Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/.cvsignore2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/META-INF/MANIFEST.MF28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/jptResourceModels.genmodel395
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/old_core.ecore549
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/old_coreModels.genmodel682
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/old_java.ecore110
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/old_orm.ecore275
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/orm.ecore469
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/orm.ecoredi9
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/persistence.ecore (renamed from jpa/plugins/org.eclipse.jpt.core/model/old_persistence.ecore)41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/persistence.ecoredi257
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/plugin.xml41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractResourceModel.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AsynchronousJpaProjectUpdater.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IContextModel.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaTransientContext.java)29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaAnnotationProvider.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaDataSource.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaEObject.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaFactory.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaFile.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaFileContentProvider.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaModel.java1
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaModelObject.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaNode.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaPlatform.java252
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaProject.java117
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaRootContentNode.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaSourceObject.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IPersistentType.java114
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IResourceModel.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IResourceModelListener.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaCoreFactory.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaCorePackage.java1390
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaDataSource.java244
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaEObject.java151
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaFile.java343
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaModel.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaModelObject.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaNode.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaProject.java388
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCorePlugin.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/NullTypeMapping.java266
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleJpaProjectConfig.java1
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleSchedulingRule.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SynchronousJpaProjectUpdater.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaAttributeMapping.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaContentNodes.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaTypeMapping.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaEObject.java128
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaJpaFileContentProvider.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaPersistentAttribute.java599
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaPersistentType.java915
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaCompilationUnit.java457
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaJavaFactory.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaJavaPackage.java785
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/AbstractJavaColumn.java695
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/AbstractJavaTable.java1114
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaBasic.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaEmbeddable.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaEmbedded.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaEmbeddedId.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaEntity.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaId.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaManyToMany.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaManyToOne.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaMappedSuperclass.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaOneToMany.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaOneToOne.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaTransient.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaVersion.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IntAnnotationElementAdapter.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAbstractQuery.java631
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAssociationOverride.java506
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeMapping.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeOverride.java268
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaBasic.java779
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaBasicProvider.java186
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaCascade.java583
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaColumn.java533
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaDiscriminatorColumn.java451
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddable.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbedded.java590
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddedId.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddedIdProvider.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddedProvider.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEntity.java3010
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaGeneratedValue.java347
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaGenerator.java569
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaId.java779
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaJoinColumn.java521
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaJoinTable.java822
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaManyToMany.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaManyToManyProvider.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaManyToOne.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaMappedSuperclass.java341
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaMultiRelationshipMapping.java811
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedColumn.java526
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedNativeQuery.java354
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedQuery.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNullAttributeMapping.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNullTypeMapping.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOneToMany.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOneToOne.java340
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOneToOneProvider.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOverride.java331
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaPrimaryKeyJoinColumn.java478
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaQueryHint.java384
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaRelationshipMapping.java704
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSecondaryTable.java557
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSequenceGenerator.java348
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSingleRelationshipMapping.java686
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTableGenerator.java1350
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTransient.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTransientProvider.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTypeMapping.java252
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaUniqueConstraint.java368
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaVersion.java408
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaVersionProvider.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsFactory.java499
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsPackage.java6595
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/util/JpaJavaMappingsAdapterFactory.java2204
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/util/JpaJavaMappingsSwitch.java3024
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/util/JpaJavaAdapterFactory.java404
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/util/JpaJavaSwitch.java444
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/AbstractXmlColumn.java921
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/AbstractXmlNamedColumn.java476
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/AbstractXmlTable.java984
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/EntityMappings.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/EntityMappingsForXml.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/EntityMappingsInternal.java1680
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/IXmlColumnMapping.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/IXmlContentNodes.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmFactory.java698
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmPackage.java10044
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmXmlJpaFileContentProvider.java151
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitDefaults.java142
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitDefaultsForXml.java142
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitDefaultsInternal.java950
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitMetadata.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitMetadataForXml.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitMetadataInternal.java532
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAssociationOverride.java281
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAttributeMapping.java374
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAttributeOverride.java327
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlBasic.java704
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlCascade.java488
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlColumn.java751
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlDiscriminatorColumn.java519
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddable.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbedded.java371
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddedIdProvider.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntity.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityForXml.java138
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityInternal.java2177
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlGenerator.java490
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlId.java682
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlIdClass.java213
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlInheritance.java213
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlJoinColumn.java461
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlJoinTable.java511
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlManyToMany.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlManyToManyProvider.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlManyToOne.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMappedSuperclass.java422
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMultiRelationshipMapping.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMultiRelationshipMappingForXml.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMultiRelationshipMappingInternal.java836
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlNamedNativeQuery.java281
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOneToMany.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOneToManyProvider.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOneToOne.java263
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOverride.java230
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlPersistentAttribute.java355
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlPersistentType.java958
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlPrimaryKeyJoinColumn.java434
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlRelationshipMapping.java577
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlRootContentNode.java367
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlSecondaryTable.java291
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlSequenceGenerator.java281
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlSingleRelationshipMapping.java483
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTable.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTableGenerator.java1070
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTransient.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTypeMapping.java674
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlUniqueConstraint.java193
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlVersion.java387
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AbstractColumnTranslator.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AbstractTableTranslator.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AccessTypeElementTranslator.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AssociationOverrideTranslator.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AssociationOverridesTranslator.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeMappingTranslator.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeMappingsTranslator.java137
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeNameTranslator.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeOverrideTranslator.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeOverridesTranslator.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/BasicTranslator.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/BooleanEnumeratorTranslator.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/CascadeTranslator.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/ColumnTranslator.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/DebugTranslator.java431
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EmbeddedTranslator.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EntityMappingsTranslator.java116
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EntityTranslator.java189
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EnumeratedTypeElementTranslator.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EnumeratorTranslator.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/GeneratedValueTranslator.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/GeneratorTranslator.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/IdTranslator.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/JoinColumnTranslator.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/JoinTableTranslator.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/ManyToManyTranslator.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/ManyToOneTranslator.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MappedSuperclassTranslator.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MultiObjectDependencyTranslator.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MultiRelationshipTranslator.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/NamedNativeQueryTranslator.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/NamedQueryTranslator.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OneToManyTranslator.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmXmlMapper.java181
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/PersistenceUnitDefaultsTranslator.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/PersistenceUnitMetadataTranslator.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/QueryHintTranslator.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/RelationshipTranslator.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SecondaryTableTranslator.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SecondaryTablesTranslator.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SingleRelationshipTranslator.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TableGeneratorTranslator.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TableTranslator.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TemporalTypeElementTranslator.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TransientTranslator.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TypeJavaClassTranslator.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TypeMappingTranslator.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TypeMappingsTranslator.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/UniqueConstraintTranslator.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/VersionTranslator.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/util/OrmAdapterFactory.java2384
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/util/OrmSwitch.java3244
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/MappingFileRef.java219
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/Persistence.java365
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceFactory.java278
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistencePackage.java1380
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceXmlJpaFileContentProvider.java153
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceXmlRootContentNode.java379
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/IPersistenceXmlContentNodes.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/PersistenceTranslator.java143
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/TransactionTypeTranslator.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/util/PersistenceAdapterFactory.java384
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/util/PersistenceSwitch.java459
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/AccessType.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/BaseJpaContent.java198
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ClassRef.java139
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/DiscriminatorType.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/EnumType.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/FetchType.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/GenerationType.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAbstractColumn.java89
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAbstractJoinColumn.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAssociationOverride.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAttributeMapping.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IAttributeMapping.java)28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAttributeOverride.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IBaseJpaContent.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IBasicMapping.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ICascade.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IClassRef.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IColumn.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IColumnMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IDiscriminatorColumn.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IEmbeddable.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/IXmlTypeMappingProvider.java)10
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IEmbeddedIdMapping.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IEmbeddedMapping.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IEntity.java196
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IFetchable.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IGeneratedValue.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IGenerator.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IIdMapping.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IJoinColumn.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IJoinColumn.java)18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IJoinTable.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IJpaContextNode.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IManyToManyMapping.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/IXmlAttributeMappingProvider.java)10
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IManyToOneMapping.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IMappedSuperclass.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IMappingFileRef.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IMultiRelationshipMapping.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INamedColumn.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INamedNativeQuery.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INamedQuery.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INonOwningMapping.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INullable.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IOneToManyMapping.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IOneToOneMapping.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IOverride.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistence.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistenceUnit.java382
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistenceXml.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistentAttribute.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IPersistentAttribute.java)77
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistentType.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPrimaryKeyJoinColumn.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IProperty.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IQuery.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IQueryHint.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlTransientContext.java)18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IRelationshipMapping.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ISecondaryTable.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ISequenceGenerator.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ISingleRelationshipMapping.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ITable.java89
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ITableGenerator.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ITransientMapping.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ITypeMapping.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/ITypeMapping.java)54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IVersionMapping.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/InheritanceType.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/JpaContextNode.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/MappingFileRef.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/Persistence.java179
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/PersistenceUnit.java978
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/PersistenceUnitTransactionType.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/PersistenceXml.java133
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/Property.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/RelationshipMappingTools.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/RelationshipMappingTools.java)2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/TemporalType.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaColumn.java299
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaQuery.java151
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java396
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IDefaultJavaAttributeMappingProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IDefaultJavaAttributeMappingProvider.java)11
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaAssociationOverride.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaAttributeMapping.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaAttributeMappingProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaAttributeMappingProvider.java)18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaAttributeOverride.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaBasicMapping.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaColumn.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaColumnMapping.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaDiscriminatorColumn.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaEmbeddable.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaEmbeddedIdMapping.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaEmbeddedMapping.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaEntity.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaGeneratedValue.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaGenerator.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/generic/GenericPlatform.java)18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaIdMapping.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INamedQuery.java)28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaJoinColumn.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaJoinTable.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaJpaContextNode.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaManyToManyMapping.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaManyToOneMapping.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaMappedSuperclass.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaMultiRelationshipMapping.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaNamedColumn.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaNamedNativeQuery.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaNamedQuery.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaOneToManyMapping.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaOneToOneMapping.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaPersistentAttribute.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaPersistentType.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaPrimaryKeyJoinColumn.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaQuery.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaQueryHint.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaRelationshipMapping.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaSecondaryTable.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaSequenceGenerator.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaSingleRelationshipMapping.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTable.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTableGenerator.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTransientMapping.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTypeMapping.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTypeMappingProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaTypeMappingProvider.java)12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaVersionMapping.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaAssociationOverride.java231
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaAttributeMapping.java157
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaAttributeOverride.java122
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMapping.java336
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMappingProvider.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaCascade.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaColumn.java134
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaContextModel.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaDiscriminatorColumn.java149
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddable.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddableProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddableProvider.java)24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedIdMapping.java318
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedIdMappingProvider.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMapping.java338
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMappingProvider.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntity.java1649
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEntityProvider.java)19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaGeneratedValue.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaGenerator.java134
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMapping.java430
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMappingProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaIdProvider.java)27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaJoinColumn.java163
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaJoinTable.java486
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToManyMapping.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToManyMappingProvider.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToOneMapping.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToOneMappingProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaManyToOneProvider.java)29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclass.java164
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaMappedSuperclassProvider.java)22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMultiRelationshipMapping.java513
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedColumn.java187
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedNativeQuery.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedQuery.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullAttributeMapping.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullAttributeMappingProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNullAttributeMappingProvider.java)23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMappingProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNullTypeMappingProvider.java)18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToManyMapping.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToManyMappingProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOneToManyProvider.java)29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToOneMapping.java213
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToOneMappingProvider.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOverride.java114
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPersistentAttribute.java300
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPersistentType.java489
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPrimaryKeyJoinColumn.java160
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaQueryHint.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaRelationshipMapping.java185
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaSecondaryTable.java255
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaSequenceGenerator.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaSingleRelationshipMapping.java350
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTable.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTableGenerator.java335
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTransientMapping.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTransientMappingProvider.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTypeMapping.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaVersionMapping.java166
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaVersionMappingProvider.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractXmlColumn.java301
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractXmlNamedColumn.java187
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractXmlQuery.java150
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractXmlTable.java310
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/EntityMappings.java122
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/EntityMappingsImpl.java703
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/IXmlAttributeMappingProvider.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/IXmlColumnMapping.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/IXmlTypeMappingProvider.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmXml.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmXmlImpl.java124
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/PersistenceUnitDefaults.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/PersistenceUnitDefaultsImpl.java207
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/PersistenceUnitMetadata.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/PersistenceUnitMetadataImpl.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlAssociationOverride.java235
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlAttributeMapping.java231
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlAttributeOverride.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlBasicMapping.java261
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlBasicMappingProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlBasicProvider.java)17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlCascade.java233
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlColumn.java203
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlDiscriminatorColumn.java181
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddable.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddableProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddableProvider.java)8
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddedIdMapping.java293
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddedIdMappingProvider.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddedMapping.java315
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddedMappingProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddedProvider.java)13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEntity.java1542
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEntityProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityProvider.java)8
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlGeneratedValue.java116
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlGenerator.java130
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlIdMapping.java338
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlIdMappingProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlIdProvider.java)18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlJoinColumn.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlJoinTable.java518
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlManyToManyMapping.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlManyToManyMappingProvider.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlManyToOneMapping.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlManyToOneMappingProvider.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlMappedSuperclass.java181
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlMappedSuperclassProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMappedSuperclassProvider.java)8
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlMultiRelationshipMapping.java228
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlNamedNativeQuery.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlNamedQuery.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlNullAttributeMapping.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlNullAttributeMappingProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlManyToOneProvider.java)18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlOneToManyMapping.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlOneToManyMappingProvider.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlOneToOneMapping.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlOneToOneMappingProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOneToOneProvider.java)19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlPersistentAttribute.java321
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlPersistentType.java820
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlPrimaryKeyJoinColumn.java141
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlQueryHint.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlRelationshipMapping.java230
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlSecondaryTable.java216
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlSequenceGenerator.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlSingleRelationshipMapping.java253
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTable.java158
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTableGenerator.java271
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTransientMapping.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTransientMappingProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTransientProvider.java)19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTypeMapping.java305
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlVersionMapping.java122
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlVersionMappingProvider.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlVersionProvider.java)19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/emfutility/ComponentUtilities.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProvider.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ASTNodeSearchUtil.java108
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ASTNodes.java726
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/Attribute.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/AttributeAnnotationTools.java216
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/BooleanExpressionConverter.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/BooleanStringExpressionConverter.java)22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ConversionDeclarationAnnotationElementAdapter.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/EnumArrayDeclarationAnnotationElementAdapter.java1
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/FieldAttribute.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/GenericVisitor.java795
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/JDTTools.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/JPTTools.java186
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/Member.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/MethodAttribute.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ModifiedDeclaration.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/NodeFinder.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/NumberIntegerExpressionConverter.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/NumberStringExpressionConverter.java)22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/Type.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/CascadeType.java338
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DefaultEagerFetchType.java262
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DefaultFalseBoolean.java261
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DefaultLazyFetchType.java262
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DefaultTrueBoolean.java261
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAbstractColumn.java211
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAbstractJoinColumn.java131
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAssociationOverride.java163
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAttributeOverride.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ICascade.java162
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IColumn.java199
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IColumnMapping.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IDiscriminatorColumn.java157
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEmbeddable.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEmbedded.java146
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEmbeddedId.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEntity.java694
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IGenerator.java177
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IJoinTable.java308
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IManyToMany.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IManyToOne.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IMappedSuperclass.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IMultiRelationshipMapping.java179
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INamedColumn.java175
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INamedNativeQuery.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INonOwningMapping.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IOneToMany.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IOverride.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IRelationshipMapping.java164
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISecondaryTable.java139
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISequenceGenerator.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISingleRelationshipMapping.java219
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITable.java286
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITableGenerator.java428
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IUniqueConstraint.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IVersion.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/JpaCoreMappingsFactory.java373
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/JpaCoreMappingsPackage.java8840
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/OrderingType.java237
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/util/JpaCoreMappingsAdapterFactory.java1004
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/util/JpaCoreMappingsSwitch.java1383
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/AbstractJoinColumnContext.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/AssociationOverrideContext.java133
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/AttributeOverrideContext.java143
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseContext.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseJpaFactory.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseJpaPlatform.java403
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseJpaProjectContext.java401
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/ColumnContext.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/DefaultsContext.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GeneratorRepository.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/IContext.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/IGeneratorRepository.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaAttributeContext.java145
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaBasicContext.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEmbeddableContext.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEmbeddedContext.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEmbeddedIdContext.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEntityContext.java307
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaIdContext.java118
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaManyToManyContext.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaManyToOneContext.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaMappedSuperclassContext.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaMultiRelationshipMappingContext.java196
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaNullAttributeMappingContext.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaNullTypeMappingContext.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaOneToManyContext.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaOneToOneContext.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaPersistentAttributeContext.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaRelationshipMappingContext.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaSingleRelationshipMappingContext.java139
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaTypeContext.java124
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaVersionContext.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JoinColumnContext.java136
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JoinTableContext.java226
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JpaPlatformRegistry.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformRegistry.java)4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/MappingFileContext.java174
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/NullGeneratorRepository.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/PersistenceUnitContext.java613
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/PrimaryKeyJoinColumnContext.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/SecondaryTableContext.java109
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/TableContext.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/TypeContext.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlAttributeContext.java183
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlAttributeOverrideContext.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlBasicContext.java126
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlEmbeddableContext.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlEmbeddedContext.java133
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlEntityContext.java417
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlIdContext.java179
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlManyToManyContext.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlManyToOneContext.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlMappedSuperclassContext.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlMultiRelationshipMappingContext.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlNullAttributeMappingContext.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlOneToManyContext.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlOneToOneContext.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlRelationshipMappingContext.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlSingleRelationshipMappingContext.java195
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlTypeContext.java406
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlVersionContext.java130
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/base/BaseJpaAnnotationProvider.java326
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/base/BaseJpaFactory.java424
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/base/BaseJpaPlatform.java275
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/base/IJpaBaseContextFactory.java182
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/generic/GenericJpaAnnotationProvider.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/generic/GenericJpaFactory.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/generic/GenericJpaPlatform.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/IJpaEObject.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/JpaArtifactEdit.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/JpaEObject.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/XmlEObject.java)230
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/JpaXmlResource.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/PersistenceResource.java)94
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/JpaXmlResourceModel.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/translators/BooleanTranslator.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/BooleanTranslator.java)21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractAnnotationResource.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractColumn.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractColumnImpl.java215
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractJavaPersistentResource.java486
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractMemberResource.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractNamedColumn.java137
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractNamedQuery.java296
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractRelationshipMappingAnnotation.java279
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractResource.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractTableResource.java324
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AccessType.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Annotation.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AnnotationDefinition.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverride.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrideImpl.java274
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrides.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverridesImpl.java146
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverride.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrideImpl.java154
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrides.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverridesImpl.java147
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Basic.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/BasicImpl.java142
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/CascadeType.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Column.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ColumnImpl.java226
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ContainerAnnotation.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ContainerAnnotationTools.java195
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumn.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumnImpl.java154
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorType.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValue.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValueImpl.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Embeddable.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddableImpl.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Embedded.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedId.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedIdImpl.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedImpl.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Entity.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EntityImpl.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumType.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Enumerated.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedImpl.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/FetchType.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValue.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValueImpl.java139
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GenerationType.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Generator.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratorImpl.java152
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Id.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClass.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClassImpl.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdImpl.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Inheritance.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceImpl.java105
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceType.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JPA.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JPA.java)6
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentAttributeResource.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentAttributeResourceImpl.java402
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentResource.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentTypeResource.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentTypeResourceImpl.java484
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaResource.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaResourceModel.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumn.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnImpl.java214
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumns.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlEmbeddedIdContext.java)12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnsImpl.java150
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTable.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTableImpl.java379
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JpaCompilationUnitResource.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Lob.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/LobImpl.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToMany.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToManyImpl.java156
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOne.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOneImpl.java155
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKey.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKeyImpl.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclass.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclassImpl.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedColumn.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueries.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueriesImpl.java149
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQuery.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueryImpl.java218
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueries.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueriesImpl.java148
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQuery.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueryImpl.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAnnotation.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAssociationOverride.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAttributeOverride.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableJoinColumn.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableNamedNativeQuery.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableNamedQuery.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestablePrimaryKeyJoinColumn.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableQueryHint.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableSecondaryTable.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableUniqueConstraint.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAbstractColumn.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAbstractTable.java137
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAssociationOverride.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverride.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBasic.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumn.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumn.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValue.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumerated.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritance.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinColumn.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTable.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumn.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullPrimaryKeyJoinColumn.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTable.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrderByTranslator.java)19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporal.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToMany.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToManyImpl.java152
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOne.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOneImpl.java193
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderBy.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderByImpl.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideImpl.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideResource.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumn.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnImpl.java173
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumns.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnsImpl.java150
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Query.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/QueryHint.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/QueryHintImpl.java148
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/RelationshipMapping.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTable.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTableImpl.java306
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTables.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTablesImpl.java153
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGenerator.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGeneratorImpl.java141
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Table.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGenerator.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGeneratorImpl.java455
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableImpl.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTable.java)92
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Temporal.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalImpl.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalType.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Transient.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TransientImpl.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/UniqueConstraint.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/UniqueConstraintImpl.java161
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Version.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/VersionImpl.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AbstractColumn.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AbstractTable.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AccessType.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AccessType.java)125
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AssociationOverride.java264
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AttributeMapping.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AttributeOverride.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IQueryHint.java)62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AttributeOverrideImpl.java286
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Attributes.java602
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Basic.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IBasic.java)104
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/BasicImpl.java660
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/CascadeType.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/CascadeTypeImpl.java456
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Column.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ColumnImpl.java794
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ColumnMapping.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ColumnResult.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMapKey.java)125
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/DiscriminatorColumn.java396
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/DiscriminatorType.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DiscriminatorType.java)161
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Embeddable.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddedId.java)46
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Embedded.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EmbeddedId.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EmbeddedIdImpl.java255
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EmbeddedImpl.java255
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Entity.java1919
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EntityListener.java793
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EntityListeners.java179
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EntityMappings.java1073
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EntityResult.java332
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EnumType.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/EnumType.java)138
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EventMethod.java196
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/FetchType.java229
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/FieldResult.java264
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/GeneratedValue.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IGeneratedValue.java)75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/GeneratedValueImpl.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlGeneratedValue.java)238
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/GenerationType.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/GenerationType.java)197
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Generator.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Id.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IId.java)90
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/IdClass.java196
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/IdImpl.java636
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Inheritance.java196
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/InheritanceType.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/InheritanceType.java)161
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/JoinColumn.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/JoinColumnImpl.java657
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/JoinTable.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/JoinTableImpl.java474
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Lob.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlNullAttributeMapping.java)36
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ManyToMany.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IPrimaryKeyJoinColumn.java)14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ManyToManyImpl.java718
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ManyToOne.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IOneToOne.java)15
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ManyToOneImpl.java620
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/MapKey.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/MapKeyImpl.java188
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/MappedSuperclass.java1034
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/MultiRelationshipMapping.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/NamedColumn.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/NamedNativeQuery.java464
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/NamedQuery.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/AbstractXmlQuery.java)183
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OneToMany.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OneToManyImpl.java769
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OneToOne.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OneToOneImpl.java733
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmArtifactEdit.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmFactory.java1041
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmPackage.java12851
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmResource.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmResourceFactory.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmResourceModel.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PersistenceUnitDefaults.java499
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PersistenceUnitMetadata.java295
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PostLoad.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlNamedQuery.java)20
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PostPersist.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PostRemove.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PostUpdate.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PrePersist.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PreRemove.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PreUpdate.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PrimaryKeyJoinColumn.java328
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Query.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IQuery.java)41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/QueryHint.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlQueryHint.java)149
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/RelationshipMapping.java142
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SecondaryTable.java434
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SequenceGenerator.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SequenceGeneratorImpl.java389
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SingleRelationshipMapping.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SqlResultSetMapping.java311
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Table.java383
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TableGenerator.java210
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TableGeneratorImpl.java791
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TemporalType.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/TemporalType.java)160
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Transient.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITransient.java)14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TransientImpl.java188
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TypeMapping.java498
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/UniqueConstraint.java177
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Version.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VersionImpl.java390
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualAttributeOverride.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualBasic.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualCascadeType.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualColumn.java141
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualEmbedded.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualEmbeddedId.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualGeneratedValue.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualId.java125
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualJoinColumn.java119
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualJoinTable.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualManyToMany.java175
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualManyToOne.java152
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualMapKey.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualOneToMany.java175
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualOneToOne.java187
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualSequenceGenerator.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualTableGenerator.java139
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualTransient.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualVersion.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/AssociationOverrideTranslator.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/AttributeOverrideTranslator.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/AttributesTranslator.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/BasicTranslator.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/CascadeTypeTranslator.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/ColumnResultTranslator.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/ColumnTranslator.java90
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/DiscriminatorColumnTranslator.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/DiscriminatorColumnTranslator.java)46
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EmbeddableTranslator.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EmbeddedIdTranslator.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OneToOneTranslator.java)42
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EmbeddedTranslator.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EmptyTagBooleanTranslator.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EmptyTagBooleanTranslator.java)4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityListenerTranslator.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityListenersTranslator.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityMappingsTranslator.java120
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityResultTranslator.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityTranslator.java188
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EventMethodTranslator.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/FieldResultTranslator.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/GeneratedValueTranslator.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/InheritanceTranslator.java)32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/IdClassTranslator.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/IdClassTranslator.java)33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/IdTranslator.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/InheritanceTranslator.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/JoinColumnTranslator.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/JoinTableTranslator.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/ManyToManyTranslator.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/ManyToOneTranslator.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/MapKeyTranslator.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MapKeyTranslator.java)31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/MappedSuperclassTranslator.java118
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/NamedNativeQueryTranslator.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/NamedQueryTranslator.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/OneToManyTranslator.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/OneToOneTranslator.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/OrmXmlMapper.java126
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/PersistenceUnitDefaultsTranslator.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/PersistenceUnitMetadataTranslator.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/PrimaryKeyJoinColumnTranslator.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/PrimaryKeyJoinColumnTranslator.java)41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/QueryHintTranslator.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SequenceGeneratorTranslator.java)34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/SecondaryTableTranslator.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/SequenceGeneratorTranslator.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/SqlResultSetMappingTranslator.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/TableGeneratorTranslator.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/TableTranslator.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/TransientTranslator.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EmbeddedIdTranslator.java)35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/UniqueConstraintTranslator.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EmbeddableTranslator.java)38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/VersionTranslator.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/util/OrmAdapterFactory.java1812
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/util/OrmSwitch.java2159
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceArtifactEdit.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceFactory.java287
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistencePackage.java1320
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceResource.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceResourceFactory.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceResourceModel.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlJavaClassRef.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/JavaClassRef.java)122
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlMappingFileRef.java199
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlPersistence.java273
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlPersistenceUnit.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceUnit.java)650
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlPersistenceUnitTransactionType.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceUnitTransactionType.java)105
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlProperties.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/Properties.java)102
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlProperty.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/Property.java)130
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/JavaClassRefTranslator.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/JavaClassRefTranslator.java)15
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/MappingFileTranslator.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/MappingFileTranslator.java)27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PersistenceTranslator.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PersistenceUnitTranslator.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PersistenceXmlMapper.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/PersistenceXMLMapper.java)45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PropertiesTranslator.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PropertyTranslator.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/util/PersistenceAdapterFactory.java244
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/util/PersistenceSwitch.java266
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/synch/SynchronizeClassesJob.java187
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/util/JpaCoreAdapterFactory.java424
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/util/JpaCoreSwitch.java546
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.db.ui/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Catalog.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Column.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ConnectionProfile.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ConnectionProfileRepository.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileWrapper.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionWrapper.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseWrapper.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Database.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ForeignKey.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/NullConnectionProfile.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/NullDatabase.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Schema.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Sequence.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Table.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.gen/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/EntityGenerator.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/GenScope.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/GenTable.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/.options14
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF15
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/jpa-content.gifbin0 -> 896 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/jpa-file.gifbin0 -> 968 bytes
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/plugin.properties1
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/plugin.xml90
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui.properties11
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties67
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_xml.properties5
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaUiFactory.java191
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/GenericJpaUiFactory.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaPlatformUi.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaUiFactory.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JpaCompletionProposalComputer.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JpaMappingImageHelper.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiIcons.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiMessages.java171
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiPlugin.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/Tracing.java177
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAction.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAndMapAction.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentClassAction.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/PersistentAttributeActionFilter.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/ProjectAction.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentAttributeFromXmlAction.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentClassAction.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/XmlPersistentAttributeActionFilter.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaComposite.java105
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaController.java172
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaDetailsPage.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaComposite.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsPage.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsProvider.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PageBookManager.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentAttributeDetailsPage.java479
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentTypeDetailsPage.java365
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentClassDialog.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/IAttributeMappingUiProvider.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/ITypeMappingUiProvider.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaDetailsProvider.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java130
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentTypeDetailsPage.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/BasicMappingUiProvider.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultBasicMappingUiProvider.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultEmbeddedMappingUiProvider.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddableUiProvider.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedIdMappingUiProvider.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedMappingUiProvider.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EntityUiProvider.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/IdMappingUiProvider.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToManyMappingUiProvider.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToOneMappingUiProvider.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/MappedSuperclassUiProvider.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullAttributeMappingUiProvider.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullTypeMappingUiProvider.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToManyMappingUiProvider.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToOneMappingUiProvider.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/TransientMappingUiProvider.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/VersionMappingUiProvider.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaCompilationUnitItemProvider.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaPersistentAttributeItemProvider.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaPersistentTypeItemProvider.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaStructureProvider.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JpaCoreJavaItemProviderAdapterFactory.java176
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/AbstractItemLabelProvider.java153
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/AbstractTreeItemContentProvider.java207
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/DelegatingContentAndLabelProvider.java172
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/DelegatingTreeContentAndLabelProvider.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/IItemContentProvider.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/IItemContentProviderFactory.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/IItemLabelProvider.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/IItemLabelProviderFactory.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/ITreeItemContentProvider.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/ITreeItemContentProviderFactory.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullLabelProvider.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullTreeContentProvider.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsImages.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/AbstractDatabaseObjectCombo.java462
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/CatalogCombo.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/ColumnCombo.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/SchemaCombo.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/SequenceCombo.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/TableCombo.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnDialog.java207
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnDialogPane.java204
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnStateObject.java163
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicComposite.java357
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicMappingComposite.java125
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CascadeComposite.java498
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CatalogCombo.java304
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ColumnComposite.java769
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CommonWidgets.java286
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddableComposite.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedAttributeOverridesComposite.java565
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedComposite.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedIdComposite.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedIdMappingComposite.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedMappingComposite.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityComposite.java319
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityNameCombo.java208
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumComboViewer.java206
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumTypeComposite.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/FetchTypeComposite.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratedValueComposite.java481
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GenerationComposite.java268
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratorComposite.java318
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdComposite.java459
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdMappingComposite.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InheritanceComposite.java754
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InverseJoinColumnDialog.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InverseJoinColumnDialogPane.java118
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnComposite.java661
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialog.java225
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialogPane.java193
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInAssociationOverrideDialog.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInAssociationOverrideStateObject.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInJoinTableDialog.java90
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInJoinTableStateObject.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInRelationshipMappingDialog.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInRelationshipMappingStateObject.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnStateObject.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnsComposite.java476
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinTableComposite.java743
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/LobCheckBox.java129
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/LobComposite.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyComposite.java184
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyMappingComposite.java151
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToOneComposite.java145
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToOneMappingComposite.java116
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedByCombo.java162
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedByComposite.java177
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedSuperclassComposite.java126
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToManyComposite.java187
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToManyMappingComposite.java151
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToOneComposite.java226
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToOneMappingComposite.java125
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OptionalComposite.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OrderingComposite.java449
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OverridesComposite.java798
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnDialog.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnDialogPane.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnInSecondaryTableDialog.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnInSecondaryTableStateObject.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnStateObject.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsComposite.java596
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsInSecondaryTableComposite.java672
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SchemaCombo.java327
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTableDialog.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTablesComposite.java485
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SequenceGeneratorComposite.java269
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/StringWithDefaultChooser.java274
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableCombo.java338
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableComposite.java315
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableGeneratorComposite.java657
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TargetEntityChooser.java226
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TargetEntityComposite.java241
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TemporalTypeComposite.java108
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TransientComposite.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TransientMappingComposite.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionComposite.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionMappingComposite.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/navigator/JpaNavigatorContentProvider.java258
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/navigator/JpaNavigatorLabelProvider.java185
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/JpaPlatformUiRegistry.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/PlatformRegistry.java)12
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/BaseJpaNavigatorContentProvider.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/BaseJpaNavigatorLabelProvider.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/BaseJpaPlatformUi.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaPlatformUi.java)151
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/EntitiesGenerator.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/generic/EntitiesGenerator.java)30
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/generic/GenericPlatformUi.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/generic/GenericPlatformUi.java)17
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/properties/JpaProjectPropertiesPage.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/IJpaSelection.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/IJpaSelectionManager.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/ISelectionManager.java)10
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/IJpaSelectionParticipant.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/ISelectionParticipant.java)6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaDetailsSelectionParticipant.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaSelection.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/Selection.java)63
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaSelectionEvent.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionEvent.java)8
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaSelectionManager.java (renamed from jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionManager.java)107
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaStructureSelectionParticipant.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionManagerFactory.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionParticipantFactory.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/TextEditorSelectionParticipant.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/GeneralJpaMappingItemContentProviderFactory.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/GeneralJpaMappingItemLabelProviderFactory.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/IJpaStructureProvider.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/JavaItemContentProviderFactory.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/JavaItemLabelProviderFactory.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/JavaResourceModelStructureProvider.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/JpaStructureProviderFactory.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/OrmItemContentProviderFactory.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/OrmItemLabelProviderFactory.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/OrmResourceModelStructureProvider.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/PersistenceItemContentProviderFactory.java175
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/PersistenceItemLabelProviderFactory.java139
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/PersistenceResourceModelStructureProvider.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/ResourceModelStructureProvider.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/swt/BooleanButtonModelAdapter.java209
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/swt/ListBoxModelAdapter.java588
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/swt/TriStateBooleanButtonModelAdapter.java179
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/AbstractControlEnabler.java284
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/ControlAligner.java912
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/ControlEnabler.java170
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledButton.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledControl.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledControlUpdater.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledLabel.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledTableItem.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/PaneEnabler.java168
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/SWTUtil.java261
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/TableLayoutComposite.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/AbstractJpaView.java155
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaDetailsView.java293
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaStructureView.java218
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/structure/JpaStructurePage.java231
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/structure/JpaStructureView.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractDialog.java240
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractDialogPane.java171
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractFormPane.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractPane.java2108
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractValidatingDialog.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AddRemoveListPane.java250
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AddRemovePane.java588
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/EnumComboViewer.java361
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/NullPostExecution.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/PostExecution.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/TriStateCheckBox.java351
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/DatabaseReconnectWizardPage.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/GenerateEntitiesWizard.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/JpaFacetWizardPage.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/JptUiXmlMessages.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/AccessTypeComboViewer.java184
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/AccessTypeComposite.java109
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/CascadePersistCheckBox.java128
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/CommonWidgets.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/MetaDataCompleteComboViewer.java211
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/PersistenceUnitMetadataComposite.java277
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/PersistenceUnitMetadataSection.java285
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlDetailsProvider.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlEntityMappingsDetailsPage.java467
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaAttributeChooser.java156
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaClassChooser.java161
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlMappingMetadataCompleteCheckBox.java128
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPackageChooser.java176
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentAttributeDetailsPage.java270
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentTypeDetailsPage.java244
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/EntityMappingsItemProvider.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/JpaCoreXmlItemProviderAdapterFactory.java197
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlPersistentAttributeItemProvider.java116
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlPersistentTypeItemProvider.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlRootContentNodeItemProvider.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlStructureProvider.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/ClassTools.java284
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/Classpath.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/CollectionTools.java632
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/FileTools.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/IndentingPrintWriter.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/JDBCTools.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/JDBCType.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/JavaType.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/NameTools.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/ReverseComparator.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SimpleStack.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SimpleStringMatcher.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/StringMatcher.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/StringTools.java1168
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SynchronizedBoolean.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SynchronizedObject.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SynchronizedStack.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CloneIterator.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CloneListIterator.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CompositeListIterator.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/EmptyIterator.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/EmptyListIterator.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/FilteringIterator.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyCompositeListIterator.java179
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/AbstractModel.java90
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/event/CollectionChangeEvent.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/event/ListChangeEvent.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/event/TreeChangeEvent.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AbstractTreeNodeValueModel.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AspectAdapter.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AspectPropertyValueModelAdapter.java178
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/BufferedWritablePropertyValueModel.java343
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionAspectAdapter.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionListValueModelAdapter.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionPropertyValueModelAdapter.java142
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionValueModel.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionValueModelWrapper.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CompositeCollectionValueModel.java130
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ExtendedListValueModelWrapper.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/FilteringCollectionValueModel.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/FilteringPropertyValueModel.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/FilteringWritablePropertyValueModel.java124
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemAspectListValueModelAdapter.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemCollectionListValueModelAdapter.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemListListValueModelAdapter.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemPropertyListValueModelAdapter.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemStateListValueModelAdapter.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemTreeListValueModelAdapter.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListAspectAdapter.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListCollectionValueModelAdapter.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListCurator.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListPropertyValueModelAdapter.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListValueModel.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListValueModelWrapper.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullCollectionValueModel.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullListValueModel.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullPropertyValueModel.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullTreeValueModel.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyAspectAdapter.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyCollectionValueModelAdapter.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyValueModel.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyValueModelWrapper.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SimpleCollectionValueModel.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SimpleListValueModel.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SimplePropertyValueModel.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SortedListValueModelAdapter.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StatePropertyValueModelAdapter.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StaticCollectionValueModel.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StaticListValueModel.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StaticPropertyValueModel.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StaticTreeValueModel.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TransformationListValueModelAdapter.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TransformationPropertyValueModel.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TransformationWritablePropertyValueModel.java126
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreeAspectAdapter.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreeNodeValueModel.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreePropertyValueModelAdapter.java136
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreeValueModel.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueAspectAdapter.java162
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueCollectionAdapter.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueListAdapter.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValuePropertyAdapter.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueStateAdapter.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueTreeAdapter.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/WritablePropertyValueModel.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/prefs/PreferencePropertyValueModel.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/prefs/PreferencesCollectionValueModel.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/AbstractTreeModel.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/CheckBoxModelAdapter.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ColumnAdapter.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ComboBoxModelAdapter.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/DateSpinnerModelAdapter.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/DocumentAdapter.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ListModelAdapter.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ListSpinnerModelAdapter.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/NumberSpinnerModelAdapter.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ObjectListSelectionModel.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/PrimitiveListTreeModel.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/RadioButtonModelAdapter.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/SpinnerModelAdapter.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/TableModelAdapter.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ToggleButtonModelAdapter.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/TreeModelAdapter.java149
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/node/AbstractNode.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/node/PluggableValidator.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/CheckBoxTableCellRenderer.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/ComboBoxTableCellRenderer.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/FilteringListBrowser.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/FilteringListPanel.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/ListChooser.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/SpinnerTableCellRenderer.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/META-INF/MANIFEST.MF2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/META-INF/MANIFEST.MF19
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java13
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JavaEntityTests.java103
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JpaJavaTestCase.java72
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JptCoreContentJavaMappingsTests.java34
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/ContextModelTestCase.java192
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JptCoreContextModelTests.java38
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAssociationOverrideTests.java179
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAttributeOverrideTests.java262
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java1000
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaColumnTests.java849
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java327
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddableTests.java187
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java615
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedMappingTests.java618
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java2440
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaGeneratedValueTests.java160
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java724
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinTableTests.java851
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToManyMappingTests.java872
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToOneMappingTests.java884
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaMappedSuperclassTests.java243
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedNativeQueryTests.java424
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedQueryTests.java329
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToManyMappingTests.java876
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToOneMappingTests.java1026
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPersistentAttributeTests.java226
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPersistentTypeTests.java701
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java319
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaQueryHintTests.java164
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSecondaryTableTests.java496
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSequenceGeneratorTests.java270
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java469
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java338
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTransientMappingTests.java259
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java413
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JptCoreContextJavaModelTests.java61
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java1066
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/JptCoreOrmContextModelTests.java65
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java111
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java369
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java105
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlAssociationOverrideTests.java251
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlAttributeOverrideTests.java96
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlBasicMappingTests.java568
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlCascadeTests.java280
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlColumnTests.java698
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlDiscriminatorColumnTests.java353
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddableTests.java305
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddedIdMappingTests.java231
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddedMappingTests.java502
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEntityTests.java1901
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlGeneratedValueTests.java129
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlIdMappingTests.java620
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlJoinColumnTests.java564
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlJoinTableTests.java781
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlManyToManyMappingTests.java349
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlManyToOneMappingTests.java571
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlMappedSuperclassTests.java356
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlNamedNativeQueryTests.java358
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlNamedQueryTests.java273
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlOneToManyMappingTests.java354
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlOneToOneMappingTests.java610
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlPersistentTypeTests.java518
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlPrimaryKeyJoinColumnTests.java308
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlQueryHintTests.java122
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlSecondaryTableTests.java497
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlSequenceGeneratorTests.java223
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTableGeneratorTests.java373
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTableTests.java485
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTransientMappingTests.java163
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlVersionMappingTests.java335
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/BaseJpaContentTests.java94
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/ClassRefTests.java114
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/JptCorePersistenceContextModelTests.java37
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/MappingFileRefTests.java97
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceTests.java123
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java960
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceXmlTests.java92
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/AnnotationTestCase.java72
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/MemberAnnotationElementAdapterTests.java114
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/TypeTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java190
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/BaseJpaPlatformTests.java81
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/JptCorePlatformTests.java35
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJpaProject.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/JptCoreResourceModelTests.java36
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/OrmModelTests.java46
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/PersistenceModelTests.java46
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverrideTests.java283
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverridesTests.java355
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverrideTests.java176
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverridesTests.java303
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/BasicTests.java154
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ColumnTests.java423
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorColumnTests.java225
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorValueTests.java84
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddableTests.java76
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedIdTests.java50
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedTests.java50
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EntityTests.java128
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java91
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/GeneratedValueTests.java144
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdClassTests.java118
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdTests.java50
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/InheritanceTests.java86
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JPTToolsTests.java527
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaPersistentAttributeResourceTests.java825
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaPersistentTypeResourceTests.java977
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourceModelTestCase.java141
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnTests.java369
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnsTests.java444
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinTableTests.java711
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JpaCompilationUnitResourceTests.java77
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JptJavaResourceTests.java80
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/LobTests.java49
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToManyTests.java413
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToOneTests.java405
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MapKeyTests.java89
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MappedSuperclassTests.java76
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueriesTests.java452
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueryTests.java367
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueriesTests.java361
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueryTests.java282
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToManyTests.java415
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToOneTests.java466
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OrderByTests.java88
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java197
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java268
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/QueryHintTests.java77
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTableTests.java477
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTablesTests.java550
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SequenceGeneratorTests.java242
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableGeneratorTests.java532
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableTests.java358
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TemporalTests.java91
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TransientTests.java50
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/VersionTests.java49
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/.classpath2
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/META-INF/MANIFEST.MF1
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTestsPlugin.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/DTPPlatformTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Derby101Tests.java13
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/MySQL41Tests.java10
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gTests.java10
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gXETests.java10
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle9iTests.java10
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/PostgreSQL824Tests.java10
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/SQLServer2005Tests.java11
-rw-r--r--jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Sybase12Tests.java10
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/jface/DelegatingLabelProviderUiTest.java590
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/jface/DelegatingTreeContentProviderUiTest.java570
-rw-r--r--jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/platform/JpaPlatformUiExtensionTests.java16
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/ClassToolsTests.java101
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/ClasspathTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/CollectionToolsTests.java38
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/IndentingPrintWriterTests.java22
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/JDBCTypeTests.java10
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/JavaTypeTests.java30
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/StringToolsTests.java164
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/CompositeIteratorTests.java18
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/CompositeListIteratorTests.java95
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/FilteringIteratorTests.java49
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/JptUtilityIteratorsTests.java3
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/ReadOnlyCompositeListIteratorTests.java205
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/AbstractModelTests.java5
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/BufferedWritablePropertyValueModelTests.java410
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionAspectAdapterTests.java90
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionListValueModelAdapterTests.java68
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionPropertyValueModelAdapterTests.java72
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CompositeCollectionValueModelTests.java112
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CoordinatedBag.java149
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CoordinatedList.java256
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ExtendedListValueModelWrapperTests.java63
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/FilteringCollectionValueModelTests.java108
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/FilteringPropertyValueModelTests.java46
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemCollectionListValueModelAdapterTests.java123
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemListListValueModelAdapterTests.java126
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemPropertyListValueModelAdapterTests.java135
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemStateListValueModelAdapterTests.java120
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/JptUtilityModelValueTests.java16
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListAspectAdapterTests.java137
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListCollectionValueModelAdapterTests.java81
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListCuratorTests.java67
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullCollectionValueModelTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullListValueModelTests.java10
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullPropertyValueModelTests.java16
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/PropertyAspectAdapterTests.java88
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/PropertyCollectionValueModelAdapterTests.java44
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimpleCollectionValueModelTests.java43
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimpleListValueModelTests.java45
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimplePropertyValueModelTests.java14
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SortedListValueModelAdapterTests.java51
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/StaticCollectionValueModelTests.java63
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/StaticListValueModelTests.java66
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/StaticValueModelTests.java19
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/TransformationListValueModelAdapterTests.java80
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/TransformationPropertyValueModelTests.java46
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/TreeAspectAdapterTests.java28
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ValueCollectionAdapterTests.java158
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ValueListAdapterTests.java169
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ValuePropertyAdapterTests.java144
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ValueStateAdapterTests.java144
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencePropertyValueModelTests.java86
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencesCollectionValueModelTests.java52
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencesTestCase.java8
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/CheckBoxModelAdapterTests.java22
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/CheckBoxModelAdapterUITest.java53
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ComboBoxModelAdapterTests.java22
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest.java28
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest2.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/DateSpinnerModelAdapterTests.java20
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/DocumentAdapterTests.java22
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/DocumentAdapterUITest.java26
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListModelAdapterTests.java84
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListModelAdapterUITest.java85
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListSpinnerModelAdapterTests.java18
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/NumberSpinnerModelAdapterTests.java20
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ObjectListSelectionModelTests.java14
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/PrimitiveListTreeModelTests.java36
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/RadioButtonModelAdapterTests.java24
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/RadioButtonModelAdapterUITest.java22
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ReadOnlyTableModelAdapterUITest.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/SpinnerModelAdapterTests.java22
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/SpinnerModelAdapterUITest.java53
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TableModelAdapterTests.java135
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TableModelAdapterUITest.java143
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TreeModelAdapterTests.java210
-rw-r--r--jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TreeModelAdapterUITest.java36
1585 files changed, 180079 insertions, 139737 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/.cvsignore b/jpa/plugins/org.eclipse.jpt.core/.cvsignore
index a196dd7686..31362a7d19 100644
--- a/jpa/plugins/org.eclipse.jpt.core/.cvsignore
+++ b/jpa/plugins/org.eclipse.jpt.core/.cvsignore
@@ -3,4 +3,4 @@ bin
temp.folder
build.xml
javaCompiler...args
-javaCompiler...args.* \ No newline at end of file
+javaCompiler...args.*
diff --git a/jpa/plugins/org.eclipse.jpt.core/.settings/org.eclipse.core.resources.prefs b/jpa/plugins/org.eclipse.jpt.core/.settings/org.eclipse.core.resources.prefs
index a8d148b02f..56f01c3c10 100644
--- a/jpa/plugins/org.eclipse.jpt.core/.settings/org.eclipse.core.resources.prefs
+++ b/jpa/plugins/org.eclipse.jpt.core/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +1,3 @@
-#Sun May 27 15:09:44 EDT 2007
+#Tue Jan 15 11:10:33 EST 2008
eclipse.preferences.version=1
encoding/<project>=ISO-8859-1
diff --git a/jpa/plugins/org.eclipse.jpt.core/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.core/META-INF/MANIFEST.MF
index 2db18eec21..375997d936 100644
--- a/jpa/plugins/org.eclipse.jpt.core/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.core/META-INF/MANIFEST.MF
@@ -35,25 +35,25 @@ Require-Bundle: org.eclipse.core.commands,
org.eclipse.wst.xml.core,
org.eclipse.xsd
Export-Package: org.eclipse.jpt.core.internal;x-friends:="org.eclipse.jpt.ui",
- org.eclipse.jpt.core.internal.content.java;x-friends:="org.eclipse.jpt.ui",
- org.eclipse.jpt.core.internal.content.java.mappings;x-friends:="org.eclipse.jpt.ui,org.eclipse.jpt.gen",
- org.eclipse.jpt.core.internal.content.java.mappings.util;x-friends:="org.eclipse.jpt.ui",
- org.eclipse.jpt.core.internal.content.java.util;x-friends:="org.eclipse.jpt.ui",
- org.eclipse.jpt.core.internal.content.orm;x-friends:="org.eclipse.jpt.ui",
- org.eclipse.jpt.core.internal.content.orm.resource;x-friends:="org.eclipse.jpt.ui",
- org.eclipse.jpt.core.internal.content.orm.util;x-friends:="org.eclipse.jpt.ui",
- org.eclipse.jpt.core.internal.content.persistence;x-friends:="org.eclipse.jpt.ui",
- org.eclipse.jpt.core.internal.content.persistence.resource;x-friends:="org.eclipse.jpt.ui",
- org.eclipse.jpt.core.internal.content.persistence.util;x-friends:="org.eclipse.jpt.ui",
- org.eclipse.jpt.core.internal.emfutility;x-internal:=true,
+ org.eclipse.jpt.core.internal.context.base;x-friends:="org.eclipse.jpt.ui",
+ org.eclipse.jpt.core.internal.context.java;x-friends:="org.eclipse.jpt.ui",
+ org.eclipse.jpt.core.internal.context.orm;x-friends:="org.eclipse.jpt.ui",
+ org.eclipse.jpt.core.internal.emfutility;x-friends:="org.eclipse.jpt.ui",
org.eclipse.jpt.core.internal.facet;x-friends:="org.eclipse.jpt.ui",
org.eclipse.jpt.core.internal.jdtutility;x-friends:="org.eclipse.jpt.ui",
- org.eclipse.jpt.core.internal.mappings;x-friends:="org.eclipse.jpt.ui",
- org.eclipse.jpt.core.internal.mappings.util;x-friends:="org.eclipse.jpt.ui",
org.eclipse.jpt.core.internal.platform;x-friends:="org.eclipse.jpt.ui",
+ org.eclipse.jpt.core.internal.platform.base;x-friends:="org.eclipse.jpt.ui",
org.eclipse.jpt.core.internal.platform.generic;x-friends:="org.eclipse.jpt.ui",
org.eclipse.jpt.core.internal.prefs;x-friends:="org.eclipse.jpt.ui",
+ org.eclipse.jpt.core.internal.resource.common;x-friends:="org.eclipse.jpt.ui",
+ org.eclipse.jpt.core.internal.resource.common.translators;x-friends:="org.eclipse.jpt.ui",
+ org.eclipse.jpt.core.internal.resource.java;x-friends:="org.eclipse.jpt.ui,org.eclipse.jpt.gen",
+ org.eclipse.jpt.core.internal.resource.orm;x-friends:="org.eclipse.jpt.ui",
+ org.eclipse.jpt.core.internal.resource.orm.translators;x-friends:="org.eclipse.jpt.ui",
+ org.eclipse.jpt.core.internal.resource.orm.util;x-friends:="org.eclipse.jpt.ui",
+ org.eclipse.jpt.core.internal.resource.persistence;x-friends:="org.eclipse.jpt.ui",
+ org.eclipse.jpt.core.internal.resource.persistence.translators;x-friends:="org.eclipse.jpt.ui",
+ org.eclipse.jpt.core.internal.resource.persistence.util;x-friends:="org.eclipse.jpt.ui",
org.eclipse.jpt.core.internal.synch;x-friends:="org.eclipse.jpt.ui",
- org.eclipse.jpt.core.internal.util;x-friends:="org.eclipse.jpt.ui",
org.eclipse.jpt.core.internal.validation;x-friends:="org.eclipse.jpt.ui"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/jptResourceModels.genmodel b/jpa/plugins/org.eclipse.jpt.core/model/jptResourceModels.genmodel
new file mode 100644
index 0000000000..c57db26c6c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/model/jptResourceModels.genmodel
@@ -0,0 +1,395 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.jpt.core/src"
+ creationCommands="false" creationIcons="false" editDirectory="" editorDirectory=""
+ modelPluginID="org.eclipse.jpt.core" modelName="Core" editPluginClass="" editorPluginClass=""
+ rootExtendsInterface="org.eclipse.jpt.core.internal.resource.common.IJpaEObject"
+ rootExtendsClass="org.eclipse.jpt.core.internal.resource.common.JpaEObject" suppressInterfaces="true"
+ testsDirectory="" testSuiteClass="" importerID="org.eclipse.emf.importer.ecore"
+ complianceLevel="5.0" copyrightFields="false" usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore">
+ <foreignModel>orm.ecore</foreignModel>
+ <foreignModel>persistence.ecore</foreignModel>
+ <genPackages prefix="Orm" basePackage="org.eclipse.jpt.core.internal.resource" disposableProviderFactory="true"
+ ecorePackage="orm.ecore#/">
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="orm.ecore#//AccessType">
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//AccessType/PROPERTY"/>
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//AccessType/FIELD"/>
+ </genEnums>
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="orm.ecore#//DiscriminatorType">
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//DiscriminatorType/STRING"/>
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//DiscriminatorType/CHAR"/>
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//DiscriminatorType/INTEGER"/>
+ </genEnums>
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="orm.ecore#//EnumType">
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//EnumType/ORDINAL"/>
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//EnumType/STRING"/>
+ </genEnums>
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="orm.ecore#//FetchType">
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//FetchType/LAZY"/>
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//FetchType/EAGER"/>
+ </genEnums>
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="orm.ecore#//GenerationType">
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//GenerationType/TABLE"/>
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//GenerationType/SEQUENCE"/>
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//GenerationType/IDENTITY"/>
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//GenerationType/AUTO"/>
+ </genEnums>
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="orm.ecore#//InheritanceType">
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//InheritanceType/SINGLE_TABLE"/>
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//InheritanceType/JOINED"/>
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//InheritanceType/TABLE_PER_CLASS"/>
+ </genEnums>
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="orm.ecore#//TemporalType">
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//TemporalType/DATE"/>
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//TemporalType/TIME"/>
+ <genEnumLiterals ecoreEnumLiteral="orm.ecore#//TemporalType/TIMESTAMP"/>
+ </genEnums>
+ <genDataTypes ecoreDataType="orm.ecore#//DiscriminatorValue"/>
+ <genDataTypes ecoreDataType="orm.ecore#//Enumerated"/>
+ <genDataTypes ecoreDataType="orm.ecore#//OrderBy"/>
+ <genDataTypes ecoreDataType="orm.ecore#//VersionType"/>
+ <genClasses ecoreClass="orm.ecore#//EntityMappings">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//EntityMappings/version"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//EntityMappings/description"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityMappings/persistenceUnitMetadata"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//EntityMappings/package"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//EntityMappings/schema"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//EntityMappings/catalog"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//EntityMappings/access"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityMappings/sequenceGenerators"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityMappings/tableGenerators"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityMappings/namedQueries"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityMappings/namedNativeQueries"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityMappings/sqlResultSetMappings"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityMappings/mappedSuperclasses"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityMappings/entities"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityMappings/embeddables"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//PersistenceUnitMetadata">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute orm.ecore#//PersistenceUnitMetadata/xmlMappingMetadataComplete"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//PersistenceUnitMetadata/persistenceUnitDefaults"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//PersistenceUnitDefaults">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//PersistenceUnitDefaults/schema"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//PersistenceUnitDefaults/catalog"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//PersistenceUnitDefaults/access"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute orm.ecore#//PersistenceUnitDefaults/cascadePersist"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//PersistenceUnitDefaults/entityListeners"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="orm.ecore#//TypeMapping">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//TypeMapping/className"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//TypeMapping/access"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//TypeMapping/metadataComplete"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//TypeMapping/description"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//TypeMapping/attributes"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//MappedSuperclass">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//MappedSuperclass/idClass"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute orm.ecore#//MappedSuperclass/excludeDefaultListeners"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute orm.ecore#//MappedSuperclass/excludeSuperclassListeners"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//MappedSuperclass/entityListeners"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//MappedSuperclass/prePersist"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//MappedSuperclass/postPersist"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//MappedSuperclass/preRemove"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//MappedSuperclass/postRemove"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//MappedSuperclass/preUpdate"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//MappedSuperclass/postUpdate"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//MappedSuperclass/postLoad"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//Entity">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Entity/name"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/table"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/secondaryTables"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/primaryKeyJoinColumns"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/idClass"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/inheritance"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Entity/discriminatorValue"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/discriminatorColumn"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/sequenceGenerator"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/tableGenerator"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/namedQueries"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/namedNativeQueries"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/sqlResultSetMappings"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute orm.ecore#//Entity/excludeDefaultListeners"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute orm.ecore#//Entity/excludeSuperclassListeners"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/entityListeners"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/prePersist"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/postPersist"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/preRemove"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/postRemove"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/preUpdate"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/postUpdate"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/postLoad"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/attributeOverrides"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Entity/associationOverrides"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//Embeddable"/>
+ <genClasses ecoreClass="orm.ecore#//Attributes">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Attributes/ids"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Attributes/embeddedIds"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Attributes/basics"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Attributes/versions"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Attributes/manyToOnes"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Attributes/oneToManys"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Attributes/oneToOnes"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Attributes/manyToManys"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Attributes/embeddeds"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Attributes/transients"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="orm.ecore#//AttributeMapping">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//AttributeMapping/name"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//ColumnMapping">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//ColumnMapping/column"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="orm.ecore#//RelationshipMapping">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//RelationshipMapping/targetEntity"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//RelationshipMapping/fetch"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//RelationshipMapping/joinTable"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//RelationshipMapping/cascade"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="orm.ecore#//MultiRelationshipMapping">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//MultiRelationshipMapping/mappedBy"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//MultiRelationshipMapping/orderBy"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//MultiRelationshipMapping/mapKey"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="orm.ecore#//SingleRelationshipMapping">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//SingleRelationshipMapping/optional"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//SingleRelationshipMapping/joinColumns"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//Id">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Id/generatedValue"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Id/temporal"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Id/tableGenerator"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Id/sequenceGenerator"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//IdImpl"/>
+ <genClasses ecoreClass="orm.ecore#//EmbeddedId">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EmbeddedId/attributeOverrides"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//EmbeddedIdImpl"/>
+ <genClasses ecoreClass="orm.ecore#//Basic">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Basic/fetch"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Basic/optional"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute orm.ecore#//Basic/lob"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Basic/temporal"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Basic/enumerated"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//BasicImpl"/>
+ <genClasses ecoreClass="orm.ecore#//Version">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Version/temporal"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//VersionImpl"/>
+ <genClasses ecoreClass="orm.ecore#//ManyToOne"/>
+ <genClasses ecoreClass="orm.ecore#//ManyToOneImpl"/>
+ <genClasses ecoreClass="orm.ecore#//OneToMany">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//OneToMany/joinColumns"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//OneToManyImpl"/>
+ <genClasses ecoreClass="orm.ecore#//OneToOne">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//OneToOne/mappedBy"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//OneToOne/primaryKeyJoinColumns"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//OneToOneImpl"/>
+ <genClasses ecoreClass="orm.ecore#//ManyToMany"/>
+ <genClasses ecoreClass="orm.ecore#//ManyToManyImpl"/>
+ <genClasses ecoreClass="orm.ecore#//Embedded">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Embedded/attributeOverrides"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//EmbeddedImpl"/>
+ <genClasses ecoreClass="orm.ecore#//Transient"/>
+ <genClasses ecoreClass="orm.ecore#//TransientImpl"/>
+ <genClasses ecoreClass="orm.ecore#//AssociationOverride">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//AssociationOverride/joinColumns"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//AssociationOverride/name"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//AttributeOverride">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//AttributeOverride/column"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//AttributeOverride/name"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//AttributeOverrideImpl"/>
+ <genClasses ecoreClass="orm.ecore#//CascadeType">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute orm.ecore#//CascadeType/cascadeAll"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute orm.ecore#//CascadeType/cascadePersist"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute orm.ecore#//CascadeType/cascadeMerge"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute orm.ecore#//CascadeType/cascadeRemove"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute orm.ecore#//CascadeType/cascadeRefresh"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//CascadeTypeImpl"/>
+ <genClasses image="false" ecoreClass="orm.ecore#//NamedColumn">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//NamedColumn/columnDefinition"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//NamedColumn/name"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="orm.ecore#//AbstractColumn">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//AbstractColumn/insertable"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//AbstractColumn/nullable"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//AbstractColumn/table"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//AbstractColumn/unique"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//AbstractColumn/updatable"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//Column">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Column/length"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Column/precision"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Column/scale"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//ColumnImpl"/>
+ <genClasses ecoreClass="orm.ecore#//ColumnResult">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//ColumnResult/name"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//DiscriminatorColumn">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//DiscriminatorColumn/discriminatorType"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//DiscriminatorColumn/length"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//EntityListeners">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityListeners/entityListeners"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//EntityListener">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//EntityListener/className"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityListener/prePersist"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityListener/postPersist"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityListener/preRemove"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityListener/postRemove"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityListener/preUpdate"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityListener/postUpdate"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityListener/postLoad"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//EntityResult">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//EntityResult/discriminatorColumn"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//EntityResult/entityClass"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//EntityResult/fieldResults"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//EventMethod">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//EventMethod/methodName"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//FieldResult">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//FieldResult/name"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//FieldResult/column"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//GeneratedValue">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//GeneratedValue/generator"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//GeneratedValue/strategy"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//GeneratedValueImpl"/>
+ <genClasses ecoreClass="orm.ecore#//IdClass">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//IdClass/className"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//Inheritance">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Inheritance/strategy"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//JoinColumn">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//JoinColumn/referencedColumnName"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//JoinColumnImpl"/>
+ <genClasses ecoreClass="orm.ecore#//JoinTable">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//JoinTable/joinColumns"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//JoinTable/inverseJoinColumns"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//JoinTableImpl"/>
+ <genClasses ecoreClass="orm.ecore#//Lob"/>
+ <genClasses ecoreClass="orm.ecore#//MapKey">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//MapKey/name"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//MapKeyImpl"/>
+ <genClasses image="false" ecoreClass="orm.ecore#//Query">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Query/name"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Query/query"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//Query/hints"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//NamedNativeQuery">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//NamedNativeQuery/resultClass"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//NamedNativeQuery/resultSetMapping"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//NamedQuery"/>
+ <genClasses ecoreClass="orm.ecore#//PostLoad"/>
+ <genClasses ecoreClass="orm.ecore#//PostPersist"/>
+ <genClasses ecoreClass="orm.ecore#//PostRemove"/>
+ <genClasses ecoreClass="orm.ecore#//PostUpdate"/>
+ <genClasses ecoreClass="orm.ecore#//PrePersist"/>
+ <genClasses ecoreClass="orm.ecore#//PreRemove"/>
+ <genClasses ecoreClass="orm.ecore#//PreUpdate"/>
+ <genClasses ecoreClass="orm.ecore#//PrimaryKeyJoinColumn">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//PrimaryKeyJoinColumn/referencedColumnName"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//QueryHint">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//QueryHint/name"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//QueryHint/value"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="orm.ecore#//AbstractTable">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//AbstractTable/name"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//AbstractTable/catalog"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//AbstractTable/schema"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//AbstractTable/uniqueConstraints"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//Table"/>
+ <genClasses ecoreClass="orm.ecore#//SecondaryTable">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//SecondaryTable/primaryKeyJoinColumns"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="orm.ecore#//Generator">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Generator/name"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Generator/initialValue"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//Generator/allocationSize"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//SequenceGenerator">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//SequenceGenerator/sequenceName"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//SequenceGeneratorImpl"/>
+ <genClasses ecoreClass="orm.ecore#//SqlResultSetMapping">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//SqlResultSetMapping/name"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//SqlResultSetMapping/entityResults"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//SqlResultSetMapping/columnResults"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//TableGenerator">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//TableGenerator/table"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//TableGenerator/catalog"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//TableGenerator/schema"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//TableGenerator/pkColumnName"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//TableGenerator/valueColumnName"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//TableGenerator/pkColumnValue"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference orm.ecore#//TableGenerator/uniqueConstraints"/>
+ </genClasses>
+ <genClasses ecoreClass="orm.ecore#//TableGeneratorImpl"/>
+ <genClasses ecoreClass="orm.ecore#//UniqueConstraint">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute orm.ecore#//UniqueConstraint/columnNames"/>
+ </genClasses>
+ </genPackages>
+ <genPackages prefix="Persistence" basePackage="org.eclipse.jpt.core.internal.resource"
+ disposableProviderFactory="true" ecorePackage="persistence.ecore#/">
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="persistence.ecore#//XmlPersistenceUnitTransactionType">
+ <genEnumLiterals ecoreEnumLiteral="persistence.ecore#//XmlPersistenceUnitTransactionType/JTA"/>
+ <genEnumLiterals ecoreEnumLiteral="persistence.ecore#//XmlPersistenceUnitTransactionType/RESOURCE_LOCAL"/>
+ </genEnums>
+ <genDataTypes ecoreDataType="persistence.ecore#//XmlPersistenceUnitTransactionTypeObject"/>
+ <genDataTypes ecoreDataType="persistence.ecore#//XmlVersion"/>
+ <genClasses ecoreClass="persistence.ecore#//XmlPersistence">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference persistence.ecore#//XmlPersistence/persistenceUnits"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute persistence.ecore#//XmlPersistence/version"/>
+ </genClasses>
+ <genClasses ecoreClass="persistence.ecore#//XmlPersistenceUnit">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute persistence.ecore#//XmlPersistenceUnit/description"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute persistence.ecore#//XmlPersistenceUnit/provider"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute persistence.ecore#//XmlPersistenceUnit/jtaDataSource"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute persistence.ecore#//XmlPersistenceUnit/nonJtaDataSource"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference persistence.ecore#//XmlPersistenceUnit/mappingFiles"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute persistence.ecore#//XmlPersistenceUnit/jarFiles"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference persistence.ecore#//XmlPersistenceUnit/classes"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute persistence.ecore#//XmlPersistenceUnit/excludeUnlistedClasses"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference persistence.ecore#//XmlPersistenceUnit/properties"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute persistence.ecore#//XmlPersistenceUnit/name"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute persistence.ecore#//XmlPersistenceUnit/transactionType"/>
+ </genClasses>
+ <genClasses ecoreClass="persistence.ecore#//XmlMappingFileRef">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute persistence.ecore#//XmlMappingFileRef/fileName"/>
+ </genClasses>
+ <genClasses ecoreClass="persistence.ecore#//XmlJavaClassRef">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute persistence.ecore#//XmlJavaClassRef/javaClass"/>
+ </genClasses>
+ <genClasses ecoreClass="persistence.ecore#//XmlProperties">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference persistence.ecore#//XmlProperties/properties"/>
+ </genClasses>
+ <genClasses ecoreClass="persistence.ecore#//XmlProperty">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute persistence.ecore#//XmlProperty/name"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute persistence.ecore#//XmlProperty/value"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/old_core.ecore b/jpa/plugins/org.eclipse.jpt.core/model/old_core.ecore
deleted file mode 100644
index 95405b246e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/model/old_core.ecore
+++ /dev/null
@@ -1,549 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="internal"
- nsURI="jpt.core.xmi" nsPrefix="jpt.core">
- <eClassifiers xsi:type="ecore:EClass" name="IJpaEObject" abstract="true" interface="true"/>
- <eClassifiers xsi:type="ecore:EClass" name="JpaEObject" abstract="true" eSuperTypes="#//IJpaEObject"/>
- <eClassifiers xsi:type="ecore:EClass" name="IJpaDataSource" abstract="true" interface="true"
- eSuperTypes="#//IJpaEObject">
- <eOperations name="getConnectionProfileName" ordered="false" unique="false" lowerBound="1"
- eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="JpaDataSource" eSuperTypes="#//JpaEObject #//IJpaDataSource">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="connectionProfileName"
- ordered="false" unique="false" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IJpaFile" abstract="true" interface="true"
- eSuperTypes="#//IJpaEObject">
- <eOperations name="getContentId" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eOperations name="getContent" eType="#//IJpaRootContentNode"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="JpaFile" eSuperTypes="#//JpaEObject #//IJpaFile">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="contentId" lowerBound="1"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="content" eType="#//IJpaRootContentNode"
- containment="true" eOpposite="#//IJpaRootContentNode/jpaFile"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IJpaSourceObject" abstract="true" interface="true"
- eSuperTypes="#//IJpaEObject">
- <eOperations name="getJpaFile" eType="#//IJpaFile"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IXmlEObject" abstract="true" interface="true"
- eSuperTypes="#//IJpaEObject #//IJpaSourceObject"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlEObject" abstract="true" eSuperTypes="#//JpaEObject #//IXmlEObject"/>
- <eClassifiers xsi:type="ecore:EClass" name="IJpaContentNode" abstract="true" interface="true"
- eSuperTypes="#//IJpaSourceObject">
- <eOperations name="getJpaFile" lowerBound="1" eType="#//IJpaFile"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IJpaRootContentNode" abstract="true"
- interface="true" eSuperTypes="#//IJpaContentNode">
- <eStructuralFeatures xsi:type="ecore:EReference" name="jpaFile" eType="#//IJpaFile"
- changeable="false" eOpposite="#//JpaFile/content"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IPersistentType" abstract="true" interface="true"
- eSuperTypes="#//IJpaContentNode">
- <eOperations name="getMapping" lowerBound="1" eType="#//ITypeMapping"/>
- <eOperations name="parentPersistentType" eType="#//IPersistentType"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="mappingKey" lowerBound="1"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="ITypeMapping" abstract="true" interface="true"
- eSuperTypes="#//IJpaSourceObject">
- <eOperations name="getPersistentType" lowerBound="1" eType="#//IPersistentType"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="tableName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" derived="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="NullTypeMapping" eSuperTypes="#//JpaEObject #//ITypeMapping #//IJpaSourceObject"/>
- <eClassifiers xsi:type="ecore:EClass" name="IPersistentAttribute" abstract="true"
- interface="true" eSuperTypes="#//IJpaContentNode">
- <eOperations name="typeMapping" lowerBound="1" eType="#//ITypeMapping"/>
- <eOperations name="getName" lowerBound="1" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- <eOperations name="mappingKey" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eOperations name="defaultMappingKey" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="mapping" lowerBound="1"
- eType="#//IAttributeMapping" changeable="false" volatile="true" transient="true"
- derived="true" resolveProxies="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IAttributeMapping" abstract="true" interface="true"
- eSuperTypes="#//IJpaSourceObject">
- <eOperations name="getPersistentAttribute" lowerBound="1" eType="#//IPersistentAttribute"/>
- <eOperations name="isDefault" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBoolean"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" name="AccessType">
- <eLiterals name="Default" literal="Default"/>
- <eLiterals name="PROPERTY" value="1" literal="Property"/>
- <eLiterals name="FIELD" value="2" literal="Field"/>
- </eClassifiers>
- <eSubpackages name="mappings" nsURI="jpt.core.mappings.xmi" nsPrefix="jpt.core.mappings">
- <eClassifiers xsi:type="ecore:EClass" name="IMappedSuperclass" abstract="true"
- interface="true" eSuperTypes="#//ITypeMapping">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="idClass" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IEntity" abstract="true" interface="true"
- eSuperTypes="#//ITypeMapping">
- <eOperations name="discriminatorValueIsAllowed" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- <eOperations name="getSecondaryTables" upperBound="-1" eType="#//mappings/ISecondaryTable"/>
- <eOperations name="parentEntity" eType="#//mappings/IEntity"/>
- <eOperations name="rootEntity" eType="#//mappings/IEntity"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="table" lowerBound="1"
- eType="#//mappings/ITable" changeable="false" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="specifiedSecondaryTables"
- upperBound="-1" eType="#//mappings/ISecondaryTable" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="primaryKeyJoinColumns"
- upperBound="-1" eType="#//mappings/IPrimaryKeyJoinColumn" changeable="false"
- volatile="true" transient="true" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="specifiedPrimaryKeyJoinColumns"
- upperBound="-1" eType="#//mappings/IPrimaryKeyJoinColumn" containment="true"
- resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="defaultPrimaryKeyJoinColumns"
- upperBound="-1" eType="#//mappings/IPrimaryKeyJoinColumn" containment="true"
- resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="inheritanceStrategy"
- eType="#//mappings/InheritanceType"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultDiscriminatorValue"
- eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedDiscriminatorValue"
- eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="discriminatorValue" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"
- changeable="false" volatile="true" transient="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="discriminatorColumn"
- eType="#//mappings/IDiscriminatorColumn" changeable="false" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="sequenceGenerator" eType="#//mappings/ISequenceGenerator"
- containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="tableGenerator" eType="#//mappings/ITableGenerator"
- containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="attributeOverrides" upperBound="-1"
- eType="#//mappings/IAttributeOverride" changeable="false" volatile="true"
- transient="true" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="specifiedAttributeOverrides"
- upperBound="-1" eType="#//mappings/IAttributeOverride" containment="true"
- resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="defaultAttributeOverrides"
- upperBound="-1" eType="#//mappings/IAttributeOverride" containment="true"
- resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="associationOverrides"
- upperBound="-1" eType="#//mappings/IAssociationOverride" changeable="false"
- volatile="true" transient="true" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="specifiedAssociationOverrides"
- upperBound="-1" eType="#//mappings/IAssociationOverride" containment="true"
- resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="defaultAssociationOverrides"
- upperBound="-1" eType="#//mappings/IAssociationOverride" containment="true"
- resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="namedQueries" upperBound="-1"
- eType="#//mappings/INamedQuery" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="namedNativeQueries" upperBound="-1"
- eType="#//mappings/INamedNativeQuery" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="idClass" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IEmbeddable" abstract="true" interface="true"
- eSuperTypes="#//ITypeMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="ITable" abstract="true" interface="true"
- eSuperTypes="#//IJpaSourceObject">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="catalog" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedCatalog" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultCatalog" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="schema" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedSchema" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultSchema" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="uniqueConstraints" upperBound="-1"
- eType="#//mappings/IUniqueConstraint" containment="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IUniqueConstraint" abstract="true"
- interface="true" eSuperTypes="#//IJpaSourceObject">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="columnNames" unique="false"
- upperBound="-1" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="INamedColumn" abstract="true" interface="true"
- eSuperTypes="#//IJpaSourceObject">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="columnDefinition" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IAbstractColumn" abstract="true" interface="true"
- eSuperTypes="#//mappings/INamedColumn">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="unique" eType="#//mappings/DefaultFalseBoolean"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="nullable" eType="#//mappings/DefaultTrueBoolean"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="insertable" eType="#//mappings/DefaultTrueBoolean"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="updatable" eType="#//mappings/DefaultTrueBoolean"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="table" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedTable" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultTable" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IColumn" abstract="true" interface="true"
- eSuperTypes="#//mappings/IAbstractColumn">
- <eOperations name="getDefaultLength" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"/>
- <eOperations name="getDefaultPrecision" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"/>
- <eOperations name="getDefaultScale" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="length" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedLength" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
- defaultValueLiteral="-1"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="precision" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedPrecision" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
- defaultValueLiteral="-1"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="scale" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedScale" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
- defaultValueLiteral="-1"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IColumnMapping" abstract="true" interface="true">
- <eOperations name="getColumn" eType="#//mappings/IColumn"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IBasic" abstract="true" interface="true"
- eSuperTypes="#//IAttributeMapping #//mappings/IColumnMapping">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="fetch" eType="#//mappings/DefaultEagerFetchType"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="optional" eType="#//mappings/DefaultTrueBoolean"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="column" lowerBound="1"
- eType="#//mappings/IColumn" changeable="false" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="lob" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="temporal" eType="#//mappings/TemporalType"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="enumerated" eType="#//mappings/EnumType"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IId" abstract="true" interface="true"
- eSuperTypes="#//IAttributeMapping #//mappings/IColumnMapping">
- <eStructuralFeatures xsi:type="ecore:EReference" name="column" lowerBound="1"
- eType="#//mappings/IColumn" changeable="false" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="generatedValue" eType="#//mappings/IGeneratedValue"
- containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="temporal" eType="#//mappings/TemporalType"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="tableGenerator" eType="#//mappings/ITableGenerator"
- containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="sequenceGenerator" eType="#//mappings/ISequenceGenerator"
- containment="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="ITransient" abstract="true" interface="true"
- eSuperTypes="#//IAttributeMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="IVersion" abstract="true" interface="true"
- eSuperTypes="#//IAttributeMapping #//mappings/IColumnMapping">
- <eStructuralFeatures xsi:type="ecore:EReference" name="column" lowerBound="1"
- eType="#//mappings/IColumn" changeable="false" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="temporal" eType="#//mappings/TemporalType"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IEmbeddedId" abstract="true" interface="true"
- eSuperTypes="#//IAttributeMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="IEmbedded" abstract="true" interface="true"
- eSuperTypes="#//IAttributeMapping">
- <eOperations name="embeddable" eType="#//mappings/IEmbeddable"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="attributeOverrides" upperBound="-1"
- eType="#//mappings/IAttributeOverride" changeable="false" volatile="true"
- transient="true" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="specifiedAttributeOverrides"
- upperBound="-1" eType="#//mappings/IAttributeOverride" containment="true"
- resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="defaultAttributeOverrides"
- upperBound="-1" eType="#//mappings/IAttributeOverride" containment="true"
- resolveProxies="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IRelationshipMapping" abstract="true"
- interface="true" eSuperTypes="#//IAttributeMapping">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="targetEntity" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedTargetEntity"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultTargetEntity"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="resolvedTargetEntity"
- eType="#//mappings/IEntity"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="cascade" eType="#//mappings/ICascade"
- containment="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="INonOwningMapping" abstract="true"
- interface="true" eSuperTypes="#//mappings/IRelationshipMapping">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="mappedBy" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IMultiRelationshipMapping" abstract="true"
- interface="true" eSuperTypes="#//mappings/INonOwningMapping">
- <eOperations name="isNoOrdering" ordered="false" unique="false" lowerBound="1"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- <eOperations name="setNoOrdering" ordered="false" unique="false"/>
- <eOperations name="isOrderByPk" ordered="false" unique="false" lowerBound="1"
- eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBoolean"/>
- <eOperations name="setOrderByPk" ordered="false" unique="false"/>
- <eOperations name="isCustomOrdering" ordered="false" unique="false" lowerBound="1"
- eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBoolean"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="orderBy" ordered="false"
- unique="false" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="fetch" eType="#//mappings/DefaultLazyFetchType"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="joinTable" lowerBound="1"
- eType="#//mappings/IJoinTable" changeable="false" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="mapKey" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IOneToMany" abstract="true" interface="true"
- eSuperTypes="#//mappings/IMultiRelationshipMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="IManyToMany" abstract="true" interface="true"
- eSuperTypes="#//mappings/IMultiRelationshipMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="ISingleRelationshipMapping" abstract="true"
- interface="true" eSuperTypes="#//mappings/IRelationshipMapping">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="fetch" eType="#//mappings/DefaultEagerFetchType"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="joinColumns" upperBound="-1"
- eType="#//mappings/IJoinColumn" changeable="false" volatile="true" transient="true"
- containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="specifiedJoinColumns"
- upperBound="-1" eType="#//mappings/IJoinColumn" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="defaultJoinColumns" upperBound="-1"
- eType="#//mappings/IJoinColumn" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="optional" eType="#//mappings/DefaultTrueBoolean"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IManyToOne" abstract="true" interface="true"
- eSuperTypes="#//mappings/ISingleRelationshipMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="IOneToOne" abstract="true" interface="true"
- eSuperTypes="#//mappings/ISingleRelationshipMapping #//mappings/INonOwningMapping"/>
- <eClassifiers xsi:type="ecore:EEnum" name="DefaultEagerFetchType">
- <eLiterals name="Default" literal="Default (Eager)"/>
- <eLiterals name="EAGER" value="1" literal="Eager"/>
- <eLiterals name="LAZY" value="2" literal="Lazy"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" name="DefaultLazyFetchType">
- <eLiterals name="Default" literal="Default (Lazy)"/>
- <eLiterals name="LAZY" value="1" literal="Lazy"/>
- <eLiterals name="EAGER" value="2" literal="Eager"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" name="DefaultFalseBoolean">
- <eLiterals name="Default" literal="Default (False)"/>
- <eLiterals name="false" value="1" literal="False"/>
- <eLiterals name="true" value="2" literal="True"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" name="DefaultTrueBoolean">
- <eLiterals name="Default" literal="Default (True)"/>
- <eLiterals name="true" value="1" literal="True"/>
- <eLiterals name="false" value="2" literal="False"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" name="TemporalType">
- <eLiterals name="Null" literal=""/>
- <eLiterals name="DATE" value="1" literal="Date"/>
- <eLiterals name="TIME" value="2" literal="Time"/>
- <eLiterals name="TIMESTAMP" value="3" literal="Timestamp"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IJoinTable" abstract="true" interface="true"
- eSuperTypes="#//mappings/ITable">
- <eStructuralFeatures xsi:type="ecore:EReference" name="joinColumns" upperBound="-1"
- eType="#//mappings/IJoinColumn" changeable="false" volatile="true" transient="true"
- containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="specifiedJoinColumns"
- upperBound="-1" eType="#//mappings/IJoinColumn" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="defaultJoinColumns" upperBound="-1"
- eType="#//mappings/IJoinColumn" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="inverseJoinColumns" upperBound="-1"
- eType="#//mappings/IJoinColumn" changeable="false" volatile="true" transient="true"
- containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="specifiedInverseJoinColumns"
- upperBound="-1" eType="#//mappings/IJoinColumn" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="defaultInverseJoinColumns"
- upperBound="-1" eType="#//mappings/IJoinColumn" containment="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IAbstractJoinColumn" abstract="true"
- interface="true" eSuperTypes="#//mappings/INamedColumn">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="referencedColumnName"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedReferencedColumnName"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultReferencedColumnName"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IJoinColumn" abstract="true" interface="true"
- eSuperTypes="#//mappings/IAbstractColumn #//mappings/IAbstractJoinColumn"/>
- <eClassifiers xsi:type="ecore:EClass" name="IOverride" abstract="true" interface="true"
- eSuperTypes="#//IJpaSourceObject">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IAttributeOverride" abstract="true"
- interface="true" eSuperTypes="#//mappings/IOverride #//mappings/IColumnMapping">
- <eStructuralFeatures xsi:type="ecore:EReference" name="column" lowerBound="1"
- eType="#//mappings/IColumn" changeable="false" containment="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IAssociationOverride" abstract="true"
- interface="true" eSuperTypes="#//mappings/IOverride">
- <eStructuralFeatures xsi:type="ecore:EReference" name="joinColumns" upperBound="-1"
- eType="#//mappings/IJoinColumn" changeable="false" volatile="true" transient="true"
- containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="specifiedJoinColumns"
- upperBound="-1" eType="#//mappings/IJoinColumn" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="defaultJoinColumns" upperBound="-1"
- eType="#//mappings/IJoinColumn" containment="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IDiscriminatorColumn" abstract="true"
- interface="true" eSuperTypes="#//mappings/INamedColumn">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="discriminatorType" eType="#//mappings/DiscriminatorType"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultLength" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
- defaultValueLiteral="31"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedLength" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
- defaultValueLiteral="-1"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="length" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
- changeable="false" volatile="true" transient="true" derived="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" name="InheritanceType">
- <eLiterals name="Default" literal="Default (Single Table)"/>
- <eLiterals name="SINGLE_TABLE" value="1" literal="Single Table"/>
- <eLiterals name="JOINED" value="2" literal="Joined"/>
- <eLiterals name="TABLE_PER_CLASS" value="3" literal="Table per Class"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" name="DiscriminatorType">
- <eLiterals name="Default" literal="Default (String)"/>
- <eLiterals name="STRING" value="1" literal="String"/>
- <eLiterals name="CHAR" value="2" literal="Char"/>
- <eLiterals name="INTEGER" value="3" literal="Integer"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="ISecondaryTable" abstract="true" interface="true"
- eSuperTypes="#//mappings/ITable">
- <eOperations name="typeMapping" eType="#//ITypeMapping"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="primaryKeyJoinColumns"
- upperBound="-1" eType="#//mappings/IPrimaryKeyJoinColumn" changeable="false"
- volatile="true" transient="true" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="specifiedPrimaryKeyJoinColumns"
- upperBound="-1" eType="#//mappings/IPrimaryKeyJoinColumn" containment="true"
- resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="defaultPrimaryKeyJoinColumns"
- upperBound="-1" eType="#//mappings/IPrimaryKeyJoinColumn" containment="true"
- resolveProxies="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IPrimaryKeyJoinColumn" abstract="true"
- interface="true" eSuperTypes="#//mappings/IAbstractJoinColumn"/>
- <eClassifiers xsi:type="ecore:EClass" name="IGenerator" abstract="true" interface="true"
- eSuperTypes="#//IJpaSourceObject">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="initialValue" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedInitialValue"
- eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
- defaultValueLiteral="-1"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultInitialValue"
- eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
- changeable="false"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="allocationSize" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedAllocationSize"
- eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
- defaultValueLiteral="-1"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultAllocationSize"
- eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
- changeable="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="ITableGenerator" abstract="true" interface="true"
- eSuperTypes="#//mappings/IGenerator">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="table" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedTable" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultTable" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="catalog" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedCatalog" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultCatalog" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="schema" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedSchema" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultSchema" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="pkColumnName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedPkColumnName"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultPkColumnName"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="valueColumnName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedValueColumnName"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultValueColumnName"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="pkColumnValue" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedPkColumnValue"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultPkColumnValue"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="uniqueConstraints" upperBound="-1"
- eType="#//mappings/IUniqueConstraint" containment="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="ISequenceGenerator" abstract="true"
- interface="true" eSuperTypes="#//mappings/IGenerator">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="sequenceName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" derived="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedSequenceName"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultSequenceName"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IGeneratedValue" abstract="true" interface="true"
- eSuperTypes="#//IJpaSourceObject">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="strategy" eType="#//mappings/GenerationType"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="generator" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" name="GenerationType">
- <eLiterals name="Default" literal="Default (Auto)"/>
- <eLiterals name="AUTO" value="1" literal="Auto"/>
- <eLiterals name="IDENTITY" value="2" literal="Identity"/>
- <eLiterals name="SEQUENCE" value="3" literal="Sequence"/>
- <eLiterals name="TABLE" value="4" literal="Table"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" name="EnumType">
- <eLiterals name="Default" literal="Default (Ordinal)"/>
- <eLiterals name="ORDINAL" value="1" literal="Ordinal"/>
- <eLiterals name="STRING" value="2" literal="String"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IQuery" abstract="true" interface="true"
- eSuperTypes="#//IJpaSourceObject">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="query" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="hints" upperBound="-1"
- eType="#//mappings/IQueryHint" containment="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="INamedQuery" abstract="true" interface="true"
- eSuperTypes="#//IJpaSourceObject #//mappings/IQuery"/>
- <eClassifiers xsi:type="ecore:EClass" name="INamedNativeQuery" abstract="true"
- interface="true" eSuperTypes="#//IJpaSourceObject #//mappings/IQuery">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="resultClass" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="resultSetMapping" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IQueryHint" abstract="true" interface="true"
- eSuperTypes="#//IJpaSourceObject">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" name="CascadeType">
- <eLiterals name="ALL" literal="All"/>
- <eLiterals name="PERSIST" value="1" literal="Persist"/>
- <eLiterals name="MERGE" value="2" literal="Merge"/>
- <eLiterals name="REMOVE" value="3" literal="Remove"/>
- <eLiterals name="REFRESH" value="4" literal="Refresh"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="ICascade" abstract="true" interface="true"
- eSuperTypes="#//IJpaSourceObject">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="all" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBoolean"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="persist" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBoolean"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="merge" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBoolean"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="remove" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBoolean"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="refresh" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBoolean"/>
- </eClassifiers>
- </eSubpackages>
-</ecore:EPackage>
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/old_coreModels.genmodel b/jpa/plugins/org.eclipse.jpt.core/model/old_coreModels.genmodel
deleted file mode 100644
index ff43d52470..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/model/old_coreModels.genmodel
+++ /dev/null
@@ -1,682 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<genmodel:GenModel xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
- xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.jpt.core/src"
- creationCommands="false" creationIcons="false" editDirectory="" editorDirectory=""
- modelPluginID="org.eclipse.jpt.core" modelName="Core" editPluginClass="" editorPluginClass=""
- suppressInterfaces="true" codeFormatting="true" testsDirectory="" testSuiteClass=""
- importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0" copyrightFields="false"
- usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore">
- <foreignModel>old_core.ecore</foreignModel>
- <foreignModel>old_java.ecore</foreignModel>
- <foreignModel>old_orm.ecore</foreignModel>
- <foreignModel>old_persistence.ecore</foreignModel>
- <genPackages prefix="JpaCore" basePackage="org.eclipse.jpt.core" disposableProviderFactory="true"
- ecorePackage="old_core.ecore#/">
- <genEnums typeSafeEnumCompatible="false" ecoreEnum="old_core.ecore#//AccessType">
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//AccessType/Default"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//AccessType/PROPERTY"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//AccessType/FIELD"/>
- </genEnums>
- <genClasses ecoreClass="old_core.ecore#//IJpaEObject"/>
- <genClasses image="false" ecoreClass="old_core.ecore#//JpaEObject"/>
- <genClasses ecoreClass="old_core.ecore#//IJpaDataSource">
- <genOperations ecoreOperation="old_core.ecore#//IJpaDataSource/getConnectionProfileName"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//JpaDataSource">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//JpaDataSource/connectionProfileName"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//IJpaFile">
- <genOperations ecoreOperation="old_core.ecore#//IJpaFile/getContentId"/>
- <genOperations ecoreOperation="old_core.ecore#//IJpaFile/getContent"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//JpaFile">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//JpaFile/contentId"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//JpaFile/content"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//IJpaSourceObject">
- <genOperations ecoreOperation="old_core.ecore#//IJpaSourceObject/getJpaFile"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_core.ecore#//IXmlEObject"/>
- <genClasses image="false" ecoreClass="old_core.ecore#//XmlEObject"/>
- <genClasses ecoreClass="old_core.ecore#//IJpaContentNode">
- <genOperations ecoreOperation="old_core.ecore#//IJpaContentNode/getJpaFile"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//IJpaRootContentNode">
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_core.ecore#//IJpaRootContentNode/jpaFile"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//IPersistentType">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//IPersistentType/mappingKey"/>
- <genOperations ecoreOperation="old_core.ecore#//IPersistentType/getMapping"/>
- <genOperations ecoreOperation="old_core.ecore#//IPersistentType/parentPersistentType"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//ITypeMapping">
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//ITypeMapping/name"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//ITypeMapping/tableName"/>
- <genOperations ecoreOperation="old_core.ecore#//ITypeMapping/getPersistentType"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//NullTypeMapping"/>
- <genClasses ecoreClass="old_core.ecore#//IPersistentAttribute">
- <genFeatures property="Readonly" notify="false" createChild="false" ecoreFeature="ecore:EReference old_core.ecore#//IPersistentAttribute/mapping"/>
- <genOperations ecoreOperation="old_core.ecore#//IPersistentAttribute/typeMapping"/>
- <genOperations ecoreOperation="old_core.ecore#//IPersistentAttribute/getName"/>
- <genOperations ecoreOperation="old_core.ecore#//IPersistentAttribute/mappingKey"/>
- <genOperations ecoreOperation="old_core.ecore#//IPersistentAttribute/defaultMappingKey"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//IAttributeMapping">
- <genOperations ecoreOperation="old_core.ecore#//IAttributeMapping/getPersistentAttribute"/>
- <genOperations ecoreOperation="old_core.ecore#//IAttributeMapping/isDefault"/>
- </genClasses>
- <nestedGenPackages prefix="JpaCoreMappings" basePackage="org.eclipse.jpt.core.internal"
- disposableProviderFactory="true" ecorePackage="old_core.ecore#//mappings">
- <genEnums typeSafeEnumCompatible="false" ecoreEnum="old_core.ecore#//mappings/DefaultEagerFetchType">
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/DefaultEagerFetchType/Default"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/DefaultEagerFetchType/EAGER"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/DefaultEagerFetchType/LAZY"/>
- </genEnums>
- <genEnums typeSafeEnumCompatible="false" ecoreEnum="old_core.ecore#//mappings/DefaultLazyFetchType">
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/DefaultLazyFetchType/Default"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/DefaultLazyFetchType/LAZY"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/DefaultLazyFetchType/EAGER"/>
- </genEnums>
- <genEnums typeSafeEnumCompatible="false" ecoreEnum="old_core.ecore#//mappings/DefaultFalseBoolean">
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/DefaultFalseBoolean/Default"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/DefaultFalseBoolean/false"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/DefaultFalseBoolean/true"/>
- </genEnums>
- <genEnums typeSafeEnumCompatible="false" ecoreEnum="old_core.ecore#//mappings/DefaultTrueBoolean">
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/DefaultTrueBoolean/Default"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/DefaultTrueBoolean/true"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/DefaultTrueBoolean/false"/>
- </genEnums>
- <genEnums typeSafeEnumCompatible="false" ecoreEnum="old_core.ecore#//mappings/TemporalType">
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/TemporalType/Null"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/TemporalType/DATE"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/TemporalType/TIME"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/TemporalType/TIMESTAMP"/>
- </genEnums>
- <genEnums typeSafeEnumCompatible="false" ecoreEnum="old_core.ecore#//mappings/InheritanceType">
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/InheritanceType/Default"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/InheritanceType/SINGLE_TABLE"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/InheritanceType/JOINED"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/InheritanceType/TABLE_PER_CLASS"/>
- </genEnums>
- <genEnums typeSafeEnumCompatible="false" ecoreEnum="old_core.ecore#//mappings/DiscriminatorType">
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/DiscriminatorType/Default"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/DiscriminatorType/STRING"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/DiscriminatorType/CHAR"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/DiscriminatorType/INTEGER"/>
- </genEnums>
- <genEnums typeSafeEnumCompatible="false" ecoreEnum="old_core.ecore#//mappings/GenerationType">
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/GenerationType/Default"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/GenerationType/AUTO"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/GenerationType/IDENTITY"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/GenerationType/SEQUENCE"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/GenerationType/TABLE"/>
- </genEnums>
- <genEnums typeSafeEnumCompatible="false" ecoreEnum="old_core.ecore#//mappings/EnumType">
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/EnumType/Default"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/EnumType/ORDINAL"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/EnumType/STRING"/>
- </genEnums>
- <genEnums typeSafeEnumCompatible="false" ecoreEnum="old_core.ecore#//mappings/CascadeType">
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/CascadeType/ALL"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/CascadeType/PERSIST"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/CascadeType/MERGE"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/CascadeType/REMOVE"/>
- <genEnumLiterals ecoreEnumLiteral="old_core.ecore#//mappings/CascadeType/REFRESH"/>
- </genEnums>
- <genClasses ecoreClass="old_core.ecore#//mappings/IMappedSuperclass">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IMappedSuperclass/idClass"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/IEntity">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IEntity/specifiedName"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IEntity/defaultName"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEntity/table"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEntity/specifiedSecondaryTables"/>
- <genFeatures property="None" children="true" createChild="false" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEntity/primaryKeyJoinColumns"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEntity/specifiedPrimaryKeyJoinColumns"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEntity/defaultPrimaryKeyJoinColumns"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IEntity/inheritanceStrategy"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IEntity/defaultDiscriminatorValue"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IEntity/specifiedDiscriminatorValue"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true"
- ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IEntity/discriminatorValue"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEntity/discriminatorColumn"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEntity/sequenceGenerator"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEntity/tableGenerator"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true"
- ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEntity/attributeOverrides"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true"
- ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEntity/specifiedAttributeOverrides"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true"
- ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEntity/defaultAttributeOverrides"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true"
- ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEntity/associationOverrides"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true"
- ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEntity/specifiedAssociationOverrides"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true"
- ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEntity/defaultAssociationOverrides"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEntity/namedQueries"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEntity/namedNativeQueries"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IEntity/idClass"/>
- <genOperations ecoreOperation="old_core.ecore#//mappings/IEntity/discriminatorValueIsAllowed"/>
- <genOperations ecoreOperation="old_core.ecore#//mappings/IEntity/getSecondaryTables"/>
- <genOperations ecoreOperation="old_core.ecore#//mappings/IEntity/parentEntity"/>
- <genOperations ecoreOperation="old_core.ecore#//mappings/IEntity/rootEntity"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/IEmbeddable"/>
- <genClasses ecoreClass="old_core.ecore#//mappings/ITable">
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITable/name"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITable/specifiedName"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITable/defaultName"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITable/catalog"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITable/specifiedCatalog"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITable/defaultCatalog"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITable/schema"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITable/specifiedSchema"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITable/defaultSchema"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/ITable/uniqueConstraints"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/IUniqueConstraint">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IUniqueConstraint/columnNames"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/INamedColumn">
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/INamedColumn/name"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/INamedColumn/specifiedName"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/INamedColumn/defaultName"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/INamedColumn/columnDefinition"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/IAbstractColumn">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IAbstractColumn/unique"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IAbstractColumn/nullable"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IAbstractColumn/insertable"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IAbstractColumn/updatable"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IAbstractColumn/table"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IAbstractColumn/specifiedTable"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IAbstractColumn/defaultTable"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/IColumn">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IColumn/length"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IColumn/specifiedLength"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IColumn/precision"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IColumn/specifiedPrecision"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IColumn/scale"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IColumn/specifiedScale"/>
- <genOperations ecoreOperation="old_core.ecore#//mappings/IColumn/getDefaultLength"/>
- <genOperations ecoreOperation="old_core.ecore#//mappings/IColumn/getDefaultPrecision"/>
- <genOperations ecoreOperation="old_core.ecore#//mappings/IColumn/getDefaultScale"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/IColumnMapping">
- <genOperations ecoreOperation="old_core.ecore#//mappings/IColumnMapping/getColumn"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/IBasic">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IBasic/fetch"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IBasic/optional"/>
- <genFeatures property="None" children="true" createChild="false" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IBasic/column"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IBasic/lob"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IBasic/temporal"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IBasic/enumerated"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/IId">
- <genFeatures property="None" children="true" createChild="false" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IId/column"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true"
- ecoreFeature="ecore:EReference old_core.ecore#//mappings/IId/generatedValue"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IId/temporal"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true"
- ecoreFeature="ecore:EReference old_core.ecore#//mappings/IId/tableGenerator"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true"
- ecoreFeature="ecore:EReference old_core.ecore#//mappings/IId/sequenceGenerator"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/ITransient"/>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/IVersion">
- <genFeatures property="None" children="true" createChild="false" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IVersion/column"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IVersion/temporal"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/IEmbeddedId"/>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/IEmbedded">
- <genFeatures property="None" children="true" createChild="false" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEmbedded/attributeOverrides"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEmbedded/specifiedAttributeOverrides"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IEmbedded/defaultAttributeOverrides"/>
- <genOperations ecoreOperation="old_core.ecore#//mappings/IEmbedded/embeddable"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/IRelationshipMapping">
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IRelationshipMapping/targetEntity"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IRelationshipMapping/specifiedTargetEntity"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IRelationshipMapping/defaultTargetEntity"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true"
- ecoreFeature="ecore:EReference old_core.ecore#//mappings/IRelationshipMapping/resolvedTargetEntity"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IRelationshipMapping/cascade"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/INonOwningMapping">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/INonOwningMapping/mappedBy"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/IMultiRelationshipMapping">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IMultiRelationshipMapping/orderBy"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IMultiRelationshipMapping/fetch"/>
- <genFeatures property="None" children="true" createChild="false" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IMultiRelationshipMapping/joinTable"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IMultiRelationshipMapping/mapKey"/>
- <genOperations ecoreOperation="old_core.ecore#//mappings/IMultiRelationshipMapping/isNoOrdering"/>
- <genOperations ecoreOperation="old_core.ecore#//mappings/IMultiRelationshipMapping/setNoOrdering"/>
- <genOperations ecoreOperation="old_core.ecore#//mappings/IMultiRelationshipMapping/isOrderByPk"/>
- <genOperations ecoreOperation="old_core.ecore#//mappings/IMultiRelationshipMapping/setOrderByPk"/>
- <genOperations ecoreOperation="old_core.ecore#//mappings/IMultiRelationshipMapping/isCustomOrdering"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/IOneToMany"/>
- <genClasses ecoreClass="old_core.ecore#//mappings/IManyToMany"/>
- <genClasses ecoreClass="old_core.ecore#//mappings/ISingleRelationshipMapping">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ISingleRelationshipMapping/fetch"/>
- <genFeatures property="None" children="true" createChild="false" ecoreFeature="ecore:EReference old_core.ecore#//mappings/ISingleRelationshipMapping/joinColumns"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/ISingleRelationshipMapping/specifiedJoinColumns"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/ISingleRelationshipMapping/defaultJoinColumns"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ISingleRelationshipMapping/optional"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/IManyToOne"/>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/IOneToOne"/>
- <genClasses ecoreClass="old_core.ecore#//mappings/IJoinTable">
- <genFeatures property="None" children="true" createChild="false" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IJoinTable/joinColumns"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IJoinTable/specifiedJoinColumns"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IJoinTable/defaultJoinColumns"/>
- <genFeatures property="None" children="true" createChild="false" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IJoinTable/inverseJoinColumns"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IJoinTable/specifiedInverseJoinColumns"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IJoinTable/defaultInverseJoinColumns"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/IAbstractJoinColumn">
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IAbstractJoinColumn/referencedColumnName"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IAbstractJoinColumn/specifiedReferencedColumnName"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IAbstractJoinColumn/defaultReferencedColumnName"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/IJoinColumn"/>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/IOverride">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IOverride/name"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/IAttributeOverride">
- <genFeatures property="None" children="true" createChild="false" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IAttributeOverride/column"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/IAssociationOverride">
- <genFeatures property="None" children="true" createChild="false" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IAssociationOverride/joinColumns"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IAssociationOverride/specifiedJoinColumns"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IAssociationOverride/defaultJoinColumns"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/IDiscriminatorColumn">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IDiscriminatorColumn/discriminatorType"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IDiscriminatorColumn/defaultLength"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IDiscriminatorColumn/specifiedLength"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IDiscriminatorColumn/length"/>
- </genClasses>
- <genClasses ecoreClass="old_core.ecore#//mappings/ISecondaryTable">
- <genFeatures property="None" children="true" createChild="false" ecoreFeature="ecore:EReference old_core.ecore#//mappings/ISecondaryTable/primaryKeyJoinColumns"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/ISecondaryTable/specifiedPrimaryKeyJoinColumns"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/ISecondaryTable/defaultPrimaryKeyJoinColumns"/>
- <genOperations ecoreOperation="old_core.ecore#//mappings/ISecondaryTable/typeMapping"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/IPrimaryKeyJoinColumn"/>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/IGenerator">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IGenerator/name"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IGenerator/initialValue"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IGenerator/specifiedInitialValue"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IGenerator/defaultInitialValue"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IGenerator/allocationSize"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IGenerator/specifiedAllocationSize"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IGenerator/defaultAllocationSize"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/ITableGenerator">
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/table"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/specifiedTable"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/defaultTable"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/catalog"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/specifiedCatalog"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/defaultCatalog"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/schema"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/specifiedSchema"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/defaultSchema"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/pkColumnName"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/specifiedPkColumnName"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/defaultPkColumnName"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/valueColumnName"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/specifiedValueColumnName"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/defaultValueColumnName"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/pkColumnValue"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/specifiedPkColumnValue"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ITableGenerator/defaultPkColumnValue"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/ITableGenerator/uniqueConstraints"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/ISequenceGenerator">
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ISequenceGenerator/sequenceName"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ISequenceGenerator/specifiedSequenceName"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ISequenceGenerator/defaultSequenceName"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/IGeneratedValue">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IGeneratedValue/strategy"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IGeneratedValue/generator"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/IQuery">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IQuery/name"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IQuery/query"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_core.ecore#//mappings/IQuery/hints"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/INamedQuery"/>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/INamedNativeQuery">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/INamedNativeQuery/resultClass"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/INamedNativeQuery/resultSetMapping"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/IQueryHint">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IQueryHint/name"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/IQueryHint/value"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_core.ecore#//mappings/ICascade">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ICascade/all"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ICascade/persist"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ICascade/merge"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ICascade/remove"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_core.ecore#//mappings/ICascade/refresh"/>
- </genClasses>
- </nestedGenPackages>
- </genPackages>
- <genPackages prefix="JpaJava" basePackage="org.eclipse.jpt.core.internal.content"
- disposableProviderFactory="true" ecorePackage="old_java.ecore#/">
- <genClasses image="false" ecoreClass="old_java.ecore#//JavaEObject">
- <genOperations ecoreOperation="old_java.ecore#//JavaEObject/getJpaFile"/>
- <genOperations ecoreOperation="old_java.ecore#//JavaEObject/getRoot"/>
- </genClasses>
- <genClasses ecoreClass="old_java.ecore#//JpaCompilationUnit">
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_java.ecore#//JpaCompilationUnit/types"/>
- </genClasses>
- <genClasses ecoreClass="old_java.ecore#//JavaPersistentType">
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_java.ecore#//JavaPersistentType/mapping"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_java.ecore#//JavaPersistentType/attributes"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_java.ecore#//JavaPersistentType/access"/>
- </genClasses>
- <genClasses ecoreClass="old_java.ecore#//JavaPersistentAttribute">
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_java.ecore#//JavaPersistentAttribute/defaultMapping"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_java.ecore#//JavaPersistentAttribute/specifiedMapping"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_java.ecore#//IJavaTypeMapping"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//IJavaAttributeMapping"/>
- <nestedGenPackages prefix="JpaJavaMappings" basePackage="org.eclipse.jpt.core.internal.content.java"
- disposableProviderFactory="true" ecorePackage="old_java.ecore#//mappings">
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/IJavaEntity"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/IJavaEmbeddable"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/IJavaMappedSuperclass"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/IJavaBasic"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/IJavaEmbedded"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/IJavaEmbeddedId"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/IJavaId"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/IJavaManyToMany"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/IJavaManyToOne"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/IJavaOneToMany"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/IJavaOneToOne"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/IJavaTransient"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/IJavaVersion"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/JavaTypeMapping"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaEntity"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaMappedSuperclass"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaEmbeddable"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaNullTypeMapping"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/JavaAttributeMapping"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaBasic"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaId"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaTransient"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaVersion"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaEmbeddedId"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaEmbedded"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/JavaRelationshipMapping"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/JavaSingleRelationshipMapping"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaManyToOne"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaOneToOne"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/JavaMultiRelationshipMapping"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaOneToMany"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaManyToMany"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaNullAttributeMapping"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/AbstractJavaTable"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaTable"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaSecondaryTable"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaJoinTable"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/JavaNamedColumn"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/AbstractJavaColumn"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaColumn"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaJoinColumn"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaOverride"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaAttributeOverride"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaAssociationOverride"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaDiscriminatorColumn"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaPrimaryKeyJoinColumn"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaGeneratedValue"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaGenerator"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaTableGenerator"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaSequenceGenerator"/>
- <genClasses image="false" ecoreClass="old_java.ecore#//mappings/JavaAbstractQuery"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaNamedQuery"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaNamedNativeQuery"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaQueryHint"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaUniqueConstraint"/>
- <genClasses ecoreClass="old_java.ecore#//mappings/JavaCascade"/>
- </nestedGenPackages>
- </genPackages>
- <genPackages prefix="Orm" basePackage="org.eclipse.jpt.core.internal.content" disposableProviderFactory="true"
- ecorePackage="old_orm.ecore#/">
- <genClasses ecoreClass="old_orm.ecore#//XmlRootContentNode">
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlRootContentNode/entityMappings"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//EntityMappingsInternal">
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_orm.ecore#//EntityMappingsInternal/root"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//EntityMappingsInternal/version"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//EntityMappingsInternal/description"/>
- <genFeatures property="None" children="true" createChild="false" ecoreFeature="ecore:EReference old_orm.ecore#//EntityMappingsInternal/persistenceUnitMetadataInternal"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//EntityMappingsInternal/packageInternal"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//EntityMappingsInternal/defaultSchema"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//EntityMappingsInternal/specifiedSchema"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//EntityMappingsInternal/schema"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//EntityMappingsInternal/defaultCatalog"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//EntityMappingsInternal/specifiedCatalog"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//EntityMappingsInternal/catalog"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//EntityMappingsInternal/defaultAccess"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//EntityMappingsInternal/specifiedAccess"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//EntityMappingsInternal/access"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_orm.ecore#//EntityMappingsInternal/typeMappings"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_orm.ecore#//EntityMappingsInternal/persistentTypes"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_orm.ecore#//EntityMappingsInternal/sequenceGenerators"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_orm.ecore#//EntityMappingsInternal/tableGenerators"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_orm.ecore#//EntityMappingsInternal/namedQueries"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_orm.ecore#//EntityMappingsInternal/namedNativeQueries"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//EntityMappings">
- <genFeatures property="Readonly" notify="false" createChild="false" ecoreFeature="ecore:EReference old_orm.ecore#//EntityMappings/persistenceUnitMetadata"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//EntityMappings/package"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//EntityMappingsForXml">
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_orm.ecore#//EntityMappingsForXml/persistenceUnitMetadataForXml"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//EntityMappingsForXml/packageForXml"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_orm.ecore#//XmlTypeMapping">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//XmlTypeMapping/defaultAccess"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//XmlTypeMapping/specifiedAccess"/>
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//XmlTypeMapping/access"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//XmlTypeMapping/metadataComplete"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlTypeMapping/persistentType"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//XmlPersistentType">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//XmlPersistentType/class"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlPersistentType/attributeMappings"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlPersistentType/specifiedAttributeMappings"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlPersistentType/virtualAttributeMappings"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlPersistentType/persistentAttributes"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlPersistentType/specifiedPersistentAttributes"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlPersistentType/virtualPersistentAttributes"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//XmlMappedSuperclass">
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlMappedSuperclass/idClassForXml"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//XmlEntityInternal"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlEntityForXml">
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlEntityForXml/tableForXml"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlEntityForXml/discriminatorColumnForXml"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlEntityForXml/idClassForXml"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlEntityForXml/inheritanceForXml"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//XmlEntity">
- <genFeatures property="None" children="true" createChild="false" ecoreFeature="ecore:EReference old_orm.ecore#//XmlEntity/secondaryTables"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlEntity/virtualSecondaryTables"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//XmlEmbeddable"/>
- <genClasses image="false" ecoreClass="old_orm.ecore#//XmlAttributeMapping">
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlAttributeMapping/persistentAttribute"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//XmlNullAttributeMapping"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlBasic"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlId"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlTransient"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlEmbedded"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlEmbeddedId"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlVersion"/>
- <genClasses image="false" ecoreClass="old_orm.ecore#//XmlMultiRelationshipMappingInternal"/>
- <genClasses image="false" ecoreClass="old_orm.ecore#//XmlMultiRelationshipMappingForXml">
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlMultiRelationshipMappingForXml/joinTableForXml"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_orm.ecore#//XmlMultiRelationshipMappingForXml/mapKeyForXml"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_orm.ecore#//XmlMultiRelationshipMapping"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlOneToMany"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlManyToMany"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlPersistentAttribute">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//XmlPersistentAttribute/name"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//PersistenceUnitMetadataInternal">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//PersistenceUnitMetadataInternal/xmlMappingMetadataCompleteInternal"/>
- <genFeatures property="None" children="true" createChild="false" ecoreFeature="ecore:EReference old_orm.ecore#//PersistenceUnitMetadataInternal/persistenceUnitDefaultsInternal"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//PersistenceUnitMetadata">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//PersistenceUnitMetadata/xmlMappingMetadataComplete"/>
- <genFeatures property="Readonly" notify="false" createChild="false" ecoreFeature="ecore:EReference old_orm.ecore#//PersistenceUnitMetadata/persistenceUnitDefaults"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//PersistenceUnitMetadataForXml">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//PersistenceUnitMetadataForXml/xmlMappingMetadataCompleteForXml"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_orm.ecore#//PersistenceUnitMetadataForXml/persistenceUnitDefaultsForXml"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//PersistenceUnitDefaultsInternal">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//PersistenceUnitDefaultsInternal/schemaInternal"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//PersistenceUnitDefaultsInternal/catalogInternal"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//PersistenceUnitDefaultsInternal/accessInternal"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//PersistenceUnitDefaultsInternal/cascadePersistInternal"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//PersistenceUnitDefaults">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//PersistenceUnitDefaults/schema"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//PersistenceUnitDefaults/catalog"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//PersistenceUnitDefaults/access"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//PersistenceUnitDefaults/cascadePersist"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//PersistenceUnitDefaultsForXml">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//PersistenceUnitDefaultsForXml/schemaForXml"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//PersistenceUnitDefaultsForXml/catalogForXml"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//PersistenceUnitDefaultsForXml/accessForXml"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//PersistenceUnitDefaultsForXml/cascadePersistForXml"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//XmlTable"/>
- <genClasses image="false" ecoreClass="old_orm.ecore#//AbstractXmlNamedColumn">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//AbstractXmlNamedColumn/specifiedNameForXml"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//AbstractXmlNamedColumn/columnDefinitionForXml"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//AbstractXmlColumn">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//AbstractXmlColumn/uniqueForXml"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//AbstractXmlColumn/nullableForXml"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//AbstractXmlColumn/insertableForXml"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//AbstractXmlColumn/updatableForXml"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//AbstractXmlColumn/specifiedTableForXml"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//XmlColumn">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//XmlColumn/lengthForXml"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//XmlColumn/precisionForXml"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//XmlColumn/scaleForXml"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//XmlJoinColumn">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//XmlJoinColumn/specifiedReferencedColumnNameForXml"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//IXmlColumnMapping">
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_orm.ecore#//IXmlColumnMapping/columnForXml"/>
- <genOperations ecoreOperation="old_orm.ecore#//IXmlColumnMapping/makeColumnForXmlNonNull"/>
- <genOperations ecoreOperation="old_orm.ecore#//IXmlColumnMapping/makeColumnForXmlNull"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//XmlManyToOne"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlOneToOne"/>
- <genClasses image="false" ecoreClass="old_orm.ecore#//XmlSingleRelationshipMapping"/>
- <genClasses image="false" ecoreClass="old_orm.ecore#//XmlRelationshipMapping"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlJoinTable"/>
- <genClasses ecoreClass="old_orm.ecore#//AbstractXmlTable">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//AbstractXmlTable/specifiedNameForXml"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//AbstractXmlTable/specifiedCatalogForXml"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//AbstractXmlTable/specifiedSchemaForXml"/>
- </genClasses>
- <genClasses image="false" ecoreClass="old_orm.ecore#//XmlOverride"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlAttributeOverride"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlAssociationOverride"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlDiscriminatorColumn">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//XmlDiscriminatorColumn/discriminatorTypeForXml"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//XmlDiscriminatorColumn/specifiedLengthForXml"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//XmlSecondaryTable"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlPrimaryKeyJoinColumn">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//XmlPrimaryKeyJoinColumn/specifiedReferencedColumnNameForXml"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//XmlGeneratedValue"/>
- <genClasses image="false" ecoreClass="old_orm.ecore#//XmlGenerator"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlSequenceGenerator"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlTableGenerator"/>
- <genClasses image="false" ecoreClass="old_orm.ecore#//AbstractXmlQuery"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlNamedQuery"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlNamedNativeQuery"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlQueryHint"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlUniqueConstraint"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlCascade"/>
- <genClasses ecoreClass="old_orm.ecore#//XmlIdClass">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//XmlIdClass/value"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//XmlInheritance">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//XmlInheritance/strategy"/>
- </genClasses>
- <genClasses ecoreClass="old_orm.ecore#//XmlMapKey">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_orm.ecore#//XmlMapKey/name"/>
- </genClasses>
- </genPackages>
- <genPackages prefix="Persistence" basePackage="org.eclipse.jpt.core.internal.content"
- disposableProviderFactory="true" ecorePackage="old_persistence.ecore#/">
- <genEnums typeSafeEnumCompatible="false" ecoreEnum="old_persistence.ecore#//PersistenceUnitTransactionType">
- <genEnumLiterals ecoreEnumLiteral="old_persistence.ecore#//PersistenceUnitTransactionType/JTA"/>
- <genEnumLiterals ecoreEnumLiteral="old_persistence.ecore#//PersistenceUnitTransactionType/RESOURCE_LOCAL"/>
- </genEnums>
- <genDataTypes ecoreDataType="old_persistence.ecore#//PersistenceUnitTransactionTypeObject"/>
- <genDataTypes ecoreDataType="old_persistence.ecore#//Version"/>
- <genClasses ecoreClass="old_persistence.ecore#//PersistenceXmlRootContentNode">
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_persistence.ecore#//PersistenceXmlRootContentNode/persistence"/>
- </genClasses>
- <genClasses ecoreClass="old_persistence.ecore#//Persistence">
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_persistence.ecore#//Persistence/persistenceUnits"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_persistence.ecore#//Persistence/version"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference old_persistence.ecore#//Persistence/root"/>
- </genClasses>
- <genClasses ecoreClass="old_persistence.ecore#//PersistenceUnit">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_persistence.ecore#//PersistenceUnit/description"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_persistence.ecore#//PersistenceUnit/provider"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_persistence.ecore#//PersistenceUnit/jtaDataSource"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_persistence.ecore#//PersistenceUnit/nonJtaDataSource"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EReference old_persistence.ecore#//PersistenceUnit/mappingFiles"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_persistence.ecore#//PersistenceUnit/jarFiles"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EReference old_persistence.ecore#//PersistenceUnit/classes"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_persistence.ecore#//PersistenceUnit/excludeUnlistedClasses"/>
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_persistence.ecore#//PersistenceUnit/properties"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_persistence.ecore#//PersistenceUnit/name"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_persistence.ecore#//PersistenceUnit/transactionType"/>
- </genClasses>
- <genClasses ecoreClass="old_persistence.ecore#//MappingFileRef">
- <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute old_persistence.ecore#//MappingFileRef/fileName"/>
- </genClasses>
- <genClasses ecoreClass="old_persistence.ecore#//JavaClassRef">
- <genFeatures property="Readonly" notify="false" createChild="false" ecoreFeature="ecore:EAttribute old_persistence.ecore#//JavaClassRef/javaClass"/>
- </genClasses>
- <genClasses ecoreClass="old_persistence.ecore#//Properties">
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference old_persistence.ecore#//Properties/properties"/>
- </genClasses>
- <genClasses ecoreClass="old_persistence.ecore#//Property">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_persistence.ecore#//Property/name"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute old_persistence.ecore#//Property/value"/>
- </genClasses>
- </genPackages>
-</genmodel:GenModel>
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/old_java.ecore b/jpa/plugins/org.eclipse.jpt.core/model/old_java.ecore
deleted file mode 100644
index 4140f4d686..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/model/old_java.ecore
+++ /dev/null
@@ -1,110 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="java"
- nsURI="jpt.java.xmi" nsPrefix="org.eclipse.jpt.core.content.java">
- <eClassifiers xsi:type="ecore:EClass" name="JavaEObject" abstract="true" eSuperTypes="old_core.ecore#//JpaEObject old_core.ecore#//IJpaSourceObject">
- <eOperations name="getJpaFile" eType="ecore:EClass old_core.ecore#//IJpaFile"/>
- <eOperations name="getRoot" eType="ecore:EClass old_core.ecore#//IJpaRootContentNode"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="JpaCompilationUnit" eSuperTypes="#//JavaEObject old_core.ecore#//IJpaRootContentNode">
- <eStructuralFeatures xsi:type="ecore:EReference" name="types" upperBound="-1"
- eType="#//JavaPersistentType" containment="true" resolveProxies="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="JavaPersistentType" eSuperTypes="#//JavaEObject old_core.ecore#//IPersistentType">
- <eStructuralFeatures xsi:type="ecore:EReference" name="mapping" lowerBound="1"
- eType="#//IJavaTypeMapping" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="attributes" upperBound="-1"
- eType="#//JavaPersistentAttribute" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="access" eType="ecore:EEnum old_core.ecore#//AccessType"
- changeable="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="JavaPersistentAttribute" eSuperTypes="#//JavaEObject old_core.ecore#//IPersistentAttribute">
- <eStructuralFeatures xsi:type="ecore:EReference" name="defaultMapping" lowerBound="1"
- eType="#//IJavaAttributeMapping" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="specifiedMapping" lowerBound="1"
- eType="#//IJavaAttributeMapping" containment="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IJavaTypeMapping" abstract="true" interface="true"
- eSuperTypes="old_core.ecore#//ITypeMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="IJavaAttributeMapping" abstract="true"
- interface="true" eSuperTypes="old_core.ecore#//IAttributeMapping"/>
- <eSubpackages name="mappings" nsURI="jpt.core.java.mappings.xmi" nsPrefix="jpt.core.java.mappings">
- <eClassifiers xsi:type="ecore:EClass" name="IJavaEntity" abstract="true" interface="true"
- eSuperTypes="#//IJavaTypeMapping old_core.ecore#//mappings/IEntity"/>
- <eClassifiers xsi:type="ecore:EClass" name="IJavaEmbeddable" abstract="true" interface="true"
- eSuperTypes="#//IJavaTypeMapping old_core.ecore#//mappings/IEmbeddable"/>
- <eClassifiers xsi:type="ecore:EClass" name="IJavaMappedSuperclass" abstract="true"
- interface="true" eSuperTypes="#//IJavaTypeMapping old_core.ecore#//mappings/IMappedSuperclass"/>
- <eClassifiers xsi:type="ecore:EClass" name="IJavaBasic" abstract="true" interface="true"
- eSuperTypes="#//IJavaAttributeMapping old_core.ecore#//mappings/IBasic"/>
- <eClassifiers xsi:type="ecore:EClass" name="IJavaEmbedded" abstract="true" interface="true"
- eSuperTypes="#//IJavaAttributeMapping old_core.ecore#//mappings/IEmbedded"/>
- <eClassifiers xsi:type="ecore:EClass" name="IJavaEmbeddedId" abstract="true" interface="true"
- eSuperTypes="#//IJavaAttributeMapping old_core.ecore#//mappings/IEmbeddedId"/>
- <eClassifiers xsi:type="ecore:EClass" name="IJavaId" abstract="true" interface="true"
- eSuperTypes="#//IJavaAttributeMapping old_core.ecore#//mappings/IId"/>
- <eClassifiers xsi:type="ecore:EClass" name="IJavaManyToMany" abstract="true" interface="true"
- eSuperTypes="#//IJavaAttributeMapping old_core.ecore#//mappings/IManyToMany"/>
- <eClassifiers xsi:type="ecore:EClass" name="IJavaManyToOne" abstract="true" interface="true"
- eSuperTypes="#//IJavaAttributeMapping old_core.ecore#//mappings/IManyToOne"/>
- <eClassifiers xsi:type="ecore:EClass" name="IJavaOneToMany" abstract="true" interface="true"
- eSuperTypes="#//IJavaAttributeMapping old_core.ecore#//mappings/IOneToMany"/>
- <eClassifiers xsi:type="ecore:EClass" name="IJavaOneToOne" abstract="true" interface="true"
- eSuperTypes="#//IJavaAttributeMapping old_core.ecore#//mappings/IOneToOne"/>
- <eClassifiers xsi:type="ecore:EClass" name="IJavaTransient" abstract="true" interface="true"
- eSuperTypes="#//IJavaAttributeMapping old_core.ecore#//mappings/ITransient"/>
- <eClassifiers xsi:type="ecore:EClass" name="IJavaVersion" abstract="true" interface="true"
- eSuperTypes="#//IJavaAttributeMapping old_core.ecore#//mappings/IVersion"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaTypeMapping" abstract="true" eSuperTypes="#//JavaEObject #//IJavaTypeMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaEntity" eSuperTypes="#//mappings/JavaTypeMapping #//mappings/IJavaEntity"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaMappedSuperclass" eSuperTypes="#//mappings/JavaTypeMapping #//mappings/IJavaMappedSuperclass"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaEmbeddable" eSuperTypes="#//mappings/JavaTypeMapping #//mappings/IJavaEmbeddable"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaNullTypeMapping" eSuperTypes="#//mappings/JavaTypeMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaAttributeMapping" abstract="true"
- eSuperTypes="#//JavaEObject #//IJavaAttributeMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaBasic" eSuperTypes="#//mappings/JavaAttributeMapping #//mappings/IJavaBasic"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaId" eSuperTypes="#//mappings/JavaAttributeMapping #//mappings/IJavaId"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaTransient" eSuperTypes="#//mappings/JavaAttributeMapping #//mappings/IJavaTransient"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaVersion" eSuperTypes="#//mappings/JavaAttributeMapping #//mappings/IJavaVersion"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaEmbeddedId" eSuperTypes="#//mappings/JavaAttributeMapping #//mappings/IJavaEmbeddedId"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaEmbedded" eSuperTypes="#//mappings/JavaAttributeMapping #//mappings/IJavaEmbedded"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaRelationshipMapping" abstract="true"
- eSuperTypes="#//mappings/JavaAttributeMapping old_core.ecore#//mappings/IRelationshipMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaSingleRelationshipMapping" abstract="true"
- eSuperTypes="#//mappings/JavaRelationshipMapping old_core.ecore#//mappings/ISingleRelationshipMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaManyToOne" eSuperTypes="#//mappings/JavaSingleRelationshipMapping #//mappings/IJavaManyToOne"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaOneToOne" eSuperTypes="#//mappings/JavaSingleRelationshipMapping #//mappings/IJavaOneToOne"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaMultiRelationshipMapping" abstract="true"
- eSuperTypes="#//mappings/JavaRelationshipMapping old_core.ecore#//mappings/IMultiRelationshipMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaOneToMany" eSuperTypes="#//mappings/JavaMultiRelationshipMapping #//mappings/IJavaOneToMany"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaManyToMany" eSuperTypes="#//mappings/JavaMultiRelationshipMapping #//mappings/IJavaManyToMany"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaNullAttributeMapping" eSuperTypes="#//mappings/JavaAttributeMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="AbstractJavaTable" abstract="true"
- eSuperTypes="#//JavaEObject old_core.ecore#//mappings/ITable"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaTable" eSuperTypes="#//mappings/AbstractJavaTable"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaSecondaryTable" eSuperTypes="#//mappings/AbstractJavaTable old_core.ecore#//mappings/ISecondaryTable"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaJoinTable" eSuperTypes="#//mappings/AbstractJavaTable old_core.ecore#//mappings/IJoinTable"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaNamedColumn" abstract="true" eSuperTypes="#//JavaEObject old_core.ecore#//mappings/INamedColumn"/>
- <eClassifiers xsi:type="ecore:EClass" name="AbstractJavaColumn" abstract="true"
- eSuperTypes="#//mappings/JavaNamedColumn old_core.ecore#//mappings/IAbstractColumn"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaColumn" eSuperTypes="#//mappings/AbstractJavaColumn old_core.ecore#//mappings/IColumn"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaJoinColumn" eSuperTypes="#//mappings/AbstractJavaColumn old_core.ecore#//mappings/IJoinColumn"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaOverride" abstract="true" eSuperTypes="#//JavaEObject old_core.ecore#//mappings/IOverride"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaAttributeOverride" eSuperTypes="#//mappings/JavaOverride old_core.ecore#//mappings/IAttributeOverride"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaAssociationOverride" eSuperTypes="#//mappings/JavaOverride old_core.ecore#//mappings/IAssociationOverride"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaDiscriminatorColumn" eSuperTypes="#//mappings/JavaNamedColumn old_core.ecore#//mappings/IDiscriminatorColumn"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaPrimaryKeyJoinColumn" eSuperTypes="#//mappings/JavaNamedColumn old_core.ecore#//mappings/IPrimaryKeyJoinColumn"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaGeneratedValue" eSuperTypes="#//JavaEObject old_core.ecore#//mappings/IGeneratedValue"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaGenerator" abstract="true" eSuperTypes="#//JavaEObject old_core.ecore#//mappings/IGenerator"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaTableGenerator" eSuperTypes="#//mappings/JavaGenerator old_core.ecore#//mappings/ITableGenerator"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaSequenceGenerator" eSuperTypes="#//mappings/JavaGenerator old_core.ecore#//mappings/ISequenceGenerator"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaAbstractQuery" abstract="true"
- eSuperTypes="#//JavaEObject old_core.ecore#//mappings/IQuery"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaNamedQuery" eSuperTypes="#//mappings/JavaAbstractQuery old_core.ecore#//mappings/INamedQuery"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaNamedNativeQuery" eSuperTypes="#//mappings/JavaAbstractQuery old_core.ecore#//mappings/INamedNativeQuery"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaQueryHint" eSuperTypes="#//JavaEObject old_core.ecore#//mappings/IQueryHint"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaUniqueConstraint" eSuperTypes="#//JavaEObject old_core.ecore#//mappings/IUniqueConstraint"/>
- <eClassifiers xsi:type="ecore:EClass" name="JavaCascade" eSuperTypes="#//JavaEObject old_core.ecore#//mappings/ICascade"/>
- </eSubpackages>
-</ecore:EPackage>
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/old_orm.ecore b/jpa/plugins/org.eclipse.jpt.core/model/old_orm.ecore
deleted file mode 100644
index 030f176ca0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/model/old_orm.ecore
+++ /dev/null
@@ -1,275 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="orm"
- nsURI="jpt.orm.xmi" nsPrefix="org.eclipse.jpt.core.content.orm">
- <eClassifiers xsi:type="ecore:EClass" name="XmlRootContentNode" eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//IJpaRootContentNode">
- <eStructuralFeatures xsi:type="ecore:EReference" name="entityMappings" ordered="false"
- unique="false" lowerBound="1" eType="#//EntityMappingsInternal" resolveProxies="false"
- eOpposite="#//EntityMappingsInternal/root"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="EntityMappingsInternal" eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//IJpaContentNode #//EntityMappingsForXml #//EntityMappings">
- <eStructuralFeatures xsi:type="ecore:EReference" name="root" ordered="false" unique="false"
- lowerBound="1" eType="#//XmlRootContentNode" resolveProxies="false" eOpposite="#//XmlRootContentNode/entityMappings"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="version" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="persistenceUnitMetadataInternal"
- lowerBound="1" eType="#//PersistenceUnitMetadataInternal" changeable="false"
- containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="packageInternal" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultSchema" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedSchema" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="schema" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" transient="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultCatalog" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedCatalog" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="catalog" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- changeable="false" volatile="true" transient="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultAccess" eType="ecore:EEnum old_core.ecore#//AccessType"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedAccess" eType="ecore:EEnum old_core.ecore#//AccessType"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="access" eType="ecore:EEnum old_core.ecore#//AccessType"
- changeable="false" volatile="true" transient="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="typeMappings" upperBound="-1"
- eType="#//XmlTypeMapping" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="persistentTypes" upperBound="-1"
- eType="#//XmlPersistentType" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="sequenceGenerators" upperBound="-1"
- eType="#//XmlSequenceGenerator" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="tableGenerators" upperBound="-1"
- eType="#//XmlTableGenerator" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="namedQueries" upperBound="-1"
- eType="#//XmlNamedQuery" containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="namedNativeQueries" upperBound="-1"
- eType="#//XmlNamedNativeQuery" containment="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="EntityMappings" abstract="true" interface="true">
- <eStructuralFeatures xsi:type="ecore:EReference" name="persistenceUnitMetadata"
- eType="#//PersistenceUnitMetadata" changeable="false" volatile="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="package" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- volatile="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="EntityMappingsForXml" abstract="true"
- interface="true">
- <eStructuralFeatures xsi:type="ecore:EReference" name="persistenceUnitMetadataForXml"
- eType="#//PersistenceUnitMetadataForXml" volatile="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="packageForXml" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- volatile="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlTypeMapping" abstract="true" eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//ITypeMapping">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="defaultAccess" eType="ecore:EEnum old_core.ecore#//AccessType"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedAccess" eType="ecore:EEnum old_core.ecore#//AccessType"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="access" eType="ecore:EEnum old_core.ecore#//AccessType"
- changeable="false" volatile="true" transient="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="metadataComplete" eType="ecore:EEnum old_core.ecore#//mappings/DefaultFalseBoolean"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="persistentType" lowerBound="1"
- eType="#//XmlPersistentType" containment="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlPersistentType" eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//IPersistentType">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="class" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="attributeMappings" upperBound="-1"
- eType="#//XmlAttributeMapping" changeable="false" volatile="true" transient="true"
- containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="specifiedAttributeMappings"
- upperBound="-1" eType="#//XmlAttributeMapping" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="virtualAttributeMappings"
- upperBound="-1" eType="#//XmlAttributeMapping" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="persistentAttributes" upperBound="-1"
- eType="#//XmlPersistentAttribute" changeable="false" volatile="true" transient="true"
- resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="specifiedPersistentAttributes"
- upperBound="-1" eType="#//XmlPersistentAttribute" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="virtualPersistentAttributes"
- upperBound="-1" eType="#//XmlPersistentAttribute" resolveProxies="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlMappedSuperclass" eSuperTypes="#//XmlTypeMapping old_core.ecore#//mappings/IMappedSuperclass">
- <eStructuralFeatures xsi:type="ecore:EReference" name="idClassForXml" eType="#//XmlIdClass"
- containment="true" resolveProxies="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlEntityInternal" eSuperTypes="#//XmlTypeMapping #//XmlEntityForXml #//XmlEntity"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlEntityForXml" abstract="true" interface="true">
- <eStructuralFeatures xsi:type="ecore:EReference" name="tableForXml" eType="#//XmlTable"
- volatile="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="discriminatorColumnForXml"
- eType="#//XmlDiscriminatorColumn" volatile="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="idClassForXml" eType="#//XmlIdClass"
- containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="inheritanceForXml" eType="#//XmlInheritance"
- containment="true" resolveProxies="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlEntity" abstract="true" interface="true"
- eSuperTypes="old_core.ecore#//mappings/IEntity">
- <eStructuralFeatures xsi:type="ecore:EReference" name="secondaryTables" upperBound="-1"
- eType="ecore:EClass old_core.ecore#//mappings/ISecondaryTable" changeable="false"
- volatile="true" transient="true" containment="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="virtualSecondaryTables"
- upperBound="-1" eType="ecore:EClass old_core.ecore#//mappings/ISecondaryTable"
- containment="true" resolveProxies="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlEmbeddable" eSuperTypes="#//XmlTypeMapping old_core.ecore#//mappings/IEmbeddable"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlAttributeMapping" abstract="true"
- eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//IAttributeMapping">
- <eStructuralFeatures xsi:type="ecore:EReference" name="persistentAttribute" lowerBound="1"
- eType="#//XmlPersistentAttribute" containment="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlNullAttributeMapping" eSuperTypes="#//XmlAttributeMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlBasic" eSuperTypes="#//XmlAttributeMapping old_core.ecore#//mappings/IBasic #//IXmlColumnMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlId" eSuperTypes="#//XmlAttributeMapping old_core.ecore#//mappings/IId #//IXmlColumnMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlTransient" eSuperTypes="#//XmlAttributeMapping old_core.ecore#//mappings/ITransient"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlEmbedded" eSuperTypes="#//XmlAttributeMapping old_core.ecore#//mappings/IEmbedded"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlEmbeddedId" eSuperTypes="#//XmlAttributeMapping old_core.ecore#//mappings/IEmbeddedId"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlVersion" eSuperTypes="#//XmlAttributeMapping old_core.ecore#//mappings/IVersion #//IXmlColumnMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlMultiRelationshipMappingInternal"
- abstract="true" eSuperTypes="#//XmlRelationshipMapping old_core.ecore#//mappings/IMultiRelationshipMapping #//XmlMultiRelationshipMappingForXml #//XmlMultiRelationshipMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlMultiRelationshipMappingForXml" abstract="true"
- interface="true">
- <eStructuralFeatures xsi:type="ecore:EReference" name="joinTableForXml" eType="#//XmlJoinTable"
- volatile="true" resolveProxies="false"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="mapKeyForXml" eType="#//XmlMapKey"
- containment="true" resolveProxies="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlMultiRelationshipMapping" abstract="true"
- interface="true" eSuperTypes="old_core.ecore#//mappings/IMultiRelationshipMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlOneToMany" eSuperTypes="#//XmlMultiRelationshipMappingInternal old_core.ecore#//mappings/IOneToMany"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlManyToMany" eSuperTypes="#//XmlMultiRelationshipMappingInternal old_core.ecore#//mappings/IManyToMany"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlPersistentAttribute" eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//IPersistentAttribute">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="PersistenceUnitMetadataInternal" eSuperTypes="old_core.ecore#//XmlEObject #//PersistenceUnitMetadataForXml #//PersistenceUnitMetadata">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="xmlMappingMetadataCompleteInternal"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="persistenceUnitDefaultsInternal"
- lowerBound="1" eType="#//PersistenceUnitDefaultsInternal" changeable="false"
- containment="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="PersistenceUnitMetadata" abstract="true"
- interface="true" eSuperTypes="old_core.ecore#//IXmlEObject">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="xmlMappingMetadataComplete"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean" volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="persistenceUnitDefaults"
- eType="#//PersistenceUnitDefaults" changeable="false" volatile="true" resolveProxies="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="PersistenceUnitMetadataForXml" abstract="true"
- interface="true" eSuperTypes="old_core.ecore#//IXmlEObject">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="xmlMappingMetadataCompleteForXml"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean" volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="persistenceUnitDefaultsForXml"
- eType="#//PersistenceUnitDefaultsForXml" volatile="true" resolveProxies="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="PersistenceUnitDefaultsInternal" eSuperTypes="old_core.ecore#//XmlEObject #//PersistenceUnitDefaults #//PersistenceUnitDefaultsForXml">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="schemaInternal" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="catalogInternal" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="accessInternal" eType="ecore:EEnum old_core.ecore#//AccessType"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="cascadePersistInternal"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="PersistenceUnitDefaults" abstract="true"
- interface="true" eSuperTypes="old_core.ecore#//IXmlEObject">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="schema" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="catalog" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="access" eType="ecore:EEnum old_core.ecore#//AccessType"
- volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="cascadePersist" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
- volatile="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="PersistenceUnitDefaultsForXml" abstract="true"
- interface="true" eSuperTypes="old_core.ecore#//IXmlEObject">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="schemaForXml" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="catalogForXml" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="accessForXml" eType="ecore:EEnum old_core.ecore#//AccessType"
- volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="cascadePersistForXml" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
- volatile="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlTable" eSuperTypes="#//AbstractXmlTable old_core.ecore#//mappings/ITable"/>
- <eClassifiers xsi:type="ecore:EClass" name="AbstractXmlNamedColumn" abstract="true"
- eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//mappings/INamedColumn">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedNameForXml" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="columnDefinitionForXml"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" volatile="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="AbstractXmlColumn" abstract="true" eSuperTypes="#//AbstractXmlNamedColumn old_core.ecore#//mappings/IAbstractColumn">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="uniqueForXml" eType="ecore:EEnum old_core.ecore#//mappings/DefaultFalseBoolean"
- volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="nullableForXml" eType="ecore:EEnum old_core.ecore#//mappings/DefaultTrueBoolean"
- volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="insertableForXml" eType="ecore:EEnum old_core.ecore#//mappings/DefaultTrueBoolean"
- volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="updatableForXml" eType="ecore:EEnum old_core.ecore#//mappings/DefaultTrueBoolean"
- volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedTableForXml" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- volatile="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlColumn" eSuperTypes="#//AbstractXmlColumn old_core.ecore#//mappings/IColumn">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="lengthForXml" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
- volatile="true" defaultValueLiteral="255"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="precisionForXml" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
- volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="scaleForXml" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
- volatile="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlJoinColumn" eSuperTypes="#//AbstractXmlColumn old_core.ecore#//mappings/IJoinColumn">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedReferencedColumnNameForXml"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" volatile="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="IXmlColumnMapping" abstract="true" interface="true"
- eSuperTypes="old_core.ecore#//mappings/IColumnMapping">
- <eOperations name="makeColumnForXmlNonNull"/>
- <eOperations name="makeColumnForXmlNull"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="columnForXml" eType="#//XmlColumn"
- volatile="true" resolveProxies="false"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlManyToOne" eSuperTypes="#//XmlSingleRelationshipMapping old_core.ecore#//mappings/IManyToOne"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlOneToOne" eSuperTypes="#//XmlSingleRelationshipMapping old_core.ecore#//mappings/IOneToOne"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlSingleRelationshipMapping" abstract="true"
- eSuperTypes="#//XmlRelationshipMapping old_core.ecore#//mappings/ISingleRelationshipMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlRelationshipMapping" abstract="true"
- eSuperTypes="#//XmlAttributeMapping old_core.ecore#//mappings/IRelationshipMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlJoinTable" eSuperTypes="#//AbstractXmlTable old_core.ecore#//mappings/IJoinTable"/>
- <eClassifiers xsi:type="ecore:EClass" name="AbstractXmlTable" abstract="true" eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//mappings/ITable">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedNameForXml" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
- volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedCatalogForXml"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedSchemaForXml"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" volatile="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlOverride" abstract="true" eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//mappings/IOverride"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlAttributeOverride" eSuperTypes="#//XmlOverride old_core.ecore#//mappings/IAttributeOverride #//IXmlColumnMapping"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlAssociationOverride" eSuperTypes="#//XmlOverride old_core.ecore#//mappings/IAssociationOverride"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlDiscriminatorColumn" eSuperTypes="#//AbstractXmlNamedColumn old_core.ecore#//mappings/IDiscriminatorColumn">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="discriminatorTypeForXml"
- eType="ecore:EEnum old_core.ecore#//mappings/DiscriminatorType" volatile="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedLengthForXml"
- eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
- volatile="true" defaultValueLiteral="-1"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlSecondaryTable" eSuperTypes="#//AbstractXmlTable old_core.ecore#//mappings/ISecondaryTable"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlPrimaryKeyJoinColumn" eSuperTypes="#//AbstractXmlNamedColumn old_core.ecore#//mappings/IPrimaryKeyJoinColumn">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="specifiedReferencedColumnNameForXml"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" volatile="true"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlGeneratedValue" eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//mappings/IGeneratedValue"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlGenerator" abstract="true" eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//mappings/IGenerator"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlSequenceGenerator" eSuperTypes="#//XmlGenerator old_core.ecore#//mappings/ISequenceGenerator"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlTableGenerator" eSuperTypes="#//XmlGenerator old_core.ecore#//mappings/ITableGenerator"/>
- <eClassifiers xsi:type="ecore:EClass" name="AbstractXmlQuery" abstract="true" eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//mappings/IQuery"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlNamedQuery" eSuperTypes="#//AbstractXmlQuery old_core.ecore#//mappings/INamedQuery"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlNamedNativeQuery" eSuperTypes="#//AbstractXmlQuery old_core.ecore#//mappings/INamedNativeQuery"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlQueryHint" eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//mappings/IQueryHint"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlUniqueConstraint" eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//mappings/IUniqueConstraint"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlCascade" eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//mappings/ICascade"/>
- <eClassifiers xsi:type="ecore:EClass" name="XmlIdClass" eSuperTypes="old_core.ecore#//XmlEObject">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlInheritance" eSuperTypes="old_core.ecore#//XmlEObject">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="strategy" eType="ecore:EEnum old_core.ecore#//mappings/InheritanceType"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="XmlMapKey" eSuperTypes="old_core.ecore#//XmlEObject">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eClassifiers>
-</ecore:EPackage>
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/orm.ecore b/jpa/plugins/org.eclipse.jpt.core/model/orm.ecore
new file mode 100644
index 0000000000..4c011123e6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/model/orm.ecore
@@ -0,0 +1,469 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="orm"
+ nsURI="jpt.orm.xmi" nsPrefix="org.eclipse.jpt.core.resource.orm">
+ <eClassifiers xsi:type="ecore:EClass" name="EntityMappings">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="version" lowerBound="1"
+ eType="#//VersionType" defaultValueLiteral="1.0" unsettable="true"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="persistenceUnitMetadata"
+ eType="#//PersistenceUnitMetadata" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="package" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="schema" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="catalog" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="access" eType="#//AccessType"
+ defaultValueLiteral="PROPERTY"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="sequenceGenerators" upperBound="-1"
+ eType="#//SequenceGenerator" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="tableGenerators" upperBound="-1"
+ eType="#//TableGenerator" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="namedQueries" upperBound="-1"
+ eType="#//NamedQuery" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="namedNativeQueries" upperBound="-1"
+ eType="#//NamedNativeQuery" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="sqlResultSetMappings" upperBound="-1"
+ eType="#//SqlResultSetMapping" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="mappedSuperclasses" upperBound="-1"
+ eType="#//MappedSuperclass" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="entities" upperBound="-1"
+ eType="#//Entity" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="embeddables" upperBound="-1"
+ eType="#//Embeddable" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="PersistenceUnitMetadata">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="xmlMappingMetadataComplete"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="persistenceUnitDefaults"
+ eType="#//PersistenceUnitDefaults" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="PersistenceUnitDefaults">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="schema" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="catalog" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="access" eType="#//AccessType"
+ defaultValueLiteral="PROPERTY"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="cascadePersist" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="entityListeners" eType="#//EntityListeners"
+ containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="TypeMapping" abstract="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="className" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="access" eType="#//AccessType"
+ defaultValueLiteral="PROPERTY"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="metadataComplete" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//BooleanObject"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="attributes" eType="#//Attributes"
+ containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="MappedSuperclass" eSuperTypes="#//TypeMapping">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="idClass" eType="#//IdClass"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="excludeDefaultListeners"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="excludeSuperclassListeners"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="entityListeners" eType="#//EntityListeners"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="prePersist" eType="#//PrePersist"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="postPersist" eType="#//PostPersist"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="preRemove" eType="#//PreRemove"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="postRemove" eType="#//PostRemove"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="preUpdate" eType="#//PreUpdate"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="postUpdate" eType="#//PostUpdate"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="postLoad" eType="#//PostLoad"
+ containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Entity" eSuperTypes="#//TypeMapping">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="table" eType="#//Table"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="secondaryTables" upperBound="-1"
+ eType="#//SecondaryTable" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="primaryKeyJoinColumns"
+ upperBound="-1" eType="#//PrimaryKeyJoinColumn" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="idClass" eType="#//IdClass"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="inheritance" eType="#//Inheritance"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="discriminatorValue" eType="#//DiscriminatorValue"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="discriminatorColumn" eType="#//DiscriminatorColumn"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="sequenceGenerator" eType="#//SequenceGenerator"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="tableGenerator" eType="#//TableGenerator"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="namedQueries" upperBound="-1"
+ eType="#//NamedQuery" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="namedNativeQueries" upperBound="-1"
+ eType="#//NamedNativeQuery" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="sqlResultSetMappings" upperBound="-1"
+ eType="#//SqlResultSetMapping" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="excludeDefaultListeners"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="excludeSuperclassListeners"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="entityListeners" eType="#//EntityListeners"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="prePersist" eType="#//PrePersist"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="postPersist" eType="#//PostPersist"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="preRemove" eType="#//PreRemove"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="postRemove" eType="#//PostRemove"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="preUpdate" eType="#//PreUpdate"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="postUpdate" eType="#//PostUpdate"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="postLoad" eType="#//PostLoad"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="attributeOverrides" upperBound="-1"
+ eType="#//AttributeOverride" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="associationOverrides" upperBound="-1"
+ eType="#//AssociationOverride" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Embeddable" eSuperTypes="#//TypeMapping"/>
+ <eClassifiers xsi:type="ecore:EClass" name="Attributes">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="ids" upperBound="-1" eType="#//IdImpl"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="embeddedIds" upperBound="-1"
+ eType="#//EmbeddedIdImpl" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="basics" upperBound="-1"
+ eType="#//BasicImpl" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="versions" upperBound="-1"
+ eType="#//VersionImpl" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="manyToOnes" upperBound="-1"
+ eType="#//ManyToOneImpl" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="oneToManys" upperBound="-1"
+ eType="#//OneToManyImpl" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="oneToOnes" upperBound="-1"
+ eType="#//OneToOneImpl" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="manyToManys" upperBound="-1"
+ eType="#//ManyToManyImpl" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="embeddeds" upperBound="-1"
+ eType="#//EmbeddedImpl" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="transients" upperBound="-1"
+ eType="#//TransientImpl" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="AttributeMapping" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="ColumnMapping" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="column" eType="#//Column"
+ containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="RelationshipMapping" abstract="true"
+ interface="true" eSuperTypes="#//AttributeMapping">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="targetEntity" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="fetch" eType="#//FetchType"
+ defaultValueLiteral="LAZY"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="joinTable" eType="#//JoinTable"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="cascade" eType="#//CascadeType"
+ containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="MultiRelationshipMapping" abstract="true"
+ interface="true" eSuperTypes="#//RelationshipMapping">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="mappedBy" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="orderBy" eType="#//OrderBy"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="mapKey" eType="#//MapKey"
+ containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="SingleRelationshipMapping" abstract="true"
+ interface="true" eSuperTypes="#//RelationshipMapping">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="optional" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//BooleanObject"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="joinColumns" upperBound="-1"
+ eType="#//JoinColumn" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Id" abstract="true" interface="true"
+ eSuperTypes="#//AttributeMapping #//ColumnMapping">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="generatedValue" eType="#//GeneratedValue"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="temporal" eType="#//TemporalType"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="tableGenerator" eType="#//TableGenerator"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="sequenceGenerator" eType="#//SequenceGenerator"
+ containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="IdImpl" eSuperTypes="#//Id"/>
+ <eClassifiers xsi:type="ecore:EClass" name="EmbeddedId" abstract="true" interface="true"
+ eSuperTypes="#//AttributeMapping">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="attributeOverrides" upperBound="-1"
+ eType="#//AttributeOverride" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="EmbeddedIdImpl" eSuperTypes="#//EmbeddedId"/>
+ <eClassifiers xsi:type="ecore:EClass" name="Basic" abstract="true" interface="true"
+ eSuperTypes="#//AttributeMapping #//ColumnMapping">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="fetch" eType="#//FetchType"
+ defaultValueLiteral="LAZY"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="optional" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//BooleanObject"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="lob" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="temporal" eType="#//TemporalType"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="enumerated" eType="#//EnumType"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="BasicImpl" eSuperTypes="#//Basic"/>
+ <eClassifiers xsi:type="ecore:EClass" name="Version" abstract="true" interface="true"
+ eSuperTypes="#//AttributeMapping #//ColumnMapping">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="temporal" eType="#//TemporalType"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="VersionImpl" eSuperTypes="#//Version"/>
+ <eClassifiers xsi:type="ecore:EClass" name="ManyToOne" abstract="true" interface="true"
+ eSuperTypes="#//SingleRelationshipMapping"/>
+ <eClassifiers xsi:type="ecore:EClass" name="ManyToOneImpl" eSuperTypes="#//ManyToOne"/>
+ <eClassifiers xsi:type="ecore:EClass" name="OneToMany" abstract="true" interface="true"
+ eSuperTypes="#//MultiRelationshipMapping">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="joinColumns" upperBound="-1"
+ eType="#//JoinColumn" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="OneToManyImpl" eSuperTypes="#//OneToMany"/>
+ <eClassifiers xsi:type="ecore:EClass" name="OneToOne" abstract="true" interface="true"
+ eSuperTypes="#//SingleRelationshipMapping">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="mappedBy" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="primaryKeyJoinColumns"
+ upperBound="-1" eType="#//PrimaryKeyJoinColumn" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="OneToOneImpl" eSuperTypes="#//OneToOne"/>
+ <eClassifiers xsi:type="ecore:EClass" name="ManyToMany" abstract="true" interface="true"
+ eSuperTypes="#//MultiRelationshipMapping"/>
+ <eClassifiers xsi:type="ecore:EClass" name="ManyToManyImpl" eSuperTypes="#//ManyToMany"/>
+ <eClassifiers xsi:type="ecore:EClass" name="Embedded" abstract="true" interface="true"
+ eSuperTypes="#//AttributeMapping">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="attributeOverrides" upperBound="-1"
+ eType="#//AttributeOverride" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="EmbeddedImpl" eSuperTypes="#//Embedded"/>
+ <eClassifiers xsi:type="ecore:EClass" name="Transient" abstract="true" interface="true"
+ eSuperTypes="#//AttributeMapping"/>
+ <eClassifiers xsi:type="ecore:EClass" name="TransientImpl" eSuperTypes="#//Transient"/>
+ <eClassifiers xsi:type="ecore:EClass" name="AssociationOverride">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="joinColumns" lowerBound="1"
+ upperBound="-1" eType="#//JoinColumn" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="AttributeOverride" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="column" lowerBound="1"
+ eType="#//Column" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="AttributeOverrideImpl" eSuperTypes="#//AttributeOverride"/>
+ <eClassifiers xsi:type="ecore:EClass" name="CascadeType" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="cascadeAll" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="cascadePersist" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="cascadeMerge" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="cascadeRemove" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="cascadeRefresh" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="CascadeTypeImpl" eSuperTypes="#//CascadeType"/>
+ <eClassifiers xsi:type="ecore:EClass" name="NamedColumn" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="columnDefinition" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="AbstractColumn" abstract="true" interface="true"
+ eSuperTypes="#//NamedColumn">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="insertable" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//BooleanObject"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="nullable" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//BooleanObject"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="table" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="unique" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//BooleanObject"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="updatable" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//BooleanObject"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Column" abstract="true" interface="true"
+ eSuperTypes="#//AbstractColumn">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="length" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//IntObject"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="precision" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//IntObject"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="scale" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//IntObject"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="ColumnImpl" eSuperTypes="#//Column"/>
+ <eClassifiers xsi:type="ecore:EClass" name="ColumnResult">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="DiscriminatorColumn" eSuperTypes="#//NamedColumn">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="discriminatorType" eType="#//DiscriminatorType"
+ defaultValueLiteral="STRING"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="length" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//IntObject"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="EntityListeners">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="entityListeners" upperBound="-1"
+ eType="#//EntityListener" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="EntityListener">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="className" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="prePersist" eType="#//PrePersist"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="postPersist" eType="#//PostPersist"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="preRemove" eType="#//PreRemove"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="postRemove" eType="#//PostRemove"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="preUpdate" eType="#//PreUpdate"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="postUpdate" eType="#//PostUpdate"
+ containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="postLoad" eType="#//PostLoad"
+ containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="EntityResult">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="discriminatorColumn" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="entityClass" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="fieldResults" upperBound="-1"
+ eType="#//FieldResult" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="EventMethod">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="methodName" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="FieldResult">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="column" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="GeneratedValue" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="generator" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="strategy" eType="#//GenerationType"
+ defaultValueLiteral="TABLE"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="GeneratedValueImpl" eSuperTypes="#//GeneratedValue"/>
+ <eClassifiers xsi:type="ecore:EClass" name="IdClass">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="className" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Inheritance">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="strategy" eType="#//InheritanceType"
+ defaultValueLiteral="SINGLE_TABLE"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="JoinColumn" abstract="true" interface="true"
+ eSuperTypes="#//AbstractColumn">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="referencedColumnName" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="JoinColumnImpl" eSuperTypes="#//JoinColumn"/>
+ <eClassifiers xsi:type="ecore:EClass" name="JoinTable" abstract="true" interface="true"
+ eSuperTypes="#//AbstractTable">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="joinColumns" upperBound="-1"
+ eType="#//JoinColumn" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="inverseJoinColumns" upperBound="-1"
+ eType="#//JoinColumn" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="JoinTableImpl" eSuperTypes="#//JoinTable"/>
+ <eClassifiers xsi:type="ecore:EClass" name="Lob"/>
+ <eClassifiers xsi:type="ecore:EClass" name="MapKey" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="MapKeyImpl" eSuperTypes="#//MapKey"/>
+ <eClassifiers xsi:type="ecore:EClass" name="Query" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="query" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="hints" upperBound="-1"
+ eType="#//QueryHint" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="NamedNativeQuery" eSuperTypes="#//Query">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="resultClass" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="resultSetMapping" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="NamedQuery" eSuperTypes="#//Query"/>
+ <eClassifiers xsi:type="ecore:EClass" name="PostLoad" eSuperTypes="#//EventMethod"/>
+ <eClassifiers xsi:type="ecore:EClass" name="PostPersist" eSuperTypes="#//EventMethod"/>
+ <eClassifiers xsi:type="ecore:EClass" name="PostRemove" eSuperTypes="#//EventMethod"/>
+ <eClassifiers xsi:type="ecore:EClass" name="PostUpdate" eSuperTypes="#//EventMethod"/>
+ <eClassifiers xsi:type="ecore:EClass" name="PrePersist" eSuperTypes="#//EventMethod"/>
+ <eClassifiers xsi:type="ecore:EClass" name="PreRemove" eSuperTypes="#//EventMethod"/>
+ <eClassifiers xsi:type="ecore:EClass" name="PreUpdate" eSuperTypes="#//EventMethod"/>
+ <eClassifiers xsi:type="ecore:EClass" name="PrimaryKeyJoinColumn" eSuperTypes="#//NamedColumn">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="referencedColumnName" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="QueryHint">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="AbstractTable" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="catalog" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="schema" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="uniqueConstraints" upperBound="-1"
+ eType="#//UniqueConstraint" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Table" eSuperTypes="#//AbstractTable"/>
+ <eClassifiers xsi:type="ecore:EClass" name="SecondaryTable" eSuperTypes="#//AbstractTable">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="primaryKeyJoinColumns"
+ upperBound="-1" eType="#//PrimaryKeyJoinColumn" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Generator" abstract="true" interface="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="initialValue" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//IntObject"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="allocationSize" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//IntObject"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="SequenceGenerator" abstract="true" interface="true"
+ eSuperTypes="#//Generator">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="sequenceName" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="SequenceGeneratorImpl" eSuperTypes="#//SequenceGenerator"/>
+ <eClassifiers xsi:type="ecore:EClass" name="SqlResultSetMapping">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="entityResults" upperBound="-1"
+ eType="#//EntityResult" containment="true" resolveProxies="false"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="columnResults" upperBound="-1"
+ eType="#//ColumnResult" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="TableGenerator" abstract="true" interface="true"
+ eSuperTypes="#//Generator">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="table" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="catalog" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="schema" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="pkColumnName" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="valueColumnName" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="pkColumnValue" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="uniqueConstraints" upperBound="-1"
+ eType="#//UniqueConstraint" containment="true" resolveProxies="false"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="TableGeneratorImpl" eSuperTypes="#//TableGenerator"/>
+ <eClassifiers xsi:type="ecore:EClass" name="UniqueConstraint">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="columnNames" unique="false"
+ lowerBound="1" upperBound="-1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EDataType" name="DiscriminatorValue" instanceClassName="java.lang.String"/>
+ <eClassifiers xsi:type="ecore:EDataType" name="Enumerated" instanceClassName="org.eclipse.emf.common.util.Enumerator"/>
+ <eClassifiers xsi:type="ecore:EDataType" name="OrderBy" instanceClassName="java.lang.String"/>
+ <eClassifiers xsi:type="ecore:EDataType" name="VersionType" instanceClassName="java.lang.String"/>
+ <eClassifiers xsi:type="ecore:EEnum" name="AccessType">
+ <eLiterals name="PROPERTY"/>
+ <eLiterals name="FIELD" value="1"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="DiscriminatorType">
+ <eLiterals name="STRING"/>
+ <eLiterals name="CHAR" value="1"/>
+ <eLiterals name="INTEGER" value="2"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="EnumType">
+ <eLiterals name="ORDINAL"/>
+ <eLiterals name="STRING" value="1"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="FetchType">
+ <eLiterals name="LAZY"/>
+ <eLiterals name="EAGER" value="1"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="GenerationType">
+ <eLiterals name="TABLE"/>
+ <eLiterals name="SEQUENCE" value="1"/>
+ <eLiterals name="IDENTITY" value="2"/>
+ <eLiterals name="AUTO" value="3"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="InheritanceType">
+ <eLiterals name="SINGLE_TABLE" literal="SINGLE_TABLE"/>
+ <eLiterals name="JOINED" value="1"/>
+ <eLiterals name="TABLE_PER_CLASS" value="2" literal="TABLE_PER_CLASS"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="TemporalType">
+ <eLiterals name="DATE"/>
+ <eLiterals name="TIME" value="1"/>
+ <eLiterals name="TIMESTAMP" value="2"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/orm.ecoredi b/jpa/plugins/org.eclipse.jpt.core/model/orm.ecoredi
new file mode 100644
index 0000000000..2a157d937e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/model/orm.ecoredi
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ASCII"?>
+<diagrams:Diagrams xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.topcased.org/DI/1.0" xmlns:diagrams="http://www.topcased.org/Diagrams/1.0" xmi:id="_Zg6S0EtFEdyx4aXsvvq6Lg">
+ <model href="orm.ecore#/"/>
+ <diagrams xmi:id="_ZiDiUEtFEdyx4aXsvvq6Lg" position="0,0" size="100,100" name="No name" viewport="0,0">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_ZiDiUUtFEdyx4aXsvvq6Lg" presentation="org.topcased.modeler.ecore.ediagram">
+ <element href="orm.ecore#/"/>
+ </semanticModel>
+ </diagrams>
+</diagrams:Diagrams>
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/old_persistence.ecore b/jpa/plugins/org.eclipse.jpt.core/model/persistence.ecore
index 4deccb1608..02c5c5f7d1 100644
--- a/jpa/plugins/org.eclipse.jpt.core/model/old_persistence.ecore
+++ b/jpa/plugins/org.eclipse.jpt.core/model/persistence.ecore
@@ -2,21 +2,14 @@
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="persistence"
- nsURI="persistence.xmi" nsPrefix="org.eclipse.jpt.core.content.persistence">
- <eClassifiers xsi:type="ecore:EClass" name="PersistenceXmlRootContentNode" eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//IJpaRootContentNode">
- <eStructuralFeatures xsi:type="ecore:EReference" name="persistence" eType="#//Persistence"
- eOpposite="#//Persistence/root"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="Persistence" eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//IJpaContentNode">
+ nsURI="jpt.persistence.xmi" nsPrefix="org.eclipse.jpt.core.resource.persistence">
+ <eClassifiers xsi:type="ecore:EClass" name="XmlPersistence">
<eStructuralFeatures xsi:type="ecore:EReference" name="persistenceUnits" upperBound="-1"
- eType="#//PersistenceUnit" containment="true" resolveProxies="false"/>
+ eType="#//XmlPersistenceUnit" containment="true" resolveProxies="false"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="version" unique="false"
- lowerBound="1" eType="#//Version"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="root" ordered="false" unique="false"
- lowerBound="1" eType="#//PersistenceXmlRootContentNode" resolveProxies="false"
- eOpposite="#//PersistenceXmlRootContentNode/persistence"/>
+ lowerBound="1" eType="#//XmlVersion"/>
</eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="PersistenceUnit" eSuperTypes="old_core.ecore#//XmlEObject old_core.ecore#//IJpaContentNode">
+ <eClassifiers xsi:type="ecore:EClass" name="XmlPersistenceUnit">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="description" unique="false"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="provider" unique="false"
@@ -26,45 +19,45 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="nonJtaDataSource" unique="false"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="mappingFiles" unique="false"
- upperBound="-1" eType="#//MappingFileRef" containment="true" resolveProxies="false"/>
+ upperBound="-1" eType="#//XmlMappingFileRef" containment="true" resolveProxies="false"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="jarFiles" unique="false"
upperBound="-1" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="classes" unique="false"
- upperBound="-1" eType="#//JavaClassRef" containment="true" resolveProxies="false"/>
+ upperBound="-1" eType="#//XmlJavaClassRef" containment="true" resolveProxies="false"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="excludeUnlistedClasses"
unique="false" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//Boolean"
defaultValueLiteral="false" unsettable="true"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="properties" eType="#//Properties"
+ <eStructuralFeatures xsi:type="ecore:EReference" name="properties" eType="#//XmlProperties"
containment="true" resolveProxies="false"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" unique="false" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="transactionType" unique="false"
- eType="#//PersistenceUnitTransactionType" defaultValueLiteral="JTA" unsettable="true"/>
+ eType="#//XmlPersistenceUnitTransactionType" defaultValueLiteral="JTA" unsettable="true"/>
</eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="MappingFileRef" eSuperTypes="old_core.ecore#//XmlEObject">
+ <eClassifiers xsi:type="ecore:EClass" name="XmlMappingFileRef">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="fileName" ordered="false"
unique="false" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"
defaultValueLiteral=""/>
</eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="JavaClassRef" eSuperTypes="old_core.ecore#//XmlEObject">
+ <eClassifiers xsi:type="ecore:EClass" name="XmlJavaClassRef">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="javaClass" ordered="false"
unique="false" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
</eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="Properties" eSuperTypes="old_core.ecore#//XmlEObject">
+ <eClassifiers xsi:type="ecore:EClass" name="XmlProperties">
<eStructuralFeatures xsi:type="ecore:EReference" name="properties" upperBound="-1"
- eType="#//Property" containment="true" resolveProxies="false"/>
+ eType="#//XmlProperty" containment="true" resolveProxies="false"/>
</eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="Property" eSuperTypes="old_core.ecore#//XmlEObject">
+ <eClassifiers xsi:type="ecore:EClass" name="XmlProperty">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" unique="false" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" unique="false" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//String"/>
</eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" name="PersistenceUnitTransactionType">
+ <eClassifiers xsi:type="ecore:EEnum" name="XmlPersistenceUnitTransactionType">
<eLiterals name="JTA"/>
<eLiterals name="RESOURCE_LOCAL" value="1"/>
</eClassifiers>
- <eClassifiers xsi:type="ecore:EDataType" name="PersistenceUnitTransactionTypeObject"
+ <eClassifiers xsi:type="ecore:EDataType" name="XmlPersistenceUnitTransactionTypeObject"
instanceClassName="org.eclipse.emf.common.util.Enumerator"/>
- <eClassifiers xsi:type="ecore:EDataType" name="Version" instanceClassName="java.lang.String"/>
+ <eClassifiers xsi:type="ecore:EDataType" name="XmlVersion" instanceClassName="java.lang.String"/>
</ecore:EPackage>
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/persistence.ecoredi b/jpa/plugins/org.eclipse.jpt.core/model/persistence.ecoredi
new file mode 100644
index 0000000000..291a403df5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/model/persistence.ecoredi
@@ -0,0 +1,257 @@
+<?xml version="1.0" encoding="ASCII"?>
+<diagrams:Diagrams xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.topcased.org/DI/1.0" xmlns:diagrams="http://www.topcased.org/Diagrams/1.0" xmi:id="_PX6KMDPmEdyvyINE9bD7Ew" activeDiagram="_PYSksDPmEdyvyINE9bD7Ew">
+ <model href="persistence.ecore#/"/>
+ <diagrams xmi:id="_PYSksDPmEdyvyINE9bD7Ew" position="0,0" size="100,100" name="persistence" viewport="0,0">
+ <property xmi:id="_PrM5oDPmEdyvyINE9bD7Ew" key="pageFormatName" value="A4"/>
+ <property xmi:id="_PrM5oTPmEdyvyINE9bD7Ew" key="diagramWidth" value="840"/>
+ <property xmi:id="_PrM5ojPmEdyvyINE9bD7Ew" key="diagramHeight" value="1188"/>
+ <property xmi:id="_PrM5ozPmEdyvyINE9bD7Ew" key="pageMarginName" value="Small Margin"/>
+ <property xmi:id="_PrM5pDPmEdyvyINE9bD7Ew" key="diagramTopMargin" value="20"/>
+ <property xmi:id="_PrM5pTPmEdyvyINE9bD7Ew" key="diagramBottomMargin" value="20"/>
+ <property xmi:id="_PrM5pjPmEdyvyINE9bD7Ew" key="diagramLeftMargin" value="20"/>
+ <property xmi:id="_PrM5pzPmEdyvyINE9bD7Ew" key="diagramRightMargin" value="20"/>
+ <property xmi:id="_PrM5qDPmEdyvyINE9bD7Ew" key="orientation" value="landscape"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PYSksTPmEdyvyINE9bD7Ew" presentation="org.topcased.modeler.ecore.ediagram">
+ <element href="persistence.ecore#/"/>
+ </semanticModel>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzghEDPmEdyvyINE9bD7Ew" position="35,26" size="126,-1">
+ <anchorage xmi:id="_Pz_CMTPmEdyvyINE9bD7Ew" graphEdge="_P0pwkTPmEdyvyINE9bD7Ew"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzghETPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//Persistence"/>
+ </semanticModel>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzghEjPmEdyvyINE9bD7Ew">
+ <property xmi:id="_PzghEzPmEdyvyINE9bD7Ew" key="eStructuralFeatureID" value="21"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzghFDPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//Persistence"/>
+ </semanticModel>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzghGDPmEdyvyINE9bD7Ew" position="0,0" size="-1,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzghGTPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//Persistence/version"/>
+ </semanticModel>
+ </contained>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzghFTPmEdyvyINE9bD7Ew">
+ <property xmi:id="_PzghFjPmEdyvyINE9bD7Ew" key="eStructuralFeatureID" value="11"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzghFzPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//Persistence"/>
+ </semanticModel>
+ </contained>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzmnsDPmEdyvyINE9bD7Ew" position="35,120" size="298,-1">
+ <anchorage xmi:id="_P0pwkDPmEdyvyINE9bD7Ew" graphEdge="_P0pwkTPmEdyvyINE9bD7Ew _P0v3MDPmEdyvyINE9bD7Ew _P0v3NTPmEdyvyINE9bD7Ew _P0v3OjPmEdyvyINE9bD7Ew"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzmnsTPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnit"/>
+ </semanticModel>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzmnsjPmEdyvyINE9bD7Ew">
+ <property xmi:id="_PzmnszPmEdyvyINE9bD7Ew" key="eStructuralFeatureID" value="21"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzmntDPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnit"/>
+ </semanticModel>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzmnuDPmEdyvyINE9bD7Ew" position="0,0" size="-1,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzmnuTPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnit/description"/>
+ </semanticModel>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzmnujPmEdyvyINE9bD7Ew" position="0,0" size="-1,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzmnuzPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnit/provider"/>
+ </semanticModel>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzmnvDPmEdyvyINE9bD7Ew" position="0,0" size="-1,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzmnvTPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnit/jtaDataSource"/>
+ </semanticModel>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzmnvjPmEdyvyINE9bD7Ew" position="0,0" size="-1,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzmnvzPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnit/nonJtaDataSource"/>
+ </semanticModel>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzmnwDPmEdyvyINE9bD7Ew" position="0,0" size="-1,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzmnwTPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnit/jarFiles"/>
+ </semanticModel>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzmnwjPmEdyvyINE9bD7Ew" position="0,0" size="-1,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzmnwzPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnit/excludeUnlistedClasses"/>
+ </semanticModel>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzmnxDPmEdyvyINE9bD7Ew" position="0,0" size="-1,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzmnxTPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnit/name"/>
+ </semanticModel>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzmnxjPmEdyvyINE9bD7Ew" position="0,0" size="-1,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzmnxzPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnit/transactionType"/>
+ </semanticModel>
+ </contained>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzmntTPmEdyvyINE9bD7Ew">
+ <property xmi:id="_PzmntjPmEdyvyINE9bD7Ew" key="eStructuralFeatureID" value="11"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzmntzPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnit"/>
+ </semanticModel>
+ </contained>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzmnyDPmEdyvyINE9bD7Ew" position="162,360" size="135,-1">
+ <anchorage xmi:id="_P0pwlTPmEdyvyINE9bD7Ew" graphEdge="_P0v3MDPmEdyvyINE9bD7Ew"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzmnyTPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//MappingFileRef"/>
+ </semanticModel>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzmnyjPmEdyvyINE9bD7Ew">
+ <property xmi:id="_PzmnyzPmEdyvyINE9bD7Ew" key="eStructuralFeatureID" value="21"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzmnzDPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//MappingFileRef"/>
+ </semanticModel>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzsuUDPmEdyvyINE9bD7Ew" position="0,0" size="-1,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzsuUTPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//MappingFileRef/fileName"/>
+ </semanticModel>
+ </contained>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzmnzTPmEdyvyINE9bD7Ew">
+ <property xmi:id="_PzmnzjPmEdyvyINE9bD7Ew" key="eStructuralFeatureID" value="11"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzmnzzPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//MappingFileRef"/>
+ </semanticModel>
+ </contained>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzsuUjPmEdyvyINE9bD7Ew" position="342,359" size="141,-1">
+ <anchorage xmi:id="_P0v3NDPmEdyvyINE9bD7Ew" graphEdge="_P0v3NTPmEdyvyINE9bD7Ew"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzsuUzPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//JavaClassRef"/>
+ </semanticModel>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzsuVDPmEdyvyINE9bD7Ew">
+ <property xmi:id="_PzsuVTPmEdyvyINE9bD7Ew" key="eStructuralFeatureID" value="21"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzsuVjPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//JavaClassRef"/>
+ </semanticModel>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzsuWjPmEdyvyINE9bD7Ew" position="0,0" size="-1,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzsuWzPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//JavaClassRef/javaClass"/>
+ </semanticModel>
+ </contained>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzsuVzPmEdyvyINE9bD7Ew">
+ <property xmi:id="_PzsuWDPmEdyvyINE9bD7Ew" key="eStructuralFeatureID" value="11"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzsuWTPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//JavaClassRef"/>
+ </semanticModel>
+ </contained>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzsuXDPmEdyvyINE9bD7Ew" position="37,361" size="95,-1">
+ <anchorage xmi:id="_P0v3OTPmEdyvyINE9bD7Ew" graphEdge="_P0v3OjPmEdyvyINE9bD7Ew _P0v3PzPmEdyvyINE9bD7Ew"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzsuXTPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//Properties"/>
+ </semanticModel>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzsuXjPmEdyvyINE9bD7Ew">
+ <property xmi:id="_PzsuXzPmEdyvyINE9bD7Ew" key="eStructuralFeatureID" value="21"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzsuYDPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//Properties"/>
+ </semanticModel>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzsuYTPmEdyvyINE9bD7Ew">
+ <property xmi:id="_PzsuYjPmEdyvyINE9bD7Ew" key="eStructuralFeatureID" value="11"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzsuYzPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//Properties"/>
+ </semanticModel>
+ </contained>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzsuZDPmEdyvyINE9bD7Ew" position="37,455" size="109,-1">
+ <anchorage xmi:id="_P0v3PjPmEdyvyINE9bD7Ew" graphEdge="_P0v3PzPmEdyvyINE9bD7Ew"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzsuZTPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//Property"/>
+ </semanticModel>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzsuZjPmEdyvyINE9bD7Ew">
+ <property xmi:id="_PzsuZzPmEdyvyINE9bD7Ew" key="eStructuralFeatureID" value="21"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzsuaDPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//Property"/>
+ </semanticModel>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzsubDPmEdyvyINE9bD7Ew" position="0,0" size="-1,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzsubTPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//Property/name"/>
+ </semanticModel>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzsubjPmEdyvyINE9bD7Ew" position="0,0" size="-1,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzsubzPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//Property/value"/>
+ </semanticModel>
+ </contained>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzsuaTPmEdyvyINE9bD7Ew">
+ <property xmi:id="_PzsuajPmEdyvyINE9bD7Ew" key="eStructuralFeatureID" value="11"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzsuazPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//Property"/>
+ </semanticModel>
+ </contained>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzsucDPmEdyvyINE9bD7Ew" position="365,183" size="209,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzsucTPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnitTransactionType"/>
+ </semanticModel>
+ <contained xsi:type="di:GraphNode" xmi:id="_PzsucjPmEdyvyINE9bD7Ew">
+ <property xmi:id="_PzsuczPmEdyvyINE9bD7Ew" key="eStructuralFeatureID" value="9"/>
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_PzsudDPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnitTransactionType"/>
+ </semanticModel>
+ <contained xsi:type="di:GraphNode" xmi:id="_Pzy08DPmEdyvyINE9bD7Ew" position="0,0" size="-1,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_Pzy08TPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnitTransactionType/JTA"/>
+ </semanticModel>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_Pzy08jPmEdyvyINE9bD7Ew" position="0,0" size="-1,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_Pzy08zPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnitTransactionType/RESOURCE_LOCAL"/>
+ </semanticModel>
+ </contained>
+ </contained>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_Pzy09DPmEdyvyINE9bD7Ew" position="365,121" size="292,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_Pzy09TPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnitTransactionTypeObject"/>
+ </semanticModel>
+ </contained>
+ <contained xsi:type="di:GraphNode" xmi:id="_Pzy09jPmEdyvyINE9bD7Ew" position="239,26" size="174,-1">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_Pzy09zPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//Version"/>
+ </semanticModel>
+ </contained>
+ <contained xsi:type="di:GraphEdge" xmi:id="_P0pwkTPmEdyvyINE9bD7Ew" anchor="_Pz_CMTPmEdyvyINE9bD7Ew _P0pwkDPmEdyvyINE9bD7Ew">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_P0pwkjPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//Persistence/persistenceUnits"/>
+ </semanticModel>
+ <contained xsi:type="di:EdgeObjectUV" xmi:id="_P0pwkzPmEdyvyINE9bD7Ew" id="nameLabel" uDistance="20" vDistance="20"/>
+ <contained xsi:type="di:EdgeObjectUV" xmi:id="_P0pwlDPmEdyvyINE9bD7Ew" id="cardinalityLabel" uDistance="20" vDistance="-20"/>
+ </contained>
+ <contained xsi:type="di:GraphEdge" xmi:id="_P0v3MDPmEdyvyINE9bD7Ew" anchor="_P0pwkDPmEdyvyINE9bD7Ew _P0pwlTPmEdyvyINE9bD7Ew">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_P0v3MTPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnit/mappingFiles"/>
+ </semanticModel>
+ <contained xsi:type="di:EdgeObjectUV" xmi:id="_P0v3MjPmEdyvyINE9bD7Ew" id="nameLabel" uDistance="5" vDistance="13"/>
+ <contained xsi:type="di:EdgeObjectUV" xmi:id="_P0v3MzPmEdyvyINE9bD7Ew" id="cardinalityLabel" uDistance="5" vDistance="-19"/>
+ </contained>
+ <contained xsi:type="di:GraphEdge" xmi:id="_P0v3NTPmEdyvyINE9bD7Ew" anchor="_P0pwkDPmEdyvyINE9bD7Ew _P0v3NDPmEdyvyINE9bD7Ew">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_P0v3NjPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnit/classes"/>
+ </semanticModel>
+ <contained xsi:type="di:EdgeObjectUV" xmi:id="_P0v3NzPmEdyvyINE9bD7Ew" id="nameLabel" uDistance="10" vDistance="1"/>
+ <contained xsi:type="di:EdgeObjectUV" xmi:id="_P0v3ODPmEdyvyINE9bD7Ew" id="cardinalityLabel" uDistance="-3" vDistance="-35"/>
+ </contained>
+ <contained xsi:type="di:GraphEdge" xmi:id="_P0v3OjPmEdyvyINE9bD7Ew" anchor="_P0pwkDPmEdyvyINE9bD7Ew _P0v3OTPmEdyvyINE9bD7Ew">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_P0v3OzPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//PersistenceUnit/properties"/>
+ </semanticModel>
+ <contained xsi:type="di:EdgeObjectUV" xmi:id="_P0v3PDPmEdyvyINE9bD7Ew" id="nameLabel" uDistance="7" vDistance="18"/>
+ <contained xsi:type="di:EdgeObjectUV" xmi:id="_P0v3PTPmEdyvyINE9bD7Ew" id="cardinalityLabel" uDistance="7" vDistance="-14"/>
+ </contained>
+ <contained xsi:type="di:GraphEdge" xmi:id="_P0v3PzPmEdyvyINE9bD7Ew" anchor="_P0v3OTPmEdyvyINE9bD7Ew _P0v3PjPmEdyvyINE9bD7Ew">
+ <semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_P0v3QDPmEdyvyINE9bD7Ew" presentation="default">
+ <element href="persistence.ecore#//Properties/properties"/>
+ </semanticModel>
+ <contained xsi:type="di:EdgeObjectUV" xmi:id="_P0v3QTPmEdyvyINE9bD7Ew" id="nameLabel" uDistance="8" vDistance="14"/>
+ <contained xsi:type="di:EdgeObjectUV" xmi:id="_P0v3QjPmEdyvyINE9bD7Ew" id="cardinalityLabel" uDistance="9" vDistance="-14"/>
+ </contained>
+ </diagrams>
+</diagrams:Diagrams>
diff --git a/jpa/plugins/org.eclipse.jpt.core/plugin.xml b/jpa/plugins/org.eclipse.jpt.core/plugin.xml
index 023f4eaedf..c5d4d48274 100644
--- a/jpa/plugins/org.eclipse.jpt.core/plugin.xml
+++ b/jpa/plugins/org.eclipse.jpt.core/plugin.xml
@@ -52,24 +52,27 @@
point="org.eclipse.core.runtime.contentTypes">
<content-type
- id="org.eclipse.jpt.core.content.orm"
- name="%ORM_XML_CONTENT"
- base-type="org.eclipse.core.runtime.xml"
- file-names="orm.xml"
- priority="normal">
- Only allowing file names of orm.xml. Extenders will have to specify a different file name.
- Limitation with WTP translators for registering files names instead of content types
+ id="org.eclipse.jpt.core.content.orm"
+ name="%ORM_XML_CONTENT"
+ base-type="org.eclipse.core.runtime.xml"
+ file-names="orm.xml">
+ <describer
+ class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber">
+ <parameter name="element" value="entity-mappings"/>
+ </describer>
</content-type>
<content-type
- id="org.eclipse.jpt.core.content.persistence"
- name="%PERSISTENCE_XML_CONTENT"
- base-type="org.eclipse.core.runtime.xml"
- file-names="persistence.xml"
- priority="normal">
- Only allowing file names of persistence.xml.
+ id="org.eclipse.jpt.core.content.persistence"
+ name="%PERSISTENCE_XML_CONTENT"
+ base-type="org.eclipse.core.runtime.xml"
+ file-names="persistence.xml">
+ <describer
+ class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber">
+ <parameter name="element" value="persistence"/>
+ </describer>
</content-type>
-
+
</extension>
@@ -80,15 +83,15 @@
class="org.eclipse.jpt.core.internal.prefs.JpaPreferenceInitializer"/>
</extension>
-
-
+
+
<!-- ***** WTP extensions ***** -->
<extension
point="org.eclipse.wst.common.modulecore.resourceFactories">
<resourceFactory
- class="org.eclipse.jpt.core.internal.content.persistence.resource.PersistenceResourceFactory"
+ class="org.eclipse.jpt.core.internal.resource.persistence.PersistenceResourceFactory"
isDefault="true"
shortSegment="persistence.xml">
<contentTypeBinding
@@ -97,7 +100,7 @@
</resourceFactory>
<resourceFactory
- class="org.eclipse.jpt.core.internal.content.orm.resource.OrmResourceFactory"
+ class="org.eclipse.jpt.core.internal.resource.orm.OrmResourceFactory"
isDefault="true"
shortSegment="orm.xml">
<contentTypeBinding
@@ -235,7 +238,7 @@
<jpaPlatform
id="generic"
label="%GENERIC_PLATFORM_LABEL"
- class="org.eclipse.jpt.core.internal.platform.generic.GenericPlatform"/>
+ class="org.eclipse.jpt.core.internal.platform.generic.GenericJpaPlatform"/>
</extension>
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractResourceModel.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractResourceModel.java
new file mode 100644
index 0000000000..0db133a52b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractResourceModel.java
@@ -0,0 +1,52 @@
+package org.eclipse.jpt.core.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
+
+public abstract class AbstractResourceModel extends AbstractModel
+ implements IResourceModel
+{
+ private final List<IJpaContextNode> rootContextNodes;
+
+
+ protected AbstractResourceModel() {
+ this.rootContextNodes = new ArrayList<IJpaContextNode>();
+ }
+
+
+ public abstract Object resource();
+
+ public ListIterator<IJpaContextNode> rootContextNodes() {
+ return new CloneListIterator<IJpaContextNode>(rootContextNodes);
+ }
+
+ public void addRootContextNode(IJpaContextNode contextNode) {
+ addRootContextNode(rootContextNodes.size(), contextNode);
+ }
+
+ public void addRootContextNode(int index, IJpaContextNode contextNode) {
+ if (! rootContextNodes.contains(contextNode)) {
+ rootContextNodes.add(index, contextNode);
+ fireItemAdded(ROOT_CONTEXT_NODE_LIST, index, contextNode);
+ }
+ }
+
+ public void removeRootContextNode(IJpaContextNode contextNode) {
+ if (rootContextNodes.contains(contextNode)) {
+ removeRootContextNode(rootContextNodes.indexOf(contextNode));
+ }
+ }
+
+ public void removeRootContextNode(int index) {
+ IJpaContextNode contextNode = rootContextNodes.remove(index);
+ fireItemRemoved(ROOT_CONTEXT_NODE_LIST, index, contextNode);
+ }
+
+ public void dispose() {
+ this.rootContextNodes.clear();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AsynchronousJpaProjectUpdater.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AsynchronousJpaProjectUpdater.java
new file mode 100644
index 0000000000..17ab50273a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AsynchronousJpaProjectUpdater.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jpt.core.internal.IJpaProject;
+import org.eclipse.jpt.utility.internal.StringTools;
+
+/**
+ * This updater will update the project in a job that executes in a separate
+ * thread and allows calls to #update() to return immediately.
+ */
+public class AsynchronousJpaProjectUpdater implements IJpaProject.Updater {
+ protected final IJpaProject jpaProject;
+ protected final UpdateJob job;
+
+ public AsynchronousJpaProjectUpdater(IJpaProject jpaProject) {
+ super();
+ this.jpaProject = jpaProject;
+ this.job = this.buildJob();
+ }
+
+ protected UpdateJob buildJob() {
+ return new UpdateJob();
+ }
+
+ /**
+ * Let the job run to completion (i.e. do not cancel it).
+ * This should reduce the number of times the job is re-scheduled.
+ */
+ public void update() {
+ this.job.schedule();
+ }
+
+ /**
+ * prevent the job from running again and wait for the current
+ * execution, if there is any, to end before returning
+ */
+ public void dispose() {
+ this.job.setShouldSchedule(false);
+ try {
+ this.job.join();
+ } catch (InterruptedException ex) {
+ // the job thread was interrupted while waiting - ignore
+ }
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.jpaProject);
+ }
+
+
+ /**
+ * This is the job that gets scheduled by the asynchronous updater.
+ * When the job is run it tells the JPA project to "update".
+ * Only a single instance of this job per project can run at a time.
+ */
+ protected class UpdateJob extends Job {
+ protected boolean shouldSchedule;
+
+ protected UpdateJob() {
+ super("Update JPA project: " + AsynchronousJpaProjectUpdater.this.jpaProject.name()); // TODO i18n
+ this.shouldSchedule = true;
+ this.setRule(AsynchronousJpaProjectUpdater.this.jpaProject.project());
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ return AsynchronousJpaProjectUpdater.this.jpaProject.update(monitor);
+ }
+
+ /**
+ * When setting to false, the job does not stop immediately;
+ * but it won't run again, even if it is scheduled.
+ */
+ public void setShouldSchedule(boolean shouldSchedule) {
+ this.shouldSchedule = shouldSchedule;
+ }
+
+ @Override
+ public boolean shouldSchedule() {
+ return this.shouldSchedule;
+ }
+
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaTransientContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IContextModel.java
index 088e34a48a..fb074eec17 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaTransientContext.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IContextModel.java
@@ -7,19 +7,26 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.platform;
+package org.eclipse.jpt.core.internal;
import java.util.List;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaTransient;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-public class JavaTransientContext extends JavaAttributeContext
+public interface IContextModel
{
- public JavaTransientContext(IContext parentContext, JavaTransient javaTransient) {
- super(parentContext, javaTransient);
- }
-
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
- }
-}
+ /**
+ * Update the context model with the content of the JPA project
+ */
+ void update(IProgressMonitor monitor);
+
+ // ********** validation **********
+
+ /**
+ * All subclass implementations {@link #addToMessages(List<IMessage>, CompilationUnit astRoot)}
+ * should be preceded by a "super" call to this method
+ */
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot);
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaAnnotationProvider.java
new file mode 100644
index 0000000000..2703d4c39b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaAnnotationProvider.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.Type;
+import org.eclipse.jpt.core.internal.resource.java.Annotation;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+
+public interface IJpaAnnotationProvider
+{
+ /**
+ * Build an Annotation with the given fully qualififed annotation name.
+ * @param type
+ * @param mappingAnnotationName
+ * @return
+ */
+ Annotation buildTypeMappingAnnotation(JavaPersistentTypeResource parent, Type type, String mappingAnnotationName);
+
+ Annotation buildNullTypeMappingAnnotation(JavaPersistentTypeResource parent, Type type, String mappingAnnotationName);
+
+ /**
+ * Build an Annotation with the given fully qualififed annotation name.
+ * @param type
+ * @param annotationName
+ * @return
+ */
+ Annotation buildTypeAnnotation(JavaPersistentTypeResource parent, Type type, String annotationName);
+
+ Annotation buildNullTypeAnnotation(JavaPersistentTypeResource parent, Type type, String annotationName);
+
+ /**
+ * Ordered iterator of fully qualified annotation names that can apply to a Type
+ */
+ ListIterator<String> typeMappingAnnotationNames();
+
+ /**
+ * Iterator of fully qualified annotation(non-mapping) names that can apply to a Type
+ */
+ Iterator<String> typeAnnotationNames();
+
+ /**
+ * Build a Annotation with the given fully qualififed annotation name.
+ * @param attribute
+ * @param mappingAnnotationName
+ * @return
+ */
+ Annotation buildAttributeMappingAnnotation(JavaPersistentAttributeResource parent, Attribute attribute, String mappingAnnotationName);
+
+ Annotation buildNullAttributeMappingAnnotation(JavaPersistentAttributeResource parent, Attribute attribute, String mappingAnnotationName);
+
+ /**
+ * Build an Annotation with the given fully qualififed annotation name.
+ * @param attribute
+ * @param annotationName
+ * @return
+ */
+ Annotation buildAttributeAnnotation(JavaPersistentAttributeResource parent, Attribute attribute, String annotationName);
+
+ Annotation buildNullAttributeAnnotation(JavaPersistentAttributeResource parent, Attribute attribute, String annotationName);
+
+
+ /**
+ * Ordered iterator of fully qualified annotation names that can apply to an Attribute
+ */
+ ListIterator<String> attributeMappingAnnotationNames();
+
+ /**
+ * Iterator of fully qualified annotation(non-mapping) names that can apply to an Attribute
+ */
+ Iterator<String> attributeAnnotationNames();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaDataSource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaDataSource.java
index 60414702f7..6bb7df5633 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaDataSource.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaDataSource.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -12,36 +12,44 @@ package org.eclipse.jpt.core.internal;
import org.eclipse.jpt.db.internal.ConnectionProfile;
/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJpa Data Source</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIJpaDataSource()
- * @model kind="class" interface="true" abstract="true"
- * @generated
+ *
*/
-public interface IJpaDataSource extends IJpaEObject
-{
+public interface IJpaDataSource extends IJpaNode {
+
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation" unique="false" required="true" ordered="false"
- * @generated
+ * Return the data source's connection profile name.
+ * The connection profile is looked up based on this setting.
*/
- String getConnectionProfileName();
-
- void setConnectionProfileName(String newConnectionProfileName);
-
- boolean isConnected();
-
- boolean hasAConnection();
-
+ String connectionProfileName();
+
+ /**
+ * Set the data source's connection profile name.
+ * The connection profile is looked up based on this setting.
+ */
+ void setConnectionProfileName(String connectionProfileName);
+
+ /**
+ * ID string used when connectionProfileName property is changed
+ * @see org.eclipse.jpt.utility.internal.model.Model#addPropertyChangeListener(String, org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener)
+ */
+ public static final String CONNECTION_PROFILE_NAME_PROPERTY = "connectionProfileName";
+
/**
* The data source's connection profile should never be null.
* If we do not have a connection, return a "null" connection profile.
*/
- ConnectionProfile getConnectionProfile();
-
+ ConnectionProfile connectionProfile();
+
+ /**
+ * ID string used when connectionProfile property is changed
+ * @see org.eclipse.jpt.utility.internal.model.Model#addPropertyChangeListener(String, org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener)
+ */
+ public static final String CONNECTION_PROFILE_PROPERTY = "connectionProfile";
+
+ boolean isConnected();
+
+ boolean hasAConnection();
+
void dispose();
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaEObject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaEObject.java
index 1c1a5c22ad..0e6ed632dc 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaEObject.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaEObject.java
@@ -31,7 +31,5 @@ public interface IJpaEObject extends EObject
*/
IResource getResource();
- IJpaFactory jpaFactory();
-
IJpaPlatform jpaPlatform();
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaFactory.java
index 8c405d8dcb..bd55860c25 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaFactory.java
@@ -11,63 +11,48 @@ package org.eclipse.jpt.core.internal;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaBasic;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddable;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbedded;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddedId;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaEntity;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaId;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToMany;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToOne;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaMappedSuperclass;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToMany;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToOne;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaTransient;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaVersion;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
-import org.eclipse.jpt.core.internal.platform.BaseJpaFactory;
+import org.eclipse.jpt.core.internal.platform.base.BaseJpaFactory;
/**
- * Use IJpaFactory to create any IJavaTypeMapping or IJavaAttributeMappings. This is necessary
- * so that platforms can extend the java model with their own annotations.
- * IJavaTypeMappingProvider and IJavaAttributeMappingProvider use this factory.
- * See IJpaPlatform.javaTypeMappingProviders() and IJpaPlatform.javaAttributeMappingProviders()
- * for creating new mappings types.
+ * Use IJpaFactory to create any core (e.g. IJpaProject), resource
+ * (e.g. PersistenceResource), or context (e.g. IAttributeMapping) model objects.
* @see BaseJpaFactory
*/
-public interface IJpaFactory {
-
+public interface IJpaFactory
+{
+ /**
+ * Construct an IJpaProject for the specified config, to be
+ * added to the specified JPA project. Return null if unable to create
+ * the JPA file (e.g. the content type is unrecognized).
+ */
IJpaProject createJpaProject(IJpaProject.Config config) throws CoreException;
-
- IJpaDataSource createDataSource(IJpaProject jpaProject, String connectionProfileName);
-
- IJpaFile createJpaFile(IJpaProject jpaProject, IFile file, IJpaFileContentProvider provider);
-
- IJavaEntity createJavaEntity(Type type);
-
- IJavaEmbeddable createJavaEmbeddable(Type type);
-
- IJavaMappedSuperclass createJavaMappedSuperclass(Type type);
-
- IJavaBasic createJavaBasic(Attribute attribute);
-
- IJavaEmbedded createJavaEmbedded(Attribute attribute);
-
- IJavaEmbeddedId createJavaEmbeddedId(Attribute attribute);
- IJavaId createJavaId(Attribute attribute);
-
- IJavaManyToMany createJavaManyToMany(Attribute attribute);
-
- IJavaManyToOne createJavaManyToOne(Attribute attribute);
-
- IJavaOneToMany createJavaOneToMany(Attribute attribute);
-
- IJavaOneToOne createJavaOneToOne(Attribute attribute);
-
- IJavaTransient createJavaTransient(Attribute attribute);
-
- IJavaVersion createJavaVersion(Attribute attribute);
-
+ IJpaDataSource createJpaDataSource(IJpaProject jpaProject, String connectionProfileName);
+
+ /**
+ * Construct a JPA file for the specified file and with the specified resource
+ * model, to be added to the specified JPA project.
+ * This should be non-null iff (if and only if) {@link #hasRelevantContent(IFile)}
+ * returns true.
+ */
+ IJpaFile createJpaFile(IJpaProject jpaProject, IFile file, IResourceModel resourceModel);
+
+ /**
+ * Return true if a resource model will be provided for the given file
+ */
+ boolean hasRelevantContent(IFile file);
+
+ /**
+ * Build a resource model to be associated with the given file.
+ * This should be non-null iff (if and only if) {@link #hasRelevantContent(IFile)}
+ * returns true.
+ */
+ IResourceModel buildResourceModel(IJpaProject jpaProject, IFile file);
+
+ /**
+ * Build a (updated) context model to be associated with the given JPA project.
+ * The context model will be built once, but updated many times.
+ * @see update(IJpaProject, IContextModel, IProgressMonitor)
+ */
+ IContextModel buildContextModel(IJpaProject jpaProject);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaFile.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaFile.java
index cb27fe0861..bf34e57bd3 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaFile.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaFile.java
@@ -11,40 +11,18 @@ package org.eclipse.jpt.core.internal;
import org.eclipse.core.resources.IFile;
import org.eclipse.jdt.core.ElementChangedEvent;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IPersistence File</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIJpaFile()
- * @model kind="class" interface="true" abstract="true"
- * @generated
+ *
*/
-public interface IJpaFile extends IJpaEObject
+public interface IJpaFile extends IJpaNode
{
/**
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Content</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @model kind="operation"
- * @generated
- */
- IJpaRootContentNode getContent();
-
- void setContent(IJpaRootContentNode content);
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation" required="true"
- * @generated
+ * Return the type of resource represented by this JPA file
+ * @see IResourceModel#getResourceType()
*/
- String getContentId();
+ String getResourceType();
/**
* Return the IFile associated with this JPA file
@@ -52,10 +30,14 @@ public interface IJpaFile extends IJpaEObject
IFile getFile();
/**
- * Return the content node corresponding to the given offset in the source.
- * This may (and often will) be <code>null</code>.
+ * Return the resource model represented by this JPA file
*/
- IJpaContentNode getContentNode(int offset);
+ IResourceModel getResourceModel();
+
+ /**
+ * Return the context node best represented by the location in the file
+ */
+ IJpaContextNode contextNode(int textOffset);
/**
* Forward the Java element changed event to the JPA file's content.
@@ -67,4 +49,16 @@ public interface IJpaFile extends IJpaEObject
* hooks to external resources etc.
*/
void dispose();
+
+ /**
+ * jpaFile was added to the JpaProject
+ * @param jpaFile
+ */
+ void fileAdded(IJpaFile jpaFile);
+
+ /**
+ * jpaFile was removed from the JpaProject
+ * @param jpaFile
+ */
+ void fileRemoved(IJpaFile jpaFile);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaFileContentProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaFileContentProvider.java
deleted file mode 100644
index c6e6c48c41..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaFileContentProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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;
-
-
-/**
- * A JpaProject corresponds to an IProject and containts of JpaFiles.
- * A JpaFile corresponds to a file resource in the project and contains
- * an IJpaRootContentNode. Specify an IJpaFileContentProvider for each
- * file contentType to be included in the JpaProject.
- *
- * See IJpaPlatform
- *
- */
-public interface IJpaFileContentProvider
-{
- /**
- * Create the IJpaRootContentNode for the given IFile.
- * This will be set on the corresponding JpaFile in the JpaProject.
- * The file passed in will have a contentType that matches
- * the one returned by the contentType() method.
- */
- IJpaRootContentNode buildRootContent(IJpaFile jpaFile);
-
- /**
- * Return the contentType of the file to be included in the JpaProject.
- * This contentType should correspond to one specified through the
- * org.eclipse.core.runtime.contentTypes extension point.
- * @return
- */
- String contentType();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaModel.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaModel.java
index 50fa21bc18..a37c41410e 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaModel.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaModel.java
@@ -10,7 +10,6 @@
package org.eclipse.jpt.core.internal;
import java.util.Iterator;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaModelObject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaModelObject.java
new file mode 100644
index 0000000000..eba02cd988
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaModelObject.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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;
+
+public interface IJpaModelObject
+{
+ Object getParent();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaNode.java
index 71e1631999..c467ec0ebe 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaNode.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,25 +9,38 @@
******************************************************************************/
package org.eclipse.jpt.core.internal;
+import java.util.List;
+
import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jpt.utility.internal.node.Node;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* Tweak the node interface with JPA-specific protocol.
*/
-public interface IJpaNode extends Node {
+public interface IJpaNode extends Node, IAdaptable
+{
/**
- * Return the JPA project the object belongs to.
+ * Return the JPA project the node belongs to.
*/
IJpaProject jpaProject();
/**
- * Return the resource that most directly contains the object.
+ * Return the resource that most directly contains the node.
* This is used by JpaHelper.
*/
IResource resource();
-
+
+
+ // ********** validation **********
+
+ /**
+ * Adds to the list of current messages
+ */
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot);
// ********** covariant overrides **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaPlatform.java
index 4b2c6c2d0b..7ca4796b38 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaPlatform.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaPlatform.java
@@ -9,27 +9,21 @@
******************************************************************************/
package org.eclipse.jpt.core.internal;
-import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.content.java.IDefaultJavaAttributeMappingProvider;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMappingProvider;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMappingProvider;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.platform.IContext;
+import org.eclipse.jpt.core.internal.context.java.IJavaAttributeMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.context.java.IJavaTypeMapping;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
* This interface is to be implemented by a JPA vendor to provide extensions to
- * the core JPA model. The core JPA model will provide functinality for JPA
- * spec annotations in java and the orm.xml mapping file.
+ * the core JPA model. The core JPA model will provide functionality for JPA
+ * spec annotations in java, persistence.xml and (orm.xml) mapping files.
* The org.eclipse.jpt.core.genericPlatform extension supplies
- * IJpaFileContentProvider for those file types. As another vendor option you
- * will have to supply those IJpaFileContentProviders as well or different ones
+ * resource models for those file types. As another vendor option you
+ * will have to supply those resource models as well or different ones
* as necessary.
*
* See the org.eclipse.jpt.core.jpaPlatform extension point
@@ -50,137 +44,105 @@ public interface IJpaPlatform
*/
void setId(String theId);
- /**
- * Get the IJpaProject for this platform
- */
- IJpaProject getProject();
-
- /**
- * Set the IJpaProject on this platform
- */
- void setProject(IJpaProject jpaProject);
-
- IJpaFactory getJpaFactory();
-
- /**
- * Construct a JPA file for the specified file, to be
- * added to the specified JPA project. Return null if unable to create
- * the JPA file (e.g. the content type is unrecognized).
- */
- IJpaFile createJpaFile(IJpaProject jpaProject, IFile file);
-
- // ********** Persistence Unit ********************************************
- boolean containsPersistenceUnitNamed(String name);
-
- PersistenceUnit persistenceUnitNamed(String name);
-
- Iterator<PersistenceUnit> persistenceUnits();
-
- int persistenceUnitSize();
-
+
+ // **************** Model construction / updating **************************
+
+ /**
+ * Construct a JPA file for the specified file, to be added to the specified
+ * JPA project. (Defer to the factory for actual object creation.)
+ * Return null if unable to create the JPA file (e.g. the content type is
+ * unrecognized).
+ */
+ IJpaFile buildJpaFile(IJpaProject jpaProject, IFile file);
+
+ /**
+ * Return a factory responsible for creating core (e.g. IJpaProject), resource
+ * (e.g. PersistenceResource), and context (e.g. IPersistenceUnit) model
+ * objects
+ */
+ IJpaFactory jpaFactory();
+
+
+ // **************** Java annotation support ********************************
+
+ /**
+ * Return an annotation provider responsible for determining what annotations
+ * are supported and constructing java resource model objects
+ */
+ IJpaAnnotationProvider annotationProvider();
+
+
+ // **************** Java type mapping support ********************************
+
+ IJavaTypeMapping createJavaTypeMappingFromMappingKey(String typeMappingKey, IJavaPersistentType parent);
+
+ IJavaTypeMapping createJavaTypeMappingFromAnnotation(String mappingAnnotationName, IJavaPersistentType parent);
+
+ // **************** Java attribute mapping support ********************************
+
+ IJavaAttributeMapping createJavaAttributeMappingFromMappingKey(String attributeMappingKey, IJavaPersistentAttribute parent);
+
+ IJavaAttributeMapping createJavaAttributeMappingFromAnnotation(String mappingAnnotationName, IJavaPersistentAttribute parent);
+
+ IJavaAttributeMapping createDefaultJavaAttributeMapping(IJavaPersistentAttribute parent);
+
+ String defaultJavaAttributeMappingKey(IJavaPersistentAttribute persistentAttribute);
+
+ // *************************************************************************
+
+ /**
+ * Adds validation messages to the growing list of messages for a given project
+ */
+ void addToMessages(IJpaProject project, List<IMessage> messages);
+
+
+ // ********** XmlPersistence Unit ********************************************
+ // boolean containsPersistenceUnitNamed(String name);
+ //
+ // XmlPersistenceUnit persistenceUnitNamed(String name);
+ //
+ // Iterator<XmlPersistenceUnit> persistenceUnits();
+ //
+ // int persistenceUnitSize();
// ********** Persistent Types ********************************************
- /**
- * Return all persistent types for the persistence unit with the given name
- */
- Iterator<IPersistentType> persistentTypes(String persistenceUnitName);
-
+ // /**
+ // * Return all persistent types for the persistence unit with the given name
+ // */
+ // Iterator<IPersistentType> persistentTypes(String persistenceUnitName);
// ************************************************************************
- /**
- * Get the valid persistence XML files from the project
- */
- Iterator<IJpaFile> validPersistenceXmlFiles();
-
- /**
- * Return an Iterator of IJpaFileContentProviders. These will be used to
- * determine which files will be read from an IProject based on contentType.
- * These contentProviders should have unique contentTypes.
- */
- Iterator<IJpaFileContentProvider> jpaFileContentProviders();
-
- IJpaFileContentProvider fileContentProvider(String contentTypeId);
-
- /**
- * Return an Iterator of IJavaTypeMappingProviders. These define which
- * IJavaTypeMappings are supported and which annotation applies.
- */
- Iterator<IJavaTypeMappingProvider> javaTypeMappingProviders();
-
- IJavaTypeMappingProvider javaTypeMappingProvider(String typeMappingKey);
-
- /**
- * Return an Iterator of IJavaAttributeMappingProviders. These define which
- * IJavaAttributeMappings are supported and which annotation applies.
- */
- Iterator<IJavaAttributeMappingProvider> javaAttributeMappingProviders();
-
- IJavaAttributeMappingProvider javaAttributeMappingProvider(String attributeMappingKey);
-
- /**
- * Return a ListIterator of IDefaultJavaAttributeMappingProvider. This is a List
- * because the defaults are checked in order.
- */
- ListIterator<IDefaultJavaAttributeMappingProvider> defaultJavaAttributeMappingProviders();
-
- /**
- * Build a project context to be used when resynching the intra-model
- * references and creating validation problems.
- * The JPA model containment hierarchy is inappropriate to use as a context
- * for defaults because it is based on the IJpaProject containing files.
- * The defaults context for the jpa model is based on the persistence.xml
- * and the mapping files and classes it contains.
- *
- * @see refreshDefaults(Object)
- */
- IContext buildProjectContext();
-
- /**
- * Build a type context to be used when resynching the intra-model
- * references and creating validation problems.
- * The JPA model containment hierarchy is inappropriate to use as a context
- * for defaults because it is based on the IJpaProject containing files.
- * The defaults context for the jpa model is based on the persistence.xml
- * and the mapping files and classes it contains.
- *
- * @see refreshDefaults(Object)
- * @return
- */
- IContext buildJavaTypeContext(IContext parentContext, IJavaTypeMapping typeMapping);
-
- /**
- * Build an attribute context to be used when resynching the intra-model
- * references and creating validation problems.
- * The JPA model containment hierarchy is inappropriate to use as a context
- * for defaults because it is based on the IJpaProject containing files.
- * The defaults context for the jpa model is based on the persistence.xml
- * and the mapping files and classes it contains.
- *
- * @see refreshDefaults(Object)
- * @return
- */
- IContext buildJavaAttributeContext(IContext parentContext, IJavaAttributeMapping attributeMapping);
-
- /**
- * Resynchronize intra-model connections given the context hierarchy the
- * IJpaPlatform built in buildContextHierarchy().
- * This will be called each time an update to the jpa model occurs. If an
- * update occurs while the resynch() job is in process, another resynch()
- * will be started upon completion.
- * @param contextHierarchy
- */
- void resynch(IContext contextHierarchy, IProgressMonitor monitor);
-
- /**
- * Adds validation messages to the growing list of messages
- */
- @SuppressWarnings("restriction")
- void addToMessages(List<org.eclipse.wst.validation.internal.provisional.core.IMessage> messages);
-
- /**
- * Returns the IGeneratorRepository for the persistence unit of the
- * given IPersistentType. A NullGeneratorRepository should be returned
- * if the IPersistentType is not part of a persistence unit
- * @param persistentType
- * @return
- */
+ // /**
+ // * Get the valid persistence XML files from the project
+ // */
+ // Iterator<IJpaFile> validPersistenceXmlFiles();
+
+ // /**
+ // * Return an Iterator of IJavaTypeMappingProviders. These define which
+ // * IJavaTypeMappings are supported and which annotation applies.
+ // */
+ // Iterator<IJavaTypeMappingProvider> javaTypeMappingProviders();
+ //
+ // IJavaTypeMappingProvider javaTypeMappingProvider(String typeMappingKey);
+ //
+ // /**
+ // * Return an Iterator of IJavaAttributeMappingProviders. These define which
+ // * IJavaAttributeMappings are supported and which annotation applies.
+ // */
+ // Iterator<IJavaAttributeMappingProvider> javaAttributeMappingProviders();
+ //
+ // IJavaAttributeMappingProvider javaAttributeMappingProvider(String attributeMappingKey);
+ //
+ // /**
+ // * Return a ListIterator of IDefaultJavaAttributeMappingProvider. This is a List
+ // * because the defaults are checked in order.
+ // */
+ // ListIterator<IDefaultJavaAttributeMappingProvider> defaultJavaAttributeMappingProviders();
+ //
+ // /**
+ // * Returns the IGeneratorRepository for the persistence unit of the
+ // * given IPersistentType. A NullGeneratorRepository should be returned
+ // * if the IPersistentType is not part of a persistence unit
+ // * @param persistentType
+ // * @return
+ // */
// IGeneratorRepository generatorRepository(IPersistentType persistentType);
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaProject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaProject.java
index 07cc500637..76e8fa90be 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaProject.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaProject.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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,7 +10,6 @@
package org.eclipse.jpt.core.internal;
import java.util.Iterator;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResourceDelta;
@@ -19,11 +18,12 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.ElementChangedEvent;
import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
import org.eclipse.jpt.db.internal.ConnectionProfile;
+import org.eclipse.jpt.db.internal.Schema;
import org.eclipse.jpt.utility.internal.CommandExecutor;
import org.eclipse.jpt.utility.internal.CommandExecutorProvider;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
*
@@ -62,10 +62,20 @@ public interface IJpaProject extends IJpaNode {
IJpaDataSource dataSource();
/**
+ * Return the project's default schema, taken from the ConnectionProfile
+ */
+ Schema defaultSchema();
+
+ /**
* Return the JPA project's JPA files.
*/
Iterator<IJpaFile> jpaFiles();
- String JPA_FILES_COLLECTION = "jpaFiles";
+
+ /**
+ * ID string used when jpaFiles collection is changed.
+ * @see org.eclipse.jpt.utility.internal.model.Model#addCollectionChangeListener(String, org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener)
+ */
+ String JPA_FILES_COLLECTION = "jpaFiles";
/**
* Return the size of the JPA project's JPA files.
@@ -85,22 +95,17 @@ public interface IJpaProject extends IJpaNode {
* JPA file content provider.
*/
Iterator<IJpaFile> jpaFiles(String contentTypeId);
-
+
/**
- * Return the JPA project's Java JPA files.
+ * Return the context model representing the JPA content of this project
*/
- Iterator<IJpaFile> javaJpaFiles();
+ IContextModel contextModel();
/**
- * Return the JPA project's Java persistent types.
- */
- Iterator<JavaPersistentType> javaPersistentTypes();
-
- /**
- * Return the Java persistent type for the specified JDT type;
+ * Return the Java persistent type resource for the specified fully qualified type name;
* null, if none exists.
*/
- JavaPersistentType javaPersistentType(IType type);
+ JavaPersistentTypeResource javaPersistentTypeResource(String typeName);
/**
* Synchronize the JPA project's JPA files with the specified resource
@@ -119,20 +124,24 @@ public interface IJpaProject extends IJpaNode {
* listed in persistence.xml.
*/
boolean discoversAnnotatedClasses();
- String DISCOVERS_ANNOTATED_CLASSES_PROPERTY = "discoversAnnotatedClasses";
-
+
+ /**
+ * ID string used when discoversAnnotatedClasses property is changed.
+ * @see org.eclipse.jpt.utility.internal.model.Model#addPropertyChangeListener(String, org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener)
+ */
+ String DISCOVERS_ANNOTATED_CLASSES_PROPERTY = "discoversAnnotatedClasses";
+
/**
* Set whether the JPA project will "discover" annotated classes
* automatically, as opposed to requiring the classes to be
* listed in persistence.xml.
*/
void setDiscoversAnnotatedClasses(boolean discoversAnnotatedClasses);
-
+
/**
* Return project's validation messages.
*/
- @SuppressWarnings("restriction")
- Iterator<org.eclipse.wst.validation.internal.provisional.core.IMessage> validationMessages();
+ Iterator<IMessage> validationMessages();
/**
* Return the JPA project's root "deploy path".
@@ -167,16 +176,80 @@ public interface IJpaProject extends IJpaNode {
CommandExecutorProvider modifySharedDocumentCommandExecutorProvider();
- // ********** updating defaults etc. **********
+ // ********** project "update" **********
+
+ /**
+ * Return the implementation of the Updater
+ * interface that will be used to "update" a JPA project.
+ */
+ Updater updater();
+
+ /**
+ * Set the implementation of the Updater
+ * interface that will be used to "update" a JPA project.
+ */
+ void setUpdater(Updater updater);
/**
- * Reconnect the model together, recalculating default values as needed
+ * Something in the JPA project has changed, "update" those parts of the
+ * JPA project that are dependent on other parts of the JPA project.
+ * This is called when
+ * - the JPA project is first constructed
+ * - anything in the JPA project changes
+ * - the JPA project's database connection is changed, opened, or closed
*/
void update();
+ /**
+ * This is the callback used by the updater to perform the actual
+ * "update".
+ */
IStatus update(IProgressMonitor monitor);
+ /**
+ * Define a strategy that can be used to "update" a JPA project whenever
+ * something changes.
+ */
+ interface Updater {
+
+ /**
+ * Update the JPA project.
+ */
+ void update();
+
+ /**
+ * The JPA project is disposed; dispose the updater.
+ */
+ void dispose();
+
+ /**
+ * This updater does nothing. Useful for testing.
+ */
+ final class Null implements Updater {
+ public static final Updater INSTANCE = new Null();
+ public static Updater instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Null() {
+ super();
+ }
+ public void update() {
+ // do nothing
+ }
+ public void dispose() {
+ // do nothing
+ }
+ @Override
+ public String toString() {
+ return "IJpaProject.Updater.Null";
+ }
+ }
+
+ }
+
+
// ********** config that can be used to construct a JPA project **********
/**
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaRootContentNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaRootContentNode.java
index 8688b2a04e..a4a900bfd4 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaRootContentNode.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaRootContentNode.java
@@ -30,18 +30,16 @@ import org.eclipse.jdt.core.ElementChangedEvent;
public interface IJpaRootContentNode extends IJpaContentNode
{
/**
- * Returns the value of the '<em><b>Jpa File</b></em>' container reference.
- * It is bidirectional and its opposite is '{@link org.eclipse.jpt.core.internal.JpaFile#getContent <em>Content</em>}'.
+ * Returns the value of the '<em><b>Jpa File</b></em>' reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Jpa File</em>' container reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- * @return the value of the '<em>Jpa File</em>' container reference.
+ * @return the value of the '<em>Jpa File</em>' reference.
* @see org.eclipse.jpt.core.internal.JpaCorePackage#getIJpaRootContentNode_JpaFile()
- * @see org.eclipse.jpt.core.internal.JpaFile#getContent
- * @model opposite="content" transient="false" changeable="false"
+ * @model changeable="false"
* @generated
*/
IJpaFile getJpaFile();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaSourceObject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaSourceObject.java
index 3b8d70b049..ea2a1c50a8 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaSourceObject.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IJpaSourceObject.java
@@ -17,7 +17,7 @@ package org.eclipse.jpt.core.internal;
* @model kind="class" interface="true" abstract="true"
* @generated
*/
-public interface IJpaSourceObject extends IJpaEObject
+public interface IJpaSourceObject
{
/**
* Return the JPA file containing this object.
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IPersistentType.java
deleted file mode 100644
index 0faa13eb52..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IPersistentType.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.IType;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IPersistent Type</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.IPersistentType#getMappingKey <em>Mapping Key</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIPersistentType()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IPersistentType extends IJpaContentNode
-{
- /**
- * Returns the value of the '<em><b>Mapping Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Mapping Key</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Mapping Key</em>' attribute.
- * @see #setMappingKey(String)
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIPersistentType_MappingKey()
- * @model required="true"
- * @generated
- */
- String getMappingKey();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.IPersistentType#getMappingKey <em>Mapping Key</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Mapping Key</em>' attribute.
- * @see #getMappingKey()
- * @generated
- */
- void setMappingKey(String value);
-
- /**
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Mapping</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @model kind="operation" required="true"
- * @generated
- */
- ITypeMapping getMapping();
-
- /**
- * Return the parent IPersistentType from the inheritance hierarchy.
- * If the java inheritance parent is not a IPersistentType then continue
- * up the hierarchy. Return null if this persistentType is the root
- * persistent type.
- * @model
- * @generated
- */
- IPersistentType parentPersistentType();
-
- /**
- * Return a read-only iterator of the contained IPersistentAttributes
- */
- Iterator<? extends IPersistentAttribute> attributes();
-
- Iterator<String> attributeNames();
-
- /**
- * Return a read-only iterator of the all the IPersistentAttributes
- * in the hierarchy
- */
- Iterator<IPersistentAttribute> allAttributes();
-
- Iterator<String> allAttributeNames();
-
- /**
- * Return the attribute named <code>attributeName</code> if
- * it exists locally on this type
- */
- IPersistentAttribute attributeNamed(String attributeName);
-
- /**
- * Resolve and return the attribute named <code>attributeName</code> if it
- * is distinct and exists within the context of this type
- */
- IPersistentAttribute resolveAttribute(String attributeName);
-
- Iterator<IPersistentType> inheritanceHierarchy();
-
- /**
- * Return the corresponding JDT IType, if it resolves to a single IType
- */
- IType findJdtType();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IResourceModel.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IResourceModel.java
new file mode 100644
index 0000000000..1ee8e447c5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IResourceModel.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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;
+
+import java.util.ListIterator;
+import org.eclipse.jdt.core.ElementChangedEvent;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.utility.internal.model.Model;
+
+public interface IResourceModel extends Model
+{
+ /**
+ * Constant representing a Java resource type
+ * @see IResourceModel#getResourceType()
+ */
+ static final String JAVA_RESOURCE_TYPE = "JAVA_RESOURCE_TYPE";
+
+ /**
+ * Constant representing a persistence.xml resource type
+ * @see IResourceModel#getResourceType()
+ */
+ static final String PERSISTENCE_RESOURCE_TYPE = "PERSISTENCE_RESOURCE_TYPE";
+
+ /**
+ * Constant representing a mapping file (e.g. orm.xml) resource type
+ * @see IResourceModel#getResourceType()
+ */
+ static final String ORM_RESOURCE_TYPE = "ORM_RESOURCE_TYPE";
+
+
+ /**
+ * Return a unique identifier for all resource models of this type
+ */
+ String getResourceType();
+
+
+ // **************** root context nodes *************************************
+
+ /**
+ * String constant associated with changes to the list of root context nodes
+ */
+ final static String ROOT_CONTEXT_NODE_LIST = "rootContextNodes";
+
+ /**
+ * Return a list iterator of all root context nodes
+ */
+ ListIterator<IJpaContextNode> rootContextNodes();
+
+
+ void handleJavaElementChangedEvent(ElementChangedEvent event);
+
+
+ void addResourceModelChangeListener(IResourceModelListener listener);
+
+ void removeResourceModelChangeListener(IResourceModelListener listener);
+
+
+ void dispose();
+
+ /**
+ * Use to resolve type information that could be dependent on other files being added/removed
+ */
+ void resolveTypes();
+}
+
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IResourceModelListener.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IResourceModelListener.java
new file mode 100644
index 0000000000..1b0b91ecb1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IResourceModelListener.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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;
+
+import org.eclipse.jpt.utility.internal.model.listener.ChangeListener;
+
+public interface IResourceModelListener extends ChangeListener
+{
+ void resourceModelChanged();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaCoreFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaCoreFactory.java
deleted file mode 100644
index b476ae818c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaCoreFactory.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.impl.EFactoryImpl;
-import org.eclipse.emf.ecore.plugin.EcorePlugin;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Factory</b> for the model.
- * It provides a create method for each non-abstract class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.JpaCorePackage
- * @generated
- */
-public class JpaCoreFactory extends EFactoryImpl
-{
- /**
- * The singleton instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final JpaCoreFactory eINSTANCE = init();
-
- /**
- * Creates the default factory implementation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static JpaCoreFactory init() {
- try {
- JpaCoreFactory theJpaCoreFactory = (JpaCoreFactory) EPackage.Registry.INSTANCE.getEFactory("jpt.core.xmi");
- if (theJpaCoreFactory != null) {
- return theJpaCoreFactory;
- }
- }
- catch (Exception exception) {
- EcorePlugin.INSTANCE.log(exception);
- }
- return new JpaCoreFactory();
- }
-
- /**
- * Creates an instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaCoreFactory() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public EObject create(EClass eClass) {
- switch (eClass.getClassifierID()) {
- case JpaCorePackage.JPA_DATA_SOURCE :
- return createJpaDataSource();
- case JpaCorePackage.JPA_FILE :
- return createJpaFile();
- case JpaCorePackage.NULL_TYPE_MAPPING :
- return createNullTypeMapping();
- default :
- throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object createFromString(EDataType eDataType, String initialValue) {
- switch (eDataType.getClassifierID()) {
- case JpaCorePackage.ACCESS_TYPE :
- return createAccessTypeFromString(eDataType, initialValue);
- default :
- throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String convertToString(EDataType eDataType, Object instanceValue) {
- switch (eDataType.getClassifierID()) {
- case JpaCorePackage.ACCESS_TYPE :
- return convertAccessTypeToString(eDataType, instanceValue);
- default :
- throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaDataSource createJpaDataSource() {
- JpaDataSource jpaDataSource = new JpaDataSource();
- return jpaDataSource;
- }
-
- public JpaDataSource createJpaDataSource(IJpaProject jpaProject, String connectionProfileName) {
- return new JpaDataSource(jpaProject, connectionProfileName);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaFile createJpaFile() {
- JpaFile jpaFile = new JpaFile();
- return jpaFile;
- }
-
- public IJpaFile createJpaFile(IJpaProject jpaProject, IFile file, IJpaFileContentProvider provider) {
- return new JpaFile(jpaProject, file, provider);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NullTypeMapping createNullTypeMapping() {
- NullTypeMapping nullTypeMapping = new NullTypeMapping();
- return nullTypeMapping;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public AccessType createAccessTypeFromString(EDataType eDataType, String initialValue) {
- AccessType result = AccessType.get(initialValue);
- if (result == null)
- throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertAccessTypeToString(EDataType eDataType, Object instanceValue) {
- return instanceValue == null ? null : instanceValue.toString();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaCorePackage getJpaCorePackage() {
- return (JpaCorePackage) getEPackage();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @deprecated
- * @generated
- */
- @Deprecated
- public static JpaCorePackage getPackage() {
- return JpaCorePackage.eINSTANCE;
- }
-} //JpaCoreFactory
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaCorePackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaCorePackage.java
deleted file mode 100644
index 895e120366..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaCorePackage.java
+++ /dev/null
@@ -1,1390 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-import org.eclipse.jpt.core.internal.content.java.JpaJavaPackage;
-import org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.persistence.PersistencePackage;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Package</b> for the model.
- * It contains accessors for the meta objects to represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.JpaCoreFactory
- * @model kind="package"
- * @generated
- */
-public class JpaCorePackage extends EPackageImpl
-{
- /**
- * The package name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNAME = "internal";
-
- /**
- * The package namespace URI.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNS_URI = "jpt.core.xmi";
-
- /**
- * The package namespace name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNS_PREFIX = "jpt.core";
-
- /**
- * The singleton instance of the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final JpaCorePackage eINSTANCE = org.eclipse.jpt.core.internal.JpaCorePackage.init();
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.IJpaEObject <em>IJpa EObject</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IJpaEObject
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIJpaEObject()
- * @generated
- */
- public static final int IJPA_EOBJECT = 0;
-
- /**
- * The number of structural features of the '<em>IJpa EObject</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJPA_EOBJECT_FEATURE_COUNT = 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.JpaEObject <em>Jpa EObject</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.JpaEObject
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getJpaEObject()
- * @generated
- */
- public static final int JPA_EOBJECT = 1;
-
- /**
- * The number of structural features of the '<em>Jpa EObject</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JPA_EOBJECT_FEATURE_COUNT = IJPA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.IJpaDataSource <em>IJpa Data Source</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IJpaDataSource
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIJpaDataSource()
- * @generated
- */
- public static final int IJPA_DATA_SOURCE = 2;
-
- /**
- * The number of structural features of the '<em>IJpa Data Source</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJPA_DATA_SOURCE_FEATURE_COUNT = IJPA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.JpaDataSource <em>Jpa Data Source</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.JpaDataSource
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getJpaDataSource()
- * @generated
- */
- public static final int JPA_DATA_SOURCE = 3;
-
- /**
- * The feature id for the '<em><b>Connection Profile Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JPA_DATA_SOURCE__CONNECTION_PROFILE_NAME = JPA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Jpa Data Source</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JPA_DATA_SOURCE_FEATURE_COUNT = JPA_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.IJpaFile <em>IJpa File</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IJpaFile
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIJpaFile()
- * @generated
- */
- public static final int IJPA_FILE = 4;
-
- /**
- * The number of structural features of the '<em>IJpa File</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJPA_FILE_FEATURE_COUNT = IJPA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.JpaFile <em>Jpa File</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.JpaFile
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getJpaFile()
- * @generated
- */
- public static final int JPA_FILE = 5;
-
- /**
- * The feature id for the '<em><b>Content Id</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JPA_FILE__CONTENT_ID = JPA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Content</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JPA_FILE__CONTENT = JPA_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Jpa File</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JPA_FILE_FEATURE_COUNT = JPA_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.IJpaSourceObject <em>IJpa Source Object</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IJpaSourceObject
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIJpaSourceObject()
- * @generated
- */
- public static final int IJPA_SOURCE_OBJECT = 6;
-
- /**
- * The number of structural features of the '<em>IJpa Source Object</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJPA_SOURCE_OBJECT_FEATURE_COUNT = IJPA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.IXmlEObject <em>IXml EObject</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IXmlEObject
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIXmlEObject()
- * @generated
- */
- public static final int IXML_EOBJECT = 7;
-
- /**
- * The number of structural features of the '<em>IXml EObject</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IXML_EOBJECT_FEATURE_COUNT = IJPA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.XmlEObject <em>Xml EObject</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.XmlEObject
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getXmlEObject()
- * @generated
- */
- public static final int XML_EOBJECT = 8;
-
- /**
- * The number of structural features of the '<em>Xml EObject</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_EOBJECT_FEATURE_COUNT = JPA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.IJpaContentNode <em>IJpa Content Node</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IJpaContentNode
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIJpaContentNode()
- * @generated
- */
- public static final int IJPA_CONTENT_NODE = 9;
-
- /**
- * The number of structural features of the '<em>IJpa Content Node</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJPA_CONTENT_NODE_FEATURE_COUNT = IJPA_SOURCE_OBJECT_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.IJpaRootContentNode <em>IJpa Root Content Node</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IJpaRootContentNode
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIJpaRootContentNode()
- * @generated
- */
- public static final int IJPA_ROOT_CONTENT_NODE = 10;
-
- /**
- * The feature id for the '<em><b>Jpa File</b></em>' container reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJPA_ROOT_CONTENT_NODE__JPA_FILE = IJPA_CONTENT_NODE_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>IJpa Root Content Node</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJPA_ROOT_CONTENT_NODE_FEATURE_COUNT = IJPA_CONTENT_NODE_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.IPersistentType <em>IPersistent Type</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IPersistentType
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIPersistentType()
- * @generated
- */
- public static final int IPERSISTENT_TYPE = 11;
-
- /**
- * The feature id for the '<em><b>Mapping Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IPERSISTENT_TYPE__MAPPING_KEY = IJPA_CONTENT_NODE_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>IPersistent Type</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IPERSISTENT_TYPE_FEATURE_COUNT = IJPA_CONTENT_NODE_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.ITypeMapping <em>IType Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.ITypeMapping
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getITypeMapping()
- * @generated
- */
- public static final int ITYPE_MAPPING = 12;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITYPE_MAPPING__NAME = IJPA_SOURCE_OBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITYPE_MAPPING__TABLE_NAME = IJPA_SOURCE_OBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>IType Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITYPE_MAPPING_FEATURE_COUNT = IJPA_SOURCE_OBJECT_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.NullTypeMapping <em>Null Type Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.NullTypeMapping
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getNullTypeMapping()
- * @generated
- */
- public static final int NULL_TYPE_MAPPING = 13;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int NULL_TYPE_MAPPING__NAME = JPA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int NULL_TYPE_MAPPING__TABLE_NAME = JPA_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Null Type Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int NULL_TYPE_MAPPING_FEATURE_COUNT = JPA_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.IPersistentAttribute <em>IPersistent Attribute</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IPersistentAttribute
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIPersistentAttribute()
- * @generated
- */
- public static final int IPERSISTENT_ATTRIBUTE = 14;
-
- /**
- * The feature id for the '<em><b>Mapping</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IPERSISTENT_ATTRIBUTE__MAPPING = IJPA_CONTENT_NODE_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>IPersistent Attribute</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IPERSISTENT_ATTRIBUTE_FEATURE_COUNT = IJPA_CONTENT_NODE_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.IAttributeMapping <em>IAttribute Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IAttributeMapping
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIAttributeMapping()
- * @generated
- */
- public static final int IATTRIBUTE_MAPPING = 15;
-
- /**
- * The number of structural features of the '<em>IAttribute Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IATTRIBUTE_MAPPING_FEATURE_COUNT = IJPA_SOURCE_OBJECT_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.AccessType <em>Access Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.AccessType
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getAccessType()
- * @generated
- */
- public static final int ACCESS_TYPE = 16;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJpaEObjectEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass jpaEObjectEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJpaDataSourceEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass jpaDataSourceEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJpaFileEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass jpaFileEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJpaSourceObjectEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iXmlEObjectEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlEObjectEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJpaContentNodeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJpaRootContentNodeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iPersistentTypeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iTypeMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass nullTypeMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iPersistentAttributeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iAttributeMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EEnum accessTypeEEnum = null;
-
- /**
- * Creates an instance of the model <b>Package</b>, registered with
- * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
- * package URI value.
- * <p>Note: the correct way to create the package is via the static
- * factory method {@link #init init()}, which also performs
- * initialization of the package, or returns the registered package,
- * if one already exists.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.ecore.EPackage.Registry
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#eNS_URI
- * @see #init()
- * @generated
- */
- private JpaCorePackage() {
- super(eNS_URI, JpaCoreFactory.eINSTANCE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static boolean isInited = false;
-
- /**
- * Creates, registers, and initializes the <b>Package</b> for this
- * model, and for any others upon which it depends. Simple
- * dependencies are satisfied by calling this method on all
- * dependent packages before doing anything else. This method drives
- * initialization for interdependent packages directly, in parallel
- * with this package, itself.
- * <p>Of this package and its interdependencies, all packages which
- * have not yet been registered by their URI values are first created
- * and registered. The packages are then initialized in two steps:
- * meta-model objects for all of the packages are created before any
- * are initialized, since one package's meta-model objects may refer to
- * those of another.
- * <p>Invocation of this method will not affect any packages that have
- * already been initialized.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #eNS_URI
- * @see #createPackageContents()
- * @see #initializePackageContents()
- * @generated
- */
- public static JpaCorePackage init() {
- if (isInited)
- return (JpaCorePackage) EPackage.Registry.INSTANCE.getEPackage(JpaCorePackage.eNS_URI);
- // Obtain or create and register package
- JpaCorePackage theJpaCorePackage = (JpaCorePackage) (EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof JpaCorePackage ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new JpaCorePackage());
- isInited = true;
- // Initialize simple dependencies
- EcorePackage.eINSTANCE.eClass();
- // Obtain or create and register interdependencies
- JpaCoreMappingsPackage theJpaCoreMappingsPackage = (JpaCoreMappingsPackage) (EPackage.Registry.INSTANCE.getEPackage(JpaCoreMappingsPackage.eNS_URI) instanceof JpaCoreMappingsPackage ? EPackage.Registry.INSTANCE.getEPackage(JpaCoreMappingsPackage.eNS_URI) : JpaCoreMappingsPackage.eINSTANCE);
- JpaJavaPackage theJpaJavaPackage = (JpaJavaPackage) (EPackage.Registry.INSTANCE.getEPackage(JpaJavaPackage.eNS_URI) instanceof JpaJavaPackage ? EPackage.Registry.INSTANCE.getEPackage(JpaJavaPackage.eNS_URI) : JpaJavaPackage.eINSTANCE);
- JpaJavaMappingsPackage theJpaJavaMappingsPackage = (JpaJavaMappingsPackage) (EPackage.Registry.INSTANCE.getEPackage(JpaJavaMappingsPackage.eNS_URI) instanceof JpaJavaMappingsPackage ? EPackage.Registry.INSTANCE.getEPackage(JpaJavaMappingsPackage.eNS_URI) : JpaJavaMappingsPackage.eINSTANCE);
- OrmPackage theOrmPackage = (OrmPackage) (EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) instanceof OrmPackage ? EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) : OrmPackage.eINSTANCE);
- PersistencePackage thePersistencePackage = (PersistencePackage) (EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI) instanceof PersistencePackage ? EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI) : PersistencePackage.eINSTANCE);
- // Create package meta-data objects
- theJpaCorePackage.createPackageContents();
- theJpaCoreMappingsPackage.createPackageContents();
- theJpaJavaPackage.createPackageContents();
- theJpaJavaMappingsPackage.createPackageContents();
- theOrmPackage.createPackageContents();
- thePersistencePackage.createPackageContents();
- // Initialize created meta-data
- theJpaCorePackage.initializePackageContents();
- theJpaCoreMappingsPackage.initializePackageContents();
- theJpaJavaPackage.initializePackageContents();
- theJpaJavaMappingsPackage.initializePackageContents();
- theOrmPackage.initializePackageContents();
- thePersistencePackage.initializePackageContents();
- // Mark meta-data to indicate it can't be changed
- theJpaCorePackage.freeze();
- return theJpaCorePackage;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.IJpaEObject <em>IJpa EObject</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJpa EObject</em>'.
- * @see org.eclipse.jpt.core.internal.IJpaEObject
- * @generated
- */
- public EClass getIJpaEObject() {
- return iJpaEObjectEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.JpaEObject <em>Jpa EObject</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Jpa EObject</em>'.
- * @see org.eclipse.jpt.core.internal.JpaEObject
- * @generated
- */
- public EClass getJpaEObject() {
- return jpaEObjectEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.IJpaDataSource <em>IJpa Data Source</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJpa Data Source</em>'.
- * @see org.eclipse.jpt.core.internal.IJpaDataSource
- * @generated
- */
- public EClass getIJpaDataSource() {
- return iJpaDataSourceEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.JpaDataSource <em>Jpa Data Source</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Jpa Data Source</em>'.
- * @see org.eclipse.jpt.core.internal.JpaDataSource
- * @generated
- */
- public EClass getJpaDataSource() {
- return jpaDataSourceEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.JpaDataSource#getConnectionProfileName <em>Connection Profile Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Connection Profile Name</em>'.
- * @see org.eclipse.jpt.core.internal.JpaDataSource#getConnectionProfileName()
- * @see #getJpaDataSource()
- * @generated
- */
- public EAttribute getJpaDataSource_ConnectionProfileName() {
- return (EAttribute) jpaDataSourceEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.IJpaFile <em>IJpa File</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJpa File</em>'.
- * @see org.eclipse.jpt.core.internal.IJpaFile
- * @generated
- */
- public EClass getIJpaFile() {
- return iJpaFileEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.JpaFile <em>Jpa File</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Jpa File</em>'.
- * @see org.eclipse.jpt.core.internal.JpaFile
- * @generated
- */
- public EClass getJpaFile() {
- return jpaFileEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.JpaFile#getContentId <em>Content Id</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Content Id</em>'.
- * @see org.eclipse.jpt.core.internal.JpaFile#getContentId()
- * @see #getJpaFile()
- * @generated
- */
- public EAttribute getJpaFile_ContentId() {
- return (EAttribute) jpaFileEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.JpaFile#getContent <em>Content</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Content</em>'.
- * @see org.eclipse.jpt.core.internal.JpaFile#getContent()
- * @see #getJpaFile()
- * @generated
- */
- public EReference getJpaFile_Content() {
- return (EReference) jpaFileEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.IJpaSourceObject <em>IJpa Source Object</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJpa Source Object</em>'.
- * @see org.eclipse.jpt.core.internal.IJpaSourceObject
- * @generated
- */
- public EClass getIJpaSourceObject() {
- return iJpaSourceObjectEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.IXmlEObject <em>IXml EObject</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IXml EObject</em>'.
- * @see org.eclipse.jpt.core.internal.IXmlEObject
- * @generated
- */
- public EClass getIXmlEObject() {
- return iXmlEObjectEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.XmlEObject <em>Xml EObject</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml EObject</em>'.
- * @see org.eclipse.jpt.core.internal.XmlEObject
- * @generated
- */
- public EClass getXmlEObject() {
- return xmlEObjectEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.IJpaContentNode <em>IJpa Content Node</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJpa Content Node</em>'.
- * @see org.eclipse.jpt.core.internal.IJpaContentNode
- * @generated
- */
- public EClass getIJpaContentNode() {
- return iJpaContentNodeEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.IJpaRootContentNode <em>IJpa Root Content Node</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJpa Root Content Node</em>'.
- * @see org.eclipse.jpt.core.internal.IJpaRootContentNode
- * @generated
- */
- public EClass getIJpaRootContentNode() {
- return iJpaRootContentNodeEClass;
- }
-
- /**
- * Returns the meta object for the container reference '{@link org.eclipse.jpt.core.internal.IJpaRootContentNode#getJpaFile <em>Jpa File</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the container reference '<em>Jpa File</em>'.
- * @see org.eclipse.jpt.core.internal.IJpaRootContentNode#getJpaFile()
- * @see #getIJpaRootContentNode()
- * @generated
- */
- public EReference getIJpaRootContentNode_JpaFile() {
- return (EReference) iJpaRootContentNodeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.IPersistentType <em>IPersistent Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IPersistent Type</em>'.
- * @see org.eclipse.jpt.core.internal.IPersistentType
- * @generated
- */
- public EClass getIPersistentType() {
- return iPersistentTypeEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.IPersistentType#getMappingKey <em>Mapping Key</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Mapping Key</em>'.
- * @see org.eclipse.jpt.core.internal.IPersistentType#getMappingKey()
- * @see #getIPersistentType()
- * @generated
- */
- public EAttribute getIPersistentType_MappingKey() {
- return (EAttribute) iPersistentTypeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.ITypeMapping <em>IType Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IType Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.ITypeMapping
- * @generated
- */
- public EClass getITypeMapping() {
- return iTypeMappingEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.ITypeMapping#getName <em>Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Name</em>'.
- * @see org.eclipse.jpt.core.internal.ITypeMapping#getName()
- * @see #getITypeMapping()
- * @generated
- */
- public EAttribute getITypeMapping_Name() {
- return (EAttribute) iTypeMappingEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.ITypeMapping#getTableName <em>Table Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Table Name</em>'.
- * @see org.eclipse.jpt.core.internal.ITypeMapping#getTableName()
- * @see #getITypeMapping()
- * @generated
- */
- public EAttribute getITypeMapping_TableName() {
- return (EAttribute) iTypeMappingEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.NullTypeMapping <em>Null Type Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Null Type Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.NullTypeMapping
- * @generated
- */
- public EClass getNullTypeMapping() {
- return nullTypeMappingEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.IPersistentAttribute <em>IPersistent Attribute</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IPersistent Attribute</em>'.
- * @see org.eclipse.jpt.core.internal.IPersistentAttribute
- * @generated
- */
- public EClass getIPersistentAttribute() {
- return iPersistentAttributeEClass;
- }
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.jpt.core.internal.IPersistentAttribute#getMapping <em>Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.IPersistentAttribute#getMapping()
- * @see #getIPersistentAttribute()
- * @generated
- */
- public EReference getIPersistentAttribute_Mapping() {
- return (EReference) iPersistentAttributeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.IAttributeMapping <em>IAttribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IAttribute Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.IAttributeMapping
- * @generated
- */
- public EClass getIAttributeMapping() {
- return iAttributeMappingEClass;
- }
-
- /**
- * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.AccessType <em>Access Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for enum '<em>Access Type</em>'.
- * @see org.eclipse.jpt.core.internal.AccessType
- * @generated
- */
- public EEnum getAccessType() {
- return accessTypeEEnum;
- }
-
- /**
- * Returns the factory that creates the instances of the model.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the factory that creates the instances of the model.
- * @generated
- */
- public JpaCoreFactory getJpaCoreFactory() {
- return (JpaCoreFactory) getEFactoryInstance();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isCreated = false;
-
- /**
- * Creates the meta-model objects for the package. This method is
- * guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void createPackageContents() {
- if (isCreated)
- return;
- isCreated = true;
- // Create classes and their features
- iJpaEObjectEClass = createEClass(IJPA_EOBJECT);
- jpaEObjectEClass = createEClass(JPA_EOBJECT);
- iJpaDataSourceEClass = createEClass(IJPA_DATA_SOURCE);
- jpaDataSourceEClass = createEClass(JPA_DATA_SOURCE);
- createEAttribute(jpaDataSourceEClass, JPA_DATA_SOURCE__CONNECTION_PROFILE_NAME);
- iJpaFileEClass = createEClass(IJPA_FILE);
- jpaFileEClass = createEClass(JPA_FILE);
- createEAttribute(jpaFileEClass, JPA_FILE__CONTENT_ID);
- createEReference(jpaFileEClass, JPA_FILE__CONTENT);
- iJpaSourceObjectEClass = createEClass(IJPA_SOURCE_OBJECT);
- iXmlEObjectEClass = createEClass(IXML_EOBJECT);
- xmlEObjectEClass = createEClass(XML_EOBJECT);
- iJpaContentNodeEClass = createEClass(IJPA_CONTENT_NODE);
- iJpaRootContentNodeEClass = createEClass(IJPA_ROOT_CONTENT_NODE);
- createEReference(iJpaRootContentNodeEClass, IJPA_ROOT_CONTENT_NODE__JPA_FILE);
- iPersistentTypeEClass = createEClass(IPERSISTENT_TYPE);
- createEAttribute(iPersistentTypeEClass, IPERSISTENT_TYPE__MAPPING_KEY);
- iTypeMappingEClass = createEClass(ITYPE_MAPPING);
- createEAttribute(iTypeMappingEClass, ITYPE_MAPPING__NAME);
- createEAttribute(iTypeMappingEClass, ITYPE_MAPPING__TABLE_NAME);
- nullTypeMappingEClass = createEClass(NULL_TYPE_MAPPING);
- iPersistentAttributeEClass = createEClass(IPERSISTENT_ATTRIBUTE);
- createEReference(iPersistentAttributeEClass, IPERSISTENT_ATTRIBUTE__MAPPING);
- iAttributeMappingEClass = createEClass(IATTRIBUTE_MAPPING);
- // Create enums
- accessTypeEEnum = createEEnum(ACCESS_TYPE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isInitialized = false;
-
- /**
- * Complete the initialization of the package and its meta-model. This
- * method is guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void initializePackageContents() {
- if (isInitialized)
- return;
- isInitialized = true;
- // Initialize package
- setName(eNAME);
- setNsPrefix(eNS_PREFIX);
- setNsURI(eNS_URI);
- // Obtain other dependent packages
- JpaCoreMappingsPackage theJpaCoreMappingsPackage = (JpaCoreMappingsPackage) EPackage.Registry.INSTANCE.getEPackage(JpaCoreMappingsPackage.eNS_URI);
- EcorePackage theEcorePackage = (EcorePackage) EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
- // Add subpackages
- getESubpackages().add(theJpaCoreMappingsPackage);
- // Create type parameters
- // Set bounds for type parameters
- // Add supertypes to classes
- jpaEObjectEClass.getESuperTypes().add(this.getIJpaEObject());
- iJpaDataSourceEClass.getESuperTypes().add(this.getIJpaEObject());
- jpaDataSourceEClass.getESuperTypes().add(this.getJpaEObject());
- jpaDataSourceEClass.getESuperTypes().add(this.getIJpaDataSource());
- iJpaFileEClass.getESuperTypes().add(this.getIJpaEObject());
- jpaFileEClass.getESuperTypes().add(this.getJpaEObject());
- jpaFileEClass.getESuperTypes().add(this.getIJpaFile());
- iJpaSourceObjectEClass.getESuperTypes().add(this.getIJpaEObject());
- iXmlEObjectEClass.getESuperTypes().add(this.getIJpaEObject());
- iXmlEObjectEClass.getESuperTypes().add(this.getIJpaSourceObject());
- xmlEObjectEClass.getESuperTypes().add(this.getJpaEObject());
- xmlEObjectEClass.getESuperTypes().add(this.getIXmlEObject());
- iJpaContentNodeEClass.getESuperTypes().add(this.getIJpaSourceObject());
- iJpaRootContentNodeEClass.getESuperTypes().add(this.getIJpaContentNode());
- iPersistentTypeEClass.getESuperTypes().add(this.getIJpaContentNode());
- iTypeMappingEClass.getESuperTypes().add(this.getIJpaSourceObject());
- nullTypeMappingEClass.getESuperTypes().add(this.getJpaEObject());
- nullTypeMappingEClass.getESuperTypes().add(this.getITypeMapping());
- nullTypeMappingEClass.getESuperTypes().add(this.getIJpaSourceObject());
- iPersistentAttributeEClass.getESuperTypes().add(this.getIJpaContentNode());
- iAttributeMappingEClass.getESuperTypes().add(this.getIJpaSourceObject());
- // Initialize classes and features; add operations and parameters
- initEClass(iJpaEObjectEClass, IJpaEObject.class, "IJpaEObject", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(jpaEObjectEClass, JpaEObject.class, "JpaEObject", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iJpaDataSourceEClass, IJpaDataSource.class, "IJpaDataSource", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- addEOperation(iJpaDataSourceEClass, theEcorePackage.getEString(), "getConnectionProfileName", 1, 1, !IS_UNIQUE, !IS_ORDERED);
- initEClass(jpaDataSourceEClass, JpaDataSource.class, "JpaDataSource", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getJpaDataSource_ConnectionProfileName(), ecorePackage.getEString(), "connectionProfileName", null, 1, 1, JpaDataSource.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
- initEClass(iJpaFileEClass, IJpaFile.class, "IJpaFile", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- addEOperation(iJpaFileEClass, ecorePackage.getEString(), "getContentId", 1, 1, IS_UNIQUE, IS_ORDERED);
- addEOperation(iJpaFileEClass, this.getIJpaRootContentNode(), "getContent", 0, 1, IS_UNIQUE, IS_ORDERED);
- initEClass(jpaFileEClass, JpaFile.class, "JpaFile", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getJpaFile_ContentId(), ecorePackage.getEString(), "contentId", null, 1, 1, JpaFile.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getJpaFile_Content(), this.getIJpaRootContentNode(), this.getIJpaRootContentNode_JpaFile(), "content", null, 0, 1, JpaFile.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iJpaSourceObjectEClass, IJpaSourceObject.class, "IJpaSourceObject", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- addEOperation(iJpaSourceObjectEClass, this.getIJpaFile(), "getJpaFile", 0, 1, IS_UNIQUE, IS_ORDERED);
- initEClass(iXmlEObjectEClass, IXmlEObject.class, "IXmlEObject", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlEObjectEClass, XmlEObject.class, "XmlEObject", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iJpaContentNodeEClass, IJpaContentNode.class, "IJpaContentNode", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- addEOperation(iJpaContentNodeEClass, this.getIJpaFile(), "getJpaFile", 1, 1, IS_UNIQUE, IS_ORDERED);
- initEClass(iJpaRootContentNodeEClass, IJpaRootContentNode.class, "IJpaRootContentNode", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getIJpaRootContentNode_JpaFile(), this.getIJpaFile(), this.getJpaFile_Content(), "jpaFile", null, 0, 1, IJpaRootContentNode.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iPersistentTypeEClass, IPersistentType.class, "IPersistentType", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getIPersistentType_MappingKey(), ecorePackage.getEString(), "mappingKey", null, 1, 1, IPersistentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- addEOperation(iPersistentTypeEClass, this.getITypeMapping(), "getMapping", 1, 1, IS_UNIQUE, IS_ORDERED);
- addEOperation(iPersistentTypeEClass, this.getIPersistentType(), "parentPersistentType", 0, 1, IS_UNIQUE, IS_ORDERED);
- initEClass(iTypeMappingEClass, ITypeMapping.class, "ITypeMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getITypeMapping_Name(), ecorePackage.getEString(), "name", null, 0, 1, ITypeMapping.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getITypeMapping_TableName(), ecorePackage.getEString(), "tableName", null, 0, 1, ITypeMapping.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- addEOperation(iTypeMappingEClass, this.getIPersistentType(), "getPersistentType", 1, 1, IS_UNIQUE, IS_ORDERED);
- initEClass(nullTypeMappingEClass, NullTypeMapping.class, "NullTypeMapping", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iPersistentAttributeEClass, IPersistentAttribute.class, "IPersistentAttribute", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getIPersistentAttribute_Mapping(), this.getIAttributeMapping(), null, "mapping", null, 1, 1, IPersistentAttribute.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- addEOperation(iPersistentAttributeEClass, this.getITypeMapping(), "typeMapping", 1, 1, IS_UNIQUE, IS_ORDERED);
- addEOperation(iPersistentAttributeEClass, theEcorePackage.getEString(), "getName", 1, 1, IS_UNIQUE, IS_ORDERED);
- addEOperation(iPersistentAttributeEClass, ecorePackage.getEString(), "mappingKey", 1, 1, IS_UNIQUE, IS_ORDERED);
- addEOperation(iPersistentAttributeEClass, ecorePackage.getEString(), "defaultMappingKey", 1, 1, IS_UNIQUE, IS_ORDERED);
- initEClass(iAttributeMappingEClass, IAttributeMapping.class, "IAttributeMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- addEOperation(iAttributeMappingEClass, this.getIPersistentAttribute(), "getPersistentAttribute", 1, 1, IS_UNIQUE, IS_ORDERED);
- addEOperation(iAttributeMappingEClass, theEcorePackage.getEBoolean(), "isDefault", 0, 1, IS_UNIQUE, IS_ORDERED);
- // Initialize enums and add enum literals
- initEEnum(accessTypeEEnum, AccessType.class, "AccessType");
- addEEnumLiteral(accessTypeEEnum, AccessType.DEFAULT);
- addEEnumLiteral(accessTypeEEnum, AccessType.PROPERTY);
- addEEnumLiteral(accessTypeEEnum, AccessType.FIELD);
- // Create resource
- createResource(eNS_URI);
- }
- /**
- * <!-- begin-user-doc -->
- * Defines literals for the meta objects that represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @generated
- */
- public interface Literals
- {
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.IJpaEObject <em>IJpa EObject</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IJpaEObject
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIJpaEObject()
- * @generated
- */
- public static final EClass IJPA_EOBJECT = eINSTANCE.getIJpaEObject();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.JpaEObject <em>Jpa EObject</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.JpaEObject
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getJpaEObject()
- * @generated
- */
- public static final EClass JPA_EOBJECT = eINSTANCE.getJpaEObject();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.IJpaDataSource <em>IJpa Data Source</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IJpaDataSource
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIJpaDataSource()
- * @generated
- */
- public static final EClass IJPA_DATA_SOURCE = eINSTANCE.getIJpaDataSource();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.JpaDataSource <em>Jpa Data Source</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.JpaDataSource
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getJpaDataSource()
- * @generated
- */
- public static final EClass JPA_DATA_SOURCE = eINSTANCE.getJpaDataSource();
-
- /**
- * The meta object literal for the '<em><b>Connection Profile Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute JPA_DATA_SOURCE__CONNECTION_PROFILE_NAME = eINSTANCE.getJpaDataSource_ConnectionProfileName();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.IJpaFile <em>IJpa File</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IJpaFile
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIJpaFile()
- * @generated
- */
- public static final EClass IJPA_FILE = eINSTANCE.getIJpaFile();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.JpaFile <em>Jpa File</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.JpaFile
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getJpaFile()
- * @generated
- */
- public static final EClass JPA_FILE = eINSTANCE.getJpaFile();
-
- /**
- * The meta object literal for the '<em><b>Content Id</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute JPA_FILE__CONTENT_ID = eINSTANCE.getJpaFile_ContentId();
-
- /**
- * The meta object literal for the '<em><b>Content</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference JPA_FILE__CONTENT = eINSTANCE.getJpaFile_Content();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.IJpaSourceObject <em>IJpa Source Object</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IJpaSourceObject
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIJpaSourceObject()
- * @generated
- */
- public static final EClass IJPA_SOURCE_OBJECT = eINSTANCE.getIJpaSourceObject();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.IXmlEObject <em>IXml EObject</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IXmlEObject
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIXmlEObject()
- * @generated
- */
- public static final EClass IXML_EOBJECT = eINSTANCE.getIXmlEObject();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.XmlEObject <em>Xml EObject</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.XmlEObject
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getXmlEObject()
- * @generated
- */
- public static final EClass XML_EOBJECT = eINSTANCE.getXmlEObject();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.IJpaContentNode <em>IJpa Content Node</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IJpaContentNode
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIJpaContentNode()
- * @generated
- */
- public static final EClass IJPA_CONTENT_NODE = eINSTANCE.getIJpaContentNode();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.IJpaRootContentNode <em>IJpa Root Content Node</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IJpaRootContentNode
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIJpaRootContentNode()
- * @generated
- */
- public static final EClass IJPA_ROOT_CONTENT_NODE = eINSTANCE.getIJpaRootContentNode();
-
- /**
- * The meta object literal for the '<em><b>Jpa File</b></em>' container reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IJPA_ROOT_CONTENT_NODE__JPA_FILE = eINSTANCE.getIJpaRootContentNode_JpaFile();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.IPersistentType <em>IPersistent Type</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IPersistentType
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIPersistentType()
- * @generated
- */
- public static final EClass IPERSISTENT_TYPE = eINSTANCE.getIPersistentType();
-
- /**
- * The meta object literal for the '<em><b>Mapping Key</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IPERSISTENT_TYPE__MAPPING_KEY = eINSTANCE.getIPersistentType_MappingKey();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.ITypeMapping <em>IType Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.ITypeMapping
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getITypeMapping()
- * @generated
- */
- public static final EClass ITYPE_MAPPING = eINSTANCE.getITypeMapping();
-
- /**
- * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITYPE_MAPPING__NAME = eINSTANCE.getITypeMapping_Name();
-
- /**
- * The meta object literal for the '<em><b>Table Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITYPE_MAPPING__TABLE_NAME = eINSTANCE.getITypeMapping_TableName();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.NullTypeMapping <em>Null Type Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.NullTypeMapping
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getNullTypeMapping()
- * @generated
- */
- public static final EClass NULL_TYPE_MAPPING = eINSTANCE.getNullTypeMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.IPersistentAttribute <em>IPersistent Attribute</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IPersistentAttribute
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIPersistentAttribute()
- * @generated
- */
- public static final EClass IPERSISTENT_ATTRIBUTE = eINSTANCE.getIPersistentAttribute();
-
- /**
- * The meta object literal for the '<em><b>Mapping</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IPERSISTENT_ATTRIBUTE__MAPPING = eINSTANCE.getIPersistentAttribute_Mapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.IAttributeMapping <em>IAttribute Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.IAttributeMapping
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIAttributeMapping()
- * @generated
- */
- public static final EClass IATTRIBUTE_MAPPING = eINSTANCE.getIAttributeMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.AccessType <em>Access Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.AccessType
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getAccessType()
- * @generated
- */
- public static final EEnum ACCESS_TYPE = eINSTANCE.getAccessType();
- }
-} //JpaCorePackage
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaDataSource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaDataSource.java
index 121f2a1dd4..c0fcb06082 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaDataSource.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaDataSource.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,9 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.core.internal;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.jpt.db.internal.ConnectionListener;
import org.eclipse.jpt.db.internal.ConnectionProfile;
import org.eclipse.jpt.db.internal.ConnectionProfileRepository;
@@ -21,67 +18,46 @@ import org.eclipse.jpt.db.internal.Schema;
import org.eclipse.jpt.db.internal.Table;
/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Jpa Data Source</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.JpaDataSource#getConnectionProfileName <em>Connection Profile Name</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getJpaDataSource()
- * @model kind="class"
- * @generated
+ *
*/
-public class JpaDataSource extends JpaEObject implements IJpaDataSource
+public class JpaDataSource
+ extends JpaNode
+ implements IJpaDataSource
{
- // temporary bridge until we remove EMF stuff
- private IJpaProject jpaProject;
-
/**
- * The default value of the '{@link #getConnectionProfileName() <em>Connection Profile Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getConnectionProfileName()
- * @generated
- * @ordered
+ * cache the connection profile name so we can detect when
+ * it changes and notify listeners
*/
- protected static final String CONNECTION_PROFILE_NAME_EDEFAULT = null;
+ protected String connectionProfileName;
/**
- * The cached value of the '{@link #getConnectionProfileName() <em>Connection Profile Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getConnectionProfileName()
- * @generated
- * @ordered
+ * this should never be null; if we do not have a connection, this will be
+ * a "null" connection profile
*/
- protected String connectionProfileName = CONNECTION_PROFILE_NAME_EDEFAULT;
- // cache the connection profile name so we can detect when it changes and fire events
-
- // this should never be null
protected transient ConnectionProfile connectionProfile;
+ /**
+ * listen for the connection to be added or removed or its name changed
+ */
protected final ProfileListener profileListener;
+ /**
+ * listen for the connection to be opened or closed
+ */
protected final ConnectionListener connectionListener;
+
// ********** constructor/initialization **********
- protected JpaDataSource() {
- super();
+
+ public JpaDataSource(IJpaProject jpaProject, String connectionProfileName) {
+ super(jpaProject);
+
this.profileListener = this.buildProfileListener();
ConnectionProfileRepository.instance().addProfileListener(this.profileListener);
- this.connectionListener = this.buildConnectionListener();
- }
- protected JpaDataSource(IJpaProject jpaProject, String connectionProfileName) {
- this();
- this.jpaProject = jpaProject;
+ this.connectionListener = this.buildConnectionListener();
this.connectionProfileName = connectionProfileName;
- this.connectionProfile = this.profileNamed(connectionProfileName);
+ this.connectionProfile = this.connectionProfileNamed(connectionProfileName);
this.connectionProfile.addConnectionListener(this.connectionListener);
}
@@ -93,188 +69,83 @@ public class JpaDataSource extends JpaEObject implements IJpaDataSource
return new LocalConnectionListener();
}
- // ********** EMF stuff **********
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaCorePackage.Literals.JPA_DATA_SOURCE;
- }
- /**
- * Returns the value of the '<em><b>Connection Profile Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Connection Profile Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Connection Profile Name</em>' attribute.
- * @see #setConnectionProfileName(String)
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getJpaDataSource_ConnectionProfileName()
- * @model unique="false" required="true" ordered="false"
- * @generated
- */
- public String getConnectionProfileName() {
- return connectionProfileName;
- }
+ // ********** IJpaDataSource implementation **********
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.JpaDataSource#getConnectionProfileName <em>Connection Profile Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Connection Profile Name</em>' attribute.
- * @see #getConnectionProfileName()
- * @generated
- */
- public void setConnectionProfileNameGen(String newConnectionProfileName) {
- String oldConnectionProfileName = connectionProfileName;
- connectionProfileName = newConnectionProfileName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaCorePackage.JPA_DATA_SOURCE__CONNECTION_PROFILE_NAME, oldConnectionProfileName, connectionProfileName));
+ public String connectionProfileName() {
+ return this.connectionProfileName;
}
- /**
- * set the connection profile when the name changes
- */
public void setConnectionProfileName(String connectionProfileName) {
- if (!connectionProfileName.equals(this.connectionProfileName)) {
- this.setConnectionProfileNameGen(connectionProfileName);
- this.setConnectionProfile(this.profileNamed(connectionProfileName));
- }
+ String old = this.connectionProfileName;
+ this.connectionProfileName = connectionProfileName;
+ this.firePropertyChanged(CONNECTION_PROFILE_NAME_PROPERTY, old, connectionProfileName);
+ // synch the connection profile when the name changes
+ this.setConnectionProfile(this.connectionProfileNamed(connectionProfileName));
}
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
@Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaCorePackage.JPA_DATA_SOURCE__CONNECTION_PROFILE_NAME :
- return getConnectionProfileName();
- }
- return super.eGet(featureID, resolve, coreType);
+ public ConnectionProfile connectionProfile() {
+ return this.connectionProfile;
}
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaCorePackage.JPA_DATA_SOURCE__CONNECTION_PROFILE_NAME :
- setConnectionProfileName((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
+ public boolean hasAConnection() {
+ return ! this.connectionProfile.isNull();
}
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaCorePackage.JPA_DATA_SOURCE__CONNECTION_PROFILE_NAME :
- setConnectionProfileName(CONNECTION_PROFILE_NAME_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
+ public void dispose() {
+ this.connectionProfile.removeConnectionListener(this.connectionListener);
+ ConnectionProfileRepository.instance().removeProfileListener(this.profileListener);
}
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaCorePackage.JPA_DATA_SOURCE__CONNECTION_PROFILE_NAME :
- return CONNECTION_PROFILE_NAME_EDEFAULT == null ? connectionProfileName != null : !CONNECTION_PROFILE_NAME_EDEFAULT.equals(connectionProfileName);
- }
- return super.eIsSet(featureID);
- }
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (connectionProfileName: ");
- result.append(connectionProfileName);
- result.append(')');
- return result.toString();
- }
+ // ********** internal methods **********
- // ********** non-EMF stuff **********
- public IJpaProject getProject() {
- return this.jpaProject;
+ private ConnectionProfile connectionProfileNamed(String name) {
+ return ConnectionProfileRepository.instance().profileNamed(name);
}
- public ConnectionProfile getConnectionProfile() {
- return this.connectionProfile;
+ protected void setConnectionProfile(ConnectionProfile connectionProfile) {
+ ConnectionProfile old = this.connectionProfile;
+ this.connectionProfile.removeConnectionListener(this.connectionListener);
+ this.connectionProfile = connectionProfile;
+ this.connectionProfile.addConnectionListener(this.connectionListener);
+ this.firePropertyChanged(CONNECTION_PROFILE_PROPERTY, old, connectionProfile);
}
- private ConnectionProfile profileNamed(String name) {
- return ConnectionProfileRepository.instance().profileNamed(name);
- }
- void setConnectionProfile(ConnectionProfile profile) {
- if (this.connectionProfile != profile) {
- this.connectionProfile.removeConnectionListener(this.connectionListener);
- this.connectionProfile = profile;
- this.connectionProfile.addConnectionListener(this.connectionListener);
- this.getProject().update();
- }
- }
+ // ********** overrides **********
@Override
public boolean isConnected() {
return this.connectionProfile.isConnected();
}
- public boolean hasAConnection() {
- return this.connectionProfile.isNull();
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.connectionProfileName);
}
- public void dispose() {
- this.connectionProfile.removeConnectionListener(this.connectionListener);
- ConnectionProfileRepository.instance().removeProfileListener(this.profileListener);
- }
- // ********** member class **********
+ // ********** member classes **********
/**
* Listen for a connection profile with our name being added or removed.
- * Also listen for our connection's name begin changed.
+ * Also listen for our connection's name being changed.
*/
protected class LocalProfileListener implements ProfileListener {
-
protected LocalProfileListener() {
super();
}
+ // possible name change
public void profileChanged(ConnectionProfile profile) {
if (profile == JpaDataSource.this.connectionProfile) {
JpaDataSource.this.setConnectionProfileName(profile.getName());
}
}
+ // profile added or removed
public void profileReplaced(ConnectionProfile oldProfile, ConnectionProfile newProfile) {
if (oldProfile == JpaDataSource.this.connectionProfile) {
JpaDataSource.this.setConnectionProfile(newProfile);
@@ -283,6 +154,7 @@ public class JpaDataSource extends JpaEObject implements IJpaDataSource
}
+
/**
* Whenever the connection is opened or closed trigger a project update.
*/
@@ -293,7 +165,7 @@ public class JpaDataSource extends JpaEObject implements IJpaDataSource
}
public void opened(ConnectionProfile profile) {
- JpaDataSource.this.getProject().update();
+ JpaDataSource.this.jpaProject().update();
}
public void aboutToClose(ConnectionProfile profile) {
@@ -305,7 +177,7 @@ public class JpaDataSource extends JpaEObject implements IJpaDataSource
}
public void closed(ConnectionProfile profile) {
- JpaDataSource.this.getProject().update();
+ JpaDataSource.this.jpaProject().update();
}
public void modified(ConnectionProfile profile) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaEObject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaEObject.java
deleted file mode 100644
index b583525f41..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaEObject.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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;
-
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Set;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.Database;
-
-/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getJpaEObject()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class JpaEObject extends EObjectImpl implements IJpaEObject
-{
- /**
- * Sets of "insignificant" feature ids, keyed by class.
- * This is built up lazily, as the objects are modified.
- */
- private static final Map<Class<? extends JpaEObject>, Set<Integer>> insignificantFeatureIdSets = new Hashtable<Class<? extends JpaEObject>, Set<Integer>>();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected JpaEObject() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaCorePackage.Literals.JPA_EOBJECT;
- }
-
- public IJpaProject getJpaProject() {
- IJpaEObject container = (IJpaEObject) this.eContainer();
- return (container == null) ? null : container.getJpaProject();
- }
-
- public IResource getResource() {
- return this.getJpaProject().project();
- }
-
- public IJpaPlatform jpaPlatform() {
- return getJpaProject().jpaPlatform();
- }
-
- public IJpaFactory jpaFactory() {
- return jpaPlatform().getJpaFactory();
- }
-
- public ConnectionProfile connectionProfile() {
- return this.getJpaProject().connectionProfile();
- }
-
- public Database database() {
- return this.connectionProfile().getDatabase();
- }
-
- public boolean isConnected() {
- ConnectionProfile cp = this.connectionProfile();
- return (cp != null) && cp.isConnected();
- }
-
- // ********** change notification **********
- /**
- * override to prevent notification when the object's state is unchanged
- */
- @Override
- public void eNotify(Notification notification) {
- if (!notification.isTouch()) {
- super.eNotify(notification);
- this.featureChanged(notification.getFeatureID(this.getClass()));
- }
- }
-
- protected void featureChanged(int featureId) {
- if (this.featureIsSignificant(featureId)) {
- IJpaProject project = this.getJpaProject();
- // check that the model is fully initialized
- if (project != null) {
- project.update();
- }
- }
- }
-
- protected boolean featureIsSignificant(int featureId) {
- return !this.featureIsInsignificant(featureId);
- }
-
- protected boolean featureIsInsignificant(int featureId) {
- return this.insignificantFeatureIds().contains(featureId);
- }
-
- /**
- * Return a set of the object's "insignificant" feature ids.
- * These are the EMF features that, when they change, will NOT cause the
- * object (or its containing tree) to be resynched, i.e. defaults calculated.
- * If you need instance-based calculation of your "insignificant" aspects,
- * override this method. If class-based calculation is sufficient,
- * override #addInsignificantFeatureIdsTo(Set).
- */
- protected Set<Integer> insignificantFeatureIds() {
- synchronized (insignificantFeatureIdSets) {
- Set<Integer> insignificantFeatureIds = insignificantFeatureIdSets.get(this.getClass());
- if (insignificantFeatureIds == null) {
- insignificantFeatureIds = new HashSet<Integer>();
- this.addInsignificantFeatureIdsTo(insignificantFeatureIds);
- insignificantFeatureIdSets.put(this.getClass(), insignificantFeatureIds);
- }
- return insignificantFeatureIds;
- }
- }
-
- /**
- * Add the object's "insignificant" feature ids to the specified set.
- * These are the EMF features that, when they change, will NOT cause the
- * object (or its containing tree) to be resynched, i.e. defaults calculated.
- * If class-based calculation of your "insignificant" features is sufficient,
- * override this method. If you need instance-based calculation,
- * override #insignificantFeatureIds().
- */
- protected void addInsignificantFeatureIdsTo(Set<Integer> insignificantFeatureIds) {
- // when you override this method, don't forget to include:
- // super.addInsignificantFeatureIdsTo(insignificantFeatureIds);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaFile.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaFile.java
index 31a1cc89f1..778a834504 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaFile.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaFile.java
@@ -10,334 +10,77 @@
package org.eclipse.jpt.core.internal;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.jdt.core.ElementChangedEvent;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Persistence File</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.JpaFile#getContentId <em>Content Id</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.JpaFile#getContent <em>Content</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getJpaFile()
- * @model kind="class"
- * @generated
+ *
*/
-public class JpaFile extends JpaEObject implements IJpaFile
+public class JpaFile extends JpaNode implements IJpaFile
{
- // temporary bridge until we remove EMF stuff
- private IJpaProject jpaProject;
-
- /**
- * The default value of the '{@link #getContentId() <em>Content Id</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getContentId()
- * @generated
- * @ordered
- */
- protected static final String CONTENT_ID_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getContentId() <em>Content Id</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getContentId()
- * @generated
- * @ordered
- */
- protected String contentId = CONTENT_ID_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getContent() <em>Content</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getContent()
- * @generated
- * @ordered
- */
- protected IJpaRootContentNode content;
-
/**
* The IFile associated with this JPA file
*/
- protected IFile file;
-
+ protected final IFile file;
+
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
+ * The resource model represented by this JPA file
*/
- protected JpaFile() {
- super();
- }
-
- public JpaFile(IJpaProject jpaProject, IFile file, IJpaFileContentProvider provider) {
- this();
- this.jpaProject = jpaProject;
- this.setFile(file);
- this.setContentId(provider.contentType());
- provider.buildRootContent(this);
- }
-
- // temporary bridge until we get rid of EMF stuff
- @Override
- public IJpaProject getJpaProject() {
- return this.jpaProject;
+ protected final IResourceModel resourceModel;
+
+
+ public JpaFile(IJpaProject jpaProject, IFile file, IResourceModel resourceModel) {
+ super(jpaProject);
+ this.file = file;
+ this.resourceModel = resourceModel;
}
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaCorePackage.Literals.JPA_FILE;
- }
-
- /**
- * Returns the value of the '<em><b>Content Id</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Content Id</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Content Id</em>' attribute.
- * @see #setContentId(String)
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getJpaFile_ContentId()
- * @model required="true"
- * @generated
- */
- public String getContentId() {
- return contentId;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.JpaFile#getContentId <em>Content Id</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Content Id</em>' attribute.
- * @see #getContentId()
- * @generated
- */
- public void setContentId(String newContentId) {
- String oldContentId = contentId;
- contentId = newContentId;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaCorePackage.JPA_FILE__CONTENT_ID, oldContentId, contentId));
- }
-
- /**
- * Returns the value of the '<em><b>Content</b></em>' containment reference.
- * It is bidirectional and its opposite is '{@link org.eclipse.jpt.core.internal.IJpaRootContentNode#getJpaFile <em>Jpa File</em>}'.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Content</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Content</em>' containment reference.
- * @see #setContent(IJpaRootContentNode)
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getJpaFile_Content()
- * @see org.eclipse.jpt.core.internal.IJpaRootContentNode#getJpaFile
- * @model opposite="jpaFile" containment="true"
- * @generated
- */
- public IJpaRootContentNode getContent() {
- return content;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetContent(IJpaRootContentNode newContent, NotificationChain msgs) {
- IJpaRootContentNode oldContent = content;
- content = newContent;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaCorePackage.JPA_FILE__CONTENT, oldContent, newContent);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
+
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.JpaFile#getContent <em>Content</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Content</em>' containment reference.
- * @see #getContent()
- * @generated
+ * @see IJpaFile#getFile()
*/
- public void setContent(IJpaRootContentNode newContent) {
- if (newContent != content) {
- NotificationChain msgs = null;
- if (content != null)
- msgs = ((InternalEObject) content).eInverseRemove(this, JpaCorePackage.IJPA_ROOT_CONTENT_NODE__JPA_FILE, IJpaRootContentNode.class, msgs);
- if (newContent != null)
- msgs = ((InternalEObject) newContent).eInverseAdd(this, JpaCorePackage.IJPA_ROOT_CONTENT_NODE__JPA_FILE, IJpaRootContentNode.class, msgs);
- msgs = basicSetContent(newContent, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaCorePackage.JPA_FILE__CONTENT, newContent, newContent));
- }
-
public IFile getFile() {
return file;
}
- void setFile(IFile theFile) {
- file = theFile;
- }
-
- public void dispose() {
- this.content.dispose();
- }
-
- public void javaElementChanged(ElementChangedEvent event) {
- this.content.javaElementChanged(event);
- }
-
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
+ * @see IJpaFile#getResourceModel()
*/
- @Override
- public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaCorePackage.JPA_FILE__CONTENT :
- if (content != null)
- msgs = ((InternalEObject) content).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JpaCorePackage.JPA_FILE__CONTENT, null, msgs);
- return basicSetContent((IJpaRootContentNode) otherEnd, msgs);
- }
- return super.eInverseAdd(otherEnd, featureID, msgs);
+ public IResourceModel getResourceModel() {
+ return resourceModel;
}
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaCorePackage.JPA_FILE__CONTENT :
- return basicSetContent(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
+
+ public IJpaContextNode contextNode(int textOffset) {
+ return null;
}
-
+
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
+ * @see IJpaFile#getResourceType()
*/
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaCorePackage.JPA_FILE__CONTENT_ID :
- return getContentId();
- case JpaCorePackage.JPA_FILE__CONTENT :
- return getContent();
- }
- return super.eGet(featureID, resolve, coreType);
+ public String getResourceType() {
+ return getResourceModel().getResourceType();
}
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaCorePackage.JPA_FILE__CONTENT_ID :
- setContentId((String) newValue);
- return;
- case JpaCorePackage.JPA_FILE__CONTENT :
- setContent((IJpaRootContentNode) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaCorePackage.JPA_FILE__CONTENT_ID :
- setContentId(CONTENT_ID_EDEFAULT);
- return;
- case JpaCorePackage.JPA_FILE__CONTENT :
- setContent((IJpaRootContentNode) null);
- return;
- }
- super.eUnset(featureID);
+
+ public void dispose() {
+ getResourceModel().dispose();
}
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaCorePackage.JPA_FILE__CONTENT_ID :
- return CONTENT_ID_EDEFAULT == null ? contentId != null : !CONTENT_ID_EDEFAULT.equals(contentId);
- case JpaCorePackage.JPA_FILE__CONTENT :
- return content != null;
- }
- return super.eIsSet(featureID);
+
+ public void javaElementChanged(ElementChangedEvent event) {
+ getResourceModel().handleJavaElementChangedEvent(event);
}
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (contentId: ");
- result.append(contentId);
- result.append(')');
- return result.toString();
+
+ public void fileAdded(IJpaFile jpaFile) {
+ getResourceModel().resolveTypes();
}
-
- public IJpaContentNode getContentNode(int offset) {
- return getContent().getContentNode(offset);
+
+ public void fileRemoved(IJpaFile jpaFile) {
+ getResourceModel().resolveTypes();
}
-
+
@Override
- public IResource getResource() {
- return file;
+ public void toString(StringBuilder sb) {
+ sb.append(getFile().toString());
+ sb.append(" (resourceType: ");
+ sb.append(getResourceType());
+ sb.append(")");
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaModel.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaModel.java
index 74c9be8134..01c9d66d0e 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaModel.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -28,16 +28,13 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.core.ElementChangedEvent;
import org.eclipse.jpt.core.internal.IJpaProject.Config;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.OrmResource;
-import org.eclipse.jpt.core.internal.content.orm.resource.OrmArtifactEdit;
-import org.eclipse.jpt.core.internal.content.persistence.Persistence;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.content.persistence.resource.PersistenceArtifactEdit;
-import org.eclipse.jpt.core.internal.content.persistence.resource.PersistenceResource;
import org.eclipse.jpt.core.internal.facet.IJpaFacetDataModelProperties;
+import org.eclipse.jpt.core.internal.resource.orm.EntityMappings;
+import org.eclipse.jpt.core.internal.resource.orm.OrmArtifactEdit;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.OrmResource;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceArtifactEdit;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResource;
import org.eclipse.jpt.utility.internal.ClassTools;
import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
@@ -221,74 +218,69 @@ public class JpaModel
IProject project = event.getProject().getProject();
IDataModel dataModel = (IDataModel) event.getActionConfig();
- this.buildPersistenceXmlJob(project).schedule();
-
- if (dataModel.getBooleanProperty(IJpaFacetDataModelProperties.CREATE_ORM_XML)) {
- this.buildOrmXmlJob(project).schedule();
- }
+ boolean buildOrmXml = dataModel.getBooleanProperty(IJpaFacetDataModelProperties.CREATE_ORM_XML);
+ this.buildProjectXmlJob(project, buildOrmXml).schedule();
// assume(?) this is the first event to indicate we need to add the JPA project to the JPA model
this.addJpaProject(project);
}
- private Job buildPersistenceXmlJob(final IProject project) {
- return new Job("Create persistence.xml") {
+ private Job buildProjectXmlJob(final IProject project, final boolean buildOrmXml) {
+ Job job = new Job("Create Project XML files") {
@Override
protected IStatus run(IProgressMonitor monitor) {
- JpaModel.this.createPersistenceXml(project);
+ JpaModel.this.createProjectXml(project, buildOrmXml);
return Status.OK_STATUS;
}
};
+ job.setRule(ResourcesPlugin.getWorkspace().getRoot());
+ return job;
}
- /* private */ void createPersistenceXml(IProject project) {
+ /* private */ void createProjectXml(IProject project, boolean buildOrmXml) {
+ this.createPersistenceXml(project);
+
+ if (buildOrmXml) {
+ this.createOrmXml(project);
+ }
+
+ }
+
+ private void createPersistenceXml(IProject project) {
PersistenceArtifactEdit pae = PersistenceArtifactEdit.getArtifactEditForWrite(project);
- PersistenceResource resource = pae.getPersistenceResource(JptCorePlugin.persistenceXmlDeploymentURI(project));
// 202811 - do not add content if it is already present
- if (resource.getPersistence() == null) {
- Persistence persistence = PersistenceFactory.eINSTANCE.createPersistence();
- persistence.setVersion("1.0");
- PersistenceUnit pUnit = PersistenceFactory.eINSTANCE.createPersistenceUnit();
- pUnit.setName(project.getName());
- persistence.getPersistenceUnits().add(pUnit);
- this.resourceContents(resource).add(persistence);
- pae.save(null);
+ PersistenceResource resource = pae.getResource();
+ if (! resource.getFile().exists()) {
+ pae.createDefaultResource();
}
pae.dispose();
}
- @SuppressWarnings({ "restriction", "unchecked" })
- private EList<EObject> resourceContents(PersistenceResource resource) {
- return resource.getContents();
- }
-
- private Job buildOrmXmlJob(final IProject project) {
- return new Job("Create orm.xml") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- JpaModel.this.createOrmXml(project);
- return Status.OK_STATUS;
- }
- };
- }
-
- /* private */ void createOrmXml(IProject project) {
+ private void createOrmXml(IProject project) {
OrmArtifactEdit oae = OrmArtifactEdit.getArtifactEditForWrite(project);
- OrmResource resource = oae.getOrmResource(JptCorePlugin.ormXmlDeploymentURI(project));
+ OrmResource resource = oae.getResource(JptCorePlugin.ormXmlDeploymentURI(project));
// 202811 - do not add content if it is already present
if (resource.getEntityMappings() == null) {
- EntityMappingsInternal entityMappings = OrmFactory.eINSTANCE.createEntityMappingsInternal();
+ EntityMappings entityMappings = OrmFactory.eINSTANCE.createEntityMappings();
entityMappings.setVersion("1.0");
- resource.getContents().add(entityMappings);
+ this.resourceContents(resource).add(entityMappings);
oae.save(null);
}
oae.dispose();
}
+ /**
+ * minimize the scope of the suppressed warnings
+ */
+ @SuppressWarnings("unchecked")
+ private EList<EObject> resourceContents(OrmResource resource) {
+ return resource.getContents();
+ }
+
// TODO remove classpath items? persistence.xml? orm.xml?
synchronized void jpaFacetedProjectPreUninstall(IProjectFacetActionEvent event) {
// assume(?) this is the first event to indicate we need to remove the JPA project to the JPA model
@@ -454,7 +446,7 @@ public class JpaModel
}
private IJpaProject buildJpaProject() throws CoreException {
- return this.config.jpaPlatform().getJpaFactory().createJpaProject(this.config);
+ return this.config.jpaPlatform().jpaFactory().createJpaProject(this.config);
}
public void synchronizeJpaFiles(IResourceDelta delta) throws CoreException {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaModelObject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaModelObject.java
new file mode 100644
index 0000000000..bb32c61275
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaModelObject.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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;
+
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
+
+public abstract class JpaModelObject extends AbstractModel
+ implements IJpaModelObject
+{
+ // For now, make this simply an object, but it should eventually be a JpaModelObject
+ private Object parent;
+
+
+ public JpaModelObject(Object theParent) {
+ super();
+ parent = theParent;
+ initialize(parent);
+ }
+
+ protected void initialize(Object parent) {
+ // do nothing by default
+ }
+
+ /**
+ * @see IJpaModelObject#getParent()
+ */
+ public Object getParent() {
+ return parent;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaNode.java
index fa69654791..3216115fbf 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaNode.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -12,14 +12,17 @@ package org.eclipse.jpt.core.internal;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Set;
-
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.db.internal.ConnectionProfile;
import org.eclipse.jpt.db.internal.Database;
import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
import org.eclipse.jpt.utility.internal.node.AbstractNode;
import org.eclipse.jpt.utility.internal.node.Node;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
*
@@ -35,12 +38,20 @@ public abstract class JpaNode
protected JpaNode(IJpaNode parent) {
super(parent);
}
+
+
+ // ********** IAdaptable implementation **********
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class adapter) {
+ return Platform.getAdapterManager().getAdapter(this, adapter);
+ }
// ********** IJpaNodeModel implementation **********
public IResource resource() {
- return this.jpaProject().project();
+ return parent().resource();
}
public IJpaProject jpaProject() {
@@ -64,7 +75,6 @@ public abstract class JpaNode
return (IJpaProject) super.root();
}
-
// ********** convenience methods **********
public Iterator<IJpaNode> jpaChildren() {
@@ -81,7 +91,7 @@ public abstract class JpaNode
}
protected IJpaFactory jpaFactory() {
- return this.jpaPlatform().getJpaFactory();
+ return this.jpaPlatform().jpaFactory();
}
protected ConnectionProfile connectionProfile() {
@@ -92,52 +102,59 @@ public abstract class JpaNode
return this.connectionProfile().getDatabase();
}
- protected boolean isConnected() {
+ public boolean isConnected() {
return this.connectionProfile().isConnected();
}
+ // ********** update model **********
- // TODO this stuff should go away when we rework "defaults"
- // ********** recalculate defaults **********
-
- private static final HashMap<Class<? extends AbstractNode>, HashSet<String>> nonDefaultAspectNameSets = new HashMap<Class<? extends AbstractNode>, HashSet<String>>();
+ private static final HashMap<Class<? extends AbstractNode>, HashSet<String>> nonUpdateAspectNameSets = new HashMap<Class<? extends AbstractNode>, HashSet<String>>();
@Override
protected void aspectChanged(String aspectName) {
super.aspectChanged(aspectName);
- if (this.aspectAffectsDefaults(aspectName)) {
- // System.out.println(Thread.currentThread() + " defaults change: " + this + ": " + aspectName);
+ if (this.aspectTriggersUpdate(aspectName)) {
+ // System.out.println(Thread.currentThread() + " \"update\" change: " + this + ": " + aspectName);
this.jpaProject().update();
}
}
- private boolean aspectAffectsDefaults(String aspectName) {
- return ! this.aspectDoesNotAffectDefaults(aspectName);
+ private boolean aspectTriggersUpdate(String aspectName) {
+ return ! this.aspectDoesNotTriggerUpdate(aspectName);
}
- private boolean aspectDoesNotAffectDefaults(String aspectName) {
- return this.nonDefaultAspectNames().contains(aspectName);
+ private boolean aspectDoesNotTriggerUpdate(String aspectName) {
+ return this.nonUpdateAspectNames().contains(aspectName);
}
- protected final Set<String> nonDefaultAspectNames() {
- synchronized (nonDefaultAspectNameSets) {
- HashSet<String> nonDefaultAspectNames = nonDefaultAspectNameSets.get(this.getClass());
- if (nonDefaultAspectNames == null) {
- nonDefaultAspectNames = new HashSet<String>();
- this.addNonDefaultAspectNamesTo(nonDefaultAspectNames);
- nonDefaultAspectNameSets.put(this.getClass(), nonDefaultAspectNames);
+ protected final Set<String> nonUpdateAspectNames() {
+ synchronized (nonUpdateAspectNameSets) {
+ HashSet<String> nonUpdateAspectNames = nonUpdateAspectNameSets.get(this.getClass());
+ if (nonUpdateAspectNames == null) {
+ nonUpdateAspectNames = new HashSet<String>();
+ this.addNonUpdateAspectNamesTo(nonUpdateAspectNames);
+ nonUpdateAspectNameSets.put(this.getClass(), nonUpdateAspectNames);
}
- return nonDefaultAspectNames;
+ return nonUpdateAspectNames;
}
}
- protected void addNonDefaultAspectNamesTo(Set<String> nonDefaultAspectNames) {
- nonDefaultAspectNames.add(COMMENT_PROPERTY);
- nonDefaultAspectNames.add(DIRTY_BRANCH_PROPERTY);
- nonDefaultAspectNames.add(BRANCH_PROBLEMS_LIST);
- nonDefaultAspectNames.add(HAS_BRANCH_PROBLEMS_PROPERTY);
+ protected void addNonUpdateAspectNamesTo(Set<String> nonUpdateAspectNames) {
+ nonUpdateAspectNames.add(COMMENT_PROPERTY);
+ nonUpdateAspectNames.add(DIRTY_BRANCH_PROPERTY);
+ nonUpdateAspectNames.add(BRANCH_PROBLEMS_LIST);
+ nonUpdateAspectNames.add(HAS_BRANCH_PROBLEMS_PROPERTY);
// when you override this method, don't forget to include:
- // super.addNonDefaultAspectNamesTo(nonDefaultAspectNames);
+ // super.addNonUpdateAspectNamesTo(nonUpdateAspectNames);
+ }
+
+ // ********** validation **********
+
+ /**
+ * All subclass implementations {@link #addToMessages(List<IMessage>)}
+ * should be preceded by a "super" call to this method
+ */
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaProject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaProject.java
index e330ab0999..ae14a02355 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaProject.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaProject.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -13,7 +13,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -26,23 +25,27 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.core.ElementChangedEvent;
import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit;
-import org.eclipse.jpt.core.internal.platform.IContext;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResourceModel;
+import org.eclipse.jpt.core.internal.resource.java.JpaCompilationUnitResource;
+import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.db.internal.ConnectionProfile;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.CommandExecutor;
import org.eclipse.jpt.utility.internal.CommandExecutorProvider;
import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
import org.eclipse.jpt.utility.internal.node.Node;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
/**
*
@@ -78,6 +81,12 @@ public class JpaProject extends JpaNode implements IJpaProject {
protected boolean discoversAnnotatedClasses;
/**
+ * The model representing the collated resources associated
+ * with the JPA project.
+ */
+ protected IContextModel contextModel;
+
+ /**
* The visitor passed to resource deltas.
*/
protected final IResourceDeltaVisitor resourceDeltaVisitor;
@@ -89,10 +98,23 @@ public class JpaProject extends JpaNode implements IJpaProject {
protected final CommandExecutorProvider modifySharedDocumentCommandExecutorProvider;
/**
- * Scheduler that uses a job to update the JPA project when changes occur.
- * @see #update()
+ * A pluggable updater that can be used to "update" the project either
+ * synchronously or asynchronously (or not at all). An asynchronous
+ * updater is the default and is used when the project is being manipulated
+ * by the UI. A synchronous updater is used when the project is being
+ * manipulated by a "batch" (or non-UI) client (e.g. when testing the
+ * "update" behavior). A null updater is used during tests that
+ * do not care whether "updates" occur. Clients will need to explicitly
+ * configure the updater if they require something other than an
+ * asynchronous updater.
+ */
+ protected Updater updater;
+
+ /**
+ * Resource models notify this listener when they change. A project update
+ * should occur any time a resource model changes.
*/
- protected final UpdateJpaProjectJobScheduler updateJpaProjectJobScheduler;
+ protected IResourceModelListener resourceModelListener;
// ********** constructor/initialization **********
@@ -107,19 +129,22 @@ public class JpaProject extends JpaNode implements IJpaProject {
}
this.project = config.project();
this.jpaPlatform = config.jpaPlatform();
- this.jpaPlatform.setProject(this); // TODO this must go
- this.dataSource = this.jpaFactory().createDataSource(this, config.connectionProfileName());
+ this.dataSource = this.jpaFactory().createJpaDataSource(this, config.connectionProfileName());
this.discoversAnnotatedClasses = config.discoverAnnotatedClasses();
- this.jpaFiles = this.buildJpaFiles();
+ this.jpaFiles = this.buildEmptyJpaFiles();
this.resourceDeltaVisitor = this.buildResourceDeltaVisitor();
this.threadLocalModifySharedDocumentCommandExecutor = this.buildThreadLocalModifySharedDocumentCommandExecutor();
this.modifySharedDocumentCommandExecutorProvider = this.buildModifySharedDocumentCommandExecutorProvider();
- this.updateJpaProjectJobScheduler = this.buildUpdateJpaProjectJobScheduler();
+ this.updater = this.buildUpdater();
+
+ this.resourceModelListener = this.buildResourceModelListener();
// build the JPA files corresponding to the Eclipse project's files
this.project.accept(this.buildInitialResourceProxyVisitor(), IResource.NONE);
+ this.contextModel = this.buildContextModel();
+
this.update();
}
@@ -129,8 +154,13 @@ public class JpaProject extends JpaNode implements IJpaProject {
throw new IllegalArgumentException("The parent node must be null");
}
}
+
+ @Override
+ public IResource resource() {
+ return project();
+ }
- protected Vector<IJpaFile> buildJpaFiles() {
+ protected Vector<IJpaFile> buildEmptyJpaFiles() {
return new Vector<IJpaFile>();
}
@@ -146,12 +176,20 @@ public class JpaProject extends JpaNode implements IJpaProject {
return new ModifySharedDocumentCommandExecutorProvider();
}
+ protected Updater buildUpdater() {
+ return new AsynchronousJpaProjectUpdater(this);
+ }
+
+ protected IResourceModelListener buildResourceModelListener() {
+ return new ResourceModelListener();
+ }
+
protected IResourceProxyVisitor buildInitialResourceProxyVisitor() {
return new InitialResourceProxyVisitor();
}
- protected UpdateJpaProjectJobScheduler buildUpdateJpaProjectJobScheduler() {
- return new UpdateJpaProjectJobScheduler(this, this.project);
+ protected IContextModel buildContextModel() {
+ return this.jpaFactory().buildContextModel(this);
}
// ***** inner class
@@ -167,7 +205,7 @@ public class JpaProject extends JpaNode implements IJpaProject {
case IResource.FOLDER :
return true; // visit children
case IResource.FILE :
- JpaProject.this.addJpaFile((IFile) resource.requestResource());
+ JpaProject.this.addJpaFileInternal((IFile) resource.requestResource());
return false; // no children
default :
return false; // no children
@@ -206,9 +244,13 @@ public class JpaProject extends JpaNode implements IJpaProject {
@Override
public ConnectionProfile connectionProfile() {
- return this.dataSource.getConnectionProfile();
+ return this.dataSource.connectionProfile();
}
+ public Schema defaultSchema() {
+ return connectionProfile().defaultSchema();
+ }
+
@Override
public Validator validator() {
return NULL_VALIDATOR;
@@ -241,36 +283,58 @@ public class JpaProject extends JpaNode implements IJpaProject {
return null;
}
- public Iterator<IJpaFile> jpaFiles(final String contentTypeId) {
- return new FilteringIterator<IJpaFile>(this.jpaFiles()) {
+ public Iterator<IJpaFile> jpaFiles(final String resourceType) {
+ return new FilteringIterator<IJpaFile, IJpaFile>(this.jpaFiles()) {
@Override
- protected boolean accept(Object o) {
- return ((IJpaFile) o).getContentId().equals(contentTypeId);
+ protected boolean accept(IJpaFile o) {
+ return o.getResourceType().equals(resourceType);
}
};
}
public Iterator<IJpaFile> javaJpaFiles() {
- return this.jpaFiles(JavaCore.JAVA_SOURCE_CONTENT_TYPE);
+ return this.jpaFiles(IResourceModel.JAVA_RESOURCE_TYPE);
}
/**
* Add a JPA file for the specified file, if appropriate.
*/
protected void addJpaFile(IFile file) {
- IJpaFile jpaFile = this.jpaPlatform.createJpaFile(this, file);
+ IJpaFile jpaFile = this.addJpaFileInternal(file);
if (jpaFile != null) {
- this.addItemToCollection(jpaFile, this.jpaFiles, JPA_FILES_COLLECTION);
+ this.fireItemAdded(JPA_FILES_COLLECTION, jpaFile);
+ for (Iterator<IJpaFile> stream = this.jpaFiles(); stream.hasNext(); ) {
+ stream.next().fileAdded(jpaFile);
+ }
}
}
/**
+ * Add a JPA file for the specified file, if appropriate, without firing
+ * an event; useful during construction.
+ * Return the new JPA file, null if it was not created.
+ */
+ protected IJpaFile addJpaFileInternal(IFile file) {
+ IJpaFile jpaFile = this.jpaPlatform.buildJpaFile(this, file);
+ if (jpaFile == null) {
+ return null;
+ }
+ this.jpaFiles.add(jpaFile);
+ jpaFile.getResourceModel().addResourceModelChangeListener(this.resourceModelListener);
+ return jpaFile;
+ }
+
+ /**
* Remove the specified JPA file and dispose it.
*/
protected void removeJpaFile(IJpaFile jpaFile) {
+ jpaFile.getResourceModel().removeResourceModelChangeListener(this.resourceModelListener);
if ( ! this.removeItemFromCollection(jpaFile, this.jpaFiles, JPA_FILES_COLLECTION)) {
throw new IllegalArgumentException("JPA file: " + jpaFile.getFile().getName());
}
+ for (Iterator<IJpaFile> stream = this.jpaFiles(); stream.hasNext(); ) {
+ stream.next().fileRemoved(jpaFile);
+ }
jpaFile.dispose();
}
@@ -279,38 +343,29 @@ public class JpaProject extends JpaNode implements IJpaProject {
}
- // ********** more queries **********
+ // ********** context model **********
- protected Iterator<JpaCompilationUnit> jpaCompilationUnits() {
- return new TransformationIterator<IJpaFile, JpaCompilationUnit>(this.javaJpaFiles()) {
- @Override
- protected JpaCompilationUnit transform(IJpaFile jpaFile) {
- return (JpaCompilationUnit) jpaFile.getContent();
- }
- };
+ public IContextModel contextModel() {
+ return this.contextModel;
}
- /**
- * Return an iterator of iterators on Java persistent types
- */
- protected Iterator<Iterator<JavaPersistentType>> javaPersistentTypeIterators() {
- return new TransformationIterator<JpaCompilationUnit, Iterator<JavaPersistentType>>(this.jpaCompilationUnits()) {
+
+ // ********** more queries **********
+
+ protected Iterator<JpaCompilationUnitResource> jpaCompilationUnitResources() {
+ return new TransformationIterator<IJpaFile, JpaCompilationUnitResource>(this.javaJpaFiles()) {
@Override
- protected Iterator<JavaPersistentType> transform(JpaCompilationUnit jcu) {
- return jcu.getTypes().iterator();
+ protected JpaCompilationUnitResource transform(IJpaFile jpaFile) {
+ return ((JavaResourceModel) jpaFile.getResourceModel()).resource();
}
};
}
- public Iterator<JavaPersistentType> javaPersistentTypes() {
- return new CompositeIterator<JavaPersistentType>(this.javaPersistentTypeIterators());
- }
-
- public JavaPersistentType javaPersistentType(IType type) {
- for (Iterator<JavaPersistentType> stream = this.javaPersistentTypes(); stream.hasNext(); ) {
- JavaPersistentType jpt = stream.next();
- if (jpt.getType().getJdtMember().equals(type)) {
- return jpt;
+ public JavaPersistentTypeResource javaPersistentTypeResource(String typeName) {
+ for (JpaCompilationUnitResource jpCompilationUnitResource : CollectionTools.iterable(this.jpaCompilationUnitResources())) {
+ JavaPersistentTypeResource jptr = jpCompilationUnitResource.javaPersistentTypeResource(typeName);
+ if (jptr != null) {
+ return jptr;
}
}
return null;
@@ -327,26 +382,94 @@ public class JpaProject extends JpaNode implements IJpaProject {
// ********** validation **********
-
- @SuppressWarnings("restriction")
- public Iterator<org.eclipse.wst.validation.internal.provisional.core.IMessage> validationMessages() {
- List<org.eclipse.wst.validation.internal.provisional.core.IMessage> messages = new ArrayList<org.eclipse.wst.validation.internal.provisional.core.IMessage>();
- this.jpaPlatform.addToMessages(messages);
+
+
+ public Iterator<IMessage> validationMessages() {
+ List<IMessage> messages = new ArrayList<IMessage>();
+ this.jpaPlatform.addToMessages(this, messages);
return messages.iterator();
}
-
-
+
+ /* If this is true, it may be assumed that all the requirements are valid
+ * for further validation. For example, if this is true at the point we
+ * are validating persistence units, it may be assumed that there is a
+ * single persistence.xml and that it has valid content down to the
+ * persistence unit level. */
+ private boolean okToContinueValidation = true;
+
+
+ @Override
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+ //start with the project - then down
+ //project validation
+ addProjectLevelMessages(messages);
+
+ //context model validation
+ contextModel().addToMessages(messages, astRoot);
+ }
+
+ protected void addProjectLevelMessages(List<IMessage> messages) {
+ addConnectionMessages(messages);
+ addMultiplePersistenceXmlMessage(messages);
+ }
+
+ protected void addConnectionMessages(List<IMessage> messages) {
+ addNoConnectionMessage(messages);
+ addInactiveConnectionMessage(messages);
+ }
+
+ protected boolean okToProceedForConnectionValidation = true;
+
+ protected void addNoConnectionMessage(List<IMessage> messages) {
+ if (! this.dataSource().hasAConnection()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ IJpaValidationMessages.PROJECT_NO_CONNECTION,
+ this)
+ );
+ okToProceedForConnectionValidation = false;
+ }
+ }
+
+ protected void addInactiveConnectionMessage(List<IMessage> messages) {
+ if (okToProceedForConnectionValidation && ! this.dataSource().isConnected()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.NORMAL_SEVERITY,
+ IJpaValidationMessages.PROJECT_INACTIVE_CONNECTION,
+ new String[] {this.dataSource().connectionProfileName()},
+ this)
+ );
+ }
+ okToProceedForConnectionValidation = true;
+ }
+
+ protected void addMultiplePersistenceXmlMessage(List<IMessage> messages) {
+// if (validPersistenceXmlFiles.size() > 1) {
+// messages.add(
+// JpaValidationMessages.buildMessage(
+// IMessage.HIGH_SEVERITY,
+// IJpaValidationMessages.PROJECT_MULTIPLE_PERSISTENCE_XML,
+// jpaProject)
+// );
+// okToContinueValidation = false;
+// }
+ }
+
+
+
+
// ********** root deploy location **********
- @SuppressWarnings("restriction")
- protected static final String WEB_PROJECT_ROOT_DEPLOY_LOCATION = org.eclipse.jst.j2ee.internal.J2EEConstants.WEB_INF_CLASSES;
+ protected static final String WEB_PROJECT_ROOT_DEPLOY_LOCATION = J2EEConstants.WEB_INF_CLASSES;
public String rootDeployLocation() {
return this.isWebProject() ? WEB_PROJECT_ROOT_DEPLOY_LOCATION : "";
}
- @SuppressWarnings("restriction")
- protected static final String JST_WEB_MODULE = org.eclipse.wst.common.componentcore.internal.util.IModuleConstants.JST_WEB_MODULE;
+ protected static final String JST_WEB_MODULE = IModuleConstants.JST_WEB_MODULE;
protected boolean isWebProject() {
return JptCorePlugin.projectHasWebFacet(this.project);
@@ -369,7 +492,7 @@ public class JpaProject extends JpaNode implements IJpaProject {
// ********** dispose **********
public void dispose() {
- this.updateJpaProjectJobScheduler.dispose();
+ this.updater.dispose();
// use clone iterator while deleting JPA files
for (Iterator<IJpaFile> stream = this.jpaFiles(); stream.hasNext(); ) {
this.removeJpaFile(stream.next());
@@ -378,6 +501,18 @@ public class JpaProject extends JpaNode implements IJpaProject {
}
+ // ********** resource model listener **********
+
+ protected class ResourceModelListener implements IResourceModelListener {
+ protected ResourceModelListener() {
+ super();
+ }
+ public void resourceModelChanged() {
+ JpaProject.this.update();
+ }
+ }
+
+
// ********** handling resource deltas **********
public void synchronizeJpaFiles(IResourceDelta delta) throws CoreException {
@@ -387,7 +522,7 @@ public class JpaProject extends JpaNode implements IJpaProject {
/**
* resource delta visitor callback
*/
- protected void synchronizeJpaFile(IFile file, int deltaKind) {
+ protected void synchronizeJpaFiles(IFile file, int deltaKind) {
switch (deltaKind) {
case IResourceDelta.ADDED :
if ( ! this.containsJpaFile(file)) {
@@ -424,7 +559,7 @@ public class JpaProject extends JpaNode implements IJpaProject {
case IResource.FOLDER :
return true; // visit children
case IResource.FILE :
- JpaProject.this.synchronizeJpaFile((IFile) res, delta.getKind());
+ JpaProject.this.synchronizeJpaFiles((IFile) res, delta.getKind());
return false; // no children
default :
return false; // no children
@@ -463,112 +598,41 @@ public class JpaProject extends JpaNode implements IJpaProject {
}
+ // ********** project "update" **********
- // ********** update project **********
+ public Updater updater() {
+ return this.updater;
+ }
- public IStatus update(IProgressMonitor monitor) {
- if (monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
+ public void setUpdater(Updater updater) {
+ this.updater = updater;
+ }
+ /**
+ * Delegate to the updater so clients can configure how updates occur.
+ */
+ public void update() {
+ this.updater.update();
+ }
+
+ /**
+ * Called by the updater.
+ */
+ public IStatus update(IProgressMonitor monitor) {
try {
- IContext contextHierarchy = this.jpaPlatform.buildProjectContext();
- this.jpaPlatform.resynch(contextHierarchy, monitor);
+ this.contextModel.update(monitor);
} catch (OperationCanceledException ex) {
return Status.CANCEL_STATUS;
} catch (Throwable ex) {
- //exceptions can occur when this thread is running and changes are
- //made to the java source. our model is not yet updated to the changed java source.
- //log these exceptions and assume they won't happen when the resynch runs again
- //as a result of the java source changes.
+ // Exceptions can occur when the update is running and changes are
+ // made concurrently to the Java source. When that happens, our
+ // model might be in an inconsistent state because it is not yet in
+ // sync with the changed Java source.
+ // Log these exceptions and assume they won't happen when the
+ // update runs again as a result of the concurrent Java source changes.
JptCorePlugin.log(ex);
}
return Status.OK_STATUS;
}
- public void update() {
- this.updateJpaProjectJobScheduler.schedule();
- }
-
- protected static class UpdateJpaProjectJobScheduler {
- /**
- * The job is built during construction and cleared out during dispose.
- * All the "public" methods check to make sure the job is not null,
- * doing nothing if it is (preventing anything from happening after
- * dispose).
- */
- protected Job job;
-
- protected UpdateJpaProjectJobScheduler(IJpaProject jpaProject, ISchedulingRule rule) {
- super();
- this.job = this.buildJob(jpaProject, rule);
- }
-
- protected Job buildJob(IJpaProject jpaProject, ISchedulingRule rule) {
- Job j = new UpdateJpaProjectJob(jpaProject);
- j.setRule(rule);
- return j;
- }
-
- /**
- * Stop the job if it is currently running, reschedule it to
- * run again, and return without waiting.
- */
- protected synchronized void schedule() {
- if (this.job != null) {
- this.job.cancel();
- this.job.schedule();
- }
- }
-
- /**
- * Stop the job if it is currently running, reschedule it to
- * run again, and wait until it is finished.
- */
- protected synchronized void scheduleAndWait() {
- if (this.job != null) {
- this.job.cancel();
- this.join();
- this.job.schedule();
- this.join();
- }
- }
-
- /**
- * Stop the job if it is currently running, wait until
- * it is finished, then clear the job out so it cannot
- * be scheduled again.
- */
- protected synchronized void dispose() {
- if (this.job != null) {
- this.job.cancel();
- this.join();
- this.job = null;
- }
- }
-
- protected synchronized void join() {
- try {
- this.job.join();
- } catch (InterruptedException ex) {
- // the thread was interrupted while waiting, job must be finished
- }
- }
-
- protected static class UpdateJpaProjectJob extends Job {
- protected final IJpaProject jpaProject;
-
- protected UpdateJpaProjectJob(IJpaProject jpaProject) {
- super("Update JPA project"); // TODO i18n
- this.jpaProject = jpaProject;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- return this.jpaProject.update(monitor);
- }
-
- }
-
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCorePlugin.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCorePlugin.java
index d42ed1232c..67657501ec 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCorePlugin.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCorePlugin.java
@@ -19,7 +19,10 @@ import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.jpt.core.internal.platform.generic.GenericPlatform;
+import org.eclipse.jpt.core.internal.platform.JpaPlatformRegistry;
+import org.eclipse.jpt.core.internal.platform.generic.GenericJpaPlatform;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
import org.osgi.framework.BundleContext;
import org.osgi.service.prefs.BackingStoreException;
@@ -91,14 +94,12 @@ public class JptCorePlugin extends Plugin {
/**
* Web projects have some special exceptions.
*/
- @SuppressWarnings("restriction")
- public static final String WEB_PROJECT_FACET_ID = org.eclipse.wst.common.componentcore.internal.util.IModuleConstants.JST_WEB_MODULE;
+ public static final String WEB_PROJECT_FACET_ID = IModuleConstants.JST_WEB_MODULE;
/**
* Web projects have some special exceptions.
*/
- @SuppressWarnings("restriction")
- public static final String WEB_PROJECT_DEPLOY_PREFIX = org.eclipse.jst.j2ee.internal.J2EEConstants.WEB_INF_CLASSES;
+ public static final String WEB_PROJECT_DEPLOY_PREFIX = J2EEConstants.WEB_INF_CLASSES;
public static final String DEFAULT_PERSISTENCE_XML_FILE_PATH = "META-INF/persistence.xml";
@@ -223,7 +224,7 @@ public class JptCorePlugin extends Plugin {
* Return the JPA platform ID associated with the specified Eclipse project.
*/
public static String jpaPlatformId(IProject project) {
- return preferences(project).get(JPA_PLATFORM, GenericPlatform.ID);
+ return preferences(project).get(JPA_PLATFORM, GenericJpaPlatform.ID);
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/NullTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/NullTypeMapping.java
deleted file mode 100644
index c60025b719..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/NullTypeMapping.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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;
-
-import java.util.Iterator;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jdt.core.ElementChangedEvent;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Null Type Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getNullTypeMapping()
- * @model kind="class"
- * @generated
- */
-public class NullTypeMapping extends JpaEObject
- implements ITypeMapping, IJpaSourceObject
-{
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getTableName() <em>Table Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTableName()
- * @generated
- * @ordered
- */
- protected static final String TABLE_NAME_EDEFAULT = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected NullTypeMapping() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaCorePackage.Literals.NULL_TYPE_MAPPING;
- }
-
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getITypeMapping_Name()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getName() {
- return "";
- }
-
- /**
- * Returns the value of the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.JpaCoreackage#getITypeMapping_TableName()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getTableName() {
- return "";
- }
-
- public IPersistentType getPersistentType() {
- throw new UnsupportedOperationException();
- }
-
- public IResource getResource() {
- throw new UnsupportedOperationException("getResource()");
- }
-
- /**
- * @model kind="operation"
- * @generated NOT
- */
- public IJpaFile getJpaFile() {
- throw new UnsupportedOperationException("getJpaFile()");
- }
-
- public ITextRange validationTextRange() {
- throw new UnsupportedOperationException("validationTextRange()");
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaCorePackage.NULL_TYPE_MAPPING__NAME :
- return getName();
- case JpaCorePackage.NULL_TYPE_MAPPING__TABLE_NAME :
- return getTableName();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaCorePackage.NULL_TYPE_MAPPING__NAME :
- return NAME_EDEFAULT == null ? getName() != null : !NAME_EDEFAULT.equals(getName());
- case JpaCorePackage.NULL_TYPE_MAPPING__TABLE_NAME :
- return TABLE_NAME_EDEFAULT == null ? getTableName() != null : !TABLE_NAME_EDEFAULT.equals(getTableName());
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaSourceObject.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == ITypeMapping.class) {
- switch (derivedFeatureID) {
- case JpaCorePackage.NULL_TYPE_MAPPING__NAME :
- return JpaCorePackage.ITYPE_MAPPING__NAME;
- case JpaCorePackage.NULL_TYPE_MAPPING__TABLE_NAME :
- return JpaCorePackage.ITYPE_MAPPING__TABLE_NAME;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaSourceObject.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == ITypeMapping.class) {
- switch (baseFeatureID) {
- case JpaCorePackage.ITYPE_MAPPING__NAME :
- return JpaCorePackage.NULL_TYPE_MAPPING__NAME;
- case JpaCorePackage.ITYPE_MAPPING__TABLE_NAME :
- return JpaCorePackage.NULL_TYPE_MAPPING__TABLE_NAME;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- public String getKey() {
- return IMappingKeys.NULL_TYPE_MAPPING_KEY;
- }
-
- public void javaElementChanged(ElementChangedEvent event) {}
-
- public Iterator<String> associatedTableNamesIncludingInherited() {
- return EmptyIterator.instance();
- }
-
- public Iterator<ITable> associatedTables() {
- return EmptyIterator.instance();
- }
-
- public Iterator<ITable> associatedTablesIncludingInherited() {
- return EmptyIterator.instance();
- }
-
- public Table primaryDbTable() {
- return null;
- }
-
- public Table dbTable(String tableName) {
- return null;
- }
-
- public Schema dbSchema() {
- return null;
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
- public Iterator<String> overridableAssociationNames() {
- return EmptyIterator.instance();
- }
-
- public Iterator<String> overridableAttributeNames() {
- return EmptyIterator.instance();
- }
-
- public Iterator<String> allOverridableAssociationNames() {
- return EmptyIterator.instance();
- }
-
- public Iterator<String> allOverridableAttributeNames() {
- return EmptyIterator.instance();
- }
-
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- // it's not so much that all mapping keys are allowed.
- // it's just that they're not really invalid, per se
- return true;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleJpaProjectConfig.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleJpaProjectConfig.java
index 930e3c01c2..7f57b5b7d6 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleJpaProjectConfig.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleJpaProjectConfig.java
@@ -10,7 +10,6 @@
package org.eclipse.jpt.core.internal;
import org.eclipse.core.resources.IProject;
-import org.eclipse.jpt.core.internal.IJpaProject;
import org.eclipse.jpt.utility.internal.StringTools;
/**
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleSchedulingRule.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleSchedulingRule.java
new file mode 100644
index 0000000000..52be764086
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleSchedulingRule.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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;
+
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+
+/**
+ * A job scheduling rule that conflicts only with itself.
+ */
+public final class SimpleSchedulingRule
+ implements ISchedulingRule
+{
+
+ // singleton
+ private static final SimpleSchedulingRule INSTANCE = new SimpleSchedulingRule();
+
+ /**
+ * Return the singleton.
+ */
+ public static ISchedulingRule instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private SimpleSchedulingRule() {
+ super();
+ }
+
+ public boolean contains(ISchedulingRule rule) {
+ return rule == this;
+ }
+
+ public boolean isConflicting(ISchedulingRule rule) {
+ return rule == this;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SynchronousJpaProjectUpdater.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SynchronousJpaProjectUpdater.java
new file mode 100644
index 0000000000..bde4745304
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SynchronousJpaProjectUpdater.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jpt.core.internal.IJpaProject;
+import org.eclipse.jpt.utility.internal.StringTools;
+
+/**
+ * This updater will update the JPA project immediately and not return until
+ * the update and all resulting updates are complete.
+ */
+public class SynchronousJpaProjectUpdater implements IJpaProject.Updater {
+ protected final IJpaProject jpaProject;
+ protected boolean updating;
+ protected boolean again;
+
+ protected static final IProgressMonitor NULL_PROGRESS_MONITOR = new NullProgressMonitor();
+
+ public SynchronousJpaProjectUpdater(IJpaProject jpaProject) {
+ super();
+ this.jpaProject = jpaProject;
+ this.updating = false;
+ this.again = false;
+ }
+
+ public void update() {
+ if (this.updating) {
+ // recursion: we get here when IJpaProject#update() is called during the "update"
+ this.again = true;
+ } else {
+ this.updating = true;
+ do {
+ this.again = false;
+ this.jpaProject.update(NULL_PROGRESS_MONITOR);
+ } while (this.again);
+ this.updating = false;
+ }
+ }
+
+ public void dispose() {
+ // nothing to do
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.jpaProject);
+ }
+
+}
+
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaAttributeMapping.java
deleted file mode 100644
index 5b2f5cae3b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaAttributeMapping.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.utility.internal.Filter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJava Attribute Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getIJavaAttributeMapping()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IJavaAttributeMapping extends IAttributeMapping
-{
- void updateFromJava(CompilationUnit astRoot);
-
- /**
- * Refresh defaults using the given DefaultsContext
- */
- void refreshDefaults(DefaultsContext defaultsContext);
-
- Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaContentNodes.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaContentNodes.java
deleted file mode 100644
index 21ec42e486..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaContentNodes.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java;
-
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-
-public interface IJavaContentNodes
-{
- public static final String COMPILATION_UNIT_ID =
- JptCorePlugin.PLUGIN_ID + ".java.compilationUnit";
-
- public static final String PERSISTENT_TYPE_ID =
- JptCorePlugin.PLUGIN_ID + ".java.persistentType";
-
- public static final String PERSISTENT_ATTRIBUTE_ID =
- JptCorePlugin.PLUGIN_ID + ".java.persistentAttribute";
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaTypeMapping.java
deleted file mode 100644
index 8b99b4fcb6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaTypeMapping.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.utility.internal.Filter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJava Type Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getIJavaTypeMapping()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IJavaTypeMapping extends ITypeMapping
-{
- void updateFromJava(CompilationUnit astRoot);
-
- /**
- * Return the candidate code-completion values for the specified position
- * in the source code.
- */
- Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot);
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaEObject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaEObject.java
deleted file mode 100644
index 40d2a24cd5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaEObject.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java;
-
-import java.util.Iterator;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IJpaRootContentNode;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.JpaEObject;
-import org.eclipse.jpt.utility.internal.Filter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java EObject</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJavaEObject()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class JavaEObject extends JpaEObject
- implements IJpaSourceObject
-{
- protected JavaEObject() {
- super();
- this.eAdapters().add(this.buildListener());
- }
-
- protected Adapter buildListener() {
- return new AdapterImpl() {
- @Override
- public void notifyChanged(Notification notification) {
- JavaEObject.this.notifyChanged(notification);
- }
- };
- }
-
- protected void notifyChanged(Notification notification) {
- // do nothing by default
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaPackage.Literals.JAVA_EOBJECT;
- }
-
- public IJpaFile getJpaFile() {
- return this.getRoot().getJpaFile();
- }
-
- public IJpaRootContentNode getRoot() {
- return ((JavaEObject) this.eContainer()).getRoot();
- }
-
- @Override
- public IResource getResource() {
- return this.getJpaFile().getResource();
- }
-
- /**
- * All features are "insiginificant". We do a resynch of our java model
- * when it gets notification from the jdt java model. We had problems
- * with the java model being in a bad state while doing our resynch.
- */
- @Override
- protected boolean featureIsInsignificant(int featureId) {
- return true;
- }
-
- /**
- * Convenience method. If the specified element text range is null
- * return the Java object's text range instead (which is usually the
- * annotation's text range).
- */
- protected ITextRange elementTextRange(ITextRange elementTextRange) {
- return (elementTextRange != null) ? elementTextRange : this.validationTextRange();
- }
-
- // TODO better name?
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- if (this.isConnected()) {
- Iterator<String> result = this.connectedCandidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * This method is called if the database is connected, allowing us to
- * get candidates from the various database tables etc.
- * This method should NOT be cascaded to "child" objects; it should
- * only return candidates for the current object. The cascading is
- * handled by #candidateValuesFor(int, Filter, CompilationUnit).
- */
- public Iterator<String> connectedCandidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- return null;
- }
-
- /**
- * Convenience method. Return whether element's text range is not
- * null (meaning the element exists) and the specified position touches it.
- */
- protected boolean elementTouches(ITextRange elementTextRange, int pos) {
- return (elementTextRange != null) && elementTextRange.touches(pos);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaJpaFileContentProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaJpaFileContentProvider.java
deleted file mode 100644
index a50fe76ecc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaJpaFileContentProvider.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java;
-
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IJpaFileContentProvider;
-import org.eclipse.jpt.core.internal.IJpaRootContentNode;
-
-public class JavaJpaFileContentProvider implements IJpaFileContentProvider
-{
- //singleton
- private static final JavaJpaFileContentProvider INSTANCE = new JavaJpaFileContentProvider();
-
- /**
- * Return the singleton.
- */
- public static IJpaFileContentProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Restrict access
- */
- private JavaJpaFileContentProvider() {
- super();
- }
-
- public IJpaRootContentNode buildRootContent(IJpaFile jpaFile) {
- JpaCompilationUnit content = JpaJavaFactory.eINSTANCE.createJpaCompilationUnit();
- jpaFile.setContent(content);
- content.setFile(jpaFile.getFile());
- return content;
- }
-
- public String contentType() {
- return JavaCore.JAVA_SOURCE_CONTENT_TYPE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaPersistentAttribute.java
deleted file mode 100644
index 25596bfe79..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaPersistentAttribute.java
+++ /dev/null
@@ -1,599 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaNullAttributeMappingProvider;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.utility.internal.Filter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Persistent Attribute</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute#getDefaultMapping <em>Default Mapping</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute#getSpecifiedMapping <em>Specified Mapping</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJavaPersistentAttribute()
- * @model kind="class"
- * @generated
- */
-public class JavaPersistentAttribute extends JavaEObject
- implements IPersistentAttribute
-{
- /**
- * The cached value of the '{@link #getDefaultMapping() <em>Default Mapping</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultMapping()
- * @generated
- * @ordered
- */
- protected IJavaAttributeMapping defaultMapping;
-
- /**
- * The cached value of the '{@link #getSpecifiedMapping() <em>Specified Mapping</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedMapping()
- * @generated
- * @ordered
- */
- protected IJavaAttributeMapping specifiedMapping;
-
- private Attribute attribute;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected JavaPersistentAttribute() {
- super();
- }
-
- protected JavaPersistentAttribute(Attribute attribute) {
- super();
- this.attribute = attribute;
- //no access to the jpaFactory() in the constructor because the parent is not set yet
- this.setDefaultMapping(this.nullAttributeMappingProvider().buildMapping(this.attribute, null));
- }
-
- private Iterator<IJavaAttributeMappingProvider> attributeMappingProviders() {
- return jpaPlatform().javaAttributeMappingProviders();
- }
-
- private ListIterator<IDefaultJavaAttributeMappingProvider> defaultAttributeMappingProviders() {
- return jpaPlatform().defaultJavaAttributeMappingProviders();
- }
-
- /**
- * the "null" attribute mapping is used when the attribute is neither
- * modified with a mapping annotation nor mapped by a "default" mapping
- */
- protected IJavaAttributeMappingProvider nullAttributeMappingProvider() {
- return JavaNullAttributeMappingProvider.instance();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaPackage.Literals.JAVA_PERSISTENT_ATTRIBUTE;
- }
-
- /**
- * Returns the value of the '<em><b>Default Mapping</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Mapping</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Mapping</em>' containment reference.
- * @see #setDefaultMapping(IJavaAttributeMapping)
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJavaPersistentAttribute_DefaultMapping()
- * @model containment="true" required="true"
- * @generated
- */
- public IJavaAttributeMapping getDefaultMapping() {
- return defaultMapping;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetDefaultMapping(IJavaAttributeMapping newDefaultMapping, NotificationChain msgs) {
- IJavaAttributeMapping oldDefaultMapping = defaultMapping;
- defaultMapping = newDefaultMapping;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__DEFAULT_MAPPING, oldDefaultMapping, newDefaultMapping);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute#getDefaultMapping <em>Default Mapping</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Default Mapping</em>' containment reference.
- * @see #getDefaultMapping()
- * @generated
- */
- public void setDefaultMappingGen(IJavaAttributeMapping newDefaultMapping) {
- if (newDefaultMapping != defaultMapping) {
- NotificationChain msgs = null;
- if (defaultMapping != null)
- msgs = ((InternalEObject) defaultMapping).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__DEFAULT_MAPPING, null, msgs);
- if (newDefaultMapping != null)
- msgs = ((InternalEObject) newDefaultMapping).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__DEFAULT_MAPPING, null, msgs);
- msgs = basicSetDefaultMapping(newDefaultMapping, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__DEFAULT_MAPPING, newDefaultMapping, newDefaultMapping));
- }
-
- /**
- * clients do not set the "default" mapping
- */
- private void setDefaultMapping(IJavaAttributeMapping defaultMapping) {
- this.setDefaultMappingGen(defaultMapping);
- }
-
- /**
- * Returns the value of the '<em><b>Specified Mapping</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Mapping</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Mapping</em>' containment reference.
- * @see #setSpecifiedMapping(IJavaAttributeMapping)
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJavaPersistentAttribute_SpecifiedMapping()
- * @model containment="true" required="true"
- * @generated
- */
- public IJavaAttributeMapping getSpecifiedMapping() {
- return specifiedMapping;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetSpecifiedMapping(IJavaAttributeMapping newSpecifiedMapping, NotificationChain msgs) {
- IJavaAttributeMapping oldSpecifiedMapping = specifiedMapping;
- specifiedMapping = newSpecifiedMapping;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__SPECIFIED_MAPPING, oldSpecifiedMapping, newSpecifiedMapping);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute#getSpecifiedMapping <em>Specified Mapping</em>}' containment reference.
- * <!-- begin-user-doc -->
- * clients do not set the "specified" mapping directly;
- * call #setMappingKey(String, boolean) instead
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Mapping</em>' containment reference.
- * @see #getSpecifiedMapping()
- * @generated
- */
- public void setSpecifiedMappingGen(IJavaAttributeMapping newSpecifiedMapping) {
- if (newSpecifiedMapping != specifiedMapping) {
- NotificationChain msgs = null;
- if (specifiedMapping != null)
- msgs = ((InternalEObject) specifiedMapping).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__SPECIFIED_MAPPING, null, msgs);
- if (newSpecifiedMapping != null)
- msgs = ((InternalEObject) newSpecifiedMapping).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__SPECIFIED_MAPPING, null, msgs);
- msgs = basicSetSpecifiedMapping(newSpecifiedMapping, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__SPECIFIED_MAPPING, newSpecifiedMapping, newSpecifiedMapping));
- }
-
- /**
- * clients do not set the "specified" mapping;
- * use #setMappingKey(String)
- */
- private void setSpecifiedMapping(IJavaAttributeMapping specifiedMapping) {
- this.setSpecifiedMappingGen(specifiedMapping);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__DEFAULT_MAPPING :
- return basicSetDefaultMapping(null, msgs);
- case JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__SPECIFIED_MAPPING :
- return basicSetSpecifiedMapping(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__MAPPING :
- return getMapping();
- case JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__DEFAULT_MAPPING :
- return getDefaultMapping();
- case JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__SPECIFIED_MAPPING :
- return getSpecifiedMapping();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__DEFAULT_MAPPING :
- setDefaultMapping((IJavaAttributeMapping) newValue);
- return;
- case JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__SPECIFIED_MAPPING :
- setSpecifiedMapping((IJavaAttributeMapping) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__DEFAULT_MAPPING :
- setDefaultMapping((IJavaAttributeMapping) null);
- return;
- case JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__SPECIFIED_MAPPING :
- setSpecifiedMapping((IJavaAttributeMapping) null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__MAPPING :
- return getMapping() != null;
- case JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__DEFAULT_MAPPING :
- return defaultMapping != null;
- case JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__SPECIFIED_MAPPING :
- return specifiedMapping != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaContentNode.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IPersistentAttribute.class) {
- switch (derivedFeatureID) {
- case JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__MAPPING :
- return JpaCorePackage.IPERSISTENT_ATTRIBUTE__MAPPING;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaContentNode.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IPersistentAttribute.class) {
- switch (baseFeatureID) {
- case JpaCorePackage.IPERSISTENT_ATTRIBUTE__MAPPING :
- return JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__MAPPING;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- public IPersistentType getPersistentType() {
- return (IPersistentType) this.eContainer();
- }
-
- public IJavaAttributeMapping getMapping() {
- return (this.specifiedMapping != null) ? this.specifiedMapping : this.defaultMapping;
- }
-
- public String getName() {
- return this.attribute.attributeName();
- }
-
- public ITypeMapping typeMapping() {
- return this.getPersistentType().getMapping();
- }
-
- public String mappingKey() {
- return this.getMapping().getKey();
- }
-
- /**
- * return null if there is no "default" mapping for the attribute
- */
- public String defaultMappingKey() {
- return this.defaultMapping.getKey();
- }
-
- /**
- * return null if there is no "specified" mapping for the attribute
- */
- public String specifiedMappingKey() {
- return (this.specifiedMapping == null) ? null : this.specifiedMapping.getKey();
- }
-
- // TODO support morphing mappings, i.e. copying common settings over
- // to the new mapping; this can't be done in the same was as XmlAttributeMapping
- // since we don't know all the possible mapping types
- public void setSpecifiedMappingKey(String newKey) {
- String oldKey = this.specifiedMappingKey();
- if (newKey == oldKey) {
- return;
- }
- IJavaAttributeMapping old = this.getMapping();
- if (newKey == null) {
- // remove mapping annotation
- this.setSpecifiedMapping(null);
- this.attribute.removeAnnotation(this.declarationAnnotationAdapterForAttributeMappingKey(oldKey));
- }
- else {
- // add or replace mapping annotation
- this.setSpecifiedMapping(this.attributeMappingProvider(newKey).buildMapping(this.attribute, jpaFactory()));
- if (oldKey != null) {
- this.attribute.removeAnnotation(this.declarationAnnotationAdapterForAttributeMappingKey(oldKey));
- }
- this.attribute.newMarkerAnnotation(this.declarationAnnotationAdapterForAttributeMappingKey(newKey));
- this.specifiedMapping.updateFromJava(getAttribute().astRoot());
- }
- if (this.eNotificationRequired()) {
- this.eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__MAPPING, old, this.getMapping()));
- }
- }
-
- private DeclarationAnnotationAdapter declarationAnnotationAdapterForAttributeMappingKey(String attributeMappingKey) {
- return this.attributeMappingProvider(attributeMappingKey).declarationAnnotationAdapter();
- }
-
- /**
- * throw an exception if the provider is not found
- */
- private IJavaAttributeMappingProvider attributeMappingProvider(String attributeMappingKey) {
- return jpaPlatform().javaAttributeMappingProvider(attributeMappingKey);
- }
-
- public Object getId() {
- return IJavaContentNodes.PERSISTENT_ATTRIBUTE_ID;
- }
-
- public Attribute getAttribute() {
- return this.attribute;
- }
-
- public boolean includes(int offset) {
- ITextRange fullTextRange = this.fullTextRange();
- if (fullTextRange == null) {
- //This happens if the attribute no longer exists in the java.
- //The text selection event is fired before the update from java so our
- //model has not yet had a chance to update appropriately. The list of
- //JavaPersistentAttriubtes is stale at this point. For now, we are trying
- //to avoid the NPE, not sure of the ultimate solution to these 2 threads accessing
- //our model
- return false;
- }
- return fullTextRange.includes(offset);
- }
-
- public ITextRange fullTextRange() {
- return this.attribute.textRange();
- }
-
- public ITextRange validationTextRange() {
- return this.selectionTextRange();
- }
-
- public ITextRange selectionTextRange() {
- return this.attribute.nameTextRange();
- }
-
- public boolean isFor(IMember member) {
- return this.attribute.wraps(member);
- }
-
- public void updateFromJava(CompilationUnit astRoot) {
- // synchronize the "specified" mapping with the Java source
- String jpaKey = this.specifiedMappingKey();
- IJavaAttributeMappingProvider javaProvider = this.javaAttributeMappingProvider(astRoot);
- String javaKey = ((javaProvider == null) ? null : javaProvider.key());
- if (javaKey != jpaKey) {
- IJavaAttributeMapping old = this.getMapping();
- if (javaKey == null) {
- // no mapping annotation found in Java source
- this.setSpecifiedMapping(null);
- }
- else {
- // the mapping has changed
- this.setSpecifiedMapping(javaProvider.buildMapping(this.attribute, jpaFactory()));
- }
- if (this.eNotificationRequired()) {
- this.eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__MAPPING, old, this.getMapping()));
- }
- }
- // once the "specified" mapping is in place, update it from Java;
- // unless it is null, in which case we update the "default" mapping from Java
- this.getMapping().updateFromJava(astRoot);
- }
-
- /**
- * return null if we can't find a mapping annotation on the attribute
- */
- private IJavaAttributeMappingProvider javaAttributeMappingProvider(CompilationUnit astRoot) {
- for (Iterator<IJavaAttributeMappingProvider> i = this.attributeMappingProviders(); i.hasNext();) {
- IJavaAttributeMappingProvider provider = i.next();
- if (this.attribute.containsAnnotation(provider.declarationAnnotationAdapter(), astRoot)) {
- return provider;
- }
- }
- return null;
- }
-
- public String primaryKeyColumnName() {
- IJavaAttributeMapping mapping = this.getMapping();
- return (mapping == null) ? null : mapping.primaryKeyColumnName();
- }
-
- /**
- * the mapping might be "default", but it still might be a "null" mapping...
- */
- public boolean mappingIsDefault() {
- return this.specifiedMapping == null;
- }
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return this.getMapping().candidateValuesFor(pos, filter, astRoot);
- }
-
- /**
- * check to see whether the "default" mapping has changed
- */
- public void refreshDefaults(DefaultsContext defaultsContext) {
- IJavaAttributeMappingProvider defaultProvider = this.defaultAttributeMappingProvider(defaultsContext);
- if (defaultProvider.key() == this.defaultMapping.getKey()) {
- return;
- }
- // the "default" mapping has changed
- IJavaAttributeMapping old = this.getMapping();
- this.setDefaultMapping(defaultProvider.buildMapping(this.attribute, jpaFactory()));
- this.defaultMapping.updateFromJava(defaultsContext.astRoot());
- if (this.eNotificationRequired()) {
- this.eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE__MAPPING, old, this.getMapping()));
- }
- }
-
- /**
- * return the first(?) provider that can supply a "default" mapping for the attribute;
- * return the null provider if we can't find a provider
- */
- private IJavaAttributeMappingProvider defaultAttributeMappingProvider(DefaultsContext defaultsContext) {
- for (Iterator<IDefaultJavaAttributeMappingProvider> i = this.defaultAttributeMappingProviders(); i.hasNext();) {
- IDefaultJavaAttributeMappingProvider provider = i.next();
- if (provider.defaultApplies(this.attribute, defaultsContext)) {
- return provider;
- }
- }
- return this.nullAttributeMappingProvider();
- }
-
- public boolean isOverridableAttribute() {
- return this.getMapping().isOverridableAttributeMapping();
- }
-
- public boolean isOverridableAssociation() {
- return this.getMapping().isOverridableAssociationMapping();
- }
-
- public boolean isIdAttribute() {
- return this.getMapping().isIdMapping();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaPersistentType.java
deleted file mode 100644
index eca26005c7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JavaPersistentType.java
+++ /dev/null
@@ -1,915 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jpt.core.internal.AccessType;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaAssociationOverride;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeOverride;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaColumn;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbedded;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddedId;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaGeneratedValue;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaId;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinColumn;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinTable;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToMany;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToOne;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaNullTypeMappingProvider;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToMany;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToOne;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaSequenceGenerator;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaTransient;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaVersion;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.AttributeAnnotationTools;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.FieldAttribute;
-import org.eclipse.jpt.core.internal.jdtutility.MethodAttribute;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.utility.internal.CommandExecutorProvider;
-import org.eclipse.jpt.utility.internal.Filter;
-import org.eclipse.jpt.utility.internal.iterators.ChainIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Type</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentType#getMapping <em>Mapping</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentType#getAttributes <em>Attributes</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentType#getAccess <em>Access</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJavaPersistentType()
- * @model kind="class"
- * @generated
- */
-public class JavaPersistentType extends JavaEObject implements IPersistentType
-{
- /**
- * The default value of the '{@link #getMappingKey() <em>Mapping Key</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMappingKey()
- * @generated
- * @ordered
- */
- protected static final String MAPPING_KEY_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getMappingKey() <em>Mapping Key</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMappingKey()
- * @generated
- * @ordered
- */
- protected String mappingKey = MAPPING_KEY_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getMapping() <em>Mapping</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMapping()
- * @generated
- * @ordered
- */
- protected IJavaTypeMapping mapping;
-
- /**
- * The cached value of the '{@link #getAttributes() <em>Attributes</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getAttributes()
- * @generated
- * @ordered
- */
- protected EList<JavaPersistentAttribute> attributes;
-
- /**
- * The default value of the '{@link #getAccess() <em>Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getAccess()
- * @generated
- * @ordered
- */
- protected static final AccessType ACCESS_EDEFAULT = AccessType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getAccess() <em>Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getAccess()
- * @generated
- * @ordered
- */
- protected AccessType access = ACCESS_EDEFAULT;
-
- private Type type;
-
- private DeclarationAnnotationAdapter[] attributeMappingAnnotationAdapters;
-
- /**
- * Store the parentPersistentType during default calculation. This will
- * be the first persisentType found in the hierarchy, the JPA spec allows
- * for non-persistent types to be part of the hierarchy.
- * Example:
- *
- * @Entity public abstract class Model {}
- *
- * public abstract class Animal extends Model {}
- *
- * @Entity public class Cat extends Animal {}
- *
- * If this is the Cat JavaPersistentType then parentPersistentType is the Model JavaPersistentType
- * The parentPersistentType could be found in java or xml.
- */
- private IPersistentType parentPersistentType;
-
- protected JavaPersistentType() {
- throw new UnsupportedOperationException();
- }
-
- protected JavaPersistentType(Type type) {
- super();
- this.type = type;
- this.attributeMappingAnnotationAdapters = this.buildAttributeMappingAnnotationAdapters();
- this.setMappingGen(this.nullTypeMappingProvider().buildMapping(this.type, null));
- }
-
- private DeclarationAnnotationAdapter[] buildAttributeMappingAnnotationAdapters() {
- ArrayList<DeclarationAnnotationAdapter> adapters = new ArrayList<DeclarationAnnotationAdapter>();
- this.addAttributeMappingAnnotationAdaptersTo(adapters);
- return adapters.toArray(new DeclarationAnnotationAdapter[adapters.size()]);
- }
-
- /**
- * Override this to specify more or different attribute mapping annotation
- * adapters. The default includes the JPA spec-defined attribute mapping
- * annotations.
- */
- protected void addAttributeMappingAnnotationAdaptersTo(Collection<DeclarationAnnotationAdapter> adapters) {
- adapters.add(JavaAssociationOverride.SINGLE_DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaAssociationOverride.MULTIPLE_DECLARATION_ANNOTATION_ADAPTER); // AssociationOverrides
- adapters.add(JavaAttributeOverride.SINGLE_DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaAttributeOverride.MULTIPLE_DECLARATION_ANNOTATION_ADAPTER); // AttributeOverrides
- adapters.add(JavaBasic.DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaColumn.MAPPING_DECLARATION_ANNOTATION_ADAPTER); // standalone Column
- adapters.add(JavaEmbedded.DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaEmbeddedId.DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaBasic.ENUMERATED_ADAPTER);
- adapters.add(JavaGeneratedValue.DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaId.DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaJoinColumn.SINGLE_DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaJoinColumn.MULTIPLE_DECLARATION_ANNOTATION_ADAPTER); // JoinColumns
- adapters.add(JavaJoinTable.DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaBasic.LOB_ADAPTER);
- adapters.add(JavaManyToMany.DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaManyToOne.DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaMultiRelationshipMapping.ORDER_BY_ADAPTER);
- adapters.add(JavaMultiRelationshipMapping.MAP_KEY_ADAPTER);
- adapters.add(JavaOneToMany.DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaOneToOne.DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaPrimaryKeyJoinColumn.MULTIPLE_DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaPrimaryKeyJoinColumn.SINGLE_DECLARATION_ANNOTATION_ADAPTER); // PrimaryKeyJoinColumns
- adapters.add(JavaSequenceGenerator.DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaTableGenerator.DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaBasic.TEMPORAL_ADAPTER);
- adapters.add(JavaTransient.DECLARATION_ANNOTATION_ADAPTER);
- adapters.add(JavaVersion.DECLARATION_ANNOTATION_ADAPTER);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaPackage.Literals.JAVA_PERSISTENT_TYPE;
- }
-
- /**
- * Returns the value of the '<em><b>Mapping Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Mapping Key</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Mapping Key</em>' attribute.
- * @see #setMappingKey(String)
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getIPersistentType_MappingKey()
- * @model required="true"
- * @generated
- */
- public String getMappingKey() {
- return mappingKey;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentType#getMappingKey <em>Mapping Key</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Mapping Key</em>' attribute.
- * @see #getMappingKey()
- * @generated
- */
- public void setMappingKeyGen(String newMappingKey) {
- String oldMappingKey = mappingKey;
- mappingKey = newMappingKey;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaPackage.JAVA_PERSISTENT_TYPE__MAPPING_KEY, oldMappingKey, mappingKey));
- }
-
- /**
- * This is called by the UI, it should not be called when updating
- * the persistence model from the java model.
- */
- public void setMappingKey(String newMappingKey) {
- if (newMappingKey == this.mappingKey) {
- return;
- }
- setMapping(buildJavaTypeMapping(newMappingKey));
- setMappingKeyGen(newMappingKey);
- }
-
- /**
- * Returns the value of the '<em><b>Mapping</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Mapping</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Mapping</em>' containment reference.
- * @see #setMapping(IJavaTypeMapping)
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJavaPersistentType_Mapping()
- * @model containment="true" required="true"
- * @generated
- */
- public IJavaTypeMapping getMapping() {
- return mapping;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetMapping(IJavaTypeMapping newMapping, NotificationChain msgs) {
- IJavaTypeMapping oldMapping = mapping;
- mapping = newMapping;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaPackage.JAVA_PERSISTENT_TYPE__MAPPING, oldMapping, newMapping);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentType#getMapping <em>Mapping</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Mapping</em>' containment reference.
- * @see #getMapping()
- * @generated
- */
- public void setMappingGen(IJavaTypeMapping newMapping) {
- if (newMapping != mapping) {
- NotificationChain msgs = null;
- if (mapping != null)
- msgs = ((InternalEObject) mapping).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JpaJavaPackage.JAVA_PERSISTENT_TYPE__MAPPING, null, msgs);
- if (newMapping != null)
- msgs = ((InternalEObject) newMapping).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaPackage.JAVA_PERSISTENT_TYPE__MAPPING, null, msgs);
- msgs = basicSetMapping(newMapping, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaPackage.JAVA_PERSISTENT_TYPE__MAPPING, newMapping, newMapping));
- }
-
- /**
- * This should not be called when updating the persistence model
- * from the java model, it should only be called when going in the
- * other direction. This will update the java code appropriately
- * to the change in mapping in the persistence model.
- */
- public void setMapping(IJavaTypeMapping newMapping) {
- this.type.removeAnnotation(this.annotationAdapterForTypeMappingKey(this.mapping.getKey()));
- this.type.newMarkerAnnotation(this.annotationAdapterForTypeMappingKey(newMapping.getKey()));
- this.setMappingGen(newMapping);
- }
-
- private DeclarationAnnotationAdapter annotationAdapterForTypeMappingKey(String typeMappingKey) {
- return this.typeMappingProvider(typeMappingKey).declarationAnnotationAdapter();
- }
-
- protected Iterator<IJavaTypeMappingProvider> typeMappingProviders() {
- return jpaPlatform().javaTypeMappingProviders();
- }
-
- private IJavaTypeMappingProvider typeMappingProvider(String typeMappingKey) {
- IJavaTypeMappingProvider javaTypeMappingProvider = jpaPlatform().javaTypeMappingProvider(typeMappingKey);
- if (javaTypeMappingProvider == null) {
- javaTypeMappingProvider = nullTypeMappingProvider();
- }
- return javaTypeMappingProvider;
- }
-
- /**
- * the "null" type mapping is used when the types is not modified
- * by a mapping annotation
- */
- protected IJavaTypeMappingProvider nullTypeMappingProvider() {
- return JavaNullTypeMappingProvider.instance();
- }
-
- /**
- * Returns the value of the '<em><b>Attributes</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Attributes</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Attributes</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJavaPersistentType_Attributes()
- * @model containment="true"
- * @generated
- */
- public EList<JavaPersistentAttribute> getAttributes() {
- if (attributes == null) {
- attributes = new EObjectContainmentEList<JavaPersistentAttribute>(JavaPersistentAttribute.class, this, JpaJavaPackage.JAVA_PERSISTENT_TYPE__ATTRIBUTES);
- }
- return attributes;
- }
-
- /**
- * Returns the value of the '<em><b>Access</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.AccessType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Access</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Access</em>' attribute.
- * @see org.eclipse.jpt.core.internal.AccessType
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJavaPersistentType_Access()
- * @model changeable="false"
- * @generated
- */
- public AccessType getAccess() {
- return access;
- }
-
- private void setAccess(AccessType newAccess) {
- AccessType oldAccess = access;
- access = newAccess == null ? ACCESS_EDEFAULT : newAccess;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaPackage.JAVA_PERSISTENT_TYPE__ACCESS, oldAccess, access));
- }
-
- /* @see IJpaContentNode#getId() */
- public Object getId() {
- return IJavaContentNodes.PERSISTENT_TYPE_ID;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__MAPPING :
- return basicSetMapping(null, msgs);
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__ATTRIBUTES :
- return ((InternalEList<?>) getAttributes()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__MAPPING_KEY :
- return getMappingKey();
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__MAPPING :
- return getMapping();
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__ATTRIBUTES :
- return getAttributes();
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__ACCESS :
- return getAccess();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__MAPPING_KEY :
- setMappingKey((String) newValue);
- return;
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__MAPPING :
- setMapping((IJavaTypeMapping) newValue);
- return;
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__ATTRIBUTES :
- getAttributes().clear();
- getAttributes().addAll((Collection<? extends JavaPersistentAttribute>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__MAPPING_KEY :
- setMappingKey(MAPPING_KEY_EDEFAULT);
- return;
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__MAPPING :
- setMapping((IJavaTypeMapping) null);
- return;
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__ATTRIBUTES :
- getAttributes().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__MAPPING_KEY :
- return MAPPING_KEY_EDEFAULT == null ? mappingKey != null : !MAPPING_KEY_EDEFAULT.equals(mappingKey);
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__MAPPING :
- return mapping != null;
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__ATTRIBUTES :
- return attributes != null && !attributes.isEmpty();
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__ACCESS :
- return access != ACCESS_EDEFAULT;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaContentNode.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IPersistentType.class) {
- switch (derivedFeatureID) {
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__MAPPING_KEY :
- return JpaCorePackage.IPERSISTENT_TYPE__MAPPING_KEY;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaContentNode.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IPersistentType.class) {
- switch (baseFeatureID) {
- case JpaCorePackage.IPERSISTENT_TYPE__MAPPING_KEY :
- return JpaJavaPackage.JAVA_PERSISTENT_TYPE__MAPPING_KEY;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (mappingKey: ");
- result.append(mappingKey);
- result.append(", access: ");
- result.append(access);
- result.append(')');
- return result.toString();
- }
-
- /**
- * delegate to the type's project (there is one provider per project)
- */
- private CommandExecutorProvider modifySharedDocumentCommandExecutorProvider() {
- return this.getJpaProject().modifySharedDocumentCommandExecutorProvider();
- }
-
- public JavaPersistentAttribute addJavaPersistentAttribute(IMember jdtMember) {
- JavaPersistentAttribute persistentAttribute = createJavaPersistentAttribute(jdtMember);
- getAttributes().add(persistentAttribute);
- return persistentAttribute;
- }
-
- public JavaPersistentAttribute createJavaPersistentAttribute(IMember member) {
- Attribute attribute = null;
- if (member instanceof IField) {
- attribute = new FieldAttribute((IField) member, this.modifySharedDocumentCommandExecutorProvider());
- }
- else if (member instanceof IMethod) {
- attribute = new MethodAttribute((IMethod) member, this.modifySharedDocumentCommandExecutorProvider());
- }
- else {
- throw new IllegalArgumentException();
- }
- return JpaJavaFactory.eINSTANCE.createJavaPersistentAttribute(attribute);
- }
-
- private void createAndSetPersistentTypeMappingFromJava(String key) {
- setMappingGen(buildJavaTypeMapping(key));
- setMappingKeyGen(key);
- }
-
- private IJavaTypeMapping buildJavaTypeMapping(String key) {
- return this.typeMappingProvider(key).buildMapping(this.type, this.jpaFactory());
- }
-
- public Type getType() {
- return this.type;
- }
-
- public String fullyQualifiedTypeName() {
- return jdtType().getFullyQualifiedName();
- }
-
- public IType jdtType() {
- return getType().getJdtMember();
- }
-
- /**
- * This implementation of IPersistentType#findJdtType() will
- * *always* find its type
- */
- public IType findJdtType() {
- return jdtType();
- }
-
- public boolean isFor(IType member) {
- return this.type.wraps(member);
- }
-
- protected void updateFromJava(CompilationUnit astRoot) {
- this.setAccess(this.javaAccessType(astRoot));
- String jpaKey = this.getMapping().getKey();
- String javaKey = this.javaTypeMappingKey(astRoot);
- if (jpaKey != javaKey) {
- this.createAndSetPersistentTypeMappingFromJava(javaKey);
- }
- this.getMapping().updateFromJava(astRoot);
- this.updatePersistentAttributes(astRoot);
- }
-
- private void updatePersistentAttributes(CompilationUnit astRoot) {
- List<JavaPersistentAttribute> persistentAttributesToRemove = new ArrayList<JavaPersistentAttribute>(getAttributes());
- if (getAccess() == AccessType.FIELD) {
- updatePersistentFields(astRoot, persistentAttributesToRemove);
- }
- else if (getAccess() == AccessType.PROPERTY) {
- updatePersistentProperties(astRoot, persistentAttributesToRemove);
- }
- getAttributes().removeAll(persistentAttributesToRemove);
- }
-
- private void updatePersistentFields(CompilationUnit astRoot, List<JavaPersistentAttribute> persistentAttributesToRemove) {
- updatePersistentAttributes(astRoot, persistentAttributesToRemove, this.jdtPersistableFields());
- }
-
- private void updatePersistentProperties(CompilationUnit astRoot, List<JavaPersistentAttribute> persistentAttributesToRemove) {
- updatePersistentAttributes(astRoot, persistentAttributesToRemove, this.jdtPersistableProperties());
- }
-
- private void updatePersistentAttributes(CompilationUnit astRoot, List<JavaPersistentAttribute> persistentAttributesToRemove, IMember[] members) {
- for (IMember member : members) {
- JavaPersistentAttribute persistentAttribute = persistentAttributeFor(member);
- if (persistentAttribute == null) {
- persistentAttribute = addJavaPersistentAttribute(member);
- }
- else {
- persistentAttributesToRemove.remove(persistentAttribute);
- }
- persistentAttribute.updateFromJava(astRoot);
- }
- }
-
- private IField[] jdtPersistableFields() {
- return AttributeAnnotationTools.persistableFields(jdtType());
- }
-
- private IMethod[] jdtPersistableProperties() {
- return AttributeAnnotationTools.persistablePropertyGetters(jdtType());
- }
-
- private String javaTypeMappingKey(CompilationUnit astRoot) {
- for (Iterator<IJavaTypeMappingProvider> i = this.typeMappingProviders(); i.hasNext();) {
- IJavaTypeMappingProvider provider = i.next();
- if (this.type.containsAnnotation(provider.declarationAnnotationAdapter(), astRoot)) {
- return provider.key();
- }
- }
- return null;
- }
-
- protected Iterator<JavaPersistentAttribute> attributesNamed(final String attributeName) {
- return new FilteringIterator<JavaPersistentAttribute>(attributes()) {
- @Override
- protected boolean accept(Object o) {
- return attributeName.equals(((JavaPersistentAttribute) o).getName());
- }
- };
- }
-
- public JavaPersistentAttribute attributeNamed(String attributeName) {
- Iterator<JavaPersistentAttribute> stream = attributesNamed(attributeName);
- return (stream.hasNext()) ? stream.next() : null;
- }
-
- public IPersistentAttribute resolveAttribute(String attributeName) {
- Iterator<JavaPersistentAttribute> stream = attributesNamed(attributeName);
- if (stream.hasNext()) {
- JavaPersistentAttribute attribute = stream.next();
- return (stream.hasNext()) ? null /*more than one*/: attribute;
- }
- return (parentPersistentType() == null) ? null : parentPersistentType().resolveAttribute(attributeName);
- }
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- Iterator<String> values = this.mapping.candidateValuesFor(pos, filter, astRoot);
- if (values != null) {
- return values;
- }
- for (Iterator<JavaPersistentAttribute> stream = attributes(); stream.hasNext();) {
- values = stream.next().candidateValuesFor(pos, filter, astRoot);
- if (values != null) {
- return values;
- }
- }
- return null;
- }
-
- public IJpaContentNode contentNodeAt(int offset) {
- for (Iterator<JavaPersistentAttribute> i = attributes(); i.hasNext();) {
- JavaPersistentAttribute persistentAttribute = i.next();
- if (persistentAttribute.includes(offset)) {
- return persistentAttribute;
- }
- }
- return null;
- }
-
- public boolean includes(int offset) {
- ITextRange fullTextRange = this.fullTextRange();
- if (fullTextRange == null) {
- //This happens if the type no longer exists in the java (rename in editor).
- //The text selection event is fired before the update from java so our
- //model has not yet had a chance to update appropriately. For now, avoid the NPE,
- //not sure of the ultimate solution to these 2 threads accessing our model
- return false;
- }
- return fullTextRange.includes(offset);
- }
-
- public ITextRange fullTextRange() {
- return this.type.textRange();
- }
-
- public ITextRange validationTextRange() {
- return this.selectionTextRange();
- }
-
- public ITextRange selectionTextRange() {
- return this.type.nameTextRange();
- }
-
- public ITextRange getTextRange() {
- return type.textRange();
- }
-
- private JavaPersistentAttribute persistentAttributeFor(IMember member) {
- for (Iterator<JavaPersistentAttribute> i = attributes(); i.hasNext();) {
- JavaPersistentAttribute attribute = i.next();
- if (attribute.isFor(member)) {
- return attribute;
- }
- }
- return null;
- }
-
- public Iterator<JavaPersistentAttribute> attributes() {
- return new CloneIterator<JavaPersistentAttribute>(getAttributes());
- }
-
- public Iterator<String> attributeNames() {
- return this.attributeNames(this.attributes());
- }
-
- private Iterator<String> attributeNames(Iterator<? extends IPersistentAttribute> attrs) {
- return new TransformationIterator<IPersistentAttribute, String>(attrs) {
- @Override
- protected String transform(IPersistentAttribute attribute) {
- return attribute.getName();
- }
- };
- }
-
- public Iterator<IPersistentAttribute> allAttributes() {
- return new CompositeIterator<IPersistentAttribute>(new TransformationIterator<IPersistentType, Iterator<IPersistentAttribute>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<IPersistentAttribute> transform(IPersistentType pt) {
- //TODO how to remove this warning?
- return (Iterator<IPersistentAttribute>) pt.attributes();
- }
- });
- }
-
- public Iterator<String> allAttributeNames() {
- return this.attributeNames(this.allAttributes());
- }
-
- public Iterator<IPersistentType> inheritanceHierarchy() {
- // using a chain iterator to traverse up the inheritance tree
- return new ChainIterator<IPersistentType>(this) {
- @Override
- protected IPersistentType nextLink(IPersistentType pt) {
- return pt.parentPersistentType();
- }
- };
- }
-
- public IPersistentType parentPersistentType() {
- return this.parentPersistentType;
- }
-
- /**
- * Return the AccessType currently implied by the Java source code:
- * - if only Fields are annotated => FIELD
- * - if only Properties are annotated => PROPERTY
- * - if both Fields and Properties are annotated => FIELD
- * - if nothing is annotated
- * - and fields exist => FIELD
- * - and properties exist, but no fields exist => PROPERTY
- * - and neither fields nor properties exist => FIELD
- */
- private AccessType javaAccessType(CompilationUnit astRoot) {
- IType jdtType = this.jdtType();
- boolean hasPersistableFields = false;
- boolean hasPersistableProperties = false;
- for (IField field : AttributeAnnotationTools.persistableFields(jdtType)) {
- hasPersistableFields = true;
- FieldAttribute fa = new FieldAttribute(field, null); // a bit hacky...
- if (fa.containsAnyAnnotation(this.attributeMappingAnnotationAdapters, astRoot)) {
- // any field is annotated => FIELD
- return AccessType.FIELD;
- }
- }
- for (IMethod method : AttributeAnnotationTools.persistablePropertyGetters(jdtType)) {
- hasPersistableProperties = true;
- MethodAttribute ma = new MethodAttribute(method, null); // a bit hacky...
- if (ma.containsAnyAnnotation(this.attributeMappingAnnotationAdapters, astRoot)) {
- // none of the fields are annotated and a getter is annotated => PROPERTY
- return AccessType.PROPERTY;
- }
- }
- // no annotations exist - default to fields, unless it's *obvious* to use properties
- if (hasPersistableProperties && !hasPersistableFields) {
- return AccessType.PROPERTY;
- }
- return AccessType.FIELD;
- }
-
- public void refreshDefaults(DefaultsContext context) {
- refreshParentPersistentType(context);
- }
-
- private void refreshParentPersistentType(DefaultsContext context) {
- ITypeBinding typeBinding = getType().typeBinding(context.astRoot());
- this.parentPersistentType = parentPersistentType(context, typeBinding);
- }
-
- public static IPersistentType parentPersistentType(DefaultsContext context, ITypeBinding typeBinding) {
- if (typeBinding == null) {
- return null;
- }
- ITypeBinding superClassTypeBinding = typeBinding.getSuperclass();
- if (superClassTypeBinding == null) {
- return null;
- }
- String fullyQualifiedTypeName = superClassTypeBinding.getQualifiedName();
- IPersistentType possibleParent = context.persistentType(fullyQualifiedTypeName);
- if (possibleParent == null) {
- //TODO look to superclass
- return null;
- }
- if (possibleParent.getMappingKey() != null) {
- return possibleParent;
- }
- return possibleParent.parentPersistentType();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaCompilationUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaCompilationUnit.java
deleted file mode 100644
index 99167b12c2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaCompilationUnit.java
+++ /dev/null
@@ -1,457 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jdt.core.ElementChangedEvent;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaElementDelta;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IJpaRootContentNode;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.JpaFile;
-import org.eclipse.jpt.core.internal.jdtutility.AttributeAnnotationTools;
-import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
-import org.eclipse.jpt.utility.internal.BitTools;
-import org.eclipse.jpt.utility.internal.CommandExecutorProvider;
-import org.eclipse.jpt.utility.internal.Filter;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java File Content</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit#getTypes <em>Types</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJpaCompilationUnit()
- * @model kind="class"
- * @generated
- */
-public class JpaCompilationUnit extends JavaEObject
- implements IJpaRootContentNode
-{
- //can this just have one JavaType, or does it need to be multiple.
- //only 1 primary type that can be annotated according to the spec? - kfm
- /**
- * The cached value of the '{@link #getTypes() <em>Types</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTypes()
- * @generated
- * @ordered
- */
- protected EList<JavaPersistentType> types;
-
- private ICompilationUnit compilationUnit;
-
- protected JpaCompilationUnit() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaPackage.Literals.JPA_COMPILATION_UNIT;
- }
-
- /**
- * Returns the value of the '<em><b>Jpa File</b></em>' container reference.
- * It is bidirectional and its opposite is '{@link org.eclipse.jpt.core.internal.JpaFile#getContent <em>Content</em>}'.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Jpa File</em>' container reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Jpa File</em>' container reference.
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getIJpaRootContentNode_JpaFile()
- * @see org.eclipse.jpt.core.internal.JpaFile#getContent
- * @model opposite="content" transient="false" changeable="false"
- * @generated
- */
- @Override
- public IJpaFile getJpaFile() {
- if (eContainerFeatureID != JpaJavaPackage.JPA_COMPILATION_UNIT__JPA_FILE)
- return null;
- return (IJpaFile) eContainer();
- }
-
- /**
- * Returns the value of the '<em><b>Types</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.java.JavaPersistentType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Types</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Types</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJpaCompilationUnit_Types()
- * @model containment="true"
- * @generated
- */
- public EList<JavaPersistentType> getTypes() {
- if (types == null) {
- types = new EObjectContainmentEList<JavaPersistentType>(JavaPersistentType.class, this, JpaJavaPackage.JPA_COMPILATION_UNIT__TYPES);
- }
- return types;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaPackage.JPA_COMPILATION_UNIT__JPA_FILE :
- if (eInternalContainer() != null)
- msgs = eBasicRemoveFromContainer(msgs);
- return eBasicSetContainer(otherEnd, JpaJavaPackage.JPA_COMPILATION_UNIT__JPA_FILE, msgs);
- }
- return super.eInverseAdd(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaPackage.JPA_COMPILATION_UNIT__JPA_FILE :
- return eBasicSetContainer(null, JpaJavaPackage.JPA_COMPILATION_UNIT__JPA_FILE, msgs);
- case JpaJavaPackage.JPA_COMPILATION_UNIT__TYPES :
- return ((InternalEList<?>) getTypes()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
- switch (eContainerFeatureID) {
- case JpaJavaPackage.JPA_COMPILATION_UNIT__JPA_FILE :
- return eInternalContainer().eInverseRemove(this, JpaCorePackage.JPA_FILE__CONTENT, JpaFile.class, msgs);
- }
- return super.eBasicRemoveFromContainerFeature(msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaPackage.JPA_COMPILATION_UNIT__JPA_FILE :
- return getJpaFile();
- case JpaJavaPackage.JPA_COMPILATION_UNIT__TYPES :
- return getTypes();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaPackage.JPA_COMPILATION_UNIT__TYPES :
- getTypes().clear();
- getTypes().addAll((Collection<? extends JavaPersistentType>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaPackage.JPA_COMPILATION_UNIT__TYPES :
- getTypes().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaPackage.JPA_COMPILATION_UNIT__JPA_FILE :
- return getJpaFile() != null;
- case JpaJavaPackage.JPA_COMPILATION_UNIT__TYPES :
- return types != null && !types.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaContentNode.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IJpaRootContentNode.class) {
- switch (derivedFeatureID) {
- case JpaJavaPackage.JPA_COMPILATION_UNIT__JPA_FILE :
- return JpaCorePackage.IJPA_ROOT_CONTENT_NODE__JPA_FILE;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaContentNode.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IJpaRootContentNode.class) {
- switch (baseFeatureID) {
- case JpaCorePackage.IJPA_ROOT_CONTENT_NODE__JPA_FILE :
- return JpaJavaPackage.JPA_COMPILATION_UNIT__JPA_FILE;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- public ITextRange validationTextRange() {
- return this.selectionTextRange();
- }
-
- /**
- * Return null for selection textRange. Entire java file will appear selected when
- * switching files otherwise
- */
- public ITextRange selectionTextRange() {
- return null;
- }
-
- public Object getId() {
- return IJavaContentNodes.COMPILATION_UNIT_ID;
- }
-
- @Override
- public IJpaRootContentNode getRoot() {
- return this;
- }
-
- public void setFile(IFile file) {
- this.compilationUnit = JavaCore.createCompilationUnitFrom(file);
- try {
- this.compilationUnit.open(null);
- }
- catch (JavaModelException jme) {
- // do nothing - we just won't have a primary type in this case
- }
- this.synchronizePersistentTypes();
- }
-
- public JavaPersistentType addJavaPersistentType(IType primaryType) {
- JavaPersistentType persistentType = createJavaPersistentType(primaryType);
- getTypes().add(persistentType);
- return persistentType;
- }
-
- public JavaPersistentType createJavaPersistentType(IType primaryType) {
- Type type = new Type(primaryType, this.modifySharedDocumentCommandExecutorProvider());
- return JpaJavaFactory.eINSTANCE.createJavaPersistentType(type);
- }
-
- /**
- * delegate to the type's project (there is one provider per project)
- */
- private CommandExecutorProvider modifySharedDocumentCommandExecutorProvider() {
- return this.getJpaProject().modifySharedDocumentCommandExecutorProvider();
- }
-
- public IJpaContentNode getContentNode(int offset) {
- for (JavaPersistentType javaType : this.getTypes()) {
- if (javaType.includes(offset)) {
- IJpaContentNode contentNode = javaType.contentNodeAt(offset);
- if (contentNode != null) {
- return contentNode;
- }
- return javaType;
- }
- }
- return this;
- }
-
- public void javaElementChanged(ElementChangedEvent event) {
- this.synchWithJavaDelta(event.getDelta());
- }
-
- private void synchWithJavaDelta(IJavaElementDelta delta) {
- switch (delta.getElement().getElementType()) {
- case IJavaElement.JAVA_MODEL :
- case IJavaElement.JAVA_PROJECT :
- case IJavaElement.PACKAGE_FRAGMENT_ROOT :
- case IJavaElement.PACKAGE_FRAGMENT :
- this.synchWithJavaDelta(delta.getAffectedChildren()); // recurse
- break;
- case IJavaElement.COMPILATION_UNIT :
- this.synchCompilationUnitWithJavaDelta(delta);
- break;
- default :
- break; // the event is somehow lower than a compilation unit
- }
- }
-
- private void synchWithJavaDelta(IJavaElementDelta[] deltas) {
- for (IJavaElementDelta delta : deltas) {
- this.synchWithJavaDelta(delta); // recurse
- }
- }
-
- private void synchCompilationUnitWithJavaDelta(IJavaElementDelta delta) {
- // ignore changes to/from primary working copy - no content has changed;
- // and make sure there are no other flags set that indicate both a change to/from
- // primary working copy AND content has changed
- if (BitTools.onlyFlagIsSet(delta.getFlags(), IJavaElementDelta.F_PRIMARY_WORKING_COPY)) {
- return;
- }
- // synchronize if the change is for this compilation unit
- if (delta.getElement().equals(this.compilationUnit)) {
- this.synchronizePersistentTypes(); // ignore the delta
- }
- }
-
- private void synchronizePersistentTypes() {
- CompilationUnit astRoot = this.astRoot();
- List<JavaPersistentType> persistentTypesToRemove = new ArrayList<JavaPersistentType>(this.getTypes());
- IType[] iTypes = this.compilationUnitTypes();
- for (IType iType : iTypes) {
- JavaPersistentType persistentType = this.persistentTypeFor(iType);
- if (persistentType == null) {
- if (AttributeAnnotationTools.typeIsPersistable(iType)) {
- persistentType = this.addJavaPersistentType(iType);
- }
- }
- if (persistentType != null) {
- persistentTypesToRemove.remove(persistentType);
- if (AttributeAnnotationTools.typeIsPersistable(iType)) {
- persistentType.updateFromJava(astRoot);
- }
- else {
- this.getTypes().remove(persistentType);
- }
- }
- }
- this.getTypes().removeAll(persistentTypesToRemove);
- }
-
- private JavaPersistentType persistentTypeFor(IType iType) {
- for (JavaPersistentType persistentType : this.getTypes()) {
- if (persistentType.isFor(iType)) {
- return persistentType;
- }
- }
- return null;
- }
-
- private IType[] compilationUnitTypes() {
- try {
- return this.compilationUnit.getTypes();
- }
- catch (JavaModelException e) {
- //TODO not throwing an exception because of tests, should I be?
- //throw new RuntimeException(e);
- return new IType[0];
- }
- }
-
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter) {
- CompilationUnit astRoot = this.astRoot();
- for (JavaPersistentType persistentType : this.getTypes()) {
- Iterator<String> values = persistentType.candidateValuesFor(pos, filter, astRoot);
- if (values != null) {
- return values;
- }
- }
- return EmptyIterator.instance();
- }
-
- private CompilationUnit astRoot() {
- return JDTTools.buildASTRoot(this.compilationUnit);
- }
-
- public void dispose() {
- // TODO
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaJavaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaJavaFactory.java
deleted file mode 100644
index 1509894098..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaJavaFactory.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.impl.EFactoryImpl;
-import org.eclipse.emf.ecore.plugin.EcorePlugin;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Factory</b> for the model.
- * It provides a create method for each non-abstract class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage
- * @generated
- */
-public class JpaJavaFactory extends EFactoryImpl
-{
- /**
- * The singleton instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final JpaJavaFactory eINSTANCE = init();
-
- /**
- * Creates the default factory implementation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static JpaJavaFactory init() {
- try {
- JpaJavaFactory theJpaJavaFactory = (JpaJavaFactory) EPackage.Registry.INSTANCE.getEFactory("jpt.java.xmi");
- if (theJpaJavaFactory != null) {
- return theJpaJavaFactory;
- }
- }
- catch (Exception exception) {
- EcorePlugin.INSTANCE.log(exception);
- }
- return new JpaJavaFactory();
- }
-
- /**
- * Creates an instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaJavaFactory() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public EObject create(EClass eClass) {
- switch (eClass.getClassifierID()) {
- case JpaJavaPackage.JPA_COMPILATION_UNIT :
- return createJpaCompilationUnit();
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE :
- return createJavaPersistentType();
- case JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE :
- return createJavaPersistentAttribute();
- default :
- throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaCompilationUnit createJpaCompilationUnit() {
- JpaCompilationUnit jpaCompilationUnit = new JpaCompilationUnit();
- return jpaCompilationUnit;
- }
-
-
- public JavaPersistentType createJavaPersistentType() {
- throw new UnsupportedOperationException();
- }
-
- public JavaPersistentType createJavaPersistentType(Type type) {
- JavaPersistentType javaPersistentType = new JavaPersistentType(type);
- return javaPersistentType;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JavaPersistentAttribute createJavaPersistentAttribute() {
- JavaPersistentAttribute javaPersistentAttribute = new JavaPersistentAttribute();
- return javaPersistentAttribute;
- }
-
- public JavaPersistentAttribute createJavaPersistentAttribute(Attribute attribute) {
- JavaPersistentAttribute javaPersistentAttribute = new JavaPersistentAttribute(attribute);
- return javaPersistentAttribute;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaJavaPackage getJpaJavaPackage() {
- return (JpaJavaPackage) getEPackage();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @deprecated
- * @generated
- */
- @Deprecated
- public static JpaJavaPackage getPackage() {
- return JpaJavaPackage.eINSTANCE;
- }
-} //JpaCoreJavaFactory
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaJavaPackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaJavaPackage.java
deleted file mode 100644
index 96454e58df..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/JpaJavaPackage.java
+++ /dev/null
@@ -1,785 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.persistence.PersistencePackage;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Package</b> for the model.
- * It contains accessors for the meta objects to represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaFactory
- * @model kind="package"
- * @generated
- */
-public class JpaJavaPackage extends EPackageImpl
-{
- /**
- * The package name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNAME = "java";
-
- /**
- * The package namespace URI.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNS_URI = "jpt.java.xmi";
-
- /**
- * The package namespace name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNS_PREFIX = "org.eclipse.jpt.core.content.java";
-
- /**
- * The singleton instance of the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final JpaJavaPackage eINSTANCE = org.eclipse.jpt.core.internal.content.java.JpaJavaPackage.init();
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.JavaEObject <em>Java EObject</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.JavaEObject
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJavaEObject()
- * @generated
- */
- public static final int JAVA_EOBJECT = 0;
-
- /**
- * The number of structural features of the '<em>Java EObject</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_EOBJECT_FEATURE_COUNT = JpaCorePackage.JPA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit <em>Jpa Compilation Unit</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJpaCompilationUnit()
- * @generated
- */
- public static final int JPA_COMPILATION_UNIT = 1;
-
- /**
- * The feature id for the '<em><b>Jpa File</b></em>' container reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JPA_COMPILATION_UNIT__JPA_FILE = JAVA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Types</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JPA_COMPILATION_UNIT__TYPES = JAVA_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Jpa Compilation Unit</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JPA_COMPILATION_UNIT_FEATURE_COUNT = JAVA_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentType <em>Java Persistent Type</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.JavaPersistentType
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJavaPersistentType()
- * @generated
- */
- public static final int JAVA_PERSISTENT_TYPE = 2;
-
- /**
- * The feature id for the '<em><b>Mapping Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PERSISTENT_TYPE__MAPPING_KEY = JAVA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Mapping</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PERSISTENT_TYPE__MAPPING = JAVA_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Attributes</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PERSISTENT_TYPE__ATTRIBUTES = JAVA_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PERSISTENT_TYPE__ACCESS = JAVA_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The number of structural features of the '<em>Java Persistent Type</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PERSISTENT_TYPE_FEATURE_COUNT = JAVA_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute <em>Java Persistent Attribute</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJavaPersistentAttribute()
- * @generated
- */
- public static final int JAVA_PERSISTENT_ATTRIBUTE = 3;
-
- /**
- * The feature id for the '<em><b>Mapping</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PERSISTENT_ATTRIBUTE__MAPPING = JAVA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Default Mapping</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PERSISTENT_ATTRIBUTE__DEFAULT_MAPPING = JAVA_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Specified Mapping</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PERSISTENT_ATTRIBUTE__SPECIFIED_MAPPING = JAVA_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Java Persistent Attribute</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PERSISTENT_ATTRIBUTE_FEATURE_COUNT = JAVA_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping <em>IJava Type Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getIJavaTypeMapping()
- * @generated
- */
- public static final int IJAVA_TYPE_MAPPING = 4;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_TYPE_MAPPING__NAME = JpaCorePackage.ITYPE_MAPPING__NAME;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_TYPE_MAPPING__TABLE_NAME = JpaCorePackage.ITYPE_MAPPING__TABLE_NAME;
-
- /**
- * The number of structural features of the '<em>IJava Type Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_TYPE_MAPPING_FEATURE_COUNT = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping <em>IJava Attribute Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getIJavaAttributeMapping()
- * @generated
- */
- public static final int IJAVA_ATTRIBUTE_MAPPING = 5;
-
- /**
- * The number of structural features of the '<em>IJava Attribute Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaEObjectEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass jpaCompilationUnitEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaPersistentTypeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaPersistentAttributeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJavaTypeMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJavaAttributeMappingEClass = null;
-
- /**
- * Creates an instance of the model <b>Package</b>, registered with
- * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
- * package URI value.
- * <p>Note: the correct way to create the package is via the static
- * factory method {@link #init init()}, which also performs
- * initialization of the package, or returns the registered package,
- * if one already exists.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.ecore.EPackage.Registry
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#eNS_URI
- * @see #init()
- * @generated
- */
- private JpaJavaPackage() {
- super(eNS_URI, JpaJavaFactory.eINSTANCE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static boolean isInited = false;
-
- /**
- * Creates, registers, and initializes the <b>Package</b> for this
- * model, and for any others upon which it depends. Simple
- * dependencies are satisfied by calling this method on all
- * dependent packages before doing anything else. This method drives
- * initialization for interdependent packages directly, in parallel
- * with this package, itself.
- * <p>Of this package and its interdependencies, all packages which
- * have not yet been registered by their URI values are first created
- * and registered. The packages are then initialized in two steps:
- * meta-model objects for all of the packages are created before any
- * are initialized, since one package's meta-model objects may refer to
- * those of another.
- * <p>Invocation of this method will not affect any packages that have
- * already been initialized.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #eNS_URI
- * @see #createPackageContents()
- * @see #initializePackageContents()
- * @generated
- */
- public static JpaJavaPackage init() {
- if (isInited)
- return (JpaJavaPackage) EPackage.Registry.INSTANCE.getEPackage(JpaJavaPackage.eNS_URI);
- // Obtain or create and register package
- JpaJavaPackage theJpaJavaPackage = (JpaJavaPackage) (EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof JpaJavaPackage ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new JpaJavaPackage());
- isInited = true;
- // Initialize simple dependencies
- EcorePackage.eINSTANCE.eClass();
- // Obtain or create and register interdependencies
- JpaCorePackage theJpaCorePackage = (JpaCorePackage) (EPackage.Registry.INSTANCE.getEPackage(JpaCorePackage.eNS_URI) instanceof JpaCorePackage ? EPackage.Registry.INSTANCE.getEPackage(JpaCorePackage.eNS_URI) : JpaCorePackage.eINSTANCE);
- JpaCoreMappingsPackage theJpaCoreMappingsPackage = (JpaCoreMappingsPackage) (EPackage.Registry.INSTANCE.getEPackage(JpaCoreMappingsPackage.eNS_URI) instanceof JpaCoreMappingsPackage ? EPackage.Registry.INSTANCE.getEPackage(JpaCoreMappingsPackage.eNS_URI) : JpaCoreMappingsPackage.eINSTANCE);
- JpaJavaMappingsPackage theJpaJavaMappingsPackage = (JpaJavaMappingsPackage) (EPackage.Registry.INSTANCE.getEPackage(JpaJavaMappingsPackage.eNS_URI) instanceof JpaJavaMappingsPackage ? EPackage.Registry.INSTANCE.getEPackage(JpaJavaMappingsPackage.eNS_URI) : JpaJavaMappingsPackage.eINSTANCE);
- OrmPackage theOrmPackage = (OrmPackage) (EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) instanceof OrmPackage ? EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) : OrmPackage.eINSTANCE);
- PersistencePackage thePersistencePackage = (PersistencePackage) (EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI) instanceof PersistencePackage ? EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI) : PersistencePackage.eINSTANCE);
- // Create package meta-data objects
- theJpaJavaPackage.createPackageContents();
- theJpaCorePackage.createPackageContents();
- theJpaCoreMappingsPackage.createPackageContents();
- theJpaJavaMappingsPackage.createPackageContents();
- theOrmPackage.createPackageContents();
- thePersistencePackage.createPackageContents();
- // Initialize created meta-data
- theJpaJavaPackage.initializePackageContents();
- theJpaCorePackage.initializePackageContents();
- theJpaCoreMappingsPackage.initializePackageContents();
- theJpaJavaMappingsPackage.initializePackageContents();
- theOrmPackage.initializePackageContents();
- thePersistencePackage.initializePackageContents();
- // Mark meta-data to indicate it can't be changed
- theJpaJavaPackage.freeze();
- return theJpaJavaPackage;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.JavaEObject <em>Java EObject</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java EObject</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.JavaEObject
- * @generated
- */
- public EClass getJavaEObject() {
- return javaEObjectEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit <em>Jpa Compilation Unit</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Jpa Compilation Unit</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit
- * @generated
- */
- public EClass getJpaCompilationUnit() {
- return jpaCompilationUnitEClass;
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit#getTypes <em>Types</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Types</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit#getTypes()
- * @see #getJpaCompilationUnit()
- * @generated
- */
- public EReference getJpaCompilationUnit_Types() {
- return (EReference) jpaCompilationUnitEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentType <em>Java Persistent Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Persistent Type</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.JavaPersistentType
- * @generated
- */
- public EClass getJavaPersistentType() {
- return javaPersistentTypeEClass;
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentType#getMapping <em>Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.JavaPersistentType#getMapping()
- * @see #getJavaPersistentType()
- * @generated
- */
- public EReference getJavaPersistentType_Mapping() {
- return (EReference) javaPersistentTypeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentType#getAttributes <em>Attributes</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Attributes</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.JavaPersistentType#getAttributes()
- * @see #getJavaPersistentType()
- * @generated
- */
- public EReference getJavaPersistentType_Attributes() {
- return (EReference) javaPersistentTypeEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentType#getAccess <em>Access</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Access</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.JavaPersistentType#getAccess()
- * @see #getJavaPersistentType()
- * @generated
- */
- public EAttribute getJavaPersistentType_Access() {
- return (EAttribute) javaPersistentTypeEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute <em>Java Persistent Attribute</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Persistent Attribute</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute
- * @generated
- */
- public EClass getJavaPersistentAttribute() {
- return javaPersistentAttributeEClass;
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute#getDefaultMapping <em>Default Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Default Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute#getDefaultMapping()
- * @see #getJavaPersistentAttribute()
- * @generated
- */
- public EReference getJavaPersistentAttribute_DefaultMapping() {
- return (EReference) javaPersistentAttributeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute#getSpecifiedMapping <em>Specified Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Specified Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute#getSpecifiedMapping()
- * @see #getJavaPersistentAttribute()
- * @generated
- */
- public EReference getJavaPersistentAttribute_SpecifiedMapping() {
- return (EReference) javaPersistentAttributeEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping <em>IJava Type Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJava Type Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping
- * @generated
- */
- public EClass getIJavaTypeMapping() {
- return iJavaTypeMappingEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping <em>IJava Attribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJava Attribute Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping
- * @generated
- */
- public EClass getIJavaAttributeMapping() {
- return iJavaAttributeMappingEClass;
- }
-
- /**
- * Returns the factory that creates the instances of the model.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the factory that creates the instances of the model.
- * @generated
- */
- public JpaJavaFactory getJpaJavaFactory() {
- return (JpaJavaFactory) getEFactoryInstance();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isCreated = false;
-
- /**
- * Creates the meta-model objects for the package. This method is
- * guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void createPackageContents() {
- if (isCreated)
- return;
- isCreated = true;
- // Create classes and their features
- javaEObjectEClass = createEClass(JAVA_EOBJECT);
- jpaCompilationUnitEClass = createEClass(JPA_COMPILATION_UNIT);
- createEReference(jpaCompilationUnitEClass, JPA_COMPILATION_UNIT__TYPES);
- javaPersistentTypeEClass = createEClass(JAVA_PERSISTENT_TYPE);
- createEReference(javaPersistentTypeEClass, JAVA_PERSISTENT_TYPE__MAPPING);
- createEReference(javaPersistentTypeEClass, JAVA_PERSISTENT_TYPE__ATTRIBUTES);
- createEAttribute(javaPersistentTypeEClass, JAVA_PERSISTENT_TYPE__ACCESS);
- javaPersistentAttributeEClass = createEClass(JAVA_PERSISTENT_ATTRIBUTE);
- createEReference(javaPersistentAttributeEClass, JAVA_PERSISTENT_ATTRIBUTE__DEFAULT_MAPPING);
- createEReference(javaPersistentAttributeEClass, JAVA_PERSISTENT_ATTRIBUTE__SPECIFIED_MAPPING);
- iJavaTypeMappingEClass = createEClass(IJAVA_TYPE_MAPPING);
- iJavaAttributeMappingEClass = createEClass(IJAVA_ATTRIBUTE_MAPPING);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isInitialized = false;
-
- /**
- * Complete the initialization of the package and its meta-model. This
- * method is guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void initializePackageContents() {
- if (isInitialized)
- return;
- isInitialized = true;
- // Initialize package
- setName(eNAME);
- setNsPrefix(eNS_PREFIX);
- setNsURI(eNS_URI);
- // Obtain other dependent packages
- JpaJavaMappingsPackage theJpaJavaMappingsPackage = (JpaJavaMappingsPackage) EPackage.Registry.INSTANCE.getEPackage(JpaJavaMappingsPackage.eNS_URI);
- JpaCorePackage theJpaCorePackage = (JpaCorePackage) EPackage.Registry.INSTANCE.getEPackage(JpaCorePackage.eNS_URI);
- // Add subpackages
- getESubpackages().add(theJpaJavaMappingsPackage);
- // Create type parameters
- // Set bounds for type parameters
- // Add supertypes to classes
- javaEObjectEClass.getESuperTypes().add(theJpaCorePackage.getJpaEObject());
- javaEObjectEClass.getESuperTypes().add(theJpaCorePackage.getIJpaSourceObject());
- jpaCompilationUnitEClass.getESuperTypes().add(this.getJavaEObject());
- jpaCompilationUnitEClass.getESuperTypes().add(theJpaCorePackage.getIJpaRootContentNode());
- javaPersistentTypeEClass.getESuperTypes().add(this.getJavaEObject());
- javaPersistentTypeEClass.getESuperTypes().add(theJpaCorePackage.getIPersistentType());
- javaPersistentAttributeEClass.getESuperTypes().add(this.getJavaEObject());
- javaPersistentAttributeEClass.getESuperTypes().add(theJpaCorePackage.getIPersistentAttribute());
- iJavaTypeMappingEClass.getESuperTypes().add(theJpaCorePackage.getITypeMapping());
- iJavaAttributeMappingEClass.getESuperTypes().add(theJpaCorePackage.getIAttributeMapping());
- // Initialize classes and features; add operations and parameters
- initEClass(javaEObjectEClass, JavaEObject.class, "JavaEObject", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- addEOperation(javaEObjectEClass, theJpaCorePackage.getIJpaFile(), "getJpaFile", 0, 1, IS_UNIQUE, IS_ORDERED);
- addEOperation(javaEObjectEClass, theJpaCorePackage.getIJpaRootContentNode(), "getRoot", 0, 1, IS_UNIQUE, IS_ORDERED);
- initEClass(jpaCompilationUnitEClass, JpaCompilationUnit.class, "JpaCompilationUnit", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getJpaCompilationUnit_Types(), this.getJavaPersistentType(), null, "types", null, 0, -1, JpaCompilationUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(javaPersistentTypeEClass, JavaPersistentType.class, "JavaPersistentType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getJavaPersistentType_Mapping(), this.getIJavaTypeMapping(), null, "mapping", null, 1, 1, JavaPersistentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getJavaPersistentType_Attributes(), this.getJavaPersistentAttribute(), null, "attributes", null, 0, -1, JavaPersistentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getJavaPersistentType_Access(), theJpaCorePackage.getAccessType(), "access", null, 0, 1, JavaPersistentType.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(javaPersistentAttributeEClass, JavaPersistentAttribute.class, "JavaPersistentAttribute", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getJavaPersistentAttribute_DefaultMapping(), this.getIJavaAttributeMapping(), null, "defaultMapping", null, 1, 1, JavaPersistentAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getJavaPersistentAttribute_SpecifiedMapping(), this.getIJavaAttributeMapping(), null, "specifiedMapping", null, 1, 1, JavaPersistentAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iJavaTypeMappingEClass, IJavaTypeMapping.class, "IJavaTypeMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iJavaAttributeMappingEClass, IJavaAttributeMapping.class, "IJavaAttributeMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- // Create resource
- createResource(eNS_URI);
- }
-
-
- /**
- * <!-- begin-user-doc -->
- * Defines literals for the meta objects that represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @generated
- */
- public interface Literals
- {
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.JavaEObject <em>Java EObject</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.JavaEObject
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJavaEObject()
- * @generated
- */
- public static final EClass JAVA_EOBJECT = eINSTANCE.getJavaEObject();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit <em>Jpa Compilation Unit</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJpaCompilationUnit()
- * @generated
- */
- public static final EClass JPA_COMPILATION_UNIT = eINSTANCE.getJpaCompilationUnit();
-
- /**
- * The meta object literal for the '<em><b>Types</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference JPA_COMPILATION_UNIT__TYPES = eINSTANCE.getJpaCompilationUnit_Types();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentType <em>Java Persistent Type</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.JavaPersistentType
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJavaPersistentType()
- * @generated
- */
- public static final EClass JAVA_PERSISTENT_TYPE = eINSTANCE.getJavaPersistentType();
-
- /**
- * The meta object literal for the '<em><b>Mapping</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference JAVA_PERSISTENT_TYPE__MAPPING = eINSTANCE.getJavaPersistentType_Mapping();
-
- /**
- * The meta object literal for the '<em><b>Attributes</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference JAVA_PERSISTENT_TYPE__ATTRIBUTES = eINSTANCE.getJavaPersistentType_Attributes();
-
- /**
- * The meta object literal for the '<em><b>Access</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute JAVA_PERSISTENT_TYPE__ACCESS = eINSTANCE.getJavaPersistentType_Access();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute <em>Java Persistent Attribute</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getJavaPersistentAttribute()
- * @generated
- */
- public static final EClass JAVA_PERSISTENT_ATTRIBUTE = eINSTANCE.getJavaPersistentAttribute();
-
- /**
- * The meta object literal for the '<em><b>Default Mapping</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference JAVA_PERSISTENT_ATTRIBUTE__DEFAULT_MAPPING = eINSTANCE.getJavaPersistentAttribute_DefaultMapping();
-
- /**
- * The meta object literal for the '<em><b>Specified Mapping</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference JAVA_PERSISTENT_ATTRIBUTE__SPECIFIED_MAPPING = eINSTANCE.getJavaPersistentAttribute_SpecifiedMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping <em>IJava Type Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getIJavaTypeMapping()
- * @generated
- */
- public static final EClass IJAVA_TYPE_MAPPING = eINSTANCE.getIJavaTypeMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping <em>IJava Attribute Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage#getIJavaAttributeMapping()
- * @generated
- */
- public static final EClass IJAVA_ATTRIBUTE_MAPPING = eINSTANCE.getIJavaAttributeMapping();
- }
-} //JpaJavaPackage
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/AbstractJavaColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/AbstractJavaColumn.java
deleted file mode 100644
index 23cbe8fb51..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/AbstractJavaColumn.java
+++ /dev/null
@@ -1,695 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.IAbstractColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.utility.internal.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Abstract Java Column</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getAbstractJavaColumn()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class AbstractJavaColumn extends JavaNamedColumn
- implements IAbstractColumn
-{
- /**
- * The default value of the '{@link #getUnique() <em>Unique</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getUnique()
- * @generated
- * @ordered
- */
- protected static final DefaultFalseBoolean UNIQUE_EDEFAULT = DefaultFalseBoolean.DEFAULT;
-
- /**
- * The cached value of the '{@link #getUnique() <em>Unique</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getUnique()
- * @generated
- * @ordered
- */
- protected DefaultFalseBoolean unique = UNIQUE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getNullable() <em>Nullable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getNullable()
- * @generated
- * @ordered
- */
- protected static final DefaultTrueBoolean NULLABLE_EDEFAULT = DefaultTrueBoolean.DEFAULT;
-
- /**
- * The cached value of the '{@link #getNullable() <em>Nullable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getNullable()
- * @generated
- * @ordered
- */
- protected DefaultTrueBoolean nullable = NULLABLE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getInsertable() <em>Insertable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getInsertable()
- * @generated
- * @ordered
- */
- protected static final DefaultTrueBoolean INSERTABLE_EDEFAULT = DefaultTrueBoolean.DEFAULT;
-
- /**
- * The cached value of the '{@link #getInsertable() <em>Insertable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getInsertable()
- * @generated
- * @ordered
- */
- protected DefaultTrueBoolean insertable = INSERTABLE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getUpdatable() <em>Updatable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getUpdatable()
- * @generated
- * @ordered
- */
- protected static final DefaultTrueBoolean UPDATABLE_EDEFAULT = DefaultTrueBoolean.DEFAULT;
-
- /**
- * The cached value of the '{@link #getUpdatable() <em>Updatable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getUpdatable()
- * @generated
- * @ordered
- */
- protected DefaultTrueBoolean updatable = UPDATABLE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getTable() <em>Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTable()
- * @generated
- * @ordered
- */
- protected static final String TABLE_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedTable() <em>Specified Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedTable()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_TABLE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedTable() <em>Specified Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedTable()
- * @generated
- * @ordered
- */
- protected String specifiedTable = SPECIFIED_TABLE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultTable() <em>Default Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultTable()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_TABLE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultTable() <em>Default Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultTable()
- * @generated
- * @ordered
- */
- protected String defaultTable = DEFAULT_TABLE_EDEFAULT;
-
- // hold this so we can get the 'table' text range
- private final DeclarationAnnotationElementAdapter<String> tableDeclarationAdapter;
-
- private final AnnotationElementAdapter<String> tableAdapter;
-
- private final AnnotationElementAdapter<String> uniqueAdapter;
-
- private final AnnotationElementAdapter<String> nullableAdapter;
-
- private final AnnotationElementAdapter<String> insertableAdapter;
-
- private final AnnotationElementAdapter<String> updatableAdapter;
-
- protected AbstractJavaColumn() {
- super();
- throw new UnsupportedOperationException("Use AbstractJavaColumn(Owner, Member, DeclarationAnnotationAdapter) instead");
- }
-
- protected AbstractJavaColumn(Owner owner, Member member, DeclarationAnnotationAdapter daa) {
- super(owner, member, daa);
- this.tableDeclarationAdapter = this.buildStringElementAdapter(this.tableElementName());
- this.tableAdapter = this.buildShortCircuitElementAdapter(this.tableDeclarationAdapter);
- this.uniqueAdapter = this.buildShortCircuitBooleanElementAdapter(this.uniqueElementName());
- this.nullableAdapter = this.buildShortCircuitBooleanElementAdapter(this.nullableElementName());
- this.insertableAdapter = this.buildShortCircuitBooleanElementAdapter(this.insertableElementName());
- this.updatableAdapter = this.buildShortCircuitBooleanElementAdapter(this.updatableElementName());
- }
-
- protected abstract String tableElementName();
-
- protected abstract String uniqueElementName();
-
- protected abstract String nullableElementName();
-
- protected abstract String insertableElementName();
-
- protected abstract String updatableElementName();
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IAbstractColumn.class)) {
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__SPECIFIED_TABLE :
- this.tableAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__UNIQUE :
- this.uniqueAdapter.setValue(((DefaultFalseBoolean) notification.getNewValue()).convertToJavaAnnotationValue());
- break;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__NULLABLE :
- this.nullableAdapter.setValue(((DefaultTrueBoolean) notification.getNewValue()).convertToJavaAnnotationValue());
- break;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__INSERTABLE :
- this.insertableAdapter.setValue(((DefaultTrueBoolean) notification.getNewValue()).convertToJavaAnnotationValue());
- break;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__UPDATABLE :
- this.updatableAdapter.setValue(((DefaultTrueBoolean) notification.getNewValue()).convertToJavaAnnotationValue());
- break;
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.ABSTRACT_JAVA_COLUMN;
- }
-
- /**
- * Returns the value of the '<em><b>Unique</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Unique</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Unique</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean
- * @see #setUnique(DefaultFalseBoolean)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIAbstractColumn_Unique()
- * @model
- * @generated
- */
- public DefaultFalseBoolean getUnique() {
- return unique;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaColumn#getUnique <em>Unique</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Unique</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean
- * @see #getUnique()
- * @generated
- */
- public void setUnique(DefaultFalseBoolean newUnique) {
- DefaultFalseBoolean oldUnique = unique;
- unique = newUnique == null ? UNIQUE_EDEFAULT : newUnique;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__UNIQUE, oldUnique, unique));
- }
-
- /**
- * Returns the value of the '<em><b>Nullable</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Nullable</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Nullable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setNullable(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIAbstractColumn_Nullable()
- * @model
- * @generated
- */
- public DefaultTrueBoolean getNullable() {
- return nullable;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaColumn#getNullable <em>Nullable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Nullable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getNullable()
- * @generated
- */
- public void setNullable(DefaultTrueBoolean newNullable) {
- DefaultTrueBoolean oldNullable = nullable;
- nullable = newNullable == null ? NULLABLE_EDEFAULT : newNullable;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__NULLABLE, oldNullable, nullable));
- }
-
- /**
- * Returns the value of the '<em><b>Insertable</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Insertable</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Insertable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setInsertable(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIAbstractColumn_Insertable()
- * @model
- * @generated
- */
- public DefaultTrueBoolean getInsertable() {
- return insertable;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaColumn#getInsertable <em>Insertable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Insertable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getInsertable()
- * @generated
- */
- public void setInsertable(DefaultTrueBoolean newInsertable) {
- DefaultTrueBoolean oldInsertable = insertable;
- insertable = newInsertable == null ? INSERTABLE_EDEFAULT : newInsertable;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__INSERTABLE, oldInsertable, insertable));
- }
-
- /**
- * Returns the value of the '<em><b>Updatable</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Updatable</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Updatable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setUpdatable(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIAbstractColumn_Updatable()
- * @model
- * @generated
- */
- public DefaultTrueBoolean getUpdatable() {
- return updatable;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaColumn#getUpdatable <em>Updatable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Updatable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getUpdatable()
- * @generated
- */
- public void setUpdatable(DefaultTrueBoolean newUpdatable) {
- DefaultTrueBoolean oldUpdatable = updatable;
- updatable = newUpdatable == null ? UPDATABLE_EDEFAULT : newUpdatable;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__UPDATABLE, oldUpdatable, updatable));
- }
-
- public String getTable() {
- return (this.getSpecifiedTable() == null) ? getDefaultTable() : this.getSpecifiedTable();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Table</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Table</em>' attribute.
- * @see #setSpecifiedTable(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIAbstractColumn_SpecifiedTable()
- * @model
- * @generated
- */
- public String getSpecifiedTable() {
- return specifiedTable;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaColumn#getSpecifiedTable <em>Specified Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Table</em>' attribute.
- * @see #getSpecifiedTable()
- * @generated
- */
- public void setSpecifiedTable(String newSpecifiedTable) {
- String oldSpecifiedTable = specifiedTable;
- specifiedTable = newSpecifiedTable;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__SPECIFIED_TABLE, oldSpecifiedTable, specifiedTable));
- }
-
- protected void setDefaultTable(String newDefaultTable) {
- String oldDefaultTable = this.defaultTable;
- this.defaultTable = newDefaultTable;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__DEFAULT_TABLE, oldDefaultTable, newDefaultTable));
- }
-
- /**
- * Returns the value of the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Table</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Table</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIAbstractColumn_DefaultTable()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultTable() {
- return defaultTable;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__UNIQUE :
- return getUnique();
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__NULLABLE :
- return getNullable();
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__INSERTABLE :
- return getInsertable();
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__UPDATABLE :
- return getUpdatable();
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__TABLE :
- return getTable();
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__SPECIFIED_TABLE :
- return getSpecifiedTable();
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__DEFAULT_TABLE :
- return getDefaultTable();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__UNIQUE :
- setUnique((DefaultFalseBoolean) newValue);
- return;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__NULLABLE :
- setNullable((DefaultTrueBoolean) newValue);
- return;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__INSERTABLE :
- setInsertable((DefaultTrueBoolean) newValue);
- return;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__UPDATABLE :
- setUpdatable((DefaultTrueBoolean) newValue);
- return;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__SPECIFIED_TABLE :
- setSpecifiedTable((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__UNIQUE :
- setUnique(UNIQUE_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__NULLABLE :
- setNullable(NULLABLE_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__INSERTABLE :
- setInsertable(INSERTABLE_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__UPDATABLE :
- setUpdatable(UPDATABLE_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__SPECIFIED_TABLE :
- setSpecifiedTable(SPECIFIED_TABLE_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__UNIQUE :
- return unique != UNIQUE_EDEFAULT;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__NULLABLE :
- return nullable != NULLABLE_EDEFAULT;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__INSERTABLE :
- return insertable != INSERTABLE_EDEFAULT;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__UPDATABLE :
- return updatable != UPDATABLE_EDEFAULT;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__TABLE :
- return TABLE_EDEFAULT == null ? getTable() != null : !TABLE_EDEFAULT.equals(getTable());
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__SPECIFIED_TABLE :
- return SPECIFIED_TABLE_EDEFAULT == null ? specifiedTable != null : !SPECIFIED_TABLE_EDEFAULT.equals(specifiedTable);
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__DEFAULT_TABLE :
- return DEFAULT_TABLE_EDEFAULT == null ? defaultTable != null : !DEFAULT_TABLE_EDEFAULT.equals(defaultTable);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IAbstractColumn.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__UNIQUE :
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__UNIQUE;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__NULLABLE :
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__NULLABLE;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__INSERTABLE :
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__INSERTABLE;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__UPDATABLE :
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__UPDATABLE;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__TABLE :
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__TABLE;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__SPECIFIED_TABLE :
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__SPECIFIED_TABLE;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__DEFAULT_TABLE :
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__DEFAULT_TABLE;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IAbstractColumn.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IABSTRACT_COLUMN__UNIQUE :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__UNIQUE;
- case JpaCoreMappingsPackage.IABSTRACT_COLUMN__NULLABLE :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__NULLABLE;
- case JpaCoreMappingsPackage.IABSTRACT_COLUMN__INSERTABLE :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__INSERTABLE;
- case JpaCoreMappingsPackage.IABSTRACT_COLUMN__UPDATABLE :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__UPDATABLE;
- case JpaCoreMappingsPackage.IABSTRACT_COLUMN__TABLE :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__TABLE;
- case JpaCoreMappingsPackage.IABSTRACT_COLUMN__SPECIFIED_TABLE :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__SPECIFIED_TABLE;
- case JpaCoreMappingsPackage.IABSTRACT_COLUMN__DEFAULT_TABLE :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN__DEFAULT_TABLE;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (unique: ");
- result.append(unique);
- result.append(", nullable: ");
- result.append(nullable);
- result.append(", insertable: ");
- result.append(insertable);
- result.append(", updatable: ");
- result.append(updatable);
- result.append(", specifiedTable: ");
- result.append(specifiedTable);
- result.append(", defaultTable: ");
- result.append(defaultTable);
- result.append(')');
- return result.toString();
- }
-
- @Override
- protected String tableName() {
- return this.getTable();
- }
-
- public ITextRange tableTextRange() {
- return this.elementTextRange(this.tableDeclarationAdapter);
- }
-
- public boolean tableTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(this.tableDeclarationAdapter, pos, astRoot);
- }
-
- private Iterator<String> candidateTableNames() {
- return this.tableIsAllowed() ? this.getOwner().getTypeMapping().associatedTableNamesIncludingInherited() : EmptyIterator.<String> instance();
- }
-
- private Iterator<String> candidateTableNames(Filter<String> filter) {
- return new FilteringIterator<String>(this.candidateTableNames(), filter);
- }
-
- private Iterator<String> quotedCandidateTableNames(Filter<String> filter) {
- return StringTools.quote(this.candidateTableNames(filter));
- }
-
- /**
- * Return whether the 'table' element is allowed. It is not allowed for
- * join columns inside of join tables.
- */
- public abstract boolean tableIsAllowed();
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.tableTouches(pos, astRoot)) {
- return this.quotedCandidateTableNames(filter);
- }
- return null;
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- this.setSpecifiedTable(this.tableAdapter.getValue(astRoot));
- this.setUnique(DefaultFalseBoolean.fromJavaAnnotationValue(this.uniqueAdapter.getValue(astRoot)));
- this.setNullable(DefaultTrueBoolean.fromJavaAnnotationValue(this.nullableAdapter.getValue(astRoot)));
- this.setInsertable(DefaultTrueBoolean.fromJavaAnnotationValue(this.insertableAdapter.getValue(astRoot)));
- this.setUpdatable(DefaultTrueBoolean.fromJavaAnnotationValue(this.updatableAdapter.getValue(astRoot)));
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/AbstractJavaTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/AbstractJavaTable.java
deleted file mode 100644
index 3954c23467..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/AbstractJavaTable.java
+++ /dev/null
@@ -1,1114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.content.java.JavaEObject;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.utility.internal.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Abstract Java Table</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getAbstractJavaTable()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class AbstractJavaTable extends JavaEObject implements ITable
-{
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedName() <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedName()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedName() <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedName()
- * @generated
- * @ordered
- */
- protected String specifiedName = SPECIFIED_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultName() <em>Default Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultName()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultName() <em>Default Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultName()
- * @generated
- * @ordered
- */
- protected String defaultName = DEFAULT_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getCatalog()
- * @generated
- * @ordered
- */
- protected static final String CATALOG_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedCatalog() <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedCatalog()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_CATALOG_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedCatalog() <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedCatalog()
- * @generated
- * @ordered
- */
- protected String specifiedCatalog = SPECIFIED_CATALOG_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultCatalog() <em>Default Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultCatalog()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_CATALOG_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultCatalog() <em>Default Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultCatalog()
- * @generated
- * @ordered
- */
- protected String defaultCatalog = DEFAULT_CATALOG_EDEFAULT;
-
- /**
- * The default value of the '{@link #getSchema() <em>Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSchema()
- * @generated
- * @ordered
- */
- protected static final String SCHEMA_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedSchema() <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSchema()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_SCHEMA_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedSchema() <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSchema()
- * @generated
- * @ordered
- */
- protected String specifiedSchema = SPECIFIED_SCHEMA_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultSchema() <em>Default Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultSchema()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_SCHEMA_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultSchema() <em>Default Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultSchema()
- * @generated
- * @ordered
- */
- protected String defaultSchema = DEFAULT_SCHEMA_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getUniqueConstraints() <em>Unique Constraints</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getUniqueConstraints()
- * @generated
- * @ordered
- */
- protected EList<IUniqueConstraint> uniqueConstraints;
-
- private final Owner owner;
-
- private final Member member;
-
- // hold this so we can get the annotation's text range
- private final DeclarationAnnotationAdapter daa;
-
- // hold this so we can get the 'name' text range
- private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
-
- // hold this so we can get the 'schema' text range
- private final DeclarationAnnotationElementAdapter<String> schemaDeclarationAdapter;
-
- // hold this so we can get the 'catalog' text range
- private final DeclarationAnnotationElementAdapter<String> catalogDeclarationAdapter;
-
- private final AnnotationElementAdapter<String> nameAdapter;
-
- private final AnnotationElementAdapter<String> schemaAdapter;
-
- private final AnnotationElementAdapter<String> catalogAdapter;
-
- protected AbstractJavaTable() {
- super();
- throw new UnsupportedOperationException("Use AbstractJavaTable(Owner, Member) instead");
- }
-
- protected AbstractJavaTable(Owner owner, Member member, DeclarationAnnotationAdapter daa) {
- super();
- this.owner = owner;
- this.member = member;
- this.daa = daa;
- this.nameDeclarationAdapter = this.nameAdapter(daa);
- this.schemaDeclarationAdapter = this.schemaAdapter(daa);
- this.catalogDeclarationAdapter = this.catalogAdapter(daa);
- this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(this.member, this.nameDeclarationAdapter);
- this.schemaAdapter = new ShortCircuitAnnotationElementAdapter<String>(this.member, this.schemaDeclarationAdapter);
- this.catalogAdapter = new ShortCircuitAnnotationElementAdapter<String>(this.member, this.catalogDeclarationAdapter);
- }
-
- /**
- * Build and return a declaration element adapter for the table's 'name' element
- */
- protected abstract DeclarationAnnotationElementAdapter<String> nameAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter);
-
- /**
- * Build and return a declaration element adapter for the table's 'schema' element
- */
- protected abstract DeclarationAnnotationElementAdapter<String> schemaAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter);
-
- /**
- * Build and return a declaration element adapter for the table's 'catalog' element
- */
- protected abstract DeclarationAnnotationElementAdapter<String> catalogAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter);
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(ITable.class)) {
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_NAME :
- this.nameAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_SCHEMA :
- this.schemaAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_CATALOG :
- this.catalogAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__UNIQUE_CONSTRAINTS :
- uniqueConstraintsChanged(notification);
- break;
- default :
- break;
- }
- }
-
- @SuppressWarnings("unchecked")
- void uniqueConstraintsChanged(Notification notification) {
- switch (notification.getEventType()) {
- case Notification.ADD :
- uniqueConstraintAdded(notification.getPosition(), (IUniqueConstraint) notification.getNewValue());
- break;
- case Notification.ADD_MANY :
- uniqueConstraintsAdded(notification.getPosition(), (List<IUniqueConstraint>) notification.getNewValue());
- break;
- case Notification.REMOVE :
- uniqueConstraintRemoved(notification.getPosition(), (IUniqueConstraint) notification.getOldValue());
- break;
- case Notification.REMOVE_MANY :
- if (notification.getPosition() == Notification.NO_INDEX) {
- uniqueConstraintsCleared((List<IUniqueConstraint>) notification.getOldValue());
- }
- else {
- // Notification.getNewValue() returns an array of the positions of objects that were removed
- uniqueConstraintsRemoved((int[]) notification.getNewValue(), (List<IUniqueConstraint>) notification.getOldValue());
- }
- break;
- case Notification.SET :
- if (!notification.isTouch()) {
- uniqueConstraintSet(notification.getPosition(), (IUniqueConstraint) notification.getOldValue(), (IUniqueConstraint) notification.getNewValue());
- }
- break;
- case Notification.MOVE :
- // Notification.getOldValue() returns the source index
- // Notification.getPositon() returns the target index
- // Notification.getNewValue() returns the moved object
- uniqueConstraintMoved(notification.getOldIntValue(), notification.getPosition(), (IUniqueConstraint) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.ABSTRACT_JAVA_TABLE;
- }
-
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITable_Name()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getName() {
- return (this.getSpecifiedName() == null) ? getDefaultName() : this.getSpecifiedName();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Name</em>' attribute.
- * @see #setSpecifiedName(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITable_SpecifiedName()
- * @model
- * @generated
- */
- public String getSpecifiedName() {
- return specifiedName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaTable#getSpecifiedName <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Name</em>' attribute.
- * @see #getSpecifiedName()
- * @generated
- */
- public void setSpecifiedName(String newSpecifiedName) {
- String oldSpecifiedName = specifiedName;
- specifiedName = newSpecifiedName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_NAME, oldSpecifiedName, specifiedName));
- }
-
- /**
- * Returns the value of the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITable_DefaultName()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultName() {
- return defaultName;
- }
-
- /**
- * Returns the value of the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Catalog</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITable_Catalog()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getCatalog() {
- return (this.getSpecifiedCatalog() == null) ? getDefaultCatalog() : this.getSpecifiedCatalog();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Catalog</em>' attribute.
- * @see #setSpecifiedCatalog(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITable_SpecifiedCatalog()
- * @model
- * @generated
- */
- public String getSpecifiedCatalog() {
- return specifiedCatalog;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaTable#getSpecifiedCatalog <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Catalog</em>' attribute.
- * @see #getSpecifiedCatalog()
- * @generated
- */
- public void setSpecifiedCatalog(String newSpecifiedCatalog) {
- String oldSpecifiedCatalog = specifiedCatalog;
- specifiedCatalog = newSpecifiedCatalog;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_CATALOG, oldSpecifiedCatalog, specifiedCatalog));
- }
-
- /**
- * Returns the value of the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Catalog</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITable_DefaultCatalog()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultCatalog() {
- return defaultCatalog;
- }
-
- /**
- * Returns the value of the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Schema</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITable_Schema()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getSchema() {
- return (this.getSpecifiedSchema() == null) ? getDefaultSchema() : this.getSpecifiedSchema();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Schema</em>' attribute.
- * @see #setSpecifiedSchema(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITable_SpecifiedSchema()
- * @model
- * @generated
- */
- public String getSpecifiedSchema() {
- return specifiedSchema;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaTable#getSpecifiedSchema <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Schema</em>' attribute.
- * @see #getSpecifiedSchema()
- * @generated
- */
- public void setSpecifiedSchema(String newSpecifiedSchema) {
- String oldSpecifiedSchema = specifiedSchema;
- specifiedSchema = newSpecifiedSchema;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_SCHEMA, oldSpecifiedSchema, specifiedSchema));
- }
-
- /**
- * Returns the value of the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Schema</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITable_DefaultSchema()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultSchema() {
- return defaultSchema;
- }
-
- /**
- * Returns the value of the '<em><b>Unique Constraints</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IUniqueConstraint}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Unique Constraints</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Unique Constraints</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITable_UniqueConstraints()
- * @model containment="true"
- * @generated
- */
- public EList<IUniqueConstraint> getUniqueConstraints() {
- if (uniqueConstraints == null) {
- uniqueConstraints = new EObjectContainmentEList<IUniqueConstraint>(IUniqueConstraint.class, this, JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__UNIQUE_CONSTRAINTS);
- }
- return uniqueConstraints;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__UNIQUE_CONSTRAINTS :
- return ((InternalEList<?>) getUniqueConstraints()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__NAME :
- return getName();
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_NAME :
- return getSpecifiedName();
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__DEFAULT_NAME :
- return getDefaultName();
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__CATALOG :
- return getCatalog();
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_CATALOG :
- return getSpecifiedCatalog();
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__DEFAULT_CATALOG :
- return getDefaultCatalog();
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SCHEMA :
- return getSchema();
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_SCHEMA :
- return getSpecifiedSchema();
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__DEFAULT_SCHEMA :
- return getDefaultSchema();
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__UNIQUE_CONSTRAINTS :
- return getUniqueConstraints();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_NAME :
- setSpecifiedName((String) newValue);
- return;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_CATALOG :
- setSpecifiedCatalog((String) newValue);
- return;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_SCHEMA :
- setSpecifiedSchema((String) newValue);
- return;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__UNIQUE_CONSTRAINTS :
- getUniqueConstraints().clear();
- getUniqueConstraints().addAll((Collection<? extends IUniqueConstraint>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_NAME :
- setSpecifiedName(SPECIFIED_NAME_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_CATALOG :
- setSpecifiedCatalog(SPECIFIED_CATALOG_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_SCHEMA :
- setSpecifiedSchema(SPECIFIED_SCHEMA_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__UNIQUE_CONSTRAINTS :
- getUniqueConstraints().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__NAME :
- return NAME_EDEFAULT == null ? getName() != null : !NAME_EDEFAULT.equals(getName());
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_NAME :
- return SPECIFIED_NAME_EDEFAULT == null ? specifiedName != null : !SPECIFIED_NAME_EDEFAULT.equals(specifiedName);
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__DEFAULT_NAME :
- return DEFAULT_NAME_EDEFAULT == null ? defaultName != null : !DEFAULT_NAME_EDEFAULT.equals(defaultName);
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__CATALOG :
- return CATALOG_EDEFAULT == null ? getCatalog() != null : !CATALOG_EDEFAULT.equals(getCatalog());
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_CATALOG :
- return SPECIFIED_CATALOG_EDEFAULT == null ? specifiedCatalog != null : !SPECIFIED_CATALOG_EDEFAULT.equals(specifiedCatalog);
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__DEFAULT_CATALOG :
- return DEFAULT_CATALOG_EDEFAULT == null ? defaultCatalog != null : !DEFAULT_CATALOG_EDEFAULT.equals(defaultCatalog);
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SCHEMA :
- return SCHEMA_EDEFAULT == null ? getSchema() != null : !SCHEMA_EDEFAULT.equals(getSchema());
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_SCHEMA :
- return SPECIFIED_SCHEMA_EDEFAULT == null ? specifiedSchema != null : !SPECIFIED_SCHEMA_EDEFAULT.equals(specifiedSchema);
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__DEFAULT_SCHEMA :
- return DEFAULT_SCHEMA_EDEFAULT == null ? defaultSchema != null : !DEFAULT_SCHEMA_EDEFAULT.equals(defaultSchema);
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__UNIQUE_CONSTRAINTS :
- return uniqueConstraints != null && !uniqueConstraints.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == ITable.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__NAME :
- return JpaCoreMappingsPackage.ITABLE__NAME;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_NAME :
- return JpaCoreMappingsPackage.ITABLE__SPECIFIED_NAME;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__DEFAULT_NAME :
- return JpaCoreMappingsPackage.ITABLE__DEFAULT_NAME;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__CATALOG :
- return JpaCoreMappingsPackage.ITABLE__CATALOG;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_CATALOG :
- return JpaCoreMappingsPackage.ITABLE__SPECIFIED_CATALOG;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__DEFAULT_CATALOG :
- return JpaCoreMappingsPackage.ITABLE__DEFAULT_CATALOG;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SCHEMA :
- return JpaCoreMappingsPackage.ITABLE__SCHEMA;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_SCHEMA :
- return JpaCoreMappingsPackage.ITABLE__SPECIFIED_SCHEMA;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__DEFAULT_SCHEMA :
- return JpaCoreMappingsPackage.ITABLE__DEFAULT_SCHEMA;
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__UNIQUE_CONSTRAINTS :
- return JpaCoreMappingsPackage.ITABLE__UNIQUE_CONSTRAINTS;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == ITable.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.ITABLE__NAME :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__NAME;
- case JpaCoreMappingsPackage.ITABLE__SPECIFIED_NAME :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_NAME;
- case JpaCoreMappingsPackage.ITABLE__DEFAULT_NAME :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__DEFAULT_NAME;
- case JpaCoreMappingsPackage.ITABLE__CATALOG :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__CATALOG;
- case JpaCoreMappingsPackage.ITABLE__SPECIFIED_CATALOG :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_CATALOG;
- case JpaCoreMappingsPackage.ITABLE__DEFAULT_CATALOG :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__DEFAULT_CATALOG;
- case JpaCoreMappingsPackage.ITABLE__SCHEMA :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SCHEMA;
- case JpaCoreMappingsPackage.ITABLE__SPECIFIED_SCHEMA :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__SPECIFIED_SCHEMA;
- case JpaCoreMappingsPackage.ITABLE__DEFAULT_SCHEMA :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__DEFAULT_SCHEMA;
- case JpaCoreMappingsPackage.ITABLE__UNIQUE_CONSTRAINTS :
- return JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__UNIQUE_CONSTRAINTS;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedName: ");
- result.append(specifiedName);
- result.append(", defaultName: ");
- result.append(defaultName);
- result.append(", specifiedCatalog: ");
- result.append(specifiedCatalog);
- result.append(", defaultCatalog: ");
- result.append(defaultCatalog);
- result.append(", specifiedSchema: ");
- result.append(specifiedSchema);
- result.append(", defaultSchema: ");
- result.append(defaultSchema);
- result.append(')');
- return result.toString();
- }
-
- // ********** ITable implementation **********
- public ITextRange nameTextRange() {
- return this.elementTextRange(this.nameDeclarationAdapter);
- }
-
- public ITextRange nameTextRange(CompilationUnit astRoot) {
- return this.elementTextRange(this.nameDeclarationAdapter, astRoot);
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(this.nameDeclarationAdapter, pos, astRoot);
- }
-
- public ITextRange schemaTextRange() {
- return this.elementTextRange(this.schemaDeclarationAdapter);
- }
-
- public ITextRange schemaTextRange(CompilationUnit astRoot) {
- return this.elementTextRange(this.schemaDeclarationAdapter, astRoot);
- }
-
- public boolean schemaTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(this.schemaDeclarationAdapter, pos, astRoot);
- }
-
- public ITextRange catalogTextRange() {
- return this.elementTextRange(this.catalogDeclarationAdapter);
- }
-
- public ITextRange catalogTextRange(CompilationUnit astRoot) {
- return this.elementTextRange(this.catalogDeclarationAdapter, astRoot);
- }
-
- public boolean catalogTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(this.catalogDeclarationAdapter, pos, astRoot);
- }
-
- //TODO should we allow setting through the ecore, that would make this method
- //public and part of the ITable api. only the model needs to be setting the default,
- //but the ui needs to be listening for changes to the default.
- protected void setDefaultName(String newDefaultName) {
- String oldDefaultName = this.defaultName;
- this.defaultName = newDefaultName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_TABLE__DEFAULT_NAME, oldDefaultName, this.defaultName));
- }
-
- protected void setDefaultCatalog(String newDefaultCatalog) {
- String oldDefaultCatalog = this.defaultCatalog;
- this.defaultCatalog = newDefaultCatalog;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_TABLE__DEFAULT_CATALOG, oldDefaultCatalog, this.defaultCatalog));
- }
-
- protected void setDefaultSchema(String newDefaultSchema) {
- String oldDefaultSchema = this.defaultSchema;
- this.defaultSchema = newDefaultSchema;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_TABLE__DEFAULT_SCHEMA, oldDefaultSchema, this.defaultSchema));
- }
-
- public Owner getOwner() {
- return owner;
- }
-
- protected Member getMember() {
- return this.member;
- }
-
- protected DeclarationAnnotationAdapter getDeclarationAnnotationAdapter() {
- return this.daa;
- }
-
- public IUniqueConstraint createUniqueConstraint(int index) {
- return createJavaUniqueConstraint(index);
- }
-
- protected abstract JavaUniqueConstraint createJavaUniqueConstraint(int index);
-
- //set these defaults here or call setDefaultCatalog from JavaTableContext instead
- public void refreshDefaults(DefaultsContext defaultsContext) {
- this.setDefaultCatalog((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_TABLE_CATALOG_KEY));
- this.setDefaultSchema((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_TABLE_SCHEMA_KEY));
- }
-
- protected void updateFromJava(CompilationUnit astRoot) {
- this.setSpecifiedName(this.nameAdapter.getValue(astRoot));
- this.setSpecifiedSchema(this.schemaAdapter.getValue(astRoot));
- this.setSpecifiedCatalog(this.catalogAdapter.getValue(astRoot));
- this.updateUniqueConstraintsFromJava(astRoot);
- }
-
- /**
- * here we just worry about getting the unique constraints lists the same size;
- * then we delegate to the unique constraints to synch themselves up
- */
- private void updateUniqueConstraintsFromJava(CompilationUnit astRoot) {
- // synchronize the model join columns with the Java source
- List<IUniqueConstraint> constraints = this.getUniqueConstraints();
- int persSize = constraints.size();
- int javaSize = 0;
- boolean allJavaAnnotationsFound = false;
- for (int i = 0; i < persSize; i++) {
- JavaUniqueConstraint uniqueConstraint = (JavaUniqueConstraint) constraints.get(i);
- if (uniqueConstraint.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- break; // no need to go any further
- }
- uniqueConstraint.updateFromJava(astRoot);
- javaSize++;
- }
- if (allJavaAnnotationsFound) {
- // remove any model join columns beyond those that correspond to the Java annotations
- while (persSize > javaSize) {
- persSize--;
- constraints.remove(persSize);
- }
- }
- else {
- // add new model join columns until they match the Java annotations
- while (!allJavaAnnotationsFound) {
- JavaUniqueConstraint uniqueConstraint = this.createJavaUniqueConstraint(javaSize);
- if (uniqueConstraint.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- }
- else {
- this.getUniqueConstraints().add(uniqueConstraint);
- uniqueConstraint.updateFromJava(astRoot);
- javaSize++;
- }
- }
- }
- }
-
- public ITextRange validationTextRange() {
- ITextRange textRange = this.member.annotationTextRange(this.daa);
- return (textRange != null) ? textRange : this.getOwner().validationTextRange();
- }
-
- public Table dbTable() {
- Schema schema = this.dbSchema();
- return (schema == null) ? null : schema.tableNamed(this.getName());
- }
-
- public Schema dbSchema() {
- return this.database().schemaNamed(this.getSchema());
- }
-
- public boolean hasResolvedSchema() {
- return this.dbSchema() != null;
- }
-
- public boolean isResolved() {
- return this.dbTable() != null;
- }
-
- protected ITextRange elementTextRange(DeclarationAnnotationElementAdapter<?> elementAdapter) {
- return this.elementTextRange(this.member.annotationElementTextRange(elementAdapter));
- }
-
- protected ITextRange elementTextRange(DeclarationAnnotationElementAdapter<?> elementAdapter, CompilationUnit astRoot) {
- return this.elementTextRange(this.member.annotationElementTextRange(elementAdapter, astRoot));
- }
-
- protected boolean elementTouches(DeclarationAnnotationElementAdapter<?> elementAdapter, int pos) {
- return this.elementTouches(this.member.annotationElementTextRange(elementAdapter), pos);
- }
-
- protected boolean elementTouches(DeclarationAnnotationElementAdapter<?> elementAdapter, int pos, CompilationUnit astRoot) {
- return this.elementTouches(this.member.annotationElementTextRange(elementAdapter, astRoot), pos);
- }
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (IUniqueConstraint constraint : this.getUniqueConstraints()) {
- result = ((JavaUniqueConstraint) constraint).candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * called if the database is connected
- * name, schema, catalog
- */
- @Override
- public Iterator<String> connectedCandidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.connectedCandidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.nameTouches(pos, astRoot)) {
- return this.quotedCandidateNames(filter);
- }
- if (this.schemaTouches(pos, astRoot)) {
- return this.quotedCandidateSchemas(filter);
- }
- if (this.catalogTouches(pos, astRoot)) {
- return this.quotedCandidateCatalogs(filter);
- }
- return null;
- }
-
- private Iterator<String> candidateNames() {
- Schema dbSchema = this.dbSchema();
- return (dbSchema != null) ? dbSchema.tableNames() : EmptyIterator.<String> instance();
- }
-
- private Iterator<String> candidateNames(Filter<String> filter) {
- return new FilteringIterator<String>(this.candidateNames(), filter);
- }
-
- private Iterator<String> quotedCandidateNames(Filter<String> filter) {
- return StringTools.quote(this.candidateNames(filter));
- }
-
- private Iterator<String> candidateSchemas() {
- return this.database().schemaNames();
- }
-
- private Iterator<String> candidateSchemas(Filter<String> filter) {
- return new FilteringIterator<String>(this.candidateSchemas(), filter);
- }
-
- private Iterator<String> quotedCandidateSchemas(Filter<String> filter) {
- return StringTools.quote(this.candidateSchemas(filter));
- }
-
- private Iterator<String> candidateCatalogs() {
- return this.database().catalogNames();
- }
-
- private Iterator<String> candidateCatalogs(Filter<String> filter) {
- return new FilteringIterator<String>(this.candidateCatalogs(), filter);
- }
-
- private Iterator<String> quotedCandidateCatalogs(Filter<String> filter) {
- return StringTools.quote(this.candidateCatalogs(filter));
- }
-
- // ********** jpa model -> java annotations **********
- ////////////////////////////////////////////////////////
- /**
- * slide over all the annotations that follow the new join column
- */
- public void uniqueConstraintAdded(int index, IUniqueConstraint uniqueConstraint) {
- // JoinColumn was added to jpa model when updating from java, do not need
- // to edit the java in this case. TODO is there a better way to handle this??
- if (((JavaUniqueConstraint) uniqueConstraint).annotation(getMember().astRoot()) == null) {
- this.synchUniqueConstraintAnnotationsAfterAdd(index + 1);
- ((JavaUniqueConstraint) uniqueConstraint).newAnnotation();
- }
- }
-
- // look at this
- public void uniqueConstraintsAdded(int index, List<IUniqueConstraint> constraints) {
- // JoinColumn was added to jpa model when updating from java, do not need
- // to edit the java in this case. TODO is there a better way to handle this??
- if (!constraints.isEmpty() && ((JavaUniqueConstraint) constraints.get(0)).annotation(getMember().astRoot()) == null) {
- this.synchUniqueConstraintAnnotationsAfterAdd(index + constraints.size());
- for (IUniqueConstraint uniqueConstraint : constraints) {
- ((JavaUniqueConstraint) uniqueConstraint).newAnnotation();
- }
- }
- }
-
- public void uniqueConstraintRemoved(int index, IUniqueConstraint uniqueConstraint) {
- ((JavaUniqueConstraint) uniqueConstraint).removeAnnotation();
- this.synchUniqueConstraintAnnotationsAfterRemove(index);
- }
-
- public void uniqueConstraintsRemoved(int[] indexes, List<IUniqueConstraint> constraints) {
- for (IUniqueConstraint uniqueConstraint : constraints) {
- ((JavaUniqueConstraint) uniqueConstraint).removeAnnotation();
- }
- this.synchUniqueConstraintAnnotationsAfterRemove(indexes[0]);
- }
-
- public void uniqueConstraintsCleared(List<IUniqueConstraint> constraints) {
- for (IUniqueConstraint uniqueConstraint : constraints) {
- ((JavaUniqueConstraint) uniqueConstraint).removeAnnotation();
- }
- }
-
- public void uniqueConstraintSet(int index, IUniqueConstraint oldUniqueConstraint, IUniqueConstraint newUniqueConstraint) {
- ((JavaUniqueConstraint) newUniqueConstraint).newAnnotation();
- }
-
- public void uniqueConstraintMoved(int sourceIndex, int targetIndex, IUniqueConstraint uniqueConstraint) {
- List<IUniqueConstraint> constraints = this.getUniqueConstraints();
- int begin = Math.min(sourceIndex, targetIndex);
- int end = Math.max(sourceIndex, targetIndex);
- for (int i = begin; i-- > end;) {
- this.synch(constraints.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the end of the list to prevent overlap
- */
- private void synchUniqueConstraintAnnotationsAfterAdd(int index) {
- List<IUniqueConstraint> constraints = this.getUniqueConstraints();
- for (int i = constraints.size(); i-- > index;) {
- this.synch(constraints.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the specified index to prevent overlap
- */
- private void synchUniqueConstraintAnnotationsAfterRemove(int index) {
- List<IUniqueConstraint> joinColumns = this.getUniqueConstraints();
- for (int i = index; i < joinColumns.size(); i++) {
- this.synch(joinColumns.get(i), i);
- }
- }
-
- private void synch(IUniqueConstraint uniqueConstraint, int index) {
- ((JavaUniqueConstraint) uniqueConstraint).moveAnnotation(index);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaBasic.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaBasic.java
deleted file mode 100644
index 5076220487..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaBasic.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJava Basic</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaBasic()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IJavaBasic extends IJavaAttributeMapping, IBasic
-{} // IJavaBasic
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaEmbeddable.java
deleted file mode 100644
index 46da23cc45..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaEmbeddable.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddable;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJava Embeddable</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaEmbeddable()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IJavaEmbeddable extends IJavaTypeMapping, IEmbeddable
-{} // IJavaEmbeddable
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaEmbedded.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaEmbedded.java
deleted file mode 100644
index f92b980680..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaEmbedded.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJava Embedded</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaEmbedded()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IJavaEmbedded extends IJavaAttributeMapping, IEmbedded
-{} // IJavaEmbedded
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaEmbeddedId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaEmbeddedId.java
deleted file mode 100644
index f1f53c90ab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaEmbeddedId.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddedId;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJava Embedded Id</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaEmbeddedId()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IJavaEmbeddedId extends IJavaAttributeMapping, IEmbeddedId
-{} // IJavaEmbeddedId
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaEntity.java
deleted file mode 100644
index ed775f7a09..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaEntity.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJava Entity</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaEntity()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IJavaEntity extends IJavaTypeMapping, IEntity
-{} // IJavaEntity
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaId.java
deleted file mode 100644
index 1cf5cb0498..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaId.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.mappings.IId;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJava Id</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaId()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IJavaId extends IJavaAttributeMapping, IId
-{} // IJavaId
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaManyToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaManyToMany.java
deleted file mode 100644
index 321f9bf6cf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaManyToMany.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.mappings.IManyToMany;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJava Many To Many</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaManyToMany()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IJavaManyToMany extends IJavaAttributeMapping, IManyToMany
-{} // IJavaManyToMany
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaManyToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaManyToOne.java
deleted file mode 100644
index 094266ed41..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaManyToOne.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.mappings.IManyToOne;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJava Many To One</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaManyToOne()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IJavaManyToOne extends IJavaAttributeMapping, IManyToOne
-{} // IJavaManyToOne
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaMappedSuperclass.java
deleted file mode 100644
index 3229645ffb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaMappedSuperclass.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.mappings.IMappedSuperclass;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJava Mapped Superclass</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaMappedSuperclass()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IJavaMappedSuperclass
- extends IJavaTypeMapping, IMappedSuperclass
-{} // IJavaMappedSuperclass
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaOneToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaOneToMany.java
deleted file mode 100644
index 8f3496d45f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaOneToMany.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.mappings.IOneToMany;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJava One To Many</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaOneToMany()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IJavaOneToMany extends IJavaAttributeMapping, IOneToMany
-{} // IJavaOneToMany
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaOneToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaOneToOne.java
deleted file mode 100644
index 43daf73625..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaOneToOne.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.mappings.IOneToOne;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJava One To One</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaOneToOne()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IJavaOneToOne extends IJavaAttributeMapping, IOneToOne
-{} // IJavaOneToOne
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaTransient.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaTransient.java
deleted file mode 100644
index 02df56e681..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaTransient.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.mappings.ITransient;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJava Transient</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaTransient()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IJavaTransient extends IJavaAttributeMapping, ITransient
-{} // IJavaTransient
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaVersion.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaVersion.java
deleted file mode 100644
index e5e9e682a1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IJavaVersion.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.mappings.IVersion;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJava Version</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaVersion()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IJavaVersion extends IJavaAttributeMapping, IVersion
-{} // IJavaVersion
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IntAnnotationElementAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IntAnnotationElementAdapter.java
deleted file mode 100644
index bb676ebfd3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/IntAnnotationElementAdapter.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * Wrap an AnnotationElementAdapter and convert its value to an int,
- * and vice-versa. The public protocol is identical to
- * AnnotationElementAdapter; except the #getValue and #setValue
- * methods deal with an int instead of an Object.
- *
- * Assumptions:
- * - the nested adapter returns and expects a String value
- * - the value should be a non-negative number (value >= 0)
- * - an invalid value is represented with a -1/null
- * These assumptions work reasonably enough with the JPA requirements.
- */
-public class IntAnnotationElementAdapter {
- private final AnnotationElementAdapter<String> adapter;
-
- public IntAnnotationElementAdapter(AnnotationElementAdapter<String> adapter) {
- super();
- this.adapter = adapter;
- }
-
- public ASTNode astNode() {
- return this.adapter.astNode();
- }
-
- public ASTNode astNode(CompilationUnit astRoot) {
- return this.adapter.astNode(astRoot);
- }
-
- public int getValue() {
- return this.convertStringToInt(this.adapter.getValue());
- }
-
- public int getValue(CompilationUnit astRoot) {
- return this.convertStringToInt(this.adapter.getValue(astRoot));
- }
-
- protected int convertStringToInt(String stringValue) {
- if (stringValue == null) {
- return -1;
- }
- try {
- int intValue = Integer.parseInt(stringValue);
- return (intValue >= 0) ? intValue : -1;
- } catch (NumberFormatException ex) {
- return -1;
- }
- }
-
- public void setValue(int value) {
- this.adapter.setValue(this.convertIntToValue(value));
- }
-
- protected String convertIntToValue(int intValue) {
- return this.convertIntToString(intValue);
- }
-
- protected String convertIntToString(int intValue) {
- return (intValue >= 0) ? Integer.toString(intValue) : null;
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.adapter);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAbstractQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAbstractQuery.java
deleted file mode 100644
index 76230a7b1e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAbstractQuery.java
+++ /dev/null
@@ -1,631 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.content.java.JavaEObject;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.mappings.IQuery;
-import org.eclipse.jpt.core.internal.mappings.IQueryHint;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Abstract Query</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaAbstractQuery()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class JavaAbstractQuery extends JavaEObject implements IQuery
-{
- private final Member member;
-
- // hold this so we can get the annotation's text range
- private final IndexedDeclarationAnnotationAdapter idaa;
-
- // hold this so we can get the 'name' text range
- private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
-
- // hold this so we can get the 'query' text range
- private final DeclarationAnnotationElementAdapter<String> queryDeclarationAdapter;
-
- private final IndexedAnnotationAdapter annotationAdapter;
-
- private final AnnotationElementAdapter<String> nameAdapter;
-
- private final AnnotationElementAdapter<String> queryAdapter;
-
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected String name = NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getQuery() <em>Query</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getQuery()
- * @generated
- * @ordered
- */
- protected static final String QUERY_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getQuery() <em>Query</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getQuery()
- * @generated
- * @ordered
- */
- protected String query = QUERY_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getHints() <em>Hints</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getHints()
- * @generated
- * @ordered
- */
- protected EList<IQueryHint> hints;
-
- protected JavaAbstractQuery() {
- throw new UnsupportedOperationException("Use JavaAbstractQuery(Member) instead");
- }
-
- protected JavaAbstractQuery(Member member, IndexedDeclarationAnnotationAdapter idaa) {
- super();
- this.member = member;
- this.idaa = idaa;
- this.annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
- this.nameDeclarationAdapter = nameAdapter(this.idaa);
- this.queryDeclarationAdapter = queryAdapter(this.idaa);
- this.nameAdapter = this.buildAdapter(this.nameDeclarationAdapter);
- this.queryAdapter = this.buildAdapter(this.queryDeclarationAdapter);
- }
-
- // ********** initialization **********
- protected AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new ShortCircuitAnnotationElementAdapter<String>(this.member, daea);
- }
-
- protected DeclarationAnnotationElementAdapter<String> nameAdapter(DeclarationAnnotationAdapter daa) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, nameElementName());
- }
-
- protected DeclarationAnnotationElementAdapter<String> queryAdapter(DeclarationAnnotationAdapter daa) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, queryElementName());
- }
-
- protected abstract String nameElementName();
-
- protected abstract String queryElementName();
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IQuery.class)) {
- case JpaCoreMappingsPackage.IQUERY__NAME :
- this.nameAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaCoreMappingsPackage.IQUERY__QUERY :
- this.queryAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaCoreMappingsPackage.IQUERY__HINTS :
- hintsChanged(notification);
- break;
- default :
- break;
- }
- }
-
- @SuppressWarnings("unchecked")
- void hintsChanged(Notification notification) {
- switch (notification.getEventType()) {
- case Notification.ADD :
- hintAdded(notification.getPosition(), (IQueryHint) notification.getNewValue());
- break;
- case Notification.ADD_MANY :
- hintsAdded(notification.getPosition(), (List<IQueryHint>) notification.getNewValue());
- break;
- case Notification.REMOVE :
- hintRemoved(notification.getPosition(), (IQueryHint) notification.getOldValue());
- break;
- case Notification.REMOVE_MANY :
- if (notification.getPosition() == Notification.NO_INDEX) {
- hintsCleared((List<IQueryHint>) notification.getOldValue());
- }
- else {
- // Notification.getNewValue() returns an array of the positions of objects that were removed
- hintsRemoved((int[]) notification.getNewValue(), (List<IQueryHint>) notification.getOldValue());
- }
- break;
- case Notification.SET :
- if (!notification.isTouch()) {
- hintSet(notification.getPosition(), (IQueryHint) notification.getOldValue(), (IQueryHint) notification.getNewValue());
- }
- break;
- case Notification.MOVE :
- // Notification.getOldValue() returns the source index
- // Notification.getPositon() returns the target index
- // Notification.getNewValue() returns the moved object
- hintMoved(notification.getOldIntValue(), notification.getPosition(), (IQueryHint) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_ABSTRACT_QUERY;
- }
-
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see #setName(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIQuery_Name()
- * @model
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAbstractQuery#getName <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Name</em>' attribute.
- * @see #getName()
- * @generated
- */
- public void setName(String newName) {
- String oldName = name;
- name = newName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__NAME, oldName, name));
- }
-
- /**
- * Returns the value of the '<em><b>Query</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Query</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Query</em>' attribute.
- * @see #setQuery(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIQuery_Query()
- * @model
- * @generated
- */
- public String getQuery() {
- return query;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAbstractQuery#getQuery <em>Query</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Query</em>' attribute.
- * @see #getQuery()
- * @generated
- */
- public void setQuery(String newQuery) {
- String oldQuery = query;
- query = newQuery;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__QUERY, oldQuery, query));
- }
-
- /**
- * Returns the value of the '<em><b>Hints</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IQueryHint}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Hints</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Hints</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIQuery_Hints()
- * @model containment="true"
- * @generated
- */
- public EList<IQueryHint> getHints() {
- if (hints == null) {
- hints = new EObjectContainmentEList<IQueryHint>(IQueryHint.class, this, JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__HINTS);
- }
- return hints;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__HINTS :
- return ((InternalEList<?>) getHints()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__NAME :
- return getName();
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__QUERY :
- return getQuery();
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__HINTS :
- return getHints();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__NAME :
- setName((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__QUERY :
- setQuery((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__HINTS :
- getHints().clear();
- getHints().addAll((Collection<? extends IQueryHint>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__NAME :
- setName(NAME_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__QUERY :
- setQuery(QUERY_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__HINTS :
- getHints().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__NAME :
- return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__QUERY :
- return QUERY_EDEFAULT == null ? query != null : !QUERY_EDEFAULT.equals(query);
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__HINTS :
- return hints != null && !hints.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IQuery.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__NAME :
- return JpaCoreMappingsPackage.IQUERY__NAME;
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__QUERY :
- return JpaCoreMappingsPackage.IQUERY__QUERY;
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__HINTS :
- return JpaCoreMappingsPackage.IQUERY__HINTS;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IQuery.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IQUERY__NAME :
- return JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__NAME;
- case JpaCoreMappingsPackage.IQUERY__QUERY :
- return JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__QUERY;
- case JpaCoreMappingsPackage.IQUERY__HINTS :
- return JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY__HINTS;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (name: ");
- result.append(name);
- result.append(", query: ");
- result.append(query);
- result.append(')');
- return result.toString();
- }
-
- protected Member getMember() {
- return this.member;
- }
-
- // ********** jpa model -> java annotations **********
- /**
- * slide over all the annotations that follow the new join column
- */
- public void hintAdded(int index, IQueryHint hint) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (((JavaQueryHint) hint).annotation(getMember().astRoot()) == null) {
- this.synchHintAnnotationsAfterAdd(index + 1);
- ((JavaQueryHint) hint).newAnnotation();
- }
- }
-
- // bjv look at this
- public void hintsAdded(int index, List<IQueryHint> queryHints) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (!queryHints.isEmpty() && ((JavaQueryHint) queryHints.get(0)).annotation(getMember().astRoot()) == null) {
- this.synchHintAnnotationsAfterAdd(index + queryHints.size());
- for (IQueryHint hint : queryHints) {
- ((JavaQueryHint) hint).newAnnotation();
- }
- }
- }
-
- public void hintRemoved(int index, IQueryHint hint) {
- ((JavaQueryHint) hint).removeAnnotation();
- this.synchHintAnnotationsAfterRemove(index);
- }
-
- public void hintsRemoved(int[] indexes, List<IQueryHint> queryHints) {
- for (IQueryHint hint : queryHints) {
- ((JavaQueryHint) hint).removeAnnotation();
- }
- this.synchHintAnnotationsAfterRemove(indexes[0]);
- }
-
- public void hintsCleared(List<IQueryHint> queryHints) {
- for (IQueryHint hint : queryHints) {
- ((JavaQueryHint) hint).removeAnnotation();
- }
- }
-
- public void hintSet(int index, IQueryHint oldHint, IQueryHint newHint) {
- ((JavaQueryHint) newHint).newAnnotation();
- }
-
- public void hintMoved(int sourceIndex, int targetIndex, IQueryHint hint) {
- List<IQueryHint> queryHints = this.getHints();
- int begin = Math.min(sourceIndex, targetIndex);
- int end = Math.max(sourceIndex, targetIndex);
- for (int i = begin; i-- > end;) {
- this.synch(queryHints.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the end of the list to prevent overlap
- */
- private void synchHintAnnotationsAfterAdd(int index) {
- List<IQueryHint> queryHints = this.getHints();
- for (int i = queryHints.size(); i-- > index;) {
- this.synch(queryHints.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the specified index to prevent overlap
- */
- private void synchHintAnnotationsAfterRemove(int index) {
- List<IQueryHint> queryHints = this.getHints();
- for (int i = index; i < queryHints.size(); i++) {
- this.synch(queryHints.get(i), i);
- }
- }
-
- private void synch(IQueryHint queryHint, int index) {
- ((JavaQueryHint) queryHint).moveAnnotation(index);
- }
-
- /**
- * allow owners to verify the annotation
- */
- public Annotation annotation(CompilationUnit astRoot) {
- return this.annotationAdapter.getAnnotation(astRoot);
- }
-
- protected void updateFromJava(CompilationUnit astRoot) {
- this.setName(this.nameAdapter.getValue(astRoot));
- this.setQuery(this.queryAdapter.getValue(astRoot));
- this.updateQueryHintsFromJava(astRoot);
- }
-
- /**
- * here we just worry about getting the named query lists the same size;
- * then we delegate to the named queries to synch themselves up
- */
- private void updateQueryHintsFromJava(CompilationUnit astRoot) {
- // synchronize the model named queries with the Java source
- List<IQueryHint> queryHints = this.getHints();
- int persSize = queryHints.size();
- int javaSize = 0;
- boolean allJavaAnnotationsFound = false;
- for (int i = 0; i < persSize; i++) {
- JavaQueryHint hint = (JavaQueryHint) queryHints.get(i);
- if (hint.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- break; // no need to go any further
- }
- hint.updateFromJava(astRoot);
- javaSize++;
- }
- if (allJavaAnnotationsFound) {
- // remove any model named queries beyond those that correspond to the Java annotations
- while (persSize > javaSize) {
- persSize--;
- queryHints.remove(persSize);
- }
- }
- else {
- // add new model join columns until they match the Java annotations
- while (!allJavaAnnotationsFound) {
- JavaQueryHint javaQueryHint = createJavaQueryHint(javaSize);
- if (javaQueryHint.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- }
- else {
- getHints().add(javaQueryHint);
- javaQueryHint.updateFromJava(astRoot);
- javaSize++;
- }
- }
- }
- }
-
- public JavaQueryHint createQueryHint(int index) {
- return createJavaQueryHint(index);
- }
-
- protected abstract JavaQueryHint createJavaQueryHint(int index);
-
- protected IndexedDeclarationAnnotationAdapter getDeclarationAnnotationAdapter() {
- return this.idaa;
- }
-
- // ********** persistence model -> java annotations **********
- void moveAnnotation(int newIndex) {
- this.annotationAdapter.moveAnnotation(newIndex);
- }
-
- void newAnnotation() {
- this.annotationAdapter.newMarkerAnnotation();
- }
-
- void removeAnnotation() {
- this.annotationAdapter.removeAnnotation();
- }
-
- // ********* IJpaSourceObject implementation ***********
- public ITextRange validationTextRange() {
- return this.member.annotationTextRange(this.idaa);
- }
-
- // ********** static methods **********
- protected static DeclarationAnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(annotationAdapter, elementName);
- }
-} // JavaAbstractQuery
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAssociationOverride.java
deleted file mode 100644
index cfd89dead8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAssociationOverride.java
+++ /dev/null
@@ -1,506 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.jdtutility.CombinationIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.utility.internal.Filter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Association Override</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaAssociationOverride()
- * @model kind="class"
- * @generated
- */
-public class JavaAssociationOverride extends JavaOverride
- implements IAssociationOverride
-{
- /**
- * The cached value of the '{@link #getSpecifiedJoinColumns() <em>Specified Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IJoinColumn> specifiedJoinColumns;
-
- /**
- * The cached value of the '{@link #getDefaultJoinColumns() <em>Default Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IJoinColumn> defaultJoinColumns;
-
- public static final SimpleDeclarationAnnotationAdapter SINGLE_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ASSOCIATION_OVERRIDE);
-
- public static final SimpleDeclarationAnnotationAdapter MULTIPLE_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ASSOCIATION_OVERRIDES);
-
- protected JavaAssociationOverride() {
- throw new UnsupportedOperationException("use JavaAssociationOverride(Owner, Member, IndexedDeclarationAnnotationAdapter)");
- }
-
- protected JavaAssociationOverride(Owner owner, Member member, IndexedDeclarationAnnotationAdapter daa) {
- super(owner, member, daa);
- }
-
- /**
- * check for changes to the 'specifiedJoinColumns' and
- * 'specifiedInverseJoinColumns' lists so we can notify the
- * model adapter of any changes;
- * also listen for changes to the 'defaultJoinColumns' and
- * 'defaultInverseJoinColumns' lists so we can spank the developer
- */
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IJoinTable.class)) {
- case JpaCoreMappingsPackage.IASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS :
- specifiedJoinColumnsChanged(notification);
- break;
- default :
- break;
- }
- }
-
- @SuppressWarnings("unchecked")
- void specifiedJoinColumnsChanged(Notification notification) {
- switch (notification.getEventType()) {
- case Notification.ADD :
- specifiedJoinColumnAdded(notification.getPosition(), (IJoinColumn) notification.getNewValue());
- break;
- case Notification.ADD_MANY :
- specifiedJoinColumnsAdded(notification.getPosition(), (List<IJoinColumn>) notification.getNewValue());
- break;
- case Notification.REMOVE :
- specifiedJoinColumnRemoved(notification.getPosition(), (IJoinColumn) notification.getOldValue());
- break;
- case Notification.REMOVE_MANY :
- if (notification.getPosition() == Notification.NO_INDEX) {
- specifiedJoinColumnsCleared((List<IJoinColumn>) notification.getOldValue());
- }
- else {
- // Notification.getNewValue() returns an array of the positions of objects that were removed
- specifiedJoinColumnsRemoved((int[]) notification.getNewValue(), (List<IJoinColumn>) notification.getOldValue());
- }
- break;
- case Notification.SET :
- if (!notification.isTouch()) {
- specifiedJoinColumnSet(notification.getPosition(), (IJoinColumn) notification.getOldValue(), (IJoinColumn) notification.getNewValue());
- }
- break;
- case Notification.MOVE :
- // Notification.getOldValue() returns the source index
- // Notification.getPositon() returns the target index
- // Notification.getNewValue() returns the moved object
- specifiedJoinColumnMoved(notification.getOldIntValue(), notification.getPosition(), (IJoinColumn) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- @Override
- protected String nameElementName() {
- return JPA.ASSOCIATION_OVERRIDE__NAME;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_ASSOCIATION_OVERRIDE;
- }
-
- public EList<IJoinColumn> getJoinColumns() {
- return this.getSpecifiedJoinColumns().isEmpty() ? this.getDefaultJoinColumns() : this.getSpecifiedJoinColumns();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIAssociationOverride_SpecifiedJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IJoinColumn> getSpecifiedJoinColumns() {
- if (specifiedJoinColumns == null) {
- specifiedJoinColumns = new EObjectContainmentEList<IJoinColumn>(IJoinColumn.class, this, JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS);
- }
- return specifiedJoinColumns;
- }
-
- /**
- * Returns the value of the '<em><b>Default Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIAssociationOverride_DefaultJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IJoinColumn> getDefaultJoinColumns() {
- if (defaultJoinColumns == null) {
- defaultJoinColumns = new EObjectContainmentEList<IJoinColumn>(IJoinColumn.class, this, JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS);
- }
- return defaultJoinColumns;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__JOIN_COLUMNS :
- return ((InternalEList<?>) getJoinColumns()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS :
- return ((InternalEList<?>) getSpecifiedJoinColumns()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS :
- return ((InternalEList<?>) getDefaultJoinColumns()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__JOIN_COLUMNS :
- return getJoinColumns();
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS :
- return getSpecifiedJoinColumns();
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS :
- return getDefaultJoinColumns();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS :
- getSpecifiedJoinColumns().clear();
- getSpecifiedJoinColumns().addAll((Collection<? extends IJoinColumn>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS :
- getDefaultJoinColumns().clear();
- getDefaultJoinColumns().addAll((Collection<? extends IJoinColumn>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS :
- getSpecifiedJoinColumns().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS :
- getDefaultJoinColumns().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__JOIN_COLUMNS :
- return !getJoinColumns().isEmpty();
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS :
- return specifiedJoinColumns != null && !specifiedJoinColumns.isEmpty();
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS :
- return defaultJoinColumns != null && !defaultJoinColumns.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IAssociationOverride.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IASSOCIATION_OVERRIDE__JOIN_COLUMNS;
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS;
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IAssociationOverride.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IASSOCIATION_OVERRIDE__JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- public ITypeMapping typeMapping() {
- return (ITypeMapping) eContainer();
- }
-
- public boolean containsSpecifiedJoinColumns() {
- return !this.getSpecifiedJoinColumns().isEmpty();
- }
-
- public IJoinColumn createJoinColumn(int index) {
- return this.createJavaJoinColumn(index);
- }
-
- private JavaJoinColumn createJavaJoinColumn(int index) {
- return JavaJoinColumn.createAssociationOverrideJoinColumn(this.getDeclarationAnnotationAdapter(), new JoinColumnOwner(this), this.getMember(), index);
- }
-
- // ********** jpa model -> java annotations **********
- /**
- * slide over all the annotations that follow the new join column
- */
- public void specifiedJoinColumnAdded(int index, IJoinColumn joinColumn) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (((JavaJoinColumn) joinColumn).annotation(getMember().astRoot()) == null) {
- this.synchJoinColumnAnnotationsAfterAdd(index + 1);
- ((JavaJoinColumn) joinColumn).newAnnotation();
- }
- }
-
- // bjv look at this
- public void specifiedJoinColumnsAdded(int index, List<IJoinColumn> joinColumns) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (!joinColumns.isEmpty() && ((JavaJoinColumn) joinColumns.get(0)).annotation(getMember().astRoot()) == null) {
- this.synchJoinColumnAnnotationsAfterAdd(index + joinColumns.size());
- for (IJoinColumn joinColumn : joinColumns) {
- ((JavaJoinColumn) joinColumn).newAnnotation();
- }
- }
- }
-
- public void specifiedJoinColumnRemoved(int index, IJoinColumn joinColumn) {
- ((JavaJoinColumn) joinColumn).removeAnnotation();
- this.synchJoinColumnAnnotationsAfterRemove(index);
- }
-
- public void specifiedJoinColumnsRemoved(int[] indexes, List<IJoinColumn> joinColumns) {
- for (IJoinColumn joinColumn : joinColumns) {
- ((JavaJoinColumn) joinColumn).removeAnnotation();
- }
- this.synchJoinColumnAnnotationsAfterRemove(indexes[0]);
- }
-
- public void specifiedJoinColumnsCleared(List<IJoinColumn> joinColumns) {
- for (IJoinColumn joinColumn : joinColumns) {
- ((JavaJoinColumn) joinColumn).removeAnnotation();
- }
- }
-
- public void specifiedJoinColumnSet(int index, IJoinColumn oldJoinColumn, IJoinColumn newJoinColumn) {
- ((JavaJoinColumn) newJoinColumn).newAnnotation();
- }
-
- public void specifiedJoinColumnMoved(int sourceIndex, int targetIndex, IJoinColumn joinColumn) {
- List<IJoinColumn> joinColumns = this.getSpecifiedJoinColumns();
- int begin = Math.min(sourceIndex, targetIndex);
- int end = Math.max(sourceIndex, targetIndex);
- for (int i = begin; i-- > end;) {
- this.synch(joinColumns.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the end of the list to prevent overlap
- */
- private void synchJoinColumnAnnotationsAfterAdd(int index) {
- List<IJoinColumn> joinColumns = this.getSpecifiedJoinColumns();
- for (int i = joinColumns.size(); i-- > index;) {
- this.synch(joinColumns.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the specified index to prevent overlap
- */
- private void synchJoinColumnAnnotationsAfterRemove(int index) {
- List<IJoinColumn> joinColumns = this.getSpecifiedJoinColumns();
- for (int i = index; i < joinColumns.size(); i++) {
- this.synch(joinColumns.get(i), i);
- }
- }
-
- private void synch(IJoinColumn joinColumn, int index) {
- ((JavaJoinColumn) joinColumn).moveAnnotation(index);
- }
-
- @Override
- protected Iterator<String> candidateNames() {
- return this.getOwner().getTypeMapping().allOverridableAssociationNames();
- }
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (IJoinColumn column : this.getJoinColumns()) {
- result = ((JavaJoinColumn) column).candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- updateSpecifiedJoinColumnsFromJava(astRoot);
- }
-
- /**
- * here we just worry about getting the join column lists the same size;
- * then we delegate to the join columns to synch themselves up
- */
- private void updateSpecifiedJoinColumnsFromJava(CompilationUnit astRoot) {
- // synchronize the model join columns with the Java source
- List<IJoinColumn> joinColumns = getSpecifiedJoinColumns();
- int persSize = joinColumns.size();
- int javaSize = 0;
- boolean allJavaAnnotationsFound = false;
- for (int i = 0; i < persSize; i++) {
- JavaJoinColumn joinColumn = (JavaJoinColumn) joinColumns.get(i);
- if (joinColumn.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- break; // no need to go any further
- }
- joinColumn.updateFromJava(astRoot);
- javaSize++;
- }
- if (allJavaAnnotationsFound) {
- // remove any model join columns beyond those that correspond to the Java annotations
- while (persSize > javaSize) {
- persSize--;
- joinColumns.remove(persSize);
- }
- }
- else {
- // add new model join columns until they match the Java annotations
- while (!allJavaAnnotationsFound) {
- JavaJoinColumn joinColumn = this.createJavaJoinColumn(javaSize);
- if (joinColumn.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- }
- else {
- getSpecifiedJoinColumns().add(joinColumn);
- joinColumn.updateFromJava(astRoot);
- javaSize++;
- }
- }
- }
- }
-
- static JavaAssociationOverride createAssociationOverride(Owner owner, Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaAssociationOverride(owner, member, buildAnnotationAdapter(index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildAnnotationAdapter(int index) {
- return new CombinationIndexedDeclarationAnnotationAdapter(SINGLE_DECLARATION_ANNOTATION_ADAPTER, MULTIPLE_DECLARATION_ANNOTATION_ADAPTER, index, JPA.ASSOCIATION_OVERRIDE);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeMapping.java
deleted file mode 100644
index c92d571d96..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeMapping.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.JavaEObject;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.db.internal.Table;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Attribute Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaAttributeMapping()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class JavaAttributeMapping extends JavaEObject
- implements IJavaAttributeMapping
-{
- private final Attribute attribute;
-
- // TODO remove?
- @SuppressWarnings("unused")
- private final AnnotationAdapter annotationAdapter;
-
- protected JavaAttributeMapping() {
- throw new UnsupportedOperationException("Use JavaAttributeMapping(Attribute) instead");
- }
-
- protected JavaAttributeMapping(Attribute attribute) {
- super();
- this.attribute = attribute;
- this.annotationAdapter = this.buildAnnotationAdapter(this.declarationAnnotationAdapter());
- }
-
- /**
- * Return the declaration adapter for the mapping's annotation.
- */
- protected abstract DeclarationAnnotationAdapter declarationAnnotationAdapter();
-
- /**
- * Build and return an adapter for the mapping's annotation.
- */
- protected AnnotationAdapter buildAnnotationAdapter(DeclarationAnnotationAdapter daa) {
- return new MemberAnnotationAdapter(this.attribute, daa);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_ATTRIBUTE_MAPPING;
- }
-
- public JavaPersistentAttribute getPersistentAttribute() {
- return (JavaPersistentAttribute) this.eContainer();
- }
-
- /**
- * the persistent attribute can tell whether there is a "specified" mapping
- * or a "default" one
- */
- public boolean isDefault() {
- return this.getPersistentAttribute().mappingIsDefault();
- }
-
- public ITypeMapping typeMapping() {
- return this.getPersistentAttribute().typeMapping();
- }
-
- public Attribute getAttribute() {
- return this.attribute;
- }
-
- public ITextRange validationTextRange() {
- ITextRange textRange = this.attribute.annotationTextRange(this.declarationAnnotationAdapter());
- return (textRange == null) ? this.getPersistentAttribute().validationTextRange() : textRange;
- }
-
- protected ITextRange elementTextRange(DeclarationAnnotationElementAdapter<?> elementAdapter) {
- return this.elementTextRange(this.attribute.annotationElementTextRange(elementAdapter));
- }
-
- protected IType jdtType() {
- return this.typeMapping().getPersistentType().findJdtType();
- }
-
- public void updateFromJava(CompilationUnit astRoot) {
- // do nothing - override as appropriate
- }
-
- protected INamedColumn.Owner buildColumnOwner() {
- return new ColumnOwner();
- }
-
- public void refreshDefaults(DefaultsContext defaultsContext) {
- // do nothing - override as appropriate
- }
-
- public String primaryKeyColumnName() {
- return null;
- }
-
- protected boolean elementTouches(DeclarationAnnotationElementAdapter<?> elementAdapter, int pos) {
- return this.elementTouches(this.attribute.annotationElementTextRange(elementAdapter), pos);
- }
-
- protected boolean elementTouches(DeclarationAnnotationElementAdapter<?> elementAdapter, int pos, CompilationUnit astRoot) {
- return this.elementTouches(this.attribute.annotationElementTextRange(elementAdapter, astRoot), pos);
- }
-
- public boolean isOverridableAttributeMapping() {
- return false;
- }
-
- public boolean isOverridableAssociationMapping() {
- return false;
- }
-
- public boolean isIdMapping() {
- return false;
- }
-
-
- /**
- * mapping implementation of column owner
- */
- protected class ColumnOwner implements INamedColumn.Owner
- {
- public ITypeMapping getTypeMapping() {
- return JavaAttributeMapping.this.typeMapping();
- }
-
- public ITextRange validationTextRange() {
- return JavaAttributeMapping.this.validationTextRange();
- }
-
- public Table dbTable(String tableName) {
- return this.getTypeMapping().dbTable(tableName);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeOverride.java
deleted file mode 100644
index 467b5a512d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaAttributeOverride.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.jdtutility.CombinationIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.utility.internal.Filter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Attribute Override</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaAttributeOverride()
- * @model kind="class"
- * @generated
- */
-public class JavaAttributeOverride extends JavaOverride
- implements IAttributeOverride
-{
- /**
- * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getColumn()
- * @generated
- * @ordered
- */
- protected IColumn column;
-
- public static final SimpleDeclarationAnnotationAdapter SINGLE_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ATTRIBUTE_OVERRIDE);
-
- public static final SimpleDeclarationAnnotationAdapter MULTIPLE_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ATTRIBUTE_OVERRIDES);
-
- protected JavaAttributeOverride() {
- throw new UnsupportedOperationException("use JavaAttributeOverride(Owner, Member, IndexedDeclarationAnnotationAdapter)");
- }
-
- protected JavaAttributeOverride(Owner owner, Member member, IndexedDeclarationAnnotationAdapter daa) {
- super(owner, member, daa);
- this.column = JavaColumn.createAttributeOverrideColumn(this.buildColumnOwner(), member, daa);
- ((InternalEObject) this.column).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ATTRIBUTE_OVERRIDE__COLUMN, null, null);
- }
-
- @Override
- protected String nameElementName() {
- return JPA.ATTRIBUTE_OVERRIDE__NAME;
- }
-
- // TODO figure out how to use [stupid] EMF to implement the Column.Owner interface directly
- protected INamedColumn.Owner buildColumnOwner() {
- return new ColumnOwner();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_ATTRIBUTE_OVERRIDE;
- }
-
- /**
- * Returns the value of the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIAttributeOverride_Column()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- public IColumn getColumn() {
- return column;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetColumn(IColumn newColumn, NotificationChain msgs) {
- IColumn oldColumn = column;
- column = newColumn;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ATTRIBUTE_OVERRIDE__COLUMN, oldColumn, newColumn);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ATTRIBUTE_OVERRIDE__COLUMN :
- return basicSetColumn(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ATTRIBUTE_OVERRIDE__COLUMN :
- return getColumn();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ATTRIBUTE_OVERRIDE__COLUMN :
- return column != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IColumnMapping.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IAttributeOverride.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_ATTRIBUTE_OVERRIDE__COLUMN :
- return JpaCoreMappingsPackage.IATTRIBUTE_OVERRIDE__COLUMN;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IColumnMapping.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IAttributeOverride.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IATTRIBUTE_OVERRIDE__COLUMN :
- return JpaJavaMappingsPackage.JAVA_ATTRIBUTE_OVERRIDE__COLUMN;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- this.getJavaColumn().updateFromJava(astRoot);
- }
-
- private JavaColumn getJavaColumn() {
- return (JavaColumn) this.column;
- }
-
- @Override
- protected Iterator<String> candidateNames() {
- return this.getOwner().getTypeMapping().allOverridableAttributeNames();
- }
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.getJavaColumn().candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
- // ********** static methods **********
- static JavaAttributeOverride createAttributeOverride(Owner owner, Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaAttributeOverride(owner, member, buildAnnotationAdapter(index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildAnnotationAdapter(int index) {
- return new CombinationIndexedDeclarationAnnotationAdapter(SINGLE_DECLARATION_ANNOTATION_ADAPTER, MULTIPLE_DECLARATION_ANNOTATION_ADAPTER, index, JPA.ATTRIBUTE_OVERRIDE);
- }
-
-
- // ********** member class **********
- public class ColumnOwner implements INamedColumn.Owner
- {
- public ITypeMapping getTypeMapping() {
- return JavaAttributeOverride.this.getOwner().getTypeMapping();
- }
-
- public ITextRange validationTextRange() {
- return JavaAttributeOverride.this.validationTextRange();
- }
-
- public Table dbTable(String tableName) {
- return this.getTypeMapping().dbTable(tableName);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaBasic.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaBasic.java
deleted file mode 100644
index 94c40f9d46..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaBasic.java
+++ /dev/null
@@ -1,779 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.BooleanAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.BooleanStringExpressionConverter;
-import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleBooleanAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.EnumType;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.TemporalType;
-import org.eclipse.jpt.utility.internal.Filter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Basic</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaBasic()
- * @model kind="class"
- * @generated
- */
-public class JavaBasic extends JavaAttributeMapping implements IJavaBasic
-{
- private final AnnotationElementAdapter<String> optionalAdapter;
-
- private final AnnotationElementAdapter<String> fetchAdapter;
-
- private final AnnotationAdapter temporalAnnotationAdapter;
-
- private final AnnotationElementAdapter<String> temporalValueAdapter;
-
- private final AnnotationAdapter enumeratedAnnotationAdapter;
-
- private final AnnotationElementAdapter<String> enumeratedValueAdapter;
-
- private final BooleanAnnotationAdapter lobAdapter;
-
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.BASIC);
-
- private static final DeclarationAnnotationElementAdapter<String> OPTIONAL_ADAPTER = buildOptionalAdapter();
-
- private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter();
-
- public static final DeclarationAnnotationAdapter TEMPORAL_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.TEMPORAL);
-
- private static final DeclarationAnnotationElementAdapter<String> TEMPORAL_VALUE_ADAPTER = buildTemporalValueAdapter();
-
- public static final DeclarationAnnotationAdapter ENUMERATED_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ENUMERATED);
-
- private static final DeclarationAnnotationElementAdapter<String> ENUMERATED_VALUE_ADAPTER = buildEnumeratedValueAdapter();
-
- public static final DeclarationAnnotationAdapter LOB_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.LOB);
-
- /**
- * The default value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getFetch()
- * @generated
- * @ordered
- */
- protected static final DefaultEagerFetchType FETCH_EDEFAULT = DefaultEagerFetchType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getFetch()
- * @generated
- * @ordered
- */
- protected DefaultEagerFetchType fetch = FETCH_EDEFAULT;
-
- /**
- * The default value of the '{@link #getOptional() <em>Optional</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getOptional()
- * @generated
- * @ordered
- */
- protected static final DefaultTrueBoolean OPTIONAL_EDEFAULT = DefaultTrueBoolean.DEFAULT;
-
- /**
- * The cached value of the '{@link #getOptional() <em>Optional</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getOptional()
- * @generated
- * @ordered
- */
- protected DefaultTrueBoolean optional = OPTIONAL_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getColumn()
- * @generated
- * @ordered
- */
- protected IColumn column;
-
- /**
- * The default value of the '{@link #isLob() <em>Lob</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isLob()
- * @generated
- * @ordered
- */
- protected static final boolean LOB_EDEFAULT = false;
-
- /**
- * The cached value of the '{@link #isLob() <em>Lob</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isLob()
- * @generated
- * @ordered
- */
- protected boolean lob = LOB_EDEFAULT;
-
- /**
- * The default value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTemporal()
- * @generated
- * @ordered
- */
- protected static final TemporalType TEMPORAL_EDEFAULT = TemporalType.NULL;
-
- /**
- * The cached value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTemporal()
- * @generated
- * @ordered
- */
- protected TemporalType temporal = TEMPORAL_EDEFAULT;
-
- /**
- * The default value of the '{@link #getEnumerated() <em>Enumerated</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getEnumerated()
- * @generated
- * @ordered
- */
- protected static final EnumType ENUMERATED_EDEFAULT = EnumType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getEnumerated() <em>Enumerated</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getEnumerated()
- * @generated
- * @ordered
- */
- protected EnumType enumerated = ENUMERATED_EDEFAULT;
-
- protected JavaBasic() {
- this(null);
- }
-
- protected JavaBasic(Attribute attribute) {
- super(attribute);
- this.column = JavaColumn.createColumnMappingColumn(buildColumnOwner(), getAttribute());
- ((InternalEObject) this.column).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_BASIC__COLUMN, null, null);
- this.optionalAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, OPTIONAL_ADAPTER);
- this.fetchAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, FETCH_ADAPTER);
- this.lobAdapter = new SimpleBooleanAnnotationAdapter(new MemberAnnotationAdapter(attribute, LOB_ADAPTER));
- this.temporalAnnotationAdapter = new MemberAnnotationAdapter(this.getAttribute(), TEMPORAL_ADAPTER);
- this.temporalValueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, TEMPORAL_VALUE_ADAPTER);
- this.enumeratedAnnotationAdapter = new MemberAnnotationAdapter(this.getAttribute(), ENUMERATED_ADAPTER);
- this.enumeratedValueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, ENUMERATED_VALUE_ADAPTER);
- }
-
- @Override
- protected DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IBasic.class)) {
- case JpaJavaMappingsPackage.JAVA_BASIC__FETCH :
- this.fetchAdapter.setValue(((DefaultEagerFetchType) notification.getNewValue()).convertToJavaAnnotationValue());
- break;
- case JpaJavaMappingsPackage.JAVA_BASIC__OPTIONAL :
- this.optionalAdapter.setValue(((DefaultTrueBoolean) notification.getNewValue()).convertToJavaAnnotationValue());
- break;
- case JpaJavaMappingsPackage.JAVA_BASIC__LOB :
- this.lobAdapter.setValue(notification.getNewBooleanValue());
- break;
- case JpaJavaMappingsPackage.JAVA_BASIC__TEMPORAL :
- TemporalType newTemporal = (TemporalType) notification.getNewValue();
- if (newTemporal == TemporalType.NULL) {
- this.temporalAnnotationAdapter.removeAnnotation();
- }
- else {
- this.temporalValueAdapter.setValue(newTemporal.convertToJavaAnnotationValue());
- }
- break;
- case JpaJavaMappingsPackage.JAVA_BASIC__ENUMERATED :
- EnumType newEnumerated = (EnumType) notification.getNewValue();
- if (newEnumerated == EnumType.DEFAULT) {
- this.enumeratedAnnotationAdapter.removeAnnotation();
- }
- else {
- this.enumeratedValueAdapter.setValue(newEnumerated.convertToJavaAnnotationValue());
- }
- break;
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_BASIC;
- }
-
- /**
- * Returns the value of the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIBasic_Column()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- public IColumn getColumn() {
- return column;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetColumn(IColumn newColumn, NotificationChain msgs) {
- IColumn oldColumn = column;
- column = newColumn;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_BASIC__COLUMN, oldColumn, newColumn);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Returns the value of the '<em><b>Fetch</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Fetch</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType
- * @see #setFetch(DefaultEagerFetchType)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIBasic_Fetch()
- * @model
- * @generated
- */
- public DefaultEagerFetchType getFetch() {
- return fetch;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic#getFetch <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType
- * @see #getFetch()
- * @generated
- */
- public void setFetch(DefaultEagerFetchType newFetch) {
- DefaultEagerFetchType oldFetch = fetch;
- fetch = newFetch == null ? FETCH_EDEFAULT : newFetch;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_BASIC__FETCH, oldFetch, fetch));
- }
-
- /**
- * Returns the value of the '<em><b>Optional</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Optional</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Optional</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setOptional(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIBasic_Optional()
- * @model
- * @generated
- */
- public DefaultTrueBoolean getOptional() {
- return optional;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic#getOptional <em>Optional</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Optional</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getOptional()
- * @generated
- */
- public void setOptional(DefaultTrueBoolean newOptional) {
- DefaultTrueBoolean oldOptional = optional;
- optional = newOptional == null ? OPTIONAL_EDEFAULT : newOptional;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_BASIC__OPTIONAL, oldOptional, optional));
- }
-
- /**
- * Returns the value of the '<em><b>Lob</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Lob</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Lob</em>' attribute.
- * @see #setLob(boolean)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIBasic_Lob()
- * @model
- * @generated
- */
- public boolean isLob() {
- return lob;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic#isLob <em>Lob</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Lob</em>' attribute.
- * @see #isLob()
- * @generated
- */
- public void setLob(boolean newLob) {
- boolean oldLob = lob;
- lob = newLob;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_BASIC__LOB, oldLob, lob));
- }
-
- /**
- * Returns the value of the '<em><b>Temporal</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.TemporalType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Temporal</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @see #setTemporal(TemporalType)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIBasic_Temporal()
- * @model
- * @generated
- */
- public TemporalType getTemporal() {
- return temporal;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic#getTemporal <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @see #getTemporal()
- * @generated
- */
- public void setTemporal(TemporalType newTemporal) {
- TemporalType oldTemporal = temporal;
- temporal = newTemporal == null ? TEMPORAL_EDEFAULT : newTemporal;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_BASIC__TEMPORAL, oldTemporal, temporal));
- }
-
- /**
- * Returns the value of the '<em><b>Enumerated</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.EnumType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Enumerated</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Enumerated</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.EnumType
- * @see #setEnumerated(EnumType)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIBasic_Enumerated()
- * @model
- * @generated
- */
- public EnumType getEnumerated() {
- return enumerated;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic#getEnumerated <em>Enumerated</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Enumerated</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.EnumType
- * @see #getEnumerated()
- * @generated
- */
- public void setEnumerated(EnumType newEnumerated) {
- EnumType oldEnumerated = enumerated;
- enumerated = newEnumerated == null ? ENUMERATED_EDEFAULT : newEnumerated;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_BASIC__ENUMERATED, oldEnumerated, enumerated));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_BASIC__COLUMN :
- return basicSetColumn(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_BASIC__FETCH :
- return getFetch();
- case JpaJavaMappingsPackage.JAVA_BASIC__OPTIONAL :
- return getOptional();
- case JpaJavaMappingsPackage.JAVA_BASIC__COLUMN :
- return getColumn();
- case JpaJavaMappingsPackage.JAVA_BASIC__LOB :
- return isLob() ? Boolean.TRUE : Boolean.FALSE;
- case JpaJavaMappingsPackage.JAVA_BASIC__TEMPORAL :
- return getTemporal();
- case JpaJavaMappingsPackage.JAVA_BASIC__ENUMERATED :
- return getEnumerated();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_BASIC__FETCH :
- setFetch((DefaultEagerFetchType) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_BASIC__OPTIONAL :
- setOptional((DefaultTrueBoolean) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_BASIC__LOB :
- setLob(((Boolean) newValue).booleanValue());
- return;
- case JpaJavaMappingsPackage.JAVA_BASIC__TEMPORAL :
- setTemporal((TemporalType) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_BASIC__ENUMERATED :
- setEnumerated((EnumType) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_BASIC__FETCH :
- setFetch(FETCH_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_BASIC__OPTIONAL :
- setOptional(OPTIONAL_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_BASIC__LOB :
- setLob(LOB_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_BASIC__TEMPORAL :
- setTemporal(TEMPORAL_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_BASIC__ENUMERATED :
- setEnumerated(ENUMERATED_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_BASIC__FETCH :
- return fetch != FETCH_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_BASIC__OPTIONAL :
- return optional != OPTIONAL_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_BASIC__COLUMN :
- return column != null;
- case JpaJavaMappingsPackage.JAVA_BASIC__LOB :
- return lob != LOB_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_BASIC__TEMPORAL :
- return temporal != TEMPORAL_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_BASIC__ENUMERATED :
- return enumerated != ENUMERATED_EDEFAULT;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IColumnMapping.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IBasic.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_BASIC__FETCH :
- return JpaCoreMappingsPackage.IBASIC__FETCH;
- case JpaJavaMappingsPackage.JAVA_BASIC__OPTIONAL :
- return JpaCoreMappingsPackage.IBASIC__OPTIONAL;
- case JpaJavaMappingsPackage.JAVA_BASIC__COLUMN :
- return JpaCoreMappingsPackage.IBASIC__COLUMN;
- case JpaJavaMappingsPackage.JAVA_BASIC__LOB :
- return JpaCoreMappingsPackage.IBASIC__LOB;
- case JpaJavaMappingsPackage.JAVA_BASIC__TEMPORAL :
- return JpaCoreMappingsPackage.IBASIC__TEMPORAL;
- case JpaJavaMappingsPackage.JAVA_BASIC__ENUMERATED :
- return JpaCoreMappingsPackage.IBASIC__ENUMERATED;
- default :
- return -1;
- }
- }
- if (baseClass == IJavaBasic.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IColumnMapping.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IBasic.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IBASIC__FETCH :
- return JpaJavaMappingsPackage.JAVA_BASIC__FETCH;
- case JpaCoreMappingsPackage.IBASIC__OPTIONAL :
- return JpaJavaMappingsPackage.JAVA_BASIC__OPTIONAL;
- case JpaCoreMappingsPackage.IBASIC__COLUMN :
- return JpaJavaMappingsPackage.JAVA_BASIC__COLUMN;
- case JpaCoreMappingsPackage.IBASIC__LOB :
- return JpaJavaMappingsPackage.JAVA_BASIC__LOB;
- case JpaCoreMappingsPackage.IBASIC__TEMPORAL :
- return JpaJavaMappingsPackage.JAVA_BASIC__TEMPORAL;
- case JpaCoreMappingsPackage.IBASIC__ENUMERATED :
- return JpaJavaMappingsPackage.JAVA_BASIC__ENUMERATED;
- default :
- return -1;
- }
- }
- if (baseClass == IJavaBasic.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (fetch: ");
- result.append(fetch);
- result.append(", optional: ");
- result.append(optional);
- result.append(", lob: ");
- result.append(lob);
- result.append(", temporal: ");
- result.append(temporal);
- result.append(", enumerated: ");
- result.append(enumerated);
- result.append(')');
- return result.toString();
- }
-
- public String getKey() {
- return IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- this.setOptional(DefaultTrueBoolean.fromJavaAnnotationValue(this.optionalAdapter.getValue(astRoot)));
- this.setFetch(DefaultEagerFetchType.fromJavaAnnotationValue(this.fetchAdapter.getValue(astRoot)));
- this.getJavaColumn().updateFromJava(astRoot);
- this.setLob(this.lobAdapter.getValue(astRoot));
- this.updateTemporalFromJava(astRoot);
- this.updateEnumeratedFromJava(astRoot);
- }
-
- private JavaColumn getJavaColumn() {
- return (JavaColumn) this.column;
- }
-
- /*
- * The @Temporal annotation is a bit different than most JPA annotations.
- * For some indecipherable reason it has no default value (e.g. TIMESTAMP).
- * Also, it is *required* for any attribute declared with a type of
- * java.util.Date or java.util.Calendar; otherwise, it is *prohibited*.
- * As a result we allow a Basic mapping to have a null 'temporal',
- * indicating that the annotation is completely missing, as opposed
- * to the annotation being present but its value is invalid (e.g.
- * @Temporal(FRIDAY)).
- *
- * TODO this comment is wrong now, revisit this with Brian at some point
- */
- private void updateTemporalFromJava(CompilationUnit astRoot) {
- if (this.temporalAnnotationAdapter.getAnnotation(astRoot) == null) {
- this.setTemporal(TemporalType.NULL);
- }
- else {
- this.setTemporal(TemporalType.fromJavaAnnotationValue(this.temporalValueAdapter.getValue(astRoot)));
- }
- }
-
- private void updateEnumeratedFromJava(CompilationUnit astRoot) {
- if (this.enumeratedAnnotationAdapter.getAnnotation(astRoot) == null) {
- this.setEnumerated(EnumType.DEFAULT);
- }
- else {
- this.setEnumerated(EnumType.fromJavaAnnotationValue(this.enumeratedValueAdapter.getValue(astRoot)));
- }
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter<String> buildOptionalAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, JPA.BASIC__OPTIONAL, false, BooleanStringExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.BASIC__FETCH, false);
- }
-
- @Override
- public boolean isOverridableAttributeMapping() {
- return true;
- }
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.getJavaColumn().candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter<String> buildTemporalValueAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(TEMPORAL_ADAPTER, JPA.TEMPORAL__VALUE, false);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildEnumeratedValueAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(ENUMERATED_ADAPTER, JPA.ENUMERATED__VALUE, false);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaBasicProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaBasicProvider.java
deleted file mode 100644
index 444c9476b8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaBasicProvider.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jpt.core.internal.IJpaFactory;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.content.java.IDefaultJavaAttributeMappingProvider;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- *
- */
-public class JavaBasicProvider
- implements IDefaultJavaAttributeMappingProvider
-{
-
- // singleton
- private static final JavaBasicProvider INSTANCE = new JavaBasicProvider();
-
- /**
- * Return the singleton.
- */
- public static IDefaultJavaAttributeMappingProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private JavaBasicProvider() {
- super();
- }
-
- public String key() {
- return IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
- }
-
- public boolean defaultApplies(Attribute attribute, DefaultsContext defaultsContext) {
- CompilationUnit astRoot = defaultsContext.astRoot();
- return typeIsBasic(attribute.typeBinding(astRoot), astRoot.getAST());
- }
-
- public IJavaAttributeMapping buildMapping(Attribute attribute, IJpaFactory factory) {
- return factory.createJavaBasic(attribute);
- }
-
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return JavaBasic.DECLARATION_ANNOTATION_ADAPTER;
- }
-
- // ********** static methods **********
-
- /**
- * From the JPA spec, when the basic mapping applies:
- * If the type of the attribute (field or property) is one of the following
- * it must be mapped as @Basic:
- * primitive types
- * byte[]
- * Byte[]
- * char[]
- * Character[]
- * primitive wrappers
- * java.lang.String
- * java.math.BigInteger
- * java.math.BigDecimal
- * java.util.Date
- * java.util.Calendar
- * java.sql.Date
- * java.sql.Time
- * java.sql.Timestamp
- * enums
- * any other type that implements java.io.Serializable
- */
- public static boolean typeIsBasic(ITypeBinding typeBinding, AST ast) {
- if (typeBinding == null) {
- return false; // type not found
- }
- if (typeBinding.isPrimitive()) {
- return true;
- }
- if (typeBinding.isArray()) {
- if (typeBinding.getDimensions() > 1) {
- return false; // multi-dimensional arrays are not supported
- }
- ITypeBinding elementTypeBinding = typeBinding.getElementType();
- if (elementTypeBinding == null) {
- return false;// unable to resolve the type
- }
- return elementTypeIsValid(elementTypeBinding.getQualifiedName());
- }
- String typeName = typeBinding.getQualifiedName();
- if (typeIsPrimitiveWrapper(typeName)) {
- return true;
- }
- if (typeIsOtherSupportedType(typeName)) {
- return true;
- }
- if (typeBinding.isEnum()) {
- return true;
- }
- if (typeImplementsSerializable(typeBinding, ast)) {
- return true;
- }
- return false;
- }
-
- /**
- * Return whether the specified type is a valid element type for
- * a one-dimensional array:
- * byte
- * char
- * java.lang.Byte
- * java.lang.Character
- */
- private static boolean elementTypeIsValid(String elementTypeName) {
- return CollectionTools.contains(VALID_ELEMENT_TYPE_NAMES, elementTypeName);
- }
-
- private static final String[] VALID_ELEMENT_TYPE_NAMES = {
- byte.class.getName(),
- char.class.getName(),
- java.lang.Byte.class.getName(),
- java.lang.Character.class.getName()
- };
-
- /**
- * Return whether the specified type is a primitive wrapper.
- */
- private static boolean typeIsPrimitiveWrapper(String typeName) {
- return CollectionTools.contains(PRIMITIVE_WRAPPER_TYPE_NAMES, typeName);
- }
-
- private static final String[] PRIMITIVE_WRAPPER_TYPE_NAMES = {
- java.lang.Byte.class.getName(),
- java.lang.Character.class.getName(),
- java.lang.Double.class.getName(),
- java.lang.Float.class.getName(),
- java.lang.Integer.class.getName(),
- java.lang.Long.class.getName(),
- java.lang.Short.class.getName(),
- java.lang.Boolean.class.getName(),
- };
-
- /**
- * Return whether the specified type is among the various other types
- * that default to a Basic mapping.
- */
- private static boolean typeIsOtherSupportedType(String typeName) {
- return CollectionTools.contains(OTHER_SUPPORTED_TYPE_NAMES, typeName);
- }
-
- private static final String[] OTHER_SUPPORTED_TYPE_NAMES = {
- java.lang.String.class.getName(),
- java.math.BigInteger.class.getName(),
- java.math.BigDecimal.class.getName(),
- java.util.Date.class.getName(),
- java.util.Calendar.class.getName(),
- java.sql.Date.class.getName(),
- java.sql.Time.class.getName(),
- java.sql.Timestamp.class.getName(),
- };
-
- /**
- * Return whether the specified type implements java.io.Serializable.
- */
- private static boolean typeImplementsSerializable(ITypeBinding typeBinding, AST ast) {
- ITypeBinding serializableTypeBinding = ast.resolveWellKnownType(SERIALIZABLE_TYPE_NAME);
- return typeBinding.isAssignmentCompatible(serializableTypeBinding);
- }
-
- private static final String SERIALIZABLE_TYPE_NAME = java.io.Serializable.class.getName();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaCascade.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaCascade.java
deleted file mode 100644
index d5998f5f61..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaCascade.java
+++ /dev/null
@@ -1,583 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.content.java.JavaEObject;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitArrayAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.mappings.CascadeType;
-import org.eclipse.jpt.core.internal.mappings.ICascade;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Cascade</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaCascade()
- * @model kind="class"
- * @generated
- */
-public class JavaCascade extends JavaEObject implements ICascade
-{
- /**
- * The default value of the '{@link #isAll() <em>All</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isAll()
- * @generated
- * @ordered
- */
- protected static final boolean ALL_EDEFAULT = false;
-
- /**
- * The cached value of the '{@link #isAll() <em>All</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isAll()
- * @generated
- * @ordered
- */
- protected boolean all = ALL_EDEFAULT;
-
- /**
- * The default value of the '{@link #isPersist() <em>Persist</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isPersist()
- * @generated
- * @ordered
- */
- protected static final boolean PERSIST_EDEFAULT = false;
-
- /**
- * The cached value of the '{@link #isPersist() <em>Persist</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isPersist()
- * @generated
- * @ordered
- */
- protected boolean persist = PERSIST_EDEFAULT;
-
- /**
- * The default value of the '{@link #isMerge() <em>Merge</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isMerge()
- * @generated
- * @ordered
- */
- protected static final boolean MERGE_EDEFAULT = false;
-
- /**
- * The cached value of the '{@link #isMerge() <em>Merge</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isMerge()
- * @generated
- * @ordered
- */
- protected boolean merge = MERGE_EDEFAULT;
-
- /**
- * The default value of the '{@link #isRemove() <em>Remove</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isRemove()
- * @generated
- * @ordered
- */
- protected static final boolean REMOVE_EDEFAULT = false;
-
- /**
- * The cached value of the '{@link #isRemove() <em>Remove</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isRemove()
- * @generated
- * @ordered
- */
- protected boolean remove = REMOVE_EDEFAULT;
-
- /**
- * The default value of the '{@link #isRefresh() <em>Refresh</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isRefresh()
- * @generated
- * @ordered
- */
- protected static final boolean REFRESH_EDEFAULT = false;
-
- /**
- * The cached value of the '{@link #isRefresh() <em>Refresh</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isRefresh()
- * @generated
- * @ordered
- */
- protected boolean refresh = REFRESH_EDEFAULT;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected JavaCascade() {
- super();
- }
-
- private Attribute attribute;
-
- private AnnotationElementAdapter<String[]> cascadeAdapter;
-
- private DeclarationAnnotationElementAdapter<String[]> cascadeDeclarationAdapter;
-
- protected JavaCascade(Attribute attribute, DeclarationAnnotationElementAdapter<String[]> cascadeAdapter) {
- super();
- this.attribute = attribute;
- this.cascadeDeclarationAdapter = cascadeAdapter;
- this.cascadeAdapter = new ShortCircuitArrayAnnotationElementAdapter<String>(this.attribute, cascadeAdapter);
- }
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(ICascade.class)) {
- case JpaJavaMappingsPackage.JAVA_CASCADE__ALL :
- updateJavaAnnotation(isAll(), CascadeType.ALL);
- break;
- case JpaJavaMappingsPackage.JAVA_CASCADE__MERGE :
- updateJavaAnnotation(isMerge(), CascadeType.MERGE);
- break;
- case JpaJavaMappingsPackage.JAVA_CASCADE__PERSIST :
- updateJavaAnnotation(isPersist(), CascadeType.PERSIST);
- break;
- case JpaJavaMappingsPackage.JAVA_CASCADE__REMOVE :
- updateJavaAnnotation(isRemove(), CascadeType.REMOVE);
- break;
- case JpaJavaMappingsPackage.JAVA_CASCADE__REFRESH :
- updateJavaAnnotation(isRefresh(), CascadeType.REFRESH);
- break;
- default :
- break;
- }
- }
-
- private void updateJavaAnnotation(boolean isSet, CascadeType cascadeType) {
- String[] javaValue = this.cascadeAdapter.getValue();
- CascadeType[] cascadeTypes = CascadeType.fromJavaAnnotationValue(javaValue);
- List<CascadeType> cascadeCollection = CollectionTools.list(cascadeTypes);
- if (cascadeCollection.contains(cascadeType)) {
- if (!isSet) {
- if (javaValue.length == 1) {
- this.cascadeAdapter.setValue(null);
- }
- else {
- cascadeCollection.remove(cascadeType);
- String[] newJavaValue = CascadeType.toJavaAnnotationValue(cascadeCollection.toArray(new CascadeType[cascadeCollection.size()]));
- this.cascadeAdapter.setValue(newJavaValue);
- }
- }
- }
- else {
- if (isSet) {
- cascadeCollection.add(cascadeType);
- String[] newJavaValue = CascadeType.toJavaAnnotationValue(cascadeCollection.toArray(new CascadeType[cascadeCollection.size()]));
- this.cascadeAdapter.setValue(newJavaValue);
- }
- }
- }
-
- protected AnnotationElementAdapter<String[]> getCascadeAdapter() {
- return this.cascadeAdapter;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_CASCADE;
- }
-
- /**
- * Returns the value of the '<em><b>All</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>All</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>All</em>' attribute.
- * @see #setAll(boolean)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getICascade_All()
- * @model
- * @generated
- */
- public boolean isAll() {
- return all;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaCascade#isAll <em>All</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>All</em>' attribute.
- * @see #isAll()
- * @generated
- */
- public void setAll(boolean newAll) {
- boolean oldAll = all;
- all = newAll;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_CASCADE__ALL, oldAll, all));
- }
-
- /**
- * Returns the value of the '<em><b>Persist</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Persist</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persist</em>' attribute.
- * @see #setPersist(boolean)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getICascade_Persist()
- * @model
- * @generated
- */
- public boolean isPersist() {
- return persist;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaCascade#isPersist <em>Persist</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Persist</em>' attribute.
- * @see #isPersist()
- * @generated
- */
- public void setPersist(boolean newPersist) {
- boolean oldPersist = persist;
- persist = newPersist;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_CASCADE__PERSIST, oldPersist, persist));
- }
-
- /**
- * Returns the value of the '<em><b>Merge</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Merge</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Merge</em>' attribute.
- * @see #setMerge(boolean)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getICascade_Merge()
- * @model
- * @generated
- */
- public boolean isMerge() {
- return merge;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaCascade#isMerge <em>Merge</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Merge</em>' attribute.
- * @see #isMerge()
- * @generated
- */
- public void setMerge(boolean newMerge) {
- boolean oldMerge = merge;
- merge = newMerge;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_CASCADE__MERGE, oldMerge, merge));
- }
-
- /**
- * Returns the value of the '<em><b>Remove</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Remove</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Remove</em>' attribute.
- * @see #setRemove(boolean)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getICascade_Remove()
- * @model
- * @generated
- */
- public boolean isRemove() {
- return remove;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaCascade#isRemove <em>Remove</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Remove</em>' attribute.
- * @see #isRemove()
- * @generated
- */
- public void setRemove(boolean newRemove) {
- boolean oldRemove = remove;
- remove = newRemove;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_CASCADE__REMOVE, oldRemove, remove));
- }
-
- /**
- * Returns the value of the '<em><b>Refresh</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Refresh</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Refresh</em>' attribute.
- * @see #setRefresh(boolean)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getICascade_Refresh()
- * @model
- * @generated
- */
- public boolean isRefresh() {
- return refresh;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaCascade#isRefresh <em>Refresh</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Refresh</em>' attribute.
- * @see #isRefresh()
- * @generated
- */
- public void setRefresh(boolean newRefresh) {
- boolean oldRefresh = refresh;
- refresh = newRefresh;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_CASCADE__REFRESH, oldRefresh, refresh));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_CASCADE__ALL :
- return isAll() ? Boolean.TRUE : Boolean.FALSE;
- case JpaJavaMappingsPackage.JAVA_CASCADE__PERSIST :
- return isPersist() ? Boolean.TRUE : Boolean.FALSE;
- case JpaJavaMappingsPackage.JAVA_CASCADE__MERGE :
- return isMerge() ? Boolean.TRUE : Boolean.FALSE;
- case JpaJavaMappingsPackage.JAVA_CASCADE__REMOVE :
- return isRemove() ? Boolean.TRUE : Boolean.FALSE;
- case JpaJavaMappingsPackage.JAVA_CASCADE__REFRESH :
- return isRefresh() ? Boolean.TRUE : Boolean.FALSE;
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_CASCADE__ALL :
- setAll(((Boolean) newValue).booleanValue());
- return;
- case JpaJavaMappingsPackage.JAVA_CASCADE__PERSIST :
- setPersist(((Boolean) newValue).booleanValue());
- return;
- case JpaJavaMappingsPackage.JAVA_CASCADE__MERGE :
- setMerge(((Boolean) newValue).booleanValue());
- return;
- case JpaJavaMappingsPackage.JAVA_CASCADE__REMOVE :
- setRemove(((Boolean) newValue).booleanValue());
- return;
- case JpaJavaMappingsPackage.JAVA_CASCADE__REFRESH :
- setRefresh(((Boolean) newValue).booleanValue());
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_CASCADE__ALL :
- setAll(ALL_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_CASCADE__PERSIST :
- setPersist(PERSIST_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_CASCADE__MERGE :
- setMerge(MERGE_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_CASCADE__REMOVE :
- setRemove(REMOVE_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_CASCADE__REFRESH :
- setRefresh(REFRESH_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_CASCADE__ALL :
- return all != ALL_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_CASCADE__PERSIST :
- return persist != PERSIST_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_CASCADE__MERGE :
- return merge != MERGE_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_CASCADE__REMOVE :
- return remove != REMOVE_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_CASCADE__REFRESH :
- return refresh != REFRESH_EDEFAULT;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == ICascade.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_CASCADE__ALL :
- return JpaCoreMappingsPackage.ICASCADE__ALL;
- case JpaJavaMappingsPackage.JAVA_CASCADE__PERSIST :
- return JpaCoreMappingsPackage.ICASCADE__PERSIST;
- case JpaJavaMappingsPackage.JAVA_CASCADE__MERGE :
- return JpaCoreMappingsPackage.ICASCADE__MERGE;
- case JpaJavaMappingsPackage.JAVA_CASCADE__REMOVE :
- return JpaCoreMappingsPackage.ICASCADE__REMOVE;
- case JpaJavaMappingsPackage.JAVA_CASCADE__REFRESH :
- return JpaCoreMappingsPackage.ICASCADE__REFRESH;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == ICascade.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.ICASCADE__ALL :
- return JpaJavaMappingsPackage.JAVA_CASCADE__ALL;
- case JpaCoreMappingsPackage.ICASCADE__PERSIST :
- return JpaJavaMappingsPackage.JAVA_CASCADE__PERSIST;
- case JpaCoreMappingsPackage.ICASCADE__MERGE :
- return JpaJavaMappingsPackage.JAVA_CASCADE__MERGE;
- case JpaCoreMappingsPackage.ICASCADE__REMOVE :
- return JpaJavaMappingsPackage.JAVA_CASCADE__REMOVE;
- case JpaCoreMappingsPackage.ICASCADE__REFRESH :
- return JpaJavaMappingsPackage.JAVA_CASCADE__REFRESH;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (all: ");
- result.append(all);
- result.append(", persist: ");
- result.append(persist);
- result.append(", merge: ");
- result.append(merge);
- result.append(", remove: ");
- result.append(remove);
- result.append(", refresh: ");
- result.append(refresh);
- result.append(')');
- return result.toString();
- }
-
- public Attribute getAttribute() {
- return this.attribute;
- }
-
- public ITextRange validationTextRange() {
- return getAttribute().annotationElementTextRange(this.cascadeDeclarationAdapter);
- }
-
- public void updateFromJava(CompilationUnit astRoot) {
- String[] javaValue = this.cascadeAdapter.getValue(astRoot);
- CascadeType[] cascadeTypes = CascadeType.fromJavaAnnotationValue(javaValue);
- Collection<CascadeType> cascadeCollection = CollectionTools.collection(cascadeTypes);
- setAll(cascadeCollection.contains(CascadeType.ALL));
- setPersist(cascadeCollection.contains(CascadeType.PERSIST));
- setMerge(cascadeCollection.contains(CascadeType.MERGE));
- setRemove(cascadeCollection.contains(CascadeType.REMOVE));
- setRefresh(cascadeCollection.contains(CascadeType.REFRESH));
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaColumn.java
deleted file mode 100644
index b35341659c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaColumn.java
+++ /dev/null
@@ -1,533 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.NestedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Column</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaColumn()
- * @model kind="class"
- * @generated
- */
-public class JavaColumn extends AbstractJavaColumn implements IColumn
-{
- /**
- * The default value of the '{@link #getLength() <em>Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getLength()
- * @generated
- * @ordered
- */
- protected static final int LENGTH_EDEFAULT = 0;
-
- /**
- * The default value of the '{@link #getSpecifiedLength() <em>Specified Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedLength()
- * @generated
- * @ordered
- */
- protected static final int SPECIFIED_LENGTH_EDEFAULT = -1;
-
- /**
- * The cached value of the '{@link #getSpecifiedLength() <em>Specified Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedLength()
- * @generated
- * @ordered
- */
- protected int specifiedLength = SPECIFIED_LENGTH_EDEFAULT;
-
- /**
- * The default value of the '{@link #getPrecision() <em>Precision</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPrecision()
- * @generated
- * @ordered
- */
- protected static final int PRECISION_EDEFAULT = 0;
-
- /**
- * The default value of the '{@link #getSpecifiedPrecision() <em>Specified Precision</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPrecision()
- * @generated
- * @ordered
- */
- protected static final int SPECIFIED_PRECISION_EDEFAULT = -1;
-
- /**
- * The cached value of the '{@link #getSpecifiedPrecision() <em>Specified Precision</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPrecision()
- * @generated
- * @ordered
- */
- protected int specifiedPrecision = SPECIFIED_PRECISION_EDEFAULT;
-
- /**
- * The default value of the '{@link #getScale() <em>Scale</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getScale()
- * @generated
- * @ordered
- */
- protected static final int SCALE_EDEFAULT = 0;
-
- /**
- * The default value of the '{@link #getSpecifiedScale() <em>Specified Scale</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedScale()
- * @generated
- * @ordered
- */
- protected static final int SPECIFIED_SCALE_EDEFAULT = -1;
-
- /**
- * The cached value of the '{@link #getSpecifiedScale() <em>Specified Scale</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedScale()
- * @generated
- * @ordered
- */
- protected int specifiedScale = SPECIFIED_SCALE_EDEFAULT;
-
- private final IntAnnotationElementAdapter lengthAdapter;
-
- private final IntAnnotationElementAdapter precisionAdapter;
-
- private final IntAnnotationElementAdapter scaleAdapter;
-
- // this adapter is only used by a Column annotation associated with a mapping annotation (e.g. Basic)
- public static final SimpleDeclarationAnnotationAdapter MAPPING_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.COLUMN);
-
- protected JavaColumn() {
- super();
- throw new UnsupportedOperationException("Use JavaColumn(Owner, Member, DeclarationAnnotationAdapter) instead");
- }
-
- protected JavaColumn(Owner owner, Member member, DeclarationAnnotationAdapter daa) {
- super(owner, member, daa);
- this.lengthAdapter = this.buildShortCircuitIntElementAdapter(JPA.COLUMN__LENGTH);
- this.precisionAdapter = this.buildShortCircuitIntElementAdapter(JPA.COLUMN__PRECISION);
- this.scaleAdapter = this.buildShortCircuitIntElementAdapter(JPA.COLUMN__SCALE);
- }
-
- @Override
- protected String nameElementName() {
- return JPA.COLUMN__NAME;
- }
-
- @Override
- protected String columnDefinitionElementName() {
- return JPA.COLUMN__COLUMN_DEFINITION;
- }
-
- @Override
- protected String tableElementName() {
- return JPA.COLUMN__TABLE;
- }
-
- @Override
- protected String uniqueElementName() {
- return JPA.COLUMN__UNIQUE;
- }
-
- @Override
- protected String nullableElementName() {
- return JPA.COLUMN__NULLABLE;
- }
-
- @Override
- protected String insertableElementName() {
- return JPA.COLUMN__INSERTABLE;
- }
-
- @Override
- protected String updatableElementName() {
- return JPA.COLUMN__UPDATABLE;
- }
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IColumn.class)) {
- case JpaJavaMappingsPackage.JAVA_COLUMN__LENGTH :
- this.lengthAdapter.setValue(notification.getNewIntValue());
- break;
- case JpaJavaMappingsPackage.JAVA_COLUMN__PRECISION :
- this.precisionAdapter.setValue(notification.getNewIntValue());
- break;
- case JpaJavaMappingsPackage.JAVA_COLUMN__SCALE :
- this.scaleAdapter.setValue(notification.getNewIntValue());
- break;
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_COLUMN;
- }
-
- public int getLength() {
- return (this.getSpecifiedLength() == SPECIFIED_LENGTH_EDEFAULT) ? getDefaultLength() : this.getSpecifiedLength();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Length</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Length</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Length</em>' attribute.
- * @see #setSpecifiedLength(int)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIColumn_SpecifiedLength()
- * @model default="-1"
- * @generated
- */
- public int getSpecifiedLength() {
- return specifiedLength;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaColumn#getSpecifiedLength <em>Specified Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Length</em>' attribute.
- * @see #getSpecifiedLength()
- * @generated
- */
- public void setSpecifiedLength(int newSpecifiedLength) {
- int oldSpecifiedLength = specifiedLength;
- specifiedLength = newSpecifiedLength;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_LENGTH, oldSpecifiedLength, specifiedLength));
- }
-
- public int getPrecision() {
- return (this.getSpecifiedPrecision() == SPECIFIED_PRECISION_EDEFAULT) ? getDefaultPrecision() : this.getSpecifiedPrecision();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Precision</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Precision</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Precision</em>' attribute.
- * @see #setSpecifiedPrecision(int)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIColumn_SpecifiedPrecision()
- * @model default="-1"
- * @generated
- */
- public int getSpecifiedPrecision() {
- return specifiedPrecision;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaColumn#getSpecifiedPrecision <em>Specified Precision</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Precision</em>' attribute.
- * @see #getSpecifiedPrecision()
- * @generated
- */
- public void setSpecifiedPrecision(int newSpecifiedPrecision) {
- int oldSpecifiedPrecision = specifiedPrecision;
- specifiedPrecision = newSpecifiedPrecision;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_PRECISION, oldSpecifiedPrecision, specifiedPrecision));
- }
-
- public int getScale() {
- return (this.getSpecifiedScale() == SPECIFIED_SCALE_EDEFAULT) ? getDefaultScale() : this.getSpecifiedScale();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Scale</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Scale</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Scale</em>' attribute.
- * @see #setSpecifiedScale(int)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIColumn_SpecifiedScale()
- * @model default="-1"
- * @generated
- */
- public int getSpecifiedScale() {
- return specifiedScale;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaColumn#getSpecifiedScale <em>Specified Scale</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Scale</em>' attribute.
- * @see #getSpecifiedScale()
- * @generated
- */
- public void setSpecifiedScale(int newSpecifiedScale) {
- int oldSpecifiedScale = specifiedScale;
- specifiedScale = newSpecifiedScale;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_SCALE, oldSpecifiedScale, specifiedScale));
- }
-
- public int getDefaultLength() {
- return DEFAULT_LENGTH;
- }
-
- public int getDefaultPrecision() {
- return DEFAULT_PRECISION;
- }
-
- public int getDefaultScale() {
- return DEFAULT_SCALE;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_COLUMN__LENGTH :
- return new Integer(getLength());
- case JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_LENGTH :
- return new Integer(getSpecifiedLength());
- case JpaJavaMappingsPackage.JAVA_COLUMN__PRECISION :
- return new Integer(getPrecision());
- case JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_PRECISION :
- return new Integer(getSpecifiedPrecision());
- case JpaJavaMappingsPackage.JAVA_COLUMN__SCALE :
- return new Integer(getScale());
- case JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_SCALE :
- return new Integer(getSpecifiedScale());
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_LENGTH :
- setSpecifiedLength(((Integer) newValue).intValue());
- return;
- case JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_PRECISION :
- setSpecifiedPrecision(((Integer) newValue).intValue());
- return;
- case JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_SCALE :
- setSpecifiedScale(((Integer) newValue).intValue());
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_LENGTH :
- setSpecifiedLength(SPECIFIED_LENGTH_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_PRECISION :
- setSpecifiedPrecision(SPECIFIED_PRECISION_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_SCALE :
- setSpecifiedScale(SPECIFIED_SCALE_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_COLUMN__LENGTH :
- return getLength() != LENGTH_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_LENGTH :
- return specifiedLength != SPECIFIED_LENGTH_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_COLUMN__PRECISION :
- return getPrecision() != PRECISION_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_PRECISION :
- return specifiedPrecision != SPECIFIED_PRECISION_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_COLUMN__SCALE :
- return getScale() != SCALE_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_SCALE :
- return specifiedScale != SPECIFIED_SCALE_EDEFAULT;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IColumn.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_COLUMN__LENGTH :
- return JpaCoreMappingsPackage.ICOLUMN__LENGTH;
- case JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_LENGTH :
- return JpaCoreMappingsPackage.ICOLUMN__SPECIFIED_LENGTH;
- case JpaJavaMappingsPackage.JAVA_COLUMN__PRECISION :
- return JpaCoreMappingsPackage.ICOLUMN__PRECISION;
- case JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_PRECISION :
- return JpaCoreMappingsPackage.ICOLUMN__SPECIFIED_PRECISION;
- case JpaJavaMappingsPackage.JAVA_COLUMN__SCALE :
- return JpaCoreMappingsPackage.ICOLUMN__SCALE;
- case JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_SCALE :
- return JpaCoreMappingsPackage.ICOLUMN__SPECIFIED_SCALE;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IColumn.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.ICOLUMN__LENGTH :
- return JpaJavaMappingsPackage.JAVA_COLUMN__LENGTH;
- case JpaCoreMappingsPackage.ICOLUMN__SPECIFIED_LENGTH :
- return JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_LENGTH;
- case JpaCoreMappingsPackage.ICOLUMN__PRECISION :
- return JpaJavaMappingsPackage.JAVA_COLUMN__PRECISION;
- case JpaCoreMappingsPackage.ICOLUMN__SPECIFIED_PRECISION :
- return JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_PRECISION;
- case JpaCoreMappingsPackage.ICOLUMN__SCALE :
- return JpaJavaMappingsPackage.JAVA_COLUMN__SCALE;
- case JpaCoreMappingsPackage.ICOLUMN__SPECIFIED_SCALE :
- return JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_SCALE;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedLength: ");
- result.append(specifiedLength);
- result.append(", specifiedPrecision: ");
- result.append(specifiedPrecision);
- result.append(", specifiedScale: ");
- result.append(specifiedScale);
- result.append(')');
- return result.toString();
- }
-
- @Override
- public boolean tableIsAllowed() {
- return true;
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- this.setSpecifiedLength(this.lengthAdapter.getValue(astRoot));
- this.setSpecifiedPrecision(this.precisionAdapter.getValue(astRoot));
- this.setSpecifiedScale(this.scaleAdapter.getValue(astRoot));
- }
-
- public void refreshDefaults(DefaultsContext defaultsContext) {
- this.setDefaultTable((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_COLUMN_TABLE_KEY));
- this.setDefaultName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_COLUMN_NAME_KEY));
- }
-
- // ********** static methods **********
- public static JavaColumn createColumnMappingColumn(Owner owner, Member member) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaColumn(owner, member, MAPPING_DECLARATION_ANNOTATION_ADAPTER);
- }
-
- static JavaColumn createAttributeOverrideColumn(Owner owner, Member member, DeclarationAnnotationAdapter attributeOverrideAnnotationAdapter) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaColumn(owner, member, buildAttributeOverrideAnnotationAdapter(attributeOverrideAnnotationAdapter));
- }
-
- private static DeclarationAnnotationAdapter buildAttributeOverrideAnnotationAdapter(DeclarationAnnotationAdapter attributeOverrideAnnotationAdapter) {
- return new NestedDeclarationAnnotationAdapter(attributeOverrideAnnotationAdapter, JPA.ATTRIBUTE_OVERRIDE__COLUMN, JPA.COLUMN);
- }
-} // JavaColumn
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaDiscriminatorColumn.java
deleted file mode 100644
index e1735f7ae3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaDiscriminatorColumn.java
+++ /dev/null
@@ -1,451 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
-import org.eclipse.jpt.core.internal.mappings.DiscriminatorType;
-import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Discriminator Column</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaDiscriminatorColumn()
- * @model kind="class"
- * @generated
- */
-public class JavaDiscriminatorColumn extends JavaNamedColumn
- implements IDiscriminatorColumn
-{
- private AnnotationElementAdapter<String> discriminatorTypeAdapter;
-
- private IntAnnotationElementAdapter lengthAdapter;
-
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.DISCRIMINATOR_COLUMN);
-
- private static final DeclarationAnnotationElementAdapter<String> DISCRIMINATOR_TYPE_ADAPTER = buildDiscriminatorTypeAdapter();
-
- /**
- * The default value of the '{@link #getDiscriminatorType() <em>Discriminator Type</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDiscriminatorType()
- * @generated
- * @ordered
- */
- protected static final DiscriminatorType DISCRIMINATOR_TYPE_EDEFAULT = DiscriminatorType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getDiscriminatorType() <em>Discriminator Type</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDiscriminatorType()
- * @generated
- * @ordered
- */
- protected DiscriminatorType discriminatorType = DISCRIMINATOR_TYPE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultLength() <em>Default Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultLength()
- * @generated
- * @ordered
- */
- protected static final int DEFAULT_LENGTH_EDEFAULT = 31;
-
- /**
- * The cached value of the '{@link #getDefaultLength() <em>Default Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultLength()
- * @generated
- * @ordered
- */
- protected int defaultLength = DEFAULT_LENGTH_EDEFAULT;
-
- /**
- * The default value of the '{@link #getSpecifiedLength() <em>Specified Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedLength()
- * @generated
- * @ordered
- */
- protected static final int SPECIFIED_LENGTH_EDEFAULT = -1;
-
- /**
- * The cached value of the '{@link #getSpecifiedLength() <em>Specified Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedLength()
- * @generated
- * @ordered
- */
- protected int specifiedLength = SPECIFIED_LENGTH_EDEFAULT;
-
- /**
- * The default value of the '{@link #getLength() <em>Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getLength()
- * @generated
- * @ordered
- */
- protected static final int LENGTH_EDEFAULT = 0;
-
- protected JavaDiscriminatorColumn() {
- throw new UnsupportedOperationException();
- }
-
- protected JavaDiscriminatorColumn(INamedColumn.Owner owner, Type type, DeclarationAnnotationAdapter daa) {
- super(owner, type, daa);
- this.discriminatorTypeAdapter = this.buildShortCircuitElementAdapter(DISCRIMINATOR_TYPE_ADAPTER);
- this.lengthAdapter = this.buildShortCircuitIntElementAdapter(JPA.DISCRIMINATOR_COLUMN__LENGTH);
- }
-
- @Override
- protected String nameElementName() {
- return JPA.DISCRIMINATOR_COLUMN__NAME;
- }
-
- @Override
- protected String columnDefinitionElementName() {
- return JPA.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION;
- }
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IDiscriminatorColumn.class)) {
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE :
- this.discriminatorTypeAdapter.setValue(((DiscriminatorType) notification.getNewValue()).convertToJavaAnnotationValue());
- break;
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH :
- this.lengthAdapter.setValue(notification.getNewIntValue());
- break;
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_DISCRIMINATOR_COLUMN;
- }
-
- /**
- * Returns the value of the '<em><b>Discriminator Type</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DiscriminatorType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Discriminator Type</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Discriminator Type</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DiscriminatorType
- * @see #setDiscriminatorType(DiscriminatorType)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIDiscriminatorColumn_DiscriminatorType()
- * @model
- * @generated
- */
- public DiscriminatorType getDiscriminatorType() {
- return discriminatorType;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaDiscriminatorColumn#getDiscriminatorType <em>Discriminator Type</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Discriminator Type</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DiscriminatorType
- * @see #getDiscriminatorType()
- * @generated
- */
- public void setDiscriminatorType(DiscriminatorType newDiscriminatorType) {
- DiscriminatorType oldDiscriminatorType = discriminatorType;
- discriminatorType = newDiscriminatorType == null ? DISCRIMINATOR_TYPE_EDEFAULT : newDiscriminatorType;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE, oldDiscriminatorType, discriminatorType));
- }
-
- /**
- * Returns the value of the '<em><b>Default Length</b></em>' attribute.
- * The default value is <code>"31"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Length</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Length</em>' attribute.
- * @see #setDefaultLength(int)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIDiscriminatorColumn_DefaultLength()
- * @model default="31"
- * @generated
- */
- public int getDefaultLength() {
- return defaultLength;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaDiscriminatorColumn#getDefaultLength <em>Default Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Default Length</em>' attribute.
- * @see #getDefaultLength()
- * @generated
- */
- public void setDefaultLength(int newDefaultLength) {
- int oldDefaultLength = defaultLength;
- defaultLength = newDefaultLength;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__DEFAULT_LENGTH, oldDefaultLength, defaultLength));
- }
-
- /**
- * Returns the value of the '<em><b>Specified Length</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Length</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Length</em>' attribute.
- * @see #setSpecifiedLength(int)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIDiscriminatorColumn_SpecifiedLength()
- * @model default="-1"
- * @generated
- */
- public int getSpecifiedLength() {
- return specifiedLength;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaDiscriminatorColumn#getSpecifiedLength <em>Specified Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Length</em>' attribute.
- * @see #getSpecifiedLength()
- * @generated
- */
- public void setSpecifiedLength(int newSpecifiedLength) {
- int oldSpecifiedLength = specifiedLength;
- specifiedLength = newSpecifiedLength;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH, oldSpecifiedLength, specifiedLength));
- }
-
- /**
- * Returns the value of the '<em><b>Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Length</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Length</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIDiscriminatorColumn_Length()
- * @model transient="true" changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public int getLength() {
- return (this.getSpecifiedLength() == -1) ? this.getDefaultLength() : this.getSpecifiedLength();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE :
- return getDiscriminatorType();
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__DEFAULT_LENGTH :
- return new Integer(getDefaultLength());
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH :
- return new Integer(getSpecifiedLength());
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__LENGTH :
- return new Integer(getLength());
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE :
- setDiscriminatorType((DiscriminatorType) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__DEFAULT_LENGTH :
- setDefaultLength(((Integer) newValue).intValue());
- return;
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH :
- setSpecifiedLength(((Integer) newValue).intValue());
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE :
- setDiscriminatorType(DISCRIMINATOR_TYPE_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__DEFAULT_LENGTH :
- setDefaultLength(DEFAULT_LENGTH_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH :
- setSpecifiedLength(SPECIFIED_LENGTH_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE :
- return discriminatorType != DISCRIMINATOR_TYPE_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__DEFAULT_LENGTH :
- return defaultLength != DEFAULT_LENGTH_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH :
- return specifiedLength != SPECIFIED_LENGTH_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__LENGTH :
- return getLength() != LENGTH_EDEFAULT;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IDiscriminatorColumn.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE :
- return JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE;
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__DEFAULT_LENGTH :
- return JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__DEFAULT_LENGTH;
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH :
- return JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__SPECIFIED_LENGTH;
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__LENGTH :
- return JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__LENGTH;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IDiscriminatorColumn.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE :
- return JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE;
- case JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__DEFAULT_LENGTH :
- return JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__DEFAULT_LENGTH;
- case JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__SPECIFIED_LENGTH :
- return JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH;
- case JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__LENGTH :
- return JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN__LENGTH;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (discriminatorType: ");
- result.append(discriminatorType);
- result.append(", defaultLength: ");
- result.append(defaultLength);
- result.append(", specifiedLength: ");
- result.append(specifiedLength);
- result.append(')');
- return result.toString();
- }
-
- @Override
- protected String tableName() {
- return this.getOwner().getTypeMapping().getTableName();
- }
-
- // ********** java annotations -> persistence model **********
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- setDiscriminatorType(DiscriminatorType.fromJavaAnnotationValue(this.discriminatorTypeAdapter.getValue(astRoot)));
- setSpecifiedLength(this.lengthAdapter.getValue(astRoot));
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter<String> buildDiscriminatorTypeAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE);
- }
-} // JavaDiscriminatorColumn
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddable.java
deleted file mode 100644
index add7155d5a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddable.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Embeddable</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaEmbeddable()
- * @model kind="class"
- * @generated
- */
-public class JavaEmbeddable extends JavaTypeMapping implements IJavaEmbeddable
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.EMBEDDABLE);
-
- protected JavaEmbeddable() {
- throw new UnsupportedOperationException("Use JavaEmbeddable(Type) instead");
- }
-
- protected JavaEmbeddable(Type type) {
- super(type);
- }
-
- @Override
- protected DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_EMBEDDABLE;
- }
-
- public String getKey() {
- return IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
- }
-
- @Override
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- return attributeMappingKey == IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY || attributeMappingKey == IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbedded.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbedded.java
deleted file mode 100644
index a66613ab8b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbedded.java
+++ /dev/null
@@ -1,590 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.EObjectEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddable;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.utility.internal.Filter;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Embedded</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaEmbedded()
- * @model kind="class"
- * @generated
- */
-public class JavaEmbedded extends JavaAttributeMapping implements IJavaEmbedded
-{
- /**
- * The cached value of the '{@link #getSpecifiedAttributeOverrides() <em>Specified Attribute Overrides</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedAttributeOverrides()
- * @generated
- * @ordered
- */
- protected EList<IAttributeOverride> specifiedAttributeOverrides;
-
- /**
- * The cached value of the '{@link #getDefaultAttributeOverrides() <em>Default Attribute Overrides</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultAttributeOverrides()
- * @generated
- * @ordered
- */
- protected EList<IAttributeOverride> defaultAttributeOverrides;
-
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.EMBEDDED);
-
- private IEmbeddable embeddable;
-
- protected JavaEmbedded() {
- throw new UnsupportedOperationException("Use JavaEmbedded(Attribute) instead");
- }
-
- protected JavaEmbedded(Attribute attribute) {
- super(attribute);
- }
-
- /**
- * check for changes to the 'specifiedJoinColumns' and
- * 'specifiedInverseJoinColumns' lists so we can notify the
- * model adapter of any changes;
- * also listen for changes to the 'defaultJoinColumns' and
- * 'defaultInverseJoinColumns' lists so we can spank the developer
- */
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IEntity.class)) {
- case JpaCoreMappingsPackage.IEMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- attributeOverridesChanged(notification);
- break;
- default :
- break;
- }
- }
-
- @SuppressWarnings("unchecked")
- void attributeOverridesChanged(Notification notification) {
- switch (notification.getEventType()) {
- case Notification.ADD :
- attributeOverrideAdded(notification.getPosition(), (JavaAttributeOverride) notification.getNewValue());
- break;
- case Notification.ADD_MANY :
- attributeOverridesAdded(notification.getPosition(), (List<JavaAttributeOverride>) notification.getNewValue());
- break;
- case Notification.REMOVE :
- attributeOverrideRemoved(notification.getPosition(), (JavaAttributeOverride) notification.getOldValue());
- break;
- case Notification.REMOVE_MANY :
- if (notification.getPosition() == Notification.NO_INDEX) {
- attributeOverridesCleared((List<JavaAttributeOverride>) notification.getOldValue());
- }
- else {
- // Notification.getNewValue() returns an array of the positions of objects that were removed
- attributeOverridesRemoved((int[]) notification.getNewValue(), (List<JavaAttributeOverride>) notification.getOldValue());
- }
- break;
- case Notification.SET :
- if (!notification.isTouch()) {
- attributeOverrideSet(notification.getPosition(), (JavaAttributeOverride) notification.getOldValue(), (JavaAttributeOverride) notification.getNewValue());
- }
- break;
- case Notification.MOVE :
- // Notification.getOldValue() returns the source index
- // Notification.getPositon() returns the target index
- // Notification.getNewValue() returns the moved object
- attributeOverrideMoved(notification.getOldIntValue(), notification.getPosition(), (JavaAttributeOverride) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- // ********** jpa model -> java annotations **********
- /**
- * slide over all the annotations that follow the new join column
- */
- public void attributeOverrideAdded(int index, JavaAttributeOverride attributeOverride) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (attributeOverride.annotation(getAttribute().astRoot()) == null) {
- this.synchAttributeOverrideAnnotationsAfterAdd(index + 1);
- attributeOverride.newAnnotation();
- }
- }
-
- public void attributeOverridesAdded(int index, List<JavaAttributeOverride> attributeOverrides) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (!attributeOverrides.isEmpty() && (attributeOverrides.get(0).annotation(getAttribute().astRoot()) == null)) {
- this.synchAttributeOverrideAnnotationsAfterAdd(index + attributeOverrides.size());
- for (JavaAttributeOverride attributeOverride : attributeOverrides) {
- attributeOverride.newAnnotation();
- }
- }
- }
-
- public void attributeOverrideRemoved(int index, JavaAttributeOverride attributeOverride) {
- attributeOverride.removeAnnotation();
- this.synchAttributeOverrideAnnotationsAfterRemove(index);
- }
-
- public void attributeOverridesRemoved(int[] indexes, List<JavaAttributeOverride> attributeOverrides) {
- for (JavaAttributeOverride attributeOverride : attributeOverrides) {
- attributeOverride.removeAnnotation();
- }
- this.synchAttributeOverrideAnnotationsAfterRemove(indexes[0]);
- }
-
- public void attributeOverridesCleared(List<JavaAttributeOverride> attributeOverrides) {
- for (JavaAttributeOverride attributeOverride : attributeOverrides) {
- attributeOverride.removeAnnotation();
- }
- }
-
- public void attributeOverrideSet(int index, JavaAttributeOverride oldAttributeOverride, JavaAttributeOverride newAttributeOverride) {
- newAttributeOverride.newAnnotation();
- }
-
- public void attributeOverrideMoved(int sourceIndex, int targetIndex, JavaAttributeOverride attributeOverride) {
- List<IAttributeOverride> attributeOverrides = getSpecifiedAttributeOverrides();
- int begin = Math.min(sourceIndex, targetIndex);
- int end = Math.max(sourceIndex, targetIndex);
- for (int i = begin; i-- > end;) {
- this.synch((JavaAttributeOverride) attributeOverrides.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the end of the list to prevent overlap
- */
- private void synchAttributeOverrideAnnotationsAfterAdd(int index) {
- List<IAttributeOverride> attributeOverrides = getSpecifiedAttributeOverrides();
- for (int i = attributeOverrides.size(); i-- > index;) {
- this.synch((JavaAttributeOverride) attributeOverrides.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the specified index to prevent overlap
- */
- private void synchAttributeOverrideAnnotationsAfterRemove(int index) {
- List<IAttributeOverride> attributeOverrides = getSpecifiedAttributeOverrides();
- for (int i = index; i < attributeOverrides.size(); i++) {
- this.synch((JavaAttributeOverride) attributeOverrides.get(i), i);
- }
- }
-
- private void synch(JavaAttributeOverride attributeOverride, int index) {
- attributeOverride.moveAnnotation(index);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_EMBEDDED;
- }
-
- public EList<IAttributeOverride> getAttributeOverrides() {
- EList<IAttributeOverride> list = new EObjectEList<IAttributeOverride>(IAttributeOverride.class, this, JpaJavaMappingsPackage.JAVA_EMBEDDED__ATTRIBUTE_OVERRIDES);
- list.addAll(getSpecifiedAttributeOverrides());
- list.addAll(getDefaultAttributeOverrides());
- return list;
- }
-
- /**
- * Returns the value of the '<em><b>Specified Attribute Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Attribute Overrides</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Attribute Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEmbedded_SpecifiedAttributeOverrides()
- * @model containment="true"
- * @generated
- */
- public EList<IAttributeOverride> getSpecifiedAttributeOverrides() {
- if (specifiedAttributeOverrides == null) {
- specifiedAttributeOverrides = new EObjectContainmentEList<IAttributeOverride>(IAttributeOverride.class, this, JpaJavaMappingsPackage.JAVA_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES);
- }
- return specifiedAttributeOverrides;
- }
-
- /**
- * Returns the value of the '<em><b>Default Attribute Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Attribute Overrides</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Attribute Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEmbedded_DefaultAttributeOverrides()
- * @model containment="true"
- * @generated
- */
- public EList<IAttributeOverride> getDefaultAttributeOverrides() {
- if (defaultAttributeOverrides == null) {
- defaultAttributeOverrides = new EObjectContainmentEList<IAttributeOverride>(IAttributeOverride.class, this, JpaJavaMappingsPackage.JAVA_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES);
- }
- return defaultAttributeOverrides;
- }
-
- public IEmbeddable embeddable() {
- return this.embeddable;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_EMBEDDED__ATTRIBUTE_OVERRIDES :
- return ((InternalEList<?>) getAttributeOverrides()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return ((InternalEList<?>) getSpecifiedAttributeOverrides()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES :
- return ((InternalEList<?>) getDefaultAttributeOverrides()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_EMBEDDED__ATTRIBUTE_OVERRIDES :
- return getAttributeOverrides();
- case JpaJavaMappingsPackage.JAVA_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return getSpecifiedAttributeOverrides();
- case JpaJavaMappingsPackage.JAVA_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES :
- return getDefaultAttributeOverrides();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- getSpecifiedAttributeOverrides().clear();
- getSpecifiedAttributeOverrides().addAll((Collection<? extends IAttributeOverride>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES :
- getDefaultAttributeOverrides().clear();
- getDefaultAttributeOverrides().addAll((Collection<? extends IAttributeOverride>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- getSpecifiedAttributeOverrides().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES :
- getDefaultAttributeOverrides().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_EMBEDDED__ATTRIBUTE_OVERRIDES :
- return !getAttributeOverrides().isEmpty();
- case JpaJavaMappingsPackage.JAVA_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return specifiedAttributeOverrides != null && !specifiedAttributeOverrides.isEmpty();
- case JpaJavaMappingsPackage.JAVA_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES :
- return defaultAttributeOverrides != null && !defaultAttributeOverrides.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IEmbedded.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_EMBEDDED__ATTRIBUTE_OVERRIDES :
- return JpaCoreMappingsPackage.IEMBEDDED__ATTRIBUTE_OVERRIDES;
- case JpaJavaMappingsPackage.JAVA_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return JpaCoreMappingsPackage.IEMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES;
- case JpaJavaMappingsPackage.JAVA_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES :
- return JpaCoreMappingsPackage.IEMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES;
- default :
- return -1;
- }
- }
- if (baseClass == IJavaEmbedded.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IEmbedded.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IEMBEDDED__ATTRIBUTE_OVERRIDES :
- return JpaJavaMappingsPackage.JAVA_EMBEDDED__ATTRIBUTE_OVERRIDES;
- case JpaCoreMappingsPackage.IEMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return JpaJavaMappingsPackage.JAVA_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES;
- case JpaCoreMappingsPackage.IEMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES :
- return JpaJavaMappingsPackage.JAVA_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES;
- default :
- return -1;
- }
- }
- if (baseClass == IJavaEmbedded.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- @Override
- protected DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- public String getKey() {
- return IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext) {
- super.refreshDefaults(defaultsContext);
- refreshEmbeddable(defaultsContext);
- }
-
- private void refreshEmbeddable(DefaultsContext defaultsContext) {
- this.embeddable = embeddableFor(getAttribute(), defaultsContext);
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- updateAttributeOverridesFromJava(astRoot);
- }
-
- /**
- * here we just worry about getting the attribute override lists the same size;
- * then we delegate to the attribute overrides to synch themselves up
- */
- private void updateAttributeOverridesFromJava(CompilationUnit astRoot) {
- // synchronize the model attribute overrides with the Java source
- List<IAttributeOverride> attributeOverrides = getSpecifiedAttributeOverrides();
- int persSize = attributeOverrides.size();
- int javaSize = 0;
- boolean allJavaAnnotationsFound = false;
- for (int i = 0; i < persSize; i++) {
- JavaAttributeOverride attributeOverride = (JavaAttributeOverride) attributeOverrides.get(i);
- if (attributeOverride.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- break; // no need to go any further
- }
- attributeOverride.updateFromJava(astRoot);
- javaSize++;
- }
- if (allJavaAnnotationsFound) {
- // remove any model attribute overrides beyond those that correspond to the Java annotations
- while (persSize > javaSize) {
- persSize--;
- attributeOverrides.remove(persSize);
- }
- }
- else {
- // add new model attribute overrides until they match the Java annotations
- while (!allJavaAnnotationsFound) {
- JavaAttributeOverride attributeOverride = this.createJavaAttributeOverride(javaSize);
- if (attributeOverride.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- }
- else {
- getSpecifiedAttributeOverrides().add(attributeOverride);
- attributeOverride.updateFromJava(astRoot);
- javaSize++;
- }
- }
- }
- }
-
- public IAttributeOverride attributeOverrideNamed(String name) {
- return (IAttributeOverride) overrideNamed(name, getAttributeOverrides());
- }
-
- public boolean containsAttributeOverride(String name) {
- return containsOverride(name, getAttributeOverrides());
- }
-
- public boolean containsSpecifiedAttributeOverride(String name) {
- return containsOverride(name, getSpecifiedAttributeOverrides());
- }
-
- private IOverride overrideNamed(String name, List<? extends IOverride> overrides) {
- for (IOverride override : overrides) {
- String overrideName = override.getName();
- if (overrideName == null && name == null) {
- return override;
- }
- if (overrideName != null && overrideName.equals(name)) {
- return override;
- }
- }
- return null;
- }
-
- private boolean containsOverride(String name, List<? extends IOverride> overrides) {
- return overrideNamed(name, overrides) != null;
- }
-
- public Iterator<String> allOverridableAttributeNames() {
- return new TransformationIterator<IPersistentAttribute, String>(this.allOverridableAttributes()) {
- @Override
- protected String transform(IPersistentAttribute attribute) {
- return attribute.getName();
- }
- };
- }
-
- public Iterator<IPersistentAttribute> allOverridableAttributes() {
- if (this.embeddable() == null) {
- return EmptyIterator.instance();
- }
- return new FilteringIterator<IPersistentAttribute>(this.embeddable().getPersistentType().attributes()) {
- @Override
- protected boolean accept(Object o) {
- return ((IPersistentAttribute) o).isOverridableAttribute();
- }
- };
- }
-
- public IAttributeOverride createAttributeOverride(int index) {
- return createJavaAttributeOverride(index);
- }
-
- private JavaAttributeOverride createJavaAttributeOverride(int index) {
- return JavaAttributeOverride.createAttributeOverride(new AttributeOverrideOwner(this), this.getAttribute(), index);
- }
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (IAttributeOverride override : this.getAttributeOverrides()) {
- result = ((JavaAttributeOverride) override).candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- //******* static methods *********
- public static IEmbeddable embeddableFor(Attribute attribute, DefaultsContext defaultsContext) {
- CompilationUnit astRoot = defaultsContext.astRoot();
- String resolvedTypeName = attribute.resolvedTypeName(astRoot);
- if (resolvedTypeName == null) {
- return null;
- }
- IPersistentType persistentType = defaultsContext.persistentType(resolvedTypeName);
- if (persistentType != null) {
- if (persistentType.getMappingKey() == IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY) {
- return (IEmbeddable) persistentType.getMapping();
- }
- }
- return null;
- }
-} // JavaEmbedded
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddedId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddedId.java
deleted file mode 100644
index 0f16e5d430..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddedId.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Embedded Id</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaEmbeddedId()
- * @model kind="class"
- * @generated
- */
-public class JavaEmbeddedId extends JavaAttributeMapping
- implements IJavaEmbeddedId
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.EMBEDDED_ID);
-
- protected JavaEmbeddedId() {
- throw new UnsupportedOperationException("Use JavaEmbeddedId(Attribute) instead");
- }
-
- protected JavaEmbeddedId(Attribute attribute) {
- super(attribute);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_EMBEDDED_ID;
- }
-
- @Override
- protected DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- public String getKey() {
- return IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- public boolean isIdMapping() {
- return true;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddedIdProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddedIdProvider.java
deleted file mode 100644
index b3b602d775..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddedIdProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.IJpaFactory;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMappingProvider;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-
-/**
- *
- */
-public class JavaEmbeddedIdProvider
- implements IJavaAttributeMappingProvider
-{
-
- // singleton
- private static final JavaEmbeddedIdProvider INSTANCE = new JavaEmbeddedIdProvider();
-
- /**
- * Return the singleton.
- */
- public static IJavaAttributeMappingProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private JavaEmbeddedIdProvider() {
- super();
- }
-
- public String key() {
- return IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- public IJavaAttributeMapping buildMapping(Attribute attribute, IJpaFactory factory) {
- return factory.createJavaEmbeddedId(attribute);
- }
-
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return JavaEmbeddedId.DECLARATION_ANNOTATION_ADAPTER;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddedProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddedProvider.java
deleted file mode 100644
index 6fa7b07cbe..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddedProvider.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.IJpaFactory;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.content.java.IDefaultJavaAttributeMappingProvider;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddable;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-
-/**
- *
- */
-public class JavaEmbeddedProvider
- implements IDefaultJavaAttributeMappingProvider
-{
-
- // singleton
- private static final JavaEmbeddedProvider INSTANCE = new JavaEmbeddedProvider();
-
- /**
- * Return the singleton.
- */
- public static IDefaultJavaAttributeMappingProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private JavaEmbeddedProvider() {
- super();
- }
-
- public String key() {
- return IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
- }
-
- public boolean defaultApplies(Attribute attribute, DefaultsContext defaultsContext) {
- return embeddableFor(attribute, defaultsContext) != null;
- }
-
- private IEmbeddable embeddableFor(Attribute attribute, DefaultsContext defaultsContext) {
- return JavaEmbedded.embeddableFor(attribute, defaultsContext);
- }
-
- public IJavaAttributeMapping buildMapping(Attribute attribute, IJpaFactory factory) {
- return factory.createJavaEmbedded(attribute);
- }
-
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return JavaEmbedded.DECLARATION_ANNOTATION_ADAPTER;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEntity.java
deleted file mode 100644
index f96ea4c9c8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEntity.java
+++ /dev/null
@@ -1,3010 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.EObjectEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleTypeStringExpressionConverter;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
-import org.eclipse.jpt.core.internal.mappings.DiscriminatorType;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.INamedNativeQuery;
-import org.eclipse.jpt.core.internal.mappings.INamedQuery;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.mappings.InheritanceType;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.Filter;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Entity</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaEntity()
- * @model kind="class"
- * @generated
- */
-public class JavaEntity extends JavaTypeMapping implements IJavaEntity
-{
- /**
- * The default value of the '{@link #getSpecifiedName() <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedName()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedName() <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedName()
- * @generated
- * @ordered
- */
- protected String specifiedName = SPECIFIED_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultName() <em>Default Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultName()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultName() <em>Default Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultName()
- * @generated
- * @ordered
- */
- protected String defaultName = DEFAULT_NAME_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getTable() <em>Table</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTable()
- * @generated
- * @ordered
- */
- protected ITable table;
-
- /**
- * The cached value of the '{@link #getSpecifiedSecondaryTables() <em>Specified Secondary Tables</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSecondaryTables()
- * @generated
- * @ordered
- */
- protected EList<ISecondaryTable> specifiedSecondaryTables;
-
- /**
- * The cached value of the '{@link #getSpecifiedPrimaryKeyJoinColumns() <em>Specified Primary Key Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPrimaryKeyJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns;
-
- /**
- * The cached value of the '{@link #getDefaultPrimaryKeyJoinColumns() <em>Default Primary Key Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultPrimaryKeyJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns;
-
- /**
- * The default value of the '{@link #getInheritanceStrategy() <em>Inheritance Strategy</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getInheritanceStrategy()
- * @generated
- * @ordered
- */
- protected static final InheritanceType INHERITANCE_STRATEGY_EDEFAULT = InheritanceType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getInheritanceStrategy() <em>Inheritance Strategy</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getInheritanceStrategy()
- * @generated
- * @ordered
- */
- protected InheritanceType inheritanceStrategy = INHERITANCE_STRATEGY_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultDiscriminatorValue() <em>Default Discriminator Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultDiscriminatorValue()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_DISCRIMINATOR_VALUE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultDiscriminatorValue() <em>Default Discriminator Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultDiscriminatorValue()
- * @generated
- * @ordered
- */
- protected String defaultDiscriminatorValue = DEFAULT_DISCRIMINATOR_VALUE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getSpecifiedDiscriminatorValue() <em>Specified Discriminator Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedDiscriminatorValue()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_DISCRIMINATOR_VALUE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedDiscriminatorValue() <em>Specified Discriminator Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedDiscriminatorValue()
- * @generated
- * @ordered
- */
- protected String specifiedDiscriminatorValue = SPECIFIED_DISCRIMINATOR_VALUE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDiscriminatorValue() <em>Discriminator Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDiscriminatorValue()
- * @generated
- * @ordered
- */
- protected static final String DISCRIMINATOR_VALUE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDiscriminatorColumn() <em>Discriminator Column</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDiscriminatorColumn()
- * @generated
- * @ordered
- */
- protected IDiscriminatorColumn discriminatorColumn;
-
- /**
- * The cached value of the '{@link #getSequenceGenerator() <em>Sequence Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSequenceGenerator()
- * @generated
- * @ordered
- */
- protected ISequenceGenerator sequenceGenerator;
-
- /**
- * The cached value of the '{@link #getTableGenerator() <em>Table Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTableGenerator()
- * @generated
- * @ordered
- */
- protected ITableGenerator tableGenerator;
-
- /**
- * The cached value of the '{@link #getSpecifiedAttributeOverrides() <em>Specified Attribute Overrides</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedAttributeOverrides()
- * @generated
- * @ordered
- */
- protected EList<IAttributeOverride> specifiedAttributeOverrides;
-
- /**
- * The cached value of the '{@link #getDefaultAttributeOverrides() <em>Default Attribute Overrides</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultAttributeOverrides()
- * @generated
- * @ordered
- */
- protected EList<IAttributeOverride> defaultAttributeOverrides;
-
- /**
- * The cached value of the '{@link #getSpecifiedAssociationOverrides() <em>Specified Association Overrides</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedAssociationOverrides()
- * @generated
- * @ordered
- */
- protected EList<IAssociationOverride> specifiedAssociationOverrides;
-
- /**
- * The cached value of the '{@link #getDefaultAssociationOverrides() <em>Default Association Overrides</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultAssociationOverrides()
- * @generated
- * @ordered
- */
- protected EList<IAssociationOverride> defaultAssociationOverrides;
-
- /**
- * The cached value of the '{@link #getNamedQueries() <em>Named Queries</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getNamedQueries()
- * @generated
- * @ordered
- */
- protected EList<INamedQuery> namedQueries;
-
- /**
- * The cached value of the '{@link #getNamedNativeQueries() <em>Named Native Queries</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getNamedNativeQueries()
- * @generated
- * @ordered
- */
- protected EList<INamedNativeQuery> namedNativeQueries;
-
- /**
- * The default value of the '{@link #getIdClass() <em>Id Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getIdClass()
- * @generated
- * @ordered
- */
- protected static final String ID_CLASS_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getIdClass() <em>Id Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getIdClass()
- * @generated
- * @ordered
- */
- protected String idClass = ID_CLASS_EDEFAULT;
-
- private AnnotationElementAdapter<String> nameAdapter;
-
- private AnnotationElementAdapter<String> inheritanceStrategyAdapter;
-
- private final AnnotationElementAdapter<String> discriminatorValueAdapter;
-
- private AnnotationAdapter tableGeneratorAnnotationAdapter;
-
- private AnnotationAdapter sequenceGeneratorAnnotationAdapter;
-
- private final AnnotationAdapter idClassAnnotationAdapter;
-
- private final AnnotationElementAdapter<String> idClassValueAdapter;
-
- public static final DeclarationAnnotationAdapter ID_CLASS_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ID_CLASS);
-
- private static final DeclarationAnnotationElementAdapter<String> ID_CLASS_VALUE_ADAPTER = buildIdClassValueAdapter();
-
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ENTITY);
-
- private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildNameAdapter();
-
- private static final DeclarationAnnotationAdapter INHERITANCE_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.INHERITANCE);
-
- private static final DeclarationAnnotationElementAdapter<String> INHERITANCE_STRATEGY_ADAPTER = buildStrategyAdapter();
-
- private static final DeclarationAnnotationAdapter DISCRIMINATOR_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.DISCRIMINATOR_VALUE);
-
- private static final DeclarationAnnotationElementAdapter<String> DISCRIMINATOR_VALUE_ADAPTER = buildDiscriminatorValueAdapter();
-
- protected JavaEntity() {
- this(null);
- }
-
- protected JavaEntity(Type type) {
- super(type);
- this.table = JpaJavaMappingsFactory.eINSTANCE.createJavaTable(buildTableOwner(), getType());
- ((InternalEObject) this.table).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ENTITY__TABLE, null, null);
- this.discriminatorColumn = JpaJavaMappingsFactory.eINSTANCE.createJavaDiscriminatorColumn(new IDiscriminatorColumn.Owner(this), type, JavaDiscriminatorColumn.DECLARATION_ANNOTATION_ADAPTER);
- ((InternalEObject) this.discriminatorColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ENTITY__DISCRIMINATOR_COLUMN, null, null);
- // this.getDefaultPrimaryKeyJoinColumns().add(this.createPrimaryKeyJoinColumn(IPrimaryKeyJoinColumnModelAdapter.DEFAULT));
- // this.eAdapters().add(this.buildListener());
- this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(getType(), NAME_ADAPTER);
- this.inheritanceStrategyAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, INHERITANCE_STRATEGY_ADAPTER);
- this.discriminatorValueAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, DISCRIMINATOR_VALUE_ADAPTER);
- this.idClassAnnotationAdapter = new MemberAnnotationAdapter(this.getType(), ID_CLASS_ADAPTER);
- this.idClassValueAdapter = new ShortCircuitAnnotationElementAdapter<String>(this.getType(), ID_CLASS_VALUE_ADAPTER);
- this.getDefaultPrimaryKeyJoinColumns().add(this.createPrimaryKeyJoinColumn(0));
- this.tableGeneratorAnnotationAdapter = new MemberAnnotationAdapter(getType(), JavaTableGenerator.DECLARATION_ANNOTATION_ADAPTER);
- this.sequenceGeneratorAnnotationAdapter = new MemberAnnotationAdapter(getType(), JavaSequenceGenerator.DECLARATION_ANNOTATION_ADAPTER);
- }
-
- private ITable.Owner buildTableOwner() {
- return new ITable.Owner() {
- public ITextRange validationTextRange() {
- return JavaEntity.this.validationTextRange();
- }
-
- public ITypeMapping getTypeMapping() {
- return JavaEntity.this;
- }
- };
- }
-
- @Override
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildNameAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.ENTITY__NAME, false); // false = do not remove annotation when empty
- }
-
- /**
- * check for changes to the 'specifiedJoinColumns' and
- * 'specifiedInverseJoinColumns' lists so we can notify the
- * model adapter of any changes;
- * also listen for changes to the 'defaultJoinColumns' and
- * 'defaultInverseJoinColumns' lists so we can spank the developer
- */
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IEntity.class)) {
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_NAME :
- this.nameAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaJavaMappingsPackage.JAVA_ENTITY__INHERITANCE_STRATEGY :
- this.inheritanceStrategyAdapter.setValue(((InheritanceType) notification.getNewValue()).convertToJavaAnnotationValue());
- break;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_DISCRIMINATOR_VALUE :
- this.discriminatorValueAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES :
- this.attributeOverridesChanged(notification);
- break;
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_ASSOCIATION_OVERRIDES :
- this.associationOverridesChanged(notification);
- break;
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_SECONDARY_TABLES :
- this.secondaryTablesChanged(notification);
- break;
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- this.specifiedPrimaryKeyJoinColumnsChanged(notification);
- break;
- case JpaCoreMappingsPackage.IENTITY__NAMED_QUERIES :
- this.namedQueriesChanged(notification);
- break;
- case JpaCoreMappingsPackage.IENTITY__NAMED_NATIVE_QUERIES :
- this.namedNativeQueriesChanged(notification);
- break;
- case JpaCoreMappingsPackage.IENTITY__TABLE_GENERATOR :
- attributeChanged(notification.getNewValue(), this.tableGeneratorAnnotationAdapter);
- break;
- case JpaCoreMappingsPackage.IENTITY__SEQUENCE_GENERATOR :
- attributeChanged(notification.getNewValue(), this.sequenceGeneratorAnnotationAdapter);
- break;
- case JpaCoreMappingsPackage.IENTITY__ID_CLASS :
- String newIdClass = (String) notification.getNewValue();
- if (newIdClass == null) {
- this.idClassAnnotationAdapter.removeAnnotation();
- }
- else {
- this.idClassValueAdapter.setValue(newIdClass);
- }
- default :
- break;
- }
- }
-
- @SuppressWarnings("unchecked")
- void attributeOverridesChanged(Notification notification) {
- switch (notification.getEventType()) {
- case Notification.ADD :
- attributeOverrideAdded(notification.getPosition(), (JavaAttributeOverride) notification.getNewValue());
- break;
- case Notification.ADD_MANY :
- attributeOverridesAdded(notification.getPosition(), (List<JavaAttributeOverride>) notification.getNewValue());
- break;
- case Notification.REMOVE :
- attributeOverrideRemoved(notification.getPosition(), (JavaAttributeOverride) notification.getOldValue());
- break;
- case Notification.REMOVE_MANY :
- if (notification.getPosition() == Notification.NO_INDEX) {
- attributeOverridesCleared((List<JavaAttributeOverride>) notification.getOldValue());
- }
- else {
- // Notification.getNewValue() returns an array of the positions of objects that were removed
- attributeOverridesRemoved((int[]) notification.getNewValue(), (List<JavaAttributeOverride>) notification.getOldValue());
- }
- break;
- case Notification.SET :
- if (!notification.isTouch()) {
- attributeOverrideSet(notification.getPosition(), (JavaAttributeOverride) notification.getOldValue(), (JavaAttributeOverride) notification.getNewValue());
- }
- break;
- case Notification.MOVE :
- // Notification.getOldValue() returns the source index
- // Notification.getPositon() returns the target index
- // Notification.getNewValue() returns the moved object
- attributeOverrideMoved(notification.getOldIntValue(), notification.getPosition(), (JavaAttributeOverride) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- @SuppressWarnings("unchecked")
- void associationOverridesChanged(Notification notification) {
- switch (notification.getEventType()) {
- case Notification.ADD :
- associationOverrideAdded(notification.getPosition(), (JavaAssociationOverride) notification.getNewValue());
- break;
- case Notification.ADD_MANY :
- associationOverridesAdded(notification.getPosition(), (List<JavaAssociationOverride>) notification.getNewValue());
- break;
- case Notification.REMOVE :
- associationOverrideRemoved(notification.getPosition(), (JavaAssociationOverride) notification.getOldValue());
- break;
- case Notification.REMOVE_MANY :
- if (notification.getPosition() == Notification.NO_INDEX) {
- associationOverridesCleared((List<JavaAssociationOverride>) notification.getOldValue());
- }
- else {
- // Notification.getNewValue() returns an array of the positions of objects that were removed
- associationOverridesRemoved((int[]) notification.getNewValue(), (List<JavaAssociationOverride>) notification.getOldValue());
- }
- break;
- case Notification.SET :
- if (!notification.isTouch()) {
- associationOverrideSet(notification.getPosition(), (JavaAssociationOverride) notification.getOldValue(), (JavaAssociationOverride) notification.getNewValue());
- }
- break;
- case Notification.MOVE :
- // Notification.getOldValue() returns the source index
- // Notification.getPositon() returns the target index
- // Notification.getNewValue() returns the moved object
- associationOverrideMoved(notification.getOldIntValue(), notification.getPosition(), (JavaAssociationOverride) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- void defaultJoinColumnsChanged(Notification notification) {
- throw new IllegalStateException("'defaultJoinColumns' cannot be changed");
- }
-
- @SuppressWarnings("unchecked")
- void secondaryTablesChanged(Notification notification) {
- switch (notification.getEventType()) {
- case Notification.ADD :
- secondaryTableAdded(notification.getPosition(), (JavaSecondaryTable) notification.getNewValue());
- break;
- case Notification.ADD_MANY :
- secondaryTablesAdded(notification.getPosition(), (List<ISecondaryTable>) notification.getNewValue());
- break;
- case Notification.REMOVE :
- secondaryTableRemoved(notification.getPosition(), (JavaSecondaryTable) notification.getOldValue());
- break;
- case Notification.REMOVE_MANY :
- if (notification.getPosition() == Notification.NO_INDEX) {
- secondaryTablesCleared((List<ISecondaryTable>) notification.getOldValue());
- }
- else {
- // Notification.getNewValue() returns an array of the positions of objects that were removed
- secondaryTablesRemoved((int[]) notification.getNewValue(), (List<ISecondaryTable>) notification.getOldValue());
- }
- break;
- case Notification.SET :
- if (!notification.isTouch()) {
- secondaryTableSet(notification.getPosition(), (JavaSecondaryTable) notification.getOldValue(), (JavaSecondaryTable) notification.getNewValue());
- }
- break;
- case Notification.MOVE :
- // Notification.getOldValue() returns the source index
- // Notification.getPositon() returns the target index
- // Notification.getNewValue() returns the moved object
- secondaryTableMoved(notification.getOldIntValue(), notification.getPosition(), (ISecondaryTable) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- @SuppressWarnings("unchecked")
- void specifiedPrimaryKeyJoinColumnsChanged(Notification notification) {
- switch (notification.getEventType()) {
- case Notification.ADD :
- specifiedPrimaryKeyJoinColumnAdded(notification.getPosition(), (JavaPrimaryKeyJoinColumn) notification.getNewValue());
- break;
- case Notification.ADD_MANY :
- specifiedPrimaryKeyJoinColumnsAdded(notification.getPosition(), (List<IPrimaryKeyJoinColumn>) notification.getNewValue());
- break;
- case Notification.REMOVE :
- specifiedPrimaryKeyJoinColumnRemoved(notification.getPosition(), (JavaPrimaryKeyJoinColumn) notification.getOldValue());
- break;
- case Notification.REMOVE_MANY :
- if (notification.getPosition() == Notification.NO_INDEX) {
- specifiedPrimaryKeyJoinColumnsCleared((List<IPrimaryKeyJoinColumn>) notification.getOldValue());
- }
- else {
- // Notification.getNewValue() returns an array of the positions of objects that were removed
- specifiedPrimaryKeyJoinColumnsRemoved((int[]) notification.getNewValue(), (List<IPrimaryKeyJoinColumn>) notification.getOldValue());
- }
- break;
- case Notification.SET :
- if (!notification.isTouch()) {
- specifiedPrimaryKeyJoinColumnSet(notification.getPosition(), (JavaPrimaryKeyJoinColumn) notification.getOldValue(), (JavaPrimaryKeyJoinColumn) notification.getNewValue());
- }
- break;
- case Notification.MOVE :
- // Notification.getOldValue() returns the source index
- // Notification.getPositon() returns the target index
- // Notification.getNewValue() returns the moved object
- specifiedPrimaryKeyJoinColumnMoved(notification.getOldIntValue(), notification.getPosition(), (JavaPrimaryKeyJoinColumn) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- @SuppressWarnings("unchecked")
- void namedQueriesChanged(Notification notification) {
- switch (notification.getEventType()) {
- case Notification.ADD :
- namedQueryAdded(notification.getPosition(), (JavaNamedQuery) notification.getNewValue());
- break;
- case Notification.ADD_MANY :
- namedQueriesAdded(notification.getPosition(), (List<JavaNamedQuery>) notification.getNewValue());
- break;
- case Notification.REMOVE :
- namedQueryRemoved(notification.getPosition(), (JavaNamedQuery) notification.getOldValue());
- break;
- case Notification.REMOVE_MANY :
- if (notification.getPosition() == Notification.NO_INDEX) {
- namedQueriesCleared((List<JavaNamedQuery>) notification.getOldValue());
- }
- else {
- // Notification.getNewValue() returns an array of the positions of objects that were removed
- namedQueriesRemoved((int[]) notification.getNewValue(), (List<JavaNamedQuery>) notification.getOldValue());
- }
- break;
- case Notification.SET :
- if (!notification.isTouch()) {
- namedQuerySet(notification.getPosition(), (JavaNamedQuery) notification.getOldValue(), (JavaNamedQuery) notification.getNewValue());
- }
- break;
- case Notification.MOVE :
- // Notification.getOldValue() returns the source index
- // Notification.getPositon() returns the target index
- // Notification.getNewValue() returns the moved object
- namedQueryMoved(notification.getOldIntValue(), notification.getPosition(), (JavaNamedQuery) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- @SuppressWarnings("unchecked")
- void namedNativeQueriesChanged(Notification notification) {
- switch (notification.getEventType()) {
- case Notification.ADD :
- namedNativeQueryAdded(notification.getPosition(), (JavaNamedNativeQuery) notification.getNewValue());
- break;
- case Notification.ADD_MANY :
- namedNativeQueriesAdded(notification.getPosition(), (List<JavaNamedNativeQuery>) notification.getNewValue());
- break;
- case Notification.REMOVE :
- namedNativeQueryRemoved(notification.getPosition(), (JavaNamedNativeQuery) notification.getOldValue());
- break;
- case Notification.REMOVE_MANY :
- if (notification.getPosition() == Notification.NO_INDEX) {
- namedNativeQueriesCleared((List<JavaNamedNativeQuery>) notification.getOldValue());
- }
- else {
- // Notification.getNewValue() returns an array of the positions of objects that were removed
- namedNativeQueriesRemoved((int[]) notification.getNewValue(), (List<JavaNamedNativeQuery>) notification.getOldValue());
- }
- break;
- case Notification.SET :
- if (!notification.isTouch()) {
- namedNativeQuerySet(notification.getPosition(), (JavaNamedNativeQuery) notification.getOldValue(), (JavaNamedNativeQuery) notification.getNewValue());
- }
- break;
- case Notification.MOVE :
- // Notification.getOldValue() returns the source index
- // Notification.getPositon() returns the target index
- // Notification.getNewValue() returns the moved object
- namedNativeQueryMoved(notification.getOldIntValue(), notification.getPosition(), (JavaNamedNativeQuery) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- // ********** jpa model -> java annotations **********
- /**
- * slide over all the annotations that follow the new attribute override
- */
- public void attributeOverrideAdded(int index, JavaAttributeOverride attributeOverride) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (attributeOverride.annotation(getType().astRoot()) == null) {
- this.synchAttributeOverrideAnnotationsAfterAdd(index + 1);
- attributeOverride.newAnnotation();
- }
- }
-
- public void attributeOverridesAdded(int index, List<JavaAttributeOverride> attributeOverrides) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (!attributeOverrides.isEmpty() && (attributeOverrides.get(0).annotation(getType().astRoot()) == null)) {
- this.synchAttributeOverrideAnnotationsAfterAdd(index + attributeOverrides.size());
- for (JavaAttributeOverride attributeOverride : attributeOverrides) {
- attributeOverride.newAnnotation();
- }
- }
- }
-
- public void attributeOverrideRemoved(int index, JavaAttributeOverride attributeOverride) {
- attributeOverride.removeAnnotation();
- this.synchAttributeOverrideAnnotationsAfterRemove(index);
- }
-
- public void attributeOverridesRemoved(int[] indexes, List<JavaAttributeOverride> attributeOverrides) {
- for (JavaAttributeOverride attributeOverride : attributeOverrides) {
- attributeOverride.removeAnnotation();
- }
- this.synchAttributeOverrideAnnotationsAfterRemove(indexes[0]);
- }
-
- public void attributeOverridesCleared(List<JavaAttributeOverride> attributeOverrides) {
- for (JavaAttributeOverride attributeOverride : attributeOverrides) {
- attributeOverride.removeAnnotation();
- }
- }
-
- public void attributeOverrideSet(int index, JavaAttributeOverride oldAttributeOverride, JavaAttributeOverride newAttributeOverride) {
- newAttributeOverride.newAnnotation();
- }
-
- public void attributeOverrideMoved(int sourceIndex, int targetIndex, JavaAttributeOverride attributeOverride) {
- List<IAttributeOverride> attributeOverrides = getSpecifiedAttributeOverrides();
- int begin = Math.min(sourceIndex, targetIndex);
- int end = Math.max(sourceIndex, targetIndex);
- for (int i = begin; i-- > end;) {
- this.synch((JavaAttributeOverride) attributeOverrides.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the end of the list to prevent overlap
- */
- private void synchAttributeOverrideAnnotationsAfterAdd(int index) {
- List<IAttributeOverride> attributeOverrides = getSpecifiedAttributeOverrides();
- for (int i = attributeOverrides.size(); i-- > index;) {
- this.synch((JavaAttributeOverride) attributeOverrides.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the specified index to prevent overlap
- */
- private void synchAttributeOverrideAnnotationsAfterRemove(int index) {
- List<IAttributeOverride> attributeOverrides = getSpecifiedAttributeOverrides();
- for (int i = index; i < attributeOverrides.size(); i++) {
- this.synch((JavaAttributeOverride) attributeOverrides.get(i), i);
- }
- }
-
- private void synch(JavaAttributeOverride attributeOverride, int index) {
- attributeOverride.moveAnnotation(index);
- }
-
- /**
- * slide over all the annotations that follow the new association override
- */
- public void associationOverrideAdded(int index, JavaAssociationOverride associationOverride) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (associationOverride.annotation(getType().astRoot()) == null) {
- this.synchAssociationOverrideAnnotationsAfterAdd(index + 1);
- associationOverride.newAnnotation();
- }
- }
-
- public void associationOverridesAdded(int index, List<JavaAssociationOverride> associationOverrides) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (!associationOverrides.isEmpty() && (associationOverrides.get(0).annotation(getType().astRoot()) == null)) {
- this.synchAssociationOverrideAnnotationsAfterAdd(index + associationOverrides.size());
- for (JavaAssociationOverride associationOverride : associationOverrides) {
- associationOverride.newAnnotation();
- }
- }
- }
-
- public void associationOverrideRemoved(int index, JavaAssociationOverride associationOverride) {
- associationOverride.removeAnnotation();
- this.synchAssociationOverrideAnnotationsAfterRemove(index);
- }
-
- public void associationOverridesRemoved(int[] indexes, List<JavaAssociationOverride> associationOverrides) {
- for (JavaAssociationOverride associationOverride : associationOverrides) {
- associationOverride.removeAnnotation();
- }
- this.synchAssociationOverrideAnnotationsAfterRemove(indexes[0]);
- }
-
- public void associationOverridesCleared(List<JavaAssociationOverride> associationOverrides) {
- for (JavaAssociationOverride associationOverride : associationOverrides) {
- associationOverride.removeAnnotation();
- }
- }
-
- public void associationOverrideSet(int index, JavaAssociationOverride oldAssociationOverride, JavaAssociationOverride newAssociationOverride) {
- newAssociationOverride.newAnnotation();
- }
-
- public void associationOverrideMoved(int sourceIndex, int targetIndex, JavaAssociationOverride associationOverride) {
- List<IAssociationOverride> assocationOverrides = getSpecifiedAssociationOverrides();
- int begin = Math.min(sourceIndex, targetIndex);
- int end = Math.max(sourceIndex, targetIndex);
- for (int i = begin; i-- > end;) {
- this.synch((JavaAssociationOverride) assocationOverrides.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the end of the list to prevent overlap
- */
- private void synchAssociationOverrideAnnotationsAfterAdd(int index) {
- List<IAssociationOverride> associationOverrides = getSpecifiedAssociationOverrides();
- for (int i = associationOverrides.size(); i-- > index;) {
- this.synch((JavaAssociationOverride) associationOverrides.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the specified index to prevent overlap
- */
- private void synchAssociationOverrideAnnotationsAfterRemove(int index) {
- List<IAssociationOverride> assocationOverrides = getSpecifiedAssociationOverrides();
- for (int i = index; i < assocationOverrides.size(); i++) {
- this.synch((JavaAssociationOverride) assocationOverrides.get(i), i);
- }
- }
-
- private void synch(JavaAssociationOverride associationOverride, int index) {
- associationOverride.moveAnnotation(index);
- }
-
- /**
- * slide over all the annotations that follow the new secondary table
- */
- // bjv look at this
- public void secondaryTableAdded(int index, JavaSecondaryTable secondaryTable) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (secondaryTable.annotation(getType().astRoot()) == null) {
- this.synchSecondaryTableAnnotationsAfterAdd(index + 1);
- secondaryTable.newAnnotation();
- }
- }
-
- public void secondaryTablesAdded(int index, List<ISecondaryTable> secondaryTables) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (!secondaryTables.isEmpty() && ((JavaSecondaryTable) secondaryTables.get(0)).annotation(getType().astRoot()) == null) {
- this.synchSecondaryTableAnnotationsAfterAdd(index + secondaryTables.size());
- for (Iterator<ISecondaryTable> stream = secondaryTables.iterator(); stream.hasNext();) {
- JavaSecondaryTable secondaryTable = (JavaSecondaryTable) stream.next();
- secondaryTable.newAnnotation();
- }
- }
- }
-
- public void secondaryTableRemoved(int index, JavaSecondaryTable secondaryTable) {
- secondaryTable.removeAnnotation();
- this.synchSecondaryTableAnnotationsAfterRemove(index);
- }
-
- public void secondaryTablesRemoved(int[] indexes, List<ISecondaryTable> secondaryTables) {
- for (Iterator<ISecondaryTable> stream = secondaryTables.iterator(); stream.hasNext();) {
- JavaSecondaryTable secondaryTable = (JavaSecondaryTable) stream.next();
- secondaryTable.removeAnnotation();
- }
- this.synchSecondaryTableAnnotationsAfterRemove(indexes[0]);
- }
-
- public void secondaryTablesCleared(List<ISecondaryTable> secondaryTables) {
- for (Iterator<ISecondaryTable> stream = secondaryTables.iterator(); stream.hasNext();) {
- JavaSecondaryTable secondaryTable = (JavaSecondaryTable) stream.next();
- secondaryTable.removeAnnotation();
- }
- }
-
- public void secondaryTableSet(int index, JavaSecondaryTable oldSecondaryTable, JavaSecondaryTable newSecondaryTable) {
- newSecondaryTable.newAnnotation();
- }
-
- public void secondaryTableMoved(int sourceIndex, int targetIndex, ISecondaryTable secondaryTable) {
- List<ISecondaryTable> secondaryTables = getSecondaryTables();
- int begin = Math.min(sourceIndex, targetIndex);
- int end = Math.max(sourceIndex, targetIndex);
- for (int i = begin; i-- > end;) {
- this.synch((JavaSecondaryTable) secondaryTables.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the end of the list to prevent overlap
- */
- private void synchSecondaryTableAnnotationsAfterAdd(int index) {
- List<ISecondaryTable> secondaryTables = getSecondaryTables();
- for (int i = secondaryTables.size(); i-- > index;) {
- this.synch((JavaSecondaryTable) secondaryTables.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the specified index to prevent overlap
- */
- private void synchSecondaryTableAnnotationsAfterRemove(int index) {
- List<ISecondaryTable> secondaryTables = getSecondaryTables();
- for (int i = index; i < secondaryTables.size(); i++) {
- this.synch((JavaSecondaryTable) secondaryTables.get(i), i);
- }
- }
-
- private void synch(JavaSecondaryTable secondaryTable, int index) {
- secondaryTable.moveAnnotation(index);
- }
-
- /**
- * slide over all the annotations that follow the new
- * primary key join column
- */
- // bjv look at this
- public void specifiedPrimaryKeyJoinColumnAdded(int index, JavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- if (primaryKeyJoinColumn.annotation(getType().astRoot()) == null) {
- this.synchPKJCAnnotationsAfterAdd(index + 1);
- primaryKeyJoinColumn.newAnnotation();
- }
- }
-
- public void specifiedPrimaryKeyJoinColumnsAdded(int index, List<IPrimaryKeyJoinColumn> primaryKeyJoinColumns) {
- if (!primaryKeyJoinColumns.isEmpty() && ((JavaPrimaryKeyJoinColumn) primaryKeyJoinColumns.get(0)).annotation(getType().astRoot()) == null) {
- this.synchPKJCAnnotationsAfterAdd(index + primaryKeyJoinColumns.size());
- for (Iterator<IPrimaryKeyJoinColumn> stream = primaryKeyJoinColumns.iterator(); stream.hasNext();) {
- JavaPrimaryKeyJoinColumn primaryKeyJoinColumn = (JavaPrimaryKeyJoinColumn) stream.next();
- primaryKeyJoinColumn.newAnnotation();
- }
- }
- }
-
- public void specifiedPrimaryKeyJoinColumnRemoved(int index, JavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- primaryKeyJoinColumn.removeAnnotation();
- this.synchPKJCAnnotationsAfterRemove(index);
- }
-
- public void specifiedPrimaryKeyJoinColumnsRemoved(int[] indexes, List<IPrimaryKeyJoinColumn> primaryKeyJoinColumns) {
- for (Iterator<IPrimaryKeyJoinColumn> stream = primaryKeyJoinColumns.iterator(); stream.hasNext();) {
- JavaPrimaryKeyJoinColumn primaryKeyJoinColumn = (JavaPrimaryKeyJoinColumn) stream.next();
- primaryKeyJoinColumn.removeAnnotation();
- }
- this.synchPKJCAnnotationsAfterRemove(indexes[0]);
- }
-
- public void specifiedPrimaryKeyJoinColumnsCleared(List<IPrimaryKeyJoinColumn> primaryKeyJoinColumns) {
- for (Iterator<IPrimaryKeyJoinColumn> stream = primaryKeyJoinColumns.iterator(); stream.hasNext();) {
- JavaPrimaryKeyJoinColumn primaryKeyJoinColumn = (JavaPrimaryKeyJoinColumn) stream.next();
- primaryKeyJoinColumn.removeAnnotation();
- }
- }
-
- public void specifiedPrimaryKeyJoinColumnSet(int index, JavaPrimaryKeyJoinColumn oldPrimaryKeyJoinColumn, JavaPrimaryKeyJoinColumn newPrimaryKeyJoinColumn) {
- newPrimaryKeyJoinColumn.newAnnotation();
- }
-
- public void specifiedPrimaryKeyJoinColumnMoved(int sourceIndex, int targetIndex, JavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
- List<IPrimaryKeyJoinColumn> primaryKeyJoinColumns = getSpecifiedPrimaryKeyJoinColumns();
- int begin = Math.min(sourceIndex, targetIndex);
- int end = Math.max(sourceIndex, targetIndex);
- for (int i = begin; i-- > end;) {
- this.synch((JavaPrimaryKeyJoinColumn) primaryKeyJoinColumns.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the end of the list to prevent overlap
- */
- private void synchPKJCAnnotationsAfterAdd(int index) {
- List<IPrimaryKeyJoinColumn> primaryKeyJoinColumns = getSpecifiedPrimaryKeyJoinColumns();
- for (int i = primaryKeyJoinColumns.size(); i-- > index;) {
- this.synch((JavaPrimaryKeyJoinColumn) primaryKeyJoinColumns.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the specified index to prevent overlap
- */
- private void synchPKJCAnnotationsAfterRemove(int index) {
- List<IPrimaryKeyJoinColumn> primaryKeyJoinColumns = getSpecifiedPrimaryKeyJoinColumns();
- for (int i = index; i < primaryKeyJoinColumns.size(); i++) {
- this.synch((JavaPrimaryKeyJoinColumn) primaryKeyJoinColumns.get(i), i);
- }
- }
-
- private void synch(JavaPrimaryKeyJoinColumn primaryKeyJoinColumn, int index) {
- primaryKeyJoinColumn.moveAnnotation(index);
- }
-
- /**
- * slide over all the annotations that follow the new secondary table
- */
- // bjv look at this
- public void namedQueryAdded(int index, JavaNamedQuery namedQuery) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (namedQuery.annotation(getType().astRoot()) == null) {
- this.synchNamedQueryAnnotationsAfterAdd(index + 1);
- namedQuery.newAnnotation();
- }
- }
-
- public void namedQueriesAdded(int index, List<JavaNamedQuery> queries) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (!queries.isEmpty() && queries.get(0).annotation(getType().astRoot()) == null) {
- this.synchNamedQueryAnnotationsAfterAdd(index + queries.size());
- for (JavaNamedQuery namedQuery : queries) {
- namedQuery.newAnnotation();
- }
- }
- }
-
- public void namedQueryRemoved(int index, JavaNamedQuery namedQuery) {
- namedQuery.removeAnnotation();
- this.synchNamedQueryAnnotationsAfterRemove(index);
- }
-
- public void namedQueriesRemoved(int[] indexes, List<JavaNamedQuery> queries) {
- for (JavaNamedQuery namedQuery : queries) {
- namedQuery.removeAnnotation();
- }
- this.synchNamedQueryAnnotationsAfterRemove(indexes[0]);
- }
-
- public void namedQueriesCleared(List<JavaNamedQuery> queries) {
- for (JavaNamedQuery namedQuery : queries) {
- namedQuery.removeAnnotation();
- }
- }
-
- public void namedQuerySet(int index, JavaNamedQuery oldNamedQuery, JavaNamedQuery newNamedQuery) {
- newNamedQuery.newAnnotation();
- }
-
- public void namedQueryMoved(int sourceIndex, int targetIndex, JavaNamedQuery namedQuery) {
- List<INamedQuery> queries = getNamedQueries();
- int begin = Math.min(sourceIndex, targetIndex);
- int end = Math.max(sourceIndex, targetIndex);
- for (int i = begin; i-- > end;) {
- this.synch((JavaNamedQuery) queries.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the end of the list to prevent overlap
- */
- private void synchNamedQueryAnnotationsAfterAdd(int index) {
- List<INamedQuery> queries = getNamedQueries();
- for (int i = queries.size(); i-- > index;) {
- this.synch((JavaNamedQuery) queries.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the specified index to prevent overlap
- */
- private void synchNamedQueryAnnotationsAfterRemove(int index) {
- List<INamedQuery> queries = getNamedQueries();
- for (int i = index; i < queries.size(); i++) {
- this.synch((JavaNamedQuery) queries.get(i), i);
- }
- }
-
- private void synch(JavaNamedQuery namedQuery, int index) {
- namedQuery.moveAnnotation(index);
- }
-
- /**
- * slide over all the annotations that follow the new secondary table
- */
- // bjv look at this
- public void namedNativeQueryAdded(int index, JavaNamedNativeQuery namedQuery) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (namedQuery.annotation(getType().astRoot()) == null) {
- this.synchNamedNativeQueryAnnotationsAfterAdd(index + 1);
- namedQuery.newAnnotation();
- }
- }
-
- public void namedNativeQueriesAdded(int index, List<JavaNamedNativeQuery> queries) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (!queries.isEmpty() && queries.get(0).annotation(getType().astRoot()) == null) {
- this.synchNamedNativeQueryAnnotationsAfterAdd(index + queries.size());
- for (JavaNamedNativeQuery namedQuery : queries) {
- namedQuery.newAnnotation();
- }
- }
- }
-
- public void namedNativeQueryRemoved(int index, JavaNamedNativeQuery namedQuery) {
- namedQuery.removeAnnotation();
- this.synchNamedNativeQueryAnnotationsAfterRemove(index);
- }
-
- public void namedNativeQueriesRemoved(int[] indexes, List<JavaNamedNativeQuery> queries) {
- for (JavaNamedNativeQuery namedQuery : queries) {
- namedQuery.removeAnnotation();
- }
- this.synchNamedNativeQueryAnnotationsAfterRemove(indexes[0]);
- }
-
- public void namedNativeQueriesCleared(List<JavaNamedNativeQuery> queries) {
- for (JavaNamedNativeQuery namedQuery : queries) {
- namedQuery.removeAnnotation();
- }
- }
-
- public void namedNativeQuerySet(int index, JavaNamedNativeQuery oldNamedQuery, JavaNamedNativeQuery newNamedQuery) {
- newNamedQuery.newAnnotation();
- }
-
- public void namedNativeQueryMoved(int sourceIndex, int targetIndex, JavaNamedNativeQuery namedQuery) {
- List<INamedNativeQuery> queries = getNamedNativeQueries();
- int begin = Math.min(sourceIndex, targetIndex);
- int end = Math.max(sourceIndex, targetIndex);
- for (int i = begin; i-- > end;) {
- this.synch((JavaNamedNativeQuery) queries.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the end of the list to prevent overlap
- */
- private void synchNamedNativeQueryAnnotationsAfterAdd(int index) {
- List<INamedNativeQuery> queries = getNamedNativeQueries();
- for (int i = queries.size(); i-- > index;) {
- this.synch((JavaNamedNativeQuery) queries.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the specified index to prevent overlap
- */
- private void synchNamedNativeQueryAnnotationsAfterRemove(int index) {
- List<INamedNativeQuery> queries = getNamedNativeQueries();
- for (int i = index; i < queries.size(); i++) {
- this.synch((JavaNamedNativeQuery) queries.get(i), i);
- }
- }
-
- private void synch(JavaNamedNativeQuery namedQuery, int index) {
- namedQuery.moveAnnotation(index);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_ENTITY;
- }
-
- @Override
- public String getName() {
- return (this.getSpecifiedName() == null) ? this.getDefaultName() : this.getSpecifiedName();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Name</em>' attribute.
- * @see #setSpecifiedName(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_SpecifiedName()
- * @model
- * @generated
- */
- public String getSpecifiedName() {
- return specifiedName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity#getSpecifiedName <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Name</em>' attribute.
- * @see #getSpecifiedName()
- * @generated
- */
- public void setSpecifiedName(String newSpecifiedName) {
- String oldSpecifiedName = specifiedName;
- specifiedName = newSpecifiedName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_NAME, oldSpecifiedName, specifiedName));
- }
-
- /**
- * Returns the value of the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_DefaultName()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultName() {
- return defaultName;
- }
-
- /**
- * Returns the value of the '<em><b>Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_Table()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- public ITable getTable() {
- return table;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetTable(ITable newTable, NotificationChain msgs) {
- ITable oldTable = table;
- table = newTable;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ENTITY__TABLE, oldTable, newTable);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Returns the value of the '<em><b>Specified Secondary Tables</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Secondary Tables</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Secondary Tables</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_SpecifiedSecondaryTables()
- * @model containment="true"
- * @generated
- */
- public EList<ISecondaryTable> getSpecifiedSecondaryTables() {
- if (specifiedSecondaryTables == null) {
- specifiedSecondaryTables = new EObjectContainmentEList<ISecondaryTable>(ISecondaryTable.class, this, JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_SECONDARY_TABLES);
- }
- return specifiedSecondaryTables;
- }
-
- public EList<ISecondaryTable> getSecondaryTables() {
- return getSpecifiedSecondaryTables();
- }
-
- public boolean containsSecondaryTable(String name) {
- return containsSecondaryTable(name, getSecondaryTables());
- }
-
- public boolean containsSpecifiedSecondaryTable(String name) {
- return containsSecondaryTable(name, getSpecifiedSecondaryTables());
- }
-
- private boolean containsSecondaryTable(String name, List<ISecondaryTable> secondaryTables) {
- for (ISecondaryTable secondaryTable : secondaryTables) {
- String secondaryTableName = secondaryTable.getName();
- if (secondaryTableName != null && secondaryTableName.equals(name)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns the value of the '<em><b>Inheritance Strategy</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.InheritanceType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Inheritance Strategy</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Inheritance Strategy</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.InheritanceType
- * @see #setInheritanceStrategy(InheritanceType)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_InheritanceStrategy()
- * @model
- * @generated
- */
- public InheritanceType getInheritanceStrategy() {
- return inheritanceStrategy;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity#getInheritanceStrategy <em>Inheritance Strategy</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Inheritance Strategy</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.InheritanceType
- * @see #getInheritanceStrategy()
- * @generated
- */
- public void setInheritanceStrategy(InheritanceType newInheritanceStrategy) {
- InheritanceType oldInheritanceStrategy = inheritanceStrategy;
- inheritanceStrategy = newInheritanceStrategy == null ? INHERITANCE_STRATEGY_EDEFAULT : newInheritanceStrategy;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ENTITY__INHERITANCE_STRATEGY, oldInheritanceStrategy, inheritanceStrategy));
- }
-
- /**
- * Returns the value of the '<em><b>Discriminator Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Discriminator Column</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Discriminator Column</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_DiscriminatorColumn()
- * @model containment="true" changeable="false"
- * @generated
- */
- public IDiscriminatorColumn getDiscriminatorColumn() {
- return discriminatorColumn;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetDiscriminatorColumn(IDiscriminatorColumn newDiscriminatorColumn, NotificationChain msgs) {
- IDiscriminatorColumn oldDiscriminatorColumn = discriminatorColumn;
- discriminatorColumn = newDiscriminatorColumn;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ENTITY__DISCRIMINATOR_COLUMN, oldDiscriminatorColumn, newDiscriminatorColumn);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Returns the value of the '<em><b>Sequence Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Sequence Generator</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Sequence Generator</em>' containment reference.
- * @see #setSequenceGenerator(ISequenceGenerator)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_SequenceGenerator()
- * @model containment="true"
- * @generated
- */
- public ISequenceGenerator getSequenceGenerator() {
- return sequenceGenerator;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetSequenceGenerator(ISequenceGenerator newSequenceGenerator, NotificationChain msgs) {
- ISequenceGenerator oldSequenceGenerator = sequenceGenerator;
- sequenceGenerator = newSequenceGenerator;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ENTITY__SEQUENCE_GENERATOR, oldSequenceGenerator, newSequenceGenerator);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity#getSequenceGenerator <em>Sequence Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Sequence Generator</em>' containment reference.
- * @see #getSequenceGenerator()
- * @generated
- */
- public void setSequenceGenerator(ISequenceGenerator newSequenceGenerator) {
- if (newSequenceGenerator != sequenceGenerator) {
- NotificationChain msgs = null;
- if (sequenceGenerator != null)
- msgs = ((InternalEObject) sequenceGenerator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ENTITY__SEQUENCE_GENERATOR, null, msgs);
- if (newSequenceGenerator != null)
- msgs = ((InternalEObject) newSequenceGenerator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ENTITY__SEQUENCE_GENERATOR, null, msgs);
- msgs = basicSetSequenceGenerator(newSequenceGenerator, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ENTITY__SEQUENCE_GENERATOR, newSequenceGenerator, newSequenceGenerator));
- }
-
- /**
- * Returns the value of the '<em><b>Table Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table Generator</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table Generator</em>' containment reference.
- * @see #setTableGenerator(ITableGenerator)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_TableGenerator()
- * @model containment="true"
- * @generated
- */
- public ITableGenerator getTableGenerator() {
- return tableGenerator;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetTableGenerator(ITableGenerator newTableGenerator, NotificationChain msgs) {
- ITableGenerator oldTableGenerator = tableGenerator;
- tableGenerator = newTableGenerator;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ENTITY__TABLE_GENERATOR, oldTableGenerator, newTableGenerator);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity#getTableGenerator <em>Table Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Table Generator</em>' containment reference.
- * @see #getTableGenerator()
- * @generated
- */
- public void setTableGenerator(ITableGenerator newTableGenerator) {
- if (newTableGenerator != tableGenerator) {
- NotificationChain msgs = null;
- if (tableGenerator != null)
- msgs = ((InternalEObject) tableGenerator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ENTITY__TABLE_GENERATOR, null, msgs);
- if (newTableGenerator != null)
- msgs = ((InternalEObject) newTableGenerator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ENTITY__TABLE_GENERATOR, null, msgs);
- msgs = basicSetTableGenerator(newTableGenerator, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ENTITY__TABLE_GENERATOR, newTableGenerator, newTableGenerator));
- }
-
- /**
- * Returns the value of the '<em><b>Default Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Discriminator Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Discriminator Value</em>' attribute.
- * @see #setDefaultDiscriminatorValue(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_DefaultDiscriminatorValue()
- * @model
- * @generated
- */
- public String getDefaultDiscriminatorValue() {
- return defaultDiscriminatorValue;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity#getDefaultDiscriminatorValue <em>Default Discriminator Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Default Discriminator Value</em>' attribute.
- * @see #getDefaultDiscriminatorValue()
- * @generated
- */
- public void setDefaultDiscriminatorValue(String newDefaultDiscriminatorValue) {
- String oldDefaultDiscriminatorValue = defaultDiscriminatorValue;
- defaultDiscriminatorValue = newDefaultDiscriminatorValue;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_DISCRIMINATOR_VALUE, oldDefaultDiscriminatorValue, defaultDiscriminatorValue));
- }
-
- /**
- * Returns the value of the '<em><b>Specified Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Discriminator Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Discriminator Value</em>' attribute.
- * @see #setSpecifiedDiscriminatorValue(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_SpecifiedDiscriminatorValue()
- * @model
- * @generated
- */
- public String getSpecifiedDiscriminatorValue() {
- return specifiedDiscriminatorValue;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity#getSpecifiedDiscriminatorValue <em>Specified Discriminator Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Discriminator Value</em>' attribute.
- * @see #getSpecifiedDiscriminatorValue()
- * @generated
- */
- public void setSpecifiedDiscriminatorValue(String newSpecifiedDiscriminatorValue) {
- String oldSpecifiedDiscriminatorValue = specifiedDiscriminatorValue;
- specifiedDiscriminatorValue = newSpecifiedDiscriminatorValue;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_DISCRIMINATOR_VALUE, oldSpecifiedDiscriminatorValue, specifiedDiscriminatorValue));
- }
-
- /**
- * Returns the value of the '<em><b>Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Discriminator Value</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Discriminator Value</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_DiscriminatorValue()
- * @model transient="true" changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getDiscriminatorValue() {
- return (this.getSpecifiedDiscriminatorValue() == null) ? getDefaultDiscriminatorValue() : this.getSpecifiedDiscriminatorValue();
- }
-
- public EList<IPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- return this.getSpecifiedPrimaryKeyJoinColumns().isEmpty() ? this.getDefaultPrimaryKeyJoinColumns() : this.getSpecifiedPrimaryKeyJoinColumns();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Primary Key Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Primary Key Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Primary Key Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_SpecifiedPrimaryKeyJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
- if (specifiedPrimaryKeyJoinColumns == null) {
- specifiedPrimaryKeyJoinColumns = new EObjectContainmentEList<IPrimaryKeyJoinColumn>(IPrimaryKeyJoinColumn.class, this, JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS);
- }
- return specifiedPrimaryKeyJoinColumns;
- }
-
- /**
- * Returns the value of the '<em><b>Default Primary Key Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Primary Key Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Primary Key Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_DefaultPrimaryKeyJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns() {
- if (defaultPrimaryKeyJoinColumns == null) {
- defaultPrimaryKeyJoinColumns = new EObjectContainmentEList<IPrimaryKeyJoinColumn>(IPrimaryKeyJoinColumn.class, this, JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS);
- }
- return defaultPrimaryKeyJoinColumns;
- }
-
- public EList<IAttributeOverride> getAttributeOverrides() {
- EList<IAttributeOverride> list = new EObjectEList<IAttributeOverride>(IAttributeOverride.class, this, JpaJavaMappingsPackage.JAVA_ENTITY__ATTRIBUTE_OVERRIDES);
- list.addAll(getSpecifiedAttributeOverrides());
- list.addAll(getDefaultAttributeOverrides());
- return list;
- }
-
- public IAttributeOverride attributeOverrideNamed(String name) {
- return (IAttributeOverride) overrideNamed(name, getAttributeOverrides());
- }
-
- public boolean containsAttributeOverride(String name) {
- return containsOverride(name, getAttributeOverrides());
- }
-
- public boolean containsDefaultAttributeOverride(String name) {
- return containsOverride(name, getDefaultAttributeOverrides());
- }
-
- public boolean containsSpecifiedAttributeOverride(String name) {
- return containsOverride(name, getSpecifiedAttributeOverrides());
- }
-
- public boolean containsAssociationOverride(String name) {
- return containsOverride(name, getAssociationOverrides());
- }
-
- public boolean containsSpecifiedAssociationOverride(String name) {
- return containsOverride(name, getSpecifiedAssociationOverrides());
- }
-
- public boolean containsDefaultAssociationOverride(String name) {
- return containsOverride(name, getDefaultAssociationOverrides());
- }
-
- private IOverride overrideNamed(String name, List<? extends IOverride> overrides) {
- for (IOverride override : overrides) {
- String overrideName = override.getName();
- if (overrideName == null && name == null) {
- return override;
- }
- if (overrideName != null && overrideName.equals(name)) {
- return override;
- }
- }
- return null;
- }
-
- private boolean containsOverride(String name, List<? extends IOverride> overrides) {
- return overrideNamed(name, overrides) != null;
- }
-
- /**
- * Returns the value of the '<em><b>Specified Attribute Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Attribute Overrides</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Attribute Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_SpecifiedAttributeOverrides()
- * @model containment="true"
- * @generated
- */
- public EList<IAttributeOverride> getSpecifiedAttributeOverrides() {
- if (specifiedAttributeOverrides == null) {
- specifiedAttributeOverrides = new EObjectContainmentEList<IAttributeOverride>(IAttributeOverride.class, this, JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES);
- }
- return specifiedAttributeOverrides;
- }
-
- /**
- * Returns the value of the '<em><b>Default Attribute Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Attribute Overrides</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Attribute Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_DefaultAttributeOverrides()
- * @model containment="true"
- * @generated
- */
- public EList<IAttributeOverride> getDefaultAttributeOverrides() {
- if (defaultAttributeOverrides == null) {
- defaultAttributeOverrides = new EObjectContainmentEList<IAttributeOverride>(IAttributeOverride.class, this, JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_ATTRIBUTE_OVERRIDES);
- }
- return defaultAttributeOverrides;
- }
-
- public EList<IAssociationOverride> getAssociationOverrides() {
- EList<IAssociationOverride> list = new EObjectEList<IAssociationOverride>(IAssociationOverride.class, this, JpaJavaMappingsPackage.JAVA_ENTITY__ASSOCIATION_OVERRIDES);
- list.addAll(getSpecifiedAssociationOverrides());
- list.addAll(getDefaultAssociationOverrides());
- return list;
- }
-
- /**
- * Returns the value of the '<em><b>Specified Association Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Association Overrides</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Association Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_SpecifiedAssociationOverrides()
- * @model containment="true"
- * @generated
- */
- public EList<IAssociationOverride> getSpecifiedAssociationOverrides() {
- if (specifiedAssociationOverrides == null) {
- specifiedAssociationOverrides = new EObjectContainmentEList<IAssociationOverride>(IAssociationOverride.class, this, JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_ASSOCIATION_OVERRIDES);
- }
- return specifiedAssociationOverrides;
- }
-
- /**
- * Returns the value of the '<em><b>Default Association Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Association Overrides</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Association Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_DefaultAssociationOverrides()
- * @model containment="true"
- * @generated
- */
- public EList<IAssociationOverride> getDefaultAssociationOverrides() {
- if (defaultAssociationOverrides == null) {
- defaultAssociationOverrides = new EObjectContainmentEList<IAssociationOverride>(IAssociationOverride.class, this, JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_ASSOCIATION_OVERRIDES);
- }
- return defaultAssociationOverrides;
- }
-
- /**
- * Returns the value of the '<em><b>Named Queries</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.INamedQuery}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Named Queries</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Named Queries</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_NamedQueries()
- * @model containment="true"
- * @generated
- */
- public EList<INamedQuery> getNamedQueries() {
- if (namedQueries == null) {
- namedQueries = new EObjectContainmentEList<INamedQuery>(INamedQuery.class, this, JpaJavaMappingsPackage.JAVA_ENTITY__NAMED_QUERIES);
- }
- return namedQueries;
- }
-
- /**
- * Returns the value of the '<em><b>Named Native Queries</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.INamedNativeQuery}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Named Native Queries</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Named Native Queries</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_NamedNativeQueries()
- * @model containment="true"
- * @generated
- */
- public EList<INamedNativeQuery> getNamedNativeQueries() {
- if (namedNativeQueries == null) {
- namedNativeQueries = new EObjectContainmentEList<INamedNativeQuery>(INamedNativeQuery.class, this, JpaJavaMappingsPackage.JAVA_ENTITY__NAMED_NATIVE_QUERIES);
- }
- return namedNativeQueries;
- }
-
- /**
- * Returns the value of the '<em><b>Id Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Id Class</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Id Class</em>' attribute.
- * @see #setIdClass(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIEntity_IdClass()
- * @model
- * @generated
- */
- public String getIdClass() {
- return idClass;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity#getIdClass <em>Id Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Id Class</em>' attribute.
- * @see #getIdClass()
- * @generated
- */
- public void setIdClass(String newIdClass) {
- String oldIdClass = idClass;
- idClass = newIdClass;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ENTITY__ID_CLASS, oldIdClass, idClass));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated NOT
- */
- public boolean discriminatorValueIsAllowed() {
- return !getType().isAbstract();
- }
-
- public IEntity parentEntity() {
- for (Iterator<IPersistentType> i = getPersistentType().inheritanceHierarchy(); i.hasNext();) {
- ITypeMapping typeMapping = i.next().getMapping();
- if (typeMapping != this && typeMapping instanceof IEntity) {
- return (IEntity) typeMapping;
- }
- }
- return this;
- }
-
- public IEntity rootEntity() {
- IEntity rootEntity = null;
- for (Iterator<IPersistentType> i = getPersistentType().inheritanceHierarchy(); i.hasNext();) {
- IPersistentType persistentType = i.next();
- if (persistentType.getMapping() instanceof IEntity) {
- rootEntity = (IEntity) persistentType.getMapping();
- }
- }
- return rootEntity;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ENTITY__TABLE :
- return basicSetTable(null, msgs);
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_SECONDARY_TABLES :
- return ((InternalEList<?>) getSpecifiedSecondaryTables()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_ENTITY__PRIMARY_KEY_JOIN_COLUMNS :
- return ((InternalEList<?>) getPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return ((InternalEList<?>) getSpecifiedPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return ((InternalEList<?>) getDefaultPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_ENTITY__DISCRIMINATOR_COLUMN :
- return basicSetDiscriminatorColumn(null, msgs);
- case JpaJavaMappingsPackage.JAVA_ENTITY__SEQUENCE_GENERATOR :
- return basicSetSequenceGenerator(null, msgs);
- case JpaJavaMappingsPackage.JAVA_ENTITY__TABLE_GENERATOR :
- return basicSetTableGenerator(null, msgs);
- case JpaJavaMappingsPackage.JAVA_ENTITY__ATTRIBUTE_OVERRIDES :
- return ((InternalEList<?>) getAttributeOverrides()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return ((InternalEList<?>) getSpecifiedAttributeOverrides()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_ATTRIBUTE_OVERRIDES :
- return ((InternalEList<?>) getDefaultAttributeOverrides()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_ENTITY__ASSOCIATION_OVERRIDES :
- return ((InternalEList<?>) getAssociationOverrides()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_ASSOCIATION_OVERRIDES :
- return ((InternalEList<?>) getSpecifiedAssociationOverrides()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_ASSOCIATION_OVERRIDES :
- return ((InternalEList<?>) getDefaultAssociationOverrides()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_ENTITY__NAMED_QUERIES :
- return ((InternalEList<?>) getNamedQueries()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_ENTITY__NAMED_NATIVE_QUERIES :
- return ((InternalEList<?>) getNamedNativeQueries()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- protected void setDefaultName(String newDefaultName) {
- String oldDefaultName = defaultName;
- defaultName = newDefaultName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_NAME, oldDefaultName, defaultName));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_NAME :
- return getSpecifiedName();
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_NAME :
- return getDefaultName();
- case JpaJavaMappingsPackage.JAVA_ENTITY__TABLE :
- return getTable();
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_SECONDARY_TABLES :
- return getSpecifiedSecondaryTables();
- case JpaJavaMappingsPackage.JAVA_ENTITY__PRIMARY_KEY_JOIN_COLUMNS :
- return getPrimaryKeyJoinColumns();
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return getSpecifiedPrimaryKeyJoinColumns();
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return getDefaultPrimaryKeyJoinColumns();
- case JpaJavaMappingsPackage.JAVA_ENTITY__INHERITANCE_STRATEGY :
- return getInheritanceStrategy();
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_DISCRIMINATOR_VALUE :
- return getDefaultDiscriminatorValue();
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_DISCRIMINATOR_VALUE :
- return getSpecifiedDiscriminatorValue();
- case JpaJavaMappingsPackage.JAVA_ENTITY__DISCRIMINATOR_VALUE :
- return getDiscriminatorValue();
- case JpaJavaMappingsPackage.JAVA_ENTITY__DISCRIMINATOR_COLUMN :
- return getDiscriminatorColumn();
- case JpaJavaMappingsPackage.JAVA_ENTITY__SEQUENCE_GENERATOR :
- return getSequenceGenerator();
- case JpaJavaMappingsPackage.JAVA_ENTITY__TABLE_GENERATOR :
- return getTableGenerator();
- case JpaJavaMappingsPackage.JAVA_ENTITY__ATTRIBUTE_OVERRIDES :
- return getAttributeOverrides();
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return getSpecifiedAttributeOverrides();
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_ATTRIBUTE_OVERRIDES :
- return getDefaultAttributeOverrides();
- case JpaJavaMappingsPackage.JAVA_ENTITY__ASSOCIATION_OVERRIDES :
- return getAssociationOverrides();
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_ASSOCIATION_OVERRIDES :
- return getSpecifiedAssociationOverrides();
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_ASSOCIATION_OVERRIDES :
- return getDefaultAssociationOverrides();
- case JpaJavaMappingsPackage.JAVA_ENTITY__NAMED_QUERIES :
- return getNamedQueries();
- case JpaJavaMappingsPackage.JAVA_ENTITY__NAMED_NATIVE_QUERIES :
- return getNamedNativeQueries();
- case JpaJavaMappingsPackage.JAVA_ENTITY__ID_CLASS :
- return getIdClass();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_NAME :
- setSpecifiedName((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_SECONDARY_TABLES :
- getSpecifiedSecondaryTables().clear();
- getSpecifiedSecondaryTables().addAll((Collection<? extends ISecondaryTable>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- getSpecifiedPrimaryKeyJoinColumns().clear();
- getSpecifiedPrimaryKeyJoinColumns().addAll((Collection<? extends IPrimaryKeyJoinColumn>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- getDefaultPrimaryKeyJoinColumns().clear();
- getDefaultPrimaryKeyJoinColumns().addAll((Collection<? extends IPrimaryKeyJoinColumn>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__INHERITANCE_STRATEGY :
- setInheritanceStrategy((InheritanceType) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_DISCRIMINATOR_VALUE :
- setDefaultDiscriminatorValue((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_DISCRIMINATOR_VALUE :
- setSpecifiedDiscriminatorValue((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SEQUENCE_GENERATOR :
- setSequenceGenerator((ISequenceGenerator) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__TABLE_GENERATOR :
- setTableGenerator((ITableGenerator) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES :
- getSpecifiedAttributeOverrides().clear();
- getSpecifiedAttributeOverrides().addAll((Collection<? extends IAttributeOverride>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_ATTRIBUTE_OVERRIDES :
- getDefaultAttributeOverrides().clear();
- getDefaultAttributeOverrides().addAll((Collection<? extends IAttributeOverride>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_ASSOCIATION_OVERRIDES :
- getSpecifiedAssociationOverrides().clear();
- getSpecifiedAssociationOverrides().addAll((Collection<? extends IAssociationOverride>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_ASSOCIATION_OVERRIDES :
- getDefaultAssociationOverrides().clear();
- getDefaultAssociationOverrides().addAll((Collection<? extends IAssociationOverride>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__NAMED_QUERIES :
- getNamedQueries().clear();
- getNamedQueries().addAll((Collection<? extends INamedQuery>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__NAMED_NATIVE_QUERIES :
- getNamedNativeQueries().clear();
- getNamedNativeQueries().addAll((Collection<? extends INamedNativeQuery>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__ID_CLASS :
- setIdClass((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_NAME :
- setSpecifiedName(SPECIFIED_NAME_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_SECONDARY_TABLES :
- getSpecifiedSecondaryTables().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- getSpecifiedPrimaryKeyJoinColumns().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- getDefaultPrimaryKeyJoinColumns().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__INHERITANCE_STRATEGY :
- setInheritanceStrategy(INHERITANCE_STRATEGY_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_DISCRIMINATOR_VALUE :
- setDefaultDiscriminatorValue(DEFAULT_DISCRIMINATOR_VALUE_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_DISCRIMINATOR_VALUE :
- setSpecifiedDiscriminatorValue(SPECIFIED_DISCRIMINATOR_VALUE_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SEQUENCE_GENERATOR :
- setSequenceGenerator((ISequenceGenerator) null);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__TABLE_GENERATOR :
- setTableGenerator((ITableGenerator) null);
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES :
- getSpecifiedAttributeOverrides().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_ATTRIBUTE_OVERRIDES :
- getDefaultAttributeOverrides().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_ASSOCIATION_OVERRIDES :
- getSpecifiedAssociationOverrides().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_ASSOCIATION_OVERRIDES :
- getDefaultAssociationOverrides().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__NAMED_QUERIES :
- getNamedQueries().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__NAMED_NATIVE_QUERIES :
- getNamedNativeQueries().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_ENTITY__ID_CLASS :
- setIdClass(ID_CLASS_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_NAME :
- return SPECIFIED_NAME_EDEFAULT == null ? specifiedName != null : !SPECIFIED_NAME_EDEFAULT.equals(specifiedName);
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_NAME :
- return DEFAULT_NAME_EDEFAULT == null ? defaultName != null : !DEFAULT_NAME_EDEFAULT.equals(defaultName);
- case JpaJavaMappingsPackage.JAVA_ENTITY__TABLE :
- return table != null;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_SECONDARY_TABLES :
- return specifiedSecondaryTables != null && !specifiedSecondaryTables.isEmpty();
- case JpaJavaMappingsPackage.JAVA_ENTITY__PRIMARY_KEY_JOIN_COLUMNS :
- return !getPrimaryKeyJoinColumns().isEmpty();
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return specifiedPrimaryKeyJoinColumns != null && !specifiedPrimaryKeyJoinColumns.isEmpty();
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return defaultPrimaryKeyJoinColumns != null && !defaultPrimaryKeyJoinColumns.isEmpty();
- case JpaJavaMappingsPackage.JAVA_ENTITY__INHERITANCE_STRATEGY :
- return inheritanceStrategy != INHERITANCE_STRATEGY_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_DISCRIMINATOR_VALUE :
- return DEFAULT_DISCRIMINATOR_VALUE_EDEFAULT == null ? defaultDiscriminatorValue != null : !DEFAULT_DISCRIMINATOR_VALUE_EDEFAULT.equals(defaultDiscriminatorValue);
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_DISCRIMINATOR_VALUE :
- return SPECIFIED_DISCRIMINATOR_VALUE_EDEFAULT == null ? specifiedDiscriminatorValue != null : !SPECIFIED_DISCRIMINATOR_VALUE_EDEFAULT.equals(specifiedDiscriminatorValue);
- case JpaJavaMappingsPackage.JAVA_ENTITY__DISCRIMINATOR_VALUE :
- return DISCRIMINATOR_VALUE_EDEFAULT == null ? getDiscriminatorValue() != null : !DISCRIMINATOR_VALUE_EDEFAULT.equals(getDiscriminatorValue());
- case JpaJavaMappingsPackage.JAVA_ENTITY__DISCRIMINATOR_COLUMN :
- return discriminatorColumn != null;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SEQUENCE_GENERATOR :
- return sequenceGenerator != null;
- case JpaJavaMappingsPackage.JAVA_ENTITY__TABLE_GENERATOR :
- return tableGenerator != null;
- case JpaJavaMappingsPackage.JAVA_ENTITY__ATTRIBUTE_OVERRIDES :
- return !getAttributeOverrides().isEmpty();
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return specifiedAttributeOverrides != null && !specifiedAttributeOverrides.isEmpty();
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_ATTRIBUTE_OVERRIDES :
- return defaultAttributeOverrides != null && !defaultAttributeOverrides.isEmpty();
- case JpaJavaMappingsPackage.JAVA_ENTITY__ASSOCIATION_OVERRIDES :
- return !getAssociationOverrides().isEmpty();
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_ASSOCIATION_OVERRIDES :
- return specifiedAssociationOverrides != null && !specifiedAssociationOverrides.isEmpty();
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_ASSOCIATION_OVERRIDES :
- return defaultAssociationOverrides != null && !defaultAssociationOverrides.isEmpty();
- case JpaJavaMappingsPackage.JAVA_ENTITY__NAMED_QUERIES :
- return namedQueries != null && !namedQueries.isEmpty();
- case JpaJavaMappingsPackage.JAVA_ENTITY__NAMED_NATIVE_QUERIES :
- return namedNativeQueries != null && !namedNativeQueries.isEmpty();
- case JpaJavaMappingsPackage.JAVA_ENTITY__ID_CLASS :
- return ID_CLASS_EDEFAULT == null ? idClass != null : !ID_CLASS_EDEFAULT.equals(idClass);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IEntity.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_NAME :
- return JpaCoreMappingsPackage.IENTITY__SPECIFIED_NAME;
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_NAME :
- return JpaCoreMappingsPackage.IENTITY__DEFAULT_NAME;
- case JpaJavaMappingsPackage.JAVA_ENTITY__TABLE :
- return JpaCoreMappingsPackage.IENTITY__TABLE;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_SECONDARY_TABLES :
- return JpaCoreMappingsPackage.IENTITY__SPECIFIED_SECONDARY_TABLES;
- case JpaJavaMappingsPackage.JAVA_ENTITY__PRIMARY_KEY_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IENTITY__PRIMARY_KEY_JOIN_COLUMNS;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS;
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS;
- case JpaJavaMappingsPackage.JAVA_ENTITY__INHERITANCE_STRATEGY :
- return JpaCoreMappingsPackage.IENTITY__INHERITANCE_STRATEGY;
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_DISCRIMINATOR_VALUE :
- return JpaCoreMappingsPackage.IENTITY__DEFAULT_DISCRIMINATOR_VALUE;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_DISCRIMINATOR_VALUE :
- return JpaCoreMappingsPackage.IENTITY__SPECIFIED_DISCRIMINATOR_VALUE;
- case JpaJavaMappingsPackage.JAVA_ENTITY__DISCRIMINATOR_VALUE :
- return JpaCoreMappingsPackage.IENTITY__DISCRIMINATOR_VALUE;
- case JpaJavaMappingsPackage.JAVA_ENTITY__DISCRIMINATOR_COLUMN :
- return JpaCoreMappingsPackage.IENTITY__DISCRIMINATOR_COLUMN;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SEQUENCE_GENERATOR :
- return JpaCoreMappingsPackage.IENTITY__SEQUENCE_GENERATOR;
- case JpaJavaMappingsPackage.JAVA_ENTITY__TABLE_GENERATOR :
- return JpaCoreMappingsPackage.IENTITY__TABLE_GENERATOR;
- case JpaJavaMappingsPackage.JAVA_ENTITY__ATTRIBUTE_OVERRIDES :
- return JpaCoreMappingsPackage.IENTITY__ATTRIBUTE_OVERRIDES;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return JpaCoreMappingsPackage.IENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES;
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_ATTRIBUTE_OVERRIDES :
- return JpaCoreMappingsPackage.IENTITY__DEFAULT_ATTRIBUTE_OVERRIDES;
- case JpaJavaMappingsPackage.JAVA_ENTITY__ASSOCIATION_OVERRIDES :
- return JpaCoreMappingsPackage.IENTITY__ASSOCIATION_OVERRIDES;
- case JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_ASSOCIATION_OVERRIDES :
- return JpaCoreMappingsPackage.IENTITY__SPECIFIED_ASSOCIATION_OVERRIDES;
- case JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_ASSOCIATION_OVERRIDES :
- return JpaCoreMappingsPackage.IENTITY__DEFAULT_ASSOCIATION_OVERRIDES;
- case JpaJavaMappingsPackage.JAVA_ENTITY__NAMED_QUERIES :
- return JpaCoreMappingsPackage.IENTITY__NAMED_QUERIES;
- case JpaJavaMappingsPackage.JAVA_ENTITY__NAMED_NATIVE_QUERIES :
- return JpaCoreMappingsPackage.IENTITY__NAMED_NATIVE_QUERIES;
- case JpaJavaMappingsPackage.JAVA_ENTITY__ID_CLASS :
- return JpaCoreMappingsPackage.IENTITY__ID_CLASS;
- default :
- return -1;
- }
- }
- if (baseClass == IJavaEntity.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IEntity.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_NAME :
- return JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_NAME;
- case JpaCoreMappingsPackage.IENTITY__DEFAULT_NAME :
- return JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_NAME;
- case JpaCoreMappingsPackage.IENTITY__TABLE :
- return JpaJavaMappingsPackage.JAVA_ENTITY__TABLE;
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_SECONDARY_TABLES :
- return JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_SECONDARY_TABLES;
- case JpaCoreMappingsPackage.IENTITY__PRIMARY_KEY_JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_ENTITY__PRIMARY_KEY_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IENTITY__INHERITANCE_STRATEGY :
- return JpaJavaMappingsPackage.JAVA_ENTITY__INHERITANCE_STRATEGY;
- case JpaCoreMappingsPackage.IENTITY__DEFAULT_DISCRIMINATOR_VALUE :
- return JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_DISCRIMINATOR_VALUE;
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_DISCRIMINATOR_VALUE :
- return JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_DISCRIMINATOR_VALUE;
- case JpaCoreMappingsPackage.IENTITY__DISCRIMINATOR_VALUE :
- return JpaJavaMappingsPackage.JAVA_ENTITY__DISCRIMINATOR_VALUE;
- case JpaCoreMappingsPackage.IENTITY__DISCRIMINATOR_COLUMN :
- return JpaJavaMappingsPackage.JAVA_ENTITY__DISCRIMINATOR_COLUMN;
- case JpaCoreMappingsPackage.IENTITY__SEQUENCE_GENERATOR :
- return JpaJavaMappingsPackage.JAVA_ENTITY__SEQUENCE_GENERATOR;
- case JpaCoreMappingsPackage.IENTITY__TABLE_GENERATOR :
- return JpaJavaMappingsPackage.JAVA_ENTITY__TABLE_GENERATOR;
- case JpaCoreMappingsPackage.IENTITY__ATTRIBUTE_OVERRIDES :
- return JpaJavaMappingsPackage.JAVA_ENTITY__ATTRIBUTE_OVERRIDES;
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES;
- case JpaCoreMappingsPackage.IENTITY__DEFAULT_ATTRIBUTE_OVERRIDES :
- return JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_ATTRIBUTE_OVERRIDES;
- case JpaCoreMappingsPackage.IENTITY__ASSOCIATION_OVERRIDES :
- return JpaJavaMappingsPackage.JAVA_ENTITY__ASSOCIATION_OVERRIDES;
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_ASSOCIATION_OVERRIDES :
- return JpaJavaMappingsPackage.JAVA_ENTITY__SPECIFIED_ASSOCIATION_OVERRIDES;
- case JpaCoreMappingsPackage.IENTITY__DEFAULT_ASSOCIATION_OVERRIDES :
- return JpaJavaMappingsPackage.JAVA_ENTITY__DEFAULT_ASSOCIATION_OVERRIDES;
- case JpaCoreMappingsPackage.IENTITY__NAMED_QUERIES :
- return JpaJavaMappingsPackage.JAVA_ENTITY__NAMED_QUERIES;
- case JpaCoreMappingsPackage.IENTITY__NAMED_NATIVE_QUERIES :
- return JpaJavaMappingsPackage.JAVA_ENTITY__NAMED_NATIVE_QUERIES;
- case JpaCoreMappingsPackage.IENTITY__ID_CLASS :
- return JpaJavaMappingsPackage.JAVA_ENTITY__ID_CLASS;
- default :
- return -1;
- }
- }
- if (baseClass == IJavaEntity.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedName: ");
- result.append(specifiedName);
- result.append(", defaultName: ");
- result.append(defaultName);
- result.append(", inheritanceStrategy: ");
- result.append(inheritanceStrategy);
- result.append(", defaultDiscriminatorValue: ");
- result.append(defaultDiscriminatorValue);
- result.append(", specifiedDiscriminatorValue: ");
- result.append(specifiedDiscriminatorValue);
- result.append(", idClass: ");
- result.append(idClass);
- result.append(')');
- return result.toString();
- }
-
- public String getKey() {
- return IMappingKeys.ENTITY_TYPE_MAPPING_KEY;
- }
-
- @Override
- public String getTableName() {
- return getTable().getName();
- }
-
- @Override
- public Table primaryDbTable() {
- return getTable().dbTable();
- }
-
- @Override
- public Table dbTable(String tableName) {
- for (Iterator<ITable> stream = this.associatedTablesIncludingInherited(); stream.hasNext();) {
- Table dbTable = stream.next().dbTable();
- if (dbTable != null && dbTable.matchesShortJavaClassName(tableName)) {
- return dbTable;
- }
- }
- return null;
- }
-
- @Override
- public Schema dbSchema() {
- return getTable().dbSchema();
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- this.setSpecifiedName(this.getType().annotationElementValue(NAME_ADAPTER, astRoot));
- this.setDefaultName(this.getType().getName());
- this.getJavaTable().updateFromJava(astRoot);
- this.updateSecondaryTablesFromJava(astRoot);
- this.updateNamedQueriesFromJava(astRoot);
- this.updateNamedNativeQueriesFromJava(astRoot);
- this.updateSpecifiedPrimaryKeyJoinColumnsFromJava(astRoot);
- this.updateAttributeOverridesFromJava(astRoot);
- this.updateAssociationOverridesFromJava(astRoot);
- this.setInheritanceStrategy(InheritanceType.fromJavaAnnotationValue(this.inheritanceStrategyAdapter.getValue(astRoot)));
- this.getJavaDiscriminatorColumn().updateFromJava(astRoot);
- this.setSpecifiedDiscriminatorValue(this.discriminatorValueAdapter.getValue(astRoot));
- this.setDefaultDiscriminatorValue(this.javaDefaultDiscriminatorValue());
- this.updateTableGeneratorFromJava(astRoot);
- this.updateSequenceGeneratorFromJava(astRoot);
- this.updateIdClassFromJava(astRoot);
- }
-
- private void updateIdClassFromJava(CompilationUnit astRoot) {
- if (this.idClassAnnotationAdapter.getAnnotation(astRoot) == null) {
- this.setIdClass(null);
- }
- else {
- this.setIdClass(this.idClassValueAdapter.getValue(astRoot));
- }
- }
-
- private JavaTable getJavaTable() {
- return (JavaTable) this.table;
- }
-
- private JavaDiscriminatorColumn getJavaDiscriminatorColumn() {
- return (JavaDiscriminatorColumn) this.discriminatorColumn;
- }
-
- private void updateTableGeneratorFromJava(CompilationUnit astRoot) {
- if (this.tableGeneratorAnnotationAdapter.getAnnotation(astRoot) == null) {
- if (this.tableGenerator != null) {
- setTableGenerator(null);
- }
- }
- else {
- if (this.tableGenerator == null) {
- setTableGenerator(createTableGenerator());
- }
- this.getJavaTableGenerator().updateFromJava(astRoot);
- }
- }
-
- private JavaTableGenerator getJavaTableGenerator() {
- return (JavaTableGenerator) this.tableGenerator;
- }
-
- private void updateSequenceGeneratorFromJava(CompilationUnit astRoot) {
- if (this.sequenceGeneratorAnnotationAdapter.getAnnotation(astRoot) == null) {
- if (this.sequenceGenerator != null) {
- setSequenceGenerator(null);
- }
- }
- else {
- if (this.sequenceGenerator == null) {
- setSequenceGenerator(createSequenceGenerator());
- }
- this.getJavaSequenceGenerator().updateFromJava(astRoot);
- }
- }
-
- private JavaSequenceGenerator getJavaSequenceGenerator() {
- return (JavaSequenceGenerator) this.sequenceGenerator;
- }
-
- /**
- * From the Spec:
- * If the DiscriminatorValue annotation is not specified, a
- * provider-specific function to generate a value representing
- * the entity type is used for the value of the discriminator
- * column. If the DiscriminatorType is STRING, the discriminator
- * value default is the entity name.
- *
- * TODO extension point for provider-specific function?
- */
- private String javaDefaultDiscriminatorValue() {
- if (this.getType().isAbstract()) {
- return null;
- }
- if (!this.discriminatorType().isString()) {
- return null;
- }
- return this.getName();
- }
-
- private DiscriminatorType discriminatorType() {
- return this.getDiscriminatorColumn().getDiscriminatorType();
- }
-
- /**
- * here we just worry about getting the attribute override lists the same size;
- * then we delegate to the attribute overrides to synch themselves up
- */
- private void updateAttributeOverridesFromJava(CompilationUnit astRoot) {
- // synchronize the model attribute overrides with the Java source
- List<IAttributeOverride> attributeOverrides = getSpecifiedAttributeOverrides();
- int persSize = attributeOverrides.size();
- int javaSize = 0;
- boolean allJavaAnnotationsFound = false;
- for (int i = 0; i < persSize; i++) {
- JavaAttributeOverride attributeOverride = (JavaAttributeOverride) attributeOverrides.get(i);
- if (attributeOverride.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- break; // no need to go any further
- }
- attributeOverride.updateFromJava(astRoot);
- javaSize++;
- }
- if (allJavaAnnotationsFound) {
- // remove any model attribute overrides beyond those that correspond to the Java annotations
- while (persSize > javaSize) {
- persSize--;
- attributeOverrides.remove(persSize);
- }
- }
- else {
- // add new model attribute overrides until they match the Java annotations
- while (!allJavaAnnotationsFound) {
- JavaAttributeOverride attributeOverride = this.createJavaAttributeOverride(javaSize);
- if (attributeOverride.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- }
- else {
- getSpecifiedAttributeOverrides().add(attributeOverride);
- attributeOverride.updateFromJava(astRoot);
- javaSize++;
- }
- }
- }
- }
-
- /**
- * here we just worry about getting the attribute override lists the same size;
- * then we delegate to the attribute overrides to synch themselves up
- */
- private void updateAssociationOverridesFromJava(CompilationUnit astRoot) {
- // synchronize the model attribute overrides with the Java source
- List<IAssociationOverride> associationOverrides = getSpecifiedAssociationOverrides();
- int persSize = associationOverrides.size();
- int javaSize = 0;
- boolean allJavaAnnotationsFound = false;
- for (int i = 0; i < persSize; i++) {
- JavaAssociationOverride associationOverride = (JavaAssociationOverride) associationOverrides.get(i);
- if (associationOverride.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- break; // no need to go any further
- }
- associationOverride.updateFromJava(astRoot);
- javaSize++;
- }
- if (allJavaAnnotationsFound) {
- // remove any model attribute overrides beyond those that correspond to the Java annotations
- while (persSize > javaSize) {
- persSize--;
- associationOverrides.remove(persSize);
- }
- }
- else {
- // add new model attribute overrides until they match the Java annotations
- while (!allJavaAnnotationsFound) {
- JavaAssociationOverride associationOverride = this.createJavaAssociationOverride(javaSize);
- if (associationOverride.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- }
- else {
- getSpecifiedAssociationOverrides().add(associationOverride);
- associationOverride.updateFromJava(astRoot);
- javaSize++;
- }
- }
- }
- }
-
- /**
- * here we just worry about getting the secondary table lists the same size;
- * then we delegate to the secondary tables to synch themselves up
- */
- private void updateSecondaryTablesFromJava(CompilationUnit astRoot) {
- // synchronize the model secondary tables with the Java source
- List<ISecondaryTable> sTables = this.getSecondaryTables();
- int persSize = sTables.size();
- int javaSize = 0;
- boolean allJavaAnnotationsFound = false;
- for (int i = 0; i < persSize; i++) {
- JavaSecondaryTable secondaryTable = (JavaSecondaryTable) sTables.get(i);
- if (secondaryTable.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- break; // no need to go any further
- }
- secondaryTable.updateFromJava(astRoot);
- javaSize++;
- }
- if (allJavaAnnotationsFound) {
- // remove any model secondary tables beyond those that correspond to the Java annotations
- while (persSize > javaSize) {
- persSize--;
- sTables.remove(persSize);
- }
- }
- else {
- // add new model join columns until they match the Java annotations
- while (!allJavaAnnotationsFound) {
- JavaSecondaryTable secondaryTable = this.createJavaSecondaryTable(javaSize);
- if (secondaryTable.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- }
- else {
- getSecondaryTables().add(secondaryTable);
- secondaryTable.updateFromJava(astRoot);
- javaSize++;
- }
- }
- }
- }
-
- /**
- * here we just worry about getting the named query lists the same size;
- * then we delegate to the named queries to synch themselves up
- */
- private void updateNamedQueriesFromJava(CompilationUnit astRoot) {
- // synchronize the model named queries with the Java source
- List<INamedQuery> queries = this.getNamedQueries();
- int persSize = queries.size();
- int javaSize = 0;
- boolean allJavaAnnotationsFound = false;
- for (int i = 0; i < persSize; i++) {
- JavaNamedQuery namedQuery = (JavaNamedQuery) queries.get(i);
- if (namedQuery.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- break; // no need to go any further
- }
- namedQuery.updateFromJava(astRoot);
- javaSize++;
- }
- if (allJavaAnnotationsFound) {
- // remove any model named queries beyond those that correspond to the Java annotations
- while (persSize > javaSize) {
- persSize--;
- queries.remove(persSize);
- }
- }
- else {
- // add new model join columns until they match the Java annotations
- while (!allJavaAnnotationsFound) {
- JavaNamedQuery javaNamedQuery = this.createJavaNamedQuery(javaSize);
- if (javaNamedQuery.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- }
- else {
- getNamedQueries().add(javaNamedQuery);
- javaNamedQuery.updateFromJava(astRoot);
- javaSize++;
- }
- }
- }
- }
-
- /**
- * here we just worry about getting the named native query lists the same size;
- * then we delegate to the named native queries to synch themselves up
- */
- private void updateNamedNativeQueriesFromJava(CompilationUnit astRoot) {
- // synchronize the model named queries with the Java source
- List<INamedNativeQuery> queries = this.getNamedNativeQueries();
- int persSize = queries.size();
- int javaSize = 0;
- boolean allJavaAnnotationsFound = false;
- for (int i = 0; i < persSize; i++) {
- JavaNamedNativeQuery namedQuery = (JavaNamedNativeQuery) queries.get(i);
- if (namedQuery.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- break; // no need to go any further
- }
- namedQuery.updateFromJava(astRoot);
- javaSize++;
- }
- if (allJavaAnnotationsFound) {
- // remove any model named queries beyond those that correspond to the Java annotations
- while (persSize > javaSize) {
- persSize--;
- queries.remove(persSize);
- }
- }
- else {
- // add new model join columns until they match the Java annotations
- while (!allJavaAnnotationsFound) {
- JavaNamedNativeQuery javaNamedQuery = this.createJavaNamedNativeQuery(javaSize);
- if (javaNamedQuery.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- }
- else {
- getNamedNativeQueries().add(javaNamedQuery);
- javaNamedQuery.updateFromJava(astRoot);
- javaSize++;
- }
- }
- }
- }
-
- /**
- * here we just worry about getting the primary key join column lists
- * the same size; then we delegate to the join columns to synch
- * themselves up
- */
- private void updateSpecifiedPrimaryKeyJoinColumnsFromJava(CompilationUnit astRoot) {
- // synchronize the model primary key join columns with the Java source
- List<IPrimaryKeyJoinColumn> pkJoinColumns = getSpecifiedPrimaryKeyJoinColumns();
- int persSize = pkJoinColumns.size();
- int javaSize = 0;
- boolean allJavaAnnotationsFound = false;
- for (int i = 0; i < persSize; i++) {
- JavaPrimaryKeyJoinColumn pkJoinColumn = (JavaPrimaryKeyJoinColumn) pkJoinColumns.get(i);
- if (pkJoinColumn.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- break; // no need to go any further
- }
- pkJoinColumn.updateFromJava(astRoot);
- javaSize++;
- }
- if (allJavaAnnotationsFound) {
- // remove any model primary key join columns beyond those that correspond to the Java annotations
- while (persSize > javaSize) {
- persSize--;
- pkJoinColumns.remove(persSize);
- }
- }
- else {
- // add new model join columns until they match the Java annotations
- while (!allJavaAnnotationsFound) {
- JavaPrimaryKeyJoinColumn jpkjc = this.createJavaPrimaryKeyJoinColumn(javaSize);
- if (jpkjc.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- }
- else {
- getSpecifiedPrimaryKeyJoinColumns().add(jpkjc);
- jpkjc.updateFromJava(astRoot);
- javaSize++;
- }
- }
- }
- }
-
- public String primaryKeyColumnName() {
- String pkColumnName = null;
- for (Iterator<IPersistentAttribute> stream = getPersistentType().allAttributes(); stream.hasNext();) {
- IPersistentAttribute attribute = stream.next();
- String name = attribute.primaryKeyColumnName();
- if (pkColumnName == null) {
- pkColumnName = name;
- }
- else if (name != null) {
- // if we encounter a composite primary key, return null
- return null;
- }
- }
- // if we encounter only a single primary key column name, return it
- return pkColumnName;
- }
-
- public String primaryKeyAttributeName() {
- String pkColumnName = null;
- String pkAttributeName = null;
- for (Iterator<IPersistentAttribute> stream = getPersistentType().allAttributes(); stream.hasNext();) {
- IPersistentAttribute attribute = stream.next();
- String name = attribute.primaryKeyColumnName();
- if (pkColumnName == null) {
- pkColumnName = name;
- pkAttributeName = attribute.getName();
- }
- else if (name != null) {
- // if we encounter a composite primary key, return null
- return null;
- }
- }
- // if we encounter only a single primary key column name, return it
- return pkAttributeName;
- }
-
- @Override
- public boolean tableNameIsInvalid(String tableName) {
- return !CollectionTools.contains(this.associatedTableNamesIncludingInherited(), tableName);
- }
-
- @Override
- public Iterator<ITable> associatedTables() {
- return new CompositeIterator<ITable>(this.getTable(), this.getSecondaryTables().iterator());
- }
-
- @Override
- public Iterator<ITable> associatedTablesIncludingInherited() {
- return new CompositeIterator<ITable>(new TransformationIterator<ITypeMapping, Iterator<ITable>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<ITable> transform(ITypeMapping mapping) {
- return new FilteringIterator<ITable>(mapping.associatedTables()) {
- @Override
- protected boolean accept(Object o) {
- return true;
- //TODO
- //filtering these out so as to avoid the duplicate table, root and children share the same table
- //return !(o instanceof SingleTableInheritanceChildTableImpl);
- }
- };
- }
- });
- }
-
- @Override
- public Iterator<String> associatedTableNamesIncludingInherited() {
- return this.nonNullTableNames(this.associatedTablesIncludingInherited());
- }
-
- private Iterator<String> nonNullTableNames(Iterator<ITable> tables) {
- return new FilteringIterator<String>(this.tableNames(tables)) {
- @Override
- protected boolean accept(Object o) {
- return o != null;
- }
- };
- }
-
- private Iterator<String> tableNames(Iterator<ITable> tables) {
- return new TransformationIterator<ITable, String>(tables) {
- @Override
- protected String transform(ITable t) {
- return t.getName();
- }
- };
- }
-
- /**
- * Return an iterator of Entities, each which inherits from the one before,
- * and terminates at the root entity (or at the point of cyclicity).
- */
- private Iterator<ITypeMapping> inheritanceHierarchy() {
- return new TransformationIterator<IPersistentType, ITypeMapping>(getPersistentType().inheritanceHierarchy()) {
- @Override
- protected ITypeMapping transform(IPersistentType type) {
- return type.getMapping();
- }
- };
- //TODO once we support inheritance, which of these should we use??
- //return this.getInheritance().typeMappingLineage();
- }
-
- public Iterator<String> allOverridableAttributeNames() {
- return new CompositeIterator<String>(new TransformationIterator<ITypeMapping, Iterator<String>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<String> transform(ITypeMapping mapping) {
- return mapping.overridableAttributeNames();
- }
- });
- }
-
- public Iterator<String> allOverridableAssociationNames() {
- return new CompositeIterator<String>(new TransformationIterator<ITypeMapping, Iterator<String>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<String> transform(ITypeMapping mapping) {
- return mapping.overridableAssociationNames();
- }
- });
- }
-
- public IAttributeOverride createAttributeOverride(int index) {
- return createJavaAttributeOverride(index);
- }
-
- private JavaAttributeOverride createJavaAttributeOverride(int index) {
- return JavaAttributeOverride.createAttributeOverride(new AttributeOverrideOwner(this), this.getType(), index);
- }
-
- public IAssociationOverride createAssociationOverride(int index) {
- return createJavaAssociationOverride(index);
- }
-
- private JavaAssociationOverride createJavaAssociationOverride(int index) {
- return JavaAssociationOverride.createAssociationOverride(new AssociationOverrideOwner(this), this.getType(), index);
- }
-
- public JavaSecondaryTable createSecondaryTable(int index) {
- return createJavaSecondaryTable(index);
- }
-
- private JavaSecondaryTable createJavaSecondaryTable(int index) {
- return JavaSecondaryTable.createJavaSecondaryTable(buildSecondaryTableOwner(), this.getType(), index);
- }
-
- private ITable.Owner buildSecondaryTableOwner() {
- return new ITable.Owner() {
- public ITextRange validationTextRange() {
- return JavaEntity.this.validationTextRange();
- }
-
- public ITypeMapping getTypeMapping() {
- return JavaEntity.this;
- }
- };
- }
-
- public boolean containsSpecifiedPrimaryKeyJoinColumns() {
- return !this.getSpecifiedPrimaryKeyJoinColumns().isEmpty();
- }
-
- public IPrimaryKeyJoinColumn createPrimaryKeyJoinColumn(int index) {
- return this.createJavaPrimaryKeyJoinColumn(index);
- }
-
- private JavaPrimaryKeyJoinColumn createJavaPrimaryKeyJoinColumn(int index) {
- return JavaPrimaryKeyJoinColumn.createEntityPrimaryKeyJoinColumn(buildPkJoinColumnOwner(), this.getType(), index);
- }
-
- protected IAbstractJoinColumn.Owner buildPkJoinColumnOwner() {
- return new IEntity.PrimaryKeyJoinColumnOwner(this);
- }
-
- public JavaNamedQuery createNamedQuery(int index) {
- return createJavaNamedQuery(index);
- }
-
- private JavaNamedQuery createJavaNamedQuery(int index) {
- return JavaNamedQuery.createJavaNamedQuery(this.getType(), index);
- }
-
- public JavaNamedNativeQuery createNamedNativeQuery(int index) {
- return createJavaNamedNativeQuery(index);
- }
-
- private JavaNamedNativeQuery createJavaNamedNativeQuery(int index) {
- return JavaNamedNativeQuery.createJavaNamedNativeQuery(this.getType(), index);
- }
-
- public ISequenceGenerator createSequenceGenerator() {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaSequenceGenerator(getType());
- }
-
- public ITableGenerator createTableGenerator() {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaTableGenerator(getType());
- }
-
- // ********** misc **********
- private static void attributeChanged(Object value, AnnotationAdapter annotationAdapter) {
- Annotation annotation = annotationAdapter.getAnnotation();
- if (value == null) {
- if (annotation != null) {
- annotationAdapter.removeAnnotation();
- }
- }
- else {
- if (annotation == null) {
- annotationAdapter.newMarkerAnnotation();
- }
- }
- }
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.getJavaTable().candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (ISecondaryTable sTable : this.getSecondaryTables()) {
- result = ((JavaSecondaryTable) sTable).candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- for (IPrimaryKeyJoinColumn column : this.getPrimaryKeyJoinColumns()) {
- result = ((JavaPrimaryKeyJoinColumn) column).candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- for (IAttributeOverride override : this.getAttributeOverrides()) {
- result = ((JavaAttributeOverride) override).candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- for (IAssociationOverride override : this.getAssociationOverrides()) {
- result = ((JavaAssociationOverride) override).candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- result = this.getJavaDiscriminatorColumn().candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- JavaTableGenerator jtg = this.getJavaTableGenerator();
- if (jtg != null) {
- result = jtg.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- JavaSequenceGenerator jsg = this.getJavaSequenceGenerator();
- if (jsg != null) {
- result = jsg.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- // ********** static methods **********
- protected static DeclarationAnnotationElementAdapter<String> buildStrategyAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(INHERITANCE_ANNOTATION_ADAPTER, JPA.INHERITANCE__STRATEGY);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildDiscriminatorValueAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DISCRIMINATOR_ANNOTATION_ADAPTER, JPA.DISCRIMINATOR_VALUE__VALUE);
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter<String> buildIdClassValueAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter<String>(ID_CLASS_ADAPTER, JPA.ID_CLASS__VALUE, false, SimpleTypeStringExpressionConverter.instance());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaGeneratedValue.java
deleted file mode 100644
index 17cd499080..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaGeneratedValue.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.content.java.JavaEObject;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.GenerationType;
-import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Generated Value</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaGeneratedValue()
- * @model kind="class"
- * @generated
- */
-public class JavaGeneratedValue extends JavaEObject implements IGeneratedValue
-{
- private Member member;
-
- private final AnnotationElementAdapter<String> strategyAdapter;
-
- private final AnnotationElementAdapter<String> generatorAdapter;
-
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.GENERATED_VALUE);
-
- private static final DeclarationAnnotationElementAdapter<String> STRATEGY_ADAPTER = buildStrategyAdapter();
-
- private static final DeclarationAnnotationElementAdapter<String> GENERATOR_ADAPTER = buildGeneratorAdapter();
-
- /**
- * The default value of the '{@link #getStrategy() <em>Strategy</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getStrategy()
- * @generated
- * @ordered
- */
- protected static final GenerationType STRATEGY_EDEFAULT = GenerationType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getStrategy() <em>Strategy</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getStrategy()
- * @generated
- * @ordered
- */
- protected GenerationType strategy = STRATEGY_EDEFAULT;
-
- /**
- * The default value of the '{@link #getGenerator() <em>Generator</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getGenerator()
- * @generated
- * @ordered
- */
- protected static final String GENERATOR_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getGenerator() <em>Generator</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getGenerator()
- * @generated
- * @ordered
- */
- protected String generator = GENERATOR_EDEFAULT;
-
- protected JavaGeneratedValue() {
- throw new UnsupportedOperationException("Use JavaGeneratedValue(Member) instead");
- }
-
- protected JavaGeneratedValue(Member member) {
- super();
- this.member = member;
- this.strategyAdapter = new ShortCircuitAnnotationElementAdapter<String>(this.member, STRATEGY_ADAPTER);
- this.generatorAdapter = new ShortCircuitAnnotationElementAdapter<String>(this.member, GENERATOR_ADAPTER);
- }
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IGeneratedValue.class)) {
- case JpaJavaMappingsPackage.JAVA_GENERATED_VALUE__GENERATOR :
- this.generatorAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaJavaMappingsPackage.JAVA_GENERATED_VALUE__STRATEGY :
- this.strategyAdapter.setValue(((GenerationType) notification.getNewValue()).convertToJavaAnnotationValue());
- break;
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_GENERATED_VALUE;
- }
-
- /**
- * Returns the value of the '<em><b>Strategy</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.GenerationType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Strategy</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Strategy</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.GenerationType
- * @see #setStrategy(GenerationType)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIGeneratedValue_Strategy()
- * @model
- * @generated
- */
- public GenerationType getStrategy() {
- return strategy;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaGeneratedValue#getStrategy <em>Strategy</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Strategy</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.GenerationType
- * @see #getStrategy()
- * @generated
- */
- public void setStrategy(GenerationType newStrategy) {
- GenerationType oldStrategy = strategy;
- strategy = newStrategy == null ? STRATEGY_EDEFAULT : newStrategy;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_GENERATED_VALUE__STRATEGY, oldStrategy, strategy));
- }
-
- /**
- * Returns the value of the '<em><b>Generator</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Generator</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Generator</em>' attribute.
- * @see #setGenerator(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIGeneratedValue_Generator()
- * @model
- * @generated
- */
- public String getGenerator() {
- return generator;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaGeneratedValue#getGenerator <em>Generator</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Generator</em>' attribute.
- * @see #getGenerator()
- * @generated
- */
- public void setGenerator(String newGenerator) {
- String oldGenerator = generator;
- generator = newGenerator;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_GENERATED_VALUE__GENERATOR, oldGenerator, generator));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_GENERATED_VALUE__STRATEGY :
- return getStrategy();
- case JpaJavaMappingsPackage.JAVA_GENERATED_VALUE__GENERATOR :
- return getGenerator();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_GENERATED_VALUE__STRATEGY :
- setStrategy((GenerationType) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_GENERATED_VALUE__GENERATOR :
- setGenerator((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_GENERATED_VALUE__STRATEGY :
- setStrategy(STRATEGY_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_GENERATED_VALUE__GENERATOR :
- setGenerator(GENERATOR_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_GENERATED_VALUE__STRATEGY :
- return strategy != STRATEGY_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_GENERATED_VALUE__GENERATOR :
- return GENERATOR_EDEFAULT == null ? generator != null : !GENERATOR_EDEFAULT.equals(generator);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IGeneratedValue.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_GENERATED_VALUE__STRATEGY :
- return JpaCoreMappingsPackage.IGENERATED_VALUE__STRATEGY;
- case JpaJavaMappingsPackage.JAVA_GENERATED_VALUE__GENERATOR :
- return JpaCoreMappingsPackage.IGENERATED_VALUE__GENERATOR;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IGeneratedValue.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IGENERATED_VALUE__STRATEGY :
- return JpaJavaMappingsPackage.JAVA_GENERATED_VALUE__STRATEGY;
- case JpaCoreMappingsPackage.IGENERATED_VALUE__GENERATOR :
- return JpaJavaMappingsPackage.JAVA_GENERATED_VALUE__GENERATOR;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (strategy: ");
- result.append(strategy);
- result.append(", generator: ");
- result.append(generator);
- result.append(')');
- return result.toString();
- }
-
- public ITextRange validationTextRange() {
- return this.member.annotationTextRange(DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public ITextRange generatorTextRange() {
- return elementTextRange(this.member.annotationElementTextRange(GENERATOR_ADAPTER));
- }
-
- // ********** java annotations -> persistence model **********
- public void updateFromJava(CompilationUnit astRoot) {
- setStrategy(GenerationType.fromJavaAnnotationValue(this.strategyAdapter.getValue(astRoot)));
- setGenerator(this.generatorAdapter.getValue(astRoot));
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter<String> buildStrategyAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.GENERATED_VALUE__STRATEGY, false);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildGeneratorAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.GENERATED_VALUE__GENERATOR, false);
- }
-} // JavaGeneratedValue
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaGenerator.java
deleted file mode 100644
index 25c53ac257..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaGenerator.java
+++ /dev/null
@@ -1,569 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.content.java.JavaEObject;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.NumberStringExpressionConverter;
-import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.mappings.IGenerator;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Generator</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaGenerator()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class JavaGenerator extends JavaEObject implements IGenerator
-{
- private final Member member;
-
- private final AnnotationElementAdapter<String> nameAdapter;
-
- private final IntAnnotationElementAdapter initialValueAdapter;
-
- private final IntAnnotationElementAdapter allocationSizeAdapter;
-
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected String name = NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getInitialValue() <em>Initial Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getInitialValue()
- * @generated
- * @ordered
- */
- protected static final int INITIAL_VALUE_EDEFAULT = 0;
-
- /**
- * The default value of the '{@link #getSpecifiedInitialValue() <em>Specified Initial Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedInitialValue()
- * @generated
- * @ordered
- */
- protected static final int SPECIFIED_INITIAL_VALUE_EDEFAULT = -1;
-
- /**
- * The cached value of the '{@link #getSpecifiedInitialValue() <em>Specified Initial Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedInitialValue()
- * @generated
- * @ordered
- */
- protected int specifiedInitialValue = SPECIFIED_INITIAL_VALUE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultInitialValue() <em>Default Initial Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultInitialValue()
- * @generated
- * @ordered
- */
- protected static final int DEFAULT_INITIAL_VALUE_EDEFAULT = 0;
-
- /**
- * The cached value of the '{@link #getDefaultInitialValue() <em>Default Initial Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultInitialValue()
- * @generated
- * @ordered
- */
- protected int defaultInitialValue = DEFAULT_INITIAL_VALUE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getAllocationSize() <em>Allocation Size</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getAllocationSize()
- * @generated
- * @ordered
- */
- protected static final int ALLOCATION_SIZE_EDEFAULT = 0;
-
- /**
- * The default value of the '{@link #getSpecifiedAllocationSize() <em>Specified Allocation Size</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedAllocationSize()
- * @generated
- * @ordered
- */
- protected static final int SPECIFIED_ALLOCATION_SIZE_EDEFAULT = -1;
-
- /**
- * The cached value of the '{@link #getSpecifiedAllocationSize() <em>Specified Allocation Size</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedAllocationSize()
- * @generated
- * @ordered
- */
- protected int specifiedAllocationSize = SPECIFIED_ALLOCATION_SIZE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultAllocationSize() <em>Default Allocation Size</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultAllocationSize()
- * @generated
- * @ordered
- */
- protected static final int DEFAULT_ALLOCATION_SIZE_EDEFAULT = 0;
-
- /**
- * The cached value of the '{@link #getDefaultAllocationSize() <em>Default Allocation Size</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultAllocationSize()
- * @generated
- * @ordered
- */
- protected int defaultAllocationSize = DEFAULT_ALLOCATION_SIZE_EDEFAULT;
-
- protected JavaGenerator() {
- throw new UnsupportedOperationException("Use JavaGenerator(Member) instead");
- }
-
- protected JavaGenerator(Member member) {
- super();
- this.member = member;
- this.nameAdapter = this.buildAdapter(this.nameAdapter());
- this.initialValueAdapter = this.buildIntAdapter(this.initialValueAdapter());
- this.allocationSizeAdapter = this.buildIntAdapter(this.allocationSizeAdapter());
- }
-
- protected Member getMember() {
- return this.member;
- }
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IGenerator.class)) {
- case JpaJavaMappingsPackage.JAVA_GENERATOR__SPECIFIED_ALLOCATION_SIZE :
- this.allocationSizeAdapter.setValue(notification.getNewIntValue());
- break;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__SPECIFIED_INITIAL_VALUE :
- this.initialValueAdapter.setValue(notification.getNewIntValue());
- break;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__NAME :
- this.nameAdapter.setValue((String) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- // ********** initialization **********
- protected AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new ShortCircuitAnnotationElementAdapter<String>(this.member, daea);
- }
-
- protected IntAnnotationElementAdapter buildIntAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new IntAnnotationElementAdapter(this.buildAdapter(daea));
- }
-
- protected abstract DeclarationAnnotationAdapter annotationAdapter();
-
- protected abstract DeclarationAnnotationElementAdapter<String> nameAdapter();
-
- protected abstract DeclarationAnnotationElementAdapter<String> initialValueAdapter();
-
- protected abstract DeclarationAnnotationElementAdapter<String> allocationSizeAdapter();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_GENERATOR;
- }
-
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see #setName(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIGenerator_Name()
- * @model
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaGenerator#getName <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Name</em>' attribute.
- * @see #getName()
- * @generated
- */
- public void setName(String newName) {
- String oldName = name;
- name = newName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_GENERATOR__NAME, oldName, name));
- }
-
- public int getInitialValue() {
- return (this.getSpecifiedInitialValue() == -1) ? this.getDefaultInitialValue() : this.getSpecifiedInitialValue();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Initial Value</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Initial Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Initial Value</em>' attribute.
- * @see #setSpecifiedInitialValue(int)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIGenerator_SpecifiedInitialValue()
- * @model default="-1"
- * @generated
- */
- public int getSpecifiedInitialValue() {
- return specifiedInitialValue;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaGenerator#getSpecifiedInitialValue <em>Specified Initial Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Initial Value</em>' attribute.
- * @see #getSpecifiedInitialValue()
- * @generated
- */
- public void setSpecifiedInitialValue(int newSpecifiedInitialValue) {
- int oldSpecifiedInitialValue = specifiedInitialValue;
- specifiedInitialValue = newSpecifiedInitialValue;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_GENERATOR__SPECIFIED_INITIAL_VALUE, oldSpecifiedInitialValue, specifiedInitialValue));
- }
-
- /**
- * Returns the value of the '<em><b>Default Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Initial Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Initial Value</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIGenerator_DefaultInitialValue()
- * @model changeable="false"
- * @generated
- */
- public int getDefaultInitialValue() {
- return defaultInitialValue;
- }
-
- public int getAllocationSize() {
- return (this.getSpecifiedAllocationSize() == -1) ? this.getDefaultAllocationSize() : this.getSpecifiedAllocationSize();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Allocation Size</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Allocation Size</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Allocation Size</em>' attribute.
- * @see #setSpecifiedAllocationSize(int)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIGenerator_SpecifiedAllocationSize()
- * @model default="-1"
- * @generated
- */
- public int getSpecifiedAllocationSize() {
- return specifiedAllocationSize;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaGenerator#getSpecifiedAllocationSize <em>Specified Allocation Size</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Allocation Size</em>' attribute.
- * @see #getSpecifiedAllocationSize()
- * @generated
- */
- public void setSpecifiedAllocationSize(int newSpecifiedAllocationSize) {
- int oldSpecifiedAllocationSize = specifiedAllocationSize;
- specifiedAllocationSize = newSpecifiedAllocationSize;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_GENERATOR__SPECIFIED_ALLOCATION_SIZE, oldSpecifiedAllocationSize, specifiedAllocationSize));
- }
-
- /**
- * Returns the value of the '<em><b>Default Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Allocation Size</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Allocation Size</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIGenerator_DefaultAllocationSize()
- * @model changeable="false"
- * @generated
- */
- public int getDefaultAllocationSize() {
- return defaultAllocationSize;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_GENERATOR__NAME :
- return getName();
- case JpaJavaMappingsPackage.JAVA_GENERATOR__INITIAL_VALUE :
- return new Integer(getInitialValue());
- case JpaJavaMappingsPackage.JAVA_GENERATOR__SPECIFIED_INITIAL_VALUE :
- return new Integer(getSpecifiedInitialValue());
- case JpaJavaMappingsPackage.JAVA_GENERATOR__DEFAULT_INITIAL_VALUE :
- return new Integer(getDefaultInitialValue());
- case JpaJavaMappingsPackage.JAVA_GENERATOR__ALLOCATION_SIZE :
- return new Integer(getAllocationSize());
- case JpaJavaMappingsPackage.JAVA_GENERATOR__SPECIFIED_ALLOCATION_SIZE :
- return new Integer(getSpecifiedAllocationSize());
- case JpaJavaMappingsPackage.JAVA_GENERATOR__DEFAULT_ALLOCATION_SIZE :
- return new Integer(getDefaultAllocationSize());
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_GENERATOR__NAME :
- setName((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__SPECIFIED_INITIAL_VALUE :
- setSpecifiedInitialValue(((Integer) newValue).intValue());
- return;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__SPECIFIED_ALLOCATION_SIZE :
- setSpecifiedAllocationSize(((Integer) newValue).intValue());
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_GENERATOR__NAME :
- setName(NAME_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__SPECIFIED_INITIAL_VALUE :
- setSpecifiedInitialValue(SPECIFIED_INITIAL_VALUE_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__SPECIFIED_ALLOCATION_SIZE :
- setSpecifiedAllocationSize(SPECIFIED_ALLOCATION_SIZE_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_GENERATOR__NAME :
- return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
- case JpaJavaMappingsPackage.JAVA_GENERATOR__INITIAL_VALUE :
- return getInitialValue() != INITIAL_VALUE_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__SPECIFIED_INITIAL_VALUE :
- return specifiedInitialValue != SPECIFIED_INITIAL_VALUE_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__DEFAULT_INITIAL_VALUE :
- return defaultInitialValue != DEFAULT_INITIAL_VALUE_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__ALLOCATION_SIZE :
- return getAllocationSize() != ALLOCATION_SIZE_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__SPECIFIED_ALLOCATION_SIZE :
- return specifiedAllocationSize != SPECIFIED_ALLOCATION_SIZE_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__DEFAULT_ALLOCATION_SIZE :
- return defaultAllocationSize != DEFAULT_ALLOCATION_SIZE_EDEFAULT;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IGenerator.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_GENERATOR__NAME :
- return JpaCoreMappingsPackage.IGENERATOR__NAME;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__INITIAL_VALUE :
- return JpaCoreMappingsPackage.IGENERATOR__INITIAL_VALUE;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__SPECIFIED_INITIAL_VALUE :
- return JpaCoreMappingsPackage.IGENERATOR__SPECIFIED_INITIAL_VALUE;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__DEFAULT_INITIAL_VALUE :
- return JpaCoreMappingsPackage.IGENERATOR__DEFAULT_INITIAL_VALUE;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__ALLOCATION_SIZE :
- return JpaCoreMappingsPackage.IGENERATOR__ALLOCATION_SIZE;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__SPECIFIED_ALLOCATION_SIZE :
- return JpaCoreMappingsPackage.IGENERATOR__SPECIFIED_ALLOCATION_SIZE;
- case JpaJavaMappingsPackage.JAVA_GENERATOR__DEFAULT_ALLOCATION_SIZE :
- return JpaCoreMappingsPackage.IGENERATOR__DEFAULT_ALLOCATION_SIZE;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IGenerator.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IGENERATOR__NAME :
- return JpaJavaMappingsPackage.JAVA_GENERATOR__NAME;
- case JpaCoreMappingsPackage.IGENERATOR__INITIAL_VALUE :
- return JpaJavaMappingsPackage.JAVA_GENERATOR__INITIAL_VALUE;
- case JpaCoreMappingsPackage.IGENERATOR__SPECIFIED_INITIAL_VALUE :
- return JpaJavaMappingsPackage.JAVA_GENERATOR__SPECIFIED_INITIAL_VALUE;
- case JpaCoreMappingsPackage.IGENERATOR__DEFAULT_INITIAL_VALUE :
- return JpaJavaMappingsPackage.JAVA_GENERATOR__DEFAULT_INITIAL_VALUE;
- case JpaCoreMappingsPackage.IGENERATOR__ALLOCATION_SIZE :
- return JpaJavaMappingsPackage.JAVA_GENERATOR__ALLOCATION_SIZE;
- case JpaCoreMappingsPackage.IGENERATOR__SPECIFIED_ALLOCATION_SIZE :
- return JpaJavaMappingsPackage.JAVA_GENERATOR__SPECIFIED_ALLOCATION_SIZE;
- case JpaCoreMappingsPackage.IGENERATOR__DEFAULT_ALLOCATION_SIZE :
- return JpaJavaMappingsPackage.JAVA_GENERATOR__DEFAULT_ALLOCATION_SIZE;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (name: ");
- result.append(name);
- result.append(", specifiedInitialValue: ");
- result.append(specifiedInitialValue);
- result.append(", defaultInitialValue: ");
- result.append(defaultInitialValue);
- result.append(", specifiedAllocationSize: ");
- result.append(specifiedAllocationSize);
- result.append(", defaultAllocationSize: ");
- result.append(defaultAllocationSize);
- result.append(')');
- return result.toString();
- }
-
- public ITextRange validationTextRange() {
- return this.member.annotationTextRange(this.annotationAdapter());
- }
-
- // ********** java annotations -> persistence model **********
- public void updateFromJava(CompilationUnit astRoot) {
- setName(this.nameAdapter.getValue(astRoot));
- setSpecifiedInitialValue(this.initialValueAdapter.getValue(astRoot));
- setSpecifiedAllocationSize(this.allocationSizeAdapter.getValue(astRoot));
- }
-
- // ********** static methods **********
- protected static DeclarationAnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(annotationAdapter, elementName);
- }
-
- protected static DeclarationAnnotationElementAdapter<String> buildNumberAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, NumberStringExpressionConverter.instance());
- }
-} // JavaGenerator
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaId.java
deleted file mode 100644
index 56e732d87d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaId.java
+++ /dev/null
@@ -1,779 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.TemporalType;
-import org.eclipse.jpt.utility.internal.Filter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Id</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaId()
- * @model kind="class"
- * @generated
- */
-public class JavaId extends JavaAttributeMapping implements IJavaId
-{
- private AnnotationAdapter generatedValueAnnotationAdapter;
-
- private AnnotationAdapter tableGeneratorAnnotationAdapter;
-
- private AnnotationAdapter sequenceGeneratorAnnotationAdapter;
-
- private final AnnotationAdapter temporalAnnotationAdapter;
-
- private final AnnotationElementAdapter<String> temporalValueAdapter;
-
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ID);
-
- private static final DeclarationAnnotationAdapter TEMPORAL_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.TEMPORAL);
-
- private static final DeclarationAnnotationElementAdapter<String> TEMPORAL_VALUE_ADAPTER = buildTemporalValueAdapter();
-
- /**
- * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getColumn()
- * @generated
- * @ordered
- */
- protected IColumn column;
-
- /**
- * The cached value of the '{@link #getGeneratedValue() <em>Generated Value</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getGeneratedValue()
- * @generated
- * @ordered
- */
- protected IGeneratedValue generatedValue;
-
- /**
- * The default value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTemporal()
- * @generated
- * @ordered
- */
- protected static final TemporalType TEMPORAL_EDEFAULT = TemporalType.NULL;
-
- /**
- * The cached value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTemporal()
- * @generated
- * @ordered
- */
- protected TemporalType temporal = TEMPORAL_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getTableGenerator() <em>Table Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTableGenerator()
- * @generated
- * @ordered
- */
- protected ITableGenerator tableGenerator;
-
- /**
- * The cached value of the '{@link #getSequenceGenerator() <em>Sequence Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSequenceGenerator()
- * @generated
- * @ordered
- */
- protected ISequenceGenerator sequenceGenerator;
-
- protected JavaId() {
- throw new UnsupportedOperationException("Use JavaId(Attribute) instead");
- }
-
- protected JavaId(Attribute attribute) {
- super(attribute);
- this.column = JavaColumn.createColumnMappingColumn(buildColumnOwner(), getAttribute());
- ((InternalEObject) this.column).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ID__COLUMN, null, null);
- this.temporalAnnotationAdapter = new MemberAnnotationAdapter(this.getAttribute(), TEMPORAL_ADAPTER);
- this.temporalValueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, TEMPORAL_VALUE_ADAPTER);
- this.generatedValueAnnotationAdapter = this.buildAnnotationAdapter(JavaGeneratedValue.DECLARATION_ANNOTATION_ADAPTER);
- this.tableGeneratorAnnotationAdapter = this.buildAnnotationAdapter(JavaTableGenerator.DECLARATION_ANNOTATION_ADAPTER);
- this.sequenceGeneratorAnnotationAdapter = this.buildAnnotationAdapter(JavaSequenceGenerator.DECLARATION_ANNOTATION_ADAPTER);
- }
-
- @Override
- protected DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IId.class)) {
- case JpaCoreMappingsPackage.IID__TABLE_GENERATOR :
- attributeChanged(notification.getNewValue(), this.tableGeneratorAnnotationAdapter);
- break;
- case JpaCoreMappingsPackage.IID__SEQUENCE_GENERATOR :
- attributeChanged(notification.getNewValue(), this.sequenceGeneratorAnnotationAdapter);
- break;
- case JpaCoreMappingsPackage.IID__GENERATED_VALUE :
- attributeChanged(notification.getNewValue(), this.generatedValueAnnotationAdapter);
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_ID;
- }
-
- /**
- * Returns the value of the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIId_Column()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- public IColumn getColumn() {
- return column;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetColumn(IColumn newColumn, NotificationChain msgs) {
- IColumn oldColumn = column;
- column = newColumn;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ID__COLUMN, oldColumn, newColumn);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Returns the value of the '<em><b>Generated Value</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Generated Value</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Generated Value</em>' containment reference.
- * @see #setGeneratedValue(IGeneratedValue)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIId_GeneratedValue()
- * @model containment="true"
- * @generated
- */
- public IGeneratedValue getGeneratedValue() {
- return generatedValue;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetGeneratedValue(IGeneratedValue newGeneratedValue, NotificationChain msgs) {
- IGeneratedValue oldGeneratedValue = generatedValue;
- generatedValue = newGeneratedValue;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ID__GENERATED_VALUE, oldGeneratedValue, newGeneratedValue);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaId#getGeneratedValue <em>Generated Value</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Generated Value</em>' containment reference.
- * @see #getGeneratedValue()
- * @generated
- */
- public void setGeneratedValue(IGeneratedValue newGeneratedValue) {
- if (newGeneratedValue != generatedValue) {
- NotificationChain msgs = null;
- if (generatedValue != null)
- msgs = ((InternalEObject) generatedValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ID__GENERATED_VALUE, null, msgs);
- if (newGeneratedValue != null)
- msgs = ((InternalEObject) newGeneratedValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ID__GENERATED_VALUE, null, msgs);
- msgs = basicSetGeneratedValue(newGeneratedValue, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ID__GENERATED_VALUE, newGeneratedValue, newGeneratedValue));
- }
-
- private static void attributeChanged(Object value, AnnotationAdapter annotationAdapter) {
- Annotation annotation = annotationAdapter.getAnnotation();
- if (value == null) {
- if (annotation != null) {
- annotationAdapter.removeAnnotation();
- }
- }
- else {
- if (annotation == null) {
- annotationAdapter.newMarkerAnnotation();
- }
- }
- }
-
- /**
- * Returns the value of the '<em><b>Temporal</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.TemporalType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Temporal</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @see #setTemporal(TemporalType)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIId_Temporal()
- * @model
- * @generated
- */
- public TemporalType getTemporal() {
- return temporal;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaId#getTemporal <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @see #getTemporal()
- * @generated
- */
- public void setTemporalGen(TemporalType newTemporal) {
- TemporalType oldTemporal = temporal;
- temporal = newTemporal == null ? TEMPORAL_EDEFAULT : newTemporal;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ID__TEMPORAL, oldTemporal, temporal));
- }
-
- public void setTemporal(TemporalType newTemporal) {
- if (newTemporal != TemporalType.NULL) {
- if (this.temporalAnnotationAdapter.getAnnotation() == null) {
- this.temporalAnnotationAdapter.newMarkerAnnotation();
- }
- this.temporalValueAdapter.setValue(newTemporal.convertToJavaAnnotationValue());
- }
- else if (this.temporalAnnotationAdapter.getAnnotation() != null) {
- this.temporalAnnotationAdapter.removeAnnotation();
- }
- setTemporalGen(newTemporal);
- }
-
- /**
- * Returns the value of the '<em><b>Table Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table Generator</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table Generator</em>' containment reference.
- * @see #setTableGenerator(ITableGenerator)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIId_TableGenerator()
- * @model containment="true"
- * @generated
- */
- public ITableGenerator getTableGenerator() {
- return tableGenerator;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetTableGenerator(ITableGenerator newTableGenerator, NotificationChain msgs) {
- ITableGenerator oldTableGenerator = tableGenerator;
- tableGenerator = newTableGenerator;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ID__TABLE_GENERATOR, oldTableGenerator, newTableGenerator);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaId#getTableGenerator <em>Table Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Table Generator</em>' containment reference.
- * @see #getTableGenerator()
- * @generated
- */
- public void setTableGenerator(ITableGenerator newTableGenerator) {
- if (newTableGenerator != tableGenerator) {
- NotificationChain msgs = null;
- if (tableGenerator != null)
- msgs = ((InternalEObject) tableGenerator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ID__TABLE_GENERATOR, null, msgs);
- if (newTableGenerator != null)
- msgs = ((InternalEObject) newTableGenerator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ID__TABLE_GENERATOR, null, msgs);
- msgs = basicSetTableGenerator(newTableGenerator, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ID__TABLE_GENERATOR, newTableGenerator, newTableGenerator));
- }
-
- /**
- * Returns the value of the '<em><b>Sequence Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Sequence Generator</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Sequence Generator</em>' containment reference.
- * @see #setSequenceGenerator(ISequenceGenerator)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIId_SequenceGenerator()
- * @model containment="true"
- * @generated
- */
- public ISequenceGenerator getSequenceGenerator() {
- return sequenceGenerator;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetSequenceGenerator(ISequenceGenerator newSequenceGenerator, NotificationChain msgs) {
- ISequenceGenerator oldSequenceGenerator = sequenceGenerator;
- sequenceGenerator = newSequenceGenerator;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ID__SEQUENCE_GENERATOR, oldSequenceGenerator, newSequenceGenerator);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaId#getSequenceGenerator <em>Sequence Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Sequence Generator</em>' containment reference.
- * @see #getSequenceGenerator()
- * @generated
- */
- public void setSequenceGenerator(ISequenceGenerator newSequenceGenerator) {
- if (newSequenceGenerator != sequenceGenerator) {
- NotificationChain msgs = null;
- if (sequenceGenerator != null)
- msgs = ((InternalEObject) sequenceGenerator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ID__SEQUENCE_GENERATOR, null, msgs);
- if (newSequenceGenerator != null)
- msgs = ((InternalEObject) newSequenceGenerator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_ID__SEQUENCE_GENERATOR, null, msgs);
- msgs = basicSetSequenceGenerator(newSequenceGenerator, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ID__SEQUENCE_GENERATOR, newSequenceGenerator, newSequenceGenerator));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ID__COLUMN :
- return basicSetColumn(null, msgs);
- case JpaJavaMappingsPackage.JAVA_ID__GENERATED_VALUE :
- return basicSetGeneratedValue(null, msgs);
- case JpaJavaMappingsPackage.JAVA_ID__TABLE_GENERATOR :
- return basicSetTableGenerator(null, msgs);
- case JpaJavaMappingsPackage.JAVA_ID__SEQUENCE_GENERATOR :
- return basicSetSequenceGenerator(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ID__COLUMN :
- return getColumn();
- case JpaJavaMappingsPackage.JAVA_ID__GENERATED_VALUE :
- return getGeneratedValue();
- case JpaJavaMappingsPackage.JAVA_ID__TEMPORAL :
- return getTemporal();
- case JpaJavaMappingsPackage.JAVA_ID__TABLE_GENERATOR :
- return getTableGenerator();
- case JpaJavaMappingsPackage.JAVA_ID__SEQUENCE_GENERATOR :
- return getSequenceGenerator();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ID__GENERATED_VALUE :
- setGeneratedValue((IGeneratedValue) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ID__TEMPORAL :
- setTemporal((TemporalType) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ID__TABLE_GENERATOR :
- setTableGenerator((ITableGenerator) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_ID__SEQUENCE_GENERATOR :
- setSequenceGenerator((ISequenceGenerator) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ID__GENERATED_VALUE :
- setGeneratedValue((IGeneratedValue) null);
- return;
- case JpaJavaMappingsPackage.JAVA_ID__TEMPORAL :
- setTemporal(TEMPORAL_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_ID__TABLE_GENERATOR :
- setTableGenerator((ITableGenerator) null);
- return;
- case JpaJavaMappingsPackage.JAVA_ID__SEQUENCE_GENERATOR :
- setSequenceGenerator((ISequenceGenerator) null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ID__COLUMN :
- return column != null;
- case JpaJavaMappingsPackage.JAVA_ID__GENERATED_VALUE :
- return generatedValue != null;
- case JpaJavaMappingsPackage.JAVA_ID__TEMPORAL :
- return temporal != TEMPORAL_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_ID__TABLE_GENERATOR :
- return tableGenerator != null;
- case JpaJavaMappingsPackage.JAVA_ID__SEQUENCE_GENERATOR :
- return sequenceGenerator != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IColumnMapping.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IId.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_ID__COLUMN :
- return JpaCoreMappingsPackage.IID__COLUMN;
- case JpaJavaMappingsPackage.JAVA_ID__GENERATED_VALUE :
- return JpaCoreMappingsPackage.IID__GENERATED_VALUE;
- case JpaJavaMappingsPackage.JAVA_ID__TEMPORAL :
- return JpaCoreMappingsPackage.IID__TEMPORAL;
- case JpaJavaMappingsPackage.JAVA_ID__TABLE_GENERATOR :
- return JpaCoreMappingsPackage.IID__TABLE_GENERATOR;
- case JpaJavaMappingsPackage.JAVA_ID__SEQUENCE_GENERATOR :
- return JpaCoreMappingsPackage.IID__SEQUENCE_GENERATOR;
- default :
- return -1;
- }
- }
- if (baseClass == IJavaId.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IColumnMapping.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IId.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IID__COLUMN :
- return JpaJavaMappingsPackage.JAVA_ID__COLUMN;
- case JpaCoreMappingsPackage.IID__GENERATED_VALUE :
- return JpaJavaMappingsPackage.JAVA_ID__GENERATED_VALUE;
- case JpaCoreMappingsPackage.IID__TEMPORAL :
- return JpaJavaMappingsPackage.JAVA_ID__TEMPORAL;
- case JpaCoreMappingsPackage.IID__TABLE_GENERATOR :
- return JpaJavaMappingsPackage.JAVA_ID__TABLE_GENERATOR;
- case JpaCoreMappingsPackage.IID__SEQUENCE_GENERATOR :
- return JpaJavaMappingsPackage.JAVA_ID__SEQUENCE_GENERATOR;
- default :
- return -1;
- }
- }
- if (baseClass == IJavaId.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (temporal: ");
- result.append(temporal);
- result.append(')');
- return result.toString();
- }
-
- public String getKey() {
- return IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- this.updateTemporalFromJava(astRoot);
- this.getJavaColumn().updateFromJava(astRoot);
- this.updateGeneratedValueFromJava(astRoot);
- this.updateTableGeneratorFromJava(astRoot);
- this.updateSequenceGeneratorFromJava(astRoot);
- }
-
- private void updateGeneratedValueFromJava(CompilationUnit astRoot) {
- if (this.generatedValueAnnotationAdapter.getAnnotation(astRoot) == null) {
- if (getGeneratedValue() != null) {
- setGeneratedValue(null);
- }
- }
- else {
- if (getGeneratedValue() == null) {
- setGeneratedValue(createGeneratedValue());
- }
- ((JavaGeneratedValue) getGeneratedValue()).updateFromJava(astRoot);
- }
- }
-
- private void updateTableGeneratorFromJava(CompilationUnit astRoot) {
- if (this.tableGeneratorAnnotationAdapter.getAnnotation(astRoot) == null) {
- if (getTableGenerator() != null) {
- setTableGenerator(null);
- }
- }
- else {
- if (getTableGenerator() == null) {
- setTableGenerator(createTableGenerator());
- }
- ((JavaTableGenerator) getTableGenerator()).updateFromJava(astRoot);
- }
- }
-
- private void updateSequenceGeneratorFromJava(CompilationUnit astRoot) {
- if (this.sequenceGeneratorAnnotationAdapter.getAnnotation(astRoot) == null) {
- if (getSequenceGenerator() != null) {
- setSequenceGenerator(null);
- }
- }
- else {
- if (getSequenceGenerator() == null) {
- setSequenceGenerator(createSequenceGenerator());
- }
- ((JavaSequenceGenerator) getSequenceGenerator()).updateFromJava(astRoot);
- }
- }
-
- /*
- * The @Temporal annotation is a bit different than most JPA annotations.
- * For some indecipherable reason it has no default value (e.g. TIMESTAMP).
- * Also, it is *required* for any attribute declared with a type of
- * java.util.Date or java.util.Calendar; otherwise, it is *prohibited*.
- * As a result we allow a Basic mapping to have a null 'temporal',
- * indicating that the annotation is completely missing, as opposed
- * to the annotation being present but its value is invalid (e.g.
- * @Temporal(FRIDAY)).
- *
- * TODO this comment is wrong now, revisit this with Brian at some point
- */
- private void updateTemporalFromJava(CompilationUnit astRoot) {
- if (this.temporalAnnotationAdapter.getAnnotation(astRoot) == null) {
- setTemporalGen(TemporalType.NULL);
- }
- else {
- setTemporalGen(TemporalType.fromJavaAnnotationValue(this.temporalValueAdapter.getValue(astRoot)));
- }
- }
-
- private JavaColumn getJavaColumn() {
- return (JavaColumn) this.column;
- }
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.getJavaColumn().candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
- @Override
- public String primaryKeyColumnName() {
- return this.getColumn().getName();
- }
-
- public IGeneratedValue createGeneratedValue() {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaGeneratedValue(getAttribute());
- }
-
- public ISequenceGenerator createSequenceGenerator() {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaSequenceGenerator(getAttribute());
- }
-
- public ITableGenerator createTableGenerator() {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaTableGenerator(getAttribute());
- }
-
- @Override
- public boolean isOverridableAttributeMapping() {
- return true;
- }
-
- @Override
- public boolean isIdMapping() {
- return true;
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter<String> buildTemporalValueAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(TEMPORAL_ADAPTER, JPA.TEMPORAL__VALUE, false);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaJoinColumn.java
deleted file mode 100644
index caafa4f122..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaJoinColumn.java
+++ /dev/null
@@ -1,521 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.CombinationIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.db.internal.Column;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.utility.internal.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Join Column</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaJoinColumn()
- * @model kind="class"
- * @generated
- */
-public class JavaJoinColumn extends AbstractJavaColumn implements IJoinColumn
-{
- /**
- * The default value of the '{@link #getReferencedColumnName() <em>Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getReferencedColumnName()
- * @generated
- * @ordered
- */
- protected static final String REFERENCED_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedReferencedColumnName() <em>Specified Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedReferencedColumnName()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedReferencedColumnName() <em>Specified Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedReferencedColumnName()
- * @generated
- * @ordered
- */
- protected String specifiedReferencedColumnName = SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultReferencedColumnName() <em>Default Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultReferencedColumnName()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_REFERENCED_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultReferencedColumnName() <em>Default Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultReferencedColumnName()
- * @generated
- * @ordered
- */
- protected String defaultReferencedColumnName = DEFAULT_REFERENCED_COLUMN_NAME_EDEFAULT;
-
- private final IndexedAnnotationAdapter annotationAdapter;
-
- // hold this so we can get the 'referenced column name' text range
- private final DeclarationAnnotationElementAdapter<String> referencedColumnNameDeclarationAdapter;
-
- private final AnnotationElementAdapter<String> referencedColumnNameAdapter;
-
- public static final SimpleDeclarationAnnotationAdapter SINGLE_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.JOIN_COLUMN);
-
- public static final SimpleDeclarationAnnotationAdapter MULTIPLE_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.JOIN_COLUMNS);
-
- protected JavaJoinColumn() {
- super();
- throw new UnsupportedOperationException("Use JavaJoinColumn(Owner, Member, IndexedDeclarationAnnotationAdapter) instead");
- }
-
- protected JavaJoinColumn(IJoinColumn.Owner owner, Member member, IndexedDeclarationAnnotationAdapter daa) {
- super(owner, member, daa);
- this.annotationAdapter = new MemberIndexedAnnotationAdapter(member, daa);
- this.referencedColumnNameDeclarationAdapter = this.buildStringElementAdapter(JPA.JOIN_COLUMN__REFERENCED_COLUMN_NAME);
- this.referencedColumnNameAdapter = this.buildShortCircuitElementAdapter(this.referencedColumnNameDeclarationAdapter);
- }
-
- @Override
- protected String nameElementName() {
- return JPA.JOIN_COLUMN__NAME;
- }
-
- @Override
- protected String columnDefinitionElementName() {
- return JPA.JOIN_COLUMN__COLUMN_DEFINITION;
- }
-
- @Override
- protected String tableElementName() {
- return JPA.JOIN_COLUMN__TABLE;
- }
-
- @Override
- protected String uniqueElementName() {
- return JPA.JOIN_COLUMN__UNIQUE;
- }
-
- @Override
- protected String nullableElementName() {
- return JPA.JOIN_COLUMN__NULLABLE;
- }
-
- @Override
- protected String insertableElementName() {
- return JPA.JOIN_COLUMN__INSERTABLE;
- }
-
- @Override
- protected String updatableElementName() {
- return JPA.JOIN_COLUMN__UPDATABLE;
- }
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IAbstractJoinColumn.class)) {
- case JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- this.referencedColumnNameAdapter.setValue((String) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_JOIN_COLUMN;
- }
-
- /**
- * Returns the value of the '<em><b>Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Referenced Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Referenced Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJoinColumn_ReferencedColumnName()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getReferencedColumnName() {
- return (this.specifiedReferencedColumnName == null) ? this.defaultReferencedColumnName : this.specifiedReferencedColumnName;
- }
-
- /**
- * Returns the value of the '<em><b>Specified Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Referenced Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Referenced Column Name</em>' attribute.
- * @see #setSpecifiedReferencedColumnName(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIAbstractJoinColumn_SpecifiedReferencedColumnName()
- * @model
- * @generated
- */
- public String getSpecifiedReferencedColumnName() {
- return specifiedReferencedColumnName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinColumn#getSpecifiedReferencedColumnName <em>Specified Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Referenced Column Name</em>' attribute.
- * @see #getSpecifiedReferencedColumnName()
- * @generated
- */
- public void setSpecifiedReferencedColumnName(String newSpecifiedReferencedColumnName) {
- String oldSpecifiedReferencedColumnName = specifiedReferencedColumnName;
- specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME, oldSpecifiedReferencedColumnName, specifiedReferencedColumnName));
- }
-
- /**
- * Returns the value of the '<em><b>Default Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Referenced Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Referenced Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIAbstractJoinColumn_DefaultReferencedColumnName()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultReferencedColumnName() {
- return defaultReferencedColumnName;
- }
-
- protected void setDefaultReferencedColumnName(String newDefaultReferencedColumnName) {
- String oldDefaultReferencedColumnName = this.defaultReferencedColumnName;
- this.defaultReferencedColumnName = newDefaultReferencedColumnName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME, oldDefaultReferencedColumnName, newDefaultReferencedColumnName));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_JOIN_COLUMN__REFERENCED_COLUMN_NAME :
- return getReferencedColumnName();
- case JpaJavaMappingsPackage.JAVA_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- return getSpecifiedReferencedColumnName();
- case JpaJavaMappingsPackage.JAVA_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME :
- return getDefaultReferencedColumnName();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- setSpecifiedReferencedColumnName((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- setSpecifiedReferencedColumnName(SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_JOIN_COLUMN__REFERENCED_COLUMN_NAME :
- return REFERENCED_COLUMN_NAME_EDEFAULT == null ? getReferencedColumnName() != null : !REFERENCED_COLUMN_NAME_EDEFAULT.equals(getReferencedColumnName());
- case JpaJavaMappingsPackage.JAVA_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- return SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT == null ? specifiedReferencedColumnName != null : !SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT.equals(specifiedReferencedColumnName);
- case JpaJavaMappingsPackage.JAVA_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME :
- return DEFAULT_REFERENCED_COLUMN_NAME_EDEFAULT == null ? defaultReferencedColumnName != null : !DEFAULT_REFERENCED_COLUMN_NAME_EDEFAULT.equals(defaultReferencedColumnName);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IAbstractJoinColumn.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_JOIN_COLUMN__REFERENCED_COLUMN_NAME :
- return JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__REFERENCED_COLUMN_NAME;
- case JpaJavaMappingsPackage.JAVA_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- return JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME;
- case JpaJavaMappingsPackage.JAVA_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME :
- return JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME;
- default :
- return -1;
- }
- }
- if (baseClass == IJoinColumn.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IAbstractJoinColumn.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__REFERENCED_COLUMN_NAME :
- return JpaJavaMappingsPackage.JAVA_JOIN_COLUMN__REFERENCED_COLUMN_NAME;
- case JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- return JpaJavaMappingsPackage.JAVA_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME;
- case JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME :
- return JpaJavaMappingsPackage.JAVA_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME;
- default :
- return -1;
- }
- }
- if (baseClass == IJoinColumn.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedReferencedColumnName: ");
- result.append(specifiedReferencedColumnName);
- result.append(", defaultReferencedColumnName: ");
- result.append(defaultReferencedColumnName);
- result.append(')');
- return result.toString();
- }
-
- @Override
- public IJoinColumn.Owner getOwner() {
- return (IJoinColumn.Owner) super.getOwner();
- }
-
- public boolean isVirtual() {
- return getOwner().isVirtual(this);
- }
-
- public Table dbReferencedColumnTable() {
- return getOwner().dbReferencedColumnTable();
- }
-
- public Column dbReferencedColumn() {
- Table table = this.dbReferencedColumnTable();
- return (table == null) ? null : table.columnNamed(this.getReferencedColumnName());
- }
-
- @Override
- public boolean tableIsAllowed() {
- return this.getOwner().tableIsAllowed();
- }
-
- public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(this.referencedColumnNameDeclarationAdapter, pos, astRoot);
- }
-
- private Iterator<String> candidateReferencedColumnNames() {
- Table table = this.getOwner().dbReferencedColumnTable();
- return (table != null) ? table.columnNames() : EmptyIterator.<String> instance();
- }
-
- private Iterator<String> candidateReferencedColumnNames(Filter<String> filter) {
- return new FilteringIterator<String>(this.candidateReferencedColumnNames(), filter);
- }
-
- private Iterator<String> quotedCandidateReferencedColumnNames(Filter<String> filter) {
- return StringTools.quote(this.candidateReferencedColumnNames(filter));
- }
-
- @Override
- public Iterator<String> connectedCandidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.connectedCandidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.referencedColumnNameTouches(pos, astRoot)) {
- return this.quotedCandidateReferencedColumnNames(filter);
- }
- return null;
- }
-
- public boolean isReferencedColumnResolved() {
- return dbReferencedColumn() != null;
- }
-
- public ITextRange referencedColumnNameTextRange() {
- return elementTextRange(this.referencedColumnNameDeclarationAdapter);
- }
-
- /**
- * allow owners to verify the annotation
- */
- public Annotation annotation(CompilationUnit astRoot) {
- return this.annotationAdapter.getAnnotation(astRoot);
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- this.setSpecifiedReferencedColumnName(this.referencedColumnNameAdapter.getValue(astRoot));
- }
-
- public void refreshDefaults(DefaultsContext defaultsContext) {
- this.setDefaultReferencedColumnName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_REFERENCED_COLUMN_NAME_KEY));
- this.setDefaultName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_NAME_KEY));
- this.setDefaultTable((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_TABLE_KEY));
- }
-
- // ********** persistence model -> java annotations **********
- void moveAnnotation(int newIndex) {
- this.annotationAdapter.moveAnnotation(newIndex);
- }
-
- void newAnnotation() {
- this.annotationAdapter.newMarkerAnnotation();
- }
-
- void removeAnnotation() {
- this.annotationAdapter.removeAnnotation();
- }
-
- // ********** static methods **********
- static JavaJoinColumn createSingleRelationshipMappingJoinColumn(IJoinColumn.Owner owner, Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaJoinColumn(owner, member, buildSingleRelationshipMappingAnnotationAdapter(index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildSingleRelationshipMappingAnnotationAdapter(int index) {
- return new CombinationIndexedDeclarationAnnotationAdapter(SINGLE_DECLARATION_ANNOTATION_ADAPTER, MULTIPLE_DECLARATION_ANNOTATION_ADAPTER, index, JPA.JOIN_COLUMN);
- }
-
- static JavaJoinColumn createAssociationOverrideJoinColumn(DeclarationAnnotationAdapter associationOverrideAdapter, IJoinColumn.Owner owner, Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaJoinColumn(owner, member, buildAssociationOverrideAnnotationAdapter(associationOverrideAdapter, index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildAssociationOverrideAnnotationAdapter(DeclarationAnnotationAdapter associationOverrideAdapter, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(associationOverrideAdapter, JPA.ASSOCIATION_OVERRIDE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
- }
-
- static JavaJoinColumn createJoinTableJoinColumn(IJoinColumn.Owner owner, Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaJoinColumn(owner, member, buildJoinTableAnnotationAdapter(index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildJoinTableAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(JavaJoinTable.DECLARATION_ANNOTATION_ADAPTER, JPA.JOIN_TABLE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
- }
-
- static JavaJoinColumn createJoinTableInverseJoinColumn(IJoinColumn.Owner owner, Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaJoinColumn(owner, member, buildJoinTableInverseAnnotationAdapter(index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildJoinTableInverseAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(JavaJoinTable.DECLARATION_ANNOTATION_ADAPTER, JPA.JOIN_TABLE__INVERSE_JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaJoinTable.java
deleted file mode 100644
index 06bb606635..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaJoinTable.java
+++ /dev/null
@@ -1,822 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.utility.internal.Filter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Join Table</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaJoinTable()
- * @model kind="class"
- * @generated
- */
-public class JavaJoinTable extends AbstractJavaTable implements IJoinTable
-{
- /**
- * The cached value of the '{@link #getSpecifiedJoinColumns() <em>Specified Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IJoinColumn> specifiedJoinColumns;
-
- /**
- * The cached value of the '{@link #getDefaultJoinColumns() <em>Default Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IJoinColumn> defaultJoinColumns;
-
- /**
- * The cached value of the '{@link #getSpecifiedInverseJoinColumns() <em>Specified Inverse Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedInverseJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IJoinColumn> specifiedInverseJoinColumns;
-
- /**
- * The cached value of the '{@link #getDefaultInverseJoinColumns() <em>Default Inverse Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultInverseJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IJoinColumn> defaultInverseJoinColumns;
-
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.JOIN_TABLE);
-
- private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.JOIN_TABLE__NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> SCHEMA_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.JOIN_TABLE__SCHEMA);
-
- private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.JOIN_TABLE__CATALOG);
-
- protected JavaJoinTable() {
- super();
- throw new UnsupportedOperationException("Use JavaJoinTable(Owner, Member) instead");
- }
-
- protected JavaJoinTable(Owner owner, Member member) {
- super(owner, member, DECLARATION_ANNOTATION_ADAPTER);
- this.getDefaultJoinColumns().add(this.createJoinColumn(new JoinColumnOwner(this), member));
- this.getDefaultInverseJoinColumns().add(this.createJoinColumn(new InverseJoinColumnOwner(this), member));
- }
-
- // ********** AbstractJavaTable implementation **********
- @Override
- protected DeclarationAnnotationElementAdapter<String> nameAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
- // ignore the daa passed in, @JoinTable is never nested
- return NAME_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> schemaAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
- // ignore the daa passed in, @JoinTable is never nested
- return SCHEMA_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> catalogAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
- // ignore the daa passed in, @JoinTable is never nested
- return CATALOG_ADAPTER;
- }
-
- private IJoinColumn createJoinColumn(IJoinColumn.Owner joinColumnOwner, Member joinColumnMember) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaJoinColumn(joinColumnOwner, joinColumnMember);
- }
-
- /**
- * check for changes to the 'specifiedJoinColumns' and
- * 'specifiedInverseJoinColumns' lists so we can notify the
- * model adapter of any changes;
- * also listen for changes to the 'defaultJoinColumns' and
- * 'defaultInverseJoinColumns' lists so we can spank the developer
- */
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IJoinTable.class)) {
- case JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_JOIN_COLUMNS :
- specifiedJoinColumnsChanged(notification);
- break;
- case JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS :
- specifiedInverseJoinColumnsChanged(notification);
- break;
- default :
- break;
- }
- }
-
- @SuppressWarnings("unchecked")
- void specifiedJoinColumnsChanged(Notification notification) {
- switch (notification.getEventType()) {
- case Notification.ADD :
- specifiedJoinColumnAdded(notification.getPosition(), (IJoinColumn) notification.getNewValue());
- break;
- case Notification.ADD_MANY :
- specifiedJoinColumnsAdded(notification.getPosition(), (List<IJoinColumn>) notification.getNewValue());
- break;
- case Notification.REMOVE :
- specifiedJoinColumnRemoved(notification.getPosition(), (IJoinColumn) notification.getOldValue());
- break;
- case Notification.REMOVE_MANY :
- if (notification.getPosition() == Notification.NO_INDEX) {
- specifiedJoinColumnsCleared((List<IJoinColumn>) notification.getOldValue());
- }
- else {
- // Notification.getNewValue() returns an array of the positions of objects that were removed
- specifiedJoinColumnsRemoved((int[]) notification.getNewValue(), (List<IJoinColumn>) notification.getOldValue());
- }
- break;
- case Notification.SET :
- if (!notification.isTouch()) {
- specifiedJoinColumnSet(notification.getPosition(), (IJoinColumn) notification.getOldValue(), (IJoinColumn) notification.getNewValue());
- }
- break;
- case Notification.MOVE :
- // Notification.getOldValue() returns the source index
- // Notification.getPositon() returns the target index
- // Notification.getNewValue() returns the moved object
- specifiedJoinColumnMoved(notification.getOldIntValue(), notification.getPosition(), (IJoinColumn) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- @SuppressWarnings("unchecked")
- void specifiedInverseJoinColumnsChanged(Notification notification) {
- switch (notification.getEventType()) {
- case Notification.ADD :
- specifiedInverseJoinColumnAdded(notification.getPosition(), (IJoinColumn) notification.getNewValue());
- break;
- case Notification.ADD_MANY :
- specifiedInverseJoinColumnsAdded(notification.getPosition(), (List<IJoinColumn>) notification.getNewValue());
- break;
- case Notification.REMOVE :
- specifiedInverseJoinColumnRemoved(notification.getPosition(), (IJoinColumn) notification.getOldValue());
- break;
- case Notification.REMOVE_MANY :
- if (notification.getPosition() == Notification.NO_INDEX) {
- specifiedInverseJoinColumnsCleared((List<IJoinColumn>) notification.getOldValue());
- }
- else {
- // Notification.getNewValue() returns an array of the positions of objects that were removed
- specifiedInverseJoinColumnsRemoved((int[]) notification.getNewValue(), (List<IJoinColumn>) notification.getOldValue());
- }
- break;
- case Notification.SET :
- if (!notification.isTouch()) {
- specifiedInverseJoinColumnSet(notification.getPosition(), (IJoinColumn) notification.getOldValue(), (IJoinColumn) notification.getNewValue());
- }
- break;
- case Notification.MOVE :
- // Notification.getOldValue() returns the source index
- // Notification.getPositon() returns the target index
- // Notification.getNewValue() returns the moved object
- specifiedInverseJoinColumnMoved(notification.getOldIntValue(), notification.getPosition(), (IJoinColumn) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_JOIN_TABLE;
- }
-
- public EList<IJoinColumn> getJoinColumns() {
- return this.getSpecifiedJoinColumns().isEmpty() ? this.getDefaultJoinColumns() : this.getSpecifiedJoinColumns();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJoinTable_SpecifiedJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IJoinColumn> getSpecifiedJoinColumns() {
- if (specifiedJoinColumns == null) {
- specifiedJoinColumns = new EObjectContainmentEList<IJoinColumn>(IJoinColumn.class, this, JpaJavaMappingsPackage.JAVA_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS);
- }
- return specifiedJoinColumns;
- }
-
- /**
- * Returns the value of the '<em><b>Default Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJoinTable_DefaultJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IJoinColumn> getDefaultJoinColumns() {
- if (defaultJoinColumns == null) {
- defaultJoinColumns = new EObjectContainmentEList<IJoinColumn>(IJoinColumn.class, this, JpaJavaMappingsPackage.JAVA_JOIN_TABLE__DEFAULT_JOIN_COLUMNS);
- }
- return defaultJoinColumns;
- }
-
- public EList<IJoinColumn> getInverseJoinColumns() {
- return this.getSpecifiedInverseJoinColumns().isEmpty() ? this.getDefaultInverseJoinColumns() : this.getSpecifiedInverseJoinColumns();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Inverse Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Inverse Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Inverse Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJoinTable_SpecifiedInverseJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IJoinColumn> getSpecifiedInverseJoinColumns() {
- if (specifiedInverseJoinColumns == null) {
- specifiedInverseJoinColumns = new EObjectContainmentEList<IJoinColumn>(IJoinColumn.class, this, JpaJavaMappingsPackage.JAVA_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS);
- }
- return specifiedInverseJoinColumns;
- }
-
- /**
- * Returns the value of the '<em><b>Default Inverse Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Inverse Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Inverse Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJoinTable_DefaultInverseJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IJoinColumn> getDefaultInverseJoinColumns() {
- if (defaultInverseJoinColumns == null) {
- defaultInverseJoinColumns = new EObjectContainmentEList<IJoinColumn>(IJoinColumn.class, this, JpaJavaMappingsPackage.JAVA_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS);
- }
- return defaultInverseJoinColumns;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__JOIN_COLUMNS :
- return ((InternalEList<?>) getJoinColumns()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS :
- return ((InternalEList<?>) getSpecifiedJoinColumns()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__DEFAULT_JOIN_COLUMNS :
- return ((InternalEList<?>) getDefaultJoinColumns()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__INVERSE_JOIN_COLUMNS :
- return ((InternalEList<?>) getInverseJoinColumns()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS :
- return ((InternalEList<?>) getSpecifiedInverseJoinColumns()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS :
- return ((InternalEList<?>) getDefaultInverseJoinColumns()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__JOIN_COLUMNS :
- return getJoinColumns();
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS :
- return getSpecifiedJoinColumns();
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__DEFAULT_JOIN_COLUMNS :
- return getDefaultJoinColumns();
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__INVERSE_JOIN_COLUMNS :
- return getInverseJoinColumns();
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS :
- return getSpecifiedInverseJoinColumns();
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS :
- return getDefaultInverseJoinColumns();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS :
- getSpecifiedJoinColumns().clear();
- getSpecifiedJoinColumns().addAll((Collection<? extends IJoinColumn>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__DEFAULT_JOIN_COLUMNS :
- getDefaultJoinColumns().clear();
- getDefaultJoinColumns().addAll((Collection<? extends IJoinColumn>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS :
- getSpecifiedInverseJoinColumns().clear();
- getSpecifiedInverseJoinColumns().addAll((Collection<? extends IJoinColumn>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS :
- getDefaultInverseJoinColumns().clear();
- getDefaultInverseJoinColumns().addAll((Collection<? extends IJoinColumn>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS :
- getSpecifiedJoinColumns().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__DEFAULT_JOIN_COLUMNS :
- getDefaultJoinColumns().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS :
- getSpecifiedInverseJoinColumns().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS :
- getDefaultInverseJoinColumns().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__JOIN_COLUMNS :
- return !getJoinColumns().isEmpty();
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS :
- return specifiedJoinColumns != null && !specifiedJoinColumns.isEmpty();
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__DEFAULT_JOIN_COLUMNS :
- return defaultJoinColumns != null && !defaultJoinColumns.isEmpty();
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__INVERSE_JOIN_COLUMNS :
- return !getInverseJoinColumns().isEmpty();
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS :
- return specifiedInverseJoinColumns != null && !specifiedInverseJoinColumns.isEmpty();
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS :
- return defaultInverseJoinColumns != null && !defaultInverseJoinColumns.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IJoinTable.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IJOIN_TABLE__JOIN_COLUMNS;
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_JOIN_COLUMNS;
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__DEFAULT_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IJOIN_TABLE__DEFAULT_JOIN_COLUMNS;
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__INVERSE_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IJOIN_TABLE__INVERSE_JOIN_COLUMNS;
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS;
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IJOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IJoinTable.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IJOIN_TABLE__JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_JOIN_TABLE__JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IJOIN_TABLE__DEFAULT_JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_JOIN_TABLE__DEFAULT_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IJOIN_TABLE__INVERSE_JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_JOIN_TABLE__INVERSE_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IJOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- public IRelationshipMapping relationshipMapping() {
- return (IRelationshipMapping) this.eContainer();
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- this.updateSpecifiedJoinColumnsFromJava(astRoot);
- this.updateSpecifiedInverseJoinColumnsFromJava(astRoot);
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext) {
- super.refreshDefaults(defaultsContext);
- this.setDefaultName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_TABLE_NAME_KEY));
- }
-
- public boolean isSpecified() {
- return getMember().containsAnnotation(DECLARATION_ANNOTATION_ADAPTER);
- }
-
- /**
- * here we just worry about getting the join column lists the same size;
- * then we delegate to the join columns to synch themselves up
- */
- private void updateSpecifiedJoinColumnsFromJava(CompilationUnit astRoot) {
- // synchronize the model join columns with the Java source
- List<IJoinColumn> joinColumns = this.getSpecifiedJoinColumns();
- int persSize = joinColumns.size();
- int javaSize = 0;
- boolean allJavaAnnotationsFound = false;
- for (int i = 0; i < persSize; i++) {
- JavaJoinColumn joinColumn = (JavaJoinColumn) joinColumns.get(i);
- if (joinColumn.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- break; // no need to go any further
- }
- joinColumn.updateFromJava(astRoot);
- javaSize++;
- }
- if (allJavaAnnotationsFound) {
- // remove any model join columns beyond those that correspond to the Java annotations
- while (persSize > javaSize) {
- persSize--;
- joinColumns.remove(persSize);
- }
- }
- else {
- // add new model join columns until they match the Java annotations
- while (!allJavaAnnotationsFound) {
- JavaJoinColumn joinColumn = this.createJavaJoinColumn(javaSize);
- if (joinColumn.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- }
- else {
- this.getSpecifiedJoinColumns().add(joinColumn);
- joinColumn.updateFromJava(astRoot);
- javaSize++;
- }
- }
- }
- }
-
- /**
- * here we just worry about getting the inverse join column lists the same size;
- * then we delegate to the join columns to synch themselves up
- */
- private void updateSpecifiedInverseJoinColumnsFromJava(CompilationUnit astRoot) {
- // synchronize the model join columns with the Java source
- List<IJoinColumn> inverseJoinColumns = this.getSpecifiedInverseJoinColumns();
- int persSize = inverseJoinColumns.size();
- int javaSize = 0;
- boolean allJavaAnnotationsFound = false;
- for (int i = 0; i < persSize; i++) {
- JavaJoinColumn inverseJoinColumn = (JavaJoinColumn) inverseJoinColumns.get(i);
- if (inverseJoinColumn.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- break; // no need to go any further
- }
- inverseJoinColumn.updateFromJava(astRoot);
- javaSize++;
- }
- if (allJavaAnnotationsFound) {
- // remove any model join columns beyond those that correspond to the Java annotations
- while (persSize > javaSize) {
- persSize--;
- inverseJoinColumns.remove(persSize);
- }
- }
- else {
- // add new model join columns until they match the Java annotations
- while (!allJavaAnnotationsFound) {
- JavaJoinColumn inverseJoinColumn = this.createJavaInverseJoinColumn(javaSize);
- if (inverseJoinColumn.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- }
- else {
- this.getSpecifiedInverseJoinColumns().add(inverseJoinColumn);
- inverseJoinColumn.updateFromJava(astRoot);
- javaSize++;
- }
- }
- }
- }
-
- // ********** jpa model -> java annotations **********
- ////////////////////////////////////////////////////////
- /**
- * slide over all the annotations that follow the new join column
- */
- public void specifiedJoinColumnAdded(int index, IJoinColumn joinColumn) {
- // JoinColumn was added to jpa model when updating from java, do not need
- // to edit the java in this case. TODO is there a better way to handle this??
- if (((JavaJoinColumn) joinColumn).annotation(getMember().astRoot()) == null) {
- this.synchJoinColumnAnnotationsAfterAdd(index + 1);
- ((JavaJoinColumn) joinColumn).newAnnotation();
- }
- }
-
- // bjv look at this
- public void specifiedJoinColumnsAdded(int index, List<IJoinColumn> joinColumns) {
- // JoinColumn was added to jpa model when updating from java, do not need
- // to edit the java in this case. TODO is there a better way to handle this??
- if (!joinColumns.isEmpty() && ((JavaJoinColumn) joinColumns.get(0)).annotation(getMember().astRoot()) == null) {
- this.synchJoinColumnAnnotationsAfterAdd(index + joinColumns.size());
- for (IJoinColumn joinColumn : joinColumns) {
- ((JavaJoinColumn) joinColumn).newAnnotation();
- }
- }
- }
-
- public void specifiedJoinColumnRemoved(int index, IJoinColumn joinColumn) {
- ((JavaJoinColumn) joinColumn).removeAnnotation();
- this.synchJoinColumnAnnotationsAfterRemove(index);
- }
-
- public void specifiedJoinColumnsRemoved(int[] indexes, List<IJoinColumn> joinColumns) {
- for (IJoinColumn joinColumn : joinColumns) {
- ((JavaJoinColumn) joinColumn).removeAnnotation();
- }
- this.synchJoinColumnAnnotationsAfterRemove(indexes[0]);
- }
-
- public void specifiedJoinColumnsCleared(List<IJoinColumn> joinColumns) {
- for (IJoinColumn joinColumn : joinColumns) {
- ((JavaJoinColumn) joinColumn).removeAnnotation();
- }
- }
-
- public void specifiedJoinColumnSet(int index, IJoinColumn oldJoinColumn, IJoinColumn newJoinColumn) {
- ((JavaJoinColumn) newJoinColumn).newAnnotation();
- }
-
- public void specifiedJoinColumnMoved(int sourceIndex, int targetIndex, IJoinColumn joinColumn) {
- List<IJoinColumn> joinColumns = this.getSpecifiedJoinColumns();
- int begin = Math.min(sourceIndex, targetIndex);
- int end = Math.max(sourceIndex, targetIndex);
- for (int i = begin; i-- > end;) {
- this.synch(joinColumns.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the end of the list to prevent overlap
- */
- private void synchJoinColumnAnnotationsAfterAdd(int index) {
- List<IJoinColumn> joinColumns = this.getSpecifiedJoinColumns();
- for (int i = joinColumns.size(); i-- > index;) {
- this.synch(joinColumns.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the specified index to prevent overlap
- */
- private void synchJoinColumnAnnotationsAfterRemove(int index) {
- List<IJoinColumn> joinColumns = this.getSpecifiedJoinColumns();
- for (int i = index; i < joinColumns.size(); i++) {
- this.synch(joinColumns.get(i), i);
- }
- }
-
- ////////////////////////////////////////////////////////
- /**
- * slide over all the annotations that follow the new inverse join column
- */
- public void specifiedInverseJoinColumnAdded(int index, IJoinColumn inverseJoinColumn) {
- if (((JavaJoinColumn) inverseJoinColumn).annotation(getMember().astRoot()) == null) {
- this.synchInverseJoinColumnAnnotationsAfterAdd(index + 1);
- ((JavaJoinColumn) inverseJoinColumn).newAnnotation();
- }
- }
-
- public void specifiedInverseJoinColumnsAdded(int index, List<IJoinColumn> inverseJoinColumns) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (!inverseJoinColumns.isEmpty() && ((JavaJoinColumn) inverseJoinColumns.get(0)).annotation(getMember().astRoot()) == null) {
- this.synchInverseJoinColumnAnnotationsAfterAdd(index + inverseJoinColumns.size());
- for (IJoinColumn inverseJoinColumn : inverseJoinColumns) {
- ((JavaJoinColumn) inverseJoinColumn).newAnnotation();
- }
- }
- }
-
- public void specifiedInverseJoinColumnRemoved(int index, IJoinColumn inverseJoinColumn) {
- ((JavaJoinColumn) inverseJoinColumn).removeAnnotation();
- this.synchInverseJoinColumnAnnotationsAfterRemove(index);
- }
-
- public void specifiedInverseJoinColumnsRemoved(int[] indexes, List<IJoinColumn> inverseJoinColumns) {
- for (IJoinColumn inverseJoinColumn : inverseJoinColumns) {
- ((JavaJoinColumn) inverseJoinColumn).removeAnnotation();
- }
- this.synchInverseJoinColumnAnnotationsAfterRemove(indexes[0]);
- }
-
- public void specifiedInverseJoinColumnsCleared(List<IJoinColumn> inverseJoinColumns) {
- for (IJoinColumn inverseJoinColumn : inverseJoinColumns) {
- ((JavaJoinColumn) inverseJoinColumn).removeAnnotation();
- }
- }
-
- public void specifiedInverseJoinColumnSet(int index, IJoinColumn oldInverseJoinColumn, IJoinColumn newInverseJoinColumn) {
- ((JavaJoinColumn) newInverseJoinColumn).newAnnotation();
- }
-
- public void specifiedInverseJoinColumnMoved(int sourceIndex, int targetIndex, IJoinColumn inverseJoinColumn) {
- List<IJoinColumn> inverseJoinColumns = this.getSpecifiedInverseJoinColumns();
- int begin = Math.min(sourceIndex, targetIndex);
- int end = Math.max(sourceIndex, targetIndex);
- for (int i = begin; i-- > end;) {
- this.synch(inverseJoinColumns.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model inverse join columns,
- * starting at the end of the list to prevent overlap
- */
- private void synchInverseJoinColumnAnnotationsAfterAdd(int index) {
- List<IJoinColumn> inverseJoinColumns = this.getSpecifiedInverseJoinColumns();
- for (int i = inverseJoinColumns.size(); i-- > index;) {
- this.synch(inverseJoinColumns.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model inverse join columns,
- * starting at the specified index to prevent overlap
- */
- private void synchInverseJoinColumnAnnotationsAfterRemove(int index) {
- List<IJoinColumn> inverseJoinColumns = this.getSpecifiedInverseJoinColumns();
- for (int i = index; i < inverseJoinColumns.size(); i++) {
- this.synch(inverseJoinColumns.get(i), i);
- }
- }
-
- private void synch(IJoinColumn joinColumn, int index) {
- ((JavaJoinColumn) joinColumn).moveAnnotation(index);
- }
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (IJoinColumn column : this.getJoinColumns()) {
- result = ((JavaJoinColumn) column).candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- for (IJoinColumn column : this.getInverseJoinColumns()) {
- result = ((JavaJoinColumn) column).candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- @Override
- protected JavaUniqueConstraint createJavaUniqueConstraint(int index) {
- return JavaUniqueConstraint.createJoinTableUniqueConstraint(new UniqueConstraintOwner(this), this.getMember(), index);
- }
-
- // ********** IJoinTable implementation **********
- public IJoinColumn createJoinColumn(int index) {
- return this.createJavaJoinColumn(index);
- }
-
- private JavaJoinColumn createJavaJoinColumn(int index) {
- return JavaJoinColumn.createJoinTableJoinColumn(new JoinColumnOwner(this), this.getMember(), index);
- }
-
- public IJoinColumn createInverseJoinColumn(int index) {
- return this.createJavaInverseJoinColumn(index);
- }
-
- private JavaJoinColumn createJavaInverseJoinColumn(int index) {
- return JavaJoinColumn.createJoinTableInverseJoinColumn(new InverseJoinColumnOwner(this), this.getMember(), index);
- }
-
- public boolean containsSpecifiedJoinColumns() {
- return !this.getSpecifiedJoinColumns().isEmpty();
- }
-
- public boolean containsSpecifiedInverseJoinColumns() {
- return !this.getSpecifiedInverseJoinColumns().isEmpty();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaManyToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaManyToMany.java
deleted file mode 100644
index ac016dd044..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaManyToMany.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Many To Many</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaManyToMany()
- * @model kind="class"
- * @generated
- */
-public class JavaManyToMany extends JavaMultiRelationshipMapping
- implements IJavaManyToMany
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.MANY_TO_MANY);
-
- private static final DeclarationAnnotationElementAdapter<String> TARGET_ENTITY_ADAPTER = buildTargetEntityAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__TARGET_ENTITY);
-
- private static final DeclarationAnnotationElementAdapter<String[]> CASCADE_ADAPTER = buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__CASCADE);
-
- private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildEnumAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__FETCH);
-
- private static final DeclarationAnnotationElementAdapter<String> MAPPED_BY_ADAPTER = buildAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__MAPPED_BY);
-
- protected JavaManyToMany() {
- throw new UnsupportedOperationException("Use JavaManyToMany(Attribute) instead");
- }
-
- protected JavaManyToMany(Attribute attribute) {
- super(attribute);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_MANY_TO_MANY;
- }
-
- public String getKey() {
- return IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- // ********** JavaRelationshipMappingModelAdapter implementation **********
- @Override
- protected DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> targetEntityAdapter() {
- return TARGET_ENTITY_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String[]> cascadeAdapter() {
- return CASCADE_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> fetchAdapter() {
- return FETCH_ADAPTER;
- }
-
- // ********** JavaMultiRelationshipMappingModelAdapter implementation **********
- @Override
- protected DeclarationAnnotationElementAdapter<String> mappedByAdapter() {
- return MAPPED_BY_ADAPTER;
- }
-
- // ********** INonOwningMapping implementation **********
- public boolean mappedByIsValid(IAttributeMapping mappedByMapping) {
- String mappedByKey = mappedByMapping.getKey();
- return (mappedByKey == IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaManyToManyProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaManyToManyProvider.java
deleted file mode 100644
index 3d77937bd2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaManyToManyProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.IJpaFactory;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMappingProvider;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-
-/**
- *
- */
-public class JavaManyToManyProvider
- implements IJavaAttributeMappingProvider
-{
-
- // singleton
- private static final JavaManyToManyProvider INSTANCE = new JavaManyToManyProvider();
-
- /**
- * Return the singleton.
- */
- public static IJavaAttributeMappingProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private JavaManyToManyProvider() {
- super();
- }
-
- public String key() {
- return IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- public IJavaAttributeMapping buildMapping(Attribute attribute, IJpaFactory factory) {
- return factory.createJavaManyToMany(attribute);
- }
-
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return JavaManyToMany.DECLARATION_ANNOTATION_ADAPTER;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaManyToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaManyToOne.java
deleted file mode 100644
index 5ba5e9ed81..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaManyToOne.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Many To One</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaManyToOne()
- * @model kind="class"
- * @generated
- */
-public class JavaManyToOne extends JavaSingleRelationshipMapping
- implements IJavaManyToOne
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.MANY_TO_ONE);
-
- private static final DeclarationAnnotationElementAdapter<String> TARGET_ENTITY_ADAPTER = buildTargetEntityAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_ONE__TARGET_ENTITY);
-
- private static final DeclarationAnnotationElementAdapter<String[]> CASCADE_ADAPTER = buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_ONE__CASCADE);
-
- private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildEnumAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_ONE__FETCH);
-
- private static final DeclarationAnnotationElementAdapter<String> OPTIONAL_ADAPTER = buildOptionalAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_ONE__OPTIONAL);
-
- protected JavaManyToOne() {
- throw new UnsupportedOperationException("Use JavaManyToOne(Attribute) instead");
- }
-
- protected JavaManyToOne(Attribute attribute) {
- super(attribute);
- }
-
- // ********** initialization **********
- @Override
- protected DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> targetEntityAdapter() {
- return TARGET_ENTITY_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String[]> cascadeAdapter() {
- return CASCADE_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> fetchAdapter() {
- return FETCH_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> optionalAdapter() {
- return OPTIONAL_ADAPTER;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_MANY_TO_ONE;
- }
-
- public String getKey() {
- return IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- public boolean isOverridableAssociationMapping() {
- return true;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaMappedSuperclass.java
deleted file mode 100644
index 86b4ad7542..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaMappedSuperclass.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleTypeStringExpressionConverter;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
-import org.eclipse.jpt.core.internal.mappings.IMappedSuperclass;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Mapped Superclass</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaMappedSuperclass()
- * @model kind="class"
- * @generated
- */
-public class JavaMappedSuperclass extends JavaTypeMapping
- implements IJavaMappedSuperclass
-{
- /**
- * The default value of the '{@link #getIdClass() <em>Id Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getIdClass()
- * @generated
- * @ordered
- */
- protected static final String ID_CLASS_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getIdClass() <em>Id Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getIdClass()
- * @generated
- * @ordered
- */
- protected String idClass = ID_CLASS_EDEFAULT;
-
- private final AnnotationAdapter idClassAnnotationAdapter;
-
- private final AnnotationElementAdapter<String> idClassValueAdapter;
-
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.MAPPED_SUPERCLASS);
-
- public static final DeclarationAnnotationAdapter ID_CLASS_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ID_CLASS);
-
- private static final DeclarationAnnotationElementAdapter<String> ID_CLASS_VALUE_ADAPTER = buildIdClassValueAdapter();
-
- protected JavaMappedSuperclass() {
- throw new UnsupportedOperationException("Use JavaMappedSuperclass(Type) instead");
- }
-
- protected JavaMappedSuperclass(Type type) {
- super(type);
- this.idClassAnnotationAdapter = new MemberAnnotationAdapter(this.getType(), ID_CLASS_ADAPTER);
- this.idClassValueAdapter = new ShortCircuitAnnotationElementAdapter<String>(this.getType(), ID_CLASS_VALUE_ADAPTER);
- }
-
- @Override
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- /**
- * check for changes to the 'specifiedJoinColumns' and
- * 'specifiedInverseJoinColumns' lists so we can notify the
- * model adapter of any changes;
- * also listen for changes to the 'defaultJoinColumns' and
- * 'defaultInverseJoinColumns' lists so we can spank the developer
- */
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IMappedSuperclass.class)) {
- case JpaCoreMappingsPackage.IMAPPED_SUPERCLASS__ID_CLASS :
- String newIdClass = (String) notification.getNewValue();
- if (newIdClass == null) {
- this.idClassAnnotationAdapter.removeAnnotation();
- }
- else {
- this.idClassValueAdapter.setValue(newIdClass);
- }
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_MAPPED_SUPERCLASS;
- }
-
- /**
- * Returns the value of the '<em><b>Id Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Id Class</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Id Class</em>' attribute.
- * @see #setIdClass(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIMappedSuperclass_IdClass()
- * @model
- * @generated
- */
- public String getIdClass() {
- return idClass;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaMappedSuperclass#getIdClass <em>Id Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Id Class</em>' attribute.
- * @see #getIdClass()
- * @generated
- */
- public void setIdClass(String newIdClass) {
- String oldIdClass = idClass;
- idClass = newIdClass;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_MAPPED_SUPERCLASS__ID_CLASS, oldIdClass, idClass));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_MAPPED_SUPERCLASS__ID_CLASS :
- return getIdClass();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_MAPPED_SUPERCLASS__ID_CLASS :
- setIdClass((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_MAPPED_SUPERCLASS__ID_CLASS :
- setIdClass(ID_CLASS_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_MAPPED_SUPERCLASS__ID_CLASS :
- return ID_CLASS_EDEFAULT == null ? idClass != null : !ID_CLASS_EDEFAULT.equals(idClass);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IMappedSuperclass.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_MAPPED_SUPERCLASS__ID_CLASS :
- return JpaCoreMappingsPackage.IMAPPED_SUPERCLASS__ID_CLASS;
- default :
- return -1;
- }
- }
- if (baseClass == IJavaMappedSuperclass.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IMappedSuperclass.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IMAPPED_SUPERCLASS__ID_CLASS :
- return JpaJavaMappingsPackage.JAVA_MAPPED_SUPERCLASS__ID_CLASS;
- default :
- return -1;
- }
- }
- if (baseClass == IJavaMappedSuperclass.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (idClass: ");
- result.append(idClass);
- result.append(')');
- return result.toString();
- }
-
- public String getKey() {
- return IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
- }
-
- @Override
- public Iterator<String> overridableAttributeNames() {
- return this.namesOf(this.overridableAttributes());
- }
-
- private Iterator<IPersistentAttribute> overridableAttributes() {
- return new FilteringIterator<IPersistentAttribute>(this.getPersistentType().attributes()) {
- @Override
- protected boolean accept(Object o) {
- return ((IPersistentAttribute) o).isOverridableAttribute();
- }
- };
- }
-
- @Override
- public Iterator<String> overridableAssociationNames() {
- return this.namesOf(this.overridableAssociations());
- }
-
- private Iterator<IPersistentAttribute> overridableAssociations() {
- return new FilteringIterator<IPersistentAttribute>(this.getPersistentType().attributes()) {
- @Override
- protected boolean accept(Object o) {
- return ((IPersistentAttribute) o).isOverridableAssociation();
- }
- };
- }
-
- private Iterator<String> namesOf(Iterator<IPersistentAttribute> attributes) {
- return new TransformationIterator<IPersistentAttribute, String>(attributes) {
- @Override
- protected String transform(IPersistentAttribute attribute) {
- return attribute.getName();
- }
- };
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- this.updateIdClassFromJava(astRoot);
- }
-
- private void updateIdClassFromJava(CompilationUnit astRoot) {
- if (this.idClassAnnotationAdapter.getAnnotation(astRoot) == null) {
- this.setIdClass(null);
- }
- else {
- this.setIdClass(this.idClassValueAdapter.getValue(astRoot));
- }
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter<String> buildIdClassValueAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter<String>(ID_CLASS_ADAPTER, JPA.ID_CLASS__VALUE, false, SimpleTypeStringExpressionConverter.instance());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaMultiRelationshipMapping.java
deleted file mode 100644
index 9ab22db543..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaMultiRelationshipMapping.java
+++ /dev/null
@@ -1,811 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.INonOwningMapping;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.utility.internal.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Multi Relationship Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaMultiRelationshipMapping()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class JavaMultiRelationshipMapping
- extends JavaRelationshipMapping implements IMultiRelationshipMapping
-{
- /**
- * The default value of the '{@link #getMappedBy() <em>Mapped By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMappedBy()
- * @generated
- * @ordered
- */
- protected static final String MAPPED_BY_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getMappedBy() <em>Mapped By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMappedBy()
- * @generated
- * @ordered
- */
- protected String mappedBy = MAPPED_BY_EDEFAULT;
-
- /**
- * The default value of the '{@link #getOrderBy() <em>Order By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getOrderBy()
- * @generated
- * @ordered
- */
- protected static final String ORDER_BY_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getOrderBy() <em>Order By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getOrderBy()
- * @generated
- * @ordered
- */
- protected String orderBy = ORDER_BY_EDEFAULT;
-
- /**
- * The default value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getFetch()
- * @generated
- * @ordered
- */
- protected static final DefaultLazyFetchType FETCH_EDEFAULT = DefaultLazyFetchType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getFetch()
- * @generated
- * @ordered
- */
- protected DefaultLazyFetchType fetch = FETCH_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getJoinTable() <em>Join Table</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getJoinTable()
- * @generated
- * @ordered
- */
- protected IJoinTable joinTable;
-
- /**
- * The default value of the '{@link #getMapKey() <em>Map Key</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMapKey()
- * @generated
- * @ordered
- */
- protected static final String MAP_KEY_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getMapKey() <em>Map Key</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMapKey()
- * @generated
- * @ordered
- */
- protected String mapKey = MAP_KEY_EDEFAULT;
-
- private final AnnotationElementAdapter<String> mappedByAdapter;
-
- /*
- * The @OrderBy annotation is a bit wack:
- * - no annotation at all means "no ordering"
- * - an annotation with no 'value' means "order by ascending primary key"
- * - an annotation with a 'value' means "order by the settings in the 'value' string"
- */
- private final AnnotationAdapter orderByAnnotationAdapter;
-
- private final AnnotationElementAdapter<String> orderByValueAdapter;
-
- public static final DeclarationAnnotationAdapter ORDER_BY_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ORDER_BY);
-
- private static final DeclarationAnnotationElementAdapter<String> ORDER_BY_VALUE_ADAPTER = buildOrderByValueAdapter();
-
- private final AnnotationAdapter mapKeyAnnotationAdapter;
-
- private final AnnotationElementAdapter<String> mapKeyNameAdapter;
-
- public static final DeclarationAnnotationAdapter MAP_KEY_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.MAP_KEY);
-
- private static final DeclarationAnnotationElementAdapter<String> MAP_KEY_NAME_ADAPTER = buildMapKeyNameAdapter();
-
- protected JavaMultiRelationshipMapping() {
- throw new UnsupportedOperationException("Use JavaMultiRelationshipMapping(Attribute) instead");
- }
-
- protected JavaMultiRelationshipMapping(Attribute attribute) {
- super(attribute);
- this.mappedByAdapter = this.buildAnnotationElementAdapter(this.mappedByAdapter());
- this.orderByAnnotationAdapter = new MemberAnnotationAdapter(attribute, ORDER_BY_ADAPTER);
- this.orderByValueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, ORDER_BY_VALUE_ADAPTER);
- this.mapKeyAnnotationAdapter = new MemberAnnotationAdapter(attribute, MAP_KEY_ADAPTER);
- this.mapKeyNameAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, MAP_KEY_NAME_ADAPTER);
- this.joinTable = JpaJavaMappingsFactory.eINSTANCE.createJavaJoinTable(buildOwner(), attribute);
- ((InternalEObject) this.joinTable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE, null, null);
- }
-
- /**
- * return the Java adapter's 'mappedBy' element adapter config
- */
- protected abstract DeclarationAnnotationElementAdapter<String> mappedByAdapter();
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(INonOwningMapping.class)) {
- case JpaCoreMappingsPackage.INON_OWNING_MAPPING__MAPPED_BY :
- this.mappedByAdapter.setValue((String) notification.getNewValue());
- break;
- default :
- break;
- }
- switch (notification.getFeatureID(IMultiRelationshipMapping.class)) {
- case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__ORDER_BY :
- String orderBy = (String) notification.getNewValue();
- if (orderBy == null) {
- this.orderByAnnotationAdapter.removeAnnotation();
- }
- else if ("".equals(orderBy)) {
- Annotation orderByAnnotation = this.orderByAnnotationAdapter.getAnnotation();
- if (orderByAnnotation != null) {
- // if the value is already "", then leave it alone (short circuit java change cycle)
- if (!"".equals(orderByValueAdapter.getValue())) {
- this.orderByValueAdapter.setValue(null);
- }
- }
- else {
- this.orderByAnnotationAdapter.newMarkerAnnotation();
- }
- }
- else {
- this.orderByValueAdapter.setValue(orderBy);
- }
- break;
- case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__MAP_KEY :
- String mk = (String) notification.getNewValue();
- if (mk == null) {
- this.mapKeyAnnotationAdapter.removeAnnotation();
- }
- else {
- this.mapKeyNameAdapter.setValue(mk);
- }
- break;
- case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__FETCH :
- this.getFetchAdapter().setValue(((DefaultLazyFetchType) notification.getNewValue()).convertToJavaAnnotationValue());
- break;
- default :
- break;
- }
- }
-
- private ITable.Owner buildOwner() {
- return new ITable.Owner() {
- public ITextRange validationTextRange() {
- return JavaMultiRelationshipMapping.this.validationTextRange();
- }
-
- public ITypeMapping getTypeMapping() {
- return JavaMultiRelationshipMapping.this.typeMapping();
- }
- };
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_MULTI_RELATIONSHIP_MAPPING;
- }
-
- /**
- * Returns the value of the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Mapped By</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Mapped By</em>' attribute.
- * @see #setMappedBy(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getINonOwningMapping_MappedBy()
- * @model
- * @generated
- */
- public String getMappedBy() {
- return mappedBy;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping#getMappedBy <em>Mapped By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Mapped By</em>' attribute.
- * @see #getMappedBy()
- * @generated
- */
- public void setMappedBy(String newMappedBy) {
- String oldMappedBy = mappedBy;
- mappedBy = newMappedBy;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY, oldMappedBy, mappedBy));
- }
-
- /**
- * Returns the value of the '<em><b>Order By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Order By</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Order By</em>' attribute.
- * @see #setOrderBy(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIMultiRelationshipMapping_OrderBy()
- * @model unique="false" ordered="false"
- * @generated
- */
- public String getOrderBy() {
- return orderBy;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping#getOrderBy <em>Order By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Order By</em>' attribute.
- * @see #getOrderBy()
- * @generated
- */
- public void setOrderBy(String newOrderBy) {
- String oldOrderBy = orderBy;
- orderBy = newOrderBy;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY, oldOrderBy, orderBy));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation" unique="false" required="true" ordered="false"
- * @generated NOT
- */
- public boolean isNoOrdering() {
- return getOrderBy() == null;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated NOT
- */
- public void setNoOrdering() {
- setOrderBy(null);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation" unique="false" required="true" ordered="false"
- * @generated NOT
- */
- public boolean isOrderByPk() {
- return "".equals(getOrderBy());
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated NOT
- */
- public void setOrderByPk() {
- setOrderBy("");
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation" unique="false" required="true" ordered="false"
- * @generated NOT
- */
- public boolean isCustomOrdering() {
- return !StringTools.stringIsEmpty(getOrderBy());
- }
-
- public ITextRange mappedByTextRange() {
- return this.elementTextRange(this.mappedByAdapter());
- }
-
- /**
- * Returns the value of the '<em><b>Fetch</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Fetch</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType
- * @see #setFetch(DefaultLazyFetchType)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIMultiRelationshipMapping_Fetch()
- * @model
- * @generated
- */
- public DefaultLazyFetchType getFetch() {
- return fetch;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping#getFetch <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType
- * @see #getFetch()
- * @generated
- */
- public void setFetch(DefaultLazyFetchType newFetch) {
- DefaultLazyFetchType oldFetch = fetch;
- fetch = newFetch == null ? FETCH_EDEFAULT : newFetch;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__FETCH, oldFetch, fetch));
- }
-
- /**
- * Returns the value of the '<em><b>Join Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Join Table</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Join Table</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIMultiRelationshipMapping_JoinTable()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- public IJoinTable getJoinTable() {
- return joinTable;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetJoinTable(IJoinTable newJoinTable, NotificationChain msgs) {
- IJoinTable oldJoinTable = joinTable;
- joinTable = newJoinTable;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE, oldJoinTable, newJoinTable);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- public boolean isJoinTableSpecified() {
- return getJavaJoinTable().isSpecified();
- }
-
- /**
- * Returns the value of the '<em><b>Map Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Map Key</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Map Key</em>' attribute.
- * @see #setMapKey(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIMultiRelationshipMapping_MapKey()
- * @model
- * @generated
- */
- public String getMapKey() {
- return mapKey;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping#getMapKey <em>Map Key</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Map Key</em>' attribute.
- * @see #getMapKey()
- * @generated
- */
- public void setMapKey(String newMapKey) {
- String oldMapKey = mapKey;
- mapKey = newMapKey;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY, oldMapKey, mapKey));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE :
- return basicSetJoinTable(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY :
- return getMappedBy();
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY :
- return getOrderBy();
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__FETCH :
- return getFetch();
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE :
- return getJoinTable();
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY :
- return getMapKey();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY :
- setMappedBy((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY :
- setOrderBy((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__FETCH :
- setFetch((DefaultLazyFetchType) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY :
- setMapKey((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY :
- setMappedBy(MAPPED_BY_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY :
- setOrderBy(ORDER_BY_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__FETCH :
- setFetch(FETCH_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY :
- setMapKey(MAP_KEY_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY :
- return MAPPED_BY_EDEFAULT == null ? mappedBy != null : !MAPPED_BY_EDEFAULT.equals(mappedBy);
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY :
- return ORDER_BY_EDEFAULT == null ? orderBy != null : !ORDER_BY_EDEFAULT.equals(orderBy);
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__FETCH :
- return fetch != FETCH_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE :
- return joinTable != null;
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY :
- return MAP_KEY_EDEFAULT == null ? mapKey != null : !MAP_KEY_EDEFAULT.equals(mapKey);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == INonOwningMapping.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY :
- return JpaCoreMappingsPackage.INON_OWNING_MAPPING__MAPPED_BY;
- default :
- return -1;
- }
- }
- if (baseClass == IMultiRelationshipMapping.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY :
- return JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__ORDER_BY;
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__FETCH :
- return JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__FETCH;
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE :
- return JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__JOIN_TABLE;
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY :
- return JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__MAP_KEY;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == INonOwningMapping.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.INON_OWNING_MAPPING__MAPPED_BY :
- return JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY;
- default :
- return -1;
- }
- }
- if (baseClass == IMultiRelationshipMapping.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__ORDER_BY :
- return JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY;
- case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__FETCH :
- return JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__FETCH;
- case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__JOIN_TABLE :
- return JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE;
- case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__MAP_KEY :
- return JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (mappedBy: ");
- result.append(mappedBy);
- result.append(", orderBy: ");
- result.append(orderBy);
- result.append(", fetch: ");
- result.append(fetch);
- result.append(", mapKey: ");
- result.append(mapKey);
- result.append(')');
- return result.toString();
- }
-
- public void refreshDefaults(DefaultsContext defaultsContext) {
- super.refreshDefaults(defaultsContext);
- // TODO
- // if (isOrderByPk()) {
- // refreshDefaultOrderBy(defaultsContext);
- // }
- }
-
- //primary key ordering when just the @OrderBy annotation is present
- protected void refreshDefaultOrderBy(DefaultsContext defaultsContext) {
- IEntity targetEntity = getResolvedTargetEntity();
- if (targetEntity != null) {
- setOrderBy(targetEntity.primaryKeyAttributeName() + " ASC");
- }
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- setMappedBy(this.mappedByAdapter.getValue(astRoot));
- updateOrderByFromJava(astRoot);
- this.getJavaJoinTable().updateFromJava(astRoot);
- updateMapKeyFromJava(astRoot);
- }
-
- private void updateOrderByFromJava(CompilationUnit astRoot) {
- String orderBy = this.orderByValueAdapter.getValue(astRoot);
- if (orderBy == null) {
- if (orderByAnnotation(astRoot) == null) {
- this.setNoOrdering();
- }
- else {
- this.setOrderByPk();
- }
- }
- else if ("".equals(orderBy)) {
- this.setOrderByPk();
- }
- else {
- this.setOrderBy(orderBy);
- }
- }
-
- private Annotation orderByAnnotation(CompilationUnit astRoot) {
- return this.orderByAnnotationAdapter.getAnnotation(astRoot);
- }
-
- private void updateMapKeyFromJava(CompilationUnit astRoot) {
- this.setMapKey(this.mapKeyNameAdapter.getValue(astRoot));
- }
-
- private JavaJoinTable getJavaJoinTable() {
- return (JavaJoinTable) this.joinTable;
- }
-
- @Override
- protected void updateFetchFromJava(CompilationUnit astRoot) {
- setFetch(DefaultLazyFetchType.fromJavaAnnotationValue(this.getFetchAdapter().getValue(astRoot)));
- }
-
- private boolean mappedByTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(this.mappedByAdapter(), pos, astRoot);
- }
-
- private boolean mapKeyNameTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(MAP_KEY_NAME_ADAPTER, pos, astRoot);
- }
-
- public Iterator<String> candidateMapKeyNames() {
- return this.allTargetEntityAttributeNames();
- }
-
- protected Iterator<String> candidateMapKeyNames(Filter<String> filter) {
- return new FilteringIterator<String>(this.candidateMapKeyNames(), filter);
- }
-
- protected Iterator<String> quotedCandidateMapKeyNames(Filter<String> filter) {
- return StringTools.quote(this.candidateMapKeyNames(filter));
- }
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.getJavaJoinTable().candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.mappedByTouches(pos, astRoot)) {
- return this.quotedCandidateMappedByAttributeNames(filter);
- }
- if (this.mapKeyNameTouches(pos, astRoot)) {
- return this.quotedCandidateMapKeyNames(filter);
- }
- return null;
- }
-
- /**
- * extract the element type from the specified container signature and
- * convert it into a reference entity type name;
- * return null if the type is not a valid reference entity type (e.g. it's
- * another container or an array or a primitive or other Basic type)
- */
- @Override
- protected String javaDefaultTargetEntity(ITypeBinding typeBinding) {
- String typeName = super.javaDefaultTargetEntity(typeBinding);
- return typeNamedIsContainer(typeName) ? javaDefaultTargetEntityFromContainer(typeBinding) : null;
- }
-
- public static String javaDefaultTargetEntityFromContainer(ITypeBinding typeBinding) {
- ITypeBinding[] typeArguments = typeBinding.getTypeArguments();
- if (typeArguments.length != 1) {
- return null;
- }
- ITypeBinding elementTypeBinding = typeArguments[0];
- String elementTypeName = buildReferenceEntityTypeName(elementTypeBinding);
- return typeNamedIsContainer(elementTypeName) ? null : elementTypeName;
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter<String> buildOrderByValueAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(ORDER_BY_ADAPTER, JPA.ORDER_BY__VALUE, false);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildMapKeyNameAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(MAP_KEY_ADAPTER, JPA.MAP_KEY__NAME, false);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedColumn.java
deleted file mode 100644
index 37023600eb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedColumn.java
+++ /dev/null
@@ -1,526 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.content.java.JavaEObject;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.BooleanStringExpressionConverter;
-import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.NumberStringExpressionConverter;
-import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.Column;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.utility.internal.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Named Column</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaNamedColumn()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class JavaNamedColumn extends JavaEObject
- implements INamedColumn
-{
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedName() <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedName()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedName() <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedName()
- * @generated
- * @ordered
- */
- protected String specifiedName = SPECIFIED_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultName() <em>Default Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultName()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultName() <em>Default Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultName()
- * @generated
- * @ordered
- */
- protected String defaultName = DEFAULT_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getColumnDefinition() <em>Column Definition</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getColumnDefinition()
- * @generated
- * @ordered
- */
- protected static final String COLUMN_DEFINITION_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getColumnDefinition() <em>Column Definition</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getColumnDefinition()
- * @generated
- * @ordered
- */
- protected String columnDefinition = COLUMN_DEFINITION_EDEFAULT;
-
- private final Owner owner;
-
- private final Member member;
-
- // hold this so we can get the annotation's text range
- private final DeclarationAnnotationAdapter daa;
-
- // hold this so we can get the 'name' text range
- private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
-
- private final AnnotationElementAdapter<String> nameAdapter;
-
- private final AnnotationElementAdapter<String> columnDefinitionAdapter;
-
- protected JavaNamedColumn() {
- super();
- throw new UnsupportedOperationException("Use JavaNamedColumn(Owner, Member, DeclarationAnnotationAdapter) instead");
- }
-
- protected JavaNamedColumn(Owner owner, Member member, DeclarationAnnotationAdapter daa) {
- super();
- this.owner = owner;
- this.member = member;
- this.daa = daa;
- this.nameDeclarationAdapter = this.buildStringElementAdapter(this.nameElementName());
- this.nameAdapter = this.buildShortCircuitElementAdapter(this.nameDeclarationAdapter);
- this.columnDefinitionAdapter = this.buildShortCircuitStringElementAdapter(this.columnDefinitionElementName());
- }
-
- protected DeclarationAnnotationElementAdapter<String> buildStringElementAdapter(String elementName) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, elementName);
- }
-
- protected DeclarationAnnotationElementAdapter<String> buildBooleanElementAdapter(String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(this.daa, elementName, BooleanStringExpressionConverter.instance());
- }
-
- protected DeclarationAnnotationElementAdapter<String> buildIntElementAdapter(String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(this.daa, elementName, NumberStringExpressionConverter.instance());
- }
-
- protected AnnotationElementAdapter<String> buildShortCircuitElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new ShortCircuitAnnotationElementAdapter<String>(this.member, daea);
- }
-
- protected AnnotationElementAdapter<String> buildShortCircuitStringElementAdapter(String elementName) {
- return this.buildShortCircuitElementAdapter(this.buildStringElementAdapter(elementName));
- }
-
- protected AnnotationElementAdapter<String> buildShortCircuitBooleanElementAdapter(String elementName) {
- return this.buildShortCircuitElementAdapter(this.buildBooleanElementAdapter(elementName));
- }
-
- protected IntAnnotationElementAdapter buildShortCircuitIntElementAdapter(String elementName) {
- return new IntAnnotationElementAdapter(this.buildShortCircuitElementAdapter(this.buildIntElementAdapter(elementName)));
- }
-
- protected abstract String nameElementName();
-
- protected abstract String columnDefinitionElementName();
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(INamedColumn.class)) {
- case JpaJavaMappingsPackage.JAVA_COLUMN__SPECIFIED_NAME :
- this.nameAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaJavaMappingsPackage.JAVA_COLUMN__COLUMN_DEFINITION :
- this.columnDefinitionAdapter.setValue((String) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_NAMED_COLUMN;
- }
-
- public String getName() {
- return (this.getSpecifiedName() == null) ? getDefaultName() : this.getSpecifiedName();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Name</em>' attribute.
- * @see #setSpecifiedName(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getINamedColumn_SpecifiedName()
- * @model
- * @generated
- */
- public String getSpecifiedName() {
- return specifiedName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedColumn#getSpecifiedName <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Name</em>' attribute.
- * @see #getSpecifiedName()
- * @generated
- */
- public void setSpecifiedName(String newSpecifiedName) {
- String oldSpecifiedName = specifiedName;
- specifiedName = newSpecifiedName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__SPECIFIED_NAME, oldSpecifiedName, specifiedName));
- }
-
- //TODO should we allow setting through the ecore, that would make this method
- //public and part of the ITable api. only the model needs to be setting the default,
- //but the ui needs to be listening for changes to the default.
- protected void setDefaultName(String newDefaultName) {
- String oldDefaultName = this.defaultName;
- this.defaultName = newDefaultName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__DEFAULT_NAME, oldDefaultName, this.defaultName));
- }
-
- /**
- * Returns the value of the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getINamedColumn_DefaultName()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultName() {
- return defaultName;
- }
-
- /**
- * Returns the value of the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column Definition</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column Definition</em>' attribute.
- * @see #setColumnDefinition(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getINamedColumn_ColumnDefinition()
- * @model
- * @generated
- */
- public String getColumnDefinition() {
- return columnDefinition;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedColumn#getColumnDefinition <em>Column Definition</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Column Definition</em>' attribute.
- * @see #getColumnDefinition()
- * @generated
- */
- public void setColumnDefinition(String newColumnDefinition) {
- String oldColumnDefinition = columnDefinition;
- columnDefinition = newColumnDefinition;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__COLUMN_DEFINITION, oldColumnDefinition, columnDefinition));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__NAME :
- return getName();
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__SPECIFIED_NAME :
- return getSpecifiedName();
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__DEFAULT_NAME :
- return getDefaultName();
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__COLUMN_DEFINITION :
- return getColumnDefinition();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__SPECIFIED_NAME :
- setSpecifiedName((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__COLUMN_DEFINITION :
- setColumnDefinition((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__SPECIFIED_NAME :
- setSpecifiedName(SPECIFIED_NAME_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__COLUMN_DEFINITION :
- setColumnDefinition(COLUMN_DEFINITION_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__NAME :
- return NAME_EDEFAULT == null ? getName() != null : !NAME_EDEFAULT.equals(getName());
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__SPECIFIED_NAME :
- return SPECIFIED_NAME_EDEFAULT == null ? specifiedName != null : !SPECIFIED_NAME_EDEFAULT.equals(specifiedName);
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__DEFAULT_NAME :
- return DEFAULT_NAME_EDEFAULT == null ? defaultName != null : !DEFAULT_NAME_EDEFAULT.equals(defaultName);
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__COLUMN_DEFINITION :
- return COLUMN_DEFINITION_EDEFAULT == null ? columnDefinition != null : !COLUMN_DEFINITION_EDEFAULT.equals(columnDefinition);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == INamedColumn.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__NAME :
- return JpaCoreMappingsPackage.INAMED_COLUMN__NAME;
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__SPECIFIED_NAME :
- return JpaCoreMappingsPackage.INAMED_COLUMN__SPECIFIED_NAME;
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__DEFAULT_NAME :
- return JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME;
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__COLUMN_DEFINITION :
- return JpaCoreMappingsPackage.INAMED_COLUMN__COLUMN_DEFINITION;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == INamedColumn.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.INAMED_COLUMN__NAME :
- return JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__NAME;
- case JpaCoreMappingsPackage.INAMED_COLUMN__SPECIFIED_NAME :
- return JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__SPECIFIED_NAME;
- case JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME :
- return JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__DEFAULT_NAME;
- case JpaCoreMappingsPackage.INAMED_COLUMN__COLUMN_DEFINITION :
- return JpaJavaMappingsPackage.JAVA_NAMED_COLUMN__COLUMN_DEFINITION;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedName: ");
- result.append(specifiedName);
- result.append(", defaultName: ");
- result.append(defaultName);
- result.append(", columnDefinition: ");
- result.append(columnDefinition);
- result.append(')');
- return result.toString();
- }
-
- public Owner getOwner() {
- return this.owner;
- }
-
- public ITextRange validationTextRange() {
- ITextRange textRange = this.member.annotationTextRange(this.daa);
- return (textRange != null) ? textRange : this.owner.validationTextRange();
- }
-
- protected ITextRange elementTextRange(DeclarationAnnotationElementAdapter<?> elementAdapter) {
- return this.elementTextRange(this.member.annotationElementTextRange(elementAdapter));
- }
-
- protected ITextRange elementTextRange(DeclarationAnnotationElementAdapter<?> elementAdapter, CompilationUnit astRoot) {
- return this.elementTextRange(this.member.annotationElementTextRange(elementAdapter, astRoot));
- }
-
- public ITextRange nameTextRange() {
- return this.elementTextRange(this.nameDeclarationAdapter);
- }
-
- public ITextRange nameTextRange(CompilationUnit astRoot) {
- return this.elementTextRange(this.nameDeclarationAdapter, astRoot);
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(this.nameDeclarationAdapter, pos, astRoot);
- }
-
- protected boolean elementTouches(DeclarationAnnotationElementAdapter<?> elementAdapter, int pos, CompilationUnit astRoot) {
- return this.elementTouches(this.member.annotationElementTextRange(elementAdapter, astRoot), pos);
- }
-
- public void updateFromJava(CompilationUnit astRoot) {
- this.setSpecifiedName(this.nameAdapter.getValue(astRoot));
- this.setColumnDefinition(this.columnDefinitionAdapter.getValue(astRoot));
- }
-
- public Column dbColumn() {
- Table table = this.dbTable();
- return (table == null) ? null : table.columnNamed(this.getName());
- }
-
- public Table dbTable() {
- return this.owner.dbTable(this.tableName());
- }
-
- /**
- * Return the name of the column's table.
- */
- protected abstract String tableName();
-
- public boolean isResolved() {
- return this.dbColumn() != null;
- }
-
- @Override
- public Iterator<String> connectedCandidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.connectedCandidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.nameTouches(pos, astRoot)) {
- return this.quotedCandidateNames(filter);
- }
- return null;
- }
-
- private Iterator<String> candidateNames() {
- Table dbTable = this.dbTable();
- return (dbTable != null) ? dbTable.columnNames() : EmptyIterator.<String> instance();
- }
-
- private Iterator<String> candidateNames(Filter<String> filter) {
- return new FilteringIterator<String>(this.candidateNames(), filter);
- }
-
- private Iterator<String> quotedCandidateNames(Filter<String> filter) {
- return StringTools.quote(this.candidateNames(filter));
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedNativeQuery.java
deleted file mode 100644
index e34850a2cd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedNativeQuery.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.CombinationIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.INamedNativeQuery;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Named Native Query</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaNamedNativeQuery()
- * @model kind="class"
- * @generated
- */
-public class JavaNamedNativeQuery extends JavaAbstractQuery
- implements INamedNativeQuery
-{
- /**
- * The default value of the '{@link #getResultClass() <em>Result Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getResultClass()
- * @generated
- * @ordered
- */
- protected static final String RESULT_CLASS_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getResultClass() <em>Result Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getResultClass()
- * @generated
- * @ordered
- */
- protected String resultClass = RESULT_CLASS_EDEFAULT;
-
- /**
- * The default value of the '{@link #getResultSetMapping() <em>Result Set Mapping</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getResultSetMapping()
- * @generated
- * @ordered
- */
- protected static final String RESULT_SET_MAPPING_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getResultSetMapping() <em>Result Set Mapping</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getResultSetMapping()
- * @generated
- * @ordered
- */
- protected String resultSetMapping = RESULT_SET_MAPPING_EDEFAULT;
-
- public static final SimpleDeclarationAnnotationAdapter SINGLE_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.NAMED_NATIVE_QUERY);
-
- public static final SimpleDeclarationAnnotationAdapter MULTIPLE_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.NAMED_NATIVE_QUERIES);
-
- private final AnnotationElementAdapter<String> resultClassAdapter;
-
- private final AnnotationElementAdapter<String> resultSetMappingAdapter;
-
- protected JavaNamedNativeQuery() {
- throw new UnsupportedOperationException("Use JavaNamedNativeQuery(Member) instead");
- }
-
- protected JavaNamedNativeQuery(Member member, IndexedDeclarationAnnotationAdapter idaa) {
- super(member, idaa);
- this.resultClassAdapter = this.buildAdapter(resultClassAdapter(idaa));
- this.resultSetMappingAdapter = this.buildAdapter(resultSetMappingAdapter(idaa));
- }
-
- // ********** initialization **********
- protected DeclarationAnnotationElementAdapter<String> resultClassAdapter(DeclarationAnnotationAdapter daa) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JPA.NAMED_NATIVE_QUERY__RESULT_CLASS);
- }
-
- protected DeclarationAnnotationElementAdapter<String> resultSetMappingAdapter(DeclarationAnnotationAdapter daa) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JPA.NAMED_NATIVE_QUERY__RESULT_SET_MAPPING);
- }
-
- @Override
- protected String nameElementName() {
- return JPA.NAMED_NATIVE_QUERY__NAME;
- }
-
- @Override
- protected String queryElementName() {
- return JPA.NAMED_NATIVE_QUERY__QUERY;
- }
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(INamedNativeQuery.class)) {
- case JpaCoreMappingsPackage.INAMED_NATIVE_QUERY__RESULT_CLASS :
- this.resultClassAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaCoreMappingsPackage.INAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
- this.resultSetMappingAdapter.setValue((String) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_NAMED_NATIVE_QUERY;
- }
-
- /**
- * Returns the value of the '<em><b>Result Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Result Class</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Result Class</em>' attribute.
- * @see #setResultClass(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getINamedNativeQuery_ResultClass()
- * @model
- * @generated
- */
- public String getResultClass() {
- return resultClass;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedNativeQuery#getResultClass <em>Result Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Result Class</em>' attribute.
- * @see #getResultClass()
- * @generated
- */
- public void setResultClass(String newResultClass) {
- String oldResultClass = resultClass;
- resultClass = newResultClass;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_NAMED_NATIVE_QUERY__RESULT_CLASS, oldResultClass, resultClass));
- }
-
- /**
- * Returns the value of the '<em><b>Result Set Mapping</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Result Set Mapping</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Result Set Mapping</em>' attribute.
- * @see #setResultSetMapping(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getINamedNativeQuery_ResultSetMapping()
- * @model
- * @generated
- */
- public String getResultSetMapping() {
- return resultSetMapping;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedNativeQuery#getResultSetMapping <em>Result Set Mapping</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Result Set Mapping</em>' attribute.
- * @see #getResultSetMapping()
- * @generated
- */
- public void setResultSetMapping(String newResultSetMapping) {
- String oldResultSetMapping = resultSetMapping;
- resultSetMapping = newResultSetMapping;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING, oldResultSetMapping, resultSetMapping));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_NAMED_NATIVE_QUERY__RESULT_CLASS :
- return getResultClass();
- case JpaJavaMappingsPackage.JAVA_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
- return getResultSetMapping();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_NAMED_NATIVE_QUERY__RESULT_CLASS :
- setResultClass((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
- setResultSetMapping((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_NAMED_NATIVE_QUERY__RESULT_CLASS :
- setResultClass(RESULT_CLASS_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
- setResultSetMapping(RESULT_SET_MAPPING_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_NAMED_NATIVE_QUERY__RESULT_CLASS :
- return RESULT_CLASS_EDEFAULT == null ? resultClass != null : !RESULT_CLASS_EDEFAULT.equals(resultClass);
- case JpaJavaMappingsPackage.JAVA_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
- return RESULT_SET_MAPPING_EDEFAULT == null ? resultSetMapping != null : !RESULT_SET_MAPPING_EDEFAULT.equals(resultSetMapping);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == INamedNativeQuery.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_NAMED_NATIVE_QUERY__RESULT_CLASS :
- return JpaCoreMappingsPackage.INAMED_NATIVE_QUERY__RESULT_CLASS;
- case JpaJavaMappingsPackage.JAVA_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
- return JpaCoreMappingsPackage.INAMED_NATIVE_QUERY__RESULT_SET_MAPPING;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == INamedNativeQuery.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.INAMED_NATIVE_QUERY__RESULT_CLASS :
- return JpaJavaMappingsPackage.JAVA_NAMED_NATIVE_QUERY__RESULT_CLASS;
- case JpaCoreMappingsPackage.INAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
- return JpaJavaMappingsPackage.JAVA_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (resultClass: ");
- result.append(resultClass);
- result.append(", resultSetMapping: ");
- result.append(resultSetMapping);
- result.append(')');
- return result.toString();
- }
-
- @Override
- protected void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- this.setResultClass(this.resultClassAdapter.getValue(astRoot));
- this.setResultSetMapping(this.resultSetMappingAdapter.getValue(astRoot));
- }
-
- @Override
- protected JavaQueryHint createJavaQueryHint(int index) {
- return JavaQueryHint.createNamedNativeQueryQueryHint(this.getDeclarationAnnotationAdapter(), this.getMember(), index);
- }
-
- // ********** static methods **********
- static JavaNamedNativeQuery createJavaNamedNativeQuery(Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaNamedNativeQuery(member, buildAnnotationAdapter(index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildAnnotationAdapter(int index) {
- return new CombinationIndexedDeclarationAnnotationAdapter(SINGLE_DECLARATION_ANNOTATION_ADAPTER, MULTIPLE_DECLARATION_ANNOTATION_ADAPTER, index, JPA.NAMED_NATIVE_QUERY);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedQuery.java
deleted file mode 100644
index e7dd0a260a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNamedQuery.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.jdtutility.CombinationIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.INamedQuery;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Named Query</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaNamedQuery()
- * @model kind="class"
- * @generated
- */
-public class JavaNamedQuery extends JavaAbstractQuery implements INamedQuery
-{
- public static final SimpleDeclarationAnnotationAdapter SINGLE_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.NAMED_QUERY);
-
- public static final SimpleDeclarationAnnotationAdapter MULTIPLE_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.NAMED_QUERIES);
-
- protected JavaNamedQuery() {
- throw new UnsupportedOperationException("Use JavaNamedQuery(Member) instead");
- }
-
- protected JavaNamedQuery(Member member, IndexedDeclarationAnnotationAdapter idaa) {
- super(member, idaa);
- }
-
- @Override
- protected String nameElementName() {
- return JPA.NAMED_QUERY__NAME;
- }
-
- @Override
- protected String queryElementName() {
- return JPA.NAMED_QUERY__QUERY;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_NAMED_QUERY;
- }
-
- @Override
- protected JavaQueryHint createJavaQueryHint(int index) {
- return JavaQueryHint.createNamedQueryQueryHint(this.getDeclarationAnnotationAdapter(), this.getMember(), index);
- }
-
- // ********** static methods **********
- static JavaNamedQuery createJavaNamedQuery(Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaNamedQuery(member, buildAnnotationAdapter(index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildAnnotationAdapter(int index) {
- return new CombinationIndexedDeclarationAnnotationAdapter(SINGLE_DECLARATION_ANNOTATION_ADAPTER, MULTIPLE_DECLARATION_ANNOTATION_ADAPTER, index, JPA.NAMED_QUERY);
- }
-} // JavaNamedQuery
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNullAttributeMapping.java
deleted file mode 100644
index 7aed51fa31..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNullAttributeMapping.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.NullDeclarationAnnotationAdapter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Null Attribute Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaNullAttributeMapping()
- * @model kind="class"
- * @generated
- */
-public class JavaNullAttributeMapping extends JavaAttributeMapping
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = NullDeclarationAnnotationAdapter.instance();
-
- protected JavaNullAttributeMapping() {
- throw new UnsupportedOperationException("Use JavaNullAttributeMapping(Attribute) instead");
- }
-
- public JavaNullAttributeMapping(Attribute attribute) {
- super(attribute);
- }
-
- @Override
- protected DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_NULL_ATTRIBUTE_MAPPING;
- }
-
- public String getKey() {
- return null;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNullTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNullTypeMapping.java
deleted file mode 100644
index aa20d185bd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNullTypeMapping.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.NullDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Null Type Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaNullTypeMapping()
- * @model kind="class"
- * @generated
- */
-public class JavaNullTypeMapping extends JavaTypeMapping
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = NullDeclarationAnnotationAdapter.instance();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected JavaNullTypeMapping() {
- super();
- }
-
- protected JavaNullTypeMapping(Type type) {
- super(type);
- }
-
- @Override
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_NULL_TYPE_MAPPING;
- }
-
- public String getKey() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOneToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOneToMany.java
deleted file mode 100644
index aa37d9634f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOneToMany.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java One To Many</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaOneToMany()
- * @model kind="class"
- * @generated
- */
-public class JavaOneToMany extends JavaMultiRelationshipMapping
- implements IJavaOneToMany
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ONE_TO_MANY);
-
- private static final DeclarationAnnotationElementAdapter<String> TARGET_ENTITY_ADAPTER = buildTargetEntityAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_MANY__TARGET_ENTITY);
-
- private static final DeclarationAnnotationElementAdapter<String[]> CASCADE_ADAPTER = buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_MANY__CASCADE);
-
- private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildEnumAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_MANY__FETCH);
-
- private static final DeclarationAnnotationElementAdapter<String> MAPPED_BY_ADAPTER = buildAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_MANY__MAPPED_BY);
-
- protected JavaOneToMany() {
- throw new UnsupportedOperationException("Use JavaOneToMany(Attribute) instead");
- }
-
- protected JavaOneToMany(Attribute attribute) {
- super(attribute);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_ONE_TO_MANY;
- }
-
- public String getKey() {
- return IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- // ********** JavaRelationshipMappingModelAdapter implementation **********
- @Override
- protected DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> targetEntityAdapter() {
- return TARGET_ENTITY_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String[]> cascadeAdapter() {
- return CASCADE_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> fetchAdapter() {
- return FETCH_ADAPTER;
- }
-
- // ********** JavaMultiRelationshipMappingModelAdapter implementation **********
- @Override
- protected DeclarationAnnotationElementAdapter<String> mappedByAdapter() {
- return MAPPED_BY_ADAPTER;
- }
-
- // ********** INonOwningMapping implementation **********
- public boolean mappedByIsValid(IAttributeMapping mappedByMapping) {
- String mappedByKey = mappedByMapping.getKey();
- return (mappedByKey == IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOneToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOneToOne.java
deleted file mode 100644
index a91635c100..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOneToOne.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.INonOwningMapping;
-import org.eclipse.jpt.core.internal.mappings.IOneToOne;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.utility.internal.Filter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java One To One</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaOneToOne()
- * @model kind="class"
- * @generated
- */
-public class JavaOneToOne extends JavaSingleRelationshipMapping
- implements IJavaOneToOne
-{
- /**
- * The default value of the '{@link #getMappedBy() <em>Mapped By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMappedBy()
- * @generated
- * @ordered
- */
- protected static final String MAPPED_BY_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getMappedBy() <em>Mapped By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMappedBy()
- * @generated
- * @ordered
- */
- protected String mappedBy = MAPPED_BY_EDEFAULT;
-
- private AnnotationElementAdapter<String> mappedByAdapter;
-
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ONE_TO_ONE);
-
- private static final DeclarationAnnotationElementAdapter<String> TARGET_ENTITY_ADAPTER = buildTargetEntityAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__TARGET_ENTITY);
-
- private static final DeclarationAnnotationElementAdapter<String[]> CASCADE_ADAPTER = buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__CASCADE);
-
- private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildEnumAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__FETCH);
-
- private static final DeclarationAnnotationElementAdapter<String> OPTIONAL_ADAPTER = buildOptionalAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__OPTIONAL);
-
- private static final DeclarationAnnotationElementAdapter<String> MAPPED_BY_ADAPTER = buildAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__MAPPED_BY);
-
- protected JavaOneToOne() {
- throw new UnsupportedOperationException("Use JavaOneToOne(Attribute) instead");
- }
-
- protected JavaOneToOne(Attribute attribute) {
- super(attribute);
- this.mappedByAdapter = this.buildAnnotationElementAdapter(MAPPED_BY_ADAPTER);
- }
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(INonOwningMapping.class)) {
- case JpaCoreMappingsPackage.INON_OWNING_MAPPING__MAPPED_BY :
- this.mappedByAdapter.setValue((String) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- // ********** initialization **********
- @Override
- protected DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> targetEntityAdapter() {
- return TARGET_ENTITY_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String[]> cascadeAdapter() {
- return CASCADE_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> fetchAdapter() {
- return FETCH_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> optionalAdapter() {
- return OPTIONAL_ADAPTER;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_ONE_TO_ONE;
- }
-
- /**
- * Returns the value of the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Mapped By</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Mapped By</em>' attribute.
- * @see #setMappedBy(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getINonOwningMapping_MappedBy()
- * @model
- * @generated
- */
- public String getMappedBy() {
- return mappedBy;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToOne#getMappedBy <em>Mapped By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Mapped By</em>' attribute.
- * @see #getMappedBy()
- * @generated
- */
- public void setMappedBy(String newMappedBy) {
- String oldMappedBy = mappedBy;
- mappedBy = newMappedBy;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_ONE_TO_ONE__MAPPED_BY, oldMappedBy, mappedBy));
- }
-
- public boolean mappedByIsValid(IAttributeMapping mappedByMapping) {
- String mappedByKey = mappedByMapping.getKey();
- return (mappedByKey == IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- }
-
- public ITextRange mappedByTextRange() {
- return this.elementTextRange(MAPPED_BY_ADAPTER);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ONE_TO_ONE__MAPPED_BY :
- return getMappedBy();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ONE_TO_ONE__MAPPED_BY :
- setMappedBy((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ONE_TO_ONE__MAPPED_BY :
- setMappedBy(MAPPED_BY_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_ONE_TO_ONE__MAPPED_BY :
- return MAPPED_BY_EDEFAULT == null ? mappedBy != null : !MAPPED_BY_EDEFAULT.equals(mappedBy);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == INonOwningMapping.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_ONE_TO_ONE__MAPPED_BY :
- return JpaCoreMappingsPackage.INON_OWNING_MAPPING__MAPPED_BY;
- default :
- return -1;
- }
- }
- if (baseClass == IOneToOne.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IJavaOneToOne.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == INonOwningMapping.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.INON_OWNING_MAPPING__MAPPED_BY :
- return JpaJavaMappingsPackage.JAVA_ONE_TO_ONE__MAPPED_BY;
- default :
- return -1;
- }
- }
- if (baseClass == IOneToOne.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IJavaOneToOne.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (mappedBy: ");
- result.append(mappedBy);
- result.append(')');
- return result.toString();
- }
-
- public String getKey() {
- return IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- setMappedBy(this.mappedByAdapter.getValue(astRoot));
- }
-
- public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(MAPPED_BY_ADAPTER, pos, astRoot);
- }
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.mappedByTouches(pos, astRoot)) {
- return this.quotedCandidateMappedByAttributeNames(filter);
- }
- return null;
- }
-
- @Override
- public boolean isOverridableAssociationMapping() {
- return true;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOneToOneProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOneToOneProvider.java
deleted file mode 100644
index d6c24a31e6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOneToOneProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.IJpaFactory;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMappingProvider;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-
-/**
- *
- */
-public class JavaOneToOneProvider
- implements IJavaAttributeMappingProvider
-{
-
- // singleton
- private static final JavaOneToOneProvider INSTANCE = new JavaOneToOneProvider();
-
- /**
- * Return the singleton.
- */
- public static IJavaAttributeMappingProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private JavaOneToOneProvider() {
- super();
- }
-
- public String key() {
- return IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- public IJavaAttributeMapping buildMapping(Attribute attribute, IJpaFactory factory) {
- return factory.createJavaOneToOne(attribute);
- }
-
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return JavaOneToOne.DECLARATION_ANNOTATION_ADAPTER;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOverride.java
deleted file mode 100644
index 56c394de6c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOverride.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.content.java.JavaEObject;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.utility.internal.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Override</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaOverride()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class JavaOverride extends JavaEObject implements IOverride
-{
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected String name = NAME_EDEFAULT;
-
- private final Owner owner;
-
- private final Member member;
-
- private final IndexedDeclarationAnnotationAdapter daa;
-
- private final IndexedAnnotationAdapter annotationAdapter;
-
- private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
-
- private final AnnotationElementAdapter<String> nameAdapter;
-
- protected JavaOverride() {
- throw new UnsupportedOperationException("use JavaAttributeOverride(Owner, Member, IndexedDeclarationAnnotationAdapter)");
- }
-
- protected JavaOverride(Owner owner, Member member, IndexedDeclarationAnnotationAdapter daa) {
- super();
- this.owner = owner;
- this.member = member;
- this.daa = daa;
- this.annotationAdapter = new MemberIndexedAnnotationAdapter(member, daa);
- this.nameDeclarationAdapter = ConversionDeclarationAnnotationElementAdapter.forStrings(this.daa, this.nameElementName());
- this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(this.member, this.nameDeclarationAdapter);
- }
-
- protected abstract String nameElementName();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_OVERRIDE;
- }
-
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see #setName(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIOverride_Name()
- * @model
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaOverride#getName <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Name</em>' attribute.
- * @see #getName()
- * @generated
- */
- public void setNameGen(String newName) {
- String oldName = name;
- name = newName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_OVERRIDE__NAME, oldName, name));
- }
-
- public void setName(String newName) {
- setNameGen(newName);
- if (!this.isVirtual()) {
- setNameInJava(newName);
- }
- }
-
- private void setNameInJava(String newName) {
- this.nameAdapter.setValue(newName);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_OVERRIDE__NAME :
- return getName();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_OVERRIDE__NAME :
- setName((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_OVERRIDE__NAME :
- setName(NAME_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_OVERRIDE__NAME :
- return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IOverride.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_OVERRIDE__NAME :
- return JpaCoreMappingsPackage.IOVERRIDE__NAME;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IOverride.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IOVERRIDE__NAME :
- return JpaJavaMappingsPackage.JAVA_OVERRIDE__NAME;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (name: ");
- result.append(name);
- result.append(')');
- return result.toString();
- }
-
- public boolean isVirtual() {
- return getOwner().isVirtual(this);
- }
-
- public Owner getOwner() {
- return this.owner;
- }
-
- protected Member getMember() {
- return this.member;
- }
-
- /**
- * allow owners to verify the annotation
- */
- public Annotation annotation(CompilationUnit astRoot) {
- return this.annotationAdapter.getAnnotation(astRoot);
- }
-
- protected boolean elementTouches(DeclarationAnnotationElementAdapter<?> elementAdapter, int pos, CompilationUnit astRoot) {
- return this.elementTouches(this.member.annotationElementTextRange(elementAdapter, astRoot), pos);
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(this.nameDeclarationAdapter, pos, astRoot);
- }
-
- protected abstract Iterator<String> candidateNames();
-
- private Iterator<String> candidateNames(Filter<String> filter) {
- return new FilteringIterator<String>(this.candidateNames(), filter);
- }
-
- private Iterator<String> quotedCandidateNames(Filter<String> filter) {
- return StringTools.quote(this.candidateNames(filter));
- }
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.nameTouches(pos, astRoot)) {
- return this.quotedCandidateNames(filter);
- }
- return null;
- }
-
- public void updateFromJava(CompilationUnit astRoot) {
- setName(this.nameAdapter.getValue(astRoot));
- }
-
- // ********** persistence model -> java annotations **********
- void moveAnnotation(int newIndex) {
- this.annotationAdapter.moveAnnotation(newIndex);
- }
-
- void newAnnotation() {
- this.annotationAdapter.newMarkerAnnotation();
- }
-
- void removeAnnotation() {
- this.annotationAdapter.removeAnnotation();
- }
-
- public ITextRange validationTextRange() {
- ITextRange textRange = this.member.annotationTextRange(this.daa);
- return (textRange == null) ? getOwner().validationTextRange() : textRange;
- }
-
- protected IndexedDeclarationAnnotationAdapter getDeclarationAnnotationAdapter() {
- return this.daa;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaPrimaryKeyJoinColumn.java
deleted file mode 100644
index e4e0ea166e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaPrimaryKeyJoinColumn.java
+++ /dev/null
@@ -1,478 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.CombinationIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.db.internal.Column;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.utility.internal.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Primary Key Join Column</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaPrimaryKeyJoinColumn()
- * @model kind="class"
- * @generated
- */
-public class JavaPrimaryKeyJoinColumn extends JavaNamedColumn
- implements IPrimaryKeyJoinColumn
-{
- private final IndexedAnnotationAdapter annotationAdapter;
-
- // hold this so we can get the 'referenced column name' text range
- private final DeclarationAnnotationElementAdapter<String> referencedColumnNameDeclarationAdapter;
-
- private final AnnotationElementAdapter<String> referencedColumnNameAdapter;
-
- public static final SimpleDeclarationAnnotationAdapter SINGLE_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.PRIMARY_KEY_JOIN_COLUMN);
-
- public static final SimpleDeclarationAnnotationAdapter MULTIPLE_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.PRIMARY_KEY_JOIN_COLUMNS);
-
- /**
- * The default value of the '{@link #getReferencedColumnName() <em>Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getReferencedColumnName()
- * @generated
- * @ordered
- */
- protected static final String REFERENCED_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedReferencedColumnName() <em>Specified Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedReferencedColumnName()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedReferencedColumnName() <em>Specified Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedReferencedColumnName()
- * @generated
- * @ordered
- */
- protected String specifiedReferencedColumnName = SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultReferencedColumnName() <em>Default Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultReferencedColumnName()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_REFERENCED_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultReferencedColumnName() <em>Default Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultReferencedColumnName()
- * @generated
- * @ordered
- */
- protected String defaultReferencedColumnName = DEFAULT_REFERENCED_COLUMN_NAME_EDEFAULT;
-
- protected JavaPrimaryKeyJoinColumn() {
- throw new UnsupportedOperationException();
- }
-
- protected JavaPrimaryKeyJoinColumn(IAbstractJoinColumn.Owner owner, Member member, IndexedDeclarationAnnotationAdapter daa) {
- super(owner, member, daa);
- this.annotationAdapter = new MemberIndexedAnnotationAdapter(member, daa);
- this.referencedColumnNameDeclarationAdapter = this.buildStringElementAdapter(JPA.PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME);
- this.referencedColumnNameAdapter = this.buildShortCircuitElementAdapter(this.referencedColumnNameDeclarationAdapter);
- }
-
- @Override
- protected String nameElementName() {
- return JPA.PRIMARY_KEY_JOIN_COLUMN__NAME;
- }
-
- @Override
- protected String columnDefinitionElementName() {
- return JPA.PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION;
- }
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IAbstractJoinColumn.class)) {
- case JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- this.referencedColumnNameAdapter.setValue((String) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_PRIMARY_KEY_JOIN_COLUMN;
- }
-
- /**
- * Returns the value of the '<em><b>Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Referenced Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Referenced Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIPrimaryKeyJoinColumn_ReferencedColumnName()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getReferencedColumnName() {
- return (this.specifiedReferencedColumnName == null) ? this.defaultReferencedColumnName : this.specifiedReferencedColumnName;
- }
-
- /**
- * Returns the value of the '<em><b>Specified Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Referenced Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Referenced Column Name</em>' attribute.
- * @see #setSpecifiedReferencedColumnName(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIAbstractJoinColumn_SpecifiedReferencedColumnName()
- * @model
- * @generated
- */
- public String getSpecifiedReferencedColumnName() {
- return specifiedReferencedColumnName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaPrimaryKeyJoinColumn#getSpecifiedReferencedColumnName <em>Specified Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Referenced Column Name</em>' attribute.
- * @see #getSpecifiedReferencedColumnName()
- * @generated
- */
- public void setSpecifiedReferencedColumnName(String newSpecifiedReferencedColumnName) {
- String oldSpecifiedReferencedColumnName = specifiedReferencedColumnName;
- specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME, oldSpecifiedReferencedColumnName, specifiedReferencedColumnName));
- }
-
- /**
- * Returns the value of the '<em><b>Default Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Referenced Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Referenced Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIAbstractJoinColumn_DefaultReferencedColumnName()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultReferencedColumnName() {
- return defaultReferencedColumnName;
- }
-
- protected void setDefaultReferencedColumnName(String newDefaultReferencedColumnName) {
- String oldDefaultReferencedColumnName = this.defaultReferencedColumnName;
- this.defaultReferencedColumnName = newDefaultReferencedColumnName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME, oldDefaultReferencedColumnName, newDefaultReferencedColumnName));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME :
- return getReferencedColumnName();
- case JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- return getSpecifiedReferencedColumnName();
- case JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME :
- return getDefaultReferencedColumnName();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- setSpecifiedReferencedColumnName((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- setSpecifiedReferencedColumnName(SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME :
- return REFERENCED_COLUMN_NAME_EDEFAULT == null ? getReferencedColumnName() != null : !REFERENCED_COLUMN_NAME_EDEFAULT.equals(getReferencedColumnName());
- case JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- return SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT == null ? specifiedReferencedColumnName != null : !SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT.equals(specifiedReferencedColumnName);
- case JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME :
- return DEFAULT_REFERENCED_COLUMN_NAME_EDEFAULT == null ? defaultReferencedColumnName != null : !DEFAULT_REFERENCED_COLUMN_NAME_EDEFAULT.equals(defaultReferencedColumnName);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IAbstractJoinColumn.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME :
- return JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__REFERENCED_COLUMN_NAME;
- case JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- return JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME;
- case JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME :
- return JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME;
- default :
- return -1;
- }
- }
- if (baseClass == IPrimaryKeyJoinColumn.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IAbstractJoinColumn.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__REFERENCED_COLUMN_NAME :
- return JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME;
- case JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- return JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME;
- case JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME :
- return JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME;
- default :
- return -1;
- }
- }
- if (baseClass == IPrimaryKeyJoinColumn.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedReferencedColumnName: ");
- result.append(specifiedReferencedColumnName);
- result.append(", defaultReferencedColumnName: ");
- result.append(defaultReferencedColumnName);
- result.append(')');
- return result.toString();
- }
-
- @Override
- public IAbstractJoinColumn.Owner getOwner() {
- return (IAbstractJoinColumn.Owner) super.getOwner();
- }
-
- @Override
- protected String tableName() {
- return this.getOwner().getTypeMapping().getTableName();
- }
-
- public Column dbReferencedColumn() {
- Table table = this.dbReferencedColumnTable();
- return (table == null) ? null : table.columnNamed(this.getReferencedColumnName());
- }
-
- public Table dbReferencedColumnTable() {
- return getOwner().dbReferencedColumnTable();
- }
-
- public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(this.referencedColumnNameDeclarationAdapter, pos, astRoot);
- }
-
- private Iterator<String> candidateReferencedColumnNames() {
- Table table = this.getOwner().dbReferencedColumnTable();
- return (table != null) ? table.columnNames() : EmptyIterator.<String> instance();
- }
-
- private Iterator<String> candidateReferencedColumnNames(Filter<String> filter) {
- return new FilteringIterator<String>(this.candidateReferencedColumnNames(), filter);
- }
-
- private Iterator<String> quotedCandidateReferencedColumnNames(Filter<String> filter) {
- return StringTools.quote(this.candidateReferencedColumnNames(filter));
- }
-
- @Override
- public Iterator<String> connectedCandidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.connectedCandidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.referencedColumnNameTouches(pos, astRoot)) {
- return this.quotedCandidateReferencedColumnNames(filter);
- }
- return null;
- }
-
- public boolean isReferencedColumnResolved() {
- return dbReferencedColumn() != null;
- }
-
- public ITextRange referencedColumnNameTextRange() {
- return elementTextRange(this.referencedColumnNameDeclarationAdapter);
- }
-
- public void refreshDefaults(DefaultsContext defaultsContext) {
- setDefaultReferencedColumnName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_REFERENCED_COLUMN_NAME_KEY));
- setDefaultName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_NAME_KEY));
- }
-
- /**
- * allow owners to verify the annotation
- */
- public Annotation annotation(CompilationUnit astRoot) {
- return this.annotationAdapter.getAnnotation(astRoot);
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- setSpecifiedReferencedColumnName(this.referencedColumnNameAdapter.getValue(astRoot));
- }
-
- void moveAnnotation(int newIndex) {
- this.annotationAdapter.moveAnnotation(newIndex);
- }
-
- void newAnnotation() {
- this.annotationAdapter.newMarkerAnnotation();
- }
-
- void removeAnnotation() {
- this.annotationAdapter.removeAnnotation();
- }
-
- public boolean isVirtual() {
- return getOwner().isVirtual(this);
- }
-
- // ********** static methods **********
- static JavaPrimaryKeyJoinColumn createSecondaryTableJoinColumn(DeclarationAnnotationAdapter secondaryTableAdapter, IAbstractJoinColumn.Owner owner, Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaPrimaryKeyJoinColumn(owner, member, buildSecondaryTableAnnotationAdapter(secondaryTableAdapter, index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildSecondaryTableAnnotationAdapter(DeclarationAnnotationAdapter secondaryTableAdapter, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(secondaryTableAdapter, JPA.SECONDARY_TABLE__PK_JOIN_COLUMNS, index, JPA.PRIMARY_KEY_JOIN_COLUMN);
- }
-
- static JavaPrimaryKeyJoinColumn createEntityPrimaryKeyJoinColumn(IAbstractJoinColumn.Owner owner, Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaPrimaryKeyJoinColumn(owner, member, buildEntityPrimaryKeyJoinColumnAnnotationAdapter(index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildEntityPrimaryKeyJoinColumnAnnotationAdapter(int index) {
- return new CombinationIndexedDeclarationAnnotationAdapter(SINGLE_DECLARATION_ANNOTATION_ADAPTER, MULTIPLE_DECLARATION_ANNOTATION_ADAPTER, index, JPA.PRIMARY_KEY_JOIN_COLUMN);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaQueryHint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaQueryHint.java
deleted file mode 100644
index 4e445f2bbc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaQueryHint.java
+++ /dev/null
@@ -1,384 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.content.java.JavaEObject;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.mappings.IQueryHint;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Query Hint</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaQueryHint()
- * @model kind="class"
- * @generated
- */
-public class JavaQueryHint extends JavaEObject implements IQueryHint
-{
- private final Member member;
-
- // hold this so we can get the annotation's text range
- private final IndexedDeclarationAnnotationAdapter idaa;
-
- private final IndexedAnnotationAdapter annotationAdapter;
-
- private final AnnotationElementAdapter<String> nameAdapter;
-
- private final AnnotationElementAdapter<String> valueAdapter;
-
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected String name = NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getValue() <em>Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getValue()
- * @generated
- * @ordered
- */
- protected static final String VALUE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getValue() <em>Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getValue()
- * @generated
- * @ordered
- */
- protected String value = VALUE_EDEFAULT;
-
- protected JavaQueryHint() {
- throw new UnsupportedOperationException("Use JavaQueryHint(Member, IndexedDeclarationAnnotationAdapter) instead");
- }
-
- protected JavaQueryHint(Member member, IndexedDeclarationAnnotationAdapter idaa) {
- super();
- this.member = member;
- this.idaa = idaa;
- this.annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
- this.nameAdapter = this.buildAdapter(nameAdapter(idaa));
- this.valueAdapter = this.buildAdapter(valueAdapter(idaa));
- }
-
- // ********** initialization **********
- protected AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new ShortCircuitAnnotationElementAdapter<String>(this.member, daea);
- }
-
- protected DeclarationAnnotationElementAdapter<String> nameAdapter(DeclarationAnnotationAdapter daa) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JPA.QUERY_HINT__NAME);
- }
-
- protected DeclarationAnnotationElementAdapter<String> valueAdapter(DeclarationAnnotationAdapter daa) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JPA.QUERY_HINT__VALUE);
- }
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IQueryHint.class)) {
- case JpaCoreMappingsPackage.IQUERY_HINT__NAME :
- this.nameAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaCoreMappingsPackage.IQUERY_HINT__VALUE :
- this.valueAdapter.setValue((String) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_QUERY_HINT;
- }
-
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see #setName(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIQueryHint_Name()
- * @model
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaQueryHint#getName <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Name</em>' attribute.
- * @see #getName()
- * @generated
- */
- public void setName(String newName) {
- String oldName = name;
- name = newName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_QUERY_HINT__NAME, oldName, name));
- }
-
- /**
- * Returns the value of the '<em><b>Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Value</em>' attribute.
- * @see #setValue(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIQueryHint_Value()
- * @model
- * @generated
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaQueryHint#getValue <em>Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Value</em>' attribute.
- * @see #getValue()
- * @generated
- */
- public void setValue(String newValue) {
- String oldValue = value;
- value = newValue;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_QUERY_HINT__VALUE, oldValue, value));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_QUERY_HINT__NAME :
- return getName();
- case JpaJavaMappingsPackage.JAVA_QUERY_HINT__VALUE :
- return getValue();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_QUERY_HINT__NAME :
- setName((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_QUERY_HINT__VALUE :
- setValue((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_QUERY_HINT__NAME :
- setName(NAME_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_QUERY_HINT__VALUE :
- setValue(VALUE_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_QUERY_HINT__NAME :
- return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
- case JpaJavaMappingsPackage.JAVA_QUERY_HINT__VALUE :
- return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IQueryHint.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_QUERY_HINT__NAME :
- return JpaCoreMappingsPackage.IQUERY_HINT__NAME;
- case JpaJavaMappingsPackage.JAVA_QUERY_HINT__VALUE :
- return JpaCoreMappingsPackage.IQUERY_HINT__VALUE;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IQueryHint.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IQUERY_HINT__NAME :
- return JpaJavaMappingsPackage.JAVA_QUERY_HINT__NAME;
- case JpaCoreMappingsPackage.IQUERY_HINT__VALUE :
- return JpaJavaMappingsPackage.JAVA_QUERY_HINT__VALUE;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (name: ");
- result.append(name);
- result.append(", value: ");
- result.append(value);
- result.append(')');
- return result.toString();
- }
-
- // ********* IJpaSourceObject implementation ***********
- public ITextRange validationTextRange() {
- return this.member.annotationTextRange(this.idaa);
- }
-
- protected void updateFromJava(CompilationUnit astRoot) {
- this.setName(this.nameAdapter.getValue(astRoot));
- this.setValue(this.valueAdapter.getValue(astRoot));
- }
-
- /**
- * allow owners to verify the annotation
- */
- public Annotation annotation(CompilationUnit astRoot) {
- return this.annotationAdapter.getAnnotation(astRoot);
- }
-
- // ********** persistence model -> java annotations **********
- void moveAnnotation(int newIndex) {
- this.annotationAdapter.moveAnnotation(newIndex);
- }
-
- void newAnnotation() {
- this.annotationAdapter.newMarkerAnnotation();
- }
-
- void removeAnnotation() {
- this.annotationAdapter.removeAnnotation();
- }
-
- // ********** static methods **********
- static JavaQueryHint createNamedQueryQueryHint(DeclarationAnnotationAdapter namedQueryAdapter, Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaQueryHint(member, buildNamedQueryQueryHintAnnotationAdapter(namedQueryAdapter, index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildNamedQueryQueryHintAnnotationAdapter(DeclarationAnnotationAdapter namedQueryAdapter, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(namedQueryAdapter, JPA.NAMED_QUERY__HINTS, index, JPA.QUERY_HINT);
- }
-
- static JavaQueryHint createNamedNativeQueryQueryHint(DeclarationAnnotationAdapter namedNativeQueryAdapter, Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaQueryHint(member, buildNamedNativeQueryQueryHintAnnotationAdapter(namedNativeQueryAdapter, index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildNamedNativeQueryQueryHintAnnotationAdapter(DeclarationAnnotationAdapter namedNativeQueryAdapter, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(namedNativeQueryAdapter, JPA.NAMED_NATIVE_QUERY__HINTS, index, JPA.QUERY_HINT);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaRelationshipMapping.java
deleted file mode 100644
index 69b2d15218..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaRelationshipMapping.java
+++ /dev/null
@@ -1,704 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.TypeLiteral;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.EnumArrayDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ExpressionConverter;
-import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleTypeStringExpressionConverter;
-import org.eclipse.jpt.core.internal.jdtutility.StringExpressionConverter;
-import org.eclipse.jpt.core.internal.mappings.ICascade;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.RelationshipMappingTools;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Relationship Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaRelationshipMapping()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class JavaRelationshipMapping extends JavaAttributeMapping
- implements IRelationshipMapping
-{
- private AnnotationElementAdapter<String> targetEntityAdapter;
-
- /**
- * all the relationship mappings have a 'fetch' setting;
- * but the 1:1 and m:1 mappings have a default of EAGER,
- * while the 1:m and m:m mappings have a default of LAZY
- */
- private AnnotationElementAdapter<String> fetchAdapter;
-
- /**
- * The default value of the '{@link #getTargetEntity() <em>Target Entity</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTargetEntity()
- * @generated
- * @ordered
- */
- protected static final String TARGET_ENTITY_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedTargetEntity() <em>Specified Target Entity</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedTargetEntity()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_TARGET_ENTITY_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedTargetEntity() <em>Specified Target Entity</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedTargetEntity()
- * @generated
- * @ordered
- */
- protected String specifiedTargetEntity = SPECIFIED_TARGET_ENTITY_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultTargetEntity() <em>Default Target Entity</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultTargetEntity()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_TARGET_ENTITY_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultTargetEntity() <em>Default Target Entity</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultTargetEntity()
- * @generated
- * @ordered
- */
- protected String defaultTargetEntity = DEFAULT_TARGET_ENTITY_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getResolvedTargetEntity() <em>Resolved Target Entity</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getResolvedTargetEntity()
- * @generated
- * @ordered
- */
- protected IEntity resolvedTargetEntity;
-
- /**
- * The cached value of the '{@link #getCascade() <em>Cascade</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getCascade()
- * @generated
- * @ordered
- */
- protected ICascade cascade;
-
- protected JavaRelationshipMapping() {
- throw new UnsupportedOperationException("Use JavaRelationshipMapping(Attribute) instead");
- }
-
- protected JavaRelationshipMapping(Attribute attribute) {
- super(attribute);
- this.targetEntityAdapter = this.buildAnnotationElementAdapter(this.targetEntityAdapter());
- this.fetchAdapter = this.buildAnnotationElementAdapter(this.fetchAdapter());
- }
-
- protected AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new ShortCircuitAnnotationElementAdapter<String>(this.getAttribute(), daea);
- }
-
- /**
- * return the Java adapter's 'targetEntity' element adapter config
- */
- protected abstract DeclarationAnnotationElementAdapter<String> targetEntityAdapter();
-
- /**
- * return the Java adapter's 'cascade' element adapter config
- */
- protected abstract DeclarationAnnotationElementAdapter<String[]> cascadeAdapter();
-
- /**
- * return the Java adapter's 'fetch' element adapter config
- */
- protected abstract DeclarationAnnotationElementAdapter<String> fetchAdapter();
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IRelationshipMapping.class)) {
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY :
- this.targetEntityAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__CASCADE :
- if (notification.getNewValue() == null && notification.getOldValue() != null) {
- ((JavaCascade) notification.getOldValue()).getCascadeAdapter().setValue(null);
- }
- break;
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_RELATIONSHIP_MAPPING;
- }
-
- /**
- * Returns the value of the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Target Entity</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Target Entity</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIRelationshipMapping_TargetEntity()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getTargetEntity() {
- return (this.getSpecifiedTargetEntity() == null) ? getDefaultTargetEntity() : this.getSpecifiedTargetEntity();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Target Entity</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Target Entity</em>' attribute.
- * @see #setSpecifiedTargetEntity(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIRelationshipMapping_SpecifiedTargetEntity()
- * @model
- * @generated
- */
- public String getSpecifiedTargetEntity() {
- return specifiedTargetEntity;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaRelationshipMapping#getSpecifiedTargetEntity <em>Specified Target Entity</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Target Entity</em>' attribute.
- * @see #getSpecifiedTargetEntity()
- * @generated
- */
- public void setSpecifiedTargetEntity(String newSpecifiedTargetEntity) {
- String oldSpecifiedTargetEntity = specifiedTargetEntity;
- specifiedTargetEntity = newSpecifiedTargetEntity;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY, oldSpecifiedTargetEntity, specifiedTargetEntity));
- }
-
- /**
- * Returns the value of the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Target Entity</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Target Entity</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIRelationshipMapping_DefaultTargetEntity()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultTargetEntity() {
- return defaultTargetEntity;
- }
-
- protected void setDefaultTargetEntity(String newDefaultTargetEntity) {
- String oldDefaultTargetEntity = this.defaultTargetEntity;
- this.defaultTargetEntity = newDefaultTargetEntity;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY, oldDefaultTargetEntity, this.defaultTargetEntity));
- }
-
- /**
- * Returns the value of the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Resolved Target Entity</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Resolved Target Entity</em>' reference.
- * @see #setResolvedTargetEntity(IEntity)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIRelationshipMapping_ResolvedTargetEntity()
- * @model
- * @generated
- */
- public IEntity getResolvedTargetEntity() {
- if (resolvedTargetEntity != null && resolvedTargetEntity.eIsProxy()) {
- InternalEObject oldResolvedTargetEntity = (InternalEObject) resolvedTargetEntity;
- resolvedTargetEntity = (IEntity) eResolveProxy(oldResolvedTargetEntity);
- if (resolvedTargetEntity != oldResolvedTargetEntity) {
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.RESOLVE, JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY, oldResolvedTargetEntity, resolvedTargetEntity));
- }
- }
- return resolvedTargetEntity;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public IEntity basicGetResolvedTargetEntity() {
- return resolvedTargetEntity;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaRelationshipMapping#getResolvedTargetEntity <em>Resolved Target Entity</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Resolved Target Entity</em>' reference.
- * @see #getResolvedTargetEntity()
- * @generated
- */
- public void setResolvedTargetEntity(IEntity newResolvedTargetEntity) {
- IEntity oldResolvedTargetEntity = resolvedTargetEntity;
- resolvedTargetEntity = newResolvedTargetEntity;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY, oldResolvedTargetEntity, resolvedTargetEntity));
- }
-
- /**
- * Returns the value of the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Cascade</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Cascade</em>' containment reference.
- * @see #setCascade(ICascade)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIRelationshipMapping_Cascade()
- * @model containment="true"
- * @generated
- */
- public ICascade getCascade() {
- return cascade;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetCascade(ICascade newCascade, NotificationChain msgs) {
- ICascade oldCascade = cascade;
- cascade = newCascade;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__CASCADE, oldCascade, newCascade);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaRelationshipMapping#getCascade <em>Cascade</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Cascade</em>' containment reference.
- * @see #getCascade()
- * @generated
- */
- public void setCascade(ICascade newCascade) {
- if (newCascade != cascade) {
- NotificationChain msgs = null;
- if (cascade != null)
- msgs = ((InternalEObject) cascade).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__CASCADE, null, msgs);
- if (newCascade != null)
- msgs = ((InternalEObject) newCascade).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__CASCADE, null, msgs);
- msgs = basicSetCascade(newCascade, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__CASCADE, newCascade, newCascade));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__CASCADE :
- return basicSetCascade(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__TARGET_ENTITY :
- return getTargetEntity();
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY :
- return getSpecifiedTargetEntity();
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY :
- return getDefaultTargetEntity();
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY :
- if (resolve)
- return getResolvedTargetEntity();
- return basicGetResolvedTargetEntity();
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__CASCADE :
- return getCascade();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY :
- setSpecifiedTargetEntity((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY :
- setResolvedTargetEntity((IEntity) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__CASCADE :
- setCascade((ICascade) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY :
- setSpecifiedTargetEntity(SPECIFIED_TARGET_ENTITY_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY :
- setResolvedTargetEntity((IEntity) null);
- return;
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__CASCADE :
- setCascade((ICascade) null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__TARGET_ENTITY :
- return TARGET_ENTITY_EDEFAULT == null ? getTargetEntity() != null : !TARGET_ENTITY_EDEFAULT.equals(getTargetEntity());
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY :
- return SPECIFIED_TARGET_ENTITY_EDEFAULT == null ? specifiedTargetEntity != null : !SPECIFIED_TARGET_ENTITY_EDEFAULT.equals(specifiedTargetEntity);
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY :
- return DEFAULT_TARGET_ENTITY_EDEFAULT == null ? defaultTargetEntity != null : !DEFAULT_TARGET_ENTITY_EDEFAULT.equals(defaultTargetEntity);
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY :
- return resolvedTargetEntity != null;
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__CASCADE :
- return cascade != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IRelationshipMapping.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__TARGET_ENTITY :
- return JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__TARGET_ENTITY;
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY :
- return JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY :
- return JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY :
- return JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__CASCADE :
- return JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__CASCADE;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IRelationshipMapping.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__TARGET_ENTITY :
- return JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__TARGET_ENTITY;
- case JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY :
- return JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
- case JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY :
- return JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
- case JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY :
- return JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
- case JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__CASCADE :
- return JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING__CASCADE;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedTargetEntity: ");
- result.append(specifiedTargetEntity);
- result.append(", defaultTargetEntity: ");
- result.append(defaultTargetEntity);
- result.append(')');
- return result.toString();
- }
-
- public String fullyQualifiedTargetEntity(CompilationUnit astRoot) {
- if (getSpecifiedTargetEntity() == null) {
- return getDefaultTargetEntity(); //already fully qualified, or null which is fine
- }
- //not positive this is the right way to handle this
- Expression expression = this.targetEntityAdapter.expression(astRoot);
- if (expression.getNodeType() == ASTNode.TYPE_LITERAL) {
- ITypeBinding resolvedTypeBinding = ((TypeLiteral) expression).getType().resolveBinding();
- if (resolvedTypeBinding != null) {
- return resolvedTypeBinding.getQualifiedName();
- }
- }
- return null;
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- updateDefaultTargetEntityFromJava(astRoot);
- setSpecifiedTargetEntity(this.targetEntityAdapter.getValue(astRoot));
- this.updateFetchFromJava(astRoot);
- if (this.cascade != null) {
- ((JavaCascade) this.cascade).updateFromJava(astRoot);
- }
- else if (cascadeAdapter().expression(getAttribute().modifiedDeclaration(astRoot)) != null) {
- setCascade(createCascade());
- ((JavaCascade) this.cascade).updateFromJava(astRoot);
- }
- }
-
- private void updateDefaultTargetEntityFromJava(CompilationUnit astRoot) {
- ITypeBinding typeBinding = getAttribute().typeBinding(astRoot);
- if (typeBinding != null) {
- setDefaultTargetEntity(javaDefaultTargetEntity(typeBinding));
- }
- else {
- setDefaultTargetEntity(null);
- }
- }
-
- /**
- * delegate to subclasses because there are different 'fetch'
- * defaults across the subclasses
- */
- protected abstract void updateFetchFromJava(CompilationUnit astRoot);
-
- /**
- * the default 'targetEntity' is calculated from the attribute type;
- * return null if the attribute type cannot possibly be an entity
- */
- protected String javaDefaultTargetEntity(ITypeBinding typeBinding) {
- return buildReferenceEntityTypeName(typeBinding);
- }
-
- // // TODO Embeddable???
- public static String buildReferenceEntityTypeName(ITypeBinding typeBinding) {
- if (!typeBinding.isArray()) { // arrays cannot be entities
- return typeBinding.getTypeDeclaration().getQualifiedName();
- }
- return null;
- }
-
- public IEntity getEntity() {
- ITypeMapping typeMapping = typeMapping();
- if (typeMapping instanceof IEntity) {
- return (IEntity) typeMapping;
- }
- return null;
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext) {
- super.refreshDefaults(defaultsContext);
- String targetEntityName = fullyQualifiedTargetEntity(defaultsContext.astRoot());
- if (targetEntityName != null) {
- IPersistentType persistentType = defaultsContext.persistentType(targetEntityName);
- if (persistentType != null) {
- if (persistentType.getMapping() instanceof IEntity) {
- setResolvedTargetEntity((IEntity) persistentType.getMapping());
- return;
- }
- }
- }
- setResolvedTargetEntity(null);
- }
-
- public Iterator<String> allTargetEntityAttributeNames() {
- IEntity targetEntity = this.getResolvedTargetEntity();
- return (targetEntity == null) ? EmptyIterator.<String> instance() : targetEntity.getPersistentType().allAttributeNames();
- }
-
- public Iterator<String> candidateMappedByAttributeNames() {
- return this.allTargetEntityAttributeNames();
- }
-
- protected Iterator<String> candidateMappedByAttributeNames(Filter<String> filter) {
- return new FilteringIterator<String>(this.candidateMappedByAttributeNames(), filter);
- }
-
- protected Iterator<String> quotedCandidateMappedByAttributeNames(Filter<String> filter) {
- return StringTools.quote(this.candidateMappedByAttributeNames(filter));
- }
-
- public ICascade createCascade() {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaCascade(getAttribute(), cascadeAdapter());
- }
-
- // ********** convenience methods **********
- protected AnnotationElementAdapter<String> getFetchAdapter() {
- return this.fetchAdapter;
- }
-
- // ********** static methods **********
- protected static DeclarationAnnotationElementAdapter<String> buildTargetEntityAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- // TODO what about QualifiedType?
- return buildAnnotationElementAdapter(annotationAdapter, elementName, SimpleTypeStringExpressionConverter.instance());
- }
-
- protected static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return buildAnnotationElementAdapter(annotationAdapter, elementName, StringExpressionConverter.instance());
- }
-
- protected static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, false, converter);
- }
-
- protected static DeclarationAnnotationElementAdapter<String> buildEnumAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new EnumDeclarationAnnotationElementAdapter(annotationAdapter, elementName, false);
- }
-
- protected static DeclarationAnnotationElementAdapter<String[]> buildEnumArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new EnumArrayDeclarationAnnotationElementAdapter(annotationAdapter, elementName, false);
- }
-
- public boolean targetEntityIsValid(String targetEntity) {
- return RelationshipMappingTools.targetEntityIsValid(targetEntity);
- }
-
- /**
- * return whether the specified non-array type is one of the container
- * types allowed by the JPA spec
- */
- public static boolean typeNamedIsContainer(String typeName) {
- return CollectionTools.contains(CONTAINER_TYPE_NAMES, typeName);
- }
-
- private static final String[] CONTAINER_TYPE_NAMES = {
- java.util.Collection.class.getName(),
- java.util.Set.class.getName(),
- java.util.List.class.getName(),
- java.util.Map.class.getName()
- };
-} // JavaRelationshipMapping
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSecondaryTable.java
deleted file mode 100644
index 4cac806670..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSecondaryTable.java
+++ /dev/null
@@ -1,557 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.jdtutility.CombinationIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.utility.internal.Filter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Secondary Table</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaSecondaryTable()
- * @model kind="class"
- * @generated
- */
-public class JavaSecondaryTable extends AbstractJavaTable
- implements ISecondaryTable
-{
- /**
- * The cached value of the '{@link #getSpecifiedPrimaryKeyJoinColumns() <em>Specified Primary Key Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPrimaryKeyJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns;
-
- /**
- * The cached value of the '{@link #getDefaultPrimaryKeyJoinColumns() <em>Default Primary Key Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultPrimaryKeyJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns;
-
- private final IndexedAnnotationAdapter annotationAdapter;
-
- protected JavaSecondaryTable() {
- super();
- throw new UnsupportedOperationException("Use JavaSecondaryTable(Owner, Member, int) instead");
- }
-
- public JavaSecondaryTable(Owner owner, Member member, IndexedDeclarationAnnotationAdapter idaa) {
- super(owner, member, idaa);
- this.annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
- this.getDefaultPrimaryKeyJoinColumns().add(this.createPrimaryKeyJoinColumn(0));
- }
-
- /**
- * check for changes to the 'specifiedJoinColumns' and
- * 'specifiedInverseJoinColumns' lists so we can notify the
- * model adapter of any changes;
- * also listen for changes to the 'defaultJoinColumns' and
- * 'defaultInverseJoinColumns' lists so we can spank the developer
- */
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(ISecondaryTable.class)) {
- case JpaCoreMappingsPackage.ISECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- specifiedPKJoinColumnsChanged(notification);
- break;
- default :
- break;
- }
- }
-
- @SuppressWarnings("unchecked")
- void specifiedPKJoinColumnsChanged(Notification notification) {
- switch (notification.getEventType()) {
- case Notification.ADD :
- specifiedPKJoinColumnAdded(notification.getPosition(), (IPrimaryKeyJoinColumn) notification.getNewValue());
- break;
- case Notification.ADD_MANY :
- specifiedPKJoinColumnsAdded(notification.getPosition(), (List<IPrimaryKeyJoinColumn>) notification.getNewValue());
- break;
- case Notification.REMOVE :
- specifiedPKJoinColumnRemoved(notification.getPosition(), (IPrimaryKeyJoinColumn) notification.getOldValue());
- break;
- case Notification.REMOVE_MANY :
- if (notification.getPosition() == Notification.NO_INDEX) {
- specifiedPKJoinColumnsCleared((List<IPrimaryKeyJoinColumn>) notification.getOldValue());
- }
- else {
- // Notification.getNewValue() returns an array of the positions of objects that were removed
- specifiedPKJoinColumnsRemoved((int[]) notification.getNewValue(), (List<IPrimaryKeyJoinColumn>) notification.getOldValue());
- }
- break;
- case Notification.SET :
- if (!notification.isTouch()) {
- specifiedPKJoinColumnSet(notification.getPosition(), (IPrimaryKeyJoinColumn) notification.getOldValue(), (IPrimaryKeyJoinColumn) notification.getNewValue());
- }
- break;
- case Notification.MOVE :
- // Notification.getOldValue() returns the source index
- // Notification.getPositon() returns the target index
- // Notification.getNewValue() returns the moved object
- specifiedPKJoinColumnMoved(notification.getOldIntValue(), notification.getPosition(), (IPrimaryKeyJoinColumn) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_SECONDARY_TABLE;
- }
-
- public EList<IPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- return this.getSpecifiedPrimaryKeyJoinColumns().isEmpty() ? this.getDefaultPrimaryKeyJoinColumns() : this.getSpecifiedPrimaryKeyJoinColumns();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Primary Key Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Primary Key Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Primary Key Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getISecondaryTable_SpecifiedPrimaryKeyJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
- if (specifiedPrimaryKeyJoinColumns == null) {
- specifiedPrimaryKeyJoinColumns = new EObjectContainmentEList<IPrimaryKeyJoinColumn>(IPrimaryKeyJoinColumn.class, this, JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS);
- }
- return specifiedPrimaryKeyJoinColumns;
- }
-
- /**
- * Returns the value of the '<em><b>Default Primary Key Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Primary Key Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Primary Key Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getISecondaryTable_DefaultPrimaryKeyJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns() {
- if (defaultPrimaryKeyJoinColumns == null) {
- defaultPrimaryKeyJoinColumns = new EObjectContainmentEList<IPrimaryKeyJoinColumn>(IPrimaryKeyJoinColumn.class, this, JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS);
- }
- return defaultPrimaryKeyJoinColumns;
- }
-
- public ITypeMapping typeMapping() {
- return (ITypeMapping) eContainer();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS :
- return ((InternalEList<?>) getPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return ((InternalEList<?>) getSpecifiedPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return ((InternalEList<?>) getDefaultPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS :
- return getPrimaryKeyJoinColumns();
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return getSpecifiedPrimaryKeyJoinColumns();
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return getDefaultPrimaryKeyJoinColumns();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- getSpecifiedPrimaryKeyJoinColumns().clear();
- getSpecifiedPrimaryKeyJoinColumns().addAll((Collection<? extends IPrimaryKeyJoinColumn>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- getDefaultPrimaryKeyJoinColumns().clear();
- getDefaultPrimaryKeyJoinColumns().addAll((Collection<? extends IPrimaryKeyJoinColumn>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- getSpecifiedPrimaryKeyJoinColumns().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- getDefaultPrimaryKeyJoinColumns().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS :
- return !getPrimaryKeyJoinColumns().isEmpty();
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return specifiedPrimaryKeyJoinColumns != null && !specifiedPrimaryKeyJoinColumns.isEmpty();
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return defaultPrimaryKeyJoinColumns != null && !defaultPrimaryKeyJoinColumns.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == ISecondaryTable.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.ISECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS;
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.ISECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS;
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.ISECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == ISecondaryTable.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.ISECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.ISECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.ISECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- @Override
- protected void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- this.updateSpecifiedPrimaryKeyJoinColumnsFromJava(astRoot);
- }
-
- /**
- * here we just worry about getting the join column lists the same size;
- * then we delegate to the join columns to synch themselves up
- */
- private void updateSpecifiedPrimaryKeyJoinColumnsFromJava(CompilationUnit astRoot) {
- // synchronize the model join columns with the Java source
- List<IPrimaryKeyJoinColumn> joinColumns = getSpecifiedPrimaryKeyJoinColumns();
- int persSize = joinColumns.size();
- int javaSize = 0;
- boolean allJavaAnnotationsFound = false;
- for (int i = 0; i < persSize; i++) {
- JavaPrimaryKeyJoinColumn joinColumn = (JavaPrimaryKeyJoinColumn) joinColumns.get(i);
- if (joinColumn.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- break; // no need to go any further
- }
- joinColumn.updateFromJava(astRoot);
- javaSize++;
- }
- if (allJavaAnnotationsFound) {
- // remove any model join columns beyond those that correspond to the Java annotations
- while (persSize > javaSize) {
- persSize--;
- joinColumns.remove(persSize);
- }
- }
- else {
- // add new model join columns until they match the Java annotations
- while (!allJavaAnnotationsFound) {
- JavaPrimaryKeyJoinColumn joinColumn = this.createJavaPrimaryKeyJoinColumn(javaSize);
- if (joinColumn.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- }
- else {
- getSpecifiedPrimaryKeyJoinColumns().add(joinColumn);
- joinColumn.updateFromJava(astRoot);
- javaSize++;
- }
- }
- }
- }
-
- /**
- * allow owners to verify the annotation
- */
- public Annotation annotation(CompilationUnit astRoot) {
- return this.annotationAdapter.getAnnotation(astRoot);
- }
-
- @Override
- protected void setDefaultName(String newDefaultName) {
- throw new UnsupportedOperationException("No default name for a secondary table");
- }
-
- // ********** AbstractJavaTable implementation **********
- @Override
- protected DeclarationAnnotationElementAdapter<String> nameAdapter(DeclarationAnnotationAdapter daa) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JPA.SECONDARY_TABLE__NAME);
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> schemaAdapter(DeclarationAnnotationAdapter daa) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JPA.SECONDARY_TABLE__SCHEMA);
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> catalogAdapter(DeclarationAnnotationAdapter daa) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JPA.SECONDARY_TABLE__CATALOG);
- }
-
- public IPrimaryKeyJoinColumn createPrimaryKeyJoinColumn(int index) {
- return this.createJavaPrimaryKeyJoinColumn(index);
- }
-
- private JavaPrimaryKeyJoinColumn createJavaPrimaryKeyJoinColumn(int index) {
- return JavaPrimaryKeyJoinColumn.createSecondaryTableJoinColumn(this.getDeclarationAnnotationAdapter(), buildPkJoinColumnOwner(), this.getMember(), index);
- }
-
- protected IAbstractJoinColumn.Owner buildPkJoinColumnOwner() {
- return new ISecondaryTable.PrimaryKeyJoinColumnOwner(this);
- }
-
- public boolean containsSpecifiedPrimaryKeyJoinColumns() {
- return !this.getSpecifiedPrimaryKeyJoinColumns().isEmpty();
- }
-
- @Override
- protected JavaUniqueConstraint createJavaUniqueConstraint(int index) {
- return JavaUniqueConstraint.createSecondaryTableUniqueConstraint(new UniqueConstraintOwner(this), this.getDeclarationAnnotationAdapter(), getMember(), index);
- }
-
- // ********** persistence model -> java annotations **********
- void moveAnnotation(int newIndex) {
- this.annotationAdapter.moveAnnotation(newIndex);
- }
-
- void newAnnotation() {
- this.annotationAdapter.newMarkerAnnotation();
- }
-
- void removeAnnotation() {
- this.annotationAdapter.removeAnnotation();
- }
-
- // ********** jpa model -> java annotations **********
- /**
- * slide over all the annotations that follow the new join column
- */
- public void specifiedPKJoinColumnAdded(int index, IPrimaryKeyJoinColumn joinColumn) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (((JavaPrimaryKeyJoinColumn) joinColumn).annotation(getMember().astRoot()) == null) {
- this.synchPKJoinColumnAnnotationsAfterAdd(index + 1);
- ((JavaPrimaryKeyJoinColumn) joinColumn).newAnnotation();
- }
- }
-
- // bjv look at this
- public void specifiedPKJoinColumnsAdded(int index, List<IPrimaryKeyJoinColumn> joinColumns) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (!joinColumns.isEmpty() && ((JavaPrimaryKeyJoinColumn) joinColumns.get(0)).annotation(getMember().astRoot()) == null) {
- this.synchPKJoinColumnAnnotationsAfterAdd(index + joinColumns.size());
- for (IPrimaryKeyJoinColumn joinColumn : joinColumns) {
- ((JavaPrimaryKeyJoinColumn) joinColumn).newAnnotation();
- }
- }
- }
-
- public void specifiedPKJoinColumnRemoved(int index, IPrimaryKeyJoinColumn joinColumn) {
- ((JavaPrimaryKeyJoinColumn) joinColumn).removeAnnotation();
- this.synchPKJoinColumnAnnotationsAfterRemove(index);
- }
-
- public void specifiedPKJoinColumnsRemoved(int[] indexes, List<IPrimaryKeyJoinColumn> joinColumns) {
- for (IPrimaryKeyJoinColumn joinColumn : joinColumns) {
- ((JavaPrimaryKeyJoinColumn) joinColumn).removeAnnotation();
- }
- this.synchPKJoinColumnAnnotationsAfterRemove(indexes[0]);
- }
-
- public void specifiedPKJoinColumnsCleared(List<IPrimaryKeyJoinColumn> joinColumns) {
- for (IPrimaryKeyJoinColumn joinColumn : joinColumns) {
- ((JavaPrimaryKeyJoinColumn) joinColumn).removeAnnotation();
- }
- }
-
- public void specifiedPKJoinColumnSet(int index, IPrimaryKeyJoinColumn oldJoinColumn, IPrimaryKeyJoinColumn newJoinColumn) {
- ((JavaPrimaryKeyJoinColumn) newJoinColumn).newAnnotation();
- }
-
- public void specifiedPKJoinColumnMoved(int sourceIndex, int targetIndex, IPrimaryKeyJoinColumn joinColumn) {
- List<IPrimaryKeyJoinColumn> joinColumns = this.getSpecifiedPrimaryKeyJoinColumns();
- int begin = Math.min(sourceIndex, targetIndex);
- int end = Math.max(sourceIndex, targetIndex);
- for (int i = begin; i-- > end;) {
- this.synch(joinColumns.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the end of the list to prevent overlap
- */
- private void synchPKJoinColumnAnnotationsAfterAdd(int index) {
- List<IPrimaryKeyJoinColumn> joinColumns = this.getSpecifiedPrimaryKeyJoinColumns();
- for (int i = joinColumns.size(); i-- > index;) {
- this.synch(joinColumns.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the specified index to prevent overlap
- */
- private void synchPKJoinColumnAnnotationsAfterRemove(int index) {
- List<IPrimaryKeyJoinColumn> joinColumns = this.getSpecifiedPrimaryKeyJoinColumns();
- for (int i = index; i < joinColumns.size(); i++) {
- this.synch(joinColumns.get(i), i);
- }
- }
-
- private void synch(IPrimaryKeyJoinColumn joinColumn, int index) {
- ((JavaPrimaryKeyJoinColumn) joinColumn).moveAnnotation(index);
- }
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (IPrimaryKeyJoinColumn column : this.getPrimaryKeyJoinColumns()) {
- result = ((JavaPrimaryKeyJoinColumn) column).candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- public boolean isVirtual() {
- return false;
- }
-
- // ********** static methods **********
- static JavaSecondaryTable createJavaSecondaryTable(Owner owner, Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaSecondaryTable(owner, member, buildDeclarationAnnotationAdapter(index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildDeclarationAnnotationAdapter(int index) {
- return new CombinationIndexedDeclarationAnnotationAdapter(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES, index);
- }
-} // JavaSecondaryTable
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSequenceGenerator.java
deleted file mode 100644
index 28bce2778d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSequenceGenerator.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Sequence Generator</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaSequenceGenerator()
- * @model kind="class"
- * @generated
- */
-public class JavaSequenceGenerator extends JavaGenerator
- implements ISequenceGenerator
-{
- private final AnnotationElementAdapter<String> sequenceNameAdapter;
-
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.SEQUENCE_GENERATOR);
-
- private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildAdapter(JPA.SEQUENCE_GENERATOR__NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> INITIAL_VALUE_ADAPTER = buildNumberAdapter(JPA.SEQUENCE_GENERATOR__INITIAL_VALUE);
-
- private static final DeclarationAnnotationElementAdapter<String> ALLOCATION_SIZE_ADAPTER = buildNumberAdapter(JPA.SEQUENCE_GENERATOR__ALLOCATION_SIZE);
-
- private static final DeclarationAnnotationElementAdapter<String> SEQUENCE_NAME_ADAPTER = buildAdapter(JPA.SEQUENCE_GENERATOR__SEQUENCE_NAME);
-
- /**
- * The default value of the '{@link #getSequenceName() <em>Sequence Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSequenceName()
- * @generated
- * @ordered
- */
- protected static final String SEQUENCE_NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedSequenceName() <em>Specified Sequence Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSequenceName()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_SEQUENCE_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedSequenceName() <em>Specified Sequence Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSequenceName()
- * @generated
- * @ordered
- */
- protected String specifiedSequenceName = SPECIFIED_SEQUENCE_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultSequenceName() <em>Default Sequence Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultSequenceName()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_SEQUENCE_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultSequenceName() <em>Default Sequence Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultSequenceName()
- * @generated
- * @ordered
- */
- protected String defaultSequenceName = DEFAULT_SEQUENCE_NAME_EDEFAULT;
-
- protected JavaSequenceGenerator() {
- throw new UnsupportedOperationException("Use JavaSequenceGenerator(Member) instead");
- }
-
- protected JavaSequenceGenerator(Member member) {
- super(member);
- this.sequenceNameAdapter = this.buildAdapter(SEQUENCE_NAME_ADAPTER);
- }
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(ISequenceGenerator.class)) {
- case JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME :
- this.sequenceNameAdapter.setValue((String) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- // ********** initialization **********
- @Override
- protected DeclarationAnnotationAdapter annotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> nameAdapter() {
- return NAME_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> initialValueAdapter() {
- return INITIAL_VALUE_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> allocationSizeAdapter() {
- return ALLOCATION_SIZE_ADAPTER;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_SEQUENCE_GENERATOR;
- }
-
- public String getSequenceName() {
- return (this.getSpecifiedSequenceName() == null) ? getDefaultSequenceName() : this.getSpecifiedSequenceName();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Sequence Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Sequence Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Sequence Name</em>' attribute.
- * @see #setSpecifiedSequenceName(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getISequenceGenerator_SpecifiedSequenceName()
- * @model
- * @generated
- */
- public String getSpecifiedSequenceName() {
- return specifiedSequenceName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaSequenceGenerator#getSpecifiedSequenceName <em>Specified Sequence Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Sequence Name</em>' attribute.
- * @see #getSpecifiedSequenceName()
- * @generated
- */
- public void setSpecifiedSequenceName(String newSpecifiedSequenceName) {
- String oldSpecifiedSequenceName = specifiedSequenceName;
- specifiedSequenceName = newSpecifiedSequenceName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME, oldSpecifiedSequenceName, specifiedSequenceName));
- }
-
- /**
- * Returns the value of the '<em><b>Default Sequence Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Sequence Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Sequence Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getISequenceGenerator_DefaultSequenceName()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultSequenceName() {
- return defaultSequenceName;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR__SEQUENCE_NAME :
- return getSequenceName();
- case JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME :
- return getSpecifiedSequenceName();
- case JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME :
- return getDefaultSequenceName();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME :
- setSpecifiedSequenceName((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME :
- setSpecifiedSequenceName(SPECIFIED_SEQUENCE_NAME_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR__SEQUENCE_NAME :
- return SEQUENCE_NAME_EDEFAULT == null ? getSequenceName() != null : !SEQUENCE_NAME_EDEFAULT.equals(getSequenceName());
- case JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME :
- return SPECIFIED_SEQUENCE_NAME_EDEFAULT == null ? specifiedSequenceName != null : !SPECIFIED_SEQUENCE_NAME_EDEFAULT.equals(specifiedSequenceName);
- case JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME :
- return DEFAULT_SEQUENCE_NAME_EDEFAULT == null ? defaultSequenceName != null : !DEFAULT_SEQUENCE_NAME_EDEFAULT.equals(defaultSequenceName);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == ISequenceGenerator.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR__SEQUENCE_NAME :
- return JpaCoreMappingsPackage.ISEQUENCE_GENERATOR__SEQUENCE_NAME;
- case JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME :
- return JpaCoreMappingsPackage.ISEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME;
- case JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME :
- return JpaCoreMappingsPackage.ISEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == ISequenceGenerator.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.ISEQUENCE_GENERATOR__SEQUENCE_NAME :
- return JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR__SEQUENCE_NAME;
- case JpaCoreMappingsPackage.ISEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME :
- return JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME;
- case JpaCoreMappingsPackage.ISEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME :
- return JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedSequenceName: ");
- result.append(specifiedSequenceName);
- result.append(", defaultSequenceName: ");
- result.append(defaultSequenceName);
- result.append(')');
- return result.toString();
- }
-
- // ********** java annotations -> persistence model **********
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- setSpecifiedSequenceName(this.sequenceNameAdapter.getValue(astRoot));
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter<String> buildAdapter(String elementName) {
- return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildNumberAdapter(String elementName) {
- return buildNumberAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
- }
-} // JavaSequenceGenerator
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSingleRelationshipMapping.java
deleted file mode 100644
index 0d325cbe1f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaSingleRelationshipMapping.java
+++ /dev/null
@@ -1,686 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.BooleanStringExpressionConverter;
-import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.utility.internal.Filter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Single Relationship Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaSingleRelationshipMapping()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class JavaSingleRelationshipMapping
- extends JavaRelationshipMapping implements ISingleRelationshipMapping
-{
- /**
- * The default value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getFetch()
- * @generated
- * @ordered
- */
- protected static final DefaultEagerFetchType FETCH_EDEFAULT = DefaultEagerFetchType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getFetch()
- * @generated
- * @ordered
- */
- protected DefaultEagerFetchType fetch = FETCH_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getSpecifiedJoinColumns() <em>Specified Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IJoinColumn> specifiedJoinColumns;
-
- /**
- * The cached value of the '{@link #getDefaultJoinColumns() <em>Default Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IJoinColumn> defaultJoinColumns;
-
- /**
- * The default value of the '{@link #getOptional() <em>Optional</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getOptional()
- * @generated
- * @ordered
- */
- protected static final DefaultTrueBoolean OPTIONAL_EDEFAULT = DefaultTrueBoolean.DEFAULT;
-
- /**
- * The cached value of the '{@link #getOptional() <em>Optional</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getOptional()
- * @generated
- * @ordered
- */
- protected DefaultTrueBoolean optional = OPTIONAL_EDEFAULT;
-
- private AnnotationElementAdapter<String> optionalAdapter;
-
- protected JavaSingleRelationshipMapping() {
- throw new UnsupportedOperationException("Use JavaSingleRelationshipMapping(Attribute) instead");
- }
-
- protected JavaSingleRelationshipMapping(Attribute attribute) {
- super(attribute);
- this.optionalAdapter = this.buildAnnotationElementAdapter(this.optionalAdapter());
- this.getDefaultJoinColumns().add(this.createJoinColumn(new ISingleRelationshipMapping.JoinColumnOwner(this), attribute));
- }
-
- private IJoinColumn createJoinColumn(IJoinColumn.Owner joinColumnOwner, Member member) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaJoinColumn(joinColumnOwner, member);
- }
-
- /**
- * check for changes to the 'specifiedJoinColumns' and
- * 'specifiedInverseJoinColumns' lists so we can notify the
- * model adapter of any changes;
- * also listen for changes to the 'defaultJoinColumns' and
- * 'defaultInverseJoinColumns' lists so we can spank the developer
- */
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(ISingleRelationshipMapping.class)) {
- case JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__OPTIONAL :
- this.optionalAdapter.setValue(((DefaultTrueBoolean) notification.getNewValue()).convertToJavaAnnotationValue());
- break;
- case JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS :
- specifiedJoinColumnsChanged(notification);
- break;
- case JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__FETCH :
- this.getFetchAdapter().setValue(((DefaultEagerFetchType) notification.getNewValue()).convertToJavaAnnotationValue());
- break;
- default :
- break;
- }
- }
-
- @SuppressWarnings("unchecked")
- void specifiedJoinColumnsChanged(Notification notification) {
- switch (notification.getEventType()) {
- case Notification.ADD :
- specifiedJoinColumnAdded(notification.getPosition(), (IJoinColumn) notification.getNewValue());
- break;
- case Notification.ADD_MANY :
- specifiedJoinColumnsAdded(notification.getPosition(), (List<IJoinColumn>) notification.getNewValue());
- break;
- case Notification.REMOVE :
- specifiedJoinColumnRemoved(notification.getPosition(), (IJoinColumn) notification.getOldValue());
- break;
- case Notification.REMOVE_MANY :
- if (notification.getPosition() == Notification.NO_INDEX) {
- specifiedJoinColumnsCleared((List<IJoinColumn>) notification.getOldValue());
- }
- else {
- // Notification.getNewValue() returns an array of the positions of objects that were removed
- specifiedJoinColumnsRemoved((int[]) notification.getNewValue(), (List<IJoinColumn>) notification.getOldValue());
- }
- break;
- case Notification.SET :
- if (!notification.isTouch()) {
- specifiedJoinColumnSet(notification.getPosition(), (IJoinColumn) notification.getOldValue(), (IJoinColumn) notification.getNewValue());
- }
- break;
- case Notification.MOVE :
- // Notification.getOldValue() returns the source index
- // Notification.getPositon() returns the target index
- // Notification.getNewValue() returns the moved object
- specifiedJoinColumnMoved(notification.getOldIntValue(), notification.getPosition(), (IJoinColumn) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- // ********** jpa model -> java annotations **********
- /**
- * slide over all the annotations that follow the new join column
- */
- public void specifiedJoinColumnAdded(int index, IJoinColumn joinColumn) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (((JavaJoinColumn) joinColumn).annotation(getAttribute().astRoot()) == null) {
- this.synchJoinColumnAnnotationsAfterAdd(index + 1);
- ((JavaJoinColumn) joinColumn).newAnnotation();
- }
- }
-
- public void specifiedJoinColumnsAdded(int index, List<IJoinColumn> joinColumns) {
- //JoinColumn was added to persistence model when udating from java, do not need
- //to edit the java in this case. TODO is there a better way to handle this??
- if (!joinColumns.isEmpty() && ((JavaJoinColumn) joinColumns.get(0)).annotation(getAttribute().astRoot()) == null) {
- this.synchJoinColumnAnnotationsAfterAdd(index + joinColumns.size());
- for (Iterator<IJoinColumn> stream = joinColumns.iterator(); stream.hasNext();) {
- JavaJoinColumn joinColumn = (JavaJoinColumn) stream.next();
- joinColumn.newAnnotation();
- }
- }
- }
-
- public void specifiedJoinColumnRemoved(int index, IJoinColumn joinColumn) {
- ((JavaJoinColumn) joinColumn).removeAnnotation();
- this.synchJoinColumnAnnotationsAfterRemove(index);
- }
-
- public void specifiedJoinColumnsRemoved(int[] indexes, List<IJoinColumn> joinColumns) {
- for (Iterator<IJoinColumn> stream = joinColumns.iterator(); stream.hasNext();) {
- JavaJoinColumn joinColumn = (JavaJoinColumn) stream.next();
- joinColumn.removeAnnotation();
- }
- this.synchJoinColumnAnnotationsAfterRemove(indexes[0]);
- }
-
- public void specifiedJoinColumnsCleared(List<IJoinColumn> joinColumns) {
- for (Iterator<IJoinColumn> stream = joinColumns.iterator(); stream.hasNext();) {
- JavaJoinColumn joinColumn = (JavaJoinColumn) stream.next();
- joinColumn.removeAnnotation();
- }
- }
-
- public void specifiedJoinColumnSet(int index, IJoinColumn oldJoinColumn, IJoinColumn newJoinColumn) {
- ((JavaJoinColumn) newJoinColumn).newAnnotation();
- }
-
- public void specifiedJoinColumnMoved(int sourceIndex, int targetIndex, IJoinColumn joinColumn) {
- List<IJoinColumn> joinColumns = getSpecifiedJoinColumns();
- int begin = Math.min(sourceIndex, targetIndex);
- int end = Math.max(sourceIndex, targetIndex);
- for (int i = begin; i-- > end;) {
- this.synch(joinColumns.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the end of the list to prevent overlap
- */
- private void synchJoinColumnAnnotationsAfterAdd(int index) {
- List<IJoinColumn> joinColumns = getSpecifiedJoinColumns();
- for (int i = joinColumns.size(); i-- > index;) {
- this.synch(joinColumns.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the specified index to prevent overlap
- */
- private void synchJoinColumnAnnotationsAfterRemove(int index) {
- List<IJoinColumn> joinColumns = getSpecifiedJoinColumns();
- for (int i = index; i < joinColumns.size(); i++) {
- this.synch(joinColumns.get(i), i);
- }
- }
-
- private void synch(IJoinColumn joinColumn, int index) {
- ((JavaJoinColumn) joinColumn).moveAnnotation(index);
- }
-
- /**
- * return the Java adapter's 'optional' element adapter config
- */
- protected abstract DeclarationAnnotationElementAdapter<String> optionalAdapter();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_SINGLE_RELATIONSHIP_MAPPING;
- }
-
- /**
- * Returns the value of the '<em><b>Fetch</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Fetch</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType
- * @see #setFetch(DefaultEagerFetchType)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getISingleRelationshipMapping_Fetch()
- * @model
- * @generated
- */
- public DefaultEagerFetchType getFetch() {
- return fetch;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaSingleRelationshipMapping#getFetch <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType
- * @see #getFetch()
- * @generated
- */
- public void setFetch(DefaultEagerFetchType newFetch) {
- DefaultEagerFetchType oldFetch = fetch;
- fetch = newFetch == null ? FETCH_EDEFAULT : newFetch;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__FETCH, oldFetch, fetch));
- }
-
- public EList<IJoinColumn> getJoinColumns() {
- return this.getSpecifiedJoinColumns().isEmpty() ? this.getDefaultJoinColumns() : this.getSpecifiedJoinColumns();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getISingleRelationshipMapping_SpecifiedJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IJoinColumn> getSpecifiedJoinColumns() {
- if (specifiedJoinColumns == null) {
- specifiedJoinColumns = new EObjectContainmentEList<IJoinColumn>(IJoinColumn.class, this, JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS);
- }
- return specifiedJoinColumns;
- }
-
- /**
- * Returns the value of the '<em><b>Default Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getISingleRelationshipMapping_DefaultJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IJoinColumn> getDefaultJoinColumns() {
- if (defaultJoinColumns == null) {
- defaultJoinColumns = new EObjectContainmentEList<IJoinColumn>(IJoinColumn.class, this, JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS);
- }
- return defaultJoinColumns;
- }
-
- /**
- * Returns the value of the '<em><b>Optional</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Optional</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Optional</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setOptional(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getISingleRelationshipMapping_Optional()
- * @model
- * @generated
- */
- public DefaultTrueBoolean getOptional() {
- return optional;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaSingleRelationshipMapping#getOptional <em>Optional</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Optional</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getOptional()
- * @generated
- */
- public void setOptional(DefaultTrueBoolean newOptional) {
- DefaultTrueBoolean oldOptional = optional;
- optional = newOptional == null ? OPTIONAL_EDEFAULT : newOptional;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL, oldOptional, optional));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS :
- return ((InternalEList<?>) getJoinColumns()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS :
- return ((InternalEList<?>) getSpecifiedJoinColumns()).basicRemove(otherEnd, msgs);
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS :
- return ((InternalEList<?>) getDefaultJoinColumns()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__FETCH :
- return getFetch();
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS :
- return getJoinColumns();
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS :
- return getSpecifiedJoinColumns();
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS :
- return getDefaultJoinColumns();
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL :
- return getOptional();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__FETCH :
- setFetch((DefaultEagerFetchType) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS :
- getSpecifiedJoinColumns().clear();
- getSpecifiedJoinColumns().addAll((Collection<? extends IJoinColumn>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS :
- getDefaultJoinColumns().clear();
- getDefaultJoinColumns().addAll((Collection<? extends IJoinColumn>) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL :
- setOptional((DefaultTrueBoolean) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__FETCH :
- setFetch(FETCH_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS :
- getSpecifiedJoinColumns().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS :
- getDefaultJoinColumns().clear();
- return;
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL :
- setOptional(OPTIONAL_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__FETCH :
- return fetch != FETCH_EDEFAULT;
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS :
- return !getJoinColumns().isEmpty();
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS :
- return specifiedJoinColumns != null && !specifiedJoinColumns.isEmpty();
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS :
- return defaultJoinColumns != null && !defaultJoinColumns.isEmpty();
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL :
- return optional != OPTIONAL_EDEFAULT;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == ISingleRelationshipMapping.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__FETCH :
- return JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__FETCH;
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS :
- return JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS;
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS;
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS;
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL :
- return JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__OPTIONAL;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == ISingleRelationshipMapping.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__FETCH :
- return JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__FETCH;
- case JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS;
- case JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS :
- return JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__OPTIONAL :
- return JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (fetch: ");
- result.append(fetch);
- result.append(", optional: ");
- result.append(optional);
- result.append(')');
- return result.toString();
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- this.updateFetchFromJava(astRoot);
- this.updateSpecifiedJoinColumnsFromJava(astRoot);
- this.setOptional(DefaultTrueBoolean.fromJavaAnnotationValue(this.optionalAdapter.getValue(astRoot)));
- }
-
- /**
- * here we just worry about getting the join column lists the same size;
- * then we delegate to the join columns to synch themselves up
- */
- private void updateSpecifiedJoinColumnsFromJava(CompilationUnit astRoot) {
- // synchronize the model join columns with the Java source
- List<IJoinColumn> joinColumns = getSpecifiedJoinColumns();
- int persSize = joinColumns.size();
- int javaSize = 0;
- boolean allJavaAnnotationsFound = false;
- for (int i = 0; i < persSize; i++) {
- JavaJoinColumn joinColumn = (JavaJoinColumn) joinColumns.get(i);
- if (joinColumn.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- break; // no need to go any further
- }
- joinColumn.updateFromJava(astRoot);
- javaSize++;
- }
- if (allJavaAnnotationsFound) {
- // remove any model join columns beyond those that correspond to the Java annotations
- while (persSize > javaSize) {
- persSize--;
- joinColumns.remove(persSize);
- }
- }
- else {
- // add new model join columns until they match the Java annotations
- while (!allJavaAnnotationsFound) {
- JavaJoinColumn joinColumn = this.createJavaJoinColumn(javaSize);
- if (joinColumn.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- }
- else {
- getSpecifiedJoinColumns().add(joinColumn);
- joinColumn.updateFromJava(astRoot);
- javaSize++;
- }
- }
- }
- }
-
- @Override
- protected void updateFetchFromJava(CompilationUnit astRoot) {
- setFetch(DefaultEagerFetchType.fromJavaAnnotationValue(this.getFetchAdapter().getValue(astRoot)));
- }
-
- /**
- * extend to eliminate any "container" types
- */
- @Override
- protected String javaDefaultTargetEntity(ITypeBinding typeBinding) {
- String typeName = super.javaDefaultTargetEntity(typeBinding);
- // if the attribute is a container, don't use it
- return typeNamedIsContainer(typeName) ? null : typeName;
- }
-
- public boolean containsSpecifiedJoinColumns() {
- return !this.getSpecifiedJoinColumns().isEmpty();
- }
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (IJoinColumn column : this.getJoinColumns()) {
- result = ((JavaJoinColumn) column).candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- public IJoinColumn createJoinColumn(int index) {
- return this.createJavaJoinColumn(index);
- }
-
- private JavaJoinColumn createJavaJoinColumn(int index) {
- return JavaJoinColumn.createSingleRelationshipMappingJoinColumn(new JoinColumnOwner(this), this.getAttribute(), index);
- }
-
- // ********** static methods **********
- protected static DeclarationAnnotationElementAdapter<String> buildOptionalAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, false, BooleanStringExpressionConverter.instance());
- }
-} // JavaSingleRelationshipMapping
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTableGenerator.java
deleted file mode 100644
index a18eeea0e3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTableGenerator.java
+++ /dev/null
@@ -1,1350 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Table Generator</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaTableGenerator()
- * @model kind="class"
- * @generated
- */
-public class JavaTableGenerator extends JavaGenerator
- implements ITableGenerator
-{
- private final AnnotationElementAdapter<String> tableAdapter;
-
- private final AnnotationElementAdapter<String> catalogAdapter;
-
- private final AnnotationElementAdapter<String> schemaAdapter;
-
- private final AnnotationElementAdapter<String> pkColumnNameAdapter;
-
- private final AnnotationElementAdapter<String> valueColumnNameAdapter;
-
- private final AnnotationElementAdapter<String> pkColumnValueAdapter;
-
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.TABLE_GENERATOR);
-
- private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> INITIAL_VALUE_ADAPTER = buildNumberAdapter(JPA.TABLE_GENERATOR__INITIAL_VALUE);
-
- private static final DeclarationAnnotationElementAdapter<String> ALLOCATION_SIZE_ADAPTER = buildNumberAdapter(JPA.TABLE_GENERATOR__ALLOCATION_SIZE);
-
- private static final DeclarationAnnotationElementAdapter<String> TABLE_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__TABLE);
-
- private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__CATALOG);
-
- private static final DeclarationAnnotationElementAdapter<String> SCHEMA_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__SCHEMA);
-
- private static final DeclarationAnnotationElementAdapter<String> PK_COLUMN_NAME_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__PK_COLUMN_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> VALUE_COLUMN_NAME_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__VALUE_COLUMN_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> PK_COLUMN_VALUE_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__PK_COLUMN_VALUE);
-
- /**
- * The default value of the '{@link #getTable() <em>Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTable()
- * @generated
- * @ordered
- */
- protected static final String TABLE_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedTable() <em>Specified Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedTable()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_TABLE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedTable() <em>Specified Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedTable()
- * @generated
- * @ordered
- */
- protected String specifiedTable = SPECIFIED_TABLE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultTable() <em>Default Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultTable()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_TABLE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultTable() <em>Default Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultTable()
- * @generated
- * @ordered
- */
- protected String defaultTable = DEFAULT_TABLE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getCatalog()
- * @generated
- * @ordered
- */
- protected static final String CATALOG_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedCatalog() <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedCatalog()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_CATALOG_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedCatalog() <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedCatalog()
- * @generated
- * @ordered
- */
- protected String specifiedCatalog = SPECIFIED_CATALOG_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultCatalog() <em>Default Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultCatalog()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_CATALOG_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultCatalog() <em>Default Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultCatalog()
- * @generated
- * @ordered
- */
- protected String defaultCatalog = DEFAULT_CATALOG_EDEFAULT;
-
- /**
- * The default value of the '{@link #getSchema() <em>Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSchema()
- * @generated
- * @ordered
- */
- protected static final String SCHEMA_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedSchema() <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSchema()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_SCHEMA_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedSchema() <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSchema()
- * @generated
- * @ordered
- */
- protected String specifiedSchema = SPECIFIED_SCHEMA_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultSchema() <em>Default Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultSchema()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_SCHEMA_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultSchema() <em>Default Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultSchema()
- * @generated
- * @ordered
- */
- protected String defaultSchema = DEFAULT_SCHEMA_EDEFAULT;
-
- /**
- * The default value of the '{@link #getPkColumnName() <em>Pk Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPkColumnName()
- * @generated
- * @ordered
- */
- protected static final String PK_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedPkColumnName() <em>Specified Pk Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPkColumnName()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_PK_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedPkColumnName() <em>Specified Pk Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPkColumnName()
- * @generated
- * @ordered
- */
- protected String specifiedPkColumnName = SPECIFIED_PK_COLUMN_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultPkColumnName() <em>Default Pk Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultPkColumnName()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_PK_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultPkColumnName() <em>Default Pk Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultPkColumnName()
- * @generated
- * @ordered
- */
- protected String defaultPkColumnName = DEFAULT_PK_COLUMN_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getValueColumnName() <em>Value Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getValueColumnName()
- * @generated
- * @ordered
- */
- protected static final String VALUE_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedValueColumnName() <em>Specified Value Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedValueColumnName()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_VALUE_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedValueColumnName() <em>Specified Value Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedValueColumnName()
- * @generated
- * @ordered
- */
- protected String specifiedValueColumnName = SPECIFIED_VALUE_COLUMN_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultValueColumnName() <em>Default Value Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultValueColumnName()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_VALUE_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultValueColumnName() <em>Default Value Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultValueColumnName()
- * @generated
- * @ordered
- */
- protected String defaultValueColumnName = DEFAULT_VALUE_COLUMN_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getPkColumnValue() <em>Pk Column Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPkColumnValue()
- * @generated
- * @ordered
- */
- protected static final String PK_COLUMN_VALUE_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedPkColumnValue() <em>Specified Pk Column Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPkColumnValue()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_PK_COLUMN_VALUE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedPkColumnValue() <em>Specified Pk Column Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPkColumnValue()
- * @generated
- * @ordered
- */
- protected String specifiedPkColumnValue = SPECIFIED_PK_COLUMN_VALUE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultPkColumnValue() <em>Default Pk Column Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultPkColumnValue()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_PK_COLUMN_VALUE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultPkColumnValue() <em>Default Pk Column Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultPkColumnValue()
- * @generated
- * @ordered
- */
- protected String defaultPkColumnValue = DEFAULT_PK_COLUMN_VALUE_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getUniqueConstraints() <em>Unique Constraints</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getUniqueConstraints()
- * @generated
- * @ordered
- */
- protected EList<IUniqueConstraint> uniqueConstraints;
-
- protected JavaTableGenerator() {
- throw new UnsupportedOperationException("Use JavaTableGenerator(Member) instead");
- }
-
- protected JavaTableGenerator(Member member) {
- super(member);
- this.tableAdapter = this.buildAdapter(TABLE_ADAPTER);
- this.catalogAdapter = this.buildAdapter(CATALOG_ADAPTER);
- this.schemaAdapter = this.buildAdapter(SCHEMA_ADAPTER);
- this.pkColumnNameAdapter = this.buildAdapter(PK_COLUMN_NAME_ADAPTER);
- this.valueColumnNameAdapter = this.buildAdapter(VALUE_COLUMN_NAME_ADAPTER);
- this.pkColumnValueAdapter = this.buildAdapter(PK_COLUMN_VALUE_ADAPTER);
- }
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(ITableGenerator.class)) {
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_TABLE :
- this.tableAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_CATALOG :
- this.catalogAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_SCHEMA :
- this.schemaAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME :
- this.valueColumnNameAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME :
- this.pkColumnNameAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE :
- this.pkColumnValueAdapter.setValue((String) notification.getNewValue());
- break;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__UNIQUE_CONSTRAINTS :
- uniqueConstraintsChanged(notification);
- break;
- default :
- break;
- }
- }
-
- @SuppressWarnings("unchecked")
- void uniqueConstraintsChanged(Notification notification) {
- switch (notification.getEventType()) {
- case Notification.ADD :
- uniqueConstraintAdded(notification.getPosition(), (IUniqueConstraint) notification.getNewValue());
- break;
- case Notification.ADD_MANY :
- uniqueConstraintsAdded(notification.getPosition(), (List<IUniqueConstraint>) notification.getNewValue());
- break;
- case Notification.REMOVE :
- uniqueConstraintRemoved(notification.getPosition(), (IUniqueConstraint) notification.getOldValue());
- break;
- case Notification.REMOVE_MANY :
- if (notification.getPosition() == Notification.NO_INDEX) {
- uniqueConstraintsCleared((List<IUniqueConstraint>) notification.getOldValue());
- }
- else {
- // Notification.getNewValue() returns an array of the positions of objects that were removed
- uniqueConstraintsRemoved((int[]) notification.getNewValue(), (List<IUniqueConstraint>) notification.getOldValue());
- }
- break;
- case Notification.SET :
- if (!notification.isTouch()) {
- uniqueConstraintSet(notification.getPosition(), (IUniqueConstraint) notification.getOldValue(), (IUniqueConstraint) notification.getNewValue());
- }
- break;
- case Notification.MOVE :
- // Notification.getOldValue() returns the source index
- // Notification.getPositon() returns the target index
- // Notification.getNewValue() returns the moved object
- uniqueConstraintMoved(notification.getOldIntValue(), notification.getPosition(), (IUniqueConstraint) notification.getNewValue());
- break;
- default :
- break;
- }
- }
-
- // ********** initialization **********
- @Override
- protected DeclarationAnnotationAdapter annotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> nameAdapter() {
- return NAME_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> initialValueAdapter() {
- return INITIAL_VALUE_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> allocationSizeAdapter() {
- return ALLOCATION_SIZE_ADAPTER;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_TABLE_GENERATOR;
- }
-
- public String getTable() {
- return (this.getSpecifiedTable() == null) ? getDefaultTable() : this.getSpecifiedTable();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Table</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Table</em>' attribute.
- * @see #setSpecifiedTable(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITableGenerator_SpecifiedTable()
- * @model
- * @generated
- */
- public String getSpecifiedTable() {
- return specifiedTable;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator#getSpecifiedTable <em>Specified Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Table</em>' attribute.
- * @see #getSpecifiedTable()
- * @generated
- */
- public void setSpecifiedTable(String newSpecifiedTable) {
- String oldSpecifiedTable = specifiedTable;
- specifiedTable = newSpecifiedTable;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_TABLE, oldSpecifiedTable, specifiedTable));
- }
-
- /**
- * Returns the value of the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Table</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Table</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITableGenerator_DefaultTable()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultTable() {
- return defaultTable;
- }
-
- public String getCatalog() {
- return (this.getSpecifiedCatalog() == null) ? getDefaultCatalog() : this.getSpecifiedCatalog();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Catalog</em>' attribute.
- * @see #setSpecifiedCatalog(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITableGenerator_SpecifiedCatalog()
- * @model
- * @generated
- */
- public String getSpecifiedCatalog() {
- return specifiedCatalog;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator#getSpecifiedCatalog <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Catalog</em>' attribute.
- * @see #getSpecifiedCatalog()
- * @generated
- */
- public void setSpecifiedCatalog(String newSpecifiedCatalog) {
- String oldSpecifiedCatalog = specifiedCatalog;
- specifiedCatalog = newSpecifiedCatalog;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_CATALOG, oldSpecifiedCatalog, specifiedCatalog));
- }
-
- /**
- * Returns the value of the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Catalog</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITableGenerator_DefaultCatalog()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultCatalog() {
- return defaultCatalog;
- }
-
- public String getSchema() {
- return (this.getSpecifiedSchema() == null) ? getDefaultSchema() : this.getSpecifiedSchema();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Schema</em>' attribute.
- * @see #setSpecifiedSchema(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITableGenerator_SpecifiedSchema()
- * @model
- * @generated
- */
- public String getSpecifiedSchema() {
- return specifiedSchema;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator#getSpecifiedSchema <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Schema</em>' attribute.
- * @see #getSpecifiedSchema()
- * @generated
- */
- public void setSpecifiedSchema(String newSpecifiedSchema) {
- String oldSpecifiedSchema = specifiedSchema;
- specifiedSchema = newSpecifiedSchema;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_SCHEMA, oldSpecifiedSchema, specifiedSchema));
- }
-
- /**
- * Returns the value of the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Schema</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITableGenerator_DefaultSchema()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultSchema() {
- return defaultSchema;
- }
-
- protected void setDefaultSchema(String newDefaultSchema) {
- String oldDefaultSchema = this.defaultSchema;
- this.defaultSchema = newDefaultSchema;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_SCHEMA, oldDefaultSchema, this.defaultSchema));
- }
-
- public String getPkColumnName() {
- return (this.getSpecifiedPkColumnName() == null) ? getDefaultPkColumnName() : this.getSpecifiedPkColumnName();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Pk Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Pk Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Pk Column Name</em>' attribute.
- * @see #setSpecifiedPkColumnName(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITableGenerator_SpecifiedPkColumnName()
- * @model
- * @generated
- */
- public String getSpecifiedPkColumnName() {
- return specifiedPkColumnName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator#getSpecifiedPkColumnName <em>Specified Pk Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Pk Column Name</em>' attribute.
- * @see #getSpecifiedPkColumnName()
- * @generated
- */
- public void setSpecifiedPkColumnName(String newSpecifiedPkColumnName) {
- String oldSpecifiedPkColumnName = specifiedPkColumnName;
- specifiedPkColumnName = newSpecifiedPkColumnName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME, oldSpecifiedPkColumnName, specifiedPkColumnName));
- }
-
- /**
- * Returns the value of the '<em><b>Default Pk Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Pk Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Pk Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITableGenerator_DefaultPkColumnName()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultPkColumnName() {
- return defaultPkColumnName;
- }
-
- public String getValueColumnName() {
- return (this.getSpecifiedValueColumnName() == null) ? getDefaultValueColumnName() : this.getSpecifiedValueColumnName();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Value Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Value Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Value Column Name</em>' attribute.
- * @see #setSpecifiedValueColumnName(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITableGenerator_SpecifiedValueColumnName()
- * @model
- * @generated
- */
- public String getSpecifiedValueColumnName() {
- return specifiedValueColumnName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator#getSpecifiedValueColumnName <em>Specified Value Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Value Column Name</em>' attribute.
- * @see #getSpecifiedValueColumnName()
- * @generated
- */
- public void setSpecifiedValueColumnName(String newSpecifiedValueColumnName) {
- String oldSpecifiedValueColumnName = specifiedValueColumnName;
- specifiedValueColumnName = newSpecifiedValueColumnName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME, oldSpecifiedValueColumnName, specifiedValueColumnName));
- }
-
- /**
- * Returns the value of the '<em><b>Default Value Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Value Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Value Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITableGenerator_DefaultValueColumnName()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultValueColumnName() {
- return defaultValueColumnName;
- }
-
- public String getPkColumnValue() {
- return (this.getSpecifiedPkColumnValue() == null) ? getDefaultPkColumnValue() : this.getSpecifiedPkColumnValue();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Pk Column Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Pk Column Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Pk Column Value</em>' attribute.
- * @see #setSpecifiedPkColumnValue(String)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITableGenerator_SpecifiedPkColumnValue()
- * @model
- * @generated
- */
- public String getSpecifiedPkColumnValue() {
- return specifiedPkColumnValue;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator#getSpecifiedPkColumnValue <em>Specified Pk Column Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Pk Column Value</em>' attribute.
- * @see #getSpecifiedPkColumnValue()
- * @generated
- */
- public void setSpecifiedPkColumnValue(String newSpecifiedPkColumnValue) {
- String oldSpecifiedPkColumnValue = specifiedPkColumnValue;
- specifiedPkColumnValue = newSpecifiedPkColumnValue;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE, oldSpecifiedPkColumnValue, specifiedPkColumnValue));
- }
-
- /**
- * Returns the value of the '<em><b>Default Pk Column Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Pk Column Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Pk Column Value</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITableGenerator_DefaultPkColumnValue()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultPkColumnValue() {
- return defaultPkColumnValue;
- }
-
- /**
- * Returns the value of the '<em><b>Unique Constraints</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IUniqueConstraint}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Unique Constraints</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Unique Constraints</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getITableGenerator_UniqueConstraints()
- * @model containment="true"
- * @generated
- */
- public EList<IUniqueConstraint> getUniqueConstraints() {
- if (uniqueConstraints == null) {
- uniqueConstraints = new EObjectContainmentEList<IUniqueConstraint>(IUniqueConstraint.class, this, JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__UNIQUE_CONSTRAINTS);
- }
- return uniqueConstraints;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__UNIQUE_CONSTRAINTS :
- return ((InternalEList<?>) getUniqueConstraints()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__TABLE :
- return getTable();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_TABLE :
- return getSpecifiedTable();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_TABLE :
- return getDefaultTable();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__CATALOG :
- return getCatalog();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_CATALOG :
- return getSpecifiedCatalog();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_CATALOG :
- return getDefaultCatalog();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SCHEMA :
- return getSchema();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_SCHEMA :
- return getSpecifiedSchema();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_SCHEMA :
- return getDefaultSchema();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__PK_COLUMN_NAME :
- return getPkColumnName();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME :
- return getSpecifiedPkColumnName();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME :
- return getDefaultPkColumnName();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__VALUE_COLUMN_NAME :
- return getValueColumnName();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME :
- return getSpecifiedValueColumnName();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME :
- return getDefaultValueColumnName();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__PK_COLUMN_VALUE :
- return getPkColumnValue();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE :
- return getSpecifiedPkColumnValue();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE :
- return getDefaultPkColumnValue();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__UNIQUE_CONSTRAINTS :
- return getUniqueConstraints();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_TABLE :
- setSpecifiedTable((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_CATALOG :
- setSpecifiedCatalog((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_SCHEMA :
- setSpecifiedSchema((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME :
- setSpecifiedPkColumnName((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME :
- setSpecifiedValueColumnName((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE :
- setSpecifiedPkColumnValue((String) newValue);
- return;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__UNIQUE_CONSTRAINTS :
- getUniqueConstraints().clear();
- getUniqueConstraints().addAll((Collection<? extends IUniqueConstraint>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_TABLE :
- setSpecifiedTable(SPECIFIED_TABLE_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_CATALOG :
- setSpecifiedCatalog(SPECIFIED_CATALOG_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_SCHEMA :
- setSpecifiedSchema(SPECIFIED_SCHEMA_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME :
- setSpecifiedPkColumnName(SPECIFIED_PK_COLUMN_NAME_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME :
- setSpecifiedValueColumnName(SPECIFIED_VALUE_COLUMN_NAME_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE :
- setSpecifiedPkColumnValue(SPECIFIED_PK_COLUMN_VALUE_EDEFAULT);
- return;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__UNIQUE_CONSTRAINTS :
- getUniqueConstraints().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__TABLE :
- return TABLE_EDEFAULT == null ? getTable() != null : !TABLE_EDEFAULT.equals(getTable());
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_TABLE :
- return SPECIFIED_TABLE_EDEFAULT == null ? specifiedTable != null : !SPECIFIED_TABLE_EDEFAULT.equals(specifiedTable);
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_TABLE :
- return DEFAULT_TABLE_EDEFAULT == null ? defaultTable != null : !DEFAULT_TABLE_EDEFAULT.equals(defaultTable);
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__CATALOG :
- return CATALOG_EDEFAULT == null ? getCatalog() != null : !CATALOG_EDEFAULT.equals(getCatalog());
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_CATALOG :
- return SPECIFIED_CATALOG_EDEFAULT == null ? specifiedCatalog != null : !SPECIFIED_CATALOG_EDEFAULT.equals(specifiedCatalog);
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_CATALOG :
- return DEFAULT_CATALOG_EDEFAULT == null ? defaultCatalog != null : !DEFAULT_CATALOG_EDEFAULT.equals(defaultCatalog);
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SCHEMA :
- return SCHEMA_EDEFAULT == null ? getSchema() != null : !SCHEMA_EDEFAULT.equals(getSchema());
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_SCHEMA :
- return SPECIFIED_SCHEMA_EDEFAULT == null ? specifiedSchema != null : !SPECIFIED_SCHEMA_EDEFAULT.equals(specifiedSchema);
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_SCHEMA :
- return DEFAULT_SCHEMA_EDEFAULT == null ? defaultSchema != null : !DEFAULT_SCHEMA_EDEFAULT.equals(defaultSchema);
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__PK_COLUMN_NAME :
- return PK_COLUMN_NAME_EDEFAULT == null ? getPkColumnName() != null : !PK_COLUMN_NAME_EDEFAULT.equals(getPkColumnName());
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME :
- return SPECIFIED_PK_COLUMN_NAME_EDEFAULT == null ? specifiedPkColumnName != null : !SPECIFIED_PK_COLUMN_NAME_EDEFAULT.equals(specifiedPkColumnName);
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME :
- return DEFAULT_PK_COLUMN_NAME_EDEFAULT == null ? defaultPkColumnName != null : !DEFAULT_PK_COLUMN_NAME_EDEFAULT.equals(defaultPkColumnName);
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__VALUE_COLUMN_NAME :
- return VALUE_COLUMN_NAME_EDEFAULT == null ? getValueColumnName() != null : !VALUE_COLUMN_NAME_EDEFAULT.equals(getValueColumnName());
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME :
- return SPECIFIED_VALUE_COLUMN_NAME_EDEFAULT == null ? specifiedValueColumnName != null : !SPECIFIED_VALUE_COLUMN_NAME_EDEFAULT.equals(specifiedValueColumnName);
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME :
- return DEFAULT_VALUE_COLUMN_NAME_EDEFAULT == null ? defaultValueColumnName != null : !DEFAULT_VALUE_COLUMN_NAME_EDEFAULT.equals(defaultValueColumnName);
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__PK_COLUMN_VALUE :
- return PK_COLUMN_VALUE_EDEFAULT == null ? getPkColumnValue() != null : !PK_COLUMN_VALUE_EDEFAULT.equals(getPkColumnValue());
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE :
- return SPECIFIED_PK_COLUMN_VALUE_EDEFAULT == null ? specifiedPkColumnValue != null : !SPECIFIED_PK_COLUMN_VALUE_EDEFAULT.equals(specifiedPkColumnValue);
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE :
- return DEFAULT_PK_COLUMN_VALUE_EDEFAULT == null ? defaultPkColumnValue != null : !DEFAULT_PK_COLUMN_VALUE_EDEFAULT.equals(defaultPkColumnValue);
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__UNIQUE_CONSTRAINTS :
- return uniqueConstraints != null && !uniqueConstraints.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == ITableGenerator.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__TABLE :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__TABLE;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_TABLE :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_TABLE;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_TABLE :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_TABLE;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__CATALOG :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__CATALOG;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_CATALOG :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_CATALOG;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_CATALOG :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_CATALOG;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SCHEMA :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__SCHEMA;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_SCHEMA :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_SCHEMA;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_SCHEMA :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_SCHEMA;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__PK_COLUMN_NAME :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__PK_COLUMN_NAME;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__VALUE_COLUMN_NAME :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__VALUE_COLUMN_NAME;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__PK_COLUMN_VALUE :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__PK_COLUMN_VALUE;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE;
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__UNIQUE_CONSTRAINTS :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__UNIQUE_CONSTRAINTS;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == ITableGenerator.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__TABLE :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__TABLE;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_TABLE :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_TABLE;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_TABLE :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_TABLE;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__CATALOG :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__CATALOG;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_CATALOG :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_CATALOG;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_CATALOG :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_CATALOG;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__SCHEMA :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SCHEMA;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_SCHEMA :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_SCHEMA;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_SCHEMA :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_SCHEMA;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__PK_COLUMN_NAME :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__PK_COLUMN_NAME;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__VALUE_COLUMN_NAME :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__VALUE_COLUMN_NAME;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__PK_COLUMN_VALUE :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__PK_COLUMN_VALUE;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__UNIQUE_CONSTRAINTS :
- return JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__UNIQUE_CONSTRAINTS;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedTable: ");
- result.append(specifiedTable);
- result.append(", defaultTable: ");
- result.append(defaultTable);
- result.append(", specifiedCatalog: ");
- result.append(specifiedCatalog);
- result.append(", defaultCatalog: ");
- result.append(defaultCatalog);
- result.append(", specifiedSchema: ");
- result.append(specifiedSchema);
- result.append(", defaultSchema: ");
- result.append(defaultSchema);
- result.append(", specifiedPkColumnName: ");
- result.append(specifiedPkColumnName);
- result.append(", defaultPkColumnName: ");
- result.append(defaultPkColumnName);
- result.append(", specifiedValueColumnName: ");
- result.append(specifiedValueColumnName);
- result.append(", defaultValueColumnName: ");
- result.append(defaultValueColumnName);
- result.append(", specifiedPkColumnValue: ");
- result.append(specifiedPkColumnValue);
- result.append(", defaultPkColumnValue: ");
- result.append(defaultPkColumnValue);
- result.append(')');
- return result.toString();
- }
-
- // ********** java annotations -> persistence model **********
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- setSpecifiedTable(this.tableAdapter.getValue(astRoot));
- setSpecifiedCatalog(this.catalogAdapter.getValue(astRoot));
- setSpecifiedSchema(this.schemaAdapter.getValue(astRoot));
- setSpecifiedPkColumnName(this.pkColumnNameAdapter.getValue(astRoot));
- setSpecifiedValueColumnName(this.valueColumnNameAdapter.getValue(astRoot));
- setSpecifiedPkColumnValue(this.pkColumnValueAdapter.getValue(astRoot));
- this.updateUniqueConstraintsFromJava(astRoot);
- }
-
- /**
- * here we just worry about getting the unique constraints lists the same size;
- * then we delegate to the unique constraints to synch themselves up
- */
- private void updateUniqueConstraintsFromJava(CompilationUnit astRoot) {
- // synchronize the model join columns with the Java source
- List<IUniqueConstraint> constraints = this.getUniqueConstraints();
- int persSize = constraints.size();
- int javaSize = 0;
- boolean allJavaAnnotationsFound = false;
- for (int i = 0; i < persSize; i++) {
- JavaUniqueConstraint uniqueConstraint = (JavaUniqueConstraint) constraints.get(i);
- if (uniqueConstraint.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- break; // no need to go any further
- }
- uniqueConstraint.updateFromJava(astRoot);
- javaSize++;
- }
- if (allJavaAnnotationsFound) {
- // remove any model join columns beyond those that correspond to the Java annotations
- while (persSize > javaSize) {
- persSize--;
- constraints.remove(persSize);
- }
- }
- else {
- // add new model join columns until they match the Java annotations
- while (!allJavaAnnotationsFound) {
- JavaUniqueConstraint uniqueConstraint = this.createJavaUniqueConstraint(javaSize);
- if (uniqueConstraint.annotation(astRoot) == null) {
- allJavaAnnotationsFound = true;
- }
- else {
- this.getUniqueConstraints().add(uniqueConstraint);
- uniqueConstraint.updateFromJava(astRoot);
- javaSize++;
- }
- }
- }
- }
-
- public void refreshDefaults(DefaultsContext defaultsContext) {
- setDefaultSchema((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_TABLE_GENERATOR_SCHEMA_KEY));
- }
-
- public IUniqueConstraint createUniqueConstraint(int index) {
- return createJavaUniqueConstraint(index);
- }
-
- protected JavaUniqueConstraint createJavaUniqueConstraint(int index) {
- return JavaUniqueConstraint.createTableGeneratorUniqueConstraint(new UniqueConstraintOwner(this), this.getMember(), index);
- }
-
- public Table dbTable() {
- Schema schema = this.dbSchema();
- return (schema == null) ? null : schema.tableNamed(this.getTable());
- }
-
- public Schema dbSchema() {
- return this.database().schemaNamed(this.getSchema());
- }
-
- // ********** jpa model -> java annotations **********
- ////////////////////////////////////////////////////////
- /**
- * slide over all the annotations that follow the new join column
- */
- public void uniqueConstraintAdded(int index, IUniqueConstraint uniqueConstraint) {
- // JoinColumn was added to jpa model when updating from java, do not need
- // to edit the java in this case. TODO is there a better way to handle this??
- if (((JavaUniqueConstraint) uniqueConstraint).annotation(getMember().astRoot()) == null) {
- this.synchUniqueConstraintAnnotationsAfterAdd(index + 1);
- ((JavaUniqueConstraint) uniqueConstraint).newAnnotation();
- }
- }
-
- // bjv look at this
- public void uniqueConstraintsAdded(int index, List<IUniqueConstraint> constraints) {
- // JoinColumn was added to jpa model when updating from java, do not need
- // to edit the java in this case. TODO is there a better way to handle this??
- if (!constraints.isEmpty() && ((JavaUniqueConstraint) constraints.get(0)).annotation(getMember().astRoot()) == null) {
- this.synchUniqueConstraintAnnotationsAfterAdd(index + constraints.size());
- for (IUniqueConstraint uniqueConstraint : constraints) {
- ((JavaUniqueConstraint) uniqueConstraint).newAnnotation();
- }
- }
- }
-
- public void uniqueConstraintRemoved(int index, IUniqueConstraint uniqueConstraint) {
- ((JavaUniqueConstraint) uniqueConstraint).removeAnnotation();
- this.synchUniqueConstraintAnnotationsAfterRemove(index);
- }
-
- public void uniqueConstraintsRemoved(int[] indexes, List<IUniqueConstraint> constraints) {
- for (IUniqueConstraint uniqueConstraint : constraints) {
- ((JavaUniqueConstraint) uniqueConstraint).removeAnnotation();
- }
- this.synchUniqueConstraintAnnotationsAfterRemove(indexes[0]);
- }
-
- public void uniqueConstraintsCleared(List<IUniqueConstraint> constraints) {
- for (IUniqueConstraint uniqueConstraint : constraints) {
- ((JavaUniqueConstraint) uniqueConstraint).removeAnnotation();
- }
- }
-
- public void uniqueConstraintSet(int index, IUniqueConstraint oldUniqueConstraint, IUniqueConstraint newUniqueConstraint) {
- ((JavaUniqueConstraint) newUniqueConstraint).newAnnotation();
- }
-
- public void uniqueConstraintMoved(int sourceIndex, int targetIndex, IUniqueConstraint uniqueConstraint) {
- List<IUniqueConstraint> constraints = this.getUniqueConstraints();
- int begin = Math.min(sourceIndex, targetIndex);
- int end = Math.max(sourceIndex, targetIndex);
- for (int i = begin; i-- > end;) {
- this.synch(constraints.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the end of the list to prevent overlap
- */
- private void synchUniqueConstraintAnnotationsAfterAdd(int index) {
- List<IUniqueConstraint> constraints = this.getUniqueConstraints();
- for (int i = constraints.size(); i-- > index;) {
- this.synch(constraints.get(i), i);
- }
- }
-
- /**
- * synchronize the annotations with the model join columns,
- * starting at the specified index to prevent overlap
- */
- private void synchUniqueConstraintAnnotationsAfterRemove(int index) {
- List<IUniqueConstraint> joinColumns = this.getUniqueConstraints();
- for (int i = index; i < joinColumns.size(); i++) {
- this.synch(joinColumns.get(i), i);
- }
- }
-
- private void synch(IUniqueConstraint uniqueConstraint, int index) {
- ((JavaUniqueConstraint) uniqueConstraint).moveAnnotation(index);
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter<String> buildAdapter(String elementName) {
- return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildNumberAdapter(String elementName) {
- return buildNumberAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
- }
-} // JavaTableGenerator
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTransient.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTransient.java
deleted file mode 100644
index 61c6a14b82..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTransient.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Transient</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaTransient()
- * @model kind="class"
- * @generated
- */
-public class JavaTransient extends JavaAttributeMapping
- implements IJavaTransient
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.TRANSIENT);
-
- protected JavaTransient() {
- throw new UnsupportedOperationException("Use JavaTransient(Attribute) instead");
- }
-
- protected JavaTransient(Attribute attribute) {
- super(attribute);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_TRANSIENT;
- }
-
- @Override
- protected DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- public String getKey() {
- return IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTransientProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTransientProvider.java
deleted file mode 100644
index 4e889a46d8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTransientProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.IJpaFactory;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMappingProvider;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-
-/**
- *
- */
-public class JavaTransientProvider
- implements IJavaAttributeMappingProvider
-{
-
- // singleton
- private static final JavaTransientProvider INSTANCE = new JavaTransientProvider();
-
- /**
- * Return the singleton.
- */
- public static IJavaAttributeMappingProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private JavaTransientProvider() {
- super();
- }
-
- public String key() {
- return IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
- }
-
- public IJavaAttributeMapping buildMapping(Attribute attribute, IJpaFactory factory) {
- return factory.createJavaTransient(attribute);
- }
-
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return JavaTransient.DECLARATION_ANNOTATION_ADAPTER;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTypeMapping.java
deleted file mode 100644
index 9b621657cf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTypeMapping.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.JavaEObject;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Type Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaTypeMapping()
- * @model kind="class" abstract="true"
- * @generated
- */
-//TODO need a way to morph between mapping types to save any information that is
-//comming to the different TypeMappings. For java, we do not know the other types
-//of mappings since they are defined in an extension point so we can do this the same
-//way as xml.
-public abstract class JavaTypeMapping extends JavaEObject
- implements IJavaTypeMapping
-{
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getTableName() <em>Table Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTableName()
- * @generated
- * @ordered
- */
- protected static final String TABLE_NAME_EDEFAULT = null;
-
- private Type type;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected JavaTypeMapping() {
- super();
- }
-
- protected JavaTypeMapping(Type type) {
- super();
- this.type = type;
- }
-
- /**
- * Return the declaration adapter for the mapping's annotation.
- */
- protected abstract DeclarationAnnotationAdapter declarationAnnotationAdapter();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_TYPE_MAPPING;
- }
-
- public String getName() {
- return this.getType().getName();
- }
-
- public String getTableName() {
- return this.getType().getName();
- }
-
- public IPersistentType getPersistentType() {
- return (IPersistentType) this.eContainer();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_TYPE_MAPPING__NAME :
- return getName();
- case JpaJavaMappingsPackage.JAVA_TYPE_MAPPING__TABLE_NAME :
- return getTableName();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_TYPE_MAPPING__NAME :
- return NAME_EDEFAULT == null ? getName() != null : !NAME_EDEFAULT.equals(getName());
- case JpaJavaMappingsPackage.JAVA_TYPE_MAPPING__TABLE_NAME :
- return TABLE_NAME_EDEFAULT == null ? getTableName() != null : !TABLE_NAME_EDEFAULT.equals(getTableName());
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == ITypeMapping.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_TYPE_MAPPING__NAME :
- return JpaCorePackage.ITYPE_MAPPING__NAME;
- case JpaJavaMappingsPackage.JAVA_TYPE_MAPPING__TABLE_NAME :
- return JpaCorePackage.ITYPE_MAPPING__TABLE_NAME;
- default :
- return -1;
- }
- }
- if (baseClass == IJavaTypeMapping.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == ITypeMapping.class) {
- switch (baseFeatureID) {
- case JpaCorePackage.ITYPE_MAPPING__NAME :
- return JpaJavaMappingsPackage.JAVA_TYPE_MAPPING__NAME;
- case JpaCorePackage.ITYPE_MAPPING__TABLE_NAME :
- return JpaJavaMappingsPackage.JAVA_TYPE_MAPPING__TABLE_NAME;
- default :
- return -1;
- }
- }
- if (baseClass == IJavaTypeMapping.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- public void updateFromJava(CompilationUnit astRoot) {
- // do nothing
- }
-
- public Type getType() {
- return this.type;
- }
-
- public ITextRange validationTextRange() {
- ITextRange textRange = this.type.annotationTextRange(this.declarationAnnotationAdapter());
- return (textRange != null) ? textRange : this.getPersistentType().validationTextRange();
- }
-
- public Table primaryDbTable() {
- return null;
- }
-
- public Table dbTable(String tableName) {
- return null;
- }
-
- public Schema dbSchema() {
- return null;
- }
-
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- return true;
- }
-
- public Iterator<ITable> associatedTables() {
- return EmptyIterator.instance();
- }
-
- public Iterator<String> associatedTableNamesIncludingInherited() {
- return EmptyIterator.instance();
- }
-
- public Iterator<ITable> associatedTablesIncludingInherited() {
- return EmptyIterator.instance();
- }
-
- public Iterator<String> overridableAssociationNames() {
- return EmptyIterator.instance();
- }
-
- public Iterator<String> overridableAttributeNames() {
- return EmptyIterator.instance();
- }
-
- public Iterator<String> allOverridableAttributeNames() {
- return EmptyIterator.instance();
- }
-
- public Iterator<String> allOverridableAssociationNames() {
- return EmptyIterator.instance();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaUniqueConstraint.java
deleted file mode 100644
index 51ec6eea66..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaUniqueConstraint.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Collection;
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.util.EDataTypeEList;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.content.java.JavaEObject;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationStringArrayExpressionConverter;
-import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ExpressionConverter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitArrayAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Unique Constraint</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaUniqueConstraint()
- * @model kind="class"
- * @generated
- */
-public class JavaUniqueConstraint extends JavaEObject
- implements IUniqueConstraint
-{
- /**
- * The cached value of the '{@link #getColumnNames() <em>Column Names</em>}' attribute list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getColumnNames()
- * @generated
- * @ordered
- */
- protected EList<String> columnNames;
-
- private final IUniqueConstraint.Owner owner;
-
- private final Member member;
-
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.UNIQUE_CONSTRAINT);
-
- private final IndexedDeclarationAnnotationAdapter idaa;
-
- private final IndexedAnnotationAdapter annotationAdapter;
-
- private final DeclarationAnnotationElementAdapter<String[]> columnNamesDeclarationAdapter;
-
- private final AnnotationElementAdapter<String[]> columnNamesAdapter;
-
- protected JavaUniqueConstraint() {
- super();
- throw new UnsupportedOperationException("Use JavaUniqueConstraint(IUniqueConstraint.Owner, Member, IndexedDeclarationAnnotationAdapter) instead");
- }
-
- protected JavaUniqueConstraint(IUniqueConstraint.Owner owner, Member member, IndexedDeclarationAnnotationAdapter idaa) {
- super();
- this.owner = owner;
- this.member = member;
- this.idaa = idaa;
- this.annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
- this.columnNamesDeclarationAdapter = buildArrayAnnotationElementAdapter(idaa, JPA.UNIQUE_CONSTRAINT__COLUMN_NAMES);
- this.columnNamesAdapter = this.buildAnnotationElementAdapter(this.columnNamesDeclarationAdapter);
- }
-
- protected AnnotationElementAdapter<String[]> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String[]> daea) {
- return new ShortCircuitArrayAnnotationElementAdapter<String>(this.member, daea);
- }
-
- protected static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return buildArrayAnnotationElementAdapter(annotationAdapter, elementName, AnnotationStringArrayExpressionConverter.forStrings());
- }
-
- protected static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String[]> converter) {
- return new ConversionDeclarationAnnotationElementAdapter<String[]>(annotationAdapter, elementName, false, converter);
- }
-
- @Override
- protected void notifyChanged(Notification notification) {
- super.notifyChanged(notification);
- switch (notification.getFeatureID(IUniqueConstraint.class)) {
- case JpaJavaMappingsPackage.JAVA_UNIQUE_CONSTRAINT__COLUMN_NAMES :
- this.columnNamesAdapter.setValue((String[]) getColumnNames().toArray());
- break;
- default :
- break;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_UNIQUE_CONSTRAINT;
- }
-
- /**
- * Returns the value of the '<em><b>Column Names</b></em>' attribute list.
- * The list contents are of type {@link java.lang.String}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column Names</em>' attribute list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column Names</em>' attribute list.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIUniqueConstraint_ColumnNames()
- * @model unique="false"
- * @generated
- */
- public EList<String> getColumnNames() {
- if (columnNames == null) {
- columnNames = new EDataTypeEList<String>(String.class, this, JpaJavaMappingsPackage.JAVA_UNIQUE_CONSTRAINT__COLUMN_NAMES);
- }
- return columnNames;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_UNIQUE_CONSTRAINT__COLUMN_NAMES :
- return getColumnNames();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_UNIQUE_CONSTRAINT__COLUMN_NAMES :
- getColumnNames().clear();
- getColumnNames().addAll((Collection<? extends String>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_UNIQUE_CONSTRAINT__COLUMN_NAMES :
- getColumnNames().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_UNIQUE_CONSTRAINT__COLUMN_NAMES :
- return columnNames != null && !columnNames.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IUniqueConstraint.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_UNIQUE_CONSTRAINT__COLUMN_NAMES :
- return JpaCoreMappingsPackage.IUNIQUE_CONSTRAINT__COLUMN_NAMES;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IUniqueConstraint.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IUNIQUE_CONSTRAINT__COLUMN_NAMES :
- return JpaJavaMappingsPackage.JAVA_UNIQUE_CONSTRAINT__COLUMN_NAMES;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (columnNames: ");
- result.append(columnNames);
- result.append(')');
- return result.toString();
- }
-
- public IUniqueConstraint.Owner getOwner() {
- return this.owner;
- }
-
- public ITextRange validationTextRange() {
- return this.member.annotationTextRange(this.idaa);
- }
-
- protected boolean elementTouches(DeclarationAnnotationElementAdapter<?> elementAdapter, int pos, CompilationUnit astRoot) {
- return this.elementTouches(this.member.annotationElementTextRange(elementAdapter, astRoot), pos);
- }
-
- private boolean columnNamesTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(this.columnNamesDeclarationAdapter, pos, astRoot);
- }
-
- private Iterator<String> candidateColumnNames() {
- return this.getOwner().candidateUniqueConstraintColumnNames();
- }
-
- private Iterator<String> candidateColumnNames(Filter<String> filter) {
- return new FilteringIterator<String>(this.candidateColumnNames(), filter);
- }
-
- private Iterator<String> quotedCandidateColumnNames(Filter<String> filter) {
- return StringTools.quote(this.candidateColumnNames(filter));
- }
-
- @Override
- public Iterator<String> connectedCandidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.connectedCandidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.columnNamesTouches(pos, astRoot)) {
- return this.quotedCandidateColumnNames(filter);
- }
- return null;
- }
-
- /**
- * allow owners to verify the annotation
- */
- public Annotation annotation(CompilationUnit astRoot) {
- return this.annotationAdapter.getAnnotation(astRoot);
- }
-
- public void updateFromJava(CompilationUnit astRoot) {
- updateColumnNamesFromJava(astRoot);
- }
-
- private void updateColumnNamesFromJava(CompilationUnit astRoot) {
- String[] javaColumnNames = this.columnNamesAdapter.getValue(astRoot);
- CollectionTools.retainAll(getColumnNames(), javaColumnNames);
- for (int i = 0; i < javaColumnNames.length; i++) {
- String columnName = javaColumnNames[i];
- if (!getColumnNames().contains(columnName)) {
- getColumnNames().add(columnName);
- }
- }
- }
-
- // ********** persistence model -> java annotations **********
- void moveAnnotation(int newIndex) {
- this.annotationAdapter.moveAnnotation(newIndex);
- }
-
- void newAnnotation() {
- this.annotationAdapter.newMarkerAnnotation();
- }
-
- void removeAnnotation() {
- this.annotationAdapter.removeAnnotation();
- }
-
- // ********** static methods **********
- static JavaUniqueConstraint createSecondaryTableUniqueConstraint(IUniqueConstraint.Owner owner, DeclarationAnnotationAdapter declarationAnnotationAdapter, Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaUniqueConstraint(owner, member, buildSecondaryTableUniqueConstraintAnnotationAdapter(declarationAnnotationAdapter, index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildSecondaryTableUniqueConstraintAnnotationAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(declarationAnnotationAdapter, JPA.SECONDARY_TABLE__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT);
- }
-
- static JavaUniqueConstraint createJoinTableUniqueConstraint(IUniqueConstraint.Owner owner, Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaUniqueConstraint(owner, member, buildJoinTableUniqueConstraintAnnotationAdapter(index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildJoinTableUniqueConstraintAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(JavaJoinTable.DECLARATION_ANNOTATION_ADAPTER, JPA.JOIN_TABLE__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT);
- }
-
- static JavaUniqueConstraint createTableUniqueConstraint(IUniqueConstraint.Owner owner, Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaUniqueConstraint(owner, member, buildTableUniqueConstraintAnnotationAdapter(index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildTableUniqueConstraintAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(JavaTable.DECLARATION_ANNOTATION_ADAPTER, JPA.TABLE__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT);
- }
-
- static JavaUniqueConstraint createTableGeneratorUniqueConstraint(IUniqueConstraint.Owner owner, Member member, int index) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaUniqueConstraint(owner, member, buildTableGeneratorUniqueConstraintAnnotationAdapter(index));
- }
-
- private static IndexedDeclarationAnnotationAdapter buildTableGeneratorUniqueConstraintAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(JavaTableGenerator.DECLARATION_ANNOTATION_ADAPTER, JPA.TABLE_GENERATOR__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaVersion.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaVersion.java
deleted file mode 100644
index 032081dc7c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaVersion.java
+++ /dev/null
@@ -1,408 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-import org.eclipse.jpt.core.internal.mappings.IVersion;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.TemporalType;
-import org.eclipse.jpt.utility.internal.Filter;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Version</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaVersion()
- * @model kind="class"
- * @generated
- */
-public class JavaVersion extends JavaAttributeMapping implements IJavaVersion
-{
- private final AnnotationAdapter temporalAnnotationAdapter;
-
- private final AnnotationElementAdapter<String> temporalValueAdapter;
-
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.VERSION);
-
- private static final DeclarationAnnotationAdapter TEMPORAL_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.TEMPORAL);
-
- private static final DeclarationAnnotationElementAdapter<String> TEMPORAL_VALUE_ADAPTER = buildTemporalValueAdapter();
-
- /**
- * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getColumn()
- * @generated
- * @ordered
- */
- protected IColumn column;
-
- /**
- * The default value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTemporal()
- * @generated
- * @ordered
- */
- protected static final TemporalType TEMPORAL_EDEFAULT = TemporalType.NULL;
-
- /**
- * The cached value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTemporal()
- * @generated
- * @ordered
- */
- protected TemporalType temporal = TEMPORAL_EDEFAULT;
-
- protected JavaVersion() {
- throw new UnsupportedOperationException("Use JavaVersion(Attribute) instead");
- }
-
- protected JavaVersion(Attribute attribute) {
- super(attribute);
- this.column = JavaColumn.createColumnMappingColumn(buildColumnOwner(), getAttribute());
- ((InternalEObject) this.column).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JpaJavaMappingsPackage.JAVA_VERSION__COLUMN, null, null);
- this.temporalAnnotationAdapter = new MemberAnnotationAdapter(this.getAttribute(), TEMPORAL_ADAPTER);
- this.temporalValueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, TEMPORAL_VALUE_ADAPTER);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_VERSION;
- }
-
- /**
- * Returns the value of the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIVersion_Column()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- public IColumn getColumn() {
- return column;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetColumn(IColumn newColumn, NotificationChain msgs) {
- IColumn oldColumn = column;
- column = newColumn;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_VERSION__COLUMN, oldColumn, newColumn);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Returns the value of the '<em><b>Temporal</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.TemporalType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Temporal</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @see #setTemporal(TemporalType)
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIVersion_Temporal()
- * @model
- * @generated
- */
- public TemporalType getTemporal() {
- return temporal;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaVersion#getTemporal <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @see #getTemporal()
- * @generated
- */
- public void setTemporalGen(TemporalType newTemporal) {
- TemporalType oldTemporal = temporal;
- temporal = newTemporal == null ? TEMPORAL_EDEFAULT : newTemporal;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, JpaJavaMappingsPackage.JAVA_VERSION__TEMPORAL, oldTemporal, temporal));
- }
-
- public void setTemporal(TemporalType newTemporal) {
- if (newTemporal != TemporalType.NULL) {
- if (this.temporalAnnotationAdapter.getAnnotation() == null) {
- this.temporalAnnotationAdapter.newMarkerAnnotation();
- }
- this.temporalValueAdapter.setValue(newTemporal.convertToJavaAnnotationValue());
- }
- else if (this.temporalAnnotationAdapter.getAnnotation() != null) {
- this.temporalAnnotationAdapter.removeAnnotation();
- }
- setTemporalGen(newTemporal);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_VERSION__COLUMN :
- return basicSetColumn(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_VERSION__COLUMN :
- return getColumn();
- case JpaJavaMappingsPackage.JAVA_VERSION__TEMPORAL :
- return getTemporal();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_VERSION__TEMPORAL :
- setTemporal((TemporalType) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_VERSION__TEMPORAL :
- setTemporal(TEMPORAL_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case JpaJavaMappingsPackage.JAVA_VERSION__COLUMN :
- return column != null;
- case JpaJavaMappingsPackage.JAVA_VERSION__TEMPORAL :
- return temporal != TEMPORAL_EDEFAULT;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IColumnMapping.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IVersion.class) {
- switch (derivedFeatureID) {
- case JpaJavaMappingsPackage.JAVA_VERSION__COLUMN :
- return JpaCoreMappingsPackage.IVERSION__COLUMN;
- case JpaJavaMappingsPackage.JAVA_VERSION__TEMPORAL :
- return JpaCoreMappingsPackage.IVERSION__TEMPORAL;
- default :
- return -1;
- }
- }
- if (baseClass == IJavaVersion.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IColumnMapping.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IVersion.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IVERSION__COLUMN :
- return JpaJavaMappingsPackage.JAVA_VERSION__COLUMN;
- case JpaCoreMappingsPackage.IVERSION__TEMPORAL :
- return JpaJavaMappingsPackage.JAVA_VERSION__TEMPORAL;
- default :
- return -1;
- }
- }
- if (baseClass == IJavaVersion.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (temporal: ");
- result.append(temporal);
- result.append(')');
- return result.toString();
- }
-
- @Override
- protected DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return DECLARATION_ANNOTATION_ADAPTER;
- }
-
- public String getKey() {
- return IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- public void updateFromJava(CompilationUnit astRoot) {
- super.updateFromJava(astRoot);
- this.updateTemporalFromJava(astRoot);
- this.getJavaColumn().updateFromJava(astRoot);
- }
-
- /*
- * The @Temporal annotation is a bit different than most JPA annotations.
- * For some indecipherable reason it has no default value (e.g. TIMESTAMP).
- * Also, it is *required* for any attribute declared with a type of
- * java.util.Date or java.util.Calendar; otherwise, it is *prohibited*.
- * As a result we allow a Basic mapping to have a null 'temporal',
- * indicating that the annotation is completely missing, as opposed
- * to the annotation being present but its value is invalid (e.g.
- * @Temporal(FRIDAY)).
- *
- * TODO this comment is wrong now, revisit this with Brian at some point
- */
- private void updateTemporalFromJava(CompilationUnit astRoot) {
- if (this.temporalAnnotationAdapter.getAnnotation(astRoot) == null) {
- setTemporalGen(TemporalType.NULL);
- }
- else {
- setTemporalGen(TemporalType.fromJavaAnnotationValue(this.temporalValueAdapter.getValue(astRoot)));
- }
- }
-
- private JavaColumn getJavaColumn() {
- return (JavaColumn) this.column;
- }
-
- @Override
- public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.getJavaColumn().candidateValuesFor(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
- // ********** static methods **********
- private static DeclarationAnnotationElementAdapter<String> buildTemporalValueAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(TEMPORAL_ADAPTER, JPA.TEMPORAL__VALUE, false);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaVersionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaVersionProvider.java
deleted file mode 100644
index 3cd7167846..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaVersionProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.java.mappings;
-
-import org.eclipse.jpt.core.internal.IJpaFactory;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMappingProvider;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-
-/**
- *
- */
-public class JavaVersionProvider
- implements IJavaAttributeMappingProvider
-{
-
- // singleton
- private static final JavaVersionProvider INSTANCE = new JavaVersionProvider();
-
- /**
- * Return the singleton.
- */
- public static IJavaAttributeMappingProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private JavaVersionProvider() {
- super();
- }
-
- public String key() {
- return IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
- }
-
- public IJavaAttributeMapping buildMapping(Attribute attribute, IJpaFactory factory) {
- return factory.createJavaVersion(attribute);
- }
-
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return JavaVersion.DECLARATION_ANNOTATION_ADAPTER;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsFactory.java
deleted file mode 100644
index cd845074d4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsFactory.java
+++ /dev/null
@@ -1,499 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.impl.EFactoryImpl;
-import org.eclipse.emf.ecore.plugin.EcorePlugin;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Member;
-import org.eclipse.jpt.core.internal.jdtutility.NullDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn.Owner;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Factory</b> for the model.
- * It provides a create method for each non-abstract class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage
- * @generated
- */
-public class JpaJavaMappingsFactory extends EFactoryImpl
-{
- /**
- * The singleton instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final JpaJavaMappingsFactory eINSTANCE = init();
-
- /**
- * Creates the default factory implementation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static JpaJavaMappingsFactory init() {
- try {
- JpaJavaMappingsFactory theJpaJavaMappingsFactory = (JpaJavaMappingsFactory) EPackage.Registry.INSTANCE.getEFactory("jpt.core.java.mappings.xmi");
- if (theJpaJavaMappingsFactory != null) {
- return theJpaJavaMappingsFactory;
- }
- }
- catch (Exception exception) {
- EcorePlugin.INSTANCE.log(exception);
- }
- return new JpaJavaMappingsFactory();
- }
-
- /**
- * Creates an instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaJavaMappingsFactory() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public EObject create(EClass eClass) {
- switch (eClass.getClassifierID()) {
- case JpaJavaMappingsPackage.JAVA_ENTITY :
- return createJavaEntity();
- case JpaJavaMappingsPackage.JAVA_MAPPED_SUPERCLASS :
- return createJavaMappedSuperclass();
- case JpaJavaMappingsPackage.JAVA_EMBEDDABLE :
- return createJavaEmbeddable();
- case JpaJavaMappingsPackage.JAVA_NULL_TYPE_MAPPING :
- return createJavaNullTypeMapping();
- case JpaJavaMappingsPackage.JAVA_BASIC :
- return createJavaBasic();
- case JpaJavaMappingsPackage.JAVA_ID :
- return createJavaId();
- case JpaJavaMappingsPackage.JAVA_TRANSIENT :
- return createJavaTransient();
- case JpaJavaMappingsPackage.JAVA_VERSION :
- return createJavaVersion();
- case JpaJavaMappingsPackage.JAVA_EMBEDDED_ID :
- return createJavaEmbeddedId();
- case JpaJavaMappingsPackage.JAVA_EMBEDDED :
- return createJavaEmbedded();
- case JpaJavaMappingsPackage.JAVA_MANY_TO_ONE :
- return createJavaManyToOne();
- case JpaJavaMappingsPackage.JAVA_ONE_TO_ONE :
- return createJavaOneToOne();
- case JpaJavaMappingsPackage.JAVA_ONE_TO_MANY :
- return createJavaOneToMany();
- case JpaJavaMappingsPackage.JAVA_MANY_TO_MANY :
- return createJavaManyToMany();
- case JpaJavaMappingsPackage.JAVA_NULL_ATTRIBUTE_MAPPING :
- return createJavaNullAttributeMapping();
- case JpaJavaMappingsPackage.JAVA_TABLE :
- return createJavaTable();
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE :
- return createJavaSecondaryTable();
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE :
- return createJavaJoinTable();
- case JpaJavaMappingsPackage.JAVA_COLUMN :
- return createJavaColumn();
- case JpaJavaMappingsPackage.JAVA_JOIN_COLUMN :
- return createJavaJoinColumn();
- case JpaJavaMappingsPackage.JAVA_ATTRIBUTE_OVERRIDE :
- return createJavaAttributeOverride();
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE :
- return createJavaAssociationOverride();
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN :
- return createJavaDiscriminatorColumn();
- case JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN :
- return createJavaPrimaryKeyJoinColumn();
- case JpaJavaMappingsPackage.JAVA_GENERATED_VALUE :
- return createJavaGeneratedValue();
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR :
- return createJavaTableGenerator();
- case JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR :
- return createJavaSequenceGenerator();
- case JpaJavaMappingsPackage.JAVA_NAMED_QUERY :
- return createJavaNamedQuery();
- case JpaJavaMappingsPackage.JAVA_NAMED_NATIVE_QUERY :
- return createJavaNamedNativeQuery();
- case JpaJavaMappingsPackage.JAVA_QUERY_HINT :
- return createJavaQueryHint();
- case JpaJavaMappingsPackage.JAVA_UNIQUE_CONSTRAINT :
- return createJavaUniqueConstraint();
- case JpaJavaMappingsPackage.JAVA_CASCADE :
- return createJavaCascade();
- default :
- throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
- }
- }
-
- public JavaEntity createJavaEntity() {
- throw new UnsupportedOperationException("Use createJavaEntity(Type) instead");
- }
-
- public JavaEntity createJavaEntity(Type type) {
- JavaEntity javaEntity = new JavaEntity(type);
- return javaEntity;
- }
-
- public JavaMappedSuperclass createJavaMappedSuperclass() {
- throw new UnsupportedOperationException("Use createJavaMappedSuperclass(Type) instead");
- }
-
- public JavaEmbeddable createJavaEmbeddable() {
- throw new UnsupportedOperationException("Use createJavaEmbeddable(Type) instead");
- }
-
- public JavaEmbeddable createJavaEmbeddable(Type type) {
- JavaEmbeddable javaEmbeddable = new JavaEmbeddable(type);
- return javaEmbeddable;
- }
-
- public JavaMappedSuperclass createJavaMappedSuperclass(Type type) {
- JavaMappedSuperclass javaMappedSuperclass = new JavaMappedSuperclass(type);
- return javaMappedSuperclass;
- }
-
- public JavaNullTypeMapping createJavaNullTypeMapping() {
- throw new UnsupportedOperationException("Use createJavaNullTypeMapping(Type) instead");
- }
-
- public JavaNullTypeMapping createJavaNullTypeMapping(Type type) {
- JavaNullTypeMapping javaNullTypeMapping = new JavaNullTypeMapping(type);
- return javaNullTypeMapping;
- }
-
- public JavaNullAttributeMapping createJavaNullAttributeMapping() {
- throw new UnsupportedOperationException("Use createJavaNullAttributeMapping(Attribute) instead");
- }
-
- public JavaNullAttributeMapping createJavaNullAttributeMapping(Attribute attribute) {
- JavaNullAttributeMapping javaNullAttributeMapping = new JavaNullAttributeMapping(attribute);
- return javaNullAttributeMapping;
- }
-
- public JavaBasic createJavaBasic() {
- throw new UnsupportedOperationException("Use createJavaBasic(Attribute) instead");
- }
-
- public JavaBasic createJavaBasic(Attribute attribute) {
- JavaBasic javaBasic = new JavaBasic(attribute);
- return javaBasic;
- }
-
- public JavaId createJavaId() {
- throw new UnsupportedOperationException("Use createJavaId(Attribute) instead");
- }
-
- public JavaTransient createJavaTransient() {
- throw new UnsupportedOperationException("Use createJavaTransient(Attribute) instead");
- }
-
- public JavaVersion createJavaVersion() {
- throw new UnsupportedOperationException("Use createJavaVersion(Attribute) instead");
- }
-
- public JavaVersion createJavaVersion(Attribute attribute) {
- JavaVersion javaVersion = new JavaVersion(attribute);
- return javaVersion;
- }
-
- public JavaEmbeddedId createJavaEmbeddedId() {
- throw new UnsupportedOperationException("Use createJavaEmbeddedId(Attribute) instead");
- }
-
- public JavaEmbeddedId createJavaEmbeddedId(Attribute attribute) {
- JavaEmbeddedId javaEmbeddedId = new JavaEmbeddedId(attribute);
- return javaEmbeddedId;
- }
-
- public JavaEmbedded createJavaEmbedded() {
- throw new UnsupportedOperationException("Use createJavaEmbedded(Attribute) instead");
- }
-
- public JavaEmbedded createJavaEmbedded(Attribute attribute) {
- JavaEmbedded javaEmbedded = new JavaEmbedded(attribute);
- return javaEmbedded;
- }
-
- public JavaTransient createJavaTransient(Attribute attribute) {
- JavaTransient javaTransient = new JavaTransient(attribute);
- return javaTransient;
- }
-
- public JavaId createJavaId(Attribute attribute) {
- JavaId javaId = new JavaId(attribute);
- return javaId;
- }
-
- public JavaTable createJavaTable() {
- throw new UnsupportedOperationException("Use createJavaTable(ITable.Owner, Member) instead");
- }
-
- public JavaTable createJavaTable(ITable.Owner owner, Member member) {
- JavaTable javaTable = new JavaTable(owner, member);
- return javaTable;
- }
-
- public JavaColumn createJavaColumn() {
- throw new UnsupportedOperationException("Use createJavaColumn(Member ) instead");
- }
-
- public JavaOneToMany createJavaOneToMany() {
- throw new UnsupportedOperationException("Use createJavaOneToMany(Attribute) instead");
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JavaManyToMany createJavaManyToMany() {
- JavaManyToMany javaManyToMany = new JavaManyToMany();
- return javaManyToMany;
- }
-
- public JavaManyToMany createJavaManyToMany(Attribute attribute) {
- JavaManyToMany javaManyToMany = new JavaManyToMany(attribute);
- return javaManyToMany;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JavaJoinTable createJavaJoinTable() {
- JavaJoinTable javaJoinTable = new JavaJoinTable();
- return javaJoinTable;
- }
-
- public JavaJoinTable createJavaJoinTable(ITable.Owner owner, Member member) {
- JavaJoinTable javaJoinTable = new JavaJoinTable(owner, member);
- return javaJoinTable;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JavaJoinColumn createJavaJoinColumn() {
- JavaJoinColumn javaJoinColumn = new JavaJoinColumn();
- return javaJoinColumn;
- }
-
- public JavaAttributeOverride createJavaAttributeOverride() {
- throw new UnsupportedOperationException();
- }
-
- public JavaAttributeOverride createJavaAttributeOverride(IOverride.Owner owner, Member member, IndexedDeclarationAnnotationAdapter idaa) {
- JavaAttributeOverride javaAttributeOverride = new JavaAttributeOverride(owner, member, idaa);
- return javaAttributeOverride;
- }
-
- public JavaAttributeOverride createJavaAttributeOverride(IOverride.Owner owner, Member member) {
- return this.createJavaAttributeOverride(owner, member, NullDeclarationAnnotationAdapter.instance());
- }
-
- public JavaAssociationOverride createJavaAssociationOverride() {
- throw new UnsupportedOperationException();
- }
-
- public JavaAssociationOverride createJavaAssociationOverride(IOverride.Owner owner, Member member, IndexedDeclarationAnnotationAdapter idaa) {
- JavaAssociationOverride javaAssociationOverride = new JavaAssociationOverride(owner, member, idaa);
- return javaAssociationOverride;
- }
-
- public JavaAssociationOverride createJavaAssociationOverride(IOverride.Owner owner, Member member) {
- return this.createJavaAssociationOverride(owner, member, NullDeclarationAnnotationAdapter.instance());
- }
-
- public JavaDiscriminatorColumn createJavaDiscriminatorColumn() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JavaPrimaryKeyJoinColumn createJavaPrimaryKeyJoinColumn() {
- JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn = new JavaPrimaryKeyJoinColumn();
- return javaPrimaryKeyJoinColumn;
- }
-
- public JavaGeneratedValue createJavaGeneratedValue() {
- throw new UnsupportedOperationException("Use createJavaGeneratedValue(Member) instead");
- }
-
- public JavaGeneratedValue createJavaGeneratedValue(Member member) {
- JavaGeneratedValue javaGeneratedValue = new JavaGeneratedValue(member);
- return javaGeneratedValue;
- }
-
- public JavaTableGenerator createJavaTableGenerator() {
- throw new UnsupportedOperationException("Use createJavaTableGenerator(Member) instead");
- }
-
- public JavaTableGenerator createJavaTableGenerator(Member member) {
- JavaTableGenerator javaTableGenerator = new JavaTableGenerator(member);
- return javaTableGenerator;
- }
-
- public JavaSequenceGenerator createJavaSequenceGenerator() {
- throw new UnsupportedOperationException("Use createJavaSequenceGenerator(Member) instead");
- }
-
- public JavaNamedQuery createJavaNamedQuery() {
- throw new UnsupportedOperationException("Use createJavaNamedQuery(Member, IndexedDeclarationAnnotationAdapter) instead");
- }
-
- public JavaNamedQuery createJavaNamedQuery(Member member, IndexedDeclarationAnnotationAdapter idaa) {
- JavaNamedQuery javaNamedQuery = new JavaNamedQuery(member, idaa);
- return javaNamedQuery;
- }
-
- public JavaNamedNativeQuery createJavaNamedNativeQuery() {
- throw new UnsupportedOperationException("Use createJavaNamedNativeQuery(Member, IndexedDeclarationAnnotationAdapter) instead");
- }
-
- public JavaNamedNativeQuery createJavaNamedNativeQuery(Member member, IndexedDeclarationAnnotationAdapter idaa) {
- JavaNamedNativeQuery javaNamedNativeQuery = new JavaNamedNativeQuery(member, idaa);
- return javaNamedNativeQuery;
- }
-
- public JavaQueryHint createJavaQueryHint() {
- throw new UnsupportedOperationException("Use createJavaQueryHint(Member, IndexedDeclarationAnnotationAdapter) instead");
- }
-
- public JavaUniqueConstraint createJavaUniqueConstraint() {
- throw new UnsupportedOperationException("Use createJavaUniqueConstraint(Member, IndexedDeclarationAnnotationAdapter) instead");
- }
-
- public JavaCascade createJavaCascade() {
- throw new UnsupportedOperationException("Use createJavaCascade(Attribute, DeclarationAnnotationElementAdapter) instead");
- }
-
- public JavaCascade createJavaCascade(Attribute attribute, DeclarationAnnotationElementAdapter<String[]> cascadeAdapter) {
- JavaCascade javaCascade = new JavaCascade(attribute, cascadeAdapter);
- return javaCascade;
- }
-
- public JavaUniqueConstraint createJavaUniqueConstraint(IUniqueConstraint.Owner owner, Member member, IndexedDeclarationAnnotationAdapter idaa) {
- JavaUniqueConstraint javaUniqueConstraint = new JavaUniqueConstraint(owner, member, idaa);
- return javaUniqueConstraint;
- }
-
- public JavaQueryHint createJavaQueryHint(Member member, IndexedDeclarationAnnotationAdapter idaa) {
- JavaQueryHint javaQueryHint = new JavaQueryHint(member, idaa);
- return javaQueryHint;
- }
-
- public JavaSequenceGenerator createJavaSequenceGenerator(Member member) {
- JavaSequenceGenerator javaSequenceGenerator = new JavaSequenceGenerator(member);
- return javaSequenceGenerator;
- }
-
- public JavaPrimaryKeyJoinColumn createJavaPrimaryKeyJoinColumn(IAbstractJoinColumn.Owner owner, Member member, IndexedDeclarationAnnotationAdapter idaa) {
- JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn = new JavaPrimaryKeyJoinColumn(owner, member, idaa);
- return javaPrimaryKeyJoinColumn;
- }
-
- public JavaSecondaryTable createJavaSecondaryTable() {
- throw new UnsupportedOperationException();
- }
-
- public JavaSecondaryTable createJavaSecondaryTable(ITable.Owner owner, Member member, IndexedDeclarationAnnotationAdapter idaa) {
- JavaSecondaryTable javaSecondaryTable = new JavaSecondaryTable(owner, member, idaa);
- return javaSecondaryTable;
- }
-
- public JavaDiscriminatorColumn createJavaDiscriminatorColumn(Owner owner, Type type, DeclarationAnnotationAdapter daa) {
- JavaDiscriminatorColumn javaDiscriminatorColumn = new JavaDiscriminatorColumn(owner, type, daa);
- return javaDiscriminatorColumn;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaJavaMappingsPackage getJpaJavaMappingsPackage() {
- return (JpaJavaMappingsPackage) getEPackage();
- }
-
- public JavaJoinColumn createJavaJoinColumn(IJoinColumn.Owner joinColumnOwner, Member member, IndexedDeclarationAnnotationAdapter idaa) {
- JavaJoinColumn javaJoinColumn = new JavaJoinColumn(joinColumnOwner, member, idaa);
- return javaJoinColumn;
- }
-
- public JavaJoinColumn createJavaJoinColumn(IJoinColumn.Owner joinColumnOwner, Member member) {
- return this.createJavaJoinColumn(joinColumnOwner, member, NullDeclarationAnnotationAdapter.instance());
- }
-
- public JavaManyToOne createJavaManyToOne() {
- throw new UnsupportedOperationException("Use createJavaManyToOne(Attribute) instead");
- }
-
- public JavaOneToOne createJavaOneToOne() {
- throw new UnsupportedOperationException("Use createJavaOneToOne(Attribute) instead");
- }
-
- public JavaOneToOne createJavaOneToOne(Attribute attribute) {
- JavaOneToOne javaOneToOne = new JavaOneToOne(attribute);
- return javaOneToOne;
- }
-
- public JavaManyToOne createJavaManyToOne(Attribute attribute) {
- JavaManyToOne javaManyToOne = new JavaManyToOne(attribute);
- return javaManyToOne;
- }
-
- public JavaOneToMany createJavaOneToMany(Attribute attribute) {
- JavaOneToMany javaOneToMany = new JavaOneToMany(attribute);
- return javaOneToMany;
- }
-
- public JavaColumn createJavaColumn(IColumn.Owner owner, Member member, DeclarationAnnotationAdapter daa) {
- JavaColumn javaColumn = new JavaColumn(owner, member, daa);
- return javaColumn;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @deprecated
- * @generated
- */
- @Deprecated
- public static JpaJavaMappingsPackage getPackage() {
- return JpaJavaMappingsPackage.eINSTANCE;
- }
-} //JavaMappingsFactory
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsPackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsPackage.java
deleted file mode 100644
index 0bc3cea56f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JpaJavaMappingsPackage.java
+++ /dev/null
@@ -1,6595 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.content.java.JpaJavaPackage;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.persistence.PersistencePackage;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Package</b> for the model.
- * It contains accessors for the meta objects to represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsFactory
- * @model kind="package"
- * @generated
- */
-public class JpaJavaMappingsPackage extends EPackageImpl
-{
- /**
- * The package name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNAME = "mappings";
-
- /**
- * The package namespace URI.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNS_URI = "jpt.core.java.mappings.xmi";
-
- /**
- * The package namespace name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNS_PREFIX = "jpt.core.java.mappings";
-
- /**
- * The singleton instance of the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final JpaJavaMappingsPackage eINSTANCE = org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage.init();
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaEntity <em>IJava Entity</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaEntity
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaEntity()
- * @generated
- */
- public static final int IJAVA_ENTITY = 0;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__NAME = JpaJavaPackage.IJAVA_TYPE_MAPPING__NAME;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__TABLE_NAME = JpaJavaPackage.IJAVA_TYPE_MAPPING__TABLE_NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__SPECIFIED_NAME = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__DEFAULT_NAME = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__TABLE = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Specified Secondary Tables</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__SPECIFIED_SECONDARY_TABLES = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__PRIMARY_KEY_JOIN_COLUMNS = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Specified Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Default Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Inheritance Strategy</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__INHERITANCE_STRATEGY = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Default Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__DEFAULT_DISCRIMINATOR_VALUE = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Specified Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__SPECIFIED_DISCRIMINATOR_VALUE = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 9;
-
- /**
- * The feature id for the '<em><b>Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__DISCRIMINATOR_VALUE = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 10;
-
- /**
- * The feature id for the '<em><b>Discriminator Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__DISCRIMINATOR_COLUMN = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 11;
-
- /**
- * The feature id for the '<em><b>Sequence Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__SEQUENCE_GENERATOR = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 12;
-
- /**
- * The feature id for the '<em><b>Table Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__TABLE_GENERATOR = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 13;
-
- /**
- * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__ATTRIBUTE_OVERRIDES = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 14;
-
- /**
- * The feature id for the '<em><b>Specified Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 15;
-
- /**
- * The feature id for the '<em><b>Default Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__DEFAULT_ATTRIBUTE_OVERRIDES = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 16;
-
- /**
- * The feature id for the '<em><b>Association Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__ASSOCIATION_OVERRIDES = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 17;
-
- /**
- * The feature id for the '<em><b>Specified Association Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__SPECIFIED_ASSOCIATION_OVERRIDES = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 18;
-
- /**
- * The feature id for the '<em><b>Default Association Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__DEFAULT_ASSOCIATION_OVERRIDES = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 19;
-
- /**
- * The feature id for the '<em><b>Named Queries</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__NAMED_QUERIES = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 20;
-
- /**
- * The feature id for the '<em><b>Named Native Queries</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__NAMED_NATIVE_QUERIES = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 21;
-
- /**
- * The feature id for the '<em><b>Id Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY__ID_CLASS = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 22;
-
- /**
- * The number of structural features of the '<em>IJava Entity</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ENTITY_FEATURE_COUNT = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 23;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddable <em>IJava Embeddable</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddable
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaEmbeddable()
- * @generated
- */
- public static final int IJAVA_EMBEDDABLE = 1;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_EMBEDDABLE__NAME = JpaJavaPackage.IJAVA_TYPE_MAPPING__NAME;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_EMBEDDABLE__TABLE_NAME = JpaJavaPackage.IJAVA_TYPE_MAPPING__TABLE_NAME;
-
- /**
- * The number of structural features of the '<em>IJava Embeddable</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_EMBEDDABLE_FEATURE_COUNT = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaMappedSuperclass <em>IJava Mapped Superclass</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaMappedSuperclass
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaMappedSuperclass()
- * @generated
- */
- public static final int IJAVA_MAPPED_SUPERCLASS = 2;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MAPPED_SUPERCLASS__NAME = JpaJavaPackage.IJAVA_TYPE_MAPPING__NAME;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MAPPED_SUPERCLASS__TABLE_NAME = JpaJavaPackage.IJAVA_TYPE_MAPPING__TABLE_NAME;
-
- /**
- * The feature id for the '<em><b>Id Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MAPPED_SUPERCLASS__ID_CLASS = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>IJava Mapped Superclass</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MAPPED_SUPERCLASS_FEATURE_COUNT = JpaJavaPackage.IJAVA_TYPE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaBasic <em>IJava Basic</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaBasic
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaBasic()
- * @generated
- */
- public static final int IJAVA_BASIC = 3;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_BASIC__FETCH = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_BASIC__OPTIONAL = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_BASIC__COLUMN = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Lob</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_BASIC__LOB = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Temporal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_BASIC__TEMPORAL = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Enumerated</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_BASIC__ENUMERATED = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The number of structural features of the '<em>IJava Basic</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_BASIC_FEATURE_COUNT = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 6;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbedded <em>IJava Embedded</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbedded
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaEmbedded()
- * @generated
- */
- public static final int IJAVA_EMBEDDED = 4;
-
- /**
- * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_EMBEDDED__ATTRIBUTE_OVERRIDES = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>IJava Embedded</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_EMBEDDED_FEATURE_COUNT = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddedId <em>IJava Embedded Id</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddedId
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaEmbeddedId()
- * @generated
- */
- public static final int IJAVA_EMBEDDED_ID = 5;
-
- /**
- * The number of structural features of the '<em>IJava Embedded Id</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_EMBEDDED_ID_FEATURE_COUNT = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaId <em>IJava Id</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaId
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaId()
- * @generated
- */
- public static final int IJAVA_ID = 6;
-
- /**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ID__COLUMN = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Generated Value</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ID__GENERATED_VALUE = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Temporal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ID__TEMPORAL = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Table Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ID__TABLE_GENERATOR = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Sequence Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ID__SEQUENCE_GENERATOR = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The number of structural features of the '<em>IJava Id</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ID_FEATURE_COUNT = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToMany <em>IJava Many To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToMany
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaManyToMany()
- * @generated
- */
- public static final int IJAVA_MANY_TO_MANY = 7;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_MANY__TARGET_ENTITY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_MANY__SPECIFIED_TARGET_ENTITY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_MANY__DEFAULT_TARGET_ENTITY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_MANY__RESOLVED_TARGET_ENTITY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_MANY__CASCADE = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_MANY__MAPPED_BY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Order By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_MANY__ORDER_BY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_MANY__FETCH = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Join Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_MANY__JOIN_TABLE = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Map Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_MANY__MAP_KEY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 9;
-
- /**
- * The number of structural features of the '<em>IJava Many To Many</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_MANY_FEATURE_COUNT = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 10;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToOne <em>IJava Many To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToOne
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaManyToOne()
- * @generated
- */
- public static final int IJAVA_MANY_TO_ONE = 8;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_ONE__TARGET_ENTITY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_ONE__SPECIFIED_TARGET_ENTITY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_ONE__DEFAULT_TARGET_ENTITY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_ONE__RESOLVED_TARGET_ENTITY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_ONE__CASCADE = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_ONE__FETCH = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_ONE__JOIN_COLUMNS = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_ONE__SPECIFIED_JOIN_COLUMNS = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_ONE__DEFAULT_JOIN_COLUMNS = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_ONE__OPTIONAL = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 9;
-
- /**
- * The number of structural features of the '<em>IJava Many To One</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_MANY_TO_ONE_FEATURE_COUNT = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 10;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToMany <em>IJava One To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToMany
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaOneToMany()
- * @generated
- */
- public static final int IJAVA_ONE_TO_MANY = 9;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_MANY__TARGET_ENTITY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_MANY__SPECIFIED_TARGET_ENTITY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_MANY__DEFAULT_TARGET_ENTITY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_MANY__RESOLVED_TARGET_ENTITY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_MANY__CASCADE = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_MANY__MAPPED_BY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Order By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_MANY__ORDER_BY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_MANY__FETCH = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Join Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_MANY__JOIN_TABLE = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Map Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_MANY__MAP_KEY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 9;
-
- /**
- * The number of structural features of the '<em>IJava One To Many</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_MANY_FEATURE_COUNT = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 10;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToOne <em>IJava One To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToOne
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaOneToOne()
- * @generated
- */
- public static final int IJAVA_ONE_TO_ONE = 10;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_ONE__TARGET_ENTITY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_ONE__SPECIFIED_TARGET_ENTITY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_ONE__DEFAULT_TARGET_ENTITY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_ONE__RESOLVED_TARGET_ENTITY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_ONE__CASCADE = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_ONE__FETCH = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_ONE__JOIN_COLUMNS = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_ONE__SPECIFIED_JOIN_COLUMNS = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_ONE__DEFAULT_JOIN_COLUMNS = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_ONE__OPTIONAL = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 9;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_ONE__MAPPED_BY = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 10;
-
- /**
- * The number of structural features of the '<em>IJava One To One</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_ONE_TO_ONE_FEATURE_COUNT = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 11;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaTransient <em>IJava Transient</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaTransient
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaTransient()
- * @generated
- */
- public static final int IJAVA_TRANSIENT = 11;
-
- /**
- * The number of structural features of the '<em>IJava Transient</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_TRANSIENT_FEATURE_COUNT = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaVersion <em>IJava Version</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaVersion
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaVersion()
- * @generated
- */
- public static final int IJAVA_VERSION = 12;
-
- /**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_VERSION__COLUMN = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Temporal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_VERSION__TEMPORAL = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>IJava Version</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJAVA_VERSION_FEATURE_COUNT = JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTypeMapping <em>Java Type Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaTypeMapping
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaTypeMapping()
- * @generated
- */
- public static final int JAVA_TYPE_MAPPING = 13;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TYPE_MAPPING__NAME = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TYPE_MAPPING__TABLE_NAME = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Java Type Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TYPE_MAPPING_FEATURE_COUNT = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity <em>Java Entity</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaEntity()
- * @generated
- */
- public static final int JAVA_ENTITY = 14;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__NAME = JAVA_TYPE_MAPPING__NAME;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__TABLE_NAME = JAVA_TYPE_MAPPING__TABLE_NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__SPECIFIED_NAME = JAVA_TYPE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__DEFAULT_NAME = JAVA_TYPE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__TABLE = JAVA_TYPE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Specified Secondary Tables</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__SPECIFIED_SECONDARY_TABLES = JAVA_TYPE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__PRIMARY_KEY_JOIN_COLUMNS = JAVA_TYPE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Specified Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS = JAVA_TYPE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Default Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS = JAVA_TYPE_MAPPING_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Inheritance Strategy</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__INHERITANCE_STRATEGY = JAVA_TYPE_MAPPING_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Default Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__DEFAULT_DISCRIMINATOR_VALUE = JAVA_TYPE_MAPPING_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Specified Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__SPECIFIED_DISCRIMINATOR_VALUE = JAVA_TYPE_MAPPING_FEATURE_COUNT + 9;
-
- /**
- * The feature id for the '<em><b>Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__DISCRIMINATOR_VALUE = JAVA_TYPE_MAPPING_FEATURE_COUNT + 10;
-
- /**
- * The feature id for the '<em><b>Discriminator Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__DISCRIMINATOR_COLUMN = JAVA_TYPE_MAPPING_FEATURE_COUNT + 11;
-
- /**
- * The feature id for the '<em><b>Sequence Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__SEQUENCE_GENERATOR = JAVA_TYPE_MAPPING_FEATURE_COUNT + 12;
-
- /**
- * The feature id for the '<em><b>Table Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__TABLE_GENERATOR = JAVA_TYPE_MAPPING_FEATURE_COUNT + 13;
-
- /**
- * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__ATTRIBUTE_OVERRIDES = JAVA_TYPE_MAPPING_FEATURE_COUNT + 14;
-
- /**
- * The feature id for the '<em><b>Specified Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES = JAVA_TYPE_MAPPING_FEATURE_COUNT + 15;
-
- /**
- * The feature id for the '<em><b>Default Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__DEFAULT_ATTRIBUTE_OVERRIDES = JAVA_TYPE_MAPPING_FEATURE_COUNT + 16;
-
- /**
- * The feature id for the '<em><b>Association Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__ASSOCIATION_OVERRIDES = JAVA_TYPE_MAPPING_FEATURE_COUNT + 17;
-
- /**
- * The feature id for the '<em><b>Specified Association Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__SPECIFIED_ASSOCIATION_OVERRIDES = JAVA_TYPE_MAPPING_FEATURE_COUNT + 18;
-
- /**
- * The feature id for the '<em><b>Default Association Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__DEFAULT_ASSOCIATION_OVERRIDES = JAVA_TYPE_MAPPING_FEATURE_COUNT + 19;
-
- /**
- * The feature id for the '<em><b>Named Queries</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__NAMED_QUERIES = JAVA_TYPE_MAPPING_FEATURE_COUNT + 20;
-
- /**
- * The feature id for the '<em><b>Named Native Queries</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__NAMED_NATIVE_QUERIES = JAVA_TYPE_MAPPING_FEATURE_COUNT + 21;
-
- /**
- * The feature id for the '<em><b>Id Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY__ID_CLASS = JAVA_TYPE_MAPPING_FEATURE_COUNT + 22;
-
- /**
- * The number of structural features of the '<em>Java Entity</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ENTITY_FEATURE_COUNT = JAVA_TYPE_MAPPING_FEATURE_COUNT + 23;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaMappedSuperclass <em>Java Mapped Superclass</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaMappedSuperclass
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaMappedSuperclass()
- * @generated
- */
- public static final int JAVA_MAPPED_SUPERCLASS = 15;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MAPPED_SUPERCLASS__NAME = JAVA_TYPE_MAPPING__NAME;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MAPPED_SUPERCLASS__TABLE_NAME = JAVA_TYPE_MAPPING__TABLE_NAME;
-
- /**
- * The feature id for the '<em><b>Id Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MAPPED_SUPERCLASS__ID_CLASS = JAVA_TYPE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Java Mapped Superclass</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MAPPED_SUPERCLASS_FEATURE_COUNT = JAVA_TYPE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddable <em>Java Embeddable</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddable
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaEmbeddable()
- * @generated
- */
- public static final int JAVA_EMBEDDABLE = 16;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_EMBEDDABLE__NAME = JAVA_TYPE_MAPPING__NAME;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_EMBEDDABLE__TABLE_NAME = JAVA_TYPE_MAPPING__TABLE_NAME;
-
- /**
- * The number of structural features of the '<em>Java Embeddable</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_EMBEDDABLE_FEATURE_COUNT = JAVA_TYPE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNullTypeMapping <em>Java Null Type Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNullTypeMapping
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaNullTypeMapping()
- * @generated
- */
- public static final int JAVA_NULL_TYPE_MAPPING = 17;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NULL_TYPE_MAPPING__NAME = JAVA_TYPE_MAPPING__NAME;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NULL_TYPE_MAPPING__TABLE_NAME = JAVA_TYPE_MAPPING__TABLE_NAME;
-
- /**
- * The number of structural features of the '<em>Java Null Type Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NULL_TYPE_MAPPING_FEATURE_COUNT = JAVA_TYPE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeMapping <em>Java Attribute Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeMapping
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaAttributeMapping()
- * @generated
- */
- public static final int JAVA_ATTRIBUTE_MAPPING = 18;
-
- /**
- * The number of structural features of the '<em>Java Attribute Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNullAttributeMapping <em>Java Null Attribute Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNullAttributeMapping
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaNullAttributeMapping()
- * @generated
- */
- public static final int JAVA_NULL_ATTRIBUTE_MAPPING = 32;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic <em>Java Basic</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaBasic()
- * @generated
- */
- public static final int JAVA_BASIC = 19;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_BASIC__FETCH = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_BASIC__OPTIONAL = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_BASIC__COLUMN = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Lob</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_BASIC__LOB = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Temporal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_BASIC__TEMPORAL = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Enumerated</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_BASIC__ENUMERATED = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The number of structural features of the '<em>Java Basic</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_BASIC_FEATURE_COUNT = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 6;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaId <em>Java Id</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaId
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaId()
- * @generated
- */
- public static final int JAVA_ID = 20;
-
- /**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ID__COLUMN = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Generated Value</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ID__GENERATED_VALUE = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Temporal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ID__TEMPORAL = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Table Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ID__TABLE_GENERATOR = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Sequence Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ID__SEQUENCE_GENERATOR = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The number of structural features of the '<em>Java Id</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ID_FEATURE_COUNT = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTransient <em>Java Transient</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaTransient
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaTransient()
- * @generated
- */
- public static final int JAVA_TRANSIENT = 21;
-
- /**
- * The number of structural features of the '<em>Java Transient</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TRANSIENT_FEATURE_COUNT = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaVersion <em>Java Version</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaVersion
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaVersion()
- * @generated
- */
- public static final int JAVA_VERSION = 22;
-
- /**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_VERSION__COLUMN = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Temporal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_VERSION__TEMPORAL = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Java Version</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_VERSION_FEATURE_COUNT = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddedId <em>Java Embedded Id</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddedId
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaEmbeddedId()
- * @generated
- */
- public static final int JAVA_EMBEDDED_ID = 23;
-
- /**
- * The number of structural features of the '<em>Java Embedded Id</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_EMBEDDED_ID_FEATURE_COUNT = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbedded <em>Java Embedded</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbedded
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaEmbedded()
- * @generated
- */
- public static final int JAVA_EMBEDDED = 24;
-
- /**
- * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_EMBEDDED__ATTRIBUTE_OVERRIDES = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Java Embedded</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_EMBEDDED_FEATURE_COUNT = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaRelationshipMapping <em>Java Relationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaRelationshipMapping
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaRelationshipMapping()
- * @generated
- */
- public static final int JAVA_RELATIONSHIP_MAPPING = 25;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_RELATIONSHIP_MAPPING__TARGET_ENTITY = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_RELATIONSHIP_MAPPING__CASCADE = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The number of structural features of the '<em>Java Relationship Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaSingleRelationshipMapping <em>Java Single Relationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaSingleRelationshipMapping
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaSingleRelationshipMapping()
- * @generated
- */
- public static final int JAVA_SINGLE_RELATIONSHIP_MAPPING = 26;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SINGLE_RELATIONSHIP_MAPPING__TARGET_ENTITY = JAVA_RELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY = JAVA_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY = JAVA_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SINGLE_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY = JAVA_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SINGLE_RELATIONSHIP_MAPPING__CASCADE = JAVA_RELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SINGLE_RELATIONSHIP_MAPPING__FETCH = JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS = JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS = JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS = JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL = JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The number of structural features of the '<em>Java Single Relationship Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT = JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToOne <em>Java Many To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToOne
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaManyToOne()
- * @generated
- */
- public static final int JAVA_MANY_TO_ONE = 27;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_ONE__TARGET_ENTITY = JAVA_SINGLE_RELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_ONE__SPECIFIED_TARGET_ENTITY = JAVA_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_ONE__DEFAULT_TARGET_ENTITY = JAVA_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_ONE__RESOLVED_TARGET_ENTITY = JAVA_SINGLE_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_ONE__CASCADE = JAVA_SINGLE_RELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_ONE__FETCH = JAVA_SINGLE_RELATIONSHIP_MAPPING__FETCH;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_ONE__JOIN_COLUMNS = JAVA_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_ONE__SPECIFIED_JOIN_COLUMNS = JAVA_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_ONE__DEFAULT_JOIN_COLUMNS = JAVA_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_ONE__OPTIONAL = JAVA_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL;
-
- /**
- * The number of structural features of the '<em>Java Many To One</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_ONE_FEATURE_COUNT = JAVA_SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToOne <em>Java One To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToOne
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaOneToOne()
- * @generated
- */
- public static final int JAVA_ONE_TO_ONE = 28;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_ONE__TARGET_ENTITY = JAVA_SINGLE_RELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_ONE__SPECIFIED_TARGET_ENTITY = JAVA_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_ONE__DEFAULT_TARGET_ENTITY = JAVA_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_ONE__RESOLVED_TARGET_ENTITY = JAVA_SINGLE_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_ONE__CASCADE = JAVA_SINGLE_RELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_ONE__FETCH = JAVA_SINGLE_RELATIONSHIP_MAPPING__FETCH;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_ONE__JOIN_COLUMNS = JAVA_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_ONE__SPECIFIED_JOIN_COLUMNS = JAVA_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_ONE__DEFAULT_JOIN_COLUMNS = JAVA_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_ONE__OPTIONAL = JAVA_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_ONE__MAPPED_BY = JAVA_SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Java One To One</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_ONE_FEATURE_COUNT = JAVA_SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping <em>Java Multi Relationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaMultiRelationshipMapping()
- * @generated
- */
- public static final int JAVA_MULTI_RELATIONSHIP_MAPPING = 29;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MULTI_RELATIONSHIP_MAPPING__TARGET_ENTITY = JAVA_RELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MULTI_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY = JAVA_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MULTI_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY = JAVA_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MULTI_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY = JAVA_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MULTI_RELATIONSHIP_MAPPING__CASCADE = JAVA_RELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY = JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Order By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY = JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MULTI_RELATIONSHIP_MAPPING__FETCH = JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Join Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE = JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Map Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY = JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The number of structural features of the '<em>Java Multi Relationship Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT = JAVA_RELATIONSHIP_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToMany <em>Java One To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToMany
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaOneToMany()
- * @generated
- */
- public static final int JAVA_ONE_TO_MANY = 30;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_MANY__TARGET_ENTITY = JAVA_MULTI_RELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_MANY__SPECIFIED_TARGET_ENTITY = JAVA_MULTI_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_MANY__DEFAULT_TARGET_ENTITY = JAVA_MULTI_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_MANY__RESOLVED_TARGET_ENTITY = JAVA_MULTI_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_MANY__CASCADE = JAVA_MULTI_RELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_MANY__MAPPED_BY = JAVA_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY;
-
- /**
- * The feature id for the '<em><b>Order By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_MANY__ORDER_BY = JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_MANY__FETCH = JAVA_MULTI_RELATIONSHIP_MAPPING__FETCH;
-
- /**
- * The feature id for the '<em><b>Join Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_MANY__JOIN_TABLE = JAVA_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE;
-
- /**
- * The feature id for the '<em><b>Map Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_MANY__MAP_KEY = JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY;
-
- /**
- * The number of structural features of the '<em>Java One To Many</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ONE_TO_MANY_FEATURE_COUNT = JAVA_MULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToMany <em>Java Many To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToMany
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaManyToMany()
- * @generated
- */
- public static final int JAVA_MANY_TO_MANY = 31;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_MANY__TARGET_ENTITY = JAVA_MULTI_RELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_MANY__SPECIFIED_TARGET_ENTITY = JAVA_MULTI_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_MANY__DEFAULT_TARGET_ENTITY = JAVA_MULTI_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_MANY__RESOLVED_TARGET_ENTITY = JAVA_MULTI_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_MANY__CASCADE = JAVA_MULTI_RELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_MANY__MAPPED_BY = JAVA_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY;
-
- /**
- * The feature id for the '<em><b>Order By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_MANY__ORDER_BY = JAVA_MULTI_RELATIONSHIP_MAPPING__ORDER_BY;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_MANY__FETCH = JAVA_MULTI_RELATIONSHIP_MAPPING__FETCH;
-
- /**
- * The feature id for the '<em><b>Join Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_MANY__JOIN_TABLE = JAVA_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE;
-
- /**
- * The feature id for the '<em><b>Map Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_MANY__MAP_KEY = JAVA_MULTI_RELATIONSHIP_MAPPING__MAP_KEY;
-
- /**
- * The number of structural features of the '<em>Java Many To Many</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_MANY_TO_MANY_FEATURE_COUNT = JAVA_MULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Java Null Attribute Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NULL_ATTRIBUTE_MAPPING_FEATURE_COUNT = JAVA_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaTable <em>Abstract Java Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaTable
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getAbstractJavaTable()
- * @generated
- */
- public static final int ABSTRACT_JAVA_TABLE = 33;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_TABLE__NAME = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_TABLE__SPECIFIED_NAME = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_TABLE__DEFAULT_NAME = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_TABLE__CATALOG = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_TABLE__SPECIFIED_CATALOG = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_TABLE__DEFAULT_CATALOG = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_TABLE__SCHEMA = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_TABLE__SPECIFIED_SCHEMA = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_TABLE__DEFAULT_SCHEMA = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_TABLE__UNIQUE_CONSTRAINTS = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 9;
-
- /**
- * The number of structural features of the '<em>Abstract Java Table</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_TABLE_FEATURE_COUNT = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 10;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTable <em>Java Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaTable
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaTable()
- * @generated
- */
- public static final int JAVA_TABLE = 34;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE__NAME = ABSTRACT_JAVA_TABLE__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE__SPECIFIED_NAME = ABSTRACT_JAVA_TABLE__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE__DEFAULT_NAME = ABSTRACT_JAVA_TABLE__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE__CATALOG = ABSTRACT_JAVA_TABLE__CATALOG;
-
- /**
- * The feature id for the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE__SPECIFIED_CATALOG = ABSTRACT_JAVA_TABLE__SPECIFIED_CATALOG;
-
- /**
- * The feature id for the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE__DEFAULT_CATALOG = ABSTRACT_JAVA_TABLE__DEFAULT_CATALOG;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE__SCHEMA = ABSTRACT_JAVA_TABLE__SCHEMA;
-
- /**
- * The feature id for the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE__SPECIFIED_SCHEMA = ABSTRACT_JAVA_TABLE__SPECIFIED_SCHEMA;
-
- /**
- * The feature id for the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE__DEFAULT_SCHEMA = ABSTRACT_JAVA_TABLE__DEFAULT_SCHEMA;
-
- /**
- * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE__UNIQUE_CONSTRAINTS = ABSTRACT_JAVA_TABLE__UNIQUE_CONSTRAINTS;
-
- /**
- * The number of structural features of the '<em>Java Table</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_FEATURE_COUNT = ABSTRACT_JAVA_TABLE_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinTable <em>Java Join Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinTable
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaJoinTable()
- * @generated
- */
- public static final int JAVA_JOIN_TABLE = 36;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaColumn <em>Java Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaColumn
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaColumn()
- * @generated
- */
- public static final int JAVA_COLUMN = 39;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinColumn <em>Java Join Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinColumn
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaJoinColumn()
- * @generated
- */
- public static final int JAVA_JOIN_COLUMN = 40;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeOverride <em>Java Attribute Override</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeOverride
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaAttributeOverride()
- * @generated
- */
- public static final int JAVA_ATTRIBUTE_OVERRIDE = 42;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAssociationOverride <em>Java Association Override</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaAssociationOverride
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaAssociationOverride()
- * @generated
- */
- public static final int JAVA_ASSOCIATION_OVERRIDE = 43;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaDiscriminatorColumn <em>Java Discriminator Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaDiscriminatorColumn
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaDiscriminatorColumn()
- * @generated
- */
- public static final int JAVA_DISCRIMINATOR_COLUMN = 44;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaPrimaryKeyJoinColumn <em>Java Primary Key Join Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaPrimaryKeyJoinColumn
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaPrimaryKeyJoinColumn()
- * @generated
- */
- public static final int JAVA_PRIMARY_KEY_JOIN_COLUMN = 45;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaGeneratedValue <em>Java Generated Value</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaGeneratedValue
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaGeneratedValue()
- * @generated
- */
- public static final int JAVA_GENERATED_VALUE = 46;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaGenerator <em>Java Generator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaGenerator
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaGenerator()
- * @generated
- */
- public static final int JAVA_GENERATOR = 47;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator <em>Java Table Generator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaTableGenerator()
- * @generated
- */
- public static final int JAVA_TABLE_GENERATOR = 48;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaSequenceGenerator <em>Java Sequence Generator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaSequenceGenerator
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaSequenceGenerator()
- * @generated
- */
- public static final int JAVA_SEQUENCE_GENERATOR = 49;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaSecondaryTable <em>Java Secondary Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaSecondaryTable
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaSecondaryTable()
- * @generated
- */
- public static final int JAVA_SECONDARY_TABLE = 35;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SECONDARY_TABLE__NAME = ABSTRACT_JAVA_TABLE__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SECONDARY_TABLE__SPECIFIED_NAME = ABSTRACT_JAVA_TABLE__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SECONDARY_TABLE__DEFAULT_NAME = ABSTRACT_JAVA_TABLE__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SECONDARY_TABLE__CATALOG = ABSTRACT_JAVA_TABLE__CATALOG;
-
- /**
- * The feature id for the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SECONDARY_TABLE__SPECIFIED_CATALOG = ABSTRACT_JAVA_TABLE__SPECIFIED_CATALOG;
-
- /**
- * The feature id for the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SECONDARY_TABLE__DEFAULT_CATALOG = ABSTRACT_JAVA_TABLE__DEFAULT_CATALOG;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SECONDARY_TABLE__SCHEMA = ABSTRACT_JAVA_TABLE__SCHEMA;
-
- /**
- * The feature id for the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SECONDARY_TABLE__SPECIFIED_SCHEMA = ABSTRACT_JAVA_TABLE__SPECIFIED_SCHEMA;
-
- /**
- * The feature id for the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SECONDARY_TABLE__DEFAULT_SCHEMA = ABSTRACT_JAVA_TABLE__DEFAULT_SCHEMA;
-
- /**
- * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SECONDARY_TABLE__UNIQUE_CONSTRAINTS = ABSTRACT_JAVA_TABLE__UNIQUE_CONSTRAINTS;
-
- /**
- * The feature id for the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS = ABSTRACT_JAVA_TABLE_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS = ABSTRACT_JAVA_TABLE_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS = ABSTRACT_JAVA_TABLE_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Java Secondary Table</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SECONDARY_TABLE_FEATURE_COUNT = ABSTRACT_JAVA_TABLE_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE__NAME = ABSTRACT_JAVA_TABLE__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE__SPECIFIED_NAME = ABSTRACT_JAVA_TABLE__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE__DEFAULT_NAME = ABSTRACT_JAVA_TABLE__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE__CATALOG = ABSTRACT_JAVA_TABLE__CATALOG;
-
- /**
- * The feature id for the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE__SPECIFIED_CATALOG = ABSTRACT_JAVA_TABLE__SPECIFIED_CATALOG;
-
- /**
- * The feature id for the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE__DEFAULT_CATALOG = ABSTRACT_JAVA_TABLE__DEFAULT_CATALOG;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE__SCHEMA = ABSTRACT_JAVA_TABLE__SCHEMA;
-
- /**
- * The feature id for the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE__SPECIFIED_SCHEMA = ABSTRACT_JAVA_TABLE__SPECIFIED_SCHEMA;
-
- /**
- * The feature id for the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE__DEFAULT_SCHEMA = ABSTRACT_JAVA_TABLE__DEFAULT_SCHEMA;
-
- /**
- * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE__UNIQUE_CONSTRAINTS = ABSTRACT_JAVA_TABLE__UNIQUE_CONSTRAINTS;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE__JOIN_COLUMNS = ABSTRACT_JAVA_TABLE_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS = ABSTRACT_JAVA_TABLE_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE__DEFAULT_JOIN_COLUMNS = ABSTRACT_JAVA_TABLE_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Inverse Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE__INVERSE_JOIN_COLUMNS = ABSTRACT_JAVA_TABLE_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Specified Inverse Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS = ABSTRACT_JAVA_TABLE_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Default Inverse Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS = ABSTRACT_JAVA_TABLE_FEATURE_COUNT + 5;
-
- /**
- * The number of structural features of the '<em>Java Join Table</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_TABLE_FEATURE_COUNT = ABSTRACT_JAVA_TABLE_FEATURE_COUNT + 6;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedColumn <em>Java Named Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedColumn
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaNamedColumn()
- * @generated
- */
- public static final int JAVA_NAMED_COLUMN = 37;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NAMED_COLUMN__NAME = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NAMED_COLUMN__SPECIFIED_NAME = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NAMED_COLUMN__DEFAULT_NAME = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NAMED_COLUMN__COLUMN_DEFINITION = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The number of structural features of the '<em>Java Named Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NAMED_COLUMN_FEATURE_COUNT = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaColumn <em>Abstract Java Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaColumn
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getAbstractJavaColumn()
- * @generated
- */
- public static final int ABSTRACT_JAVA_COLUMN = 38;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_COLUMN__NAME = JAVA_NAMED_COLUMN__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_COLUMN__SPECIFIED_NAME = JAVA_NAMED_COLUMN__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_COLUMN__DEFAULT_NAME = JAVA_NAMED_COLUMN__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_COLUMN__COLUMN_DEFINITION = JAVA_NAMED_COLUMN__COLUMN_DEFINITION;
-
- /**
- * The feature id for the '<em><b>Unique</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_COLUMN__UNIQUE = JAVA_NAMED_COLUMN_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Nullable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_COLUMN__NULLABLE = JAVA_NAMED_COLUMN_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Insertable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_COLUMN__INSERTABLE = JAVA_NAMED_COLUMN_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Updatable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_COLUMN__UPDATABLE = JAVA_NAMED_COLUMN_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_COLUMN__TABLE = JAVA_NAMED_COLUMN_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_COLUMN__SPECIFIED_TABLE = JAVA_NAMED_COLUMN_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_COLUMN__DEFAULT_TABLE = JAVA_NAMED_COLUMN_FEATURE_COUNT + 6;
-
- /**
- * The number of structural features of the '<em>Abstract Java Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_JAVA_COLUMN_FEATURE_COUNT = JAVA_NAMED_COLUMN_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__NAME = ABSTRACT_JAVA_COLUMN__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__SPECIFIED_NAME = ABSTRACT_JAVA_COLUMN__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__DEFAULT_NAME = ABSTRACT_JAVA_COLUMN__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__COLUMN_DEFINITION = ABSTRACT_JAVA_COLUMN__COLUMN_DEFINITION;
-
- /**
- * The feature id for the '<em><b>Unique</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__UNIQUE = ABSTRACT_JAVA_COLUMN__UNIQUE;
-
- /**
- * The feature id for the '<em><b>Nullable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__NULLABLE = ABSTRACT_JAVA_COLUMN__NULLABLE;
-
- /**
- * The feature id for the '<em><b>Insertable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__INSERTABLE = ABSTRACT_JAVA_COLUMN__INSERTABLE;
-
- /**
- * The feature id for the '<em><b>Updatable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__UPDATABLE = ABSTRACT_JAVA_COLUMN__UPDATABLE;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__TABLE = ABSTRACT_JAVA_COLUMN__TABLE;
-
- /**
- * The feature id for the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__SPECIFIED_TABLE = ABSTRACT_JAVA_COLUMN__SPECIFIED_TABLE;
-
- /**
- * The feature id for the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__DEFAULT_TABLE = ABSTRACT_JAVA_COLUMN__DEFAULT_TABLE;
-
- /**
- * The feature id for the '<em><b>Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__LENGTH = ABSTRACT_JAVA_COLUMN_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__SPECIFIED_LENGTH = ABSTRACT_JAVA_COLUMN_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Precision</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__PRECISION = ABSTRACT_JAVA_COLUMN_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Specified Precision</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__SPECIFIED_PRECISION = ABSTRACT_JAVA_COLUMN_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Scale</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__SCALE = ABSTRACT_JAVA_COLUMN_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Specified Scale</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN__SPECIFIED_SCALE = ABSTRACT_JAVA_COLUMN_FEATURE_COUNT + 5;
-
- /**
- * The number of structural features of the '<em>Java Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_COLUMN_FEATURE_COUNT = ABSTRACT_JAVA_COLUMN_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_COLUMN__NAME = ABSTRACT_JAVA_COLUMN__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_COLUMN__SPECIFIED_NAME = ABSTRACT_JAVA_COLUMN__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_COLUMN__DEFAULT_NAME = ABSTRACT_JAVA_COLUMN__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_COLUMN__COLUMN_DEFINITION = ABSTRACT_JAVA_COLUMN__COLUMN_DEFINITION;
-
- /**
- * The feature id for the '<em><b>Unique</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_COLUMN__UNIQUE = ABSTRACT_JAVA_COLUMN__UNIQUE;
-
- /**
- * The feature id for the '<em><b>Nullable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_COLUMN__NULLABLE = ABSTRACT_JAVA_COLUMN__NULLABLE;
-
- /**
- * The feature id for the '<em><b>Insertable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_COLUMN__INSERTABLE = ABSTRACT_JAVA_COLUMN__INSERTABLE;
-
- /**
- * The feature id for the '<em><b>Updatable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_COLUMN__UPDATABLE = ABSTRACT_JAVA_COLUMN__UPDATABLE;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_COLUMN__TABLE = ABSTRACT_JAVA_COLUMN__TABLE;
-
- /**
- * The feature id for the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_COLUMN__SPECIFIED_TABLE = ABSTRACT_JAVA_COLUMN__SPECIFIED_TABLE;
-
- /**
- * The feature id for the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_COLUMN__DEFAULT_TABLE = ABSTRACT_JAVA_COLUMN__DEFAULT_TABLE;
-
- /**
- * The feature id for the '<em><b>Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_COLUMN__REFERENCED_COLUMN_NAME = ABSTRACT_JAVA_COLUMN_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME = ABSTRACT_JAVA_COLUMN_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME = ABSTRACT_JAVA_COLUMN_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Java Join Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_JOIN_COLUMN_FEATURE_COUNT = ABSTRACT_JAVA_COLUMN_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaOverride <em>Java Override</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaOverride
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaOverride()
- * @generated
- */
- public static final int JAVA_OVERRIDE = 41;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_OVERRIDE__NAME = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Java Override</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_OVERRIDE_FEATURE_COUNT = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ATTRIBUTE_OVERRIDE__NAME = JAVA_OVERRIDE__NAME;
-
- /**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ATTRIBUTE_OVERRIDE__COLUMN = JAVA_OVERRIDE_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Java Attribute Override</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ATTRIBUTE_OVERRIDE_FEATURE_COUNT = JAVA_OVERRIDE_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ASSOCIATION_OVERRIDE__NAME = JAVA_OVERRIDE__NAME;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ASSOCIATION_OVERRIDE__JOIN_COLUMNS = JAVA_OVERRIDE_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS = JAVA_OVERRIDE_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS = JAVA_OVERRIDE_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Java Association Override</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ASSOCIATION_OVERRIDE_FEATURE_COUNT = JAVA_OVERRIDE_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_DISCRIMINATOR_COLUMN__NAME = JAVA_NAMED_COLUMN__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_DISCRIMINATOR_COLUMN__SPECIFIED_NAME = JAVA_NAMED_COLUMN__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_DISCRIMINATOR_COLUMN__DEFAULT_NAME = JAVA_NAMED_COLUMN__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_DISCRIMINATOR_COLUMN__COLUMN_DEFINITION = JAVA_NAMED_COLUMN__COLUMN_DEFINITION;
-
- /**
- * The feature id for the '<em><b>Discriminator Type</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE = JAVA_NAMED_COLUMN_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Default Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_DISCRIMINATOR_COLUMN__DEFAULT_LENGTH = JAVA_NAMED_COLUMN_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Specified Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH = JAVA_NAMED_COLUMN_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_DISCRIMINATOR_COLUMN__LENGTH = JAVA_NAMED_COLUMN_FEATURE_COUNT + 3;
-
- /**
- * The number of structural features of the '<em>Java Discriminator Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_DISCRIMINATOR_COLUMN_FEATURE_COUNT = JAVA_NAMED_COLUMN_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PRIMARY_KEY_JOIN_COLUMN__NAME = JAVA_NAMED_COLUMN__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_NAME = JAVA_NAMED_COLUMN__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PRIMARY_KEY_JOIN_COLUMN__DEFAULT_NAME = JAVA_NAMED_COLUMN__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION = JAVA_NAMED_COLUMN__COLUMN_DEFINITION;
-
- /**
- * The feature id for the '<em><b>Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME = JAVA_NAMED_COLUMN_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME = JAVA_NAMED_COLUMN_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PRIMARY_KEY_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME = JAVA_NAMED_COLUMN_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Java Primary Key Join Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_PRIMARY_KEY_JOIN_COLUMN_FEATURE_COUNT = JAVA_NAMED_COLUMN_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Strategy</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_GENERATED_VALUE__STRATEGY = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Generator</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_GENERATED_VALUE__GENERATOR = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Java Generated Value</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_GENERATED_VALUE_FEATURE_COUNT = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_GENERATOR__NAME = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_GENERATOR__INITIAL_VALUE = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Specified Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_GENERATOR__SPECIFIED_INITIAL_VALUE = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Default Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_GENERATOR__DEFAULT_INITIAL_VALUE = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_GENERATOR__ALLOCATION_SIZE = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Specified Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_GENERATOR__SPECIFIED_ALLOCATION_SIZE = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Default Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_GENERATOR__DEFAULT_ALLOCATION_SIZE = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 6;
-
- /**
- * The number of structural features of the '<em>Java Generator</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_GENERATOR_FEATURE_COUNT = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__NAME = JAVA_GENERATOR__NAME;
-
- /**
- * The feature id for the '<em><b>Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__INITIAL_VALUE = JAVA_GENERATOR__INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Specified Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__SPECIFIED_INITIAL_VALUE = JAVA_GENERATOR__SPECIFIED_INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Default Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__DEFAULT_INITIAL_VALUE = JAVA_GENERATOR__DEFAULT_INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__ALLOCATION_SIZE = JAVA_GENERATOR__ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Specified Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__SPECIFIED_ALLOCATION_SIZE = JAVA_GENERATOR__SPECIFIED_ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Default Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__DEFAULT_ALLOCATION_SIZE = JAVA_GENERATOR__DEFAULT_ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__TABLE = JAVA_GENERATOR_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__SPECIFIED_TABLE = JAVA_GENERATOR_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__DEFAULT_TABLE = JAVA_GENERATOR_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__CATALOG = JAVA_GENERATOR_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__SPECIFIED_CATALOG = JAVA_GENERATOR_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__DEFAULT_CATALOG = JAVA_GENERATOR_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__SCHEMA = JAVA_GENERATOR_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__SPECIFIED_SCHEMA = JAVA_GENERATOR_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__DEFAULT_SCHEMA = JAVA_GENERATOR_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Pk Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__PK_COLUMN_NAME = JAVA_GENERATOR_FEATURE_COUNT + 9;
-
- /**
- * The feature id for the '<em><b>Specified Pk Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME = JAVA_GENERATOR_FEATURE_COUNT + 10;
-
- /**
- * The feature id for the '<em><b>Default Pk Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME = JAVA_GENERATOR_FEATURE_COUNT + 11;
-
- /**
- * The feature id for the '<em><b>Value Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__VALUE_COLUMN_NAME = JAVA_GENERATOR_FEATURE_COUNT + 12;
-
- /**
- * The feature id for the '<em><b>Specified Value Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME = JAVA_GENERATOR_FEATURE_COUNT + 13;
-
- /**
- * The feature id for the '<em><b>Default Value Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME = JAVA_GENERATOR_FEATURE_COUNT + 14;
-
- /**
- * The feature id for the '<em><b>Pk Column Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__PK_COLUMN_VALUE = JAVA_GENERATOR_FEATURE_COUNT + 15;
-
- /**
- * The feature id for the '<em><b>Specified Pk Column Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE = JAVA_GENERATOR_FEATURE_COUNT + 16;
-
- /**
- * The feature id for the '<em><b>Default Pk Column Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE = JAVA_GENERATOR_FEATURE_COUNT + 17;
-
- /**
- * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR__UNIQUE_CONSTRAINTS = JAVA_GENERATOR_FEATURE_COUNT + 18;
-
- /**
- * The number of structural features of the '<em>Java Table Generator</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_TABLE_GENERATOR_FEATURE_COUNT = JAVA_GENERATOR_FEATURE_COUNT + 19;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SEQUENCE_GENERATOR__NAME = JAVA_GENERATOR__NAME;
-
- /**
- * The feature id for the '<em><b>Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SEQUENCE_GENERATOR__INITIAL_VALUE = JAVA_GENERATOR__INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Specified Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SEQUENCE_GENERATOR__SPECIFIED_INITIAL_VALUE = JAVA_GENERATOR__SPECIFIED_INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Default Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SEQUENCE_GENERATOR__DEFAULT_INITIAL_VALUE = JAVA_GENERATOR__DEFAULT_INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SEQUENCE_GENERATOR__ALLOCATION_SIZE = JAVA_GENERATOR__ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Specified Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SEQUENCE_GENERATOR__SPECIFIED_ALLOCATION_SIZE = JAVA_GENERATOR__SPECIFIED_ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Default Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SEQUENCE_GENERATOR__DEFAULT_ALLOCATION_SIZE = JAVA_GENERATOR__DEFAULT_ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Sequence Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SEQUENCE_GENERATOR__SEQUENCE_NAME = JAVA_GENERATOR_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Sequence Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME = JAVA_GENERATOR_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Sequence Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME = JAVA_GENERATOR_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Java Sequence Generator</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_SEQUENCE_GENERATOR_FEATURE_COUNT = JAVA_GENERATOR_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAbstractQuery <em>Java Abstract Query</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaAbstractQuery
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaAbstractQuery()
- * @generated
- */
- public static final int JAVA_ABSTRACT_QUERY = 50;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ABSTRACT_QUERY__NAME = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Query</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ABSTRACT_QUERY__QUERY = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Hints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ABSTRACT_QUERY__HINTS = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Java Abstract Query</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_ABSTRACT_QUERY_FEATURE_COUNT = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedQuery <em>Java Named Query</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedQuery
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaNamedQuery()
- * @generated
- */
- public static final int JAVA_NAMED_QUERY = 51;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NAMED_QUERY__NAME = JAVA_ABSTRACT_QUERY__NAME;
-
- /**
- * The feature id for the '<em><b>Query</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NAMED_QUERY__QUERY = JAVA_ABSTRACT_QUERY__QUERY;
-
- /**
- * The feature id for the '<em><b>Hints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NAMED_QUERY__HINTS = JAVA_ABSTRACT_QUERY__HINTS;
-
- /**
- * The number of structural features of the '<em>Java Named Query</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NAMED_QUERY_FEATURE_COUNT = JAVA_ABSTRACT_QUERY_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedNativeQuery <em>Java Named Native Query</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedNativeQuery
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaNamedNativeQuery()
- * @generated
- */
- public static final int JAVA_NAMED_NATIVE_QUERY = 52;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NAMED_NATIVE_QUERY__NAME = JAVA_ABSTRACT_QUERY__NAME;
-
- /**
- * The feature id for the '<em><b>Query</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NAMED_NATIVE_QUERY__QUERY = JAVA_ABSTRACT_QUERY__QUERY;
-
- /**
- * The feature id for the '<em><b>Hints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NAMED_NATIVE_QUERY__HINTS = JAVA_ABSTRACT_QUERY__HINTS;
-
- /**
- * The feature id for the '<em><b>Result Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NAMED_NATIVE_QUERY__RESULT_CLASS = JAVA_ABSTRACT_QUERY_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Result Set Mapping</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING = JAVA_ABSTRACT_QUERY_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Java Named Native Query</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_NAMED_NATIVE_QUERY_FEATURE_COUNT = JAVA_ABSTRACT_QUERY_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaQueryHint <em>Java Query Hint</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaQueryHint
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaQueryHint()
- * @generated
- */
- public static final int JAVA_QUERY_HINT = 53;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_QUERY_HINT__NAME = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_QUERY_HINT__VALUE = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Java Query Hint</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_QUERY_HINT_FEATURE_COUNT = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaUniqueConstraint <em>Java Unique Constraint</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaUniqueConstraint
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaUniqueConstraint()
- * @generated
- */
- public static final int JAVA_UNIQUE_CONSTRAINT = 54;
-
- /**
- * The feature id for the '<em><b>Column Names</b></em>' attribute list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_UNIQUE_CONSTRAINT__COLUMN_NAMES = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Java Unique Constraint</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_UNIQUE_CONSTRAINT_FEATURE_COUNT = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaCascade <em>Java Cascade</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaCascade
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaCascade()
- * @generated
- */
- public static final int JAVA_CASCADE = 55;
-
- /**
- * The feature id for the '<em><b>All</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_CASCADE__ALL = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Persist</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_CASCADE__PERSIST = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Merge</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_CASCADE__MERGE = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Remove</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_CASCADE__REMOVE = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Refresh</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_CASCADE__REFRESH = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The number of structural features of the '<em>Java Cascade</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_CASCADE_FEATURE_COUNT = JpaJavaPackage.JAVA_EOBJECT_FEATURE_COUNT + 5;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJavaEntityEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJavaEmbeddableEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJavaMappedSuperclassEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJavaBasicEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJavaEmbeddedEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJavaEmbeddedIdEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJavaIdEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJavaManyToManyEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJavaManyToOneEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJavaOneToManyEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJavaOneToOneEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJavaTransientEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJavaVersionEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaEntityEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaMappedSuperclassEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaEmbeddableEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaNullTypeMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaNullAttributeMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaBasicEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaIdEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaTransientEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaVersionEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaEmbeddedIdEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaEmbeddedEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaAttributeMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaTypeMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass abstractJavaTableEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaTableEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaRelationshipMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaSingleRelationshipMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaManyToOneEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaOneToOneEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaMultiRelationshipMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaOneToManyEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaManyToManyEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaJoinTableEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaNamedColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass abstractJavaColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaJoinColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaOverrideEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaAttributeOverrideEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaAssociationOverrideEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaDiscriminatorColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaPrimaryKeyJoinColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaGeneratedValueEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaGeneratorEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaTableGeneratorEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaSequenceGeneratorEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaAbstractQueryEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaNamedQueryEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaNamedNativeQueryEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaQueryHintEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaUniqueConstraintEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaCascadeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaSecondaryTableEClass = null;
-
- /**
- * Creates an instance of the model <b>Package</b>, registered with
- * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
- * package URI value.
- * <p>Note: the correct way to create the package is via the static
- * factory method {@link #init init()}, which also performs
- * initialization of the package, or returns the registered package,
- * if one already exists.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.ecore.EPackage.Registry
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#eNS_URI
- * @see #init()
- * @generated
- */
- private JpaJavaMappingsPackage() {
- super(eNS_URI, JpaJavaMappingsFactory.eINSTANCE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static boolean isInited = false;
-
- /**
- * Creates, registers, and initializes the <b>Package</b> for this
- * model, and for any others upon which it depends. Simple
- * dependencies are satisfied by calling this method on all
- * dependent packages before doing anything else. This method drives
- * initialization for interdependent packages directly, in parallel
- * with this package, itself.
- * <p>Of this package and its interdependencies, all packages which
- * have not yet been registered by their URI values are first created
- * and registered. The packages are then initialized in two steps:
- * meta-model objects for all of the packages are created before any
- * are initialized, since one package's meta-model objects may refer to
- * those of another.
- * <p>Invocation of this method will not affect any packages that have
- * already been initialized.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #eNS_URI
- * @see #createPackageContents()
- * @see #initializePackageContents()
- * @generated
- */
- public static JpaJavaMappingsPackage init() {
- if (isInited)
- return (JpaJavaMappingsPackage) EPackage.Registry.INSTANCE.getEPackage(JpaJavaMappingsPackage.eNS_URI);
- // Obtain or create and register package
- JpaJavaMappingsPackage theJpaJavaMappingsPackage = (JpaJavaMappingsPackage) (EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof JpaJavaMappingsPackage ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new JpaJavaMappingsPackage());
- isInited = true;
- // Initialize simple dependencies
- EcorePackage.eINSTANCE.eClass();
- // Obtain or create and register interdependencies
- JpaCorePackage theJpaCorePackage = (JpaCorePackage) (EPackage.Registry.INSTANCE.getEPackage(JpaCorePackage.eNS_URI) instanceof JpaCorePackage ? EPackage.Registry.INSTANCE.getEPackage(JpaCorePackage.eNS_URI) : JpaCorePackage.eINSTANCE);
- JpaCoreMappingsPackage theJpaCoreMappingsPackage = (JpaCoreMappingsPackage) (EPackage.Registry.INSTANCE.getEPackage(JpaCoreMappingsPackage.eNS_URI) instanceof JpaCoreMappingsPackage ? EPackage.Registry.INSTANCE.getEPackage(JpaCoreMappingsPackage.eNS_URI) : JpaCoreMappingsPackage.eINSTANCE);
- JpaJavaPackage theJpaJavaPackage = (JpaJavaPackage) (EPackage.Registry.INSTANCE.getEPackage(JpaJavaPackage.eNS_URI) instanceof JpaJavaPackage ? EPackage.Registry.INSTANCE.getEPackage(JpaJavaPackage.eNS_URI) : JpaJavaPackage.eINSTANCE);
- OrmPackage theOrmPackage = (OrmPackage) (EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) instanceof OrmPackage ? EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) : OrmPackage.eINSTANCE);
- PersistencePackage thePersistencePackage = (PersistencePackage) (EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI) instanceof PersistencePackage ? EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI) : PersistencePackage.eINSTANCE);
- // Create package meta-data objects
- theJpaJavaMappingsPackage.createPackageContents();
- theJpaCorePackage.createPackageContents();
- theJpaCoreMappingsPackage.createPackageContents();
- theJpaJavaPackage.createPackageContents();
- theOrmPackage.createPackageContents();
- thePersistencePackage.createPackageContents();
- // Initialize created meta-data
- theJpaJavaMappingsPackage.initializePackageContents();
- theJpaCorePackage.initializePackageContents();
- theJpaCoreMappingsPackage.initializePackageContents();
- theJpaJavaPackage.initializePackageContents();
- theOrmPackage.initializePackageContents();
- thePersistencePackage.initializePackageContents();
- // Mark meta-data to indicate it can't be changed
- theJpaJavaMappingsPackage.freeze();
- return theJpaJavaMappingsPackage;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaEntity <em>IJava Entity</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJava Entity</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaEntity
- * @generated
- */
- public EClass getIJavaEntity() {
- return iJavaEntityEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddable <em>IJava Embeddable</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJava Embeddable</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddable
- * @generated
- */
- public EClass getIJavaEmbeddable() {
- return iJavaEmbeddableEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaMappedSuperclass <em>IJava Mapped Superclass</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJava Mapped Superclass</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaMappedSuperclass
- * @generated
- */
- public EClass getIJavaMappedSuperclass() {
- return iJavaMappedSuperclassEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaBasic <em>IJava Basic</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJava Basic</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaBasic
- * @generated
- */
- public EClass getIJavaBasic() {
- return iJavaBasicEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbedded <em>IJava Embedded</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJava Embedded</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbedded
- * @generated
- */
- public EClass getIJavaEmbedded() {
- return iJavaEmbeddedEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddedId <em>IJava Embedded Id</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJava Embedded Id</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddedId
- * @generated
- */
- public EClass getIJavaEmbeddedId() {
- return iJavaEmbeddedIdEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaId <em>IJava Id</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJava Id</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaId
- * @generated
- */
- public EClass getIJavaId() {
- return iJavaIdEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToMany <em>IJava Many To Many</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJava Many To Many</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToMany
- * @generated
- */
- public EClass getIJavaManyToMany() {
- return iJavaManyToManyEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToOne <em>IJava Many To One</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJava Many To One</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToOne
- * @generated
- */
- public EClass getIJavaManyToOne() {
- return iJavaManyToOneEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToMany <em>IJava One To Many</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJava One To Many</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToMany
- * @generated
- */
- public EClass getIJavaOneToMany() {
- return iJavaOneToManyEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToOne <em>IJava One To One</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJava One To One</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToOne
- * @generated
- */
- public EClass getIJavaOneToOne() {
- return iJavaOneToOneEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaTransient <em>IJava Transient</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJava Transient</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaTransient
- * @generated
- */
- public EClass getIJavaTransient() {
- return iJavaTransientEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaVersion <em>IJava Version</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJava Version</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaVersion
- * @generated
- */
- public EClass getIJavaVersion() {
- return iJavaVersionEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity <em>Java Entity</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Entity</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity
- * @generated
- */
- public EClass getJavaEntity() {
- return javaEntityEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaMappedSuperclass <em>Java Mapped Superclass</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Mapped Superclass</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaMappedSuperclass
- * @generated
- */
- public EClass getJavaMappedSuperclass() {
- return javaMappedSuperclassEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddable <em>Java Embeddable</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Embeddable</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddable
- * @generated
- */
- public EClass getJavaEmbeddable() {
- return javaEmbeddableEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNullTypeMapping <em>Java Null Type Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Null Type Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNullTypeMapping
- * @generated
- */
- public EClass getJavaNullTypeMapping() {
- return javaNullTypeMappingEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNullAttributeMapping <em>Java Null Attribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Null Attribute Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNullAttributeMapping
- * @generated
- */
- public EClass getJavaNullAttributeMapping() {
- return javaNullAttributeMappingEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic <em>Java Basic</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Basic</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic
- * @generated
- */
- public EClass getJavaBasic() {
- return javaBasicEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaId <em>Java Id</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Id</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaId
- * @generated
- */
- public EClass getJavaId() {
- return javaIdEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTransient <em>Java Transient</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Transient</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaTransient
- * @generated
- */
- public EClass getJavaTransient() {
- return javaTransientEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaVersion <em>Java Version</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Version</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaVersion
- * @generated
- */
- public EClass getJavaVersion() {
- return javaVersionEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddedId <em>Java Embedded Id</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Embedded Id</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddedId
- * @generated
- */
- public EClass getJavaEmbeddedId() {
- return javaEmbeddedIdEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbedded <em>Java Embedded</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Embedded</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbedded
- * @generated
- */
- public EClass getJavaEmbedded() {
- return javaEmbeddedEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeMapping <em>Java Attribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Attribute Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeMapping
- * @generated
- */
- public EClass getJavaAttributeMapping() {
- return javaAttributeMappingEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTypeMapping <em>Java Type Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Type Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaTypeMapping
- * @generated
- */
- public EClass getJavaTypeMapping() {
- return javaTypeMappingEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaTable <em>Abstract Java Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Abstract Java Table</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaTable
- * @generated
- */
- public EClass getAbstractJavaTable() {
- return abstractJavaTableEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTable <em>Java Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Table</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaTable
- * @generated
- */
- public EClass getJavaTable() {
- return javaTableEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaColumn <em>Java Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Column</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaColumn
- * @generated
- */
- public EClass getJavaColumn() {
- return javaColumnEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaRelationshipMapping <em>Java Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Relationship Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaRelationshipMapping
- * @generated
- */
- public EClass getJavaRelationshipMapping() {
- return javaRelationshipMappingEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaSingleRelationshipMapping <em>Java Single Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Single Relationship Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaSingleRelationshipMapping
- * @generated
- */
- public EClass getJavaSingleRelationshipMapping() {
- return javaSingleRelationshipMappingEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToOne <em>Java Many To One</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Many To One</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToOne
- * @generated
- */
- public EClass getJavaManyToOne() {
- return javaManyToOneEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToOne <em>Java One To One</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java One To One</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToOne
- * @generated
- */
- public EClass getJavaOneToOne() {
- return javaOneToOneEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping <em>Java Multi Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Multi Relationship Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping
- * @generated
- */
- public EClass getJavaMultiRelationshipMapping() {
- return javaMultiRelationshipMappingEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToMany <em>Java One To Many</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java One To Many</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToMany
- * @generated
- */
- public EClass getJavaOneToMany() {
- return javaOneToManyEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToMany <em>Java Many To Many</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Many To Many</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToMany
- * @generated
- */
- public EClass getJavaManyToMany() {
- return javaManyToManyEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinTable <em>Java Join Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Join Table</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinTable
- * @generated
- */
- public EClass getJavaJoinTable() {
- return javaJoinTableEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedColumn <em>Java Named Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Named Column</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedColumn
- * @generated
- */
- public EClass getJavaNamedColumn() {
- return javaNamedColumnEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaColumn <em>Abstract Java Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Abstract Java Column</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaColumn
- * @generated
- */
- public EClass getAbstractJavaColumn() {
- return abstractJavaColumnEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinColumn <em>Java Join Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Join Column</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinColumn
- * @generated
- */
- public EClass getJavaJoinColumn() {
- return javaJoinColumnEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaOverride <em>Java Override</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Override</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaOverride
- * @generated
- */
- public EClass getJavaOverride() {
- return javaOverrideEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeOverride <em>Java Attribute Override</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Attribute Override</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeOverride
- * @generated
- */
- public EClass getJavaAttributeOverride() {
- return javaAttributeOverrideEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAssociationOverride <em>Java Association Override</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Association Override</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaAssociationOverride
- * @generated
- */
- public EClass getJavaAssociationOverride() {
- return javaAssociationOverrideEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaDiscriminatorColumn <em>Java Discriminator Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Discriminator Column</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaDiscriminatorColumn
- * @generated
- */
- public EClass getJavaDiscriminatorColumn() {
- return javaDiscriminatorColumnEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaPrimaryKeyJoinColumn <em>Java Primary Key Join Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Primary Key Join Column</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaPrimaryKeyJoinColumn
- * @generated
- */
- public EClass getJavaPrimaryKeyJoinColumn() {
- return javaPrimaryKeyJoinColumnEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaGeneratedValue <em>Java Generated Value</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Generated Value</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaGeneratedValue
- * @generated
- */
- public EClass getJavaGeneratedValue() {
- return javaGeneratedValueEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaGenerator <em>Java Generator</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Generator</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaGenerator
- * @generated
- */
- public EClass getJavaGenerator() {
- return javaGeneratorEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator <em>Java Table Generator</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Table Generator</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator
- * @generated
- */
- public EClass getJavaTableGenerator() {
- return javaTableGeneratorEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaSequenceGenerator <em>Java Sequence Generator</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Sequence Generator</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaSequenceGenerator
- * @generated
- */
- public EClass getJavaSequenceGenerator() {
- return javaSequenceGeneratorEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAbstractQuery <em>Java Abstract Query</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Abstract Query</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaAbstractQuery
- * @generated
- */
- public EClass getJavaAbstractQuery() {
- return javaAbstractQueryEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedQuery <em>Java Named Query</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Named Query</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedQuery
- * @generated
- */
- public EClass getJavaNamedQuery() {
- return javaNamedQueryEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedNativeQuery <em>Java Named Native Query</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Named Native Query</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedNativeQuery
- * @generated
- */
- public EClass getJavaNamedNativeQuery() {
- return javaNamedNativeQueryEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaQueryHint <em>Java Query Hint</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Query Hint</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaQueryHint
- * @generated
- */
- public EClass getJavaQueryHint() {
- return javaQueryHintEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaUniqueConstraint <em>Java Unique Constraint</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Unique Constraint</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaUniqueConstraint
- * @generated
- */
- public EClass getJavaUniqueConstraint() {
- return javaUniqueConstraintEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaCascade <em>Java Cascade</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Cascade</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaCascade
- * @generated
- */
- public EClass getJavaCascade() {
- return javaCascadeEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaSecondaryTable <em>Java Secondary Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Secondary Table</em>'.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaSecondaryTable
- * @generated
- */
- public EClass getJavaSecondaryTable() {
- return javaSecondaryTableEClass;
- }
-
- /**
- * Returns the factory that creates the instances of the model.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the factory that creates the instances of the model.
- * @generated
- */
- public JpaJavaMappingsFactory getJpaJavaMappingsFactory() {
- return (JpaJavaMappingsFactory) getEFactoryInstance();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isCreated = false;
-
- /**
- * Creates the meta-model objects for the package. This method is
- * guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void createPackageContents() {
- if (isCreated)
- return;
- isCreated = true;
- // Create classes and their features
- iJavaEntityEClass = createEClass(IJAVA_ENTITY);
- iJavaEmbeddableEClass = createEClass(IJAVA_EMBEDDABLE);
- iJavaMappedSuperclassEClass = createEClass(IJAVA_MAPPED_SUPERCLASS);
- iJavaBasicEClass = createEClass(IJAVA_BASIC);
- iJavaEmbeddedEClass = createEClass(IJAVA_EMBEDDED);
- iJavaEmbeddedIdEClass = createEClass(IJAVA_EMBEDDED_ID);
- iJavaIdEClass = createEClass(IJAVA_ID);
- iJavaManyToManyEClass = createEClass(IJAVA_MANY_TO_MANY);
- iJavaManyToOneEClass = createEClass(IJAVA_MANY_TO_ONE);
- iJavaOneToManyEClass = createEClass(IJAVA_ONE_TO_MANY);
- iJavaOneToOneEClass = createEClass(IJAVA_ONE_TO_ONE);
- iJavaTransientEClass = createEClass(IJAVA_TRANSIENT);
- iJavaVersionEClass = createEClass(IJAVA_VERSION);
- javaTypeMappingEClass = createEClass(JAVA_TYPE_MAPPING);
- javaEntityEClass = createEClass(JAVA_ENTITY);
- javaMappedSuperclassEClass = createEClass(JAVA_MAPPED_SUPERCLASS);
- javaEmbeddableEClass = createEClass(JAVA_EMBEDDABLE);
- javaNullTypeMappingEClass = createEClass(JAVA_NULL_TYPE_MAPPING);
- javaAttributeMappingEClass = createEClass(JAVA_ATTRIBUTE_MAPPING);
- javaBasicEClass = createEClass(JAVA_BASIC);
- javaIdEClass = createEClass(JAVA_ID);
- javaTransientEClass = createEClass(JAVA_TRANSIENT);
- javaVersionEClass = createEClass(JAVA_VERSION);
- javaEmbeddedIdEClass = createEClass(JAVA_EMBEDDED_ID);
- javaEmbeddedEClass = createEClass(JAVA_EMBEDDED);
- javaRelationshipMappingEClass = createEClass(JAVA_RELATIONSHIP_MAPPING);
- javaSingleRelationshipMappingEClass = createEClass(JAVA_SINGLE_RELATIONSHIP_MAPPING);
- javaManyToOneEClass = createEClass(JAVA_MANY_TO_ONE);
- javaOneToOneEClass = createEClass(JAVA_ONE_TO_ONE);
- javaMultiRelationshipMappingEClass = createEClass(JAVA_MULTI_RELATIONSHIP_MAPPING);
- javaOneToManyEClass = createEClass(JAVA_ONE_TO_MANY);
- javaManyToManyEClass = createEClass(JAVA_MANY_TO_MANY);
- javaNullAttributeMappingEClass = createEClass(JAVA_NULL_ATTRIBUTE_MAPPING);
- abstractJavaTableEClass = createEClass(ABSTRACT_JAVA_TABLE);
- javaTableEClass = createEClass(JAVA_TABLE);
- javaSecondaryTableEClass = createEClass(JAVA_SECONDARY_TABLE);
- javaJoinTableEClass = createEClass(JAVA_JOIN_TABLE);
- javaNamedColumnEClass = createEClass(JAVA_NAMED_COLUMN);
- abstractJavaColumnEClass = createEClass(ABSTRACT_JAVA_COLUMN);
- javaColumnEClass = createEClass(JAVA_COLUMN);
- javaJoinColumnEClass = createEClass(JAVA_JOIN_COLUMN);
- javaOverrideEClass = createEClass(JAVA_OVERRIDE);
- javaAttributeOverrideEClass = createEClass(JAVA_ATTRIBUTE_OVERRIDE);
- javaAssociationOverrideEClass = createEClass(JAVA_ASSOCIATION_OVERRIDE);
- javaDiscriminatorColumnEClass = createEClass(JAVA_DISCRIMINATOR_COLUMN);
- javaPrimaryKeyJoinColumnEClass = createEClass(JAVA_PRIMARY_KEY_JOIN_COLUMN);
- javaGeneratedValueEClass = createEClass(JAVA_GENERATED_VALUE);
- javaGeneratorEClass = createEClass(JAVA_GENERATOR);
- javaTableGeneratorEClass = createEClass(JAVA_TABLE_GENERATOR);
- javaSequenceGeneratorEClass = createEClass(JAVA_SEQUENCE_GENERATOR);
- javaAbstractQueryEClass = createEClass(JAVA_ABSTRACT_QUERY);
- javaNamedQueryEClass = createEClass(JAVA_NAMED_QUERY);
- javaNamedNativeQueryEClass = createEClass(JAVA_NAMED_NATIVE_QUERY);
- javaQueryHintEClass = createEClass(JAVA_QUERY_HINT);
- javaUniqueConstraintEClass = createEClass(JAVA_UNIQUE_CONSTRAINT);
- javaCascadeEClass = createEClass(JAVA_CASCADE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isInitialized = false;
-
- /**
- * Complete the initialization of the package and its meta-model. This
- * method is guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void initializePackageContents() {
- if (isInitialized)
- return;
- isInitialized = true;
- // Initialize package
- setName(eNAME);
- setNsPrefix(eNS_PREFIX);
- setNsURI(eNS_URI);
- // Obtain other dependent packages
- JpaJavaPackage theJpaJavaPackage = (JpaJavaPackage) EPackage.Registry.INSTANCE.getEPackage(JpaJavaPackage.eNS_URI);
- JpaCoreMappingsPackage theJpaCoreMappingsPackage = (JpaCoreMappingsPackage) EPackage.Registry.INSTANCE.getEPackage(JpaCoreMappingsPackage.eNS_URI);
- // Create type parameters
- // Set bounds for type parameters
- // Add supertypes to classes
- iJavaEntityEClass.getESuperTypes().add(theJpaJavaPackage.getIJavaTypeMapping());
- iJavaEntityEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIEntity());
- iJavaEmbeddableEClass.getESuperTypes().add(theJpaJavaPackage.getIJavaTypeMapping());
- iJavaEmbeddableEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIEmbeddable());
- iJavaMappedSuperclassEClass.getESuperTypes().add(theJpaJavaPackage.getIJavaTypeMapping());
- iJavaMappedSuperclassEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIMappedSuperclass());
- iJavaBasicEClass.getESuperTypes().add(theJpaJavaPackage.getIJavaAttributeMapping());
- iJavaBasicEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIBasic());
- iJavaEmbeddedEClass.getESuperTypes().add(theJpaJavaPackage.getIJavaAttributeMapping());
- iJavaEmbeddedEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIEmbedded());
- iJavaEmbeddedIdEClass.getESuperTypes().add(theJpaJavaPackage.getIJavaAttributeMapping());
- iJavaEmbeddedIdEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIEmbeddedId());
- iJavaIdEClass.getESuperTypes().add(theJpaJavaPackage.getIJavaAttributeMapping());
- iJavaIdEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIId());
- iJavaManyToManyEClass.getESuperTypes().add(theJpaJavaPackage.getIJavaAttributeMapping());
- iJavaManyToManyEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIManyToMany());
- iJavaManyToOneEClass.getESuperTypes().add(theJpaJavaPackage.getIJavaAttributeMapping());
- iJavaManyToOneEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIManyToOne());
- iJavaOneToManyEClass.getESuperTypes().add(theJpaJavaPackage.getIJavaAttributeMapping());
- iJavaOneToManyEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIOneToMany());
- iJavaOneToOneEClass.getESuperTypes().add(theJpaJavaPackage.getIJavaAttributeMapping());
- iJavaOneToOneEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIOneToOne());
- iJavaTransientEClass.getESuperTypes().add(theJpaJavaPackage.getIJavaAttributeMapping());
- iJavaTransientEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getITransient());
- iJavaVersionEClass.getESuperTypes().add(theJpaJavaPackage.getIJavaAttributeMapping());
- iJavaVersionEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIVersion());
- javaTypeMappingEClass.getESuperTypes().add(theJpaJavaPackage.getJavaEObject());
- javaTypeMappingEClass.getESuperTypes().add(theJpaJavaPackage.getIJavaTypeMapping());
- javaEntityEClass.getESuperTypes().add(this.getJavaTypeMapping());
- javaEntityEClass.getESuperTypes().add(this.getIJavaEntity());
- javaMappedSuperclassEClass.getESuperTypes().add(this.getJavaTypeMapping());
- javaMappedSuperclassEClass.getESuperTypes().add(this.getIJavaMappedSuperclass());
- javaEmbeddableEClass.getESuperTypes().add(this.getJavaTypeMapping());
- javaEmbeddableEClass.getESuperTypes().add(this.getIJavaEmbeddable());
- javaNullTypeMappingEClass.getESuperTypes().add(this.getJavaTypeMapping());
- javaAttributeMappingEClass.getESuperTypes().add(theJpaJavaPackage.getJavaEObject());
- javaAttributeMappingEClass.getESuperTypes().add(theJpaJavaPackage.getIJavaAttributeMapping());
- javaBasicEClass.getESuperTypes().add(this.getJavaAttributeMapping());
- javaBasicEClass.getESuperTypes().add(this.getIJavaBasic());
- javaIdEClass.getESuperTypes().add(this.getJavaAttributeMapping());
- javaIdEClass.getESuperTypes().add(this.getIJavaId());
- javaTransientEClass.getESuperTypes().add(this.getJavaAttributeMapping());
- javaTransientEClass.getESuperTypes().add(this.getIJavaTransient());
- javaVersionEClass.getESuperTypes().add(this.getJavaAttributeMapping());
- javaVersionEClass.getESuperTypes().add(this.getIJavaVersion());
- javaEmbeddedIdEClass.getESuperTypes().add(this.getJavaAttributeMapping());
- javaEmbeddedIdEClass.getESuperTypes().add(this.getIJavaEmbeddedId());
- javaEmbeddedEClass.getESuperTypes().add(this.getJavaAttributeMapping());
- javaEmbeddedEClass.getESuperTypes().add(this.getIJavaEmbedded());
- javaRelationshipMappingEClass.getESuperTypes().add(this.getJavaAttributeMapping());
- javaRelationshipMappingEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIRelationshipMapping());
- javaSingleRelationshipMappingEClass.getESuperTypes().add(this.getJavaRelationshipMapping());
- javaSingleRelationshipMappingEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getISingleRelationshipMapping());
- javaManyToOneEClass.getESuperTypes().add(this.getJavaSingleRelationshipMapping());
- javaManyToOneEClass.getESuperTypes().add(this.getIJavaManyToOne());
- javaOneToOneEClass.getESuperTypes().add(this.getJavaSingleRelationshipMapping());
- javaOneToOneEClass.getESuperTypes().add(this.getIJavaOneToOne());
- javaMultiRelationshipMappingEClass.getESuperTypes().add(this.getJavaRelationshipMapping());
- javaMultiRelationshipMappingEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIMultiRelationshipMapping());
- javaOneToManyEClass.getESuperTypes().add(this.getJavaMultiRelationshipMapping());
- javaOneToManyEClass.getESuperTypes().add(this.getIJavaOneToMany());
- javaManyToManyEClass.getESuperTypes().add(this.getJavaMultiRelationshipMapping());
- javaManyToManyEClass.getESuperTypes().add(this.getIJavaManyToMany());
- javaNullAttributeMappingEClass.getESuperTypes().add(this.getJavaAttributeMapping());
- abstractJavaTableEClass.getESuperTypes().add(theJpaJavaPackage.getJavaEObject());
- abstractJavaTableEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getITable());
- javaTableEClass.getESuperTypes().add(this.getAbstractJavaTable());
- javaSecondaryTableEClass.getESuperTypes().add(this.getAbstractJavaTable());
- javaSecondaryTableEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getISecondaryTable());
- javaJoinTableEClass.getESuperTypes().add(this.getAbstractJavaTable());
- javaJoinTableEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIJoinTable());
- javaNamedColumnEClass.getESuperTypes().add(theJpaJavaPackage.getJavaEObject());
- javaNamedColumnEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getINamedColumn());
- abstractJavaColumnEClass.getESuperTypes().add(this.getJavaNamedColumn());
- abstractJavaColumnEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIAbstractColumn());
- javaColumnEClass.getESuperTypes().add(this.getAbstractJavaColumn());
- javaColumnEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIColumn());
- javaJoinColumnEClass.getESuperTypes().add(this.getAbstractJavaColumn());
- javaJoinColumnEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIJoinColumn());
- javaOverrideEClass.getESuperTypes().add(theJpaJavaPackage.getJavaEObject());
- javaOverrideEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIOverride());
- javaAttributeOverrideEClass.getESuperTypes().add(this.getJavaOverride());
- javaAttributeOverrideEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIAttributeOverride());
- javaAssociationOverrideEClass.getESuperTypes().add(this.getJavaOverride());
- javaAssociationOverrideEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIAssociationOverride());
- javaDiscriminatorColumnEClass.getESuperTypes().add(this.getJavaNamedColumn());
- javaDiscriminatorColumnEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIDiscriminatorColumn());
- javaPrimaryKeyJoinColumnEClass.getESuperTypes().add(this.getJavaNamedColumn());
- javaPrimaryKeyJoinColumnEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIPrimaryKeyJoinColumn());
- javaGeneratedValueEClass.getESuperTypes().add(theJpaJavaPackage.getJavaEObject());
- javaGeneratedValueEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIGeneratedValue());
- javaGeneratorEClass.getESuperTypes().add(theJpaJavaPackage.getJavaEObject());
- javaGeneratorEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIGenerator());
- javaTableGeneratorEClass.getESuperTypes().add(this.getJavaGenerator());
- javaTableGeneratorEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getITableGenerator());
- javaSequenceGeneratorEClass.getESuperTypes().add(this.getJavaGenerator());
- javaSequenceGeneratorEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getISequenceGenerator());
- javaAbstractQueryEClass.getESuperTypes().add(theJpaJavaPackage.getJavaEObject());
- javaAbstractQueryEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIQuery());
- javaNamedQueryEClass.getESuperTypes().add(this.getJavaAbstractQuery());
- javaNamedQueryEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getINamedQuery());
- javaNamedNativeQueryEClass.getESuperTypes().add(this.getJavaAbstractQuery());
- javaNamedNativeQueryEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getINamedNativeQuery());
- javaQueryHintEClass.getESuperTypes().add(theJpaJavaPackage.getJavaEObject());
- javaQueryHintEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIQueryHint());
- javaUniqueConstraintEClass.getESuperTypes().add(theJpaJavaPackage.getJavaEObject());
- javaUniqueConstraintEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIUniqueConstraint());
- javaCascadeEClass.getESuperTypes().add(theJpaJavaPackage.getJavaEObject());
- javaCascadeEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getICascade());
- // Initialize classes and features; add operations and parameters
- initEClass(iJavaEntityEClass, IJavaEntity.class, "IJavaEntity", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iJavaEmbeddableEClass, IJavaEmbeddable.class, "IJavaEmbeddable", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iJavaMappedSuperclassEClass, IJavaMappedSuperclass.class, "IJavaMappedSuperclass", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iJavaBasicEClass, IJavaBasic.class, "IJavaBasic", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iJavaEmbeddedEClass, IJavaEmbedded.class, "IJavaEmbedded", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iJavaEmbeddedIdEClass, IJavaEmbeddedId.class, "IJavaEmbeddedId", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iJavaIdEClass, IJavaId.class, "IJavaId", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iJavaManyToManyEClass, IJavaManyToMany.class, "IJavaManyToMany", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iJavaManyToOneEClass, IJavaManyToOne.class, "IJavaManyToOne", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iJavaOneToManyEClass, IJavaOneToMany.class, "IJavaOneToMany", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iJavaOneToOneEClass, IJavaOneToOne.class, "IJavaOneToOne", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iJavaTransientEClass, IJavaTransient.class, "IJavaTransient", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iJavaVersionEClass, IJavaVersion.class, "IJavaVersion", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaTypeMappingEClass, JavaTypeMapping.class, "JavaTypeMapping", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaEntityEClass, JavaEntity.class, "JavaEntity", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaMappedSuperclassEClass, JavaMappedSuperclass.class, "JavaMappedSuperclass", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaEmbeddableEClass, JavaEmbeddable.class, "JavaEmbeddable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaNullTypeMappingEClass, JavaNullTypeMapping.class, "JavaNullTypeMapping", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaAttributeMappingEClass, JavaAttributeMapping.class, "JavaAttributeMapping", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaBasicEClass, JavaBasic.class, "JavaBasic", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaIdEClass, JavaId.class, "JavaId", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaTransientEClass, JavaTransient.class, "JavaTransient", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaVersionEClass, JavaVersion.class, "JavaVersion", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaEmbeddedIdEClass, JavaEmbeddedId.class, "JavaEmbeddedId", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaEmbeddedEClass, JavaEmbedded.class, "JavaEmbedded", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaRelationshipMappingEClass, JavaRelationshipMapping.class, "JavaRelationshipMapping", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaSingleRelationshipMappingEClass, JavaSingleRelationshipMapping.class, "JavaSingleRelationshipMapping", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaManyToOneEClass, JavaManyToOne.class, "JavaManyToOne", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaOneToOneEClass, JavaOneToOne.class, "JavaOneToOne", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaMultiRelationshipMappingEClass, JavaMultiRelationshipMapping.class, "JavaMultiRelationshipMapping", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaOneToManyEClass, JavaOneToMany.class, "JavaOneToMany", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaManyToManyEClass, JavaManyToMany.class, "JavaManyToMany", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaNullAttributeMappingEClass, JavaNullAttributeMapping.class, "JavaNullAttributeMapping", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(abstractJavaTableEClass, AbstractJavaTable.class, "AbstractJavaTable", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaTableEClass, JavaTable.class, "JavaTable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaSecondaryTableEClass, JavaSecondaryTable.class, "JavaSecondaryTable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaJoinTableEClass, JavaJoinTable.class, "JavaJoinTable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaNamedColumnEClass, JavaNamedColumn.class, "JavaNamedColumn", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(abstractJavaColumnEClass, AbstractJavaColumn.class, "AbstractJavaColumn", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaColumnEClass, JavaColumn.class, "JavaColumn", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaJoinColumnEClass, JavaJoinColumn.class, "JavaJoinColumn", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaOverrideEClass, JavaOverride.class, "JavaOverride", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaAttributeOverrideEClass, JavaAttributeOverride.class, "JavaAttributeOverride", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaAssociationOverrideEClass, JavaAssociationOverride.class, "JavaAssociationOverride", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaDiscriminatorColumnEClass, JavaDiscriminatorColumn.class, "JavaDiscriminatorColumn", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaPrimaryKeyJoinColumnEClass, JavaPrimaryKeyJoinColumn.class, "JavaPrimaryKeyJoinColumn", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaGeneratedValueEClass, JavaGeneratedValue.class, "JavaGeneratedValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaGeneratorEClass, JavaGenerator.class, "JavaGenerator", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaTableGeneratorEClass, JavaTableGenerator.class, "JavaTableGenerator", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaSequenceGeneratorEClass, JavaSequenceGenerator.class, "JavaSequenceGenerator", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaAbstractQueryEClass, JavaAbstractQuery.class, "JavaAbstractQuery", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaNamedQueryEClass, JavaNamedQuery.class, "JavaNamedQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaNamedNativeQueryEClass, JavaNamedNativeQuery.class, "JavaNamedNativeQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaQueryHintEClass, JavaQueryHint.class, "JavaQueryHint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaUniqueConstraintEClass, JavaUniqueConstraint.class, "JavaUniqueConstraint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(javaCascadeEClass, JavaCascade.class, "JavaCascade", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- }
-
-
- /**
- * <!-- begin-user-doc -->
- * Defines literals for the meta objects that represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @generated
- */
- public interface Literals
- {
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaEntity <em>IJava Entity</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaEntity
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaEntity()
- * @generated
- */
- public static final EClass IJAVA_ENTITY = eINSTANCE.getIJavaEntity();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddable <em>IJava Embeddable</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddable
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaEmbeddable()
- * @generated
- */
- public static final EClass IJAVA_EMBEDDABLE = eINSTANCE.getIJavaEmbeddable();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaMappedSuperclass <em>IJava Mapped Superclass</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaMappedSuperclass
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaMappedSuperclass()
- * @generated
- */
- public static final EClass IJAVA_MAPPED_SUPERCLASS = eINSTANCE.getIJavaMappedSuperclass();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaBasic <em>IJava Basic</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaBasic
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaBasic()
- * @generated
- */
- public static final EClass IJAVA_BASIC = eINSTANCE.getIJavaBasic();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbedded <em>IJava Embedded</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbedded
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaEmbedded()
- * @generated
- */
- public static final EClass IJAVA_EMBEDDED = eINSTANCE.getIJavaEmbedded();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddedId <em>IJava Embedded Id</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddedId
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaEmbeddedId()
- * @generated
- */
- public static final EClass IJAVA_EMBEDDED_ID = eINSTANCE.getIJavaEmbeddedId();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaId <em>IJava Id</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaId
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaId()
- * @generated
- */
- public static final EClass IJAVA_ID = eINSTANCE.getIJavaId();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToMany <em>IJava Many To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToMany
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaManyToMany()
- * @generated
- */
- public static final EClass IJAVA_MANY_TO_MANY = eINSTANCE.getIJavaManyToMany();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToOne <em>IJava Many To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToOne
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaManyToOne()
- * @generated
- */
- public static final EClass IJAVA_MANY_TO_ONE = eINSTANCE.getIJavaManyToOne();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToMany <em>IJava One To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToMany
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaOneToMany()
- * @generated
- */
- public static final EClass IJAVA_ONE_TO_MANY = eINSTANCE.getIJavaOneToMany();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToOne <em>IJava One To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToOne
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaOneToOne()
- * @generated
- */
- public static final EClass IJAVA_ONE_TO_ONE = eINSTANCE.getIJavaOneToOne();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaTransient <em>IJava Transient</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaTransient
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaTransient()
- * @generated
- */
- public static final EClass IJAVA_TRANSIENT = eINSTANCE.getIJavaTransient();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaVersion <em>IJava Version</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaVersion
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getIJavaVersion()
- * @generated
- */
- public static final EClass IJAVA_VERSION = eINSTANCE.getIJavaVersion();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity <em>Java Entity</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaEntity()
- * @generated
- */
- public static final EClass JAVA_ENTITY = eINSTANCE.getJavaEntity();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaMappedSuperclass <em>Java Mapped Superclass</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaMappedSuperclass
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaMappedSuperclass()
- * @generated
- */
- public static final EClass JAVA_MAPPED_SUPERCLASS = eINSTANCE.getJavaMappedSuperclass();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddable <em>Java Embeddable</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddable
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaEmbeddable()
- * @generated
- */
- public static final EClass JAVA_EMBEDDABLE = eINSTANCE.getJavaEmbeddable();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNullTypeMapping <em>Java Null Type Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNullTypeMapping
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaNullTypeMapping()
- * @generated
- */
- public static final EClass JAVA_NULL_TYPE_MAPPING = eINSTANCE.getJavaNullTypeMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNullAttributeMapping <em>Java Null Attribute Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNullAttributeMapping
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaNullAttributeMapping()
- * @generated
- */
- public static final EClass JAVA_NULL_ATTRIBUTE_MAPPING = eINSTANCE.getJavaNullAttributeMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic <em>Java Basic</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaBasic()
- * @generated
- */
- public static final EClass JAVA_BASIC = eINSTANCE.getJavaBasic();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaId <em>Java Id</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaId
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaId()
- * @generated
- */
- public static final EClass JAVA_ID = eINSTANCE.getJavaId();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTransient <em>Java Transient</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaTransient
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaTransient()
- * @generated
- */
- public static final EClass JAVA_TRANSIENT = eINSTANCE.getJavaTransient();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaVersion <em>Java Version</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaVersion
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaVersion()
- * @generated
- */
- public static final EClass JAVA_VERSION = eINSTANCE.getJavaVersion();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddedId <em>Java Embedded Id</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddedId
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaEmbeddedId()
- * @generated
- */
- public static final EClass JAVA_EMBEDDED_ID = eINSTANCE.getJavaEmbeddedId();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbedded <em>Java Embedded</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbedded
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaEmbedded()
- * @generated
- */
- public static final EClass JAVA_EMBEDDED = eINSTANCE.getJavaEmbedded();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeMapping <em>Java Attribute Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeMapping
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaAttributeMapping()
- * @generated
- */
- public static final EClass JAVA_ATTRIBUTE_MAPPING = eINSTANCE.getJavaAttributeMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTypeMapping <em>Java Type Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaTypeMapping
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaTypeMapping()
- * @generated
- */
- public static final EClass JAVA_TYPE_MAPPING = eINSTANCE.getJavaTypeMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaTable <em>Abstract Java Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaTable
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getAbstractJavaTable()
- * @generated
- */
- public static final EClass ABSTRACT_JAVA_TABLE = eINSTANCE.getAbstractJavaTable();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTable <em>Java Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaTable
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaTable()
- * @generated
- */
- public static final EClass JAVA_TABLE = eINSTANCE.getJavaTable();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaColumn <em>Java Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaColumn
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaColumn()
- * @generated
- */
- public static final EClass JAVA_COLUMN = eINSTANCE.getJavaColumn();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaRelationshipMapping <em>Java Relationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaRelationshipMapping
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaRelationshipMapping()
- * @generated
- */
- public static final EClass JAVA_RELATIONSHIP_MAPPING = eINSTANCE.getJavaRelationshipMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaSingleRelationshipMapping <em>Java Single Relationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaSingleRelationshipMapping
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaSingleRelationshipMapping()
- * @generated
- */
- public static final EClass JAVA_SINGLE_RELATIONSHIP_MAPPING = eINSTANCE.getJavaSingleRelationshipMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToOne <em>Java Many To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToOne
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaManyToOne()
- * @generated
- */
- public static final EClass JAVA_MANY_TO_ONE = eINSTANCE.getJavaManyToOne();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToOne <em>Java One To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToOne
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaOneToOne()
- * @generated
- */
- public static final EClass JAVA_ONE_TO_ONE = eINSTANCE.getJavaOneToOne();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping <em>Java Multi Relationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaMultiRelationshipMapping()
- * @generated
- */
- public static final EClass JAVA_MULTI_RELATIONSHIP_MAPPING = eINSTANCE.getJavaMultiRelationshipMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToMany <em>Java One To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToMany
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaOneToMany()
- * @generated
- */
- public static final EClass JAVA_ONE_TO_MANY = eINSTANCE.getJavaOneToMany();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToMany <em>Java Many To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToMany
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaManyToMany()
- * @generated
- */
- public static final EClass JAVA_MANY_TO_MANY = eINSTANCE.getJavaManyToMany();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinTable <em>Java Join Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinTable
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaJoinTable()
- * @generated
- */
- public static final EClass JAVA_JOIN_TABLE = eINSTANCE.getJavaJoinTable();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedColumn <em>Java Named Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedColumn
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaNamedColumn()
- * @generated
- */
- public static final EClass JAVA_NAMED_COLUMN = eINSTANCE.getJavaNamedColumn();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaColumn <em>Abstract Java Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaColumn
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getAbstractJavaColumn()
- * @generated
- */
- public static final EClass ABSTRACT_JAVA_COLUMN = eINSTANCE.getAbstractJavaColumn();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinColumn <em>Java Join Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinColumn
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaJoinColumn()
- * @generated
- */
- public static final EClass JAVA_JOIN_COLUMN = eINSTANCE.getJavaJoinColumn();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaOverride <em>Java Override</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaOverride
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaOverride()
- * @generated
- */
- public static final EClass JAVA_OVERRIDE = eINSTANCE.getJavaOverride();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeOverride <em>Java Attribute Override</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeOverride
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaAttributeOverride()
- * @generated
- */
- public static final EClass JAVA_ATTRIBUTE_OVERRIDE = eINSTANCE.getJavaAttributeOverride();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAssociationOverride <em>Java Association Override</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaAssociationOverride
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaAssociationOverride()
- * @generated
- */
- public static final EClass JAVA_ASSOCIATION_OVERRIDE = eINSTANCE.getJavaAssociationOverride();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaDiscriminatorColumn <em>Java Discriminator Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaDiscriminatorColumn
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaDiscriminatorColumn()
- * @generated
- */
- public static final EClass JAVA_DISCRIMINATOR_COLUMN = eINSTANCE.getJavaDiscriminatorColumn();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaPrimaryKeyJoinColumn <em>Java Primary Key Join Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaPrimaryKeyJoinColumn
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaPrimaryKeyJoinColumn()
- * @generated
- */
- public static final EClass JAVA_PRIMARY_KEY_JOIN_COLUMN = eINSTANCE.getJavaPrimaryKeyJoinColumn();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaGeneratedValue <em>Java Generated Value</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaGeneratedValue
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaGeneratedValue()
- * @generated
- */
- public static final EClass JAVA_GENERATED_VALUE = eINSTANCE.getJavaGeneratedValue();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaGenerator <em>Java Generator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaGenerator
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaGenerator()
- * @generated
- */
- public static final EClass JAVA_GENERATOR = eINSTANCE.getJavaGenerator();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator <em>Java Table Generator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaTableGenerator()
- * @generated
- */
- public static final EClass JAVA_TABLE_GENERATOR = eINSTANCE.getJavaTableGenerator();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaSequenceGenerator <em>Java Sequence Generator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaSequenceGenerator
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaSequenceGenerator()
- * @generated
- */
- public static final EClass JAVA_SEQUENCE_GENERATOR = eINSTANCE.getJavaSequenceGenerator();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAbstractQuery <em>Java Abstract Query</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaAbstractQuery
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaAbstractQuery()
- * @generated
- */
- public static final EClass JAVA_ABSTRACT_QUERY = eINSTANCE.getJavaAbstractQuery();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedQuery <em>Java Named Query</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedQuery
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaNamedQuery()
- * @generated
- */
- public static final EClass JAVA_NAMED_QUERY = eINSTANCE.getJavaNamedQuery();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedNativeQuery <em>Java Named Native Query</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedNativeQuery
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaNamedNativeQuery()
- * @generated
- */
- public static final EClass JAVA_NAMED_NATIVE_QUERY = eINSTANCE.getJavaNamedNativeQuery();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaQueryHint <em>Java Query Hint</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaQueryHint
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaQueryHint()
- * @generated
- */
- public static final EClass JAVA_QUERY_HINT = eINSTANCE.getJavaQueryHint();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaUniqueConstraint <em>Java Unique Constraint</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaUniqueConstraint
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaUniqueConstraint()
- * @generated
- */
- public static final EClass JAVA_UNIQUE_CONSTRAINT = eINSTANCE.getJavaUniqueConstraint();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaCascade <em>Java Cascade</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaCascade
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaCascade()
- * @generated
- */
- public static final EClass JAVA_CASCADE = eINSTANCE.getJavaCascade();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaSecondaryTable <em>Java Secondary Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaSecondaryTable
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaSecondaryTable()
- * @generated
- */
- public static final EClass JAVA_SECONDARY_TABLE = eINSTANCE.getJavaSecondaryTable();
- }
-} //JavaMappingsPackage
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/util/JpaJavaMappingsAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/util/JpaJavaMappingsAdapterFactory.java
deleted file mode 100644
index 8184028df4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/util/JpaJavaMappingsAdapterFactory.java
+++ /dev/null
@@ -1,2204 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings.util;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IJpaEObject;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.JpaEObject;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.JavaEObject;
-import org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaColumn;
-import org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaTable;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaBasic;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddable;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbedded;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddedId;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaEntity;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaId;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToMany;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToOne;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaMappedSuperclass;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToMany;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToOne;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaTransient;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaVersion;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaAbstractQuery;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaAssociationOverride;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeOverride;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaCascade;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaColumn;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddable;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbedded;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddedId;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaGeneratedValue;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaGenerator;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaId;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinColumn;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinTable;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToMany;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToOne;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaMappedSuperclass;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedColumn;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedNativeQuery;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedQuery;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaNullAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaNullTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToMany;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToOne;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaOverride;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaQueryHint;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaRelationshipMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaSecondaryTable;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaSequenceGenerator;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaSingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaTable;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaTransient;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaUniqueConstraint;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaVersion;
-import org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.IAbstractColumn;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.ICascade;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddable;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddedId;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
-import org.eclipse.jpt.core.internal.mappings.IGenerator;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.IManyToMany;
-import org.eclipse.jpt.core.internal.mappings.IManyToOne;
-import org.eclipse.jpt.core.internal.mappings.IMappedSuperclass;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedNativeQuery;
-import org.eclipse.jpt.core.internal.mappings.INamedQuery;
-import org.eclipse.jpt.core.internal.mappings.INonOwningMapping;
-import org.eclipse.jpt.core.internal.mappings.IOneToMany;
-import org.eclipse.jpt.core.internal.mappings.IOneToOne;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IQuery;
-import org.eclipse.jpt.core.internal.mappings.IQueryHint;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.mappings.ITransient;
-import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint;
-import org.eclipse.jpt.core.internal.mappings.IVersion;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Adapter Factory</b> for the model.
- * It provides an adapter <code>createXXX</code> method for each class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage
- * @generated
- */
-public class JpaJavaMappingsAdapterFactory extends AdapterFactoryImpl
-{
- /**
- * The cached model package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static JpaJavaMappingsPackage modelPackage;
-
- /**
- * Creates an instance of the adapter factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaJavaMappingsAdapterFactory() {
- if (modelPackage == null) {
- modelPackage = JpaJavaMappingsPackage.eINSTANCE;
- }
- }
-
- /**
- * Returns whether this factory is applicable for the type of the object.
- * <!-- begin-user-doc -->
- * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
- * <!-- end-user-doc -->
- * @return whether this factory is applicable for the type of the object.
- * @generated
- */
- @Override
- public boolean isFactoryForType(Object object) {
- if (object == modelPackage) {
- return true;
- }
- if (object instanceof EObject) {
- return ((EObject) object).eClass().getEPackage() == modelPackage;
- }
- return false;
- }
-
- /**
- * The switch the delegates to the <code>createXXX</code> methods.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected JpaJavaMappingsSwitch<Adapter> modelSwitch = new JpaJavaMappingsSwitch<Adapter>() {
- @Override
- public Adapter caseIJavaEntity(IJavaEntity object) {
- return createIJavaEntityAdapter();
- }
-
- @Override
- public Adapter caseIJavaEmbeddable(IJavaEmbeddable object) {
- return createIJavaEmbeddableAdapter();
- }
-
- @Override
- public Adapter caseIJavaMappedSuperclass(IJavaMappedSuperclass object) {
- return createIJavaMappedSuperclassAdapter();
- }
-
- @Override
- public Adapter caseIJavaBasic(IJavaBasic object) {
- return createIJavaBasicAdapter();
- }
-
- @Override
- public Adapter caseIJavaEmbedded(IJavaEmbedded object) {
- return createIJavaEmbeddedAdapter();
- }
-
- @Override
- public Adapter caseIJavaEmbeddedId(IJavaEmbeddedId object) {
- return createIJavaEmbeddedIdAdapter();
- }
-
- @Override
- public Adapter caseIJavaId(IJavaId object) {
- return createIJavaIdAdapter();
- }
-
- @Override
- public Adapter caseIJavaManyToMany(IJavaManyToMany object) {
- return createIJavaManyToManyAdapter();
- }
-
- @Override
- public Adapter caseIJavaManyToOne(IJavaManyToOne object) {
- return createIJavaManyToOneAdapter();
- }
-
- @Override
- public Adapter caseIJavaOneToMany(IJavaOneToMany object) {
- return createIJavaOneToManyAdapter();
- }
-
- @Override
- public Adapter caseIJavaOneToOne(IJavaOneToOne object) {
- return createIJavaOneToOneAdapter();
- }
-
- @Override
- public Adapter caseIJavaTransient(IJavaTransient object) {
- return createIJavaTransientAdapter();
- }
-
- @Override
- public Adapter caseIJavaVersion(IJavaVersion object) {
- return createIJavaVersionAdapter();
- }
-
- @Override
- public Adapter caseJavaTypeMapping(JavaTypeMapping object) {
- return createJavaTypeMappingAdapter();
- }
-
- @Override
- public Adapter caseJavaEntity(JavaEntity object) {
- return createJavaEntityAdapter();
- }
-
- @Override
- public Adapter caseJavaMappedSuperclass(JavaMappedSuperclass object) {
- return createJavaMappedSuperclassAdapter();
- }
-
- @Override
- public Adapter caseJavaEmbeddable(JavaEmbeddable object) {
- return createJavaEmbeddableAdapter();
- }
-
- @Override
- public Adapter caseJavaNullTypeMapping(JavaNullTypeMapping object) {
- return createJavaNullTypeMappingAdapter();
- }
-
- @Override
- public Adapter caseJavaAttributeMapping(JavaAttributeMapping object) {
- return createJavaAttributeMappingAdapter();
- }
-
- @Override
- public Adapter caseJavaBasic(JavaBasic object) {
- return createJavaBasicAdapter();
- }
-
- @Override
- public Adapter caseJavaId(JavaId object) {
- return createJavaIdAdapter();
- }
-
- @Override
- public Adapter caseJavaTransient(JavaTransient object) {
- return createJavaTransientAdapter();
- }
-
- @Override
- public Adapter caseJavaVersion(JavaVersion object) {
- return createJavaVersionAdapter();
- }
-
- @Override
- public Adapter caseJavaEmbeddedId(JavaEmbeddedId object) {
- return createJavaEmbeddedIdAdapter();
- }
-
- @Override
- public Adapter caseJavaEmbedded(JavaEmbedded object) {
- return createJavaEmbeddedAdapter();
- }
-
- @Override
- public Adapter caseJavaRelationshipMapping(JavaRelationshipMapping object) {
- return createJavaRelationshipMappingAdapter();
- }
-
- @Override
- public Adapter caseJavaSingleRelationshipMapping(JavaSingleRelationshipMapping object) {
- return createJavaSingleRelationshipMappingAdapter();
- }
-
- @Override
- public Adapter caseJavaManyToOne(JavaManyToOne object) {
- return createJavaManyToOneAdapter();
- }
-
- @Override
- public Adapter caseJavaOneToOne(JavaOneToOne object) {
- return createJavaOneToOneAdapter();
- }
-
- @Override
- public Adapter caseJavaMultiRelationshipMapping(JavaMultiRelationshipMapping object) {
- return createJavaMultiRelationshipMappingAdapter();
- }
-
- @Override
- public Adapter caseJavaOneToMany(JavaOneToMany object) {
- return createJavaOneToManyAdapter();
- }
-
- @Override
- public Adapter caseJavaManyToMany(JavaManyToMany object) {
- return createJavaManyToManyAdapter();
- }
-
- @Override
- public Adapter caseJavaNullAttributeMapping(JavaNullAttributeMapping object) {
- return createJavaNullAttributeMappingAdapter();
- }
-
- @Override
- public Adapter caseAbstractJavaTable(AbstractJavaTable object) {
- return createAbstractJavaTableAdapter();
- }
-
- @Override
- public Adapter caseJavaTable(JavaTable object) {
- return createJavaTableAdapter();
- }
-
- @Override
- public Adapter caseJavaSecondaryTable(JavaSecondaryTable object) {
- return createJavaSecondaryTableAdapter();
- }
-
- @Override
- public Adapter caseJavaJoinTable(JavaJoinTable object) {
- return createJavaJoinTableAdapter();
- }
-
- @Override
- public Adapter caseJavaNamedColumn(JavaNamedColumn object) {
- return createJavaNamedColumnAdapter();
- }
-
- @Override
- public Adapter caseAbstractJavaColumn(AbstractJavaColumn object) {
- return createAbstractJavaColumnAdapter();
- }
-
- @Override
- public Adapter caseJavaColumn(JavaColumn object) {
- return createJavaColumnAdapter();
- }
-
- @Override
- public Adapter caseJavaJoinColumn(JavaJoinColumn object) {
- return createJavaJoinColumnAdapter();
- }
-
- @Override
- public Adapter caseJavaOverride(JavaOverride object) {
- return createJavaOverrideAdapter();
- }
-
- @Override
- public Adapter caseJavaAttributeOverride(JavaAttributeOverride object) {
- return createJavaAttributeOverrideAdapter();
- }
-
- @Override
- public Adapter caseJavaAssociationOverride(JavaAssociationOverride object) {
- return createJavaAssociationOverrideAdapter();
- }
-
- @Override
- public Adapter caseJavaDiscriminatorColumn(JavaDiscriminatorColumn object) {
- return createJavaDiscriminatorColumnAdapter();
- }
-
- @Override
- public Adapter caseJavaPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn object) {
- return createJavaPrimaryKeyJoinColumnAdapter();
- }
-
- @Override
- public Adapter caseJavaGeneratedValue(JavaGeneratedValue object) {
- return createJavaGeneratedValueAdapter();
- }
-
- @Override
- public Adapter caseJavaGenerator(JavaGenerator object) {
- return createJavaGeneratorAdapter();
- }
-
- @Override
- public Adapter caseJavaTableGenerator(JavaTableGenerator object) {
- return createJavaTableGeneratorAdapter();
- }
-
- @Override
- public Adapter caseJavaSequenceGenerator(JavaSequenceGenerator object) {
- return createJavaSequenceGeneratorAdapter();
- }
-
- @Override
- public Adapter caseJavaAbstractQuery(JavaAbstractQuery object) {
- return createJavaAbstractQueryAdapter();
- }
-
- @Override
- public Adapter caseJavaNamedQuery(JavaNamedQuery object) {
- return createJavaNamedQueryAdapter();
- }
-
- @Override
- public Adapter caseJavaNamedNativeQuery(JavaNamedNativeQuery object) {
- return createJavaNamedNativeQueryAdapter();
- }
-
- @Override
- public Adapter caseJavaQueryHint(JavaQueryHint object) {
- return createJavaQueryHintAdapter();
- }
-
- @Override
- public Adapter caseJavaUniqueConstraint(JavaUniqueConstraint object) {
- return createJavaUniqueConstraintAdapter();
- }
-
- @Override
- public Adapter caseJavaCascade(JavaCascade object) {
- return createJavaCascadeAdapter();
- }
-
- @Override
- public Adapter caseIJpaEObject(IJpaEObject object) {
- return createIJpaEObjectAdapter();
- }
-
- @Override
- public Adapter caseIJpaSourceObject(IJpaSourceObject object) {
- return createIJpaSourceObjectAdapter();
- }
-
- @Override
- public Adapter caseITypeMapping(ITypeMapping object) {
- return createITypeMappingAdapter();
- }
-
- @Override
- public Adapter caseIJavaTypeMapping(IJavaTypeMapping object) {
- return createIJavaTypeMappingAdapter();
- }
-
- @Override
- public Adapter caseIEntity(IEntity object) {
- return createIEntityAdapter();
- }
-
- @Override
- public Adapter caseIEmbeddable(IEmbeddable object) {
- return createIEmbeddableAdapter();
- }
-
- @Override
- public Adapter caseIMappedSuperclass(IMappedSuperclass object) {
- return createIMappedSuperclassAdapter();
- }
-
- @Override
- public Adapter caseIAttributeMapping(IAttributeMapping object) {
- return createIAttributeMappingAdapter();
- }
-
- @Override
- public Adapter caseIJavaAttributeMapping(IJavaAttributeMapping object) {
- return createIJavaAttributeMappingAdapter();
- }
-
- @Override
- public Adapter caseIColumnMapping(IColumnMapping object) {
- return createIColumnMappingAdapter();
- }
-
- @Override
- public Adapter caseIBasic(IBasic object) {
- return createIBasicAdapter();
- }
-
- @Override
- public Adapter caseIEmbedded(IEmbedded object) {
- return createIEmbeddedAdapter();
- }
-
- @Override
- public Adapter caseIEmbeddedId(IEmbeddedId object) {
- return createIEmbeddedIdAdapter();
- }
-
- @Override
- public Adapter caseIId(IId object) {
- return createIIdAdapter();
- }
-
- @Override
- public Adapter caseIRelationshipMapping(IRelationshipMapping object) {
- return createIRelationshipMappingAdapter();
- }
-
- @Override
- public Adapter caseINonOwningMapping(INonOwningMapping object) {
- return createINonOwningMappingAdapter();
- }
-
- @Override
- public Adapter caseIMultiRelationshipMapping(IMultiRelationshipMapping object) {
- return createIMultiRelationshipMappingAdapter();
- }
-
- @Override
- public Adapter caseIManyToMany(IManyToMany object) {
- return createIManyToManyAdapter();
- }
-
- @Override
- public Adapter caseISingleRelationshipMapping(ISingleRelationshipMapping object) {
- return createISingleRelationshipMappingAdapter();
- }
-
- @Override
- public Adapter caseIManyToOne(IManyToOne object) {
- return createIManyToOneAdapter();
- }
-
- @Override
- public Adapter caseIOneToMany(IOneToMany object) {
- return createIOneToManyAdapter();
- }
-
- @Override
- public Adapter caseIOneToOne(IOneToOne object) {
- return createIOneToOneAdapter();
- }
-
- @Override
- public Adapter caseITransient(ITransient object) {
- return createITransientAdapter();
- }
-
- @Override
- public Adapter caseIVersion(IVersion object) {
- return createIVersionAdapter();
- }
-
- @Override
- public Adapter caseJpaEObject(JpaEObject object) {
- return createJpaEObjectAdapter();
- }
-
- @Override
- public Adapter caseJavaEObject(JavaEObject object) {
- return createJavaEObjectAdapter();
- }
-
- @Override
- public Adapter caseITable(ITable object) {
- return createITableAdapter();
- }
-
- @Override
- public Adapter caseISecondaryTable(ISecondaryTable object) {
- return createISecondaryTableAdapter();
- }
-
- @Override
- public Adapter caseIJoinTable(IJoinTable object) {
- return createIJoinTableAdapter();
- }
-
- @Override
- public Adapter caseINamedColumn(INamedColumn object) {
- return createINamedColumnAdapter();
- }
-
- @Override
- public Adapter caseIAbstractColumn(IAbstractColumn object) {
- return createIAbstractColumnAdapter();
- }
-
- @Override
- public Adapter caseIColumn(IColumn object) {
- return createIColumnAdapter();
- }
-
- @Override
- public Adapter caseIAbstractJoinColumn(IAbstractJoinColumn object) {
- return createIAbstractJoinColumnAdapter();
- }
-
- @Override
- public Adapter caseIJoinColumn(IJoinColumn object) {
- return createIJoinColumnAdapter();
- }
-
- @Override
- public Adapter caseIOverride(IOverride object) {
- return createIOverrideAdapter();
- }
-
- @Override
- public Adapter caseIAttributeOverride(IAttributeOverride object) {
- return createIAttributeOverrideAdapter();
- }
-
- @Override
- public Adapter caseIAssociationOverride(IAssociationOverride object) {
- return createIAssociationOverrideAdapter();
- }
-
- @Override
- public Adapter caseIDiscriminatorColumn(IDiscriminatorColumn object) {
- return createIDiscriminatorColumnAdapter();
- }
-
- @Override
- public Adapter caseIPrimaryKeyJoinColumn(IPrimaryKeyJoinColumn object) {
- return createIPrimaryKeyJoinColumnAdapter();
- }
-
- @Override
- public Adapter caseIGeneratedValue(IGeneratedValue object) {
- return createIGeneratedValueAdapter();
- }
-
- @Override
- public Adapter caseIGenerator(IGenerator object) {
- return createIGeneratorAdapter();
- }
-
- @Override
- public Adapter caseITableGenerator(ITableGenerator object) {
- return createITableGeneratorAdapter();
- }
-
- @Override
- public Adapter caseISequenceGenerator(ISequenceGenerator object) {
- return createISequenceGeneratorAdapter();
- }
-
- @Override
- public Adapter caseIQuery(IQuery object) {
- return createIQueryAdapter();
- }
-
- @Override
- public Adapter caseINamedQuery(INamedQuery object) {
- return createINamedQueryAdapter();
- }
-
- @Override
- public Adapter caseINamedNativeQuery(INamedNativeQuery object) {
- return createINamedNativeQueryAdapter();
- }
-
- @Override
- public Adapter caseIQueryHint(IQueryHint object) {
- return createIQueryHintAdapter();
- }
-
- @Override
- public Adapter caseIUniqueConstraint(IUniqueConstraint object) {
- return createIUniqueConstraintAdapter();
- }
-
- @Override
- public Adapter caseICascade(ICascade object) {
- return createICascadeAdapter();
- }
-
- @Override
- public Adapter defaultCase(EObject object) {
- return createEObjectAdapter();
- }
- };
-
- /**
- * Creates an adapter for the <code>target</code>.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param target the object to adapt.
- * @return the adapter for the <code>target</code>.
- * @generated
- */
- @Override
- public Adapter createAdapter(Notifier target) {
- return modelSwitch.doSwitch((EObject) target);
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaEntity <em>IJava Entity</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaEntity
- * @generated
- */
- public Adapter createIJavaEntityAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddable <em>IJava Embeddable</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddable
- * @generated
- */
- public Adapter createIJavaEmbeddableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaMappedSuperclass <em>IJava Mapped Superclass</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaMappedSuperclass
- * @generated
- */
- public Adapter createIJavaMappedSuperclassAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaBasic <em>IJava Basic</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaBasic
- * @generated
- */
- public Adapter createIJavaBasicAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbedded <em>IJava Embedded</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbedded
- * @generated
- */
- public Adapter createIJavaEmbeddedAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddedId <em>IJava Embedded Id</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddedId
- * @generated
- */
- public Adapter createIJavaEmbeddedIdAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaId <em>IJava Id</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaId
- * @generated
- */
- public Adapter createIJavaIdAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToMany <em>IJava Many To Many</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToMany
- * @generated
- */
- public Adapter createIJavaManyToManyAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToOne <em>IJava Many To One</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToOne
- * @generated
- */
- public Adapter createIJavaManyToOneAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToMany <em>IJava One To Many</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToMany
- * @generated
- */
- public Adapter createIJavaOneToManyAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToOne <em>IJava One To One</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToOne
- * @generated
- */
- public Adapter createIJavaOneToOneAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaTransient <em>IJava Transient</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaTransient
- * @generated
- */
- public Adapter createIJavaTransientAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.IJavaVersion <em>IJava Version</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.IJavaVersion
- * @generated
- */
- public Adapter createIJavaVersionAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity <em>Java Entity</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity
- * @generated
- */
- public Adapter createJavaEntityAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaMappedSuperclass <em>Java Mapped Superclass</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaMappedSuperclass
- * @generated
- */
- public Adapter createJavaMappedSuperclassAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddable <em>Java Embeddable</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddable
- * @generated
- */
- public Adapter createJavaEmbeddableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNullTypeMapping <em>Java Null Type Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNullTypeMapping
- * @generated
- */
- public Adapter createJavaNullTypeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNullAttributeMapping <em>Java Null Attribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNullAttributeMapping
- * @generated
- */
- public Adapter createJavaNullAttributeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic <em>Java Basic</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic
- * @generated
- */
- public Adapter createJavaBasicAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaId <em>Java Id</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaId
- * @generated
- */
- public Adapter createJavaIdAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTransient <em>Java Transient</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaTransient
- * @generated
- */
- public Adapter createJavaTransientAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaVersion <em>Java Version</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaVersion
- * @generated
- */
- public Adapter createJavaVersionAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddedId <em>Java Embedded Id</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddedId
- * @generated
- */
- public Adapter createJavaEmbeddedIdAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbedded <em>Java Embedded</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbedded
- * @generated
- */
- public Adapter createJavaEmbeddedAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeMapping <em>Java Attribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeMapping
- * @generated
- */
- public Adapter createJavaAttributeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTypeMapping <em>Java Type Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaTypeMapping
- * @generated
- */
- public Adapter createJavaTypeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaTable <em>Abstract Java Table</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaTable
- * @generated
- */
- public Adapter createAbstractJavaTableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTable <em>Java Table</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaTable
- * @generated
- */
- public Adapter createJavaTableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaColumn <em>Java Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaColumn
- * @generated
- */
- public Adapter createJavaColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaRelationshipMapping <em>Java Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaRelationshipMapping
- * @generated
- */
- public Adapter createJavaRelationshipMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaSingleRelationshipMapping <em>Java Single Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaSingleRelationshipMapping
- * @generated
- */
- public Adapter createJavaSingleRelationshipMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToMany <em>Java One To Many</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToMany
- * @generated
- */
- public Adapter createJavaOneToManyAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToMany <em>Java Many To Many</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToMany
- * @generated
- */
- public Adapter createJavaManyToManyAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinTable <em>Java Join Table</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinTable
- * @generated
- */
- public Adapter createJavaJoinTableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedColumn <em>Java Named Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedColumn
- * @generated
- */
- public Adapter createJavaNamedColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaColumn <em>Abstract Java Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaColumn
- * @generated
- */
- public Adapter createAbstractJavaColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinColumn <em>Java Join Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinColumn
- * @generated
- */
- public Adapter createJavaJoinColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaOverride <em>Java Override</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaOverride
- * @generated
- */
- public Adapter createJavaOverrideAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeOverride <em>Java Attribute Override</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeOverride
- * @generated
- */
- public Adapter createJavaAttributeOverrideAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAssociationOverride <em>Java Association Override</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaAssociationOverride
- * @generated
- */
- public Adapter createJavaAssociationOverrideAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaDiscriminatorColumn <em>Java Discriminator Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaDiscriminatorColumn
- * @generated
- */
- public Adapter createJavaDiscriminatorColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaPrimaryKeyJoinColumn <em>Java Primary Key Join Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaPrimaryKeyJoinColumn
- * @generated
- */
- public Adapter createJavaPrimaryKeyJoinColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaGeneratedValue <em>Java Generated Value</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaGeneratedValue
- * @generated
- */
- public Adapter createJavaGeneratedValueAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaGenerator <em>Java Generator</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaGenerator
- * @generated
- */
- public Adapter createJavaGeneratorAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator <em>Java Table Generator</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator
- * @generated
- */
- public Adapter createJavaTableGeneratorAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaSequenceGenerator <em>Java Sequence Generator</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaSequenceGenerator
- * @generated
- */
- public Adapter createJavaSequenceGeneratorAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaAbstractQuery <em>Java Abstract Query</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaAbstractQuery
- * @generated
- */
- public Adapter createJavaAbstractQueryAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedQuery <em>Java Named Query</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedQuery
- * @generated
- */
- public Adapter createJavaNamedQueryAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedNativeQuery <em>Java Named Native Query</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedNativeQuery
- * @generated
- */
- public Adapter createJavaNamedNativeQueryAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaQueryHint <em>Java Query Hint</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaQueryHint
- * @generated
- */
- public Adapter createJavaQueryHintAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaUniqueConstraint <em>Java Unique Constraint</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaUniqueConstraint
- * @generated
- */
- public Adapter createJavaUniqueConstraintAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaCascade <em>Java Cascade</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaCascade
- * @generated
- */
- public Adapter createJavaCascadeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaSecondaryTable <em>Java Secondary Table</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaSecondaryTable
- * @generated
- */
- public Adapter createJavaSecondaryTableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaEObject <em>IJpa EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaEObject
- * @generated
- */
- public Adapter createIJpaEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.JpaEObject <em>Jpa EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.JpaEObject
- * @generated
- */
- public Adapter createJpaEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaSourceObject <em>IJpa Source Object</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaSourceObject
- * @generated
- */
- public Adapter createIJpaSourceObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.JavaEObject <em>Java EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.JavaEObject
- * @generated
- */
- public Adapter createJavaEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToOne <em>Java Many To One</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToOne
- * @generated
- */
- public Adapter createJavaManyToOneAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToOne <em>Java One To One</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToOne
- * @generated
- */
- public Adapter createJavaOneToOneAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping <em>Java Multi Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping
- * @generated
- */
- public Adapter createJavaMultiRelationshipMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.ITypeMapping <em>IType Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.ITypeMapping
- * @generated
- */
- public Adapter createITypeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping <em>IJava Type Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping
- * @generated
- */
- public Adapter createIJavaTypeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IEntity <em>IEntity</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity
- * @generated
- */
- public Adapter createIEntityAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IMappedSuperclass <em>IMapped Superclass</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IMappedSuperclass
- * @generated
- */
- public Adapter createIMappedSuperclassAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IEmbeddable <em>IEmbeddable</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IEmbeddable
- * @generated
- */
- public Adapter createIEmbeddableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IAttributeMapping <em>IAttribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IAttributeMapping
- * @generated
- */
- public Adapter createIAttributeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping <em>IJava Attribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping
- * @generated
- */
- public Adapter createIJavaAttributeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IColumnMapping <em>IColumn Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IColumnMapping
- * @generated
- */
- public Adapter createIColumnMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IBasic <em>IBasic</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IBasic
- * @generated
- */
- public Adapter createIBasicAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IId <em>IId</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IId
- * @generated
- */
- public Adapter createIIdAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ITransient <em>ITransient</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ITransient
- * @generated
- */
- public Adapter createITransientAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IVersion <em>IVersion</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IVersion
- * @generated
- */
- public Adapter createIVersionAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IEmbeddedId <em>IEmbedded Id</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IEmbeddedId
- * @generated
- */
- public Adapter createIEmbeddedIdAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IEmbedded <em>IEmbedded</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IEmbedded
- * @generated
- */
- public Adapter createIEmbeddedAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ITable <em>ITable</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ITable
- * @generated
- */
- public Adapter createITableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IColumn <em>IColumn</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IColumn
- * @generated
- */
- public Adapter createIColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn <em>IAbstract Join Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn
- * @generated
- */
- public Adapter createIAbstractJoinColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping <em>IRelationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IRelationshipMapping
- * @generated
- */
- public Adapter createIRelationshipMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping <em>IMulti Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping
- * @generated
- */
- public Adapter createIMultiRelationshipMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IOneToMany <em>IOne To Many</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IOneToMany
- * @generated
- */
- public Adapter createIOneToManyAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IManyToMany <em>IMany To Many</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IManyToMany
- * @generated
- */
- public Adapter createIManyToManyAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IJoinTable <em>IJoin Table</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IJoinTable
- * @generated
- */
- public Adapter createIJoinTableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.INamedColumn <em>INamed Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.INamedColumn
- * @generated
- */
- public Adapter createINamedColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn <em>IAbstract Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractColumn
- * @generated
- */
- public Adapter createIAbstractColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IJoinColumn <em>IJoin Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IJoinColumn
- * @generated
- */
- public Adapter createIJoinColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IOverride <em>IOverride</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IOverride
- * @generated
- */
- public Adapter createIOverrideAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride <em>IAttribute Override</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IAttributeOverride
- * @generated
- */
- public Adapter createIAttributeOverrideAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride <em>IAssociation Override</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IAssociationOverride
- * @generated
- */
- public Adapter createIAssociationOverrideAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn <em>IDiscriminator Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn
- * @generated
- */
- public Adapter createIDiscriminatorColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn <em>IPrimary Key Join Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn
- * @generated
- */
- public Adapter createIPrimaryKeyJoinColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IGeneratedValue <em>IGenerated Value</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IGeneratedValue
- * @generated
- */
- public Adapter createIGeneratedValueAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IGenerator <em>IGenerator</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IGenerator
- * @generated
- */
- public Adapter createIGeneratorAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator <em>ITable Generator</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator
- * @generated
- */
- public Adapter createITableGeneratorAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ISequenceGenerator <em>ISequence Generator</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ISequenceGenerator
- * @generated
- */
- public Adapter createISequenceGeneratorAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IQuery <em>IQuery</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IQuery
- * @generated
- */
- public Adapter createIQueryAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.INamedQuery <em>INamed Query</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.INamedQuery
- * @generated
- */
- public Adapter createINamedQueryAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.INamedNativeQuery <em>INamed Native Query</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.INamedNativeQuery
- * @generated
- */
- public Adapter createINamedNativeQueryAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IQueryHint <em>IQuery Hint</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IQueryHint
- * @generated
- */
- public Adapter createIQueryHintAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IUniqueConstraint <em>IUnique Constraint</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IUniqueConstraint
- * @generated
- */
- public Adapter createIUniqueConstraintAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ICascade <em>ICascade</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ICascade
- * @generated
- */
- public Adapter createICascadeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable <em>ISecondary Table</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ISecondaryTable
- * @generated
- */
- public Adapter createISecondaryTableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping <em>ISingle Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping
- * @generated
- */
- public Adapter createISingleRelationshipMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IManyToOne <em>IMany To One</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IManyToOne
- * @generated
- */
- public Adapter createIManyToOneAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IOneToOne <em>IOne To One</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IOneToOne
- * @generated
- */
- public Adapter createIOneToOneAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.INonOwningMapping <em>INon Owning Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.INonOwningMapping
- * @generated
- */
- public Adapter createINonOwningMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for the default case.
- * <!-- begin-user-doc -->
- * This default implementation returns null.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @generated
- */
- public Adapter createEObjectAdapter() {
- return null;
- }
-} //JavaMappingsAdapterFactory
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/util/JpaJavaMappingsSwitch.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/util/JpaJavaMappingsSwitch.java
deleted file mode 100644
index 162460d653..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/util/JpaJavaMappingsSwitch.java
+++ /dev/null
@@ -1,3024 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.mappings.util;
-
-import java.util.List;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IJpaEObject;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.JpaEObject;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.JavaEObject;
-import org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaColumn;
-import org.eclipse.jpt.core.internal.content.java.mappings.AbstractJavaTable;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaBasic;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddable;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbedded;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddedId;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaEntity;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaId;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToMany;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToOne;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaMappedSuperclass;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToMany;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToOne;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaTransient;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaVersion;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaAbstractQuery;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaAssociationOverride;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeOverride;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaCascade;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaColumn;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddable;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbedded;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddedId;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaGeneratedValue;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaGenerator;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaId;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinColumn;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaJoinTable;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToMany;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToOne;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaMappedSuperclass;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedColumn;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedNativeQuery;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaNamedQuery;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaNullAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaNullTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToMany;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToOne;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaOverride;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaQueryHint;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaRelationshipMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaSecondaryTable;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaSequenceGenerator;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaSingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaTable;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaTableGenerator;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaTransient;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaUniqueConstraint;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaVersion;
-import org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.IAbstractColumn;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.ICascade;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddable;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddedId;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
-import org.eclipse.jpt.core.internal.mappings.IGenerator;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.IManyToMany;
-import org.eclipse.jpt.core.internal.mappings.IManyToOne;
-import org.eclipse.jpt.core.internal.mappings.IMappedSuperclass;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedNativeQuery;
-import org.eclipse.jpt.core.internal.mappings.INamedQuery;
-import org.eclipse.jpt.core.internal.mappings.INonOwningMapping;
-import org.eclipse.jpt.core.internal.mappings.IOneToMany;
-import org.eclipse.jpt.core.internal.mappings.IOneToOne;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IQuery;
-import org.eclipse.jpt.core.internal.mappings.IQueryHint;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.mappings.ITransient;
-import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint;
-import org.eclipse.jpt.core.internal.mappings.IVersion;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Switch</b> for the model's inheritance hierarchy.
- * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
- * to invoke the <code>caseXXX</code> method for each class of the model,
- * starting with the actual class of the object
- * and proceeding up the inheritance hierarchy
- * until a non-null result is returned,
- * which is the result of the switch.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage
- * @generated
- */
-public class JpaJavaMappingsSwitch<T>
-{
- /**
- * The cached model package
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static JpaJavaMappingsPackage modelPackage;
-
- /**
- * Creates an instance of the switch.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaJavaMappingsSwitch() {
- if (modelPackage == null) {
- modelPackage = JpaJavaMappingsPackage.eINSTANCE;
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- public T doSwitch(EObject theEObject) {
- return doSwitch(theEObject.eClass(), theEObject);
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(EClass theEClass, EObject theEObject) {
- if (theEClass.eContainer() == modelPackage) {
- return doSwitch(theEClass.getClassifierID(), theEObject);
- }
- else {
- List<EClass> eSuperTypes = theEClass.getESuperTypes();
- return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), theEObject);
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(int classifierID, EObject theEObject) {
- switch (classifierID) {
- case JpaJavaMappingsPackage.IJAVA_ENTITY : {
- IJavaEntity iJavaEntity = (IJavaEntity) theEObject;
- T result = caseIJavaEntity(iJavaEntity);
- if (result == null)
- result = caseIJavaTypeMapping(iJavaEntity);
- if (result == null)
- result = caseIEntity(iJavaEntity);
- if (result == null)
- result = caseITypeMapping(iJavaEntity);
- if (result == null)
- result = caseIJpaSourceObject(iJavaEntity);
- if (result == null)
- result = caseIJpaEObject(iJavaEntity);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.IJAVA_EMBEDDABLE : {
- IJavaEmbeddable iJavaEmbeddable = (IJavaEmbeddable) theEObject;
- T result = caseIJavaEmbeddable(iJavaEmbeddable);
- if (result == null)
- result = caseIJavaTypeMapping(iJavaEmbeddable);
- if (result == null)
- result = caseIEmbeddable(iJavaEmbeddable);
- if (result == null)
- result = caseITypeMapping(iJavaEmbeddable);
- if (result == null)
- result = caseIJpaSourceObject(iJavaEmbeddable);
- if (result == null)
- result = caseIJpaEObject(iJavaEmbeddable);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.IJAVA_MAPPED_SUPERCLASS : {
- IJavaMappedSuperclass iJavaMappedSuperclass = (IJavaMappedSuperclass) theEObject;
- T result = caseIJavaMappedSuperclass(iJavaMappedSuperclass);
- if (result == null)
- result = caseIJavaTypeMapping(iJavaMappedSuperclass);
- if (result == null)
- result = caseIMappedSuperclass(iJavaMappedSuperclass);
- if (result == null)
- result = caseITypeMapping(iJavaMappedSuperclass);
- if (result == null)
- result = caseIJpaSourceObject(iJavaMappedSuperclass);
- if (result == null)
- result = caseIJpaEObject(iJavaMappedSuperclass);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.IJAVA_BASIC : {
- IJavaBasic iJavaBasic = (IJavaBasic) theEObject;
- T result = caseIJavaBasic(iJavaBasic);
- if (result == null)
- result = caseIJavaAttributeMapping(iJavaBasic);
- if (result == null)
- result = caseIBasic(iJavaBasic);
- if (result == null)
- result = caseIAttributeMapping(iJavaBasic);
- if (result == null)
- result = caseIColumnMapping(iJavaBasic);
- if (result == null)
- result = caseIJpaSourceObject(iJavaBasic);
- if (result == null)
- result = caseIJpaEObject(iJavaBasic);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.IJAVA_EMBEDDED : {
- IJavaEmbedded iJavaEmbedded = (IJavaEmbedded) theEObject;
- T result = caseIJavaEmbedded(iJavaEmbedded);
- if (result == null)
- result = caseIJavaAttributeMapping(iJavaEmbedded);
- if (result == null)
- result = caseIEmbedded(iJavaEmbedded);
- if (result == null)
- result = caseIAttributeMapping(iJavaEmbedded);
- if (result == null)
- result = caseIJpaSourceObject(iJavaEmbedded);
- if (result == null)
- result = caseIJpaEObject(iJavaEmbedded);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.IJAVA_EMBEDDED_ID : {
- IJavaEmbeddedId iJavaEmbeddedId = (IJavaEmbeddedId) theEObject;
- T result = caseIJavaEmbeddedId(iJavaEmbeddedId);
- if (result == null)
- result = caseIJavaAttributeMapping(iJavaEmbeddedId);
- if (result == null)
- result = caseIEmbeddedId(iJavaEmbeddedId);
- if (result == null)
- result = caseIAttributeMapping(iJavaEmbeddedId);
- if (result == null)
- result = caseIJpaSourceObject(iJavaEmbeddedId);
- if (result == null)
- result = caseIJpaEObject(iJavaEmbeddedId);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.IJAVA_ID : {
- IJavaId iJavaId = (IJavaId) theEObject;
- T result = caseIJavaId(iJavaId);
- if (result == null)
- result = caseIJavaAttributeMapping(iJavaId);
- if (result == null)
- result = caseIId(iJavaId);
- if (result == null)
- result = caseIAttributeMapping(iJavaId);
- if (result == null)
- result = caseIColumnMapping(iJavaId);
- if (result == null)
- result = caseIJpaSourceObject(iJavaId);
- if (result == null)
- result = caseIJpaEObject(iJavaId);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.IJAVA_MANY_TO_MANY : {
- IJavaManyToMany iJavaManyToMany = (IJavaManyToMany) theEObject;
- T result = caseIJavaManyToMany(iJavaManyToMany);
- if (result == null)
- result = caseIJavaAttributeMapping(iJavaManyToMany);
- if (result == null)
- result = caseIManyToMany(iJavaManyToMany);
- if (result == null)
- result = caseIAttributeMapping(iJavaManyToMany);
- if (result == null)
- result = caseIMultiRelationshipMapping(iJavaManyToMany);
- if (result == null)
- result = caseIJpaSourceObject(iJavaManyToMany);
- if (result == null)
- result = caseINonOwningMapping(iJavaManyToMany);
- if (result == null)
- result = caseIJpaEObject(iJavaManyToMany);
- if (result == null)
- result = caseIRelationshipMapping(iJavaManyToMany);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.IJAVA_MANY_TO_ONE : {
- IJavaManyToOne iJavaManyToOne = (IJavaManyToOne) theEObject;
- T result = caseIJavaManyToOne(iJavaManyToOne);
- if (result == null)
- result = caseIJavaAttributeMapping(iJavaManyToOne);
- if (result == null)
- result = caseIManyToOne(iJavaManyToOne);
- if (result == null)
- result = caseIAttributeMapping(iJavaManyToOne);
- if (result == null)
- result = caseISingleRelationshipMapping(iJavaManyToOne);
- if (result == null)
- result = caseIJpaSourceObject(iJavaManyToOne);
- if (result == null)
- result = caseIRelationshipMapping(iJavaManyToOne);
- if (result == null)
- result = caseIJpaEObject(iJavaManyToOne);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.IJAVA_ONE_TO_MANY : {
- IJavaOneToMany iJavaOneToMany = (IJavaOneToMany) theEObject;
- T result = caseIJavaOneToMany(iJavaOneToMany);
- if (result == null)
- result = caseIJavaAttributeMapping(iJavaOneToMany);
- if (result == null)
- result = caseIOneToMany(iJavaOneToMany);
- if (result == null)
- result = caseIAttributeMapping(iJavaOneToMany);
- if (result == null)
- result = caseIMultiRelationshipMapping(iJavaOneToMany);
- if (result == null)
- result = caseIJpaSourceObject(iJavaOneToMany);
- if (result == null)
- result = caseINonOwningMapping(iJavaOneToMany);
- if (result == null)
- result = caseIJpaEObject(iJavaOneToMany);
- if (result == null)
- result = caseIRelationshipMapping(iJavaOneToMany);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.IJAVA_ONE_TO_ONE : {
- IJavaOneToOne iJavaOneToOne = (IJavaOneToOne) theEObject;
- T result = caseIJavaOneToOne(iJavaOneToOne);
- if (result == null)
- result = caseIJavaAttributeMapping(iJavaOneToOne);
- if (result == null)
- result = caseIOneToOne(iJavaOneToOne);
- if (result == null)
- result = caseIAttributeMapping(iJavaOneToOne);
- if (result == null)
- result = caseISingleRelationshipMapping(iJavaOneToOne);
- if (result == null)
- result = caseINonOwningMapping(iJavaOneToOne);
- if (result == null)
- result = caseIJpaSourceObject(iJavaOneToOne);
- if (result == null)
- result = caseIRelationshipMapping(iJavaOneToOne);
- if (result == null)
- result = caseIJpaEObject(iJavaOneToOne);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.IJAVA_TRANSIENT : {
- IJavaTransient iJavaTransient = (IJavaTransient) theEObject;
- T result = caseIJavaTransient(iJavaTransient);
- if (result == null)
- result = caseIJavaAttributeMapping(iJavaTransient);
- if (result == null)
- result = caseITransient(iJavaTransient);
- if (result == null)
- result = caseIAttributeMapping(iJavaTransient);
- if (result == null)
- result = caseIJpaSourceObject(iJavaTransient);
- if (result == null)
- result = caseIJpaEObject(iJavaTransient);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.IJAVA_VERSION : {
- IJavaVersion iJavaVersion = (IJavaVersion) theEObject;
- T result = caseIJavaVersion(iJavaVersion);
- if (result == null)
- result = caseIJavaAttributeMapping(iJavaVersion);
- if (result == null)
- result = caseIVersion(iJavaVersion);
- if (result == null)
- result = caseIAttributeMapping(iJavaVersion);
- if (result == null)
- result = caseIColumnMapping(iJavaVersion);
- if (result == null)
- result = caseIJpaSourceObject(iJavaVersion);
- if (result == null)
- result = caseIJpaEObject(iJavaVersion);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_TYPE_MAPPING : {
- JavaTypeMapping javaTypeMapping = (JavaTypeMapping) theEObject;
- T result = caseJavaTypeMapping(javaTypeMapping);
- if (result == null)
- result = caseJavaEObject(javaTypeMapping);
- if (result == null)
- result = caseIJavaTypeMapping(javaTypeMapping);
- if (result == null)
- result = caseJpaEObject(javaTypeMapping);
- if (result == null)
- result = caseIJpaSourceObject(javaTypeMapping);
- if (result == null)
- result = caseITypeMapping(javaTypeMapping);
- if (result == null)
- result = caseIJpaEObject(javaTypeMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_ENTITY : {
- JavaEntity javaEntity = (JavaEntity) theEObject;
- T result = caseJavaEntity(javaEntity);
- if (result == null)
- result = caseJavaTypeMapping(javaEntity);
- if (result == null)
- result = caseIJavaEntity(javaEntity);
- if (result == null)
- result = caseJavaEObject(javaEntity);
- if (result == null)
- result = caseIJavaTypeMapping(javaEntity);
- if (result == null)
- result = caseIEntity(javaEntity);
- if (result == null)
- result = caseJpaEObject(javaEntity);
- if (result == null)
- result = caseIJpaSourceObject(javaEntity);
- if (result == null)
- result = caseITypeMapping(javaEntity);
- if (result == null)
- result = caseIJpaEObject(javaEntity);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_MAPPED_SUPERCLASS : {
- JavaMappedSuperclass javaMappedSuperclass = (JavaMappedSuperclass) theEObject;
- T result = caseJavaMappedSuperclass(javaMappedSuperclass);
- if (result == null)
- result = caseJavaTypeMapping(javaMappedSuperclass);
- if (result == null)
- result = caseIJavaMappedSuperclass(javaMappedSuperclass);
- if (result == null)
- result = caseJavaEObject(javaMappedSuperclass);
- if (result == null)
- result = caseIJavaTypeMapping(javaMappedSuperclass);
- if (result == null)
- result = caseIMappedSuperclass(javaMappedSuperclass);
- if (result == null)
- result = caseJpaEObject(javaMappedSuperclass);
- if (result == null)
- result = caseIJpaSourceObject(javaMappedSuperclass);
- if (result == null)
- result = caseITypeMapping(javaMappedSuperclass);
- if (result == null)
- result = caseIJpaEObject(javaMappedSuperclass);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_EMBEDDABLE : {
- JavaEmbeddable javaEmbeddable = (JavaEmbeddable) theEObject;
- T result = caseJavaEmbeddable(javaEmbeddable);
- if (result == null)
- result = caseJavaTypeMapping(javaEmbeddable);
- if (result == null)
- result = caseIJavaEmbeddable(javaEmbeddable);
- if (result == null)
- result = caseJavaEObject(javaEmbeddable);
- if (result == null)
- result = caseIJavaTypeMapping(javaEmbeddable);
- if (result == null)
- result = caseIEmbeddable(javaEmbeddable);
- if (result == null)
- result = caseJpaEObject(javaEmbeddable);
- if (result == null)
- result = caseIJpaSourceObject(javaEmbeddable);
- if (result == null)
- result = caseITypeMapping(javaEmbeddable);
- if (result == null)
- result = caseIJpaEObject(javaEmbeddable);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_NULL_TYPE_MAPPING : {
- JavaNullTypeMapping javaNullTypeMapping = (JavaNullTypeMapping) theEObject;
- T result = caseJavaNullTypeMapping(javaNullTypeMapping);
- if (result == null)
- result = caseJavaTypeMapping(javaNullTypeMapping);
- if (result == null)
- result = caseJavaEObject(javaNullTypeMapping);
- if (result == null)
- result = caseIJavaTypeMapping(javaNullTypeMapping);
- if (result == null)
- result = caseJpaEObject(javaNullTypeMapping);
- if (result == null)
- result = caseIJpaSourceObject(javaNullTypeMapping);
- if (result == null)
- result = caseITypeMapping(javaNullTypeMapping);
- if (result == null)
- result = caseIJpaEObject(javaNullTypeMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_ATTRIBUTE_MAPPING : {
- JavaAttributeMapping javaAttributeMapping = (JavaAttributeMapping) theEObject;
- T result = caseJavaAttributeMapping(javaAttributeMapping);
- if (result == null)
- result = caseJavaEObject(javaAttributeMapping);
- if (result == null)
- result = caseIJavaAttributeMapping(javaAttributeMapping);
- if (result == null)
- result = caseJpaEObject(javaAttributeMapping);
- if (result == null)
- result = caseIJpaSourceObject(javaAttributeMapping);
- if (result == null)
- result = caseIAttributeMapping(javaAttributeMapping);
- if (result == null)
- result = caseIJpaEObject(javaAttributeMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_BASIC : {
- JavaBasic javaBasic = (JavaBasic) theEObject;
- T result = caseJavaBasic(javaBasic);
- if (result == null)
- result = caseJavaAttributeMapping(javaBasic);
- if (result == null)
- result = caseIJavaBasic(javaBasic);
- if (result == null)
- result = caseJavaEObject(javaBasic);
- if (result == null)
- result = caseIJavaAttributeMapping(javaBasic);
- if (result == null)
- result = caseIBasic(javaBasic);
- if (result == null)
- result = caseJpaEObject(javaBasic);
- if (result == null)
- result = caseIJpaSourceObject(javaBasic);
- if (result == null)
- result = caseIAttributeMapping(javaBasic);
- if (result == null)
- result = caseIColumnMapping(javaBasic);
- if (result == null)
- result = caseIJpaEObject(javaBasic);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_ID : {
- JavaId javaId = (JavaId) theEObject;
- T result = caseJavaId(javaId);
- if (result == null)
- result = caseJavaAttributeMapping(javaId);
- if (result == null)
- result = caseIJavaId(javaId);
- if (result == null)
- result = caseJavaEObject(javaId);
- if (result == null)
- result = caseIJavaAttributeMapping(javaId);
- if (result == null)
- result = caseIId(javaId);
- if (result == null)
- result = caseJpaEObject(javaId);
- if (result == null)
- result = caseIJpaSourceObject(javaId);
- if (result == null)
- result = caseIAttributeMapping(javaId);
- if (result == null)
- result = caseIColumnMapping(javaId);
- if (result == null)
- result = caseIJpaEObject(javaId);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_TRANSIENT : {
- JavaTransient javaTransient = (JavaTransient) theEObject;
- T result = caseJavaTransient(javaTransient);
- if (result == null)
- result = caseJavaAttributeMapping(javaTransient);
- if (result == null)
- result = caseIJavaTransient(javaTransient);
- if (result == null)
- result = caseJavaEObject(javaTransient);
- if (result == null)
- result = caseIJavaAttributeMapping(javaTransient);
- if (result == null)
- result = caseITransient(javaTransient);
- if (result == null)
- result = caseJpaEObject(javaTransient);
- if (result == null)
- result = caseIJpaSourceObject(javaTransient);
- if (result == null)
- result = caseIAttributeMapping(javaTransient);
- if (result == null)
- result = caseIJpaEObject(javaTransient);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_VERSION : {
- JavaVersion javaVersion = (JavaVersion) theEObject;
- T result = caseJavaVersion(javaVersion);
- if (result == null)
- result = caseJavaAttributeMapping(javaVersion);
- if (result == null)
- result = caseIJavaVersion(javaVersion);
- if (result == null)
- result = caseJavaEObject(javaVersion);
- if (result == null)
- result = caseIJavaAttributeMapping(javaVersion);
- if (result == null)
- result = caseIVersion(javaVersion);
- if (result == null)
- result = caseJpaEObject(javaVersion);
- if (result == null)
- result = caseIJpaSourceObject(javaVersion);
- if (result == null)
- result = caseIAttributeMapping(javaVersion);
- if (result == null)
- result = caseIColumnMapping(javaVersion);
- if (result == null)
- result = caseIJpaEObject(javaVersion);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_EMBEDDED_ID : {
- JavaEmbeddedId javaEmbeddedId = (JavaEmbeddedId) theEObject;
- T result = caseJavaEmbeddedId(javaEmbeddedId);
- if (result == null)
- result = caseJavaAttributeMapping(javaEmbeddedId);
- if (result == null)
- result = caseIJavaEmbeddedId(javaEmbeddedId);
- if (result == null)
- result = caseJavaEObject(javaEmbeddedId);
- if (result == null)
- result = caseIJavaAttributeMapping(javaEmbeddedId);
- if (result == null)
- result = caseIEmbeddedId(javaEmbeddedId);
- if (result == null)
- result = caseJpaEObject(javaEmbeddedId);
- if (result == null)
- result = caseIJpaSourceObject(javaEmbeddedId);
- if (result == null)
- result = caseIAttributeMapping(javaEmbeddedId);
- if (result == null)
- result = caseIJpaEObject(javaEmbeddedId);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_EMBEDDED : {
- JavaEmbedded javaEmbedded = (JavaEmbedded) theEObject;
- T result = caseJavaEmbedded(javaEmbedded);
- if (result == null)
- result = caseJavaAttributeMapping(javaEmbedded);
- if (result == null)
- result = caseIJavaEmbedded(javaEmbedded);
- if (result == null)
- result = caseJavaEObject(javaEmbedded);
- if (result == null)
- result = caseIJavaAttributeMapping(javaEmbedded);
- if (result == null)
- result = caseIEmbedded(javaEmbedded);
- if (result == null)
- result = caseJpaEObject(javaEmbedded);
- if (result == null)
- result = caseIJpaSourceObject(javaEmbedded);
- if (result == null)
- result = caseIAttributeMapping(javaEmbedded);
- if (result == null)
- result = caseIJpaEObject(javaEmbedded);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_RELATIONSHIP_MAPPING : {
- JavaRelationshipMapping javaRelationshipMapping = (JavaRelationshipMapping) theEObject;
- T result = caseJavaRelationshipMapping(javaRelationshipMapping);
- if (result == null)
- result = caseJavaAttributeMapping(javaRelationshipMapping);
- if (result == null)
- result = caseIRelationshipMapping(javaRelationshipMapping);
- if (result == null)
- result = caseJavaEObject(javaRelationshipMapping);
- if (result == null)
- result = caseIJavaAttributeMapping(javaRelationshipMapping);
- if (result == null)
- result = caseIAttributeMapping(javaRelationshipMapping);
- if (result == null)
- result = caseJpaEObject(javaRelationshipMapping);
- if (result == null)
- result = caseIJpaSourceObject(javaRelationshipMapping);
- if (result == null)
- result = caseIJpaEObject(javaRelationshipMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_SINGLE_RELATIONSHIP_MAPPING : {
- JavaSingleRelationshipMapping javaSingleRelationshipMapping = (JavaSingleRelationshipMapping) theEObject;
- T result = caseJavaSingleRelationshipMapping(javaSingleRelationshipMapping);
- if (result == null)
- result = caseJavaRelationshipMapping(javaSingleRelationshipMapping);
- if (result == null)
- result = caseISingleRelationshipMapping(javaSingleRelationshipMapping);
- if (result == null)
- result = caseJavaAttributeMapping(javaSingleRelationshipMapping);
- if (result == null)
- result = caseIRelationshipMapping(javaSingleRelationshipMapping);
- if (result == null)
- result = caseJavaEObject(javaSingleRelationshipMapping);
- if (result == null)
- result = caseIJavaAttributeMapping(javaSingleRelationshipMapping);
- if (result == null)
- result = caseIAttributeMapping(javaSingleRelationshipMapping);
- if (result == null)
- result = caseJpaEObject(javaSingleRelationshipMapping);
- if (result == null)
- result = caseIJpaSourceObject(javaSingleRelationshipMapping);
- if (result == null)
- result = caseIJpaEObject(javaSingleRelationshipMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_MANY_TO_ONE : {
- JavaManyToOne javaManyToOne = (JavaManyToOne) theEObject;
- T result = caseJavaManyToOne(javaManyToOne);
- if (result == null)
- result = caseJavaSingleRelationshipMapping(javaManyToOne);
- if (result == null)
- result = caseIJavaManyToOne(javaManyToOne);
- if (result == null)
- result = caseJavaRelationshipMapping(javaManyToOne);
- if (result == null)
- result = caseISingleRelationshipMapping(javaManyToOne);
- if (result == null)
- result = caseIJavaAttributeMapping(javaManyToOne);
- if (result == null)
- result = caseIManyToOne(javaManyToOne);
- if (result == null)
- result = caseJavaAttributeMapping(javaManyToOne);
- if (result == null)
- result = caseIRelationshipMapping(javaManyToOne);
- if (result == null)
- result = caseIAttributeMapping(javaManyToOne);
- if (result == null)
- result = caseJavaEObject(javaManyToOne);
- if (result == null)
- result = caseIJpaSourceObject(javaManyToOne);
- if (result == null)
- result = caseJpaEObject(javaManyToOne);
- if (result == null)
- result = caseIJpaEObject(javaManyToOne);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_ONE_TO_ONE : {
- JavaOneToOne javaOneToOne = (JavaOneToOne) theEObject;
- T result = caseJavaOneToOne(javaOneToOne);
- if (result == null)
- result = caseJavaSingleRelationshipMapping(javaOneToOne);
- if (result == null)
- result = caseIJavaOneToOne(javaOneToOne);
- if (result == null)
- result = caseJavaRelationshipMapping(javaOneToOne);
- if (result == null)
- result = caseISingleRelationshipMapping(javaOneToOne);
- if (result == null)
- result = caseIJavaAttributeMapping(javaOneToOne);
- if (result == null)
- result = caseIOneToOne(javaOneToOne);
- if (result == null)
- result = caseJavaAttributeMapping(javaOneToOne);
- if (result == null)
- result = caseIRelationshipMapping(javaOneToOne);
- if (result == null)
- result = caseIAttributeMapping(javaOneToOne);
- if (result == null)
- result = caseINonOwningMapping(javaOneToOne);
- if (result == null)
- result = caseJavaEObject(javaOneToOne);
- if (result == null)
- result = caseIJpaSourceObject(javaOneToOne);
- if (result == null)
- result = caseJpaEObject(javaOneToOne);
- if (result == null)
- result = caseIJpaEObject(javaOneToOne);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_MULTI_RELATIONSHIP_MAPPING : {
- JavaMultiRelationshipMapping javaMultiRelationshipMapping = (JavaMultiRelationshipMapping) theEObject;
- T result = caseJavaMultiRelationshipMapping(javaMultiRelationshipMapping);
- if (result == null)
- result = caseJavaRelationshipMapping(javaMultiRelationshipMapping);
- if (result == null)
- result = caseIMultiRelationshipMapping(javaMultiRelationshipMapping);
- if (result == null)
- result = caseJavaAttributeMapping(javaMultiRelationshipMapping);
- if (result == null)
- result = caseIRelationshipMapping(javaMultiRelationshipMapping);
- if (result == null)
- result = caseINonOwningMapping(javaMultiRelationshipMapping);
- if (result == null)
- result = caseJavaEObject(javaMultiRelationshipMapping);
- if (result == null)
- result = caseIJavaAttributeMapping(javaMultiRelationshipMapping);
- if (result == null)
- result = caseIAttributeMapping(javaMultiRelationshipMapping);
- if (result == null)
- result = caseJpaEObject(javaMultiRelationshipMapping);
- if (result == null)
- result = caseIJpaSourceObject(javaMultiRelationshipMapping);
- if (result == null)
- result = caseIJpaEObject(javaMultiRelationshipMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_ONE_TO_MANY : {
- JavaOneToMany javaOneToMany = (JavaOneToMany) theEObject;
- T result = caseJavaOneToMany(javaOneToMany);
- if (result == null)
- result = caseJavaMultiRelationshipMapping(javaOneToMany);
- if (result == null)
- result = caseIJavaOneToMany(javaOneToMany);
- if (result == null)
- result = caseJavaRelationshipMapping(javaOneToMany);
- if (result == null)
- result = caseIMultiRelationshipMapping(javaOneToMany);
- if (result == null)
- result = caseIJavaAttributeMapping(javaOneToMany);
- if (result == null)
- result = caseIOneToMany(javaOneToMany);
- if (result == null)
- result = caseJavaAttributeMapping(javaOneToMany);
- if (result == null)
- result = caseIRelationshipMapping(javaOneToMany);
- if (result == null)
- result = caseINonOwningMapping(javaOneToMany);
- if (result == null)
- result = caseIAttributeMapping(javaOneToMany);
- if (result == null)
- result = caseJavaEObject(javaOneToMany);
- if (result == null)
- result = caseIJpaSourceObject(javaOneToMany);
- if (result == null)
- result = caseJpaEObject(javaOneToMany);
- if (result == null)
- result = caseIJpaEObject(javaOneToMany);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_MANY_TO_MANY : {
- JavaManyToMany javaManyToMany = (JavaManyToMany) theEObject;
- T result = caseJavaManyToMany(javaManyToMany);
- if (result == null)
- result = caseJavaMultiRelationshipMapping(javaManyToMany);
- if (result == null)
- result = caseIJavaManyToMany(javaManyToMany);
- if (result == null)
- result = caseJavaRelationshipMapping(javaManyToMany);
- if (result == null)
- result = caseIMultiRelationshipMapping(javaManyToMany);
- if (result == null)
- result = caseIJavaAttributeMapping(javaManyToMany);
- if (result == null)
- result = caseIManyToMany(javaManyToMany);
- if (result == null)
- result = caseJavaAttributeMapping(javaManyToMany);
- if (result == null)
- result = caseIRelationshipMapping(javaManyToMany);
- if (result == null)
- result = caseINonOwningMapping(javaManyToMany);
- if (result == null)
- result = caseIAttributeMapping(javaManyToMany);
- if (result == null)
- result = caseJavaEObject(javaManyToMany);
- if (result == null)
- result = caseIJpaSourceObject(javaManyToMany);
- if (result == null)
- result = caseJpaEObject(javaManyToMany);
- if (result == null)
- result = caseIJpaEObject(javaManyToMany);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_NULL_ATTRIBUTE_MAPPING : {
- JavaNullAttributeMapping javaNullAttributeMapping = (JavaNullAttributeMapping) theEObject;
- T result = caseJavaNullAttributeMapping(javaNullAttributeMapping);
- if (result == null)
- result = caseJavaAttributeMapping(javaNullAttributeMapping);
- if (result == null)
- result = caseJavaEObject(javaNullAttributeMapping);
- if (result == null)
- result = caseIJavaAttributeMapping(javaNullAttributeMapping);
- if (result == null)
- result = caseJpaEObject(javaNullAttributeMapping);
- if (result == null)
- result = caseIJpaSourceObject(javaNullAttributeMapping);
- if (result == null)
- result = caseIAttributeMapping(javaNullAttributeMapping);
- if (result == null)
- result = caseIJpaEObject(javaNullAttributeMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE : {
- AbstractJavaTable abstractJavaTable = (AbstractJavaTable) theEObject;
- T result = caseAbstractJavaTable(abstractJavaTable);
- if (result == null)
- result = caseJavaEObject(abstractJavaTable);
- if (result == null)
- result = caseITable(abstractJavaTable);
- if (result == null)
- result = caseJpaEObject(abstractJavaTable);
- if (result == null)
- result = caseIJpaSourceObject(abstractJavaTable);
- if (result == null)
- result = caseIJpaEObject(abstractJavaTable);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_TABLE : {
- JavaTable javaTable = (JavaTable) theEObject;
- T result = caseJavaTable(javaTable);
- if (result == null)
- result = caseAbstractJavaTable(javaTable);
- if (result == null)
- result = caseJavaEObject(javaTable);
- if (result == null)
- result = caseITable(javaTable);
- if (result == null)
- result = caseJpaEObject(javaTable);
- if (result == null)
- result = caseIJpaSourceObject(javaTable);
- if (result == null)
- result = caseIJpaEObject(javaTable);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_SECONDARY_TABLE : {
- JavaSecondaryTable javaSecondaryTable = (JavaSecondaryTable) theEObject;
- T result = caseJavaSecondaryTable(javaSecondaryTable);
- if (result == null)
- result = caseAbstractJavaTable(javaSecondaryTable);
- if (result == null)
- result = caseISecondaryTable(javaSecondaryTable);
- if (result == null)
- result = caseJavaEObject(javaSecondaryTable);
- if (result == null)
- result = caseITable(javaSecondaryTable);
- if (result == null)
- result = caseJpaEObject(javaSecondaryTable);
- if (result == null)
- result = caseIJpaSourceObject(javaSecondaryTable);
- if (result == null)
- result = caseIJpaEObject(javaSecondaryTable);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_JOIN_TABLE : {
- JavaJoinTable javaJoinTable = (JavaJoinTable) theEObject;
- T result = caseJavaJoinTable(javaJoinTable);
- if (result == null)
- result = caseAbstractJavaTable(javaJoinTable);
- if (result == null)
- result = caseIJoinTable(javaJoinTable);
- if (result == null)
- result = caseJavaEObject(javaJoinTable);
- if (result == null)
- result = caseITable(javaJoinTable);
- if (result == null)
- result = caseJpaEObject(javaJoinTable);
- if (result == null)
- result = caseIJpaSourceObject(javaJoinTable);
- if (result == null)
- result = caseIJpaEObject(javaJoinTable);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_NAMED_COLUMN : {
- JavaNamedColumn javaNamedColumn = (JavaNamedColumn) theEObject;
- T result = caseJavaNamedColumn(javaNamedColumn);
- if (result == null)
- result = caseJavaEObject(javaNamedColumn);
- if (result == null)
- result = caseINamedColumn(javaNamedColumn);
- if (result == null)
- result = caseJpaEObject(javaNamedColumn);
- if (result == null)
- result = caseIJpaSourceObject(javaNamedColumn);
- if (result == null)
- result = caseIJpaEObject(javaNamedColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.ABSTRACT_JAVA_COLUMN : {
- AbstractJavaColumn abstractJavaColumn = (AbstractJavaColumn) theEObject;
- T result = caseAbstractJavaColumn(abstractJavaColumn);
- if (result == null)
- result = caseJavaNamedColumn(abstractJavaColumn);
- if (result == null)
- result = caseIAbstractColumn(abstractJavaColumn);
- if (result == null)
- result = caseJavaEObject(abstractJavaColumn);
- if (result == null)
- result = caseINamedColumn(abstractJavaColumn);
- if (result == null)
- result = caseJpaEObject(abstractJavaColumn);
- if (result == null)
- result = caseIJpaSourceObject(abstractJavaColumn);
- if (result == null)
- result = caseIJpaEObject(abstractJavaColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_COLUMN : {
- JavaColumn javaColumn = (JavaColumn) theEObject;
- T result = caseJavaColumn(javaColumn);
- if (result == null)
- result = caseAbstractJavaColumn(javaColumn);
- if (result == null)
- result = caseIColumn(javaColumn);
- if (result == null)
- result = caseJavaNamedColumn(javaColumn);
- if (result == null)
- result = caseIAbstractColumn(javaColumn);
- if (result == null)
- result = caseJavaEObject(javaColumn);
- if (result == null)
- result = caseINamedColumn(javaColumn);
- if (result == null)
- result = caseJpaEObject(javaColumn);
- if (result == null)
- result = caseIJpaSourceObject(javaColumn);
- if (result == null)
- result = caseIJpaEObject(javaColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_JOIN_COLUMN : {
- JavaJoinColumn javaJoinColumn = (JavaJoinColumn) theEObject;
- T result = caseJavaJoinColumn(javaJoinColumn);
- if (result == null)
- result = caseAbstractJavaColumn(javaJoinColumn);
- if (result == null)
- result = caseIJoinColumn(javaJoinColumn);
- if (result == null)
- result = caseJavaNamedColumn(javaJoinColumn);
- if (result == null)
- result = caseIAbstractColumn(javaJoinColumn);
- if (result == null)
- result = caseIAbstractJoinColumn(javaJoinColumn);
- if (result == null)
- result = caseJavaEObject(javaJoinColumn);
- if (result == null)
- result = caseINamedColumn(javaJoinColumn);
- if (result == null)
- result = caseJpaEObject(javaJoinColumn);
- if (result == null)
- result = caseIJpaSourceObject(javaJoinColumn);
- if (result == null)
- result = caseIJpaEObject(javaJoinColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_OVERRIDE : {
- JavaOverride javaOverride = (JavaOverride) theEObject;
- T result = caseJavaOverride(javaOverride);
- if (result == null)
- result = caseJavaEObject(javaOverride);
- if (result == null)
- result = caseIOverride(javaOverride);
- if (result == null)
- result = caseJpaEObject(javaOverride);
- if (result == null)
- result = caseIJpaSourceObject(javaOverride);
- if (result == null)
- result = caseIJpaEObject(javaOverride);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_ATTRIBUTE_OVERRIDE : {
- JavaAttributeOverride javaAttributeOverride = (JavaAttributeOverride) theEObject;
- T result = caseJavaAttributeOverride(javaAttributeOverride);
- if (result == null)
- result = caseJavaOverride(javaAttributeOverride);
- if (result == null)
- result = caseIAttributeOverride(javaAttributeOverride);
- if (result == null)
- result = caseJavaEObject(javaAttributeOverride);
- if (result == null)
- result = caseIOverride(javaAttributeOverride);
- if (result == null)
- result = caseIColumnMapping(javaAttributeOverride);
- if (result == null)
- result = caseJpaEObject(javaAttributeOverride);
- if (result == null)
- result = caseIJpaSourceObject(javaAttributeOverride);
- if (result == null)
- result = caseIJpaEObject(javaAttributeOverride);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_ASSOCIATION_OVERRIDE : {
- JavaAssociationOverride javaAssociationOverride = (JavaAssociationOverride) theEObject;
- T result = caseJavaAssociationOverride(javaAssociationOverride);
- if (result == null)
- result = caseJavaOverride(javaAssociationOverride);
- if (result == null)
- result = caseIAssociationOverride(javaAssociationOverride);
- if (result == null)
- result = caseJavaEObject(javaAssociationOverride);
- if (result == null)
- result = caseIOverride(javaAssociationOverride);
- if (result == null)
- result = caseJpaEObject(javaAssociationOverride);
- if (result == null)
- result = caseIJpaSourceObject(javaAssociationOverride);
- if (result == null)
- result = caseIJpaEObject(javaAssociationOverride);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_DISCRIMINATOR_COLUMN : {
- JavaDiscriminatorColumn javaDiscriminatorColumn = (JavaDiscriminatorColumn) theEObject;
- T result = caseJavaDiscriminatorColumn(javaDiscriminatorColumn);
- if (result == null)
- result = caseJavaNamedColumn(javaDiscriminatorColumn);
- if (result == null)
- result = caseIDiscriminatorColumn(javaDiscriminatorColumn);
- if (result == null)
- result = caseJavaEObject(javaDiscriminatorColumn);
- if (result == null)
- result = caseINamedColumn(javaDiscriminatorColumn);
- if (result == null)
- result = caseJpaEObject(javaDiscriminatorColumn);
- if (result == null)
- result = caseIJpaSourceObject(javaDiscriminatorColumn);
- if (result == null)
- result = caseIJpaEObject(javaDiscriminatorColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_PRIMARY_KEY_JOIN_COLUMN : {
- JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn = (JavaPrimaryKeyJoinColumn) theEObject;
- T result = caseJavaPrimaryKeyJoinColumn(javaPrimaryKeyJoinColumn);
- if (result == null)
- result = caseJavaNamedColumn(javaPrimaryKeyJoinColumn);
- if (result == null)
- result = caseIPrimaryKeyJoinColumn(javaPrimaryKeyJoinColumn);
- if (result == null)
- result = caseJavaEObject(javaPrimaryKeyJoinColumn);
- if (result == null)
- result = caseINamedColumn(javaPrimaryKeyJoinColumn);
- if (result == null)
- result = caseIAbstractJoinColumn(javaPrimaryKeyJoinColumn);
- if (result == null)
- result = caseJpaEObject(javaPrimaryKeyJoinColumn);
- if (result == null)
- result = caseIJpaSourceObject(javaPrimaryKeyJoinColumn);
- if (result == null)
- result = caseIJpaEObject(javaPrimaryKeyJoinColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_GENERATED_VALUE : {
- JavaGeneratedValue javaGeneratedValue = (JavaGeneratedValue) theEObject;
- T result = caseJavaGeneratedValue(javaGeneratedValue);
- if (result == null)
- result = caseJavaEObject(javaGeneratedValue);
- if (result == null)
- result = caseIGeneratedValue(javaGeneratedValue);
- if (result == null)
- result = caseJpaEObject(javaGeneratedValue);
- if (result == null)
- result = caseIJpaSourceObject(javaGeneratedValue);
- if (result == null)
- result = caseIJpaEObject(javaGeneratedValue);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_GENERATOR : {
- JavaGenerator javaGenerator = (JavaGenerator) theEObject;
- T result = caseJavaGenerator(javaGenerator);
- if (result == null)
- result = caseJavaEObject(javaGenerator);
- if (result == null)
- result = caseIGenerator(javaGenerator);
- if (result == null)
- result = caseJpaEObject(javaGenerator);
- if (result == null)
- result = caseIJpaSourceObject(javaGenerator);
- if (result == null)
- result = caseIJpaEObject(javaGenerator);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR : {
- JavaTableGenerator javaTableGenerator = (JavaTableGenerator) theEObject;
- T result = caseJavaTableGenerator(javaTableGenerator);
- if (result == null)
- result = caseJavaGenerator(javaTableGenerator);
- if (result == null)
- result = caseITableGenerator(javaTableGenerator);
- if (result == null)
- result = caseJavaEObject(javaTableGenerator);
- if (result == null)
- result = caseIGenerator(javaTableGenerator);
- if (result == null)
- result = caseJpaEObject(javaTableGenerator);
- if (result == null)
- result = caseIJpaSourceObject(javaTableGenerator);
- if (result == null)
- result = caseIJpaEObject(javaTableGenerator);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_SEQUENCE_GENERATOR : {
- JavaSequenceGenerator javaSequenceGenerator = (JavaSequenceGenerator) theEObject;
- T result = caseJavaSequenceGenerator(javaSequenceGenerator);
- if (result == null)
- result = caseJavaGenerator(javaSequenceGenerator);
- if (result == null)
- result = caseISequenceGenerator(javaSequenceGenerator);
- if (result == null)
- result = caseJavaEObject(javaSequenceGenerator);
- if (result == null)
- result = caseIGenerator(javaSequenceGenerator);
- if (result == null)
- result = caseJpaEObject(javaSequenceGenerator);
- if (result == null)
- result = caseIJpaSourceObject(javaSequenceGenerator);
- if (result == null)
- result = caseIJpaEObject(javaSequenceGenerator);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_ABSTRACT_QUERY : {
- JavaAbstractQuery javaAbstractQuery = (JavaAbstractQuery) theEObject;
- T result = caseJavaAbstractQuery(javaAbstractQuery);
- if (result == null)
- result = caseJavaEObject(javaAbstractQuery);
- if (result == null)
- result = caseIQuery(javaAbstractQuery);
- if (result == null)
- result = caseJpaEObject(javaAbstractQuery);
- if (result == null)
- result = caseIJpaSourceObject(javaAbstractQuery);
- if (result == null)
- result = caseIJpaEObject(javaAbstractQuery);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_NAMED_QUERY : {
- JavaNamedQuery javaNamedQuery = (JavaNamedQuery) theEObject;
- T result = caseJavaNamedQuery(javaNamedQuery);
- if (result == null)
- result = caseJavaAbstractQuery(javaNamedQuery);
- if (result == null)
- result = caseINamedQuery(javaNamedQuery);
- if (result == null)
- result = caseJavaEObject(javaNamedQuery);
- if (result == null)
- result = caseIQuery(javaNamedQuery);
- if (result == null)
- result = caseIJpaSourceObject(javaNamedQuery);
- if (result == null)
- result = caseJpaEObject(javaNamedQuery);
- if (result == null)
- result = caseIJpaEObject(javaNamedQuery);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_NAMED_NATIVE_QUERY : {
- JavaNamedNativeQuery javaNamedNativeQuery = (JavaNamedNativeQuery) theEObject;
- T result = caseJavaNamedNativeQuery(javaNamedNativeQuery);
- if (result == null)
- result = caseJavaAbstractQuery(javaNamedNativeQuery);
- if (result == null)
- result = caseINamedNativeQuery(javaNamedNativeQuery);
- if (result == null)
- result = caseJavaEObject(javaNamedNativeQuery);
- if (result == null)
- result = caseIQuery(javaNamedNativeQuery);
- if (result == null)
- result = caseIJpaSourceObject(javaNamedNativeQuery);
- if (result == null)
- result = caseJpaEObject(javaNamedNativeQuery);
- if (result == null)
- result = caseIJpaEObject(javaNamedNativeQuery);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_QUERY_HINT : {
- JavaQueryHint javaQueryHint = (JavaQueryHint) theEObject;
- T result = caseJavaQueryHint(javaQueryHint);
- if (result == null)
- result = caseJavaEObject(javaQueryHint);
- if (result == null)
- result = caseIQueryHint(javaQueryHint);
- if (result == null)
- result = caseJpaEObject(javaQueryHint);
- if (result == null)
- result = caseIJpaSourceObject(javaQueryHint);
- if (result == null)
- result = caseIJpaEObject(javaQueryHint);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_UNIQUE_CONSTRAINT : {
- JavaUniqueConstraint javaUniqueConstraint = (JavaUniqueConstraint) theEObject;
- T result = caseJavaUniqueConstraint(javaUniqueConstraint);
- if (result == null)
- result = caseJavaEObject(javaUniqueConstraint);
- if (result == null)
- result = caseIUniqueConstraint(javaUniqueConstraint);
- if (result == null)
- result = caseJpaEObject(javaUniqueConstraint);
- if (result == null)
- result = caseIJpaSourceObject(javaUniqueConstraint);
- if (result == null)
- result = caseIJpaEObject(javaUniqueConstraint);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaMappingsPackage.JAVA_CASCADE : {
- JavaCascade javaCascade = (JavaCascade) theEObject;
- T result = caseJavaCascade(javaCascade);
- if (result == null)
- result = caseJavaEObject(javaCascade);
- if (result == null)
- result = caseICascade(javaCascade);
- if (result == null)
- result = caseJpaEObject(javaCascade);
- if (result == null)
- result = caseIJpaSourceObject(javaCascade);
- if (result == null)
- result = caseIJpaEObject(javaCascade);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- default :
- return defaultCase(theEObject);
- }
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava Entity</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava Entity</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaEntity(IJavaEntity object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava Embeddable</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava Embeddable</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaEmbeddable(IJavaEmbeddable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava Mapped Superclass</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava Mapped Superclass</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaMappedSuperclass(IJavaMappedSuperclass object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava Basic</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava Basic</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaBasic(IJavaBasic object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava Embedded</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava Embedded</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaEmbedded(IJavaEmbedded object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava Embedded Id</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava Embedded Id</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaEmbeddedId(IJavaEmbeddedId object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava Id</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava Id</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaId(IJavaId object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava Many To Many</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava Many To Many</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaManyToMany(IJavaManyToMany object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava Many To One</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava Many To One</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaManyToOne(IJavaManyToOne object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava One To Many</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava One To Many</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaOneToMany(IJavaOneToMany object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava One To One</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava One To One</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaOneToOne(IJavaOneToOne object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava Transient</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava Transient</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaTransient(IJavaTransient object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava Version</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava Version</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaVersion(IJavaVersion object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Entity</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Entity</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaEntity(JavaEntity object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Mapped Superclass</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Mapped Superclass</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaMappedSuperclass(JavaMappedSuperclass object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Embeddable</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Embeddable</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaEmbeddable(JavaEmbeddable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Null Type Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Null Type Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaNullTypeMapping(JavaNullTypeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Null Attribute Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Null Attribute Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaNullAttributeMapping(JavaNullAttributeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Basic</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Basic</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaBasic(JavaBasic object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Id</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Id</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaId(JavaId object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Transient</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Transient</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaTransient(JavaTransient object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Version</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Version</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaVersion(JavaVersion object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Embedded Id</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Embedded Id</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaEmbeddedId(JavaEmbeddedId object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Embedded</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Embedded</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaEmbedded(JavaEmbedded object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Attribute Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Attribute Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaAttributeMapping(JavaAttributeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Type Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Type Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaTypeMapping(JavaTypeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Abstract Java Table</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Abstract Java Table</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseAbstractJavaTable(AbstractJavaTable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Table</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Table</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaTable(JavaTable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaColumn(JavaColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Relationship Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Relationship Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaRelationshipMapping(JavaRelationshipMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Single Relationship Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Single Relationship Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaSingleRelationshipMapping(JavaSingleRelationshipMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java One To Many</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java One To Many</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaOneToMany(JavaOneToMany object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Many To Many</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Many To Many</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaManyToMany(JavaManyToMany object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Join Table</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Join Table</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaJoinTable(JavaJoinTable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Named Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Named Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaNamedColumn(JavaNamedColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Abstract Java Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Abstract Java Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseAbstractJavaColumn(AbstractJavaColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Join Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Join Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaJoinColumn(JavaJoinColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Override</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Override</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaOverride(JavaOverride object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Attribute Override</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Attribute Override</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaAttributeOverride(JavaAttributeOverride object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Association Override</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Association Override</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaAssociationOverride(JavaAssociationOverride object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Discriminator Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Discriminator Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaDiscriminatorColumn(JavaDiscriminatorColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Primary Key Join Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Primary Key Join Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Generated Value</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Generated Value</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaGeneratedValue(JavaGeneratedValue object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Generator</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Generator</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaGenerator(JavaGenerator object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Table Generator</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Table Generator</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaTableGenerator(JavaTableGenerator object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Sequence Generator</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Sequence Generator</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaSequenceGenerator(JavaSequenceGenerator object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Abstract Query</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Abstract Query</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaAbstractQuery(JavaAbstractQuery object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Named Query</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Named Query</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaNamedQuery(JavaNamedQuery object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Named Native Query</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Named Native Query</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaNamedNativeQuery(JavaNamedNativeQuery object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Query Hint</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Query Hint</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaQueryHint(JavaQueryHint object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Unique Constraint</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Unique Constraint</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaUniqueConstraint(JavaUniqueConstraint object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Cascade</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Cascade</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaCascade(JavaCascade object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Secondary Table</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Secondary Table</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaSecondaryTable(JavaSecondaryTable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaEObject(IJpaEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Jpa EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Jpa EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJpaEObject(JpaEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa Source Object</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa Source Object</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaSourceObject(IJpaSourceObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaEObject(JavaEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Many To One</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Many To One</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaManyToOne(JavaManyToOne object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java One To One</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java One To One</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaOneToOne(JavaOneToOne object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Multi Relationship Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Multi Relationship Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaMultiRelationshipMapping(JavaMultiRelationshipMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IType Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IType Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseITypeMapping(ITypeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava Type Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava Type Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaTypeMapping(IJavaTypeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IEntity</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IEntity</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIEntity(IEntity object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IMapped Superclass</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IMapped Superclass</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIMappedSuperclass(IMappedSuperclass object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IEmbeddable</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IEmbeddable</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIEmbeddable(IEmbeddable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAttribute Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAttribute Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAttributeMapping(IAttributeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava Attribute Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava Attribute Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaAttributeMapping(IJavaAttributeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IColumn Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IColumn Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIColumnMapping(IColumnMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IBasic</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IBasic</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIBasic(IBasic object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IId</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IId</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIId(IId object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ITransient</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ITransient</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseITransient(ITransient object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IVersion</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IVersion</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIVersion(IVersion object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IEmbedded Id</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IEmbedded Id</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIEmbeddedId(IEmbeddedId object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IEmbedded</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IEmbedded</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIEmbedded(IEmbedded object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ITable</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ITable</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseITable(ITable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IColumn</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IColumn</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIColumn(IColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAbstract Join Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAbstract Join Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAbstractJoinColumn(IAbstractJoinColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IRelationship Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IRelationship Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIRelationshipMapping(IRelationshipMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IMulti Relationship Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IMulti Relationship Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIMultiRelationshipMapping(IMultiRelationshipMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IOne To Many</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IOne To Many</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIOneToMany(IOneToMany object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IMany To Many</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IMany To Many</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIManyToMany(IManyToMany object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJoin Table</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJoin Table</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJoinTable(IJoinTable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>INamed Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>INamed Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseINamedColumn(INamedColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAbstract Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAbstract Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAbstractColumn(IAbstractColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJoin Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJoin Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJoinColumn(IJoinColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IOverride</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IOverride</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIOverride(IOverride object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAttribute Override</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAttribute Override</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAttributeOverride(IAttributeOverride object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAssociation Override</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAssociation Override</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAssociationOverride(IAssociationOverride object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IDiscriminator Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IDiscriminator Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIDiscriminatorColumn(IDiscriminatorColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IPrimary Key Join Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IPrimary Key Join Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIPrimaryKeyJoinColumn(IPrimaryKeyJoinColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IGenerated Value</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IGenerated Value</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIGeneratedValue(IGeneratedValue object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IGenerator</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IGenerator</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIGenerator(IGenerator object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ITable Generator</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ITable Generator</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseITableGenerator(ITableGenerator object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ISequence Generator</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ISequence Generator</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseISequenceGenerator(ISequenceGenerator object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IQuery</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IQuery</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIQuery(IQuery object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>INamed Query</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>INamed Query</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseINamedQuery(INamedQuery object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>INamed Native Query</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>INamed Native Query</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseINamedNativeQuery(INamedNativeQuery object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IQuery Hint</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IQuery Hint</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIQueryHint(IQueryHint object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IUnique Constraint</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IUnique Constraint</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIUniqueConstraint(IUniqueConstraint object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ICascade</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ICascade</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseICascade(ICascade object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ISecondary Table</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ISecondary Table</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseISecondaryTable(ISecondaryTable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ISingle Relationship Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ISingle Relationship Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseISingleRelationshipMapping(ISingleRelationshipMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IMany To One</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IMany To One</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIManyToOne(IManyToOne object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IOne To One</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IOne To One</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIOneToOne(IOneToOne object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>INon Owning Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>INon Owning Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseINonOwningMapping(INonOwningMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch, but this is the last case anyway.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject)
- * @generated
- */
- public T defaultCase(EObject object) {
- return null;
- }
-} //JavaMappingsSwitch
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/util/JpaJavaAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/util/JpaJavaAdapterFactory.java
deleted file mode 100644
index 8dfa5a9bfc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/util/JpaJavaAdapterFactory.java
+++ /dev/null
@@ -1,404 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.util;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IJpaEObject;
-import org.eclipse.jpt.core.internal.IJpaRootContentNode;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.JpaEObject;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.JavaEObject;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit;
-import org.eclipse.jpt.core.internal.content.java.JpaJavaPackage;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Adapter Factory</b> for the model.
- * It provides an adapter <code>createXXX</code> method for each class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage
- * @generated
- */
-public class JpaJavaAdapterFactory extends AdapterFactoryImpl
-{
- /**
- * The cached model package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static JpaJavaPackage modelPackage;
-
- /**
- * Creates an instance of the adapter factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaJavaAdapterFactory() {
- if (modelPackage == null) {
- modelPackage = JpaJavaPackage.eINSTANCE;
- }
- }
-
- /**
- * Returns whether this factory is applicable for the type of the object.
- * <!-- begin-user-doc -->
- * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
- * <!-- end-user-doc -->
- * @return whether this factory is applicable for the type of the object.
- * @generated
- */
- @Override
- public boolean isFactoryForType(Object object) {
- if (object == modelPackage) {
- return true;
- }
- if (object instanceof EObject) {
- return ((EObject) object).eClass().getEPackage() == modelPackage;
- }
- return false;
- }
-
- /**
- * The switch the delegates to the <code>createXXX</code> methods.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected JpaJavaSwitch<Adapter> modelSwitch = new JpaJavaSwitch<Adapter>() {
- @Override
- public Adapter caseJavaEObject(JavaEObject object) {
- return createJavaEObjectAdapter();
- }
-
- @Override
- public Adapter caseJpaCompilationUnit(JpaCompilationUnit object) {
- return createJpaCompilationUnitAdapter();
- }
-
- @Override
- public Adapter caseJavaPersistentType(JavaPersistentType object) {
- return createJavaPersistentTypeAdapter();
- }
-
- @Override
- public Adapter caseJavaPersistentAttribute(JavaPersistentAttribute object) {
- return createJavaPersistentAttributeAdapter();
- }
-
- @Override
- public Adapter caseIJavaTypeMapping(IJavaTypeMapping object) {
- return createIJavaTypeMappingAdapter();
- }
-
- @Override
- public Adapter caseIJavaAttributeMapping(IJavaAttributeMapping object) {
- return createIJavaAttributeMappingAdapter();
- }
-
- @Override
- public Adapter caseIJpaEObject(IJpaEObject object) {
- return createIJpaEObjectAdapter();
- }
-
- @Override
- public Adapter caseJpaEObject(JpaEObject object) {
- return createJpaEObjectAdapter();
- }
-
- @Override
- public Adapter caseIJpaSourceObject(IJpaSourceObject object) {
- return createIJpaSourceObjectAdapter();
- }
-
- @Override
- public Adapter caseIJpaContentNode(IJpaContentNode object) {
- return createIJpaContentNodeAdapter();
- }
-
- @Override
- public Adapter caseIJpaRootContentNode(IJpaRootContentNode object) {
- return createIJpaRootContentNodeAdapter();
- }
-
- @Override
- public Adapter caseIPersistentType(IPersistentType object) {
- return createIPersistentTypeAdapter();
- }
-
- @Override
- public Adapter caseIPersistentAttribute(IPersistentAttribute object) {
- return createIPersistentAttributeAdapter();
- }
-
- @Override
- public Adapter caseITypeMapping(ITypeMapping object) {
- return createITypeMappingAdapter();
- }
-
- @Override
- public Adapter caseIAttributeMapping(IAttributeMapping object) {
- return createIAttributeMappingAdapter();
- }
-
- @Override
- public Adapter defaultCase(EObject object) {
- return createEObjectAdapter();
- }
- };
-
- /**
- * Creates an adapter for the <code>target</code>.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param target the object to adapt.
- * @return the adapter for the <code>target</code>.
- * @generated
- */
- @Override
- public Adapter createAdapter(Notifier target) {
- return modelSwitch.doSwitch((EObject) target);
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping <em>IJava Attribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping
- * @generated
- */
- public Adapter createIJavaAttributeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping <em>IJava Type Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping
- * @generated
- */
- public Adapter createIJavaTypeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.JavaEObject <em>Java EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.JavaEObject
- * @generated
- */
- public Adapter createJavaEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit <em>Jpa Compilation Unit</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit
- * @generated
- */
- public Adapter createJpaCompilationUnitAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentType <em>Java Persistent Type</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.JavaPersistentType
- * @generated
- */
- public Adapter createJavaPersistentTypeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute <em>Java Persistent Attribute</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute
- * @generated
- */
- public Adapter createJavaPersistentAttributeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaEObject <em>IJpa EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaEObject
- * @generated
- */
- public Adapter createIJpaEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaSourceObject <em>IJpa Source Object</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaSourceObject
- * @generated
- */
- public Adapter createIJpaSourceObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaContentNode <em>IJpa Content Node</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaContentNode
- * @generated
- */
- public Adapter createIJpaContentNodeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaRootContentNode <em>IJpa Root Content Node</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaRootContentNode
- * @generated
- */
- public Adapter createIJpaRootContentNodeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IPersistentType <em>IPersistent Type</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IPersistentType
- * @generated
- */
- public Adapter createIPersistentTypeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IPersistentAttribute <em>IPersistent Attribute</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IPersistentAttribute
- * @generated
- */
- public Adapter createIPersistentAttributeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IAttributeMapping <em>IAttribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IAttributeMapping
- * @generated
- */
- public Adapter createIAttributeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.ITypeMapping <em>IType Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.ITypeMapping
- * @generated
- */
- public Adapter createITypeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.JpaEObject <em>Jpa EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.JpaEObject
- * @generated
- */
- public Adapter createJpaEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for the default case.
- * <!-- begin-user-doc -->
- * This default implementation returns null.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @generated
- */
- public Adapter createEObjectAdapter() {
- return null;
- }
-} //JpaCoreJavaAdapterFactory
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/util/JpaJavaSwitch.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/util/JpaJavaSwitch.java
deleted file mode 100644
index 8ef4b80079..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/util/JpaJavaSwitch.java
+++ /dev/null
@@ -1,444 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.java.util;
-
-import java.util.List;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IJpaEObject;
-import org.eclipse.jpt.core.internal.IJpaRootContentNode;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.JpaEObject;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.JavaEObject;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit;
-import org.eclipse.jpt.core.internal.content.java.JpaJavaPackage;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Switch</b> for the model's inheritance hierarchy.
- * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
- * to invoke the <code>caseXXX</code> method for each class of the model,
- * starting with the actual class of the object
- * and proceeding up the inheritance hierarchy
- * until a non-null result is returned,
- * which is the result of the switch.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.java.JpaJavaPackage
- * @generated
- */
-public class JpaJavaSwitch<T>
-{
- /**
- * The cached model package
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static JpaJavaPackage modelPackage;
-
- /**
- * Creates an instance of the switch.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaJavaSwitch() {
- if (modelPackage == null) {
- modelPackage = JpaJavaPackage.eINSTANCE;
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- public T doSwitch(EObject theEObject) {
- return doSwitch(theEObject.eClass(), theEObject);
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(EClass theEClass, EObject theEObject) {
- if (theEClass.eContainer() == modelPackage) {
- return doSwitch(theEClass.getClassifierID(), theEObject);
- }
- else {
- List<EClass> eSuperTypes = theEClass.getESuperTypes();
- return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), theEObject);
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(int classifierID, EObject theEObject) {
- switch (classifierID) {
- case JpaJavaPackage.JAVA_EOBJECT : {
- JavaEObject javaEObject = (JavaEObject) theEObject;
- T result = caseJavaEObject(javaEObject);
- if (result == null)
- result = caseJpaEObject(javaEObject);
- if (result == null)
- result = caseIJpaSourceObject(javaEObject);
- if (result == null)
- result = caseIJpaEObject(javaEObject);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaPackage.JPA_COMPILATION_UNIT : {
- JpaCompilationUnit jpaCompilationUnit = (JpaCompilationUnit) theEObject;
- T result = caseJpaCompilationUnit(jpaCompilationUnit);
- if (result == null)
- result = caseJavaEObject(jpaCompilationUnit);
- if (result == null)
- result = caseIJpaRootContentNode(jpaCompilationUnit);
- if (result == null)
- result = caseJpaEObject(jpaCompilationUnit);
- if (result == null)
- result = caseIJpaSourceObject(jpaCompilationUnit);
- if (result == null)
- result = caseIJpaContentNode(jpaCompilationUnit);
- if (result == null)
- result = caseIJpaEObject(jpaCompilationUnit);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE : {
- JavaPersistentType javaPersistentType = (JavaPersistentType) theEObject;
- T result = caseJavaPersistentType(javaPersistentType);
- if (result == null)
- result = caseJavaEObject(javaPersistentType);
- if (result == null)
- result = caseIPersistentType(javaPersistentType);
- if (result == null)
- result = caseJpaEObject(javaPersistentType);
- if (result == null)
- result = caseIJpaSourceObject(javaPersistentType);
- if (result == null)
- result = caseIJpaContentNode(javaPersistentType);
- if (result == null)
- result = caseIJpaEObject(javaPersistentType);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaPackage.JAVA_PERSISTENT_ATTRIBUTE : {
- JavaPersistentAttribute javaPersistentAttribute = (JavaPersistentAttribute) theEObject;
- T result = caseJavaPersistentAttribute(javaPersistentAttribute);
- if (result == null)
- result = caseJavaEObject(javaPersistentAttribute);
- if (result == null)
- result = caseIPersistentAttribute(javaPersistentAttribute);
- if (result == null)
- result = caseJpaEObject(javaPersistentAttribute);
- if (result == null)
- result = caseIJpaSourceObject(javaPersistentAttribute);
- if (result == null)
- result = caseIJpaContentNode(javaPersistentAttribute);
- if (result == null)
- result = caseIJpaEObject(javaPersistentAttribute);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaPackage.IJAVA_TYPE_MAPPING : {
- IJavaTypeMapping iJavaTypeMapping = (IJavaTypeMapping) theEObject;
- T result = caseIJavaTypeMapping(iJavaTypeMapping);
- if (result == null)
- result = caseITypeMapping(iJavaTypeMapping);
- if (result == null)
- result = caseIJpaSourceObject(iJavaTypeMapping);
- if (result == null)
- result = caseIJpaEObject(iJavaTypeMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaJavaPackage.IJAVA_ATTRIBUTE_MAPPING : {
- IJavaAttributeMapping iJavaAttributeMapping = (IJavaAttributeMapping) theEObject;
- T result = caseIJavaAttributeMapping(iJavaAttributeMapping);
- if (result == null)
- result = caseIAttributeMapping(iJavaAttributeMapping);
- if (result == null)
- result = caseIJpaSourceObject(iJavaAttributeMapping);
- if (result == null)
- result = caseIJpaEObject(iJavaAttributeMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- default :
- return defaultCase(theEObject);
- }
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava Attribute Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava Attribute Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaAttributeMapping(IJavaAttributeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJava Type Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJava Type Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJavaTypeMapping(IJavaTypeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaEObject(JavaEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Jpa Compilation Unit</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Jpa Compilation Unit</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJpaCompilationUnit(JpaCompilationUnit object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Persistent Type</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Persistent Type</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaPersistentType(JavaPersistentType object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Persistent Attribute</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Persistent Attribute</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaPersistentAttribute(JavaPersistentAttribute object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaEObject(IJpaEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa Source Object</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa Source Object</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaSourceObject(IJpaSourceObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa Content Node</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa Content Node</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaContentNode(IJpaContentNode object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa Root Content Node</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa Root Content Node</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaRootContentNode(IJpaRootContentNode object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IPersistent Type</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IPersistent Type</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIPersistentType(IPersistentType object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IPersistent Attribute</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IPersistent Attribute</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIPersistentAttribute(IPersistentAttribute object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAttribute Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAttribute Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAttributeMapping(IAttributeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IType Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IType Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseITypeMapping(ITypeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Jpa EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Jpa EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJpaEObject(JpaEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch, but this is the last case anyway.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject)
- * @generated
- */
- public T defaultCase(EObject object) {
- return null;
- }
-} //JpaCoreJavaSwitch
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/AbstractXmlColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/AbstractXmlColumn.java
deleted file mode 100644
index 1fa12e5041..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/AbstractXmlColumn.java
+++ /dev/null
@@ -1,921 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import java.util.Set;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.content.orm.resource.OrmXmlMapper;
-import org.eclipse.jpt.core.internal.emfutility.DOMUtilities;
-import org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.IAbstractColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Abstract Xml Column</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getUniqueForXml <em>Unique For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getNullableForXml <em>Nullable For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getInsertableForXml <em>Insertable For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getUpdatableForXml <em>Updatable For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getSpecifiedTableForXml <em>Specified Table For Xml</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlColumn()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class AbstractXmlColumn extends AbstractXmlNamedColumn
- implements IAbstractColumn
-{
- /**
- * The default value of the '{@link #getUnique() <em>Unique</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getUnique()
- * @generated
- * @ordered
- */
- protected static final DefaultFalseBoolean UNIQUE_EDEFAULT = DefaultFalseBoolean.DEFAULT;
-
- /**
- * The cached value of the '{@link #getUnique() <em>Unique</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getUnique()
- * @generated
- * @ordered
- */
- protected DefaultFalseBoolean unique = UNIQUE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getNullable() <em>Nullable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getNullable()
- * @generated
- * @ordered
- */
- protected static final DefaultTrueBoolean NULLABLE_EDEFAULT = DefaultTrueBoolean.DEFAULT;
-
- /**
- * The cached value of the '{@link #getNullable() <em>Nullable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getNullable()
- * @generated
- * @ordered
- */
- protected DefaultTrueBoolean nullable = NULLABLE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getInsertable() <em>Insertable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getInsertable()
- * @generated
- * @ordered
- */
- protected static final DefaultTrueBoolean INSERTABLE_EDEFAULT = DefaultTrueBoolean.DEFAULT;
-
- /**
- * The cached value of the '{@link #getInsertable() <em>Insertable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getInsertable()
- * @generated
- * @ordered
- */
- protected DefaultTrueBoolean insertable = INSERTABLE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getUpdatable() <em>Updatable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getUpdatable()
- * @generated
- * @ordered
- */
- protected static final DefaultTrueBoolean UPDATABLE_EDEFAULT = DefaultTrueBoolean.DEFAULT;
-
- /**
- * The cached value of the '{@link #getUpdatable() <em>Updatable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getUpdatable()
- * @generated
- * @ordered
- */
- protected DefaultTrueBoolean updatable = UPDATABLE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getTable() <em>Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTable()
- * @generated
- * @ordered
- */
- protected static final String TABLE_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedTable() <em>Specified Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedTable()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_TABLE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedTable() <em>Specified Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedTable()
- * @generated
- * @ordered
- */
- protected String specifiedTable = SPECIFIED_TABLE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultTable() <em>Default Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultTable()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_TABLE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultTable() <em>Default Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultTable()
- * @generated
- * @ordered
- */
- protected String defaultTable = DEFAULT_TABLE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getUniqueForXml() <em>Unique For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getUniqueForXml()
- * @generated
- * @ordered
- */
- protected static final DefaultFalseBoolean UNIQUE_FOR_XML_EDEFAULT = DefaultFalseBoolean.DEFAULT;
-
- /**
- * The default value of the '{@link #getNullableForXml() <em>Nullable For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getNullableForXml()
- * @generated
- * @ordered
- */
- protected static final DefaultTrueBoolean NULLABLE_FOR_XML_EDEFAULT = DefaultTrueBoolean.DEFAULT;
-
- /**
- * The default value of the '{@link #getInsertableForXml() <em>Insertable For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getInsertableForXml()
- * @generated
- * @ordered
- */
- protected static final DefaultTrueBoolean INSERTABLE_FOR_XML_EDEFAULT = DefaultTrueBoolean.DEFAULT;
-
- /**
- * The default value of the '{@link #getUpdatableForXml() <em>Updatable For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getUpdatableForXml()
- * @generated
- * @ordered
- */
- protected static final DefaultTrueBoolean UPDATABLE_FOR_XML_EDEFAULT = DefaultTrueBoolean.DEFAULT;
-
- /**
- * The default value of the '{@link #getSpecifiedTableForXml() <em>Specified Table For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedTableForXml()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_TABLE_FOR_XML_EDEFAULT = null;
-
- protected AbstractXmlColumn() {
- throw new UnsupportedOperationException("Use AbstractXmlColumn(IColumn.Owner) instead.");
- }
-
- protected AbstractXmlColumn(INamedColumn.Owner owner) {
- super(owner);
- }
-
- @Override
- protected void addInsignificantXmlFeatureIdsTo(Set<Integer> insignificantXmlFeatureIds) {
- super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
- insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IABSTRACT_COLUMN__DEFAULT_TABLE);
- insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IABSTRACT_COLUMN__TABLE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.ABSTRACT_XML_COLUMN;
- }
-
- /**
- * Returns the value of the '<em><b>Unique</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Unique</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Unique</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean
- * @see #setUnique(DefaultFalseBoolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIAbstractColumn_Unique()
- * @model
- * @generated
- */
- public DefaultFalseBoolean getUnique() {
- return unique;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getUnique <em>Unique</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Unique</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean
- * @see #getUnique()
- * @generated
- */
- public void setUniqueGen(DefaultFalseBoolean newUnique) {
- DefaultFalseBoolean oldUnique = unique;
- unique = newUnique == null ? UNIQUE_EDEFAULT : newUnique;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_COLUMN__UNIQUE, oldUnique, unique));
- }
-
- /**
- * Returns the value of the '<em><b>Nullable</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Nullable</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Nullable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setNullable(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIAbstractColumn_Nullable()
- * @model
- * @generated
- */
- public DefaultTrueBoolean getNullable() {
- return nullable;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getNullable <em>Nullable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Nullable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getNullable()
- * @generated
- */
- public void setNullableGen(DefaultTrueBoolean newNullable) {
- DefaultTrueBoolean oldNullable = nullable;
- nullable = newNullable == null ? NULLABLE_EDEFAULT : newNullable;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_COLUMN__NULLABLE, oldNullable, nullable));
- }
-
- /**
- * Returns the value of the '<em><b>Insertable</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Insertable</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Insertable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setInsertable(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIAbstractColumn_Insertable()
- * @model
- * @generated
- */
- public DefaultTrueBoolean getInsertable() {
- return insertable;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getInsertable <em>Insertable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Insertable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getInsertable()
- * @generated
- */
- public void setInsertableGen(DefaultTrueBoolean newInsertable) {
- DefaultTrueBoolean oldInsertable = insertable;
- insertable = newInsertable == null ? INSERTABLE_EDEFAULT : newInsertable;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_COLUMN__INSERTABLE, oldInsertable, insertable));
- }
-
- /**
- * Returns the value of the '<em><b>Updatable</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Updatable</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Updatable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setUpdatable(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIAbstractColumn_Updatable()
- * @model
- * @generated
- */
- public DefaultTrueBoolean getUpdatable() {
- return updatable;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getUpdatable <em>Updatable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Updatable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getUpdatable()
- * @generated
- */
- public void setUpdatableGen(DefaultTrueBoolean newUpdatable) {
- DefaultTrueBoolean oldUpdatable = updatable;
- updatable = newUpdatable == null ? UPDATABLE_EDEFAULT : newUpdatable;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE, oldUpdatable, updatable));
- }
-
- /**
- * Returns the value of the '<em><b>Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIAbstractColumn_Table()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getTable() {
- return (this.getSpecifiedTable() == null) ? getDefaultTable() : this.getSpecifiedTable();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Table</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Table</em>' attribute.
- * @see #setSpecifiedTable(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIAbstractColumn_SpecifiedTable()
- * @model
- * @generated
- */
- public String getSpecifiedTable() {
- return specifiedTable;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getSpecifiedTable <em>Specified Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Table</em>' attribute.
- * @see #getSpecifiedTable()
- * @generated
- */
- public void setSpecifiedTableGen(String newSpecifiedTable) {
- String oldSpecifiedTable = specifiedTable;
- specifiedTable = newSpecifiedTable;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_COLUMN__SPECIFIED_TABLE, oldSpecifiedTable, specifiedTable));
- }
-
- /**
- * Returns the value of the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Table</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Table</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIAbstractColumn_DefaultTable()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultTable() {
- return defaultTable;
- }
-
- protected void setDefaultTable(String newDefaultTable) {
- String oldDefaultTable = this.defaultTable;
- this.defaultTable = newDefaultTable;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_COLUMN__DEFAULT_TABLE, oldDefaultTable, this.defaultTable));
- }
-
- /**
- * Returns the value of the '<em><b>Unique For Xml</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Unique For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Unique For Xml</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean
- * @see #setUniqueForXml(DefaultFalseBoolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlColumn_UniqueForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public DefaultFalseBoolean getUniqueForXml() {
- return getUnique();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getUniqueForXml <em>Unique For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Unique For Xml</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean
- * @see #getUniqueForXml()
- * @generated NOT
- */
- public void setUniqueForXml(DefaultFalseBoolean newUniqueForXml) {
- setUniqueGen(newUniqueForXml);
- if (eNotificationRequired())
- //pass in oldValue of null because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_COLUMN__UNIQUE_FOR_XML, null, newUniqueForXml));
- }
-
- /**
- * Returns the value of the '<em><b>Nullable For Xml</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Nullable For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Nullable For Xml</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setNullableForXml(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlColumn_NullableForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public DefaultTrueBoolean getNullableForXml() {
- return getNullable();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getNullableForXml <em>Nullable For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Nullable For Xml</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getNullableForXml()
- * @generated NOT
- */
- public void setNullableForXml(DefaultTrueBoolean newNullableForXml) {
- setNullableGen(newNullableForXml);
- if (eNotificationRequired())
- //pass in oldValue of null because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_COLUMN__NULLABLE_FOR_XML, null, newNullableForXml));
- }
-
- /**
- * Returns the value of the '<em><b>Insertable For Xml</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Insertable For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Insertable For Xml</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setInsertableForXml(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlColumn_InsertableForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public DefaultTrueBoolean getInsertableForXml() {
- return getInsertable();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getInsertableForXml <em>Insertable For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Insertable For Xml</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getInsertableForXml()
- * @generated NOT
- */
- public void setInsertableForXml(DefaultTrueBoolean newInsertableForXml) {
- setInsertableGen(newInsertableForXml);
- if (eNotificationRequired())
- //pass in oldValue of null because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_COLUMN__INSERTABLE_FOR_XML, null, newInsertableForXml));
- }
-
- /**
- * Returns the value of the '<em><b>Updatable For Xml</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Updatable For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Updatable For Xml</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setUpdatableForXml(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlColumn_UpdatableForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public DefaultTrueBoolean getUpdatableForXml() {
- return getUpdatable();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getUpdatableForXml <em>Updatable For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Updatable For Xml</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getUpdatableForXml()
- * @generated NOT
- */
- public void setUpdatableForXml(DefaultTrueBoolean newUpdatableForXml) {
- setUpdatableGen(newUpdatableForXml);
- if (eNotificationRequired())
- //pass in oldValue of null because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE_FOR_XML, null, newUpdatableForXml));
- }
-
- /**
- * Returns the value of the '<em><b>Column Definition For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column Definition For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column Definition For Xml</em>' attribute.
- * @see #setColumnDefinitionForXml(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlColumn_ColumnDefinitionForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public String getColumnDefinitionForXml() {
- return getColumnDefinition();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Table For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Table For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Table For Xml</em>' attribute.
- * @see #setSpecifiedTableForXml(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlColumn_SpecifiedTableForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public String getSpecifiedTableForXml() {
- return getSpecifiedTable();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getSpecifiedTableForXml <em>Specified Table For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Table For Xml</em>' attribute.
- * @see #getSpecifiedTableForXml()
- * @generated NOT
- */
- public void setSpecifiedTableForXml(String newSpecifiedTableForXml) {
- setSpecifiedTableGen(newSpecifiedTableForXml);
- if (eNotificationRequired())
- //pass in oldValue of null because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_COLUMN__SPECIFIED_TABLE_FOR_XML, newSpecifiedTableForXml + " ", newSpecifiedTableForXml));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_COLUMN__UNIQUE :
- return getUnique();
- case OrmPackage.ABSTRACT_XML_COLUMN__NULLABLE :
- return getNullable();
- case OrmPackage.ABSTRACT_XML_COLUMN__INSERTABLE :
- return getInsertable();
- case OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE :
- return getUpdatable();
- case OrmPackage.ABSTRACT_XML_COLUMN__TABLE :
- return getTable();
- case OrmPackage.ABSTRACT_XML_COLUMN__SPECIFIED_TABLE :
- return getSpecifiedTable();
- case OrmPackage.ABSTRACT_XML_COLUMN__DEFAULT_TABLE :
- return getDefaultTable();
- case OrmPackage.ABSTRACT_XML_COLUMN__UNIQUE_FOR_XML :
- return getUniqueForXml();
- case OrmPackage.ABSTRACT_XML_COLUMN__NULLABLE_FOR_XML :
- return getNullableForXml();
- case OrmPackage.ABSTRACT_XML_COLUMN__INSERTABLE_FOR_XML :
- return getInsertableForXml();
- case OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE_FOR_XML :
- return getUpdatableForXml();
- case OrmPackage.ABSTRACT_XML_COLUMN__SPECIFIED_TABLE_FOR_XML :
- return getSpecifiedTableForXml();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_COLUMN__UNIQUE :
- setUnique((DefaultFalseBoolean) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__NULLABLE :
- setNullable((DefaultTrueBoolean) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__INSERTABLE :
- setInsertable((DefaultTrueBoolean) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE :
- setUpdatable((DefaultTrueBoolean) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__SPECIFIED_TABLE :
- setSpecifiedTable((String) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__UNIQUE_FOR_XML :
- setUniqueForXml((DefaultFalseBoolean) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__NULLABLE_FOR_XML :
- setNullableForXml((DefaultTrueBoolean) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__INSERTABLE_FOR_XML :
- setInsertableForXml((DefaultTrueBoolean) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE_FOR_XML :
- setUpdatableForXml((DefaultTrueBoolean) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__SPECIFIED_TABLE_FOR_XML :
- setSpecifiedTableForXml((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_COLUMN__UNIQUE :
- setUnique(UNIQUE_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__NULLABLE :
- setNullable(NULLABLE_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__INSERTABLE :
- setInsertable(INSERTABLE_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE :
- setUpdatable(UPDATABLE_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__SPECIFIED_TABLE :
- setSpecifiedTable(SPECIFIED_TABLE_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__UNIQUE_FOR_XML :
- setUniqueForXml(UNIQUE_FOR_XML_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__NULLABLE_FOR_XML :
- setNullableForXml(NULLABLE_FOR_XML_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__INSERTABLE_FOR_XML :
- setInsertableForXml(INSERTABLE_FOR_XML_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE_FOR_XML :
- setUpdatableForXml(UPDATABLE_FOR_XML_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_COLUMN__SPECIFIED_TABLE_FOR_XML :
- setSpecifiedTableForXml(SPECIFIED_TABLE_FOR_XML_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_COLUMN__UNIQUE :
- return unique != UNIQUE_EDEFAULT;
- case OrmPackage.ABSTRACT_XML_COLUMN__NULLABLE :
- return nullable != NULLABLE_EDEFAULT;
- case OrmPackage.ABSTRACT_XML_COLUMN__INSERTABLE :
- return insertable != INSERTABLE_EDEFAULT;
- case OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE :
- return updatable != UPDATABLE_EDEFAULT;
- case OrmPackage.ABSTRACT_XML_COLUMN__TABLE :
- return TABLE_EDEFAULT == null ? getTable() != null : !TABLE_EDEFAULT.equals(getTable());
- case OrmPackage.ABSTRACT_XML_COLUMN__SPECIFIED_TABLE :
- return SPECIFIED_TABLE_EDEFAULT == null ? specifiedTable != null : !SPECIFIED_TABLE_EDEFAULT.equals(specifiedTable);
- case OrmPackage.ABSTRACT_XML_COLUMN__DEFAULT_TABLE :
- return DEFAULT_TABLE_EDEFAULT == null ? defaultTable != null : !DEFAULT_TABLE_EDEFAULT.equals(defaultTable);
- case OrmPackage.ABSTRACT_XML_COLUMN__UNIQUE_FOR_XML :
- return getUniqueForXml() != UNIQUE_FOR_XML_EDEFAULT;
- case OrmPackage.ABSTRACT_XML_COLUMN__NULLABLE_FOR_XML :
- return getNullableForXml() != NULLABLE_FOR_XML_EDEFAULT;
- case OrmPackage.ABSTRACT_XML_COLUMN__INSERTABLE_FOR_XML :
- return getInsertableForXml() != INSERTABLE_FOR_XML_EDEFAULT;
- case OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE_FOR_XML :
- return getUpdatableForXml() != UPDATABLE_FOR_XML_EDEFAULT;
- case OrmPackage.ABSTRACT_XML_COLUMN__SPECIFIED_TABLE_FOR_XML :
- return SPECIFIED_TABLE_FOR_XML_EDEFAULT == null ? getSpecifiedTableForXml() != null : !SPECIFIED_TABLE_FOR_XML_EDEFAULT.equals(getSpecifiedTableForXml());
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IAbstractColumn.class) {
- switch (derivedFeatureID) {
- case OrmPackage.ABSTRACT_XML_COLUMN__UNIQUE :
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__UNIQUE;
- case OrmPackage.ABSTRACT_XML_COLUMN__NULLABLE :
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__NULLABLE;
- case OrmPackage.ABSTRACT_XML_COLUMN__INSERTABLE :
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__INSERTABLE;
- case OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE :
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__UPDATABLE;
- case OrmPackage.ABSTRACT_XML_COLUMN__TABLE :
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__TABLE;
- case OrmPackage.ABSTRACT_XML_COLUMN__SPECIFIED_TABLE :
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__SPECIFIED_TABLE;
- case OrmPackage.ABSTRACT_XML_COLUMN__DEFAULT_TABLE :
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__DEFAULT_TABLE;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IAbstractColumn.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IABSTRACT_COLUMN__UNIQUE :
- return OrmPackage.ABSTRACT_XML_COLUMN__UNIQUE;
- case JpaCoreMappingsPackage.IABSTRACT_COLUMN__NULLABLE :
- return OrmPackage.ABSTRACT_XML_COLUMN__NULLABLE;
- case JpaCoreMappingsPackage.IABSTRACT_COLUMN__INSERTABLE :
- return OrmPackage.ABSTRACT_XML_COLUMN__INSERTABLE;
- case JpaCoreMappingsPackage.IABSTRACT_COLUMN__UPDATABLE :
- return OrmPackage.ABSTRACT_XML_COLUMN__UPDATABLE;
- case JpaCoreMappingsPackage.IABSTRACT_COLUMN__TABLE :
- return OrmPackage.ABSTRACT_XML_COLUMN__TABLE;
- case JpaCoreMappingsPackage.IABSTRACT_COLUMN__SPECIFIED_TABLE :
- return OrmPackage.ABSTRACT_XML_COLUMN__SPECIFIED_TABLE;
- case JpaCoreMappingsPackage.IABSTRACT_COLUMN__DEFAULT_TABLE :
- return OrmPackage.ABSTRACT_XML_COLUMN__DEFAULT_TABLE;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (unique: ");
- result.append(unique);
- result.append(", nullable: ");
- result.append(nullable);
- result.append(", insertable: ");
- result.append(insertable);
- result.append(", updatable: ");
- result.append(updatable);
- result.append(", specifiedTable: ");
- result.append(specifiedTable);
- result.append(", defaultTable: ");
- result.append(defaultTable);
- result.append(')');
- return result.toString();
- }
-
- @Override
- protected String tableName() {
- return this.getTable();
- }
-
- public ITextRange tableTextRange() {
- if (node == null) {
- return owner.validationTextRange();
- }
- IDOMNode tableNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.ENTITY__TABLE);
- return (tableNode == null) ? validationTextRange() : buildTextRange(tableNode);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/AbstractXmlNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/AbstractXmlNamedColumn.java
deleted file mode 100644
index aedb293ea0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/AbstractXmlNamedColumn.java
+++ /dev/null
@@ -1,476 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import java.util.Set;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.orm.resource.OrmXmlMapper;
-import org.eclipse.jpt.core.internal.emfutility.DOMUtilities;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.db.internal.Column;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Abstract Xml Named Column</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn#getSpecifiedNameForXml <em>Specified Name For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn#getColumnDefinitionForXml <em>Column Definition For Xml</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlNamedColumn()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class AbstractXmlNamedColumn extends XmlEObject
- implements INamedColumn
-{
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedName() <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedName()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedName() <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedName()
- * @generated
- * @ordered
- */
- protected String specifiedName = SPECIFIED_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultName() <em>Default Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultName()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultName() <em>Default Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultName()
- * @generated
- * @ordered
- */
- protected String defaultName = DEFAULT_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getColumnDefinition() <em>Column Definition</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getColumnDefinition()
- * @generated
- * @ordered
- */
- protected static final String COLUMN_DEFINITION_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getColumnDefinition() <em>Column Definition</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getColumnDefinition()
- * @generated
- * @ordered
- */
- protected String columnDefinition = COLUMN_DEFINITION_EDEFAULT;
-
- /**
- * The default value of the '{@link #getSpecifiedNameForXml() <em>Specified Name For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedNameForXml()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_NAME_FOR_XML_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getColumnDefinitionForXml() <em>Column Definition For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getColumnDefinitionForXml()
- * @generated
- * @ordered
- */
- protected static final String COLUMN_DEFINITION_FOR_XML_EDEFAULT = null;
-
- protected final INamedColumn.Owner owner;
-
- protected AbstractXmlNamedColumn() {
- throw new UnsupportedOperationException("Use AbstractXmlNamedColumn(INamedColumn.Owner) instead.");
- }
-
- protected AbstractXmlNamedColumn(INamedColumn.Owner owner) {
- super();
- this.owner = owner;
- }
-
- @Override
- protected void addInsignificantXmlFeatureIdsTo(Set<Integer> insignificantXmlFeatureIds) {
- super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
- insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME);
- insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.INAMED_COLUMN__NAME);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.ABSTRACT_XML_NAMED_COLUMN;
- }
-
- public String getName() {
- return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
- }
-
- /**
- * Returns the value of the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Name</em>' attribute.
- * @see #setSpecifiedName(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getINamedColumn_SpecifiedName()
- * @model
- * @generated
- */
- public String getSpecifiedName() {
- return specifiedName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn#getSpecifiedName <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Name</em>' attribute.
- * @see #getSpecifiedName()
- * @generated
- */
- public void setSpecifiedNameGen(String newSpecifiedName) {
- String oldSpecifiedName = specifiedName;
- specifiedName = newSpecifiedName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME, oldSpecifiedName, specifiedName));
- }
-
- /**
- * Returns the value of the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getINamedColumn_DefaultName()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultName() {
- return defaultName;
- }
-
- protected void setDefaultName(String newDefaultName) {
- String oldDefaultName = this.defaultName;
- this.defaultName = newDefaultName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_COLUMN__DEFAULT_NAME, oldDefaultName, this.defaultName));
- }
-
- /**
- * Returns the value of the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column Definition</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column Definition</em>' attribute.
- * @see #setColumnDefinition(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getINamedColumn_ColumnDefinition()
- * @model
- * @generated
- */
- public String getColumnDefinition() {
- return columnDefinition;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn#getColumnDefinition <em>Column Definition</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Column Definition</em>' attribute.
- * @see #getColumnDefinition()
- * @generated
- */
- public void setColumnDefinitionGen(String newColumnDefinition) {
- String oldColumnDefinition = columnDefinition;
- columnDefinition = newColumnDefinition;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION, oldColumnDefinition, columnDefinition));
- }
-
- public String getSpecifiedNameForXml() {
- return getSpecifiedName();
- }
-
- public void setSpecifiedNameForXml(String newSpecifiedNameForXml) {
- setSpecifiedNameGen(newSpecifiedNameForXml);
- if (eNotificationRequired())
- //make sure oldValue different from newValue because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME_FOR_XML, newSpecifiedNameForXml + " ", newSpecifiedNameForXml));
- }
-
- public String getColumnDefinitionForXml() {
- return getColumnDefinition();
- }
-
- public void setColumnDefinitionForXml(String newColumnDefinitionForXml) {
- setColumnDefinitionGen(newColumnDefinitionForXml);
- if (eNotificationRequired())
- //pass in oldValue of null because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_COLUMN__COLUMN_DEFINITION_FOR_XML, newColumnDefinitionForXml + " ", newColumnDefinitionForXml));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__NAME :
- return getName();
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME :
- return getSpecifiedName();
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__DEFAULT_NAME :
- return getDefaultName();
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION :
- return getColumnDefinition();
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME_FOR_XML :
- return getSpecifiedNameForXml();
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION_FOR_XML :
- return getColumnDefinitionForXml();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME :
- setSpecifiedName((String) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION :
- setColumnDefinition((String) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME_FOR_XML :
- setSpecifiedNameForXml((String) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION_FOR_XML :
- setColumnDefinitionForXml((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME :
- setSpecifiedName(SPECIFIED_NAME_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION :
- setColumnDefinition(COLUMN_DEFINITION_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME_FOR_XML :
- setSpecifiedNameForXml(SPECIFIED_NAME_FOR_XML_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION_FOR_XML :
- setColumnDefinitionForXml(COLUMN_DEFINITION_FOR_XML_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__NAME :
- return NAME_EDEFAULT == null ? getName() != null : !NAME_EDEFAULT.equals(getName());
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME :
- return SPECIFIED_NAME_EDEFAULT == null ? specifiedName != null : !SPECIFIED_NAME_EDEFAULT.equals(specifiedName);
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__DEFAULT_NAME :
- return DEFAULT_NAME_EDEFAULT == null ? defaultName != null : !DEFAULT_NAME_EDEFAULT.equals(defaultName);
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION :
- return COLUMN_DEFINITION_EDEFAULT == null ? columnDefinition != null : !COLUMN_DEFINITION_EDEFAULT.equals(columnDefinition);
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME_FOR_XML :
- return SPECIFIED_NAME_FOR_XML_EDEFAULT == null ? getSpecifiedNameForXml() != null : !SPECIFIED_NAME_FOR_XML_EDEFAULT.equals(getSpecifiedNameForXml());
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION_FOR_XML :
- return COLUMN_DEFINITION_FOR_XML_EDEFAULT == null ? getColumnDefinitionForXml() != null : !COLUMN_DEFINITION_FOR_XML_EDEFAULT.equals(getColumnDefinitionForXml());
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == INamedColumn.class) {
- switch (derivedFeatureID) {
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__NAME :
- return JpaCoreMappingsPackage.INAMED_COLUMN__NAME;
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME :
- return JpaCoreMappingsPackage.INAMED_COLUMN__SPECIFIED_NAME;
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__DEFAULT_NAME :
- return JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME;
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION :
- return JpaCoreMappingsPackage.INAMED_COLUMN__COLUMN_DEFINITION;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == INamedColumn.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.INAMED_COLUMN__NAME :
- return OrmPackage.ABSTRACT_XML_NAMED_COLUMN__NAME;
- case JpaCoreMappingsPackage.INAMED_COLUMN__SPECIFIED_NAME :
- return OrmPackage.ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME;
- case JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME :
- return OrmPackage.ABSTRACT_XML_NAMED_COLUMN__DEFAULT_NAME;
- case JpaCoreMappingsPackage.INAMED_COLUMN__COLUMN_DEFINITION :
- return OrmPackage.ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedName: ");
- result.append(specifiedName);
- result.append(", defaultName: ");
- result.append(defaultName);
- result.append(", columnDefinition: ");
- result.append(columnDefinition);
- result.append(')');
- return result.toString();
- }
-
- public INamedColumn.Owner getOwner() {
- return owner;
- }
-
- public Column dbColumn() {
- Table table = this.dbTable();
- return (table == null) ? null : table.columnNamed(getName());
- }
-
- public Table dbTable() {
- return getOwner().dbTable(this.tableName());
- }
-
- protected abstract String tableName();
-
- public boolean isResolved() {
- return dbColumn() != null;
- }
-
- public ITextRange nameTextRange() {
- if (node == null) {
- return owner.validationTextRange();
- }
- IDOMNode nameNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.NAME);
- return (nameNode == null) ? validationTextRange() : buildTextRange(nameNode);
- }
-
- public void refreshDefaults(DefaultsContext defaultsContext) {
- setDefaultName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_COLUMN_NAME_KEY));
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/AbstractXmlTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/AbstractXmlTable.java
deleted file mode 100644
index bae5c6d1c4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/AbstractXmlTable.java
+++ /dev/null
@@ -1,984 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import java.util.Collection;
-import java.util.Set;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.orm.resource.OrmXmlMapper;
-import org.eclipse.jpt.core.internal.emfutility.DOMUtilities;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Abstract Xml Table</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable#getSpecifiedNameForXml <em>Specified Name For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable#getSpecifiedCatalogForXml <em>Specified Catalog For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable#getSpecifiedSchemaForXml <em>Specified Schema For Xml</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlTable()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class AbstractXmlTable extends XmlEObject implements ITable
-{
- private Owner owner;
-
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedName() <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedName()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedName() <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedName()
- * @generated
- * @ordered
- */
- protected String specifiedName = SPECIFIED_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultName() <em>Default Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultName()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultName() <em>Default Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultName()
- * @generated
- * @ordered
- */
- protected String defaultName = DEFAULT_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getCatalog()
- * @generated
- * @ordered
- */
- protected static final String CATALOG_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedCatalog() <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedCatalog()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_CATALOG_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedCatalog() <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedCatalog()
- * @generated
- * @ordered
- */
- protected String specifiedCatalog = SPECIFIED_CATALOG_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultCatalog() <em>Default Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultCatalog()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_CATALOG_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultCatalog() <em>Default Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultCatalog()
- * @generated
- * @ordered
- */
- protected String defaultCatalog = DEFAULT_CATALOG_EDEFAULT;
-
- /**
- * The default value of the '{@link #getSchema() <em>Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSchema()
- * @generated
- * @ordered
- */
- protected static final String SCHEMA_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedSchema() <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSchema()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_SCHEMA_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedSchema() <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSchema()
- * @generated
- * @ordered
- */
- protected String specifiedSchema = SPECIFIED_SCHEMA_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultSchema() <em>Default Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultSchema()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_SCHEMA_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultSchema() <em>Default Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultSchema()
- * @generated
- * @ordered
- */
- protected String defaultSchema = DEFAULT_SCHEMA_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getUniqueConstraints() <em>Unique Constraints</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getUniqueConstraints()
- * @generated
- * @ordered
- */
- protected EList<IUniqueConstraint> uniqueConstraints;
-
- /**
- * The default value of the '{@link #getSpecifiedNameForXml() <em>Specified Name For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedNameForXml()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_NAME_FOR_XML_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedCatalogForXml() <em>Specified Catalog For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedCatalogForXml()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_CATALOG_FOR_XML_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedSchemaForXml() <em>Specified Schema For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSchemaForXml()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_SCHEMA_FOR_XML_EDEFAULT = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected AbstractXmlTable() {
- super();
- }
-
- protected AbstractXmlTable(Owner owner) {
- super();
- this.owner = owner;
- }
-
- @Override
- protected void addInsignificantXmlFeatureIdsTo(Set<Integer> insignificantXmlFeatureIds) {
- super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
- insignificantXmlFeatureIds.add(OrmPackage.ABSTRACT_XML_TABLE__NAME);
- insignificantXmlFeatureIds.add(OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_NAME);
- insignificantXmlFeatureIds.add(OrmPackage.ABSTRACT_XML_TABLE__SCHEMA);
- insignificantXmlFeatureIds.add(OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_SCHEMA);
- insignificantXmlFeatureIds.add(OrmPackage.ABSTRACT_XML_TABLE__CATALOG);
- insignificantXmlFeatureIds.add(OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_CATALOG);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.ABSTRACT_XML_TABLE;
- }
-
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITable_Name()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getName() {
- return (this.getSpecifiedName() == null) ? getDefaultName() : this.getSpecifiedName();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Name</em>' attribute.
- * @see #setSpecifiedName(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITable_SpecifiedName()
- * @model
- * @generated
- */
- public String getSpecifiedName() {
- return specifiedName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable#getSpecifiedName <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Name</em>' attribute.
- * @see #getSpecifiedName()
- * @generated
- */
- public void setSpecifiedNameGen(String newSpecifiedName) {
- String oldSpecifiedName = specifiedName;
- specifiedName = newSpecifiedName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_NAME, oldSpecifiedName, specifiedName));
- }
-
- public void setSpecifiedName(String newSpecifiedName) {
- setSpecifiedNameGen(newSpecifiedName);
- if (newSpecifiedName != SPECIFIED_NAME_EDEFAULT) {
- makeTableForXmlNonNull();
- }
- setSpecifiedNameForXml(newSpecifiedName);
- if (isAllFeaturesUnset()) {
- makeTableForXmlNull();
- }
- }
-
- /**
- * Returns the value of the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITable_DefaultName()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultName() {
- return defaultName;
- }
-
- /**
- * Returns the value of the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Catalog</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITable_Catalog()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getCatalog() {
- return (this.getSpecifiedCatalog() == null) ? getDefaultCatalog() : this.getSpecifiedCatalog();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Catalog</em>' attribute.
- * @see #setSpecifiedCatalog(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITable_SpecifiedCatalog()
- * @model
- * @generated
- */
- public String getSpecifiedCatalog() {
- return specifiedCatalog;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable#getSpecifiedCatalog <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Catalog</em>' attribute.
- * @see #getSpecifiedCatalog()
- * @generated
- */
- public void setSpecifiedCatalogGen(String newSpecifiedCatalog) {
- String oldSpecifiedCatalog = specifiedCatalog;
- specifiedCatalog = newSpecifiedCatalog;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_CATALOG, oldSpecifiedCatalog, specifiedCatalog));
- }
-
- public void setSpecifiedCatalog(String newSpecifiedCatalog) {
- setSpecifiedCatalogGen(newSpecifiedCatalog);
- if (newSpecifiedCatalog != SPECIFIED_CATALOG_EDEFAULT) {
- makeTableForXmlNonNull();
- }
- setSpecifiedCatalogForXml(newSpecifiedCatalog);
- if (isAllFeaturesUnset()) {
- makeTableForXmlNull();
- }
- }
-
- protected abstract void makeTableForXmlNull();
-
- protected abstract void makeTableForXmlNonNull();
-
- /**
- * Returns the value of the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Catalog</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITable_DefaultCatalog()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultCatalog() {
- return defaultCatalog;
- }
-
- /**
- * Returns the value of the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Schema</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITable_Schema()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getSchema() {
- return (this.getSpecifiedSchema() == null) ? getDefaultSchema() : this.getSpecifiedSchema();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Schema</em>' attribute.
- * @see #setSpecifiedSchema(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITable_SpecifiedSchema()
- * @model
- * @generated
- */
- public String getSpecifiedSchema() {
- return specifiedSchema;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable#getSpecifiedSchema <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Schema</em>' attribute.
- * @see #getSpecifiedSchema()
- * @generated
- */
- public void setSpecifiedSchemaGen(String newSpecifiedSchema) {
- String oldSpecifiedSchema = specifiedSchema;
- specifiedSchema = newSpecifiedSchema;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA, oldSpecifiedSchema, specifiedSchema));
- }
-
- public void setSpecifiedSchema(String newSpecifiedSchema) {
- setSpecifiedSchemaGen(newSpecifiedSchema);
- if (newSpecifiedSchema != SPECIFIED_SCHEMA_EDEFAULT) {
- makeTableForXmlNonNull();
- }
- setSpecifiedSchemaForXml(newSpecifiedSchema);
- if (isAllFeaturesUnset()) {
- makeTableForXmlNull();
- }
- }
-
- /**
- * Returns the value of the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Schema</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITable_DefaultSchema()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultSchema() {
- return defaultSchema;
- }
-
- /**
- * Returns the value of the '<em><b>Unique Constraints</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IUniqueConstraint}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Unique Constraints</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Unique Constraints</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITable_UniqueConstraints()
- * @model containment="true"
- * @generated
- */
- public EList<IUniqueConstraint> getUniqueConstraints() {
- if (uniqueConstraints == null) {
- uniqueConstraints = new EObjectContainmentEList<IUniqueConstraint>(IUniqueConstraint.class, this, OrmPackage.ABSTRACT_XML_TABLE__UNIQUE_CONSTRAINTS);
- }
- return uniqueConstraints;
- }
-
- /**
- * Returns the value of the '<em><b>Specified Name For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Name For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Name For Xml</em>' attribute.
- * @see #setSpecifiedNameForXml(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlTable_SpecifiedNameForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public String getSpecifiedNameForXml() {
- return getSpecifiedName();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable#getSpecifiedNameForXml <em>Specified Name For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Name For Xml</em>' attribute.
- * @see #getSpecifiedNameForXml()
- * @generated NOT
- */
- public void setSpecifiedNameForXml(String newSpecifiedNameForXml) {
- setSpecifiedNameGen(newSpecifiedNameForXml);
- if (eNotificationRequired())
- //pass in oldValue of null because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_NAME_FOR_XML, newSpecifiedNameForXml + " ", newSpecifiedNameForXml));
- }
-
- /**
- * Returns the value of the '<em><b>Specified Catalog For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Catalog For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Catalog For Xml</em>' attribute.
- * @see #setSpecifiedCatalogForXml(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlTable_SpecifiedCatalogForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public String getSpecifiedCatalogForXml() {
- return getSpecifiedCatalog();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable#getSpecifiedCatalogForXml <em>Specified Catalog For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Catalog For Xml</em>' attribute.
- * @see #getSpecifiedCatalogForXml()
- * @generated NOT
- */
- public void setSpecifiedCatalogForXml(String newSpecifiedCatalogForXml) {
- setSpecifiedCatalogGen(newSpecifiedCatalogForXml);
- if (eNotificationRequired())
- //pass in oldValue of null because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_CATALOG_FOR_XML, newSpecifiedCatalogForXml + " ", newSpecifiedCatalogForXml));
- }
-
- /**
- * Returns the value of the '<em><b>Specified Schema For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Schema For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Schema For Xml</em>' attribute.
- * @see #setSpecifiedSchemaForXml(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlTable_SpecifiedSchemaForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public String getSpecifiedSchemaForXml() {
- return getSpecifiedSchema();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable#getSpecifiedSchemaForXml <em>Specified Schema For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Schema For Xml</em>' attribute.
- * @see #getSpecifiedSchemaForXml()
- * @generated NOT
- */
- public void setSpecifiedSchemaForXml(String newSpecifiedSchemaForXml) {
- setSpecifiedSchemaGen(newSpecifiedSchemaForXml);
- if (eNotificationRequired())
- //pass in oldValue of null because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA_FOR_XML, newSpecifiedSchemaForXml + " ", newSpecifiedSchemaForXml));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_TABLE__UNIQUE_CONSTRAINTS :
- return ((InternalEList<?>) getUniqueConstraints()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- //TODO should we allow setting through the ecore, that would make this method
- //public and part of the ITable api. only the model needs to be setting the default,
- //but the ui needs to be listening for changes to the default.
- protected void setDefaultName(String newDefaultName) {
- String oldDefaultName = this.defaultName;
- this.defaultName = newDefaultName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_TABLE__DEFAULT_NAME, oldDefaultName, this.defaultName));
- }
-
- protected void setDefaultSchema(String newDefaultSchema) {
- String oldDefaultSchema = this.defaultSchema;
- this.defaultSchema = newDefaultSchema;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_TABLE__DEFAULT_SCHEMA, oldDefaultSchema, this.defaultSchema));
- }
-
- protected void setDefaultCatalog(String newDefaultCatalog) {
- String oldDefaultCatalog = this.defaultCatalog;
- this.defaultCatalog = newDefaultCatalog;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_TABLE__DEFAULT_CATALOG, oldDefaultCatalog, this.defaultCatalog));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_TABLE__NAME :
- return getName();
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_NAME :
- return getSpecifiedName();
- case OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_NAME :
- return getDefaultName();
- case OrmPackage.ABSTRACT_XML_TABLE__CATALOG :
- return getCatalog();
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_CATALOG :
- return getSpecifiedCatalog();
- case OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_CATALOG :
- return getDefaultCatalog();
- case OrmPackage.ABSTRACT_XML_TABLE__SCHEMA :
- return getSchema();
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA :
- return getSpecifiedSchema();
- case OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_SCHEMA :
- return getDefaultSchema();
- case OrmPackage.ABSTRACT_XML_TABLE__UNIQUE_CONSTRAINTS :
- return getUniqueConstraints();
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_NAME_FOR_XML :
- return getSpecifiedNameForXml();
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_CATALOG_FOR_XML :
- return getSpecifiedCatalogForXml();
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA_FOR_XML :
- return getSpecifiedSchemaForXml();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_NAME :
- setSpecifiedName((String) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_CATALOG :
- setSpecifiedCatalog((String) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA :
- setSpecifiedSchema((String) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_TABLE__UNIQUE_CONSTRAINTS :
- getUniqueConstraints().clear();
- getUniqueConstraints().addAll((Collection<? extends IUniqueConstraint>) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_NAME_FOR_XML :
- setSpecifiedNameForXml((String) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_CATALOG_FOR_XML :
- setSpecifiedCatalogForXml((String) newValue);
- return;
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA_FOR_XML :
- setSpecifiedSchemaForXml((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_NAME :
- setSpecifiedName(SPECIFIED_NAME_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_CATALOG :
- setSpecifiedCatalog(SPECIFIED_CATALOG_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA :
- setSpecifiedSchema(SPECIFIED_SCHEMA_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_TABLE__UNIQUE_CONSTRAINTS :
- getUniqueConstraints().clear();
- return;
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_NAME_FOR_XML :
- setSpecifiedNameForXml(SPECIFIED_NAME_FOR_XML_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_CATALOG_FOR_XML :
- setSpecifiedCatalogForXml(SPECIFIED_CATALOG_FOR_XML_EDEFAULT);
- return;
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA_FOR_XML :
- setSpecifiedSchemaForXml(SPECIFIED_SCHEMA_FOR_XML_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_TABLE__NAME :
- return NAME_EDEFAULT == null ? getName() != null : !NAME_EDEFAULT.equals(getName());
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_NAME :
- return SPECIFIED_NAME_EDEFAULT == null ? specifiedName != null : !SPECIFIED_NAME_EDEFAULT.equals(specifiedName);
- case OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_NAME :
- return DEFAULT_NAME_EDEFAULT == null ? defaultName != null : !DEFAULT_NAME_EDEFAULT.equals(defaultName);
- case OrmPackage.ABSTRACT_XML_TABLE__CATALOG :
- return CATALOG_EDEFAULT == null ? getCatalog() != null : !CATALOG_EDEFAULT.equals(getCatalog());
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_CATALOG :
- return SPECIFIED_CATALOG_EDEFAULT == null ? specifiedCatalog != null : !SPECIFIED_CATALOG_EDEFAULT.equals(specifiedCatalog);
- case OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_CATALOG :
- return DEFAULT_CATALOG_EDEFAULT == null ? defaultCatalog != null : !DEFAULT_CATALOG_EDEFAULT.equals(defaultCatalog);
- case OrmPackage.ABSTRACT_XML_TABLE__SCHEMA :
- return SCHEMA_EDEFAULT == null ? getSchema() != null : !SCHEMA_EDEFAULT.equals(getSchema());
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA :
- return SPECIFIED_SCHEMA_EDEFAULT == null ? specifiedSchema != null : !SPECIFIED_SCHEMA_EDEFAULT.equals(specifiedSchema);
- case OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_SCHEMA :
- return DEFAULT_SCHEMA_EDEFAULT == null ? defaultSchema != null : !DEFAULT_SCHEMA_EDEFAULT.equals(defaultSchema);
- case OrmPackage.ABSTRACT_XML_TABLE__UNIQUE_CONSTRAINTS :
- return uniqueConstraints != null && !uniqueConstraints.isEmpty();
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_NAME_FOR_XML :
- return SPECIFIED_NAME_FOR_XML_EDEFAULT == null ? getSpecifiedNameForXml() != null : !SPECIFIED_NAME_FOR_XML_EDEFAULT.equals(getSpecifiedNameForXml());
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_CATALOG_FOR_XML :
- return SPECIFIED_CATALOG_FOR_XML_EDEFAULT == null ? getSpecifiedCatalogForXml() != null : !SPECIFIED_CATALOG_FOR_XML_EDEFAULT.equals(getSpecifiedCatalogForXml());
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA_FOR_XML :
- return SPECIFIED_SCHEMA_FOR_XML_EDEFAULT == null ? getSpecifiedSchemaForXml() != null : !SPECIFIED_SCHEMA_FOR_XML_EDEFAULT.equals(getSpecifiedSchemaForXml());
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == ITable.class) {
- switch (derivedFeatureID) {
- case OrmPackage.ABSTRACT_XML_TABLE__NAME :
- return JpaCoreMappingsPackage.ITABLE__NAME;
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_NAME :
- return JpaCoreMappingsPackage.ITABLE__SPECIFIED_NAME;
- case OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_NAME :
- return JpaCoreMappingsPackage.ITABLE__DEFAULT_NAME;
- case OrmPackage.ABSTRACT_XML_TABLE__CATALOG :
- return JpaCoreMappingsPackage.ITABLE__CATALOG;
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_CATALOG :
- return JpaCoreMappingsPackage.ITABLE__SPECIFIED_CATALOG;
- case OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_CATALOG :
- return JpaCoreMappingsPackage.ITABLE__DEFAULT_CATALOG;
- case OrmPackage.ABSTRACT_XML_TABLE__SCHEMA :
- return JpaCoreMappingsPackage.ITABLE__SCHEMA;
- case OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA :
- return JpaCoreMappingsPackage.ITABLE__SPECIFIED_SCHEMA;
- case OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_SCHEMA :
- return JpaCoreMappingsPackage.ITABLE__DEFAULT_SCHEMA;
- case OrmPackage.ABSTRACT_XML_TABLE__UNIQUE_CONSTRAINTS :
- return JpaCoreMappingsPackage.ITABLE__UNIQUE_CONSTRAINTS;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == ITable.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.ITABLE__NAME :
- return OrmPackage.ABSTRACT_XML_TABLE__NAME;
- case JpaCoreMappingsPackage.ITABLE__SPECIFIED_NAME :
- return OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_NAME;
- case JpaCoreMappingsPackage.ITABLE__DEFAULT_NAME :
- return OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_NAME;
- case JpaCoreMappingsPackage.ITABLE__CATALOG :
- return OrmPackage.ABSTRACT_XML_TABLE__CATALOG;
- case JpaCoreMappingsPackage.ITABLE__SPECIFIED_CATALOG :
- return OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_CATALOG;
- case JpaCoreMappingsPackage.ITABLE__DEFAULT_CATALOG :
- return OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_CATALOG;
- case JpaCoreMappingsPackage.ITABLE__SCHEMA :
- return OrmPackage.ABSTRACT_XML_TABLE__SCHEMA;
- case JpaCoreMappingsPackage.ITABLE__SPECIFIED_SCHEMA :
- return OrmPackage.ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA;
- case JpaCoreMappingsPackage.ITABLE__DEFAULT_SCHEMA :
- return OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_SCHEMA;
- case JpaCoreMappingsPackage.ITABLE__UNIQUE_CONSTRAINTS :
- return OrmPackage.ABSTRACT_XML_TABLE__UNIQUE_CONSTRAINTS;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedName: ");
- result.append(specifiedName);
- result.append(", defaultName: ");
- result.append(defaultName);
- result.append(", specifiedCatalog: ");
- result.append(specifiedCatalog);
- result.append(", defaultCatalog: ");
- result.append(defaultCatalog);
- result.append(", specifiedSchema: ");
- result.append(specifiedSchema);
- result.append(", defaultSchema: ");
- result.append(defaultSchema);
- result.append(')');
- return result.toString();
- }
-
- /**
- * Call this when the table tag is removed from the xml,
- * need to make sure all the model attributes are set to the default
- */
- protected void unsetAllAttributes() {
- eUnset(OrmPackage.XML_TABLE__SPECIFIED_NAME);
- eUnset(OrmPackage.XML_TABLE__SPECIFIED_SCHEMA);
- eUnset(OrmPackage.XML_TABLE__SPECIFIED_CATALOG);
- }
-
- public void refreshDefaults(DefaultsContext defaultsContext) {
- setDefaultCatalog((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_TABLE_CATALOG_KEY));
- setDefaultSchema((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_TABLE_SCHEMA_KEY));
- }
-
- public ITextRange nameTextRange() {
- if (node == null) {
- return owner.validationTextRange();
- }
- IDOMNode nameNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.NAME);
- return (nameNode == null) ? validationTextRange() : buildTextRange(nameNode);
- }
-
- public ITextRange schemaTextRange() {
- if (node == null) {
- return owner.validationTextRange();
- }
- IDOMNode schemaNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.SCHEMA);
- return (schemaNode == null) ? validationTextRange() : buildTextRange(schemaNode);
- }
-
- @Override
- public ITextRange validationTextRange() {
- return (node == null) ? owner.validationTextRange() : super.validationTextRange();
- }
-
- public Owner getOwner() {
- return owner;
- }
-
- public Table dbTable() {
- Schema schema = this.dbSchema();
- return (schema == null) ? null : schema.tableNamed(getName());
- }
-
- public Schema dbSchema() {
- return getJpaProject().connectionProfile().getDatabase().schemaNamed(getSchema());
- }
-
- public boolean hasResolvedSchema() {
- return dbSchema() != null;
- }
-
- public boolean isResolved() {
- return dbTable() != null;
- }
-
- public IUniqueConstraint createUniqueConstraint(int index) {
- return createXmlJavaUniqueConstraint(index);
- }
-
- protected XmlUniqueConstraint createXmlJavaUniqueConstraint(int index) {
- return OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/EntityMappings.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/EntityMappings.java
deleted file mode 100644
index 4bd4d6d76b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/EntityMappings.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Entity Mappings</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappings#getPersistenceUnitMetadata <em>Persistence Unit Metadata</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappings#getPackage <em>Package</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappings()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface EntityMappings extends EObject
-{
- /**
- * Returns the value of the '<em><b>Persistence Unit Metadata</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Persistence Unit Metadata</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persistence Unit Metadata</em>' reference.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappings_PersistenceUnitMetadata()
- * @model resolveProxies="false" changeable="false" volatile="true"
- * @generated
- */
- PersistenceUnitMetadata getPersistenceUnitMetadata();
-
- /**
- * Returns the value of the '<em><b>Package</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Package</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Package</em>' attribute.
- * @see #setPackage(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappings_Package()
- * @model volatile="true"
- * @generated
- */
- String getPackage();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappings#getPackage <em>Package</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Package</em>' attribute.
- * @see #getPackage()
- * @generated
- */
- void setPackage(String value);
-
- void changeMapping(XmlTypeMapping oldMapping, String newMappingKey);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/EntityMappingsForXml.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/EntityMappingsForXml.java
deleted file mode 100644
index 924dd3bd56..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/EntityMappingsForXml.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Entity Mappings For Xml</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml#getPersistenceUnitMetadataForXml <em>Persistence Unit Metadata For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml#getPackageForXml <em>Package For Xml</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsForXml()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface EntityMappingsForXml extends EObject
-{
- /**
- * Returns the value of the '<em><b>Persistence Unit Metadata For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Persistence Unit Metadata For Xml</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persistence Unit Metadata For Xml</em>' reference.
- * @see #setPersistenceUnitMetadataForXml(PersistenceUnitMetadataForXml)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsForXml_PersistenceUnitMetadataForXml()
- * @model resolveProxies="false" volatile="true"
- * @generated
- */
- PersistenceUnitMetadataForXml getPersistenceUnitMetadataForXml();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml#getPersistenceUnitMetadataForXml <em>Persistence Unit Metadata For Xml</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Persistence Unit Metadata For Xml</em>' reference.
- * @see #getPersistenceUnitMetadataForXml()
- * @generated
- */
- void setPersistenceUnitMetadataForXml(PersistenceUnitMetadataForXml value);
-
- /**
- * Returns the value of the '<em><b>Package For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Package For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Package For Xml</em>' attribute.
- * @see #setPackageForXml(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsForXml_PackageForXml()
- * @model volatile="true"
- * @generated
- */
- String getPackageForXml();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml#getPackageForXml <em>Package For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Package For Xml</em>' attribute.
- * @see #getPackageForXml()
- * @generated
- */
- void setPackageForXml(String value);
-} // EntityMappingsForXml
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/EntityMappingsInternal.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/EntityMappingsInternal.java
deleted file mode 100644
index e121f32b02..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/EntityMappingsInternal.java
+++ /dev/null
@@ -1,1680 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.Set;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.EObjectEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jdt.core.ElementChangedEvent;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.core.internal.AccessType;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Entity Mappings Internal</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getRoot <em>Root</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getVersion <em>Version</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getDescription <em>Description</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getPersistenceUnitMetadataInternal <em>Persistence Unit Metadata Internal</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getPackageInternal <em>Package Internal</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getDefaultSchema <em>Default Schema</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSpecifiedSchema <em>Specified Schema</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSchema <em>Schema</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getDefaultCatalog <em>Default Catalog</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSpecifiedCatalog <em>Specified Catalog</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getCatalog <em>Catalog</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getDefaultAccess <em>Default Access</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSpecifiedAccess <em>Specified Access</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getAccess <em>Access</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getTypeMappings <em>Type Mappings</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getPersistentTypes <em>Persistent Types</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSequenceGenerators <em>Sequence Generators</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getTableGenerators <em>Table Generators</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getNamedQueries <em>Named Queries</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getNamedNativeQueries <em>Named Native Queries</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal()
- * @model kind="class"
- * @generated
- */
-public class EntityMappingsInternal extends XmlEObject
- implements IJpaContentNode, EntityMappingsForXml, EntityMappings
-{
- /**
- * The default value of the '{@link #getPackageForXml() <em>Package For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPackageForXml()
- * @generated
- * @ordered
- */
- protected static final String PACKAGE_FOR_XML_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getPackage() <em>Package</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPackage()
- * @generated
- * @ordered
- */
- protected static final String PACKAGE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getRoot() <em>Root</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getRoot()
- * @generated
- * @ordered
- */
- protected XmlRootContentNode root;
-
- /**
- * The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getVersion()
- * @generated
- * @ordered
- */
- protected static final String VERSION_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getVersion()
- * @generated
- * @ordered
- */
- protected String version = VERSION_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDescription()
- * @generated
- * @ordered
- */
- protected static final String DESCRIPTION_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDescription()
- * @generated
- * @ordered
- */
- protected String description = DESCRIPTION_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getPersistenceUnitMetadataInternal() <em>Persistence Unit Metadata Internal</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPersistenceUnitMetadataInternal()
- * @generated
- * @ordered
- */
- protected PersistenceUnitMetadataInternal persistenceUnitMetadataInternal;
-
- /**
- * The default value of the '{@link #getPackageInternal() <em>Package Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPackageInternal()
- * @generated
- * @ordered
- */
- protected static final String PACKAGE_INTERNAL_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getPackageInternal() <em>Package Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPackageInternal()
- * @generated
- * @ordered
- */
- protected String packageInternal = PACKAGE_INTERNAL_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultSchema() <em>Default Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultSchema()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_SCHEMA_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultSchema() <em>Default Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultSchema()
- * @generated
- * @ordered
- */
- protected String defaultSchema = DEFAULT_SCHEMA_EDEFAULT;
-
- /**
- * The default value of the '{@link #getSpecifiedSchema() <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSchema()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_SCHEMA_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedSchema() <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSchema()
- * @generated
- * @ordered
- */
- protected String specifiedSchema = SPECIFIED_SCHEMA_EDEFAULT;
-
- /**
- * The default value of the '{@link #getSchema() <em>Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSchema()
- * @generated
- * @ordered
- */
- protected static final String SCHEMA_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getDefaultCatalog() <em>Default Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultCatalog()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_CATALOG_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultCatalog() <em>Default Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultCatalog()
- * @generated
- * @ordered
- */
- protected String defaultCatalog = DEFAULT_CATALOG_EDEFAULT;
-
- /**
- * The default value of the '{@link #getSpecifiedCatalog() <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedCatalog()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_CATALOG_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedCatalog() <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedCatalog()
- * @generated
- * @ordered
- */
- protected String specifiedCatalog = SPECIFIED_CATALOG_EDEFAULT;
-
- /**
- * The default value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getCatalog()
- * @generated
- * @ordered
- */
- protected static final String CATALOG_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getDefaultAccess() <em>Default Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultAccess()
- * @generated
- * @ordered
- */
- protected static final AccessType DEFAULT_ACCESS_EDEFAULT = AccessType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getDefaultAccess() <em>Default Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultAccess()
- * @generated
- * @ordered
- */
- protected AccessType defaultAccess = DEFAULT_ACCESS_EDEFAULT;
-
- /**
- * The default value of the '{@link #getSpecifiedAccess() <em>Specified Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedAccess()
- * @generated
- * @ordered
- */
- protected static final AccessType SPECIFIED_ACCESS_EDEFAULT = AccessType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getSpecifiedAccess() <em>Specified Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedAccess()
- * @generated
- * @ordered
- */
- protected AccessType specifiedAccess = SPECIFIED_ACCESS_EDEFAULT;
-
- /**
- * The default value of the '{@link #getAccess() <em>Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getAccess()
- * @generated
- * @ordered
- */
- protected static final AccessType ACCESS_EDEFAULT = AccessType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getTypeMappings() <em>Type Mappings</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTypeMappings()
- * @generated
- * @ordered
- */
- protected EList<XmlTypeMapping> typeMappings;
-
- /**
- * The cached value of the '{@link #getPersistentTypes() <em>Persistent Types</em>}' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPersistentTypes()
- * @generated
- * @ordered
- */
- protected EList<XmlPersistentType> persistentTypes;
-
- /**
- * The cached value of the '{@link #getSequenceGenerators() <em>Sequence Generators</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSequenceGenerators()
- * @generated
- * @ordered
- */
- protected EList<XmlSequenceGenerator> sequenceGenerators;
-
- /**
- * The cached value of the '{@link #getTableGenerators() <em>Table Generators</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTableGenerators()
- * @generated
- * @ordered
- */
- protected EList<XmlTableGenerator> tableGenerators;
-
- /**
- * The cached value of the '{@link #getNamedQueries() <em>Named Queries</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getNamedQueries()
- * @generated
- * @ordered
- */
- protected EList<XmlNamedQuery> namedQueries;
-
- /**
- * The cached value of the '{@link #getNamedNativeQueries() <em>Named Native Queries</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getNamedNativeQueries()
- * @generated
- * @ordered
- */
- protected EList<XmlNamedNativeQuery> namedNativeQueries;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated NOT
- */
- protected EntityMappingsInternal() {
- super();
- //we don't want a setter for this object since it should never be null, but
- //it must be initialized and is necessary for emf to call the eInverseAdd method
- this.persistenceUnitMetadataInternal = OrmFactory.eINSTANCE.createPersistenceUnitMetadataInternal();
- ((InternalEObject) this.persistenceUnitMetadataInternal).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA_INTERNAL, null, null);
- }
-
- @Override
- protected void addInsignificantFeatureIdsTo(Set<Integer> insignificantFeatureIds) {
- super.addInsignificantFeatureIdsTo(insignificantFeatureIds);
- insignificantFeatureIds.add(OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENT_TYPES);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.ENTITY_MAPPINGS_INTERNAL;
- }
-
- /**
- * Returns the value of the '<em><b>Access</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.content.orm.AccessType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Access</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Access</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.AccessType
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_Access()
- * @model transient="true" changeable="false" volatile="true"
- * @generated NOT
- */
- public AccessType getAccess() {
- return (this.getSpecifiedAccess() == null) ? this.getDefaultAccess() : this.getSpecifiedAccess();
- }
-
- /**
- * Returns the value of the '<em><b>Persistence Unit Metadata For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * API just for the xml translators. Null in the model for a containment
- * object corresponds to no persistence-unit-metadata xml tag in the xml file.
- * We check for whether any features are set in the model and return null for
- * persistenceUnitMetadataForXml if there aren't any. Otherwise we return
- * the persistenceUnitMetadataInternal that has already been created.
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persistence Unit Metadata For Xml</em>' reference.
- * @see #setPersistenceUnitMetadataForXml(PersistenceUnitMetadataForXml)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsForXml_PersistenceUnitMetadataForXml()
- * @model resolveProxies="false" volatile="true"
- * @generated NOT
- */
- public PersistenceUnitMetadataForXml getPersistenceUnitMetadataForXml() {
- if (getPersistenceUnitMetadataInternal().isAllFeaturesUnset()) {
- return null;
- }
- return getPersistenceUnitMetadataInternal();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getPersistenceUnitMetadataForXml <em>Persistence Unit Metadata For Xml</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Persistence Unit Metadata For Xml</em>' reference.
- * @see #getPersistenceUnitMetadataForXml()
- * @generated NOT
- */
- public void setPersistenceUnitMetadataForXmlGen(PersistenceUnitMetadataForXml newPersistenceUnitMetadataForXml) {
- PersistenceUnitMetadataForXml oldValue = newPersistenceUnitMetadataForXml == null ? (PersistenceUnitMetadataForXml) getPersistenceUnitMetadata() : null;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA_FOR_XML, oldValue, newPersistenceUnitMetadataForXml));
- }
-
- public void setPersistenceUnitMetadataForXml(PersistenceUnitMetadataForXml newPersistenceUnitMetadataForXml) {
- setPersistenceUnitMetadataForXmlGen(newPersistenceUnitMetadataForXml);
- if (newPersistenceUnitMetadataForXml == null) {
- getPersistenceUnitMetadataInternal().unsetAllAttributes();
- }
- }
-
- public String getPackageForXml() {
- return getPackageInternal();
- }
-
- public void setPackageForXml(String newPackageForXml) {
- setPackageInternal(newPackageForXml);
- if (eNotificationRequired())
- //pass in oldValue of null because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE_FOR_XML, null, newPackageForXml));
- }
-
- public void makePersistenceUnitMetadataForXmlNull() {
- setPersistenceUnitMetadataForXmlGen(null);
- }
-
- public void makePersistenceUnitMetadataForXmlNonNull() {
- setPersistenceUnitMetadataForXmlGen(getPersistenceUnitMetadataForXml());
- }
-
- /**
- * Returns the value of the '<em><b>Persistence Unit Metadata</b></em>' containment reference.
- * The default value is <code>""</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Persistence Unit Metadata</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persistence Unit Metadata</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappings_PersistenceUnitMetadata()
- * @model containment="true" required="true" changeable="false" volatile="true"
- * @generated NOT
- */
- public PersistenceUnitMetadata getPersistenceUnitMetadata() {
- return getPersistenceUnitMetadataInternal();
- }
-
- /**
- * Returns the value of the '<em><b>Root</b></em>' reference.
- * It is bidirectional and its opposite is '{@link org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode#getEntityMappings <em>Entity Mappings</em>}'.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Root</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Root</em>' reference.
- * @see #setRoot(XmlRootContentNode)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_Root()
- * @see org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode#getEntityMappings
- * @model opposite="entityMappings" resolveProxies="false" required="true" ordered="false"
- * @generated
- */
- public XmlRootContentNode getRoot() {
- return root;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetRoot(XmlRootContentNode newRoot, NotificationChain msgs) {
- XmlRootContentNode oldRoot = root;
- root = newRoot;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS_INTERNAL__ROOT, oldRoot, newRoot);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getRoot <em>Root</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Root</em>' reference.
- * @see #getRoot()
- * @generated
- */
- public void setRoot(XmlRootContentNode newRoot) {
- if (newRoot != root) {
- NotificationChain msgs = null;
- if (root != null)
- msgs = ((InternalEObject) root).eInverseRemove(this, OrmPackage.XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS, XmlRootContentNode.class, msgs);
- if (newRoot != null)
- msgs = ((InternalEObject) newRoot).eInverseAdd(this, OrmPackage.XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS, XmlRootContentNode.class, msgs);
- msgs = basicSetRoot(newRoot, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS_INTERNAL__ROOT, newRoot, newRoot));
- }
-
- /**
- * Returns the value of the '<em><b>Version</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Version</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Version</em>' attribute.
- * @see #setVersion(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_Version()
- * @model
- * @generated
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getVersion <em>Version</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Version</em>' attribute.
- * @see #getVersion()
- * @generated
- */
- public void setVersion(String newVersion) {
- String oldVersion = version;
- version = newVersion;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS_INTERNAL__VERSION, oldVersion, version));
- }
-
- /**
- * Returns the value of the '<em><b>Description</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Description</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Description</em>' attribute.
- * @see #setDescription(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_Description()
- * @model
- * @generated
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getDescription <em>Description</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Description</em>' attribute.
- * @see #getDescription()
- * @generated
- */
- public void setDescription(String newDescription) {
- String oldDescription = description;
- description = newDescription;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS_INTERNAL__DESCRIPTION, oldDescription, description));
- }
-
- /**
- * Returns the value of the '<em><b>Persistence Unit Metadata Internal</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Persistence Unit Metadata Internal</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persistence Unit Metadata Internal</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_PersistenceUnitMetadataInternal()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- public PersistenceUnitMetadataInternal getPersistenceUnitMetadataInternal() {
- return persistenceUnitMetadataInternal;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetPersistenceUnitMetadataInternal(PersistenceUnitMetadataInternal newPersistenceUnitMetadataInternal, NotificationChain msgs) {
- PersistenceUnitMetadataInternal oldPersistenceUnitMetadataInternal = persistenceUnitMetadataInternal;
- persistenceUnitMetadataInternal = newPersistenceUnitMetadataInternal;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA_INTERNAL, oldPersistenceUnitMetadataInternal, newPersistenceUnitMetadataInternal);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Returns the value of the '<em><b>Package Internal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Package Internal</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Package Internal</em>' attribute.
- * @see #setPackageInternal(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_PackageInternal()
- * @model
- * @generated
- */
- public String getPackageInternal() {
- return packageInternal;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getPackageInternal <em>Package Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Package Internal</em>' attribute.
- * @see #getPackageInternal()
- * @generated NOT
- */
- public void setPackageInternal(String newPackageInternal) {
- String oldPackageInternal = packageInternal;
- packageInternal = newPackageInternal;
- if (eNotificationRequired()) {
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE_INTERNAL, oldPackageInternal, packageInternal));
- //notification so the UI is updated when the xml changes, can't call the UI api
- //because it has other side effects
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE, oldPackageInternal, packageInternal));
- }
- }
-
- /**
- * Returns the value of the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Schema</em>' attribute.
- * @see #setDefaultSchema(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_DefaultSchema()
- * @model
- * @generated
- */
- public String getDefaultSchema() {
- return defaultSchema;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getDefaultSchema <em>Default Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Default Schema</em>' attribute.
- * @see #getDefaultSchema()
- * @generated
- */
- public void setDefaultSchema(String newDefaultSchema) {
- String oldDefaultSchema = defaultSchema;
- defaultSchema = newDefaultSchema;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_SCHEMA, oldDefaultSchema, defaultSchema));
- }
-
- /**
- * Returns the value of the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Schema</em>' attribute.
- * @see #setSpecifiedSchema(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_SpecifiedSchema()
- * @model
- * @generated
- */
- public String getSpecifiedSchema() {
- return specifiedSchema;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSpecifiedSchema <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Schema</em>' attribute.
- * @see #getSpecifiedSchema()
- * @generated
- */
- public void setSpecifiedSchema(String newSpecifiedSchema) {
- String oldSpecifiedSchema = specifiedSchema;
- specifiedSchema = newSpecifiedSchema;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_SCHEMA, oldSpecifiedSchema, specifiedSchema));
- }
-
- /**
- * Returns the value of the '<em><b>Package</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Package</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Package</em>' attribute.
- * @see #setPackage(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappings_Package()
- * @model volatile="true"
- * @generated NOT
- */
- public String getPackage() {
- return getPackageInternal();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getPackage <em>Package</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Package</em>' attribute.
- * @see #getPackage()
- * @generated NOT
- */
- public void setPackage(String newPackage) {
- if (newPackage == "") {
- newPackage = null;
- }
- setPackageInternal(newPackage);
- setPackageForXml(newPackage);
- }
-
- /**
- * Returns the value of the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Schema</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_Schema()
- * @model transient="true" changeable="false" volatile="true"
- * @generated NOT
- */
- public String getSchema() {
- return (this.getSpecifiedSchema() == null) ? this.getDefaultSchema() : this.getSpecifiedSchema();
- }
-
- /**
- * Returns the value of the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Catalog</em>' attribute.
- * @see #setDefaultCatalog(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_DefaultCatalog()
- * @model
- * @generated
- */
- public String getDefaultCatalog() {
- return defaultCatalog;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getDefaultCatalog <em>Default Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Default Catalog</em>' attribute.
- * @see #getDefaultCatalog()
- * @generated
- */
- public void setDefaultCatalog(String newDefaultCatalog) {
- String oldDefaultCatalog = defaultCatalog;
- defaultCatalog = newDefaultCatalog;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_CATALOG, oldDefaultCatalog, defaultCatalog));
- }
-
- /**
- * Returns the value of the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Catalog</em>' attribute.
- * @see #setSpecifiedCatalog(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_SpecifiedCatalog()
- * @model
- * @generated
- */
- public String getSpecifiedCatalog() {
- return specifiedCatalog;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSpecifiedCatalog <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Catalog</em>' attribute.
- * @see #getSpecifiedCatalog()
- * @generated
- */
- public void setSpecifiedCatalog(String newSpecifiedCatalog) {
- String oldSpecifiedCatalog = specifiedCatalog;
- specifiedCatalog = newSpecifiedCatalog;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_CATALOG, oldSpecifiedCatalog, specifiedCatalog));
- }
-
- /**
- * Returns the value of the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Catalog</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_Catalog()
- * @model transient="true" changeable="false" volatile="true"
- * @generated NOT
- */
- public String getCatalog() {
- return (this.getSpecifiedCatalog() == null) ? this.getDefaultCatalog() : this.getSpecifiedCatalog();
- }
-
- /**
- * Returns the value of the '<em><b>Default Access</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.AccessType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Access</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Access</em>' attribute.
- * @see org.eclipse.jpt.core.internal.AccessType
- * @see #setDefaultAccess(AccessType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_DefaultAccess()
- * @model
- * @generated
- */
- public AccessType getDefaultAccess() {
- return defaultAccess;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getDefaultAccess <em>Default Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Default Access</em>' attribute.
- * @see org.eclipse.jpt.core.internal.AccessType
- * @see #getDefaultAccess()
- * @generated
- */
- public void setDefaultAccess(AccessType newDefaultAccess) {
- AccessType oldDefaultAccess = defaultAccess;
- defaultAccess = newDefaultAccess == null ? DEFAULT_ACCESS_EDEFAULT : newDefaultAccess;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_ACCESS, oldDefaultAccess, defaultAccess));
- }
-
- /**
- * Returns the value of the '<em><b>Specified Access</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.AccessType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Access</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Access</em>' attribute.
- * @see org.eclipse.jpt.core.internal.AccessType
- * @see #setSpecifiedAccess(AccessType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_SpecifiedAccess()
- * @model
- * @generated
- */
- public AccessType getSpecifiedAccess() {
- return specifiedAccess;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSpecifiedAccess <em>Specified Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Access</em>' attribute.
- * @see org.eclipse.jpt.core.internal.AccessType
- * @see #getSpecifiedAccess()
- * @generated
- */
- public void setSpecifiedAccess(AccessType newSpecifiedAccess) {
- AccessType oldSpecifiedAccess = specifiedAccess;
- specifiedAccess = newSpecifiedAccess == null ? SPECIFIED_ACCESS_EDEFAULT : newSpecifiedAccess;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_ACCESS, oldSpecifiedAccess, specifiedAccess));
- }
-
- /**
- * Returns the value of the '<em><b>Type Mappings</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Type Mappings</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Type Mappings</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_TypeMappings()
- * @model containment="true"
- * @generated
- */
- public EList<XmlTypeMapping> getTypeMappingsGen() {
- if (typeMappings == null) {
- typeMappings = new EObjectContainmentEList<XmlTypeMapping>(XmlTypeMapping.class, this, OrmPackage.ENTITY_MAPPINGS_INTERNAL__TYPE_MAPPINGS);
- }
- return typeMappings;
- }
-
- public EList<XmlTypeMapping> getTypeMappings() {
- if (typeMappings == null) {
- typeMappings = new TypeMappingsList<XmlTypeMapping>();
- }
- return getTypeMappingsGen();
- }
-
- /**
- * Returns the value of the '<em><b>Persistent Types</b></em>' reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Persistent Types</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persistent Types</em>' reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_PersistentTypes()
- * @model resolveProxies="false"
- * @generated
- */
- public EList<XmlPersistentType> getPersistentTypes() {
- if (persistentTypes == null) {
- persistentTypes = new EObjectEList<XmlPersistentType>(XmlPersistentType.class, this, OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENT_TYPES);
- }
- return persistentTypes;
- }
-
- public boolean containsPersistentType(IType type) {
- if (type == null) {
- return false;
- }
- for (XmlPersistentType each : getPersistentTypes()) {
- if (type.equals(each.findJdtType())) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns the value of the '<em><b>Table Generators</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table Generators</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table Generators</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_TableGenerators()
- * @model containment="true"
- * @generated
- */
- public EList<XmlTableGenerator> getTableGenerators() {
- if (tableGenerators == null) {
- tableGenerators = new EObjectContainmentEList<XmlTableGenerator>(XmlTableGenerator.class, this, OrmPackage.ENTITY_MAPPINGS_INTERNAL__TABLE_GENERATORS);
- }
- return tableGenerators;
- }
-
- /**
- * Returns the value of the '<em><b>Named Queries</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.orm.XmlNamedQuery}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Named Queries</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Named Queries</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_NamedQueries()
- * @model containment="true"
- * @generated
- */
- public EList<XmlNamedQuery> getNamedQueries() {
- if (namedQueries == null) {
- namedQueries = new EObjectContainmentEList<XmlNamedQuery>(XmlNamedQuery.class, this, OrmPackage.ENTITY_MAPPINGS_INTERNAL__NAMED_QUERIES);
- }
- return namedQueries;
- }
-
- /**
- * Returns the value of the '<em><b>Named Native Queries</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.orm.XmlNamedNativeQuery}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Named Native Queries</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Named Native Queries</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_NamedNativeQueries()
- * @model containment="true"
- * @generated
- */
- public EList<XmlNamedNativeQuery> getNamedNativeQueries() {
- if (namedNativeQueries == null) {
- namedNativeQueries = new EObjectContainmentEList<XmlNamedNativeQuery>(XmlNamedNativeQuery.class, this, OrmPackage.ENTITY_MAPPINGS_INTERNAL__NAMED_NATIVE_QUERIES);
- }
- return namedNativeQueries;
- }
-
- /**
- * Returns the value of the '<em><b>Sequence Generators</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.orm.XmlSequenceGenerator}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Sequence Generators</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Sequence Generators</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal_SequenceGenerators()
- * @model containment="true"
- * @generated
- */
- public EList<XmlSequenceGenerator> getSequenceGenerators() {
- if (sequenceGenerators == null) {
- sequenceGenerators = new EObjectContainmentEList<XmlSequenceGenerator>(XmlSequenceGenerator.class, this, OrmPackage.ENTITY_MAPPINGS_INTERNAL__SEQUENCE_GENERATORS);
- }
- return sequenceGenerators;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__ROOT :
- if (root != null)
- msgs = ((InternalEObject) root).eInverseRemove(this, OrmPackage.XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS, XmlRootContentNode.class, msgs);
- return basicSetRoot((XmlRootContentNode) otherEnd, msgs);
- }
- return super.eInverseAdd(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__ROOT :
- return basicSetRoot(null, msgs);
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA_INTERNAL :
- return basicSetPersistenceUnitMetadataInternal(null, msgs);
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__TYPE_MAPPINGS :
- return ((InternalEList<?>) getTypeMappings()).basicRemove(otherEnd, msgs);
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SEQUENCE_GENERATORS :
- return ((InternalEList<?>) getSequenceGenerators()).basicRemove(otherEnd, msgs);
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__TABLE_GENERATORS :
- return ((InternalEList<?>) getTableGenerators()).basicRemove(otherEnd, msgs);
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__NAMED_QUERIES :
- return ((InternalEList<?>) getNamedQueries()).basicRemove(otherEnd, msgs);
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__NAMED_NATIVE_QUERIES :
- return ((InternalEList<?>) getNamedNativeQueries()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA_FOR_XML :
- return getPersistenceUnitMetadataForXml();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE_FOR_XML :
- return getPackageForXml();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA :
- return getPersistenceUnitMetadata();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE :
- return getPackage();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__ROOT :
- return getRoot();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__VERSION :
- return getVersion();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__DESCRIPTION :
- return getDescription();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA_INTERNAL :
- return getPersistenceUnitMetadataInternal();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE_INTERNAL :
- return getPackageInternal();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_SCHEMA :
- return getDefaultSchema();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_SCHEMA :
- return getSpecifiedSchema();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SCHEMA :
- return getSchema();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_CATALOG :
- return getDefaultCatalog();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_CATALOG :
- return getSpecifiedCatalog();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__CATALOG :
- return getCatalog();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_ACCESS :
- return getDefaultAccess();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_ACCESS :
- return getSpecifiedAccess();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__ACCESS :
- return getAccess();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__TYPE_MAPPINGS :
- return getTypeMappings();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENT_TYPES :
- return getPersistentTypes();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SEQUENCE_GENERATORS :
- return getSequenceGenerators();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__TABLE_GENERATORS :
- return getTableGenerators();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__NAMED_QUERIES :
- return getNamedQueries();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__NAMED_NATIVE_QUERIES :
- return getNamedNativeQueries();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA_FOR_XML :
- setPersistenceUnitMetadataForXml((PersistenceUnitMetadataForXml) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE_FOR_XML :
- setPackageForXml((String) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE :
- setPackage((String) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__ROOT :
- setRoot((XmlRootContentNode) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__VERSION :
- setVersion((String) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__DESCRIPTION :
- setDescription((String) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE_INTERNAL :
- setPackageInternal((String) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_SCHEMA :
- setDefaultSchema((String) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_SCHEMA :
- setSpecifiedSchema((String) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_CATALOG :
- setDefaultCatalog((String) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_CATALOG :
- setSpecifiedCatalog((String) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_ACCESS :
- setDefaultAccess((AccessType) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_ACCESS :
- setSpecifiedAccess((AccessType) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__TYPE_MAPPINGS :
- getTypeMappings().clear();
- getTypeMappings().addAll((Collection<? extends XmlTypeMapping>) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENT_TYPES :
- getPersistentTypes().clear();
- getPersistentTypes().addAll((Collection<? extends XmlPersistentType>) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SEQUENCE_GENERATORS :
- getSequenceGenerators().clear();
- getSequenceGenerators().addAll((Collection<? extends XmlSequenceGenerator>) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__TABLE_GENERATORS :
- getTableGenerators().clear();
- getTableGenerators().addAll((Collection<? extends XmlTableGenerator>) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__NAMED_QUERIES :
- getNamedQueries().clear();
- getNamedQueries().addAll((Collection<? extends XmlNamedQuery>) newValue);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__NAMED_NATIVE_QUERIES :
- getNamedNativeQueries().clear();
- getNamedNativeQueries().addAll((Collection<? extends XmlNamedNativeQuery>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA_FOR_XML :
- setPersistenceUnitMetadataForXml((PersistenceUnitMetadataForXml) null);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE_FOR_XML :
- setPackageForXml(PACKAGE_FOR_XML_EDEFAULT);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE :
- setPackage(PACKAGE_EDEFAULT);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__ROOT :
- setRoot((XmlRootContentNode) null);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__VERSION :
- setVersion(VERSION_EDEFAULT);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__DESCRIPTION :
- setDescription(DESCRIPTION_EDEFAULT);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE_INTERNAL :
- setPackageInternal(PACKAGE_INTERNAL_EDEFAULT);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_SCHEMA :
- setDefaultSchema(DEFAULT_SCHEMA_EDEFAULT);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_SCHEMA :
- setSpecifiedSchema(SPECIFIED_SCHEMA_EDEFAULT);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_CATALOG :
- setDefaultCatalog(DEFAULT_CATALOG_EDEFAULT);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_CATALOG :
- setSpecifiedCatalog(SPECIFIED_CATALOG_EDEFAULT);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_ACCESS :
- setDefaultAccess(DEFAULT_ACCESS_EDEFAULT);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_ACCESS :
- setSpecifiedAccess(SPECIFIED_ACCESS_EDEFAULT);
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__TYPE_MAPPINGS :
- getTypeMappings().clear();
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENT_TYPES :
- getPersistentTypes().clear();
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SEQUENCE_GENERATORS :
- getSequenceGenerators().clear();
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__TABLE_GENERATORS :
- getTableGenerators().clear();
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__NAMED_QUERIES :
- getNamedQueries().clear();
- return;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__NAMED_NATIVE_QUERIES :
- getNamedNativeQueries().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA_FOR_XML :
- return getPersistenceUnitMetadataForXml() != null;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE_FOR_XML :
- return PACKAGE_FOR_XML_EDEFAULT == null ? getPackageForXml() != null : !PACKAGE_FOR_XML_EDEFAULT.equals(getPackageForXml());
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA :
- return getPersistenceUnitMetadata() != null;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE :
- return PACKAGE_EDEFAULT == null ? getPackage() != null : !PACKAGE_EDEFAULT.equals(getPackage());
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__ROOT :
- return root != null;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__VERSION :
- return VERSION_EDEFAULT == null ? version != null : !VERSION_EDEFAULT.equals(version);
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__DESCRIPTION :
- return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA_INTERNAL :
- return persistenceUnitMetadataInternal != null;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE_INTERNAL :
- return PACKAGE_INTERNAL_EDEFAULT == null ? packageInternal != null : !PACKAGE_INTERNAL_EDEFAULT.equals(packageInternal);
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_SCHEMA :
- return DEFAULT_SCHEMA_EDEFAULT == null ? defaultSchema != null : !DEFAULT_SCHEMA_EDEFAULT.equals(defaultSchema);
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_SCHEMA :
- return SPECIFIED_SCHEMA_EDEFAULT == null ? specifiedSchema != null : !SPECIFIED_SCHEMA_EDEFAULT.equals(specifiedSchema);
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SCHEMA :
- return SCHEMA_EDEFAULT == null ? getSchema() != null : !SCHEMA_EDEFAULT.equals(getSchema());
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_CATALOG :
- return DEFAULT_CATALOG_EDEFAULT == null ? defaultCatalog != null : !DEFAULT_CATALOG_EDEFAULT.equals(defaultCatalog);
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_CATALOG :
- return SPECIFIED_CATALOG_EDEFAULT == null ? specifiedCatalog != null : !SPECIFIED_CATALOG_EDEFAULT.equals(specifiedCatalog);
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__CATALOG :
- return CATALOG_EDEFAULT == null ? getCatalog() != null : !CATALOG_EDEFAULT.equals(getCatalog());
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_ACCESS :
- return defaultAccess != DEFAULT_ACCESS_EDEFAULT;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_ACCESS :
- return specifiedAccess != SPECIFIED_ACCESS_EDEFAULT;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__ACCESS :
- return getAccess() != ACCESS_EDEFAULT;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__TYPE_MAPPINGS :
- return typeMappings != null && !typeMappings.isEmpty();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENT_TYPES :
- return persistentTypes != null && !persistentTypes.isEmpty();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__SEQUENCE_GENERATORS :
- return sequenceGenerators != null && !sequenceGenerators.isEmpty();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__TABLE_GENERATORS :
- return tableGenerators != null && !tableGenerators.isEmpty();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__NAMED_QUERIES :
- return namedQueries != null && !namedQueries.isEmpty();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__NAMED_NATIVE_QUERIES :
- return namedNativeQueries != null && !namedNativeQueries.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaContentNode.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == EntityMappingsForXml.class) {
- switch (derivedFeatureID) {
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA_FOR_XML :
- return OrmPackage.ENTITY_MAPPINGS_FOR_XML__PERSISTENCE_UNIT_METADATA_FOR_XML;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE_FOR_XML :
- return OrmPackage.ENTITY_MAPPINGS_FOR_XML__PACKAGE_FOR_XML;
- default :
- return -1;
- }
- }
- if (baseClass == EntityMappings.class) {
- switch (derivedFeatureID) {
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA :
- return OrmPackage.ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA;
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE :
- return OrmPackage.ENTITY_MAPPINGS__PACKAGE;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaContentNode.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == EntityMappingsForXml.class) {
- switch (baseFeatureID) {
- case OrmPackage.ENTITY_MAPPINGS_FOR_XML__PERSISTENCE_UNIT_METADATA_FOR_XML :
- return OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA_FOR_XML;
- case OrmPackage.ENTITY_MAPPINGS_FOR_XML__PACKAGE_FOR_XML :
- return OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE_FOR_XML;
- default :
- return -1;
- }
- }
- if (baseClass == EntityMappings.class) {
- switch (baseFeatureID) {
- case OrmPackage.ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA :
- return OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA;
- case OrmPackage.ENTITY_MAPPINGS__PACKAGE :
- return OrmPackage.ENTITY_MAPPINGS_INTERNAL__PACKAGE;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (version: ");
- result.append(version);
- result.append(", description: ");
- result.append(description);
- result.append(", packageInternal: ");
- result.append(packageInternal);
- result.append(", defaultSchema: ");
- result.append(defaultSchema);
- result.append(", specifiedSchema: ");
- result.append(specifiedSchema);
- result.append(", defaultCatalog: ");
- result.append(defaultCatalog);
- result.append(", specifiedCatalog: ");
- result.append(specifiedCatalog);
- result.append(", defaultAccess: ");
- result.append(defaultAccess);
- result.append(", specifiedAccess: ");
- result.append(specifiedAccess);
- result.append(')');
- return result.toString();
- }
-
- public void addMapping(String className, String mappingKey) {
- XmlPersistentType persistentType = OrmFactory.eINSTANCE.createXmlPersistentType();
- XmlTypeMapping typeMapping = buildXmlTypeMapping(persistentType.typeMappingProviders(), mappingKey);
- if (className.startsWith(getPackage() + ".")) {
- // adds short name if package name is specified
- className = className.substring(getPackage().length() + 1);
- }
- typeMapping.getPersistentType().setClass(className);
- insertTypeMapping(typeMapping);
- }
-
- public void changeMapping(XmlTypeMapping oldMapping, String newMappingKey) {
- XmlTypeMapping newTypeMapping = buildXmlTypeMapping(oldMapping.getPersistentType().typeMappingProviders(), newMappingKey);
- newTypeMapping.setPersistentType(oldMapping.getPersistentType());
- getTypeMappings().remove(oldMapping);
- newTypeMapping.initializeFrom(oldMapping);
- insertTypeMapping(newTypeMapping);
- }
-
- private XmlTypeMapping buildXmlTypeMapping(Collection<IXmlTypeMappingProvider> providers, String key) {
- for (IXmlTypeMappingProvider provider : providers) {
- if (provider.key().equals(key)) {
- return provider.buildTypeMapping();
- }
- }
- //TODO throw an exception? what about the NullJavaTypeMapping?
- return null;
- }
-
- private void insertTypeMapping(XmlTypeMapping newMapping) {
- int newIndex = CollectionTools.insertionIndexOf(getTypeMappings(), newMapping, buildMappingComparator());
- getTypeMappings().add(newIndex, newMapping);
- }
-
- private Comparator<XmlTypeMapping> buildMappingComparator() {
- return new Comparator<XmlTypeMapping>() {
- public int compare(XmlTypeMapping o1, XmlTypeMapping o2) {
- int o1Sequence = o1.xmlSequence();
- int o2Sequence = o2.xmlSequence();
- if (o1Sequence < o2Sequence) {
- return -1;
- }
- if (o1Sequence == o2Sequence) {
- return 0;
- }
- return 1;
- }
- };
- }
-
- /**
- * Override this because EntityMappingInternal does not have an eContainer()
- * This is because entityMappings is the "root" feature of the doc for xml Translators
- * and thus cannot be "contained"
- */
- @Override
- public IJpaProject getJpaProject() {
- IJpaFile file = getJpaFile();
- return (file == null) ? null : file.getJpaProject();
- }
-
- /* @see IJpaContentNode#getId() */
- public Object getId() {
- return IXmlContentNodes.ENTITY_MAPPINGS_ID;
- }
-
- public IJpaContentNode getContentNode(int offset) {
- for (Iterator i = getTypeMappings().iterator(); i.hasNext();) {
- XmlTypeMapping mapping = (XmlTypeMapping) i.next();
- if (mapping.getNode().contains(offset)) {
- return mapping.getContentNode(offset);
- }
- }
- return this;
- }
-
- public void javaElementChanged(ElementChangedEvent event) {
- for (XmlTypeMapping typeMapping : this.getTypeMappings()) {
- //typeMapping.javaElementChanged(event);
- }
- }
-
- public void refreshDefaults(DefaultsContext defaultsContext) {
- setDefaultCatalog((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_TABLE_CATALOG_KEY));
- setDefaultSchema((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_TABLE_SCHEMA_KEY));
- setDefaultAccess((AccessType) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_ACCESS_KEY));
- }
-
-
- private class TypeMappingsList<E>
- extends EObjectContainmentEList<XmlTypeMapping>
- {
- private TypeMappingsList() {
- super(XmlTypeMapping.class, EntityMappingsInternal.this, OrmPackage.ENTITY_MAPPINGS_INTERNAL__TYPE_MAPPINGS);
- }
-
- @Override
- protected void didAdd(int index, XmlTypeMapping newObject) {
- XmlPersistentType type = newObject.getPersistentType();
- if (getPersistentTypes().contains(type)) {
- // the type has been remapped. don't remove, simply move.
- getPersistentTypes().move(index, type);
- }
- else {
- getPersistentTypes().add(index, type);
- }
- }
-
- @Override
- protected void didChange() {
- // TODO Auto-generated method stub
- super.didChange();
- }
-
- @Override
- protected void didClear(int size, Object[] oldObjects) {
- getPersistentTypes().clear();
- }
-
- @Override
- protected void didMove(int index, XmlTypeMapping movedObject, int oldIndex) {
- getPersistentTypes().move(index, movedObject.getPersistentType());
- }
-
- @Override
- protected void didRemove(int index, XmlTypeMapping oldObject) {
- XmlPersistentType type = oldObject.getPersistentType();
- if (type != null) {
- // the type has been remapped. don't remove, simply move.
- // (see didAdd(int, XmlTypeMapping) )
- getPersistentTypes().remove(oldObject.getPersistentType());
- }
- }
-
- @Override
- protected void didSet(int index, XmlTypeMapping newObject, XmlTypeMapping oldObject) {
- getPersistentTypes().set(index, newObject.getPersistentType());
- }
- }
-} // EntityMappingsInternal
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/IXmlColumnMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/IXmlColumnMapping.java
deleted file mode 100644
index c071c1308b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/IXmlColumnMapping.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IXml Column Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.IXmlColumnMapping#getColumnForXml <em>Column For Xml</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIXmlColumnMapping()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IXmlColumnMapping extends IColumnMapping
-{
- /**
- * Returns the value of the '<em><b>Column For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column For Xml</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column For Xml</em>' reference.
- * @see #setColumnForXml(XmlColumn)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIXmlColumnMapping_ColumnForXml()
- * @model resolveProxies="false" volatile="true"
- * @generated
- */
- XmlColumn getColumnForXml();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.IXmlColumnMapping#getColumnForXml <em>Column For Xml</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Column For Xml</em>' reference.
- * @see #getColumnForXml()
- * @generated
- */
- void setColumnForXml(XmlColumn value);
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated
- */
- void makeColumnForXmlNonNull();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated
- */
- void makeColumnForXmlNull();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/IXmlContentNodes.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/IXmlContentNodes.java
deleted file mode 100644
index 59d4ff5107..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/IXmlContentNodes.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-
-public interface IXmlContentNodes
-{
- public static final String XML_ROOT_ID =
- JptCorePlugin.PLUGIN_ID + ".xml.Root";
-
- public static final String ENTITY_MAPPINGS_ID =
- JptCorePlugin.PLUGIN_ID + ".xml.entityMappings";
-
- public static final String PERSISTENT_TYPE_ID =
- JptCorePlugin.PLUGIN_ID + ".xml.persistentType";
-
- public static final String PERSISTENT_ATTRIBUTE_ID =
- JptCorePlugin.PLUGIN_ID + ".xml.persistentAttribute";
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmFactory.java
deleted file mode 100644
index 75b6486828..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmFactory.java
+++ /dev/null
@@ -1,698 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.impl.EFactoryImpl;
-import org.eclipse.emf.ecore.plugin.EcorePlugin;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model <b>Factory</b>.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage
- * @generated
- */
-public class OrmFactory extends EFactoryImpl
-{
- /**
- * The singleton instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final OrmFactory eINSTANCE = init();
-
- /**
- * Creates the default factory implementation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static OrmFactory init() {
- try {
- OrmFactory theOrmFactory = (OrmFactory) EPackage.Registry.INSTANCE.getEFactory("jpt.orm.xmi");
- if (theOrmFactory != null) {
- return theOrmFactory;
- }
- }
- catch (Exception exception) {
- EcorePlugin.INSTANCE.log(exception);
- }
- return new OrmFactory();
- }
-
- /**
- * Creates an instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public OrmFactory() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public EObject create(EClass eClass) {
- switch (eClass.getClassifierID()) {
- case OrmPackage.XML_ROOT_CONTENT_NODE :
- return createXmlRootContentNode();
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL :
- return createEntityMappingsInternal();
- case OrmPackage.XML_PERSISTENT_TYPE :
- return createXmlPersistentType();
- case OrmPackage.XML_MAPPED_SUPERCLASS :
- return createXmlMappedSuperclass();
- case OrmPackage.XML_ENTITY_INTERNAL :
- return createXmlEntityInternal();
- case OrmPackage.XML_EMBEDDABLE :
- return createXmlEmbeddable();
- case OrmPackage.XML_NULL_ATTRIBUTE_MAPPING :
- return createXmlNullAttributeMapping();
- case OrmPackage.XML_BASIC :
- return createXmlBasic();
- case OrmPackage.XML_ID :
- return createXmlId();
- case OrmPackage.XML_TRANSIENT :
- return createXmlTransient();
- case OrmPackage.XML_EMBEDDED :
- return createXmlEmbedded();
- case OrmPackage.XML_EMBEDDED_ID :
- return createXmlEmbeddedId();
- case OrmPackage.XML_VERSION :
- return createXmlVersion();
- case OrmPackage.XML_ONE_TO_MANY :
- return createXmlOneToMany();
- case OrmPackage.XML_MANY_TO_MANY :
- return createXmlManyToMany();
- case OrmPackage.XML_PERSISTENT_ATTRIBUTE :
- return createXmlPersistentAttribute();
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL :
- return createPersistenceUnitMetadataInternal();
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL :
- return createPersistenceUnitDefaultsInternal();
- case OrmPackage.XML_TABLE :
- return createXmlTable();
- case OrmPackage.XML_COLUMN :
- return createXmlColumn();
- case OrmPackage.XML_JOIN_COLUMN :
- return createXmlJoinColumn();
- case OrmPackage.XML_MANY_TO_ONE :
- return createXmlManyToOne();
- case OrmPackage.XML_ONE_TO_ONE :
- return createXmlOneToOne();
- case OrmPackage.XML_JOIN_TABLE :
- return createXmlJoinTable();
- case OrmPackage.XML_ATTRIBUTE_OVERRIDE :
- return createXmlAttributeOverride();
- case OrmPackage.XML_ASSOCIATION_OVERRIDE :
- return createXmlAssociationOverride();
- case OrmPackage.XML_DISCRIMINATOR_COLUMN :
- return createXmlDiscriminatorColumn();
- case OrmPackage.XML_SECONDARY_TABLE :
- return createXmlSecondaryTable();
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN :
- return createXmlPrimaryKeyJoinColumn();
- case OrmPackage.XML_GENERATED_VALUE :
- return createXmlGeneratedValue();
- case OrmPackage.XML_SEQUENCE_GENERATOR :
- return createXmlSequenceGenerator();
- case OrmPackage.XML_TABLE_GENERATOR :
- return createXmlTableGenerator();
- case OrmPackage.XML_NAMED_QUERY :
- return createXmlNamedQuery();
- case OrmPackage.XML_NAMED_NATIVE_QUERY :
- return createXmlNamedNativeQuery();
- case OrmPackage.XML_QUERY_HINT :
- return createXmlQueryHint();
- case OrmPackage.XML_UNIQUE_CONSTRAINT :
- return createXmlUniqueConstraint();
- case OrmPackage.XML_CASCADE :
- return createXmlCascade();
- case OrmPackage.XML_ID_CLASS :
- return createXmlIdClass();
- case OrmPackage.XML_INHERITANCE :
- return createXmlInheritance();
- case OrmPackage.XML_MAP_KEY :
- return createXmlMapKey();
- default :
- throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlRootContentNode createXmlRootContentNode() {
- XmlRootContentNode xmlRootContentNode = new XmlRootContentNode();
- return xmlRootContentNode;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EntityMappingsInternal createEntityMappingsInternal() {
- EntityMappingsInternal entityMappingsInternal = new EntityMappingsInternal();
- return entityMappingsInternal;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlPersistentType createXmlPersistentType() {
- XmlPersistentType xmlPersistentType = new XmlPersistentType();
- return xmlPersistentType;
- }
-
- public XmlPersistentType createXmlPersistentType(String mappingKey) {
- XmlPersistentType xmlPersistentType = new XmlPersistentType(mappingKey);
- return xmlPersistentType;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlMappedSuperclass createXmlMappedSuperclassGen() {
- XmlMappedSuperclass xmlMappedSuperclass = new XmlMappedSuperclass();
- return xmlMappedSuperclass;
- }
-
- public XmlMappedSuperclass createXmlMappedSuperclass() {
- XmlMappedSuperclass mappedSuperclass = createXmlMappedSuperclassGen();
- XmlPersistentType persistentType = createXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
- mappedSuperclass.setPersistentType(persistentType);
- return mappedSuperclass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlEntityInternal createXmlEntityInternalGen() {
- XmlEntityInternal xmlEntityInternal = new XmlEntityInternal();
- return xmlEntityInternal;
- }
-
- public XmlEntityInternal createXmlEntityInternal() {
- XmlEntityInternal entity = createXmlEntityInternalGen();
- XmlPersistentType persistentType = createXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY);
- entity.setPersistentType(persistentType);
- return entity;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlEmbeddable createXmlEmbeddableGen() {
- XmlEmbeddable xmlEmbeddable = new XmlEmbeddable();
- return xmlEmbeddable;
- }
-
- public XmlEmbeddable createXmlEmbeddable() {
- XmlEmbeddable embeddable = createXmlEmbeddableGen();
- XmlPersistentType persistentType = createXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
- embeddable.setPersistentType(persistentType);
- return embeddable;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlNullAttributeMapping createXmlNullAttributeMappingGen() {
- XmlNullAttributeMapping xmlNullAttributeMapping = new XmlNullAttributeMapping();
- return xmlNullAttributeMapping;
- }
-
- public XmlNullAttributeMapping createXmlNullAttributeMapping() {
- XmlNullAttributeMapping xmlNullAttributeMapping = createXmlNullAttributeMappingGen();
- XmlPersistentAttribute persistentAttribute = createXmlPersistentAttribute();
- xmlNullAttributeMapping.setPersistentAttribute(persistentAttribute);
- return xmlNullAttributeMapping;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlPersistentAttribute createXmlPersistentAttribute() {
- XmlPersistentAttribute xmlPersistentAttribute = new XmlPersistentAttribute();
- return xmlPersistentAttribute;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlBasic createXmlBasicGen() {
- XmlBasic xmlBasic = new XmlBasic();
- return xmlBasic;
- }
-
- public XmlBasic createXmlBasic() {
- XmlBasic basic = createXmlBasicGen();
- XmlPersistentAttribute persistentAttribute = createXmlPersistentAttribute();
- basic.setPersistentAttribute(persistentAttribute);
- return basic;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlId createXmlIdGen() {
- XmlId xmlId = new XmlId();
- return xmlId;
- }
-
- public XmlId createXmlId() {
- XmlId id = createXmlIdGen();
- XmlPersistentAttribute persistentAttribute = createXmlPersistentAttribute();
- id.setPersistentAttribute(persistentAttribute);
- return id;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlTransient createXmlTransientGen() {
- XmlTransient xmlTransient = new XmlTransient();
- return xmlTransient;
- }
-
- public XmlTransient createXmlTransient() {
- XmlTransient xmlTransient = createXmlTransientGen();
- XmlPersistentAttribute persistentAttribute = createXmlPersistentAttribute();
- xmlTransient.setPersistentAttribute(persistentAttribute);
- return xmlTransient;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlEmbedded createXmlEmbeddedGen() {
- XmlEmbedded xmlEmbedded = new XmlEmbedded();
- return xmlEmbedded;
- }
-
- public XmlEmbedded createXmlEmbedded() {
- XmlEmbedded xmlEmbedded = createXmlEmbeddedGen();
- XmlPersistentAttribute persistentAttribute = createXmlPersistentAttribute();
- xmlEmbedded.setPersistentAttribute(persistentAttribute);
- return xmlEmbedded;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlEmbeddedId createXmlEmbeddedIdGen() {
- XmlEmbeddedId xmlEmbeddedId = new XmlEmbeddedId();
- return xmlEmbeddedId;
- }
-
- public XmlEmbeddedId createXmlEmbeddedId() {
- XmlEmbeddedId xmlEmbeddedId = createXmlEmbeddedIdGen();
- XmlPersistentAttribute persistentAttribute = createXmlPersistentAttribute();
- xmlEmbeddedId.setPersistentAttribute(persistentAttribute);
- return xmlEmbeddedId;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlVersion createXmlVersionGen() {
- XmlVersion xmlVersion = new XmlVersion();
- return xmlVersion;
- }
-
- public XmlVersion createXmlVersion() {
- XmlVersion xmlVersion = createXmlVersionGen();
- XmlPersistentAttribute persistentAttribute = createXmlPersistentAttribute();
- xmlVersion.setPersistentAttribute(persistentAttribute);
- return xmlVersion;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlOneToMany createXmlOneToManyGen() {
- XmlOneToMany xmlOneToMany = new XmlOneToMany();
- return xmlOneToMany;
- }
-
- public XmlOneToMany createXmlOneToMany() {
- XmlOneToMany oneToMany = createXmlOneToManyGen();
- XmlPersistentAttribute persistentAttribute = createXmlPersistentAttribute();
- oneToMany.setPersistentAttribute(persistentAttribute);
- return oneToMany;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlManyToMany createXmlManyToManyGen() {
- XmlManyToMany xmlManyToMany = new XmlManyToMany();
- return xmlManyToMany;
- }
-
- public XmlManyToMany createXmlManyToMany() {
- XmlManyToMany manyToMany = createXmlManyToManyGen();
- XmlPersistentAttribute persistentAttribute = createXmlPersistentAttribute();
- manyToMany.setPersistentAttribute(persistentAttribute);
- return manyToMany;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PersistenceUnitMetadataInternal createPersistenceUnitMetadataInternal() {
- PersistenceUnitMetadataInternal persistenceUnitMetadataInternal = new PersistenceUnitMetadataInternal();
- return persistenceUnitMetadataInternal;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PersistenceUnitDefaultsInternal createPersistenceUnitDefaultsInternal() {
- PersistenceUnitDefaultsInternal persistenceUnitDefaultsInternal = new PersistenceUnitDefaultsInternal();
- return persistenceUnitDefaultsInternal;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlTable createXmlTable() {
- XmlTable xmlTable = new XmlTable();
- return xmlTable;
- }
-
- public XmlTable createXmlTable(ITable.Owner owner) {
- return new XmlTable(owner);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlColumn createXmlColumn() {
- XmlColumn xmlColumn = new XmlColumn();
- return xmlColumn;
- }
-
- public XmlColumn createXmlColumn(IColumn.Owner owner) {
- return new XmlColumn(owner);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated NOT
- */
- public XmlJoinColumn createXmlJoinColumn() {
- throw new UnsupportedOperationException("Use createXmlJoinColumn(IColumn.Owner) instead");
- }
-
- public XmlJoinColumn createXmlJoinColumn(IJoinColumn.Owner owner) {
- return new XmlJoinColumn(owner);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlManyToOne createXmlManyToOneGen() {
- XmlManyToOne xmlManyToOne = new XmlManyToOne();
- return xmlManyToOne;
- }
-
- public XmlManyToOne createXmlManyToOne() {
- XmlManyToOne xmlManyToOne = createXmlManyToOneGen();
- XmlPersistentAttribute persistentAttribute = createXmlPersistentAttribute();
- xmlManyToOne.setPersistentAttribute(persistentAttribute);
- return xmlManyToOne;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlOneToOne createXmlOneToOneGen() {
- XmlOneToOne xmlOneToOne = new XmlOneToOne();
- return xmlOneToOne;
- }
-
- public XmlOneToOne createXmlOneToOne() {
- XmlOneToOne xmlOneToOne = createXmlOneToOneGen();
- XmlPersistentAttribute persistentAttribute = createXmlPersistentAttribute();
- xmlOneToOne.setPersistentAttribute(persistentAttribute);
- return xmlOneToOne;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlJoinTable createXmlJoinTable() {
- XmlJoinTable xmlJoinTable = new XmlJoinTable();
- return xmlJoinTable;
- }
-
- public XmlJoinTable createXmlJoinTable(IJoinTable.Owner owner) {
- return new XmlJoinTable(owner);
- }
-
- public XmlAttributeOverride createXmlAttributeOverride() {
- throw new UnsupportedOperationException("Use createXmlAttributeOverride(IAttributeOverride.Owner) instead");
- }
-
- public XmlAttributeOverride createXmlAttributeOverride(IAttributeOverride.Owner owner) {
- XmlAttributeOverride xmlAttributeOverride = new XmlAttributeOverride(owner);
- return xmlAttributeOverride;
- }
-
- public XmlAssociationOverride createXmlAssociationOverride() {
- throw new UnsupportedOperationException("Use createXmlAssociationOverride(IAssociationOverride.Owner) instead");
- }
-
- public XmlAssociationOverride createXmlAssociationOverride(IAssociationOverride.Owner owner) {
- XmlAssociationOverride xmlAssociationOverride = new XmlAssociationOverride(owner);
- return xmlAssociationOverride;
- }
-
- public XmlDiscriminatorColumn createXmlDiscriminatorColumn() {
- throw new UnsupportedOperationException("Use createXmlDiscriminatorColumn(INamedColumn.Owner) instead");
- }
-
- public XmlDiscriminatorColumn createXmlDiscriminatorColumn(INamedColumn.Owner owner) {
- XmlDiscriminatorColumn xmlDiscriminatorColumn = new XmlDiscriminatorColumn(owner);
- return xmlDiscriminatorColumn;
- }
-
- public XmlSecondaryTable createXmlSecondaryTable() {
- throw new UnsupportedOperationException();
- }
-
- public XmlPrimaryKeyJoinColumn createXmlPrimaryKeyJoinColumn() {
- throw new UnsupportedOperationException("Use createXmlPrimaryKeyJoinColumn(INamedColumn.Owner) instead");
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlGeneratedValue createXmlGeneratedValue() {
- XmlGeneratedValue xmlGeneratedValue = new XmlGeneratedValue();
- return xmlGeneratedValue;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlSequenceGenerator createXmlSequenceGenerator() {
- XmlSequenceGenerator xmlSequenceGenerator = new XmlSequenceGenerator();
- return xmlSequenceGenerator;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlTableGenerator createXmlTableGenerator() {
- XmlTableGenerator xmlTableGenerator = new XmlTableGenerator();
- return xmlTableGenerator;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlNamedQuery createXmlNamedQuery() {
- XmlNamedQuery xmlNamedQuery = new XmlNamedQuery();
- return xmlNamedQuery;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlNamedNativeQuery createXmlNamedNativeQuery() {
- XmlNamedNativeQuery xmlNamedNativeQuery = new XmlNamedNativeQuery();
- return xmlNamedNativeQuery;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlQueryHint createXmlQueryHint() {
- XmlQueryHint xmlQueryHint = new XmlQueryHint();
- return xmlQueryHint;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlUniqueConstraint createXmlUniqueConstraint() {
- XmlUniqueConstraint xmlUniqueConstraint = new XmlUniqueConstraint();
- return xmlUniqueConstraint;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlCascade createXmlCascade() {
- XmlCascade xmlCascade = new XmlCascade();
- return xmlCascade;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlIdClass createXmlIdClass() {
- XmlIdClass xmlIdClass = new XmlIdClass();
- return xmlIdClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlInheritance createXmlInheritance() {
- XmlInheritance xmlInheritance = new XmlInheritance();
- return xmlInheritance;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public XmlMapKey createXmlMapKey() {
- XmlMapKey xmlMapKey = new XmlMapKey();
- return xmlMapKey;
- }
-
- public XmlPrimaryKeyJoinColumn createXmlPrimaryKeyJoinColumn(IAbstractJoinColumn.Owner owner) {
- XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = new XmlPrimaryKeyJoinColumn(owner);
- return xmlPrimaryKeyJoinColumn;
- }
-
- public XmlSecondaryTable createXmlSecondaryTable(ITable.Owner owner) {
- XmlSecondaryTable xmlSecondaryTable = new XmlSecondaryTable(owner);
- return xmlSecondaryTable;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public OrmPackage getOrmPackage() {
- return (OrmPackage) getEPackage();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @deprecated
- * @generated
- */
- @Deprecated
- public static OrmPackage getPackage() {
- return OrmPackage.eINSTANCE;
- }
-} //JpaCoreXmlFactory \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmPackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmPackage.java
deleted file mode 100644
index 10e5d2d947..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmPackage.java
+++ /dev/null
@@ -1,10044 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.content.java.JpaJavaPackage;
-import org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage;
-import org.eclipse.jpt.core.internal.content.persistence.PersistencePackage;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Package</b> for the model.
- * It contains accessors for the meta objects to represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.OrmFactory
- * @model kind="package"
- * @generated
- */
-public class OrmPackage extends EPackageImpl
-{
- /**
- * The package name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNAME = "orm";
-
- /**
- * The package namespace URI.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNS_URI = "jpt.orm.xmi";
-
- /**
- * The package namespace name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNS_PREFIX = "org.eclipse.jpt.core.content.orm";
-
- /**
- * The singleton instance of the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final OrmPackage eINSTANCE = org.eclipse.jpt.core.internal.content.orm.OrmPackage.init();
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode <em>Xml Root Content Node</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlRootContentNode()
- * @generated
- */
- public static final int XML_ROOT_CONTENT_NODE = 0;
-
- /**
- * The feature id for the '<em><b>Jpa File</b></em>' container reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ROOT_CONTENT_NODE__JPA_FILE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Entity Mappings</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Xml Root Content Node</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ROOT_CONTENT_NODE_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal <em>Entity Mappings Internal</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal()
- * @generated
- */
- public static final int ENTITY_MAPPINGS_INTERNAL = 1;
-
- /**
- * The feature id for the '<em><b>Persistence Unit Metadata For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA_FOR_XML = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Package For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__PACKAGE_FOR_XML = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Persistence Unit Metadata</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Package</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__PACKAGE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Root</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__ROOT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Version</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__VERSION = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Description</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__DESCRIPTION = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Persistence Unit Metadata Internal</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA_INTERNAL = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Package Internal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__PACKAGE_INTERNAL = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__DEFAULT_SCHEMA = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 9;
-
- /**
- * The feature id for the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__SPECIFIED_SCHEMA = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 10;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__SCHEMA = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 11;
-
- /**
- * The feature id for the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__DEFAULT_CATALOG = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 12;
-
- /**
- * The feature id for the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__SPECIFIED_CATALOG = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 13;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__CATALOG = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 14;
-
- /**
- * The feature id for the '<em><b>Default Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__DEFAULT_ACCESS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 15;
-
- /**
- * The feature id for the '<em><b>Specified Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__SPECIFIED_ACCESS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 16;
-
- /**
- * The feature id for the '<em><b>Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__ACCESS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 17;
-
- /**
- * The feature id for the '<em><b>Type Mappings</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__TYPE_MAPPINGS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 18;
-
- /**
- * The feature id for the '<em><b>Persistent Types</b></em>' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__PERSISTENT_TYPES = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 19;
-
- /**
- * The feature id for the '<em><b>Sequence Generators</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__SEQUENCE_GENERATORS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 20;
-
- /**
- * The feature id for the '<em><b>Table Generators</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__TABLE_GENERATORS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 21;
-
- /**
- * The feature id for the '<em><b>Named Queries</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__NAMED_QUERIES = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 22;
-
- /**
- * The feature id for the '<em><b>Named Native Queries</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL__NAMED_NATIVE_QUERIES = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 23;
-
- /**
- * The number of structural features of the '<em>Entity Mappings Internal</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_INTERNAL_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 24;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappings <em>Entity Mappings</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappings
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappings()
- * @generated
- */
- public static final int ENTITY_MAPPINGS = 2;
-
- /**
- * The feature id for the '<em><b>Persistence Unit Metadata</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA = 0;
-
- /**
- * The feature id for the '<em><b>Package</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS__PACKAGE = 1;
-
- /**
- * The number of structural features of the '<em>Entity Mappings</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_FEATURE_COUNT = 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml <em>Entity Mappings For Xml</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsForXml()
- * @generated
- */
- public static final int ENTITY_MAPPINGS_FOR_XML = 3;
-
- /**
- * The feature id for the '<em><b>Persistence Unit Metadata For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_FOR_XML__PERSISTENCE_UNIT_METADATA_FOR_XML = 0;
-
- /**
- * The feature id for the '<em><b>Package For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_FOR_XML__PACKAGE_FOR_XML = 1;
-
- /**
- * The number of structural features of the '<em>Entity Mappings For Xml</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ENTITY_MAPPINGS_FOR_XML_FEATURE_COUNT = 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping <em>Xml Type Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTypeMapping()
- * @generated
- */
- public static final int XML_TYPE_MAPPING = 4;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TYPE_MAPPING__NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TYPE_MAPPING__TABLE_NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TYPE_MAPPING__DEFAULT_ACCESS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Specified Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TYPE_MAPPING__SPECIFIED_ACCESS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TYPE_MAPPING__ACCESS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Metadata Complete</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TYPE_MAPPING__METADATA_COMPLETE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Persistent Type</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TYPE_MAPPING__PERSISTENT_TYPE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 6;
-
- /**
- * The number of structural features of the '<em>Xml Type Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TYPE_MAPPING_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 7;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType <em>Xml Persistent Type</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPersistentType
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPersistentType()
- * @generated
- */
- public static final int XML_PERSISTENT_TYPE = 5;
-
- /**
- * The feature id for the '<em><b>Mapping Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PERSISTENT_TYPE__MAPPING_KEY = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PERSISTENT_TYPE__CLASS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Attribute Mappings</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PERSISTENT_TYPE__ATTRIBUTE_MAPPINGS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Specified Attribute Mappings</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PERSISTENT_TYPE__SPECIFIED_ATTRIBUTE_MAPPINGS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Virtual Attribute Mappings</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PERSISTENT_TYPE__VIRTUAL_ATTRIBUTE_MAPPINGS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Persistent Attributes</b></em>' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PERSISTENT_TYPE__PERSISTENT_ATTRIBUTES = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Specified Persistent Attributes</b></em>' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PERSISTENT_TYPE__SPECIFIED_PERSISTENT_ATTRIBUTES = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Virtual Persistent Attributes</b></em>' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PERSISTENT_TYPE__VIRTUAL_PERSISTENT_ATTRIBUTES = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 7;
-
- /**
- * The number of structural features of the '<em>Xml Persistent Type</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PERSISTENT_TYPE_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 8;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass <em>Xml Mapped Superclass</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMappedSuperclass()
- * @generated
- */
- public static final int XML_MAPPED_SUPERCLASS = 6;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MAPPED_SUPERCLASS__NAME = XML_TYPE_MAPPING__NAME;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MAPPED_SUPERCLASS__TABLE_NAME = XML_TYPE_MAPPING__TABLE_NAME;
-
- /**
- * The feature id for the '<em><b>Default Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MAPPED_SUPERCLASS__DEFAULT_ACCESS = XML_TYPE_MAPPING__DEFAULT_ACCESS;
-
- /**
- * The feature id for the '<em><b>Specified Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MAPPED_SUPERCLASS__SPECIFIED_ACCESS = XML_TYPE_MAPPING__SPECIFIED_ACCESS;
-
- /**
- * The feature id for the '<em><b>Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MAPPED_SUPERCLASS__ACCESS = XML_TYPE_MAPPING__ACCESS;
-
- /**
- * The feature id for the '<em><b>Metadata Complete</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MAPPED_SUPERCLASS__METADATA_COMPLETE = XML_TYPE_MAPPING__METADATA_COMPLETE;
-
- /**
- * The feature id for the '<em><b>Persistent Type</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MAPPED_SUPERCLASS__PERSISTENT_TYPE = XML_TYPE_MAPPING__PERSISTENT_TYPE;
-
- /**
- * The feature id for the '<em><b>Id Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MAPPED_SUPERCLASS__ID_CLASS = XML_TYPE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Id Class For Xml</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MAPPED_SUPERCLASS__ID_CLASS_FOR_XML = XML_TYPE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Xml Mapped Superclass</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MAPPED_SUPERCLASS_FEATURE_COUNT = XML_TYPE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal <em>Xml Entity Internal</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntityInternal()
- * @generated
- */
- public static final int XML_ENTITY_INTERNAL = 7;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__NAME = XML_TYPE_MAPPING__NAME;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__TABLE_NAME = XML_TYPE_MAPPING__TABLE_NAME;
-
- /**
- * The feature id for the '<em><b>Default Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__DEFAULT_ACCESS = XML_TYPE_MAPPING__DEFAULT_ACCESS;
-
- /**
- * The feature id for the '<em><b>Specified Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__SPECIFIED_ACCESS = XML_TYPE_MAPPING__SPECIFIED_ACCESS;
-
- /**
- * The feature id for the '<em><b>Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__ACCESS = XML_TYPE_MAPPING__ACCESS;
-
- /**
- * The feature id for the '<em><b>Metadata Complete</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__METADATA_COMPLETE = XML_TYPE_MAPPING__METADATA_COMPLETE;
-
- /**
- * The feature id for the '<em><b>Persistent Type</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__PERSISTENT_TYPE = XML_TYPE_MAPPING__PERSISTENT_TYPE;
-
- /**
- * The feature id for the '<em><b>Table For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__TABLE_FOR_XML = XML_TYPE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Discriminator Column For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN_FOR_XML = XML_TYPE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Id Class For Xml</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__ID_CLASS_FOR_XML = XML_TYPE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Inheritance For Xml</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__INHERITANCE_FOR_XML = XML_TYPE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__SPECIFIED_NAME = XML_TYPE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__DEFAULT_NAME = XML_TYPE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__TABLE = XML_TYPE_MAPPING_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Specified Secondary Tables</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__SPECIFIED_SECONDARY_TABLES = XML_TYPE_MAPPING_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__PRIMARY_KEY_JOIN_COLUMNS = XML_TYPE_MAPPING_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Specified Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS = XML_TYPE_MAPPING_FEATURE_COUNT + 9;
-
- /**
- * The feature id for the '<em><b>Default Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS = XML_TYPE_MAPPING_FEATURE_COUNT + 10;
-
- /**
- * The feature id for the '<em><b>Inheritance Strategy</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__INHERITANCE_STRATEGY = XML_TYPE_MAPPING_FEATURE_COUNT + 11;
-
- /**
- * The feature id for the '<em><b>Default Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__DEFAULT_DISCRIMINATOR_VALUE = XML_TYPE_MAPPING_FEATURE_COUNT + 12;
-
- /**
- * The feature id for the '<em><b>Specified Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__SPECIFIED_DISCRIMINATOR_VALUE = XML_TYPE_MAPPING_FEATURE_COUNT + 13;
-
- /**
- * The feature id for the '<em><b>Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__DISCRIMINATOR_VALUE = XML_TYPE_MAPPING_FEATURE_COUNT + 14;
-
- /**
- * The feature id for the '<em><b>Discriminator Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN = XML_TYPE_MAPPING_FEATURE_COUNT + 15;
-
- /**
- * The feature id for the '<em><b>Sequence Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__SEQUENCE_GENERATOR = XML_TYPE_MAPPING_FEATURE_COUNT + 16;
-
- /**
- * The feature id for the '<em><b>Table Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__TABLE_GENERATOR = XML_TYPE_MAPPING_FEATURE_COUNT + 17;
-
- /**
- * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__ATTRIBUTE_OVERRIDES = XML_TYPE_MAPPING_FEATURE_COUNT + 18;
-
- /**
- * The feature id for the '<em><b>Specified Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__SPECIFIED_ATTRIBUTE_OVERRIDES = XML_TYPE_MAPPING_FEATURE_COUNT + 19;
-
- /**
- * The feature id for the '<em><b>Default Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__DEFAULT_ATTRIBUTE_OVERRIDES = XML_TYPE_MAPPING_FEATURE_COUNT + 20;
-
- /**
- * The feature id for the '<em><b>Association Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__ASSOCIATION_OVERRIDES = XML_TYPE_MAPPING_FEATURE_COUNT + 21;
-
- /**
- * The feature id for the '<em><b>Specified Association Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__SPECIFIED_ASSOCIATION_OVERRIDES = XML_TYPE_MAPPING_FEATURE_COUNT + 22;
-
- /**
- * The feature id for the '<em><b>Default Association Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__DEFAULT_ASSOCIATION_OVERRIDES = XML_TYPE_MAPPING_FEATURE_COUNT + 23;
-
- /**
- * The feature id for the '<em><b>Named Queries</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__NAMED_QUERIES = XML_TYPE_MAPPING_FEATURE_COUNT + 24;
-
- /**
- * The feature id for the '<em><b>Named Native Queries</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__NAMED_NATIVE_QUERIES = XML_TYPE_MAPPING_FEATURE_COUNT + 25;
-
- /**
- * The feature id for the '<em><b>Id Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__ID_CLASS = XML_TYPE_MAPPING_FEATURE_COUNT + 26;
-
- /**
- * The feature id for the '<em><b>Secondary Tables</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__SECONDARY_TABLES = XML_TYPE_MAPPING_FEATURE_COUNT + 27;
-
- /**
- * The feature id for the '<em><b>Virtual Secondary Tables</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL__VIRTUAL_SECONDARY_TABLES = XML_TYPE_MAPPING_FEATURE_COUNT + 28;
-
- /**
- * The number of structural features of the '<em>Xml Entity Internal</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_INTERNAL_FEATURE_COUNT = XML_TYPE_MAPPING_FEATURE_COUNT + 29;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml <em>Xml Entity For Xml</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntityForXml()
- * @generated
- */
- public static final int XML_ENTITY_FOR_XML = 8;
-
- /**
- * The feature id for the '<em><b>Table For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_FOR_XML__TABLE_FOR_XML = 0;
-
- /**
- * The feature id for the '<em><b>Discriminator Column For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_FOR_XML__DISCRIMINATOR_COLUMN_FOR_XML = 1;
-
- /**
- * The feature id for the '<em><b>Id Class For Xml</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_FOR_XML__ID_CLASS_FOR_XML = 2;
-
- /**
- * The feature id for the '<em><b>Inheritance For Xml</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_FOR_XML__INHERITANCE_FOR_XML = 3;
-
- /**
- * The number of structural features of the '<em>Xml Entity For Xml</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_FOR_XML_FEATURE_COUNT = 4;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntity <em>Xml Entity</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntity
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntity()
- * @generated
- */
- public static final int XML_ENTITY = 9;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__NAME = JpaCoreMappingsPackage.IENTITY__NAME;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__TABLE_NAME = JpaCoreMappingsPackage.IENTITY__TABLE_NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__SPECIFIED_NAME = JpaCoreMappingsPackage.IENTITY__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__DEFAULT_NAME = JpaCoreMappingsPackage.IENTITY__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__TABLE = JpaCoreMappingsPackage.IENTITY__TABLE;
-
- /**
- * The feature id for the '<em><b>Specified Secondary Tables</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__SPECIFIED_SECONDARY_TABLES = JpaCoreMappingsPackage.IENTITY__SPECIFIED_SECONDARY_TABLES;
-
- /**
- * The feature id for the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__PRIMARY_KEY_JOIN_COLUMNS = JpaCoreMappingsPackage.IENTITY__PRIMARY_KEY_JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Specified Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS = JpaCoreMappingsPackage.IENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Default Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS = JpaCoreMappingsPackage.IENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Inheritance Strategy</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__INHERITANCE_STRATEGY = JpaCoreMappingsPackage.IENTITY__INHERITANCE_STRATEGY;
-
- /**
- * The feature id for the '<em><b>Default Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__DEFAULT_DISCRIMINATOR_VALUE = JpaCoreMappingsPackage.IENTITY__DEFAULT_DISCRIMINATOR_VALUE;
-
- /**
- * The feature id for the '<em><b>Specified Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__SPECIFIED_DISCRIMINATOR_VALUE = JpaCoreMappingsPackage.IENTITY__SPECIFIED_DISCRIMINATOR_VALUE;
-
- /**
- * The feature id for the '<em><b>Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__DISCRIMINATOR_VALUE = JpaCoreMappingsPackage.IENTITY__DISCRIMINATOR_VALUE;
-
- /**
- * The feature id for the '<em><b>Discriminator Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__DISCRIMINATOR_COLUMN = JpaCoreMappingsPackage.IENTITY__DISCRIMINATOR_COLUMN;
-
- /**
- * The feature id for the '<em><b>Sequence Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__SEQUENCE_GENERATOR = JpaCoreMappingsPackage.IENTITY__SEQUENCE_GENERATOR;
-
- /**
- * The feature id for the '<em><b>Table Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__TABLE_GENERATOR = JpaCoreMappingsPackage.IENTITY__TABLE_GENERATOR;
-
- /**
- * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__ATTRIBUTE_OVERRIDES = JpaCoreMappingsPackage.IENTITY__ATTRIBUTE_OVERRIDES;
-
- /**
- * The feature id for the '<em><b>Specified Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES = JpaCoreMappingsPackage.IENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES;
-
- /**
- * The feature id for the '<em><b>Default Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__DEFAULT_ATTRIBUTE_OVERRIDES = JpaCoreMappingsPackage.IENTITY__DEFAULT_ATTRIBUTE_OVERRIDES;
-
- /**
- * The feature id for the '<em><b>Association Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__ASSOCIATION_OVERRIDES = JpaCoreMappingsPackage.IENTITY__ASSOCIATION_OVERRIDES;
-
- /**
- * The feature id for the '<em><b>Specified Association Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__SPECIFIED_ASSOCIATION_OVERRIDES = JpaCoreMappingsPackage.IENTITY__SPECIFIED_ASSOCIATION_OVERRIDES;
-
- /**
- * The feature id for the '<em><b>Default Association Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__DEFAULT_ASSOCIATION_OVERRIDES = JpaCoreMappingsPackage.IENTITY__DEFAULT_ASSOCIATION_OVERRIDES;
-
- /**
- * The feature id for the '<em><b>Named Queries</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__NAMED_QUERIES = JpaCoreMappingsPackage.IENTITY__NAMED_QUERIES;
-
- /**
- * The feature id for the '<em><b>Named Native Queries</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__NAMED_NATIVE_QUERIES = JpaCoreMappingsPackage.IENTITY__NAMED_NATIVE_QUERIES;
-
- /**
- * The feature id for the '<em><b>Id Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__ID_CLASS = JpaCoreMappingsPackage.IENTITY__ID_CLASS;
-
- /**
- * The feature id for the '<em><b>Secondary Tables</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__SECONDARY_TABLES = JpaCoreMappingsPackage.IENTITY_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Virtual Secondary Tables</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY__VIRTUAL_SECONDARY_TABLES = JpaCoreMappingsPackage.IENTITY_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Xml Entity</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ENTITY_FEATURE_COUNT = JpaCoreMappingsPackage.IENTITY_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEmbeddable <em>Xml Embeddable</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEmbeddable
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEmbeddable()
- * @generated
- */
- public static final int XML_EMBEDDABLE = 10;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_EMBEDDABLE__NAME = XML_TYPE_MAPPING__NAME;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_EMBEDDABLE__TABLE_NAME = XML_TYPE_MAPPING__TABLE_NAME;
-
- /**
- * The feature id for the '<em><b>Default Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_EMBEDDABLE__DEFAULT_ACCESS = XML_TYPE_MAPPING__DEFAULT_ACCESS;
-
- /**
- * The feature id for the '<em><b>Specified Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_EMBEDDABLE__SPECIFIED_ACCESS = XML_TYPE_MAPPING__SPECIFIED_ACCESS;
-
- /**
- * The feature id for the '<em><b>Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_EMBEDDABLE__ACCESS = XML_TYPE_MAPPING__ACCESS;
-
- /**
- * The feature id for the '<em><b>Metadata Complete</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_EMBEDDABLE__METADATA_COMPLETE = XML_TYPE_MAPPING__METADATA_COMPLETE;
-
- /**
- * The feature id for the '<em><b>Persistent Type</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_EMBEDDABLE__PERSISTENT_TYPE = XML_TYPE_MAPPING__PERSISTENT_TYPE;
-
- /**
- * The number of structural features of the '<em>Xml Embeddable</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_EMBEDDABLE_FEATURE_COUNT = XML_TYPE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping <em>Xml Attribute Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlAttributeMapping()
- * @generated
- */
- public static final int XML_ATTRIBUTE_MAPPING = 11;
-
- /**
- * The feature id for the '<em><b>Persistent Attribute</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Xml Attribute Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ATTRIBUTE_MAPPING_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlNullAttributeMapping <em>Xml Null Attribute Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlNullAttributeMapping
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlNullAttributeMapping()
- * @generated
- */
- public static final int XML_NULL_ATTRIBUTE_MAPPING = 12;
-
- /**
- * The feature id for the '<em><b>Persistent Attribute</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_NULL_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE = XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE;
-
- /**
- * The number of structural features of the '<em>Xml Null Attribute Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_NULL_ATTRIBUTE_MAPPING_FEATURE_COUNT = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlBasic <em>Xml Basic</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlBasic
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlBasic()
- * @generated
- */
- public static final int XML_BASIC = 13;
-
- /**
- * The feature id for the '<em><b>Persistent Attribute</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_BASIC__PERSISTENT_ATTRIBUTE = XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_BASIC__FETCH = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_BASIC__OPTIONAL = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_BASIC__COLUMN = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Lob</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_BASIC__LOB = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Temporal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_BASIC__TEMPORAL = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Enumerated</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_BASIC__ENUMERATED = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Column For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_BASIC__COLUMN_FOR_XML = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 6;
-
- /**
- * The number of structural features of the '<em>Xml Basic</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_BASIC_FEATURE_COUNT = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 7;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlId <em>Xml Id</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlId
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlId()
- * @generated
- */
- public static final int XML_ID = 14;
-
- /**
- * The feature id for the '<em><b>Persistent Attribute</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ID__PERSISTENT_ATTRIBUTE = XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE;
-
- /**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ID__COLUMN = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Generated Value</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ID__GENERATED_VALUE = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Temporal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ID__TEMPORAL = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Table Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ID__TABLE_GENERATOR = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Sequence Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ID__SEQUENCE_GENERATOR = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Column For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ID__COLUMN_FOR_XML = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The number of structural features of the '<em>Xml Id</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ID_FEATURE_COUNT = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 6;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTransient <em>Xml Transient</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTransient
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTransient()
- * @generated
- */
- public static final int XML_TRANSIENT = 15;
-
- /**
- * The feature id for the '<em><b>Persistent Attribute</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TRANSIENT__PERSISTENT_ATTRIBUTE = XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE;
-
- /**
- * The number of structural features of the '<em>Xml Transient</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TRANSIENT_FEATURE_COUNT = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEmbedded <em>Xml Embedded</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEmbedded
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEmbedded()
- * @generated
- */
- public static final int XML_EMBEDDED = 16;
-
- /**
- * The feature id for the '<em><b>Persistent Attribute</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_EMBEDDED__PERSISTENT_ATTRIBUTE = XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE;
-
- /**
- * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_EMBEDDED__ATTRIBUTE_OVERRIDES = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Xml Embedded</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_EMBEDDED_FEATURE_COUNT = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEmbeddedId <em>Xml Embedded Id</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEmbeddedId
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEmbeddedId()
- * @generated
- */
- public static final int XML_EMBEDDED_ID = 17;
-
- /**
- * The feature id for the '<em><b>Persistent Attribute</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_EMBEDDED_ID__PERSISTENT_ATTRIBUTE = XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE;
-
- /**
- * The number of structural features of the '<em>Xml Embedded Id</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_EMBEDDED_ID_FEATURE_COUNT = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlVersion <em>Xml Version</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlVersion
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlVersion()
- * @generated
- */
- public static final int XML_VERSION = 18;
-
- /**
- * The feature id for the '<em><b>Persistent Attribute</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_VERSION__PERSISTENT_ATTRIBUTE = XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE;
-
- /**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_VERSION__COLUMN = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Temporal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_VERSION__TEMPORAL = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Column For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_VERSION__COLUMN_FOR_XML = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Xml Version</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_VERSION_FEATURE_COUNT = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlRelationshipMapping <em>Xml Relationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlRelationshipMapping
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlRelationshipMapping()
- * @generated
- */
- public static final int XML_RELATIONSHIP_MAPPING = 40;
-
- /**
- * The feature id for the '<em><b>Persistent Attribute</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_RELATIONSHIP_MAPPING__PERSISTENT_ATTRIBUTE = XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_RELATIONSHIP_MAPPING__TARGET_ENTITY = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_RELATIONSHIP_MAPPING__CASCADE = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The number of structural features of the '<em>Xml Relationship Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_RELATIONSHIP_MAPPING_FEATURE_COUNT = XML_ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal <em>Xml Multi Relationship Mapping Internal</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMultiRelationshipMappingInternal()
- * @generated
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL = 19;
-
- /**
- * The feature id for the '<em><b>Persistent Attribute</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__PERSISTENT_ATTRIBUTE = XML_RELATIONSHIP_MAPPING__PERSISTENT_ATTRIBUTE;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__TARGET_ENTITY = XML_RELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__SPECIFIED_TARGET_ENTITY = XML_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__DEFAULT_TARGET_ENTITY = XML_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__RESOLVED_TARGET_ENTITY = XML_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__CASCADE = XML_RELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAPPED_BY = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Order By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__FETCH = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Join Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Map Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Join Table For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE_FOR_XML = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Map Key For Xml</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY_FOR_XML = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 6;
-
- /**
- * The number of structural features of the '<em>Xml Multi Relationship Mapping Internal</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL_FEATURE_COUNT = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 7;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml <em>Xml Multi Relationship Mapping For Xml</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMultiRelationshipMappingForXml()
- * @generated
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_FOR_XML = 20;
-
- /**
- * The feature id for the '<em><b>Join Table For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_FOR_XML__JOIN_TABLE_FOR_XML = 0;
-
- /**
- * The feature id for the '<em><b>Map Key For Xml</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_FOR_XML__MAP_KEY_FOR_XML = 1;
-
- /**
- * The number of structural features of the '<em>Xml Multi Relationship Mapping For Xml</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_FOR_XML_FEATURE_COUNT = 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMapping <em>Xml Multi Relationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMapping
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMultiRelationshipMapping()
- * @generated
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING = 21;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING__TARGET_ENTITY = JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY = JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY = JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY = JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING__CASCADE = JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING__MAPPED_BY = JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__MAPPED_BY;
-
- /**
- * The feature id for the '<em><b>Order By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING__ORDER_BY = JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__ORDER_BY;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING__FETCH = JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__FETCH;
-
- /**
- * The feature id for the '<em><b>Join Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE = JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__JOIN_TABLE;
-
- /**
- * The feature id for the '<em><b>Map Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING__MAP_KEY = JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__MAP_KEY;
-
- /**
- * The number of structural features of the '<em>Xml Multi Relationship Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT = JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlOneToMany <em>Xml One To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlOneToMany
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlOneToMany()
- * @generated
- */
- public static final int XML_ONE_TO_MANY = 22;
-
- /**
- * The feature id for the '<em><b>Persistent Attribute</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_MANY__PERSISTENT_ATTRIBUTE = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__PERSISTENT_ATTRIBUTE;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_MANY__TARGET_ENTITY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_MANY__SPECIFIED_TARGET_ENTITY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_MANY__DEFAULT_TARGET_ENTITY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_MANY__RESOLVED_TARGET_ENTITY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_MANY__CASCADE = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__CASCADE;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_MANY__MAPPED_BY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAPPED_BY;
-
- /**
- * The feature id for the '<em><b>Order By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_MANY__ORDER_BY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_MANY__FETCH = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__FETCH;
-
- /**
- * The feature id for the '<em><b>Join Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_MANY__JOIN_TABLE = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE;
-
- /**
- * The feature id for the '<em><b>Map Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_MANY__MAP_KEY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY;
-
- /**
- * The feature id for the '<em><b>Join Table For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_MANY__JOIN_TABLE_FOR_XML = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Map Key For Xml</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_MANY__MAP_KEY_FOR_XML = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY_FOR_XML;
-
- /**
- * The number of structural features of the '<em>Xml One To Many</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_MANY_FEATURE_COUNT = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlManyToMany <em>Xml Many To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlManyToMany
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlManyToMany()
- * @generated
- */
- public static final int XML_MANY_TO_MANY = 23;
-
- /**
- * The feature id for the '<em><b>Persistent Attribute</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_MANY__PERSISTENT_ATTRIBUTE = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__PERSISTENT_ATTRIBUTE;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_MANY__TARGET_ENTITY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_MANY__SPECIFIED_TARGET_ENTITY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_MANY__DEFAULT_TARGET_ENTITY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_MANY__RESOLVED_TARGET_ENTITY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_MANY__CASCADE = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__CASCADE;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_MANY__MAPPED_BY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAPPED_BY;
-
- /**
- * The feature id for the '<em><b>Order By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_MANY__ORDER_BY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_MANY__FETCH = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__FETCH;
-
- /**
- * The feature id for the '<em><b>Join Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_MANY__JOIN_TABLE = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE;
-
- /**
- * The feature id for the '<em><b>Map Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_MANY__MAP_KEY = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY;
-
- /**
- * The feature id for the '<em><b>Join Table For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_MANY__JOIN_TABLE_FOR_XML = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Map Key For Xml</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_MANY__MAP_KEY_FOR_XML = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY_FOR_XML;
-
- /**
- * The number of structural features of the '<em>Xml Many To Many</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_MANY_FEATURE_COUNT = XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute <em>Xml Persistent Attribute</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPersistentAttribute()
- * @generated
- */
- public static final int XML_PERSISTENT_ATTRIBUTE = 24;
-
- /**
- * The feature id for the '<em><b>Mapping</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PERSISTENT_ATTRIBUTE__MAPPING = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PERSISTENT_ATTRIBUTE__NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Xml Persistent Attribute</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PERSISTENT_ATTRIBUTE_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal <em>Persistence Unit Metadata Internal</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadataInternal()
- * @generated
- */
- public static final int PERSISTENCE_UNIT_METADATA_INTERNAL = 25;
-
- /**
- * The feature id for the '<em><b>Xml Mapping Metadata Complete For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_FOR_XML = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Persistence Unit Defaults For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS_FOR_XML = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Xml Mapping Metadata Complete</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Persistence Unit Defaults</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Xml Mapping Metadata Complete Internal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_INTERNAL = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Persistence Unit Defaults Internal</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS_INTERNAL = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 5;
-
- /**
- * The number of structural features of the '<em>Persistence Unit Metadata Internal</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_METADATA_INTERNAL_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 6;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata <em>Persistence Unit Metadata</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadata()
- * @generated
- */
- public static final int PERSISTENCE_UNIT_METADATA = 26;
-
- /**
- * The feature id for the '<em><b>Xml Mapping Metadata Complete</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE = JpaCorePackage.IXML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Persistence Unit Defaults</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS = JpaCorePackage.IXML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Persistence Unit Metadata</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_METADATA_FEATURE_COUNT = JpaCorePackage.IXML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml <em>Persistence Unit Metadata For Xml</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadataForXml()
- * @generated
- */
- public static final int PERSISTENCE_UNIT_METADATA_FOR_XML = 27;
-
- /**
- * The feature id for the '<em><b>Xml Mapping Metadata Complete For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_METADATA_FOR_XML__XML_MAPPING_METADATA_COMPLETE_FOR_XML = JpaCorePackage.IXML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Persistence Unit Defaults For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_METADATA_FOR_XML__PERSISTENCE_UNIT_DEFAULTS_FOR_XML = JpaCorePackage.IXML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Persistence Unit Metadata For Xml</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_METADATA_FOR_XML_FEATURE_COUNT = JpaCorePackage.IXML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal <em>Persistence Unit Defaults Internal</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsInternal()
- * @generated
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_INTERNAL = 28;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Cascade Persist</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Schema For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_FOR_XML = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Catalog For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_FOR_XML = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Access For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_FOR_XML = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Cascade Persist For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_FOR_XML = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Schema Internal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_INTERNAL = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Catalog Internal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_INTERNAL = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 9;
-
- /**
- * The feature id for the '<em><b>Access Internal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_INTERNAL = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 10;
-
- /**
- * The feature id for the '<em><b>Cascade Persist Internal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_INTERNAL = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 11;
-
- /**
- * The number of structural features of the '<em>Persistence Unit Defaults Internal</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_INTERNAL_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 12;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults <em>Persistence Unit Defaults</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaults()
- * @generated
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS = 29;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS__SCHEMA = JpaCorePackage.IXML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS__CATALOG = JpaCorePackage.IXML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Access</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS__ACCESS = JpaCorePackage.IXML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Cascade Persist</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST = JpaCorePackage.IXML_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The number of structural features of the '<em>Persistence Unit Defaults</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_FEATURE_COUNT = JpaCorePackage.IXML_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml <em>Persistence Unit Defaults For Xml</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsForXml()
- * @generated
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_FOR_XML = 30;
-
- /**
- * The feature id for the '<em><b>Schema For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_FOR_XML__SCHEMA_FOR_XML = JpaCorePackage.IXML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Catalog For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_FOR_XML__CATALOG_FOR_XML = JpaCorePackage.IXML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Access For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_FOR_XML__ACCESS_FOR_XML = JpaCorePackage.IXML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Cascade Persist For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_FOR_XML__CASCADE_PERSIST_FOR_XML = JpaCorePackage.IXML_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The number of structural features of the '<em>Persistence Unit Defaults For Xml</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_DEFAULTS_FOR_XML_FEATURE_COUNT = JpaCorePackage.IXML_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable <em>Abstract Xml Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlTable()
- * @generated
- */
- public static final int ABSTRACT_XML_TABLE = 42;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_TABLE__NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_TABLE__SPECIFIED_NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_TABLE__DEFAULT_NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_TABLE__CATALOG = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_TABLE__SPECIFIED_CATALOG = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_TABLE__DEFAULT_CATALOG = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_TABLE__SCHEMA = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_TABLE__DEFAULT_SCHEMA = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_TABLE__UNIQUE_CONSTRAINTS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 9;
-
- /**
- * The feature id for the '<em><b>Specified Name For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_TABLE__SPECIFIED_NAME_FOR_XML = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 10;
-
- /**
- * The feature id for the '<em><b>Specified Catalog For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_TABLE__SPECIFIED_CATALOG_FOR_XML = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 11;
-
- /**
- * The feature id for the '<em><b>Specified Schema For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA_FOR_XML = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 12;
-
- /**
- * The number of structural features of the '<em>Abstract Xml Table</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_TABLE_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 13;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTable <em>Xml Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTable
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTable()
- * @generated
- */
- public static final int XML_TABLE = 31;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE__NAME = ABSTRACT_XML_TABLE__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE__SPECIFIED_NAME = ABSTRACT_XML_TABLE__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE__DEFAULT_NAME = ABSTRACT_XML_TABLE__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE__CATALOG = ABSTRACT_XML_TABLE__CATALOG;
-
- /**
- * The feature id for the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE__SPECIFIED_CATALOG = ABSTRACT_XML_TABLE__SPECIFIED_CATALOG;
-
- /**
- * The feature id for the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE__DEFAULT_CATALOG = ABSTRACT_XML_TABLE__DEFAULT_CATALOG;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE__SCHEMA = ABSTRACT_XML_TABLE__SCHEMA;
-
- /**
- * The feature id for the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE__SPECIFIED_SCHEMA = ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA;
-
- /**
- * The feature id for the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE__DEFAULT_SCHEMA = ABSTRACT_XML_TABLE__DEFAULT_SCHEMA;
-
- /**
- * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE__UNIQUE_CONSTRAINTS = ABSTRACT_XML_TABLE__UNIQUE_CONSTRAINTS;
-
- /**
- * The feature id for the '<em><b>Specified Name For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE__SPECIFIED_NAME_FOR_XML = ABSTRACT_XML_TABLE__SPECIFIED_NAME_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Specified Catalog For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE__SPECIFIED_CATALOG_FOR_XML = ABSTRACT_XML_TABLE__SPECIFIED_CATALOG_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Specified Schema For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE__SPECIFIED_SCHEMA_FOR_XML = ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA_FOR_XML;
-
- /**
- * The number of structural features of the '<em>Xml Table</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_FEATURE_COUNT = ABSTRACT_XML_TABLE_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn <em>Abstract Xml Named Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlNamedColumn()
- * @generated
- */
- public static final int ABSTRACT_XML_NAMED_COLUMN = 32;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_NAMED_COLUMN__NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_NAMED_COLUMN__DEFAULT_NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Specified Name For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME_FOR_XML = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Column Definition For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION_FOR_XML = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 5;
-
- /**
- * The number of structural features of the '<em>Abstract Xml Named Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 6;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn <em>Abstract Xml Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlColumn()
- * @generated
- */
- public static final int ABSTRACT_XML_COLUMN = 33;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__NAME = ABSTRACT_XML_NAMED_COLUMN__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__SPECIFIED_NAME = ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__DEFAULT_NAME = ABSTRACT_XML_NAMED_COLUMN__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__COLUMN_DEFINITION = ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION;
-
- /**
- * The feature id for the '<em><b>Specified Name For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__SPECIFIED_NAME_FOR_XML = ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Column Definition For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__COLUMN_DEFINITION_FOR_XML = ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Unique</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__UNIQUE = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Nullable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__NULLABLE = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Insertable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__INSERTABLE = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Updatable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__UPDATABLE = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__TABLE = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__SPECIFIED_TABLE = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__DEFAULT_TABLE = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Unique For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__UNIQUE_FOR_XML = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Nullable For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__NULLABLE_FOR_XML = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Insertable For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__INSERTABLE_FOR_XML = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 9;
-
- /**
- * The feature id for the '<em><b>Updatable For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__UPDATABLE_FOR_XML = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 10;
-
- /**
- * The feature id for the '<em><b>Specified Table For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN__SPECIFIED_TABLE_FOR_XML = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 11;
-
- /**
- * The number of structural features of the '<em>Abstract Xml Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_COLUMN_FEATURE_COUNT = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 12;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlColumn <em>Xml Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlColumn
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlColumn()
- * @generated
- */
- public static final int XML_COLUMN = 34;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__NAME = ABSTRACT_XML_COLUMN__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__SPECIFIED_NAME = ABSTRACT_XML_COLUMN__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__DEFAULT_NAME = ABSTRACT_XML_COLUMN__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__COLUMN_DEFINITION = ABSTRACT_XML_COLUMN__COLUMN_DEFINITION;
-
- /**
- * The feature id for the '<em><b>Specified Name For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__SPECIFIED_NAME_FOR_XML = ABSTRACT_XML_COLUMN__SPECIFIED_NAME_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Column Definition For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__COLUMN_DEFINITION_FOR_XML = ABSTRACT_XML_COLUMN__COLUMN_DEFINITION_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Unique</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__UNIQUE = ABSTRACT_XML_COLUMN__UNIQUE;
-
- /**
- * The feature id for the '<em><b>Nullable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__NULLABLE = ABSTRACT_XML_COLUMN__NULLABLE;
-
- /**
- * The feature id for the '<em><b>Insertable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__INSERTABLE = ABSTRACT_XML_COLUMN__INSERTABLE;
-
- /**
- * The feature id for the '<em><b>Updatable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__UPDATABLE = ABSTRACT_XML_COLUMN__UPDATABLE;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__TABLE = ABSTRACT_XML_COLUMN__TABLE;
-
- /**
- * The feature id for the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__SPECIFIED_TABLE = ABSTRACT_XML_COLUMN__SPECIFIED_TABLE;
-
- /**
- * The feature id for the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__DEFAULT_TABLE = ABSTRACT_XML_COLUMN__DEFAULT_TABLE;
-
- /**
- * The feature id for the '<em><b>Unique For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__UNIQUE_FOR_XML = ABSTRACT_XML_COLUMN__UNIQUE_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Nullable For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__NULLABLE_FOR_XML = ABSTRACT_XML_COLUMN__NULLABLE_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Insertable For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__INSERTABLE_FOR_XML = ABSTRACT_XML_COLUMN__INSERTABLE_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Updatable For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__UPDATABLE_FOR_XML = ABSTRACT_XML_COLUMN__UPDATABLE_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Specified Table For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__SPECIFIED_TABLE_FOR_XML = ABSTRACT_XML_COLUMN__SPECIFIED_TABLE_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__LENGTH = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__SPECIFIED_LENGTH = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Precision</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__PRECISION = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Specified Precision</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__SPECIFIED_PRECISION = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Scale</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__SCALE = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Specified Scale</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__SPECIFIED_SCALE = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Length For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__LENGTH_FOR_XML = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Precision For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__PRECISION_FOR_XML = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Scale For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN__SCALE_FOR_XML = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 8;
-
- /**
- * The number of structural features of the '<em>Xml Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_COLUMN_FEATURE_COUNT = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 9;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlJoinColumn <em>Xml Join Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlJoinColumn
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlJoinColumn()
- * @generated
- */
- public static final int XML_JOIN_COLUMN = 35;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__NAME = ABSTRACT_XML_COLUMN__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__SPECIFIED_NAME = ABSTRACT_XML_COLUMN__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__DEFAULT_NAME = ABSTRACT_XML_COLUMN__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__COLUMN_DEFINITION = ABSTRACT_XML_COLUMN__COLUMN_DEFINITION;
-
- /**
- * The feature id for the '<em><b>Specified Name For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__SPECIFIED_NAME_FOR_XML = ABSTRACT_XML_COLUMN__SPECIFIED_NAME_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Column Definition For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__COLUMN_DEFINITION_FOR_XML = ABSTRACT_XML_COLUMN__COLUMN_DEFINITION_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Unique</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__UNIQUE = ABSTRACT_XML_COLUMN__UNIQUE;
-
- /**
- * The feature id for the '<em><b>Nullable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__NULLABLE = ABSTRACT_XML_COLUMN__NULLABLE;
-
- /**
- * The feature id for the '<em><b>Insertable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__INSERTABLE = ABSTRACT_XML_COLUMN__INSERTABLE;
-
- /**
- * The feature id for the '<em><b>Updatable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__UPDATABLE = ABSTRACT_XML_COLUMN__UPDATABLE;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__TABLE = ABSTRACT_XML_COLUMN__TABLE;
-
- /**
- * The feature id for the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__SPECIFIED_TABLE = ABSTRACT_XML_COLUMN__SPECIFIED_TABLE;
-
- /**
- * The feature id for the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__DEFAULT_TABLE = ABSTRACT_XML_COLUMN__DEFAULT_TABLE;
-
- /**
- * The feature id for the '<em><b>Unique For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__UNIQUE_FOR_XML = ABSTRACT_XML_COLUMN__UNIQUE_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Nullable For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__NULLABLE_FOR_XML = ABSTRACT_XML_COLUMN__NULLABLE_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Insertable For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__INSERTABLE_FOR_XML = ABSTRACT_XML_COLUMN__INSERTABLE_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Updatable For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__UPDATABLE_FOR_XML = ABSTRACT_XML_COLUMN__UPDATABLE_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Specified Table For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__SPECIFIED_TABLE_FOR_XML = ABSTRACT_XML_COLUMN__SPECIFIED_TABLE_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__REFERENCED_COLUMN_NAME = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Specified Referenced Column Name For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 3;
-
- /**
- * The number of structural features of the '<em>Xml Join Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_COLUMN_FEATURE_COUNT = ABSTRACT_XML_COLUMN_FEATURE_COUNT + 4;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.IXmlColumnMapping <em>IXml Column Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.IXmlColumnMapping
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIXmlColumnMapping()
- * @generated
- */
- public static final int IXML_COLUMN_MAPPING = 36;
-
- /**
- * The feature id for the '<em><b>Column For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IXML_COLUMN_MAPPING__COLUMN_FOR_XML = JpaCoreMappingsPackage.ICOLUMN_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>IXml Column Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IXML_COLUMN_MAPPING_FEATURE_COUNT = JpaCoreMappingsPackage.ICOLUMN_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlSingleRelationshipMapping <em>Xml Single Relationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlSingleRelationshipMapping
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlSingleRelationshipMapping()
- * @generated
- */
- public static final int XML_SINGLE_RELATIONSHIP_MAPPING = 39;
-
- /**
- * The feature id for the '<em><b>Persistent Attribute</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SINGLE_RELATIONSHIP_MAPPING__PERSISTENT_ATTRIBUTE = XML_RELATIONSHIP_MAPPING__PERSISTENT_ATTRIBUTE;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SINGLE_RELATIONSHIP_MAPPING__TARGET_ENTITY = XML_RELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY = XML_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY = XML_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SINGLE_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY = XML_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SINGLE_RELATIONSHIP_MAPPING__CASCADE = XML_RELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SINGLE_RELATIONSHIP_MAPPING__FETCH = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The number of structural features of the '<em>Xml Single Relationship Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT = XML_RELATIONSHIP_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlManyToOne <em>Xml Many To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlManyToOne
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlManyToOne()
- * @generated
- */
- public static final int XML_MANY_TO_ONE = 37;
-
- /**
- * The feature id for the '<em><b>Persistent Attribute</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_ONE__PERSISTENT_ATTRIBUTE = XML_SINGLE_RELATIONSHIP_MAPPING__PERSISTENT_ATTRIBUTE;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_ONE__TARGET_ENTITY = XML_SINGLE_RELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_ONE__SPECIFIED_TARGET_ENTITY = XML_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_ONE__DEFAULT_TARGET_ENTITY = XML_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_ONE__RESOLVED_TARGET_ENTITY = XML_SINGLE_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_ONE__CASCADE = XML_SINGLE_RELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_ONE__FETCH = XML_SINGLE_RELATIONSHIP_MAPPING__FETCH;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_ONE__JOIN_COLUMNS = XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_ONE__SPECIFIED_JOIN_COLUMNS = XML_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_ONE__DEFAULT_JOIN_COLUMNS = XML_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_ONE__OPTIONAL = XML_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL;
-
- /**
- * The number of structural features of the '<em>Xml Many To One</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MANY_TO_ONE_FEATURE_COUNT = XML_SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlOneToOne <em>Xml One To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlOneToOne
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlOneToOne()
- * @generated
- */
- public static final int XML_ONE_TO_ONE = 38;
-
- /**
- * The feature id for the '<em><b>Persistent Attribute</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_ONE__PERSISTENT_ATTRIBUTE = XML_SINGLE_RELATIONSHIP_MAPPING__PERSISTENT_ATTRIBUTE;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_ONE__TARGET_ENTITY = XML_SINGLE_RELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_ONE__SPECIFIED_TARGET_ENTITY = XML_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_ONE__DEFAULT_TARGET_ENTITY = XML_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_ONE__RESOLVED_TARGET_ENTITY = XML_SINGLE_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_ONE__CASCADE = XML_SINGLE_RELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_ONE__FETCH = XML_SINGLE_RELATIONSHIP_MAPPING__FETCH;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_ONE__JOIN_COLUMNS = XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_ONE__SPECIFIED_JOIN_COLUMNS = XML_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_ONE__DEFAULT_JOIN_COLUMNS = XML_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_ONE__OPTIONAL = XML_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_ONE__MAPPED_BY = XML_SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Xml One To One</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ONE_TO_ONE_FEATURE_COUNT = XML_SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlJoinTable <em>Xml Join Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlJoinTable
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlJoinTable()
- * @generated
- */
- public static final int XML_JOIN_TABLE = 41;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__NAME = ABSTRACT_XML_TABLE__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__SPECIFIED_NAME = ABSTRACT_XML_TABLE__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__DEFAULT_NAME = ABSTRACT_XML_TABLE__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__CATALOG = ABSTRACT_XML_TABLE__CATALOG;
-
- /**
- * The feature id for the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__SPECIFIED_CATALOG = ABSTRACT_XML_TABLE__SPECIFIED_CATALOG;
-
- /**
- * The feature id for the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__DEFAULT_CATALOG = ABSTRACT_XML_TABLE__DEFAULT_CATALOG;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__SCHEMA = ABSTRACT_XML_TABLE__SCHEMA;
-
- /**
- * The feature id for the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__SPECIFIED_SCHEMA = ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA;
-
- /**
- * The feature id for the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__DEFAULT_SCHEMA = ABSTRACT_XML_TABLE__DEFAULT_SCHEMA;
-
- /**
- * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__UNIQUE_CONSTRAINTS = ABSTRACT_XML_TABLE__UNIQUE_CONSTRAINTS;
-
- /**
- * The feature id for the '<em><b>Specified Name For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__SPECIFIED_NAME_FOR_XML = ABSTRACT_XML_TABLE__SPECIFIED_NAME_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Specified Catalog For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__SPECIFIED_CATALOG_FOR_XML = ABSTRACT_XML_TABLE__SPECIFIED_CATALOG_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Specified Schema For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__SPECIFIED_SCHEMA_FOR_XML = ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__JOIN_COLUMNS = ABSTRACT_XML_TABLE_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS = ABSTRACT_XML_TABLE_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__DEFAULT_JOIN_COLUMNS = ABSTRACT_XML_TABLE_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Inverse Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__INVERSE_JOIN_COLUMNS = ABSTRACT_XML_TABLE_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Specified Inverse Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS = ABSTRACT_XML_TABLE_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Default Inverse Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS = ABSTRACT_XML_TABLE_FEATURE_COUNT + 5;
-
- /**
- * The number of structural features of the '<em>Xml Join Table</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_JOIN_TABLE_FEATURE_COUNT = ABSTRACT_XML_TABLE_FEATURE_COUNT + 6;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlOverride <em>Xml Override</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlOverride
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlOverride()
- * @generated
- */
- public static final int XML_OVERRIDE = 43;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_OVERRIDE__NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Xml Override</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_OVERRIDE_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlAttributeOverride <em>Xml Attribute Override</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlAttributeOverride
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlAttributeOverride()
- * @generated
- */
- public static final int XML_ATTRIBUTE_OVERRIDE = 44;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ATTRIBUTE_OVERRIDE__NAME = XML_OVERRIDE__NAME;
-
- /**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ATTRIBUTE_OVERRIDE__COLUMN = XML_OVERRIDE_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Column For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ATTRIBUTE_OVERRIDE__COLUMN_FOR_XML = XML_OVERRIDE_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Xml Attribute Override</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ATTRIBUTE_OVERRIDE_FEATURE_COUNT = XML_OVERRIDE_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlAssociationOverride <em>Xml Association Override</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlAssociationOverride
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlAssociationOverride()
- * @generated
- */
- public static final int XML_ASSOCIATION_OVERRIDE = 45;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ASSOCIATION_OVERRIDE__NAME = XML_OVERRIDE__NAME;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ASSOCIATION_OVERRIDE__JOIN_COLUMNS = XML_OVERRIDE_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS = XML_OVERRIDE_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS = XML_OVERRIDE_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Xml Association Override</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ASSOCIATION_OVERRIDE_FEATURE_COUNT = XML_OVERRIDE_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn <em>Xml Discriminator Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlDiscriminatorColumn()
- * @generated
- */
- public static final int XML_DISCRIMINATOR_COLUMN = 46;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_DISCRIMINATOR_COLUMN__NAME = ABSTRACT_XML_NAMED_COLUMN__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_DISCRIMINATOR_COLUMN__SPECIFIED_NAME = ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_DISCRIMINATOR_COLUMN__DEFAULT_NAME = ABSTRACT_XML_NAMED_COLUMN__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_DISCRIMINATOR_COLUMN__COLUMN_DEFINITION = ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION;
-
- /**
- * The feature id for the '<em><b>Specified Name For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_DISCRIMINATOR_COLUMN__SPECIFIED_NAME_FOR_XML = ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Column Definition For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_DISCRIMINATOR_COLUMN__COLUMN_DEFINITION_FOR_XML = ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Discriminator Type</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Default Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_DISCRIMINATOR_COLUMN__DEFAULT_LENGTH = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Specified Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_DISCRIMINATOR_COLUMN__LENGTH = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Discriminator Type For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE_FOR_XML = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Specified Length For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH_FOR_XML = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 5;
-
- /**
- * The number of structural features of the '<em>Xml Discriminator Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_DISCRIMINATOR_COLUMN_FEATURE_COUNT = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 6;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlSecondaryTable <em>Xml Secondary Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlSecondaryTable
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlSecondaryTable()
- * @generated
- */
- public static final int XML_SECONDARY_TABLE = 47;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE__NAME = ABSTRACT_XML_TABLE__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE__SPECIFIED_NAME = ABSTRACT_XML_TABLE__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE__DEFAULT_NAME = ABSTRACT_XML_TABLE__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE__CATALOG = ABSTRACT_XML_TABLE__CATALOG;
-
- /**
- * The feature id for the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE__SPECIFIED_CATALOG = ABSTRACT_XML_TABLE__SPECIFIED_CATALOG;
-
- /**
- * The feature id for the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE__DEFAULT_CATALOG = ABSTRACT_XML_TABLE__DEFAULT_CATALOG;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE__SCHEMA = ABSTRACT_XML_TABLE__SCHEMA;
-
- /**
- * The feature id for the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE__SPECIFIED_SCHEMA = ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA;
-
- /**
- * The feature id for the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE__DEFAULT_SCHEMA = ABSTRACT_XML_TABLE__DEFAULT_SCHEMA;
-
- /**
- * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE__UNIQUE_CONSTRAINTS = ABSTRACT_XML_TABLE__UNIQUE_CONSTRAINTS;
-
- /**
- * The feature id for the '<em><b>Specified Name For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE__SPECIFIED_NAME_FOR_XML = ABSTRACT_XML_TABLE__SPECIFIED_NAME_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Specified Catalog For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE__SPECIFIED_CATALOG_FOR_XML = ABSTRACT_XML_TABLE__SPECIFIED_CATALOG_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Specified Schema For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE__SPECIFIED_SCHEMA_FOR_XML = ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS = ABSTRACT_XML_TABLE_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS = ABSTRACT_XML_TABLE_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS = ABSTRACT_XML_TABLE_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Xml Secondary Table</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SECONDARY_TABLE_FEATURE_COUNT = ABSTRACT_XML_TABLE_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlPrimaryKeyJoinColumn <em>Xml Primary Key Join Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPrimaryKeyJoinColumn
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPrimaryKeyJoinColumn()
- * @generated
- */
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN = 48;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN__NAME = ABSTRACT_XML_NAMED_COLUMN__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_NAME = ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN__DEFAULT_NAME = ABSTRACT_XML_NAMED_COLUMN__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION = ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION;
-
- /**
- * The feature id for the '<em><b>Specified Name For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_NAME_FOR_XML = ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Column Definition For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION_FOR_XML = ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION_FOR_XML;
-
- /**
- * The feature id for the '<em><b>Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Specified Referenced Column Name For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 3;
-
- /**
- * The number of structural features of the '<em>Xml Primary Key Join Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_PRIMARY_KEY_JOIN_COLUMN_FEATURE_COUNT = ABSTRACT_XML_NAMED_COLUMN_FEATURE_COUNT + 4;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlGeneratedValue <em>Xml Generated Value</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlGeneratedValue
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlGeneratedValue()
- * @generated
- */
- public static final int XML_GENERATED_VALUE = 49;
-
- /**
- * The feature id for the '<em><b>Strategy</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_GENERATED_VALUE__STRATEGY = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Generator</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_GENERATED_VALUE__GENERATOR = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Xml Generated Value</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_GENERATED_VALUE_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlGenerator <em>Xml Generator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlGenerator
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlGenerator()
- * @generated
- */
- public static final int XML_GENERATOR = 50;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_GENERATOR__NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_GENERATOR__INITIAL_VALUE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Specified Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_GENERATOR__SPECIFIED_INITIAL_VALUE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Default Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_GENERATOR__DEFAULT_INITIAL_VALUE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_GENERATOR__ALLOCATION_SIZE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Specified Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_GENERATOR__SPECIFIED_ALLOCATION_SIZE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Default Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_GENERATOR__DEFAULT_ALLOCATION_SIZE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 6;
-
- /**
- * The number of structural features of the '<em>Xml Generator</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_GENERATOR_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 7;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlSequenceGenerator <em>Xml Sequence Generator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlSequenceGenerator
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlSequenceGenerator()
- * @generated
- */
- public static final int XML_SEQUENCE_GENERATOR = 51;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SEQUENCE_GENERATOR__NAME = XML_GENERATOR__NAME;
-
- /**
- * The feature id for the '<em><b>Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SEQUENCE_GENERATOR__INITIAL_VALUE = XML_GENERATOR__INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Specified Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SEQUENCE_GENERATOR__SPECIFIED_INITIAL_VALUE = XML_GENERATOR__SPECIFIED_INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Default Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SEQUENCE_GENERATOR__DEFAULT_INITIAL_VALUE = XML_GENERATOR__DEFAULT_INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SEQUENCE_GENERATOR__ALLOCATION_SIZE = XML_GENERATOR__ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Specified Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SEQUENCE_GENERATOR__SPECIFIED_ALLOCATION_SIZE = XML_GENERATOR__SPECIFIED_ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Default Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SEQUENCE_GENERATOR__DEFAULT_ALLOCATION_SIZE = XML_GENERATOR__DEFAULT_ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Sequence Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SEQUENCE_GENERATOR__SEQUENCE_NAME = XML_GENERATOR_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Sequence Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME = XML_GENERATOR_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Sequence Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME = XML_GENERATOR_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Xml Sequence Generator</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_SEQUENCE_GENERATOR_FEATURE_COUNT = XML_GENERATOR_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator <em>Xml Table Generator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTableGenerator()
- * @generated
- */
- public static final int XML_TABLE_GENERATOR = 52;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__NAME = XML_GENERATOR__NAME;
-
- /**
- * The feature id for the '<em><b>Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__INITIAL_VALUE = XML_GENERATOR__INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Specified Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__SPECIFIED_INITIAL_VALUE = XML_GENERATOR__SPECIFIED_INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Default Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__DEFAULT_INITIAL_VALUE = XML_GENERATOR__DEFAULT_INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__ALLOCATION_SIZE = XML_GENERATOR__ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Specified Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__SPECIFIED_ALLOCATION_SIZE = XML_GENERATOR__SPECIFIED_ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Default Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__DEFAULT_ALLOCATION_SIZE = XML_GENERATOR__DEFAULT_ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__TABLE = XML_GENERATOR_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__SPECIFIED_TABLE = XML_GENERATOR_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__DEFAULT_TABLE = XML_GENERATOR_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__CATALOG = XML_GENERATOR_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__SPECIFIED_CATALOG = XML_GENERATOR_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__DEFAULT_CATALOG = XML_GENERATOR_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__SCHEMA = XML_GENERATOR_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__SPECIFIED_SCHEMA = XML_GENERATOR_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__DEFAULT_SCHEMA = XML_GENERATOR_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Pk Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__PK_COLUMN_NAME = XML_GENERATOR_FEATURE_COUNT + 9;
-
- /**
- * The feature id for the '<em><b>Specified Pk Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME = XML_GENERATOR_FEATURE_COUNT + 10;
-
- /**
- * The feature id for the '<em><b>Default Pk Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME = XML_GENERATOR_FEATURE_COUNT + 11;
-
- /**
- * The feature id for the '<em><b>Value Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__VALUE_COLUMN_NAME = XML_GENERATOR_FEATURE_COUNT + 12;
-
- /**
- * The feature id for the '<em><b>Specified Value Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME = XML_GENERATOR_FEATURE_COUNT + 13;
-
- /**
- * The feature id for the '<em><b>Default Value Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME = XML_GENERATOR_FEATURE_COUNT + 14;
-
- /**
- * The feature id for the '<em><b>Pk Column Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__PK_COLUMN_VALUE = XML_GENERATOR_FEATURE_COUNT + 15;
-
- /**
- * The feature id for the '<em><b>Specified Pk Column Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE = XML_GENERATOR_FEATURE_COUNT + 16;
-
- /**
- * The feature id for the '<em><b>Default Pk Column Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE = XML_GENERATOR_FEATURE_COUNT + 17;
-
- /**
- * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR__UNIQUE_CONSTRAINTS = XML_GENERATOR_FEATURE_COUNT + 18;
-
- /**
- * The number of structural features of the '<em>Xml Table Generator</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_TABLE_GENERATOR_FEATURE_COUNT = XML_GENERATOR_FEATURE_COUNT + 19;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlQuery <em>Abstract Xml Query</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlQuery
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlQuery()
- * @generated
- */
- public static final int ABSTRACT_XML_QUERY = 53;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_QUERY__NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Query</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_QUERY__QUERY = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Hints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_QUERY__HINTS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Abstract Xml Query</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ABSTRACT_XML_QUERY_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlNamedQuery <em>Xml Named Query</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlNamedQuery
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlNamedQuery()
- * @generated
- */
- public static final int XML_NAMED_QUERY = 54;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_NAMED_QUERY__NAME = ABSTRACT_XML_QUERY__NAME;
-
- /**
- * The feature id for the '<em><b>Query</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_NAMED_QUERY__QUERY = ABSTRACT_XML_QUERY__QUERY;
-
- /**
- * The feature id for the '<em><b>Hints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_NAMED_QUERY__HINTS = ABSTRACT_XML_QUERY__HINTS;
-
- /**
- * The number of structural features of the '<em>Xml Named Query</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_NAMED_QUERY_FEATURE_COUNT = ABSTRACT_XML_QUERY_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlNamedNativeQuery <em>Xml Named Native Query</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlNamedNativeQuery
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlNamedNativeQuery()
- * @generated
- */
- public static final int XML_NAMED_NATIVE_QUERY = 55;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_NAMED_NATIVE_QUERY__NAME = ABSTRACT_XML_QUERY__NAME;
-
- /**
- * The feature id for the '<em><b>Query</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_NAMED_NATIVE_QUERY__QUERY = ABSTRACT_XML_QUERY__QUERY;
-
- /**
- * The feature id for the '<em><b>Hints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_NAMED_NATIVE_QUERY__HINTS = ABSTRACT_XML_QUERY__HINTS;
-
- /**
- * The feature id for the '<em><b>Result Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_NAMED_NATIVE_QUERY__RESULT_CLASS = ABSTRACT_XML_QUERY_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Result Set Mapping</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING = ABSTRACT_XML_QUERY_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Xml Named Native Query</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_NAMED_NATIVE_QUERY_FEATURE_COUNT = ABSTRACT_XML_QUERY_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlQueryHint <em>Xml Query Hint</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlQueryHint
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlQueryHint()
- * @generated
- */
- public static final int XML_QUERY_HINT = 56;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_QUERY_HINT__NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_QUERY_HINT__VALUE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Xml Query Hint</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_QUERY_HINT_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlUniqueConstraint <em>Xml Unique Constraint</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlUniqueConstraint
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlUniqueConstraint()
- * @generated
- */
- public static final int XML_UNIQUE_CONSTRAINT = 57;
-
- /**
- * The feature id for the '<em><b>Column Names</b></em>' attribute list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_UNIQUE_CONSTRAINT__COLUMN_NAMES = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Xml Unique Constraint</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_UNIQUE_CONSTRAINT_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlCascade <em>Xml Cascade</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlCascade
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlCascade()
- * @generated
- */
- public static final int XML_CASCADE = 58;
-
- /**
- * The feature id for the '<em><b>All</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_CASCADE__ALL = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Persist</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_CASCADE__PERSIST = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Merge</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_CASCADE__MERGE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Remove</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_CASCADE__REMOVE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Refresh</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_CASCADE__REFRESH = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The number of structural features of the '<em>Xml Cascade</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_CASCADE_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 5;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlIdClass <em>Xml Id Class</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlIdClass
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlIdClass()
- * @generated
- */
- public static final int XML_ID_CLASS = 59;
-
- /**
- * The feature id for the '<em><b>Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ID_CLASS__VALUE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Xml Id Class</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_ID_CLASS_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlInheritance <em>Xml Inheritance</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlInheritance
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlInheritance()
- * @generated
- */
- public static final int XML_INHERITANCE = 60;
-
- /**
- * The feature id for the '<em><b>Strategy</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_INHERITANCE__STRATEGY = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Xml Inheritance</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_INHERITANCE_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMapKey <em>Xml Map Key</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMapKey
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMapKey()
- * @generated
- */
- public static final int XML_MAP_KEY = 61;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MAP_KEY__NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Xml Map Key</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int XML_MAP_KEY_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlRootContentNodeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass entityMappingsInternalEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass entityMappingsEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass entityMappingsForXmlEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlTypeMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlPersistentTypeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlMappedSuperclassEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlEntityInternalEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlEntityForXmlEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlEntityEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlEmbeddableEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlAttributeMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlNullAttributeMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlBasicEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlIdEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlTransientEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlEmbeddedEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlEmbeddedIdEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlVersionEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlMultiRelationshipMappingInternalEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlMultiRelationshipMappingForXmlEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlMultiRelationshipMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlOneToManyEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlManyToManyEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlPersistentAttributeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass persistenceUnitMetadataInternalEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass persistenceUnitMetadataEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass persistenceUnitMetadataForXmlEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass persistenceUnitDefaultsInternalEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass persistenceUnitDefaultsEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass persistenceUnitDefaultsForXmlEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlTableEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass abstractXmlNamedColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass abstractXmlColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlJoinColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iXmlColumnMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlManyToOneEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlOneToOneEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlSingleRelationshipMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlRelationshipMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlJoinTableEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass abstractXmlTableEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlOverrideEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlAttributeOverrideEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlAssociationOverrideEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlDiscriminatorColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlSecondaryTableEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlPrimaryKeyJoinColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlGeneratedValueEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlGeneratorEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlSequenceGeneratorEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlTableGeneratorEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass abstractXmlQueryEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlNamedQueryEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlNamedNativeQueryEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlQueryHintEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlUniqueConstraintEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlCascadeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlIdClassEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlInheritanceEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass xmlMapKeyEClass = null;
-
- /**
- * Creates an instance of the model <b>Package</b>, registered with
- * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
- * package URI value.
- * <p>Note: the correct way to create the package is via the static
- * factory method {@link #init init()}, which also performs
- * initialization of the package, or returns the registered package,
- * if one already exists.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.ecore.EPackage.Registry
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#eNS_URI
- * @see #init()
- * @generated
- */
- private OrmPackage() {
- super(eNS_URI, OrmFactory.eINSTANCE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static boolean isInited = false;
-
- /**
- * Creates, registers, and initializes the <b>Package</b> for this
- * model, and for any others upon which it depends. Simple
- * dependencies are satisfied by calling this method on all
- * dependent packages before doing anything else. This method drives
- * initialization for interdependent packages directly, in parallel
- * with this package, itself.
- * <p>Of this package and its interdependencies, all packages which
- * have not yet been registered by their URI values are first created
- * and registered. The packages are then initialized in two steps:
- * meta-model objects for all of the packages are created before any
- * are initialized, since one package's meta-model objects may refer to
- * those of another.
- * <p>Invocation of this method will not affect any packages that have
- * already been initialized.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #eNS_URI
- * @see #createPackageContents()
- * @see #initializePackageContents()
- * @generated
- */
- public static OrmPackage init() {
- if (isInited)
- return (OrmPackage) EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI);
- // Obtain or create and register package
- OrmPackage theOrmPackage = (OrmPackage) (EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof OrmPackage ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new OrmPackage());
- isInited = true;
- // Initialize simple dependencies
- EcorePackage.eINSTANCE.eClass();
- // Obtain or create and register interdependencies
- JpaCorePackage theJpaCorePackage = (JpaCorePackage) (EPackage.Registry.INSTANCE.getEPackage(JpaCorePackage.eNS_URI) instanceof JpaCorePackage ? EPackage.Registry.INSTANCE.getEPackage(JpaCorePackage.eNS_URI) : JpaCorePackage.eINSTANCE);
- JpaCoreMappingsPackage theJpaCoreMappingsPackage = (JpaCoreMappingsPackage) (EPackage.Registry.INSTANCE.getEPackage(JpaCoreMappingsPackage.eNS_URI) instanceof JpaCoreMappingsPackage ? EPackage.Registry.INSTANCE.getEPackage(JpaCoreMappingsPackage.eNS_URI) : JpaCoreMappingsPackage.eINSTANCE);
- JpaJavaPackage theJpaJavaPackage = (JpaJavaPackage) (EPackage.Registry.INSTANCE.getEPackage(JpaJavaPackage.eNS_URI) instanceof JpaJavaPackage ? EPackage.Registry.INSTANCE.getEPackage(JpaJavaPackage.eNS_URI) : JpaJavaPackage.eINSTANCE);
- JpaJavaMappingsPackage theJpaJavaMappingsPackage = (JpaJavaMappingsPackage) (EPackage.Registry.INSTANCE.getEPackage(JpaJavaMappingsPackage.eNS_URI) instanceof JpaJavaMappingsPackage ? EPackage.Registry.INSTANCE.getEPackage(JpaJavaMappingsPackage.eNS_URI) : JpaJavaMappingsPackage.eINSTANCE);
- PersistencePackage thePersistencePackage = (PersistencePackage) (EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI) instanceof PersistencePackage ? EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI) : PersistencePackage.eINSTANCE);
- // Create package meta-data objects
- theOrmPackage.createPackageContents();
- theJpaCorePackage.createPackageContents();
- theJpaCoreMappingsPackage.createPackageContents();
- theJpaJavaPackage.createPackageContents();
- theJpaJavaMappingsPackage.createPackageContents();
- thePersistencePackage.createPackageContents();
- // Initialize created meta-data
- theOrmPackage.initializePackageContents();
- theJpaCorePackage.initializePackageContents();
- theJpaCoreMappingsPackage.initializePackageContents();
- theJpaJavaPackage.initializePackageContents();
- theJpaJavaMappingsPackage.initializePackageContents();
- thePersistencePackage.initializePackageContents();
- // Mark meta-data to indicate it can't be changed
- theOrmPackage.freeze();
- return theOrmPackage;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode <em>Xml Root Content Node</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Root Content Node</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode
- * @generated
- */
- public EClass getXmlRootContentNode() {
- return xmlRootContentNodeEClass;
- }
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode#getEntityMappings <em>Entity Mappings</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Entity Mappings</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode#getEntityMappings()
- * @see #getXmlRootContentNode()
- * @generated
- */
- public EReference getXmlRootContentNode_EntityMappings() {
- return (EReference) xmlRootContentNodeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal <em>Entity Mappings Internal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Entity Mappings Internal</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal
- * @generated
- */
- public EClass getEntityMappingsInternal() {
- return entityMappingsInternalEClass;
- }
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getRoot <em>Root</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Root</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getRoot()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EReference getEntityMappingsInternal_Root() {
- return (EReference) entityMappingsInternalEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getVersion <em>Version</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Version</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getVersion()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EAttribute getEntityMappingsInternal_Version() {
- return (EAttribute) entityMappingsInternalEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getDescription <em>Description</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Description</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getDescription()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EAttribute getEntityMappingsInternal_Description() {
- return (EAttribute) entityMappingsInternalEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getPersistenceUnitMetadataInternal <em>Persistence Unit Metadata Internal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Persistence Unit Metadata Internal</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getPersistenceUnitMetadataInternal()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EReference getEntityMappingsInternal_PersistenceUnitMetadataInternal() {
- return (EReference) entityMappingsInternalEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getPackageInternal <em>Package Internal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Package Internal</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getPackageInternal()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EAttribute getEntityMappingsInternal_PackageInternal() {
- return (EAttribute) entityMappingsInternalEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getDefaultSchema <em>Default Schema</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Schema</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getDefaultSchema()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EAttribute getEntityMappingsInternal_DefaultSchema() {
- return (EAttribute) entityMappingsInternalEClass.getEStructuralFeatures().get(5);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSpecifiedSchema <em>Specified Schema</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Schema</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSpecifiedSchema()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EAttribute getEntityMappingsInternal_SpecifiedSchema() {
- return (EAttribute) entityMappingsInternalEClass.getEStructuralFeatures().get(6);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSchema <em>Schema</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Schema</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSchema()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EAttribute getEntityMappingsInternal_Schema() {
- return (EAttribute) entityMappingsInternalEClass.getEStructuralFeatures().get(7);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getDefaultCatalog <em>Default Catalog</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Catalog</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getDefaultCatalog()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EAttribute getEntityMappingsInternal_DefaultCatalog() {
- return (EAttribute) entityMappingsInternalEClass.getEStructuralFeatures().get(8);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSpecifiedCatalog <em>Specified Catalog</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Catalog</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSpecifiedCatalog()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EAttribute getEntityMappingsInternal_SpecifiedCatalog() {
- return (EAttribute) entityMappingsInternalEClass.getEStructuralFeatures().get(9);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getCatalog <em>Catalog</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Catalog</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getCatalog()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EAttribute getEntityMappingsInternal_Catalog() {
- return (EAttribute) entityMappingsInternalEClass.getEStructuralFeatures().get(10);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getDefaultAccess <em>Default Access</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Access</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getDefaultAccess()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EAttribute getEntityMappingsInternal_DefaultAccess() {
- return (EAttribute) entityMappingsInternalEClass.getEStructuralFeatures().get(11);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSpecifiedAccess <em>Specified Access</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Access</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSpecifiedAccess()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EAttribute getEntityMappingsInternal_SpecifiedAccess() {
- return (EAttribute) entityMappingsInternalEClass.getEStructuralFeatures().get(12);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getAccess <em>Access</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Access</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getAccess()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EAttribute getEntityMappingsInternal_Access() {
- return (EAttribute) entityMappingsInternalEClass.getEStructuralFeatures().get(13);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getTypeMappings <em>Type Mappings</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Type Mappings</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getTypeMappings()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EReference getEntityMappingsInternal_TypeMappings() {
- return (EReference) entityMappingsInternalEClass.getEStructuralFeatures().get(14);
- }
-
- /**
- * Returns the meta object for the reference list '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getPersistentTypes <em>Persistent Types</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference list '<em>Persistent Types</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getPersistentTypes()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EReference getEntityMappingsInternal_PersistentTypes() {
- return (EReference) entityMappingsInternalEClass.getEStructuralFeatures().get(15);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSequenceGenerators <em>Sequence Generators</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Sequence Generators</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getSequenceGenerators()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EReference getEntityMappingsInternal_SequenceGenerators() {
- return (EReference) entityMappingsInternalEClass.getEStructuralFeatures().get(16);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getTableGenerators <em>Table Generators</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Table Generators</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getTableGenerators()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EReference getEntityMappingsInternal_TableGenerators() {
- return (EReference) entityMappingsInternalEClass.getEStructuralFeatures().get(17);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getNamedQueries <em>Named Queries</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Named Queries</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getNamedQueries()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EReference getEntityMappingsInternal_NamedQueries() {
- return (EReference) entityMappingsInternalEClass.getEStructuralFeatures().get(18);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getNamedNativeQueries <em>Named Native Queries</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Named Native Queries</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getNamedNativeQueries()
- * @see #getEntityMappingsInternal()
- * @generated
- */
- public EReference getEntityMappingsInternal_NamedNativeQueries() {
- return (EReference) entityMappingsInternalEClass.getEStructuralFeatures().get(19);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappings <em>Entity Mappings</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Entity Mappings</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappings
- * @generated
- */
- public EClass getEntityMappings() {
- return entityMappingsEClass;
- }
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappings#getPersistenceUnitMetadata <em>Persistence Unit Metadata</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Persistence Unit Metadata</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappings#getPersistenceUnitMetadata()
- * @see #getEntityMappings()
- * @generated
- */
- public EReference getEntityMappings_PersistenceUnitMetadata() {
- return (EReference) entityMappingsEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappings#getPackage <em>Package</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Package</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappings#getPackage()
- * @see #getEntityMappings()
- * @generated
- */
- public EAttribute getEntityMappings_Package() {
- return (EAttribute) entityMappingsEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml <em>Entity Mappings For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Entity Mappings For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml
- * @generated
- */
- public EClass getEntityMappingsForXml() {
- return entityMappingsForXmlEClass;
- }
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml#getPersistenceUnitMetadataForXml <em>Persistence Unit Metadata For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Persistence Unit Metadata For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml#getPersistenceUnitMetadataForXml()
- * @see #getEntityMappingsForXml()
- * @generated
- */
- public EReference getEntityMappingsForXml_PersistenceUnitMetadataForXml() {
- return (EReference) entityMappingsForXmlEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml#getPackageForXml <em>Package For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Package For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml#getPackageForXml()
- * @see #getEntityMappingsForXml()
- * @generated
- */
- public EAttribute getEntityMappingsForXml_PackageForXml() {
- return (EAttribute) entityMappingsForXmlEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping <em>Xml Type Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Type Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping
- * @generated
- */
- public EClass getXmlTypeMapping() {
- return xmlTypeMappingEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getDefaultAccess <em>Default Access</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Access</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getDefaultAccess()
- * @see #getXmlTypeMapping()
- * @generated
- */
- public EAttribute getXmlTypeMapping_DefaultAccess() {
- return (EAttribute) xmlTypeMappingEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getSpecifiedAccess <em>Specified Access</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Access</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getSpecifiedAccess()
- * @see #getXmlTypeMapping()
- * @generated
- */
- public EAttribute getXmlTypeMapping_SpecifiedAccess() {
- return (EAttribute) xmlTypeMappingEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getAccess <em>Access</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Access</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getAccess()
- * @see #getXmlTypeMapping()
- * @generated
- */
- public EAttribute getXmlTypeMapping_Access() {
- return (EAttribute) xmlTypeMappingEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getMetadataComplete <em>Metadata Complete</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Metadata Complete</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getMetadataComplete()
- * @see #getXmlTypeMapping()
- * @generated
- */
- public EAttribute getXmlTypeMapping_MetadataComplete() {
- return (EAttribute) xmlTypeMappingEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getPersistentType <em>Persistent Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Persistent Type</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getPersistentType()
- * @see #getXmlTypeMapping()
- * @generated
- */
- public EReference getXmlTypeMapping_PersistentType() {
- return (EReference) xmlTypeMappingEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType <em>Xml Persistent Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Persistent Type</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPersistentType
- * @generated
- */
- public EClass getXmlPersistentType() {
- return xmlPersistentTypeEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getClass_ <em>Class</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Class</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getClass_()
- * @see #getXmlPersistentType()
- * @generated
- */
- public EAttribute getXmlPersistentType_Class() {
- return (EAttribute) xmlPersistentTypeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getAttributeMappings <em>Attribute Mappings</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Attribute Mappings</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getAttributeMappings()
- * @see #getXmlPersistentType()
- * @generated
- */
- public EReference getXmlPersistentType_AttributeMappings() {
- return (EReference) xmlPersistentTypeEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getSpecifiedAttributeMappings <em>Specified Attribute Mappings</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Specified Attribute Mappings</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getSpecifiedAttributeMappings()
- * @see #getXmlPersistentType()
- * @generated
- */
- public EReference getXmlPersistentType_SpecifiedAttributeMappings() {
- return (EReference) xmlPersistentTypeEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getVirtualAttributeMappings <em>Virtual Attribute Mappings</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Virtual Attribute Mappings</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getVirtualAttributeMappings()
- * @see #getXmlPersistentType()
- * @generated
- */
- public EReference getXmlPersistentType_VirtualAttributeMappings() {
- return (EReference) xmlPersistentTypeEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the reference list '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getPersistentAttributes <em>Persistent Attributes</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference list '<em>Persistent Attributes</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getPersistentAttributes()
- * @see #getXmlPersistentType()
- * @generated
- */
- public EReference getXmlPersistentType_PersistentAttributes() {
- return (EReference) xmlPersistentTypeEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for the reference list '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getSpecifiedPersistentAttributes <em>Specified Persistent Attributes</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference list '<em>Specified Persistent Attributes</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getSpecifiedPersistentAttributes()
- * @see #getXmlPersistentType()
- * @generated
- */
- public EReference getXmlPersistentType_SpecifiedPersistentAttributes() {
- return (EReference) xmlPersistentTypeEClass.getEStructuralFeatures().get(5);
- }
-
- /**
- * Returns the meta object for the reference list '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getVirtualPersistentAttributes <em>Virtual Persistent Attributes</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference list '<em>Virtual Persistent Attributes</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getVirtualPersistentAttributes()
- * @see #getXmlPersistentType()
- * @generated
- */
- public EReference getXmlPersistentType_VirtualPersistentAttributes() {
- return (EReference) xmlPersistentTypeEClass.getEStructuralFeatures().get(6);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass <em>Xml Mapped Superclass</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Mapped Superclass</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass
- * @generated
- */
- public EClass getXmlMappedSuperclass() {
- return xmlMappedSuperclassEClass;
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass#getIdClassForXml <em>Id Class For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Id Class For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass#getIdClassForXml()
- * @see #getXmlMappedSuperclass()
- * @generated
- */
- public EReference getXmlMappedSuperclass_IdClassForXml() {
- return (EReference) xmlMappedSuperclassEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal <em>Xml Entity Internal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Entity Internal</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal
- * @generated
- */
- public EClass getXmlEntityInternal() {
- return xmlEntityInternalEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml <em>Xml Entity For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Entity For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml
- * @generated
- */
- public EClass getXmlEntityForXml() {
- return xmlEntityForXmlEClass;
- }
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml#getTableForXml <em>Table For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Table For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml#getTableForXml()
- * @see #getXmlEntityForXml()
- * @generated
- */
- public EReference getXmlEntityForXml_TableForXml() {
- return (EReference) xmlEntityForXmlEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml#getDiscriminatorColumnForXml <em>Discriminator Column For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Discriminator Column For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml#getDiscriminatorColumnForXml()
- * @see #getXmlEntityForXml()
- * @generated
- */
- public EReference getXmlEntityForXml_DiscriminatorColumnForXml() {
- return (EReference) xmlEntityForXmlEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml#getIdClassForXml <em>Id Class For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Id Class For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml#getIdClassForXml()
- * @see #getXmlEntityForXml()
- * @generated
- */
- public EReference getXmlEntityForXml_IdClassForXml() {
- return (EReference) xmlEntityForXmlEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml#getInheritanceForXml <em>Inheritance For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Inheritance For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml#getInheritanceForXml()
- * @see #getXmlEntityForXml()
- * @generated
- */
- public EReference getXmlEntityForXml_InheritanceForXml() {
- return (EReference) xmlEntityForXmlEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntity <em>Xml Entity</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Entity</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntity
- * @generated
- */
- public EClass getXmlEntity() {
- return xmlEntityEClass;
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntity#getSecondaryTables <em>Secondary Tables</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Secondary Tables</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntity#getSecondaryTables()
- * @see #getXmlEntity()
- * @generated
- */
- public EReference getXmlEntity_SecondaryTables() {
- return (EReference) xmlEntityEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntity#getVirtualSecondaryTables <em>Virtual Secondary Tables</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Virtual Secondary Tables</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntity#getVirtualSecondaryTables()
- * @see #getXmlEntity()
- * @generated
- */
- public EReference getXmlEntity_VirtualSecondaryTables() {
- return (EReference) xmlEntityEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlEmbeddable <em>Xml Embeddable</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Embeddable</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEmbeddable
- * @generated
- */
- public EClass getXmlEmbeddable() {
- return xmlEmbeddableEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping <em>Xml Attribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Attribute Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping
- * @generated
- */
- public EClass getXmlAttributeMapping() {
- return xmlAttributeMappingEClass;
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping#getPersistentAttribute <em>Persistent Attribute</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Persistent Attribute</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping#getPersistentAttribute()
- * @see #getXmlAttributeMapping()
- * @generated
- */
- public EReference getXmlAttributeMapping_PersistentAttribute() {
- return (EReference) xmlAttributeMappingEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlNullAttributeMapping <em>Xml Null Attribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Null Attribute Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlNullAttributeMapping
- * @generated
- */
- public EClass getXmlNullAttributeMapping() {
- return xmlNullAttributeMappingEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlBasic <em>Xml Basic</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Basic</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlBasic
- * @generated
- */
- public EClass getXmlBasic() {
- return xmlBasicEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlId <em>Xml Id</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Id</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlId
- * @generated
- */
- public EClass getXmlId() {
- return xmlIdEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlTransient <em>Xml Transient</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Transient</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTransient
- * @generated
- */
- public EClass getXmlTransient() {
- return xmlTransientEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlEmbedded <em>Xml Embedded</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Embedded</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEmbedded
- * @generated
- */
- public EClass getXmlEmbedded() {
- return xmlEmbeddedEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlEmbeddedId <em>Xml Embedded Id</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Embedded Id</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEmbeddedId
- * @generated
- */
- public EClass getXmlEmbeddedId() {
- return xmlEmbeddedIdEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlVersion <em>Xml Version</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Version</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlVersion
- * @generated
- */
- public EClass getXmlVersion() {
- return xmlVersionEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal <em>Xml Multi Relationship Mapping Internal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Multi Relationship Mapping Internal</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal
- * @generated
- */
- public EClass getXmlMultiRelationshipMappingInternal() {
- return xmlMultiRelationshipMappingInternalEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml <em>Xml Multi Relationship Mapping For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Multi Relationship Mapping For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml
- * @generated
- */
- public EClass getXmlMultiRelationshipMappingForXml() {
- return xmlMultiRelationshipMappingForXmlEClass;
- }
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml#getJoinTableForXml <em>Join Table For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Join Table For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml#getJoinTableForXml()
- * @see #getXmlMultiRelationshipMappingForXml()
- * @generated
- */
- public EReference getXmlMultiRelationshipMappingForXml_JoinTableForXml() {
- return (EReference) xmlMultiRelationshipMappingForXmlEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml#getMapKeyForXml <em>Map Key For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Map Key For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml#getMapKeyForXml()
- * @see #getXmlMultiRelationshipMappingForXml()
- * @generated
- */
- public EReference getXmlMultiRelationshipMappingForXml_MapKeyForXml() {
- return (EReference) xmlMultiRelationshipMappingForXmlEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMapping <em>Xml Multi Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Multi Relationship Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMapping
- * @generated
- */
- public EClass getXmlMultiRelationshipMapping() {
- return xmlMultiRelationshipMappingEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlOneToMany <em>Xml One To Many</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml One To Many</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlOneToMany
- * @generated
- */
- public EClass getXmlOneToMany() {
- return xmlOneToManyEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlManyToMany <em>Xml Many To Many</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Many To Many</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlManyToMany
- * @generated
- */
- public EClass getXmlManyToMany() {
- return xmlManyToManyEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute <em>Xml Persistent Attribute</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Persistent Attribute</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute
- * @generated
- */
- public EClass getXmlPersistentAttribute() {
- return xmlPersistentAttributeEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute#getName <em>Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Name</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute#getName()
- * @see #getXmlPersistentAttribute()
- * @generated
- */
- public EAttribute getXmlPersistentAttribute_Name() {
- return (EAttribute) xmlPersistentAttributeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal <em>Persistence Unit Metadata Internal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Persistence Unit Metadata Internal</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal
- * @generated
- */
- public EClass getPersistenceUnitMetadataInternal() {
- return persistenceUnitMetadataInternalEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal#isXmlMappingMetadataCompleteInternal <em>Xml Mapping Metadata Complete Internal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Xml Mapping Metadata Complete Internal</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal#isXmlMappingMetadataCompleteInternal()
- * @see #getPersistenceUnitMetadataInternal()
- * @generated
- */
- public EAttribute getPersistenceUnitMetadataInternal_XmlMappingMetadataCompleteInternal() {
- return (EAttribute) persistenceUnitMetadataInternalEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal#getPersistenceUnitDefaultsInternal <em>Persistence Unit Defaults Internal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Persistence Unit Defaults Internal</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal#getPersistenceUnitDefaultsInternal()
- * @see #getPersistenceUnitMetadataInternal()
- * @generated
- */
- public EReference getPersistenceUnitMetadataInternal_PersistenceUnitDefaultsInternal() {
- return (EReference) persistenceUnitMetadataInternalEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata <em>Persistence Unit Metadata</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Persistence Unit Metadata</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata
- * @generated
- */
- public EClass getPersistenceUnitMetadata() {
- return persistenceUnitMetadataEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata#isXmlMappingMetadataComplete <em>Xml Mapping Metadata Complete</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Xml Mapping Metadata Complete</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata#isXmlMappingMetadataComplete()
- * @see #getPersistenceUnitMetadata()
- * @generated
- */
- public EAttribute getPersistenceUnitMetadata_XmlMappingMetadataComplete() {
- return (EAttribute) persistenceUnitMetadataEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata#getPersistenceUnitDefaults <em>Persistence Unit Defaults</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Persistence Unit Defaults</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata#getPersistenceUnitDefaults()
- * @see #getPersistenceUnitMetadata()
- * @generated
- */
- public EReference getPersistenceUnitMetadata_PersistenceUnitDefaults() {
- return (EReference) persistenceUnitMetadataEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml <em>Persistence Unit Metadata For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Persistence Unit Metadata For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml
- * @generated
- */
- public EClass getPersistenceUnitMetadataForXml() {
- return persistenceUnitMetadataForXmlEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml#isXmlMappingMetadataCompleteForXml <em>Xml Mapping Metadata Complete For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Xml Mapping Metadata Complete For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml#isXmlMappingMetadataCompleteForXml()
- * @see #getPersistenceUnitMetadataForXml()
- * @generated
- */
- public EAttribute getPersistenceUnitMetadataForXml_XmlMappingMetadataCompleteForXml() {
- return (EAttribute) persistenceUnitMetadataForXmlEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml#getPersistenceUnitDefaultsForXml <em>Persistence Unit Defaults For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Persistence Unit Defaults For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml#getPersistenceUnitDefaultsForXml()
- * @see #getPersistenceUnitMetadataForXml()
- * @generated
- */
- public EReference getPersistenceUnitMetadataForXml_PersistenceUnitDefaultsForXml() {
- return (EReference) persistenceUnitMetadataForXmlEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal <em>Persistence Unit Defaults Internal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Persistence Unit Defaults Internal</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal
- * @generated
- */
- public EClass getPersistenceUnitDefaultsInternal() {
- return persistenceUnitDefaultsInternalEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getSchemaInternal <em>Schema Internal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Schema Internal</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getSchemaInternal()
- * @see #getPersistenceUnitDefaultsInternal()
- * @generated
- */
- public EAttribute getPersistenceUnitDefaultsInternal_SchemaInternal() {
- return (EAttribute) persistenceUnitDefaultsInternalEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getCatalogInternal <em>Catalog Internal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Catalog Internal</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getCatalogInternal()
- * @see #getPersistenceUnitDefaultsInternal()
- * @generated
- */
- public EAttribute getPersistenceUnitDefaultsInternal_CatalogInternal() {
- return (EAttribute) persistenceUnitDefaultsInternalEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getAccessInternal <em>Access Internal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Access Internal</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getAccessInternal()
- * @see #getPersistenceUnitDefaultsInternal()
- * @generated
- */
- public EAttribute getPersistenceUnitDefaultsInternal_AccessInternal() {
- return (EAttribute) persistenceUnitDefaultsInternalEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#isCascadePersistInternal <em>Cascade Persist Internal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Cascade Persist Internal</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#isCascadePersistInternal()
- * @see #getPersistenceUnitDefaultsInternal()
- * @generated
- */
- public EAttribute getPersistenceUnitDefaultsInternal_CascadePersistInternal() {
- return (EAttribute) persistenceUnitDefaultsInternalEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults <em>Persistence Unit Defaults</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Persistence Unit Defaults</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults
- * @generated
- */
- public EClass getPersistenceUnitDefaults() {
- return persistenceUnitDefaultsEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults#getSchema <em>Schema</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Schema</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults#getSchema()
- * @see #getPersistenceUnitDefaults()
- * @generated
- */
- public EAttribute getPersistenceUnitDefaults_Schema() {
- return (EAttribute) persistenceUnitDefaultsEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults#getCatalog <em>Catalog</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Catalog</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults#getCatalog()
- * @see #getPersistenceUnitDefaults()
- * @generated
- */
- public EAttribute getPersistenceUnitDefaults_Catalog() {
- return (EAttribute) persistenceUnitDefaultsEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults#getAccess <em>Access</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Access</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults#getAccess()
- * @see #getPersistenceUnitDefaults()
- * @generated
- */
- public EAttribute getPersistenceUnitDefaults_Access() {
- return (EAttribute) persistenceUnitDefaultsEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults#isCascadePersist <em>Cascade Persist</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Cascade Persist</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults#isCascadePersist()
- * @see #getPersistenceUnitDefaults()
- * @generated
- */
- public EAttribute getPersistenceUnitDefaults_CascadePersist() {
- return (EAttribute) persistenceUnitDefaultsEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml <em>Persistence Unit Defaults For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Persistence Unit Defaults For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml
- * @generated
- */
- public EClass getPersistenceUnitDefaultsForXml() {
- return persistenceUnitDefaultsForXmlEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml#getSchemaForXml <em>Schema For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Schema For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml#getSchemaForXml()
- * @see #getPersistenceUnitDefaultsForXml()
- * @generated
- */
- public EAttribute getPersistenceUnitDefaultsForXml_SchemaForXml() {
- return (EAttribute) persistenceUnitDefaultsForXmlEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml#getCatalogForXml <em>Catalog For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Catalog For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml#getCatalogForXml()
- * @see #getPersistenceUnitDefaultsForXml()
- * @generated
- */
- public EAttribute getPersistenceUnitDefaultsForXml_CatalogForXml() {
- return (EAttribute) persistenceUnitDefaultsForXmlEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml#getAccessForXml <em>Access For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Access For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml#getAccessForXml()
- * @see #getPersistenceUnitDefaultsForXml()
- * @generated
- */
- public EAttribute getPersistenceUnitDefaultsForXml_AccessForXml() {
- return (EAttribute) persistenceUnitDefaultsForXmlEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml#isCascadePersistForXml <em>Cascade Persist For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Cascade Persist For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml#isCascadePersistForXml()
- * @see #getPersistenceUnitDefaultsForXml()
- * @generated
- */
- public EAttribute getPersistenceUnitDefaultsForXml_CascadePersistForXml() {
- return (EAttribute) persistenceUnitDefaultsForXmlEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlTable <em>Xml Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Table</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTable
- * @generated
- */
- public EClass getXmlTable() {
- return xmlTableEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn <em>Abstract Xml Named Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Abstract Xml Named Column</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn
- * @generated
- */
- public EClass getAbstractXmlNamedColumn() {
- return abstractXmlNamedColumnEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn#getSpecifiedNameForXml <em>Specified Name For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Name For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn#getSpecifiedNameForXml()
- * @see #getAbstractXmlNamedColumn()
- * @generated
- */
- public EAttribute getAbstractXmlNamedColumn_SpecifiedNameForXml() {
- return (EAttribute) abstractXmlNamedColumnEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn#getColumnDefinitionForXml <em>Column Definition For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Column Definition For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn#getColumnDefinitionForXml()
- * @see #getAbstractXmlNamedColumn()
- * @generated
- */
- public EAttribute getAbstractXmlNamedColumn_ColumnDefinitionForXml() {
- return (EAttribute) abstractXmlNamedColumnEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn <em>Abstract Xml Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Abstract Xml Column</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn
- * @generated
- */
- public EClass getAbstractXmlColumn() {
- return abstractXmlColumnEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getUniqueForXml <em>Unique For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Unique For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getUniqueForXml()
- * @see #getAbstractXmlColumn()
- * @generated
- */
- public EAttribute getAbstractXmlColumn_UniqueForXml() {
- return (EAttribute) abstractXmlColumnEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getNullableForXml <em>Nullable For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Nullable For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getNullableForXml()
- * @see #getAbstractXmlColumn()
- * @generated
- */
- public EAttribute getAbstractXmlColumn_NullableForXml() {
- return (EAttribute) abstractXmlColumnEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getInsertableForXml <em>Insertable For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Insertable For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getInsertableForXml()
- * @see #getAbstractXmlColumn()
- * @generated
- */
- public EAttribute getAbstractXmlColumn_InsertableForXml() {
- return (EAttribute) abstractXmlColumnEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getUpdatableForXml <em>Updatable For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Updatable For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getUpdatableForXml()
- * @see #getAbstractXmlColumn()
- * @generated
- */
- public EAttribute getAbstractXmlColumn_UpdatableForXml() {
- return (EAttribute) abstractXmlColumnEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getSpecifiedTableForXml <em>Specified Table For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Table For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn#getSpecifiedTableForXml()
- * @see #getAbstractXmlColumn()
- * @generated
- */
- public EAttribute getAbstractXmlColumn_SpecifiedTableForXml() {
- return (EAttribute) abstractXmlColumnEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlColumn <em>Xml Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Column</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlColumn
- * @generated
- */
- public EClass getXmlColumn() {
- return xmlColumnEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.XmlColumn#getLengthForXml <em>Length For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Length For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlColumn#getLengthForXml()
- * @see #getXmlColumn()
- * @generated
- */
- public EAttribute getXmlColumn_LengthForXml() {
- return (EAttribute) xmlColumnEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.XmlColumn#getPrecisionForXml <em>Precision For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Precision For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlColumn#getPrecisionForXml()
- * @see #getXmlColumn()
- * @generated
- */
- public EAttribute getXmlColumn_PrecisionForXml() {
- return (EAttribute) xmlColumnEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.XmlColumn#getScaleForXml <em>Scale For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Scale For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlColumn#getScaleForXml()
- * @see #getXmlColumn()
- * @generated
- */
- public EAttribute getXmlColumn_ScaleForXml() {
- return (EAttribute) xmlColumnEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlJoinColumn <em>Xml Join Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Join Column</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlJoinColumn
- * @generated
- */
- public EClass getXmlJoinColumn() {
- return xmlJoinColumnEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.XmlJoinColumn#getSpecifiedReferencedColumnNameForXml <em>Specified Referenced Column Name For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Referenced Column Name For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlJoinColumn#getSpecifiedReferencedColumnNameForXml()
- * @see #getXmlJoinColumn()
- * @generated
- */
- public EAttribute getXmlJoinColumn_SpecifiedReferencedColumnNameForXml() {
- return (EAttribute) xmlJoinColumnEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.IXmlColumnMapping <em>IXml Column Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IXml Column Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.IXmlColumnMapping
- * @generated
- */
- public EClass getIXmlColumnMapping() {
- return iXmlColumnMappingEClass;
- }
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.jpt.core.internal.content.orm.IXmlColumnMapping#getColumnForXml <em>Column For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Column For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.IXmlColumnMapping#getColumnForXml()
- * @see #getIXmlColumnMapping()
- * @generated
- */
- public EReference getIXmlColumnMapping_ColumnForXml() {
- return (EReference) iXmlColumnMappingEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlManyToOne <em>Xml Many To One</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Many To One</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlManyToOne
- * @generated
- */
- public EClass getXmlManyToOne() {
- return xmlManyToOneEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlOneToOne <em>Xml One To One</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml One To One</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlOneToOne
- * @generated
- */
- public EClass getXmlOneToOne() {
- return xmlOneToOneEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlSingleRelationshipMapping <em>Xml Single Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Single Relationship Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlSingleRelationshipMapping
- * @generated
- */
- public EClass getXmlSingleRelationshipMapping() {
- return xmlSingleRelationshipMappingEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlRelationshipMapping <em>Xml Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Relationship Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlRelationshipMapping
- * @generated
- */
- public EClass getXmlRelationshipMapping() {
- return xmlRelationshipMappingEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlJoinTable <em>Xml Join Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Join Table</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlJoinTable
- * @generated
- */
- public EClass getXmlJoinTable() {
- return xmlJoinTableEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable <em>Abstract Xml Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Abstract Xml Table</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable
- * @generated
- */
- public EClass getAbstractXmlTable() {
- return abstractXmlTableEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable#getSpecifiedNameForXml <em>Specified Name For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Name For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable#getSpecifiedNameForXml()
- * @see #getAbstractXmlTable()
- * @generated
- */
- public EAttribute getAbstractXmlTable_SpecifiedNameForXml() {
- return (EAttribute) abstractXmlTableEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable#getSpecifiedCatalogForXml <em>Specified Catalog For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Catalog For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable#getSpecifiedCatalogForXml()
- * @see #getAbstractXmlTable()
- * @generated
- */
- public EAttribute getAbstractXmlTable_SpecifiedCatalogForXml() {
- return (EAttribute) abstractXmlTableEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable#getSpecifiedSchemaForXml <em>Specified Schema For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Schema For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable#getSpecifiedSchemaForXml()
- * @see #getAbstractXmlTable()
- * @generated
- */
- public EAttribute getAbstractXmlTable_SpecifiedSchemaForXml() {
- return (EAttribute) abstractXmlTableEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlOverride <em>Xml Override</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Override</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlOverride
- * @generated
- */
- public EClass getXmlOverride() {
- return xmlOverrideEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlAttributeOverride <em>Xml Attribute Override</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Attribute Override</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlAttributeOverride
- * @generated
- */
- public EClass getXmlAttributeOverride() {
- return xmlAttributeOverrideEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlAssociationOverride <em>Xml Association Override</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Association Override</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlAssociationOverride
- * @generated
- */
- public EClass getXmlAssociationOverride() {
- return xmlAssociationOverrideEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn <em>Xml Discriminator Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Discriminator Column</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn
- * @generated
- */
- public EClass getXmlDiscriminatorColumn() {
- return xmlDiscriminatorColumnEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn#getDiscriminatorTypeForXml <em>Discriminator Type For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Discriminator Type For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn#getDiscriminatorTypeForXml()
- * @see #getXmlDiscriminatorColumn()
- * @generated
- */
- public EAttribute getXmlDiscriminatorColumn_DiscriminatorTypeForXml() {
- return (EAttribute) xmlDiscriminatorColumnEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn#getSpecifiedLengthForXml <em>Specified Length For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Length For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn#getSpecifiedLengthForXml()
- * @see #getXmlDiscriminatorColumn()
- * @generated
- */
- public EAttribute getXmlDiscriminatorColumn_SpecifiedLengthForXml() {
- return (EAttribute) xmlDiscriminatorColumnEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlSecondaryTable <em>Xml Secondary Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Secondary Table</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlSecondaryTable
- * @generated
- */
- public EClass getXmlSecondaryTable() {
- return xmlSecondaryTableEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlPrimaryKeyJoinColumn <em>Xml Primary Key Join Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Primary Key Join Column</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPrimaryKeyJoinColumn
- * @generated
- */
- public EClass getXmlPrimaryKeyJoinColumn() {
- return xmlPrimaryKeyJoinColumnEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.XmlPrimaryKeyJoinColumn#getSpecifiedReferencedColumnNameForXml <em>Specified Referenced Column Name For Xml</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Referenced Column Name For Xml</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPrimaryKeyJoinColumn#getSpecifiedReferencedColumnNameForXml()
- * @see #getXmlPrimaryKeyJoinColumn()
- * @generated
- */
- public EAttribute getXmlPrimaryKeyJoinColumn_SpecifiedReferencedColumnNameForXml() {
- return (EAttribute) xmlPrimaryKeyJoinColumnEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlGeneratedValue <em>Xml Generated Value</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Generated Value</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlGeneratedValue
- * @generated
- */
- public EClass getXmlGeneratedValue() {
- return xmlGeneratedValueEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlGenerator <em>Xml Generator</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Generator</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlGenerator
- * @generated
- */
- public EClass getXmlGenerator() {
- return xmlGeneratorEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlSequenceGenerator <em>Xml Sequence Generator</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Sequence Generator</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlSequenceGenerator
- * @generated
- */
- public EClass getXmlSequenceGenerator() {
- return xmlSequenceGeneratorEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator <em>Xml Table Generator</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Table Generator</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator
- * @generated
- */
- public EClass getXmlTableGenerator() {
- return xmlTableGeneratorEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlQuery <em>Abstract Xml Query</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Abstract Xml Query</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlQuery
- * @generated
- */
- public EClass getAbstractXmlQuery() {
- return abstractXmlQueryEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlNamedQuery <em>Xml Named Query</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Named Query</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlNamedQuery
- * @generated
- */
- public EClass getXmlNamedQuery() {
- return xmlNamedQueryEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlNamedNativeQuery <em>Xml Named Native Query</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Named Native Query</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlNamedNativeQuery
- * @generated
- */
- public EClass getXmlNamedNativeQuery() {
- return xmlNamedNativeQueryEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlQueryHint <em>Xml Query Hint</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Query Hint</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlQueryHint
- * @generated
- */
- public EClass getXmlQueryHint() {
- return xmlQueryHintEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlUniqueConstraint <em>Xml Unique Constraint</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Unique Constraint</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlUniqueConstraint
- * @generated
- */
- public EClass getXmlUniqueConstraint() {
- return xmlUniqueConstraintEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlCascade <em>Xml Cascade</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Cascade</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlCascade
- * @generated
- */
- public EClass getXmlCascade() {
- return xmlCascadeEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlIdClass <em>Xml Id Class</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Id Class</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlIdClass
- * @generated
- */
- public EClass getXmlIdClass() {
- return xmlIdClassEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.XmlIdClass#getValue <em>Value</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Value</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlIdClass#getValue()
- * @see #getXmlIdClass()
- * @generated
- */
- public EAttribute getXmlIdClass_Value() {
- return (EAttribute) xmlIdClassEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlInheritance <em>Xml Inheritance</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Inheritance</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlInheritance
- * @generated
- */
- public EClass getXmlInheritance() {
- return xmlInheritanceEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.XmlInheritance#getStrategy <em>Strategy</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Strategy</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlInheritance#getStrategy()
- * @see #getXmlInheritance()
- * @generated
- */
- public EAttribute getXmlInheritance_Strategy() {
- return (EAttribute) xmlInheritanceEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.orm.XmlMapKey <em>Xml Map Key</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Map Key</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMapKey
- * @generated
- */
- public EClass getXmlMapKey() {
- return xmlMapKeyEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.orm.XmlMapKey#getName <em>Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Name</em>'.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMapKey#getName()
- * @see #getXmlMapKey()
- * @generated
- */
- public EAttribute getXmlMapKey_Name() {
- return (EAttribute) xmlMapKeyEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the factory that creates the instances of the model.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the factory that creates the instances of the model.
- * @generated
- */
- public OrmFactory getOrmFactory() {
- return (OrmFactory) getEFactoryInstance();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isCreated = false;
-
- /**
- * Creates the meta-model objects for the package. This method is
- * guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void createPackageContents() {
- if (isCreated)
- return;
- isCreated = true;
- // Create classes and their features
- xmlRootContentNodeEClass = createEClass(XML_ROOT_CONTENT_NODE);
- createEReference(xmlRootContentNodeEClass, XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS);
- entityMappingsInternalEClass = createEClass(ENTITY_MAPPINGS_INTERNAL);
- createEReference(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__ROOT);
- createEAttribute(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__VERSION);
- createEAttribute(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__DESCRIPTION);
- createEReference(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA_INTERNAL);
- createEAttribute(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__PACKAGE_INTERNAL);
- createEAttribute(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__DEFAULT_SCHEMA);
- createEAttribute(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__SPECIFIED_SCHEMA);
- createEAttribute(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__SCHEMA);
- createEAttribute(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__DEFAULT_CATALOG);
- createEAttribute(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__SPECIFIED_CATALOG);
- createEAttribute(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__CATALOG);
- createEAttribute(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__DEFAULT_ACCESS);
- createEAttribute(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__SPECIFIED_ACCESS);
- createEAttribute(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__ACCESS);
- createEReference(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__TYPE_MAPPINGS);
- createEReference(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__PERSISTENT_TYPES);
- createEReference(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__SEQUENCE_GENERATORS);
- createEReference(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__TABLE_GENERATORS);
- createEReference(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__NAMED_QUERIES);
- createEReference(entityMappingsInternalEClass, ENTITY_MAPPINGS_INTERNAL__NAMED_NATIVE_QUERIES);
- entityMappingsEClass = createEClass(ENTITY_MAPPINGS);
- createEReference(entityMappingsEClass, ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA);
- createEAttribute(entityMappingsEClass, ENTITY_MAPPINGS__PACKAGE);
- entityMappingsForXmlEClass = createEClass(ENTITY_MAPPINGS_FOR_XML);
- createEReference(entityMappingsForXmlEClass, ENTITY_MAPPINGS_FOR_XML__PERSISTENCE_UNIT_METADATA_FOR_XML);
- createEAttribute(entityMappingsForXmlEClass, ENTITY_MAPPINGS_FOR_XML__PACKAGE_FOR_XML);
- xmlTypeMappingEClass = createEClass(XML_TYPE_MAPPING);
- createEAttribute(xmlTypeMappingEClass, XML_TYPE_MAPPING__DEFAULT_ACCESS);
- createEAttribute(xmlTypeMappingEClass, XML_TYPE_MAPPING__SPECIFIED_ACCESS);
- createEAttribute(xmlTypeMappingEClass, XML_TYPE_MAPPING__ACCESS);
- createEAttribute(xmlTypeMappingEClass, XML_TYPE_MAPPING__METADATA_COMPLETE);
- createEReference(xmlTypeMappingEClass, XML_TYPE_MAPPING__PERSISTENT_TYPE);
- xmlPersistentTypeEClass = createEClass(XML_PERSISTENT_TYPE);
- createEAttribute(xmlPersistentTypeEClass, XML_PERSISTENT_TYPE__CLASS);
- createEReference(xmlPersistentTypeEClass, XML_PERSISTENT_TYPE__ATTRIBUTE_MAPPINGS);
- createEReference(xmlPersistentTypeEClass, XML_PERSISTENT_TYPE__SPECIFIED_ATTRIBUTE_MAPPINGS);
- createEReference(xmlPersistentTypeEClass, XML_PERSISTENT_TYPE__VIRTUAL_ATTRIBUTE_MAPPINGS);
- createEReference(xmlPersistentTypeEClass, XML_PERSISTENT_TYPE__PERSISTENT_ATTRIBUTES);
- createEReference(xmlPersistentTypeEClass, XML_PERSISTENT_TYPE__SPECIFIED_PERSISTENT_ATTRIBUTES);
- createEReference(xmlPersistentTypeEClass, XML_PERSISTENT_TYPE__VIRTUAL_PERSISTENT_ATTRIBUTES);
- xmlMappedSuperclassEClass = createEClass(XML_MAPPED_SUPERCLASS);
- createEReference(xmlMappedSuperclassEClass, XML_MAPPED_SUPERCLASS__ID_CLASS_FOR_XML);
- xmlEntityInternalEClass = createEClass(XML_ENTITY_INTERNAL);
- xmlEntityForXmlEClass = createEClass(XML_ENTITY_FOR_XML);
- createEReference(xmlEntityForXmlEClass, XML_ENTITY_FOR_XML__TABLE_FOR_XML);
- createEReference(xmlEntityForXmlEClass, XML_ENTITY_FOR_XML__DISCRIMINATOR_COLUMN_FOR_XML);
- createEReference(xmlEntityForXmlEClass, XML_ENTITY_FOR_XML__ID_CLASS_FOR_XML);
- createEReference(xmlEntityForXmlEClass, XML_ENTITY_FOR_XML__INHERITANCE_FOR_XML);
- xmlEntityEClass = createEClass(XML_ENTITY);
- createEReference(xmlEntityEClass, XML_ENTITY__SECONDARY_TABLES);
- createEReference(xmlEntityEClass, XML_ENTITY__VIRTUAL_SECONDARY_TABLES);
- xmlEmbeddableEClass = createEClass(XML_EMBEDDABLE);
- xmlAttributeMappingEClass = createEClass(XML_ATTRIBUTE_MAPPING);
- createEReference(xmlAttributeMappingEClass, XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE);
- xmlNullAttributeMappingEClass = createEClass(XML_NULL_ATTRIBUTE_MAPPING);
- xmlBasicEClass = createEClass(XML_BASIC);
- xmlIdEClass = createEClass(XML_ID);
- xmlTransientEClass = createEClass(XML_TRANSIENT);
- xmlEmbeddedEClass = createEClass(XML_EMBEDDED);
- xmlEmbeddedIdEClass = createEClass(XML_EMBEDDED_ID);
- xmlVersionEClass = createEClass(XML_VERSION);
- xmlMultiRelationshipMappingInternalEClass = createEClass(XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL);
- xmlMultiRelationshipMappingForXmlEClass = createEClass(XML_MULTI_RELATIONSHIP_MAPPING_FOR_XML);
- createEReference(xmlMultiRelationshipMappingForXmlEClass, XML_MULTI_RELATIONSHIP_MAPPING_FOR_XML__JOIN_TABLE_FOR_XML);
- createEReference(xmlMultiRelationshipMappingForXmlEClass, XML_MULTI_RELATIONSHIP_MAPPING_FOR_XML__MAP_KEY_FOR_XML);
- xmlMultiRelationshipMappingEClass = createEClass(XML_MULTI_RELATIONSHIP_MAPPING);
- xmlOneToManyEClass = createEClass(XML_ONE_TO_MANY);
- xmlManyToManyEClass = createEClass(XML_MANY_TO_MANY);
- xmlPersistentAttributeEClass = createEClass(XML_PERSISTENT_ATTRIBUTE);
- createEAttribute(xmlPersistentAttributeEClass, XML_PERSISTENT_ATTRIBUTE__NAME);
- persistenceUnitMetadataInternalEClass = createEClass(PERSISTENCE_UNIT_METADATA_INTERNAL);
- createEAttribute(persistenceUnitMetadataInternalEClass, PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_INTERNAL);
- createEReference(persistenceUnitMetadataInternalEClass, PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS_INTERNAL);
- persistenceUnitMetadataEClass = createEClass(PERSISTENCE_UNIT_METADATA);
- createEAttribute(persistenceUnitMetadataEClass, PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE);
- createEReference(persistenceUnitMetadataEClass, PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS);
- persistenceUnitMetadataForXmlEClass = createEClass(PERSISTENCE_UNIT_METADATA_FOR_XML);
- createEAttribute(persistenceUnitMetadataForXmlEClass, PERSISTENCE_UNIT_METADATA_FOR_XML__XML_MAPPING_METADATA_COMPLETE_FOR_XML);
- createEReference(persistenceUnitMetadataForXmlEClass, PERSISTENCE_UNIT_METADATA_FOR_XML__PERSISTENCE_UNIT_DEFAULTS_FOR_XML);
- persistenceUnitDefaultsInternalEClass = createEClass(PERSISTENCE_UNIT_DEFAULTS_INTERNAL);
- createEAttribute(persistenceUnitDefaultsInternalEClass, PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_INTERNAL);
- createEAttribute(persistenceUnitDefaultsInternalEClass, PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_INTERNAL);
- createEAttribute(persistenceUnitDefaultsInternalEClass, PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_INTERNAL);
- createEAttribute(persistenceUnitDefaultsInternalEClass, PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_INTERNAL);
- persistenceUnitDefaultsEClass = createEClass(PERSISTENCE_UNIT_DEFAULTS);
- createEAttribute(persistenceUnitDefaultsEClass, PERSISTENCE_UNIT_DEFAULTS__SCHEMA);
- createEAttribute(persistenceUnitDefaultsEClass, PERSISTENCE_UNIT_DEFAULTS__CATALOG);
- createEAttribute(persistenceUnitDefaultsEClass, PERSISTENCE_UNIT_DEFAULTS__ACCESS);
- createEAttribute(persistenceUnitDefaultsEClass, PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST);
- persistenceUnitDefaultsForXmlEClass = createEClass(PERSISTENCE_UNIT_DEFAULTS_FOR_XML);
- createEAttribute(persistenceUnitDefaultsForXmlEClass, PERSISTENCE_UNIT_DEFAULTS_FOR_XML__SCHEMA_FOR_XML);
- createEAttribute(persistenceUnitDefaultsForXmlEClass, PERSISTENCE_UNIT_DEFAULTS_FOR_XML__CATALOG_FOR_XML);
- createEAttribute(persistenceUnitDefaultsForXmlEClass, PERSISTENCE_UNIT_DEFAULTS_FOR_XML__ACCESS_FOR_XML);
- createEAttribute(persistenceUnitDefaultsForXmlEClass, PERSISTENCE_UNIT_DEFAULTS_FOR_XML__CASCADE_PERSIST_FOR_XML);
- xmlTableEClass = createEClass(XML_TABLE);
- abstractXmlNamedColumnEClass = createEClass(ABSTRACT_XML_NAMED_COLUMN);
- createEAttribute(abstractXmlNamedColumnEClass, ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME_FOR_XML);
- createEAttribute(abstractXmlNamedColumnEClass, ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION_FOR_XML);
- abstractXmlColumnEClass = createEClass(ABSTRACT_XML_COLUMN);
- createEAttribute(abstractXmlColumnEClass, ABSTRACT_XML_COLUMN__UNIQUE_FOR_XML);
- createEAttribute(abstractXmlColumnEClass, ABSTRACT_XML_COLUMN__NULLABLE_FOR_XML);
- createEAttribute(abstractXmlColumnEClass, ABSTRACT_XML_COLUMN__INSERTABLE_FOR_XML);
- createEAttribute(abstractXmlColumnEClass, ABSTRACT_XML_COLUMN__UPDATABLE_FOR_XML);
- createEAttribute(abstractXmlColumnEClass, ABSTRACT_XML_COLUMN__SPECIFIED_TABLE_FOR_XML);
- xmlColumnEClass = createEClass(XML_COLUMN);
- createEAttribute(xmlColumnEClass, XML_COLUMN__LENGTH_FOR_XML);
- createEAttribute(xmlColumnEClass, XML_COLUMN__PRECISION_FOR_XML);
- createEAttribute(xmlColumnEClass, XML_COLUMN__SCALE_FOR_XML);
- xmlJoinColumnEClass = createEClass(XML_JOIN_COLUMN);
- createEAttribute(xmlJoinColumnEClass, XML_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML);
- iXmlColumnMappingEClass = createEClass(IXML_COLUMN_MAPPING);
- createEReference(iXmlColumnMappingEClass, IXML_COLUMN_MAPPING__COLUMN_FOR_XML);
- xmlManyToOneEClass = createEClass(XML_MANY_TO_ONE);
- xmlOneToOneEClass = createEClass(XML_ONE_TO_ONE);
- xmlSingleRelationshipMappingEClass = createEClass(XML_SINGLE_RELATIONSHIP_MAPPING);
- xmlRelationshipMappingEClass = createEClass(XML_RELATIONSHIP_MAPPING);
- xmlJoinTableEClass = createEClass(XML_JOIN_TABLE);
- abstractXmlTableEClass = createEClass(ABSTRACT_XML_TABLE);
- createEAttribute(abstractXmlTableEClass, ABSTRACT_XML_TABLE__SPECIFIED_NAME_FOR_XML);
- createEAttribute(abstractXmlTableEClass, ABSTRACT_XML_TABLE__SPECIFIED_CATALOG_FOR_XML);
- createEAttribute(abstractXmlTableEClass, ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA_FOR_XML);
- xmlOverrideEClass = createEClass(XML_OVERRIDE);
- xmlAttributeOverrideEClass = createEClass(XML_ATTRIBUTE_OVERRIDE);
- xmlAssociationOverrideEClass = createEClass(XML_ASSOCIATION_OVERRIDE);
- xmlDiscriminatorColumnEClass = createEClass(XML_DISCRIMINATOR_COLUMN);
- createEAttribute(xmlDiscriminatorColumnEClass, XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE_FOR_XML);
- createEAttribute(xmlDiscriminatorColumnEClass, XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH_FOR_XML);
- xmlSecondaryTableEClass = createEClass(XML_SECONDARY_TABLE);
- xmlPrimaryKeyJoinColumnEClass = createEClass(XML_PRIMARY_KEY_JOIN_COLUMN);
- createEAttribute(xmlPrimaryKeyJoinColumnEClass, XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML);
- xmlGeneratedValueEClass = createEClass(XML_GENERATED_VALUE);
- xmlGeneratorEClass = createEClass(XML_GENERATOR);
- xmlSequenceGeneratorEClass = createEClass(XML_SEQUENCE_GENERATOR);
- xmlTableGeneratorEClass = createEClass(XML_TABLE_GENERATOR);
- abstractXmlQueryEClass = createEClass(ABSTRACT_XML_QUERY);
- xmlNamedQueryEClass = createEClass(XML_NAMED_QUERY);
- xmlNamedNativeQueryEClass = createEClass(XML_NAMED_NATIVE_QUERY);
- xmlQueryHintEClass = createEClass(XML_QUERY_HINT);
- xmlUniqueConstraintEClass = createEClass(XML_UNIQUE_CONSTRAINT);
- xmlCascadeEClass = createEClass(XML_CASCADE);
- xmlIdClassEClass = createEClass(XML_ID_CLASS);
- createEAttribute(xmlIdClassEClass, XML_ID_CLASS__VALUE);
- xmlInheritanceEClass = createEClass(XML_INHERITANCE);
- createEAttribute(xmlInheritanceEClass, XML_INHERITANCE__STRATEGY);
- xmlMapKeyEClass = createEClass(XML_MAP_KEY);
- createEAttribute(xmlMapKeyEClass, XML_MAP_KEY__NAME);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isInitialized = false;
-
- /**
- * Complete the initialization of the package and its meta-model. This
- * method is guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void initializePackageContents() {
- if (isInitialized)
- return;
- isInitialized = true;
- // Initialize package
- setName(eNAME);
- setNsPrefix(eNS_PREFIX);
- setNsURI(eNS_URI);
- // Obtain other dependent packages
- JpaCorePackage theJpaCorePackage = (JpaCorePackage) EPackage.Registry.INSTANCE.getEPackage(JpaCorePackage.eNS_URI);
- JpaCoreMappingsPackage theJpaCoreMappingsPackage = (JpaCoreMappingsPackage) EPackage.Registry.INSTANCE.getEPackage(JpaCoreMappingsPackage.eNS_URI);
- EcorePackage theEcorePackage = (EcorePackage) EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
- // Create type parameters
- // Set bounds for type parameters
- // Add supertypes to classes
- xmlRootContentNodeEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- xmlRootContentNodeEClass.getESuperTypes().add(theJpaCorePackage.getIJpaRootContentNode());
- entityMappingsInternalEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- entityMappingsInternalEClass.getESuperTypes().add(theJpaCorePackage.getIJpaContentNode());
- entityMappingsInternalEClass.getESuperTypes().add(this.getEntityMappingsForXml());
- entityMappingsInternalEClass.getESuperTypes().add(this.getEntityMappings());
- xmlTypeMappingEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- xmlTypeMappingEClass.getESuperTypes().add(theJpaCorePackage.getITypeMapping());
- xmlPersistentTypeEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- xmlPersistentTypeEClass.getESuperTypes().add(theJpaCorePackage.getIPersistentType());
- xmlMappedSuperclassEClass.getESuperTypes().add(this.getXmlTypeMapping());
- xmlMappedSuperclassEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIMappedSuperclass());
- xmlEntityInternalEClass.getESuperTypes().add(this.getXmlTypeMapping());
- xmlEntityInternalEClass.getESuperTypes().add(this.getXmlEntityForXml());
- xmlEntityInternalEClass.getESuperTypes().add(this.getXmlEntity());
- xmlEntityEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIEntity());
- xmlEmbeddableEClass.getESuperTypes().add(this.getXmlTypeMapping());
- xmlEmbeddableEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIEmbeddable());
- xmlAttributeMappingEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- xmlAttributeMappingEClass.getESuperTypes().add(theJpaCorePackage.getIAttributeMapping());
- xmlNullAttributeMappingEClass.getESuperTypes().add(this.getXmlAttributeMapping());
- xmlBasicEClass.getESuperTypes().add(this.getXmlAttributeMapping());
- xmlBasicEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIBasic());
- xmlBasicEClass.getESuperTypes().add(this.getIXmlColumnMapping());
- xmlIdEClass.getESuperTypes().add(this.getXmlAttributeMapping());
- xmlIdEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIId());
- xmlIdEClass.getESuperTypes().add(this.getIXmlColumnMapping());
- xmlTransientEClass.getESuperTypes().add(this.getXmlAttributeMapping());
- xmlTransientEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getITransient());
- xmlEmbeddedEClass.getESuperTypes().add(this.getXmlAttributeMapping());
- xmlEmbeddedEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIEmbedded());
- xmlEmbeddedIdEClass.getESuperTypes().add(this.getXmlAttributeMapping());
- xmlEmbeddedIdEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIEmbeddedId());
- xmlVersionEClass.getESuperTypes().add(this.getXmlAttributeMapping());
- xmlVersionEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIVersion());
- xmlVersionEClass.getESuperTypes().add(this.getIXmlColumnMapping());
- xmlMultiRelationshipMappingInternalEClass.getESuperTypes().add(this.getXmlRelationshipMapping());
- xmlMultiRelationshipMappingInternalEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIMultiRelationshipMapping());
- xmlMultiRelationshipMappingInternalEClass.getESuperTypes().add(this.getXmlMultiRelationshipMappingForXml());
- xmlMultiRelationshipMappingInternalEClass.getESuperTypes().add(this.getXmlMultiRelationshipMapping());
- xmlMultiRelationshipMappingEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIMultiRelationshipMapping());
- xmlOneToManyEClass.getESuperTypes().add(this.getXmlMultiRelationshipMappingInternal());
- xmlOneToManyEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIOneToMany());
- xmlManyToManyEClass.getESuperTypes().add(this.getXmlMultiRelationshipMappingInternal());
- xmlManyToManyEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIManyToMany());
- xmlPersistentAttributeEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- xmlPersistentAttributeEClass.getESuperTypes().add(theJpaCorePackage.getIPersistentAttribute());
- persistenceUnitMetadataInternalEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- persistenceUnitMetadataInternalEClass.getESuperTypes().add(this.getPersistenceUnitMetadataForXml());
- persistenceUnitMetadataInternalEClass.getESuperTypes().add(this.getPersistenceUnitMetadata());
- persistenceUnitMetadataEClass.getESuperTypes().add(theJpaCorePackage.getIXmlEObject());
- persistenceUnitMetadataForXmlEClass.getESuperTypes().add(theJpaCorePackage.getIXmlEObject());
- persistenceUnitDefaultsInternalEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- persistenceUnitDefaultsInternalEClass.getESuperTypes().add(this.getPersistenceUnitDefaults());
- persistenceUnitDefaultsInternalEClass.getESuperTypes().add(this.getPersistenceUnitDefaultsForXml());
- persistenceUnitDefaultsEClass.getESuperTypes().add(theJpaCorePackage.getIXmlEObject());
- persistenceUnitDefaultsForXmlEClass.getESuperTypes().add(theJpaCorePackage.getIXmlEObject());
- xmlTableEClass.getESuperTypes().add(this.getAbstractXmlTable());
- xmlTableEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getITable());
- abstractXmlNamedColumnEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- abstractXmlNamedColumnEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getINamedColumn());
- abstractXmlColumnEClass.getESuperTypes().add(this.getAbstractXmlNamedColumn());
- abstractXmlColumnEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIAbstractColumn());
- xmlColumnEClass.getESuperTypes().add(this.getAbstractXmlColumn());
- xmlColumnEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIColumn());
- xmlJoinColumnEClass.getESuperTypes().add(this.getAbstractXmlColumn());
- xmlJoinColumnEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIJoinColumn());
- iXmlColumnMappingEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIColumnMapping());
- xmlManyToOneEClass.getESuperTypes().add(this.getXmlSingleRelationshipMapping());
- xmlManyToOneEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIManyToOne());
- xmlOneToOneEClass.getESuperTypes().add(this.getXmlSingleRelationshipMapping());
- xmlOneToOneEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIOneToOne());
- xmlSingleRelationshipMappingEClass.getESuperTypes().add(this.getXmlRelationshipMapping());
- xmlSingleRelationshipMappingEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getISingleRelationshipMapping());
- xmlRelationshipMappingEClass.getESuperTypes().add(this.getXmlAttributeMapping());
- xmlRelationshipMappingEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIRelationshipMapping());
- xmlJoinTableEClass.getESuperTypes().add(this.getAbstractXmlTable());
- xmlJoinTableEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIJoinTable());
- abstractXmlTableEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- abstractXmlTableEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getITable());
- xmlOverrideEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- xmlOverrideEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIOverride());
- xmlAttributeOverrideEClass.getESuperTypes().add(this.getXmlOverride());
- xmlAttributeOverrideEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIAttributeOverride());
- xmlAttributeOverrideEClass.getESuperTypes().add(this.getIXmlColumnMapping());
- xmlAssociationOverrideEClass.getESuperTypes().add(this.getXmlOverride());
- xmlAssociationOverrideEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIAssociationOverride());
- xmlDiscriminatorColumnEClass.getESuperTypes().add(this.getAbstractXmlNamedColumn());
- xmlDiscriminatorColumnEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIDiscriminatorColumn());
- xmlSecondaryTableEClass.getESuperTypes().add(this.getAbstractXmlTable());
- xmlSecondaryTableEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getISecondaryTable());
- xmlPrimaryKeyJoinColumnEClass.getESuperTypes().add(this.getAbstractXmlNamedColumn());
- xmlPrimaryKeyJoinColumnEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIPrimaryKeyJoinColumn());
- xmlGeneratedValueEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- xmlGeneratedValueEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIGeneratedValue());
- xmlGeneratorEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- xmlGeneratorEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIGenerator());
- xmlSequenceGeneratorEClass.getESuperTypes().add(this.getXmlGenerator());
- xmlSequenceGeneratorEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getISequenceGenerator());
- xmlTableGeneratorEClass.getESuperTypes().add(this.getXmlGenerator());
- xmlTableGeneratorEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getITableGenerator());
- abstractXmlQueryEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- abstractXmlQueryEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIQuery());
- xmlNamedQueryEClass.getESuperTypes().add(this.getAbstractXmlQuery());
- xmlNamedQueryEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getINamedQuery());
- xmlNamedNativeQueryEClass.getESuperTypes().add(this.getAbstractXmlQuery());
- xmlNamedNativeQueryEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getINamedNativeQuery());
- xmlQueryHintEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- xmlQueryHintEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIQueryHint());
- xmlUniqueConstraintEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- xmlUniqueConstraintEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getIUniqueConstraint());
- xmlCascadeEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- xmlCascadeEClass.getESuperTypes().add(theJpaCoreMappingsPackage.getICascade());
- xmlIdClassEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- xmlInheritanceEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- xmlMapKeyEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- // Initialize classes and features; add operations and parameters
- initEClass(xmlRootContentNodeEClass, XmlRootContentNode.class, "XmlRootContentNode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getXmlRootContentNode_EntityMappings(), this.getEntityMappingsInternal(), this.getEntityMappingsInternal_Root(), "entityMappings", null, 1, 1, XmlRootContentNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
- initEClass(entityMappingsInternalEClass, EntityMappingsInternal.class, "EntityMappingsInternal", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getEntityMappingsInternal_Root(), this.getXmlRootContentNode(), this.getXmlRootContentNode_EntityMappings(), "root", null, 1, 1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
- initEAttribute(getEntityMappingsInternal_Version(), ecorePackage.getEString(), "version", null, 0, 1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getEntityMappingsInternal_Description(), ecorePackage.getEString(), "description", null, 0, 1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getEntityMappingsInternal_PersistenceUnitMetadataInternal(), this.getPersistenceUnitMetadataInternal(), null, "persistenceUnitMetadataInternal", null, 1, 1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getEntityMappingsInternal_PackageInternal(), ecorePackage.getEString(), "packageInternal", null, 0, 1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getEntityMappingsInternal_DefaultSchema(), ecorePackage.getEString(), "defaultSchema", null, 0, 1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getEntityMappingsInternal_SpecifiedSchema(), ecorePackage.getEString(), "specifiedSchema", null, 0, 1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getEntityMappingsInternal_Schema(), ecorePackage.getEString(), "schema", null, 0, 1, EntityMappingsInternal.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getEntityMappingsInternal_DefaultCatalog(), ecorePackage.getEString(), "defaultCatalog", null, 0, 1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getEntityMappingsInternal_SpecifiedCatalog(), ecorePackage.getEString(), "specifiedCatalog", null, 0, 1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getEntityMappingsInternal_Catalog(), ecorePackage.getEString(), "catalog", null, 0, 1, EntityMappingsInternal.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getEntityMappingsInternal_DefaultAccess(), theJpaCorePackage.getAccessType(), "defaultAccess", null, 0, 1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getEntityMappingsInternal_SpecifiedAccess(), theJpaCorePackage.getAccessType(), "specifiedAccess", null, 0, 1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getEntityMappingsInternal_Access(), theJpaCorePackage.getAccessType(), "access", null, 0, 1, EntityMappingsInternal.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getEntityMappingsInternal_TypeMappings(), this.getXmlTypeMapping(), null, "typeMappings", null, 0, -1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getEntityMappingsInternal_PersistentTypes(), this.getXmlPersistentType(), null, "persistentTypes", null, 0, -1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getEntityMappingsInternal_SequenceGenerators(), this.getXmlSequenceGenerator(), null, "sequenceGenerators", null, 0, -1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getEntityMappingsInternal_TableGenerators(), this.getXmlTableGenerator(), null, "tableGenerators", null, 0, -1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getEntityMappingsInternal_NamedQueries(), this.getXmlNamedQuery(), null, "namedQueries", null, 0, -1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getEntityMappingsInternal_NamedNativeQueries(), this.getXmlNamedNativeQuery(), null, "namedNativeQueries", null, 0, -1, EntityMappingsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(entityMappingsEClass, EntityMappings.class, "EntityMappings", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getEntityMappings_PersistenceUnitMetadata(), this.getPersistenceUnitMetadata(), null, "persistenceUnitMetadata", null, 0, 1, EntityMappings.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getEntityMappings_Package(), ecorePackage.getEString(), "package", null, 0, 1, EntityMappings.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(entityMappingsForXmlEClass, EntityMappingsForXml.class, "EntityMappingsForXml", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getEntityMappingsForXml_PersistenceUnitMetadataForXml(), this.getPersistenceUnitMetadataForXml(), null, "persistenceUnitMetadataForXml", null, 0, 1, EntityMappingsForXml.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getEntityMappingsForXml_PackageForXml(), ecorePackage.getEString(), "packageForXml", null, 0, 1, EntityMappingsForXml.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(xmlTypeMappingEClass, XmlTypeMapping.class, "XmlTypeMapping", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getXmlTypeMapping_DefaultAccess(), theJpaCorePackage.getAccessType(), "defaultAccess", null, 0, 1, XmlTypeMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getXmlTypeMapping_SpecifiedAccess(), theJpaCorePackage.getAccessType(), "specifiedAccess", null, 0, 1, XmlTypeMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getXmlTypeMapping_Access(), theJpaCorePackage.getAccessType(), "access", null, 0, 1, XmlTypeMapping.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getXmlTypeMapping_MetadataComplete(), theJpaCoreMappingsPackage.getDefaultFalseBoolean(), "metadataComplete", null, 0, 1, XmlTypeMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getXmlTypeMapping_PersistentType(), this.getXmlPersistentType(), null, "persistentType", null, 1, 1, XmlTypeMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(xmlPersistentTypeEClass, XmlPersistentType.class, "XmlPersistentType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getXmlPersistentType_Class(), theEcorePackage.getEString(), "class", null, 0, 1, XmlPersistentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getXmlPersistentType_AttributeMappings(), this.getXmlAttributeMapping(), null, "attributeMappings", null, 0, -1, XmlPersistentType.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getXmlPersistentType_SpecifiedAttributeMappings(), this.getXmlAttributeMapping(), null, "specifiedAttributeMappings", null, 0, -1, XmlPersistentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getXmlPersistentType_VirtualAttributeMappings(), this.getXmlAttributeMapping(), null, "virtualAttributeMappings", null, 0, -1, XmlPersistentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getXmlPersistentType_PersistentAttributes(), this.getXmlPersistentAttribute(), null, "persistentAttributes", null, 0, -1, XmlPersistentType.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getXmlPersistentType_SpecifiedPersistentAttributes(), this.getXmlPersistentAttribute(), null, "specifiedPersistentAttributes", null, 0, -1, XmlPersistentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getXmlPersistentType_VirtualPersistentAttributes(), this.getXmlPersistentAttribute(), null, "virtualPersistentAttributes", null, 0, -1, XmlPersistentType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(xmlMappedSuperclassEClass, XmlMappedSuperclass.class, "XmlMappedSuperclass", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getXmlMappedSuperclass_IdClassForXml(), this.getXmlIdClass(), null, "idClassForXml", null, 0, 1, XmlMappedSuperclass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(xmlEntityInternalEClass, XmlEntityInternal.class, "XmlEntityInternal", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlEntityForXmlEClass, XmlEntityForXml.class, "XmlEntityForXml", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getXmlEntityForXml_TableForXml(), this.getXmlTable(), null, "tableForXml", null, 0, 1, XmlEntityForXml.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getXmlEntityForXml_DiscriminatorColumnForXml(), this.getXmlDiscriminatorColumn(), null, "discriminatorColumnForXml", null, 0, 1, XmlEntityForXml.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getXmlEntityForXml_IdClassForXml(), this.getXmlIdClass(), null, "idClassForXml", null, 0, 1, XmlEntityForXml.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getXmlEntityForXml_InheritanceForXml(), this.getXmlInheritance(), null, "inheritanceForXml", null, 0, 1, XmlEntityForXml.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(xmlEntityEClass, XmlEntity.class, "XmlEntity", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getXmlEntity_SecondaryTables(), theJpaCoreMappingsPackage.getISecondaryTable(), null, "secondaryTables", null, 0, -1, XmlEntity.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getXmlEntity_VirtualSecondaryTables(), theJpaCoreMappingsPackage.getISecondaryTable(), null, "virtualSecondaryTables", null, 0, -1, XmlEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(xmlEmbeddableEClass, XmlEmbeddable.class, "XmlEmbeddable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlAttributeMappingEClass, XmlAttributeMapping.class, "XmlAttributeMapping", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getXmlAttributeMapping_PersistentAttribute(), this.getXmlPersistentAttribute(), null, "persistentAttribute", null, 1, 1, XmlAttributeMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(xmlNullAttributeMappingEClass, XmlNullAttributeMapping.class, "XmlNullAttributeMapping", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlBasicEClass, XmlBasic.class, "XmlBasic", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlIdEClass, XmlId.class, "XmlId", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlTransientEClass, XmlTransient.class, "XmlTransient", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlEmbeddedEClass, XmlEmbedded.class, "XmlEmbedded", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlEmbeddedIdEClass, XmlEmbeddedId.class, "XmlEmbeddedId", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlVersionEClass, XmlVersion.class, "XmlVersion", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlMultiRelationshipMappingInternalEClass, XmlMultiRelationshipMappingInternal.class, "XmlMultiRelationshipMappingInternal", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlMultiRelationshipMappingForXmlEClass, XmlMultiRelationshipMappingForXml.class, "XmlMultiRelationshipMappingForXml", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getXmlMultiRelationshipMappingForXml_JoinTableForXml(), this.getXmlJoinTable(), null, "joinTableForXml", null, 0, 1, XmlMultiRelationshipMappingForXml.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getXmlMultiRelationshipMappingForXml_MapKeyForXml(), this.getXmlMapKey(), null, "mapKeyForXml", null, 0, 1, XmlMultiRelationshipMappingForXml.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(xmlMultiRelationshipMappingEClass, XmlMultiRelationshipMapping.class, "XmlMultiRelationshipMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlOneToManyEClass, XmlOneToMany.class, "XmlOneToMany", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlManyToManyEClass, XmlManyToMany.class, "XmlManyToMany", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlPersistentAttributeEClass, XmlPersistentAttribute.class, "XmlPersistentAttribute", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getXmlPersistentAttribute_Name(), ecorePackage.getEString(), "name", null, 0, 1, XmlPersistentAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(persistenceUnitMetadataInternalEClass, PersistenceUnitMetadataInternal.class, "PersistenceUnitMetadataInternal", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getPersistenceUnitMetadataInternal_XmlMappingMetadataCompleteInternal(), ecorePackage.getEBoolean(), "xmlMappingMetadataCompleteInternal", null, 0, 1, PersistenceUnitMetadataInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getPersistenceUnitMetadataInternal_PersistenceUnitDefaultsInternal(), this.getPersistenceUnitDefaultsInternal(), null, "persistenceUnitDefaultsInternal", null, 1, 1, PersistenceUnitMetadataInternal.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(persistenceUnitMetadataEClass, PersistenceUnitMetadata.class, "PersistenceUnitMetadata", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getPersistenceUnitMetadata_XmlMappingMetadataComplete(), ecorePackage.getEBoolean(), "xmlMappingMetadataComplete", null, 0, 1, PersistenceUnitMetadata.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getPersistenceUnitMetadata_PersistenceUnitDefaults(), this.getPersistenceUnitDefaults(), null, "persistenceUnitDefaults", null, 0, 1, PersistenceUnitMetadata.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(persistenceUnitMetadataForXmlEClass, PersistenceUnitMetadataForXml.class, "PersistenceUnitMetadataForXml", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getPersistenceUnitMetadataForXml_XmlMappingMetadataCompleteForXml(), ecorePackage.getEBoolean(), "xmlMappingMetadataCompleteForXml", null, 0, 1, PersistenceUnitMetadataForXml.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getPersistenceUnitMetadataForXml_PersistenceUnitDefaultsForXml(), this.getPersistenceUnitDefaultsForXml(), null, "persistenceUnitDefaultsForXml", null, 0, 1, PersistenceUnitMetadataForXml.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(persistenceUnitDefaultsInternalEClass, PersistenceUnitDefaultsInternal.class, "PersistenceUnitDefaultsInternal", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getPersistenceUnitDefaultsInternal_SchemaInternal(), ecorePackage.getEString(), "schemaInternal", null, 0, 1, PersistenceUnitDefaultsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistenceUnitDefaultsInternal_CatalogInternal(), ecorePackage.getEString(), "catalogInternal", null, 0, 1, PersistenceUnitDefaultsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistenceUnitDefaultsInternal_AccessInternal(), theJpaCorePackage.getAccessType(), "accessInternal", null, 0, 1, PersistenceUnitDefaultsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistenceUnitDefaultsInternal_CascadePersistInternal(), ecorePackage.getEBoolean(), "cascadePersistInternal", null, 0, 1, PersistenceUnitDefaultsInternal.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(persistenceUnitDefaultsEClass, PersistenceUnitDefaults.class, "PersistenceUnitDefaults", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getPersistenceUnitDefaults_Schema(), ecorePackage.getEString(), "schema", null, 0, 1, PersistenceUnitDefaults.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistenceUnitDefaults_Catalog(), ecorePackage.getEString(), "catalog", null, 0, 1, PersistenceUnitDefaults.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistenceUnitDefaults_Access(), theJpaCorePackage.getAccessType(), "access", null, 0, 1, PersistenceUnitDefaults.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistenceUnitDefaults_CascadePersist(), ecorePackage.getEBoolean(), "cascadePersist", null, 0, 1, PersistenceUnitDefaults.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(persistenceUnitDefaultsForXmlEClass, PersistenceUnitDefaultsForXml.class, "PersistenceUnitDefaultsForXml", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getPersistenceUnitDefaultsForXml_SchemaForXml(), ecorePackage.getEString(), "schemaForXml", null, 0, 1, PersistenceUnitDefaultsForXml.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistenceUnitDefaultsForXml_CatalogForXml(), ecorePackage.getEString(), "catalogForXml", null, 0, 1, PersistenceUnitDefaultsForXml.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistenceUnitDefaultsForXml_AccessForXml(), theJpaCorePackage.getAccessType(), "accessForXml", null, 0, 1, PersistenceUnitDefaultsForXml.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistenceUnitDefaultsForXml_CascadePersistForXml(), ecorePackage.getEBoolean(), "cascadePersistForXml", null, 0, 1, PersistenceUnitDefaultsForXml.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(xmlTableEClass, XmlTable.class, "XmlTable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(abstractXmlNamedColumnEClass, AbstractXmlNamedColumn.class, "AbstractXmlNamedColumn", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getAbstractXmlNamedColumn_SpecifiedNameForXml(), ecorePackage.getEString(), "specifiedNameForXml", null, 0, 1, AbstractXmlNamedColumn.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getAbstractXmlNamedColumn_ColumnDefinitionForXml(), ecorePackage.getEString(), "columnDefinitionForXml", null, 0, 1, AbstractXmlNamedColumn.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(abstractXmlColumnEClass, AbstractXmlColumn.class, "AbstractXmlColumn", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getAbstractXmlColumn_UniqueForXml(), theJpaCoreMappingsPackage.getDefaultFalseBoolean(), "uniqueForXml", null, 0, 1, AbstractXmlColumn.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getAbstractXmlColumn_NullableForXml(), theJpaCoreMappingsPackage.getDefaultTrueBoolean(), "nullableForXml", null, 0, 1, AbstractXmlColumn.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getAbstractXmlColumn_InsertableForXml(), theJpaCoreMappingsPackage.getDefaultTrueBoolean(), "insertableForXml", null, 0, 1, AbstractXmlColumn.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getAbstractXmlColumn_UpdatableForXml(), theJpaCoreMappingsPackage.getDefaultTrueBoolean(), "updatableForXml", null, 0, 1, AbstractXmlColumn.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getAbstractXmlColumn_SpecifiedTableForXml(), ecorePackage.getEString(), "specifiedTableForXml", null, 0, 1, AbstractXmlColumn.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(xmlColumnEClass, XmlColumn.class, "XmlColumn", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getXmlColumn_LengthForXml(), ecorePackage.getEInt(), "lengthForXml", "255", 0, 1, XmlColumn.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getXmlColumn_PrecisionForXml(), ecorePackage.getEInt(), "precisionForXml", null, 0, 1, XmlColumn.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getXmlColumn_ScaleForXml(), ecorePackage.getEInt(), "scaleForXml", null, 0, 1, XmlColumn.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(xmlJoinColumnEClass, XmlJoinColumn.class, "XmlJoinColumn", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getXmlJoinColumn_SpecifiedReferencedColumnNameForXml(), ecorePackage.getEString(), "specifiedReferencedColumnNameForXml", null, 0, 1, XmlJoinColumn.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iXmlColumnMappingEClass, IXmlColumnMapping.class, "IXmlColumnMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getIXmlColumnMapping_ColumnForXml(), this.getXmlColumn(), null, "columnForXml", null, 0, 1, IXmlColumnMapping.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- addEOperation(iXmlColumnMappingEClass, null, "makeColumnForXmlNonNull", 0, 1, IS_UNIQUE, IS_ORDERED);
- addEOperation(iXmlColumnMappingEClass, null, "makeColumnForXmlNull", 0, 1, IS_UNIQUE, IS_ORDERED);
- initEClass(xmlManyToOneEClass, XmlManyToOne.class, "XmlManyToOne", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlOneToOneEClass, XmlOneToOne.class, "XmlOneToOne", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlSingleRelationshipMappingEClass, XmlSingleRelationshipMapping.class, "XmlSingleRelationshipMapping", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlRelationshipMappingEClass, XmlRelationshipMapping.class, "XmlRelationshipMapping", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlJoinTableEClass, XmlJoinTable.class, "XmlJoinTable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(abstractXmlTableEClass, AbstractXmlTable.class, "AbstractXmlTable", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getAbstractXmlTable_SpecifiedNameForXml(), ecorePackage.getEString(), "specifiedNameForXml", null, 0, 1, AbstractXmlTable.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getAbstractXmlTable_SpecifiedCatalogForXml(), ecorePackage.getEString(), "specifiedCatalogForXml", null, 0, 1, AbstractXmlTable.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getAbstractXmlTable_SpecifiedSchemaForXml(), ecorePackage.getEString(), "specifiedSchemaForXml", null, 0, 1, AbstractXmlTable.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(xmlOverrideEClass, XmlOverride.class, "XmlOverride", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlAttributeOverrideEClass, XmlAttributeOverride.class, "XmlAttributeOverride", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlAssociationOverrideEClass, XmlAssociationOverride.class, "XmlAssociationOverride", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlDiscriminatorColumnEClass, XmlDiscriminatorColumn.class, "XmlDiscriminatorColumn", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getXmlDiscriminatorColumn_DiscriminatorTypeForXml(), theJpaCoreMappingsPackage.getDiscriminatorType(), "discriminatorTypeForXml", null, 0, 1, XmlDiscriminatorColumn.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getXmlDiscriminatorColumn_SpecifiedLengthForXml(), theEcorePackage.getEInt(), "specifiedLengthForXml", "-1", 0, 1, XmlDiscriminatorColumn.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(xmlSecondaryTableEClass, XmlSecondaryTable.class, "XmlSecondaryTable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlPrimaryKeyJoinColumnEClass, XmlPrimaryKeyJoinColumn.class, "XmlPrimaryKeyJoinColumn", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getXmlPrimaryKeyJoinColumn_SpecifiedReferencedColumnNameForXml(), ecorePackage.getEString(), "specifiedReferencedColumnNameForXml", null, 0, 1, XmlPrimaryKeyJoinColumn.class, !IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(xmlGeneratedValueEClass, XmlGeneratedValue.class, "XmlGeneratedValue", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlGeneratorEClass, XmlGenerator.class, "XmlGenerator", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlSequenceGeneratorEClass, XmlSequenceGenerator.class, "XmlSequenceGenerator", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlTableGeneratorEClass, XmlTableGenerator.class, "XmlTableGenerator", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(abstractXmlQueryEClass, AbstractXmlQuery.class, "AbstractXmlQuery", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlNamedQueryEClass, XmlNamedQuery.class, "XmlNamedQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlNamedNativeQueryEClass, XmlNamedNativeQuery.class, "XmlNamedNativeQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlQueryHintEClass, XmlQueryHint.class, "XmlQueryHint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlUniqueConstraintEClass, XmlUniqueConstraint.class, "XmlUniqueConstraint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlCascadeEClass, XmlCascade.class, "XmlCascade", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(xmlIdClassEClass, XmlIdClass.class, "XmlIdClass", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getXmlIdClass_Value(), theEcorePackage.getEString(), "value", null, 0, 1, XmlIdClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(xmlInheritanceEClass, XmlInheritance.class, "XmlInheritance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getXmlInheritance_Strategy(), theJpaCoreMappingsPackage.getInheritanceType(), "strategy", null, 0, 1, XmlInheritance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(xmlMapKeyEClass, XmlMapKey.class, "XmlMapKey", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getXmlMapKey_Name(), ecorePackage.getEString(), "name", null, 0, 1, XmlMapKey.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- // Create resource
- createResource(eNS_URI);
- }
-
-
- /**
- * <!-- begin-user-doc -->
- * Defines literals for the meta objects that represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @generated
- */
- public interface Literals
- {
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode <em>Xml Root Content Node</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlRootContentNode()
- * @generated
- */
- public static final EClass XML_ROOT_CONTENT_NODE = eINSTANCE.getXmlRootContentNode();
-
- /**
- * The meta object literal for the '<em><b>Entity Mappings</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS = eINSTANCE.getXmlRootContentNode_EntityMappings();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal <em>Entity Mappings Internal</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsInternal()
- * @generated
- */
- public static final EClass ENTITY_MAPPINGS_INTERNAL = eINSTANCE.getEntityMappingsInternal();
-
- /**
- * The meta object literal for the '<em><b>Root</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ENTITY_MAPPINGS_INTERNAL__ROOT = eINSTANCE.getEntityMappingsInternal_Root();
-
- /**
- * The meta object literal for the '<em><b>Version</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ENTITY_MAPPINGS_INTERNAL__VERSION = eINSTANCE.getEntityMappingsInternal_Version();
-
- /**
- * The meta object literal for the '<em><b>Description</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ENTITY_MAPPINGS_INTERNAL__DESCRIPTION = eINSTANCE.getEntityMappingsInternal_Description();
-
- /**
- * The meta object literal for the '<em><b>Persistence Unit Metadata Internal</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ENTITY_MAPPINGS_INTERNAL__PERSISTENCE_UNIT_METADATA_INTERNAL = eINSTANCE.getEntityMappingsInternal_PersistenceUnitMetadataInternal();
-
- /**
- * The meta object literal for the '<em><b>Package Internal</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ENTITY_MAPPINGS_INTERNAL__PACKAGE_INTERNAL = eINSTANCE.getEntityMappingsInternal_PackageInternal();
-
- /**
- * The meta object literal for the '<em><b>Default Schema</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ENTITY_MAPPINGS_INTERNAL__DEFAULT_SCHEMA = eINSTANCE.getEntityMappingsInternal_DefaultSchema();
-
- /**
- * The meta object literal for the '<em><b>Specified Schema</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ENTITY_MAPPINGS_INTERNAL__SPECIFIED_SCHEMA = eINSTANCE.getEntityMappingsInternal_SpecifiedSchema();
-
- /**
- * The meta object literal for the '<em><b>Schema</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ENTITY_MAPPINGS_INTERNAL__SCHEMA = eINSTANCE.getEntityMappingsInternal_Schema();
-
- /**
- * The meta object literal for the '<em><b>Default Catalog</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ENTITY_MAPPINGS_INTERNAL__DEFAULT_CATALOG = eINSTANCE.getEntityMappingsInternal_DefaultCatalog();
-
- /**
- * The meta object literal for the '<em><b>Specified Catalog</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ENTITY_MAPPINGS_INTERNAL__SPECIFIED_CATALOG = eINSTANCE.getEntityMappingsInternal_SpecifiedCatalog();
-
- /**
- * The meta object literal for the '<em><b>Catalog</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ENTITY_MAPPINGS_INTERNAL__CATALOG = eINSTANCE.getEntityMappingsInternal_Catalog();
-
- /**
- * The meta object literal for the '<em><b>Default Access</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ENTITY_MAPPINGS_INTERNAL__DEFAULT_ACCESS = eINSTANCE.getEntityMappingsInternal_DefaultAccess();
-
- /**
- * The meta object literal for the '<em><b>Specified Access</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ENTITY_MAPPINGS_INTERNAL__SPECIFIED_ACCESS = eINSTANCE.getEntityMappingsInternal_SpecifiedAccess();
-
- /**
- * The meta object literal for the '<em><b>Access</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ENTITY_MAPPINGS_INTERNAL__ACCESS = eINSTANCE.getEntityMappingsInternal_Access();
-
- /**
- * The meta object literal for the '<em><b>Type Mappings</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ENTITY_MAPPINGS_INTERNAL__TYPE_MAPPINGS = eINSTANCE.getEntityMappingsInternal_TypeMappings();
-
- /**
- * The meta object literal for the '<em><b>Persistent Types</b></em>' reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ENTITY_MAPPINGS_INTERNAL__PERSISTENT_TYPES = eINSTANCE.getEntityMappingsInternal_PersistentTypes();
-
- /**
- * The meta object literal for the '<em><b>Sequence Generators</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ENTITY_MAPPINGS_INTERNAL__SEQUENCE_GENERATORS = eINSTANCE.getEntityMappingsInternal_SequenceGenerators();
-
- /**
- * The meta object literal for the '<em><b>Table Generators</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ENTITY_MAPPINGS_INTERNAL__TABLE_GENERATORS = eINSTANCE.getEntityMappingsInternal_TableGenerators();
-
- /**
- * The meta object literal for the '<em><b>Named Queries</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ENTITY_MAPPINGS_INTERNAL__NAMED_QUERIES = eINSTANCE.getEntityMappingsInternal_NamedQueries();
-
- /**
- * The meta object literal for the '<em><b>Named Native Queries</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ENTITY_MAPPINGS_INTERNAL__NAMED_NATIVE_QUERIES = eINSTANCE.getEntityMappingsInternal_NamedNativeQueries();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappings <em>Entity Mappings</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappings
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappings()
- * @generated
- */
- public static final EClass ENTITY_MAPPINGS = eINSTANCE.getEntityMappings();
-
- /**
- * The meta object literal for the '<em><b>Persistence Unit Metadata</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA = eINSTANCE.getEntityMappings_PersistenceUnitMetadata();
-
- /**
- * The meta object literal for the '<em><b>Package</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ENTITY_MAPPINGS__PACKAGE = eINSTANCE.getEntityMappings_Package();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml <em>Entity Mappings For Xml</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getEntityMappingsForXml()
- * @generated
- */
- public static final EClass ENTITY_MAPPINGS_FOR_XML = eINSTANCE.getEntityMappingsForXml();
-
- /**
- * The meta object literal for the '<em><b>Persistence Unit Metadata For Xml</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ENTITY_MAPPINGS_FOR_XML__PERSISTENCE_UNIT_METADATA_FOR_XML = eINSTANCE.getEntityMappingsForXml_PersistenceUnitMetadataForXml();
-
- /**
- * The meta object literal for the '<em><b>Package For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ENTITY_MAPPINGS_FOR_XML__PACKAGE_FOR_XML = eINSTANCE.getEntityMappingsForXml_PackageForXml();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping <em>Xml Type Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTypeMapping()
- * @generated
- */
- public static final EClass XML_TYPE_MAPPING = eINSTANCE.getXmlTypeMapping();
-
- /**
- * The meta object literal for the '<em><b>Default Access</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_TYPE_MAPPING__DEFAULT_ACCESS = eINSTANCE.getXmlTypeMapping_DefaultAccess();
-
- /**
- * The meta object literal for the '<em><b>Specified Access</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_TYPE_MAPPING__SPECIFIED_ACCESS = eINSTANCE.getXmlTypeMapping_SpecifiedAccess();
-
- /**
- * The meta object literal for the '<em><b>Access</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_TYPE_MAPPING__ACCESS = eINSTANCE.getXmlTypeMapping_Access();
-
- /**
- * The meta object literal for the '<em><b>Metadata Complete</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_TYPE_MAPPING__METADATA_COMPLETE = eINSTANCE.getXmlTypeMapping_MetadataComplete();
-
- /**
- * The meta object literal for the '<em><b>Persistent Type</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_TYPE_MAPPING__PERSISTENT_TYPE = eINSTANCE.getXmlTypeMapping_PersistentType();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType <em>Xml Persistent Type</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPersistentType
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPersistentType()
- * @generated
- */
- public static final EClass XML_PERSISTENT_TYPE = eINSTANCE.getXmlPersistentType();
-
- /**
- * The meta object literal for the '<em><b>Class</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_PERSISTENT_TYPE__CLASS = eINSTANCE.getXmlPersistentType_Class();
-
- /**
- * The meta object literal for the '<em><b>Attribute Mappings</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_PERSISTENT_TYPE__ATTRIBUTE_MAPPINGS = eINSTANCE.getXmlPersistentType_AttributeMappings();
-
- /**
- * The meta object literal for the '<em><b>Specified Attribute Mappings</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_PERSISTENT_TYPE__SPECIFIED_ATTRIBUTE_MAPPINGS = eINSTANCE.getXmlPersistentType_SpecifiedAttributeMappings();
-
- /**
- * The meta object literal for the '<em><b>Virtual Attribute Mappings</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_PERSISTENT_TYPE__VIRTUAL_ATTRIBUTE_MAPPINGS = eINSTANCE.getXmlPersistentType_VirtualAttributeMappings();
-
- /**
- * The meta object literal for the '<em><b>Persistent Attributes</b></em>' reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_PERSISTENT_TYPE__PERSISTENT_ATTRIBUTES = eINSTANCE.getXmlPersistentType_PersistentAttributes();
-
- /**
- * The meta object literal for the '<em><b>Specified Persistent Attributes</b></em>' reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_PERSISTENT_TYPE__SPECIFIED_PERSISTENT_ATTRIBUTES = eINSTANCE.getXmlPersistentType_SpecifiedPersistentAttributes();
-
- /**
- * The meta object literal for the '<em><b>Virtual Persistent Attributes</b></em>' reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_PERSISTENT_TYPE__VIRTUAL_PERSISTENT_ATTRIBUTES = eINSTANCE.getXmlPersistentType_VirtualPersistentAttributes();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass <em>Xml Mapped Superclass</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMappedSuperclass()
- * @generated
- */
- public static final EClass XML_MAPPED_SUPERCLASS = eINSTANCE.getXmlMappedSuperclass();
-
- /**
- * The meta object literal for the '<em><b>Id Class For Xml</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_MAPPED_SUPERCLASS__ID_CLASS_FOR_XML = eINSTANCE.getXmlMappedSuperclass_IdClassForXml();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal <em>Xml Entity Internal</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntityInternal()
- * @generated
- */
- public static final EClass XML_ENTITY_INTERNAL = eINSTANCE.getXmlEntityInternal();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml <em>Xml Entity For Xml</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntityForXml()
- * @generated
- */
- public static final EClass XML_ENTITY_FOR_XML = eINSTANCE.getXmlEntityForXml();
-
- /**
- * The meta object literal for the '<em><b>Table For Xml</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_ENTITY_FOR_XML__TABLE_FOR_XML = eINSTANCE.getXmlEntityForXml_TableForXml();
-
- /**
- * The meta object literal for the '<em><b>Discriminator Column For Xml</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_ENTITY_FOR_XML__DISCRIMINATOR_COLUMN_FOR_XML = eINSTANCE.getXmlEntityForXml_DiscriminatorColumnForXml();
-
- /**
- * The meta object literal for the '<em><b>Id Class For Xml</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_ENTITY_FOR_XML__ID_CLASS_FOR_XML = eINSTANCE.getXmlEntityForXml_IdClassForXml();
-
- /**
- * The meta object literal for the '<em><b>Inheritance For Xml</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_ENTITY_FOR_XML__INHERITANCE_FOR_XML = eINSTANCE.getXmlEntityForXml_InheritanceForXml();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntity <em>Xml Entity</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntity
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntity()
- * @generated
- */
- public static final EClass XML_ENTITY = eINSTANCE.getXmlEntity();
-
- /**
- * The meta object literal for the '<em><b>Secondary Tables</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_ENTITY__SECONDARY_TABLES = eINSTANCE.getXmlEntity_SecondaryTables();
-
- /**
- * The meta object literal for the '<em><b>Virtual Secondary Tables</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_ENTITY__VIRTUAL_SECONDARY_TABLES = eINSTANCE.getXmlEntity_VirtualSecondaryTables();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEmbeddable <em>Xml Embeddable</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEmbeddable
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEmbeddable()
- * @generated
- */
- public static final EClass XML_EMBEDDABLE = eINSTANCE.getXmlEmbeddable();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping <em>Xml Attribute Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlAttributeMapping()
- * @generated
- */
- public static final EClass XML_ATTRIBUTE_MAPPING = eINSTANCE.getXmlAttributeMapping();
-
- /**
- * The meta object literal for the '<em><b>Persistent Attribute</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE = eINSTANCE.getXmlAttributeMapping_PersistentAttribute();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlNullAttributeMapping <em>Xml Null Attribute Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlNullAttributeMapping
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlNullAttributeMapping()
- * @generated
- */
- public static final EClass XML_NULL_ATTRIBUTE_MAPPING = eINSTANCE.getXmlNullAttributeMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlBasic <em>Xml Basic</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlBasic
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlBasic()
- * @generated
- */
- public static final EClass XML_BASIC = eINSTANCE.getXmlBasic();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlId <em>Xml Id</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlId
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlId()
- * @generated
- */
- public static final EClass XML_ID = eINSTANCE.getXmlId();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTransient <em>Xml Transient</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTransient
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTransient()
- * @generated
- */
- public static final EClass XML_TRANSIENT = eINSTANCE.getXmlTransient();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEmbedded <em>Xml Embedded</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEmbedded
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEmbedded()
- * @generated
- */
- public static final EClass XML_EMBEDDED = eINSTANCE.getXmlEmbedded();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEmbeddedId <em>Xml Embedded Id</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEmbeddedId
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEmbeddedId()
- * @generated
- */
- public static final EClass XML_EMBEDDED_ID = eINSTANCE.getXmlEmbeddedId();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlVersion <em>Xml Version</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlVersion
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlVersion()
- * @generated
- */
- public static final EClass XML_VERSION = eINSTANCE.getXmlVersion();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal <em>Xml Multi Relationship Mapping Internal</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMultiRelationshipMappingInternal()
- * @generated
- */
- public static final EClass XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL = eINSTANCE.getXmlMultiRelationshipMappingInternal();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml <em>Xml Multi Relationship Mapping For Xml</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMultiRelationshipMappingForXml()
- * @generated
- */
- public static final EClass XML_MULTI_RELATIONSHIP_MAPPING_FOR_XML = eINSTANCE.getXmlMultiRelationshipMappingForXml();
-
- /**
- * The meta object literal for the '<em><b>Join Table For Xml</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_MULTI_RELATIONSHIP_MAPPING_FOR_XML__JOIN_TABLE_FOR_XML = eINSTANCE.getXmlMultiRelationshipMappingForXml_JoinTableForXml();
-
- /**
- * The meta object literal for the '<em><b>Map Key For Xml</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference XML_MULTI_RELATIONSHIP_MAPPING_FOR_XML__MAP_KEY_FOR_XML = eINSTANCE.getXmlMultiRelationshipMappingForXml_MapKeyForXml();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMapping <em>Xml Multi Relationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMapping
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMultiRelationshipMapping()
- * @generated
- */
- public static final EClass XML_MULTI_RELATIONSHIP_MAPPING = eINSTANCE.getXmlMultiRelationshipMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlOneToMany <em>Xml One To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlOneToMany
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlOneToMany()
- * @generated
- */
- public static final EClass XML_ONE_TO_MANY = eINSTANCE.getXmlOneToMany();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlManyToMany <em>Xml Many To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlManyToMany
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlManyToMany()
- * @generated
- */
- public static final EClass XML_MANY_TO_MANY = eINSTANCE.getXmlManyToMany();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute <em>Xml Persistent Attribute</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPersistentAttribute()
- * @generated
- */
- public static final EClass XML_PERSISTENT_ATTRIBUTE = eINSTANCE.getXmlPersistentAttribute();
-
- /**
- * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_PERSISTENT_ATTRIBUTE__NAME = eINSTANCE.getXmlPersistentAttribute_Name();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal <em>Persistence Unit Metadata Internal</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadataInternal()
- * @generated
- */
- public static final EClass PERSISTENCE_UNIT_METADATA_INTERNAL = eINSTANCE.getPersistenceUnitMetadataInternal();
-
- /**
- * The meta object literal for the '<em><b>Xml Mapping Metadata Complete Internal</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_INTERNAL = eINSTANCE.getPersistenceUnitMetadataInternal_XmlMappingMetadataCompleteInternal();
-
- /**
- * The meta object literal for the '<em><b>Persistence Unit Defaults Internal</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS_INTERNAL = eINSTANCE.getPersistenceUnitMetadataInternal_PersistenceUnitDefaultsInternal();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata <em>Persistence Unit Metadata</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadata()
- * @generated
- */
- public static final EClass PERSISTENCE_UNIT_METADATA = eINSTANCE.getPersistenceUnitMetadata();
-
- /**
- * The meta object literal for the '<em><b>Xml Mapping Metadata Complete</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE = eINSTANCE.getPersistenceUnitMetadata_XmlMappingMetadataComplete();
-
- /**
- * The meta object literal for the '<em><b>Persistence Unit Defaults</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS = eINSTANCE.getPersistenceUnitMetadata_PersistenceUnitDefaults();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml <em>Persistence Unit Metadata For Xml</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadataForXml()
- * @generated
- */
- public static final EClass PERSISTENCE_UNIT_METADATA_FOR_XML = eINSTANCE.getPersistenceUnitMetadataForXml();
-
- /**
- * The meta object literal for the '<em><b>Xml Mapping Metadata Complete For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT_METADATA_FOR_XML__XML_MAPPING_METADATA_COMPLETE_FOR_XML = eINSTANCE.getPersistenceUnitMetadataForXml_XmlMappingMetadataCompleteForXml();
-
- /**
- * The meta object literal for the '<em><b>Persistence Unit Defaults For Xml</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference PERSISTENCE_UNIT_METADATA_FOR_XML__PERSISTENCE_UNIT_DEFAULTS_FOR_XML = eINSTANCE.getPersistenceUnitMetadataForXml_PersistenceUnitDefaultsForXml();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal <em>Persistence Unit Defaults Internal</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsInternal()
- * @generated
- */
- public static final EClass PERSISTENCE_UNIT_DEFAULTS_INTERNAL = eINSTANCE.getPersistenceUnitDefaultsInternal();
-
- /**
- * The meta object literal for the '<em><b>Schema Internal</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_INTERNAL = eINSTANCE.getPersistenceUnitDefaultsInternal_SchemaInternal();
-
- /**
- * The meta object literal for the '<em><b>Catalog Internal</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_INTERNAL = eINSTANCE.getPersistenceUnitDefaultsInternal_CatalogInternal();
-
- /**
- * The meta object literal for the '<em><b>Access Internal</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_INTERNAL = eINSTANCE.getPersistenceUnitDefaultsInternal_AccessInternal();
-
- /**
- * The meta object literal for the '<em><b>Cascade Persist Internal</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_INTERNAL = eINSTANCE.getPersistenceUnitDefaultsInternal_CascadePersistInternal();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults <em>Persistence Unit Defaults</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaults()
- * @generated
- */
- public static final EClass PERSISTENCE_UNIT_DEFAULTS = eINSTANCE.getPersistenceUnitDefaults();
-
- /**
- * The meta object literal for the '<em><b>Schema</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT_DEFAULTS__SCHEMA = eINSTANCE.getPersistenceUnitDefaults_Schema();
-
- /**
- * The meta object literal for the '<em><b>Catalog</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT_DEFAULTS__CATALOG = eINSTANCE.getPersistenceUnitDefaults_Catalog();
-
- /**
- * The meta object literal for the '<em><b>Access</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT_DEFAULTS__ACCESS = eINSTANCE.getPersistenceUnitDefaults_Access();
-
- /**
- * The meta object literal for the '<em><b>Cascade Persist</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST = eINSTANCE.getPersistenceUnitDefaults_CascadePersist();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml <em>Persistence Unit Defaults For Xml</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsForXml()
- * @generated
- */
- public static final EClass PERSISTENCE_UNIT_DEFAULTS_FOR_XML = eINSTANCE.getPersistenceUnitDefaultsForXml();
-
- /**
- * The meta object literal for the '<em><b>Schema For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT_DEFAULTS_FOR_XML__SCHEMA_FOR_XML = eINSTANCE.getPersistenceUnitDefaultsForXml_SchemaForXml();
-
- /**
- * The meta object literal for the '<em><b>Catalog For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT_DEFAULTS_FOR_XML__CATALOG_FOR_XML = eINSTANCE.getPersistenceUnitDefaultsForXml_CatalogForXml();
-
- /**
- * The meta object literal for the '<em><b>Access For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT_DEFAULTS_FOR_XML__ACCESS_FOR_XML = eINSTANCE.getPersistenceUnitDefaultsForXml_AccessForXml();
-
- /**
- * The meta object literal for the '<em><b>Cascade Persist For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT_DEFAULTS_FOR_XML__CASCADE_PERSIST_FOR_XML = eINSTANCE.getPersistenceUnitDefaultsForXml_CascadePersistForXml();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTable <em>Xml Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTable
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTable()
- * @generated
- */
- public static final EClass XML_TABLE = eINSTANCE.getXmlTable();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn <em>Abstract Xml Named Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlNamedColumn()
- * @generated
- */
- public static final EClass ABSTRACT_XML_NAMED_COLUMN = eINSTANCE.getAbstractXmlNamedColumn();
-
- /**
- * The meta object literal for the '<em><b>Specified Name For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ABSTRACT_XML_NAMED_COLUMN__SPECIFIED_NAME_FOR_XML = eINSTANCE.getAbstractXmlNamedColumn_SpecifiedNameForXml();
-
- /**
- * The meta object literal for the '<em><b>Column Definition For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ABSTRACT_XML_NAMED_COLUMN__COLUMN_DEFINITION_FOR_XML = eINSTANCE.getAbstractXmlNamedColumn_ColumnDefinitionForXml();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn <em>Abstract Xml Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlColumn()
- * @generated
- */
- public static final EClass ABSTRACT_XML_COLUMN = eINSTANCE.getAbstractXmlColumn();
-
- /**
- * The meta object literal for the '<em><b>Unique For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ABSTRACT_XML_COLUMN__UNIQUE_FOR_XML = eINSTANCE.getAbstractXmlColumn_UniqueForXml();
-
- /**
- * The meta object literal for the '<em><b>Nullable For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ABSTRACT_XML_COLUMN__NULLABLE_FOR_XML = eINSTANCE.getAbstractXmlColumn_NullableForXml();
-
- /**
- * The meta object literal for the '<em><b>Insertable For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ABSTRACT_XML_COLUMN__INSERTABLE_FOR_XML = eINSTANCE.getAbstractXmlColumn_InsertableForXml();
-
- /**
- * The meta object literal for the '<em><b>Updatable For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ABSTRACT_XML_COLUMN__UPDATABLE_FOR_XML = eINSTANCE.getAbstractXmlColumn_UpdatableForXml();
-
- /**
- * The meta object literal for the '<em><b>Specified Table For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ABSTRACT_XML_COLUMN__SPECIFIED_TABLE_FOR_XML = eINSTANCE.getAbstractXmlColumn_SpecifiedTableForXml();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlColumn <em>Xml Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlColumn
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlColumn()
- * @generated
- */
- public static final EClass XML_COLUMN = eINSTANCE.getXmlColumn();
-
- /**
- * The meta object literal for the '<em><b>Length For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_COLUMN__LENGTH_FOR_XML = eINSTANCE.getXmlColumn_LengthForXml();
-
- /**
- * The meta object literal for the '<em><b>Precision For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_COLUMN__PRECISION_FOR_XML = eINSTANCE.getXmlColumn_PrecisionForXml();
-
- /**
- * The meta object literal for the '<em><b>Scale For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_COLUMN__SCALE_FOR_XML = eINSTANCE.getXmlColumn_ScaleForXml();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlJoinColumn <em>Xml Join Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlJoinColumn
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlJoinColumn()
- * @generated
- */
- public static final EClass XML_JOIN_COLUMN = eINSTANCE.getXmlJoinColumn();
-
- /**
- * The meta object literal for the '<em><b>Specified Referenced Column Name For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML = eINSTANCE.getXmlJoinColumn_SpecifiedReferencedColumnNameForXml();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.IXmlColumnMapping <em>IXml Column Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.IXmlColumnMapping
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIXmlColumnMapping()
- * @generated
- */
- public static final EClass IXML_COLUMN_MAPPING = eINSTANCE.getIXmlColumnMapping();
-
- /**
- * The meta object literal for the '<em><b>Column For Xml</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IXML_COLUMN_MAPPING__COLUMN_FOR_XML = eINSTANCE.getIXmlColumnMapping_ColumnForXml();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlManyToOne <em>Xml Many To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlManyToOne
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlManyToOne()
- * @generated
- */
- public static final EClass XML_MANY_TO_ONE = eINSTANCE.getXmlManyToOne();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlOneToOne <em>Xml One To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlOneToOne
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlOneToOne()
- * @generated
- */
- public static final EClass XML_ONE_TO_ONE = eINSTANCE.getXmlOneToOne();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlSingleRelationshipMapping <em>Xml Single Relationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlSingleRelationshipMapping
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlSingleRelationshipMapping()
- * @generated
- */
- public static final EClass XML_SINGLE_RELATIONSHIP_MAPPING = eINSTANCE.getXmlSingleRelationshipMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlRelationshipMapping <em>Xml Relationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlRelationshipMapping
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlRelationshipMapping()
- * @generated
- */
- public static final EClass XML_RELATIONSHIP_MAPPING = eINSTANCE.getXmlRelationshipMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlJoinTable <em>Xml Join Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlJoinTable
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlJoinTable()
- * @generated
- */
- public static final EClass XML_JOIN_TABLE = eINSTANCE.getXmlJoinTable();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable <em>Abstract Xml Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlTable()
- * @generated
- */
- public static final EClass ABSTRACT_XML_TABLE = eINSTANCE.getAbstractXmlTable();
-
- /**
- * The meta object literal for the '<em><b>Specified Name For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ABSTRACT_XML_TABLE__SPECIFIED_NAME_FOR_XML = eINSTANCE.getAbstractXmlTable_SpecifiedNameForXml();
-
- /**
- * The meta object literal for the '<em><b>Specified Catalog For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ABSTRACT_XML_TABLE__SPECIFIED_CATALOG_FOR_XML = eINSTANCE.getAbstractXmlTable_SpecifiedCatalogForXml();
-
- /**
- * The meta object literal for the '<em><b>Specified Schema For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ABSTRACT_XML_TABLE__SPECIFIED_SCHEMA_FOR_XML = eINSTANCE.getAbstractXmlTable_SpecifiedSchemaForXml();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlOverride <em>Xml Override</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlOverride
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlOverride()
- * @generated
- */
- public static final EClass XML_OVERRIDE = eINSTANCE.getXmlOverride();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlAttributeOverride <em>Xml Attribute Override</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlAttributeOverride
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlAttributeOverride()
- * @generated
- */
- public static final EClass XML_ATTRIBUTE_OVERRIDE = eINSTANCE.getXmlAttributeOverride();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlAssociationOverride <em>Xml Association Override</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlAssociationOverride
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlAssociationOverride()
- * @generated
- */
- public static final EClass XML_ASSOCIATION_OVERRIDE = eINSTANCE.getXmlAssociationOverride();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn <em>Xml Discriminator Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlDiscriminatorColumn()
- * @generated
- */
- public static final EClass XML_DISCRIMINATOR_COLUMN = eINSTANCE.getXmlDiscriminatorColumn();
-
- /**
- * The meta object literal for the '<em><b>Discriminator Type For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE_FOR_XML = eINSTANCE.getXmlDiscriminatorColumn_DiscriminatorTypeForXml();
-
- /**
- * The meta object literal for the '<em><b>Specified Length For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH_FOR_XML = eINSTANCE.getXmlDiscriminatorColumn_SpecifiedLengthForXml();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlSecondaryTable <em>Xml Secondary Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlSecondaryTable
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlSecondaryTable()
- * @generated
- */
- public static final EClass XML_SECONDARY_TABLE = eINSTANCE.getXmlSecondaryTable();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlPrimaryKeyJoinColumn <em>Xml Primary Key Join Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPrimaryKeyJoinColumn
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPrimaryKeyJoinColumn()
- * @generated
- */
- public static final EClass XML_PRIMARY_KEY_JOIN_COLUMN = eINSTANCE.getXmlPrimaryKeyJoinColumn();
-
- /**
- * The meta object literal for the '<em><b>Specified Referenced Column Name For Xml</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML = eINSTANCE.getXmlPrimaryKeyJoinColumn_SpecifiedReferencedColumnNameForXml();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlGeneratedValue <em>Xml Generated Value</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlGeneratedValue
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlGeneratedValue()
- * @generated
- */
- public static final EClass XML_GENERATED_VALUE = eINSTANCE.getXmlGeneratedValue();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlGenerator <em>Xml Generator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlGenerator
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlGenerator()
- * @generated
- */
- public static final EClass XML_GENERATOR = eINSTANCE.getXmlGenerator();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlSequenceGenerator <em>Xml Sequence Generator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlSequenceGenerator
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlSequenceGenerator()
- * @generated
- */
- public static final EClass XML_SEQUENCE_GENERATOR = eINSTANCE.getXmlSequenceGenerator();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator <em>Xml Table Generator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTableGenerator()
- * @generated
- */
- public static final EClass XML_TABLE_GENERATOR = eINSTANCE.getXmlTableGenerator();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlQuery <em>Abstract Xml Query</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlQuery
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlQuery()
- * @generated
- */
- public static final EClass ABSTRACT_XML_QUERY = eINSTANCE.getAbstractXmlQuery();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlNamedQuery <em>Xml Named Query</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlNamedQuery
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlNamedQuery()
- * @generated
- */
- public static final EClass XML_NAMED_QUERY = eINSTANCE.getXmlNamedQuery();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlNamedNativeQuery <em>Xml Named Native Query</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlNamedNativeQuery
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlNamedNativeQuery()
- * @generated
- */
- public static final EClass XML_NAMED_NATIVE_QUERY = eINSTANCE.getXmlNamedNativeQuery();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlQueryHint <em>Xml Query Hint</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlQueryHint
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlQueryHint()
- * @generated
- */
- public static final EClass XML_QUERY_HINT = eINSTANCE.getXmlQueryHint();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlUniqueConstraint <em>Xml Unique Constraint</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlUniqueConstraint
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlUniqueConstraint()
- * @generated
- */
- public static final EClass XML_UNIQUE_CONSTRAINT = eINSTANCE.getXmlUniqueConstraint();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlCascade <em>Xml Cascade</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlCascade
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlCascade()
- * @generated
- */
- public static final EClass XML_CASCADE = eINSTANCE.getXmlCascade();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlIdClass <em>Xml Id Class</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlIdClass
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlIdClass()
- * @generated
- */
- public static final EClass XML_ID_CLASS = eINSTANCE.getXmlIdClass();
-
- /**
- * The meta object literal for the '<em><b>Value</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_ID_CLASS__VALUE = eINSTANCE.getXmlIdClass_Value();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlInheritance <em>Xml Inheritance</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlInheritance
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlInheritance()
- * @generated
- */
- public static final EClass XML_INHERITANCE = eINSTANCE.getXmlInheritance();
-
- /**
- * The meta object literal for the '<em><b>Strategy</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_INHERITANCE__STRATEGY = eINSTANCE.getXmlInheritance_Strategy();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMapKey <em>Xml Map Key</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMapKey
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMapKey()
- * @generated
- */
- public static final EClass XML_MAP_KEY = eINSTANCE.getXmlMapKey();
-
- /**
- * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute XML_MAP_KEY__NAME = eINSTANCE.getXmlMapKey_Name();
- }
-} //OrmPackage
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmXmlJpaFileContentProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmXmlJpaFileContentProvider.java
deleted file mode 100644
index 021035921d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/OrmXmlJpaFileContentProvider.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import java.io.IOException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IJpaFileContentProvider;
-import org.eclipse.jpt.core.internal.IJpaRootContentNode;
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.core.internal.content.orm.resource.OrmArtifactEdit;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModelEvent;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModelListener;
-
-public class OrmXmlJpaFileContentProvider implements IJpaFileContentProvider
-{
- //singleton
- private static final OrmXmlJpaFileContentProvider INSTANCE = new OrmXmlJpaFileContentProvider();
-
-
- /**
- * Return the singleton.
- */
- public static IJpaFileContentProvider instance() {
- return INSTANCE;
- }
-
-
- /**
- * Restrict access
- */
- private OrmXmlJpaFileContentProvider() {
- super();
- }
-
- public IJpaRootContentNode buildRootContent(IJpaFile jpaFile) {
- IFile resourceFile = jpaFile.getFile();
- OrmArtifactEdit oae =
- OrmArtifactEdit.getArtifactEditForRead(resourceFile.getProject());
- OrmResource resource =
- oae.getOrmResource(resourceFile);
- oae.addListener(buildReloadListener(resource));
- XmlRootContentNode root = OrmFactory.eINSTANCE.createXmlRootContentNode();
- root.setArtifactEdit(oae);
- root.setEntityMappings(resource.getEntityMappings());
- resource.eAdapters().add(buildRootNodeListener(resourceFile, root));
- jpaFile.setContent(root);
- return root;
- }
-
- private Adapter buildRootNodeListener(IFile resourceFile, XmlRootContentNode root) {
- return new RootAdapter(resourceFile, root);
- }
-
- private EditModelListener buildReloadListener(OrmResource resource) {
- return new ReloadListener(resource);
- }
-
- public String contentType() {
- return JptCorePlugin.ORM_XML_CONTENT_TYPE;
- }
-
-
- private class RootAdapter extends AdapterImpl
- {
- final IFile resourceFile;
- final XmlRootContentNode rootContentNode;
-
- RootAdapter(IFile resourceFile, XmlRootContentNode rootContentNode) {
- super();
- this.resourceFile = resourceFile;
- this.rootContentNode = rootContentNode;
- }
- @Override
- public void notifyChanged(Notification notification) {
- int featureId = notification.getFeatureID(Resource.class);
- if (featureId == Resource.RESOURCE__CONTENTS) {
- if (notification.getEventType() == Notification.ADD
- || notification.getEventType() == Notification.REMOVE) {
- OrmResource resource = (OrmResource) notification.getNotifier();
- this.rootContentNode.setEntityMappings(resource.getEntityMappings());
- }
- }
- }
- }
-
-
- private class ReloadListener implements EditModelListener
- {
- final OrmResource resource;
-
- ReloadListener(OrmResource resource) {
- super();
- this.resource = resource;
- }
-
- public void editModelChanged(EditModelEvent anEvent) {
- switch (anEvent.getEventCode()) {
- case EditModelEvent.UNLOADED_RESOURCE :
- if (anEvent.getChangedResources().contains(resource)
- && ! resource.isLoaded()) {
- try {
- resource.load(resource.getResourceSet().getLoadOptions());
- }
- catch (IOException ioe) {
- JptCorePlugin.log(ioe);
- }
- }
- break;
- case EditModelEvent.REMOVED_RESOURCE :
- if (anEvent.getChangedResources().contains(resource)) {
- anEvent.getEditModel().removeListener(this);
- }
- break;
-// case EditModelEvent.SAVE :
-// case EditModelEvent.PRE_DISPOSE :
- }
-
- }
- // commenting out for now - this *was* a workaround for 202190, but with ArtifactEdit
- // usage, it no longer works
- //
- // 11/07/07 - Actually, it has now been replaced by the above code
-// else if (featureId == Resource.RESOURCE__IS_LOADED) {
-// if (file.exists()) {
-// // dumb translator is unloading my resource, reload it
-// if (notification.getNewBooleanValue() == false) {
-// PersistenceResource resource = (PersistenceResource) notification.getNotifier();
-// try {
-// resource.load(Collections.EMPTY_MAP);
-// }
-// catch (IOException ioe) {
-// // hmmm, log for now
-// JptCorePlugin.log(ioe);
-// }
-// }
-// }
-// }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitDefaults.java
deleted file mode 100644
index f1b6c44ade..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitDefaults.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.jpt.core.internal.AccessType;
-import org.eclipse.jpt.core.internal.IXmlEObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Persistence Unit Defaults</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults#getSchema <em>Schema</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults#getCatalog <em>Catalog</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults#getAccess <em>Access</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults#isCascadePersist <em>Cascade Persist</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaults()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface PersistenceUnitDefaults extends IXmlEObject
-{
- /**
- * Returns the value of the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Schema</em>' attribute.
- * @see #setSchema(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaults_Schema()
- * @model volatile="true"
- * @generated
- */
- String getSchema();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults#getSchema <em>Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Schema</em>' attribute.
- * @see #getSchema()
- * @generated
- */
- void setSchema(String value);
-
- /**
- * Returns the value of the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Catalog</em>' attribute.
- * @see #setCatalog(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaults_Catalog()
- * @model volatile="true"
- * @generated
- */
- String getCatalog();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults#getCatalog <em>Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Catalog</em>' attribute.
- * @see #getCatalog()
- * @generated
- */
- void setCatalog(String value);
-
- /**
- * Returns the value of the '<em><b>Access</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.AccessType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Access</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Access</em>' attribute.
- * @see org.eclipse.jpt.core.internal.AccessType
- * @see #setAccess(AccessType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaults_Access()
- * @model volatile="true"
- * @generated
- */
- AccessType getAccess();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults#getAccess <em>Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Access</em>' attribute.
- * @see org.eclipse.jpt.core.internal.AccessType
- * @see #getAccess()
- * @generated
- */
- void setAccess(AccessType value);
-
- /**
- * Returns the value of the '<em><b>Cascade Persist</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Cascade Persist</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Cascade Persist</em>' attribute.
- * @see #setCascadePersist(boolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaults_CascadePersist()
- * @model volatile="true"
- * @generated
- */
- boolean isCascadePersist();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults#isCascadePersist <em>Cascade Persist</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Cascade Persist</em>' attribute.
- * @see #isCascadePersist()
- * @generated
- */
- void setCascadePersist(boolean value);
-} // PersistenceUnitDefaults
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitDefaultsForXml.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitDefaultsForXml.java
deleted file mode 100644
index 81da952f89..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitDefaultsForXml.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.jpt.core.internal.AccessType;
-import org.eclipse.jpt.core.internal.IXmlEObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Persistence Unit Defaults For Xml</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml#getSchemaForXml <em>Schema For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml#getCatalogForXml <em>Catalog For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml#getAccessForXml <em>Access For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml#isCascadePersistForXml <em>Cascade Persist For Xml</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsForXml()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface PersistenceUnitDefaultsForXml extends IXmlEObject
-{
- /**
- * Returns the value of the '<em><b>Schema For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Schema For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Schema For Xml</em>' attribute.
- * @see #setSchemaForXml(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsForXml_SchemaForXml()
- * @model volatile="true"
- * @generated
- */
- String getSchemaForXml();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml#getSchemaForXml <em>Schema For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Schema For Xml</em>' attribute.
- * @see #getSchemaForXml()
- * @generated
- */
- void setSchemaForXml(String value);
-
- /**
- * Returns the value of the '<em><b>Catalog For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Catalog For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Catalog For Xml</em>' attribute.
- * @see #setCatalogForXml(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsForXml_CatalogForXml()
- * @model volatile="true"
- * @generated
- */
- String getCatalogForXml();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml#getCatalogForXml <em>Catalog For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Catalog For Xml</em>' attribute.
- * @see #getCatalogForXml()
- * @generated
- */
- void setCatalogForXml(String value);
-
- /**
- * Returns the value of the '<em><b>Access For Xml</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.AccessType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Access For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Access For Xml</em>' attribute.
- * @see org.eclipse.jpt.core.internal.AccessType
- * @see #setAccessForXml(AccessType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsForXml_AccessForXml()
- * @model volatile="true"
- * @generated
- */
- AccessType getAccessForXml();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml#getAccessForXml <em>Access For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Access For Xml</em>' attribute.
- * @see org.eclipse.jpt.core.internal.AccessType
- * @see #getAccessForXml()
- * @generated
- */
- void setAccessForXml(AccessType value);
-
- /**
- * Returns the value of the '<em><b>Cascade Persist For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Cascade Persist For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Cascade Persist For Xml</em>' attribute.
- * @see #setCascadePersistForXml(boolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsForXml_CascadePersistForXml()
- * @model volatile="true"
- * @generated
- */
- boolean isCascadePersistForXml();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml#isCascadePersistForXml <em>Cascade Persist For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Cascade Persist For Xml</em>' attribute.
- * @see #isCascadePersistForXml()
- * @generated
- */
- void setCascadePersistForXml(boolean value);
-} // PersistenceUnitDefaultsForXml
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitDefaultsInternal.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitDefaultsInternal.java
deleted file mode 100644
index 8941898c6d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitDefaultsInternal.java
+++ /dev/null
@@ -1,950 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.AccessType;
-import org.eclipse.jpt.core.internal.XmlEObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Persistence Unit Defaults Internal</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getSchemaInternal <em>Schema Internal</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getCatalogInternal <em>Catalog Internal</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getAccessInternal <em>Access Internal</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#isCascadePersistInternal <em>Cascade Persist Internal</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsInternal()
- * @model kind="class"
- * @generated
- */
-public class PersistenceUnitDefaultsInternal extends XmlEObject
- implements PersistenceUnitDefaults, PersistenceUnitDefaultsForXml
-{
- /**
- * The default value of the '{@link #getSchema() <em>Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSchema()
- * @generated
- * @ordered
- */
- protected static final String SCHEMA_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getCatalog()
- * @generated
- * @ordered
- */
- protected static final String CATALOG_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getAccess() <em>Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getAccess()
- * @generated
- * @ordered
- */
- protected static final AccessType ACCESS_EDEFAULT = AccessType.DEFAULT;
-
- /**
- * The default value of the '{@link #isCascadePersist() <em>Cascade Persist</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isCascadePersist()
- * @generated
- * @ordered
- */
- protected static final boolean CASCADE_PERSIST_EDEFAULT = false;
-
- /**
- * The default value of the '{@link #getSchemaForXml() <em>Schema For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSchemaForXml()
- * @generated
- * @ordered
- */
- protected static final String SCHEMA_FOR_XML_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getCatalogForXml() <em>Catalog For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getCatalogForXml()
- * @generated
- * @ordered
- */
- protected static final String CATALOG_FOR_XML_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getAccessForXml() <em>Access For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getAccessForXml()
- * @generated
- * @ordered
- */
- protected static final AccessType ACCESS_FOR_XML_EDEFAULT = AccessType.DEFAULT;
-
- /**
- * The default value of the '{@link #isCascadePersistForXml() <em>Cascade Persist For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isCascadePersistForXml()
- * @generated
- * @ordered
- */
- protected static final boolean CASCADE_PERSIST_FOR_XML_EDEFAULT = false;
-
- /**
- * The default value of the '{@link #getSchemaInternal() <em>Schema Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSchemaInternal()
- * @generated
- * @ordered
- */
- protected static final String SCHEMA_INTERNAL_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSchemaInternal() <em>Schema Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSchemaInternal()
- * @generated
- * @ordered
- */
- protected String schemaInternal = SCHEMA_INTERNAL_EDEFAULT;
-
- /**
- * The default value of the '{@link #getCatalogInternal() <em>Catalog Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getCatalogInternal()
- * @generated
- * @ordered
- */
- protected static final String CATALOG_INTERNAL_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getCatalogInternal() <em>Catalog Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getCatalogInternal()
- * @generated
- * @ordered
- */
- protected String catalogInternal = CATALOG_INTERNAL_EDEFAULT;
-
- /**
- * The default value of the '{@link #getAccessInternal() <em>Access Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getAccessInternal()
- * @generated
- * @ordered
- */
- protected static final AccessType ACCESS_INTERNAL_EDEFAULT = AccessType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getAccessInternal() <em>Access Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getAccessInternal()
- * @generated
- * @ordered
- */
- protected AccessType accessInternal = ACCESS_INTERNAL_EDEFAULT;
-
- /**
- * The default value of the '{@link #isCascadePersistInternal() <em>Cascade Persist Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isCascadePersistInternal()
- * @generated
- * @ordered
- */
- protected static final boolean CASCADE_PERSIST_INTERNAL_EDEFAULT = false;
-
- /**
- * The cached value of the '{@link #isCascadePersistInternal() <em>Cascade Persist Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isCascadePersistInternal()
- * @generated
- * @ordered
- */
- protected boolean cascadePersistInternal = CASCADE_PERSIST_INTERNAL_EDEFAULT;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected PersistenceUnitDefaultsInternal() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.PERSISTENCE_UNIT_DEFAULTS_INTERNAL;
- }
-
- /**
- * Returns the value of the '<em><b>Access</b></em>' attribute.
- * The default value is <code>""</code>.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.content.orm.AccessType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Access</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Access</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.AccessType
- * @see #setAccess(AccessType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAccessHolder_Access()
- * @model default="" volatile="true"
- * @generated NOT
- */
- public AccessType getAccess() {
- return getAccessInternal();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getAccess <em>Access</em>}' attribute.
- * This api should be used by the UI. It calls the appropriate
- * internal api for updating the xml. It also handles setting container
- * objects to null for the xml. If access is set to the default, empty xml containment
- * tags will be removed when they no longer contain any other xml tags.
- * This is done in the UI method because we do not want the same behavior
- * when setting the access from the xml, we never want to change the xml
- * as the user is directly edting the xml.
- *
- * @param value the new value of the '<em>Access</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.AccessType
- * @see #getAccess()
- * @generated NOT
- */
- public void setAccess(AccessType newAccess) {
- setAccessInternal(newAccess);
- if (newAccess != ACCESS_EDEFAULT) {
- getPersistenceUnitMetadata().makePersistenceUnitDefaultsForXmlNonNull();
- }
- setAccessForXml(newAccess);
- if (isAllFeaturesUnset()) {
- getPersistenceUnitMetadata().makePersistenceUnitDefaultsForXmlNull();
- }
- }
-
- private PersistenceUnitMetadataInternal getPersistenceUnitMetadata() {
- return (PersistenceUnitMetadataInternal) eContainer();
- }
-
- /**
- * Returns the value of the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Catalog</em>' attribute.
- * @see #setCatalog(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getCatalogHolder_Catalog()
- * @model volatile="true"
- * @generated NOT
- */
- public String getCatalog() {
- return getCatalogInternal();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getCatalog <em>Catalog</em>}' attribute.
- * This api should be used by the UI. It calls the appropriate
- * internal api for updating the xml. It also handles setting container
- * objects to null for the xml. If access is set to the default, empty xml containment
- * tags will be removed when they no longer contain any other xml tags.
- * This is done in the UI method because we do not want the same behavior
- * when setting the access from the xml, we never want to change the xml
- * as the user is directly edting the xml.
- * @param value the new value of the '<em>Catalog</em>' attribute.
- * @see #getCatalog()
- * @generated NOT
- */
- public void setCatalog(String newCatalog) {
- setCatalogInternal(newCatalog);
- if (newCatalog != CATALOG_EDEFAULT) {
- getPersistenceUnitMetadata().makePersistenceUnitDefaultsForXmlNonNull();
- }
- setCatalogForXml(newCatalog);
- if (isAllFeaturesUnset()) {
- getPersistenceUnitMetadata().makePersistenceUnitDefaultsForXmlNull();
- }
- }
-
- /**
- * Returns the value of the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Schema</em>' attribute.
- * @see #setSchema(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getSchemaHolder_Schema()
- * @model volatile="true"
- * @generated NOT
- */
- public String getSchema() {
- return getSchemaInternal();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getSchema <em>Schema</em>}' attribute.
- * This api should be used by the UI. It calls the appropriate
- * internal api for updating the xml. It also handles setting container
- * objects to null for the xml. If access is set to the default, empty xml containment
- * tags will be removed when they no longer contain any other xml tags.
- * This is done in the UI method because we do not want the same behavior
- * when setting the access from the xml, we never want to change the xml
- * as the user is directly edting the xml.
- * @param value the new value of the '<em>Schema</em>' attribute.
- * @see #getSchema()
- * @generated NOT
- */
- public void setSchema(String newSchema) {
- setSchemaInternal(newSchema);
- if (newSchema != SCHEMA_EDEFAULT) {
- getPersistenceUnitMetadata().makePersistenceUnitDefaultsForXmlNonNull();
- }
- setSchemaForXml(newSchema);
- if (isAllFeaturesUnset()) {
- getPersistenceUnitMetadata().makePersistenceUnitDefaultsForXmlNull();
- }
- }
-
- /**
- * Returns the value of the '<em><b>Cascade Persist</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Cascade Persist</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Cascade Persist</em>' attribute.
- * @see #setCascadePersist(boolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaults_CascadePersist()
- * @model volatile="true"
- * @generated NOT
- */
- public boolean isCascadePersist() {
- return isCascadePersistInternal();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#isCascadePersist <em>Cascade Persist</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Cascade Persist</em>' attribute.
- * @see #isCascadePersist()
- * @generated NOT
- */
- public void setCascadePersist(boolean newCascadePersist) {
- setCascadePersistInternal(newCascadePersist);
- if (newCascadePersist != CASCADE_PERSIST_EDEFAULT) {
- getPersistenceUnitMetadata().makePersistenceUnitDefaultsForXmlNonNull();
- }
- setCascadePersistForXml(newCascadePersist);
- if (isAllFeaturesUnset()) {
- getPersistenceUnitMetadata().makePersistenceUnitDefaultsForXmlNull();
- }
- }
-
- /**
- * Returns the value of the '<em><b>Schema For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Schema For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Schema For Xml</em>' attribute.
- * @see #setSchemaForXml(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsForXml_SchemaForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public String getSchemaForXml() {
- return getSchemaInternal();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getSchemaForXml <em>Schema For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Schema For Xml</em>' attribute.
- * @see #getSchemaForXml()
- * @generated NOT
- */
- public void setSchemaForXml(String newSchemaForXml) {
- setSchemaInternal(newSchemaForXml);
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_FOR_XML, newSchemaForXml + " ", newSchemaForXml));
- }
-
- /**
- * Returns the value of the '<em><b>Catalog For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Catalog For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Catalog For Xml</em>' attribute.
- * @see #setCatalogForXml(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsForXml_CatalogForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public String getCatalogForXml() {
- return getCatalogInternal();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getCatalogForXml <em>Catalog For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Catalog For Xml</em>' attribute.
- * @see #getCatalogForXml()
- * @generated NOT
- */
- public void setCatalogForXml(String newCatalogForXml) {
- setCatalogInternal(newCatalogForXml);
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_FOR_XML, newCatalogForXml + " ", newCatalogForXml));
- }
-
- /**
- * Returns the value of the '<em><b>Access For Xml</b></em>' attribute.
- * The default value is <code>""</code>.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.content.orm.AccessType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Access For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Access For Xml</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.AccessType
- * @see #setAccessForXml(AccessType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsForXml_AccessForXml()
- * @model default="" volatile="true"
- * @generated NOT
- */
- public AccessType getAccessForXml() {
- return getAccessInternal();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getAccessForXml <em>Access For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Access For Xml</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.AccessType
- * @see #getAccessForXml()
- * @generated NOT
- */
- public void setAccessForXml(AccessType newAccessForXml) {
- setAccessInternal(newAccessForXml);
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_FOR_XML, null, newAccessForXml));
- }
-
- /**
- * Returns the value of the '<em><b>Cascade Persist For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Cascade Persist For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Cascade Persist For Xml</em>' attribute.
- * @see #setCascadePersistForXml(boolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsForXml_CascadePersistForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public boolean isCascadePersistForXml() {
- return isCascadePersistInternal();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#isCascadePersistForXml <em>Cascade Persist For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Cascade Persist For Xml</em>' attribute.
- * @see #isCascadePersistForXml()
- * @generated NOT
- */
- public void setCascadePersistForXml(boolean newCascadePersistForXml) {
- setCascadePersistInternal(newCascadePersistForXml);
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_FOR_XML, null, newCascadePersistForXml));
- }
-
- /**
- * Returns the value of the '<em><b>Schema Internal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Schema Internal</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Schema Internal</em>' attribute.
- * @see #setSchemaInternal(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsInternal_SchemaInternal()
- * @model
- * @generated
- */
- public String getSchemaInternal() {
- return schemaInternal;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getSchemaInternal <em>Schema Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Schema Internal</em>' attribute.
- * @see #getSchemaInternal()
- * @generated NOT
- */
- public void setSchemaInternal(String newSchemaInternal) {
- String oldSchemaInternal = schemaInternal;
- schemaInternal = newSchemaInternal;
- if (eNotificationRequired()) {
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_INTERNAL, oldSchemaInternal, schemaInternal));
- //notification so the UI is updated when the xml changes, can't call the UI api
- //because it has other side effects
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA, oldSchemaInternal, schemaInternal));
- }
- }
-
- /**
- * Returns the value of the '<em><b>Catalog Internal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Catalog Internal</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Catalog Internal</em>' attribute.
- * @see #setCatalogInternal(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsInternal_CatalogInternal()
- * @model
- * @generated
- */
- public String getCatalogInternal() {
- return catalogInternal;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getCatalogInternal <em>Catalog Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Catalog Internal</em>' attribute.
- * @see #getCatalogInternal()
- * @generated NOT
- */
- public void setCatalogInternal(String newCatalogInternal) {
- String oldCatalogInternal = catalogInternal;
- catalogInternal = newCatalogInternal;
- if (eNotificationRequired()) {
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_INTERNAL, oldCatalogInternal, catalogInternal));
- //notification so the UI is updated when the xml changes, can't call the UI api
- //because it has other side effects
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG, oldCatalogInternal, catalogInternal));
- }
- }
-
- /**
- * Returns the value of the '<em><b>Access Internal</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.AccessType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Access Internal</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Access Internal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.AccessType
- * @see #setAccessInternal(AccessType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsInternal_AccessInternal()
- * @model
- * @generated
- */
- public AccessType getAccessInternal() {
- return accessInternal;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#getAccessInternal <em>Access Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Access Internal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.AccessType
- * @see #getAccessInternal()
- * @generated NOT
- */
- public void setAccessInternal(AccessType newAccessInternal) {
- AccessType oldAccessInternal = accessInternal;
- accessInternal = newAccessInternal == null ? ACCESS_INTERNAL_EDEFAULT : newAccessInternal;
- if (eNotificationRequired()) {
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_INTERNAL, oldAccessInternal, accessInternal));
- //notification so the UI is updated when the xml changes, can't call the UI api
- //because it has other side effects
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS, oldAccessInternal, accessInternal));
- }
- }
-
- /**
- * Returns the value of the '<em><b>Cascade Persist Internal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Cascade Persist Internal</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Cascade Persist Internal</em>' attribute.
- * @see #setCascadePersistInternal(boolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitDefaultsInternal_CascadePersistInternal()
- * @model
- * @generated
- */
- public boolean isCascadePersistInternal() {
- return cascadePersistInternal;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal#isCascadePersistInternal <em>Cascade Persist Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Cascade Persist Internal</em>' attribute.
- * @see #isCascadePersistInternal()
- * @generated NOT
- */
- public void setCascadePersistInternal(boolean newCascadePersistInternal) {
- boolean oldCascadePersistInternal = cascadePersistInternal;
- cascadePersistInternal = newCascadePersistInternal;
- if (eNotificationRequired()) {
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_INTERNAL, oldCascadePersistInternal, cascadePersistInternal));
- //notification so the UI is updated when the xml changes, can't call the UI api
- //because it has other side effects
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST, oldCascadePersistInternal, newCascadePersistInternal));
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA :
- return getSchema();
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG :
- return getCatalog();
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS :
- return getAccess();
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST :
- return isCascadePersist() ? Boolean.TRUE : Boolean.FALSE;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_FOR_XML :
- return getSchemaForXml();
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_FOR_XML :
- return getCatalogForXml();
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_FOR_XML :
- return getAccessForXml();
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_FOR_XML :
- return isCascadePersistForXml() ? Boolean.TRUE : Boolean.FALSE;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_INTERNAL :
- return getSchemaInternal();
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_INTERNAL :
- return getCatalogInternal();
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_INTERNAL :
- return getAccessInternal();
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_INTERNAL :
- return isCascadePersistInternal() ? Boolean.TRUE : Boolean.FALSE;
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA :
- setSchema((String) newValue);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG :
- setCatalog((String) newValue);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS :
- setAccess((AccessType) newValue);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST :
- setCascadePersist(((Boolean) newValue).booleanValue());
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_FOR_XML :
- setSchemaForXml((String) newValue);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_FOR_XML :
- setCatalogForXml((String) newValue);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_FOR_XML :
- setAccessForXml((AccessType) newValue);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_FOR_XML :
- setCascadePersistForXml(((Boolean) newValue).booleanValue());
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_INTERNAL :
- setSchemaInternal((String) newValue);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_INTERNAL :
- setCatalogInternal((String) newValue);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_INTERNAL :
- setAccessInternal((AccessType) newValue);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_INTERNAL :
- setCascadePersistInternal(((Boolean) newValue).booleanValue());
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA :
- setSchema(SCHEMA_EDEFAULT);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG :
- setCatalog(CATALOG_EDEFAULT);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS :
- setAccess(ACCESS_EDEFAULT);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST :
- setCascadePersist(CASCADE_PERSIST_EDEFAULT);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_FOR_XML :
- setSchemaForXml(SCHEMA_FOR_XML_EDEFAULT);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_FOR_XML :
- setCatalogForXml(CATALOG_FOR_XML_EDEFAULT);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_FOR_XML :
- setAccessForXml(ACCESS_FOR_XML_EDEFAULT);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_FOR_XML :
- setCascadePersistForXml(CASCADE_PERSIST_FOR_XML_EDEFAULT);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_INTERNAL :
- setSchemaInternal(SCHEMA_INTERNAL_EDEFAULT);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_INTERNAL :
- setCatalogInternal(CATALOG_INTERNAL_EDEFAULT);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_INTERNAL :
- setAccessInternal(ACCESS_INTERNAL_EDEFAULT);
- return;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_INTERNAL :
- setCascadePersistInternal(CASCADE_PERSIST_INTERNAL_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA :
- return SCHEMA_EDEFAULT == null ? getSchema() != null : !SCHEMA_EDEFAULT.equals(getSchema());
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG :
- return CATALOG_EDEFAULT == null ? getCatalog() != null : !CATALOG_EDEFAULT.equals(getCatalog());
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS :
- return getAccess() != ACCESS_EDEFAULT;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST :
- return isCascadePersist() != CASCADE_PERSIST_EDEFAULT;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_FOR_XML :
- return SCHEMA_FOR_XML_EDEFAULT == null ? getSchemaForXml() != null : !SCHEMA_FOR_XML_EDEFAULT.equals(getSchemaForXml());
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_FOR_XML :
- return CATALOG_FOR_XML_EDEFAULT == null ? getCatalogForXml() != null : !CATALOG_FOR_XML_EDEFAULT.equals(getCatalogForXml());
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_FOR_XML :
- return getAccessForXml() != ACCESS_FOR_XML_EDEFAULT;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_FOR_XML :
- return isCascadePersistForXml() != CASCADE_PERSIST_FOR_XML_EDEFAULT;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_INTERNAL :
- return SCHEMA_INTERNAL_EDEFAULT == null ? schemaInternal != null : !SCHEMA_INTERNAL_EDEFAULT.equals(schemaInternal);
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_INTERNAL :
- return CATALOG_INTERNAL_EDEFAULT == null ? catalogInternal != null : !CATALOG_INTERNAL_EDEFAULT.equals(catalogInternal);
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_INTERNAL :
- return accessInternal != ACCESS_INTERNAL_EDEFAULT;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_INTERNAL :
- return cascadePersistInternal != CASCADE_PERSIST_INTERNAL_EDEFAULT;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == PersistenceUnitDefaults.class) {
- switch (derivedFeatureID) {
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA :
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS__SCHEMA;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG :
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CATALOG;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS :
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ACCESS;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST :
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST;
- default :
- return -1;
- }
- }
- if (baseClass == PersistenceUnitDefaultsForXml.class) {
- switch (derivedFeatureID) {
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_FOR_XML :
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS_FOR_XML__SCHEMA_FOR_XML;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_FOR_XML :
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS_FOR_XML__CATALOG_FOR_XML;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_FOR_XML :
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS_FOR_XML__ACCESS_FOR_XML;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_FOR_XML :
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS_FOR_XML__CASCADE_PERSIST_FOR_XML;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == PersistenceUnitDefaults.class) {
- switch (baseFeatureID) {
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__SCHEMA :
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CATALOG :
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ACCESS :
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST :
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST;
- default :
- return -1;
- }
- }
- if (baseClass == PersistenceUnitDefaultsForXml.class) {
- switch (baseFeatureID) {
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_FOR_XML__SCHEMA_FOR_XML :
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_FOR_XML;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_FOR_XML__CATALOG_FOR_XML :
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_FOR_XML;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_FOR_XML__ACCESS_FOR_XML :
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_FOR_XML;
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_FOR_XML__CASCADE_PERSIST_FOR_XML :
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_FOR_XML;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (schemaInternal: ");
- result.append(schemaInternal);
- result.append(", catalogInternal: ");
- result.append(catalogInternal);
- result.append(", accessInternal: ");
- result.append(accessInternal);
- result.append(", cascadePersistInternal: ");
- result.append(cascadePersistInternal);
- result.append(')');
- return result.toString();
- }
-
- /**
- * Call this when the persistence-unit-defaults tag is removed
- * from the xml, need to make sure all the model attributes are set to the default
- */
- protected void unsetAllAttributes() {
- eUnset(OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__ACCESS_INTERNAL);
- eUnset(OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CATALOG_INTERNAL);
- eUnset(OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__SCHEMA_INTERNAL);
- eUnset(OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL__CASCADE_PERSIST_INTERNAL);
- }
-} // PersistenceUnitDefaultsInternal
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitMetadata.java
deleted file mode 100644
index ef8b57d28b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitMetadata.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.jpt.core.internal.IXmlEObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Persistence Unit Metadata</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata#isXmlMappingMetadataComplete <em>Xml Mapping Metadata Complete</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata#getPersistenceUnitDefaults <em>Persistence Unit Defaults</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadata()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface PersistenceUnitMetadata extends IXmlEObject
-{
- /**
- * Returns the value of the '<em><b>Xml Mapping Metadata Complete</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Xml Mapping Metadata Complete</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Xml Mapping Metadata Complete</em>' attribute.
- * @see #setXmlMappingMetadataComplete(boolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadata_XmlMappingMetadataComplete()
- * @model volatile="true"
- * @generated
- */
- boolean isXmlMappingMetadataComplete();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata#isXmlMappingMetadataComplete <em>Xml Mapping Metadata Complete</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Xml Mapping Metadata Complete</em>' attribute.
- * @see #isXmlMappingMetadataComplete()
- * @generated
- */
- void setXmlMappingMetadataComplete(boolean value);
-
- /**
- * Returns the value of the '<em><b>Persistence Unit Defaults</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Persistence Unit Defaults</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persistence Unit Defaults</em>' reference.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadata_PersistenceUnitDefaults()
- * @model resolveProxies="false" changeable="false" volatile="true"
- * @generated
- */
- PersistenceUnitDefaults getPersistenceUnitDefaults();
-} // PersistenceUnitMetadata
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitMetadataForXml.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitMetadataForXml.java
deleted file mode 100644
index 2d98702161..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitMetadataForXml.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.jpt.core.internal.IXmlEObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Persistence Unit Metadata For Xml</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml#isXmlMappingMetadataCompleteForXml <em>Xml Mapping Metadata Complete For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml#getPersistenceUnitDefaultsForXml <em>Persistence Unit Defaults For Xml</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadataForXml()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface PersistenceUnitMetadataForXml extends IXmlEObject
-{
- /**
- * Returns the value of the '<em><b>Xml Mapping Metadata Complete For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Xml Mapping Metadata Complete For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Xml Mapping Metadata Complete For Xml</em>' attribute.
- * @see #setXmlMappingMetadataCompleteForXml(boolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadataForXml_XmlMappingMetadataCompleteForXml()
- * @model volatile="true"
- * @generated
- */
- boolean isXmlMappingMetadataCompleteForXml();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml#isXmlMappingMetadataCompleteForXml <em>Xml Mapping Metadata Complete For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Xml Mapping Metadata Complete For Xml</em>' attribute.
- * @see #isXmlMappingMetadataCompleteForXml()
- * @generated
- */
- void setXmlMappingMetadataCompleteForXml(boolean value);
-
- /**
- * Returns the value of the '<em><b>Persistence Unit Defaults For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Persistence Unit Defaults For Xml</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persistence Unit Defaults For Xml</em>' reference.
- * @see #setPersistenceUnitDefaultsForXml(PersistenceUnitDefaultsForXml)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadataForXml_PersistenceUnitDefaultsForXml()
- * @model resolveProxies="false" volatile="true"
- * @generated
- */
- PersistenceUnitDefaultsForXml getPersistenceUnitDefaultsForXml();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml#getPersistenceUnitDefaultsForXml <em>Persistence Unit Defaults For Xml</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Persistence Unit Defaults For Xml</em>' reference.
- * @see #getPersistenceUnitDefaultsForXml()
- * @generated
- */
- void setPersistenceUnitDefaultsForXml(PersistenceUnitDefaultsForXml value);
-} // PersistenceUnitMetadataForXml
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitMetadataInternal.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitMetadataInternal.java
deleted file mode 100644
index b88ecac74f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/PersistenceUnitMetadataInternal.java
+++ /dev/null
@@ -1,532 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.XmlEObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Persistence Unit Metadata Internal</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal#isXmlMappingMetadataCompleteInternal <em>Xml Mapping Metadata Complete Internal</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal#getPersistenceUnitDefaultsInternal <em>Persistence Unit Defaults Internal</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadataInternal()
- * @model kind="class"
- * @generated
- */
-public class PersistenceUnitMetadataInternal extends XmlEObject
- implements PersistenceUnitMetadataForXml, PersistenceUnitMetadata
-{
- /**
- * The default value of the '{@link #isXmlMappingMetadataCompleteForXml() <em>Xml Mapping Metadata Complete For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isXmlMappingMetadataCompleteForXml()
- * @generated
- * @ordered
- */
- protected static final boolean XML_MAPPING_METADATA_COMPLETE_FOR_XML_EDEFAULT = false;
-
- /**
- * The default value of the '{@link #isXmlMappingMetadataComplete() <em>Xml Mapping Metadata Complete</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isXmlMappingMetadataComplete()
- * @generated
- * @ordered
- */
- protected static final boolean XML_MAPPING_METADATA_COMPLETE_EDEFAULT = false;
-
- /**
- * The default value of the '{@link #isXmlMappingMetadataCompleteInternal() <em>Xml Mapping Metadata Complete Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isXmlMappingMetadataCompleteInternal()
- * @generated
- * @ordered
- */
- protected static final boolean XML_MAPPING_METADATA_COMPLETE_INTERNAL_EDEFAULT = false;
-
- /**
- * The cached value of the '{@link #isXmlMappingMetadataCompleteInternal() <em>Xml Mapping Metadata Complete Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isXmlMappingMetadataCompleteInternal()
- * @generated
- * @ordered
- */
- protected boolean xmlMappingMetadataCompleteInternal = XML_MAPPING_METADATA_COMPLETE_INTERNAL_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getPersistenceUnitDefaultsInternal() <em>Persistence Unit Defaults Internal</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPersistenceUnitDefaultsInternal()
- * @generated
- * @ordered
- */
- protected PersistenceUnitDefaultsInternal persistenceUnitDefaultsInternal;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated NOT
- */
- protected PersistenceUnitMetadataInternal() {
- super();
- //we don't want a setter for this object since it should never be null, but
- //it must be initialized and is necessary for emf to call the eInverseAdd method
- this.persistenceUnitDefaultsInternal = OrmFactory.eINSTANCE.createPersistenceUnitDefaultsInternal();
- ((InternalEObject) this.persistenceUnitDefaultsInternal).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS_INTERNAL, null, null);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.PERSISTENCE_UNIT_METADATA_INTERNAL;
- }
-
- /**
- * Returns the value of the '<em><b>Xml Mapping Metadata Complete For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * API used by the xml translator. Defers to the internal attribute, no actual
- * xml attribute is stored in the model.
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Xml Mapping Metadata Complete For Xml</em>' attribute.
- * @see #setXmlMappingMetadataCompleteForXml(boolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadataForXml_XmlMappingMetadataCompleteForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public boolean isXmlMappingMetadataCompleteForXml() {
- return isXmlMappingMetadataCompleteInternal();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal#isXmlMappingMetadataCompleteForXml <em>Xml Mapping Metadata Complete For Xml</em>}' attribute.
- * API used by the XML translator, sets the internal attribute and
- * fires notification about the XML attribute changing.
- * @param value the new value of the '<em>Xml Mapping Metadata Complete For Xml</em>' attribute.
- * @see #isXmlMappingMetadataCompleteForXml()
- * @generated NOT
- */
- public void setXmlMappingMetadataCompleteForXml(boolean newXmlMappingMetadataCompleteForXml) {
- setXmlMappingMetadataCompleteInternal(newXmlMappingMetadataCompleteForXml);
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_FOR_XML, null, newXmlMappingMetadataCompleteForXml));
- }
-
- /**
- * Returns the value of the '<em><b>Persistence Unit Defaults For Xml</b></em>' reference.
- * The default value is <code>""</code>.
- * <!-- begin-user-doc -->
- * <p>
- * API just for the xml translators. Null in the model for a containment
- * object corresponds to no persistence-unit-defaults xml tag in the xml file.
- * We check for whether any features are set in the model and return null for
- * persistenceUnitDefaultsForXml if there aren't any. Otherwise we return
- * the persistenceUnitDefaultsInternal that has already been created.
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persistence Unit Defaults For Xml</em>' reference.
- * @see #setPersistenceUnitDefaultsForXml(PersistenceUnitDefaultsForXml)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadataForXml_PersistenceUnitDefaultsForXml()
- * @model resolveProxies="false" volatile="true"
- * @generated NOT
- */
- public PersistenceUnitDefaultsForXml getPersistenceUnitDefaultsForXml() {
- if (getPersistenceUnitDefaultsInternal().isAllFeaturesUnset()) {
- return null;
- }
- return getPersistenceUnitDefaultsInternal();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal#getPersistenceUnitDefaultsForXml <em>Persistence Unit Defaults For Xml</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Persistence Unit Defaults For Xml</em>' reference.
- * @see #getPersistenceUnitDefaultsForXml()
- * @generated NOT
- */
- public void setPersistenceUnitDefaultsForXmlGen(PersistenceUnitDefaultsForXml newPersistenceUnitDefaultsForXml) {
- PersistenceUnitDefaultsForXml oldValue = newPersistenceUnitDefaultsForXml == null ? (PersistenceUnitDefaultsForXml) getPersistenceUnitDefaults() : null;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS_FOR_XML, oldValue, newPersistenceUnitDefaultsForXml));
- }
-
- public void setPersistenceUnitDefaultsForXml(PersistenceUnitDefaultsForXml newPersistenceUnitDefaultsForXml) {
- setPersistenceUnitDefaultsForXmlGen(newPersistenceUnitDefaultsForXml);
- if (newPersistenceUnitDefaultsForXml == null) {
- getPersistenceUnitDefaultsInternal().unsetAllAttributes();
- }
- }
-
- public void makePersistenceUnitDefaultsForXmlNull() {
- setPersistenceUnitDefaultsForXmlGen(null);
- if (isAllFeaturesUnset()) {
- getEntityMappings().makePersistenceUnitMetadataForXmlNull();
- }
- }
-
- public void makePersistenceUnitDefaultsForXmlNonNull() {
- setPersistenceUnitDefaultsForXmlGen(getPersistenceUnitDefaultsForXml());
- getEntityMappings().makePersistenceUnitMetadataForXmlNonNull();
- }
-
- private EntityMappingsInternal getEntityMappings() {
- return (EntityMappingsInternal) eContainer();
- }
-
- /**
- * Returns the value of the '<em><b>Xml Mapping Metadata Complete</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Xml Mapping Metadata Complete</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Xml Mapping Metadata Complete</em>' attribute.
- * @see #setXmlMappingMetadataComplete(boolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadata_XmlMappingMetadataComplete()
- * @model volatile="true"
- * @generated NOT
- */
- public boolean isXmlMappingMetadataComplete() {
- return isXmlMappingMetadataCompleteInternal();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal#isXmlMappingMetadataComplete <em>Xml Mapping Metadata Complete</em>}' attribute.
- * This api should be used by the UI. It calls the appropriate
- * internal api for updating the xml. It also handles setting container
- * objects to null for the xml. If access is set to the default, empty xml containment
- * tags will be removed when they no longer contain any other xml tags.
- * This is done in the UI method because we do not want the same behavior
- * when setting the access from the xml, we never want to change the xml
- * as the user is directly edting the xml.
- * @param value the new value of the '<em>Xml Mapping Metadata Complete</em>' attribute.
- * @see #isXmlMappingMetadataComplete()
- * @generated NOT
- */
- public void setXmlMappingMetadataComplete(boolean newXmlMappingMetadataComplete) {
- setXmlMappingMetadataCompleteInternal(newXmlMappingMetadataComplete);
- if (newXmlMappingMetadataComplete != XML_MAPPING_METADATA_COMPLETE_EDEFAULT) {
- getEntityMappings().makePersistenceUnitMetadataForXmlNonNull();
- }
- setXmlMappingMetadataCompleteForXml(newXmlMappingMetadataComplete);
- if (isAllFeaturesUnset()) {
- getEntityMappings().makePersistenceUnitMetadataForXmlNull();
- }
- }
-
- /**
- * Returns the value of the '<em><b>Persistence Unit Defaults</b></em>' reference.
- * The default value is <code>""</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Persistence Unit Defaults</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persistence Unit Defaults</em>' reference.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadata_PersistenceUnitDefaults()
- * @model resolveProxies="false" changeable="false" volatile="true"
- * @generated NOT
- */
- public PersistenceUnitDefaults getPersistenceUnitDefaults() {
- return getPersistenceUnitDefaultsInternal();
- }
-
- /**
- * Returns the value of the '<em><b>Xml Mapping Metadata Complete Internal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Xml Mapping Metadata Complete Internal</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Xml Mapping Metadata Complete Internal</em>' attribute.
- * @see #setXmlMappingMetadataCompleteInternal(boolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadataInternal_XmlMappingMetadataCompleteInternal()
- * @model
- * @generated
- */
- public boolean isXmlMappingMetadataCompleteInternal() {
- return xmlMappingMetadataCompleteInternal;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal#isXmlMappingMetadataCompleteInternal <em>Xml Mapping Metadata Complete Internal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Xml Mapping Metadata Complete Internal</em>' attribute.
- * @see #isXmlMappingMetadataCompleteInternal()
- * @generated NOT
- */
- public void setXmlMappingMetadataCompleteInternal(boolean newXmlMappingMetadataCompleteInternal) {
- boolean oldXmlMappingMetadataCompleteInternal = xmlMappingMetadataCompleteInternal;
- xmlMappingMetadataCompleteInternal = newXmlMappingMetadataCompleteInternal;
- if (eNotificationRequired()) {
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_INTERNAL, oldXmlMappingMetadataCompleteInternal, xmlMappingMetadataCompleteInternal));
- //notification so the UI is updated when the xml changes, can't call the UI api
- //because it has other side effects
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE, oldXmlMappingMetadataCompleteInternal, xmlMappingMetadataCompleteInternal));
- }
- }
-
- /**
- * Returns the value of the '<em><b>Persistence Unit Defaults Internal</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Persistence Unit Defaults Internal</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persistence Unit Defaults Internal</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getPersistenceUnitMetadataInternal_PersistenceUnitDefaultsInternal()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- public PersistenceUnitDefaultsInternal getPersistenceUnitDefaultsInternal() {
- return persistenceUnitDefaultsInternal;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetPersistenceUnitDefaultsInternal(PersistenceUnitDefaultsInternal newPersistenceUnitDefaultsInternal, NotificationChain msgs) {
- PersistenceUnitDefaultsInternal oldPersistenceUnitDefaultsInternal = persistenceUnitDefaultsInternal;
- persistenceUnitDefaultsInternal = newPersistenceUnitDefaultsInternal;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS_INTERNAL, oldPersistenceUnitDefaultsInternal, newPersistenceUnitDefaultsInternal);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS_INTERNAL :
- return basicSetPersistenceUnitDefaultsInternal(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_FOR_XML :
- return isXmlMappingMetadataCompleteForXml() ? Boolean.TRUE : Boolean.FALSE;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS_FOR_XML :
- return getPersistenceUnitDefaultsForXml();
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE :
- return isXmlMappingMetadataComplete() ? Boolean.TRUE : Boolean.FALSE;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS :
- return getPersistenceUnitDefaults();
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_INTERNAL :
- return isXmlMappingMetadataCompleteInternal() ? Boolean.TRUE : Boolean.FALSE;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS_INTERNAL :
- return getPersistenceUnitDefaultsInternal();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_FOR_XML :
- setXmlMappingMetadataCompleteForXml(((Boolean) newValue).booleanValue());
- return;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS_FOR_XML :
- setPersistenceUnitDefaultsForXml((PersistenceUnitDefaultsForXml) newValue);
- return;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE :
- setXmlMappingMetadataComplete(((Boolean) newValue).booleanValue());
- return;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_INTERNAL :
- setXmlMappingMetadataCompleteInternal(((Boolean) newValue).booleanValue());
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_FOR_XML :
- setXmlMappingMetadataCompleteForXml(XML_MAPPING_METADATA_COMPLETE_FOR_XML_EDEFAULT);
- return;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS_FOR_XML :
- setPersistenceUnitDefaultsForXml((PersistenceUnitDefaultsForXml) null);
- return;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE :
- setXmlMappingMetadataComplete(XML_MAPPING_METADATA_COMPLETE_EDEFAULT);
- return;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_INTERNAL :
- setXmlMappingMetadataCompleteInternal(XML_MAPPING_METADATA_COMPLETE_INTERNAL_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_FOR_XML :
- return isXmlMappingMetadataCompleteForXml() != XML_MAPPING_METADATA_COMPLETE_FOR_XML_EDEFAULT;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS_FOR_XML :
- return getPersistenceUnitDefaultsForXml() != null;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE :
- return isXmlMappingMetadataComplete() != XML_MAPPING_METADATA_COMPLETE_EDEFAULT;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS :
- return getPersistenceUnitDefaults() != null;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_INTERNAL :
- return xmlMappingMetadataCompleteInternal != XML_MAPPING_METADATA_COMPLETE_INTERNAL_EDEFAULT;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS_INTERNAL :
- return persistenceUnitDefaultsInternal != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == PersistenceUnitMetadataForXml.class) {
- switch (derivedFeatureID) {
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_FOR_XML :
- return OrmPackage.PERSISTENCE_UNIT_METADATA_FOR_XML__XML_MAPPING_METADATA_COMPLETE_FOR_XML;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS_FOR_XML :
- return OrmPackage.PERSISTENCE_UNIT_METADATA_FOR_XML__PERSISTENCE_UNIT_DEFAULTS_FOR_XML;
- default :
- return -1;
- }
- }
- if (baseClass == PersistenceUnitMetadata.class) {
- switch (derivedFeatureID) {
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE :
- return OrmPackage.PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS :
- return OrmPackage.PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == PersistenceUnitMetadataForXml.class) {
- switch (baseFeatureID) {
- case OrmPackage.PERSISTENCE_UNIT_METADATA_FOR_XML__XML_MAPPING_METADATA_COMPLETE_FOR_XML :
- return OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_FOR_XML;
- case OrmPackage.PERSISTENCE_UNIT_METADATA_FOR_XML__PERSISTENCE_UNIT_DEFAULTS_FOR_XML :
- return OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS_FOR_XML;
- default :
- return -1;
- }
- }
- if (baseClass == PersistenceUnitMetadata.class) {
- switch (baseFeatureID) {
- case OrmPackage.PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE :
- return OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE;
- case OrmPackage.PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS :
- return OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__PERSISTENCE_UNIT_DEFAULTS;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (xmlMappingMetadataCompleteInternal: ");
- result.append(xmlMappingMetadataCompleteInternal);
- result.append(')');
- return result.toString();
- }
-
- /**
- * Call this when the persistence-unit-metadata tag is removed
- * from the xml, need to make sure all the model attributes are set to the default
- */
- protected void unsetAllAttributes() {
- eUnset(OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL__XML_MAPPING_METADATA_COMPLETE_INTERNAL);
- getPersistenceUnitDefaultsInternal().unsetAllAttributes();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAssociationOverride.java
deleted file mode 100644
index 8035356b46..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAssociationOverride.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import java.util.Collection;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Association Override</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlAssociationOverride()
- * @model kind="class"
- * @generated
- */
-public class XmlAssociationOverride extends XmlOverride
- implements IAssociationOverride
-{
- /**
- * The cached value of the '{@link #getSpecifiedJoinColumns() <em>Specified Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IJoinColumn> specifiedJoinColumns;
-
- /**
- * The cached value of the '{@link #getDefaultJoinColumns() <em>Default Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IJoinColumn> defaultJoinColumns;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlAssociationOverride() {
- super();
- }
-
- protected XmlAssociationOverride(IOverride.Owner owner) {
- super(owner);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_ASSOCIATION_OVERRIDE;
- }
-
- public EList<IJoinColumn> getJoinColumns() {
- return this.getSpecifiedJoinColumns().isEmpty() ? this.getDefaultJoinColumns() : this.getSpecifiedJoinColumns();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIAssociationOverride_SpecifiedJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IJoinColumn> getSpecifiedJoinColumns() {
- if (specifiedJoinColumns == null) {
- specifiedJoinColumns = new EObjectContainmentEList<IJoinColumn>(IJoinColumn.class, this, OrmPackage.XML_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS);
- }
- return specifiedJoinColumns;
- }
-
- /**
- * Returns the value of the '<em><b>Default Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIAssociationOverride_DefaultJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IJoinColumn> getDefaultJoinColumns() {
- if (defaultJoinColumns == null) {
- defaultJoinColumns = new EObjectContainmentEList<IJoinColumn>(IJoinColumn.class, this, OrmPackage.XML_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS);
- }
- return defaultJoinColumns;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_COLUMNS :
- return ((InternalEList<?>) getJoinColumns()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS :
- return ((InternalEList<?>) getSpecifiedJoinColumns()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS :
- return ((InternalEList<?>) getDefaultJoinColumns()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_COLUMNS :
- return getJoinColumns();
- case OrmPackage.XML_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS :
- return getSpecifiedJoinColumns();
- case OrmPackage.XML_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS :
- return getDefaultJoinColumns();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS :
- getSpecifiedJoinColumns().clear();
- getSpecifiedJoinColumns().addAll((Collection<? extends IJoinColumn>) newValue);
- return;
- case OrmPackage.XML_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS :
- getDefaultJoinColumns().clear();
- getDefaultJoinColumns().addAll((Collection<? extends IJoinColumn>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS :
- getSpecifiedJoinColumns().clear();
- return;
- case OrmPackage.XML_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS :
- getDefaultJoinColumns().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_COLUMNS :
- return !getJoinColumns().isEmpty();
- case OrmPackage.XML_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS :
- return specifiedJoinColumns != null && !specifiedJoinColumns.isEmpty();
- case OrmPackage.XML_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS :
- return defaultJoinColumns != null && !defaultJoinColumns.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IAssociationOverride.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IASSOCIATION_OVERRIDE__JOIN_COLUMNS;
- case OrmPackage.XML_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS;
- case OrmPackage.XML_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IAssociationOverride.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IASSOCIATION_OVERRIDE__JOIN_COLUMNS :
- return OrmPackage.XML_ASSOCIATION_OVERRIDE__JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS :
- return OrmPackage.XML_ASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS :
- return OrmPackage.XML_ASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- // ********** IAssociationOverride implementation **********
- public IJoinColumn createJoinColumn(int index) {
- return this.createXmlJoinColumn(index);
- }
-
- private XmlJoinColumn createXmlJoinColumn(int index) {
- return OrmFactory.eINSTANCE.createXmlJoinColumn(new JoinColumnOwner(this));
- //return XmlJoinColumn.createJoinTableJoinColumn(new JoinColumnOwner(), this.getMember(), index);
- }
-
- public boolean containsSpecifiedJoinColumns() {
- return !this.getSpecifiedJoinColumns().isEmpty();
- }
-
- public ITypeMapping typeMapping() {
- return (ITypeMapping) eContainer();
- }
-} // XmlAssociationOverride
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAttributeMapping.java
deleted file mode 100644
index 234a8b0e6c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAttributeMapping.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import java.util.Set;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.orm.resource.OrmXmlMapper;
-import org.eclipse.jpt.core.internal.emfutility.DOMUtilities;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Attribute Mapping</b></em>'.
- * Discussion of morphing mappings:<ol>
-
- * <li> Each concrete subclass must override the method initializeOn(MWMapping newMapping)
- * and call the appropriate initializeFromMW___Mapping(MW___Mapping oldMapping).
- * [This is call double-dispatching.]
- * We could have overloaded the same method name (e.g. initializeFrom(MW___Mapping oldMapping))
- * but the resulting confusion is not worth it. "Upcasting" just makes this really fuzzy....
- *
- * <il> If necessary, each subclass (concrete and abstract) should override
- * the initializeFromMW___Mapping(MW___Mapping oldMapping) method. This override
- * should first call super.initializeFromMW___Mapping(MW___Mapping oldMapping); then
- * it should initialize only the properties that are defined by it that have
- * corresponding properties in the oldMapping.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping#getPersistentAttribute <em>Persistent Attribute</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlAttributeMapping()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class XmlAttributeMapping extends XmlEObject
- implements IAttributeMapping
-{
- /**
- * The cached value of the '{@link #getPersistentAttribute() <em>Persistent Attribute</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPersistentAttribute()
- * @generated
- * @ordered
- */
- protected XmlPersistentAttribute persistentAttribute;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlAttributeMapping() {
- super();
- }
-
- protected INamedColumn.Owner buildOwner() {
- return new ColumnOwner();
- }
-
- @Override
- protected void addInsignificantFeatureIdsTo(Set<Integer> insignificantFeatureIds) {
- super.addInsignificantFeatureIdsTo(insignificantFeatureIds);
- insignificantFeatureIds.add(OrmPackage.XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_ATTRIBUTE_MAPPING;
- }
-
- public XmlPersistentType getPersistentType() {
- return (XmlPersistentType) eContainer();
- }
-
- /**
- * Returns the value of the '<em><b>Persistent Attribute</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Persistent Attribute</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persistent Attribute</em>' containment reference.
- * @see #setPersistentAttribute(XmlPersistentAttribute)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlAttributeMapping_PersistentAttribute()
- * @model containment="true" required="true"
- * @generated
- */
- public XmlPersistentAttribute getPersistentAttribute() {
- return persistentAttribute;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetPersistentAttribute(XmlPersistentAttribute newPersistentAttribute, NotificationChain msgs) {
- XmlPersistentAttribute oldPersistentAttribute = persistentAttribute;
- persistentAttribute = newPersistentAttribute;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE, oldPersistentAttribute, newPersistentAttribute);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping#getPersistentAttribute <em>Persistent Attribute</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Persistent Attribute</em>' containment reference.
- * @see #getPersistentAttribute()
- * @generated
- */
- public void setPersistentAttribute(XmlPersistentAttribute newPersistentAttribute) {
- if (newPersistentAttribute != persistentAttribute) {
- NotificationChain msgs = null;
- if (persistentAttribute != null)
- msgs = ((InternalEObject) persistentAttribute).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE, null, msgs);
- if (newPersistentAttribute != null)
- msgs = ((InternalEObject) newPersistentAttribute).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE, null, msgs);
- msgs = basicSetPersistentAttribute(newPersistentAttribute, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE, newPersistentAttribute, newPersistentAttribute));
- }
-
- public boolean isDefault() {
- return false;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE :
- return basicSetPersistentAttribute(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE :
- return getPersistentAttribute();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE :
- setPersistentAttribute((XmlPersistentAttribute) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE :
- setPersistentAttribute((XmlPersistentAttribute) null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE :
- return persistentAttribute != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * IMPORTANT: See XmlAttributeMapping class comment.
- * Subclasses should override this method to call the
- * appropriate initializeFrom___Mapping() method.
- */
- protected abstract void initializeOn(XmlAttributeMapping newMapping);
-
- public void initializeFromXmlAttributeMapping(XmlAttributeMapping oldMapping) {}
-
- public void initializeFromXmlBasicMapping(XmlBasic oldMapping) {
- initializeFromXmlAttributeMapping(oldMapping);
- }
-
- public void initializeFromXmlIdMapping(XmlId oldMapping) {
- initializeFromXmlAttributeMapping(oldMapping);
- }
-
- public void initializeFromXmlTransientMapping(XmlTransient oldMapping) {
- initializeFromXmlAttributeMapping(oldMapping);
- }
-
- public void initializeFromXmlEmbeddedMapping(XmlEmbedded oldMapping) {
- initializeFromXmlAttributeMapping(oldMapping);
- }
-
- public void initializeFromXmlEmbeddedIdMapping(XmlEmbeddedId oldMapping) {
- initializeFromXmlAttributeMapping(oldMapping);
- }
-
- public void initializeFromXmlVersionMapping(XmlVersion oldMapping) {
- initializeFromXmlAttributeMapping(oldMapping);
- }
-
- public void initializeFromXmlRelationshipMapping(XmlRelationshipMapping oldMapping) {
- initializeFromXmlAttributeMapping(oldMapping);
- }
-
- public void initializeFromXmlMulitRelationshipMapping(XmlMultiRelationshipMappingInternal oldMapping) {
- initializeFromXmlRelationshipMapping(oldMapping);
- }
-
- public void initializeFromXmlSingleRelationshipMapping(XmlSingleRelationshipMapping oldMapping) {
- initializeFromXmlRelationshipMapping(oldMapping);
- }
-
- public void initializeFromXmlOneToManyMapping(XmlOneToMany oldMapping) {
- initializeFromXmlMulitRelationshipMapping(oldMapping);
- }
-
- public void initializeFromXmlManyToOneMapping(XmlManyToOne oldMapping) {
- initializeFromXmlSingleRelationshipMapping(oldMapping);
- }
-
- public void initializeFromXmlOneToOneMapping(XmlOneToOne oldMapping) {
- initializeFromXmlSingleRelationshipMapping(oldMapping);
- }
-
- public void initializeFromXmlManyToManyMapping(XmlManyToMany oldMapping) {
- initializeFromXmlMulitRelationshipMapping(oldMapping);
- }
-
- public IJpaContentNode getContentNode(int offset) {
- return getPersistentAttribute();
- }
-
- /**
- * Attributes are a sequence in the orm schema. We must keep
- * the list of attributes in the appropriate order so the wtp xml
- * translators will write them to the xml in that order and they
- * will adhere to the schema.
- *
- * Each concrete subclass of XmlAttributeMapping must implement this
- * method and return an int that matches it's order in the schema
- * @return
- */
- public abstract int xmlSequence();
-
- public void refreshDefaults(DefaultsContext defaultsContext) {
- // do nothing
- }
-
- public String primaryKeyColumnName() {
- return null;
- }
-
- public XmlTypeMapping typeMapping() {
- return this.getPersistentType().getMapping();
- }
-
- public boolean isVirtual() {
- return getPersistentType().getVirtualAttributeMappings().contains(this);
- }
-
- public void setVirtual(boolean virtual) {
- getPersistentType().setMappingVirtual(this, virtual);
- }
-
- @Override
- public ITextRange validationTextRange() {
- return (this.isVirtual()) ? this.getPersistentType().attributesTextRange() : super.validationTextRange();
- }
-
- public ITextRange nameTextRange() {
- IDOMNode nameNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.NAME);
- return (nameNode != null) ? this.buildTextRange(nameNode) : this.validationTextRange();
- }
-
- public boolean isOverridableAttributeMapping() {
- return false;
- }
-
- public boolean isOverridableAssociationMapping() {
- return false;
- }
-
- public boolean isIdMapping() {
- return false;
- }
-
-
- public class ColumnOwner implements INamedColumn.Owner
- {
- public ITextRange validationTextRange() {
- return XmlAttributeMapping.this.validationTextRange();
- }
-
- public ITypeMapping getTypeMapping() {
- return XmlAttributeMapping.this.typeMapping();
- }
-
- public Table dbTable(String tableName) {
- return this.getTypeMapping().dbTable(tableName);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAttributeOverride.java
deleted file mode 100644
index bcd363009e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlAttributeOverride.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.Table;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Attribute Override</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlAttributeOverride()
- * @model kind="class"
- * @generated
- */
-public class XmlAttributeOverride extends XmlOverride
- implements IAttributeOverride, IXmlColumnMapping
-{
- /**
- * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getColumn()
- * @generated
- * @ordered
- */
- protected IColumn column;
-
- protected XmlAttributeOverride() {
- throw new UnsupportedOperationException();
- }
-
- protected XmlAttributeOverride(IOverride.Owner owner) {
- super(owner);
- this.column = OrmFactory.eINSTANCE.createXmlColumn(buildColumnOwner());
- ((InternalEObject) this.column).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN, null, null);
- }
-
- protected INamedColumn.Owner buildColumnOwner() {
- return new ColumnOwner();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_ATTRIBUTE_OVERRIDE;
- }
-
- /**
- * Returns the value of the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIAttributeOverride_Column()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- public IColumn getColumn() {
- return column;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetColumn(IColumn newColumn, NotificationChain msgs) {
- IColumn oldColumn = column;
- column = newColumn;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN, oldColumn, newColumn);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Returns the value of the '<em><b>Column For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column For Xml</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column For Xml</em>' reference.
- * @see #setColumnForXml(XmlColumn)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIXmlColumnMapping_ColumnForXml()
- * @model resolveProxies="false" volatile="true"
- * @generated NOT
- */
- public XmlColumn getColumnForXml() {
- if (((XmlColumn) getColumn()).isAllFeaturesUnset()) {
- return null;
- }
- return (XmlColumn) getColumn();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlAttributeOverride#getColumnForXml <em>Column For Xml</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Column For Xml</em>' reference.
- * @see #getColumnForXml()
- * @generated NOT
- */
- public void setColumnForXmlGen(XmlColumn newColumnForXml) {
- XmlColumn oldValue = newColumnForXml == null ? (XmlColumn) getColumn() : null;
- if (eNotificationRequired()) {
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN_FOR_XML, oldValue, newColumnForXml));
- }
- }
-
- public void setColumnForXml(XmlColumn newColumnForXml) {
- setColumnForXmlGen(newColumnForXml);
- if (newColumnForXml == null) {
- ((XmlColumn) getColumn()).unsetAllAttributes();
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated NOT
- */
- public void makeColumnForXmlNonNull() {
- setColumnForXmlGen(getColumnForXml());
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated NOT
- */
- public void makeColumnForXmlNull() {
- setColumnForXmlGen(null);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN :
- return basicSetColumn(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN :
- return getColumn();
- case OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN_FOR_XML :
- return getColumnForXml();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN_FOR_XML :
- setColumnForXml((XmlColumn) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN_FOR_XML :
- setColumnForXml((XmlColumn) null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN :
- return column != null;
- case OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN_FOR_XML :
- return getColumnForXml() != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IColumnMapping.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IAttributeOverride.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN :
- return JpaCoreMappingsPackage.IATTRIBUTE_OVERRIDE__COLUMN;
- default :
- return -1;
- }
- }
- if (baseClass == IXmlColumnMapping.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN_FOR_XML :
- return OrmPackage.IXML_COLUMN_MAPPING__COLUMN_FOR_XML;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IColumnMapping.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IAttributeOverride.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IATTRIBUTE_OVERRIDE__COLUMN :
- return OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN;
- default :
- return -1;
- }
- }
- if (baseClass == IXmlColumnMapping.class) {
- switch (baseFeatureID) {
- case OrmPackage.IXML_COLUMN_MAPPING__COLUMN_FOR_XML :
- return OrmPackage.XML_ATTRIBUTE_OVERRIDE__COLUMN_FOR_XML;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
-
- public class ColumnOwner implements INamedColumn.Owner
- {
- public ITextRange validationTextRange() {
- return XmlAttributeOverride.this.validationTextRange();
- }
-
- public ITypeMapping getTypeMapping() {
- return XmlAttributeOverride.this.getOwner().getTypeMapping();
- }
-
- public Table dbTable(String tablename) {
- return this.getTypeMapping().dbTable(column.getTable());
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlBasic.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlBasic.java
deleted file mode 100644
index 28d7b929c6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlBasic.java
+++ /dev/null
@@ -1,704 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.EnumType;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.TemporalType;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Basic</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlBasic()
- * @model kind="class"
- * @generated
- */
-public class XmlBasic extends XmlAttributeMapping
- implements IBasic, IXmlColumnMapping
-{
- /**
- * The default value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getFetch()
- * @generated
- * @ordered
- */
- protected static final DefaultEagerFetchType FETCH_EDEFAULT = DefaultEagerFetchType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getFetch()
- * @generated
- * @ordered
- */
- protected DefaultEagerFetchType fetch = FETCH_EDEFAULT;
-
- /**
- * The default value of the '{@link #getOptional() <em>Optional</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getOptional()
- * @generated
- * @ordered
- */
- protected static final DefaultTrueBoolean OPTIONAL_EDEFAULT = DefaultTrueBoolean.DEFAULT;
-
- /**
- * The cached value of the '{@link #getOptional() <em>Optional</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getOptional()
- * @generated
- * @ordered
- */
- protected DefaultTrueBoolean optional = OPTIONAL_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getColumn()
- * @generated
- * @ordered
- */
- protected IColumn column;
-
- /**
- * The default value of the '{@link #isLob() <em>Lob</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isLob()
- * @generated
- * @ordered
- */
- protected static final boolean LOB_EDEFAULT = false;
-
- /**
- * The cached value of the '{@link #isLob() <em>Lob</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isLob()
- * @generated
- * @ordered
- */
- protected boolean lob = LOB_EDEFAULT;
-
- /**
- * The default value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTemporal()
- * @generated
- * @ordered
- */
- protected static final TemporalType TEMPORAL_EDEFAULT = TemporalType.NULL;
-
- /**
- * The cached value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTemporal()
- * @generated
- * @ordered
- */
- protected TemporalType temporal = TEMPORAL_EDEFAULT;
-
- /**
- * The default value of the '{@link #getEnumerated() <em>Enumerated</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getEnumerated()
- * @generated
- * @ordered
- */
- protected static final EnumType ENUMERATED_EDEFAULT = EnumType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getEnumerated() <em>Enumerated</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getEnumerated()
- * @generated
- * @ordered
- */
- protected EnumType enumerated = ENUMERATED_EDEFAULT;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated NOT
- */
- protected XmlBasic() {
- super();
- this.column = OrmFactory.eINSTANCE.createXmlColumn(buildOwner());
- ((InternalEObject) this.column).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_BASIC__COLUMN, null, null);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_BASIC;
- }
-
- /**
- * Returns the value of the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIBasic_Column()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- public IColumn getColumn() {
- return column;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetColumn(IColumn newColumn, NotificationChain msgs) {
- IColumn oldColumn = column;
- column = newColumn;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_BASIC__COLUMN, oldColumn, newColumn);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Returns the value of the '<em><b>Fetch</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Fetch</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType
- * @see #setFetch(DefaultEagerFetchType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIBasic_Fetch()
- * @model
- * @generated
- */
- public DefaultEagerFetchType getFetch() {
- return fetch;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlBasic#getFetch <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType
- * @see #getFetch()
- * @generated
- */
- public void setFetch(DefaultEagerFetchType newFetch) {
- DefaultEagerFetchType oldFetch = fetch;
- fetch = newFetch == null ? FETCH_EDEFAULT : newFetch;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_BASIC__FETCH, oldFetch, fetch));
- }
-
- /**
- * Returns the value of the '<em><b>Optional</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Optional</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Optional</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setOptional(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIBasic_Optional()
- * @model
- * @generated
- */
- public DefaultTrueBoolean getOptional() {
- return optional;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlBasic#getOptional <em>Optional</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Optional</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getOptional()
- * @generated
- */
- public void setOptional(DefaultTrueBoolean newOptional) {
- DefaultTrueBoolean oldOptional = optional;
- optional = newOptional == null ? OPTIONAL_EDEFAULT : newOptional;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_BASIC__OPTIONAL, oldOptional, optional));
- }
-
- /**
- * Returns the value of the '<em><b>Lob</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Lob</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Lob</em>' attribute.
- * @see #setLob(boolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIBasic_Lob()
- * @model
- * @generated
- */
- public boolean isLob() {
- return lob;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlBasic#isLob <em>Lob</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Lob</em>' attribute.
- * @see #isLob()
- * @generated
- */
- public void setLob(boolean newLob) {
- boolean oldLob = lob;
- lob = newLob;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_BASIC__LOB, oldLob, lob));
- }
-
- /**
- * Returns the value of the '<em><b>Temporal</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.TemporalType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Temporal</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @see #setTemporal(TemporalType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIBasic_Temporal()
- * @model
- * @generated
- */
- public TemporalType getTemporal() {
- return temporal;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlBasic#getTemporal <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @see #getTemporal()
- * @generated
- */
- public void setTemporal(TemporalType newTemporal) {
- TemporalType oldTemporal = temporal;
- temporal = newTemporal == null ? TEMPORAL_EDEFAULT : newTemporal;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_BASIC__TEMPORAL, oldTemporal, temporal));
- }
-
- /**
- * Returns the value of the '<em><b>Enumerated</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.EnumType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Enumerated</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Enumerated</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.EnumType
- * @see #setEnumerated(EnumType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIBasic_Enumerated()
- * @model
- * @generated
- */
- public EnumType getEnumerated() {
- return enumerated;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlBasic#getEnumerated <em>Enumerated</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Enumerated</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.EnumType
- * @see #getEnumerated()
- * @generated
- */
- public void setEnumerated(EnumType newEnumerated) {
- EnumType oldEnumerated = enumerated;
- enumerated = newEnumerated == null ? ENUMERATED_EDEFAULT : newEnumerated;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_BASIC__ENUMERATED, oldEnumerated, enumerated));
- }
-
- /**
- * Returns the value of the '<em><b>Column For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column For Xml</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column For Xml</em>' reference.
- * @see #setColumnForXml(XmlColumn)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIXmlColumnMapping_ColumnForXml()
- * @model resolveProxies="false" volatile="true"
- * @generated NOT
- */
- public XmlColumn getColumnForXml() {
- if (((XmlColumn) getColumn()).isAllFeaturesUnset()) {
- return null;
- }
- return (XmlColumn) getColumn();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlBasic#getColumnForXml <em>Column For Xml</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Column For Xml</em>' reference.
- * @see #getColumnForXml()
- * @generated NOT
- */
- public void setColumnForXmlGen(XmlColumn newColumnForXml) {
- XmlColumn oldValue = newColumnForXml == null ? (XmlColumn) getColumn() : null;
- if (eNotificationRequired()) {
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_BASIC__COLUMN_FOR_XML, oldValue, newColumnForXml));
- }
- }
-
- public void setColumnForXml(XmlColumn newColumnForXml) {
- setColumnForXmlGen(newColumnForXml);
- if (newColumnForXml == null) {
- ((XmlColumn) getColumn()).unsetAllAttributes();
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated NOT
- */
- public void makeColumnForXmlNonNull() {
- setColumnForXmlGen(getColumnForXml());
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated NOT
- */
- public void makeColumnForXmlNull() {
- setColumnForXmlGen(null);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_BASIC__COLUMN :
- return basicSetColumn(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_BASIC__FETCH :
- return getFetch();
- case OrmPackage.XML_BASIC__OPTIONAL :
- return getOptional();
- case OrmPackage.XML_BASIC__COLUMN :
- return getColumn();
- case OrmPackage.XML_BASIC__LOB :
- return isLob() ? Boolean.TRUE : Boolean.FALSE;
- case OrmPackage.XML_BASIC__TEMPORAL :
- return getTemporal();
- case OrmPackage.XML_BASIC__ENUMERATED :
- return getEnumerated();
- case OrmPackage.XML_BASIC__COLUMN_FOR_XML :
- return getColumnForXml();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_BASIC__FETCH :
- setFetch((DefaultEagerFetchType) newValue);
- return;
- case OrmPackage.XML_BASIC__OPTIONAL :
- setOptional((DefaultTrueBoolean) newValue);
- return;
- case OrmPackage.XML_BASIC__LOB :
- setLob(((Boolean) newValue).booleanValue());
- return;
- case OrmPackage.XML_BASIC__TEMPORAL :
- setTemporal((TemporalType) newValue);
- return;
- case OrmPackage.XML_BASIC__ENUMERATED :
- setEnumerated((EnumType) newValue);
- return;
- case OrmPackage.XML_BASIC__COLUMN_FOR_XML :
- setColumnForXml((XmlColumn) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_BASIC__FETCH :
- setFetch(FETCH_EDEFAULT);
- return;
- case OrmPackage.XML_BASIC__OPTIONAL :
- setOptional(OPTIONAL_EDEFAULT);
- return;
- case OrmPackage.XML_BASIC__LOB :
- setLob(LOB_EDEFAULT);
- return;
- case OrmPackage.XML_BASIC__TEMPORAL :
- setTemporal(TEMPORAL_EDEFAULT);
- return;
- case OrmPackage.XML_BASIC__ENUMERATED :
- setEnumerated(ENUMERATED_EDEFAULT);
- return;
- case OrmPackage.XML_BASIC__COLUMN_FOR_XML :
- setColumnForXml((XmlColumn) null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_BASIC__FETCH :
- return fetch != FETCH_EDEFAULT;
- case OrmPackage.XML_BASIC__OPTIONAL :
- return optional != OPTIONAL_EDEFAULT;
- case OrmPackage.XML_BASIC__COLUMN :
- return column != null;
- case OrmPackage.XML_BASIC__LOB :
- return lob != LOB_EDEFAULT;
- case OrmPackage.XML_BASIC__TEMPORAL :
- return temporal != TEMPORAL_EDEFAULT;
- case OrmPackage.XML_BASIC__ENUMERATED :
- return enumerated != ENUMERATED_EDEFAULT;
- case OrmPackage.XML_BASIC__COLUMN_FOR_XML :
- return getColumnForXml() != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IColumnMapping.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IBasic.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_BASIC__FETCH :
- return JpaCoreMappingsPackage.IBASIC__FETCH;
- case OrmPackage.XML_BASIC__OPTIONAL :
- return JpaCoreMappingsPackage.IBASIC__OPTIONAL;
- case OrmPackage.XML_BASIC__COLUMN :
- return JpaCoreMappingsPackage.IBASIC__COLUMN;
- case OrmPackage.XML_BASIC__LOB :
- return JpaCoreMappingsPackage.IBASIC__LOB;
- case OrmPackage.XML_BASIC__TEMPORAL :
- return JpaCoreMappingsPackage.IBASIC__TEMPORAL;
- case OrmPackage.XML_BASIC__ENUMERATED :
- return JpaCoreMappingsPackage.IBASIC__ENUMERATED;
- default :
- return -1;
- }
- }
- if (baseClass == IXmlColumnMapping.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_BASIC__COLUMN_FOR_XML :
- return OrmPackage.IXML_COLUMN_MAPPING__COLUMN_FOR_XML;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IColumnMapping.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IBasic.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IBASIC__FETCH :
- return OrmPackage.XML_BASIC__FETCH;
- case JpaCoreMappingsPackage.IBASIC__OPTIONAL :
- return OrmPackage.XML_BASIC__OPTIONAL;
- case JpaCoreMappingsPackage.IBASIC__COLUMN :
- return OrmPackage.XML_BASIC__COLUMN;
- case JpaCoreMappingsPackage.IBASIC__LOB :
- return OrmPackage.XML_BASIC__LOB;
- case JpaCoreMappingsPackage.IBASIC__TEMPORAL :
- return OrmPackage.XML_BASIC__TEMPORAL;
- case JpaCoreMappingsPackage.IBASIC__ENUMERATED :
- return OrmPackage.XML_BASIC__ENUMERATED;
- default :
- return -1;
- }
- }
- if (baseClass == IXmlColumnMapping.class) {
- switch (baseFeatureID) {
- case OrmPackage.IXML_COLUMN_MAPPING__COLUMN_FOR_XML :
- return OrmPackage.XML_BASIC__COLUMN_FOR_XML;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (fetch: ");
- result.append(fetch);
- result.append(", optional: ");
- result.append(optional);
- result.append(", lob: ");
- result.append(lob);
- result.append(", temporal: ");
- result.append(temporal);
- result.append(", enumerated: ");
- result.append(enumerated);
- result.append(')');
- return result.toString();
- }
-
- public String getKey() {
- return IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- protected void initializeOn(XmlAttributeMapping newMapping) {
- newMapping.initializeFromXmlBasicMapping(this);
- }
-
- @Override
- public void initializeFromXmlIdMapping(XmlId oldMapping) {
- super.initializeFromXmlIdMapping(oldMapping);
- setTemporal(oldMapping.getTemporal());
- }
-
- @Override
- public int xmlSequence() {
- return 1;
- }
-
- @Override
- public boolean isOverridableAttributeMapping() {
- return true;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlCascade.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlCascade.java
deleted file mode 100644
index aac4d933ab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlCascade.java
+++ /dev/null
@@ -1,488 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.mappings.ICascade;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Cascade</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlCascade()
- * @model kind="class"
- * @generated
- */
-public class XmlCascade extends XmlEObject implements ICascade
-{
- /**
- * The default value of the '{@link #isAll() <em>All</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isAll()
- * @generated
- * @ordered
- */
- protected static final boolean ALL_EDEFAULT = false;
-
- /**
- * The cached value of the '{@link #isAll() <em>All</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isAll()
- * @generated
- * @ordered
- */
- protected boolean all = ALL_EDEFAULT;
-
- /**
- * The default value of the '{@link #isPersist() <em>Persist</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isPersist()
- * @generated
- * @ordered
- */
- protected static final boolean PERSIST_EDEFAULT = false;
-
- /**
- * The cached value of the '{@link #isPersist() <em>Persist</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isPersist()
- * @generated
- * @ordered
- */
- protected boolean persist = PERSIST_EDEFAULT;
-
- /**
- * The default value of the '{@link #isMerge() <em>Merge</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isMerge()
- * @generated
- * @ordered
- */
- protected static final boolean MERGE_EDEFAULT = false;
-
- /**
- * The cached value of the '{@link #isMerge() <em>Merge</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isMerge()
- * @generated
- * @ordered
- */
- protected boolean merge = MERGE_EDEFAULT;
-
- /**
- * The default value of the '{@link #isRemove() <em>Remove</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isRemove()
- * @generated
- * @ordered
- */
- protected static final boolean REMOVE_EDEFAULT = false;
-
- /**
- * The cached value of the '{@link #isRemove() <em>Remove</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isRemove()
- * @generated
- * @ordered
- */
- protected boolean remove = REMOVE_EDEFAULT;
-
- /**
- * The default value of the '{@link #isRefresh() <em>Refresh</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isRefresh()
- * @generated
- * @ordered
- */
- protected static final boolean REFRESH_EDEFAULT = false;
-
- /**
- * The cached value of the '{@link #isRefresh() <em>Refresh</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isRefresh()
- * @generated
- * @ordered
- */
- protected boolean refresh = REFRESH_EDEFAULT;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlCascade() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_CASCADE;
- }
-
- /**
- * Returns the value of the '<em><b>All</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>All</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>All</em>' attribute.
- * @see #setAll(boolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getICascade_All()
- * @model
- * @generated
- */
- public boolean isAll() {
- return all;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlCascade#isAll <em>All</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>All</em>' attribute.
- * @see #isAll()
- * @generated
- */
- public void setAll(boolean newAll) {
- boolean oldAll = all;
- all = newAll;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_CASCADE__ALL, oldAll, all));
- }
-
- /**
- * Returns the value of the '<em><b>Persist</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Persist</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persist</em>' attribute.
- * @see #setPersist(boolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getICascade_Persist()
- * @model
- * @generated
- */
- public boolean isPersist() {
- return persist;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlCascade#isPersist <em>Persist</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Persist</em>' attribute.
- * @see #isPersist()
- * @generated
- */
- public void setPersist(boolean newPersist) {
- boolean oldPersist = persist;
- persist = newPersist;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_CASCADE__PERSIST, oldPersist, persist));
- }
-
- /**
- * Returns the value of the '<em><b>Merge</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Merge</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Merge</em>' attribute.
- * @see #setMerge(boolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getICascade_Merge()
- * @model
- * @generated
- */
- public boolean isMerge() {
- return merge;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlCascade#isMerge <em>Merge</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Merge</em>' attribute.
- * @see #isMerge()
- * @generated
- */
- public void setMerge(boolean newMerge) {
- boolean oldMerge = merge;
- merge = newMerge;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_CASCADE__MERGE, oldMerge, merge));
- }
-
- /**
- * Returns the value of the '<em><b>Remove</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Remove</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Remove</em>' attribute.
- * @see #setRemove(boolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getICascade_Remove()
- * @model
- * @generated
- */
- public boolean isRemove() {
- return remove;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlCascade#isRemove <em>Remove</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Remove</em>' attribute.
- * @see #isRemove()
- * @generated
- */
- public void setRemove(boolean newRemove) {
- boolean oldRemove = remove;
- remove = newRemove;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_CASCADE__REMOVE, oldRemove, remove));
- }
-
- /**
- * Returns the value of the '<em><b>Refresh</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Refresh</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Refresh</em>' attribute.
- * @see #setRefresh(boolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getICascade_Refresh()
- * @model
- * @generated
- */
- public boolean isRefresh() {
- return refresh;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlCascade#isRefresh <em>Refresh</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Refresh</em>' attribute.
- * @see #isRefresh()
- * @generated
- */
- public void setRefresh(boolean newRefresh) {
- boolean oldRefresh = refresh;
- refresh = newRefresh;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_CASCADE__REFRESH, oldRefresh, refresh));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_CASCADE__ALL :
- return isAll() ? Boolean.TRUE : Boolean.FALSE;
- case OrmPackage.XML_CASCADE__PERSIST :
- return isPersist() ? Boolean.TRUE : Boolean.FALSE;
- case OrmPackage.XML_CASCADE__MERGE :
- return isMerge() ? Boolean.TRUE : Boolean.FALSE;
- case OrmPackage.XML_CASCADE__REMOVE :
- return isRemove() ? Boolean.TRUE : Boolean.FALSE;
- case OrmPackage.XML_CASCADE__REFRESH :
- return isRefresh() ? Boolean.TRUE : Boolean.FALSE;
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_CASCADE__ALL :
- setAll(((Boolean) newValue).booleanValue());
- return;
- case OrmPackage.XML_CASCADE__PERSIST :
- setPersist(((Boolean) newValue).booleanValue());
- return;
- case OrmPackage.XML_CASCADE__MERGE :
- setMerge(((Boolean) newValue).booleanValue());
- return;
- case OrmPackage.XML_CASCADE__REMOVE :
- setRemove(((Boolean) newValue).booleanValue());
- return;
- case OrmPackage.XML_CASCADE__REFRESH :
- setRefresh(((Boolean) newValue).booleanValue());
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_CASCADE__ALL :
- setAll(ALL_EDEFAULT);
- return;
- case OrmPackage.XML_CASCADE__PERSIST :
- setPersist(PERSIST_EDEFAULT);
- return;
- case OrmPackage.XML_CASCADE__MERGE :
- setMerge(MERGE_EDEFAULT);
- return;
- case OrmPackage.XML_CASCADE__REMOVE :
- setRemove(REMOVE_EDEFAULT);
- return;
- case OrmPackage.XML_CASCADE__REFRESH :
- setRefresh(REFRESH_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_CASCADE__ALL :
- return all != ALL_EDEFAULT;
- case OrmPackage.XML_CASCADE__PERSIST :
- return persist != PERSIST_EDEFAULT;
- case OrmPackage.XML_CASCADE__MERGE :
- return merge != MERGE_EDEFAULT;
- case OrmPackage.XML_CASCADE__REMOVE :
- return remove != REMOVE_EDEFAULT;
- case OrmPackage.XML_CASCADE__REFRESH :
- return refresh != REFRESH_EDEFAULT;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == ICascade.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_CASCADE__ALL :
- return JpaCoreMappingsPackage.ICASCADE__ALL;
- case OrmPackage.XML_CASCADE__PERSIST :
- return JpaCoreMappingsPackage.ICASCADE__PERSIST;
- case OrmPackage.XML_CASCADE__MERGE :
- return JpaCoreMappingsPackage.ICASCADE__MERGE;
- case OrmPackage.XML_CASCADE__REMOVE :
- return JpaCoreMappingsPackage.ICASCADE__REMOVE;
- case OrmPackage.XML_CASCADE__REFRESH :
- return JpaCoreMappingsPackage.ICASCADE__REFRESH;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == ICascade.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.ICASCADE__ALL :
- return OrmPackage.XML_CASCADE__ALL;
- case JpaCoreMappingsPackage.ICASCADE__PERSIST :
- return OrmPackage.XML_CASCADE__PERSIST;
- case JpaCoreMappingsPackage.ICASCADE__MERGE :
- return OrmPackage.XML_CASCADE__MERGE;
- case JpaCoreMappingsPackage.ICASCADE__REMOVE :
- return OrmPackage.XML_CASCADE__REMOVE;
- case JpaCoreMappingsPackage.ICASCADE__REFRESH :
- return OrmPackage.XML_CASCADE__REFRESH;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (all: ");
- result.append(all);
- result.append(", persist: ");
- result.append(persist);
- result.append(", merge: ");
- result.append(merge);
- result.append(", remove: ");
- result.append(remove);
- result.append(", refresh: ");
- result.append(refresh);
- result.append(')');
- return result.toString();
- }
-} // XmlCascade
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlColumn.java
deleted file mode 100644
index eddc97ac51..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlColumn.java
+++ /dev/null
@@ -1,751 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import java.util.Set;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Column</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlColumn#getLengthForXml <em>Length For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlColumn#getPrecisionForXml <em>Precision For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlColumn#getScaleForXml <em>Scale For Xml</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlColumn()
- * @model kind="class"
- * @generated
- */
-public class XmlColumn extends AbstractXmlColumn implements IColumn
-{
- /**
- * The default value of the '{@link #getLength() <em>Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getLength()
- * @generated
- * @ordered
- */
- protected static final int LENGTH_EDEFAULT = 0;
-
- /**
- * The default value of the '{@link #getSpecifiedLength() <em>Specified Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedLength()
- * @generated
- * @ordered
- */
- protected static final int SPECIFIED_LENGTH_EDEFAULT = -1;
-
- /**
- * The cached value of the '{@link #getSpecifiedLength() <em>Specified Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedLength()
- * @generated
- * @ordered
- */
- protected int specifiedLength = SPECIFIED_LENGTH_EDEFAULT;
-
- /**
- * The default value of the '{@link #getPrecision() <em>Precision</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPrecision()
- * @generated
- * @ordered
- */
- protected static final int PRECISION_EDEFAULT = 0;
-
- /**
- * The default value of the '{@link #getSpecifiedPrecision() <em>Specified Precision</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPrecision()
- * @generated
- * @ordered
- */
- protected static final int SPECIFIED_PRECISION_EDEFAULT = -1;
-
- /**
- * The cached value of the '{@link #getSpecifiedPrecision() <em>Specified Precision</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPrecision()
- * @generated
- * @ordered
- */
- protected int specifiedPrecision = SPECIFIED_PRECISION_EDEFAULT;
-
- /**
- * The default value of the '{@link #getScale() <em>Scale</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getScale()
- * @generated
- * @ordered
- */
- protected static final int SCALE_EDEFAULT = 0;
-
- /**
- * The default value of the '{@link #getSpecifiedScale() <em>Specified Scale</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedScale()
- * @generated
- * @ordered
- */
- protected static final int SPECIFIED_SCALE_EDEFAULT = -1;
-
- /**
- * The cached value of the '{@link #getSpecifiedScale() <em>Specified Scale</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedScale()
- * @generated
- * @ordered
- */
- protected int specifiedScale = SPECIFIED_SCALE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getLengthForXml() <em>Length For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getLengthForXml()
- * @generated
- * @ordered
- */
- protected static final int LENGTH_FOR_XML_EDEFAULT = 255;
-
- /**
- * The default value of the '{@link #getPrecisionForXml() <em>Precision For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPrecisionForXml()
- * @generated
- * @ordered
- */
- protected static final int PRECISION_FOR_XML_EDEFAULT = 0;
-
- /**
- * The default value of the '{@link #getScaleForXml() <em>Scale For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getScaleForXml()
- * @generated
- * @ordered
- */
- protected static final int SCALE_FOR_XML_EDEFAULT = 0;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlColumn() {
- super();
- }
-
- protected XmlColumn(IColumn.Owner owner) {
- super(owner);
- }
-
- @Override
- protected void addInsignificantXmlFeatureIdsTo(Set<Integer> insignificantXmlFeatureIds) {
- super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
- insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.ICOLUMN__LENGTH);
- insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.ICOLUMN__SCALE);
- insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.ICOLUMN__PRECISION);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_COLUMN;
- }
-
- public int getLength() {
- return (this.getSpecifiedLength() == SPECIFIED_LENGTH_EDEFAULT) ? getDefaultLength() : this.getSpecifiedLength();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Length</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Length</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Length</em>' attribute.
- * @see #setSpecifiedLength(int)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIColumn_SpecifiedLength()
- * @model default="-1"
- * @generated
- */
- public int getSpecifiedLength() {
- return specifiedLength;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlColumn#getSpecifiedLength <em>Specified Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Length</em>' attribute.
- * @see #getSpecifiedLength()
- * @generated
- */
- public void setSpecifiedLengthGen(int newSpecifiedLength) {
- int oldSpecifiedLength = specifiedLength;
- specifiedLength = newSpecifiedLength;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_COLUMN__SPECIFIED_LENGTH, oldSpecifiedLength, specifiedLength));
- }
-
- public void setSpecifiedLength(int newSpecifiedLength) {
- setSpecifiedLengthGen(newSpecifiedLength);
- if (newSpecifiedLength != LENGTH_EDEFAULT) {
- getColumnMapping().makeColumnForXmlNonNull();
- }
- setLengthForXml(newSpecifiedLength);
- if (isAllFeaturesUnset()) {
- getColumnMapping().makeColumnForXmlNull();
- }
- }
-
- public int getPrecision() {
- return (this.getSpecifiedPrecision() == SPECIFIED_PRECISION_EDEFAULT) ? getDefaultPrecision() : this.getSpecifiedPrecision();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Precision</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Precision</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Precision</em>' attribute.
- * @see #setSpecifiedPrecision(int)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIColumn_SpecifiedPrecision()
- * @model default="-1"
- * @generated
- */
- public int getSpecifiedPrecision() {
- return specifiedPrecision;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlColumn#getSpecifiedPrecision <em>Specified Precision</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Precision</em>' attribute.
- * @see #getSpecifiedPrecision()
- * @generated
- */
- public void setSpecifiedPrecisionGen(int newSpecifiedPrecision) {
- int oldSpecifiedPrecision = specifiedPrecision;
- specifiedPrecision = newSpecifiedPrecision;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_COLUMN__SPECIFIED_PRECISION, oldSpecifiedPrecision, specifiedPrecision));
- }
-
- public void setSpecifiedPrecision(int newSpecifiedPrecision) {
- setSpecifiedPrecisionGen(newSpecifiedPrecision);
- if (newSpecifiedPrecision != PRECISION_EDEFAULT) {
- getColumnMapping().makeColumnForXmlNonNull();
- }
- setPrecisionForXml(newSpecifiedPrecision);
- if (isAllFeaturesUnset()) {
- getColumnMapping().makeColumnForXmlNull();
- }
- }
-
- public int getScale() {
- return (this.getSpecifiedScale() == SPECIFIED_SCALE_EDEFAULT) ? getDefaultScale() : this.getSpecifiedScale();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Scale</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Scale</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Scale</em>' attribute.
- * @see #setSpecifiedScale(int)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIColumn_SpecifiedScale()
- * @model default="-1"
- * @generated
- */
- public int getSpecifiedScale() {
- return specifiedScale;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlColumn#getSpecifiedScale <em>Specified Scale</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Scale</em>' attribute.
- * @see #getSpecifiedScale()
- * @generated
- */
- public void setSpecifiedScaleGen(int newSpecifiedScale) {
- int oldSpecifiedScale = specifiedScale;
- specifiedScale = newSpecifiedScale;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_COLUMN__SPECIFIED_SCALE, oldSpecifiedScale, specifiedScale));
- }
-
- public void setSpecifiedScale(int newSpecifiedScale) {
- setSpecifiedScaleGen(newSpecifiedScale);
- if (newSpecifiedScale != SCALE_EDEFAULT) {
- getColumnMapping().makeColumnForXmlNonNull();
- }
- setScaleForXml(newSpecifiedScale);
- if (isAllFeaturesUnset()) {
- getColumnMapping().makeColumnForXmlNull();
- }
- }
-
- /**
- * Returns the value of the '<em><b>Length For Xml</b></em>' attribute.
- * The default value is <code>"255"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Length For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Length For Xml</em>' attribute.
- * @see #setLengthForXml(int)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlColumn_LengthForXml()
- * @model default="255" volatile="true"
- * @generated NOT
- */
- public int getLengthForXml() {
- return getLength();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlColumn#getLengthForXml <em>Length For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Length For Xml</em>' attribute.
- * @see #getLengthForXml()
- * @generated NOT
- */
- public void setLengthForXml(int newLengthForXml) {
- setSpecifiedLengthGen(newLengthForXml);
- if (eNotificationRequired())
- //pass in oldValue of null because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_COLUMN__LENGTH_FOR_XML, null, newLengthForXml));
- }
-
- /**
- * Returns the value of the '<em><b>Precision For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Precision For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Precision For Xml</em>' attribute.
- * @see #setPrecisionForXml(int)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlColumn_PrecisionForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public int getPrecisionForXml() {
- return getPrecision();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlColumn#getPrecisionForXml <em>Precision For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Precision For Xml</em>' attribute.
- * @see #getPrecisionForXml()
- * @generated NOT
- */
- public void setPrecisionForXml(int newPrecisionForXml) {
- setSpecifiedPrecisionGen(newPrecisionForXml);
- if (eNotificationRequired())
- //pass in oldValue of null because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_COLUMN__PRECISION_FOR_XML, null, newPrecisionForXml));
- }
-
- /**
- * Returns the value of the '<em><b>Scale For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Scale For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Scale For Xml</em>' attribute.
- * @see #setScaleForXml(int)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlColumn_ScaleForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public int getScaleForXml() {
- return getScale();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlColumn#getScaleForXml <em>Scale For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Scale For Xml</em>' attribute.
- * @see #getScaleForXml()
- * @generated NOT
- */
- public void setScaleForXml(int newScaleForXml) {
- setSpecifiedScaleGen(newScaleForXml);
- if (eNotificationRequired())
- //pass in oldValue of null because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_COLUMN__SCALE_FOR_XML, null, newScaleForXml));
- }
-
- public int getDefaultLength() {
- return DEFAULT_LENGTH;
- }
-
- public int getDefaultPrecision() {
- return DEFAULT_PRECISION;
- }
-
- public int getDefaultScale() {
- return DEFAULT_SCALE;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_COLUMN__LENGTH :
- return new Integer(getLength());
- case OrmPackage.XML_COLUMN__SPECIFIED_LENGTH :
- return new Integer(getSpecifiedLength());
- case OrmPackage.XML_COLUMN__PRECISION :
- return new Integer(getPrecision());
- case OrmPackage.XML_COLUMN__SPECIFIED_PRECISION :
- return new Integer(getSpecifiedPrecision());
- case OrmPackage.XML_COLUMN__SCALE :
- return new Integer(getScale());
- case OrmPackage.XML_COLUMN__SPECIFIED_SCALE :
- return new Integer(getSpecifiedScale());
- case OrmPackage.XML_COLUMN__LENGTH_FOR_XML :
- return new Integer(getLengthForXml());
- case OrmPackage.XML_COLUMN__PRECISION_FOR_XML :
- return new Integer(getPrecisionForXml());
- case OrmPackage.XML_COLUMN__SCALE_FOR_XML :
- return new Integer(getScaleForXml());
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_COLUMN__SPECIFIED_LENGTH :
- setSpecifiedLength(((Integer) newValue).intValue());
- return;
- case OrmPackage.XML_COLUMN__SPECIFIED_PRECISION :
- setSpecifiedPrecision(((Integer) newValue).intValue());
- return;
- case OrmPackage.XML_COLUMN__SPECIFIED_SCALE :
- setSpecifiedScale(((Integer) newValue).intValue());
- return;
- case OrmPackage.XML_COLUMN__LENGTH_FOR_XML :
- setLengthForXml(((Integer) newValue).intValue());
- return;
- case OrmPackage.XML_COLUMN__PRECISION_FOR_XML :
- setPrecisionForXml(((Integer) newValue).intValue());
- return;
- case OrmPackage.XML_COLUMN__SCALE_FOR_XML :
- setScaleForXml(((Integer) newValue).intValue());
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_COLUMN__SPECIFIED_LENGTH :
- setSpecifiedLength(SPECIFIED_LENGTH_EDEFAULT);
- return;
- case OrmPackage.XML_COLUMN__SPECIFIED_PRECISION :
- setSpecifiedPrecision(SPECIFIED_PRECISION_EDEFAULT);
- return;
- case OrmPackage.XML_COLUMN__SPECIFIED_SCALE :
- setSpecifiedScale(SPECIFIED_SCALE_EDEFAULT);
- return;
- case OrmPackage.XML_COLUMN__LENGTH_FOR_XML :
- setLengthForXml(LENGTH_FOR_XML_EDEFAULT);
- return;
- case OrmPackage.XML_COLUMN__PRECISION_FOR_XML :
- setPrecisionForXml(PRECISION_FOR_XML_EDEFAULT);
- return;
- case OrmPackage.XML_COLUMN__SCALE_FOR_XML :
- setScaleForXml(SCALE_FOR_XML_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_COLUMN__LENGTH :
- return getLength() != LENGTH_EDEFAULT;
- case OrmPackage.XML_COLUMN__SPECIFIED_LENGTH :
- return specifiedLength != SPECIFIED_LENGTH_EDEFAULT;
- case OrmPackage.XML_COLUMN__PRECISION :
- return getPrecision() != PRECISION_EDEFAULT;
- case OrmPackage.XML_COLUMN__SPECIFIED_PRECISION :
- return specifiedPrecision != SPECIFIED_PRECISION_EDEFAULT;
- case OrmPackage.XML_COLUMN__SCALE :
- return getScale() != SCALE_EDEFAULT;
- case OrmPackage.XML_COLUMN__SPECIFIED_SCALE :
- return specifiedScale != SPECIFIED_SCALE_EDEFAULT;
- case OrmPackage.XML_COLUMN__LENGTH_FOR_XML :
- return getLengthForXml() != LENGTH_FOR_XML_EDEFAULT;
- case OrmPackage.XML_COLUMN__PRECISION_FOR_XML :
- return getPrecisionForXml() != PRECISION_FOR_XML_EDEFAULT;
- case OrmPackage.XML_COLUMN__SCALE_FOR_XML :
- return getScaleForXml() != SCALE_FOR_XML_EDEFAULT;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IColumn.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_COLUMN__LENGTH :
- return JpaCoreMappingsPackage.ICOLUMN__LENGTH;
- case OrmPackage.XML_COLUMN__SPECIFIED_LENGTH :
- return JpaCoreMappingsPackage.ICOLUMN__SPECIFIED_LENGTH;
- case OrmPackage.XML_COLUMN__PRECISION :
- return JpaCoreMappingsPackage.ICOLUMN__PRECISION;
- case OrmPackage.XML_COLUMN__SPECIFIED_PRECISION :
- return JpaCoreMappingsPackage.ICOLUMN__SPECIFIED_PRECISION;
- case OrmPackage.XML_COLUMN__SCALE :
- return JpaCoreMappingsPackage.ICOLUMN__SCALE;
- case OrmPackage.XML_COLUMN__SPECIFIED_SCALE :
- return JpaCoreMappingsPackage.ICOLUMN__SPECIFIED_SCALE;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IColumn.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.ICOLUMN__LENGTH :
- return OrmPackage.XML_COLUMN__LENGTH;
- case JpaCoreMappingsPackage.ICOLUMN__SPECIFIED_LENGTH :
- return OrmPackage.XML_COLUMN__SPECIFIED_LENGTH;
- case JpaCoreMappingsPackage.ICOLUMN__PRECISION :
- return OrmPackage.XML_COLUMN__PRECISION;
- case JpaCoreMappingsPackage.ICOLUMN__SPECIFIED_PRECISION :
- return OrmPackage.XML_COLUMN__SPECIFIED_PRECISION;
- case JpaCoreMappingsPackage.ICOLUMN__SCALE :
- return OrmPackage.XML_COLUMN__SCALE;
- case JpaCoreMappingsPackage.ICOLUMN__SPECIFIED_SCALE :
- return OrmPackage.XML_COLUMN__SPECIFIED_SCALE;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedLength: ");
- result.append(specifiedLength);
- result.append(", specifiedPrecision: ");
- result.append(specifiedPrecision);
- result.append(", specifiedScale: ");
- result.append(specifiedScale);
- result.append(')');
- return result.toString();
- }
-
- /**
- * Call this when the table tag is removed from the xml,
- * need to make sure all the model attributes are set to the default
- */
- protected void unsetAllAttributes() {
- eUnset(OrmPackage.XML_COLUMN__SPECIFIED_NAME);
- eUnset(OrmPackage.XML_COLUMN__SPECIFIED_TABLE);
- eUnset(OrmPackage.XML_COLUMN__COLUMN_DEFINITION);
- eUnset(OrmPackage.XML_COLUMN__INSERTABLE);
- eUnset(OrmPackage.XML_COLUMN__SPECIFIED_LENGTH);
- eUnset(OrmPackage.XML_COLUMN__NULLABLE);
- eUnset(OrmPackage.XML_COLUMN__SPECIFIED_PRECISION);
- eUnset(OrmPackage.XML_COLUMN__SPECIFIED_SCALE);
- eUnset(OrmPackage.XML_COLUMN__UNIQUE);
- eUnset(OrmPackage.XML_COLUMN__UPDATABLE);
- }
-
- public void setSpecifiedName(String newSpecifiedName) {
- setSpecifiedNameGen(newSpecifiedName);
- if (newSpecifiedName != SPECIFIED_NAME_EDEFAULT) {
- getColumnMapping().makeColumnForXmlNonNull();
- }
- setSpecifiedNameForXml(newSpecifiedName);
- if (isAllFeaturesUnset()) {
- getColumnMapping().makeColumnForXmlNull();
- }
- }
-
- public void setUnique(DefaultFalseBoolean newUnique) {
- setUniqueGen(newUnique);
- if (newUnique != UNIQUE_EDEFAULT) {
- getColumnMapping().makeColumnForXmlNonNull();
- }
- setUniqueForXml(newUnique);
- if (isAllFeaturesUnset()) {
- getColumnMapping().makeColumnForXmlNull();
- }
- }
-
- public void setNullable(DefaultTrueBoolean newNullable) {
- setNullableGen(newNullable);
- if (newNullable != NULLABLE_EDEFAULT) {
- getColumnMapping().makeColumnForXmlNonNull();
- }
- setNullableForXml(newNullable);
- if (isAllFeaturesUnset()) {
- getColumnMapping().makeColumnForXmlNull();
- }
- }
-
- public void setInsertable(DefaultTrueBoolean newInsertable) {
- setInsertableGen(newInsertable);
- if (newInsertable != INSERTABLE_EDEFAULT) {
- getColumnMapping().makeColumnForXmlNonNull();
- }
- setInsertableForXml(newInsertable);
- if (isAllFeaturesUnset()) {
- getColumnMapping().makeColumnForXmlNull();
- }
- }
-
- public void setUpdatable(DefaultTrueBoolean newUpdatable) {
- setUpdatableGen(newUpdatable);
- if (newUpdatable != UPDATABLE_EDEFAULT) {
- getColumnMapping().makeColumnForXmlNonNull();
- }
- setUpdatableForXml(newUpdatable);
- if (isAllFeaturesUnset()) {
- getColumnMapping().makeColumnForXmlNull();
- }
- }
-
- public void setColumnDefinition(String newColumnDefinition) {
- setColumnDefinitionGen(newColumnDefinition);
- if (newColumnDefinition != COLUMN_DEFINITION_EDEFAULT) {
- getColumnMapping().makeColumnForXmlNonNull();
- }
- setColumnDefinitionForXml(newColumnDefinition);
- if (isAllFeaturesUnset()) {
- getColumnMapping().makeColumnForXmlNull();
- }
- }
-
- public void setSpecifiedTable(String newSpecifiedTable) {
- setSpecifiedTableGen(newSpecifiedTable);
- if (newSpecifiedTable != SPECIFIED_TABLE_EDEFAULT) {
- getColumnMapping().makeColumnForXmlNonNull();
- }
- setSpecifiedTableForXml(newSpecifiedTable);
- if (isAllFeaturesUnset()) {
- getColumnMapping().makeColumnForXmlNull();
- }
- }
-
- protected IXmlColumnMapping getColumnMapping() {
- return (IXmlColumnMapping) eContainer();
- }
-
- public void refreshDefaults(DefaultsContext defaultsContext) {
- setDefaultTable((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_COLUMN_TABLE_KEY));
- setDefaultName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_COLUMN_NAME_KEY));
- }
-} // XmlColumn
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlDiscriminatorColumn.java
deleted file mode 100644
index e44f2cfebf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlDiscriminatorColumn.java
+++ /dev/null
@@ -1,519 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import java.util.Set;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.mappings.DiscriminatorType;
-import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Discriminator Column</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn#getDiscriminatorTypeForXml <em>Discriminator Type For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn#getSpecifiedLengthForXml <em>Specified Length For Xml</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlDiscriminatorColumn()
- * @model kind="class"
- * @generated
- */
-public class XmlDiscriminatorColumn extends AbstractXmlNamedColumn
- implements IDiscriminatorColumn
-{
- /**
- * The default value of the '{@link #getDiscriminatorType() <em>Discriminator Type</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDiscriminatorType()
- * @generated
- * @ordered
- */
- protected static final DiscriminatorType DISCRIMINATOR_TYPE_EDEFAULT = DiscriminatorType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getDiscriminatorType() <em>Discriminator Type</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDiscriminatorType()
- * @generated
- * @ordered
- */
- protected DiscriminatorType discriminatorType = DISCRIMINATOR_TYPE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultLength() <em>Default Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultLength()
- * @generated
- * @ordered
- */
- protected static final int DEFAULT_LENGTH_EDEFAULT = 31;
-
- /**
- * The cached value of the '{@link #getDefaultLength() <em>Default Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultLength()
- * @generated
- * @ordered
- */
- protected int defaultLength = DEFAULT_LENGTH_EDEFAULT;
-
- /**
- * The default value of the '{@link #getSpecifiedLength() <em>Specified Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedLength()
- * @generated
- * @ordered
- */
- protected static final int SPECIFIED_LENGTH_EDEFAULT = -1;
-
- /**
- * The cached value of the '{@link #getSpecifiedLength() <em>Specified Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedLength()
- * @generated
- * @ordered
- */
- protected int specifiedLength = SPECIFIED_LENGTH_EDEFAULT;
-
- /**
- * The default value of the '{@link #getLength() <em>Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getLength()
- * @generated
- * @ordered
- */
- protected static final int LENGTH_EDEFAULT = 0;
-
- /**
- * The default value of the '{@link #getDiscriminatorTypeForXml() <em>Discriminator Type For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDiscriminatorTypeForXml()
- * @generated
- * @ordered
- */
- protected static final DiscriminatorType DISCRIMINATOR_TYPE_FOR_XML_EDEFAULT = DiscriminatorType.DEFAULT;
-
- /**
- * The default value of the '{@link #getSpecifiedLengthForXml() <em>Specified Length For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedLengthForXml()
- * @generated
- * @ordered
- */
- protected static final int SPECIFIED_LENGTH_FOR_XML_EDEFAULT = -1;
-
- protected XmlDiscriminatorColumn() {
- throw new UnsupportedOperationException();
- }
-
- protected XmlDiscriminatorColumn(INamedColumn.Owner owner) {
- super(owner);
- }
-
- @Override
- protected void addInsignificantXmlFeatureIdsTo(Set<Integer> insignificantXmlFeatureIds) {
- super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
- insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__LENGTH);
- insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__DEFAULT_LENGTH);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_DISCRIMINATOR_COLUMN;
- }
-
- public void setSpecifiedName(String newSpecifiedName) {
- setSpecifiedNameGen(newSpecifiedName);
- if (newSpecifiedName != SPECIFIED_NAME_EDEFAULT) {
- entity().makeDiscriminatorColumnForXmlNonNull();
- }
- setSpecifiedNameForXml(newSpecifiedName);
- if (isAllFeaturesUnset()) {
- entity().makeDiscriminatorColumnForXmlNull();
- }
- }
-
- /**
- * Returns the value of the '<em><b>Discriminator Type</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DiscriminatorType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Discriminator Type</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Discriminator Type</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DiscriminatorType
- * @see #setDiscriminatorType(DiscriminatorType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIDiscriminatorColumn_DiscriminatorType()
- * @model
- * @generated
- */
- public DiscriminatorType getDiscriminatorType() {
- return discriminatorType;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn#getDiscriminatorType <em>Discriminator Type</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Discriminator Type</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DiscriminatorType
- * @see #getDiscriminatorType()
- * @generated
- */
- public void setDiscriminatorTypeGen(DiscriminatorType newDiscriminatorType) {
- DiscriminatorType oldDiscriminatorType = discriminatorType;
- discriminatorType = newDiscriminatorType == null ? DISCRIMINATOR_TYPE_EDEFAULT : newDiscriminatorType;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE, oldDiscriminatorType, discriminatorType));
- }
-
- public void setDiscriminatorType(DiscriminatorType newDiscriminatorType) {
- setDiscriminatorTypeGen(newDiscriminatorType);
- if (newDiscriminatorType != DISCRIMINATOR_TYPE_EDEFAULT) {
- entity().makeDiscriminatorColumnForXmlNonNull();
- }
- setDiscriminatorTypeForXml(newDiscriminatorType);
- if (isAllFeaturesUnset()) {
- entity().makeDiscriminatorColumnForXmlNull();
- }
- }
-
- public void setColumnDefinition(String newColumnDefinition) {
- setColumnDefinitionGen(newColumnDefinition);
- if (newColumnDefinition != COLUMN_DEFINITION_EDEFAULT) {
- entity().makeDiscriminatorColumnForXmlNonNull();
- }
- setColumnDefinitionForXml(newColumnDefinition);
- if (isAllFeaturesUnset()) {
- entity().makeDiscriminatorColumnForXmlNull();
- }
- }
-
- /**
- * Returns the value of the '<em><b>Default Length</b></em>' attribute.
- * The default value is <code>"31"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Length</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Length</em>' attribute.
- * @see #setDefaultLength(int)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIDiscriminatorColumn_DefaultLength()
- * @model default="31"
- * @generated
- */
- public int getDefaultLength() {
- return defaultLength;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn#getDefaultLength <em>Default Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Default Length</em>' attribute.
- * @see #getDefaultLength()
- * @generated
- */
- public void setDefaultLength(int newDefaultLength) {
- int oldDefaultLength = defaultLength;
- defaultLength = newDefaultLength;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_DISCRIMINATOR_COLUMN__DEFAULT_LENGTH, oldDefaultLength, defaultLength));
- }
-
- /**
- * Returns the value of the '<em><b>Specified Length</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Length</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Length</em>' attribute.
- * @see #setSpecifiedLength(int)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIDiscriminatorColumn_SpecifiedLength()
- * @model default="-1"
- * @generated
- */
- public int getSpecifiedLength() {
- return specifiedLength;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn#getSpecifiedLength <em>Specified Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Length</em>' attribute.
- * @see #getSpecifiedLength()
- * @generated
- */
- public void setSpecifiedLengthGen(int newSpecifiedLength) {
- int oldSpecifiedLength = specifiedLength;
- specifiedLength = newSpecifiedLength;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH, oldSpecifiedLength, specifiedLength));
- }
-
- public void setSpecifiedLength(int newSpecifiedLength) {
- setSpecifiedLengthGen(newSpecifiedLength);
- if (newSpecifiedLength != SPECIFIED_LENGTH_EDEFAULT) {
- entity().makeDiscriminatorColumnForXmlNonNull();
- }
- setSpecifiedLengthForXml(newSpecifiedLength);
- if (isAllFeaturesUnset()) {
- entity().makeDiscriminatorColumnForXmlNull();
- }
- }
-
- public int getLength() {
- return (this.specifiedLength != -1) ? this.specifiedLength : this.defaultLength;
- }
-
- public DiscriminatorType getDiscriminatorTypeForXml() {
- return getDiscriminatorType();
- }
-
- public void setDiscriminatorTypeForXml(DiscriminatorType newDiscriminatorTypeForXml) {
- setDiscriminatorTypeGen(newDiscriminatorTypeForXml);
- if (eNotificationRequired())
- //pass in oldValue of null because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE_FOR_XML, null, newDiscriminatorTypeForXml));
- }
-
- public int getSpecifiedLengthForXml() {
- return getSpecifiedLength();
- }
-
- public void setSpecifiedLengthForXml(int newSpecifiedLengthForXml) {
- setSpecifiedLengthGen(newSpecifiedLengthForXml);
- if (eNotificationRequired())
- //pass in oldValue of null because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH_FOR_XML, -1, newSpecifiedLengthForXml));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE :
- return getDiscriminatorType();
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__DEFAULT_LENGTH :
- return new Integer(getDefaultLength());
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH :
- return new Integer(getSpecifiedLength());
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__LENGTH :
- return new Integer(getLength());
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE_FOR_XML :
- return getDiscriminatorTypeForXml();
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH_FOR_XML :
- return new Integer(getSpecifiedLengthForXml());
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE :
- setDiscriminatorType((DiscriminatorType) newValue);
- return;
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__DEFAULT_LENGTH :
- setDefaultLength(((Integer) newValue).intValue());
- return;
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH :
- setSpecifiedLength(((Integer) newValue).intValue());
- return;
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE_FOR_XML :
- setDiscriminatorTypeForXml((DiscriminatorType) newValue);
- return;
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH_FOR_XML :
- setSpecifiedLengthForXml(((Integer) newValue).intValue());
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE :
- setDiscriminatorType(DISCRIMINATOR_TYPE_EDEFAULT);
- return;
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__DEFAULT_LENGTH :
- setDefaultLength(DEFAULT_LENGTH_EDEFAULT);
- return;
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH :
- setSpecifiedLength(SPECIFIED_LENGTH_EDEFAULT);
- return;
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE_FOR_XML :
- setDiscriminatorTypeForXml(DISCRIMINATOR_TYPE_FOR_XML_EDEFAULT);
- return;
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH_FOR_XML :
- setSpecifiedLengthForXml(SPECIFIED_LENGTH_FOR_XML_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE :
- return discriminatorType != DISCRIMINATOR_TYPE_EDEFAULT;
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__DEFAULT_LENGTH :
- return defaultLength != DEFAULT_LENGTH_EDEFAULT;
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH :
- return specifiedLength != SPECIFIED_LENGTH_EDEFAULT;
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__LENGTH :
- return getLength() != LENGTH_EDEFAULT;
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE_FOR_XML :
- return getDiscriminatorTypeForXml() != DISCRIMINATOR_TYPE_FOR_XML_EDEFAULT;
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH_FOR_XML :
- return getSpecifiedLengthForXml() != SPECIFIED_LENGTH_FOR_XML_EDEFAULT;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IDiscriminatorColumn.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE :
- return JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE;
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__DEFAULT_LENGTH :
- return JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__DEFAULT_LENGTH;
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH :
- return JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__SPECIFIED_LENGTH;
- case OrmPackage.XML_DISCRIMINATOR_COLUMN__LENGTH :
- return JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__LENGTH;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IDiscriminatorColumn.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE :
- return OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE;
- case JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__DEFAULT_LENGTH :
- return OrmPackage.XML_DISCRIMINATOR_COLUMN__DEFAULT_LENGTH;
- case JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__SPECIFIED_LENGTH :
- return OrmPackage.XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH;
- case JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__LENGTH :
- return OrmPackage.XML_DISCRIMINATOR_COLUMN__LENGTH;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (discriminatorType: ");
- result.append(discriminatorType);
- result.append(", defaultLength: ");
- result.append(defaultLength);
- result.append(", specifiedLength: ");
- result.append(specifiedLength);
- result.append(')');
- return result.toString();
- }
-
- private XmlEntityInternal entity() {
- return (XmlEntityInternal) eContainer();
- }
-
- @Override
- protected String tableName() {
- return this.getOwner().getTypeMapping().getTableName();
- }
-
- /**
- * Call this when the table tag is removed from the xml,
- * need to make sure all the model attributes are set to the default
- */
- protected void unsetAllAttributes() {
- eUnset(OrmPackage.XML_DISCRIMINATOR_COLUMN__SPECIFIED_LENGTH);
- eUnset(OrmPackage.XML_DISCRIMINATOR_COLUMN__SPECIFIED_NAME);
- eUnset(OrmPackage.XML_DISCRIMINATOR_COLUMN__COLUMN_DEFINITION);
- eUnset(OrmPackage.XML_DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddable.java
deleted file mode 100644
index 79f87f3a14..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddable.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import java.util.Iterator;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Embeddable</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEmbeddable()
- * @model kind="class"
- * @generated
- */
-public class XmlEmbeddable extends XmlTypeMapping implements IEmbeddable
-{
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlEmbeddable() {
- super();
- }
-
- public String getKey() {
- return IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_EMBEDDABLE;
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
- public Iterator associatedTableNamesIncludingInherited() {
- // TODO Auto-generated method stub
- return EmptyIterator.instance();
- }
-
- public Iterator associatedTables() {
- // TODO Auto-generated method stub
- return EmptyIterator.instance();
- }
-
- public Iterator associatedTablesIncludingInherited() {
- // TODO Auto-generated method stub
- return EmptyIterator.instance();
- }
-
- @Override
- public int xmlSequence() {
- return 2;
- }
-
- @Override
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- return attributeMappingKey == IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY || attributeMappingKey == IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbedded.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbedded.java
deleted file mode 100644
index 02b874bfe8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbedded.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.EObjectEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbedded;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddable;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Embedded</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEmbedded()
- * @model kind="class"
- * @generated
- */
-public class XmlEmbedded extends XmlAttributeMapping implements IEmbedded
-{
- /**
- * The cached value of the '{@link #getSpecifiedAttributeOverrides() <em>Specified Attribute Overrides</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedAttributeOverrides()
- * @generated
- * @ordered
- */
- protected EList<IAttributeOverride> specifiedAttributeOverrides;
-
- /**
- * The cached value of the '{@link #getDefaultAttributeOverrides() <em>Default Attribute Overrides</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultAttributeOverrides()
- * @generated
- * @ordered
- */
- protected EList<IAttributeOverride> defaultAttributeOverrides;
-
- private IEmbeddable embeddable;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlEmbedded() {
- super();
- }
-
- @Override
- protected void addInsignificantFeatureIdsTo(Set<Integer> insignificantFeatureIds) {
- super.addInsignificantFeatureIdsTo(insignificantFeatureIds);
- insignificantFeatureIds.add(OrmPackage.XML_EMBEDDED__ATTRIBUTE_OVERRIDES);
- }
-
- @Override
- protected void initializeOn(XmlAttributeMapping newMapping) {
- newMapping.initializeFromXmlEmbeddedMapping(this);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_EMBEDDED;
- }
-
- public EList<IAttributeOverride> getAttributeOverrides() {
- EList<IAttributeOverride> list = new EObjectEList<IAttributeOverride>(IAttributeOverride.class, this, OrmPackage.XML_EMBEDDED__ATTRIBUTE_OVERRIDES);
- list.addAll(getSpecifiedAttributeOverrides());
- list.addAll(getDefaultAttributeOverrides());
- return list;
- }
-
- /**
- * Returns the value of the '<em><b>Specified Attribute Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Attribute Overrides</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Attribute Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEmbedded_SpecifiedAttributeOverrides()
- * @model containment="true"
- * @generated
- */
- public EList<IAttributeOverride> getSpecifiedAttributeOverrides() {
- if (specifiedAttributeOverrides == null) {
- specifiedAttributeOverrides = new EObjectContainmentEList<IAttributeOverride>(IAttributeOverride.class, this, OrmPackage.XML_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES);
- }
- return specifiedAttributeOverrides;
- }
-
- /**
- * Returns the value of the '<em><b>Default Attribute Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Attribute Overrides</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Attribute Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEmbedded_DefaultAttributeOverrides()
- * @model containment="true"
- * @generated
- */
- public EList<IAttributeOverride> getDefaultAttributeOverrides() {
- if (defaultAttributeOverrides == null) {
- defaultAttributeOverrides = new EObjectContainmentEList<IAttributeOverride>(IAttributeOverride.class, this, OrmPackage.XML_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES);
- }
- return defaultAttributeOverrides;
- }
-
- public IEmbeddable embeddable() {
- return this.embeddable;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_EMBEDDED__ATTRIBUTE_OVERRIDES :
- return ((InternalEList<?>) getAttributeOverrides()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return ((InternalEList<?>) getSpecifiedAttributeOverrides()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES :
- return ((InternalEList<?>) getDefaultAttributeOverrides()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_EMBEDDED__ATTRIBUTE_OVERRIDES :
- return getAttributeOverrides();
- case OrmPackage.XML_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return getSpecifiedAttributeOverrides();
- case OrmPackage.XML_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES :
- return getDefaultAttributeOverrides();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- getSpecifiedAttributeOverrides().clear();
- getSpecifiedAttributeOverrides().addAll((Collection<? extends IAttributeOverride>) newValue);
- return;
- case OrmPackage.XML_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES :
- getDefaultAttributeOverrides().clear();
- getDefaultAttributeOverrides().addAll((Collection<? extends IAttributeOverride>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- getSpecifiedAttributeOverrides().clear();
- return;
- case OrmPackage.XML_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES :
- getDefaultAttributeOverrides().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_EMBEDDED__ATTRIBUTE_OVERRIDES :
- return !getAttributeOverrides().isEmpty();
- case OrmPackage.XML_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return specifiedAttributeOverrides != null && !specifiedAttributeOverrides.isEmpty();
- case OrmPackage.XML_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES :
- return defaultAttributeOverrides != null && !defaultAttributeOverrides.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IEmbedded.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_EMBEDDED__ATTRIBUTE_OVERRIDES :
- return JpaCoreMappingsPackage.IEMBEDDED__ATTRIBUTE_OVERRIDES;
- case OrmPackage.XML_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return JpaCoreMappingsPackage.IEMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES;
- case OrmPackage.XML_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES :
- return JpaCoreMappingsPackage.IEMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IEmbedded.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IEMBEDDED__ATTRIBUTE_OVERRIDES :
- return OrmPackage.XML_EMBEDDED__ATTRIBUTE_OVERRIDES;
- case JpaCoreMappingsPackage.IEMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return OrmPackage.XML_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES;
- case JpaCoreMappingsPackage.IEMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES :
- return OrmPackage.XML_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- @Override
- public int xmlSequence() {
- return 7;
- }
-
- public String getKey() {
- return IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
- }
-
- public IAttributeOverride attributeOverrideNamed(String name) {
- return (IAttributeOverride) overrideNamed(name, getAttributeOverrides());
- }
-
- public boolean containsAttributeOverride(String name) {
- return containsOverride(name, getAttributeOverrides());
- }
-
- public boolean containsSpecifiedAttributeOverride(String name) {
- return containsOverride(name, getSpecifiedAttributeOverrides());
- }
-
- private IOverride overrideNamed(String name, List<? extends IOverride> overrides) {
- for (IOverride override : overrides) {
- String overrideName = override.getName();
- if (overrideName == null && name == null) {
- return override;
- }
- if (overrideName != null && overrideName.equals(name)) {
- return override;
- }
- }
- return null;
- }
-
- private boolean containsOverride(String name, List<? extends IOverride> overrides) {
- return overrideNamed(name, overrides) != null;
- }
-
- public Iterator<String> allOverridableAttributeNames() {
- return new TransformationIterator<IPersistentAttribute, String>(this.allOverridableAttributes()) {
- @Override
- protected String transform(IPersistentAttribute attribute) {
- return attribute.getName();
- }
- };
- }
-
- public Iterator<IPersistentAttribute> allOverridableAttributes() {
- if (this.embeddable() == null) {
- return EmptyIterator.instance();
- }
- return new FilteringIterator<IPersistentAttribute>(this.embeddable().getPersistentType().attributes()) {
- @Override
- protected boolean accept(Object o) {
- return ((IPersistentAttribute) o).isOverridableAttribute();
- }
- };
- }
-
- public IAttributeOverride createAttributeOverride(int index) {
- return OrmFactory.eINSTANCE.createXmlAttributeOverride(new AttributeOverrideOwner(this));
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext) {
- super.refreshDefaults(defaultsContext);
- refreshEmbeddable(defaultsContext);
- }
-
- private void refreshEmbeddable(DefaultsContext defaultsContext) {
- this.embeddable = embeddableFor(getPersistentAttribute().getAttribute(), defaultsContext);
- }
-
- //******* static methods *********
- public static IEmbeddable embeddableFor(Attribute attribute, DefaultsContext defaultsContext) {
- if (attribute == null) {
- return null;
- }
- return JavaEmbedded.embeddableFor(attribute, defaultsContext);
- }
-} // XmlEmbedded
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddedIdProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddedIdProvider.java
deleted file mode 100644
index 3327620b6a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddedIdProvider.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import org.eclipse.jpt.core.internal.IMappingKeys;
-
-public class XmlEmbeddedIdProvider implements IXmlAttributeMappingProvider
-{
- // singleton
- private static final XmlEmbeddedIdProvider INSTANCE = new XmlEmbeddedIdProvider();
-
- /**
- * Return the singleton.
- */
- public static IXmlAttributeMappingProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private XmlEmbeddedIdProvider() {
- super();
- }
-
- public XmlAttributeMapping buildAttributeMapping() {
- return OrmFactory.eINSTANCE.createXmlEmbeddedId();
- }
-
- public String key() {
- return IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntity.java
deleted file mode 100644
index ff4274b0e5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntity.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Entity</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlEntity#getSecondaryTables <em>Secondary Tables</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlEntity#getVirtualSecondaryTables <em>Virtual Secondary Tables</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntity()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface XmlEntity extends IEntity
-{
- /**
- * Returns the value of the '<em><b>Secondary Tables</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Secondary Tables</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Secondary Tables</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntity_SecondaryTables()
- * @model containment="true" transient="true" changeable="false" volatile="true"
- * @generated
- */
- EList<ISecondaryTable> getSecondaryTables();
-
- /**
- * Returns the value of the '<em><b>Virtual Secondary Tables</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Virtual Secondary Tables</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Virtual Secondary Tables</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntity_VirtualSecondaryTables()
- * @model containment="true"
- * @generated
- */
- EList<ISecondaryTable> getVirtualSecondaryTables();
-} // XmlEntity
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityForXml.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityForXml.java
deleted file mode 100644
index 20578b091d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityForXml.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Entity For Xml</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml#getTableForXml <em>Table For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml#getDiscriminatorColumnForXml <em>Discriminator Column For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml#getIdClassForXml <em>Id Class For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml#getInheritanceForXml <em>Inheritance For Xml</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntityForXml()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface XmlEntityForXml extends EObject
-{
- /**
- * Returns the value of the '<em><b>Table For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table For Xml</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table For Xml</em>' reference.
- * @see #setTableForXml(XmlTable)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntityForXml_TableForXml()
- * @model resolveProxies="false" volatile="true"
- * @generated
- */
- XmlTable getTableForXml();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml#getTableForXml <em>Table For Xml</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Table For Xml</em>' reference.
- * @see #getTableForXml()
- * @generated
- */
- void setTableForXml(XmlTable value);
-
- /**
- * Returns the value of the '<em><b>Discriminator Column For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Discriminator Column For Xml</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Discriminator Column For Xml</em>' reference.
- * @see #setDiscriminatorColumnForXml(XmlDiscriminatorColumn)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntityForXml_DiscriminatorColumnForXml()
- * @model resolveProxies="false" volatile="true"
- * @generated
- */
- XmlDiscriminatorColumn getDiscriminatorColumnForXml();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml#getDiscriminatorColumnForXml <em>Discriminator Column For Xml</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Discriminator Column For Xml</em>' reference.
- * @see #getDiscriminatorColumnForXml()
- * @generated
- */
- void setDiscriminatorColumnForXml(XmlDiscriminatorColumn value);
-
- /**
- * Returns the value of the '<em><b>Id Class For Xml</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Id Class For Xml</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Id Class For Xml</em>' containment reference.
- * @see #setIdClassForXml(XmlIdClass)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntityForXml_IdClassForXml()
- * @model containment="true"
- * @generated
- */
- XmlIdClass getIdClassForXml();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml#getIdClassForXml <em>Id Class For Xml</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Id Class For Xml</em>' containment reference.
- * @see #getIdClassForXml()
- * @generated
- */
- void setIdClassForXml(XmlIdClass value);
-
- /**
- * Returns the value of the '<em><b>Inheritance For Xml</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Inheritance For Xml</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Inheritance For Xml</em>' containment reference.
- * @see #setInheritanceForXml(XmlInheritance)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntityForXml_InheritanceForXml()
- * @model containment="true"
- * @generated
- */
- XmlInheritance getInheritanceForXml();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml#getInheritanceForXml <em>Inheritance For Xml</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Inheritance For Xml</em>' containment reference.
- * @see #getInheritanceForXml()
- * @generated
- */
- void setInheritanceForXml(XmlInheritance value);
-} // XmlEntityForXml
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityInternal.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityInternal.java
deleted file mode 100644
index 735531cf81..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityInternal.java
+++ /dev/null
@@ -1,2177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.EObjectEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.INamedNativeQuery;
-import org.eclipse.jpt.core.internal.mappings.INamedQuery;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.mappings.InheritanceType;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Xml Entity</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntityInternal()
- * @model kind="class"
- * @generated
- */
-public class XmlEntityInternal extends XmlTypeMapping
- implements XmlEntityForXml, XmlEntity
-{
- /**
- * The cached value of the '{@link #getIdClassForXml() <em>Id Class For Xml</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getIdClassForXml()
- * @generated
- * @ordered
- */
- protected XmlIdClass idClassForXml;
-
- /**
- * The cached value of the '{@link #getInheritanceForXml() <em>Inheritance For Xml</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getInheritanceForXml()
- * @generated
- * @ordered
- */
- protected XmlInheritance inheritanceForXml;
-
- /**
- * The default value of the '{@link #getSpecifiedName() <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedName()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedName() <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedName()
- * @generated
- * @ordered
- */
- protected String specifiedName = SPECIFIED_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultName() <em>Default Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultName()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultName() <em>Default Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultName()
- * @generated
- * @ordered
- */
- protected String defaultName = DEFAULT_NAME_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getTable() <em>Table</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTable()
- * @generated
- * @ordered
- */
- protected ITable table;
-
- /**
- * The cached value of the '{@link #getSpecifiedSecondaryTables() <em>Specified Secondary Tables</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSecondaryTables()
- * @generated
- * @ordered
- */
- protected EList<ISecondaryTable> specifiedSecondaryTables;
-
- /**
- * The cached value of the '{@link #getSpecifiedPrimaryKeyJoinColumns() <em>Specified Primary Key Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPrimaryKeyJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns;
-
- /**
- * The cached value of the '{@link #getDefaultPrimaryKeyJoinColumns() <em>Default Primary Key Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultPrimaryKeyJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns;
-
- /**
- * The default value of the '{@link #getInheritanceStrategy() <em>Inheritance Strategy</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getInheritanceStrategy()
- * @generated
- * @ordered
- */
- protected static final InheritanceType INHERITANCE_STRATEGY_EDEFAULT = InheritanceType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getInheritanceStrategy() <em>Inheritance Strategy</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getInheritanceStrategy()
- * @generated
- * @ordered
- */
- protected InheritanceType inheritanceStrategy = INHERITANCE_STRATEGY_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultDiscriminatorValue() <em>Default Discriminator Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultDiscriminatorValue()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_DISCRIMINATOR_VALUE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultDiscriminatorValue() <em>Default Discriminator Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultDiscriminatorValue()
- * @generated
- * @ordered
- */
- protected String defaultDiscriminatorValue = DEFAULT_DISCRIMINATOR_VALUE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getSpecifiedDiscriminatorValue() <em>Specified Discriminator Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedDiscriminatorValue()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_DISCRIMINATOR_VALUE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedDiscriminatorValue() <em>Specified Discriminator Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedDiscriminatorValue()
- * @generated
- * @ordered
- */
- protected String specifiedDiscriminatorValue = SPECIFIED_DISCRIMINATOR_VALUE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDiscriminatorValue() <em>Discriminator Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDiscriminatorValue()
- * @generated
- * @ordered
- */
- protected static final String DISCRIMINATOR_VALUE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDiscriminatorColumn() <em>Discriminator Column</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDiscriminatorColumn()
- * @generated
- * @ordered
- */
- protected IDiscriminatorColumn discriminatorColumn;
-
- /**
- * The cached value of the '{@link #getSequenceGenerator() <em>Sequence Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSequenceGenerator()
- * @generated
- * @ordered
- */
- protected ISequenceGenerator sequenceGenerator;
-
- /**
- * The cached value of the '{@link #getTableGenerator() <em>Table Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTableGenerator()
- * @generated
- * @ordered
- */
- protected ITableGenerator tableGenerator;
-
- /**
- * The cached value of the '{@link #getSpecifiedAttributeOverrides() <em>Specified Attribute Overrides</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedAttributeOverrides()
- * @generated
- * @ordered
- */
- protected EList<IAttributeOverride> specifiedAttributeOverrides;
-
- /**
- * The cached value of the '{@link #getDefaultAttributeOverrides() <em>Default Attribute Overrides</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultAttributeOverrides()
- * @generated
- * @ordered
- */
- protected EList<IAttributeOverride> defaultAttributeOverrides;
-
- /**
- * The cached value of the '{@link #getSpecifiedAssociationOverrides() <em>Specified Association Overrides</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedAssociationOverrides()
- * @generated
- * @ordered
- */
- protected EList<IAssociationOverride> specifiedAssociationOverrides;
-
- /**
- * The cached value of the '{@link #getDefaultAssociationOverrides() <em>Default Association Overrides</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultAssociationOverrides()
- * @generated
- * @ordered
- */
- protected EList<IAssociationOverride> defaultAssociationOverrides;
-
- /**
- * The cached value of the '{@link #getNamedQueries() <em>Named Queries</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getNamedQueries()
- * @generated
- * @ordered
- */
- protected EList<INamedQuery> namedQueries;
-
- /**
- * The cached value of the '{@link #getNamedNativeQueries() <em>Named Native Queries</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getNamedNativeQueries()
- * @generated
- * @ordered
- */
- protected EList<INamedNativeQuery> namedNativeQueries;
-
- /**
- * The default value of the '{@link #getIdClass() <em>Id Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getIdClass()
- * @generated
- * @ordered
- */
- protected static final String ID_CLASS_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getIdClass() <em>Id Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getIdClass()
- * @generated
- * @ordered
- */
- protected String idClass = ID_CLASS_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getVirtualSecondaryTables() <em>Virtual Secondary Tables</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getVirtualSecondaryTables()
- * @generated
- * @ordered
- */
- protected EList<ISecondaryTable> virtualSecondaryTables;
-
- protected XmlEntityInternal() {
- super();
- this.table = OrmFactory.eINSTANCE.createXmlTable(buildTableOwner());
- ((InternalEObject) this.table).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY_INTERNAL__TABLE, null, null);
- this.discriminatorColumn = OrmFactory.eINSTANCE.createXmlDiscriminatorColumn(new IDiscriminatorColumn.Owner(this));
- ((InternalEObject) this.discriminatorColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN, null, null);
- this.getDefaultPrimaryKeyJoinColumns().add(this.createPrimaryKeyJoinColumn(0));
- this.eAdapters().add(this.buildListener());
- }
-
- protected Adapter buildListener() {
- return new AdapterImpl() {
- @Override
- public void notifyChanged(Notification notification) {
- XmlEntityInternal.this.notifyChanged(notification);
- }
- };
- }
-
- protected void notifyChanged(Notification notification) {
- switch (notification.getFeatureID(IEntity.class)) {
- case JpaCoreMappingsPackage.IENTITY__ID_CLASS :
- idClassChanged();
- break;
- case JpaCoreMappingsPackage.IENTITY__INHERITANCE_STRATEGY :
- inheritanceStrategyChanged();
- break;
- default :
- break;
- }
- switch (notification.getFeatureID(XmlEntityForXml.class)) {
- case OrmPackage.XML_ENTITY_FOR_XML__ID_CLASS_FOR_XML :
- xmlIdClassChanged();
- break;
- case OrmPackage.XML_ENTITY_FOR_XML__INHERITANCE_FOR_XML :
- xmlInheritanceChanged();
- break;
- default :
- break;
- }
- }
-
- protected void inheritanceStrategyChanged() {
- if (getInheritanceStrategy() == InheritanceType.DEFAULT) {
- setInheritanceForXml(null);
- }
- else {
- if (getInheritanceForXml() == null) {
- setInheritanceForXml(OrmFactory.eINSTANCE.createXmlInheritance());
- }
- getInheritanceForXml().setStrategy(getInheritanceStrategy());
- }
- }
-
- protected void xmlInheritanceChanged() {
- if (getInheritanceForXml() == null) {
- setInheritanceStrategy(null);
- }
- }
-
- @Override
- protected void addInsignificantFeatureIdsTo(Set<Integer> insignificantFeatureIds) {
- super.addInsignificantFeatureIdsTo(insignificantFeatureIds);
- insignificantFeatureIds.add(OrmPackage.XML_ENTITY_INTERNAL__SECONDARY_TABLES);
- insignificantFeatureIds.add(OrmPackage.XML_ENTITY_INTERNAL__ATTRIBUTE_OVERRIDES);
- insignificantFeatureIds.add(OrmPackage.XML_ENTITY_INTERNAL__ASSOCIATION_OVERRIDES);
- }
-
- private ITable.Owner buildTableOwner() {
- return new ITable.Owner() {
- public ITextRange validationTextRange() {
- return XmlEntityInternal.this.validationTextRange();
- }
-
- public ITypeMapping getTypeMapping() {
- return XmlEntityInternal.this;
- }
- };
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_ENTITY_INTERNAL;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated NOT
- */
- public String getName() {
- return (this.getSpecifiedName() == null) ? getDefaultName() : this.getSpecifiedName();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Name</em>' attribute.
- * @see #setSpecifiedName(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_SpecifiedName()
- * @model
- * @generated
- */
- public String getSpecifiedName() {
- return specifiedName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal#getSpecifiedName <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Name</em>' attribute.
- * @see #getSpecifiedName()
- * @generated
- */
- public void setSpecifiedName(String newSpecifiedName) {
- String oldSpecifiedName = specifiedName;
- specifiedName = newSpecifiedName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_NAME, oldSpecifiedName, specifiedName));
- }
-
- /**
- * Returns the value of the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_DefaultName()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultName() {
- return defaultName;
- }
-
- /**
- * Returns the value of the '<em><b>Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_Table()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- public ITable getTable() {
- return table;
- }
-
- private XmlTable getTableInternal() {
- return (XmlTable) getTable();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetTable(ITable newTable, NotificationChain msgs) {
- ITable oldTable = table;
- table = newTable;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__TABLE, oldTable, newTable);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Returns the value of the '<em><b>Secondary Tables</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Secondary Tables</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Secondary Tables</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntity_SecondaryTables()
- * @model type="org.eclipse.jpt.core.internal.mappings.ISecondaryTable" containment="true" transient="true" changeable="false" volatile="true"
- * @generated NOT
- */
- public EList<ISecondaryTable> getSecondaryTables() {
- EList<ISecondaryTable> list = new EObjectEList<ISecondaryTable>(ISecondaryTable.class, this, OrmPackage.XML_ENTITY_INTERNAL__SECONDARY_TABLES);
- list.addAll(getSpecifiedSecondaryTables());
- list.addAll(getVirtualSecondaryTables());
- return list;
- }
-
- /**
- * Returns the value of the '<em><b>Virtual Secondary Tables</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Virtual Secondary Tables</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Virtual Secondary Tables</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntity_VirtualSecondaryTables()
- * @model containment="true"
- * @generated
- */
- public EList<ISecondaryTable> getVirtualSecondaryTables() {
- if (virtualSecondaryTables == null) {
- virtualSecondaryTables = new EObjectContainmentEList<ISecondaryTable>(ISecondaryTable.class, this, OrmPackage.XML_ENTITY_INTERNAL__VIRTUAL_SECONDARY_TABLES);
- }
- return virtualSecondaryTables;
- }
-
- protected void xmlIdClassChanged() {
- if (getIdClassForXml() == null) {
- setIdClass(null);
- }
- }
-
- public boolean containsSecondaryTable(String name) {
- return containsSecondaryTable(name, getSecondaryTables());
- }
-
- public boolean containsSpecifiedSecondaryTable(String name) {
- return containsSecondaryTable(name, getSpecifiedSecondaryTables());
- }
-
- private boolean containsSecondaryTable(String name, List<ISecondaryTable> secondaryTables) {
- for (ISecondaryTable secondaryTable : secondaryTables) {
- String secondaryTableName = secondaryTable.getName();
- if (secondaryTableName != null && secondaryTableName.equals(name)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns the value of the '<em><b>Specified Secondary Tables</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Secondary Tables</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Secondary Tables</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_SpecifiedSecondaryTables()
- * @model containment="true"
- * @generated
- */
- public EList<ISecondaryTable> getSpecifiedSecondaryTables() {
- if (specifiedSecondaryTables == null) {
- specifiedSecondaryTables = new EObjectContainmentEList<ISecondaryTable>(ISecondaryTable.class, this, OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_SECONDARY_TABLES);
- }
- return specifiedSecondaryTables;
- }
-
- /**
- * Returns the value of the '<em><b>Inheritance Strategy</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.InheritanceType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Inheritance Strategy</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Inheritance Strategy</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.InheritanceType
- * @see #setInheritanceStrategy(InheritanceType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_InheritanceStrategy()
- * @model
- * @generated
- */
- public InheritanceType getInheritanceStrategy() {
- return inheritanceStrategy;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal#getInheritanceStrategy <em>Inheritance Strategy</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Inheritance Strategy</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.InheritanceType
- * @see #getInheritanceStrategy()
- * @generated
- */
- public void setInheritanceStrategy(InheritanceType newInheritanceStrategy) {
- InheritanceType oldInheritanceStrategy = inheritanceStrategy;
- inheritanceStrategy = newInheritanceStrategy == null ? INHERITANCE_STRATEGY_EDEFAULT : newInheritanceStrategy;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_STRATEGY, oldInheritanceStrategy, inheritanceStrategy));
- }
-
- // public void setInheritanceStrategy(InheritanceType newInheritanceStrategy) {
- // setInheritanceStrategyGen(newInheritanceStrategy);
- // if (newInheritanceStrategy != INHERITANCE_STRATEGY_EDEFAULT) {
- // //makeInheritanceForXmlNonNull();
- // }
- // setInheritanceStrategyForXml(newInheritanceStrategy);
- // if (isAllFeaturesUnset()) {
- // //makeInheritanceForXmlNull();
- // }
- // }
- /**
- * Returns the value of the '<em><b>Discriminator Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Discriminator Column</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Discriminator Column</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_DiscriminatorColumn()
- * @model containment="true" changeable="false"
- * @generated
- */
- public IDiscriminatorColumn getDiscriminatorColumn() {
- return discriminatorColumn;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetDiscriminatorColumn(IDiscriminatorColumn newDiscriminatorColumn, NotificationChain msgs) {
- IDiscriminatorColumn oldDiscriminatorColumn = discriminatorColumn;
- discriminatorColumn = newDiscriminatorColumn;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN, oldDiscriminatorColumn, newDiscriminatorColumn);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Returns the value of the '<em><b>Sequence Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Sequence Generator</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Sequence Generator</em>' containment reference.
- * @see #setSequenceGenerator(ISequenceGenerator)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_SequenceGenerator()
- * @model containment="true"
- * @generated
- */
- public ISequenceGenerator getSequenceGenerator() {
- return sequenceGenerator;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetSequenceGenerator(ISequenceGenerator newSequenceGenerator, NotificationChain msgs) {
- ISequenceGenerator oldSequenceGenerator = sequenceGenerator;
- sequenceGenerator = newSequenceGenerator;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__SEQUENCE_GENERATOR, oldSequenceGenerator, newSequenceGenerator);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal#getSequenceGenerator <em>Sequence Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Sequence Generator</em>' containment reference.
- * @see #getSequenceGenerator()
- * @generated
- */
- public void setSequenceGenerator(ISequenceGenerator newSequenceGenerator) {
- if (newSequenceGenerator != sequenceGenerator) {
- NotificationChain msgs = null;
- if (sequenceGenerator != null)
- msgs = ((InternalEObject) sequenceGenerator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY_INTERNAL__SEQUENCE_GENERATOR, null, msgs);
- if (newSequenceGenerator != null)
- msgs = ((InternalEObject) newSequenceGenerator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY_INTERNAL__SEQUENCE_GENERATOR, null, msgs);
- msgs = basicSetSequenceGenerator(newSequenceGenerator, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__SEQUENCE_GENERATOR, newSequenceGenerator, newSequenceGenerator));
- }
-
- /**
- * Returns the value of the '<em><b>Table Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table Generator</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table Generator</em>' containment reference.
- * @see #setTableGenerator(ITableGenerator)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_TableGenerator()
- * @model containment="true"
- * @generated
- */
- public ITableGenerator getTableGenerator() {
- return tableGenerator;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetTableGenerator(ITableGenerator newTableGenerator, NotificationChain msgs) {
- ITableGenerator oldTableGenerator = tableGenerator;
- tableGenerator = newTableGenerator;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__TABLE_GENERATOR, oldTableGenerator, newTableGenerator);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal#getTableGenerator <em>Table Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Table Generator</em>' containment reference.
- * @see #getTableGenerator()
- * @generated
- */
- public void setTableGenerator(ITableGenerator newTableGenerator) {
- if (newTableGenerator != tableGenerator) {
- NotificationChain msgs = null;
- if (tableGenerator != null)
- msgs = ((InternalEObject) tableGenerator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY_INTERNAL__TABLE_GENERATOR, null, msgs);
- if (newTableGenerator != null)
- msgs = ((InternalEObject) newTableGenerator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY_INTERNAL__TABLE_GENERATOR, null, msgs);
- msgs = basicSetTableGenerator(newTableGenerator, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__TABLE_GENERATOR, newTableGenerator, newTableGenerator));
- }
-
- /**
- * Returns the value of the '<em><b>Default Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Discriminator Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Discriminator Value</em>' attribute.
- * @see #setDefaultDiscriminatorValue(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_DefaultDiscriminatorValue()
- * @model
- * @generated
- */
- public String getDefaultDiscriminatorValue() {
- return defaultDiscriminatorValue;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal#getDefaultDiscriminatorValue <em>Default Discriminator Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Default Discriminator Value</em>' attribute.
- * @see #getDefaultDiscriminatorValue()
- * @generated
- */
- public void setDefaultDiscriminatorValue(String newDefaultDiscriminatorValue) {
- String oldDefaultDiscriminatorValue = defaultDiscriminatorValue;
- defaultDiscriminatorValue = newDefaultDiscriminatorValue;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_DISCRIMINATOR_VALUE, oldDefaultDiscriminatorValue, defaultDiscriminatorValue));
- }
-
- /**
- * Returns the value of the '<em><b>Specified Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Discriminator Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Discriminator Value</em>' attribute.
- * @see #setSpecifiedDiscriminatorValue(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_SpecifiedDiscriminatorValue()
- * @model
- * @generated
- */
- public String getSpecifiedDiscriminatorValue() {
- return specifiedDiscriminatorValue;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal#getSpecifiedDiscriminatorValue <em>Specified Discriminator Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Discriminator Value</em>' attribute.
- * @see #getSpecifiedDiscriminatorValue()
- * @generated
- */
- public void setSpecifiedDiscriminatorValue(String newSpecifiedDiscriminatorValue) {
- String oldSpecifiedDiscriminatorValue = specifiedDiscriminatorValue;
- specifiedDiscriminatorValue = newSpecifiedDiscriminatorValue;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_DISCRIMINATOR_VALUE, oldSpecifiedDiscriminatorValue, specifiedDiscriminatorValue));
- }
-
- /**
- * Returns the value of the '<em><b>Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Discriminator Value</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Discriminator Value</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_DiscriminatorValue()
- * @model transient="true" changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getDiscriminatorValue() {
- return (this.getSpecifiedDiscriminatorValue() == null) ? getDefaultDiscriminatorValue() : this.getSpecifiedDiscriminatorValue();
- }
-
- public EList<IPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- return this.getSpecifiedPrimaryKeyJoinColumns().isEmpty() ? this.getDefaultPrimaryKeyJoinColumns() : this.getSpecifiedPrimaryKeyJoinColumns();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Primary Key Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Primary Key Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Primary Key Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_SpecifiedPrimaryKeyJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
- if (specifiedPrimaryKeyJoinColumns == null) {
- specifiedPrimaryKeyJoinColumns = new EObjectContainmentEList<IPrimaryKeyJoinColumn>(IPrimaryKeyJoinColumn.class, this, OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS);
- }
- return specifiedPrimaryKeyJoinColumns;
- }
-
- /**
- * Returns the value of the '<em><b>Default Primary Key Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Primary Key Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Primary Key Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_DefaultPrimaryKeyJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns() {
- if (defaultPrimaryKeyJoinColumns == null) {
- defaultPrimaryKeyJoinColumns = new EObjectContainmentEList<IPrimaryKeyJoinColumn>(IPrimaryKeyJoinColumn.class, this, OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS);
- }
- return defaultPrimaryKeyJoinColumns;
- }
-
- public EList<IAttributeOverride> getAttributeOverrides() {
- EList<IAttributeOverride> list = new EObjectEList<IAttributeOverride>(IAttributeOverride.class, this, OrmPackage.XML_ENTITY_INTERNAL__ATTRIBUTE_OVERRIDES);
- list.addAll(getSpecifiedAttributeOverrides());
- list.addAll(getDefaultAttributeOverrides());
- return list;
- }
-
- /**
- * Returns the value of the '<em><b>Specified Attribute Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Attribute Overrides</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Attribute Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_SpecifiedAttributeOverrides()
- * @model containment="true"
- * @generated
- */
- public EList<IAttributeOverride> getSpecifiedAttributeOverrides() {
- if (specifiedAttributeOverrides == null) {
- specifiedAttributeOverrides = new EObjectContainmentEList<IAttributeOverride>(IAttributeOverride.class, this, OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_ATTRIBUTE_OVERRIDES);
- }
- return specifiedAttributeOverrides;
- }
-
- /**
- * Returns the value of the '<em><b>Default Attribute Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Attribute Overrides</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Attribute Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_DefaultAttributeOverrides()
- * @model containment="true"
- * @generated
- */
- public EList<IAttributeOverride> getDefaultAttributeOverrides() {
- if (defaultAttributeOverrides == null) {
- defaultAttributeOverrides = new EObjectContainmentEList<IAttributeOverride>(IAttributeOverride.class, this, OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_ATTRIBUTE_OVERRIDES);
- }
- return defaultAttributeOverrides;
- }
-
- public EList<IAssociationOverride> getAssociationOverrides() {
- EList<IAssociationOverride> list = new EObjectEList<IAssociationOverride>(IAssociationOverride.class, this, OrmPackage.XML_ENTITY_INTERNAL__ASSOCIATION_OVERRIDES);
- list.addAll(getSpecifiedAssociationOverrides());
- list.addAll(getDefaultAssociationOverrides());
- return list;
- }
-
- /**
- * Returns the value of the '<em><b>Specified Association Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Association Overrides</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Association Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_SpecifiedAssociationOverrides()
- * @model containment="true"
- * @generated
- */
- public EList<IAssociationOverride> getSpecifiedAssociationOverrides() {
- if (specifiedAssociationOverrides == null) {
- specifiedAssociationOverrides = new EObjectContainmentEList<IAssociationOverride>(IAssociationOverride.class, this, OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_ASSOCIATION_OVERRIDES);
- }
- return specifiedAssociationOverrides;
- }
-
- /**
- * Returns the value of the '<em><b>Default Association Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Association Overrides</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Association Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_DefaultAssociationOverrides()
- * @model containment="true"
- * @generated
- */
- public EList<IAssociationOverride> getDefaultAssociationOverrides() {
- if (defaultAssociationOverrides == null) {
- defaultAssociationOverrides = new EObjectContainmentEList<IAssociationOverride>(IAssociationOverride.class, this, OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_ASSOCIATION_OVERRIDES);
- }
- return defaultAssociationOverrides;
- }
-
- /**
- * Returns the value of the '<em><b>Named Queries</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.INamedQuery}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Named Queries</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Named Queries</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_NamedQueries()
- * @model containment="true"
- * @generated
- */
- public EList<INamedQuery> getNamedQueries() {
- if (namedQueries == null) {
- namedQueries = new EObjectContainmentEList<INamedQuery>(INamedQuery.class, this, OrmPackage.XML_ENTITY_INTERNAL__NAMED_QUERIES);
- }
- return namedQueries;
- }
-
- /**
- * Returns the value of the '<em><b>Named Native Queries</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.INamedNativeQuery}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Named Native Queries</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Named Native Queries</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_NamedNativeQueries()
- * @model containment="true"
- * @generated
- */
- public EList<INamedNativeQuery> getNamedNativeQueries() {
- if (namedNativeQueries == null) {
- namedNativeQueries = new EObjectContainmentEList<INamedNativeQuery>(INamedNativeQuery.class, this, OrmPackage.XML_ENTITY_INTERNAL__NAMED_NATIVE_QUERIES);
- }
- return namedNativeQueries;
- }
-
- /**
- * Returns the value of the '<em><b>Id Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Id Class</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Id Class</em>' attribute.
- * @see #setIdClass(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIEntity_IdClass()
- * @model
- * @generated
- */
- public String getIdClass() {
- return idClass;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal#getIdClass <em>Id Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Id Class</em>' attribute.
- * @see #getIdClass()
- * @generated
- */
- public void setIdClass(String newIdClass) {
- String oldIdClass = idClass;
- idClass = newIdClass;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS, oldIdClass, idClass));
- }
-
- protected void idClassChanged() {
- if (getIdClass() == null) {
- setIdClassForXml(null);
- }
- else {
- if (getIdClassForXml() == null) {
- setIdClassForXml(OrmFactory.eINSTANCE.createXmlIdClass());
- }
- getIdClassForXml().setValue(getIdClass());
- }
- }
-
- public boolean discriminatorValueIsAllowed() {
- Type type = getPersistentType().findType();
- return (type == null) ? false : !type.isAbstract();
- }
-
- public IEntity parentEntity() {
- for (Iterator<IPersistentType> i = getPersistentType().inheritanceHierarchy(); i.hasNext();) {
- ITypeMapping typeMapping = i.next().getMapping();
- if (typeMapping != this && typeMapping instanceof IEntity) {
- return (IEntity) typeMapping;
- }
- }
- return this;
- }
-
- public IEntity rootEntity() {
- IEntity rootEntity = null;
- for (Iterator<IPersistentType> i = getPersistentType().inheritanceHierarchy(); i.hasNext();) {
- IPersistentType persistentType = i.next();
- if (persistentType.getMapping() instanceof IEntity) {
- rootEntity = (IEntity) persistentType.getMapping();
- }
- }
- return rootEntity;
- }
-
- /**
- * Returns the value of the '<em><b>Table For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table For Xml</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table For Xml</em>' reference.
- * @see #setTableForXml(XmlTable)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntityForXml_TableForXml()
- * @model resolveProxies="false" volatile="true"
- * @generated NOT
- */
- public XmlTable getTableForXml() {
- if (getTableInternal().isAllFeaturesUnset()) {
- return null;
- }
- return getTableInternal();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal#getTableForXml <em>Table For Xml</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Table For Xml</em>' reference.
- * @see #getTableForXml()
- * @generated NOT
- */
- public void setTableForXmlGen(XmlTable newTableForXml) {
- XmlTable oldValue = newTableForXml == null ? (XmlTable) getTable() : null;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__TABLE_FOR_XML, oldValue, newTableForXml));
- }
-
- public void setTableForXml(XmlTable newTableForXml) {
- setTableForXmlGen(newTableForXml);
- if (newTableForXml == null) {
- getTableInternal().unsetAllAttributes();
- }
- }
-
- /**
- * Returns the value of the '<em><b>Discriminator Column For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Discriminator Column For Xml</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Discriminator Column For Xml</em>' reference.
- * @see #setDiscriminatorColumnForXml(XmlDiscriminatorColumn)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntityForXml_DiscriminatorColumnForXml()
- * @model resolveProxies="false" volatile="true"
- * @generated NOT
- */
- public XmlDiscriminatorColumn getDiscriminatorColumnForXml() {
- if (getDiscriminatorColumnInternal().isAllFeaturesUnset()) {
- return null;
- }
- return getDiscriminatorColumnInternal();
- }
-
- private XmlDiscriminatorColumn getDiscriminatorColumnInternal() {
- return (XmlDiscriminatorColumn) getDiscriminatorColumn();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal#getDiscriminatorColumnForXml <em>Discriminator Column For Xml</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Discriminator Column For Xml</em>' reference.
- * @see #getDiscriminatorColumnForXml()
- * @generated NOT
- */
- public void setDiscriminatorColumnForXmlGen(XmlDiscriminatorColumn newDiscriminatorColumnForXml) {
- XmlDiscriminatorColumn oldValue = newDiscriminatorColumnForXml == null ? (XmlDiscriminatorColumn) getDiscriminatorColumn() : null;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN_FOR_XML, oldValue, newDiscriminatorColumnForXml));
- }
-
- public void setDiscriminatorColumnForXml(XmlDiscriminatorColumn newDiscriminatorColumnForXml) {
- setDiscriminatorColumnForXmlGen(newDiscriminatorColumnForXml);
- if (newDiscriminatorColumnForXml == null) {
- getDiscriminatorColumnInternal().unsetAllAttributes();
- }
- }
-
- /**
- * Returns the value of the '<em><b>Id Class For Xml</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Id Class For Xml</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Id Class For Xml</em>' containment reference.
- * @see #setIdClassForXml(XmlIdClass)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntityForXml_IdClassForXml()
- * @model containment="true"
- * @generated
- */
- public XmlIdClass getIdClassForXml() {
- return idClassForXml;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetIdClassForXml(XmlIdClass newIdClassForXml, NotificationChain msgs) {
- XmlIdClass oldIdClassForXml = idClassForXml;
- idClassForXml = newIdClassForXml;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS_FOR_XML, oldIdClassForXml, newIdClassForXml);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal#getIdClassForXml <em>Id Class For Xml</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Id Class For Xml</em>' containment reference.
- * @see #getIdClassForXml()
- * @generated
- */
- public void setIdClassForXml(XmlIdClass newIdClassForXml) {
- if (newIdClassForXml != idClassForXml) {
- NotificationChain msgs = null;
- if (idClassForXml != null)
- msgs = ((InternalEObject) idClassForXml).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS_FOR_XML, null, msgs);
- if (newIdClassForXml != null)
- msgs = ((InternalEObject) newIdClassForXml).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS_FOR_XML, null, msgs);
- msgs = basicSetIdClassForXml(newIdClassForXml, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS_FOR_XML, newIdClassForXml, newIdClassForXml));
- }
-
- /**
- * Returns the value of the '<em><b>Inheritance For Xml</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Inheritance For Xml</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Inheritance For Xml</em>' containment reference.
- * @see #setInheritanceForXml(XmlInheritance)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEntityForXml_InheritanceForXml()
- * @model containment="true"
- * @generated
- */
- public XmlInheritance getInheritanceForXml() {
- return inheritanceForXml;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetInheritanceForXml(XmlInheritance newInheritanceForXml, NotificationChain msgs) {
- XmlInheritance oldInheritanceForXml = inheritanceForXml;
- inheritanceForXml = newInheritanceForXml;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_FOR_XML, oldInheritanceForXml, newInheritanceForXml);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal#getInheritanceForXml <em>Inheritance For Xml</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Inheritance For Xml</em>' containment reference.
- * @see #getInheritanceForXml()
- * @generated
- */
- public void setInheritanceForXml(XmlInheritance newInheritanceForXml) {
- if (newInheritanceForXml != inheritanceForXml) {
- NotificationChain msgs = null;
- if (inheritanceForXml != null)
- msgs = ((InternalEObject) inheritanceForXml).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_FOR_XML, null, msgs);
- if (newInheritanceForXml != null)
- msgs = ((InternalEObject) newInheritanceForXml).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_FOR_XML, null, msgs);
- msgs = basicSetInheritanceForXml(newInheritanceForXml, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_FOR_XML, newInheritanceForXml, newInheritanceForXml));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS_FOR_XML :
- return basicSetIdClassForXml(null, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_FOR_XML :
- return basicSetInheritanceForXml(null, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__TABLE :
- return basicSetTable(null, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_SECONDARY_TABLES :
- return ((InternalEList<?>) getSpecifiedSecondaryTables()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__PRIMARY_KEY_JOIN_COLUMNS :
- return ((InternalEList<?>) getPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return ((InternalEList<?>) getSpecifiedPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return ((InternalEList<?>) getDefaultPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN :
- return basicSetDiscriminatorColumn(null, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__SEQUENCE_GENERATOR :
- return basicSetSequenceGenerator(null, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__TABLE_GENERATOR :
- return basicSetTableGenerator(null, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__ATTRIBUTE_OVERRIDES :
- return ((InternalEList<?>) getAttributeOverrides()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return ((InternalEList<?>) getSpecifiedAttributeOverrides()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_ATTRIBUTE_OVERRIDES :
- return ((InternalEList<?>) getDefaultAttributeOverrides()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__ASSOCIATION_OVERRIDES :
- return ((InternalEList<?>) getAssociationOverrides()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_ASSOCIATION_OVERRIDES :
- return ((InternalEList<?>) getSpecifiedAssociationOverrides()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_ASSOCIATION_OVERRIDES :
- return ((InternalEList<?>) getDefaultAssociationOverrides()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__NAMED_QUERIES :
- return ((InternalEList<?>) getNamedQueries()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__NAMED_NATIVE_QUERIES :
- return ((InternalEList<?>) getNamedNativeQueries()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__SECONDARY_TABLES :
- return ((InternalEList<?>) getSecondaryTables()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_ENTITY_INTERNAL__VIRTUAL_SECONDARY_TABLES :
- return ((InternalEList<?>) getVirtualSecondaryTables()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- protected void setDefaultName(String newDefaultName) {
- String oldDefaultName = this.defaultName;
- this.defaultName = newDefaultName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_NAME, oldDefaultName, defaultName));
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext) {
- super.refreshDefaults(defaultsContext);
- setDefaultName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_ENTITY_NAME_KEY));
- }
-
- public String getKey() {
- return IMappingKeys.ENTITY_TYPE_MAPPING_KEY;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_ENTITY_INTERNAL__TABLE_FOR_XML :
- return getTableForXml();
- case OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN_FOR_XML :
- return getDiscriminatorColumnForXml();
- case OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS_FOR_XML :
- return getIdClassForXml();
- case OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_FOR_XML :
- return getInheritanceForXml();
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_NAME :
- return getSpecifiedName();
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_NAME :
- return getDefaultName();
- case OrmPackage.XML_ENTITY_INTERNAL__TABLE :
- return getTable();
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_SECONDARY_TABLES :
- return getSpecifiedSecondaryTables();
- case OrmPackage.XML_ENTITY_INTERNAL__PRIMARY_KEY_JOIN_COLUMNS :
- return getPrimaryKeyJoinColumns();
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return getSpecifiedPrimaryKeyJoinColumns();
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return getDefaultPrimaryKeyJoinColumns();
- case OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_STRATEGY :
- return getInheritanceStrategy();
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_DISCRIMINATOR_VALUE :
- return getDefaultDiscriminatorValue();
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_DISCRIMINATOR_VALUE :
- return getSpecifiedDiscriminatorValue();
- case OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_VALUE :
- return getDiscriminatorValue();
- case OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN :
- return getDiscriminatorColumn();
- case OrmPackage.XML_ENTITY_INTERNAL__SEQUENCE_GENERATOR :
- return getSequenceGenerator();
- case OrmPackage.XML_ENTITY_INTERNAL__TABLE_GENERATOR :
- return getTableGenerator();
- case OrmPackage.XML_ENTITY_INTERNAL__ATTRIBUTE_OVERRIDES :
- return getAttributeOverrides();
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return getSpecifiedAttributeOverrides();
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_ATTRIBUTE_OVERRIDES :
- return getDefaultAttributeOverrides();
- case OrmPackage.XML_ENTITY_INTERNAL__ASSOCIATION_OVERRIDES :
- return getAssociationOverrides();
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_ASSOCIATION_OVERRIDES :
- return getSpecifiedAssociationOverrides();
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_ASSOCIATION_OVERRIDES :
- return getDefaultAssociationOverrides();
- case OrmPackage.XML_ENTITY_INTERNAL__NAMED_QUERIES :
- return getNamedQueries();
- case OrmPackage.XML_ENTITY_INTERNAL__NAMED_NATIVE_QUERIES :
- return getNamedNativeQueries();
- case OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS :
- return getIdClass();
- case OrmPackage.XML_ENTITY_INTERNAL__SECONDARY_TABLES :
- return getSecondaryTables();
- case OrmPackage.XML_ENTITY_INTERNAL__VIRTUAL_SECONDARY_TABLES :
- return getVirtualSecondaryTables();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_ENTITY_INTERNAL__TABLE_FOR_XML :
- setTableForXml((XmlTable) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN_FOR_XML :
- setDiscriminatorColumnForXml((XmlDiscriminatorColumn) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS_FOR_XML :
- setIdClassForXml((XmlIdClass) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_FOR_XML :
- setInheritanceForXml((XmlInheritance) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_NAME :
- setSpecifiedName((String) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_SECONDARY_TABLES :
- getSpecifiedSecondaryTables().clear();
- getSpecifiedSecondaryTables().addAll((Collection<? extends ISecondaryTable>) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- getSpecifiedPrimaryKeyJoinColumns().clear();
- getSpecifiedPrimaryKeyJoinColumns().addAll((Collection<? extends IPrimaryKeyJoinColumn>) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- getDefaultPrimaryKeyJoinColumns().clear();
- getDefaultPrimaryKeyJoinColumns().addAll((Collection<? extends IPrimaryKeyJoinColumn>) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_STRATEGY :
- setInheritanceStrategy((InheritanceType) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_DISCRIMINATOR_VALUE :
- setDefaultDiscriminatorValue((String) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_DISCRIMINATOR_VALUE :
- setSpecifiedDiscriminatorValue((String) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__SEQUENCE_GENERATOR :
- setSequenceGenerator((ISequenceGenerator) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__TABLE_GENERATOR :
- setTableGenerator((ITableGenerator) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_ATTRIBUTE_OVERRIDES :
- getSpecifiedAttributeOverrides().clear();
- getSpecifiedAttributeOverrides().addAll((Collection<? extends IAttributeOverride>) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_ATTRIBUTE_OVERRIDES :
- getDefaultAttributeOverrides().clear();
- getDefaultAttributeOverrides().addAll((Collection<? extends IAttributeOverride>) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_ASSOCIATION_OVERRIDES :
- getSpecifiedAssociationOverrides().clear();
- getSpecifiedAssociationOverrides().addAll((Collection<? extends IAssociationOverride>) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_ASSOCIATION_OVERRIDES :
- getDefaultAssociationOverrides().clear();
- getDefaultAssociationOverrides().addAll((Collection<? extends IAssociationOverride>) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__NAMED_QUERIES :
- getNamedQueries().clear();
- getNamedQueries().addAll((Collection<? extends INamedQuery>) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__NAMED_NATIVE_QUERIES :
- getNamedNativeQueries().clear();
- getNamedNativeQueries().addAll((Collection<? extends INamedNativeQuery>) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS :
- setIdClass((String) newValue);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__VIRTUAL_SECONDARY_TABLES :
- getVirtualSecondaryTables().clear();
- getVirtualSecondaryTables().addAll((Collection<? extends ISecondaryTable>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_ENTITY_INTERNAL__TABLE_FOR_XML :
- setTableForXml((XmlTable) null);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN_FOR_XML :
- setDiscriminatorColumnForXml((XmlDiscriminatorColumn) null);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS_FOR_XML :
- setIdClassForXml((XmlIdClass) null);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_FOR_XML :
- setInheritanceForXml((XmlInheritance) null);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_NAME :
- setSpecifiedName(SPECIFIED_NAME_EDEFAULT);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_SECONDARY_TABLES :
- getSpecifiedSecondaryTables().clear();
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- getSpecifiedPrimaryKeyJoinColumns().clear();
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- getDefaultPrimaryKeyJoinColumns().clear();
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_STRATEGY :
- setInheritanceStrategy(INHERITANCE_STRATEGY_EDEFAULT);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_DISCRIMINATOR_VALUE :
- setDefaultDiscriminatorValue(DEFAULT_DISCRIMINATOR_VALUE_EDEFAULT);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_DISCRIMINATOR_VALUE :
- setSpecifiedDiscriminatorValue(SPECIFIED_DISCRIMINATOR_VALUE_EDEFAULT);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__SEQUENCE_GENERATOR :
- setSequenceGenerator((ISequenceGenerator) null);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__TABLE_GENERATOR :
- setTableGenerator((ITableGenerator) null);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_ATTRIBUTE_OVERRIDES :
- getSpecifiedAttributeOverrides().clear();
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_ATTRIBUTE_OVERRIDES :
- getDefaultAttributeOverrides().clear();
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_ASSOCIATION_OVERRIDES :
- getSpecifiedAssociationOverrides().clear();
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_ASSOCIATION_OVERRIDES :
- getDefaultAssociationOverrides().clear();
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__NAMED_QUERIES :
- getNamedQueries().clear();
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__NAMED_NATIVE_QUERIES :
- getNamedNativeQueries().clear();
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS :
- setIdClass(ID_CLASS_EDEFAULT);
- return;
- case OrmPackage.XML_ENTITY_INTERNAL__VIRTUAL_SECONDARY_TABLES :
- getVirtualSecondaryTables().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_ENTITY_INTERNAL__TABLE_FOR_XML :
- return getTableForXml() != null;
- case OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN_FOR_XML :
- return getDiscriminatorColumnForXml() != null;
- case OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS_FOR_XML :
- return idClassForXml != null;
- case OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_FOR_XML :
- return inheritanceForXml != null;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_NAME :
- return SPECIFIED_NAME_EDEFAULT == null ? specifiedName != null : !SPECIFIED_NAME_EDEFAULT.equals(specifiedName);
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_NAME :
- return DEFAULT_NAME_EDEFAULT == null ? defaultName != null : !DEFAULT_NAME_EDEFAULT.equals(defaultName);
- case OrmPackage.XML_ENTITY_INTERNAL__TABLE :
- return table != null;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_SECONDARY_TABLES :
- return specifiedSecondaryTables != null && !specifiedSecondaryTables.isEmpty();
- case OrmPackage.XML_ENTITY_INTERNAL__PRIMARY_KEY_JOIN_COLUMNS :
- return !getPrimaryKeyJoinColumns().isEmpty();
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return specifiedPrimaryKeyJoinColumns != null && !specifiedPrimaryKeyJoinColumns.isEmpty();
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return defaultPrimaryKeyJoinColumns != null && !defaultPrimaryKeyJoinColumns.isEmpty();
- case OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_STRATEGY :
- return inheritanceStrategy != INHERITANCE_STRATEGY_EDEFAULT;
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_DISCRIMINATOR_VALUE :
- return DEFAULT_DISCRIMINATOR_VALUE_EDEFAULT == null ? defaultDiscriminatorValue != null : !DEFAULT_DISCRIMINATOR_VALUE_EDEFAULT.equals(defaultDiscriminatorValue);
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_DISCRIMINATOR_VALUE :
- return SPECIFIED_DISCRIMINATOR_VALUE_EDEFAULT == null ? specifiedDiscriminatorValue != null : !SPECIFIED_DISCRIMINATOR_VALUE_EDEFAULT.equals(specifiedDiscriminatorValue);
- case OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_VALUE :
- return DISCRIMINATOR_VALUE_EDEFAULT == null ? getDiscriminatorValue() != null : !DISCRIMINATOR_VALUE_EDEFAULT.equals(getDiscriminatorValue());
- case OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN :
- return discriminatorColumn != null;
- case OrmPackage.XML_ENTITY_INTERNAL__SEQUENCE_GENERATOR :
- return sequenceGenerator != null;
- case OrmPackage.XML_ENTITY_INTERNAL__TABLE_GENERATOR :
- return tableGenerator != null;
- case OrmPackage.XML_ENTITY_INTERNAL__ATTRIBUTE_OVERRIDES :
- return !getAttributeOverrides().isEmpty();
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return specifiedAttributeOverrides != null && !specifiedAttributeOverrides.isEmpty();
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_ATTRIBUTE_OVERRIDES :
- return defaultAttributeOverrides != null && !defaultAttributeOverrides.isEmpty();
- case OrmPackage.XML_ENTITY_INTERNAL__ASSOCIATION_OVERRIDES :
- return !getAssociationOverrides().isEmpty();
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_ASSOCIATION_OVERRIDES :
- return specifiedAssociationOverrides != null && !specifiedAssociationOverrides.isEmpty();
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_ASSOCIATION_OVERRIDES :
- return defaultAssociationOverrides != null && !defaultAssociationOverrides.isEmpty();
- case OrmPackage.XML_ENTITY_INTERNAL__NAMED_QUERIES :
- return namedQueries != null && !namedQueries.isEmpty();
- case OrmPackage.XML_ENTITY_INTERNAL__NAMED_NATIVE_QUERIES :
- return namedNativeQueries != null && !namedNativeQueries.isEmpty();
- case OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS :
- return ID_CLASS_EDEFAULT == null ? idClass != null : !ID_CLASS_EDEFAULT.equals(idClass);
- case OrmPackage.XML_ENTITY_INTERNAL__SECONDARY_TABLES :
- return !getSecondaryTables().isEmpty();
- case OrmPackage.XML_ENTITY_INTERNAL__VIRTUAL_SECONDARY_TABLES :
- return virtualSecondaryTables != null && !virtualSecondaryTables.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == XmlEntityForXml.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_ENTITY_INTERNAL__TABLE_FOR_XML :
- return OrmPackage.XML_ENTITY_FOR_XML__TABLE_FOR_XML;
- case OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN_FOR_XML :
- return OrmPackage.XML_ENTITY_FOR_XML__DISCRIMINATOR_COLUMN_FOR_XML;
- case OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS_FOR_XML :
- return OrmPackage.XML_ENTITY_FOR_XML__ID_CLASS_FOR_XML;
- case OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_FOR_XML :
- return OrmPackage.XML_ENTITY_FOR_XML__INHERITANCE_FOR_XML;
- default :
- return -1;
- }
- }
- if (baseClass == IEntity.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_NAME :
- return JpaCoreMappingsPackage.IENTITY__SPECIFIED_NAME;
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_NAME :
- return JpaCoreMappingsPackage.IENTITY__DEFAULT_NAME;
- case OrmPackage.XML_ENTITY_INTERNAL__TABLE :
- return JpaCoreMappingsPackage.IENTITY__TABLE;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_SECONDARY_TABLES :
- return JpaCoreMappingsPackage.IENTITY__SPECIFIED_SECONDARY_TABLES;
- case OrmPackage.XML_ENTITY_INTERNAL__PRIMARY_KEY_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IENTITY__PRIMARY_KEY_JOIN_COLUMNS;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS;
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS;
- case OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_STRATEGY :
- return JpaCoreMappingsPackage.IENTITY__INHERITANCE_STRATEGY;
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_DISCRIMINATOR_VALUE :
- return JpaCoreMappingsPackage.IENTITY__DEFAULT_DISCRIMINATOR_VALUE;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_DISCRIMINATOR_VALUE :
- return JpaCoreMappingsPackage.IENTITY__SPECIFIED_DISCRIMINATOR_VALUE;
- case OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_VALUE :
- return JpaCoreMappingsPackage.IENTITY__DISCRIMINATOR_VALUE;
- case OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN :
- return JpaCoreMappingsPackage.IENTITY__DISCRIMINATOR_COLUMN;
- case OrmPackage.XML_ENTITY_INTERNAL__SEQUENCE_GENERATOR :
- return JpaCoreMappingsPackage.IENTITY__SEQUENCE_GENERATOR;
- case OrmPackage.XML_ENTITY_INTERNAL__TABLE_GENERATOR :
- return JpaCoreMappingsPackage.IENTITY__TABLE_GENERATOR;
- case OrmPackage.XML_ENTITY_INTERNAL__ATTRIBUTE_OVERRIDES :
- return JpaCoreMappingsPackage.IENTITY__ATTRIBUTE_OVERRIDES;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return JpaCoreMappingsPackage.IENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES;
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_ATTRIBUTE_OVERRIDES :
- return JpaCoreMappingsPackage.IENTITY__DEFAULT_ATTRIBUTE_OVERRIDES;
- case OrmPackage.XML_ENTITY_INTERNAL__ASSOCIATION_OVERRIDES :
- return JpaCoreMappingsPackage.IENTITY__ASSOCIATION_OVERRIDES;
- case OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_ASSOCIATION_OVERRIDES :
- return JpaCoreMappingsPackage.IENTITY__SPECIFIED_ASSOCIATION_OVERRIDES;
- case OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_ASSOCIATION_OVERRIDES :
- return JpaCoreMappingsPackage.IENTITY__DEFAULT_ASSOCIATION_OVERRIDES;
- case OrmPackage.XML_ENTITY_INTERNAL__NAMED_QUERIES :
- return JpaCoreMappingsPackage.IENTITY__NAMED_QUERIES;
- case OrmPackage.XML_ENTITY_INTERNAL__NAMED_NATIVE_QUERIES :
- return JpaCoreMappingsPackage.IENTITY__NAMED_NATIVE_QUERIES;
- case OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS :
- return JpaCoreMappingsPackage.IENTITY__ID_CLASS;
- default :
- return -1;
- }
- }
- if (baseClass == XmlEntity.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_ENTITY_INTERNAL__SECONDARY_TABLES :
- return OrmPackage.XML_ENTITY__SECONDARY_TABLES;
- case OrmPackage.XML_ENTITY_INTERNAL__VIRTUAL_SECONDARY_TABLES :
- return OrmPackage.XML_ENTITY__VIRTUAL_SECONDARY_TABLES;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == XmlEntityForXml.class) {
- switch (baseFeatureID) {
- case OrmPackage.XML_ENTITY_FOR_XML__TABLE_FOR_XML :
- return OrmPackage.XML_ENTITY_INTERNAL__TABLE_FOR_XML;
- case OrmPackage.XML_ENTITY_FOR_XML__DISCRIMINATOR_COLUMN_FOR_XML :
- return OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN_FOR_XML;
- case OrmPackage.XML_ENTITY_FOR_XML__ID_CLASS_FOR_XML :
- return OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS_FOR_XML;
- case OrmPackage.XML_ENTITY_FOR_XML__INHERITANCE_FOR_XML :
- return OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_FOR_XML;
- default :
- return -1;
- }
- }
- if (baseClass == IEntity.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_NAME :
- return OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_NAME;
- case JpaCoreMappingsPackage.IENTITY__DEFAULT_NAME :
- return OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_NAME;
- case JpaCoreMappingsPackage.IENTITY__TABLE :
- return OrmPackage.XML_ENTITY_INTERNAL__TABLE;
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_SECONDARY_TABLES :
- return OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_SECONDARY_TABLES;
- case JpaCoreMappingsPackage.IENTITY__PRIMARY_KEY_JOIN_COLUMNS :
- return OrmPackage.XML_ENTITY_INTERNAL__PRIMARY_KEY_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IENTITY__INHERITANCE_STRATEGY :
- return OrmPackage.XML_ENTITY_INTERNAL__INHERITANCE_STRATEGY;
- case JpaCoreMappingsPackage.IENTITY__DEFAULT_DISCRIMINATOR_VALUE :
- return OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_DISCRIMINATOR_VALUE;
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_DISCRIMINATOR_VALUE :
- return OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_DISCRIMINATOR_VALUE;
- case JpaCoreMappingsPackage.IENTITY__DISCRIMINATOR_VALUE :
- return OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_VALUE;
- case JpaCoreMappingsPackage.IENTITY__DISCRIMINATOR_COLUMN :
- return OrmPackage.XML_ENTITY_INTERNAL__DISCRIMINATOR_COLUMN;
- case JpaCoreMappingsPackage.IENTITY__SEQUENCE_GENERATOR :
- return OrmPackage.XML_ENTITY_INTERNAL__SEQUENCE_GENERATOR;
- case JpaCoreMappingsPackage.IENTITY__TABLE_GENERATOR :
- return OrmPackage.XML_ENTITY_INTERNAL__TABLE_GENERATOR;
- case JpaCoreMappingsPackage.IENTITY__ATTRIBUTE_OVERRIDES :
- return OrmPackage.XML_ENTITY_INTERNAL__ATTRIBUTE_OVERRIDES;
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES :
- return OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_ATTRIBUTE_OVERRIDES;
- case JpaCoreMappingsPackage.IENTITY__DEFAULT_ATTRIBUTE_OVERRIDES :
- return OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_ATTRIBUTE_OVERRIDES;
- case JpaCoreMappingsPackage.IENTITY__ASSOCIATION_OVERRIDES :
- return OrmPackage.XML_ENTITY_INTERNAL__ASSOCIATION_OVERRIDES;
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_ASSOCIATION_OVERRIDES :
- return OrmPackage.XML_ENTITY_INTERNAL__SPECIFIED_ASSOCIATION_OVERRIDES;
- case JpaCoreMappingsPackage.IENTITY__DEFAULT_ASSOCIATION_OVERRIDES :
- return OrmPackage.XML_ENTITY_INTERNAL__DEFAULT_ASSOCIATION_OVERRIDES;
- case JpaCoreMappingsPackage.IENTITY__NAMED_QUERIES :
- return OrmPackage.XML_ENTITY_INTERNAL__NAMED_QUERIES;
- case JpaCoreMappingsPackage.IENTITY__NAMED_NATIVE_QUERIES :
- return OrmPackage.XML_ENTITY_INTERNAL__NAMED_NATIVE_QUERIES;
- case JpaCoreMappingsPackage.IENTITY__ID_CLASS :
- return OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS;
- default :
- return -1;
- }
- }
- if (baseClass == XmlEntity.class) {
- switch (baseFeatureID) {
- case OrmPackage.XML_ENTITY__SECONDARY_TABLES :
- return OrmPackage.XML_ENTITY_INTERNAL__SECONDARY_TABLES;
- case OrmPackage.XML_ENTITY__VIRTUAL_SECONDARY_TABLES :
- return OrmPackage.XML_ENTITY_INTERNAL__VIRTUAL_SECONDARY_TABLES;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedName: ");
- result.append(specifiedName);
- result.append(", defaultName: ");
- result.append(defaultName);
- result.append(", inheritanceStrategy: ");
- result.append(inheritanceStrategy);
- result.append(", defaultDiscriminatorValue: ");
- result.append(defaultDiscriminatorValue);
- result.append(", specifiedDiscriminatorValue: ");
- result.append(specifiedDiscriminatorValue);
- result.append(", idClass: ");
- result.append(idClass);
- result.append(')');
- return result.toString();
- }
-
- @Override
- public String getTableName() {
- return getTable().getName();
- }
-
- public void makeTableForXmlNull() {
- setTableForXmlGen(null);
- }
-
- public void makeTableForXmlNonNull() {
- setTableForXmlGen(getTableForXml());
- }
-
- public void makeDiscriminatorColumnForXmlNull() {
- setDiscriminatorColumnForXmlGen(null);
- }
-
- //um, this is an object on XmlInheritance, but a tag on entity in the xml, how to handle???
- public void makeDiscriminatorColumnForXmlNonNull() {
- setDiscriminatorColumnForXmlGen(getDiscriminatorColumnForXml());
- }
-
- public String primaryKeyColumnName() {
- String pkColumnName = null;
- for (Iterator<IPersistentAttribute> stream = getPersistentType().allAttributes(); stream.hasNext();) {
- IPersistentAttribute attribute = stream.next();
- String name = attribute.primaryKeyColumnName();
- if (pkColumnName == null) {
- pkColumnName = name;
- }
- else if (name != null) {
- // if we encounter a composite primary key, return null
- return null;
- }
- }
- // if we encounter only a single primary key column name, return it
- return pkColumnName;
- }
-
- public String primaryKeyAttributeName() {
- String pkColumnName = null;
- String pkAttributeName = null;
- for (Iterator<IPersistentAttribute> stream = getPersistentType().allAttributes(); stream.hasNext();) {
- IPersistentAttribute attribute = stream.next();
- String name = attribute.primaryKeyColumnName();
- if (pkColumnName == null) {
- pkColumnName = name;
- pkAttributeName = attribute.getName();
- }
- else if (name != null) {
- // if we encounter a composite primary key, return null
- return null;
- }
- }
- // if we encounter only a single primary key column name, return it
- return pkAttributeName;
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return !CollectionTools.contains(this.associatedTableNamesIncludingInherited(), tableName);
- }
-
- private Iterator<String> tableNames(Iterator<ITable> tables) {
- return new TransformationIterator(tables) {
- @Override
- protected Object transform(Object next) {
- return ((ITable) next).getName();
- }
- };
- }
-
- public Iterator<String> associatedTableNamesIncludingInherited() {
- return this.nonNullTableNames(this.associatedTablesIncludingInherited());
- }
-
- private Iterator<String> nonNullTableNames(Iterator<ITable> tables) {
- return new FilteringIterator(this.tableNames(tables)) {
- @Override
- protected boolean accept(Object o) {
- return o != null;
- }
- };
- }
-
- public Iterator<ITable> associatedTables() {
- return new CompositeIterator(this.getTable(), this.getSecondaryTables().iterator());
- }
-
- public Iterator<ITable> associatedTablesIncludingInherited() {
- return new CompositeIterator(new TransformationIterator(this.inheritanceHierarchy()) {
- @Override
- protected Object transform(Object next) {
- return new FilteringIterator(((ITypeMapping) next).associatedTables()) {
- @Override
- protected boolean accept(Object o) {
- return true;
- //TODO
- //filtering these out so as to avoid the duplicate table, root and children share the same table
- //return !(o instanceof SingleTableInheritanceChildTableImpl);
- }
- };
- }
- });
- }
-
- @Override
- public Table primaryDbTable() {
- return getTable().dbTable();
- }
-
- @Override
- public Table dbTable(String tableName) {
- for (Iterator<ITable> stream = this.associatedTablesIncludingInherited(); stream.hasNext();) {
- Table dbTable = stream.next().dbTable();
- if (dbTable != null && dbTable.matchesShortJavaClassName(tableName)) {
- return dbTable;
- }
- }
- return null;
- }
-
- @Override
- public Schema dbSchema() {
- return getTable().dbSchema();
- }
-
- @Override
- public int xmlSequence() {
- return 1;
- }
-
- /**
- * Return an iterator of Entities, each which inherits from the one before,
- * and terminates at the root entity (or at the point of cyclicity).
- */
- private Iterator<ITypeMapping> inheritanceHierarchy() {
- return new TransformationIterator(getPersistentType().inheritanceHierarchy()) {
- @Override
- protected Object transform(Object next) {
- return ((IPersistentType) next).getMapping();
- }
- };
- //TODO once we support inheritance, which of these should we use??
- //return this.getInheritance().typeMappingLineage();
- }
-
- public Iterator<String> allOverridableAttributeNames() {
- return new CompositeIterator(new TransformationIterator(this.inheritanceHierarchy()) {
- protected Object transform(Object next) {
- return ((ITypeMapping) next).overridableAttributeNames();
- }
- });
- }
-
- public Iterator<String> allOverridableAssociationNames() {
- return new CompositeIterator(new TransformationIterator(this.inheritanceHierarchy()) {
- protected Object transform(Object next) {
- return ((ITypeMapping) next).overridableAssociationNames();
- }
- });
- }
-
- public IAttributeOverride createAttributeOverride(int index) {
- return OrmFactory.eINSTANCE.createXmlAttributeOverride(new IEntity.AttributeOverrideOwner(this));
- }
-
- public IAssociationOverride createAssociationOverride(int index) {
- return OrmFactory.eINSTANCE.createXmlAssociationOverride(new IEntity.AssociationOverrideOwner(this));
- }
-
- public IAttributeOverride attributeOverrideNamed(String name) {
- return (IAttributeOverride) overrideNamed(name, getAttributeOverrides());
- }
-
- public boolean containsAttributeOverride(String name) {
- return containsOverride(name, getAttributeOverrides());
- }
-
- public boolean containsSpecifiedAttributeOverride(String name) {
- return containsOverride(name, getSpecifiedAttributeOverrides());
- }
-
- public boolean containsAssociationOverride(String name) {
- return containsOverride(name, getAssociationOverrides());
- }
-
- public boolean containsSpecifiedAssociationOverride(String name) {
- return containsOverride(name, getSpecifiedAssociationOverrides());
- }
-
- private IOverride overrideNamed(String name, List<? extends IOverride> overrides) {
- for (IOverride override : overrides) {
- String overrideName = override.getName();
- if (overrideName == null && name == null) {
- return override;
- }
- if (overrideName != null && overrideName.equals(name)) {
- return override;
- }
- }
- return null;
- }
-
- private boolean containsOverride(String name, List<? extends IOverride> overrides) {
- return overrideNamed(name, overrides) != null;
- }
-
- public ISecondaryTable createSecondaryTable(int index) {
- return OrmFactory.eINSTANCE.createXmlSecondaryTable(buildSecondaryTableOwner());
- }
-
- private ITable.Owner buildSecondaryTableOwner() {
- return new ITable.Owner() {
- public ITextRange validationTextRange() {
- return XmlEntityInternal.this.validationTextRange();
- }
-
- public ITypeMapping getTypeMapping() {
- return XmlEntityInternal.this;
- }
- };
- }
-
- public boolean containsSpecifiedPrimaryKeyJoinColumns() {
- return !this.getSpecifiedPrimaryKeyJoinColumns().isEmpty();
- }
-
- public IPrimaryKeyJoinColumn createPrimaryKeyJoinColumn(int index) {
- return OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn(new IEntity.PrimaryKeyJoinColumnOwner(this));
- }
-
- public INamedQuery createNamedQuery(int index) {
- return OrmFactory.eINSTANCE.createXmlNamedQuery();
- }
-
- public INamedNativeQuery createNamedNativeQuery(int index) {
- return OrmFactory.eINSTANCE.createXmlNamedNativeQuery();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlGenerator.java
deleted file mode 100644
index bdadaaa49a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlGenerator.java
+++ /dev/null
@@ -1,490 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.mappings.IGenerator;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Generator</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlGenerator()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class XmlGenerator extends XmlEObject implements IGenerator
-{
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected String name = NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getInitialValue() <em>Initial Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getInitialValue()
- * @generated
- * @ordered
- */
- protected static final int INITIAL_VALUE_EDEFAULT = 0;
-
- /**
- * The default value of the '{@link #getSpecifiedInitialValue() <em>Specified Initial Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedInitialValue()
- * @generated
- * @ordered
- */
- protected static final int SPECIFIED_INITIAL_VALUE_EDEFAULT = -1;
-
- /**
- * The cached value of the '{@link #getSpecifiedInitialValue() <em>Specified Initial Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedInitialValue()
- * @generated
- * @ordered
- */
- protected int specifiedInitialValue = SPECIFIED_INITIAL_VALUE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultInitialValue() <em>Default Initial Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultInitialValue()
- * @generated
- * @ordered
- */
- protected static final int DEFAULT_INITIAL_VALUE_EDEFAULT = 0;
-
- /**
- * The cached value of the '{@link #getDefaultInitialValue() <em>Default Initial Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultInitialValue()
- * @generated
- * @ordered
- */
- protected int defaultInitialValue = DEFAULT_INITIAL_VALUE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getAllocationSize() <em>Allocation Size</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getAllocationSize()
- * @generated
- * @ordered
- */
- protected static final int ALLOCATION_SIZE_EDEFAULT = 0;
-
- /**
- * The default value of the '{@link #getSpecifiedAllocationSize() <em>Specified Allocation Size</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedAllocationSize()
- * @generated
- * @ordered
- */
- protected static final int SPECIFIED_ALLOCATION_SIZE_EDEFAULT = -1;
-
- /**
- * The cached value of the '{@link #getSpecifiedAllocationSize() <em>Specified Allocation Size</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedAllocationSize()
- * @generated
- * @ordered
- */
- protected int specifiedAllocationSize = SPECIFIED_ALLOCATION_SIZE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultAllocationSize() <em>Default Allocation Size</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultAllocationSize()
- * @generated
- * @ordered
- */
- protected static final int DEFAULT_ALLOCATION_SIZE_EDEFAULT = 0;
-
- /**
- * The cached value of the '{@link #getDefaultAllocationSize() <em>Default Allocation Size</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultAllocationSize()
- * @generated
- * @ordered
- */
- protected int defaultAllocationSize = DEFAULT_ALLOCATION_SIZE_EDEFAULT;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlGenerator() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_GENERATOR;
- }
-
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see #setName(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIGenerator_Name()
- * @model
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlGenerator#getName <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Name</em>' attribute.
- * @see #getName()
- * @generated
- */
- public void setName(String newName) {
- String oldName = name;
- name = newName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_GENERATOR__NAME, oldName, name));
- }
-
- public int getInitialValue() {
- return (this.getSpecifiedInitialValue() == -1) ? this.getDefaultInitialValue() : this.getSpecifiedInitialValue();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Initial Value</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Initial Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Initial Value</em>' attribute.
- * @see #setSpecifiedInitialValue(int)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIGenerator_SpecifiedInitialValue()
- * @model default="-1"
- * @generated
- */
- public int getSpecifiedInitialValue() {
- return specifiedInitialValue;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlGenerator#getSpecifiedInitialValue <em>Specified Initial Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Initial Value</em>' attribute.
- * @see #getSpecifiedInitialValue()
- * @generated
- */
- public void setSpecifiedInitialValue(int newSpecifiedInitialValue) {
- int oldSpecifiedInitialValue = specifiedInitialValue;
- specifiedInitialValue = newSpecifiedInitialValue;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_GENERATOR__SPECIFIED_INITIAL_VALUE, oldSpecifiedInitialValue, specifiedInitialValue));
- }
-
- /**
- * Returns the value of the '<em><b>Default Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Initial Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Initial Value</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIGenerator_DefaultInitialValue()
- * @model changeable="false"
- * @generated
- */
- public int getDefaultInitialValue() {
- return defaultInitialValue;
- }
-
- public int getAllocationSize() {
- return (this.getSpecifiedAllocationSize() == -1) ? this.getDefaultAllocationSize() : this.getSpecifiedAllocationSize();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Allocation Size</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Allocation Size</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Allocation Size</em>' attribute.
- * @see #setSpecifiedAllocationSize(int)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIGenerator_SpecifiedAllocationSize()
- * @model default="-1"
- * @generated
- */
- public int getSpecifiedAllocationSize() {
- return specifiedAllocationSize;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlGenerator#getSpecifiedAllocationSize <em>Specified Allocation Size</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Allocation Size</em>' attribute.
- * @see #getSpecifiedAllocationSize()
- * @generated
- */
- public void setSpecifiedAllocationSize(int newSpecifiedAllocationSize) {
- int oldSpecifiedAllocationSize = specifiedAllocationSize;
- specifiedAllocationSize = newSpecifiedAllocationSize;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_GENERATOR__SPECIFIED_ALLOCATION_SIZE, oldSpecifiedAllocationSize, specifiedAllocationSize));
- }
-
- /**
- * Returns the value of the '<em><b>Default Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Allocation Size</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Allocation Size</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIGenerator_DefaultAllocationSize()
- * @model changeable="false"
- * @generated
- */
- public int getDefaultAllocationSize() {
- return defaultAllocationSize;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_GENERATOR__NAME :
- return getName();
- case OrmPackage.XML_GENERATOR__INITIAL_VALUE :
- return new Integer(getInitialValue());
- case OrmPackage.XML_GENERATOR__SPECIFIED_INITIAL_VALUE :
- return new Integer(getSpecifiedInitialValue());
- case OrmPackage.XML_GENERATOR__DEFAULT_INITIAL_VALUE :
- return new Integer(getDefaultInitialValue());
- case OrmPackage.XML_GENERATOR__ALLOCATION_SIZE :
- return new Integer(getAllocationSize());
- case OrmPackage.XML_GENERATOR__SPECIFIED_ALLOCATION_SIZE :
- return new Integer(getSpecifiedAllocationSize());
- case OrmPackage.XML_GENERATOR__DEFAULT_ALLOCATION_SIZE :
- return new Integer(getDefaultAllocationSize());
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_GENERATOR__NAME :
- setName((String) newValue);
- return;
- case OrmPackage.XML_GENERATOR__SPECIFIED_INITIAL_VALUE :
- setSpecifiedInitialValue(((Integer) newValue).intValue());
- return;
- case OrmPackage.XML_GENERATOR__SPECIFIED_ALLOCATION_SIZE :
- setSpecifiedAllocationSize(((Integer) newValue).intValue());
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_GENERATOR__NAME :
- setName(NAME_EDEFAULT);
- return;
- case OrmPackage.XML_GENERATOR__SPECIFIED_INITIAL_VALUE :
- setSpecifiedInitialValue(SPECIFIED_INITIAL_VALUE_EDEFAULT);
- return;
- case OrmPackage.XML_GENERATOR__SPECIFIED_ALLOCATION_SIZE :
- setSpecifiedAllocationSize(SPECIFIED_ALLOCATION_SIZE_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_GENERATOR__NAME :
- return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
- case OrmPackage.XML_GENERATOR__INITIAL_VALUE :
- return getInitialValue() != INITIAL_VALUE_EDEFAULT;
- case OrmPackage.XML_GENERATOR__SPECIFIED_INITIAL_VALUE :
- return specifiedInitialValue != SPECIFIED_INITIAL_VALUE_EDEFAULT;
- case OrmPackage.XML_GENERATOR__DEFAULT_INITIAL_VALUE :
- return defaultInitialValue != DEFAULT_INITIAL_VALUE_EDEFAULT;
- case OrmPackage.XML_GENERATOR__ALLOCATION_SIZE :
- return getAllocationSize() != ALLOCATION_SIZE_EDEFAULT;
- case OrmPackage.XML_GENERATOR__SPECIFIED_ALLOCATION_SIZE :
- return specifiedAllocationSize != SPECIFIED_ALLOCATION_SIZE_EDEFAULT;
- case OrmPackage.XML_GENERATOR__DEFAULT_ALLOCATION_SIZE :
- return defaultAllocationSize != DEFAULT_ALLOCATION_SIZE_EDEFAULT;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IGenerator.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_GENERATOR__NAME :
- return JpaCoreMappingsPackage.IGENERATOR__NAME;
- case OrmPackage.XML_GENERATOR__INITIAL_VALUE :
- return JpaCoreMappingsPackage.IGENERATOR__INITIAL_VALUE;
- case OrmPackage.XML_GENERATOR__SPECIFIED_INITIAL_VALUE :
- return JpaCoreMappingsPackage.IGENERATOR__SPECIFIED_INITIAL_VALUE;
- case OrmPackage.XML_GENERATOR__DEFAULT_INITIAL_VALUE :
- return JpaCoreMappingsPackage.IGENERATOR__DEFAULT_INITIAL_VALUE;
- case OrmPackage.XML_GENERATOR__ALLOCATION_SIZE :
- return JpaCoreMappingsPackage.IGENERATOR__ALLOCATION_SIZE;
- case OrmPackage.XML_GENERATOR__SPECIFIED_ALLOCATION_SIZE :
- return JpaCoreMappingsPackage.IGENERATOR__SPECIFIED_ALLOCATION_SIZE;
- case OrmPackage.XML_GENERATOR__DEFAULT_ALLOCATION_SIZE :
- return JpaCoreMappingsPackage.IGENERATOR__DEFAULT_ALLOCATION_SIZE;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IGenerator.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IGENERATOR__NAME :
- return OrmPackage.XML_GENERATOR__NAME;
- case JpaCoreMappingsPackage.IGENERATOR__INITIAL_VALUE :
- return OrmPackage.XML_GENERATOR__INITIAL_VALUE;
- case JpaCoreMappingsPackage.IGENERATOR__SPECIFIED_INITIAL_VALUE :
- return OrmPackage.XML_GENERATOR__SPECIFIED_INITIAL_VALUE;
- case JpaCoreMappingsPackage.IGENERATOR__DEFAULT_INITIAL_VALUE :
- return OrmPackage.XML_GENERATOR__DEFAULT_INITIAL_VALUE;
- case JpaCoreMappingsPackage.IGENERATOR__ALLOCATION_SIZE :
- return OrmPackage.XML_GENERATOR__ALLOCATION_SIZE;
- case JpaCoreMappingsPackage.IGENERATOR__SPECIFIED_ALLOCATION_SIZE :
- return OrmPackage.XML_GENERATOR__SPECIFIED_ALLOCATION_SIZE;
- case JpaCoreMappingsPackage.IGENERATOR__DEFAULT_ALLOCATION_SIZE :
- return OrmPackage.XML_GENERATOR__DEFAULT_ALLOCATION_SIZE;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (name: ");
- result.append(name);
- result.append(", specifiedInitialValue: ");
- result.append(specifiedInitialValue);
- result.append(", defaultInitialValue: ");
- result.append(defaultInitialValue);
- result.append(", specifiedAllocationSize: ");
- result.append(specifiedAllocationSize);
- result.append(", defaultAllocationSize: ");
- result.append(defaultAllocationSize);
- result.append(')');
- return result.toString();
- }
-} // XmlGenerator
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlId.java
deleted file mode 100644
index b45ab2960c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlId.java
+++ /dev/null
@@ -1,682 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.TemporalType;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Id</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlId()
- * @model kind="class"
- * @generated
- */
-public class XmlId extends XmlAttributeMapping
- implements IId, IXmlColumnMapping
-{
- /**
- * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getColumn()
- * @generated
- * @ordered
- */
- protected IColumn column;
-
- /**
- * The cached value of the '{@link #getGeneratedValue() <em>Generated Value</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getGeneratedValue()
- * @generated
- * @ordered
- */
- protected IGeneratedValue generatedValue;
-
- /**
- * The default value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTemporal()
- * @generated
- * @ordered
- */
- protected static final TemporalType TEMPORAL_EDEFAULT = TemporalType.NULL;
-
- /**
- * The cached value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTemporal()
- * @generated
- * @ordered
- */
- protected TemporalType temporal = TEMPORAL_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getTableGenerator() <em>Table Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTableGenerator()
- * @generated
- * @ordered
- */
- protected ITableGenerator tableGenerator;
-
- /**
- * The cached value of the '{@link #getSequenceGenerator() <em>Sequence Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSequenceGenerator()
- * @generated
- * @ordered
- */
- protected ISequenceGenerator sequenceGenerator;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated NOT
- */
- protected XmlId() {
- super();
- this.column = OrmFactory.eINSTANCE.createXmlColumn(buildOwner());
- ((InternalEObject) this.column).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ID__COLUMN, null, null);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_ID;
- }
-
- /**
- * Returns the value of the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIId_Column()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- public IColumn getColumn() {
- return column;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetColumn(IColumn newColumn, NotificationChain msgs) {
- IColumn oldColumn = column;
- column = newColumn;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ID__COLUMN, oldColumn, newColumn);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Returns the value of the '<em><b>Generated Value</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Generated Value</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Generated Value</em>' containment reference.
- * @see #setGeneratedValue(IGeneratedValue)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIId_GeneratedValue()
- * @model containment="true"
- * @generated
- */
- public IGeneratedValue getGeneratedValue() {
- return generatedValue;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetGeneratedValue(IGeneratedValue newGeneratedValue, NotificationChain msgs) {
- IGeneratedValue oldGeneratedValue = generatedValue;
- generatedValue = newGeneratedValue;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ID__GENERATED_VALUE, oldGeneratedValue, newGeneratedValue);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlId#getGeneratedValue <em>Generated Value</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Generated Value</em>' containment reference.
- * @see #getGeneratedValue()
- * @generated
- */
- public void setGeneratedValue(IGeneratedValue newGeneratedValue) {
- if (newGeneratedValue != generatedValue) {
- NotificationChain msgs = null;
- if (generatedValue != null)
- msgs = ((InternalEObject) generatedValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ID__GENERATED_VALUE, null, msgs);
- if (newGeneratedValue != null)
- msgs = ((InternalEObject) newGeneratedValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ID__GENERATED_VALUE, null, msgs);
- msgs = basicSetGeneratedValue(newGeneratedValue, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ID__GENERATED_VALUE, newGeneratedValue, newGeneratedValue));
- }
-
- /**
- * Returns the value of the '<em><b>Temporal</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.TemporalType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Temporal</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @see #setTemporal(TemporalType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIId_Temporal()
- * @model
- * @generated
- */
- public TemporalType getTemporal() {
- return temporal;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlId#getTemporal <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @see #getTemporal()
- * @generated
- */
- public void setTemporal(TemporalType newTemporal) {
- TemporalType oldTemporal = temporal;
- temporal = newTemporal == null ? TEMPORAL_EDEFAULT : newTemporal;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ID__TEMPORAL, oldTemporal, temporal));
- }
-
- /**
- * Returns the value of the '<em><b>Table Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table Generator</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table Generator</em>' containment reference.
- * @see #setTableGenerator(ITableGenerator)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIId_TableGenerator()
- * @model containment="true"
- * @generated
- */
- public ITableGenerator getTableGenerator() {
- return tableGenerator;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetTableGenerator(ITableGenerator newTableGenerator, NotificationChain msgs) {
- ITableGenerator oldTableGenerator = tableGenerator;
- tableGenerator = newTableGenerator;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ID__TABLE_GENERATOR, oldTableGenerator, newTableGenerator);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlId#getTableGenerator <em>Table Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Table Generator</em>' containment reference.
- * @see #getTableGenerator()
- * @generated
- */
- public void setTableGenerator(ITableGenerator newTableGenerator) {
- if (newTableGenerator != tableGenerator) {
- NotificationChain msgs = null;
- if (tableGenerator != null)
- msgs = ((InternalEObject) tableGenerator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ID__TABLE_GENERATOR, null, msgs);
- if (newTableGenerator != null)
- msgs = ((InternalEObject) newTableGenerator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ID__TABLE_GENERATOR, null, msgs);
- msgs = basicSetTableGenerator(newTableGenerator, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ID__TABLE_GENERATOR, newTableGenerator, newTableGenerator));
- }
-
- /**
- * Returns the value of the '<em><b>Sequence Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Sequence Generator</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Sequence Generator</em>' containment reference.
- * @see #setSequenceGenerator(ISequenceGenerator)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIId_SequenceGenerator()
- * @model containment="true"
- * @generated
- */
- public ISequenceGenerator getSequenceGenerator() {
- return sequenceGenerator;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetSequenceGenerator(ISequenceGenerator newSequenceGenerator, NotificationChain msgs) {
- ISequenceGenerator oldSequenceGenerator = sequenceGenerator;
- sequenceGenerator = newSequenceGenerator;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ID__SEQUENCE_GENERATOR, oldSequenceGenerator, newSequenceGenerator);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlId#getSequenceGenerator <em>Sequence Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Sequence Generator</em>' containment reference.
- * @see #getSequenceGenerator()
- * @generated
- */
- public void setSequenceGenerator(ISequenceGenerator newSequenceGenerator) {
- if (newSequenceGenerator != sequenceGenerator) {
- NotificationChain msgs = null;
- if (sequenceGenerator != null)
- msgs = ((InternalEObject) sequenceGenerator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ID__SEQUENCE_GENERATOR, null, msgs);
- if (newSequenceGenerator != null)
- msgs = ((InternalEObject) newSequenceGenerator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ID__SEQUENCE_GENERATOR, null, msgs);
- msgs = basicSetSequenceGenerator(newSequenceGenerator, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ID__SEQUENCE_GENERATOR, newSequenceGenerator, newSequenceGenerator));
- }
-
- /**
- * Returns the value of the '<em><b>Column For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column For Xml</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column For Xml</em>' reference.
- * @see #setColumnForXml(XmlColumn)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIXmlColumnMapping_ColumnForXml()
- * @model resolveProxies="false" volatile="true"
- * @generated NOT
- */
- public XmlColumn getColumnForXml() {
- if (((XmlColumn) getColumn()).isAllFeaturesUnset()) {
- return null;
- }
- return (XmlColumn) getColumn();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlId#getColumnForXml <em>Column For Xml</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Column For Xml</em>' reference.
- * @see #getColumnForXml()
- * @generated NOT
- */
- public void setColumnForXmlGen(XmlColumn newColumnForXml) {
- XmlColumn oldValue = newColumnForXml == null ? (XmlColumn) getColumn() : null;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ID__COLUMN_FOR_XML, oldValue, newColumnForXml));
- }
-
- public void setColumnForXml(XmlColumn newColumnForXml) {
- setColumnForXmlGen(newColumnForXml);
- if (newColumnForXml == null) {
- ((XmlColumn) getColumn()).unsetAllAttributes();
- }
- }
-
- public void makeColumnForXmlNonNull() {
- setColumnForXmlGen(getColumnForXml());
- }
-
- public void makeColumnForXmlNull() {
- setColumnForXmlGen(null);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_ID__COLUMN :
- return basicSetColumn(null, msgs);
- case OrmPackage.XML_ID__GENERATED_VALUE :
- return basicSetGeneratedValue(null, msgs);
- case OrmPackage.XML_ID__TABLE_GENERATOR :
- return basicSetTableGenerator(null, msgs);
- case OrmPackage.XML_ID__SEQUENCE_GENERATOR :
- return basicSetSequenceGenerator(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_ID__COLUMN :
- return getColumn();
- case OrmPackage.XML_ID__GENERATED_VALUE :
- return getGeneratedValue();
- case OrmPackage.XML_ID__TEMPORAL :
- return getTemporal();
- case OrmPackage.XML_ID__TABLE_GENERATOR :
- return getTableGenerator();
- case OrmPackage.XML_ID__SEQUENCE_GENERATOR :
- return getSequenceGenerator();
- case OrmPackage.XML_ID__COLUMN_FOR_XML :
- return getColumnForXml();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_ID__GENERATED_VALUE :
- setGeneratedValue((IGeneratedValue) newValue);
- return;
- case OrmPackage.XML_ID__TEMPORAL :
- setTemporal((TemporalType) newValue);
- return;
- case OrmPackage.XML_ID__TABLE_GENERATOR :
- setTableGenerator((ITableGenerator) newValue);
- return;
- case OrmPackage.XML_ID__SEQUENCE_GENERATOR :
- setSequenceGenerator((ISequenceGenerator) newValue);
- return;
- case OrmPackage.XML_ID__COLUMN_FOR_XML :
- setColumnForXml((XmlColumn) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_ID__GENERATED_VALUE :
- setGeneratedValue((IGeneratedValue) null);
- return;
- case OrmPackage.XML_ID__TEMPORAL :
- setTemporal(TEMPORAL_EDEFAULT);
- return;
- case OrmPackage.XML_ID__TABLE_GENERATOR :
- setTableGenerator((ITableGenerator) null);
- return;
- case OrmPackage.XML_ID__SEQUENCE_GENERATOR :
- setSequenceGenerator((ISequenceGenerator) null);
- return;
- case OrmPackage.XML_ID__COLUMN_FOR_XML :
- setColumnForXml((XmlColumn) null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_ID__COLUMN :
- return column != null;
- case OrmPackage.XML_ID__GENERATED_VALUE :
- return generatedValue != null;
- case OrmPackage.XML_ID__TEMPORAL :
- return temporal != TEMPORAL_EDEFAULT;
- case OrmPackage.XML_ID__TABLE_GENERATOR :
- return tableGenerator != null;
- case OrmPackage.XML_ID__SEQUENCE_GENERATOR :
- return sequenceGenerator != null;
- case OrmPackage.XML_ID__COLUMN_FOR_XML :
- return getColumnForXml() != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IColumnMapping.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IId.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_ID__COLUMN :
- return JpaCoreMappingsPackage.IID__COLUMN;
- case OrmPackage.XML_ID__GENERATED_VALUE :
- return JpaCoreMappingsPackage.IID__GENERATED_VALUE;
- case OrmPackage.XML_ID__TEMPORAL :
- return JpaCoreMappingsPackage.IID__TEMPORAL;
- case OrmPackage.XML_ID__TABLE_GENERATOR :
- return JpaCoreMappingsPackage.IID__TABLE_GENERATOR;
- case OrmPackage.XML_ID__SEQUENCE_GENERATOR :
- return JpaCoreMappingsPackage.IID__SEQUENCE_GENERATOR;
- default :
- return -1;
- }
- }
- if (baseClass == IXmlColumnMapping.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_ID__COLUMN_FOR_XML :
- return OrmPackage.IXML_COLUMN_MAPPING__COLUMN_FOR_XML;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IColumnMapping.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IId.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IID__COLUMN :
- return OrmPackage.XML_ID__COLUMN;
- case JpaCoreMappingsPackage.IID__GENERATED_VALUE :
- return OrmPackage.XML_ID__GENERATED_VALUE;
- case JpaCoreMappingsPackage.IID__TEMPORAL :
- return OrmPackage.XML_ID__TEMPORAL;
- case JpaCoreMappingsPackage.IID__TABLE_GENERATOR :
- return OrmPackage.XML_ID__TABLE_GENERATOR;
- case JpaCoreMappingsPackage.IID__SEQUENCE_GENERATOR :
- return OrmPackage.XML_ID__SEQUENCE_GENERATOR;
- default :
- return -1;
- }
- }
- if (baseClass == IXmlColumnMapping.class) {
- switch (baseFeatureID) {
- case OrmPackage.IXML_COLUMN_MAPPING__COLUMN_FOR_XML :
- return OrmPackage.XML_ID__COLUMN_FOR_XML;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (temporal: ");
- result.append(temporal);
- result.append(')');
- return result.toString();
- }
-
- public String getKey() {
- return IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- protected void initializeOn(XmlAttributeMapping newMapping) {
- newMapping.initializeFromXmlIdMapping(this);
- }
-
- @Override
- public void initializeFromXmlBasicMapping(XmlBasic oldMapping) {
- super.initializeFromXmlBasicMapping(oldMapping);
- setTemporal(oldMapping.getTemporal());
- }
-
- @Override
- public int xmlSequence() {
- return 0;
- }
-
- public String primaryKeyColumnName() {
- return this.getColumn().getName();
- }
-
- public IGeneratedValue createGeneratedValue() {
- return OrmFactory.eINSTANCE.createXmlGeneratedValue();
- }
-
- public ISequenceGenerator createSequenceGenerator() {
- return OrmFactory.eINSTANCE.createXmlSequenceGenerator();
- }
-
- public ITableGenerator createTableGenerator() {
- return OrmFactory.eINSTANCE.createXmlTableGenerator();
- }
-
- @Override
- public boolean isOverridableAttributeMapping() {
- return true;
- }
-
- @Override
- public boolean isIdMapping() {
- return true;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlIdClass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlIdClass.java
deleted file mode 100644
index 4bb0a55f97..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlIdClass.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.XmlEObject;
-
-/**
- * This class is purely used to hack around a problem with the translators and representing
- * the IEntity.idClass feature in the xml. Added this object to correspend to the
- * id-class type in the xml since the translator path approach caused the id-class element
- * to be added even when the idClass was null. This occurred when you added a new persistent
- * type to the orm.xml via the structure view.
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlIdClass#getValue <em>Value</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlIdClass()
- * @model kind="class"
- * @generated
- */
-public class XmlIdClass extends XmlEObject
-{
- /**
- * The default value of the '{@link #getValue() <em>Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getValue()
- * @generated
- * @ordered
- */
- protected static final String VALUE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getValue() <em>Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getValue()
- * @generated
- * @ordered
- */
- protected String value = VALUE_EDEFAULT;
-
- protected XmlIdClass() {
- super();
- this.eAdapters().add(this.buildListener());
- }
-
- protected Adapter buildListener() {
- return new AdapterImpl() {
- @Override
- public void notifyChanged(Notification notification) {
- XmlIdClass.this.notifyChanged(notification);
- }
- };
- }
-
- protected void notifyChanged(Notification notification) {
- switch (notification.getFeatureID(XmlIdClass.class)) {
- case OrmPackage.XML_ID_CLASS__VALUE :
- valueChanged();
- break;
- default :
- break;
- }
- }
-
- private Owner owner() {
- return (Owner) eContainer();
- }
-
- protected void valueChanged() {
- owner().setIdClass(getValue());
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_ID_CLASS;
- }
-
- /**
- * Returns the value of the '<em><b>Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Value</em>' attribute.
- * @see #setValue(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlIdClass_Value()
- * @model
- * @generated
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlIdClass#getValue <em>Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Value</em>' attribute.
- * @see #getValue()
- * @generated
- */
- public void setValue(String newValue) {
- String oldValue = value;
- value = newValue;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ID_CLASS__VALUE, oldValue, value));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_ID_CLASS__VALUE :
- return getValue();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_ID_CLASS__VALUE :
- setValue((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_ID_CLASS__VALUE :
- setValue(VALUE_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_ID_CLASS__VALUE :
- return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (value: ");
- result.append(value);
- result.append(')');
- return result.toString();
- }
-
-
- public interface Owner
- {
- void setIdClass(String idClass);
- }
-} // XmlIdClass
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlInheritance.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlInheritance.java
deleted file mode 100644
index 0635c7a1e6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlInheritance.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.mappings.InheritanceType;
-
-/**
- * <!-- begin-user-doc -->
- * This class is purely used to hack around a problem with the translators and representing
- * the IEntity.inheritanceStrategy feature in the xml. Added this object to correspend to the
- * inheritance type in the xml since the translator path approach caused the inheritance element
- * to be added even when the strategy was default was null. This occurred when you added a new persistent
- * type to the orm.xml via the structure view.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlInheritance#getStrategy <em>Strategy</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlInheritance()
- * @model kind="class"
- * @generated
- */
-public class XmlInheritance extends XmlEObject
-{
- /**
- * The default value of the '{@link #getStrategy() <em>Strategy</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getStrategy()
- * @generated
- * @ordered
- */
- protected static final InheritanceType STRATEGY_EDEFAULT = InheritanceType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getStrategy() <em>Strategy</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getStrategy()
- * @generated
- * @ordered
- */
- protected InheritanceType strategy = STRATEGY_EDEFAULT;
-
- protected XmlInheritance() {
- super();
- this.eAdapters().add(this.buildListener());
- }
-
- protected Adapter buildListener() {
- return new AdapterImpl() {
- @Override
- public void notifyChanged(Notification notification) {
- XmlInheritance.this.notifyChanged(notification);
- }
- };
- }
-
- protected void notifyChanged(Notification notification) {
- switch (notification.getFeatureID(XmlInheritance.class)) {
- case OrmPackage.XML_INHERITANCE__STRATEGY :
- strategyChanged();
- break;
- default :
- break;
- }
- }
-
- private XmlEntityInternal xmlEntity() {
- return (XmlEntityInternal) eContainer();
- }
-
- protected void strategyChanged() {
- xmlEntity().setInheritanceStrategy(getStrategy());
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_INHERITANCE;
- }
-
- /**
- * Returns the value of the '<em><b>Strategy</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.InheritanceType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Strategy</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Strategy</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.InheritanceType
- * @see #setStrategy(InheritanceType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlInheritance_Strategy()
- * @model
- * @generated
- */
- public InheritanceType getStrategy() {
- return strategy;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlInheritance#getStrategy <em>Strategy</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Strategy</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.InheritanceType
- * @see #getStrategy()
- * @generated
- */
- public void setStrategy(InheritanceType newStrategy) {
- InheritanceType oldStrategy = strategy;
- strategy = newStrategy == null ? STRATEGY_EDEFAULT : newStrategy;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_INHERITANCE__STRATEGY, oldStrategy, strategy));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_INHERITANCE__STRATEGY :
- return getStrategy();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_INHERITANCE__STRATEGY :
- setStrategy((InheritanceType) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_INHERITANCE__STRATEGY :
- setStrategy(STRATEGY_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_INHERITANCE__STRATEGY :
- return strategy != STRATEGY_EDEFAULT;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (strategy: ");
- result.append(strategy);
- result.append(')');
- return result.toString();
- }
-} // XmlInheritance
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlJoinColumn.java
deleted file mode 100644
index aa06b04d0a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlJoinColumn.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.content.orm.resource.OrmXmlMapper;
-import org.eclipse.jpt.core.internal.emfutility.DOMUtilities;
-import org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.db.internal.Column;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Join Column</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlJoinColumn#getSpecifiedReferencedColumnNameForXml <em>Specified Referenced Column Name For Xml</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlJoinColumn()
- * @model kind="class"
- * @generated
- */
-public class XmlJoinColumn extends AbstractXmlColumn implements IJoinColumn
-{
- /**
- * The default value of the '{@link #getReferencedColumnName() <em>Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getReferencedColumnName()
- * @generated
- * @ordered
- */
- protected static final String REFERENCED_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedReferencedColumnName() <em>Specified Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedReferencedColumnName()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedReferencedColumnName() <em>Specified Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedReferencedColumnName()
- * @generated
- * @ordered
- */
- protected String specifiedReferencedColumnName = SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultReferencedColumnName() <em>Default Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultReferencedColumnName()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_REFERENCED_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultReferencedColumnName() <em>Default Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultReferencedColumnName()
- * @generated
- * @ordered
- */
- protected String defaultReferencedColumnName = DEFAULT_REFERENCED_COLUMN_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getSpecifiedReferencedColumnNameForXml() <em>Specified Referenced Column Name For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedReferencedColumnNameForXml()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML_EDEFAULT = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated NOT
- */
- protected XmlJoinColumn() {
- throw new UnsupportedOperationException();
- }
-
- protected XmlJoinColumn(IJoinColumn.Owner owner) {
- super(owner);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_JOIN_COLUMN;
- }
-
- /**
- * Returns the value of the '<em><b>Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Referenced Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Referenced Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIJoinColumn_ReferencedColumnName()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getReferencedColumnName() {
- return (this.getSpecifiedReferencedColumnName() == null) ? getDefaultReferencedColumnName() : this.getSpecifiedReferencedColumnName();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Referenced Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Referenced Column Name</em>' attribute.
- * @see #setSpecifiedReferencedColumnName(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIAbstractJoinColumn_SpecifiedReferencedColumnName()
- * @model
- * @generated
- */
- public String getSpecifiedReferencedColumnName() {
- return specifiedReferencedColumnName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlJoinColumn#getSpecifiedReferencedColumnName <em>Specified Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Referenced Column Name</em>' attribute.
- * @see #getSpecifiedReferencedColumnName()
- * @generated
- */
- public void setSpecifiedReferencedColumnNameGen(String newSpecifiedReferencedColumnName) {
- String oldSpecifiedReferencedColumnName = specifiedReferencedColumnName;
- specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME, oldSpecifiedReferencedColumnName, specifiedReferencedColumnName));
- }
-
- public void setSpecifiedReferencedColumnName(String newSpecifiedReferencedColumnName) {
- setSpecifiedReferencedColumnNameGen(newSpecifiedReferencedColumnName);
- setSpecifiedReferencedColumnNameForXml(newSpecifiedReferencedColumnName);
- }
-
- /**
- * Returns the value of the '<em><b>Default Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Referenced Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Referenced Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIAbstractJoinColumn_DefaultReferencedColumnName()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultReferencedColumnName() {
- return defaultReferencedColumnName;
- }
-
- protected void setDefaultReferencedColumnName(String newDefaultReferencedColumnName) {
- String oldDefaultReferencedColumnName = this.defaultReferencedColumnName;
- this.defaultReferencedColumnName = newDefaultReferencedColumnName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME, oldDefaultReferencedColumnName, newDefaultReferencedColumnName));
- }
-
- /**
- * Returns the value of the '<em><b>Specified Referenced Column Name For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Referenced Column Name For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Referenced Column Name For Xml</em>' attribute.
- * @see #setSpecifiedReferencedColumnNameForXml(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlJoinColumn_SpecifiedReferencedColumnNameForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public String getSpecifiedReferencedColumnNameForXml() {
- return getSpecifiedReferencedColumnName();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlJoinColumn#getSpecifiedReferencedColumnNameForXml <em>Specified Referenced Column Name For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Referenced Column Name For Xml</em>' attribute.
- * @see #getSpecifiedReferencedColumnNameForXml()
- * @generated NOT
- */
- public void setSpecifiedReferencedColumnNameForXml(String newSpecifiedReferencedColumnNameForXml) {
- setSpecifiedReferencedColumnNameGen(newSpecifiedReferencedColumnNameForXml);
- if (eNotificationRequired())
- //make sure oldValue different from newValue because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML, newSpecifiedReferencedColumnNameForXml + " ", newSpecifiedReferencedColumnNameForXml));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_JOIN_COLUMN__REFERENCED_COLUMN_NAME :
- return getReferencedColumnName();
- case OrmPackage.XML_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- return getSpecifiedReferencedColumnName();
- case OrmPackage.XML_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME :
- return getDefaultReferencedColumnName();
- case OrmPackage.XML_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML :
- return getSpecifiedReferencedColumnNameForXml();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- setSpecifiedReferencedColumnName((String) newValue);
- return;
- case OrmPackage.XML_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML :
- setSpecifiedReferencedColumnNameForXml((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- setSpecifiedReferencedColumnName(SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT);
- return;
- case OrmPackage.XML_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML :
- setSpecifiedReferencedColumnNameForXml(SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_JOIN_COLUMN__REFERENCED_COLUMN_NAME :
- return REFERENCED_COLUMN_NAME_EDEFAULT == null ? getReferencedColumnName() != null : !REFERENCED_COLUMN_NAME_EDEFAULT.equals(getReferencedColumnName());
- case OrmPackage.XML_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- return SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT == null ? specifiedReferencedColumnName != null : !SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT.equals(specifiedReferencedColumnName);
- case OrmPackage.XML_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME :
- return DEFAULT_REFERENCED_COLUMN_NAME_EDEFAULT == null ? defaultReferencedColumnName != null : !DEFAULT_REFERENCED_COLUMN_NAME_EDEFAULT.equals(defaultReferencedColumnName);
- case OrmPackage.XML_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML :
- return SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML_EDEFAULT == null ? getSpecifiedReferencedColumnNameForXml() != null : !SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML_EDEFAULT.equals(getSpecifiedReferencedColumnNameForXml());
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IAbstractJoinColumn.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_JOIN_COLUMN__REFERENCED_COLUMN_NAME :
- return JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__REFERENCED_COLUMN_NAME;
- case OrmPackage.XML_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- return JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME;
- case OrmPackage.XML_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME :
- return JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME;
- default :
- return -1;
- }
- }
- if (baseClass == IJoinColumn.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IAbstractJoinColumn.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__REFERENCED_COLUMN_NAME :
- return OrmPackage.XML_JOIN_COLUMN__REFERENCED_COLUMN_NAME;
- case JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- return OrmPackage.XML_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME;
- case JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME :
- return OrmPackage.XML_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME;
- default :
- return -1;
- }
- }
- if (baseClass == IJoinColumn.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedReferencedColumnName: ");
- result.append(specifiedReferencedColumnName);
- result.append(", defaultReferencedColumnName: ");
- result.append(defaultReferencedColumnName);
- result.append(')');
- return result.toString();
- }
-
- public void setSpecifiedName(String newSpecifiedName) {
- setSpecifiedNameGen(newSpecifiedName);
- setSpecifiedNameForXml(newSpecifiedName);
- }
-
- public void setUnique(DefaultFalseBoolean newUnique) {
- setUniqueGen(newUnique);
- setUniqueForXml(newUnique);
- }
-
- public void setNullable(DefaultTrueBoolean newNullable) {
- setNullableGen(newNullable);
- setNullableForXml(newNullable);
- }
-
- public void setInsertable(DefaultTrueBoolean newInsertable) {
- setInsertableGen(newInsertable);
- setInsertableForXml(newInsertable);
- }
-
- public void setUpdatable(DefaultTrueBoolean newUpdatable) {
- setUpdatableGen(newUpdatable);
- setUpdatableForXml(newUpdatable);
- }
-
- public void setColumnDefinition(String newColumnDefinition) {
- setColumnDefinitionGen(newColumnDefinition);
- setColumnDefinitionForXml(newColumnDefinition);
- }
-
- public void setSpecifiedTable(String newSpecifiedTable) {
- setSpecifiedTableGen(newSpecifiedTable);
- setSpecifiedTableForXml(newSpecifiedTable);
- }
-
- public boolean isVirtual() {
- return getOwner().isVirtual(this);
- }
-
- public IJoinColumn.Owner getOwner() {
- return (IJoinColumn.Owner) this.owner;
- }
-
- public Table dbReferencedColumnTable() {
- return getOwner().dbReferencedColumnTable();
- }
-
- public Column dbReferencedColumn() {
- Table table = dbReferencedColumnTable();
- return (table == null) ? null : table.columnNamed(getReferencedColumnName());
- }
-
- public boolean isReferencedColumnResolved() {
- return dbReferencedColumn() != null;
- }
-
- public ITextRange referencedColumnNameTextRange() {
- if (node == null) {
- return owner.validationTextRange();
- }
- IDOMNode referencedColumnNameNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.REFERENCED_COLUMN_NAME);
- return (referencedColumnNameNode == null) ? validationTextRange() : buildTextRange(referencedColumnNameNode);
- }
-
- public void refreshDefaults(DefaultsContext defaultsContext) {
- setDefaultReferencedColumnName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_REFERENCED_COLUMN_NAME_KEY));
- setDefaultName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_NAME_KEY));
- setDefaultTable((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_TABLE_KEY));
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlJoinTable.java
deleted file mode 100644
index 0470ad1fae..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlJoinTable.java
+++ /dev/null
@@ -1,511 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import java.util.Collection;
-import java.util.Set;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Join Table</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlJoinTable()
- * @model kind="class"
- * @generated
- */
-public class XmlJoinTable extends AbstractXmlTable implements IJoinTable
-{
- /**
- * The cached value of the '{@link #getSpecifiedJoinColumns() <em>Specified Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IJoinColumn> specifiedJoinColumns;
-
- /**
- * The cached value of the '{@link #getDefaultJoinColumns() <em>Default Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IJoinColumn> defaultJoinColumns;
-
- /**
- * The cached value of the '{@link #getSpecifiedInverseJoinColumns() <em>Specified Inverse Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedInverseJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IJoinColumn> specifiedInverseJoinColumns;
-
- /**
- * The cached value of the '{@link #getDefaultInverseJoinColumns() <em>Default Inverse Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultInverseJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IJoinColumn> defaultInverseJoinColumns;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated NOT
- */
- protected XmlJoinTable() {
- throw new UnsupportedOperationException();
- }
-
- protected XmlJoinTable(IJoinTable.Owner owner) {
- super(owner);
- this.getDefaultJoinColumns().add(this.createJoinColumn(new JoinColumnOwner(this)));
- this.getDefaultInverseJoinColumns().add(this.createJoinColumn(new InverseJoinColumnOwner(this)));
- this.eAdapters().add(this.buildListener());
- }
-
- @Override
- protected void addInsignificantXmlFeatureIdsTo(Set<Integer> insignificantXmlFeatureIds) {
- super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
- insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IJOIN_TABLE__DEFAULT_JOIN_COLUMNS);
- insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IJOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS);
- insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IJOIN_TABLE__JOIN_COLUMNS);
- insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IJOIN_TABLE__INVERSE_JOIN_COLUMNS);
- }
-
- private IJoinColumn createJoinColumn(IJoinColumn.Owner owner) {
- return OrmFactory.eINSTANCE.createXmlJoinColumn(owner);
- }
-
- private Adapter buildListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- XmlJoinTable.this.notifyChanged(notification);
- }
- };
- }
-
- /**
- * check for changes to the 'specifiedJoinColumns' and
- * 'specifiedInverseJoinColumns' lists so we can notify the
- * model adapter of any changes;
- * also listen for changes to the 'defaultJoinColumns' and
- * 'defaultInverseJoinColumns' lists so we can spank the developer
- */
- void notifyChanged(Notification notification) {
- switch (notification.getFeatureID(IJoinTable.class)) {
- case JpaCoreMappingsPackage.IJOIN_TABLE__DEFAULT_JOIN_COLUMNS :
- defaultJoinColumnsChanged(notification);
- break;
- case JpaCoreMappingsPackage.IJOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS :
- defaultInverseJoinColumnsChanged(notification);
- break;
- default :
- break;
- }
- }
-
- void defaultJoinColumnsChanged(Notification notification) {
- throw new IllegalStateException("'defaultJoinColumns' cannot be changed");
- }
-
- void defaultInverseJoinColumnsChanged(Notification notification) {
- throw new IllegalStateException("'defaultInverseJoinColumns' cannot be changed");
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_JOIN_TABLE;
- }
-
- /**
- * Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIJoinTable_JoinColumns()
- * @model type="org.eclipse.jpt.core.internal.mappings.IJoinColumn" containment="true" transient="true" changeable="false" volatile="true"
- * @generated NOT
- */
- public EList<IJoinColumn> getJoinColumns() {
- return this.getSpecifiedJoinColumns().isEmpty() ? this.getDefaultJoinColumns() : this.getSpecifiedJoinColumns();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIJoinTable_SpecifiedJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IJoinColumn> getSpecifiedJoinColumns() {
- if (specifiedJoinColumns == null) {
- specifiedJoinColumns = new EObjectContainmentEList<IJoinColumn>(IJoinColumn.class, this, OrmPackage.XML_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS);
- }
- return specifiedJoinColumns;
- }
-
- /**
- * Returns the value of the '<em><b>Default Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIJoinTable_DefaultJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IJoinColumn> getDefaultJoinColumns() {
- if (defaultJoinColumns == null) {
- defaultJoinColumns = new EObjectContainmentEList<IJoinColumn>(IJoinColumn.class, this, OrmPackage.XML_JOIN_TABLE__DEFAULT_JOIN_COLUMNS);
- }
- return defaultJoinColumns;
- }
-
- /**
- * Returns the value of the '<em><b>Inverse Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Inverse Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Inverse Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIJoinTable_InverseJoinColumns()
- * @model type="org.eclipse.jpt.core.internal.mappings.IJoinColumn" containment="true" transient="true" changeable="false" volatile="true"
- * @generated NOT
- */
- public EList<IJoinColumn> getInverseJoinColumns() {
- return this.getSpecifiedInverseJoinColumns().isEmpty() ? this.getDefaultInverseJoinColumns() : this.getSpecifiedInverseJoinColumns();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Inverse Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Inverse Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Inverse Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIJoinTable_SpecifiedInverseJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IJoinColumn> getSpecifiedInverseJoinColumns() {
- if (specifiedInverseJoinColumns == null) {
- specifiedInverseJoinColumns = new EObjectContainmentEList<IJoinColumn>(IJoinColumn.class, this, OrmPackage.XML_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS);
- }
- return specifiedInverseJoinColumns;
- }
-
- /**
- * Returns the value of the '<em><b>Default Inverse Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Inverse Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Inverse Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIJoinTable_DefaultInverseJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IJoinColumn> getDefaultInverseJoinColumns() {
- if (defaultInverseJoinColumns == null) {
- defaultInverseJoinColumns = new EObjectContainmentEList<IJoinColumn>(IJoinColumn.class, this, OrmPackage.XML_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS);
- }
- return defaultInverseJoinColumns;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_JOIN_TABLE__JOIN_COLUMNS :
- return ((InternalEList<?>) getJoinColumns()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS :
- return ((InternalEList<?>) getSpecifiedJoinColumns()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_JOIN_TABLE__DEFAULT_JOIN_COLUMNS :
- return ((InternalEList<?>) getDefaultJoinColumns()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_JOIN_TABLE__INVERSE_JOIN_COLUMNS :
- return ((InternalEList<?>) getInverseJoinColumns()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS :
- return ((InternalEList<?>) getSpecifiedInverseJoinColumns()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS :
- return ((InternalEList<?>) getDefaultInverseJoinColumns()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_JOIN_TABLE__JOIN_COLUMNS :
- return getJoinColumns();
- case OrmPackage.XML_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS :
- return getSpecifiedJoinColumns();
- case OrmPackage.XML_JOIN_TABLE__DEFAULT_JOIN_COLUMNS :
- return getDefaultJoinColumns();
- case OrmPackage.XML_JOIN_TABLE__INVERSE_JOIN_COLUMNS :
- return getInverseJoinColumns();
- case OrmPackage.XML_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS :
- return getSpecifiedInverseJoinColumns();
- case OrmPackage.XML_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS :
- return getDefaultInverseJoinColumns();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS :
- getSpecifiedJoinColumns().clear();
- getSpecifiedJoinColumns().addAll((Collection<? extends IJoinColumn>) newValue);
- return;
- case OrmPackage.XML_JOIN_TABLE__DEFAULT_JOIN_COLUMNS :
- getDefaultJoinColumns().clear();
- getDefaultJoinColumns().addAll((Collection<? extends IJoinColumn>) newValue);
- return;
- case OrmPackage.XML_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS :
- getSpecifiedInverseJoinColumns().clear();
- getSpecifiedInverseJoinColumns().addAll((Collection<? extends IJoinColumn>) newValue);
- return;
- case OrmPackage.XML_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS :
- getDefaultInverseJoinColumns().clear();
- getDefaultInverseJoinColumns().addAll((Collection<? extends IJoinColumn>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS :
- getSpecifiedJoinColumns().clear();
- return;
- case OrmPackage.XML_JOIN_TABLE__DEFAULT_JOIN_COLUMNS :
- getDefaultJoinColumns().clear();
- return;
- case OrmPackage.XML_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS :
- getSpecifiedInverseJoinColumns().clear();
- return;
- case OrmPackage.XML_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS :
- getDefaultInverseJoinColumns().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_JOIN_TABLE__JOIN_COLUMNS :
- return !getJoinColumns().isEmpty();
- case OrmPackage.XML_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS :
- return specifiedJoinColumns != null && !specifiedJoinColumns.isEmpty();
- case OrmPackage.XML_JOIN_TABLE__DEFAULT_JOIN_COLUMNS :
- return defaultJoinColumns != null && !defaultJoinColumns.isEmpty();
- case OrmPackage.XML_JOIN_TABLE__INVERSE_JOIN_COLUMNS :
- return !getInverseJoinColumns().isEmpty();
- case OrmPackage.XML_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS :
- return specifiedInverseJoinColumns != null && !specifiedInverseJoinColumns.isEmpty();
- case OrmPackage.XML_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS :
- return defaultInverseJoinColumns != null && !defaultInverseJoinColumns.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IJoinTable.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_JOIN_TABLE__JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IJOIN_TABLE__JOIN_COLUMNS;
- case OrmPackage.XML_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_JOIN_COLUMNS;
- case OrmPackage.XML_JOIN_TABLE__DEFAULT_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IJOIN_TABLE__DEFAULT_JOIN_COLUMNS;
- case OrmPackage.XML_JOIN_TABLE__INVERSE_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IJOIN_TABLE__INVERSE_JOIN_COLUMNS;
- case OrmPackage.XML_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS;
- case OrmPackage.XML_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.IJOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IJoinTable.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IJOIN_TABLE__JOIN_COLUMNS :
- return OrmPackage.XML_JOIN_TABLE__JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_JOIN_COLUMNS :
- return OrmPackage.XML_JOIN_TABLE__SPECIFIED_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IJOIN_TABLE__DEFAULT_JOIN_COLUMNS :
- return OrmPackage.XML_JOIN_TABLE__DEFAULT_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IJOIN_TABLE__INVERSE_JOIN_COLUMNS :
- return OrmPackage.XML_JOIN_TABLE__INVERSE_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS :
- return OrmPackage.XML_JOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.IJOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS :
- return OrmPackage.XML_JOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- private XmlMultiRelationshipMappingInternal getMultiRelationshipMapping() {
- return (XmlMultiRelationshipMappingInternal) eContainer();
- }
-
- @Override
- protected void makeTableForXmlNonNull() {
- getMultiRelationshipMapping().makeJoinTableForXmlNonNull();
- }
-
- @Override
- protected void makeTableForXmlNull() {
- getMultiRelationshipMapping().makeJoinTableForXmlNull();
- }
-
- // ********** IJoinTable implementation **********
- public IJoinColumn createJoinColumn(int index) {
- return this.createXmlJoinColumn(index);
- }
-
- private XmlJoinColumn createXmlJoinColumn(int index) {
- return OrmFactory.eINSTANCE.createXmlJoinColumn(new JoinColumnOwner(this));
- //return XmlJoinColumn.createJoinTableJoinColumn(new JoinColumnOwner(), this.getMember(), index);
- }
-
- public IJoinColumn createInverseJoinColumn(int index) {
- return this.createXmlInverseJoinColumn(index);
- }
-
- private XmlJoinColumn createXmlInverseJoinColumn(int index) {
- return OrmFactory.eINSTANCE.createXmlJoinColumn(new InverseJoinColumnOwner(this));
- //return JavaJoinColumn.createJoinTableInverseJoinColumn(new InverseJoinColumnOwner(), this.getMember(), index);
- }
-
- public boolean containsSpecifiedJoinColumns() {
- return !this.getSpecifiedJoinColumns().isEmpty();
- }
-
- public boolean containsSpecifiedInverseJoinColumns() {
- return !this.getSpecifiedInverseJoinColumns().isEmpty();
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext) {
- super.refreshDefaults(defaultsContext);
- setDefaultName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_TABLE_NAME_KEY));
- }
-
- public boolean isSpecified() {
- return node != null;
- }
-
- public IRelationshipMapping relationshipMapping() {
- return (IRelationshipMapping) this.eContainer();
- }
-} // XmlJoinTable
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlManyToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlManyToMany.java
deleted file mode 100644
index 183e112595..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlManyToMany.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.mappings.IManyToMany;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Many To Many</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlManyToMany()
- * @model kind="class"
- * @generated
- */
-public class XmlManyToMany extends XmlMultiRelationshipMappingInternal
- implements IManyToMany
-{
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlManyToMany() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_MANY_TO_MANY;
- }
-
- public String getKey() {
- return IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- protected void initializeOn(XmlAttributeMapping newMapping) {
- newMapping.initializeFromXmlManyToManyMapping(this);
- }
-
- @Override
- public int xmlSequence() {
- return 6;
- }
-
- // ********** INonOwningMapping implementation **********
- public boolean mappedByIsValid(IAttributeMapping mappedByMapping) {
- String mappedByKey = mappedByMapping.getKey();
- return (mappedByKey == IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlManyToManyProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlManyToManyProvider.java
deleted file mode 100644
index 2ddab39dac..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlManyToManyProvider.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.jpt.core.internal.IMappingKeys;
-
-public class XmlManyToManyProvider implements IXmlAttributeMappingProvider
-{
- // singleton
- private static final XmlManyToManyProvider INSTANCE = new XmlManyToManyProvider();
-
- /**
- * Return the singleton.
- */
- public static IXmlAttributeMappingProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private XmlManyToManyProvider() {
- super();
- }
-
- public XmlAttributeMapping buildAttributeMapping() {
- return OrmFactory.eINSTANCE.createXmlManyToMany();
- }
-
- public String key() {
- return IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlManyToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlManyToOne.java
deleted file mode 100644
index 244e45f066..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlManyToOne.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.mappings.IManyToOne;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Many To One</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlManyToOne()
- * @model kind="class"
- * @generated
- */
-public class XmlManyToOne extends XmlSingleRelationshipMapping
- implements IManyToOne
-{
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlManyToOne() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_MANY_TO_ONE;
- }
-
- @Override
- public int xmlSequence() {
- return 3;
- }
-
- public String getKey() {
- return IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- protected void initializeOn(XmlAttributeMapping newMapping) {
- newMapping.initializeFromXmlManyToOneMapping(this);
- }
-
- @Override
- public boolean isOverridableAssociationMapping() {
- return true;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMappedSuperclass.java
deleted file mode 100644
index 7340896db3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMappedSuperclass.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.mappings.IMappedSuperclass;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Xml Mapped Superclass</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass#getIdClassForXml <em>Id Class For Xml</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMappedSuperclass()
- * @model kind="class"
- * @generated
- */
-public class XmlMappedSuperclass extends XmlTypeMapping
- implements IMappedSuperclass
-{
- /**
- * The default value of the '{@link #getIdClass() <em>Id Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getIdClass()
- * @generated
- * @ordered
- */
- protected static final String ID_CLASS_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getIdClass() <em>Id Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getIdClass()
- * @generated
- * @ordered
- */
- protected String idClass = ID_CLASS_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getIdClassForXml() <em>Id Class For Xml</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getIdClassForXml()
- * @generated
- * @ordered
- */
- protected XmlIdClass idClassForXml;
-
- protected XmlMappedSuperclass() {
- super();
- this.eAdapters().add(this.buildListener());
- }
-
- protected Adapter buildListener() {
- return new AdapterImpl() {
- @Override
- public void notifyChanged(Notification notification) {
- XmlMappedSuperclass.this.notifyChanged(notification);
- }
- };
- }
-
- protected void notifyChanged(Notification notification) {
- switch (notification.getFeatureID(IMappedSuperclass.class)) {
- case JpaCoreMappingsPackage.IMAPPED_SUPERCLASS__ID_CLASS :
- idClassChanged();
- break;
- default :
- break;
- }
- switch (notification.getFeatureID(XmlMappedSuperclass.class)) {
- case OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS_FOR_XML :
- xmlIdClassChanged();
- break;
- default :
- break;
- }
- }
-
- protected void idClassChanged() {
- if (getIdClass() == null) {
- setIdClassForXml(null);
- }
- else {
- if (getIdClassForXml() == null) {
- setIdClassForXml(OrmFactory.eINSTANCE.createXmlIdClass());
- }
- getIdClassForXml().setValue(getIdClass());
- }
- }
-
- protected void xmlIdClassChanged() {
- if (getIdClassForXml() == null) {
- setIdClass(null);
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_MAPPED_SUPERCLASS;
- }
-
- /**
- * Returns the value of the '<em><b>Id Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Id Class</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Id Class</em>' attribute.
- * @see #setIdClass(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIMappedSuperclass_IdClass()
- * @model
- * @generated
- */
- public String getIdClass() {
- return idClass;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass#getIdClass <em>Id Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Id Class</em>' attribute.
- * @see #getIdClass()
- * @generated
- */
- public void setIdClass(String newIdClass) {
- String oldIdClass = idClass;
- idClass = newIdClass;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS, oldIdClass, idClass));
- }
-
- /**
- * Returns the value of the '<em><b>Id Class For Xml</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Id Class For Xml</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Id Class For Xml</em>' containment reference.
- * @see #setIdClassForXml(XmlIdClass)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMappedSuperclass_IdClassForXml()
- * @model containment="true"
- * @generated
- */
- public XmlIdClass getIdClassForXml() {
- return idClassForXml;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetIdClassForXml(XmlIdClass newIdClassForXml, NotificationChain msgs) {
- XmlIdClass oldIdClassForXml = idClassForXml;
- idClassForXml = newIdClassForXml;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS_FOR_XML, oldIdClassForXml, newIdClassForXml);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass#getIdClassForXml <em>Id Class For Xml</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Id Class For Xml</em>' containment reference.
- * @see #getIdClassForXml()
- * @generated
- */
- public void setIdClassForXml(XmlIdClass newIdClassForXml) {
- if (newIdClassForXml != idClassForXml) {
- NotificationChain msgs = null;
- if (idClassForXml != null)
- msgs = ((InternalEObject) idClassForXml).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS_FOR_XML, null, msgs);
- if (newIdClassForXml != null)
- msgs = ((InternalEObject) newIdClassForXml).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS_FOR_XML, null, msgs);
- msgs = basicSetIdClassForXml(newIdClassForXml, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS_FOR_XML, newIdClassForXml, newIdClassForXml));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS_FOR_XML :
- return basicSetIdClassForXml(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS :
- return getIdClass();
- case OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS_FOR_XML :
- return getIdClassForXml();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS :
- setIdClass((String) newValue);
- return;
- case OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS_FOR_XML :
- setIdClassForXml((XmlIdClass) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS :
- setIdClass(ID_CLASS_EDEFAULT);
- return;
- case OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS_FOR_XML :
- setIdClassForXml((XmlIdClass) null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS :
- return ID_CLASS_EDEFAULT == null ? idClass != null : !ID_CLASS_EDEFAULT.equals(idClass);
- case OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS_FOR_XML :
- return idClassForXml != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IMappedSuperclass.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS :
- return JpaCoreMappingsPackage.IMAPPED_SUPERCLASS__ID_CLASS;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IMappedSuperclass.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IMAPPED_SUPERCLASS__ID_CLASS :
- return OrmPackage.XML_MAPPED_SUPERCLASS__ID_CLASS;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (idClass: ");
- result.append(idClass);
- result.append(')');
- return result.toString();
- }
-
- public String getKey() {
- return IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
- public Iterator<String> associatedTableNamesIncludingInherited() {
- return EmptyIterator.instance();
- }
-
- public Iterator<ITable> associatedTables() {
- return EmptyIterator.instance();
- }
-
- public Iterator<ITable> associatedTablesIncludingInherited() {
- return EmptyIterator.instance();
- }
-
- public Iterator<String> overridableAttributeNames() {
- return this.namesOf(this.overridableAttributes());
- }
-
- public Iterator<IPersistentAttribute> overridableAttributes() {
- return new FilteringIterator<IPersistentAttribute>(this.getPersistentType().attributes()) {
- @Override
- protected boolean accept(Object o) {
- return ((IPersistentAttribute) o).isOverridableAttribute();
- }
- };
- }
-
- public Iterator<String> overridableAssociationNames() {
- return this.namesOf(this.overridableAssociations());
- }
-
- public Iterator<IPersistentAttribute> overridableAssociations() {
- return new FilteringIterator<IPersistentAttribute>(this.getPersistentType().attributes()) {
- @Override
- protected boolean accept(Object o) {
- return ((IPersistentAttribute) o).isOverridableAssociation();
- }
- };
- }
-
- private Iterator<String> namesOf(Iterator<IPersistentAttribute> attributes) {
- return new TransformationIterator<IPersistentAttribute, String>(attributes) {
- @Override
- protected String transform(IPersistentAttribute attribute) {
- return attribute.getName();
- }
- };
- }
-
- @Override
- public int xmlSequence() {
- return 0;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMultiRelationshipMapping.java
deleted file mode 100644
index d5f17f8b56..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMultiRelationshipMapping.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Multi Relationship Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMultiRelationshipMapping()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface XmlMultiRelationshipMapping extends IMultiRelationshipMapping
-{} // XmlMultiRelationshipMapping
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMultiRelationshipMappingForXml.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMultiRelationshipMappingForXml.java
deleted file mode 100644
index 333d0cc30c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMultiRelationshipMappingForXml.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Multi Relationship Mapping For Xml</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml#getJoinTableForXml <em>Join Table For Xml</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml#getMapKeyForXml <em>Map Key For Xml</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMultiRelationshipMappingForXml()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface XmlMultiRelationshipMappingForXml extends EObject
-{
- /**
- * Returns the value of the '<em><b>Join Table For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Join Table For Xml</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Join Table For Xml</em>' reference.
- * @see #setJoinTableForXml(XmlJoinTable)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMultiRelationshipMappingForXml_JoinTableForXml()
- * @model resolveProxies="false" volatile="true"
- * @generated
- */
- XmlJoinTable getJoinTableForXml();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml#getJoinTableForXml <em>Join Table For Xml</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Join Table For Xml</em>' reference.
- * @see #getJoinTableForXml()
- * @generated
- */
- void setJoinTableForXml(XmlJoinTable value);
-
- /**
- * Returns the value of the '<em><b>Map Key For Xml</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Map Key For Xml</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Map Key For Xml</em>' containment reference.
- * @see #setMapKeyForXml(XmlMapKey)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMultiRelationshipMappingForXml_MapKeyForXml()
- * @model containment="true"
- * @generated
- */
- XmlMapKey getMapKeyForXml();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml#getMapKeyForXml <em>Map Key For Xml</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Map Key For Xml</em>' containment reference.
- * @see #getMapKeyForXml()
- * @generated
- */
- void setMapKeyForXml(XmlMapKey value);
-} // XmlMultiRelationshipMappingForXml
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMultiRelationshipMappingInternal.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMultiRelationshipMappingInternal.java
deleted file mode 100644
index 6e0eb00c48..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMultiRelationshipMappingInternal.java
+++ /dev/null
@@ -1,836 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaRelationshipMapping;
-import org.eclipse.jpt.core.internal.content.orm.resource.OrmXmlMapper;
-import org.eclipse.jpt.core.internal.emfutility.DOMUtilities;
-import org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.INonOwningMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Multi Relationship Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMultiRelationshipMappingInternal()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class XmlMultiRelationshipMappingInternal
- extends XmlRelationshipMapping
- implements IMultiRelationshipMapping, XmlMultiRelationshipMappingForXml,
- XmlMultiRelationshipMapping
-{
- /**
- * The default value of the '{@link #getMappedBy() <em>Mapped By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMappedBy()
- * @generated
- * @ordered
- */
- protected static final String MAPPED_BY_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getMappedBy() <em>Mapped By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMappedBy()
- * @generated
- * @ordered
- */
- protected String mappedBy = MAPPED_BY_EDEFAULT;
-
- /**
- * The default value of the '{@link #getOrderBy() <em>Order By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getOrderBy()
- * @generated
- * @ordered
- */
- protected static final String ORDER_BY_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getOrderBy() <em>Order By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getOrderBy()
- * @generated
- * @ordered
- */
- protected String orderBy = ORDER_BY_EDEFAULT;
-
- /**
- * The default value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getFetch()
- * @generated
- * @ordered
- */
- protected static final DefaultLazyFetchType FETCH_EDEFAULT = DefaultLazyFetchType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getFetch()
- * @generated
- * @ordered
- */
- protected DefaultLazyFetchType fetch = FETCH_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getJoinTable() <em>Join Table</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getJoinTable()
- * @generated
- * @ordered
- */
- protected IJoinTable joinTable;
-
- /**
- * The default value of the '{@link #getMapKey() <em>Map Key</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMapKey()
- * @generated
- * @ordered
- */
- protected static final String MAP_KEY_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getMapKey() <em>Map Key</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMapKey()
- * @generated
- * @ordered
- */
- protected String mapKey = MAP_KEY_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getMapKeyForXml() <em>Map Key For Xml</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMapKeyForXml()
- * @generated
- * @ordered
- */
- protected XmlMapKey mapKeyForXml;
-
- protected XmlMultiRelationshipMappingInternal() {
- super();
- this.joinTable = OrmFactory.eINSTANCE.createXmlJoinTable(buildJoinTableOwner());
- ((InternalEObject) this.joinTable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE, null, null);
- this.eAdapters().add(this.buildListener());
- }
-
- protected Adapter buildListener() {
- return new AdapterImpl() {
- @Override
- public void notifyChanged(Notification notification) {
- XmlMultiRelationshipMappingInternal.this.notifyChanged(notification);
- }
- };
- }
-
- protected void notifyChanged(Notification notification) {
- switch (notification.getFeatureID(IMultiRelationshipMapping.class)) {
- case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__MAP_KEY :
- mapKeyChanged();
- break;
- default :
- break;
- }
- switch (notification.getFeatureID(XmlMultiRelationshipMappingForXml.class)) {
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY_FOR_XML :
- xmlMapKeyChanged();
- break;
- default :
- break;
- }
- }
-
- protected void mapKeyChanged() {
- if (getMapKey() == null) {
- setMapKeyForXml(null);
- }
- else {
- if (getMapKeyForXml() == null) {
- setMapKeyForXml(OrmFactory.eINSTANCE.createXmlMapKey());
- }
- getMapKeyForXml().setName(getMapKey());
- }
- }
-
- protected void xmlMapKeyChanged() {
- if (getMapKeyForXml() == null) {
- setMapKey(null);
- }
- }
-
- private IJoinTable.Owner buildJoinTableOwner() {
- return new IJoinTable.Owner() {
- public ITextRange validationTextRange() {
- return XmlMultiRelationshipMappingInternal.this.validationTextRange();
- }
-
- public ITypeMapping getTypeMapping() {
- return XmlMultiRelationshipMappingInternal.this.typeMapping();
- }
- };
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL;
- }
-
- /**
- * Returns the value of the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Mapped By</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Mapped By</em>' attribute.
- * @see #setMappedBy(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getINonOwningMapping_MappedBy()
- * @model
- * @generated
- */
- public String getMappedBy() {
- return mappedBy;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal#getMappedBy <em>Mapped By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Mapped By</em>' attribute.
- * @see #getMappedBy()
- * @generated
- */
- public void setMappedBy(String newMappedBy) {
- String oldMappedBy = mappedBy;
- mappedBy = newMappedBy;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAPPED_BY, oldMappedBy, mappedBy));
- }
-
- /**
- * Returns the value of the '<em><b>Order By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Order By</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Order By</em>' attribute.
- * @see #setOrderBy(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIMultiRelationshipMapping_OrderBy()
- * @model unique="false" ordered="false"
- * @generated
- */
- public String getOrderBy() {
- return orderBy;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal#getOrderBy <em>Order By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Order By</em>' attribute.
- * @see #getOrderBy()
- * @generated
- */
- public void setOrderBy(String newOrderBy) {
- String oldOrderBy = orderBy;
- orderBy = newOrderBy;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY, oldOrderBy, orderBy));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation" unique="false" required="true" ordered="false"
- * @generated NOT
- */
- public boolean isNoOrdering() {
- return getOrderBy() == null;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated NOT
- */
- public void setNoOrdering() {
- setOrderBy(null);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation" unique="false" required="true" ordered="false"
- * @generated NOT
- */
- public boolean isOrderByPk() {
- return "".equals(getOrderBy());
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated NOT
- */
- public void setOrderByPk() {
- setOrderBy("");
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation" unique="false" required="true" ordered="false"
- * @generated NOT
- */
- public boolean isCustomOrdering() {
- return !StringTools.stringIsEmpty(getOrderBy());
- }
-
- public ITextRange mappedByTextRange() {
- if (node == null) {
- return typeMapping().validationTextRange();
- }
- IDOMNode mappedByNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.MAPPED_BY);
- return (mappedByNode == null) ? validationTextRange() : buildTextRange(mappedByNode);
- }
-
- /**
- * Returns the value of the '<em><b>Fetch</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Fetch</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType
- * @see #setFetch(DefaultLazyFetchType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIMultiRelationshipMapping_Fetch()
- * @model
- * @generated
- */
- public DefaultLazyFetchType getFetch() {
- return fetch;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal#getFetch <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType
- * @see #getFetch()
- * @generated
- */
- public void setFetch(DefaultLazyFetchType newFetch) {
- DefaultLazyFetchType oldFetch = fetch;
- fetch = newFetch == null ? FETCH_EDEFAULT : newFetch;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__FETCH, oldFetch, fetch));
- }
-
- /**
- * Returns the value of the '<em><b>Join Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Join Table</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Join Table</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIMultiRelationshipMapping_JoinTable()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- public IJoinTable getJoinTable() {
- return joinTable;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetJoinTable(IJoinTable newJoinTable, NotificationChain msgs) {
- IJoinTable oldJoinTable = joinTable;
- joinTable = newJoinTable;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE, oldJoinTable, newJoinTable);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- public boolean isJoinTableSpecified() {
- XmlJoinTable table = getJoinTableForXml();
- return table != null && table.isSpecified();
- }
-
- /**
- * Returns the value of the '<em><b>Map Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Map Key</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Map Key</em>' attribute.
- * @see #setMapKey(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIMultiRelationshipMapping_MapKey()
- * @model
- * @generated
- */
- public String getMapKey() {
- return mapKey;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal#getMapKey <em>Map Key</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Map Key</em>' attribute.
- * @see #getMapKey()
- * @generated
- */
- public void setMapKey(String newMapKey) {
- String oldMapKey = mapKey;
- mapKey = newMapKey;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY, oldMapKey, mapKey));
- }
-
- private XmlJoinTable getJoinTableInternal() {
- return (XmlJoinTable) getJoinTable();
- }
-
- public XmlJoinTable getJoinTableForXml() {
- if (getJoinTableInternal().isAllFeaturesUnset()) {
- return null;
- }
- return getJoinTableInternal();
- }
-
- public void setJoinTableForXmlGen(XmlJoinTable newJoinTableForXml) {
- XmlJoinTable oldValue = newJoinTableForXml == null ? (XmlJoinTable) getJoinTable() : null;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE_FOR_XML, oldValue, newJoinTableForXml));
- }
-
- public void setJoinTableForXml(XmlJoinTable newJoinTableForXml) {
- setJoinTableForXmlGen(newJoinTableForXml);
- if (newJoinTableForXml == null) {
- getJoinTableInternal().unsetAllAttributes();
- }
- }
-
- /**
- * Returns the value of the '<em><b>Map Key For Xml</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Map Key For Xml</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Map Key For Xml</em>' containment reference.
- * @see #setMapKeyForXml(XmlMapKey)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMultiRelationshipMappingForXml_MapKeyForXml()
- * @model containment="true"
- * @generated
- */
- public XmlMapKey getMapKeyForXml() {
- return mapKeyForXml;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetMapKeyForXml(XmlMapKey newMapKeyForXml, NotificationChain msgs) {
- XmlMapKey oldMapKeyForXml = mapKeyForXml;
- mapKeyForXml = newMapKeyForXml;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY_FOR_XML, oldMapKeyForXml, newMapKeyForXml);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal#getMapKeyForXml <em>Map Key For Xml</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Map Key For Xml</em>' containment reference.
- * @see #getMapKeyForXml()
- * @generated
- */
- public void setMapKeyForXml(XmlMapKey newMapKeyForXml) {
- if (newMapKeyForXml != mapKeyForXml) {
- NotificationChain msgs = null;
- if (mapKeyForXml != null)
- msgs = ((InternalEObject) mapKeyForXml).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY_FOR_XML, null, msgs);
- if (newMapKeyForXml != null)
- msgs = ((InternalEObject) newMapKeyForXml).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY_FOR_XML, null, msgs);
- msgs = basicSetMapKeyForXml(newMapKeyForXml, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY_FOR_XML, newMapKeyForXml, newMapKeyForXml));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE :
- return basicSetJoinTable(null, msgs);
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY_FOR_XML :
- return basicSetMapKeyForXml(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAPPED_BY :
- return getMappedBy();
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY :
- return getOrderBy();
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__FETCH :
- return getFetch();
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE :
- return getJoinTable();
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY :
- return getMapKey();
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE_FOR_XML :
- return getJoinTableForXml();
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY_FOR_XML :
- return getMapKeyForXml();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAPPED_BY :
- setMappedBy((String) newValue);
- return;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY :
- setOrderBy((String) newValue);
- return;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__FETCH :
- setFetch((DefaultLazyFetchType) newValue);
- return;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY :
- setMapKey((String) newValue);
- return;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE_FOR_XML :
- setJoinTableForXml((XmlJoinTable) newValue);
- return;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY_FOR_XML :
- setMapKeyForXml((XmlMapKey) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAPPED_BY :
- setMappedBy(MAPPED_BY_EDEFAULT);
- return;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY :
- setOrderBy(ORDER_BY_EDEFAULT);
- return;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__FETCH :
- setFetch(FETCH_EDEFAULT);
- return;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY :
- setMapKey(MAP_KEY_EDEFAULT);
- return;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE_FOR_XML :
- setJoinTableForXml((XmlJoinTable) null);
- return;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY_FOR_XML :
- setMapKeyForXml((XmlMapKey) null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAPPED_BY :
- return MAPPED_BY_EDEFAULT == null ? mappedBy != null : !MAPPED_BY_EDEFAULT.equals(mappedBy);
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY :
- return ORDER_BY_EDEFAULT == null ? orderBy != null : !ORDER_BY_EDEFAULT.equals(orderBy);
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__FETCH :
- return fetch != FETCH_EDEFAULT;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE :
- return joinTable != null;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY :
- return MAP_KEY_EDEFAULT == null ? mapKey != null : !MAP_KEY_EDEFAULT.equals(mapKey);
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE_FOR_XML :
- return getJoinTableForXml() != null;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY_FOR_XML :
- return mapKeyForXml != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == INonOwningMapping.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAPPED_BY :
- return JpaCoreMappingsPackage.INON_OWNING_MAPPING__MAPPED_BY;
- default :
- return -1;
- }
- }
- if (baseClass == IMultiRelationshipMapping.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY :
- return JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__ORDER_BY;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__FETCH :
- return JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__FETCH;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE :
- return JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__JOIN_TABLE;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY :
- return JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__MAP_KEY;
- default :
- return -1;
- }
- }
- if (baseClass == XmlMultiRelationshipMappingForXml.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE_FOR_XML :
- return OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_FOR_XML__JOIN_TABLE_FOR_XML;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY_FOR_XML :
- return OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_FOR_XML__MAP_KEY_FOR_XML;
- default :
- return -1;
- }
- }
- if (baseClass == XmlMultiRelationshipMapping.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == INonOwningMapping.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.INON_OWNING_MAPPING__MAPPED_BY :
- return OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAPPED_BY;
- default :
- return -1;
- }
- }
- if (baseClass == IMultiRelationshipMapping.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__ORDER_BY :
- return OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__ORDER_BY;
- case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__FETCH :
- return OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__FETCH;
- case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__JOIN_TABLE :
- return OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE;
- case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__MAP_KEY :
- return OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY;
- default :
- return -1;
- }
- }
- if (baseClass == XmlMultiRelationshipMappingForXml.class) {
- switch (baseFeatureID) {
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_FOR_XML__JOIN_TABLE_FOR_XML :
- return OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__JOIN_TABLE_FOR_XML;
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_FOR_XML__MAP_KEY_FOR_XML :
- return OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL__MAP_KEY_FOR_XML;
- default :
- return -1;
- }
- }
- if (baseClass == XmlMultiRelationshipMapping.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (mappedBy: ");
- result.append(mappedBy);
- result.append(", orderBy: ");
- result.append(orderBy);
- result.append(", fetch: ");
- result.append(fetch);
- result.append(", mapKey: ");
- result.append(mapKey);
- result.append(')');
- return result.toString();
- }
-
- public void makeJoinTableForXmlNull() {
- setJoinTableForXmlGen(null);
- }
-
- public void makeJoinTableForXmlNonNull() {
- setJoinTableForXmlGen(getJoinTableForXml());
- }
-
- @Override
- public void initializeFromXmlMulitRelationshipMapping(XmlMultiRelationshipMappingInternal oldMapping) {
- super.initializeFromXmlMulitRelationshipMapping(oldMapping);
- setFetch(oldMapping.getFetch());
- }
-
- public Iterator<String> candidateMapKeyNames() {
- return this.allTargetEntityAttributeNames();
- }
-
- public void refreshDefaults(DefaultsContext defaultsContext) {
- super.refreshDefaults(defaultsContext);
- // TODO
- // if (isOrderByPk()) {
- // refreshDefaultOrderBy(defaultsContext);
- // }
- }
-
- //primary key ordering when just the @OrderBy annotation is present
- protected void refreshDefaultOrderBy(DefaultsContext defaultsContext) {
- IEntity targetEntity = getResolvedTargetEntity();
- if (targetEntity != null) {
- setOrderBy(targetEntity.primaryKeyAttributeName() + " ASC");
- }
- }
-
- //TODO copied from JavaMultiRelationshipMapping
- /**
- * extract the element type from the specified container signature and
- * convert it into a reference entity type name;
- * return null if the type is not a valid reference entity type (e.g. it's
- * another container or an array or a primitive or other Basic type)
- */
- @Override
- protected String javaDefaultTargetEntity(ITypeBinding typeBinding) {
- String typeName = super.javaDefaultTargetEntity(typeBinding);
- return JavaRelationshipMapping.typeNamedIsContainer(typeName) ? this.javaDefaultTargetEntityFromContainer(typeBinding) : null;
- }
-
- protected String javaDefaultTargetEntityFromContainer(ITypeBinding typeBinding) {
- return JavaMultiRelationshipMapping.javaDefaultTargetEntityFromContainer(typeBinding);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlNamedNativeQuery.java
deleted file mode 100644
index e1de3f77ee..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlNamedNativeQuery.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.mappings.INamedNativeQuery;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Named Native Query</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlNamedNativeQuery()
- * @model kind="class"
- * @generated
- */
-public class XmlNamedNativeQuery extends AbstractXmlQuery
- implements INamedNativeQuery
-{
- /**
- * The default value of the '{@link #getResultClass() <em>Result Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getResultClass()
- * @generated
- * @ordered
- */
- protected static final String RESULT_CLASS_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getResultClass() <em>Result Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getResultClass()
- * @generated
- * @ordered
- */
- protected String resultClass = RESULT_CLASS_EDEFAULT;
-
- /**
- * The default value of the '{@link #getResultSetMapping() <em>Result Set Mapping</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getResultSetMapping()
- * @generated
- * @ordered
- */
- protected static final String RESULT_SET_MAPPING_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getResultSetMapping() <em>Result Set Mapping</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getResultSetMapping()
- * @generated
- * @ordered
- */
- protected String resultSetMapping = RESULT_SET_MAPPING_EDEFAULT;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlNamedNativeQuery() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_NAMED_NATIVE_QUERY;
- }
-
- /**
- * Returns the value of the '<em><b>Result Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Result Class</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Result Class</em>' attribute.
- * @see #setResultClass(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getINamedNativeQuery_ResultClass()
- * @model
- * @generated
- */
- public String getResultClass() {
- return resultClass;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlNamedNativeQuery#getResultClass <em>Result Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Result Class</em>' attribute.
- * @see #getResultClass()
- * @generated
- */
- public void setResultClass(String newResultClass) {
- String oldResultClass = resultClass;
- resultClass = newResultClass;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_CLASS, oldResultClass, resultClass));
- }
-
- /**
- * Returns the value of the '<em><b>Result Set Mapping</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Result Set Mapping</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Result Set Mapping</em>' attribute.
- * @see #setResultSetMapping(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getINamedNativeQuery_ResultSetMapping()
- * @model
- * @generated
- */
- public String getResultSetMapping() {
- return resultSetMapping;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlNamedNativeQuery#getResultSetMapping <em>Result Set Mapping</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Result Set Mapping</em>' attribute.
- * @see #getResultSetMapping()
- * @generated
- */
- public void setResultSetMapping(String newResultSetMapping) {
- String oldResultSetMapping = resultSetMapping;
- resultSetMapping = newResultSetMapping;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING, oldResultSetMapping, resultSetMapping));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_CLASS :
- return getResultClass();
- case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
- return getResultSetMapping();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_CLASS :
- setResultClass((String) newValue);
- return;
- case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
- setResultSetMapping((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_CLASS :
- setResultClass(RESULT_CLASS_EDEFAULT);
- return;
- case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
- setResultSetMapping(RESULT_SET_MAPPING_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_CLASS :
- return RESULT_CLASS_EDEFAULT == null ? resultClass != null : !RESULT_CLASS_EDEFAULT.equals(resultClass);
- case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
- return RESULT_SET_MAPPING_EDEFAULT == null ? resultSetMapping != null : !RESULT_SET_MAPPING_EDEFAULT.equals(resultSetMapping);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == INamedNativeQuery.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_CLASS :
- return JpaCoreMappingsPackage.INAMED_NATIVE_QUERY__RESULT_CLASS;
- case OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
- return JpaCoreMappingsPackage.INAMED_NATIVE_QUERY__RESULT_SET_MAPPING;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == INamedNativeQuery.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.INAMED_NATIVE_QUERY__RESULT_CLASS :
- return OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_CLASS;
- case JpaCoreMappingsPackage.INAMED_NATIVE_QUERY__RESULT_SET_MAPPING :
- return OrmPackage.XML_NAMED_NATIVE_QUERY__RESULT_SET_MAPPING;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (resultClass: ");
- result.append(resultClass);
- result.append(", resultSetMapping: ");
- result.append(resultSetMapping);
- result.append(')');
- return result.toString();
- }
-} // XmlNamedNativeQuery
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOneToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOneToMany.java
deleted file mode 100644
index 2a01ead6fe..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOneToMany.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.mappings.IOneToMany;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml One To Many</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlOneToMany()
- * @model kind="class"
- * @generated
- */
-public class XmlOneToMany extends XmlMultiRelationshipMappingInternal
- implements IOneToMany
-{
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlOneToMany() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_ONE_TO_MANY;
- }
-
- public String getKey() {
- return IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- protected void initializeOn(XmlAttributeMapping newMapping) {
- newMapping.initializeFromXmlOneToManyMapping(this);
- }
-
- public int xmlSequence() {
- return 4;
- }
-
- // ********** INonOwningMapping implementation **********
- public boolean mappedByIsValid(IAttributeMapping mappedByMapping) {
- String mappedByKey = mappedByMapping.getKey();
- return (mappedByKey == IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOneToManyProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOneToManyProvider.java
deleted file mode 100644
index cb25ed79fb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOneToManyProvider.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.jpt.core.internal.IMappingKeys;
-
-public class XmlOneToManyProvider implements IXmlAttributeMappingProvider
-{
- // singleton
- private static final XmlOneToManyProvider INSTANCE = new XmlOneToManyProvider();
-
- /**
- * Return the singleton.
- */
- public static IXmlAttributeMappingProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private XmlOneToManyProvider() {
- super();
- }
-
- public XmlAttributeMapping buildAttributeMapping() {
- return OrmFactory.eINSTANCE.createXmlOneToMany();
- }
-
- public String key() {
- return IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOneToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOneToOne.java
deleted file mode 100644
index f51105b5a2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOneToOne.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.content.orm.resource.OrmXmlMapper;
-import org.eclipse.jpt.core.internal.emfutility.DOMUtilities;
-import org.eclipse.jpt.core.internal.mappings.INonOwningMapping;
-import org.eclipse.jpt.core.internal.mappings.IOneToOne;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml One To One</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlOneToOne()
- * @model kind="class"
- * @generated
- */
-public class XmlOneToOne extends XmlSingleRelationshipMapping
- implements IOneToOne
-{
- /**
- * The default value of the '{@link #getMappedBy() <em>Mapped By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMappedBy()
- * @generated
- * @ordered
- */
- protected static final String MAPPED_BY_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getMappedBy() <em>Mapped By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMappedBy()
- * @generated
- * @ordered
- */
- protected String mappedBy = MAPPED_BY_EDEFAULT;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlOneToOne() {
- super();
- }
-
- @Override
- protected void initializeOn(XmlAttributeMapping newMapping) {
- newMapping.initializeFromXmlOneToOneMapping(this);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_ONE_TO_ONE;
- }
-
- /**
- * Returns the value of the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Mapped By</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Mapped By</em>' attribute.
- * @see #setMappedBy(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getINonOwningMapping_MappedBy()
- * @model
- * @generated
- */
- public String getMappedBy() {
- return mappedBy;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlOneToOne#getMappedBy <em>Mapped By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Mapped By</em>' attribute.
- * @see #getMappedBy()
- * @generated
- */
- public void setMappedBy(String newMappedBy) {
- String oldMappedBy = mappedBy;
- mappedBy = newMappedBy;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ONE_TO_ONE__MAPPED_BY, oldMappedBy, mappedBy));
- }
-
- public boolean mappedByIsValid(IAttributeMapping mappedByMapping) {
- String mappedByKey = mappedByMapping.getKey();
- return (mappedByKey == IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
- }
-
- public ITextRange mappedByTextRange() {
- if (node == null) {
- return typeMapping().validationTextRange();
- }
- IDOMNode mappedByNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.MAPPED_BY);
- return (mappedByNode == null) ? validationTextRange() : buildTextRange(mappedByNode);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_ONE_TO_ONE__MAPPED_BY :
- return getMappedBy();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_ONE_TO_ONE__MAPPED_BY :
- setMappedBy((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_ONE_TO_ONE__MAPPED_BY :
- setMappedBy(MAPPED_BY_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_ONE_TO_ONE__MAPPED_BY :
- return MAPPED_BY_EDEFAULT == null ? mappedBy != null : !MAPPED_BY_EDEFAULT.equals(mappedBy);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == INonOwningMapping.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_ONE_TO_ONE__MAPPED_BY :
- return JpaCoreMappingsPackage.INON_OWNING_MAPPING__MAPPED_BY;
- default :
- return -1;
- }
- }
- if (baseClass == IOneToOne.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == INonOwningMapping.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.INON_OWNING_MAPPING__MAPPED_BY :
- return OrmPackage.XML_ONE_TO_ONE__MAPPED_BY;
- default :
- return -1;
- }
- }
- if (baseClass == IOneToOne.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (mappedBy: ");
- result.append(mappedBy);
- result.append(')');
- return result.toString();
- }
-
- @Override
- public int xmlSequence() {
- return 5;
- }
-
- public String getKey() {
- return IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- public boolean isOverridableAssociationMapping() {
- return true;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOverride.java
deleted file mode 100644
index fb077655d0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOverride.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Override</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlOverride()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class XmlOverride extends XmlEObject implements IOverride
-{
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected String name = NAME_EDEFAULT;
-
- private final Owner owner;
-
- protected XmlOverride() {
- throw new UnsupportedOperationException();
- }
-
- protected XmlOverride(IOverride.Owner owner) {
- super();
- this.owner = owner;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_OVERRIDE;
- }
-
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see #setName(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIOverride_Name()
- * @model
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlOverride#getName <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Name</em>' attribute.
- * @see #getName()
- * @generated
- */
- public void setName(String newName) {
- String oldName = name;
- name = newName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_OVERRIDE__NAME, oldName, name));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_OVERRIDE__NAME :
- return getName();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_OVERRIDE__NAME :
- setName((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_OVERRIDE__NAME :
- setName(NAME_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_OVERRIDE__NAME :
- return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IOverride.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_OVERRIDE__NAME :
- return JpaCoreMappingsPackage.IOVERRIDE__NAME;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IOverride.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IOVERRIDE__NAME :
- return OrmPackage.XML_OVERRIDE__NAME;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (name: ");
- result.append(name);
- result.append(')');
- return result.toString();
- }
-
- public boolean isVirtual() {
- return getOwner().isVirtual(this);
- }
-
- @Override
- public ITextRange validationTextRange() {
- if (node == null) {
- return getOwner().validationTextRange();
- }
- return super.validationTextRange();
- }
-
- public Owner getOwner() {
- return this.owner;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlPersistentAttribute.java
deleted file mode 100644
index 2bf4687338..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlPersistentAttribute.java
+++ /dev/null
@@ -1,355 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Persistent Attribute</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute#getName <em>Name</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPersistentAttribute()
- * @model kind="class"
- * @generated
- */
-public class XmlPersistentAttribute extends XmlEObject
- implements IPersistentAttribute
-{
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected String name = NAME_EDEFAULT;
-
- private List<IXmlAttributeMappingProvider> attributeMappingProviders;
-
- protected XmlPersistentAttribute() {
- super();
- this.attributeMappingProviders = buildAttributeMappingProviders();
- }
-
- protected List<IXmlAttributeMappingProvider> buildAttributeMappingProviders() {
- List<IXmlAttributeMappingProvider> list = new ArrayList<IXmlAttributeMappingProvider>();
- list.add(XmlEmbeddedProvider.instance()); //bug 190344 need to test default embedded before basic
- list.add(XmlBasicProvider.instance());
- list.add(XmlTransientProvider.instance());
- list.add(XmlIdProvider.instance());
- list.add(XmlManyToManyProvider.instance());
- list.add(XmlOneToManyProvider.instance());
- list.add(XmlManyToOneProvider.instance());
- list.add(XmlOneToOneProvider.instance());
- list.add(XmlVersionProvider.instance());
- list.add(XmlEmbeddedIdProvider.instance());
- return list;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_PERSISTENT_ATTRIBUTE;
- }
-
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see #setName(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPersistentAttribute_Name()
- * @model
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute#getName <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Name</em>' attribute.
- * @see #getName()
- * @generated
- */
- public void setName(String newName) {
- String oldName = name;
- name = newName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_PERSISTENT_ATTRIBUTE__NAME, oldName, name));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_PERSISTENT_ATTRIBUTE__MAPPING :
- return getMapping();
- case OrmPackage.XML_PERSISTENT_ATTRIBUTE__NAME :
- return getName();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_PERSISTENT_ATTRIBUTE__NAME :
- setName((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_PERSISTENT_ATTRIBUTE__NAME :
- setName(NAME_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_PERSISTENT_ATTRIBUTE__MAPPING :
- return getMapping() != null;
- case OrmPackage.XML_PERSISTENT_ATTRIBUTE__NAME :
- return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaContentNode.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IPersistentAttribute.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_PERSISTENT_ATTRIBUTE__MAPPING :
- return JpaCorePackage.IPERSISTENT_ATTRIBUTE__MAPPING;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaContentNode.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IPersistentAttribute.class) {
- switch (baseFeatureID) {
- case JpaCorePackage.IPERSISTENT_ATTRIBUTE__MAPPING :
- return OrmPackage.XML_PERSISTENT_ATTRIBUTE__MAPPING;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (name: ");
- result.append(name);
- result.append(')');
- return result.toString();
- }
-
- public XmlAttributeMapping getMapping() {
- return (XmlAttributeMapping) eContainer();
- }
-
- public String mappingKey() {
- return this.getMapping().getKey();
- }
-
- public String defaultMappingKey() {
- return null;
- }
-
- public void setSpecifiedMappingKey(String newKey) {
- String oldKey = this.mappingKey();
- if (newKey == oldKey) {
- return;
- }
- XmlAttributeMapping oldMapping = getMapping();
- this.persistentType().changeMapping(this.getMapping(), newKey);
- XmlAttributeMapping newMapping = getMapping();
- if (eNotificationRequired()) {
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_PERSISTENT_ATTRIBUTE__MAPPING, oldMapping, newMapping));
- }
- }
-
- public Object getId() {
- return IXmlContentNodes.PERSISTENT_ATTRIBUTE_ID;
- }
-
- public Collection<IXmlAttributeMappingProvider> attributeMappingProviders() {
- return this.attributeMappingProviders;
- }
-
- public XmlPersistentType persistentType() {
- return getMapping().getPersistentType();
- }
-
- public XmlTypeMapping typeMapping() {
- return persistentType().getMapping();
- }
-
- public boolean isVirtual() {
- return getMapping().isVirtual();
- }
-
- public void setVirtual(boolean virtual) {
- getMapping().setVirtual(virtual);
- }
-
- public Attribute getAttribute() {
- JavaPersistentType javaPersistentType = typeMapping().getPersistentType().findJavaPersistentType();
- if (javaPersistentType == null) {
- return null;
- }
- for (Iterator<JavaPersistentAttribute> i = javaPersistentType.attributes(); i.hasNext();) {
- JavaPersistentAttribute persistentAttribute = i.next();
- if (persistentAttribute.getName().equals(getName())) {
- return persistentAttribute.getAttribute();
- }
- }
- return null;
- }
-
- public String primaryKeyColumnName() {
- return getMapping().primaryKeyColumnName();
- }
-
- @Override
- public ITextRange fullTextRange() {
- return (this.isVirtual()) ? null : super.fullTextRange();
- }
-
- @Override
- public ITextRange validationTextRange() {
- return (this.isVirtual()) ? this.persistentType().attributesTextRange() : this.getMapping().validationTextRange();
- }
-
- @Override
- public ITextRange selectionTextRange() {
- return (isVirtual()) ? null : this.getMapping().selectionTextRange();
- }
-
- public ITextRange nameTextRange() {
- return getMapping().nameTextRange();
- }
-
- public boolean isOverridableAttribute() {
- return this.getMapping().isOverridableAttributeMapping();
- }
-
- public boolean isOverridableAssociation() {
- return this.getMapping().isOverridableAssociationMapping();
- }
-
- public boolean isIdAttribute() {
- return this.getMapping().isIdMapping();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlPersistentType.java
deleted file mode 100644
index 09f51af040..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlPersistentType.java
+++ /dev/null
@@ -1,958 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.EObjectEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.ChainIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.ReadOnlyIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Persistent Type</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getClass_ <em>Class</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getAttributeMappings <em>Attribute Mappings</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getSpecifiedAttributeMappings <em>Specified Attribute Mappings</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getVirtualAttributeMappings <em>Virtual Attribute Mappings</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getPersistentAttributes <em>Persistent Attributes</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getSpecifiedPersistentAttributes <em>Specified Persistent Attributes</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getVirtualPersistentAttributes <em>Virtual Persistent Attributes</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPersistentType()
- * @model kind="class"
- * @generated
- */
-public class XmlPersistentType extends XmlEObject implements IPersistentType
-{
- /**
- * The default value of the '{@link #getMappingKey() <em>Mapping Key</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMappingKey()
- * @generated
- * @ordered
- */
- protected static final String MAPPING_KEY_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getMappingKey() <em>Mapping Key</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMappingKey()
- * @generated
- * @ordered
- */
- protected String mappingKey = MAPPING_KEY_EDEFAULT;
-
- /**
- * The default value of the '{@link #getClass_() <em>Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getClass_()
- * @generated
- * @ordered
- */
- protected static final String CLASS_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getClass_() <em>Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getClass_()
- * @generated
- * @ordered
- */
- protected String class_ = CLASS_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getSpecifiedAttributeMappings() <em>Specified Attribute Mappings</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedAttributeMappings()
- * @generated
- * @ordered
- */
- protected EList<XmlAttributeMapping> specifiedAttributeMappings;
-
- /**
- * The cached value of the '{@link #getVirtualAttributeMappings() <em>Virtual Attribute Mappings</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getVirtualAttributeMappings()
- * @generated
- * @ordered
- */
- protected EList<XmlAttributeMapping> virtualAttributeMappings;
-
- /**
- * The cached value of the '{@link #getSpecifiedPersistentAttributes() <em>Specified Persistent Attributes</em>}' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPersistentAttributes()
- * @generated
- * @ordered
- */
- protected EList<XmlPersistentAttribute> specifiedPersistentAttributes;
-
- /**
- * The cached value of the '{@link #getVirtualPersistentAttributes() <em>Virtual Persistent Attributes</em>}' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getVirtualPersistentAttributes()
- * @generated
- * @ordered
- */
- protected EList<XmlPersistentAttribute> virtualPersistentAttributes;
-
- private Collection<IXmlTypeMappingProvider> typeMappingProviders;
-
- private IPersistentType parentPersistentType;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated NOT
- */
- protected XmlPersistentType() {
- super();
- this.typeMappingProviders = buildTypeMappingProviders();
- }
-
- protected XmlPersistentType(String theMappingKey) {
- this();
- mappingKey = theMappingKey;
- }
-
- @Override
- protected void addInsignificantFeatureIdsTo(Set<Integer> insignificantFeatureIds) {
- super.addInsignificantFeatureIdsTo(insignificantFeatureIds);
- insignificantFeatureIds.add(OrmPackage.XML_PERSISTENT_TYPE__ATTRIBUTE_MAPPINGS);
- insignificantFeatureIds.add(OrmPackage.XML_PERSISTENT_TYPE__PERSISTENT_ATTRIBUTES);
- insignificantFeatureIds.add(OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_PERSISTENT_ATTRIBUTES);
- insignificantFeatureIds.add(OrmPackage.XML_PERSISTENT_TYPE__VIRTUAL_PERSISTENT_ATTRIBUTES);
- }
-
- protected Collection<IXmlTypeMappingProvider> buildTypeMappingProviders() {
- Collection<IXmlTypeMappingProvider> collection = new ArrayList<IXmlTypeMappingProvider>();
- collection.add(new XmlEntityProvider());
- collection.add(new XmlMappedSuperclassProvider());
- collection.add(new XmlEmbeddableProvider());
- return collection;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_PERSISTENT_TYPE;
- }
-
- public XmlTypeMapping getMapping() {
- return (XmlTypeMapping) eContainer();
- }
-
- /* @see IJpaContentNode#getId() */
- public Object getId() {
- return IXmlContentNodes.PERSISTENT_TYPE_ID;
- }
-
- /**
- * Returns the value of the '<em><b>Mapping Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Mapping Key</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Mapping Key</em>' attribute.
- * @see #setMappingKey(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIPersistentType_MappingKey()
- * @model required="true"
- * @generated
- */
- public String getMappingKey() {
- return mappingKey;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getMappingKey <em>Mapping Key</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Mapping Key</em>' attribute.
- * @see #getMappingKey()
- * @generated
- */
- public void setMappingKeyGen(String newMappingKey) {
- String oldMappingKey = mappingKey;
- mappingKey = newMappingKey;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_PERSISTENT_TYPE__MAPPING_KEY, oldMappingKey, mappingKey));
- }
-
- public void setMappingKey(String newMappingKey) {
- if (mappingKey.equals(newMappingKey)) {
- return;
- }
- XmlTypeMapping oldMapping = getMapping();
- EntityMappings entityMappings = oldMapping.getEntityMappings();
- entityMappings.changeMapping(oldMapping, newMappingKey);
- setMappingKeyGen(newMappingKey);
- }
-
- /**
- * Returns the value of the '<em><b>Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Class</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Class</em>' attribute.
- * @see #setClass(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPersistentType_Class()
- * @model
- * @generated
- */
- public String getClass_() {
- return class_;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType#getClass_ <em>Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Class</em>' attribute.
- * @see #getClass_()
- * @generated
- */
- public void setClass(String newClass) {
- String oldClass = class_;
- class_ = newClass;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_PERSISTENT_TYPE__CLASS, oldClass, class_));
- }
-
- /**
- * Returns the value of the '<em><b>Attribute Mappings</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Attribute Mappings</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Attribute Mappings</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPersistentType_AttributeMappings()
- * @model type="org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping" containment="true" transient="true" changeable="false" volatile="true"
- * @generated NOT
- */
- public EList<XmlAttributeMapping> getAttributeMappings() {
- EList<XmlAttributeMapping> list = new EObjectEList<XmlAttributeMapping>(XmlAttributeMapping.class, this, OrmPackage.XML_PERSISTENT_TYPE__ATTRIBUTE_MAPPINGS);
- list.addAll(getSpecifiedAttributeMappings());
- list.addAll(getVirtualAttributeMappings());
- return list;
- }
-
- /**
- * Returns the value of the '<em><b>Specified Attribute Mappings</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Attribute Mappings</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Attribute Mappings</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPersistentType_SpecifiedAttributeMappings()
- * @model containment="true"
- * @generated
- */
- public EList<XmlAttributeMapping> getSpecifiedAttributeMappingsGen() {
- if (specifiedAttributeMappings == null) {
- specifiedAttributeMappings = new EObjectContainmentEList<XmlAttributeMapping>(XmlAttributeMapping.class, this, OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_ATTRIBUTE_MAPPINGS);
- }
- return specifiedAttributeMappings;
- }
-
- public EList<XmlAttributeMapping> getSpecifiedAttributeMappings() {
- if (specifiedAttributeMappings == null) {
- specifiedAttributeMappings = new SpecifiedAttributeMappingsList<XmlAttributeMapping>();
- }
- return getSpecifiedAttributeMappingsGen();
- }
-
- /**
- * Returns the value of the '<em><b>Virtual Attribute Mappings</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Virtual Attribute Mappings</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Virtual Attribute Mappings</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPersistentType_VirtualAttributeMappings()
- * @model containment="true"
- * @generated
- */
- public EList<XmlAttributeMapping> getVirtualAttributeMappingsGen() {
- if (virtualAttributeMappings == null) {
- virtualAttributeMappings = new EObjectContainmentEList<XmlAttributeMapping>(XmlAttributeMapping.class, this, OrmPackage.XML_PERSISTENT_TYPE__VIRTUAL_ATTRIBUTE_MAPPINGS);
- }
- return virtualAttributeMappings;
- }
-
- public EList<XmlAttributeMapping> getVirtualAttributeMappings() {
- if (virtualAttributeMappings == null) {
- virtualAttributeMappings = new VirtualAttributeMappingsList<XmlAttributeMapping>();
- }
- return getVirtualAttributeMappingsGen();
- }
-
- /**
- * Returns the value of the '<em><b>Persistent Attributes</b></em>' reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Persistent Attributes</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persistent Attributes</em>' reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPersistentType_PersistentAttributes()
- * @model type="org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute" resolveProxies="false" transient="true" changeable="false" volatile="true"
- * @generated NOT
- */
- public EList<XmlPersistentAttribute> getPersistentAttributes() {
- EList<XmlPersistentAttribute> list = new EObjectEList<XmlPersistentAttribute>(XmlPersistentAttribute.class, this, OrmPackage.XML_PERSISTENT_TYPE__PERSISTENT_ATTRIBUTES);
- list.addAll(getSpecifiedPersistentAttributes());
- list.addAll(getVirtualPersistentAttributes());
- return list;
- }
-
- /**
- * Returns the value of the '<em><b>Specified Persistent Attributes</b></em>' reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Persistent Attributes</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Persistent Attributes</em>' reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPersistentType_SpecifiedPersistentAttributes()
- * @model resolveProxies="false"
- * @generated
- */
- public EList<XmlPersistentAttribute> getSpecifiedPersistentAttributes() {
- if (specifiedPersistentAttributes == null) {
- specifiedPersistentAttributes = new EObjectEList<XmlPersistentAttribute>(XmlPersistentAttribute.class, this, OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_PERSISTENT_ATTRIBUTES);
- }
- return specifiedPersistentAttributes;
- }
-
- /**
- * Returns the value of the '<em><b>Virtual Persistent Attributes</b></em>' reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Persistent Attributes</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Virtual Persistent Attributes</em>' reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPersistentType_VirtualPersistentAttributes()
- * @model resolveProxies="false"
- * @generated
- */
- public EList<XmlPersistentAttribute> getVirtualPersistentAttributes() {
- if (virtualPersistentAttributes == null) {
- virtualPersistentAttributes = new EObjectEList<XmlPersistentAttribute>(XmlPersistentAttribute.class, this, OrmPackage.XML_PERSISTENT_TYPE__VIRTUAL_PERSISTENT_ATTRIBUTES);
- }
- return virtualPersistentAttributes;
- }
-
- protected void changeMapping(XmlAttributeMapping oldMapping, String newMappingKey) {
- boolean virtual = oldMapping.isVirtual();
- XmlAttributeMapping newAttributeMapping = buildAttributeMapping(oldMapping.getPersistentAttribute().attributeMappingProviders(), newMappingKey);
- // we can't set the attribute to null, but we can set it to a dummy placeholder one
- // we do this to get the translators to *wake up* and remove adapters from the attribute
- XmlPersistentAttribute nullAttribute = OrmFactory.eINSTANCE.createXmlPersistentAttribute();
- XmlPersistentAttribute attribute = oldMapping.getPersistentAttribute();
- oldMapping.setPersistentAttribute(nullAttribute);
- if (virtual) {
- getVirtualPersistentAttributes().remove(attribute);
- getVirtualAttributeMappings().remove(oldMapping);
- }
- else {
- getSpecifiedPersistentAttributes().remove(attribute);
- getSpecifiedAttributeMappings().remove(oldMapping);
- }
- newAttributeMapping.setPersistentAttribute(attribute);
- oldMapping.initializeOn(newAttributeMapping);
- if (virtual) {
- insertAttributeMapping(newAttributeMapping, getVirtualAttributeMappings());
- }
- else {
- insertAttributeMapping(newAttributeMapping, getSpecifiedAttributeMappings());
- }
- }
-
- private XmlAttributeMapping buildAttributeMapping(Collection<IXmlAttributeMappingProvider> providers, String key) {
- for (IXmlAttributeMappingProvider provider : providers) {
- if (provider.key().equals(key)) {
- return provider.buildAttributeMapping();
- }
- }
- return OrmFactory.eINSTANCE.createXmlNullAttributeMapping();
- }
-
- public Collection<IXmlTypeMappingProvider> typeMappingProviders() {
- return this.typeMappingProviders;
- }
-
- protected void setMappingVirtual(XmlAttributeMapping attributeMapping, boolean virtual) {
- boolean oldVirtual = attributeMapping.isVirtual();
- if (oldVirtual == virtual) {
- return;
- }
- if (virtual) {
- getSpecifiedAttributeMappings().remove(attributeMapping);
- insertAttributeMapping(attributeMapping, getVirtualAttributeMappings());
- }
- else {
- getVirtualAttributeMappings().remove(attributeMapping);
- insertAttributeMapping(attributeMapping, getSpecifiedAttributeMappings());
- }
- }
-
- private void insertAttributeMapping(XmlAttributeMapping newMapping, List<XmlAttributeMapping> attributeMappings) {
- int newIndex = CollectionTools.insertionIndexOf(attributeMappings, newMapping, buildMappingComparator());
- attributeMappings.add(newIndex, newMapping);
- }
-
- private Comparator<XmlAttributeMapping> buildMappingComparator() {
- return new Comparator<XmlAttributeMapping>() {
- public int compare(XmlAttributeMapping o1, XmlAttributeMapping o2) {
- int o1Sequence = o1.xmlSequence();
- int o2Sequence = o2.xmlSequence();
- if (o1Sequence < o2Sequence) {
- return -1;
- }
- if (o1Sequence == o2Sequence) {
- return 0;
- }
- return 1;
- }
- };
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_PERSISTENT_TYPE__ATTRIBUTE_MAPPINGS :
- return ((InternalEList<?>) getAttributeMappings()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_ATTRIBUTE_MAPPINGS :
- return ((InternalEList<?>) getSpecifiedAttributeMappings()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_PERSISTENT_TYPE__VIRTUAL_ATTRIBUTE_MAPPINGS :
- return ((InternalEList<?>) getVirtualAttributeMappings()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_PERSISTENT_TYPE__MAPPING_KEY :
- return getMappingKey();
- case OrmPackage.XML_PERSISTENT_TYPE__CLASS :
- return getClass_();
- case OrmPackage.XML_PERSISTENT_TYPE__ATTRIBUTE_MAPPINGS :
- return getAttributeMappings();
- case OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_ATTRIBUTE_MAPPINGS :
- return getSpecifiedAttributeMappings();
- case OrmPackage.XML_PERSISTENT_TYPE__VIRTUAL_ATTRIBUTE_MAPPINGS :
- return getVirtualAttributeMappings();
- case OrmPackage.XML_PERSISTENT_TYPE__PERSISTENT_ATTRIBUTES :
- return getPersistentAttributes();
- case OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_PERSISTENT_ATTRIBUTES :
- return getSpecifiedPersistentAttributes();
- case OrmPackage.XML_PERSISTENT_TYPE__VIRTUAL_PERSISTENT_ATTRIBUTES :
- return getVirtualPersistentAttributes();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_PERSISTENT_TYPE__MAPPING_KEY :
- setMappingKey((String) newValue);
- return;
- case OrmPackage.XML_PERSISTENT_TYPE__CLASS :
- setClass((String) newValue);
- return;
- case OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_ATTRIBUTE_MAPPINGS :
- getSpecifiedAttributeMappings().clear();
- getSpecifiedAttributeMappings().addAll((Collection<? extends XmlAttributeMapping>) newValue);
- return;
- case OrmPackage.XML_PERSISTENT_TYPE__VIRTUAL_ATTRIBUTE_MAPPINGS :
- getVirtualAttributeMappings().clear();
- getVirtualAttributeMappings().addAll((Collection<? extends XmlAttributeMapping>) newValue);
- return;
- case OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_PERSISTENT_ATTRIBUTES :
- getSpecifiedPersistentAttributes().clear();
- getSpecifiedPersistentAttributes().addAll((Collection<? extends XmlPersistentAttribute>) newValue);
- return;
- case OrmPackage.XML_PERSISTENT_TYPE__VIRTUAL_PERSISTENT_ATTRIBUTES :
- getVirtualPersistentAttributes().clear();
- getVirtualPersistentAttributes().addAll((Collection<? extends XmlPersistentAttribute>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_PERSISTENT_TYPE__MAPPING_KEY :
- setMappingKey(MAPPING_KEY_EDEFAULT);
- return;
- case OrmPackage.XML_PERSISTENT_TYPE__CLASS :
- setClass(CLASS_EDEFAULT);
- return;
- case OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_ATTRIBUTE_MAPPINGS :
- getSpecifiedAttributeMappings().clear();
- return;
- case OrmPackage.XML_PERSISTENT_TYPE__VIRTUAL_ATTRIBUTE_MAPPINGS :
- getVirtualAttributeMappings().clear();
- return;
- case OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_PERSISTENT_ATTRIBUTES :
- getSpecifiedPersistentAttributes().clear();
- return;
- case OrmPackage.XML_PERSISTENT_TYPE__VIRTUAL_PERSISTENT_ATTRIBUTES :
- getVirtualPersistentAttributes().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_PERSISTENT_TYPE__MAPPING_KEY :
- return MAPPING_KEY_EDEFAULT == null ? mappingKey != null : !MAPPING_KEY_EDEFAULT.equals(mappingKey);
- case OrmPackage.XML_PERSISTENT_TYPE__CLASS :
- return CLASS_EDEFAULT == null ? class_ != null : !CLASS_EDEFAULT.equals(class_);
- case OrmPackage.XML_PERSISTENT_TYPE__ATTRIBUTE_MAPPINGS :
- return !getAttributeMappings().isEmpty();
- case OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_ATTRIBUTE_MAPPINGS :
- return specifiedAttributeMappings != null && !specifiedAttributeMappings.isEmpty();
- case OrmPackage.XML_PERSISTENT_TYPE__VIRTUAL_ATTRIBUTE_MAPPINGS :
- return virtualAttributeMappings != null && !virtualAttributeMappings.isEmpty();
- case OrmPackage.XML_PERSISTENT_TYPE__PERSISTENT_ATTRIBUTES :
- return !getPersistentAttributes().isEmpty();
- case OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_PERSISTENT_ATTRIBUTES :
- return specifiedPersistentAttributes != null && !specifiedPersistentAttributes.isEmpty();
- case OrmPackage.XML_PERSISTENT_TYPE__VIRTUAL_PERSISTENT_ATTRIBUTES :
- return virtualPersistentAttributes != null && !virtualPersistentAttributes.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaContentNode.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IPersistentType.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_PERSISTENT_TYPE__MAPPING_KEY :
- return JpaCorePackage.IPERSISTENT_TYPE__MAPPING_KEY;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaContentNode.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IPersistentType.class) {
- switch (baseFeatureID) {
- case JpaCorePackage.IPERSISTENT_TYPE__MAPPING_KEY :
- return OrmPackage.XML_PERSISTENT_TYPE__MAPPING_KEY;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (mappingKey: ");
- result.append(mappingKey);
- result.append(", class: ");
- result.append(class_);
- result.append(')');
- return result.toString();
- }
-
- public IType findJdtType() {
- String fqName = getClass_();
- if (StringTools.stringIsEmpty(fqName)) {
- return null;
- }
- // try to resolve by only the locally specified name
- IType type = resolveJdtType(fqName);
- if (type == null) {
- // try to resolve by prepending the global package name
- fqName = getMapping().getEntityMappings().getPackage() + "." + getClass_();
- type = resolveJdtType(fqName);
- }
- return type;
- }
-
- private IType resolveJdtType(String fullyQualifiedName) {
- // this name could be of the form "package.name.ClassName"
- // or the form "package.name.ClassName.MemberClassName"
- // so we must try multiple package and class names here
- String[] name = new String[] {
- fullyQualifiedName, ""
- };
- while (name[0].length() != 0) {
- name = moveDot(name);
- IType type = JDTTools.findType(name[0], name[1], getJpaProject().javaProject());
- if (type != null)
- return type;
- }
- return null;
- }
-
- /**
- * Returns a String array based on the given string array by
- * moving a package segment from the end of the first to the
- * beginning of the second
- *
- * e.g. ["foo.bar", "Baz"] -> ["foo", "bar.Baz"]
- */
- private String[] moveDot(String[] packageAndClassName) {
- if (packageAndClassName[0].length() == 0) {
- throw new IllegalArgumentException();
- }
- String segmentToMove;
- String packageName = packageAndClassName[0];
- String className = packageAndClassName[1];
- if (packageName.indexOf('.') == -1) {
- segmentToMove = packageName;
- packageAndClassName[0] = "";
- }
- else {
- int dotIndex = packageName.lastIndexOf('.');
- segmentToMove = packageName.substring(dotIndex + 1, packageName.length());
- packageAndClassName[0] = packageName.substring(0, dotIndex);
- }
- if (className.length() == 0) {
- packageAndClassName[1] = segmentToMove;
- }
- else {
- packageAndClassName[1] = segmentToMove + '.' + className;
- }
- return packageAndClassName;
- }
-
- public JavaPersistentType findJavaPersistentType() {
- return this.getJpaProject().javaPersistentType(this.findJdtType());
- }
-
- public Type findType() {
- JavaPersistentType javaPersistentType = findJavaPersistentType();
- return (javaPersistentType == null) ? null : javaPersistentType.getType();
- }
-
- public Iterator<XmlPersistentAttribute> attributes() {
- return new ReadOnlyIterator<XmlPersistentAttribute>(getPersistentAttributes());
- }
-
- public Iterator<String> attributeNames() {
- return this.attributeNames(this.attributes());
- }
-
- private Iterator<String> attributeNames(Iterator<? extends IPersistentAttribute> attrs) {
- return new TransformationIterator<IPersistentAttribute, String>(attrs) {
- @Override
- protected String transform(IPersistentAttribute attribute) {
- return attribute.getName();
- }
- };
- }
-
- public Iterator<IPersistentAttribute> allAttributes() {
- return new CompositeIterator<IPersistentAttribute>(new TransformationIterator<IPersistentType, Iterator<IPersistentAttribute>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<IPersistentAttribute> transform(IPersistentType pt) {
- //TODO how to remove this warning?
- return (Iterator<IPersistentAttribute>) pt.attributes();
- }
- });
- }
-
- public Iterator<String> allAttributeNames() {
- return this.attributeNames(this.allAttributes());
- }
-
- public Iterator<IPersistentType> inheritanceHierarchy() {
- // using a chain iterator to traverse up the inheritance tree
- return new ChainIterator<IPersistentType>(this) {
- @Override
- protected IPersistentType nextLink(IPersistentType pt) {
- return pt.parentPersistentType();
- }
- };
- }
-
- public IPersistentType parentPersistentType() {
- return this.parentPersistentType;
- }
-
- public IJpaContentNode getContentNode(int offset) {
- for (XmlAttributeMapping mapping : this.getSpecifiedAttributeMappings()) {
- if (mapping.getNode().contains(offset)) {
- return mapping.getContentNode(offset);
- }
- }
- return this;
- }
-
- public void refreshDefaults(DefaultsContext context) {
- refreshParentPersistentType(context);
- }
-
- private void refreshParentPersistentType(DefaultsContext context) {
- JavaPersistentType javaPersistentType = findJavaPersistentType();
- if (javaPersistentType == null) {
- this.parentPersistentType = null;
- return;
- }
- //TODO need to fix the performance issue that results here
- //setting this back for now because of bug 200957 in the M1 release
- ITypeBinding typeBinding = javaPersistentType.getType().typeBinding(javaPersistentType.getType().astRoot());
- IPersistentType parentPersistentType = JavaPersistentType.parentPersistentType(context, typeBinding);
- this.parentPersistentType = parentPersistentType;
- return;
- }
-
- protected Iterator<XmlPersistentAttribute> attributesNamed(final String attributeName) {
- return new FilteringIterator<XmlPersistentAttribute>(getPersistentAttributes().iterator()) {
- @Override
- protected boolean accept(Object o) {
- return attributeName.equals(((XmlPersistentAttribute) o).getName());
- }
- };
- }
-
- public XmlPersistentAttribute attributeNamed(String attributeName) {
- Iterator<XmlPersistentAttribute> attributes = attributesNamed(attributeName);
- return attributes.hasNext() ? attributes.next() : null;
- }
-
- public IPersistentAttribute resolveAttribute(String attributeName) {
- Iterator<XmlPersistentAttribute> attributes = attributesNamed(attributeName);
- if (attributes.hasNext()) {
- XmlPersistentAttribute attribute = attributes.next();
- return attributes.hasNext() ? null /* more than one */: attribute;
- }
- else if (parentPersistentType() != null) {
- return parentPersistentType().resolveAttribute(attributeName);
- }
- else {
- return null;
- }
- }
-
- @Override
- public ITextRange validationTextRange() {
- return selectionTextRange();
- }
-
- @Override
- public ITextRange selectionTextRange() {
- return getMapping().selectionTextRange();
- }
-
- public ITextRange classTextRange() {
- return getMapping().classTextRange();
- }
-
- public ITextRange attributesTextRange() {
- return getMapping().attributesTextRange();
- }
- private abstract class AttributeMappingsList<E>
- extends EObjectContainmentEList<XmlAttributeMapping>
- {
- AttributeMappingsList(int feature) {
- super(XmlAttributeMapping.class, XmlPersistentType.this, feature);
- }
-
- protected abstract EList<XmlPersistentAttribute> persistentAttributes();
-
- @Override
- protected void didAdd(int index, XmlAttributeMapping newObject) {
- if (newObject.getPersistentAttribute() == null) {
- throw new IllegalStateException("Must set the PersistentAttribute during creation");
- }
- persistentAttributes().add(index, newObject.getPersistentAttribute());
- }
-
- @Override
- protected void didChange() {
- // TODO Auto-generated method stub
- super.didChange();
- }
-
- @Override
- protected void didClear(int len, Object[] oldObjects) {
- persistentAttributes().clear();
- }
-
- @Override
- protected void didMove(int index, XmlAttributeMapping movedObject, int oldIndex) {
- persistentAttributes().move(index, movedObject.getPersistentAttribute());
- }
-
- @Override
- protected void didRemove(int index, XmlAttributeMapping oldObject) {
- persistentAttributes().remove(oldObject.getPersistentAttribute());
- }
-
- @Override
- protected void didSet(int index, XmlAttributeMapping newObject, XmlAttributeMapping oldObject) {
- persistentAttributes().set(index, newObject.getPersistentAttribute());
- }
- }
- private class SpecifiedAttributeMappingsList<E>
- extends AttributeMappingsList<XmlAttributeMapping>
- {
- SpecifiedAttributeMappingsList() {
- super(OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_ATTRIBUTE_MAPPINGS);
- }
-
- @Override
- protected EList<XmlPersistentAttribute> persistentAttributes() {
- return getSpecifiedPersistentAttributes();
- }
- }
- private class VirtualAttributeMappingsList<E>
- extends AttributeMappingsList<XmlAttributeMapping>
- {
- VirtualAttributeMappingsList() {
- super(OrmPackage.XML_PERSISTENT_TYPE__VIRTUAL_ATTRIBUTE_MAPPINGS);
- }
-
- @Override
- protected EList<XmlPersistentAttribute> persistentAttributes() {
- return getVirtualPersistentAttributes();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlPrimaryKeyJoinColumn.java
deleted file mode 100644
index 053d369ff1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlPrimaryKeyJoinColumn.java
+++ /dev/null
@@ -1,434 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.content.orm.resource.OrmXmlMapper;
-import org.eclipse.jpt.core.internal.emfutility.DOMUtilities;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.db.internal.Column;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Primary Key Join Column</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlPrimaryKeyJoinColumn#getSpecifiedReferencedColumnNameForXml <em>Specified Referenced Column Name For Xml</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPrimaryKeyJoinColumn()
- * @model kind="class"
- * @generated
- */
-public class XmlPrimaryKeyJoinColumn extends AbstractXmlNamedColumn
- implements IPrimaryKeyJoinColumn
-{
- /**
- * The default value of the '{@link #getReferencedColumnName() <em>Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getReferencedColumnName()
- * @generated
- * @ordered
- */
- protected static final String REFERENCED_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedReferencedColumnName() <em>Specified Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedReferencedColumnName()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedReferencedColumnName() <em>Specified Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedReferencedColumnName()
- * @generated
- * @ordered
- */
- protected String specifiedReferencedColumnName = SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultReferencedColumnName() <em>Default Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultReferencedColumnName()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_REFERENCED_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultReferencedColumnName() <em>Default Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultReferencedColumnName()
- * @generated
- * @ordered
- */
- protected String defaultReferencedColumnName = DEFAULT_REFERENCED_COLUMN_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getSpecifiedReferencedColumnNameForXml() <em>Specified Referenced Column Name For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedReferencedColumnNameForXml()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML_EDEFAULT = null;
-
- protected XmlPrimaryKeyJoinColumn() {
- throw new UnsupportedOperationException("Use XmlPrimaryKeyJoinColumn(INamedColumn.Owner) instead");
- }
-
- protected XmlPrimaryKeyJoinColumn(IAbstractJoinColumn.Owner owner) {
- super(owner);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_PRIMARY_KEY_JOIN_COLUMN;
- }
-
- public void setSpecifiedName(String newSpecifiedName) {
- setSpecifiedNameGen(newSpecifiedName);
- setSpecifiedNameForXml(newSpecifiedName);
- }
-
- /**
- * Returns the value of the '<em><b>Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Referenced Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Referenced Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIPrimaryKeyJoinColumn_ReferencedColumnName()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getReferencedColumnName() {
- return (this.getSpecifiedReferencedColumnName() == null) ? getDefaultReferencedColumnName() : this.getSpecifiedReferencedColumnName();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Referenced Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Referenced Column Name</em>' attribute.
- * @see #setSpecifiedReferencedColumnName(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIAbstractJoinColumn_SpecifiedReferencedColumnName()
- * @model
- * @generated
- */
- public String getSpecifiedReferencedColumnName() {
- return specifiedReferencedColumnName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlPrimaryKeyJoinColumn#getSpecifiedReferencedColumnName <em>Specified Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Referenced Column Name</em>' attribute.
- * @see #getSpecifiedReferencedColumnName()
- * @generated
- */
- public void setSpecifiedReferencedColumnNameGen(String newSpecifiedReferencedColumnName) {
- String oldSpecifiedReferencedColumnName = specifiedReferencedColumnName;
- specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME, oldSpecifiedReferencedColumnName, specifiedReferencedColumnName));
- }
-
- public void setSpecifiedReferencedColumnName(String newSpecifiedReferencedColumnName) {
- setSpecifiedReferencedColumnNameGen(newSpecifiedReferencedColumnName);
- setSpecifiedReferencedColumnNameForXml(newSpecifiedReferencedColumnName);
- }
-
- /**
- * Returns the value of the '<em><b>Default Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Referenced Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Referenced Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIAbstractJoinColumn_DefaultReferencedColumnName()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultReferencedColumnName() {
- return defaultReferencedColumnName;
- }
-
- protected void setDefaultReferencedColumnName(String newDefaultReferencedColumnName) {
- String oldDefaultReferencedColumnName = this.defaultReferencedColumnName;
- this.defaultReferencedColumnName = newDefaultReferencedColumnName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME, oldDefaultReferencedColumnName, newDefaultReferencedColumnName));
- }
-
- public void setColumnDefinition(String newColumnDefinition) {
- setColumnDefinitionGen(newColumnDefinition);
- setColumnDefinitionForXml(newColumnDefinition);
- }
-
- /**
- * Returns the value of the '<em><b>Specified Referenced Column Name For Xml</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Referenced Column Name For Xml</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Referenced Column Name For Xml</em>' attribute.
- * @see #setSpecifiedReferencedColumnNameForXml(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlPrimaryKeyJoinColumn_SpecifiedReferencedColumnNameForXml()
- * @model volatile="true"
- * @generated NOT
- */
- public String getSpecifiedReferencedColumnNameForXml() {
- return getSpecifiedReferencedColumnName();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlPrimaryKeyJoinColumn#getSpecifiedReferencedColumnNameForXml <em>Specified Referenced Column Name For Xml</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Referenced Column Name For Xml</em>' attribute.
- * @see #getSpecifiedReferencedColumnNameForXml()
- * @generated NOT
- */
- public void setSpecifiedReferencedColumnNameForXml(String newSpecifiedReferencedColumnNameForXml) {
- setSpecifiedReferencedColumnNameGen(newSpecifiedReferencedColumnNameForXml);
- if (eNotificationRequired())
- //make sure oldValue different from newValue because we don't store the value from the xml, see super.eNotify()
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML, newSpecifiedReferencedColumnNameForXml + " ", newSpecifiedReferencedColumnNameForXml));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME :
- return getReferencedColumnName();
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- return getSpecifiedReferencedColumnName();
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME :
- return getDefaultReferencedColumnName();
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML :
- return getSpecifiedReferencedColumnNameForXml();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- setSpecifiedReferencedColumnName((String) newValue);
- return;
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML :
- setSpecifiedReferencedColumnNameForXml((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- setSpecifiedReferencedColumnName(SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT);
- return;
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML :
- setSpecifiedReferencedColumnNameForXml(SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME :
- return REFERENCED_COLUMN_NAME_EDEFAULT == null ? getReferencedColumnName() != null : !REFERENCED_COLUMN_NAME_EDEFAULT.equals(getReferencedColumnName());
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- return SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT == null ? specifiedReferencedColumnName != null : !SPECIFIED_REFERENCED_COLUMN_NAME_EDEFAULT.equals(specifiedReferencedColumnName);
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME :
- return DEFAULT_REFERENCED_COLUMN_NAME_EDEFAULT == null ? defaultReferencedColumnName != null : !DEFAULT_REFERENCED_COLUMN_NAME_EDEFAULT.equals(defaultReferencedColumnName);
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML :
- return SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML_EDEFAULT == null ? getSpecifiedReferencedColumnNameForXml() != null : !SPECIFIED_REFERENCED_COLUMN_NAME_FOR_XML_EDEFAULT.equals(getSpecifiedReferencedColumnNameForXml());
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IAbstractJoinColumn.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME :
- return JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__REFERENCED_COLUMN_NAME;
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- return JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME;
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME :
- return JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME;
- default :
- return -1;
- }
- }
- if (baseClass == IPrimaryKeyJoinColumn.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IAbstractJoinColumn.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__REFERENCED_COLUMN_NAME :
- return OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME;
- case JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME :
- return OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME;
- case JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME :
- return OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME;
- default :
- return -1;
- }
- }
- if (baseClass == IPrimaryKeyJoinColumn.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedReferencedColumnName: ");
- result.append(specifiedReferencedColumnName);
- result.append(", defaultReferencedColumnName: ");
- result.append(defaultReferencedColumnName);
- result.append(')');
- return result.toString();
- }
-
- public IAbstractJoinColumn.Owner getOwner() {
- return (IAbstractJoinColumn.Owner) this.owner;
- }
-
- public Column dbReferencedColumn() {
- Table table = this.dbReferencedColumnTable();
- return (table == null) ? null : table.columnNamed(this.getReferencedColumnName());
- }
-
- public Table dbReferencedColumnTable() {
- return getOwner().dbReferencedColumnTable();
- }
-
- @Override
- protected String tableName() {
- return this.getOwner().getTypeMapping().getTableName();
- }
-
- public boolean isReferencedColumnResolved() {
- return dbReferencedColumn() != null;
- }
-
- public ITextRange referencedColumnNameTextRange() {
- if (node == null) {
- return owner.validationTextRange();
- }
- IDOMNode referencedColumnNameNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.REFERENCED_COLUMN_NAME);
- return (referencedColumnNameNode == null) ? validationTextRange() : buildTextRange(referencedColumnNameNode);
- }
-
- public void refreshDefaults(DefaultsContext defaultsContext) {
- setDefaultReferencedColumnName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_REFERENCED_COLUMN_NAME_KEY));
- setDefaultName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_NAME_KEY));
- }
-
- public boolean isVirtual() {
- return getOwner().isVirtual(this);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlRelationshipMapping.java
deleted file mode 100644
index 96debff57b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlRelationshipMapping.java
+++ /dev/null
@@ -1,577 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ICascade;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.RelationshipMappingTools;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Relationship Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlRelationshipMapping()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class XmlRelationshipMapping extends XmlAttributeMapping
- implements IRelationshipMapping
-{
- /**
- * The default value of the '{@link #getTargetEntity() <em>Target Entity</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTargetEntity()
- * @generated
- * @ordered
- */
- protected static final String TARGET_ENTITY_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedTargetEntity() <em>Specified Target Entity</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedTargetEntity()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_TARGET_ENTITY_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedTargetEntity() <em>Specified Target Entity</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedTargetEntity()
- * @generated
- * @ordered
- */
- protected String specifiedTargetEntity = SPECIFIED_TARGET_ENTITY_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultTargetEntity() <em>Default Target Entity</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultTargetEntity()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_TARGET_ENTITY_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultTargetEntity() <em>Default Target Entity</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultTargetEntity()
- * @generated
- * @ordered
- */
- protected String defaultTargetEntity = DEFAULT_TARGET_ENTITY_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getResolvedTargetEntity() <em>Resolved Target Entity</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getResolvedTargetEntity()
- * @generated
- * @ordered
- */
- protected IEntity resolvedTargetEntity;
-
- /**
- * The cached value of the '{@link #getCascade() <em>Cascade</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getCascade()
- * @generated
- * @ordered
- */
- protected ICascade cascade;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlRelationshipMapping() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_RELATIONSHIP_MAPPING;
- }
-
- /**
- * Returns the value of the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Target Entity</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Target Entity</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIRelationshipMapping_TargetEntity()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getTargetEntity() {
- return (this.getSpecifiedTargetEntity() == null) ? getDefaultTargetEntity() : this.getSpecifiedTargetEntity();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Target Entity</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Target Entity</em>' attribute.
- * @see #setSpecifiedTargetEntity(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIRelationshipMapping_SpecifiedTargetEntity()
- * @model
- * @generated
- */
- public String getSpecifiedTargetEntity() {
- return specifiedTargetEntity;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlRelationshipMapping#getSpecifiedTargetEntity <em>Specified Target Entity</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Target Entity</em>' attribute.
- * @see #getSpecifiedTargetEntity()
- * @generated
- */
- public void setSpecifiedTargetEntity(String newSpecifiedTargetEntity) {
- String oldSpecifiedTargetEntity = specifiedTargetEntity;
- specifiedTargetEntity = newSpecifiedTargetEntity;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY, oldSpecifiedTargetEntity, specifiedTargetEntity));
- }
-
- /**
- * Returns the value of the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Target Entity</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Target Entity</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIRelationshipMapping_DefaultTargetEntity()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultTargetEntity() {
- return defaultTargetEntity;
- }
-
- /**
- * Returns the value of the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Resolved Target Entity</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Resolved Target Entity</em>' reference.
- * @see #setResolvedTargetEntity(IEntity)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIRelationshipMapping_ResolvedTargetEntity()
- * @model
- * @generated
- */
- public IEntity getResolvedTargetEntity() {
- if (resolvedTargetEntity != null && resolvedTargetEntity.eIsProxy()) {
- InternalEObject oldResolvedTargetEntity = (InternalEObject) resolvedTargetEntity;
- resolvedTargetEntity = (IEntity) eResolveProxy(oldResolvedTargetEntity);
- if (resolvedTargetEntity != oldResolvedTargetEntity) {
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.RESOLVE, OrmPackage.XML_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY, oldResolvedTargetEntity, resolvedTargetEntity));
- }
- }
- return resolvedTargetEntity;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public IEntity basicGetResolvedTargetEntity() {
- return resolvedTargetEntity;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlRelationshipMapping#getResolvedTargetEntity <em>Resolved Target Entity</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Resolved Target Entity</em>' reference.
- * @see #getResolvedTargetEntity()
- * @generated
- */
- public void setResolvedTargetEntity(IEntity newResolvedTargetEntity) {
- IEntity oldResolvedTargetEntity = resolvedTargetEntity;
- resolvedTargetEntity = newResolvedTargetEntity;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY, oldResolvedTargetEntity, resolvedTargetEntity));
- }
-
- /**
- * Returns the value of the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Cascade</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Cascade</em>' containment reference.
- * @see #setCascade(ICascade)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIRelationshipMapping_Cascade()
- * @model containment="true"
- * @generated
- */
- public ICascade getCascade() {
- return cascade;
- }
-
- public ICascade createCascade() {
- return OrmFactory.eINSTANCE.createXmlCascade();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetCascade(ICascade newCascade, NotificationChain msgs) {
- ICascade oldCascade = cascade;
- cascade = newCascade;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_RELATIONSHIP_MAPPING__CASCADE, oldCascade, newCascade);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlRelationshipMapping#getCascade <em>Cascade</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Cascade</em>' containment reference.
- * @see #getCascade()
- * @generated
- */
- public void setCascade(ICascade newCascade) {
- if (newCascade != cascade) {
- NotificationChain msgs = null;
- if (cascade != null)
- msgs = ((InternalEObject) cascade).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_RELATIONSHIP_MAPPING__CASCADE, null, msgs);
- if (newCascade != null)
- msgs = ((InternalEObject) newCascade).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_RELATIONSHIP_MAPPING__CASCADE, null, msgs);
- msgs = basicSetCascade(newCascade, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_RELATIONSHIP_MAPPING__CASCADE, newCascade, newCascade));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_RELATIONSHIP_MAPPING__CASCADE :
- return basicSetCascade(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- //TODO should we allow setting through the ecore, that would make this method
- //public and part of the ITable api. only the model needs to be setting the default,
- //but the ui needs to be listening for changes to the default.
- protected void setDefaultTargetEntity(String newDefaultTargetEntity) {
- String oldDefaultTargetEntity = this.defaultTargetEntity;
- this.defaultTargetEntity = newDefaultTargetEntity;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY, oldDefaultTargetEntity, this.defaultTargetEntity));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_RELATIONSHIP_MAPPING__TARGET_ENTITY :
- return getTargetEntity();
- case OrmPackage.XML_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY :
- return getSpecifiedTargetEntity();
- case OrmPackage.XML_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY :
- return getDefaultTargetEntity();
- case OrmPackage.XML_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY :
- if (resolve)
- return getResolvedTargetEntity();
- return basicGetResolvedTargetEntity();
- case OrmPackage.XML_RELATIONSHIP_MAPPING__CASCADE :
- return getCascade();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY :
- setSpecifiedTargetEntity((String) newValue);
- return;
- case OrmPackage.XML_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY :
- setResolvedTargetEntity((IEntity) newValue);
- return;
- case OrmPackage.XML_RELATIONSHIP_MAPPING__CASCADE :
- setCascade((ICascade) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY :
- setSpecifiedTargetEntity(SPECIFIED_TARGET_ENTITY_EDEFAULT);
- return;
- case OrmPackage.XML_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY :
- setResolvedTargetEntity((IEntity) null);
- return;
- case OrmPackage.XML_RELATIONSHIP_MAPPING__CASCADE :
- setCascade((ICascade) null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_RELATIONSHIP_MAPPING__TARGET_ENTITY :
- return TARGET_ENTITY_EDEFAULT == null ? getTargetEntity() != null : !TARGET_ENTITY_EDEFAULT.equals(getTargetEntity());
- case OrmPackage.XML_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY :
- return SPECIFIED_TARGET_ENTITY_EDEFAULT == null ? specifiedTargetEntity != null : !SPECIFIED_TARGET_ENTITY_EDEFAULT.equals(specifiedTargetEntity);
- case OrmPackage.XML_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY :
- return DEFAULT_TARGET_ENTITY_EDEFAULT == null ? defaultTargetEntity != null : !DEFAULT_TARGET_ENTITY_EDEFAULT.equals(defaultTargetEntity);
- case OrmPackage.XML_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY :
- return resolvedTargetEntity != null;
- case OrmPackage.XML_RELATIONSHIP_MAPPING__CASCADE :
- return cascade != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IRelationshipMapping.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_RELATIONSHIP_MAPPING__TARGET_ENTITY :
- return JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__TARGET_ENTITY;
- case OrmPackage.XML_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY :
- return JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
- case OrmPackage.XML_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY :
- return JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
- case OrmPackage.XML_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY :
- return JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
- case OrmPackage.XML_RELATIONSHIP_MAPPING__CASCADE :
- return JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__CASCADE;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IRelationshipMapping.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__TARGET_ENTITY :
- return OrmPackage.XML_RELATIONSHIP_MAPPING__TARGET_ENTITY;
- case JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY :
- return OrmPackage.XML_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
- case JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY :
- return OrmPackage.XML_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
- case JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY :
- return OrmPackage.XML_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
- case JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__CASCADE :
- return OrmPackage.XML_RELATIONSHIP_MAPPING__CASCADE;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedTargetEntity: ");
- result.append(specifiedTargetEntity);
- result.append(", defaultTargetEntity: ");
- result.append(defaultTargetEntity);
- result.append(')');
- return result.toString();
- }
-
- @Override
- public void initializeFromXmlRelationshipMapping(XmlRelationshipMapping oldMapping) {
- super.initializeFromXmlRelationshipMapping(oldMapping);
- setSpecifiedTargetEntity(oldMapping.getSpecifiedTargetEntity());
- }
-
- public boolean targetEntityIsValid(String targetEntity) {
- return RelationshipMappingTools.targetEntityIsValid(targetEntity);
- }
-
- public IEntity getEntity() {
- ITypeMapping typeMapping = getPersistentType().getMapping();
- if (typeMapping instanceof IEntity) {
- return (IEntity) typeMapping;
- }
- return null;
- }
-
- public String fullyQualifiedTargetEntity(CompilationUnit astRoot) {
- if (getTargetEntity() == null) {
- return null;
- }
- if (targetEntityIncludesPackage()) {
- return getTargetEntity();
- }
- String package_ = getPersistentType().getMapping().getEntityMappings().getPackage();
- if (package_ != null) {
- return package_ + '.' + getTargetEntity();
- }
- return getTargetEntity();
- }
-
- private boolean targetEntityIncludesPackage() {
- return getTargetEntity().lastIndexOf('.') != -1;
- }
-
- public Iterator<String> allTargetEntityAttributeNames() {
- IEntity targetEntity = this.getResolvedTargetEntity();
- return (targetEntity == null) ? EmptyIterator.<String> instance() : targetEntity.getPersistentType().allAttributeNames();
- }
-
- public Iterator<String> candidateMappedByAttributeNames() {
- return this.allTargetEntityAttributeNames();
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext) {
- super.refreshDefaults(defaultsContext);
- setDefaultTargetEntity((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_TARGET_ENTITY_KEY));
- String targetEntity = fullyQualifiedTargetEntity(defaultsContext.astRoot());
- if (targetEntity != null) {
- IPersistentType persistentType = defaultsContext.persistentType(targetEntity);
- if (persistentType != null) {
- if (persistentType.getMapping() instanceof IEntity) {
- setResolvedTargetEntity((IEntity) persistentType.getMapping());
- return;
- }
- }
- }
- setResolvedTargetEntity(null);
- }
-
- /**
- * the default 'targetEntity' is calculated from the attribute type;
- * return null if the attribute type cannot possibly be an entity
- */
- public String javaDefaultTargetEntity(CompilationUnit astRoot) {
- ITypeBinding typeBinding = this.getPersistentAttribute().getAttribute().typeBinding(astRoot);
- if (typeBinding != null) {
- return this.javaDefaultTargetEntity(typeBinding);
- }
- return null;
- }
-
- protected String javaDefaultTargetEntity(ITypeBinding typeBinding) {
- return buildReferenceEntityTypeName(typeBinding);
- }
-
- protected String buildReferenceEntityTypeName(ITypeBinding typeBinding) {
- return JavaRelationshipMapping.buildReferenceEntityTypeName(typeBinding);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlRootContentNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlRootContentNode.java
deleted file mode 100644
index ed1ba64720..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlRootContentNode.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.ElementChangedEvent;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IJpaRootContentNode;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.JpaFile;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.orm.resource.OrmArtifactEdit;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Root Content Node</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode#getEntityMappings <em>Entity Mappings</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlRootContentNode()
- * @model kind="class"
- * @generated
- */
-public class XmlRootContentNode extends XmlEObject
- implements IJpaRootContentNode
-{
- /**
- * The cached value of the '{@link #getEntityMappings() <em>Entity Mappings</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getEntityMappings()
- * @generated
- * @ordered
- */
- protected EntityMappingsInternal entityMappings;
-
- private OrmArtifactEdit artifactEdit;
-
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlRootContentNode() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_ROOT_CONTENT_NODE;
- }
-
- /* @see IJpaContentNode#getId() */
- public Object getId() {
- return IXmlContentNodes.XML_ROOT_ID;
- }
-
- @Override
- public IJpaRootContentNode getRoot() {
- return this;
- }
-
- /**
- * Returns the value of the '<em><b>Jpa File</b></em>' container reference.
- * It is bidirectional and its opposite is '{@link org.eclipse.jpt.core.internal.JpaFile#getContent <em>Content</em>}'.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>File</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Jpa File</em>' container reference.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIJpaRootContentNode_JpaFile()
- * @see org.eclipse.jpt.core.internal.JpaFile#getContent
- * @model opposite="content" transient="false" changeable="false"
- * @generated
- */
- public IJpaFile getJpaFile() {
- if (eContainerFeatureID != OrmPackage.XML_ROOT_CONTENT_NODE__JPA_FILE)
- return null;
- return (IJpaFile) eContainer();
- }
-
- @Override
- public IResource getResource() {
- return getJpaFile().getResource();
- }
-
- /**
- * Returns the value of the '<em><b>Entity Mappings</b></em>' reference.
- * It is bidirectional and its opposite is '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getRoot <em>Root</em>}'.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Entity Mappings</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Entity Mappings</em>' reference.
- * @see #setEntityMappings(EntityMappingsInternal)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlRootContentNode_EntityMappings()
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal#getRoot
- * @model opposite="root" resolveProxies="false" required="true" ordered="false"
- * @generated
- */
- public EntityMappingsInternal getEntityMappings() {
- return entityMappings;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetEntityMappings(EntityMappingsInternal newEntityMappings, NotificationChain msgs) {
- EntityMappingsInternal oldEntityMappings = entityMappings;
- entityMappings = newEntityMappings;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS, oldEntityMappings, newEntityMappings);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode#getEntityMappings <em>Entity Mappings</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Entity Mappings</em>' reference.
- * @see #getEntityMappings()
- * @generated
- */
- public void setEntityMappings(EntityMappingsInternal newEntityMappings) {
- if (newEntityMappings != entityMappings) {
- NotificationChain msgs = null;
- if (entityMappings != null)
- msgs = ((InternalEObject) entityMappings).eInverseRemove(this, OrmPackage.ENTITY_MAPPINGS_INTERNAL__ROOT, EntityMappingsInternal.class, msgs);
- if (newEntityMappings != null)
- msgs = ((InternalEObject) newEntityMappings).eInverseAdd(this, OrmPackage.ENTITY_MAPPINGS_INTERNAL__ROOT, EntityMappingsInternal.class, msgs);
- msgs = basicSetEntityMappings(newEntityMappings, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS, newEntityMappings, newEntityMappings));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_ROOT_CONTENT_NODE__JPA_FILE :
- if (eInternalContainer() != null)
- msgs = eBasicRemoveFromContainer(msgs);
- return eBasicSetContainer(otherEnd, OrmPackage.XML_ROOT_CONTENT_NODE__JPA_FILE, msgs);
- case OrmPackage.XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS :
- if (entityMappings != null)
- msgs = ((InternalEObject) entityMappings).eInverseRemove(this, OrmPackage.ENTITY_MAPPINGS_INTERNAL__ROOT, EntityMappingsInternal.class, msgs);
- return basicSetEntityMappings((EntityMappingsInternal) otherEnd, msgs);
- }
- return super.eInverseAdd(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_ROOT_CONTENT_NODE__JPA_FILE :
- return eBasicSetContainer(null, OrmPackage.XML_ROOT_CONTENT_NODE__JPA_FILE, msgs);
- case OrmPackage.XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS :
- return basicSetEntityMappings(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
- switch (eContainerFeatureID) {
- case OrmPackage.XML_ROOT_CONTENT_NODE__JPA_FILE :
- return eInternalContainer().eInverseRemove(this, JpaCorePackage.JPA_FILE__CONTENT, JpaFile.class, msgs);
- }
- return super.eBasicRemoveFromContainerFeature(msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_ROOT_CONTENT_NODE__JPA_FILE :
- return getJpaFile();
- case OrmPackage.XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS :
- return getEntityMappings();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS :
- setEntityMappings((EntityMappingsInternal) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS :
- setEntityMappings((EntityMappingsInternal) null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_ROOT_CONTENT_NODE__JPA_FILE :
- return getJpaFile() != null;
- case OrmPackage.XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS :
- return entityMappings != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaContentNode.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IJpaRootContentNode.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_ROOT_CONTENT_NODE__JPA_FILE :
- return JpaCorePackage.IJPA_ROOT_CONTENT_NODE__JPA_FILE;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaContentNode.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IJpaRootContentNode.class) {
- switch (baseFeatureID) {
- case JpaCorePackage.IJPA_ROOT_CONTENT_NODE__JPA_FILE :
- return OrmPackage.XML_ROOT_CONTENT_NODE__JPA_FILE;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- public void dispose() {
- if (artifactEdit != null) {
- artifactEdit.dispose();
- }
- }
-
- @Override
- public ITextRange fullTextRange() {
- return ITextRange.Empty.instance();
- }
-
- /* (non-Javadoc)
- *
- * @see IJpaRootContentNode#getContentNode(int)
- */
- public IJpaContentNode getContentNode(int offset) {
- if (getEntityMappings() == null || !getEntityMappings().getNode().contains(offset)) {
- return this;
- }
- return getEntityMappings().getContentNode(offset);
- }
-
- public void javaElementChanged(ElementChangedEvent event) {
- if (this.entityMappings != null) {
- this.entityMappings.javaElementChanged(event);
- }
- }
-
- public void setArtifactEdit(OrmArtifactEdit ormArtifactEdit) {
- artifactEdit = ormArtifactEdit;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlSecondaryTable.java
deleted file mode 100644
index 7baeeadbcd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlSecondaryTable.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import java.util.Collection;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Secondary Table</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlSecondaryTable()
- * @model kind="class"
- * @generated
- */
-public class XmlSecondaryTable extends AbstractXmlTable
- implements ISecondaryTable
-{
- /**
- * The cached value of the '{@link #getSpecifiedPrimaryKeyJoinColumns() <em>Specified Primary Key Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPrimaryKeyJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns;
-
- /**
- * The cached value of the '{@link #getDefaultPrimaryKeyJoinColumns() <em>Default Primary Key Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultPrimaryKeyJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns;
-
- @SuppressWarnings("unused")
- private XmlSecondaryTable() {
- super();
- }
-
- protected XmlSecondaryTable(Owner owner) {
- super(owner);
- this.getDefaultPrimaryKeyJoinColumns().add(this.createPrimaryKeyJoinColumn(0));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_SECONDARY_TABLE;
- }
-
- public EList<IPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- return this.getSpecifiedPrimaryKeyJoinColumns().isEmpty() ? this.getDefaultPrimaryKeyJoinColumns() : this.getSpecifiedPrimaryKeyJoinColumns();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Primary Key Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Primary Key Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Primary Key Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getISecondaryTable_SpecifiedPrimaryKeyJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
- if (specifiedPrimaryKeyJoinColumns == null) {
- specifiedPrimaryKeyJoinColumns = new EObjectContainmentEList<IPrimaryKeyJoinColumn>(IPrimaryKeyJoinColumn.class, this, OrmPackage.XML_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS);
- }
- return specifiedPrimaryKeyJoinColumns;
- }
-
- /**
- * Returns the value of the '<em><b>Default Primary Key Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Primary Key Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Primary Key Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getISecondaryTable_DefaultPrimaryKeyJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns() {
- if (defaultPrimaryKeyJoinColumns == null) {
- defaultPrimaryKeyJoinColumns = new EObjectContainmentEList<IPrimaryKeyJoinColumn>(IPrimaryKeyJoinColumn.class, this, OrmPackage.XML_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS);
- }
- return defaultPrimaryKeyJoinColumns;
- }
-
- public ITypeMapping typeMapping() {
- return (ITypeMapping) eContainer();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS :
- return ((InternalEList<?>) getPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return ((InternalEList<?>) getSpecifiedPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return ((InternalEList<?>) getDefaultPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS :
- return getPrimaryKeyJoinColumns();
- case OrmPackage.XML_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return getSpecifiedPrimaryKeyJoinColumns();
- case OrmPackage.XML_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return getDefaultPrimaryKeyJoinColumns();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- getSpecifiedPrimaryKeyJoinColumns().clear();
- getSpecifiedPrimaryKeyJoinColumns().addAll((Collection<? extends IPrimaryKeyJoinColumn>) newValue);
- return;
- case OrmPackage.XML_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- getDefaultPrimaryKeyJoinColumns().clear();
- getDefaultPrimaryKeyJoinColumns().addAll((Collection<? extends IPrimaryKeyJoinColumn>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- getSpecifiedPrimaryKeyJoinColumns().clear();
- return;
- case OrmPackage.XML_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- getDefaultPrimaryKeyJoinColumns().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS :
- return !getPrimaryKeyJoinColumns().isEmpty();
- case OrmPackage.XML_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return specifiedPrimaryKeyJoinColumns != null && !specifiedPrimaryKeyJoinColumns.isEmpty();
- case OrmPackage.XML_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return defaultPrimaryKeyJoinColumns != null && !defaultPrimaryKeyJoinColumns.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == ISecondaryTable.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.ISECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS;
- case OrmPackage.XML_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.ISECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS;
- case OrmPackage.XML_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.ISECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == ISecondaryTable.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.ISECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS :
- return OrmPackage.XML_SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.ISECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS :
- return OrmPackage.XML_SECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.ISECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS :
- return OrmPackage.XML_SECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- private XmlEntityInternal entity() {
- return (XmlEntityInternal) eContainer();
- }
-
- @Override
- protected void makeTableForXmlNonNull() {
- //secondaryTables are part of a collection, the secondary-table element will be removed/added
- //when the XmlSecondaryTable is removed/added to the XmlEntity collection
- }
-
- @Override
- protected void makeTableForXmlNull() {
- //secondaryTables are part of a collection, the secondary-table element will be removed/added
- //when the XmlSecondaryTable is removed/added to the XmlEntity collection
- }
-
- public boolean containsSpecifiedPrimaryKeyJoinColumns() {
- return !this.getSpecifiedPrimaryKeyJoinColumns().isEmpty();
- }
-
- public IPrimaryKeyJoinColumn createPrimaryKeyJoinColumn(int index) {
- return OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn(new ISecondaryTable.PrimaryKeyJoinColumnOwner(this));
- }
-
- public boolean isVirtual() {
- return entity().getVirtualSecondaryTables().contains(this);
- }
-} // XmlSecondaryTable
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlSequenceGenerator.java
deleted file mode 100644
index e9d9a07d75..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlSequenceGenerator.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Sequence Generator</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlSequenceGenerator()
- * @model kind="class"
- * @generated
- */
-public class XmlSequenceGenerator extends XmlGenerator
- implements ISequenceGenerator
-{
- /**
- * The default value of the '{@link #getSequenceName() <em>Sequence Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSequenceName()
- * @generated
- * @ordered
- */
- protected static final String SEQUENCE_NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedSequenceName() <em>Specified Sequence Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSequenceName()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_SEQUENCE_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedSequenceName() <em>Specified Sequence Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSequenceName()
- * @generated
- * @ordered
- */
- protected String specifiedSequenceName = SPECIFIED_SEQUENCE_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultSequenceName() <em>Default Sequence Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultSequenceName()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_SEQUENCE_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultSequenceName() <em>Default Sequence Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultSequenceName()
- * @generated
- * @ordered
- */
- protected String defaultSequenceName = DEFAULT_SEQUENCE_NAME_EDEFAULT;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlSequenceGenerator() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_SEQUENCE_GENERATOR;
- }
-
- public String getSequenceName() {
- return (this.getSpecifiedSequenceName() == null) ? getDefaultSequenceName() : this.getSpecifiedSequenceName();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Sequence Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Sequence Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Sequence Name</em>' attribute.
- * @see #setSpecifiedSequenceName(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getISequenceGenerator_SpecifiedSequenceName()
- * @model
- * @generated
- */
- public String getSpecifiedSequenceName() {
- return specifiedSequenceName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlSequenceGenerator#getSpecifiedSequenceName <em>Specified Sequence Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Sequence Name</em>' attribute.
- * @see #getSpecifiedSequenceName()
- * @generated
- */
- public void setSpecifiedSequenceName(String newSpecifiedSequenceName) {
- String oldSpecifiedSequenceName = specifiedSequenceName;
- specifiedSequenceName = newSpecifiedSequenceName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME, oldSpecifiedSequenceName, specifiedSequenceName));
- }
-
- /**
- * Returns the value of the '<em><b>Default Sequence Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Sequence Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Sequence Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getISequenceGenerator_DefaultSequenceName()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultSequenceName() {
- return defaultSequenceName;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_SEQUENCE_GENERATOR__SEQUENCE_NAME :
- return getSequenceName();
- case OrmPackage.XML_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME :
- return getSpecifiedSequenceName();
- case OrmPackage.XML_SEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME :
- return getDefaultSequenceName();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME :
- setSpecifiedSequenceName((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME :
- setSpecifiedSequenceName(SPECIFIED_SEQUENCE_NAME_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_SEQUENCE_GENERATOR__SEQUENCE_NAME :
- return SEQUENCE_NAME_EDEFAULT == null ? getSequenceName() != null : !SEQUENCE_NAME_EDEFAULT.equals(getSequenceName());
- case OrmPackage.XML_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME :
- return SPECIFIED_SEQUENCE_NAME_EDEFAULT == null ? specifiedSequenceName != null : !SPECIFIED_SEQUENCE_NAME_EDEFAULT.equals(specifiedSequenceName);
- case OrmPackage.XML_SEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME :
- return DEFAULT_SEQUENCE_NAME_EDEFAULT == null ? defaultSequenceName != null : !DEFAULT_SEQUENCE_NAME_EDEFAULT.equals(defaultSequenceName);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == ISequenceGenerator.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_SEQUENCE_GENERATOR__SEQUENCE_NAME :
- return JpaCoreMappingsPackage.ISEQUENCE_GENERATOR__SEQUENCE_NAME;
- case OrmPackage.XML_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME :
- return JpaCoreMappingsPackage.ISEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME;
- case OrmPackage.XML_SEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME :
- return JpaCoreMappingsPackage.ISEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == ISequenceGenerator.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.ISEQUENCE_GENERATOR__SEQUENCE_NAME :
- return OrmPackage.XML_SEQUENCE_GENERATOR__SEQUENCE_NAME;
- case JpaCoreMappingsPackage.ISEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME :
- return OrmPackage.XML_SEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME;
- case JpaCoreMappingsPackage.ISEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME :
- return OrmPackage.XML_SEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedSequenceName: ");
- result.append(specifiedSequenceName);
- result.append(", defaultSequenceName: ");
- result.append(defaultSequenceName);
- result.append(')');
- return result.toString();
- }
-} // XmlSequenceGenerator
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlSingleRelationshipMapping.java
deleted file mode 100644
index 64d1733ac3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlSingleRelationshipMapping.java
+++ /dev/null
@@ -1,483 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import java.util.Collection;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Single Relationship Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlSingleRelationshipMapping()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class XmlSingleRelationshipMapping
- extends XmlRelationshipMapping implements ISingleRelationshipMapping
-{
- /**
- * The default value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getFetch()
- * @generated
- * @ordered
- */
- protected static final DefaultEagerFetchType FETCH_EDEFAULT = DefaultEagerFetchType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getFetch()
- * @generated
- * @ordered
- */
- protected DefaultEagerFetchType fetch = FETCH_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getSpecifiedJoinColumns() <em>Specified Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IJoinColumn> specifiedJoinColumns;
-
- /**
- * The cached value of the '{@link #getDefaultJoinColumns() <em>Default Join Columns</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultJoinColumns()
- * @generated
- * @ordered
- */
- protected EList<IJoinColumn> defaultJoinColumns;
-
- /**
- * The default value of the '{@link #getOptional() <em>Optional</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getOptional()
- * @generated
- * @ordered
- */
- protected static final DefaultTrueBoolean OPTIONAL_EDEFAULT = DefaultTrueBoolean.DEFAULT;
-
- /**
- * The cached value of the '{@link #getOptional() <em>Optional</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getOptional()
- * @generated
- * @ordered
- */
- protected DefaultTrueBoolean optional = OPTIONAL_EDEFAULT;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated NOT
- */
- protected XmlSingleRelationshipMapping() {
- super();
- this.getDefaultJoinColumns().add(this.createJoinColumn(new JoinColumnOwner(this)));
- this.eAdapters().add(this.buildListener());
- }
-
- private IJoinColumn createJoinColumn(IJoinColumn.Owner owner) {
- return OrmFactory.eINSTANCE.createXmlJoinColumn(owner);
- }
-
- private Adapter buildListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- XmlSingleRelationshipMapping.this.notifyChanged(notification);
- }
- };
- }
-
- /**
- * check for changes to the 'specifiedJoinColumns' and
- * 'specifiedInverseJoinColumns' lists so we can notify the
- * model adapter of any changes;
- * also listen for changes to the 'defaultJoinColumns' and
- * 'defaultInverseJoinColumns' lists so we can spank the developer
- */
- void notifyChanged(Notification notification) {
- switch (notification.getFeatureID(ISingleRelationshipMapping.class)) {
- case JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS :
- defaultJoinColumnsChanged(notification);
- break;
- default :
- break;
- }
- }
-
- void defaultJoinColumnsChanged(Notification notification) {
- throw new IllegalStateException("'defaultJoinColumns' cannot be changed");
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_SINGLE_RELATIONSHIP_MAPPING;
- }
-
- /**
- * Returns the value of the '<em><b>Fetch</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Fetch</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType
- * @see #setFetch(DefaultEagerFetchType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getISingleRelationshipMapping_Fetch()
- * @model
- * @generated
- */
- public DefaultEagerFetchType getFetch() {
- return fetch;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlSingleRelationshipMapping#getFetch <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType
- * @see #getFetch()
- * @generated
- */
- public void setFetch(DefaultEagerFetchType newFetch) {
- DefaultEagerFetchType oldFetch = fetch;
- fetch = newFetch == null ? FETCH_EDEFAULT : newFetch;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__FETCH, oldFetch, fetch));
- }
-
- /**
- * Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getISingleRelationshipMapping_JoinColumns()
- * @model type="org.eclipse.jpt.core.internal.mappings.IJoinColumn" containment="true" transient="true" changeable="false" volatile="true"
- * @generated NOT
- */
- public EList<IJoinColumn> getJoinColumns() {
- return this.getSpecifiedJoinColumns().isEmpty() ? this.getDefaultJoinColumns() : this.getSpecifiedJoinColumns();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getISingleRelationshipMapping_SpecifiedJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IJoinColumn> getSpecifiedJoinColumns() {
- if (specifiedJoinColumns == null) {
- specifiedJoinColumns = new EObjectContainmentEList<IJoinColumn>(IJoinColumn.class, this, OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS);
- }
- return specifiedJoinColumns;
- }
-
- /**
- * Returns the value of the '<em><b>Default Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getISingleRelationshipMapping_DefaultJoinColumns()
- * @model containment="true"
- * @generated
- */
- public EList<IJoinColumn> getDefaultJoinColumns() {
- if (defaultJoinColumns == null) {
- defaultJoinColumns = new EObjectContainmentEList<IJoinColumn>(IJoinColumn.class, this, OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS);
- }
- return defaultJoinColumns;
- }
-
- /**
- * Returns the value of the '<em><b>Optional</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Optional</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Optional</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setOptional(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getISingleRelationshipMapping_Optional()
- * @model
- * @generated
- */
- public DefaultTrueBoolean getOptional() {
- return optional;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlSingleRelationshipMapping#getOptional <em>Optional</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Optional</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getOptional()
- * @generated
- */
- public void setOptional(DefaultTrueBoolean newOptional) {
- DefaultTrueBoolean oldOptional = optional;
- optional = newOptional == null ? OPTIONAL_EDEFAULT : newOptional;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL, oldOptional, optional));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS :
- return ((InternalEList<?>) getJoinColumns()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS :
- return ((InternalEList<?>) getSpecifiedJoinColumns()).basicRemove(otherEnd, msgs);
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS :
- return ((InternalEList<?>) getDefaultJoinColumns()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__FETCH :
- return getFetch();
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS :
- return getJoinColumns();
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS :
- return getSpecifiedJoinColumns();
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS :
- return getDefaultJoinColumns();
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL :
- return getOptional();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__FETCH :
- setFetch((DefaultEagerFetchType) newValue);
- return;
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS :
- getSpecifiedJoinColumns().clear();
- getSpecifiedJoinColumns().addAll((Collection<? extends IJoinColumn>) newValue);
- return;
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS :
- getDefaultJoinColumns().clear();
- getDefaultJoinColumns().addAll((Collection<? extends IJoinColumn>) newValue);
- return;
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL :
- setOptional((DefaultTrueBoolean) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__FETCH :
- setFetch(FETCH_EDEFAULT);
- return;
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS :
- getSpecifiedJoinColumns().clear();
- return;
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS :
- getDefaultJoinColumns().clear();
- return;
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL :
- setOptional(OPTIONAL_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__FETCH :
- return fetch != FETCH_EDEFAULT;
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS :
- return !getJoinColumns().isEmpty();
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS :
- return specifiedJoinColumns != null && !specifiedJoinColumns.isEmpty();
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS :
- return defaultJoinColumns != null && !defaultJoinColumns.isEmpty();
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL :
- return optional != OPTIONAL_EDEFAULT;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == ISingleRelationshipMapping.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__FETCH :
- return JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__FETCH;
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS :
- return JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS;
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS;
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS :
- return JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS;
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL :
- return JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__OPTIONAL;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == ISingleRelationshipMapping.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__FETCH :
- return OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__FETCH;
- case JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS :
- return OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS;
- case JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS :
- return OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS :
- return OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS;
- case JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__OPTIONAL :
- return OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING__OPTIONAL;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (fetch: ");
- result.append(fetch);
- result.append(", optional: ");
- result.append(optional);
- result.append(')');
- return result.toString();
- }
-
- @Override
- public void initializeFromXmlSingleRelationshipMapping(XmlSingleRelationshipMapping oldMapping) {
- super.initializeFromXmlSingleRelationshipMapping(oldMapping);
- setFetch(oldMapping.getFetch());
- }
-
- public IJoinColumn createJoinColumn(int index) {
- return OrmFactory.eINSTANCE.createXmlJoinColumn(new JoinColumnOwner(this));
- }
-
- public boolean containsSpecifiedJoinColumns() {
- return !this.getSpecifiedJoinColumns().isEmpty();
- }
-} // XmlSingleRelationshipMapping
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTable.java
deleted file mode 100644
index eaf623b6fa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTable.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Table</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTable()
- * @model kind="class"
- * @generated
- */
-public class XmlTable extends AbstractXmlTable
-{
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlTable() {
- super();
- }
-
- protected XmlTable(Owner owner) {
- super(owner);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_TABLE;
- }
-
- private XmlEntityInternal entity() {
- return (XmlEntityInternal) eContainer();
- }
-
- @Override
- protected void makeTableForXmlNonNull() {
- entity().makeTableForXmlNonNull();
- }
-
- @Override
- protected void makeTableForXmlNull() {
- entity().makeTableForXmlNull();
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext) {
- super.refreshDefaults(defaultsContext);
- setDefaultName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_TABLE_NAME_KEY));
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTableGenerator.java
deleted file mode 100644
index 9dddb25962..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTableGenerator.java
+++ /dev/null
@@ -1,1070 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import java.util.Collection;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Table Generator</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTableGenerator()
- * @model kind="class"
- * @generated
- */
-public class XmlTableGenerator extends XmlGenerator implements ITableGenerator
-{
- /**
- * The default value of the '{@link #getTable() <em>Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTable()
- * @generated
- * @ordered
- */
- protected static final String TABLE_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedTable() <em>Specified Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedTable()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_TABLE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedTable() <em>Specified Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedTable()
- * @generated
- * @ordered
- */
- protected String specifiedTable = SPECIFIED_TABLE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultTable() <em>Default Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultTable()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_TABLE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultTable() <em>Default Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultTable()
- * @generated
- * @ordered
- */
- protected String defaultTable = DEFAULT_TABLE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getCatalog()
- * @generated
- * @ordered
- */
- protected static final String CATALOG_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedCatalog() <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedCatalog()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_CATALOG_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedCatalog() <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedCatalog()
- * @generated
- * @ordered
- */
- protected String specifiedCatalog = SPECIFIED_CATALOG_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultCatalog() <em>Default Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultCatalog()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_CATALOG_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultCatalog() <em>Default Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultCatalog()
- * @generated
- * @ordered
- */
- protected String defaultCatalog = DEFAULT_CATALOG_EDEFAULT;
-
- /**
- * The default value of the '{@link #getSchema() <em>Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSchema()
- * @generated
- * @ordered
- */
- protected static final String SCHEMA_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedSchema() <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSchema()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_SCHEMA_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedSchema() <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedSchema()
- * @generated
- * @ordered
- */
- protected String specifiedSchema = SPECIFIED_SCHEMA_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultSchema() <em>Default Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultSchema()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_SCHEMA_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultSchema() <em>Default Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultSchema()
- * @generated
- * @ordered
- */
- protected String defaultSchema = DEFAULT_SCHEMA_EDEFAULT;
-
- /**
- * The default value of the '{@link #getPkColumnName() <em>Pk Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPkColumnName()
- * @generated
- * @ordered
- */
- protected static final String PK_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedPkColumnName() <em>Specified Pk Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPkColumnName()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_PK_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedPkColumnName() <em>Specified Pk Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPkColumnName()
- * @generated
- * @ordered
- */
- protected String specifiedPkColumnName = SPECIFIED_PK_COLUMN_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultPkColumnName() <em>Default Pk Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultPkColumnName()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_PK_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultPkColumnName() <em>Default Pk Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultPkColumnName()
- * @generated
- * @ordered
- */
- protected String defaultPkColumnName = DEFAULT_PK_COLUMN_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getValueColumnName() <em>Value Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getValueColumnName()
- * @generated
- * @ordered
- */
- protected static final String VALUE_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedValueColumnName() <em>Specified Value Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedValueColumnName()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_VALUE_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedValueColumnName() <em>Specified Value Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedValueColumnName()
- * @generated
- * @ordered
- */
- protected String specifiedValueColumnName = SPECIFIED_VALUE_COLUMN_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultValueColumnName() <em>Default Value Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultValueColumnName()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_VALUE_COLUMN_NAME_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultValueColumnName() <em>Default Value Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultValueColumnName()
- * @generated
- * @ordered
- */
- protected String defaultValueColumnName = DEFAULT_VALUE_COLUMN_NAME_EDEFAULT;
-
- /**
- * The default value of the '{@link #getPkColumnValue() <em>Pk Column Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPkColumnValue()
- * @generated
- * @ordered
- */
- protected static final String PK_COLUMN_VALUE_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getSpecifiedPkColumnValue() <em>Specified Pk Column Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPkColumnValue()
- * @generated
- * @ordered
- */
- protected static final String SPECIFIED_PK_COLUMN_VALUE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getSpecifiedPkColumnValue() <em>Specified Pk Column Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedPkColumnValue()
- * @generated
- * @ordered
- */
- protected String specifiedPkColumnValue = SPECIFIED_PK_COLUMN_VALUE_EDEFAULT;
-
- /**
- * The default value of the '{@link #getDefaultPkColumnValue() <em>Default Pk Column Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultPkColumnValue()
- * @generated
- * @ordered
- */
- protected static final String DEFAULT_PK_COLUMN_VALUE_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getDefaultPkColumnValue() <em>Default Pk Column Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultPkColumnValue()
- * @generated
- * @ordered
- */
- protected String defaultPkColumnValue = DEFAULT_PK_COLUMN_VALUE_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getUniqueConstraints() <em>Unique Constraints</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getUniqueConstraints()
- * @generated
- * @ordered
- */
- protected EList<IUniqueConstraint> uniqueConstraints;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlTableGenerator() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_TABLE_GENERATOR;
- }
-
- public String getTable() {
- return (this.getSpecifiedTable() == null) ? getDefaultTable() : this.getSpecifiedTable();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Table</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Table</em>' attribute.
- * @see #setSpecifiedTable(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITableGenerator_SpecifiedTable()
- * @model
- * @generated
- */
- public String getSpecifiedTable() {
- return specifiedTable;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator#getSpecifiedTable <em>Specified Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Table</em>' attribute.
- * @see #getSpecifiedTable()
- * @generated
- */
- public void setSpecifiedTable(String newSpecifiedTable) {
- String oldSpecifiedTable = specifiedTable;
- specifiedTable = newSpecifiedTable;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_TABLE, oldSpecifiedTable, specifiedTable));
- }
-
- /**
- * Returns the value of the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Table</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Table</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITableGenerator_DefaultTable()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultTable() {
- return defaultTable;
- }
-
- public String getCatalog() {
- return (this.getSpecifiedCatalog() == null) ? getDefaultCatalog() : this.getSpecifiedCatalog();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Catalog</em>' attribute.
- * @see #setSpecifiedCatalog(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITableGenerator_SpecifiedCatalog()
- * @model
- * @generated
- */
- public String getSpecifiedCatalog() {
- return specifiedCatalog;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator#getSpecifiedCatalog <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Catalog</em>' attribute.
- * @see #getSpecifiedCatalog()
- * @generated
- */
- public void setSpecifiedCatalog(String newSpecifiedCatalog) {
- String oldSpecifiedCatalog = specifiedCatalog;
- specifiedCatalog = newSpecifiedCatalog;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_CATALOG, oldSpecifiedCatalog, specifiedCatalog));
- }
-
- /**
- * Returns the value of the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Catalog</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITableGenerator_DefaultCatalog()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultCatalog() {
- return defaultCatalog;
- }
-
- public String getSchema() {
- return (this.getSpecifiedSchema() == null) ? getDefaultSchema() : this.getSpecifiedSchema();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Schema</em>' attribute.
- * @see #setSpecifiedSchema(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITableGenerator_SpecifiedSchema()
- * @model
- * @generated
- */
- public String getSpecifiedSchema() {
- return specifiedSchema;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator#getSpecifiedSchema <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Schema</em>' attribute.
- * @see #getSpecifiedSchema()
- * @generated
- */
- public void setSpecifiedSchema(String newSpecifiedSchema) {
- String oldSpecifiedSchema = specifiedSchema;
- specifiedSchema = newSpecifiedSchema;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_SCHEMA, oldSpecifiedSchema, specifiedSchema));
- }
-
- /**
- * Returns the value of the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Schema</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITableGenerator_DefaultSchema()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultSchema() {
- return defaultSchema;
- }
-
- protected void setDefaultSchema(String newDefaultSchema) {
- String oldDefaultSchema = this.defaultSchema;
- this.defaultSchema = newDefaultSchema;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_TABLE_GENERATOR__DEFAULT_SCHEMA, oldDefaultSchema, this.defaultSchema));
- }
-
- public String getPkColumnName() {
- return (this.getSpecifiedPkColumnName() == null) ? getDefaultPkColumnName() : this.getSpecifiedPkColumnName();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Pk Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Pk Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Pk Column Name</em>' attribute.
- * @see #setSpecifiedPkColumnName(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITableGenerator_SpecifiedPkColumnName()
- * @model
- * @generated
- */
- public String getSpecifiedPkColumnName() {
- return specifiedPkColumnName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator#getSpecifiedPkColumnName <em>Specified Pk Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Pk Column Name</em>' attribute.
- * @see #getSpecifiedPkColumnName()
- * @generated
- */
- public void setSpecifiedPkColumnName(String newSpecifiedPkColumnName) {
- String oldSpecifiedPkColumnName = specifiedPkColumnName;
- specifiedPkColumnName = newSpecifiedPkColumnName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME, oldSpecifiedPkColumnName, specifiedPkColumnName));
- }
-
- /**
- * Returns the value of the '<em><b>Default Pk Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Pk Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Pk Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITableGenerator_DefaultPkColumnName()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultPkColumnName() {
- return defaultPkColumnName;
- }
-
- public String getValueColumnName() {
- return (this.getSpecifiedValueColumnName() == null) ? getDefaultValueColumnName() : this.getSpecifiedValueColumnName();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Value Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Value Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Value Column Name</em>' attribute.
- * @see #setSpecifiedValueColumnName(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITableGenerator_SpecifiedValueColumnName()
- * @model
- * @generated
- */
- public String getSpecifiedValueColumnName() {
- return specifiedValueColumnName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator#getSpecifiedValueColumnName <em>Specified Value Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Value Column Name</em>' attribute.
- * @see #getSpecifiedValueColumnName()
- * @generated
- */
- public void setSpecifiedValueColumnName(String newSpecifiedValueColumnName) {
- String oldSpecifiedValueColumnName = specifiedValueColumnName;
- specifiedValueColumnName = newSpecifiedValueColumnName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME, oldSpecifiedValueColumnName, specifiedValueColumnName));
- }
-
- /**
- * Returns the value of the '<em><b>Default Value Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Value Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Value Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITableGenerator_DefaultValueColumnName()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultValueColumnName() {
- return defaultValueColumnName;
- }
-
- public String getPkColumnValue() {
- return (this.getSpecifiedPkColumnValue() == null) ? getDefaultPkColumnValue() : this.getSpecifiedPkColumnValue();
- }
-
- /**
- * Returns the value of the '<em><b>Specified Pk Column Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Pk Column Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Pk Column Value</em>' attribute.
- * @see #setSpecifiedPkColumnValue(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITableGenerator_SpecifiedPkColumnValue()
- * @model
- * @generated
- */
- public String getSpecifiedPkColumnValue() {
- return specifiedPkColumnValue;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator#getSpecifiedPkColumnValue <em>Specified Pk Column Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Pk Column Value</em>' attribute.
- * @see #getSpecifiedPkColumnValue()
- * @generated
- */
- public void setSpecifiedPkColumnValue(String newSpecifiedPkColumnValue) {
- String oldSpecifiedPkColumnValue = specifiedPkColumnValue;
- specifiedPkColumnValue = newSpecifiedPkColumnValue;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE, oldSpecifiedPkColumnValue, specifiedPkColumnValue));
- }
-
- /**
- * Returns the value of the '<em><b>Default Pk Column Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Pk Column Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Pk Column Value</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITableGenerator_DefaultPkColumnValue()
- * @model changeable="false"
- * @generated
- */
- public String getDefaultPkColumnValue() {
- return defaultPkColumnValue;
- }
-
- /**
- * Returns the value of the '<em><b>Unique Constraints</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IUniqueConstraint}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Unique Constraints</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Unique Constraints</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITableGenerator_UniqueConstraints()
- * @model containment="true"
- * @generated
- */
- public EList<IUniqueConstraint> getUniqueConstraints() {
- if (uniqueConstraints == null) {
- uniqueConstraints = new EObjectContainmentEList<IUniqueConstraint>(IUniqueConstraint.class, this, OrmPackage.XML_TABLE_GENERATOR__UNIQUE_CONSTRAINTS);
- }
- return uniqueConstraints;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_TABLE_GENERATOR__UNIQUE_CONSTRAINTS :
- return ((InternalEList<?>) getUniqueConstraints()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_TABLE_GENERATOR__TABLE :
- return getTable();
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_TABLE :
- return getSpecifiedTable();
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_TABLE :
- return getDefaultTable();
- case OrmPackage.XML_TABLE_GENERATOR__CATALOG :
- return getCatalog();
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_CATALOG :
- return getSpecifiedCatalog();
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_CATALOG :
- return getDefaultCatalog();
- case OrmPackage.XML_TABLE_GENERATOR__SCHEMA :
- return getSchema();
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_SCHEMA :
- return getSpecifiedSchema();
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_SCHEMA :
- return getDefaultSchema();
- case OrmPackage.XML_TABLE_GENERATOR__PK_COLUMN_NAME :
- return getPkColumnName();
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME :
- return getSpecifiedPkColumnName();
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME :
- return getDefaultPkColumnName();
- case OrmPackage.XML_TABLE_GENERATOR__VALUE_COLUMN_NAME :
- return getValueColumnName();
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME :
- return getSpecifiedValueColumnName();
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME :
- return getDefaultValueColumnName();
- case OrmPackage.XML_TABLE_GENERATOR__PK_COLUMN_VALUE :
- return getPkColumnValue();
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE :
- return getSpecifiedPkColumnValue();
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE :
- return getDefaultPkColumnValue();
- case OrmPackage.XML_TABLE_GENERATOR__UNIQUE_CONSTRAINTS :
- return getUniqueConstraints();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_TABLE :
- setSpecifiedTable((String) newValue);
- return;
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_CATALOG :
- setSpecifiedCatalog((String) newValue);
- return;
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_SCHEMA :
- setSpecifiedSchema((String) newValue);
- return;
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME :
- setSpecifiedPkColumnName((String) newValue);
- return;
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME :
- setSpecifiedValueColumnName((String) newValue);
- return;
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE :
- setSpecifiedPkColumnValue((String) newValue);
- return;
- case OrmPackage.XML_TABLE_GENERATOR__UNIQUE_CONSTRAINTS :
- getUniqueConstraints().clear();
- getUniqueConstraints().addAll((Collection<? extends IUniqueConstraint>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_TABLE :
- setSpecifiedTable(SPECIFIED_TABLE_EDEFAULT);
- return;
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_CATALOG :
- setSpecifiedCatalog(SPECIFIED_CATALOG_EDEFAULT);
- return;
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_SCHEMA :
- setSpecifiedSchema(SPECIFIED_SCHEMA_EDEFAULT);
- return;
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME :
- setSpecifiedPkColumnName(SPECIFIED_PK_COLUMN_NAME_EDEFAULT);
- return;
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME :
- setSpecifiedValueColumnName(SPECIFIED_VALUE_COLUMN_NAME_EDEFAULT);
- return;
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE :
- setSpecifiedPkColumnValue(SPECIFIED_PK_COLUMN_VALUE_EDEFAULT);
- return;
- case OrmPackage.XML_TABLE_GENERATOR__UNIQUE_CONSTRAINTS :
- getUniqueConstraints().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_TABLE_GENERATOR__TABLE :
- return TABLE_EDEFAULT == null ? getTable() != null : !TABLE_EDEFAULT.equals(getTable());
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_TABLE :
- return SPECIFIED_TABLE_EDEFAULT == null ? specifiedTable != null : !SPECIFIED_TABLE_EDEFAULT.equals(specifiedTable);
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_TABLE :
- return DEFAULT_TABLE_EDEFAULT == null ? defaultTable != null : !DEFAULT_TABLE_EDEFAULT.equals(defaultTable);
- case OrmPackage.XML_TABLE_GENERATOR__CATALOG :
- return CATALOG_EDEFAULT == null ? getCatalog() != null : !CATALOG_EDEFAULT.equals(getCatalog());
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_CATALOG :
- return SPECIFIED_CATALOG_EDEFAULT == null ? specifiedCatalog != null : !SPECIFIED_CATALOG_EDEFAULT.equals(specifiedCatalog);
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_CATALOG :
- return DEFAULT_CATALOG_EDEFAULT == null ? defaultCatalog != null : !DEFAULT_CATALOG_EDEFAULT.equals(defaultCatalog);
- case OrmPackage.XML_TABLE_GENERATOR__SCHEMA :
- return SCHEMA_EDEFAULT == null ? getSchema() != null : !SCHEMA_EDEFAULT.equals(getSchema());
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_SCHEMA :
- return SPECIFIED_SCHEMA_EDEFAULT == null ? specifiedSchema != null : !SPECIFIED_SCHEMA_EDEFAULT.equals(specifiedSchema);
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_SCHEMA :
- return DEFAULT_SCHEMA_EDEFAULT == null ? defaultSchema != null : !DEFAULT_SCHEMA_EDEFAULT.equals(defaultSchema);
- case OrmPackage.XML_TABLE_GENERATOR__PK_COLUMN_NAME :
- return PK_COLUMN_NAME_EDEFAULT == null ? getPkColumnName() != null : !PK_COLUMN_NAME_EDEFAULT.equals(getPkColumnName());
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME :
- return SPECIFIED_PK_COLUMN_NAME_EDEFAULT == null ? specifiedPkColumnName != null : !SPECIFIED_PK_COLUMN_NAME_EDEFAULT.equals(specifiedPkColumnName);
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME :
- return DEFAULT_PK_COLUMN_NAME_EDEFAULT == null ? defaultPkColumnName != null : !DEFAULT_PK_COLUMN_NAME_EDEFAULT.equals(defaultPkColumnName);
- case OrmPackage.XML_TABLE_GENERATOR__VALUE_COLUMN_NAME :
- return VALUE_COLUMN_NAME_EDEFAULT == null ? getValueColumnName() != null : !VALUE_COLUMN_NAME_EDEFAULT.equals(getValueColumnName());
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME :
- return SPECIFIED_VALUE_COLUMN_NAME_EDEFAULT == null ? specifiedValueColumnName != null : !SPECIFIED_VALUE_COLUMN_NAME_EDEFAULT.equals(specifiedValueColumnName);
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME :
- return DEFAULT_VALUE_COLUMN_NAME_EDEFAULT == null ? defaultValueColumnName != null : !DEFAULT_VALUE_COLUMN_NAME_EDEFAULT.equals(defaultValueColumnName);
- case OrmPackage.XML_TABLE_GENERATOR__PK_COLUMN_VALUE :
- return PK_COLUMN_VALUE_EDEFAULT == null ? getPkColumnValue() != null : !PK_COLUMN_VALUE_EDEFAULT.equals(getPkColumnValue());
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE :
- return SPECIFIED_PK_COLUMN_VALUE_EDEFAULT == null ? specifiedPkColumnValue != null : !SPECIFIED_PK_COLUMN_VALUE_EDEFAULT.equals(specifiedPkColumnValue);
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE :
- return DEFAULT_PK_COLUMN_VALUE_EDEFAULT == null ? defaultPkColumnValue != null : !DEFAULT_PK_COLUMN_VALUE_EDEFAULT.equals(defaultPkColumnValue);
- case OrmPackage.XML_TABLE_GENERATOR__UNIQUE_CONSTRAINTS :
- return uniqueConstraints != null && !uniqueConstraints.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == ITableGenerator.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_TABLE_GENERATOR__TABLE :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__TABLE;
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_TABLE :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_TABLE;
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_TABLE :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_TABLE;
- case OrmPackage.XML_TABLE_GENERATOR__CATALOG :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__CATALOG;
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_CATALOG :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_CATALOG;
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_CATALOG :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_CATALOG;
- case OrmPackage.XML_TABLE_GENERATOR__SCHEMA :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__SCHEMA;
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_SCHEMA :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_SCHEMA;
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_SCHEMA :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_SCHEMA;
- case OrmPackage.XML_TABLE_GENERATOR__PK_COLUMN_NAME :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__PK_COLUMN_NAME;
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME;
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME;
- case OrmPackage.XML_TABLE_GENERATOR__VALUE_COLUMN_NAME :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__VALUE_COLUMN_NAME;
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME;
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME;
- case OrmPackage.XML_TABLE_GENERATOR__PK_COLUMN_VALUE :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__PK_COLUMN_VALUE;
- case OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE;
- case OrmPackage.XML_TABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE;
- case OrmPackage.XML_TABLE_GENERATOR__UNIQUE_CONSTRAINTS :
- return JpaCoreMappingsPackage.ITABLE_GENERATOR__UNIQUE_CONSTRAINTS;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == ITableGenerator.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__TABLE :
- return OrmPackage.XML_TABLE_GENERATOR__TABLE;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_TABLE :
- return OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_TABLE;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_TABLE :
- return OrmPackage.XML_TABLE_GENERATOR__DEFAULT_TABLE;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__CATALOG :
- return OrmPackage.XML_TABLE_GENERATOR__CATALOG;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_CATALOG :
- return OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_CATALOG;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_CATALOG :
- return OrmPackage.XML_TABLE_GENERATOR__DEFAULT_CATALOG;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__SCHEMA :
- return OrmPackage.XML_TABLE_GENERATOR__SCHEMA;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_SCHEMA :
- return OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_SCHEMA;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_SCHEMA :
- return OrmPackage.XML_TABLE_GENERATOR__DEFAULT_SCHEMA;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__PK_COLUMN_NAME :
- return OrmPackage.XML_TABLE_GENERATOR__PK_COLUMN_NAME;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME :
- return OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME :
- return OrmPackage.XML_TABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__VALUE_COLUMN_NAME :
- return OrmPackage.XML_TABLE_GENERATOR__VALUE_COLUMN_NAME;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME :
- return OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME :
- return OrmPackage.XML_TABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__PK_COLUMN_VALUE :
- return OrmPackage.XML_TABLE_GENERATOR__PK_COLUMN_VALUE;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE :
- return OrmPackage.XML_TABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE :
- return OrmPackage.XML_TABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE;
- case JpaCoreMappingsPackage.ITABLE_GENERATOR__UNIQUE_CONSTRAINTS :
- return OrmPackage.XML_TABLE_GENERATOR__UNIQUE_CONSTRAINTS;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (specifiedTable: ");
- result.append(specifiedTable);
- result.append(", defaultTable: ");
- result.append(defaultTable);
- result.append(", specifiedCatalog: ");
- result.append(specifiedCatalog);
- result.append(", defaultCatalog: ");
- result.append(defaultCatalog);
- result.append(", specifiedSchema: ");
- result.append(specifiedSchema);
- result.append(", defaultSchema: ");
- result.append(defaultSchema);
- result.append(", specifiedPkColumnName: ");
- result.append(specifiedPkColumnName);
- result.append(", defaultPkColumnName: ");
- result.append(defaultPkColumnName);
- result.append(", specifiedValueColumnName: ");
- result.append(specifiedValueColumnName);
- result.append(", defaultValueColumnName: ");
- result.append(defaultValueColumnName);
- result.append(", specifiedPkColumnValue: ");
- result.append(specifiedPkColumnValue);
- result.append(", defaultPkColumnValue: ");
- result.append(defaultPkColumnValue);
- result.append(')');
- return result.toString();
- }
-
- public void refreshDefaults(DefaultsContext defaultsContext) {
- setDefaultSchema((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_TABLE_GENERATOR_SCHEMA_KEY));
- }
-
- public IUniqueConstraint createUniqueConstraint(int index) {
- return createXmlJavaUniqueConstraint(index);
- }
-
- protected XmlUniqueConstraint createXmlJavaUniqueConstraint(int index) {
- return OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- }
-
- public Table dbTable() {
- Schema schema = this.dbSchema();
- return (schema == null) ? null : schema.tableNamed(this.getTable());
- }
-
- public Schema dbSchema() {
- return this.database().schemaNamed(this.getSchema());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTransient.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTransient.java
deleted file mode 100644
index f6666d4f2a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTransient.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.mappings.ITransient;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Transient</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTransient()
- * @model kind="class"
- * @generated
- */
-public class XmlTransient extends XmlAttributeMapping implements ITransient
-{
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlTransient() {
- super();
- }
-
- @Override
- protected void initializeOn(XmlAttributeMapping newMapping) {
- newMapping.initializeFromXmlTransientMapping(this);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_TRANSIENT;
- }
-
- @Override
- public int xmlSequence() {
- return 8;
- }
-
- public String getKey() {
- return IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
- }
-} // XmlTransient
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTypeMapping.java
deleted file mode 100644
index 0609f9e76c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTypeMapping.java
+++ /dev/null
@@ -1,674 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm;
-
-import java.util.Iterator;
-import java.util.Set;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.AccessType;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.orm.resource.OrmXmlMapper;
-import org.eclipse.jpt.core.internal.emfutility.DOMUtilities;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
-import org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Xml Persistent Type Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getDefaultAccess <em>Default Access</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getSpecifiedAccess <em>Specified Access</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getAccess <em>Access</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getMetadataComplete <em>Metadata Complete</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getPersistentType <em>Persistent Type</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTypeMapping()
- * @model kind="class" abstract="true"
- * @generated
- */
-public abstract class XmlTypeMapping extends XmlEObject implements ITypeMapping
-{
- /**
- * The default value of the '{@link #getName() <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getName()
- * @generated
- * @ordered
- */
- protected static final String NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getTableName() <em>Table Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTableName()
- * @generated
- * @ordered
- */
- protected static final String TABLE_NAME_EDEFAULT = null;
-
- /**
- * The default value of the '{@link #getDefaultAccess() <em>Default Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultAccess()
- * @generated
- * @ordered
- */
- protected static final AccessType DEFAULT_ACCESS_EDEFAULT = AccessType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getDefaultAccess() <em>Default Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getDefaultAccess()
- * @generated
- * @ordered
- */
- protected AccessType defaultAccess = DEFAULT_ACCESS_EDEFAULT;
-
- /**
- * The default value of the '{@link #getSpecifiedAccess() <em>Specified Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedAccess()
- * @generated
- * @ordered
- */
- protected static final AccessType SPECIFIED_ACCESS_EDEFAULT = AccessType.DEFAULT;
-
- /**
- * The cached value of the '{@link #getSpecifiedAccess() <em>Specified Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getSpecifiedAccess()
- * @generated
- * @ordered
- */
- protected AccessType specifiedAccess = SPECIFIED_ACCESS_EDEFAULT;
-
- /**
- * The default value of the '{@link #getAccess() <em>Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getAccess()
- * @generated
- * @ordered
- */
- protected static final AccessType ACCESS_EDEFAULT = AccessType.DEFAULT;
-
- /**
- * The default value of the '{@link #getMetadataComplete() <em>Metadata Complete</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMetadataComplete()
- * @generated
- * @ordered
- */
- protected static final DefaultFalseBoolean METADATA_COMPLETE_EDEFAULT = DefaultFalseBoolean.DEFAULT;
-
- /**
- * The cached value of the '{@link #getMetadataComplete() <em>Metadata Complete</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getMetadataComplete()
- * @generated
- * @ordered
- */
- protected DefaultFalseBoolean metadataComplete = METADATA_COMPLETE_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getPersistentType() <em>Persistent Type</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPersistentType()
- * @generated
- * @ordered
- */
- protected XmlPersistentType persistentType;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated NOT
- */
- protected XmlTypeMapping() {
- super();
- XmlPersistentType persistentType = createXmlPersistentType();
- setPersistentType(persistentType);
- }
-
- protected XmlPersistentType createXmlPersistentType() {
- return OrmFactory.eINSTANCE.createXmlPersistentType(getKey());
- }
-
- @Override
- protected void addInsignificantFeatureIdsTo(Set<Integer> insignificantFeatureIds) {
- super.addInsignificantFeatureIdsTo(insignificantFeatureIds);
- insignificantFeatureIds.add(OrmPackage.XML_TYPE_MAPPING__PERSISTENT_TYPE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_TYPE_MAPPING;
- }
-
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITypeMapping_Name()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getName() {
- Type type = getPersistentType().findType();
- return (type == null) ? "" : type.getName();
- }
-
- /**
- * Returns the value of the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getITypeMapping_TableName()
- * @model changeable="false" volatile="true" derived="true"
- * @generated NOT
- */
- public String getTableName() {
- return "";
- }
-
- /**
- * Returns the value of the '<em><b>Default Access</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.AccessType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Access</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Access</em>' attribute.
- * @see org.eclipse.jpt.core.internal.AccessType
- * @see #setDefaultAccess(AccessType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTypeMapping_DefaultAccess()
- * @model
- * @generated
- */
- public AccessType getDefaultAccess() {
- return defaultAccess;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getDefaultAccess <em>Default Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Default Access</em>' attribute.
- * @see org.eclipse.jpt.core.internal.AccessType
- * @see #getDefaultAccess()
- * @generated
- */
- public void setDefaultAccess(AccessType newDefaultAccess) {
- AccessType oldDefaultAccess = defaultAccess;
- defaultAccess = newDefaultAccess == null ? DEFAULT_ACCESS_EDEFAULT : newDefaultAccess;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_TYPE_MAPPING__DEFAULT_ACCESS, oldDefaultAccess, defaultAccess));
- }
-
- /**
- * Returns the value of the '<em><b>Specified Access</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.AccessType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Access</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Access</em>' attribute.
- * @see org.eclipse.jpt.core.internal.AccessType
- * @see #setSpecifiedAccess(AccessType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTypeMapping_SpecifiedAccess()
- * @model
- * @generated
- */
- public AccessType getSpecifiedAccess() {
- return specifiedAccess;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getSpecifiedAccess <em>Specified Access</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Access</em>' attribute.
- * @see org.eclipse.jpt.core.internal.AccessType
- * @see #getSpecifiedAccess()
- * @generated
- */
- public void setSpecifiedAccess(AccessType newSpecifiedAccess) {
- AccessType oldSpecifiedAccess = specifiedAccess;
- specifiedAccess = newSpecifiedAccess == null ? SPECIFIED_ACCESS_EDEFAULT : newSpecifiedAccess;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_TYPE_MAPPING__SPECIFIED_ACCESS, oldSpecifiedAccess, specifiedAccess));
- }
-
- /**
- * Returns the value of the '<em><b>Access</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.content.orm.AccessType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Access</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Access</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.orm.AccessType
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTypeMapping_Access()
- * @model transient="true" changeable="false" volatile="true"
- * @generated NOT
- */
- public AccessType getAccess() {
- return (this.getSpecifiedAccess() == null) ? this.getDefaultAccess() : this.getSpecifiedAccess();
- }
-
- public EntityMappings getEntityMappings() {
- return (EntityMappings) eContainer();
- }
-
- /**
- * Returns the value of the '<em><b>Metadata Complete</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the value of the '<em>Metadata Complete</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean
- * @see #setMetadataComplete(DefaultFalseBoolean)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTypeMapping_MetadataComplete()
- * @model
- * @generated
- */
- public DefaultFalseBoolean getMetadataComplete() {
- return metadataComplete;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getMetadataComplete <em>Metadata Complete</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Metadata Complete</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean
- * @see #getMetadataComplete()
- * @generated
- */
- public void setMetadataComplete(DefaultFalseBoolean newMetadataComplete) {
- DefaultFalseBoolean oldMetadataComplete = metadataComplete;
- metadataComplete = newMetadataComplete == null ? METADATA_COMPLETE_EDEFAULT : newMetadataComplete;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_TYPE_MAPPING__METADATA_COMPLETE, oldMetadataComplete, metadataComplete));
- }
-
- public boolean isXmlMetadataComplete() {
- return isPersistenceUnitXmlMetadataComplete() || (getMetadataComplete() == DefaultFalseBoolean.TRUE);
- }
-
- protected boolean isPersistenceUnitXmlMetadataComplete() {
- return ((XmlRootContentNode) getRoot()).entityMappings.getPersistenceUnitMetadata().isXmlMappingMetadataComplete();
- }
-
- /**
- * Returns the value of the '<em><b>Persistent Type</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persistent Type</em>' containment reference.
- * @see #setPersistentType(XmlPersistentType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlTypeMapping_PersistentType()
- * @model containment="true" required="true"
- * @generated
- */
- public XmlPersistentType getPersistentType() {
- return persistentType;
- }
-
- public IPersistentType javaPersistentType() {
- return getPersistentType().findJavaPersistentType();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetPersistentType(XmlPersistentType newPersistentType, NotificationChain msgs) {
- XmlPersistentType oldPersistentType = persistentType;
- persistentType = newPersistentType;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_TYPE_MAPPING__PERSISTENT_TYPE, oldPersistentType, newPersistentType);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping#getPersistentType <em>Persistent Type</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Persistent Type</em>' containment reference.
- * @see #getPersistentType()
- * @generated
- */
- public void setPersistentType(XmlPersistentType newPersistentType) {
- if (newPersistentType != persistentType) {
- NotificationChain msgs = null;
- if (persistentType != null)
- msgs = ((InternalEObject) persistentType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_TYPE_MAPPING__PERSISTENT_TYPE, null, msgs);
- if (newPersistentType != null)
- msgs = ((InternalEObject) newPersistentType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_TYPE_MAPPING__PERSISTENT_TYPE, null, msgs);
- msgs = basicSetPersistentType(newPersistentType, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_TYPE_MAPPING__PERSISTENT_TYPE, newPersistentType, newPersistentType));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Attribute Mappings</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_TYPE_MAPPING__PERSISTENT_TYPE :
- return basicSetPersistentType(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_TYPE_MAPPING__NAME :
- return getName();
- case OrmPackage.XML_TYPE_MAPPING__TABLE_NAME :
- return getTableName();
- case OrmPackage.XML_TYPE_MAPPING__DEFAULT_ACCESS :
- return getDefaultAccess();
- case OrmPackage.XML_TYPE_MAPPING__SPECIFIED_ACCESS :
- return getSpecifiedAccess();
- case OrmPackage.XML_TYPE_MAPPING__ACCESS :
- return getAccess();
- case OrmPackage.XML_TYPE_MAPPING__METADATA_COMPLETE :
- return getMetadataComplete();
- case OrmPackage.XML_TYPE_MAPPING__PERSISTENT_TYPE :
- return getPersistentType();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_TYPE_MAPPING__DEFAULT_ACCESS :
- setDefaultAccess((AccessType) newValue);
- return;
- case OrmPackage.XML_TYPE_MAPPING__SPECIFIED_ACCESS :
- setSpecifiedAccess((AccessType) newValue);
- return;
- case OrmPackage.XML_TYPE_MAPPING__METADATA_COMPLETE :
- setMetadataComplete((DefaultFalseBoolean) newValue);
- return;
- case OrmPackage.XML_TYPE_MAPPING__PERSISTENT_TYPE :
- setPersistentType((XmlPersistentType) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_TYPE_MAPPING__DEFAULT_ACCESS :
- setDefaultAccess(DEFAULT_ACCESS_EDEFAULT);
- return;
- case OrmPackage.XML_TYPE_MAPPING__SPECIFIED_ACCESS :
- setSpecifiedAccess(SPECIFIED_ACCESS_EDEFAULT);
- return;
- case OrmPackage.XML_TYPE_MAPPING__METADATA_COMPLETE :
- setMetadataComplete(METADATA_COMPLETE_EDEFAULT);
- return;
- case OrmPackage.XML_TYPE_MAPPING__PERSISTENT_TYPE :
- setPersistentType((XmlPersistentType) null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_TYPE_MAPPING__NAME :
- return NAME_EDEFAULT == null ? getName() != null : !NAME_EDEFAULT.equals(getName());
- case OrmPackage.XML_TYPE_MAPPING__TABLE_NAME :
- return TABLE_NAME_EDEFAULT == null ? getTableName() != null : !TABLE_NAME_EDEFAULT.equals(getTableName());
- case OrmPackage.XML_TYPE_MAPPING__DEFAULT_ACCESS :
- return defaultAccess != DEFAULT_ACCESS_EDEFAULT;
- case OrmPackage.XML_TYPE_MAPPING__SPECIFIED_ACCESS :
- return specifiedAccess != SPECIFIED_ACCESS_EDEFAULT;
- case OrmPackage.XML_TYPE_MAPPING__ACCESS :
- return getAccess() != ACCESS_EDEFAULT;
- case OrmPackage.XML_TYPE_MAPPING__METADATA_COMPLETE :
- return metadataComplete != METADATA_COMPLETE_EDEFAULT;
- case OrmPackage.XML_TYPE_MAPPING__PERSISTENT_TYPE :
- return persistentType != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == ITypeMapping.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_TYPE_MAPPING__NAME :
- return JpaCorePackage.ITYPE_MAPPING__NAME;
- case OrmPackage.XML_TYPE_MAPPING__TABLE_NAME :
- return JpaCorePackage.ITYPE_MAPPING__TABLE_NAME;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == ITypeMapping.class) {
- switch (baseFeatureID) {
- case JpaCorePackage.ITYPE_MAPPING__NAME :
- return OrmPackage.XML_TYPE_MAPPING__NAME;
- case JpaCorePackage.ITYPE_MAPPING__TABLE_NAME :
- return OrmPackage.XML_TYPE_MAPPING__TABLE_NAME;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (defaultAccess: ");
- result.append(defaultAccess);
- result.append(", specifiedAccess: ");
- result.append(specifiedAccess);
- result.append(", metadataComplete: ");
- result.append(metadataComplete);
- result.append(')');
- return result.toString();
- }
-
- /**
- * ITypeMapping is changed and various ITypeMappings may have
- * common settings. In this method initialize the new ITypeMapping (this)
- * fromthe old ITypeMapping (oldMapping)
- * @param oldMapping
- */
- public void initializeFrom(XmlTypeMapping oldMapping) {}
-
- public IJpaContentNode getContentNode(int offset) {
- return getPersistentType().getContentNode(offset);
- }
-
- public Table primaryDbTable() {
- return null;
- }
-
- public Table dbTable(String tableName) {
- return null;
- }
-
- public Schema dbSchema() {
- return null;
- }
-
- public void refreshDefaults(DefaultsContext defaultsContext) {}
-
- public ITextRange classTextRange() {
- IDOMNode classNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.CLASS);
- if (classNode != null) {
- return buildTextRange(classNode);
- }
- return validationTextRange();
- }
-
- public ITextRange attributesTextRange() {
- IDOMNode attributesNode = (IDOMNode) DOMUtilities.getNodeChild(node, OrmXmlMapper.ATTRIBUTES);
- if (attributesNode != null) {
- return buildTextRange(attributesNode);
- }
- return validationTextRange();
- }
-
- /**
- * type mappings are a sequence in the orm schema. We must keep
- * the list of type mappings in the appropriate order so the wtp xml
- * translators will write them to the xml in that order and they
- * will adhere to the schema.
- *
- * Each concrete subclass of XmlTypeMapping must implement this
- * method and return an int that matches it's order in the schema
- * @return
- */
- public abstract int xmlSequence();
-
- /**
- * @see ITypeMapping#attributeMappingKeyAllowed(String)
- *
- * Default implementation: override where needed
- */
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- return true;
- }
-
- public Iterator<String> overridableAssociationNames() {
- return EmptyIterator.instance();
- }
-
- public Iterator<String> overridableAttributeNames() {
- return EmptyIterator.instance();
- }
-
- public Iterator<String> allOverridableAssociationNames() {
- return EmptyIterator.instance();
- }
-
- public Iterator<String> allOverridableAttributeNames() {
- return EmptyIterator.instance();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlUniqueConstraint.java
deleted file mode 100644
index 7d45ae1e30..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlUniqueConstraint.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import java.util.Collection;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.util.EDataTypeEList;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Unique Constraint</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlUniqueConstraint()
- * @model kind="class"
- * @generated
- */
-public class XmlUniqueConstraint extends XmlEObject
- implements IUniqueConstraint
-{
- /**
- * The cached value of the '{@link #getColumnNames() <em>Column Names</em>}' attribute list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getColumnNames()
- * @generated
- * @ordered
- */
- protected EList<String> columnNames;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XmlUniqueConstraint() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_UNIQUE_CONSTRAINT;
- }
-
- /**
- * Returns the value of the '<em><b>Column Names</b></em>' attribute list.
- * The list contents are of type {@link java.lang.String}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column Names</em>' attribute list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column Names</em>' attribute list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIUniqueConstraint_ColumnNames()
- * @model unique="false"
- * @generated
- */
- public EList<String> getColumnNames() {
- if (columnNames == null) {
- columnNames = new EDataTypeEList<String>(String.class, this, OrmPackage.XML_UNIQUE_CONSTRAINT__COLUMN_NAMES);
- }
- return columnNames;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_UNIQUE_CONSTRAINT__COLUMN_NAMES :
- return getColumnNames();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_UNIQUE_CONSTRAINT__COLUMN_NAMES :
- getColumnNames().clear();
- getColumnNames().addAll((Collection<? extends String>) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_UNIQUE_CONSTRAINT__COLUMN_NAMES :
- getColumnNames().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_UNIQUE_CONSTRAINT__COLUMN_NAMES :
- return columnNames != null && !columnNames.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IUniqueConstraint.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_UNIQUE_CONSTRAINT__COLUMN_NAMES :
- return JpaCoreMappingsPackage.IUNIQUE_CONSTRAINT__COLUMN_NAMES;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IUniqueConstraint.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IUNIQUE_CONSTRAINT__COLUMN_NAMES :
- return OrmPackage.XML_UNIQUE_CONSTRAINT__COLUMN_NAMES;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (columnNames: ");
- result.append(columnNames);
- result.append(')');
- return result.toString();
- }
-} // XmlUniqueConstraint
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlVersion.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlVersion.java
deleted file mode 100644
index b1613b0de2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlVersion.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-import org.eclipse.jpt.core.internal.mappings.IVersion;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.TemporalType;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Version</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlVersion()
- * @model kind="class"
- * @generated
- */
-public class XmlVersion extends XmlAttributeMapping
- implements IVersion, IXmlColumnMapping
-{
- /**
- * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getColumn()
- * @generated
- * @ordered
- */
- protected IColumn column;
-
- /**
- * The default value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTemporal()
- * @generated
- * @ordered
- */
- protected static final TemporalType TEMPORAL_EDEFAULT = TemporalType.NULL;
-
- /**
- * The cached value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTemporal()
- * @generated
- * @ordered
- */
- protected TemporalType temporal = TEMPORAL_EDEFAULT;
-
- protected XmlVersion() {
- super();
- this.column = OrmFactory.eINSTANCE.createXmlColumn(buildOwner());
- ((InternalEObject) this.column).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.XML_ID__COLUMN, null, null);
- }
-
- @Override
- protected void initializeOn(XmlAttributeMapping newMapping) {
- newMapping.initializeFromXmlVersionMapping(this);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_VERSION;
- }
-
- /**
- * Returns the value of the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIVersion_Column()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- public IColumn getColumn() {
- return column;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetColumn(IColumn newColumn, NotificationChain msgs) {
- IColumn oldColumn = column;
- column = newColumn;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.XML_VERSION__COLUMN, oldColumn, newColumn);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Returns the value of the '<em><b>Temporal</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.TemporalType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Temporal</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @see #setTemporal(TemporalType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIVersion_Temporal()
- * @model
- * @generated
- */
- public TemporalType getTemporal() {
- return temporal;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlVersion#getTemporal <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @see #getTemporal()
- * @generated
- */
- public void setTemporal(TemporalType newTemporal) {
- TemporalType oldTemporal = temporal;
- temporal = newTemporal == null ? TEMPORAL_EDEFAULT : newTemporal;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_VERSION__TEMPORAL, oldTemporal, temporal));
- }
-
- /**
- * Returns the value of the '<em><b>Column For Xml</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column For Xml</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column For Xml</em>' reference.
- * @see #setColumnForXml(XmlColumn)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIXmlColumnMapping_ColumnForXml()
- * @model resolveProxies="false" volatile="true"
- * @generated NOT
- */
- public XmlColumn getColumnForXml() {
- if (((XmlColumn) getColumn()).isAllFeaturesUnset()) {
- return null;
- }
- return (XmlColumn) getColumn();
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlVersion#getColumnForXml <em>Column For Xml</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Column For Xml</em>' reference.
- * @see #getColumnForXml()
- * @generated NOT
- */
- public void setColumnForXmlGen(XmlColumn newColumnForXml) {
- XmlColumn oldValue = newColumnForXml == null ? (XmlColumn) getColumn() : null;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_VERSION__COLUMN_FOR_XML, oldValue, newColumnForXml));
- }
-
- public void setColumnForXml(XmlColumn newColumnForXml) {
- setColumnForXmlGen(newColumnForXml);
- if (newColumnForXml == null) {
- ((XmlColumn) getColumn()).unsetAllAttributes();
- }
- }
-
- public void makeColumnForXmlNonNull() {
- setColumnForXmlGen(getColumnForXml());
- }
-
- public void makeColumnForXmlNull() {
- setColumnForXmlGen(null);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.XML_VERSION__COLUMN :
- return basicSetColumn(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_VERSION__COLUMN :
- return getColumn();
- case OrmPackage.XML_VERSION__TEMPORAL :
- return getTemporal();
- case OrmPackage.XML_VERSION__COLUMN_FOR_XML :
- return getColumnForXml();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_VERSION__TEMPORAL :
- setTemporal((TemporalType) newValue);
- return;
- case OrmPackage.XML_VERSION__COLUMN_FOR_XML :
- setColumnForXml((XmlColumn) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_VERSION__TEMPORAL :
- setTemporal(TEMPORAL_EDEFAULT);
- return;
- case OrmPackage.XML_VERSION__COLUMN_FOR_XML :
- setColumnForXml((XmlColumn) null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_VERSION__COLUMN :
- return column != null;
- case OrmPackage.XML_VERSION__TEMPORAL :
- return temporal != TEMPORAL_EDEFAULT;
- case OrmPackage.XML_VERSION__COLUMN_FOR_XML :
- return getColumnForXml() != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IColumnMapping.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IVersion.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_VERSION__COLUMN :
- return JpaCoreMappingsPackage.IVERSION__COLUMN;
- case OrmPackage.XML_VERSION__TEMPORAL :
- return JpaCoreMappingsPackage.IVERSION__TEMPORAL;
- default :
- return -1;
- }
- }
- if (baseClass == IXmlColumnMapping.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_VERSION__COLUMN_FOR_XML :
- return OrmPackage.IXML_COLUMN_MAPPING__COLUMN_FOR_XML;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IColumnMapping.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IVersion.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IVERSION__COLUMN :
- return OrmPackage.XML_VERSION__COLUMN;
- case JpaCoreMappingsPackage.IVERSION__TEMPORAL :
- return OrmPackage.XML_VERSION__TEMPORAL;
- default :
- return -1;
- }
- }
- if (baseClass == IXmlColumnMapping.class) {
- switch (baseFeatureID) {
- case OrmPackage.IXML_COLUMN_MAPPING__COLUMN_FOR_XML :
- return OrmPackage.XML_VERSION__COLUMN_FOR_XML;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (temporal: ");
- result.append(temporal);
- result.append(')');
- return result.toString();
- }
-
- @Override
- public int xmlSequence() {
- return 2;
- }
-
- public String getKey() {
- return IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
- }
-} // XmlVersion
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AbstractColumnTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AbstractColumnTranslator.java
deleted file mode 100644
index a10227f091..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AbstractColumnTranslator.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public abstract class AbstractColumnTranslator extends Translator
- implements OrmXmlMapper
-{
- private Translator[] children;
-
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
- protected static final OrmFactory JPA_CORE_XML_FACTORY =
- OrmFactory.eINSTANCE;
- protected static final JpaCoreMappingsPackage MAPPINGS_PKG =
- JpaCoreMappingsPackage.eINSTANCE;
-
- public AbstractColumnTranslator(String domNameAndPath, EStructuralFeature aFeature) {
- super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
- }
-
- public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
- }
- return children;
- }
-
-
- protected abstract Translator[] createChildren();
-
- protected Translator createNameTranslator() {
- return new Translator(COLUMN__NAME, JPA_CORE_XML_PKG.getAbstractXmlNamedColumn_SpecifiedNameForXml(), DOM_ATTRIBUTE);
- }
-
- protected Translator createTableTranslator() {
- return new Translator(COLUMN__TABLE, JPA_CORE_XML_PKG.getAbstractXmlColumn_SpecifiedTableForXml(), DOM_ATTRIBUTE);
- }
-
- protected Translator createUniqueTranslator() {
- return new BooleanEnumeratorTranslator(COLUMN__UNIQUE, JPA_CORE_XML_PKG.getAbstractXmlColumn_UniqueForXml(), DOM_ATTRIBUTE);
- }
-
- protected Translator createNullableTranslator() {
- return new BooleanEnumeratorTranslator(COLUMN__NULLABLE, JPA_CORE_XML_PKG.getAbstractXmlColumn_NullableForXml(), DOM_ATTRIBUTE);
- }
-
- protected Translator createInsertableTranslator() {
- return new BooleanEnumeratorTranslator(COLUMN__INSERTABLE, JPA_CORE_XML_PKG.getAbstractXmlColumn_InsertableForXml(), DOM_ATTRIBUTE);
- }
-
- protected Translator createUpdatableTranslator() {
- return new BooleanEnumeratorTranslator(COLUMN__UPDATABLE, JPA_CORE_XML_PKG.getAbstractXmlColumn_UpdatableForXml(), DOM_ATTRIBUTE);
- }
-
- protected Translator createColumnDefinitionTranslator() {
- return new Translator(COLUMN__COLUMN_DEFINITION, JPA_CORE_XML_PKG.getAbstractXmlNamedColumn_ColumnDefinitionForXml(), DOM_ATTRIBUTE);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AbstractTableTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AbstractTableTranslator.java
deleted file mode 100644
index 8ce566892b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AbstractTableTranslator.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public abstract class AbstractTableTranslator extends Translator
- implements OrmXmlMapper
-{
- private Translator[] children;
-
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
- protected static final OrmFactory JPA_CORE_XML_FACTORY =
- OrmFactory.eINSTANCE;
- protected static final JpaCoreMappingsPackage MAPPINGS_PKG =
- JpaCoreMappingsPackage.eINSTANCE;
-
- public AbstractTableTranslator(String domNameAndPath, EStructuralFeature aFeature) {
- super(domNameAndPath,aFeature);
- }
-
- public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
- }
- return children;
- }
-
-
- protected abstract Translator[] createChildren();
-
- protected Translator createNameTranslator() {
- return new Translator(NAME, JPA_CORE_XML_PKG.getAbstractXmlTable_SpecifiedNameForXml(), DOM_ATTRIBUTE);
- }
-
- protected Translator createCatalogTranslator() {
- return new Translator(CATALOG, JPA_CORE_XML_PKG.getAbstractXmlTable_SpecifiedCatalogForXml(), DOM_ATTRIBUTE);
- }
-
- protected Translator createSchemaTranslator() {
- return new Translator(SCHEMA, JPA_CORE_XML_PKG.getAbstractXmlTable_SpecifiedSchemaForXml(), DOM_ATTRIBUTE);
- }
-
- protected Translator createUniqueConstraintTranslator() {
- return new UniqueConstraintTranslator();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AccessTypeElementTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AccessTypeElementTranslator.java
deleted file mode 100644
index 8444938762..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AccessTypeElementTranslator.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.AccessType;
-
-/**
- * There is a bug in the translator framework that causes
- * enumerators in xml elements and enumerators in xml attributes
- * to be treated differently. When the enumerator is an attribute
- * setting the model to the default causes the attribute to be removed.
- * With an element is causes the default literal to be placed in
- * the tag.
- *
- * The problem is wrapped up in the emf unsettable attribute as well.
- * For attributes the eIsSet method returns false for the default value
- * For elements the eIsSet method returns true for the default value.
- * I don't want to have to use the unsettable option in emf since that would
- * require that I call different api. I am not sure yet what the bug is in
- * the translator, so I have entered one ~KFM
- */
-public class AccessTypeElementTranslator extends EnumeratorTranslator
-{
-
- public AccessTypeElementTranslator(String domNameAndPath, EStructuralFeature aFeature, int style) {
- super(domNameAndPath, aFeature, style);
- }
-
- @Override
- public Object getMOFValue(EObject mofObject) {
- AccessType access = (AccessType) super.getMOFValue(mofObject);
- if (access == AccessType.DEFAULT) {
- return null;
- }
- return access;
- }
-
- @Override
- public List getMOFChildren(EObject mofObject) {
- List result = super.getMOFChildren(mofObject);
- if(result != null && result.size() > 0) {
- AccessType accessType = (AccessType) result.get(0);
- if(accessType.getValue() == AccessType.DEFAULT_VALUE)
- result = Collections.EMPTY_LIST;
- }
- return result;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AssociationOverrideTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AssociationOverrideTranslator.java
deleted file mode 100644
index faba3fa29e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AssociationOverrideTranslator.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.resource.JoinColumnTranslator.JoinColumnBuilder;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride.JoinColumnOwner;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class AssociationOverrideTranslator extends Translator implements OrmXmlMapper
-{
- private AssociationOverrideBuilder associationOverrideBuilder;
-
- private IAssociationOverride associationOverride;
-
- protected static final JpaCoreMappingsPackage MAPPINGS_PKG =
- JpaCoreMappingsPackage.eINSTANCE;
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
-
-
- private Translator[] children;
- private JoinColumnTranslator joinColumnsTranslator;
-
- public AssociationOverrideTranslator(String domNameAndPath, EStructuralFeature aFeature, AssociationOverrideBuilder associationOverrideBuilder) {
- super(domNameAndPath, aFeature);
- this.associationOverrideBuilder = associationOverrideBuilder;
- this.joinColumnsTranslator = createJoinColumnsTranslator();
- }
-
- protected JoinColumnTranslator createJoinColumnsTranslator() {
- return new JoinColumnTranslator(
- JOIN_COLUMN,
- JpaCoreMappingsPackage.eINSTANCE.getIAssociationOverride_SpecifiedJoinColumns(),
- buildJoinColumnsBuilder());
- }
-
- private JoinColumnBuilder buildJoinColumnsBuilder() {
- return new JoinColumnBuilder() {
- public IJoinColumn createJoinColumn() {
- return OrmFactory.eINSTANCE.createXmlJoinColumn(new JoinColumnOwner(associationOverride));
- }
- };
- }
-
- public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
- }
- return children;
- }
-
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- joinColumnsTranslator,
- };
- }
- protected Translator createNameTranslator() {
- return new Translator(ATTRIBUTE_OVERRIDE_NAME, MAPPINGS_PKG.getIOverride_Name(), DOM_ATTRIBUTE);
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- this.associationOverride = this.associationOverrideBuilder.createAssociationOverride();
- return this.associationOverride;
- }
-
- public interface AssociationOverrideBuilder {
- IAssociationOverride createAssociationOverride();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AssociationOverridesTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AssociationOverridesTranslator.java
deleted file mode 100644
index f44c0e38b3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AssociationOverridesTranslator.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.resource.AssociationOverrideTranslator.AssociationOverrideBuilder;
-import org.eclipse.wst.common.internal.emf.resource.MultiObjectTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-/**
- * Created this class so there would be a 1-1 association between
- * AssociationOverride and AssociationOverrideTranslator. Without this the state
- * stored on AssociationOverrideTranslator will be invalid for multiple AssociationOverrides.
- * see bug 188901.
- *
- * TODO 189767 - memory leak if an associationOverride is removed from the model, it is still
- * stored along with its translator in the translator map
- */
-public class AssociationOverridesTranslator extends MultiObjectTranslator implements OrmXmlMapper
-{
- private AssociationOverrideBuilder associationOverrideBuilder;
-
- private Map<EObject, AssociationOverrideTranslator> translatorMap;
-
- public AssociationOverridesTranslator(String domNameAndPath, EStructuralFeature aFeature, AssociationOverrideBuilder associationOverrideBuilder) {
- super(domNameAndPath, aFeature);
- this.associationOverrideBuilder = associationOverrideBuilder;
- this.translatorMap = new HashMap<EObject, AssociationOverrideTranslator>();
- }
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- AssociationOverrideTranslator translator = (AssociationOverrideTranslator) getDelegateFor(nodeName, readAheadName);
- EObject eObject = translator.createEMFObject(nodeName, readAheadName);
- this.translatorMap.put(eObject, translator);
- return eObject;
- }
-
- /* (non-Javadoc)
- * @see MultiObjectTranslator#getDelegateFor(EObject)
- */
- @Override
- public Translator getDelegateFor(EObject o) {
- Translator translator = translatorMap.get(o);
- if (translator != null) {
- return translator;
- }
-
- switch (o.eClass().getClassifierID()) {
- case OrmPackage.XML_ASSOCIATION_OVERRIDE :
- return new AssociationOverrideTranslator(this.domNameAndPath, getFeature(), this.associationOverrideBuilder);
- }
-
- return null;
- }
-
- @Override
- public Translator getDelegateFor(String domName, String readAheadName) {
- if (domName.equals(ENTITY__ASSOCIATION_OVERRIDE)) {
- return new AssociationOverrideTranslator(this.domNameAndPath, getFeature(), this.associationOverrideBuilder);
- }
- throw new IllegalStateException("Illegal dom name: " + domName); //$NON-NLS-1$
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeMappingTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeMappingTranslator.java
deleted file mode 100644
index 39dab93292..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeMappingTranslator.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public abstract class AttributeMappingTranslator extends Translator
- implements OrmXmlMapper
-{
- protected static final JpaCoreMappingsPackage MAPPINGS_PKG =
- JpaCoreMappingsPackage.eINSTANCE;
-
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
- protected static final OrmFactory JPA_CORE_XML_FACTORY =
- OrmFactory.eINSTANCE;
-
-
- private Translator[] children;
-
-
- public AttributeMappingTranslator(String domNameAndPath, int style) {
- super(domNameAndPath, JPA_CORE_XML_PKG.getXmlPersistentType_SpecifiedAttributeMappings(), style);
- dependencyFeature = JPA_CORE_XML_PKG.getXmlAttributeMapping_PersistentAttribute();
- }
-
-
- public Translator[] getChildren(Object target, int versionID) {
- if (this.children == null) {
- this.children = createChildren();
- }
- return this.children;
- }
-
- protected abstract Translator[] createChildren();
-
-
- protected Translator createNameTranslator() {
- return new AttributeNameTranslator();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeMappingsTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeMappingsTranslator.java
deleted file mode 100644
index 61dd65086b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeMappingsTranslator.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class AttributeMappingsTranslator extends MultiObjectDependencyTranslator
- implements OrmXmlMapper
-{
- public static final String ATTRIBUTES_PATH =
- ATTRIBUTES + '/' + ID + ',' + EMBEDDED_ID + ','+ BASIC + ',' + VERSION +',' + MANY_TO_ONE + "," + ONE_TO_MANY + ',' + ONE_TO_ONE + ',' + MANY_TO_MANY + ',' + EMBEDDED+ ',' + TRANSIENT;
-
- private static final OrmPackage JPA_CORE_XML_PKG = OrmPackage.eINSTANCE;
-
- public AttributeMappingsTranslator() {
- super(ATTRIBUTES_PATH, JPA_CORE_XML_PKG.getXmlPersistentType_SpecifiedAttributeMappings(), JPA_CORE_XML_PKG.getXmlTypeMapping_PersistentType());
- }
-
- //TODO we're not putting the translator in the translator map in this situation
- public Translator getDelegateFor(EObject o) {
- Translator translator = super.getDelegateFor(o);
-
- if (translator != null) {
- return translator;
- }
-
- switch (o.eClass().getClassifierID()) {
- case OrmPackage.XML_ID :
- translator = new IdTranslator();
- ((IdTranslator) translator).setId(((IId) o));
- break;
- case OrmPackage.XML_BASIC :
- translator = new BasicTranslator();
- ((BasicTranslator) translator).setBasic(((IBasic) o));
- break;
- case OrmPackage.XML_ONE_TO_MANY :
- translator = new OneToManyTranslator();
- ((OneToManyTranslator) translator).setMapping((IMultiRelationshipMapping) o);
- break;
- case OrmPackage.XML_MANY_TO_MANY :
- translator = new ManyToManyTranslator();
- ((ManyToManyTranslator) translator).setMapping((IMultiRelationshipMapping) o);
- break;
- case OrmPackage.XML_MANY_TO_ONE :
- translator = new ManyToOneTranslator();
- break;
- case OrmPackage.XML_TRANSIENT :
- translator = new TransientTranslator();
- break;
- case OrmPackage.XML_EMBEDDED :
- translator = new EmbeddedTranslator();
- ((EmbeddedTranslator) translator).setEmbedded((IEmbedded) o);
- break;
- case OrmPackage.XML_EMBEDDED_ID :
- translator = new EmbeddedIdTranslator();
- break;
- case OrmPackage.XML_ONE_TO_ONE :
- translator = new OneToOneTranslator();
- break;
- case OrmPackage.XML_VERSION :
- translator = new VersionTranslator();
- break;
- }
-
- setDelegateFor(o, translator);
- return translator;
- }
-
-
- @Override
- public Translator getDelegateFor(String domName, String readAheadName) {
- if (domName.equals(ID)) {
- return new IdTranslator();
- }
- if (domName.equals(BASIC)) {
- return new BasicTranslator();
- }
- if (domName.equals(MANY_TO_ONE)) {
- return new ManyToOneTranslator();
- }
- if (domName.equals(ONE_TO_MANY)) {
- return new OneToManyTranslator();
- }
- if (domName.equals(MANY_TO_MANY)) {
- return new ManyToManyTranslator();
- }
- if (domName.equals(TRANSIENT)) {
- return new TransientTranslator();
- }
- if (domName.equals(EMBEDDED)) {
- return new EmbeddedTranslator();
- }
- if (domName.equals(EMBEDDED_ID)) {
- return new EmbeddedIdTranslator();
- }
- if (domName.equals(ONE_TO_ONE)) {
- return new OneToOneTranslator();
- }
- if (domName.equals(VERSION)) {
- return new VersionTranslator();
- }
- throw new IllegalStateException("Illegal dom name: " + domName); //$NON-NLS-1$
- }
-
- @Override
- public boolean isDependencyParent() {
- return true;
- }
-
- @Override
- public EStructuralFeature getDependencyFeature() {
- return JPA_CORE_XML_PKG.getXmlAttributeMapping_PersistentAttribute();
- }
-
- @Override
- public EObject basicGetDependencyObject(EObject parent) {
- Translator delegate = getDelegateFor(parent);
-
- if (delegate != null) {
- return delegate.basicGetDependencyObject(parent);
- }
- return super.basicGetDependencyObject(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeNameTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeNameTranslator.java
deleted file mode 100644
index 2278da6527..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeNameTranslator.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.wst.common.internal.emf.resource.DependencyTranslator;
-
-public class AttributeNameTranslator extends DependencyTranslator
- implements OrmXmlMapper
-{
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
-
-
- public AttributeNameTranslator() {
- super(NAME, JPA_CORE_XML_PKG.getXmlPersistentAttribute_Name(),
- JPA_CORE_XML_PKG.getXmlAttributeMapping_PersistentAttribute());
- fStyle = DOM_ATTRIBUTE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeOverrideTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeOverrideTranslator.java
deleted file mode 100644
index 824b14e04d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeOverrideTranslator.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class AttributeOverrideTranslator extends Translator implements OrmXmlMapper
-{
- private AttributeOverrideBuilder attributeOverrideBuilder;
-
- protected static final JpaCoreMappingsPackage MAPPINGS_PKG =
- JpaCoreMappingsPackage.eINSTANCE;
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
-
-
- private Translator[] children;
- private ColumnTranslator columnTranslator;
-
- public AttributeOverrideTranslator(String domNameAndPath, EStructuralFeature aFeature, AttributeOverrideBuilder attributeOverrideBuilder) {
- super(domNameAndPath, aFeature);
- this.attributeOverrideBuilder = attributeOverrideBuilder;
- this.columnTranslator = createColumnTranslator();
- }
-
- private ColumnTranslator createColumnTranslator() {
- return new ColumnTranslator(ATTRIBUTE_OVERRIDE_COLUMN, JPA_CORE_XML_PKG.getIXmlColumnMapping_ColumnForXml());
- }
-
- public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
- }
- return children;
- }
-
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- columnTranslator,
- };
- }
- protected Translator createNameTranslator() {
- return new Translator(ATTRIBUTE_OVERRIDE_NAME, MAPPINGS_PKG.getIOverride_Name(), DOM_ATTRIBUTE);
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- IAttributeOverride attributeOverride = this.attributeOverrideBuilder.createAttributeOverride();
- this.columnTranslator.setColumnMapping(attributeOverride);
- return attributeOverride;
- }
-
- public interface AttributeOverrideBuilder {
- IAttributeOverride createAttributeOverride();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeOverridesTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeOverridesTranslator.java
deleted file mode 100644
index 9762ecbd0e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/AttributeOverridesTranslator.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.resource.AttributeOverrideTranslator.AttributeOverrideBuilder;
-import org.eclipse.wst.common.internal.emf.resource.MultiObjectTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-/**
- * Created this class so there would be a 1-1 association between
- * AttributeOverride and AttributeOverrideTranslator. Without this the state
- * stored on AttributeOverrideTranslator will be invalid for multiple AttributeOverrides.
- * see bug 188901.
- *
- * TODO 189767 - memory leak if an associationOverride is removed from the model, it is still
- * stored along with its translator in the translator map
- */
-public class AttributeOverridesTranslator extends MultiObjectTranslator implements OrmXmlMapper
-{
- private AttributeOverrideBuilder attributeOverrideBuilder;
-
- private Map<EObject, AttributeOverrideTranslator> translatorMap;
-
- public AttributeOverridesTranslator(String domNameAndPath, EStructuralFeature aFeature, AttributeOverrideBuilder attributeOverrideBuilder) {
- super(domNameAndPath, aFeature);
- this.attributeOverrideBuilder = attributeOverrideBuilder;
- this.translatorMap = new HashMap<EObject, AttributeOverrideTranslator>();
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- AttributeOverrideTranslator translator = (AttributeOverrideTranslator) getDelegateFor(nodeName, readAheadName);
- EObject eObject = translator.createEMFObject(nodeName, readAheadName);
- this.translatorMap.put(eObject, translator);
- return eObject;
- }
-
- /* (non-Javadoc)
- * @see MultiObjectTranslator#getDelegateFor(EObject)
- */
- @Override
- public Translator getDelegateFor(EObject o) {
- Translator translator = translatorMap.get(o);
- if (translator != null) {
- return translator;
- }
-
- switch (o.eClass().getClassifierID()) {
- case OrmPackage.XML_ATTRIBUTE_OVERRIDE :
- return new AttributeOverrideTranslator(this.domNameAndPath, getFeature(), this.attributeOverrideBuilder);
- }
-
- return null;
- }
-
- @Override
- public Translator getDelegateFor(String domName, String readAheadName) {
- if (domName.equals(ENTITY__ATTRIBUTE_OVERRIDE)) {
- return new AttributeOverrideTranslator(this.domNameAndPath, getFeature(), this.attributeOverrideBuilder);
- }
- throw new IllegalStateException("Illegal dom name: " + domName); //$NON-NLS-1$
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/BasicTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/BasicTranslator.java
deleted file mode 100644
index 2d36121c62..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/BasicTranslator.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class BasicTranslator extends AttributeMappingTranslator
-{
- private ColumnTranslator columnTranslator;
-
-
- public BasicTranslator() {
- super(BASIC, NO_STYLE);
- this.columnTranslator = createColumnTranslator();
- }
-
- private ColumnTranslator createColumnTranslator() {
- return new ColumnTranslator(COLUMN, JPA_CORE_XML_PKG.getIXmlColumnMapping_ColumnForXml());
- }
-
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- IBasic xmlBasic = JPA_CORE_XML_FACTORY.createXmlBasic();
- this.setBasic(xmlBasic);
- return xmlBasic;
- }
-
- protected void setBasic(IBasic basic) {
- this.columnTranslator.setColumnMapping(basic);
- }
-
- @Override
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- createFetchTypeTranslator(),
- createOptionalTranslator(),
- columnTranslator,
- createLobTranslator(),
- createTemporalTranslator(),
- createEnumeratedTranslator(),
- };
- }
-
- private Translator createFetchTypeTranslator() {
- return new EnumeratorTranslator(FETCH, JpaCoreMappingsPackage.eINSTANCE.getIBasic_Fetch(), DOM_ATTRIBUTE);
- }
-
- private Translator createOptionalTranslator() {
- return new BooleanEnumeratorTranslator(OPTIONAL, JpaCoreMappingsPackage.eINSTANCE.getIBasic_Optional(), DOM_ATTRIBUTE);
- }
-
- private Translator createLobTranslator() {
- return new EmptyTagBooleanTranslator(LOB, JpaCoreMappingsPackage.eINSTANCE.getIBasic_Lob());
- }
-
- private Translator createTemporalTranslator() {
- return new TemporalTypeElementTranslator(TEMPORAL, JpaCoreMappingsPackage.eINSTANCE.getIBasic_Temporal(), NO_STYLE);
- }
-
- private Translator createEnumeratedTranslator() {
- return new EnumeratedTypeElementTranslator(BASIC__ENUMERATED, JpaCoreMappingsPackage.eINSTANCE.getIBasic_Enumerated(), NO_STYLE);
- }
-
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/BooleanEnumeratorTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/BooleanEnumeratorTranslator.java
deleted file mode 100644
index 7235dbef0f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/BooleanEnumeratorTranslator.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-public class BooleanEnumeratorTranslator extends EnumeratorTranslator
-{
- public BooleanEnumeratorTranslator(String domNameAndPath, EStructuralFeature aFeature) {
- super(domNameAndPath, aFeature, BOOLEAN_FEATURE | BOOLEAN_LOWERCASE);
- }
-
- public BooleanEnumeratorTranslator(String domNameAndPath, EStructuralFeature aFeature, int style) {
- super(domNameAndPath, aFeature, BOOLEAN_FEATURE | BOOLEAN_LOWERCASE | style);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/CascadeTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/CascadeTranslator.java
deleted file mode 100644
index 3312b47e51..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/CascadeTranslator.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class CascadeTranslator extends Translator implements OrmXmlMapper
-{
- protected static final JpaCoreMappingsPackage MAPPINGS_PKG =
- JpaCoreMappingsPackage.eINSTANCE;
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
-
-
- private Translator[] children;
-
- public CascadeTranslator(String domNameAndPath, EStructuralFeature aFeature) {
- super(domNameAndPath, aFeature);
- }
-
- public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
- }
- return children;
- }
-
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createCascadeAllTranslator(),
- createCascadePersistTranslator(),
- createCascadeMergeTranslator(),
- createCascadeRemoveTranslator(),
- createCascadeRefreshTranslator(),
- };
- }
-
- protected Translator createCascadeAllTranslator() {
- return new EmptyTagBooleanTranslator(CASCADE__CASCADE_ALL, MAPPINGS_PKG.getICascade_All());
- }
-
- protected Translator createCascadePersistTranslator() {
- return new EmptyTagBooleanTranslator(CASCADE__CASCADE_PERSIST, MAPPINGS_PKG.getICascade_Persist());
- }
-
- protected Translator createCascadeMergeTranslator() {
- return new EmptyTagBooleanTranslator(CASCADE__CASCADE_MERGE, MAPPINGS_PKG.getICascade_Merge());
- }
-
- protected Translator createCascadeRemoveTranslator() {
- return new EmptyTagBooleanTranslator(CASCADE__CASCADE_REMOVE, MAPPINGS_PKG.getICascade_Remove());
- }
-
- protected Translator createCascadeRefreshTranslator() {
- return new EmptyTagBooleanTranslator(CASCADE__CASCADE_REFRESH, MAPPINGS_PKG.getICascade_Refresh());
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return OrmFactory.eINSTANCE.createXmlCascade();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/ColumnTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/ColumnTranslator.java
deleted file mode 100644
index 57db33d7dd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/ColumnTranslator.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class ColumnTranslator extends AbstractColumnTranslator
- implements OrmXmlMapper
-{
-
- private IColumnMapping columnMapping;
-
- public ColumnTranslator(String domNameAndPath, EStructuralFeature aFeature) {
- super(domNameAndPath, aFeature);
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return getColumnMapping().getColumn();
- }
-
- private IColumnMapping getColumnMapping() {
- return this.columnMapping;
- }
-
- void setColumnMapping(IColumnMapping columnMapping) {
- this.columnMapping = columnMapping;
- }
-
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- createUniqueTranslator(),
- createNullableTranslator(),
- createInsertableTranslator(),
- createUpdatableTranslator(),
- createColumnDefinitionTranslator(),
- createTableTranslator(),
- createLengthTranslator(),
- createPrecisionTranslator(),
- createScaleTranslator(),
- };
- }
-
- protected Translator createLengthTranslator() {
- return new Translator(COLUMN__LENGTH, JPA_CORE_XML_PKG.getXmlColumn_LengthForXml(), DOM_ATTRIBUTE);
- }
-
- protected Translator createPrecisionTranslator() {
- return new Translator(COLUMN__PRECISION, JPA_CORE_XML_PKG.getXmlColumn_PrecisionForXml(), DOM_ATTRIBUTE);
- }
-
- protected Translator createScaleTranslator() {
- return new Translator(COLUMN__SCALE, JPA_CORE_XML_PKG.getXmlColumn_ScaleForXml(), DOM_ATTRIBUTE);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/DebugTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/DebugTranslator.java
deleted file mode 100644
index 2ee8a8484f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/DebugTranslator.java
+++ /dev/null
@@ -1,431 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import java.util.List;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.wst.common.internal.emf.resource.ReadAheadHelper;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-import org.eclipse.wst.common.internal.emf.resource.TranslatorPath;
-import org.eclipse.wst.common.internal.emf.resource.VariableTranslatorFactory;
-
-public class DebugTranslator extends Translator
-{
- @Override
- public String getDOMPath() {
- // TODO Auto-generated method stub
- return super.getDOMPath();
- }
-
- public DebugTranslator(String domNameAndPath, EStructuralFeature aFeature) {
- super(domNameAndPath, aFeature);
- // TODO Auto-generated constructor stub
- }
-
- public DebugTranslator(String domNameAndPath, EStructuralFeature aFeature, int style) {
- super(domNameAndPath, aFeature, style);
- // TODO Auto-generated constructor stub
- }
-
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- // TODO Auto-generated method stub
- return super.createEMFObject(nodeName, readAheadName);
- }
-
- @Override
- public Translator[] getChildren(Object target, int versionID) {
- // TODO Auto-generated method stub
- return super.getChildren(target, versionID);
- }
-
- @Override
- public String getDOMName(Object value) {
- // TODO Auto-generated method stub
- return super.getDOMName(value);
- }
-
- @Override
- public boolean isManagedByParent() {
- // TODO Auto-generated method stub
- return super.isManagedByParent();
- }
-
- @Override
- public void addReadAheadHelper(ReadAheadHelper helper) {
- // TODO Auto-generated method stub
- super.addReadAheadHelper(helper);
- }
-
- @Override
- public EObject basicGetDependencyObject(EObject parent) {
- // TODO Auto-generated method stub
- return super.basicGetDependencyObject(parent);
- }
-
- @Override
- public void clearList(EObject mofObject) {
- // TODO Auto-generated method stub
- super.clearList(mofObject);
- }
-
- @Override
- public Object convertStringToValue(String strValue, EObject owner) {
- // TODO Auto-generated method stub
- return super.convertStringToValue(strValue, owner);
- }
-
- @Override
- public Object convertStringToValue(String nodeName, String readAheadName,
- String value, Notifier owner) {
- // TODO Auto-generated method stub
- return super.convertStringToValue(nodeName, readAheadName, value, owner);
- }
-
- @Override
- public String convertValueToString(Object value, EObject owner) {
- // TODO Auto-generated method stub
- return super.convertValueToString(value, owner);
- }
-
- @Override
- public boolean equals(Object object) {
- // TODO Auto-generated method stub
- return super.equals(object);
- }
-
- @Override
- public String extractStringValue(EObject emfObject) {
- // TODO Auto-generated method stub
- return super.extractStringValue(emfObject);
- }
-
- @Override
- public boolean featureExists(EObject emfObject) {
- // TODO Auto-generated method stub
- return super.featureExists(emfObject);
- }
-
- @Override
- public Translator findChild(String tagName, Object target, int versionID) {
- // TODO Auto-generated method stub
- return super.findChild(tagName, target, versionID);
- }
-
- @Override
- protected Translator[] getChildren() {
- // TODO Auto-generated method stub
- return super.getChildren();
- }
-
- @Override
- public EStructuralFeature getDependencyFeature() {
- // TODO Auto-generated method stub
- return super.getDependencyFeature();
- }
-
- @Override
- public String[] getDOMNames() {
- // TODO Auto-generated method stub
- return super.getDOMNames();
- }
-
- @Override
- public EStructuralFeature getFeature() {
- // TODO Auto-generated method stub
- return super.getFeature();
- }
-
- @Override
- public List getMOFChildren(EObject mofObject) {
- // TODO Auto-generated method stub
- return super.getMOFChildren(mofObject);
- }
-
- @Override
- public Object getMOFValue(EObject mofObject) {
- // TODO Auto-generated method stub
- return super.getMOFValue(mofObject);
- }
-
- @Override
- public String getNameSpace() {
- // TODO Auto-generated method stub
- return super.getNameSpace();
- }
-
- @Override
- public ReadAheadHelper getReadAheadHelper(String parentName) {
- // TODO Auto-generated method stub
- return super.getReadAheadHelper(parentName);
- }
-
- @Override
- public TranslatorPath[] getTranslatorPaths() {
- // TODO Auto-generated method stub
- return super.getTranslatorPaths();
- }
-
- @Override
- public Translator[] getVariableChildren(Notifier target, int version) {
- // TODO Auto-generated method stub
- return super.getVariableChildren(target, version);
- }
-
- @Override
- public VariableTranslatorFactory getVariableTranslatorFactory() {
- // TODO Auto-generated method stub
- return super.getVariableTranslatorFactory();
- }
-
- @Override
- public boolean hasDOMPath() {
- // TODO Auto-generated method stub
- return super.hasDOMPath();
- }
-
- @Override
- public boolean hasReadAheadNames() {
- // TODO Auto-generated method stub
- return super.hasReadAheadNames();
- }
-
- @Override
- protected void initializeDOMNameAndPath(String domNameAndPathArg) {
- // TODO Auto-generated method stub
- super.initializeDOMNameAndPath(domNameAndPathArg);
- }
-
- @Override
- public boolean isBooleanFeature() {
- // TODO Auto-generated method stub
- return super.isBooleanFeature();
- }
-
- @Override
- public boolean isBooleanUppercase() {
- // TODO Auto-generated method stub
- return super.isBooleanUppercase();
- }
-
- @Override
- public boolean isCDATAContent() {
- // TODO Auto-generated method stub
- return super.isCDATAContent();
- }
-
- @Override
- public boolean isComment() {
- // TODO Auto-generated method stub
- return super.isComment();
- }
-
- @Override
- public boolean isDataType() {
- // TODO Auto-generated method stub
- return super.isDataType();
- }
-
- @Override
- public boolean isDependencyChild() {
- // TODO Auto-generated method stub
- return super.isDependencyChild();
- }
-
- @Override
- public boolean isDependencyParent() {
- // TODO Auto-generated method stub
- return super.isDependencyParent();
- }
-
- @Override
- public boolean isDOMAttribute() {
- // TODO Auto-generated method stub
- return super.isDOMAttribute();
- }
-
- @Override
- public boolean isDOMTextValue() {
- // TODO Auto-generated method stub
- return super.isDOMTextValue();
- }
-
- @Override
- public boolean isEmptyContentSignificant() {
- // TODO Auto-generated method stub
- return super.isEmptyContentSignificant();
- }
-
- @Override
- public boolean isEmptyTag() {
- // TODO Auto-generated method stub
- return super.isEmptyTag();
- }
-
- @Override
- public boolean isEnumFeature() {
- // TODO Auto-generated method stub
- return super.isEnumFeature();
- }
-
- @Override
- public boolean isEnumWithHyphens() {
- // TODO Auto-generated method stub
- return super.isEnumWithHyphens();
- }
-
- @Override
- public boolean isIDMap() {
- // TODO Auto-generated method stub
- return super.isIDMap();
- }
-
- @Override
- public boolean isLinkMap() {
- // TODO Auto-generated method stub
- return super.isLinkMap();
- }
-
- @Override
- public boolean isMapFor(Object aFeature, Object oldValue, Object newValue) {
- // TODO Auto-generated method stub
- return super.isMapFor(aFeature, oldValue, newValue);
- }
-
- @Override
- public boolean isMapFor(String domName) {
- // TODO Auto-generated method stub
- return super.isMapFor(domName);
- }
-
- @Override
- public boolean isMultiValued() {
- // TODO Auto-generated method stub
- return super.isMultiValued();
- }
-
- @Override
- public boolean isObjectMap() {
- // TODO Auto-generated method stub
- return super.isObjectMap();
- }
-
- @Override
- public boolean isSetMOFValue(EObject emfObject) {
- // TODO Auto-generated method stub
- return super.isSetMOFValue(emfObject);
- }
-
- @Override
- public boolean isShared() {
- // TODO Auto-generated method stub
- return super.isShared();
- }
-
- @Override
- public boolean isTargetLinkMap() {
- // TODO Auto-generated method stub
- return super.isTargetLinkMap();
- }
-
- @Override
- public boolean isUnsettable() {
- // TODO Auto-generated method stub
- return super.isUnsettable();
- }
-
- @Override
- protected String[] parseDOMNames(String domNamesString) {
- // TODO Auto-generated method stub
- return super.parseDOMNames(domNamesString);
- }
-
- @Override
- public void removeMOFValue(Notifier owner, Object value) {
- // TODO Auto-generated method stub
- super.removeMOFValue(owner, value);
- }
-
- @Override
- protected void setEMFClass(EClass anEClass) {
- // TODO Auto-generated method stub
- super.setEMFClass(anEClass);
- }
-
- @Override
- protected void setFeature(EStructuralFeature aFeature) {
- // TODO Auto-generated method stub
- super.setFeature(aFeature);
- }
-
- @Override
- public void setMOFValue(EObject emfObject, Object value) {
- // TODO Auto-generated method stub
- super.setMOFValue(emfObject, value);
- }
-
- @Override
- public void setMOFValue(Notifier owner, Object value, int newIndex) {
- // TODO Auto-generated method stub
- super.setMOFValue(owner, value, newIndex);
- }
-
- @Override
- public void setMOFValue(Notifier owner, Object value) {
- // TODO Auto-generated method stub
- super.setMOFValue(owner, value);
- }
-
- @Override
- public void setMOFValue(Resource res, Object value) {
- // TODO Auto-generated method stub
- super.setMOFValue(res, value);
- }
-
- @Override
- public void setMOFValueFromEmptyDOMPath(EObject eObject) {
- // TODO Auto-generated method stub
- super.setMOFValueFromEmptyDOMPath(eObject);
- }
-
- @Override
- public void setNameSpace(String string) {
- // TODO Auto-generated method stub
- super.setNameSpace(string);
- }
-
- @Override
- public void setTextValueIfNecessary(String textValue, Notifier owner, int versionId) {
- // TODO Auto-generated method stub
- super.setTextValueIfNecessary(textValue, owner, versionId);
- }
-
- @Override
- public boolean shouldIndentEndTag() {
- // TODO Auto-generated method stub
- return super.shouldIndentEndTag();
- }
-
- @Override
- public boolean shouldRenderEmptyDOMPath(EObject eObject) {
- // TODO Auto-generated method stub
- return super.shouldRenderEmptyDOMPath(eObject);
- }
-
- @Override
- public void unSetMOFValue(EObject emfObject) {
- // TODO Auto-generated method stub
- super.unSetMOFValue(emfObject);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EmbeddedTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EmbeddedTranslator.java
deleted file mode 100644
index 23a850aa29..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EmbeddedTranslator.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.resource.AttributeOverrideTranslator.AttributeOverrideBuilder;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class EmbeddedTranslator extends AttributeMappingTranslator
-{
- private IEmbedded embedded;
-
- public EmbeddedTranslator() {
- super(EMBEDDED, NO_STYLE);
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- IEmbedded embedded = JPA_CORE_XML_FACTORY.createXmlEmbedded();
- this.setEmbedded(embedded);
- return embedded;
- }
-
- protected void setEmbedded(IEmbedded embedded) {
- this.embedded = embedded;
- }
-
- @Override
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- createAttributeOverridesTranslator(),
- };
- }
- private Translator createAttributeOverridesTranslator() {
- return new AttributeOverridesTranslator(EMBEDDED__ATTRIBUTE_OVERRIDE, MAPPINGS_PKG.getIEmbedded_SpecifiedAttributeOverrides(), buildAttributeOverrideBuilder());
- }
-
- private AttributeOverrideBuilder buildAttributeOverrideBuilder() {
- return new AttributeOverrideBuilder() {
- public IAttributeOverride createAttributeOverride() {
- return EmbeddedTranslator.this.embedded.createAttributeOverride(0);
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EntityMappingsTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EntityMappingsTranslator.java
deleted file mode 100644
index 9ba1785e42..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EntityMappingsTranslator.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappings;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.wst.common.internal.emf.resource.ConstantAttributeTranslator;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.RootTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class EntityMappingsTranslator extends RootTranslator
- implements OrmXmlMapper
-{
- private Translator[] children;
-
- private PersistenceUnitMetadataTranslator persistenceUnitMetadataTranslator;
-
- public EntityMappingsTranslator() {
- super(ENTITY_MAPPINGS, OrmPackage.eINSTANCE.getEntityMappingsInternal());
- }
-
- public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
- }
- return children;
- }
-
- private Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- new ConstantAttributeTranslator(XML_NS, PERSISTENCE_NS_URL),
- new ConstantAttributeTranslator(XML_NS_XSI, XSI_NS_URL),
- new ConstantAttributeTranslator(XSI_SCHEMA_LOCATION, PERSISTENCE_NS_URL + ' ' + ORM_SCHEMA_LOC_1_0),
- createVersionTranslator(),
- createPlaceHolderTranslator(ENTITY_MAPPINGS__DESCRIPTION),
- createPersistenceUnitMetadataTranslator(),
- createPackageTranslator(),
- createSchemaTranslator(),
- createCatalogTranslator(),
- createAccessTranslator(),
- createSequenceGeneratorTranslator(),
- createTableGeneratorTranslator(),
- createNamedQueryTranslator(),
- createNamedNativeQueryTranslator(),
- createPlaceHolderTranslator(ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPING),
- createTypeMappingsTranslator()
- };
- }
-
- private Translator createPlaceHolderTranslator(String domNameAndPath) {
- return new Translator(domNameAndPath, (EStructuralFeature) null);
- }
-
- protected Translator createVersionTranslator() {
- return new Translator(VERSION, OrmPackage.eINSTANCE.getEntityMappingsInternal_Version(), DOM_ATTRIBUTE);
- }
-
- protected Translator createPersistenceUnitMetadataTranslator() {
- this.persistenceUnitMetadataTranslator = new PersistenceUnitMetadataTranslator();
- return this.persistenceUnitMetadataTranslator;
- }
-
- protected Translator createPackageTranslator() {
- return new Translator(ENTITY_MAPPINGS__PACKAGE, OrmPackage.eINSTANCE.getEntityMappingsForXml_PackageForXml());
- }
-
- protected Translator createSchemaTranslator() {
- return new Translator(ENTITY_MAPPINGS__SCHEMA, OrmPackage.eINSTANCE.getEntityMappingsInternal_SpecifiedSchema());
- }
-
- protected Translator createCatalogTranslator() {
- return new Translator(ENTITY_MAPPINGS__CATALOG, OrmPackage.eINSTANCE.getEntityMappingsInternal_SpecifiedCatalog());
- }
-
- protected Translator createAccessTranslator() {
- return new AccessTypeElementTranslator(ENTITY_MAPPINGS__ACCESS, OrmPackage.eINSTANCE.getEntityMappingsInternal_SpecifiedAccess(), NO_STYLE);
- }
-
- protected Translator createTypeMappingsTranslator() {
- return new TypeMappingsTranslator();
- }
-
- private Translator createTableGeneratorTranslator() {
- return new TableGeneratorTranslator(TABLE_GENERATOR, OrmPackage.eINSTANCE.getEntityMappingsInternal_TableGenerators());
- }
-
- private Translator createSequenceGeneratorTranslator() {
- return new SequenceGeneratorTranslator(SEQUENCE_GENERATOR, OrmPackage.eINSTANCE.getEntityMappingsInternal_SequenceGenerators());
- }
-
- private Translator createNamedQueryTranslator() {
- return new NamedQueryTranslator(NAMED_QUERY, OrmPackage.eINSTANCE.getEntityMappingsInternal_NamedQueries());
- }
-
- private Translator createNamedNativeQueryTranslator() {
- return new NamedNativeQueryTranslator(NAMED_NATIVE_QUERY, OrmPackage.eINSTANCE.getEntityMappingsInternal_NamedNativeQueries());
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- EntityMappings entityMappings = (EntityMappings) super.createEMFObject(nodeName, readAheadName);
- this.persistenceUnitMetadataTranslator.setEntityMappings(entityMappings);
- return entityMappings;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EntityTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EntityTranslator.java
deleted file mode 100644
index f2177576ba..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EntityTranslator.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.resource.AssociationOverrideTranslator.AssociationOverrideBuilder;
-import org.eclipse.jpt.core.internal.content.orm.resource.AttributeOverrideTranslator.AttributeOverrideBuilder;
-import org.eclipse.jpt.core.internal.content.orm.resource.PrimaryKeyJoinColumnTranslator.PrimaryKeyJoinColumnBuilder;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class EntityTranslator extends TypeMappingTranslator
-{
- protected static final JpaCoreMappingsPackage MAPPINGS_PKG =
- JpaCoreMappingsPackage.eINSTANCE;
-
- private TableTranslator tableTranslator;
- private SecondaryTablesTranslator secondaryTablesTranslator;
- private DiscriminatorColumnTranslator discriminatorColumnTranslator;
-
- private IEntity entity;
-
- public EntityTranslator() {
- super(ENTITY);
- this.tableTranslator = createTableTranslator();
- this.secondaryTablesTranslator = createSecondaryTableTranslator();
- this.discriminatorColumnTranslator = createDiscriminatorColumnTranslator();
- }
-
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- IEntity entity = JPA_CORE_XML_FACTORY.createXmlEntityInternal();
- this.setEntity(entity);
- return entity;
- }
-
- protected void setEntity(IEntity entity) {
- this.entity = entity;
- this.tableTranslator.setEntity(this.entity);
- this.secondaryTablesTranslator.setEntity(this.entity);
- this.discriminatorColumnTranslator.setEntity(this.entity);
- }
-
- @Override
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- createJavaClassTranslator(),
- createAccessTypeTranslator(),
- createMetadataCompleteTranslator(),
- createPlaceHolderTranslator(ENTITY__DESCRIPTION),
- getTableTranslator(),
- getSecondaryTableTranslator(),
- createPrimaryKeyJoinColumnsTranslator(),
- createIdClassTranslator(),
- createInheritanceTranslator(),
- createDiscriminatorValueTranslator(),
- getDiscriminatorColumnTranslator(),
- createSequenceGeneratorTranslator(),
- createTableGeneratorTranslator(),
- createNamedQueryTranslator(),
- createNamedNativeQueryTranslator(),
- createPlaceHolderTranslator(ENTITY__SQL_RESULT_SET_MAPPING),
- createPlaceHolderTranslator(ENTITY__EXCLUDE_DEFAULT_LISTENERS),
- createPlaceHolderTranslator(ENTITY__EXCLUDE_SUPERCLASS_LISTENERS),
- createPlaceHolderTranslator(ENTITY__ENTITY_LISTENERS),
- createPlaceHolderTranslator(ENTITY__PRE_PERSIST),
- createPlaceHolderTranslator(ENTITY__POST_PERSIST),
- createPlaceHolderTranslator(ENTITY__PRE_REMOVE),
- createPlaceHolderTranslator(ENTITY__POST_REMOVE),
- createPlaceHolderTranslator(ENTITY__PRE_UPDATE),
- createPlaceHolderTranslator(ENTITY__POST_UPDATE),
- createPlaceHolderTranslator(ENTITY__POST_LOAD),
- createAttributeOverridesTranslator(),
- createAssociationOverridesTranslator(),
- createPersistentAttributesTranslator()
- };
- }
-
- private Translator createNameTranslator() {
- return new Translator(NAME, MAPPINGS_PKG.getIEntity_SpecifiedName(), DOM_ATTRIBUTE);
- }
-
- private Translator getTableTranslator() {
- return this.tableTranslator;
- }
-
- private Translator getSecondaryTableTranslator() {
- return this.secondaryTablesTranslator;
- }
-
- private Translator getDiscriminatorColumnTranslator() {
- return this.discriminatorColumnTranslator;
- }
-
- private TableTranslator createTableTranslator() {
- return new TableTranslator();
- }
-
- private SecondaryTablesTranslator createSecondaryTableTranslator() {
- return new SecondaryTablesTranslator();
- }
-
- private DiscriminatorColumnTranslator createDiscriminatorColumnTranslator() {
- return new DiscriminatorColumnTranslator();
- }
-
- private Translator createTableGeneratorTranslator() {
- return new TableGeneratorTranslator(TABLE_GENERATOR, JpaCoreMappingsPackage.eINSTANCE.getIEntity_TableGenerator());
- }
-
- private Translator createSequenceGeneratorTranslator() {
- return new SequenceGeneratorTranslator(SEQUENCE_GENERATOR, JpaCoreMappingsPackage.eINSTANCE.getIEntity_SequenceGenerator());
- }
-
- private Translator createNamedQueryTranslator() {
- return new NamedQueryTranslator(NAMED_QUERY, JpaCoreMappingsPackage.eINSTANCE.getIEntity_NamedQueries());
- }
-
- private Translator createNamedNativeQueryTranslator() {
- return new NamedNativeQueryTranslator(NAMED_NATIVE_QUERY, JpaCoreMappingsPackage.eINSTANCE.getIEntity_NamedNativeQueries());
- }
-
- protected Translator createDiscriminatorValueTranslator() {
- return new Translator(ENTITY__DISCRIMINATOR_VALUE, MAPPINGS_PKG.getIEntity_SpecifiedDiscriminatorValue(), NO_STYLE);
- }
-
- protected Translator createInheritanceTranslator() {
- return new InheritanceTranslator(ENTITY__INHERITANCE, JPA_CORE_XML_PKG.getXmlEntityForXml_InheritanceForXml());
- }
-
- protected Translator createPrimaryKeyJoinColumnsTranslator() {
- return new PrimaryKeyJoinColumnTranslator(
- ENTITY__PRIMARY_KEY_JOIN_COLUMN,
- JpaCoreMappingsPackage.eINSTANCE.getIEntity_SpecifiedPrimaryKeyJoinColumns(),
- buildPrimaryKeyJoinColumnsBuilder());
- }
-
- private PrimaryKeyJoinColumnBuilder buildPrimaryKeyJoinColumnsBuilder() {
- return new PrimaryKeyJoinColumnBuilder() {
- public IPrimaryKeyJoinColumn createPrimaryKeyJoinColumn() {
- return OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn(new IEntity.PrimaryKeyJoinColumnOwner(entity));
- }
- };
- }
-
- private Translator createAttributeOverridesTranslator() {
- return new AttributeOverridesTranslator(ENTITY__ATTRIBUTE_OVERRIDE, MAPPINGS_PKG.getIEntity_SpecifiedAttributeOverrides(), buildAttributeOverrideBuilder());
- }
-
- private AttributeOverrideBuilder buildAttributeOverrideBuilder() {
- return new AttributeOverrideBuilder() {
- public IAttributeOverride createAttributeOverride() {
- return EntityTranslator.this.entity.createAttributeOverride(0);
- }
- };
- }
-
- private Translator createAssociationOverridesTranslator() {
- return new AssociationOverridesTranslator(ENTITY__ASSOCIATION_OVERRIDE, MAPPINGS_PKG.getIEntity_SpecifiedAssociationOverrides(), buildAssociationOverrideBuilder());
- }
-
- private AssociationOverrideBuilder buildAssociationOverrideBuilder() {
- return new AssociationOverrideBuilder() {
- public IAssociationOverride createAssociationOverride() {
- return EntityTranslator.this.entity.createAssociationOverride(0);
- }
- };
- }
-
- protected Translator createIdClassTranslator() {
- return new IdClassTranslator(ID_CLASS, JPA_CORE_XML_PKG.getXmlEntityForXml_IdClassForXml());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EnumeratedTypeElementTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EnumeratedTypeElementTranslator.java
deleted file mode 100644
index c926b883d7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EnumeratedTypeElementTranslator.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.mappings.EnumType;
-
-/**
- * There is a bug in the translator framework that causes
- * enumerators in xml elements and enumerators in xml attributes
- * to be treated differently. When the enumerator is an attribute
- * setting the model to the default causes the attribute to be removed.
- * With an element is causes the default literal to be placed in
- * the tag.
- *
- * The problem is wrapped up in the emf unsettable attribute as well.
- * For attributes the eIsSet method returns false for the default value
- * For elements the eIsSet method returns true for the default value.
- * I don't want to have to use the unsettable option in emf since that would
- * require that I call different api. I am not sure yet what the bug is in
- * the translator, so I have entered one ~KFM
- */
-public class EnumeratedTypeElementTranslator extends EnumeratorTranslator
-{
-
- public EnumeratedTypeElementTranslator(String domNameAndPath, EStructuralFeature aFeature, int style) {
- super(domNameAndPath, aFeature, style);
- }
-
- @Override
- public Object getMOFValue(EObject mofObject) {
- EnumType type = (EnumType) super.getMOFValue(mofObject);
- if (type == EnumType.DEFAULT) {
- return null;
- }
- return type;
- }
-
- @Override
- public List getMOFChildren(EObject mofObject) {
- List result = super.getMOFChildren(mofObject);
- if(result != null && result.size() > 0) {
- EnumType type = (EnumType) result.get(0);
- if(type.getValue() == EnumType.DEFAULT_VALUE)
- result = Collections.EMPTY_LIST;
- }
- return result;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EnumeratorTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EnumeratorTranslator.java
deleted file mode 100644
index 743531d55b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EnumeratorTranslator.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.common.util.Enumerator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-import org.eclipse.wst.common.internal.emf.resource.TranslatorPath;
-
-public class EnumeratorTranslator extends Translator
-{
-
- public EnumeratorTranslator(String domNameAndPath, EStructuralFeature aFeature, int style) {
- super(domNameAndPath, aFeature, style);
- }
-
- public EnumeratorTranslator(String domNameAndPath, EStructuralFeature aFeature, TranslatorPath translatorPath) {
- super(domNameAndPath, aFeature, translatorPath);
- }
-
- /**
- * Overriding this because the default functionality is to return
- * the toString of the Enumerator. This returns the literal value
- * while we want to return the name instead.
- *
- * An example is fetchType where the literal value is going to be "Lazy"
- * and the name is "LAZY". The xml needs "LAZY" to be placed in it
- * while the ui wants to display "Lazy"
- */
- @Override
- public String convertValueToString(Object value, EObject owner) {
- Enumerator enumerator = (Enumerator) value;
- return enumerator.getName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/GeneratedValueTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/GeneratedValueTranslator.java
deleted file mode 100644
index e44adb6175..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/GeneratedValueTranslator.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class GeneratedValueTranslator extends Translator implements OrmXmlMapper
-{
- protected static final JpaCoreMappingsPackage MAPPINGS_PKG =
- JpaCoreMappingsPackage.eINSTANCE;
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
-
-
- private Translator[] children;
-
- public GeneratedValueTranslator(String domNameAndPath, EStructuralFeature aFeature) {
- super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
- }
-
- public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
- }
- return children;
- }
-
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createStrategyTranslator(),
- createGeneratorTranslator(),
- };
- }
-
- protected Translator createStrategyTranslator() {
- return new EnumeratorTranslator(GENERATED_VALUE__STRATEGY, MAPPINGS_PKG.getIGeneratedValue_Strategy(), DOM_ATTRIBUTE);
- }
-
- protected Translator createGeneratorTranslator() {
- return new Translator(GENERATED_VALUE__GENERATOR, MAPPINGS_PKG.getIGeneratedValue_Generator(), DOM_ATTRIBUTE);
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return OrmFactory.eINSTANCE.createXmlGeneratedValue();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/GeneratorTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/GeneratorTranslator.java
deleted file mode 100644
index 0ad1f08982..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/GeneratorTranslator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public abstract class GeneratorTranslator extends Translator implements OrmXmlMapper
-{
- protected static final JpaCoreMappingsPackage MAPPINGS_PKG =
- JpaCoreMappingsPackage.eINSTANCE;
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
-
-
- private Translator[] children;
-
- public GeneratorTranslator(String domNameAndPath, EStructuralFeature aFeature, int style) {
- super(domNameAndPath, aFeature, style);
- }
-
- public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
- }
- return children;
- }
-
- protected abstract Translator[] createChildren();
-
-
- protected Translator createNameTranslator() {
- return new Translator(GENERATOR__NAME, MAPPINGS_PKG.getIGenerator_Name(), DOM_ATTRIBUTE);
- }
-
- protected Translator createInitialValueTranslator() {
- return new Translator(GENERATOR__INITIAL_VALUE, MAPPINGS_PKG.getIGenerator_SpecifiedInitialValue(), DOM_ATTRIBUTE);
- }
-
- protected Translator createAllocationSizeTranslator() {
- return new Translator(GENERATOR__ALLOCATION_SIZE, MAPPINGS_PKG.getIGenerator_SpecifiedAllocationSize(), DOM_ATTRIBUTE);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/IdTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/IdTranslator.java
deleted file mode 100644
index 93ec76cc45..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/IdTranslator.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class IdTranslator extends AttributeMappingTranslator
-{
- private ColumnTranslator columnTranslator;
-
- public IdTranslator() {
- super(ID, NO_STYLE);
- this.columnTranslator = createColumnTranslator();
- }
-
- private ColumnTranslator createColumnTranslator() {
- return new ColumnTranslator(COLUMN, JPA_CORE_XML_PKG.getIXmlColumnMapping_ColumnForXml());
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- IId xmlId = JPA_CORE_XML_FACTORY.createXmlId();
- this.setId(xmlId);
- return xmlId;
- }
-
- protected void setId(IId id) {
- this.columnTranslator.setColumnMapping(id);
- }
-
- @Override
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- columnTranslator,
- createGeneratedValueTranslator(),
- createTemporalTranslator(),
- createTableGeneratorTranslator(),
- createSequenceGeneratorTranslator(),
- };
- }
-
- private Translator createGeneratedValueTranslator() {
- return new GeneratedValueTranslator(GENERATED_VALUE, JpaCoreMappingsPackage.eINSTANCE.getIId_GeneratedValue());
- }
-
- private Translator createTemporalTranslator() {
- return new TemporalTypeElementTranslator(ID__TEMPORAL, JpaCoreMappingsPackage.eINSTANCE.getIId_Temporal(), NO_STYLE);
- }
-
- private Translator createTableGeneratorTranslator() {
- return new TableGeneratorTranslator(TABLE_GENERATOR, JpaCoreMappingsPackage.eINSTANCE.getIId_TableGenerator());
- }
-
- private Translator createSequenceGeneratorTranslator() {
- return new SequenceGeneratorTranslator(SEQUENCE_GENERATOR, JpaCoreMappingsPackage.eINSTANCE.getIId_SequenceGenerator());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/JoinColumnTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/JoinColumnTranslator.java
deleted file mode 100644
index 95472e4324..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/JoinColumnTranslator.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class JoinColumnTranslator extends AbstractColumnTranslator
- implements OrmXmlMapper
-{
- private JoinColumnBuilder joinColumnBuilder;
-
- public JoinColumnTranslator(String domNameAndPath, EStructuralFeature aFeature, JoinColumnBuilder joinColumnBuilder) {
- super(domNameAndPath, aFeature);
- this.joinColumnBuilder = joinColumnBuilder;
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return joinColumnBuilder.createJoinColumn();
- }
-
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- createReferencedColumnNameTranslator(),
- createUniqueTranslator(),
- createNullableTranslator(),
- createInsertableTranslator(),
- createUpdatableTranslator(),
- createColumnDefinitionTranslator(),
- createTableTranslator(),
- };
- }
-
- protected Translator createReferencedColumnNameTranslator() {
- return new Translator(REFERENCED_COLUMN_NAME, JPA_CORE_XML_PKG.getXmlJoinColumn_SpecifiedReferencedColumnNameForXml(), DOM_ATTRIBUTE);
- }
-
- public interface JoinColumnBuilder {
- IJoinColumn createJoinColumn();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/JoinTableTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/JoinTableTranslator.java
deleted file mode 100644
index 162d23d2b9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/JoinTableTranslator.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.resource.JoinColumnTranslator.JoinColumnBuilder;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable.InverseJoinColumnOwner;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable.JoinColumnOwner;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class JoinTableTranslator extends AbstractTableTranslator
-{
-
- private IMultiRelationshipMapping mapping;
-
-
- public JoinTableTranslator() {
- super(JOIN_TABLE, JPA_CORE_XML_PKG.getXmlMultiRelationshipMappingForXml_JoinTableForXml());
- }
-
- protected IMultiRelationshipMapping getMapping() {
- return this.mapping;
- }
-
- void setMapping(IMultiRelationshipMapping mapping) {
- this.mapping = mapping;
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return getMapping().getJoinTable();
- }
-
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- createCatalogTranslator(),
- createSchemaTranslator(),
- createJoinColumnsTranslator(),
- createInverseJoinColumnsTranslator(),
- createUniqueConstraintTranslator()
- };
- }
-
- protected Translator createJoinColumnsTranslator() {
- return new JoinColumnTranslator(
- JOIN_COLUMN,
- JpaCoreMappingsPackage.eINSTANCE.getIJoinTable_SpecifiedJoinColumns(),
- buildJoinColumnsBuilder());
- }
-
- private JoinColumnBuilder buildJoinColumnsBuilder() {
- return new JoinColumnBuilder() {
- public IJoinColumn createJoinColumn() {
- return OrmFactory.eINSTANCE.createXmlJoinColumn(new JoinColumnOwner(getMapping().getJoinTable()));
- }
- };
- }
-
- protected Translator createInverseJoinColumnsTranslator() {
- return new JoinColumnTranslator(
- INVERSE_JOIN_COLUMN,
- JpaCoreMappingsPackage.eINSTANCE.getIJoinTable_SpecifiedInverseJoinColumns(),
- buildInverseJoinColumnsBuilder());
- }
-
- private JoinColumnBuilder buildInverseJoinColumnsBuilder() {
- return new JoinColumnBuilder() {
- public IJoinColumn createJoinColumn() {
- return OrmFactory.eINSTANCE.createXmlJoinColumn(new InverseJoinColumnOwner(getMapping().getJoinTable()));
- }
- };
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/ManyToManyTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/ManyToManyTranslator.java
deleted file mode 100644
index f2775fcbf2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/ManyToManyTranslator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.XmlManyToMany;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class ManyToManyTranslator extends MultiRelationshipTranslator
-{
- public ManyToManyTranslator() {
- super(MANY_TO_MANY);
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- XmlManyToMany mapping = JPA_CORE_XML_FACTORY.createXmlManyToMany();
- this.setMapping(mapping);
- return mapping;
- }
-
- @Override
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- createTargetEntityTranslator(),
- createFetchTypeTranslator(),
- createMappedByTranslator(),
- createOrderByTranslator(),
- createMapKeyTranslator(),
- getJoinTableTranslator(),
- createCascadeTranslator()
- };
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/ManyToOneTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/ManyToOneTranslator.java
deleted file mode 100644
index 9c1b100681..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/ManyToOneTranslator.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class ManyToOneTranslator extends SingleRelationshipTranslator
-{
- public ManyToOneTranslator() {
- super(MANY_TO_ONE);
- }
-
- @Override
- protected ISingleRelationshipMapping createMapping() {
- return JPA_CORE_XML_FACTORY.createXmlManyToOne();
- }
-
- @Override
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- createTargetEntityTranslator(),
- createFetchTypeTranslator(),
- createOptionalTranslator(),
- createJoinColumnsTranslator(),
- createCascadeTranslator()
- };
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MappedSuperclassTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MappedSuperclassTranslator.java
deleted file mode 100644
index aaf4743429..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MappedSuperclassTranslator.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class MappedSuperclassTranslator extends TypeMappingTranslator
-{
- protected static final OrmPackage XML_PKG =
- OrmPackage.eINSTANCE;
-
-
- public MappedSuperclassTranslator() {
- super(MAPPED_SUPERCLASS);
- }
-
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return JPA_CORE_XML_FACTORY.createXmlMappedSuperclass();
- }
-
- @Override
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createJavaClassTranslator(),
- createAccessTypeTranslator(),
- createMetadataCompleteTranslator(),
- createPlaceHolderTranslator(ENTITY__DESCRIPTION),
- createIdClassTranslator(),
- createPlaceHolderTranslator(ENTITY__EXCLUDE_DEFAULT_LISTENERS),
- createPlaceHolderTranslator(ENTITY__EXCLUDE_SUPERCLASS_LISTENERS),
- createPlaceHolderTranslator(ENTITY__ENTITY_LISTENERS),
- createPlaceHolderTranslator(ENTITY__PRE_PERSIST),
- createPlaceHolderTranslator(ENTITY__POST_PERSIST),
- createPlaceHolderTranslator(ENTITY__PRE_REMOVE),
- createPlaceHolderTranslator(ENTITY__POST_REMOVE),
- createPlaceHolderTranslator(ENTITY__PRE_UPDATE),
- createPlaceHolderTranslator(ENTITY__POST_UPDATE),
- createPlaceHolderTranslator(ENTITY__POST_LOAD),
- createPersistentAttributesTranslator()
- };
- }
-
- protected Translator createIdClassTranslator() {
- return new IdClassTranslator(ID_CLASS, JPA_CORE_XML_PKG.getXmlMappedSuperclass_IdClassForXml());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MultiObjectDependencyTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MultiObjectDependencyTranslator.java
deleted file mode 100644
index 9ace901605..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MultiObjectDependencyTranslator.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.wst.common.internal.emf.resource.DependencyTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public abstract class MultiObjectDependencyTranslator extends DependencyTranslator
-{
- private static final Translator[] EMPTY_TRANSLATORS = new Translator[]{};
-
-
- private Map<EObject, Translator> translatorMap;
-
- public MultiObjectDependencyTranslator(String domNameAndPath, EStructuralFeature aFeature, EStructuralFeature aDependentFeature) {
- super(domNameAndPath, aFeature, aDependentFeature);
- this.translatorMap = new HashMap<EObject, Translator>();
- }
-
-
- public Translator getDelegateFor(EObject o) {
- return translatorMap.get(o);
- }
-
- public void setDelegateFor(EObject o, Translator t) {
- translatorMap.put(o, t);
- }
-
- public abstract Translator getDelegateFor(String domName, String readAheadName);
-
- public EObject createEMFObject(String nodeName, String readAheadName) {
- Translator translator = getDelegateFor(nodeName, readAheadName);
- EObject eObject = translator.createEMFObject(nodeName, readAheadName);
- this.translatorMap.put(eObject, translator);
- return eObject;
- }
-
- public Translator[] getChildren(Object o, int version) {
- if (o == null) {
- return EMPTY_TRANSLATORS;
- }
- Translator[] children = getDelegateFor((EObject) o).getChildren(o, version);
- if (children == null) {
- return EMPTY_TRANSLATORS;
- }
- return children;
- }
-
- public String getDOMName(Object value) {
- return getDelegateFor((EObject) value).getDOMName(value);
- }
-
- public boolean isManagedByParent() {
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MultiRelationshipTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MultiRelationshipTranslator.java
deleted file mode 100644
index 20b5c7be42..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MultiRelationshipTranslator.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public abstract class MultiRelationshipTranslator extends RelationshipTranslator
-{
- private JoinTableTranslator tableTranslator;
-
- public MultiRelationshipTranslator(String domNameAndPath) {
- super(domNameAndPath);
- this.tableTranslator = createTableTranslator();
- }
-
- protected Translator createFetchTypeTranslator() {
- return new EnumeratorTranslator(FETCH, JpaCoreMappingsPackage.eINSTANCE.getIMultiRelationshipMapping_Fetch(), DOM_ATTRIBUTE);
- }
-
- protected JoinTableTranslator getJoinTableTranslator() {
- return this.tableTranslator;
- }
-
- protected JoinTableTranslator createTableTranslator() {
- this.tableTranslator = new JoinTableTranslator();
- return this.tableTranslator;
- }
-
- protected OrderByTranslator createOrderByTranslator() {
- return new OrderByTranslator();
- }
-
- protected Translator createMapKeyTranslator() {
- return new MapKeyTranslator(MAP_KEY, JPA_CORE_XML_PKG.getXmlMultiRelationshipMappingForXml_MapKeyForXml());
- }
-
- protected void setMapping(IMultiRelationshipMapping multiRelationshipMapping) {
- this.getJoinTableTranslator().setMapping(multiRelationshipMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/NamedNativeQueryTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/NamedNativeQueryTranslator.java
deleted file mode 100644
index 480a67f36b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/NamedNativeQueryTranslator.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class NamedNativeQueryTranslator extends Translator implements OrmXmlMapper
-{
- protected static final JpaCoreMappingsPackage MAPPINGS_PKG =
- JpaCoreMappingsPackage.eINSTANCE;
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
-
-
- private Translator[] children;
-
- public NamedNativeQueryTranslator(String domNameAndPath, EStructuralFeature aFeature) {
- super(domNameAndPath, aFeature, NO_STYLE);
- }
-
- public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
- }
- return children;
- }
-
-
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- createResultClassTranslator(),
- createResultSetMappingTranslator(),
- createQueryTranslator(),
- createQueryHintTranslator(),
- };
- }
-
- protected Translator createNameTranslator() {
- return new Translator(NAMED_NATIVE_QUERY__NAME, MAPPINGS_PKG.getIQuery_Name(), DOM_ATTRIBUTE);
- }
-
- protected Translator createQueryTranslator() {
- return new Translator(NAMED_NATIVE_QUERY__QUERY, MAPPINGS_PKG.getIQuery_Query(), NO_STYLE);
- }
-
- protected Translator createResultClassTranslator() {
- return new Translator(NAMED_NATIVE_QUERY__RESULT_CLASS, MAPPINGS_PKG.getINamedNativeQuery_ResultClass(), DOM_ATTRIBUTE);
- }
-
- protected Translator createResultSetMappingTranslator() {
- return new Translator(NAMED_NATIVE_QUERY__RESULT_SET_MAPPING, MAPPINGS_PKG.getINamedNativeQuery_ResultSetMapping(), DOM_ATTRIBUTE);
- }
-
- protected Translator createQueryHintTranslator() {
- return new QueryHintTranslator(NAMED_NATIVE_QUERY__HINT, MAPPINGS_PKG.getIQuery_Hints());
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return OrmFactory.eINSTANCE.createXmlNamedQuery();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/NamedQueryTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/NamedQueryTranslator.java
deleted file mode 100644
index 44afa3ce69..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/NamedQueryTranslator.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class NamedQueryTranslator extends Translator implements OrmXmlMapper
-{
- protected static final JpaCoreMappingsPackage MAPPINGS_PKG =
- JpaCoreMappingsPackage.eINSTANCE;
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
-
-
- private Translator[] children;
-
- public NamedQueryTranslator(String domNameAndPath, EStructuralFeature aFeature) {
- super(domNameAndPath, aFeature, NO_STYLE);
- }
-
- public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
- }
- return children;
- }
-
-
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- createQueryTranslator(),
- createQueryHintTranslator(),
- };
- }
-
- protected Translator createNameTranslator() {
- return new Translator(NAMED_QUERY__NAME, MAPPINGS_PKG.getIQuery_Name(), DOM_ATTRIBUTE);
- }
-
- protected Translator createQueryTranslator() {
- return new Translator(NAMED_QUERY__QUERY, MAPPINGS_PKG.getIQuery_Query(), NO_STYLE);
- }
-
- protected Translator createQueryHintTranslator() {
- return new QueryHintTranslator(NAMED_QUERY__HINT, MAPPINGS_PKG.getIQuery_Hints());
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return OrmFactory.eINSTANCE.createXmlNamedQuery();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OneToManyTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OneToManyTranslator.java
deleted file mode 100644
index 740d998852..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OneToManyTranslator.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.XmlOneToMany;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class OneToManyTranslator extends MultiRelationshipTranslator
-{
- public OneToManyTranslator() {
- super(ONE_TO_MANY);
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- XmlOneToMany mapping = JPA_CORE_XML_FACTORY.createXmlOneToMany();
- this.setMapping(mapping);
- return mapping;
- }
-
- @Override
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- createTargetEntityTranslator(),
- createFetchTypeTranslator(),
- createMappedByTranslator(),
- createOrderByTranslator(),
- createMapKeyTranslator(),
- getJoinTableTranslator(),
- createCascadeTranslator()
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmXmlMapper.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmXmlMapper.java
deleted file mode 100644
index 26d6540174..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrmXmlMapper.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-public interface OrmXmlMapper
-{
- String XML_NS = "xmlns"; //$NON-NLS-1$
- String XML_NS_XSI = "xmlns:xsi"; //$NON-NLS-1$
- String XSI_SCHEMA_LOCATION = "xsi:schemaLocation"; //$NON-NLS-1$
- String XSI_NS_URL = "http://www.w3.org/2001/XMLSchema-instance"; //$NON-NLS-1$
- String PERSISTENCE_NS_URL = "http://java.sun.com/xml/ns/persistence/orm"; //$NON-NLS-1$
- String ORM_SCHEMA_LOC_1_0 = "http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"; //$NON-NLS-1$
-
- String FOO="foo"; //$NON-NLS-1$
- String BAR="bar"; //$NON-NLS-1$
-
- String ACCESS = "access"; //$NON-NLS-1$
- String ATTRIBUTES = "attributes"; //$NON-NLS-1$
- String ATTRIBUTE_OVERRIDE_NAME = "name"; //$NON-NLS-1$
- String ATTRIBUTE_OVERRIDE_COLUMN = "column"; //$NON-NLS-1$
- String ASSOCIATION_OVERRIDE_NAME = "name"; //$NON-NLS-1$
- String ASSOCIATION_OVERRIDE_JOIN_COLUMN = "join-column"; //$NON-NLS-1$
- String BASIC = "basic"; //$NON-NLS-1$
- String BASIC__ENUMERATED = "enumerated"; //$NON-NLS-1$
-
- String CASCADE = "cascade"; //$NON-NLS-1$
- String CASCADE__CASCADE_ALL = "cascade-all"; //$NON-NLS-1$
- String CASCADE__CASCADE_PERSIST = "cascade-persist"; //$NON-NLS-1$
- String CASCADE__CASCADE_MERGE = "cascade-merge"; //$NON-NLS-1$
- String CASCADE__CASCADE_REMOVE = "cascade-remove"; //$NON-NLS-1$
- String CASCADE__CASCADE_REFRESH = "cascade-refresh"; //$NON-NLS-1$
-
- String CASCADE_PERSIST = "cascade-persist"; //$NON-NLS-1$
-
- String CATALOG = "catalog"; //$NON-NLS-1$
- String CLASS = "class"; //$NON-NLS-1$
- String COLUMN = "column"; //$NON-NLS-1$
- String COLUMN__LENGTH = "length"; //$NON-NLS-1$
- String COLUMN__PRECISION= "precision"; //$NON-NLS-1$
- String COLUMN__SCALE= "scale"; //$NON-NLS-1$
- String COLUMN__COLUMN_DEFINITION= "column-definition"; //$NON-NLS-1$
- String COLUMN__NULLABLE = "nullable"; //$NON-NLS-1$
- String COLUMN__UNIQUE = "unique"; //$NON-NLS-1$
- String COLUMN__UPDATABLE = "updatable"; //$NON-NLS-1$
- String COLUMN__INSERTABLE = "insertable"; //$NON-NLS-1$
- String COLUMN__TABLE = "table"; //$NON-NLS-1$
- String COLUMN__NAME = "name"; //$NON-NLS-1$
-
- String DISCRIMINATOR_COLUMN__NAME = "name"; //$NON-NLS-1$
- String DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE = "discriminator-type"; //$NON-NLS-1$
- String DISCRIMINATOR_COLUMN__COLUMN_DEFINITION = "column-definition"; //$NON-NLS-1$
- String DISCRIMINATOR_COLUMN__LENGTH = "length"; //$NON-NLS-1$
- String EMBEDDABLE = "embeddable"; //$NON-NLS-1$
- String EMBEDDABLE__DESCRIPTION = "description"; //$NON-NLS-1$
-
- String EMBEDDED = "embedded"; //$NON-NLS-1$
- String EMBEDDED__ATTRIBUTE_OVERRIDE = "attribute-override"; //$NON-NLS-1$
- String EMBEDDED_ID = "embedded-id"; //$NON-NLS-1$
- String EMBEDDED_ID__ATTRIBUTE_OVERRIDE = "attribute-override"; //$NON-NLS-1$
-
- String ENTITY = "entity"; //$NON-NLS-1$
- String ENTITY__DESCRIPTION = "description"; //$NON-NLS-1$
- String ENTITY__TABLE = "table"; //$NON-NLS-1$
- String ENTITY__PRIMARY_KEY_JOIN_COLUMN = "primary-key-join-column"; //$NON-NLS-1$
- String ENTITY__INHERITANCE = "inheritance"; //$NON-NLS-1$
- String INHERITANCE__STRATEGY = "strategy"; //$NON-NLS-1$
- String ENTITY__DISCRIMINATOR_VALUE = "discriminator-value"; //$NON-NLS-1$
- String ENTITY__DISCRIMINATOR_COLUMN = "discriminator-column"; //$NON-NLS-1$
- String ENTITY__SEQUENCE_GENERATOR = "sequence-generator"; //$NON-NLS-1$
- String ENTITY__TABLE_GENERATOR = "table-generator"; //$NON-NLS-1$
- String ENTITY__NAMED_QUERY = "named-query"; //$NON-NLS-1$
- String ENTITY__NAMED_NATIVE_QUERY = "named-native-query"; //$NON-NLS-1$
- String ENTITY__SQL_RESULT_SET_MAPPING = "sql-result-set-mapping"; //$NON-NLS-1$
- String ENTITY__EXCLUDE_DEFAULT_LISTENERS = "exclude-default-listeners"; //$NON-NLS-1$
- String ENTITY__EXCLUDE_SUPERCLASS_LISTENERS = "exclude-superclass-listeners"; //$NON-NLS-1$
- String ENTITY__ENTITY_LISTENERS = "entity-listeners"; //$NON-NLS-1$
- String ENTITY__PRE_PERSIST = "pre-persist"; //$NON-NLS-1$
- String ENTITY__POST_PERSIST = "post-persist"; //$NON-NLS-1$
- String ENTITY__PRE_REMOVE = "pre-remove"; //$NON-NLS-1$
- String ENTITY__POST_REMOVE = "post-remove"; //$NON-NLS-1$
- String ENTITY__PRE_UPDATE = "pre-update"; //$NON-NLS-1$
- String ENTITY__POST_UPDATE = "post-update"; //$NON-NLS-1$
- String ENTITY__POST_LOAD = "post-load"; //$NON-NLS-1$
- String ENTITY__ATTRIBUTE_OVERRIDE = "attribute-override"; //$NON-NLS-1$
- String ENTITY__ASSOCIATION_OVERRIDE = "association-override"; //$NON-NLS-1$
-
- String ENTITY_MAPPINGS = "entity-mappings"; //$NON-NLS-1$
- String ENTITY_MAPPINGS__DESCRIPTION = "description"; //$NON-NLS-1$
- String ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA = "persistence-unit-metadata"; //$NON-NLS-1$
- String ENTITY_MAPPINGS__PACKAGE = "package"; //$NON-NLS-1$
- String ENTITY_MAPPINGS__SCHEMA = "schema"; //$NON-NLS-1$
- String ENTITY_MAPPINGS__CATALOG = "catalog"; //$NON-NLS-1$
- String ENTITY_MAPPINGS__ACCESS = "access"; //$NON-NLS-1$
- String ENTITY_MAPPINGS__SEQUENCE_GENERATOR = "sequence-generator"; //$NON-NLS-1$
- String ENTITY_MAPPINGS__TABLE_GENERATOR = "table-generator"; //$NON-NLS-1$
- String ENTITY_MAPPINGS__NAMED_QUERY = "named-query"; //$NON-NLS-1$
- String ENTITY_MAPPINGS__NAMED_NATIVE_QUERY = "named-native-query"; //$NON-NLS-1$
- String ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPING = "sql-result-set-mapping"; //$NON-NLS-1$
-
- String FETCH = "fetch"; //$NON-NLS-1$
- String JOIN_COLUMN = "join-column"; //$NON-NLS-1$
- String JOIN_TABLE = "join-table"; //$NON-NLS-1$
- String ID = "id"; //$NON-NLS-1$
- String ID__TEMPORAL = "temporal"; //$NON-NLS-1$
- String ID_CLASS = "id-class"; //$NON-NLS-1$
- String ID_CLASS__CLASS = "class"; //$NON-NLS-1$
-
- String GENERATED_VALUE = "generated-value"; //$NON-NLS-1$
- String GENERATED_VALUE__STRATEGY = "strategy"; //$NON-NLS-1$
- String GENERATED_VALUE__GENERATOR = "generator"; //$NON-NLS-1$
- String GENERATOR__NAME = "name"; //$NON-NLS-1$
- String GENERATOR__INITIAL_VALUE = "initial-value"; //$NON-NLS-1$
- String GENERATOR__ALLOCATION_SIZE = "allocation-size"; //$NON-NLS-1$
-
- String INVERSE_JOIN_COLUMN = "inverse-join-column"; //$NON-NLS-1$
- String LOB = "lob"; //$NON-NLS-1$
- String MANY_TO_MANY = "many-to-many"; //$NON-NLS-1$
- String MANY_TO_ONE = "many-to-one"; //$NON-NLS-1$
- String MAP_KEY = "map-key"; //$NON-NLS-1$
- String MAP_KEY__NAME = "name"; //$NON-NLS-1$
-
- String MAPPED_BY = "mapped-by"; //$NON-NLS-1$
- String MAPPED_SUPERCLASS = "mapped-superclass"; //$NON-NLS-1$
- String METADATA_COMPLETE = "metadata-complete"; //$NON-NLS-1$
- String NAME = "name"; //$NON-NLS-1$
-
- String NAMED_NATIVE_QUERY = "named-native-query"; //$NON-NLS-1$
- String NAMED_NATIVE_QUERY__NAME = "name"; //$NON-NLS-1$
- String NAMED_NATIVE_QUERY__QUERY = "query"; //$NON-NLS-1$
- String NAMED_NATIVE_QUERY__RESULT_CLASS = "result-class"; //$NON-NLS-1$
- String NAMED_NATIVE_QUERY__RESULT_SET_MAPPING = "result-set-mapping"; //$NON-NLS-1$
- String NAMED_NATIVE_QUERY__HINT = "hint"; //$NON-NLS-1$
-
- String NAMED_QUERY = "named-query"; //$NON-NLS-1$
- String NAMED_QUERY__NAME = "name"; //$NON-NLS-1$
- String NAMED_QUERY__QUERY = "query"; //$NON-NLS-1$
- String NAMED_QUERY__HINT = "hint"; //$NON-NLS-1$
-
- String QUERY_HINT__NAME = "name"; //$NON-NLS-1$
- String QUERY_HINT__VALUE = "value"; //$NON-NLS-1$
-
- String ONE_TO_MANY = "one-to-many"; //$NON-NLS-1$
- String ONE_TO_ONE = "one-to-one"; //$NON-NLS-1$
- String ONE_TO_ONE__PRIMARY_KEY_JOIN_COLUMNS = "primary-key-join-columns"; //$NON-NLS-1$
- String ONE_TO_ONE__JOIN_TABLE = "join-table"; //$NON-NLS-1$
-
- String OPTIONAL = "optional"; //$NON-NLS-1$
- String ORDER_BY = "order-by"; //$NON-NLS-1$
- String PACKAGE="package"; //$NON-NLS-1$
- String PERSISTENCE_UNIT_DEFAULTS="persistence-unit-defaults"; //$NON-NLS-1$
- String PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS="entity-listeners"; //$NON-NLS-1$
-
- String PERSISTENCE_UNIT_METADATA="persistence-unit-metadata"; //$NON-NLS-1$
- String REFERENCED_COLUMN_NAME="referenced-column-name"; //$NON-NLS-1$
- String SCHEMA="schema"; //$NON-NLS-1$
- String SECONDARY_TABLE = "secondary-table"; //$NON-NLS-1$
- String SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMN = "primary-key-join-column"; //$NON-NLS-1$
- String SEQUENCE_GENERATOR = "sequence-generator"; //$NON-NLS-1$
- String SEQUENCE_GENERATOR__SEQUENCE_NAME = "sequence-name"; //$NON-NLS-1$
-
- String TABLE_GENERATOR = "table-generator"; //$NON-NLS-1$
- String TABLE_GENERATOR__TABLE = "table"; //$NON-NLS-1$
- String TABLE_GENERATOR__CATALOG = "catalog"; //$NON-NLS-1$
- String TABLE_GENERATOR__SCHEMA = "schema"; //$NON-NLS-1$
- String TABLE_GENERATOR__PK_COLUMN_NAME = "pk-column-name"; //$NON-NLS-1$
- String TABLE_GENERATOR__VALUE_COLUMN_NAME = "value-column-name"; //$NON-NLS-1$
- String TABLE_GENERATOR__PK_COLUMN_VALUE = "pk-column-value"; //$NON-NLS-1$
- String TARGET_ENTITY = "target-entity"; //$NON-NLS-1$
- String TEMPORAL = "temporal"; //$NON-NLS-1$
- String TRANSIENT = "transient"; //$NON-NLS-1$
- String UNIQUE_CONSTRAINT = "unique-constraint"; //$NON-NLS-1$
- String UNIQUE_CONSTRAINT__COLUMN_NAME = "column-name"; //$NON-NLS-1$
- String VERSION = "version"; //$NON-NLS-1$
- String XML_MAPPING_METADATA_COMPLETE = "xml-mapping-metadata-complete"; //$NON-NLS-1$
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/PersistenceUnitDefaultsTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/PersistenceUnitDefaultsTranslator.java
deleted file mode 100644
index db6ff8ff9b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/PersistenceUnitDefaultsTranslator.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class PersistenceUnitDefaultsTranslator extends Translator implements OrmXmlMapper
-{
- private Translator[] children;
-
- private PersistenceUnitMetadata persistenceUnitMetadata;
-
- public PersistenceUnitDefaultsTranslator() {
- super(PERSISTENCE_UNIT_DEFAULTS, OrmPackage.eINSTANCE.getPersistenceUnitMetadataForXml_PersistenceUnitDefaultsForXml());
- }
-
- public Translator[] getChildren(Object target, int versionID) {
- if (this.children == null) {
- this.children = createChildren();
- }
- return this.children;
- }
-
- private Translator[] createChildren() {
- return new Translator[] {
- createSchemaTranslator(),
- createCatalogTranslator(),
- createAccessTranslator(),
- createCascadePersistTranslator(),
- createPlaceHolderTranslator(PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS),
- };
- }
-
- private Translator createPlaceHolderTranslator(String domNameAndPath) {
- return new Translator(domNameAndPath, (EStructuralFeature) null);
- }
-
- private Translator createSchemaTranslator() {
- return new Translator(SCHEMA, OrmPackage.eINSTANCE.getPersistenceUnitDefaultsForXml_SchemaForXml());
- }
-
- private Translator createCatalogTranslator() {
- return new Translator(CATALOG, OrmPackage.eINSTANCE.getPersistenceUnitDefaultsForXml_CatalogForXml());
- }
-
- private Translator createAccessTranslator() {
- return new AccessTypeElementTranslator(ACCESS, OrmPackage.eINSTANCE.getPersistenceUnitDefaultsForXml_AccessForXml(), NO_STYLE);
- }
-
- private Translator createCascadePersistTranslator() {
- return new EmptyTagBooleanTranslator(CASCADE_PERSIST, OrmPackage.eINSTANCE.getPersistenceUnitDefaultsForXml_CascadePersistForXml());
- }
-
- @Override
- //This is called when the persistence-unit-defaults tag is added
- //by hand through the xml editor. In this situation PersistenceUnitMetaData.persistenceUnitDefaultsForXml
- //is null and we don't want to create a new PersistenceUnitDefaults object, we just want to
- //reuse the one already created by our internal model
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return getPersistenceUnitMetadata().getPersistenceUnitDefaults();
- }
-
- private PersistenceUnitMetadata getPersistenceUnitMetadata() {
- return this.persistenceUnitMetadata;
- }
-
- void setPersistenceUnitMetadata(PersistenceUnitMetadata persistenceUnitMetadata) {
- this.persistenceUnitMetadata = persistenceUnitMetadata;
- }
-
- @Override
- //if my object has containtment = true then the translators clear out all adapters
- //even the ones it didn't add. if i have containtment = false then the translators
- //are not removing the adapter they added
- // the shared flag gets set when containment=true. isShared() is called in
- //EMF2DOMAdapterImpl.primUpdateMOFFeature which then calls removeMOFValue() if
- //isShared() returns false. removeMOFValue() removes the EMF2DOMSSEAdapter
- //and then since isContainment() = false the call to ExtendedEcoreUtil.unload(value);
- // does not occur. In that method the adapters are all cleared out thus my UI
- //no longer has listeners on the model. Talk to KFM about this and maybe
- //she'll remember the details. \
-
- //Need to enter a bug against the translators as well. Now one other
- //adapter is not being removed, the AnnotationsAdapter, this is being added by the translators
- //and never removed. not sure
- public boolean isShared() {
- return false;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/PersistenceUnitMetadataTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/PersistenceUnitMetadataTranslator.java
deleted file mode 100644
index a1244d89f9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/PersistenceUnitMetadataTranslator.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappings;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class PersistenceUnitMetadataTranslator extends Translator implements OrmXmlMapper
-{
- private Translator[] children;
-
- private PersistenceUnitDefaultsTranslator persistenceUnitDefaultsTranslator;
- private EntityMappings entityMappings;
-
- public PersistenceUnitMetadataTranslator() {
- super(PERSISTENCE_UNIT_METADATA, OrmPackage.eINSTANCE.getEntityMappingsForXml_PersistenceUnitMetadataForXml());
- }
-
- public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
- }
- return children;
- }
-
- private Translator[] createChildren() {
- return new Translator[] {
- createXmlMappingMetadataCompleteTranslator(),
- createPersistenceUnitDefaultsTranslator(),
- };
- }
-
- private Translator createXmlMappingMetadataCompleteTranslator() {
- return new EmptyTagBooleanTranslator(XML_MAPPING_METADATA_COMPLETE, OrmPackage.eINSTANCE.getPersistenceUnitMetadataForXml_XmlMappingMetadataCompleteForXml());
- }
-
- private Translator createPersistenceUnitDefaultsTranslator() {
- this.persistenceUnitDefaultsTranslator = new PersistenceUnitDefaultsTranslator();
- return this.persistenceUnitDefaultsTranslator;
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- PersistenceUnitMetadata persistenceUnitMetadata = getEntityMappings().getPersistenceUnitMetadata();
- this.persistenceUnitDefaultsTranslator.setPersistenceUnitMetadata(persistenceUnitMetadata);
- return persistenceUnitMetadata;
- }
-
- private EntityMappings getEntityMappings() {
- return this.entityMappings;
- }
-
- public void setEntityMappings(EntityMappings entityMappings) {
- this.entityMappings = entityMappings;
- }
-
- @Override
- //if my object has containtment = true then the translators clear out all adapters
- //even the ones it didn't add. if i have containtment = false then the translators
- //are not removing the adapter they added
- // the shared flag gets set when containment=true. isShared() is called in
- //EMF2DOMAdapterImpl.primUpdateMOFFeature which then calls removeMOFValue() if
- //isShared() returns false. removeMOFValue() removes the EMF2DOMSSEAdapter
- //and then since isContainment() = false the call to ExtendedEcoreUtil.unload(value);
- // does not occur. In that method the adapters are all cleared out thus my UI
- //no longer has listeners on the model. Talk to KFM about this and maybe
- //she'll remember the details. \
-
- //Need to enter a bug against the translators as well. Now one other
- //adapter is not being removed, the AnnotationsAdapter, this is being added by the translators
- //and never removed. not sure
- public boolean isShared() {
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/QueryHintTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/QueryHintTranslator.java
deleted file mode 100644
index 502440429f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/QueryHintTranslator.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class QueryHintTranslator extends Translator implements OrmXmlMapper
-{
- protected static final JpaCoreMappingsPackage MAPPINGS_PKG =
- JpaCoreMappingsPackage.eINSTANCE;
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
-
-
- private Translator[] children;
-
- public QueryHintTranslator(String domNameAndPath, EStructuralFeature aFeature) {
- super(domNameAndPath, aFeature, NO_STYLE);
- }
-
- public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
- }
- return children;
- }
-
-
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- createValueTranslator(),
- };
- }
-
- protected Translator createNameTranslator() {
- return new Translator(QUERY_HINT__NAME, MAPPINGS_PKG.getIQueryHint_Name(), DOM_ATTRIBUTE);
- }
-
- protected Translator createValueTranslator() {
- return new Translator(QUERY_HINT__VALUE, MAPPINGS_PKG.getIQueryHint_Value(), DOM_ATTRIBUTE);
- }
-
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return OrmFactory.eINSTANCE.createXmlQueryHint();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/RelationshipTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/RelationshipTranslator.java
deleted file mode 100644
index cee4d5218d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/RelationshipTranslator.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public abstract class RelationshipTranslator extends AttributeMappingTranslator
-{
- public RelationshipTranslator(String domNameAndPath) {
- super(domNameAndPath, NO_STYLE);
- }
-
- protected Translator createTargetEntityTranslator() {
- return new Translator(TARGET_ENTITY, JpaCoreMappingsPackage.eINSTANCE.getIRelationshipMapping_SpecifiedTargetEntity(), DOM_ATTRIBUTE);
- }
-
- //placeholder until we support in our model, this allow us
- //to keep the elements in the proper order
- protected Translator createCascadeTranslator() {
- return new CascadeTranslator(CASCADE , JpaCoreMappingsPackage.eINSTANCE.getIRelationshipMapping_Cascade());
- }
-
- protected Translator createMappedByTranslator() {
- return new Translator(MAPPED_BY, JpaCoreMappingsPackage.eINSTANCE.getINonOwningMapping_MappedBy(), DOM_ATTRIBUTE);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SecondaryTableTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SecondaryTableTranslator.java
deleted file mode 100644
index fe07d1aa64..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SecondaryTableTranslator.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.resource.PrimaryKeyJoinColumnTranslator.PrimaryKeyJoinColumnBuilder;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class SecondaryTableTranslator extends AbstractTableTranslator
-{
-
- private IEntity entity;
-
- private ISecondaryTable secondaryTable;
-
- public SecondaryTableTranslator() {
- super(SECONDARY_TABLE, MAPPINGS_PKG.getIEntity_SpecifiedSecondaryTables());
- }
-
-
- protected IEntity getEntity() {
- return this.entity;
- }
-
- void setEntity(IEntity entity) {
- this.entity = entity;
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- this.secondaryTable = getEntity().createSecondaryTable(0);
- return this.secondaryTable;
- }
-
-
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- createCatalogTranslator(),
- createSchemaTranslator(),
- createPrimaryKeyJoinColumnsTranslator(),
- createUniqueConstraintTranslator()
- };
- }
-
- protected Translator createPrimaryKeyJoinColumnsTranslator() {
- return new PrimaryKeyJoinColumnTranslator(
- SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMN,
- JpaCoreMappingsPackage.eINSTANCE.getISecondaryTable_SpecifiedPrimaryKeyJoinColumns(),
- buildPrimaryKeyJoinColumnsBuilder());
- }
-
- private PrimaryKeyJoinColumnBuilder buildPrimaryKeyJoinColumnsBuilder() {
- return new PrimaryKeyJoinColumnBuilder() {
- public IPrimaryKeyJoinColumn createPrimaryKeyJoinColumn() {
- return OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn(new ISecondaryTable.PrimaryKeyJoinColumnOwner(secondaryTable));
- }
- };
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SecondaryTablesTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SecondaryTablesTranslator.java
deleted file mode 100644
index 7819bf9ee0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SecondaryTablesTranslator.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.MultiObjectTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-/**
- * Created this class so there would be a 1-1 association between
- * SecondaryTable and SecondaryTableTranslator. Without this the state
- * stored on SecondaryTableTranslator will be invalid for multiple SecondaryTables.
- * see bug 188901.
- *
- * TODO 189767 - memory leak if a SecondaryTable is removed from the model, it is still
- * stored along with its translator in the translator map
- */
-public class SecondaryTablesTranslator extends MultiObjectTranslator implements OrmXmlMapper
-{
-
- private IEntity entity;
-
- private Map<EObject, SecondaryTableTranslator> translatorMap;
-
- protected static final JpaCoreMappingsPackage MAPPINGS_PKG =
- JpaCoreMappingsPackage.eINSTANCE;
-
- public SecondaryTablesTranslator() {
- super(SECONDARY_TABLE, MAPPINGS_PKG.getIEntity_SpecifiedSecondaryTables());
- this.translatorMap = new HashMap<EObject, SecondaryTableTranslator>();
- }
-
-
- protected IEntity getEntity() {
- return this.entity;
- }
-
- void setEntity(IEntity entity) {
- this.entity = entity;
- for (SecondaryTableTranslator translator : translatorMap.values()) {
- translator.setEntity(entity);
- }
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- SecondaryTableTranslator translator = (SecondaryTableTranslator) getDelegateFor(nodeName, readAheadName);
- EObject eObject = translator.createEMFObject(nodeName, readAheadName);
- this.translatorMap.put(eObject, translator);
- return eObject;
- }
-
- /* (non-Javadoc)
- * @see MultiObjectTranslator#getDelegateFor(EObject)
- */
- @Override
- public Translator getDelegateFor(EObject o) {
- Translator translator = translatorMap.get(o);
- if (translator != null) {
- return translator;
- }
-
- switch (o.eClass().getClassifierID()) {
- case OrmPackage.XML_SECONDARY_TABLE :
- SecondaryTableTranslator secondaryTableTranslator = new SecondaryTableTranslator();
- secondaryTableTranslator.setEntity(getEntity());
- return secondaryTableTranslator;
- }
-
- return null;
- }
-
- @Override
- public Translator getDelegateFor(String domName, String readAheadName) {
- if (domName.equals(SECONDARY_TABLE)) {
- SecondaryTableTranslator secondaryTableTranslator = new SecondaryTableTranslator();
- secondaryTableTranslator.setEntity(getEntity());
- return secondaryTableTranslator;
- }
- throw new IllegalStateException("Illegal dom name: " + domName); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SingleRelationshipTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SingleRelationshipTranslator.java
deleted file mode 100644
index c9291c8f7f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SingleRelationshipTranslator.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.resource.JoinColumnTranslator.JoinColumnBuilder;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public abstract class SingleRelationshipTranslator extends RelationshipTranslator
-{
- private ISingleRelationshipMapping singleRelationshipMapping;
-
- public SingleRelationshipTranslator(String domNameAndPath) {
- super(domNameAndPath);
- }
-
- @Override
- public final EObject createEMFObject(String nodeName, String readAheadName) {
- this.singleRelationshipMapping = createMapping();
- return this.singleRelationshipMapping;
- }
-
- protected abstract ISingleRelationshipMapping createMapping();
-
- protected Translator createFetchTypeTranslator() {
- return new EnumeratorTranslator(FETCH, JpaCoreMappingsPackage.eINSTANCE.getISingleRelationshipMapping_Fetch(), DOM_ATTRIBUTE);
- }
-
- protected Translator createOptionalTranslator() {
- return new BooleanEnumeratorTranslator(OPTIONAL, JpaCoreMappingsPackage.eINSTANCE.getISingleRelationshipMapping_Optional(), DOM_ATTRIBUTE);
- }
-
- protected Translator createJoinColumnsTranslator() {
- return new JoinColumnTranslator(
- JOIN_COLUMN,
- JpaCoreMappingsPackage.eINSTANCE.getISingleRelationshipMapping_SpecifiedJoinColumns(),
- buildJoinColumnsCreator());
- }
-
- private JoinColumnBuilder buildJoinColumnsCreator() {
- return new JoinColumnBuilder() {
- public IJoinColumn createJoinColumn() {
- return OrmFactory.eINSTANCE.createXmlJoinColumn(new ISingleRelationshipMapping.JoinColumnOwner(singleRelationshipMapping));
- }
- };
- }
-
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TableGeneratorTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TableGeneratorTranslator.java
deleted file mode 100644
index 2dfcdcbb3c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TableGeneratorTranslator.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class TableGeneratorTranslator extends GeneratorTranslator
-{
-
- public TableGeneratorTranslator(String domNameAndPath, EStructuralFeature aFeature) {
- super(domNameAndPath, aFeature, NO_STYLE);
- }
-
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- createTableTranslator(),
- createCatalogTranslator(),
- createSchemaTranslator(),
- createPkColumnNameTranslator(),
- createValueColumnNameTranslator(),
- createPkColumnValueTranslator(),
- createInitialValueTranslator(),
- createAllocationSizeTranslator(),
- createUniqueConstraintTranslator(),
- };
- }
-
- protected Translator createTableTranslator() {
- return new Translator(TABLE_GENERATOR__TABLE, MAPPINGS_PKG.getITableGenerator_SpecifiedTable(), DOM_ATTRIBUTE);
- }
-
- protected Translator createCatalogTranslator() {
- return new Translator(TABLE_GENERATOR__CATALOG, MAPPINGS_PKG.getITableGenerator_SpecifiedCatalog(), DOM_ATTRIBUTE);
- }
-
- protected Translator createSchemaTranslator() {
- return new Translator(TABLE_GENERATOR__SCHEMA, MAPPINGS_PKG.getITableGenerator_SpecifiedSchema(), DOM_ATTRIBUTE);
- }
-
- protected Translator createPkColumnNameTranslator() {
- return new Translator(TABLE_GENERATOR__PK_COLUMN_NAME, MAPPINGS_PKG.getITableGenerator_SpecifiedPkColumnName(), DOM_ATTRIBUTE);
- }
-
- protected Translator createValueColumnNameTranslator() {
- return new Translator(TABLE_GENERATOR__VALUE_COLUMN_NAME, MAPPINGS_PKG.getITableGenerator_SpecifiedValueColumnName(), DOM_ATTRIBUTE);
- }
-
- protected Translator createPkColumnValueTranslator() {
- return new Translator(TABLE_GENERATOR__PK_COLUMN_VALUE, MAPPINGS_PKG.getITableGenerator_SpecifiedPkColumnValue(), DOM_ATTRIBUTE);
- }
-
- protected Translator createUniqueConstraintTranslator() {
- return new Translator(UNIQUE_CONSTRAINT, (EStructuralFeature) null);
- //return new UniqueConstraintTranslator(UNIQUE_CONSTRAINT, MAPPINGS_PKG.getITableGenerator_UniqueConstraints());
- }
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return OrmFactory.eINSTANCE.createXmlTableGenerator();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TableTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TableTranslator.java
deleted file mode 100644
index 6cc6c213fd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TableTranslator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class TableTranslator extends AbstractTableTranslator
- implements OrmXmlMapper
-{
-
- private IEntity entity;
-
-
- public TableTranslator() {
- super(ENTITY__TABLE, JPA_CORE_XML_PKG.getXmlEntityForXml_TableForXml());
- }
-
- protected IEntity getEntity() {
- return this.entity;
- }
-
- void setEntity(IEntity entity) {
- this.entity = entity;
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return getEntity().getTable();
- }
-
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- createCatalogTranslator(),
- createSchemaTranslator(),
- createUniqueConstraintTranslator()
- };
- }
-
-
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TemporalTypeElementTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TemporalTypeElementTranslator.java
deleted file mode 100644
index 85597bcd74..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TemporalTypeElementTranslator.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.mappings.TemporalType;
-
-/**
- * There is a bug in the translator framework that causes
- * enumerators in xml elements and enumerators in xml attributes
- * to be treated differently. When the enumerator is an attribute
- * setting the model to the default causes the attribute to be removed.
- * With an element is causes the default literal to be placed in
- * the tag.
- *
- * The problem is wrapped up in the emf unsettable attribute as well.
- * For attributes the eIsSet method returns false for the default value
- * For elements the eIsSet method returns true for the default value.
- * I don't want to have to use the unsettable option in emf since that would
- * require that I call different api. I am not sure yet what the bug is in
- * the translator, so I have entered one ~KFM
- */
-public class TemporalTypeElementTranslator extends EnumeratorTranslator
-{
-
- public TemporalTypeElementTranslator(String domNameAndPath, EStructuralFeature aFeature, int style) {
- super(domNameAndPath, aFeature, style);
- }
-
- @Override
- public Object getMOFValue(EObject mofObject) {
- TemporalType type = (TemporalType) super.getMOFValue(mofObject);
- if (type == TemporalType.NULL) {
- return null;
- }
- return type;
- }
-
- @Override
- public List getMOFChildren(EObject mofObject) {
- List result = super.getMOFChildren(mofObject);
- if(result != null && result.size() > 0) {
- TemporalType type = (TemporalType) result.get(0);
- if(type.getValue() == TemporalType.NULL_VALUE)
- result = Collections.EMPTY_LIST;
- }
- return result;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TransientTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TransientTranslator.java
deleted file mode 100644
index 461c9babf1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TransientTranslator.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class TransientTranslator extends AttributeMappingTranslator
-{
- public TransientTranslator() {
- super(TRANSIENT, END_TAG_NO_INDENT);
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return JPA_CORE_XML_FACTORY.createXmlTransient();
- }
-
- @Override
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- };
- }
-
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TypeJavaClassTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TypeJavaClassTranslator.java
deleted file mode 100644
index cd392a6556..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TypeJavaClassTranslator.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.wst.common.internal.emf.resource.DependencyTranslator;
-
-public class TypeJavaClassTranslator extends DependencyTranslator
- implements OrmXmlMapper
-{
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
-
-
- public TypeJavaClassTranslator() {
- super(CLASS, JPA_CORE_XML_PKG.getXmlPersistentType_Class(),
- JPA_CORE_XML_PKG.getXmlTypeMapping_PersistentType());
- fStyle = DOM_ATTRIBUTE;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TypeMappingTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TypeMappingTranslator.java
deleted file mode 100644
index db34811c0a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TypeMappingTranslator.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public abstract class TypeMappingTranslator extends Translator
- implements OrmXmlMapper
-{
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
- protected static final OrmFactory JPA_CORE_XML_FACTORY =
- OrmFactory.eINSTANCE;
-
-
- private Translator[] children;
-
-
- public TypeMappingTranslator(String domNameAndPath) {
- super(domNameAndPath, JPA_CORE_XML_PKG.getEntityMappingsInternal_TypeMappings());
- dependencyFeature = JPA_CORE_XML_PKG.getXmlTypeMapping_PersistentType();
- }
-
-
- public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
- }
- return children;
- }
-
- protected abstract Translator[] createChildren();
-
- protected Translator createJavaClassTranslator() {
- return new TypeJavaClassTranslator();
- }
-
- protected Translator createMetadataCompleteTranslator() {
- return new BooleanEnumeratorTranslator(METADATA_COMPLETE, JPA_CORE_XML_PKG.getXmlTypeMapping_MetadataComplete(), DOM_ATTRIBUTE);
- }
-
- protected Translator createAccessTypeTranslator() {
- return new EnumeratorTranslator(ACCESS, JPA_CORE_XML_PKG.getXmlTypeMapping_SpecifiedAccess(), DOM_ATTRIBUTE);
- }
-
- protected Translator createPersistentAttributesTranslator() {
- return new AttributeMappingsTranslator();
- }
-
-
- protected Translator createPlaceHolderTranslator(String domNameAndPath) {
- return new Translator(domNameAndPath, (EStructuralFeature) null);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TypeMappingsTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TypeMappingsTranslator.java
deleted file mode 100644
index 7a66392e67..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/TypeMappingsTranslator.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.resource;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.wst.common.internal.emf.resource.MultiObjectTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class TypeMappingsTranslator extends MultiObjectTranslator
- implements OrmXmlMapper
-{
- public static final String ENTITY_MAPPINGS_PATH =
- MAPPED_SUPERCLASS + ',' + ENTITY + ',' + EMBEDDABLE;
-
- private static final OrmPackage JPA_CORE_XML_PKG = OrmPackage.eINSTANCE;
-
- private Map<EObject, Translator> translatorMap;
-
- public TypeMappingsTranslator() {
- super(ENTITY_MAPPINGS_PATH, JPA_CORE_XML_PKG.getEntityMappingsInternal_TypeMappings());
- this.translatorMap = new HashMap<EObject, Translator>();
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- Translator translator = getDelegateFor(nodeName, readAheadName);
- EObject eObject = translator.createEMFObject(nodeName, readAheadName);
- this.translatorMap.put(eObject, translator);
- return eObject;
- }
- /* (non-Javadoc)
- * @see MultiObjectTranslator#getDelegateFor(EObject)
- */
- @Override
- public Translator getDelegateFor(EObject o) {
- Translator translator = translatorMap.get(o);
- if (translator != null) {
- return translator;
- }
-
- switch (o.eClass().getClassifierID()) {
- case OrmPackage.XML_ENTITY_INTERNAL :
- translator = new EntityTranslator();
- ((EntityTranslator) translator).setEntity((IEntity) o);
- break;
- case OrmPackage.XML_MAPPED_SUPERCLASS:
- translator = new MappedSuperclassTranslator();
- break;
- case OrmPackage.XML_EMBEDDABLE:
- translator = new EmbeddableTranslator();
- break;
- }
- if (translator != null) {
- this.translatorMap.put(o, translator);
- }
-
- return translator;
- }
-
- @Override
- public Translator getDelegateFor(String domName, String readAheadName) {
- if (domName.equals(ENTITY)) {
- return new EntityTranslator();
- }
- if (domName.equals(MAPPED_SUPERCLASS)) {
- return new MappedSuperclassTranslator();
- }
- if (domName.equals(EMBEDDABLE)) {
- return new EmbeddableTranslator();
- }
- throw new IllegalStateException("Illegal dom name: " + domName); //$NON-NLS-1$
- }
-
- @Override
- public boolean isDependencyParent() {
- return true;
- }
-
- @Override
- public EStructuralFeature getDependencyFeature() {
- return JPA_CORE_XML_PKG.getXmlTypeMapping_PersistentType();
- }
-
- @Override
- public EObject basicGetDependencyObject(EObject parent) {
- Translator delegate = getDelegateFor(parent);
-
- if (delegate != null) {
- return delegate.basicGetDependencyObject(parent);
- }
- else {
- return super.basicGetDependencyObject(parent);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/UniqueConstraintTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/UniqueConstraintTranslator.java
deleted file mode 100644
index c450b192cb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/UniqueConstraintTranslator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class UniqueConstraintTranslator extends Translator implements OrmXmlMapper
-{
- protected static final JpaCoreMappingsPackage MAPPINGS_PKG =
- JpaCoreMappingsPackage.eINSTANCE;
-
-
- private Translator[] children;
-
-
- public UniqueConstraintTranslator() {
- super(UNIQUE_CONSTRAINT, MAPPINGS_PKG.getITable_UniqueConstraints());
- }
-
-
- public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
- }
- return children;
- }
-
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- creatColumnNamesTranslator(),
- };
- }
-
- protected Translator creatColumnNamesTranslator() {
- return new Translator(UNIQUE_CONSTRAINT__COLUMN_NAME, MAPPINGS_PKG.getIUniqueConstraint_ColumnNames());
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/VersionTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/VersionTranslator.java
deleted file mode 100644
index fd9619f2c7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/VersionTranslator.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.orm.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IVersion;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class VersionTranslator extends AttributeMappingTranslator
-{
- private ColumnTranslator columnTranslator;
-
- public VersionTranslator() {
- super(VERSION, NO_STYLE);
- this.columnTranslator = createColumnTranslator();
- }
-
- private ColumnTranslator createColumnTranslator() {
- return new ColumnTranslator(COLUMN, JPA_CORE_XML_PKG.getIXmlColumnMapping_ColumnForXml());
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- IVersion version = JPA_CORE_XML_FACTORY.createXmlVersion();
- setVersion(version);
- return version;
- }
-
- protected void setVersion(IVersion version) {
- this.columnTranslator.setColumnMapping(version);
- }
-
- @Override
- protected Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createNameTranslator(),
- columnTranslator,
- createTemporalTranslator(),
- };
- }
-
- private Translator createTemporalTranslator() {
- return new TemporalTypeElementTranslator(TEMPORAL, JpaCoreMappingsPackage.eINSTANCE.getIVersion_Temporal(), NO_STYLE);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/util/OrmAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/util/OrmAdapterFactory.java
deleted file mode 100644
index beaab2eb30..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/util/OrmAdapterFactory.java
+++ /dev/null
@@ -1,2384 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.util;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IJpaEObject;
-import org.eclipse.jpt.core.internal.IJpaRootContentNode;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.IXmlEObject;
-import org.eclipse.jpt.core.internal.JpaEObject;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn;
-import org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn;
-import org.eclipse.jpt.core.internal.content.orm.AbstractXmlQuery;
-import org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappings;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
-import org.eclipse.jpt.core.internal.content.orm.IXmlColumnMapping;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal;
-import org.eclipse.jpt.core.internal.content.orm.XmlAssociationOverride;
-import org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.internal.content.orm.XmlBasic;
-import org.eclipse.jpt.core.internal.content.orm.XmlCascade;
-import org.eclipse.jpt.core.internal.content.orm.XmlColumn;
-import org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.content.orm.XmlEmbeddable;
-import org.eclipse.jpt.core.internal.content.orm.XmlEmbedded;
-import org.eclipse.jpt.core.internal.content.orm.XmlEmbeddedId;
-import org.eclipse.jpt.core.internal.content.orm.XmlEntity;
-import org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml;
-import org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal;
-import org.eclipse.jpt.core.internal.content.orm.XmlGeneratedValue;
-import org.eclipse.jpt.core.internal.content.orm.XmlGenerator;
-import org.eclipse.jpt.core.internal.content.orm.XmlId;
-import org.eclipse.jpt.core.internal.content.orm.XmlIdClass;
-import org.eclipse.jpt.core.internal.content.orm.XmlInheritance;
-import org.eclipse.jpt.core.internal.content.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.internal.content.orm.XmlJoinTable;
-import org.eclipse.jpt.core.internal.content.orm.XmlManyToMany;
-import org.eclipse.jpt.core.internal.content.orm.XmlManyToOne;
-import org.eclipse.jpt.core.internal.content.orm.XmlMapKey;
-import org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass;
-import org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml;
-import org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal;
-import org.eclipse.jpt.core.internal.content.orm.XmlNamedNativeQuery;
-import org.eclipse.jpt.core.internal.content.orm.XmlNamedQuery;
-import org.eclipse.jpt.core.internal.content.orm.XmlNullAttributeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlOneToMany;
-import org.eclipse.jpt.core.internal.content.orm.XmlOneToOne;
-import org.eclipse.jpt.core.internal.content.orm.XmlOverride;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentType;
-import org.eclipse.jpt.core.internal.content.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.content.orm.XmlQueryHint;
-import org.eclipse.jpt.core.internal.content.orm.XmlRelationshipMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode;
-import org.eclipse.jpt.core.internal.content.orm.XmlSecondaryTable;
-import org.eclipse.jpt.core.internal.content.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.core.internal.content.orm.XmlSingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlTable;
-import org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator;
-import org.eclipse.jpt.core.internal.content.orm.XmlTransient;
-import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.core.internal.content.orm.XmlVersion;
-import org.eclipse.jpt.core.internal.mappings.IAbstractColumn;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.ICascade;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddable;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddedId;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
-import org.eclipse.jpt.core.internal.mappings.IGenerator;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.IManyToMany;
-import org.eclipse.jpt.core.internal.mappings.IManyToOne;
-import org.eclipse.jpt.core.internal.mappings.IMappedSuperclass;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedNativeQuery;
-import org.eclipse.jpt.core.internal.mappings.INamedQuery;
-import org.eclipse.jpt.core.internal.mappings.INonOwningMapping;
-import org.eclipse.jpt.core.internal.mappings.IOneToMany;
-import org.eclipse.jpt.core.internal.mappings.IOneToOne;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IQuery;
-import org.eclipse.jpt.core.internal.mappings.IQueryHint;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.mappings.ITransient;
-import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint;
-import org.eclipse.jpt.core.internal.mappings.IVersion;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Adapter Factory</b> for the model.
- * It provides an adapter <code>createXXX</code> method for each class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage
- * @generated
- */
-public class OrmAdapterFactory extends AdapterFactoryImpl
-{
- /**
- * The cached model package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static OrmPackage modelPackage;
-
- /**
- * Creates an instance of the adapter factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public OrmAdapterFactory() {
- if (modelPackage == null) {
- modelPackage = OrmPackage.eINSTANCE;
- }
- }
-
- /**
- * Returns whether this factory is applicable for the type of the object.
- * <!-- begin-user-doc -->
- * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
- * <!-- end-user-doc -->
- * @return whether this factory is applicable for the type of the object.
- * @generated
- */
- @Override
- public boolean isFactoryForType(Object object) {
- if (object == modelPackage) {
- return true;
- }
- if (object instanceof EObject) {
- return ((EObject) object).eClass().getEPackage() == modelPackage;
- }
- return false;
- }
-
- /**
- * The switch the delegates to the <code>createXXX</code> methods.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected OrmSwitch<Adapter> modelSwitch = new OrmSwitch<Adapter>() {
- @Override
- public Adapter caseXmlRootContentNode(XmlRootContentNode object) {
- return createXmlRootContentNodeAdapter();
- }
-
- @Override
- public Adapter caseEntityMappingsInternal(EntityMappingsInternal object) {
- return createEntityMappingsInternalAdapter();
- }
-
- @Override
- public Adapter caseEntityMappings(EntityMappings object) {
- return createEntityMappingsAdapter();
- }
-
- @Override
- public Adapter caseEntityMappingsForXml(EntityMappingsForXml object) {
- return createEntityMappingsForXmlAdapter();
- }
-
- @Override
- public Adapter caseXmlTypeMapping(XmlTypeMapping object) {
- return createXmlTypeMappingAdapter();
- }
-
- @Override
- public Adapter caseXmlPersistentType(XmlPersistentType object) {
- return createXmlPersistentTypeAdapter();
- }
-
- @Override
- public Adapter caseXmlMappedSuperclass(XmlMappedSuperclass object) {
- return createXmlMappedSuperclassAdapter();
- }
-
- @Override
- public Adapter caseXmlEntityInternal(XmlEntityInternal object) {
- return createXmlEntityInternalAdapter();
- }
-
- @Override
- public Adapter caseXmlEntityForXml(XmlEntityForXml object) {
- return createXmlEntityForXmlAdapter();
- }
-
- @Override
- public Adapter caseXmlEntity(XmlEntity object) {
- return createXmlEntityAdapter();
- }
-
- @Override
- public Adapter caseXmlEmbeddable(XmlEmbeddable object) {
- return createXmlEmbeddableAdapter();
- }
-
- @Override
- public Adapter caseXmlAttributeMapping(XmlAttributeMapping object) {
- return createXmlAttributeMappingAdapter();
- }
-
- @Override
- public Adapter caseXmlNullAttributeMapping(XmlNullAttributeMapping object) {
- return createXmlNullAttributeMappingAdapter();
- }
-
- @Override
- public Adapter caseXmlBasic(XmlBasic object) {
- return createXmlBasicAdapter();
- }
-
- @Override
- public Adapter caseXmlId(XmlId object) {
- return createXmlIdAdapter();
- }
-
- @Override
- public Adapter caseXmlTransient(XmlTransient object) {
- return createXmlTransientAdapter();
- }
-
- @Override
- public Adapter caseXmlEmbedded(XmlEmbedded object) {
- return createXmlEmbeddedAdapter();
- }
-
- @Override
- public Adapter caseXmlEmbeddedId(XmlEmbeddedId object) {
- return createXmlEmbeddedIdAdapter();
- }
-
- @Override
- public Adapter caseXmlVersion(XmlVersion object) {
- return createXmlVersionAdapter();
- }
-
- @Override
- public Adapter caseXmlMultiRelationshipMappingInternal(XmlMultiRelationshipMappingInternal object) {
- return createXmlMultiRelationshipMappingInternalAdapter();
- }
-
- @Override
- public Adapter caseXmlMultiRelationshipMappingForXml(XmlMultiRelationshipMappingForXml object) {
- return createXmlMultiRelationshipMappingForXmlAdapter();
- }
-
- @Override
- public Adapter caseXmlMultiRelationshipMapping(XmlMultiRelationshipMapping object) {
- return createXmlMultiRelationshipMappingAdapter();
- }
-
- @Override
- public Adapter caseXmlOneToMany(XmlOneToMany object) {
- return createXmlOneToManyAdapter();
- }
-
- @Override
- public Adapter caseXmlManyToMany(XmlManyToMany object) {
- return createXmlManyToManyAdapter();
- }
-
- @Override
- public Adapter caseXmlPersistentAttribute(XmlPersistentAttribute object) {
- return createXmlPersistentAttributeAdapter();
- }
-
- @Override
- public Adapter casePersistenceUnitMetadataInternal(PersistenceUnitMetadataInternal object) {
- return createPersistenceUnitMetadataInternalAdapter();
- }
-
- @Override
- public Adapter casePersistenceUnitMetadata(PersistenceUnitMetadata object) {
- return createPersistenceUnitMetadataAdapter();
- }
-
- @Override
- public Adapter casePersistenceUnitMetadataForXml(PersistenceUnitMetadataForXml object) {
- return createPersistenceUnitMetadataForXmlAdapter();
- }
-
- @Override
- public Adapter casePersistenceUnitDefaultsInternal(PersistenceUnitDefaultsInternal object) {
- return createPersistenceUnitDefaultsInternalAdapter();
- }
-
- @Override
- public Adapter casePersistenceUnitDefaults(PersistenceUnitDefaults object) {
- return createPersistenceUnitDefaultsAdapter();
- }
-
- @Override
- public Adapter casePersistenceUnitDefaultsForXml(PersistenceUnitDefaultsForXml object) {
- return createPersistenceUnitDefaultsForXmlAdapter();
- }
-
- @Override
- public Adapter caseXmlTable(XmlTable object) {
- return createXmlTableAdapter();
- }
-
- @Override
- public Adapter caseAbstractXmlNamedColumn(AbstractXmlNamedColumn object) {
- return createAbstractXmlNamedColumnAdapter();
- }
-
- @Override
- public Adapter caseAbstractXmlColumn(AbstractXmlColumn object) {
- return createAbstractXmlColumnAdapter();
- }
-
- @Override
- public Adapter caseXmlColumn(XmlColumn object) {
- return createXmlColumnAdapter();
- }
-
- @Override
- public Adapter caseXmlJoinColumn(XmlJoinColumn object) {
- return createXmlJoinColumnAdapter();
- }
-
- @Override
- public Adapter caseIXmlColumnMapping(IXmlColumnMapping object) {
- return createIXmlColumnMappingAdapter();
- }
-
- @Override
- public Adapter caseXmlManyToOne(XmlManyToOne object) {
- return createXmlManyToOneAdapter();
- }
-
- @Override
- public Adapter caseXmlOneToOne(XmlOneToOne object) {
- return createXmlOneToOneAdapter();
- }
-
- @Override
- public Adapter caseXmlSingleRelationshipMapping(XmlSingleRelationshipMapping object) {
- return createXmlSingleRelationshipMappingAdapter();
- }
-
- @Override
- public Adapter caseXmlRelationshipMapping(XmlRelationshipMapping object) {
- return createXmlRelationshipMappingAdapter();
- }
-
- @Override
- public Adapter caseXmlJoinTable(XmlJoinTable object) {
- return createXmlJoinTableAdapter();
- }
-
- @Override
- public Adapter caseAbstractXmlTable(AbstractXmlTable object) {
- return createAbstractXmlTableAdapter();
- }
-
- @Override
- public Adapter caseXmlOverride(XmlOverride object) {
- return createXmlOverrideAdapter();
- }
-
- @Override
- public Adapter caseXmlAttributeOverride(XmlAttributeOverride object) {
- return createXmlAttributeOverrideAdapter();
- }
-
- @Override
- public Adapter caseXmlAssociationOverride(XmlAssociationOverride object) {
- return createXmlAssociationOverrideAdapter();
- }
-
- @Override
- public Adapter caseXmlDiscriminatorColumn(XmlDiscriminatorColumn object) {
- return createXmlDiscriminatorColumnAdapter();
- }
-
- @Override
- public Adapter caseXmlSecondaryTable(XmlSecondaryTable object) {
- return createXmlSecondaryTableAdapter();
- }
-
- @Override
- public Adapter caseXmlPrimaryKeyJoinColumn(XmlPrimaryKeyJoinColumn object) {
- return createXmlPrimaryKeyJoinColumnAdapter();
- }
-
- @Override
- public Adapter caseXmlGeneratedValue(XmlGeneratedValue object) {
- return createXmlGeneratedValueAdapter();
- }
-
- @Override
- public Adapter caseXmlGenerator(XmlGenerator object) {
- return createXmlGeneratorAdapter();
- }
-
- @Override
- public Adapter caseXmlSequenceGenerator(XmlSequenceGenerator object) {
- return createXmlSequenceGeneratorAdapter();
- }
-
- @Override
- public Adapter caseXmlTableGenerator(XmlTableGenerator object) {
- return createXmlTableGeneratorAdapter();
- }
-
- @Override
- public Adapter caseAbstractXmlQuery(AbstractXmlQuery object) {
- return createAbstractXmlQueryAdapter();
- }
-
- @Override
- public Adapter caseXmlNamedQuery(XmlNamedQuery object) {
- return createXmlNamedQueryAdapter();
- }
-
- @Override
- public Adapter caseXmlNamedNativeQuery(XmlNamedNativeQuery object) {
- return createXmlNamedNativeQueryAdapter();
- }
-
- @Override
- public Adapter caseXmlQueryHint(XmlQueryHint object) {
- return createXmlQueryHintAdapter();
- }
-
- @Override
- public Adapter caseXmlUniqueConstraint(XmlUniqueConstraint object) {
- return createXmlUniqueConstraintAdapter();
- }
-
- @Override
- public Adapter caseXmlCascade(XmlCascade object) {
- return createXmlCascadeAdapter();
- }
-
- @Override
- public Adapter caseXmlIdClass(XmlIdClass object) {
- return createXmlIdClassAdapter();
- }
-
- @Override
- public Adapter caseXmlInheritance(XmlInheritance object) {
- return createXmlInheritanceAdapter();
- }
-
- @Override
- public Adapter caseXmlMapKey(XmlMapKey object) {
- return createXmlMapKeyAdapter();
- }
-
- @Override
- public Adapter caseIJpaEObject(IJpaEObject object) {
- return createIJpaEObjectAdapter();
- }
-
- @Override
- public Adapter caseJpaEObject(JpaEObject object) {
- return createJpaEObjectAdapter();
- }
-
- @Override
- public Adapter caseIJpaSourceObject(IJpaSourceObject object) {
- return createIJpaSourceObjectAdapter();
- }
-
- @Override
- public Adapter caseIXmlEObject(IXmlEObject object) {
- return createIXmlEObjectAdapter();
- }
-
- @Override
- public Adapter caseXmlEObject(XmlEObject object) {
- return createXmlEObjectAdapter();
- }
-
- @Override
- public Adapter caseIJpaContentNode(IJpaContentNode object) {
- return createIJpaContentNodeAdapter();
- }
-
- @Override
- public Adapter caseIJpaRootContentNode(IJpaRootContentNode object) {
- return createIJpaRootContentNodeAdapter();
- }
-
- @Override
- public Adapter caseITypeMapping(ITypeMapping object) {
- return createITypeMappingAdapter();
- }
-
- @Override
- public Adapter caseIPersistentType(IPersistentType object) {
- return createIPersistentTypeAdapter();
- }
-
- @Override
- public Adapter caseIMappedSuperclass(IMappedSuperclass object) {
- return createIMappedSuperclassAdapter();
- }
-
- @Override
- public Adapter caseIEntity(IEntity object) {
- return createIEntityAdapter();
- }
-
- @Override
- public Adapter caseIEmbeddable(IEmbeddable object) {
- return createIEmbeddableAdapter();
- }
-
- @Override
- public Adapter caseIAttributeMapping(IAttributeMapping object) {
- return createIAttributeMappingAdapter();
- }
-
- @Override
- public Adapter caseIColumnMapping(IColumnMapping object) {
- return createIColumnMappingAdapter();
- }
-
- @Override
- public Adapter caseIBasic(IBasic object) {
- return createIBasicAdapter();
- }
-
- @Override
- public Adapter caseIId(IId object) {
- return createIIdAdapter();
- }
-
- @Override
- public Adapter caseITransient(ITransient object) {
- return createITransientAdapter();
- }
-
- @Override
- public Adapter caseIEmbedded(IEmbedded object) {
- return createIEmbeddedAdapter();
- }
-
- @Override
- public Adapter caseIEmbeddedId(IEmbeddedId object) {
- return createIEmbeddedIdAdapter();
- }
-
- @Override
- public Adapter caseIVersion(IVersion object) {
- return createIVersionAdapter();
- }
-
- @Override
- public Adapter caseIRelationshipMapping(IRelationshipMapping object) {
- return createIRelationshipMappingAdapter();
- }
-
- @Override
- public Adapter caseINonOwningMapping(INonOwningMapping object) {
- return createINonOwningMappingAdapter();
- }
-
- @Override
- public Adapter caseIMultiRelationshipMapping(IMultiRelationshipMapping object) {
- return createIMultiRelationshipMappingAdapter();
- }
-
- @Override
- public Adapter caseIOneToMany(IOneToMany object) {
- return createIOneToManyAdapter();
- }
-
- @Override
- public Adapter caseIManyToMany(IManyToMany object) {
- return createIManyToManyAdapter();
- }
-
- @Override
- public Adapter caseIPersistentAttribute(IPersistentAttribute object) {
- return createIPersistentAttributeAdapter();
- }
-
- @Override
- public Adapter caseITable(ITable object) {
- return createITableAdapter();
- }
-
- @Override
- public Adapter caseINamedColumn(INamedColumn object) {
- return createINamedColumnAdapter();
- }
-
- @Override
- public Adapter caseIAbstractColumn(IAbstractColumn object) {
- return createIAbstractColumnAdapter();
- }
-
- @Override
- public Adapter caseIColumn(IColumn object) {
- return createIColumnAdapter();
- }
-
- @Override
- public Adapter caseIAbstractJoinColumn(IAbstractJoinColumn object) {
- return createIAbstractJoinColumnAdapter();
- }
-
- @Override
- public Adapter caseIJoinColumn(IJoinColumn object) {
- return createIJoinColumnAdapter();
- }
-
- @Override
- public Adapter caseISingleRelationshipMapping(ISingleRelationshipMapping object) {
- return createISingleRelationshipMappingAdapter();
- }
-
- @Override
- public Adapter caseIManyToOne(IManyToOne object) {
- return createIManyToOneAdapter();
- }
-
- @Override
- public Adapter caseIOneToOne(IOneToOne object) {
- return createIOneToOneAdapter();
- }
-
- @Override
- public Adapter caseIJoinTable(IJoinTable object) {
- return createIJoinTableAdapter();
- }
-
- @Override
- public Adapter caseIOverride(IOverride object) {
- return createIOverrideAdapter();
- }
-
- @Override
- public Adapter caseIAttributeOverride(IAttributeOverride object) {
- return createIAttributeOverrideAdapter();
- }
-
- @Override
- public Adapter caseIAssociationOverride(IAssociationOverride object) {
- return createIAssociationOverrideAdapter();
- }
-
- @Override
- public Adapter caseIDiscriminatorColumn(IDiscriminatorColumn object) {
- return createIDiscriminatorColumnAdapter();
- }
-
- @Override
- public Adapter caseISecondaryTable(ISecondaryTable object) {
- return createISecondaryTableAdapter();
- }
-
- @Override
- public Adapter caseIPrimaryKeyJoinColumn(IPrimaryKeyJoinColumn object) {
- return createIPrimaryKeyJoinColumnAdapter();
- }
-
- @Override
- public Adapter caseIGeneratedValue(IGeneratedValue object) {
- return createIGeneratedValueAdapter();
- }
-
- @Override
- public Adapter caseIGenerator(IGenerator object) {
- return createIGeneratorAdapter();
- }
-
- @Override
- public Adapter caseISequenceGenerator(ISequenceGenerator object) {
- return createISequenceGeneratorAdapter();
- }
-
- @Override
- public Adapter caseITableGenerator(ITableGenerator object) {
- return createITableGeneratorAdapter();
- }
-
- @Override
- public Adapter caseIQuery(IQuery object) {
- return createIQueryAdapter();
- }
-
- @Override
- public Adapter caseINamedQuery(INamedQuery object) {
- return createINamedQueryAdapter();
- }
-
- @Override
- public Adapter caseINamedNativeQuery(INamedNativeQuery object) {
- return createINamedNativeQueryAdapter();
- }
-
- @Override
- public Adapter caseIQueryHint(IQueryHint object) {
- return createIQueryHintAdapter();
- }
-
- @Override
- public Adapter caseIUniqueConstraint(IUniqueConstraint object) {
- return createIUniqueConstraintAdapter();
- }
-
- @Override
- public Adapter caseICascade(ICascade object) {
- return createICascadeAdapter();
- }
-
- @Override
- public Adapter defaultCase(EObject object) {
- return createEObjectAdapter();
- }
- };
-
- /**
- * Creates an adapter for the <code>target</code>.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param target the object to adapt.
- * @return the adapter for the <code>target</code>.
- * @generated
- */
- @Override
- public Adapter createAdapter(Notifier target) {
- return modelSwitch.doSwitch((EObject) target);
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.XmlEObject <em>Xml EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.XmlEObject
- * @generated
- */
- public Adapter createXmlEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode <em>Xml Root Content Node</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode
- * @generated
- */
- public Adapter createXmlRootContentNodeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal <em>Entity Mappings Internal</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal
- * @generated
- */
- public Adapter createEntityMappingsInternalAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappings <em>Entity Mappings</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappings
- * @generated
- */
- public Adapter createEntityMappingsAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml <em>Entity Mappings For Xml</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml
- * @generated
- */
- public Adapter createEntityMappingsForXmlAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping <em>Xml Type Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping
- * @generated
- */
- public Adapter createXmlTypeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType <em>Xml Persistent Type</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPersistentType
- * @generated
- */
- public Adapter createXmlPersistentTypeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntity <em>Xml Entity</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntity
- * @generated
- */
- public Adapter createXmlEntityAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlEmbeddable <em>Xml Embeddable</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEmbeddable
- * @generated
- */
- public Adapter createXmlEmbeddableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping <em>Xml Attribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping
- * @generated
- */
- public Adapter createXmlAttributeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlNullAttributeMapping <em>Xml Null Attribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlNullAttributeMapping
- * @generated
- */
- public Adapter createXmlNullAttributeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute <em>Xml Persistent Attribute</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute
- * @generated
- */
- public Adapter createXmlPersistentAttributeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlBasic <em>Xml Basic</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlBasic
- * @generated
- */
- public Adapter createXmlBasicAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlId <em>Xml Id</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlId
- * @generated
- */
- public Adapter createXmlIdAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlTransient <em>Xml Transient</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTransient
- * @generated
- */
- public Adapter createXmlTransientAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlEmbedded <em>Xml Embedded</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEmbedded
- * @generated
- */
- public Adapter createXmlEmbeddedAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlEmbeddedId <em>Xml Embedded Id</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEmbeddedId
- * @generated
- */
- public Adapter createXmlEmbeddedIdAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlVersion <em>Xml Version</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlVersion
- * @generated
- */
- public Adapter createXmlVersionAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal <em>Xml Multi Relationship Mapping Internal</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal
- * @generated
- */
- public Adapter createXmlMultiRelationshipMappingInternalAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml <em>Xml Multi Relationship Mapping For Xml</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml
- * @generated
- */
- public Adapter createXmlMultiRelationshipMappingForXmlAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMapping <em>Xml Multi Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMapping
- * @generated
- */
- public Adapter createXmlMultiRelationshipMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlOneToMany <em>Xml One To Many</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlOneToMany
- * @generated
- */
- public Adapter createXmlOneToManyAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlManyToMany <em>Xml Many To Many</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlManyToMany
- * @generated
- */
- public Adapter createXmlManyToManyAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal <em>Persistence Unit Metadata Internal</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal
- * @generated
- */
- public Adapter createPersistenceUnitMetadataInternalAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata <em>Persistence Unit Metadata</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata
- * @generated
- */
- public Adapter createPersistenceUnitMetadataAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml <em>Persistence Unit Metadata For Xml</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml
- * @generated
- */
- public Adapter createPersistenceUnitMetadataForXmlAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal <em>Persistence Unit Defaults Internal</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal
- * @generated
- */
- public Adapter createPersistenceUnitDefaultsInternalAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults <em>Persistence Unit Defaults</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults
- * @generated
- */
- public Adapter createPersistenceUnitDefaultsAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml <em>Persistence Unit Defaults For Xml</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml
- * @generated
- */
- public Adapter createPersistenceUnitDefaultsForXmlAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlTable <em>Xml Table</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTable
- * @generated
- */
- public Adapter createXmlTableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn <em>Abstract Xml Named Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn
- * @generated
- */
- public Adapter createAbstractXmlNamedColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn <em>Abstract Xml Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn
- * @generated
- */
- public Adapter createAbstractXmlColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlColumn <em>Xml Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlColumn
- * @generated
- */
- public Adapter createXmlColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlJoinColumn <em>Xml Join Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlJoinColumn
- * @generated
- */
- public Adapter createXmlJoinColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.IXmlColumnMapping <em>IXml Column Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.IXmlColumnMapping
- * @generated
- */
- public Adapter createIXmlColumnMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlManyToOne <em>Xml Many To One</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlManyToOne
- * @generated
- */
- public Adapter createXmlManyToOneAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlOneToOne <em>Xml One To One</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlOneToOne
- * @generated
- */
- public Adapter createXmlOneToOneAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlSingleRelationshipMapping <em>Xml Single Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlSingleRelationshipMapping
- * @generated
- */
- public Adapter createXmlSingleRelationshipMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlRelationshipMapping <em>Xml Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlRelationshipMapping
- * @generated
- */
- public Adapter createXmlRelationshipMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlJoinTable <em>Xml Join Table</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlJoinTable
- * @generated
- */
- public Adapter createXmlJoinTableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable <em>Abstract Xml Table</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable
- * @generated
- */
- public Adapter createAbstractXmlTableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlOverride <em>Xml Override</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlOverride
- * @generated
- */
- public Adapter createXmlOverrideAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlAttributeOverride <em>Xml Attribute Override</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlAttributeOverride
- * @generated
- */
- public Adapter createXmlAttributeOverrideAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlAssociationOverride <em>Xml Association Override</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlAssociationOverride
- * @generated
- */
- public Adapter createXmlAssociationOverrideAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn <em>Xml Discriminator Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn
- * @generated
- */
- public Adapter createXmlDiscriminatorColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlSecondaryTable <em>Xml Secondary Table</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlSecondaryTable
- * @generated
- */
- public Adapter createXmlSecondaryTableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlPrimaryKeyJoinColumn <em>Xml Primary Key Join Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlPrimaryKeyJoinColumn
- * @generated
- */
- public Adapter createXmlPrimaryKeyJoinColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlGeneratedValue <em>Xml Generated Value</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlGeneratedValue
- * @generated
- */
- public Adapter createXmlGeneratedValueAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlGenerator <em>Xml Generator</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlGenerator
- * @generated
- */
- public Adapter createXmlGeneratorAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlSequenceGenerator <em>Xml Sequence Generator</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlSequenceGenerator
- * @generated
- */
- public Adapter createXmlSequenceGeneratorAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator <em>Xml Table Generator</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator
- * @generated
- */
- public Adapter createXmlTableGeneratorAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlQuery <em>Abstract Xml Query</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.AbstractXmlQuery
- * @generated
- */
- public Adapter createAbstractXmlQueryAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlNamedQuery <em>Xml Named Query</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlNamedQuery
- * @generated
- */
- public Adapter createXmlNamedQueryAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlNamedNativeQuery <em>Xml Named Native Query</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlNamedNativeQuery
- * @generated
- */
- public Adapter createXmlNamedNativeQueryAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlQueryHint <em>Xml Query Hint</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlQueryHint
- * @generated
- */
- public Adapter createXmlQueryHintAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlUniqueConstraint <em>Xml Unique Constraint</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlUniqueConstraint
- * @generated
- */
- public Adapter createXmlUniqueConstraintAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlCascade <em>Xml Cascade</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlCascade
- * @generated
- */
- public Adapter createXmlCascadeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlIdClass <em>Xml Id Class</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlIdClass
- * @generated
- */
- public Adapter createXmlIdClassAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlInheritance <em>Xml Inheritance</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlInheritance
- * @generated
- */
- public Adapter createXmlInheritanceAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlMapKey <em>Xml Map Key</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMapKey
- * @generated
- */
- public Adapter createXmlMapKeyAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaEObject <em>IJpa EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaEObject
- * @generated
- */
- public Adapter createIJpaEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.JpaEObject <em>Jpa EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.JpaEObject
- * @generated
- */
- public Adapter createJpaEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaSourceObject <em>IJpa Source Object</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaSourceObject
- * @generated
- */
- public Adapter createIJpaSourceObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IXmlEObject <em>IXml EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IXmlEObject
- * @generated
- */
- public Adapter createIXmlEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaContentNode <em>IJpa Content Node</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaContentNode
- * @generated
- */
- public Adapter createIJpaContentNodeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaRootContentNode <em>IJpa Root Content Node</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaRootContentNode
- * @generated
- */
- public Adapter createIJpaRootContentNodeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass <em>Xml Mapped Superclass</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass
- * @generated
- */
- public Adapter createXmlMappedSuperclassAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal <em>Xml Entity Internal</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal
- * @generated
- */
- public Adapter createXmlEntityInternalAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml <em>Xml Entity For Xml</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml
- * @generated
- */
- public Adapter createXmlEntityForXmlAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IAttributeMapping <em>IAttribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IAttributeMapping
- * @generated
- */
- public Adapter createIAttributeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IColumnMapping <em>IColumn Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IColumnMapping
- * @generated
- */
- public Adapter createIColumnMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IPersistentAttribute <em>IPersistent Attribute</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IPersistentAttribute
- * @generated
- */
- public Adapter createIPersistentAttributeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ITable <em>ITable</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ITable
- * @generated
- */
- public Adapter createITableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.INamedColumn <em>INamed Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.INamedColumn
- * @generated
- */
- public Adapter createINamedColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn <em>IAbstract Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractColumn
- * @generated
- */
- public Adapter createIAbstractColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IColumn <em>IColumn</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IColumn
- * @generated
- */
- public Adapter createIColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn <em>IAbstract Join Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn
- * @generated
- */
- public Adapter createIAbstractJoinColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IJoinColumn <em>IJoin Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IJoinColumn
- * @generated
- */
- public Adapter createIJoinColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping <em>ISingle Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping
- * @generated
- */
- public Adapter createISingleRelationshipMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IManyToOne <em>IMany To One</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IManyToOne
- * @generated
- */
- public Adapter createIManyToOneAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IOneToOne <em>IOne To One</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IOneToOne
- * @generated
- */
- public Adapter createIOneToOneAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IJoinTable <em>IJoin Table</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IJoinTable
- * @generated
- */
- public Adapter createIJoinTableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IOverride <em>IOverride</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IOverride
- * @generated
- */
- public Adapter createIOverrideAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride <em>IAttribute Override</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IAttributeOverride
- * @generated
- */
- public Adapter createIAttributeOverrideAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride <em>IAssociation Override</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IAssociationOverride
- * @generated
- */
- public Adapter createIAssociationOverrideAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn <em>IDiscriminator Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn
- * @generated
- */
- public Adapter createIDiscriminatorColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable <em>ISecondary Table</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ISecondaryTable
- * @generated
- */
- public Adapter createISecondaryTableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn <em>IPrimary Key Join Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn
- * @generated
- */
- public Adapter createIPrimaryKeyJoinColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IGeneratedValue <em>IGenerated Value</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IGeneratedValue
- * @generated
- */
- public Adapter createIGeneratedValueAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IGenerator <em>IGenerator</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IGenerator
- * @generated
- */
- public Adapter createIGeneratorAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ISequenceGenerator <em>ISequence Generator</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ISequenceGenerator
- * @generated
- */
- public Adapter createISequenceGeneratorAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator <em>ITable Generator</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator
- * @generated
- */
- public Adapter createITableGeneratorAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IQuery <em>IQuery</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IQuery
- * @generated
- */
- public Adapter createIQueryAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.INamedQuery <em>INamed Query</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.INamedQuery
- * @generated
- */
- public Adapter createINamedQueryAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.INamedNativeQuery <em>INamed Native Query</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.INamedNativeQuery
- * @generated
- */
- public Adapter createINamedNativeQueryAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IQueryHint <em>IQuery Hint</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IQueryHint
- * @generated
- */
- public Adapter createIQueryHintAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IUniqueConstraint <em>IUnique Constraint</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IUniqueConstraint
- * @generated
- */
- public Adapter createIUniqueConstraintAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ICascade <em>ICascade</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ICascade
- * @generated
- */
- public Adapter createICascadeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IBasic <em>IBasic</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IBasic
- * @generated
- */
- public Adapter createIBasicAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IId <em>IId</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IId
- * @generated
- */
- public Adapter createIIdAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ITransient <em>ITransient</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ITransient
- * @generated
- */
- public Adapter createITransientAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IEmbedded <em>IEmbedded</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IEmbedded
- * @generated
- */
- public Adapter createIEmbeddedAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IEmbeddedId <em>IEmbedded Id</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IEmbeddedId
- * @generated
- */
- public Adapter createIEmbeddedIdAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IVersion <em>IVersion</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IVersion
- * @generated
- */
- public Adapter createIVersionAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping <em>IRelationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IRelationshipMapping
- * @generated
- */
- public Adapter createIRelationshipMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.INonOwningMapping <em>INon Owning Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.INonOwningMapping
- * @generated
- */
- public Adapter createINonOwningMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping <em>IMulti Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping
- * @generated
- */
- public Adapter createIMultiRelationshipMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IOneToMany <em>IOne To Many</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IOneToMany
- * @generated
- */
- public Adapter createIOneToManyAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IManyToMany <em>IMany To Many</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IManyToMany
- * @generated
- */
- public Adapter createIManyToManyAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IPersistentType <em>IPersistent Type</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IPersistentType
- * @generated
- */
- public Adapter createIPersistentTypeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IMappedSuperclass <em>IMapped Superclass</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IMappedSuperclass
- * @generated
- */
- public Adapter createIMappedSuperclassAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IEntity <em>IEntity</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity
- * @generated
- */
- public Adapter createIEntityAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IEmbeddable <em>IEmbeddable</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IEmbeddable
- * @generated
- */
- public Adapter createIEmbeddableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.ITypeMapping <em>IType Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.ITypeMapping
- * @generated
- */
- public Adapter createITypeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for the default case.
- * <!-- begin-user-doc -->
- * This default implementation returns null.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @generated
- */
- public Adapter createEObjectAdapter() {
- return null;
- }
-} //JpaCoreXmlAdapterFactory
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/util/OrmSwitch.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/util/OrmSwitch.java
deleted file mode 100644
index add4659317..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/util/OrmSwitch.java
+++ /dev/null
@@ -1,3244 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.orm.util;
-
-import java.util.List;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IJpaEObject;
-import org.eclipse.jpt.core.internal.IJpaRootContentNode;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.IXmlEObject;
-import org.eclipse.jpt.core.internal.JpaEObject;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.orm.AbstractXmlColumn;
-import org.eclipse.jpt.core.internal.content.orm.AbstractXmlNamedColumn;
-import org.eclipse.jpt.core.internal.content.orm.AbstractXmlQuery;
-import org.eclipse.jpt.core.internal.content.orm.AbstractXmlTable;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappings;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsForXml;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
-import org.eclipse.jpt.core.internal.content.orm.IXmlColumnMapping;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsForXml;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataForXml;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadataInternal;
-import org.eclipse.jpt.core.internal.content.orm.XmlAssociationOverride;
-import org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.internal.content.orm.XmlBasic;
-import org.eclipse.jpt.core.internal.content.orm.XmlCascade;
-import org.eclipse.jpt.core.internal.content.orm.XmlColumn;
-import org.eclipse.jpt.core.internal.content.orm.XmlDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.content.orm.XmlEmbeddable;
-import org.eclipse.jpt.core.internal.content.orm.XmlEmbedded;
-import org.eclipse.jpt.core.internal.content.orm.XmlEmbeddedId;
-import org.eclipse.jpt.core.internal.content.orm.XmlEntity;
-import org.eclipse.jpt.core.internal.content.orm.XmlEntityForXml;
-import org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal;
-import org.eclipse.jpt.core.internal.content.orm.XmlGeneratedValue;
-import org.eclipse.jpt.core.internal.content.orm.XmlGenerator;
-import org.eclipse.jpt.core.internal.content.orm.XmlId;
-import org.eclipse.jpt.core.internal.content.orm.XmlIdClass;
-import org.eclipse.jpt.core.internal.content.orm.XmlInheritance;
-import org.eclipse.jpt.core.internal.content.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.internal.content.orm.XmlJoinTable;
-import org.eclipse.jpt.core.internal.content.orm.XmlManyToMany;
-import org.eclipse.jpt.core.internal.content.orm.XmlManyToOne;
-import org.eclipse.jpt.core.internal.content.orm.XmlMapKey;
-import org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass;
-import org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingForXml;
-import org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal;
-import org.eclipse.jpt.core.internal.content.orm.XmlNamedNativeQuery;
-import org.eclipse.jpt.core.internal.content.orm.XmlNamedQuery;
-import org.eclipse.jpt.core.internal.content.orm.XmlNullAttributeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlOneToMany;
-import org.eclipse.jpt.core.internal.content.orm.XmlOneToOne;
-import org.eclipse.jpt.core.internal.content.orm.XmlOverride;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentType;
-import org.eclipse.jpt.core.internal.content.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.content.orm.XmlQueryHint;
-import org.eclipse.jpt.core.internal.content.orm.XmlRelationshipMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode;
-import org.eclipse.jpt.core.internal.content.orm.XmlSecondaryTable;
-import org.eclipse.jpt.core.internal.content.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.core.internal.content.orm.XmlSingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlTable;
-import org.eclipse.jpt.core.internal.content.orm.XmlTableGenerator;
-import org.eclipse.jpt.core.internal.content.orm.XmlTransient;
-import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.core.internal.content.orm.XmlVersion;
-import org.eclipse.jpt.core.internal.mappings.IAbstractColumn;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.ICascade;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddable;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddedId;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
-import org.eclipse.jpt.core.internal.mappings.IGenerator;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.IManyToMany;
-import org.eclipse.jpt.core.internal.mappings.IManyToOne;
-import org.eclipse.jpt.core.internal.mappings.IMappedSuperclass;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedNativeQuery;
-import org.eclipse.jpt.core.internal.mappings.INamedQuery;
-import org.eclipse.jpt.core.internal.mappings.INonOwningMapping;
-import org.eclipse.jpt.core.internal.mappings.IOneToMany;
-import org.eclipse.jpt.core.internal.mappings.IOneToOne;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IQuery;
-import org.eclipse.jpt.core.internal.mappings.IQueryHint;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.mappings.ITransient;
-import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint;
-import org.eclipse.jpt.core.internal.mappings.IVersion;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Switch</b> for the model's inheritance hierarchy.
- * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
- * to invoke the <code>caseXXX</code> method for each class of the model,
- * starting with the actual class of the object
- * and proceeding up the inheritance hierarchy
- * until a non-null result is returned,
- * which is the result of the switch.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage
- * @generated
- */
-public class OrmSwitch<T>
-{
- /**
- * The cached model package
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static OrmPackage modelPackage;
-
- /**
- * Creates an instance of the switch.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public OrmSwitch() {
- if (modelPackage == null) {
- modelPackage = OrmPackage.eINSTANCE;
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- public T doSwitch(EObject theEObject) {
- return doSwitch(theEObject.eClass(), theEObject);
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(EClass theEClass, EObject theEObject) {
- if (theEClass.eContainer() == modelPackage) {
- return doSwitch(theEClass.getClassifierID(), theEObject);
- }
- else {
- List<EClass> eSuperTypes = theEClass.getESuperTypes();
- return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), theEObject);
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(int classifierID, EObject theEObject) {
- switch (classifierID) {
- case OrmPackage.XML_ROOT_CONTENT_NODE : {
- XmlRootContentNode xmlRootContentNode = (XmlRootContentNode) theEObject;
- T result = caseXmlRootContentNode(xmlRootContentNode);
- if (result == null)
- result = caseXmlEObject(xmlRootContentNode);
- if (result == null)
- result = caseIJpaRootContentNode(xmlRootContentNode);
- if (result == null)
- result = caseJpaEObject(xmlRootContentNode);
- if (result == null)
- result = caseIXmlEObject(xmlRootContentNode);
- if (result == null)
- result = caseIJpaContentNode(xmlRootContentNode);
- if (result == null)
- result = caseIJpaEObject(xmlRootContentNode);
- if (result == null)
- result = caseIJpaSourceObject(xmlRootContentNode);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL : {
- EntityMappingsInternal entityMappingsInternal = (EntityMappingsInternal) theEObject;
- T result = caseEntityMappingsInternal(entityMappingsInternal);
- if (result == null)
- result = caseXmlEObject(entityMappingsInternal);
- if (result == null)
- result = caseIJpaContentNode(entityMappingsInternal);
- if (result == null)
- result = caseEntityMappingsForXml(entityMappingsInternal);
- if (result == null)
- result = caseEntityMappings(entityMappingsInternal);
- if (result == null)
- result = caseJpaEObject(entityMappingsInternal);
- if (result == null)
- result = caseIXmlEObject(entityMappingsInternal);
- if (result == null)
- result = caseIJpaSourceObject(entityMappingsInternal);
- if (result == null)
- result = caseIJpaEObject(entityMappingsInternal);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.ENTITY_MAPPINGS : {
- EntityMappings entityMappings = (EntityMappings) theEObject;
- T result = caseEntityMappings(entityMappings);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.ENTITY_MAPPINGS_FOR_XML : {
- EntityMappingsForXml entityMappingsForXml = (EntityMappingsForXml) theEObject;
- T result = caseEntityMappingsForXml(entityMappingsForXml);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_TYPE_MAPPING : {
- XmlTypeMapping xmlTypeMapping = (XmlTypeMapping) theEObject;
- T result = caseXmlTypeMapping(xmlTypeMapping);
- if (result == null)
- result = caseXmlEObject(xmlTypeMapping);
- if (result == null)
- result = caseITypeMapping(xmlTypeMapping);
- if (result == null)
- result = caseJpaEObject(xmlTypeMapping);
- if (result == null)
- result = caseIXmlEObject(xmlTypeMapping);
- if (result == null)
- result = caseIJpaSourceObject(xmlTypeMapping);
- if (result == null)
- result = caseIJpaEObject(xmlTypeMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_PERSISTENT_TYPE : {
- XmlPersistentType xmlPersistentType = (XmlPersistentType) theEObject;
- T result = caseXmlPersistentType(xmlPersistentType);
- if (result == null)
- result = caseXmlEObject(xmlPersistentType);
- if (result == null)
- result = caseIPersistentType(xmlPersistentType);
- if (result == null)
- result = caseJpaEObject(xmlPersistentType);
- if (result == null)
- result = caseIXmlEObject(xmlPersistentType);
- if (result == null)
- result = caseIJpaContentNode(xmlPersistentType);
- if (result == null)
- result = caseIJpaEObject(xmlPersistentType);
- if (result == null)
- result = caseIJpaSourceObject(xmlPersistentType);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_MAPPED_SUPERCLASS : {
- XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) theEObject;
- T result = caseXmlMappedSuperclass(xmlMappedSuperclass);
- if (result == null)
- result = caseXmlTypeMapping(xmlMappedSuperclass);
- if (result == null)
- result = caseIMappedSuperclass(xmlMappedSuperclass);
- if (result == null)
- result = caseXmlEObject(xmlMappedSuperclass);
- if (result == null)
- result = caseITypeMapping(xmlMappedSuperclass);
- if (result == null)
- result = caseJpaEObject(xmlMappedSuperclass);
- if (result == null)
- result = caseIXmlEObject(xmlMappedSuperclass);
- if (result == null)
- result = caseIJpaSourceObject(xmlMappedSuperclass);
- if (result == null)
- result = caseIJpaEObject(xmlMappedSuperclass);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_ENTITY_INTERNAL : {
- XmlEntityInternal xmlEntityInternal = (XmlEntityInternal) theEObject;
- T result = caseXmlEntityInternal(xmlEntityInternal);
- if (result == null)
- result = caseXmlTypeMapping(xmlEntityInternal);
- if (result == null)
- result = caseXmlEntityForXml(xmlEntityInternal);
- if (result == null)
- result = caseXmlEntity(xmlEntityInternal);
- if (result == null)
- result = caseXmlEObject(xmlEntityInternal);
- if (result == null)
- result = caseITypeMapping(xmlEntityInternal);
- if (result == null)
- result = caseIEntity(xmlEntityInternal);
- if (result == null)
- result = caseJpaEObject(xmlEntityInternal);
- if (result == null)
- result = caseIXmlEObject(xmlEntityInternal);
- if (result == null)
- result = caseIJpaSourceObject(xmlEntityInternal);
- if (result == null)
- result = caseIJpaEObject(xmlEntityInternal);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_ENTITY_FOR_XML : {
- XmlEntityForXml xmlEntityForXml = (XmlEntityForXml) theEObject;
- T result = caseXmlEntityForXml(xmlEntityForXml);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_ENTITY : {
- XmlEntity xmlEntity = (XmlEntity) theEObject;
- T result = caseXmlEntity(xmlEntity);
- if (result == null)
- result = caseIEntity(xmlEntity);
- if (result == null)
- result = caseITypeMapping(xmlEntity);
- if (result == null)
- result = caseIJpaSourceObject(xmlEntity);
- if (result == null)
- result = caseIJpaEObject(xmlEntity);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_EMBEDDABLE : {
- XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) theEObject;
- T result = caseXmlEmbeddable(xmlEmbeddable);
- if (result == null)
- result = caseXmlTypeMapping(xmlEmbeddable);
- if (result == null)
- result = caseIEmbeddable(xmlEmbeddable);
- if (result == null)
- result = caseXmlEObject(xmlEmbeddable);
- if (result == null)
- result = caseITypeMapping(xmlEmbeddable);
- if (result == null)
- result = caseJpaEObject(xmlEmbeddable);
- if (result == null)
- result = caseIXmlEObject(xmlEmbeddable);
- if (result == null)
- result = caseIJpaSourceObject(xmlEmbeddable);
- if (result == null)
- result = caseIJpaEObject(xmlEmbeddable);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_ATTRIBUTE_MAPPING : {
- XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) theEObject;
- T result = caseXmlAttributeMapping(xmlAttributeMapping);
- if (result == null)
- result = caseXmlEObject(xmlAttributeMapping);
- if (result == null)
- result = caseIAttributeMapping(xmlAttributeMapping);
- if (result == null)
- result = caseJpaEObject(xmlAttributeMapping);
- if (result == null)
- result = caseIXmlEObject(xmlAttributeMapping);
- if (result == null)
- result = caseIJpaSourceObject(xmlAttributeMapping);
- if (result == null)
- result = caseIJpaEObject(xmlAttributeMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_NULL_ATTRIBUTE_MAPPING : {
- XmlNullAttributeMapping xmlNullAttributeMapping = (XmlNullAttributeMapping) theEObject;
- T result = caseXmlNullAttributeMapping(xmlNullAttributeMapping);
- if (result == null)
- result = caseXmlAttributeMapping(xmlNullAttributeMapping);
- if (result == null)
- result = caseXmlEObject(xmlNullAttributeMapping);
- if (result == null)
- result = caseIAttributeMapping(xmlNullAttributeMapping);
- if (result == null)
- result = caseJpaEObject(xmlNullAttributeMapping);
- if (result == null)
- result = caseIXmlEObject(xmlNullAttributeMapping);
- if (result == null)
- result = caseIJpaSourceObject(xmlNullAttributeMapping);
- if (result == null)
- result = caseIJpaEObject(xmlNullAttributeMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_BASIC : {
- XmlBasic xmlBasic = (XmlBasic) theEObject;
- T result = caseXmlBasic(xmlBasic);
- if (result == null)
- result = caseXmlAttributeMapping(xmlBasic);
- if (result == null)
- result = caseIBasic(xmlBasic);
- if (result == null)
- result = caseIXmlColumnMapping(xmlBasic);
- if (result == null)
- result = caseXmlEObject(xmlBasic);
- if (result == null)
- result = caseIAttributeMapping(xmlBasic);
- if (result == null)
- result = caseIColumnMapping(xmlBasic);
- if (result == null)
- result = caseJpaEObject(xmlBasic);
- if (result == null)
- result = caseIXmlEObject(xmlBasic);
- if (result == null)
- result = caseIJpaSourceObject(xmlBasic);
- if (result == null)
- result = caseIJpaEObject(xmlBasic);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_ID : {
- XmlId xmlId = (XmlId) theEObject;
- T result = caseXmlId(xmlId);
- if (result == null)
- result = caseXmlAttributeMapping(xmlId);
- if (result == null)
- result = caseIId(xmlId);
- if (result == null)
- result = caseIXmlColumnMapping(xmlId);
- if (result == null)
- result = caseXmlEObject(xmlId);
- if (result == null)
- result = caseIAttributeMapping(xmlId);
- if (result == null)
- result = caseIColumnMapping(xmlId);
- if (result == null)
- result = caseJpaEObject(xmlId);
- if (result == null)
- result = caseIXmlEObject(xmlId);
- if (result == null)
- result = caseIJpaSourceObject(xmlId);
- if (result == null)
- result = caseIJpaEObject(xmlId);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_TRANSIENT : {
- XmlTransient xmlTransient = (XmlTransient) theEObject;
- T result = caseXmlTransient(xmlTransient);
- if (result == null)
- result = caseXmlAttributeMapping(xmlTransient);
- if (result == null)
- result = caseITransient(xmlTransient);
- if (result == null)
- result = caseXmlEObject(xmlTransient);
- if (result == null)
- result = caseIAttributeMapping(xmlTransient);
- if (result == null)
- result = caseJpaEObject(xmlTransient);
- if (result == null)
- result = caseIXmlEObject(xmlTransient);
- if (result == null)
- result = caseIJpaSourceObject(xmlTransient);
- if (result == null)
- result = caseIJpaEObject(xmlTransient);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_EMBEDDED : {
- XmlEmbedded xmlEmbedded = (XmlEmbedded) theEObject;
- T result = caseXmlEmbedded(xmlEmbedded);
- if (result == null)
- result = caseXmlAttributeMapping(xmlEmbedded);
- if (result == null)
- result = caseIEmbedded(xmlEmbedded);
- if (result == null)
- result = caseXmlEObject(xmlEmbedded);
- if (result == null)
- result = caseIAttributeMapping(xmlEmbedded);
- if (result == null)
- result = caseJpaEObject(xmlEmbedded);
- if (result == null)
- result = caseIXmlEObject(xmlEmbedded);
- if (result == null)
- result = caseIJpaSourceObject(xmlEmbedded);
- if (result == null)
- result = caseIJpaEObject(xmlEmbedded);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_EMBEDDED_ID : {
- XmlEmbeddedId xmlEmbeddedId = (XmlEmbeddedId) theEObject;
- T result = caseXmlEmbeddedId(xmlEmbeddedId);
- if (result == null)
- result = caseXmlAttributeMapping(xmlEmbeddedId);
- if (result == null)
- result = caseIEmbeddedId(xmlEmbeddedId);
- if (result == null)
- result = caseXmlEObject(xmlEmbeddedId);
- if (result == null)
- result = caseIAttributeMapping(xmlEmbeddedId);
- if (result == null)
- result = caseJpaEObject(xmlEmbeddedId);
- if (result == null)
- result = caseIXmlEObject(xmlEmbeddedId);
- if (result == null)
- result = caseIJpaSourceObject(xmlEmbeddedId);
- if (result == null)
- result = caseIJpaEObject(xmlEmbeddedId);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_VERSION : {
- XmlVersion xmlVersion = (XmlVersion) theEObject;
- T result = caseXmlVersion(xmlVersion);
- if (result == null)
- result = caseXmlAttributeMapping(xmlVersion);
- if (result == null)
- result = caseIVersion(xmlVersion);
- if (result == null)
- result = caseIXmlColumnMapping(xmlVersion);
- if (result == null)
- result = caseXmlEObject(xmlVersion);
- if (result == null)
- result = caseIAttributeMapping(xmlVersion);
- if (result == null)
- result = caseIColumnMapping(xmlVersion);
- if (result == null)
- result = caseJpaEObject(xmlVersion);
- if (result == null)
- result = caseIXmlEObject(xmlVersion);
- if (result == null)
- result = caseIJpaSourceObject(xmlVersion);
- if (result == null)
- result = caseIJpaEObject(xmlVersion);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_INTERNAL : {
- XmlMultiRelationshipMappingInternal xmlMultiRelationshipMappingInternal = (XmlMultiRelationshipMappingInternal) theEObject;
- T result = caseXmlMultiRelationshipMappingInternal(xmlMultiRelationshipMappingInternal);
- if (result == null)
- result = caseXmlRelationshipMapping(xmlMultiRelationshipMappingInternal);
- if (result == null)
- result = caseIMultiRelationshipMapping(xmlMultiRelationshipMappingInternal);
- if (result == null)
- result = caseXmlMultiRelationshipMappingForXml(xmlMultiRelationshipMappingInternal);
- if (result == null)
- result = caseXmlMultiRelationshipMapping(xmlMultiRelationshipMappingInternal);
- if (result == null)
- result = caseXmlAttributeMapping(xmlMultiRelationshipMappingInternal);
- if (result == null)
- result = caseIRelationshipMapping(xmlMultiRelationshipMappingInternal);
- if (result == null)
- result = caseINonOwningMapping(xmlMultiRelationshipMappingInternal);
- if (result == null)
- result = caseXmlEObject(xmlMultiRelationshipMappingInternal);
- if (result == null)
- result = caseIAttributeMapping(xmlMultiRelationshipMappingInternal);
- if (result == null)
- result = caseJpaEObject(xmlMultiRelationshipMappingInternal);
- if (result == null)
- result = caseIXmlEObject(xmlMultiRelationshipMappingInternal);
- if (result == null)
- result = caseIJpaSourceObject(xmlMultiRelationshipMappingInternal);
- if (result == null)
- result = caseIJpaEObject(xmlMultiRelationshipMappingInternal);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING_FOR_XML : {
- XmlMultiRelationshipMappingForXml xmlMultiRelationshipMappingForXml = (XmlMultiRelationshipMappingForXml) theEObject;
- T result = caseXmlMultiRelationshipMappingForXml(xmlMultiRelationshipMappingForXml);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_MULTI_RELATIONSHIP_MAPPING : {
- XmlMultiRelationshipMapping xmlMultiRelationshipMapping = (XmlMultiRelationshipMapping) theEObject;
- T result = caseXmlMultiRelationshipMapping(xmlMultiRelationshipMapping);
- if (result == null)
- result = caseIMultiRelationshipMapping(xmlMultiRelationshipMapping);
- if (result == null)
- result = caseINonOwningMapping(xmlMultiRelationshipMapping);
- if (result == null)
- result = caseIRelationshipMapping(xmlMultiRelationshipMapping);
- if (result == null)
- result = caseIAttributeMapping(xmlMultiRelationshipMapping);
- if (result == null)
- result = caseIJpaSourceObject(xmlMultiRelationshipMapping);
- if (result == null)
- result = caseIJpaEObject(xmlMultiRelationshipMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_ONE_TO_MANY : {
- XmlOneToMany xmlOneToMany = (XmlOneToMany) theEObject;
- T result = caseXmlOneToMany(xmlOneToMany);
- if (result == null)
- result = caseXmlMultiRelationshipMappingInternal(xmlOneToMany);
- if (result == null)
- result = caseIOneToMany(xmlOneToMany);
- if (result == null)
- result = caseXmlRelationshipMapping(xmlOneToMany);
- if (result == null)
- result = caseIMultiRelationshipMapping(xmlOneToMany);
- if (result == null)
- result = caseXmlMultiRelationshipMappingForXml(xmlOneToMany);
- if (result == null)
- result = caseXmlMultiRelationshipMapping(xmlOneToMany);
- if (result == null)
- result = caseXmlAttributeMapping(xmlOneToMany);
- if (result == null)
- result = caseIRelationshipMapping(xmlOneToMany);
- if (result == null)
- result = caseINonOwningMapping(xmlOneToMany);
- if (result == null)
- result = caseXmlEObject(xmlOneToMany);
- if (result == null)
- result = caseIAttributeMapping(xmlOneToMany);
- if (result == null)
- result = caseJpaEObject(xmlOneToMany);
- if (result == null)
- result = caseIXmlEObject(xmlOneToMany);
- if (result == null)
- result = caseIJpaSourceObject(xmlOneToMany);
- if (result == null)
- result = caseIJpaEObject(xmlOneToMany);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_MANY_TO_MANY : {
- XmlManyToMany xmlManyToMany = (XmlManyToMany) theEObject;
- T result = caseXmlManyToMany(xmlManyToMany);
- if (result == null)
- result = caseXmlMultiRelationshipMappingInternal(xmlManyToMany);
- if (result == null)
- result = caseIManyToMany(xmlManyToMany);
- if (result == null)
- result = caseXmlRelationshipMapping(xmlManyToMany);
- if (result == null)
- result = caseIMultiRelationshipMapping(xmlManyToMany);
- if (result == null)
- result = caseXmlMultiRelationshipMappingForXml(xmlManyToMany);
- if (result == null)
- result = caseXmlMultiRelationshipMapping(xmlManyToMany);
- if (result == null)
- result = caseXmlAttributeMapping(xmlManyToMany);
- if (result == null)
- result = caseIRelationshipMapping(xmlManyToMany);
- if (result == null)
- result = caseINonOwningMapping(xmlManyToMany);
- if (result == null)
- result = caseXmlEObject(xmlManyToMany);
- if (result == null)
- result = caseIAttributeMapping(xmlManyToMany);
- if (result == null)
- result = caseJpaEObject(xmlManyToMany);
- if (result == null)
- result = caseIXmlEObject(xmlManyToMany);
- if (result == null)
- result = caseIJpaSourceObject(xmlManyToMany);
- if (result == null)
- result = caseIJpaEObject(xmlManyToMany);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_PERSISTENT_ATTRIBUTE : {
- XmlPersistentAttribute xmlPersistentAttribute = (XmlPersistentAttribute) theEObject;
- T result = caseXmlPersistentAttribute(xmlPersistentAttribute);
- if (result == null)
- result = caseXmlEObject(xmlPersistentAttribute);
- if (result == null)
- result = caseIPersistentAttribute(xmlPersistentAttribute);
- if (result == null)
- result = caseJpaEObject(xmlPersistentAttribute);
- if (result == null)
- result = caseIXmlEObject(xmlPersistentAttribute);
- if (result == null)
- result = caseIJpaContentNode(xmlPersistentAttribute);
- if (result == null)
- result = caseIJpaEObject(xmlPersistentAttribute);
- if (result == null)
- result = caseIJpaSourceObject(xmlPersistentAttribute);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.PERSISTENCE_UNIT_METADATA_INTERNAL : {
- PersistenceUnitMetadataInternal persistenceUnitMetadataInternal = (PersistenceUnitMetadataInternal) theEObject;
- T result = casePersistenceUnitMetadataInternal(persistenceUnitMetadataInternal);
- if (result == null)
- result = caseXmlEObject(persistenceUnitMetadataInternal);
- if (result == null)
- result = casePersistenceUnitMetadataForXml(persistenceUnitMetadataInternal);
- if (result == null)
- result = casePersistenceUnitMetadata(persistenceUnitMetadataInternal);
- if (result == null)
- result = caseJpaEObject(persistenceUnitMetadataInternal);
- if (result == null)
- result = caseIXmlEObject(persistenceUnitMetadataInternal);
- if (result == null)
- result = caseIJpaEObject(persistenceUnitMetadataInternal);
- if (result == null)
- result = caseIJpaSourceObject(persistenceUnitMetadataInternal);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.PERSISTENCE_UNIT_METADATA : {
- PersistenceUnitMetadata persistenceUnitMetadata = (PersistenceUnitMetadata) theEObject;
- T result = casePersistenceUnitMetadata(persistenceUnitMetadata);
- if (result == null)
- result = caseIXmlEObject(persistenceUnitMetadata);
- if (result == null)
- result = caseIJpaEObject(persistenceUnitMetadata);
- if (result == null)
- result = caseIJpaSourceObject(persistenceUnitMetadata);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.PERSISTENCE_UNIT_METADATA_FOR_XML : {
- PersistenceUnitMetadataForXml persistenceUnitMetadataForXml = (PersistenceUnitMetadataForXml) theEObject;
- T result = casePersistenceUnitMetadataForXml(persistenceUnitMetadataForXml);
- if (result == null)
- result = caseIXmlEObject(persistenceUnitMetadataForXml);
- if (result == null)
- result = caseIJpaEObject(persistenceUnitMetadataForXml);
- if (result == null)
- result = caseIJpaSourceObject(persistenceUnitMetadataForXml);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_INTERNAL : {
- PersistenceUnitDefaultsInternal persistenceUnitDefaultsInternal = (PersistenceUnitDefaultsInternal) theEObject;
- T result = casePersistenceUnitDefaultsInternal(persistenceUnitDefaultsInternal);
- if (result == null)
- result = caseXmlEObject(persistenceUnitDefaultsInternal);
- if (result == null)
- result = casePersistenceUnitDefaults(persistenceUnitDefaultsInternal);
- if (result == null)
- result = casePersistenceUnitDefaultsForXml(persistenceUnitDefaultsInternal);
- if (result == null)
- result = caseJpaEObject(persistenceUnitDefaultsInternal);
- if (result == null)
- result = caseIXmlEObject(persistenceUnitDefaultsInternal);
- if (result == null)
- result = caseIJpaEObject(persistenceUnitDefaultsInternal);
- if (result == null)
- result = caseIJpaSourceObject(persistenceUnitDefaultsInternal);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS : {
- PersistenceUnitDefaults persistenceUnitDefaults = (PersistenceUnitDefaults) theEObject;
- T result = casePersistenceUnitDefaults(persistenceUnitDefaults);
- if (result == null)
- result = caseIXmlEObject(persistenceUnitDefaults);
- if (result == null)
- result = caseIJpaEObject(persistenceUnitDefaults);
- if (result == null)
- result = caseIJpaSourceObject(persistenceUnitDefaults);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.PERSISTENCE_UNIT_DEFAULTS_FOR_XML : {
- PersistenceUnitDefaultsForXml persistenceUnitDefaultsForXml = (PersistenceUnitDefaultsForXml) theEObject;
- T result = casePersistenceUnitDefaultsForXml(persistenceUnitDefaultsForXml);
- if (result == null)
- result = caseIXmlEObject(persistenceUnitDefaultsForXml);
- if (result == null)
- result = caseIJpaEObject(persistenceUnitDefaultsForXml);
- if (result == null)
- result = caseIJpaSourceObject(persistenceUnitDefaultsForXml);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_TABLE : {
- XmlTable xmlTable = (XmlTable) theEObject;
- T result = caseXmlTable(xmlTable);
- if (result == null)
- result = caseAbstractXmlTable(xmlTable);
- if (result == null)
- result = caseITable(xmlTable);
- if (result == null)
- result = caseXmlEObject(xmlTable);
- if (result == null)
- result = caseIJpaSourceObject(xmlTable);
- if (result == null)
- result = caseJpaEObject(xmlTable);
- if (result == null)
- result = caseIXmlEObject(xmlTable);
- if (result == null)
- result = caseIJpaEObject(xmlTable);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.ABSTRACT_XML_NAMED_COLUMN : {
- AbstractXmlNamedColumn abstractXmlNamedColumn = (AbstractXmlNamedColumn) theEObject;
- T result = caseAbstractXmlNamedColumn(abstractXmlNamedColumn);
- if (result == null)
- result = caseXmlEObject(abstractXmlNamedColumn);
- if (result == null)
- result = caseINamedColumn(abstractXmlNamedColumn);
- if (result == null)
- result = caseJpaEObject(abstractXmlNamedColumn);
- if (result == null)
- result = caseIXmlEObject(abstractXmlNamedColumn);
- if (result == null)
- result = caseIJpaSourceObject(abstractXmlNamedColumn);
- if (result == null)
- result = caseIJpaEObject(abstractXmlNamedColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.ABSTRACT_XML_COLUMN : {
- AbstractXmlColumn abstractXmlColumn = (AbstractXmlColumn) theEObject;
- T result = caseAbstractXmlColumn(abstractXmlColumn);
- if (result == null)
- result = caseAbstractXmlNamedColumn(abstractXmlColumn);
- if (result == null)
- result = caseIAbstractColumn(abstractXmlColumn);
- if (result == null)
- result = caseXmlEObject(abstractXmlColumn);
- if (result == null)
- result = caseINamedColumn(abstractXmlColumn);
- if (result == null)
- result = caseJpaEObject(abstractXmlColumn);
- if (result == null)
- result = caseIXmlEObject(abstractXmlColumn);
- if (result == null)
- result = caseIJpaSourceObject(abstractXmlColumn);
- if (result == null)
- result = caseIJpaEObject(abstractXmlColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_COLUMN : {
- XmlColumn xmlColumn = (XmlColumn) theEObject;
- T result = caseXmlColumn(xmlColumn);
- if (result == null)
- result = caseAbstractXmlColumn(xmlColumn);
- if (result == null)
- result = caseIColumn(xmlColumn);
- if (result == null)
- result = caseAbstractXmlNamedColumn(xmlColumn);
- if (result == null)
- result = caseIAbstractColumn(xmlColumn);
- if (result == null)
- result = caseXmlEObject(xmlColumn);
- if (result == null)
- result = caseINamedColumn(xmlColumn);
- if (result == null)
- result = caseJpaEObject(xmlColumn);
- if (result == null)
- result = caseIXmlEObject(xmlColumn);
- if (result == null)
- result = caseIJpaSourceObject(xmlColumn);
- if (result == null)
- result = caseIJpaEObject(xmlColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_JOIN_COLUMN : {
- XmlJoinColumn xmlJoinColumn = (XmlJoinColumn) theEObject;
- T result = caseXmlJoinColumn(xmlJoinColumn);
- if (result == null)
- result = caseAbstractXmlColumn(xmlJoinColumn);
- if (result == null)
- result = caseIJoinColumn(xmlJoinColumn);
- if (result == null)
- result = caseAbstractXmlNamedColumn(xmlJoinColumn);
- if (result == null)
- result = caseIAbstractColumn(xmlJoinColumn);
- if (result == null)
- result = caseIAbstractJoinColumn(xmlJoinColumn);
- if (result == null)
- result = caseXmlEObject(xmlJoinColumn);
- if (result == null)
- result = caseINamedColumn(xmlJoinColumn);
- if (result == null)
- result = caseJpaEObject(xmlJoinColumn);
- if (result == null)
- result = caseIXmlEObject(xmlJoinColumn);
- if (result == null)
- result = caseIJpaSourceObject(xmlJoinColumn);
- if (result == null)
- result = caseIJpaEObject(xmlJoinColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.IXML_COLUMN_MAPPING : {
- IXmlColumnMapping iXmlColumnMapping = (IXmlColumnMapping) theEObject;
- T result = caseIXmlColumnMapping(iXmlColumnMapping);
- if (result == null)
- result = caseIColumnMapping(iXmlColumnMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_MANY_TO_ONE : {
- XmlManyToOne xmlManyToOne = (XmlManyToOne) theEObject;
- T result = caseXmlManyToOne(xmlManyToOne);
- if (result == null)
- result = caseXmlSingleRelationshipMapping(xmlManyToOne);
- if (result == null)
- result = caseIManyToOne(xmlManyToOne);
- if (result == null)
- result = caseXmlRelationshipMapping(xmlManyToOne);
- if (result == null)
- result = caseISingleRelationshipMapping(xmlManyToOne);
- if (result == null)
- result = caseXmlAttributeMapping(xmlManyToOne);
- if (result == null)
- result = caseIRelationshipMapping(xmlManyToOne);
- if (result == null)
- result = caseXmlEObject(xmlManyToOne);
- if (result == null)
- result = caseIAttributeMapping(xmlManyToOne);
- if (result == null)
- result = caseJpaEObject(xmlManyToOne);
- if (result == null)
- result = caseIXmlEObject(xmlManyToOne);
- if (result == null)
- result = caseIJpaSourceObject(xmlManyToOne);
- if (result == null)
- result = caseIJpaEObject(xmlManyToOne);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_ONE_TO_ONE : {
- XmlOneToOne xmlOneToOne = (XmlOneToOne) theEObject;
- T result = caseXmlOneToOne(xmlOneToOne);
- if (result == null)
- result = caseXmlSingleRelationshipMapping(xmlOneToOne);
- if (result == null)
- result = caseIOneToOne(xmlOneToOne);
- if (result == null)
- result = caseXmlRelationshipMapping(xmlOneToOne);
- if (result == null)
- result = caseISingleRelationshipMapping(xmlOneToOne);
- if (result == null)
- result = caseINonOwningMapping(xmlOneToOne);
- if (result == null)
- result = caseXmlAttributeMapping(xmlOneToOne);
- if (result == null)
- result = caseIRelationshipMapping(xmlOneToOne);
- if (result == null)
- result = caseXmlEObject(xmlOneToOne);
- if (result == null)
- result = caseIAttributeMapping(xmlOneToOne);
- if (result == null)
- result = caseJpaEObject(xmlOneToOne);
- if (result == null)
- result = caseIXmlEObject(xmlOneToOne);
- if (result == null)
- result = caseIJpaSourceObject(xmlOneToOne);
- if (result == null)
- result = caseIJpaEObject(xmlOneToOne);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_SINGLE_RELATIONSHIP_MAPPING : {
- XmlSingleRelationshipMapping xmlSingleRelationshipMapping = (XmlSingleRelationshipMapping) theEObject;
- T result = caseXmlSingleRelationshipMapping(xmlSingleRelationshipMapping);
- if (result == null)
- result = caseXmlRelationshipMapping(xmlSingleRelationshipMapping);
- if (result == null)
- result = caseISingleRelationshipMapping(xmlSingleRelationshipMapping);
- if (result == null)
- result = caseXmlAttributeMapping(xmlSingleRelationshipMapping);
- if (result == null)
- result = caseIRelationshipMapping(xmlSingleRelationshipMapping);
- if (result == null)
- result = caseXmlEObject(xmlSingleRelationshipMapping);
- if (result == null)
- result = caseIAttributeMapping(xmlSingleRelationshipMapping);
- if (result == null)
- result = caseJpaEObject(xmlSingleRelationshipMapping);
- if (result == null)
- result = caseIXmlEObject(xmlSingleRelationshipMapping);
- if (result == null)
- result = caseIJpaSourceObject(xmlSingleRelationshipMapping);
- if (result == null)
- result = caseIJpaEObject(xmlSingleRelationshipMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_RELATIONSHIP_MAPPING : {
- XmlRelationshipMapping xmlRelationshipMapping = (XmlRelationshipMapping) theEObject;
- T result = caseXmlRelationshipMapping(xmlRelationshipMapping);
- if (result == null)
- result = caseXmlAttributeMapping(xmlRelationshipMapping);
- if (result == null)
- result = caseIRelationshipMapping(xmlRelationshipMapping);
- if (result == null)
- result = caseXmlEObject(xmlRelationshipMapping);
- if (result == null)
- result = caseIAttributeMapping(xmlRelationshipMapping);
- if (result == null)
- result = caseJpaEObject(xmlRelationshipMapping);
- if (result == null)
- result = caseIXmlEObject(xmlRelationshipMapping);
- if (result == null)
- result = caseIJpaSourceObject(xmlRelationshipMapping);
- if (result == null)
- result = caseIJpaEObject(xmlRelationshipMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_JOIN_TABLE : {
- XmlJoinTable xmlJoinTable = (XmlJoinTable) theEObject;
- T result = caseXmlJoinTable(xmlJoinTable);
- if (result == null)
- result = caseAbstractXmlTable(xmlJoinTable);
- if (result == null)
- result = caseIJoinTable(xmlJoinTable);
- if (result == null)
- result = caseXmlEObject(xmlJoinTable);
- if (result == null)
- result = caseITable(xmlJoinTable);
- if (result == null)
- result = caseJpaEObject(xmlJoinTable);
- if (result == null)
- result = caseIXmlEObject(xmlJoinTable);
- if (result == null)
- result = caseIJpaSourceObject(xmlJoinTable);
- if (result == null)
- result = caseIJpaEObject(xmlJoinTable);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.ABSTRACT_XML_TABLE : {
- AbstractXmlTable abstractXmlTable = (AbstractXmlTable) theEObject;
- T result = caseAbstractXmlTable(abstractXmlTable);
- if (result == null)
- result = caseXmlEObject(abstractXmlTable);
- if (result == null)
- result = caseITable(abstractXmlTable);
- if (result == null)
- result = caseJpaEObject(abstractXmlTable);
- if (result == null)
- result = caseIXmlEObject(abstractXmlTable);
- if (result == null)
- result = caseIJpaSourceObject(abstractXmlTable);
- if (result == null)
- result = caseIJpaEObject(abstractXmlTable);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_OVERRIDE : {
- XmlOverride xmlOverride = (XmlOverride) theEObject;
- T result = caseXmlOverride(xmlOverride);
- if (result == null)
- result = caseXmlEObject(xmlOverride);
- if (result == null)
- result = caseIOverride(xmlOverride);
- if (result == null)
- result = caseJpaEObject(xmlOverride);
- if (result == null)
- result = caseIXmlEObject(xmlOverride);
- if (result == null)
- result = caseIJpaSourceObject(xmlOverride);
- if (result == null)
- result = caseIJpaEObject(xmlOverride);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_ATTRIBUTE_OVERRIDE : {
- XmlAttributeOverride xmlAttributeOverride = (XmlAttributeOverride) theEObject;
- T result = caseXmlAttributeOverride(xmlAttributeOverride);
- if (result == null)
- result = caseXmlOverride(xmlAttributeOverride);
- if (result == null)
- result = caseIAttributeOverride(xmlAttributeOverride);
- if (result == null)
- result = caseIXmlColumnMapping(xmlAttributeOverride);
- if (result == null)
- result = caseXmlEObject(xmlAttributeOverride);
- if (result == null)
- result = caseIOverride(xmlAttributeOverride);
- if (result == null)
- result = caseIColumnMapping(xmlAttributeOverride);
- if (result == null)
- result = caseJpaEObject(xmlAttributeOverride);
- if (result == null)
- result = caseIXmlEObject(xmlAttributeOverride);
- if (result == null)
- result = caseIJpaSourceObject(xmlAttributeOverride);
- if (result == null)
- result = caseIJpaEObject(xmlAttributeOverride);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_ASSOCIATION_OVERRIDE : {
- XmlAssociationOverride xmlAssociationOverride = (XmlAssociationOverride) theEObject;
- T result = caseXmlAssociationOverride(xmlAssociationOverride);
- if (result == null)
- result = caseXmlOverride(xmlAssociationOverride);
- if (result == null)
- result = caseIAssociationOverride(xmlAssociationOverride);
- if (result == null)
- result = caseXmlEObject(xmlAssociationOverride);
- if (result == null)
- result = caseIOverride(xmlAssociationOverride);
- if (result == null)
- result = caseJpaEObject(xmlAssociationOverride);
- if (result == null)
- result = caseIXmlEObject(xmlAssociationOverride);
- if (result == null)
- result = caseIJpaSourceObject(xmlAssociationOverride);
- if (result == null)
- result = caseIJpaEObject(xmlAssociationOverride);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_DISCRIMINATOR_COLUMN : {
- XmlDiscriminatorColumn xmlDiscriminatorColumn = (XmlDiscriminatorColumn) theEObject;
- T result = caseXmlDiscriminatorColumn(xmlDiscriminatorColumn);
- if (result == null)
- result = caseAbstractXmlNamedColumn(xmlDiscriminatorColumn);
- if (result == null)
- result = caseIDiscriminatorColumn(xmlDiscriminatorColumn);
- if (result == null)
- result = caseXmlEObject(xmlDiscriminatorColumn);
- if (result == null)
- result = caseINamedColumn(xmlDiscriminatorColumn);
- if (result == null)
- result = caseJpaEObject(xmlDiscriminatorColumn);
- if (result == null)
- result = caseIXmlEObject(xmlDiscriminatorColumn);
- if (result == null)
- result = caseIJpaSourceObject(xmlDiscriminatorColumn);
- if (result == null)
- result = caseIJpaEObject(xmlDiscriminatorColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_SECONDARY_TABLE : {
- XmlSecondaryTable xmlSecondaryTable = (XmlSecondaryTable) theEObject;
- T result = caseXmlSecondaryTable(xmlSecondaryTable);
- if (result == null)
- result = caseAbstractXmlTable(xmlSecondaryTable);
- if (result == null)
- result = caseISecondaryTable(xmlSecondaryTable);
- if (result == null)
- result = caseXmlEObject(xmlSecondaryTable);
- if (result == null)
- result = caseITable(xmlSecondaryTable);
- if (result == null)
- result = caseJpaEObject(xmlSecondaryTable);
- if (result == null)
- result = caseIXmlEObject(xmlSecondaryTable);
- if (result == null)
- result = caseIJpaSourceObject(xmlSecondaryTable);
- if (result == null)
- result = caseIJpaEObject(xmlSecondaryTable);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_PRIMARY_KEY_JOIN_COLUMN : {
- XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = (XmlPrimaryKeyJoinColumn) theEObject;
- T result = caseXmlPrimaryKeyJoinColumn(xmlPrimaryKeyJoinColumn);
- if (result == null)
- result = caseAbstractXmlNamedColumn(xmlPrimaryKeyJoinColumn);
- if (result == null)
- result = caseIPrimaryKeyJoinColumn(xmlPrimaryKeyJoinColumn);
- if (result == null)
- result = caseXmlEObject(xmlPrimaryKeyJoinColumn);
- if (result == null)
- result = caseINamedColumn(xmlPrimaryKeyJoinColumn);
- if (result == null)
- result = caseIAbstractJoinColumn(xmlPrimaryKeyJoinColumn);
- if (result == null)
- result = caseJpaEObject(xmlPrimaryKeyJoinColumn);
- if (result == null)
- result = caseIXmlEObject(xmlPrimaryKeyJoinColumn);
- if (result == null)
- result = caseIJpaSourceObject(xmlPrimaryKeyJoinColumn);
- if (result == null)
- result = caseIJpaEObject(xmlPrimaryKeyJoinColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_GENERATED_VALUE : {
- XmlGeneratedValue xmlGeneratedValue = (XmlGeneratedValue) theEObject;
- T result = caseXmlGeneratedValue(xmlGeneratedValue);
- if (result == null)
- result = caseXmlEObject(xmlGeneratedValue);
- if (result == null)
- result = caseIGeneratedValue(xmlGeneratedValue);
- if (result == null)
- result = caseJpaEObject(xmlGeneratedValue);
- if (result == null)
- result = caseIXmlEObject(xmlGeneratedValue);
- if (result == null)
- result = caseIJpaSourceObject(xmlGeneratedValue);
- if (result == null)
- result = caseIJpaEObject(xmlGeneratedValue);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_GENERATOR : {
- XmlGenerator xmlGenerator = (XmlGenerator) theEObject;
- T result = caseXmlGenerator(xmlGenerator);
- if (result == null)
- result = caseXmlEObject(xmlGenerator);
- if (result == null)
- result = caseIGenerator(xmlGenerator);
- if (result == null)
- result = caseJpaEObject(xmlGenerator);
- if (result == null)
- result = caseIXmlEObject(xmlGenerator);
- if (result == null)
- result = caseIJpaSourceObject(xmlGenerator);
- if (result == null)
- result = caseIJpaEObject(xmlGenerator);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_SEQUENCE_GENERATOR : {
- XmlSequenceGenerator xmlSequenceGenerator = (XmlSequenceGenerator) theEObject;
- T result = caseXmlSequenceGenerator(xmlSequenceGenerator);
- if (result == null)
- result = caseXmlGenerator(xmlSequenceGenerator);
- if (result == null)
- result = caseISequenceGenerator(xmlSequenceGenerator);
- if (result == null)
- result = caseXmlEObject(xmlSequenceGenerator);
- if (result == null)
- result = caseIGenerator(xmlSequenceGenerator);
- if (result == null)
- result = caseJpaEObject(xmlSequenceGenerator);
- if (result == null)
- result = caseIXmlEObject(xmlSequenceGenerator);
- if (result == null)
- result = caseIJpaSourceObject(xmlSequenceGenerator);
- if (result == null)
- result = caseIJpaEObject(xmlSequenceGenerator);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_TABLE_GENERATOR : {
- XmlTableGenerator xmlTableGenerator = (XmlTableGenerator) theEObject;
- T result = caseXmlTableGenerator(xmlTableGenerator);
- if (result == null)
- result = caseXmlGenerator(xmlTableGenerator);
- if (result == null)
- result = caseITableGenerator(xmlTableGenerator);
- if (result == null)
- result = caseXmlEObject(xmlTableGenerator);
- if (result == null)
- result = caseIGenerator(xmlTableGenerator);
- if (result == null)
- result = caseJpaEObject(xmlTableGenerator);
- if (result == null)
- result = caseIXmlEObject(xmlTableGenerator);
- if (result == null)
- result = caseIJpaSourceObject(xmlTableGenerator);
- if (result == null)
- result = caseIJpaEObject(xmlTableGenerator);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.ABSTRACT_XML_QUERY : {
- AbstractXmlQuery abstractXmlQuery = (AbstractXmlQuery) theEObject;
- T result = caseAbstractXmlQuery(abstractXmlQuery);
- if (result == null)
- result = caseXmlEObject(abstractXmlQuery);
- if (result == null)
- result = caseIQuery(abstractXmlQuery);
- if (result == null)
- result = caseJpaEObject(abstractXmlQuery);
- if (result == null)
- result = caseIXmlEObject(abstractXmlQuery);
- if (result == null)
- result = caseIJpaSourceObject(abstractXmlQuery);
- if (result == null)
- result = caseIJpaEObject(abstractXmlQuery);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_NAMED_QUERY : {
- XmlNamedQuery xmlNamedQuery = (XmlNamedQuery) theEObject;
- T result = caseXmlNamedQuery(xmlNamedQuery);
- if (result == null)
- result = caseAbstractXmlQuery(xmlNamedQuery);
- if (result == null)
- result = caseINamedQuery(xmlNamedQuery);
- if (result == null)
- result = caseXmlEObject(xmlNamedQuery);
- if (result == null)
- result = caseIQuery(xmlNamedQuery);
- if (result == null)
- result = caseIJpaSourceObject(xmlNamedQuery);
- if (result == null)
- result = caseJpaEObject(xmlNamedQuery);
- if (result == null)
- result = caseIXmlEObject(xmlNamedQuery);
- if (result == null)
- result = caseIJpaEObject(xmlNamedQuery);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_NAMED_NATIVE_QUERY : {
- XmlNamedNativeQuery xmlNamedNativeQuery = (XmlNamedNativeQuery) theEObject;
- T result = caseXmlNamedNativeQuery(xmlNamedNativeQuery);
- if (result == null)
- result = caseAbstractXmlQuery(xmlNamedNativeQuery);
- if (result == null)
- result = caseINamedNativeQuery(xmlNamedNativeQuery);
- if (result == null)
- result = caseXmlEObject(xmlNamedNativeQuery);
- if (result == null)
- result = caseIQuery(xmlNamedNativeQuery);
- if (result == null)
- result = caseIJpaSourceObject(xmlNamedNativeQuery);
- if (result == null)
- result = caseJpaEObject(xmlNamedNativeQuery);
- if (result == null)
- result = caseIXmlEObject(xmlNamedNativeQuery);
- if (result == null)
- result = caseIJpaEObject(xmlNamedNativeQuery);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_QUERY_HINT : {
- XmlQueryHint xmlQueryHint = (XmlQueryHint) theEObject;
- T result = caseXmlQueryHint(xmlQueryHint);
- if (result == null)
- result = caseXmlEObject(xmlQueryHint);
- if (result == null)
- result = caseIQueryHint(xmlQueryHint);
- if (result == null)
- result = caseJpaEObject(xmlQueryHint);
- if (result == null)
- result = caseIXmlEObject(xmlQueryHint);
- if (result == null)
- result = caseIJpaSourceObject(xmlQueryHint);
- if (result == null)
- result = caseIJpaEObject(xmlQueryHint);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_UNIQUE_CONSTRAINT : {
- XmlUniqueConstraint xmlUniqueConstraint = (XmlUniqueConstraint) theEObject;
- T result = caseXmlUniqueConstraint(xmlUniqueConstraint);
- if (result == null)
- result = caseXmlEObject(xmlUniqueConstraint);
- if (result == null)
- result = caseIUniqueConstraint(xmlUniqueConstraint);
- if (result == null)
- result = caseJpaEObject(xmlUniqueConstraint);
- if (result == null)
- result = caseIXmlEObject(xmlUniqueConstraint);
- if (result == null)
- result = caseIJpaSourceObject(xmlUniqueConstraint);
- if (result == null)
- result = caseIJpaEObject(xmlUniqueConstraint);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_CASCADE : {
- XmlCascade xmlCascade = (XmlCascade) theEObject;
- T result = caseXmlCascade(xmlCascade);
- if (result == null)
- result = caseXmlEObject(xmlCascade);
- if (result == null)
- result = caseICascade(xmlCascade);
- if (result == null)
- result = caseJpaEObject(xmlCascade);
- if (result == null)
- result = caseIXmlEObject(xmlCascade);
- if (result == null)
- result = caseIJpaSourceObject(xmlCascade);
- if (result == null)
- result = caseIJpaEObject(xmlCascade);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_ID_CLASS : {
- XmlIdClass xmlIdClass = (XmlIdClass) theEObject;
- T result = caseXmlIdClass(xmlIdClass);
- if (result == null)
- result = caseXmlEObject(xmlIdClass);
- if (result == null)
- result = caseJpaEObject(xmlIdClass);
- if (result == null)
- result = caseIXmlEObject(xmlIdClass);
- if (result == null)
- result = caseIJpaEObject(xmlIdClass);
- if (result == null)
- result = caseIJpaSourceObject(xmlIdClass);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_INHERITANCE : {
- XmlInheritance xmlInheritance = (XmlInheritance) theEObject;
- T result = caseXmlInheritance(xmlInheritance);
- if (result == null)
- result = caseXmlEObject(xmlInheritance);
- if (result == null)
- result = caseJpaEObject(xmlInheritance);
- if (result == null)
- result = caseIXmlEObject(xmlInheritance);
- if (result == null)
- result = caseIJpaEObject(xmlInheritance);
- if (result == null)
- result = caseIJpaSourceObject(xmlInheritance);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case OrmPackage.XML_MAP_KEY : {
- XmlMapKey xmlMapKey = (XmlMapKey) theEObject;
- T result = caseXmlMapKey(xmlMapKey);
- if (result == null)
- result = caseXmlEObject(xmlMapKey);
- if (result == null)
- result = caseJpaEObject(xmlMapKey);
- if (result == null)
- result = caseIXmlEObject(xmlMapKey);
- if (result == null)
- result = caseIJpaEObject(xmlMapKey);
- if (result == null)
- result = caseIJpaSourceObject(xmlMapKey);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- default :
- return defaultCase(theEObject);
- }
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlEObject(XmlEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Root Content Node</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Root Content Node</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlRootContentNode(XmlRootContentNode object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Entity Mappings Internal</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Entity Mappings Internal</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseEntityMappingsInternal(EntityMappingsInternal object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Entity Mappings</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Entity Mappings</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseEntityMappings(EntityMappings object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Entity Mappings For Xml</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Entity Mappings For Xml</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseEntityMappingsForXml(EntityMappingsForXml object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Type Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Type Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlTypeMapping(XmlTypeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Persistent Type</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Persistent Type</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlPersistentType(XmlPersistentType object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Embeddable</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Embeddable</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlEmbeddable(XmlEmbeddable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Attribute Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Attribute Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlAttributeMapping(XmlAttributeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Null Attribute Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Null Attribute Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlNullAttributeMapping(XmlNullAttributeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Persistent Attribute</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Persistent Attribute</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlPersistentAttribute(XmlPersistentAttribute object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Basic</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Basic</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlBasic(XmlBasic object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Id</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Id</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlId(XmlId object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Transient</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Transient</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlTransient(XmlTransient object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Embedded</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Embedded</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlEmbedded(XmlEmbedded object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Embedded Id</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Embedded Id</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlEmbeddedId(XmlEmbeddedId object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Version</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Version</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlVersion(XmlVersion object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Multi Relationship Mapping Internal</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Multi Relationship Mapping Internal</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlMultiRelationshipMappingInternal(XmlMultiRelationshipMappingInternal object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Multi Relationship Mapping For Xml</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Multi Relationship Mapping For Xml</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlMultiRelationshipMappingForXml(XmlMultiRelationshipMappingForXml object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Multi Relationship Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Multi Relationship Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlMultiRelationshipMapping(XmlMultiRelationshipMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml One To Many</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml One To Many</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlOneToMany(XmlOneToMany object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Many To Many</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Many To Many</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlManyToMany(XmlManyToMany object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Persistence Unit Metadata Internal</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Persistence Unit Metadata Internal</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T casePersistenceUnitMetadataInternal(PersistenceUnitMetadataInternal object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Persistence Unit Metadata</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Persistence Unit Metadata</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T casePersistenceUnitMetadata(PersistenceUnitMetadata object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Persistence Unit Metadata For Xml</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Persistence Unit Metadata For Xml</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T casePersistenceUnitMetadataForXml(PersistenceUnitMetadataForXml object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Persistence Unit Defaults Internal</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Persistence Unit Defaults Internal</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T casePersistenceUnitDefaultsInternal(PersistenceUnitDefaultsInternal object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Persistence Unit Defaults</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Persistence Unit Defaults</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T casePersistenceUnitDefaults(PersistenceUnitDefaults object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Persistence Unit Defaults For Xml</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Persistence Unit Defaults For Xml</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T casePersistenceUnitDefaultsForXml(PersistenceUnitDefaultsForXml object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Table</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Table</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlTable(XmlTable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Abstract Xml Named Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Abstract Xml Named Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseAbstractXmlNamedColumn(AbstractXmlNamedColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Abstract Xml Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Abstract Xml Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseAbstractXmlColumn(AbstractXmlColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlColumn(XmlColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Join Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Join Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlJoinColumn(XmlJoinColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IXml Column Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IXml Column Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIXmlColumnMapping(IXmlColumnMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Many To One</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Many To One</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlManyToOne(XmlManyToOne object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml One To One</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml One To One</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlOneToOne(XmlOneToOne object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Single Relationship Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Single Relationship Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlSingleRelationshipMapping(XmlSingleRelationshipMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Relationship Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Relationship Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlRelationshipMapping(XmlRelationshipMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Join Table</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Join Table</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlJoinTable(XmlJoinTable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Abstract Xml Table</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Abstract Xml Table</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseAbstractXmlTable(AbstractXmlTable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Override</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Override</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlOverride(XmlOverride object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Attribute Override</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Attribute Override</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlAttributeOverride(XmlAttributeOverride object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Association Override</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Association Override</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlAssociationOverride(XmlAssociationOverride object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Discriminator Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Discriminator Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlDiscriminatorColumn(XmlDiscriminatorColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Secondary Table</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Secondary Table</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlSecondaryTable(XmlSecondaryTable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Primary Key Join Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Primary Key Join Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlPrimaryKeyJoinColumn(XmlPrimaryKeyJoinColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Generated Value</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Generated Value</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlGeneratedValue(XmlGeneratedValue object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Generator</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Generator</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlGenerator(XmlGenerator object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Sequence Generator</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Sequence Generator</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlSequenceGenerator(XmlSequenceGenerator object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Table Generator</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Table Generator</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlTableGenerator(XmlTableGenerator object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Abstract Xml Query</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Abstract Xml Query</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseAbstractXmlQuery(AbstractXmlQuery object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Named Query</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Named Query</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlNamedQuery(XmlNamedQuery object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Named Native Query</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Named Native Query</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlNamedNativeQuery(XmlNamedNativeQuery object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Query Hint</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Query Hint</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlQueryHint(XmlQueryHint object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Unique Constraint</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Unique Constraint</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlUniqueConstraint(XmlUniqueConstraint object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Cascade</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Cascade</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlCascade(XmlCascade object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Id Class</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Id Class</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlIdClass(XmlIdClass object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Inheritance</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Inheritance</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlInheritance(XmlInheritance object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Map Key</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Map Key</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlMapKey(XmlMapKey object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaEObject(IJpaEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Jpa EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Jpa EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJpaEObject(JpaEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa Source Object</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa Source Object</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaSourceObject(IJpaSourceObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IXml EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IXml EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIXmlEObject(IXmlEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa Content Node</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa Content Node</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaContentNode(IJpaContentNode object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa Root Content Node</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa Root Content Node</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaRootContentNode(IJpaRootContentNode object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Mapped Superclass</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Mapped Superclass</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlMappedSuperclass(XmlMappedSuperclass object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Entity Internal</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Entity Internal</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlEntityInternal(XmlEntityInternal object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Entity For Xml</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Entity For Xml</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlEntityForXml(XmlEntityForXml object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Entity</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Entity</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlEntity(XmlEntity object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAttribute Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAttribute Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAttributeMapping(IAttributeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IColumn Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IColumn Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIColumnMapping(IColumnMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IPersistent Attribute</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IPersistent Attribute</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIPersistentAttribute(IPersistentAttribute object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ITable</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ITable</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseITable(ITable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>INamed Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>INamed Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseINamedColumn(INamedColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAbstract Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAbstract Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAbstractColumn(IAbstractColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IColumn</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IColumn</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIColumn(IColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAbstract Join Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAbstract Join Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAbstractJoinColumn(IAbstractJoinColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJoin Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJoin Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJoinColumn(IJoinColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ISingle Relationship Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ISingle Relationship Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseISingleRelationshipMapping(ISingleRelationshipMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IMany To One</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IMany To One</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIManyToOne(IManyToOne object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IOne To One</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IOne To One</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIOneToOne(IOneToOne object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJoin Table</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJoin Table</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJoinTable(IJoinTable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IOverride</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IOverride</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIOverride(IOverride object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAttribute Override</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAttribute Override</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAttributeOverride(IAttributeOverride object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAssociation Override</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAssociation Override</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAssociationOverride(IAssociationOverride object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IDiscriminator Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IDiscriminator Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIDiscriminatorColumn(IDiscriminatorColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ISecondary Table</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ISecondary Table</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseISecondaryTable(ISecondaryTable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IPrimary Key Join Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IPrimary Key Join Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIPrimaryKeyJoinColumn(IPrimaryKeyJoinColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IGenerated Value</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IGenerated Value</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIGeneratedValue(IGeneratedValue object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IGenerator</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IGenerator</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIGenerator(IGenerator object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ISequence Generator</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ISequence Generator</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseISequenceGenerator(ISequenceGenerator object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ITable Generator</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ITable Generator</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseITableGenerator(ITableGenerator object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IQuery</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IQuery</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIQuery(IQuery object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>INamed Query</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>INamed Query</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseINamedQuery(INamedQuery object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>INamed Native Query</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>INamed Native Query</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseINamedNativeQuery(INamedNativeQuery object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IQuery Hint</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IQuery Hint</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIQueryHint(IQueryHint object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IUnique Constraint</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IUnique Constraint</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIUniqueConstraint(IUniqueConstraint object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ICascade</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ICascade</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseICascade(ICascade object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IBasic</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IBasic</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIBasic(IBasic object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IId</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IId</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIId(IId object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ITransient</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ITransient</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseITransient(ITransient object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IEmbedded</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IEmbedded</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIEmbedded(IEmbedded object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IEmbedded Id</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IEmbedded Id</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIEmbeddedId(IEmbeddedId object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IVersion</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IVersion</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIVersion(IVersion object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IRelationship Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IRelationship Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIRelationshipMapping(IRelationshipMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>INon Owning Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>INon Owning Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseINonOwningMapping(INonOwningMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IMulti Relationship Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IMulti Relationship Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIMultiRelationshipMapping(IMultiRelationshipMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IOne To Many</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IOne To Many</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIOneToMany(IOneToMany object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IMany To Many</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IMany To Many</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIManyToMany(IManyToMany object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IPersistent Type</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IPersistent Type</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIPersistentType(IPersistentType object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IMapped Superclass</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IMapped Superclass</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIMappedSuperclass(IMappedSuperclass object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IEntity</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IEntity</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIEntity(IEntity object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IEmbeddable</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IEmbeddable</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIEmbeddable(IEmbeddable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IType Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IType Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseITypeMapping(ITypeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch, but this is the last case anyway.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject)
- * @generated
- */
- public T defaultCase(EObject object) {
- return null;
- }
-} //JpaCoreXmlSwitch
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/MappingFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/MappingFileRef.java
deleted file mode 100644
index 890bd48c7a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/MappingFileRef.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.content.persistence;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.internal.emf.utilities.DOMUtilities;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Mapping File Ref</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.MappingFileRef#getFileName <em>File Name</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getMappingFileRef()
- * @model kind="class"
- * @generated
- */
-public class MappingFileRef extends XmlEObject
-{
- /**
- * The default value of the '{@link #getFileName() <em>File Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getFileName()
- * @generated
- * @ordered
- */
- protected static final String FILE_NAME_EDEFAULT = "";
-
- /**
- * The cached value of the '{@link #getFileName() <em>File Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getFileName()
- * @generated
- * @ordered
- */
- protected String fileName = FILE_NAME_EDEFAULT;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected MappingFileRef() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return PersistencePackage.Literals.MAPPING_FILE_REF;
- }
-
- /**
- * Returns the value of the '<em><b>File Name</b></em>' attribute.
- * The default value is <code>""</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>File Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>File Name</em>' attribute.
- * @see #setFileName(String)
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getMappingFileRef_FileName()
- * @model default="" unique="false" ordered="false"
- * @generated
- */
- public String getFileName() {
- return fileName;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.MappingFileRef#getFileName <em>File Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>File Name</em>' attribute.
- * @see #getFileName()
- * @generated
- */
- public void setFileName(String newFileName) {
- String oldFileName = fileName;
- fileName = newFileName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.MAPPING_FILE_REF__FILE_NAME, oldFileName, fileName));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case PersistencePackage.MAPPING_FILE_REF__FILE_NAME :
- return getFileName();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case PersistencePackage.MAPPING_FILE_REF__FILE_NAME :
- setFileName((String) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case PersistencePackage.MAPPING_FILE_REF__FILE_NAME :
- setFileName(FILE_NAME_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case PersistencePackage.MAPPING_FILE_REF__FILE_NAME :
- return FILE_NAME_EDEFAULT == null ? fileName != null : !FILE_NAME_EDEFAULT.equals(fileName);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (fileName: ");
- result.append(fileName);
- result.append(')');
- return result.toString();
- }
-
- @Override
- public ITextRange validationTextRange() {
- IDOMNode textNode = (IDOMNode) DOMUtilities.getChildTextNode(node);
- return (textNode == null) ? buildTextRange(node) : buildTextRange(textNode);
- }
-
- public IJpaFile getMappingFile() {
- // check flexible project structure
- IVirtualComponent component = ComponentCore.createComponent(getJpaProject().project());
- IVirtualFolder virtualRootFolder = component.getRootFolder();
- IVirtualFile virtualMappingFile = virtualRootFolder.getFile(new Path(getJpaProject().rootDeployLocation() + '/' + fileName));
- // keep track of whether one has been found so that we may know if multiple exist
- IJpaFile mappingFile = null;
- for (IFile underlyingFile : virtualMappingFile.getUnderlyingFiles()) {
- IJpaFile jpaFile = JptCorePlugin.jpaFile(underlyingFile);
- if (jpaFile != null) {
- if (mappingFile != null) {
- return null; // multiple do exist
- }
- else {
- mappingFile = jpaFile;
- }
- }
- }
- return mappingFile;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/Persistence.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/Persistence.java
deleted file mode 100644
index f78bb27b36..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/Persistence.java
+++ /dev/null
@@ -1,365 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.persistence;
-
-import java.util.Collection;
-import java.util.Iterator;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.persistence.resource.IPersistenceXmlContentNodes;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Persistence</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.Persistence#getPersistenceUnits <em>Persistence Units</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.Persistence#getVersion <em>Version</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.Persistence#getRoot <em>Root</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistence()
- * @model kind="class"
- * @generated
- */
-public class Persistence extends XmlEObject implements IJpaContentNode
-{
- /**
- * The cached value of the '{@link #getPersistenceUnits() <em>Persistence Units</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPersistenceUnits()
- * @generated
- * @ordered
- */
- protected EList<PersistenceUnit> persistenceUnits;
-
- /**
- * The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getVersion()
- * @generated
- * @ordered
- */
- protected static final String VERSION_EDEFAULT = null;
-
- /**
- * The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getVersion()
- * @generated
- * @ordered
- */
- protected String version = VERSION_EDEFAULT;
-
- /**
- * The cached value of the '{@link #getRoot() <em>Root</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getRoot()
- * @generated
- * @ordered
- */
- protected PersistenceXmlRootContentNode root;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected Persistence() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return PersistencePackage.Literals.PERSISTENCE;
- }
-
- /**
- * Returns the value of the '<em><b>Persistence Units</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persistence Units</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistence_PersistenceUnits()
- * @model containment="true"
- * @generated
- */
- public EList<PersistenceUnit> getPersistenceUnits() {
- if (persistenceUnits == null) {
- persistenceUnits = new EObjectContainmentEList<PersistenceUnit>(PersistenceUnit.class, this, PersistencePackage.PERSISTENCE__PERSISTENCE_UNITS);
- }
- return persistenceUnits;
- }
-
- /**
- * Returns the value of the '<em><b>Version</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the value of the '<em>Version</em>' attribute.
- * @see #setVersion(String)
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistence_Version()
- * @model unique="false" dataType="org.eclipse.jpt.core.internal.content.persistence.Version" required="true"
- * @generated
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.Persistence#getVersion <em>Version</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Version</em>' attribute.
- * @see #getVersion()
- * @generated
- */
- public void setVersion(String newVersion) {
- String oldVersion = version;
- version = newVersion;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.PERSISTENCE__VERSION, oldVersion, version));
- }
-
- /**
- * Returns the value of the '<em><b>Root</b></em>' reference.
- * It is bidirectional and its opposite is '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode#getPersistence <em>Persistence</em>}'.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Root</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Root</em>' reference.
- * @see #setRoot(PersistenceXmlRootContentNode)
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistence_Root()
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode#getPersistence
- * @model opposite="persistence" resolveProxies="false" required="true" ordered="false"
- * @generated
- */
- public PersistenceXmlRootContentNode getRoot() {
- return root;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetRoot(PersistenceXmlRootContentNode newRoot, NotificationChain msgs) {
- PersistenceXmlRootContentNode oldRoot = root;
- root = newRoot;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PersistencePackage.PERSISTENCE__ROOT, oldRoot, newRoot);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.Persistence#getRoot <em>Root</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Root</em>' reference.
- * @see #getRoot()
- * @generated
- */
- public void setRoot(PersistenceXmlRootContentNode newRoot) {
- if (newRoot != root) {
- NotificationChain msgs = null;
- if (root != null)
- msgs = ((InternalEObject) root).eInverseRemove(this, PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__PERSISTENCE, PersistenceXmlRootContentNode.class, msgs);
- if (newRoot != null)
- msgs = ((InternalEObject) newRoot).eInverseAdd(this, PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__PERSISTENCE, PersistenceXmlRootContentNode.class, msgs);
- msgs = basicSetRoot(newRoot, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.PERSISTENCE__ROOT, newRoot, newRoot));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE__ROOT :
- if (root != null)
- msgs = ((InternalEObject) root).eInverseRemove(this, PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__PERSISTENCE, PersistenceXmlRootContentNode.class, msgs);
- return basicSetRoot((PersistenceXmlRootContentNode) otherEnd, msgs);
- }
- return super.eInverseAdd(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE__PERSISTENCE_UNITS :
- return ((InternalEList<?>) getPersistenceUnits()).basicRemove(otherEnd, msgs);
- case PersistencePackage.PERSISTENCE__ROOT :
- return basicSetRoot(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE__PERSISTENCE_UNITS :
- return getPersistenceUnits();
- case PersistencePackage.PERSISTENCE__VERSION :
- return getVersion();
- case PersistencePackage.PERSISTENCE__ROOT :
- return getRoot();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE__PERSISTENCE_UNITS :
- getPersistenceUnits().clear();
- getPersistenceUnits().addAll((Collection<? extends PersistenceUnit>) newValue);
- return;
- case PersistencePackage.PERSISTENCE__VERSION :
- setVersion((String) newValue);
- return;
- case PersistencePackage.PERSISTENCE__ROOT :
- setRoot((PersistenceXmlRootContentNode) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE__PERSISTENCE_UNITS :
- getPersistenceUnits().clear();
- return;
- case PersistencePackage.PERSISTENCE__VERSION :
- setVersion(VERSION_EDEFAULT);
- return;
- case PersistencePackage.PERSISTENCE__ROOT :
- setRoot((PersistenceXmlRootContentNode) null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE__PERSISTENCE_UNITS :
- return persistenceUnits != null && !persistenceUnits.isEmpty();
- case PersistencePackage.PERSISTENCE__VERSION :
- return VERSION_EDEFAULT == null ? version != null : !VERSION_EDEFAULT.equals(version);
- case PersistencePackage.PERSISTENCE__ROOT :
- return root != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (version: ");
- result.append(version);
- result.append(')');
- return result.toString();
- }
-
- /**
- * Override this because Persistence does not have an eContainer()
- * This is because persistence is the "root" feature of the doc for xml Translators
- * and thus cannot be "contained"
- */
- @Override
- public IJpaProject getJpaProject() {
- IJpaFile file = getJpaFile();
- return (file == null) ? null : file.getJpaProject();
- }
-
- public IJpaContentNode getContentNode(int offset) {
- for (Iterator<PersistenceUnit> i = getPersistenceUnits().iterator(); i.hasNext();) {
- PersistenceUnit persistenceUnit = i.next();
- if (persistenceUnit.getNode().contains(offset)) {
- return persistenceUnit;
- }
- }
- return this;
- }
-
- public Object getId() {
- return IPersistenceXmlContentNodes.PERSISTENCEXML_ROOT_ID;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceFactory.java
deleted file mode 100644
index 6fd2712ee8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceFactory.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.persistence;
-
-import org.eclipse.emf.common.util.Enumerator;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.impl.EFactoryImpl;
-import org.eclipse.emf.ecore.plugin.EcorePlugin;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Factory</b> for the model.
- * It provides a create method for each non-abstract class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage
- * @generated
- */
-public class PersistenceFactory extends EFactoryImpl
-{
- /**
- * The singleton instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final PersistenceFactory eINSTANCE = init();
-
- /**
- * Creates the default factory implementation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static PersistenceFactory init() {
- try {
- PersistenceFactory thePersistenceFactory = (PersistenceFactory) EPackage.Registry.INSTANCE.getEFactory("persistence.xmi");
- if (thePersistenceFactory != null) {
- return thePersistenceFactory;
- }
- }
- catch (Exception exception) {
- EcorePlugin.INSTANCE.log(exception);
- }
- return new PersistenceFactory();
- }
-
- /**
- * Creates an instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PersistenceFactory() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public EObject create(EClass eClass) {
- switch (eClass.getClassifierID()) {
- case PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE :
- return createPersistenceXmlRootContentNode();
- case PersistencePackage.PERSISTENCE :
- return createPersistence();
- case PersistencePackage.PERSISTENCE_UNIT :
- return createPersistenceUnit();
- case PersistencePackage.MAPPING_FILE_REF :
- return createMappingFileRef();
- case PersistencePackage.JAVA_CLASS_REF :
- return createJavaClassRef();
- case PersistencePackage.PROPERTIES :
- return createProperties();
- case PersistencePackage.PROPERTY :
- return createProperty();
- default :
- throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object createFromString(EDataType eDataType, String initialValue) {
- switch (eDataType.getClassifierID()) {
- case PersistencePackage.PERSISTENCE_UNIT_TRANSACTION_TYPE :
- return createPersistenceUnitTransactionTypeFromString(eDataType, initialValue);
- case PersistencePackage.PERSISTENCE_UNIT_TRANSACTION_TYPE_OBJECT :
- return createPersistenceUnitTransactionTypeObjectFromString(eDataType, initialValue);
- case PersistencePackage.VERSION :
- return createVersionFromString(eDataType, initialValue);
- default :
- throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String convertToString(EDataType eDataType, Object instanceValue) {
- switch (eDataType.getClassifierID()) {
- case PersistencePackage.PERSISTENCE_UNIT_TRANSACTION_TYPE :
- return convertPersistenceUnitTransactionTypeToString(eDataType, instanceValue);
- case PersistencePackage.PERSISTENCE_UNIT_TRANSACTION_TYPE_OBJECT :
- return convertPersistenceUnitTransactionTypeObjectToString(eDataType, instanceValue);
- case PersistencePackage.VERSION :
- return convertVersionToString(eDataType, instanceValue);
- default :
- throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Persistence createPersistence() {
- Persistence persistence = new Persistence();
- return persistence;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PersistenceUnit createPersistenceUnit() {
- PersistenceUnit persistenceUnit = new PersistenceUnit();
- return persistenceUnit;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public MappingFileRef createMappingFileRef() {
- MappingFileRef mappingFileRef = new MappingFileRef();
- return mappingFileRef;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JavaClassRef createJavaClassRef() {
- JavaClassRef javaClassRef = new JavaClassRef();
- return javaClassRef;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Properties createProperties() {
- Properties properties = new Properties();
- return properties;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Property createProperty() {
- Property property = new Property();
- return property;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PersistenceXmlRootContentNode createPersistenceXmlRootContentNode() {
- PersistenceXmlRootContentNode persistenceXmlRootContentNode = new PersistenceXmlRootContentNode();
- return persistenceXmlRootContentNode;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PersistenceUnitTransactionType createPersistenceUnitTransactionTypeFromString(EDataType eDataType, String initialValue) {
- PersistenceUnitTransactionType result = PersistenceUnitTransactionType.get(initialValue);
- if (result == null)
- throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertPersistenceUnitTransactionTypeToString(EDataType eDataType, Object instanceValue) {
- return instanceValue == null ? null : instanceValue.toString();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Enumerator createPersistenceUnitTransactionTypeObjectFromString(EDataType eDataType, String initialValue) {
- return (Enumerator) super.createFromString(eDataType, initialValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertPersistenceUnitTransactionTypeObjectToString(EDataType eDataType, Object instanceValue) {
- return super.convertToString(eDataType, instanceValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String createVersionFromString(EDataType eDataType, String initialValue) {
- return (String) super.createFromString(eDataType, initialValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertVersionToString(EDataType eDataType, Object instanceValue) {
- return super.convertToString(eDataType, instanceValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PersistencePackage getPersistencePackage() {
- return (PersistencePackage) getEPackage();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @deprecated
- * @generated
- */
- @Deprecated
- public static PersistencePackage getPackage() {
- return PersistencePackage.eINSTANCE;
- }
-} //PersistenceInternalFactory
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistencePackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistencePackage.java
deleted file mode 100644
index 6c9dea2b53..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistencePackage.java
+++ /dev/null
@@ -1,1380 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.persistence;
-
-import org.eclipse.emf.common.util.Enumerator;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.content.java.JpaJavaPackage;
-import org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Package</b> for the model.
- * It contains accessors for the meta objects to represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceFactory
- * @model kind="package"
- * @generated
- */
-public class PersistencePackage extends EPackageImpl
-{
- /**
- * The package name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNAME = "persistence";
-
- /**
- * The package namespace URI.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNS_URI = "persistence.xmi";
-
- /**
- * The package namespace name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNS_PREFIX = "org.eclipse.jpt.core.content.persistence";
-
- /**
- * The singleton instance of the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final PersistencePackage eINSTANCE = org.eclipse.jpt.core.internal.content.persistence.PersistencePackage.init();
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.persistence.Persistence <em>Persistence</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.Persistence
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistence()
- * @generated
- */
- public static final int PERSISTENCE = 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit <em>Unit</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnit()
- * @generated
- */
- public static final int PERSISTENCE_UNIT = 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.persistence.Properties <em>Properties</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.Properties
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getProperties()
- * @generated
- */
- public static final int PROPERTIES = 5;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.persistence.Property <em>Property</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.Property
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getProperty()
- * @generated
- */
- public static final int PROPERTY = 6;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode <em>Xml Root Content Node</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceXmlRootContentNode()
- * @generated
- */
- public static final int PERSISTENCE_XML_ROOT_CONTENT_NODE = 0;
-
- /**
- * The feature id for the '<em><b>Jpa File</b></em>' container reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_XML_ROOT_CONTENT_NODE__JPA_FILE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Persistence</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_XML_ROOT_CONTENT_NODE__PERSISTENCE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Xml Root Content Node</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_XML_ROOT_CONTENT_NODE_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Persistence Units</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE__PERSISTENCE_UNITS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Version</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE__VERSION = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Root</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE__ROOT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Persistence</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Description</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT__DESCRIPTION = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Provider</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT__PROVIDER = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Jta Data Source</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT__JTA_DATA_SOURCE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Non Jta Data Source</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Mapping Files</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT__MAPPING_FILES = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Jar Files</b></em>' attribute list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT__JAR_FILES = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Classes</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT__CLASSES = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Exclude Unlisted Classes</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Properties</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT__PROPERTIES = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT__NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 9;
-
- /**
- * The feature id for the '<em><b>Transaction Type</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT__TRANSACTION_TYPE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 10;
-
- /**
- * The number of structural features of the '<em>Unit</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PERSISTENCE_UNIT_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 11;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.persistence.MappingFileRef <em>Mapping File Ref</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.MappingFileRef
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getMappingFileRef()
- * @generated
- */
- public static final int MAPPING_FILE_REF = 3;
-
- /**
- * The feature id for the '<em><b>File Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int MAPPING_FILE_REF__FILE_NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Mapping File Ref</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int MAPPING_FILE_REF_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.persistence.JavaClassRef <em>Java Class Ref</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.JavaClassRef
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getJavaClassRef()
- * @generated
- */
- public static final int JAVA_CLASS_REF = 4;
-
- /**
- * The feature id for the '<em><b>Java Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_CLASS_REF__JAVA_CLASS = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Java Class Ref</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int JAVA_CLASS_REF_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Properties</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PROPERTIES__PROPERTIES = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>Properties</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PROPERTIES_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PROPERTY__NAME = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PROPERTY__VALUE = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>Property</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int PROPERTY_FEATURE_COUNT = JpaCorePackage.XML_EOBJECT_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnitTransactionType <em>Unit Transaction Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnitTransactionType
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnitTransactionType()
- * @generated
- */
- public static final int PERSISTENCE_UNIT_TRANSACTION_TYPE = 7;
-
- /**
- * The meta object id for the '<em>Unit Transaction Type Object</em>' data type.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.common.util.Enumerator
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnitTransactionTypeObject()
- * @generated
- */
- public static final int PERSISTENCE_UNIT_TRANSACTION_TYPE_OBJECT = 8;
-
- /**
- * The meta object id for the '<em>Version</em>' data type.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see java.lang.String
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getVersion()
- * @generated
- */
- public static final int VERSION = 9;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass persistenceEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass persistenceUnitEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass mappingFileRefEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass javaClassRefEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass propertiesEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass propertyEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass persistenceXmlRootContentNodeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EEnum persistenceUnitTransactionTypeEEnum = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EDataType persistenceUnitTransactionTypeObjectEDataType = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EDataType versionEDataType = null;
-
- /**
- * Creates an instance of the model <b>Package</b>, registered with
- * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
- * package URI value.
- * <p>Note: the correct way to create the package is via the static
- * factory method {@link #init init()}, which also performs
- * initialization of the package, or returns the registered package,
- * if one already exists.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.ecore.EPackage.Registry
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#eNS_URI
- * @see #init()
- * @generated
- */
- private PersistencePackage() {
- super(eNS_URI, PersistenceFactory.eINSTANCE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static boolean isInited = false;
-
- /**
- * Creates, registers, and initializes the <b>Package</b> for this
- * model, and for any others upon which it depends. Simple
- * dependencies are satisfied by calling this method on all
- * dependent packages before doing anything else. This method drives
- * initialization for interdependent packages directly, in parallel
- * with this package, itself.
- * <p>Of this package and its interdependencies, all packages which
- * have not yet been registered by their URI values are first created
- * and registered. The packages are then initialized in two steps:
- * meta-model objects for all of the packages are created before any
- * are initialized, since one package's meta-model objects may refer to
- * those of another.
- * <p>Invocation of this method will not affect any packages that have
- * already been initialized.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #eNS_URI
- * @see #createPackageContents()
- * @see #initializePackageContents()
- * @generated
- */
- public static PersistencePackage init() {
- if (isInited)
- return (PersistencePackage) EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI);
- // Obtain or create and register package
- PersistencePackage thePersistencePackage = (PersistencePackage) (EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof PersistencePackage ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new PersistencePackage());
- isInited = true;
- // Initialize simple dependencies
- EcorePackage.eINSTANCE.eClass();
- XMLTypePackage.eINSTANCE.eClass();
- // Obtain or create and register interdependencies
- JpaCorePackage theJpaCorePackage = (JpaCorePackage) (EPackage.Registry.INSTANCE.getEPackage(JpaCorePackage.eNS_URI) instanceof JpaCorePackage ? EPackage.Registry.INSTANCE.getEPackage(JpaCorePackage.eNS_URI) : JpaCorePackage.eINSTANCE);
- JpaCoreMappingsPackage theJpaCoreMappingsPackage = (JpaCoreMappingsPackage) (EPackage.Registry.INSTANCE.getEPackage(JpaCoreMappingsPackage.eNS_URI) instanceof JpaCoreMappingsPackage ? EPackage.Registry.INSTANCE.getEPackage(JpaCoreMappingsPackage.eNS_URI) : JpaCoreMappingsPackage.eINSTANCE);
- JpaJavaPackage theJpaJavaPackage = (JpaJavaPackage) (EPackage.Registry.INSTANCE.getEPackage(JpaJavaPackage.eNS_URI) instanceof JpaJavaPackage ? EPackage.Registry.INSTANCE.getEPackage(JpaJavaPackage.eNS_URI) : JpaJavaPackage.eINSTANCE);
- JpaJavaMappingsPackage theJpaJavaMappingsPackage = (JpaJavaMappingsPackage) (EPackage.Registry.INSTANCE.getEPackage(JpaJavaMappingsPackage.eNS_URI) instanceof JpaJavaMappingsPackage ? EPackage.Registry.INSTANCE.getEPackage(JpaJavaMappingsPackage.eNS_URI) : JpaJavaMappingsPackage.eINSTANCE);
- OrmPackage theOrmPackage = (OrmPackage) (EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) instanceof OrmPackage ? EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) : OrmPackage.eINSTANCE);
- // Create package meta-data objects
- thePersistencePackage.createPackageContents();
- theJpaCorePackage.createPackageContents();
- theJpaCoreMappingsPackage.createPackageContents();
- theJpaJavaPackage.createPackageContents();
- theJpaJavaMappingsPackage.createPackageContents();
- theOrmPackage.createPackageContents();
- // Initialize created meta-data
- thePersistencePackage.initializePackageContents();
- theJpaCorePackage.initializePackageContents();
- theJpaCoreMappingsPackage.initializePackageContents();
- theJpaJavaPackage.initializePackageContents();
- theJpaJavaMappingsPackage.initializePackageContents();
- theOrmPackage.initializePackageContents();
- // Mark meta-data to indicate it can't be changed
- thePersistencePackage.freeze();
- return thePersistencePackage;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.persistence.Persistence <em>Persistence</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Persistence</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.Persistence
- * @generated
- */
- public EClass getPersistence() {
- return persistenceEClass;
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.content.persistence.Persistence#getPersistenceUnits <em>Persistence Units</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Persistence Units</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.Persistence#getPersistenceUnits()
- * @see #getPersistence()
- * @generated
- */
- public EReference getPersistence_PersistenceUnits() {
- return (EReference) persistenceEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.persistence.Persistence#getVersion <em>Version</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Version</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.Persistence#getVersion()
- * @see #getPersistence()
- * @generated
- */
- public EAttribute getPersistence_Version() {
- return (EAttribute) persistenceEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.jpt.core.internal.content.persistence.Persistence#getRoot <em>Root</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Root</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.Persistence#getRoot()
- * @see #getPersistence()
- * @generated
- */
- public EReference getPersistence_Root() {
- return (EReference) persistenceEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit <em>Unit</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Unit</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit
- * @generated
- */
- public EClass getPersistenceUnit() {
- return persistenceUnitEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getDescription <em>Description</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Description</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getDescription()
- * @see #getPersistenceUnit()
- * @generated
- */
- public EAttribute getPersistenceUnit_Description() {
- return (EAttribute) persistenceUnitEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getProvider <em>Provider</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Provider</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getProvider()
- * @see #getPersistenceUnit()
- * @generated
- */
- public EAttribute getPersistenceUnit_Provider() {
- return (EAttribute) persistenceUnitEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getJtaDataSource <em>Jta Data Source</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Jta Data Source</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getJtaDataSource()
- * @see #getPersistenceUnit()
- * @generated
- */
- public EAttribute getPersistenceUnit_JtaDataSource() {
- return (EAttribute) persistenceUnitEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getNonJtaDataSource <em>Non Jta Data Source</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Non Jta Data Source</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getNonJtaDataSource()
- * @see #getPersistenceUnit()
- * @generated
- */
- public EAttribute getPersistenceUnit_NonJtaDataSource() {
- return (EAttribute) persistenceUnitEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getMappingFiles <em>Mapping Files</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Mapping Files</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getMappingFiles()
- * @see #getPersistenceUnit()
- * @generated
- */
- public EReference getPersistenceUnit_MappingFiles() {
- return (EReference) persistenceUnitEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for the attribute list '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getJarFiles <em>Jar Files</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute list '<em>Jar Files</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getJarFiles()
- * @see #getPersistenceUnit()
- * @generated
- */
- public EAttribute getPersistenceUnit_JarFiles() {
- return (EAttribute) persistenceUnitEClass.getEStructuralFeatures().get(5);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getClasses <em>Classes</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Classes</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getClasses()
- * @see #getPersistenceUnit()
- * @generated
- */
- public EReference getPersistenceUnit_Classes() {
- return (EReference) persistenceUnitEClass.getEStructuralFeatures().get(6);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#isExcludeUnlistedClasses <em>Exclude Unlisted Classes</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Exclude Unlisted Classes</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#isExcludeUnlistedClasses()
- * @see #getPersistenceUnit()
- * @generated
- */
- public EAttribute getPersistenceUnit_ExcludeUnlistedClasses() {
- return (EAttribute) persistenceUnitEClass.getEStructuralFeatures().get(7);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getProperties <em>Properties</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Properties</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getProperties()
- * @see #getPersistenceUnit()
- * @generated
- */
- public EReference getPersistenceUnit_Properties() {
- return (EReference) persistenceUnitEClass.getEStructuralFeatures().get(8);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getName <em>Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Name</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getName()
- * @see #getPersistenceUnit()
- * @generated
- */
- public EAttribute getPersistenceUnit_Name() {
- return (EAttribute) persistenceUnitEClass.getEStructuralFeatures().get(9);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getTransactionType <em>Transaction Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Transaction Type</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getTransactionType()
- * @see #getPersistenceUnit()
- * @generated
- */
- public EAttribute getPersistenceUnit_TransactionType() {
- return (EAttribute) persistenceUnitEClass.getEStructuralFeatures().get(10);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.persistence.MappingFileRef <em>Mapping File Ref</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Mapping File Ref</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.MappingFileRef
- * @generated
- */
- public EClass getMappingFileRef() {
- return mappingFileRefEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.persistence.MappingFileRef#getFileName <em>File Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>File Name</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.MappingFileRef#getFileName()
- * @see #getMappingFileRef()
- * @generated
- */
- public EAttribute getMappingFileRef_FileName() {
- return (EAttribute) mappingFileRefEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.persistence.JavaClassRef <em>Java Class Ref</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Java Class Ref</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.JavaClassRef
- * @generated
- */
- public EClass getJavaClassRef() {
- return javaClassRefEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.persistence.JavaClassRef#getJavaClass <em>Java Class</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Java Class</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.JavaClassRef#getJavaClass()
- * @see #getJavaClassRef()
- * @generated
- */
- public EAttribute getJavaClassRef_JavaClass() {
- return (EAttribute) javaClassRefEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.persistence.Properties <em>Properties</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Properties</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.Properties
- * @generated
- */
- public EClass getProperties() {
- return propertiesEClass;
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.content.persistence.Properties#getProperties <em>Properties</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Properties</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.Properties#getProperties()
- * @see #getProperties()
- * @generated
- */
- public EReference getProperties_Properties() {
- return (EReference) propertiesEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.persistence.Property <em>Property</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Property</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.Property
- * @generated
- */
- public EClass getProperty() {
- return propertyEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.persistence.Property#getName <em>Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Name</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.Property#getName()
- * @see #getProperty()
- * @generated
- */
- public EAttribute getProperty_Name() {
- return (EAttribute) propertyEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.content.persistence.Property#getValue <em>Value</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Value</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.Property#getValue()
- * @see #getProperty()
- * @generated
- */
- public EAttribute getProperty_Value() {
- return (EAttribute) propertyEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode <em>Xml Root Content Node</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Xml Root Content Node</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode
- * @generated
- */
- public EClass getPersistenceXmlRootContentNode() {
- return persistenceXmlRootContentNodeEClass;
- }
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode#getPersistence <em>Persistence</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Persistence</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode#getPersistence()
- * @see #getPersistenceXmlRootContentNode()
- * @generated
- */
- public EReference getPersistenceXmlRootContentNode_Persistence() {
- return (EReference) persistenceXmlRootContentNodeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnitTransactionType <em>Unit Transaction Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for enum '<em>Unit Transaction Type</em>'.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnitTransactionType
- * @generated
- */
- public EEnum getPersistenceUnitTransactionType() {
- return persistenceUnitTransactionTypeEEnum;
- }
-
- /**
- * Returns the meta object for data type '{@link org.eclipse.emf.common.util.Enumerator <em>Unit Transaction Type Object</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for data type '<em>Unit Transaction Type Object</em>'.
- * @see org.eclipse.emf.common.util.Enumerator
- * @model instanceClass="org.eclipse.emf.common.util.Enumerator"
- * @generated
- */
- public EDataType getPersistenceUnitTransactionTypeObject() {
- return persistenceUnitTransactionTypeObjectEDataType;
- }
-
- /**
- * Returns the meta object for data type '{@link java.lang.String <em>Version</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for data type '<em>Version</em>'.
- * @see java.lang.String
- * @model instanceClass="java.lang.String"
- * @generated
- */
- public EDataType getVersion() {
- return versionEDataType;
- }
-
- /**
- * Returns the factory that creates the instances of the model.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the factory that creates the instances of the model.
- * @generated
- */
- public PersistenceFactory getPersistenceFactory() {
- return (PersistenceFactory) getEFactoryInstance();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isCreated = false;
-
- /**
- * Creates the meta-model objects for the package. This method is
- * guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void createPackageContents() {
- if (isCreated)
- return;
- isCreated = true;
- // Create classes and their features
- persistenceXmlRootContentNodeEClass = createEClass(PERSISTENCE_XML_ROOT_CONTENT_NODE);
- createEReference(persistenceXmlRootContentNodeEClass, PERSISTENCE_XML_ROOT_CONTENT_NODE__PERSISTENCE);
- persistenceEClass = createEClass(PERSISTENCE);
- createEReference(persistenceEClass, PERSISTENCE__PERSISTENCE_UNITS);
- createEAttribute(persistenceEClass, PERSISTENCE__VERSION);
- createEReference(persistenceEClass, PERSISTENCE__ROOT);
- persistenceUnitEClass = createEClass(PERSISTENCE_UNIT);
- createEAttribute(persistenceUnitEClass, PERSISTENCE_UNIT__DESCRIPTION);
- createEAttribute(persistenceUnitEClass, PERSISTENCE_UNIT__PROVIDER);
- createEAttribute(persistenceUnitEClass, PERSISTENCE_UNIT__JTA_DATA_SOURCE);
- createEAttribute(persistenceUnitEClass, PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE);
- createEReference(persistenceUnitEClass, PERSISTENCE_UNIT__MAPPING_FILES);
- createEAttribute(persistenceUnitEClass, PERSISTENCE_UNIT__JAR_FILES);
- createEReference(persistenceUnitEClass, PERSISTENCE_UNIT__CLASSES);
- createEAttribute(persistenceUnitEClass, PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES);
- createEReference(persistenceUnitEClass, PERSISTENCE_UNIT__PROPERTIES);
- createEAttribute(persistenceUnitEClass, PERSISTENCE_UNIT__NAME);
- createEAttribute(persistenceUnitEClass, PERSISTENCE_UNIT__TRANSACTION_TYPE);
- mappingFileRefEClass = createEClass(MAPPING_FILE_REF);
- createEAttribute(mappingFileRefEClass, MAPPING_FILE_REF__FILE_NAME);
- javaClassRefEClass = createEClass(JAVA_CLASS_REF);
- createEAttribute(javaClassRefEClass, JAVA_CLASS_REF__JAVA_CLASS);
- propertiesEClass = createEClass(PROPERTIES);
- createEReference(propertiesEClass, PROPERTIES__PROPERTIES);
- propertyEClass = createEClass(PROPERTY);
- createEAttribute(propertyEClass, PROPERTY__NAME);
- createEAttribute(propertyEClass, PROPERTY__VALUE);
- // Create enums
- persistenceUnitTransactionTypeEEnum = createEEnum(PERSISTENCE_UNIT_TRANSACTION_TYPE);
- // Create data types
- persistenceUnitTransactionTypeObjectEDataType = createEDataType(PERSISTENCE_UNIT_TRANSACTION_TYPE_OBJECT);
- versionEDataType = createEDataType(VERSION);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isInitialized = false;
-
- /**
- * Complete the initialization of the package and its meta-model. This
- * method is guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void initializePackageContents() {
- if (isInitialized)
- return;
- isInitialized = true;
- // Initialize package
- setName(eNAME);
- setNsPrefix(eNS_PREFIX);
- setNsURI(eNS_URI);
- // Obtain other dependent packages
- JpaCorePackage theJpaCorePackage = (JpaCorePackage) EPackage.Registry.INSTANCE.getEPackage(JpaCorePackage.eNS_URI);
- XMLTypePackage theXMLTypePackage = (XMLTypePackage) EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI);
- EcorePackage theEcorePackage = (EcorePackage) EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
- // Create type parameters
- // Set bounds for type parameters
- // Add supertypes to classes
- persistenceXmlRootContentNodeEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- persistenceXmlRootContentNodeEClass.getESuperTypes().add(theJpaCorePackage.getIJpaRootContentNode());
- persistenceEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- persistenceEClass.getESuperTypes().add(theJpaCorePackage.getIJpaContentNode());
- persistenceUnitEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- persistenceUnitEClass.getESuperTypes().add(theJpaCorePackage.getIJpaContentNode());
- mappingFileRefEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- javaClassRefEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- propertiesEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- propertyEClass.getESuperTypes().add(theJpaCorePackage.getXmlEObject());
- // Initialize classes and features; add operations and parameters
- initEClass(persistenceXmlRootContentNodeEClass, PersistenceXmlRootContentNode.class, "PersistenceXmlRootContentNode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getPersistenceXmlRootContentNode_Persistence(), this.getPersistence(), this.getPersistence_Root(), "persistence", null, 0, 1, PersistenceXmlRootContentNode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(persistenceEClass, Persistence.class, "Persistence", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getPersistence_PersistenceUnits(), this.getPersistenceUnit(), null, "persistenceUnits", null, 0, -1, Persistence.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistence_Version(), this.getVersion(), "version", null, 1, 1, Persistence.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getPersistence_Root(), this.getPersistenceXmlRootContentNode(), this.getPersistenceXmlRootContentNode_Persistence(), "root", null, 1, 1, Persistence.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
- initEClass(persistenceUnitEClass, PersistenceUnit.class, "PersistenceUnit", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getPersistenceUnit_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, PersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistenceUnit_Provider(), theXMLTypePackage.getString(), "provider", null, 0, 1, PersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistenceUnit_JtaDataSource(), theXMLTypePackage.getString(), "jtaDataSource", null, 0, 1, PersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistenceUnit_NonJtaDataSource(), theXMLTypePackage.getString(), "nonJtaDataSource", null, 0, 1, PersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getPersistenceUnit_MappingFiles(), this.getMappingFileRef(), null, "mappingFiles", null, 0, -1, PersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistenceUnit_JarFiles(), theXMLTypePackage.getString(), "jarFiles", null, 0, -1, PersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getPersistenceUnit_Classes(), this.getJavaClassRef(), null, "classes", null, 0, -1, PersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistenceUnit_ExcludeUnlistedClasses(), theXMLTypePackage.getBoolean(), "excludeUnlistedClasses", "false", 0, 1, PersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getPersistenceUnit_Properties(), this.getProperties(), null, "properties", null, 0, 1, PersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistenceUnit_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, PersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPersistenceUnit_TransactionType(), this.getPersistenceUnitTransactionType(), "transactionType", "JTA", 0, 1, PersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(mappingFileRefEClass, MappingFileRef.class, "MappingFileRef", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getMappingFileRef_FileName(), theEcorePackage.getEString(), "fileName", "", 0, 1, MappingFileRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
- initEClass(javaClassRefEClass, JavaClassRef.class, "JavaClassRef", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getJavaClassRef_JavaClass(), theEcorePackage.getEString(), "javaClass", null, 0, 1, JavaClassRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
- initEClass(propertiesEClass, Properties.class, "Properties", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getProperties_Properties(), this.getProperty(), null, "properties", null, 0, -1, Properties.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(propertyEClass, Property.class, "Property", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getProperty_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, Property.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getProperty_Value(), theXMLTypePackage.getString(), "value", null, 1, 1, Property.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- // Initialize enums and add enum literals
- initEEnum(persistenceUnitTransactionTypeEEnum, PersistenceUnitTransactionType.class, "PersistenceUnitTransactionType");
- addEEnumLiteral(persistenceUnitTransactionTypeEEnum, PersistenceUnitTransactionType.JTA);
- addEEnumLiteral(persistenceUnitTransactionTypeEEnum, PersistenceUnitTransactionType.RESOURCE_LOCAL);
- // Initialize data types
- initEDataType(persistenceUnitTransactionTypeObjectEDataType, Enumerator.class, "PersistenceUnitTransactionTypeObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
- initEDataType(versionEDataType, String.class, "Version", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
- // Create resource
- createResource(eNS_URI);
- }
-
-
- /**
- * <!-- begin-user-doc -->
- * Defines literals for the meta objects that represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @generated
- */
- public interface Literals
- {
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.persistence.Persistence <em>Persistence</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.Persistence
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistence()
- * @generated
- */
- public static final EClass PERSISTENCE = eINSTANCE.getPersistence();
-
- /**
- * The meta object literal for the '<em><b>Persistence Units</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference PERSISTENCE__PERSISTENCE_UNITS = eINSTANCE.getPersistence_PersistenceUnits();
-
- /**
- * The meta object literal for the '<em><b>Version</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE__VERSION = eINSTANCE.getPersistence_Version();
-
- /**
- * The meta object literal for the '<em><b>Root</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference PERSISTENCE__ROOT = eINSTANCE.getPersistence_Root();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit <em>Unit</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnit()
- * @generated
- */
- public static final EClass PERSISTENCE_UNIT = eINSTANCE.getPersistenceUnit();
-
- /**
- * The meta object literal for the '<em><b>Description</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT__DESCRIPTION = eINSTANCE.getPersistenceUnit_Description();
-
- /**
- * The meta object literal for the '<em><b>Provider</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT__PROVIDER = eINSTANCE.getPersistenceUnit_Provider();
-
- /**
- * The meta object literal for the '<em><b>Jta Data Source</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT__JTA_DATA_SOURCE = eINSTANCE.getPersistenceUnit_JtaDataSource();
-
- /**
- * The meta object literal for the '<em><b>Non Jta Data Source</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE = eINSTANCE.getPersistenceUnit_NonJtaDataSource();
-
- /**
- * The meta object literal for the '<em><b>Mapping Files</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference PERSISTENCE_UNIT__MAPPING_FILES = eINSTANCE.getPersistenceUnit_MappingFiles();
-
- /**
- * The meta object literal for the '<em><b>Jar Files</b></em>' attribute list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT__JAR_FILES = eINSTANCE.getPersistenceUnit_JarFiles();
-
- /**
- * The meta object literal for the '<em><b>Classes</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference PERSISTENCE_UNIT__CLASSES = eINSTANCE.getPersistenceUnit_Classes();
-
- /**
- * The meta object literal for the '<em><b>Exclude Unlisted Classes</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES = eINSTANCE.getPersistenceUnit_ExcludeUnlistedClasses();
-
- /**
- * The meta object literal for the '<em><b>Properties</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference PERSISTENCE_UNIT__PROPERTIES = eINSTANCE.getPersistenceUnit_Properties();
-
- /**
- * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT__NAME = eINSTANCE.getPersistenceUnit_Name();
-
- /**
- * The meta object literal for the '<em><b>Transaction Type</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PERSISTENCE_UNIT__TRANSACTION_TYPE = eINSTANCE.getPersistenceUnit_TransactionType();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.persistence.MappingFileRef <em>Mapping File Ref</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.MappingFileRef
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getMappingFileRef()
- * @generated
- */
- public static final EClass MAPPING_FILE_REF = eINSTANCE.getMappingFileRef();
-
- /**
- * The meta object literal for the '<em><b>File Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute MAPPING_FILE_REF__FILE_NAME = eINSTANCE.getMappingFileRef_FileName();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.persistence.JavaClassRef <em>Java Class Ref</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.JavaClassRef
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getJavaClassRef()
- * @generated
- */
- public static final EClass JAVA_CLASS_REF = eINSTANCE.getJavaClassRef();
-
- /**
- * The meta object literal for the '<em><b>Java Class</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute JAVA_CLASS_REF__JAVA_CLASS = eINSTANCE.getJavaClassRef_JavaClass();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.persistence.Properties <em>Properties</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.Properties
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getProperties()
- * @generated
- */
- public static final EClass PROPERTIES = eINSTANCE.getProperties();
-
- /**
- * The meta object literal for the '<em><b>Properties</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference PROPERTIES__PROPERTIES = eINSTANCE.getProperties_Properties();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.persistence.Property <em>Property</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.Property
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getProperty()
- * @generated
- */
- public static final EClass PROPERTY = eINSTANCE.getProperty();
-
- /**
- * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PROPERTY__NAME = eINSTANCE.getProperty_Name();
-
- /**
- * The meta object literal for the '<em><b>Value</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute PROPERTY__VALUE = eINSTANCE.getProperty_Value();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode <em>Xml Root Content Node</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceXmlRootContentNode()
- * @generated
- */
- public static final EClass PERSISTENCE_XML_ROOT_CONTENT_NODE = eINSTANCE.getPersistenceXmlRootContentNode();
-
- /**
- * The meta object literal for the '<em><b>Persistence</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference PERSISTENCE_XML_ROOT_CONTENT_NODE__PERSISTENCE = eINSTANCE.getPersistenceXmlRootContentNode_Persistence();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnitTransactionType <em>Unit Transaction Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnitTransactionType
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnitTransactionType()
- * @generated
- */
- public static final EEnum PERSISTENCE_UNIT_TRANSACTION_TYPE = eINSTANCE.getPersistenceUnitTransactionType();
-
- /**
- * The meta object literal for the '<em>Unit Transaction Type Object</em>' data type.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.common.util.Enumerator
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnitTransactionTypeObject()
- * @generated
- */
- public static final EDataType PERSISTENCE_UNIT_TRANSACTION_TYPE_OBJECT = eINSTANCE.getPersistenceUnitTransactionTypeObject();
-
- /**
- * The meta object literal for the '<em>Version</em>' data type.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see java.lang.String
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getVersion()
- * @generated
- */
- public static final EDataType VERSION = eINSTANCE.getVersion();
- }
-} //PersistenceInternalPackage
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceXmlJpaFileContentProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceXmlJpaFileContentProvider.java
deleted file mode 100644
index afd2b08e9d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceXmlJpaFileContentProvider.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.persistence;
-
-import java.io.IOException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IJpaFileContentProvider;
-import org.eclipse.jpt.core.internal.IJpaRootContentNode;
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.core.internal.content.persistence.resource.PersistenceArtifactEdit;
-import org.eclipse.jpt.core.internal.content.persistence.resource.PersistenceResource;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModelEvent;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModelListener;
-
-public class PersistenceXmlJpaFileContentProvider implements IJpaFileContentProvider
-{
- //singleton
- private static final PersistenceXmlJpaFileContentProvider INSTANCE = new PersistenceXmlJpaFileContentProvider();
-
-
- /**
- * Return the singleton.
- */
- public static IJpaFileContentProvider instance() {
- return INSTANCE;
- }
-
-
- /**
- * Restrict access
- */
- private PersistenceXmlJpaFileContentProvider() {
- super();
- }
-
- public IJpaRootContentNode buildRootContent(IJpaFile jpaFile) {
- IFile resourceFile = jpaFile.getFile();
- PersistenceArtifactEdit pae =
- PersistenceArtifactEdit.getArtifactEditForRead(resourceFile.getProject());
- PersistenceResource resource =
- pae.getPersistenceResource(resourceFile);
- pae.addListener(buildReloadListener(resource));
- PersistenceXmlRootContentNode root = PersistenceFactory.eINSTANCE.createPersistenceXmlRootContentNode();
- root.setArtifactEdit(pae);
- root.setPersistence(resource.getPersistence());
- resource.eAdapters().add(buildRootNodeListener(resourceFile, root));
- jpaFile.setContent(root);
- return root;
- }
-
- private Adapter buildRootNodeListener(IFile resourceFile, PersistenceXmlRootContentNode rootContentNode) {
- return new RootAdapter(resourceFile, rootContentNode);
- }
-
- private EditModelListener buildReloadListener(PersistenceResource resource) {
- return new ReloadListener(resource);
- }
-
- public String contentType() {
- return JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE;
- }
-
-
- private class RootAdapter extends AdapterImpl
- {
- final IFile resourceFile;
- final PersistenceXmlRootContentNode rootContentNode;
-
- RootAdapter(IFile resourceFile, PersistenceXmlRootContentNode rootContentNode) {
- super();
- this.resourceFile = resourceFile;
- this.rootContentNode = rootContentNode;
- }
-
- @Override
- public void notifyChanged(Notification notification) {
- int featureId = notification.getFeatureID(Resource.class);
- if (featureId == Resource.RESOURCE__CONTENTS) {
- if (notification.getEventType() == Notification.ADD
- || notification.getEventType() == Notification.REMOVE) {
- PersistenceResource resource = (PersistenceResource) notification.getNotifier();
- this.rootContentNode.setPersistence(resource.getPersistence());
- }
- }
- }
- }
-
-
- private class ReloadListener implements EditModelListener
- {
- final PersistenceResource resource;
-
- ReloadListener(PersistenceResource resource) {
- super();
- this.resource = resource;
- }
-
- public void editModelChanged(EditModelEvent anEvent) {
- switch (anEvent.getEventCode()) {
- case EditModelEvent.UNLOADED_RESOURCE :
- if (anEvent.getChangedResources().contains(resource)
- && ! resource.isLoaded()) {
- try {
- resource.load(resource.getResourceSet().getLoadOptions());
- }
- catch (IOException ioe) {
- JptCorePlugin.log(ioe);
- }
- }
- break;
- case EditModelEvent.REMOVED_RESOURCE :
- if (anEvent.getChangedResources().contains(resource)) {
- anEvent.getEditModel().removeListener(this);
- }
- break;
-// case EditModelEvent.SAVE :
-// case EditModelEvent.PRE_DISPOSE :
- }
-
- }
- // commenting out for now - this *was* a workaround for 202190, but with ArtifactEdit
- // usage, it no longer works
- //
- // 11/07/07 - Actually, it has now been replaced by the above code
-// else if (featureId == Resource.RESOURCE__IS_LOADED) {
-// if (file.exists()) {
-// // dumb translator is unloading my resource, reload it
-// if (notification.getNewBooleanValue() == false) {
-// PersistenceResource resource = (PersistenceResource) notification.getNotifier();
-// try {
-// resource.load(Collections.EMPTY_MAP);
-// }
-// catch (IOException ioe) {
-// // hmmm, log for now
-// JptCorePlugin.log(ioe);
-// }
-// }
-// }
-// }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceXmlRootContentNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceXmlRootContentNode.java
deleted file mode 100644
index 0d619aad0c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceXmlRootContentNode.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.persistence;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.ElementChangedEvent;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IJpaRootContentNode;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.JpaFile;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.persistence.resource.IPersistenceXmlContentNodes;
-import org.eclipse.jpt.core.internal.content.persistence.resource.PersistenceArtifactEdit;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Persistence Xml Root Content Node</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode#getPersistence <em>Persistence</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceXmlRootContentNode()
- * @model kind="class"
- * @generated
- */
-public class PersistenceXmlRootContentNode extends XmlEObject
- implements IJpaRootContentNode
-{
- /**
- * The cached value of the '{@link #getPersistence() <em>Persistence</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getPersistence()
- * @generated
- * @ordered
- */
- protected Persistence persistence;
-
- private PersistenceArtifactEdit artifactEdit;
-
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected PersistenceXmlRootContentNode() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return PersistencePackage.Literals.PERSISTENCE_XML_ROOT_CONTENT_NODE;
- }
-
- /**
- * Returns the value of the '<em><b>Jpa File</b></em>' container reference.
- * It is bidirectional and its opposite is '{@link org.eclipse.jpt.core.internal.JpaFile#getContent <em>Content</em>}'.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Jpa File</em>' container reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Jpa File</em>' container reference.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getIJpaRootContentNode_JpaFile()
- * @see org.eclipse.jpt.core.internal.JpaFile#getContent
- * @model opposite="content" transient="false" changeable="false"
- * @generated
- */
- public IJpaFile getJpaFile() {
- if (eContainerFeatureID != PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__JPA_FILE)
- return null;
- return (IJpaFile) eContainer();
- }
-
- public IResource getResource() {
- return getJpaFile().getResource();
- }
-
- /**
- * Returns the value of the '<em><b>Persistence</b></em>' reference.
- * It is bidirectional and its opposite is '{@link org.eclipse.jpt.core.internal.content.persistence.Persistence#getRoot <em>Root</em>}'.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Persistence</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persistence</em>' reference.
- * @see #setPersistence(Persistence)
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceXmlRootContentNode_Persistence()
- * @see org.eclipse.jpt.core.internal.content.persistence.Persistence#getRoot
- * @model opposite="root"
- * @generated
- */
- public Persistence getPersistence() {
- if (persistence != null && persistence.eIsProxy()) {
- InternalEObject oldPersistence = (InternalEObject) persistence;
- persistence = (Persistence) eResolveProxy(oldPersistence);
- if (persistence != oldPersistence) {
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.RESOLVE, PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__PERSISTENCE, oldPersistence, persistence));
- }
- }
- return persistence;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Persistence basicGetPersistence() {
- return persistence;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public NotificationChain basicSetPersistence(Persistence newPersistence, NotificationChain msgs) {
- Persistence oldPersistence = persistence;
- persistence = newPersistence;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__PERSISTENCE, oldPersistence, newPersistence);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
- }
- return msgs;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode#getPersistence <em>Persistence</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Persistence</em>' reference.
- * @see #getPersistence()
- * @generated
- */
- public void setPersistence(Persistence newPersistence) {
- if (newPersistence != persistence) {
- NotificationChain msgs = null;
- if (persistence != null)
- msgs = ((InternalEObject) persistence).eInverseRemove(this, PersistencePackage.PERSISTENCE__ROOT, Persistence.class, msgs);
- if (newPersistence != null)
- msgs = ((InternalEObject) newPersistence).eInverseAdd(this, PersistencePackage.PERSISTENCE__ROOT, Persistence.class, msgs);
- msgs = basicSetPersistence(newPersistence, msgs);
- if (msgs != null)
- msgs.dispatch();
- }
- else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__PERSISTENCE, newPersistence, newPersistence));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__JPA_FILE :
- if (eInternalContainer() != null)
- msgs = eBasicRemoveFromContainer(msgs);
- return eBasicSetContainer(otherEnd, PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__JPA_FILE, msgs);
- case PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__PERSISTENCE :
- if (persistence != null)
- msgs = ((InternalEObject) persistence).eInverseRemove(this, PersistencePackage.PERSISTENCE__ROOT, Persistence.class, msgs);
- return basicSetPersistence((Persistence) otherEnd, msgs);
- }
- return super.eInverseAdd(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__JPA_FILE :
- return eBasicSetContainer(null, PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__JPA_FILE, msgs);
- case PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__PERSISTENCE :
- return basicSetPersistence(null, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
- switch (eContainerFeatureID) {
- case PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__JPA_FILE :
- return eInternalContainer().eInverseRemove(this, JpaCorePackage.JPA_FILE__CONTENT, JpaFile.class, msgs);
- }
- return super.eBasicRemoveFromContainerFeature(msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__JPA_FILE :
- return getJpaFile();
- case PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__PERSISTENCE :
- if (resolve)
- return getPersistence();
- return basicGetPersistence();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__PERSISTENCE :
- setPersistence((Persistence) newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__PERSISTENCE :
- setPersistence((Persistence) null);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__JPA_FILE :
- return getJpaFile() != null;
- case PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__PERSISTENCE :
- return persistence != null;
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaContentNode.class) {
- switch (derivedFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IJpaRootContentNode.class) {
- switch (derivedFeatureID) {
- case PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__JPA_FILE :
- return JpaCorePackage.IJPA_ROOT_CONTENT_NODE__JPA_FILE;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IJpaContentNode.class) {
- switch (baseFeatureID) {
- default :
- return -1;
- }
- }
- if (baseClass == IJpaRootContentNode.class) {
- switch (baseFeatureID) {
- case JpaCorePackage.IJPA_ROOT_CONTENT_NODE__JPA_FILE :
- return PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE__JPA_FILE;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- public void dispose() {
- if (artifactEdit != null) {
- artifactEdit.dispose();
- }
- }
-
- @Override
- public ITextRange fullTextRange() {
- return ITextRange.Empty.instance();
- }
-
- public IJpaContentNode getContentNode(int offset) {
- if (getPersistence() == null || !getPersistence().getNode().contains(offset)) {
- return this;
- }
- return getPersistence().getContentNode(offset);
- }
-
- public Object getId() {
- return IPersistenceXmlContentNodes.PERSISTENCEXML_ROOT_ID;
- }
-
- @Override
- public IJpaRootContentNode getRoot() {
- return this;
- }
-
- public void javaElementChanged(ElementChangedEvent event) {
- // TODO Auto-generated method stub
- }
-
- public void setArtifactEdit(PersistenceArtifactEdit persistenceArtifactEdit) {
- artifactEdit = persistenceArtifactEdit;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/IPersistenceXmlContentNodes.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/IPersistenceXmlContentNodes.java
deleted file mode 100644
index 3c389ad3e0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/IPersistenceXmlContentNodes.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.persistence.resource;
-
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-
-public interface IPersistenceXmlContentNodes
-{
- String PERSISTENCEXML_ROOT_ID = JptCorePlugin.PLUGIN_ID + ".persistencexml.Root";
-
- String PERSISTENCE_UNIT_ID = JptCorePlugin.PLUGIN_ID + ".persistencexml.PersistenceUnit";
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/PersistenceTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/PersistenceTranslator.java
deleted file mode 100644
index f74260b073..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/PersistenceTranslator.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.persistence.resource;
-
-import org.eclipse.jpt.core.internal.content.persistence.PersistencePackage;
-import org.eclipse.wst.common.internal.emf.resource.ConstantAttributeTranslator;
-import org.eclipse.wst.common.internal.emf.resource.GenericTranslator;
-import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
-import org.eclipse.wst.common.internal.emf.resource.RootTranslator;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class PersistenceTranslator extends RootTranslator
- implements PersistenceXMLMapper
-{
- public static PersistenceTranslator INSTANCE = new PersistenceTranslator();
-
- private static Translator[] children;
-
- private static PersistencePackage PERSISTENCE_PKG = PersistencePackage.eINSTANCE;
-
-
- public PersistenceTranslator() {
- super(PERSISTENCE, PersistencePackage.eINSTANCE.getPersistence());
- }
-
- public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
- }
- return children;
- }
-
- private static Translator[] createChildren() {
- return new Translator[] {
- IDTranslator.INSTANCE,
- createVersionTranslator(),
- new ConstantAttributeTranslator(XML_NS, PERSISTENCE_NS_URL),
- new ConstantAttributeTranslator(XML_NS_XSI, XSI_NS_URL),
- new ConstantAttributeTranslator(XSI_SCHEMA_LOCATION, PERSISTENCE_NS_URL + ' ' + PERSISTENCE_SCHEMA_LOC_1_0),
- createPersistenceUnitTranslator()
- };
- }
-
- private static Translator createVersionTranslator() {
- return new Translator(PERSISTENCE_VERSION, PERSISTENCE_PKG.getPersistence_Version(), DOM_ATTRIBUTE);
- }
-
- private static Translator createPersistenceUnitTranslator() {
- GenericTranslator translator = new GenericTranslator(PERSISTENCE_UNIT, PERSISTENCE_PKG.getPersistence_PersistenceUnits());
- translator.setChildren(
- new Translator[] {
- IDTranslator.INSTANCE,
- createPersistenceUnitNameTranslator(),
- createTransactionTypeTranslator(),
- createPersistenceUnitDescriptionTranslator(),
- createPersistenceUnitProviderTranslator(),
- createJtaDataSourceTranslator(),
- createNonJtaDataSourceTranslator(),
- createMappingFileTranslator(),
- createJarFileTranslator(),
- createClassTranslator(),
- createExcludeUnlistedClassesTranslator(),
- createPropertiesTranslator()
- }
- );
- return translator;
- }
-
- private static Translator createPersistenceUnitNameTranslator() {
- return new Translator(PERSISTENCE_UNIT_NAME, PERSISTENCE_PKG.getPersistenceUnit_Name(), DOM_ATTRIBUTE);
- }
-
- private static Translator createTransactionTypeTranslator() {
- return new TransactionTypeTranslator();
- }
-
- private static Translator createPersistenceUnitDescriptionTranslator() {
- return new Translator(PERSISTENCE_UNIT_DESCRIPTION, PERSISTENCE_PKG.getPersistenceUnit_Description());
- }
-
- private static Translator createPersistenceUnitProviderTranslator() {
- return new Translator(PERSISTENCE_UNIT_PROVIDER, PERSISTENCE_PKG.getPersistenceUnit_Provider(), UNSET_IF_NULL);
- }
-
- private static Translator createJtaDataSourceTranslator() {
- return new Translator(JTA_DATA_SOURCE, PERSISTENCE_PKG.getPersistenceUnit_JtaDataSource());
- }
-
- private static Translator createNonJtaDataSourceTranslator() {
- return new Translator(NON_JTA_DATA_SOURCE, PERSISTENCE_PKG.getPersistenceUnit_NonJtaDataSource());
- }
-
- private static Translator createMappingFileTranslator() {
- return new MappingFileTranslator(MAPPING_FILE, PERSISTENCE_PKG.getPersistenceUnit_MappingFiles());
- }
-
- private static Translator createJarFileTranslator() {
- return new Translator(JAR_FILE, PERSISTENCE_PKG.getPersistenceUnit_JarFiles());
- }
-
- private static Translator createClassTranslator() {
- return new JavaClassRefTranslator(CLASS, PERSISTENCE_PKG.getPersistenceUnit_Classes());
- }
-
- private static Translator createExcludeUnlistedClassesTranslator() {
- return new BooleanTranslator(EXCLUDE_UNLISTED_CLASSES, PERSISTENCE_PKG.getPersistenceUnit_ExcludeUnlistedClasses(), UNSET_IF_NULL);
- }
-
- private static Translator createPropertiesTranslator() {
- GenericTranslator translator = new GenericTranslator(PROPERTIES, PERSISTENCE_PKG.getPersistenceUnit_Properties());
- translator.setChildren(
- new Translator[] {
- createPropertyTranslator()
- }
- );
- return translator;
- }
-
- private static Translator createPropertyTranslator() {
- GenericTranslator translator = new GenericTranslator(PROPERTY, PERSISTENCE_PKG.getProperties_Properties(), END_TAG_NO_INDENT);
- translator.setChildren(
- new Translator[] {
- createPropertyNameTranslator(),
- createPropertyValueTranslator()
- }
- );
- return translator;
- }
-
- private static Translator createPropertyNameTranslator() {
- return new Translator(PROPERTY_NAME, PERSISTENCE_PKG.getProperty_Name(), DOM_ATTRIBUTE);
- }
-
- private static Translator createPropertyValueTranslator() {
- return new Translator(PROPERTY_VALUE, PERSISTENCE_PKG.getProperty_Value(), DOM_ATTRIBUTE);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/TransactionTypeTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/TransactionTypeTranslator.java
deleted file mode 100644
index acd5b18ab5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/TransactionTypeTranslator.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.persistence.resource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.persistence.PersistencePackage;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceUnitTransactionType;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-
-public class TransactionTypeTranslator extends Translator
- implements PersistenceXMLMapper
-{
- public TransactionTypeTranslator() {
- super(TRANSACTION_TYPE, PersistencePackage.eINSTANCE.getPersistenceUnit_TransactionType());
- }
-
- public Object convertStringToValue(String strValue, EObject owner) {
- String adjStrValue = strValue;
- String jtaStrValue = PersistenceUnitTransactionType.JTA.getName();
- String resourceLocalStrValue = PersistenceUnitTransactionType.RESOURCE_LOCAL.getName();
-
- if (jtaStrValue.equals(strValue.toUpperCase())) { //$NON-NLS-1$
- adjStrValue = jtaStrValue;
- }
- else if (resourceLocalStrValue.equals(strValue.toUpperCase())) { //$NON-NLS-1$
- adjStrValue = resourceLocalStrValue;
- }
- return super.convertStringToValue(adjStrValue, owner);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/util/PersistenceAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/util/PersistenceAdapterFactory.java
deleted file mode 100644
index 13ec9bd6e5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/util/PersistenceAdapterFactory.java
+++ /dev/null
@@ -1,384 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.persistence.util;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IJpaEObject;
-import org.eclipse.jpt.core.internal.IJpaRootContentNode;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.IXmlEObject;
-import org.eclipse.jpt.core.internal.JpaEObject;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.persistence.JavaClassRef;
-import org.eclipse.jpt.core.internal.content.persistence.MappingFileRef;
-import org.eclipse.jpt.core.internal.content.persistence.Persistence;
-import org.eclipse.jpt.core.internal.content.persistence.PersistencePackage;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode;
-import org.eclipse.jpt.core.internal.content.persistence.Properties;
-import org.eclipse.jpt.core.internal.content.persistence.Property;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Adapter Factory</b> for the model.
- * It provides an adapter <code>createXXX</code> method for each class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage
- * @generated
- */
-public class PersistenceAdapterFactory extends AdapterFactoryImpl
-{
- /**
- * The cached model package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static PersistencePackage modelPackage;
-
- /**
- * Creates an instance of the adapter factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PersistenceAdapterFactory() {
- if (modelPackage == null) {
- modelPackage = PersistencePackage.eINSTANCE;
- }
- }
-
- /**
- * Returns whether this factory is applicable for the type of the object.
- * <!-- begin-user-doc -->
- * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
- * <!-- end-user-doc -->
- * @return whether this factory is applicable for the type of the object.
- * @generated
- */
- @Override
- public boolean isFactoryForType(Object object) {
- if (object == modelPackage) {
- return true;
- }
- if (object instanceof EObject) {
- return ((EObject) object).eClass().getEPackage() == modelPackage;
- }
- return false;
- }
-
- /**
- * The switch the delegates to the <code>createXXX</code> methods.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected PersistenceSwitch<Adapter> modelSwitch = new PersistenceSwitch<Adapter>() {
- @Override
- public Adapter casePersistenceXmlRootContentNode(PersistenceXmlRootContentNode object) {
- return createPersistenceXmlRootContentNodeAdapter();
- }
-
- @Override
- public Adapter casePersistence(Persistence object) {
- return createPersistenceAdapter();
- }
-
- @Override
- public Adapter casePersistenceUnit(PersistenceUnit object) {
- return createPersistenceUnitAdapter();
- }
-
- @Override
- public Adapter caseMappingFileRef(MappingFileRef object) {
- return createMappingFileRefAdapter();
- }
-
- @Override
- public Adapter caseJavaClassRef(JavaClassRef object) {
- return createJavaClassRefAdapter();
- }
-
- @Override
- public Adapter caseProperties(Properties object) {
- return createPropertiesAdapter();
- }
-
- @Override
- public Adapter caseProperty(Property object) {
- return createPropertyAdapter();
- }
-
- @Override
- public Adapter caseIJpaEObject(IJpaEObject object) {
- return createIJpaEObjectAdapter();
- }
-
- @Override
- public Adapter caseJpaEObject(JpaEObject object) {
- return createJpaEObjectAdapter();
- }
-
- @Override
- public Adapter caseIJpaSourceObject(IJpaSourceObject object) {
- return createIJpaSourceObjectAdapter();
- }
-
- @Override
- public Adapter caseIXmlEObject(IXmlEObject object) {
- return createIXmlEObjectAdapter();
- }
-
- @Override
- public Adapter caseXmlEObject(XmlEObject object) {
- return createXmlEObjectAdapter();
- }
-
- @Override
- public Adapter caseIJpaContentNode(IJpaContentNode object) {
- return createIJpaContentNodeAdapter();
- }
-
- @Override
- public Adapter caseIJpaRootContentNode(IJpaRootContentNode object) {
- return createIJpaRootContentNodeAdapter();
- }
-
- @Override
- public Adapter defaultCase(EObject object) {
- return createEObjectAdapter();
- }
- };
-
- /**
- * Creates an adapter for the <code>target</code>.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param target the object to adapt.
- * @return the adapter for the <code>target</code>.
- * @generated
- */
- @Override
- public Adapter createAdapter(Notifier target) {
- return modelSwitch.doSwitch((EObject) target);
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.persistence.Persistence <em>Persistence</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.persistence.Persistence
- * @generated
- */
- public Adapter createPersistenceAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit <em>Unit</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit
- * @generated
- */
- public Adapter createPersistenceUnitAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.persistence.MappingFileRef <em>Mapping File Ref</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.persistence.MappingFileRef
- * @generated
- */
- public Adapter createMappingFileRefAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.persistence.JavaClassRef <em>Java Class Ref</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.persistence.JavaClassRef
- * @generated
- */
- public Adapter createJavaClassRefAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.persistence.Properties <em>Properties</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.persistence.Properties
- * @generated
- */
- public Adapter createPropertiesAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.persistence.Property <em>Property</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.persistence.Property
- * @generated
- */
- public Adapter createPropertyAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaEObject <em>IJpa EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaEObject
- * @generated
- */
- public Adapter createIJpaEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.JpaEObject <em>Jpa EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.JpaEObject
- * @generated
- */
- public Adapter createJpaEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaSourceObject <em>IJpa Source Object</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaSourceObject
- * @generated
- */
- public Adapter createIJpaSourceObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IXmlEObject <em>IXml EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IXmlEObject
- * @generated
- */
- public Adapter createIXmlEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode <em>Xml Root Content Node</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode
- * @generated
- */
- public Adapter createPersistenceXmlRootContentNodeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.XmlEObject <em>Xml EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.XmlEObject
- * @generated
- */
- public Adapter createXmlEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaContentNode <em>IJpa Content Node</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaContentNode
- * @generated
- */
- public Adapter createIJpaContentNodeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaRootContentNode <em>IJpa Root Content Node</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaRootContentNode
- * @generated
- */
- public Adapter createIJpaRootContentNodeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for the default case.
- * <!-- begin-user-doc -->
- * This default implementation returns null.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @generated
- */
- public Adapter createEObjectAdapter() {
- return null;
- }
-} //PersistenceInternalAdapterFactory
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/util/PersistenceSwitch.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/util/PersistenceSwitch.java
deleted file mode 100644
index e73bb6b0a8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/util/PersistenceSwitch.java
+++ /dev/null
@@ -1,459 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.persistence.util;
-
-import java.util.List;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IJpaEObject;
-import org.eclipse.jpt.core.internal.IJpaRootContentNode;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.IXmlEObject;
-import org.eclipse.jpt.core.internal.JpaEObject;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.persistence.JavaClassRef;
-import org.eclipse.jpt.core.internal.content.persistence.MappingFileRef;
-import org.eclipse.jpt.core.internal.content.persistence.Persistence;
-import org.eclipse.jpt.core.internal.content.persistence.PersistencePackage;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode;
-import org.eclipse.jpt.core.internal.content.persistence.Properties;
-import org.eclipse.jpt.core.internal.content.persistence.Property;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Switch</b> for the model's inheritance hierarchy.
- * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
- * to invoke the <code>caseXXX</code> method for each class of the model,
- * starting with the actual class of the object
- * and proceeding up the inheritance hierarchy
- * until a non-null result is returned,
- * which is the result of the switch.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage
- * @generated
- */
-public class PersistenceSwitch<T>
-{
- /**
- * The cached model package
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static PersistencePackage modelPackage;
-
- /**
- * Creates an instance of the switch.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PersistenceSwitch() {
- if (modelPackage == null) {
- modelPackage = PersistencePackage.eINSTANCE;
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- public T doSwitch(EObject theEObject) {
- return doSwitch(theEObject.eClass(), theEObject);
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(EClass theEClass, EObject theEObject) {
- if (theEClass.eContainer() == modelPackage) {
- return doSwitch(theEClass.getClassifierID(), theEObject);
- }
- else {
- List<EClass> eSuperTypes = theEClass.getESuperTypes();
- return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), theEObject);
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(int classifierID, EObject theEObject) {
- switch (classifierID) {
- case PersistencePackage.PERSISTENCE_XML_ROOT_CONTENT_NODE : {
- PersistenceXmlRootContentNode persistenceXmlRootContentNode = (PersistenceXmlRootContentNode) theEObject;
- T result = casePersistenceXmlRootContentNode(persistenceXmlRootContentNode);
- if (result == null)
- result = caseXmlEObject(persistenceXmlRootContentNode);
- if (result == null)
- result = caseIJpaRootContentNode(persistenceXmlRootContentNode);
- if (result == null)
- result = caseJpaEObject(persistenceXmlRootContentNode);
- if (result == null)
- result = caseIXmlEObject(persistenceXmlRootContentNode);
- if (result == null)
- result = caseIJpaContentNode(persistenceXmlRootContentNode);
- if (result == null)
- result = caseIJpaEObject(persistenceXmlRootContentNode);
- if (result == null)
- result = caseIJpaSourceObject(persistenceXmlRootContentNode);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case PersistencePackage.PERSISTENCE : {
- Persistence persistence = (Persistence) theEObject;
- T result = casePersistence(persistence);
- if (result == null)
- result = caseXmlEObject(persistence);
- if (result == null)
- result = caseIJpaContentNode(persistence);
- if (result == null)
- result = caseJpaEObject(persistence);
- if (result == null)
- result = caseIXmlEObject(persistence);
- if (result == null)
- result = caseIJpaSourceObject(persistence);
- if (result == null)
- result = caseIJpaEObject(persistence);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case PersistencePackage.PERSISTENCE_UNIT : {
- PersistenceUnit persistenceUnit = (PersistenceUnit) theEObject;
- T result = casePersistenceUnit(persistenceUnit);
- if (result == null)
- result = caseXmlEObject(persistenceUnit);
- if (result == null)
- result = caseIJpaContentNode(persistenceUnit);
- if (result == null)
- result = caseJpaEObject(persistenceUnit);
- if (result == null)
- result = caseIXmlEObject(persistenceUnit);
- if (result == null)
- result = caseIJpaSourceObject(persistenceUnit);
- if (result == null)
- result = caseIJpaEObject(persistenceUnit);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case PersistencePackage.MAPPING_FILE_REF : {
- MappingFileRef mappingFileRef = (MappingFileRef) theEObject;
- T result = caseMappingFileRef(mappingFileRef);
- if (result == null)
- result = caseXmlEObject(mappingFileRef);
- if (result == null)
- result = caseJpaEObject(mappingFileRef);
- if (result == null)
- result = caseIXmlEObject(mappingFileRef);
- if (result == null)
- result = caseIJpaEObject(mappingFileRef);
- if (result == null)
- result = caseIJpaSourceObject(mappingFileRef);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case PersistencePackage.JAVA_CLASS_REF : {
- JavaClassRef javaClassRef = (JavaClassRef) theEObject;
- T result = caseJavaClassRef(javaClassRef);
- if (result == null)
- result = caseXmlEObject(javaClassRef);
- if (result == null)
- result = caseJpaEObject(javaClassRef);
- if (result == null)
- result = caseIXmlEObject(javaClassRef);
- if (result == null)
- result = caseIJpaEObject(javaClassRef);
- if (result == null)
- result = caseIJpaSourceObject(javaClassRef);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case PersistencePackage.PROPERTIES : {
- Properties properties = (Properties) theEObject;
- T result = caseProperties(properties);
- if (result == null)
- result = caseXmlEObject(properties);
- if (result == null)
- result = caseJpaEObject(properties);
- if (result == null)
- result = caseIXmlEObject(properties);
- if (result == null)
- result = caseIJpaEObject(properties);
- if (result == null)
- result = caseIJpaSourceObject(properties);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case PersistencePackage.PROPERTY : {
- Property property = (Property) theEObject;
- T result = caseProperty(property);
- if (result == null)
- result = caseXmlEObject(property);
- if (result == null)
- result = caseJpaEObject(property);
- if (result == null)
- result = caseIXmlEObject(property);
- if (result == null)
- result = caseIJpaEObject(property);
- if (result == null)
- result = caseIJpaSourceObject(property);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- default :
- return defaultCase(theEObject);
- }
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Persistence</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Persistence</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T casePersistence(Persistence object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Unit</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Unit</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T casePersistenceUnit(PersistenceUnit object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Mapping File Ref</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Mapping File Ref</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseMappingFileRef(MappingFileRef object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Java Class Ref</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Java Class Ref</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJavaClassRef(JavaClassRef object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Properties</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Properties</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseProperties(Properties object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Property</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Property</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseProperty(Property object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaEObject(IJpaEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Jpa EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Jpa EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJpaEObject(JpaEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa Source Object</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa Source Object</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaSourceObject(IJpaSourceObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IXml EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IXml EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIXmlEObject(IXmlEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml Root Content Node</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml Root Content Node</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T casePersistenceXmlRootContentNode(PersistenceXmlRootContentNode object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlEObject(XmlEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa Content Node</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa Content Node</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaContentNode(IJpaContentNode object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa Root Content Node</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa Root Content Node</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaRootContentNode(IJpaRootContentNode object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch, but this is the last case anyway.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject)
- * @generated
- */
- public T defaultCase(EObject object) {
- return null;
- }
-} //PersistenceInternalSwitch
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/AccessType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/AccessType.java
new file mode 100644
index 0000000000..0f5fa60468
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/AccessType.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+public enum AccessType {
+
+ FIELD,
+ PROPERTY;
+
+
+ public static AccessType fromJavaResourceModel(org.eclipse.jpt.core.internal.resource.java.AccessType javaAccess) {
+ if (javaAccess == org.eclipse.jpt.core.internal.resource.java.AccessType.FIELD) {
+ return FIELD;
+ }
+ else if (javaAccess == org.eclipse.jpt.core.internal.resource.java.AccessType.PROPERTY) {
+ return PROPERTY;
+ }
+ return null;
+ }
+
+ public static AccessType fromXmlResourceModel(org.eclipse.jpt.core.internal.resource.orm.AccessType ormAccess) {
+ if (ormAccess == org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD) {
+ return FIELD;
+ }
+ else if (ormAccess == org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY) {
+ return PROPERTY;
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.core.internal.resource.orm.AccessType toXmlResourceModel(AccessType access) {
+ if (access == FIELD) {
+ return org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD;
+ }
+ else if (access == PROPERTY) {
+ return org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY;
+ }
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/BaseJpaContent.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/BaseJpaContent.java
new file mode 100644
index 0000000000..5398ed38e5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/BaseJpaContent.java
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IJpaFile;
+import org.eclipse.jpt.core.internal.IJpaNode;
+import org.eclipse.jpt.core.internal.IJpaProject;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JpaNode;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.EntityMappings;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceArtifactEdit;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResource;
+import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.utility.internal.node.Node;
+import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class BaseJpaContent extends JpaContextNode
+ implements IBaseJpaContent
+{
+ protected IPersistenceXml persistenceXml;
+
+
+ public BaseJpaContent(IJpaProject jpaProject) {
+ super(jpaProject);
+ }
+
+ @Override
+ protected void initialize(Node parentNode) {
+ super.initialize(parentNode);
+ PersistenceArtifactEdit pae = PersistenceArtifactEdit.getArtifactEditForRead(jpaProject().project());
+ PersistenceResource pr = pae.getResource();
+
+ if (pr.exists()) {
+ this.persistenceXml = this.createPersistenceXml(pr);
+ }
+
+ pae.dispose();
+ }
+
+ @Override
+ public EntityMappings entityMappings() {
+ return null;
+ }
+
+ @Override
+ public XmlPersistentType xmlPersistentType() {
+ return null;
+ }
+
+ // **************** persistence xml ****************************************
+
+ public IPersistenceXml getPersistenceXml() {
+ return this.persistenceXml;
+ }
+
+ protected void setPersistenceXml(IPersistenceXml persistenceXml) {
+ IPersistenceXml old = this.persistenceXml;
+ this.persistenceXml = persistenceXml;
+ this.firePropertyChanged(PERSISTENCE_XML_PROPERTY, old, persistenceXml);
+ }
+
+ public IPersistenceXml addPersistenceXml() {
+ if (this.persistenceXml != null) {
+ throw new IllegalStateException();
+ }
+ PersistenceArtifactEdit pae = PersistenceArtifactEdit.getArtifactEditForWrite(this.jpaProject().project());
+ PersistenceResource pr = pae.createDefaultResource();
+ pae.dispose();
+ IPersistenceXml px = this.createPersistenceXml(pr);
+ this.setPersistenceXml(px);
+ return px;
+ }
+
+ public void removePersistenceXml() {
+ if (this.persistenceXml == null) {
+ throw new IllegalStateException();
+ }
+ PersistenceArtifactEdit pae = PersistenceArtifactEdit.getArtifactEditForWrite(jpaProject().project());
+ PersistenceResource pr = pae.getResource();
+ pae.dispose();
+ try {
+ WorkbenchResourceHelper.deleteResource(pr);
+ }
+ catch (CoreException ce) {
+ JptCorePlugin.log(ce);
+ }
+
+ if (! pr.exists()) {
+ this.setPersistenceXml(null);
+ }
+ }
+
+
+ // **************** updating ***********************************************
+
+ public void update(IProgressMonitor monitor) {
+ PersistenceArtifactEdit pae = PersistenceArtifactEdit.getArtifactEditForRead(jpaProject().project());
+ PersistenceResource pr = pae.getResource();
+
+ if (pr.exists()) {
+ if (this.persistenceXml != null) {
+ this.persistenceXml.update(pr);
+ }
+ else {
+ setPersistenceXml(createPersistenceXml(pr));
+ }
+ }
+ else {
+ setPersistenceXml(null);
+ }
+
+ pae.dispose();
+ }
+
+ protected IPersistenceXml createPersistenceXml(PersistenceResource persistenceResource) {
+ IPersistenceXml px = this.jpaFactory().createPersistenceXml(this);
+ px.initialize(persistenceResource);
+ return px;
+ }
+
+
+ // *************************************************************************
+
+ @Override
+ public IPersistenceUnit persistenceUnit() {
+ throw new UnsupportedOperationException("No PersistenceUnit in this context");
+ }
+
+
+ //******** Validation *************************************************
+
+ /* If this is true, it may be assumed that all the requirements are valid
+ * for further validation. For example, if this is true at the point we
+ * are validating persistence units, it may be assumed that there is a
+ * single persistence.xml and that it has valid content down to the
+ * persistence unit level. */
+ private boolean okToContinueValidation = true;
+
+ @Override
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+ addNoPersistenceXmlMessage(messages);
+ addOrphanedJavaClassMessages(messages);
+
+ if(okToContinueValidation) {
+ getPersistenceXml().addToMessages(messages, astRoot);
+ }
+
+ }
+
+ protected void addNoPersistenceXmlMessage(List<IMessage> messages) {
+ if (persistenceXml == null) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.PROJECT_NO_PERSISTENCE_XML,
+ this)
+ );
+ okToContinueValidation = false;
+ }
+ }
+
+
+
+
+ protected void addOrphanedJavaClassMessages(List<IMessage> messages) {
+// for (Iterator<JavaPersistentType> stream = jpaProject.javaPersistentTypes(); stream.hasNext(); ) {
+// JavaPersistentType jpType = stream.next();
+// if (jpType.getMappingKey() != IMappingKeys.NULL_TYPE_MAPPING_KEY && ! contains(jpType)) {
+// messages.add(
+// JpaValidationMessages.buildMessage(
+// IMessage.HIGH_SEVERITY,
+// IJpaValidationMessages.PERSISTENT_TYPE_UNSPECIFIED_CONTEXT,
+// jpType.getMapping(), jpType.getMapping().validationTextRange())
+// );
+// }
+// }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ClassRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ClassRef.java
new file mode 100644
index 0000000000..fed69cef0e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ClassRef.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+/**
+ * This is the context model object which corresponds to the
+ * persistence resource model object XmlJavaClassRef.
+ * XmlJavaClassRef corresponds to the class tag in the persistence.xml
+ */
+public class ClassRef extends JpaContextNode implements IClassRef
+{
+ protected XmlJavaClassRef xmlJavaClassRef;
+
+ protected String className;
+
+ protected IJavaPersistentType javaPersistentType;
+
+
+ public ClassRef(IPersistenceUnit parent) {
+ super(parent);
+ }
+
+
+ public boolean isFor(String fullyQualifiedTypeName) {
+ if (getClassName() == null) {
+ return false;
+ }
+ return getClassName().equals(fullyQualifiedTypeName);
+ }
+
+
+ // **************** class name *********************************************
+
+ public String getClassName() {
+ return this.className;
+ }
+
+ public void setClassName(String newClassName) {
+ String oldClassName = this.className;
+ this.className = newClassName;
+ this.xmlJavaClassRef.setJavaClass(newClassName);
+ firePropertyChanged(CLASS_NAME_PROPERTY, oldClassName, newClassName);
+ }
+
+
+ // **************** java persistent type ***********************************
+
+ public IJavaPersistentType getJavaPersistentType() {
+ return this.javaPersistentType;
+ }
+
+ protected void setJavaPersistentType(IJavaPersistentType newJavaPersistentType) {
+ IJavaPersistentType oldJavaPersistentType = this.javaPersistentType;
+ this.javaPersistentType = newJavaPersistentType;
+ firePropertyChanged(IClassRef.JAVA_PERSISTENT_TYPE_PROPERTY, oldJavaPersistentType, newJavaPersistentType);
+ }
+
+
+ // **************** updating ***********************************************
+
+ public void initialize(XmlJavaClassRef classRef) {
+ this.xmlJavaClassRef = classRef;
+ this.className = classRef.getJavaClass();
+ this.initializeJavaPersistentType();
+ }
+
+ protected void initializeJavaPersistentType() {
+ JavaPersistentTypeResource persistentTypeResource = jpaProject().javaPersistentTypeResource(getClassName());
+ if (persistentTypeResource != null) {
+ this.javaPersistentType = createJavaPersistentType(persistentTypeResource);
+ }
+ }
+
+ public void update(XmlJavaClassRef classRef) {
+ this.xmlJavaClassRef = classRef;
+ this.setClassName(classRef.getJavaClass());
+ this.updateJavaPersistentType();
+ }
+
+ protected void updateJavaPersistentType() {
+ JavaPersistentTypeResource persistentTypeResource = jpaProject().javaPersistentTypeResource(getClassName());
+ if (persistentTypeResource == null) {
+ setJavaPersistentType(null);
+ }
+ else {
+ if (getJavaPersistentType() != null) {
+ getJavaPersistentType().update(persistentTypeResource);
+ }
+ else {
+ setJavaPersistentType(createJavaPersistentType(persistentTypeResource));
+ }
+ }
+ }
+
+ protected IJavaPersistentType createJavaPersistentType(JavaPersistentTypeResource persistentTypeResource) {
+ IJavaPersistentType javaPersistentType = jpaFactory().createJavaPersistentType(this);
+ javaPersistentType.initializeFromResource(persistentTypeResource);
+ return javaPersistentType;
+ }
+
+
+ // *************************************************************************
+
+ @Override
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+
+ //classRef might have been empty
+ if(javaPersistentType != null){
+ javaPersistentType.addToMessages(messages, astRoot);
+ }
+ }
+
+ public ITextRange validationTextRange() {
+ return this.xmlJavaClassRef.validationTextRange();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(getClassName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/DiscriminatorType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/DiscriminatorType.java
new file mode 100644
index 0000000000..dc12ccbea2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/DiscriminatorType.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 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.context.base;
+
+
+public enum DiscriminatorType {
+
+ STRING,
+ CHAR,
+ INTEGER;
+
+
+ public static DiscriminatorType fromJavaResourceModel(org.eclipse.jpt.core.internal.resource.java.DiscriminatorType javaDiscriminatorType) {
+ if (javaDiscriminatorType == org.eclipse.jpt.core.internal.resource.java.DiscriminatorType.STRING) {
+ return STRING;
+ }
+ else if (javaDiscriminatorType == org.eclipse.jpt.core.internal.resource.java.DiscriminatorType.CHAR) {
+ return CHAR;
+ }
+ else if (javaDiscriminatorType == org.eclipse.jpt.core.internal.resource.java.DiscriminatorType.INTEGER) {
+ return INTEGER;
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.core.internal.resource.java.DiscriminatorType toJavaResourceModel(DiscriminatorType discriminatorType) {
+ if (discriminatorType == STRING) {
+ return org.eclipse.jpt.core.internal.resource.java.DiscriminatorType.STRING;
+ }
+ else if (discriminatorType == CHAR) {
+ return org.eclipse.jpt.core.internal.resource.java.DiscriminatorType.CHAR;
+ }
+ else if (discriminatorType == INTEGER) {
+ return org.eclipse.jpt.core.internal.resource.java.DiscriminatorType.INTEGER;
+ }
+ return null;
+ }
+
+
+ public static DiscriminatorType fromOrmResourceModel(org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType ormDiscriminatorType) {
+ if (ormDiscriminatorType == org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType.STRING) {
+ return STRING;
+ }
+ else if (ormDiscriminatorType == org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType.CHAR) {
+ return CHAR;
+ }
+ else if (ormDiscriminatorType == org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType.INTEGER) {
+ return INTEGER;
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType toOrmResourceModel(DiscriminatorType discriminatorType) {
+ if (discriminatorType == STRING) {
+ return org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType.STRING;
+ }
+ else if (discriminatorType == CHAR) {
+ return org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType.CHAR;
+ }
+ else if (discriminatorType == INTEGER) {
+ return org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType.INTEGER;
+ }
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/EnumType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/EnumType.java
new file mode 100644
index 0000000000..cb4770707c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/EnumType.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 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.context.base;
+
+
+public enum EnumType {
+
+ ORDINAL,
+ STRING;
+
+
+ public static EnumType fromJavaResourceModel(org.eclipse.jpt.core.internal.resource.java.EnumType javaEnumType) {
+ if (javaEnumType == org.eclipse.jpt.core.internal.resource.java.EnumType.ORDINAL) {
+ return ORDINAL;
+ }
+ else if (javaEnumType == org.eclipse.jpt.core.internal.resource.java.EnumType.STRING) {
+ return STRING;
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.core.internal.resource.java.EnumType toJavaResourceModel(EnumType enumType) {
+ if (enumType == ORDINAL) {
+ return org.eclipse.jpt.core.internal.resource.java.EnumType.ORDINAL;
+ }
+ else if (enumType == STRING) {
+ return org.eclipse.jpt.core.internal.resource.java.EnumType.STRING;
+ }
+ return null;
+ }
+
+
+ public static EnumType fromOrmResourceModel(org.eclipse.jpt.core.internal.resource.orm.EnumType ormEnumType) {
+ if (ormEnumType == org.eclipse.jpt.core.internal.resource.orm.EnumType.ORDINAL) {
+ return ORDINAL;
+ }
+ else if (ormEnumType == org.eclipse.jpt.core.internal.resource.orm.EnumType.STRING) {
+ return STRING;
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.core.internal.resource.orm.EnumType toOrmResourceModel(EnumType enumType) {
+ if (enumType == ORDINAL) {
+ return org.eclipse.jpt.core.internal.resource.orm.EnumType.ORDINAL;
+ }
+ else if (enumType == STRING) {
+ return org.eclipse.jpt.core.internal.resource.orm.EnumType.STRING;
+ }
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/FetchType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/FetchType.java
new file mode 100644
index 0000000000..7630e7e0d2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/FetchType.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 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.context.base;
+
+
+public enum FetchType {
+
+ EAGER,
+ LAZY;
+
+
+ public static FetchType fromJavaResourceModel(org.eclipse.jpt.core.internal.resource.java.FetchType javaFetchType) {
+ if (javaFetchType == org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER) {
+ return EAGER;
+ }
+ else if (javaFetchType == org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY) {
+ return LAZY;
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.core.internal.resource.java.FetchType toJavaResourceModel(FetchType fetchType) {
+ if (fetchType == EAGER) {
+ return org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER;
+ }
+ else if (fetchType == LAZY) {
+ return org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY;
+ }
+ return null;
+ }
+
+
+ public static FetchType fromOrmResourceModel(org.eclipse.jpt.core.internal.resource.orm.FetchType ormFetchType) {
+ if (ormFetchType == org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER) {
+ return EAGER;
+ }
+ else if (ormFetchType == org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY) {
+ return LAZY;
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.core.internal.resource.orm.FetchType toOrmResourceModel(FetchType fetchType) {
+ if (fetchType == EAGER) {
+ return org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER;
+ }
+ else if (fetchType == LAZY) {
+ return org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY;
+ }
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/GenerationType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/GenerationType.java
new file mode 100644
index 0000000000..2ee75e2ae0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/GenerationType.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 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.context.base;
+
+
+public enum GenerationType {
+
+ TABLE,
+ SEQUENCE,
+ IDENTITY,
+ AUTO;
+
+
+ public static GenerationType fromJavaResourceModel(org.eclipse.jpt.core.internal.resource.java.GenerationType javaGenerationType) {
+ if (javaGenerationType == org.eclipse.jpt.core.internal.resource.java.GenerationType.TABLE) {
+ return TABLE;
+ }
+ else if (javaGenerationType == org.eclipse.jpt.core.internal.resource.java.GenerationType.SEQUENCE) {
+ return SEQUENCE;
+ }
+ else if (javaGenerationType == org.eclipse.jpt.core.internal.resource.java.GenerationType.IDENTITY) {
+ return IDENTITY;
+ }
+ else if (javaGenerationType == org.eclipse.jpt.core.internal.resource.java.GenerationType.AUTO) {
+ return AUTO;
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.core.internal.resource.java.GenerationType toJavaResourceModel(GenerationType generationType) {
+ if (generationType == TABLE) {
+ return org.eclipse.jpt.core.internal.resource.java.GenerationType.TABLE;
+ }
+ else if (generationType == SEQUENCE) {
+ return org.eclipse.jpt.core.internal.resource.java.GenerationType.SEQUENCE;
+ }
+ else if (generationType == IDENTITY) {
+ return org.eclipse.jpt.core.internal.resource.java.GenerationType.IDENTITY;
+ }
+ else if (generationType == AUTO) {
+ return org.eclipse.jpt.core.internal.resource.java.GenerationType.AUTO;
+ }
+ return null;
+ }
+
+
+ public static GenerationType fromOrmResourceModel(org.eclipse.jpt.core.internal.resource.orm.GenerationType ormGenerationType) {
+ if (ormGenerationType == org.eclipse.jpt.core.internal.resource.orm.GenerationType.TABLE) {
+ return TABLE;
+ }
+ else if (ormGenerationType == org.eclipse.jpt.core.internal.resource.orm.GenerationType.SEQUENCE) {
+ return SEQUENCE;
+ }
+ else if (ormGenerationType == org.eclipse.jpt.core.internal.resource.orm.GenerationType.IDENTITY) {
+ return IDENTITY;
+ }
+ else if (ormGenerationType == org.eclipse.jpt.core.internal.resource.orm.GenerationType.AUTO) {
+ return AUTO;
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.core.internal.resource.orm.GenerationType toOrmResourceModel(GenerationType generationType) {
+ if (generationType == TABLE) {
+ return org.eclipse.jpt.core.internal.resource.orm.GenerationType.TABLE;
+ }
+ else if (generationType == SEQUENCE) {
+ return org.eclipse.jpt.core.internal.resource.orm.GenerationType.SEQUENCE;
+ }
+ else if (generationType == IDENTITY) {
+ return org.eclipse.jpt.core.internal.resource.orm.GenerationType.IDENTITY;
+ }
+ else if (generationType == AUTO) {
+ return org.eclipse.jpt.core.internal.resource.orm.GenerationType.AUTO;
+ }
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAbstractColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAbstractColumn.java
new file mode 100644
index 0000000000..02dbc36fd5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAbstractColumn.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.base;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public interface IAbstractColumn extends INamedColumn
+{
+
+ String getTable();
+
+ String getDefaultTable();
+ String DEFAULT_TABLE_PROPERTY = "defaultTableProperty";
+
+ String getSpecifiedTable();
+ void setSpecifiedTable(String value);
+ String SPECIFIED_TABLE_PROPERTY = "specifiedTableProperty";
+
+
+ Boolean getUnique();
+
+ Boolean getDefaultUnique();
+ String DEFAULT_UNIQUE_PROPERTY = "defaultUniqueProperty";
+ Boolean DEFAULT_UNIQUE = Boolean.FALSE;
+ Boolean getSpecifiedUnique();
+ void setSpecifiedUnique(Boolean newSpecifiedUnique);
+ String SPECIFIED_UNIQUE_PROPERTY = "specifiedUniqueProperty";
+
+
+ Boolean getNullable();
+
+ Boolean getDefaultNullable();
+ String DEFAULT_NULLABLE_PROPERTY = "defaultNullableProperty";
+ Boolean DEFAULT_NULLABLE = Boolean.TRUE;
+ Boolean getSpecifiedNullable();
+ void setSpecifiedNullable(Boolean newSpecifiedNullable);
+ String SPECIFIED_NULLABLE_PROPERTY = "specifiedNullableProperty";
+
+
+ Boolean getInsertable();
+
+ Boolean getDefaultInsertable();
+ String DEFAULT_INSERTABLE_PROPERTY = "defaulInsertableProperty";
+ Boolean DEFAULT_INSERTABLE = Boolean.TRUE;
+ Boolean getSpecifiedInsertable();
+ void setSpecifiedInsertable(Boolean newSpecifiedInsertable);
+ String SPECIFIED_INSERTABLE_PROPERTY = "specifiedInsertableProperty";
+
+
+ Boolean getUpdatable();
+
+ Boolean getDefaultUpdatable();
+ String DEFAULT_UPDATABLE_PROPERTY = "defaulUpdatableProperty";
+ Boolean DEFAULT_UPDATABLE = Boolean.TRUE;
+ Boolean getSpecifiedUpdatable();
+ void setSpecifiedUpdatable(Boolean newSpecifiedUpdatable);
+ String SPECIFIED_UPDATABLE_PROPERTY = "specifiedUpdatableProperty";
+
+ /**
+ * Return the (best guess) text location of the column's table.
+ */
+ ITextRange tableTextRange(CompilationUnit astRoot);
+
+ //TODO not sure we really need/want this to be public. This
+ //is used by ColumnComposite to get a list of possible associated tables, but
+ //right now that list isn't going to update in the UI except when we repopulate
+ Owner owner();
+
+ /**
+ * interface allowing columns to be used in multiple places
+ * (e.g. basic mappings and attribute overrides)
+ */
+ interface Owner extends INamedColumn.Owner
+ {
+ /**
+ * Return the name of the persistent attribute that contains the column.
+ */
+ String defaultTableName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAbstractJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAbstractJoinColumn.java
new file mode 100644
index 0000000000..cadb57411c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAbstractJoinColumn.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.db.internal.Column;
+import org.eclipse.jpt.db.internal.Table;
+
+
+public interface IAbstractJoinColumn extends INamedColumn
+{
+ String getReferencedColumnName();
+ String getDefaultReferencedColumnName();
+ String getSpecifiedReferencedColumnName();
+ void setSpecifiedReferencedColumnName(String value);
+ String SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY = "specifiedReferencedColumnName";
+ String DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY = "defaultReferencedColumnName";
+
+ /**
+ * Return the wrapper for the datasource referenced column
+ */
+ Column dbReferencedColumn();
+
+ /**
+ * Return whether the reference column is found on the datasource
+ */
+ boolean isReferencedColumnResolved();
+
+ /**
+ * Return the (best guess) text location of the referenced column name
+ */
+ ITextRange referencedColumnNameTextRange(CompilationUnit astRoot);
+
+ boolean isVirtual();
+
+ interface Owner extends INamedColumn.Owner
+ {
+ /**
+ * Return the wrapper for the datasource table for the referenced column
+ */
+ Table dbReferencedColumnTable();
+
+ boolean isVirtual(IAbstractJoinColumn joinColumn);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAssociationOverride.java
new file mode 100644
index 0000000000..f1e6113047
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAssociationOverride.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import java.util.ListIterator;
+
+public interface IAssociationOverride extends IOverride
+{
+ <T extends IJoinColumn> ListIterator<T> joinColumns();
+ <T extends IJoinColumn> ListIterator<T> specifiedJoinColumns();
+ <T extends IJoinColumn> ListIterator<T> defaultJoinColumns();
+ int specifiedJoinColumnsSize();
+ IJoinColumn addSpecifiedJoinColumn(int index);
+ void removeSpecifiedJoinColumn(int index);
+ void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex);
+ String SPECIFIED_JOIN_COLUMNS_LIST = "specifiedJoinColumnsList";
+ String DEFAULT_JOIN_COLUMNS_LIST = "defaultJoinColumnsList";
+
+ boolean containsSpecifiedJoinColumns();
+
+
+// public class JoinColumnOwner implements IJoinColumn.Owner
+// {
+// private IAssociationOverride associationOverride;
+//
+// public JoinColumnOwner(IAssociationOverride associationOverride) {
+// super();
+// this.associationOverride = associationOverride;
+// }
+//
+// /**
+// * by default, the join column is in the type mapping's primary table
+// */
+// public String defaultTableName() {
+// return this.associationOverride.getOwner().getTypeMapping().getTableName();
+// }
+//
+// public List<IJoinColumn> joinColumns() {
+// return this.associationOverride.getJoinColumns();
+// }
+//
+// public int indexOf(IAbstractJoinColumn joinColumn) {
+// return joinColumns().indexOf(joinColumn);
+// }
+//
+// public IEntity targetEntity() {
+// return getRelationshipMapping().getResolvedTargetEntity();
+// }
+//
+// public String attributeName() {
+// return this.associationOverride.getName();
+// }
+//
+// public IRelationshipMapping getRelationshipMapping() {
+// //TODO cast or check instanceof first??
+// return (IRelationshipMapping) this.associationOverride.getOwner().attributeMapping(this.associationOverride.getName());
+// }
+//
+// public boolean tableNameIsInvalid(String tableName) {
+// return getTypeMapping().tableNameIsInvalid(tableName);
+// }
+//
+// /**
+// * the join column can be on a secondary table
+// */
+// public boolean tableIsAllowed() {
+// return true;
+// }
+//
+// public ITextRange validationTextRange() {
+// return this.associationOverride.validationTextRange();
+// }
+//
+// public ITypeMapping getTypeMapping() {
+// return this.associationOverride.getOwner().getTypeMapping();
+// }
+//
+// public Table dbTable(String tableName) {
+// return getTypeMapping().dbTable(tableName);
+// }
+//
+// public Table dbReferencedColumnTable() {
+// IEntity targetEntity = targetEntity();
+// return (targetEntity == null) ? null : targetEntity().primaryDbTable();
+// }
+//
+// public boolean isVirtual(IAbstractJoinColumn joinColumn) {
+// return this.associationOverride.getDefaultJoinColumns().contains(joinColumn);
+// }
+//
+// }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAttributeMapping.java
index 0cf331549b..0841b6ea00 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IAttributeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAttributeMapping.java
@@ -7,34 +7,12 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal;
+package org.eclipse.jpt.core.internal.context.base;
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IAttribute Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIAttributeMapping()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IAttributeMapping extends IJpaSourceObject
+public interface IAttributeMapping extends IJpaContextNode
{
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation" required="true"
- * @generated
- */
- IPersistentAttribute getPersistentAttribute();
+ IPersistentAttribute persistentAttribute();
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation"
- * @generated
- */
boolean isDefault();
/**
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAttributeOverride.java
new file mode 100644
index 0000000000..e7abdbc35b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IAttributeOverride.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+
+public interface IAttributeOverride extends IOverride, IColumn.Owner
+{
+ IColumn getColumn();
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IBaseJpaContent.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IBaseJpaContent.java
new file mode 100644
index 0000000000..5305bf595b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IBaseJpaContent.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import org.eclipse.jpt.core.internal.IContextModel;
+
+public interface IBaseJpaContent extends IJpaContextNode, IContextModel
+{
+ // **************** persistence xml ***************************************
+
+ /**
+ * String constant associated with changes to the persistenceXml property
+ */
+ public final static String PERSISTENCE_XML_PROPERTY = "persistenceXml";
+
+ /**
+ * Return the content represented by the persistence.xml file associated with
+ * this project.
+ * This may be null.
+ */
+ IPersistenceXml getPersistenceXml();
+
+ /**
+ * Add a persistence.xml file to this content and return the content associated
+ * with it.
+ * Throws {@link IllegalStateException} if a persistence.xml already exists.
+ */
+ IPersistenceXml addPersistenceXml();
+
+ /**
+ * Remove the persistence.xml file from this content.
+ * Throws {@link IllegalStateException} if a persistence.xml does not exist.
+ */
+ void removePersistenceXml();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IBasicMapping.java
new file mode 100644
index 0000000000..20d8a8f21f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IBasicMapping.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.base;
+
+public interface IBasicMapping extends IAttributeMapping, IColumnMapping, IFetchable, INullable
+{
+ FetchType DEFAULT_FETCH_TYPE = FetchType.EAGER;
+
+ boolean isLob();
+
+ void setLob(boolean value);
+ String LOB_PROPERTY = "lobProperty";
+
+ EnumType getEnumerated();
+
+ EnumType getDefaultEnumerated();
+ String DEFAULT_ENUMERATED_PROPERTY = "defaultEnumeratedProperty";
+ EnumType DEFAULT_ENUMERATED = EnumType.ORDINAL;
+
+ EnumType getSpecifiedEnumerated();
+ void setSpecifiedEnumerated(EnumType newSpecifiedEnumerated);
+ String SPECIFIED_ENUMERATED_PROPERTY = "specifiedEnumeratedProperty";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ICascade.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ICascade.java
new file mode 100644
index 0000000000..f4b4cae76f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ICascade.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+public interface ICascade extends IJpaContextNode
+{
+
+ boolean isAll();
+ void setAll(boolean value);
+ String ALL_PROPERTY = "allProperty";
+
+ boolean isPersist();
+ void setPersist(boolean value);
+ String PERSIST_PROPERTY = "persistProperty";
+
+ boolean isMerge();
+ void setMerge(boolean value);
+ String MERGE_PROPERTY = "mergeProperty";
+
+ boolean isRemove();
+ void setRemove(boolean value);
+ String REMOVE_PROPERTY = "removeProperty";
+
+ boolean isRefresh();
+ void setRefresh(boolean value);
+ String REFRESH_PROPERTY = "refreshProperty";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IClassRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IClassRef.java
new file mode 100644
index 0000000000..852e36b8ab
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IClassRef.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef;
+
+public interface IClassRef extends IJpaContextNode
+{
+ /**
+ * Return true if the IClassRef matches the fullyQualfiedTypeName
+ */
+ boolean isFor(String fullyQualifiedTypeName);
+
+
+ // **************** class name *********************************************
+
+ /**
+ * String constant associated with changes to the class name
+ */
+ final static String CLASS_NAME_PROPERTY = "className";
+
+ /**
+ * Return the class name of the class ref.
+ */
+ String getClassName();
+
+ /**
+ * Set the class name of the class ref.
+ */
+ void setClassName(String className);
+
+
+ // **************** java persistent type ***********************************
+
+ /**
+ * String constant associated with changes to the java persistent type
+ */
+ final static String JAVA_PERSISTENT_TYPE_PROPERTY = "javaPersistentType";
+
+ /**
+ * Return the JavaPersistentType that corresponds to this IClassRef.
+ * This can be null.
+ * This is not settable by users of this API.
+ */
+ IJavaPersistentType getJavaPersistentType();
+
+
+ // **************** updating ***********************************************
+
+ void initialize(XmlJavaClassRef classRef);
+
+ void update(XmlJavaClassRef classRef);
+
+ // *************************************************************************
+
+ ITextRange validationTextRange();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IColumn.java
new file mode 100644
index 0000000000..4413970e22
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IColumn.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.base;
+
+public interface IColumn extends IAbstractColumn
+{
+ Integer getLength();
+
+ Integer getDefaultLength();
+ Integer DEFAULT_LENGTH = Integer.valueOf(255);
+ String DEFAULT_LENGTH_PROPERTY = "defaultLengthProperty";
+
+ Integer getSpecifiedLength();
+ void setSpecifiedLength(Integer newSpecifiedLength);
+ String SPECIFIED_LENGTH_PROPERTY = "spcifiedLengthProperty";
+
+ Integer getPrecision();
+
+ Integer getDefaultPrecision();
+ Integer DEFAULT_PRECISION = Integer.valueOf(0);
+ String DEFAULT_PRECISION_PROPERTY = "defaultPrecisionProperty";
+
+ Integer getSpecifiedPrecision();
+ void setSpecifiedPrecision(Integer newSpecifiedPrecision);
+ String SPECIFIED_PRECISION_PROPERTY = "spcifiedPrecisionProperty";
+
+
+ Integer getScale();
+
+ Integer getDefaultScale();
+ Integer DEFAULT_SCALE = Integer.valueOf(0);
+ String DEFAULT_SCALE_PROPERTY = "defaultScaleProperty";
+
+ Integer getSpecifiedScale();
+ void setSpecifiedScale(Integer newSpecifiedScale);
+ String SPECIFIED_SCALE_PROPERTY = "spcifiedScaleProperty";
+
+ /**
+ * Return whether the column is found on the datasource
+ */
+ boolean isResolved();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IColumnMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IColumnMapping.java
new file mode 100644
index 0000000000..489dad19cf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IColumnMapping.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.base;
+
+
+public interface IColumnMapping extends IJpaContextNode, IColumn.Owner
+{
+ IColumn getColumn();
+
+ TemporalType getTemporal();
+ void setTemporal(TemporalType value);
+ String TEMPORAL_PROPERTY = "temporalProperty";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IDiscriminatorColumn.java
new file mode 100644
index 0000000000..e6159fc70d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IDiscriminatorColumn.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 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.context.base;
+
+
+
+public interface IDiscriminatorColumn extends INamedColumn
+{
+ String DEFAULT_NAME = "DTYPE";
+
+ DiscriminatorType getDiscriminatorType();
+
+ DiscriminatorType getDefaultDiscriminatorType();
+ String DEFAULT_DISCRIMINATOR_TYPE_PROPERTY = "defaultDiscriminatorTypeProperty";
+ DiscriminatorType DEFAULT_DISCRIMINATOR_TYPE = DiscriminatorType.STRING;
+
+ DiscriminatorType getSpecifiedDiscriminatorType();
+ void setSpecifiedDiscriminatorType(DiscriminatorType newSpecifiedDiscriminatorType);
+ String SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY = "specifiedDiscriminatorTypeProperty";
+
+
+ Integer getLength();
+
+ Integer getDefaultLength();
+ Integer DEFAULT_LENGTH = Integer.valueOf(31);
+ String DEFAULT_LENGTH_PROPERTY = "defaultLengthProperty";
+
+ Integer getSpecifiedLength();
+ void setSpecifiedLength(Integer value);
+ String SPECIFIED_LENGTH_PROPERTY = "spcifiedLengthProperty";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/IXmlTypeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IEmbeddable.java
index a1434a6482..7bec965e74 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/IXmlTypeMappingProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IEmbeddable.java
@@ -7,12 +7,8 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.context.base;
+public interface IEmbeddable extends ITypeMapping
+{}
-public interface IXmlTypeMappingProvider
-{
- String key();
-
- XmlTypeMapping buildTypeMapping();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IEmbeddedIdMapping.java
new file mode 100644
index 0000000000..f0adde1fdd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IEmbeddedIdMapping.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import java.util.ListIterator;
+
+
+public interface IEmbeddedIdMapping extends IAttributeMapping, IOverride.Owner
+{
+ <T extends IAttributeOverride> ListIterator<T> attributeOverrides();
+ <T extends IAttributeOverride> ListIterator<T> specifiedAttributeOverrides();
+ <T extends IAttributeOverride> ListIterator<T> defaultAttributeOverrides();
+ int specifiedAttributeOverridesSize();
+ IAttributeOverride addSpecifiedAttributeOverride(int index);
+ void removeSpecifiedAttributeOverride(int index);
+ void moveSpecifiedAttributeOverride(int targetIndex, int sourceIndex);
+ String SPECIFIED_ATTRIBUTE_OVERRIDES_LIST = "specifiedAttributeOverridesList";
+ String DEFAULT_ATTRIBUTE_OVERRIDES_LIST = "defaultAttributeOverridesList";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IEmbeddedMapping.java
new file mode 100644
index 0000000000..95624b6828
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IEmbeddedMapping.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import java.util.ListIterator;
+
+public interface IEmbeddedMapping extends IAttributeMapping, IOverride.Owner
+{
+ <T extends IAttributeOverride> ListIterator<T> attributeOverrides();
+ <T extends IAttributeOverride> ListIterator<T> specifiedAttributeOverrides();
+ <T extends IAttributeOverride> ListIterator<T> defaultAttributeOverrides();
+ int specifiedAttributeOverridesSize();
+ IAttributeOverride addSpecifiedAttributeOverride(int index);
+ void removeSpecifiedAttributeOverride(int index);
+ void moveSpecifiedAttributeOverride(int targetIndex, int sourceIndex);
+ String SPECIFIED_ATTRIBUTE_OVERRIDES_LIST = "specifiedAttributeOverridesList";
+ String DEFAULT_ATTRIBUTE_OVERRIDES_LIST = "defaultAttributeOverridesList";
+
+
+// IEmbeddable embeddable();
+//
+// IAttributeOverride createAttributeOverride(int index);
+//
+// Iterator<String> allOverridableAttributeNames();
+//
+// IAttributeOverride attributeOverrideNamed(String name);
+//
+// boolean containsAttributeOverride(String name);
+//
+// boolean containsSpecifiedAttributeOverride(String name);
+//
+//
+// class AttributeOverrideOwner implements Owner
+// {
+// private IEmbedded embedded;
+//
+// public AttributeOverrideOwner(IEmbedded embedded) {
+// this.embedded = embedded;
+// }
+//
+// public ITypeMapping getTypeMapping() {
+// return this.embedded.typeMapping();
+// }
+//
+// public IAttributeMapping attributeMapping(String attributeName) {
+// return (IAttributeMapping) columnMapping(attributeName);
+// }
+//
+// private IColumnMapping columnMapping(String name) {
+// IEmbeddable embeddable = this.embedded.embeddable();
+// if (embeddable != null) {
+// for (Iterator<IPersistentAttribute> stream = embeddable.getPersistentType().allAttributes(); stream.hasNext();) {
+// IPersistentAttribute persAttribute = stream.next();
+// if (persAttribute.getName().equals(name)) {
+// if (persAttribute.getMapping() instanceof IColumnMapping) {
+// return (IColumnMapping) persAttribute.getMapping();
+// }
+// }
+// }
+// }
+// return null;
+// }
+//
+// public boolean isVirtual(IOverride override) {
+// return embedded.getDefaultAttributeOverrides().contains(override);
+// }
+//
+// public ITextRange validationTextRange() {
+// return embedded.validationTextRange();
+// }
+// }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IEntity.java
new file mode 100644
index 0000000000..fa9e54df6c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IEntity.java
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.base;
+
+import java.util.ListIterator;
+
+public interface IEntity extends ITypeMapping
+{
+ String getName();
+ String getSpecifiedName();
+ void setSpecifiedName(String value);
+ String SPECIFIED_NAME_PROPERTY = "specifiedNameProperty";
+
+ String getDefaultName();
+ String DEFAULT_NAME_PROPERTY = "defaultNameProperty";
+
+ ITable getTable();
+
+ <T extends ISecondaryTable> ListIterator<T> secondaryTables();
+ int secondaryTablesSize();
+
+ <T extends ISecondaryTable> ListIterator<T> specifiedSecondaryTables();
+ int specifiedSecondaryTablesSize();
+ ISecondaryTable addSpecifiedSecondaryTable(int index);
+ void removeSpecifiedSecondaryTable(int index);
+ void moveSpecifiedSecondaryTable(int targetIndex, int sourceIndex);
+ String SPECIFIED_SECONDARY_TABLES_LIST = "specifiedSecondaryTablesList";
+
+ InheritanceType getInheritanceStrategy();
+
+ InheritanceType getDefaultInheritanceStrategy();
+ String DEFAULT_INHERITANCE_STRATEGY_PROPERTY = "defaultInheritanceStrategyProperty";
+
+ InheritanceType getSpecifiedInheritanceStrategy();
+ void setSpecifiedInheritanceStrategy(InheritanceType newInheritanceType);
+ String SPECIFIED_INHERITANCE_STRATEGY_PROPERTY = "specifiedInheritanceStrategyProperty";
+
+ IDiscriminatorColumn getDiscriminatorColumn();
+
+
+ String getDiscriminatorValue();
+
+ String getDefaultDiscriminatorValue();
+ String DEFAULT_DISCRIMINATOR_VALUE_PROPERTY = "defaultDiscriminatorValueProperty";
+
+ String getSpecifiedDiscriminatorValue();
+ void setSpecifiedDiscriminatorValue(String value);
+ String SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY = "specifiedDiscriminatorValueProperty";
+
+
+ ITableGenerator getTableGenerator();
+ ITableGenerator addTableGenerator();
+ void removeTableGenerator();
+ String TABLE_GENERATOR_PROPERTY = "tableGeneratorProperty";
+
+ ISequenceGenerator getSequenceGenerator();
+ ISequenceGenerator addSequenceGenerator();
+ void removeSequenceGenerator();
+ String SEQUENCE_GENERATOR_PROPERTY = "sequenceGeneratorProperty";
+
+ <T extends IPrimaryKeyJoinColumn> ListIterator<T> primaryKeyJoinColumns();
+ <T extends IPrimaryKeyJoinColumn> ListIterator<T> specifiedPrimaryKeyJoinColumns();
+ <T extends IPrimaryKeyJoinColumn> ListIterator<T> defaultPrimaryKeyJoinColumns();
+ int specifiedPrimaryKeyJoinColumnsSize();
+ IPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index);
+ void removeSpecifiedPrimaryKeyJoinColumn(int index);
+ void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex);
+ String SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST = "specifiedPrimaryKeyJoinColumnsList";
+ String DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST = "defaultPrimaryKeyJoinColumnsList";
+
+ <T extends IAttributeOverride> ListIterator<T> attributeOverrides();
+ <T extends IAttributeOverride> ListIterator<T> specifiedAttributeOverrides();
+ <T extends IAttributeOverride> ListIterator<T> defaultAttributeOverrides();
+ int specifiedAttributeOverridesSize();
+ IAttributeOverride addSpecifiedAttributeOverride(int index);
+ void removeSpecifiedAttributeOverride(int index);
+ void moveSpecifiedAttributeOverride(int targetIndex, int sourceIndex);
+ String SPECIFIED_ATTRIBUTE_OVERRIDES_LIST = "specifiedAttributeOverridesList";
+ String DEFAULT_ATTRIBUTE_OVERRIDES_LIST = "defaultAttributeOverridesList";
+
+
+ <T extends IAssociationOverride> ListIterator<T> associationOverrides();
+ <T extends IAssociationOverride> ListIterator<T> specifiedAssociationOverrides();
+ <T extends IAssociationOverride> ListIterator<T> defaultAssociationOverrides();
+ int specifiedAssociationOverridesSize();
+ IAssociationOverride addSpecifiedAssociationOverride(int index);
+ void removeSpecifiedAssociationOverride(int index);
+ void moveSpecifiedAssociationOverride(int targetIndex, int sourceIndex);
+ String SPECIFIED_ASSOCIATION_OVERRIDES_LIST = "specifiedAssociationOverridesList";
+ String DEFAULT_ASSOCIATION_OVERRIDES_LIST = "defaulAssociationOverridesList";
+
+
+ <T extends INamedQuery> ListIterator<T> namedQueries();
+ int namedQueriesSize();
+ INamedQuery addNamedQuery(int index);
+ void removeNamedQuery(int index);
+ void moveNamedQuery(int targetIndex, int sourceIndex);
+ String NAMED_QUERIES_LIST = "namedQueriesList";
+
+ <T extends INamedNativeQuery> ListIterator<T> namedNativeQueries();
+ int namedNativeQueriesSize();
+ INamedNativeQuery addNamedNativeQuery(int index);
+ void removeNamedNativeQuery(int index);
+ void moveNamedNativeQuery(int targetIndex, int sourceIndex);
+ String NAMED_NATIVE_QUERIES_LIST = "namedNativeQueriesList";
+
+
+ String getIdClass();
+ void setIdClass(String value);
+ String ID_CLASS_PROPERTY = "isClassProperty";
+
+// boolean discriminatorValueIsAllowed();
+//
+ /**
+ * Return the ultimate top of the inheritance hierarchy
+ * This method should never return null. The root
+ * is defined as the persistent type in the inheritance hierarchy
+ * that has no parent. The root should be an entity
+ *
+ * Non-entities in the hierarchy should be ignored, ie skip
+ * over them in the search for the root.
+ */
+ IEntity rootEntity();
+
+ /**
+ * The first parent in the class hierarchy that is an entity.
+ * This is the parent in the entity (persistent) inheritance hierarchy
+ * (vs class inheritance hierarchy)
+ */
+ IEntity parentEntity();
+
+ /**
+ * Return the name of the entity's primary key column.
+ * Return null if the entity's primary key is "compound"
+ * (i.e. the primary key is composed of multiple columns).
+ */
+ String primaryKeyColumnName();
+
+// /**
+// * Return the name of the entity's primary key attribute.
+// * Return null if the entity's primary key is "compound"
+// * (i.e. the primary key is composed of multiple columns).
+// */
+// String primaryKeyAttributeName();
+//
+// IAttributeOverride attributeOverrideNamed(String name);
+//
+// boolean containsAttributeOverride(String name);
+//
+// boolean containsSpecifiedAttributeOverride(String name);
+//
+// boolean containsAssociationOverride(String name);
+//
+// boolean containsSpecifiedAssociationOverride(String name);
+//
+// boolean containsSecondaryTable(String name);
+//
+// boolean containsSpecifiedSecondaryTable(String name);
+//
+// boolean containsSpecifiedPrimaryKeyJoinColumns();
+
+
+
+//
+//
+// class AssociationOverrideOwner extends OverrideOwner
+// {
+// public AssociationOverrideOwner(IEntity entity) {
+// super(entity);
+// }
+//
+// public IAttributeMapping attributeMapping(String attributeName) {
+// for (Iterator<IPersistentAttribute> stream = this.entity.getPersistentType().allAttributes(); stream.hasNext();) {
+// IPersistentAttribute persAttribute = stream.next();
+// if (attributeName.equals(persAttribute.getName())) {
+// return persAttribute.getMapping();
+// }
+// }
+// return null;
+// }
+//
+// public boolean isVirtual(IOverride override) {
+// return entity.getDefaultAssociationOverrides().contains(override);
+// }
+// }
+//
+//
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IFetchable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IFetchable.java
new file mode 100644
index 0000000000..ca5b87895b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IFetchable.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+public interface IFetchable extends IAttributeMapping
+{
+ FetchType getFetch();
+
+ FetchType getDefaultFetch();
+ String DEFAULT_FETCH_PROPERTY = "defaultFetchProperty";
+
+ FetchType getSpecifiedFetch();
+ void setSpecifiedFetch(FetchType newSpecifiedFetch);
+ String SPECIFIED_FETCH_PROPERTY = "specifiedFetchProperty";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IGeneratedValue.java
new file mode 100644
index 0000000000..9156ed8c8b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IGeneratedValue.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public interface IGeneratedValue extends IJpaContextNode
+{
+
+ GenerationType getStrategy();
+ GenerationType getDefaultStrategy();
+ GenerationType getSpecifiedStrategy();
+ void setSpecifiedStrategy(GenerationType value);
+ String SPECIFIED_STRATEGY_PROPERTY = "specifiedStrategyProperty";
+ String DEFAULT_STRATEGY_PROPERTY = "defaultStrategyProperty";
+
+ String getGenerator();
+ String getDefaultGenerator();
+ GenerationType DEFAULT_STRATEGY = GenerationType.AUTO;
+ String getSpecifiedGenerator();
+ void setSpecifiedGenerator(String value);
+ String SPECIFIED_GENERATOR_PROPERTY = "specifiedGeneratorProperty";
+ String DEFAULT_GENERATOR_PROPERTY = "defaultGeneratorProperty";
+
+ /**
+ * Return the (best guess) text location of the generator.
+ */
+ ITextRange generatorTextRange(CompilationUnit astRoot);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IGenerator.java
new file mode 100644
index 0000000000..8468c39ff2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IGenerator.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+
+public interface IGenerator extends IJpaContextNode
+{
+
+ String getName();
+ void setName(String value);
+ String NAME_PROPERTY = "nameProperty";
+
+ Integer getInitialValue();
+
+ Integer getDefaultInitialValue();
+ String DEFAULT_INITIAL_VALUE_PROPERTY = "defaultInitialValueProperty";
+
+ Integer getSpecifiedInitialValue();
+ void setSpecifiedInitialValue(Integer value);
+ String SPECIFIED_INITIAL_VALUE_PROPERTY = "specifiedInitialValueProperty";
+
+
+ Integer getAllocationSize();
+
+ Integer getDefaultAllocationSize();
+ Integer DEFAULT_ALLOCATION_SIZE = Integer.valueOf(50);
+ String DEFAULT_ALLOCATION_SIZE_PROPERTY = "defaultAllocationSizeProperty";
+
+ Integer getSpecifiedAllocationSize();
+ void setSpecifiedAllocationSize(Integer value);
+ String SPECIFIED_ALLOCATION_SIZE_PROPERTY = "specifiedAllocationSizeProperty";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IIdMapping.java
new file mode 100644
index 0000000000..0add35302e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IIdMapping.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.base;
+
+public interface IIdMapping extends IAttributeMapping, IColumnMapping
+{
+ IGeneratedValue getGeneratedValue();
+ IGeneratedValue addGeneratedValue();
+ void removeGeneratedValue();
+ String GENERATED_VALUE_PROPERTY = "generatedValueProperty";
+
+ ITableGenerator getTableGenerator();
+ ITableGenerator addTableGenerator();
+ void removeTableGenerator();
+ String TABLE_GENERATOR_PROPERTY = "tableGeneratorProperty";
+
+ ISequenceGenerator getSequenceGenerator();
+ ISequenceGenerator addSequenceGenerator();
+ void removeSequenceGenerator();
+ String SEQUENCE_GENERATOR_PROPERTY = "sequenceGeneratorProperty";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IJoinColumn.java
index 141b55e3f5..367238f2bc 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IJoinColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IJoinColumn.java
@@ -7,27 +7,17 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.mappings;
+package org.eclipse.jpt.core.internal.context.base;
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJoin Column</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIJoinColumn()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
public interface IJoinColumn extends IAbstractColumn, IAbstractJoinColumn
{
- IJoinColumn.Owner getOwner();
+ IJoinColumn.Owner owner();
/**
* interface allowing join columns to be used in multiple places
* (e.g. 1:1 mappings and join tables)
*/
- interface Owner extends IAbstractJoinColumn.Owner
+ interface Owner extends IAbstractJoinColumn.Owner, IAbstractColumn.Owner
{
/**
* return whether the specified table cannot be explicitly specified
@@ -53,6 +43,6 @@ public interface IJoinColumn extends IAbstractColumn, IAbstractJoinColumn
/**
* return the relationship mapping for this join column
*/
- IRelationshipMapping getRelationshipMapping();
+ IRelationshipMapping relationshipMapping();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IJoinTable.java
new file mode 100644
index 0000000000..9df5a35019
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IJoinTable.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import java.util.ListIterator;
+
+
+public interface IJoinTable extends ITable
+{
+
+ <T extends IJoinColumn> ListIterator<T> joinColumns();
+ <T extends IJoinColumn> ListIterator<T> specifiedJoinColumns();
+ <T extends IJoinColumn> ListIterator<T> defaultJoinColumns();
+ int specifiedJoinColumnsSize();
+ IJoinColumn addSpecifiedJoinColumn(int index);
+ void removeSpecifiedJoinColumn(int index);
+ void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex);
+ String SPECIFIED_JOIN_COLUMNS_LIST = "specifiedJoinColumnsList";
+ String DEFAULT_JOIN_COLUMNS_LIST = "defaultJoinColumnsList";
+
+ boolean containsSpecifiedJoinColumns();
+
+
+ <T extends IJoinColumn> ListIterator<T> inverseJoinColumns();
+ <T extends IJoinColumn> ListIterator<T> specifiedInverseJoinColumns();
+ <T extends IJoinColumn> ListIterator<T> defaultInverseJoinColumns();
+ int specifiedInverseJoinColumnsSize();
+ IJoinColumn addSpecifiedInverseJoinColumn(int index);
+ void removeSpecifiedInverseJoinColumn(int index);
+ void moveSpecifiedInverseJoinColumn(int targetIndex, int sourceIndex);
+ String SPECIFIED_INVERSE_JOIN_COLUMNS_LIST = "specifiedInverseJoinColumnsList";
+ String DEFAULT_INVERSE_JOIN_COLUMNS_LIST = "defaultInverseJoinColumnsList";
+
+ boolean containsSpecifiedInverseJoinColumns();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IJpaContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IJpaContextNode.java
new file mode 100644
index 0000000000..b383562668
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IJpaContextNode.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import org.eclipse.jpt.core.internal.IJpaNode;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.orm.EntityMappings;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+
+public interface IJpaContextNode extends IJpaNode
+{
+ IPersistenceUnit persistenceUnit();
+
+ /**
+ * Return the EntityMappings if this contextNode is within an orm.xml context
+ * Return null otherwise.
+ */
+ EntityMappings entityMappings();
+
+ //TODO interface for this
+ XmlPersistentType xmlPersistentType();
+
+ ITextRange selectionTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/IXmlAttributeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IManyToManyMapping.java
index 41f0e2daed..b293b5bd43 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/IXmlAttributeMappingProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IManyToManyMapping.java
@@ -7,11 +7,7 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.context.base;
-public interface IXmlAttributeMappingProvider
-{
- String key();
-
- XmlAttributeMapping buildAttributeMapping();
-}
+public interface IManyToManyMapping extends IMultiRelationshipMapping
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IManyToOneMapping.java
new file mode 100644
index 0000000000..e69c056b3d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IManyToOneMapping.java
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.base;
+
+
+public interface IManyToOneMapping extends ISingleRelationshipMapping
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IMappedSuperclass.java
new file mode 100644
index 0000000000..7531f932b8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IMappedSuperclass.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.base;
+
+
+public interface IMappedSuperclass extends ITypeMapping
+{
+ String getIdClass();
+ void setIdClass(String value);
+ String ID_CLASS_PROPERTY = "isClassProperty";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IMappingFileRef.java
new file mode 100644
index 0000000000..4a8e142c33
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IMappingFileRef.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import org.eclipse.jpt.core.internal.context.orm.OrmXml;
+import org.eclipse.jpt.core.internal.context.orm.PersistenceUnitDefaults;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+
+public interface IMappingFileRef extends IJpaContextNode
+{
+ /**
+ * Return whether this mapping file ref is represented by an entry in the
+ * persistence.xml (false) or if it is instead virtual
+ */
+ boolean isVirtual();
+
+
+ // **************** file name **********************************************
+
+ /**
+ * String constant associated with changes to the file name
+ */
+ String FILE_NAME_PROPERTY = "fileNameProperty";
+
+ /**
+ * Return the file name of the mapping file ref.
+ */
+ String getFileName();
+
+ /**
+ * Set the file name of the mapping file ref.
+ */
+ void setFileName(String fileName);
+
+
+ // **************** orm xml ************************************************
+
+ String ORM_XML_PROPERTY = "ormXmlProperty";
+
+ OrmXml getOrmXml();
+
+
+ // **************** udpating ***********************************************
+
+ void initialize(XmlMappingFileRef mappingFileRef);
+
+ void update(XmlMappingFileRef mappingFileRef);
+
+
+ // *************************************************************************
+
+ PersistenceUnitDefaults persistenceUnitDefaults();
+
+ /**
+ * Return the XmlPersistentType listed in this mapping file
+ * with the given fullyQualifiedTypeName. Return null if non exists.
+ */
+ XmlPersistentType persistentTypeFor(String fullyQualifiedTypeName);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IMultiRelationshipMapping.java
new file mode 100644
index 0000000000..603e05eca6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IMultiRelationshipMapping.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.base;
+
+import java.util.Iterator;
+
+public interface IMultiRelationshipMapping extends INonOwningMapping
+{
+ FetchType DEFAULT_FETCH_TYPE = FetchType.LAZY;
+
+ String getOrderBy();
+ void setOrderBy(String value);
+ String ORDER_BY_PROPERTY = "orderByProperty";
+
+
+ boolean isNoOrdering();
+
+ void setNoOrdering();
+
+ boolean isOrderByPk();
+
+ void setOrderByPk();
+
+ boolean isCustomOrdering();
+
+
+ IJoinTable getJoinTable();
+
+ boolean isJoinTableSpecified();
+
+
+ String getMapKey();
+ void setMapKey(String value);
+ String MAP_KEY_PROPERTY = "mapKeyProperty";
+
+ Iterator<String> candidateMapKeyNames();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INamedColumn.java
new file mode 100644
index 0000000000..e2f8b07de3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INamedColumn.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.db.internal.Column;
+import org.eclipse.jpt.db.internal.Table;
+
+
+public interface INamedColumn extends IJpaContextNode
+{
+ String getName();
+
+ String getDefaultName();
+ String DEFAULT_NAME_PROPERTY = "defaultNameProperty";
+
+ String getSpecifiedName();
+ void setSpecifiedName(String value);
+ String SPECIFIED_NAME_PROPERTY = "specifiedNameProperty";
+
+
+ String getColumnDefinition();
+
+ void setColumnDefinition(String value);
+ String COLUMN_DEFINITION_PROPERTY = "columnDefinitionProperty";
+
+
+ /**
+ * Return the wrapper for the datasource column
+ */
+ Column dbColumn();
+
+ /**
+ * Return the wrapper for the datasource table
+ */
+ Table dbTable();
+
+ /**
+ * Return whether the column is found on the datasource.
+ */
+ boolean isResolved();
+
+ /**
+ * Return the (best guess) text location of the column's name.
+ */
+ ITextRange nameTextRange(CompilationUnit astRoot);
+
+ Owner owner();
+ /**
+ * interface allowing columns to be used in multiple places
+ * (e.g. basic mappings and attribute overrides)
+ */
+ interface Owner
+ {
+ /**
+ * Return the type mapping that contains the column.
+ */
+ ITypeMapping typeMapping();
+
+ /**
+ * Return the column owner's text range. This can be returned by the
+ * column when its annotation is not present.
+ */
+ ITextRange validationTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the wrapper for the datasource table for the given table name
+ */
+ Table dbTable(String tableName);
+
+ /**
+ * Return the default column name
+ */
+ String defaultColumnName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INamedNativeQuery.java
new file mode 100644
index 0000000000..24d813e95c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INamedNativeQuery.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+
+public interface INamedNativeQuery extends IQuery
+{
+ String getResultClass();
+ void setResultClass(String value);
+ String RESULT_CLASS_PROPERTY = "resultClassProperty";
+
+ String getResultSetMapping();
+ void setResultSetMapping(String value);
+ String RESULT_SET_MAPPING_PROPERTY = "resultSetMappingProperty";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INamedQuery.java
new file mode 100644
index 0000000000..5b98e1e835
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INamedQuery.java
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+
+public interface INamedQuery extends IQuery
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INonOwningMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INonOwningMapping.java
new file mode 100644
index 0000000000..c7a08c5e9d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INonOwningMapping.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.base;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+public interface INonOwningMapping extends IRelationshipMapping
+{
+ String getMappedBy();
+ void setMappedBy(String value);
+ String MAPPED_BY_PROPERTY = "mappedByProperty";
+
+ Iterator<String> candidateMappedByAttributeNames();
+
+ boolean mappedByIsValid(IAttributeMapping mappedByMapping);
+
+ ITextRange mappedByTextRange(CompilationUnit astRoot);
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INullable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INullable.java
new file mode 100644
index 0000000000..d99ebbad16
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/INullable.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.context.base;
+
+/**
+ * This interface is used for mappings that support the optional element.
+ * From the JPA spec:
+ * Whether the value of the field or property may be null. This is a hint
+ * and is disregarded for primitive types; it may be used in schema generation.
+ * @author kamoore
+ */
+public interface INullable extends IAttributeMapping
+{
+ Boolean getOptional();
+
+ Boolean getDefaultOptional();
+ String DEFAULT_OPTIONAL_PROPERTY = "defaultOptionalProperty";
+ Boolean DEFAULT_OPTIONAL = Boolean.TRUE;
+
+ Boolean getSpecifiedOptional();
+ void setSpecifiedOptional(Boolean newSpecifiedOptional);
+ String SPECIFIED_OPTIONAL_PROPERTY = "specifiedOptionalProperty";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IOneToManyMapping.java
new file mode 100644
index 0000000000..d99a7f2ac8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IOneToManyMapping.java
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.base;
+
+
+public interface IOneToManyMapping extends IMultiRelationshipMapping
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IOneToOneMapping.java
new file mode 100644
index 0000000000..8f586b0b1e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IOneToOneMapping.java
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+public interface IOneToOneMapping
+ extends ISingleRelationshipMapping, INonOwningMapping
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IOverride.java
new file mode 100644
index 0000000000..5677e9d521
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IOverride.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public interface IOverride extends IJpaContextNode
+{
+
+ String getName();
+ void setName(String value);
+ String NAME_PROPERTY = "nameProperty";
+
+ /**
+ * Return true if override exists as specified on the owning object, or false
+ * if the override is "gotten for free" as a result of defaults calculation
+ */
+ boolean isVirtual();
+
+ interface Owner
+ {
+ ITypeMapping typeMapping();
+
+ IColumnMapping columnMapping(String attributeName);
+
+ boolean isVirtual(IOverride override);
+
+ ITextRange validationTextRange(CompilationUnit astRoot);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistence.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistence.java
new file mode 100644
index 0000000000..32ae1edc25
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistence.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence;
+
+public interface IPersistence extends IJpaContextNode
+{
+ // **************** persistence units **************************************
+
+ /**
+ * String constant associated with changes to the persistence units list
+ */
+ public final static String PERSISTENCE_UNITS_LIST = "persistenceUnits";
+
+ /**
+ * Return an iterator on the list of persistence units.
+ * This will not be null.
+ */
+ ListIterator<IPersistenceUnit> persistenceUnits();
+
+ /**
+ * Add a persistence unit to the persistence node and return the object
+ * representing it.
+ */
+ IPersistenceUnit addPersistenceUnit();
+
+ /**
+ * Add a persistence unit to the persistence node at the specified index and
+ * return the object representing it.
+ */
+ IPersistenceUnit addPersistenceUnit(int index);
+
+ /**
+ * Remove the persistence unit from the persistence node.
+ */
+ void removePersistenceUnit(IPersistenceUnit persistenceUnit);
+
+ /**
+ * Remove the persistence unit at the specified index from the persistence node.
+ */
+ void removePersistenceUnit(int index);
+
+
+ // **************** updating ***********************************************
+
+ void initialize(XmlPersistence xmlPersistence);
+
+ void update(XmlPersistence persistence);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistenceUnit.java
new file mode 100644
index 0000000000..94efe4220d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistenceUnit.java
@@ -0,0 +1,382 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.context.base;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit;
+
+public interface IPersistenceUnit extends IJpaContextNode
+{
+ // **************** parent *************************************************
+
+ IPersistence persistence();
+
+
+ // **************** name ***************************************************
+
+ /**
+ * String constant associated with changes to the persistence unit's name
+ */
+ final static String NAME_PROPERTY = "name";
+
+ /**
+ * Return the name of the persistence unit.
+ */
+ String getName();
+
+ /**
+ * Set the name of the persistence unit.
+ */
+ void setName(String name);
+
+
+ // **************** transaction type ***************************************
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * transaction type
+ */
+ final static String TRANSACTION_TYPE_PROPERTY = "transactionType";
+
+ /**
+ * Return the transaction type of the persistence unit, one of the values of
+ * {@link PersistenceUnitTransactionType}
+ */
+ PersistenceUnitTransactionType getTransactionType();
+
+ /**
+ * Set the transaction type of the persistence unit, one of the values of
+ * {@link PersistenceUnitTransactionType}
+ */
+ void setTransactionType(PersistenceUnitTransactionType transactionType);
+
+ /**
+ * Return true if the transaction type is default rather than overridden
+ * (corresponds to missing tag in persistence.xml)
+ */
+ boolean isTransactionTypeDefault();
+
+ /**
+ * Set the transaction type of the persistence unit to the default
+ */
+ void setTransactionTypeToDefault();
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * default transaction type (not typically changed)
+ */
+ final static String DEFAULT_TRANSACTION_TYPE_PROPERTY = "defaultTransactionType";
+
+ /**
+ * Return the default transaction type
+ */
+ PersistenceUnitTransactionType getDefaultTransactionType();
+
+
+
+ // **************** description ********************************************
+
+ /**
+ * String constant associated with changes to the persistence unit's description
+ */
+ final static String DESCRIPTION_PROPERTY = "description";
+
+ /**
+ * Return the description of the persistence unit.
+ */
+ String getDescription();
+
+ /**
+ * Set the description of the persistence unit.
+ */
+ void setDescription(String description);
+
+
+ // **************** provider ********************************************
+
+ /**
+ * String constant associated with changes to the persistence unit's provider
+ */
+ final static String PROVIDER_PROPERTY = "provider";
+
+ /**
+ * Return the provider of the persistence unit.
+ */
+ String getProvider();
+
+ /**
+ * Set the provider of the persistence unit.
+ */
+ void setProvider(String provider);
+
+
+ // **************** jta data source ****************************************
+
+ /**
+ * String constant associated with changes to the persistence unit's JTA data source
+ */
+ final static String JTA_DATA_SOURCE_PROPERTY = "jtaDataSource";
+
+ /**
+ * Return the JTA data source of the persistence unit.
+ */
+ String getJtaDataSource();
+
+ /**
+ * Set the JTA data source of the persistence unit.
+ */
+ void setJtaDataSource(String jtaDataSource);
+
+
+ // **************** non-jta data source ************************************
+
+ /**
+ * String constant associated with changes to the persistence unit's non-JTA data source
+ */
+ final static String NON_JTA_DATA_SOURCE_PROPERTY = "nonJtaDataSource";
+
+ /**
+ * Return the non-JTA data source of the persistence unit.
+ */
+ String getNonJtaDataSource();
+
+ /**
+ * Set the non-JTA data source of the persistence unit.
+ */
+ void setNonJtaDataSource(String nonJtaDataSource);
+
+
+ // **************** mapping file refs **************************************
+
+ /**
+ * Return an iterator on the list of mapping file refs, whether specified or
+ * not.
+ * This will not be null.
+ */
+ ListIterator<IMappingFileRef> mappingFileRefs();
+
+
+ // **************** default mapping file ref *******************************
+
+ /**
+ * String constant associated with changes to the default mapping file ref
+ */
+ final static String DEFAULT_MAPPING_FILE_REF_PROPERTY = "defaultMappingFileRef";
+
+ /**
+ * Return the current default mapping file ref.
+ * This may be null.
+ */
+ IMappingFileRef getDefaultMappingFileRef();
+
+ /**
+ * Adds the default mapping file ref
+ */
+ IMappingFileRef setDefaultMappingFileRef();
+
+ /**
+ * Removes the default mapping file ref
+ */
+ void unsetDefaultMappingFileRef();
+
+
+ // **************** specified mapping file refs ****************************
+
+ /**
+ * String constant associated with changes to the specified mapping file refs list
+ */
+ final static String SPECIFIED_MAPPING_FILE_REF_LIST = "specifiedMappingFileRefs";
+
+ /**
+ * Return an iterator on the list of specified mapping file refs.
+ * This will not be null.
+ */
+ ListIterator<IMappingFileRef> specifiedMappingFileRefs();
+
+ /**
+ * Add a specified mapping file ref to the persistence unit and return the object
+ * representing it.
+ */
+ IMappingFileRef addSpecifiedMappingFileRef();
+
+ /**
+ * Add a specified mapping file ref to the persistence unit at the specified index and
+ * return the object representing it.
+ */
+ IMappingFileRef addSpecifiedMappingFileRef(int index);
+
+ /**
+ * Remove the specified mapping file ref from the persistence unit.
+ */
+ void removeSpecifiedMappingFileRef(IMappingFileRef mappingFileRef);
+
+ /**
+ * Remove the specified mapping file ref at the specified index from the persistence unit.
+ */
+ void removeSpecifiedMappingFileRef(int index);
+
+
+ // **************** class refs *********************************************
+
+ /**
+ * String constant associated with changes to the class refs list
+ */
+ final static String CLASS_REF_LIST = "classRefs";
+
+ /**
+ * Return an iterator on the list of class refs.
+ * This will not be null.
+ */
+ ListIterator<IClassRef> classRefs();
+
+ /**
+ * Add a class ref to the persistence unit and return the object
+ * representing it.
+ */
+ IClassRef addClassRef();
+
+ /**
+ * Add a class ref to the persistence unit at the specified index and
+ * return the object representing it.
+ */
+ IClassRef addClassRef(int index);
+
+ /**
+ * Remove the class ref from the persistence unit.
+ */
+ void removeClassRef(IClassRef classRef);
+
+ /**
+ * Remove the class ref at the specified index from the persistence unit.
+ */
+ void removeClassRef(int index);
+
+
+ // **************** exclude unlisted classes *******************************
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * "exclude unlisted classes" setting
+ */
+ final static String EXCLUDE_UNLISTED_CLASSED_PROPERTY = "excludeUnlistedClasses";
+
+ /**
+ * Return the "exclude unlisted classes" setting of the persistence unit.
+ */
+ boolean getExcludeUnlistedClasses();
+
+ /**
+ * Set the "exclude unlisted classes" setting of the persistence unit.
+ */
+ void setExcludeUnlistedClasses(boolean excludeUnlistedClasses);
+
+ /**
+ * Return true if the "exclude unlisted classes" setting is default rather
+ * than overridden
+ * (corresponds to missing tag in persistence.xml)
+ */
+ boolean isExcludeUnlistedClassesDefault();
+
+ /**
+ * Set the "exclude unlisted classes" setting of the persistence unit to the
+ * default
+ */
+ void setExcludeUnlistedClassesToDefault();
+
+ /**
+ * String constant associated with changes to the persistence unit's
+ * default "exclude unlisted classes" setting (not typically changed)
+ */
+ final static String DEFAULT_EXCLUDE_UNLISTED_CLASSED_PROPERTY = "defaultExcludeUnlistedClasses";
+
+ /**
+ * Return the default "exclude unlisted classes" setting
+ */
+ boolean getDefaultExcludeUnlistedClasses();
+
+
+ // **************** properties *********************************************
+
+ /**
+ * String constant associated with changes to the properties list
+ */
+ final static String PROPERTIES_LIST = "properties";
+
+ /**
+ * Return an iterator on the list of properties.
+ * This will not be null.
+ */
+ ListIterator<IProperty> properties();
+
+ int propertiesSize();
+
+ /**
+ * Add a property to the persistence unit and return the object
+ * representing it.
+ */
+ IProperty addProperty();
+
+ IProperty getProperty(String key);
+
+ IProperty getProperty(String key, String value);
+
+ void putProperty(String key, String value, boolean allowDuplicates);
+
+ void replacePropertyValue(String key, String oldValue, String newValue);
+
+ boolean containsProperty(String key);
+
+ /**
+ * Remove the property from the persistence unit.
+ */
+ void removeProperty(IProperty property);
+
+ /**
+ * Remove the property with the given key from the persistence unit.
+ */
+ void removeProperty(String key);
+
+ /**
+ * Remove the property with the given key and valuefrom the persistence unit.
+ */
+ void removeProperty(String key, String value);
+
+
+ // **************** PersistenceUnitDefaults ********************************
+
+ String getDefaultSchema();
+ String DEFAULT_SCHEMA_PROPERTY = "defaultSchema";
+
+ String getDefaultCatalog();
+ String DEFAULT_CATALOG_PROPERTY = "defaultCatalog";
+
+ AccessType getDefaultAccess();
+ String DEFAULT_ACCESS_PROPERTY = "defaultAccess";
+
+ boolean getDefaultCascadePersist();
+ String DEFAULT_CASCADE_PERSIST_PROPERTY = "defaultCascadePersist";
+
+
+ // **************** updating ***********************************************
+
+ void initialize(XmlPersistenceUnit persistenceUnit);
+
+ void update(XmlPersistenceUnit persistenceUnit);
+
+
+ // *************************************************************************
+
+ /**
+ * Return the IPersistentType specified in this PersistenceUnit with the given
+ * fully qualified type name
+ */
+ IPersistentType persistentType(String fullyQualifiedTypeName);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistenceXml.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistenceXml.java
new file mode 100644
index 0000000000..86d34656f6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistenceXml.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResource;
+
+public interface IPersistenceXml extends IJpaContextNode
+{
+ // **************** persistence *******************************************
+
+ /**
+ * String constant associated with changes to the persistence property
+ */
+ public final static String PERSISTENCE_PROPERTY = "persistence";
+
+ /**
+ * Return the content represented by the root of the persistence.xml file.
+ * This may be null.
+ */
+ IPersistence getPersistence();
+
+ /**
+ * Add a persistence node to the persistence.xml file and return the object
+ * representing it.
+ * Throws {@link IllegalStateException} if a persistence node already exists.
+ */
+ IPersistence addPersistence();
+
+ /**
+ * Remove the persistence node from the persistence.xml file.
+ * Throws {@link IllegalStateException} if a persistence node does not exist.
+ */
+ void removePersistence();
+
+
+ // **************** updating **********************************************
+
+ void initialize(PersistenceResource persistenceResource);
+
+ void update(PersistenceResource persistenceResource);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistentAttribute.java
index a9c3a8e268..fc79ea8804 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/IPersistentAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistentAttribute.java
@@ -7,87 +7,50 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal;
+package org.eclipse.jpt.core.internal.context.base;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IPersistent Attribute</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.IPersistentAttribute#getMapping <em>Mapping</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIPersistentAttribute()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IPersistentAttribute extends IJpaContentNode
+public interface IPersistentAttribute extends IJpaContextNode
{
- /**
- * Returns the value of the '<em><b>Mapping</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the value of the '<em>Mapping</em>' reference.
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getIPersistentAttribute_Mapping()
- * @model resolveProxies="false" required="true" transient="true" changeable="false" volatile="true" derived="true"
- * @generated
- */
- IAttributeMapping getMapping();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model required="true"
- * @generated
- */
- ITypeMapping typeMapping();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation" required="true"
- * @generated
- */
String getName();
+ String NAME_PROPERTY = "nameProperty";
/**
- * <!-- begin-user-doc -->
* Return the key for the attribute's mapping.
* The key may be for either the "specified" mapping or, if the "specified"
* mapping is missing, the "default" mapping.
- * <!-- end-user-doc -->
- * @model required="true"
- * @generated
*/
String mappingKey();
/**
- * <!-- begin-user-doc -->
* Return the key for the attribute's "default" mapping.
- * <!-- end-user-doc -->
- * @model required="true"
- * @generated
*/
String defaultMappingKey();
/**
+ * Return the attribute's "specified" mapping, or if it is null
+ * return the "default" mapping. WIll not return null.
+ */
+ IAttributeMapping getMapping();
+
+ /**
+ * Return the attribute's "specified" mapping, could be null
+ */
+ IAttributeMapping getSpecifiedMapping();
+
+ /**
* Clients should call this method to set the attribute's mapping.
* Passing in a null key will cause the "specified" mapping to be
* cleared and the attribute's mapping to be its "default" mapping.
*/
void setSpecifiedMappingKey(String key);
+ String SPECIFIED_MAPPING_PROPERTY = "specifiedMappingProperty";
+ String DEFAULT_MAPPING_PROPERTY = "defaultMappingProperty";
+
+ ITypeMapping typeMapping();
- /**
- * Return the attribute's Java attribute.
- */
- Attribute getAttribute();
-
+ IPersistentType persistentType();
+
/**
* If the attribute is mapped to a primary key column, return the
* column's name, otherwise return null.
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistentType.java
new file mode 100644
index 0000000000..18dd4c116d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPersistentType.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.base;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+
+
+public interface IPersistentType extends IJpaContextNode
+{
+ String getName();
+ String NAME_PROPERTY = "nameProperty";
+
+ AccessType access();
+ String ACCESS_PROPERTY = "accessProperty";
+
+ ITypeMapping getMapping();
+ String mappingKey();
+ void setMappingKey(String key);
+ String MAPPING_PROPERTY = "mappingProperty";
+
+ boolean isMapped();
+
+ /**
+ * Return the parent IPersistentType from the inheritance hierarchy.
+ * If the java inheritance parent is not a IPersistentType then continue
+ * up the hierarchy. Return null if this persistentType is the root
+ * persistent type.
+ */
+ IPersistentType parentPersistentType();
+
+ /**
+ * Return a read-only iterator of the contained IPersistentAttributes
+ */
+ <T extends IPersistentAttribute> ListIterator<T> attributes();
+ int attributesSize();
+ String SPECIFIED_ATTRIBUTES_LIST = "specifiedAttributesList";
+ String VIRTUAL_ATTRIBUTES_LIST = "virtualAttributesList";
+
+ Iterator<String> attributeNames();
+
+ /**
+ * Return a read-only iterator of the all the IPersistentAttributes
+ * in the hierarchy
+ */
+ Iterator<IPersistentAttribute> allAttributes();
+
+ Iterator<String> allAttributeNames();
+
+ /**
+ * Return the attribute named <code>attributeName</code> if
+ * it exists locally on this type
+ */
+ IPersistentAttribute attributeNamed(String attributeName);
+
+ /**
+ * Resolve and return the attribute named <code>attributeName</code> if it
+ * is distinct and exists within the context of this type
+ */
+ IPersistentAttribute resolveAttribute(String attributeName);
+
+ Iterator<IPersistentType> inheritanceHierarchy();
+
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..731f06ab4a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IPrimaryKeyJoinColumn.java
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+
+public interface IPrimaryKeyJoinColumn extends IAbstractJoinColumn
+{} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IProperty.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IProperty.java
new file mode 100644
index 0000000000..b2e8853432
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IProperty.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import org.eclipse.jpt.core.internal.resource.persistence.XmlProperty;
+
+public interface IProperty extends IJpaContextNode
+{
+ // **************** name ***************************************************
+
+ final static String NAME_PROPERTY = "name";
+
+ String getName();
+
+ void setName(String name);
+
+
+ // **************** value **************************************************
+
+ final static String VALUE_PROPERTY = "value";
+
+ void setValue(String value);
+
+ String getValue();
+
+
+ // **************** updating ***********************************************
+
+ void initialize(XmlProperty property);
+
+ void update(XmlProperty property);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IQuery.java
new file mode 100644
index 0000000000..6614012aca
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IQuery.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import java.util.ListIterator;
+
+public interface IQuery extends IJpaContextNode
+{
+
+ String getName();
+ void setName(String value);
+ String NAME_PROPERTY = "nameProperty";
+
+ String getQuery();
+ void setQuery(String value);
+ String QUERY_PROPERTY = "queryProperty";
+
+ <T extends IQueryHint> ListIterator<T> hints();
+ int hintsSize();
+ IQueryHint addHint(int index);
+ void removeHint(int index);
+ void moveHint(int targetIndex, int sourceIndex);
+ String HINTS_LIST = "hintsList";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlTransientContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IQueryHint.java
index c5b824ca27..6513585e66 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlTransientContext.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IQueryHint.java
@@ -7,16 +7,18 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.platform;
+package org.eclipse.jpt.core.internal.context.base;
-import org.eclipse.jpt.core.internal.content.orm.XmlTransient;
-public class XmlTransientContext
- extends XmlAttributeContext
+public interface IQueryHint extends IJpaContextNode
{
- public XmlTransientContext(
- IContext parentContext, XmlTransient mapping) {
- super(parentContext, mapping);
- }
+
+ String getName();
+ void setName(String value);
+ String NAME_PROPERTY = "nameProperty";
+
+ String getValue();
+ void setValue(String value);
+ String VALUE_PROPERTY = "valueProperty";
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IRelationshipMapping.java
new file mode 100644
index 0000000000..436ae0d310
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IRelationshipMapping.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.base;
+
+
+public interface IRelationshipMapping extends IAttributeMapping, IFetchable
+{
+
+ String getTargetEntity();
+
+ String getSpecifiedTargetEntity();
+ void setSpecifiedTargetEntity(String value);
+ String SPECIFIED_TARGET_ENTITY_PROPERTY = "specifiedTargetEntityProperty";
+
+ String getDefaultTargetEntity();
+ String DEFAULT_TARGET_ENTITY_PROPERTY = "defaultTargetEntityProperty";
+
+ IEntity getResolvedTargetEntity();
+ String RESOLVED_TARGET_ENTITY_PROPERTY = "resolvedTargetEntityProperty";
+
+ ICascade getCascade();
+
+ /**
+ * Return whether the specified 'targetEntity' is valid.
+ */
+ boolean targetEntityIsValid(String targetEntity);
+
+ /**
+ * Return the Entity that owns this relationship mapping
+ * @return
+ */
+ IEntity getEntity();
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ISecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ISecondaryTable.java
new file mode 100644
index 0000000000..138efced67
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ISecondaryTable.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import java.util.ListIterator;
+
+
+public interface ISecondaryTable extends ITable
+{
+
+ <T extends IPrimaryKeyJoinColumn> ListIterator<T> primaryKeyJoinColumns();
+ <T extends IPrimaryKeyJoinColumn> ListIterator<T> specifiedPrimaryKeyJoinColumns();
+ <T extends IPrimaryKeyJoinColumn> ListIterator<T> defaultPrimaryKeyJoinColumns();
+ int specifiedPrimaryKeyJoinColumnsSize();
+ IPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index);
+ void removeSpecifiedPrimaryKeyJoinColumn(int index);
+ void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex);
+ String SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST = "specifiedPrimaryKeyJoinColumnsList";
+ String DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST = "defaultPrimaryKeyJoinColumnsList";
+
+
+// ITypeMapping typeMapping();
+//
+// /**
+// * Create a primary key join column with the given index
+// */
+// IPrimaryKeyJoinColumn createPrimaryKeyJoinColumn(int index);
+//
+// boolean containsSpecifiedPrimaryKeyJoinColumns();
+//
+// boolean isVirtual();
+//
+// class PrimaryKeyJoinColumnOwner implements IAbstractJoinColumn.Owner
+// {
+// private ISecondaryTable secondaryTable;
+//
+// public PrimaryKeyJoinColumnOwner(ISecondaryTable secondaryTable) {
+// this.secondaryTable = secondaryTable;
+// }
+//
+// public ITextRange validationTextRange() {
+// return this.secondaryTable.validationTextRange();
+// }
+//
+// public ITypeMapping getTypeMapping() {
+// return this.secondaryTable.typeMapping();
+// }
+//
+// public Table dbTable(String tableName) {
+// return this.secondaryTable.dbTable();
+// }
+//
+// public Table dbReferencedColumnTable() {
+// return getTypeMapping().primaryDbTable();
+// }
+//
+// public List<IPrimaryKeyJoinColumn> joinColumns() {
+// return this.secondaryTable.getPrimaryKeyJoinColumns();
+// }
+//
+// public boolean isVirtual(IAbstractJoinColumn joinColumn) {
+// return this.secondaryTable.getDefaultPrimaryKeyJoinColumns().contains(joinColumn);
+// }
+//
+// public int indexOf(IAbstractJoinColumn joinColumn) {
+// return joinColumns().indexOf(joinColumn);
+// }
+// }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ISequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ISequenceGenerator.java
new file mode 100644
index 0000000000..5bdd4a6765
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ISequenceGenerator.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+
+public interface ISequenceGenerator extends IGenerator
+{
+ Integer DEFAULT_INITIAL_VALUE = Integer.valueOf(1);
+
+ String getSequenceName();
+
+ String getDefaultSequenceName();
+ String DEFAULT_SEQUENCE_NAME_PROPERTY = "defaultSequenceNameProperty";
+ String getSpecifiedSequenceName();
+ void setSpecifiedSequenceName(String value);
+ String SPECIFIED_SEQUENCE_NAME_PROPERTY = "specifiedSequenceNameProperty";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ISingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ISingleRelationshipMapping.java
new file mode 100644
index 0000000000..dcd2cb6366
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ISingleRelationshipMapping.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.base;
+
+import java.util.ListIterator;
+
+
+public interface ISingleRelationshipMapping extends IRelationshipMapping, INullable
+{
+
+ FetchType DEFAULT_FETCH_TYPE = FetchType.EAGER;
+
+ <T extends IJoinColumn> ListIterator<T> joinColumns();
+ <T extends IJoinColumn> ListIterator<T> specifiedJoinColumns();
+ <T extends IJoinColumn> ListIterator<T> defaultJoinColumns();
+ int specifiedJoinColumnsSize();
+ IJoinColumn addSpecifiedJoinColumn(int index);
+ void removeSpecifiedJoinColumn(int index);
+ void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex);
+ String SPECIFIED_JOIN_COLUMNS_LIST = "specifiedJoinColumnsList";
+ String DEFAULT_JOIN_COLUMNS_LIST = "defaultJoinColumnsList";
+
+ boolean containsSpecifiedJoinColumns();
+
+// public class JoinColumnOwner implements IJoinColumn.Owner
+// {
+// private ISingleRelationshipMapping singleRelationshipMapping;
+//
+// public JoinColumnOwner(ISingleRelationshipMapping singleRelationshipMapping) {
+// super();
+// this.singleRelationshipMapping = singleRelationshipMapping;
+// }
+//
+// /**
+// * by default, the join column is in the type mapping's primary table
+// */
+// public String defaultTableName() {
+// return this.singleRelationshipMapping.getPersistentAttribute().typeMapping().getTableName();
+// }
+//
+// public List<IJoinColumn> joinColumns() {
+// return this.singleRelationshipMapping.getJoinColumns();
+// }
+//
+// public int indexOf(IAbstractJoinColumn joinColumn) {
+// return joinColumns().indexOf(joinColumn);
+// }
+//
+// public IEntity targetEntity() {
+// return this.singleRelationshipMapping.getResolvedTargetEntity();
+// }
+//
+// public String attributeName() {
+// return this.singleRelationshipMapping.getPersistentAttribute().getName();
+// }
+//
+// public IRelationshipMapping getRelationshipMapping() {
+// return this.singleRelationshipMapping;
+// }
+//
+// public boolean tableNameIsInvalid(String tableName) {
+// return this.singleRelationshipMapping.getPersistentAttribute().typeMapping().tableNameIsInvalid(tableName);
+// }
+//
+// /**
+// * the join column can be on a secondary table
+// */
+// public boolean tableIsAllowed() {
+// return true;
+// }
+//
+// public ITextRange validationTextRange() {
+// return this.singleRelationshipMapping.validationTextRange();
+// }
+//
+// public ITypeMapping getTypeMapping() {
+// return this.singleRelationshipMapping.typeMapping();
+// }
+//
+// public Table dbTable(String tableName) {
+// return getTypeMapping().dbTable(tableName);
+// }
+//
+// public Table dbReferencedColumnTable() {
+// IEntity targetEntity = targetEntity();
+// return (targetEntity == null) ? null : targetEntity().primaryDbTable();
+// }
+//
+// public boolean isVirtual(IAbstractJoinColumn joinColumn) {
+// return this.singleRelationshipMapping.getDefaultJoinColumns().contains(joinColumn);
+// }
+// }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ITable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ITable.java
new file mode 100644
index 0000000000..fc3fc5449b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ITable.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.base;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.db.internal.Schema;
+
+public interface ITable extends IJpaContextNode
+{
+ String getName();
+
+ String getDefaultName();
+ String DEFAULT_NAME_PROPERTY = "defaultNameProperty";
+
+ String getSpecifiedName();
+ void setSpecifiedName(String value);
+ String SPECIFIED_NAME_PROPERTY = "specifiedNameProperty";
+
+ String getCatalog();
+
+ String getDefaultCatalog();
+ String DEFAULT_CATALOG_PROPERTY = "defaultCatalogProperty";
+
+ String getSpecifiedCatalog();
+ void setSpecifiedCatalog(String value);
+ String SPECIFIED_CATALOG_PROPERTY = "specifiedCatalogProperty";
+
+
+ String getSchema();
+
+ String getDefaultSchema();
+ String DEFAULT_SCHEMA_PROPERTY = "defaultSchemaProperty";
+
+ String getSpecifiedSchema();
+ void setSpecifiedSchema(String value);
+ String SPECIFIED_SCHEMA_PROPERTY = "specifiedSchemaProperty";
+
+
+// EList<IUniqueConstraint> getUniqueConstraints();
+// IUniqueConstraint createUniqueConstraint(int index);
+
+ org.eclipse.jpt.db.internal.Table dbTable();
+
+ Schema dbSchema();
+
+ /**
+ * Return true if this table is connected to a datasource
+ */
+ boolean isConnected();
+
+ /**
+ * Return true if this table's schema can be resolved to a schema on the active connection
+ */
+ boolean hasResolvedSchema();
+
+ /**
+ * Return true if this can be resolved to a table on the active connection
+ */
+ boolean isResolved();
+
+ ITextRange nameTextRange(CompilationUnit astRoot);
+
+ ITextRange schemaTextRange(CompilationUnit astRoot);
+
+ ITextRange catalogTextRange(CompilationUnit astRoot);
+
+//
+// class UniqueConstraintOwner implements IUniqueConstraint.Owner
+// {
+// private final ITable table;
+//
+// public UniqueConstraintOwner(ITable table) {
+// super();
+// this.table = table;
+// }
+//
+// public Iterator<String> candidateUniqueConstraintColumnNames() {
+// return this.table.dbTable().columnNames();
+// }
+// }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ITableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ITableGenerator.java
new file mode 100644
index 0000000000..539399d041
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ITableGenerator.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.db.internal.Table;
+
+
+public interface ITableGenerator extends IGenerator
+{
+ Integer DEFAULT_INITIAL_VALUE = Integer.valueOf(0);
+
+ String getTable();
+
+ String getDefaultTable();
+ String DEFAULT_TABLE_PROPERTY = "defaultTableProperty";
+ String getSpecifiedTable();
+ void setSpecifiedTable(String value);
+ String SPECIFIED_TABLE_PROPERTY = "specifiedTableProperty";
+
+
+
+ String getCatalog();
+
+ String getDefaultCatalog();
+ String DEFAULT_CATALOG_PROPERTY = "defaultCatalogProperty";
+
+ String getSpecifiedCatalog();
+ void setSpecifiedCatalog(String value);
+ String SPECIFIED_CATALOG_PROPERTY = "specifiedCatalogProperty";
+
+
+
+ String getSchema();
+
+ String getDefaultSchema();
+ String DEFAULT_SCHEMA_PROPERTY = "defaultSchemaProperty";
+
+ String getSpecifiedSchema();
+ void setSpecifiedSchema(String value);
+ String SPECIFIED_SCHEMA_PROPERTY = "specifiedSchemaProperty";
+
+
+
+ String getPkColumnName();
+
+ String getDefaultPkColumnName();
+ String DEFAULT_PK_COLUMN_NAME_PROPERTY = "defaultPkColumnNameProperty";
+
+ String getSpecifiedPkColumnName();
+ void setSpecifiedPkColumnName(String value);
+ String SPECIFIED_PK_COLUMN_NAME_PROPERTY = "specifiedPkColumnNameProperty";
+
+
+ String getValueColumnName();
+
+ String getDefaultValueColumnName();
+ String DEFAULT_VALUE_COLUMN_NAME_PROPERTY = "defaultValueColumnNameProperty";
+
+ String getSpecifiedValueColumnName();
+ void setSpecifiedValueColumnName(String value);
+ String SPECIFIED_VALUE_COLUMN_NAME_PROPERTY = "specifiedValueColumnNameProperty";
+
+
+ String getPkColumnValue();
+
+ String getDefaultPkColumnValue();
+ String DEFAULT_PK_COLUMN_VALUE_PROPERTY = "defaultPkColummValueProperty";
+
+ String getSpecifiedPkColumnValue();
+ void setSpecifiedPkColumnValue(String value);
+ String SPECIFIED_PK_COLUMN_VALUE_PROPERTY = "specifiedPkColummValueProperty";
+
+
+// EList<IUniqueConstraint> getUniqueConstraints();
+
+// IUniqueConstraint createUniqueConstraint(int index);
+
+ Schema dbSchema();
+
+ Table dbTable();
+
+
+// class UniqueConstraintOwner implements IUniqueConstraint.Owner
+// {
+// private final ITableGenerator tableGenerator;
+//
+// public UniqueConstraintOwner(ITableGenerator tableGenerator) {
+// super();
+// this.tableGenerator = tableGenerator;
+// }
+//
+// public Iterator<String> candidateUniqueConstraintColumnNames() {
+// return this.tableGenerator.dbTable().columnNames();
+// }
+// }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ITransientMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ITransientMapping.java
new file mode 100644
index 0000000000..bdc3676644
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ITransientMapping.java
@@ -0,0 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+
+public interface ITransientMapping extends IAttributeMapping
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/ITypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ITypeMapping.java
index cbc352aca4..0ddb1fed25 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/ITypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/ITypeMapping.java
@@ -7,31 +7,13 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal;
+package org.eclipse.jpt.core.internal.context.base;
import java.util.Iterator;
-import org.eclipse.jpt.core.internal.mappings.ITable;
import org.eclipse.jpt.db.internal.Schema;
import org.eclipse.jpt.db.internal.Table;
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>I Type Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.ITypeMapping#getName <em>Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.ITypeMapping#getTableName <em>Table Name</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getITypeMapping()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface ITypeMapping extends IJpaSourceObject
+public interface ITypeMapping extends IJpaContextNode
{
/**
* Return a unique key for the ITypeMapping. If this is defined in
@@ -40,36 +22,10 @@ public interface ITypeMapping extends IJpaSourceObject
*/
String getKey();
- IPersistentType getPersistentType();
+ IPersistentType persistentType();
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getITypeMapping_Name()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- String getName();
-
- /**
- * Returns the value of the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getITypeMapping_TableName()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
+ boolean isMapped();
+
String getTableName();
/**
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IVersionMapping.java
new file mode 100644
index 0000000000..9050f4b7df
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/IVersionMapping.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+
+public interface IVersionMapping extends IAttributeMapping, IColumnMapping
+{
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/InheritanceType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/InheritanceType.java
new file mode 100644
index 0000000000..8d2760760a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/InheritanceType.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 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.context.base;
+
+
+
+public enum InheritanceType {
+
+
+ SINGLE_TABLE,
+ JOINED,
+ TABLE_PER_CLASS;
+
+ public static InheritanceType fromJavaResourceModel(org.eclipse.jpt.core.internal.resource.java.InheritanceType javaInheritanceType) {
+ if (javaInheritanceType == org.eclipse.jpt.core.internal.resource.java.InheritanceType.SINGLE_TABLE) {
+ return SINGLE_TABLE;
+ }
+ else if (javaInheritanceType == org.eclipse.jpt.core.internal.resource.java.InheritanceType.JOINED) {
+ return JOINED;
+ }
+ else if (javaInheritanceType == org.eclipse.jpt.core.internal.resource.java.InheritanceType.TABLE_PER_CLASS) {
+ return TABLE_PER_CLASS;
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.core.internal.resource.java.InheritanceType toJavaResourceModel(InheritanceType inheritanceType) {
+ if (inheritanceType == SINGLE_TABLE) {
+ return org.eclipse.jpt.core.internal.resource.java.InheritanceType.SINGLE_TABLE;
+ }
+ else if (inheritanceType == JOINED) {
+ return org.eclipse.jpt.core.internal.resource.java.InheritanceType.JOINED;
+ }
+ else if (inheritanceType == TABLE_PER_CLASS) {
+ return org.eclipse.jpt.core.internal.resource.java.InheritanceType.TABLE_PER_CLASS;
+ }
+ return null;
+ }
+
+
+ public static InheritanceType fromOrmResourceModel(org.eclipse.jpt.core.internal.resource.orm.InheritanceType ormInheritanceType) {
+ if (ormInheritanceType == org.eclipse.jpt.core.internal.resource.orm.InheritanceType.SINGLE_TABLE) {
+ return SINGLE_TABLE;
+ }
+ else if (ormInheritanceType == org.eclipse.jpt.core.internal.resource.orm.InheritanceType.JOINED) {
+ return JOINED;
+ }
+ else if (ormInheritanceType == org.eclipse.jpt.core.internal.resource.orm.InheritanceType.TABLE_PER_CLASS) {
+ return TABLE_PER_CLASS;
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.core.internal.resource.orm.InheritanceType toOrmResourceModel(InheritanceType inheritanceType) {
+ if (inheritanceType == SINGLE_TABLE) {
+ return org.eclipse.jpt.core.internal.resource.orm.InheritanceType.SINGLE_TABLE;
+ }
+ else if (inheritanceType == JOINED) {
+ return org.eclipse.jpt.core.internal.resource.orm.InheritanceType.JOINED;
+ }
+ else if (inheritanceType == TABLE_PER_CLASS) {
+ return org.eclipse.jpt.core.internal.resource.orm.InheritanceType.TABLE_PER_CLASS;
+ }
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/JpaContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/JpaContextNode.java
new file mode 100644
index 0000000000..dd77ff2e0f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/JpaContextNode.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import org.eclipse.jpt.core.internal.IJpaNode;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.JpaNode;
+import org.eclipse.jpt.core.internal.SimpleTextRange;
+import org.eclipse.jpt.core.internal.context.orm.EntityMappings;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+
+public abstract class JpaContextNode extends JpaNode
+ implements IJpaContextNode
+{
+ // **************** constructor ********************************************
+
+ protected JpaContextNode(IJpaNode parent) {
+ super(parent);
+ }
+
+
+ // **************** IJpaContextNode impl ***********************************
+
+ @Override
+ protected IJpaBaseContextFactory jpaFactory() {
+ return (IJpaBaseContextFactory) super.jpaFactory();
+ }
+
+ //TODO casting to IJpaContextNode here(possible CCE).
+ /**
+ * Overidden in BaseJpaContext, Persistence, PersitsenceXml to throw UnsupportedOperationException
+ * Overidden in PersistenceUnit to return it.
+ */
+ public IPersistenceUnit persistenceUnit() {
+ return ((IJpaContextNode) parent()).persistenceUnit();
+ }
+
+ /**
+ * Overidden in BaseJpaContext to return null
+ * Overidden in EntityMappings to return it.
+ */
+ public EntityMappings entityMappings() {
+ return ((IJpaContextNode) parent()).entityMappings();
+ }
+
+ /**
+ * Overidden in BaseJpaContext to return null
+ * Overidden in XmlPersistentType to return it.
+ */
+ public XmlPersistentType xmlPersistentType() {
+ return ((IJpaContextNode) parent()).xmlPersistentType();
+ }
+
+ public ITextRange selectionTextRange() {
+ return new SimpleTextRange(0, 0, 0);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/MappingFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/MappingFileRef.java
new file mode 100644
index 0000000000..95a9ee2014
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/MappingFileRef.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.OrmXml;
+import org.eclipse.jpt.core.internal.context.orm.PersistenceUnitDefaults;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.orm.OrmArtifactEdit;
+import org.eclipse.jpt.core.internal.resource.orm.OrmResource;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+
+public class MappingFileRef extends JpaContextNode
+ implements IMappingFileRef
+{
+ protected XmlMappingFileRef xmlMappingFileRef;
+
+ protected String fileName;
+
+ protected OrmXml ormXml;
+
+ public MappingFileRef(IPersistenceUnit parent) {
+ super(parent);
+ }
+
+
+ public boolean isVirtual() {
+ return xmlMappingFileRef == null;
+ }
+
+
+ // **************** file name **********************************************
+
+ public String getFileName() {
+ return this.fileName;
+ }
+
+ public void setFileName(String newFileName) {
+ String oldFileName = this.fileName;
+ this.fileName = newFileName;
+ this.xmlMappingFileRef.setFileName(newFileName);
+ firePropertyChanged(FILE_NAME_PROPERTY, oldFileName, newFileName);
+ }
+
+ public OrmXml getOrmXml() {
+ return this.ormXml;
+ }
+
+ protected void setOrmXml(OrmXml newOrmXml) {
+ OrmXml oldOrmXml = this.ormXml;
+ this.ormXml = newOrmXml;
+ firePropertyChanged(ORM_XML_PROPERTY, oldOrmXml, newOrmXml);
+ }
+
+
+ // **************** updating ***********************************************
+
+ public void initialize(XmlMappingFileRef mappingFileRef) {
+ xmlMappingFileRef = mappingFileRef;
+ initializeFileName();
+ initializeOrmXml();
+
+ }
+
+ protected void initializeFileName() {
+ if (isVirtual()) {
+ fileName = JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH;
+ }
+ else {
+ fileName = xmlMappingFileRef.getFileName();
+ }
+ }
+
+ protected void initializeOrmXml() {
+ if (fileName != null) {
+ OrmArtifactEdit oae = OrmArtifactEdit.getArtifactEditForRead(jpaProject().project());
+ OrmResource ormResource = oae.getResource(fileName);
+
+ if (ormResource != null && ormResource.exists()) {
+ ormXml = createOrmXml(ormResource);
+ }
+ oae.dispose();
+ }
+ }
+
+ public void update(XmlMappingFileRef mappingFileRef) {
+ xmlMappingFileRef = mappingFileRef;
+ updateFileName();
+ updateOrmXml();
+
+ }
+
+ protected void updateFileName() {
+ if (isVirtual()) {
+ setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ }
+ else {
+ setFileName(xmlMappingFileRef.getFileName());
+ }
+ }
+
+ protected void updateOrmXml() {
+ if (fileName != null) {
+ OrmArtifactEdit oae = OrmArtifactEdit.getArtifactEditForRead(jpaProject().project());
+ OrmResource ormResource = oae.getResource(fileName);
+ if (ormResource != null && ormResource.exists()) {
+ if (ormXml != null) {
+ ormXml.update(ormResource);
+ }
+ else {
+ setOrmXml(createOrmXml(ormResource));
+ }
+ }
+ else {
+ setOrmXml(null);
+ }
+ oae.dispose();
+ }
+ else {
+ setOrmXml(null);
+ }
+ }
+
+ protected OrmXml createOrmXml(OrmResource ormResource) {
+ OrmXml ormXml = jpaFactory().createOrmXml(this);
+ ormXml.initialize(ormResource);
+ return ormXml;
+ }
+
+
+ // *************************************************************************
+
+ public PersistenceUnitDefaults persistenceUnitDefaults() {
+ if (getOrmXml() != null) {
+ return getOrmXml().persistenceUnitDefaults();
+ }
+ return null;
+ }
+
+ public XmlPersistentType persistentTypeFor(String fullyQualifiedTypeName) {
+ if (getOrmXml() != null) {
+ return getOrmXml().persistentTypeFor(fullyQualifiedTypeName);
+ }
+ return null;
+ }
+
+ public ITextRange validationTextRange() {
+ return this.xmlMappingFileRef.validationTextRange();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ super.toString(sb);
+ sb.append(getFileName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/Persistence.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/Persistence.java
new file mode 100644
index 0000000000..f4645e44d4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/Persistence.java
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class Persistence extends JpaContextNode
+ implements IPersistence
+{
+ protected XmlPersistence xmlPersistence;
+
+ protected final List<IPersistenceUnit> persistenceUnits;
+
+
+ public Persistence(IPersistenceXml parent) {
+ super(parent);
+ this.persistenceUnits = new ArrayList<IPersistenceUnit>();
+ }
+
+
+ // **************** persistence units **************************************
+
+ public ListIterator<IPersistenceUnit> persistenceUnits() {
+ return new CloneListIterator<IPersistenceUnit>(persistenceUnits);
+ }
+
+ public IPersistenceUnit addPersistenceUnit() {
+ return addPersistenceUnit(persistenceUnits.size());
+ }
+
+ // TODO - add better change support
+ public IPersistenceUnit addPersistenceUnit(int index) {
+ XmlPersistenceUnit xmlPersistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = createPersistenceUnit(xmlPersistenceUnit);
+ persistenceUnits.add(index, persistenceUnit);
+ xmlPersistence.getPersistenceUnits().add(xmlPersistenceUnit);
+ fireListChanged(PERSISTENCE_UNITS_LIST);
+ return persistenceUnit;
+ }
+
+ public void removePersistenceUnit(IPersistenceUnit persistenceUnit) {
+ removePersistenceUnit(persistenceUnits.indexOf(persistenceUnit));
+ }
+
+ public void removePersistenceUnit(int index) {
+ persistenceUnits.remove(index);
+ xmlPersistence.getPersistenceUnits().remove(index);
+ fireListChanged(PERSISTENCE_UNITS_LIST);
+ }
+
+ protected void addPersistenceUnit_(IPersistenceUnit persistenceUnit) {
+ addPersistenceUnit_(persistenceUnits.size(), persistenceUnit);
+ }
+
+ protected void addPersistenceUnit_(int index, IPersistenceUnit persistenceUnit) {
+ persistenceUnits.add(index, persistenceUnit);
+ fireListChanged(PERSISTENCE_UNITS_LIST);
+ }
+
+ protected void removePersistenceUnit_(IPersistenceUnit persistenceUnit) {
+ removePersistenceUnit_(persistenceUnits.indexOf(persistenceUnit));
+ }
+
+ protected void removePersistenceUnit_(int index) {
+ persistenceUnits.remove(index);
+ fireListChanged(PERSISTENCE_UNITS_LIST);
+ }
+
+
+ // **************** updating ***********************************************
+
+ public void initialize(XmlPersistence xmlPersistence) {
+ this.xmlPersistence = xmlPersistence;
+ initializePersistenceUnits(xmlPersistence);
+ }
+
+ protected void initializePersistenceUnits(XmlPersistence persistence) {
+ for (XmlPersistenceUnit xmlPersistenceUnit : persistence.getPersistenceUnits()) {
+ this.persistenceUnits.add(createPersistenceUnit(xmlPersistenceUnit));
+ }
+ }
+
+ public void update(XmlPersistence persistence) {
+ this.xmlPersistence = persistence;
+ Iterator<IPersistenceUnit> stream = persistenceUnits();
+ Iterator<XmlPersistenceUnit> stream2 = persistence.getPersistenceUnits().iterator();
+
+ while (stream.hasNext()) {
+ IPersistenceUnit persistenceUnit = stream.next();
+ if (stream2.hasNext()) {
+ persistenceUnit.update(stream2.next());
+ }
+ else {
+ removePersistenceUnit_(persistenceUnit);
+ }
+ }
+
+ while (stream2.hasNext()) {
+ addPersistenceUnit_(createPersistenceUnit(stream2.next()));
+ }
+ }
+
+ protected IPersistenceUnit createPersistenceUnit(XmlPersistenceUnit xmlPersistenceUnit) {
+ IPersistenceUnit persistenceUnit = jpaFactory().createPersistenceUnit(this);
+ persistenceUnit.initialize(xmlPersistenceUnit);
+ return persistenceUnit;
+ }
+
+
+ // *************************************************************************
+
+ @Override
+ public IPersistenceUnit persistenceUnit() {
+ throw new UnsupportedOperationException("No PersistenceUnit in this context");
+ }
+
+ public ITextRange validationTextRange() {
+ return this.xmlPersistence.validationTextRange();
+ }
+
+
+ @Override
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+
+ //persistence root validation
+ addNoPersistenceUnitMessage(messages);
+ addMultiplePersistenceUnitMessage(messages);
+
+
+ //persistence unit validation
+ for (IPersistenceUnit pu : persistenceUnits){
+ pu.addToMessages(messages, astRoot);
+ }
+ }
+
+ protected void addNoPersistenceUnitMessage(List<IMessage> messages) {
+ if (persistenceUnits.size() == 0) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.PERSISTENCE_NO_PERSISTENCE_UNIT,
+ this, this.validationTextRange())
+ );
+ }
+ }
+
+ protected void addMultiplePersistenceUnitMessage(List<IMessage> messages) {
+ if (persistenceUnits.size() > 1) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS,
+ this, this.validationTextRange())
+ );
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/PersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/PersistenceUnit.java
new file mode 100644
index 0000000000..8f430e34ab
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/PersistenceUnit.java
@@ -0,0 +1,978 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.context.base;
+
+import static org.eclipse.jpt.core.internal.context.base.PersistenceUnitTransactionType.DEFAULT;
+import static org.eclipse.jpt.core.internal.context.base.PersistenceUnitTransactionType.JTA;
+import static org.eclipse.jpt.core.internal.context.base.PersistenceUnitTransactionType.RESOURCE_LOCAL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.PersistenceUnitDefaults;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.orm.OrmArtifactEdit;
+import org.eclipse.jpt.core.internal.resource.orm.OrmResource;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnitTransactionType;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlProperties;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlProperty;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterators.ReadOnlyCompositeListIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.xml.core.internal.catalog.NextCatalog;
+
+public class PersistenceUnit extends JpaContextNode
+ implements IPersistenceUnit
+{
+ protected XmlPersistenceUnit xmlPersistenceUnit;
+
+ protected String name;
+
+ protected PersistenceUnitTransactionType transactionType;
+
+ protected PersistenceUnitTransactionType defaultTransactionType = DEFAULT;
+
+ protected String description;
+
+ protected String provider;
+
+ protected String jtaDataSource;
+
+ protected String nonJtaDataSource;
+
+ protected IMappingFileRef defaultMappingFileRef;
+
+ protected final List<IMappingFileRef> specifiedMappingFileRefs;
+
+ protected final List<IClassRef> classRefs;
+
+ protected Boolean excludeUnlistedClasses;
+
+ protected boolean defaultExcludeUnlistedClasses = false;
+
+ protected final List<IProperty> properties;
+
+ protected String defaultSchema;
+ protected String defaultCatalog;
+ protected AccessType defaultAccess;
+ protected boolean defaultCascadePersist;
+
+ public PersistenceUnit(IPersistence parent) {
+ super(parent);
+ this.transactionType = PersistenceUnitTransactionType.DEFAULT;
+ this.specifiedMappingFileRefs = new ArrayList<IMappingFileRef>();
+ this.classRefs = new ArrayList<IClassRef>();
+ this.properties = new ArrayList<IProperty>();
+ }
+
+
+ @Override
+ public IPersistenceUnit persistenceUnit() {
+ return this;
+ }
+
+
+ // **************** parent *************************************************
+
+ public IPersistence persistence() {
+ return (IPersistence) parent();
+ }
+
+ // **************** name ***************************************************
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.xmlPersistenceUnit.setName(newName);
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+
+ // **************** transaction type ***************************************
+
+ public PersistenceUnitTransactionType getTransactionType() {
+ return (isTransactionTypeDefault()) ?
+ getDefaultTransactionType() : this.transactionType;
+ }
+
+ public void setTransactionType(PersistenceUnitTransactionType newTransactionType) {
+ if (newTransactionType == null) {
+ throw new IllegalArgumentException("null");
+ }
+ PersistenceUnitTransactionType oldTransactionType = this.transactionType;
+ this.transactionType = newTransactionType;
+
+ if (this.transactionType == JTA) {
+ this.xmlPersistenceUnit.setTransactionType(XmlPersistenceUnitTransactionType.JTA);
+ }
+ else if (this.transactionType == RESOURCE_LOCAL) {
+ this.xmlPersistenceUnit.setTransactionType(XmlPersistenceUnitTransactionType.RESOURCE_LOCAL);
+ }
+ else if (this.transactionType == DEFAULT) {
+ this.xmlPersistenceUnit.unsetTransactionType();
+ }
+ else {
+ throw new IllegalArgumentException();
+ }
+
+ firePropertyChanged(TRANSACTION_TYPE_PROPERTY, oldTransactionType, newTransactionType);
+ }
+
+ public boolean isTransactionTypeDefault() {
+ return this.transactionType == DEFAULT;
+ }
+
+ public void setTransactionTypeToDefault() {
+ setTransactionType(DEFAULT);
+ }
+
+ public PersistenceUnitTransactionType getDefaultTransactionType() {
+ // 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."
+ return this.defaultTransactionType;
+ }
+
+
+ // **************** description ********************************************
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String newDescription) {
+ String oldDescription = this.description;
+ this.description = newDescription;
+ this.xmlPersistenceUnit.setDescription(newDescription);
+ firePropertyChanged(DESCRIPTION_PROPERTY, oldDescription, newDescription);
+ }
+
+
+ // **************** provider ***********************************************
+
+ public String getProvider() {
+ return this.provider;
+ }
+
+ public void setProvider(String newProvider) {
+ String oldProvider = this.provider;
+ this.provider = newProvider;
+ this.xmlPersistenceUnit.setProvider(newProvider);
+ firePropertyChanged(DESCRIPTION_PROPERTY, oldProvider, newProvider);
+ }
+
+
+ // **************** jta data source ****************************************
+
+ public String getJtaDataSource() {
+ return this.jtaDataSource;
+ }
+
+ public void setJtaDataSource(String newJtaDataSource) {
+ String oldJtaDataSource = this.jtaDataSource;
+ this.jtaDataSource = newJtaDataSource;
+ this.xmlPersistenceUnit.setJtaDataSource(newJtaDataSource);
+ firePropertyChanged(DESCRIPTION_PROPERTY, oldJtaDataSource, newJtaDataSource);
+ }
+
+
+ // **************** non-jta data source ************************************
+
+ public String getNonJtaDataSource() {
+ return this.nonJtaDataSource;
+ }
+
+ public void setNonJtaDataSource(String newNonJtaDataSource) {
+ String oldNonJtaDataSource = this.nonJtaDataSource;
+ this.nonJtaDataSource = newNonJtaDataSource;
+ this.xmlPersistenceUnit.setNonJtaDataSource(newNonJtaDataSource);
+ firePropertyChanged(DESCRIPTION_PROPERTY, oldNonJtaDataSource, newNonJtaDataSource);
+ }
+
+
+ // **************** mapping file refs **************************************
+
+ public ListIterator<IMappingFileRef> mappingFileRefs() {
+ if (defaultMappingFileRef == null) {
+ return specifiedMappingFileRefs();
+ }
+ else {
+ return new ReadOnlyCompositeListIterator<IMappingFileRef>(
+ defaultMappingFileRef, specifiedMappingFileRefs());
+ }
+ }
+
+
+ // **************** default mapping file ref *******************************
+
+ public IMappingFileRef getDefaultMappingFileRef() {
+ return defaultMappingFileRef;
+ }
+
+ public IMappingFileRef setDefaultMappingFileRef() {
+ if (defaultMappingFileRef != null) {
+ throw new IllegalStateException("The default mapping file ref is already set.");
+ }
+ IMappingFileRef mappingFileRef = createMappingFileRef(null);
+ defaultMappingFileRef = mappingFileRef;
+ firePropertyChanged(DEFAULT_MAPPING_FILE_REF_PROPERTY, null, mappingFileRef);
+ return mappingFileRef;
+ }
+
+ public void unsetDefaultMappingFileRef() {
+ if (defaultMappingFileRef == null) {
+ throw new IllegalStateException("The default mapping file ref is already unset.");
+ }
+ IMappingFileRef mappingFileRef = defaultMappingFileRef;
+ defaultMappingFileRef = null;
+ firePropertyChanged(DEFAULT_MAPPING_FILE_REF_PROPERTY, mappingFileRef, null);
+ }
+
+
+ // **************** specified mapping file refs ****************************
+
+ public ListIterator<IMappingFileRef> specifiedMappingFileRefs() {
+ return new CloneListIterator<IMappingFileRef>(specifiedMappingFileRefs);
+ }
+
+ public IMappingFileRef addSpecifiedMappingFileRef() {
+ return addSpecifiedMappingFileRef(specifiedMappingFileRefs.size());
+ }
+
+ public IMappingFileRef addSpecifiedMappingFileRef(int index) {
+ XmlMappingFileRef xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ IMappingFileRef mappingFileRef = createMappingFileRef(xmlMappingFileRef);
+ specifiedMappingFileRefs.add(index, mappingFileRef);
+ this.xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
+ fireItemAdded(SPECIFIED_MAPPING_FILE_REF_LIST, index, mappingFileRef);
+ return mappingFileRef;
+ }
+
+ public void removeSpecifiedMappingFileRef(IMappingFileRef mappingFileRef) {
+ removeSpecifiedMappingFileRef(specifiedMappingFileRefs.indexOf(mappingFileRef));
+ }
+
+ public void removeSpecifiedMappingFileRef(int index) {
+ IMappingFileRef mappingFileRefRemoved = specifiedMappingFileRefs.remove(index);
+ this.xmlPersistenceUnit.getMappingFiles().remove(index);
+ fireItemRemoved(SPECIFIED_MAPPING_FILE_REF_LIST, index, mappingFileRefRemoved);
+ }
+
+ protected void addSpecifiedMappingFileRef_(IMappingFileRef mappingFileRef) {
+ addSpecifiedMappingFileRef_(specifiedMappingFileRefs.size(), mappingFileRef);
+ }
+
+ protected void addSpecifiedMappingFileRef_(int index, IMappingFileRef mappingFileRef) {
+ addItemToList(index, mappingFileRef, specifiedMappingFileRefs, SPECIFIED_MAPPING_FILE_REF_LIST);
+ }
+
+ protected void removeSpecifiedMappingFileRef_(IMappingFileRef mappingFileRef) {
+ removeSpecifiedMappingFileRef_(specifiedMappingFileRefs.indexOf(mappingFileRef));
+ }
+
+ protected void removeSpecifiedMappingFileRef_(int index) {
+ removeItemFromList(index, specifiedMappingFileRefs, SPECIFIED_MAPPING_FILE_REF_LIST);
+ }
+
+
+ // **************** class refs *********************************************
+
+ public ListIterator<IClassRef> classRefs() {
+ return new CloneListIterator<IClassRef>(this.classRefs);
+ }
+
+ public IClassRef addClassRef() {
+ return addClassRef(this.classRefs.size());
+ }
+
+ public IClassRef addClassRef(int index) {
+ XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
+ IClassRef classRef = createClassRef(xmlClassRef);
+ this.classRefs.add(index, classRef);
+ this.xmlPersistenceUnit.getClasses().add(xmlClassRef);
+ fireItemAdded(CLASS_REF_LIST, index, classRef);
+ return classRef;
+ }
+
+ public void removeClassRef(IClassRef classRef) {
+ removeClassRef(this.classRefs.indexOf(classRef));
+ }
+
+ public void removeClassRef(int index) {
+ IClassRef classRefRemoved = this.classRefs.remove(index);
+ this.xmlPersistenceUnit.getClasses().remove(index);
+ fireItemRemoved(CLASS_REF_LIST, index, classRefRemoved);
+ }
+
+ protected void addClassRef_(IClassRef classRef) {
+ addClassRef_(this.classRefs.size(), classRef);
+ }
+
+ protected void addClassRef_(int index, IClassRef classRef) {
+ addItemToList(index, classRef, this.classRefs, CLASS_REF_LIST);
+ }
+
+ protected void removeClassRef_(IClassRef classRef) {
+ removeClassRef_(this.classRefs.indexOf(classRef));
+ }
+
+ protected void removeClassRef_(int index) {
+ removeItemFromList(index, this.classRefs, CLASS_REF_LIST);
+ }
+
+
+ // **************** exclude unlisted classes *******************************
+
+ public boolean getExcludeUnlistedClasses() {
+ return (isExcludeUnlistedClassesDefault()) ?
+ getDefaultExcludeUnlistedClasses() : this.excludeUnlistedClasses;
+ }
+
+ public void setExcludeUnlistedClasses(boolean newExcludeUnlistedClasses) {
+ setExcludeUnlistedClasses((Boolean) newExcludeUnlistedClasses);
+ }
+
+ public boolean isExcludeUnlistedClassesDefault() {
+ return this.excludeUnlistedClasses == null;
+ }
+
+ public boolean getDefaultExcludeUnlistedClasses() {
+ // TODO - calculate default
+ // This is determined from the project
+ return this.defaultExcludeUnlistedClasses;
+ }
+
+ public void setExcludeUnlistedClassesToDefault() {
+ setExcludeUnlistedClasses(null);
+ }
+
+ protected void setExcludeUnlistedClasses(Boolean newExcludeUnlistedClasses) {
+ Boolean oldExcludeUnlistedClasses = this.excludeUnlistedClasses;
+ this.excludeUnlistedClasses = newExcludeUnlistedClasses;
+
+ if (this.excludeUnlistedClasses != null) {
+ this.xmlPersistenceUnit.setExcludeUnlistedClasses(this.excludeUnlistedClasses);
+ }
+ else {
+ this.xmlPersistenceUnit.unsetExcludeUnlistedClasses();
+ }
+
+ firePropertyChanged(EXCLUDE_UNLISTED_CLASSED_PROPERTY, oldExcludeUnlistedClasses, newExcludeUnlistedClasses);
+ }
+
+
+ // **************** properties *********************************************
+
+ public ListIterator<IProperty> properties() {
+ return new CloneListIterator<IProperty>(this.properties);
+ }
+
+ public int propertiesSize() {
+ return this.properties.size();
+ }
+
+ public IProperty getProperty(String key) {
+ for(IProperty property : this.properties) {
+ if(property.getName().equals(key)) {
+ return property;
+ }
+ }
+ return null;
+ }
+
+ public IProperty getProperty(String key, String value) {
+ for(IProperty property : this.properties) {
+ if(property.getName().equals(key) && property.getValue().equals(value)) {
+ return property;
+ }
+ }
+ return null;
+ }
+
+ protected IProperty getProperty(int index) {
+ return this.properties.get(index);
+ }
+
+ protected XmlProperty getXmlProperty(String name, String value) {
+ if (this.xmlPersistenceUnit.getProperties() == null) {
+ XmlProperties xmlProperties = PersistenceFactory.eINSTANCE.createXmlProperties();
+ this.xmlPersistenceUnit.setProperties(xmlProperties);
+ }
+ for(XmlProperty xmlProperty : this.xmlPersistenceUnit.getProperties().getProperties()) {
+ if(name.equals(xmlProperty.getName()) && value.equals(xmlProperty.getValue())) {
+ return xmlProperty;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Adds or Changes Property with the given key and value.
+ */
+ public void putProperty(String key, String value, boolean allowDuplicates) {
+ if( ! allowDuplicates && this.containsProperty(key)) {
+ this.putXmlProperty(key, value, this.getProperty(key).getValue());
+ return;
+ }
+ if( value != null) {
+ XmlProperty xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
+ xmlProperty.setName(key);
+ xmlProperty.setValue(value);
+
+ this.addXmlProperty(xmlProperty);
+ return;
+ }
+ }
+
+ public void replacePropertyValue(String key, String oldValue, String newValue) {
+
+ this.putXmlProperty(key, newValue, oldValue);
+ }
+
+ protected void putXmlProperty(String key, String value, String oldValue) {
+ if( value == null) {
+ this.removeProperty(key);
+ return;
+ }
+ EList<XmlProperty> xmlProperties = this.xmlPersistenceUnit.getProperties().getProperties();
+
+ XmlProperty xmlProperty = this.getXmlProperty(key, oldValue);
+ if(xmlProperty == null) {
+ throw new NoSuchElementException("Missing Property name: " + key + ", value: " + oldValue);
+ }
+ xmlProperty.setValue(value);
+ this.setItemInList(xmlProperties.indexOf(xmlProperty), xmlProperty, xmlProperties, PROPERTIES_LIST);
+ }
+
+ public boolean containsProperty(String key) {
+ return (this.getProperty(key) != null);
+ }
+
+ public IProperty addProperty() {
+ XmlProperty xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
+
+ return this.addXmlProperty(xmlProperty);
+ }
+
+ protected IProperty addXmlProperty(XmlProperty xmlProperty) {
+
+ IProperty property = createProperty(xmlProperty);
+ int index = this.properties.size();
+ this.properties.add(index, property);
+
+ if (this.xmlPersistenceUnit.getProperties() == null) {
+ XmlProperties xmlProperties = PersistenceFactory.eINSTANCE.createXmlProperties();
+ this.xmlPersistenceUnit.setProperties(xmlProperties);
+ }
+
+ this.xmlPersistenceUnit.getProperties().getProperties().add(xmlProperty);
+ this.fireItemAdded(PROPERTIES_LIST, index, property);
+ return property;
+ }
+
+ public void removeProperty(String key) {
+ this.removeProperty(this.getProperty(key));
+ }
+
+ public void removeProperty(String key, String value) {
+ this.removeProperty(this.getProperty(key, value));
+ }
+
+ public void removeProperty(IProperty property) {
+ if (property != null) {
+ this.removeProperty(this.properties.indexOf(property));
+ }
+ }
+
+ protected void removeProperty(int index) {
+ IProperty propertyRemoved = this.properties.remove(index);
+ this.xmlPersistenceUnit.getProperties().getProperties().remove(index);
+
+ if (this.xmlPersistenceUnit.getProperties().getProperties().isEmpty()) {
+ this.xmlPersistenceUnit.setProperties(null);
+ }
+
+ fireItemRemoved(PROPERTIES_LIST, index, propertyRemoved);
+ }
+
+ protected void addProperty_(IProperty property) {
+ addProperty_(this.properties.size(), property);
+ }
+
+ protected void addProperty_(int index, IProperty property) {
+ addItemToList(index, property, this.properties, PROPERTIES_LIST);
+ }
+
+ protected void removeProperty_(IProperty property) {
+ removeProperty_(this.properties.indexOf(property));
+ }
+
+ protected void removeProperty_(int index) {
+ removeItemFromList(index, this.properties, PROPERTIES_LIST);
+ }
+
+
+ // **************** Persistence Unit Defaults *********************************************
+
+ //TODO validation for multiple persistenceUnitDefaults.
+
+ //Take the first PersistenceUnitDefaults found in an orm.xml file and use
+ //this for the defaults of the PersistenceUnit.
+ protected PersistenceUnitDefaults persistenceUnitDefaults() {
+ for (IMappingFileRef mappingFileRef : CollectionTools.iterable(mappingFileRefs())) {
+ PersistenceUnitDefaults persistenceUnitDefaults = mappingFileRef.persistenceUnitDefaults();
+ if (persistenceUnitDefaults != null) {
+ return persistenceUnitDefaults;
+ }
+ }
+ return null;
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+ protected void setDefaultSchema(String newDefaultSchema) {
+ String oldDefaultSchema = this.defaultSchema;
+ this.defaultSchema = newDefaultSchema;
+ firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, oldDefaultSchema, newDefaultSchema);
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ protected void setDefaultCatalog(String newDefaultCatalog) {
+ String oldDefaultCatalog = this.defaultCatalog;
+ this.defaultCatalog = newDefaultCatalog;
+ firePropertyChanged(DEFAULT_CATALOG_PROPERTY, oldDefaultCatalog, newDefaultCatalog);
+ }
+
+ public AccessType getDefaultAccess() {
+ return this.defaultAccess;
+ }
+
+ protected void setDefaultAccess(AccessType newDefaultAccess) {
+ AccessType oldDefaultAccess = this.defaultAccess;
+ this.defaultAccess = newDefaultAccess;
+ firePropertyChanged(DEFAULT_ACCESS_PROPERTY, oldDefaultAccess, newDefaultAccess);
+ }
+
+ public boolean getDefaultCascadePersist() {
+ return this.defaultCascadePersist;
+ }
+
+ protected void setDefaultCascadePersist(boolean newDefaultCascadePersist) {
+ boolean oldDefaultCascadePersist = this.defaultCascadePersist;
+ this.defaultCascadePersist = newDefaultCascadePersist;
+ firePropertyChanged(DEFAULT_CASCADE_PERSIST_PROPERTY, oldDefaultCascadePersist, newDefaultCascadePersist);
+ }
+
+
+ // **************** updating ***********************************************
+
+ public void initialize(XmlPersistenceUnit xmlPersistenceUnit) {
+ this.xmlPersistenceUnit = xmlPersistenceUnit;
+ this.name = xmlPersistenceUnit.getName();
+ initializeMappingFileRefs(xmlPersistenceUnit);
+ initializeClassRefs(xmlPersistenceUnit);
+ initializeProperties(xmlPersistenceUnit);
+ }
+
+ protected void initializeMappingFileRefs(XmlPersistenceUnit xmlPersistenceUnit) {
+ for (XmlMappingFileRef xmlMappingFileRef : xmlPersistenceUnit.getMappingFiles()) {
+ specifiedMappingFileRefs.add(createMappingFileRef(xmlMappingFileRef));
+ }
+ if (! defaultMappingFileIsSpecified() && defaultMappingFileExists()) {
+ defaultMappingFileRef = createMappingFileRef(null);
+ }
+ }
+
+ protected void initializeClassRefs(XmlPersistenceUnit xmlPersistenceUnit) {
+ for (XmlJavaClassRef xmlJavaClassRef : xmlPersistenceUnit.getClasses()) {
+ this.classRefs.add(createClassRef(xmlJavaClassRef));
+ }
+ }
+
+ protected void initializeProperties(XmlPersistenceUnit xmlPersistenceUnit) {
+ XmlProperties xmlProperties = xmlPersistenceUnit.getProperties();
+ if (xmlProperties == null) {
+ return;
+ }
+ for (XmlProperty xmlProperty : xmlProperties.getProperties()) {
+ this.properties.add(createProperty(xmlProperty));
+ }
+ }
+
+ protected void initializePersistenceUnitDefaults() {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ if (persistenceUnitDefaults != null) {
+ this.defaultSchema = persistenceUnitDefaults.getSchema();
+ this.defaultCatalog = persistenceUnitDefaults.getCatalog();
+ this.defaultAccess = persistenceUnitDefaults.getAccess();
+ this.defaultCascadePersist = persistenceUnitDefaults.isCascadePersist();
+ }
+ else {
+ this.defaultSchema = null;
+ this.defaultCatalog = null;
+ this.defaultAccess = null;
+ this.defaultCascadePersist = false;
+ }
+ }
+
+ public void update(XmlPersistenceUnit persistenceUnit) {
+ this.xmlPersistenceUnit = persistenceUnit;
+ updateName(persistenceUnit);
+ updateTransactionType(persistenceUnit);
+ updateDescription(persistenceUnit);
+ updateProvider(persistenceUnit);
+ updateJtaDataSource(persistenceUnit);
+ updateNonJtaDataSource(persistenceUnit);
+ updateMappingFileRefs(persistenceUnit);
+ updateClassRefs(persistenceUnit);
+ updateExcludeUnlistedClasses(persistenceUnit);
+ updateProperties(persistenceUnit);
+ updatePersistenceUnitDefaults();
+ }
+
+ protected void updateName(XmlPersistenceUnit persistenceUnit) {
+ setName(persistenceUnit.getName());
+ }
+
+ protected void updateTransactionType(XmlPersistenceUnit persistenceUnit) {
+ if (! persistenceUnit.isSetTransactionType()) {
+ setTransactionType(DEFAULT);
+ }
+ else if (persistenceUnit.getTransactionType() == XmlPersistenceUnitTransactionType.JTA) {
+ setTransactionType(JTA);
+ }
+ else if (persistenceUnit.getTransactionType() == XmlPersistenceUnitTransactionType.RESOURCE_LOCAL) {
+ setTransactionType(RESOURCE_LOCAL);
+ }
+ else {
+ throw new IllegalStateException();
+ }
+ }
+
+ protected void updateDescription(XmlPersistenceUnit persistenceUnit) {
+ setDescription(persistenceUnit.getDescription());
+ }
+
+ protected void updateProvider(XmlPersistenceUnit persistenceUnit) {
+ setProvider(persistenceUnit.getProvider());
+ }
+
+ protected void updateJtaDataSource(XmlPersistenceUnit persistenceUnit) {
+ setJtaDataSource(persistenceUnit.getJtaDataSource());
+ }
+
+ protected void updateNonJtaDataSource(XmlPersistenceUnit persistenceUnit) {
+ setNonJtaDataSource(persistenceUnit.getNonJtaDataSource());
+ }
+
+ protected void updateMappingFileRefs(XmlPersistenceUnit persistenceUnit) {
+ Iterator<IMappingFileRef> stream = specifiedMappingFileRefs();
+ Iterator<XmlMappingFileRef> stream2 = persistenceUnit.getMappingFiles().iterator();
+
+ while (stream.hasNext()) {
+ IMappingFileRef mappingFileRef = stream.next();
+ if (stream2.hasNext()) {
+ mappingFileRef.update(stream2.next());
+ }
+ else {
+ removeSpecifiedMappingFileRef_(mappingFileRef);
+ }
+ }
+
+ while (stream2.hasNext()) {
+ addSpecifiedMappingFileRef_(createMappingFileRef(stream2.next()));
+ }
+
+ if (defaultMappingFileIsSpecified()) {
+ if (defaultMappingFileRef != null) {
+ unsetDefaultMappingFileRef();
+ }
+ }
+ else {
+ if (defaultMappingFileExists()) {
+ if (defaultMappingFileRef == null) {
+ setDefaultMappingFileRef();
+ }
+ }
+ else {
+ if (defaultMappingFileRef != null) {
+ unsetDefaultMappingFileRef();
+ }
+ }
+ }
+ }
+
+ protected boolean defaultMappingFileIsSpecified() {
+ String defaultMappingFile = JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH;
+ for (IMappingFileRef each : specifiedMappingFileRefs) {
+ if (defaultMappingFile.equals(each.getFileName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected boolean defaultMappingFileExists() {
+ OrmArtifactEdit oae = OrmArtifactEdit.getArtifactEditForRead(jpaProject().project());
+ OrmResource or = oae.getResource(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ boolean exists = or != null && or.exists();
+ oae.dispose();
+ return exists;
+ }
+
+ protected IMappingFileRef createMappingFileRef(XmlMappingFileRef xmlMappingFileRef) {
+ IMappingFileRef mappingFileRef = jpaFactory().createMappingFileRef(this);
+ mappingFileRef.initialize(xmlMappingFileRef);
+ return mappingFileRef;
+ }
+
+ protected void updateClassRefs(XmlPersistenceUnit persistenceUnit) {
+ Iterator<IClassRef> stream = classRefs();
+ Iterator<XmlJavaClassRef> stream2 = persistenceUnit.getClasses().iterator();
+
+ while (stream.hasNext()) {
+ IClassRef classRef = stream.next();
+ if (stream2.hasNext()) {
+ classRef.update(stream2.next());
+ }
+ else {
+ removeClassRef_(classRef);
+ }
+ }
+
+ while (stream2.hasNext()) {
+ addClassRef_(createClassRef(stream2.next()));
+ }
+ }
+
+ protected IClassRef createClassRef(XmlJavaClassRef xmlClassRef) {
+ IClassRef classRef = jpaFactory().createClassRef(this);
+ classRef.initialize(xmlClassRef);
+ return classRef;
+ }
+
+ protected void updateExcludeUnlistedClasses(XmlPersistenceUnit persistenceUnit) {
+ if (persistenceUnit.isSetExcludeUnlistedClasses()) {
+ setExcludeUnlistedClasses(persistenceUnit.isExcludeUnlistedClasses());
+ }
+ else {
+ setExcludeUnlistedClassesToDefault();
+ }
+ }
+
+ protected void updateProperties(XmlPersistenceUnit persistenceUnit) {
+ XmlProperties xmlProperties = persistenceUnit.getProperties();
+
+ Iterator<IProperty> stream = properties();
+ Iterator<XmlProperty> stream2;
+
+ if (xmlProperties == null) {
+ stream2 = EmptyIterator.instance();
+ }
+ else {
+ stream2 = xmlProperties.getProperties().iterator();
+ }
+
+ while (stream.hasNext()) {
+ IProperty property = stream.next();
+ if (stream2.hasNext()) {
+ property.update(stream2.next());
+ }
+ else {
+ removeProperty_(property);
+ }
+ }
+
+ while (stream2.hasNext()) {
+ addProperty_(createProperty(stream2.next()));
+ }
+ }
+
+ protected IProperty createProperty(XmlProperty xmlProperty) {
+ IProperty property = jpaFactory().createProperty(this);
+ property.initialize(xmlProperty);
+ return property;
+ }
+
+ protected void updatePersistenceUnitDefaults() {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ this.setDefaultSchema(this.schema(persistenceUnitDefaults));
+ this.setDefaultCatalog(this.catalog(persistenceUnitDefaults));
+ this.setDefaultAccess(this.access(persistenceUnitDefaults));
+ this.setDefaultCascadePersist(this.cascadePersist(persistenceUnitDefaults));
+ }
+
+ protected String schema(PersistenceUnitDefaults persistenceUnitDefaults) {
+ if (persistenceUnitDefaults == null) {
+ return null;
+ }
+ if (persistenceUnitDefaults.getSchema() != null) {
+ return persistenceUnitDefaults.getSchema();
+ }
+ Schema projectDefaultSchema = projectDefaultSchema();
+ return projectDefaultSchema == null ? null : projectDefaultSchema.getName();
+ }
+
+ protected Schema projectDefaultSchema() {
+ return jpaProject().defaultSchema();
+ }
+
+ protected String catalog(PersistenceUnitDefaults persistenceUnitDefaults) {
+ if (persistenceUnitDefaults == null) {
+ return null;
+ }
+ if (persistenceUnitDefaults.getCatalog() != null) {
+ return persistenceUnitDefaults.getCatalog();
+ }
+ String catalog = projectDefaultCatalog();
+ //the context model uses nulls for defaults that don't exist. currently
+ //the DB model is using "" to represent no catalog, changing this here
+ if (catalog == "") {
+ catalog = null;
+ }
+ return catalog;
+ }
+
+ protected String projectDefaultCatalog() {
+ return jpaProject().connectionProfile().getCatalogName();
+ }
+
+ protected AccessType access(PersistenceUnitDefaults persistenceUnitDefaults) {
+ return persistenceUnitDefaults == null ? null : persistenceUnitDefaults.getAccess();
+ }
+
+ protected boolean cascadePersist(PersistenceUnitDefaults persistenceUnitDefaults) {
+ return persistenceUnitDefaults == null ? false : persistenceUnitDefaults.isCascadePersist();
+ }
+ // *************************************************************************
+
+ // ********** Validation ***********************************************
+
+ @Override
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+
+ addMappingFileMessages(messages, astRoot);
+ addClassMessages(messages, astRoot);
+ }
+
+ protected void addMappingFileMessages(List<IMessage> messages, CompilationUnit astRoot) {
+// addMultipleMetadataMessages(messages);
+// addUnspecifiedMappingFileMessages(messages);
+// addUnresolvedMappingFileMessages(messages);
+// addInvalidMappingFileContentMessage(messages);
+// addDuplicateMappingFileMessages(messages);
+
+ for (Iterator<IMappingFileRef> stream = mappingFileRefs(); stream.hasNext();) {
+ stream.next().addToMessages(messages, astRoot);
+ }
+ }
+
+ protected void addClassMessages(List<IMessage> messages, CompilationUnit astRoot) {
+// addUnspecifiedClassMessages(messages);
+ addUnresolvedClassMessages(messages);
+// addInvalidClassContentMessages(messages);
+// addDuplicateClassMessages(messages);
+
+ //need to have support for non-annotated mode
+ //can't just go down the class-ref list
+ //also need to think about
+
+ for (IClassRef classRef : classRefs) {
+ //temporary
+ classRef.addToMessages(messages, astRoot);
+ }
+ }
+
+ protected void addUnresolvedClassMessages(List<IMessage> messages) {
+ for (IClassRef javaClassRef : this.classRefs) {
+ String javaClass = javaClassRef.getClassName();
+ if (! StringTools.stringIsEmpty(javaClass) && javaClassRef.getJavaPersistentType() == null) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.PERSISTENCE_UNIT_NONEXISTENT_CLASS,
+ new String[] {javaClass},
+ javaClassRef, javaClassRef.validationTextRange())
+ );
+ }
+ }
+ }
+
+// protected void addDuplicateClassMessages(List<IMessage> messages) {
+// HashBag<String> classNameBag = this.classNameBag();
+// for (JavaClassRef javaClassRef : persistenceUnit.getClasses()) {
+// if (javaClassRef.getJavaClass() != null
+// && classNameBag.count(javaClassRef.getJavaClass()) > 1) {
+// messages.add(
+// JpaValidationMessages.buildMessage(
+// IMessage.HIGH_SEVERITY,
+// IJpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_CLASS,
+// new String[] {javaClassRef.getJavaClass()},
+// javaClassRef, javaClassRef.validationTextRange())
+// );
+// }
+// }
+// }
+
+
+ //*************************************
+
+ public IPersistentType persistentType(String fullyQualifiedTypeName) {
+ for (IMappingFileRef mappingFileRef : CollectionTools.iterable(mappingFileRefs())) {
+ XmlPersistentType xmlPersistentType = mappingFileRef.persistentTypeFor(fullyQualifiedTypeName);
+ if (xmlPersistentType != null) {
+ return xmlPersistentType;
+ }
+ }
+ for (IClassRef classRef : CollectionTools.iterable(classRefs())) {
+ if (classRef.isFor(fullyQualifiedTypeName)) {
+ return classRef.getJavaPersistentType();
+ }
+ }
+ return null;
+ }
+
+ public ITextRange validationTextRange() {
+ return this.xmlPersistenceUnit.validationTextRange();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ super.toString(sb);
+ sb.append(getName());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/PersistenceUnitTransactionType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/PersistenceUnitTransactionType.java
new file mode 100644
index 0000000000..72ca93d6f6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/PersistenceUnitTransactionType.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+public enum PersistenceUnitTransactionType
+{
+ /** Corresponds to JTA transaction type **/
+ JTA,
+
+ /** Corresponds to RESOURCE_LOCAL transaction type **/
+ RESOURCE_LOCAL,
+
+ /** Corresponds to default transaction type **/
+ DEFAULT;
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/PersistenceXml.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/PersistenceXml.java
new file mode 100644
index 0000000000..ab8e4e4117
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/PersistenceXml.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.base;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResource;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class PersistenceXml extends JpaContextNode
+ implements IPersistenceXml
+{
+ protected PersistenceResource persistenceResource;
+
+ protected IPersistence persistence;
+
+
+ public PersistenceXml(IBaseJpaContent baseJpaContent) {
+ super(baseJpaContent);
+ }
+
+ @Override
+ public IResource resource() {
+ return persistenceResource.getFile();
+ }
+
+ // **************** persistence ********************************************
+
+ public IPersistence getPersistence() {
+ return persistence;
+ }
+
+ public IPersistence addPersistence() {
+ if (persistence != null) {
+ throw new IllegalStateException();
+ }
+
+ XmlPersistence xmlPersistence = PersistenceFactory.eINSTANCE.createXmlPersistence();
+ persistence = createPersistence(xmlPersistence);
+ persistenceResource.getContents().add(xmlPersistence);
+ firePropertyChanged(PERSISTENCE_PROPERTY, null, persistence);
+ return persistence;
+ }
+
+ public void removePersistence() {
+ if (persistence == null) {
+ throw new IllegalStateException();
+ }
+
+ IPersistence oldPersistence = persistence;
+ persistence = null;
+ XmlPersistence xmlPersistence = persistenceResource.getPersistence();
+ persistenceResource.getContents().remove(xmlPersistence);
+ firePropertyChanged(PERSISTENCE_PROPERTY, oldPersistence, null);
+ }
+
+ protected void setPersistence_(IPersistence newPersistence) {
+ IPersistence oldPersistence = persistence;
+ persistence = newPersistence;
+ firePropertyChanged(PERSISTENCE_PROPERTY, oldPersistence, newPersistence);
+ }
+
+
+ // **************** updating ***********************************************
+
+ public void initialize(PersistenceResource persistenceResource) {
+ this.persistenceResource = persistenceResource;
+ if (persistenceResource.getPersistence() != null) {
+ this.persistence = createPersistence(persistenceResource.getPersistence());
+ }
+ }
+
+ public void update(PersistenceResource persistenceResource) {
+ if (! persistenceResource.equals(this.persistenceResource)) {
+ this.persistenceResource = persistenceResource;
+ this.persistenceResource.resourceModel().removeRootContextNode(this);
+ }
+ if (persistenceResource.getPersistence() != null) {
+ if (this.persistence != null) {
+ this.persistence.update(persistenceResource.getPersistence());
+ }
+ else {
+ setPersistence_(createPersistence(persistenceResource.getPersistence()));
+ }
+ persistenceResource.resourceModel().addRootContextNode(getPersistence());
+ }
+ else {
+ setPersistence_(null);
+ }
+ }
+
+ protected IPersistence createPersistence(XmlPersistence xmlPersistence) {
+ IPersistence persistence = jpaFactory().createPersistence(this);
+ persistence.initialize(xmlPersistence);
+ return persistence;
+ }
+
+
+ // *************************************************************************
+
+ @Override
+ public IPersistenceUnit persistenceUnit() {
+ throw new UnsupportedOperationException("No PersistenceUnit in this context");
+ }
+
+ public ITextRange validationTextRange() {
+ return ITextRange.Empty.instance();
+ }
+
+
+ @Override
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+
+// addInvalidPersistenceXmlContentMessage(messages);
+
+ getPersistence().addToMessages(messages, astRoot);
+
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/Property.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/Property.java
new file mode 100644
index 0000000000..a4702aab98
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/Property.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.context.base;
+
+import org.eclipse.jpt.core.internal.resource.persistence.XmlProperty;
+
+
+public class Property extends JpaContextNode
+ implements IProperty
+{
+ protected String name;
+
+ protected String value;
+
+
+ public Property(IPersistenceUnit parent) {
+ super(parent);
+ }
+
+ // **************** name ***************************************************
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String newName) {
+ String oldName = name;
+ name = newName;
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+
+ // **************** value **************************************************
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String newValue) {
+ String oldValue = value;
+ value = newValue;
+ firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
+ }
+
+
+ // **************** updating ***********************************************
+
+ public void initialize(XmlProperty property) {
+ name = property.getName();
+ value = property.getValue();
+ }
+
+ public void update(XmlProperty property) {
+ setName(property.getName());
+ setValue(property.getValue());
+ }
+
+
+ // **************** toString
+ @Override
+ public void toString(StringBuilder sb)
+ {
+ sb.append(" (name: ");
+ sb.append(name);
+ sb.append(", value: ");
+ sb.append(value);
+ sb.append(')');
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/RelationshipMappingTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/RelationshipMappingTools.java
index 2d4be328fe..2c6d944b1a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/RelationshipMappingTools.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/RelationshipMappingTools.java
@@ -7,7 +7,7 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.mappings;
+package org.eclipse.jpt.core.internal.context.base;
import java.util.StringTokenizer;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/TemporalType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/TemporalType.java
new file mode 100644
index 0000000000..ec4d21a351
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/base/TemporalType.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 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.context.base;
+
+
+public enum TemporalType {
+
+ DATE,
+ TIME,
+ TIMESTAMP;
+
+
+ public static TemporalType fromJavaResourceModel(org.eclipse.jpt.core.internal.resource.java.TemporalType javaTemporalType) {
+ if (javaTemporalType == org.eclipse.jpt.core.internal.resource.java.TemporalType.DATE) {
+ return DATE;
+ }
+ else if (javaTemporalType == org.eclipse.jpt.core.internal.resource.java.TemporalType.TIME) {
+ return TIME;
+ }
+ else if (javaTemporalType == org.eclipse.jpt.core.internal.resource.java.TemporalType.TIMESTAMP) {
+ return TIMESTAMP;
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.core.internal.resource.java.TemporalType toJavaResourceModel(TemporalType temporalType) {
+ if (temporalType == DATE) {
+ return org.eclipse.jpt.core.internal.resource.java.TemporalType.DATE;
+ }
+ else if (temporalType == TIME) {
+ return org.eclipse.jpt.core.internal.resource.java.TemporalType.TIME;
+ }
+ else if (temporalType == TIMESTAMP) {
+ return org.eclipse.jpt.core.internal.resource.java.TemporalType.TIMESTAMP;
+ }
+ return null;
+ }
+
+
+ public static TemporalType fromOrmResourceModel(org.eclipse.jpt.core.internal.resource.orm.TemporalType ormTemporalType) {
+ if (ormTemporalType == org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE) {
+ return DATE;
+ }
+ else if (ormTemporalType == org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME) {
+ return TIME;
+ }
+ else if (ormTemporalType == org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP) {
+ return TIMESTAMP;
+ }
+ return null;
+ }
+
+ public static org.eclipse.jpt.core.internal.resource.orm.TemporalType toOrmResourceModel(TemporalType temporalType) {
+ if (temporalType == DATE) {
+ return org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE;
+ }
+ else if (temporalType == TIME) {
+ return org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME;
+ }
+ else if (temporalType == TIMESTAMP) {
+ return org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP;
+ }
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaColumn.java
new file mode 100644
index 0000000000..99566f0a81
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaColumn.java
@@ -0,0 +1,299 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAbstractColumn;
+import org.eclipse.jpt.core.internal.resource.java.AbstractColumn;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+
+public abstract class AbstractJavaColumn<T extends AbstractColumn> extends JavaNamedColumn<T>
+ implements IAbstractColumn
+{
+
+ protected String specifiedTable;
+
+ protected String defaultTable;
+
+ protected Boolean specifiedUnique;
+
+ protected Boolean specifiedNullable;
+
+ protected Boolean specifiedInsertable;
+
+ protected Boolean specifiedUpdatable;
+
+ protected AbstractJavaColumn(IJavaJpaContextNode parent, IAbstractColumn.Owner owner) {
+ super(parent, owner);
+ }
+
+ @Override
+ protected void initializeFromResource(T column) {
+ super.initializeFromResource(column);
+ this.defaultTable = this.defaultTable();
+ this.specifiedTable = this.specifiedTable(column);
+ this.specifiedUnique = this.specifiedUnique(column);
+ this.specifiedNullable = this.specifiedNullable(column);
+ this.specifiedInsertable = this.specifiedInsertable(column);
+ this.specifiedUpdatable = this.specifiedUpdatable(column);
+ }
+
+ @Override
+ public IAbstractColumn.Owner owner() {
+ return (IAbstractColumn.Owner) super.owner();
+ }
+
+ //************** IAbstractColumn implementation *******************
+
+
+ public String getTable() {
+ return (this.getSpecifiedTable() == null) ? getDefaultTable() : this.getSpecifiedTable();
+ }
+
+ public String getSpecifiedTable() {
+ return this.specifiedTable;
+ }
+
+ public void setSpecifiedTable(String newSpecifiedTable) {
+ String oldSpecifiedTable = this.specifiedTable;
+ this.specifiedTable = newSpecifiedTable;
+ columnResource().setTable(newSpecifiedTable);
+ firePropertyChanged(IAbstractColumn.SPECIFIED_TABLE_PROPERTY, oldSpecifiedTable, newSpecifiedTable);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedTable_(String newSpecifiedTable) {
+ String oldSpecifiedTable = this.specifiedTable;
+ this.specifiedTable = newSpecifiedTable;
+ firePropertyChanged(IAbstractColumn.SPECIFIED_TABLE_PROPERTY, oldSpecifiedTable, newSpecifiedTable);
+ }
+
+ public String getDefaultTable() {
+ return this.defaultTable;
+ }
+
+ protected void setDefaultTable(String newDefaultTable) {
+ String oldDefaultTable = this.defaultTable;
+ this.defaultTable = newDefaultTable;
+ firePropertyChanged(IAbstractColumn.DEFAULT_TABLE_PROPERTY, oldDefaultTable, newDefaultTable);
+ }
+
+ public Boolean getUnique() {
+ return (this.getSpecifiedUnique() == null) ? this.getDefaultUnique() : this.getSpecifiedUnique();
+ }
+
+ public Boolean getDefaultUnique() {
+ return IAbstractColumn.DEFAULT_UNIQUE;
+ }
+
+ public Boolean getSpecifiedUnique() {
+ return this.specifiedUnique;
+ }
+
+ public void setSpecifiedUnique(Boolean newSpecifiedUnique) {
+ Boolean oldSpecifiedUnique = this.specifiedUnique;
+ this.specifiedUnique = newSpecifiedUnique;
+ this.columnResource().setUnique(newSpecifiedUnique);
+ firePropertyChanged(IAbstractColumn.SPECIFIED_UNIQUE_PROPERTY, oldSpecifiedUnique, newSpecifiedUnique);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedUnique_(Boolean newSpecifiedUnique) {
+ Boolean oldSpecifiedUnique = this.specifiedUnique;
+ this.specifiedUnique = newSpecifiedUnique;
+ firePropertyChanged(IAbstractColumn.SPECIFIED_UNIQUE_PROPERTY, oldSpecifiedUnique, newSpecifiedUnique);
+ }
+
+ public Boolean getNullable() {
+ return (this.getSpecifiedNullable() == null) ? this.getDefaultNullable() : this.getSpecifiedNullable();
+ }
+
+ public Boolean getDefaultNullable() {
+ return IAbstractColumn.DEFAULT_NULLABLE;
+ }
+
+ public Boolean getSpecifiedNullable() {
+ return this.specifiedNullable;
+ }
+
+ public void setSpecifiedNullable(Boolean newSpecifiedNullable) {
+ Boolean oldSpecifiedNullable = this.specifiedNullable;
+ this.specifiedNullable = newSpecifiedNullable;
+ this.columnResource().setNullable(newSpecifiedNullable);
+ firePropertyChanged(IAbstractColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedNullable_(Boolean newSpecifiedNullable) {
+ Boolean oldSpecifiedNullable = this.specifiedNullable;
+ this.specifiedNullable = newSpecifiedNullable;
+ firePropertyChanged(IAbstractColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable);
+ }
+
+ public Boolean getInsertable() {
+ return (this.getSpecifiedInsertable() == null) ? this.getDefaultInsertable() : this.getSpecifiedInsertable();
+ }
+
+ public Boolean getDefaultInsertable() {
+ return IAbstractColumn.DEFAULT_INSERTABLE;
+ }
+
+ public Boolean getSpecifiedInsertable() {
+ return this.specifiedInsertable;
+ }
+
+ public void setSpecifiedInsertable(Boolean newSpecifiedInsertable) {
+ Boolean oldSpecifiedInsertable = this.specifiedInsertable;
+ this.specifiedInsertable = newSpecifiedInsertable;
+ this.columnResource().setInsertable(newSpecifiedInsertable);
+ firePropertyChanged(IAbstractColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedInsertable_(Boolean newSpecifiedInsertable) {
+ Boolean oldSpecifiedInsertable = this.specifiedInsertable;
+ this.specifiedInsertable = newSpecifiedInsertable;
+ firePropertyChanged(IAbstractColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable);
+ }
+
+ public Boolean getUpdatable() {
+ return (this.getSpecifiedUpdatable() == null) ? this.getDefaultUpdatable() : this.getSpecifiedUpdatable();
+ }
+
+ public Boolean getDefaultUpdatable() {
+ return IAbstractColumn.DEFAULT_UPDATABLE;
+ }
+
+ public Boolean getSpecifiedUpdatable() {
+ return this.specifiedUpdatable;
+ }
+
+ public void setSpecifiedUpdatable(Boolean newSpecifiedUpdatable) {
+ Boolean oldSpecifiedUpdatable = this.specifiedUpdatable;
+ this.specifiedUpdatable = newSpecifiedUpdatable;
+ this.columnResource().setUpdatable(newSpecifiedUpdatable);
+ firePropertyChanged(IAbstractColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedUpdatable_(Boolean newSpecifiedUpdatable) {
+ Boolean oldSpecifiedUpdatable = this.specifiedUpdatable;
+ this.specifiedUpdatable = newSpecifiedUpdatable;
+ firePropertyChanged(IAbstractColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable);
+ }
+
+ @Override
+ protected String tableName() {
+ return this.getTable();
+ }
+
+ public ITextRange tableTextRange(CompilationUnit astRoot) {
+ return columnResource().tableTextRange(astRoot);
+ }
+
+ public boolean tableTouches(int pos, CompilationUnit astRoot) {
+ return columnResource().tableTouches(pos, astRoot);
+ }
+
+ private Iterator<String> candidateTableNames() {
+ return this.tableIsAllowed() ? this.owner().typeMapping().associatedTableNamesIncludingInherited() : EmptyIterator.<String> instance();
+ }
+
+ private Iterator<String> candidateTableNames(Filter<String> filter) {
+ return new FilteringIterator<String, String>(this.candidateTableNames(), filter);
+ }
+
+ private Iterator<String> quotedCandidateTableNames(Filter<String> filter) {
+ return StringTools.quote(this.candidateTableNames(filter));
+ }
+
+ /**
+ * Return whether the 'table' element is allowed. It is not allowed for
+ * join columns inside of join tables.
+ */
+ public abstract boolean tableIsAllowed();
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.tableTouches(pos, astRoot)) {
+ return this.quotedCandidateTableNames(filter);
+ }
+ return null;
+ }
+
+ @Override
+ protected void update(T column) {
+ super.update(column);
+ this.setDefaultTable(this.defaultTable());
+ this.setSpecifiedTable_(this.specifiedTable(column));
+ this.setSpecifiedUnique_(this.specifiedUnique(column));
+ this.setSpecifiedNullable_(this.specifiedNullable(column));
+ this.setSpecifiedInsertable_(this.specifiedInsertable(column));
+ this.setSpecifiedUpdatable_(this.specifiedUpdatable(column));
+ }
+
+ protected String defaultTable() {
+ return this.owner().defaultTableName();
+ }
+
+ protected String specifiedTable(AbstractColumn column) {
+ return column.getTable();
+ }
+
+ protected Boolean specifiedUnique(AbstractColumn column) {
+ return column.getUnique();
+ }
+
+ protected Boolean specifiedNullable(AbstractColumn column) {
+ return column.getNullable();
+ }
+
+ protected Boolean specifiedInsertable(AbstractColumn column) {
+ return column.getInsertable();
+ }
+
+ protected Boolean specifiedUpdatable(AbstractColumn column) {
+ return column.getUpdatable();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaQuery.java
new file mode 100644
index 0000000000..0e67e969ce
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaQuery.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IQuery;
+import org.eclipse.jpt.core.internal.resource.java.Query;
+import org.eclipse.jpt.core.internal.resource.java.QueryHint;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+
+public abstract class AbstractJavaQuery<E extends Query> extends JavaContextModel implements IJavaQuery<E>
+{
+ protected String name;
+
+ protected String query;
+
+ protected final List<IJavaQueryHint> hints;
+
+ protected E queryResource;
+
+ protected AbstractJavaQuery(IJavaJpaContextNode parent) {
+ super(parent);
+ this.hints = new ArrayList<IJavaQueryHint>();
+ }
+
+ protected E query() {
+ return this.queryResource;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.queryResource.setName(newName);
+ firePropertyChanged(IQuery.NAME_PROPERTY, oldName, newName);
+ }
+
+ public String getQuery() {
+ return this.query;
+ }
+
+ public void setQuery(String newQuery) {
+ String oldQuery = this.query;
+ this.query = newQuery;
+ this.queryResource.setQuery(newQuery);
+ firePropertyChanged(IQuery.QUERY_PROPERTY, oldQuery, newQuery);
+ }
+
+ public ListIterator<IJavaQueryHint> hints() {
+ return new CloneListIterator<IJavaQueryHint>(this.hints);
+ }
+
+ public int hintsSize() {
+ return this.hints.size();
+ }
+
+ public IJavaQueryHint addHint(int index) {
+ IJavaQueryHint hint = jpaFactory().createJavaQueryHint(this);
+ this.hints.add(index, hint);
+ this.query().addHint(index);
+ this.fireItemAdded(IQuery.HINTS_LIST, index, hint);
+ return hint;
+ }
+
+ protected void addHint(int index, IJavaQueryHint hint) {
+ addItemToList(index, hint, this.hints, IQuery.HINTS_LIST);
+ }
+
+ public void removeHint(int index) {
+ IJavaQueryHint removedHint = this.hints.remove(index);
+ this.query().removeHint(index);
+ fireItemRemoved(IQuery.HINTS_LIST, index, removedHint);
+ }
+
+ protected void removeHint(IJavaQueryHint hint) {
+ removeItemFromList(hint, this.hints, IQuery.HINTS_LIST);
+ }
+
+ public void moveHint(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.hints, targetIndex, sourceIndex);
+ this.query().moveHint(targetIndex, sourceIndex);
+ fireItemMoved(IQuery.HINTS_LIST, targetIndex, sourceIndex);
+ }
+
+ public void initializeFromResource(E queryResource) {
+ this.queryResource = queryResource;
+ this.name = queryResource.getName();
+ this.query = queryResource.getQuery();
+ this.initializeQueryHints(queryResource);
+ }
+
+ public void update(E queryResource) {
+ this.queryResource = queryResource;
+ this.setName(queryResource.getName());
+ this.setQuery(queryResource.getQuery());
+ this.updateQueryHints(queryResource);
+ }
+
+ protected void initializeQueryHints(E queryResource) {
+ ListIterator<QueryHint> annotations = queryResource.hints();
+
+ while(annotations.hasNext()) {
+ this.hints.add(createQueryHint(annotations.next()));
+ }
+ }
+ protected void updateQueryHints(E queryResource) {
+ ListIterator<IJavaQueryHint> hints = hints();
+ ListIterator<QueryHint> resourceHints = queryResource.hints();
+
+ while (hints.hasNext()) {
+ IJavaQueryHint hint = hints.next();
+ if (resourceHints.hasNext()) {
+ hint.update(resourceHints.next());
+ }
+ else {
+ removeHint(hint);
+ }
+ }
+
+ while (resourceHints.hasNext()) {
+ addHint(hintsSize(), createQueryHint(resourceHints.next()));
+ }
+ }
+
+ protected IJavaQueryHint createQueryHint(QueryHint hintResource) {
+ IJavaQueryHint queryHint = jpaFactory().createJavaQueryHint(this);
+ queryHint.initializeFromResource(hintResource);
+ return queryHint;
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java
new file mode 100644
index 0000000000..401ba1dfdc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java
@@ -0,0 +1,396 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.ITable;
+import org.eclipse.jpt.core.internal.resource.java.Table;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.NameTools;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+
+public abstract class AbstractJavaTable extends JavaContextModel
+{
+
+ protected String specifiedName;
+ protected String defaultName;
+
+ protected String specifiedCatalog;
+ protected String defaultCatalog;
+
+ protected String specifiedSchema;
+ protected String defaultSchema;
+
+// protected EList<IUniqueConstraint> uniqueConstraints;
+
+
+ protected AbstractJavaTable(IJavaJpaContextNode parent) {
+ super(parent);
+ }
+
+ protected void initializeFromResource(Table table) {
+ this.defaultName = this.defaultName();
+ this.defaultSchema = this.defaultSchema();
+ this.defaultCatalog = this.defaultCatalog();
+ this.specifiedName = table.getName();
+ this.specifiedSchema = table.getSchema();
+ this.specifiedCatalog = table.getCatalog();
+ }
+
+ protected abstract Table tableResource();
+
+ protected abstract String annotationName();
+
+ public String getName() {
+ return (this.getSpecifiedName() == null) ? getDefaultName() : this.getSpecifiedName();
+ }
+
+ public String getSpecifiedName() {
+ return this.specifiedName;
+ }
+
+ public void setSpecifiedName(String newSpecifiedName) {
+ String oldSpecifiedName = this.specifiedName;
+ this.specifiedName = newSpecifiedName;
+ tableResource().setName(newSpecifiedName);
+ firePropertyChanged(ITable.SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedName_(String newSpecifiedName) {
+ String oldSpecifiedName = this.specifiedName;
+ this.specifiedName = newSpecifiedName;
+ firePropertyChanged(ITable.SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
+ }
+
+ public String getDefaultName() {
+ return this.defaultName;
+ }
+
+ public String getCatalog() {
+ return (this.getSpecifiedCatalog() == null) ? getDefaultCatalog() : this.getSpecifiedCatalog();
+ }
+
+ public String getSpecifiedCatalog() {
+ return this.specifiedCatalog;
+ }
+
+ public void setSpecifiedCatalog(String newSpecifiedCatalog) {
+ String oldSpecifiedCatalog = this.specifiedCatalog;
+ this.specifiedCatalog = newSpecifiedCatalog;
+ tableResource().setCatalog(newSpecifiedCatalog);
+ firePropertyChanged(ITable.SPECIFIED_CATALOG_PROPERTY, oldSpecifiedCatalog, newSpecifiedCatalog);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedCatalog_(String newSpecifiedCatalog) {
+ String oldSpecifiedCatalog = this.specifiedCatalog;
+ this.specifiedCatalog = newSpecifiedCatalog;
+ firePropertyChanged(ITable.SPECIFIED_CATALOG_PROPERTY, oldSpecifiedCatalog, newSpecifiedCatalog);
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ public String getSchema() {
+ return (this.getSpecifiedSchema() == null) ? getDefaultSchema() : this.getSpecifiedSchema();
+ }
+
+ public String getSpecifiedSchema() {
+ return this.specifiedSchema;
+ }
+
+ public void setSpecifiedSchema(String newSpecifiedSchema) {
+ String oldSpecifiedSchema = this.specifiedSchema;
+ this.specifiedSchema = newSpecifiedSchema;
+ tableResource().setSchema(newSpecifiedSchema);
+ firePropertyChanged(ITable.SPECIFIED_SCHEMA_PROPERTY, oldSpecifiedSchema, newSpecifiedSchema);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedSchema_(String newSpecifiedSchema) {
+ String oldSpecifiedSchema = this.specifiedSchema;
+ this.specifiedSchema = newSpecifiedSchema;
+ firePropertyChanged(ITable.SPECIFIED_SCHEMA_PROPERTY, oldSpecifiedSchema, newSpecifiedSchema);
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+// public EList<IUniqueConstraint> getUniqueConstraints() {
+// if (uniqueConstraints == null) {
+// uniqueConstraints = new EObjectContainmentEList<IUniqueConstraint>(IUniqueConstraint.class, this, JpaJavaMappingsPackage.ABSTRACT_JAVA_TABLE__UNIQUE_CONSTRAINTS);
+// }
+// return uniqueConstraints;
+// }
+
+
+
+ // ********** ITable implementation **********
+
+ public ITextRange nameTextRange(CompilationUnit astRoot) {
+ ITextRange textRange = tableResource().nameTextRange(astRoot);
+ return (textRange != null) ? textRange : this.parent().validationTextRange(astRoot);
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return tableResource().nameTouches(pos, astRoot);
+ }
+
+ public ITextRange schemaTextRange(CompilationUnit astRoot) {
+ ITextRange textRange = tableResource().schemaTextRange(astRoot);
+ return (textRange != null) ? textRange : this.parent().validationTextRange(astRoot);
+ }
+
+ public boolean schemaTouches(int pos, CompilationUnit astRoot) {
+ return tableResource().schemaTouches(pos, astRoot);
+ }
+
+ public ITextRange catalogTextRange(CompilationUnit astRoot) {
+ return tableResource().catalogTextRange(astRoot);
+ }
+
+ public boolean catalogTouches(int pos, CompilationUnit astRoot) {
+ return tableResource().catalogTouches(pos, astRoot);
+ }
+
+ protected void setDefaultName(String newDefaultName) {
+ String oldDefaultName = this.defaultName;
+ this.defaultName = newDefaultName;
+ firePropertyChanged(ITable.DEFAULT_NAME_PROPERTY, oldDefaultName, newDefaultName);
+ }
+
+ protected void setDefaultCatalog(String newDefaultCatalog) {
+ String oldDefaultCatalog = this.defaultCatalog;
+ this.defaultCatalog = newDefaultCatalog;
+ firePropertyChanged(ITable.DEFAULT_CATALOG_PROPERTY, oldDefaultCatalog, newDefaultCatalog);
+ }
+
+ protected void setDefaultSchema(String newDefaultSchema) {
+ String oldDefaultSchema = this.defaultSchema;
+ this.defaultSchema = newDefaultSchema;
+ firePropertyChanged(ITable.DEFAULT_SCHEMA_PROPERTY, oldDefaultSchema, newDefaultSchema);
+ }
+
+// public IUniqueConstraint createUniqueConstraint(int index) {
+// return createJavaUniqueConstraint(index);
+// }
+//
+// protected abstract JavaUniqueConstraint createJavaUniqueConstraint(int index);
+
+
+
+ protected void update(Table table) {
+ this.setSpecifiedName_(table.getName());
+ this.setSpecifiedSchema_(table.getSchema());
+ this.setSpecifiedCatalog_(table.getCatalog());
+ this.setDefaultName(this.defaultName());
+ this.setDefaultSchema(this.defaultSchema());
+ this.setDefaultCatalog(this.defaultCatalog());
+ //this.updateUniqueConstraints(table);
+ }
+
+ protected abstract String defaultName();
+
+ protected String defaultSchema() {
+ if (entityMappings() != null) {
+ return entityMappings().getSchema();
+ }
+ return persistenceUnit().getDefaultSchema();
+ }
+
+ protected String defaultCatalog() {
+ if (entityMappings() != null) {
+ return entityMappings().getCatalog();
+ }
+ return persistenceUnit().getDefaultCatalog();
+ }
+
+
+// /**
+// * here we just worry about getting the unique constraints lists the same size;
+// * then we delegate to the unique constraints to synch themselves up
+// */
+// private void updateUniqueConstraintsFromJava(CompilationUnit astRoot) {
+// // synchronize the model join columns with the Java source
+// List<IUniqueConstraint> constraints = this.getUniqueConstraints();
+// int persSize = constraints.size();
+// int javaSize = 0;
+// boolean allJavaAnnotationsFound = false;
+// for (int i = 0; i < persSize; i++) {
+// JavaUniqueConstraint uniqueConstraint = (JavaUniqueConstraint) constraints.get(i);
+// if (uniqueConstraint.annotation(astRoot) == null) {
+// allJavaAnnotationsFound = true;
+// break; // no need to go any further
+// }
+// uniqueConstraint.updateFromJava(astRoot);
+// javaSize++;
+// }
+// if (allJavaAnnotationsFound) {
+// // remove any model join columns beyond those that correspond to the Java annotations
+// while (persSize > javaSize) {
+// persSize--;
+// constraints.remove(persSize);
+// }
+// }
+// else {
+// // add new model join columns until they match the Java annotations
+// while (!allJavaAnnotationsFound) {
+// JavaUniqueConstraint uniqueConstraint = this.createJavaUniqueConstraint(javaSize);
+// if (uniqueConstraint.annotation(astRoot) == null) {
+// allJavaAnnotationsFound = true;
+// }
+// else {
+// this.getUniqueConstraints().add(uniqueConstraint);
+// uniqueConstraint.updateFromJava(astRoot);
+// javaSize++;
+// }
+// }
+// }
+// }
+
+ @Override
+ public IJavaJpaContextNode parent() {
+ return (IJavaJpaContextNode) super.parent();
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ ITextRange textRange = tableResource().textRange(astRoot);
+ return (textRange != null) ? textRange : this.parent().validationTextRange(astRoot);
+ }
+
+ public org.eclipse.jpt.db.internal.Table dbTable() {
+ Schema schema = this.dbSchema();
+ return (schema == null) ? null : schema.tableNamed(this.getName());
+ }
+
+ public Schema dbSchema() {
+ return this.database().schemaNamed(this.getSchema());
+ }
+
+ public boolean hasResolvedSchema() {
+ return this.dbSchema() != null;
+ }
+
+ public boolean isResolved() {
+ return this.dbTable() != null;
+ }
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+// for (IUniqueConstraint constraint : this.getUniqueConstraints()) {
+// result = ((JavaUniqueConstraint) constraint).candidateValuesFor(pos, filter, astRoot);
+// if (result != null) {
+// return result;
+// }
+// }
+ return null;
+ }
+
+ /**
+ * called if the database is connected
+ * name, schema, catalog
+ */
+ @Override
+ public Iterator<String> connectedCandidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.connectedCandidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.nameTouches(pos, astRoot)) {
+ return this.quotedCandidateNames(filter);
+ }
+ if (this.schemaTouches(pos, astRoot)) {
+ return this.quotedCandidateSchemas(filter);
+ }
+ if (this.catalogTouches(pos, astRoot)) {
+ return this.quotedCandidateCatalogs(filter);
+ }
+ return null;
+ }
+
+ private Iterator<String> candidateNames() {
+ Schema dbSchema = this.dbSchema();
+ return (dbSchema != null) ? dbSchema.tableNames() : EmptyIterator.<String> instance();
+ }
+
+ private Iterator<String> candidateNames(Filter<String> filter) {
+ return new FilteringIterator<String, String>(this.candidateNames(), filter);
+ }
+
+ private Iterator<String> quotedCandidateNames(Filter<String> filter) {
+ return StringTools.quote(this.candidateNames(filter));
+ }
+
+ private Iterator<String> candidateSchemas() {
+ return this.database().schemaNames();
+ }
+
+ private Iterator<String> candidateSchemas(Filter<String> filter) {
+ return new FilteringIterator<String, String>(this.candidateSchemas(), filter);
+ }
+
+ private Iterator<String> quotedCandidateSchemas(Filter<String> filter) {
+ return StringTools.quote(this.candidateSchemas(filter));
+ }
+
+ private Iterator<String> candidateCatalogs() {
+ return this.database().catalogNames();
+ }
+
+ private Iterator<String> candidateCatalogs(Filter<String> filter) {
+ return new FilteringIterator<String, String>(this.candidateCatalogs(), filter);
+ }
+
+ private Iterator<String> quotedCandidateCatalogs(Filter<String> filter) {
+ return StringTools.quote(this.candidateCatalogs(filter));
+ }
+
+ public String qualifiedName() {
+ return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ super.toString(sb);
+ sb.append(qualifiedName());
+ }
+
+ @Override
+ public String displayString() {
+ return qualifiedName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IDefaultJavaAttributeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IDefaultJavaAttributeMappingProvider.java
index 017fbd6992..ea8d2c4356 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IDefaultJavaAttributeMappingProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IDefaultJavaAttributeMappingProvider.java
@@ -7,10 +7,8 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.java;
+package org.eclipse.jpt.core.internal.context.java;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
/**
* Map a string key to an attribute mapping and its corresponding
@@ -19,13 +17,10 @@ import org.eclipse.jpt.core.internal.platform.DefaultsContext;
public interface IDefaultJavaAttributeMappingProvider extends IJavaAttributeMappingProvider {
/**
- * Given the Attribute and DefaultContext return whether the default mapping applies.
+ * Given the IJavaPersistentAttribute return whether the default mapping applies.
* This will be used to determine the default mapping in the case where no
* mapping has been specified.
- * @param attribute
- * @param defaultsContext
- * @return
*/
- boolean defaultApplies(Attribute attribute, DefaultsContext defaultsContext);
+ boolean defaultApplies(IJavaPersistentAttribute persistentAttribute);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaAssociationOverride.java
new file mode 100644
index 0000000000..bc1ccd7d14
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaAssociationOverride.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.context.base.IAssociationOverride;
+import org.eclipse.jpt.core.internal.resource.java.AssociationOverride;
+
+public interface IJavaAssociationOverride extends IAssociationOverride, IJavaJpaContextNode
+{
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaJoinColumn> joinColumns();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaJoinColumn> specifiedJoinColumns();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaJoinColumn> defaultJoinColumns();
+ IJavaJoinColumn addSpecifiedJoinColumn(int index);
+
+ void initializeFromResource(AssociationOverride associationOverride);
+
+ void update(AssociationOverride associationOverride);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaAttributeMapping.java
new file mode 100644
index 0000000000..8706bb4a4c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaAttributeMapping.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+
+
+public interface IJavaAttributeMapping extends IAttributeMapping, IJavaJpaContextNode
+{
+ IJavaPersistentAttribute persistentAttribute();
+
+ void initializeFromResource(JavaPersistentAttributeResource persistentAttributeResource);
+
+ void update(JavaPersistentAttributeResource persistentAttributeResource);
+
+ String annotationName();
+
+ /**
+ * Return all fully qualfied 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> correspondingAnnotationNames();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaAttributeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaAttributeMappingProvider.java
index 16ad84e026..4d28bc9f37 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaAttributeMappingProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaAttributeMappingProvider.java
@@ -7,14 +7,12 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.java;
+package org.eclipse.jpt.core.internal.context.java;
-import org.eclipse.jpt.core.internal.IJpaFactory;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
/**
- * Map a string key to an attribute mapping and its corresponding
+ * Map a string key to a type mapping and its corresponding
* Java annotation adapter.
*/
public interface IJavaAttributeMappingProvider {
@@ -24,15 +22,15 @@ public interface IJavaAttributeMappingProvider {
*/
String key();
+ String annotationName();
+
/**
- * Create an IJavaAttributeMapping for the given attribute. Use the IJpaFactory
+ * Create an IJavaAtttributeMapping for the given attribute. Use the IJpaFactory
* for creation so that extenders can create their own IJpaFactory instead of
* creating their own attributeMappingProvider.
- * @param attribute
+ * @param type
* @param jpaFactory
*/
- IJavaAttributeMapping buildMapping(Attribute attribute, IJpaFactory jpaFactory);
-
- DeclarationAnnotationAdapter declarationAnnotationAdapter();
+ public IJavaAttributeMapping buildMapping(IJavaPersistentAttribute parent, IJpaBaseContextFactory factory);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaAttributeOverride.java
new file mode 100644
index 0000000000..c3f82894a0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaAttributeOverride.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IAttributeOverride;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverride;
+
+public interface IJavaAttributeOverride extends IAttributeOverride, IJavaJpaContextNode, IJavaColumn.Owner
+{
+ IJavaColumn getColumn();
+
+ void initializeFromResource(AttributeOverride attributeOverride);
+
+ void update(AttributeOverride attributeOverride);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaBasicMapping.java
new file mode 100644
index 0000000000..91eb09d074
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaBasicMapping.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+
+public interface IJavaBasicMapping extends IJavaAttributeMapping, IBasicMapping, IJavaColumnMapping
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaColumn.java
new file mode 100644
index 0000000000..8d7ca17781
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaColumn.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IAbstractColumn;
+import org.eclipse.jpt.core.internal.context.base.IColumn;
+import org.eclipse.jpt.core.internal.resource.java.Column;
+
+public interface IJavaColumn extends IJavaNamedColumn, IColumn
+{
+ void initializeFromResource(Column columnResource);
+
+ void update(Column columnResource);
+
+ boolean isConnected();
+
+ Owner owner();
+ /**
+ * interface allowing columns to be used in multiple places
+ * (e.g. basic mappings and attribute overrides)
+ */
+ interface Owner extends IAbstractColumn.Owner
+ {
+ Column columnResource();
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaColumnMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaColumnMapping.java
new file mode 100644
index 0000000000..203e0edfa1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaColumnMapping.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IColumnMapping;
+
+public interface IJavaColumnMapping extends IJavaJpaContextNode, IColumnMapping, IJavaColumn.Owner
+{
+ IJavaColumn getColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaDiscriminatorColumn.java
new file mode 100644
index 0000000000..ca80950aa6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaDiscriminatorColumn.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IDiscriminatorColumn;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentResource;
+
+public interface IJavaDiscriminatorColumn extends IJavaNamedColumn, IDiscriminatorColumn
+{
+ void initializeFromResource(JavaPersistentResource persistentResource);
+
+ void update(JavaPersistentResource persistentResource);
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaEmbeddable.java
new file mode 100644
index 0000000000..2d7c804fd2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaEmbeddable.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IEmbeddable;
+
+
+
+public interface IJavaEmbeddable extends IJavaTypeMapping, IEmbeddable
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaEmbeddedIdMapping.java
new file mode 100644
index 0000000000..b417a9042f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaEmbeddedIdMapping.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
+
+public interface IJavaEmbeddedIdMapping extends IJavaAttributeMapping, IEmbeddedIdMapping
+{
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaAttributeOverride> attributeOverrides();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaAttributeOverride> defaultAttributeOverrides();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaAttributeOverride> specifiedAttributeOverrides();
+ IJavaAttributeOverride addSpecifiedAttributeOverride(int index);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaEmbeddedMapping.java
new file mode 100644
index 0000000000..3e16cbde62
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaEmbeddedMapping.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
+
+public interface IJavaEmbeddedMapping extends IJavaAttributeMapping, IEmbeddedMapping
+{
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaAttributeOverride> attributeOverrides();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaAttributeOverride> defaultAttributeOverrides();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaAttributeOverride> specifiedAttributeOverrides();
+ IJavaAttributeOverride addSpecifiedAttributeOverride(int index);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaEntity.java
new file mode 100644
index 0000000000..056229a96c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaEntity.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IPrimaryKeyJoinColumn;
+
+public interface IJavaEntity extends IJavaTypeMapping, IEntity
+{
+ IJavaTable getTable();
+
+ IJavaDiscriminatorColumn getDiscriminatorColumn();
+
+ IJavaTableGenerator getTableGenerator();
+ IJavaTableGenerator addTableGenerator();
+
+ IJavaSequenceGenerator getSequenceGenerator();
+ IJavaSequenceGenerator addSequenceGenerator();
+
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaSecondaryTable> secondaryTables();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaSecondaryTable> specifiedSecondaryTables();
+ IJavaSecondaryTable addSpecifiedSecondaryTable(int index);
+
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ IPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index);
+
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaAttributeOverride> attributeOverrides();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaAttributeOverride> specifiedAttributeOverrides();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaAttributeOverride> defaultAttributeOverrides();
+ IJavaAttributeOverride addSpecifiedAttributeOverride(int index);
+
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaAssociationOverride> associationOverrides();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaAssociationOverride> specifiedAssociationOverrides();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaAssociationOverride> defaultAssociationOverrides();
+ IJavaAssociationOverride addSpecifiedAssociationOverride(int index);
+
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaNamedQuery> namedQueries();
+ IJavaNamedQuery addNamedQuery(int index);
+
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaNamedNativeQuery> namedNativeQueries();
+ IJavaNamedNativeQuery addNamedNativeQuery(int index);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaGeneratedValue.java
new file mode 100644
index 0000000000..e01a5a1db0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaGeneratedValue.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IGeneratedValue;
+import org.eclipse.jpt.core.internal.resource.java.GeneratedValue;
+
+public interface IJavaGeneratedValue extends IGeneratedValue, IJavaJpaContextNode
+{
+ void initializeFromResource(GeneratedValue generatedValue);
+
+ void update(GeneratedValue generatedValue);
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/generic/GenericPlatform.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaGenerator.java
index 001f795e79..922df25631 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/generic/GenericPlatform.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaGenerator.java
@@ -7,19 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.platform.generic;
+package org.eclipse.jpt.core.internal.context.java;
-import org.eclipse.jpt.core.internal.IJpaFactory;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
+import org.eclipse.jpt.core.internal.context.base.IGenerator;
+import org.eclipse.jpt.core.internal.resource.java.Generator;
-public class GenericPlatform
- extends BaseJpaPlatform
+public interface IJavaGenerator<T extends Generator> extends IGenerator, IJavaJpaContextNode
{
- public final static String ID = "generic";
+ void initializeFromResource(T generator);
- @Override
- protected IJpaFactory buildJpaFactory() {
- return new GenericJpaFactory();
- }
+ void update(T generator);
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaIdMapping.java
index fc6c348e9c..c89f1c0e84 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INamedQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaIdMapping.java
@@ -7,19 +7,19 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.mappings;
+package org.eclipse.jpt.core.internal.context.java;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>INamed Query</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINamedQuery()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface INamedQuery extends IJpaSourceObject, IQuery
-{} // INamedQuery
+
+public interface IJavaIdMapping extends IJavaAttributeMapping, IIdMapping, IJavaColumnMapping
+{
+ IJavaGeneratedValue getGeneratedValue();
+ IJavaGeneratedValue addGeneratedValue();
+
+ IJavaSequenceGenerator getSequenceGenerator();
+ IJavaSequenceGenerator addSequenceGenerator();
+
+ IJavaTableGenerator getTableGenerator();
+ IJavaTableGenerator addTableGenerator();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaJoinColumn.java
new file mode 100644
index 0000000000..be95f96bd5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaJoinColumn.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumn;
+
+public interface IJavaJoinColumn extends IJoinColumn, IJavaNamedColumn
+{
+ void initializeFromResource(JoinColumn joinColumn);
+
+ boolean isConnected();
+
+ void update(JoinColumn joinColumn);
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaJoinTable.java
new file mode 100644
index 0000000000..c9fa03c354
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaJoinTable.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.context.base.IJoinTable;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+
+
+public interface IJavaJoinTable extends IJoinTable, IJavaJpaContextNode
+{
+ void initializeFromResource(JavaPersistentAttributeResource attributeResource);
+
+ void update(JavaPersistentAttributeResource attributeResource);
+
+ boolean isSpecified();
+
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaJoinColumn> joinColumns();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaJoinColumn> defaultJoinColumns();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaJoinColumn> specifiedJoinColumns();
+ IJavaJoinColumn addSpecifiedJoinColumn(int index);
+
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaJoinColumn> inverseJoinColumns();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaJoinColumn> defaultInverseJoinColumns();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaJoinColumn> specifiedInverseJoinColumns();
+ IJavaJoinColumn addSpecifiedInverseJoinColumn(int index);
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaJpaContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaJpaContextNode.java
new file mode 100644
index 0000000000..a6cfa09b08
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaJpaContextNode.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.utility.internal.Filter;
+
+public interface IJavaJpaContextNode extends IJpaContextNode
+{
+ ITextRange validationTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the candidate code-completion values for the specified position
+ * in the source code.
+ */
+ Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaManyToManyMapping.java
new file mode 100644
index 0000000000..f65378960b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaManyToManyMapping.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping;
+
+public interface IJavaManyToManyMapping extends IJavaMultiRelationshipMapping, IManyToManyMapping
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaManyToOneMapping.java
new file mode 100644
index 0000000000..a69115e745
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaManyToOneMapping.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping;
+
+
+public interface IJavaManyToOneMapping extends IJavaSingleRelationshipMapping, IManyToOneMapping
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaMappedSuperclass.java
new file mode 100644
index 0000000000..974ed01d34
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaMappedSuperclass.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IMappedSuperclass;
+
+
+public interface IJavaMappedSuperclass
+ extends IJavaTypeMapping, IMappedSuperclass
+{
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaMultiRelationshipMapping.java
new file mode 100644
index 0000000000..33ff761a96
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaMultiRelationshipMapping.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IMultiRelationshipMapping;
+
+public interface IJavaMultiRelationshipMapping extends IJavaRelationshipMapping, IMultiRelationshipMapping
+{
+
+ IJavaJoinTable getJoinTable();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaNamedColumn.java
new file mode 100644
index 0000000000..96ea2e93e9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaNamedColumn.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.INamedColumn;
+
+
+public interface IJavaNamedColumn extends INamedColumn, IJavaJpaContextNode
+{
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaNamedNativeQuery.java
new file mode 100644
index 0000000000..154ba6c62b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaNamedNativeQuery.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.INamedNativeQuery;
+import org.eclipse.jpt.core.internal.resource.java.NamedNativeQuery;
+
+public interface IJavaNamedNativeQuery extends INamedNativeQuery, IJavaQuery<NamedNativeQuery>
+{
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaNamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaNamedQuery.java
new file mode 100644
index 0000000000..b4ac2288b2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaNamedQuery.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.INamedQuery;
+import org.eclipse.jpt.core.internal.resource.java.NamedQuery;
+
+public interface IJavaNamedQuery extends INamedQuery, IJavaQuery<NamedQuery>
+{
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaOneToManyMapping.java
new file mode 100644
index 0000000000..7be227aca0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaOneToManyMapping.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping;
+
+
+public interface IJavaOneToManyMapping extends IJavaMultiRelationshipMapping, IOneToManyMapping
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaOneToOneMapping.java
new file mode 100644
index 0000000000..ffea677b1f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaOneToOneMapping.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping;
+
+public interface IJavaOneToOneMapping extends IJavaSingleRelationshipMapping, IOneToOneMapping
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaPersistentAttribute.java
new file mode 100644
index 0000000000..8f545c539a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaPersistentAttribute.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+
+public interface IJavaPersistentAttribute extends IPersistentAttribute, IJavaJpaContextNode
+{
+
+ IJavaAttributeMapping getMapping();
+
+ IJavaAttributeMapping getSpecifiedMapping();
+
+ IJavaTypeMapping typeMapping();
+
+ IJavaPersistentType persistentType();
+
+ void initializeFromResource(JavaPersistentAttributeResource persistentAttributeResource);
+
+ void update(JavaPersistentAttributeResource persistentAttributeResource);
+
+ JavaPersistentAttributeResource getPersistentAttributeResource();
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaPersistentType.java
new file mode 100644
index 0000000000..d7714aee9f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaPersistentType.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import java.util.ListIterator;
+
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.IPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+
+public interface IJavaPersistentType extends IPersistentType, IJavaJpaContextNode
+{
+ IJavaTypeMapping getMapping();
+
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaPersistentAttribute> attributes();
+
+ IJavaPersistentAttribute attributeNamed(String attributeName);
+
+ /**
+ * Resolve and return the attribute named <code>attributeName</code> if it
+ * is distinct and exists within the context of this type
+ */
+ IPersistentAttribute resolveAttribute(String attributeName);
+
+ void initializeFromResource(JavaPersistentTypeResource persistentTypeResource);
+
+ void update(JavaPersistentTypeResource persistentTypeResource);
+
+ /**
+ * Return whether any attribute in this persistent type contains a mapping annotation
+ * @return
+ */
+ boolean hasAnyAttributeMappingAnnotations();
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaPrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..b70d8bd11f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaPrimaryKeyJoinColumn.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn;
+
+public interface IJavaPrimaryKeyJoinColumn extends IPrimaryKeyJoinColumn, IJavaNamedColumn
+{
+ void initializeFromResource(PrimaryKeyJoinColumn primaryKeyJoinColumn);
+
+ void update(PrimaryKeyJoinColumn primaryKeyJoinColumn);
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaQuery.java
new file mode 100644
index 0000000000..6bc94d55c3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaQuery.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.context.base.IQuery;
+import org.eclipse.jpt.core.internal.resource.java.Query;
+
+public interface IJavaQuery<E extends Query> extends IQuery, IJavaJpaContextNode
+{
+
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaQueryHint> hints();
+ IJavaQueryHint addHint(int index);
+
+
+ void initializeFromResource(E queryResource);
+
+ void update(E queryResource);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaQueryHint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaQueryHint.java
new file mode 100644
index 0000000000..5231266c2b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaQueryHint.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IQueryHint;
+import org.eclipse.jpt.core.internal.resource.java.QueryHint;
+
+public interface IJavaQueryHint extends IQueryHint, IJavaJpaContextNode
+{
+ void initializeFromResource(QueryHint queryHint);
+
+ void update(QueryHint queryHint);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaRelationshipMapping.java
new file mode 100644
index 0000000000..11a76004ea
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaRelationshipMapping.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IRelationshipMapping;
+
+
+public interface IJavaRelationshipMapping extends IJavaAttributeMapping, IRelationshipMapping
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaSecondaryTable.java
new file mode 100644
index 0000000000..a4884dcdd9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaSecondaryTable.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.context.base.ISecondaryTable;
+import org.eclipse.jpt.core.internal.resource.java.SecondaryTable;
+
+
+public interface IJavaSecondaryTable extends ISecondaryTable, IJavaJpaContextNode
+{
+
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaPrimaryKeyJoinColumn> primaryKeyJoinColumns();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns();
+ IJavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index);
+
+ void initializeFromResource(SecondaryTable secondaryTable);
+
+ void update(SecondaryTable secondaryTable);
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaSequenceGenerator.java
new file mode 100644
index 0000000000..4b6b61c77b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaSequenceGenerator.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.ISequenceGenerator;
+import org.eclipse.jpt.core.internal.resource.java.SequenceGenerator;
+
+public interface IJavaSequenceGenerator extends IJavaGenerator<SequenceGenerator>, ISequenceGenerator
+{
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaSingleRelationshipMapping.java
new file mode 100644
index 0000000000..0a7bc21872
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaSingleRelationshipMapping.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.context.base.ISingleRelationshipMapping;
+
+public interface IJavaSingleRelationshipMapping extends IJavaRelationshipMapping, ISingleRelationshipMapping
+{
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaJoinColumn> joinColumns();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaJoinColumn> defaultJoinColumns();
+ @SuppressWarnings("unchecked")
+ ListIterator<IJavaJoinColumn> specifiedJoinColumns();
+ IJavaJoinColumn addSpecifiedJoinColumn(int index);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTable.java
new file mode 100644
index 0000000000..9598a79af4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTable.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.ITable;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentResource;
+
+public interface IJavaTable extends ITable, IJavaJpaContextNode
+{
+ void initializeFromResource(JavaPersistentResource persistentResource);
+
+ void update(JavaPersistentResource persistentResource);
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTableGenerator.java
new file mode 100644
index 0000000000..d7aeaab8aa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTableGenerator.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.ITableGenerator;
+import org.eclipse.jpt.core.internal.resource.java.TableGenerator;
+
+public interface IJavaTableGenerator extends IJavaGenerator<TableGenerator>, ITableGenerator
+{
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTransientMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTransientMapping.java
new file mode 100644
index 0000000000..bb68d1424f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTransientMapping.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
+
+
+public interface IJavaTransientMapping extends IJavaAttributeMapping, ITransientMapping
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTypeMapping.java
new file mode 100644
index 0000000000..b3e287fcf8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTypeMapping.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+
+public interface IJavaTypeMapping extends ITypeMapping, IJavaJpaContextNode
+{
+ IJavaPersistentType persistentType();
+
+ void initializeFromResource(JavaPersistentTypeResource persistentTypeResource);
+
+ void update(JavaPersistentTypeResource persistentTypeResource);
+
+ String annotationName();
+
+ Iterator<String> correspondingAnnotationNames();
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaTypeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTypeMappingProvider.java
index b214120aed..03194d6f28 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/IJavaTypeMappingProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaTypeMappingProvider.java
@@ -7,11 +7,9 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.java;
+package org.eclipse.jpt.core.internal.context.java;
-import org.eclipse.jpt.core.internal.IJpaFactory;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
/**
* Map a string key to a type mapping and its corresponding
@@ -24,6 +22,8 @@ public interface IJavaTypeMappingProvider {
*/
String key();
+ String annotationName();
+
/**
* Create an IJavaTypeMapping for the given attribute. Use the IJpaFactory
* for creation so that extenders can create their own IJpaFactory instead of
@@ -31,8 +31,6 @@ public interface IJavaTypeMappingProvider {
* @param type
* @param jpaFactory
*/
- IJavaTypeMapping buildMapping(Type type, IJpaFactory factory);
-
- DeclarationAnnotationAdapter declarationAnnotationAdapter();
+ public IJavaTypeMapping buildMapping(IJavaPersistentType parent, IJpaBaseContextFactory factory);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaVersionMapping.java
new file mode 100644
index 0000000000..271b5cfddb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/IJavaVersionMapping.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IVersionMapping;
+
+
+public interface IJavaVersionMapping extends IJavaAttributeMapping, IVersionMapping, IJavaColumnMapping
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaAssociationOverride.java
new file mode 100644
index 0000000000..435cbbe5e6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaAssociationOverride.java
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.context.java;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IAssociationOverride;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IRelationshipMapping;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.resource.java.AssociationOverride;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumn;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+public class JavaAssociationOverride extends JavaOverride<AssociationOverride>
+ implements IJavaAssociationOverride
+{
+
+ protected final List<IJavaJoinColumn> specifiedJoinColumns;
+
+ protected final List<IJavaJoinColumn> defaultJoinColumns;
+
+
+ public JavaAssociationOverride(IJavaJpaContextNode parent, Owner owner) {
+ super(parent, owner);
+ this.specifiedJoinColumns = new ArrayList<IJavaJoinColumn>();
+ this.defaultJoinColumns = new ArrayList<IJavaJoinColumn>();
+ }
+
+ public ListIterator<IJavaJoinColumn> joinColumns() {
+ return this.specifiedJoinColumns.isEmpty() ? this.defaultJoinColumns() : this.specifiedJoinColumns();
+ }
+
+ public ListIterator<IJavaJoinColumn> defaultJoinColumns() {
+ return new CloneListIterator<IJavaJoinColumn>(this.defaultJoinColumns);
+ }
+
+ public ListIterator<IJavaJoinColumn> specifiedJoinColumns() {
+ return new CloneListIterator<IJavaJoinColumn>(this.specifiedJoinColumns);
+ }
+
+ public int specifiedJoinColumnsSize() {
+ return this.specifiedJoinColumns.size();
+ }
+
+ public IJavaJoinColumn addSpecifiedJoinColumn(int index) {
+ IJavaJoinColumn joinColumn = jpaFactory().createJavaJoinColumn(this, createJoinColumnOwner());
+ this.specifiedJoinColumns.add(index, joinColumn);
+ this.overrideResource.addJoinColumn(index);
+ this.fireItemAdded(IAssociationOverride.SPECIFIED_JOIN_COLUMNS_LIST, index, joinColumn);
+ return joinColumn;
+ }
+
+ protected IJoinColumn.Owner createJoinColumnOwner() {
+ return new JoinColumnOwner();
+ }
+
+ protected void addSpecifiedJoinColumn(int index, IJavaJoinColumn joinColumn) {
+ addItemToList(index, joinColumn, this.specifiedJoinColumns, IAssociationOverride.SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public void removeSpecifiedJoinColumn(int index) {
+ IJavaJoinColumn removedJoinColumn = this.specifiedJoinColumns.remove(index);
+ this.overrideResource.removeJoinColumn(index);
+ fireItemRemoved(IEntity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, removedJoinColumn);
+ }
+
+ protected void removeSpecifiedJoinColumn(IJavaJoinColumn joinColumn) {
+ removeItemFromList(joinColumn, this.specifiedJoinColumns, IAssociationOverride.SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
+ this.overrideResource.moveJoinColumn(targetIndex, sourceIndex);
+ moveItemInList(targetIndex, sourceIndex, this.specifiedJoinColumns, IAssociationOverride.SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public boolean containsSpecifiedJoinColumns() {
+ return !this.specifiedJoinColumns.isEmpty();
+ }
+
+
+ @Override
+ protected Iterator<String> candidateNames() {
+ return this.owner().typeMapping().allOverridableAssociationNames();
+ }
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ for (IJavaJoinColumn column : CollectionTools.iterable(this.joinColumns())) {
+ result = column.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void initializeFromResource(AssociationOverride associationOverride) {
+ super.initializeFromResource(associationOverride);
+ this.name = associationOverride.getName();
+ initializeSpecifiedJoinColumns(associationOverride);
+ }
+
+ protected void initializeSpecifiedJoinColumns(AssociationOverride associationOverride) {
+ ListIterator<JoinColumn> annotations = associationOverride.joinColumns();
+
+ while(annotations.hasNext()) {
+ this.specifiedJoinColumns.add(createJoinColumn(annotations.next()));
+ }
+ }
+
+ @Override
+ public void update(AssociationOverride associationOverride) {
+ super.update(associationOverride);
+ this.setName(associationOverride.getName());
+ updateSpecifiedJoinColumns(associationOverride);
+ }
+
+ protected void updateSpecifiedJoinColumns(AssociationOverride associationOverride) {
+ ListIterator<IJavaJoinColumn> joinColumns = specifiedJoinColumns();
+ ListIterator<JoinColumn> resourceJoinColumns = associationOverride.joinColumns();
+
+ while (joinColumns.hasNext()) {
+ IJavaJoinColumn joinColumn = joinColumns.next();
+ if (resourceJoinColumns.hasNext()) {
+ joinColumn.update(resourceJoinColumns.next());
+ }
+ else {
+ removeSpecifiedJoinColumn(joinColumn);
+ }
+ }
+
+ while (resourceJoinColumns.hasNext()) {
+ addSpecifiedJoinColumn(specifiedJoinColumnsSize(), createJoinColumn(resourceJoinColumns.next()));
+ }
+ }
+
+
+ protected IJavaJoinColumn createJoinColumn(JoinColumn joinColumnResource) {
+ IJavaJoinColumn joinColumn = jpaFactory().createJavaJoinColumn(this, createJoinColumnOwner());
+ joinColumn.initializeFromResource(joinColumnResource);
+ return joinColumn;
+ }
+
+ public class JoinColumnOwner implements IJoinColumn.Owner
+ {
+
+ public JoinColumnOwner() {
+ super();
+ }
+
+ /**
+ * by default, the join column is in the type mapping's primary table
+ */
+ public String defaultTableName() {
+ return JavaAssociationOverride.this.owner.typeMapping().getTableName();
+ }
+
+ public String defaultColumnName() {
+ return null;
+ }
+
+ public IEntity targetEntity() {
+ return relationshipMapping().getResolvedTargetEntity();
+ }
+
+ public String attributeName() {
+ return JavaAssociationOverride.this.getName();
+ }
+
+ public IRelationshipMapping relationshipMapping() {
+ //TODO this isn't going to work, classCastException
+ return (IRelationshipMapping) JavaAssociationOverride.this.owner.columnMapping(JavaAssociationOverride.this.getName());
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return typeMapping().tableNameIsInvalid(tableName);
+ }
+
+ /**
+ * the join column can be on a secondary table
+ */
+ public boolean tableIsAllowed() {
+ return true;
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ITypeMapping typeMapping() {
+ return JavaAssociationOverride.this.owner.typeMapping();
+ }
+
+ public Table dbTable(String tableName) {
+ return typeMapping().dbTable(tableName);
+ }
+
+ public Table dbReferencedColumnTable() {
+ IEntity targetEntity = targetEntity();
+ return (targetEntity == null) ? null : targetEntity().primaryDbTable();
+ }
+
+ public boolean isVirtual(IAbstractJoinColumn joinColumn) {
+ return JavaAssociationOverride.this.defaultJoinColumns.contains(joinColumn);
+ }
+
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaAttributeMapping.java
new file mode 100644
index 0000000000..276f45977f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaAttributeMapping.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import java.util.List;
+
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+
+public abstract class JavaAttributeMapping extends JavaContextModel
+ implements IJavaAttributeMapping
+{
+ protected JavaPersistentAttributeResource persistentAttributeResource;
+
+
+ protected JavaAttributeMapping(IJavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ public void initializeFromResource(JavaPersistentAttributeResource persistentAttributeResource) {
+ this.persistentAttributeResource = persistentAttributeResource;
+ }
+
+ public JavaPersistentAttribute persistentAttribute() {
+ return (JavaPersistentAttribute) this.parent();
+ }
+
+ /**
+ * the persistent attribute can tell whether there is a "specified" mapping
+ * or a "default" one
+ */
+ public boolean isDefault() {
+ return this.persistentAttribute().mappingIsDefault();
+ }
+
+ protected boolean embeddableOwned() {
+ return this.typeMapping().getKey() == IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
+ }
+
+ protected boolean entityOwned() {
+ return this.typeMapping().getKey() == IMappingKeys.ENTITY_TYPE_MAPPING_KEY;
+ }
+
+ public ITypeMapping typeMapping() {
+ return this.persistentAttribute().typeMapping();
+ }
+
+ public String attributeName() {
+ return this.persistentAttribute().getName();
+ }
+
+ public Table dbTable(String tableName) {
+ return typeMapping().dbTable(tableName);
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ ITextRange textRange = this.persistentAttributeResource.textRange(astRoot);
+ return (textRange != null) ? textRange : this.persistentAttribute().validationTextRange(astRoot);
+ }
+
+ public void update(JavaPersistentAttributeResource persistentAttributeResource) {
+ this.persistentAttributeResource = persistentAttributeResource;
+ }
+
+ public String primaryKeyColumnName() {
+ return null;
+ }
+
+ public boolean isOverridableAttributeMapping() {
+ return false;
+ }
+
+ public boolean isOverridableAssociationMapping() {
+ return false;
+ }
+
+ public boolean isIdMapping() {
+ return false;
+ }
+
+ //************ Validation *************************
+
+ @Override
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+
+ addModifierMessages(messages, astRoot);
+ addInvalidMappingMessage(messages, astRoot);
+
+ }
+
+ protected void addModifierMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ JavaPersistentAttribute attribute = this.persistentAttribute();
+ if (attribute.getMapping().getKey() != IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY
+ && persistentAttributeResource.isForField()) {
+ int flags;
+
+ try {
+ flags = persistentAttributeResource.getMember().getJdtMember().getFlags();
+ } catch (JavaModelException jme) {
+ /* no error to log, in that case */
+ return;
+ }
+
+ if (Flags.isFinal(flags)) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_FIELD,
+ new String[] {attribute.getName()},
+ attribute, attribute.validationTextRange(astRoot))
+ );
+ }
+
+ if (Flags.isPublic(flags)) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.PERSISTENT_ATTRIBUTE_PUBLIC_FIELD,
+ new String[] {attribute.getName()},
+ attribute, attribute.validationTextRange(astRoot))
+ );
+
+ }
+ }
+ }
+
+ protected void addInvalidMappingMessage(List<IMessage> messages, CompilationUnit astRoot) {
+ if (! typeMapping().attributeMappingKeyAllowed(this.getKey())) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_MAPPING,
+ new String[] {this.persistentAttribute().getName()},
+ this, this.validationTextRange(astRoot))
+ );
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaAttributeOverride.java
new file mode 100644
index 0000000000..47784d6f26
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaAttributeOverride.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.context.base.IColumnMapping;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.java.Column;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.Filter;
+
+
+public class JavaAttributeOverride extends JavaOverride<AttributeOverride>
+ implements IJavaAttributeOverride
+{
+
+ protected final IJavaColumn column;
+
+
+ public JavaAttributeOverride(IJavaJpaContextNode parent, Owner owner) {
+ super(parent, owner);
+ this.column = jpaFactory().createJavaColumn(this, this);
+ }
+
+
+ @Override
+ public void initializeFromResource(AttributeOverride attributeOverrideResource) {
+ super.initializeFromResource(attributeOverrideResource);
+ this.column.initializeFromResource(this.columnResource());
+ }
+
+ public Column columnResource() {
+ return this.getOverrideResource().getNonNullColumn();
+ }
+
+ public String defaultColumnName() {
+ IColumnMapping columnMapping = columnMapping();
+ if (columnMapping == null) {
+ return null;
+ }
+ return columnMapping.getColumn().getName();
+ }
+
+ public String defaultTableName() {
+ IColumnMapping columnMapping = columnMapping();
+ if (columnMapping == null) {
+ return null;
+ }
+ String tableName = columnMapping.getColumn().getSpecifiedTable();
+ if (tableName != null) {
+ return tableName;
+ }
+ return owner().typeMapping().getTableName();
+ }
+
+ protected IColumnMapping columnMapping() {
+ return owner().columnMapping(getName());
+ }
+
+ //************* IColumn.Owner implementation **************
+ public ITypeMapping typeMapping() {
+ return this.owner().typeMapping();
+ }
+
+ public Table dbTable(String tableName) {
+ return this.typeMapping().dbTable(tableName);
+ }
+
+ //************* IAttributeOverride implementation **************
+
+ public IJavaColumn getColumn() {
+ return this.column;
+ }
+
+ //************* JavaOverride implementation **************
+
+ @Override
+ protected Iterator<String> candidateNames() {
+ return this.owner().typeMapping().allOverridableAttributeNames();
+ }
+
+ //************* java resource model -> java context model **************
+ @Override
+ public void update(AttributeOverride attributeOverrideResource) {
+ super.update(attributeOverrideResource);
+ this.column.update(this.columnResource());
+ }
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.getColumn().candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
+
+
+
+ // ********** static methods **********
+// static JavaAttributeOverride createAttributeOverride(Owner owner, Member member, int index) {
+// return JpaJavaMappingsFactory.eINSTANCE.createJavaAttributeOverride(owner, member, buildAnnotationAdapter(index));
+// }
+//
+// private static IndexedDeclarationAnnotationAdapter buildAnnotationAdapter(int index) {
+// return new CombinationIndexedDeclarationAnnotationAdapter(SINGLE_DECLARATION_ANNOTATION_ADAPTER, MULTIPLE_DECLARATION_ANNOTATION_ADAPTER, index, JPA.ATTRIBUTE_OVERRIDE);
+// }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMapping.java
new file mode 100644
index 0000000000..bdc240d9b1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMapping.java
@@ -0,0 +1,336 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.EnumType;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IColumnMapping;
+import org.eclipse.jpt.core.internal.context.base.IFetchable;
+import org.eclipse.jpt.core.internal.context.base.INullable;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.context.base.TemporalType;
+import org.eclipse.jpt.core.internal.resource.java.Basic;
+import org.eclipse.jpt.core.internal.resource.java.Column;
+import org.eclipse.jpt.core.internal.resource.java.Enumerated;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.Lob;
+import org.eclipse.jpt.core.internal.resource.java.Temporal;
+import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+
+public class JavaBasicMapping extends JavaAttributeMapping implements IJavaBasicMapping
+{
+ protected FetchType specifiedFetch;
+
+ protected Boolean specifiedOptional;
+
+ protected EnumType specifiedEnumerated;
+
+ protected final IJavaColumn column;
+
+ protected boolean lob;
+
+ protected TemporalType temporal;
+
+ public JavaBasicMapping(IJavaPersistentAttribute parent) {
+ super(parent);
+ this.column = createJavaColumn();
+ }
+
+ protected IJavaColumn createJavaColumn() {
+ return jpaFactory().createJavaColumn(this, this);
+ }
+
+ @Override
+ public void initializeFromResource(JavaPersistentAttributeResource persistentAttributeResource) {
+ super.initializeFromResource(persistentAttributeResource);
+ this.column.initializeFromResource(this.columnResource());
+ Basic basicResource = this.basicResource();
+ this.specifiedFetch = this.specifiedFetchType(basicResource);
+ this.specifiedOptional = this.specifiedOptional(basicResource);
+ this.specifiedEnumerated = this.specifiedEnumerated(this.enumeratedResource());
+ this.lob = this.lob(persistentAttributeResource);
+ this.temporal = this.temporal(this.temporalResource());
+ }
+
+ protected Basic basicResource() {
+ return (Basic) this.persistentAttributeResource.nonNullMappingAnnotation(annotationName());
+ }
+
+ protected Enumerated enumeratedResource() {
+ return (Enumerated) this.persistentAttributeResource.nonNullAnnotation(Enumerated.ANNOTATION_NAME);
+ }
+
+ protected Temporal temporalResource() {
+ return (Temporal) this.persistentAttributeResource.nonNullAnnotation(Temporal.ANNOTATION_NAME);
+ }
+
+ public Column columnResource() {
+ return (Column) this.persistentAttributeResource.nonNullAnnotation(Column.ANNOTATION_NAME);
+ }
+
+ //************** IJavaAttributeMapping implementation ***************
+ public String getKey() {
+ return IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return Basic.ANNOTATION_NAME;
+ }
+
+ public Iterator<String> correspondingAnnotationNames() {
+ return new ArrayIterator<String>(
+ JPA.COLUMN,
+ JPA.LOB,
+ JPA.TEMPORAL,
+ JPA.ENUMERATED);
+ }
+
+ public String defaultColumnName() {
+ return attributeName();
+ }
+
+ public String defaultTableName() {
+ return typeMapping().getTableName();
+ }
+
+ //************** IBasicMapping implementation ***************
+
+ public IJavaColumn getColumn() {
+ return this.column;
+ }
+
+ public FetchType getFetch() {
+ return (this.getSpecifiedFetch() == null) ? this.getDefaultFetch() : this.getSpecifiedFetch();
+ }
+
+ public FetchType getDefaultFetch() {
+ return IBasicMapping.DEFAULT_FETCH_TYPE;
+ }
+
+ public FetchType getSpecifiedFetch() {
+ return this.specifiedFetch;
+ }
+
+ public void setSpecifiedFetch(FetchType newSpecifiedFetch) {
+ FetchType oldFetch = this.specifiedFetch;
+ this.specifiedFetch = newSpecifiedFetch;
+ this.basicResource().setFetch(FetchType.toJavaResourceModel(newSpecifiedFetch));
+ firePropertyChanged(IFetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedFetch_(FetchType newSpecifiedFetch) {
+ FetchType oldFetch = this.specifiedFetch;
+ this.specifiedFetch = newSpecifiedFetch;
+ firePropertyChanged(IFetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch);
+ }
+
+ public Boolean getOptional() {
+ return (this.getSpecifiedOptional() == null) ? this.getDefaultOptional() : this.getSpecifiedOptional();
+ }
+
+ public Boolean getDefaultOptional() {
+ return INullable.DEFAULT_OPTIONAL;
+ }
+
+ public Boolean getSpecifiedOptional() {
+ return this.specifiedOptional;
+ }
+
+ public void setSpecifiedOptional(Boolean newSpecifiedOptional) {
+ Boolean oldOptional = this.specifiedOptional;
+ this.specifiedOptional = newSpecifiedOptional;
+ this.basicResource().setOptional(newSpecifiedOptional);
+ firePropertyChanged(INullable.SPECIFIED_OPTIONAL_PROPERTY, oldOptional, newSpecifiedOptional);
+ }
+
+
+ public boolean isLob() {
+ return this.lob;
+ }
+
+ public void setLob(boolean newLob) {
+ boolean oldLob = this.lob;
+ this.lob = newLob;
+ if (newLob) {
+ if (lobResource(this.persistentAttributeResource) == null) {
+ this.persistentAttributeResource.addAnnotation(Lob.ANNOTATION_NAME);
+ }
+ }
+ else {
+ if (lobResource(this.persistentAttributeResource) != null) {
+ this.persistentAttributeResource.removeAnnotation(Lob.ANNOTATION_NAME);
+ }
+ }
+ firePropertyChanged(IBasicMapping.LOB_PROPERTY, oldLob, newLob);
+ }
+
+ public TemporalType getTemporal() {
+ return this.temporal;
+ }
+
+ public void setTemporal(TemporalType newTemporal) {
+ TemporalType oldTemporal = this.temporal;
+ this.temporal = newTemporal;
+ this.temporalResource().setValue(TemporalType.toJavaResourceModel(newTemporal));
+ firePropertyChanged(IColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setTemporal_(TemporalType newTemporal) {
+ TemporalType oldTemporal = this.temporal;
+ this.temporal = newTemporal;
+ firePropertyChanged(IColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+ }
+
+ public EnumType getEnumerated() {
+ return (this.getSpecifiedEnumerated() == null) ? this.getDefaultEnumerated() : this.getSpecifiedEnumerated();
+ }
+
+ public EnumType getDefaultEnumerated() {
+ return IBasicMapping.DEFAULT_ENUMERATED;
+ }
+
+ public EnumType getSpecifiedEnumerated() {
+ return this.specifiedEnumerated;
+ }
+
+ public void setSpecifiedEnumerated(EnumType newSpecifiedEnumerated) {
+ EnumType oldEnumerated = this.specifiedEnumerated;
+ this.specifiedEnumerated = newSpecifiedEnumerated;
+ this.enumeratedResource().setValue(EnumType.toJavaResourceModel(newSpecifiedEnumerated));
+ firePropertyChanged(IBasicMapping.SPECIFIED_ENUMERATED_PROPERTY, oldEnumerated, newSpecifiedEnumerated);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedEnumerated_(EnumType newSpecifiedEnumerated) {
+ EnumType oldEnumerated = this.specifiedEnumerated;
+ this.specifiedEnumerated = newSpecifiedEnumerated;
+ firePropertyChanged(IBasicMapping.SPECIFIED_ENUMERATED_PROPERTY, oldEnumerated, newSpecifiedEnumerated);
+ }
+
+ @Override
+ public void update(JavaPersistentAttributeResource persistentAttributeResource) {
+ super.update(persistentAttributeResource);
+ this.column.update(this.columnResource());
+ Basic basicResource = this.basicResource();
+ this.setSpecifiedFetch_(this.specifiedFetchType(basicResource));
+ this.setSpecifiedOptional(this.specifiedOptional(basicResource));
+ this.setSpecifiedEnumerated_(this.specifiedEnumerated(this.enumeratedResource()));
+ this.setLob(this.lob(persistentAttributeResource));
+ this.setTemporal_(this.temporal(this.temporalResource()));
+ }
+
+
+ protected FetchType specifiedFetchType(Basic basic) {
+ return FetchType.fromJavaResourceModel(basic.getFetch());
+ }
+
+ protected Boolean specifiedOptional(Basic basic) {
+ return basic.getOptional();
+ }
+
+ protected EnumType specifiedEnumerated(Enumerated enumerated) {
+ return EnumType.fromJavaResourceModel(enumerated.getValue());
+ }
+
+ protected boolean lob(JavaPersistentAttributeResource persistentAttributeResource) {
+ return lobResource(persistentAttributeResource) != null;
+ }
+
+ protected Lob lobResource(JavaPersistentAttributeResource persistentAttributeResource) {
+ return (Lob) persistentAttributeResource.annotation(Lob.ANNOTATION_NAME);
+ }
+
+ protected TemporalType temporal(Temporal temporal) {
+ return TemporalType.fromJavaResourceModel(temporal.getValue());
+ }
+
+
+ @Override
+ public boolean isOverridableAttributeMapping() {
+ return true;
+ }
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.getColumn().candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
+
+ // ************** Validation *************************************
+
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages ,astRoot);
+
+ addColumnMessages(messages, astRoot);
+ }
+
+ protected void addColumnMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ IJavaColumn column = this.getColumn();
+ String table = column.getTable();
+ boolean doContinue = entityOwned() && column.isConnected();
+
+ if (doContinue && this.typeMapping().tableNameIsInvalid(table)) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
+ new String[] {table, column.getName()},
+ column, column.tableTextRange(astRoot))
+ );
+ doContinue = false;
+ }
+
+ if (doContinue && ! column.isResolved()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.COLUMN_UNRESOLVED_NAME,
+ new String[] {column.getName()},
+ column, column.nameTextRange(astRoot))
+ );
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMappingProvider.java
new file mode 100644
index 0000000000..ff24e11c4a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMappingProvider.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.java.Basic;
+
+public class JavaBasicMappingProvider
+ implements IDefaultJavaAttributeMappingProvider
+{
+
+ // singleton
+ private static final JavaBasicMappingProvider INSTANCE = new JavaBasicMappingProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static IDefaultJavaAttributeMappingProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private JavaBasicMappingProvider() {
+ super();
+ }
+
+ public String key() {
+ return IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return Basic.ANNOTATION_NAME;
+ }
+
+ public IJavaAttributeMapping buildMapping(IJavaPersistentAttribute parent, IJpaBaseContextFactory factory) {
+ return factory.createJavaBasicMapping(parent);
+ }
+
+ public boolean defaultApplies(IJavaPersistentAttribute persistentAttribute) {
+ return persistentAttribute.getPersistentAttributeResource().typeIsBasic();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaCascade.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaCascade.java
new file mode 100644
index 0000000000..158adf3804
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaCascade.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.ICascade;
+import org.eclipse.jpt.core.internal.resource.java.RelationshipMapping;
+
+public class JavaCascade extends JavaContextModel implements ICascade
+{
+ protected boolean all;
+
+ protected boolean persist;
+
+ protected boolean merge;
+
+ protected boolean remove;
+
+ protected boolean refresh;
+
+ protected RelationshipMapping relationshipMapping;
+
+ protected JavaCascade(IJavaRelationshipMapping parent) {
+ super(parent);
+ }
+
+ public boolean isAll() {
+ return this.all;
+ }
+
+ public void setAll(boolean newAll) {
+ boolean oldAll = this.all;
+ this.all = newAll;
+ this.relationshipMapping.setCascadeAll(newAll);
+ firePropertyChanged(ICascade.ALL_PROPERTY, oldAll, newAll);
+ }
+
+ public boolean isPersist() {
+ return this.persist;
+ }
+
+ public void setPersist(boolean newPersist) {
+ boolean oldPersist = this.persist;
+ this.persist = newPersist;
+ this.relationshipMapping.setCascadePersist(newPersist);
+ firePropertyChanged(ICascade.PERSIST_PROPERTY, oldPersist, newPersist);
+ }
+
+ public boolean isMerge() {
+ return this.merge;
+ }
+
+ public void setMerge(boolean newMerge) {
+ boolean oldMerge = this.merge;
+ this.merge = newMerge;
+ this.relationshipMapping.setCascadeMerge(newMerge);
+ firePropertyChanged(ICascade.MERGE_PROPERTY, oldMerge, newMerge);
+ }
+
+ public boolean isRemove() {
+ return this.remove;
+ }
+
+ public void setRemove(boolean newRemove) {
+ boolean oldRemove = this.remove;
+ this.remove = newRemove;
+ this.relationshipMapping.setCascadeRemove(newRemove);
+ firePropertyChanged(ICascade.REMOVE_PROPERTY, oldRemove, newRemove);
+ }
+
+ public boolean isRefresh() {
+ return this.refresh;
+ }
+
+ public void setRefresh(boolean newRefresh) {
+ boolean oldRefresh = this.refresh;
+ this.refresh = newRefresh;
+ this.relationshipMapping.setCascadeRefresh(newRefresh);
+ firePropertyChanged(ICascade.REFRESH_PROPERTY, oldRefresh, newRefresh);
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ return this.relationshipMapping.cascadeTextRange(astRoot);
+ }
+
+ public void initialize(RelationshipMapping relationshipMapping) {
+ this.relationshipMapping = relationshipMapping;
+ this.all = relationshipMapping.isCascadeAll();
+ this.persist = relationshipMapping.isCascadePersist();
+ this.merge = relationshipMapping.isCascadeMerge();
+ this.remove = relationshipMapping.isCascadeRemove();
+ this.refresh = relationshipMapping.isCascadeRefresh();
+ }
+
+ public void update(RelationshipMapping relationshipMapping) {
+ this.relationshipMapping = relationshipMapping;
+ this.setAll(relationshipMapping.isCascadeAll());
+ this.setPersist(relationshipMapping.isCascadePersist());
+ this.setMerge(relationshipMapping.isCascadeMerge());
+ this.setRemove(relationshipMapping.isCascadeRemove());
+ this.setRefresh(relationshipMapping.isCascadeRefresh());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaColumn.java
new file mode 100644
index 0000000000..adab09b64c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaColumn.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IColumn;
+import org.eclipse.jpt.core.internal.resource.java.Column;
+
+public class JavaColumn extends AbstractJavaColumn<Column> implements IJavaColumn
+{
+
+ protected Integer specifiedLength;
+
+ protected Integer specifiedPrecision;
+
+ protected Integer specifiedScale;
+
+ public JavaColumn(IJavaJpaContextNode parent, IJavaColumn.Owner owner) {
+ super(parent, owner);
+ }
+
+ @Override
+ public void initializeFromResource(Column column) {
+ super.initializeFromResource(column);
+ this.specifiedLength = this.specifiedLength(column);
+ this.specifiedPrecision = this.specifiedPrecision(column);
+ this.specifiedScale = this.specifiedScale(column);
+ }
+
+ @Override
+ public IJavaColumn.Owner owner() {
+ return (IJavaColumn.Owner) super.owner();
+ }
+
+ @Override
+ protected Column columnResource() {
+ return this.owner().columnResource();
+ }
+
+ public Integer getLength() {
+ return (this.getSpecifiedLength() == null) ? getDefaultLength() : this.getSpecifiedLength();
+ }
+
+ public Integer getDefaultLength() {
+ return IColumn.DEFAULT_LENGTH;
+ }
+
+ public Integer getSpecifiedLength() {
+ return this.specifiedLength;
+ }
+
+ public void setSpecifiedLength(Integer newSpecifiedLength) {
+ Integer oldSpecifiedLength = this.specifiedLength;
+ this.specifiedLength = newSpecifiedLength;
+ columnResource().setLength(newSpecifiedLength);
+ firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
+ }
+
+ public Integer getPrecision() {
+ return (this.getSpecifiedPrecision() == null) ? getDefaultPrecision() : this.getSpecifiedPrecision();
+ }
+
+ public Integer getDefaultPrecision() {
+ return IColumn.DEFAULT_PRECISION;
+ }
+
+ public Integer getSpecifiedPrecision() {
+ return this.specifiedPrecision;
+ }
+
+ public void setSpecifiedPrecision(Integer newSpecifiedPrecision) {
+ Integer oldSpecifiedPrecision = this.specifiedPrecision;
+ this.specifiedPrecision = newSpecifiedPrecision;
+ columnResource().setPrecision(newSpecifiedPrecision);
+ firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, oldSpecifiedPrecision, newSpecifiedPrecision);
+ }
+
+ public Integer getScale() {
+ return (this.getSpecifiedScale() == null) ? getDefaultScale() : this.getSpecifiedScale();
+ }
+
+ public Integer getDefaultScale() {
+ return IColumn.DEFAULT_SCALE;
+ }
+
+ public Integer getSpecifiedScale() {
+ return this.specifiedScale;
+ }
+
+ public void setSpecifiedScale(Integer newSpecifiedScale) {
+ Integer oldSpecifiedScale = this.specifiedScale;
+ this.specifiedScale = newSpecifiedScale;
+ columnResource().setScale(newSpecifiedScale);
+ firePropertyChanged(SPECIFIED_SCALE_PROPERTY, oldSpecifiedScale, newSpecifiedScale);
+ }
+
+ @Override
+ public boolean tableIsAllowed() {
+ return true;
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ ITextRange textRange = columnResource().textRange(astRoot);
+ return (textRange != null) ? textRange : this.owner().validationTextRange(astRoot);
+ }
+
+ @Override
+ public void update(Column column) {
+ super.update(column);
+ this.setSpecifiedLength(this.specifiedLength(column));
+ this.setSpecifiedPrecision(this.specifiedPrecision(column));
+ this.setSpecifiedScale(this.specifiedScale(column));
+ }
+
+ protected Integer specifiedLength(Column column) {
+ return column.getLength();
+ }
+
+ protected Integer specifiedPrecision(Column column) {
+ return column.getPrecision();
+ }
+
+ protected Integer specifiedScale(Column column) {
+ return column.getScale();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaContextModel.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaContextModel.java
new file mode 100644
index 0000000000..0196d0bbd3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaContextModel.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IJpaNode;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.utility.internal.Filter;
+
+public abstract class JavaContextModel extends JpaContextNode implements IJavaJpaContextNode
+{
+ // ********** constructor **********
+
+ protected JavaContextModel(IJpaNode parent) {
+ super(parent);
+ }
+
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ if (this.isConnected()) {
+ Iterator<String> result = this.connectedCandidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * This method is called if the database is connected, allowing us to
+ * get candidates from the various database tables etc.
+ * This method should NOT be cascaded to "child" objects; it should
+ * only return candidates for the current object. The cascading is
+ * handled by #candidateValuesFor(int, Filter, CompilationUnit).
+ */
+ public Iterator<String> connectedCandidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ return null;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaDiscriminatorColumn.java
new file mode 100644
index 0000000000..11914143a6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaDiscriminatorColumn.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.DiscriminatorType;
+import org.eclipse.jpt.core.internal.context.base.IDiscriminatorColumn;
+import org.eclipse.jpt.core.internal.context.base.INamedColumn;
+import org.eclipse.jpt.core.internal.resource.java.DiscriminatorColumn;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentResource;
+
+public class JavaDiscriminatorColumn extends JavaNamedColumn<DiscriminatorColumn>
+ implements IJavaDiscriminatorColumn
+{
+
+ protected DiscriminatorType specifiedDiscriminatorType;
+
+ protected Integer specifiedLength;
+
+ protected JavaPersistentResource persistenceResource;
+
+ public JavaDiscriminatorColumn(IJavaEntity parent, INamedColumn.Owner owner) {
+ super(parent, owner);
+ }
+
+ public void initializeFromResource(JavaPersistentResource persistentResource) {
+ this.persistenceResource = persistentResource;
+ this.initializeFromResource(this.columnResource());
+ }
+
+ @Override
+ public void initializeFromResource(DiscriminatorColumn column) {
+ super.initializeFromResource(column);
+ this.specifiedDiscriminatorType = this.discriminatorType(column);
+ this.specifiedLength = this.length(column);
+ }
+
+ protected IJavaEntity javaEntity() {
+ return (IJavaEntity) super.parent();
+ }
+
+ @Override
+ protected DiscriminatorColumn columnResource() {
+ return (DiscriminatorColumn) this.persistenceResource.nonNullAnnotation(DiscriminatorColumn.ANNOTATION_NAME);
+ }
+
+ public DiscriminatorType getDiscriminatorType() {
+ return (this.getSpecifiedDiscriminatorType() == null) ? this.getDefaultDiscriminatorType() : this.getSpecifiedDiscriminatorType();
+ }
+
+ public DiscriminatorType getDefaultDiscriminatorType() {
+ return IDiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE;
+ }
+
+ public DiscriminatorType getSpecifiedDiscriminatorType() {
+ return this.specifiedDiscriminatorType;
+ }
+
+ public void setSpecifiedDiscriminatorType(DiscriminatorType newSpecifiedDiscriminatorType) {
+ DiscriminatorType oldDiscriminatorType = this.specifiedDiscriminatorType;
+ this.specifiedDiscriminatorType = newSpecifiedDiscriminatorType;
+ columnResource().setDiscriminatorType(DiscriminatorType.toJavaResourceModel(newSpecifiedDiscriminatorType));
+ firePropertyChanged(IDiscriminatorColumn.SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY, oldDiscriminatorType, newSpecifiedDiscriminatorType);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedDiscriminatorType_(DiscriminatorType newSpecifiedDiscriminatorType) {
+ DiscriminatorType oldDiscriminatorType = this.specifiedDiscriminatorType;
+ this.specifiedDiscriminatorType = newSpecifiedDiscriminatorType;
+ firePropertyChanged(IDiscriminatorColumn.SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY, oldDiscriminatorType, newSpecifiedDiscriminatorType);
+ }
+
+ public Integer getLength() {
+ return (this.getSpecifiedLength() == null) ? this.getDefaultLength() : this.getSpecifiedLength();
+ }
+
+ public Integer getDefaultLength() {
+ return IDiscriminatorColumn.DEFAULT_LENGTH;
+ }
+
+ public Integer getSpecifiedLength() {
+ return this.specifiedLength;
+ }
+
+ public void setSpecifiedLength(Integer newSpecifiedLength) {
+ Integer oldSpecifiedLength = this.specifiedLength;
+ this.specifiedLength = newSpecifiedLength;
+ columnResource().setLength(newSpecifiedLength);
+ firePropertyChanged(IDiscriminatorColumn.SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedLength_(Integer newSpecifiedLength) {
+ Integer oldSpecifiedLength = this.specifiedLength;
+ this.specifiedLength = newSpecifiedLength;
+ firePropertyChanged(IDiscriminatorColumn.SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
+ }
+
+ @Override
+ protected String tableName() {
+ return javaEntity().getTableName();
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ ITextRange textRange = columnResource().textRange(astRoot);
+ return (textRange != null) ? textRange : this.owner().validationTextRange(astRoot);
+ }
+
+
+ // ********** java annotations -> persistence model **********
+
+ public void update(JavaPersistentResource persistentResource) {
+ this.persistenceResource = persistentResource;
+ this.update(this.columnResource());
+ }
+
+ @Override
+ public void update(DiscriminatorColumn discriminatorColumn) {
+ super.update(discriminatorColumn);
+ this.setSpecifiedDiscriminatorType_(this.discriminatorType(discriminatorColumn));
+ this.setSpecifiedLength_(this.length(discriminatorColumn));
+ }
+
+ protected DiscriminatorType discriminatorType(DiscriminatorColumn discriminatorColumn) {
+ return DiscriminatorType.fromJavaResourceModel(discriminatorColumn.getDiscriminatorType());
+ }
+
+ protected Integer length(DiscriminatorColumn discriminatorColumn) {
+ return discriminatorColumn.getLength();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddable.java
new file mode 100644
index 0000000000..a37b48eea0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddable.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.resource.java.Embeddable;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+
+
+public class JavaEmbeddable extends JavaTypeMapping implements IJavaEmbeddable
+{
+ public JavaEmbeddable(IJavaPersistentType parent) {
+ super(parent);
+ }
+
+ public String getKey() {
+ return IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return Embeddable.ANNOTATION_NAME;
+ }
+
+ public Iterator<String> correspondingAnnotationNames() {
+ return EmptyIterator.instance();
+ }
+
+ public boolean isMapped() {
+ return true;
+ }
+
+ @Override
+ public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
+ return attributeMappingKey == IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY || attributeMappingKey == IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddableProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddableProvider.java
index 2bddab0d53..275ab09760 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEmbeddableProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddableProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2007 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.
@@ -7,18 +7,12 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.java.mappings;
+package org.eclipse.jpt.core.internal.context.java;
-import org.eclipse.jpt.core.internal.IJpaFactory;
import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMappingProvider;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.java.Embeddable;
-/**
- *
- */
public class JavaEmbeddableProvider
implements IJavaTypeMappingProvider
{
@@ -43,13 +37,13 @@ public class JavaEmbeddableProvider
public String key() {
return IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
}
-
- public IJavaTypeMapping buildMapping(Type type, IJpaFactory factory) {
- return factory.createJavaEmbeddable(type);
+
+ public String annotationName() {
+ return Embeddable.ANNOTATION_NAME;
}
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return JavaEmbeddable.DECLARATION_ANNOTATION_ADAPTER;
+ public IJavaTypeMapping buildMapping(IJavaPersistentType parent, IJpaBaseContextFactory factory) {
+ return factory.createJavaEmbeddable(parent);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedIdMapping.java
new file mode 100644
index 0000000000..6b122c7e2a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedIdMapping.java
@@ -0,0 +1,318 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.context.java;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IAttributeOverride;
+import org.eclipse.jpt.core.internal.context.base.IColumnMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddable;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IOverride;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverrides;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.NullAttributeOverride;
+import org.eclipse.jpt.core.internal.resource.java.NullColumn;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.CompositeListIterator;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+
+public class JavaEmbeddedIdMapping extends JavaAttributeMapping
+ implements IJavaEmbeddedIdMapping
+{
+ protected final List<IJavaAttributeOverride> specifiedAttributeOverrides;
+
+ protected final List<IJavaAttributeOverride> defaultAttributeOverrides;
+
+ private IEmbeddable embeddable;
+
+ public JavaEmbeddedIdMapping(IJavaPersistentAttribute parent) {
+ super(parent);
+ this.specifiedAttributeOverrides = new ArrayList<IJavaAttributeOverride>();
+ this.defaultAttributeOverrides = new ArrayList<IJavaAttributeOverride>();
+ }
+
+ //****************** IJavaAttributeMapping implemenation *******************
+
+ public String getKey() {
+ return IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return EmbeddedId.ANNOTATION_NAME;
+ }
+
+ public Iterator<String> correspondingAnnotationNames() {
+ return new ArrayIterator<String>(
+ JPA.ATTRIBUTE_OVERRIDE,
+ JPA.ATTRIBUTE_OVERRIDES);
+ }
+
+ @Override
+ public boolean isIdMapping() {
+ return true;
+ }
+
+ //****************** IOverride.Owner implemenation *******************
+ public IColumnMapping columnMapping(String attributeName) {
+ return JavaEmbeddedMapping.columnMapping(attributeName, embeddable());
+ }
+
+ public boolean isVirtual(IOverride override) {
+ return this.defaultAttributeOverrides.contains(override);
+ }
+
+
+ //****************** IEmbeddedMapping implemenation *******************
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<IJavaAttributeOverride> attributeOverrides() {
+ return new CompositeListIterator<IJavaAttributeOverride>(specifiedAttributeOverrides(), defaultAttributeOverrides());
+ }
+
+ public ListIterator<IJavaAttributeOverride> defaultAttributeOverrides() {
+ return new CloneListIterator<IJavaAttributeOverride>(this.defaultAttributeOverrides);
+ }
+
+ public ListIterator<IJavaAttributeOverride> specifiedAttributeOverrides() {
+ return new CloneListIterator<IJavaAttributeOverride>(this.specifiedAttributeOverrides);
+ }
+
+ public int specifiedAttributeOverridesSize() {
+ return this.specifiedAttributeOverrides.size();
+ }
+
+ public IJavaAttributeOverride addSpecifiedAttributeOverride(int index) {
+ IJavaAttributeOverride attributeOverride = jpaFactory().createJavaAttributeOverride(this, this);
+ this.specifiedAttributeOverrides.add(index, attributeOverride);
+ this.persistentAttributeResource.addAnnotation(index, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ this.fireItemAdded(IEmbeddedIdMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, attributeOverride);
+ return attributeOverride;
+ }
+
+ protected void addSpecifiedAttributeOverride(int index, IJavaAttributeOverride attributeOverride) {
+ addItemToList(index, attributeOverride, this.specifiedAttributeOverrides, IEmbeddedIdMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public void removeSpecifiedAttributeOverride(int index) {
+ IJavaAttributeOverride removedAttributeOverride = this.specifiedAttributeOverrides.remove(index);
+ this.persistentAttributeResource.removeAnnotation(index, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ fireItemRemoved(IEmbeddedIdMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, removedAttributeOverride);
+ }
+
+ protected void removeSpecifiedAttributeOverride(IJavaAttributeOverride attributeOverride) {
+ removeItemFromList(attributeOverride, this.specifiedAttributeOverrides, IEmbeddedIdMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public void moveSpecifiedAttributeOverride(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedAttributeOverrides, targetIndex, sourceIndex);
+ this.persistentAttributeResource.move(targetIndex, sourceIndex, AttributeOverrides.ANNOTATION_NAME);
+ fireItemMoved(IEmbeddedIdMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, targetIndex, sourceIndex);
+ }
+
+ protected void addDefaultAttributeOverride(IJavaAttributeOverride attributeOverride) {
+ addItemToList(attributeOverride, this.defaultAttributeOverrides, IEmbeddedIdMapping.DEFAULT_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ protected void removeDefaultAttributeOverride(IJavaAttributeOverride attributeOverride) {
+ removeItemFromList(attributeOverride, this.defaultAttributeOverrides, IEmbeddedIdMapping.DEFAULT_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public IJavaAttributeOverride attributeOverrideNamed(String name) {
+ return (IJavaAttributeOverride) overrideNamed(name, attributeOverrides());
+ }
+
+ public boolean containsAttributeOverride(String name) {
+ return containsOverride(name, attributeOverrides());
+ }
+
+ public boolean containsDefaultAttributeOverride(String name) {
+ return containsOverride(name, defaultAttributeOverrides());
+ }
+
+ public boolean containsSpecifiedAttributeOverride(String name) {
+ return containsOverride(name, specifiedAttributeOverrides());
+ }
+
+ private IOverride overrideNamed(String name, ListIterator<? extends IOverride> overrides) {
+ for (IOverride override : CollectionTools.iterable(overrides)) {
+ String overrideName = override.getName();
+ if (overrideName == null && name == null) {
+ return override;
+ }
+ if (overrideName != null && overrideName.equals(name)) {
+ return override;
+ }
+ }
+ return null;
+ }
+
+ private boolean containsOverride(String name, ListIterator<? extends IOverride> overrides) {
+ return overrideNamed(name, overrides) != null;
+ }
+
+ public IEmbeddable embeddable() {
+ return this.embeddable;
+ }
+
+
+
+ @Override
+ public void initializeFromResource(JavaPersistentAttributeResource persistentAttributeResource) {
+ super.initializeFromResource(persistentAttributeResource);
+ this.initializeAttributeOverrides(persistentAttributeResource);
+ this.initializeDefaultAttributeOverrides(persistentAttributeResource);
+ this.embeddable = embeddableFor(persistentAttribute());
+ }
+
+ protected void initializeAttributeOverrides(JavaPersistentAttributeResource persistentAttributeResource) {
+ ListIterator<JavaResource> annotations = persistentAttributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+
+ while(annotations.hasNext()) {
+ IJavaAttributeOverride attributeOverride = jpaFactory().createJavaAttributeOverride(this, this);
+ attributeOverride.initializeFromResource((AttributeOverride) annotations.next());
+ this.specifiedAttributeOverrides.add(attributeOverride);
+ }
+ }
+
+ protected void initializeDefaultAttributeOverrides(JavaPersistentAttributeResource persistentAttributeResource) {
+ for (Iterator<String> i = allOverridableAttributeNames(); i.hasNext(); ) {
+ String attributeName = i.next();
+ IJavaAttributeOverride attributeOverride = attributeOverrideNamed(attributeName);
+ if (attributeOverride == null) {
+ attributeOverride = createAttributeOverride(new NullAttributeOverride(persistentAttributeResource, attributeName));
+ this.defaultAttributeOverrides.add(attributeOverride);
+ }
+ }
+ } @Override
+ public void update(JavaPersistentAttributeResource persistentAttributeResource) {
+ super.update(persistentAttributeResource);
+ this.embeddable = embeddableFor(persistentAttribute());
+ this.updateSpecifiedAttributeOverrides(persistentAttributeResource);
+ this.updateDefaultAttributeOverrides(persistentAttributeResource);
+
+ }
+ protected void updateSpecifiedAttributeOverrides(JavaPersistentAttributeResource persistentAttributeResource) {
+ ListIterator<IJavaAttributeOverride> attributeOverrides = specifiedAttributeOverrides();
+ ListIterator<JavaResource> resourceAttributeOverrides = persistentAttributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+
+ while (attributeOverrides.hasNext()) {
+ IJavaAttributeOverride attributeOverride = attributeOverrides.next();
+ if (resourceAttributeOverrides.hasNext()) {
+ attributeOverride.update((AttributeOverride) resourceAttributeOverrides.next());
+ }
+ else {
+ removeSpecifiedAttributeOverride(attributeOverride);
+ }
+ }
+
+ while (resourceAttributeOverrides.hasNext()) {
+ addSpecifiedAttributeOverride(specifiedAttributeOverridesSize(), createAttributeOverride((AttributeOverride) resourceAttributeOverrides.next()));
+ }
+ }
+
+ protected IJavaAttributeOverride createAttributeOverride(AttributeOverride attributeOverrideResource) {
+ IJavaAttributeOverride attributeOverride = jpaFactory().createJavaAttributeOverride(this, this);
+ attributeOverride.initializeFromResource(attributeOverrideResource);
+ return attributeOverride;
+ }
+
+ protected void updateDefaultAttributeOverrides(JavaPersistentAttributeResource persistentAttributeResource) {
+ for (Iterator<String> i = allOverridableAttributeNames(); i.hasNext(); ) {
+ String attributeName = i.next();
+ IJavaAttributeOverride attributeOverride = attributeOverrideNamed(attributeName);
+ if (attributeOverride == null) {
+ attributeOverride = createAttributeOverride(new NullAttributeOverride(persistentAttributeResource, attributeName));
+ addDefaultAttributeOverride(attributeOverride);
+ }
+ else if (attributeOverride.isVirtual()) {
+ attributeOverride.getColumn().update(new NullColumn(persistentAttributeResource));
+ }
+ }
+
+ Collection<String> attributeNames = CollectionTools.collection(allOverridableAttributeNames());
+
+ //remove any default mappings that are not included in the attributeNames collection
+ for (IJavaAttributeOverride attributeOverride : CollectionTools.iterable(defaultAttributeOverrides())) {
+ if (!attributeNames.contains(attributeOverride.getName())
+ || containsSpecifiedAttributeOverride(attributeOverride.getName())) {
+ removeDefaultAttributeOverride(attributeOverride);
+ }
+ }
+ }
+
+
+ public Iterator<String> allOverridableAttributeNames() {
+ return new TransformationIterator<IPersistentAttribute, String>(this.allOverridableAttributes()) {
+ @Override
+ protected String transform(IPersistentAttribute attribute) {
+ return attribute.getName();
+ }
+ };
+ }
+
+ public Iterator<IPersistentAttribute> allOverridableAttributes() {
+ if (this.embeddable() == null) {
+ return EmptyIterator.instance();
+ }
+ return new FilteringIterator<IPersistentAttribute, IPersistentAttribute>(this.embeddable().persistentType().attributes()) {
+ @Override
+ protected boolean accept(IPersistentAttribute o) {
+ return o.isOverridableAttribute();
+ }
+ };
+ }
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ for (IAttributeOverride override : CollectionTools.iterable(this.attributeOverrides())) {
+ result = ((IJavaAttributeOverride) override).candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ //******** Validation ******************
+
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+ }
+
+ //******* static methods *********
+
+ protected static IEmbeddable embeddableFor(IJavaPersistentAttribute persistentAttribute) {
+ //TODO move this off of JavaEmbeddedMapping so that both can use it?
+ return JavaEmbeddedMapping.embeddableFor(persistentAttribute);
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedIdMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedIdMappingProvider.java
new file mode 100644
index 0000000000..ec898ff153
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedIdMappingProvider.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddedId;
+
+public class JavaEmbeddedIdMappingProvider
+ implements IDefaultJavaAttributeMappingProvider
+{
+
+ // singleton
+ private static final JavaEmbeddedIdMappingProvider INSTANCE = new JavaEmbeddedIdMappingProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static IDefaultJavaAttributeMappingProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private JavaEmbeddedIdMappingProvider() {
+ super();
+ }
+
+ public String key() {
+ return IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return EmbeddedId.ANNOTATION_NAME;
+ }
+
+ public IJavaAttributeMapping buildMapping(IJavaPersistentAttribute parent, IJpaBaseContextFactory factory) {
+ return factory.createJavaEmbeddedIdMapping(parent);
+ }
+
+ public boolean defaultApplies(IJavaPersistentAttribute persistentAttribute) {
+ return JavaEmbeddedMapping.embeddableFor(persistentAttribute) != null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMapping.java
new file mode 100644
index 0000000000..379c0c2b05
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMapping.java
@@ -0,0 +1,338 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.context.java;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IAttributeOverride;
+import org.eclipse.jpt.core.internal.context.base.IColumnMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddable;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.base.IOverride;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.IPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverrides;
+import org.eclipse.jpt.core.internal.resource.java.Embedded;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.NullAttributeOverride;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.CompositeListIterator;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+
+public class JavaEmbeddedMapping extends JavaAttributeMapping implements IJavaEmbeddedMapping
+{
+ protected final List<IJavaAttributeOverride> specifiedAttributeOverrides;
+
+ protected final List<IJavaAttributeOverride> defaultAttributeOverrides;
+
+ private IEmbeddable embeddable;
+
+ public JavaEmbeddedMapping(IJavaPersistentAttribute parent) {
+ super(parent);
+ this.specifiedAttributeOverrides = new ArrayList<IJavaAttributeOverride>();
+ this.defaultAttributeOverrides = new ArrayList<IJavaAttributeOverride>();
+ }
+
+ @Override
+ public void initializeFromResource(JavaPersistentAttributeResource persistentAttributeResource) {
+ super.initializeFromResource(persistentAttributeResource);
+ this.embeddable = embeddableFor(persistentAttribute());
+ this.initializeSpecifiedAttributeOverrides(persistentAttributeResource);
+ this.initializeDefaultAttributeOverrides(persistentAttributeResource);
+ }
+
+ protected void initializeSpecifiedAttributeOverrides(JavaPersistentAttributeResource persistentAttributeResource) {
+ ListIterator<JavaResource> annotations = persistentAttributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+
+ while(annotations.hasNext()) {
+ IJavaAttributeOverride attributeOverride = jpaFactory().createJavaAttributeOverride(this, this);
+ attributeOverride.initializeFromResource((AttributeOverride) annotations.next());
+ this.specifiedAttributeOverrides.add(attributeOverride);
+ }
+ }
+
+ protected void initializeDefaultAttributeOverrides(JavaPersistentAttributeResource persistentAttributeResource) {
+ for (Iterator<String> i = allOverridableAttributeNames(); i.hasNext(); ) {
+ String attributeName = i.next();
+ IJavaAttributeOverride attributeOverride = attributeOverrideNamed(attributeName);
+ if (attributeOverride == null) {
+ attributeOverride = createAttributeOverride(new NullAttributeOverride(persistentAttributeResource, attributeName));
+ this.defaultAttributeOverrides.add(attributeOverride);
+ }
+ }
+ }
+ //****************** IOverride.Owner implemenation *******************
+ public IColumnMapping columnMapping(String attributeName) {
+ return columnMapping(attributeName, embeddable());
+ }
+
+ public boolean isVirtual(IOverride override) {
+ return this.defaultAttributeOverrides.contains(override);
+ }
+
+ //****************** IJavaAttributeMapping implemenation *******************
+
+ public String getKey() {
+ return IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return Embedded.ANNOTATION_NAME;
+ }
+
+ public Iterator<String> correspondingAnnotationNames() {
+ return new ArrayIterator<String>(
+ JPA.ATTRIBUTE_OVERRIDE,
+ JPA.ATTRIBUTE_OVERRIDES);
+ }
+
+ //****************** IEmbeddedMapping implemenation *******************
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<IJavaAttributeOverride> attributeOverrides() {
+ return new CompositeListIterator<IJavaAttributeOverride>(specifiedAttributeOverrides(), defaultAttributeOverrides());
+ }
+
+ public ListIterator<IJavaAttributeOverride> defaultAttributeOverrides() {
+ return new CloneListIterator<IJavaAttributeOverride>(this.defaultAttributeOverrides);
+ }
+
+ public ListIterator<IJavaAttributeOverride> specifiedAttributeOverrides() {
+ return new CloneListIterator<IJavaAttributeOverride>(this.specifiedAttributeOverrides);
+ }
+
+ public int specifiedAttributeOverridesSize() {
+ return this.specifiedAttributeOverrides.size();
+ }
+
+ public IJavaAttributeOverride addSpecifiedAttributeOverride(int index) {
+ IJavaAttributeOverride attributeOverride = jpaFactory().createJavaAttributeOverride(this, this);
+ this.specifiedAttributeOverrides.add(index, attributeOverride);
+ this.persistentAttributeResource.addAnnotation(index, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ this.fireItemAdded(IEmbeddedMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, attributeOverride);
+ return attributeOverride;
+ }
+
+ protected void addSpecifiedAttributeOverride(int index, IJavaAttributeOverride attributeOverride) {
+ addItemToList(index, attributeOverride, this.specifiedAttributeOverrides, IEmbeddedMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public void removeSpecifiedAttributeOverride(int index) {
+ IJavaAttributeOverride removedAttributeOverride = this.specifiedAttributeOverrides.remove(index);
+ this.persistentAttributeResource.removeAnnotation(index, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ fireItemRemoved(IEmbeddedMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, removedAttributeOverride);
+ }
+
+ protected void removeSpecifiedAttributeOverride(IJavaAttributeOverride attributeOverride) {
+ removeItemFromList(attributeOverride, this.specifiedAttributeOverrides, IEmbeddedMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public void moveSpecifiedAttributeOverride(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedAttributeOverrides, targetIndex, sourceIndex);
+ this.persistentAttributeResource.move(targetIndex, sourceIndex, AttributeOverrides.ANNOTATION_NAME);
+ fireItemMoved(IEmbeddedMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, targetIndex, sourceIndex);
+ }
+
+ protected void addDefaultAttributeOverride(IJavaAttributeOverride attributeOverride) {
+ addItemToList(attributeOverride, this.defaultAttributeOverrides, IEmbeddedMapping.DEFAULT_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ protected void removeDefaultAttributeOverride(IJavaAttributeOverride attributeOverride) {
+ removeItemFromList(attributeOverride, this.defaultAttributeOverrides, IEmbeddedMapping.DEFAULT_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public IJavaAttributeOverride attributeOverrideNamed(String name) {
+ return (IJavaAttributeOverride) overrideNamed(name, attributeOverrides());
+ }
+
+ public boolean containsAttributeOverride(String name) {
+ return containsOverride(name, attributeOverrides());
+ }
+
+ public boolean containsDefaultAttributeOverride(String name) {
+ return containsOverride(name, defaultAttributeOverrides());
+ }
+
+ public boolean containsSpecifiedAttributeOverride(String name) {
+ return containsOverride(name, specifiedAttributeOverrides());
+ }
+
+ private IOverride overrideNamed(String name, ListIterator<? extends IOverride> overrides) {
+ for (IOverride override : CollectionTools.iterable(overrides)) {
+ String overrideName = override.getName();
+ if (overrideName == null && name == null) {
+ return override;
+ }
+ if (overrideName != null && overrideName.equals(name)) {
+ return override;
+ }
+ }
+ return null;
+ }
+
+ private boolean containsOverride(String name, ListIterator<? extends IOverride> overrides) {
+ return overrideNamed(name, overrides) != null;
+ }
+
+ public IEmbeddable embeddable() {
+ return this.embeddable;
+ }
+
+ @Override
+ public void update(JavaPersistentAttributeResource persistentAttributeResource) {
+ super.update(persistentAttributeResource);
+ this.embeddable = embeddableFor(persistentAttribute());
+ this.updateSpecifiedAttributeOverrides(persistentAttributeResource);
+ this.updateDefaultAttributeOverrides(persistentAttributeResource);
+
+ }
+ protected void updateSpecifiedAttributeOverrides(JavaPersistentAttributeResource persistentAttributeResource) {
+ ListIterator<IJavaAttributeOverride> attributeOverrides = specifiedAttributeOverrides();
+ ListIterator<JavaResource> resourceAttributeOverrides = persistentAttributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+
+ while (attributeOverrides.hasNext()) {
+ IJavaAttributeOverride attributeOverride = attributeOverrides.next();
+ if (resourceAttributeOverrides.hasNext()) {
+ attributeOverride.update((AttributeOverride) resourceAttributeOverrides.next());
+ }
+ else {
+ removeSpecifiedAttributeOverride(attributeOverride);
+ }
+ }
+
+ while (resourceAttributeOverrides.hasNext()) {
+ addSpecifiedAttributeOverride(specifiedAttributeOverridesSize(), createAttributeOverride((AttributeOverride) resourceAttributeOverrides.next()));
+ }
+ }
+
+ protected IJavaAttributeOverride createAttributeOverride(AttributeOverride attributeOverrideResource) {
+ IJavaAttributeOverride attributeOverride = jpaFactory().createJavaAttributeOverride(this, this);
+ attributeOverride.initializeFromResource(attributeOverrideResource);
+ return attributeOverride;
+ }
+
+ protected void updateDefaultAttributeOverrides(JavaPersistentAttributeResource persistentAttributeResource) {
+ for (Iterator<String> i = allOverridableAttributeNames(); i.hasNext(); ) {
+ String attributeName = i.next();
+ IJavaAttributeOverride attributeOverride = attributeOverrideNamed(attributeName);
+ if (attributeOverride == null) {
+ attributeOverride = createAttributeOverride(new NullAttributeOverride(persistentAttributeResource, attributeName));
+ addDefaultAttributeOverride(attributeOverride);
+ }
+ else if (attributeOverride.isVirtual()) {
+ attributeOverride.update(new NullAttributeOverride(persistentAttributeResource, attributeName));
+ }
+ }
+
+ Collection<String> attributeNames = CollectionTools.collection(allOverridableAttributeNames());
+
+ //remove any default mappings that are not included in the attributeNames collection
+ for (IJavaAttributeOverride attributeOverride : CollectionTools.iterable(defaultAttributeOverrides())) {
+ if (!attributeNames.contains(attributeOverride.getName())
+ || containsSpecifiedAttributeOverride(attributeOverride.getName())) {
+ removeDefaultAttributeOverride(attributeOverride);
+ }
+ }
+ }
+
+ public Iterator<String> allOverridableAttributeNames() {
+ return new TransformationIterator<IPersistentAttribute, String>(this.allOverridableAttributes()) {
+ @Override
+ protected String transform(IPersistentAttribute attribute) {
+ return attribute.getName();
+ }
+ };
+ }
+
+ public Iterator<IPersistentAttribute> allOverridableAttributes() {
+ if (this.embeddable() == null) {
+ return EmptyIterator.instance();
+ }
+ return new FilteringIterator<IPersistentAttribute, IPersistentAttribute>(this.embeddable().persistentType().attributes()) {
+ @Override
+ protected boolean accept(IPersistentAttribute o) {
+ return o.isOverridableAttribute();
+ }
+ };
+ }
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ for (IAttributeOverride override : CollectionTools.iterable(this.attributeOverrides())) {
+ result = ((IJavaAttributeOverride) override).candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+
+ //******** Validation ******************
+
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+
+ for (Iterator<IJavaAttributeOverride> stream = attributeOverrides(); stream.hasNext();) {
+ stream.next().addToMessages(messages, astRoot);
+ }
+ }
+
+ //******* static methods *********
+
+ public static IEmbeddable embeddableFor(IJavaPersistentAttribute persistentAttribute) {
+ String qualifiedTypeName = persistentAttribute.getPersistentAttributeResource().getQualifiedTypeName();
+ if (qualifiedTypeName == null) {
+ return null;
+ }
+ IPersistentType persistentType = persistentAttribute.persistenceUnit().persistentType(qualifiedTypeName);
+ if (persistentType != null) {
+ if (persistentType.mappingKey() == IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY) {
+ return (IEmbeddable) persistentType.getMapping();
+ }
+ }
+ return null;
+ }
+
+ public static IColumnMapping columnMapping(String attributeName, IEmbeddable embeddable) {
+ if (attributeName == null || embeddable == null) {
+ return null;
+ }
+ for (Iterator<IPersistentAttribute> stream = embeddable.persistentType().allAttributes(); stream.hasNext();) {
+ IPersistentAttribute persAttribute = stream.next();
+ if (attributeName.equals(persAttribute.getName())) {
+ if (persAttribute.getMapping() instanceof IColumnMapping) {
+ return (IColumnMapping) persAttribute.getMapping();
+ }
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMappingProvider.java
new file mode 100644
index 0000000000..becb3925a1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMappingProvider.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.java.Embedded;
+
+public class JavaEmbeddedMappingProvider
+ implements IDefaultJavaAttributeMappingProvider
+{
+
+ // singleton
+ private static final JavaEmbeddedMappingProvider INSTANCE = new JavaEmbeddedMappingProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static IDefaultJavaAttributeMappingProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private JavaEmbeddedMappingProvider() {
+ super();
+ }
+
+ public String key() {
+ return IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return Embedded.ANNOTATION_NAME;
+ }
+
+ public IJavaAttributeMapping buildMapping(IJavaPersistentAttribute parent, IJpaBaseContextFactory factory) {
+ return factory.createJavaEmbeddedMapping(parent);
+ }
+
+ public boolean defaultApplies(IJavaPersistentAttribute persistentAttribute) {
+ return JavaEmbeddedMapping.embeddableFor(persistentAttribute) != null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntity.java
new file mode 100644
index 0000000000..02d9e89b23
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntity.java
@@ -0,0 +1,1649 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.context.java;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.DiscriminatorType;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IAttributeOverride;
+import org.eclipse.jpt.core.internal.context.base.IColumnMapping;
+import org.eclipse.jpt.core.internal.context.base.IDiscriminatorColumn;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.INamedColumn;
+import org.eclipse.jpt.core.internal.context.base.IOverride;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.IPersistentType;
+import org.eclipse.jpt.core.internal.context.base.IPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.ISecondaryTable;
+import org.eclipse.jpt.core.internal.context.base.ITable;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.context.base.InheritanceType;
+import org.eclipse.jpt.core.internal.resource.java.AssociationOverride;
+import org.eclipse.jpt.core.internal.resource.java.AssociationOverrides;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverrides;
+import org.eclipse.jpt.core.internal.resource.java.DiscriminatorValue;
+import org.eclipse.jpt.core.internal.resource.java.Entity;
+import org.eclipse.jpt.core.internal.resource.java.IdClass;
+import org.eclipse.jpt.core.internal.resource.java.Inheritance;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueries;
+import org.eclipse.jpt.core.internal.resource.java.NamedNativeQuery;
+import org.eclipse.jpt.core.internal.resource.java.NamedQueries;
+import org.eclipse.jpt.core.internal.resource.java.NamedQuery;
+import org.eclipse.jpt.core.internal.resource.java.NullAssociationOverride;
+import org.eclipse.jpt.core.internal.resource.java.NullAttributeOverride;
+import org.eclipse.jpt.core.internal.resource.java.NullColumn;
+import org.eclipse.jpt.core.internal.resource.java.NullPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumns;
+import org.eclipse.jpt.core.internal.resource.java.SecondaryTable;
+import org.eclipse.jpt.core.internal.resource.java.SecondaryTables;
+import org.eclipse.jpt.core.internal.resource.java.SequenceGenerator;
+import org.eclipse.jpt.core.internal.resource.java.TableGenerator;
+import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+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.FilteringIterator;
+import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.utility.internal.node.Node;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+
+public class JavaEntity extends JavaTypeMapping implements IJavaEntity
+{
+ protected Entity entityResource;
+
+ protected String specifiedName;
+
+ protected String defaultName;
+
+ protected final IJavaTable table;
+
+ protected final List<IJavaSecondaryTable> specifiedSecondaryTables;
+
+ protected final List<IJavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns;
+
+ protected IJavaPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
+
+ protected InheritanceType specifiedInheritanceStrategy;
+
+ protected InheritanceType defaultInheritanceStrategy;
+
+ protected String defaultDiscriminatorValue;
+
+ protected String specifiedDiscriminatorValue;
+
+ protected final IJavaDiscriminatorColumn discriminatorColumn;
+
+ protected IJavaSequenceGenerator sequenceGenerator;
+
+ protected IJavaTableGenerator tableGenerator;
+
+ protected final List<IJavaAttributeOverride> specifiedAttributeOverrides;
+
+ protected final List<IJavaAttributeOverride> defaultAttributeOverrides;
+
+ protected final List<IJavaAssociationOverride> specifiedAssociationOverrides;
+
+ protected final List<IJavaAssociationOverride> defaultAssociationOverrides;
+
+ protected final List<IJavaNamedQuery> namedQueries;
+
+ protected final List<IJavaNamedNativeQuery> namedNativeQueries;
+
+ protected String idClass;
+
+
+ public JavaEntity(IJavaPersistentType parent) {
+ super(parent);
+ this.table = jpaFactory().createJavaTable(this);
+ this.discriminatorColumn = createJavaDiscriminatorColumn();
+ this.specifiedSecondaryTables = new ArrayList<IJavaSecondaryTable>();
+ this.specifiedPrimaryKeyJoinColumns = new ArrayList<IJavaPrimaryKeyJoinColumn>();
+ this.defaultPrimaryKeyJoinColumn = this.jpaFactory().createJavaPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner());
+ this.specifiedAttributeOverrides = new ArrayList<IJavaAttributeOverride>();
+ this.defaultAttributeOverrides = new ArrayList<IJavaAttributeOverride>();
+ this.namedQueries = new ArrayList<IJavaNamedQuery>();
+ this.namedNativeQueries = new ArrayList<IJavaNamedNativeQuery>();
+ this.specifiedAssociationOverrides = new ArrayList<IJavaAssociationOverride>();
+ this.defaultAssociationOverrides = new ArrayList<IJavaAssociationOverride>();
+
+ }
+
+ protected IAbstractJoinColumn.Owner createPrimaryKeyJoinColumnOwner() {
+ return new PrimaryKeyJoinColumnOwner();
+ }
+
+ protected IJavaDiscriminatorColumn createJavaDiscriminatorColumn() {
+ return jpaFactory().createJavaDiscriminatorColumn(this, buildDiscriminatorColumnOwner());
+ }
+
+ protected INamedColumn.Owner buildDiscriminatorColumnOwner() {
+ return new INamedColumn.Owner(){
+ public Table dbTable(String tableName) {
+ return JavaEntity.this.dbTable(tableName);
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ return JavaEntity.this.validationTextRange(astRoot);
+ }
+
+ public ITypeMapping typeMapping() {
+ return JavaEntity.this;
+ }
+
+ public String defaultColumnName() {
+ return IDiscriminatorColumn.DEFAULT_NAME;
+ }
+ };
+ }
+
+ @Override
+ public void initializeFromResource(JavaPersistentTypeResource persistentTypeResource) {
+ super.initializeFromResource(persistentTypeResource);
+ this.entityResource = (Entity) persistentTypeResource.mappingAnnotation(Entity.ANNOTATION_NAME);
+
+ this.specifiedName = this.specifiedName(this.entityResource);
+ this.defaultName = this.defaultName(persistentTypeResource);
+ this.table.initializeFromResource(persistentTypeResource);
+ this.defaultInheritanceStrategy = this.defaultInheritanceStrategy();
+ this.specifiedInheritanceStrategy = this.specifiedInheritanceStrategy(inheritanceResource());
+ this.specifiedDiscriminatorValue = this.discriminatorValueResource().getValue();
+ this.defaultDiscriminatorValue = this.javaDefaultDiscriminatorValue();
+ this.discriminatorColumn.initializeFromResource(persistentTypeResource);
+ this.initializeSecondaryTables(persistentTypeResource);
+ this.initializeTableGenerator(persistentTypeResource);
+ this.initializeSequenceGenerator(persistentTypeResource);
+ this.initializePrimaryKeyJoinColumns(persistentTypeResource);
+ this.initializeSpecifiedAttributeOverrides(persistentTypeResource);
+ this.initializeDefaultAttributeOverrides(persistentTypeResource);
+ this.initializeSpecifiedAssociationOverrides(persistentTypeResource);
+ this.initializeDefaultAssociationOverrides(persistentTypeResource);
+ this.initializeNamedQueries(persistentTypeResource);
+ this.initializeNamedNativeQueries(persistentTypeResource);
+ this.initializeIdClass(persistentTypeResource);
+ }
+
+ protected void initializeSecondaryTables(JavaPersistentTypeResource persistentTypeResource) {
+ ListIterator<JavaResource> annotations = persistentTypeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME);
+
+ while(annotations.hasNext()) {
+ this.specifiedSecondaryTables.add(createSecondaryTable((SecondaryTable) annotations.next()));
+ }
+ }
+
+ protected void initializeTableGenerator(JavaPersistentTypeResource persistentTypeResource) {
+ TableGenerator tableGeneratorResource = tableGenerator(persistentTypeResource);
+ if (tableGeneratorResource != null) {
+ this.tableGenerator = jpaFactory().createJavaTableGenerator(this);
+ this.tableGenerator.initializeFromResource(tableGeneratorResource);
+ }
+ }
+
+ protected void initializeSequenceGenerator(JavaPersistentTypeResource persistentTypeResource) {
+ SequenceGenerator sequenceGeneratorResource = sequenceGenerator(persistentTypeResource);
+ if (sequenceGeneratorResource != null) {
+ this.sequenceGenerator = jpaFactory().createJavaSequenceGenerator(this);
+ this.sequenceGenerator.initializeFromResource(sequenceGeneratorResource);
+ }
+ }
+
+ protected void initializePrimaryKeyJoinColumns(JavaPersistentTypeResource persistentTypeResource) {
+ ListIterator<JavaResource> annotations = persistentTypeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+
+ while(annotations.hasNext()) {
+ this.specifiedPrimaryKeyJoinColumns.add(createPrimaryKeyJoinColumn((PrimaryKeyJoinColumn) annotations.next()));
+ }
+ }
+
+ protected void initializeSpecifiedAttributeOverrides(JavaPersistentTypeResource persistentTypeResource) {
+ ListIterator<JavaResource> annotations = persistentTypeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+
+ while(annotations.hasNext()) {
+ this.specifiedAttributeOverrides.add(createAttributeOverride((AttributeOverride) annotations.next()));
+ }
+ }
+
+ protected void initializeDefaultAttributeOverrides(JavaPersistentTypeResource persistentTypeResource) {
+ for (Iterator<String> i = allOverridableAttributeNames(); i.hasNext(); ) {
+ String attributeName = i.next();
+ IJavaAttributeOverride attributeOverride = attributeOverrideNamed(attributeName);
+ if (attributeOverride == null) {
+ attributeOverride = createAttributeOverride(new NullAttributeOverride(persistentTypeResource, attributeName));
+ this.defaultAttributeOverrides.add(attributeOverride);
+ }
+ }
+ }
+
+ protected void initializeSpecifiedAssociationOverrides(JavaPersistentTypeResource persistentTypeResource) {
+ ListIterator<JavaResource> annotations = persistentTypeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+
+ while(annotations.hasNext()) {
+ this.specifiedAssociationOverrides.add(createAssociationOverride((AssociationOverride) annotations.next()));
+ }
+ }
+
+ protected void initializeDefaultAssociationOverrides(JavaPersistentTypeResource persistentTypeResource) {
+ for (Iterator<String> i = allOverridableAssociationNames(); i.hasNext(); ) {
+ String associationName = i.next();
+ IJavaAssociationOverride associationOverride = associationOverrideNamed(associationName);
+ if (associationOverride == null) {
+ associationOverride = createAssociationOverride(new NullAssociationOverride(persistentTypeResource, associationName));
+ this.defaultAssociationOverrides.add(associationOverride);
+ }
+ }
+ }
+
+ protected void initializeNamedQueries(JavaPersistentTypeResource persistentTypeResource) {
+ ListIterator<JavaResource> annotations = persistentTypeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+
+ while(annotations.hasNext()) {
+ this.namedQueries.add(createNamedQuery((NamedQuery) annotations.next()));
+ }
+ }
+
+ protected void initializeNamedNativeQueries(JavaPersistentTypeResource persistentTypeResource) {
+ ListIterator<JavaResource> annotations = persistentTypeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+
+ while(annotations.hasNext()) {
+ this.namedNativeQueries.add(createNamedNativeQuery((NamedNativeQuery) annotations.next()));
+ }
+ }
+
+ //query for the table resource every time on setters.
+ //call one setter and the tableResource could change.
+ //You could call more than one setter before this object has received any notification
+ //from the java resource model
+ protected Inheritance inheritanceResource() {
+ //TODO get the NullInheritance from the resource model or build it here in the context model??
+ return (Inheritance) this.persistentTypeResource.nonNullAnnotation(Inheritance.ANNOTATION_NAME);
+ }
+
+ protected DiscriminatorValue discriminatorValueResource() {
+ return (DiscriminatorValue) this.persistentTypeResource.nonNullAnnotation(DiscriminatorValue.ANNOTATION_NAME);
+ }
+
+ protected void initializeIdClass(JavaPersistentTypeResource typeResource) {
+ IdClass idClassResource = (IdClass) typeResource.annotation(IdClass.ANNOTATION_NAME);
+ if (idClassResource != null) {
+ this.idClass = idClassResource.getValue();
+ }
+ }
+
+ //****************** IJavaTypeMapping implemenation *******************
+
+ public String annotationName() {
+ return Entity.ANNOTATION_NAME;
+ }
+
+ public String getKey() {
+ return IMappingKeys.ENTITY_TYPE_MAPPING_KEY;
+ }
+
+ public Iterator<String> correspondingAnnotationNames() {
+ return new ArrayIterator<String>(
+ JPA.TABLE,
+ JPA.SECONDARY_TABLE,
+ JPA.SECONDARY_TABLES,
+ JPA.PRIMARY_KEY_JOIN_COLUMN,
+ JPA.PRIMARY_KEY_JOIN_COLUMNS,
+ JPA.ID_CLASS,
+ JPA.INHERITANCE,
+ JPA.DISCRIMINATOR_VALUE,
+ JPA.DISCRIMINATOR_COLUMN,
+ JPA.SEQUENCE_GENERATOR,
+ JPA.TABLE_GENERATOR,
+ JPA.NAMED_QUERY,
+ JPA.NAMED_QUERIES,
+ JPA.NAMED_NATIVE_QUERY,
+ JPA.NAMED_NATIVE_QUERIES,
+ JPA.SQL_RESULT_SET_MAPPING,
+ JPA.EXCLUDE_DEFAULT_LISTENERS,
+ JPA.EXCLUDE_SUPERCLASS_LISTENERS,
+ JPA.ENTITY_LISTENERS,
+ JPA.PRE_PERSIST,
+ JPA.POST_PERSIST,
+ JPA.PRE_REMOVE,
+ JPA.POST_REMOVE,
+ JPA.PRE_UPDATE,
+ JPA.POST_UPDATE,
+ JPA.POST_LOAD,
+ JPA.ATTRIBUTE_OVERRIDE,
+ JPA.ATTRIBUTE_OVERRIDES,
+ JPA.ASSOCIATION_OVERRIDE,
+ JPA.ASSOCIATION_OVERRIDES);
+ }
+
+ public boolean isMapped() {
+ return true;
+ }
+
+ public String getName() {
+ return (this.getSpecifiedName() == null) ? this.getDefaultName() : this.getSpecifiedName();
+ }
+
+ //****************** IEntity implemenation *******************
+
+ public String getSpecifiedName() {
+ return this.specifiedName;
+ }
+
+ public void setSpecifiedName(String newSpecifiedName) {
+ String oldSpecifiedName = this.specifiedName;
+ this.specifiedName = newSpecifiedName;
+ this.entityResource.setName(newSpecifiedName);
+ firePropertyChanged(IEntity.SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
+ }
+
+ public String getDefaultName() {
+ return this.defaultName;
+ }
+
+ protected/*private-protected*/ void setDefaultName(String newDefaultName) {
+ String oldDefaultName = this.defaultName;
+ this.defaultName = newDefaultName;
+ firePropertyChanged(IEntity.DEFAULT_NAME_PROPERTY, oldDefaultName, newDefaultName);
+ }
+
+ public IJavaTable getTable() {
+ return this.table;
+ }
+
+ public ListIterator<IJavaSecondaryTable> specifiedSecondaryTables() {
+ return new CloneListIterator<IJavaSecondaryTable>(this.specifiedSecondaryTables);
+ }
+
+ public int specifiedSecondaryTablesSize() {
+ return this.specifiedSecondaryTables.size();
+ }
+
+ public IJavaSecondaryTable addSpecifiedSecondaryTable(int index) {
+ IJavaSecondaryTable secondaryTable = jpaFactory().createJavaSecondaryTable(this);
+ this.specifiedSecondaryTables.add(index, secondaryTable);
+ this.persistentTypeResource.addAnnotation(index, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME);
+ fireItemAdded(IEntity.SPECIFIED_SECONDARY_TABLES_LIST, index, secondaryTable);
+ return secondaryTable;
+ }
+
+ protected void addSpecifiedSecondaryTable(int index, IJavaSecondaryTable secondaryTable) {
+ addItemToList(index, secondaryTable, this.specifiedSecondaryTables, IEntity.SPECIFIED_SECONDARY_TABLES_LIST);
+ }
+
+ public void removeSpecifiedSecondaryTable(int index) {
+ IJavaSecondaryTable removedSecondaryTable = this.specifiedSecondaryTables.remove(index);
+ this.persistentTypeResource.removeAnnotation(index, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME);
+ fireItemRemoved(IEntity.SPECIFIED_SECONDARY_TABLES_LIST, index, removedSecondaryTable);
+ }
+
+ protected void removeSpecifiedSecondaryTable(IJavaSecondaryTable secondaryTable) {
+ removeItemFromList(secondaryTable, this.specifiedSecondaryTables, IEntity.SPECIFIED_SECONDARY_TABLES_LIST);
+ }
+
+ public void moveSpecifiedSecondaryTable(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedSecondaryTables, targetIndex, sourceIndex);
+ this.persistentTypeResource.move(targetIndex, sourceIndex, SecondaryTables.ANNOTATION_NAME);
+ fireItemMoved(IEntity.SPECIFIED_SECONDARY_TABLES_LIST, targetIndex, sourceIndex);
+ }
+
+ public ListIterator<IJavaSecondaryTable> secondaryTables() {
+ return specifiedSecondaryTables();
+ }
+
+ public int secondaryTablesSize() {
+ return specifiedSecondaryTablesSize();
+ }
+//TODO
+// public boolean containsSecondaryTable(String name) {
+// return containsSecondaryTable(name, getSecondaryTables());
+// }
+//
+// public boolean containsSpecifiedSecondaryTable(String name) {
+// return containsSecondaryTable(name, getSpecifiedSecondaryTables());
+// }
+//
+// private boolean containsSecondaryTable(String name, List<ISecondaryTable> secondaryTables) {
+// for (ISecondaryTable secondaryTable : secondaryTables) {
+// String secondaryTableName = secondaryTable.getName();
+// if (secondaryTableName != null && secondaryTableName.equals(name)) {
+// return true;
+// }
+// }
+// return false;
+// }
+//
+ public InheritanceType getInheritanceStrategy() {
+ return (this.getSpecifiedInheritanceStrategy() == null) ? this.getDefaultInheritanceStrategy() : this.getSpecifiedInheritanceStrategy();
+ }
+
+ public InheritanceType getDefaultInheritanceStrategy() {
+ return this.defaultInheritanceStrategy;
+ }
+
+ protected void setDefaultInheritanceStrategy(InheritanceType newInheritanceType) {
+ InheritanceType oldInheritanceType = this.defaultInheritanceStrategy;
+ this.defaultInheritanceStrategy = newInheritanceType;
+ firePropertyChanged(DEFAULT_INHERITANCE_STRATEGY_PROPERTY, oldInheritanceType, newInheritanceType);
+ }
+
+ public InheritanceType getSpecifiedInheritanceStrategy() {
+ return this.specifiedInheritanceStrategy;
+ }
+
+ public void setSpecifiedInheritanceStrategy(InheritanceType newInheritanceType) {
+ InheritanceType oldInheritanceType = this.specifiedInheritanceStrategy;
+ this.specifiedInheritanceStrategy = newInheritanceType;
+ inheritanceResource().setStrategy(InheritanceType.toJavaResourceModel(newInheritanceType));
+ firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, oldInheritanceType, newInheritanceType);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedInheritanceStrategy_(InheritanceType newInheritanceType) {
+ InheritanceType oldInheritanceType = this.specifiedInheritanceStrategy;
+ this.specifiedInheritanceStrategy = newInheritanceType;
+ firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, oldInheritanceType, newInheritanceType);
+ }
+
+ public IJavaDiscriminatorColumn getDiscriminatorColumn() {
+ return this.discriminatorColumn;
+ }
+
+ public String getDefaultDiscriminatorValue() {
+ return this.defaultDiscriminatorValue;
+ }
+
+ protected void setDefaultDiscriminatorValue(String newDefaultDiscriminatorValue) {
+ String oldDefaultDiscriminatorValue = this.defaultDiscriminatorValue;
+ this.defaultDiscriminatorValue = newDefaultDiscriminatorValue;
+ firePropertyChanged(DEFAULT_DISCRIMINATOR_VALUE_PROPERTY, oldDefaultDiscriminatorValue, newDefaultDiscriminatorValue);
+ }
+
+ public String getSpecifiedDiscriminatorValue() {
+ return this.specifiedDiscriminatorValue;
+ }
+
+ public void setSpecifiedDiscriminatorValue(String newSpecifiedDiscriminatorValue) {
+ String oldSpecifiedDiscriminatorValue = this.specifiedDiscriminatorValue;
+ this.specifiedDiscriminatorValue = newSpecifiedDiscriminatorValue;
+ discriminatorValueResource().setValue(newSpecifiedDiscriminatorValue);
+ firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY, oldSpecifiedDiscriminatorValue, newSpecifiedDiscriminatorValue);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedDiscriminatorValue_(String newSpecifiedDiscriminatorValue) {
+ String oldSpecifiedDiscriminatorValue = this.specifiedDiscriminatorValue;
+ this.specifiedDiscriminatorValue = newSpecifiedDiscriminatorValue;
+ firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY, oldSpecifiedDiscriminatorValue, newSpecifiedDiscriminatorValue);
+ }
+
+ public String getDiscriminatorValue() {
+ return (this.getSpecifiedDiscriminatorValue() == null) ? getDefaultDiscriminatorValue() : this.getSpecifiedDiscriminatorValue();
+ }
+
+ public IJavaTableGenerator addTableGenerator() {
+ if (getTableGenerator() != null) {
+ throw new IllegalStateException("tableGenerator already exists");
+ }
+ this.tableGenerator = jpaFactory().createJavaTableGenerator(this);
+ this.persistentTypeResource.addAnnotation(TableGenerator.ANNOTATION_NAME);
+ firePropertyChanged(TABLE_GENERATOR_PROPERTY, null, this.tableGenerator);
+ return this.tableGenerator;
+ }
+
+ public void removeTableGenerator() {
+ if (getTableGenerator() == null) {
+ throw new IllegalStateException("tableGenerator does not exist, cannot be removed");
+ }
+ IJavaTableGenerator oldTableGenerator = this.tableGenerator;
+ this.tableGenerator = null;
+ this.persistentTypeResource.removeAnnotation(TableGenerator.ANNOTATION_NAME);
+ firePropertyChanged(TABLE_GENERATOR_PROPERTY, oldTableGenerator, null);
+ }
+
+ public IJavaTableGenerator getTableGenerator() {
+ return this.tableGenerator;
+ }
+
+ protected void setTableGenerator(IJavaTableGenerator newTableGenerator) {
+ IJavaTableGenerator oldTableGenerator = this.tableGenerator;
+ this.tableGenerator = newTableGenerator;
+ firePropertyChanged(TABLE_GENERATOR_PROPERTY, oldTableGenerator, newTableGenerator);
+ }
+
+ public IJavaSequenceGenerator addSequenceGenerator() {
+ if (getSequenceGenerator() != null) {
+ throw new IllegalStateException("sequenceGenerator already exists");
+ }
+ this.sequenceGenerator = jpaFactory().createJavaSequenceGenerator(this);
+ this.persistentTypeResource.addAnnotation(SequenceGenerator.ANNOTATION_NAME);
+ firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, null, this.sequenceGenerator);
+ return this.sequenceGenerator;
+ }
+
+ public void removeSequenceGenerator() {
+ if (getSequenceGenerator() == null) {
+ throw new IllegalStateException("sequenceGenerator does not exist, cannot be removed");
+ }
+ IJavaSequenceGenerator oldSequenceGenerator = this.sequenceGenerator;
+ this.sequenceGenerator = null;
+ this.persistentTypeResource.removeAnnotation(SequenceGenerator.ANNOTATION_NAME);
+ firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, oldSequenceGenerator,null);
+ }
+
+ public IJavaSequenceGenerator getSequenceGenerator() {
+ return this.sequenceGenerator;
+ }
+
+ protected void setSequenceGenerator(IJavaSequenceGenerator newSequenceGenerator) {
+ IJavaSequenceGenerator oldSequenceGenerator = this.sequenceGenerator;
+ this.sequenceGenerator = newSequenceGenerator;
+ firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, oldSequenceGenerator, newSequenceGenerator);
+ }
+
+ public ListIterator<IJavaPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
+ return this.specifiedPrimaryKeyJoinColumns.isEmpty() ? this.defaultPrimaryKeyJoinColumns() : this.specifiedPrimaryKeyJoinColumns();
+ }
+
+ public ListIterator<IJavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
+ return new CloneListIterator<IJavaPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
+ }
+
+ public ListIterator<IJavaPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns() {
+ return new SingleElementListIterator<IJavaPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumn);
+ }
+
+ public IPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
+ IJavaPrimaryKeyJoinColumn primaryKeyJoinColumn = jpaFactory().createJavaPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner());
+ this.specifiedPrimaryKeyJoinColumns.add(index, primaryKeyJoinColumn);
+ this.persistentTypeResource.addAnnotation(index, PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+ this.fireItemAdded(IEntity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, primaryKeyJoinColumn);
+ return primaryKeyJoinColumn;
+ }
+
+ protected void addSpecifiedPrimaryKeyJoinColumn(int index, IJavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
+ addItemToList(index, primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, IEntity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
+ IJavaPrimaryKeyJoinColumn removedPrimaryKeyJoinColumn = this.specifiedPrimaryKeyJoinColumns.remove(index);
+ this.persistentTypeResource.removeAnnotation(index, PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+ fireItemRemoved(IEntity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, removedPrimaryKeyJoinColumn);
+ }
+
+ protected void removeSpecifiedPrimaryKeyJoinColumn(IJavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
+ removeItemFromList(primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, IEntity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
+ this.persistentTypeResource.move(targetIndex, sourceIndex, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+ moveItemInList(targetIndex, sourceIndex, this.specifiedPrimaryKeyJoinColumns, IEntity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ public int specifiedPrimaryKeyJoinColumnsSize() {
+ return this.specifiedPrimaryKeyJoinColumns.size();
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<IJavaAttributeOverride> attributeOverrides() {
+ return new CompositeListIterator<IJavaAttributeOverride>(specifiedAttributeOverrides(), defaultAttributeOverrides());
+ }
+
+ public ListIterator<IJavaAttributeOverride> defaultAttributeOverrides() {
+ return new CloneListIterator<IJavaAttributeOverride>(this.defaultAttributeOverrides);
+ }
+
+ public ListIterator<IJavaAttributeOverride> specifiedAttributeOverrides() {
+ return new CloneListIterator<IJavaAttributeOverride>(this.specifiedAttributeOverrides);
+ }
+
+ public int specifiedAttributeOverridesSize() {
+ return this.specifiedAttributeOverrides.size();
+ }
+
+ public IJavaAttributeOverride addSpecifiedAttributeOverride(int index) {
+ IJavaAttributeOverride attributeOverride = jpaFactory().createJavaAttributeOverride(this, createAttributeOverrideOwner());
+ this.specifiedAttributeOverrides.add(index, attributeOverride);
+ this.persistentTypeResource.addAnnotation(index, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ this.fireItemAdded(IEntity.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, attributeOverride);
+ return attributeOverride;
+ }
+
+ protected IOverride.Owner createAttributeOverrideOwner() {
+ return new AttributeOverrideOwner();
+ }
+
+ protected void addSpecifiedAttributeOverride(int index, IJavaAttributeOverride attributeOverride) {
+ addItemToList(index, attributeOverride, this.specifiedAttributeOverrides, IEntity.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public void removeSpecifiedAttributeOverride(int index) {
+ IJavaAttributeOverride removedAttributeOverride = this.specifiedAttributeOverrides.remove(index);
+ this.persistentTypeResource.removeAnnotation(index, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ fireItemRemoved(IEntity.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, removedAttributeOverride);
+ }
+
+ protected void removeSpecifiedAttributeOverride(IJavaAttributeOverride attributeOverride) {
+ removeItemFromList(attributeOverride, this.specifiedAttributeOverrides, IEntity.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public void moveSpecifiedAttributeOverride(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedAttributeOverrides, targetIndex, sourceIndex);
+ this.persistentTypeResource.move(targetIndex, sourceIndex, AttributeOverrides.ANNOTATION_NAME);
+ fireItemMoved(IEntity.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, targetIndex, sourceIndex);
+ }
+
+ protected void addDefaultAttributeOverride(IJavaAttributeOverride attributeOverride) {
+ addItemToList(attributeOverride, this.defaultAttributeOverrides, IEntity.DEFAULT_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ protected void removeDefaultAttributeOverride(IJavaAttributeOverride attributeOverride) {
+ removeItemFromList(attributeOverride, this.defaultAttributeOverrides, IEntity.DEFAULT_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public IJavaAttributeOverride attributeOverrideNamed(String name) {
+ return (IJavaAttributeOverride) overrideNamed(name, attributeOverrides());
+ }
+
+ public boolean containsAttributeOverride(String name) {
+ return containsOverride(name, attributeOverrides());
+ }
+
+ public boolean containsDefaultAttributeOverride(String name) {
+ return containsOverride(name, defaultAttributeOverrides());
+ }
+
+ public boolean containsSpecifiedAttributeOverride(String name) {
+ return containsOverride(name, specifiedAttributeOverrides());
+ }
+
+ public IJavaAssociationOverride associationOverrideNamed(String name) {
+ return (IJavaAssociationOverride) overrideNamed(name, associationOverrides());
+ }
+
+ public boolean containsAssociationOverride(String name) {
+ return containsOverride(name, associationOverrides());
+ }
+
+ public boolean containsSpecifiedAssociationOverride(String name) {
+ return containsOverride(name, specifiedAssociationOverrides());
+ }
+
+ public boolean containsDefaultAssociationOverride(String name) {
+ return containsOverride(name, defaultAssociationOverrides());
+ }
+
+ private IOverride overrideNamed(String name, ListIterator<? extends IOverride> overrides) {
+ for (IOverride override : CollectionTools.iterable(overrides)) {
+ String overrideName = override.getName();
+ if (overrideName == null && name == null) {
+ return override;
+ }
+ if (overrideName != null && overrideName.equals(name)) {
+ return override;
+ }
+ }
+ return null;
+ }
+
+ private boolean containsOverride(String name, ListIterator<? extends IOverride> overrides) {
+ return overrideNamed(name, overrides) != null;
+ }
+
+ public IJavaAssociationOverride addSpecifiedAssociationOverride(int index) {
+ IJavaAssociationOverride associationOverride = jpaFactory().createJavaAssociationOverride(this, createAssociationOverrideOwner());
+ this.specifiedAssociationOverrides.add(index, associationOverride);
+ this.persistentTypeResource.addAnnotation(index, AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ this.fireItemAdded(IEntity.SPECIFIED_ASSOCIATION_OVERRIDES_LIST, index, associationOverride);
+ return associationOverride;
+ }
+
+ protected IOverride.Owner createAssociationOverrideOwner() {
+ return new AssociationOverrideOwner();
+ }
+
+ protected void addSpecifiedAssociationOverride(int index, IJavaAssociationOverride associationOverride) {
+ addItemToList(index, associationOverride, this.specifiedAssociationOverrides, IEntity.SPECIFIED_ASSOCIATION_OVERRIDES_LIST);
+ }
+
+ public void removeSpecifiedAssociationOverride(int index) {
+ IJavaAssociationOverride removedAssociationOverride = this.specifiedAssociationOverrides.remove(index);
+ this.persistentTypeResource.removeAnnotation(index, AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ fireItemRemoved(IEntity.SPECIFIED_ASSOCIATION_OVERRIDES_LIST, index, removedAssociationOverride);
+ }
+
+ protected void removeSpecifiedAssociationOverride(IJavaAssociationOverride associationOverride) {
+ removeItemFromList(associationOverride, this.specifiedAssociationOverrides, IEntity.SPECIFIED_ASSOCIATION_OVERRIDES_LIST);
+ }
+
+ public void moveSpecifiedAssociationOverride(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedAssociationOverrides, targetIndex, sourceIndex);
+ this.persistentTypeResource.move(targetIndex, sourceIndex, AssociationOverrides.ANNOTATION_NAME);
+ fireItemMoved(IEntity.SPECIFIED_ASSOCIATION_OVERRIDES_LIST, targetIndex, sourceIndex);
+ }
+
+ protected void addDefaultAssociationOverride(IJavaAssociationOverride associationOverride) {
+ addItemToList(associationOverride, this.defaultAssociationOverrides, IEntity.DEFAULT_ASSOCIATION_OVERRIDES_LIST);
+ }
+
+ protected void removeDefaultAssociationOverride(IJavaAssociationOverride associationOverride) {
+ removeItemFromList(associationOverride, this.defaultAssociationOverrides, IEntity.DEFAULT_ASSOCIATION_OVERRIDES_LIST);
+ }
+
+ public ListIterator<IJavaNamedQuery> namedQueries() {
+ return new CloneListIterator<IJavaNamedQuery>(this.namedQueries);
+ }
+
+ public int namedQueriesSize() {
+ return this.namedQueries.size();
+ }
+
+ public IJavaNamedQuery addNamedQuery(int index) {
+ IJavaNamedQuery namedQuery = jpaFactory().createJavaNamedQuery(this);
+ this.namedQueries.add(index, namedQuery);
+ this.persistentTypeResource.addAnnotation(index, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ fireItemAdded(IEntity.NAMED_QUERIES_LIST, index, namedQuery);
+ return namedQuery;
+ }
+
+ protected void addNamedQuery(int index, IJavaNamedQuery namedQuery) {
+ addItemToList(index, namedQuery, this.namedQueries, IEntity.NAMED_QUERIES_LIST);
+ }
+
+ public void removeNamedQuery(int index) {
+ IJavaNamedQuery removedNamedQuery = this.namedQueries.remove(index);
+ this.persistentTypeResource.removeAnnotation(index, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ fireItemRemoved(IEntity.NAMED_QUERIES_LIST, index, removedNamedQuery);
+ }
+
+ protected void removeNamedQuery(IJavaNamedQuery namedQuery) {
+ removeItemFromList(namedQuery, this.namedQueries, IEntity.NAMED_QUERIES_LIST);
+ }
+
+ public void moveNamedQuery(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.namedQueries, targetIndex, sourceIndex);
+ this.persistentTypeResource.move(targetIndex, sourceIndex, NamedQueries.ANNOTATION_NAME);
+ fireItemMoved(IEntity.NAMED_QUERIES_LIST, targetIndex, sourceIndex);
+ }
+
+ public ListIterator<IJavaNamedNativeQuery> namedNativeQueries() {
+ return new CloneListIterator<IJavaNamedNativeQuery>(this.namedNativeQueries);
+ }
+
+ public int namedNativeQueriesSize() {
+ return this.namedNativeQueries.size();
+ }
+
+ public IJavaNamedNativeQuery addNamedNativeQuery(int index) {
+ IJavaNamedNativeQuery namedNativeQuery = jpaFactory().createJavaNamedNativeQuery(this);
+ this.namedNativeQueries.add(index, namedNativeQuery);
+ this.persistentTypeResource.addAnnotation(index, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ fireItemAdded(IEntity.NAMED_NATIVE_QUERIES_LIST, index, namedNativeQuery);
+ return namedNativeQuery;
+ }
+
+ protected void addNamedNativeQuery(int index, IJavaNamedNativeQuery namedNativeQuery) {
+ addItemToList(index, namedNativeQuery, this.namedNativeQueries, IEntity.NAMED_NATIVE_QUERIES_LIST);
+ }
+
+ public void removeNamedNativeQuery(int index) {
+ IJavaNamedNativeQuery removedNamedNativeQuery = this.namedNativeQueries.remove(index);
+ this.persistentTypeResource.removeAnnotation(index, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ fireItemRemoved(IEntity.NAMED_NATIVE_QUERIES_LIST, index, removedNamedNativeQuery);
+ }
+
+ protected void removeNamedNativeQuery(IJavaNamedNativeQuery namedNativeQuery) {
+ removeItemFromList(namedNativeQuery, this.namedNativeQueries, IEntity.NAMED_NATIVE_QUERIES_LIST);
+ }
+
+ public void moveNamedNativeQuery(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.namedNativeQueries, targetIndex, sourceIndex);
+ this.persistentTypeResource.move(targetIndex, sourceIndex, NamedNativeQueries.ANNOTATION_NAME);
+ fireItemMoved(IEntity.NAMED_NATIVE_QUERIES_LIST, targetIndex, sourceIndex);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<IJavaAssociationOverride> associationOverrides() {
+ return new CompositeListIterator<IJavaAssociationOverride>(specifiedAssociationOverrides(), defaultAssociationOverrides());
+ }
+
+ public ListIterator<IJavaAssociationOverride> defaultAssociationOverrides() {
+ return new CloneListIterator<IJavaAssociationOverride>(this.defaultAssociationOverrides);
+ }
+
+ public ListIterator<IJavaAssociationOverride> specifiedAssociationOverrides() {
+ return new CloneListIterator<IJavaAssociationOverride>(this.specifiedAssociationOverrides);
+ }
+
+ public int specifiedAssociationOverridesSize() {
+ return this.specifiedAssociationOverrides.size();
+ }
+
+ public String getIdClass() {
+ return this.idClass;
+ }
+
+ public void setIdClass(String newIdClass) {
+ String oldIdClass = this.idClass;
+ this.idClass = newIdClass;
+ if (newIdClass != oldIdClass) {
+ if (newIdClass != null) {
+ if (idClassResource() == null) {
+ addIdClassResource();
+ }
+ idClassResource().setValue(newIdClass);
+ }
+ else {
+ removeIdClassResource();
+ }
+ }
+ firePropertyChanged(IEntity.ID_CLASS_PROPERTY, oldIdClass, newIdClass);
+ }
+
+ protected void setIdClass_(String newIdClass) {
+ String oldIdClass = this.idClass;
+ this.idClass = newIdClass;
+ firePropertyChanged(IEntity.ID_CLASS_PROPERTY, oldIdClass, newIdClass);
+ }
+
+ protected IdClass idClassResource() {
+ return (IdClass) this.persistentTypeResource.annotation(IdClass.ANNOTATION_NAME);
+ }
+
+ protected void addIdClassResource() {
+ this.persistentTypeResource.addAnnotation(IdClass.ANNOTATION_NAME);
+ }
+
+ protected void removeIdClassResource() {
+ this.persistentTypeResource.removeAnnotation(IdClass.ANNOTATION_NAME);
+ }
+//TODO
+// public boolean discriminatorValueIsAllowed() {
+// return !getType().isAbstract();
+// }
+//
+ public IEntity parentEntity() {
+ for (Iterator<IPersistentType> i = persistentType().inheritanceHierarchy(); i.hasNext();) {
+ ITypeMapping typeMapping = i.next().getMapping();
+ if (typeMapping != this && typeMapping instanceof IEntity) {
+ return (IEntity) typeMapping;
+ }
+ }
+ return this;
+ }
+
+ public ITypeMapping typeMapping() {
+ return this;
+ }
+
+ public IEntity rootEntity() {
+ IEntity rootEntity = this;
+ for (Iterator<IPersistentType> i = persistentType().inheritanceHierarchy(); i.hasNext();) {
+ IPersistentType persistentType = i.next();
+ if (persistentType.getMapping() instanceof IEntity) {
+ rootEntity = (IEntity) persistentType.getMapping();
+ }
+ }
+ return rootEntity;
+ }
+
+ @Override
+ public String getTableName() {
+ return getTable().getName();
+ }
+
+ @Override
+ public Table primaryDbTable() {
+ return getTable().dbTable();
+ }
+
+ @Override
+ public Table dbTable(String tableName) {
+ for (Iterator<ITable> stream = this.associatedTablesIncludingInherited(); stream.hasNext();) {
+ Table dbTable = stream.next().dbTable();
+ if (dbTable != null && dbTable.matchesShortJavaClassName(tableName)) {
+ return dbTable;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Schema dbSchema() {
+ return getTable().dbSchema();
+ }
+
+ @Override
+ public void update(JavaPersistentTypeResource persistentTypeResource) {
+ super.update(persistentTypeResource);
+ this.entityResource = (Entity) persistentTypeResource.mappingAnnotation(Entity.ANNOTATION_NAME);
+
+ this.setSpecifiedName(this.specifiedName(this.entityResource));
+ this.setDefaultName(this.defaultName(persistentTypeResource));
+
+ this.updateTable(persistentTypeResource);
+ this.updateInheritance(inheritanceResource());
+ this.updateDiscriminatorColumn(persistentTypeResource);
+ this.updateDiscriminatorValue(discriminatorValueResource());
+ this.updateSecondaryTables(persistentTypeResource);
+ this.updateTableGenerator(persistentTypeResource);
+ this.updateSequenceGenerator(persistentTypeResource);
+ this.updateSpecifiedPrimaryKeyJoinColumns(persistentTypeResource);
+ this.updateDefaultPrimaryKeyJoinColumns(persistentTypeResource);
+ this.updateSpecifiedAttributeOverrides(persistentTypeResource);
+ this.updateDefaultAttributeOverrides(persistentTypeResource);
+ this.updateSpecifiedAssociationOverrides(persistentTypeResource);
+ this.updateDefaultAssociationOverrides(persistentTypeResource);
+ this.updateNamedQueries(persistentTypeResource);
+ this.updateNamedNativeQueries(persistentTypeResource);
+ this.updateIdClass(persistentTypeResource);
+ }
+
+ protected String specifiedName(Entity entityResource) {
+ return entityResource.getName();
+ }
+
+ protected String defaultName(JavaPersistentTypeResource persistentTypeResource) {
+ return persistentTypeResource.getName();
+ }
+
+ protected void updateTable(JavaPersistentTypeResource persistentTypeResource) {
+ getTable().update(persistentTypeResource);
+ }
+
+ protected void updateInheritance(Inheritance inheritanceResource) {
+ this.setSpecifiedInheritanceStrategy_(this.specifiedInheritanceStrategy(inheritanceResource));
+ this.setDefaultInheritanceStrategy(this.defaultInheritanceStrategy());
+ }
+
+ protected InheritanceType specifiedInheritanceStrategy(Inheritance inheritanceResource) {
+ return InheritanceType.fromJavaResourceModel(inheritanceResource.getStrategy());
+ }
+
+ protected InheritanceType defaultInheritanceStrategy() {
+ if (rootEntity() == this) {
+ return InheritanceType.SINGLE_TABLE;
+ }
+ return rootEntity().getInheritanceStrategy();
+ }
+
+ protected void updateDiscriminatorColumn(JavaPersistentTypeResource persistentTypeResource) {
+ getDiscriminatorColumn().update(persistentTypeResource);
+ }
+
+ protected void updateDiscriminatorValue(DiscriminatorValue discriminatorValueResource) {
+ this.setSpecifiedDiscriminatorValue_(discriminatorValueResource.getValue());
+ this.setDefaultDiscriminatorValue(this.javaDefaultDiscriminatorValue());
+ }
+
+ protected void updateSecondaryTables(JavaPersistentTypeResource persistentTypeResource) {
+ ListIterator<IJavaSecondaryTable> secondaryTables = specifiedSecondaryTables();
+ ListIterator<JavaResource> resourceSecondaryTables = persistentTypeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME);
+
+ while (secondaryTables.hasNext()) {
+ IJavaSecondaryTable secondaryTable = secondaryTables.next();
+ if (resourceSecondaryTables.hasNext()) {
+ secondaryTable.update((SecondaryTable) resourceSecondaryTables.next());
+ }
+ else {
+ removeSpecifiedSecondaryTable(secondaryTable);
+ }
+ }
+
+ while (resourceSecondaryTables.hasNext()) {
+ addSpecifiedSecondaryTable(specifiedSecondaryTablesSize(), createSecondaryTable((SecondaryTable) resourceSecondaryTables.next()));
+ }
+ }
+
+ protected IJavaSecondaryTable createSecondaryTable(SecondaryTable secondaryTableResource) {
+ IJavaSecondaryTable secondaryTable = jpaFactory().createJavaSecondaryTable(this);
+ secondaryTable.initializeFromResource(secondaryTableResource);
+ return secondaryTable;
+ }
+
+ protected void updateTableGenerator(JavaPersistentTypeResource persistentTypeResource) {
+ TableGenerator tableGeneratorResource = tableGenerator(persistentTypeResource);
+ if (tableGeneratorResource == null) {
+ if (getTableGenerator() != null) {
+ setTableGenerator(null);
+ }
+ }
+ else {
+ if (getTableGenerator() == null) {
+ setTableGenerator(jpaFactory().createJavaTableGenerator(this));
+ getTableGenerator().initializeFromResource(tableGeneratorResource);
+ }
+ else {
+ getTableGenerator().update(tableGeneratorResource);
+ }
+ }
+ }
+
+ protected void updateSequenceGenerator(JavaPersistentTypeResource persistentTypeResource) {
+ SequenceGenerator sequenceGeneratorResource = sequenceGenerator(persistentTypeResource);
+ if (sequenceGeneratorResource == null) {
+ if (getSequenceGenerator() != null) {
+ setSequenceGenerator(null);
+ }
+ }
+ else {
+ if (getSequenceGenerator() == null) {
+ setSequenceGenerator(jpaFactory().createJavaSequenceGenerator(this));
+ getSequenceGenerator().initializeFromResource(sequenceGeneratorResource);
+ }
+ else {
+ getSequenceGenerator().update(sequenceGeneratorResource);
+ }
+ }
+ }
+
+ protected TableGenerator tableGenerator(JavaPersistentTypeResource persistentTypeResource) {
+ return (TableGenerator) persistentTypeResource.annotation(TableGenerator.ANNOTATION_NAME);
+ }
+
+ protected SequenceGenerator sequenceGenerator(JavaPersistentTypeResource persistentTypeResource) {
+ return (SequenceGenerator) persistentTypeResource.annotation(SequenceGenerator.ANNOTATION_NAME);
+ }
+
+
+ protected void updateSpecifiedPrimaryKeyJoinColumns(JavaPersistentTypeResource persistentTypeResource) {
+ ListIterator<IJavaPrimaryKeyJoinColumn> primaryKeyJoinColumns = specifiedPrimaryKeyJoinColumns();
+ ListIterator<JavaResource> resourcePrimaryKeyJoinColumns = persistentTypeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+
+ while (primaryKeyJoinColumns.hasNext()) {
+ IJavaPrimaryKeyJoinColumn primaryKeyJoinColumn = primaryKeyJoinColumns.next();
+ if (resourcePrimaryKeyJoinColumns.hasNext()) {
+ primaryKeyJoinColumn.update((PrimaryKeyJoinColumn) resourcePrimaryKeyJoinColumns.next());
+ }
+ else {
+ removeSpecifiedPrimaryKeyJoinColumn(primaryKeyJoinColumn);
+ }
+ }
+
+ while (resourcePrimaryKeyJoinColumns.hasNext()) {
+ addSpecifiedPrimaryKeyJoinColumn(specifiedPrimaryKeyJoinColumnsSize(), createPrimaryKeyJoinColumn((PrimaryKeyJoinColumn) resourcePrimaryKeyJoinColumns.next()));
+ }
+ }
+
+ protected IJavaPrimaryKeyJoinColumn createPrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumnResource) {
+ IJavaPrimaryKeyJoinColumn primaryKeyJoinColumn = jpaFactory().createJavaPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner());
+ primaryKeyJoinColumn.initializeFromResource(primaryKeyJoinColumnResource);
+ return primaryKeyJoinColumn;
+ }
+
+ protected void updateDefaultPrimaryKeyJoinColumns(JavaPersistentTypeResource persistentTypeResource) {
+ this.defaultPrimaryKeyJoinColumn.update(new NullPrimaryKeyJoinColumn(persistentTypeResource));
+ }
+
+ protected void updateSpecifiedAttributeOverrides(JavaPersistentTypeResource persistentTypeResource) {
+ ListIterator<IJavaAttributeOverride> attributeOverrides = specifiedAttributeOverrides();
+ ListIterator<JavaResource> resourceAttributeOverrides = persistentTypeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+
+ while (attributeOverrides.hasNext()) {
+ IJavaAttributeOverride attributeOverride = attributeOverrides.next();
+ if (resourceAttributeOverrides.hasNext()) {
+ attributeOverride.update((AttributeOverride) resourceAttributeOverrides.next());
+ }
+ else {
+ removeSpecifiedAttributeOverride(attributeOverride);
+ }
+ }
+
+ while (resourceAttributeOverrides.hasNext()) {
+ addSpecifiedAttributeOverride(specifiedAttributeOverridesSize(), createAttributeOverride((AttributeOverride) resourceAttributeOverrides.next()));
+ }
+ }
+
+ protected IJavaAttributeOverride createAttributeOverride(AttributeOverride attributeOverrideResource) {
+ IJavaAttributeOverride attributeOverride = jpaFactory().createJavaAttributeOverride(this, createAttributeOverrideOwner());
+ attributeOverride.initializeFromResource(attributeOverrideResource);
+ return attributeOverride;
+ }
+
+ protected void updateDefaultAttributeOverrides(JavaPersistentTypeResource persistentTypeResource) {
+ for (Iterator<String> i = allOverridableAttributeNames(); i.hasNext(); ) {
+ String attributeName = i.next();
+ IJavaAttributeOverride attributeOverride = attributeOverrideNamed(attributeName);
+ if (attributeOverride == null) {
+ attributeOverride = createAttributeOverride(new NullAttributeOverride(persistentTypeResource, attributeName));
+ addDefaultAttributeOverride(attributeOverride);
+ }
+ else if (attributeOverride.isVirtual()) {
+ attributeOverride.getColumn().update(new NullColumn(persistentTypeResource));
+ }
+ }
+
+ Collection<String> attributeNames = CollectionTools.collection(allOverridableAttributeNames());
+
+ //remove any default mappings that are not included in the attributeNames collection
+ for (IJavaAttributeOverride attributeOverride : CollectionTools.iterable(defaultAttributeOverrides())) {
+ if (!attributeNames.contains(attributeOverride.getName())
+ || containsSpecifiedAttributeOverride(attributeOverride.getName())) {
+ removeDefaultAttributeOverride(attributeOverride);
+ }
+ }
+ }
+
+ protected void updateSpecifiedAssociationOverrides(JavaPersistentTypeResource persistentTypeResource) {
+ ListIterator<IJavaAssociationOverride> associationOverrides = specifiedAssociationOverrides();
+ ListIterator<JavaResource> resourceAssociationOverrides = persistentTypeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+
+ while (associationOverrides.hasNext()) {
+ IJavaAssociationOverride associationOverride = associationOverrides.next();
+ if (resourceAssociationOverrides.hasNext()) {
+ associationOverride.update((AssociationOverride) resourceAssociationOverrides.next());
+ }
+ else {
+ removeSpecifiedAssociationOverride(associationOverride);
+ }
+ }
+
+ while (resourceAssociationOverrides.hasNext()) {
+ addSpecifiedAssociationOverride(specifiedAssociationOverridesSize(), createAssociationOverride((AssociationOverride) resourceAssociationOverrides.next()));
+ }
+ }
+
+ protected IJavaAssociationOverride createAssociationOverride(AssociationOverride associationOverrideResource) {
+ IJavaAssociationOverride associationOverride = jpaFactory().createJavaAssociationOverride(this, createAssociationOverrideOwner());
+ associationOverride.initializeFromResource(associationOverrideResource);
+ return associationOverride;
+ }
+
+ protected void updateDefaultAssociationOverrides(JavaPersistentTypeResource persistentTypeResource) {
+ for (Iterator<String> i = allOverridableAssociationNames(); i.hasNext(); ) {
+ String associationName = i.next();
+ IJavaAssociationOverride associationOverride = associationOverrideNamed(associationName);
+ if (associationOverride == null) {
+ associationOverride = createAssociationOverride(new NullAssociationOverride(persistentTypeResource, associationName));
+ addDefaultAssociationOverride(associationOverride);
+ }
+ else if (associationOverride.isVirtual()) {
+ //TODO what is this about for attributeOverrides???
+ //associationOverride.getColumn().update(new NullColumn(persistentTypeResource));
+ }
+ }
+
+ Collection<String> associationNames = CollectionTools.collection(allOverridableAssociationNames());
+
+ //remove any default mappings that are not included in the associationNames collection
+ for (IJavaAssociationOverride associationOverride : CollectionTools.iterable(defaultAssociationOverrides())) {
+ if (!associationNames.contains(associationOverride.getName())
+ || containsSpecifiedAssociationOverride(associationOverride.getName())) {
+ removeDefaultAssociationOverride(associationOverride);
+ }
+ }
+ }
+
+ protected void updateNamedQueries(JavaPersistentTypeResource persistentTypeResource) {
+ ListIterator<IJavaNamedQuery> namedQueries = namedQueries();
+ ListIterator<JavaResource> resourceNamedQueries = persistentTypeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+
+ while (namedQueries.hasNext()) {
+ IJavaNamedQuery namedQuery = namedQueries.next();
+ if (resourceNamedQueries.hasNext()) {
+ namedQuery.update((NamedQuery) resourceNamedQueries.next());
+ }
+ else {
+ removeNamedQuery(namedQuery);
+ }
+ }
+
+ while (resourceNamedQueries.hasNext()) {
+ addNamedQuery(namedQueriesSize(), createNamedQuery((NamedQuery) resourceNamedQueries.next()));
+ }
+ }
+
+ protected void updateNamedNativeQueries(JavaPersistentTypeResource persistentTypeResource) {
+ ListIterator<IJavaNamedNativeQuery> namedNativeQueries = namedNativeQueries();
+ ListIterator<JavaResource> resourceNamedNativeQueries = persistentTypeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+
+ while (namedNativeQueries.hasNext()) {
+ IJavaNamedNativeQuery namedQuery = namedNativeQueries.next();
+ if (resourceNamedNativeQueries.hasNext()) {
+ namedQuery.update((NamedNativeQuery) resourceNamedNativeQueries.next());
+ }
+ else {
+ removeNamedNativeQuery(namedQuery);
+ }
+ }
+
+ while (resourceNamedNativeQueries.hasNext()) {
+ addNamedNativeQuery(namedQueriesSize(), createNamedNativeQuery((NamedNativeQuery) resourceNamedNativeQueries.next()));
+ }
+ }
+
+
+ protected IJavaNamedQuery createNamedQuery(NamedQuery namedQueryResource) {
+ IJavaNamedQuery namedQuery = jpaFactory().createJavaNamedQuery(this);
+ namedQuery.initializeFromResource(namedQueryResource);
+ return namedQuery;
+ }
+
+ protected IJavaNamedNativeQuery createNamedNativeQuery(NamedNativeQuery namedNativeQueryResource) {
+ IJavaNamedNativeQuery namedNativeQuery = jpaFactory().createJavaNamedNativeQuery(this);
+ namedNativeQuery.initializeFromResource(namedNativeQueryResource);
+ return namedNativeQuery;
+ }
+
+ protected void updateIdClass(JavaPersistentTypeResource typeResource) {
+ IdClass idClass = (IdClass) typeResource.annotation(IdClass.ANNOTATION_NAME);
+ if (idClass != null) {
+ setIdClass_(idClass.getValue());
+ }
+ else {
+ setIdClass_(null);
+ }
+ }
+
+ /**
+ * From the Spec:
+ * If the DiscriminatorValue annotation is not specified, a
+ * provider-specific function to generate a value representing
+ * the entity type is used for the value of the discriminator
+ * column. If the DiscriminatorType is STRING, the discriminator
+ * value default is the entity name.
+ *
+ * TODO extension point for provider-specific function?
+ */
+ protected String javaDefaultDiscriminatorValue() {
+ if (this.persistentTypeResource.isAbstract()) {
+ return null;
+ }
+ if (this.discriminatorType() != DiscriminatorType.STRING) {
+ return null;
+ }
+ return this.getName();
+ }
+
+ protected DiscriminatorType discriminatorType() {
+ return this.getDiscriminatorColumn().getDiscriminatorType();
+ }
+
+ public String primaryKeyColumnName() {
+ String pkColumnName = null;
+ for (Iterator<IPersistentAttribute> stream = persistentType().allAttributes(); stream.hasNext();) {
+ IPersistentAttribute attribute = stream.next();
+ String name = attribute.primaryKeyColumnName();
+ if (pkColumnName == null) {
+ pkColumnName = name;
+ }
+ else if (name != null) {
+ // if we encounter a composite primary key, return null
+ return null;
+ }
+ }
+ // if we encounter only a single primary key column name, return it
+ return pkColumnName;
+ }
+//TODO
+// public String primaryKeyAttributeName() {
+// String pkColumnName = null;
+// String pkAttributeName = null;
+// for (Iterator<IPersistentAttribute> stream = getPersistentType().allAttributes(); stream.hasNext();) {
+// IPersistentAttribute attribute = stream.next();
+// String name = attribute.primaryKeyColumnName();
+// if (pkColumnName == null) {
+// pkColumnName = name;
+// pkAttributeName = attribute.getName();
+// }
+// else if (name != null) {
+// // if we encounter a composite primary key, return null
+// return null;
+// }
+// }
+// // if we encounter only a single primary key column name, return it
+// return pkAttributeName;
+// }
+
+ @Override
+ public boolean tableNameIsInvalid(String tableName) {
+ return !CollectionTools.contains(this.associatedTableNamesIncludingInherited(), tableName);
+ }
+
+ @Override
+ public Iterator<ITable> associatedTables() {
+ return new CompositeIterator<ITable>(this.getTable(), this.secondaryTables());
+ }
+
+ @Override
+ public Iterator<ITable> associatedTablesIncludingInherited() {
+ return new CompositeIterator<ITable>(new TransformationIterator<ITypeMapping, Iterator<ITable>>(this.inheritanceHierarchy()) {
+ @Override
+ protected Iterator<ITable> transform(ITypeMapping mapping) {
+ return new FilteringIterator<ITable, ITable>(mapping.associatedTables()) {
+ @Override
+ protected boolean accept(ITable o) {
+ return true;
+ //TODO
+ //filtering these out so as to avoid the duplicate table, root and children share the same table
+ //return !(o instanceof SingleTableInheritanceChildTableImpl);
+ }
+ };
+ }
+ });
+ }
+
+ @Override
+ public Iterator<String> associatedTableNamesIncludingInherited() {
+ return this.nonNullTableNames(this.associatedTablesIncludingInherited());
+ }
+
+ protected Iterator<String> nonNullTableNames(Iterator<ITable> tables) {
+ return new FilteringIterator<String, String>(this.tableNames(tables)) {
+ @Override
+ protected boolean accept(String o) {
+ return o != null;
+ }
+ };
+ }
+
+ protected Iterator<String> tableNames(Iterator<ITable> tables) {
+ return new TransformationIterator<ITable, String>(tables) {
+ @Override
+ protected String transform(ITable t) {
+ return t.getName();
+ }
+ };
+ }
+
+ /**
+ * Return an iterator of Entities, each which inherits from the one before,
+ * and terminates at the root entity (or at the point of cyclicity).
+ */
+ protected Iterator<ITypeMapping> inheritanceHierarchy() {
+ return new TransformationIterator<IPersistentType, ITypeMapping>(persistentType().inheritanceHierarchy()) {
+ @Override
+ protected ITypeMapping transform(IPersistentType type) {
+ return type.getMapping();
+ }
+ };
+ }
+
+ @Override
+ public Iterator<String> allOverridableAttributeNames() {
+ return new CompositeIterator<String>(new TransformationIterator<ITypeMapping, Iterator<String>>(this.inheritanceHierarchy()) {
+ @Override
+ protected Iterator<String> transform(ITypeMapping mapping) {
+ return mapping.overridableAttributeNames();
+ }
+ });
+ }
+
+ @Override
+ public Iterator<String> allOverridableAssociationNames() {
+ return new CompositeIterator<String>(new TransformationIterator<ITypeMapping, Iterator<String>>(this.inheritanceHierarchy()) {
+ @Override
+ protected Iterator<String> transform(ITypeMapping mapping) {
+ return mapping.overridableAssociationNames();
+ }
+ });
+ }
+
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.getTable().candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ for (IJavaSecondaryTable sTable : CollectionTools.iterable(this.secondaryTables())) {
+ result = sTable.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ for (IJavaPrimaryKeyJoinColumn column : CollectionTools.iterable(this.primaryKeyJoinColumns())) {
+ result = column.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ for (IJavaAttributeOverride override : CollectionTools.iterable(this.attributeOverrides())) {
+ result = override.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ for (IJavaAssociationOverride override : CollectionTools.iterable(this.associationOverrides())) {
+ result = override.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ result = this.getDiscriminatorColumn().candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ IJavaTableGenerator jtg = this.getTableGenerator();
+ if (jtg != null) {
+ result = jtg.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ IJavaSequenceGenerator jsg = this.getSequenceGenerator();
+ if (jsg != null) {
+ result = jsg.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+
+ //********** Validation ********************************************
+
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+
+ addTableMessages(messages, astRoot);
+ addIdMessages(messages, astRoot);
+
+ for (IJavaSecondaryTable context : specifiedSecondaryTables) {
+ context.addToMessages(messages, astRoot);
+ }
+
+ for (Iterator<IJavaAttributeOverride> stream = this.attributeOverrides(); stream.hasNext();) {
+ stream.next().addToMessages(messages, astRoot);
+ }
+
+ for (Iterator<IJavaAssociationOverride> stream = this.associationOverrides(); stream.hasNext();) {
+ stream.next().addToMessages(messages, astRoot);
+ }
+
+ }
+
+ protected void addTableMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ boolean doContinue = table.isConnected();
+ String schema = table.getSchema();
+
+ if (doContinue && ! table.hasResolvedSchema()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.TABLE_UNRESOLVED_SCHEMA,
+ new String[] {schema, table.getName()},
+ table, table.schemaTextRange(astRoot))
+ );
+ doContinue = false;
+ }
+
+ if (doContinue && ! table.isResolved()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.TABLE_UNRESOLVED_NAME,
+ new String[] {table.getName()},
+ table, table.nameTextRange(astRoot))
+ );
+ }
+ }
+
+
+ protected void addIdMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ addNoIdMessage(messages, astRoot);
+
+ }
+
+ protected void addNoIdMessage(List<IMessage> messages, CompilationUnit astRoot) {
+ if (entityHasNoId()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.ENTITY_NO_ID,
+ new String[] {this.getName()},
+ this, this.validationTextRange(astRoot))
+ );
+ }
+ }
+
+ private boolean entityHasNoId() {
+ return ! this.entityHasId();
+ }
+
+ private boolean entityHasId() {
+ for (Iterator<IPersistentAttribute> stream = persistentType().allAttributes(); stream.hasNext(); ) {
+ if (stream.next().isIdAttribute()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ class PrimaryKeyJoinColumnOwner implements IAbstractJoinColumn.Owner
+ {
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ return JavaEntity.this.validationTextRange(astRoot);
+ }
+
+ public ITypeMapping typeMapping() {
+ return JavaEntity.this;
+ }
+
+ public Table dbTable(String tableName) {
+ return JavaEntity.this.dbTable(tableName);
+ }
+
+ public Table dbReferencedColumnTable() {
+ IEntity parentEntity = JavaEntity.this.parentEntity();
+ return (parentEntity == null) ? null : parentEntity.primaryDbTable();
+ }
+
+ public int joinColumnsSize() {
+ return CollectionTools.size(JavaEntity.this.primaryKeyJoinColumns());
+ }
+
+ public boolean isVirtual(IAbstractJoinColumn joinColumn) {
+ return JavaEntity.this.defaultPrimaryKeyJoinColumn == joinColumn;
+ }
+
+ public String defaultColumnName() {
+ if (joinColumnsSize() != 1) {
+ return null;
+ }
+ return JavaEntity.this.parentEntity().primaryKeyColumnName();
+ }
+ }
+
+ class AttributeOverrideOwner implements IOverride.Owner {
+
+ public IColumnMapping columnMapping(String attributeName) {
+ if (attributeName == null) {
+ return null;
+ }
+ for (Iterator<IPersistentAttribute> stream = persistentType().allAttributes(); stream.hasNext();) {
+ IPersistentAttribute persAttribute = stream.next();
+ if (attributeName.equals(persAttribute.getName())) {
+ if (persAttribute.getMapping() instanceof IColumnMapping) {
+ return (IColumnMapping) persAttribute.getMapping();
+ }
+ }
+ }
+ return null;
+ }
+
+ public boolean isVirtual(IOverride override) {
+ return JavaEntity.this.defaultAttributeOverrides.contains(override);
+ }
+
+ public ITypeMapping typeMapping() {
+ return JavaEntity.this;
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ }
+
+ class AssociationOverrideOwner implements IOverride.Owner {
+
+ public IColumnMapping columnMapping(String attributeName) {
+ if (attributeName == null) {
+ return null;
+ }
+ for (Iterator<IPersistentAttribute> stream = persistentType().allAttributes(); stream.hasNext();) {
+ IPersistentAttribute persAttribute = stream.next();
+ if (attributeName.equals(persAttribute.getName())) {
+ if (persAttribute.getMapping() instanceof IColumnMapping) {
+ return (IColumnMapping) persAttribute.getMapping();
+ }
+ }
+ }
+ return null;
+ }
+
+ public boolean isVirtual(IOverride override) {
+ return JavaEntity.this.defaultAssociationOverrides.contains(override);
+ }
+
+ public ITypeMapping typeMapping() {
+ return JavaEntity.this;
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEntityProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityProvider.java
index fd83986be8..0133b89bef 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaEntityProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityProvider.java
@@ -7,14 +7,11 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.java.mappings;
+package org.eclipse.jpt.core.internal.context.java;
-import org.eclipse.jpt.core.internal.IJpaFactory;
import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMappingProvider;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.java.Entity;
/**
*
@@ -43,13 +40,13 @@ public class JavaEntityProvider
public String key() {
return IMappingKeys.ENTITY_TYPE_MAPPING_KEY;
}
-
- public IJavaTypeMapping buildMapping(Type type, IJpaFactory factory) {
- return factory.createJavaEntity(type);
+
+ public String annotationName() {
+ return Entity.ANNOTATION_NAME;
}
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return JavaEntity.DECLARATION_ANNOTATION_ADAPTER;
+ public IJavaTypeMapping buildMapping(IJavaPersistentType parent, IJpaBaseContextFactory factory) {
+ return factory.createJavaEntity(parent);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaGeneratedValue.java
new file mode 100644
index 0000000000..3085861e51
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaGeneratedValue.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.GenerationType;
+import org.eclipse.jpt.core.internal.context.base.IGeneratedValue;
+import org.eclipse.jpt.core.internal.resource.java.GeneratedValue;
+
+
+public class JavaGeneratedValue extends JavaContextModel implements IJavaGeneratedValue
+{
+ protected GenerationType strategy;
+
+ protected String generator;
+
+ protected String defaultGenerator;
+
+ protected GeneratedValue generatedValueResource;
+
+ public JavaGeneratedValue(IJavaAttributeMapping parent) {
+ super(parent);
+ }
+
+ public void initializeFromResource(GeneratedValue generatedValue) {
+ this.generatedValueResource = generatedValue;
+ this.strategy = this.strategy(generatedValue);
+ this.generator = this.generator(generatedValue);
+ }
+
+ public GenerationType getStrategy() {
+ return (this.getSpecifiedStrategy() == null) ? this.getDefaultStrategy() : this.getSpecifiedStrategy();
+ }
+
+ public GenerationType getDefaultStrategy() {
+ return IGeneratedValue.DEFAULT_STRATEGY;
+ }
+
+ public GenerationType getSpecifiedStrategy() {
+ return this.strategy;
+ }
+
+ public void setSpecifiedStrategy(GenerationType newStrategy) {
+ GenerationType oldStrategy = this.strategy;
+ this.strategy = newStrategy;
+ this.generatedValueResource.setStrategy(GenerationType.toJavaResourceModel(newStrategy));
+ firePropertyChanged(IGeneratedValue.SPECIFIED_STRATEGY_PROPERTY, oldStrategy, newStrategy);
+ }
+
+ public String getGenerator() {
+ return (this.getSpecifiedGenerator() == null) ? this.getDefaultGenerator() : this.getSpecifiedGenerator();
+ }
+
+ public String getSpecifiedGenerator() {
+ return this.generator;
+ }
+
+ public String getDefaultGenerator() {
+ return this.defaultGenerator;
+ }
+
+ public void setSpecifiedGenerator(String newGenerator) {
+ String oldGenerator = this.generator;
+ this.generator = newGenerator;
+ this.generatedValueResource.setGenerator(newGenerator);
+ firePropertyChanged(IGeneratedValue.SPECIFIED_GENERATOR_PROPERTY, oldGenerator, newGenerator);
+ }
+
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ return null;//TODO //this.member.annotationTextRange(DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public ITextRange generatorTextRange(CompilationUnit astRoot) {
+ return this.generatedValueResource.generatorTextRange(astRoot);
+ }
+
+ // ********** resource model -> java context model **********
+
+ public void update(GeneratedValue generatedValue) {
+ this.generatedValueResource = generatedValue;
+ setSpecifiedStrategy(this.strategy(generatedValue));
+ setSpecifiedGenerator(this.generator(generatedValue));
+ }
+
+ protected GenerationType strategy(GeneratedValue generatedValue) {
+ return GenerationType.fromJavaResourceModel(generatedValue.getStrategy());
+ }
+
+ protected String generator(GeneratedValue generatedValue) {
+ return generatedValue.getGenerator();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaGenerator.java
new file mode 100644
index 0000000000..e404ecc1ea
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaGenerator.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IGenerator;
+import org.eclipse.jpt.core.internal.resource.java.Generator;
+
+
+public abstract class JavaGenerator<T extends Generator> extends JavaContextModel implements IJavaGenerator<T>
+{
+ protected String name;
+
+ protected Integer specifiedInitialValue;
+
+ protected Integer specifiedAllocationSize;
+
+ protected T generatorResource;
+
+ protected JavaGenerator(IJavaJpaContextNode parent) {
+ super(parent);
+ }
+
+ public void initializeFromResource(T generatorResource) {
+ this.generatorResource = generatorResource;
+ this.name = this.name(generatorResource);
+ this.specifiedInitialValue = this.specifiedInitialValue(generatorResource);
+ this.specifiedAllocationSize = this.specifiedAllocationSize(generatorResource);
+ }
+
+ protected T generatorResource() {
+ return this.generatorResource;
+ }
+
+ protected String name(Generator generatorResource) {
+ return generatorResource.getName();
+ }
+
+ protected Integer specifiedInitialValue(Generator generatorResource) {
+ return generatorResource.getInitialValue();
+ }
+
+ protected Integer specifiedAllocationSize(Generator generatorResource) {
+ return generatorResource.getAllocationSize();
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ generatorResource().setName(newName);
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ protected void setName_(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public Integer getInitialValue() {
+ return (this.getSpecifiedInitialValue() == null) ? this.getDefaultInitialValue() : this.getSpecifiedInitialValue();
+ }
+
+ public Integer getSpecifiedInitialValue() {
+ return this.specifiedInitialValue;
+ }
+
+ public void setSpecifiedInitialValue(Integer newSpecifiedInitialValue) {
+ Integer oldSpecifiedInitialValue = this.specifiedInitialValue;
+ this.specifiedInitialValue = newSpecifiedInitialValue;
+ generatorResource().setInitialValue(newSpecifiedInitialValue);
+ firePropertyChanged(SPECIFIED_INITIAL_VALUE_PROPERTY, oldSpecifiedInitialValue, newSpecifiedInitialValue);
+ }
+
+ protected void setSpecifiedInitialValue_(Integer newSpecifiedInitialValue) {
+ Integer oldSpecifiedInitialValue = this.specifiedInitialValue;
+ this.specifiedInitialValue = newSpecifiedInitialValue;
+ firePropertyChanged(SPECIFIED_INITIAL_VALUE_PROPERTY, oldSpecifiedInitialValue, newSpecifiedInitialValue);
+ }
+
+ public Integer getAllocationSize() {
+ return (this.getSpecifiedAllocationSize() == null) ? this.getDefaultAllocationSize() : this.getSpecifiedAllocationSize();
+ }
+
+ public Integer getSpecifiedAllocationSize() {
+ return this.specifiedAllocationSize;
+ }
+
+ public void setSpecifiedAllocationSize(Integer newSpecifiedAllocationSize) {
+ Integer oldSpecifiedAllocationSize = this.specifiedAllocationSize;
+ this.specifiedAllocationSize = newSpecifiedAllocationSize;
+ generatorResource().setAllocationSize(newSpecifiedAllocationSize);
+ firePropertyChanged(SPECIFIED_ALLOCATION_SIZE_PROPERTY, oldSpecifiedAllocationSize, newSpecifiedAllocationSize);
+ }
+
+ protected void setSpecifiedAllocationSize_(Integer newSpecifiedAllocationSize) {
+ Integer oldSpecifiedAllocationSize = this.specifiedAllocationSize;
+ this.specifiedAllocationSize = newSpecifiedAllocationSize;
+ firePropertyChanged(SPECIFIED_ALLOCATION_SIZE_PROPERTY, oldSpecifiedAllocationSize, newSpecifiedAllocationSize);
+ }
+
+ public Integer getDefaultAllocationSize() {
+ return IGenerator.DEFAULT_ALLOCATION_SIZE;
+ }
+
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ return this.selectionTextRange(astRoot);
+ }
+
+ public ITextRange selectionTextRange(CompilationUnit astRoot) {
+ return this.generatorResource.textRange(astRoot);
+ }
+
+ public void update(T generatorResource) {
+ this.generatorResource = generatorResource;
+ this.setName_(this.name(generatorResource));
+ this.setSpecifiedInitialValue_(this.specifiedInitialValue(generatorResource));
+ this.setSpecifiedAllocationSize_(this.specifiedAllocationSize(generatorResource));
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMapping.java
new file mode 100644
index 0000000000..650c3982a0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMapping.java
@@ -0,0 +1,430 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IColumnMapping;
+import org.eclipse.jpt.core.internal.context.base.TemporalType;
+import org.eclipse.jpt.core.internal.resource.java.Column;
+import org.eclipse.jpt.core.internal.resource.java.GeneratedValue;
+import org.eclipse.jpt.core.internal.resource.java.Id;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.SequenceGenerator;
+import org.eclipse.jpt.core.internal.resource.java.TableGenerator;
+import org.eclipse.jpt.core.internal.resource.java.Temporal;
+import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+
+public class JavaIdMapping extends JavaAttributeMapping implements IJavaIdMapping
+{
+ protected final IJavaColumn column;
+
+ protected IJavaGeneratedValue generatedValue;
+
+ protected TemporalType temporal;
+
+ protected IJavaTableGenerator tableGenerator;
+
+ protected IJavaSequenceGenerator sequenceGenerator;
+
+ public JavaIdMapping(IJavaPersistentAttribute parent) {
+ super(parent);
+ this.column = createJavaColumn();
+ }
+
+ protected IJavaColumn createJavaColumn() {
+ return jpaFactory().createJavaColumn(this, this);
+ }
+
+ @Override
+ public void initializeFromResource(JavaPersistentAttributeResource persistentAttributeResource) {
+ super.initializeFromResource(persistentAttributeResource);
+ this.column.initializeFromResource(this.columnResource());
+ this.temporal = this.temporal(this.temporalResource());
+ this.initializeTableGenerator(persistentAttributeResource);
+ this.initializeSequenceGenerator(persistentAttributeResource);
+ this.initializeGeneratedValue(persistentAttributeResource);
+ }
+
+ protected void initializeTableGenerator(JavaPersistentAttributeResource persistentAttributeResource) {
+ TableGenerator tableGeneratorResource = tableGenerator(persistentAttributeResource);
+ if (tableGeneratorResource != null) {
+ this.tableGenerator = jpaFactory().createJavaTableGenerator(this);
+ this.tableGenerator.initializeFromResource(tableGeneratorResource);
+ }
+ }
+
+ protected void initializeSequenceGenerator(JavaPersistentAttributeResource persistentAttributeResource) {
+ SequenceGenerator sequenceGeneratorResource = sequenceGenerator(persistentAttributeResource);
+ if (sequenceGeneratorResource != null) {
+ this.sequenceGenerator = jpaFactory().createJavaSequenceGenerator(this);
+ this.sequenceGenerator.initializeFromResource(sequenceGeneratorResource);
+ }
+ }
+
+ protected void initializeGeneratedValue(JavaPersistentAttributeResource persistentAttributeResource) {
+ GeneratedValue generatedValueResource = generatedValue(persistentAttributeResource);
+ if (generatedValueResource != null) {
+ this.generatedValue = jpaFactory().createJavaGeneratedValue(this);
+ this.generatedValue.initializeFromResource(generatedValueResource);
+ }
+ }
+
+ protected Temporal temporalResource() {
+ return (Temporal) this.persistentAttributeResource.nonNullAnnotation(Temporal.ANNOTATION_NAME);
+ }
+
+ public Column columnResource() {
+ return (Column) this.persistentAttributeResource.nonNullAnnotation(Column.ANNOTATION_NAME);
+ }
+
+ //************** IJavaAttributeMapping implementation ***************
+
+ public String getKey() {
+ return IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return Id.ANNOTATION_NAME;
+ }
+
+ public Iterator<String> correspondingAnnotationNames() {
+ return new ArrayIterator<String>(
+ JPA.COLUMN,
+ JPA.GENERATED_VALUE,
+ JPA.TEMPORAL,
+ JPA.TABLE_GENERATOR,
+ JPA.SEQUENCE_GENERATOR);
+ }
+
+ public String defaultColumnName() {
+ return attributeName();
+ }
+
+ public String defaultTableName() {
+ return typeMapping().getTableName();
+ }
+
+ //************** IIdMapping implementation ***************
+
+ public IJavaColumn getColumn() {
+ return this.column;
+ }
+
+ public TemporalType getTemporal() {
+ return this.temporal;
+ }
+
+ public void setTemporal(TemporalType newTemporal) {
+ TemporalType oldTemporal = this.temporal;
+ this.temporal = newTemporal;
+ this.temporalResource().setValue(TemporalType.toJavaResourceModel(newTemporal));
+ firePropertyChanged(IColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setTemporal_(TemporalType newTemporal) {
+ TemporalType oldTemporal = this.temporal;
+ this.temporal = newTemporal;
+ firePropertyChanged(IColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+ }
+
+ public IJavaGeneratedValue addGeneratedValue() {
+ if (getGeneratedValue() != null) {
+ throw new IllegalStateException("gemeratedValue already exists");
+ }
+ this.generatedValue = jpaFactory().createJavaGeneratedValue(this);
+ this.persistentAttributeResource.addAnnotation(GeneratedValue.ANNOTATION_NAME);
+ firePropertyChanged(GENERATED_VALUE_PROPERTY, null, this.generatedValue);
+ return this.generatedValue;
+ }
+
+ public void removeGeneratedValue() {
+ if (getGeneratedValue() == null) {
+ throw new IllegalStateException("gemeratedValue does not exist, cannot be removed");
+ }
+ IJavaGeneratedValue oldGeneratedValue = this.generatedValue;
+ this.generatedValue = null;
+ this.persistentAttributeResource.removeAnnotation(GeneratedValue.ANNOTATION_NAME);
+ firePropertyChanged(GENERATED_VALUE_PROPERTY, oldGeneratedValue, null);
+ }
+
+ public IJavaGeneratedValue getGeneratedValue() {
+ return this.generatedValue;
+ }
+
+ protected void setGeneratedValue(IJavaGeneratedValue newGeneratedValue) {
+ IJavaGeneratedValue oldGeneratedValue = this.generatedValue;
+ this.generatedValue = newGeneratedValue;
+ firePropertyChanged(GENERATED_VALUE_PROPERTY, oldGeneratedValue, newGeneratedValue);
+ }
+
+ public IJavaTableGenerator addTableGenerator() {
+ if (getTableGenerator() != null) {
+ throw new IllegalStateException("tableGenerator already exists");
+ }
+ this.tableGenerator = jpaFactory().createJavaTableGenerator(this);
+ this.persistentAttributeResource.addAnnotation(TableGenerator.ANNOTATION_NAME);
+ firePropertyChanged(TABLE_GENERATOR_PROPERTY, null, this.tableGenerator);
+ return this.tableGenerator;
+ }
+
+ public void removeTableGenerator() {
+ if (getTableGenerator() == null) {
+ throw new IllegalStateException("tableGenerator does not exist, cannot be removed");
+ }
+ IJavaTableGenerator oldTableGenerator = this.tableGenerator;
+ this.tableGenerator = null;
+ this.persistentAttributeResource.removeAnnotation(TableGenerator.ANNOTATION_NAME);
+ firePropertyChanged(TABLE_GENERATOR_PROPERTY, oldTableGenerator, null);
+ }
+
+ public IJavaTableGenerator getTableGenerator() {
+ return this.tableGenerator;
+ }
+
+ protected void setTableGenerator(IJavaTableGenerator newTableGenerator) {
+ IJavaTableGenerator oldTableGenerator = this.tableGenerator;
+ this.tableGenerator = newTableGenerator;
+ firePropertyChanged(TABLE_GENERATOR_PROPERTY, oldTableGenerator, newTableGenerator);
+ }
+
+ public IJavaSequenceGenerator addSequenceGenerator() {
+ if (getSequenceGenerator() != null) {
+ throw new IllegalStateException("sequenceGenerator already exists");
+ }
+ this.sequenceGenerator = jpaFactory().createJavaSequenceGenerator(this);
+ this.persistentAttributeResource.addAnnotation(SequenceGenerator.ANNOTATION_NAME);
+ firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, null, this.sequenceGenerator);
+ return this.sequenceGenerator;
+ }
+
+ public void removeSequenceGenerator() {
+ if (getSequenceGenerator() == null) {
+ throw new IllegalStateException("sequenceGenerator does not exist, cannot be removed");
+ }
+ IJavaSequenceGenerator oldSequenceGenerator = this.sequenceGenerator;
+ this.sequenceGenerator = null;
+ this.persistentAttributeResource.removeAnnotation(SequenceGenerator.ANNOTATION_NAME);
+ firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, oldSequenceGenerator, null);
+ }
+
+ public IJavaSequenceGenerator getSequenceGenerator() {
+ return this.sequenceGenerator;
+ }
+
+ protected void setSequenceGenerator(IJavaSequenceGenerator newSequenceGenerator) {
+ IJavaSequenceGenerator oldSequenceGenerator = this.sequenceGenerator;
+ this.sequenceGenerator = newSequenceGenerator;
+ firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, oldSequenceGenerator, newSequenceGenerator);
+ }
+
+
+ @Override
+ public void update(JavaPersistentAttributeResource persistentAttributeResource) {
+ super.update(persistentAttributeResource);
+ this.column.update(this.columnResource());
+ this.setTemporal_(this.temporal(this.temporalResource()));
+ this.updateTableGenerator(persistentAttributeResource);
+ this.updateSequenceGenerator(persistentAttributeResource);
+ this.updateGeneratedValue(persistentAttributeResource);
+ }
+
+ protected TemporalType temporal(Temporal temporal) {
+ return TemporalType.fromJavaResourceModel(temporal.getValue());
+ }
+
+ protected void updateTableGenerator(JavaPersistentAttributeResource persistentAttributeResource) {
+ TableGenerator tableGeneratorResource = tableGenerator(persistentAttributeResource);
+ if (tableGeneratorResource == null) {
+ if (getTableGenerator() != null) {
+ setTableGenerator(null);
+ }
+ }
+ else {
+ if (getTableGenerator() == null) {
+ setTableGenerator(jpaFactory().createJavaTableGenerator(this));
+ getTableGenerator().initializeFromResource(tableGeneratorResource);
+ }
+ else {
+ getTableGenerator().update(tableGeneratorResource);
+ }
+ }
+ }
+
+ protected void updateSequenceGenerator(JavaPersistentAttributeResource persistentAttributeResource) {
+ SequenceGenerator sequenceGeneratorResource = sequenceGenerator(persistentAttributeResource);
+ if (sequenceGeneratorResource == null) {
+ if (getSequenceGenerator() != null) {
+ setSequenceGenerator(null);
+ }
+ }
+ else {
+ if (getSequenceGenerator() == null) {
+ setSequenceGenerator(jpaFactory().createJavaSequenceGenerator(this));
+ getSequenceGenerator().initializeFromResource(sequenceGeneratorResource);
+ }
+ else {
+ getSequenceGenerator().update(sequenceGeneratorResource);
+ }
+ }
+ }
+
+ protected void updateGeneratedValue(JavaPersistentAttributeResource persistentAttributeResource) {
+ GeneratedValue generatedValueResource = generatedValue(persistentAttributeResource);
+ if (generatedValueResource == null) {
+ if (getGeneratedValue() != null) {
+ setGeneratedValue(null);
+ }
+ }
+ else {
+ if (getGeneratedValue() == null) {
+ setGeneratedValue(jpaFactory().createJavaGeneratedValue(this));
+ getGeneratedValue().initializeFromResource(generatedValueResource);
+ }
+ else {
+ getGeneratedValue().update(generatedValueResource);
+ }
+ }
+ }
+
+ protected TableGenerator tableGenerator(JavaPersistentAttributeResource persistentAttributeResource) {
+ return (TableGenerator) persistentAttributeResource.annotation(TableGenerator.ANNOTATION_NAME);
+ }
+
+ protected SequenceGenerator sequenceGenerator(JavaPersistentAttributeResource persistentAttributeResource) {
+ return (SequenceGenerator) persistentAttributeResource.annotation(SequenceGenerator.ANNOTATION_NAME);
+ }
+
+ protected GeneratedValue generatedValue(JavaPersistentAttributeResource persistentAttributeResource) {
+ return (GeneratedValue) persistentAttributeResource.annotation(GeneratedValue.ANNOTATION_NAME);
+ }
+
+
+// private void updateGeneratedValueFromJava(CompilationUnit astRoot) {
+// if (this.generatedValueAnnotationAdapter.getAnnotation(astRoot) == null) {
+// if (getGeneratedValue() != null) {
+// setGeneratedValue(null);
+// }
+// }
+// else {
+// if (getGeneratedValue() == null) {
+// setGeneratedValue(createGeneratedValue());
+// }
+// ((JavaGeneratedValue) getGeneratedValue()).updateFromJava(astRoot);
+// }
+// }
+
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.getColumn().candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
+
+ @Override
+ public String primaryKeyColumnName() {
+ return this.getColumn().getName();
+ }
+
+ @Override
+ public boolean isOverridableAttributeMapping() {
+ return true;
+ }
+
+ @Override
+ public boolean isIdMapping() {
+ return true;
+ }
+
+ //*********** Validation ************
+
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+
+ addColumnMessages(messages, astRoot);
+
+ //TODO njh there is no generator repos yet
+// addGeneratorMessages(messages);
+ }
+
+ protected void addColumnMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ IJavaColumn column = this.getColumn();
+ String table = column.getTable();
+ boolean doContinue = entityOwned() && column.isConnected();
+
+ if (doContinue && this.typeMapping().tableNameIsInvalid(table)) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
+ new String[] {table, column.getName()},
+ column, column.tableTextRange(astRoot))
+ );
+ doContinue = false;
+ }
+
+ if (doContinue && ! column.isResolved()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.COLUMN_UNRESOLVED_NAME,
+ new String[] {column.getName()},
+ column, column.nameTextRange(astRoot))
+ );
+ }
+ }
+
+ protected void addGeneratorMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ IJavaGeneratedValue generatedValue = this.getGeneratedValue();
+ if (generatedValue == null) {
+ return;
+ }
+ String generatorName = generatedValue.getGenerator();
+ if (generatorName == null) {
+ return;
+ }
+// IGeneratorRepository generatorRepository = persistenceUnit().getGeneratorRepository();
+// IJavaGenerator generator = generatorRepository.generator(generatorName);
+//
+// if (generator == null) {
+// messages.add(
+// JpaValidationMessages.buildMessage(
+// IMessage.HIGH_SEVERITY,
+// IJpaValidationMessages.GENERATED_VALUE_UNRESOLVED_GENERATOR,
+// new String[] {generatorName},
+// generatedValue, generatedValue.generatorTextRange())
+// );
+// }
+ }
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaIdProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMappingProvider.java
index 2fcaa12ab6..10eeff394b 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaIdProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMappingProvider.java
@@ -7,24 +7,18 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.java.mappings;
+package org.eclipse.jpt.core.internal.context.java;
-import org.eclipse.jpt.core.internal.IJpaFactory;
import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMappingProvider;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.java.Id;
-/**
- *
- */
-public class JavaIdProvider
+public class JavaIdMappingProvider
implements IJavaAttributeMappingProvider
{
// singleton
- private static final JavaIdProvider INSTANCE = new JavaIdProvider();
+ private static final JavaIdMappingProvider INSTANCE = new JavaIdMappingProvider();
/**
* Return the singleton.
@@ -36,7 +30,7 @@ public class JavaIdProvider
/**
* Ensure non-instantiability.
*/
- private JavaIdProvider() {
+ private JavaIdMappingProvider() {
super();
}
@@ -44,12 +38,11 @@ public class JavaIdProvider
return IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
}
- public IJavaAttributeMapping buildMapping(Attribute attribute, IJpaFactory factory) {
- return factory.createJavaId(attribute);
+ public String annotationName() {
+ return Id.ANNOTATION_NAME;
}
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return JavaId.DECLARATION_ANNOTATION_ADAPTER;
+ public IJavaAttributeMapping buildMapping(IJavaPersistentAttribute parent, IJpaBaseContextFactory factory) {
+ return factory.createJavaIdMapping(parent);
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaJoinColumn.java
new file mode 100644
index 0000000000..0042ccb670
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaJoinColumn.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumn;
+import org.eclipse.jpt.db.internal.Column;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+
+
+public class JavaJoinColumn extends AbstractJavaColumn<JoinColumn> implements IJavaJoinColumn
+{
+
+ protected String specifiedReferencedColumnName;
+
+ protected String defaultReferencedColumnName;
+
+ protected JoinColumn joinColumn;
+
+ public JavaJoinColumn(IJavaJpaContextNode parent, IJoinColumn.Owner owner) {
+ super(parent, owner);
+ }
+
+ @Override
+ protected JoinColumn columnResource() {
+ return this.joinColumn;
+ }
+
+ public String getReferencedColumnName() {
+ return (this.specifiedReferencedColumnName == null) ? this.defaultReferencedColumnName : this.specifiedReferencedColumnName;
+ }
+
+ public String getSpecifiedReferencedColumnName() {
+ return this.specifiedReferencedColumnName;
+ }
+
+
+ public void setSpecifiedReferencedColumnName(String newSpecifiedReferencedColumnName) {
+ String oldSpecifiedReferencedColumnName = this.specifiedReferencedColumnName;
+ this.specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
+ //TODO
+ firePropertyChanged(IAbstractJoinColumn.SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, oldSpecifiedReferencedColumnName, newSpecifiedReferencedColumnName);
+ }
+
+ public String getDefaultReferencedColumnName() {
+ return this.defaultReferencedColumnName;
+ }
+
+ protected void setDefaultReferencedColumnName(String newDefaultReferencedColumnName) {
+ String oldDefaultReferencedColumnName = this.defaultReferencedColumnName;
+ this.defaultReferencedColumnName = newDefaultReferencedColumnName;
+ firePropertyChanged(IAbstractJoinColumn.DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, oldDefaultReferencedColumnName, newDefaultReferencedColumnName);
+ }
+
+
+ @Override
+ public IJoinColumn.Owner owner() {
+ return (IJoinColumn.Owner) super.owner();
+ }
+
+ public boolean isVirtual() {
+ return owner().isVirtual(this);
+ }
+
+ public Table dbReferencedColumnTable() {
+ return owner().dbReferencedColumnTable();
+ }
+
+ public Column dbReferencedColumn() {
+ Table table = this.dbReferencedColumnTable();
+ return (table == null) ? null : table.columnNamed(this.getReferencedColumnName());
+ }
+
+ @Override
+ public boolean tableIsAllowed() {
+ return this.owner().tableIsAllowed();
+ }
+
+ public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
+ return columnResource().referencedColumnNameTouches(pos, astRoot);
+ }
+
+ private Iterator<String> candidateReferencedColumnNames() {
+ Table table = this.owner().dbReferencedColumnTable();
+ return (table != null) ? table.columnNames() : EmptyIterator.<String> instance();
+ }
+
+ private Iterator<String> candidateReferencedColumnNames(Filter<String> filter) {
+ return new FilteringIterator<String, String>(this.candidateReferencedColumnNames(), filter);
+ }
+
+ private Iterator<String> quotedCandidateReferencedColumnNames(Filter<String> filter) {
+ return StringTools.quote(this.candidateReferencedColumnNames(filter));
+ }
+
+ @Override
+ public Iterator<String> connectedCandidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.connectedCandidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.referencedColumnNameTouches(pos, astRoot)) {
+ return this.quotedCandidateReferencedColumnNames(filter);
+ }
+ return null;
+ }
+
+ public boolean isReferencedColumnResolved() {
+ return dbReferencedColumn() != null;
+ }
+
+ public ITextRange referencedColumnNameTextRange(CompilationUnit astRoot) {
+ ITextRange textRange = columnResource().referencedColumnNameTextRange(astRoot);
+ return (textRange != null) ? textRange : owner().validationTextRange(astRoot);
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void initializeFromResource(JoinColumn joinColumn) {
+ this.joinColumn = joinColumn;
+ super.initializeFromResource(joinColumn);
+ this.specifiedReferencedColumnName = joinColumn.getReferencedColumnName();
+ }
+
+ @Override
+ public void update(JoinColumn joinColumn) {
+ this.joinColumn = joinColumn;
+ super.update(joinColumn);
+ this.setSpecifiedReferencedColumnName(joinColumn.getReferencedColumnName());
+ //TODO defaultName, defaultTable, defaultReferencedColumnName
+ }
+
+// @Override
+// public void updateFromJava(CompilationUnit astRoot) {
+// super.updateFromJava(astRoot);
+// this.setSpecifiedReferencedColumnName(this.referencedColumnNameAdapter.getValue(astRoot));
+// }
+//
+// public void refreshDefaults(DefaultsContext defaultsContext) {
+// this.setDefaultReferencedColumnName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_REFERENCED_COLUMN_NAME_KEY));
+// this.setDefaultName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_NAME_KEY));
+// this.setDefaultTable((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_TABLE_KEY));
+// }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaJoinTable.java
new file mode 100644
index 0000000000..82c58b0eb1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaJoinTable.java
@@ -0,0 +1,486 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IJoinTable;
+import org.eclipse.jpt.core.internal.context.base.INonOwningMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.IRelationshipMapping;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.JoinTable;
+import org.eclipse.jpt.core.internal.resource.java.NullJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.NullJoinTable;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator;
+
+public class JavaJoinTable extends AbstractJavaTable implements IJavaJoinTable
+{
+ protected final List<IJavaJoinColumn> specifiedJoinColumns;
+
+ protected final IJavaJoinColumn defaultJoinColumn;
+
+ protected final List<IJavaJoinColumn> specifiedInverseJoinColumns;
+
+ protected final IJavaJoinColumn defaultInverseJoinColumn;
+
+ protected JavaPersistentAttributeResource attributeResource;
+
+ public JavaJoinTable(IJavaRelationshipMapping parent) {
+ super(parent);
+ this.specifiedJoinColumns = new ArrayList<IJavaJoinColumn>();
+ this.defaultJoinColumn = this.jpaFactory().createJavaJoinColumn(this, createJoinColumnOwner());
+ this.specifiedInverseJoinColumns = new ArrayList<IJavaJoinColumn>();
+ this.defaultInverseJoinColumn = this.jpaFactory().createJavaJoinColumn(this, createInverseJoinColumnOwner());
+ }
+
+ @Override
+ protected String annotationName() {
+ return JoinTable.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected String defaultName() {
+ // TODO default joinTable name
+ return null;
+ }
+
+ @Override
+ protected JoinTable tableResource() {
+ return (JoinTable) this.attributeResource.nonNullAnnotation(JoinTable.ANNOTATION_NAME);
+ }
+
+ protected void addJoinTableResource() {
+ this.attributeResource.addAnnotation(JoinTable.ANNOTATION_NAME);
+ }
+
+ //******************* IJoinTable implementation *****************
+
+
+ public ListIterator<IJavaJoinColumn> joinColumns() {
+ return this.specifiedJoinColumns.isEmpty() ? this.defaultJoinColumns() : this.specifiedJoinColumns();
+ }
+
+ public ListIterator<IJavaJoinColumn> defaultJoinColumns() {
+ return new SingleElementListIterator<IJavaJoinColumn>(this.defaultJoinColumn);
+ }
+
+ public ListIterator<IJavaJoinColumn> specifiedJoinColumns() {
+ return new CloneListIterator<IJavaJoinColumn>(this.specifiedJoinColumns);
+ }
+
+ public int specifiedJoinColumnsSize() {
+ return this.specifiedJoinColumns.size();
+ }
+
+ public boolean containsSpecifiedJoinColumns() {
+ return !this.specifiedJoinColumns.isEmpty();
+ }
+
+ public IJavaJoinColumn addSpecifiedJoinColumn(int index) {
+ //TODO this is a bad idea, but it's working for now. Need to revist
+ // the idea of having a way to add the JoinTable and the JoinColumn
+ //and then firing property change events. Otherwise we end up creating
+ //the spcifiedJoinColumn then wiping it out and creating another one during
+ //an update from the java resource model
+ if (tableResource() instanceof NullJoinTable) {
+ addJoinTableResource();
+ }
+ IJavaJoinColumn joinColumn = jpaFactory().createJavaJoinColumn(this, createJoinColumnOwner());
+ this.specifiedJoinColumns.add(index, joinColumn);
+ this.tableResource().addJoinColumn(index);
+ this.fireItemAdded(IJoinTable.SPECIFIED_JOIN_COLUMNS_LIST, index, joinColumn);
+ return joinColumn;
+ }
+
+ protected void addSpecifiedJoinColumn(int index, IJavaJoinColumn joinColumn) {
+ addItemToList(index, joinColumn, this.specifiedJoinColumns, IJoinTable.SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public void removeSpecifiedJoinColumn(int index) {
+ IJavaJoinColumn removedJoinColumn = this.specifiedJoinColumns.remove(index);
+ this.tableResource().removeJoinColumn(index);
+ fireItemRemoved(IJoinTable.SPECIFIED_JOIN_COLUMNS_LIST, index, removedJoinColumn);
+ }
+
+ protected void removeSpecifiedJoinColumn(IJavaJoinColumn joinColumn) {
+ removeItemFromList(joinColumn, this.specifiedJoinColumns, IJoinTable.SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedJoinColumns, targetIndex, sourceIndex);
+ this.tableResource().moveJoinColumn(targetIndex, sourceIndex);
+ fireItemMoved(IJoinTable.SPECIFIED_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
+ }
+
+
+ public ListIterator<IJavaJoinColumn> inverseJoinColumns() {
+ return this.specifiedInverseJoinColumns.isEmpty() ? this.defaultInverseJoinColumns() : this.specifiedInverseJoinColumns();
+ }
+
+ public ListIterator<IJavaJoinColumn> defaultInverseJoinColumns() {
+ return new SingleElementListIterator<IJavaJoinColumn>(this.defaultInverseJoinColumn);
+ }
+
+ public ListIterator<IJavaJoinColumn> specifiedInverseJoinColumns() {
+ return new CloneListIterator<IJavaJoinColumn>(this.specifiedInverseJoinColumns);
+ }
+
+ public int specifiedInverseJoinColumnsSize() {
+ return this.specifiedInverseJoinColumns.size();
+ }
+
+ public boolean containsSpecifiedInverseJoinColumns() {
+ return !this.specifiedInverseJoinColumns.isEmpty();
+ }
+
+ public IJavaJoinColumn addSpecifiedInverseJoinColumn(int index) {
+ //TODO this is a bad idea, but it's working for now and tests are passing. Need to revist
+ //the idea of having a way to add the JoinTable and the JoinColumn
+ //and then firing property change events. Otherwise we end up creating
+ //the spcifiedJoinColumn then wiping it out and creating another one during
+ //an update from the java resource model
+ if (tableResource() instanceof NullJoinTable) {
+ addJoinTableResource();
+ }
+ IJavaJoinColumn joinColumn = jpaFactory().createJavaJoinColumn(this, createInverseJoinColumnOwner());
+ this.specifiedInverseJoinColumns.add(index, joinColumn);
+ this.tableResource().addInverseJoinColumn(index);
+ this.fireItemAdded(IJoinTable.SPECIFIED_INVERSE_JOIN_COLUMNS_LIST, index, joinColumn);
+ return joinColumn;
+ }
+
+ protected void addSpecifiedInverseJoinColumn(int index, IJavaJoinColumn joinColumn) {
+ addItemToList(index, joinColumn, this.specifiedInverseJoinColumns, IJoinTable.SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ }
+
+ public void removeSpecifiedInverseJoinColumn(int index) {
+ IJavaJoinColumn removedJoinColumn = this.specifiedInverseJoinColumns.remove(index);
+ this.tableResource().removeInverseJoinColumn(index);
+ fireItemRemoved(IJoinTable.SPECIFIED_INVERSE_JOIN_COLUMNS_LIST, index, removedJoinColumn);
+ }
+
+ protected void removeSpecifiedInverseJoinColumn(IJavaJoinColumn joinColumn) {
+ removeItemFromList(joinColumn, this.specifiedInverseJoinColumns, IJoinTable.SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedInverseJoinColumn(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedInverseJoinColumns, targetIndex, sourceIndex);
+ this.tableResource().moveInverseJoinColumn(targetIndex, sourceIndex);
+ fireItemMoved(IJoinTable.SPECIFIED_INVERSE_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
+ }
+
+
+ public IRelationshipMapping relationshipMapping() {
+ return (IRelationshipMapping) this.parent();
+ }
+
+ public boolean isSpecified() {
+ return tableResource() != null;
+ }
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ for (IJavaJoinColumn column : CollectionTools.iterable(this.joinColumns())) {
+ result = column.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ for (IJavaJoinColumn column : CollectionTools.iterable(this.inverseJoinColumns())) {
+ result = column.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ protected IJoinColumn.Owner createJoinColumnOwner() {
+ return new JoinColumnOwner();
+ }
+
+ protected IJoinColumn.Owner createInverseJoinColumnOwner() {
+ return new InverseJoinColumnOwner();
+ }
+
+ public void initializeFromResource(JavaPersistentAttributeResource attributeResource) {
+ this.attributeResource = attributeResource;
+ JoinTable joinTable = tableResource();
+ this.initializeFromResource(joinTable);
+ //TODO move these method calls to initializeFromResource(JoinTable) genericize JavaJoinTable??
+ this.initializeSpecifiedJoinColumns(joinTable);
+ this.defaultJoinColumn.initializeFromResource(new NullJoinColumn(joinTable));
+ this.initializeSpecifiedInverseJoinColumns(joinTable);
+ this.defaultJoinColumn.initializeFromResource(new NullJoinColumn(joinTable));
+ }
+
+ protected void initializeSpecifiedJoinColumns(JoinTable joinTableResource) {
+ if (joinTableResource == null) {
+ return;
+ }
+ ListIterator<JoinColumn> annotations = joinTableResource.joinColumns();
+
+ while(annotations.hasNext()) {
+ this.specifiedJoinColumns.add(createJoinColumn(annotations.next()));
+ }
+ }
+
+ protected void initializeSpecifiedInverseJoinColumns(JoinTable joinTableResource) {
+ if (joinTableResource == null) {
+ return;
+ }
+ ListIterator<JoinColumn> annotations = joinTableResource.inverseJoinColumns();
+
+ while(annotations.hasNext()) {
+ this.specifiedInverseJoinColumns.add(createInverseJoinColumn(annotations.next()));
+ }
+ }
+
+ public void update(JavaPersistentAttributeResource attributeResource) {
+ this.attributeResource = attributeResource;
+ JoinTable joinTable = tableResource();
+ this.update(joinTable);
+ this.updateSpecifiedJoinColumns(joinTable);
+ this.defaultJoinColumn.update(new NullJoinColumn(joinTable));
+ this.updateSpecifiedInverseJoinColumns(joinTable);
+ this.defaultInverseJoinColumn.update(new NullJoinColumn(joinTable));
+ }
+
+ protected void updateSpecifiedJoinColumns(JoinTable joinTableResource) {
+ ListIterator<IJavaJoinColumn> joinColumns = specifiedJoinColumns();
+ ListIterator<JoinColumn> resourceJoinColumns = joinTableResource.joinColumns();
+
+ while (joinColumns.hasNext()) {
+ IJavaJoinColumn joinColumn = joinColumns.next();
+ if (resourceJoinColumns.hasNext()) {
+ joinColumn.update(resourceJoinColumns.next());
+ }
+ else {
+ removeSpecifiedJoinColumn(joinColumn);
+ }
+ }
+
+ while (resourceJoinColumns.hasNext()) {
+ addSpecifiedJoinColumn(specifiedJoinColumnsSize(), createJoinColumn(resourceJoinColumns.next()));
+ }
+ }
+
+ protected void updateSpecifiedInverseJoinColumns(JoinTable joinTableResource) {
+ ListIterator<IJavaJoinColumn> joinColumns = specifiedInverseJoinColumns();
+ ListIterator<JoinColumn> resourceJoinColumns = joinTableResource.inverseJoinColumns();
+
+ while (joinColumns.hasNext()) {
+ IJavaJoinColumn joinColumn = joinColumns.next();
+ if (resourceJoinColumns.hasNext()) {
+ joinColumn.update(resourceJoinColumns.next());
+ }
+ else {
+ removeSpecifiedInverseJoinColumn(joinColumn);
+ }
+ }
+
+ while (resourceJoinColumns.hasNext()) {
+ addSpecifiedInverseJoinColumn(specifiedInverseJoinColumnsSize(), createInverseJoinColumn(resourceJoinColumns.next()));
+ }
+ }
+
+ protected IJavaJoinColumn createJoinColumn(JoinColumn joinColumnResource) {
+ IJavaJoinColumn joinColumn = jpaFactory().createJavaJoinColumn(this, createJoinColumnOwner());
+ joinColumn.initializeFromResource(joinColumnResource);
+ return joinColumn;
+ }
+
+ protected IJavaJoinColumn createInverseJoinColumn(JoinColumn joinColumnResource) {
+ IJavaJoinColumn joinColumn = jpaFactory().createJavaJoinColumn(this, createInverseJoinColumnOwner());
+ joinColumn.initializeFromResource(joinColumnResource);
+ return joinColumn;
+ }
+
+
+
+ /**
+ * just a little common behavior
+ */
+ abstract class AbstractJoinColumnOwner implements IJoinColumn.Owner
+ {
+ AbstractJoinColumnOwner() {
+ super();
+ }
+
+ public ITypeMapping typeMapping() {
+ return relationshipMapping().typeMapping();
+ }
+ public IRelationshipMapping relationshipMapping() {
+ return JavaJoinTable.this.relationshipMapping();
+ }
+
+ /**
+ * the default table name is always valid and a specified table name
+ * is prohibited (which will be handled elsewhere)
+ */
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+
+ /**
+ * the join column can only be on the join table itself
+ */
+ public boolean tableIsAllowed() {
+ return false;
+ }
+
+ public org.eclipse.jpt.db.internal.Table dbTable(String tableName) {
+ if (JavaJoinTable.this.getName() == null) {
+ return null;
+ }
+ return (JavaJoinTable.this.getName().equals(tableName)) ? JavaJoinTable.this.dbTable() : null;
+ }
+ }
+
+
+ /**
+ * owner for "forward-pointer" JoinColumns;
+ * these point at the target/inverse entity
+ */
+ class InverseJoinColumnOwner extends AbstractJoinColumnOwner
+ {
+ public InverseJoinColumnOwner() {
+ super();
+ }
+
+ public IEntity targetEntity() {
+ return JavaJoinTable.this.relationshipMapping().getResolvedTargetEntity();
+ }
+
+ public String attributeName() {
+ return JavaJoinTable.this.relationshipMapping().persistentAttribute().getName();
+ }
+
+ @Override
+ public org.eclipse.jpt.db.internal.Table dbTable(String tableName) {
+ org.eclipse.jpt.db.internal.Table dbTable = super.dbTable(tableName);
+ if (dbTable != null) {
+ return dbTable;
+ }
+ IEntity targetEntity = targetEntity();
+ return (targetEntity == null) ? null : targetEntity.dbTable(tableName);
+ }
+
+ public org.eclipse.jpt.db.internal.Table dbReferencedColumnTable() {
+ IEntity targetEntity = targetEntity();
+ return (targetEntity == null) ? null : targetEntity.primaryDbTable();
+ }
+
+ public boolean isVirtual(IAbstractJoinColumn joinColumn) {
+ return JavaJoinTable.this.defaultInverseJoinColumn == joinColumn;
+ }
+
+ public String defaultColumnName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String defaultTableName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+
+
+ /**
+ * owner for "back-pointer" JoinColumns;
+ * these point at the source/owning entity
+ */
+ class JoinColumnOwner extends AbstractJoinColumnOwner
+ {
+ public JoinColumnOwner() {
+ super();
+ }
+
+ public IEntity targetEntity() {
+ return JavaJoinTable.this.relationshipMapping().getEntity();
+ }
+
+ public String attributeName() {
+ IEntity targetEntity = JavaJoinTable.this.relationshipMapping().getResolvedTargetEntity();
+ if (targetEntity == null) {
+ return null;
+ }
+ String attributeName = JavaJoinTable.this.relationshipMapping().persistentAttribute().getName();
+ for (Iterator<IPersistentAttribute> stream = targetEntity.persistentType().allAttributes(); stream.hasNext();) {
+ IPersistentAttribute attribute = stream.next();
+ IAttributeMapping mapping = attribute.getMapping();
+ if (mapping instanceof INonOwningMapping) {
+ String mappedBy = ((INonOwningMapping) mapping).getMappedBy();
+ if ((mappedBy != null) && mappedBy.equals(attributeName)) {
+ return attribute.getName();
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public org.eclipse.jpt.db.internal.Table dbTable(String tableName) {
+ org.eclipse.jpt.db.internal.Table dbTable = super.dbTable(tableName);
+ if (dbTable != null) {
+ return dbTable;
+ }
+ return typeMapping().dbTable(tableName);
+ }
+
+ public org.eclipse.jpt.db.internal.Table dbReferencedColumnTable() {
+ return typeMapping().primaryDbTable();
+ }
+
+ public boolean isVirtual(IAbstractJoinColumn joinColumn) {
+ return JavaJoinTable.this.defaultJoinColumn.equals(joinColumn);
+ }
+
+ public String defaultColumnName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String defaultTableName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToManyMapping.java
new file mode 100644
index 0000000000..0fa529246d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToManyMapping.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.ManyToMany;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+
+public class JavaManyToManyMapping extends JavaMultiRelationshipMapping<ManyToMany>
+ implements IJavaManyToManyMapping
+{
+
+ public JavaManyToManyMapping(IJavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ public String getKey() {
+ return IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return ManyToMany.ANNOTATION_NAME;
+ }
+
+ public Iterator<String> correspondingAnnotationNames() {
+ return new ArrayIterator<String>(
+ JPA.ORDER_BY,
+ JPA.MAP_KEY,
+ JPA.JOIN_TABLE);
+ }
+
+ @Override
+ protected ManyToMany relationshipMapping() {
+ return (ManyToMany) this.persistentAttributeResource.mappingAnnotation();
+ }
+
+ // ********** JavaMultiRelationshipMapping implementation **********
+
+ @Override
+ protected boolean mappedByTouches(int pos, CompilationUnit astRoot) {
+ return this.relationshipMapping().mappedByTouches(pos, astRoot);
+ }
+
+
+ @Override
+ protected void setMappedByOnResourceModel(String mappedBy) {
+ relationshipMapping().setMappedBy(mappedBy);
+ }
+
+ @Override
+ protected String mappedBy(ManyToMany relationshipMapping) {
+ return relationshipMapping.getMappedBy();
+ }
+
+ // ********** INonOwningMapping implementation **********
+
+ public boolean mappedByIsValid(IAttributeMapping mappedByMapping) {
+ String mappedByKey = mappedByMapping.getKey();
+ return (mappedByKey == IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ }
+
+ public ITextRange mappedByTextRange(CompilationUnit astRoot) {
+ return this.relationshipMapping().mappedByTextRange(astRoot);
+ }
+
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToManyMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToManyMappingProvider.java
new file mode 100644
index 0000000000..53f9b38f4b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToManyMappingProvider.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.java.ManyToMany;
+
+public class JavaManyToManyMappingProvider
+ implements IJavaAttributeMappingProvider
+{
+
+ // singleton
+ private static final JavaManyToManyMappingProvider INSTANCE = new JavaManyToManyMappingProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static IJavaAttributeMappingProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private JavaManyToManyMappingProvider() {
+ super();
+ }
+
+ public String key() {
+ return IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return ManyToMany.ANNOTATION_NAME;
+ }
+
+ public IJavaAttributeMapping buildMapping(IJavaPersistentAttribute parent, IJpaBaseContextFactory factory) {
+ return factory.createJavaManyToManyMapping(parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToOneMapping.java
new file mode 100644
index 0000000000..eb3e579d8b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToOneMapping.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.ManyToOne;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class JavaManyToOneMapping extends JavaSingleRelationshipMapping<ManyToOne>
+ implements IJavaManyToOneMapping
+{
+
+ public JavaManyToOneMapping(IJavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ public Iterator<String> correspondingAnnotationNames() {
+ return new ArrayIterator<String>(
+ JPA.JOIN_COLUMN,
+ JPA.JOIN_COLUMNS,
+ JPA.JOIN_TABLE);
+ }
+
+ public String annotationName() {
+ return ManyToOne.ANNOTATION_NAME;
+ }
+
+ public String getKey() {
+ return IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected ManyToOne relationshipMapping() {
+ return (ManyToOne) this.persistentAttributeResource.mappingAnnotation();
+ }
+
+ @Override
+ public boolean isOverridableAssociationMapping() {
+ return true;
+ }
+
+ @Override
+ protected void setOptionalOnResourceModel(Boolean newOptional) {
+ this.relationshipMapping().setOptional(newOptional);
+ }
+
+ @Override
+ protected Boolean specifiedOptional(ManyToOne relationshipMapping) {
+ return relationshipMapping.getOptional();
+ }
+
+ //ManyToOne mapping is always the owning side
+ protected boolean isOwningSide() {
+ return true;
+ }
+ @Override
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+ }
+
+ //***************** ISingleRelationshipMapping implementation *****************
+ @Override
+ @SuppressWarnings("unchecked")
+ //overriding purely to suppress the warning you get at the class level
+ public ListIterator<IJavaJoinColumn> joinColumns() {
+ return super.joinColumns();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ //overriding purely to suppress the warning you get at the class level
+ public ListIterator<IJavaJoinColumn> defaultJoinColumns() {
+ return super.defaultJoinColumns();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ //overriding purely to suppress the warning you get at the class level
+ public ListIterator<IJavaJoinColumn> specifiedJoinColumns() {
+ return super.specifiedJoinColumns();
+ }
+
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaManyToOneProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToOneMappingProvider.java
index 9d9af3e6c0..69d06e323f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaManyToOneProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToOneMappingProvider.java
@@ -7,24 +7,18 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.java.mappings;
+package org.eclipse.jpt.core.internal.context.java;
-import org.eclipse.jpt.core.internal.IJpaFactory;
import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMappingProvider;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.java.ManyToOne;
-/**
- *
- */
-public class JavaManyToOneProvider
+public class JavaManyToOneMappingProvider
implements IJavaAttributeMappingProvider
{
// singleton
- private static final JavaManyToOneProvider INSTANCE = new JavaManyToOneProvider();
+ private static final JavaManyToOneMappingProvider INSTANCE = new JavaManyToOneMappingProvider();
/**
* Return the singleton.
@@ -36,20 +30,19 @@ public class JavaManyToOneProvider
/**
* Ensure non-instantiability.
*/
- private JavaManyToOneProvider() {
+ private JavaManyToOneMappingProvider() {
super();
}
public String key() {
return IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
}
-
- public IJavaAttributeMapping buildMapping(Attribute attribute, IJpaFactory factory) {
- return factory.createJavaManyToOne(attribute);
+
+ public String annotationName() {
+ return ManyToOne.ANNOTATION_NAME;
}
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return JavaManyToOne.DECLARATION_ANNOTATION_ADAPTER;
+ public IJavaAttributeMapping buildMapping(IJavaPersistentAttribute parent, IJpaBaseContextFactory factory) {
+ return factory.createJavaManyToOneMapping(parent);
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclass.java
new file mode 100644
index 0000000000..0b028bef6c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclass.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IMappedSuperclass;
+import org.eclipse.jpt.core.internal.resource.java.IdClass;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.MappedSuperclass;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+
+public class JavaMappedSuperclass extends JavaTypeMapping
+ implements IJavaMappedSuperclass
+{
+
+ protected String idClass;
+
+ public JavaMappedSuperclass(IJavaPersistentType parent) {
+ super(parent);
+ }
+
+ public boolean isMapped() {
+ return true;
+ }
+
+ public String getKey() {
+ return IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return MappedSuperclass.ANNOTATION_NAME;
+ }
+ public Iterator<String> correspondingAnnotationNames() {
+ return new ArrayIterator<String>(
+ JPA.ID_CLASS,
+ JPA.EXCLUDE_DEFAULT_LISTENERS,
+ JPA.EXCLUDE_SUPERCLASS_LISTENERS,
+ JPA.ENTITY_LISTENERS,
+ JPA.PRE_PERSIST,
+ JPA.POST_PERSIST,
+ JPA.PRE_REMOVE,
+ JPA.POST_REMOVE,
+ JPA.PRE_UPDATE,
+ JPA.POST_UPDATE,
+ JPA.POST_LOAD);
+ }
+
+ public String getIdClass() {
+ return this.idClass;
+ }
+
+ public void setIdClass(String newIdClass) {
+ String oldIdClass = this.idClass;
+ this.idClass = newIdClass;
+ if (newIdClass != oldIdClass) {
+ if (newIdClass != null) {
+ if (idClassResource() == null) {
+ addIdClassResource();
+ }
+ idClassResource().setValue(newIdClass);
+ }
+ else {
+ removeIdClassResource();
+ }
+ }
+ firePropertyChanged(IMappedSuperclass.ID_CLASS_PROPERTY, oldIdClass, newIdClass);
+ }
+
+ protected void setIdClass_(String newIdClass) {
+ String oldIdClass = this.idClass;
+ this.idClass = newIdClass;
+ firePropertyChanged(IMappedSuperclass.ID_CLASS_PROPERTY, oldIdClass, newIdClass);
+ }
+
+ protected IdClass idClassResource() {
+ return (IdClass) this.persistentTypeResource.annotation(IdClass.ANNOTATION_NAME);
+ }
+
+ protected void addIdClassResource() {
+ this.persistentTypeResource.addAnnotation(IdClass.ANNOTATION_NAME);
+ }
+
+ protected void removeIdClassResource() {
+ this.persistentTypeResource.removeAnnotation(IdClass.ANNOTATION_NAME);
+ }
+
+ @Override
+ public Iterator<String> overridableAttributeNames() {
+ return this.namesOf(this.overridableAttributes());
+ }
+
+ protected Iterator<IJavaPersistentAttribute> overridableAttributes() {
+ return new FilteringIterator<IJavaPersistentAttribute, IJavaPersistentAttribute>(this.persistentType().attributes()) {
+ @Override
+ protected boolean accept(IJavaPersistentAttribute o) {
+ return o.isOverridableAttribute();
+ }
+ };
+ }
+
+ @Override
+ public Iterator<String> overridableAssociationNames() {
+ return this.namesOf(this.overridableAssociations());
+ }
+
+ protected Iterator<IJavaPersistentAttribute> overridableAssociations() {
+ return new FilteringIterator<IJavaPersistentAttribute, IJavaPersistentAttribute>(this.persistentType().attributes()) {
+ @Override
+ protected boolean accept(IJavaPersistentAttribute o) {
+ return o.isOverridableAssociation();
+ }
+ };
+ }
+
+ protected Iterator<String> namesOf(Iterator<IJavaPersistentAttribute> attributes) {
+ return new TransformationIterator<IJavaPersistentAttribute, String>(attributes) {
+ @Override
+ protected String transform(IJavaPersistentAttribute attribute) {
+ return attribute.getName();
+ }
+ };
+ }
+
+ @Override
+ public void initializeFromResource(JavaPersistentTypeResource persistentTypeResource) {
+ super.initializeFromResource(persistentTypeResource);
+ this.initializeIdClass(persistentTypeResource);
+ }
+
+ protected void initializeIdClass(JavaPersistentTypeResource typeResource) {
+ IdClass idClassResource = (IdClass) typeResource.annotation(IdClass.ANNOTATION_NAME);
+ if (idClassResource != null) {
+ this.idClass = idClassResource.getValue();
+ }
+ }
+
+ @Override
+ public void update(JavaPersistentTypeResource persistentTypeResource) {
+ super.update(persistentTypeResource);
+ this.updateIdClass(persistentTypeResource);
+ }
+
+ protected void updateIdClass(JavaPersistentTypeResource typeResource) {
+ IdClass idClass = (IdClass) typeResource.annotation(IdClass.ANNOTATION_NAME);
+ if (idClass != null) {
+ setIdClass_(idClass.getValue());
+ }
+ else {
+ setIdClass_(null);
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaMappedSuperclassProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassProvider.java
index c15fb715d5..3a0f813223 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaMappedSuperclassProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassProvider.java
@@ -7,18 +7,12 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.java.mappings;
+package org.eclipse.jpt.core.internal.context.java;
-import org.eclipse.jpt.core.internal.IJpaFactory;
import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMappingProvider;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.java.MappedSuperclass;
-/**
- *
- */
public class JavaMappedSuperclassProvider
implements IJavaTypeMappingProvider
{
@@ -43,13 +37,13 @@ public class JavaMappedSuperclassProvider
public String key() {
return IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
}
-
- public IJavaTypeMapping buildMapping(Type type, IJpaFactory factory) {
- return factory.createJavaMappedSuperclass(type);
+
+ public String annotationName() {
+ return MappedSuperclass.ANNOTATION_NAME;
}
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return JavaMappedSuperclass.DECLARATION_ANNOTATION_ADAPTER;
+ public IJavaTypeMapping buildMapping(IJavaPersistentType parent, IJpaBaseContextFactory factory) {
+ return factory.createJavaMappedSuperclass(parent);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMultiRelationshipMapping.java
new file mode 100644
index 0000000000..ed1f5d7a57
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMultiRelationshipMapping.java
@@ -0,0 +1,513 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IMultiRelationshipMapping;
+import org.eclipse.jpt.core.internal.context.base.INonOwningMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.MapKey;
+import org.eclipse.jpt.core.internal.resource.java.OrderBy;
+import org.eclipse.jpt.core.internal.resource.java.RelationshipMapping;
+import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+
+public abstract class JavaMultiRelationshipMapping<T extends RelationshipMapping>
+ extends JavaRelationshipMapping<T> implements IMultiRelationshipMapping
+{
+
+ protected String mappedBy;
+
+ protected String orderBy;
+
+ protected final IJavaJoinTable joinTable;
+
+ protected String mapKey;
+
+ protected JavaMultiRelationshipMapping(IJavaPersistentAttribute parent) {
+ super(parent);
+ this.joinTable = jpaFactory().createJavaJoinTable(this);
+
+ }
+
+
+// @Override
+// protected void notifyChanged(Notification notification) {
+// super.notifyChanged(notification);
+// switch (notification.getFeatureID(INonOwningMapping.class)) {
+// case JpaCoreMappingsPackage.INON_OWNING_MAPPING__MAPPED_BY :
+// this.mappedByAdapter.setValue((String) notification.getNewValue());
+// break;
+// default :
+// break;
+// }
+// switch (notification.getFeatureID(IMultiRelationshipMapping.class)) {
+// case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__ORDER_BY :
+// String orderBy = (String) notification.getNewValue();
+// if (orderBy == null) {
+// this.orderByAnnotationAdapter.removeAnnotation();
+// }
+// else if ("".equals(orderBy)) {
+// Annotation orderByAnnotation = this.orderByAnnotationAdapter.getAnnotation();
+// if (orderByAnnotation != null) {
+// // if the value is already "", then leave it alone (short circuit java change cycle)
+// if (!"".equals(orderByValueAdapter.getValue())) {
+// this.orderByValueAdapter.setValue(null);
+// }
+// }
+// else {
+// this.orderByAnnotationAdapter.newMarkerAnnotation();
+// }
+// }
+// else {
+// this.orderByValueAdapter.setValue(orderBy);
+// }
+// break;
+// case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__MAP_KEY :
+// String mk = (String) notification.getNewValue();
+// if (mk == null) {
+// this.mapKeyAnnotationAdapter.removeAnnotation();
+// }
+// else {
+// this.mapKeyNameAdapter.setValue(mk);
+// }
+// break;
+// case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__FETCH :
+// this.getFetchAdapter().setValue(((DefaultLazyFetchType) notification.getNewValue()).convertToJavaAnnotationValue());
+// break;
+// default :
+// break;
+// }
+// }
+
+ public String getMappedBy() {
+ return this.mappedBy;
+ }
+
+ public void setMappedBy(String newMappedBy) {
+ String oldMappedBy = this.mappedBy;
+ this.mappedBy = newMappedBy;
+ this.setMappedByOnResourceModel(newMappedBy);
+ firePropertyChanged(INonOwningMapping.MAPPED_BY_PROPERTY, oldMappedBy, newMappedBy);
+ }
+
+ protected abstract void setMappedByOnResourceModel(String mappedBy);
+
+ public String getOrderBy() {
+ return this.orderBy;
+ }
+
+ public void setOrderBy(String newOrderBy) {
+ String oldOrderBy = this.orderBy;
+ this.orderBy = newOrderBy;
+ if (oldOrderBy != newOrderBy) {
+ if (this.orderByResource(this.persistentAttributeResource) != null) {
+ if (newOrderBy != null) {
+ this.orderByResource(this.persistentAttributeResource).setValue(newOrderBy);
+ }
+ else {
+ this.persistentAttributeResource.removeAnnotation(OrderBy.ANNOTATION_NAME);
+ }
+ }
+ else if (newOrderBy != null) {
+ this.persistentAttributeResource.addAnnotation(OrderBy.ANNOTATION_NAME);
+ orderByResource(this.persistentAttributeResource).setValue(newOrderBy);
+ }
+ }
+ firePropertyChanged(IMultiRelationshipMapping.ORDER_BY_PROPERTY, oldOrderBy, newOrderBy);
+ }
+
+ protected void setOrderBy_(String newOrderBy) {
+ String oldOrderBy = this.orderBy;
+ this.orderBy = newOrderBy;
+ firePropertyChanged(IMultiRelationshipMapping.ORDER_BY_PROPERTY, oldOrderBy, newOrderBy);
+ }
+
+ protected OrderBy orderByResource(JavaPersistentAttributeResource persistentAttributeResource) {
+ return (OrderBy) persistentAttributeResource.annotation(OrderBy.ANNOTATION_NAME);
+ }
+
+ public boolean isNoOrdering() {
+ return getOrderBy() == null;
+ }
+
+ public void setNoOrdering() {
+ setOrderBy(null);
+ }
+
+ public boolean isOrderByPk() {
+ return "".equals(getOrderBy());
+ }
+
+ public void setOrderByPk() {
+ setOrderBy("");
+ }
+
+ public boolean isCustomOrdering() {
+ return !StringTools.stringIsEmpty(getOrderBy());
+ }
+
+ public FetchType getDefaultFetch() {
+ return IMultiRelationshipMapping.DEFAULT_FETCH_TYPE;
+ }
+
+ public IJavaJoinTable getJoinTable() {
+ return this.joinTable;
+ }
+
+ public boolean isJoinTableSpecified() {
+ return getJoinTable().isSpecified();
+ }
+
+ public String getMapKey() {
+ return this.mapKey;
+ }
+
+ public void setMapKey(String newMapKey) {
+ String oldMapKey = this.mapKey;
+ this.mapKey = newMapKey;
+ if (oldMapKey != newMapKey) {
+ if (this.mapKeyResource(this.persistentAttributeResource) != null) {
+ if (newMapKey != null) {
+ this.mapKeyResource(this.persistentAttributeResource).setName(newMapKey);
+ }
+ else {
+ this.persistentAttributeResource.removeAnnotation(MapKey.ANNOTATION_NAME);
+ }
+ }
+ else if (newMapKey != null) {
+ this.persistentAttributeResource.addAnnotation(MapKey.ANNOTATION_NAME);
+ mapKeyResource(this.persistentAttributeResource).setName(newMapKey);
+ }
+ }
+ firePropertyChanged(IMultiRelationshipMapping.MAP_KEY_PROPERTY, oldMapKey, newMapKey);
+ }
+
+ protected void setMapKey_(String newMapKey) {
+ String oldMapKey = this.mapKey;
+ this.mapKey = newMapKey;
+ firePropertyChanged(IMultiRelationshipMapping.MAP_KEY_PROPERTY, oldMapKey, newMapKey);
+ }
+
+//TODO default orderBy - this wasn't supported in 1.0 either
+// public void refreshDefaults(DefaultsContext defaultsContext) {
+// super.refreshDefaults(defaultsContext);
+// // if (isOrderByPk()) {
+// // refreshDefaultOrderBy(defaultsContext);
+// // }
+// }
+//
+// //primary key ordering when just the @OrderBy annotation is present
+// protected void refreshDefaultOrderBy(DefaultsContext defaultsContext) {
+// IEntity targetEntity = getResolvedTargetEntity();
+// if (targetEntity != null) {
+// setOrderBy(targetEntity.primaryKeyAttributeName() + " ASC");
+// }
+// }
+
+// private void updateOrderByFromJava(CompilationUnit astRoot) {
+// String orderBy = this.orderByValueAdapter.getValue(astRoot);
+// if (orderBy == null) {
+// if (orderByAnnotation(astRoot) == null) {
+// this.setNoOrdering();
+// }
+// else {
+// this.setOrderByPk();
+// }
+// }
+// else if ("".equals(orderBy)) {
+// this.setOrderByPk();
+// }
+// else {
+// this.setOrderBy(orderBy);
+// }
+// }
+//
+// private Annotation orderByAnnotation(CompilationUnit astRoot) {
+// return this.orderByAnnotationAdapter.getAnnotation(astRoot);
+// }
+//
+// private void updateMapKeyFromJava(CompilationUnit astRoot) {
+// this.setMapKey(this.mapKeyNameAdapter.getValue(astRoot));
+// }
+
+ @Override
+ protected String defaultTargetEntity(JavaPersistentAttributeResource persistentAttributeResource) {
+ if (!persistentAttributeResource.typeIsContainer()) {
+ return null;
+ }
+ return persistentAttributeResource.getQualifiedReferenceEntityElementTypeName();
+ }
+
+ protected abstract boolean mappedByTouches(int pos, CompilationUnit astRoot);
+
+ protected boolean mapKeyNameTouches(int pos, CompilationUnit astRoot) {
+ if (mapKeyResource(this.persistentAttributeResource) != null) {
+ return mapKeyResource(this.persistentAttributeResource).nameTouches(pos, astRoot);
+ }
+ return false;
+ }
+
+ protected MapKey mapKeyResource(JavaPersistentAttributeResource persistentAttributeResource) {
+ return (MapKey) persistentAttributeResource.annotation(MapKey.ANNOTATION_NAME);
+ }
+
+ public Iterator<String> candidateMapKeyNames() {
+ return this.allTargetEntityAttributeNames();
+ }
+
+ protected Iterator<String> candidateMapKeyNames(Filter<String> filter) {
+ return new FilteringIterator<String, String>(this.candidateMapKeyNames(), filter);
+ }
+
+ protected Iterator<String> quotedCandidateMapKeyNames(Filter<String> filter) {
+ return StringTools.quote(this.candidateMapKeyNames(filter));
+ }
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.getJoinTable().candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.mappedByTouches(pos, astRoot)) {
+ return this.quotedCandidateMappedByAttributeNames(filter);
+ }
+ if (this.mapKeyNameTouches(pos, astRoot)) {
+ return this.quotedCandidateMapKeyNames(filter);
+ }
+ return null;
+ }
+
+ @Override
+ public void initializeFromResource(JavaPersistentAttributeResource persistentAttributeResource) {
+ super.initializeFromResource(persistentAttributeResource);
+ MapKey mapKey = this.mapKeyResource(persistentAttributeResource);
+ if (mapKey != null) {
+ this.mapKey = mapKey.getName();
+ }
+ OrderBy orderBy = this.orderByResource(persistentAttributeResource);
+ if (orderBy != null) {
+ this.orderBy = orderBy.getValue();
+ }
+ this.joinTable.initializeFromResource(persistentAttributeResource);
+ }
+
+ @Override
+ protected void initialize(T relationshipMapping) {
+ super.initialize(relationshipMapping);
+ this.mappedBy = this.mappedBy(relationshipMapping);
+ }
+
+ @Override
+ public void update(JavaPersistentAttributeResource persistentAttributeResource) {
+ super.update(persistentAttributeResource);
+ this.updateMapKey(persistentAttributeResource);
+ this.updateOrderBy(persistentAttributeResource);
+ this.joinTable.update(persistentAttributeResource);
+ }
+
+ protected void updateMapKey(JavaPersistentAttributeResource persistentAttributeResource) {
+ MapKey mapKey = this.mapKeyResource(persistentAttributeResource);
+ if (mapKey != null) {
+ setMapKey_(mapKey.getName());
+ }
+ else {
+ setMapKey_(null);
+ }
+ }
+
+ protected void updateOrderBy(JavaPersistentAttributeResource persistentAttributeResource) {
+ OrderBy orderBy = this.orderByResource(persistentAttributeResource);
+ if (orderBy != null) {
+ setOrderBy_(orderBy.getValue());
+ }
+ else {
+ setOrderBy_(null);
+ }
+ }
+
+ @Override
+ protected void update(T relationshipMapping) {
+ super.update(relationshipMapping);
+ this.setMappedBy(this.mappedBy(relationshipMapping));
+ }
+
+ protected abstract String mappedBy(T relationshipMapping);
+
+ //******** Validation ***********************************
+
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+
+ if (this.isJoinTableSpecified()) {
+ addJoinTableMessages(messages, astRoot);
+ }
+ if (this.getMappedBy() != null) {
+ addMappedByMessages(messages, astRoot);
+ }
+ }
+
+ protected void addJoinTableMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ IJavaJoinTable joinTable = this.getJoinTable();
+
+ boolean doContinue = joinTable.isConnected();
+ String schema = joinTable.getSchema();
+
+ if (doContinue && ! joinTable.hasResolvedSchema()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.JOIN_TABLE_UNRESOLVED_SCHEMA,
+ new String[] {schema, joinTable.getName()},
+ joinTable, joinTable.schemaTextRange(astRoot))
+ );
+ doContinue = false;
+ }
+
+ if (doContinue && ! joinTable.isResolved()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.JOIN_TABLE_UNRESOLVED_NAME,
+ new String[] {joinTable.getName()},
+ joinTable, joinTable.nameTextRange(astRoot))
+ );
+ doContinue = false;
+ }
+
+ for (Iterator<IJavaJoinColumn> stream = joinTable.joinColumns(); stream.hasNext(); ) {
+ IJavaJoinColumn joinColumn = stream.next();
+
+ if (doContinue && ! joinColumn.isResolved()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
+ new String[] {joinColumn.getName()},
+ joinColumn, joinColumn.nameTextRange(astRoot))
+ );
+ }
+
+ if (doContinue && ! joinColumn.isReferencedColumnResolved()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
+ new String[] {joinColumn.getReferencedColumnName(), joinColumn.getName()},
+ joinColumn, joinColumn.referencedColumnNameTextRange(astRoot))
+ );
+ }
+ }
+
+ for (Iterator<IJavaJoinColumn> stream = joinTable.inverseJoinColumns(); stream.hasNext(); ) {
+ IJavaJoinColumn joinColumn = stream.next();
+
+ if (doContinue && ! joinColumn.isResolved()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
+ new String[] {joinColumn.getName()},
+ joinColumn, joinColumn.nameTextRange(astRoot))
+ );
+ }
+
+ if (doContinue && ! joinColumn.isReferencedColumnResolved()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
+ new String[] {joinColumn.getReferencedColumnName(), joinColumn.getName()},
+ joinColumn, joinColumn.referencedColumnNameTextRange(astRoot))
+ );
+ }
+ }
+ }
+
+ protected void addMappedByMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ String mappedBy = this.getMappedBy();
+
+ if (this.isJoinTableSpecified()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.MAPPING_MAPPED_BY_WITH_JOIN_TABLE,
+ this.getJoinTable(), this.getJoinTable().validationTextRange(astRoot))
+ );
+
+ }
+
+ IEntity targetEntity = this.getResolvedTargetEntity();
+
+ if (targetEntity == null) {
+ // already have validation messages for that
+ return;
+ }
+
+ IPersistentAttribute attribute = targetEntity.persistentType().resolveAttribute(mappedBy);
+
+ if (attribute == null) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.MAPPING_UNRESOLVED_MAPPED_BY,
+ new String[] {mappedBy},
+ this, this.mappedByTextRange(astRoot))
+ );
+ return;
+ }
+
+ if (! this.mappedByIsValid(attribute.getMapping())) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.MAPPING_INVALID_MAPPED_BY,
+ new String[] {mappedBy},
+ this, this.mappedByTextRange(astRoot))
+ );
+ return;
+ }
+
+ INonOwningMapping mappedByMapping;
+ try {
+ mappedByMapping = (INonOwningMapping) attribute.getMapping();
+ } catch (ClassCastException cce) {
+ // there is no error then
+ return;
+ }
+
+ if (mappedByMapping.getMappedBy() != null) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.MAPPING_MAPPED_BY_ON_BOTH_SIDES,
+ this, this.mappedByTextRange(astRoot))
+ );
+ }
+ }
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedColumn.java
new file mode 100644
index 0000000000..3112ad316e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedColumn.java
@@ -0,0 +1,187 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.INamedColumn;
+import org.eclipse.jpt.core.internal.resource.java.NamedColumn;
+import org.eclipse.jpt.db.internal.Column;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+
+
+public abstract class JavaNamedColumn<T extends NamedColumn> extends JavaContextModel
+ implements IJavaNamedColumn
+{
+
+ protected Owner owner;
+
+ protected String specifiedName;
+
+ protected String defaultName;
+
+ protected String columnDefinition;
+
+ protected JavaNamedColumn(IJavaJpaContextNode parent, Owner owner) {
+ super(parent);
+ this.owner = owner;
+ }
+
+ // ******************* initialization from java resource model ********************
+
+ protected void initializeFromResource(T column) {
+ this.specifiedName = column.getName();
+ this.defaultName = this.defaultName();
+ this.columnDefinition = column.getColumnDefinition();
+ }
+
+
+ protected abstract T columnResource();
+
+
+ //************** INamedColumn implementation *****************
+ public String getName() {
+ return (this.getSpecifiedName() == null) ? getDefaultName() : this.getSpecifiedName();
+ }
+
+ public String getSpecifiedName() {
+ return this.specifiedName;
+ }
+
+ public void setSpecifiedName(String newSpecifiedName) {
+ String oldSpecifiedName = this.specifiedName;
+ this.specifiedName = newSpecifiedName;
+ columnResource().setName(newSpecifiedName);
+ firePropertyChanged(INamedColumn.SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setSpecifiedName_(String newSpecifiedName) {
+ String oldSpecifiedName = this.specifiedName;
+ this.specifiedName = newSpecifiedName;
+ firePropertyChanged(INamedColumn.SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
+ }
+
+ public String getDefaultName() {
+ return this.defaultName;
+ }
+
+ protected void setDefaultName(String newDefaultName) {
+ String oldDefaultName = this.defaultName;
+ this.defaultName = newDefaultName;
+ firePropertyChanged(INamedColumn.DEFAULT_NAME_PROPERTY, oldDefaultName, newDefaultName);
+ }
+
+ public String getColumnDefinition() {
+ return this.columnDefinition;
+ }
+
+ public void setColumnDefinition(String newColumnDefinition) {
+ String oldColumnDefinition = this.columnDefinition;
+ this.columnDefinition = newColumnDefinition;
+ columnResource().setColumnDefinition(newColumnDefinition);
+ firePropertyChanged(INamedColumn.COLUMN_DEFINITION_PROPERTY, oldColumnDefinition, newColumnDefinition);
+ }
+
+ /**
+ * internal setter used only for updating from the resource model.
+ * There were problems with InvalidThreadAccess exceptions in the UI
+ * when you set a value from the UI and the annotation doesn't exist yet.
+ * Adding the annotation causes an update to occur and then the exception.
+ */
+ protected void setColumnDefinition_(String newColumnDefinition) {
+ String oldColumnDefinition = this.columnDefinition;
+ this.columnDefinition = newColumnDefinition;
+ firePropertyChanged(INamedColumn.COLUMN_DEFINITION_PROPERTY, oldColumnDefinition, newColumnDefinition);
+ }
+
+ public Owner owner() {
+ return this.owner;
+ }
+
+ public ITextRange nameTextRange(CompilationUnit astRoot) {
+ ITextRange textRange = this.columnResource().nameTextRange(astRoot);
+ return (textRange != null) ? textRange : this.owner().validationTextRange(astRoot);
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return this.columnResource().nameTouches(pos, astRoot);
+ }
+
+ public Column dbColumn() {
+ Table table = this.dbTable();
+ return (table == null) ? null : table.columnNamed(this.getName());
+ }
+
+ public Table dbTable() {
+ return owner().dbTable(this.tableName());
+ }
+
+ /**
+ * Return the name of the column's table.
+ */
+ protected abstract String tableName();
+
+ public boolean isResolved() {
+ return this.dbColumn() != null;
+ }
+
+ @Override
+ public Iterator<String> connectedCandidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.connectedCandidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.nameTouches(pos, astRoot)) {
+ return this.quotedCandidateNames(filter);
+ }
+ return null;
+ }
+
+ private Iterator<String> candidateNames() {
+ Table dbTable = this.dbTable();
+ return (dbTable != null) ? dbTable.columnNames() : EmptyIterator.<String> instance();
+ }
+
+ private Iterator<String> candidateNames(Filter<String> filter) {
+ return new FilteringIterator<String, String>(this.candidateNames(), filter);
+ }
+
+ private Iterator<String> quotedCandidateNames(Filter<String> filter) {
+ return StringTools.quote(this.candidateNames(filter));
+ }
+
+
+ // ******************* update from java resource model ********************
+
+ protected void update(T column) {
+ this.setSpecifiedName_(column.getName());
+ this.setDefaultName(this.defaultName());
+ this.setColumnDefinition_(column.getColumnDefinition());
+ }
+
+ /**
+ * Return the default column name.
+ */
+ protected String defaultName() {
+ return this.owner().defaultColumnName();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedNativeQuery.java
new file mode 100644
index 0000000000..bdef569b44
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedNativeQuery.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.context.base.INamedNativeQuery;
+import org.eclipse.jpt.core.internal.resource.java.NamedNativeQuery;
+
+
+public class JavaNamedNativeQuery extends AbstractJavaQuery<NamedNativeQuery>
+ implements IJavaNamedNativeQuery
+{
+
+ protected String resultClass;
+
+ protected String resultSetMapping;
+
+ public JavaNamedNativeQuery(IJavaJpaContextNode parent) {
+ super(parent);
+ }
+
+ public String getResultClass() {
+ return this.resultClass;
+ }
+
+ public void setResultClass(String newResultClass) {
+ String oldResultClass = this.resultClass;
+ this.resultClass = newResultClass;
+ query().setResultClass(newResultClass);
+ firePropertyChanged(INamedNativeQuery.RESULT_CLASS_PROPERTY, oldResultClass, newResultClass);
+ }
+
+ public String getResultSetMapping() {
+ return this.resultSetMapping;
+ }
+
+ public void setResultSetMapping(String newResultSetMapping) {
+ String oldResultSetMapping = this.resultSetMapping;
+ this.resultSetMapping = newResultSetMapping;
+ query().setResultSetMapping(newResultSetMapping);
+ firePropertyChanged(INamedNativeQuery.RESULT_SET_MAPPING_PROPERTY, oldResultSetMapping, newResultSetMapping);
+ }
+
+ @Override
+ public void initializeFromResource(NamedNativeQuery queryResource) {
+ super.initializeFromResource(queryResource);
+ this.resultClass = queryResource.getResultClass();
+ this.resultSetMapping = queryResource.getResultSetMapping();
+ }
+
+ @Override
+ public void update(NamedNativeQuery queryResource) {
+ super.update(queryResource);
+ this.setResultClass(queryResource.getResultClass());
+ this.setResultSetMapping(queryResource.getResultSetMapping());
+ }
+
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ListIterator<IJavaQueryHint> hints() {
+ return super.hints();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedQuery.java
new file mode 100644
index 0000000000..30f506226a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedQuery.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.resource.java.NamedQuery;
+
+
+
+public class JavaNamedQuery extends AbstractJavaQuery<NamedQuery> implements IJavaNamedQuery
+{
+
+ public JavaNamedQuery(IJavaJpaContextNode parent) {
+ super(parent);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ListIterator<IJavaQueryHint> hints() {
+ return super.hints();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullAttributeMapping.java
new file mode 100644
index 0000000000..1d23d838f7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullAttributeMapping.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+
+
+public class JavaNullAttributeMapping extends JavaAttributeMapping
+{
+ public JavaNullAttributeMapping(IJavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ public String getKey() {
+ return IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return null;
+ }
+
+ public Iterator<String> correspondingAnnotationNames() {
+ return EmptyIterator.instance();
+ }
+
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNullAttributeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullAttributeMappingProvider.java
index 37d8d240a0..55b53a17b6 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNullAttributeMappingProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullAttributeMappingProvider.java
@@ -7,13 +7,9 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.java.mappings;
+package org.eclipse.jpt.core.internal.context.java;
-import org.eclipse.jpt.core.internal.IJpaFactory;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMappingProvider;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
/**
* This mapping provider implementation is used to create a JavaNullAttributeMapping.
@@ -45,16 +41,11 @@ public class JavaNullAttributeMappingProvider
return null;
}
- //Do not use the IJpaFactory for building this mapping, see constructor for JavaPersistentAttribute
- //where we do no have access to the factory during constrution. This is not a mapping that
- //needs to be extensible, but it is easier to have a mappingProvider for it so we don't have
- //to handle null provider separately
- public IJavaAttributeMapping buildMapping(Attribute attribute, IJpaFactory factory) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaNullAttributeMapping(attribute);
+ public String annotationName() {
+ return null;
}
-
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return JavaNullAttributeMapping.DECLARATION_ANNOTATION_ADAPTER;
+
+ public IJavaAttributeMapping buildMapping(IJavaPersistentAttribute parent, IJpaBaseContextFactory factory) {
+ return factory.createJavaNullAttributeMapping(parent);
}
-
}
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
new file mode 100644
index 0000000000..97f9c4ffb8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+
+public class JavaNullTypeMapping extends JavaTypeMapping
+{
+ public JavaNullTypeMapping(IJavaPersistentType parent) {
+ super(parent);
+ }
+
+ public String annotationName() {
+ return null;
+ }
+
+ public String getKey() {
+ return IMappingKeys.NULL_TYPE_MAPPING_KEY;
+ }
+
+ public boolean isMapped() {
+ return false;
+ }
+
+ public Iterator<String> correspondingAnnotationNames() {
+ return EmptyIterator.instance();
+ }
+
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ // no-op, nothing to really add
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNullTypeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMappingProvider.java
index ac7a9eb017..50e860044f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaNullTypeMappingProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMappingProvider.java
@@ -7,13 +7,9 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.java.mappings;
+package org.eclipse.jpt.core.internal.context.java;
-import org.eclipse.jpt.core.internal.IJpaFactory;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMappingProvider;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
/**
* This mapping provider implementation is used to create a JavaNullAttributeMapping.
@@ -45,12 +41,12 @@ public class JavaNullTypeMappingProvider
return null;
}
- public IJavaTypeMapping buildMapping(Type type, IJpaFactory factory) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaNullTypeMapping(type);
+ public String annotationName() {
+ return null;
}
-
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return JavaNullTypeMapping.DECLARATION_ANNOTATION_ADAPTER;
+
+ public IJavaTypeMapping buildMapping(IJavaPersistentType parent, IJpaBaseContextFactory factory) {
+ return factory.createJavaNullTypeMapping(parent);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToManyMapping.java
new file mode 100644
index 0000000000..4d4e786c9e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToManyMapping.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.OneToMany;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+
+public class JavaOneToManyMapping extends JavaMultiRelationshipMapping<OneToMany>
+ implements IJavaOneToManyMapping
+{
+
+ public JavaOneToManyMapping(IJavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ public Iterator<String> correspondingAnnotationNames() {
+ return new ArrayIterator<String>(
+ JPA.ORDER_BY,
+ JPA.MAP_KEY,
+ JPA.JOIN_TABLE,
+ JPA.JOIN_COLUMN,
+ JPA.JOIN_COLUMNS);
+ }
+
+
+ public String getKey() {
+ return IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return OneToMany.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected OneToMany relationshipMapping() {
+ return (OneToMany) this.persistentAttributeResource.mappingAnnotation();
+ }
+
+ // ********** JavaMultiRelationshipMapping implementation **********
+
+ @Override
+ protected boolean mappedByTouches(int pos, CompilationUnit astRoot) {
+ return this.relationshipMapping().mappedByTouches(pos, astRoot);
+ }
+
+ @Override
+ protected void setMappedByOnResourceModel(String mappedBy) {
+ this.relationshipMapping().setMappedBy(mappedBy);
+ }
+
+ @Override
+ protected String mappedBy(OneToMany relationshipMapping) {
+ return relationshipMapping.getMappedBy();
+ }
+
+
+ // ********** INonOwningMapping implementation **********
+ public boolean mappedByIsValid(IAttributeMapping mappedByMapping) {
+ String mappedByKey = mappedByMapping.getKey();
+ return (mappedByKey == IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ }
+
+ public ITextRange mappedByTextRange(CompilationUnit astRoot) {
+ return this.relationshipMapping().mappedByTextRange(astRoot);
+ }
+
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOneToManyProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToManyMappingProvider.java
index 7f18d75e18..e575067998 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaOneToManyProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToManyMappingProvider.java
@@ -7,24 +7,18 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.java.mappings;
+package org.eclipse.jpt.core.internal.context.java;
-import org.eclipse.jpt.core.internal.IJpaFactory;
import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMappingProvider;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.java.OneToMany;
-/**
- *
- */
-public class JavaOneToManyProvider
+public class JavaOneToManyMappingProvider
implements IJavaAttributeMappingProvider
{
// singleton
- private static final JavaOneToManyProvider INSTANCE = new JavaOneToManyProvider();
+ private static final JavaOneToManyMappingProvider INSTANCE = new JavaOneToManyMappingProvider();
/**
* Return the singleton.
@@ -36,20 +30,19 @@ public class JavaOneToManyProvider
/**
* Ensure non-instantiability.
*/
- private JavaOneToManyProvider() {
+ private JavaOneToManyMappingProvider() {
super();
}
public String key() {
return IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
}
-
- public IJavaAttributeMapping buildMapping(Attribute attribute, IJpaFactory factory) {
- return factory.createJavaOneToMany(attribute);
+
+ public String annotationName() {
+ return OneToMany.ANNOTATION_NAME;
}
- public DeclarationAnnotationAdapter declarationAnnotationAdapter() {
- return JavaOneToMany.DECLARATION_ANNOTATION_ADAPTER;
+ public IJavaAttributeMapping buildMapping(IJavaPersistentAttribute parent, IJpaBaseContextFactory factory) {
+ return factory.createJavaOneToManyMapping(parent);
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToOneMapping.java
new file mode 100644
index 0000000000..118fe3c008
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToOneMapping.java
@@ -0,0 +1,213 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.INonOwningMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.OneToOne;
+import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class JavaOneToOneMapping extends JavaSingleRelationshipMapping<OneToOne>
+ implements IJavaOneToOneMapping
+{
+ protected String mappedBy;
+
+ public JavaOneToOneMapping(IJavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ public Iterator<String> correspondingAnnotationNames() {
+ return new ArrayIterator<String>(
+ JPA.PRIMARY_KEY_JOIN_COLUMN,
+ JPA.PRIMARY_KEY_JOIN_COLUMNS,
+ JPA.JOIN_COLUMN,
+ JPA.JOIN_COLUMNS,
+ JPA.JOIN_TABLE);
+ }
+
+ public String annotationName() {
+ return OneToOne.ANNOTATION_NAME;
+ }
+
+ public String getKey() {
+ return IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected OneToOne relationshipMapping() {
+ return (OneToOne) this.persistentAttributeResource.mappingAnnotation();
+ }
+
+
+ public String getMappedBy() {
+ return this.mappedBy;
+ }
+
+ public void setMappedBy(String newMappedBy) {
+ String oldMappedBy = this.mappedBy;
+ this.mappedBy = newMappedBy;
+ this.relationshipMapping().setMappedBy(newMappedBy);
+ firePropertyChanged(INonOwningMapping.MAPPED_BY_PROPERTY, oldMappedBy, newMappedBy);
+ }
+
+ public boolean mappedByIsValid(IAttributeMapping mappedByMapping) {
+ String mappedByKey = mappedByMapping.getKey();
+ return (mappedByKey == IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ }
+
+ @Override
+ protected void setOptionalOnResourceModel(Boolean newOptional) {
+ this.relationshipMapping().setOptional(newOptional);
+ }
+
+ public ITextRange mappedByTextRange(CompilationUnit astRoot) {
+ return this.relationshipMapping().mappedByTextRange(astRoot);
+ }
+
+ public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
+ return this.relationshipMapping().mappedByTouches(pos, astRoot);
+ }
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.mappedByTouches(pos, astRoot)) {
+ return this.quotedCandidateMappedByAttributeNames(filter);
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isOverridableAssociationMapping() {
+ return true;
+ }
+
+ @Override
+ protected void initialize(OneToOne oneToOneResource) {
+ super.initialize(oneToOneResource);
+ this.mappedBy = oneToOneResource.getMappedBy();
+ }
+
+ @Override
+ protected void update(OneToOne oneToOneResource) {
+ super.update(oneToOneResource);
+ this.setMappedBy(oneToOneResource.getMappedBy());
+ }
+
+ @Override
+ protected Boolean specifiedOptional(OneToOne relationshipMapping) {
+ return relationshipMapping.getOptional();
+ }
+
+ @Override
+ protected boolean isOwningSide() {
+ return this.getMappedBy() == null;
+ }
+
+ //***************** Validation ***********************************
+
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+
+ if (this.getMappedBy() != null) {
+ addMappedByMessages(messages ,astRoot);
+ }
+ }
+
+ protected void addMappedByMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ String mappedBy = this.getMappedBy();
+ IEntity targetEntity = this.getResolvedTargetEntity();
+
+ if (targetEntity == null) {
+ // already have validation messages for that
+ return;
+ }
+
+ IPersistentAttribute attribute = targetEntity.persistentType().resolveAttribute(mappedBy);
+
+ if (attribute == null) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.MAPPING_UNRESOLVED_MAPPED_BY,
+ new String[] {mappedBy},
+ this, this.mappedByTextRange(astRoot))
+ );
+ return;
+ }
+
+ if (! this.mappedByIsValid(attribute.getMapping())) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.MAPPING_INVALID_MAPPED_BY,
+ new String[] {mappedBy},
+ this, this.mappedByTextRange(astRoot))
+ );
+ return;
+ }
+
+ INonOwningMapping mappedByMapping;
+ try {
+ mappedByMapping = (INonOwningMapping) attribute.getMapping();
+ } catch (ClassCastException cce) {
+ // there is no error then
+ return;
+ }
+
+ if (mappedByMapping.getMappedBy() != null) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.MAPPING_MAPPED_BY_ON_BOTH_SIDES,
+ this, this.mappedByTextRange(astRoot))
+ );
+ }
+ }
+
+ //***************** ISingleRelationshipMapping implementation *****************
+ @Override
+ @SuppressWarnings("unchecked")
+ //overriding purely to suppress the warning you get at the class level
+ public ListIterator<IJavaJoinColumn> joinColumns() {
+ return super.joinColumns();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ //overriding purely to suppress the warning you get at the class level
+ public ListIterator<IJavaJoinColumn> defaultJoinColumns() {
+ return super.defaultJoinColumns();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ //overriding purely to suppress the warning you get at the class level
+ public ListIterator<IJavaJoinColumn> specifiedJoinColumns() {
+ return super.specifiedJoinColumns();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToOneMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToOneMappingProvider.java
new file mode 100644
index 0000000000..7c226edd81
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToOneMappingProvider.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.java.OneToOne;
+
+public class JavaOneToOneMappingProvider
+ implements IJavaAttributeMappingProvider
+{
+
+ // singleton
+ private static final JavaOneToOneMappingProvider INSTANCE = new JavaOneToOneMappingProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static IJavaAttributeMappingProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private JavaOneToOneMappingProvider() {
+ super();
+ }
+
+ public String key() {
+ return IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return OneToOne.ANNOTATION_NAME;
+ }
+
+ public IJavaAttributeMapping buildMapping(IJavaPersistentAttribute parent, IJpaBaseContextFactory factory) {
+ return factory.createJavaOneToOneMapping(parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOverride.java
new file mode 100644
index 0000000000..68fdb91971
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOverride.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IOverride;
+import org.eclipse.jpt.core.internal.resource.java.OverrideResource;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+
+
+public abstract class JavaOverride<T extends OverrideResource> extends JavaContextModel implements IOverride
+{
+
+ protected String name;
+
+ protected final Owner owner;
+
+ protected T overrideResource;
+
+ public JavaOverride(IJavaJpaContextNode parent, Owner owner) {
+ super(parent);
+ this.owner = owner;
+ }
+
+ public void initializeFromResource(T overrideResource) {
+ this.overrideResource = overrideResource;
+ this.name = this.name(overrideResource);
+ }
+
+ protected T getOverrideResource() {
+ return this.overrideResource;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.overrideResource.setName(newName);
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ protected void setName_(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public void update(T overrideResource) {
+ this.overrideResource = overrideResource;
+ this.setName_(this.name(overrideResource));
+ }
+
+ protected String name(OverrideResource overrideResource) {
+ return overrideResource.getName();
+ }
+
+ public boolean isVirtual() {
+ return owner().isVirtual(this);
+ }
+
+ public Owner owner() {
+ return this.owner;
+ }
+
+ @Override
+ public IJavaJpaContextNode parent() {
+ return (IJavaJpaContextNode) super.parent();
+ }
+
+ protected abstract Iterator<String> candidateNames();
+
+ private Iterator<String> candidateNames(Filter<String> filter) {
+ return new FilteringIterator<String, String>(this.candidateNames(), filter);
+ }
+
+ private Iterator<String> quotedCandidateNames(Filter<String> filter) {
+ return StringTools.quote(this.candidateNames(filter));
+ }
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.nameTouches(pos, astRoot)) {
+ return this.quotedCandidateNames(filter);
+ }
+ return null;
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return this.overrideResource.nameTouches(pos, astRoot);
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ ITextRange textRange = this.overrideResource.textRange(astRoot);
+ return (textRange != null) ? textRange : this.parent().validationTextRange(astRoot);
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPersistentAttribute.java
new file mode 100644
index 0000000000..5ab0f27503
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPersistentAttribute.java
@@ -0,0 +1,300 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.resource.java.Annotation;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class JavaPersistentAttribute extends JavaContextModel
+ implements IJavaPersistentAttribute
+{
+ protected String name;
+
+ protected IJavaAttributeMapping defaultMapping;
+
+ protected IJavaAttributeMapping specifiedMapping;
+
+ protected JavaPersistentAttributeResource persistentAttributeResource;
+
+ public JavaPersistentAttribute(IJavaPersistentType parent) {
+ super(parent);
+ }
+
+ public void initializeFromResource(JavaPersistentAttributeResource persistentAttributeResource) {
+ this.persistentAttributeResource = persistentAttributeResource;
+ this.name = this.name(persistentAttributeResource);
+ initializeDefaultMapping(persistentAttributeResource);
+ initializeSpecifiedMapping(persistentAttributeResource);
+ }
+
+ protected void initializeDefaultMapping(JavaPersistentAttributeResource persistentAttributeResource) {
+ this.defaultMapping = createDefaultJavaAttributeMapping(persistentAttributeResource);
+ }
+
+ protected void initializeSpecifiedMapping(JavaPersistentAttributeResource persistentAttributeResource) {
+ String javaMappingAnnotationName = this.javaMappingAnnotationName(persistentAttributeResource);
+ this.specifiedMapping = createJavaAttributeMappingFromAnnotation(javaMappingAnnotationName, persistentAttributeResource);
+ }
+
+ public JavaPersistentAttributeResource getPersistentAttributeResource() {
+ return this.persistentAttributeResource;
+ }
+
+ public IJavaPersistentType persistentType() {
+ return (IJavaPersistentType) this.parent();
+ }
+
+ public IJavaTypeMapping typeMapping() {
+ return this.persistentType().getMapping();
+ }
+
+ public String primaryKeyColumnName() {
+ return this.getMapping().primaryKeyColumnName();
+ }
+
+ public boolean isOverridableAttribute() {
+ return this.getMapping().isOverridableAttributeMapping();
+ }
+
+ public boolean isOverridableAssociation() {
+ return this.getMapping().isOverridableAssociationMapping();
+ }
+
+ public boolean isIdAttribute() {
+ return this.getMapping().isIdMapping();
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ protected void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public IJavaAttributeMapping getDefaultMapping() {
+ return this.defaultMapping;
+ }
+
+ /**
+ * clients do not set the "default" mapping
+ */
+ protected void setDefaultMapping(IJavaAttributeMapping newDefaultMapping) {
+ IJavaAttributeMapping oldMapping = this.defaultMapping;
+ this.defaultMapping = newDefaultMapping;
+ firePropertyChanged(IPersistentAttribute.DEFAULT_MAPPING_PROPERTY, oldMapping, newDefaultMapping);
+ }
+
+ public IJavaAttributeMapping getSpecifiedMapping() {
+ return this.specifiedMapping;
+ }
+
+ /**
+ * clients do not set the "specified" mapping;
+ * use #setMappingKey(String)
+ */
+ protected void setSpecifiedMapping(IJavaAttributeMapping newSpecifiedMapping) {
+ IJavaAttributeMapping oldMapping = this.specifiedMapping;
+ this.specifiedMapping = newSpecifiedMapping;
+ firePropertyChanged(IPersistentAttribute.SPECIFIED_MAPPING_PROPERTY, oldMapping, newSpecifiedMapping);
+ }
+
+
+ public IJavaAttributeMapping getMapping() {
+ return (this.specifiedMapping != null) ? this.specifiedMapping : this.defaultMapping;
+ }
+
+ public String mappingKey() {
+ return this.getMapping().getKey();
+ }
+
+ /**
+ * return null if there is no "default" mapping for the attribute
+ */
+ public String defaultMappingKey() {
+ return this.defaultMapping.getKey();
+ }
+
+ /**
+ * return null if there is no "specified" mapping for the attribute
+ */
+ public String specifiedMappingKey() {
+ return (this.specifiedMapping == null) ? null : this.specifiedMapping.getKey();
+ }
+
+ // TODO support morphing mappings, i.e. copying common settings over
+ // to the new mapping; this can't be done in the same was as XmlAttributeMapping
+ // since we don't know all the possible mapping types
+ public void setSpecifiedMappingKey(String newKey) {
+ if (newKey == specifiedMappingKey()) {
+ return;
+ }
+ IJavaAttributeMapping oldMapping = getMapping();
+ IJavaAttributeMapping newMapping = createJavaAttributeMappingFromMappingKey(newKey);
+ setSpecifiedMapping(newMapping);
+ if (newMapping != null) {
+ this.persistentAttributeResource.setMappingAnnotation(newMapping.annotationName());
+ }
+ else {
+ this.persistentAttributeResource.setMappingAnnotation(null);
+ }
+
+ if (oldMapping != null) {
+ Collection<String> annotationsToRemove = CollectionTools.collection(oldMapping.correspondingAnnotationNames());
+ if (getMapping() != null) {
+ CollectionTools.removeAll(annotationsToRemove, getMapping().correspondingAnnotationNames());
+ }
+
+ for (String annotationName : annotationsToRemove) {
+ this.persistentAttributeResource.removeAnnotation(annotationName);
+ }
+ }
+ }
+
+// public boolean includes(int offset) {
+// ITextRange fullTextRange = this.fullTextRange();
+// if (fullTextRange == null) {
+// //This happens if the attribute no longer exists in the java.
+// //The text selection event is fired before the update from java so our
+// //model has not yet had a chance to update appropriately. The list of
+// //JavaPersistentAttriubtes is stale at this point. For now, we are trying
+// //to avoid the NPE, not sure of the ultimate solution to these 2 threads accessing
+// //our model
+// return false;
+// }
+// return fullTextRange.includes(offset);
+// }
+//
+// public ITextRange fullTextRange() {
+// return this.attribute.textRange();
+// }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ return this.selectionTextRange(astRoot);
+ }
+
+ public ITextRange selectionTextRange(CompilationUnit astRoot) {
+ return this.persistentAttributeResource.textRange(astRoot);
+ }
+
+ public void update(JavaPersistentAttributeResource persistentAttributeResource) {
+ this.persistentAttributeResource = persistentAttributeResource;
+ this.setName(this.name(persistentAttributeResource));
+ this.updateDefaultMapping(persistentAttributeResource);
+ this.updateSpecifiedMapping(persistentAttributeResource);
+ }
+
+ protected String name(JavaPersistentAttributeResource persistentAttributeResource) {
+ return persistentAttributeResource.getName();
+ }
+
+ public String specifiedMappingAnnotationName() {
+ return (this.specifiedMapping == null) ? null : this.specifiedMapping.annotationName();
+ }
+
+ protected void updateSpecifiedMapping(JavaPersistentAttributeResource persistentAttributeResource) {
+ String javaMappingAnnotationName = this.javaMappingAnnotationName(persistentAttributeResource);
+ if (specifiedMappingAnnotationName() != javaMappingAnnotationName) {
+ setSpecifiedMapping(createJavaAttributeMappingFromAnnotation(javaMappingAnnotationName, persistentAttributeResource));
+ }
+ else {
+ if (getSpecifiedMapping() != null) {
+ getSpecifiedMapping().update(persistentAttributeResource);
+ }
+ }
+ }
+
+ protected void updateDefaultMapping(JavaPersistentAttributeResource persistentAttributeResource) {
+ String defaultMappingKey = jpaPlatform().defaultJavaAttributeMappingKey(this);
+ if (getDefaultMapping().getKey() != defaultMappingKey) {
+ setDefaultMapping(createDefaultJavaAttributeMapping(persistentAttributeResource));
+ }
+ else {
+ getDefaultMapping().update(persistentAttributeResource);
+ }
+ }
+
+ protected String javaMappingAnnotationName(JavaPersistentAttributeResource persistentAttributeResource) {
+ Annotation mappingAnnotation = (Annotation) persistentAttributeResource.mappingAnnotation();
+ if (mappingAnnotation != null) {
+ return mappingAnnotation.getAnnotationName();
+ }
+ return null;
+ }
+
+ protected IJavaAttributeMapping createJavaAttributeMappingFromMappingKey(String key) {
+ if (key == IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY) {
+ return null;
+ }
+ return jpaPlatform().createJavaAttributeMappingFromMappingKey(key, this);
+ }
+
+ protected IJavaAttributeMapping createJavaAttributeMappingFromAnnotation(String annotationName, JavaPersistentAttributeResource persistentAttributeResource) {
+ if (annotationName == null) {
+ return null;
+ }
+ IJavaAttributeMapping mapping = jpaPlatform().createJavaAttributeMappingFromAnnotation(annotationName, this);
+ mapping.initializeFromResource(persistentAttributeResource);
+ return mapping;
+ }
+
+ protected IJavaAttributeMapping createDefaultJavaAttributeMapping(JavaPersistentAttributeResource persistentAttributeResource) {
+ IJavaAttributeMapping defaultMapping = jpaPlatform().createDefaultJavaAttributeMapping(this);
+ defaultMapping.initializeFromResource(persistentAttributeResource);
+ return defaultMapping;
+ }
+
+ /**
+ * the mapping might be "default", but it still might be a "null" mapping...
+ */
+ public boolean mappingIsDefault() {
+ return this.specifiedMapping == null;
+ }
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return this.getMapping().candidateValuesFor(pos, filter, astRoot);
+ }
+
+ //************* Validation ******************************
+
+ @Override
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+
+ if (this.specifiedMapping != null) {
+ this.specifiedMapping.addToMessages(messages, astRoot);
+ }
+ else if (this.defaultMapping != null) {
+ this.defaultMapping.addToMessages(messages, astRoot);
+ }
+
+ }
+
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPersistentType.java
new file mode 100644
index 0000000000..6a6d014251
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPersistentType.java
@@ -0,0 +1,489 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.context.java;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.IPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.Annotation;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.iterators.ChainIterator;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class JavaPersistentType extends JavaContextModel implements IJavaPersistentType
+{
+ protected String name;
+
+ protected IJavaTypeMapping mapping;
+
+ protected final List<IJavaPersistentAttribute> attributes;
+
+ protected AccessType access;
+
+ /**
+ * Store the parentPersistentType during default calculation. This will
+ * be the first persisentType found in the hierarchy, the JPA spec allows
+ * for non-persistent types to be part of the hierarchy.
+ * Example:
+ *
+ * @Entity public abstract class Model {}
+ *
+ * public abstract class Animal extends Model {}
+ *
+ * @Entity public class Cat extends Animal {}
+ *
+ * If this is the Cat JavaPersistentType then parentPersistentType is the Model JavaPersistentType
+ * The parentPersistentType could be found in java or xml.
+ */
+ protected IPersistentType parentPersistentType;
+
+ protected JavaPersistentTypeResource persistentTypeResource;
+
+ public JavaPersistentType(IJpaContextNode parent) {
+ super(parent);
+ this.attributes = new ArrayList<IJavaPersistentAttribute>();
+ }
+
+ public void initializeFromResource(JavaPersistentTypeResource persistentTypeResource) {
+ this.persistentTypeResource = persistentTypeResource;
+ this.parentPersistentType = this.parentPersistentType(persistentTypeResource);
+ this.access = this.access(persistentTypeResource);
+ this.name = this.name(persistentTypeResource);
+ this.initializeMapping(persistentTypeResource);
+ this.initializePersistentAttributes(persistentTypeResource);
+ }
+
+ protected void initializeMapping(JavaPersistentTypeResource persistentTypeResource) {
+ this.mapping = jpaPlatform().createJavaTypeMappingFromAnnotation(this.javaMappingAnnotationName(persistentTypeResource), this);
+ this.mapping.initializeFromResource(persistentTypeResource);
+ }
+
+ protected void initializePersistentAttributes(JavaPersistentTypeResource persistentTypeResource) {
+ Iterator<JavaPersistentAttributeResource> resourceAttributes = persistentTypeResource.fields();
+ if (access() == AccessType.PROPERTY) {
+ resourceAttributes = persistentTypeResource.properties();
+ }
+
+ while (resourceAttributes.hasNext()) {
+ this.attributes.add(createAttribute(resourceAttributes.next()));
+ }
+ }
+
+ @Override
+ public IResource resource() {
+ return this.persistentTypeResource.resourceModel().resource().getCompilationUnit().getResource();
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ protected void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public IJavaTypeMapping getMapping() {
+ return this.mapping;
+ }
+
+ public String mappingKey() {
+ return getMapping().getKey();
+ }
+
+ public void setMappingKey(String key) {
+ if (key == getMapping().getKey()) {
+ return;
+ }
+ IJavaTypeMapping oldMapping = getMapping();
+ IJavaTypeMapping newMapping = createJavaTypeMappingFromMappingKey(key);
+ setMapping(newMapping);
+ this.persistentTypeResource.setMappingAnnotation(newMapping.annotationName());
+
+ if (oldMapping != null) {
+ Collection<String> annotationsToRemove = CollectionTools.collection(oldMapping.correspondingAnnotationNames());
+ if (getMapping() != null) {
+ CollectionTools.removeAll(annotationsToRemove, getMapping().correspondingAnnotationNames());
+ }
+
+ for (String annotationName : annotationsToRemove) {
+ this.persistentTypeResource.removeAnnotation(annotationName);
+ }
+ }
+ }
+
+ protected void setMapping(IJavaTypeMapping newMapping) {
+ IJavaTypeMapping oldMapping = this.mapping;
+ this.mapping = newMapping;
+ firePropertyChanged(IPersistentType.MAPPING_PROPERTY, oldMapping, newMapping);
+ }
+
+ public boolean isMapped() {
+ return getMapping().isMapped();
+ }
+
+ public AccessType access() {
+ return this.access;
+ }
+
+ protected void setAccess(AccessType newAccess) {
+ AccessType oldAccess = this.access;
+ this.access = newAccess;
+ firePropertyChanged(ACCESS_PROPERTY, oldAccess, newAccess);
+ }
+
+ protected Iterator<JavaPersistentAttribute> attributesNamed(final String attributeName) {
+ return new FilteringIterator<IJavaPersistentAttribute, JavaPersistentAttribute>(attributes()) {
+ @Override
+ protected boolean accept(IJavaPersistentAttribute o) {
+ return attributeName.equals(o.getName());
+ }
+ };
+ }
+
+ public JavaPersistentAttribute attributeNamed(String attributeName) {
+ Iterator<JavaPersistentAttribute> stream = attributesNamed(attributeName);
+ return (stream.hasNext()) ? stream.next() : null;
+ }
+
+ public IPersistentAttribute resolveAttribute(String attributeName) {
+ Iterator<JavaPersistentAttribute> stream = attributesNamed(attributeName);
+ if (stream.hasNext()) {
+ JavaPersistentAttribute attribute = stream.next();
+ return (stream.hasNext()) ? null /*more than one*/: attribute;
+ }
+ return (parentPersistentType() == null) ? null : parentPersistentType().resolveAttribute(attributeName);
+ }
+
+ public ListIterator<IJavaPersistentAttribute> attributes() {
+ return new CloneListIterator<IJavaPersistentAttribute>(this.attributes);
+ }
+
+ public int attributesSize() {
+ return this.attributes.size();
+ }
+
+ private void addAttribute(IJavaPersistentAttribute attribute) {
+ addItemToList(attribute, this.attributes, IPersistentType.SPECIFIED_ATTRIBUTES_LIST);
+ }
+
+ private void removeAttribute(IJavaPersistentAttribute attribute) {
+ removeItemFromList(attribute, this.attributes, IPersistentType.SPECIFIED_ATTRIBUTES_LIST);
+ }
+
+ public Iterator<String> attributeNames() {
+ return this.attributeNames(this.attributes());
+ }
+
+ protected Iterator<String> attributeNames(Iterator<? extends IPersistentAttribute> attrs) {
+ return new TransformationIterator<IPersistentAttribute, String>(attrs) {
+ @Override
+ protected String transform(IPersistentAttribute attribute) {
+ return attribute.getName();
+ }
+ };
+ }
+
+ public Iterator<IPersistentAttribute> allAttributes() {
+ return new CompositeIterator<IPersistentAttribute>(new TransformationIterator<IPersistentType, Iterator<IPersistentAttribute>>(this.inheritanceHierarchy()) {
+ @Override
+ protected Iterator<IPersistentAttribute> transform(IPersistentType pt) {
+ return pt.attributes();
+ }
+ });
+ }
+
+ public Iterator<String> allAttributeNames() {
+ return this.attributeNames(this.allAttributes());
+ }
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ Iterator<String> values = this.mapping.candidateValuesFor(pos, filter, astRoot);
+ if (values != null) {
+ return values;
+ }
+ for (Iterator<IJavaPersistentAttribute> stream = attributes(); stream.hasNext();) {
+ values = stream.next().candidateValuesFor(pos, filter, astRoot);
+ if (values != null) {
+ return values;
+ }
+ }
+ return EmptyIterator.instance();
+ }
+//
+// public IJpaContentNode contentNodeAt(int offset) {
+// for (Iterator<JavaPersistentAttribute> i = attributes(); i.hasNext();) {
+// JavaPersistentAttribute persistentAttribute = i.next();
+// if (persistentAttribute.includes(offset)) {
+// return persistentAttribute;
+// }
+// }
+// return null;
+// }
+
+// public boolean includes(int offset) {
+// ITextRange fullTextRange = this.fullTextRange();
+// if (fullTextRange == null) {
+// //This happens if the type no longer exists in the java (rename in editor).
+// //The text selection event is fired before the update from java so our
+// //model has not yet had a chance to update appropriately. For now, avoid the NPE,
+// //not sure of the ultimate solution to these 2 threads accessing our model
+// return false;
+// }
+// return fullTextRange.includes(offset);
+// }
+//
+// public ITextRange fullTextRange() {
+// return this.persistentTypeResource.fullTextRange();
+// }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ return this.selectionTextRange(astRoot);
+ }
+
+ public ITextRange selectionTextRange(CompilationUnit astRoot) {
+ return this.persistentTypeResource.textRange(astRoot);
+ }
+
+ public Iterator<IPersistentType> inheritanceHierarchy() {
+ // using a chain iterator to traverse up the inheritance tree
+ return new ChainIterator<IPersistentType>(this) {
+ @Override
+ protected IPersistentType nextLink(IPersistentType pt) {
+ return pt.parentPersistentType();
+ }
+ };
+ }
+
+ public IPersistentType parentPersistentType() {
+ return this.parentPersistentType;
+ }
+
+ public boolean hasAnyAttributeMappingAnnotations() {
+ if (this.persistentTypeResource.hasAnyAttributeAnnotations()) {
+ return true;
+ }
+ return false;
+ }
+
+ // ******************** Updating **********************
+ public void update(JavaPersistentTypeResource persistentTypeResource) {
+ this.persistentTypeResource = persistentTypeResource;
+ this.persistentTypeResource.resourceModel().addRootContextNode(this);
+ updateParentPersistentType(persistentTypeResource);
+ updateAccess(persistentTypeResource);
+ updateName(persistentTypeResource);
+ updateMapping(persistentTypeResource);
+ updatePersistentAttributes(persistentTypeResource);
+ }
+
+ protected void updateAccess(JavaPersistentTypeResource persistentTypeResource) {
+ this.setAccess(this.access(persistentTypeResource));
+ }
+
+ /**
+ * Check the access "specified" by the java resource model.
+ * Check xml mapping specified access first
+ * If still null check java annotations if the xml is not metadata-complete = true
+ * If still null then set to parentPersistentType 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.
+ */
+ protected AccessType access(JavaPersistentTypeResource persistentTypeResource) {
+ AccessType javaAccess = null;
+ boolean metadataComplete = false;
+ if (xmlPersistentType() != null) {
+ javaAccess = xmlPersistentType().getMapping().getSpecifiedAccess();
+ metadataComplete = xmlPersistentType().getMapping().isMetadataComplete();
+ }
+ if (javaAccess == null && !metadataComplete) {
+ javaAccess = AccessType.fromJavaResourceModel(persistentTypeResource.getAccess());
+ }
+ if (javaAccess == null) {
+ if (parentPersistentType() != null) {
+ javaAccess = parentPersistentType().access();
+ }
+ }
+ if (javaAccess == null) {
+ if (entityMappings() != null) {
+ javaAccess = entityMappings().getAccess();
+ }
+ }
+ if (javaAccess == null) {
+ //have to check persistence-unit separately in the case where it is not listed directly in an orm.xml
+ //if it is listed in an orm.xml then the entityMappings().getAccess() check will cover persistence-unit.defaultAccess
+ if (persistenceUnit() != null) {
+ javaAccess = persistenceUnit().getDefaultAccess();
+ }
+ }
+ if (javaAccess == null) {
+ javaAccess = AccessType.FIELD;
+ }
+ return javaAccess;
+ }
+
+ protected void updateName(JavaPersistentTypeResource persistentTypeResource) {
+ this.setName(this.name(persistentTypeResource));
+ }
+
+ protected String name(JavaPersistentTypeResource persistentTypeResource) {
+ return persistentTypeResource.getQualifiedName();
+ }
+
+ protected void updateMapping(JavaPersistentTypeResource persistentTypeResource) {
+ String javaMappingAnnotationName = this.javaMappingAnnotationName(persistentTypeResource);
+ if (getMapping().annotationName() != javaMappingAnnotationName) {
+ setMapping(createJavaTypeMappingFromAnnotation(javaMappingAnnotationName, persistentTypeResource));
+ }
+ else {
+ getMapping().update(persistentTypeResource);
+ }
+ }
+
+ protected IJavaTypeMapping createJavaTypeMappingFromMappingKey(String key) {
+ return jpaPlatform().createJavaTypeMappingFromMappingKey(key, this);
+ }
+
+ protected IJavaTypeMapping createJavaTypeMappingFromAnnotation(String annotationName, JavaPersistentTypeResource persistentTypeResource) {
+ IJavaTypeMapping mapping = jpaPlatform().createJavaTypeMappingFromAnnotation(annotationName, this);
+ mapping.initializeFromResource(persistentTypeResource);
+ return mapping;
+ }
+
+ protected String javaMappingAnnotationName(JavaPersistentTypeResource typeResource) {
+ Annotation mappingAnnotation = (Annotation) typeResource.mappingAnnotation();
+ if (mappingAnnotation != null) {
+ return mappingAnnotation.getAnnotationName();
+ }
+ return null;
+ }
+
+ protected void updatePersistentAttributes(JavaPersistentTypeResource persistentTypeResource) {
+ ListIterator<IJavaPersistentAttribute> contextAttributes = attributes();
+ Iterator<JavaPersistentAttributeResource> resourceAttributes = persistentTypeResource.fields();
+ if (access() == AccessType.PROPERTY) {
+ resourceAttributes = persistentTypeResource.properties();
+ }
+
+ while (contextAttributes.hasNext()) {
+ IJavaPersistentAttribute persistentAttribute = contextAttributes.next();
+ if (resourceAttributes.hasNext()) {
+ persistentAttribute.update(resourceAttributes.next());
+ }
+ else {
+ removeAttribute(persistentAttribute);
+ }
+ }
+
+ while (resourceAttributes.hasNext()) {
+ addAttribute(createAttribute(resourceAttributes.next()));
+ }
+ }
+
+ protected IJavaPersistentAttribute createAttribute(JavaPersistentAttributeResource persistentAttributeResource) {
+ IJavaPersistentAttribute javaPersistentAttribute = jpaFactory().createJavaPersistentAttribute(this);
+ javaPersistentAttribute.initializeFromResource(persistentAttributeResource);
+ return javaPersistentAttribute;
+ }
+
+ public void updateParentPersistentType(JavaPersistentTypeResource persistentTypeResource) {
+ //TODO do we need any change notification for this?
+ this.parentPersistentType = parentPersistentType(persistentTypeResource);
+ }
+
+ protected IPersistentType parentPersistentType(JavaPersistentTypeResource persistentTypeResource) {
+ return parentPersistentType(persistentTypeResource.getSuperClassQualifiedName());
+ }
+
+ protected IPersistentType parentPersistentType(String fullyQualifiedTypeName) {
+ IPersistentType possibleParent = possibleParent(fullyQualifiedTypeName);
+ if (possibleParent == null) {
+ return null;
+ }
+ if (possibleParent.isMapped()) {
+ return possibleParent;
+ }
+ return possibleParent.parentPersistentType();
+ }
+
+ /**
+ * JPA spec supports the case where there are non-persistent types in the hierarchy
+ * This will check for a PersistentType with the given name in this PersistenceUnit.
+ * If it is not found then find the JavaPersistentTypeResource and look for its parent type
+ */
+ protected IPersistentType possibleParent(String fullyQualifiedTypeName) {
+ IPersistentType possibleParent = persistentType(fullyQualifiedTypeName);
+ if (possibleParent != null) {
+ return possibleParent;
+ }
+ JavaPersistentTypeResource javaPersistentTypeResource = jpaProject().javaPersistentTypeResource(fullyQualifiedTypeName);
+ if (javaPersistentTypeResource != null) {
+ return possibleParent(javaPersistentTypeResource.getSuperClassQualifiedName());
+ }
+ return null;
+ }
+
+ protected IPersistentType persistentType(String fullyQualifiedTypeName) {
+ return persistenceUnit().persistentType(fullyQualifiedTypeName);
+ }
+
+ //*************** Validation ******************************************
+ @Override
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+
+ //get astRoot here to pass down
+ astRoot = persistentTypeResource.getMember().astRoot();
+ mapping.addToMessages(messages, astRoot);
+
+ addAttributeMessages(messages, astRoot);
+
+ }
+
+ protected void addAttributeMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ for (IJavaPersistentAttribute attributeContext : this.attributes) {
+ attributeContext.addToMessages(messages, astRoot);
+ }
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ super.toString(sb);
+ sb.append(getName());
+ }
+
+
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..0f7ac23e9b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPrimaryKeyJoinColumn.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.db.internal.Column;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+
+
+public class JavaPrimaryKeyJoinColumn extends JavaNamedColumn<PrimaryKeyJoinColumn>
+ implements IJavaPrimaryKeyJoinColumn
+{
+ protected String specifiedReferencedColumnName;
+
+ protected String defaultReferencedColumnName;
+
+ protected PrimaryKeyJoinColumn primaryKeyJoinColumnResource;
+
+ public JavaPrimaryKeyJoinColumn(IJavaJpaContextNode parent, IAbstractJoinColumn.Owner owner) {
+ super(parent, owner);
+ }
+
+ @Override
+ public void initializeFromResource(PrimaryKeyJoinColumn column) {
+ this.primaryKeyJoinColumnResource = column;
+ super.initializeFromResource(column);
+ this.specifiedReferencedColumnName = this.specifiedReferencedColumnName(column);
+ this.defaultReferencedColumnName = this.defaultReferencedColumnName();
+ }
+
+ //************** JavaNamedColumn implementation ***************
+ @Override
+ public IAbstractJoinColumn.Owner owner() {
+ return (IAbstractJoinColumn.Owner) super.owner();
+ }
+
+ @Override
+ protected PrimaryKeyJoinColumn columnResource() {
+ return this.primaryKeyJoinColumnResource;
+ }
+
+ //************** IAbstractJoinColumn implementation ***************
+
+ public String getReferencedColumnName() {
+ return (this.specifiedReferencedColumnName == null) ? this.defaultReferencedColumnName : this.specifiedReferencedColumnName;
+ }
+
+ public String getSpecifiedReferencedColumnName() {
+ return this.specifiedReferencedColumnName;
+ }
+
+ public void setSpecifiedReferencedColumnName(String newSpecifiedReferencedColumnName) {
+ String oldSpecifiedReferencedColumnName = this.specifiedReferencedColumnName;
+ this.specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
+ columnResource().setReferencedColumnName(newSpecifiedReferencedColumnName);
+ firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, oldSpecifiedReferencedColumnName, newSpecifiedReferencedColumnName);
+ }
+
+ public String getDefaultReferencedColumnName() {
+ return this.defaultReferencedColumnName;
+ }
+
+ protected void setDefaultReferencedColumnName(String newDefaultReferencedColumnName) {
+ String oldDefaultReferencedColumnName = this.defaultReferencedColumnName;
+ this.defaultReferencedColumnName = newDefaultReferencedColumnName;
+ firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, oldDefaultReferencedColumnName, newDefaultReferencedColumnName);
+ }
+
+ public boolean isVirtual() {
+ return owner().isVirtual(this);
+ }
+
+ @Override
+ protected String tableName() {
+ return this.owner().typeMapping().getTableName();
+ }
+
+ public Column dbReferencedColumn() {
+ Table table = this.dbReferencedColumnTable();
+ return (table == null) ? null : table.columnNamed(this.getReferencedColumnName());
+ }
+
+ public Table dbReferencedColumnTable() {
+ return owner().dbReferencedColumnTable();
+ }
+
+ public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
+ return this.columnResource().referencedColumnNameTouches(pos, astRoot);
+ }
+
+ private Iterator<String> candidateReferencedColumnNames() {
+ Table table = this.owner().dbReferencedColumnTable();
+ return (table != null) ? table.columnNames() : EmptyIterator.<String> instance();
+ }
+
+ private Iterator<String> candidateReferencedColumnNames(Filter<String> filter) {
+ return new FilteringIterator<String, String>(this.candidateReferencedColumnNames(), filter);
+ }
+
+ private Iterator<String> quotedCandidateReferencedColumnNames(Filter<String> filter) {
+ return StringTools.quote(this.candidateReferencedColumnNames(filter));
+ }
+
+ @Override
+ public Iterator<String> connectedCandidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.connectedCandidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ if (this.referencedColumnNameTouches(pos, astRoot)) {
+ return this.quotedCandidateReferencedColumnNames(filter);
+ }
+ return null;
+ }
+
+ public boolean isReferencedColumnResolved() {
+ return dbReferencedColumn() != null;
+ }
+
+ public ITextRange referencedColumnNameTextRange(CompilationUnit astRoot) {
+ return this.columnResource().referencedColumnNameTextRange(astRoot);
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ ITextRange textRange = columnResource().textRange(astRoot);
+ return (textRange != null) ? textRange : this.owner().validationTextRange(astRoot);
+ }
+
+ @Override
+ public void update(PrimaryKeyJoinColumn column) {
+ this.primaryKeyJoinColumnResource = column;
+ super.update(column);
+ this.setSpecifiedReferencedColumnName(this.specifiedReferencedColumnName(column));
+ this.setDefaultReferencedColumnName(this.defaultReferencedColumnName());
+ }
+
+ protected String specifiedReferencedColumnName(PrimaryKeyJoinColumn column) {
+ return column.getReferencedColumnName();
+ }
+
+ protected String defaultReferencedColumnName() {
+ return defaultName();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaQueryHint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaQueryHint.java
new file mode 100644
index 0000000000..8c3808d1ed
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaQueryHint.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IQueryHint;
+import org.eclipse.jpt.core.internal.resource.java.QueryHint;
+
+public class JavaQueryHint extends JavaContextModel implements IJavaQueryHint
+{
+ protected String name;
+
+ protected String value;
+
+ protected QueryHint queryHint;
+
+ public JavaQueryHint(IJavaQuery<?> parent) {
+ super(parent);
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.queryHint.setName(newName);
+ firePropertyChanged(IQueryHint.NAME_PROPERTY, oldName, newName);
+ }
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String newValue) {
+ String oldValue = this.value;
+ this.value = newValue;
+ this.queryHint.setValue(newValue);
+ firePropertyChanged(IQueryHint.VALUE_PROPERTY, oldValue, newValue);
+ }
+
+
+ public void initializeFromResource(QueryHint queryHint) {
+ this.queryHint = queryHint;
+ this.name = queryHint.getName();
+ this.value = queryHint.getValue();
+ }
+
+ public void update(QueryHint queryHint) {
+ this.queryHint = queryHint;
+ this.setName(queryHint.getName());
+ this.setValue(queryHint.getValue());
+ }
+
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaRelationshipMapping.java
new file mode 100644
index 0000000000..79a805f5a9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaRelationshipMapping.java
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IFetchable;
+import org.eclipse.jpt.core.internal.context.base.IPersistentType;
+import org.eclipse.jpt.core.internal.context.base.IRelationshipMapping;
+import org.eclipse.jpt.core.internal.context.base.RelationshipMappingTools;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.RelationshipMapping;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+
+public abstract class JavaRelationshipMapping<T extends RelationshipMapping> extends JavaAttributeMapping
+ implements IJavaRelationshipMapping
+{
+
+ protected String specifiedTargetEntity;
+
+ protected String defaultTargetEntity;
+
+ protected IEntity resolvedTargetEntity;
+
+ protected final JavaCascade cascade;
+
+ protected FetchType specifiedFetch;
+
+ protected JavaRelationshipMapping(IJavaPersistentAttribute parent) {
+ super(parent);
+ this.cascade = new JavaCascade(this);
+ }
+
+ protected abstract T relationshipMapping();
+
+ public String getTargetEntity() {
+ return (this.getSpecifiedTargetEntity() == null) ? getDefaultTargetEntity() : this.getSpecifiedTargetEntity();
+ }
+
+ public String getSpecifiedTargetEntity() {
+ return this.specifiedTargetEntity;
+ }
+
+ public void setSpecifiedTargetEntity(String newSpecifiedTargetEntity) {
+ String oldSpecifiedTargetEntity = this.specifiedTargetEntity;
+ this.specifiedTargetEntity = newSpecifiedTargetEntity;
+ this.relationshipMapping().setTargetEntity(newSpecifiedTargetEntity);
+ firePropertyChanged(IRelationshipMapping.SPECIFIED_TARGET_ENTITY_PROPERTY, oldSpecifiedTargetEntity, newSpecifiedTargetEntity);
+ }
+
+ public String getDefaultTargetEntity() {
+ return this.defaultTargetEntity;
+ }
+
+ protected void setDefaultTargetEntity(String newDefaultTargetEntity) {
+ String oldDefaultTargetEntity = this.defaultTargetEntity;
+ this.defaultTargetEntity = newDefaultTargetEntity;
+ firePropertyChanged(IRelationshipMapping.DEFAULT_TARGET_ENTITY_PROPERTY, oldDefaultTargetEntity, newDefaultTargetEntity);
+ }
+
+ public IEntity getResolvedTargetEntity() {
+ return this.resolvedTargetEntity;
+ }
+
+ protected void setResolvedTargetEntity(IEntity newResolvedTargetEntity) {
+ IEntity oldResolvedTargetEntity = this.resolvedTargetEntity;
+ this.resolvedTargetEntity = newResolvedTargetEntity;
+ firePropertyChanged(IRelationshipMapping.RESOLVED_TARGET_ENTITY_PROPERTY, oldResolvedTargetEntity, newResolvedTargetEntity);
+ }
+
+ public JavaCascade getCascade() {
+ return this.cascade;
+ }
+
+ public FetchType getFetch() {
+ return (this.getSpecifiedFetch() == null) ? this.getDefaultFetch() : this.getSpecifiedFetch();
+ }
+
+ public FetchType getSpecifiedFetch() {
+ return this.specifiedFetch;
+ }
+
+ public void setSpecifiedFetch(FetchType newSpecifiedFetch) {
+ FetchType oldFetch = this.specifiedFetch;
+ this.specifiedFetch = newSpecifiedFetch;
+ this.relationshipMapping().setFetch(FetchType.toJavaResourceModel(newSpecifiedFetch));
+ firePropertyChanged(IFetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch);
+ }
+
+ @Override
+ public void initializeFromResource(JavaPersistentAttributeResource persistentAttributeResource) {
+ super.initializeFromResource(persistentAttributeResource);
+ this.defaultTargetEntity = this.defaultTargetEntity(persistentAttributeResource);
+ initialize(this.relationshipMapping());
+ }
+
+ @Override
+ public void update(JavaPersistentAttributeResource persistentAttributeResource) {
+ super.update(persistentAttributeResource);
+ this.setDefaultTargetEntity(this.defaultTargetEntity(persistentAttributeResource));
+ this.update(this.relationshipMapping());
+ }
+
+ protected void initialize(T relationshipMapping) {
+ this.specifiedFetch = this.fetch(relationshipMapping);
+ this.cascade.initialize(relationshipMapping);
+ this.specifiedTargetEntity = this.specifiedTargetEntity(relationshipMapping);
+ this.resolvedTargetEntity = this.resolveTargetEntity(relationshipMapping);
+ }
+
+ protected void update(T relationshipMapping) {
+ this.setSpecifiedFetch(this.fetch(relationshipMapping));
+ this.cascade.update(relationshipMapping);
+ this.setSpecifiedTargetEntity(this.specifiedTargetEntity(relationshipMapping));
+ this.setResolvedTargetEntity(this.resolveTargetEntity(relationshipMapping));
+ }
+
+ protected FetchType fetch(T relationshipMapping) {
+ return FetchType.fromJavaResourceModel(relationshipMapping.getFetch());
+ }
+
+ protected String specifiedTargetEntity(T relationshipMapping) {
+ return relationshipMapping.getTargetEntity();
+ }
+
+ protected abstract String defaultTargetEntity(JavaPersistentAttributeResource persistentAttributeResource);
+
+ protected IEntity resolveTargetEntity(T relationshipMapping) {
+ String qualifiedTargetEntity = getDefaultTargetEntity();
+ if (getSpecifiedTargetEntity() != null) {
+ qualifiedTargetEntity = relationshipMapping.getFullyQualifiedTargetEntity();
+ }
+ if (qualifiedTargetEntity == null) {
+ return null;
+ }
+ IPersistentType persistentType = persistenceUnit().persistentType(qualifiedTargetEntity);
+ if (persistentType != null && persistentType.mappingKey() == IMappingKeys.ENTITY_TYPE_MAPPING_KEY) {
+ return (IEntity) persistentType.getMapping();
+ }
+ return null;
+ }
+
+ public IEntity getEntity() {
+ if (typeMapping() instanceof IEntity) {
+ return (IEntity) typeMapping();
+ }
+ return null;
+ }
+
+ public Iterator<String> allTargetEntityAttributeNames() {
+ IEntity targetEntity = this.getResolvedTargetEntity();
+ return (targetEntity == null) ? EmptyIterator.<String> instance() : targetEntity.persistentType().allAttributeNames();
+ }
+
+ public Iterator<String> candidateMappedByAttributeNames() {
+ return this.allTargetEntityAttributeNames();
+ }
+
+ protected Iterator<String> candidateMappedByAttributeNames(Filter<String> filter) {
+ return new FilteringIterator<String, String>(this.candidateMappedByAttributeNames(), filter);
+ }
+
+ protected Iterator<String> quotedCandidateMappedByAttributeNames(Filter<String> filter) {
+ return StringTools.quote(this.candidateMappedByAttributeNames(filter));
+ }
+
+
+ // ********** static methods **********
+
+ public boolean targetEntityIsValid(String targetEntity) {
+ return RelationshipMappingTools.targetEntityIsValid(targetEntity);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaSecondaryTable.java
new file mode 100644
index 0000000000..62cc9caaad
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaSecondaryTable.java
@@ -0,0 +1,255 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.ISecondaryTable;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.resource.java.NullPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.SecondaryTable;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator;
+
+public class JavaSecondaryTable extends AbstractJavaTable
+ implements IJavaSecondaryTable
+{
+ protected final List<IJavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns;
+
+ protected final IJavaPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
+
+ protected SecondaryTable secondaryTableResource;
+
+ public JavaSecondaryTable(IJavaEntity parent) {
+ super(parent);
+ this.specifiedPrimaryKeyJoinColumns = new ArrayList<IJavaPrimaryKeyJoinColumn>();
+ this.defaultPrimaryKeyJoinColumn = this.jpaFactory().createJavaPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner());
+ }
+
+ protected IAbstractJoinColumn.Owner createPrimaryKeyJoinColumnOwner() {
+ return new PrimaryKeyJoinColumnOwner();
+ }
+
+ public void initializeFromResource(SecondaryTable secondaryTable) {
+ super.initializeFromResource(secondaryTable);
+ this.secondaryTableResource = secondaryTable;
+ this.initializePrimaryKeyJoinColumns(secondaryTable);
+ }
+
+ protected void initializePrimaryKeyJoinColumns(SecondaryTable secondaryTable) {
+ ListIterator<PrimaryKeyJoinColumn> annotations = secondaryTable.pkJoinColumns();
+
+ while(annotations.hasNext()) {
+ IJavaPrimaryKeyJoinColumn primaryKeyJoinColumn = jpaFactory().createJavaPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner());
+ primaryKeyJoinColumn.initializeFromResource(annotations.next());
+ this.specifiedPrimaryKeyJoinColumns.add(primaryKeyJoinColumn);
+ }
+ }
+
+ //***************** AbstractJavaTable implementation ********************
+
+ @Override
+ protected String annotationName() {
+ return SecondaryTable.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected SecondaryTable tableResource() {
+ return this.secondaryTableResource;
+ }
+
+ @Override
+ protected String defaultName() {
+ return null;
+ }
+
+ //***************** ISecondaryTable implementation ********************
+
+
+ public ListIterator<IJavaPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
+ return this.specifiedPrimaryKeyJoinColumns.isEmpty() ? this.defaultPrimaryKeyJoinColumns() : this.specifiedPrimaryKeyJoinColumns();
+ }
+
+ public ListIterator<IJavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
+ return new CloneListIterator<IJavaPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
+ }
+
+ public ListIterator<IJavaPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns() {
+ return new SingleElementListIterator<IJavaPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumn);
+ }
+
+ public IJavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
+ IJavaPrimaryKeyJoinColumn primaryKeyJoinColumn = jpaFactory().createJavaPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner());
+ this.specifiedPrimaryKeyJoinColumns.add(index, primaryKeyJoinColumn);
+ this.secondaryTableResource.addPkJoinColumn(index);
+ this.fireItemAdded(ISecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, primaryKeyJoinColumn);
+ return primaryKeyJoinColumn;
+ }
+
+ protected void addSpecifiedPrimaryKeyJoinColumn(int index, IJavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
+ addItemToList(index, primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, ISecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
+ IJavaPrimaryKeyJoinColumn removedPrimaryKeyJoinColumn = this.specifiedPrimaryKeyJoinColumns.remove(index);
+ this.secondaryTableResource.removePkJoinColumn(index);
+ fireItemRemoved(ISecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, removedPrimaryKeyJoinColumn);
+ }
+
+ protected void removeSpecifiedPrimaryKeyJoinColumn(IJavaPrimaryKeyJoinColumn primaryKeyJoinColumn) {
+ removeItemFromList(primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, ISecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedPrimaryKeyJoinColumns, targetIndex, sourceIndex);
+ this.secondaryTableResource.movePkJoinColumn(targetIndex, sourceIndex);
+ fireItemMoved(ISecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
+ }
+
+ public int specifiedPrimaryKeyJoinColumnsSize() {
+ return this.specifiedPrimaryKeyJoinColumns.size();
+ }
+
+ public int primaryKeyJoinColumnsSize() {
+ return CollectionTools.size(primaryKeyJoinColumns());
+ }
+
+ public IJavaEntity javaEntity() {
+ return (IJavaEntity) parent();
+ }
+
+
+ //********************* updating ************************
+
+ public void update(SecondaryTable secondaryTableResource) {
+ this.secondaryTableResource = secondaryTableResource;
+ super.update(secondaryTableResource);
+ this.updateSpecifiedPrimaryKeyJoinColumns(secondaryTableResource);
+ this.updateDefaultPrimaryKeyJoinColumns(secondaryTableResource);
+ }
+
+ protected void updateSpecifiedPrimaryKeyJoinColumns(SecondaryTable secondaryTableResource) {
+ ListIterator<IJavaPrimaryKeyJoinColumn> primaryKeyJoinColumns = specifiedPrimaryKeyJoinColumns();
+ ListIterator<PrimaryKeyJoinColumn> resourcePrimaryKeyJoinColumns = secondaryTableResource.pkJoinColumns();
+
+ while (primaryKeyJoinColumns.hasNext()) {
+ IJavaPrimaryKeyJoinColumn primaryKeyJoinColumn = primaryKeyJoinColumns.next();
+ if (resourcePrimaryKeyJoinColumns.hasNext()) {
+ primaryKeyJoinColumn.update(resourcePrimaryKeyJoinColumns.next());
+ }
+ else {
+ removeSpecifiedPrimaryKeyJoinColumn(primaryKeyJoinColumn);
+ }
+ }
+
+ while (resourcePrimaryKeyJoinColumns.hasNext()) {
+ addSpecifiedPrimaryKeyJoinColumn(specifiedPrimaryKeyJoinColumnsSize(), createPrimaryKeyJoinColumn(resourcePrimaryKeyJoinColumns.next()));
+ }
+ }
+
+ protected IJavaPrimaryKeyJoinColumn createPrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumnResource) {
+ IJavaPrimaryKeyJoinColumn primaryKeyJoinColumn = jpaFactory().createJavaPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner());
+ primaryKeyJoinColumn.initializeFromResource(primaryKeyJoinColumnResource);
+ return primaryKeyJoinColumn;
+ }
+
+ protected void updateDefaultPrimaryKeyJoinColumns(SecondaryTable secondaryTableResource) {
+ this.defaultPrimaryKeyJoinColumn.update(new NullPrimaryKeyJoinColumn(secondaryTableResource));
+ }
+
+ // ********** AbstractJavaTable implementation **********
+//
+// public IPrimaryKeyJoinColumn createPrimaryKeyJoinColumn(int index) {
+// return this.createJavaPrimaryKeyJoinColumn(index);
+// }
+//
+// private JavaPrimaryKeyJoinColumn createJavaPrimaryKeyJoinColumn(int index) {
+// return JavaPrimaryKeyJoinColumn.createSecondaryTableJoinColumn(this.getDeclarationAnnotationAdapter(), buildPkJoinColumnOwner(), this.getMember(), index);
+// }
+//
+// protected IAbstractJoinColumn.Owner buildPkJoinColumnOwner() {
+// return new ISecondaryTable.PrimaryKeyJoinColumnOwner(this);
+// }
+//
+// public boolean containsSpecifiedPrimaryKeyJoinColumns() {
+// return !this.getSpecifiedPrimaryKeyJoinColumns().isEmpty();
+// }
+//
+// @Override
+// protected JavaUniqueConstraint createJavaUniqueConstraint(int index) {
+// return JavaUniqueConstraint.createSecondaryTableUniqueConstraint(new UniqueConstraintOwner(this), this.getDeclarationAnnotationAdapter(), getMember(), index);
+// }
+
+
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ for (IJavaPrimaryKeyJoinColumn column : CollectionTools.iterable(this.primaryKeyJoinColumns())) {
+ result = column.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ public boolean isVirtual() {
+ return false;
+ }
+
+ class PrimaryKeyJoinColumnOwner implements IAbstractJoinColumn.Owner
+ {
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ return JavaSecondaryTable.this.validationTextRange(astRoot);
+ }
+
+ public ITypeMapping typeMapping() {
+ return JavaSecondaryTable.this.javaEntity();
+ }
+
+ public Table dbTable(String tableName) {
+ return JavaSecondaryTable.this.dbTable();
+ }
+
+ public Table dbReferencedColumnTable() {
+ return typeMapping().primaryDbTable();
+ }
+
+ public int joinColumnsSize() {
+ return JavaSecondaryTable.this.primaryKeyJoinColumnsSize();
+ }
+
+ public boolean isVirtual(IAbstractJoinColumn joinColumn) {
+ return JavaSecondaryTable.this.defaultPrimaryKeyJoinColumn == joinColumn;
+ }
+
+ public String defaultColumnName() {
+ if (joinColumnsSize() != 1) {
+ return null;
+ }
+ return javaEntity().parentEntity().primaryKeyColumnName();
+
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaSequenceGenerator.java
new file mode 100644
index 0000000000..5d15639832
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaSequenceGenerator.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.ISequenceGenerator;
+import org.eclipse.jpt.core.internal.resource.java.SequenceGenerator;
+
+
+public class JavaSequenceGenerator extends JavaGenerator<SequenceGenerator>
+ implements IJavaSequenceGenerator
+{
+ protected String specifiedSequenceName;
+
+ public JavaSequenceGenerator(IJavaJpaContextNode parent) {
+ super(parent);
+ }
+
+ @Override
+ public void initializeFromResource(SequenceGenerator sequenceGenerator) {
+ super.initializeFromResource(sequenceGenerator);
+ this.specifiedSequenceName = this.specifiedSequenceName(sequenceGenerator);
+ }
+
+ public Integer getDefaultInitialValue() {
+ return ISequenceGenerator.DEFAULT_INITIAL_VALUE;
+ }
+
+ public String getSequenceName() {
+ return (this.getSpecifiedSequenceName() == null) ? getDefaultSequenceName() : this.getSpecifiedSequenceName();
+ }
+
+ public String getSpecifiedSequenceName() {
+ return this.specifiedSequenceName;
+ }
+
+ public void setSpecifiedSequenceName(String newSpecifiedSequenceName) {
+ String oldSpecifiedSequenceName = newSpecifiedSequenceName;
+ this.specifiedSequenceName = newSpecifiedSequenceName;
+ generatorResource().setSequenceName(newSpecifiedSequenceName);
+ firePropertyChanged(SPECIFIED_SEQUENCE_NAME_PROPERTY, oldSpecifiedSequenceName, newSpecifiedSequenceName);
+ }
+
+ protected void setSpecifiedSequenceName_(String newSpecifiedSequenceName) {
+ String oldSpecifiedSequenceName = newSpecifiedSequenceName;
+ this.specifiedSequenceName = newSpecifiedSequenceName;
+ firePropertyChanged(SPECIFIED_SEQUENCE_NAME_PROPERTY, oldSpecifiedSequenceName, newSpecifiedSequenceName);
+ }
+
+ public String getDefaultSequenceName() {
+ return null;
+ }
+
+ @Override
+ public void update(SequenceGenerator sequenceGenerator) {
+ super.update(sequenceGenerator);
+ this.setSpecifiedSequenceName_(this.specifiedSequenceName(sequenceGenerator));
+ }
+
+ protected String specifiedSequenceName(SequenceGenerator generatorResource) {
+ return generatorResource.getSequenceName();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaSingleRelationshipMapping.java
new file mode 100644
index 0000000000..336939042a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaSingleRelationshipMapping.java
@@ -0,0 +1,350 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.INullable;
+import org.eclipse.jpt.core.internal.context.base.IRelationshipMapping;
+import org.eclipse.jpt.core.internal.context.base.ISingleRelationshipMapping;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumns;
+import org.eclipse.jpt.core.internal.resource.java.NullJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.RelationshipMapping;
+import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+
+public abstract class JavaSingleRelationshipMapping<T extends RelationshipMapping>
+ extends JavaRelationshipMapping<T> implements IJavaSingleRelationshipMapping
+{
+
+ protected final List<IJavaJoinColumn> specifiedJoinColumns;
+
+ protected final IJavaJoinColumn defaultJoinColumn;
+
+ protected Boolean specifiedOptional;
+
+ protected JavaSingleRelationshipMapping(IJavaPersistentAttribute parent) {
+ super(parent);
+ this.specifiedJoinColumns = new ArrayList<IJavaJoinColumn>();
+ this.defaultJoinColumn = jpaFactory().createJavaJoinColumn(this, createJoinColumnOwner());
+ }
+
+ public FetchType getDefaultFetch() {
+ return ISingleRelationshipMapping.DEFAULT_FETCH_TYPE;
+ }
+
+ //***************** ISingleRelationshipMapping implementation *****************
+ public ListIterator<IJavaJoinColumn> joinColumns() {
+ return this.specifiedJoinColumns.isEmpty() ? this.defaultJoinColumns() : this.specifiedJoinColumns();
+ }
+
+ public ListIterator<IJavaJoinColumn> defaultJoinColumns() {
+ return new SingleElementListIterator<IJavaJoinColumn>(this.defaultJoinColumn);
+ }
+
+ public ListIterator<IJavaJoinColumn> specifiedJoinColumns() {
+ return new CloneListIterator<IJavaJoinColumn>(this.specifiedJoinColumns);
+ }
+
+ public int specifiedJoinColumnsSize() {
+ return this.specifiedJoinColumns.size();
+ }
+
+ public boolean containsSpecifiedJoinColumns() {
+ return !this.specifiedJoinColumns.isEmpty();
+ }
+
+ public IJavaJoinColumn addSpecifiedJoinColumn(int index) {
+ IJavaJoinColumn joinColumn = jpaFactory().createJavaJoinColumn(this, createJoinColumnOwner());
+ this.specifiedJoinColumns.add(index, joinColumn);
+ this.persistentAttributeResource.addAnnotation(index, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ this.fireItemAdded(ISingleRelationshipMapping.SPECIFIED_JOIN_COLUMNS_LIST, index, joinColumn);
+ return joinColumn;
+ }
+
+ protected void addSpecifiedJoinColumn(int index, IJavaJoinColumn joinColumn) {
+ addItemToList(index, joinColumn, this.specifiedJoinColumns, ISingleRelationshipMapping.SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public void removeSpecifiedJoinColumn(int index) {
+ IJavaJoinColumn removedJoinColumn = this.specifiedJoinColumns.remove(index);
+ this.persistentAttributeResource.removeAnnotation(index, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ fireItemRemoved(ISingleRelationshipMapping.SPECIFIED_JOIN_COLUMNS_LIST, index, removedJoinColumn);
+ }
+
+ protected void removeSpecifiedJoinColumn(IJavaJoinColumn joinColumn) {
+ removeItemFromList(joinColumn, this.specifiedJoinColumns, ISingleRelationshipMapping.SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedJoinColumns, targetIndex, sourceIndex);
+ this.persistentAttributeResource.move(targetIndex, sourceIndex, JoinColumns.ANNOTATION_NAME);
+ fireItemMoved(ISingleRelationshipMapping.SPECIFIED_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
+ }
+
+ public Boolean getOptional() {
+ return getSpecifiedOptional() == null ? getDefaultOptional() : getSpecifiedOptional();
+ }
+
+ public Boolean getDefaultOptional() {
+ return INullable.DEFAULT_OPTIONAL;
+ }
+
+ public Boolean getSpecifiedOptional() {
+ return this.specifiedOptional;
+ }
+
+ public void setSpecifiedOptional(Boolean newSpecifiedOptional) {
+ Boolean oldSpecifiedOptional = this.specifiedOptional;
+ this.specifiedOptional = newSpecifiedOptional;
+ setOptionalOnResourceModel(newSpecifiedOptional);
+ firePropertyChanged(INullable.SPECIFIED_OPTIONAL_PROPERTY, oldSpecifiedOptional, newSpecifiedOptional);
+ }
+
+ protected abstract void setOptionalOnResourceModel(Boolean newOptional);
+
+
+ @Override
+ public void initializeFromResource(JavaPersistentAttributeResource persistentAttributeResource) {
+ super.initializeFromResource(persistentAttributeResource);
+ this.initializeSpecifiedJoinColumns(persistentAttributeResource);
+ this.defaultJoinColumn.initializeFromResource(new NullJoinColumn(persistentAttributeResource));
+ }
+
+ @Override
+ protected void initialize(T relationshipMapping) {
+ super.initialize(relationshipMapping);
+ this.specifiedOptional = this.specifiedOptional(relationshipMapping);
+ }
+
+ protected void initializeSpecifiedJoinColumns(JavaPersistentAttributeResource persistentAttributeResource) {
+ ListIterator<JavaResource> annotations = persistentAttributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+
+ while(annotations.hasNext()) {
+ this.specifiedJoinColumns.add(createJoinColumn((JoinColumn) annotations.next()));
+ }
+ }
+
+ @Override
+ public void update(JavaPersistentAttributeResource persistentAttributeResource) {
+ super.update(persistentAttributeResource);
+ this.updateSpecifiedJoinColumns(persistentAttributeResource);
+ this.defaultJoinColumn.update(new NullJoinColumn(persistentAttributeResource));
+ }
+
+ @Override
+ protected void update(T relationshipMapping) {
+ super.update(relationshipMapping);
+ this.setSpecifiedOptional(this.specifiedOptional(relationshipMapping));
+ }
+
+ protected abstract Boolean specifiedOptional(T relationshipMapping);
+
+
+ protected void updateSpecifiedJoinColumns(JavaPersistentAttributeResource persistentAttributeResource) {
+ ListIterator<IJavaJoinColumn> joinColumns = specifiedJoinColumns();
+ ListIterator<JavaResource> resourceJoinColumns = persistentAttributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+
+ while (joinColumns.hasNext()) {
+ IJavaJoinColumn primaryKeyJoinColumn = joinColumns.next();
+ if (resourceJoinColumns.hasNext()) {
+ primaryKeyJoinColumn.update((JoinColumn) resourceJoinColumns.next());
+ }
+ else {
+ removeSpecifiedJoinColumn(primaryKeyJoinColumn);
+ }
+ }
+
+ while (resourceJoinColumns.hasNext()) {
+ addSpecifiedJoinColumn(specifiedJoinColumnsSize(), createJoinColumn((JoinColumn) resourceJoinColumns.next()));
+ }
+ }
+
+ protected IJavaJoinColumn createJoinColumn(JoinColumn joinColumnResource) {
+ IJavaJoinColumn joinColumn = jpaFactory().createJavaJoinColumn(this, createJoinColumnOwner());
+ joinColumn.initializeFromResource(joinColumnResource);
+ return joinColumn;
+ }
+
+ protected IJoinColumn.Owner createJoinColumnOwner() {
+ return new JoinColumnOwner();
+ }
+
+ /**
+ * eliminate any "container" types
+ */
+ @Override
+ protected String defaultTargetEntity(JavaPersistentAttributeResource persistentAttributeResource) {
+ if (persistentAttributeResource.typeIsContainer()) {
+ return null;
+ }
+ return persistentAttributeResource.getQualifiedReferenceEntityTypeName();
+ }
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ for (IJavaJoinColumn column : CollectionTools.iterable(this.joinColumns())) {
+ result = column.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ //************* Validation **********************************
+
+ @Override
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+
+ //bug 192287 - do not want joinColumn validation errors on the non-owning side
+ //of a bidirectional relationship. This is a low risk fix for RC3, but a better
+ //solution would be to not have the default joinColumns on the non-owning side.
+ //This would fix another bug that we show default joinColumns in this situation.
+ if (entityOwned() && isOwningSide()) {
+ addJoinColumnMessages(messages, astRoot);
+ }
+ }
+
+ protected abstract boolean isOwningSide();
+
+ protected void addJoinColumnMessages(List<IMessage> messages, CompilationUnit astRoot) {
+
+ for (Iterator<IJavaJoinColumn> stream = this.joinColumns(); stream.hasNext();) {
+ IJavaJoinColumn joinColumn = stream.next();
+ String table = joinColumn.getTable();
+ boolean doContinue = joinColumn.isConnected();
+
+ if (doContinue && this.typeMapping().tableNameIsInvalid(table)) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.JOIN_COLUMN_UNRESOLVED_TABLE,
+ new String[] {table, joinColumn.getName()},
+ joinColumn, joinColumn.tableTextRange(astRoot))
+ );
+ doContinue = false;
+ }
+
+ if (doContinue && ! joinColumn.isResolved()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
+ new String[] {joinColumn.getName()},
+ joinColumn, joinColumn.nameTextRange(astRoot))
+ );
+ }
+
+ if (doContinue && ! joinColumn.isReferencedColumnResolved()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
+ new String[] {joinColumn.getReferencedColumnName(), joinColumn.getName()},
+ joinColumn, joinColumn.referencedColumnNameTextRange(astRoot))
+ );
+ }
+ }
+ }
+
+
+ public class JoinColumnOwner implements IJoinColumn.Owner
+ {
+
+ public JoinColumnOwner() {
+ super();
+ }
+
+ /**
+ * by default, the join column is in the type mapping's primary table
+ */
+ public String defaultTableName() {
+ return JavaSingleRelationshipMapping.this.typeMapping().getTableName();
+ }
+
+ public IEntity targetEntity() {
+ return JavaSingleRelationshipMapping.this.getResolvedTargetEntity();
+ }
+
+ public String attributeName() {
+ return JavaSingleRelationshipMapping.this.persistentAttribute().getName();
+ }
+
+ public IRelationshipMapping relationshipMapping() {
+ return JavaSingleRelationshipMapping.this;
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return JavaSingleRelationshipMapping.this.typeMapping().tableNameIsInvalid(tableName);
+ }
+
+ /**
+ * the join column can be on a secondary table
+ */
+ public boolean tableIsAllowed() {
+ return true;
+ }
+
+ public ITypeMapping typeMapping() {
+ return JavaSingleRelationshipMapping.this.typeMapping();
+ }
+
+ public Table dbTable(String tableName) {
+ return typeMapping().dbTable(tableName);
+ }
+
+ public Table dbReferencedColumnTable() {
+ IEntity targetEntity = targetEntity();
+ return (targetEntity == null) ? null : targetEntity().primaryDbTable();
+ }
+
+ public boolean isVirtual(IAbstractJoinColumn joinColumn) {
+ return JavaSingleRelationshipMapping.this.defaultJoinColumn == joinColumn;
+ }
+
+ public String defaultColumnName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return JavaSingleRelationshipMapping.this.validationTextRange(astRoot);
+ }
+
+
+
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTable.java
new file mode 100644
index 0000000000..1ca902e875
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTable.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.InheritanceType;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentResource;
+import org.eclipse.jpt.core.internal.resource.java.Table;
+
+
+public class JavaTable extends AbstractJavaTable implements IJavaTable
+{
+ protected JavaPersistentResource persistentResource;
+
+ public JavaTable(IJavaEntity parent) {
+ super(parent);
+ }
+
+ public void initializeFromResource(JavaPersistentResource persistentResource) {
+ this.persistentResource = persistentResource;
+ initializeFromResource(tableResource());
+ }
+
+
+ //query for the table resource every time on setters.
+ //call one setter and the tableResource could change.
+ //You could call more than one setter before this object has received any notification
+ //from the java resource model
+ @Override
+ protected Table tableResource() {
+ //TODO get the NullTable from the resource model or build it here in the context model??
+ return (Table) this.persistentResource.nonNullAnnotation(annotationName());
+ }
+
+ @Override
+ protected String annotationName() {
+ return Table.ANNOTATION_NAME;
+ }
+
+ @Override
+ public IJavaEntity parent() {
+ return (IJavaEntity) super.parent();
+ }
+
+ protected IJavaEntity javaEntity() {
+ return parent();
+ }
+
+ protected IEntity rootEntity() {
+ return javaEntity().rootEntity();
+ }
+
+ @Override
+ /**
+ * Table name default to the owning java entity name.
+ * If this entity is part of a single table inheritance hierarchy, table
+ * name defaults to the root entity's table name.
+ */
+ protected String defaultName() {
+ if (javaEntity().getInheritanceStrategy() == InheritanceType.SINGLE_TABLE) {
+ if (rootEntity() != javaEntity()) {
+ return rootEntity().getTable().getName();
+ }
+ }
+ return javaEntity().getName();
+ }
+
+ @Override
+ protected String defaultSchema() {
+ if (javaEntity().getInheritanceStrategy() == InheritanceType.SINGLE_TABLE) {
+ if (rootEntity() != javaEntity()) {
+ return rootEntity().getTable().getSchema();
+ }
+ }
+ return super.defaultSchema();
+ }
+
+ @Override
+ protected String defaultCatalog() {
+ if (javaEntity().getInheritanceStrategy() == InheritanceType.SINGLE_TABLE) {
+ if (rootEntity() != javaEntity()) {
+ return rootEntity().getTable().getCatalog();
+ }
+ }
+ return super.defaultCatalog();
+ }
+
+// @Override
+// protected JavaUniqueConstraint createJavaUniqueConstraint(int index) {
+// return JavaUniqueConstraint.createTableUniqueConstraint(new UniqueConstraintOwner(this), this.getMember(), index);
+// }
+
+
+ public void update(JavaPersistentResource persistentResource) {
+ this.persistentResource = persistentResource;
+ this.update(tableResource());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTableGenerator.java
new file mode 100644
index 0000000000..db6c88c64a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTableGenerator.java
@@ -0,0 +1,335 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.context.base.ITableGenerator;
+import org.eclipse.jpt.core.internal.resource.java.TableGenerator;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.db.internal.Table;
+
+
+public class JavaTableGenerator extends JavaGenerator<TableGenerator>
+ implements IJavaTableGenerator
+{
+
+ protected String specifiedTable;
+
+ protected String defaultTable;
+
+ protected String specifiedCatalog;
+
+ protected String defaultCatalog;
+
+ protected String specifiedSchema;
+
+ protected String defaultSchema;
+
+ protected String specifiedPkColumnName;
+
+ protected String defaultPkColumnName;
+
+ protected String specifiedValueColumnName;
+
+ protected String defaultValueColumnName;
+
+ protected String specifiedPkColumnValue;
+
+ protected String defaultPkColumnValue;
+
+// protected EList<IUniqueConstraint> uniqueConstraints;
+
+ public JavaTableGenerator(IJavaJpaContextNode parent) {
+ super(parent);
+ }
+
+ @Override
+ public void initializeFromResource(TableGenerator tableGenerator) {
+ super.initializeFromResource(tableGenerator);
+ this.specifiedTable = this.specifiedTable(tableGenerator);
+ this.specifiedCatalog = this.specifiedCatalog(tableGenerator);
+ this.specifiedSchema = this.specifiedSchema(tableGenerator);
+ this.specifiedPkColumnName = this.specifiedPkColumnName(tableGenerator);
+ this.specifiedValueColumnName = this.specifiedValueColumnName(tableGenerator);
+ this.specifiedPkColumnValue = this.specifiedPkColumnValue(tableGenerator);
+ //this.updateUniqueConstraintsFromJava(astRoot);
+ }
+
+ public Integer getDefaultInitialValue() {
+ return ITableGenerator.DEFAULT_INITIAL_VALUE;
+ }
+
+ public String getTable() {
+ return (this.getSpecifiedTable() == null) ? getDefaultTable() : this.getSpecifiedTable();
+ }
+
+ public String getSpecifiedTable() {
+ return this.specifiedTable;
+ }
+
+ public void setSpecifiedTable(String newSpecifiedTable) {
+ String oldSpecifiedTable = this.specifiedTable;
+ this.specifiedTable = newSpecifiedTable;
+ generatorResource().setTable(newSpecifiedTable);
+ firePropertyChanged(SPECIFIED_TABLE_PROPERTY, oldSpecifiedTable, newSpecifiedTable);
+ }
+
+ protected void setSpecifiedTable_(String newSpecifiedTable) {
+ String oldSpecifiedTable = this.specifiedTable;
+ this.specifiedTable = newSpecifiedTable;
+ firePropertyChanged(SPECIFIED_TABLE_PROPERTY, oldSpecifiedTable, newSpecifiedTable);
+ }
+
+ public String getDefaultTable() {
+ return this.defaultTable;
+ }
+
+ public String getCatalog() {
+ return (this.getSpecifiedCatalog() == null) ? getDefaultCatalog() : this.getSpecifiedCatalog();
+ }
+
+ public String getSpecifiedCatalog() {
+ return this.specifiedCatalog;
+ }
+
+ public void setSpecifiedCatalog(String newSpecifiedCatalog) {
+ String oldSpecifiedCatalog = this.specifiedCatalog;
+ this.specifiedCatalog = newSpecifiedCatalog;
+ generatorResource().setCatalog(newSpecifiedCatalog);
+ firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, oldSpecifiedCatalog, newSpecifiedCatalog);
+ }
+
+ protected void setSpecifiedCatalog_(String newSpecifiedCatalog) {
+ String oldSpecifiedCatalog = this.specifiedCatalog;
+ this.specifiedCatalog = newSpecifiedCatalog;
+ firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, oldSpecifiedCatalog, newSpecifiedCatalog);
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ public String getSchema() {
+ return (this.getSpecifiedSchema() == null) ? getDefaultSchema() : this.getSpecifiedSchema();
+ }
+
+ public String getSpecifiedSchema() {
+ return this.specifiedSchema;
+ }
+
+ public void setSpecifiedSchema(String newSpecifiedSchema) {
+ String oldSpecifiedSchema = this.specifiedSchema;
+ this.specifiedSchema = newSpecifiedSchema;
+ generatorResource().setSchema(newSpecifiedSchema);
+ firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, oldSpecifiedSchema, newSpecifiedSchema);
+ }
+
+ protected void setSpecifiedSchema_(String newSpecifiedSchema) {
+ String oldSpecifiedSchema = this.specifiedSchema;
+ this.specifiedSchema = newSpecifiedSchema;
+ firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, oldSpecifiedSchema, newSpecifiedSchema);
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+ protected void setDefaultSchema(String newDefaultSchema) {
+ String oldDefaultSchema = this.defaultSchema;
+ this.defaultSchema = newDefaultSchema;
+ firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, oldDefaultSchema, newDefaultSchema);
+ }
+
+ public String getPkColumnName() {
+ return (this.getSpecifiedPkColumnName() == null) ? getDefaultPkColumnName() : this.getSpecifiedPkColumnName();
+ }
+
+ public String getSpecifiedPkColumnName() {
+ return this.specifiedPkColumnName;
+ }
+
+ public void setSpecifiedPkColumnName(String newSpecifiedPkColumnName) {
+ String oldSpecifiedPkColumnName = this.specifiedPkColumnName;
+ this.specifiedPkColumnName = newSpecifiedPkColumnName;
+ generatorResource().setPkColumnName(newSpecifiedPkColumnName);
+ firePropertyChanged(SPECIFIED_PK_COLUMN_NAME_PROPERTY, oldSpecifiedPkColumnName, newSpecifiedPkColumnName);
+ }
+
+ protected void setSpecifiedPkColumnName_(String newSpecifiedPkColumnName) {
+ String oldSpecifiedPkColumnName = this.specifiedPkColumnName;
+ this.specifiedPkColumnName = newSpecifiedPkColumnName;
+ firePropertyChanged(SPECIFIED_PK_COLUMN_NAME_PROPERTY, oldSpecifiedPkColumnName, newSpecifiedPkColumnName);
+ }
+
+ public String getDefaultPkColumnName() {
+ return this.defaultPkColumnName;
+ }
+
+ public String getValueColumnName() {
+ return (this.getSpecifiedValueColumnName() == null) ? getDefaultValueColumnName() : this.getSpecifiedValueColumnName();
+ }
+
+ public String getSpecifiedValueColumnName() {
+ return this.specifiedValueColumnName;
+ }
+
+ public void setSpecifiedValueColumnName(String newSpecifiedValueColumnName) {
+ String oldSpecifiedValueColumnName = this.specifiedValueColumnName;
+ this.specifiedValueColumnName = newSpecifiedValueColumnName;
+ generatorResource().setValueColumnName(newSpecifiedValueColumnName);
+ firePropertyChanged(SPECIFIED_VALUE_COLUMN_NAME_PROPERTY, oldSpecifiedValueColumnName, newSpecifiedValueColumnName);
+ }
+
+ protected void setSpecifiedValueColumnName_(String newSpecifiedValueColumnName) {
+ String oldSpecifiedValueColumnName = this.specifiedValueColumnName;
+ this.specifiedValueColumnName = newSpecifiedValueColumnName;
+ firePropertyChanged(SPECIFIED_VALUE_COLUMN_NAME_PROPERTY, oldSpecifiedValueColumnName, newSpecifiedValueColumnName);
+ }
+
+ public String getDefaultValueColumnName() {
+ return this.defaultValueColumnName;
+ }
+
+ public String getPkColumnValue() {
+ return (this.getSpecifiedPkColumnValue() == null) ? getDefaultPkColumnValue() : this.getSpecifiedPkColumnValue();
+ }
+
+ public String getSpecifiedPkColumnValue() {
+ return this.specifiedPkColumnValue;
+ }
+
+ public void setSpecifiedPkColumnValue(String newSpecifiedPkColumnValue) {
+ String oldSpecifiedPkColumnValue = this.specifiedPkColumnValue;
+ this.specifiedPkColumnValue = newSpecifiedPkColumnValue;
+ generatorResource().setPkColumnValue(newSpecifiedPkColumnValue);
+ firePropertyChanged(SPECIFIED_PK_COLUMN_VALUE_PROPERTY, oldSpecifiedPkColumnValue, newSpecifiedPkColumnValue);
+ }
+
+ public void setSpecifiedPkColumnValue_(String newSpecifiedPkColumnValue) {
+ String oldSpecifiedPkColumnValue = this.specifiedPkColumnValue;
+ this.specifiedPkColumnValue = newSpecifiedPkColumnValue;
+ firePropertyChanged(SPECIFIED_PK_COLUMN_VALUE_PROPERTY, oldSpecifiedPkColumnValue, newSpecifiedPkColumnValue);
+ }
+
+ public String getDefaultPkColumnValue() {
+ return this.defaultPkColumnValue;
+ }
+
+
+// public EList<IUniqueConstraint> getUniqueConstraints() {
+// if (uniqueConstraints == null) {
+// uniqueConstraints = new EObjectContainmentEList<IUniqueConstraint>(IUniqueConstraint.class, this, JpaJavaMappingsPackage.JAVA_TABLE_GENERATOR__UNIQUE_CONSTRAINTS);
+// }
+// return uniqueConstraints;
+// }
+
+
+
+ // ********** java resource model -> context model model **********
+ @Override
+ public void update(TableGenerator tableGenerator) {
+ super.update(tableGenerator);
+ this.setSpecifiedTable_(this.specifiedTable(tableGenerator));
+ this.setSpecifiedCatalog_(this.specifiedCatalog(tableGenerator));
+ this.setSpecifiedSchema_(this.specifiedSchema(tableGenerator));
+ this.setSpecifiedPkColumnName_(this.specifiedPkColumnName(tableGenerator));
+ this.setSpecifiedValueColumnName_(this.specifiedValueColumnName(tableGenerator));
+ this.setSpecifiedPkColumnValue_(this.specifiedPkColumnValue(tableGenerator));
+ //this.updateUniqueConstraintsFromJava(astRoot);
+ }
+
+ protected String specifiedTable(TableGenerator tableGenerator) {
+ return tableGenerator.getTable();
+ }
+
+ protected String specifiedCatalog(TableGenerator tableGenerator) {
+ return tableGenerator.getCatalog();
+ }
+
+ protected String specifiedSchema(TableGenerator tableGenerator) {
+ return tableGenerator.getSchema();
+ }
+
+ protected String specifiedPkColumnName(TableGenerator tableGenerator) {
+ return tableGenerator.getPkColumnName();
+ }
+
+ protected String specifiedValueColumnName(TableGenerator tableGenerator) {
+ return tableGenerator.getValueColumnName();
+ }
+
+ protected String specifiedPkColumnValue(TableGenerator tableGenerator) {
+ return tableGenerator.getPkColumnValue();
+ }
+
+
+// /**
+// * here we just worry about getting the unique constraints lists the same size;
+// * then we delegate to the unique constraints to synch themselves up
+// */
+// private void updateUniqueConstraintsFromJava(CompilationUnit astRoot) {
+// // synchronize the model join columns with the Java source
+// List<IUniqueConstraint> constraints = this.getUniqueConstraints();
+// int persSize = constraints.size();
+// int javaSize = 0;
+// boolean allJavaAnnotationsFound = false;
+// for (int i = 0; i < persSize; i++) {
+// JavaUniqueConstraint uniqueConstraint = (JavaUniqueConstraint) constraints.get(i);
+// if (uniqueConstraint.annotation(astRoot) == null) {
+// allJavaAnnotationsFound = true;
+// break; // no need to go any further
+// }
+// uniqueConstraint.updateFromJava(astRoot);
+// javaSize++;
+// }
+// if (allJavaAnnotationsFound) {
+// // remove any model join columns beyond those that correspond to the Java annotations
+// while (persSize > javaSize) {
+// persSize--;
+// constraints.remove(persSize);
+// }
+// }
+// else {
+// // add new model join columns until they match the Java annotations
+// while (!allJavaAnnotationsFound) {
+// JavaUniqueConstraint uniqueConstraint = this.createJavaUniqueConstraint(javaSize);
+// if (uniqueConstraint.annotation(astRoot) == null) {
+// allJavaAnnotationsFound = true;
+// }
+// else {
+// this.getUniqueConstraints().add(uniqueConstraint);
+// uniqueConstraint.updateFromJava(astRoot);
+// javaSize++;
+// }
+// }
+// }
+// }
+//
+// public void refreshDefaults(DefaultsContext defaultsContext) {
+// setDefaultSchema((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_TABLE_GENERATOR_SCHEMA_KEY));
+// }
+//
+// public IUniqueConstraint createUniqueConstraint(int index) {
+// return createJavaUniqueConstraint(index);
+// }
+//
+// protected JavaUniqueConstraint createJavaUniqueConstraint(int index) {
+// return JavaUniqueConstraint.createTableGeneratorUniqueConstraint(new UniqueConstraintOwner(this), this.getMember(), index);
+// }
+
+ public Table dbTable() {
+ Schema schema = this.dbSchema();
+ return (schema == null) ? null : schema.tableNamed(this.getTable());
+ }
+
+ public Schema dbSchema() {
+ return this.database().schemaNamed(this.getSchema());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTransientMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTransientMapping.java
new file mode 100644
index 0000000000..e1e5db6c97
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTransientMapping.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.resource.java.Transient;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+
+public class JavaTransientMapping extends JavaAttributeMapping
+ implements IJavaTransientMapping
+{
+ public JavaTransientMapping(IJavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ public String getKey() {
+ return IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return Transient.ANNOTATION_NAME;
+ }
+
+ public Iterator<String> correspondingAnnotationNames() {
+ return EmptyIterator.instance();
+ }
+
+ @Override
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+ }
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTransientMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTransientMappingProvider.java
new file mode 100644
index 0000000000..bd61eada69
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTransientMappingProvider.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.java.Transient;
+
+public class JavaTransientMappingProvider
+ implements IJavaAttributeMappingProvider
+{
+
+ // singleton
+ private static final JavaTransientMappingProvider INSTANCE = new JavaTransientMappingProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static IJavaAttributeMappingProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private JavaTransientMappingProvider() {
+ super();
+ }
+
+ public String key() {
+ return IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return Transient.ANNOTATION_NAME;
+ }
+
+ public IJavaAttributeMapping buildMapping(IJavaPersistentAttribute parent, IJpaBaseContextFactory factory) {
+ return factory.createJavaTransientMapping(parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTypeMapping.java
new file mode 100644
index 0000000000..5c8fa2f876
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTypeMapping.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.ITable;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+
+
+//TODO need a way to morph between mapping types to save any information that is
+//comming to the different TypeMappings. For java, we do not know the other types
+//of mappings since they are defined in an extension point so we can do this the same
+//way as xml.
+public abstract class JavaTypeMapping extends JavaContextModel
+ implements IJavaTypeMapping
+{
+ protected JavaPersistentTypeResource persistentTypeResource;
+
+
+ protected JavaTypeMapping(IJavaPersistentType parent) {
+ super(parent);
+ }
+
+ public void initializeFromResource(JavaPersistentTypeResource persistentTypeResource) {
+ this.persistentTypeResource = persistentTypeResource;
+ }
+
+ public String getTableName() {
+ return null;
+ }
+
+ public IJavaPersistentType persistentType() {
+ return (IJavaPersistentType) parent();
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ ITextRange textRange = this.persistentTypeResource.textRange(astRoot);
+ return (textRange != null) ? textRange : this.persistentType().validationTextRange(astRoot);
+ }
+
+ public Table primaryDbTable() {
+ return null;
+ }
+
+ public Table dbTable(String tableName) {
+ return null;
+ }
+
+ public Schema dbSchema() {
+ return null;
+ }
+
+ public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
+ return true;
+ }
+
+ public Iterator<ITable> associatedTables() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<String> associatedTableNamesIncludingInherited() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<ITable> associatedTablesIncludingInherited() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<String> overridableAssociationNames() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<String> overridableAttributeNames() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<String> allOverridableAttributeNames() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<String> allOverridableAssociationNames() {
+ return EmptyIterator.instance();
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+
+ public void update(JavaPersistentTypeResource persistentTypeResource) {
+ this.persistentTypeResource = persistentTypeResource;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaVersionMapping.java
new file mode 100644
index 0000000000..0505f203d9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaVersionMapping.java
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.java;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IColumn;
+import org.eclipse.jpt.core.internal.context.base.IColumnMapping;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.context.base.TemporalType;
+import org.eclipse.jpt.core.internal.resource.java.Column;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.Temporal;
+import org.eclipse.jpt.core.internal.resource.java.Version;
+import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+
+public class JavaVersionMapping extends JavaAttributeMapping implements IJavaVersionMapping
+{
+ protected final IJavaColumn column;
+
+ protected TemporalType temporal;
+
+ public JavaVersionMapping(IJavaPersistentAttribute parent) {
+ super(parent);
+ this.column = createJavaColumn();
+ }
+
+ protected IJavaColumn createJavaColumn() {
+ return jpaFactory().createJavaColumn(this, this);
+ }
+
+ @Override
+ public void initializeFromResource(JavaPersistentAttributeResource persistentAttributeResource) {
+ super.initializeFromResource(persistentAttributeResource);
+ this.column.initializeFromResource(this.columnResource());
+ this.temporal = this.temporal(this.temporalResource());
+ }
+
+ protected Temporal temporalResource() {
+ return (Temporal) this.persistentAttributeResource.nonNullAnnotation(Temporal.ANNOTATION_NAME);
+ }
+
+ public Column columnResource() {
+ return (Column) this.persistentAttributeResource.nonNullAnnotation(Column.ANNOTATION_NAME);
+ }
+
+ //************** IJavaAttributeMapping implementation ***************
+
+ public String getKey() {
+ return IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return Version.ANNOTATION_NAME;
+ }
+
+ public Iterator<String> correspondingAnnotationNames() {
+ return new ArrayIterator<String>(
+ JPA.COLUMN,
+ JPA.TEMPORAL);
+ }
+
+ //************** INamedColumn.Owner implementation ***************
+
+ public String defaultColumnName() {
+ return attributeName();
+ }
+
+ public String defaultTableName() {
+ return typeMapping().getTableName();
+ }
+
+ //************** IVersionMapping implementation ***************
+
+ public IJavaColumn getColumn() {
+ return this.column;
+ }
+
+ public TemporalType getTemporal() {
+ return this.temporal;
+ }
+
+ public void setTemporal(TemporalType newTemporal) {
+ TemporalType oldTemporal = this.temporal;
+ this.temporal = newTemporal;
+ this.temporalResource().setValue(TemporalType.toJavaResourceModel(newTemporal));
+ firePropertyChanged(IColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+ }
+
+ @Override
+ public void update(JavaPersistentAttributeResource persistentAttributeResource) {
+ super.update(persistentAttributeResource);
+ this.column.update(this.columnResource());
+ this.setTemporal(this.temporal(this.temporalResource()));
+ }
+
+ protected TemporalType temporal(Temporal temporal) {
+ return TemporalType.fromJavaResourceModel(temporal.getValue());
+ }
+
+ @Override
+ public Iterator<String> candidateValuesFor(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.getColumn().candidateValuesFor(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
+
+ //*********** Validation ******************************
+
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+
+ addColumnMessages(messages, astRoot);
+ }
+
+ protected void addColumnMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ ITypeMapping typeMapping = this.typeMapping();
+ IJavaColumn column = this.getColumn();
+ String table = column.getTable();
+ boolean doContinue = entityOwned() && column.isConnected();
+
+ if (doContinue && this.typeMapping().tableNameIsInvalid(table)) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
+ new String[] {table, column.getName()},
+ column, column.tableTextRange(astRoot))
+ );
+ doContinue = false;
+ }
+
+ if (doContinue && ! column.isResolved()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.COLUMN_UNRESOLVED_NAME,
+ new String[] {column.getName()},
+ column, column.nameTextRange(astRoot))
+ );
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaVersionMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaVersionMappingProvider.java
new file mode 100644
index 0000000000..88f20d2cf0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaVersionMappingProvider.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.java;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.java.Version;
+
+public class JavaVersionMappingProvider
+ implements IJavaAttributeMappingProvider
+{
+
+ // singleton
+ private static final JavaVersionMappingProvider INSTANCE = new JavaVersionMappingProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static IJavaAttributeMappingProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private JavaVersionMappingProvider() {
+ super();
+ }
+
+ public String key() {
+ return IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public String annotationName() {
+ return Version.ANNOTATION_NAME;
+ }
+
+ public IJavaAttributeMapping buildMapping(IJavaPersistentAttribute parent, IJpaBaseContextFactory factory) {
+ return factory.createJavaVersionMapping(parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractXmlColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractXmlColumn.java
new file mode 100644
index 0000000000..9de4bfa291
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractXmlColumn.java
@@ -0,0 +1,301 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAbstractColumn;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.AbstractColumn;
+
+
+public abstract class AbstractXmlColumn<T extends AbstractColumn> extends AbstractXmlNamedColumn<T>
+ implements IAbstractColumn
+{
+ protected String specifiedTable;
+
+ protected String defaultTable;
+
+ protected Boolean specifiedUnique;
+
+ protected Boolean specifiedNullable;
+
+ protected Boolean specifiedInsertable;
+
+ protected Boolean specifiedUpdatable;
+
+ protected AbstractXmlColumn(IJpaContextNode parent, IAbstractColumn.Owner owner) {
+ super(parent, owner);
+ }
+
+ @Override
+ public IAbstractColumn.Owner owner() {
+ return (IAbstractColumn.Owner) super.owner();
+ }
+
+// @Override
+// protected void addInsignificantXmlFeatureIdsTo(Set<Integer> insignificantXmlFeatureIds) {
+// super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
+// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IABSTRACT_COLUMN__DEFAULT_TABLE);
+// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IABSTRACT_COLUMN__TABLE);
+// }
+
+ public String getTable() {
+ return (this.getSpecifiedTable() == null) ? getDefaultTable() : this.getSpecifiedTable();
+ }
+
+ public String getSpecifiedTable() {
+ return this.specifiedTable;
+ }
+
+ public void setSpecifiedTable(String newSpecifiedTable) {
+ String oldSpecifiedTable = this.specifiedTable;
+ this.specifiedTable = newSpecifiedTable;
+ if (oldSpecifiedTable != newSpecifiedTable) {
+ if (this.columnResource() != null) {
+ this.columnResource().setTable(newSpecifiedTable);
+ if (this.columnResource().isAllFeaturesUnset()) {
+ removeColumnResource();
+ }
+ }
+ else if (newSpecifiedTable != null) {
+ addColumnResource();
+ columnResource().setTable(newSpecifiedTable);
+ }
+ }
+ firePropertyChanged(IAbstractColumn.SPECIFIED_TABLE_PROPERTY, oldSpecifiedTable, newSpecifiedTable);
+ }
+
+ protected void setSpecifiedTable_(String newSpecifiedTable) {
+ String oldSpecifiedTable = this.specifiedTable;
+ this.specifiedTable = newSpecifiedTable;
+ firePropertyChanged(IAbstractColumn.SPECIFIED_TABLE_PROPERTY, oldSpecifiedTable, newSpecifiedTable);
+ }
+
+ public String getDefaultTable() {
+ return this.defaultTable;
+ }
+
+ protected void setDefaultTable(String newDefaultTable) {
+ String oldDefaultTable = this.defaultTable;
+ this.defaultTable = newDefaultTable;
+ firePropertyChanged(IAbstractColumn.DEFAULT_TABLE_PROPERTY, oldDefaultTable, newDefaultTable);
+ }
+
+ public Boolean getUnique() {
+ return (this.getSpecifiedUnique() == null) ? this.getDefaultUnique() : this.getSpecifiedUnique();
+ }
+
+ public Boolean getDefaultUnique() {
+ return IAbstractColumn.DEFAULT_UNIQUE;
+ }
+
+ public Boolean getSpecifiedUnique() {
+ return this.specifiedUnique;
+ }
+
+ public void setSpecifiedUnique(Boolean newSpecifiedUnique) {
+ Boolean oldSpecifiedUnique = this.specifiedUnique;
+ this.specifiedUnique = newSpecifiedUnique;
+ if (oldSpecifiedUnique != newSpecifiedUnique) {
+ if (this.columnResource() != null) {
+ this.columnResource().setUnique(newSpecifiedUnique);
+ if (this.columnResource().isAllFeaturesUnset()) {
+ removeColumnResource();
+ }
+ }
+ else if (newSpecifiedUnique != null) {
+ addColumnResource();
+ columnResource().setUnique(newSpecifiedUnique);
+ }
+ }
+ firePropertyChanged(IAbstractColumn.SPECIFIED_UNIQUE_PROPERTY, oldSpecifiedUnique, newSpecifiedUnique);
+ }
+
+ protected void setSpecifiedUnique_(Boolean newSpecifiedUnique) {
+ Boolean oldSpecifiedUnique = this.specifiedUnique;
+ this.specifiedUnique = newSpecifiedUnique;
+ firePropertyChanged(IAbstractColumn.SPECIFIED_UNIQUE_PROPERTY, oldSpecifiedUnique, newSpecifiedUnique);
+ }
+
+ public Boolean getNullable() {
+ return (this.getSpecifiedNullable() == null) ? this.getDefaultNullable() : this.getSpecifiedNullable();
+ }
+
+ public Boolean getDefaultNullable() {
+ return IAbstractColumn.DEFAULT_NULLABLE;
+ }
+
+ public Boolean getSpecifiedNullable() {
+ return this.specifiedNullable;
+ }
+
+ public void setSpecifiedNullable(Boolean newSpecifiedNullable) {
+ Boolean oldSpecifiedNullable = this.specifiedNullable;
+ this.specifiedNullable = newSpecifiedNullable;
+ if (oldSpecifiedNullable != newSpecifiedNullable) {
+ if (this.columnResource() != null) {
+ this.columnResource().setNullable(newSpecifiedNullable);
+ if (this.columnResource().isAllFeaturesUnset()) {
+ removeColumnResource();
+ }
+ }
+ else if (newSpecifiedNullable != null) {
+ addColumnResource();
+ columnResource().setNullable(newSpecifiedNullable);
+ }
+ }
+ firePropertyChanged(IAbstractColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable);
+ }
+
+ protected void setSpecifiedNullable_(Boolean newSpecifiedNullable) {
+ Boolean oldSpecifiedNullable = this.specifiedNullable;
+ this.specifiedNullable = newSpecifiedNullable;
+ firePropertyChanged(IAbstractColumn.SPECIFIED_NULLABLE_PROPERTY, oldSpecifiedNullable, newSpecifiedNullable);
+ }
+
+ public Boolean getInsertable() {
+ return (this.getSpecifiedInsertable() == null) ? this.getDefaultInsertable() : this.getSpecifiedInsertable();
+ }
+
+ public Boolean getDefaultInsertable() {
+ return IAbstractColumn.DEFAULT_INSERTABLE;
+ }
+
+ public Boolean getSpecifiedInsertable() {
+ return this.specifiedInsertable;
+ }
+
+ public void setSpecifiedInsertable(Boolean newSpecifiedInsertable) {
+ Boolean oldSpecifiedInsertable = this.specifiedInsertable;
+ this.specifiedInsertable = newSpecifiedInsertable;
+ if (oldSpecifiedInsertable != newSpecifiedInsertable) {
+ if (this.columnResource() != null) {
+ this.columnResource().setInsertable(newSpecifiedInsertable);
+ if (this.columnResource().isAllFeaturesUnset()) {
+ removeColumnResource();
+ }
+ }
+ else if (newSpecifiedInsertable != null) {
+ addColumnResource();
+ columnResource().setInsertable(newSpecifiedInsertable);
+ }
+ }
+ firePropertyChanged(IAbstractColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable);
+ }
+
+ protected void setSpecifiedInsertable_(Boolean newSpecifiedInsertable) {
+ Boolean oldSpecifiedInsertable = this.specifiedInsertable;
+ this.specifiedInsertable = newSpecifiedInsertable;
+ firePropertyChanged(IAbstractColumn.SPECIFIED_INSERTABLE_PROPERTY, oldSpecifiedInsertable, newSpecifiedInsertable);
+ }
+
+ public Boolean getUpdatable() {
+ return (this.getSpecifiedUpdatable() == null) ? this.getDefaultUpdatable() : this.getSpecifiedUpdatable();
+ }
+
+ public Boolean getDefaultUpdatable() {
+ return IAbstractColumn.DEFAULT_UPDATABLE;
+ }
+
+ public Boolean getSpecifiedUpdatable() {
+ return this.specifiedUpdatable;
+ }
+
+ public void setSpecifiedUpdatable(Boolean newSpecifiedUpdatable) {
+ Boolean oldSpecifiedUpdatable = this.specifiedUpdatable;
+ this.specifiedUpdatable = newSpecifiedUpdatable;
+ if (oldSpecifiedUpdatable != newSpecifiedUpdatable) {
+ if (this.columnResource() != null) {
+ this.columnResource().setUpdatable(newSpecifiedUpdatable);
+ if (this.columnResource().isAllFeaturesUnset()) {
+ removeColumnResource();
+ }
+ }
+ else if (newSpecifiedUpdatable != null) {
+ addColumnResource();
+ columnResource().setUpdatable(newSpecifiedUpdatable);
+ }
+ }
+ firePropertyChanged(IAbstractColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable);
+ }
+
+ protected void setSpecifiedUpdatable_(Boolean newSpecifiedUpdatable) {
+ Boolean oldSpecifiedUpdatable = this.specifiedUpdatable;
+ this.specifiedUpdatable = newSpecifiedUpdatable;
+ firePropertyChanged(IAbstractColumn.SPECIFIED_UPDATABLE_PROPERTY, oldSpecifiedUpdatable, newSpecifiedUpdatable);
+ }
+
+ @Override
+ protected String tableName() {
+ return this.getTable();
+ }
+
+ public ITextRange tableTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+//
+// public ITextRange tableTextRange() {
+// if (node == null) {
+// return owner.validationTextRange();
+// }
+// IDOMNode tableNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.ENTITY__TABLE);
+// return (tableNode == null) ? validationTextRange() : buildTextRange(tableNode);
+// }
+
+ @Override
+ protected void initialize(T column) {
+ super.initialize(column);
+ this.specifiedTable = this.specifiedTable(column);
+ this.defaultTable = this.defaultTable();
+ //TODO default from java for all of these settings
+ this.specifiedNullable = this.specifiedNullable(column);
+ this.specifiedUpdatable = this.specifiedUpdatable(column);
+ this.specifiedUnique = this.specifiedUnique(column);
+ this.specifiedInsertable = this.specifiedInsertable(column);
+ }
+
+ @Override
+ protected void update(T column) {
+ super.update(column);
+ setSpecifiedTable_(this.specifiedTable(column));
+ setDefaultTable(this.defaultTable());
+ setSpecifiedNullable_(this.specifiedNullable(column));
+ setSpecifiedUpdatable_(this.specifiedUpdatable(column));
+ setSpecifiedUnique_(this.specifiedUnique(column));
+ setSpecifiedInsertable_(this.specifiedInsertable(column));
+ }
+
+ protected String specifiedTable(T column) {
+ return column == null ? null : column.getTable();
+ }
+
+ protected Boolean specifiedNullable(T column) {
+ return column == null ? null : column.getNullable();
+ }
+
+ protected Boolean specifiedUpdatable(T column) {
+ return column == null ? null : column.getUpdatable();
+ }
+
+ protected Boolean specifiedUnique(T column) {
+ return column == null ? null : column.getUnique();
+ }
+
+ protected Boolean specifiedInsertable(T column) {
+ return column == null ? null : column.getInsertable();
+ }
+
+ protected String defaultTable() {
+ return owner().defaultTableName();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractXmlNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractXmlNamedColumn.java
new file mode 100644
index 0000000000..ee100df0f2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractXmlNamedColumn.java
@@ -0,0 +1,187 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.INamedColumn;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.NamedColumn;
+import org.eclipse.jpt.db.internal.Column;
+import org.eclipse.jpt.db.internal.Table;
+
+
+public abstract class AbstractXmlNamedColumn<T extends NamedColumn> extends JpaContextNode
+ implements INamedColumn
+{
+ protected Owner owner;
+
+ protected String specifiedName;
+
+ protected String defaultName;
+
+ protected String columnDefinition;
+
+ protected AbstractXmlNamedColumn(IJpaContextNode parent, Owner owner) {
+ super(parent);
+ this.owner = owner;
+ }
+
+ protected abstract T columnResource();
+
+ protected abstract void removeColumnResource();
+
+ protected abstract void addColumnResource();
+
+ public Owner owner() {
+ return this.owner;
+ }
+
+// @Override
+// protected void addInsignificantXmlFeatureIdsTo(Set<Integer> insignificantXmlFeatureIds) {
+// super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
+// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME);
+// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.INAMED_COLUMN__NAME);
+// }
+
+
+ public String getName() {
+ return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
+ }
+
+ public String getSpecifiedName() {
+ return this.specifiedName;
+ }
+
+ public void setSpecifiedName(String newSpecifiedName) {
+ String oldSpecifiedName = this.specifiedName;
+ this.specifiedName = newSpecifiedName;
+ if (oldSpecifiedName != newSpecifiedName) {
+ if (this.columnResource() != null) {
+ this.columnResource().setName(newSpecifiedName);
+ if (this.columnResource().isAllFeaturesUnset()) {
+ removeColumnResource();
+ }
+ }
+ else if (newSpecifiedName != null) {
+ addColumnResource();
+ columnResource().setName(newSpecifiedName);
+ }
+ }
+ firePropertyChanged(SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
+ }
+
+ protected void setSpecifiedName_(String newSpecifiedName) {
+ String oldSpecifiedName = this.specifiedName;
+ this.specifiedName = newSpecifiedName;
+ firePropertyChanged(SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
+ }
+
+ public String getDefaultName() {
+ return this.defaultName;
+ }
+
+ protected void setDefaultName(String newDefaultName) {
+ String oldDefaultName = this.defaultName;
+ this.defaultName = newDefaultName;
+ firePropertyChanged(DEFAULT_NAME_PROPERTY, oldDefaultName, newDefaultName);
+ }
+
+ public String getColumnDefinition() {
+ return this.columnDefinition;
+ }
+
+ public void setColumnDefinition(String newColumnDefinition) {
+ String oldColumnDefinition = this.columnDefinition;
+ this.columnDefinition = newColumnDefinition;
+ if (oldColumnDefinition != newColumnDefinition) {
+ if (this.columnResource() != null) {
+ this.columnResource().setColumnDefinition(newColumnDefinition);
+ if (this.columnResource().isAllFeaturesUnset()) {
+ removeColumnResource();
+ }
+ }
+ else if (newColumnDefinition != null) {
+ addColumnResource();
+ columnResource().setColumnDefinition(newColumnDefinition);
+ }
+ }
+ firePropertyChanged(COLUMN_DEFINITION_PROPERTY, oldColumnDefinition, newColumnDefinition);
+ }
+
+ protected void setColumnDefinition_(String newColumnDefinition) {
+ String oldColumnDefinition = this.columnDefinition;
+ this.columnDefinition = newColumnDefinition;
+ firePropertyChanged(COLUMN_DEFINITION_PROPERTY, oldColumnDefinition, newColumnDefinition);
+ }
+
+ public Column dbColumn() {
+ Table table = this.dbTable();
+ return (table == null) ? null : table.columnNamed(getName());
+ }
+
+ public Table dbTable() {
+ return owner().dbTable(this.tableName());
+ }
+
+ protected abstract String tableName();
+
+ public boolean isResolved() {
+ return dbColumn() != null;
+ }
+
+ public ITextRange nameTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+// public ITextRange nameTextRange() {
+// if (node == null) {
+// return owner.validationTextRange();
+// }
+// IDOMNode nameNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.NAME);
+// return (nameNode == null) ? validationTextRange() : buildTextRange(nameNode);
+// }
+//
+// public void refreshDefaults(DefaultsContext defaultsContext) {
+// setDefaultName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_COLUMN_NAME_KEY));
+// }
+
+ // ******************* initialization from orm xml resource model ********************
+
+ protected void initialize(T column) {
+ this.specifiedName = this.specifiedName(column);
+ this.defaultName = this.defaultName();
+ this.columnDefinition = this.specifiedColumnDefinition(column);
+ }
+
+ protected void update(T column) {
+ setSpecifiedName_(this.specifiedName(column));
+ setDefaultName(this.defaultName());
+ setColumnDefinition_(this.specifiedColumnDefinition(column));
+ }
+
+ protected String specifiedName(T column) {
+ return column == null ? null : column.getName();
+ }
+
+ protected String specifiedColumnDefinition(T column) {
+ return column == null ? null : column.getColumnDefinition();
+ }
+
+ /**
+ * Return the default column name.
+ */
+ protected String defaultName() {
+ return this.owner().defaultColumnName();
+ }
+
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractXmlQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractXmlQuery.java
new file mode 100644
index 0000000000..06ef8cc1e5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractXmlQuery.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.IQuery;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.Query;
+import org.eclipse.jpt.core.internal.resource.orm.QueryHint;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+
+public abstract class AbstractXmlQuery<E extends Query> extends JpaContextNode implements IQuery
+{
+
+ protected String name;
+
+ protected String query;
+
+ protected final List<XmlQueryHint> hints;
+
+ protected E queryResource;
+
+ protected AbstractXmlQuery(IJpaContextNode parent) {
+ super(parent);
+ this.hints = new ArrayList<XmlQueryHint>();
+ }
+
+ protected E queryResource() {
+ return this.queryResource;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.queryResource().setName(newName);
+ firePropertyChanged(IQuery.NAME_PROPERTY, oldName, newName);
+ }
+
+ public String getQuery() {
+ return this.query;
+ }
+
+ public void setQuery(String newQuery) {
+ String oldQuery = this.query;
+ this.query = newQuery;
+ this.queryResource().setQuery(newQuery);
+ firePropertyChanged(IQuery.QUERY_PROPERTY, oldQuery, newQuery);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlQueryHint> hints() {
+ return new CloneListIterator<XmlQueryHint>(this.hints);
+ }
+
+ public int hintsSize() {
+ return this.hints.size();
+ }
+
+ public XmlQueryHint addHint(int index) {
+ XmlQueryHint queryHint = new XmlQueryHint(this);
+ this.hints.add(index, queryHint);
+ this.queryResource().getHints().add(index, OrmFactory.eINSTANCE.createQueryHint());
+ this.fireItemAdded(IQuery.HINTS_LIST, index, queryHint);
+ return queryHint;
+ }
+
+ protected void addHint(int index, XmlQueryHint queryHint) {
+ addItemToList(index, queryHint, this.hints, IQuery.HINTS_LIST);
+ }
+
+ public void removeHint(int index) {
+ XmlQueryHint queryHint = this.hints.remove(index);
+ this.queryResource.getHints().remove(index);
+ fireItemRemoved(IQuery.HINTS_LIST, index, queryHint);
+ }
+
+ protected void removeHint(XmlQueryHint queryHint) {
+ removeItemFromList(queryHint, this.hints, IQuery.HINTS_LIST);
+ }
+
+ public void moveHint(int targetIndex, int sourceIndex) {
+ this.queryResource.getHints().move(targetIndex, sourceIndex);
+ moveItemInList(targetIndex, sourceIndex, this.hints, IQuery.HINTS_LIST);
+
+ }
+
+
+ public void initialize(E queryResource) {
+ this.queryResource = queryResource;
+ this.name = queryResource.getName();
+ this.query = queryResource.getQuery();
+ this.initializeHints(queryResource);
+ }
+
+ protected void initializeHints(E queryResource) {
+ for (QueryHint queryhint : queryResource.getHints()) {
+ this.hints.add(createHint(queryhint));
+ }
+ }
+
+ protected XmlQueryHint createHint(QueryHint queryhint) {
+ XmlQueryHint xmlQueryHint = new XmlQueryHint(this);
+ xmlQueryHint.initialize(queryhint);
+ return xmlQueryHint;
+ }
+
+ public void update(E queryResource) {
+ this.queryResource = queryResource;
+ this.setName(queryResource.getName());
+ this.setQuery(queryResource.getQuery());
+ this.updateHints(queryResource);
+ }
+
+ protected void updateHints(E queryResource) {
+ ListIterator<XmlQueryHint> hints = hints();
+ ListIterator<QueryHint> resourceHints = queryResource.getHints().listIterator();
+
+ while (hints.hasNext()) {
+ XmlQueryHint hint = hints.next();
+ if (resourceHints.hasNext()) {
+ hint.update(resourceHints.next());
+ }
+ else {
+ removeHint(hint);
+ }
+ }
+
+ while (resourceHints.hasNext()) {
+ addHint(hintsSize(), createHint(resourceHints.next()));
+ }
+ }
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractXmlTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractXmlTable.java
new file mode 100644
index 0000000000..5eac1c34a4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractXmlTable.java
@@ -0,0 +1,310 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.ITable;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.AbstractTable;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.NameTools;
+
+public abstract class AbstractXmlTable extends JpaContextNode implements ITable
+{
+ protected String specifiedName;
+
+ protected String defaultName;
+
+ protected String specifiedCatalog;
+
+ protected String defaultCatalog;
+
+ protected String specifiedSchema;
+
+ protected String defaultSchema;
+
+// protected EList<IUniqueConstraint> uniqueConstraints;
+
+ protected AbstractXmlTable(IJpaContextNode parent) {
+ super(parent);
+ }
+//
+// @Override
+// protected void addInsignificantXmlFeatureIdsTo(Set<Integer> insignificantXmlFeatureIds) {
+// super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
+// insignificantXmlFeatureIds.add(OrmPackage.ABSTRACT_XML_TABLE__NAME);
+// insignificantXmlFeatureIds.add(OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_NAME);
+// insignificantXmlFeatureIds.add(OrmPackage.ABSTRACT_XML_TABLE__SCHEMA);
+// insignificantXmlFeatureIds.add(OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_SCHEMA);
+// insignificantXmlFeatureIds.add(OrmPackage.ABSTRACT_XML_TABLE__CATALOG);
+// insignificantXmlFeatureIds.add(OrmPackage.ABSTRACT_XML_TABLE__DEFAULT_CATALOG);
+// }
+//
+
+ public String getName() {
+ return (this.getSpecifiedName() == null) ? this.getDefaultName() : this.getSpecifiedName();
+ }
+
+ public String getSpecifiedName() {
+ return this.specifiedName;
+ }
+
+ protected abstract AbstractTable table();
+
+ protected abstract void removeTableResource();
+
+ protected abstract void addTableResource();
+
+ public void setSpecifiedName(String newSpecifiedName) {
+ String oldSpecifiedName = this.specifiedName;
+ this.specifiedName = newSpecifiedName;
+ if (oldSpecifiedName != newSpecifiedName) {
+ if (this.table() != null) {
+ this.table().setName(newSpecifiedName);
+ if (this.table().isAllFeaturesUnset()) {
+ removeTableResource();
+ }
+ }
+ else if (newSpecifiedName != null) {
+ addTableResource();
+ table().setName(newSpecifiedName);
+ }
+ }
+ firePropertyChanged(SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
+ }
+
+ protected void setSpecifiedName_(String newSpecifiedName) {
+ String oldSpecifiedName = this.specifiedName;
+ this.specifiedName = newSpecifiedName;
+ firePropertyChanged(SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
+ }
+
+ public String getDefaultName() {
+ return this.defaultName;
+ }
+
+ protected void setDefaultName(String newDefaultName) {
+ String oldDefaultName = this.defaultName;
+ this.defaultName = newDefaultName;
+ firePropertyChanged(DEFAULT_NAME_PROPERTY, oldDefaultName, newDefaultName);
+ }
+
+ public String getCatalog() {
+ return (this.getSpecifiedCatalog() == null) ? getDefaultCatalog() : this.getSpecifiedCatalog();
+ }
+
+ public String getSpecifiedCatalog() {
+ return this.specifiedCatalog;
+ }
+
+ public void setSpecifiedCatalog(String newSpecifiedCatalog) {
+ String oldSpecifiedCatalog = this.specifiedCatalog;
+ this.specifiedCatalog = newSpecifiedCatalog;
+ if (oldSpecifiedCatalog != newSpecifiedCatalog) {
+ if (this.table() != null) {
+ this.table().setCatalog(newSpecifiedCatalog);
+ if (this.table().isAllFeaturesUnset()) {
+ removeTableResource();
+ }
+ }
+ else if (newSpecifiedCatalog != null) {
+ addTableResource();
+ table().setCatalog(newSpecifiedCatalog);
+ }
+ }
+ firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, oldSpecifiedCatalog, newSpecifiedCatalog);
+ }
+
+ protected void setSpecifiedCatalog_(String newSpecifiedCatalog) {
+ String oldSpecifiedCatalog = this.specifiedCatalog;
+ this.specifiedCatalog = newSpecifiedCatalog;
+ firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, oldSpecifiedCatalog, newSpecifiedCatalog);
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ protected void setDefaultCatalog(String newDefaultCatalog) {
+ String oldDefaultCatalog = this.defaultCatalog;
+ this.defaultCatalog = newDefaultCatalog;
+ firePropertyChanged(DEFAULT_CATALOG_PROPERTY, oldDefaultCatalog, newDefaultCatalog);
+ }
+
+ public String getSchema() {
+ return (this.getSpecifiedSchema() == null) ? getDefaultSchema() : this.getSpecifiedSchema();
+ }
+
+ public String getSpecifiedSchema() {
+ return this.specifiedSchema;
+ }
+
+ public void setSpecifiedSchema(String newSpecifiedSchema) {
+ String oldSpecifiedSchema = this.specifiedSchema;
+ this.specifiedSchema = newSpecifiedSchema;
+ if (oldSpecifiedSchema != newSpecifiedSchema) {
+ if (this.table() != null) {
+ this.table().setSchema(newSpecifiedSchema);
+ if (this.table().isAllFeaturesUnset()) {
+ removeTableResource();
+ }
+ }
+ else if (newSpecifiedSchema != null) {
+ addTableResource();
+ table().setSchema(newSpecifiedSchema);
+ }
+ }
+
+ firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, oldSpecifiedSchema, newSpecifiedSchema);
+ }
+
+ protected void setSpecifiedSchema_(String newSpecifiedSchema) {
+ String oldSpecifiedSchema = this.specifiedSchema;
+ this.specifiedSchema = newSpecifiedSchema;
+ firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, oldSpecifiedSchema, newSpecifiedSchema);
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+ protected void setDefaultSchema(String newDefaultSchema) {
+ String oldDefaultSchema = this.defaultSchema;
+ this.defaultSchema = newDefaultSchema;
+ firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, oldDefaultSchema, newDefaultSchema);
+ }
+
+// public EList<IUniqueConstraint> getUniqueConstraints() {
+// if (uniqueConstraints == null) {
+// uniqueConstraints = new EObjectContainmentEList<IUniqueConstraint>(IUniqueConstraint.class, this, OrmPackage.ABSTRACT_XML_TABLE__UNIQUE_CONSTRAINTS);
+// }
+// return uniqueConstraints;
+// }
+
+
+ public ITextRange nameTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ITextRange catalogTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ITextRange schemaTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+// public ITextRange nameTextRange() {
+// if (node == null) {
+// return owner.validationTextRange();
+// }
+// IDOMNode nameNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.NAME);
+// return (nameNode == null) ? validationTextRange() : buildTextRange(nameNode);
+// }
+//
+// public ITextRange schemaTextRange() {
+// if (node == null) {
+// return owner.validationTextRange();
+// }
+// IDOMNode schemaNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.SCHEMA);
+// return (schemaNode == null) ? validationTextRange() : buildTextRange(schemaNode);
+// }
+//
+// @Override
+// public ITextRange validationTextRange() {
+// return (node == null) ? owner.validationTextRange() : super.validationTextRange();
+// }
+//
+// public Owner getOwner() {
+// return owner;
+// }
+
+ public Table dbTable() {
+ Schema schema = this.dbSchema();
+ return (schema == null) ? null : schema.tableNamed(getName());
+ }
+
+ public Schema dbSchema() {
+ return connectionProfile().getDatabase().schemaNamed(getSchema());
+ }
+
+ public boolean hasResolvedSchema() {
+ return dbSchema() != null;
+ }
+
+ public boolean isResolved() {
+ return dbTable() != null;
+ }
+//
+// public IUniqueConstraint createUniqueConstraint(int index) {
+// return createXmlJavaUniqueConstraint(index);
+// }
+//
+// protected XmlUniqueConstraint createXmlJavaUniqueConstraint(int index) {
+// return OrmFactory.eINSTANCE.createXmlUniqueConstraint();
+// }
+
+ protected void initialize(AbstractTable table) {
+ this.specifiedName = this.specifiedName(table);
+ this.specifiedSchema = this.specifiedSchema(table);
+ this.specifiedCatalog = this.specifiedCatalog(table);
+ this.defaultName = this.defaultName();
+ this.defaultSchema = this.defaultSchema();
+ this.defaultCatalog = this.defaultCatalog();
+ }
+
+ protected void update(AbstractTable table) {
+ this.setSpecifiedName_(this.specifiedName(table));
+ this.setSpecifiedSchema_(this.specifiedSchema(table));
+ this.setSpecifiedCatalog_(this.specifiedCatalog(table));
+ this.setDefaultName(this.defaultName());
+ this.setDefaultSchema(this.defaultSchema());
+ this.setDefaultCatalog(this.defaultCatalog());
+ }
+
+ protected String specifiedName(AbstractTable table) {
+ return table == null ? null : table.getName();
+ }
+
+ protected String specifiedSchema(AbstractTable table) {
+ return table == null ? null : table.getSchema();
+ }
+
+ protected String specifiedCatalog(AbstractTable table) {
+ return table == null ? null : table.getCatalog();
+ }
+
+ protected abstract String defaultName();
+
+ protected abstract String defaultSchema();
+
+ protected abstract String defaultCatalog();
+
+ public String qualifiedName() {
+ return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName());
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ super.toString(sb);
+ sb.append(qualifiedName());
+ }
+
+ @Override
+ public String displayString() {
+ return qualifiedName();
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/EntityMappings.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/EntityMappings.java
new file mode 100644
index 0000000000..f4f2de7e60
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/EntityMappings.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.ISequenceGenerator;
+import org.eclipse.jpt.core.internal.context.base.ITableGenerator;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+
+public interface EntityMappings extends IJpaContextNode
+{
+
+ String getVersion();
+
+ String getDescription();
+ void setDescription(String newDescription);
+ String DESCRIPTION_PROPERTY = "descriptionProperty";
+
+ String getPackage();
+ void setPackage(String newPackage);
+ String PACKAGE_PROPERTY = "packageProperty";
+
+ /**
+ * Return the specifiedSchema if not null, otherwise return the defaultSchema.
+ */
+ String getSchema();
+ String getDefaultSchema();
+ String DEFAULT_SCHEMA_PROPERTY = "defaultSchemaProperty";
+ String getSpecifiedSchema();
+ void setSpecifiedSchema(String newSpecifiedSchema);
+ String SPECIFIED_SCHEMA_PROPERTY = "specifiedSchemaProperty";
+
+ /**
+ * Return the specifiedCatalog if not null, otherwise return the defaultCatalog.
+ */
+ String getCatalog();
+ String getDefaultCatalog();
+ String DEFAULT_CATALOG_PROPERTY = "defaultCatalogProperty";
+ String getSpecifiedCatalog();
+ void setSpecifiedCatalog(String newSpecifiedCatalog);
+ String SPECIFIED_CATALOG_PROPERTY = "specifiedCatalogProperty";
+
+ /**
+ * Return the specifiedAccess if not null, otherwise return the defaultAccess.
+ */
+ AccessType getAccess();
+ AccessType getDefaultAccess();
+ String DEFAULT_ACCESS_PROPERTY = "defaultAccessProperty";
+ AccessType getSpecifiedAccess();
+ void setSpecifiedAccess(AccessType newSpecifiedAccess);
+ String SPECIFIED_ACCESS_PROPERTY = "specifiedAccessProperty";
+
+
+ PersistenceUnitMetadata getPersistenceUnitMetadata();
+
+
+ ListIterator<XmlPersistentType> xmlPersistentTypes();
+ int xmlPersistentTypesSize();
+ XmlPersistentType addXmlPersistentType(String mappingKey, String className);
+ void removeXmlPersistentType(int index);
+ void removeXmlPersistentType(XmlPersistentType xmlPersistentType);
+ //void moveXmlPersistentType(int targetIndex, int sourceIndex);
+ boolean containsPersistentType(String className);
+ String PERSISTENT_TYPES_LIST = "persistentTypes";
+
+
+ <T extends ISequenceGenerator> ListIterator<T> sequenceGenerators();
+ int sequenceGeneratorsSize();
+ ISequenceGenerator addSequenceGenerator(int index);
+ void removeSequenceGenerator(int index);
+ void moveSequenceGenerator(int targetIndex, int sourceIndex);
+ String SEQUENCE_GENERATORS_LIST = "sequenceGeneratorsList";
+
+ <T extends ITableGenerator> ListIterator<T> tableGenerators();
+ int tableGeneratorsSize();
+ ITableGenerator addTableGenerator(int index);
+ void removeTableGenerator(int index);
+ void moveTableGenerator(int targetIndex, int sourceIndex);
+ String TABLE_GENERATORS_LIST = "tableGeneratorsList";
+
+ ListIterator<XmlNamedQuery> namedQueries();
+ int namedQueriesSize();
+ XmlNamedQuery addNamedQuery(int index);
+ void removeNamedQuery(int index);
+ void moveNamedQuery(int targetIndex, int sourceIndex);
+ String NAMED_QUERIES_LIST = "namedQueriesList";
+
+ ListIterator<XmlNamedNativeQuery> namedNativeQueries();
+ int namedNativeQueriesSize();
+ XmlNamedNativeQuery addNamedNativeQuery(int index);
+ void removeNamedNativeQuery(int index);
+ void moveNamedNativeQuery(int targetIndex, int sourceIndex);
+ String NAMED_NATIVE_QUERIES_LIST = "namedNativeQueriesList";
+
+
+
+ PersistenceUnitDefaults persistenceUnitDefaults();
+
+ /**
+ * Return the XmlPersistentType listed in this mapping file
+ * with the given fullyQualifiedTypeName. Return null if non exists.
+ */
+ XmlPersistentType persistentTypeFor(String fullyQualifiedTypeName);
+
+ void changeMapping(XmlPersistentType xmlPersistentType, XmlTypeMapping<? extends TypeMapping> oldMapping, XmlTypeMapping<? extends TypeMapping> newMapping);
+
+ // **************** updating ***********************************************
+
+ void initialize(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings);
+
+ void update(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/EntityMappingsImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/EntityMappingsImpl.java
new file mode 100644
index 0000000000..03cc169155
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/EntityMappingsImpl.java
@@ -0,0 +1,703 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.base.ISequenceGenerator;
+import org.eclipse.jpt.core.internal.context.base.ITableGenerator;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.Embeddable;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass;
+import org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery;
+import org.eclipse.jpt.core.internal.resource.orm.NamedQuery;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator;
+import org.eclipse.jpt.core.internal.resource.orm.TableGenerator;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+
+public class EntityMappingsImpl extends JpaContextNode implements EntityMappings
+{
+ protected org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings;
+
+ protected String version;
+
+ protected String description;
+
+ protected String package_;
+
+ protected String defaultSchema;
+
+ protected String specifiedSchema;
+
+ protected String defaultCatalog;
+
+ protected String specifiedCatalog;
+
+ protected AccessType defaultAccess;
+
+ protected AccessType specifiedAccess;
+
+ protected final PersistenceUnitMetadata persistenceUnitMetadata;
+
+ protected final List<XmlPersistentType> persistentTypes;
+
+ protected final List<XmlSequenceGenerator> sequenceGenerators;
+
+ protected final List<XmlTableGenerator> tableGenerators;
+
+ protected final List<XmlNamedQuery> namedQueries;
+
+ protected final List<XmlNamedNativeQuery> namedNativeQueries;
+
+
+ public EntityMappingsImpl(OrmXml parent) {
+ super(parent);
+ this.persistenceUnitMetadata = jpaFactory().createPersistenceUnitMetadata(this);
+ this.persistentTypes = new ArrayList<XmlPersistentType>();
+ this.sequenceGenerators = new ArrayList<XmlSequenceGenerator>();
+ this.tableGenerators = new ArrayList<XmlTableGenerator>();
+ this.namedQueries = new ArrayList<XmlNamedQuery>();
+ this.namedNativeQueries = new ArrayList<XmlNamedNativeQuery>();
+ }
+
+ @Override
+ public EntityMappings entityMappings() {
+ return this;
+ }
+
+ public XmlPersistentType persistentTypeFor(String fullyQualifiedTypeName) {
+ for (XmlPersistentType xmlPersistentType : CollectionTools.iterable(xmlPersistentTypes())) {
+ if (xmlPersistentType.isFor(fullyQualifiedTypeName)) {
+ return xmlPersistentType;
+ }
+ }
+ return null;
+ }
+
+ public PersistenceUnitMetadata getPersistenceUnitMetadata() {
+ return this.persistenceUnitMetadata;
+ }
+
+ public String getPackage() {
+ return this.package_;
+ }
+
+ public void setPackage(String newPackage) {
+ String oldPackage = this.package_;
+ this.package_ = newPackage;
+ this.entityMappings.setPackage(newPackage);
+ firePropertyChanged(PACKAGE_PROPERTY, oldPackage, newPackage);
+ }
+
+ public String getVersion() {
+ return this.version;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String newDescription) {
+ String oldDescription = this.description;
+ this.description = newDescription;
+ this.entityMappings.setDescription(newDescription);
+ firePropertyChanged(DESCRIPTION_PROPERTY, oldDescription, newDescription);
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+ protected void setDefaultSchema(String newDefaultSchema) {
+ String oldDefaultSchema = this.defaultSchema;
+ this.defaultSchema = newDefaultSchema;
+ firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, oldDefaultSchema, newDefaultSchema);
+ }
+
+ public String getSpecifiedSchema() {
+ return this.specifiedSchema;
+ }
+
+ public void setSpecifiedSchema(String newSpecifiedSchema) {
+ String oldSpecifiedSchema = this.specifiedSchema;
+ this.specifiedSchema = newSpecifiedSchema;
+ this.entityMappings.setSchema(newSpecifiedSchema);
+ firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, oldSpecifiedSchema, newSpecifiedSchema);
+ }
+
+ public String getSchema() {
+ return (this.getSpecifiedSchema() == null) ? this.getDefaultSchema() : this.getSpecifiedSchema();
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ protected void setDefaultCatalog(String newDefaultCatalog) {
+ String oldDefaultCatalog = this.defaultCatalog;
+ this.defaultCatalog = newDefaultCatalog;
+ firePropertyChanged(DEFAULT_CATALOG_PROPERTY, oldDefaultCatalog, newDefaultCatalog);
+ }
+
+ public String getSpecifiedCatalog() {
+ return this.specifiedCatalog;
+ }
+
+ public void setSpecifiedCatalog(String newSpecifiedCatalog) {
+ String oldSpecifiedCatalog = this.specifiedCatalog;
+ this.specifiedCatalog = newSpecifiedCatalog;
+ this.entityMappings.setCatalog(newSpecifiedCatalog);
+ firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, oldSpecifiedCatalog, newSpecifiedCatalog);
+ }
+
+ public String getCatalog() {
+ return (this.getSpecifiedCatalog() == null) ? this.getDefaultCatalog() : this.getSpecifiedCatalog();
+ }
+
+ public AccessType getAccess() {
+ return (this.getSpecifiedAccess() == null) ? this.getDefaultAccess() : this.getSpecifiedAccess();
+ }
+
+ public AccessType getDefaultAccess() {
+ return this.defaultAccess;
+ }
+
+ protected void setDefaultAccess(AccessType newDefaultAccess) {
+ AccessType oldDefaultAccess = this.defaultAccess;
+ this.defaultAccess = newDefaultAccess;
+ firePropertyChanged(DEFAULT_ACCESS_PROPERTY, oldDefaultAccess, newDefaultAccess);
+ }
+
+ public AccessType getSpecifiedAccess() {
+ return this.specifiedAccess;
+ }
+
+ public void setSpecifiedAccess(AccessType newSpecifiedAccess) {
+ AccessType oldSpecifiedAccess = this.specifiedAccess;
+ this.specifiedAccess = newSpecifiedAccess;
+ this.entityMappings.setAccess(AccessType.toXmlResourceModel(newSpecifiedAccess));
+ firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, oldSpecifiedAccess, newSpecifiedAccess);
+ }
+
+ public ListIterator<XmlPersistentType> xmlPersistentTypes() {
+ return new CloneListIterator<XmlPersistentType>(this.persistentTypes);
+ }
+
+ public int xmlPersistentTypesSize() {
+ return this.persistentTypes.size();
+ }
+
+ public XmlPersistentType addXmlPersistentType(String mappingKey, String className) {
+ XmlPersistentType persistentType = jpaFactory().createXmlPersistentType(this, mappingKey);
+ int index = insertionIndex(persistentType);
+ this.persistentTypes.add(index, persistentType);
+ if (className.startsWith(getPackage() + ".")) {
+ // adds short name if package name is specified
+ className = className.substring(getPackage().length() + 1);
+ }
+ TypeMapping typeMapping = persistentType.getMapping().addToResourceModel(this.entityMappings);
+ typeMapping.setClassName(className);
+ fireItemAdded(PERSISTENT_TYPES_LIST, index, persistentType);
+ return persistentType;
+ }
+
+ protected void addXmlPersistentType(XmlPersistentType xmlPersistentType) {
+ addItemToList(xmlPersistentType, this.persistentTypes, PERSISTENT_TYPES_LIST);
+ }
+
+ protected int insertionIndex(XmlPersistentType persistentType) {
+ return CollectionTools.insertionIndexOf(this.persistentTypes, persistentType, buildMappingComparator());
+ }
+
+ private Comparator<XmlPersistentType> buildMappingComparator() {
+ return new Comparator<XmlPersistentType>() {
+ public int compare(XmlPersistentType o1, XmlPersistentType o2) {
+ int o1Sequence = o1.getMapping().xmlSequence();
+ int o2Sequence = o2.getMapping().xmlSequence();
+ if (o1Sequence < o2Sequence) {
+ return -1;
+ }
+ if (o1Sequence == o2Sequence) {
+ return 0;
+ }
+ return 1;
+ }
+ };
+ }
+
+ public void removeXmlPersistentType(int index) {
+ XmlPersistentType xmlPersistentType = this.persistentTypes.get(index);
+ this.persistentTypes.remove(index);
+ xmlPersistentType.getMapping().removeFromResourceModel(this.entityMappings);
+ fireItemRemoved(PERSISTENT_TYPES_LIST, index, xmlPersistentType);
+ }
+
+ public void removeXmlPersistentType(XmlPersistentType xmlPersistentType) {
+ removeXmlPersistentType(this.persistentTypes.indexOf(xmlPersistentType));
+ }
+
+ protected void removeXmlPersistentType_(XmlPersistentType xmlPersistentType) {
+ removeItemFromList(xmlPersistentType, this.persistentTypes, PERSISTENT_TYPES_LIST);
+ }
+
+ public void changeMapping(XmlPersistentType xmlPersistentType, XmlTypeMapping<? extends TypeMapping> oldMapping, XmlTypeMapping<? extends TypeMapping> newMapping) {
+ int sourceIndex = this.persistentTypes.indexOf(xmlPersistentType);
+ this.persistentTypes.remove(sourceIndex);
+ oldMapping.removeFromResourceModel(this.entityMappings);
+ int targetIndex = insertionIndex(xmlPersistentType);
+ this.persistentTypes.add(targetIndex, xmlPersistentType);
+ newMapping.addToResourceModel(this.entityMappings);
+ newMapping.initializeFrom(oldMapping);
+ //TODO are the source and target correct in this case, or is target off by one???
+ fireItemMoved(PERSISTENT_TYPES_LIST, targetIndex, sourceIndex);
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlSequenceGenerator> sequenceGenerators() {
+ return new CloneListIterator<XmlSequenceGenerator>(this.sequenceGenerators);
+ }
+
+ public int sequenceGeneratorsSize() {
+ return this.sequenceGenerators.size();
+ }
+
+ public ISequenceGenerator addSequenceGenerator(int index) {
+ XmlSequenceGenerator xmlSequenceGenerator = new XmlSequenceGenerator(this);
+ this.sequenceGenerators.add(index, xmlSequenceGenerator);
+ SequenceGenerator sequenceGenerator = OrmFactory.eINSTANCE.createSequenceGeneratorImpl();
+ xmlSequenceGenerator.initialize(sequenceGenerator);
+ this.entityMappings.getSequenceGenerators().add(index, sequenceGenerator);
+ fireItemAdded(SEQUENCE_GENERATORS_LIST, index, xmlSequenceGenerator);
+ return xmlSequenceGenerator;
+ }
+
+ protected void addSequenceGenerator(int index, XmlSequenceGenerator sequenceGenerator) {
+ addItemToList(index, sequenceGenerator, this.sequenceGenerators, EntityMappings.SEQUENCE_GENERATORS_LIST);
+ }
+
+ public void removeSequenceGenerator(int index) {
+ XmlSequenceGenerator removedSequenceGenerator = this.sequenceGenerators.remove(index);
+ fireItemRemoved(SEQUENCE_GENERATORS_LIST, index, removedSequenceGenerator);
+ this.entityMappings.getSequenceGenerators().remove(index);
+ }
+
+ protected void removeSequenceGenerator(XmlSequenceGenerator sequenceGenerator) {
+ removeItemFromList(sequenceGenerator, this.sequenceGenerators, EntityMappings.SEQUENCE_GENERATORS_LIST);
+ }
+
+ public void moveSequenceGenerator(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.sequenceGenerators, targetIndex, sourceIndex);
+ this.entityMappings.getSequenceGenerators().move(targetIndex, sourceIndex);
+ fireItemMoved(EntityMappings.SEQUENCE_GENERATORS_LIST, targetIndex, sourceIndex);
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlTableGenerator> tableGenerators() {
+ return new CloneListIterator<XmlTableGenerator>(this.tableGenerators);
+ }
+
+ public int tableGeneratorsSize() {
+ return this.tableGenerators.size();
+ }
+
+ public ITableGenerator addTableGenerator(int index) {
+ XmlTableGenerator xmlTableGenerator = new XmlTableGenerator(this);
+ this.tableGenerators.add(index, xmlTableGenerator);
+ TableGenerator tableGenerator = OrmFactory.eINSTANCE.createTableGeneratorImpl();
+ xmlTableGenerator.initialize(tableGenerator);
+ this.entityMappings.getTableGenerators().add(index, tableGenerator);
+ fireItemAdded(TABLE_GENERATORS_LIST, index, xmlTableGenerator);
+ return xmlTableGenerator;
+ }
+
+ protected void addTableGenerator(int index, XmlTableGenerator tableGenerator) {
+ addItemToList(index, tableGenerator, this.tableGenerators, EntityMappings.TABLE_GENERATORS_LIST);
+ }
+
+ public void removeTableGenerator(int index) {
+ XmlTableGenerator removedTableGenerator = this.tableGenerators.remove(index);
+ this.entityMappings.getTableGenerators().remove(index);
+ fireItemRemoved(TABLE_GENERATORS_LIST, index, removedTableGenerator);
+ }
+
+ protected void removeTableGenerator(XmlTableGenerator tableGenerator) {
+ removeItemFromList(tableGenerator, this.tableGenerators, EntityMappings.TABLE_GENERATORS_LIST);
+ }
+
+ public void moveTableGenerator(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.tableGenerators, targetIndex, sourceIndex);
+ this.entityMappings.getTableGenerators().move(targetIndex, sourceIndex);
+ fireItemMoved(EntityMappings.TABLE_GENERATORS_LIST, targetIndex, sourceIndex);
+ }
+
+ public ListIterator<XmlNamedQuery> namedQueries() {
+ return new CloneListIterator<XmlNamedQuery>(this.namedQueries);
+ }
+
+ public int namedQueriesSize() {
+ return this.namedQueries.size();
+ }
+
+ public XmlNamedQuery addNamedQuery(int index) {
+ XmlNamedQuery namedQuery = new XmlNamedQuery(this);
+ this.namedQueries.add(index, namedQuery);
+ this.entityMappings.getNamedQueries().add(index, OrmFactory.eINSTANCE.createNamedQuery());
+ this.fireItemAdded(EntityMappings.NAMED_QUERIES_LIST, index, namedQuery);
+ return namedQuery;
+ }
+
+ protected void addNamedQuery(int index, XmlNamedQuery namedQuery) {
+ addItemToList(index, namedQuery, this.namedQueries, EntityMappings.NAMED_QUERIES_LIST);
+ }
+
+ public void removeNamedQuery(int index) {
+ XmlNamedQuery namedQuery = this.namedQueries.remove(index);
+ this.entityMappings.getNamedQueries().remove(index);
+ fireItemRemoved(EntityMappings.NAMED_QUERIES_LIST, index, namedQuery);
+ }
+
+ protected void removeNamedQuery(XmlNamedQuery namedQuery) {
+ removeItemFromList(namedQuery, this.namedQueries, EntityMappings.NAMED_QUERIES_LIST);
+ }
+
+ public void moveNamedQuery(int targetIndex, int sourceIndex) {
+ this.entityMappings.getNamedQueries().move(targetIndex, sourceIndex);
+ moveItemInList(targetIndex, sourceIndex, this.namedQueries, EntityMappings.NAMED_QUERIES_LIST);
+ }
+
+ public ListIterator<XmlNamedNativeQuery> namedNativeQueries() {
+ return new CloneListIterator<XmlNamedNativeQuery>(this.namedNativeQueries);
+ }
+
+ public int namedNativeQueriesSize() {
+ return this.namedNativeQueries.size();
+ }
+
+ public XmlNamedNativeQuery addNamedNativeQuery(int index) {
+ XmlNamedNativeQuery namedNativeQuery = new XmlNamedNativeQuery(this);
+ this.namedNativeQueries.add(index, namedNativeQuery);
+ this.entityMappings.getNamedNativeQueries().add(index, OrmFactory.eINSTANCE.createNamedNativeQuery());
+ this.fireItemAdded(EntityMappings.NAMED_QUERIES_LIST, index, namedNativeQuery);
+ return namedNativeQuery;
+ }
+
+ protected void addNamedNativeQuery(int index, XmlNamedNativeQuery namedNativeQuery) {
+ addItemToList(index, namedNativeQuery, this.namedNativeQueries, EntityMappings.NAMED_NATIVE_QUERIES_LIST);
+ }
+
+ public void removeNamedNativeQuery(int index) {
+ XmlNamedNativeQuery namedNativeQuery = this.namedNativeQueries.remove(index);
+ this.entityMappings.getNamedNativeQueries().remove(index);
+ fireItemRemoved(EntityMappings.NAMED_QUERIES_LIST, index, namedNativeQuery);
+ }
+
+ protected void removeNamedNativeQuery(XmlNamedNativeQuery namedNativeQuery) {
+ removeItemFromList(namedNativeQuery, this.namedNativeQueries, EntityMappings.NAMED_NATIVE_QUERIES_LIST);
+ }
+
+ public void moveNamedNativeQuery(int targetIndex, int sourceIndex) {
+ this.entityMappings.getNamedNativeQueries().move(targetIndex, sourceIndex);
+ moveItemInList(targetIndex, sourceIndex, this.namedNativeQueries, EntityMappings.NAMED_NATIVE_QUERIES_LIST);
+ }
+
+ //TODO what about qualified name? package + class
+ //this needs to be handled both for className and persistentType.getName().
+ //moving on for now since I am just trying to get the ui compiled! just a warning that this isn't good api
+ public boolean containsPersistentType(String className) {
+ for (XmlPersistentType persistentType : CollectionTools.iterable(xmlPersistentTypes())) {
+ if (persistentType.getName().equals(className)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+// /* @see IJpaContentNode#getId() */
+// public Object getId() {
+// return IXmlContentNodes.ENTITY_MAPPINGS_ID;
+// }
+//
+// public IJpaContentNode getContentNode(int offset) {
+// for (Iterator i = getTypeMappings().iterator(); i.hasNext();) {
+// XmlTypeMapping mapping = (XmlTypeMapping) i.next();
+// if (mapping.getNode().contains(offset)) {
+// return mapping.getContentNode(offset);
+// }
+// }
+// return this;
+// }
+//
+// public void javaElementChanged(ElementChangedEvent event) {
+// }
+
+ public PersistenceUnitDefaults persistenceUnitDefaults() {
+ return getPersistenceUnitMetadata().getPersistenceUnitDefaults();
+ }
+
+ public void initialize(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ this.entityMappings = entityMappings;
+ this.version = entityMappings.getVersion();
+ this.description = entityMappings.getDescription();
+ this.package_ = entityMappings.getPackage();
+ this.specifiedSchema = entityMappings.getSchema();
+ this.specifiedCatalog = entityMappings.getCatalog();
+ this.specifiedAccess = this.specifiedAccess(entityMappings);
+ this.persistenceUnitMetadata.initialize(entityMappings);
+ this.defaultAccess = persistenceUnit().getDefaultAccess();
+ this.defaultCatalog = persistenceUnit().getDefaultCatalog();
+ this.defaultSchema = persistenceUnit().getDefaultSchema();
+ this.initializePersistentTypes(entityMappings);
+ this.initializeTableGenerators(entityMappings);
+ this.initializeSequenceGenerators(entityMappings);
+ this.initializeNamedQueries(entityMappings);
+ this.initializeNamedNativeQueries(entityMappings);
+ }
+
+ protected void initializePersistentTypes(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ this.initializeMappedSuperclasses(entityMappings);
+ this.initializeEntities(entityMappings);
+ this.initializeEmbeddables(entityMappings);
+ }
+
+ protected void initializeMappedSuperclasses(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ for (MappedSuperclass mappedSuperclass : entityMappings.getMappedSuperclasses()) {
+ XmlPersistentType xmlPersistentType = jpaFactory().createXmlPersistentType(this, IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
+ xmlPersistentType.initialize(mappedSuperclass);
+ this.persistentTypes.add(xmlPersistentType);
+ }
+ }
+
+ protected void initializeEntities(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ for (Entity entity : entityMappings.getEntities()) {
+ XmlPersistentType xmlPersistentType = jpaFactory().createXmlPersistentType(this, IMappingKeys.ENTITY_TYPE_MAPPING_KEY);
+ xmlPersistentType.initialize(entity);
+ this.persistentTypes.add(xmlPersistentType);
+ }
+ }
+
+ protected void initializeEmbeddables(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ for (Embeddable embeddable : entityMappings.getEmbeddables()) {
+ XmlPersistentType xmlPersistentType = jpaFactory().createXmlPersistentType(this, IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
+ xmlPersistentType.initialize(embeddable);
+ this.persistentTypes.add(xmlPersistentType);
+ }
+ }
+
+ protected void initializeTableGenerators(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ for (TableGenerator tableGenerator : entityMappings.getTableGenerators()) {
+ XmlTableGenerator xmlTableGenerator = new XmlTableGenerator(this);
+ xmlTableGenerator.initialize(tableGenerator);
+ this.tableGenerators.add(xmlTableGenerator);
+ }
+ }
+
+ protected void initializeSequenceGenerators(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ for (SequenceGenerator sequenceGenerator : entityMappings.getSequenceGenerators()) {
+ XmlSequenceGenerator xmlSequenceGenerator = new XmlSequenceGenerator(this);
+ xmlSequenceGenerator.initialize(sequenceGenerator);
+ this.sequenceGenerators.add(xmlSequenceGenerator);
+ }
+ }
+
+ protected void initializeNamedQueries(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ for (NamedQuery namedQuery : entityMappings.getNamedQueries()) {
+ this.namedQueries.add(createNamedQuery(namedQuery));
+ }
+ }
+
+ protected void initializeNamedNativeQueries(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ for (NamedNativeQuery namedNativeQuery : entityMappings.getNamedNativeQueries()) {
+ this.namedNativeQueries.add(createNamedNativeQuery(namedNativeQuery));
+ }
+ }
+
+ public void update(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ this.entityMappings = entityMappings;
+ this.setDescription(entityMappings.getDescription());
+ this.setPackage(entityMappings.getPackage());
+ this.setSpecifiedSchema(entityMappings.getSchema());
+ this.setSpecifiedCatalog(entityMappings.getCatalog());
+ this.setSpecifiedAccess(this.specifiedAccess(entityMappings));
+ this.persistenceUnitMetadata.update(entityMappings);
+ this.setDefaultAccess(persistenceUnit().getDefaultAccess());
+ this.setDefaultCatalog(persistenceUnit().getDefaultCatalog());
+ this.setDefaultSchema(persistenceUnit().getDefaultSchema());
+ this.updatePersistentTypes(entityMappings);
+ this.updateTableGenerators(entityMappings);
+ this.updateSequenceGenerators(entityMappings);
+ this.updateNamedQueries(entityMappings);
+ this.updateNamedNativeQueries(entityMappings);
+ }
+
+ protected AccessType specifiedAccess(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ return AccessType.fromXmlResourceModel(entityMappings.getAccess());
+ }
+
+ protected void updatePersistentTypes(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ ListIterator<XmlPersistentType> xmlPersistentTypes = this.xmlPersistentTypes();
+ this.updateMappedSuperclasses(entityMappings, xmlPersistentTypes);
+ this.updateEntities(entityMappings, xmlPersistentTypes);
+ this.updateEmbeddables(entityMappings, xmlPersistentTypes);
+
+ while (xmlPersistentTypes.hasNext()) {
+ this.removeXmlPersistentType(xmlPersistentTypes.next());
+ }
+ }
+
+ protected void updateMappedSuperclasses(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings, ListIterator<XmlPersistentType> xmlPersistentTypes) {
+ for (MappedSuperclass mappedSuperclass : entityMappings.getMappedSuperclasses()) {
+ if (xmlPersistentTypes.hasNext()) {
+ xmlPersistentTypes.next().update(mappedSuperclass);
+ }
+ else {
+ XmlPersistentType xmlPersistentType = jpaFactory().createXmlPersistentType(this, IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
+ xmlPersistentType.initialize(mappedSuperclass);
+ addXmlPersistentType(xmlPersistentType);
+ }
+ }
+ }
+
+ protected void updateEntities(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings, ListIterator<XmlPersistentType> xmlPersistentTypes) {
+ for (Entity entity : entityMappings.getEntities()) {
+ if (xmlPersistentTypes.hasNext()) {
+ xmlPersistentTypes.next().update(entity);
+ }
+ else {
+ XmlPersistentType xmlPersistentType = jpaFactory().createXmlPersistentType(this, IMappingKeys.ENTITY_TYPE_MAPPING_KEY);
+ xmlPersistentType.initialize(entity);
+ addXmlPersistentType(xmlPersistentType);
+ }
+ }
+ }
+
+ protected void updateEmbeddables(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings, ListIterator<XmlPersistentType> xmlPersistentTypes) {
+ for (Embeddable embeddable : entityMappings.getEmbeddables()) {
+ if (xmlPersistentTypes.hasNext()) {
+ xmlPersistentTypes.next().update(embeddable);
+ }
+ else {
+ XmlPersistentType xmlPersistentType = jpaFactory().createXmlPersistentType(this, IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
+ xmlPersistentType.initialize(embeddable);
+ addXmlPersistentType(xmlPersistentType);
+ }
+ }
+ }
+
+ protected void updateTableGenerators(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ ListIterator<XmlTableGenerator> tableGenerators = tableGenerators();
+ ListIterator<TableGenerator> resourceTableGenerators = entityMappings.getTableGenerators().listIterator();
+ while (tableGenerators.hasNext()) {
+ XmlTableGenerator tableGenerator = tableGenerators.next();
+ if (resourceTableGenerators.hasNext()) {
+ tableGenerator.update(resourceTableGenerators.next());
+ }
+ else {
+ removeTableGenerator(tableGenerator);
+ }
+ }
+
+ while (resourceTableGenerators.hasNext()) {
+ addTableGenerator(tableGeneratorsSize(), createTableGenerator(resourceTableGenerators.next()));
+ }
+ }
+
+ protected XmlTableGenerator createTableGenerator(TableGenerator tableGeneratorResource) {
+ XmlTableGenerator tableGenerator = new XmlTableGenerator(this);
+ tableGenerator.initialize(tableGeneratorResource);
+ return tableGenerator;
+ }
+
+ protected void updateSequenceGenerators(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ ListIterator<XmlSequenceGenerator> sequenceGenerators = sequenceGenerators();
+ ListIterator<SequenceGenerator> resourceSequenceGenerators = entityMappings.getSequenceGenerators().listIterator();
+ while (sequenceGenerators.hasNext()) {
+ XmlSequenceGenerator sequenceGenerator = sequenceGenerators.next();
+ if (resourceSequenceGenerators.hasNext()) {
+ sequenceGenerator.update(resourceSequenceGenerators.next());
+ }
+ else {
+ removeSequenceGenerator(sequenceGenerator);
+ }
+ }
+
+ while (resourceSequenceGenerators.hasNext()) {
+ addSequenceGenerator(sequenceGeneratorsSize(), createSequenceGenerator(resourceSequenceGenerators.next()));
+ }
+ }
+
+ protected XmlSequenceGenerator createSequenceGenerator(SequenceGenerator sequenceGeneratorResource) {
+ XmlSequenceGenerator sequenceGenerator = new XmlSequenceGenerator(this);
+ sequenceGenerator.initialize(sequenceGeneratorResource);
+ return sequenceGenerator;
+ }
+
+ protected void updateNamedQueries(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ ListIterator<XmlNamedQuery> namedQueries = namedQueries();
+ ListIterator<NamedQuery> resourceNamedQueries = entityMappings.getNamedQueries().listIterator();
+
+ while (namedQueries.hasNext()) {
+ XmlNamedQuery namedQuery = namedQueries.next();
+ if (resourceNamedQueries.hasNext()) {
+ namedQuery.update(resourceNamedQueries.next());
+ }
+ else {
+ removeNamedQuery(namedQuery);
+ }
+ }
+
+ while (resourceNamedQueries.hasNext()) {
+ addNamedQuery(namedQueriesSize(), createNamedQuery(resourceNamedQueries.next()));
+ }
+ }
+
+ protected XmlNamedQuery createNamedQuery(NamedQuery namedQuery) {
+ XmlNamedQuery xmlNamedQuery = new XmlNamedQuery(this);
+ xmlNamedQuery.initialize(namedQuery);
+ return xmlNamedQuery;
+ }
+
+ protected void updateNamedNativeQueries(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ ListIterator<XmlNamedNativeQuery> namedNativeQueries = namedNativeQueries();
+ ListIterator<NamedNativeQuery> resourceNamedNativeQueries = entityMappings.getNamedNativeQueries().listIterator();
+
+ while (namedNativeQueries.hasNext()) {
+ XmlNamedNativeQuery namedQuery = namedNativeQueries.next();
+ if (resourceNamedNativeQueries.hasNext()) {
+ namedQuery.update(resourceNamedNativeQueries.next());
+ }
+ else {
+ removeNamedNativeQuery(namedQuery);
+ }
+ }
+
+ while (resourceNamedNativeQueries.hasNext()) {
+ addNamedNativeQuery(namedQueriesSize(), createNamedNativeQuery(resourceNamedNativeQueries.next()));
+ }
+ }
+
+ protected XmlNamedNativeQuery createNamedNativeQuery(NamedNativeQuery namedQuery) {
+ XmlNamedNativeQuery xmlNamedNativeQuery = new XmlNamedNativeQuery(this);
+ xmlNamedNativeQuery.initialize(namedQuery);
+ return xmlNamedNativeQuery;
+ }
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/IXmlAttributeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/IXmlAttributeMappingProvider.java
new file mode 100644
index 0000000000..cd6e89f978
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/IXmlAttributeMappingProvider.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+
+public interface IXmlAttributeMappingProvider
+{
+ String key();
+
+ XmlAttributeMapping<? extends AttributeMapping> buildAttributeMapping(IJpaBaseContextFactory factory, XmlPersistentAttribute parent);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/IXmlColumnMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/IXmlColumnMapping.java
new file mode 100644
index 0000000000..d60f212904
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/IXmlColumnMapping.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.context.base.IColumnMapping;
+
+
+public interface IXmlColumnMapping extends IColumnMapping
+{
+
+ XmlColumn getColumn();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/IXmlTypeMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/IXmlTypeMappingProvider.java
new file mode 100644
index 0000000000..7bdb3e6847
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/IXmlTypeMappingProvider.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+
+
+public interface IXmlTypeMappingProvider
+{
+ String key();
+
+ XmlTypeMapping<? extends TypeMapping> buildTypeMapping(IJpaBaseContextFactory factory, XmlPersistentType parent);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmXml.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmXml.java
new file mode 100644
index 0000000000..4bb9078bdb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmXml.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.OrmResource;
+
+public interface OrmXml extends IJpaContextNode
+{
+ // **************** persistence *******************************************
+
+ /**
+ * String constant associated with changes to the entity-mappings property
+ */
+ public final static String ENTITY_MAPPINGS_PROPERTY = "entityMappingsProperty";
+
+ /**
+ * Return the content represented by the root of the orm.xml file.
+ * This may be null.
+ */
+ EntityMappings getEntityMappings();
+
+ /**
+ * Add a entity-mappings node to the orm.xml file and return the object
+ * representing it.
+ * Throws {@link IllegalStateException} if a entity-mappings node already exists.
+ */
+ EntityMappings addEntityMappings();
+
+ /**
+ * Remove the entity-mappings node from the orm.xml file.
+ * Throws {@link IllegalStateException} if a persistence node does not exist.
+ */
+ void removeEntityMappings();
+
+ PersistenceUnitDefaults persistenceUnitDefaults();
+
+ /**
+ * Return the XmlPersistentType listed in this mapping file
+ * with the given fullyQualifiedTypeName. Return null if non exists.
+ */
+ XmlPersistentType persistentTypeFor(String fullyQualifiedTypeName);
+
+ // **************** updating **********************************************
+
+ void initialize(OrmResource ormResource);
+
+ void update(OrmResource ormResource);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmXmlImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmXmlImpl.java
new file mode 100644
index 0000000000..09a1a88ff6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmXmlImpl.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IMappingFileRef;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.OrmResource;
+
+public class OrmXmlImpl extends JpaContextNode
+ implements OrmXml
+{
+ protected OrmResource ormResource;
+
+ protected EntityMappings entityMappings;
+
+
+ public OrmXmlImpl(IMappingFileRef parent) {
+ super(parent);
+ }
+
+ public XmlPersistentType persistentTypeFor(String fullyQualifiedTypeName) {
+ if (getEntityMappings() != null) {
+ return getEntityMappings().persistentTypeFor(fullyQualifiedTypeName);
+ }
+ return null;
+ }
+
+ @Override
+ public IResource resource() {
+ return ormResource.getFile();
+ }
+
+ // **************** persistence ********************************************
+
+ public EntityMappings getEntityMappings() {
+ return this.entityMappings;
+ }
+
+ protected void setEntityMappings(EntityMappings newEntityMappings) {
+ EntityMappings oldEntityMappings = this.entityMappings;
+ this.entityMappings = newEntityMappings;
+ firePropertyChanged(ENTITY_MAPPINGS_PROPERTY, oldEntityMappings, newEntityMappings);
+ }
+
+ public EntityMappings addEntityMappings() {
+ if (this.entityMappings != null) {
+ throw new IllegalStateException();
+ }
+
+ org.eclipse.jpt.core.internal.resource.orm.EntityMappings ormEntityMappings = OrmFactory.eINSTANCE.createEntityMappings();
+ this.entityMappings = createEntityMappings(ormEntityMappings);
+ this.ormResource.getContents().add(ormEntityMappings);
+ firePropertyChanged(ENTITY_MAPPINGS_PROPERTY, null, this.entityMappings);
+ return this.entityMappings;
+ }
+
+ public void removeEntityMappings() {
+ if (this.entityMappings == null) {
+ throw new IllegalStateException();
+ }
+
+ EntityMappings oldEntityMappings = this.entityMappings;
+ this.entityMappings = null;
+ org.eclipse.jpt.core.internal.resource.orm.EntityMappings ormEntityMappings = this.ormResource.getEntityMappings(); //TODO helper removeEntityMappings method on ormResource??
+ this.ormResource.getContents().remove(ormEntityMappings);
+ firePropertyChanged(ENTITY_MAPPINGS_PROPERTY, oldEntityMappings, null);
+ }
+
+ public PersistenceUnitDefaults persistenceUnitDefaults() {
+ if (getEntityMappings() != null) {
+ return getEntityMappings().persistenceUnitDefaults();
+ }
+ return null;
+ }
+ // **************** updating ***********************************************
+
+ public void initialize(OrmResource ormResource) {
+ this.ormResource = ormResource;
+ if (ormResource.getEntityMappings() != null) {
+ this.entityMappings = createEntityMappings(ormResource.getEntityMappings());
+ }
+ }
+
+ public void update(OrmResource ormResource) {
+ this.ormResource = ormResource;
+ if (ormResource.getEntityMappings() != null) {
+ if (this.entityMappings != null) {
+ this.entityMappings.update(ormResource.getEntityMappings());
+ }
+ else {
+ setEntityMappings(createEntityMappings(ormResource.getEntityMappings()));
+ }
+ ormResource.resourceModel().addRootContextNode(getEntityMappings());
+ }
+ else {
+ ormResource.resourceModel().removeRootContextNode(getEntityMappings());
+ setEntityMappings(null);
+ }
+ }
+
+ protected EntityMappings createEntityMappings(org.eclipse.jpt.core.internal.resource.orm.EntityMappings ormEntityMappings) {
+ EntityMappings entityMappings = jpaFactory().createEntityMappings(this);
+ entityMappings.initialize(ormEntityMappings);
+ return entityMappings;
+ }
+
+
+ // *************************************************************************
+
+ public ITextRange validationTextRange() {
+ return ITextRange.Empty.instance();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/PersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/PersistenceUnitDefaults.java
new file mode 100644
index 0000000000..57f4d71ad7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/PersistenceUnitDefaults.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+
+
+public interface PersistenceUnitDefaults extends IJpaContextNode
+{
+
+ String getSchema();
+ void setSchema(String value);
+ String SCHEMA_PROPERTY = "schemaProperty";
+
+ String getCatalog();
+ void setCatalog(String value);
+ String CATALOG_PROPERTY = "catalogProperty";
+
+ AccessType getAccess();
+ void setAccess(AccessType value);
+ String ACCESS_PROPERTY = "accessProperty";
+
+ boolean isCascadePersist();
+
+ void setCascadePersist(boolean value);
+ String CASCADE_PERSIST_PROPERTY = "cascadePersistProperty";
+
+ void initialize(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings);
+
+ void update(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/PersistenceUnitDefaultsImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/PersistenceUnitDefaultsImpl.java
new file mode 100644
index 0000000000..cd8a3c32db
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/PersistenceUnitDefaultsImpl.java
@@ -0,0 +1,207 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+
+public class PersistenceUnitDefaultsImpl extends JpaContextNode
+ implements PersistenceUnitDefaults
+{
+ protected String schema;
+
+ protected String catalog;
+
+ protected AccessType access;
+
+ protected boolean cascadePersist;
+
+ protected org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings;
+
+ public PersistenceUnitDefaultsImpl(PersistenceUnitMetadata parent) {
+ super(parent);
+ }
+
+ public AccessType getAccess() {
+ return this.access;
+ }
+
+ public void setAccess(AccessType newAccess) {
+ AccessType oldAccess = this.access;
+ this.access = newAccess;
+ if (oldAccess != newAccess) {
+ if (this.persistenceUnitDefaults() != null) {
+ this.persistenceUnitDefaults().setAccess(AccessType.toXmlResourceModel(newAccess));
+ if (this.persistenceUnitDefaults().isAllFeaturesUnset()) {
+ this.persistenceUnitMetadata().setPersistenceUnitDefaults(null);
+ if (this.persistenceUnitMetadata().isAllFeaturesUnset()) {
+ this.entityMappings.setPersistenceUnitMetadata(null);
+ }
+ }
+ }
+ else {
+ if (persistenceUnitMetadata() == null) {
+ this.entityMappings.setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ }
+ persistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createPersistenceUnitDefaults());
+ persistenceUnitDefaults().setAccess(AccessType.toXmlResourceModel(newAccess));
+ }
+ }
+ firePropertyChanged(PersistenceUnitDefaults.ACCESS_PROPERTY, oldAccess, newAccess);
+ }
+
+ protected void setAccess_(AccessType newAccess) {
+ AccessType oldAccess = this.access;
+ this.access = newAccess;
+ firePropertyChanged(PersistenceUnitDefaults.ACCESS_PROPERTY, oldAccess, newAccess);
+ }
+
+ public String getCatalog() {
+ return this.catalog;
+ }
+
+ public void setCatalog(String newCatalog) {
+ String oldCatalog = this.catalog;
+ this.catalog = newCatalog;
+ if (oldCatalog != newCatalog) {
+ if (this.persistenceUnitDefaults() != null) {
+ this.persistenceUnitDefaults().setCatalog(newCatalog);
+ if (this.persistenceUnitDefaults().isAllFeaturesUnset()) {
+ this.persistenceUnitMetadata().setPersistenceUnitDefaults(null);
+ if (this.persistenceUnitMetadata().isAllFeaturesUnset()) {
+ this.entityMappings.setPersistenceUnitMetadata(null);
+ }
+ }
+ }
+ else {
+ if (persistenceUnitMetadata() == null) {
+ this.entityMappings.setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ }
+ persistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createPersistenceUnitDefaults());
+ persistenceUnitDefaults().setCatalog(newCatalog);
+ }
+ }
+ firePropertyChanged(PersistenceUnitDefaults.CATALOG_PROPERTY, oldCatalog, newCatalog);
+ }
+
+ protected void setCatalog_(String newCatalog) {
+ String oldCatalog = this.catalog;
+ this.catalog = newCatalog;
+ firePropertyChanged(PersistenceUnitDefaults.CATALOG_PROPERTY, oldCatalog, newCatalog);
+ }
+
+ public String getSchema() {
+ return this.schema;
+ }
+
+ public void setSchema(String newSchema) {
+ String oldSchema = this.schema;
+ this.schema = newSchema;
+ if (oldSchema != newSchema) {
+ if (this.persistenceUnitDefaults() != null) {
+ this.persistenceUnitDefaults().setSchema(newSchema);
+ if (this.persistenceUnitDefaults().isAllFeaturesUnset()) {
+ this.persistenceUnitMetadata().setPersistenceUnitDefaults(null);
+ if (this.persistenceUnitMetadata().isAllFeaturesUnset()) {
+ this.entityMappings.setPersistenceUnitMetadata(null);
+ }
+ }
+ }
+ else {
+ if (persistenceUnitMetadata() == null) {
+ this.entityMappings.setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ }
+ persistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createPersistenceUnitDefaults());
+ persistenceUnitDefaults().setSchema(newSchema);
+ }
+ }
+ firePropertyChanged(PersistenceUnitDefaults.SCHEMA_PROPERTY, oldSchema, newSchema);
+ }
+
+ protected void setSchema_(String newSchema) {
+ String oldSchema = this.schema;
+ this.schema = newSchema;
+ firePropertyChanged(PersistenceUnitDefaults.SCHEMA_PROPERTY, oldSchema, newSchema);
+ }
+
+ public boolean isCascadePersist() {
+ return this.cascadePersist;
+ }
+
+ public void setCascadePersist(boolean newCascadePersist) {
+ boolean oldCascadePersist = this.cascadePersist;
+ this.cascadePersist = newCascadePersist;
+ if (oldCascadePersist != newCascadePersist) {
+ if (this.persistenceUnitDefaults() != null) {
+ this.persistenceUnitDefaults().setCascadePersist(newCascadePersist);
+ if (this.persistenceUnitDefaults().isAllFeaturesUnset()) {
+ this.persistenceUnitMetadata().setPersistenceUnitDefaults(null);
+ if (this.persistenceUnitMetadata().isAllFeaturesUnset()) {
+ this.entityMappings.setPersistenceUnitMetadata(null);
+ }
+ }
+ }
+ else if (newCascadePersist) {
+ if (persistenceUnitMetadata() == null) {
+ this.entityMappings.setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ }
+ persistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createPersistenceUnitDefaults());
+ persistenceUnitDefaults().setCascadePersist(newCascadePersist);
+ }
+ }
+ firePropertyChanged(PersistenceUnitDefaults.CASCADE_PERSIST_PROPERTY, oldCascadePersist, newCascadePersist);
+ }
+
+ protected void setCascadePersist_(boolean newCascadePersist) {
+ boolean oldCascadePersist = this.cascadePersist;
+ this.cascadePersist = newCascadePersist;
+ firePropertyChanged(PersistenceUnitDefaults.CASCADE_PERSIST_PROPERTY, oldCascadePersist, newCascadePersist);
+ }
+
+ public void initialize(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ this.entityMappings = entityMappings;
+ if (this.persistenceUnitDefaults() != null) {
+ this.access = AccessType.fromXmlResourceModel(this.persistenceUnitDefaults().getAccess());
+ this.cascadePersist = this.persistenceUnitDefaults().isCascadePersist();
+ this.catalog = this.persistenceUnitDefaults().getCatalog();
+ this.schema = this.persistenceUnitDefaults().getSchema();
+ }
+ }
+
+
+ public void update(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ this.entityMappings = entityMappings;
+ if (this.persistenceUnitDefaults() != null) {
+ this.setAccess_(AccessType.fromXmlResourceModel(this.persistenceUnitDefaults().getAccess()));
+ this.setCascadePersist_(this.persistenceUnitDefaults().isCascadePersist());
+ this.setCatalog_(this.persistenceUnitDefaults().getCatalog());
+ this.setSchema_(this.persistenceUnitDefaults().getSchema());
+ }
+ else {
+ this.setAccess_(null);
+ this.setCascadePersist_(false);
+ this.setCatalog_(null);
+ this.setSchema_(null);
+ }
+ }
+
+ protected org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults persistenceUnitDefaults() {
+ if (persistenceUnitMetadata() != null) {
+ return persistenceUnitMetadata().getPersistenceUnitDefaults();
+ }
+ return null;
+ }
+
+ protected org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata persistenceUnitMetadata() {
+ return this.entityMappings.getPersistenceUnitMetadata();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/PersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/PersistenceUnitMetadata.java
new file mode 100644
index 0000000000..519756ef7c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/PersistenceUnitMetadata.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+
+public interface PersistenceUnitMetadata extends IJpaContextNode
+{
+ boolean isXmlMappingMetadataComplete();
+ void setXmlMappingMetadataComplete(boolean value);
+ String XML_MAPPING_METADATA_COMPLETE_PROPERTY = "xmlMappingMetadataCompleteProperty";
+
+ PersistenceUnitDefaults getPersistenceUnitDefaults();
+
+ void initialize(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings);
+
+ void update(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/PersistenceUnitMetadataImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/PersistenceUnitMetadataImpl.java
new file mode 100644
index 0000000000..c9217c7884
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/PersistenceUnitMetadataImpl.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+
+public class PersistenceUnitMetadataImpl extends JpaContextNode
+ implements PersistenceUnitMetadata
+{
+ protected boolean xmlMappingMetadataComplete;
+
+ protected final PersistenceUnitDefaults persistenceUnitDefaults;
+
+ protected org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings;
+
+ public PersistenceUnitMetadataImpl(EntityMappings parent) {
+ super(parent);
+ this.persistenceUnitDefaults = jpaFactory().createPersistenceUnitDefaults(this);
+ }
+
+ public boolean isXmlMappingMetadataComplete() {
+ return this.xmlMappingMetadataComplete;
+ }
+
+ public void setXmlMappingMetadataComplete(boolean newXmlMappingMetadataComplete) {
+ boolean oldXmlMappingMetadataComplete = this.xmlMappingMetadataComplete;
+ this.xmlMappingMetadataComplete = newXmlMappingMetadataComplete;
+ if (oldXmlMappingMetadataComplete != newXmlMappingMetadataComplete) {
+ if (this.persistenceUnitMetadata() != null) {
+ this.persistenceUnitMetadata().setXmlMappingMetadataComplete(newXmlMappingMetadataComplete);
+ if (this.persistenceUnitMetadata().isAllFeaturesUnset()) {
+ this.entityMappings.setPersistenceUnitMetadata(null);
+ }
+ }
+ else if (newXmlMappingMetadataComplete) {
+ this.entityMappings.setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ this.persistenceUnitMetadata().setXmlMappingMetadataComplete(newXmlMappingMetadataComplete);
+ }
+ }
+ firePropertyChanged(PersistenceUnitMetadata.XML_MAPPING_METADATA_COMPLETE_PROPERTY, oldXmlMappingMetadataComplete, newXmlMappingMetadataComplete);
+ }
+
+ protected void setXmlMappingMetadataComplete_(boolean newXmlMappingMetadataComplete) {
+ boolean oldXmlMappingMetadataComplete = this.xmlMappingMetadataComplete;
+ this.xmlMappingMetadataComplete = newXmlMappingMetadataComplete;
+ firePropertyChanged(PersistenceUnitMetadata.XML_MAPPING_METADATA_COMPLETE_PROPERTY, oldXmlMappingMetadataComplete, newXmlMappingMetadataComplete);
+ }
+
+ public PersistenceUnitDefaults getPersistenceUnitDefaults() {
+ return this.persistenceUnitDefaults;
+ }
+
+ public void initialize(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ this.entityMappings = entityMappings;
+ if (this.persistenceUnitMetadata() != null) {
+ this.xmlMappingMetadataComplete = this.persistenceUnitMetadata().isXmlMappingMetadataComplete();
+ }
+ this.persistenceUnitDefaults.initialize(entityMappings);
+ }
+
+ public void update(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ this.entityMappings = entityMappings;
+ if (this.persistenceUnitMetadata() != null) {
+ setXmlMappingMetadataComplete_(this.persistenceUnitMetadata().isXmlMappingMetadataComplete());
+ }
+ else {
+ setXmlMappingMetadataComplete_(false);
+ }
+ this.persistenceUnitDefaults.update(entityMappings);
+ }
+
+ protected org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata persistenceUnitMetadata() {
+ return this.entityMappings.getPersistenceUnitMetadata();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlAssociationOverride.java
new file mode 100644
index 0000000000..9e6d55bebe
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlAssociationOverride.java
@@ -0,0 +1,235 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.context.orm;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IAssociationOverride;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.IOverride;
+import org.eclipse.jpt.core.internal.context.base.IRelationshipMapping;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.AssociationOverride;
+import org.eclipse.jpt.core.internal.resource.orm.JoinColumn;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+public class XmlAssociationOverride extends JpaContextNode
+ implements IAssociationOverride
+{
+
+ protected String name;
+
+ protected final List<XmlJoinColumn> specifiedJoinColumns;
+
+ protected final List<XmlJoinColumn> defaultJoinColumns;
+
+ private final Owner owner;
+
+ protected AssociationOverride associationOverride;
+
+
+ protected XmlAssociationOverride(IJpaContextNode parent, IOverride.Owner owner) {
+ super(parent);
+ this.owner = owner;
+ this.specifiedJoinColumns = new ArrayList<XmlJoinColumn>();
+ this.defaultJoinColumns = new ArrayList<XmlJoinColumn>();
+ }
+
+ // ********** IAssociationOverride implementation **********
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.associationOverride.setName(newName);
+ firePropertyChanged(IOverride.NAME_PROPERTY, oldName, newName);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlJoinColumn> joinColumns() {
+ return this.specifiedJoinColumns.isEmpty() ? this.defaultJoinColumns() : this.specifiedJoinColumns();
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlJoinColumn> defaultJoinColumns() {
+ return new CloneListIterator<XmlJoinColumn>(this.defaultJoinColumns);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlJoinColumn> specifiedJoinColumns() {
+ return new CloneListIterator<XmlJoinColumn>(this.specifiedJoinColumns);
+ }
+
+ public int specifiedJoinColumnsSize() {
+ return this.specifiedJoinColumns.size();
+ }
+
+ public XmlJoinColumn addSpecifiedJoinColumn(int index) {
+ XmlJoinColumn joinColumn = new XmlJoinColumn(this, createJoinColumnOwner());
+ this.specifiedJoinColumns.add(index, joinColumn);
+ this.associationOverride.getJoinColumns().add(index, OrmFactory.eINSTANCE.createJoinColumnImpl());
+ this.fireItemAdded(IAssociationOverride.SPECIFIED_JOIN_COLUMNS_LIST, index, joinColumn);
+ return joinColumn;
+ }
+
+ protected IJoinColumn.Owner createJoinColumnOwner() {
+ return new JoinColumnOwner();
+ }
+
+ protected void addSpecifiedJoinColumn(int index, XmlJoinColumn joinColumn) {
+ addItemToList(index, joinColumn, this.specifiedJoinColumns, IAssociationOverride.SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public void removeSpecifiedJoinColumn(int index) {
+ XmlJoinColumn removedJoinColumn = this.specifiedJoinColumns.remove(index);
+ this.associationOverride.getJoinColumns().remove(index);
+ fireItemRemoved(IEntity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, removedJoinColumn);
+ }
+
+ protected void removeSpecifiedJoinColumn(XmlJoinColumn joinColumn) {
+ removeItemFromList(joinColumn, this.specifiedJoinColumns, IAssociationOverride.SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
+ this.associationOverride.getJoinColumns().move(targetIndex, sourceIndex);
+ moveItemInList(targetIndex, sourceIndex, this.specifiedJoinColumns, IAssociationOverride.SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public boolean containsSpecifiedJoinColumns() {
+ return !this.specifiedJoinColumns.isEmpty();
+ }
+
+ public boolean isVirtual() {
+ return this.owner.isVirtual(this);
+ }
+
+
+ public void initialize(AssociationOverride associationOverride) {
+ this.associationOverride = associationOverride;
+ this.name = associationOverride.getName();
+ initializeSpecifiedJoinColumns(associationOverride);
+ }
+
+ protected void initializeSpecifiedJoinColumns(AssociationOverride associationOverride) {
+ for (JoinColumn joinColumn : associationOverride.getJoinColumns()) {
+ this.specifiedJoinColumns.add(createJoinColumn(joinColumn));
+ }
+ }
+
+ public void update(AssociationOverride associationOverride) {
+ this.associationOverride = associationOverride;
+ this.setName(associationOverride.getName());
+ updateSpecifiedJoinColumns(associationOverride);
+ }
+
+ protected void updateSpecifiedJoinColumns(AssociationOverride associationOverride) {
+ ListIterator<XmlJoinColumn> joinColumns = specifiedJoinColumns();
+ ListIterator<JoinColumn> resourceJoinColumns = associationOverride.getJoinColumns().listIterator();
+
+ while (joinColumns.hasNext()) {
+ XmlJoinColumn joinColumn = joinColumns.next();
+ if (resourceJoinColumns.hasNext()) {
+ joinColumn.update(resourceJoinColumns.next());
+ }
+ else {
+ removeSpecifiedJoinColumn(joinColumn);
+ }
+ }
+
+ while (resourceJoinColumns.hasNext()) {
+ addSpecifiedJoinColumn(specifiedJoinColumnsSize(), createJoinColumn(resourceJoinColumns.next()));
+ }
+ }
+
+ protected XmlJoinColumn createJoinColumn(JoinColumn joinColumn) {
+ XmlJoinColumn xmlJoinColumn = new XmlJoinColumn(this, new JoinColumnOwner());
+ xmlJoinColumn.initialize(joinColumn);
+ return xmlJoinColumn;
+ }
+
+ public class JoinColumnOwner implements IJoinColumn.Owner
+ {
+
+ public JoinColumnOwner() {
+ super();
+ }
+
+ /**
+ * by default, the join column is in the type mapping's primary table
+ */
+ public String defaultTableName() {
+ return XmlAssociationOverride.this.owner.typeMapping().getTableName();
+ }
+
+ public String defaultColumnName() {
+ return null;
+ }
+
+ public IEntity targetEntity() {
+ return relationshipMapping().getResolvedTargetEntity();
+ }
+
+ public String attributeName() {
+ return XmlAssociationOverride.this.getName();
+ }
+
+ public IRelationshipMapping relationshipMapping() {
+ //TODO this isn't going to work, classCastException
+ return (IRelationshipMapping) XmlAssociationOverride.this.owner.columnMapping(XmlAssociationOverride.this.getName());
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return typeMapping().tableNameIsInvalid(tableName);
+ }
+
+ /**
+ * the join column can be on a secondary table
+ */
+ public boolean tableIsAllowed() {
+ return true;
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ITypeMapping typeMapping() {
+ return XmlAssociationOverride.this.owner.typeMapping();
+ }
+
+ public Table dbTable(String tableName) {
+ return typeMapping().dbTable(tableName);
+ }
+
+ public Table dbReferencedColumnTable() {
+ IEntity targetEntity = targetEntity();
+ return (targetEntity == null) ? null : targetEntity().primaryDbTable();
+ }
+
+ public boolean isVirtual(IAbstractJoinColumn joinColumn) {
+ return XmlAssociationOverride.this.defaultJoinColumns.contains(joinColumn);
+ }
+
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlAttributeMapping.java
new file mode 100644
index 0000000000..c3a220c888
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlAttributeMapping.java
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping;
+import org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping;
+import org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping;
+
+
+public abstract class XmlAttributeMapping<T extends AttributeMapping> extends JpaContextNode
+ implements IAttributeMapping
+{
+ protected String name;
+ public static final String NAME_PROPERTY = "nameProperty";
+
+ protected T attributeMapping;
+
+ protected IJavaPersistentAttribute javaPersistentAttribute;
+ public static final String JAVA_PERSISTENT_ATTRIBUTE_PROPERTY = "javaPersistentAttributeProperty";
+
+ protected XmlAttributeMapping(XmlPersistentAttribute parent) {
+ super(parent);
+ }
+
+ public IJavaPersistentAttribute getJavaPersistentAttribute() {
+ return this.javaPersistentAttribute;
+ }
+
+ protected void setJavaPersistentAttribute(IJavaPersistentAttribute newJavaPersistentAttribute) {
+ IJavaPersistentAttribute oldJavaPersistentAttribute = this.javaPersistentAttribute;
+ this.javaPersistentAttribute = newJavaPersistentAttribute;
+ firePropertyChanged(JAVA_PERSISTENT_ATTRIBUTE_PROPERTY, oldJavaPersistentAttribute, newJavaPersistentAttribute);
+
+ }
+
+// protected INamedColumn.Owner buildOwner() {
+// return new ColumnOwner();
+// }
+//
+// @Override
+// protected void addInsignificantFeatureIdsTo(Set<Integer> insignificantFeatureIds) {
+// super.addInsignificantFeatureIdsTo(insignificantFeatureIds);
+// insignificantFeatureIds.add(OrmPackage.XML_ATTRIBUTE_MAPPING__PERSISTENT_ATTRIBUTE);
+// }
+//
+// public XmlPersistentType getPersistentType() {
+// return (XmlPersistentType) eContainer();
+// }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.attributeMapping.setName(newName);
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ persistentAttribute().nameChanged(oldName, newName);
+ }
+
+ protected void setName_(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ persistentAttribute().nameChanged(oldName, newName);
+ }
+
+ public XmlPersistentAttribute persistentAttribute() {
+ return (XmlPersistentAttribute) parent();
+ }
+
+ public String attributeName() {
+ return this.persistentAttribute().getName();
+ }
+
+ public boolean isDefault() {
+ return false;
+ }
+
+
+ /**
+ * IMPORTANT: See XmlAttributeMapping class comment.
+ * Subclasses should override this method to call the
+ * appropriate initializeFrom___Mapping() method.
+ */
+ protected abstract void initializeOn(XmlAttributeMapping<? extends AttributeMapping> newMapping);
+
+ public void initializeFromXmlAttributeMapping(XmlAttributeMapping<? extends AttributeMapping> oldMapping) {}
+
+ public void initializeFromXmlBasicMapping(XmlBasicMapping oldMapping) {
+ initializeFromXmlAttributeMapping(oldMapping);
+ }
+
+ public void initializeFromXmlIdMapping(XmlIdMapping oldMapping) {
+ initializeFromXmlAttributeMapping(oldMapping);
+ }
+
+ public void initializeFromXmlTransientMapping(XmlTransientMapping oldMapping) {
+ initializeFromXmlAttributeMapping(oldMapping);
+ }
+
+ public void initializeFromXmlEmbeddedMapping(XmlEmbeddedMapping oldMapping) {
+ initializeFromXmlAttributeMapping(oldMapping);
+ }
+
+ public void initializeFromXmlEmbeddedIdMapping(XmlEmbeddedIdMapping oldMapping) {
+ initializeFromXmlAttributeMapping(oldMapping);
+ }
+
+ public void initializeFromXmlVersionMapping(XmlVersionMapping oldMapping) {
+ initializeFromXmlAttributeMapping(oldMapping);
+ }
+
+ public void initializeFromXmlRelationshipMapping(XmlRelationshipMapping<? extends RelationshipMapping> oldMapping) {
+ initializeFromXmlAttributeMapping(oldMapping);
+ }
+
+ public void initializeFromXmlMulitRelationshipMapping(XmlMultiRelationshipMapping<? extends MultiRelationshipMapping> oldMapping) {
+ initializeFromXmlRelationshipMapping(oldMapping);
+ }
+
+ public void initializeFromXmlSingleRelationshipMapping(XmlSingleRelationshipMapping<? extends SingleRelationshipMapping> oldMapping) {
+ initializeFromXmlRelationshipMapping(oldMapping);
+ }
+
+ public void initializeFromXmlOneToManyMapping(XmlOneToManyMapping oldMapping) {
+ initializeFromXmlMulitRelationshipMapping(oldMapping);
+ }
+
+ public void initializeFromXmlManyToOneMapping(XmlManyToOneMapping oldMapping) {
+ initializeFromXmlSingleRelationshipMapping(oldMapping);
+ }
+
+ public void initializeFromXmlOneToOneMapping(XmlOneToOneMapping oldMapping) {
+ initializeFromXmlSingleRelationshipMapping(oldMapping);
+ }
+
+ public void initializeFromXmlManyToManyMapping(XmlManyToManyMapping oldMapping) {
+ initializeFromXmlMulitRelationshipMapping(oldMapping);
+ }
+
+// public IJpaContentNode getContentNode(int offset) {
+// return getPersistentAttribute();
+// }
+
+ /**
+ * Attributes are a sequence in the orm schema. We must keep
+ * the list of attributes in the appropriate order so the wtp xml
+ * translators will write them to the xml in that order and they
+ * will adhere to the schema.
+ *
+ * Each concrete subclass of XmlAttributeMapping must implement this
+ * method and return an int that matches it's order in the schema
+ * @return
+ */
+ public abstract int xmlSequence();
+
+// public void refreshDefaults(DefaultsContext defaultsContext) {
+// // do nothing
+// }
+
+ public String primaryKeyColumnName() {
+ return null;
+ }
+
+ public XmlTypeMapping<?> typeMapping() {
+ return this.persistentAttribute().typeMapping();
+ }
+
+// @Override
+// public ITextRange validationTextRange() {
+// return (this.isVirtual()) ? this.getPersistentType().attributesTextRange() : super.validationTextRange();
+// }
+//
+// public ITextRange nameTextRange() {
+// IDOMNode nameNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.NAME);
+// return (nameNode != null) ? this.buildTextRange(nameNode) : this.validationTextRange();
+// }
+
+ public boolean isOverridableAttributeMapping() {
+ return false;
+ }
+
+ public boolean isOverridableAssociationMapping() {
+ return false;
+ }
+
+ public boolean isIdMapping() {
+ return false;
+ }
+ public abstract void removeFromResourceModel(org.eclipse.jpt.core.internal.resource.orm.TypeMapping typeMapping);
+
+ public abstract T addToResourceModel(org.eclipse.jpt.core.internal.resource.orm.TypeMapping typeMapping);
+
+ protected T attributeMapping() {
+ return this.attributeMapping;
+ }
+
+ public void initialize(T attributeMapping) {
+ this.attributeMapping = attributeMapping;
+ this.name = attributeMapping.getName();
+ this.javaPersistentAttribute = javaPersistentAttribute();
+ }
+
+ public void update(T attributeMapping) {
+ this.attributeMapping = attributeMapping;
+ this.setName_(attributeMapping.getName());
+ this.setJavaPersistentAttribute(javaPersistentAttribute());
+ }
+
+ protected IJavaPersistentAttribute javaPersistentAttribute() {
+ IJavaPersistentType javaPersistentType = persistentAttribute().persistentType().javaPersistentType();
+ if (javaPersistentType != null && getName() != null) {
+ return javaPersistentType.attributeNamed(getName());
+ }
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlAttributeOverride.java
new file mode 100644
index 0000000000..05c53a430b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlAttributeOverride.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAttributeOverride;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.IOverride;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeOverride;
+import org.eclipse.jpt.db.internal.Table;
+
+
+public class XmlAttributeOverride extends JpaContextNode
+ implements IAttributeOverride
+{
+
+ protected String name;
+
+ private final Owner owner;
+
+ protected AttributeOverride attributeOverride;
+
+
+ protected final XmlColumn column;
+
+ protected XmlAttributeOverride(IJpaContextNode parent, IOverride.Owner owner) {
+ super(parent);
+ this.owner = owner;
+ this.column = new XmlColumn(this, this);
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.attributeOverride.setName(newName);
+ firePropertyChanged(IOverride.NAME_PROPERTY, oldName, newName);
+ }
+
+ protected void setName_(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ firePropertyChanged(IOverride.NAME_PROPERTY, oldName, newName);
+ }
+
+ public XmlColumn getColumn() {
+ return this.column;
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ITypeMapping typeMapping() {
+ return getOwner().typeMapping();
+ }
+
+ public Table dbTable(String tablename) {
+ return this.typeMapping().dbTable(getColumn().getTable());
+ }
+
+ public String defaultColumnName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String defaultTableName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isVirtual() {
+ return getOwner().isVirtual(this);
+ }
+
+// @Override
+// public ITextRange validationTextRange() {
+// if (node == null) {
+// return getOwner().validationTextRange();
+// }
+// return super.validationTextRange();
+// }
+
+ public Owner getOwner() {
+ return this.owner;
+ }
+
+ public void initialize(AttributeOverride attributeOverride) {
+ this.attributeOverride = attributeOverride;
+ this.name = attributeOverride.getName();
+ this.column.initialize(attributeOverride.getColumn());
+ }
+
+ public void update(AttributeOverride attributeOverride) {
+ this.attributeOverride = attributeOverride;
+ this.setName_(attributeOverride.getName());
+ this.column.update(attributeOverride.getColumn());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlBasicMapping.java
new file mode 100644
index 0000000000..9b641d5fe9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlBasicMapping.java
@@ -0,0 +1,261 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.EnumType;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IColumnMapping;
+import org.eclipse.jpt.core.internal.context.base.IFetchable;
+import org.eclipse.jpt.core.internal.context.base.INullable;
+import org.eclipse.jpt.core.internal.context.base.TemporalType;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.Basic;
+import org.eclipse.jpt.core.internal.resource.orm.BasicImpl;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+import org.eclipse.jpt.db.internal.Table;
+
+
+public class XmlBasicMapping extends XmlAttributeMapping<Basic>
+ implements IBasicMapping, IXmlColumnMapping
+{
+ protected final XmlColumn column;
+
+ protected FetchType specifiedFetch;
+
+ protected Boolean specifiedOptional;
+
+ protected EnumType specifiedEnumerated;
+
+ protected TemporalType temporal;
+
+ protected boolean lob;
+
+ protected XmlBasicMapping(XmlPersistentAttribute parent) {
+ super(parent);
+ this.column = new XmlColumn(this, this);
+ }
+
+ public FetchType getFetch() {
+ return (this.getSpecifiedFetch() == null) ? this.getDefaultFetch() : this.getSpecifiedFetch();
+ }
+
+ public FetchType getDefaultFetch() {
+ return IBasicMapping.DEFAULT_FETCH_TYPE;
+ }
+
+ public FetchType getSpecifiedFetch() {
+ return this.specifiedFetch;
+ }
+
+ public void setSpecifiedFetch(FetchType newSpecifiedFetch) {
+ FetchType oldFetch = this.specifiedFetch;
+ this.specifiedFetch = newSpecifiedFetch;
+ this.attributeMapping().setFetch(FetchType.toOrmResourceModel(newSpecifiedFetch));
+ firePropertyChanged(IFetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch);
+ }
+
+ protected void setSpecifiedFetch_(FetchType newSpecifiedFetch) {
+ FetchType oldFetch = this.specifiedFetch;
+ this.specifiedFetch = newSpecifiedFetch;
+ firePropertyChanged(IFetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch);
+ }
+
+ public Boolean getOptional() {
+ return (this.getSpecifiedOptional() == null) ? this.getDefaultOptional() : this.getSpecifiedOptional();
+ }
+
+ public Boolean getDefaultOptional() {
+ return INullable.DEFAULT_OPTIONAL;
+ }
+
+ public Boolean getSpecifiedOptional() {
+ return this.specifiedOptional;
+ }
+
+ public void setSpecifiedOptional(Boolean newSpecifiedOptional) {
+ Boolean oldOptional = this.specifiedOptional;
+ this.specifiedOptional = newSpecifiedOptional;
+ this.attributeMapping().setOptional(newSpecifiedOptional);
+ firePropertyChanged(INullable.SPECIFIED_OPTIONAL_PROPERTY, oldOptional, newSpecifiedOptional);
+ }
+
+ protected void setSpecifiedOptional_(Boolean newSpecifiedOptional) {
+ Boolean oldOptional = this.specifiedOptional;
+ this.specifiedOptional = newSpecifiedOptional;
+ firePropertyChanged(INullable.SPECIFIED_OPTIONAL_PROPERTY, oldOptional, newSpecifiedOptional);
+ }
+
+ public boolean isLob() {
+ return this.lob;
+ }
+
+ public void setLob(boolean newLob) {
+ boolean oldLob = this.lob;
+ this.lob = newLob;
+ this.attributeMapping().setLob(newLob);
+ firePropertyChanged(IBasicMapping.LOB_PROPERTY, oldLob, newLob);
+ }
+
+ protected void setLob_(boolean newLob) {
+ boolean oldLob = this.lob;
+ this.lob = newLob;
+ firePropertyChanged(IBasicMapping.LOB_PROPERTY, oldLob, newLob);
+ }
+
+ public TemporalType getTemporal() {
+ return this.temporal;
+ }
+
+ public void setTemporal(TemporalType newTemporal) {
+ TemporalType oldTemporal = this.temporal;
+ this.temporal = newTemporal;
+ this.attributeMapping().setTemporal(TemporalType.toOrmResourceModel(newTemporal));
+ firePropertyChanged(IColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+ }
+
+ protected void setTemporal_(TemporalType newTemporal) {
+ TemporalType oldTemporal = this.temporal;
+ this.temporal = newTemporal;
+ firePropertyChanged(IColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+ }
+
+ public EnumType getEnumerated() {
+ return (this.getSpecifiedEnumerated() == null) ? this.getDefaultEnumerated() : this.getSpecifiedEnumerated();
+ }
+
+ public EnumType getDefaultEnumerated() {
+ return IBasicMapping.DEFAULT_ENUMERATED;
+ }
+
+ public EnumType getSpecifiedEnumerated() {
+ return this.specifiedEnumerated;
+ }
+
+ public void setSpecifiedEnumerated(EnumType newSpecifiedEnumerated) {
+ EnumType oldEnumerated = this.specifiedEnumerated;
+ this.specifiedEnumerated = newSpecifiedEnumerated;
+ this.attributeMapping().setEnumerated(EnumType.toOrmResourceModel(newSpecifiedEnumerated));
+ firePropertyChanged(IBasicMapping.SPECIFIED_ENUMERATED_PROPERTY, oldEnumerated, newSpecifiedEnumerated);
+ }
+
+ protected void setSpecifiedEnumerated_(EnumType newSpecifiedEnumerated) {
+ EnumType oldEnumerated = this.specifiedEnumerated;
+ this.specifiedEnumerated = newSpecifiedEnumerated;
+ firePropertyChanged(IBasicMapping.SPECIFIED_ENUMERATED_PROPERTY, oldEnumerated, newSpecifiedEnumerated);
+ }
+
+ public String getKey() {
+ return IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected void initializeOn(XmlAttributeMapping<? extends AttributeMapping> newMapping) {
+ newMapping.initializeFromXmlBasicMapping(this);
+ }
+
+ @Override
+ public void initializeFromXmlIdMapping(XmlIdMapping oldMapping) {
+ super.initializeFromXmlIdMapping(oldMapping);
+ setTemporal(oldMapping.getTemporal());
+ }
+
+ @Override
+ public int xmlSequence() {
+ return 1;
+ }
+
+ @Override
+ public boolean isOverridableAttributeMapping() {
+ return true;
+ }
+
+ public XmlColumn getColumn() {
+ return this.column;
+ }
+
+ public String defaultColumnName() {
+ return attributeName();
+ }
+
+ public String defaultTableName() {
+ return typeMapping().getTableName();
+ }
+
+ public Table dbTable(String tableName) {
+ return typeMapping().dbTable(tableName);
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void initialize(Basic basic) {
+ super.initialize(basic);
+ this.specifiedFetch = this.specifiedFetch(basic);
+ this.specifiedOptional = this.specifiedOptional(basic);
+ this.specifiedEnumerated = this.specifiedEnumerated(basic);
+ this.temporal = this.specifiedTemporal(basic);
+ this.lob = specifiedLob(basic);
+ this.column.initialize(basic);
+ }
+
+ @Override
+ public void update(Basic basic) {
+ super.update(basic);
+ this.setSpecifiedFetch_(this.specifiedFetch(basic));
+ this.setSpecifiedOptional_(this.specifiedOptional(basic));
+ this.setSpecifiedEnumerated_(this.specifiedEnumerated(basic));
+ this.setTemporal_(this.specifiedTemporal(basic));
+ this.setLob_(this.specifiedLob(basic));
+ this.column.update(basic);
+ }
+
+ protected Boolean specifiedOptional(Basic basic) {
+ return basic.getOptional();
+ }
+
+ protected FetchType specifiedFetch(Basic basic) {
+ return FetchType.fromOrmResourceModel(basic.getFetch());
+ }
+
+ protected EnumType specifiedEnumerated(Basic basic) {
+ return EnumType.fromOrmResourceModel(basic.getEnumerated());
+ }
+
+ protected TemporalType specifiedTemporal(Basic basic) {
+ return TemporalType.fromOrmResourceModel(basic.getTemporal());
+ }
+
+ protected boolean specifiedLob(Basic basic) {
+ return basic.isLob();
+ }
+
+ @Override
+ public Basic addToResourceModel(TypeMapping typeMapping) {
+ BasicImpl basic = OrmFactory.eINSTANCE.createBasicImpl();
+ typeMapping.getAttributes().getBasics().add(basic);
+ return basic;
+ }
+
+ @Override
+ public void removeFromResourceModel(TypeMapping typeMapping) {
+ typeMapping.getAttributes().getBasics().remove(this.attributeMapping());
+ if (typeMapping.getAttributes().isAllFeaturesUnset()) {
+ typeMapping.setAttributes(null);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlBasicProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlBasicMappingProvider.java
index a68bcde901..0547876499 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlBasicProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlBasicMappingProvider.java
@@ -7,14 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.context.orm;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
-public class XmlBasicProvider implements IXmlAttributeMappingProvider
+public class XmlBasicMappingProvider implements IXmlAttributeMappingProvider
{
// singleton
- private static final XmlBasicProvider INSTANCE = new XmlBasicProvider();
+ private static final XmlBasicMappingProvider INSTANCE = new XmlBasicMappingProvider();
/**
* Return the singleton.
@@ -26,15 +27,15 @@ public class XmlBasicProvider implements IXmlAttributeMappingProvider
/**
* Ensure non-instantiability.
*/
- private XmlBasicProvider() {
+ private XmlBasicMappingProvider() {
super();
}
- public XmlAttributeMapping buildAttributeMapping() {
- return OrmFactory.eINSTANCE.createXmlBasic();
- }
-
public String key() {
return IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
}
+
+ public XmlBasicMapping buildAttributeMapping(IJpaBaseContextFactory factory, XmlPersistentAttribute parent) {
+ return new XmlBasicMapping(parent);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlCascade.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlCascade.java
new file mode 100644
index 0000000000..ffb08b31b3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlCascade.java
@@ -0,0 +1,233 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.context.base.ICascade;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.CascadeType;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping;
+
+
+public class XmlCascade extends JpaContextNode implements ICascade
+{
+
+ protected boolean all;
+
+ protected boolean persist;
+
+ protected boolean merge;
+
+ protected boolean remove;
+
+ protected boolean refresh;
+
+
+ protected RelationshipMapping relationshipMapping;
+
+ protected XmlCascade(XmlRelationshipMapping<? extends RelationshipMapping> parent) {
+ super(parent);
+ }
+
+ public boolean isAll() {
+ return this.all;
+ }
+
+ public void setAll(boolean newAll) {
+ boolean oldAll = this.all;
+ this.all = newAll;
+ if (oldAll != newAll) {
+ if (this.cascadeResource() != null) {
+ this.cascadeResource().setCascadeAll(newAll);
+ if (this.cascadeResource().isAllFeaturesUnset()) {
+ removeCascadeResource();
+ }
+ }
+ else if (newAll != false) {
+ addCascadeResource();
+ cascadeResource().setCascadeAll(newAll);
+ }
+ }
+ firePropertyChanged(ALL_PROPERTY, oldAll, newAll);
+ }
+
+ protected void setAll_(boolean newAll) {
+ boolean oldAll = this.all;
+ this.all = newAll;
+ firePropertyChanged(ALL_PROPERTY, oldAll, newAll);
+ }
+
+ public boolean isPersist() {
+ return this.persist;
+ }
+
+ public void setPersist(boolean newPersist) {
+ boolean oldPersist = this.persist;
+ this.persist = newPersist;
+ if (oldPersist != newPersist) {
+ if (this.cascadeResource() != null) {
+ this.cascadeResource().setCascadePersist(newPersist);
+ if (this.cascadeResource().isAllFeaturesUnset()) {
+ removeCascadeResource();
+ }
+ }
+ else if (newPersist != false) {
+ addCascadeResource();
+ cascadeResource().setCascadePersist(newPersist);
+ }
+ }
+ firePropertyChanged(PERSIST_PROPERTY, oldPersist, newPersist);
+ }
+
+ protected void setPersist_(boolean newPersist) {
+ boolean oldPersist = this.persist;
+ this.persist = newPersist;
+ firePropertyChanged(PERSIST_PROPERTY, oldPersist, newPersist);
+ }
+
+
+ public boolean isMerge() {
+ return this.merge;
+ }
+
+ public void setMerge(boolean newMerge) {
+ boolean oldMerge = this.merge;
+ this.merge = newMerge;
+ if (oldMerge != newMerge) {
+ if (this.cascadeResource() != null) {
+ this.cascadeResource().setCascadeMerge(newMerge);
+ if (this.cascadeResource().isAllFeaturesUnset()) {
+ removeCascadeResource();
+ }
+ }
+ else if (newMerge != false) {
+ addCascadeResource();
+ cascadeResource().setCascadeMerge(newMerge);
+ }
+ }
+ firePropertyChanged(MERGE_PROPERTY, oldMerge, newMerge);
+ }
+
+ protected void setMerge_(boolean newMerge) {
+ boolean oldMerge = this.merge;
+ this.merge = newMerge;
+ firePropertyChanged(MERGE_PROPERTY, oldMerge, newMerge);
+ }
+
+ public boolean isRemove() {
+ return this.remove;
+ }
+
+ public void setRemove(boolean newRemove) {
+ boolean oldRemove = this.remove;
+ this.remove = newRemove;
+ if (oldRemove != newRemove) {
+ if (this.cascadeResource() != null) {
+ this.cascadeResource().setCascadeRemove(newRemove);
+ if (this.cascadeResource().isAllFeaturesUnset()) {
+ removeCascadeResource();
+ }
+ }
+ else if (newRemove != false) {
+ addCascadeResource();
+ cascadeResource().setCascadeRemove(newRemove);
+ }
+ }
+ firePropertyChanged(REMOVE_PROPERTY, oldRemove, newRemove);
+ }
+
+ protected void setRemove_(boolean newRemove) {
+ boolean oldRemove = this.remove;
+ this.remove = newRemove;
+ firePropertyChanged(REMOVE_PROPERTY, oldRemove, newRemove);
+ }
+
+ public boolean isRefresh() {
+ return this.refresh;
+ }
+
+ public void setRefresh(boolean newRefresh) {
+ boolean oldRefresh = this.refresh;
+ this.refresh = newRefresh;
+ if (oldRefresh != newRefresh) {
+ if (this.cascadeResource() != null) {
+ this.cascadeResource().setCascadeRefresh(newRefresh);
+ if (this.cascadeResource().isAllFeaturesUnset()) {
+ removeCascadeResource();
+ }
+ }
+ else if (newRefresh != false) {
+ addCascadeResource();
+ cascadeResource().setCascadeRefresh(newRefresh);
+ }
+ }
+ firePropertyChanged(REFRESH_PROPERTY, oldRefresh, newRefresh);
+ }
+
+ protected void setRefresh_(boolean newRefresh) {
+ boolean oldRefresh = this.refresh;
+ this.refresh = newRefresh;
+ firePropertyChanged(REFRESH_PROPERTY, oldRefresh, newRefresh);
+ }
+
+
+ protected CascadeType cascadeResource() {
+ return this.relationshipMapping.getCascade();
+ }
+
+ protected void removeCascadeResource() {
+ this.relationshipMapping.setCascade(null);
+ }
+
+ protected void addCascadeResource() {
+ this.relationshipMapping.setCascade(OrmFactory.eINSTANCE.createCascadeTypeImpl());
+ }
+
+ public void initialize(RelationshipMapping relationshipMapping) {
+ this.relationshipMapping = relationshipMapping;
+ CascadeType cascade = cascadeResource();
+ this.all = this.all(cascade);
+ this.persist = this.persist(cascade);
+ this.merge = this.merge(cascade);
+ this.remove = this.remove(cascade);
+ this.refresh = this.refresh(cascade);
+ }
+
+ public void update(RelationshipMapping relationshipMapping) {
+ this.relationshipMapping = relationshipMapping;
+ CascadeType cascade = cascadeResource();
+ this.setAll_(this.all(cascade));
+ this.setPersist_(this.persist(cascade));
+ this.setMerge_(this.merge(cascade));
+ this.setRemove_(this.remove(cascade));
+ this.setRefresh_(this.refresh(cascade));
+ }
+
+ protected boolean all(CascadeType cascade) {
+ return cascade == null ? false : cascade.isCascadeAll();
+ }
+
+ protected boolean persist(CascadeType cascade) {
+ return cascade == null ? false : cascade.isCascadePersist();
+ }
+
+ protected boolean merge(CascadeType cascade) {
+ return cascade == null ? false : cascade.isCascadeMerge();
+ }
+
+ protected boolean remove(CascadeType cascade) {
+ return cascade == null ? false : cascade.isCascadeRemove();
+ }
+
+ protected boolean refresh(CascadeType cascade) {
+ return cascade == null ? false : cascade.isCascadeRefresh();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlColumn.java
new file mode 100644
index 0000000000..d36d0f13d6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlColumn.java
@@ -0,0 +1,203 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.context.base.IAbstractColumn;
+import org.eclipse.jpt.core.internal.context.base.IColumn;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.Column;
+import org.eclipse.jpt.core.internal.resource.orm.ColumnMapping;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+
+public class XmlColumn extends AbstractXmlColumn<Column> implements IColumn
+{
+ protected Integer specifiedLength;
+
+ protected Integer specifiedPrecision;
+
+ protected Integer specifiedScale;
+
+ protected ColumnMapping columnMapping;
+
+ protected XmlColumn(IJpaContextNode parent, IAbstractColumn.Owner owner) {
+ super(parent, owner);
+ }
+//
+// @Override
+// protected void addInsignificantXmlFeatureIdsTo(Set<Integer> insignificantXmlFeatureIds) {
+// super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
+// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.ICOLUMN__LENGTH);
+// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.ICOLUMN__SCALE);
+// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.ICOLUMN__PRECISION);
+// }
+
+
+ public Integer getLength() {
+ return (this.getSpecifiedLength() == null) ? getDefaultLength() : this.getSpecifiedLength();
+ }
+
+ public Integer getDefaultLength() {
+ return IColumn.DEFAULT_LENGTH;
+ }
+
+ public Integer getSpecifiedLength() {
+ return this.specifiedLength;
+ }
+
+ public void setSpecifiedLength(Integer newSpecifiedLength) {
+ Integer oldSpecifiedLength = this.specifiedLength;
+ this.specifiedLength = newSpecifiedLength;
+ if (oldSpecifiedLength != newSpecifiedLength) {
+ if (this.columnResource() != null) {
+ this.columnResource().setLength(newSpecifiedLength);
+ if (this.columnResource().isAllFeaturesUnset()) {
+ removeColumnResource();
+ }
+ }
+ else if (newSpecifiedLength != null) {
+ addColumnResource();
+ columnResource().setLength(newSpecifiedLength);
+ }
+ }
+ firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
+ }
+
+ protected void setSpecifiedLength_(Integer newSpecifiedLength) {
+ Integer oldSpecifiedLength = this.specifiedLength;
+ this.specifiedLength = newSpecifiedLength;
+ firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
+ }
+
+ public Integer getPrecision() {
+ return (this.getSpecifiedPrecision() == null) ? getDefaultPrecision() : this.getSpecifiedPrecision();
+ }
+
+ public Integer getDefaultPrecision() {
+ return IColumn.DEFAULT_PRECISION;
+ }
+
+ public Integer getSpecifiedPrecision() {
+ return this.specifiedPrecision;
+ }
+
+ public void setSpecifiedPrecision(Integer newSpecifiedPrecision) {
+ Integer oldSpecifiedPrecision = this.specifiedPrecision;
+ this.specifiedPrecision = newSpecifiedPrecision;
+ if (oldSpecifiedPrecision != newSpecifiedPrecision) {
+ if (this.columnResource() != null) {
+ this.columnResource().setPrecision(newSpecifiedPrecision);
+ if (this.columnResource().isAllFeaturesUnset()) {
+ removeColumnResource();
+ }
+ }
+ else if (newSpecifiedPrecision != null) {
+ addColumnResource();
+ columnResource().setPrecision(newSpecifiedPrecision);
+ }
+ }
+ firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, oldSpecifiedPrecision, newSpecifiedPrecision);
+ }
+
+ protected void setSpecifiedPrecision_(Integer newSpecifiedPrecision) {
+ Integer oldSpecifiedPrecision = this.specifiedPrecision;
+ this.specifiedPrecision = newSpecifiedPrecision;
+ firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, oldSpecifiedPrecision, newSpecifiedPrecision);
+ }
+
+ public Integer getScale() {
+ return (this.getSpecifiedScale() == null) ? getDefaultScale() : this.getSpecifiedScale();
+ }
+
+ public Integer getDefaultScale() {
+ return IColumn.DEFAULT_SCALE;
+ }
+
+ public Integer getSpecifiedScale() {
+ return this.specifiedScale;
+ }
+
+ public void setSpecifiedScale(Integer newSpecifiedScale) {
+ Integer oldSpecifiedScale = this.specifiedScale;
+ this.specifiedScale = newSpecifiedScale;
+ if (oldSpecifiedScale != newSpecifiedScale) {
+ if (this.columnResource() != null) {
+ this.columnResource().setScale(newSpecifiedScale);
+ if (this.columnResource().isAllFeaturesUnset()) {
+ removeColumnResource();
+ }
+ }
+ else if (newSpecifiedScale != null) {
+ addColumnResource();
+ columnResource().setScale(newSpecifiedScale);
+ }
+ }
+ firePropertyChanged(SPECIFIED_SCALE_PROPERTY, oldSpecifiedScale, newSpecifiedScale);
+ }
+
+ protected void setSpecifiedScale_(Integer newSpecifiedScale) {
+ Integer oldSpecifiedScale = this.specifiedScale;
+ this.specifiedScale = newSpecifiedScale;
+ firePropertyChanged(SPECIFIED_SCALE_PROPERTY, oldSpecifiedScale, newSpecifiedScale);
+ }
+
+ @Override
+ protected Column columnResource() {
+ return this.columnMapping.getColumn();
+ }
+
+ @Override
+ protected void addColumnResource() {
+ this.columnMapping.setColumn(OrmFactory.eINSTANCE.createColumnImpl());
+ }
+
+ @Override
+ protected void removeColumnResource() {
+ this.columnMapping.setColumn(null);
+ }
+
+ public void initialize(ColumnMapping columnMapping) {
+ this.columnMapping = columnMapping;
+ this.initialize(this.columnResource());
+ }
+
+ public void update(ColumnMapping columnMapping) {
+ this.columnMapping = columnMapping;
+ this.update(this.columnResource());
+ }
+
+
+ @Override
+ protected void initialize(Column column) {
+ super.initialize(column);
+ this.specifiedLength = this.specifiedLength(column);
+ this.specifiedPrecision = this.specifiedPrecision(column);
+ this.specifiedScale = this.specifiedScale(column);
+ }
+
+ @Override
+ protected void update(Column column) {
+ super.update(column);
+ this.setSpecifiedLength_(this.specifiedLength(column));
+ this.setSpecifiedPrecision_(this.specifiedPrecision(column));
+ this.setSpecifiedScale_(this.specifiedScale(column));
+ }
+
+ protected Integer specifiedLength(Column column) {
+ return column == null ? null : column.getLength();
+ }
+
+ protected Integer specifiedPrecision(Column column) {
+ return column == null ? null : column.getPrecision();
+ }
+
+ protected Integer specifiedScale(Column column) {
+ return column == null ? null : column.getScale();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlDiscriminatorColumn.java
new file mode 100644
index 0000000000..e7b6b42df2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlDiscriminatorColumn.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.context.base.DiscriminatorType;
+import org.eclipse.jpt.core.internal.context.base.IDiscriminatorColumn;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+
+public class XmlDiscriminatorColumn extends AbstractXmlNamedColumn<DiscriminatorColumn>
+ implements IDiscriminatorColumn
+{
+
+ protected DiscriminatorType specifiedDiscriminatorType;
+
+ protected DiscriminatorType defaultDiscriminatorType;
+
+// protected static final int DEFAULT_LENGTH_EDEFAULT = 31;
+
+ protected Integer defaultLength;
+
+ protected Integer specifiedLength;
+
+ protected Entity entity;
+
+ protected XmlDiscriminatorColumn(IJpaContextNode parent, Owner owner) {
+ super(parent, owner);
+ }
+
+// @Override
+// protected void addInsignificantXmlFeatureIdsTo(Set<Integer> insignificantXmlFeatureIds) {
+// super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
+// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__LENGTH);
+// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__DEFAULT_LENGTH);
+// }
+
+ public DiscriminatorType getDiscriminatorType() {
+ return (this.getSpecifiedDiscriminatorType() == null) ? this.getDefaultDiscriminatorType() : this.getSpecifiedDiscriminatorType();
+ }
+
+ public DiscriminatorType getDefaultDiscriminatorType() {
+ return IDiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE;
+ }
+
+ public DiscriminatorType getSpecifiedDiscriminatorType() {
+ return this.specifiedDiscriminatorType;
+ }
+
+ public void setSpecifiedDiscriminatorType(DiscriminatorType newSpecifiedDiscriminatorType) {
+ DiscriminatorType oldDiscriminatorType = this.specifiedDiscriminatorType;
+ this.specifiedDiscriminatorType = newSpecifiedDiscriminatorType;
+ if (oldDiscriminatorType != newSpecifiedDiscriminatorType) {
+ if (this.columnResource() != null) {
+ this.columnResource().setDiscriminatorType(DiscriminatorType.toOrmResourceModel(newSpecifiedDiscriminatorType));
+ if (this.columnResource().isAllFeaturesUnset()) {
+ removeColumnResource();
+ }
+ }
+ else if (newSpecifiedDiscriminatorType != null) {
+ addColumnResource();
+ this.columnResource().setDiscriminatorType(DiscriminatorType.toOrmResourceModel(newSpecifiedDiscriminatorType));
+ }
+ }
+ firePropertyChanged(IDiscriminatorColumn.SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY, oldDiscriminatorType, newSpecifiedDiscriminatorType);
+ }
+
+ protected void setSpecifiedDiscriminatorType_(DiscriminatorType newSpecifiedDiscriminatorType) {
+ DiscriminatorType oldDiscriminatorType = this.specifiedDiscriminatorType;
+ this.specifiedDiscriminatorType = newSpecifiedDiscriminatorType;
+ firePropertyChanged(IDiscriminatorColumn.SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY, oldDiscriminatorType, newSpecifiedDiscriminatorType);
+ }
+
+ public Integer getLength() {
+ return (this.getSpecifiedLength() == null) ? this.getDefaultLength() : this.getSpecifiedLength();
+ }
+
+ public Integer getDefaultLength() {
+ return this.defaultLength;
+ }
+
+ protected void setDefaultLength(Integer newDefaultLength) {
+ Integer oldDefaultLength = this.defaultLength;
+ this.defaultLength = newDefaultLength;
+ firePropertyChanged(DEFAULT_LENGTH_PROPERTY, oldDefaultLength, newDefaultLength);
+ }
+
+ public Integer getSpecifiedLength() {
+ return this.specifiedLength;
+ }
+
+ public void setSpecifiedLength(Integer newSpecifiedLength) {
+ Integer oldSpecifiedLength = this.specifiedLength;
+ this.specifiedLength = newSpecifiedLength;
+ if (oldSpecifiedLength != newSpecifiedLength) {
+ if (this.columnResource() != null) {
+ this.columnResource().setLength(newSpecifiedLength);
+ if (this.columnResource().isAllFeaturesUnset()) {
+ removeColumnResource();
+ }
+ }
+ else if (newSpecifiedLength != null) {
+ addColumnResource();
+ columnResource().setLength(newSpecifiedLength);
+ }
+ }
+ firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
+ }
+
+ protected void setSpecifiedLength_(Integer newSpecifiedLength) {
+ Integer oldSpecifiedLength = this.specifiedLength;
+ this.specifiedLength = newSpecifiedLength;
+ firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, oldSpecifiedLength, newSpecifiedLength);
+ }
+
+ @Override
+ protected String tableName() {
+ return this.owner().typeMapping().getTableName();
+ }
+
+
+
+ @Override
+ protected DiscriminatorColumn columnResource() {
+ return this.entity.getDiscriminatorColumn();
+ }
+
+ @Override
+ protected void addColumnResource() {
+ this.entity.setDiscriminatorColumn(OrmFactory.eINSTANCE.createDiscriminatorColumn());
+ }
+
+ @Override
+ protected void removeColumnResource() {
+ this.entity.setDiscriminatorColumn(null);
+ }
+
+ public void initialize(Entity entity) {
+ this.entity = entity;
+ this.initialize(this.columnResource());
+ }
+
+ public void update(Entity entity) {
+ this.entity = entity;
+ this.update(this.columnResource());
+ }
+
+
+ @Override
+ protected void initialize(DiscriminatorColumn column) {
+ super.initialize(column);
+ this.specifiedLength = this.specifiedLength(column);
+ this.specifiedDiscriminatorType = this.specifiedDiscriminatorType(column);
+ //TODO defaultLength, discriminator type java column
+ }
+
+ @Override
+ protected void update(DiscriminatorColumn column) {
+ super.update(column);
+ this.setSpecifiedLength_(this.specifiedLength(column));
+ this.setSpecifiedDiscriminatorType_(this.specifiedDiscriminatorType(column));
+ //TODO defaultLength, scale, precision from java column
+ }
+
+ protected Integer specifiedLength(DiscriminatorColumn column) {
+ return column == null ? null : column.getLength();
+ }
+
+ protected DiscriminatorType specifiedDiscriminatorType(DiscriminatorColumn column) {
+ return column == null ? null : DiscriminatorType.fromOrmResourceModel(column.getDiscriminatorType());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddable.java
new file mode 100644
index 0000000000..effc2f1761
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddable.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddable;
+import org.eclipse.jpt.core.internal.context.base.ITable;
+import org.eclipse.jpt.core.internal.resource.orm.Embeddable;
+import org.eclipse.jpt.core.internal.resource.orm.EntityMappings;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+
+
+public class XmlEmbeddable extends XmlTypeMapping<Embeddable> implements IEmbeddable
+{
+ public XmlEmbeddable(XmlPersistentType parent) {
+ super(parent);
+ }
+
+ public String getKey() {
+ return IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+
+ public Iterator<String> associatedTableNamesIncludingInherited() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<ITable> associatedTables() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<ITable> associatedTablesIncludingInherited() {
+ return EmptyIterator.instance();
+ }
+
+ @Override
+ public int xmlSequence() {
+ return 2;
+ }
+
+ @Override
+ public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
+ return attributeMappingKey == IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY || attributeMappingKey == IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ protected Boolean metadataComplete(Embeddable embeddable) {
+ return embeddable.getMetadataComplete();
+ }
+
+ @Override
+ public void removeFromResourceModel(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ entityMappings.getEmbeddables().remove(this.typeMappingResource());
+ }
+
+ @Override
+ public Embeddable addToResourceModel(EntityMappings entityMappings) {
+ Embeddable embeddable = OrmFactory.eINSTANCE.createEmbeddable();
+ persistentType().initialize(embeddable);
+ entityMappings.getEmbeddables().add(embeddable);
+ return embeddable;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddableProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddableProvider.java
index e6956df26c..d378559380 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddableProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddableProvider.java
@@ -7,16 +7,18 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.context.orm;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.orm.Embeddable;
public class XmlEmbeddableProvider implements IXmlTypeMappingProvider
{
- public XmlTypeMapping buildTypeMapping() {
- return OrmFactory.eINSTANCE.createXmlEmbeddable();
+ public XmlTypeMapping<Embeddable> buildTypeMapping(IJpaBaseContextFactory factory, XmlPersistentType parent) {
+ return factory.createXmlEmbeddable(parent);
}
public String key() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddedIdMapping.java
new file mode 100644
index 0000000000..3dafdbfdd4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddedIdMapping.java
@@ -0,0 +1,293 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IColumnMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddable;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IOverride;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.JavaEmbeddedMapping;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.orm.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.orm.EmbeddedIdImpl;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+
+
+public class XmlEmbeddedIdMapping extends XmlAttributeMapping<EmbeddedId> implements IEmbeddedIdMapping
+{
+ protected final List<XmlAttributeOverride> specifiedAttributeOverrides;
+
+ protected final List<XmlAttributeOverride> defaultAttributeOverrides;
+
+ private IEmbeddable embeddable;
+
+ protected XmlEmbeddedIdMapping(XmlPersistentAttribute parent) {
+ super(parent);
+ this.specifiedAttributeOverrides = new ArrayList<XmlAttributeOverride>();
+ this.defaultAttributeOverrides = new ArrayList<XmlAttributeOverride>();
+ }
+
+ @Override
+ protected void initializeOn(XmlAttributeMapping<? extends AttributeMapping> newMapping) {
+ newMapping.initializeFromXmlEmbeddedIdMapping(this);
+ }
+
+ @Override
+ public int xmlSequence() {
+ return 7;
+ }
+
+ public String getKey() {
+ return IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlAttributeOverride> attributeOverrides() {
+ //TODO
+ return EmptyListIterator.instance();
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlAttributeOverride> defaultAttributeOverrides() {
+ return new CloneListIterator<XmlAttributeOverride>(this.defaultAttributeOverrides);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlAttributeOverride> specifiedAttributeOverrides() {
+ return new CloneListIterator<XmlAttributeOverride>(this.specifiedAttributeOverrides);
+ }
+
+ public int specifiedAttributeOverridesSize() {
+ return this.specifiedAttributeOverrides.size();
+ }
+
+ public XmlAttributeOverride addSpecifiedAttributeOverride(int index) {
+ XmlAttributeOverride attributeOverride = new XmlAttributeOverride(this, this);
+ this.specifiedAttributeOverrides.add(index, attributeOverride);
+ this.attributeMapping().getAttributeOverrides().add(index, OrmFactory.eINSTANCE.createAttributeOverrideImpl());
+ this.fireItemAdded(IEmbeddedIdMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, attributeOverride);
+ return attributeOverride;
+ }
+
+ protected void addSpecifiedAttributeOverride(int index, XmlAttributeOverride attributeOverride) {
+ addItemToList(index, attributeOverride, this.specifiedAttributeOverrides, IEmbeddedIdMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public void removeSpecifiedAttributeOverride(int index) {
+ XmlAttributeOverride removedAttributeOverride = this.specifiedAttributeOverrides.remove(index);
+ this.attributeMapping().getAttributeOverrides().remove(index);
+ fireItemRemoved(IEmbeddedIdMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, removedAttributeOverride);
+ }
+
+ protected void removeSpecifiedAttributeOverride(XmlAttributeOverride attributeOverride) {
+ removeItemFromList(attributeOverride, this.specifiedAttributeOverrides, IEmbeddedIdMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public void moveSpecifiedAttributeOverride(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedAttributeOverrides, targetIndex, sourceIndex);
+ this.attributeMapping().getAttributeOverrides().move(targetIndex, sourceIndex);
+ fireItemMoved(IEmbeddedIdMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, targetIndex, sourceIndex);
+ }
+
+ public boolean isVirtual(IOverride override) {
+ return this.defaultAttributeOverrides.contains(override);
+ }
+
+ public IColumnMapping columnMapping(String attributeName) {
+ return JavaEmbeddedMapping.columnMapping(attributeName, embeddable());
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+//
+// public EList<IAttributeOverride> getAttributeOverrides() {
+// EList<IAttributeOverride> list = new EObjectEList<IAttributeOverride>(IAttributeOverride.class, this, OrmPackage.XML_EMBEDDED__ATTRIBUTE_OVERRIDES);
+// list.addAll(getSpecifiedAttributeOverrides());
+// list.addAll(getDefaultAttributeOverrides());
+// return list;
+// }
+//
+// public EList<IAttributeOverride> getSpecifiedAttributeOverrides() {
+// if (specifiedAttributeOverrides == null) {
+// specifiedAttributeOverrides = new EObjectContainmentEList<IAttributeOverride>(IAttributeOverride.class, this, OrmPackage.XML_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES);
+// }
+// return specifiedAttributeOverrides;
+// }
+//
+// public EList<IAttributeOverride> getDefaultAttributeOverrides() {
+// if (defaultAttributeOverrides == null) {
+// defaultAttributeOverrides = new EObjectContainmentEList<IAttributeOverride>(IAttributeOverride.class, this, OrmPackage.XML_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES);
+// }
+// return defaultAttributeOverrides;
+// }
+//
+// public IEmbeddable embeddable() {
+// return this.embeddable;
+// }
+//
+// public IAttributeOverride attributeOverrideNamed(String name) {
+// return (IAttributeOverride) overrideNamed(name, getAttributeOverrides());
+// }
+//
+// public boolean containsAttributeOverride(String name) {
+// return containsOverride(name, getAttributeOverrides());
+// }
+//
+// public boolean containsSpecifiedAttributeOverride(String name) {
+// return containsOverride(name, getSpecifiedAttributeOverrides());
+// }
+//
+// private IOverride overrideNamed(String name, List<? extends IOverride> overrides) {
+// for (IOverride override : overrides) {
+// String overrideName = override.getName();
+// if (overrideName == null && name == null) {
+// return override;
+// }
+// if (overrideName != null && overrideName.equals(name)) {
+// return override;
+// }
+// }
+// return null;
+// }
+//
+// private boolean containsOverride(String name, List<? extends IOverride> overrides) {
+// return overrideNamed(name, overrides) != null;
+// }
+//
+// public Iterator<String> allOverridableAttributeNames() {
+// return new TransformationIterator<IPersistentAttribute, String>(this.allOverridableAttributes()) {
+// @Override
+// protected String transform(IPersistentAttribute attribute) {
+// return attribute.getName();
+// }
+// };
+// }
+//
+// public Iterator<IPersistentAttribute> allOverridableAttributes() {
+// if (this.embeddable() == null) {
+// return EmptyIterator.instance();
+// }
+// return new FilteringIterator<IPersistentAttribute>(this.embeddable().getPersistentType().attributes()) {
+// @Override
+// protected boolean accept(Object o) {
+// return ((IPersistentAttribute) o).isOverridableAttribute();
+// }
+// };
+// }
+//
+// public IAttributeOverride createAttributeOverride(int index) {
+// return OrmFactory.eINSTANCE.createXmlAttributeOverride(new AttributeOverrideOwner(this));
+// }
+//
+
+
+ public IEmbeddable embeddable() {
+ return this.embeddable;
+ }
+
+ public Iterator<String> allOverridableAttributeNames() {
+ return new TransformationIterator<IPersistentAttribute, String>(this.allOverridableAttributes()) {
+ @Override
+ protected String transform(IPersistentAttribute attribute) {
+ return attribute.getName();
+ }
+ };
+ }
+
+ public Iterator<IPersistentAttribute> allOverridableAttributes() {
+ if (this.embeddable() == null) {
+ return EmptyIterator.instance();
+ }
+ return new FilteringIterator<IPersistentAttribute, IPersistentAttribute>(this.embeddable().persistentType().attributes()) {
+ @Override
+ protected boolean accept(IPersistentAttribute o) {
+ return o.isOverridableAttribute();
+ }
+ };
+ }
+
+ @Override
+ public void initialize(EmbeddedId embeddedId) {
+ super.initialize(embeddedId);
+ this.initializeSpecifiedAttributeOverrides(embeddedId);
+ }
+
+ protected void initializeSpecifiedAttributeOverrides(EmbeddedId embeddedId) {
+ for (AttributeOverride attributeOverride : embeddedId.getAttributeOverrides()) {
+ this.specifiedAttributeOverrides.add(createAttributeOverride(attributeOverride));
+ }
+ }
+
+ protected XmlAttributeOverride createAttributeOverride(AttributeOverride attributeOverride) {
+ XmlAttributeOverride xmlAttributeOverride = new XmlAttributeOverride(this, this);
+ xmlAttributeOverride.initialize(attributeOverride);
+ return xmlAttributeOverride;
+ }
+
+
+ @Override
+ public void update(EmbeddedId embeddedId) {
+ super.update(embeddedId);
+ this.updateSpecifiedAttributeOverrides(embeddedId);
+ }
+
+ protected void updateSpecifiedAttributeOverrides(EmbeddedId embeddedId) {
+ ListIterator<XmlAttributeOverride> attributeOverrides = specifiedAttributeOverrides();
+ ListIterator<AttributeOverride> resourceAttributeOverrides = embeddedId.getAttributeOverrides().listIterator();
+
+ while (attributeOverrides.hasNext()) {
+ XmlAttributeOverride attributeOverride = attributeOverrides.next();
+ if (resourceAttributeOverrides.hasNext()) {
+ attributeOverride.update(resourceAttributeOverrides.next());
+ }
+ else {
+ removeSpecifiedAttributeOverride(attributeOverride);
+ }
+ }
+
+ while (resourceAttributeOverrides.hasNext()) {
+ addSpecifiedAttributeOverride(specifiedAttributeOverridesSize(), createAttributeOverride(resourceAttributeOverrides.next()));
+ }
+ }
+
+ @Override
+ public EmbeddedId addToResourceModel(TypeMapping typeMapping) {
+ EmbeddedIdImpl embeddedId = OrmFactory.eINSTANCE.createEmbeddedIdImpl();
+ typeMapping.getAttributes().getEmbeddedIds().add(embeddedId);
+ return embeddedId;
+ }
+
+ @Override
+ public void removeFromResourceModel(TypeMapping typeMapping) {
+ typeMapping.getAttributes().getEmbeddeds().remove(this.attributeMapping());
+ if (typeMapping.getAttributes().isAllFeaturesUnset()) {
+ typeMapping.setAttributes(null);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddedIdMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddedIdMappingProvider.java
new file mode 100644
index 0000000000..a54455b53d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddedIdMappingProvider.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+
+public class XmlEmbeddedIdMappingProvider implements IXmlAttributeMappingProvider
+{
+ // singleton
+ private static final XmlEmbeddedIdMappingProvider INSTANCE = new XmlEmbeddedIdMappingProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static IXmlAttributeMappingProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private XmlEmbeddedIdMappingProvider() {
+ super();
+ }
+
+ public XmlEmbeddedIdMapping buildAttributeMapping(IJpaBaseContextFactory factory, XmlPersistentAttribute parent) {
+ return new XmlEmbeddedIdMapping(parent);
+ }
+
+ public String key() {
+ return IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddedMapping.java
new file mode 100644
index 0000000000..24aa5a09a2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddedMapping.java
@@ -0,0 +1,315 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IColumnMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddable;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.base.IOverride;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.JavaEmbeddedMapping;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.orm.Embedded;
+import org.eclipse.jpt.core.internal.resource.orm.EmbeddedImpl;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.CompositeListIterator;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+
+
+public class XmlEmbeddedMapping extends XmlAttributeMapping<Embedded> implements IEmbeddedMapping
+{
+ protected final List<XmlAttributeOverride> specifiedAttributeOverrides;
+
+ protected final List<XmlAttributeOverride> defaultAttributeOverrides;
+
+ private IEmbeddable embeddable;
+
+ protected XmlEmbeddedMapping(XmlPersistentAttribute parent) {
+ super(parent);
+ this.specifiedAttributeOverrides = new ArrayList<XmlAttributeOverride>();
+ this.defaultAttributeOverrides = new ArrayList<XmlAttributeOverride>();
+ }
+
+ @Override
+ protected void initializeOn(XmlAttributeMapping<? extends AttributeMapping> newMapping) {
+ newMapping.initializeFromXmlEmbeddedMapping(this);
+ }
+
+ @Override
+ public int xmlSequence() {
+ return 7;
+ }
+
+ public String getKey() {
+ return IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlAttributeOverride> attributeOverrides() {
+ return new CompositeListIterator<XmlAttributeOverride>(specifiedAttributeOverrides(), defaultAttributeOverrides());
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlAttributeOverride> defaultAttributeOverrides() {
+ return new CloneListIterator<XmlAttributeOverride>(this.defaultAttributeOverrides);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlAttributeOverride> specifiedAttributeOverrides() {
+ return new CloneListIterator<XmlAttributeOverride>(this.specifiedAttributeOverrides);
+ }
+
+ public int specifiedAttributeOverridesSize() {
+ return this.specifiedAttributeOverrides.size();
+ }
+
+ public XmlAttributeOverride addSpecifiedAttributeOverride(int index) {
+ XmlAttributeOverride attributeOverride = new XmlAttributeOverride(this, this);
+ this.specifiedAttributeOverrides.add(index, attributeOverride);
+ this.attributeMapping().getAttributeOverrides().add(index, OrmFactory.eINSTANCE.createAttributeOverrideImpl());
+ this.fireItemAdded(IEmbeddedMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, attributeOverride);
+ return attributeOverride;
+ }
+
+ protected void addSpecifiedAttributeOverride(int index, XmlAttributeOverride attributeOverride) {
+ addItemToList(index, attributeOverride, this.specifiedAttributeOverrides, IEmbeddedMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public void removeSpecifiedAttributeOverride(int index) {
+ XmlAttributeOverride removedAttributeOverride = this.specifiedAttributeOverrides.remove(index);
+ this.attributeMapping().getAttributeOverrides().remove(index);
+ fireItemRemoved(IEmbeddedMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, removedAttributeOverride);
+ }
+
+ protected void removeSpecifiedAttributeOverride(XmlAttributeOverride attributeOverride) {
+ removeItemFromList(attributeOverride, this.specifiedAttributeOverrides, IEmbeddedMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public void moveSpecifiedAttributeOverride(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedAttributeOverrides, targetIndex, sourceIndex);
+ this.attributeMapping().getAttributeOverrides().move(targetIndex, sourceIndex);
+ fireItemMoved(IEmbeddedMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, targetIndex, sourceIndex);
+ }
+
+ public boolean isVirtual(IOverride override) {
+ return this.defaultAttributeOverrides.contains(override);
+ }
+
+ public IColumnMapping columnMapping(String attributeName) {
+ return JavaEmbeddedMapping.columnMapping(attributeName, embeddable());
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+//
+// public EList<IAttributeOverride> getAttributeOverrides() {
+// EList<IAttributeOverride> list = new EObjectEList<IAttributeOverride>(IAttributeOverride.class, this, OrmPackage.XML_EMBEDDED__ATTRIBUTE_OVERRIDES);
+// list.addAll(getSpecifiedAttributeOverrides());
+// list.addAll(getDefaultAttributeOverrides());
+// return list;
+// }
+//
+// public EList<IAttributeOverride> getSpecifiedAttributeOverrides() {
+// if (specifiedAttributeOverrides == null) {
+// specifiedAttributeOverrides = new EObjectContainmentEList<IAttributeOverride>(IAttributeOverride.class, this, OrmPackage.XML_EMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES);
+// }
+// return specifiedAttributeOverrides;
+// }
+//
+// public EList<IAttributeOverride> getDefaultAttributeOverrides() {
+// if (defaultAttributeOverrides == null) {
+// defaultAttributeOverrides = new EObjectContainmentEList<IAttributeOverride>(IAttributeOverride.class, this, OrmPackage.XML_EMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES);
+// }
+// return defaultAttributeOverrides;
+// }
+//
+// public IEmbeddable embeddable() {
+// return this.embeddable;
+// }
+//
+// public IAttributeOverride attributeOverrideNamed(String name) {
+// return (IAttributeOverride) overrideNamed(name, getAttributeOverrides());
+// }
+//
+// public boolean containsAttributeOverride(String name) {
+// return containsOverride(name, getAttributeOverrides());
+// }
+//
+// public boolean containsSpecifiedAttributeOverride(String name) {
+// return containsOverride(name, getSpecifiedAttributeOverrides());
+// }
+//
+// private IOverride overrideNamed(String name, List<? extends IOverride> overrides) {
+// for (IOverride override : overrides) {
+// String overrideName = override.getName();
+// if (overrideName == null && name == null) {
+// return override;
+// }
+// if (overrideName != null && overrideName.equals(name)) {
+// return override;
+// }
+// }
+// return null;
+// }
+//
+// private boolean containsOverride(String name, List<? extends IOverride> overrides) {
+// return overrideNamed(name, overrides) != null;
+// }
+//
+// public Iterator<String> allOverridableAttributeNames() {
+// return new TransformationIterator<IPersistentAttribute, String>(this.allOverridableAttributes()) {
+// @Override
+// protected String transform(IPersistentAttribute attribute) {
+// return attribute.getName();
+// }
+// };
+// }
+//
+// public Iterator<IPersistentAttribute> allOverridableAttributes() {
+// if (this.embeddable() == null) {
+// return EmptyIterator.instance();
+// }
+// return new FilteringIterator<IPersistentAttribute>(this.embeddable().getPersistentType().attributes()) {
+// @Override
+// protected boolean accept(Object o) {
+// return ((IPersistentAttribute) o).isOverridableAttribute();
+// }
+// };
+// }
+//
+// public IAttributeOverride createAttributeOverride(int index) {
+// return OrmFactory.eINSTANCE.createXmlAttributeOverride(new AttributeOverrideOwner(this));
+// }
+
+
+ public IEmbeddable embeddable() {
+ return this.embeddable;
+ }
+
+ public Iterator<String> allOverridableAttributeNames() {
+ return new TransformationIterator<IPersistentAttribute, String>(this.allOverridableAttributes()) {
+ @Override
+ protected String transform(IPersistentAttribute attribute) {
+ return attribute.getName();
+ }
+ };
+ }
+
+ public Iterator<IPersistentAttribute> allOverridableAttributes() {
+ if (this.embeddable() == null) {
+ return EmptyIterator.instance();
+ }
+ return new FilteringIterator<IPersistentAttribute, IPersistentAttribute>(this.embeddable().persistentType().attributes()) {
+ @Override
+ protected boolean accept(IPersistentAttribute o) {
+ return o.isOverridableAttribute();
+ }
+ };
+ }
+
+ @Override
+ public void initialize(Embedded embedded) {
+ super.initialize(embedded);
+ this.embeddable = embeddableFor(javaPersistentAttribute());
+ this.initializeSpecifiedAttributeOverrides(embedded);
+ }
+
+ protected void initializeSpecifiedAttributeOverrides(Embedded embedded) {
+ for (AttributeOverride attributeOverride : embedded.getAttributeOverrides()) {
+ this.specifiedAttributeOverrides.add(createAttributeOverride(attributeOverride));
+ }
+ }
+//
+// protected void initializeDefaultAttributeOverrides(JavaPersistentAttributeResource persistentAttributeResource) {
+// for (Iterator<String> i = allOverridableAttributeNames(); i.hasNext(); ) {
+// String attributeName = i.next();
+// XmlAttributeOverride attributeOverride = attributeOverrideNamed(attributeName);
+// if (attributeOverride == null) {
+// attributeOverride = createAttributeOverride(new NullAttributeOverride(persistentAttributeResource));
+// attributeOverride.setName(attributeName);
+// this.defaultAttributeOverrides.add(attributeOverride);
+// }
+// }
+// }
+
+ protected XmlAttributeOverride createAttributeOverride(AttributeOverride attributeOverride) {
+ XmlAttributeOverride xmlAttributeOverride = new XmlAttributeOverride(this, this);
+ xmlAttributeOverride.initialize(attributeOverride);
+ return xmlAttributeOverride;
+ }
+
+
+ @Override
+ public void update(Embedded embedded) {
+ super.update(embedded);
+ this.embeddable = embeddableFor(javaPersistentAttribute());
+ this.updateSpecifiedAttributeOverrides(embedded);
+ }
+
+ protected void updateSpecifiedAttributeOverrides(Embedded embedded) {
+ ListIterator<XmlAttributeOverride> attributeOverrides = specifiedAttributeOverrides();
+ ListIterator<AttributeOverride> resourceAttributeOverrides = embedded.getAttributeOverrides().listIterator();
+
+ while (attributeOverrides.hasNext()) {
+ XmlAttributeOverride attributeOverride = attributeOverrides.next();
+ if (resourceAttributeOverrides.hasNext()) {
+ attributeOverride.update(resourceAttributeOverrides.next());
+ }
+ else {
+ removeSpecifiedAttributeOverride(attributeOverride);
+ }
+ }
+
+ while (resourceAttributeOverrides.hasNext()) {
+ addSpecifiedAttributeOverride(specifiedAttributeOverridesSize(), createAttributeOverride(resourceAttributeOverrides.next()));
+ }
+ }
+
+ @Override
+ public Embedded addToResourceModel(TypeMapping typeMapping) {
+ EmbeddedImpl embedded = OrmFactory.eINSTANCE.createEmbeddedImpl();
+ typeMapping.getAttributes().getEmbeddeds().add(embedded);
+ return embedded;
+ }
+
+ @Override
+ public void removeFromResourceModel(TypeMapping typeMapping) {
+ typeMapping.getAttributes().getEmbeddeds().remove(this.attributeMapping());
+ if (typeMapping.getAttributes().isAllFeaturesUnset()) {
+ typeMapping.setAttributes(null);
+ }
+ }
+
+ //******* static methods *********
+ public static IEmbeddable embeddableFor(IJavaPersistentAttribute javaPersistentAttribute) {
+ if (javaPersistentAttribute == null) {
+ return null;
+ }
+ return JavaEmbeddedMapping.embeddableFor(javaPersistentAttribute);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddedProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddedMappingProvider.java
index a2423e70d0..d1aaeab092 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddedProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEmbeddedMappingProvider.java
@@ -7,14 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.context.orm;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
-public class XmlEmbeddedProvider implements IXmlAttributeMappingProvider
+public class XmlEmbeddedMappingProvider implements IXmlAttributeMappingProvider
{
// singleton
- private static final XmlEmbeddedProvider INSTANCE = new XmlEmbeddedProvider();
+ private static final XmlEmbeddedMappingProvider INSTANCE = new XmlEmbeddedMappingProvider();
/**
* Return the singleton.
@@ -26,12 +27,12 @@ public class XmlEmbeddedProvider implements IXmlAttributeMappingProvider
/**
* Ensure non-instantiability.
*/
- private XmlEmbeddedProvider() {
+ private XmlEmbeddedMappingProvider() {
super();
}
- public XmlAttributeMapping buildAttributeMapping() {
- return OrmFactory.eINSTANCE.createXmlEmbedded();
+ public XmlEmbeddedMapping buildAttributeMapping(IJpaBaseContextFactory factory, XmlPersistentAttribute parent) {
+ return new XmlEmbeddedMapping(parent);
}
public String key() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEntity.java
new file mode 100644
index 0000000000..6a39ef4a38
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEntity.java
@@ -0,0 +1,1542 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.context.orm;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IAttributeOverride;
+import org.eclipse.jpt.core.internal.context.base.IColumnMapping;
+import org.eclipse.jpt.core.internal.context.base.IDiscriminatorColumn;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.INamedColumn;
+import org.eclipse.jpt.core.internal.context.base.IOverride;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.IPersistentType;
+import org.eclipse.jpt.core.internal.context.base.ISecondaryTable;
+import org.eclipse.jpt.core.internal.context.base.ITable;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.context.base.InheritanceType;
+import org.eclipse.jpt.core.internal.context.java.IJavaAssociationOverride;
+import org.eclipse.jpt.core.internal.context.java.IJavaAttributeOverride;
+import org.eclipse.jpt.core.internal.context.java.IJavaEntity;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.context.java.IJavaSecondaryTable;
+import org.eclipse.jpt.core.internal.resource.orm.AssociationOverride;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.IdClass;
+import org.eclipse.jpt.core.internal.resource.orm.Inheritance;
+import org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery;
+import org.eclipse.jpt.core.internal.resource.orm.NamedQuery;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.orm.SecondaryTable;
+import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.ClassTools;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+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.EmptyListIterator;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class XmlEntity extends XmlTypeMapping<Entity> implements IEntity
+{
+ protected String specifiedName;
+
+ protected String defaultName;
+
+ protected String idClass;
+
+ protected final XmlTable table;
+
+ protected final List<XmlSecondaryTable> specifiedSecondaryTables;
+
+ protected final List<XmlSecondaryTable> virtualSecondaryTables;
+ public static final String VIRTUAL_SECONDARY_TABLES_LIST = "virtualSecondaryTablesList";
+
+ protected final List<XmlPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns;
+
+ protected final List<XmlPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns;
+
+ protected InheritanceType specifiedInheritanceStrategy;
+
+ protected InheritanceType defaultInheritanceStrategy;
+
+ protected String defaultDiscriminatorValue;
+
+ protected String specifiedDiscriminatorValue;
+
+ protected final XmlDiscriminatorColumn discriminatorColumn;
+
+ protected XmlSequenceGenerator sequenceGenerator;
+
+ protected XmlTableGenerator tableGenerator;
+
+ protected final List<XmlAttributeOverride> specifiedAttributeOverrides;
+
+ protected final List<XmlAttributeOverride> defaultAttributeOverrides;
+
+ protected final List<XmlAssociationOverride> specifiedAssociationOverrides;
+
+ protected final List<XmlAssociationOverride> defaultAssociationOverrides;
+
+ protected final List<XmlNamedQuery> namedQueries;
+
+ protected final List<XmlNamedNativeQuery> namedNativeQueries;
+
+// protected String idClass;
+//
+
+ public XmlEntity(XmlPersistentType parent) {
+ super(parent);
+ this.table = new XmlTable(this);
+ this.specifiedSecondaryTables = new ArrayList<XmlSecondaryTable>();
+ this.virtualSecondaryTables = new ArrayList<XmlSecondaryTable>();
+ this.discriminatorColumn = createXmlDiscriminatorColumn();
+ this.specifiedPrimaryKeyJoinColumns = new ArrayList<XmlPrimaryKeyJoinColumn>();
+ this.defaultPrimaryKeyJoinColumns = new ArrayList<XmlPrimaryKeyJoinColumn>();
+ this.specifiedAttributeOverrides = new ArrayList<XmlAttributeOverride>();
+ this.defaultAttributeOverrides = new ArrayList<XmlAttributeOverride>();
+ this.specifiedAssociationOverrides = new ArrayList<XmlAssociationOverride>();
+ this.defaultAssociationOverrides = new ArrayList<XmlAssociationOverride>();
+ this.namedQueries = new ArrayList<XmlNamedQuery>();
+ this.namedNativeQueries = new ArrayList<XmlNamedNativeQuery>();
+ }
+
+ protected XmlDiscriminatorColumn createXmlDiscriminatorColumn() {
+ return new XmlDiscriminatorColumn(this, buildDiscriminatorColumnOwner());
+ }
+
+ protected INamedColumn.Owner buildDiscriminatorColumnOwner() {
+ return new INamedColumn.Owner(){
+ public Table dbTable(String tableName) {
+ return XmlEntity.this.dbTable(tableName);
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ return XmlEntity.this.validationTextRange(astRoot);
+ }
+
+ public ITypeMapping typeMapping() {
+ return XmlEntity.this;
+ }
+
+ public String defaultColumnName() {
+ //TODO default column name from java here or in XmlDiscriminatorColumn?
+ return IDiscriminatorColumn.DEFAULT_NAME;
+ }
+ };
+ }
+
+ // ******************* ITypeMapping implementation ********************
+
+ public String getKey() {
+ return IMappingKeys.ENTITY_TYPE_MAPPING_KEY;
+ }
+
+ @Override
+ public String getTableName() {
+ return getTable().getName();
+ }
+
+ @Override
+ public Table primaryDbTable() {
+ return getTable().dbTable();
+ }
+
+ @Override
+ public Table dbTable(String tableName) {
+ for (Iterator<ITable> stream = this.associatedTablesIncludingInherited(); stream.hasNext();) {
+ Table dbTable = stream.next().dbTable();
+ if (dbTable != null && dbTable.matchesShortJavaClassName(tableName)) {
+ return dbTable;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Schema dbSchema() {
+ return getTable().dbSchema();
+ }
+
+ public IJavaEntity javaEntity() {
+ IJavaPersistentType javaPersistentType = getJavaPersistentType();
+ if (javaPersistentType != null && javaPersistentType.mappingKey() == IMappingKeys.ENTITY_TYPE_MAPPING_KEY) {
+ return (IJavaEntity) javaPersistentType.getMapping();
+ }
+ return null;
+ }
+
+ public String getName() {
+ return (this.getSpecifiedName() == null) ? getDefaultName() : this.getSpecifiedName();
+ }
+
+ public String getSpecifiedName() {
+ return this.specifiedName;
+ }
+
+ public void setSpecifiedName(String newSpecifiedName) {
+ String oldSpecifiedName = this.specifiedName;
+ this.specifiedName = newSpecifiedName;
+ this.typeMappingResource().setName(newSpecifiedName);
+ firePropertyChanged(SPECIFIED_NAME_PROPERTY, oldSpecifiedName, newSpecifiedName);
+ }
+
+ public String getDefaultName() {
+ return this.defaultName;
+ }
+
+ protected void setDefaultName(String newDefaultName) {
+ String oldDefaultName = this.defaultName;
+ this.defaultName = newDefaultName;
+ firePropertyChanged(DEFAULT_NAME_PROPERTY, oldDefaultName, newDefaultName);
+ }
+
+ public XmlTable getTable() {
+ return this.table;
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlSecondaryTable> secondaryTables() {
+ if (specifiedSecondaryTablesSize() > 0) {
+ return specifiedSecondaryTables();
+ }
+ return virtualSecondaryTables();
+ }
+
+ public int secondaryTablesSize() {
+ return CollectionTools.size(secondaryTables());
+ }
+
+ public ListIterator<XmlSecondaryTable> virtualSecondaryTables() {
+ return new CloneListIterator<XmlSecondaryTable>(this.virtualSecondaryTables);
+ }
+
+ public int virtualSecondaryTablesSize() {
+ return this.virtualSecondaryTables.size();
+ }
+
+ protected void addVirtualSecondaryTable(XmlSecondaryTable secondaryTable) {
+ addItemToList(secondaryTable, this.virtualSecondaryTables, XmlEntity.VIRTUAL_SECONDARY_TABLES_LIST);
+ }
+
+ protected void removeVirtualSecondaryTable(XmlSecondaryTable secondaryTable) {
+ removeItemFromList(secondaryTable, this.virtualSecondaryTables, XmlEntity.VIRTUAL_SECONDARY_TABLES_LIST);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlSecondaryTable> specifiedSecondaryTables() {
+ return new CloneListIterator<XmlSecondaryTable>(this.specifiedSecondaryTables);
+ }
+
+ public int specifiedSecondaryTablesSize() {
+ return this.specifiedSecondaryTables.size();
+ }
+
+ public XmlSecondaryTable addSpecifiedSecondaryTable(int index) {
+ XmlSecondaryTable secondaryTable = new XmlSecondaryTable(this);
+ this.specifiedSecondaryTables.add(index, secondaryTable);
+ SecondaryTable secondaryTableResource = OrmFactory.eINSTANCE.createSecondaryTable();
+ secondaryTable.initialize(secondaryTableResource);
+ typeMappingResource().getSecondaryTables().add(index, secondaryTableResource);
+ fireItemAdded(IEntity.SPECIFIED_SECONDARY_TABLES_LIST, index, secondaryTable);
+ return secondaryTable;
+ }
+
+ protected void addSpecifiedSecondaryTable(int index, XmlSecondaryTable secondaryTable) {
+ addItemToList(index, secondaryTable, this.specifiedSecondaryTables, IEntity.SPECIFIED_SECONDARY_TABLES_LIST);
+ }
+
+ public void removeSpecifiedSecondaryTable(int index) {
+ XmlSecondaryTable removedSecondaryTable = this.specifiedSecondaryTables.remove(index);
+ typeMappingResource().getSecondaryTables().remove(index);
+ fireItemRemoved(IEntity.SPECIFIED_SECONDARY_TABLES_LIST, index, removedSecondaryTable);
+ }
+
+ protected void removeSpecifiedSecondaryTable(XmlSecondaryTable secondaryTable) {
+ removeItemFromList(secondaryTable, this.specifiedSecondaryTables, IEntity.SPECIFIED_SECONDARY_TABLES_LIST);
+ }
+
+ public void moveSpecifiedSecondaryTable(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedSecondaryTables, targetIndex, sourceIndex);
+ this.typeMappingResource().getSecondaryTables().move(targetIndex, sourceIndex);
+ fireItemMoved(IEntity.SPECIFIED_SECONDARY_TABLES_LIST, targetIndex, sourceIndex);
+ }
+
+ public boolean containsSecondaryTable(String name) {
+ return containsSecondaryTable(name, secondaryTables());
+ }
+
+ public boolean containsSpecifiedSecondaryTable(String name) {
+ return containsSecondaryTable(name, specifiedSecondaryTables());
+ }
+
+ public boolean containsVirtualSecondaryTable(String name) {
+ return containsSecondaryTable(name, virtualSecondaryTables());
+ }
+
+ public boolean containsVirtualSecondaryTable(XmlSecondaryTable secondaryTable) {
+ return this.virtualSecondaryTables.contains(secondaryTable);
+ }
+
+ protected boolean containsSecondaryTable(String name, ListIterator<XmlSecondaryTable> secondaryTables) {
+ for (XmlSecondaryTable secondaryTable : CollectionTools.iterable(secondaryTables)) {
+ String secondaryTableName = secondaryTable.getName();
+ if (secondaryTableName != null && secondaryTableName.equals(name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected Iterator<String> tableNames(Iterator<ITable> tables) {
+ return new TransformationIterator<ITable, String>(tables) {
+ @Override
+ protected String transform(ITable t) {
+ return t.getName();
+ }
+ };
+ }
+
+ public Iterator<String> associatedTableNamesIncludingInherited() {
+ return this.nonNullTableNames(this.associatedTablesIncludingInherited());
+ }
+
+ protected Iterator<String> nonNullTableNames(Iterator<ITable> tables) {
+ return new FilteringIterator<String, String>(this.tableNames(tables)) {
+ @Override
+ protected boolean accept(String o) {
+ return o != null;
+ }
+ };
+ }
+
+ public Iterator<ITable> associatedTables() {
+ return new SingleElementIterator<ITable>(getTable());
+ //TODO return new CompositeIterator(this.getTable(), this.getSecondaryTables().iterator());
+ }
+
+ public Iterator<ITable> associatedTablesIncludingInherited() {
+ return new CompositeIterator<ITable>(new TransformationIterator<ITypeMapping, Iterator<ITable>>(this.inheritanceHierarchy()) {
+ @Override
+ protected Iterator<ITable> transform(ITypeMapping mapping) {
+ return new FilteringIterator<ITable, ITable>(mapping.associatedTables()) {
+ @Override
+ protected boolean accept(ITable o) {
+ return true;
+ //TODO
+ //filtering these out so as to avoid the duplicate table, root and children share the same table
+ //return !(o instanceof SingleTableInheritanceChildTableImpl);
+ }
+ };
+ }
+ });
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return !CollectionTools.contains(this.associatedTableNamesIncludingInherited(), tableName);
+ }
+
+// protected void xmlIdClassChanged() {
+// if (getIdClassForXml() == null) {
+// setIdClass(null);
+// }
+// }
+
+ public InheritanceType getInheritanceStrategy() {
+ return (this.getSpecifiedInheritanceStrategy() == null) ? this.getDefaultInheritanceStrategy() : this.getSpecifiedInheritanceStrategy();
+ }
+
+ public InheritanceType getDefaultInheritanceStrategy() {
+ return this.defaultInheritanceStrategy;
+ }
+
+ protected void setDefaultInheritanceStrategy(InheritanceType newInheritanceType) {
+ InheritanceType oldInheritanceType = this.defaultInheritanceStrategy;
+ this.defaultInheritanceStrategy = newInheritanceType;
+ firePropertyChanged(DEFAULT_INHERITANCE_STRATEGY_PROPERTY, oldInheritanceType, newInheritanceType);
+ }
+
+ public InheritanceType getSpecifiedInheritanceStrategy() {
+ return this.specifiedInheritanceStrategy;
+ }
+
+ public void setSpecifiedInheritanceStrategy(InheritanceType newInheritanceType) {
+ InheritanceType oldInheritanceType = this.specifiedInheritanceStrategy;
+ this.specifiedInheritanceStrategy = newInheritanceType;
+ if (oldInheritanceType != newInheritanceType) {
+ if (this.inheritanceResource() != null) {
+ this.inheritanceResource().setStrategy(InheritanceType.toOrmResourceModel(newInheritanceType));
+ if (this.inheritanceResource().isAllFeaturesUnset()) {
+ removeInheritanceResource();
+ }
+ }
+ else if (newInheritanceType != null) {
+ addInheritanceResource();
+ inheritanceResource().setStrategy(InheritanceType.toOrmResourceModel(newInheritanceType));
+ }
+ }
+ firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, oldInheritanceType, newInheritanceType);
+ }
+
+ protected void setSpecifiedInheritanceStrategy_(InheritanceType newInheritanceType) {
+ InheritanceType oldInheritanceType = this.specifiedInheritanceStrategy;
+ this.specifiedInheritanceStrategy = newInheritanceType;
+ firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, oldInheritanceType, newInheritanceType);
+ }
+
+ protected Inheritance inheritanceResource() {
+ return typeMappingResource().getInheritance();
+ }
+
+ protected void addInheritanceResource() {
+ typeMappingResource().setInheritance(OrmFactory.eINSTANCE.createInheritance());
+ }
+
+ protected void removeInheritanceResource() {
+ typeMappingResource().setInheritance(null);
+ }
+
+ public XmlDiscriminatorColumn getDiscriminatorColumn() {
+ return this.discriminatorColumn;
+ }
+
+ public XmlSequenceGenerator addSequenceGenerator() {
+ if (getSequenceGenerator() != null) {
+ throw new IllegalStateException("sequenceGenerator already exists");
+ }
+ this.sequenceGenerator = new XmlSequenceGenerator(this);
+ typeMappingResource().setSequenceGenerator(OrmFactory.eINSTANCE.createSequenceGeneratorImpl());
+ firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, null, this.sequenceGenerator);
+ return this.sequenceGenerator;
+ }
+
+ public void removeSequenceGenerator() {
+ if (getSequenceGenerator() == null) {
+ throw new IllegalStateException("sequenceGenerator does not exist, cannot be removed");
+ }
+ XmlSequenceGenerator oldSequenceGenerator = this.sequenceGenerator;
+ this.sequenceGenerator = null;
+ this.typeMappingResource().setSequenceGenerator(null);
+ firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, oldSequenceGenerator, null);
+ }
+
+ public XmlSequenceGenerator getSequenceGenerator() {
+ return this.sequenceGenerator;
+ }
+
+ protected void setSequenceGenerator(XmlSequenceGenerator newSequenceGenerator) {
+ XmlSequenceGenerator oldSequenceGenerator = this.sequenceGenerator;
+ this.sequenceGenerator = newSequenceGenerator;
+ firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, oldSequenceGenerator, newSequenceGenerator);
+ }
+
+ public XmlTableGenerator addTableGenerator() {
+ if (getTableGenerator() != null) {
+ throw new IllegalStateException("tableGenerator already exists");
+ }
+ this.tableGenerator = new XmlTableGenerator(this);
+ typeMappingResource().setTableGenerator(OrmFactory.eINSTANCE.createTableGeneratorImpl());
+ firePropertyChanged(TABLE_GENERATOR_PROPERTY, null, this.tableGenerator);
+ return this.tableGenerator;
+ }
+
+ public void removeTableGenerator() {
+ if (getTableGenerator() == null) {
+ throw new IllegalStateException("tableGenerator does not exist, cannot be removed");
+ }
+ XmlTableGenerator oldTableGenerator = this.tableGenerator;
+ this.tableGenerator = null;
+ this.typeMappingResource().setTableGenerator(null);
+ firePropertyChanged(TABLE_GENERATOR_PROPERTY, oldTableGenerator, null);
+ }
+
+ public XmlTableGenerator getTableGenerator() {
+ return this.tableGenerator;
+ }
+
+ protected void setTableGenerator(XmlTableGenerator newTableGenerator) {
+ XmlTableGenerator oldTableGenerator = this.tableGenerator;
+ this.tableGenerator = newTableGenerator;
+ firePropertyChanged(TABLE_GENERATOR_PROPERTY, oldTableGenerator, newTableGenerator);
+ }
+
+ public String getDefaultDiscriminatorValue() {
+ return this.defaultDiscriminatorValue;
+ }
+
+ protected void setDefaultDiscriminatorValue(String newDefaultDiscriminatorValue) {
+ String oldDefaultDiscriminatorValue = this.defaultDiscriminatorValue;
+ this.defaultDiscriminatorValue = newDefaultDiscriminatorValue;
+ firePropertyChanged(DEFAULT_DISCRIMINATOR_VALUE_PROPERTY, oldDefaultDiscriminatorValue, newDefaultDiscriminatorValue);
+ }
+
+ public String getSpecifiedDiscriminatorValue() {
+ return this.specifiedDiscriminatorValue;
+ }
+
+ public void setSpecifiedDiscriminatorValue(String newSpecifiedDiscriminatorValue) {
+ String oldSpecifiedDiscriminatorValue = this.specifiedDiscriminatorValue;
+ this.specifiedDiscriminatorValue = newSpecifiedDiscriminatorValue;
+ typeMappingResource().setDiscriminatorValue(newSpecifiedDiscriminatorValue);
+ firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY, oldSpecifiedDiscriminatorValue, newSpecifiedDiscriminatorValue);
+ }
+
+ public String getDiscriminatorValue() {
+ return (this.getSpecifiedDiscriminatorValue() == null) ? getDefaultDiscriminatorValue() : this.getSpecifiedDiscriminatorValue();
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns() {
+ return new CloneListIterator<XmlPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumns);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
+ return this.specifiedPrimaryKeyJoinColumns.isEmpty() ? this.defaultPrimaryKeyJoinColumns() : this.specifiedPrimaryKeyJoinColumns();
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
+ return new CloneListIterator<XmlPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
+ }
+
+ public int specifiedPrimaryKeyJoinColumnsSize() {
+ return this.specifiedPrimaryKeyJoinColumns.size();
+ }
+
+ public XmlPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
+ XmlPrimaryKeyJoinColumn primaryKeyJoinColumn = new XmlPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner());
+ this.specifiedPrimaryKeyJoinColumns.add(index, primaryKeyJoinColumn);
+ this.typeMappingResource().getPrimaryKeyJoinColumns().add(index, OrmFactory.eINSTANCE.createPrimaryKeyJoinColumn());
+ this.fireItemAdded(IEntity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, primaryKeyJoinColumn);
+ return primaryKeyJoinColumn;
+ }
+
+ protected IAbstractJoinColumn.Owner createPrimaryKeyJoinColumnOwner() {
+ return new PrimaryKeyJoinColumnOwner();
+ }
+
+ protected void addSpecifiedPrimaryKeyJoinColumn(int index, XmlPrimaryKeyJoinColumn primaryKeyJoinColumn) {
+ addItemToList(index, primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, IEntity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
+ XmlPrimaryKeyJoinColumn removedPrimaryKeyJoinColumn = this.specifiedPrimaryKeyJoinColumns.remove(index);
+ this.typeMappingResource().getPrimaryKeyJoinColumns().remove(index);
+ fireItemRemoved(IEntity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, removedPrimaryKeyJoinColumn);
+ }
+
+ protected void removeSpecifiedPrimaryKeyJoinColumn(XmlPrimaryKeyJoinColumn primaryKeyJoinColumn) {
+ removeItemFromList(primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, IEntity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedPrimaryKeyJoinColumns, targetIndex, sourceIndex);
+ this.typeMappingResource().getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex);
+ fireItemMoved(IEntity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlAttributeOverride> attributeOverrides() {
+ return new CompositeListIterator<XmlAttributeOverride>(specifiedAttributeOverrides(), defaultAttributeOverrides());
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlAttributeOverride> defaultAttributeOverrides() {
+ return new CloneListIterator<XmlAttributeOverride>(this.defaultAttributeOverrides);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlAttributeOverride> specifiedAttributeOverrides() {
+ return new CloneListIterator<XmlAttributeOverride>(this.specifiedAttributeOverrides);
+ }
+
+ public int specifiedAttributeOverridesSize() {
+ return this.specifiedAttributeOverrides.size();
+ }
+
+ public XmlAttributeOverride addSpecifiedAttributeOverride(int index) {
+ XmlAttributeOverride attributeOverride = new XmlAttributeOverride(this, createAttributeOverrideOwner());
+ this.specifiedAttributeOverrides.add(index, attributeOverride);
+ this.typeMappingResource().getAttributeOverrides().add(index, OrmFactory.eINSTANCE.createAttributeOverrideImpl());
+ this.fireItemAdded(IEntity.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, attributeOverride);
+ return attributeOverride;
+ }
+
+ protected void addSpecifiedAttributeOverride(int index, XmlAttributeOverride attributeOverride) {
+ addItemToList(index, attributeOverride, this.specifiedAttributeOverrides, IEntity.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public void removeSpecifiedAttributeOverride(int index) {
+ XmlAttributeOverride removedAttributeOverride = this.specifiedAttributeOverrides.remove(index);
+ this.typeMappingResource().getAttributeOverrides().remove(index);
+ fireItemRemoved(IEntity.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, index, removedAttributeOverride);
+ }
+
+ protected void removeSpecifiedAttributeOverride(XmlAttributeOverride attributeOverride) {
+ removeItemFromList(attributeOverride, this.specifiedAttributeOverrides, IEntity.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public void moveSpecifiedAttributeOverride(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedAttributeOverrides, targetIndex, sourceIndex);
+ this.typeMappingResource().getAttributeOverrides().move(targetIndex, sourceIndex);
+ fireItemMoved(IEntity.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST, targetIndex, sourceIndex);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlAssociationOverride> associationOverrides() {
+ return new CompositeListIterator<XmlAssociationOverride>(specifiedAssociationOverrides(), defaultAssociationOverrides());
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlAssociationOverride> defaultAssociationOverrides() {
+ return new CloneListIterator<XmlAssociationOverride>(this.defaultAssociationOverrides);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlAssociationOverride> specifiedAssociationOverrides() {
+ return new CloneListIterator<XmlAssociationOverride>(this.specifiedAssociationOverrides);
+ }
+
+ public int specifiedAssociationOverridesSize() {
+ return this.specifiedAssociationOverrides.size();
+ }
+
+ public XmlAssociationOverride addSpecifiedAssociationOverride(int index) {
+ XmlAssociationOverride associationOverride = new XmlAssociationOverride(this, createAssociationOverrideOwner());
+ this.specifiedAssociationOverrides.add(index, associationOverride);
+ this.typeMappingResource().getAssociationOverrides().add(index, OrmFactory.eINSTANCE.createAssociationOverride());
+ this.fireItemAdded(IEntity.SPECIFIED_ASSOCIATION_OVERRIDES_LIST, index, associationOverride);
+ return associationOverride;
+ }
+
+ protected void addSpecifiedAssociationOverride(int index, XmlAssociationOverride associationOverride) {
+ addItemToList(index, associationOverride, this.specifiedAssociationOverrides, IEntity.SPECIFIED_ASSOCIATION_OVERRIDES_LIST);
+ }
+
+ public void removeSpecifiedAssociationOverride(int index) {
+ XmlAssociationOverride removedAssociationOverride = this.specifiedAssociationOverrides.remove(index);
+ this.typeMappingResource().getAssociationOverrides().remove(index);
+ fireItemRemoved(IEntity.SPECIFIED_ASSOCIATION_OVERRIDES_LIST, index, removedAssociationOverride);
+ }
+
+ protected void removeSpecifiedAssociationOverride(XmlAssociationOverride associationOverride) {
+ removeItemFromList(associationOverride, this.specifiedAssociationOverrides, IEntity.SPECIFIED_ASSOCIATION_OVERRIDES_LIST);
+ }
+
+ public void moveSpecifiedAssociationOverride(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedAssociationOverrides, targetIndex, sourceIndex);
+ this.typeMappingResource().getAssociationOverrides().move(targetIndex, sourceIndex);
+ fireItemMoved(IEntity.SPECIFIED_ASSOCIATION_OVERRIDES_LIST, targetIndex, sourceIndex);
+ }
+
+
+// public String getIdClass() {
+// return idClass;
+// }
+//
+// public void setIdClass(String newIdClass) {
+// String oldIdClass = idClass;
+// idClass = newIdClass;
+// if (eNotificationRequired())
+// eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_ENTITY_INTERNAL__ID_CLASS, oldIdClass, idClass));
+// }
+//
+// protected void idClassChanged() {
+// if (getIdClass() == null) {
+// setIdClassForXml(null);
+// }
+// else {
+// if (getIdClassForXml() == null) {
+// setIdClassForXml(OrmFactory.eINSTANCE.createXmlIdClass());
+// }
+// getIdClassForXml().setValue(getIdClass());
+// }
+// }
+//
+// public boolean discriminatorValueIsAllowed() {
+// Type type = persistentType().findType();
+// return (type == null) ? false : !type.isAbstract();
+// }
+
+ public IEntity parentEntity() {
+ for (Iterator<IPersistentType> i = persistentType().inheritanceHierarchy(); i.hasNext();) {
+ ITypeMapping typeMapping = i.next().getMapping();
+ if (typeMapping != this && typeMapping instanceof IEntity) {
+ return (IEntity) typeMapping;
+ }
+ }
+ return this;
+ }
+
+ public IEntity rootEntity() {
+ IEntity rootEntity = null;
+ for (Iterator<IPersistentType> i = persistentType().inheritanceHierarchy(); i.hasNext();) {
+ IPersistentType persistentType = i.next();
+ if (persistentType.getMapping() instanceof IEntity) {
+ rootEntity = (IEntity) persistentType.getMapping();
+ }
+ }
+ return rootEntity;
+ }
+
+ public String getIdClass() {
+ return this.idClass;
+ }
+
+ public void setIdClass(String newIdClass) {
+ String oldIdClass = this.idClass;
+ this.idClass = newIdClass;
+ if (oldIdClass != newIdClass) {
+ if (this.idClassResource() != null) {
+ this.idClassResource().setClassName(newIdClass);
+ if (this.idClassResource().isAllFeaturesUnset()) {
+ removeIdClassResource();
+ }
+ }
+ else if (newIdClass != null) {
+ addIdClassResource();
+ idClassResource().setClassName(newIdClass);
+ }
+ }
+ firePropertyChanged(IEntity.ID_CLASS_PROPERTY, oldIdClass, newIdClass);
+ }
+
+ protected void setIdClass_(String newIdClass) {
+ String oldIdClass = this.idClass;
+ this.idClass = newIdClass;
+ firePropertyChanged(IEntity.ID_CLASS_PROPERTY, oldIdClass, newIdClass);
+ }
+
+ protected IdClass idClassResource() {
+ return typeMappingResource().getIdClass();
+ }
+
+ protected void addIdClassResource() {
+ typeMappingResource().setIdClass(OrmFactory.eINSTANCE.createIdClass());
+ }
+
+ protected void removeIdClassResource() {
+ typeMappingResource().setIdClass(null);
+ }
+
+// public String primaryKeyColumnName() {
+// String pkColumnName = null;
+// for (Iterator<IPersistentAttribute> stream = getPersistentType().allAttributes(); stream.hasNext();) {
+// IPersistentAttribute attribute = stream.next();
+// String name = attribute.primaryKeyColumnName();
+// if (pkColumnName == null) {
+// pkColumnName = name;
+// }
+// else if (name != null) {
+// // if we encounter a composite primary key, return null
+// return null;
+// }
+// }
+// // if we encounter only a single primary key column name, return it
+// return pkColumnName;
+// }
+//
+// public String primaryKeyAttributeName() {
+// String pkColumnName = null;
+// String pkAttributeName = null;
+// for (Iterator<IPersistentAttribute> stream = getPersistentType().allAttributes(); stream.hasNext();) {
+// IPersistentAttribute attribute = stream.next();
+// String name = attribute.primaryKeyColumnName();
+// if (pkColumnName == null) {
+// pkColumnName = name;
+// pkAttributeName = attribute.getName();
+// }
+// else if (name != null) {
+// // if we encounter a composite primary key, return null
+// return null;
+// }
+// }
+// // if we encounter only a single primary key column name, return it
+// return pkAttributeName;
+// }
+//
+
+
+ @Override
+ public int xmlSequence() {
+ return 1;
+ }
+
+ /**
+ * Return an iterator of Entities, each which inherits from the one before,
+ * and terminates at the root entity (or at the point of cyclicity).
+ */
+ protected Iterator<ITypeMapping> inheritanceHierarchy() {
+ return new TransformationIterator<IPersistentType, ITypeMapping>(persistentType().inheritanceHierarchy()) {
+ @Override
+ protected ITypeMapping transform(IPersistentType type) {
+ return type.getMapping();
+ }
+ };
+ }
+
+ @Override
+ public Iterator<String> allOverridableAttributeNames() {
+ return new CompositeIterator<String>(new TransformationIterator<ITypeMapping, Iterator<String>>(this.inheritanceHierarchy()) {
+ @Override
+ protected Iterator<String> transform(ITypeMapping mapping) {
+ return mapping.overridableAttributeNames();
+ }
+ });
+ }
+
+ @Override
+ public Iterator<String> allOverridableAssociationNames() {
+ return new CompositeIterator<String>(new TransformationIterator<ITypeMapping, Iterator<String>>(this.inheritanceHierarchy()) {
+ @Override
+ protected Iterator<String> transform(ITypeMapping mapping) {
+ return mapping.overridableAssociationNames();
+ }
+ });
+ }
+
+//
+// public IAttributeOverride createAttributeOverride(int index) {
+// return OrmFactory.eINSTANCE.createXmlAttributeOverride(new IEntity.AttributeOverrideOwner(this));
+// }
+//
+// public IAssociationOverride createAssociationOverride(int index) {
+// return OrmFactory.eINSTANCE.createXmlAssociationOverride(new IEntity.AssociationOverrideOwner(this));
+// }
+//
+// public IAttributeOverride attributeOverrideNamed(String name) {
+// return (IAttributeOverride) overrideNamed(name, getAttributeOverrides());
+// }
+//
+// public boolean containsAttributeOverride(String name) {
+// return containsOverride(name, getAttributeOverrides());
+// }
+//
+// public boolean containsSpecifiedAttributeOverride(String name) {
+// return containsOverride(name, getSpecifiedAttributeOverrides());
+// }
+//
+// public boolean containsAssociationOverride(String name) {
+// return containsOverride(name, getAssociationOverrides());
+// }
+//
+// public boolean containsSpecifiedAssociationOverride(String name) {
+// return containsOverride(name, getSpecifiedAssociationOverrides());
+// }
+//
+// private IOverride overrideNamed(String name, List<? extends IOverride> overrides) {
+// for (IOverride override : overrides) {
+// String overrideName = override.getName();
+// if (overrideName == null && name == null) {
+// return override;
+// }
+// if (overrideName != null && overrideName.equals(name)) {
+// return override;
+// }
+// }
+// return null;
+// }
+//
+// private boolean containsOverride(String name, List<? extends IOverride> overrides) {
+// return overrideNamed(name, overrides) != null;
+// }
+//
+// public boolean containsSpecifiedPrimaryKeyJoinColumns() {
+// return !this.getSpecifiedPrimaryKeyJoinColumns().isEmpty();
+// }
+
+
+ @Override
+ public void initialize(Entity entity) {
+ super.initialize(entity);
+ this.specifiedName = entity.getName();
+ this.defaultName = this.defaultName();
+ this.initializeInheritance(this.inheritanceResource());
+ this.discriminatorColumn.initialize(entity);
+ this.specifiedDiscriminatorValue = entity.getDiscriminatorValue();
+ this.defaultDiscriminatorValue = this.defaultDiscriminatorValue();
+ this.table.initialize(entity);
+ this.initializeSpecifiedSecondaryTables(entity);
+ this.initializeVirtualSecondaryTables();
+ this.initializeSequenceGenerator(entity);
+ this.initializeTableGenerator(entity);
+ this.initializeSpecifiedPrimaryKeyJoinColumns(entity);
+ this.initializeSpecifiedAttributeOverrides(entity);
+ this.initializeSpecifiedAssociationOverrides(entity);
+ this.initializeNamedQueries(entity);
+ this.initializeNamedNativeQueries(entity);
+ this.initializeIdClass(this.idClassResource());
+ }
+
+ protected void initializeInheritance(Inheritance inheritanceResource) {
+ this.specifiedInheritanceStrategy = this.specifiedInheritanceStrategy(inheritanceResource);
+ this.defaultInheritanceStrategy = this.defaultInheritanceStrategy();
+ }
+
+ protected void initializeSpecifiedSecondaryTables(Entity entity) {
+ for (SecondaryTable secondaryTable : entity.getSecondaryTables()) {
+ this.specifiedSecondaryTables.add(createSecondaryTable(secondaryTable));
+ }
+ }
+
+ protected void initializeVirtualSecondaryTables() {
+ if (isMetadataComplete()) {
+ return;
+ }
+ if (javaEntity() == null) {
+ return;
+ }
+ if (specifiedSecondaryTablesSize() > 0) {
+ return;
+ }
+ ListIterator<IJavaSecondaryTable> javaSecondaryTables = javaEntity().secondaryTables();
+ while(javaSecondaryTables.hasNext()) {
+ IJavaSecondaryTable javaSecondaryTable = javaSecondaryTables.next();
+ if (javaSecondaryTable.getName() != null) {
+ //TODO calling setters during initialize in createVirtualSecondaryTable
+ //I think this is going to be a problem
+ this.virtualSecondaryTables.add(createVirtualSecondaryTable(javaSecondaryTable));
+ }
+ }
+ }
+
+ protected void initializeTableGenerator(Entity entity) {
+ if (entity.getTableGenerator() != null) {
+ this.tableGenerator = new XmlTableGenerator(this);
+ this.tableGenerator.initialize(entity.getTableGenerator());
+ }
+ }
+
+ protected void initializeSequenceGenerator(Entity entity) {
+ if (entity.getSequenceGenerator() != null) {
+ this.sequenceGenerator = new XmlSequenceGenerator(this);
+ this.sequenceGenerator.initialize(entity.getSequenceGenerator());
+ }
+ }
+
+ protected void initializeSpecifiedPrimaryKeyJoinColumns(Entity entity) {
+ for (PrimaryKeyJoinColumn primaryKeyJoinColumn : entity.getPrimaryKeyJoinColumns()) {
+ this.specifiedPrimaryKeyJoinColumns.add(createPrimaryKeyJoinColumn(primaryKeyJoinColumn));
+ }
+ }
+
+ protected void initializeSpecifiedAttributeOverrides(Entity entity) {
+ for (AttributeOverride attributeOverride : entity.getAttributeOverrides()) {
+ this.specifiedAttributeOverrides.add(createAttributeOverride(attributeOverride));
+ }
+ }
+
+ protected void initializeSpecifiedAssociationOverrides(Entity entity) {
+ for (AssociationOverride associationOverride : entity.getAssociationOverrides()) {
+ this.specifiedAssociationOverrides.add(createAssociationOverride(associationOverride));
+ }
+ }
+
+ protected void initializeNamedQueries(Entity entity) {
+ for (NamedQuery namedQuery : entity.getNamedQueries()) {
+ this.namedQueries.add(createNamedQuery(namedQuery));
+ }
+ }
+
+ protected void initializeNamedNativeQueries(Entity entity) {
+ for (NamedNativeQuery namedNativeQuery : entity.getNamedNativeQueries()) {
+ this.namedNativeQueries.add(createNamedNativeQuery(namedNativeQuery));
+ }
+ }
+
+ protected void initializeIdClass(IdClass idClassResource) {
+ this.idClass = this.idClass(idClassResource);
+ }
+
+ protected String idClass(IdClass idClassResource) {
+ return idClassResource == null ? null : idClassResource.getClassName();
+ }
+
+ @Override
+ public void update(Entity entity) {
+ super.update(entity);
+ this.setSpecifiedName(entity.getName());
+ this.setDefaultName(this.defaultName());
+ this.updateInheritance(this.inheritanceResource());
+ this.discriminatorColumn.update(entity);
+ this.setSpecifiedDiscriminatorValue(entity.getDiscriminatorValue());
+ this.setDefaultDiscriminatorValue(defaultDiscriminatorValue());
+ this.table.update(entity);
+ this.updateSpecifiedSecondaryTables(entity);
+ this.updateVirtualSecondaryTables();
+ this.updateSequenceGenerator(entity);
+ this.updateTableGenerator(entity);
+ this.updateSpecifiedPrimaryKeyJoinColumns(entity);
+ this.updateSpecifiedAttributeOverrides(entity);
+ this.updateSpecifiedAssociationOverrides(entity);
+ this.updateNamedQueries(entity);
+ this.updateNamedNativeQueries(entity);
+ this.updateIdClass(this.idClassResource());
+ }
+
+ protected String defaultName() {
+ //TODO add a test where the underyling java has a name set @Entity(name="foo")
+ //just by having the entity specified in xml we are overriding that name setting
+ String className = getClass_();
+ if (className != null) {
+ return ClassTools.shortNameForClassNamed(className);
+ }
+ return null;
+ }
+
+ protected String defaultDiscriminatorValue() {
+ //TODO default discriminator value
+ return null;
+ }
+
+ protected void updateInheritance(Inheritance inheritanceResource) {
+ this.setSpecifiedInheritanceStrategy_(this.specifiedInheritanceStrategy(inheritanceResource));
+ this.setDefaultInheritanceStrategy(this.defaultInheritanceStrategy());
+ }
+
+ protected void updateSpecifiedSecondaryTables(Entity entity) {
+ ListIterator<XmlSecondaryTable> secondaryTables = specifiedSecondaryTables();
+ ListIterator<SecondaryTable> resourceSecondaryTables = entity.getSecondaryTables().listIterator();
+
+ while (secondaryTables.hasNext()) {
+ XmlSecondaryTable secondaryTable = secondaryTables.next();
+ if (resourceSecondaryTables.hasNext()) {
+ secondaryTable.update(resourceSecondaryTables.next());
+ }
+ else {
+ removeSpecifiedSecondaryTable(secondaryTable);
+ }
+ }
+
+ while (resourceSecondaryTables.hasNext()) {
+ addSpecifiedSecondaryTable(specifiedSecondaryTablesSize(), createSecondaryTable(resourceSecondaryTables.next()));
+ }
+ }
+
+ //if any secondary-tables are specified in the xml file, then all of the java secondaryTables are overriden
+ protected void updateVirtualSecondaryTables() {
+ ListIterator<XmlSecondaryTable> secondaryTables = virtualSecondaryTables();
+ ListIterator<IJavaSecondaryTable> javaSecondaryTables = EmptyListIterator.instance();
+
+ if (javaEntity() != null && !isMetadataComplete() && specifiedSecondaryTablesSize() == 0) {
+ javaSecondaryTables = javaEntity().secondaryTables();
+ }
+ while (secondaryTables.hasNext()) {
+ XmlSecondaryTable virtualSecondaryTable = secondaryTables.next();
+ if (javaSecondaryTables.hasNext()) {
+ IJavaSecondaryTable javaSecondaryTable = javaSecondaryTables.next();
+ virtualSecondaryTable.setDefaultName(javaSecondaryTable.getName());
+ virtualSecondaryTable.setDefaultCatalog(javaSecondaryTable.getCatalog());
+ virtualSecondaryTable.setDefaultSchema(javaSecondaryTable.getSchema());
+ //TODO what about pkJoinColumns?
+ }
+ else {
+ removeVirtualSecondaryTable(virtualSecondaryTable);
+ }
+ }
+
+ while (javaSecondaryTables.hasNext()) {
+ IJavaSecondaryTable javaSecondaryTable = javaSecondaryTables.next();
+ addVirtualSecondaryTable(createVirtualSecondaryTable(javaSecondaryTable));
+ }
+ }
+
+ protected XmlSecondaryTable createSecondaryTable(SecondaryTable secondaryTable) {
+ XmlSecondaryTable xmlSecondaryTable = new XmlSecondaryTable(this);
+ xmlSecondaryTable.initialize(secondaryTable);
+ return xmlSecondaryTable;
+ }
+
+ protected XmlSecondaryTable createVirtualSecondaryTable(IJavaSecondaryTable javaSecondaryTable) {
+ XmlSecondaryTable virutalSecondaryTable = new XmlSecondaryTable(this);
+ virutalSecondaryTable.setDefaultName(javaSecondaryTable.getName());
+ virutalSecondaryTable.setDefaultCatalog(javaSecondaryTable.getCatalog());
+ virutalSecondaryTable.setDefaultSchema(javaSecondaryTable.getSchema());
+ //TODO what about primaryKeyJoinColumns, would you want to see those in the orm.xml ui??
+ return virutalSecondaryTable;
+ }
+
+ protected void updateTableGenerator(Entity entity) {
+ if (entity.getTableGenerator() == null) {
+ if (getTableGenerator() != null) {
+ setTableGenerator(null);
+ }
+ }
+ else {
+ if (getTableGenerator() == null) {
+ setTableGenerator(new XmlTableGenerator(this));
+ getTableGenerator().initialize(entity.getTableGenerator());
+ }
+ else {
+ getTableGenerator().update(entity.getTableGenerator());
+ }
+ }
+ }
+
+ protected void updateSequenceGenerator(Entity entity) {
+ if (entity.getSequenceGenerator() == null) {
+ if (getSequenceGenerator() != null) {
+ setSequenceGenerator(null);
+ }
+ }
+ else {
+ if (getSequenceGenerator() == null) {
+ setSequenceGenerator(new XmlSequenceGenerator(this));
+ getSequenceGenerator().initialize(entity.getSequenceGenerator());
+ }
+ else {
+ getSequenceGenerator().update(entity.getSequenceGenerator());
+ }
+ }
+ }
+
+ protected InheritanceType specifiedInheritanceStrategy(Inheritance inheritanceResource) {
+ if (inheritanceResource == null) {
+ return null;
+ }
+ return InheritanceType.fromOrmResourceModel(inheritanceResource.getStrategy());
+ }
+
+ protected InheritanceType defaultInheritanceStrategy() {
+ if (inheritanceResource() == null && !isMetadataComplete()) {
+ if (javaEntity() != null) {
+ return javaEntity().getInheritanceStrategy();
+ }
+ }
+ if (rootEntity() == this) {
+ return InheritanceType.SINGLE_TABLE;
+ }
+ return rootEntity().getInheritanceStrategy();
+ }
+
+ protected void updateSpecifiedPrimaryKeyJoinColumns(Entity entity) {
+ ListIterator<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns = specifiedPrimaryKeyJoinColumns();
+ ListIterator<PrimaryKeyJoinColumn> resourcePrimaryKeyJoinColumns = entity.getPrimaryKeyJoinColumns().listIterator();
+
+ while (primaryKeyJoinColumns.hasNext()) {
+ XmlPrimaryKeyJoinColumn primaryKeyJoinColumn = primaryKeyJoinColumns.next();
+ if (resourcePrimaryKeyJoinColumns.hasNext()) {
+ primaryKeyJoinColumn.update(resourcePrimaryKeyJoinColumns.next());
+ }
+ else {
+ removeSpecifiedPrimaryKeyJoinColumn(primaryKeyJoinColumn);
+ }
+ }
+
+ while (resourcePrimaryKeyJoinColumns.hasNext()) {
+ addSpecifiedPrimaryKeyJoinColumn(specifiedPrimaryKeyJoinColumnsSize(), createPrimaryKeyJoinColumn(resourcePrimaryKeyJoinColumns.next()));
+ }
+ }
+
+ protected XmlPrimaryKeyJoinColumn createPrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumn) {
+ XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = new XmlPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner());
+ xmlPrimaryKeyJoinColumn.initialize(primaryKeyJoinColumn);
+ return xmlPrimaryKeyJoinColumn;
+ }
+
+ protected void updateSpecifiedAttributeOverrides(Entity entity) {
+ ListIterator<XmlAttributeOverride> attributeOverrides = specifiedAttributeOverrides();
+ ListIterator<AttributeOverride> resourceAttributeOverrides = entity.getAttributeOverrides().listIterator();
+
+ while (attributeOverrides.hasNext()) {
+ XmlAttributeOverride attributeOverride = attributeOverrides.next();
+ if (resourceAttributeOverrides.hasNext()) {
+ attributeOverride.update(resourceAttributeOverrides.next());
+ }
+ else {
+ removeSpecifiedAttributeOverride(attributeOverride);
+ }
+ }
+
+ while (resourceAttributeOverrides.hasNext()) {
+ addSpecifiedAttributeOverride(specifiedAttributeOverridesSize(), createAttributeOverride(resourceAttributeOverrides.next()));
+ }
+ }
+
+ protected XmlAttributeOverride createAttributeOverride(AttributeOverride attributeOverride) {
+ XmlAttributeOverride xmlAttributeOverride = new XmlAttributeOverride(this, createAttributeOverrideOwner());
+ xmlAttributeOverride.initialize(attributeOverride);
+ return xmlAttributeOverride;
+ }
+
+ protected IOverride.Owner createAttributeOverrideOwner() {
+ return new AttributeOverrideOwner();
+ }
+
+ protected void updateSpecifiedAssociationOverrides(Entity entity) {
+ ListIterator<XmlAssociationOverride> associationOverrides = specifiedAssociationOverrides();
+ ListIterator<AssociationOverride> resourceAssociationOverrides = entity.getAssociationOverrides().listIterator();
+
+ while (associationOverrides.hasNext()) {
+ XmlAssociationOverride associationOverride = associationOverrides.next();
+ if (resourceAssociationOverrides.hasNext()) {
+ associationOverride.update(resourceAssociationOverrides.next());
+ }
+ else {
+ removeSpecifiedAssociationOverride(associationOverride);
+ }
+ }
+
+ while (resourceAssociationOverrides.hasNext()) {
+ addSpecifiedAssociationOverride(specifiedAssociationOverridesSize(), createAssociationOverride(resourceAssociationOverrides.next()));
+ }
+ }
+
+ protected XmlAssociationOverride createAssociationOverride(AssociationOverride associationOverride) {
+ XmlAssociationOverride xmlAssociationOverride = new XmlAssociationOverride(this, createAssociationOverrideOwner());
+ xmlAssociationOverride.initialize(associationOverride);
+ return xmlAssociationOverride;
+ }
+
+ protected IOverride.Owner createAssociationOverrideOwner() {
+ return new AssociationOverrideOwner();
+ }
+
+ protected void updateNamedQueries(Entity entity) {
+ ListIterator<XmlNamedQuery> namedQueries = namedQueries();
+ ListIterator<NamedQuery> resourceNamedQueries = entity.getNamedQueries().listIterator();
+
+ while (namedQueries.hasNext()) {
+ XmlNamedQuery namedQuery = namedQueries.next();
+ if (resourceNamedQueries.hasNext()) {
+ namedQuery.update(resourceNamedQueries.next());
+ }
+ else {
+ removeNamedQuery(namedQuery);
+ }
+ }
+
+ while (resourceNamedQueries.hasNext()) {
+ addNamedQuery(namedQueriesSize(), createNamedQuery(resourceNamedQueries.next()));
+ }
+ }
+
+ protected XmlNamedQuery createNamedQuery(NamedQuery namedQuery) {
+ XmlNamedQuery xmlNamedQuery = new XmlNamedQuery(this);
+ xmlNamedQuery.initialize(namedQuery);
+ return xmlNamedQuery;
+ }
+
+ protected void updateNamedNativeQueries(Entity entity) {
+ ListIterator<XmlNamedNativeQuery> namedNativeQueries = namedNativeQueries();
+ ListIterator<NamedNativeQuery> resourceNamedNativeQueries = entity.getNamedNativeQueries().listIterator();
+
+ while (namedNativeQueries.hasNext()) {
+ XmlNamedNativeQuery namedQuery = namedNativeQueries.next();
+ if (resourceNamedNativeQueries.hasNext()) {
+ namedQuery.update(resourceNamedNativeQueries.next());
+ }
+ else {
+ removeNamedNativeQuery(namedQuery);
+ }
+ }
+
+ while (resourceNamedNativeQueries.hasNext()) {
+ addNamedNativeQuery(namedQueriesSize(), createNamedNativeQuery(resourceNamedNativeQueries.next()));
+ }
+ }
+
+ protected XmlNamedNativeQuery createNamedNativeQuery(NamedNativeQuery namedQuery) {
+ XmlNamedNativeQuery xmlNamedNativeQuery = new XmlNamedNativeQuery(this);
+ xmlNamedNativeQuery.initialize(namedQuery);
+ return xmlNamedNativeQuery;
+ }
+
+ protected void updateIdClass(IdClass idClassResource) {
+ this.setIdClass_(this.idClass(idClassResource));
+ }
+
+
+ public String primaryKeyColumnName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlNamedQuery> namedQueries() {
+ return new CloneListIterator<XmlNamedQuery>(this.namedQueries);
+ }
+
+ public int namedQueriesSize() {
+ return this.namedQueries.size();
+ }
+
+ public XmlNamedQuery addNamedQuery(int index) {
+ XmlNamedQuery namedQuery = new XmlNamedQuery(this);
+ this.namedQueries.add(index, namedQuery);
+ this.typeMappingResource().getNamedQueries().add(index, OrmFactory.eINSTANCE.createNamedQuery());
+ this.fireItemAdded(IEntity.NAMED_QUERIES_LIST, index, namedQuery);
+ return namedQuery;
+ }
+
+ protected void addNamedQuery(int index, XmlNamedQuery namedQuery) {
+ addItemToList(index, namedQuery, this.namedQueries, IEntity.NAMED_QUERIES_LIST);
+ }
+
+ public void removeNamedQuery(int index) {
+ XmlNamedQuery namedQuery = this.namedQueries.remove(index);
+ this.typeMappingResource().getNamedQueries().remove(index);
+ fireItemRemoved(IEntity.NAMED_QUERIES_LIST, index, namedQuery);
+ }
+
+ protected void removeNamedQuery(XmlNamedQuery namedQuery) {
+ removeItemFromList(namedQuery, this.namedQueries, IEntity.NAMED_QUERIES_LIST);
+ }
+
+ public void moveNamedQuery(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.namedQueries, targetIndex, sourceIndex);
+ this.typeMappingResource().getNamedQueries().move(targetIndex, sourceIndex);
+ fireItemMoved(IEntity.NAMED_QUERIES_LIST, targetIndex, sourceIndex);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlNamedNativeQuery> namedNativeQueries() {
+ return new CloneListIterator<XmlNamedNativeQuery>(this.namedNativeQueries);
+ }
+
+ public int namedNativeQueriesSize() {
+ return this.namedNativeQueries.size();
+ }
+
+ public XmlNamedNativeQuery addNamedNativeQuery(int index) {
+ XmlNamedNativeQuery namedNativeQuery = new XmlNamedNativeQuery(this);
+ this.namedNativeQueries.add(index, namedNativeQuery);
+ this.typeMappingResource().getNamedNativeQueries().add(index, OrmFactory.eINSTANCE.createNamedNativeQuery());
+ this.fireItemAdded(IEntity.NAMED_QUERIES_LIST, index, namedNativeQuery);
+ return namedNativeQuery;
+ }
+
+ protected void addNamedNativeQuery(int index, XmlNamedNativeQuery namedNativeQuery) {
+ addItemToList(index, namedNativeQuery, this.namedNativeQueries, IEntity.NAMED_NATIVE_QUERIES_LIST);
+ }
+
+ public void removeNamedNativeQuery(int index) {
+ XmlNamedNativeQuery namedNativeQuery = this.namedNativeQueries.remove(index);
+ this.typeMappingResource().getNamedNativeQueries().remove(index);
+ fireItemRemoved(IEntity.NAMED_QUERIES_LIST, index, namedNativeQuery);
+ }
+
+ protected void removeNamedNativeQuery(XmlNamedNativeQuery namedNativeQuery) {
+ removeItemFromList(namedNativeQuery, this.namedNativeQueries, IEntity.NAMED_NATIVE_QUERIES_LIST);
+ }
+
+ public void moveNamedNativeQuery(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.namedNativeQueries, targetIndex, sourceIndex);
+ this.typeMappingResource().getNamedNativeQueries().move(targetIndex, sourceIndex);
+ fireItemMoved(IEntity.NAMED_NATIVE_QUERIES_LIST, targetIndex, sourceIndex);
+ }
+
+ public IColumnMapping columnMapping(String attributeName) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isVirtual(IOverride override) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ //********** Validation **************************
+
+ @Override
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+ table.addToMessages(messages, astRoot);
+ addIdMessages(messages, astRoot);
+
+
+ for (XmlSecondaryTable context : specifiedSecondaryTables) {
+ context.addToMessages(messages, astRoot);
+ }
+
+ for (Iterator<XmlAttributeOverride> stream = this.attributeOverrides(); stream.hasNext();) {
+ stream.next().addToMessages(messages, astRoot);
+ }
+
+ for (Iterator<XmlAssociationOverride> stream = this.associationOverrides(); stream.hasNext();) {
+ stream.next().addToMessages(messages, astRoot);
+ }
+
+ }
+
+ protected void addIdMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ addNoIdMessage(messages, astRoot);
+
+ }
+
+ protected void addNoIdMessage(List<IMessage> messages, CompilationUnit astRoot) {
+ if (entityHasNoId()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.ENTITY_NO_ID,
+ new String[] {this.getName()},
+ this, this.validationTextRange(astRoot))
+ );
+ }
+ }
+
+ private boolean entityHasNoId() {
+ return ! this.entityHasId();
+ }
+
+ private boolean entityHasId() {
+ for (Iterator<IPersistentAttribute> stream = this.persistentType().allAttributes(); stream.hasNext(); ) {
+ if (stream.next().isIdAttribute()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ITypeMapping typeMapping() {
+ return this;
+ }
+
+ @Override
+ public void removeFromResourceModel(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ entityMappings.getEntities().remove(this.typeMappingResource());
+ }
+
+ @Override
+ public Entity addToResourceModel(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ Entity entity = OrmFactory.eINSTANCE.createEntity();
+ persistentType().initialize(entity);
+ entityMappings.getEntities().add(entity);
+ return entity;
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ super.toString(sb);
+ sb.append(getName());
+ }
+
+ class PrimaryKeyJoinColumnOwner implements IAbstractJoinColumn.Owner
+ {
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ return XmlEntity.this.validationTextRange(astRoot);
+ }
+
+ public ITypeMapping typeMapping() {
+ return XmlEntity.this;
+ }
+
+ public Table dbTable(String tableName) {
+ return XmlEntity.this.dbTable(tableName);
+ }
+
+ public Table dbReferencedColumnTable() {
+ IEntity parentEntity = XmlEntity.this.parentEntity();
+ return (parentEntity == null) ? null : parentEntity.primaryDbTable();
+ }
+
+ public int joinColumnsSize() {
+ return CollectionTools.size(XmlEntity.this.primaryKeyJoinColumns());
+ }
+
+ public boolean isVirtual(IAbstractJoinColumn joinColumn) {
+ return XmlEntity.this.defaultPrimaryKeyJoinColumns.contains(joinColumn);
+ }
+
+ public String defaultColumnName() {
+ if (joinColumnsSize() != 1) {
+ return null;
+ }
+ return XmlEntity.this.parentEntity().primaryKeyColumnName();
+ }
+ }
+
+ class AttributeOverrideOwner implements IOverride.Owner {
+
+ public IColumnMapping columnMapping(String attributeName) {
+ if (attributeName == null) {
+ return null;
+ }
+ for (Iterator<IPersistentAttribute> stream = persistentType().allAttributes(); stream.hasNext();) {
+ IPersistentAttribute persAttribute = stream.next();
+ if (attributeName.equals(persAttribute.getName())) {
+ if (persAttribute.getMapping() instanceof IColumnMapping) {
+ return (IColumnMapping) persAttribute.getMapping();
+ }
+ }
+ }
+ return null;
+ }
+
+ public boolean isVirtual(IOverride override) {
+ return XmlEntity.this.defaultAttributeOverrides.contains(override);
+ }
+
+ public ITypeMapping typeMapping() {
+ return XmlEntity.this;
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ }
+
+ class AssociationOverrideOwner implements IOverride.Owner {
+
+ public IColumnMapping columnMapping(String attributeName) {
+ if (attributeName == null) {
+ return null;
+ }
+ for (Iterator<IPersistentAttribute> stream = persistentType().allAttributes(); stream.hasNext();) {
+ IPersistentAttribute persAttribute = stream.next();
+ if (attributeName.equals(persAttribute.getName())) {
+ if (persAttribute.getMapping() instanceof IColumnMapping) {
+ return (IColumnMapping) persAttribute.getMapping();
+ }
+ }
+ }
+ return null;
+ }
+
+ public boolean isVirtual(IOverride override) {
+ return XmlEntity.this.defaultAssociationOverrides.contains(override);
+ }
+
+ public ITypeMapping typeMapping() {
+ return XmlEntity.this;
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEntityProvider.java
index 05696fa549..b870fbc5e9 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlEntityProvider.java
@@ -7,15 +7,17 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.context.orm;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
public class XmlEntityProvider implements IXmlTypeMappingProvider
{
- public XmlTypeMapping buildTypeMapping() {
- return OrmFactory.eINSTANCE.createXmlEntityInternal();
+ public XmlTypeMapping<Entity> buildTypeMapping(IJpaBaseContextFactory factory, XmlPersistentType parent) {
+ return factory.createXmlEntity(parent);
}
public String key() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlGeneratedValue.java
new file mode 100644
index 0000000000..757c3df083
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlGeneratedValue.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.GenerationType;
+import org.eclipse.jpt.core.internal.context.base.IGeneratedValue;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.GeneratedValue;
+
+public class XmlGeneratedValue extends JpaContextNode implements IGeneratedValue
+{
+
+ protected GenerationType specifiedStrategy;
+
+ protected String specifiedGenerator;
+ protected String defaultGenerator;
+
+ protected GeneratedValue generatedValue;
+
+ protected XmlGeneratedValue(IJpaContextNode parent) {
+ super(parent);
+ }
+
+
+ public GenerationType getStrategy() {
+ return (this.getSpecifiedStrategy() == null) ? this.getDefaultStrategy() : this.getSpecifiedStrategy();
+ }
+
+ public GenerationType getDefaultStrategy() {
+ return IGeneratedValue.DEFAULT_STRATEGY;
+ }
+
+ public GenerationType getSpecifiedStrategy() {
+ return this.specifiedStrategy;
+ }
+
+ public void setSpecifiedStrategy(GenerationType newSpecifiedStrategy) {
+ GenerationType oldStrategy = this.specifiedStrategy;
+ this.specifiedStrategy = newSpecifiedStrategy;
+ this.generatedValue.setStrategy(GenerationType.toOrmResourceModel(newSpecifiedStrategy));
+ firePropertyChanged(SPECIFIED_STRATEGY_PROPERTY, oldStrategy, newSpecifiedStrategy);
+ }
+
+ public String getGenerator() {
+ return (this.getSpecifiedGenerator() == null) ? this.getDefaultGenerator() : this.getSpecifiedGenerator();
+ }
+
+ public String getDefaultGenerator() {
+ return this.defaultGenerator;
+ }
+
+ protected void setDefaultGenerator(String newDefaultGenerator) {
+ String oldGenerator = this.defaultGenerator;
+ this.defaultGenerator = newDefaultGenerator;
+ firePropertyChanged(DEFAULT_GENERATOR_PROPERTY, oldGenerator, newDefaultGenerator);
+ }
+
+ public String getSpecifiedGenerator() {
+ return this.specifiedGenerator;
+ }
+
+ public void setSpecifiedGenerator(String newSpecifiedGenerator) {
+ String oldGenerator = this.specifiedGenerator;
+ this.specifiedGenerator = newSpecifiedGenerator;
+ this.generatedValue.setGenerator(newSpecifiedGenerator);
+ firePropertyChanged(SPECIFIED_GENERATOR_PROPERTY, oldGenerator, newSpecifiedGenerator);
+ }
+
+ public ITextRange generatorTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+// public ITextRange generatorTextRange() {
+// if (node == null) {
+// return ((XmlEObject) eContainer()).validationTextRange();
+// }
+// IDOMNode nameNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.GENERATED_VALUE__GENERATOR);
+// return (nameNode == null) ? validationTextRange() : buildTextRange(nameNode);
+// }
+
+ // ********** resource model -> java context model **********
+
+ public void initialize(GeneratedValue generatedValue) {
+ this.generatedValue = generatedValue;
+ this.specifiedStrategy = this.strategy(generatedValue);
+ this.specifiedGenerator = this.generator(generatedValue);
+ //TODO
+ this.defaultGenerator = null;
+ }
+
+ public void update(GeneratedValue generatedValue) {
+ this.generatedValue = generatedValue;
+ this.setSpecifiedStrategy(this.strategy(generatedValue));
+ this.setSpecifiedGenerator(this.generator(generatedValue));
+ //TODO
+ this.setDefaultGenerator(null);
+ }
+
+ protected GenerationType strategy(GeneratedValue generatedValue) {
+ return GenerationType.fromOrmResourceModel(generatedValue.getStrategy());
+ }
+
+ protected String generator(GeneratedValue generatedValue) {
+ return generatedValue.getGenerator();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlGenerator.java
new file mode 100644
index 0000000000..94d0838dc0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlGenerator.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.context.base.IGenerator;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.Generator;
+
+
+public abstract class XmlGenerator<T extends Generator> extends JpaContextNode implements IGenerator
+{
+
+ protected String name;
+
+ protected Integer specifiedInitialValue;
+ protected Integer defaultInitialValue;
+
+ protected Integer specifiedAllocationSize;
+ protected Integer defaultAllocationSize;
+
+ protected T generatorResource;
+
+ protected XmlGenerator(IJpaContextNode parent) {
+ super(parent);
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ generatorResource().setName(newName);
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public Integer getInitialValue() {
+ return (this.getSpecifiedInitialValue() == null) ? this.getDefaultInitialValue() : this.getSpecifiedInitialValue();
+ }
+
+ public Integer getSpecifiedInitialValue() {
+ return this.specifiedInitialValue;
+ }
+
+ public void setSpecifiedInitialValue(Integer newSpecifiedInitialValue) {
+ Integer oldSpecifiedInitialValue = this.specifiedInitialValue;
+ this.specifiedInitialValue = newSpecifiedInitialValue;
+ generatorResource().setInitialValue(newSpecifiedInitialValue);
+ firePropertyChanged(SPECIFIED_INITIAL_VALUE_PROPERTY, oldSpecifiedInitialValue, newSpecifiedInitialValue);
+ }
+
+ public Integer getDefaultInitialValue() {
+ return this.defaultInitialValue;
+ }
+
+ protected void setDefaultInitialValue(Integer newDefaultInitialValue) {
+ Integer oldSpecifiedInitialValue = this.defaultInitialValue;
+ this.defaultInitialValue = newDefaultInitialValue;
+ firePropertyChanged(DEFAULT_INITIAL_VALUE_PROPERTY, oldSpecifiedInitialValue, newDefaultInitialValue);
+ }
+
+ public Integer getAllocationSize() {
+ return (this.getSpecifiedAllocationSize() == null) ? this.getDefaultAllocationSize() : this.getSpecifiedAllocationSize();
+ }
+
+ public Integer getSpecifiedAllocationSize() {
+ return this.specifiedAllocationSize;
+ }
+
+ public void setSpecifiedAllocationSize(Integer newSpecifiedAllocationSize) {
+ Integer oldSpecifiedAllocationSize = this.specifiedAllocationSize;
+ this.specifiedAllocationSize = newSpecifiedAllocationSize;
+ generatorResource().setAllocationSize(newSpecifiedAllocationSize);
+ firePropertyChanged(SPECIFIED_ALLOCATION_SIZE_PROPERTY, oldSpecifiedAllocationSize, newSpecifiedAllocationSize);
+ }
+
+ public Integer getDefaultAllocationSize() {
+ return this.defaultAllocationSize;
+ }
+
+ protected void setDefaultAllocationSize(Integer newDefaultAllocationSize) {
+ Integer oldSpecifiedAllocationSize = this.defaultAllocationSize;
+ this.defaultAllocationSize = newDefaultAllocationSize;
+ firePropertyChanged(DEFAULT_ALLOCATION_SIZE_PROPERTY, oldSpecifiedAllocationSize, newDefaultAllocationSize);
+ }
+
+
+ public void initialize(T generatorResource) {
+ this.generatorResource = generatorResource;
+ this.name = this.name(generatorResource);
+ this.specifiedInitialValue = this.specifiedInitialValue(generatorResource);
+ this.specifiedAllocationSize = this.specifiedAllocationSize(generatorResource);
+ //TODO defaults
+ }
+
+ public void update(T generatorResource) {
+ this.generatorResource = generatorResource;
+ this.setName(this.name(generatorResource));
+ this.setSpecifiedInitialValue(this.specifiedInitialValue(generatorResource));
+ this.setSpecifiedAllocationSize(this.specifiedAllocationSize(generatorResource));
+ //TODO defaults
+ }
+
+ protected T generatorResource() {
+ return this.generatorResource;
+ }
+
+ protected String name(Generator generatorResource) {
+ return generatorResource.getName();
+ }
+
+ protected Integer specifiedInitialValue(Generator generatorResource) {
+ return generatorResource.getInitialValue();
+ }
+
+ protected Integer specifiedAllocationSize(Generator generatorResource) {
+ return generatorResource.getAllocationSize();
+ }
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlIdMapping.java
new file mode 100644
index 0000000000..ef685e13c8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlIdMapping.java
@@ -0,0 +1,338 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IColumnMapping;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.TemporalType;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.Id;
+import org.eclipse.jpt.core.internal.resource.orm.IdImpl;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+import org.eclipse.jpt.db.internal.Table;
+
+
+public class XmlIdMapping extends XmlAttributeMapping<Id>
+ implements IIdMapping, IXmlColumnMapping
+{
+ protected final XmlColumn column;
+
+ protected XmlGeneratedValue generatedValue;
+
+ protected TemporalType temporal;
+
+ protected XmlTableGenerator tableGenerator;
+ protected XmlSequenceGenerator sequenceGenerator;
+
+
+ protected XmlIdMapping(XmlPersistentAttribute parent) {
+ super(parent);
+ this.column = new XmlColumn(this, this);
+ }
+
+ public XmlColumn getColumn() {
+ return this.column;
+ }
+
+ public TemporalType getTemporal() {
+ return this.temporal;
+ }
+
+ public void setTemporal(TemporalType newTemporal) {
+ TemporalType oldTemporal = this.temporal;
+ this.temporal = newTemporal;
+ this.attributeMapping().setTemporal(TemporalType.toOrmResourceModel(newTemporal));
+ firePropertyChanged(IColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+ }
+
+ protected void setTemporal_(TemporalType newTemporal) {
+ TemporalType oldTemporal = this.temporal;
+ this.temporal = newTemporal;
+ firePropertyChanged(IColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+ }
+
+ public XmlGeneratedValue addGeneratedValue() {
+ if (getGeneratedValue() != null) {
+ throw new IllegalStateException("gemeratedValue already exists");
+ }
+ this.generatedValue = new XmlGeneratedValue(this);
+ this.attributeMapping().setGeneratedValue(OrmFactory.eINSTANCE.createGeneratedValueImpl());
+ firePropertyChanged(GENERATED_VALUE_PROPERTY, null, this.generatedValue);
+ return this.generatedValue;
+ }
+
+ public void removeGeneratedValue() {
+ if (getGeneratedValue() == null) {
+ throw new IllegalStateException("gemeratedValue does not exist, cannot be removed");
+ }
+ XmlGeneratedValue oldGeneratedValue = this.generatedValue;
+ this.generatedValue = null;
+ this.attributeMapping().setGeneratedValue(null);
+ firePropertyChanged(GENERATED_VALUE_PROPERTY, oldGeneratedValue, null);
+ }
+
+ public XmlGeneratedValue getGeneratedValue() {
+ return this.generatedValue;
+ }
+
+ protected void setGeneratedValue(XmlGeneratedValue newGeneratedValue) {
+ XmlGeneratedValue oldGeneratedValue = this.generatedValue;
+ this.generatedValue = newGeneratedValue;
+ firePropertyChanged(GENERATED_VALUE_PROPERTY, oldGeneratedValue, newGeneratedValue);
+ }
+
+ public XmlSequenceGenerator addSequenceGenerator() {
+ if (getSequenceGenerator() != null) {
+ throw new IllegalStateException("sequenceGenerator already exists");
+ }
+ this.sequenceGenerator = new XmlSequenceGenerator(this);
+ this.attributeMapping().setSequenceGenerator(OrmFactory.eINSTANCE.createSequenceGeneratorImpl());
+ firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, null, this.sequenceGenerator);
+ return this.sequenceGenerator;
+ }
+
+ public void removeSequenceGenerator() {
+ if (getSequenceGenerator() == null) {
+ throw new IllegalStateException("sequenceGenerator does not exist, cannot be removed");
+ }
+ XmlSequenceGenerator oldSequenceGenerator = this.sequenceGenerator;
+ this.sequenceGenerator = null;
+ this.attributeMapping().setSequenceGenerator(null);
+ firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, oldSequenceGenerator, null);
+ }
+
+ public XmlSequenceGenerator getSequenceGenerator() {
+ return this.sequenceGenerator;
+ }
+
+ protected void setSequenceGenerator(XmlSequenceGenerator newSequenceGenerator) {
+ XmlSequenceGenerator oldSequenceGenerator = this.sequenceGenerator;
+ this.sequenceGenerator = newSequenceGenerator;
+ firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, oldSequenceGenerator, newSequenceGenerator);
+ }
+
+ public XmlTableGenerator addTableGenerator() {
+ if (getTableGenerator() != null) {
+ throw new IllegalStateException("tableGenerator already exists");
+ }
+ this.tableGenerator = new XmlTableGenerator(this);
+ this.attributeMapping().setTableGenerator(OrmFactory.eINSTANCE.createTableGeneratorImpl());
+ firePropertyChanged(TABLE_GENERATOR_PROPERTY, null, this.tableGenerator);
+ return this.tableGenerator;
+ }
+
+ public void removeTableGenerator() {
+ if (getTableGenerator() == null) {
+ throw new IllegalStateException("tableGenerator does not exist, cannot be removed");
+ }
+ XmlTableGenerator oldTableGenerator = this.tableGenerator;
+ this.tableGenerator = null;
+ this.attributeMapping().setTableGenerator(null);
+ firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, oldTableGenerator, null);
+ }
+
+ public XmlTableGenerator getTableGenerator() {
+ return this.tableGenerator;
+ }
+
+ protected void setTableGenerator(XmlTableGenerator newTableGenerator) {
+ XmlTableGenerator oldTableGenerator = this.tableGenerator;
+ this.tableGenerator = newTableGenerator;
+ if (newTableGenerator != null) {
+ this.attributeMapping().setTableGenerator(OrmFactory.eINSTANCE.createTableGeneratorImpl());
+ }
+ else {
+ this.attributeMapping().setTableGenerator(null);
+ }
+ firePropertyChanged(TABLE_GENERATOR_PROPERTY, oldTableGenerator, newTableGenerator);
+ }
+
+
+ public String getKey() {
+ return IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected void initializeOn(XmlAttributeMapping<? extends AttributeMapping> newMapping) {
+ newMapping.initializeFromXmlIdMapping(this);
+ }
+
+ @Override
+ public void initializeFromXmlBasicMapping(XmlBasicMapping oldMapping) {
+ super.initializeFromXmlBasicMapping(oldMapping);
+ setTemporal(oldMapping.getTemporal());
+ }
+
+ @Override
+ public int xmlSequence() {
+ return 0;
+ }
+
+ @Override
+ public String primaryKeyColumnName() {
+ return this.getColumn().getName();
+ }
+
+// public IGeneratedValue createGeneratedValue() {
+// return OrmFactory.eINSTANCE.createXmlGeneratedValue();
+// }
+//
+// public ISequenceGenerator createSequenceGenerator() {
+// return OrmFactory.eINSTANCE.createXmlSequenceGenerator();
+// }
+//
+// public ITableGenerator createTableGenerator() {
+// return OrmFactory.eINSTANCE.createXmlTableGenerator();
+// }
+
+ @Override
+ public boolean isOverridableAttributeMapping() {
+ return true;
+ }
+
+ @Override
+ public boolean isIdMapping() {
+ return true;
+ }
+
+ @Override
+ public Id addToResourceModel(TypeMapping typeMapping) {
+ IdImpl id = OrmFactory.eINSTANCE.createIdImpl();
+ typeMapping.getAttributes().getIds().add(id);
+ return id;
+ }
+
+ @Override
+ public void removeFromResourceModel(TypeMapping typeMapping) {
+ typeMapping.getAttributes().getIds().remove(this.attributeMapping());
+ if (typeMapping.getAttributes().isAllFeaturesUnset()) {
+ typeMapping.setAttributes(null);
+ }
+ }
+
+ public Table dbTable(String tableName) {
+ return typeMapping().dbTable(tableName);
+ }
+
+ public String defaultColumnName() {
+ return attributeName();
+ }
+
+ public String defaultTableName() {
+ return typeMapping().getTableName();
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void initialize(Id id) {
+ super.initialize(id);
+ this.temporal = this.specifiedTemporal(id);
+ this.column.initialize(id);
+ this.initializeSequenceGenerator(id);
+ this.initializeTableGenerator(id);
+ this.initializeGeneratedValue(id);
+ }
+
+ protected void initializeSequenceGenerator(Id id) {
+ if (id.getSequenceGenerator() != null) {
+ this.sequenceGenerator = new XmlSequenceGenerator(this);
+ this.sequenceGenerator.initialize(id.getSequenceGenerator());
+ }
+ }
+
+ protected void initializeTableGenerator(Id id) {
+ if (id.getTableGenerator() != null) {
+ this.tableGenerator = new XmlTableGenerator(this);
+ this.tableGenerator.initialize(id.getTableGenerator());
+ }
+ }
+
+ protected void initializeGeneratedValue(Id id) {
+ if (id.getGeneratedValue() != null) {
+ this.generatedValue = new XmlGeneratedValue(this);
+ this.generatedValue.initialize(id.getGeneratedValue());
+ }
+ }
+
+ @Override
+ public void update(Id id) {
+ super.update(id);
+ this.setTemporal_(this.specifiedTemporal(id));
+ this.column.update(id);
+ this.updateSequenceGenerator(id);
+ this.updateTableGenerator(id);
+ this.updateGeneratedValue(id);
+ }
+
+ protected void updateSequenceGenerator(Id id) {
+ if (id.getSequenceGenerator() == null) {
+ if (getSequenceGenerator() != null) {
+ setSequenceGenerator(null);
+ }
+ }
+ else {
+ if (getSequenceGenerator() == null) {
+ setSequenceGenerator(new XmlSequenceGenerator(this));
+ getSequenceGenerator().initialize(id.getSequenceGenerator());
+ }
+ else {
+ getSequenceGenerator().update(id.getSequenceGenerator());
+ }
+ }
+ }
+
+ protected void updateTableGenerator(Id id) {
+ if (id.getTableGenerator() == null) {
+ if (getTableGenerator() != null) {
+ setTableGenerator(null);
+ }
+ }
+ else {
+ if (getTableGenerator() == null) {
+ setTableGenerator(new XmlTableGenerator(this));
+ getTableGenerator().initialize(id.getTableGenerator());
+ }
+ else {
+ getTableGenerator().update(id.getTableGenerator());
+ }
+ }
+ }
+
+ protected void updateGeneratedValue(Id id) {
+ if (id.getGeneratedValue() == null) {
+ if (getGeneratedValue() != null) {
+ setGeneratedValue(null);
+ }
+ }
+ else {
+ if (getGeneratedValue() == null) {
+ setGeneratedValue(new XmlGeneratedValue(this));
+ getGeneratedValue().initialize(id.getGeneratedValue());
+ }
+ else {
+ getGeneratedValue().update(id.getGeneratedValue());
+ }
+ }
+ }
+
+
+ protected TemporalType specifiedTemporal(Id id) {
+ return TemporalType.fromOrmResourceModel(id.getTemporal());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlIdProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlIdMappingProvider.java
index aaf75f91c0..c9d25b6163 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlIdProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlIdMappingProvider.java
@@ -7,14 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.context.orm;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
-public class XmlIdProvider implements IXmlAttributeMappingProvider
+public class XmlIdMappingProvider implements IXmlAttributeMappingProvider
{
// singleton
- private static final XmlIdProvider INSTANCE = new XmlIdProvider();
+ private static final XmlIdMappingProvider INSTANCE = new XmlIdMappingProvider();
/**
* Return the singleton.
@@ -26,15 +27,14 @@ public class XmlIdProvider implements IXmlAttributeMappingProvider
/**
* Ensure non-instantiability.
*/
- private XmlIdProvider() {
+ private XmlIdMappingProvider() {
super();
}
-
- public XmlAttributeMapping buildAttributeMapping() {
- return OrmFactory.eINSTANCE.createXmlId();
- }
-
public String key() {
return IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
}
+
+ public XmlIdMapping buildAttributeMapping(IJpaBaseContextFactory factory, XmlPersistentAttribute parent) {
+ return new XmlIdMapping(parent);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlJoinColumn.java
new file mode 100644
index 0000000000..a64f0e50dc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlJoinColumn.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.JoinColumn;
+import org.eclipse.jpt.db.internal.Column;
+import org.eclipse.jpt.db.internal.Table;
+
+public class XmlJoinColumn extends AbstractXmlColumn<JoinColumn> implements IJoinColumn
+{
+
+ protected String specifiedReferencedColumnName;
+
+ protected String defaultReferencedColumnName;
+
+ protected JoinColumn joinColumn;
+
+ protected XmlJoinColumn(IJpaContextNode parent, IJoinColumn.Owner owner) {
+ super(parent, owner);
+ }
+
+ public String getReferencedColumnName() {
+ return (this.getSpecifiedReferencedColumnName() == null) ? getDefaultReferencedColumnName() : this.getSpecifiedReferencedColumnName();
+ }
+
+ public String getSpecifiedReferencedColumnName() {
+ return this.specifiedReferencedColumnName;
+ }
+
+ public void setSpecifiedReferencedColumnName(String newSpecifiedReferencedColumnName) {
+ String oldSpecifiedReferencedColumnName = this.specifiedReferencedColumnName;
+ this.specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
+ columnResource().setReferencedColumnName(newSpecifiedReferencedColumnName);
+ firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, oldSpecifiedReferencedColumnName, newSpecifiedReferencedColumnName);
+ }
+
+ public void setSpecifiedReferencedColumnName_(String newSpecifiedReferencedColumnName) {
+ String oldSpecifiedReferencedColumnName = this.specifiedReferencedColumnName;
+ this.specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
+ firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, oldSpecifiedReferencedColumnName, newSpecifiedReferencedColumnName);
+ }
+
+ public String getDefaultReferencedColumnName() {
+ return this.defaultReferencedColumnName;
+ }
+
+ protected void setDefaultReferencedColumnName(String newDefaultReferencedColumnName) {
+ String oldDefaultReferencedColumnName = this.defaultReferencedColumnName;
+ this.defaultReferencedColumnName = newDefaultReferencedColumnName;
+ firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, oldDefaultReferencedColumnName, newDefaultReferencedColumnName);
+ }
+
+ public boolean isVirtual() {
+ return owner().isVirtual(this);
+ }
+
+ @Override
+ public IJoinColumn.Owner owner() {
+ return (IJoinColumn.Owner) this.owner;
+ }
+
+ public Table dbReferencedColumnTable() {
+ return owner().dbReferencedColumnTable();
+ }
+
+ public Column dbReferencedColumn() {
+ Table table = dbReferencedColumnTable();
+ return (table == null) ? null : table.columnNamed(getReferencedColumnName());
+ }
+
+ public boolean isReferencedColumnResolved() {
+ return dbReferencedColumn() != null;
+ }
+//
+// public ITextRange referencedColumnNameTextRange() {
+// if (node == null) {
+// return owner.validationTextRange();
+// }
+// IDOMNode referencedColumnNameNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.REFERENCED_COLUMN_NAME);
+// return (referencedColumnNameNode == null) ? validationTextRange() : buildTextRange(referencedColumnNameNode);
+// }
+//
+// public void refreshDefaults(DefaultsContext defaultsContext) {
+// setDefaultReferencedColumnName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_REFERENCED_COLUMN_NAME_KEY));
+// setDefaultName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_NAME_KEY));
+// setDefaultTable((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_TABLE_KEY));
+// }
+
+ @Override
+ protected JoinColumn columnResource() {
+ return this.joinColumn;
+ }
+
+ @Override
+ protected void addColumnResource() {
+ //joinColumns are part of a collection, the join-column element will be removed/added
+ //when the XmlJoinColumn is removed/added to the XmlEntity collection
+ }
+
+ @Override
+ protected void removeColumnResource() {
+ //joinColumns are part of a collection, the pk-join-column element will be removed/added
+ //when the XmlJoinColumn is removed/added to the XmlEntity collection
+ }
+
+ public ITextRange referencedColumnNameTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ @Override
+ protected void initialize(JoinColumn column) {
+ this.joinColumn = column;
+ super.initialize(column);
+ this.specifiedReferencedColumnName = column.getReferencedColumnName();
+ this.defaultReferencedColumnName = defaultReferencedColumnName();
+ }
+
+ @Override
+ protected void update(JoinColumn column) {
+ this.joinColumn = column;
+ super.update(column);
+ this.setSpecifiedReferencedColumnName_(column.getReferencedColumnName());
+ this.setDefaultReferencedColumnName(defaultReferencedColumnName());
+ }
+
+ protected String defaultReferencedColumnName() {
+ //TODO
+ return null;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlJoinTable.java
new file mode 100644
index 0000000000..5cadb0ba5e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlJoinTable.java
@@ -0,0 +1,518 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IJoinTable;
+import org.eclipse.jpt.core.internal.context.base.INonOwningMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.IRelationshipMapping;
+import org.eclipse.jpt.core.internal.context.base.ITable;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.JoinColumn;
+import org.eclipse.jpt.core.internal.resource.orm.JoinTable;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
+
+
+public class XmlJoinTable extends AbstractXmlTable implements IJoinTable
+{
+
+ protected final List<XmlJoinColumn> specifiedJoinColumns;
+
+ protected final List<XmlJoinColumn> defaultJoinColumns;
+
+ protected final List<XmlJoinColumn> specifiedInverseJoinColumns;
+
+ protected final List<XmlJoinColumn> defaultInverseJoinColumns;
+
+ protected RelationshipMapping relationshipMappingResource;
+
+ protected XmlJoinTable(XmlRelationshipMapping<? extends RelationshipMapping> parent) {
+ super(parent);
+ this.specifiedJoinColumns = new ArrayList<XmlJoinColumn>();
+ this.defaultJoinColumns = new ArrayList<XmlJoinColumn>();
+ this.specifiedInverseJoinColumns = new ArrayList<XmlJoinColumn>();
+ this.defaultInverseJoinColumns = new ArrayList<XmlJoinColumn>();
+ }
+
+ //******************* AbstractXmlTable implementation *****************
+
+ @Override
+ protected String defaultCatalog() {
+ return entityMappings().getCatalog();
+ }
+
+ @Override
+ protected String defaultName() {
+ String tableName = relationshipMapping().typeMapping().getTableName();
+ if (tableName == null) {
+ return null;
+ }
+ IEntity targetEntity = targetEntity();
+ if (targetEntity == null) {
+ return null;
+ }
+ ITable targetTable = targetEntity.getTable();
+ return (targetTable == null) ? null : tableName + "_" + targetTable.getName();
+ }
+
+ @Override
+ protected String defaultSchema() {
+ return entityMappings().getSchema();
+ }
+
+
+ protected IEntity targetEntity() {
+// String targetEntity = relationshipMapping().fullyQualifiedTargetEntity(defaultsContext.astRoot());
+// if (targetEntity == null) {
+// return null;
+// }
+// IPersistentType persistentType = defaultsContext.persistentType(targetEntity);
+// if (persistentType == null) {
+// return null;
+// }
+// ITypeMapping typeMapping = persistentType.getMapping();
+// if (typeMapping instanceof IEntity) {
+// return (IEntity) typeMapping;
+// }
+ return null;
+ }
+
+
+ @Override
+ protected void removeTableResource() {
+ this.relationshipMappingResource.setJoinTable(null);
+ }
+
+ @Override
+ protected void addTableResource() {
+ this.relationshipMappingResource.setJoinTable(OrmFactory.eINSTANCE.createJoinTableImpl());
+
+ }
+
+ @Override
+ protected JoinTable table() {
+ return this.relationshipMappingResource.getJoinTable();
+ }
+
+ //******************* IJoinTable implementation *****************
+
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlJoinColumn> joinColumns() {
+ return this.specifiedJoinColumns.isEmpty() ? this.defaultJoinColumns() : this.specifiedJoinColumns();
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlJoinColumn> defaultJoinColumns() {
+ return new CloneListIterator<XmlJoinColumn>(this.defaultJoinColumns);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlJoinColumn> specifiedJoinColumns() {
+ return new CloneListIterator<XmlJoinColumn>(this.specifiedJoinColumns);
+ }
+
+ public int specifiedJoinColumnsSize() {
+ return this.specifiedJoinColumns.size();
+ }
+
+ public boolean containsSpecifiedJoinColumns() {
+ return !this.specifiedJoinColumns.isEmpty();
+ }
+
+ public XmlJoinColumn addSpecifiedJoinColumn(int index) {
+ if (table() == null) {
+ addTableResource();
+ }
+ XmlJoinColumn joinColumn = new XmlJoinColumn(this, new JoinColumnOwner());
+ this.specifiedJoinColumns.add(index, joinColumn);
+ this.table().getJoinColumns().add(index, OrmFactory.eINSTANCE.createJoinColumnImpl());
+ this.fireItemAdded(IJoinTable.SPECIFIED_JOIN_COLUMNS_LIST, index, joinColumn);
+ return joinColumn;
+ }
+
+ protected void addSpecifiedJoinColumn(int index, XmlJoinColumn joinColumn) {
+ addItemToList(index, joinColumn, this.specifiedJoinColumns, IJoinTable.SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public void removeSpecifiedJoinColumn(int index) {
+ XmlJoinColumn removedJoinColumn = this.specifiedJoinColumns.remove(index);
+ this.table().getJoinColumns().remove(index);
+ fireItemRemoved(IJoinTable.SPECIFIED_JOIN_COLUMNS_LIST, index, removedJoinColumn);
+ }
+
+ protected void removeSpecifiedJoinColumn(XmlJoinColumn joinColumn) {
+ removeItemFromList(joinColumn, this.specifiedJoinColumns, IJoinTable.SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedJoinColumns, targetIndex, sourceIndex);
+ this.table().getJoinColumns().move(targetIndex, sourceIndex);
+ fireItemMoved(IJoinTable.SPECIFIED_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlJoinColumn> inverseJoinColumns() {
+ return this.specifiedInverseJoinColumns.isEmpty() ? this.defaultInverseJoinColumns() : this.specifiedInverseJoinColumns();
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlJoinColumn> defaultInverseJoinColumns() {
+ return new CloneListIterator<XmlJoinColumn>(this.defaultInverseJoinColumns);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlJoinColumn> specifiedInverseJoinColumns() {
+ return new CloneListIterator<XmlJoinColumn>(this.specifiedInverseJoinColumns);
+ }
+
+ public int specifiedInverseJoinColumnsSize() {
+ return this.specifiedInverseJoinColumns.size();
+ }
+
+ public boolean containsSpecifiedInverseJoinColumns() {
+ return !this.specifiedInverseJoinColumns.isEmpty();
+ }
+
+ public XmlJoinColumn addSpecifiedInverseJoinColumn(int index) {
+ if (table() == null) {
+ addTableResource();
+ }
+ XmlJoinColumn joinColumn = new XmlJoinColumn(this, new InverseJoinColumnOwner());
+ this.specifiedInverseJoinColumns.add(index, joinColumn);
+ this.table().getInverseJoinColumns().add(index, OrmFactory.eINSTANCE.createJoinColumnImpl());
+ this.fireItemAdded(IJoinTable.SPECIFIED_INVERSE_JOIN_COLUMNS_LIST, index, joinColumn);
+ return joinColumn;
+ }
+
+ protected void addSpecifiedInverseJoinColumn(int index, XmlJoinColumn joinColumn) {
+ addItemToList(index, joinColumn, this.specifiedInverseJoinColumns, IJoinTable.SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ }
+
+
+ public void removeSpecifiedInverseJoinColumn(int index) {
+ XmlJoinColumn removedJoinColumn = this.specifiedInverseJoinColumns.remove(index);
+ this.table().getInverseJoinColumns().remove(index);
+ fireItemRemoved(IJoinTable.SPECIFIED_INVERSE_JOIN_COLUMNS_LIST, index, removedJoinColumn);
+ }
+
+ protected void removeSpecifiedInverseJoinColumn(XmlJoinColumn joinColumn) {
+ removeItemFromList(joinColumn, this.specifiedInverseJoinColumns, IJoinTable.SPECIFIED_INVERSE_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedInverseJoinColumn(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedInverseJoinColumns, targetIndex, sourceIndex);
+ this.table().getInverseJoinColumns().move(targetIndex, sourceIndex);
+ fireItemMoved(IJoinTable.SPECIFIED_INVERSE_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
+ }
+
+ @SuppressWarnings("unchecked")
+ public XmlRelationshipMapping<? extends RelationshipMapping> relationshipMapping() {
+ return (XmlRelationshipMapping) parent();
+ }
+
+// @Override
+// protected void addInsignificantXmlFeatureIdsTo(Set<Integer> insignificantXmlFeatureIds) {
+// super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
+// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IJOIN_TABLE__DEFAULT_JOIN_COLUMNS);
+// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IJOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS);
+// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IJOIN_TABLE__JOIN_COLUMNS);
+// insignificantXmlFeatureIds.add(JpaCoreMappingsPackage.IJOIN_TABLE__INVERSE_JOIN_COLUMNS);
+// }
+//
+// public boolean containsSpecifiedJoinColumns() {
+// return !this.getSpecifiedJoinColumns().isEmpty();
+// }
+//
+// public boolean containsSpecifiedInverseJoinColumns() {
+// return !this.getSpecifiedInverseJoinColumns().isEmpty();
+// }
+
+ public boolean isSpecified() {
+ return this.table() != null;
+ }
+
+
+ public void initialize(RelationshipMapping relationshipMapping) {
+ this.relationshipMappingResource = relationshipMapping;
+ this.initialize(this.table());
+ }
+
+ public void update(RelationshipMapping relationshipMapping) {
+ this.relationshipMappingResource = relationshipMapping;
+ this.update(this.table());
+ }
+
+ protected void initialize(JoinTable joinTable) {
+ super.initialize(joinTable);
+ this.initializeSpecifiedJoinColumns(joinTable);
+ this.initializeSpecifiedInverseJoinColumns(joinTable);
+ }
+
+ protected void initializeSpecifiedJoinColumns(JoinTable joinTable) {
+ if (joinTable == null) {
+ return;
+ }
+ for (JoinColumn joinColumn : joinTable.getJoinColumns()) {
+ this.specifiedJoinColumns.add(createJoinColumn(joinColumn));
+ }
+ }
+
+ protected void initializeSpecifiedInverseJoinColumns(JoinTable joinTable) {
+ if (joinTable == null) {
+ return;
+ }
+ for (JoinColumn joinColumn : joinTable.getInverseJoinColumns()) {
+ this.specifiedInverseJoinColumns.add(createInverseJoinColumn(joinColumn));
+ }
+ }
+
+ protected void update(JoinTable joinTable) {
+ super.update(joinTable);
+ this.updateSpecifiedJoinColumns(joinTable);
+ this.updateSpecifiedInverseJoinColumns(joinTable);
+ }
+
+ protected void updateSpecifiedJoinColumns(JoinTable joinTable) {
+ ListIterator<XmlJoinColumn> joinColumns = specifiedJoinColumns();
+ ListIterator<JoinColumn> resourceJoinColumns = EmptyListIterator.instance();
+ if (joinTable != null) {
+ resourceJoinColumns = joinTable.getJoinColumns().listIterator();
+ }
+
+ while (joinColumns.hasNext()) {
+ XmlJoinColumn joinColumn = joinColumns.next();
+ if (resourceJoinColumns.hasNext()) {
+ joinColumn.update(resourceJoinColumns.next());
+ }
+ else {
+ removeSpecifiedJoinColumn(joinColumn);
+ }
+ }
+
+ while (resourceJoinColumns.hasNext()) {
+ addSpecifiedJoinColumn(specifiedJoinColumnsSize(), createJoinColumn(resourceJoinColumns.next()));
+ }
+ }
+
+ protected void updateSpecifiedInverseJoinColumns(JoinTable joinTable) {
+ ListIterator<XmlJoinColumn> inverseJoinColumns = specifiedInverseJoinColumns();
+ ListIterator<JoinColumn> resourceInverseJoinColumns = EmptyListIterator.instance();
+ if (joinTable != null) {
+ resourceInverseJoinColumns = joinTable.getInverseJoinColumns().listIterator();
+ }
+
+ while (inverseJoinColumns.hasNext()) {
+ XmlJoinColumn joinColumn = inverseJoinColumns.next();
+ if (resourceInverseJoinColumns.hasNext()) {
+ joinColumn.update(resourceInverseJoinColumns.next());
+ }
+ else {
+ removeSpecifiedInverseJoinColumn(joinColumn);
+ }
+ }
+
+ while (resourceInverseJoinColumns.hasNext()) {
+ addSpecifiedInverseJoinColumn(specifiedJoinColumnsSize(), createInverseJoinColumn(resourceInverseJoinColumns.next()));
+ }
+ }
+
+ protected XmlJoinColumn createJoinColumn(JoinColumn joinColumn) {
+ XmlJoinColumn xmlJoinColumn = new XmlJoinColumn(this, new JoinColumnOwner());
+ xmlJoinColumn.initialize(joinColumn);
+ return xmlJoinColumn;
+ }
+
+ protected XmlJoinColumn createInverseJoinColumn(JoinColumn joinColumn) {
+ XmlJoinColumn xmlJoinColumn = new XmlJoinColumn(this, new InverseJoinColumnOwner());
+ xmlJoinColumn.initialize(joinColumn);
+ return xmlJoinColumn;
+ }
+
+ /**
+ * just a little common behavior
+ */
+ abstract class AbstractJoinColumnOwner implements IJoinColumn.Owner
+ {
+ AbstractJoinColumnOwner() {
+ super();
+ }
+
+ public ITypeMapping typeMapping() {
+ return relationshipMapping().typeMapping();
+ }
+ public IRelationshipMapping relationshipMapping() {
+ return XmlJoinTable.this.relationshipMapping();
+ }
+
+ /**
+ * the default table name is always valid and a specified table name
+ * is prohibited (which will be handled elsewhere)
+ */
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+
+ /**
+ * the join column can only be on the join table itself
+ */
+ public boolean tableIsAllowed() {
+ return false;
+ }
+//
+// public ITextRange validationTextRange() {
+// return this.joinTable.validationTextRange();
+// }
+
+ public Table dbTable(String tableName) {
+ if (XmlJoinTable.this.getName() == null) {
+ return null;
+ }
+ return (XmlJoinTable.this.getName().equals(tableName)) ? XmlJoinTable.this.dbTable() : null;
+ }
+ }
+
+
+ /**
+ * owner for "forward-pointer" JoinColumns;
+ * these point at the target/inverse entity
+ */
+ class InverseJoinColumnOwner extends AbstractJoinColumnOwner
+ {
+ public InverseJoinColumnOwner() {
+ super();
+ }
+
+ public IEntity targetEntity() {
+ return XmlJoinTable.this.relationshipMapping().getResolvedTargetEntity();
+ }
+
+ public String attributeName() {
+ return XmlJoinTable.this.relationshipMapping().getName();
+ }
+
+ @Override
+ public Table dbTable(String tableName) {
+ Table dbTable = super.dbTable(tableName);
+ if (dbTable != null) {
+ return dbTable;
+ }
+ IEntity targetEntity = targetEntity();
+ return (targetEntity == null) ? null : targetEntity.dbTable(tableName);
+ }
+
+ public Table dbReferencedColumnTable() {
+ IEntity targetEntity = targetEntity();
+ return (targetEntity == null) ? null : targetEntity.primaryDbTable();
+ }
+
+ public boolean isVirtual(IAbstractJoinColumn joinColumn) {
+ return XmlJoinTable.this.defaultInverseJoinColumns.contains(joinColumn);
+ }
+
+ public String defaultColumnName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String defaultTableName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+
+
+ /**
+ * owner for "back-pointer" JoinColumns;
+ * these point at the source/owning entity
+ */
+ class JoinColumnOwner extends AbstractJoinColumnOwner
+ {
+ public JoinColumnOwner() {
+ super();
+ }
+
+ public IEntity targetEntity() {
+ return XmlJoinTable.this.relationshipMapping().getEntity();
+ }
+
+ public String attributeName() {
+ IEntity targetEntity = XmlJoinTable.this.relationshipMapping().getResolvedTargetEntity();
+ if (targetEntity == null) {
+ return null;
+ }
+ String attributeName = XmlJoinTable.this.relationshipMapping().getName();
+ for (Iterator<IPersistentAttribute> stream = targetEntity.persistentType().allAttributes(); stream.hasNext();) {
+ IPersistentAttribute attribute = stream.next();
+ IAttributeMapping mapping = attribute.getMapping();
+ if (mapping instanceof INonOwningMapping) {
+ String mappedBy = ((INonOwningMapping) mapping).getMappedBy();
+ if ((mappedBy != null) && mappedBy.equals(attributeName)) {
+ return attribute.getName();
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public Table dbTable(String tableName) {
+ Table dbTable = super.dbTable(tableName);
+ if (dbTable != null) {
+ return dbTable;
+ }
+ return typeMapping().dbTable(tableName);
+ }
+
+ public Table dbReferencedColumnTable() {
+ return typeMapping().primaryDbTable();
+ }
+
+ public boolean isVirtual(IAbstractJoinColumn joinColumn) {
+ return XmlJoinTable.this.defaultJoinColumns.contains(joinColumn);
+ }
+
+ public String defaultColumnName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String defaultTableName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlManyToManyMapping.java
new file mode 100644
index 0000000000..a58cd6a3b7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlManyToManyMapping.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+
+public class XmlManyToManyMapping extends XmlMultiRelationshipMapping<ManyToMany>
+ implements IManyToManyMapping
+{
+
+ protected XmlManyToManyMapping(XmlPersistentAttribute parent) {
+ super(parent);
+ }
+
+ public String getKey() {
+ return IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected void initializeOn(XmlAttributeMapping<? extends AttributeMapping> newMapping) {
+ newMapping.initializeFromXmlManyToManyMapping(this);
+ }
+
+ @Override
+ public int xmlSequence() {
+ return 6;
+ }
+
+ // ********** INonOwningMapping implementation **********
+ @Override
+ public boolean mappedByIsValid(IAttributeMapping mappedByMapping) {
+ String mappedByKey = mappedByMapping.getKey();
+ return (mappedByKey == IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ }
+
+ @Override
+ public ManyToMany addToResourceModel(TypeMapping typeMapping) {
+ ManyToManyImpl manyToMany = OrmFactory.eINSTANCE.createManyToManyImpl();
+ typeMapping.getAttributes().getManyToManys().add(manyToMany);
+ return manyToMany;
+ }
+
+ @Override
+ public void removeFromResourceModel(TypeMapping typeMapping) {
+ typeMapping.getAttributes().getManyToManys().remove(this.attributeMapping());
+ if (typeMapping.getAttributes().isAllFeaturesUnset()) {
+ typeMapping.setAttributes(null);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlManyToManyMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlManyToManyMappingProvider.java
new file mode 100644
index 0000000000..08108fe28d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlManyToManyMappingProvider.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+
+public class XmlManyToManyMappingProvider implements IXmlAttributeMappingProvider
+{
+ // singleton
+ private static final XmlManyToManyMappingProvider INSTANCE = new XmlManyToManyMappingProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static IXmlAttributeMappingProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private XmlManyToManyMappingProvider() {
+ super();
+ }
+
+ public String key() {
+ return IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public XmlManyToManyMapping buildAttributeMapping(IJpaBaseContextFactory factory, XmlPersistentAttribute parent) {
+ return new XmlManyToManyMapping(parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlManyToOneMapping.java
new file mode 100644
index 0000000000..87690c68cf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlManyToOneMapping.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToOne;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+
+
+public class XmlManyToOneMapping extends XmlSingleRelationshipMapping<ManyToOne>
+ implements IManyToOneMapping
+{
+
+ protected XmlManyToOneMapping(XmlPersistentAttribute parent) {
+ super(parent);
+ }
+
+ @Override
+ public int xmlSequence() {
+ return 3;
+ }
+
+ public String getKey() {
+ return IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected void initializeOn(XmlAttributeMapping<? extends AttributeMapping> newMapping) {
+ newMapping.initializeFromXmlManyToOneMapping(this);
+ }
+
+ @Override
+ public boolean isOverridableAssociationMapping() {
+ return true;
+ }
+
+
+ @Override
+ public ManyToOne addToResourceModel(TypeMapping typeMapping) {
+ ManyToOneImpl manyToOne = OrmFactory.eINSTANCE.createManyToOneImpl();
+ typeMapping.getAttributes().getManyToOnes().add(manyToOne);
+ return manyToOne;
+ }
+
+ @Override
+ public void removeFromResourceModel(TypeMapping typeMapping) {
+ typeMapping.getAttributes().getManyToOnes().remove(this.attributeMapping());
+ if (typeMapping.getAttributes().isAllFeaturesUnset()) {
+ typeMapping.setAttributes(null);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ListIterator<XmlJoinColumn> joinColumns() {
+ return super.joinColumns();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ListIterator<XmlJoinColumn> specifiedJoinColumns() {
+ // TODO Auto-generated method stub
+ return super.specifiedJoinColumns();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ListIterator<XmlJoinColumn> defaultJoinColumns() {
+ // TODO Auto-generated method stub
+ return super.defaultJoinColumns();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlManyToOneMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlManyToOneMappingProvider.java
new file mode 100644
index 0000000000..3c400451c7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlManyToOneMappingProvider.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+
+public class XmlManyToOneMappingProvider implements IXmlAttributeMappingProvider
+{
+ // singleton
+ private static final XmlManyToOneMappingProvider INSTANCE = new XmlManyToOneMappingProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static IXmlAttributeMappingProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private XmlManyToOneMappingProvider() {
+ super();
+ }
+
+ public String key() {
+ return IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public XmlManyToOneMapping buildAttributeMapping(IJpaBaseContextFactory factory, XmlPersistentAttribute parent) {
+ return new XmlManyToOneMapping(parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlMappedSuperclass.java
new file mode 100644
index 0000000000..34956c24e7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlMappedSuperclass.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IMappedSuperclass;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.ITable;
+import org.eclipse.jpt.core.internal.resource.orm.EntityMappings;
+import org.eclipse.jpt.core.internal.resource.orm.IdClass;
+import org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+
+
+public class XmlMappedSuperclass extends XmlTypeMapping<MappedSuperclass>
+ implements IMappedSuperclass
+{
+ protected String idClass;
+
+ public XmlMappedSuperclass(XmlPersistentType parent) {
+ super(parent);
+ }
+
+ public String getIdClass() {
+ return this.idClass;
+ }
+
+ public void setIdClass(String newIdClass) {
+ String oldIdClass = this.idClass;
+ this.idClass = newIdClass;
+ if (oldIdClass != newIdClass) {
+ if (this.idClassResource() != null) {
+ this.idClassResource().setClassName(newIdClass);
+ if (this.idClassResource().isAllFeaturesUnset()) {
+ removeIdClassResource();
+ }
+ }
+ else if (newIdClass != null) {
+ addIdClassResource();
+ idClassResource().setClassName(newIdClass);
+ }
+ }
+ firePropertyChanged(IEntity.ID_CLASS_PROPERTY, oldIdClass, newIdClass);
+ }
+
+ protected void setIdClass_(String newIdClass) {
+ String oldIdClass = this.idClass;
+ this.idClass = newIdClass;
+ firePropertyChanged(IEntity.ID_CLASS_PROPERTY, oldIdClass, newIdClass);
+ }
+
+ protected IdClass idClassResource() {
+ return typeMappingResource().getIdClass();
+ }
+
+ protected void addIdClassResource() {
+ typeMappingResource().setIdClass(OrmFactory.eINSTANCE.createIdClass());
+ }
+
+ protected void removeIdClassResource() {
+ typeMappingResource().setIdClass(null);
+ }
+
+ public String getKey() {
+ return IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return false;
+ }
+
+ public Iterator<String> associatedTableNamesIncludingInherited() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<ITable> associatedTables() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<ITable> associatedTablesIncludingInherited() {
+ return EmptyIterator.instance();
+ }
+
+ @Override
+ public Iterator<String> overridableAttributeNames() {
+ return this.namesOf(this.overridableAttributes());
+ }
+
+ public Iterator<IPersistentAttribute> overridableAttributes() {
+ return new FilteringIterator<XmlPersistentAttribute, IPersistentAttribute>(this.persistentType().attributes()) {
+ @Override
+ protected boolean accept(XmlPersistentAttribute o) {
+ return o.isOverridableAttribute();
+ }
+ };
+ }
+
+ @Override
+ public Iterator<String> overridableAssociationNames() {
+ return this.namesOf(this.overridableAssociations());
+ }
+
+ public Iterator<IPersistentAttribute> overridableAssociations() {
+ return new FilteringIterator<XmlPersistentAttribute, IPersistentAttribute>(this.persistentType().attributes()) {
+ @Override
+ protected boolean accept(XmlPersistentAttribute o) {
+ return o.isOverridableAssociation();
+ }
+ };
+ }
+
+ private Iterator<String> namesOf(Iterator<IPersistentAttribute> attributes) {
+ return new TransformationIterator<IPersistentAttribute, String>(attributes) {
+ @Override
+ protected String transform(IPersistentAttribute attribute) {
+ return attribute.getName();
+ }
+ };
+ }
+
+ @Override
+ public int xmlSequence() {
+ return 0;
+ }
+
+ protected Boolean metadataComplete(MappedSuperclass mappedSuperclass) {
+ return mappedSuperclass.getMetadataComplete();
+ }
+
+ @Override
+ public void removeFromResourceModel(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings) {
+ entityMappings.getMappedSuperclasses().remove(this.typeMappingResource());
+ }
+
+ @Override
+ public MappedSuperclass addToResourceModel(EntityMappings entityMappings) {
+ MappedSuperclass mappedSuperclass = OrmFactory.eINSTANCE.createMappedSuperclass();
+ persistentType().initialize(mappedSuperclass);
+ entityMappings.getMappedSuperclasses().add(mappedSuperclass);
+ return mappedSuperclass;
+ }
+
+
+
+ @Override
+ public void initialize(MappedSuperclass mappedSuperclass) {
+ super.initialize(mappedSuperclass);
+ this.initializeIdClass(this.idClassResource());
+ }
+
+ protected void initializeIdClass(IdClass idClassResource) {
+ this.idClass = this.idClass(idClassResource);
+ }
+
+ @Override
+ public void update(MappedSuperclass mappedSuperclass) {
+ super.update(mappedSuperclass);
+ this.updateIdClass(this.idClassResource());
+ }
+
+ protected void updateIdClass(IdClass idClassResource) {
+ this.setIdClass_(this.idClass(idClassResource));
+ }
+
+ protected String idClass(IdClass idClassResource) {
+ return idClassResource == null ? null : idClassResource.getClassName();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMappedSuperclassProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlMappedSuperclassProvider.java
index da76c35612..0a61f2568a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMappedSuperclassProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlMappedSuperclassProvider.java
@@ -7,15 +7,17 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.context.orm;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+import org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass;
public class XmlMappedSuperclassProvider implements IXmlTypeMappingProvider
{
- public XmlTypeMapping buildTypeMapping() {
- return OrmFactory.eINSTANCE.createXmlMappedSuperclass();
+ public XmlTypeMapping<MappedSuperclass> buildTypeMapping(IJpaBaseContextFactory factory, XmlPersistentType parent) {
+ return factory.createXmlMappedSuperclass(parent);
}
public String key() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlMultiRelationshipMapping.java
new file mode 100644
index 0000000000..2bbef9d9bd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlMultiRelationshipMapping.java
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.context.base.IMultiRelationshipMapping;
+import org.eclipse.jpt.core.internal.resource.orm.MapKey;
+import org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.utility.internal.StringTools;
+
+
+public abstract class XmlMultiRelationshipMapping<T extends MultiRelationshipMapping>
+ extends XmlRelationshipMapping<T>
+ implements IMultiRelationshipMapping
+{
+
+ protected String mappedBy;
+
+ protected String orderBy;//TODO change this to defaultOrderBy and specifiedOrderBy?
+
+ protected final XmlJoinTable joinTable;
+
+ protected String mapKey;
+
+ protected XmlMultiRelationshipMapping(XmlPersistentAttribute parent) {
+ super(parent);
+ this.joinTable = new XmlJoinTable(this);
+ }
+
+ public FetchType getDefaultFetch() {
+ return IMultiRelationshipMapping.DEFAULT_FETCH_TYPE;
+ }
+
+ public String getMappedBy() {
+ return this.mappedBy;
+ }
+
+ public void setMappedBy(String newMappedBy) {
+ String oldMappedBy = this.mappedBy;
+ this.mappedBy = newMappedBy;
+ attributeMapping().setMappedBy(newMappedBy);
+ firePropertyChanged(MAPPED_BY_PROPERTY, oldMappedBy, newMappedBy);
+ }
+
+ protected void setMappedBy_(String newMappedBy) {
+ String oldMappedBy = this.mappedBy;
+ this.mappedBy = newMappedBy;
+ firePropertyChanged(MAPPED_BY_PROPERTY, oldMappedBy, newMappedBy);
+ }
+
+ public String getOrderBy() {
+ return this.orderBy;
+ }
+
+ public void setOrderBy(String newOrderBy) {
+ String oldOrderBy = this.orderBy;
+ this.orderBy = newOrderBy;
+ attributeMapping().setOrderBy(newOrderBy);
+ firePropertyChanged(ORDER_BY_PROPERTY, oldOrderBy, newOrderBy);
+ }
+
+ protected void setOrderBy_(String newOrderBy) {
+ String oldOrderBy = this.orderBy;
+ this.orderBy = newOrderBy;
+ firePropertyChanged(ORDER_BY_PROPERTY, oldOrderBy, newOrderBy);
+ }
+
+ public boolean isNoOrdering() {
+ return getOrderBy() == null;
+ }
+
+ public void setNoOrdering() {
+ setOrderBy(null);
+ }
+
+ //hmm, this looks odd TODO for default orderBy for pk ordering
+ public boolean isOrderByPk() {
+ return "".equals(getOrderBy());
+ }
+
+ public void setOrderByPk() {
+ setOrderBy("");
+ }
+
+ public boolean isCustomOrdering() {
+ return !StringTools.stringIsEmpty(getOrderBy());
+ }
+
+// public ITextRange mappedByTextRange() {
+// if (node == null) {
+// return typeMapping().validationTextRange();
+// }
+// IDOMNode mappedByNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.MAPPED_BY);
+// return (mappedByNode == null) ? validationTextRange() : buildTextRange(mappedByNode);
+// }
+
+ public XmlJoinTable getJoinTable() {
+ return this.joinTable;
+ }
+
+ public boolean isJoinTableSpecified() {
+ return getJoinTable().isSpecified();
+ }
+
+ public String getMapKey() {
+ return this.mapKey;
+ }
+
+ public void setMapKey(String newMapKey) {
+ String oldMapKey = this.mapKey;
+ this.mapKey = newMapKey;
+ if (oldMapKey != newMapKey) {
+ if (this.mapKeyResource() != null) {
+ this.mapKeyResource().setName(newMapKey);
+ if (this.mapKeyResource().isAllFeaturesUnset()) {
+ removeMapKeyResource();
+ }
+ }
+ else if (newMapKey != null) {
+ addMapKeyResource();
+ mapKeyResource().setName(newMapKey);
+ }
+ }
+ firePropertyChanged(MAP_KEY_PROPERTY, oldMapKey, newMapKey);
+ }
+
+ protected void setMapKey_(String newMapKey) {
+ String oldMapKey = this.mapKey;
+ this.mapKey = newMapKey;
+ firePropertyChanged(MAP_KEY_PROPERTY, oldMapKey, newMapKey);
+ }
+
+ protected MapKey mapKeyResource() {
+ return attributeMapping().getMapKey();
+ }
+
+ protected void removeMapKeyResource() {
+ attributeMapping().setMapKey(null);
+ }
+
+ protected void addMapKeyResource() {
+ attributeMapping().setMapKey(OrmFactory.eINSTANCE.createMapKeyImpl());
+ }
+
+ public Iterator<String> candidateMapKeyNames() {
+ return this.allTargetEntityAttributeNames();
+ }
+
+// public void refreshDefaults(DefaultsContext defaultsContext) {
+// super.refreshDefaults(defaultsContext);
+// // TODO
+// // if (isOrderByPk()) {
+// // refreshDefaultOrderBy(defaultsContext);
+// // }
+// }
+//
+// //primary key ordering when just the @OrderBy annotation is present
+// protected void refreshDefaultOrderBy(DefaultsContext defaultsContext) {
+// IEntity targetEntity = getResolvedTargetEntity();
+// if (targetEntity != null) {
+// setOrderBy(targetEntity.primaryKeyAttributeName() + " ASC");
+// }
+// }
+//
+// //TODO copied from JavaMultiRelationshipMapping
+// /**
+// * extract the element type from the specified container signature and
+// * convert it into a reference entity type name;
+// * return null if the type is not a valid reference entity type (e.g. it's
+// * another container or an array or a primitive or other Basic type)
+// */
+// @Override
+// protected String javaDefaultTargetEntity(ITypeBinding typeBinding) {
+// String typeName = super.javaDefaultTargetEntity(typeBinding);
+// return JavaRelationshipMapping.typeNamedIsContainer(typeName) ? this.javaDefaultTargetEntityFromContainer(typeBinding) : null;
+// }
+//
+// protected String javaDefaultTargetEntityFromContainer(ITypeBinding typeBinding) {
+// return JavaMultiRelationshipMapping.javaDefaultTargetEntityFromContainer(typeBinding);
+// }
+
+ public ITextRange mappedByTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean mappedByIsValid(IAttributeMapping mappedByMapping) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void initialize(T multiRelationshipMapping) {
+ super.initialize(multiRelationshipMapping);
+ this.mappedBy = multiRelationshipMapping.getMappedBy();
+ this.mapKey = this.mapKey(multiRelationshipMapping);
+ this.orderBy = this.orderBy(multiRelationshipMapping);
+ this.joinTable.initialize(multiRelationshipMapping);
+ }
+
+ @Override
+ public void update(T multiRelationshipMapping) {
+ super.update(multiRelationshipMapping);
+ this.setMappedBy_(multiRelationshipMapping.getMappedBy());
+ this.setMapKey_(this.mapKey(multiRelationshipMapping));
+ this.setOrderBy_(this.orderBy(multiRelationshipMapping));
+ this.joinTable.update(multiRelationshipMapping);
+ }
+
+ protected String mapKey(T multiRelationshipMapping) {
+ return attributeMapping().getMapKey() == null ? null : attributeMapping().getMapKey().getName();
+ }
+
+ protected String orderBy(T multiRelationshipMapping) {
+ return attributeMapping().getOrderBy();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlNamedNativeQuery.java
new file mode 100644
index 0000000000..63a70a761d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlNamedNativeQuery.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.INamedNativeQuery;
+import org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery;
+
+
+public class XmlNamedNativeQuery extends AbstractXmlQuery<NamedNativeQuery>
+ implements INamedNativeQuery
+{
+
+ protected String resultClass;
+
+ protected String resultSetMapping;
+
+
+ protected XmlNamedNativeQuery(IJpaContextNode parent) {
+ super(parent);
+ }
+
+ public String getResultClass() {
+ return this.resultClass;
+ }
+
+ public void setResultClass(String newResultClass) {
+ String oldResultClass = this.resultClass;
+ this.resultClass = newResultClass;
+ queryResource().setResultClass(newResultClass);
+ firePropertyChanged(INamedNativeQuery.RESULT_CLASS_PROPERTY, oldResultClass, newResultClass);
+ }
+
+ public String getResultSetMapping() {
+ return this.resultSetMapping;
+ }
+
+ public void setResultSetMapping(String newResultSetMapping) {
+ String oldResultSetMapping = this.resultSetMapping;
+ this.resultSetMapping = newResultSetMapping;
+ queryResource().setResultSetMapping(newResultSetMapping);
+ firePropertyChanged(INamedNativeQuery.RESULT_SET_MAPPING_PROPERTY, oldResultSetMapping, newResultSetMapping);
+ }
+
+
+ @Override
+ public void initialize(NamedNativeQuery queryResource) {
+ super.initialize(queryResource);
+ this.resultClass = queryResource.getResultClass();
+ this.resultSetMapping = queryResource.getResultSetMapping();
+ }
+
+ @Override
+ public void update(NamedNativeQuery queryResource) {
+ super.update(queryResource);
+ this.setResultClass(queryResource.getResultClass());
+ this.setResultSetMapping(queryResource.getResultSetMapping());
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlQueryHint> hints() {
+ return super.hints();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlNamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlNamedQuery.java
new file mode 100644
index 0000000000..09b82bbec8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlNamedQuery.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.INamedQuery;
+import org.eclipse.jpt.core.internal.resource.orm.NamedQuery;
+
+
+public class XmlNamedQuery extends AbstractXmlQuery<NamedQuery> implements INamedQuery
+{
+
+ protected XmlNamedQuery(IJpaContextNode parent) {
+ super(parent);
+ }
+
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlQueryHint> hints() {
+ return super.hints();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlNullAttributeMapping.java
new file mode 100644
index 0000000000..89c6781dcd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlNullAttributeMapping.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+
+
+public class XmlNullAttributeMapping extends XmlAttributeMapping<AttributeMapping>
+{
+
+ protected XmlNullAttributeMapping(XmlPersistentAttribute parent) {
+ super(parent);
+ }
+
+ @Override
+ public int xmlSequence() {
+ return -1;
+ }
+
+ @Override
+ protected void initializeOn(XmlAttributeMapping<? extends AttributeMapping> newMapping) {
+ newMapping.initializeFromXmlAttributeMapping(this);
+ }
+
+ public String getKey() {
+ return null;
+ }
+
+ @Override
+ //TODO throwing an exception correct here?
+ public AttributeMapping addToResourceModel(TypeMapping typeMapping) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void removeFromResourceModel(TypeMapping typeMapping) {
+ throw new UnsupportedOperationException();
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlManyToOneProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlNullAttributeMappingProvider.java
index 6c23d15ed9..f2eda1cc82 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlManyToOneProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlNullAttributeMappingProvider.java
@@ -7,14 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.context.orm;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
-public class XmlManyToOneProvider implements IXmlAttributeMappingProvider
+public class XmlNullAttributeMappingProvider implements IXmlAttributeMappingProvider
{
// singleton
- private static final XmlManyToOneProvider INSTANCE = new XmlManyToOneProvider();
+ private static final XmlNullAttributeMappingProvider INSTANCE = new XmlNullAttributeMappingProvider();
/**
* Return the singleton.
@@ -26,16 +27,15 @@ public class XmlManyToOneProvider implements IXmlAttributeMappingProvider
/**
* Ensure non-instantiability.
*/
- private XmlManyToOneProvider() {
+ private XmlNullAttributeMappingProvider() {
super();
}
-
- public XmlAttributeMapping buildAttributeMapping() {
- return OrmFactory.eINSTANCE.createXmlManyToOne();
+ public String key() {
+ return IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY;
}
- public String key() {
- return IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ public XmlNullAttributeMapping buildAttributeMapping(IJpaBaseContextFactory factory, XmlPersistentAttribute parent) {
+ return new XmlNullAttributeMapping(parent);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlOneToManyMapping.java
new file mode 100644
index 0000000000..6f95fb3697
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlOneToManyMapping.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.OneToMany;
+import org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+
+
+public class XmlOneToManyMapping extends XmlMultiRelationshipMapping<OneToMany>
+ implements IOneToManyMapping
+{
+
+ protected XmlOneToManyMapping(XmlPersistentAttribute parent) {
+ super(parent);
+ }
+
+ public String getKey() {
+ return IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ protected void initializeOn(XmlAttributeMapping<? extends AttributeMapping> newMapping) {
+ newMapping.initializeFromXmlOneToManyMapping(this);
+ }
+
+ @Override
+ public int xmlSequence() {
+ return 4;
+ }
+
+ // ********** INonOwningMapping implementation **********
+ @Override
+ public boolean mappedByIsValid(IAttributeMapping mappedByMapping) {
+ String mappedByKey = mappedByMapping.getKey();
+ return (mappedByKey == IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ }
+
+ @Override
+ public OneToMany addToResourceModel(TypeMapping typeMapping) {
+ OneToManyImpl oneToMany = OrmFactory.eINSTANCE.createOneToManyImpl();
+ typeMapping.getAttributes().getOneToManys().add(oneToMany);
+ return oneToMany;
+ }
+
+ @Override
+ public void removeFromResourceModel(TypeMapping typeMapping) {
+ typeMapping.getAttributes().getOneToManys().remove(this.attributeMapping());
+ if (typeMapping.getAttributes().isAllFeaturesUnset()) {
+ typeMapping.setAttributes(null);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlOneToManyMappingProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlOneToManyMappingProvider.java
new file mode 100644
index 0000000000..ed823add08
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlOneToManyMappingProvider.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
+
+public class XmlOneToManyMappingProvider implements IXmlAttributeMappingProvider
+{
+ // singleton
+ private static final XmlOneToManyMappingProvider INSTANCE = new XmlOneToManyMappingProvider();
+
+ /**
+ * Return the singleton.
+ */
+ public static IXmlAttributeMappingProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private XmlOneToManyMappingProvider() {
+ super();
+ }
+
+ public String key() {
+ return IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ public XmlOneToManyMapping buildAttributeMapping(IJpaBaseContextFactory factory, XmlPersistentAttribute parent) {
+ return new XmlOneToManyMapping(parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlOneToOneMapping.java
new file mode 100644
index 0000000000..3c87e4b734
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlOneToOneMapping.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.OneToOne;
+import org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+
+
+public class XmlOneToOneMapping extends XmlSingleRelationshipMapping<OneToOne>
+ implements IOneToOneMapping
+{
+
+ protected String mappedBy;
+
+
+ protected XmlOneToOneMapping(XmlPersistentAttribute parent) {
+ super(parent);
+ }
+
+ @Override
+ protected void initializeOn(XmlAttributeMapping<? extends AttributeMapping> newMapping) {
+ newMapping.initializeFromXmlOneToOneMapping(this);
+ }
+
+
+ public String getMappedBy() {
+ return this.mappedBy;
+ }
+
+ public void setMappedBy(String newMappedBy) {
+ String oldMappedBy = this.mappedBy;
+ this.mappedBy = newMappedBy;
+ attributeMapping().setMappedBy(newMappedBy);
+ firePropertyChanged(MAPPED_BY_PROPERTY, oldMappedBy, newMappedBy);
+ }
+
+ protected void setMappedBy_(String newMappedBy) {
+ String oldMappedBy = this.mappedBy;
+ this.mappedBy = newMappedBy;
+ firePropertyChanged(MAPPED_BY_PROPERTY, oldMappedBy, newMappedBy);
+ }
+
+ public boolean mappedByIsValid(IAttributeMapping mappedByMapping) {
+ String mappedByKey = mappedByMapping.getKey();
+ return (mappedByKey == IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ }
+
+ public ITextRange mappedByTextRange(CompilationUnit astRoot) {
+ return null;
+// if (node == null) {
+// return typeMapping().validationTextRange();
+// }
+// IDOMNode mappedByNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.MAPPED_BY);
+// return (mappedByNode == null) ? validationTextRange() : buildTextRange(mappedByNode);
+ }
+
+ @Override
+ public int xmlSequence() {
+ return 5;
+ }
+
+ public String getKey() {
+ return IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ public boolean isOverridableAssociationMapping() {
+ return true;
+ }
+
+ @Override
+ public OneToOne addToResourceModel(TypeMapping typeMapping) {
+ OneToOneImpl oneToOne = OrmFactory.eINSTANCE.createOneToOneImpl();
+ typeMapping.getAttributes().getOneToOnes().add(oneToOne);
+ return oneToOne;
+ }
+
+ @Override
+ public void removeFromResourceModel(TypeMapping typeMapping) {
+ typeMapping.getAttributes().getOneToOnes().remove(this.attributeMapping());
+ if (typeMapping.getAttributes().isAllFeaturesUnset()) {
+ typeMapping.setAttributes(null);
+ }
+ }
+
+ @Override
+ public Iterator<String> candidateMappedByAttributeNames() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void initialize(OneToOne oneToOne) {
+ super.initialize(oneToOne);
+ this.mappedBy = oneToOne.getMappedBy();
+ }
+
+ @Override
+ public void update(OneToOne oneToOne) {
+ super.update(oneToOne);
+ this.setMappedBy_(oneToOne.getMappedBy());
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ListIterator<XmlJoinColumn> joinColumns() {
+ return super.joinColumns();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ListIterator<XmlJoinColumn> specifiedJoinColumns() {
+ // TODO Auto-generated method stub
+ return super.specifiedJoinColumns();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ListIterator<XmlJoinColumn> defaultJoinColumns() {
+ // TODO Auto-generated method stub
+ return super.defaultJoinColumns();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOneToOneProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlOneToOneMappingProvider.java
index 420fdc0678..dcd469b105 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlOneToOneProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlOneToOneMappingProvider.java
@@ -7,14 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.context.orm;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
-public class XmlOneToOneProvider implements IXmlAttributeMappingProvider
+public class XmlOneToOneMappingProvider implements IXmlAttributeMappingProvider
{
// singleton
- private static final XmlOneToOneProvider INSTANCE = new XmlOneToOneProvider();
+ private static final XmlOneToOneMappingProvider INSTANCE = new XmlOneToOneMappingProvider();
/**
* Return the singleton.
@@ -26,15 +27,15 @@ public class XmlOneToOneProvider implements IXmlAttributeMappingProvider
/**
* Ensure non-instantiability.
*/
- private XmlOneToOneProvider() {
+ private XmlOneToOneMappingProvider() {
super();
}
-
- public XmlAttributeMapping buildAttributeMapping() {
- return OrmFactory.eINSTANCE.createXmlOneToOne();
- }
-
+
public String key() {
return IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
}
+
+ public XmlOneToOneMapping buildAttributeMapping(IJpaBaseContextFactory factory, XmlPersistentAttribute parent) {
+ return new XmlOneToOneMapping(parent);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlPersistentAttribute.java
new file mode 100644
index 0000000000..5523393f38
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlPersistentAttribute.java
@@ -0,0 +1,321 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.Basic;
+import org.eclipse.jpt.core.internal.resource.orm.Embedded;
+import org.eclipse.jpt.core.internal.resource.orm.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.orm.Id;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToOne;
+import org.eclipse.jpt.core.internal.resource.orm.OneToMany;
+import org.eclipse.jpt.core.internal.resource.orm.OneToOne;
+import org.eclipse.jpt.core.internal.resource.orm.Transient;
+import org.eclipse.jpt.core.internal.resource.orm.Version;
+
+
+public class XmlPersistentAttribute extends JpaContextNode
+ implements IPersistentAttribute
+{
+
+ protected List<IXmlAttributeMappingProvider> attributeMappingProviders;
+
+ protected XmlAttributeMapping<? extends AttributeMapping> attributeMapping;
+
+ public XmlPersistentAttribute(XmlPersistentType parent, String mappingKey) {
+ super(parent);
+ this.attributeMappingProviders = buildAttributeMappingProviders();
+ this.attributeMapping = buildAttributeMapping(mappingKey);
+ }
+
+ protected List<IXmlAttributeMappingProvider> buildAttributeMappingProviders() {
+ List<IXmlAttributeMappingProvider> list = new ArrayList<IXmlAttributeMappingProvider>();
+ list.add(XmlEmbeddedMappingProvider.instance()); //bug 190344 need to test default embedded before basic
+ list.add(XmlBasicMappingProvider.instance());
+ list.add(XmlTransientMappingProvider.instance());
+ list.add(XmlIdMappingProvider.instance());
+ list.add(XmlManyToManyMappingProvider.instance());
+ list.add(XmlOneToManyMappingProvider.instance());
+ list.add(XmlManyToOneMappingProvider.instance());
+ list.add(XmlOneToOneMappingProvider.instance());
+ list.add(XmlVersionMappingProvider.instance());
+ list.add(XmlEmbeddedIdMappingProvider.instance());
+ return list;
+ }
+
+ protected IXmlAttributeMappingProvider attributeMappingProvider(String key) {
+ for (IXmlAttributeMappingProvider provider : this.attributeMappingProviders) {
+ if (provider.key().equals(key)) {
+ return provider;
+ }
+ }
+ return XmlNullAttributeMappingProvider.instance();
+ }
+
+ protected XmlAttributeMapping<? extends AttributeMapping> buildAttributeMapping(String key) {
+ return this.attributeMappingProvider(key).buildAttributeMapping(jpaFactory(), this);
+ }
+
+
+ public String getName() {
+ return getMapping().getName();
+ }
+
+ protected void nameChanged(String oldName, String newName) {
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public IAttributeMapping getSpecifiedMapping() {
+ return this.attributeMapping;
+ }
+
+ public XmlAttributeMapping<? extends AttributeMapping> getMapping() {
+ return this.attributeMapping;
+ }
+
+ public String mappingKey() {
+ return this.getMapping().getKey();
+ }
+
+ public String defaultMappingKey() {
+ return null;
+ }
+
+ public void setSpecifiedMappingKey(String newMappingKey) {
+ if (this.mappingKey() == newMappingKey) {
+ return;
+ }
+ XmlAttributeMapping<? extends AttributeMapping> oldMapping = getMapping();
+ this.attributeMapping = buildAttributeMapping(newMappingKey);
+ //TODO persistentType().changeMapping(this, oldMapping, this.attributeMapping);
+ firePropertyChanged(SPECIFIED_MAPPING_PROPERTY, oldMapping, this.attributeMapping);
+ }
+
+ protected void setSpecifiedMappingKey_(String newMappingKey) {
+ if (this.mappingKey() == newMappingKey) {
+ return;
+ }
+ XmlAttributeMapping<? extends AttributeMapping> oldMapping = getMapping();
+ this.attributeMapping = buildAttributeMapping(newMappingKey);
+ firePropertyChanged(SPECIFIED_MAPPING_PROPERTY, oldMapping, this.attributeMapping);
+ }
+//
+// public Object getId() {
+// return IXmlContentNodes.PERSISTENT_ATTRIBUTE_ID;
+// }
+
+ public Collection<IXmlAttributeMappingProvider> attributeMappingProviders() {
+ return this.attributeMappingProviders;
+ }
+
+ public XmlPersistentType persistentType() {
+ return (XmlPersistentType) parent();
+ }
+
+ public XmlTypeMapping<?> typeMapping() {
+ return persistentType().getMapping();
+ }
+
+ public boolean isVirtual() {
+ return persistentType().containsVirtualPersistentAttribute(this);
+ }
+
+ public void setVirtual(boolean virtual) {
+ xmlPersistentType().setPersistentAttributeVirtual(this, virtual);
+ }
+
+ public String primaryKeyColumnName() {
+ return getMapping().primaryKeyColumnName();
+ }
+
+// @Override
+// public ITextRange fullTextRange() {
+// return (this.isVirtual()) ? null : super.fullTextRange();
+// }
+//
+// @Override
+// public ITextRange validationTextRange() {
+// return (this.isVirtual()) ? this.persistentType().attributesTextRange() : this.getMapping().validationTextRange();
+// }
+//
+// @Override
+// public ITextRange selectionTextRange() {
+// return (isVirtual()) ? null : this.getMapping().selectionTextRange();
+// }
+//
+// public ITextRange nameTextRange() {
+// return getMapping().nameTextRange();
+// }
+
+ public boolean isOverridableAttribute() {
+ return this.getMapping().isOverridableAttributeMapping();
+ }
+
+ public boolean isOverridableAssociation() {
+ return this.getMapping().isOverridableAssociationMapping();
+ }
+
+ public boolean isIdAttribute() {
+ return this.getMapping().isIdMapping();
+ }
+
+ //TODO is there a way to avoid a method for every mapping type?
+ //I am trying to take adavantage of generics here, but it sure is
+ //leading to a lot of duplicated code. - KFM
+ public void initialize(Basic basic) {
+ ((XmlBasicMapping) getMapping()).initialize(basic);
+ }
+
+ public void initialize(Embedded embedded) {
+ ((XmlEmbeddedMapping) getMapping()).initialize(embedded);
+ }
+
+ public void initialize(Version version) {
+ ((XmlVersionMapping) getMapping()).initialize(version);
+ }
+
+ public void initialize(ManyToOne manyToOne) {
+ ((XmlManyToOneMapping) getMapping()).initialize(manyToOne);
+ }
+
+ public void initialize(OneToMany oneToMany) {
+ ((XmlOneToManyMapping) getMapping()).initialize(oneToMany);
+ }
+
+ public void initialize(OneToOne oneToOne) {
+ ((XmlOneToOneMapping) getMapping()).initialize(oneToOne);
+ }
+
+ public void initialize(ManyToMany manyToMany) {
+ ((XmlManyToManyMapping) getMapping()).initialize(manyToMany);
+ }
+
+ public void initialize(Id id) {
+ ((XmlIdMapping) getMapping()).initialize(id);
+ }
+
+ public void initialize(EmbeddedId embeddedId) {
+ ((XmlEmbeddedIdMapping) getMapping()).initialize(embeddedId);
+ }
+
+ public void initialize(Transient transientResource) {
+ ((XmlTransientMapping) getMapping()).initialize(transientResource);
+ }
+
+ public void update(Id id) {
+ if (mappingKey() == IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY) {
+ ((XmlIdMapping) getMapping()).update(id);
+ }
+ else {
+ setSpecifiedMappingKey_(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
+ ((XmlIdMapping) getMapping()).initialize(id);
+ }
+ }
+
+ public void update(EmbeddedId embeddedId) {
+ if (mappingKey() == IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY) {
+ ((XmlEmbeddedIdMapping) getMapping()).update(embeddedId);
+ }
+ else {
+ setSpecifiedMappingKey_(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
+ ((XmlEmbeddedIdMapping) getMapping()).initialize(embeddedId);
+ }
+ }
+
+ public void update(Basic basic) {
+ if (mappingKey() == IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY) {
+ ((XmlBasicMapping) getMapping()).update(basic);
+ }
+ else {
+ setSpecifiedMappingKey_(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
+ ((XmlBasicMapping) getMapping()).initialize(basic);
+ }
+ }
+
+ public void update(Version version) {
+ if (mappingKey() == IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY) {
+ ((XmlVersionMapping) getMapping()).update(version);
+ }
+ else {
+ setSpecifiedMappingKey_(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
+ ((XmlVersionMapping) getMapping()).initialize(version);
+ }
+ }
+ public void update(ManyToOne version) {
+ if (mappingKey() == IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
+ ((XmlManyToOneMapping) getMapping()).update(version);
+ }
+ else {
+ setSpecifiedMappingKey_(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ ((XmlManyToOneMapping) getMapping()).initialize(version);
+ }
+ }
+ public void update(OneToMany version) {
+ if (mappingKey() == IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
+ ((XmlOneToManyMapping) getMapping()).update(version);
+ }
+ else {
+ setSpecifiedMappingKey_(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ ((XmlOneToManyMapping) getMapping()).initialize(version);
+ }
+ }
+ public void update(OneToOne version) {
+ if (mappingKey() == IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
+ ((XmlOneToOneMapping) getMapping()).update(version);
+ }
+ else {
+ setSpecifiedMappingKey_(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ ((XmlOneToOneMapping) getMapping()).initialize(version);
+ }
+ }
+ public void update(ManyToMany version) {
+ if (mappingKey() == IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
+ ((XmlManyToManyMapping) getMapping()).update(version);
+ }
+ else {
+ setSpecifiedMappingKey_(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ ((XmlManyToManyMapping) getMapping()).initialize(version);
+ }
+ }
+
+ public void update(Embedded embedded) {
+ if (mappingKey() == IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY) {
+ ((XmlEmbeddedMapping) getMapping()).update(embedded);
+ }
+ else {
+ setSpecifiedMappingKey_(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
+ ((XmlEmbeddedMapping) getMapping()).initialize(embedded);
+ }
+ }
+
+ public void update(Transient transientResource) {
+ if (mappingKey() == IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY) {
+ ((XmlTransientMapping) getMapping()).update(transientResource);
+ }
+ else {
+ setSpecifiedMappingKey_(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
+ ((XmlTransientMapping) getMapping()).initialize(transientResource);
+ }
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ super.toString(sb);
+ sb.append(getName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlPersistentType.java
new file mode 100644
index 0000000000..1c65e4f132
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlPersistentType.java
@@ -0,0 +1,820 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.context.orm;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.IPersistentType;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.context.java.IJavaBasicMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaIdMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.context.java.IJavaTransientMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaVersionMapping;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.Attributes;
+import org.eclipse.jpt.core.internal.resource.orm.Basic;
+import org.eclipse.jpt.core.internal.resource.orm.Embeddable;
+import org.eclipse.jpt.core.internal.resource.orm.Embedded;
+import org.eclipse.jpt.core.internal.resource.orm.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.Id;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToOne;
+import org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass;
+import org.eclipse.jpt.core.internal.resource.orm.OneToMany;
+import org.eclipse.jpt.core.internal.resource.orm.OneToOne;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.Transient;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.Version;
+import org.eclipse.jpt.core.internal.resource.orm.VirtualBasic;
+import org.eclipse.jpt.core.internal.resource.orm.VirtualEmbedded;
+import org.eclipse.jpt.core.internal.resource.orm.VirtualEmbeddedId;
+import org.eclipse.jpt.core.internal.resource.orm.VirtualId;
+import org.eclipse.jpt.core.internal.resource.orm.VirtualManyToMany;
+import org.eclipse.jpt.core.internal.resource.orm.VirtualManyToOne;
+import org.eclipse.jpt.core.internal.resource.orm.VirtualOneToMany;
+import org.eclipse.jpt.core.internal.resource.orm.VirtualOneToOne;
+import org.eclipse.jpt.core.internal.resource.orm.VirtualTransient;
+import org.eclipse.jpt.core.internal.resource.orm.VirtualVersion;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ChainIterator;
+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.EmptyListIterator;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+
+
+public class XmlPersistentType extends JpaContextNode implements IPersistentType
+{
+ protected final List<XmlPersistentAttribute> specifiedPersistentAttributes;
+
+ protected final List<XmlPersistentAttribute> virtualPersistentAttributes;
+
+ protected final Collection<IXmlTypeMappingProvider> typeMappingProviders;
+
+ protected XmlTypeMapping<? extends TypeMapping> xmlTypeMapping;
+
+ protected IPersistentType parentPersistentType;
+
+ public XmlPersistentType(EntityMappings parent, String mappingKey) {
+ super(parent);
+ this.typeMappingProviders = buildTypeMappingProviders();
+ this.xmlTypeMapping = buildXmlTypeMapping(mappingKey);
+ this.specifiedPersistentAttributes = new ArrayList<XmlPersistentAttribute>();
+ this.virtualPersistentAttributes = new ArrayList<XmlPersistentAttribute>();
+ }
+
+// /* @see IJpaContentNode#getId() */
+// public Object getId() {
+// return IXmlContentNodes.PERSISTENT_TYPE_ID;
+// }
+
+ public boolean isFor(String fullyQualifiedTypeName) {
+ String className = getMapping().getClass_();
+ if (className == null) {
+ return false;
+ }
+ if (className.equals(fullyQualifiedTypeName)) {
+ return true;
+ }
+ if ((entityMappings().getPackage() + className).equals(fullyQualifiedTypeName)) {
+ return true;
+ }
+ return false;
+ }
+
+ protected XmlTypeMapping<? extends TypeMapping> buildXmlTypeMapping(String key) {
+ return typeMappingProvider(key).buildTypeMapping(jpaFactory(), this);
+ }
+
+ protected Collection<IXmlTypeMappingProvider> buildTypeMappingProviders() {
+ Collection<IXmlTypeMappingProvider> collection = new ArrayList<IXmlTypeMappingProvider>();
+ collection.add(new XmlEntityProvider());
+ collection.add(new XmlMappedSuperclassProvider());
+ collection.add(new XmlEmbeddableProvider());
+ return collection;
+ }
+
+ protected IXmlTypeMappingProvider typeMappingProvider(String key) {
+ for (IXmlTypeMappingProvider provider : this.typeMappingProviders) {
+ if (provider.key().equals(key)) {
+ return provider;
+ }
+ }
+ throw new IllegalArgumentException();
+ }
+
+ public XmlTypeMapping<? extends TypeMapping> getMapping() {
+ return this.xmlTypeMapping;
+ }
+
+ public void setMappingKey(String newMappingKey) {
+ if (this.mappingKey() == newMappingKey) {
+ return;
+ }
+ XmlTypeMapping<? extends TypeMapping> oldMapping = getMapping();
+ this.xmlTypeMapping = buildXmlTypeMapping(newMappingKey);
+ entityMappings().changeMapping(this, oldMapping, this.xmlTypeMapping);
+ firePropertyChanged(MAPPING_PROPERTY, oldMapping, this.xmlTypeMapping);
+ }
+
+ protected void setMappingKey_(String newMappingKey) {
+ if (this.mappingKey() == newMappingKey) {
+ return;
+ }
+ XmlTypeMapping<? extends TypeMapping> oldMapping = getMapping();
+ this.xmlTypeMapping = buildXmlTypeMapping(newMappingKey);
+ firePropertyChanged(MAPPING_PROPERTY, oldMapping, this.xmlTypeMapping);
+ }
+
+ public Iterator<IPersistentType> inheritanceHierarchy() {
+ // using a chain iterator to traverse up the inheritance tree
+ return new ChainIterator<IPersistentType>(this) {
+ @Override
+ protected IPersistentType nextLink(IPersistentType pt) {
+ return pt.parentPersistentType();
+ }
+ };
+ }
+
+ public IPersistentType parentPersistentType() {
+ return this.parentPersistentType;
+ }
+
+ public AccessType access() {
+ return getMapping().getAccess();
+ }
+
+// protected void changeMapping(XmlAttributeMapping oldMapping, String newMappingKey) {
+// boolean virtual = oldMapping.isVirtual();
+// XmlAttributeMapping newAttributeMapping = buildAttributeMapping(oldMapping.getPersistentAttribute().attributeMappingProviders(), newMappingKey);
+// // we can't set the attribute to null, but we can set it to a dummy placeholder one
+// // we do this to get the translators to *wake up* and remove adapters from the attribute
+// XmlPersistentAttribute nullAttribute = OrmFactory.eINSTANCE.createXmlPersistentAttribute();
+// XmlPersistentAttribute attribute = oldMapping.getPersistentAttribute();
+// oldMapping.setPersistentAttribute(nullAttribute);
+// if (virtual) {
+// getVirtualPersistentAttributes().remove(attribute);
+// getVirtualAttributeMappings().remove(oldMapping);
+// }
+// else {
+// getSpecifiedPersistentAttributes().remove(attribute);
+// getSpecifiedAttributeMappings().remove(oldMapping);
+// }
+// newAttributeMapping.setPersistentAttribute(attribute);
+// oldMapping.initializeOn(newAttributeMapping);
+// if (virtual) {
+// insertAttributeMapping(newAttributeMapping, getVirtualAttributeMappings());
+// }
+// else {
+// insertAttributeMapping(newAttributeMapping, getSpecifiedAttributeMappings());
+// }
+// }
+
+ protected void setPersistentAttributeVirtual(XmlPersistentAttribute xmlPersistentAttribute, boolean virtual) {
+ boolean oldVirtual = xmlPersistentAttribute.isVirtual();
+ if (oldVirtual == virtual) {
+ return;
+ }
+ if (virtual) {
+ XmlPersistentAttribute virtualPersistentAttribute = createVirtualPersistentAttribute(xmlPersistentAttribute.getMapping().javaPersistentAttribute());
+ this.virtualPersistentAttributes.add(virtualPersistentAttribute);
+ this.removeSpecifiedXmlPersistentAttribute(xmlPersistentAttribute);
+ fireItemAdded(VIRTUAL_ATTRIBUTES_LIST, virtualAttributesSize(), virtualPersistentAttribute);
+ }
+ else {
+ int index = this.virtualPersistentAttributes.indexOf(xmlPersistentAttribute);
+ this.virtualPersistentAttributes.remove(xmlPersistentAttribute);
+ addSpecifiedPersistentAttribute(xmlPersistentAttribute.mappingKey(), xmlPersistentAttribute.getName());
+ fireItemRemoved(VIRTUAL_ATTRIBUTES_LIST, index, xmlPersistentAttribute);
+ }
+ }
+
+
+
+ public Iterator<String> allAttributeNames() {
+ return this.attributeNames(this.allAttributes());
+ }
+
+ public Iterator<IPersistentAttribute> allAttributes() {
+ return new CompositeIterator<IPersistentAttribute>(new TransformationIterator<IPersistentType, Iterator<IPersistentAttribute>>(this.inheritanceHierarchy()) {
+ @Override
+ protected Iterator<IPersistentAttribute> transform(IPersistentType pt) {
+ return pt.attributes();
+ }
+ });
+ }
+
+ protected Iterator<XmlPersistentAttribute> attributesNamed(final String attributeName) {
+ return new FilteringIterator<XmlPersistentAttribute, XmlPersistentAttribute>(attributes()) {
+ @Override
+ protected boolean accept(XmlPersistentAttribute o) {
+ return attributeName.equals(o.getName());
+ }
+ };
+ }
+
+ public XmlPersistentAttribute attributeNamed(String attributeName) {
+ Iterator<XmlPersistentAttribute> stream = attributesNamed(attributeName);
+ return (stream.hasNext()) ? stream.next() : null;
+ }
+
+ public Iterator<String> attributeNames() {
+ return this.attributeNames(this.attributes());
+ }
+
+ protected Iterator<String> attributeNames(Iterator<? extends IPersistentAttribute> attrs) {
+ return new TransformationIterator<IPersistentAttribute, String>(attrs) {
+ @Override
+ protected String transform(IPersistentAttribute attribute) {
+ return attribute.getName();
+ }
+ };
+ }
+
+ protected XmlPersistentAttribute specifiedAttributeNamed(String attributeName) {
+ Iterator<XmlPersistentAttribute> stream = specifiedAttributesNamed(attributeName);
+ return (stream.hasNext()) ? stream.next() : null;
+
+ }
+
+ protected Iterator<XmlPersistentAttribute> specifiedAttributesNamed(final String attributeName) {
+ return new FilteringIterator<XmlPersistentAttribute, XmlPersistentAttribute>(specifiedAttributes()) {
+ @Override
+ protected boolean accept(XmlPersistentAttribute xmlPersistentAttribute) {
+ return attributeName.equals(xmlPersistentAttribute.getName());
+ }
+ };
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlPersistentAttribute> attributes() {
+ return new CompositeListIterator<XmlPersistentAttribute>(specifiedAttributes(), virtualAttributes());
+ }
+
+ public int attributesSize() {
+ return CollectionTools.size(attributes());
+ }
+
+ public ListIterator<XmlPersistentAttribute> specifiedAttributes() {
+ return new CloneListIterator<XmlPersistentAttribute>(this.specifiedPersistentAttributes);
+ }
+
+ public ListIterator<XmlPersistentAttribute> virtualAttributes() {
+ return new CloneListIterator<XmlPersistentAttribute>(this.virtualPersistentAttributes);
+ }
+
+ public int virtualAttributesSize() {
+ return this.virtualPersistentAttributes.size();
+ }
+
+ protected void addVirtualPersistentAttribute(XmlPersistentAttribute xmlPersistentAttribute) {
+ addItemToList(xmlPersistentAttribute, this.virtualPersistentAttributes, IPersistentType.VIRTUAL_ATTRIBUTES_LIST);
+ }
+
+ protected void removeVirtualPersistentAttribute(XmlPersistentAttribute xmlPersistentAttribute) {
+ removeItemFromList(xmlPersistentAttribute, this.virtualPersistentAttributes, IPersistentType.VIRTUAL_ATTRIBUTES_LIST);
+ }
+
+ protected boolean containsVirtualPersistentAttribute(XmlPersistentAttribute xmlPersistentAttribute) {
+ return this.virtualPersistentAttributes.contains(xmlPersistentAttribute);
+ }
+
+ public XmlPersistentAttribute addSpecifiedPersistentAttribute(String mappingKey, String attributeName) {
+ XmlPersistentAttribute persistentAttribute = jpaFactory().createXmlPersistentAttribute(this, mappingKey);
+ int index = insertionIndex(persistentAttribute);
+ if (getMapping().typeMappingResource().getAttributes() == null) {
+ getMapping().typeMappingResource().setAttributes(OrmFactory.eINSTANCE.createAttributes());
+ }
+ this.specifiedPersistentAttributes.add(index, persistentAttribute);
+ AttributeMapping attributeMapping = persistentAttribute.getMapping().addToResourceModel(getMapping().typeMappingResource());
+
+ attributeMapping.setName(attributeName);
+ fireItemAdded(IPersistentType.SPECIFIED_ATTRIBUTES_LIST, index, persistentAttribute);
+ return persistentAttribute;
+ }
+
+ protected int insertionIndex(XmlPersistentAttribute persistentAttribute) {
+ return CollectionTools.insertionIndexOf(this.specifiedPersistentAttributes, persistentAttribute, buildMappingComparator());
+ }
+
+ protected Comparator<XmlPersistentAttribute> buildMappingComparator() {
+ return new Comparator<XmlPersistentAttribute>() {
+ public int compare(XmlPersistentAttribute o1, XmlPersistentAttribute o2) {
+ int o1Sequence = o1.getMapping().xmlSequence();
+ int o2Sequence = o2.getMapping().xmlSequence();
+ if (o1Sequence < o2Sequence) {
+ return -1;
+ }
+ if (o1Sequence == o2Sequence) {
+ return 0;
+ }
+ return 1;
+ }
+ };
+ }
+
+
+ protected void addSpecifiedPersistentAttribute_(XmlPersistentAttribute xmlPersistentAttribute) {
+ addItemToList(xmlPersistentAttribute, this.specifiedPersistentAttributes, IPersistentType.SPECIFIED_ATTRIBUTES_LIST);
+ }
+
+ protected void removeSpecifiedPersistentAttribute_(XmlPersistentAttribute xmlPersistentAttribute) {
+ removeItemFromList(xmlPersistentAttribute, this.specifiedPersistentAttributes, IPersistentType.SPECIFIED_ATTRIBUTES_LIST);
+ }
+
+ public void removeSpecifiedXmlPersistentAttribute(XmlPersistentAttribute xmlPersistentAttribute) {
+ int index = this.specifiedPersistentAttributes.indexOf(xmlPersistentAttribute);
+ this.specifiedPersistentAttributes.remove(xmlPersistentAttribute);
+ xmlPersistentAttribute.getMapping().removeFromResourceModel(this.xmlTypeMapping.typeMappingResource());
+ fireItemRemoved(IPersistentType.SPECIFIED_ATTRIBUTES_LIST, index, xmlPersistentAttribute);
+ }
+
+ public String getName() {
+ return getMapping().getClass_();
+ }
+
+ protected void classChanged(String oldClass, String newClass) {
+ firePropertyChanged(NAME_PROPERTY, oldClass, newClass);
+ }
+
+ public boolean isMapped() {
+ return true;
+ }
+
+ public String mappingKey() {
+ return getMapping().getKey();
+ }
+
+ public IJavaPersistentType javaPersistentType() {
+ return getMapping().getJavaPersistentType();
+ }
+
+
+ //TODO is there a way to avoid a method for every mapping type?
+ //I am trying to take adavantage of generics here, but it sure is
+ //leading to a lot of duplicated code. - KFM
+ public void initialize(Entity entity) {
+ ((XmlEntity) getMapping()).initialize(entity);
+ this.initializeParentPersistentType();
+ this.initializePersistentAttributes(entity);
+ }
+
+ public void initialize(MappedSuperclass mappedSuperclass) {
+ ((XmlMappedSuperclass) getMapping()).initialize(mappedSuperclass);
+ this.initializeParentPersistentType();
+ this.initializePersistentAttributes(mappedSuperclass);
+ }
+
+ public void initialize(Embeddable embeddable) {
+ ((XmlEmbeddable) getMapping()).initialize(embeddable);
+ this.initializeParentPersistentType();
+ this.initializePersistentAttributes(embeddable);
+ }
+
+ protected void initializePersistentAttributes(TypeMapping typeMapping) {
+ Attributes attributes = typeMapping.getAttributes();
+ if (attributes != null) {
+ this.initializeSpecifiedPersistentAttributes(attributes);
+ }
+ this.initializeVirtualPersistentAttributes();
+ }
+
+ protected void initializeSpecifiedPersistentAttributes(Attributes attributes) {
+ for (Id id : attributes.getIds()) {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(id);
+ this.specifiedPersistentAttributes.add(xmlPersistentAttribute);
+ }
+ for (EmbeddedId embeddedId : attributes.getEmbeddedIds()) {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(embeddedId);
+ this.specifiedPersistentAttributes.add(xmlPersistentAttribute);
+ }
+ for (Basic basic : attributes.getBasics()) {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(basic);
+ this.specifiedPersistentAttributes.add(xmlPersistentAttribute);
+ }
+ for (Version version : attributes.getVersions()) {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(version);
+ this.specifiedPersistentAttributes.add(xmlPersistentAttribute);
+ }
+ for (ManyToOne manyToOne : attributes.getManyToOnes()) {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(manyToOne);
+ this.specifiedPersistentAttributes.add(xmlPersistentAttribute);
+ }
+ for (OneToMany oneToMany : attributes.getOneToManys()) {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(oneToMany);
+ this.specifiedPersistentAttributes.add(xmlPersistentAttribute);
+ }
+ for (OneToOne oneToOne : attributes.getOneToOnes()) {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(oneToOne);
+ this.specifiedPersistentAttributes.add(xmlPersistentAttribute);
+ }
+ for (ManyToMany manyToMany : attributes.getManyToManys()) {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(manyToMany);
+ this.specifiedPersistentAttributes.add(xmlPersistentAttribute);
+ }
+ for (Embedded embedded : attributes.getEmbeddeds()) {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(embedded);
+ this.specifiedPersistentAttributes.add(xmlPersistentAttribute);
+ }
+ for (Transient transientResource : attributes.getTransients()) {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(transientResource);
+ this.specifiedPersistentAttributes.add(xmlPersistentAttribute);
+ }
+ }
+
+ protected void initializeVirtualPersistentAttributes() {
+ ListIterator<IJavaPersistentAttribute> javaAttributes = javaPersistentAttributes();
+
+ while (javaAttributes.hasNext()) {
+ IJavaPersistentAttribute javaPersistentAttribute = javaAttributes.next();
+ if (specifiedAttributeNamed(javaPersistentAttribute.getName()) == null) {
+ XmlPersistentAttribute xmlPersistentAttribute = createVirtualPersistentAttribute(javaPersistentAttribute);
+ this.virtualPersistentAttributes.add(xmlPersistentAttribute);
+ }
+ }
+ }
+
+ protected ListIterator<IJavaPersistentAttribute> javaPersistentAttributes() {
+ IJavaPersistentType javaPersistentType = javaPersistentType();
+ if (javaPersistentType != null) {
+ return javaPersistentType.attributes();
+ }
+ return EmptyListIterator.instance();
+ }
+
+ protected void initializeParentPersistentType() {
+ IJavaPersistentType javaPersistentType = javaPersistentType();
+ if (javaPersistentType != null) {
+ this.parentPersistentType = javaPersistentType.parentPersistentType();
+ }
+ }
+
+ public void update(Entity entity) {
+ if (mappingKey() == IMappingKeys.ENTITY_TYPE_MAPPING_KEY) {
+ ((XmlEntity) getMapping()).update(entity);
+ }
+ else {
+ setMappingKey_(IMappingKeys.ENTITY_TYPE_MAPPING_KEY);
+ ((XmlEntity) getMapping()).initialize(entity);
+ }
+ this.updateParentPersistentType();
+ this.updatePersistentAttributes(entity);
+ }
+
+ public void update(MappedSuperclass mappedSuperclass) {
+ if (mappingKey() == IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY) {
+ ((XmlMappedSuperclass) getMapping()).update(mappedSuperclass);
+ }
+ else {
+ setMappingKey_(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
+ ((XmlMappedSuperclass) getMapping()).initialize(mappedSuperclass);
+ }
+ this.updateParentPersistentType();
+ this.updatePersistentAttributes(mappedSuperclass);
+ }
+
+ public void update(Embeddable embeddable) {
+ if (mappingKey() == IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY) {
+ ((XmlEmbeddable) getMapping()).update(embeddable);
+ }
+ else {
+ setMappingKey_(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
+ ((XmlEmbeddable) getMapping()).initialize(embeddable);
+ }
+ this.updateParentPersistentType();
+ this.updatePersistentAttributes(embeddable);
+ }
+
+ protected void updateParentPersistentType() {
+ IJavaPersistentType javaPersistentType = javaPersistentType();
+ if (javaPersistentType == null) {
+ //TODO change notification for this?
+ this.parentPersistentType = null;
+ return;
+ }
+ this.parentPersistentType = javaPersistentType.parentPersistentType();
+ }
+
+ protected void updatePersistentAttributes(org.eclipse.jpt.core.internal.resource.orm.TypeMapping typeMapping) {
+ ListIterator<XmlPersistentAttribute> xmlPersistentAttributes = this.specifiedAttributes();
+ if (typeMapping.getAttributes() != null) {
+ this.updateIds(typeMapping.getAttributes(), xmlPersistentAttributes);
+ this.updateEmbeddedIds(typeMapping.getAttributes(), xmlPersistentAttributes);
+ this.updateBasics(typeMapping.getAttributes(), xmlPersistentAttributes);
+ this.updateVersions(typeMapping.getAttributes(), xmlPersistentAttributes);
+ this.updateManyToOnes(typeMapping.getAttributes(), xmlPersistentAttributes);
+ this.updateOneToManys(typeMapping.getAttributes(), xmlPersistentAttributes);
+ this.updateOneToOnes(typeMapping.getAttributes(), xmlPersistentAttributes);
+ this.updateManyToManys(typeMapping.getAttributes(), xmlPersistentAttributes);
+ this.updateEmbeddeds(typeMapping.getAttributes(), xmlPersistentAttributes);
+ this.updateTransients(typeMapping.getAttributes(), xmlPersistentAttributes);
+ }
+ while (xmlPersistentAttributes.hasNext()) {
+ this.removeSpecifiedPersistentAttribute_(xmlPersistentAttributes.next());
+ }
+ this.updateVirtualPersistentAttributes();
+ }
+
+ protected void updateVirtualAttribute(XmlPersistentAttribute xmlAttribute, IJavaPersistentAttribute javaAttribute) {
+ if (javaAttribute.mappingKey() == IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY) {
+ xmlAttribute.update(new VirtualBasic((IJavaBasicMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY) {
+ xmlAttribute.update(new VirtualEmbedded((IJavaEmbeddedMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY) {
+ xmlAttribute.update(new VirtualEmbeddedId((IJavaEmbeddedIdMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY) {
+ xmlAttribute.update(new VirtualId((IJavaIdMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
+ xmlAttribute.update(new VirtualManyToMany((IJavaManyToManyMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
+ xmlAttribute.update(new VirtualManyToOne((IJavaManyToOneMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
+ xmlAttribute.update(new VirtualOneToMany((IJavaOneToManyMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
+ xmlAttribute.update(new VirtualOneToOne((IJavaOneToOneMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY) {
+ xmlAttribute.update(new VirtualTransient((IJavaTransientMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY) {
+ xmlAttribute.update(new VirtualVersion((IJavaVersionMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ }
+
+ protected void updateVirtualPersistentAttributes() {
+ ListIterator<IJavaPersistentAttribute> javaAttributes = this.javaPersistentAttributes();
+ ListIterator<XmlPersistentAttribute> xmlVirtualAttributes = this.virtualAttributes();
+ for (IJavaPersistentAttribute javaAttribute : CollectionTools.iterable(javaAttributes)) {
+ if (specifiedAttributeNamed(javaAttribute.getName()) == null) {
+ if (xmlVirtualAttributes.hasNext()) {
+ updateVirtualAttribute(xmlVirtualAttributes.next(), javaAttribute);
+ }
+ else {
+ XmlPersistentAttribute xmlPersistentAttribute = createVirtualPersistentAttribute(javaAttribute);
+ addVirtualPersistentAttribute(xmlPersistentAttribute);
+ }
+ }
+ }
+
+ while (xmlVirtualAttributes.hasNext()) {
+ this.removeVirtualPersistentAttribute(xmlVirtualAttributes.next());
+ }
+
+ }
+
+ protected void addVirtualPersistentAttribute(IJavaPersistentAttribute javaAttribute) {
+ addVirtualPersistentAttribute(createVirtualPersistentAttribute(javaAttribute));
+ }
+
+ protected XmlPersistentAttribute createVirtualPersistentAttribute(IJavaPersistentAttribute javaAttribute) {
+ XmlPersistentAttribute xmlPersistentAttribute = new XmlPersistentAttribute(this, javaAttribute.mappingKey());
+ if (javaAttribute.mappingKey() == IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY) {
+ xmlPersistentAttribute.initialize(new VirtualBasic((IJavaBasicMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY) {
+ xmlPersistentAttribute.initialize(new VirtualEmbeddedId((IJavaEmbeddedIdMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY) {
+ xmlPersistentAttribute.initialize(new VirtualEmbedded((IJavaEmbeddedMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY) {
+ xmlPersistentAttribute.initialize(new VirtualId((IJavaIdMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
+ xmlPersistentAttribute.initialize(new VirtualManyToMany((IJavaManyToManyMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
+ xmlPersistentAttribute.initialize(new VirtualManyToOne((IJavaManyToOneMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
+ xmlPersistentAttribute.initialize(new VirtualOneToMany((IJavaOneToManyMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
+ xmlPersistentAttribute.initialize(new VirtualOneToOne((IJavaOneToOneMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY) {
+ xmlPersistentAttribute.initialize(new VirtualTransient((IJavaTransientMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ else if (javaAttribute.mappingKey() == IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY) {
+ xmlPersistentAttribute.initialize(new VirtualVersion((IJavaVersionMapping) javaAttribute.getMapping(), getMapping().isMetadataComplete()));
+ }
+ return xmlPersistentAttribute;
+ }
+
+ protected void updateIds(org.eclipse.jpt.core.internal.resource.orm.Attributes attributes, ListIterator<XmlPersistentAttribute> xmlPersistentAttributes) {
+ for (Id id : attributes.getIds()) {
+ if (xmlPersistentAttributes.hasNext()) {
+ xmlPersistentAttributes.next().update(id);
+ }
+ else {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(id);
+ addSpecifiedPersistentAttribute_(xmlPersistentAttribute);
+ }
+ }
+ }
+
+ protected void updateEmbeddedIds(org.eclipse.jpt.core.internal.resource.orm.Attributes attributes, ListIterator<XmlPersistentAttribute> xmlPersistentAttributes) {
+ for (EmbeddedId embeddedId : attributes.getEmbeddedIds()) {
+ if (xmlPersistentAttributes.hasNext()) {
+ xmlPersistentAttributes.next().update(embeddedId);
+ }
+ else {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(embeddedId);
+ addSpecifiedPersistentAttribute_(xmlPersistentAttribute);
+ }
+ }
+ }
+
+ protected void updateBasics(org.eclipse.jpt.core.internal.resource.orm.Attributes attributes, ListIterator<XmlPersistentAttribute> xmlPersistentAttributes) {
+ for (Basic basic : attributes.getBasics()) {
+ if (xmlPersistentAttributes.hasNext()) {
+ xmlPersistentAttributes.next().update(basic);
+ }
+ else {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(basic);
+ addSpecifiedPersistentAttribute_(xmlPersistentAttribute);
+ }
+ }
+ }
+
+ protected void updateVersions(org.eclipse.jpt.core.internal.resource.orm.Attributes attributes, ListIterator<XmlPersistentAttribute> xmlPersistentAttributes) {
+ for (Version version : attributes.getVersions()) {
+ if (xmlPersistentAttributes.hasNext()) {
+ xmlPersistentAttributes.next().update(version);
+ }
+ else {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(version);
+ addSpecifiedPersistentAttribute_(xmlPersistentAttribute);
+ }
+ }
+ }
+ protected void updateManyToOnes(org.eclipse.jpt.core.internal.resource.orm.Attributes attributes, ListIterator<XmlPersistentAttribute> xmlPersistentAttributes) {
+ for (ManyToOne manyToOne : attributes.getManyToOnes()) {
+ if (xmlPersistentAttributes.hasNext()) {
+ xmlPersistentAttributes.next().update(manyToOne);
+ }
+ else {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(manyToOne);
+ addSpecifiedPersistentAttribute_(xmlPersistentAttribute);
+ }
+ }
+ }
+ protected void updateOneToManys(org.eclipse.jpt.core.internal.resource.orm.Attributes attributes, ListIterator<XmlPersistentAttribute> xmlPersistentAttributes) {
+ for (OneToMany oneToMany : attributes.getOneToManys()) {
+ if (xmlPersistentAttributes.hasNext()) {
+ xmlPersistentAttributes.next().update(oneToMany);
+ }
+ else {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(oneToMany);
+ addSpecifiedPersistentAttribute_(xmlPersistentAttribute);
+ }
+ }
+ }
+ protected void updateOneToOnes(org.eclipse.jpt.core.internal.resource.orm.Attributes attributes, ListIterator<XmlPersistentAttribute> xmlPersistentAttributes) {
+ for (OneToOne oneToOne : attributes.getOneToOnes()) {
+ if (xmlPersistentAttributes.hasNext()) {
+ xmlPersistentAttributes.next().update(oneToOne);
+ }
+ else {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(oneToOne);
+ addSpecifiedPersistentAttribute_(xmlPersistentAttribute);
+ }
+ }
+ }
+ protected void updateManyToManys(org.eclipse.jpt.core.internal.resource.orm.Attributes attributes, ListIterator<XmlPersistentAttribute> xmlPersistentAttributes) {
+ for (ManyToMany manyToMany : attributes.getManyToManys()) {
+ if (xmlPersistentAttributes.hasNext()) {
+ xmlPersistentAttributes.next().update(manyToMany);
+ }
+ else {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(manyToMany);
+ addSpecifiedPersistentAttribute_(xmlPersistentAttribute);
+ }
+ }
+ }
+
+ protected void updateEmbeddeds(org.eclipse.jpt.core.internal.resource.orm.Attributes attributes, ListIterator<XmlPersistentAttribute> xmlPersistentAttributes) {
+ for (Embedded embedded : attributes.getEmbeddeds()) {
+ if (xmlPersistentAttributes.hasNext()) {
+ xmlPersistentAttributes.next().update(embedded);
+ }
+ else {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(embedded);
+ addSpecifiedPersistentAttribute_(xmlPersistentAttribute);
+ }
+ }
+ }
+
+ protected void updateTransients(org.eclipse.jpt.core.internal.resource.orm.Attributes attributes, ListIterator<XmlPersistentAttribute> xmlPersistentAttributes) {
+ for (Transient transientResource : attributes.getTransients()) {
+ if (xmlPersistentAttributes.hasNext()) {
+ xmlPersistentAttributes.next().update(transientResource);
+ }
+ else {
+ XmlPersistentAttribute xmlPersistentAttribute = jpaFactory().createXmlPersistentAttribute(this, IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
+ xmlPersistentAttribute.initialize(transientResource);
+ addSpecifiedPersistentAttribute_(xmlPersistentAttribute);
+ }
+ }
+ }
+
+// public IJpaContentNode getContentNode(int offset) {
+// for (XmlAttributeMapping mapping : this.getSpecifiedAttributeMappings()) {
+// if (mapping.getNode().contains(offset)) {
+// return mapping.getContentNode(offset);
+// }
+// }
+// return this;
+// }
+//
+ public IPersistentAttribute resolveAttribute(String attributeName) {
+ Iterator<XmlPersistentAttribute> attributes = attributesNamed(attributeName);
+ if (attributes.hasNext()) {
+ XmlPersistentAttribute attribute = attributes.next();
+ return attributes.hasNext() ? null /* more than one */: attribute;
+ }
+ else if (parentPersistentType() != null) {
+ return parentPersistentType().resolveAttribute(attributeName);
+ }
+ else {
+ return null;
+ }
+ }
+//
+// @Override
+// public ITextRange validationTextRange() {
+// return selectionTextRange();
+// }
+//
+// @Override
+// public ITextRange selectionTextRange() {
+// return getMapping().selectionTextRange();
+// }
+//
+// public ITextRange classTextRange() {
+// return getMapping().classTextRange();
+// }
+//
+// public ITextRange attributesTextRange() {
+// return getMapping().attributesTextRange();
+// }
+
+ @Override
+ public XmlPersistentType xmlPersistentType() {
+ return this;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlPrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..cda388bf8c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlPrimaryKeyJoinColumn.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.IPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.db.internal.Column;
+import org.eclipse.jpt.db.internal.Table;
+
+public class XmlPrimaryKeyJoinColumn extends AbstractXmlNamedColumn<PrimaryKeyJoinColumn>
+ implements IPrimaryKeyJoinColumn
+{
+ protected String specifiedReferencedColumnName;
+
+ protected String defaultReferencedColumnName;
+
+ protected PrimaryKeyJoinColumn primaryKeyJoinColumn;
+
+ protected XmlPrimaryKeyJoinColumn(IJpaContextNode parent, IAbstractJoinColumn.Owner owner) {
+ super(parent, owner);
+ }
+
+ @Override
+ protected PrimaryKeyJoinColumn columnResource() {
+ return this.primaryKeyJoinColumn;
+ }
+
+ @Override
+ protected void addColumnResource() {
+ //primaryKeyJoinColumns are part of a collection, the pk-join-column element will be removed/added
+ //when the XmlPrimaryKeyJoinColumn is removed/added to the XmlEntity collection
+ }
+
+ @Override
+ protected void removeColumnResource() {
+ //primaryKeyJoinColumns are part of a collection, the pk-join-column element will be removed/added
+ //when the XmlPrimaryKeyJoinColumn is removed/added to the XmlEntity collection
+ }
+
+ public String getReferencedColumnName() {
+ return (this.getSpecifiedReferencedColumnName() == null) ? getDefaultReferencedColumnName() : this.getSpecifiedReferencedColumnName();
+ }
+
+ public String getSpecifiedReferencedColumnName() {
+ return this.specifiedReferencedColumnName;
+ }
+
+ public void setSpecifiedReferencedColumnName(String newSpecifiedReferencedColumnName) {
+ String oldSpecifiedReferencedColumnName = this.specifiedReferencedColumnName;
+ this.specifiedReferencedColumnName = newSpecifiedReferencedColumnName;
+ columnResource().setReferencedColumnName(newSpecifiedReferencedColumnName);
+ firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, oldSpecifiedReferencedColumnName, newSpecifiedReferencedColumnName);
+ }
+
+ public String getDefaultReferencedColumnName() {
+ return this.defaultReferencedColumnName;
+ }
+
+ protected void setDefaultReferencedColumnName(String newDefaultReferencedColumnName) {
+ String oldDefaultReferencedColumnName = this.defaultReferencedColumnName;
+ this.defaultReferencedColumnName = newDefaultReferencedColumnName;
+ firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, oldDefaultReferencedColumnName, newDefaultReferencedColumnName);
+ }
+
+ @Override
+ public IAbstractJoinColumn.Owner owner() {
+ return (IAbstractJoinColumn.Owner) this.owner;
+ }
+
+ public Column dbReferencedColumn() {
+ Table table = this.dbReferencedColumnTable();
+ return (table == null) ? null : table.columnNamed(this.getReferencedColumnName());
+ }
+
+ public Table dbReferencedColumnTable() {
+ return owner().dbReferencedColumnTable();
+ }
+
+ @Override
+ protected String tableName() {
+ return this.owner().typeMapping().getTableName();
+ }
+
+ public boolean isReferencedColumnResolved() {
+ return dbReferencedColumn() != null;
+ }
+
+ public ITextRange referencedColumnNameTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+// public ITextRange referencedColumnNameTextRange() {
+// if (node == null) {
+// return owner.validationTextRange();
+// }
+// IDOMNode referencedColumnNameNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.REFERENCED_COLUMN_NAME);
+// return (referencedColumnNameNode == null) ? validationTextRange() : buildTextRange(referencedColumnNameNode);
+// }
+//
+// public void refreshDefaults(DefaultsContext defaultsContext) {
+// setDefaultReferencedColumnName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_REFERENCED_COLUMN_NAME_KEY));
+// setDefaultName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_NAME_KEY));
+// }
+
+
+ public boolean isVirtual() {
+ return owner().isVirtual(this);
+ }
+
+ @Override
+ protected void initialize(PrimaryKeyJoinColumn column) {
+ this.primaryKeyJoinColumn = column;
+ super.initialize(column);
+ this.specifiedReferencedColumnName = column.getReferencedColumnName();
+ this.defaultReferencedColumnName = defaultReferencedColumnName();
+ }
+
+ @Override
+ protected void update(PrimaryKeyJoinColumn column) {
+ this.primaryKeyJoinColumn = column;
+ super.update(column);
+ this.setSpecifiedReferencedColumnName(column.getReferencedColumnName());
+ this.setDefaultReferencedColumnName(defaultReferencedColumnName());
+ }
+
+ protected String defaultReferencedColumnName() {
+ //TODO
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlQueryHint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlQueryHint.java
new file mode 100644
index 0000000000..5b10162054
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlQueryHint.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.context.base.IQueryHint;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.resource.orm.QueryHint;
+
+
+public class XmlQueryHint extends JpaContextNode implements IQueryHint
+{
+
+ protected String name;
+
+ protected String value;
+
+ protected QueryHint queryHint;
+
+ public XmlQueryHint(AbstractXmlQuery<?> parent) {
+ super(parent);
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.queryHint.setName(newName);
+ firePropertyChanged(IQueryHint.NAME_PROPERTY, oldName, newName);
+ }
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String newValue) {
+ String oldValue = this.value;
+ this.value = newValue;
+ this.queryHint.setValue(newValue);
+ firePropertyChanged(IQueryHint.VALUE_PROPERTY, oldValue, newValue);
+ }
+
+ public void initialize(QueryHint queryHint) {
+ this.queryHint = queryHint;
+ this.name = queryHint.getName();
+ this.value = queryHint.getValue();
+ }
+
+ public void update(QueryHint queryHint) {
+ this.queryHint = queryHint;
+ this.setName(queryHint.getName());
+ this.setValue(queryHint.getValue());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlRelationshipMapping.java
new file mode 100644
index 0000000000..7b08f931c1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlRelationshipMapping.java
@@ -0,0 +1,230 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IFetchable;
+import org.eclipse.jpt.core.internal.context.base.IRelationshipMapping;
+import org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+
+
+public abstract class XmlRelationshipMapping<T extends RelationshipMapping> extends XmlAttributeMapping<T>
+ implements IRelationshipMapping
+{
+
+ protected String specifiedTargetEntity;
+
+ protected String defaultTargetEntity;
+
+ protected IEntity resolvedTargetEntity;
+
+ protected FetchType specifiedFetch;
+
+ protected final XmlCascade cascade;
+
+
+ protected XmlRelationshipMapping(XmlPersistentAttribute parent) {
+ super(parent);
+ this.cascade = new XmlCascade(this);
+ }
+
+ public String getTargetEntity() {
+ return (this.getSpecifiedTargetEntity() == null) ? getDefaultTargetEntity() : this.getSpecifiedTargetEntity();
+ }
+
+ public String getSpecifiedTargetEntity() {
+ return this.specifiedTargetEntity;
+ }
+
+ public void setSpecifiedTargetEntity(String newSpecifiedTargetEntity) {
+ String oldSpecifiedTargetEntity = this.specifiedTargetEntity;
+ this.specifiedTargetEntity = newSpecifiedTargetEntity;
+ attributeMapping().setTargetEntity(newSpecifiedTargetEntity);
+ firePropertyChanged(SPECIFIED_TARGET_ENTITY_PROPERTY, oldSpecifiedTargetEntity, newSpecifiedTargetEntity);
+ }
+
+ protected void setSpecifiedTargetEntity_(String newSpecifiedTargetEntity) {
+ String oldSpecifiedTargetEntity = this.specifiedTargetEntity;
+ this.specifiedTargetEntity = newSpecifiedTargetEntity;
+ firePropertyChanged(SPECIFIED_TARGET_ENTITY_PROPERTY, oldSpecifiedTargetEntity, newSpecifiedTargetEntity);
+ }
+
+ public String getDefaultTargetEntity() {
+ return this.defaultTargetEntity;
+ }
+
+ protected void setDefaultTargetEntity(String newDefaultTargetEntity) {
+ String oldDefaultTargetEntity = this.defaultTargetEntity;
+ this.defaultTargetEntity = newDefaultTargetEntity;
+ firePropertyChanged(DEFAULT_TARGET_ENTITY_PROPERTY, oldDefaultTargetEntity, newDefaultTargetEntity);
+ }
+
+ public IEntity getResolvedTargetEntity() {
+ return this.resolvedTargetEntity;
+ }
+
+ protected void setResolvedTargetEntity(IEntity newResolvedTargetEntity) {
+ IEntity oldResolvedTargetEntity = this.resolvedTargetEntity;
+ this.resolvedTargetEntity = newResolvedTargetEntity;
+ firePropertyChanged(RESOLVED_TARGET_ENTITY_PROPERTY, oldResolvedTargetEntity, newResolvedTargetEntity);
+ }
+
+ public FetchType getFetch() {
+ return (this.getSpecifiedFetch() == null) ? this.getDefaultFetch() : this.getSpecifiedFetch();
+ }
+
+ public FetchType getSpecifiedFetch() {
+ return this.specifiedFetch;
+ }
+
+ public void setSpecifiedFetch(FetchType newSpecifiedFetch) {
+ FetchType oldFetch = this.specifiedFetch;
+ this.specifiedFetch = newSpecifiedFetch;
+ this.attributeMapping().setFetch(FetchType.toOrmResourceModel(newSpecifiedFetch));
+ firePropertyChanged(IFetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch);
+ }
+
+ protected void setSpecifiedFetch_(FetchType newSpecifiedFetch) {
+ FetchType oldFetch = this.specifiedFetch;
+ this.specifiedFetch = newSpecifiedFetch;
+ firePropertyChanged(IFetchable.SPECIFIED_FETCH_PROPERTY, oldFetch, newSpecifiedFetch);
+ }
+
+ public XmlCascade getCascade() {
+ return this.cascade;
+ }
+
+
+ @Override
+ public void initializeFromXmlRelationshipMapping(XmlRelationshipMapping<? extends RelationshipMapping> oldMapping) {
+ super.initializeFromXmlRelationshipMapping(oldMapping);
+ setSpecifiedTargetEntity(oldMapping.getSpecifiedTargetEntity());
+ setSpecifiedFetch(oldMapping.getSpecifiedFetch());
+ }
+ //TODO should we set the fetch type from a BasicMapping??
+
+
+// public boolean targetEntityIsValid(String targetEntity) {
+// return RelationshipMappingTools.targetEntityIsValid(targetEntity);
+// }
+//
+// public IEntity getEntity() {
+// ITypeMapping typeMapping = getPersistentType().getMapping();
+// if (typeMapping instanceof IEntity) {
+// return (IEntity) typeMapping;
+// }
+// return null;
+// }
+//
+// public String fullyQualifiedTargetEntity(CompilationUnit astRoot) {
+// if (getTargetEntity() == null) {
+// return null;
+// }
+// if (targetEntityIncludesPackage()) {
+// return getTargetEntity();
+// }
+// String package_ = persistentType().getMapping().getEntityMappings().getPackage();
+// if (package_ != null) {
+// return package_ + '.' + getTargetEntity();
+// }
+// return getTargetEntity();
+// }
+//
+// private boolean targetEntityIncludesPackage() {
+// return getTargetEntity().lastIndexOf('.') != -1;
+// }
+
+ public Iterator<String> allTargetEntityAttributeNames() {
+ IEntity targetEntity = this.getResolvedTargetEntity();
+ return (targetEntity == null) ? EmptyIterator.<String> instance() : targetEntity.persistentType().allAttributeNames();
+ }
+
+ public Iterator<String> candidateMappedByAttributeNames() {
+ return this.allTargetEntityAttributeNames();
+ }
+
+// @Override
+// public void refreshDefaults(DefaultsContext defaultsContext) {
+// super.refreshDefaults(defaultsContext);
+// setDefaultTargetEntity((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_TARGET_ENTITY_KEY));
+// String targetEntity = fullyQualifiedTargetEntity(defaultsContext.astRoot());
+// if (targetEntity != null) {
+// IPersistentType persistentType = defaultsContext.persistentType(targetEntity);
+// if (persistentType != null) {
+// if (persistentType.getMapping() instanceof IEntity) {
+// setResolvedTargetEntity((IEntity) persistentType.getMapping());
+// return;
+// }
+// }
+// }
+// setResolvedTargetEntity(null);
+// }
+//
+// /**
+// * the default 'targetEntity' is calculated from the attribute type;
+// * return null if the attribute type cannot possibly be an entity
+// */
+// public String javaDefaultTargetEntity(CompilationUnit astRoot) {
+// ITypeBinding typeBinding = this.getPersistentAttribute().getAttribute().typeBinding(astRoot);
+// if (typeBinding != null) {
+// return this.javaDefaultTargetEntity(typeBinding);
+// }
+// return null;
+// }
+//
+// protected String javaDefaultTargetEntity(ITypeBinding typeBinding) {
+// return buildReferenceEntityTypeName(typeBinding);
+// }
+//
+// protected String buildReferenceEntityTypeName(ITypeBinding typeBinding) {
+// return JavaRelationshipMapping.buildReferenceEntityTypeName(typeBinding);
+// }
+
+ public String fullyQualifiedTargetEntity(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IEntity getEntity() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean targetEntityIsValid(String targetEntity) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void initialize(T relationshipMapping) {
+ super.initialize(relationshipMapping);
+ this.specifiedTargetEntity = relationshipMapping.getTargetEntity();
+ this.defaultTargetEntity = null;//TODO default target entity
+ this.specifiedFetch = this.specifiedFetch(relationshipMapping);
+ this.cascade.initialize(relationshipMapping);
+ }
+
+ @Override
+ public void update(T relationshipMapping) {
+ super.update(relationshipMapping);
+ this.setSpecifiedTargetEntity_(relationshipMapping.getTargetEntity());
+ this.setDefaultTargetEntity(null);//TODO default target entity
+ this.setSpecifiedFetch_(this.specifiedFetch(relationshipMapping));
+ this.cascade.update(relationshipMapping);
+ }
+
+ protected FetchType specifiedFetch(RelationshipMapping relationshipMapping) {
+ return FetchType.fromOrmResourceModel(relationshipMapping.getFetch());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlSecondaryTable.java
new file mode 100644
index 0000000000..ff7d8a79fd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlSecondaryTable.java
@@ -0,0 +1,216 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.ISecondaryTable;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.AbstractTable;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.orm.SecondaryTable;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+
+public class XmlSecondaryTable extends AbstractXmlTable
+ implements ISecondaryTable
+{
+ protected SecondaryTable secondaryTable;
+
+ protected final List<XmlPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns;
+
+ protected final List<XmlPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns;
+
+ protected XmlSecondaryTable(XmlEntity parent) {
+ super(parent);
+ this.specifiedPrimaryKeyJoinColumns = new ArrayList<XmlPrimaryKeyJoinColumn>();
+ this.defaultPrimaryKeyJoinColumns = new ArrayList<XmlPrimaryKeyJoinColumn>();
+// this.getDefaultPrimaryKeyJoinColumns().add(this.createPrimaryKeyJoinColumn(0));
+ }
+
+ public XmlEntity xmlEntity() {
+ return (XmlEntity) super.parent();
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlPrimaryKeyJoinColumn> defaultPrimaryKeyJoinColumns() {
+ return new CloneListIterator<XmlPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumns);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns() {
+ return this.specifiedPrimaryKeyJoinColumns.isEmpty() ? this.defaultPrimaryKeyJoinColumns() : this.specifiedPrimaryKeyJoinColumns();
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumns() {
+ return new CloneListIterator<XmlPrimaryKeyJoinColumn>(this.specifiedPrimaryKeyJoinColumns);
+ }
+
+ public int specifiedPrimaryKeyJoinColumnsSize() {
+ return this.specifiedPrimaryKeyJoinColumns.size();
+ }
+
+ public XmlPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
+ XmlPrimaryKeyJoinColumn primaryKeyJoinColumn = new XmlPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner());
+ this.specifiedPrimaryKeyJoinColumns.add(index, primaryKeyJoinColumn);
+ this.secondaryTable.getPrimaryKeyJoinColumns().add(index, OrmFactory.eINSTANCE.createPrimaryKeyJoinColumn());
+ this.fireItemAdded(ISecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, primaryKeyJoinColumn);
+ return primaryKeyJoinColumn;
+ }
+
+ protected IAbstractJoinColumn.Owner createPrimaryKeyJoinColumnOwner() {
+ return new PrimaryKeyJoinColumnOwner();
+ }
+
+ protected void addSpecifiedPrimaryKeyJoinColumn(int index, XmlPrimaryKeyJoinColumn primaryKeyJoinColumn) {
+ addItemToList(index, primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, ISecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
+ XmlPrimaryKeyJoinColumn removedPrimaryKeyJoinColumn = this.specifiedPrimaryKeyJoinColumns.remove(index);
+ this.secondaryTable.getPrimaryKeyJoinColumns().remove(index);
+ fireItemRemoved(ISecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, index, removedPrimaryKeyJoinColumn);
+ }
+
+ protected void removeSpecifiedPrimaryKeyJoinColumn(XmlPrimaryKeyJoinColumn primaryKeyJoinColumn) {
+ removeItemFromList(primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, ISecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedPrimaryKeyJoinColumns, targetIndex, sourceIndex);
+ this.secondaryTable.getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex);
+ fireItemMoved(ISecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
+ }
+
+
+ public boolean isVirtual() {
+ return xmlEntity().containsVirtualSecondaryTable(this);
+ }
+
+ @Override
+ protected void addTableResource() {
+ //secondaryTables are part of a collection, the secondary-table element will be removed/added
+ //when the XmlSecondaryTable is removed/added to the XmlEntity collection
+ }
+
+ @Override
+ protected void removeTableResource() {
+ //secondaryTables are part of a collection, the secondary-table element will be removed/added
+ //when the XmlSecondaryTable is removed/added to the XmlEntity collection
+ }
+
+ @Override
+ protected AbstractTable table() {
+ return this.secondaryTable;
+ }
+
+ public void initialize(SecondaryTable secondaryTable) {
+ this.secondaryTable = secondaryTable;
+ super.initialize(secondaryTable);
+ this.initializeSpecifiedPrimaryKeyJoinColumns(secondaryTable);
+ }
+
+ protected void initializeSpecifiedPrimaryKeyJoinColumns(SecondaryTable secondaryTable) {
+ for (PrimaryKeyJoinColumn primaryKeyJoinColumn : secondaryTable.getPrimaryKeyJoinColumns()) {
+ this.specifiedPrimaryKeyJoinColumns.add(createPrimaryKeyJoinColumn(primaryKeyJoinColumn));
+ }
+ }
+
+ public void update(SecondaryTable secondaryTable) {
+ this.secondaryTable = secondaryTable;
+ super.update(secondaryTable);
+ this.updateSpecifiedPrimaryKeyJoinColumns(secondaryTable);
+ }
+
+ protected void updateSpecifiedPrimaryKeyJoinColumns(SecondaryTable secondaryTable) {
+ ListIterator<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns = specifiedPrimaryKeyJoinColumns();
+ ListIterator<PrimaryKeyJoinColumn> resourcePrimaryKeyJoinColumns = secondaryTable.getPrimaryKeyJoinColumns().listIterator();
+
+ while (primaryKeyJoinColumns.hasNext()) {
+ XmlPrimaryKeyJoinColumn primaryKeyJoinColumn = primaryKeyJoinColumns.next();
+ if (resourcePrimaryKeyJoinColumns.hasNext()) {
+ primaryKeyJoinColumn.update(resourcePrimaryKeyJoinColumns.next());
+ }
+ else {
+ removeSpecifiedPrimaryKeyJoinColumn(primaryKeyJoinColumn);
+ }
+ }
+
+ while (resourcePrimaryKeyJoinColumns.hasNext()) {
+ addSpecifiedPrimaryKeyJoinColumn(specifiedPrimaryKeyJoinColumnsSize(), createPrimaryKeyJoinColumn(resourcePrimaryKeyJoinColumns.next()));
+ }
+ }
+
+ protected XmlPrimaryKeyJoinColumn createPrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumn) {
+ XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = new XmlPrimaryKeyJoinColumn(this, createPrimaryKeyJoinColumnOwner());
+ xmlPrimaryKeyJoinColumn.initialize(primaryKeyJoinColumn);
+ return xmlPrimaryKeyJoinColumn;
+ }
+
+ @Override
+ //no default name for secondaryTables
+ protected String defaultName() {
+ return null;
+ }
+
+ @Override
+ protected String defaultCatalog() {
+ return entityMappings().getCatalog();
+ }
+
+ @Override
+ protected String defaultSchema() {
+ return entityMappings().getSchema();
+ }
+
+ class PrimaryKeyJoinColumnOwner implements IAbstractJoinColumn.Owner
+ {
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ //TODO textRange
+ return null;//return XmlSecondaryTable.this.validationTextRange(astRoot);
+ }
+
+ public ITypeMapping typeMapping() {
+ return XmlSecondaryTable.this.xmlEntity();
+ }
+
+ public Table dbTable(String tableName) {
+ return XmlSecondaryTable.this.dbTable();
+ }
+
+ public Table dbReferencedColumnTable() {
+ return typeMapping().primaryDbTable();
+ }
+
+ public int joinColumnsSize() {
+ return CollectionTools.size(XmlSecondaryTable.this.primaryKeyJoinColumns());
+ }
+
+ public boolean isVirtual(IAbstractJoinColumn joinColumn) {
+ return XmlSecondaryTable.this.defaultPrimaryKeyJoinColumns.contains(joinColumn);
+ }
+
+ public String defaultColumnName() {
+ if (joinColumnsSize() != 1) {
+ return null;
+ }
+ return xmlEntity().parentEntity().primaryKeyColumnName();
+
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlSequenceGenerator.java
new file mode 100644
index 0000000000..94d86195f4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlSequenceGenerator.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.ISequenceGenerator;
+import org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator;
+
+
+public class XmlSequenceGenerator extends XmlGenerator<SequenceGenerator>
+ implements ISequenceGenerator
+{
+
+ protected String specifiedSequenceName;
+
+ protected String defaultSequenceName;
+
+ protected XmlSequenceGenerator(IJpaContextNode parent) {
+ super(parent);
+ }
+
+ public String getSequenceName() {
+ return (this.getSpecifiedSequenceName() == null) ? getDefaultSequenceName() : this.getSpecifiedSequenceName();
+ }
+
+ public String getSpecifiedSequenceName() {
+ return this.specifiedSequenceName;
+ }
+
+ public void setSpecifiedSequenceName(String newSpecifiedSequenceName) {
+ String oldSpecifiedSequenceName = this.specifiedSequenceName;
+ this.specifiedSequenceName = newSpecifiedSequenceName;
+ generatorResource().setSequenceName(newSpecifiedSequenceName);
+ firePropertyChanged(SPECIFIED_SEQUENCE_NAME_PROPERTY, oldSpecifiedSequenceName, newSpecifiedSequenceName);
+ }
+
+ public String getDefaultSequenceName() {
+ return this.defaultSequenceName;
+ }
+
+ protected void setDefaultSequenceName(String newDefaultSequenceName) {
+ String oldSpecifiedSequenceName = this.defaultSequenceName;
+ this.defaultSequenceName = newDefaultSequenceName;
+ firePropertyChanged(DEFAULT_SEQUENCE_NAME_PROPERTY, oldSpecifiedSequenceName, newDefaultSequenceName);
+ }
+
+ @Override
+ public void initialize(SequenceGenerator sequenceGenerator) {
+ super.initialize(sequenceGenerator);
+ this.specifiedSequenceName = this.specifiedSequenceName(sequenceGenerator);
+ //TODO default sequence name
+ }
+
+ @Override
+ public void update(SequenceGenerator sequenceGenerator) {
+ super.update(sequenceGenerator);
+ this.setSpecifiedSequenceName(this.specifiedSequenceName(sequenceGenerator));
+ //TODO default sequence name
+ }
+
+ protected String specifiedSequenceName(SequenceGenerator generatorResource) {
+ return generatorResource.getSequenceName();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlSingleRelationshipMapping.java
new file mode 100644
index 0000000000..7ca855b804
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlSingleRelationshipMapping.java
@@ -0,0 +1,253 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.INullable;
+import org.eclipse.jpt.core.internal.context.base.IRelationshipMapping;
+import org.eclipse.jpt.core.internal.context.base.ISingleRelationshipMapping;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.JoinColumn;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
+
+
+public abstract class XmlSingleRelationshipMapping<T extends SingleRelationshipMapping>
+ extends XmlRelationshipMapping<T> implements ISingleRelationshipMapping
+{
+
+ protected final List<XmlJoinColumn> specifiedJoinColumns;
+
+ protected final List<XmlJoinColumn> defaultJoinColumns;
+
+ protected Boolean specifiedOptional;
+
+ protected XmlSingleRelationshipMapping(XmlPersistentAttribute parent) {
+ super(parent);
+ this.specifiedJoinColumns = new ArrayList<XmlJoinColumn>();
+ this.defaultJoinColumns = new ArrayList<XmlJoinColumn>();
+
+ //this.getDefaultJoinColumns().add(this.createJoinColumn(new JoinColumnOwner(this)));
+ }
+
+ public FetchType getDefaultFetch() {
+ return ISingleRelationshipMapping.DEFAULT_FETCH_TYPE;
+ }
+
+ //***************** ISingleRelationshipMapping implementation *****************
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlJoinColumn> joinColumns() {
+ return this.specifiedJoinColumns.isEmpty() ? this.defaultJoinColumns() : this.specifiedJoinColumns();
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlJoinColumn> defaultJoinColumns() {
+ return new CloneListIterator<XmlJoinColumn>(this.defaultJoinColumns);
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<XmlJoinColumn> specifiedJoinColumns() {
+ return new CloneListIterator<XmlJoinColumn>(this.specifiedJoinColumns);
+ }
+
+ public int specifiedJoinColumnsSize() {
+ return this.specifiedJoinColumns.size();
+ }
+
+ public boolean containsSpecifiedJoinColumns() {
+ return !this.specifiedJoinColumns.isEmpty();
+ }
+
+ public XmlJoinColumn addSpecifiedJoinColumn(int index) {
+ XmlJoinColumn joinColumn = new XmlJoinColumn(this, new JoinColumnOwner());
+ this.specifiedJoinColumns.add(index, joinColumn);
+ this.attributeMapping().getJoinColumns().add(index, OrmFactory.eINSTANCE.createJoinColumnImpl());
+ this.fireItemAdded(ISingleRelationshipMapping.SPECIFIED_JOIN_COLUMNS_LIST, index, joinColumn);
+ return joinColumn;
+ }
+
+ protected void addSpecifiedJoinColumn(int index, XmlJoinColumn joinColumn) {
+ addItemToList(index, joinColumn, this.specifiedJoinColumns, ISingleRelationshipMapping.SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public void removeSpecifiedJoinColumn(int index) {
+ XmlJoinColumn removedJoinColumn = this.specifiedJoinColumns.remove(index);
+ this.attributeMapping().getJoinColumns().remove(index);
+ fireItemRemoved(ISingleRelationshipMapping.SPECIFIED_JOIN_COLUMNS_LIST, index, removedJoinColumn);
+ }
+
+ protected void removeSpecifiedJoinColumn(XmlJoinColumn joinColumn) {
+ removeItemFromList(joinColumn, this.specifiedJoinColumns, ISingleRelationshipMapping.SPECIFIED_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.specifiedJoinColumns, targetIndex, sourceIndex);
+ this.attributeMapping().getJoinColumns().move(targetIndex, sourceIndex);
+ fireItemMoved(ISingleRelationshipMapping.SPECIFIED_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
+ }
+
+ public Boolean getOptional() {
+ return getSpecifiedOptional() == null ? getDefaultOptional() : getSpecifiedOptional();
+ }
+
+ public Boolean getDefaultOptional() {
+ return INullable.DEFAULT_OPTIONAL;
+ }
+
+ public Boolean getSpecifiedOptional() {
+ return this.specifiedOptional;
+ }
+
+ public void setSpecifiedOptional(Boolean newSpecifiedOptional) {
+ Boolean oldSpecifiedOptional = this.specifiedOptional;
+ this.specifiedOptional = newSpecifiedOptional;
+ attributeMapping().setOptional(newSpecifiedOptional);
+ firePropertyChanged(INullable.SPECIFIED_OPTIONAL_PROPERTY, oldSpecifiedOptional, newSpecifiedOptional);
+ }
+
+ protected void setSpecifiedOptional_(Boolean newSpecifiedOptional) {
+ Boolean oldSpecifiedOptional = this.specifiedOptional;
+ this.specifiedOptional = newSpecifiedOptional;
+ firePropertyChanged(INullable.SPECIFIED_OPTIONAL_PROPERTY, oldSpecifiedOptional, newSpecifiedOptional);
+ }
+//
+// public boolean containsSpecifiedJoinColumns() {
+// return !this.getSpecifiedJoinColumns().isEmpty();
+// }
+
+ @Override
+ public void initialize(T singleRelationshipMapping) {
+ super.initialize(singleRelationshipMapping);
+ this.specifiedOptional = singleRelationshipMapping.getOptional();
+ //TODO defaultOptional
+ this.initializeSpecifiedJoinColumns(singleRelationshipMapping);
+ }
+
+ protected void initializeSpecifiedJoinColumns(T singleRelationshipMapping) {
+ if (singleRelationshipMapping == null) {
+ return;
+ }
+ for (JoinColumn joinColumn : singleRelationshipMapping.getJoinColumns()) {
+ this.specifiedJoinColumns.add(createJoinColumn(joinColumn));
+ }
+ }
+
+ protected XmlJoinColumn createJoinColumn(JoinColumn joinColumn) {
+ XmlJoinColumn xmlJoinColumn = new XmlJoinColumn(this, new JoinColumnOwner());
+ xmlJoinColumn.initialize(joinColumn);
+ return xmlJoinColumn;
+ }
+
+ @Override
+ public void update(T singleRelationshipMapping) {
+ super.update(singleRelationshipMapping);
+ this.setSpecifiedOptional_(singleRelationshipMapping.getOptional());
+ this.updateSpecifiedJoinColumns(singleRelationshipMapping);
+ }
+
+ protected void updateSpecifiedJoinColumns(T singleRelationshipMapping) {
+ ListIterator<XmlJoinColumn> joinColumns = specifiedJoinColumns();
+ ListIterator<JoinColumn> resourceJoinColumns = EmptyListIterator.instance();
+ if (singleRelationshipMapping != null) {
+ resourceJoinColumns = singleRelationshipMapping.getJoinColumns().listIterator();
+ }
+
+ while (joinColumns.hasNext()) {
+ XmlJoinColumn joinColumn = joinColumns.next();
+ if (resourceJoinColumns.hasNext()) {
+ joinColumn.update(resourceJoinColumns.next());
+ }
+ else {
+ removeSpecifiedJoinColumn(joinColumn);
+ }
+ }
+
+ while (resourceJoinColumns.hasNext()) {
+ addSpecifiedJoinColumn(specifiedJoinColumnsSize(), createJoinColumn(resourceJoinColumns.next()));
+ }
+ }
+
+
+ public class JoinColumnOwner implements IJoinColumn.Owner
+ {
+
+ public JoinColumnOwner() {
+ super();
+ }
+
+ /**
+ * by default, the join column is in the type mapping's primary table
+ */
+ public String defaultTableName() {
+ return XmlSingleRelationshipMapping.this.typeMapping().getTableName();
+ }
+
+ public IEntity targetEntity() {
+ return XmlSingleRelationshipMapping.this.getResolvedTargetEntity();
+ }
+
+ public String attributeName() {
+ return XmlSingleRelationshipMapping.this.getName();
+ }
+
+ public IRelationshipMapping relationshipMapping() {
+ return XmlSingleRelationshipMapping.this;
+ }
+
+ public boolean tableNameIsInvalid(String tableName) {
+ return XmlSingleRelationshipMapping.this.typeMapping().tableNameIsInvalid(tableName);
+ }
+
+ /**
+ * the join column can be on a secondary table
+ */
+ public boolean tableIsAllowed() {
+ return true;
+ }
+
+ public ITypeMapping typeMapping() {
+ return XmlSingleRelationshipMapping.this.typeMapping();
+ }
+
+ public Table dbTable(String tableName) {
+ return typeMapping().dbTable(tableName);
+ }
+
+ public Table dbReferencedColumnTable() {
+ IEntity targetEntity = targetEntity();
+ return (targetEntity == null) ? null : targetEntity().primaryDbTable();
+ }
+
+ public boolean isVirtual(IAbstractJoinColumn joinColumn) {
+ return XmlSingleRelationshipMapping.this.defaultJoinColumns.contains(joinColumn);
+ }
+
+ public String defaultColumnName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTable.java
new file mode 100644
index 0000000000..f6823a9e9a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTable.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.InheritanceType;
+import org.eclipse.jpt.core.internal.context.java.IJavaEntity;
+import org.eclipse.jpt.core.internal.context.java.IJavaTable;
+import org.eclipse.jpt.core.internal.resource.orm.AbstractTable;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class XmlTable extends AbstractXmlTable
+{
+
+ protected Entity entity;
+
+ public XmlTable(XmlEntity parent) {
+ super(parent);
+ }
+
+ public XmlEntity xmlEntity() {
+ return (XmlEntity) super.parent();
+ }
+
+ @Override
+ protected AbstractTable table() {
+ return this.entity.getTable();
+ }
+
+ @Override
+ protected void removeTableResource() {
+ this.entity.setTable(null);
+ }
+
+ @Override
+ protected void addTableResource() {
+ this.entity.setTable(OrmFactory.eINSTANCE.createTable());
+
+ }
+
+ protected IJavaTable javaTable() {
+ IJavaEntity javaEntity = xmlEntity().javaEntity();
+ if (javaEntity != null) {
+ return javaEntity.getTable();
+ }
+ return null;
+ }
+
+
+ public void initialize(Entity entity) {
+ this.entity = entity;
+ this.initialize(this.table());
+ }
+
+ public void update(Entity entity) {
+ this.entity = entity;
+ this.update(this.table());
+ }
+
+ @Override
+ protected String defaultName() {
+ IJavaTable javaTable = javaTable();
+ if (javaTable != null) {
+ if (xmlEntity().isMetadataComplete() || (table() != null)) {
+ return javaTable.getDefaultName();
+ }
+ return javaTable.getName();
+ }
+ IEntity rootEntity = xmlEntity().rootEntity();
+ if (rootEntity != xmlEntity()) {
+ if (rootEntity.getInheritanceStrategy() == InheritanceType.SINGLE_TABLE) {
+ return rootEntity.getTable().getName();
+ }
+ }
+ return xmlEntity().getName();
+ }
+
+ @Override
+ protected String defaultSchema() {
+ IJavaTable javaTable = javaTable();
+ if (javaTable != null ) {
+ if (xmlEntity().isMetadataComplete() || (table() != null)) {
+ return javaTable.getDefaultSchema();
+ }
+ return javaTable.getSchema();
+ }
+ IEntity rootEntity = xmlEntity().rootEntity();
+ if (rootEntity != xmlEntity()) {
+ if (rootEntity.getInheritanceStrategy() == InheritanceType.SINGLE_TABLE) {
+ return rootEntity.getTable().getSchema();
+ }
+ }
+ return entityMappings().getSchema();
+ }
+
+ @Override
+ protected String defaultCatalog() {
+ IJavaTable javaTable = javaTable();
+ if (javaTable != null) {
+ if (xmlEntity().isMetadataComplete() || (table() != null)) {
+ return javaTable.getDefaultCatalog();
+ }
+ return javaTable.getCatalog();
+ }
+ IEntity rootEntity = xmlEntity().rootEntity();
+ if (rootEntity != xmlEntity()) {
+ if (rootEntity.getInheritanceStrategy() == InheritanceType.SINGLE_TABLE) {
+ return rootEntity.getTable().getCatalog();
+ }
+ }
+ return entityMappings().getCatalog();
+ }
+
+ //******* Validation *******************************
+
+ @Override
+ public void addToMessages(List<IMessage> messages, CompilationUnit astRoot) {
+ super.addToMessages(messages, astRoot);
+
+ boolean doContinue = isConnected();
+ String schema = this.getSchema();
+
+ if (doContinue && ! this.hasResolvedSchema()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.TABLE_UNRESOLVED_SCHEMA,
+ new String[] {schema, this.getName()},
+ this, this.schemaTextRange(astRoot))
+ );
+ doContinue = false;
+ }
+
+ if (doContinue && ! this.isResolved()) {
+ messages.add(
+ JpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ IJpaValidationMessages.TABLE_UNRESOLVED_NAME,
+ new String[] {this.getName()},
+ this, this.nameTextRange(astRoot))
+ );
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTableGenerator.java
new file mode 100644
index 0000000000..00bcccc773
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTableGenerator.java
@@ -0,0 +1,271 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.ITableGenerator;
+import org.eclipse.jpt.core.internal.resource.orm.TableGenerator;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.db.internal.Table;
+
+public class XmlTableGenerator extends XmlGenerator<TableGenerator> implements ITableGenerator
+{
+ protected String specifiedTable;
+ protected String defaultTable;
+
+ protected String specifiedCatalog;
+ protected String defaultCatalog;
+
+ protected String specifiedSchema;
+ protected String defaultSchema;
+
+ protected String specifiedPkColumnName;
+ protected String defaultPkColumnName;
+
+ protected String specifiedValueColumnName;
+ protected String defaultValueColumnName;
+
+ protected String specifiedPkColumnValue;
+ protected String defaultPkColumnValue;
+
+// protected EList<IUniqueConstraint> uniqueConstraints;
+
+
+ protected XmlTableGenerator(IJpaContextNode parent) {
+ super(parent);
+ }
+
+ public String getTable() {
+ return (this.getSpecifiedTable() == null) ? getDefaultTable() : this.getSpecifiedTable();
+ }
+
+ public String getSpecifiedTable() {
+ return this.specifiedTable;
+ }
+
+
+ public void setSpecifiedTable(String newSpecifiedTable) {
+ String oldSpecifiedTable = this.specifiedTable;
+ this.specifiedTable = newSpecifiedTable;
+ generatorResource().setTable(newSpecifiedTable);
+ firePropertyChanged(SPECIFIED_TABLE_PROPERTY, oldSpecifiedTable, newSpecifiedTable);
+ }
+
+ public String getDefaultTable() {
+ return this.defaultTable;
+ }
+
+ public void setDefaultTable(String newDefaultTable) {
+ String oldDefaultTable = this.defaultTable;
+ this.defaultTable = newDefaultTable;
+ firePropertyChanged(DEFAULT_TABLE_PROPERTY, oldDefaultTable, newDefaultTable);
+ }
+
+ public String getCatalog() {
+ return (this.getSpecifiedCatalog() == null) ? getDefaultCatalog() : this.getSpecifiedCatalog();
+ }
+
+ public String getSpecifiedCatalog() {
+ return this.specifiedCatalog;
+ }
+
+ public void setSpecifiedCatalog(String newSpecifiedCatalog) {
+ String oldSpecifiedCatalog = this.specifiedCatalog;
+ this.specifiedCatalog = newSpecifiedCatalog;
+ generatorResource().setCatalog(newSpecifiedCatalog);
+ firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, oldSpecifiedCatalog, newSpecifiedCatalog);
+ }
+
+ public String getDefaultCatalog() {
+ return this.defaultCatalog;
+ }
+
+ public String getSchema() {
+ return (this.getSpecifiedSchema() == null) ? getDefaultSchema() : this.getSpecifiedSchema();
+ }
+
+ public String getSpecifiedSchema() {
+ return this.specifiedSchema;
+ }
+
+ public void setSpecifiedSchema(String newSpecifiedSchema) {
+ String oldSpecifiedSchema = this.specifiedSchema;
+ this.specifiedSchema = newSpecifiedSchema;
+ generatorResource().setSchema(newSpecifiedSchema);
+ firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, oldSpecifiedSchema, newSpecifiedSchema);
+ }
+
+ public String getDefaultSchema() {
+ return this.defaultSchema;
+ }
+
+ protected void setDefaultSchema(String newDefaultSchema) {
+ String oldDefaultSchema = this.defaultSchema;
+ this.defaultSchema = newDefaultSchema;
+ firePropertyChanged(this.defaultSchema, oldDefaultSchema, newDefaultSchema);
+ }
+
+ public String getPkColumnName() {
+ return (this.getSpecifiedPkColumnName() == null) ? getDefaultPkColumnName() : this.getSpecifiedPkColumnName();
+ }
+
+ public String getSpecifiedPkColumnName() {
+ return this.specifiedPkColumnName;
+ }
+
+ public void setSpecifiedPkColumnName(String newSpecifiedPkColumnName) {
+ String oldSpecifiedPkColumnName = this.specifiedPkColumnName;
+ this.specifiedPkColumnName = newSpecifiedPkColumnName;
+ generatorResource().setPkColumnName(newSpecifiedPkColumnName);
+ firePropertyChanged(SPECIFIED_PK_COLUMN_NAME_PROPERTY, oldSpecifiedPkColumnName, newSpecifiedPkColumnName);
+ }
+
+ public String getDefaultPkColumnName() {
+ return this.defaultPkColumnName;
+ }
+
+ protected void setDefaultPkColumnName(String newDefaultPkColumnName) {
+ String oldDefaultPkColumnName = this.defaultPkColumnName;
+ this.defaultPkColumnName = newDefaultPkColumnName;
+ firePropertyChanged(DEFAULT_PK_COLUMN_NAME_PROPERTY, oldDefaultPkColumnName, newDefaultPkColumnName);
+ }
+
+ public String getValueColumnName() {
+ return (this.getSpecifiedValueColumnName() == null) ? getDefaultValueColumnName() : this.getSpecifiedValueColumnName();
+ }
+
+ public String getSpecifiedValueColumnName() {
+ return this.specifiedValueColumnName;
+ }
+
+ public void setSpecifiedValueColumnName(String newSpecifiedValueColumnName) {
+ String oldSpecifiedValueColumnName = this.specifiedValueColumnName;
+ this.specifiedValueColumnName = newSpecifiedValueColumnName;
+ generatorResource().setValueColumnName(newSpecifiedValueColumnName);
+ firePropertyChanged(SPECIFIED_VALUE_COLUMN_NAME_PROPERTY, oldSpecifiedValueColumnName, newSpecifiedValueColumnName);
+ }
+
+ public String getDefaultValueColumnName() {
+ return this.defaultValueColumnName;
+ }
+
+ public void setDefaultValueColumnName(String newDefaultValueColumnName) {
+ String oldDefaultValueColumnName = this.defaultValueColumnName;
+ this.defaultValueColumnName = newDefaultValueColumnName;
+ firePropertyChanged(DEFAULT_VALUE_COLUMN_NAME_PROPERTY, oldDefaultValueColumnName, newDefaultValueColumnName);
+ }
+
+ public String getPkColumnValue() {
+ return (this.getSpecifiedPkColumnValue() == null) ? getDefaultPkColumnValue() : this.getSpecifiedPkColumnValue();
+ }
+
+ public String getSpecifiedPkColumnValue() {
+ return this.specifiedPkColumnValue;
+ }
+
+ public void setSpecifiedPkColumnValue(String newSpecifiedPkColumnValue) {
+ String oldSpecifiedPkColumnValue = this.specifiedPkColumnValue;
+ this.specifiedPkColumnValue = newSpecifiedPkColumnValue;
+ generatorResource().setPkColumnValue(newSpecifiedPkColumnValue);
+ firePropertyChanged(SPECIFIED_PK_COLUMN_VALUE_PROPERTY, oldSpecifiedPkColumnValue, newSpecifiedPkColumnValue);
+ }
+
+ public String getDefaultPkColumnValue() {
+ return this.defaultPkColumnValue;
+ }
+
+ public void setDefaultPkColumnValue(String newDefaultPkColumnValue) {
+ String oldDefaultPkColumnValue = this.defaultPkColumnValue;
+ this.defaultPkColumnValue = newDefaultPkColumnValue;
+ firePropertyChanged(DEFAULT_PK_COLUMN_VALUE_PROPERTY, oldDefaultPkColumnValue, newDefaultPkColumnValue);
+ }
+
+// public EList<IUniqueConstraint> getUniqueConstraints() {
+// if (uniqueConstraints == null) {
+// uniqueConstraints = new EObjectContainmentEList<IUniqueConstraint>(IUniqueConstraint.class, this, OrmPackage.XML_TABLE_GENERATOR__UNIQUE_CONSTRAINTS);
+// }
+// return uniqueConstraints;
+// }
+
+
+// public void refreshDefaults(DefaultsContext defaultsContext) {
+// setDefaultSchema((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_TABLE_GENERATOR_SCHEMA_KEY));
+// }
+//
+// public IUniqueConstraint createUniqueConstraint(int index) {
+// return createXmlJavaUniqueConstraint(index);
+// }
+//
+// protected XmlUniqueConstraint createXmlJavaUniqueConstraint(int index) {
+// return OrmFactory.eINSTANCE.createXmlUniqueConstraint();
+// }
+
+ public Table dbTable() {
+ Schema schema = this.dbSchema();
+ return (schema == null) ? null : schema.tableNamed(this.getTable());
+ }
+
+ public Schema dbSchema() {
+ return this.database().schemaNamed(this.getSchema());
+ }
+
+ // ********** orm resource model -> context model **********
+
+ @Override
+ public void initialize(TableGenerator tableGenerator) {
+ super.initialize(tableGenerator);
+ this.specifiedTable = this.specifiedTable(tableGenerator);
+ this.specifiedCatalog = this.specifiedCatalog(tableGenerator);
+ this.specifiedSchema = this.specifiedSchema(tableGenerator);
+ this.specifiedPkColumnName = this.specifiedPkColumnName(tableGenerator);
+ this.specifiedValueColumnName = this.specifiedValueColumnName(tableGenerator);
+ this.specifiedPkColumnValue = this.specifiedPkColumnValue(tableGenerator);
+ //TODO defaults
+ //this.updateUniqueConstraintsFromJava(astRoot);
+ }
+
+ @Override
+ public void update(TableGenerator tableGenerator) {
+ super.update(tableGenerator);
+ this.setSpecifiedTable(this.specifiedTable(tableGenerator));
+ this.setSpecifiedCatalog(this.specifiedCatalog(tableGenerator));
+ this.setSpecifiedSchema(this.specifiedSchema(tableGenerator));
+ this.setSpecifiedPkColumnName(this.specifiedPkColumnName(tableGenerator));
+ this.setSpecifiedValueColumnName(this.specifiedValueColumnName(tableGenerator));
+ this.setSpecifiedPkColumnValue(this.specifiedPkColumnValue(tableGenerator));
+ //TODO defaults
+ //this.updateUniqueConstraintsFromJava(astRoot);
+ }
+
+ protected String specifiedTable(TableGenerator tableGenerator) {
+ return tableGenerator.getTable();
+ }
+
+ protected String specifiedCatalog(TableGenerator tableGenerator) {
+ return tableGenerator.getCatalog();
+ }
+
+ protected String specifiedSchema(TableGenerator tableGenerator) {
+ return tableGenerator.getSchema();
+ }
+
+ protected String specifiedPkColumnName(TableGenerator tableGenerator) {
+ return tableGenerator.getPkColumnName();
+ }
+
+ protected String specifiedValueColumnName(TableGenerator tableGenerator) {
+ return tableGenerator.getValueColumnName();
+ }
+
+ protected String specifiedPkColumnValue(TableGenerator tableGenerator) {
+ return tableGenerator.getPkColumnValue();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTransientMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTransientMapping.java
new file mode 100644
index 0000000000..daec42723d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTransientMapping.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.Transient;
+import org.eclipse.jpt.core.internal.resource.orm.TransientImpl;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+
+
+public class XmlTransientMapping extends XmlAttributeMapping<Transient> implements ITransientMapping
+{
+
+ protected XmlTransientMapping(XmlPersistentAttribute parent) {
+ super(parent);
+ }
+
+ @Override
+ protected void initializeOn(XmlAttributeMapping<? extends AttributeMapping> newMapping) {
+ newMapping.initializeFromXmlTransientMapping(this);
+ }
+
+ @Override
+ public int xmlSequence() {
+ return 8;
+ }
+
+ public String getKey() {
+ return IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
+ }
+
+ @Override
+ public Transient addToResourceModel(TypeMapping typeMapping) {
+ TransientImpl transientResource = OrmFactory.eINSTANCE.createTransientImpl();
+ typeMapping.getAttributes().getTransients().add(transientResource);
+ return transientResource;
+ }
+
+ @Override
+ public void removeFromResourceModel(TypeMapping typeMapping) {
+ typeMapping.getAttributes().getTransients().remove(this.attributeMapping());
+ if (typeMapping.getAttributes().isAllFeaturesUnset()) {
+ typeMapping.setAttributes(null);
+ }
+ }
+
+ @Override
+ public void initialize(Transient transientResource) {
+ super.initialize(transientResource);
+ }
+
+ @Override
+ public void update(Transient transientResource) {
+ super.update(transientResource);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTransientProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTransientMappingProvider.java
index 39bb80daee..23243f0fe7 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlTransientProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTransientMappingProvider.java
@@ -7,14 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.context.orm;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
-public class XmlTransientProvider implements IXmlAttributeMappingProvider
+public class XmlTransientMappingProvider implements IXmlAttributeMappingProvider
{
// singleton
- private static final XmlTransientProvider INSTANCE = new XmlTransientProvider();
+ private static final XmlTransientMappingProvider INSTANCE = new XmlTransientMappingProvider();
/**
* Return the singleton.
@@ -26,15 +27,15 @@ public class XmlTransientProvider implements IXmlAttributeMappingProvider
/**
* Ensure non-instantiability.
*/
- private XmlTransientProvider() {
+ private XmlTransientMappingProvider() {
super();
}
-
- public XmlAttributeMapping buildAttributeMapping() {
- return OrmFactory.eINSTANCE.createXmlTransient();
- }
-
+
public String key() {
return IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
}
+
+ public XmlTransientMapping buildAttributeMapping(IJpaBaseContextFactory factory, XmlPersistentAttribute parent) {
+ return new XmlTransientMapping(parent);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTypeMapping.java
new file mode 100644
index 0000000000..33cb3407bb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlTypeMapping.java
@@ -0,0 +1,305 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.context.base.JpaContextNode;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+
+
+public abstract class XmlTypeMapping<E extends TypeMapping> extends JpaContextNode implements ITypeMapping
+{
+
+ protected String class_;
+ public static final String CLASS_PROPERTY = "classProperty";
+
+ protected AccessType defaultAccess;
+ public static final String DEFAULT_ACCESS_PROPERTY = "defaultAccessProperty";
+
+ protected AccessType specifiedAccess;
+ public static final String SPECIFIED_ACCESS_PROPERTY = "specifiedAccessProperty";
+
+ protected boolean defaultMetadataComplete;
+ public static final String DEFAULT_METADATA_COMPLETE_PROPERTY = "defaultMetadataCompleteProperty";
+
+ protected Boolean specifiedMetadataComplete;
+ public static final String SPECIFIED_METADATA_COMPLETE_PROPERTY = "specifiedMetadataCompleteProperty";
+
+ protected IJavaPersistentType javaPersistentType;
+ public static final String JAVA_PERSISTENT_TYPE_PROPERTY = "javaPersistentTypeProperty";
+
+ protected E typeMapping;
+
+ protected XmlTypeMapping(XmlPersistentType parent) {
+ super(parent);
+ }
+
+ public boolean isMapped() {
+ return true;
+ }
+
+ public String getTableName() {
+ return "";
+ }
+
+ public String getClass_() {
+ return this.class_;
+ }
+
+ public void setClass(String newClass) {
+ String oldClass = this.class_;
+ this.class_ = newClass;
+ this.typeMappingResource().setClassName(newClass);
+ firePropertyChanged(CLASS_PROPERTY, oldClass, newClass);
+ persistentType().classChanged(oldClass, newClass);
+ }
+
+ public AccessType getDefaultAccess() {
+ return this.defaultAccess;
+ }
+
+ protected void setDefaultAccess(AccessType newDefaultAccess) {
+ AccessType oldDefaultAccess = this.defaultAccess;
+ this.defaultAccess = newDefaultAccess;
+ firePropertyChanged(DEFAULT_ACCESS_PROPERTY, oldDefaultAccess, newDefaultAccess);
+ }
+
+ public AccessType getSpecifiedAccess() {
+ return this.specifiedAccess;
+ }
+
+ public void setSpecifiedAccess(AccessType newSpecifiedAccess) {
+ AccessType oldSpecifiedAccess = this.specifiedAccess;
+ this.specifiedAccess = newSpecifiedAccess;
+ this.typeMappingResource().setAccess(AccessType.toXmlResourceModel(newSpecifiedAccess));
+ firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, oldSpecifiedAccess, newSpecifiedAccess);
+ }
+
+ public AccessType getAccess() {
+ return (this.getSpecifiedAccess() == null) ? this.getDefaultAccess() : this.getSpecifiedAccess();
+ }
+
+ public boolean isMetadataComplete() {
+ if (isDefaultMetadataComplete()) {
+ //entity-mappings/persistence-unit-metadata/xml-mapping-metadata-complete is specified, then it overrides
+ //anything set here
+ return Boolean.TRUE;
+ }
+ return (this.getSpecifiedMetadataComplete() == null) ? this.isDefaultMetadataComplete() : this.getSpecifiedMetadataComplete();
+ }
+
+ public boolean isDefaultMetadataComplete() {
+ return this.defaultMetadataComplete;
+ }
+
+ protected void setDefaultMetadataComplete(boolean newDefaultMetadataComplete) {
+ boolean oldMetadataComplete = this.defaultMetadataComplete;
+ this.defaultMetadataComplete = newDefaultMetadataComplete;
+ firePropertyChanged(DEFAULT_METADATA_COMPLETE_PROPERTY, oldMetadataComplete, newDefaultMetadataComplete);
+ }
+
+ public Boolean getSpecifiedMetadataComplete() {
+ return this.specifiedMetadataComplete;
+ }
+
+ public void setSpecifiedMetadataComplete(Boolean newSpecifiedMetadataComplete) {
+ Boolean oldMetadataComplete = this.specifiedMetadataComplete;
+ this.specifiedMetadataComplete = newSpecifiedMetadataComplete;
+ this.typeMappingResource().setMetadataComplete(newSpecifiedMetadataComplete);
+ firePropertyChanged(SPECIFIED_METADATA_COMPLETE_PROPERTY, oldMetadataComplete, newSpecifiedMetadataComplete);
+ }
+
+ public XmlPersistentType persistentType() {
+ return (XmlPersistentType) parent();
+ }
+
+ /**
+ * ITypeMapping is changed and various ITypeMappings may have
+ * common settings. In this method initialize the new ITypeMapping (this)
+ * fromthe old ITypeMapping (oldMapping)
+ * @param oldMapping
+ */
+ public void initializeFrom(XmlTypeMapping<? extends TypeMapping> oldMapping) {
+ this.setClass(oldMapping.getClass_());
+ this.setSpecifiedAccess(oldMapping.getSpecifiedAccess());
+ this.setSpecifiedMetadataComplete(oldMapping.getSpecifiedMetadataComplete());
+ this.setDefaultAccess(oldMapping.getDefaultAccess());
+ this.setDefaultMetadataComplete(oldMapping.isDefaultMetadataComplete());
+ }
+
+// public IJpaContentNode getContentNode(int offset) {
+// return persistentType().getContentNode(offset);
+// }
+
+ public Table primaryDbTable() {
+ return null;
+ }
+
+ public Table dbTable(String tableName) {
+ return null;
+ }
+
+ public Schema dbSchema() {
+ return null;
+ }
+
+// public ITextRange classTextRange() {
+// IDOMNode classNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.CLASS);
+// if (classNode != null) {
+// return buildTextRange(classNode);
+// }
+// return validationTextRange();
+// }
+//
+// public ITextRange attributesTextRange() {
+// IDOMNode attributesNode = (IDOMNode) DOMUtilities.getNodeChild(node, OrmXmlMapper.ATTRIBUTES);
+// if (attributesNode != null) {
+// return buildTextRange(attributesNode);
+// }
+// return validationTextRange();
+// }
+
+ /**
+ * type mappings are a sequence in the orm schema. We must keep
+ * the list of type mappings in the appropriate order so the wtp xml
+ * translators will write them to the xml in that order and they
+ * will adhere to the schema.
+ *
+ * Each concrete subclass of XmlTypeMapping must implement this
+ * method and return an int that matches it's order in the schema
+ * @return
+ */
+ public abstract int xmlSequence();
+
+ /**
+ * @see ITypeMapping#attributeMappingKeyAllowed(String)
+ *
+ * Default implementation: override where needed
+ */
+ public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
+ return true;
+ }
+
+ public Iterator<String> overridableAssociationNames() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<String> overridableAttributeNames() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<String> allOverridableAssociationNames() {
+ return EmptyIterator.instance();
+ }
+
+ public Iterator<String> allOverridableAttributeNames() {
+ return EmptyIterator.instance();
+ }
+
+ protected E typeMappingResource() {
+ return this.typeMapping;
+ }
+
+ protected PersistenceUnitMetadata persistenceUnitMetadata() {
+ return entityMappings().getPersistenceUnitMetadata();
+ }
+
+ protected boolean defaultMetadataComplete() {
+ return persistenceUnitMetadata().isXmlMappingMetadataComplete();
+ }
+
+ protected AccessType defaultAccess() {
+ if (!isMetadataComplete()) {
+ if (getJavaPersistentType() != null) {
+ if (getJavaPersistentType().hasAnyAttributeMappingAnnotations()) {
+ return getJavaPersistentType().access();
+ }
+ if (persistentType().parentPersistentType() != null) {
+ return persistentType().parentPersistentType().access();
+ }
+ }
+ }
+ return entityMappings().getAccess();
+ }
+
+ protected IJavaPersistentType getJavaPersistentType() {
+ return this.javaPersistentType;
+ }
+
+ protected void setJavaPersistentType(IJavaPersistentType newJavaPersistentType) {
+ IJavaPersistentType oldJavaPersistentType = this.javaPersistentType;
+ this.javaPersistentType = newJavaPersistentType;
+ firePropertyChanged(JAVA_PERSISTENT_TYPE_PROPERTY, oldJavaPersistentType, newJavaPersistentType);
+ }
+
+ protected void initializeJavaPersistentType() {
+ JavaPersistentTypeResource persistentTypeResource = jpaProject().javaPersistentTypeResource(getClass_());
+ if (persistentTypeResource != null) {
+ this.javaPersistentType = createJavaPersistentType(persistentTypeResource);
+ }
+ }
+
+ protected void updateJavaPersistentType() {
+ JavaPersistentTypeResource persistentTypeResource = jpaProject().javaPersistentTypeResource(getClass_());
+ if (persistentTypeResource == null) {
+ setJavaPersistentType(null);
+ }
+ else {
+ if (getJavaPersistentType() != null) {
+ getJavaPersistentType().update(persistentTypeResource);
+ }
+ else {
+ setJavaPersistentType(createJavaPersistentType(persistentTypeResource));
+ }
+ }
+ }
+
+ protected IJavaPersistentType createJavaPersistentType(JavaPersistentTypeResource persistentTypeResource) {
+ IJavaPersistentType javaPersistentType = jpaFactory().createJavaPersistentType(this);
+ javaPersistentType.initializeFromResource(persistentTypeResource);
+ return javaPersistentType;
+ }
+
+ public void initialize(E typeMapping) {
+ this.typeMapping = typeMapping;
+ this.class_ = typeMapping.getClassName();
+ this.initializeJavaPersistentType();
+ this.specifiedMetadataComplete = this.metadataComplete(typeMapping);
+ this.defaultMetadataComplete = this.defaultMetadataComplete();
+ this.specifiedAccess = AccessType.fromXmlResourceModel(typeMapping.getAccess());
+ this.defaultAccess = this.defaultAccess();
+ }
+
+ public void update(E typeMapping) {
+ this.typeMapping = typeMapping;
+ this.setClass(typeMapping.getClassName());
+ this.updateJavaPersistentType();
+ this.setSpecifiedMetadataComplete(this.metadataComplete(typeMapping));
+ this.setDefaultMetadataComplete(this.defaultMetadataComplete());
+ this.setSpecifiedAccess(AccessType.fromXmlResourceModel(typeMapping.getAccess()));
+ this.setDefaultAccess(this.defaultAccess());
+ }
+
+ protected Boolean metadataComplete(TypeMapping typeMapping) {
+ return typeMapping.getMetadataComplete();
+ }
+
+
+ public abstract void removeFromResourceModel(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings);
+
+ public abstract E addToResourceModel(org.eclipse.jpt.core.internal.resource.orm.EntityMappings entityMappings);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlVersionMapping.java
new file mode 100644
index 0000000000..0e2fe41345
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlVersionMapping.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.context.orm;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.context.base.IColumnMapping;
+import org.eclipse.jpt.core.internal.context.base.IVersionMapping;
+import org.eclipse.jpt.core.internal.context.base.TemporalType;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.Version;
+import org.eclipse.jpt.core.internal.resource.orm.VersionImpl;
+import org.eclipse.jpt.db.internal.Table;
+
+
+public class XmlVersionMapping extends XmlAttributeMapping<Version>
+ implements IVersionMapping, IXmlColumnMapping
+{
+ protected final XmlColumn column;
+
+ protected TemporalType temporal;
+
+ protected XmlVersionMapping(XmlPersistentAttribute parent) {
+ super(parent);
+ this.column = new XmlColumn(this, this);
+ }
+
+ @Override
+ public int xmlSequence() {
+ return 2;
+ }
+
+ public String getKey() {
+ return IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
+ }
+ @Override
+ protected void initializeOn(XmlAttributeMapping<? extends AttributeMapping> newMapping) {
+ newMapping.initializeFromXmlVersionMapping(this);
+ }
+
+ public XmlColumn getColumn() {
+ return this.column;
+ }
+
+ public TemporalType getTemporal() {
+ return this.temporal;
+ }
+
+ public void setTemporal(TemporalType newTemporal) {
+ TemporalType oldTemporal = this.temporal;
+ this.temporal = newTemporal;
+ this.attributeMapping().setTemporal(TemporalType.toOrmResourceModel(newTemporal));
+ firePropertyChanged(IColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+ }
+
+ protected void setTemporal_(TemporalType newTemporal) {
+ TemporalType oldTemporal = this.temporal;
+ this.temporal = newTemporal;
+ firePropertyChanged(IColumnMapping.TEMPORAL_PROPERTY, oldTemporal, newTemporal);
+ }
+
+ @Override
+ public Version addToResourceModel(TypeMapping typeMapping) {
+ VersionImpl version = OrmFactory.eINSTANCE.createVersionImpl();
+ typeMapping.getAttributes().getVersions().add(version);
+ return version;
+ }
+
+ @Override
+ public void removeFromResourceModel(TypeMapping typeMapping) {
+ typeMapping.getAttributes().getVersions().remove(this.attributeMapping());
+ if (typeMapping.getAttributes().isAllFeaturesUnset()) {
+ typeMapping.setAttributes(null);
+ }
+ }
+
+ public String defaultColumnName() {
+ return attributeName();
+ }
+
+ public String defaultTableName() {
+ return typeMapping().getTableName();
+ }
+
+ public Table dbTable(String tableName) {
+ return typeMapping().dbTable(tableName);
+ }
+
+ public ITextRange validationTextRange(CompilationUnit astRoot) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void initialize(Version version) {
+ super.initialize(version);
+ this.temporal = this.specifiedTemporal(version);
+ this.column.initialize(version);
+ }
+
+ @Override
+ public void update(Version version) {
+ super.update(version);
+ this.setTemporal_(this.specifiedTemporal(version));
+ this.column.update(version);
+ }
+
+ protected TemporalType specifiedTemporal(Version version) {
+ return TemporalType.fromOrmResourceModel(version.getTemporal());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlVersionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlVersionMappingProvider.java
index 60f8d25a45..1685937401 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlVersionProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/XmlVersionMappingProvider.java
@@ -7,14 +7,15 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.context.orm;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;
-public class XmlVersionProvider implements IXmlAttributeMappingProvider
+public class XmlVersionMappingProvider implements IXmlAttributeMappingProvider
{
// singleton
- private static final XmlVersionProvider INSTANCE = new XmlVersionProvider();
+ private static final XmlVersionMappingProvider INSTANCE = new XmlVersionMappingProvider();
/**
* Return the singleton.
@@ -26,15 +27,15 @@ public class XmlVersionProvider implements IXmlAttributeMappingProvider
/**
* Ensure non-instantiability.
*/
- private XmlVersionProvider() {
+ private XmlVersionMappingProvider() {
super();
}
-
- public XmlAttributeMapping buildAttributeMapping() {
- return OrmFactory.eINSTANCE.createXmlVersion();
- }
-
+
public String key() {
return IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
}
+
+ public XmlVersionMapping buildAttributeMapping(IJpaBaseContextFactory factory, XmlPersistentAttribute parent) {
+ return new XmlVersionMapping(parent);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/emfutility/ComponentUtilities.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/emfutility/ComponentUtilities.java
index a6aa26fdb1..663b42740f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/emfutility/ComponentUtilities.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/emfutility/ComponentUtilities.java
@@ -1,3 +1,12 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.emfutility;
import java.util.Iterator;
@@ -36,10 +45,10 @@ public class ComponentUtilities
}
private static Iterator<IVirtualFile> allVirtualFiles(IProject project) {
- return new FilteringIterator<IVirtualFile>(allVirtualResources(project)) {
+ return new FilteringIterator<IVirtualResource, IVirtualFile>(allVirtualResources(project)) {
@Override
- protected boolean accept(Object o) {
- return ((IVirtualResource) o).getType() == IVirtualResource.FILE;
+ protected boolean accept(IVirtualResource o) {
+ return o.getType() == IVirtualResource.FILE;
}
};
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProvider.java
index fb6be34ed8..6fc080aa0c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProvider.java
@@ -16,14 +16,16 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jpt.core.internal.JptCoreMessages;
import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.core.internal.platform.generic.GenericPlatform;
+import org.eclipse.jpt.core.internal.platform.generic.GenericJpaPlatform;
import org.eclipse.jpt.core.internal.prefs.JpaPreferenceConstants;
import org.eclipse.jpt.db.internal.ConnectionProfileRepository;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
@@ -32,11 +34,9 @@ public class JpaFacetDataModelProvider
extends FacetInstallDataModelProvider
implements IJpaFacetDataModelProperties
{
- @SuppressWarnings("restriction")
- private static final String EJB_FACET_ID = org.eclipse.wst.common.componentcore.internal.util.IModuleConstants.JST_EJB_MODULE;
+ private static final String EJB_FACET_ID = IModuleConstants.JST_EJB_MODULE;
- @SuppressWarnings("restriction")
- private static final String RUNTIME_NONE = org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin.getResourceString(org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonMessages.RUNTIME_NONE, null);
+ private static final String RUNTIME_NONE = WTPCommonPlugin.getResourceString(org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonMessages.RUNTIME_NONE, null);
private static final IStatus PLATFORM_NOT_SPECIFIED_STATUS = buildErrorStatus(JptCoreMessages.VALIDATE_PLATFORM_NOT_SPECIFIED);
private static final IStatus CONNECTION_NOT_CONNECTED_STATUS = buildInfoStatus(JptCoreMessages.VALIDATE_CONNECTION_NOT_CONNECTED);
@@ -72,7 +72,7 @@ public class JpaFacetDataModelProvider
return JptCorePlugin.FACET_ID;
}
if (propertyName.equals(PLATFORM_ID)) {
- return GenericPlatform.ID;
+ return GenericJpaPlatform.ID;
}
if (propertyName.equals(CONNECTION)) {
return "";
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java
index a02f763a0e..7ac739e66b 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java
@@ -23,6 +23,7 @@ import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil;
import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IDelegate;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
@@ -114,9 +115,8 @@ public class JpaFacetInstallDelegate
};
}
- @SuppressWarnings("restriction")
private boolean projectIsStandalone(IProject project) {
- return org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities.isStandaloneProject(project);
+ return J2EEProjectUtilities.isStandaloneProject(project);
}
private IProgressMonitor nonNullMonitor(IProgressMonitor monitor) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ASTNodeSearchUtil.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ASTNodeSearchUtil.java
new file mode 100644
index 0000000000..4fd236c212
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ASTNodeSearchUtil.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jdtutility;
+
+import java.util.List;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
+import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration;
+import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration;
+import org.eclipse.jdt.core.dom.BodyDeclaration;
+import org.eclipse.jdt.core.dom.ClassInstanceCreation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
+import org.eclipse.jdt.core.dom.EnumDeclaration;
+import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+
+//copied from org.eclipse.jdt.internal.corext.refactoring.structure.ASTNodeSearchUtil
+//deleted code to limit the number of classes I had to copy
+public class ASTNodeSearchUtil {
+
+ private ASTNodeSearchUtil() {
+ //no instance
+ }
+
+
+ public static MethodDeclaration getMethodDeclarationNode(IMethod iMethod, CompilationUnit cuNode) throws JavaModelException {
+ return (MethodDeclaration)ASTNodes.getParent(getNameNode(iMethod, cuNode), MethodDeclaration.class);
+ }
+
+ public static ASTNode getParent(ASTNode node, Class<?> parentClass) {
+ do {
+ node= node.getParent();
+ } while (node != null && !parentClass.isInstance(node));
+ return node;
+ }
+
+
+ public static AnnotationTypeMemberDeclaration getAnnotationTypeMemberDeclarationNode(IMethod iMethod, CompilationUnit cuNode) throws JavaModelException {
+ return (AnnotationTypeMemberDeclaration) ASTNodes.getParent(getNameNode(iMethod, cuNode), AnnotationTypeMemberDeclaration.class);
+ }
+
+ public static VariableDeclarationFragment getFieldDeclarationFragmentNode(IField iField, CompilationUnit cuNode) throws JavaModelException {
+ ASTNode node= getNameNode(iField, cuNode);
+ if (node instanceof VariableDeclarationFragment)
+ return (VariableDeclarationFragment)node;
+ return (VariableDeclarationFragment)ASTNodes.getParent(node, VariableDeclarationFragment.class);
+ }
+
+ public static FieldDeclaration getFieldDeclarationNode(IField iField, CompilationUnit cuNode) throws JavaModelException {
+ return (FieldDeclaration) ASTNodes.getParent(getNameNode(iField, cuNode), FieldDeclaration.class);
+ }
+
+ public static EnumConstantDeclaration getEnumConstantDeclaration(IField iField, CompilationUnit cuNode) throws JavaModelException {
+ return (EnumConstantDeclaration) ASTNodes.getParent(getNameNode(iField, cuNode), EnumConstantDeclaration.class);
+ }
+
+ public static EnumDeclaration getEnumDeclarationNode(IType iType, CompilationUnit cuNode) throws JavaModelException {
+ return (EnumDeclaration) ASTNodes.getParent(getNameNode(iType, cuNode), EnumDeclaration.class);
+ }
+
+ public static AnnotationTypeDeclaration getAnnotationTypeDeclarationNode(IType iType, CompilationUnit cuNode) throws JavaModelException {
+ return (AnnotationTypeDeclaration) ASTNodes.getParent(getNameNode(iType, cuNode), AnnotationTypeDeclaration.class);
+ }
+
+ public static BodyDeclaration getBodyDeclarationNode(IMember iMember, CompilationUnit cuNode) throws JavaModelException {
+ return (BodyDeclaration) ASTNodes.getParent(getNameNode(iMember, cuNode), BodyDeclaration.class);
+ }
+
+ public static AbstractTypeDeclaration getAbstractTypeDeclarationNode(IType iType, CompilationUnit cuNode) throws JavaModelException {
+ return (AbstractTypeDeclaration) ASTNodes.getParent(getNameNode(iType, cuNode), AbstractTypeDeclaration.class);
+ }
+
+ public static TypeDeclaration getTypeDeclarationNode(IType iType, CompilationUnit cuNode) throws JavaModelException {
+ return (TypeDeclaration) ASTNodes.getParent(getNameNode(iType, cuNode), TypeDeclaration.class);
+ }
+
+ public static ClassInstanceCreation getClassInstanceCreationNode(IType iType, CompilationUnit cuNode) throws JavaModelException {
+ return (ClassInstanceCreation) ASTNodes.getParent(getNameNode(iType, cuNode), ClassInstanceCreation.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static List<BodyDeclaration> getBodyDeclarationList(IType iType, CompilationUnit cuNode) throws JavaModelException {
+ if (iType.isAnonymous())
+ return getClassInstanceCreationNode(iType, cuNode).getAnonymousClassDeclaration().bodyDeclarations();
+ return getAbstractTypeDeclarationNode(iType, cuNode).bodyDeclarations();
+ }
+
+ private static ASTNode getNameNode(IMember iMember, CompilationUnit cuNode) throws JavaModelException {
+ return NodeFinder.perform(cuNode, iMember.getNameRange());
+ }
+}
+
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ASTNodes.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ASTNodes.java
new file mode 100644
index 0000000000..ce49d2ae54
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ASTNodes.java
@@ -0,0 +1,726 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ * Dmitry Stalnov (dstalnov@fusionone.com) - contributed fix for
+ * bug "inline method - doesn't handle implicit cast" (see
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=24941).
+ * Dmitry Stalnov (dstalnov@fusionone.com) - contributed fix for
+ * bug Encapsulate field can fail when two variables in one variable declaration (see
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51540).
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jdtutility;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.ISourceReference;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.compiler.IProblem;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTVisitor;
+import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
+import org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
+import org.eclipse.jdt.core.dom.ArrayType;
+import org.eclipse.jdt.core.dom.Assignment;
+import org.eclipse.jdt.core.dom.BodyDeclaration;
+import org.eclipse.jdt.core.dom.ChildListPropertyDescriptor;
+import org.eclipse.jdt.core.dom.ClassInstanceCreation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.DoStatement;
+import org.eclipse.jdt.core.dom.EnhancedForStatement;
+import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.ForStatement;
+import org.eclipse.jdt.core.dom.IBinding;
+import org.eclipse.jdt.core.dom.IExtendedModifier;
+import org.eclipse.jdt.core.dom.IMethodBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.IVariableBinding;
+import org.eclipse.jdt.core.dom.IfStatement;
+import org.eclipse.jdt.core.dom.InfixExpression;
+import org.eclipse.jdt.core.dom.Message;
+import org.eclipse.jdt.core.dom.MethodInvocation;
+import org.eclipse.jdt.core.dom.Modifier;
+import org.eclipse.jdt.core.dom.Name;
+import org.eclipse.jdt.core.dom.ParameterizedType;
+import org.eclipse.jdt.core.dom.PrimitiveType;
+import org.eclipse.jdt.core.dom.QualifiedName;
+import org.eclipse.jdt.core.dom.QualifiedType;
+import org.eclipse.jdt.core.dom.ReturnStatement;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jdt.core.dom.SimpleType;
+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor;
+import org.eclipse.jdt.core.dom.Type;
+import org.eclipse.jdt.core.dom.VariableDeclaration;
+import org.eclipse.jdt.core.dom.VariableDeclarationExpression;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
+import org.eclipse.jdt.core.dom.WhileStatement;
+
+
+//copied from org.eclipse.jdt.internal.corext.dom.ASTNodes
+//deleted code to limit the number of classes I had to copy
+public class ASTNodes {
+
+ public static final int NODE_ONLY= 0;
+ public static final int INCLUDE_FIRST_PARENT= 1;
+ public static final int INCLUDE_ALL_PARENTS= 2;
+
+ public static final int WARNING= 1 << 0;
+ public static final int ERROR= 1 << 1;
+ public static final int PROBLEMS= WARNING | ERROR;
+
+ private static final Message[] EMPTY_MESSAGES= new Message[0];
+ private static final IProblem[] EMPTY_PROBLEMS= new IProblem[0];
+
+ private static final int CLEAR_VISIBILITY= ~(Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE);
+
+
+ private ASTNodes() {
+ // no instance;
+ }
+
+ /**
+ * Returns the list that contains the given ASTNode. If the node
+ * isn't part of any list, <code>null</code> is returned.
+ *
+ * @param node the node in question
+ * @return the list that contains the node or <code>null</code>
+ */
+ @SuppressWarnings("unchecked")
+ public static List<ASTNode> getContainingList(ASTNode node) {
+ StructuralPropertyDescriptor locationInParent= node.getLocationInParent();
+ if (locationInParent != null && locationInParent.isChildListProperty()) {
+ return (List<ASTNode>) node.getParent().getStructuralProperty(locationInParent);
+ }
+ return null;
+ }
+
+ /**
+ * Returns a list of the direct children of a node. The siblings are ordered by start offset.
+ * @param node the node to get the children for
+ * @return the children
+ */
+ public static List<ASTNode> getChildren(ASTNode node) {
+ ChildrenCollector visitor= new ChildrenCollector();
+ node.accept(visitor);
+ return visitor.result;
+ }
+
+ private static class ChildrenCollector extends GenericVisitor {
+ public List<ASTNode> result;
+
+ public ChildrenCollector() {
+ super(true);
+ result= null;
+ }
+ @Override
+ protected boolean visitNode(ASTNode node) {
+ if (result == null) { // first visitNode: on the node's parent: do nothing, return true
+ result= new ArrayList<ASTNode>();
+ return true;
+ }
+ result.add(node);
+ return false;
+ }
+ }
+
+ /**
+ * Returns true if this is an existing node, i.e. it was created as part of
+ * a parsing process of a source code file. Returns false if this is a newly
+ * created node which has not yet been given a source position.
+ *
+ * @param node the node to be tested.
+ * @return true if this is an existing node, false if not.
+ */
+ public static boolean isExistingNode(ASTNode node) {
+ return node.getStartPosition() != -1;
+ }
+
+ /**
+ * Returns the element type. This is a convenience method that returns its
+ * argument if it is a simple type and the element type if the parameter is an array type.
+ * @param type The type to get the element type from.
+ * @return The element type of the type or the type itself.
+ */
+ public static Type getElementType(Type type) {
+ if (! type.isArrayType())
+ return type;
+ return ((ArrayType)type).getElementType();
+ }
+
+ public static ASTNode findDeclaration(IBinding binding, ASTNode root) {
+ root= root.getRoot();
+ if (root instanceof CompilationUnit) {
+ return ((CompilationUnit)root).findDeclaringNode(binding);
+ }
+ return null;
+ }
+
+ public static VariableDeclaration findVariableDeclaration(IVariableBinding binding, ASTNode root) {
+ if (binding.isField())
+ return null;
+ ASTNode result= findDeclaration(binding, root);
+ if (result instanceof VariableDeclaration)
+ return (VariableDeclaration)result;
+
+ return null;
+ }
+
+ /**
+ * Returns the type node for the given declaration.
+ * @param declaration the declaration
+ * @return the type node
+ */
+ public static Type getType(VariableDeclaration declaration) {
+ if (declaration instanceof SingleVariableDeclaration) {
+ return ((SingleVariableDeclaration)declaration).getType();
+ } else if (declaration instanceof VariableDeclarationFragment) {
+ ASTNode parent= ((VariableDeclarationFragment)declaration).getParent();
+ if (parent instanceof VariableDeclarationExpression)
+ return ((VariableDeclarationExpression)parent).getType();
+ else if (parent instanceof VariableDeclarationStatement)
+ return ((VariableDeclarationStatement)parent).getType();
+ else if (parent instanceof FieldDeclaration)
+ return ((FieldDeclaration)parent).getType();
+ }
+ Assert.isTrue(false, "Unknown VariableDeclaration"); //$NON-NLS-1$
+ return null;
+ }
+
+ public static int getDimensions(VariableDeclaration declaration) {
+ int dim= declaration.getExtraDimensions();
+ Type type= getType(declaration);
+ if (type instanceof ArrayType) {
+ dim += ((ArrayType) type).getDimensions();
+ }
+ return dim;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static List<IExtendedModifier> getModifiers(VariableDeclaration declaration) {
+ Assert.isNotNull(declaration);
+ if (declaration instanceof SingleVariableDeclaration) {
+ return ((SingleVariableDeclaration)declaration).modifiers();
+ } else if (declaration instanceof VariableDeclarationFragment) {
+ ASTNode parent= declaration.getParent();
+ if (parent instanceof VariableDeclarationExpression)
+ return ((VariableDeclarationExpression)parent).modifiers();
+ else if (parent instanceof VariableDeclarationStatement)
+ return ((VariableDeclarationStatement)parent).modifiers();
+ }
+ return new ArrayList<IExtendedModifier>(0);
+ }
+
+ public static boolean isSingleDeclaration(VariableDeclaration declaration) {
+ Assert.isNotNull(declaration);
+ if (declaration instanceof SingleVariableDeclaration) {
+ return true;
+ } else if (declaration instanceof VariableDeclarationFragment) {
+ ASTNode parent= declaration.getParent();
+ if (parent instanceof VariableDeclarationExpression)
+ return ((VariableDeclarationExpression)parent).fragments().size() == 1;
+ else if (parent instanceof VariableDeclarationStatement)
+ return ((VariableDeclarationStatement)parent).fragments().size() == 1;
+ }
+ return false;
+ }
+
+ public static boolean isLiteral(Expression expression) {
+ int type= expression.getNodeType();
+ return type == ASTNode.BOOLEAN_LITERAL || type == ASTNode.CHARACTER_LITERAL || type == ASTNode.NULL_LITERAL ||
+ type == ASTNode.NUMBER_LITERAL || type == ASTNode.STRING_LITERAL || type == ASTNode.TYPE_LITERAL;
+ }
+
+ public static boolean isLabel(SimpleName name) {
+ int parentType= name.getParent().getNodeType();
+ return parentType == ASTNode.LABELED_STATEMENT ||
+ parentType == ASTNode.BREAK_STATEMENT || parentType != ASTNode.CONTINUE_STATEMENT;
+ }
+
+ public static boolean isStatic(BodyDeclaration declaration) {
+ return Modifier.isStatic(declaration.getModifiers());
+ }
+
+ @SuppressWarnings("unchecked")
+ public static List<BodyDeclaration> getBodyDeclarations(ASTNode node) {
+ if (node instanceof AbstractTypeDeclaration) {
+ return ((AbstractTypeDeclaration)node).bodyDeclarations();
+ } else if (node instanceof AnonymousClassDeclaration) {
+ return ((AnonymousClassDeclaration)node).bodyDeclarations();
+ }
+ // should not happen.
+ Assert.isTrue(false);
+ return null;
+ }
+
+ public static ChildListPropertyDescriptor getBodyDeclarationsProperty(ASTNode node) {
+ if (node instanceof AbstractTypeDeclaration) {
+ return ((AbstractTypeDeclaration)node).getBodyDeclarationsProperty();
+ } else if (node instanceof AnonymousClassDeclaration) {
+ return AnonymousClassDeclaration.BODY_DECLARATIONS_PROPERTY;
+ }
+ // should not happen.
+ Assert.isTrue(false);
+ return null;
+ }
+
+ public static String getTypeName(Type type) {
+ final StringBuffer buffer= new StringBuffer();
+ ASTVisitor visitor= new ASTVisitor() {
+ @Override
+ public boolean visit(PrimitiveType node) {
+ buffer.append(node.getPrimitiveTypeCode().toString());
+ return false;
+ }
+ @Override
+ public boolean visit(SimpleName node) {
+ buffer.append(node.getIdentifier());
+ return false;
+ }
+ @Override
+ public boolean visit(QualifiedName node) {
+ buffer.append(node.getName().getIdentifier());
+ return false;
+ }
+ @Override
+ public void endVisit(ArrayType node) {
+ buffer.append("[]"); //$NON-NLS-1$
+ }
+ };
+ type.accept(visitor);
+ return buffer.toString();
+ }
+
+ public static InfixExpression.Operator convertToInfixOperator(Assignment.Operator operator) {
+ if (operator.equals(Assignment.Operator.PLUS_ASSIGN))
+ return InfixExpression.Operator.PLUS;
+
+ if (operator.equals(Assignment.Operator.MINUS_ASSIGN))
+ return InfixExpression.Operator.MINUS;
+
+ if (operator.equals(Assignment.Operator.TIMES_ASSIGN))
+ return InfixExpression.Operator.TIMES;
+
+ if (operator.equals(Assignment.Operator.DIVIDE_ASSIGN))
+ return InfixExpression.Operator.DIVIDE;
+
+ if (operator.equals(Assignment.Operator.BIT_AND_ASSIGN))
+ return InfixExpression.Operator.AND;
+
+ if (operator.equals(Assignment.Operator.BIT_OR_ASSIGN))
+ return InfixExpression.Operator.OR;
+
+ if (operator.equals(Assignment.Operator.BIT_XOR_ASSIGN))
+ return InfixExpression.Operator.XOR;
+
+ if (operator.equals(Assignment.Operator.REMAINDER_ASSIGN))
+ return InfixExpression.Operator.REMAINDER;
+
+ if (operator.equals(Assignment.Operator.LEFT_SHIFT_ASSIGN))
+ return InfixExpression.Operator.LEFT_SHIFT;
+
+ if (operator.equals(Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN))
+ return InfixExpression.Operator.RIGHT_SHIFT_SIGNED;
+
+ if (operator.equals(Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN))
+ return InfixExpression.Operator.RIGHT_SHIFT_UNSIGNED;
+
+ Assert.isTrue(false, "Cannot convert assignment operator"); //$NON-NLS-1$
+ return null;
+ }
+
+ /**
+ * Returns true if a node at a given location is a body of a control statement. Such body nodes are
+ * interesting as when replacing them, it has to be evaluates if a Block is needed instead.
+ * E.g. <code> if (x) do(); -> if (x) { do1(); do2() } </code>
+ *
+ * @param locationInParent Location of the body node
+ * @return Returns true if the location is a body node location of a control statement.
+ */
+ public static boolean isControlStatementBody(StructuralPropertyDescriptor locationInParent) {
+ return locationInParent == IfStatement.THEN_STATEMENT_PROPERTY
+ || locationInParent == IfStatement.ELSE_STATEMENT_PROPERTY
+ || locationInParent == ForStatement.BODY_PROPERTY
+ || locationInParent == EnhancedForStatement.BODY_PROPERTY
+ || locationInParent == WhileStatement.BODY_PROPERTY
+ || locationInParent == DoStatement.BODY_PROPERTY;
+ }
+
+ public static boolean needsParentheses(Expression expression) {
+ int type= expression.getNodeType();
+ return type == ASTNode.INFIX_EXPRESSION || type == ASTNode.CONDITIONAL_EXPRESSION ||
+ type == ASTNode.PREFIX_EXPRESSION || type == ASTNode.POSTFIX_EXPRESSION ||
+ type == ASTNode.CAST_EXPRESSION || type == ASTNode.INSTANCEOF_EXPRESSION;
+ }
+
+
+ public static boolean substituteMustBeParenthesized(Expression substitute, Expression location) {
+ if (!needsParentheses(substitute))
+ return false;
+
+ ASTNode parent= location.getParent();
+ if (parent instanceof VariableDeclarationFragment){
+ VariableDeclarationFragment vdf= (VariableDeclarationFragment)parent;
+ if (vdf.getInitializer().equals(location))
+ return false;
+ } else if (parent instanceof MethodInvocation){
+ MethodInvocation mi= (MethodInvocation)parent;
+ if (mi.arguments().contains(location))
+ return false;
+ } else if (parent instanceof ReturnStatement)
+ return false;
+
+ return true;
+ }
+
+ public static ASTNode getParent(ASTNode node, Class<? extends ASTNode> parentClass) {
+ do {
+ node= node.getParent();
+ } while (node != null && !parentClass.isInstance(node));
+ return node;
+ }
+
+ public static ASTNode getParent(ASTNode node, int nodeType) {
+ do {
+ node= node.getParent();
+ } while (node != null && node.getNodeType() != nodeType);
+ return node;
+ }
+
+ public static ASTNode findParent(ASTNode node, StructuralPropertyDescriptor[][] pathes) {
+ for (int p= 0; p < pathes.length; p++) {
+ StructuralPropertyDescriptor[] path= pathes[p];
+ ASTNode current= node;
+ int d= path.length - 1;
+ for (; d >= 0 && current != null; d--) {
+ StructuralPropertyDescriptor descriptor= path[d];
+ if (!descriptor.equals(current.getLocationInParent()))
+ break;
+ current= current.getParent();
+ }
+ if (d < 0)
+ return current;
+ }
+ return null;
+ }
+
+ public static ASTNode getNormalizedNode(ASTNode node) {
+ ASTNode current= node;
+ // normalize name
+ if (QualifiedName.NAME_PROPERTY.equals(current.getLocationInParent())) {
+ current= current.getParent();
+ }
+ // normalize type
+ if (QualifiedType.NAME_PROPERTY.equals(current.getLocationInParent()) ||
+ SimpleType.NAME_PROPERTY.equals(current.getLocationInParent())) {
+ current= current.getParent();
+ }
+ // normalize parameterized types
+ if (ParameterizedType.TYPE_PROPERTY.equals(current.getLocationInParent())) {
+ current= current.getParent();
+ }
+ return current;
+ }
+
+ public static boolean isParent(ASTNode node, ASTNode parent) {
+ Assert.isNotNull(parent);
+ do {
+ node= node.getParent();
+ if (node == parent)
+ return true;
+ } while (node != null);
+ return false;
+ }
+
+ public static int getExclusiveEnd(ASTNode node){
+ return node.getStartPosition() + node.getLength();
+ }
+
+ public static int getInclusiveEnd(ASTNode node){
+ return node.getStartPosition() + node.getLength() - 1;
+ }
+
+ public static IMethodBinding getMethodBinding(Name node) {
+ IBinding binding= node.resolveBinding();
+ if (binding instanceof IMethodBinding)
+ return (IMethodBinding)binding;
+ return null;
+ }
+
+ public static IVariableBinding getVariableBinding(Name node) {
+ IBinding binding= node.resolveBinding();
+ if (binding instanceof IVariableBinding)
+ return (IVariableBinding)binding;
+ return null;
+ }
+
+ public static IVariableBinding getLocalVariableBinding(Name node) {
+ IVariableBinding result= getVariableBinding(node);
+ if (result == null || result.isField())
+ return null;
+
+ return result;
+ }
+
+ public static IVariableBinding getFieldBinding(Name node) {
+ IVariableBinding result= getVariableBinding(node);
+ if (result == null || !result.isField())
+ return null;
+
+ return result;
+ }
+
+ public static ITypeBinding getTypeBinding(Name node) {
+ IBinding binding= node.resolveBinding();
+ if (binding instanceof ITypeBinding)
+ return (ITypeBinding)binding;
+ return null;
+ }
+
+ /**
+ * Returns the receiver's type binding of the given method invocation.
+ *
+ * @param invocation method invocation to resolve type of
+ * @return the type binding of the receiver
+ */
+ public static ITypeBinding getReceiverTypeBinding(MethodInvocation invocation) {
+ ITypeBinding result= null;
+ Expression exp= invocation.getExpression();
+ if(exp != null) {
+ return exp.resolveTypeBinding();
+ }
+ AbstractTypeDeclaration type= (AbstractTypeDeclaration)getParent(invocation, AbstractTypeDeclaration.class);
+ if (type != null)
+ return type.resolveBinding();
+ return result;
+ }
+
+ public static ITypeBinding getEnclosingType(ASTNode node) {
+ while(node != null) {
+ if (node instanceof AbstractTypeDeclaration) {
+ return ((AbstractTypeDeclaration)node).resolveBinding();
+ } else if (node instanceof AnonymousClassDeclaration) {
+ return ((AnonymousClassDeclaration)node).resolveBinding();
+ }
+ node= node.getParent();
+ }
+ return null;
+ }
+
+ public static IProblem[] getProblems(ASTNode node, int scope, int severity) {
+ ASTNode root= node.getRoot();
+ if (!(root instanceof CompilationUnit))
+ return EMPTY_PROBLEMS;
+ IProblem[] problems= ((CompilationUnit)root).getProblems();
+ if (root == node)
+ return problems;
+ final int iterations= computeIterations(scope);
+ List<IProblem> result= new ArrayList<IProblem>(5);
+ for (int i= 0; i < problems.length; i++) {
+ IProblem problem= problems[i];
+ boolean consider= false;
+ if ((severity & PROBLEMS) == PROBLEMS)
+ consider= true;
+ else if ((severity & WARNING) != 0)
+ consider= problem.isWarning();
+ else if ((severity & ERROR) != 0)
+ consider= problem.isError();
+ if (consider) {
+ ASTNode temp= node;
+ int count= iterations;
+ do {
+ int nodeOffset= temp.getStartPosition();
+ int problemOffset= problem.getSourceStart();
+ if (nodeOffset <= problemOffset && problemOffset < nodeOffset + temp.getLength()) {
+ result.add(problem);
+ count= 0;
+ } else {
+ count--;
+ }
+ } while ((temp= temp.getParent()) != null && count > 0);
+ }
+ }
+ return result.toArray(new IProblem[result.size()]);
+ }
+
+ public static Message[] getMessages(ASTNode node, int flags) {
+ ASTNode root= node.getRoot();
+ if (!(root instanceof CompilationUnit))
+ return EMPTY_MESSAGES;
+ Message[] messages= ((CompilationUnit)root).getMessages();
+ if (root == node)
+ return messages;
+ final int iterations= computeIterations(flags);
+ List<Message> result= new ArrayList<Message>(5);
+ for (int i= 0; i < messages.length; i++) {
+ Message message= messages[i];
+ ASTNode temp= node;
+ int count= iterations;
+ do {
+ int nodeOffset= temp.getStartPosition();
+ int messageOffset= message.getStartPosition();
+ if (nodeOffset <= messageOffset && messageOffset < nodeOffset + temp.getLength()) {
+ result.add(message);
+ count= 0;
+ } else {
+ count--;
+ }
+ } while ((temp= temp.getParent()) != null && count > 0);
+ }
+ return result.toArray(new Message[result.size()]);
+ }
+
+ private static int computeIterations(int flags) {
+ switch (flags) {
+ case NODE_ONLY:
+ return 1;
+ case INCLUDE_ALL_PARENTS:
+ return Integer.MAX_VALUE;
+ case INCLUDE_FIRST_PARENT:
+ return 2;
+ default:
+ return 1;
+ }
+ }
+
+ public static SimpleName getLeftMostSimpleName(Name name) {
+ if (name instanceof SimpleName) {
+ return (SimpleName)name;
+ }
+ final SimpleName[] result= new SimpleName[1];
+ ASTVisitor visitor= new ASTVisitor() {
+ @Override
+ public boolean visit(QualifiedName qualifiedName) {
+ Name left= qualifiedName.getQualifier();
+ if (left instanceof SimpleName)
+ result[0]= (SimpleName)left;
+ else
+ left.accept(this);
+ return false;
+ }
+ };
+ name.accept(visitor);
+ return result[0];
+ }
+
+ public static SimpleType getLeftMostSimpleType(QualifiedType type) {
+ final SimpleType[] result= new SimpleType[1];
+ ASTVisitor visitor= new ASTVisitor() {
+ @Override
+ public boolean visit(QualifiedType qualifiedType) {
+ Type left= qualifiedType.getQualifier();
+ if (left instanceof SimpleType)
+ result[0]= (SimpleType)left;
+ else
+ left.accept(this);
+ return false;
+ }
+ };
+ type.accept(visitor);
+ return result[0];
+ }
+
+ public static Name getTopMostName(Name name) {
+ Name result= name;
+ while(result.getParent() instanceof Name) {
+ result= (Name)result.getParent();
+ }
+ return result;
+ }
+
+ public static Type getTopMostType(Type type) {
+ Type result= type;
+ while(result.getParent() instanceof Type) {
+ result= (Type)result.getParent();
+ }
+ return result;
+ }
+
+ public static int changeVisibility(int modifiers, int visibility) {
+ return (modifiers & CLEAR_VISIBILITY) | visibility;
+ }
+
+ /**
+ * Adds flags to the given node and all its descendants.
+ * @param root The root node
+ * @param flags The flags to set
+ */
+ public static void setFlagsToAST(ASTNode root, final int flags) {
+ root.accept(new GenericVisitor(true) {
+ @Override
+ protected boolean visitNode(ASTNode node) {
+ node.setFlags(node.getFlags() | flags);
+ return true;
+ }
+ });
+ }
+
+ public static String getQualifier(Name name) {
+ if (name.isQualifiedName()) {
+ return ((QualifiedName) name).getQualifier().getFullyQualifiedName();
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ public static String getSimpleNameIdentifier(Name name) {
+ if (name.isQualifiedName()) {
+ return ((QualifiedName) name).getName().getIdentifier();
+ }
+ return ((SimpleName) name).getIdentifier();
+ }
+
+ public static boolean isDeclaration(Name name) {
+ if (name.isQualifiedName()) {
+ return ((QualifiedName) name).getName().isDeclaration();
+ }
+ return ((SimpleName) name).isDeclaration();
+ }
+
+ public static Modifier findModifierNode(int flag, List<?> modifiers) {
+ for (int i= 0; i < modifiers.size(); i++) {
+ Object curr= modifiers.get(i);
+ if (curr instanceof Modifier && ((Modifier) curr).getKeyword().toFlagValue() == flag) {
+ return (Modifier) curr;
+ }
+ }
+ return null;
+ }
+
+ public static ITypeBinding getTypeBinding(CompilationUnit root, IType type) throws JavaModelException {
+ if (type.isAnonymous()) {
+ final IJavaElement parent= type.getParent();
+ if (parent instanceof IField && Flags.isEnum(((IMember) parent).getFlags())) {
+ final EnumConstantDeclaration constant= (EnumConstantDeclaration) NodeFinder.perform(root, ((ISourceReference) parent).getSourceRange());
+ if (constant != null) {
+ final AnonymousClassDeclaration declaration= constant.getAnonymousClassDeclaration();
+ if (declaration != null)
+ return declaration.resolveBinding();
+ }
+ } else {
+ final ClassInstanceCreation creation= (ClassInstanceCreation) getParent(NodeFinder.perform(root, type.getNameRange()), ClassInstanceCreation.class);
+ if (creation != null)
+ return creation.resolveTypeBinding();
+ }
+ } else {
+ final AbstractTypeDeclaration declaration= (AbstractTypeDeclaration) getParent(NodeFinder.perform(root, type.getNameRange()), AbstractTypeDeclaration.class);
+ if (declaration != null)
+ return declaration.resolveBinding();
+ }
+ return null;
+ }
+}
+
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/Attribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/Attribute.java
index 60dc9589c5..f8e1bc8d06 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/Attribute.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/Attribute.java
@@ -12,6 +12,7 @@ package org.eclipse.jpt.core.internal.jdtutility;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jpt.utility.internal.CommandExecutorProvider;
/**
@@ -22,6 +23,10 @@ public abstract class Attribute extends Member {
Attribute(IMember jdtMember, CommandExecutorProvider modifySharedDocumentCommandExecutorProvider) {
super(jdtMember, modifySharedDocumentCommandExecutorProvider);
}
+
+ Attribute(IMember jdtMember, CommandExecutorProvider modifySharedDocumentCommandExecutorProvider, AnnotationEditFormatter annotationEditFormatter) {
+ super(jdtMember, modifySharedDocumentCommandExecutorProvider, annotationEditFormatter);
+ }
public boolean isField() {
return false;
@@ -33,10 +38,6 @@ public abstract class Attribute extends Member {
public abstract String attributeName();
- public boolean typeIs(String fullyQualifiedTypeName, CompilationUnit astRoot) {
- return fullyQualifiedTypeName.equals(this.resolvedTypeName(astRoot));
- }
-
/**
* Resolve the attribute.
* Return the fully-qualified type name or return null if it cannot be
@@ -50,6 +51,18 @@ public abstract class Attribute extends Member {
return null;
}
+ /**
+ * this will throw a NPE for a top-level type
+ */
+ TypeDeclaration declaringTypeDeclaration(CompilationUnit astRoot) {
+ //assume no enums or annotation types since they have no field or method declarations
+ return (TypeDeclaration) this.getDeclaringType().bodyDeclaration(astRoot);
+ }
+ /**
+ * Return the ITypeBinding for the attribute's type, not it's declaring type
+ * @param astRoot
+ * @return
+ */
public abstract ITypeBinding typeBinding(CompilationUnit astRoot);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/AttributeAnnotationTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/AttributeAnnotationTools.java
deleted file mode 100644
index 31fa4cec12..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/AttributeAnnotationTools.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 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.jdtutility;
-
-import java.util.ArrayList;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-
-public class AttributeAnnotationTools {
-
- /**
- * Return the fields in the specified type that may be "persisted".
- */
- public static IField[] persistableFields(IType type) {
- try {
- return persistableFields_(type);
- } catch(JavaModelException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- private static IField[] persistableFields_(IType type) throws JavaModelException {
- ArrayList<IField> persistableFields = new ArrayList<IField>();
- for (IField field : type.getFields()) {
- if (fieldIsPersistable(field)) {
- persistableFields.add(field);
- }
- }
- return persistableFields.toArray(new IField[persistableFields.size()]);
- }
-
- /**
- * Return whether the specified field may be "persisted".
- */
- public static boolean fieldIsPersistable(IField field) {
- try {
- return fieldIsPersistable_(field);
- } catch(JavaModelException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- /**
- * According to the spec, "All non-transient instance variables that are not
- * annotated with the Transient annotation are persistent."
- */
- private static boolean fieldIsPersistable_(IField field) throws JavaModelException {
- int flags = field.getFlags();
- if (Flags.isStatic(flags)) {
- return false;
- }
- if (Flags.isTransient(flags)) {
- return false;
- }
- return true;
- }
-
- /**
- * Return the "getter" methods in the specified type that
- * represent properties that may be "persisted".
- */
- public static IMethod[] persistablePropertyGetters(IType type) {
- try {
- return persistablePropertyGetters_(type);
- } catch(JavaModelException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- private static IMethod[] persistablePropertyGetters_(IType type) throws JavaModelException {
- ArrayList<IMethod> persistableMethods = new ArrayList<IMethod>();
- for (IMethod method : type.getMethods()) {
- if (methodIsPersistablePropertyGetter(method)) {
- persistableMethods.add(method);
- }
- }
- return persistableMethods.toArray(new IMethod[persistableMethods.size()]);
- }
-
- /**
- * Return whether the specified method is a "getter" method that
- * represents a property that may be "persisted".
- */
- public static boolean methodIsPersistablePropertyGetter(IMethod method) {
- try {
- return methodIsPersistablePropertyGetter_(method);
- } catch(JavaModelException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- private static boolean methodIsPersistablePropertyGetter_(IMethod method) throws JavaModelException {
- if (methodHasBadModifiers(method)) {
- return false;
- }
-
- // TODO need to "resolve" return type
- String returnType = method.getReturnType();
- if (returnType.equals("V")) { // 'void'
- return false;
- }
- if (method.getNumberOfParameters() != 0) {
- return false;
- }
-
- String methodName = method.getElementName();
- int beginIndex = 0;
- boolean booleanGetter = false;
- if (methodName.startsWith("is")) {
- if (returnType.equals("Z")) { // 'boolean'
- beginIndex = 2;
- } else {
- return false;
- }
- } else {
- if (methodName.startsWith("get")) {
- beginIndex = 3;
- if (returnType.equals("Z")) { // 'boolean'
- booleanGetter = true;
- }
- } else {
- return false;
- }
- }
-
- String capitalizedAttributeName = method.getElementName().substring(beginIndex);
- // if the type has both methods:
- // boolean isProperty()
- // boolean getProperty()
- // then #isProperty() takes precedence and we ignore #getProperty()
- // (see the JavaBeans spec 1.01)
- if (booleanGetter) {
- IMethod isMethod = method.getDeclaringType().getMethod("is" + capitalizedAttributeName, new String[0]);
- if (isMethod.exists() && isMethod.getReturnType().equals("Z")) { // 'boolean'
- return false;
- }
- }
- IMethod setMethod = method.getDeclaringType().getMethod("set" + capitalizedAttributeName, new String[] {returnType});
- if ( ! setMethod.exists()) {
- return false;
- }
- if (methodHasBadModifiers(setMethod)) {
- return false;
- }
- if ( ! setMethod.getReturnType().equals("V")) { // 'void'
- return false;
- }
- return true;
- }
-
- /**
- * Return whether the specified method's modifiers prevent it
- * from being a getter or setter for a "persistent" property.
- */
- private static boolean methodHasBadModifiers(IMethod method) throws JavaModelException {
- if (method.isConstructor()) {
- return true;
- }
- int flags = method.getFlags();
- if (Flags.isStatic(flags)) {
- return true;
- }
- if (Flags.isFinal(flags)) {
- return true;
- }
- if ( ! (Flags.isPublic(flags) || Flags.isProtected(flags))) {
- return true;
- }
- return false;
- }
-
- /**
- * Return whether the type may be "persisted", ie marked as Entity, MappedSuperclass, Embeddable
- */
- public static boolean typeIsPersistable(IType type) {
- try {
- return typeIsPersistable_(type);
- } catch(JavaModelException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- private static boolean typeIsPersistable_(IType type) throws JavaModelException {
- if (type.isInterface()) {
- return false;
- }
- if (type.isAnnotation()) {
- return false;
- }
- if (type.isEnum()) {
- return false;
- }
- if (type.isLocal()) {
- return false;
- }
- if (type.isAnonymous()) {
- return false;
- }
- int flags = type.getFlags();
- if (Flags.isFinal(flags)) {
- return false;
- }
- return true;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/BooleanStringExpressionConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/BooleanExpressionConverter.java
index 0022b1d8a8..b1c26905bd 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/BooleanStringExpressionConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/BooleanExpressionConverter.java
@@ -14,37 +14,37 @@ import org.eclipse.jdt.core.dom.BooleanLiteral;
import org.eclipse.jdt.core.dom.Expression;
/**
- * Convert a boolean literal to/from a string representation of a boolean
- * (e.g. "true").
+ * Convert a boolean literal to/from a Boolean
+ * (e.g. Boolean.TRUE).
*/
-public final class BooleanStringExpressionConverter
- extends AbstractExpressionConverter<String>
+public final class BooleanExpressionConverter
+ extends AbstractExpressionConverter<Boolean>
{
- private static final ExpressionConverter<String> INSTANCE = new BooleanStringExpressionConverter();
+ private static final ExpressionConverter<Boolean> INSTANCE = new BooleanExpressionConverter();
/**
* Return the singleton.
*/
- public static ExpressionConverter<String> instance() {
+ public static ExpressionConverter<Boolean> instance() {
return INSTANCE;
}
/**
* Ensure single instance.
*/
- private BooleanStringExpressionConverter() {
+ private BooleanExpressionConverter() {
super();
}
@Override
- protected BooleanLiteral convertObject(String string, AST ast) {
- return ast.newBooleanLiteral(Boolean.parseBoolean(string));
+ protected BooleanLiteral convertObject(Boolean booleanObject, AST ast) {
+ return ast.newBooleanLiteral(booleanObject.booleanValue());
}
@Override
- protected String convertExpression(Expression expression) {
+ protected Boolean convertExpression(Expression expression) {
Object value = expression.resolveConstantExpressionValue();
- return (value instanceof Boolean) ? ((Boolean) value).toString() : null;
+ return (value instanceof Boolean) ? ((Boolean) value) : null;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ConversionDeclarationAnnotationElementAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ConversionDeclarationAnnotationElementAdapter.java
index abd0df9a31..c222091734 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ConversionDeclarationAnnotationElementAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ConversionDeclarationAnnotationElementAdapter.java
@@ -126,8 +126,8 @@ public class ConversionDeclarationAnnotationElementAdapter<T>
* remove the annotation when the last element is removed;
* the default expression converter expects number constant expressions.
*/
- public static ConversionDeclarationAnnotationElementAdapter<String> forNumbers(DeclarationAnnotationAdapter annotationAdapter) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, NumberStringExpressionConverter.instance());
+ public static ConversionDeclarationAnnotationElementAdapter<Integer> forNumbers(DeclarationAnnotationAdapter annotationAdapter) {
+ return new ConversionDeclarationAnnotationElementAdapter<Integer>(annotationAdapter, NumberIntegerExpressionConverter.instance());
}
/**
@@ -135,15 +135,15 @@ public class ConversionDeclarationAnnotationElementAdapter<T>
* element is removed; the default expression converter expects
* number constant expressions.
*/
- public static ConversionDeclarationAnnotationElementAdapter<String> forNumbers(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, NumberStringExpressionConverter.instance());
+ public static ConversionDeclarationAnnotationElementAdapter<Integer> forNumbers(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return new ConversionDeclarationAnnotationElementAdapter<Integer>(annotationAdapter, elementName, NumberIntegerExpressionConverter.instance());
}
/**
* The default expression converter expects number constant expressions.
*/
- public static ConversionDeclarationAnnotationElementAdapter<String> forNumbers(DeclarationAnnotationAdapter annotationAdapter, String elementName, boolean removeAnnotationWhenEmpty) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, removeAnnotationWhenEmpty, NumberStringExpressionConverter.instance());
+ public static ConversionDeclarationAnnotationElementAdapter<Integer> forNumbers(DeclarationAnnotationAdapter annotationAdapter, String elementName, boolean removeAnnotationWhenEmpty) {
+ return new ConversionDeclarationAnnotationElementAdapter<Integer>(annotationAdapter, elementName, removeAnnotationWhenEmpty, NumberIntegerExpressionConverter.instance());
}
/**
@@ -151,8 +151,8 @@ public class ConversionDeclarationAnnotationElementAdapter<T>
* remove the annotation when the last element is removed;
* the default expression converter expects boolean constant expressions.
*/
- public static ConversionDeclarationAnnotationElementAdapter<String> forBooleans(DeclarationAnnotationAdapter annotationAdapter) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, BooleanStringExpressionConverter.instance());
+ public static ConversionDeclarationAnnotationElementAdapter<Boolean> forBooleans(DeclarationAnnotationAdapter annotationAdapter) {
+ return new ConversionDeclarationAnnotationElementAdapter<Boolean>(annotationAdapter, BooleanExpressionConverter.instance());
}
/**
@@ -160,15 +160,15 @@ public class ConversionDeclarationAnnotationElementAdapter<T>
* element is removed; the default expression converter expects
* boolean constant expressions.
*/
- public static ConversionDeclarationAnnotationElementAdapter<String> forBooleans(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, BooleanStringExpressionConverter.instance());
+ public static ConversionDeclarationAnnotationElementAdapter<Boolean> forBooleans(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return new ConversionDeclarationAnnotationElementAdapter<Boolean>(annotationAdapter, elementName, BooleanExpressionConverter.instance());
}
/**
* The default expression converter expects boolean constant expressions.
*/
- public static ConversionDeclarationAnnotationElementAdapter<String> forBooleans(DeclarationAnnotationAdapter annotationAdapter, String elementName, boolean removeAnnotationWhenEmpty) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, removeAnnotationWhenEmpty, BooleanStringExpressionConverter.instance());
+ public static ConversionDeclarationAnnotationElementAdapter<Boolean> forBooleans(DeclarationAnnotationAdapter annotationAdapter, String elementName, boolean removeAnnotationWhenEmpty) {
+ return new ConversionDeclarationAnnotationElementAdapter<Boolean>(annotationAdapter, elementName, removeAnnotationWhenEmpty, BooleanExpressionConverter.instance());
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/EnumArrayDeclarationAnnotationElementAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/EnumArrayDeclarationAnnotationElementAdapter.java
index 633088588a..69e71b913f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/EnumArrayDeclarationAnnotationElementAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/EnumArrayDeclarationAnnotationElementAdapter.java
@@ -10,7 +10,6 @@
package org.eclipse.jpt.core.internal.jdtutility;
import java.util.List;
-
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.ArrayInitializer;
import org.eclipse.jdt.core.dom.Expression;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/FieldAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/FieldAttribute.java
index 62f6360582..fa229f3c79 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/FieldAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/FieldAttribute.java
@@ -14,6 +14,7 @@ import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.FieldDeclaration;
import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.IVariableBinding;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import org.eclipse.jpt.utility.internal.CommandExecutorProvider;
@@ -27,6 +28,10 @@ public class FieldAttribute extends Attribute {
public FieldAttribute(IField field, CommandExecutorProvider modifySharedDocumentCommandExecutorProvider) {
super(field, modifySharedDocumentCommandExecutorProvider);
}
+
+ public FieldAttribute(IField field, CommandExecutorProvider modifySharedDocumentCommandExecutorProvider, AnnotationEditFormatter annotationEditFormatter) {
+ super(field, modifySharedDocumentCommandExecutorProvider, annotationEditFormatter);
+ }
@Override
public IField getJdtMember() {
@@ -51,7 +56,22 @@ public class FieldAttribute extends Attribute {
return null;
}
-
+ private VariableDeclarationFragment fragment(CompilationUnit astRoot) {
+ FieldDeclaration fieldDeclaration = bodyDeclaration(astRoot);
+ for (VariableDeclarationFragment fragment : this.fragments(fieldDeclaration)) {
+ if (fragment.getName().getFullyQualifiedName().equals(getName())) {
+ return fragment;
+ }
+ }
+ //TODO could this ever happen, should I throw an exception instead?
+ return null;
+ }
+
+ @Override
+ public IVariableBinding binding(CompilationUnit astRoot) {
+ return fragment(astRoot).resolveBinding();
+ }
+
// ********** Attribute implementation **********
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/GenericVisitor.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/GenericVisitor.java
new file mode 100644
index 0000000000..be7b366875
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/GenericVisitor.java
@@ -0,0 +1,795 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jdtutility;
+
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTVisitor;
+import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration;
+import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration;
+import org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
+import org.eclipse.jdt.core.dom.ArrayAccess;
+import org.eclipse.jdt.core.dom.ArrayCreation;
+import org.eclipse.jdt.core.dom.ArrayInitializer;
+import org.eclipse.jdt.core.dom.ArrayType;
+import org.eclipse.jdt.core.dom.AssertStatement;
+import org.eclipse.jdt.core.dom.Assignment;
+import org.eclipse.jdt.core.dom.Block;
+import org.eclipse.jdt.core.dom.BlockComment;
+import org.eclipse.jdt.core.dom.BooleanLiteral;
+import org.eclipse.jdt.core.dom.BreakStatement;
+import org.eclipse.jdt.core.dom.CastExpression;
+import org.eclipse.jdt.core.dom.CatchClause;
+import org.eclipse.jdt.core.dom.CharacterLiteral;
+import org.eclipse.jdt.core.dom.ClassInstanceCreation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.ConditionalExpression;
+import org.eclipse.jdt.core.dom.ConstructorInvocation;
+import org.eclipse.jdt.core.dom.ContinueStatement;
+import org.eclipse.jdt.core.dom.DoStatement;
+import org.eclipse.jdt.core.dom.EmptyStatement;
+import org.eclipse.jdt.core.dom.EnhancedForStatement;
+import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
+import org.eclipse.jdt.core.dom.EnumDeclaration;
+import org.eclipse.jdt.core.dom.ExpressionStatement;
+import org.eclipse.jdt.core.dom.FieldAccess;
+import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.ForStatement;
+import org.eclipse.jdt.core.dom.IfStatement;
+import org.eclipse.jdt.core.dom.ImportDeclaration;
+import org.eclipse.jdt.core.dom.InfixExpression;
+import org.eclipse.jdt.core.dom.Initializer;
+import org.eclipse.jdt.core.dom.InstanceofExpression;
+import org.eclipse.jdt.core.dom.Javadoc;
+import org.eclipse.jdt.core.dom.LabeledStatement;
+import org.eclipse.jdt.core.dom.LineComment;
+import org.eclipse.jdt.core.dom.MarkerAnnotation;
+import org.eclipse.jdt.core.dom.MemberRef;
+import org.eclipse.jdt.core.dom.MemberValuePair;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.MethodInvocation;
+import org.eclipse.jdt.core.dom.MethodRef;
+import org.eclipse.jdt.core.dom.MethodRefParameter;
+import org.eclipse.jdt.core.dom.Modifier;
+import org.eclipse.jdt.core.dom.NormalAnnotation;
+import org.eclipse.jdt.core.dom.NullLiteral;
+import org.eclipse.jdt.core.dom.NumberLiteral;
+import org.eclipse.jdt.core.dom.PackageDeclaration;
+import org.eclipse.jdt.core.dom.ParameterizedType;
+import org.eclipse.jdt.core.dom.ParenthesizedExpression;
+import org.eclipse.jdt.core.dom.PostfixExpression;
+import org.eclipse.jdt.core.dom.PrefixExpression;
+import org.eclipse.jdt.core.dom.PrimitiveType;
+import org.eclipse.jdt.core.dom.QualifiedName;
+import org.eclipse.jdt.core.dom.QualifiedType;
+import org.eclipse.jdt.core.dom.ReturnStatement;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jdt.core.dom.SimpleType;
+import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.jdt.core.dom.StringLiteral;
+import org.eclipse.jdt.core.dom.SuperConstructorInvocation;
+import org.eclipse.jdt.core.dom.SuperFieldAccess;
+import org.eclipse.jdt.core.dom.SuperMethodInvocation;
+import org.eclipse.jdt.core.dom.SwitchCase;
+import org.eclipse.jdt.core.dom.SwitchStatement;
+import org.eclipse.jdt.core.dom.SynchronizedStatement;
+import org.eclipse.jdt.core.dom.TagElement;
+import org.eclipse.jdt.core.dom.TextElement;
+import org.eclipse.jdt.core.dom.ThisExpression;
+import org.eclipse.jdt.core.dom.ThrowStatement;
+import org.eclipse.jdt.core.dom.TryStatement;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.core.dom.TypeDeclarationStatement;
+import org.eclipse.jdt.core.dom.TypeLiteral;
+import org.eclipse.jdt.core.dom.TypeParameter;
+import org.eclipse.jdt.core.dom.VariableDeclarationExpression;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
+import org.eclipse.jdt.core.dom.WhileStatement;
+import org.eclipse.jdt.core.dom.WildcardType;
+
+//copied from org.eclipse.jdt.internal.corext.dom.GenericVisitor
+//deleted code to limit the number of classes I had to copy
+public class GenericVisitor extends ASTVisitor {
+
+ public GenericVisitor() {
+ super();
+ }
+
+ /**
+ * @param visitJavadocTags <code>true</code> if doc comment tags are
+ * to be visited by default, and <code>false</code> otherwise
+ * @see Javadoc#tags()
+ * @see #visit(Javadoc)
+ * @since 3.0
+ */
+ public GenericVisitor(boolean visitJavadocTags) {
+ super(visitJavadocTags);
+ }
+
+ //---- Hooks for subclasses -------------------------------------------------
+
+ protected boolean visitNode(ASTNode node) {
+ return true;
+ }
+
+ protected void endVisitNode(ASTNode node) {
+ // do nothing
+ }
+
+ @Override
+ public boolean visit(AnonymousClassDeclaration node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(ArrayAccess node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(ArrayCreation node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(ArrayInitializer node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(ArrayType node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(AssertStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(Assignment node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(Block node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(BooleanLiteral node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(BreakStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(CastExpression node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(CatchClause node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(CharacterLiteral node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(ClassInstanceCreation node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(CompilationUnit node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(ConditionalExpression node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(ConstructorInvocation node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(ContinueStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(DoStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(EmptyStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(ExpressionStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(FieldAccess node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(FieldDeclaration node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(ForStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(IfStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(ImportDeclaration node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(InfixExpression node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(InstanceofExpression node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(Initializer node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(Javadoc node) {
+ return (super.visit(node)) ? visitNode(node) : false;
+ }
+ @Override
+ public boolean visit(LabeledStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(MethodDeclaration node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(MethodInvocation node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(NullLiteral node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(NumberLiteral node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(PackageDeclaration node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(ParenthesizedExpression node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(PostfixExpression node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(PrefixExpression node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(PrimitiveType node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(QualifiedName node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(ReturnStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(SimpleName node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(SimpleType node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(StringLiteral node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(SuperConstructorInvocation node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(SuperFieldAccess node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(SuperMethodInvocation node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(SwitchCase node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(SwitchStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(SynchronizedStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(ThisExpression node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(ThrowStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(TryStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(TypeDeclaration node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(TypeDeclarationStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(TypeLiteral node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(SingleVariableDeclaration node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(VariableDeclarationExpression node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(VariableDeclarationStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(VariableDeclarationFragment node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(WhileStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(AnnotationTypeDeclaration node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(AnnotationTypeMemberDeclaration node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(BlockComment node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(EnhancedForStatement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(EnumConstantDeclaration node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(EnumDeclaration node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(LineComment node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(MarkerAnnotation node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(MemberRef node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(MemberValuePair node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(MethodRef node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(MethodRefParameter node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(Modifier node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(NormalAnnotation node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(ParameterizedType node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(QualifiedType node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(SingleMemberAnnotation node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(TagElement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(TextElement node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(TypeParameter node) {
+ return visitNode(node);
+ }
+ @Override
+ public boolean visit(WildcardType node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public void endVisit(AnonymousClassDeclaration node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(ArrayAccess node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(ArrayCreation node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(ArrayInitializer node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(ArrayType node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(AssertStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(Assignment node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(Block node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(BooleanLiteral node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(BreakStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(CastExpression node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(CatchClause node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(CharacterLiteral node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(ClassInstanceCreation node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(CompilationUnit node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(ConditionalExpression node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(ConstructorInvocation node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(ContinueStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(DoStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(EmptyStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(ExpressionStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(FieldAccess node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(FieldDeclaration node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(ForStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(IfStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(ImportDeclaration node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(InfixExpression node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(InstanceofExpression node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(Initializer node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(Javadoc node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(LabeledStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(MethodDeclaration node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(MethodInvocation node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(NullLiteral node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(NumberLiteral node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(PackageDeclaration node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(ParenthesizedExpression node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(PostfixExpression node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(PrefixExpression node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(PrimitiveType node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(QualifiedName node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(ReturnStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(SimpleName node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(SimpleType node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(StringLiteral node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(SuperConstructorInvocation node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(SuperFieldAccess node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(SuperMethodInvocation node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(SwitchCase node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(SwitchStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(SynchronizedStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(ThisExpression node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(ThrowStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(TryStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(TypeDeclaration node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(TypeDeclarationStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(TypeLiteral node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(SingleVariableDeclaration node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(VariableDeclarationExpression node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(VariableDeclarationStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(VariableDeclarationFragment node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(WhileStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(AnnotationTypeDeclaration node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(AnnotationTypeMemberDeclaration node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(BlockComment node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(EnhancedForStatement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(EnumConstantDeclaration node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(EnumDeclaration node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(LineComment node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(MarkerAnnotation node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(MemberRef node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(MemberValuePair node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(MethodRef node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(MethodRefParameter node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(Modifier node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(NormalAnnotation node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(ParameterizedType node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(QualifiedType node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(SingleMemberAnnotation node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(TagElement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(TextElement node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(TypeParameter node) {
+ endVisitNode(node);
+ }
+ @Override
+ public void endVisit(WildcardType node) {
+ endVisitNode(node);
+ }
+
+}
+
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/JDTTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/JDTTools.java
index cf1b284da5..e2426f83b3 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/JDTTools.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/JDTTools.java
@@ -11,19 +11,19 @@ package org.eclipse.jpt.core.internal.jdtutility;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.IAnnotationBinding;
import org.eclipse.jdt.core.dom.IBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.IVariableBinding;
import org.eclipse.jdt.core.dom.Name;
-import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jdt.core.dom.TypeLiteral;
public class JDTTools {
@@ -79,15 +79,6 @@ public class JDTTools {
parser.setResolveBindings(resolveBindings);
return (CompilationUnit) parser.createAST(null);
}
-
- public static IType findType(String packageName, String qualifiedTypeName, IJavaProject javaProject) {
- try {
- return javaProject.findType(packageName, qualifiedTypeName.replace('$', '.'));
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return null;
- }
- }
public static String resolveEnum(Expression expression) {
if (expression == null) {
@@ -113,5 +104,27 @@ public class JDTTools {
IVariableBinding variableBinding = (IVariableBinding) binding;
return variableBinding.getType().getQualifiedName() + "." + variableBinding.getName();
}
+
+ public static String resolveAnnotation(Annotation node) {
+ IAnnotationBinding annotationBinding = node.resolveAnnotationBinding();
+ if (annotationBinding == null) {
+ return null;
+ }
+ ITypeBinding annotationTypeBinding = annotationBinding.getAnnotationType();
+ if (annotationTypeBinding == null) {
+ return null;
+ }
+ return annotationTypeBinding.getQualifiedName();
+ }
+
+ public static String resolveFullyQualifiedName(Expression expression) {
+ if (expression.getNodeType() == ASTNode.TYPE_LITERAL) {
+ ITypeBinding resolvedTypeBinding = ((TypeLiteral) expression).getType().resolveBinding();
+ if (resolvedTypeBinding != null) {
+ return resolvedTypeBinding.getQualifiedName();
+ }
+ }
+ return null;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/JPTTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/JPTTools.java
new file mode 100644
index 0000000000..8c3ec2d2b5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/JPTTools.java
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 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.jdtutility;
+
+import org.eclipse.jdt.core.dom.IMethodBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.IVariableBinding;
+import org.eclipse.jdt.core.dom.Modifier;
+
+public class JPTTools {
+
+ /**
+ * Return whether the specified field may be "persisted".
+ * According to the spec, "All non-transient instance variables that are not
+ * annotated with the Transient annotation are persistent."
+ */
+ public static boolean fieldIsPersistable(IVariableBinding field) {
+ int modifiers = field.getModifiers();
+ if (Modifier.isStatic(modifiers)) {
+ return false;
+ }
+ if (Modifier.isTransient(modifiers)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Return whether the specified method is a "getter" method that
+ * represents a property that may be "persisted".
+ */
+ public static boolean methodIsPersistablePropertyGetter(IMethodBinding methodBinding) {
+ if (methodHasBadModifiers(methodBinding)) {
+ return false;
+ }
+
+ ITypeBinding returnType = methodBinding.getReturnType();
+ if (returnType == null) {
+ return false;
+ }
+ String returnTypeName = returnType.getQualifiedName();
+ if (returnTypeName.equals("void")) {
+ return false;
+ }
+ if (methodBinding.getParameterTypes().length != 0) {
+ return false;
+ }
+
+ String methodName = methodBinding.getName();
+ int beginIndex = 0;
+ boolean booleanGetter = false;
+ if (methodName.startsWith("is")) {
+ if (returnTypeName.equals("boolean")) {
+ beginIndex = 2;
+ } else {
+ return false;
+ }
+ } else {
+ if (methodName.startsWith("get")) {
+ beginIndex = 3;
+ if (returnTypeName.equals("boolean")) {
+ booleanGetter = true;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ String capitalizedAttributeName = methodName.substring(beginIndex);
+ // if the type has both methods:
+ // boolean isProperty()
+ // boolean getProperty()
+ // then #isProperty() takes precedence and we ignore #getProperty()
+ // (see the JavaBeans spec 1.01)
+ if (booleanGetter) {
+ IMethodBinding isMethod = methodBindingNoParameters(methodBinding.getDeclaringClass(), "is" + capitalizedAttributeName);
+ if (isMethod == null) {
+ return false;
+ }
+ if (isMethod.getReturnType().getName().equals("boolean")) {
+ return false;
+ }
+ }
+ IMethodBinding setMethod = methodBindingOneParameter(methodBinding.getDeclaringClass(), "set" + capitalizedAttributeName, returnTypeName);
+ if (setMethod == null) {
+ return false;
+ }
+ if (methodHasBadModifiers(setMethod)) {
+ return false;
+ }
+ if ( ! setMethod.getReturnType().getName().equals("void")) {
+ return false;
+ }
+ return true;
+ }
+
+ private static IMethodBinding methodBindingNoParameters(ITypeBinding typeBinding, String methodName) {
+ for (IMethodBinding method : typeBinding.getDeclaredMethods()) {
+ if (method.getName().equals(methodName)) {
+ if (method.getParameterTypes().length == 0) {
+ return method;
+ }
+ }
+ }
+ return null;
+ }
+
+ private static IMethodBinding methodBindingOneParameter(ITypeBinding typeBinding, String methodName, String parameterTypeName) {
+ for (IMethodBinding method : typeBinding.getDeclaredMethods()) {
+ if (method.getName().equals(methodName)) {
+ if (method.getParameterTypes().length == 1) {
+ if (method.getParameterTypes()[0].getQualifiedName().equals(parameterTypeName)) {
+ return method;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return whether the specified method's modifiers prevent it
+ * from being a getter or setter for a "persistent" property.
+ */
+ private static boolean methodHasBadModifiers(IMethodBinding methodBinding) {
+ if (methodBinding.isConstructor()) {
+ return true;
+ }
+ int modifiers = methodBinding.getModifiers();
+ if (Modifier.isStatic(modifiers)) {
+ return true;
+ }
+ if (Modifier.isFinal(modifiers)) {
+ return true;
+ }
+ if ( ! (Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers))) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return whether the type may be "persisted", ie marked as Entity, MappedSuperclass, Embeddable
+ */
+ //TODO should persistability be dependent on having a no-arg constructor or should that just be validation?
+ //seems like final, or a member type being static could be dealt with through validation instead of filtering them out.
+ public static boolean typeIsPersistable(ITypeBinding typeBinding) {
+ if (typeBinding.isInterface()) {
+ return false;
+ }
+ if (typeBinding.isAnnotation()) {
+ return false;
+ }
+ if (typeBinding.isEnum()) {
+ return false;
+ }
+ if (typeBinding.isLocal()) {
+ return false;
+ }
+ if (typeBinding.isAnonymous()) {
+ return false;
+ }
+ int modifiers = typeBinding.getModifiers();
+ if (Modifier.isFinal(modifiers)) {
+ return false;
+ }
+ if (typeBinding.isMember()) {
+ if (!Modifier.isStatic(modifiers)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static boolean typeIsAbstract(ITypeBinding typeBinding) {
+ return Modifier.isAbstract(typeBinding.getModifiers());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/Member.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/Member.java
index fca7ebde55..1621907dd2 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/Member.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/Member.java
@@ -22,7 +22,7 @@ import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.BodyDeclaration;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.Expression;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.core.dom.IBinding;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
@@ -47,15 +47,21 @@ public abstract class Member {
private final CommandExecutorProvider modifySharedDocumentCommandExecutorProvider;
+ private final AnnotationEditFormatter annotationEditFormatter;
// ********** constructor **********
-
+
Member(IMember jdtMember, CommandExecutorProvider modifySharedDocumentCommandExecutorProvider) {
+ this(jdtMember, modifySharedDocumentCommandExecutorProvider, DefaultAnnotationEditFormatter.instance());
+ }
+
+ Member(IMember jdtMember, CommandExecutorProvider modifySharedDocumentCommandExecutorProvider, AnnotationEditFormatter annotationEditFormatter) {
super();
this.jdtMember = jdtMember;
IType jdtDeclaringType = jdtMember.getDeclaringType();
this.declaringType = (jdtDeclaringType == null) ? null : new Type(jdtDeclaringType, modifySharedDocumentCommandExecutorProvider);
this.modifySharedDocumentCommandExecutorProvider = modifySharedDocumentCommandExecutorProvider;
+ this.annotationEditFormatter = annotationEditFormatter;
}
@@ -77,7 +83,8 @@ public abstract class Member {
return this.declaringType;
}
-
+ public abstract IBinding binding(CompilationUnit astRoot);
+
// ********** miscellaneous **********
public ICompilationUnit compilationUnit() {
@@ -148,13 +155,6 @@ public abstract class Member {
}
}
- /**
- * this will throw a NPE for a top-level type
- */
- TypeDeclaration declaringTypeDeclaration(CompilationUnit astRoot) {
- return this.declaringType.bodyDeclaration(astRoot);
- }
-
@Override
public String toString() {
return StringTools.buildToStringFor(this, this.getName());
@@ -377,7 +377,7 @@ public abstract class Member {
* - when editing headlessly, a "working copy" must be created
* (at least as far as I can tell ~kfm)
* - when editing via a plain text editor, make a working copy or else things are screwed
- * up the second time you edit through the Persistence Properties View
+ * up the second time you edit through the XmlPersistence XmlProperties View
*/
private void edit_(Editor editor) throws JavaModelException, BadLocationException {
ICompilationUnit compilationUnit = this.compilationUnit();
@@ -421,7 +421,7 @@ public abstract class Member {
}
private AnnotationEditFormatter annotationEditFormatter() {
- return DefaultAnnotationEditFormatter.instance();
+ return this.annotationEditFormatter;
}
private CommandExecutor modifySharedDocumentCommandExecutor() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/MethodAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/MethodAttribute.java
index f636ad6c8e..3b3f284b09 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/MethodAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/MethodAttribute.java
@@ -11,6 +11,7 @@ package org.eclipse.jpt.core.internal.jdtutility;
import java.beans.Introspector;
import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.IMethodBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
@@ -35,27 +36,32 @@ public class MethodAttribute extends Attribute {
public MethodAttribute(IMethod getMethod, CommandExecutorProvider modifySharedDocumentCommandExecutorProvider) {
super(getMethod, modifySharedDocumentCommandExecutorProvider);
}
+
+ public MethodAttribute(IMethod getMethod, CommandExecutorProvider modifySharedDocumentCommandExecutorProvider, AnnotationEditFormatter annotationEditFormatter) {
+ super(getMethod, modifySharedDocumentCommandExecutorProvider, annotationEditFormatter);
+ }
@Override
public IMethod getJdtMember() {
return (IMethod) super.getJdtMember();
}
-
+
// ********** Member implementation **********
@Override
public MethodDeclaration bodyDeclaration(CompilationUnit astRoot) {
- String methodName = this.getName();
- for (MethodDeclaration methodDeclaration : this.declaringTypeDeclaration(astRoot).getMethods()) {
- if (methodDeclaration.getName().getFullyQualifiedName().equals(methodName)
- && (methodDeclaration.parameters().size() == 0)) {
- return methodDeclaration;
- }
+ try {
+ return ASTNodeSearchUtil.getMethodDeclarationNode(getJdtMember(), astRoot);
+ } catch(JavaModelException e) {
+ throw new RuntimeException(e);
}
- return null;
}
-
+
+ @Override
+ public IMethodBinding binding(CompilationUnit astRoot) {
+ return bodyDeclaration(astRoot).resolveBinding();
+ }
// ********** Attribute implementation **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ModifiedDeclaration.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ModifiedDeclaration.java
index 9af69a287f..e018eca002 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ModifiedDeclaration.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/ModifiedDeclaration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -106,10 +106,10 @@ public class ModifiedDeclaration {
* Return the declaration's annotations.
*/
public Iterator<Annotation> annotations() {
- return new FilteringIterator<Annotation>(this.modifiers().iterator()) {
+ return new FilteringIterator<IExtendedModifier, Annotation>(this.modifiers().iterator()) {
@Override
- protected boolean accept(Object next) {
- return ((IExtendedModifier) next).isAnnotation();
+ protected boolean accept(IExtendedModifier next) {
+ return next.isAnnotation();
}
};
}
@@ -277,6 +277,7 @@ public class ModifiedDeclaration {
return (qualifiedName != null) && qualifiedName.equals(name);
}
+ // TODO?
private String qualifiedName(Annotation annotation) {
ITypeBinding typeBinding = annotation.resolveTypeBinding();
if (typeBinding != null) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/NodeFinder.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/NodeFinder.java
new file mode 100644
index 0000000000..0231fb697d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/NodeFinder.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.core.internal.jdtutility;
+
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.dom.ASTNode;
+/**
+ * For a give range finds the node covered and the node covering.
+ *
+ * @since 2.1
+ */
+//copied from org.eclipse.jdt.internal.corext.dom.NodeFinder
+//deleted code to limit the number of classes I had to copy
+public class NodeFinder extends GenericVisitor {
+
+ /**
+ * A visitor that maps a selection to a given ASTNode. The result node is
+ * determined as follows:
+ * <ul>
+ * <li>first the visitor tries to find a node with the exact start and length</li>
+ * <li>if no such node exists than the node that encloses the range defined by
+ * start and end is returned.</li>
+ * <li>if the length is zero than also nodes are considered where the node's
+ * start or end position matches <code>start</code>.</li>
+ * <li>otherwise <code>null</code> is returned.</li>
+ * </ul>
+ *
+ * @param root the root node from which the search starts
+ * @param start the start offset
+ * @param length the length
+ *
+ * @return the result node
+ *
+ * @since 2.1
+ */
+ public static ASTNode perform(ASTNode root, int start, int length) {
+ NodeFinder finder= new NodeFinder(start, length);
+ root.accept(finder);
+ ASTNode result= finder.getCoveredNode();
+ if (result == null || result.getStartPosition() != start || result.getLength() != length) {
+ return finder.getCoveringNode();
+ }
+ return result;
+ }
+
+ public static ASTNode perform(ASTNode root, ISourceRange range) {
+ return perform(root, range.getOffset(), range.getLength());
+ }
+
+ private int fStart;
+ private int fEnd;
+
+ private ASTNode fCoveringNode;
+ private ASTNode fCoveredNode;
+
+ public NodeFinder(int offset, int length) {
+ super(true); // include Javadoc tags
+ fStart= offset;
+ fEnd= offset + length;
+ }
+
+ @Override
+ protected boolean visitNode(ASTNode node) {
+ int nodeStart= node.getStartPosition();
+ int nodeEnd= nodeStart + node.getLength();
+ if (nodeEnd < fStart || fEnd < nodeStart) {
+ return false;
+ }
+ if (nodeStart <= fStart && fEnd <= nodeEnd) {
+ fCoveringNode= node;
+ }
+ if (fStart <= nodeStart && nodeEnd <= fEnd) {
+ if (fCoveringNode == node) { // nodeStart == fStart && nodeEnd == fEnd
+ fCoveredNode= node;
+ return true; // look further for node with same length as parent
+ } else if (fCoveredNode == null) { // no better found
+ fCoveredNode= node;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Returns the covered node. If more than one nodes are covered by the selection, the
+ * returned node is first covered node found in a top-down traversal of the AST
+ * @return ASTNode
+ */
+ public ASTNode getCoveredNode() {
+ return fCoveredNode;
+ }
+
+ /**
+ * Returns the covering node. If more than one nodes are covering the selection, the
+ * returned node is last covering node found in a top-down traversal of the AST
+ * @return ASTNode
+ */
+ public ASTNode getCoveringNode() {
+ return fCoveringNode;
+ }
+
+}
+
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/NumberStringExpressionConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/NumberIntegerExpressionConverter.java
index f2a531ff67..3ff2bbde50 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/NumberStringExpressionConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/NumberIntegerExpressionConverter.java
@@ -14,37 +14,37 @@ import org.eclipse.jdt.core.dom.Expression;
import org.eclipse.jdt.core.dom.NumberLiteral;
/**
- * Convert a number literal to/from a string representation of a number
- * (e.g. "48").
+ * Convert a number literal to/from an Integer
+ * (e.g. 5).
*/
-public final class NumberStringExpressionConverter
- extends AbstractExpressionConverter<String>
+public final class NumberIntegerExpressionConverter
+ extends AbstractExpressionConverter<Integer>
{
- private static final ExpressionConverter<String> INSTANCE = new NumberStringExpressionConverter();
+ private static final ExpressionConverter<Integer> INSTANCE = new NumberIntegerExpressionConverter();
/**
* Return the singleton.
*/
- public static ExpressionConverter<String> instance() {
+ public static ExpressionConverter<Integer> instance() {
return INSTANCE;
}
/**
* Ensure single instance.
*/
- private NumberStringExpressionConverter() {
+ private NumberIntegerExpressionConverter() {
super();
}
@Override
- protected NumberLiteral convertObject(String string, AST ast) {
- return ast.newNumberLiteral(string);
+ protected NumberLiteral convertObject(Integer integer, AST ast) {
+ return ast.newNumberLiteral(integer.toString());
}
@Override
- protected String convertExpression(Expression expression) {
+ protected Integer convertExpression(Expression expression) {
Object value = expression.resolveConstantExpressionValue();
- return (value instanceof Number) ? ((Number) value).toString() : null;
+ return (value instanceof Integer) ? ((Integer) value) : null;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/Type.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/Type.java
index b721f4f5f3..f27140749f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/Type.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jdtutility/Type.java
@@ -9,15 +9,17 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.jdtutility;
+import java.util.ArrayList;
import java.util.List;
-
-import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
+import org.eclipse.jdt.core.dom.BodyDeclaration;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jpt.utility.internal.CommandExecutorProvider;
public class Type extends Member {
@@ -26,46 +28,76 @@ public class Type extends Member {
super(type, modifySharedDocumentCommandExecutorProvider);
}
+ public Type(IType type, CommandExecutorProvider modifySharedDocumentCommandExecutorProvider, AnnotationEditFormatter annotationEditFormatter) {
+ super(type, modifySharedDocumentCommandExecutorProvider, annotationEditFormatter);
+ }
+
@Override
public IType getJdtMember() {
return (IType) super.getJdtMember();
}
- public boolean isAbstract() {
- try {
- return Flags.isAbstract(this.getJdtMember().getFlags());
- } catch (JavaModelException ex) {
- throw new RuntimeException(ex);
- }
- }
-
@Override
public Type topLevelDeclaringType() {
return (this.getDeclaringType() == null) ? this : super.topLevelDeclaringType();
}
- public String getFullyQualifiedName() {
- return this.getJdtMember().getFullyQualifiedName();
+ public IType[] declaredTypes() {
+ try {
+ return getJdtMember().getTypes();
+ }
+ catch(JavaModelException e) {
+ throw new RuntimeException(e);
+ }
}
-
-
- public ITypeBinding typeBinding(CompilationUnit astRoot) {
- return bodyDeclaration(astRoot).resolveBinding();
+
+ public IField[] fields() {
+ try {
+ return getJdtMember().getFields();
+ }
+ catch(JavaModelException e) {
+ throw new RuntimeException(e);
+ }
}
-
+
+ public IMethod[] methods() {
+ try {
+ return getJdtMember().getMethods();
+ }
+ catch(JavaModelException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
// ********** Member implementation **********
@Override
- public TypeDeclaration bodyDeclaration(CompilationUnit astRoot) {
+ public AbstractTypeDeclaration bodyDeclaration(CompilationUnit astRoot) {
+ Type declaringType = getDeclaringType();
+ if (declaringType != null) {
+ return typeDeclaration(declaringType.bodyDeclaration(astRoot));
+ }
+ return typeDeclaration(this.types(astRoot));
+ }
+
+ public AbstractTypeDeclaration typeDeclaration(AbstractTypeDeclaration declaringTypeDeclaration) {
+ return typeDeclaration(this.types(declaringTypeDeclaration));
+ }
+
+ private AbstractTypeDeclaration typeDeclaration(List<AbstractTypeDeclaration> typeDeclarations) {
String name = this.getName();
- for (AbstractTypeDeclaration typeDeclaration : this.types(astRoot)) {
+ for (AbstractTypeDeclaration typeDeclaration : typeDeclarations) {
if (typeDeclaration.getName().getFullyQualifiedName().equals(name)) {
- return (TypeDeclaration) typeDeclaration; // assume no enum or annotation declarations
+ return typeDeclaration;
}
}
return null;
}
-
+
+ @Override
+ public ITypeBinding binding(CompilationUnit astRoot) {
+ return bodyDeclaration(astRoot).resolveBinding();
+ }
// ********** miscellaneous **********
@@ -73,5 +105,22 @@ public class Type extends Member {
protected List<AbstractTypeDeclaration> types(CompilationUnit astRoot) {
return astRoot.types();
}
+
+ protected List<AbstractTypeDeclaration> types(AbstractTypeDeclaration typeDeclaration) {
+ List<AbstractTypeDeclaration> typeDeclarations = new ArrayList<AbstractTypeDeclaration>();
+ for (BodyDeclaration bodyDeclaration : bodyDeclarations(typeDeclaration))
+ if (bodyDeclaration.getNodeType() == ASTNode.TYPE_DECLARATION ||
+ bodyDeclaration.getNodeType() == ASTNode.ANNOTATION_TYPE_DECLARATION ||
+ bodyDeclaration.getNodeType() == ASTNode.ENUM_DECLARATION) {
+ typeDeclarations.add((AbstractTypeDeclaration) bodyDeclaration);
+ }
+ return typeDeclarations;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected List<BodyDeclaration> bodyDeclarations(AbstractTypeDeclaration typeDeclaration) {
+ return typeDeclaration.bodyDeclarations();
+ }
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/CascadeType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/CascadeType.java
deleted file mode 100644
index 9d64e1c7ad..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/CascadeType.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.eclipse.jpt.core.internal.mappings;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.emf.common.util.Enumerator;
-import org.eclipse.jpt.core.internal.content.java.mappings.JPA;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the literals of the enumeration '<em><b>Cascade Type</b></em>',
- * and utility methods for working with them.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getCascadeType()
- * @model
- * @generated
- */
-public enum CascadeType implements Enumerator {
- /**
- * The '<em><b>ALL</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #ALL_VALUE
- * @generated
- * @ordered
- */
- ALL(0, "ALL", "All"),
- /**
- * The '<em><b>PERSIST</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #PERSIST_VALUE
- * @generated
- * @ordered
- */
- PERSIST(1, "PERSIST", "Persist"),
- /**
- * The '<em><b>MERGE</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #MERGE_VALUE
- * @generated
- * @ordered
- */
- MERGE(2, "MERGE", "Merge"),
- /**
- * The '<em><b>REMOVE</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #REMOVE_VALUE
- * @generated
- * @ordered
- */
- REMOVE(3, "REMOVE", "Remove"),
- /**
- * The '<em><b>REFRESH</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #REFRESH_VALUE
- * @generated
- * @ordered
- */
- REFRESH(4, "REFRESH", "Refresh");
- /**
- * The '<em><b>ALL</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>ALL</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #ALL
- * @model literal="All"
- * @generated
- * @ordered
- */
- public static final int ALL_VALUE = 0;
-
- /**
- * The '<em><b>PERSIST</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>PERSIST</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #PERSIST
- * @model literal="Persist"
- * @generated
- * @ordered
- */
- public static final int PERSIST_VALUE = 1;
-
- /**
- * The '<em><b>MERGE</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>MERGE</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #MERGE
- * @model literal="Merge"
- * @generated
- * @ordered
- */
- public static final int MERGE_VALUE = 2;
-
- /**
- * The '<em><b>REMOVE</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>REMOVE</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #REMOVE
- * @model literal="Remove"
- * @generated
- * @ordered
- */
- public static final int REMOVE_VALUE = 3;
-
- /**
- * The '<em><b>REFRESH</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>REFRESH</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #REFRESH
- * @model literal="Refresh"
- * @generated
- * @ordered
- */
- public static final int REFRESH_VALUE = 4;
-
- /**
- * An array of all the '<em><b>Cascade Type</b></em>' enumerators.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static final CascadeType[] VALUES_ARRAY = new CascadeType[] {
- ALL, PERSIST, MERGE, REMOVE, REFRESH,
- };
-
- /**
- * A public read-only list of all the '<em><b>Cascade Type</b></em>' enumerators.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final List<CascadeType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
-
- /**
- * Returns the '<em><b>Cascade Type</b></em>' literal with the specified literal value.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static CascadeType get(String literal) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
- CascadeType result = VALUES_ARRAY[i];
- if (result.toString().equals(literal)) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the '<em><b>Cascade Type</b></em>' literal with the specified name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static CascadeType getByName(String name) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
- CascadeType result = VALUES_ARRAY[i];
- if (result.getName().equals(name)) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the '<em><b>Cascade Type</b></em>' literal with the specified integer value.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static CascadeType get(int value) {
- switch (value) {
- case ALL_VALUE :
- return ALL;
- case PERSIST_VALUE :
- return PERSIST;
- case MERGE_VALUE :
- return MERGE;
- case REMOVE_VALUE :
- return REMOVE;
- case REFRESH_VALUE :
- return REFRESH;
- }
- return null;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final int value;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final String name;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final String literal;
-
- /**
- * Only this class can construct instances.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private CascadeType(int value, String name, String literal) {
- this.value = value;
- this.name = name;
- this.literal = literal;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public int getValue() {
- return value;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getLiteral() {
- return literal;
- }
-
- /**
- * Returns the literal value of the enumerator, which is its string representation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- return literal;
- }
-
- public static CascadeType[] fromJavaAnnotationValue(String[] javaAnnotationValues) {
- if (javaAnnotationValues == null) {
- return new CascadeType[0];
- }
- CascadeType[] cascadeTypes = new CascadeType[javaAnnotationValues.length];
- for (int i = 0; i < javaAnnotationValues.length; i++) {
- String javaAnnotationValue = javaAnnotationValues[i];
- if (javaAnnotationValue != null) {
- if (javaAnnotationValue.equals(JPA.CASCADE_TYPE__ALL)) {
- cascadeTypes[i] = ALL;
- }
- else if (javaAnnotationValue.equals(JPA.CASCADE_TYPE__PERSIST)) {
- cascadeTypes[i] = PERSIST;
- }
- else if (javaAnnotationValue.equals(JPA.CASCADE_TYPE__MERGE)) {
- cascadeTypes[i] = MERGE;
- }
- else if (javaAnnotationValue.equals(JPA.CASCADE_TYPE__REMOVE)) {
- cascadeTypes[i] = REMOVE;
- }
- else if (javaAnnotationValue.equals(JPA.CASCADE_TYPE__REFRESH)) {
- cascadeTypes[i] = REFRESH;
- }
- }
- }
- return cascadeTypes;
- }
-
- public static String[] toJavaAnnotationValue(CascadeType[] cascadeTypes) {
- String[] javaAnnotationValues = new String[cascadeTypes.length];
- for (int i = 0; i < cascadeTypes.length; i++) {
- CascadeType cascadeType = cascadeTypes[i];
- if (cascadeType == ALL) {
- javaAnnotationValues[i] = JPA.CASCADE_TYPE__ALL;
- }
- else if (cascadeType == PERSIST) {
- javaAnnotationValues[i] = JPA.CASCADE_TYPE__PERSIST;
- }
- else if (cascadeType == MERGE) {
- javaAnnotationValues[i] = JPA.CASCADE_TYPE__MERGE;
- }
- else if (cascadeType == REMOVE) {
- javaAnnotationValues[i] = JPA.CASCADE_TYPE__REMOVE;
- }
- else if (cascadeType == REFRESH) {
- javaAnnotationValues[i] = JPA.CASCADE_TYPE__REFRESH;
- }
- }
- return javaAnnotationValues;
- }
-} //CascadeType
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DefaultEagerFetchType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DefaultEagerFetchType.java
deleted file mode 100644
index 73c30ca367..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DefaultEagerFetchType.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.emf.common.util.Enumerator;
-import org.eclipse.jpt.core.internal.content.java.mappings.JPA;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the literals of the enumeration '<em><b>Default Eager Fetch Type</b></em>',
- * and utility methods for working with them.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getDefaultEagerFetchType()
- * @model
- * @generated
- */
-public enum DefaultEagerFetchType implements Enumerator {
- /**
- * The '<em><b>Default</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #DEFAULT_VALUE
- * @generated
- * @ordered
- */
- DEFAULT(0, "Default", "Default (Eager)"), /**
- * The '<em><b>EAGER</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #EAGER_VALUE
- * @generated
- * @ordered
- */
- EAGER(1, "EAGER", "Eager"), /**
- * The '<em><b>LAZY</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #LAZY_VALUE
- * @generated
- * @ordered
- */
- LAZY(2, "LAZY", "Lazy");
- /**
- * The '<em><b>Default</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>Default</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #DEFAULT
- * @model name="Default" literal="Default (Eager)"
- * @generated
- * @ordered
- */
- public static final int DEFAULT_VALUE = 0;
-
- /**
- * The '<em><b>EAGER</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>EAGER</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #EAGER
- * @model literal="Eager"
- * @generated
- * @ordered
- */
- public static final int EAGER_VALUE = 1;
-
- /**
- * The '<em><b>LAZY</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>LAZY</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #LAZY
- * @model literal="Lazy"
- * @generated
- * @ordered
- */
- public static final int LAZY_VALUE = 2;
-
- /**
- * An array of all the '<em><b>Default Eager Fetch Type</b></em>' enumerators.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static final DefaultEagerFetchType[] VALUES_ARRAY = new DefaultEagerFetchType[] {
- DEFAULT, EAGER, LAZY,
- };
-
- /**
- * A public read-only list of all the '<em><b>Default Eager Fetch Type</b></em>' enumerators.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final List<DefaultEagerFetchType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
-
- /**
- * Returns the '<em><b>Default Eager Fetch Type</b></em>' literal with the specified literal value.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static DefaultEagerFetchType get(String literal) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
- DefaultEagerFetchType result = VALUES_ARRAY[i];
- if (result.toString().equals(literal)) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the '<em><b>Default Eager Fetch Type</b></em>' literal with the specified name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static DefaultEagerFetchType getByName(String name) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
- DefaultEagerFetchType result = VALUES_ARRAY[i];
- if (result.getName().equals(name)) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the '<em><b>Default Eager Fetch Type</b></em>' literal with the specified integer value.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static DefaultEagerFetchType get(int value) {
- switch (value) {
- case DEFAULT_VALUE :
- return DEFAULT;
- case EAGER_VALUE :
- return EAGER;
- case LAZY_VALUE :
- return LAZY;
- }
- return null;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final int value;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final String name;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final String literal;
-
- /**
- * Only this class can construct instances.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private DefaultEagerFetchType(int value, String name, String literal) {
- this.value = value;
- this.name = name;
- this.literal = literal;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public int getValue() {
- return value;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getLiteral() {
- return literal;
- }
-
- /**
- * Returns the literal value of the enumerator, which is its string representation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- return literal;
- }
-
- public static DefaultEagerFetchType fromJavaAnnotationValue(Object javaAnnotationValue) {
- if (javaAnnotationValue == null) {
- return DEFAULT;
- }
- if (javaAnnotationValue.equals(JPA.FETCH_TYPE__EAGER)) {
- return EAGER;
- }
- if (javaAnnotationValue.equals(JPA.FETCH_TYPE__LAZY)) {
- return LAZY;
- }
- return DEFAULT;
- }
-
- public String convertToJavaAnnotationValue() {
- switch (this.getValue()) {
- case DEFAULT_VALUE :
- return null;
- case EAGER_VALUE :
- return JPA.FETCH_TYPE__EAGER;
- case LAZY_VALUE :
- return JPA.FETCH_TYPE__LAZY;
- default :
- throw new IllegalArgumentException("unknown fetch type: " + this);
- }
- }
-} //DefaultEagerFetchType
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DefaultFalseBoolean.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DefaultFalseBoolean.java
deleted file mode 100644
index e2e379b9e0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DefaultFalseBoolean.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.emf.common.util.Enumerator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the literals of the enumeration '<em><b>Default False Boolean</b></em>',
- * and utility methods for working with them.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getDefaultFalseBoolean()
- * @model
- * @generated
- */
-public enum DefaultFalseBoolean implements Enumerator {
- /**
- * The '<em><b>Default</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #DEFAULT_VALUE
- * @generated
- * @ordered
- */
- DEFAULT(0, "Default", "Default (False)"), /**
- * The '<em><b>False</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #FALSE_VALUE
- * @generated
- * @ordered
- */
- FALSE(1, "false", "False"), /**
- * The '<em><b>True</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #TRUE_VALUE
- * @generated
- * @ordered
- */
- TRUE(2, "true", "True");
- /**
- * The '<em><b>Default</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>Default</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #DEFAULT
- * @model name="Default" literal="Default (False)"
- * @generated
- * @ordered
- */
- public static final int DEFAULT_VALUE = 0;
-
- /**
- * The '<em><b>False</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>False</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #FALSE
- * @model name="false" literal="False"
- * @generated
- * @ordered
- */
- public static final int FALSE_VALUE = 1;
-
- /**
- * The '<em><b>True</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>True</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #TRUE
- * @model name="true" literal="True"
- * @generated
- * @ordered
- */
- public static final int TRUE_VALUE = 2;
-
- /**
- * An array of all the '<em><b>Default False Boolean</b></em>' enumerators.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static final DefaultFalseBoolean[] VALUES_ARRAY = new DefaultFalseBoolean[] {
- DEFAULT, FALSE, TRUE,
- };
-
- /**
- * A public read-only list of all the '<em><b>Default False Boolean</b></em>' enumerators.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final List<DefaultFalseBoolean> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
-
- /**
- * Returns the '<em><b>Default False Boolean</b></em>' literal with the specified literal value.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static DefaultFalseBoolean get(String literal) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
- DefaultFalseBoolean result = VALUES_ARRAY[i];
- if (result.toString().equals(literal)) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the '<em><b>Default False Boolean</b></em>' literal with the specified name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static DefaultFalseBoolean getByName(String name) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
- DefaultFalseBoolean result = VALUES_ARRAY[i];
- if (result.getName().equals(name)) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the '<em><b>Default False Boolean</b></em>' literal with the specified integer value.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static DefaultFalseBoolean get(int value) {
- switch (value) {
- case DEFAULT_VALUE :
- return DEFAULT;
- case FALSE_VALUE :
- return FALSE;
- case TRUE_VALUE :
- return TRUE;
- }
- return null;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final int value;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final String name;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final String literal;
-
- /**
- * Only this class can construct instances.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private DefaultFalseBoolean(int value, String name, String literal) {
- this.value = value;
- this.name = name;
- this.literal = literal;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public int getValue() {
- return value;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getLiteral() {
- return literal;
- }
-
- /**
- * Returns the literal value of the enumerator, which is its string representation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- return literal;
- }
-
- public static DefaultFalseBoolean fromJavaAnnotationValue(Object javaAnnotationValue) {
- if (javaAnnotationValue == null) {
- return DEFAULT;
- }
- if (javaAnnotationValue.equals("true")) {
- return TRUE;
- }
- if (javaAnnotationValue.equals("false")) {
- return FALSE;
- }
- return DEFAULT;
- }
-
- public String convertToJavaAnnotationValue() {
- switch (this.getValue()) {
- case DEFAULT_VALUE :
- return null;
- case TRUE_VALUE :
- return "true";
- case FALSE_VALUE :
- return "false";
- default :
- throw new IllegalArgumentException("unknown boolean type: " + this);
- }
- }
-} //DefaultFalseBoolean
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DefaultLazyFetchType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DefaultLazyFetchType.java
deleted file mode 100644
index 3c6961dd7a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DefaultLazyFetchType.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.emf.common.util.Enumerator;
-import org.eclipse.jpt.core.internal.content.java.mappings.JPA;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the literals of the enumeration '<em><b>Default Lazy Fetch Type</b></em>',
- * and utility methods for working with them.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getDefaultLazyFetchType()
- * @model
- * @generated
- */
-public enum DefaultLazyFetchType implements Enumerator {
- /**
- * The '<em><b>Default</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #DEFAULT_VALUE
- * @generated
- * @ordered
- */
- DEFAULT(0, "Default", "Default (Lazy)"), /**
- * The '<em><b>LAZY</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #LAZY_VALUE
- * @generated
- * @ordered
- */
- LAZY(1, "LAZY", "Lazy"), /**
- * The '<em><b>EAGER</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #EAGER_VALUE
- * @generated
- * @ordered
- */
- EAGER(2, "EAGER", "Eager");
- /**
- * The '<em><b>Default</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>Default</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #DEFAULT
- * @model name="Default" literal="Default (Lazy)"
- * @generated
- * @ordered
- */
- public static final int DEFAULT_VALUE = 0;
-
- /**
- * The '<em><b>LAZY</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>LAZY</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #LAZY
- * @model literal="Lazy"
- * @generated
- * @ordered
- */
- public static final int LAZY_VALUE = 1;
-
- /**
- * The '<em><b>EAGER</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>EAGER</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #EAGER
- * @model literal="Eager"
- * @generated
- * @ordered
- */
- public static final int EAGER_VALUE = 2;
-
- /**
- * An array of all the '<em><b>Default Lazy Fetch Type</b></em>' enumerators.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static final DefaultLazyFetchType[] VALUES_ARRAY = new DefaultLazyFetchType[] {
- DEFAULT, LAZY, EAGER,
- };
-
- /**
- * A public read-only list of all the '<em><b>Default Lazy Fetch Type</b></em>' enumerators.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final List<DefaultLazyFetchType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
-
- /**
- * Returns the '<em><b>Default Lazy Fetch Type</b></em>' literal with the specified literal value.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static DefaultLazyFetchType get(String literal) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
- DefaultLazyFetchType result = VALUES_ARRAY[i];
- if (result.toString().equals(literal)) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the '<em><b>Default Lazy Fetch Type</b></em>' literal with the specified name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static DefaultLazyFetchType getByName(String name) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
- DefaultLazyFetchType result = VALUES_ARRAY[i];
- if (result.getName().equals(name)) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the '<em><b>Default Lazy Fetch Type</b></em>' literal with the specified integer value.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static DefaultLazyFetchType get(int value) {
- switch (value) {
- case DEFAULT_VALUE :
- return DEFAULT;
- case LAZY_VALUE :
- return LAZY;
- case EAGER_VALUE :
- return EAGER;
- }
- return null;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final int value;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final String name;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final String literal;
-
- /**
- * Only this class can construct instances.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private DefaultLazyFetchType(int value, String name, String literal) {
- this.value = value;
- this.name = name;
- this.literal = literal;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public int getValue() {
- return value;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getLiteral() {
- return literal;
- }
-
- /**
- * Returns the literal value of the enumerator, which is its string representation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- return literal;
- }
-
- public static DefaultLazyFetchType fromJavaAnnotationValue(Object javaAnnotationValue) {
- if (javaAnnotationValue == null) {
- return DEFAULT;
- }
- if (javaAnnotationValue.equals(JPA.FETCH_TYPE__EAGER)) {
- return EAGER;
- }
- if (javaAnnotationValue.equals(JPA.FETCH_TYPE__LAZY)) {
- return LAZY;
- }
- return DEFAULT;
- }
-
- public String convertToJavaAnnotationValue() {
- switch (this.getValue()) {
- case DEFAULT_VALUE :
- return null;
- case EAGER_VALUE :
- return JPA.FETCH_TYPE__EAGER;
- case LAZY_VALUE :
- return JPA.FETCH_TYPE__LAZY;
- default :
- throw new IllegalArgumentException("unknown fetch type: " + this);
- }
- }
-} //DefaultLazyFetchType
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DefaultTrueBoolean.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DefaultTrueBoolean.java
deleted file mode 100644
index 7bd74d153d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DefaultTrueBoolean.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.emf.common.util.Enumerator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the literals of the enumeration '<em><b>Default True Boolean</b></em>',
- * and utility methods for working with them.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getDefaultTrueBoolean()
- * @model
- * @generated
- */
-public enum DefaultTrueBoolean implements Enumerator {
- /**
- * The '<em><b>Default</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #DEFAULT_VALUE
- * @generated
- * @ordered
- */
- DEFAULT(0, "Default", "Default (True)"), /**
- * The '<em><b>True</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #TRUE_VALUE
- * @generated
- * @ordered
- */
- TRUE(1, "true", "True"), /**
- * The '<em><b>False</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #FALSE_VALUE
- * @generated
- * @ordered
- */
- FALSE(2, "false", "False");
- /**
- * The '<em><b>Default</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>Default</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #DEFAULT
- * @model name="Default" literal="Default (True)"
- * @generated
- * @ordered
- */
- public static final int DEFAULT_VALUE = 0;
-
- /**
- * The '<em><b>True</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>True</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #TRUE
- * @model name="true" literal="True"
- * @generated
- * @ordered
- */
- public static final int TRUE_VALUE = 1;
-
- /**
- * The '<em><b>False</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>False</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #FALSE
- * @model name="false" literal="False"
- * @generated
- * @ordered
- */
- public static final int FALSE_VALUE = 2;
-
- /**
- * An array of all the '<em><b>Default True Boolean</b></em>' enumerators.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static final DefaultTrueBoolean[] VALUES_ARRAY = new DefaultTrueBoolean[] {
- DEFAULT, TRUE, FALSE,
- };
-
- /**
- * A public read-only list of all the '<em><b>Default True Boolean</b></em>' enumerators.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final List<DefaultTrueBoolean> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
-
- /**
- * Returns the '<em><b>Default True Boolean</b></em>' literal with the specified literal value.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static DefaultTrueBoolean get(String literal) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
- DefaultTrueBoolean result = VALUES_ARRAY[i];
- if (result.toString().equals(literal)) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the '<em><b>Default True Boolean</b></em>' literal with the specified name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static DefaultTrueBoolean getByName(String name) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
- DefaultTrueBoolean result = VALUES_ARRAY[i];
- if (result.getName().equals(name)) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the '<em><b>Default True Boolean</b></em>' literal with the specified integer value.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static DefaultTrueBoolean get(int value) {
- switch (value) {
- case DEFAULT_VALUE :
- return DEFAULT;
- case TRUE_VALUE :
- return TRUE;
- case FALSE_VALUE :
- return FALSE;
- }
- return null;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final int value;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final String name;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final String literal;
-
- /**
- * Only this class can construct instances.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private DefaultTrueBoolean(int value, String name, String literal) {
- this.value = value;
- this.name = name;
- this.literal = literal;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public int getValue() {
- return value;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getLiteral() {
- return literal;
- }
-
- /**
- * Returns the literal value of the enumerator, which is its string representation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- return literal;
- }
-
- public static DefaultTrueBoolean fromJavaAnnotationValue(Object javaAnnotationValue) {
- if (javaAnnotationValue == null) {
- return DEFAULT;
- }
- if (javaAnnotationValue.equals("true")) {
- return TRUE;
- }
- if (javaAnnotationValue.equals("false")) {
- return FALSE;
- }
- return DEFAULT;
- }
-
- public String convertToJavaAnnotationValue() {
- switch (this.getValue()) {
- case DEFAULT_VALUE :
- return null;
- case TRUE_VALUE :
- return "true";
- case FALSE_VALUE :
- return "false";
- default :
- throw new IllegalArgumentException("unknown boolean type: " + this);
- }
- }
-} //DefaultTrueBoolean
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAbstractColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAbstractColumn.java
deleted file mode 100644
index 12b37d5301..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAbstractColumn.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: IAbstractColumn.java,v 1.4 2007/05/11 19:33:48 kmoore Exp $
- */
-package org.eclipse.jpt.core.internal.mappings;
-
-import org.eclipse.jpt.core.internal.ITextRange;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IAbstract Column</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getUnique <em>Unique</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getNullable <em>Nullable</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getInsertable <em>Insertable</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getUpdatable <em>Updatable</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getTable <em>Table</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getSpecifiedTable <em>Specified Table</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getDefaultTable <em>Default Table</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAbstractColumn()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IAbstractColumn extends INamedColumn
-{
- /**
- * Returns the value of the '<em><b>Unique</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Unique</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Unique</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean
- * @see #setUnique(DefaultFalseBoolean)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAbstractColumn_Unique()
- * @model
- * @generated
- */
- DefaultFalseBoolean getUnique();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getUnique <em>Unique</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Unique</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean
- * @see #getUnique()
- * @generated
- */
- void setUnique(DefaultFalseBoolean value);
-
- /**
- * Returns the value of the '<em><b>Nullable</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Nullable</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Nullable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setNullable(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAbstractColumn_Nullable()
- * @model
- * @generated
- */
- DefaultTrueBoolean getNullable();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getNullable <em>Nullable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Nullable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getNullable()
- * @generated
- */
- void setNullable(DefaultTrueBoolean value);
-
- /**
- * Returns the value of the '<em><b>Insertable</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Insertable</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Insertable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setInsertable(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAbstractColumn_Insertable()
- * @model
- * @generated
- */
- DefaultTrueBoolean getInsertable();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getInsertable <em>Insertable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Insertable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getInsertable()
- * @generated
- */
- void setInsertable(DefaultTrueBoolean value);
-
- /**
- * Returns the value of the '<em><b>Updatable</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Updatable</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Updatable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setUpdatable(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAbstractColumn_Updatable()
- * @model
- * @generated
- */
- DefaultTrueBoolean getUpdatable();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getUpdatable <em>Updatable</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Updatable</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getUpdatable()
- * @generated
- */
- void setUpdatable(DefaultTrueBoolean value);
-
- /**
- * Returns the value of the '<em><b>Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAbstractColumn_Table()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- String getTable();
-
- /**
- * Returns the value of the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Table</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Table</em>' attribute.
- * @see #setSpecifiedTable(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAbstractColumn_SpecifiedTable()
- * @model
- * @generated
- */
- String getSpecifiedTable();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getSpecifiedTable <em>Specified Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Table</em>' attribute.
- * @see #getSpecifiedTable()
- * @generated
- */
- void setSpecifiedTable(String value);
-
- /**
- * Returns the value of the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Table</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Table</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAbstractColumn_DefaultTable()
- * @model changeable="false"
- * @generated
- */
- String getDefaultTable();
-
- /**
- * Return the (best guess) text location of the column's table.
- */
- ITextRange tableTextRange();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAbstractJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAbstractJoinColumn.java
deleted file mode 100644
index 7e989bb71d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAbstractJoinColumn.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id: IAbstractJoinColumn.java,v 1.10 2007/09/05 15:14:59 kmoore Exp $
- */
-package org.eclipse.jpt.core.internal.mappings;
-
-import java.util.List;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.db.internal.Column;
-import org.eclipse.jpt.db.internal.Table;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IAbstract Join Column</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn#getReferencedColumnName <em>Referenced Column Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn#getSpecifiedReferencedColumnName <em>Specified Referenced Column Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn#getDefaultReferencedColumnName <em>Default Referenced Column Name</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAbstractJoinColumn()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IAbstractJoinColumn extends INamedColumn
-{
- /**
- * Returns the value of the '<em><b>Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Referenced Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Referenced Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAbstractJoinColumn_ReferencedColumnName()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- String getReferencedColumnName();
-
- /**
- * Returns the value of the '<em><b>Specified Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Referenced Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Referenced Column Name</em>' attribute.
- * @see #setSpecifiedReferencedColumnName(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAbstractJoinColumn_SpecifiedReferencedColumnName()
- * @model
- * @generated
- */
- String getSpecifiedReferencedColumnName();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn#getSpecifiedReferencedColumnName <em>Specified Referenced Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Referenced Column Name</em>' attribute.
- * @see #getSpecifiedReferencedColumnName()
- * @generated
- */
- void setSpecifiedReferencedColumnName(String value);
-
- /**
- * Returns the value of the '<em><b>Default Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Referenced Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Referenced Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAbstractJoinColumn_DefaultReferencedColumnName()
- * @model changeable="false"
- * @generated
- */
- String getDefaultReferencedColumnName();
-
- void refreshDefaults(DefaultsContext defaultsContext);
-
- /**
- * Return the wrapper for the datasource referenced column
- */
- Column dbReferencedColumn();
-
- /**
- * Return whether the reference column is found on the datasource
- */
- boolean isReferencedColumnResolved();
-
- /**
- * Return the (best guess) text location of the referenced column name
- */
- ITextRange referencedColumnNameTextRange();
-
- /**
- * Re-declared to return IAbstractJoinColumn.Owner.
- */
- IAbstractJoinColumn.Owner getOwner();
-
- boolean isVirtual();
-
- interface Owner extends INamedColumn.Owner
- {
- /**
- * Return the wrapper for the datasource table for the referenced column
- */
- Table dbReferencedColumnTable();
-
- /**
- * return the list of join columns containing the join column
- */
- List<? extends IAbstractJoinColumn> joinColumns();
-
- int indexOf(IAbstractJoinColumn joinColumn);
-
- boolean isVirtual(IAbstractJoinColumn joinColumn);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAssociationOverride.java
deleted file mode 100644
index 8f1105df15..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAssociationOverride.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.mappings;
-
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.db.internal.Table;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IAssociation Override</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride#getJoinColumns <em>Join Columns</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride#getSpecifiedJoinColumns <em>Specified Join Columns</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride#getDefaultJoinColumns <em>Default Join Columns</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAssociationOverride()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IAssociationOverride extends IOverride
-{
- /**
- * Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAssociationOverride_JoinColumns()
- * @model containment="true" transient="true" changeable="false" volatile="true"
- * @generated
- */
- EList<IJoinColumn> getJoinColumns();
-
- /**
- * Returns the value of the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAssociationOverride_SpecifiedJoinColumns()
- * @model containment="true"
- * @generated
- */
- EList<IJoinColumn> getSpecifiedJoinColumns();
-
- /**
- * Returns the value of the '<em><b>Default Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAssociationOverride_DefaultJoinColumns()
- * @model containment="true"
- * @generated
- */
- EList<IJoinColumn> getDefaultJoinColumns();
-
- IJoinColumn createJoinColumn(int index);
-
- boolean containsSpecifiedJoinColumns();
-
- ITypeMapping typeMapping();
-
-
- public class JoinColumnOwner implements IJoinColumn.Owner
- {
- private IAssociationOverride associationOverride;
-
- public JoinColumnOwner(IAssociationOverride associationOverride) {
- super();
- this.associationOverride = associationOverride;
- }
-
- /**
- * by default, the join column is in the type mapping's primary table
- */
- public String defaultTableName() {
- return this.associationOverride.getOwner().getTypeMapping().getTableName();
- }
-
- public List<IJoinColumn> joinColumns() {
- return this.associationOverride.getJoinColumns();
- }
-
- public int indexOf(IAbstractJoinColumn joinColumn) {
- return joinColumns().indexOf(joinColumn);
- }
-
- public IEntity targetEntity() {
- return getRelationshipMapping().getResolvedTargetEntity();
- }
-
- public String attributeName() {
- return this.associationOverride.getName();
- }
-
- public IRelationshipMapping getRelationshipMapping() {
- //TODO cast or check instanceof first??
- return (IRelationshipMapping) this.associationOverride.getOwner().attributeMapping(this.associationOverride.getName());
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return getTypeMapping().tableNameIsInvalid(tableName);
- }
-
- /**
- * the join column can be on a secondary table
- */
- public boolean tableIsAllowed() {
- return true;
- }
-
- public ITextRange validationTextRange() {
- return this.associationOverride.validationTextRange();
- }
-
- public ITypeMapping getTypeMapping() {
- return this.associationOverride.getOwner().getTypeMapping();
- }
-
- public Table dbTable(String tableName) {
- return getTypeMapping().dbTable(tableName);
- }
-
- public Table dbReferencedColumnTable() {
- IEntity targetEntity = targetEntity();
- return (targetEntity == null) ? null : targetEntity().primaryDbTable();
- }
-
- public boolean isVirtual(IAbstractJoinColumn joinColumn) {
- return this.associationOverride.getDefaultJoinColumns().contains(joinColumn);
- }
-
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAttributeOverride.java
deleted file mode 100644
index 97e19b51a1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IAttributeOverride.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.mappings;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IAttribute Override</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride#getColumn <em>Column</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAttributeOverride()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IAttributeOverride extends IOverride, IColumnMapping
-{
- /**
- * Returns the value of the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAttributeOverride_Column()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- IColumn getColumn();
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ICascade.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ICascade.java
deleted file mode 100644
index a4437823dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ICascade.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.eclipse.jpt.core.internal.mappings;
-
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>ICascade</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ICascade#isAll <em>All</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ICascade#isPersist <em>Persist</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ICascade#isMerge <em>Merge</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ICascade#isRemove <em>Remove</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ICascade#isRefresh <em>Refresh</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getICascade()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface ICascade extends IJpaSourceObject
-{
- /**
- * Returns the value of the '<em><b>All</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>All</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>All</em>' attribute.
- * @see #setAll(boolean)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getICascade_All()
- * @model
- * @generated
- */
- boolean isAll();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ICascade#isAll <em>All</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>All</em>' attribute.
- * @see #isAll()
- * @generated
- */
- void setAll(boolean value);
-
- /**
- * Returns the value of the '<em><b>Persist</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Persist</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Persist</em>' attribute.
- * @see #setPersist(boolean)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getICascade_Persist()
- * @model
- * @generated
- */
- boolean isPersist();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ICascade#isPersist <em>Persist</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Persist</em>' attribute.
- * @see #isPersist()
- * @generated
- */
- void setPersist(boolean value);
-
- /**
- * Returns the value of the '<em><b>Merge</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Merge</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Merge</em>' attribute.
- * @see #setMerge(boolean)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getICascade_Merge()
- * @model
- * @generated
- */
- boolean isMerge();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ICascade#isMerge <em>Merge</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Merge</em>' attribute.
- * @see #isMerge()
- * @generated
- */
- void setMerge(boolean value);
-
- /**
- * Returns the value of the '<em><b>Remove</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Remove</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Remove</em>' attribute.
- * @see #setRemove(boolean)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getICascade_Remove()
- * @model
- * @generated
- */
- boolean isRemove();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ICascade#isRemove <em>Remove</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Remove</em>' attribute.
- * @see #isRemove()
- * @generated
- */
- void setRemove(boolean value);
-
- /**
- * Returns the value of the '<em><b>Refresh</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Refresh</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Refresh</em>' attribute.
- * @see #setRefresh(boolean)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getICascade_Refresh()
- * @model
- * @generated
- */
- boolean isRefresh();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ICascade#isRefresh <em>Refresh</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Refresh</em>' attribute.
- * @see #isRefresh()
- * @generated
- */
- void setRefresh(boolean value);
-} // ICascade
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IColumn.java
deleted file mode 100644
index 9abbc8f498..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IColumn.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IColumn</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IColumn#getLength <em>Length</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IColumn#getSpecifiedLength <em>Specified Length</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IColumn#getPrecision <em>Precision</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IColumn#getSpecifiedPrecision <em>Specified Precision</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IColumn#getScale <em>Scale</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IColumn#getSpecifiedScale <em>Specified Scale</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIColumn()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IColumn extends IAbstractColumn
-{
- int DEFAULT_LENGTH = 255;
-
- int DEFAULT_PRECISION = 0;
-
- int DEFAULT_SCALE = 0;
-
- /**
- * Returns the value of the '<em><b>Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Length</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Length</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIColumn_Length()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- int getLength();
-
- /**
- * Returns the value of the '<em><b>Specified Length</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Length</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Length</em>' attribute.
- * @see #setSpecifiedLength(int)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIColumn_SpecifiedLength()
- * @model default="-1"
- * @generated
- */
- int getSpecifiedLength();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IColumn#getSpecifiedLength <em>Specified Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Length</em>' attribute.
- * @see #getSpecifiedLength()
- * @generated
- */
- void setSpecifiedLength(int value);
-
- /**
- * Returns the value of the '<em><b>Precision</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Precision</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Precision</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIColumn_Precision()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- int getPrecision();
-
- /**
- * Returns the value of the '<em><b>Specified Precision</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Precision</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Precision</em>' attribute.
- * @see #setSpecifiedPrecision(int)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIColumn_SpecifiedPrecision()
- * @model default="-1"
- * @generated
- */
- int getSpecifiedPrecision();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IColumn#getSpecifiedPrecision <em>Specified Precision</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Precision</em>' attribute.
- * @see #getSpecifiedPrecision()
- * @generated
- */
- void setSpecifiedPrecision(int value);
-
- /**
- * Returns the value of the '<em><b>Scale</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Scale</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Scale</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIColumn_Scale()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- int getScale();
-
- /**
- * Returns the value of the '<em><b>Specified Scale</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Scale</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Scale</em>' attribute.
- * @see #setSpecifiedScale(int)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIColumn_SpecifiedScale()
- * @model default="-1"
- * @generated
- */
- int getSpecifiedScale();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IColumn#getSpecifiedScale <em>Specified Scale</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Scale</em>' attribute.
- * @see #getSpecifiedScale()
- * @generated
- */
- void setSpecifiedScale(int value);
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation"
- * @generated
- */
- int getDefaultLength();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation"
- * @generated
- */
- int getDefaultPrecision();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation"
- * @generated
- */
- int getDefaultScale();
-
- void refreshDefaults(DefaultsContext defaultsContext);
-
- /**
- * Return whether the column is found on the datasource
- */
- boolean isResolved();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IColumnMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IColumnMapping.java
deleted file mode 100644
index 2ac84a01b3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IColumnMapping.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IColumn Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIColumnMapping()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IColumnMapping extends EObject
-{
- /**
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @model kind="operation"
- * @generated
- */
- IColumn getColumn();
-} // IColumnMapping
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IDiscriminatorColumn.java
deleted file mode 100644
index ceef08d4f0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IDiscriminatorColumn.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 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.mappings;
-
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.db.internal.Table;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IDiscriminator Column</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn#getDiscriminatorType <em>Discriminator Type</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn#getDefaultLength <em>Default Length</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn#getSpecifiedLength <em>Specified Length</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn#getLength <em>Length</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIDiscriminatorColumn()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IDiscriminatorColumn extends INamedColumn
-{
- /**
- * Returns the value of the '<em><b>Discriminator Type</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DiscriminatorType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Discriminator Type</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Discriminator Type</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DiscriminatorType
- * @see #setDiscriminatorType(DiscriminatorType)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIDiscriminatorColumn_DiscriminatorType()
- * @model
- * @generated
- */
- DiscriminatorType getDiscriminatorType();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn#getDiscriminatorType <em>Discriminator Type</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Discriminator Type</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DiscriminatorType
- * @see #getDiscriminatorType()
- * @generated
- */
- void setDiscriminatorType(DiscriminatorType value);
-
- /**
- * Returns the value of the '<em><b>Default Length</b></em>' attribute.
- * The default value is <code>"31"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Length</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Length</em>' attribute.
- * @see #setDefaultLength(int)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIDiscriminatorColumn_DefaultLength()
- * @model default="31"
- * @generated
- */
- int getDefaultLength();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn#getDefaultLength <em>Default Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Default Length</em>' attribute.
- * @see #getDefaultLength()
- * @generated
- */
- void setDefaultLength(int value);
-
- /**
- * Returns the value of the '<em><b>Specified Length</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Length</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Length</em>' attribute.
- * @see #setSpecifiedLength(int)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIDiscriminatorColumn_SpecifiedLength()
- * @model default="-1"
- * @generated
- */
- int getSpecifiedLength();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn#getSpecifiedLength <em>Specified Length</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Length</em>' attribute.
- * @see #getSpecifiedLength()
- * @generated
- */
- void setSpecifiedLength(int value);
-
- /**
- * Returns the value of the '<em><b>Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Length</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Length</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIDiscriminatorColumn_Length()
- * @model transient="true" changeable="false" volatile="true" derived="true"
- * @generated
- */
- int getLength();
-
-
- class Owner implements INamedColumn.Owner
- {
- private IEntity entity;
-
- public Owner(IEntity entity) {
- super();
- this.entity = entity;
- }
-
- public Table dbTable(String tableName) {
- return this.entity.dbTable(tableName);
- }
-
- public ITextRange validationTextRange() {
- return this.entity.getDiscriminatorColumn().validationTextRange();
- }
-
- public ITypeMapping getTypeMapping() {
- return this.entity;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEmbeddable.java
deleted file mode 100644
index dad0ff9044..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEmbeddable.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-import org.eclipse.jpt.core.internal.ITypeMapping;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Embeddable</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEmbeddable()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IEmbeddable extends ITypeMapping
-{} // Embeddable
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEmbedded.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEmbedded.java
deleted file mode 100644
index d639388b72..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEmbedded.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.mappings.IOverride.Owner;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IEmbedded</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEmbedded#getAttributeOverrides <em>Attribute Overrides</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEmbedded#getSpecifiedAttributeOverrides <em>Specified Attribute Overrides</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEmbedded#getDefaultAttributeOverrides <em>Default Attribute Overrides</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEmbedded()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IEmbedded extends IAttributeMapping
-{
- /**
- * Returns the value of the '<em><b>Attribute Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Attribute Overrides</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Attribute Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEmbedded_AttributeOverrides()
- * @model containment="true" transient="true" changeable="false" volatile="true"
- * @generated
- */
- EList<IAttributeOverride> getAttributeOverrides();
-
- /**
- * Returns the value of the '<em><b>Specified Attribute Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Attribute Overrides</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Attribute Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEmbedded_SpecifiedAttributeOverrides()
- * @model containment="true"
- * @generated
- */
- EList<IAttributeOverride> getSpecifiedAttributeOverrides();
-
- /**
- * Returns the value of the '<em><b>Default Attribute Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Attribute Overrides</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Attribute Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEmbedded_DefaultAttributeOverrides()
- * @model containment="true"
- * @generated
- */
- EList<IAttributeOverride> getDefaultAttributeOverrides();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated
- */
- IEmbeddable embeddable();
-
- IAttributeOverride createAttributeOverride(int index);
-
- Iterator<String> allOverridableAttributeNames();
-
- IAttributeOverride attributeOverrideNamed(String name);
-
- boolean containsAttributeOverride(String name);
-
- boolean containsSpecifiedAttributeOverride(String name);
-
-
- class AttributeOverrideOwner implements Owner
- {
- private IEmbedded embedded;
-
- public AttributeOverrideOwner(IEmbedded embedded) {
- this.embedded = embedded;
- }
-
- public ITypeMapping getTypeMapping() {
- return this.embedded.typeMapping();
- }
-
- public IAttributeMapping attributeMapping(String attributeName) {
- return (IAttributeMapping) columnMapping(attributeName);
- }
-
- private IColumnMapping columnMapping(String name) {
- IEmbeddable embeddable = this.embedded.embeddable();
- if (embeddable != null) {
- for (Iterator<IPersistentAttribute> stream = embeddable.getPersistentType().allAttributes(); stream.hasNext();) {
- IPersistentAttribute persAttribute = stream.next();
- if (persAttribute.getName().equals(name)) {
- if (persAttribute.getMapping() instanceof IColumnMapping) {
- return (IColumnMapping) persAttribute.getMapping();
- }
- }
- }
- }
- return null;
- }
-
- public boolean isVirtual(IOverride override) {
- return embedded.getDefaultAttributeOverrides().contains(override);
- }
-
- public ITextRange validationTextRange() {
- return embedded.validationTextRange();
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEmbeddedId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEmbeddedId.java
deleted file mode 100644
index d2e1f082db..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEmbeddedId.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.mappings;
-
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IEmbedded Id</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEmbeddedId()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IEmbeddedId extends IAttributeMapping
-{} // IEmbeddedId
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEntity.java
deleted file mode 100644
index efb788063c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IEntity.java
+++ /dev/null
@@ -1,694 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.db.internal.Table;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Entity</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedName <em>Specified Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getDefaultName <em>Default Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getTable <em>Table</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedSecondaryTables <em>Specified Secondary Tables</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getPrimaryKeyJoinColumns <em>Primary Key Join Columns</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedPrimaryKeyJoinColumns <em>Specified Primary Key Join Columns</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getDefaultPrimaryKeyJoinColumns <em>Default Primary Key Join Columns</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getInheritanceStrategy <em>Inheritance Strategy</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getDefaultDiscriminatorValue <em>Default Discriminator Value</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedDiscriminatorValue <em>Specified Discriminator Value</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getDiscriminatorValue <em>Discriminator Value</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getDiscriminatorColumn <em>Discriminator Column</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSequenceGenerator <em>Sequence Generator</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getTableGenerator <em>Table Generator</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getAttributeOverrides <em>Attribute Overrides</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedAttributeOverrides <em>Specified Attribute Overrides</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getDefaultAttributeOverrides <em>Default Attribute Overrides</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getAssociationOverrides <em>Association Overrides</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedAssociationOverrides <em>Specified Association Overrides</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getDefaultAssociationOverrides <em>Default Association Overrides</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getNamedQueries <em>Named Queries</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getNamedNativeQueries <em>Named Native Queries</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IEntity#getIdClass <em>Id Class</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IEntity extends ITypeMapping
-{
- /**
- * Returns the value of the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Name</em>' attribute.
- * @see #setSpecifiedName(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_SpecifiedName()
- * @model
- * @generated
- */
- String getSpecifiedName();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedName <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Name</em>' attribute.
- * @see #getSpecifiedName()
- * @generated
- */
- void setSpecifiedName(String value);
-
- /**
- * Returns the value of the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_DefaultName()
- * @model changeable="false"
- * @generated
- */
- String getDefaultName();
-
- /**
- * Returns the value of the '<em><b>Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_Table()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- ITable getTable();
-
- /**
- * Returns the value of the '<em><b>Specified Secondary Tables</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Secondary Tables</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Secondary Tables</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_SpecifiedSecondaryTables()
- * @model containment="true"
- * @generated
- */
- EList<ISecondaryTable> getSpecifiedSecondaryTables();
-
- /**
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Secondary Tables</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @model kind="operation"
- * @generated
- */
- EList<ISecondaryTable> getSecondaryTables();
-
- /**
- * Returns the value of the '<em><b>Inheritance Strategy</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.InheritanceType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Inheritance Strategy</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Inheritance Strategy</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.InheritanceType
- * @see #setInheritanceStrategy(InheritanceType)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_InheritanceStrategy()
- * @model
- * @generated
- */
- InheritanceType getInheritanceStrategy();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getInheritanceStrategy <em>Inheritance Strategy</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Inheritance Strategy</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.InheritanceType
- * @see #getInheritanceStrategy()
- * @generated
- */
- void setInheritanceStrategy(InheritanceType value);
-
- /**
- * Returns the value of the '<em><b>Discriminator Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Discriminator Column</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Discriminator Column</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_DiscriminatorColumn()
- * @model containment="true" changeable="false"
- * @generated
- */
- IDiscriminatorColumn getDiscriminatorColumn();
-
- /**
- * Returns the value of the '<em><b>Sequence Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Sequence Generator</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Sequence Generator</em>' containment reference.
- * @see #setSequenceGenerator(ISequenceGenerator)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_SequenceGenerator()
- * @model containment="true"
- * @generated
- */
- ISequenceGenerator getSequenceGenerator();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSequenceGenerator <em>Sequence Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Sequence Generator</em>' containment reference.
- * @see #getSequenceGenerator()
- * @generated
- */
- void setSequenceGenerator(ISequenceGenerator value);
-
- /**
- * Returns the value of the '<em><b>Table Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table Generator</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table Generator</em>' containment reference.
- * @see #setTableGenerator(ITableGenerator)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_TableGenerator()
- * @model containment="true"
- * @generated
- */
- ITableGenerator getTableGenerator();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getTableGenerator <em>Table Generator</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Table Generator</em>' containment reference.
- * @see #getTableGenerator()
- * @generated
- */
- void setTableGenerator(ITableGenerator value);
-
- /**
- * Returns the value of the '<em><b>Default Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Discriminator Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Discriminator Value</em>' attribute.
- * @see #setDefaultDiscriminatorValue(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_DefaultDiscriminatorValue()
- * @model
- * @generated
- */
- String getDefaultDiscriminatorValue();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getDefaultDiscriminatorValue <em>Default Discriminator Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Default Discriminator Value</em>' attribute.
- * @see #getDefaultDiscriminatorValue()
- * @generated
- */
- void setDefaultDiscriminatorValue(String value);
-
- /**
- * Returns the value of the '<em><b>Specified Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Discriminator Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Discriminator Value</em>' attribute.
- * @see #setSpecifiedDiscriminatorValue(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_SpecifiedDiscriminatorValue()
- * @model
- * @generated
- */
- String getSpecifiedDiscriminatorValue();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedDiscriminatorValue <em>Specified Discriminator Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Discriminator Value</em>' attribute.
- * @see #getSpecifiedDiscriminatorValue()
- * @generated
- */
- void setSpecifiedDiscriminatorValue(String value);
-
- /**
- * Returns the value of the '<em><b>Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Discriminator Value</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Discriminator Value</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_DiscriminatorValue()
- * @model transient="true" changeable="false" volatile="true" derived="true"
- * @generated
- */
- String getDiscriminatorValue();
-
- /**
- * Returns the value of the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Primary Key Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Primary Key Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_PrimaryKeyJoinColumns()
- * @model containment="true" transient="true" changeable="false" volatile="true"
- * @generated
- */
- EList<IPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns();
-
- /**
- * Returns the value of the '<em><b>Specified Primary Key Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Primary Key Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Primary Key Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_SpecifiedPrimaryKeyJoinColumns()
- * @model containment="true"
- * @generated
- */
- EList<IPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns();
-
- /**
- * Returns the value of the '<em><b>Default Primary Key Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Primary Key Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Primary Key Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_DefaultPrimaryKeyJoinColumns()
- * @model containment="true"
- * @generated
- */
- EList<IPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns();
-
- /**
- * Returns the value of the '<em><b>Attribute Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Attribute Overrides</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Attribute Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_AttributeOverrides()
- * @model containment="true" transient="true" changeable="false" volatile="true"
- * @generated
- */
- EList<IAttributeOverride> getAttributeOverrides();
-
- /**
- * Returns the value of the '<em><b>Specified Attribute Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Attribute Overrides</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Attribute Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_SpecifiedAttributeOverrides()
- * @model containment="true"
- * @generated
- */
- EList<IAttributeOverride> getSpecifiedAttributeOverrides();
-
- /**
- * Returns the value of the '<em><b>Default Attribute Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Attribute Overrides</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Attribute Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_DefaultAttributeOverrides()
- * @model containment="true"
- * @generated
- */
- EList<IAttributeOverride> getDefaultAttributeOverrides();
-
- /**
- * Returns the value of the '<em><b>Association Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Association Overrides</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Association Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_AssociationOverrides()
- * @model containment="true" transient="true" changeable="false" volatile="true"
- * @generated
- */
- EList<IAssociationOverride> getAssociationOverrides();
-
- /**
- * Returns the value of the '<em><b>Specified Association Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Association Overrides</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Association Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_SpecifiedAssociationOverrides()
- * @model containment="true"
- * @generated
- */
- EList<IAssociationOverride> getSpecifiedAssociationOverrides();
-
- /**
- * Returns the value of the '<em><b>Default Association Overrides</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Association Overrides</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Association Overrides</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_DefaultAssociationOverrides()
- * @model containment="true"
- * @generated
- */
- EList<IAssociationOverride> getDefaultAssociationOverrides();
-
- /**
- * Returns the value of the '<em><b>Named Queries</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.INamedQuery}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Named Queries</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Named Queries</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_NamedQueries()
- * @model containment="true"
- * @generated
- */
- EList<INamedQuery> getNamedQueries();
-
- /**
- * Returns the value of the '<em><b>Named Native Queries</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.INamedNativeQuery}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Named Native Queries</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Named Native Queries</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_NamedNativeQueries()
- * @model containment="true"
- * @generated
- */
- EList<INamedNativeQuery> getNamedNativeQueries();
-
- /**
- * Returns the value of the '<em><b>Id Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Id Class</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Id Class</em>' attribute.
- * @see #setIdClass(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity_IdClass()
- * @model
- * @generated
- */
- String getIdClass();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getIdClass <em>Id Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Id Class</em>' attribute.
- * @see #getIdClass()
- * @generated
- */
- void setIdClass(String value);
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated
- */
- boolean discriminatorValueIsAllowed();
-
- /**
- * Return the ultimate top of the inheritance hierarchy
- * This method should never return null. The root
- * is defined as the persistent type in the inheritance hierarchy
- * that has no parent. The root should be an entity
- *
- * Non-entities in the hierarchy should be ignored, ie skip
- * over them in the search for the root.
- *
- * @model
- * @generated
- */
- IEntity rootEntity();
-
- /**
- * <!-- begin-user-doc -->
- * The first parent in the class hierarchy that is an entity.
- * This is the parent in the entity (persistent) inheritance hierarchy
- * (vs class inheritance hierarchy)
- * <!-- end-user-doc -->
- * @model
- * @generated
- */
- IEntity parentEntity();
-
- /**
- * Return the name of the entity's primary key column.
- * Return null if the entity's primary key is "compound"
- * (i.e. the primary key is composed of multiple columns).
- */
- String primaryKeyColumnName();
-
- /**
- * Return the name of the entity's primary key attribute.
- * Return null if the entity's primary key is "compound"
- * (i.e. the primary key is composed of multiple columns).
- */
- String primaryKeyAttributeName();
-
- IAttributeOverride createAttributeOverride(int index);
-
- IAssociationOverride createAssociationOverride(int index);
-
- IAttributeOverride attributeOverrideNamed(String name);
-
- boolean containsAttributeOverride(String name);
-
- boolean containsSpecifiedAttributeOverride(String name);
-
- boolean containsAssociationOverride(String name);
-
- boolean containsSpecifiedAssociationOverride(String name);
-
- boolean containsSecondaryTable(String name);
-
- boolean containsSpecifiedSecondaryTable(String name);
-
- ISecondaryTable createSecondaryTable(int index);
-
- boolean containsSpecifiedPrimaryKeyJoinColumns();
-
- IPrimaryKeyJoinColumn createPrimaryKeyJoinColumn(int index);
-
- INamedQuery createNamedQuery(int index);
-
- INamedNativeQuery createNamedNativeQuery(int index);
-
-
- abstract class OverrideOwner implements IOverride.Owner
- {
- protected IEntity entity;
-
- public OverrideOwner(IEntity entity) {
- this.entity = entity;
- }
-
- public ITypeMapping getTypeMapping() {
- return this.entity;
- }
-
- public ITextRange validationTextRange() {
- return entity.validationTextRange();
- }
- }
-
-
- class AttributeOverrideOwner extends OverrideOwner
- {
- public AttributeOverrideOwner(IEntity entity) {
- super(entity);
- }
-
- public IAttributeMapping attributeMapping(String attributeName) {
- return (IAttributeMapping) columnMapping(attributeName);
- }
-
- private IColumnMapping columnMapping(String attributeName) {
- if (attributeName == null) {
- return null;
- }
- for (Iterator<IPersistentAttribute> stream = this.entity.getPersistentType().allAttributes(); stream.hasNext();) {
- IPersistentAttribute persAttribute = stream.next();
- if (attributeName.equals(persAttribute.getName())) {
- if (persAttribute.getMapping() instanceof IColumnMapping) {
- return (IColumnMapping) persAttribute.getMapping();
- }
- }
- }
- return null;
- }
-
- public boolean isVirtual(IOverride override) {
- return entity.getDefaultAttributeOverrides().contains(override);
- }
- }
-
-
- class AssociationOverrideOwner extends OverrideOwner
- {
- public AssociationOverrideOwner(IEntity entity) {
- super(entity);
- }
-
- public IAttributeMapping attributeMapping(String attributeName) {
- for (Iterator<IPersistentAttribute> stream = this.entity.getPersistentType().allAttributes(); stream.hasNext();) {
- IPersistentAttribute persAttribute = stream.next();
- if (attributeName.equals(persAttribute.getName())) {
- return persAttribute.getMapping();
- }
- }
- return null;
- }
-
- public boolean isVirtual(IOverride override) {
- return entity.getDefaultAssociationOverrides().contains(override);
- }
- }
-
-
- class PrimaryKeyJoinColumnOwner implements IAbstractJoinColumn.Owner
- {
- private IEntity entity;
-
- public PrimaryKeyJoinColumnOwner(IEntity entity) {
- this.entity = entity;
- }
-
- public ITextRange validationTextRange() {
- return this.entity.validationTextRange();
- }
-
- public ITypeMapping getTypeMapping() {
- return this.entity;
- }
-
- public Table dbTable(String tableName) {
- return this.entity.dbTable(tableName);
- }
-
- public Table dbReferencedColumnTable() {
- IEntity parentEntity = this.entity.parentEntity();
- return (parentEntity == null) ? null : parentEntity.primaryDbTable();
- }
-
- public List<IPrimaryKeyJoinColumn> joinColumns() {
- return this.entity.getPrimaryKeyJoinColumns();
- }
-
- public boolean isVirtual(IAbstractJoinColumn joinColumn) {
- return this.entity.getDefaultPrimaryKeyJoinColumns().contains(joinColumn);
- }
-
- public int indexOf(IAbstractJoinColumn joinColumn) {
- return joinColumns().indexOf(joinColumn);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IGenerator.java
deleted file mode 100644
index 07c74de367..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IGenerator.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.mappings;
-
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IGenerator</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getName <em>Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getInitialValue <em>Initial Value</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getSpecifiedInitialValue <em>Specified Initial Value</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getDefaultInitialValue <em>Default Initial Value</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getAllocationSize <em>Allocation Size</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getSpecifiedAllocationSize <em>Specified Allocation Size</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getDefaultAllocationSize <em>Default Allocation Size</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIGenerator()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IGenerator extends IJpaSourceObject
-{
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see #setName(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIGenerator_Name()
- * @model
- * @generated
- */
- String getName();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getName <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Name</em>' attribute.
- * @see #getName()
- * @generated
- */
- void setName(String value);
-
- /**
- * Returns the value of the '<em><b>Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Initial Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Initial Value</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIGenerator_InitialValue()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- int getInitialValue();
-
- /**
- * Returns the value of the '<em><b>Specified Initial Value</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Initial Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Initial Value</em>' attribute.
- * @see #setSpecifiedInitialValue(int)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIGenerator_SpecifiedInitialValue()
- * @model default="-1"
- * @generated
- */
- int getSpecifiedInitialValue();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getSpecifiedInitialValue <em>Specified Initial Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Initial Value</em>' attribute.
- * @see #getSpecifiedInitialValue()
- * @generated
- */
- void setSpecifiedInitialValue(int value);
-
- /**
- * Returns the value of the '<em><b>Default Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Initial Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Initial Value</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIGenerator_DefaultInitialValue()
- * @model changeable="false"
- * @generated
- */
- int getDefaultInitialValue();
-
- /**
- * Returns the value of the '<em><b>Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Allocation Size</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Allocation Size</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIGenerator_AllocationSize()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- int getAllocationSize();
-
- /**
- * Returns the value of the '<em><b>Specified Allocation Size</b></em>' attribute.
- * The default value is <code>"-1"</code>.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Allocation Size</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Allocation Size</em>' attribute.
- * @see #setSpecifiedAllocationSize(int)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIGenerator_SpecifiedAllocationSize()
- * @model default="-1"
- * @generated
- */
- int getSpecifiedAllocationSize();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getSpecifiedAllocationSize <em>Specified Allocation Size</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Allocation Size</em>' attribute.
- * @see #getSpecifiedAllocationSize()
- * @generated
- */
- void setSpecifiedAllocationSize(int value);
-
- /**
- * Returns the value of the '<em><b>Default Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Allocation Size</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Allocation Size</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIGenerator_DefaultAllocationSize()
- * @model changeable="false"
- * @generated
- */
- int getDefaultAllocationSize();
-} // IGenerator
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IJoinTable.java
deleted file mode 100644
index a89d7e912e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IJoinTable.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.mappings;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.db.internal.Table;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IJoin Table</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IJoinTable#getJoinColumns <em>Join Columns</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IJoinTable#getSpecifiedJoinColumns <em>Specified Join Columns</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IJoinTable#getDefaultJoinColumns <em>Default Join Columns</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IJoinTable#getInverseJoinColumns <em>Inverse Join Columns</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IJoinTable#getSpecifiedInverseJoinColumns <em>Specified Inverse Join Columns</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IJoinTable#getDefaultInverseJoinColumns <em>Default Inverse Join Columns</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIJoinTable()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IJoinTable extends ITable
-{
- /**
- * Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIJoinTable_JoinColumns()
- * @model containment="true" transient="true" changeable="false" volatile="true"
- * @generated
- */
- EList<IJoinColumn> getJoinColumns();
-
- /**
- * Returns the value of the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIJoinTable_SpecifiedJoinColumns()
- * @model containment="true"
- * @generated
- */
- EList<IJoinColumn> getSpecifiedJoinColumns();
-
- /**
- * Returns the value of the '<em><b>Default Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIJoinTable_DefaultJoinColumns()
- * @model containment="true"
- * @generated
- */
- EList<IJoinColumn> getDefaultJoinColumns();
-
- /**
- * Returns the value of the '<em><b>Inverse Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Inverse Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Inverse Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIJoinTable_InverseJoinColumns()
- * @model containment="true" transient="true" changeable="false" volatile="true"
- * @generated
- */
- EList<IJoinColumn> getInverseJoinColumns();
-
- /**
- * Returns the value of the '<em><b>Specified Inverse Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Inverse Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Inverse Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIJoinTable_SpecifiedInverseJoinColumns()
- * @model containment="true"
- * @generated
- */
- EList<IJoinColumn> getSpecifiedInverseJoinColumns();
-
- /**
- * Returns the value of the '<em><b>Default Inverse Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Inverse Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Inverse Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIJoinTable_DefaultInverseJoinColumns()
- * @model containment="true"
- * @generated
- */
- EList<IJoinColumn> getDefaultInverseJoinColumns();
-
- IJoinColumn createJoinColumn(int index);
-
- IJoinColumn createInverseJoinColumn(int index);
-
- boolean containsSpecifiedJoinColumns();
-
- boolean containsSpecifiedInverseJoinColumns();
-
- IRelationshipMapping relationshipMapping();
-
-
- /**
- * just a little common behavior
- */
- abstract class AbstractJoinColumnOwner implements IJoinColumn.Owner
- {
- private final IJoinTable joinTable;
-
- AbstractJoinColumnOwner(IJoinTable joinTable) {
- super();
- this.joinTable = joinTable;
- }
-
- protected IJoinTable getJoinTable() {
- return this.joinTable;
- }
-
- public IRelationshipMapping getRelationshipMapping() {
- return this.joinTable.relationshipMapping();
- }
-
- /**
- * the default table name is always valid and a specified table name
- * is prohibited (which will be handled elsewhere)
- */
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
- /**
- * the join column can only be on the join table itself
- */
- public boolean tableIsAllowed() {
- return false;
- }
-
- public ITextRange validationTextRange() {
- return this.joinTable.validationTextRange();
- }
-
- public ITypeMapping getTypeMapping() {
- return this.joinTable.getOwner().getTypeMapping();
- }
-
- public Table dbTable(String tableName) {
- if (this.joinTable.getName() == null) {
- return null;
- }
- return (this.joinTable.getName().equals(tableName)) ? this.joinTable.dbTable() : null;
- }
- }
-
-
- /**
- * owner for "forward-pointer" JoinColumns;
- * these point at the target/inverse entity
- */
- class InverseJoinColumnOwner extends AbstractJoinColumnOwner
- {
- public InverseJoinColumnOwner(IJoinTable joinTable) {
- super(joinTable);
- }
-
- public List<IJoinColumn> joinColumns() {
- return getJoinTable().getInverseJoinColumns();
- }
-
- public int indexOf(IAbstractJoinColumn joinColumn) {
- return joinColumns().indexOf(joinColumn);
- }
-
- public IEntity targetEntity() {
- return getJoinTable().relationshipMapping().getResolvedTargetEntity();
- }
-
- public String attributeName() {
- return getJoinTable().relationshipMapping().getPersistentAttribute().getName();
- }
-
- @Override
- public Table dbTable(String tableName) {
- Table dbTable = super.dbTable(tableName);
- if (dbTable != null) {
- return dbTable;
- }
- IEntity targetEntity = targetEntity();
- return (targetEntity == null) ? null : targetEntity.dbTable(tableName);
- }
-
- public Table dbReferencedColumnTable() {
- IEntity targetEntity = targetEntity();
- return (targetEntity == null) ? null : targetEntity.primaryDbTable();
- }
-
- public boolean isVirtual(IAbstractJoinColumn joinColumn) {
- return getJoinTable().getDefaultInverseJoinColumns().contains(joinColumn);
- }
- }
-
-
- /**
- * owner for "back-pointer" JoinColumns;
- * these point at the source/owning entity
- */
- class JoinColumnOwner extends AbstractJoinColumnOwner
- {
- public JoinColumnOwner(IJoinTable joinTable) {
- super(joinTable);
- }
-
- public List<IJoinColumn> joinColumns() {
- return getJoinTable().getJoinColumns();
- }
-
- public int indexOf(IAbstractJoinColumn joinColumn) {
- return joinColumns().indexOf(joinColumn);
- }
-
- public IEntity targetEntity() {
- return getJoinTable().relationshipMapping().getEntity();
- }
-
- public String attributeName() {
- IEntity targetEntity = getJoinTable().relationshipMapping().getResolvedTargetEntity();
- if (targetEntity == null) {
- return null;
- }
- String attributeName = getJoinTable().relationshipMapping().getPersistentAttribute().getName();
- for (Iterator<IPersistentAttribute> stream = targetEntity.getPersistentType().allAttributes(); stream.hasNext();) {
- IPersistentAttribute attribute = stream.next();
- IAttributeMapping mapping = attribute.getMapping();
- if (mapping instanceof INonOwningMapping) {
- String mappedBy = ((INonOwningMapping) mapping).getMappedBy();
- if ((mappedBy != null) && mappedBy.equals(attributeName)) {
- return attribute.getName();
- }
- }
- }
- return null;
- }
-
- @Override
- public Table dbTable(String tableName) {
- Table dbTable = super.dbTable(tableName);
- if (dbTable != null) {
- return dbTable;
- }
- return getTypeMapping().dbTable(tableName);
- }
-
- public Table dbReferencedColumnTable() {
- return getTypeMapping().primaryDbTable();
- }
-
- public boolean isVirtual(IAbstractJoinColumn joinColumn) {
- return getJoinTable().getDefaultJoinColumns().contains(joinColumn);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IManyToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IManyToMany.java
deleted file mode 100644
index 1cc4f946d3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IManyToMany.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IMany To Many</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIManyToMany()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IManyToMany extends IMultiRelationshipMapping
-{} // IManyToMany
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IManyToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IManyToOne.java
deleted file mode 100644
index 033d6afb1c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IManyToOne.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IMany To One</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIManyToOne()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IManyToOne extends ISingleRelationshipMapping
-{} // IManyToOne
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IMappedSuperclass.java
deleted file mode 100644
index fa513d0f45..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IMappedSuperclass.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-import org.eclipse.jpt.core.internal.ITypeMapping;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Mapped Superclass</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IMappedSuperclass#getIdClass <em>Id Class</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIMappedSuperclass()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IMappedSuperclass extends ITypeMapping
-{
- /**
- * Returns the value of the '<em><b>Id Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Id Class</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Id Class</em>' attribute.
- * @see #setIdClass(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIMappedSuperclass_IdClass()
- * @model
- * @generated
- */
- String getIdClass();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IMappedSuperclass#getIdClass <em>Id Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Id Class</em>' attribute.
- * @see #getIdClass()
- * @generated
- */
- void setIdClass(String value);
-} // MappedSuperclass
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IMultiRelationshipMapping.java
deleted file mode 100644
index 85db84e718..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IMultiRelationshipMapping.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-import java.util.Iterator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IMulti Relationship Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getOrderBy <em>Order By</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getFetch <em>Fetch</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getJoinTable <em>Join Table</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getMapKey <em>Map Key</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIMultiRelationshipMapping()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IMultiRelationshipMapping extends INonOwningMapping
-{
- /**
- * Returns the value of the '<em><b>Order By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Order By</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Order By</em>' attribute.
- * @see #setOrderBy(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIMultiRelationshipMapping_OrderBy()
- * @model unique="false" ordered="false"
- * @generated
- */
- String getOrderBy();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getOrderBy <em>Order By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Order By</em>' attribute.
- * @see #getOrderBy()
- * @generated
- */
- void setOrderBy(String value);
-
- /**
- * Returns the value of the '<em><b>Fetch</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Fetch</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType
- * @see #setFetch(DefaultLazyFetchType)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIMultiRelationshipMapping_Fetch()
- * @model
- * @generated
- */
- DefaultLazyFetchType getFetch();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getFetch <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType
- * @see #getFetch()
- * @generated
- */
- void setFetch(DefaultLazyFetchType value);
-
- /**
- * Returns the value of the '<em><b>Join Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Join Table</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Join Table</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIMultiRelationshipMapping_JoinTable()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- IJoinTable getJoinTable();
-
- /**
- * All multi-relationship mappings have a join table, even if it has to be
- * calculated from default settings. However, it is important to note
- * whether the table *is* default or whether it is specified.
- */
- boolean isJoinTableSpecified();
-
- /**
- * Returns the value of the '<em><b>Map Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Map Key</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Map Key</em>' attribute.
- * @see #setMapKey(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIMultiRelationshipMapping_MapKey()
- * @model
- * @generated
- */
- String getMapKey();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getMapKey <em>Map Key</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Map Key</em>' attribute.
- * @see #getMapKey()
- * @generated
- */
- void setMapKey(String value);
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation" unique="false" required="true" ordered="false"
- * @generated
- */
- boolean isNoOrdering();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated
- */
- void setNoOrdering();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation" unique="false" required="true" ordered="false"
- * @generated
- */
- boolean isOrderByPk();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated
- */
- void setOrderByPk();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation" unique="false" required="true" ordered="false"
- * @generated
- */
- boolean isCustomOrdering();
-
- Iterator<String> candidateMapKeyNames();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INamedColumn.java
deleted file mode 100644
index 87210b191f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INamedColumn.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.mappings;
-
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.db.internal.Column;
-import org.eclipse.jpt.db.internal.Table;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>INamed Column</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.INamedColumn#getName <em>Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.INamedColumn#getSpecifiedName <em>Specified Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.INamedColumn#getDefaultName <em>Default Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.INamedColumn#getColumnDefinition <em>Column Definition</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINamedColumn()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface INamedColumn extends IJpaSourceObject
-{
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINamedColumn_Name()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- String getName();
-
- /**
- * Returns the value of the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Name</em>' attribute.
- * @see #setSpecifiedName(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINamedColumn_SpecifiedName()
- * @model
- * @generated
- */
- String getSpecifiedName();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.INamedColumn#getSpecifiedName <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Name</em>' attribute.
- * @see #getSpecifiedName()
- * @generated
- */
- void setSpecifiedName(String value);
-
- /**
- * Returns the value of the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINamedColumn_DefaultName()
- * @model changeable="false"
- * @generated
- */
- String getDefaultName();
-
- /**
- * Returns the value of the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column Definition</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column Definition</em>' attribute.
- * @see #setColumnDefinition(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINamedColumn_ColumnDefinition()
- * @model
- * @generated
- */
- String getColumnDefinition();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.INamedColumn#getColumnDefinition <em>Column Definition</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Column Definition</em>' attribute.
- * @see #getColumnDefinition()
- * @generated
- */
- void setColumnDefinition(String value);
-
- /**
- * Return the wrapper for the datasource column
- */
- Column dbColumn();
-
- /**
- * Return the wrapper for the datasource table
- */
- Table dbTable();
-
- /**
- * Return whether the column is found on the datasource.
- */
- boolean isResolved();
-
- /**
- * Return the (best guess) text location of the column's name.
- */
- ITextRange nameTextRange();
-
- /**
- * Return whether the column's datasource is connected
- */
- boolean isConnected();
-
- /**
- * Return the column's "owner" - the object that contains the column
- * and provides its context.
- */
- Owner getOwner();
-
-
- /**
- * interface allowing columns to be used in multiple places
- * (e.g. basic mappings and attribute overrides)
- */
- interface Owner
- {
- /**
- * Return the type mapping that contains the column.
- */
- ITypeMapping getTypeMapping();
-
- /**
- * Return the column owner's text range. This can be returned by the
- * column when its annotation is not present.
- */
- ITextRange validationTextRange();
-
- /**
- * Return the wrapper for the datasource table for the given table name
- */
- Table dbTable(String tableName);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INamedNativeQuery.java
deleted file mode 100644
index ba382a05e3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INamedNativeQuery.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.mappings;
-
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>INamed Native Query</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.INamedNativeQuery#getResultClass <em>Result Class</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.INamedNativeQuery#getResultSetMapping <em>Result Set Mapping</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINamedNativeQuery()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface INamedNativeQuery extends IJpaSourceObject, IQuery
-{
- /**
- * Returns the value of the '<em><b>Result Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Result Class</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Result Class</em>' attribute.
- * @see #setResultClass(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINamedNativeQuery_ResultClass()
- * @model
- * @generated
- */
- String getResultClass();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.INamedNativeQuery#getResultClass <em>Result Class</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Result Class</em>' attribute.
- * @see #getResultClass()
- * @generated
- */
- void setResultClass(String value);
-
- /**
- * Returns the value of the '<em><b>Result Set Mapping</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Result Set Mapping</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Result Set Mapping</em>' attribute.
- * @see #setResultSetMapping(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINamedNativeQuery_ResultSetMapping()
- * @model
- * @generated
- */
- String getResultSetMapping();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.INamedNativeQuery#getResultSetMapping <em>Result Set Mapping</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Result Set Mapping</em>' attribute.
- * @see #getResultSetMapping()
- * @generated
- */
- void setResultSetMapping(String value);
-} // INamedNativeQuery
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INonOwningMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INonOwningMapping.java
deleted file mode 100644
index 3f15be3430..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/INonOwningMapping.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-import java.util.Iterator;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.ITextRange;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>INon Owning Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.INonOwningMapping#getMappedBy <em>Mapped By</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINonOwningMapping()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface INonOwningMapping extends IRelationshipMapping
-{
- /**
- * Returns the value of the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Mapped By</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Mapped By</em>' attribute.
- * @see #setMappedBy(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINonOwningMapping_MappedBy()
- * @model
- * @generated
- */
- String getMappedBy();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.INonOwningMapping#getMappedBy <em>Mapped By</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Mapped By</em>' attribute.
- * @see #getMappedBy()
- * @generated
- */
- void setMappedBy(String value);
-
- Iterator<String> candidateMappedByAttributeNames();
-
- boolean mappedByIsValid(IAttributeMapping mappedByMapping);
-
- ITextRange mappedByTextRange();
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IOneToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IOneToMany.java
deleted file mode 100644
index d0b03eed27..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IOneToMany.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IOne To Many</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIOneToMany()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IOneToMany extends IMultiRelationshipMapping
-{} // IOneToMany
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IOverride.java
deleted file mode 100644
index 224e003d3b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IOverride.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.mappings;
-
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IOverride</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IOverride#getName <em>Name</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIOverride()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IOverride extends IJpaSourceObject
-{
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see #setName(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIOverride_Name()
- * @model
- * @generated
- */
- String getName();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IOverride#getName <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Name</em>' attribute.
- * @see #getName()
- * @generated
- */
- void setName(String value);
-
- /**
- * Return true if override exists as specified on the owning object, or false
- * if the override is "gotten for free" as a result of defaults calculation
- */
- boolean isVirtual();
-
- Owner getOwner();
-
-
- interface Owner
- {
- ITypeMapping getTypeMapping();
-
- IAttributeMapping attributeMapping(String attributeName);
-
- boolean isVirtual(IOverride override);
-
- ITextRange validationTextRange();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IRelationshipMapping.java
deleted file mode 100644
index f1da127461..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IRelationshipMapping.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IRelationship Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getTargetEntity <em>Target Entity</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getSpecifiedTargetEntity <em>Specified Target Entity</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getDefaultTargetEntity <em>Default Target Entity</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getResolvedTargetEntity <em>Resolved Target Entity</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getCascade <em>Cascade</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIRelationshipMapping()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IRelationshipMapping extends IAttributeMapping
-{
- /**
- * Returns the value of the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Target Entity</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Target Entity</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIRelationshipMapping_TargetEntity()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- String getTargetEntity();
-
- /**
- * Returns the value of the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Target Entity</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Target Entity</em>' attribute.
- * @see #setSpecifiedTargetEntity(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIRelationshipMapping_SpecifiedTargetEntity()
- * @model
- * @generated
- */
- String getSpecifiedTargetEntity();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getSpecifiedTargetEntity <em>Specified Target Entity</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Target Entity</em>' attribute.
- * @see #getSpecifiedTargetEntity()
- * @generated
- */
- void setSpecifiedTargetEntity(String value);
-
- /**
- * Returns the value of the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Target Entity</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Target Entity</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIRelationshipMapping_DefaultTargetEntity()
- * @model changeable="false"
- * @generated
- */
- String getDefaultTargetEntity();
-
- /**
- * Returns the value of the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Resolved Target Entity</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Resolved Target Entity</em>' reference.
- * @see #setResolvedTargetEntity(IEntity)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIRelationshipMapping_ResolvedTargetEntity()
- * @model
- * @generated
- */
- IEntity getResolvedTargetEntity();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getResolvedTargetEntity <em>Resolved Target Entity</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Resolved Target Entity</em>' reference.
- * @see #getResolvedTargetEntity()
- * @generated
- */
- void setResolvedTargetEntity(IEntity value);
-
- /**
- * Returns the value of the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Cascade</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Cascade</em>' containment reference.
- * @see #setCascade(ICascade)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIRelationshipMapping_Cascade()
- * @model containment="true"
- * @generated
- */
- ICascade getCascade();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getCascade <em>Cascade</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Cascade</em>' containment reference.
- * @see #getCascade()
- * @generated
- */
- void setCascade(ICascade value);
-
- /**
- * Return whether the specified 'targetEntity' is valid.
- */
- boolean targetEntityIsValid(String targetEntity);
-
- /**
- * Return the fully qualified target entity. If it is already specified
- * as fully qualified then just return that.
- * @return
- */
- String fullyQualifiedTargetEntity(CompilationUnit astRoot);
-
- /**
- * Return the Entity that owns this relationship mapping
- * @return
- */
- IEntity getEntity();
-
- ICascade createCascade();
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISecondaryTable.java
deleted file mode 100644
index dd02c7c34a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISecondaryTable.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.mappings;
-
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.db.internal.Table;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>ISecondary Table</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable#getPrimaryKeyJoinColumns <em>Primary Key Join Columns</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable#getSpecifiedPrimaryKeyJoinColumns <em>Specified Primary Key Join Columns</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable#getDefaultPrimaryKeyJoinColumns <em>Default Primary Key Join Columns</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISecondaryTable()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface ISecondaryTable extends ITable
-{
- /**
- * Returns the value of the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Primary Key Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Primary Key Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISecondaryTable_PrimaryKeyJoinColumns()
- * @model containment="true" transient="true" changeable="false" volatile="true"
- * @generated
- */
- EList<IPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns();
-
- /**
- * Returns the value of the '<em><b>Specified Primary Key Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Primary Key Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Primary Key Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISecondaryTable_SpecifiedPrimaryKeyJoinColumns()
- * @model containment="true"
- * @generated
- */
- EList<IPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns();
-
- /**
- * Returns the value of the '<em><b>Default Primary Key Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Primary Key Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Primary Key Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISecondaryTable_DefaultPrimaryKeyJoinColumns()
- * @model containment="true"
- * @generated
- */
- EList<IPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns();
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated
- */
- ITypeMapping typeMapping();
-
- /**
- * Create a primary key join column with the given index
- */
- IPrimaryKeyJoinColumn createPrimaryKeyJoinColumn(int index);
-
- boolean containsSpecifiedPrimaryKeyJoinColumns();
-
- boolean isVirtual();
-
- class PrimaryKeyJoinColumnOwner implements IAbstractJoinColumn.Owner
- {
- private ISecondaryTable secondaryTable;
-
- public PrimaryKeyJoinColumnOwner(ISecondaryTable secondaryTable) {
- this.secondaryTable = secondaryTable;
- }
-
- public ITextRange validationTextRange() {
- return this.secondaryTable.validationTextRange();
- }
-
- public ITypeMapping getTypeMapping() {
- return this.secondaryTable.typeMapping();
- }
-
- public Table dbTable(String tableName) {
- return this.secondaryTable.dbTable();
- }
-
- public Table dbReferencedColumnTable() {
- return getTypeMapping().primaryDbTable();
- }
-
- public List<IPrimaryKeyJoinColumn> joinColumns() {
- return this.secondaryTable.getPrimaryKeyJoinColumns();
- }
-
- public boolean isVirtual(IAbstractJoinColumn joinColumn) {
- return this.secondaryTable.getDefaultPrimaryKeyJoinColumns().contains(joinColumn);
- }
-
- public int indexOf(IAbstractJoinColumn joinColumn) {
- return joinColumns().indexOf(joinColumn);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISequenceGenerator.java
deleted file mode 100644
index ca2e191675..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISequenceGenerator.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.mappings;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>ISequence Generator</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ISequenceGenerator#getSequenceName <em>Sequence Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ISequenceGenerator#getSpecifiedSequenceName <em>Specified Sequence Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ISequenceGenerator#getDefaultSequenceName <em>Default Sequence Name</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISequenceGenerator()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface ISequenceGenerator extends IGenerator
-{
- /**
- * Returns the value of the '<em><b>Sequence Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Sequence Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Sequence Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISequenceGenerator_SequenceName()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- String getSequenceName();
-
- /**
- * Returns the value of the '<em><b>Specified Sequence Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Sequence Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Sequence Name</em>' attribute.
- * @see #setSpecifiedSequenceName(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISequenceGenerator_SpecifiedSequenceName()
- * @model
- * @generated
- */
- String getSpecifiedSequenceName();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ISequenceGenerator#getSpecifiedSequenceName <em>Specified Sequence Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Sequence Name</em>' attribute.
- * @see #getSpecifiedSequenceName()
- * @generated
- */
- void setSpecifiedSequenceName(String value);
-
- /**
- * Returns the value of the '<em><b>Default Sequence Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Sequence Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Sequence Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISequenceGenerator_DefaultSequenceName()
- * @model changeable="false"
- * @generated
- */
- String getDefaultSequenceName();
-} // ISequenceGenerator
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISingleRelationshipMapping.java
deleted file mode 100644
index 612b45f0a0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ISingleRelationshipMapping.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.db.internal.Table;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>ISingle Relationship Mapping</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getFetch <em>Fetch</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getJoinColumns <em>Join Columns</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getSpecifiedJoinColumns <em>Specified Join Columns</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getDefaultJoinColumns <em>Default Join Columns</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getOptional <em>Optional</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISingleRelationshipMapping()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface ISingleRelationshipMapping extends IRelationshipMapping
-{
- /**
- * Returns the value of the '<em><b>Fetch</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Fetch</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType
- * @see #setFetch(DefaultEagerFetchType)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISingleRelationshipMapping_Fetch()
- * @model
- * @generated
- */
- DefaultEagerFetchType getFetch();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getFetch <em>Fetch</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType
- * @see #getFetch()
- * @generated
- */
- void setFetch(DefaultEagerFetchType value);
-
- /**
- * Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISingleRelationshipMapping_JoinColumns()
- * @model containment="true" transient="true" changeable="false" volatile="true"
- * @generated
- */
- EList<IJoinColumn> getJoinColumns();
-
- /**
- * Returns the value of the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISingleRelationshipMapping_SpecifiedJoinColumns()
- * @model containment="true"
- * @generated
- */
- EList<IJoinColumn> getSpecifiedJoinColumns();
-
- /**
- * Returns the value of the '<em><b>Default Join Columns</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IJoinColumn}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Join Columns</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Join Columns</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISingleRelationshipMapping_DefaultJoinColumns()
- * @model containment="true"
- * @generated
- */
- EList<IJoinColumn> getDefaultJoinColumns();
-
- /**
- * Returns the value of the '<em><b>Optional</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Optional</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Optional</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setOptional(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISingleRelationshipMapping_Optional()
- * @model
- * @generated
- */
- DefaultTrueBoolean getOptional();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getOptional <em>Optional</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Optional</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #getOptional()
- * @generated
- */
- void setOptional(DefaultTrueBoolean value);
-
- boolean containsSpecifiedJoinColumns();
-
- IJoinColumn createJoinColumn(int index);
-
-
- public class JoinColumnOwner implements IJoinColumn.Owner
- {
- private ISingleRelationshipMapping singleRelationshipMapping;
-
- public JoinColumnOwner(ISingleRelationshipMapping singleRelationshipMapping) {
- super();
- this.singleRelationshipMapping = singleRelationshipMapping;
- }
-
- /**
- * by default, the join column is in the type mapping's primary table
- */
- public String defaultTableName() {
- return this.singleRelationshipMapping.getPersistentAttribute().typeMapping().getTableName();
- }
-
- public List<IJoinColumn> joinColumns() {
- return this.singleRelationshipMapping.getJoinColumns();
- }
-
- public int indexOf(IAbstractJoinColumn joinColumn) {
- return joinColumns().indexOf(joinColumn);
- }
-
- public IEntity targetEntity() {
- return this.singleRelationshipMapping.getResolvedTargetEntity();
- }
-
- public String attributeName() {
- return this.singleRelationshipMapping.getPersistentAttribute().getName();
- }
-
- public IRelationshipMapping getRelationshipMapping() {
- return this.singleRelationshipMapping;
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.singleRelationshipMapping.getPersistentAttribute().typeMapping().tableNameIsInvalid(tableName);
- }
-
- /**
- * the join column can be on a secondary table
- */
- public boolean tableIsAllowed() {
- return true;
- }
-
- public ITextRange validationTextRange() {
- return this.singleRelationshipMapping.validationTextRange();
- }
-
- public ITypeMapping getTypeMapping() {
- return this.singleRelationshipMapping.typeMapping();
- }
-
- public Table dbTable(String tableName) {
- return getTypeMapping().dbTable(tableName);
- }
-
- public Table dbReferencedColumnTable() {
- IEntity targetEntity = targetEntity();
- return (targetEntity == null) ? null : targetEntity().primaryDbTable();
- }
-
- public boolean isVirtual(IAbstractJoinColumn joinColumn) {
- return this.singleRelationshipMapping.getDefaultJoinColumns().contains(joinColumn);
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITable.java
deleted file mode 100644
index adacc51fab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITable.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>ITable</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITable#getName <em>Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITable#getSpecifiedName <em>Specified Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITable#getDefaultName <em>Default Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITable#getCatalog <em>Catalog</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITable#getSpecifiedCatalog <em>Specified Catalog</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITable#getDefaultCatalog <em>Default Catalog</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITable#getSchema <em>Schema</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITable#getSpecifiedSchema <em>Specified Schema</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITable#getDefaultSchema <em>Default Schema</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITable#getUniqueConstraints <em>Unique Constraints</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITable()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface ITable extends IJpaSourceObject
-{
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITable_Name()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- String getName();
-
- /**
- * Returns the value of the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITable_DefaultName()
- * @model changeable="false"
- * @generated
- */
- String getDefaultName();
-
- /**
- * Returns the value of the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Catalog</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITable_Catalog()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- String getCatalog();
-
- /**
- * Returns the value of the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Catalog</em>' attribute.
- * @see #setSpecifiedCatalog(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITable_SpecifiedCatalog()
- * @model
- * @generated
- */
- String getSpecifiedCatalog();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ITable#getSpecifiedCatalog <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Catalog</em>' attribute.
- * @see #getSpecifiedCatalog()
- * @generated
- */
- void setSpecifiedCatalog(String value);
-
- /**
- * Returns the value of the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Catalog</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITable_DefaultCatalog()
- * @model changeable="false"
- * @generated
- */
- String getDefaultCatalog();
-
- /**
- * Returns the value of the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Schema</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITable_Schema()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- String getSchema();
-
- /**
- * Returns the value of the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Schema</em>' attribute.
- * @see #setSpecifiedSchema(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITable_SpecifiedSchema()
- * @model
- * @generated
- */
- String getSpecifiedSchema();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ITable#getSpecifiedSchema <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Schema</em>' attribute.
- * @see #getSpecifiedSchema()
- * @generated
- */
- void setSpecifiedSchema(String value);
-
- /**
- * Returns the value of the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Schema</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITable_DefaultSchema()
- * @model changeable="false"
- * @generated
- */
- String getDefaultSchema();
-
- /**
- * Returns the value of the '<em><b>Unique Constraints</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IUniqueConstraint}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Unique Constraints</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Unique Constraints</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITable_UniqueConstraints()
- * @model containment="true"
- * @generated
- */
- EList<IUniqueConstraint> getUniqueConstraints();
-
- /**
- * Returns the value of the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Name</em>' attribute.
- * @see #setSpecifiedName(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITable_SpecifiedName()
- * @model
- * @generated
- */
- String getSpecifiedName();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ITable#getSpecifiedName <em>Specified Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Name</em>' attribute.
- * @see #getSpecifiedName()
- * @generated
- */
- void setSpecifiedName(String value);
-
- void refreshDefaults(DefaultsContext defaultsContext);
-
- Table dbTable();
-
- Schema dbSchema();
-
- /**
- * Return true if this table is connected to a datasource
- */
- boolean isConnected();
-
- /**
- * Return true if this table's schema can be resolved to a schema on the active connection
- */
- boolean hasResolvedSchema();
-
- /**
- * Return true if this can be resolved to a table on the active connection
- */
- boolean isResolved();
-
- ITextRange nameTextRange();
-
- ITextRange schemaTextRange();
-
- Owner getOwner();
-
- IUniqueConstraint createUniqueConstraint(int index);
-
-
- /**
- * interface allowing tables to be owned by various objects
- */
- interface Owner
- {
- ITextRange validationTextRange();
-
- ITypeMapping getTypeMapping();
- }
-
-
- class UniqueConstraintOwner implements IUniqueConstraint.Owner
- {
- private final ITable table;
-
- public UniqueConstraintOwner(ITable table) {
- super();
- this.table = table;
- }
-
- public Iterator<String> candidateUniqueConstraintColumnNames() {
- return this.table.dbTable().columnNames();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITableGenerator.java
deleted file mode 100644
index 07783b4e21..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITableGenerator.java
+++ /dev/null
@@ -1,428 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>ITable Generator</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getTable <em>Table</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedTable <em>Specified Table</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultTable <em>Default Table</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getCatalog <em>Catalog</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedCatalog <em>Specified Catalog</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultCatalog <em>Default Catalog</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSchema <em>Schema</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedSchema <em>Specified Schema</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultSchema <em>Default Schema</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getPkColumnName <em>Pk Column Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedPkColumnName <em>Specified Pk Column Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultPkColumnName <em>Default Pk Column Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getValueColumnName <em>Value Column Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedValueColumnName <em>Specified Value Column Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultValueColumnName <em>Default Value Column Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getPkColumnValue <em>Pk Column Value</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedPkColumnValue <em>Specified Pk Column Value</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultPkColumnValue <em>Default Pk Column Value</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getUniqueConstraints <em>Unique Constraints</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface ITableGenerator extends IGenerator
-{
- /**
- * Returns the value of the '<em><b>Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Table</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Table</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_Table()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- String getTable();
-
- /**
- * Returns the value of the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Table</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Table</em>' attribute.
- * @see #setSpecifiedTable(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_SpecifiedTable()
- * @model
- * @generated
- */
- String getSpecifiedTable();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedTable <em>Specified Table</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Table</em>' attribute.
- * @see #getSpecifiedTable()
- * @generated
- */
- void setSpecifiedTable(String value);
-
- /**
- * Returns the value of the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Table</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Table</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_DefaultTable()
- * @model changeable="false"
- * @generated
- */
- String getDefaultTable();
-
- /**
- * Returns the value of the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Catalog</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_Catalog()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- String getCatalog();
-
- /**
- * Returns the value of the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Catalog</em>' attribute.
- * @see #setSpecifiedCatalog(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_SpecifiedCatalog()
- * @model
- * @generated
- */
- String getSpecifiedCatalog();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedCatalog <em>Specified Catalog</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Catalog</em>' attribute.
- * @see #getSpecifiedCatalog()
- * @generated
- */
- void setSpecifiedCatalog(String value);
-
- /**
- * Returns the value of the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Catalog</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Catalog</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_DefaultCatalog()
- * @model changeable="false"
- * @generated
- */
- String getDefaultCatalog();
-
- /**
- * Returns the value of the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Schema</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_Schema()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- String getSchema();
-
- /**
- * Returns the value of the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Schema</em>' attribute.
- * @see #setSpecifiedSchema(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_SpecifiedSchema()
- * @model
- * @generated
- */
- String getSpecifiedSchema();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedSchema <em>Specified Schema</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Schema</em>' attribute.
- * @see #getSpecifiedSchema()
- * @generated
- */
- void setSpecifiedSchema(String value);
-
- /**
- * Returns the value of the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Schema</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Schema</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_DefaultSchema()
- * @model changeable="false"
- * @generated
- */
- String getDefaultSchema();
-
- /**
- * Returns the value of the '<em><b>Pk Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Pk Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Pk Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_PkColumnName()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- String getPkColumnName();
-
- /**
- * Returns the value of the '<em><b>Specified Pk Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Pk Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Pk Column Name</em>' attribute.
- * @see #setSpecifiedPkColumnName(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_SpecifiedPkColumnName()
- * @model
- * @generated
- */
- String getSpecifiedPkColumnName();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedPkColumnName <em>Specified Pk Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Pk Column Name</em>' attribute.
- * @see #getSpecifiedPkColumnName()
- * @generated
- */
- void setSpecifiedPkColumnName(String value);
-
- /**
- * Returns the value of the '<em><b>Default Pk Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Pk Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Pk Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_DefaultPkColumnName()
- * @model changeable="false"
- * @generated
- */
- String getDefaultPkColumnName();
-
- /**
- * Returns the value of the '<em><b>Value Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Value Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Value Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_ValueColumnName()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- String getValueColumnName();
-
- /**
- * Returns the value of the '<em><b>Specified Value Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Value Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Value Column Name</em>' attribute.
- * @see #setSpecifiedValueColumnName(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_SpecifiedValueColumnName()
- * @model
- * @generated
- */
- String getSpecifiedValueColumnName();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedValueColumnName <em>Specified Value Column Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Value Column Name</em>' attribute.
- * @see #getSpecifiedValueColumnName()
- * @generated
- */
- void setSpecifiedValueColumnName(String value);
-
- /**
- * Returns the value of the '<em><b>Default Value Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Value Column Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Value Column Name</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_DefaultValueColumnName()
- * @model changeable="false"
- * @generated
- */
- String getDefaultValueColumnName();
-
- /**
- * Returns the value of the '<em><b>Pk Column Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Pk Column Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Pk Column Value</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_PkColumnValue()
- * @model changeable="false" volatile="true" derived="true"
- * @generated
- */
- String getPkColumnValue();
-
- /**
- * Returns the value of the '<em><b>Specified Pk Column Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Specified Pk Column Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Specified Pk Column Value</em>' attribute.
- * @see #setSpecifiedPkColumnValue(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_SpecifiedPkColumnValue()
- * @model
- * @generated
- */
- String getSpecifiedPkColumnValue();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedPkColumnValue <em>Specified Pk Column Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Specified Pk Column Value</em>' attribute.
- * @see #getSpecifiedPkColumnValue()
- * @generated
- */
- void setSpecifiedPkColumnValue(String value);
-
- /**
- * Returns the value of the '<em><b>Default Pk Column Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Default Pk Column Value</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Default Pk Column Value</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_DefaultPkColumnValue()
- * @model changeable="false"
- * @generated
- */
- String getDefaultPkColumnValue();
-
- /**
- * Returns the value of the '<em><b>Unique Constraints</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IUniqueConstraint}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Unique Constraints</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Unique Constraints</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator_UniqueConstraints()
- * @model containment="true"
- * @generated
- */
- EList<IUniqueConstraint> getUniqueConstraints();
-
- void refreshDefaults(DefaultsContext defaultsContext);
-
- IUniqueConstraint createUniqueConstraint(int index);
-
- Schema dbSchema();
-
- Table dbTable();
-
-
- class UniqueConstraintOwner implements IUniqueConstraint.Owner
- {
- private final ITableGenerator tableGenerator;
-
- public UniqueConstraintOwner(ITableGenerator tableGenerator) {
- super();
- this.tableGenerator = tableGenerator;
- }
-
- public Iterator<String> candidateUniqueConstraintColumnNames() {
- return this.tableGenerator.dbTable().columnNames();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IUniqueConstraint.java
deleted file mode 100644
index b62390b498..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IUniqueConstraint.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.mappings;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IUnique Constraint</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IUniqueConstraint#getColumnNames <em>Column Names</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIUniqueConstraint()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IUniqueConstraint extends IJpaSourceObject
-{
- /**
- * Returns the value of the '<em><b>Column Names</b></em>' attribute list.
- * The list contents are of type {@link java.lang.String}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column Names</em>' attribute list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column Names</em>' attribute list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIUniqueConstraint_ColumnNames()
- * @model unique="false"
- * @generated
- */
- EList<String> getColumnNames();
-
-
- /**
- * All containers must implement this interface.
- */
- interface Owner
- {
- Iterator<String> candidateUniqueConstraintColumnNames();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IVersion.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IVersion.java
deleted file mode 100644
index 1f3ed18483..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IVersion.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.mappings;
-
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IVersion</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IVersion#getColumn <em>Column</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IVersion#getTemporal <em>Temporal</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIVersion()
- * @model kind="class" interface="true" abstract="true"
- * @generated
- */
-public interface IVersion extends IAttributeMapping, IColumnMapping
-{
- /**
- * Returns the value of the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIVersion_Column()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- IColumn getColumn();
-
- /**
- * Returns the value of the '<em><b>Temporal</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.TemporalType}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Temporal</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @see #setTemporal(TemporalType)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIVersion_Temporal()
- * @model
- * @generated
- */
- TemporalType getTemporal();
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IVersion#getTemporal <em>Temporal</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @see #getTemporal()
- * @generated
- */
- void setTemporal(TemporalType value);
-} // IVersion
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/JpaCoreMappingsFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/JpaCoreMappingsFactory.java
deleted file mode 100644
index 71e1442228..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/JpaCoreMappingsFactory.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.impl.EFactoryImpl;
-import org.eclipse.emf.ecore.plugin.EcorePlugin;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model <b>Factory</b>.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage
- * @generated
- */
-public class JpaCoreMappingsFactory extends EFactoryImpl
-{
- /**
- * The singleton instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final JpaCoreMappingsFactory eINSTANCE = init();
-
- /**
- * Creates the default factory implementation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static JpaCoreMappingsFactory init() {
- try {
- JpaCoreMappingsFactory theJpaCoreMappingsFactory = (JpaCoreMappingsFactory) EPackage.Registry.INSTANCE.getEFactory("jpt.core.mappings.xmi");
- if (theJpaCoreMappingsFactory != null) {
- return theJpaCoreMappingsFactory;
- }
- }
- catch (Exception exception) {
- EcorePlugin.INSTANCE.log(exception);
- }
- return new JpaCoreMappingsFactory();
- }
-
- /**
- * Creates an instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaCoreMappingsFactory() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public EObject create(EClass eClass) {
- switch (eClass.getClassifierID()) {
- default :
- throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object createFromString(EDataType eDataType, String initialValue) {
- switch (eDataType.getClassifierID()) {
- case JpaCoreMappingsPackage.DEFAULT_EAGER_FETCH_TYPE :
- return createDefaultEagerFetchTypeFromString(eDataType, initialValue);
- case JpaCoreMappingsPackage.DEFAULT_LAZY_FETCH_TYPE :
- return createDefaultLazyFetchTypeFromString(eDataType, initialValue);
- case JpaCoreMappingsPackage.DEFAULT_FALSE_BOOLEAN :
- return createDefaultFalseBooleanFromString(eDataType, initialValue);
- case JpaCoreMappingsPackage.DEFAULT_TRUE_BOOLEAN :
- return createDefaultTrueBooleanFromString(eDataType, initialValue);
- case JpaCoreMappingsPackage.TEMPORAL_TYPE :
- return createTemporalTypeFromString(eDataType, initialValue);
- case JpaCoreMappingsPackage.INHERITANCE_TYPE :
- return createInheritanceTypeFromString(eDataType, initialValue);
- case JpaCoreMappingsPackage.DISCRIMINATOR_TYPE :
- return createDiscriminatorTypeFromString(eDataType, initialValue);
- case JpaCoreMappingsPackage.GENERATION_TYPE :
- return createGenerationTypeFromString(eDataType, initialValue);
- case JpaCoreMappingsPackage.ENUM_TYPE :
- return createEnumTypeFromString(eDataType, initialValue);
- case JpaCoreMappingsPackage.CASCADE_TYPE :
- return createCascadeTypeFromString(eDataType, initialValue);
- default :
- throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String convertToString(EDataType eDataType, Object instanceValue) {
- switch (eDataType.getClassifierID()) {
- case JpaCoreMappingsPackage.DEFAULT_EAGER_FETCH_TYPE :
- return convertDefaultEagerFetchTypeToString(eDataType, instanceValue);
- case JpaCoreMappingsPackage.DEFAULT_LAZY_FETCH_TYPE :
- return convertDefaultLazyFetchTypeToString(eDataType, instanceValue);
- case JpaCoreMappingsPackage.DEFAULT_FALSE_BOOLEAN :
- return convertDefaultFalseBooleanToString(eDataType, instanceValue);
- case JpaCoreMappingsPackage.DEFAULT_TRUE_BOOLEAN :
- return convertDefaultTrueBooleanToString(eDataType, instanceValue);
- case JpaCoreMappingsPackage.TEMPORAL_TYPE :
- return convertTemporalTypeToString(eDataType, instanceValue);
- case JpaCoreMappingsPackage.INHERITANCE_TYPE :
- return convertInheritanceTypeToString(eDataType, instanceValue);
- case JpaCoreMappingsPackage.DISCRIMINATOR_TYPE :
- return convertDiscriminatorTypeToString(eDataType, instanceValue);
- case JpaCoreMappingsPackage.GENERATION_TYPE :
- return convertGenerationTypeToString(eDataType, instanceValue);
- case JpaCoreMappingsPackage.ENUM_TYPE :
- return convertEnumTypeToString(eDataType, instanceValue);
- case JpaCoreMappingsPackage.CASCADE_TYPE :
- return convertCascadeTypeToString(eDataType, instanceValue);
- default :
- throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public DefaultEagerFetchType createDefaultEagerFetchTypeFromString(EDataType eDataType, String initialValue) {
- DefaultEagerFetchType result = DefaultEagerFetchType.get(initialValue);
- if (result == null)
- throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertDefaultEagerFetchTypeToString(EDataType eDataType, Object instanceValue) {
- return instanceValue == null ? null : instanceValue.toString();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public DefaultLazyFetchType createDefaultLazyFetchTypeFromString(EDataType eDataType, String initialValue) {
- DefaultLazyFetchType result = DefaultLazyFetchType.get(initialValue);
- if (result == null)
- throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertDefaultLazyFetchTypeToString(EDataType eDataType, Object instanceValue) {
- return instanceValue == null ? null : instanceValue.toString();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public DefaultFalseBoolean createDefaultFalseBooleanFromString(EDataType eDataType, String initialValue) {
- DefaultFalseBoolean result = DefaultFalseBoolean.get(initialValue);
- if (result == null)
- throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertDefaultFalseBooleanToString(EDataType eDataType, Object instanceValue) {
- return instanceValue == null ? null : instanceValue.toString();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public DefaultTrueBoolean createDefaultTrueBooleanFromString(EDataType eDataType, String initialValue) {
- DefaultTrueBoolean result = DefaultTrueBoolean.get(initialValue);
- if (result == null)
- throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertDefaultTrueBooleanToString(EDataType eDataType, Object instanceValue) {
- return instanceValue == null ? null : instanceValue.toString();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public TemporalType createTemporalTypeFromString(EDataType eDataType, String initialValue) {
- TemporalType result = TemporalType.get(initialValue);
- if (result == null)
- throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertTemporalTypeToString(EDataType eDataType, Object instanceValue) {
- return instanceValue == null ? null : instanceValue.toString();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public InheritanceType createInheritanceTypeFromString(EDataType eDataType, String initialValue) {
- InheritanceType result = InheritanceType.get(initialValue);
- if (result == null)
- throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertInheritanceTypeToString(EDataType eDataType, Object instanceValue) {
- return instanceValue == null ? null : instanceValue.toString();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public DiscriminatorType createDiscriminatorTypeFromString(EDataType eDataType, String initialValue) {
- DiscriminatorType result = DiscriminatorType.get(initialValue);
- if (result == null)
- throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertDiscriminatorTypeToString(EDataType eDataType, Object instanceValue) {
- return instanceValue == null ? null : instanceValue.toString();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public GenerationType createGenerationTypeFromString(EDataType eDataType, String initialValue) {
- GenerationType result = GenerationType.get(initialValue);
- if (result == null)
- throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertGenerationTypeToString(EDataType eDataType, Object instanceValue) {
- return instanceValue == null ? null : instanceValue.toString();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EnumType createEnumTypeFromString(EDataType eDataType, String initialValue) {
- EnumType result = EnumType.get(initialValue);
- if (result == null)
- throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertEnumTypeToString(EDataType eDataType, Object instanceValue) {
- return instanceValue == null ? null : instanceValue.toString();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public CascadeType createCascadeTypeFromString(EDataType eDataType, String initialValue) {
- CascadeType result = CascadeType.get(initialValue);
- if (result == null)
- throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertCascadeTypeToString(EDataType eDataType, Object instanceValue) {
- return instanceValue == null ? null : instanceValue.toString();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaCoreMappingsPackage getJpaCoreMappingsPackage() {
- return (JpaCoreMappingsPackage) getEPackage();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @deprecated
- * @generated
- */
- @Deprecated
- public static JpaCoreMappingsPackage getPackage() {
- return JpaCoreMappingsPackage.eINSTANCE;
- }
-} //MappingsFactoryImpl
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/JpaCoreMappingsPackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/JpaCoreMappingsPackage.java
deleted file mode 100644
index 2cd8c084dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/JpaCoreMappingsPackage.java
+++ /dev/null
@@ -1,8840 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 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.mappings;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.content.java.JpaJavaPackage;
-import org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.persistence.PersistencePackage;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Package</b> for the model.
- * It contains accessors for the meta objects to represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsFactory
- * @model kind="package"
- * @generated
- */
-public class JpaCoreMappingsPackage extends EPackageImpl
-{
- /**
- * The package name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNAME = "mappings";
-
- /**
- * The package namespace URI.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNS_URI = "jpt.core.mappings.xmi";
-
- /**
- * The package namespace name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final String eNS_PREFIX = "jpt.core.mappings";
-
- /**
- * The singleton instance of the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final JpaCoreMappingsPackage eINSTANCE = org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage.init();
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IMappedSuperclass <em>IMapped Superclass</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IMappedSuperclass
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIMappedSuperclass()
- * @generated
- */
- public static final int IMAPPED_SUPERCLASS = 0;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMAPPED_SUPERCLASS__NAME = JpaCorePackage.ITYPE_MAPPING__NAME;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMAPPED_SUPERCLASS__TABLE_NAME = JpaCorePackage.ITYPE_MAPPING__TABLE_NAME;
-
- /**
- * The feature id for the '<em><b>Id Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMAPPED_SUPERCLASS__ID_CLASS = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>IMapped Superclass</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMAPPED_SUPERCLASS_FEATURE_COUNT = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IEntity <em>IEntity</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IEntity
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity()
- * @generated
- */
- public static final int IENTITY = 1;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__NAME = JpaCorePackage.ITYPE_MAPPING__NAME;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__TABLE_NAME = JpaCorePackage.ITYPE_MAPPING__TABLE_NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__SPECIFIED_NAME = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__DEFAULT_NAME = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__TABLE = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Specified Secondary Tables</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__SPECIFIED_SECONDARY_TABLES = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__PRIMARY_KEY_JOIN_COLUMNS = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Specified Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Default Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Inheritance Strategy</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__INHERITANCE_STRATEGY = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Default Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__DEFAULT_DISCRIMINATOR_VALUE = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Specified Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__SPECIFIED_DISCRIMINATOR_VALUE = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 9;
-
- /**
- * The feature id for the '<em><b>Discriminator Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__DISCRIMINATOR_VALUE = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 10;
-
- /**
- * The feature id for the '<em><b>Discriminator Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__DISCRIMINATOR_COLUMN = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 11;
-
- /**
- * The feature id for the '<em><b>Sequence Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__SEQUENCE_GENERATOR = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 12;
-
- /**
- * The feature id for the '<em><b>Table Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__TABLE_GENERATOR = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 13;
-
- /**
- * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__ATTRIBUTE_OVERRIDES = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 14;
-
- /**
- * The feature id for the '<em><b>Specified Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 15;
-
- /**
- * The feature id for the '<em><b>Default Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__DEFAULT_ATTRIBUTE_OVERRIDES = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 16;
-
- /**
- * The feature id for the '<em><b>Association Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__ASSOCIATION_OVERRIDES = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 17;
-
- /**
- * The feature id for the '<em><b>Specified Association Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__SPECIFIED_ASSOCIATION_OVERRIDES = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 18;
-
- /**
- * The feature id for the '<em><b>Default Association Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__DEFAULT_ASSOCIATION_OVERRIDES = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 19;
-
- /**
- * The feature id for the '<em><b>Named Queries</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__NAMED_QUERIES = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 20;
-
- /**
- * The feature id for the '<em><b>Named Native Queries</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__NAMED_NATIVE_QUERIES = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 21;
-
- /**
- * The feature id for the '<em><b>Id Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY__ID_CLASS = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 22;
-
- /**
- * The number of structural features of the '<em>IEntity</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IENTITY_FEATURE_COUNT = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 23;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IEmbeddable <em>IEmbeddable</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IEmbeddable
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEmbeddable()
- * @generated
- */
- public static final int IEMBEDDABLE = 2;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IEMBEDDABLE__NAME = JpaCorePackage.ITYPE_MAPPING__NAME;
-
- /**
- * The feature id for the '<em><b>Table Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IEMBEDDABLE__TABLE_NAME = JpaCorePackage.ITYPE_MAPPING__TABLE_NAME;
-
- /**
- * The number of structural features of the '<em>IEmbeddable</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IEMBEDDABLE_FEATURE_COUNT = JpaCorePackage.ITYPE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.ITable <em>ITable</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.ITable
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITable()
- * @generated
- */
- public static final int ITABLE = 3;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE__NAME = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE__SPECIFIED_NAME = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE__DEFAULT_NAME = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE__CATALOG = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE__SPECIFIED_CATALOG = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE__DEFAULT_CATALOG = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE__SCHEMA = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE__SPECIFIED_SCHEMA = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE__DEFAULT_SCHEMA = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE__UNIQUE_CONSTRAINTS = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 9;
-
- /**
- * The number of structural features of the '<em>ITable</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_FEATURE_COUNT = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 10;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IUniqueConstraint <em>IUnique Constraint</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IUniqueConstraint
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIUniqueConstraint()
- * @generated
- */
- public static final int IUNIQUE_CONSTRAINT = 4;
-
- /**
- * The feature id for the '<em><b>Column Names</b></em>' attribute list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IUNIQUE_CONSTRAINT__COLUMN_NAMES = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>IUnique Constraint</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IUNIQUE_CONSTRAINT_FEATURE_COUNT = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.INamedColumn <em>INamed Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.INamedColumn
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINamedColumn()
- * @generated
- */
- public static final int INAMED_COLUMN = 5;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INAMED_COLUMN__NAME = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INAMED_COLUMN__SPECIFIED_NAME = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INAMED_COLUMN__DEFAULT_NAME = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INAMED_COLUMN__COLUMN_DEFINITION = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 3;
-
- /**
- * The number of structural features of the '<em>INamed Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INAMED_COLUMN_FEATURE_COUNT = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 4;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn <em>IAbstract Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractColumn
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAbstractColumn()
- * @generated
- */
- public static final int IABSTRACT_COLUMN = 6;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_COLUMN__NAME = INAMED_COLUMN__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_COLUMN__SPECIFIED_NAME = INAMED_COLUMN__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_COLUMN__DEFAULT_NAME = INAMED_COLUMN__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_COLUMN__COLUMN_DEFINITION = INAMED_COLUMN__COLUMN_DEFINITION;
-
- /**
- * The feature id for the '<em><b>Unique</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_COLUMN__UNIQUE = INAMED_COLUMN_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Nullable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_COLUMN__NULLABLE = INAMED_COLUMN_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Insertable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_COLUMN__INSERTABLE = INAMED_COLUMN_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Updatable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_COLUMN__UPDATABLE = INAMED_COLUMN_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_COLUMN__TABLE = INAMED_COLUMN_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_COLUMN__SPECIFIED_TABLE = INAMED_COLUMN_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_COLUMN__DEFAULT_TABLE = INAMED_COLUMN_FEATURE_COUNT + 6;
-
- /**
- * The number of structural features of the '<em>IAbstract Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_COLUMN_FEATURE_COUNT = INAMED_COLUMN_FEATURE_COUNT + 7;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IColumn <em>IColumn</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IColumn
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIColumn()
- * @generated
- */
- public static final int ICOLUMN = 7;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__NAME = IABSTRACT_COLUMN__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__SPECIFIED_NAME = IABSTRACT_COLUMN__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__DEFAULT_NAME = IABSTRACT_COLUMN__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__COLUMN_DEFINITION = IABSTRACT_COLUMN__COLUMN_DEFINITION;
-
- /**
- * The feature id for the '<em><b>Unique</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__UNIQUE = IABSTRACT_COLUMN__UNIQUE;
-
- /**
- * The feature id for the '<em><b>Nullable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__NULLABLE = IABSTRACT_COLUMN__NULLABLE;
-
- /**
- * The feature id for the '<em><b>Insertable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__INSERTABLE = IABSTRACT_COLUMN__INSERTABLE;
-
- /**
- * The feature id for the '<em><b>Updatable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__UPDATABLE = IABSTRACT_COLUMN__UPDATABLE;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__TABLE = IABSTRACT_COLUMN__TABLE;
-
- /**
- * The feature id for the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__SPECIFIED_TABLE = IABSTRACT_COLUMN__SPECIFIED_TABLE;
-
- /**
- * The feature id for the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__DEFAULT_TABLE = IABSTRACT_COLUMN__DEFAULT_TABLE;
-
- /**
- * The feature id for the '<em><b>Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__LENGTH = IABSTRACT_COLUMN_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__SPECIFIED_LENGTH = IABSTRACT_COLUMN_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Precision</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__PRECISION = IABSTRACT_COLUMN_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Specified Precision</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__SPECIFIED_PRECISION = IABSTRACT_COLUMN_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Scale</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__SCALE = IABSTRACT_COLUMN_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Specified Scale</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN__SPECIFIED_SCALE = IABSTRACT_COLUMN_FEATURE_COUNT + 5;
-
- /**
- * The number of structural features of the '<em>IColumn</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN_FEATURE_COUNT = IABSTRACT_COLUMN_FEATURE_COUNT + 6;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IColumnMapping <em>IColumn Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IColumnMapping
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIColumnMapping()
- * @generated
- */
- public static final int ICOLUMN_MAPPING = 8;
-
- /**
- * The number of structural features of the '<em>IColumn Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICOLUMN_MAPPING_FEATURE_COUNT = 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IBasic <em>IBasic</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IBasic
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIBasic()
- * @generated
- */
- public static final int IBASIC = 9;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IBASIC__FETCH = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IBASIC__OPTIONAL = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IBASIC__COLUMN = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Lob</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IBASIC__LOB = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Temporal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IBASIC__TEMPORAL = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Enumerated</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IBASIC__ENUMERATED = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The number of structural features of the '<em>IBasic</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IBASIC_FEATURE_COUNT = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 6;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IId <em>IId</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IId
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIId()
- * @generated
- */
- public static final int IID = 10;
-
- /**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IID__COLUMN = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Generated Value</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IID__GENERATED_VALUE = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Temporal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IID__TEMPORAL = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Table Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IID__TABLE_GENERATOR = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Sequence Generator</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IID__SEQUENCE_GENERATOR = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The number of structural features of the '<em>IId</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IID_FEATURE_COUNT = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.ITransient <em>ITransient</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.ITransient
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITransient()
- * @generated
- */
- public static final int ITRANSIENT = 11;
-
- /**
- * The number of structural features of the '<em>ITransient</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITRANSIENT_FEATURE_COUNT = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IVersion <em>IVersion</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IVersion
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIVersion()
- * @generated
- */
- public static final int IVERSION = 12;
-
- /**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IVERSION__COLUMN = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Temporal</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IVERSION__TEMPORAL = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>IVersion</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IVERSION_FEATURE_COUNT = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IEmbeddedId <em>IEmbedded Id</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IEmbeddedId
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEmbeddedId()
- * @generated
- */
- public static final int IEMBEDDED_ID = 13;
-
- /**
- * The number of structural features of the '<em>IEmbedded Id</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IEMBEDDED_ID_FEATURE_COUNT = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IEmbedded <em>IEmbedded</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IEmbedded
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEmbedded()
- * @generated
- */
- public static final int IEMBEDDED = 14;
-
- /**
- * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IEMBEDDED__ATTRIBUTE_OVERRIDES = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IEMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Attribute Overrides</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IEMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>IEmbedded</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IEMBEDDED_FEATURE_COUNT = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping <em>IRelationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IRelationshipMapping
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIRelationshipMapping()
- * @generated
- */
- public static final int IRELATIONSHIP_MAPPING = 15;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IRELATIONSHIP_MAPPING__TARGET_ENTITY = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IRELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IRELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IRELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IRELATIONSHIP_MAPPING__CASCADE = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The number of structural features of the '<em>IRelationship Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IRELATIONSHIP_MAPPING_FEATURE_COUNT = JpaCorePackage.IATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.INonOwningMapping <em>INon Owning Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.INonOwningMapping
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINonOwningMapping()
- * @generated
- */
- public static final int INON_OWNING_MAPPING = 16;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INON_OWNING_MAPPING__TARGET_ENTITY = IRELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INON_OWNING_MAPPING__SPECIFIED_TARGET_ENTITY = IRELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INON_OWNING_MAPPING__DEFAULT_TARGET_ENTITY = IRELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INON_OWNING_MAPPING__RESOLVED_TARGET_ENTITY = IRELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INON_OWNING_MAPPING__CASCADE = IRELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INON_OWNING_MAPPING__MAPPED_BY = IRELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>INon Owning Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INON_OWNING_MAPPING_FEATURE_COUNT = IRELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping <em>IMulti Relationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIMultiRelationshipMapping()
- * @generated
- */
- public static final int IMULTI_RELATIONSHIP_MAPPING = 17;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMULTI_RELATIONSHIP_MAPPING__TARGET_ENTITY = INON_OWNING_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMULTI_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY = INON_OWNING_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMULTI_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY = INON_OWNING_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMULTI_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY = INON_OWNING_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMULTI_RELATIONSHIP_MAPPING__CASCADE = INON_OWNING_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMULTI_RELATIONSHIP_MAPPING__MAPPED_BY = INON_OWNING_MAPPING__MAPPED_BY;
-
- /**
- * The feature id for the '<em><b>Order By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMULTI_RELATIONSHIP_MAPPING__ORDER_BY = INON_OWNING_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMULTI_RELATIONSHIP_MAPPING__FETCH = INON_OWNING_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Join Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMULTI_RELATIONSHIP_MAPPING__JOIN_TABLE = INON_OWNING_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Map Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMULTI_RELATIONSHIP_MAPPING__MAP_KEY = INON_OWNING_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The number of structural features of the '<em>IMulti Relationship Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT = INON_OWNING_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IOneToMany <em>IOne To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IOneToMany
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIOneToMany()
- * @generated
- */
- public static final int IONE_TO_MANY = 18;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_MANY__TARGET_ENTITY = IMULTI_RELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_MANY__SPECIFIED_TARGET_ENTITY = IMULTI_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_MANY__DEFAULT_TARGET_ENTITY = IMULTI_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_MANY__RESOLVED_TARGET_ENTITY = IMULTI_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_MANY__CASCADE = IMULTI_RELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_MANY__MAPPED_BY = IMULTI_RELATIONSHIP_MAPPING__MAPPED_BY;
-
- /**
- * The feature id for the '<em><b>Order By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_MANY__ORDER_BY = IMULTI_RELATIONSHIP_MAPPING__ORDER_BY;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_MANY__FETCH = IMULTI_RELATIONSHIP_MAPPING__FETCH;
-
- /**
- * The feature id for the '<em><b>Join Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_MANY__JOIN_TABLE = IMULTI_RELATIONSHIP_MAPPING__JOIN_TABLE;
-
- /**
- * The feature id for the '<em><b>Map Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_MANY__MAP_KEY = IMULTI_RELATIONSHIP_MAPPING__MAP_KEY;
-
- /**
- * The number of structural features of the '<em>IOne To Many</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_MANY_FEATURE_COUNT = IMULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IManyToMany <em>IMany To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IManyToMany
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIManyToMany()
- * @generated
- */
- public static final int IMANY_TO_MANY = 19;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_MANY__TARGET_ENTITY = IMULTI_RELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_MANY__SPECIFIED_TARGET_ENTITY = IMULTI_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_MANY__DEFAULT_TARGET_ENTITY = IMULTI_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_MANY__RESOLVED_TARGET_ENTITY = IMULTI_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_MANY__CASCADE = IMULTI_RELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_MANY__MAPPED_BY = IMULTI_RELATIONSHIP_MAPPING__MAPPED_BY;
-
- /**
- * The feature id for the '<em><b>Order By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_MANY__ORDER_BY = IMULTI_RELATIONSHIP_MAPPING__ORDER_BY;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_MANY__FETCH = IMULTI_RELATIONSHIP_MAPPING__FETCH;
-
- /**
- * The feature id for the '<em><b>Join Table</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_MANY__JOIN_TABLE = IMULTI_RELATIONSHIP_MAPPING__JOIN_TABLE;
-
- /**
- * The feature id for the '<em><b>Map Key</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_MANY__MAP_KEY = IMULTI_RELATIONSHIP_MAPPING__MAP_KEY;
-
- /**
- * The number of structural features of the '<em>IMany To Many</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_MANY_FEATURE_COUNT = IMULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping <em>ISingle Relationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISingleRelationshipMapping()
- * @generated
- */
- public static final int ISINGLE_RELATIONSHIP_MAPPING = 20;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISINGLE_RELATIONSHIP_MAPPING__TARGET_ENTITY = IRELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISINGLE_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY = IRELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISINGLE_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY = IRELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISINGLE_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY = IRELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISINGLE_RELATIONSHIP_MAPPING__CASCADE = IRELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISINGLE_RELATIONSHIP_MAPPING__FETCH = IRELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS = IRELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS = IRELATIONSHIP_MAPPING_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS = IRELATIONSHIP_MAPPING_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISINGLE_RELATIONSHIP_MAPPING__OPTIONAL = IRELATIONSHIP_MAPPING_FEATURE_COUNT + 4;
-
- /**
- * The number of structural features of the '<em>ISingle Relationship Mapping</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT = IRELATIONSHIP_MAPPING_FEATURE_COUNT + 5;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IManyToOne <em>IMany To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IManyToOne
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIManyToOne()
- * @generated
- */
- public static final int IMANY_TO_ONE = 21;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_ONE__TARGET_ENTITY = ISINGLE_RELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_ONE__SPECIFIED_TARGET_ENTITY = ISINGLE_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_ONE__DEFAULT_TARGET_ENTITY = ISINGLE_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_ONE__RESOLVED_TARGET_ENTITY = ISINGLE_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_ONE__CASCADE = ISINGLE_RELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_ONE__FETCH = ISINGLE_RELATIONSHIP_MAPPING__FETCH;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_ONE__JOIN_COLUMNS = ISINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_ONE__SPECIFIED_JOIN_COLUMNS = ISINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_ONE__DEFAULT_JOIN_COLUMNS = ISINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_ONE__OPTIONAL = ISINGLE_RELATIONSHIP_MAPPING__OPTIONAL;
-
- /**
- * The number of structural features of the '<em>IMany To One</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IMANY_TO_ONE_FEATURE_COUNT = ISINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IOneToOne <em>IOne To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IOneToOne
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIOneToOne()
- * @generated
- */
- public static final int IONE_TO_ONE = 22;
-
- /**
- * The feature id for the '<em><b>Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_ONE__TARGET_ENTITY = ISINGLE_RELATIONSHIP_MAPPING__TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Specified Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_ONE__SPECIFIED_TARGET_ENTITY = ISINGLE_RELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Default Target Entity</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_ONE__DEFAULT_TARGET_ENTITY = ISINGLE_RELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Resolved Target Entity</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_ONE__RESOLVED_TARGET_ENTITY = ISINGLE_RELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY;
-
- /**
- * The feature id for the '<em><b>Cascade</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_ONE__CASCADE = ISINGLE_RELATIONSHIP_MAPPING__CASCADE;
-
- /**
- * The feature id for the '<em><b>Fetch</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_ONE__FETCH = ISINGLE_RELATIONSHIP_MAPPING__FETCH;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_ONE__JOIN_COLUMNS = ISINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_ONE__SPECIFIED_JOIN_COLUMNS = ISINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_ONE__DEFAULT_JOIN_COLUMNS = ISINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS;
-
- /**
- * The feature id for the '<em><b>Optional</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_ONE__OPTIONAL = ISINGLE_RELATIONSHIP_MAPPING__OPTIONAL;
-
- /**
- * The feature id for the '<em><b>Mapped By</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_ONE__MAPPED_BY = ISINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>IOne To One</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IONE_TO_ONE_FEATURE_COUNT = ISINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IJoinTable <em>IJoin Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IJoinTable
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIJoinTable()
- * @generated
- */
- public static final int IJOIN_TABLE = 23;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE__NAME = ITABLE__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE__SPECIFIED_NAME = ITABLE__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE__DEFAULT_NAME = ITABLE__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE__CATALOG = ITABLE__CATALOG;
-
- /**
- * The feature id for the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE__SPECIFIED_CATALOG = ITABLE__SPECIFIED_CATALOG;
-
- /**
- * The feature id for the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE__DEFAULT_CATALOG = ITABLE__DEFAULT_CATALOG;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE__SCHEMA = ITABLE__SCHEMA;
-
- /**
- * The feature id for the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE__SPECIFIED_SCHEMA = ITABLE__SPECIFIED_SCHEMA;
-
- /**
- * The feature id for the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE__DEFAULT_SCHEMA = ITABLE__DEFAULT_SCHEMA;
-
- /**
- * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE__UNIQUE_CONSTRAINTS = ITABLE__UNIQUE_CONSTRAINTS;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE__JOIN_COLUMNS = ITABLE_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE__SPECIFIED_JOIN_COLUMNS = ITABLE_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE__DEFAULT_JOIN_COLUMNS = ITABLE_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Inverse Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE__INVERSE_JOIN_COLUMNS = ITABLE_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Specified Inverse Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS = ITABLE_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Default Inverse Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS = ITABLE_FEATURE_COUNT + 5;
-
- /**
- * The number of structural features of the '<em>IJoin Table</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_TABLE_FEATURE_COUNT = ITABLE_FEATURE_COUNT + 6;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn <em>IAbstract Join Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAbstractJoinColumn()
- * @generated
- */
- public static final int IABSTRACT_JOIN_COLUMN = 24;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_JOIN_COLUMN__NAME = INAMED_COLUMN__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_JOIN_COLUMN__SPECIFIED_NAME = INAMED_COLUMN__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_JOIN_COLUMN__DEFAULT_NAME = INAMED_COLUMN__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_JOIN_COLUMN__COLUMN_DEFINITION = INAMED_COLUMN__COLUMN_DEFINITION;
-
- /**
- * The feature id for the '<em><b>Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_JOIN_COLUMN__REFERENCED_COLUMN_NAME = INAMED_COLUMN_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME = INAMED_COLUMN_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME = INAMED_COLUMN_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>IAbstract Join Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IABSTRACT_JOIN_COLUMN_FEATURE_COUNT = INAMED_COLUMN_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IJoinColumn <em>IJoin Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IJoinColumn
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIJoinColumn()
- * @generated
- */
- public static final int IJOIN_COLUMN = 25;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_COLUMN__NAME = IABSTRACT_COLUMN__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_COLUMN__SPECIFIED_NAME = IABSTRACT_COLUMN__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_COLUMN__DEFAULT_NAME = IABSTRACT_COLUMN__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_COLUMN__COLUMN_DEFINITION = IABSTRACT_COLUMN__COLUMN_DEFINITION;
-
- /**
- * The feature id for the '<em><b>Unique</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_COLUMN__UNIQUE = IABSTRACT_COLUMN__UNIQUE;
-
- /**
- * The feature id for the '<em><b>Nullable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_COLUMN__NULLABLE = IABSTRACT_COLUMN__NULLABLE;
-
- /**
- * The feature id for the '<em><b>Insertable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_COLUMN__INSERTABLE = IABSTRACT_COLUMN__INSERTABLE;
-
- /**
- * The feature id for the '<em><b>Updatable</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_COLUMN__UPDATABLE = IABSTRACT_COLUMN__UPDATABLE;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_COLUMN__TABLE = IABSTRACT_COLUMN__TABLE;
-
- /**
- * The feature id for the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_COLUMN__SPECIFIED_TABLE = IABSTRACT_COLUMN__SPECIFIED_TABLE;
-
- /**
- * The feature id for the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_COLUMN__DEFAULT_TABLE = IABSTRACT_COLUMN__DEFAULT_TABLE;
-
- /**
- * The feature id for the '<em><b>Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_COLUMN__REFERENCED_COLUMN_NAME = IABSTRACT_COLUMN_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME = IABSTRACT_COLUMN_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME = IABSTRACT_COLUMN_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>IJoin Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IJOIN_COLUMN_FEATURE_COUNT = IABSTRACT_COLUMN_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IOverride <em>IOverride</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IOverride
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIOverride()
- * @generated
- */
- public static final int IOVERRIDE = 26;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IOVERRIDE__NAME = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>IOverride</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IOVERRIDE_FEATURE_COUNT = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride <em>IAttribute Override</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IAttributeOverride
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAttributeOverride()
- * @generated
- */
- public static final int IATTRIBUTE_OVERRIDE = 27;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IATTRIBUTE_OVERRIDE__NAME = IOVERRIDE__NAME;
-
- /**
- * The feature id for the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IATTRIBUTE_OVERRIDE__COLUMN = IOVERRIDE_FEATURE_COUNT + 0;
-
- /**
- * The number of structural features of the '<em>IAttribute Override</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IATTRIBUTE_OVERRIDE_FEATURE_COUNT = IOVERRIDE_FEATURE_COUNT + 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride <em>IAssociation Override</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IAssociationOverride
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAssociationOverride()
- * @generated
- */
- public static final int IASSOCIATION_OVERRIDE = 28;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IASSOCIATION_OVERRIDE__NAME = IOVERRIDE__NAME;
-
- /**
- * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IASSOCIATION_OVERRIDE__JOIN_COLUMNS = IOVERRIDE_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS = IOVERRIDE_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS = IOVERRIDE_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>IAssociation Override</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IASSOCIATION_OVERRIDE_FEATURE_COUNT = IOVERRIDE_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn <em>IDiscriminator Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIDiscriminatorColumn()
- * @generated
- */
- public static final int IDISCRIMINATOR_COLUMN = 29;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IDISCRIMINATOR_COLUMN__NAME = INAMED_COLUMN__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IDISCRIMINATOR_COLUMN__SPECIFIED_NAME = INAMED_COLUMN__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IDISCRIMINATOR_COLUMN__DEFAULT_NAME = INAMED_COLUMN__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IDISCRIMINATOR_COLUMN__COLUMN_DEFINITION = INAMED_COLUMN__COLUMN_DEFINITION;
-
- /**
- * The feature id for the '<em><b>Discriminator Type</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IDISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE = INAMED_COLUMN_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Default Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IDISCRIMINATOR_COLUMN__DEFAULT_LENGTH = INAMED_COLUMN_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Specified Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IDISCRIMINATOR_COLUMN__SPECIFIED_LENGTH = INAMED_COLUMN_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Length</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IDISCRIMINATOR_COLUMN__LENGTH = INAMED_COLUMN_FEATURE_COUNT + 3;
-
- /**
- * The number of structural features of the '<em>IDiscriminator Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IDISCRIMINATOR_COLUMN_FEATURE_COUNT = INAMED_COLUMN_FEATURE_COUNT + 4;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable <em>ISecondary Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.ISecondaryTable
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISecondaryTable()
- * @generated
- */
- public static final int ISECONDARY_TABLE = 30;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISECONDARY_TABLE__NAME = ITABLE__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISECONDARY_TABLE__SPECIFIED_NAME = ITABLE__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISECONDARY_TABLE__DEFAULT_NAME = ITABLE__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISECONDARY_TABLE__CATALOG = ITABLE__CATALOG;
-
- /**
- * The feature id for the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISECONDARY_TABLE__SPECIFIED_CATALOG = ITABLE__SPECIFIED_CATALOG;
-
- /**
- * The feature id for the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISECONDARY_TABLE__DEFAULT_CATALOG = ITABLE__DEFAULT_CATALOG;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISECONDARY_TABLE__SCHEMA = ITABLE__SCHEMA;
-
- /**
- * The feature id for the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISECONDARY_TABLE__SPECIFIED_SCHEMA = ITABLE__SPECIFIED_SCHEMA;
-
- /**
- * The feature id for the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISECONDARY_TABLE__DEFAULT_SCHEMA = ITABLE__DEFAULT_SCHEMA;
-
- /**
- * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISECONDARY_TABLE__UNIQUE_CONSTRAINTS = ITABLE__UNIQUE_CONSTRAINTS;
-
- /**
- * The feature id for the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS = ITABLE_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS = ITABLE_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Primary Key Join Columns</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS = ITABLE_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>ISecondary Table</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISECONDARY_TABLE_FEATURE_COUNT = ITABLE_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn <em>IPrimary Key Join Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIPrimaryKeyJoinColumn()
- * @generated
- */
- public static final int IPRIMARY_KEY_JOIN_COLUMN = 31;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IPRIMARY_KEY_JOIN_COLUMN__NAME = IABSTRACT_JOIN_COLUMN__NAME;
-
- /**
- * The feature id for the '<em><b>Specified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IPRIMARY_KEY_JOIN_COLUMN__SPECIFIED_NAME = IABSTRACT_JOIN_COLUMN__SPECIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Default Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IPRIMARY_KEY_JOIN_COLUMN__DEFAULT_NAME = IABSTRACT_JOIN_COLUMN__DEFAULT_NAME;
-
- /**
- * The feature id for the '<em><b>Column Definition</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IPRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION = IABSTRACT_JOIN_COLUMN__COLUMN_DEFINITION;
-
- /**
- * The feature id for the '<em><b>Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IPRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME = IABSTRACT_JOIN_COLUMN__REFERENCED_COLUMN_NAME;
-
- /**
- * The feature id for the '<em><b>Specified Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IPRIMARY_KEY_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME = IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME;
-
- /**
- * The feature id for the '<em><b>Default Referenced Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IPRIMARY_KEY_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME = IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME;
-
- /**
- * The number of structural features of the '<em>IPrimary Key Join Column</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IPRIMARY_KEY_JOIN_COLUMN_FEATURE_COUNT = IABSTRACT_JOIN_COLUMN_FEATURE_COUNT + 0;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IGenerator <em>IGenerator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IGenerator
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIGenerator()
- * @generated
- */
- public static final int IGENERATOR = 32;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IGENERATOR__NAME = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IGENERATOR__INITIAL_VALUE = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Specified Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IGENERATOR__SPECIFIED_INITIAL_VALUE = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Default Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IGENERATOR__DEFAULT_INITIAL_VALUE = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IGENERATOR__ALLOCATION_SIZE = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Specified Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IGENERATOR__SPECIFIED_ALLOCATION_SIZE = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Default Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IGENERATOR__DEFAULT_ALLOCATION_SIZE = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 6;
-
- /**
- * The number of structural features of the '<em>IGenerator</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IGENERATOR_FEATURE_COUNT = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 7;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator <em>ITable Generator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator()
- * @generated
- */
- public static final int ITABLE_GENERATOR = 33;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__NAME = IGENERATOR__NAME;
-
- /**
- * The feature id for the '<em><b>Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__INITIAL_VALUE = IGENERATOR__INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Specified Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__SPECIFIED_INITIAL_VALUE = IGENERATOR__SPECIFIED_INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Default Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__DEFAULT_INITIAL_VALUE = IGENERATOR__DEFAULT_INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__ALLOCATION_SIZE = IGENERATOR__ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Specified Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__SPECIFIED_ALLOCATION_SIZE = IGENERATOR__SPECIFIED_ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Default Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__DEFAULT_ALLOCATION_SIZE = IGENERATOR__DEFAULT_ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__TABLE = IGENERATOR_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__SPECIFIED_TABLE = IGENERATOR_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Table</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__DEFAULT_TABLE = IGENERATOR_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__CATALOG = IGENERATOR_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Specified Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__SPECIFIED_CATALOG = IGENERATOR_FEATURE_COUNT + 4;
-
- /**
- * The feature id for the '<em><b>Default Catalog</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__DEFAULT_CATALOG = IGENERATOR_FEATURE_COUNT + 5;
-
- /**
- * The feature id for the '<em><b>Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__SCHEMA = IGENERATOR_FEATURE_COUNT + 6;
-
- /**
- * The feature id for the '<em><b>Specified Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__SPECIFIED_SCHEMA = IGENERATOR_FEATURE_COUNT + 7;
-
- /**
- * The feature id for the '<em><b>Default Schema</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__DEFAULT_SCHEMA = IGENERATOR_FEATURE_COUNT + 8;
-
- /**
- * The feature id for the '<em><b>Pk Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__PK_COLUMN_NAME = IGENERATOR_FEATURE_COUNT + 9;
-
- /**
- * The feature id for the '<em><b>Specified Pk Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME = IGENERATOR_FEATURE_COUNT + 10;
-
- /**
- * The feature id for the '<em><b>Default Pk Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME = IGENERATOR_FEATURE_COUNT + 11;
-
- /**
- * The feature id for the '<em><b>Value Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__VALUE_COLUMN_NAME = IGENERATOR_FEATURE_COUNT + 12;
-
- /**
- * The feature id for the '<em><b>Specified Value Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME = IGENERATOR_FEATURE_COUNT + 13;
-
- /**
- * The feature id for the '<em><b>Default Value Column Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME = IGENERATOR_FEATURE_COUNT + 14;
-
- /**
- * The feature id for the '<em><b>Pk Column Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__PK_COLUMN_VALUE = IGENERATOR_FEATURE_COUNT + 15;
-
- /**
- * The feature id for the '<em><b>Specified Pk Column Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE = IGENERATOR_FEATURE_COUNT + 16;
-
- /**
- * The feature id for the '<em><b>Default Pk Column Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE = IGENERATOR_FEATURE_COUNT + 17;
-
- /**
- * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR__UNIQUE_CONSTRAINTS = IGENERATOR_FEATURE_COUNT + 18;
-
- /**
- * The number of structural features of the '<em>ITable Generator</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ITABLE_GENERATOR_FEATURE_COUNT = IGENERATOR_FEATURE_COUNT + 19;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.ISequenceGenerator <em>ISequence Generator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.ISequenceGenerator
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISequenceGenerator()
- * @generated
- */
- public static final int ISEQUENCE_GENERATOR = 34;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISEQUENCE_GENERATOR__NAME = IGENERATOR__NAME;
-
- /**
- * The feature id for the '<em><b>Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISEQUENCE_GENERATOR__INITIAL_VALUE = IGENERATOR__INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Specified Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISEQUENCE_GENERATOR__SPECIFIED_INITIAL_VALUE = IGENERATOR__SPECIFIED_INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Default Initial Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISEQUENCE_GENERATOR__DEFAULT_INITIAL_VALUE = IGENERATOR__DEFAULT_INITIAL_VALUE;
-
- /**
- * The feature id for the '<em><b>Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISEQUENCE_GENERATOR__ALLOCATION_SIZE = IGENERATOR__ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Specified Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISEQUENCE_GENERATOR__SPECIFIED_ALLOCATION_SIZE = IGENERATOR__SPECIFIED_ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Default Allocation Size</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISEQUENCE_GENERATOR__DEFAULT_ALLOCATION_SIZE = IGENERATOR__DEFAULT_ALLOCATION_SIZE;
-
- /**
- * The feature id for the '<em><b>Sequence Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISEQUENCE_GENERATOR__SEQUENCE_NAME = IGENERATOR_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Specified Sequence Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME = IGENERATOR_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Default Sequence Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME = IGENERATOR_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>ISequence Generator</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ISEQUENCE_GENERATOR_FEATURE_COUNT = IGENERATOR_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IGeneratedValue <em>IGenerated Value</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IGeneratedValue
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIGeneratedValue()
- * @generated
- */
- public static final int IGENERATED_VALUE = 35;
-
- /**
- * The feature id for the '<em><b>Strategy</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IGENERATED_VALUE__STRATEGY = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Generator</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IGENERATED_VALUE__GENERATOR = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>IGenerated Value</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IGENERATED_VALUE_FEATURE_COUNT = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IQuery <em>IQuery</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IQuery
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIQuery()
- * @generated
- */
- public static final int IQUERY = 36;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IQUERY__NAME = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Query</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IQUERY__QUERY = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Hints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IQUERY__HINTS = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>IQuery</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IQUERY_FEATURE_COUNT = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.INamedQuery <em>INamed Query</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.INamedQuery
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINamedQuery()
- * @generated
- */
- public static final int INAMED_QUERY = 37;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INAMED_QUERY__NAME = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Query</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INAMED_QUERY__QUERY = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Hints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INAMED_QUERY__HINTS = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>INamed Query</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INAMED_QUERY_FEATURE_COUNT = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.INamedNativeQuery <em>INamed Native Query</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.INamedNativeQuery
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINamedNativeQuery()
- * @generated
- */
- public static final int INAMED_NATIVE_QUERY = 38;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INAMED_NATIVE_QUERY__NAME = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Query</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INAMED_NATIVE_QUERY__QUERY = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Hints</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INAMED_NATIVE_QUERY__HINTS = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Result Class</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INAMED_NATIVE_QUERY__RESULT_CLASS = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Result Set Mapping</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INAMED_NATIVE_QUERY__RESULT_SET_MAPPING = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 4;
-
- /**
- * The number of structural features of the '<em>INamed Native Query</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int INAMED_NATIVE_QUERY_FEATURE_COUNT = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 5;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.IQueryHint <em>IQuery Hint</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IQueryHint
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIQueryHint()
- * @generated
- */
- public static final int IQUERY_HINT = 39;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IQUERY_HINT__NAME = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Value</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IQUERY_HINT__VALUE = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 1;
-
- /**
- * The number of structural features of the '<em>IQuery Hint</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int IQUERY_HINT_FEATURE_COUNT = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.ICascade <em>ICascade</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.ICascade
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getICascade()
- * @generated
- */
- public static final int ICASCADE = 40;
-
- /**
- * The feature id for the '<em><b>All</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICASCADE__ALL = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Persist</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICASCADE__PERSIST = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>Merge</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICASCADE__MERGE = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 2;
-
- /**
- * The feature id for the '<em><b>Remove</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICASCADE__REMOVE = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 3;
-
- /**
- * The feature id for the '<em><b>Refresh</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICASCADE__REFRESH = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 4;
-
- /**
- * The number of structural features of the '<em>ICascade</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- public static final int ICASCADE_FEATURE_COUNT = JpaCorePackage.IJPA_SOURCE_OBJECT_FEATURE_COUNT + 5;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType <em>Default Eager Fetch Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getDefaultEagerFetchType()
- * @generated
- */
- public static final int DEFAULT_EAGER_FETCH_TYPE = 41;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType <em>Default Lazy Fetch Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getDefaultLazyFetchType()
- * @generated
- */
- public static final int DEFAULT_LAZY_FETCH_TYPE = 42;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean <em>Default False Boolean</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getDefaultFalseBoolean()
- * @generated
- */
- public static final int DEFAULT_FALSE_BOOLEAN = 43;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean <em>Default True Boolean</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getDefaultTrueBoolean()
- * @generated
- */
- public static final int DEFAULT_TRUE_BOOLEAN = 44;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.TemporalType <em>Temporal Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getTemporalType()
- * @generated
- */
- public static final int TEMPORAL_TYPE = 45;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.InheritanceType <em>Inheritance Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.InheritanceType
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getInheritanceType()
- * @generated
- */
- public static final int INHERITANCE_TYPE = 46;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.DiscriminatorType <em>Discriminator Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.DiscriminatorType
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getDiscriminatorType()
- * @generated
- */
- public static final int DISCRIMINATOR_TYPE = 47;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.GenerationType <em>Generation Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.GenerationType
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getGenerationType()
- * @generated
- */
- public static final int GENERATION_TYPE = 48;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.EnumType <em>Enum Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.EnumType
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getEnumType()
- * @generated
- */
- public static final int ENUM_TYPE = 49;
-
- /**
- * The meta object id for the '{@link org.eclipse.jpt.core.internal.mappings.CascadeType <em>Cascade Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.CascadeType
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getCascadeType()
- * @generated
- */
- public static final int CASCADE_TYPE = 50;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iMappedSuperclassEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iEntityEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iEmbeddableEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iTableEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iUniqueConstraintEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iNamedColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iAbstractColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iColumnMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iBasicEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iIdEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iTransientEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iVersionEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iEmbeddedIdEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iEmbeddedEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iRelationshipMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iNonOwningMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iMultiRelationshipMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iOneToManyEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iManyToManyEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iSingleRelationshipMappingEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iManyToOneEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iOneToOneEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJoinTableEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iAbstractJoinColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iJoinColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iOverrideEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iAttributeOverrideEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iAssociationOverrideEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iDiscriminatorColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iSecondaryTableEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iPrimaryKeyJoinColumnEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iGeneratorEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iTableGeneratorEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iSequenceGeneratorEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iGeneratedValueEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iQueryEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iNamedQueryEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iNamedNativeQueryEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iQueryHintEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass iCascadeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EEnum defaultEagerFetchTypeEEnum = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EEnum defaultLazyFetchTypeEEnum = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EEnum defaultFalseBooleanEEnum = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EEnum defaultTrueBooleanEEnum = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EEnum temporalTypeEEnum = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EEnum inheritanceTypeEEnum = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EEnum discriminatorTypeEEnum = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EEnum generationTypeEEnum = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EEnum enumTypeEEnum = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EEnum cascadeTypeEEnum = null;
-
- /**
- * Creates an instance of the model <b>Package</b>, registered with
- * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
- * package URI value.
- * <p>Note: the correct way to create the package is via the static
- * factory method {@link #init init()}, which also performs
- * initialization of the package, or returns the registered package,
- * if one already exists.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.ecore.EPackage.Registry
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#eNS_URI
- * @see #init()
- * @generated
- */
- private JpaCoreMappingsPackage() {
- super(eNS_URI, JpaCoreMappingsFactory.eINSTANCE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static boolean isInited = false;
-
- /**
- * Creates, registers, and initializes the <b>Package</b> for this
- * model, and for any others upon which it depends. Simple
- * dependencies are satisfied by calling this method on all
- * dependent packages before doing anything else. This method drives
- * initialization for interdependent packages directly, in parallel
- * with this package, itself.
- * <p>Of this package and its interdependencies, all packages which
- * have not yet been registered by their URI values are first created
- * and registered. The packages are then initialized in two steps:
- * meta-model objects for all of the packages are created before any
- * are initialized, since one package's meta-model objects may refer to
- * those of another.
- * <p>Invocation of this method will not affect any packages that have
- * already been initialized.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #eNS_URI
- * @see #createPackageContents()
- * @see #initializePackageContents()
- * @generated
- */
- public static JpaCoreMappingsPackage init() {
- if (isInited)
- return (JpaCoreMappingsPackage) EPackage.Registry.INSTANCE.getEPackage(JpaCoreMappingsPackage.eNS_URI);
- // Obtain or create and register package
- JpaCoreMappingsPackage theJpaCoreMappingsPackage = (JpaCoreMappingsPackage) (EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof JpaCoreMappingsPackage ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new JpaCoreMappingsPackage());
- isInited = true;
- // Initialize simple dependencies
- EcorePackage.eINSTANCE.eClass();
- // Obtain or create and register interdependencies
- JpaCorePackage theJpaCorePackage = (JpaCorePackage) (EPackage.Registry.INSTANCE.getEPackage(JpaCorePackage.eNS_URI) instanceof JpaCorePackage ? EPackage.Registry.INSTANCE.getEPackage(JpaCorePackage.eNS_URI) : JpaCorePackage.eINSTANCE);
- JpaJavaPackage theJpaJavaPackage = (JpaJavaPackage) (EPackage.Registry.INSTANCE.getEPackage(JpaJavaPackage.eNS_URI) instanceof JpaJavaPackage ? EPackage.Registry.INSTANCE.getEPackage(JpaJavaPackage.eNS_URI) : JpaJavaPackage.eINSTANCE);
- JpaJavaMappingsPackage theJpaJavaMappingsPackage = (JpaJavaMappingsPackage) (EPackage.Registry.INSTANCE.getEPackage(JpaJavaMappingsPackage.eNS_URI) instanceof JpaJavaMappingsPackage ? EPackage.Registry.INSTANCE.getEPackage(JpaJavaMappingsPackage.eNS_URI) : JpaJavaMappingsPackage.eINSTANCE);
- OrmPackage theOrmPackage = (OrmPackage) (EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) instanceof OrmPackage ? EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) : OrmPackage.eINSTANCE);
- PersistencePackage thePersistencePackage = (PersistencePackage) (EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI) instanceof PersistencePackage ? EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI) : PersistencePackage.eINSTANCE);
- // Create package meta-data objects
- theJpaCoreMappingsPackage.createPackageContents();
- theJpaCorePackage.createPackageContents();
- theJpaJavaPackage.createPackageContents();
- theJpaJavaMappingsPackage.createPackageContents();
- theOrmPackage.createPackageContents();
- thePersistencePackage.createPackageContents();
- // Initialize created meta-data
- theJpaCoreMappingsPackage.initializePackageContents();
- theJpaCorePackage.initializePackageContents();
- theJpaJavaPackage.initializePackageContents();
- theJpaJavaMappingsPackage.initializePackageContents();
- theOrmPackage.initializePackageContents();
- thePersistencePackage.initializePackageContents();
- // Mark meta-data to indicate it can't be changed
- theJpaCoreMappingsPackage.freeze();
- return theJpaCoreMappingsPackage;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IMappedSuperclass <em>IMapped Superclass</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IMapped Superclass</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IMappedSuperclass
- * @generated
- */
- public EClass getIMappedSuperclass() {
- return iMappedSuperclassEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IMappedSuperclass#getIdClass <em>Id Class</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Id Class</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IMappedSuperclass#getIdClass()
- * @see #getIMappedSuperclass()
- * @generated
- */
- public EAttribute getIMappedSuperclass_IdClass() {
- return (EAttribute) iMappedSuperclassEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IEntity <em>IEntity</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IEntity</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity
- * @generated
- */
- public EClass getIEntity() {
- return iEntityEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedName <em>Specified Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedName()
- * @see #getIEntity()
- * @generated
- */
- public EAttribute getIEntity_SpecifiedName() {
- return (EAttribute) iEntityEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getDefaultName <em>Default Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getDefaultName()
- * @see #getIEntity()
- * @generated
- */
- public EAttribute getIEntity_DefaultName() {
- return (EAttribute) iEntityEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getTable <em>Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Table</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getTable()
- * @see #getIEntity()
- * @generated
- */
- public EReference getIEntity_Table() {
- return (EReference) iEntityEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedSecondaryTables <em>Specified Secondary Tables</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Specified Secondary Tables</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedSecondaryTables()
- * @see #getIEntity()
- * @generated
- */
- public EReference getIEntity_SpecifiedSecondaryTables() {
- return (EReference) iEntityEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getInheritanceStrategy <em>Inheritance Strategy</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Inheritance Strategy</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getInheritanceStrategy()
- * @see #getIEntity()
- * @generated
- */
- public EAttribute getIEntity_InheritanceStrategy() {
- return (EAttribute) iEntityEClass.getEStructuralFeatures().get(7);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getDiscriminatorColumn <em>Discriminator Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Discriminator Column</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getDiscriminatorColumn()
- * @see #getIEntity()
- * @generated
- */
- public EReference getIEntity_DiscriminatorColumn() {
- return (EReference) iEntityEClass.getEStructuralFeatures().get(11);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSequenceGenerator <em>Sequence Generator</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Sequence Generator</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getSequenceGenerator()
- * @see #getIEntity()
- * @generated
- */
- public EReference getIEntity_SequenceGenerator() {
- return (EReference) iEntityEClass.getEStructuralFeatures().get(12);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getTableGenerator <em>Table Generator</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Table Generator</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getTableGenerator()
- * @see #getIEntity()
- * @generated
- */
- public EReference getIEntity_TableGenerator() {
- return (EReference) iEntityEClass.getEStructuralFeatures().get(13);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getDefaultDiscriminatorValue <em>Default Discriminator Value</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Discriminator Value</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getDefaultDiscriminatorValue()
- * @see #getIEntity()
- * @generated
- */
- public EAttribute getIEntity_DefaultDiscriminatorValue() {
- return (EAttribute) iEntityEClass.getEStructuralFeatures().get(8);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedDiscriminatorValue <em>Specified Discriminator Value</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Discriminator Value</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedDiscriminatorValue()
- * @see #getIEntity()
- * @generated
- */
- public EAttribute getIEntity_SpecifiedDiscriminatorValue() {
- return (EAttribute) iEntityEClass.getEStructuralFeatures().get(9);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getDiscriminatorValue <em>Discriminator Value</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Discriminator Value</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getDiscriminatorValue()
- * @see #getIEntity()
- * @generated
- */
- public EAttribute getIEntity_DiscriminatorValue() {
- return (EAttribute) iEntityEClass.getEStructuralFeatures().get(10);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getPrimaryKeyJoinColumns <em>Primary Key Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Primary Key Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getPrimaryKeyJoinColumns()
- * @see #getIEntity()
- * @generated
- */
- public EReference getIEntity_PrimaryKeyJoinColumns() {
- return (EReference) iEntityEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedPrimaryKeyJoinColumns <em>Specified Primary Key Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Specified Primary Key Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedPrimaryKeyJoinColumns()
- * @see #getIEntity()
- * @generated
- */
- public EReference getIEntity_SpecifiedPrimaryKeyJoinColumns() {
- return (EReference) iEntityEClass.getEStructuralFeatures().get(5);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getDefaultPrimaryKeyJoinColumns <em>Default Primary Key Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Default Primary Key Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getDefaultPrimaryKeyJoinColumns()
- * @see #getIEntity()
- * @generated
- */
- public EReference getIEntity_DefaultPrimaryKeyJoinColumns() {
- return (EReference) iEntityEClass.getEStructuralFeatures().get(6);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getAttributeOverrides <em>Attribute Overrides</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Attribute Overrides</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getAttributeOverrides()
- * @see #getIEntity()
- * @generated
- */
- public EReference getIEntity_AttributeOverrides() {
- return (EReference) iEntityEClass.getEStructuralFeatures().get(14);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedAttributeOverrides <em>Specified Attribute Overrides</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Specified Attribute Overrides</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedAttributeOverrides()
- * @see #getIEntity()
- * @generated
- */
- public EReference getIEntity_SpecifiedAttributeOverrides() {
- return (EReference) iEntityEClass.getEStructuralFeatures().get(15);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getDefaultAttributeOverrides <em>Default Attribute Overrides</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Default Attribute Overrides</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getDefaultAttributeOverrides()
- * @see #getIEntity()
- * @generated
- */
- public EReference getIEntity_DefaultAttributeOverrides() {
- return (EReference) iEntityEClass.getEStructuralFeatures().get(16);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getAssociationOverrides <em>Association Overrides</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Association Overrides</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getAssociationOverrides()
- * @see #getIEntity()
- * @generated
- */
- public EReference getIEntity_AssociationOverrides() {
- return (EReference) iEntityEClass.getEStructuralFeatures().get(17);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedAssociationOverrides <em>Specified Association Overrides</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Specified Association Overrides</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getSpecifiedAssociationOverrides()
- * @see #getIEntity()
- * @generated
- */
- public EReference getIEntity_SpecifiedAssociationOverrides() {
- return (EReference) iEntityEClass.getEStructuralFeatures().get(18);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getDefaultAssociationOverrides <em>Default Association Overrides</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Default Association Overrides</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getDefaultAssociationOverrides()
- * @see #getIEntity()
- * @generated
- */
- public EReference getIEntity_DefaultAssociationOverrides() {
- return (EReference) iEntityEClass.getEStructuralFeatures().get(19);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getNamedQueries <em>Named Queries</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Named Queries</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getNamedQueries()
- * @see #getIEntity()
- * @generated
- */
- public EReference getIEntity_NamedQueries() {
- return (EReference) iEntityEClass.getEStructuralFeatures().get(20);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getNamedNativeQueries <em>Named Native Queries</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Named Native Queries</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getNamedNativeQueries()
- * @see #getIEntity()
- * @generated
- */
- public EReference getIEntity_NamedNativeQueries() {
- return (EReference) iEntityEClass.getEStructuralFeatures().get(21);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IEntity#getIdClass <em>Id Class</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Id Class</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity#getIdClass()
- * @see #getIEntity()
- * @generated
- */
- public EAttribute getIEntity_IdClass() {
- return (EAttribute) iEntityEClass.getEStructuralFeatures().get(22);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IEmbeddable <em>IEmbeddable</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IEmbeddable</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEmbeddable
- * @generated
- */
- public EClass getIEmbeddable() {
- return iEmbeddableEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.ITable <em>ITable</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>ITable</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITable
- * @generated
- */
- public EClass getITable() {
- return iTableEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITable#getName <em>Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITable#getName()
- * @see #getITable()
- * @generated
- */
- public EAttribute getITable_Name() {
- return (EAttribute) iTableEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITable#getSpecifiedName <em>Specified Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITable#getSpecifiedName()
- * @see #getITable()
- * @generated
- */
- public EAttribute getITable_SpecifiedName() {
- return (EAttribute) iTableEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITable#getDefaultName <em>Default Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITable#getDefaultName()
- * @see #getITable()
- * @generated
- */
- public EAttribute getITable_DefaultName() {
- return (EAttribute) iTableEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITable#getCatalog <em>Catalog</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Catalog</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITable#getCatalog()
- * @see #getITable()
- * @generated
- */
- public EAttribute getITable_Catalog() {
- return (EAttribute) iTableEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITable#getSpecifiedCatalog <em>Specified Catalog</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Catalog</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITable#getSpecifiedCatalog()
- * @see #getITable()
- * @generated
- */
- public EAttribute getITable_SpecifiedCatalog() {
- return (EAttribute) iTableEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITable#getDefaultCatalog <em>Default Catalog</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Catalog</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITable#getDefaultCatalog()
- * @see #getITable()
- * @generated
- */
- public EAttribute getITable_DefaultCatalog() {
- return (EAttribute) iTableEClass.getEStructuralFeatures().get(5);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITable#getSchema <em>Schema</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Schema</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITable#getSchema()
- * @see #getITable()
- * @generated
- */
- public EAttribute getITable_Schema() {
- return (EAttribute) iTableEClass.getEStructuralFeatures().get(6);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITable#getSpecifiedSchema <em>Specified Schema</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Schema</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITable#getSpecifiedSchema()
- * @see #getITable()
- * @generated
- */
- public EAttribute getITable_SpecifiedSchema() {
- return (EAttribute) iTableEClass.getEStructuralFeatures().get(7);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITable#getDefaultSchema <em>Default Schema</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Schema</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITable#getDefaultSchema()
- * @see #getITable()
- * @generated
- */
- public EAttribute getITable_DefaultSchema() {
- return (EAttribute) iTableEClass.getEStructuralFeatures().get(8);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.ITable#getUniqueConstraints <em>Unique Constraints</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Unique Constraints</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITable#getUniqueConstraints()
- * @see #getITable()
- * @generated
- */
- public EReference getITable_UniqueConstraints() {
- return (EReference) iTableEClass.getEStructuralFeatures().get(9);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IUniqueConstraint <em>IUnique Constraint</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IUnique Constraint</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IUniqueConstraint
- * @generated
- */
- public EClass getIUniqueConstraint() {
- return iUniqueConstraintEClass;
- }
-
- /**
- * Returns the meta object for the attribute list '{@link org.eclipse.jpt.core.internal.mappings.IUniqueConstraint#getColumnNames <em>Column Names</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute list '<em>Column Names</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IUniqueConstraint#getColumnNames()
- * @see #getIUniqueConstraint()
- * @generated
- */
- public EAttribute getIUniqueConstraint_ColumnNames() {
- return (EAttribute) iUniqueConstraintEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.INamedColumn <em>INamed Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>INamed Column</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.INamedColumn
- * @generated
- */
- public EClass getINamedColumn() {
- return iNamedColumnEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.INamedColumn#getName <em>Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.INamedColumn#getName()
- * @see #getINamedColumn()
- * @generated
- */
- public EAttribute getINamedColumn_Name() {
- return (EAttribute) iNamedColumnEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.INamedColumn#getSpecifiedName <em>Specified Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.INamedColumn#getSpecifiedName()
- * @see #getINamedColumn()
- * @generated
- */
- public EAttribute getINamedColumn_SpecifiedName() {
- return (EAttribute) iNamedColumnEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.INamedColumn#getDefaultName <em>Default Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.INamedColumn#getDefaultName()
- * @see #getINamedColumn()
- * @generated
- */
- public EAttribute getINamedColumn_DefaultName() {
- return (EAttribute) iNamedColumnEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.INamedColumn#getColumnDefinition <em>Column Definition</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Column Definition</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.INamedColumn#getColumnDefinition()
- * @see #getINamedColumn()
- * @generated
- */
- public EAttribute getINamedColumn_ColumnDefinition() {
- return (EAttribute) iNamedColumnEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn <em>IAbstract Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IAbstract Column</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractColumn
- * @generated
- */
- public EClass getIAbstractColumn() {
- return iAbstractColumnEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getUnique <em>Unique</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Unique</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getUnique()
- * @see #getIAbstractColumn()
- * @generated
- */
- public EAttribute getIAbstractColumn_Unique() {
- return (EAttribute) iAbstractColumnEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getNullable <em>Nullable</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Nullable</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getNullable()
- * @see #getIAbstractColumn()
- * @generated
- */
- public EAttribute getIAbstractColumn_Nullable() {
- return (EAttribute) iAbstractColumnEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getInsertable <em>Insertable</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Insertable</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getInsertable()
- * @see #getIAbstractColumn()
- * @generated
- */
- public EAttribute getIAbstractColumn_Insertable() {
- return (EAttribute) iAbstractColumnEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getUpdatable <em>Updatable</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Updatable</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getUpdatable()
- * @see #getIAbstractColumn()
- * @generated
- */
- public EAttribute getIAbstractColumn_Updatable() {
- return (EAttribute) iAbstractColumnEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getTable <em>Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Table</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getTable()
- * @see #getIAbstractColumn()
- * @generated
- */
- public EAttribute getIAbstractColumn_Table() {
- return (EAttribute) iAbstractColumnEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getSpecifiedTable <em>Specified Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Table</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getSpecifiedTable()
- * @see #getIAbstractColumn()
- * @generated
- */
- public EAttribute getIAbstractColumn_SpecifiedTable() {
- return (EAttribute) iAbstractColumnEClass.getEStructuralFeatures().get(5);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getDefaultTable <em>Default Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Table</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractColumn#getDefaultTable()
- * @see #getIAbstractColumn()
- * @generated
- */
- public EAttribute getIAbstractColumn_DefaultTable() {
- return (EAttribute) iAbstractColumnEClass.getEStructuralFeatures().get(6);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IColumn <em>IColumn</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IColumn</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IColumn
- * @generated
- */
- public EClass getIColumn() {
- return iColumnEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IColumn#getLength <em>Length</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Length</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IColumn#getLength()
- * @see #getIColumn()
- * @generated
- */
- public EAttribute getIColumn_Length() {
- return (EAttribute) iColumnEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IColumn#getSpecifiedLength <em>Specified Length</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Length</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IColumn#getSpecifiedLength()
- * @see #getIColumn()
- * @generated
- */
- public EAttribute getIColumn_SpecifiedLength() {
- return (EAttribute) iColumnEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IColumn#getPrecision <em>Precision</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Precision</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IColumn#getPrecision()
- * @see #getIColumn()
- * @generated
- */
- public EAttribute getIColumn_Precision() {
- return (EAttribute) iColumnEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IColumn#getSpecifiedPrecision <em>Specified Precision</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Precision</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IColumn#getSpecifiedPrecision()
- * @see #getIColumn()
- * @generated
- */
- public EAttribute getIColumn_SpecifiedPrecision() {
- return (EAttribute) iColumnEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IColumn#getScale <em>Scale</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Scale</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IColumn#getScale()
- * @see #getIColumn()
- * @generated
- */
- public EAttribute getIColumn_Scale() {
- return (EAttribute) iColumnEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IColumn#getSpecifiedScale <em>Specified Scale</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Scale</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IColumn#getSpecifiedScale()
- * @see #getIColumn()
- * @generated
- */
- public EAttribute getIColumn_SpecifiedScale() {
- return (EAttribute) iColumnEClass.getEStructuralFeatures().get(5);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IColumnMapping <em>IColumn Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IColumn Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IColumnMapping
- * @generated
- */
- public EClass getIColumnMapping() {
- return iColumnMappingEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IBasic <em>IBasic</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IBasic</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IBasic
- * @generated
- */
- public EClass getIBasic() {
- return iBasicEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IBasic#getFetch <em>Fetch</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Fetch</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IBasic#getFetch()
- * @see #getIBasic()
- * @generated
- */
- public EAttribute getIBasic_Fetch() {
- return (EAttribute) iBasicEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IBasic#getOptional <em>Optional</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Optional</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IBasic#getOptional()
- * @see #getIBasic()
- * @generated
- */
- public EAttribute getIBasic_Optional() {
- return (EAttribute) iBasicEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.mappings.IBasic#getColumn <em>Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Column</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IBasic#getColumn()
- * @see #getIBasic()
- * @generated
- */
- public EReference getIBasic_Column() {
- return (EReference) iBasicEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IBasic#isLob <em>Lob</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Lob</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IBasic#isLob()
- * @see #getIBasic()
- * @generated
- */
- public EAttribute getIBasic_Lob() {
- return (EAttribute) iBasicEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IBasic#getTemporal <em>Temporal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Temporal</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IBasic#getTemporal()
- * @see #getIBasic()
- * @generated
- */
- public EAttribute getIBasic_Temporal() {
- return (EAttribute) iBasicEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IBasic#getEnumerated <em>Enumerated</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Enumerated</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IBasic#getEnumerated()
- * @see #getIBasic()
- * @generated
- */
- public EAttribute getIBasic_Enumerated() {
- return (EAttribute) iBasicEClass.getEStructuralFeatures().get(5);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IId <em>IId</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IId</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IId
- * @generated
- */
- public EClass getIId() {
- return iIdEClass;
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.mappings.IId#getColumn <em>Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Column</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IId#getColumn()
- * @see #getIId()
- * @generated
- */
- public EReference getIId_Column() {
- return (EReference) iIdEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.mappings.IId#getGeneratedValue <em>Generated Value</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Generated Value</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IId#getGeneratedValue()
- * @see #getIId()
- * @generated
- */
- public EReference getIId_GeneratedValue() {
- return (EReference) iIdEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IId#getTemporal <em>Temporal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Temporal</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IId#getTemporal()
- * @see #getIId()
- * @generated
- */
- public EAttribute getIId_Temporal() {
- return (EAttribute) iIdEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.mappings.IId#getTableGenerator <em>Table Generator</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Table Generator</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IId#getTableGenerator()
- * @see #getIId()
- * @generated
- */
- public EReference getIId_TableGenerator() {
- return (EReference) iIdEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.mappings.IId#getSequenceGenerator <em>Sequence Generator</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Sequence Generator</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IId#getSequenceGenerator()
- * @see #getIId()
- * @generated
- */
- public EReference getIId_SequenceGenerator() {
- return (EReference) iIdEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.ITransient <em>ITransient</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>ITransient</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITransient
- * @generated
- */
- public EClass getITransient() {
- return iTransientEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IVersion <em>IVersion</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IVersion</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IVersion
- * @generated
- */
- public EClass getIVersion() {
- return iVersionEClass;
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.mappings.IVersion#getColumn <em>Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Column</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IVersion#getColumn()
- * @see #getIVersion()
- * @generated
- */
- public EReference getIVersion_Column() {
- return (EReference) iVersionEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IVersion#getTemporal <em>Temporal</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Temporal</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IVersion#getTemporal()
- * @see #getIVersion()
- * @generated
- */
- public EAttribute getIVersion_Temporal() {
- return (EAttribute) iVersionEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IEmbeddedId <em>IEmbedded Id</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IEmbedded Id</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEmbeddedId
- * @generated
- */
- public EClass getIEmbeddedId() {
- return iEmbeddedIdEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IEmbedded <em>IEmbedded</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IEmbedded</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEmbedded
- * @generated
- */
- public EClass getIEmbedded() {
- return iEmbeddedEClass;
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IEmbedded#getAttributeOverrides <em>Attribute Overrides</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Attribute Overrides</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEmbedded#getAttributeOverrides()
- * @see #getIEmbedded()
- * @generated
- */
- public EReference getIEmbedded_AttributeOverrides() {
- return (EReference) iEmbeddedEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IEmbedded#getSpecifiedAttributeOverrides <em>Specified Attribute Overrides</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Specified Attribute Overrides</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEmbedded#getSpecifiedAttributeOverrides()
- * @see #getIEmbedded()
- * @generated
- */
- public EReference getIEmbedded_SpecifiedAttributeOverrides() {
- return (EReference) iEmbeddedEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IEmbedded#getDefaultAttributeOverrides <em>Default Attribute Overrides</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Default Attribute Overrides</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IEmbedded#getDefaultAttributeOverrides()
- * @see #getIEmbedded()
- * @generated
- */
- public EReference getIEmbedded_DefaultAttributeOverrides() {
- return (EReference) iEmbeddedEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping <em>IRelationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IRelationship Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IRelationshipMapping
- * @generated
- */
- public EClass getIRelationshipMapping() {
- return iRelationshipMappingEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getTargetEntity <em>Target Entity</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Target Entity</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getTargetEntity()
- * @see #getIRelationshipMapping()
- * @generated
- */
- public EAttribute getIRelationshipMapping_TargetEntity() {
- return (EAttribute) iRelationshipMappingEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getSpecifiedTargetEntity <em>Specified Target Entity</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Target Entity</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getSpecifiedTargetEntity()
- * @see #getIRelationshipMapping()
- * @generated
- */
- public EAttribute getIRelationshipMapping_SpecifiedTargetEntity() {
- return (EAttribute) iRelationshipMappingEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getDefaultTargetEntity <em>Default Target Entity</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Target Entity</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getDefaultTargetEntity()
- * @see #getIRelationshipMapping()
- * @generated
- */
- public EAttribute getIRelationshipMapping_DefaultTargetEntity() {
- return (EAttribute) iRelationshipMappingEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getResolvedTargetEntity <em>Resolved Target Entity</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Resolved Target Entity</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getResolvedTargetEntity()
- * @see #getIRelationshipMapping()
- * @generated
- */
- public EReference getIRelationshipMapping_ResolvedTargetEntity() {
- return (EReference) iRelationshipMappingEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getCascade <em>Cascade</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Cascade</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IRelationshipMapping#getCascade()
- * @see #getIRelationshipMapping()
- * @generated
- */
- public EReference getIRelationshipMapping_Cascade() {
- return (EReference) iRelationshipMappingEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.INonOwningMapping <em>INon Owning Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>INon Owning Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.INonOwningMapping
- * @generated
- */
- public EClass getINonOwningMapping() {
- return iNonOwningMappingEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.INonOwningMapping#getMappedBy <em>Mapped By</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Mapped By</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.INonOwningMapping#getMappedBy()
- * @see #getINonOwningMapping()
- * @generated
- */
- public EAttribute getINonOwningMapping_MappedBy() {
- return (EAttribute) iNonOwningMappingEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping <em>IMulti Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IMulti Relationship Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping
- * @generated
- */
- public EClass getIMultiRelationshipMapping() {
- return iMultiRelationshipMappingEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getOrderBy <em>Order By</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Order By</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getOrderBy()
- * @see #getIMultiRelationshipMapping()
- * @generated
- */
- public EAttribute getIMultiRelationshipMapping_OrderBy() {
- return (EAttribute) iMultiRelationshipMappingEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getFetch <em>Fetch</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Fetch</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getFetch()
- * @see #getIMultiRelationshipMapping()
- * @generated
- */
- public EAttribute getIMultiRelationshipMapping_Fetch() {
- return (EAttribute) iMultiRelationshipMappingEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getJoinTable <em>Join Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Join Table</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getJoinTable()
- * @see #getIMultiRelationshipMapping()
- * @generated
- */
- public EReference getIMultiRelationshipMapping_JoinTable() {
- return (EReference) iMultiRelationshipMappingEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getMapKey <em>Map Key</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Map Key</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping#getMapKey()
- * @see #getIMultiRelationshipMapping()
- * @generated
- */
- public EAttribute getIMultiRelationshipMapping_MapKey() {
- return (EAttribute) iMultiRelationshipMappingEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IOneToMany <em>IOne To Many</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IOne To Many</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IOneToMany
- * @generated
- */
- public EClass getIOneToMany() {
- return iOneToManyEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IManyToMany <em>IMany To Many</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IMany To Many</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IManyToMany
- * @generated
- */
- public EClass getIManyToMany() {
- return iManyToManyEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping <em>ISingle Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>ISingle Relationship Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping
- * @generated
- */
- public EClass getISingleRelationshipMapping() {
- return iSingleRelationshipMappingEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getFetch <em>Fetch</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Fetch</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getFetch()
- * @see #getISingleRelationshipMapping()
- * @generated
- */
- public EAttribute getISingleRelationshipMapping_Fetch() {
- return (EAttribute) iSingleRelationshipMappingEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getJoinColumns <em>Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getJoinColumns()
- * @see #getISingleRelationshipMapping()
- * @generated
- */
- public EReference getISingleRelationshipMapping_JoinColumns() {
- return (EReference) iSingleRelationshipMappingEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getSpecifiedJoinColumns <em>Specified Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Specified Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getSpecifiedJoinColumns()
- * @see #getISingleRelationshipMapping()
- * @generated
- */
- public EReference getISingleRelationshipMapping_SpecifiedJoinColumns() {
- return (EReference) iSingleRelationshipMappingEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getDefaultJoinColumns <em>Default Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Default Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getDefaultJoinColumns()
- * @see #getISingleRelationshipMapping()
- * @generated
- */
- public EReference getISingleRelationshipMapping_DefaultJoinColumns() {
- return (EReference) iSingleRelationshipMappingEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getOptional <em>Optional</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Optional</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping#getOptional()
- * @see #getISingleRelationshipMapping()
- * @generated
- */
- public EAttribute getISingleRelationshipMapping_Optional() {
- return (EAttribute) iSingleRelationshipMappingEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IManyToOne <em>IMany To One</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IMany To One</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IManyToOne
- * @generated
- */
- public EClass getIManyToOne() {
- return iManyToOneEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IOneToOne <em>IOne To One</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IOne To One</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IOneToOne
- * @generated
- */
- public EClass getIOneToOne() {
- return iOneToOneEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IJoinTable <em>IJoin Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJoin Table</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IJoinTable
- * @generated
- */
- public EClass getIJoinTable() {
- return iJoinTableEClass;
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IJoinTable#getJoinColumns <em>Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IJoinTable#getJoinColumns()
- * @see #getIJoinTable()
- * @generated
- */
- public EReference getIJoinTable_JoinColumns() {
- return (EReference) iJoinTableEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IJoinTable#getSpecifiedJoinColumns <em>Specified Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Specified Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IJoinTable#getSpecifiedJoinColumns()
- * @see #getIJoinTable()
- * @generated
- */
- public EReference getIJoinTable_SpecifiedJoinColumns() {
- return (EReference) iJoinTableEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IJoinTable#getDefaultJoinColumns <em>Default Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Default Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IJoinTable#getDefaultJoinColumns()
- * @see #getIJoinTable()
- * @generated
- */
- public EReference getIJoinTable_DefaultJoinColumns() {
- return (EReference) iJoinTableEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IJoinTable#getInverseJoinColumns <em>Inverse Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Inverse Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IJoinTable#getInverseJoinColumns()
- * @see #getIJoinTable()
- * @generated
- */
- public EReference getIJoinTable_InverseJoinColumns() {
- return (EReference) iJoinTableEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IJoinTable#getSpecifiedInverseJoinColumns <em>Specified Inverse Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Specified Inverse Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IJoinTable#getSpecifiedInverseJoinColumns()
- * @see #getIJoinTable()
- * @generated
- */
- public EReference getIJoinTable_SpecifiedInverseJoinColumns() {
- return (EReference) iJoinTableEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IJoinTable#getDefaultInverseJoinColumns <em>Default Inverse Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Default Inverse Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IJoinTable#getDefaultInverseJoinColumns()
- * @see #getIJoinTable()
- * @generated
- */
- public EReference getIJoinTable_DefaultInverseJoinColumns() {
- return (EReference) iJoinTableEClass.getEStructuralFeatures().get(5);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn <em>IAbstract Join Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IAbstract Join Column</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn
- * @generated
- */
- public EClass getIAbstractJoinColumn() {
- return iAbstractJoinColumnEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn#getReferencedColumnName <em>Referenced Column Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Referenced Column Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn#getReferencedColumnName()
- * @see #getIAbstractJoinColumn()
- * @generated
- */
- public EAttribute getIAbstractJoinColumn_ReferencedColumnName() {
- return (EAttribute) iAbstractJoinColumnEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn#getSpecifiedReferencedColumnName <em>Specified Referenced Column Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Referenced Column Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn#getSpecifiedReferencedColumnName()
- * @see #getIAbstractJoinColumn()
- * @generated
- */
- public EAttribute getIAbstractJoinColumn_SpecifiedReferencedColumnName() {
- return (EAttribute) iAbstractJoinColumnEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn#getDefaultReferencedColumnName <em>Default Referenced Column Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Referenced Column Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn#getDefaultReferencedColumnName()
- * @see #getIAbstractJoinColumn()
- * @generated
- */
- public EAttribute getIAbstractJoinColumn_DefaultReferencedColumnName() {
- return (EAttribute) iAbstractJoinColumnEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IJoinColumn <em>IJoin Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IJoin Column</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IJoinColumn
- * @generated
- */
- public EClass getIJoinColumn() {
- return iJoinColumnEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IOverride <em>IOverride</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IOverride</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IOverride
- * @generated
- */
- public EClass getIOverride() {
- return iOverrideEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IOverride#getName <em>Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IOverride#getName()
- * @see #getIOverride()
- * @generated
- */
- public EAttribute getIOverride_Name() {
- return (EAttribute) iOverrideEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride <em>IAttribute Override</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IAttribute Override</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAttributeOverride
- * @generated
- */
- public EClass getIAttributeOverride() {
- return iAttributeOverrideEClass;
- }
-
- /**
- * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride#getColumn <em>Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference '<em>Column</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAttributeOverride#getColumn()
- * @see #getIAttributeOverride()
- * @generated
- */
- public EReference getIAttributeOverride_Column() {
- return (EReference) iAttributeOverrideEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride <em>IAssociation Override</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IAssociation Override</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAssociationOverride
- * @generated
- */
- public EClass getIAssociationOverride() {
- return iAssociationOverrideEClass;
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride#getJoinColumns <em>Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAssociationOverride#getJoinColumns()
- * @see #getIAssociationOverride()
- * @generated
- */
- public EReference getIAssociationOverride_JoinColumns() {
- return (EReference) iAssociationOverrideEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride#getSpecifiedJoinColumns <em>Specified Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Specified Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAssociationOverride#getSpecifiedJoinColumns()
- * @see #getIAssociationOverride()
- * @generated
- */
- public EReference getIAssociationOverride_SpecifiedJoinColumns() {
- return (EReference) iAssociationOverrideEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride#getDefaultJoinColumns <em>Default Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Default Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IAssociationOverride#getDefaultJoinColumns()
- * @see #getIAssociationOverride()
- * @generated
- */
- public EReference getIAssociationOverride_DefaultJoinColumns() {
- return (EReference) iAssociationOverrideEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn <em>IDiscriminator Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IDiscriminator Column</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn
- * @generated
- */
- public EClass getIDiscriminatorColumn() {
- return iDiscriminatorColumnEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn#getDiscriminatorType <em>Discriminator Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Discriminator Type</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn#getDiscriminatorType()
- * @see #getIDiscriminatorColumn()
- * @generated
- */
- public EAttribute getIDiscriminatorColumn_DiscriminatorType() {
- return (EAttribute) iDiscriminatorColumnEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn#getDefaultLength <em>Default Length</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Length</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn#getDefaultLength()
- * @see #getIDiscriminatorColumn()
- * @generated
- */
- public EAttribute getIDiscriminatorColumn_DefaultLength() {
- return (EAttribute) iDiscriminatorColumnEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn#getSpecifiedLength <em>Specified Length</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Length</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn#getSpecifiedLength()
- * @see #getIDiscriminatorColumn()
- * @generated
- */
- public EAttribute getIDiscriminatorColumn_SpecifiedLength() {
- return (EAttribute) iDiscriminatorColumnEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn#getLength <em>Length</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Length</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn#getLength()
- * @see #getIDiscriminatorColumn()
- * @generated
- */
- public EAttribute getIDiscriminatorColumn_Length() {
- return (EAttribute) iDiscriminatorColumnEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable <em>ISecondary Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>ISecondary Table</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ISecondaryTable
- * @generated
- */
- public EClass getISecondaryTable() {
- return iSecondaryTableEClass;
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable#getPrimaryKeyJoinColumns <em>Primary Key Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Primary Key Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ISecondaryTable#getPrimaryKeyJoinColumns()
- * @see #getISecondaryTable()
- * @generated
- */
- public EReference getISecondaryTable_PrimaryKeyJoinColumns() {
- return (EReference) iSecondaryTableEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable#getSpecifiedPrimaryKeyJoinColumns <em>Specified Primary Key Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Specified Primary Key Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ISecondaryTable#getSpecifiedPrimaryKeyJoinColumns()
- * @see #getISecondaryTable()
- * @generated
- */
- public EReference getISecondaryTable_SpecifiedPrimaryKeyJoinColumns() {
- return (EReference) iSecondaryTableEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable#getDefaultPrimaryKeyJoinColumns <em>Default Primary Key Join Columns</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Default Primary Key Join Columns</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ISecondaryTable#getDefaultPrimaryKeyJoinColumns()
- * @see #getISecondaryTable()
- * @generated
- */
- public EReference getISecondaryTable_DefaultPrimaryKeyJoinColumns() {
- return (EReference) iSecondaryTableEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn <em>IPrimary Key Join Column</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IPrimary Key Join Column</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn
- * @generated
- */
- public EClass getIPrimaryKeyJoinColumn() {
- return iPrimaryKeyJoinColumnEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IGenerator <em>IGenerator</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IGenerator</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IGenerator
- * @generated
- */
- public EClass getIGenerator() {
- return iGeneratorEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getName <em>Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IGenerator#getName()
- * @see #getIGenerator()
- * @generated
- */
- public EAttribute getIGenerator_Name() {
- return (EAttribute) iGeneratorEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getInitialValue <em>Initial Value</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Initial Value</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IGenerator#getInitialValue()
- * @see #getIGenerator()
- * @generated
- */
- public EAttribute getIGenerator_InitialValue() {
- return (EAttribute) iGeneratorEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getSpecifiedInitialValue <em>Specified Initial Value</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Initial Value</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IGenerator#getSpecifiedInitialValue()
- * @see #getIGenerator()
- * @generated
- */
- public EAttribute getIGenerator_SpecifiedInitialValue() {
- return (EAttribute) iGeneratorEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getDefaultInitialValue <em>Default Initial Value</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Initial Value</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IGenerator#getDefaultInitialValue()
- * @see #getIGenerator()
- * @generated
- */
- public EAttribute getIGenerator_DefaultInitialValue() {
- return (EAttribute) iGeneratorEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getAllocationSize <em>Allocation Size</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Allocation Size</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IGenerator#getAllocationSize()
- * @see #getIGenerator()
- * @generated
- */
- public EAttribute getIGenerator_AllocationSize() {
- return (EAttribute) iGeneratorEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getSpecifiedAllocationSize <em>Specified Allocation Size</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Allocation Size</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IGenerator#getSpecifiedAllocationSize()
- * @see #getIGenerator()
- * @generated
- */
- public EAttribute getIGenerator_SpecifiedAllocationSize() {
- return (EAttribute) iGeneratorEClass.getEStructuralFeatures().get(5);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IGenerator#getDefaultAllocationSize <em>Default Allocation Size</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Allocation Size</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IGenerator#getDefaultAllocationSize()
- * @see #getIGenerator()
- * @generated
- */
- public EAttribute getIGenerator_DefaultAllocationSize() {
- return (EAttribute) iGeneratorEClass.getEStructuralFeatures().get(6);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator <em>ITable Generator</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>ITable Generator</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator
- * @generated
- */
- public EClass getITableGenerator() {
- return iTableGeneratorEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getTable <em>Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Table</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getTable()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_Table() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedTable <em>Specified Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Table</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedTable()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_SpecifiedTable() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultTable <em>Default Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Table</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultTable()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_DefaultTable() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getCatalog <em>Catalog</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Catalog</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getCatalog()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_Catalog() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedCatalog <em>Specified Catalog</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Catalog</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedCatalog()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_SpecifiedCatalog() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultCatalog <em>Default Catalog</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Catalog</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultCatalog()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_DefaultCatalog() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(5);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSchema <em>Schema</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Schema</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSchema()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_Schema() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(6);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedSchema <em>Specified Schema</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Schema</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedSchema()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_SpecifiedSchema() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(7);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultSchema <em>Default Schema</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Schema</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultSchema()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_DefaultSchema() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(8);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getPkColumnName <em>Pk Column Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Pk Column Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getPkColumnName()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_PkColumnName() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(9);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedPkColumnName <em>Specified Pk Column Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Pk Column Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedPkColumnName()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_SpecifiedPkColumnName() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(10);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultPkColumnName <em>Default Pk Column Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Pk Column Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultPkColumnName()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_DefaultPkColumnName() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(11);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getValueColumnName <em>Value Column Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Value Column Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getValueColumnName()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_ValueColumnName() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(12);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedValueColumnName <em>Specified Value Column Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Value Column Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedValueColumnName()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_SpecifiedValueColumnName() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(13);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultValueColumnName <em>Default Value Column Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Value Column Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultValueColumnName()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_DefaultValueColumnName() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(14);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getPkColumnValue <em>Pk Column Value</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Pk Column Value</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getPkColumnValue()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_PkColumnValue() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(15);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedPkColumnValue <em>Specified Pk Column Value</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Pk Column Value</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getSpecifiedPkColumnValue()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_SpecifiedPkColumnValue() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(16);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultPkColumnValue <em>Default Pk Column Value</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Pk Column Value</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getDefaultPkColumnValue()
- * @see #getITableGenerator()
- * @generated
- */
- public EAttribute getITableGenerator_DefaultPkColumnValue() {
- return (EAttribute) iTableGeneratorEClass.getEStructuralFeatures().get(17);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator#getUniqueConstraints <em>Unique Constraints</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Unique Constraints</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator#getUniqueConstraints()
- * @see #getITableGenerator()
- * @generated
- */
- public EReference getITableGenerator_UniqueConstraints() {
- return (EReference) iTableGeneratorEClass.getEStructuralFeatures().get(18);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.ISequenceGenerator <em>ISequence Generator</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>ISequence Generator</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ISequenceGenerator
- * @generated
- */
- public EClass getISequenceGenerator() {
- return iSequenceGeneratorEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ISequenceGenerator#getSequenceName <em>Sequence Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Sequence Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ISequenceGenerator#getSequenceName()
- * @see #getISequenceGenerator()
- * @generated
- */
- public EAttribute getISequenceGenerator_SequenceName() {
- return (EAttribute) iSequenceGeneratorEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ISequenceGenerator#getSpecifiedSequenceName <em>Specified Sequence Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Specified Sequence Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ISequenceGenerator#getSpecifiedSequenceName()
- * @see #getISequenceGenerator()
- * @generated
- */
- public EAttribute getISequenceGenerator_SpecifiedSequenceName() {
- return (EAttribute) iSequenceGeneratorEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ISequenceGenerator#getDefaultSequenceName <em>Default Sequence Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Default Sequence Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ISequenceGenerator#getDefaultSequenceName()
- * @see #getISequenceGenerator()
- * @generated
- */
- public EAttribute getISequenceGenerator_DefaultSequenceName() {
- return (EAttribute) iSequenceGeneratorEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IGeneratedValue <em>IGenerated Value</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IGenerated Value</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IGeneratedValue
- * @generated
- */
- public EClass getIGeneratedValue() {
- return iGeneratedValueEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IGeneratedValue#getStrategy <em>Strategy</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Strategy</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IGeneratedValue#getStrategy()
- * @see #getIGeneratedValue()
- * @generated
- */
- public EAttribute getIGeneratedValue_Strategy() {
- return (EAttribute) iGeneratedValueEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IGeneratedValue#getGenerator <em>Generator</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Generator</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IGeneratedValue#getGenerator()
- * @see #getIGeneratedValue()
- * @generated
- */
- public EAttribute getIGeneratedValue_Generator() {
- return (EAttribute) iGeneratedValueEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IQuery <em>IQuery</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IQuery</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IQuery
- * @generated
- */
- public EClass getIQuery() {
- return iQueryEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IQuery#getName <em>Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IQuery#getName()
- * @see #getIQuery()
- * @generated
- */
- public EAttribute getIQuery_Name() {
- return (EAttribute) iQueryEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IQuery#getQuery <em>Query</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Query</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IQuery#getQuery()
- * @see #getIQuery()
- * @generated
- */
- public EAttribute getIQuery_Query() {
- return (EAttribute) iQueryEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.mappings.IQuery#getHints <em>Hints</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the containment reference list '<em>Hints</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IQuery#getHints()
- * @see #getIQuery()
- * @generated
- */
- public EReference getIQuery_Hints() {
- return (EReference) iQueryEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.INamedQuery <em>INamed Query</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>INamed Query</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.INamedQuery
- * @generated
- */
- public EClass getINamedQuery() {
- return iNamedQueryEClass;
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.INamedNativeQuery <em>INamed Native Query</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>INamed Native Query</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.INamedNativeQuery
- * @generated
- */
- public EClass getINamedNativeQuery() {
- return iNamedNativeQueryEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.INamedNativeQuery#getResultClass <em>Result Class</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Result Class</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.INamedNativeQuery#getResultClass()
- * @see #getINamedNativeQuery()
- * @generated
- */
- public EAttribute getINamedNativeQuery_ResultClass() {
- return (EAttribute) iNamedNativeQueryEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.INamedNativeQuery#getResultSetMapping <em>Result Set Mapping</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Result Set Mapping</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.INamedNativeQuery#getResultSetMapping()
- * @see #getINamedNativeQuery()
- * @generated
- */
- public EAttribute getINamedNativeQuery_ResultSetMapping() {
- return (EAttribute) iNamedNativeQueryEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.IQueryHint <em>IQuery Hint</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>IQuery Hint</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IQueryHint
- * @generated
- */
- public EClass getIQueryHint() {
- return iQueryHintEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IQueryHint#getName <em>Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Name</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IQueryHint#getName()
- * @see #getIQueryHint()
- * @generated
- */
- public EAttribute getIQueryHint_Name() {
- return (EAttribute) iQueryHintEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.IQueryHint#getValue <em>Value</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Value</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.IQueryHint#getValue()
- * @see #getIQueryHint()
- * @generated
- */
- public EAttribute getIQueryHint_Value() {
- return (EAttribute) iQueryHintEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.mappings.ICascade <em>ICascade</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>ICascade</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ICascade
- * @generated
- */
- public EClass getICascade() {
- return iCascadeEClass;
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ICascade#isAll <em>All</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>All</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ICascade#isAll()
- * @see #getICascade()
- * @generated
- */
- public EAttribute getICascade_All() {
- return (EAttribute) iCascadeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ICascade#isPersist <em>Persist</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Persist</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ICascade#isPersist()
- * @see #getICascade()
- * @generated
- */
- public EAttribute getICascade_Persist() {
- return (EAttribute) iCascadeEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ICascade#isMerge <em>Merge</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Merge</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ICascade#isMerge()
- * @see #getICascade()
- * @generated
- */
- public EAttribute getICascade_Merge() {
- return (EAttribute) iCascadeEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ICascade#isRemove <em>Remove</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Remove</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ICascade#isRemove()
- * @see #getICascade()
- * @generated
- */
- public EAttribute getICascade_Remove() {
- return (EAttribute) iCascadeEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.mappings.ICascade#isRefresh <em>Refresh</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Refresh</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.ICascade#isRefresh()
- * @see #getICascade()
- * @generated
- */
- public EAttribute getICascade_Refresh() {
- return (EAttribute) iCascadeEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType <em>Default Eager Fetch Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for enum '<em>Default Eager Fetch Type</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType
- * @generated
- */
- public EEnum getDefaultEagerFetchType() {
- return defaultEagerFetchTypeEEnum;
- }
-
- /**
- * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType <em>Default Lazy Fetch Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for enum '<em>Default Lazy Fetch Type</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType
- * @generated
- */
- public EEnum getDefaultLazyFetchType() {
- return defaultLazyFetchTypeEEnum;
- }
-
- /**
- * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean <em>Default False Boolean</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for enum '<em>Default False Boolean</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean
- * @generated
- */
- public EEnum getDefaultFalseBoolean() {
- return defaultFalseBooleanEEnum;
- }
-
- /**
- * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean <em>Default True Boolean</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for enum '<em>Default True Boolean</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @generated
- */
- public EEnum getDefaultTrueBoolean() {
- return defaultTrueBooleanEEnum;
- }
-
- /**
- * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.mappings.TemporalType <em>Temporal Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for enum '<em>Temporal Type</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @generated
- */
- public EEnum getTemporalType() {
- return temporalTypeEEnum;
- }
-
- /**
- * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.mappings.InheritanceType <em>Inheritance Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for enum '<em>Inheritance Type</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.InheritanceType
- * @generated
- */
- public EEnum getInheritanceType() {
- return inheritanceTypeEEnum;
- }
-
- /**
- * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.mappings.DiscriminatorType <em>Discriminator Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for enum '<em>Discriminator Type</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.DiscriminatorType
- * @generated
- */
- public EEnum getDiscriminatorType() {
- return discriminatorTypeEEnum;
- }
-
- /**
- * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.mappings.GenerationType <em>Generation Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for enum '<em>Generation Type</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.GenerationType
- * @generated
- */
- public EEnum getGenerationType() {
- return generationTypeEEnum;
- }
-
- /**
- * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.mappings.EnumType <em>Enum Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for enum '<em>Enum Type</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.EnumType
- * @generated
- */
- public EEnum getEnumType() {
- return enumTypeEEnum;
- }
-
- /**
- * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.mappings.CascadeType <em>Cascade Type</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for enum '<em>Cascade Type</em>'.
- * @see org.eclipse.jpt.core.internal.mappings.CascadeType
- * @generated
- */
- public EEnum getCascadeType() {
- return cascadeTypeEEnum;
- }
-
- /**
- * Returns the factory that creates the instances of the model.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the factory that creates the instances of the model.
- * @generated
- */
- public JpaCoreMappingsFactory getJpaCoreMappingsFactory() {
- return (JpaCoreMappingsFactory) getEFactoryInstance();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isCreated = false;
-
- /**
- * Creates the meta-model objects for the package. This method is
- * guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void createPackageContents() {
- if (isCreated)
- return;
- isCreated = true;
- // Create classes and their features
- iMappedSuperclassEClass = createEClass(IMAPPED_SUPERCLASS);
- createEAttribute(iMappedSuperclassEClass, IMAPPED_SUPERCLASS__ID_CLASS);
- iEntityEClass = createEClass(IENTITY);
- createEAttribute(iEntityEClass, IENTITY__SPECIFIED_NAME);
- createEAttribute(iEntityEClass, IENTITY__DEFAULT_NAME);
- createEReference(iEntityEClass, IENTITY__TABLE);
- createEReference(iEntityEClass, IENTITY__SPECIFIED_SECONDARY_TABLES);
- createEReference(iEntityEClass, IENTITY__PRIMARY_KEY_JOIN_COLUMNS);
- createEReference(iEntityEClass, IENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS);
- createEReference(iEntityEClass, IENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS);
- createEAttribute(iEntityEClass, IENTITY__INHERITANCE_STRATEGY);
- createEAttribute(iEntityEClass, IENTITY__DEFAULT_DISCRIMINATOR_VALUE);
- createEAttribute(iEntityEClass, IENTITY__SPECIFIED_DISCRIMINATOR_VALUE);
- createEAttribute(iEntityEClass, IENTITY__DISCRIMINATOR_VALUE);
- createEReference(iEntityEClass, IENTITY__DISCRIMINATOR_COLUMN);
- createEReference(iEntityEClass, IENTITY__SEQUENCE_GENERATOR);
- createEReference(iEntityEClass, IENTITY__TABLE_GENERATOR);
- createEReference(iEntityEClass, IENTITY__ATTRIBUTE_OVERRIDES);
- createEReference(iEntityEClass, IENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES);
- createEReference(iEntityEClass, IENTITY__DEFAULT_ATTRIBUTE_OVERRIDES);
- createEReference(iEntityEClass, IENTITY__ASSOCIATION_OVERRIDES);
- createEReference(iEntityEClass, IENTITY__SPECIFIED_ASSOCIATION_OVERRIDES);
- createEReference(iEntityEClass, IENTITY__DEFAULT_ASSOCIATION_OVERRIDES);
- createEReference(iEntityEClass, IENTITY__NAMED_QUERIES);
- createEReference(iEntityEClass, IENTITY__NAMED_NATIVE_QUERIES);
- createEAttribute(iEntityEClass, IENTITY__ID_CLASS);
- iEmbeddableEClass = createEClass(IEMBEDDABLE);
- iTableEClass = createEClass(ITABLE);
- createEAttribute(iTableEClass, ITABLE__NAME);
- createEAttribute(iTableEClass, ITABLE__SPECIFIED_NAME);
- createEAttribute(iTableEClass, ITABLE__DEFAULT_NAME);
- createEAttribute(iTableEClass, ITABLE__CATALOG);
- createEAttribute(iTableEClass, ITABLE__SPECIFIED_CATALOG);
- createEAttribute(iTableEClass, ITABLE__DEFAULT_CATALOG);
- createEAttribute(iTableEClass, ITABLE__SCHEMA);
- createEAttribute(iTableEClass, ITABLE__SPECIFIED_SCHEMA);
- createEAttribute(iTableEClass, ITABLE__DEFAULT_SCHEMA);
- createEReference(iTableEClass, ITABLE__UNIQUE_CONSTRAINTS);
- iUniqueConstraintEClass = createEClass(IUNIQUE_CONSTRAINT);
- createEAttribute(iUniqueConstraintEClass, IUNIQUE_CONSTRAINT__COLUMN_NAMES);
- iNamedColumnEClass = createEClass(INAMED_COLUMN);
- createEAttribute(iNamedColumnEClass, INAMED_COLUMN__NAME);
- createEAttribute(iNamedColumnEClass, INAMED_COLUMN__SPECIFIED_NAME);
- createEAttribute(iNamedColumnEClass, INAMED_COLUMN__DEFAULT_NAME);
- createEAttribute(iNamedColumnEClass, INAMED_COLUMN__COLUMN_DEFINITION);
- iAbstractColumnEClass = createEClass(IABSTRACT_COLUMN);
- createEAttribute(iAbstractColumnEClass, IABSTRACT_COLUMN__UNIQUE);
- createEAttribute(iAbstractColumnEClass, IABSTRACT_COLUMN__NULLABLE);
- createEAttribute(iAbstractColumnEClass, IABSTRACT_COLUMN__INSERTABLE);
- createEAttribute(iAbstractColumnEClass, IABSTRACT_COLUMN__UPDATABLE);
- createEAttribute(iAbstractColumnEClass, IABSTRACT_COLUMN__TABLE);
- createEAttribute(iAbstractColumnEClass, IABSTRACT_COLUMN__SPECIFIED_TABLE);
- createEAttribute(iAbstractColumnEClass, IABSTRACT_COLUMN__DEFAULT_TABLE);
- iColumnEClass = createEClass(ICOLUMN);
- createEAttribute(iColumnEClass, ICOLUMN__LENGTH);
- createEAttribute(iColumnEClass, ICOLUMN__SPECIFIED_LENGTH);
- createEAttribute(iColumnEClass, ICOLUMN__PRECISION);
- createEAttribute(iColumnEClass, ICOLUMN__SPECIFIED_PRECISION);
- createEAttribute(iColumnEClass, ICOLUMN__SCALE);
- createEAttribute(iColumnEClass, ICOLUMN__SPECIFIED_SCALE);
- iColumnMappingEClass = createEClass(ICOLUMN_MAPPING);
- iBasicEClass = createEClass(IBASIC);
- createEAttribute(iBasicEClass, IBASIC__FETCH);
- createEAttribute(iBasicEClass, IBASIC__OPTIONAL);
- createEReference(iBasicEClass, IBASIC__COLUMN);
- createEAttribute(iBasicEClass, IBASIC__LOB);
- createEAttribute(iBasicEClass, IBASIC__TEMPORAL);
- createEAttribute(iBasicEClass, IBASIC__ENUMERATED);
- iIdEClass = createEClass(IID);
- createEReference(iIdEClass, IID__COLUMN);
- createEReference(iIdEClass, IID__GENERATED_VALUE);
- createEAttribute(iIdEClass, IID__TEMPORAL);
- createEReference(iIdEClass, IID__TABLE_GENERATOR);
- createEReference(iIdEClass, IID__SEQUENCE_GENERATOR);
- iTransientEClass = createEClass(ITRANSIENT);
- iVersionEClass = createEClass(IVERSION);
- createEReference(iVersionEClass, IVERSION__COLUMN);
- createEAttribute(iVersionEClass, IVERSION__TEMPORAL);
- iEmbeddedIdEClass = createEClass(IEMBEDDED_ID);
- iEmbeddedEClass = createEClass(IEMBEDDED);
- createEReference(iEmbeddedEClass, IEMBEDDED__ATTRIBUTE_OVERRIDES);
- createEReference(iEmbeddedEClass, IEMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES);
- createEReference(iEmbeddedEClass, IEMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES);
- iRelationshipMappingEClass = createEClass(IRELATIONSHIP_MAPPING);
- createEAttribute(iRelationshipMappingEClass, IRELATIONSHIP_MAPPING__TARGET_ENTITY);
- createEAttribute(iRelationshipMappingEClass, IRELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY);
- createEAttribute(iRelationshipMappingEClass, IRELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY);
- createEReference(iRelationshipMappingEClass, IRELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY);
- createEReference(iRelationshipMappingEClass, IRELATIONSHIP_MAPPING__CASCADE);
- iNonOwningMappingEClass = createEClass(INON_OWNING_MAPPING);
- createEAttribute(iNonOwningMappingEClass, INON_OWNING_MAPPING__MAPPED_BY);
- iMultiRelationshipMappingEClass = createEClass(IMULTI_RELATIONSHIP_MAPPING);
- createEAttribute(iMultiRelationshipMappingEClass, IMULTI_RELATIONSHIP_MAPPING__ORDER_BY);
- createEAttribute(iMultiRelationshipMappingEClass, IMULTI_RELATIONSHIP_MAPPING__FETCH);
- createEReference(iMultiRelationshipMappingEClass, IMULTI_RELATIONSHIP_MAPPING__JOIN_TABLE);
- createEAttribute(iMultiRelationshipMappingEClass, IMULTI_RELATIONSHIP_MAPPING__MAP_KEY);
- iOneToManyEClass = createEClass(IONE_TO_MANY);
- iManyToManyEClass = createEClass(IMANY_TO_MANY);
- iSingleRelationshipMappingEClass = createEClass(ISINGLE_RELATIONSHIP_MAPPING);
- createEAttribute(iSingleRelationshipMappingEClass, ISINGLE_RELATIONSHIP_MAPPING__FETCH);
- createEReference(iSingleRelationshipMappingEClass, ISINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS);
- createEReference(iSingleRelationshipMappingEClass, ISINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS);
- createEReference(iSingleRelationshipMappingEClass, ISINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS);
- createEAttribute(iSingleRelationshipMappingEClass, ISINGLE_RELATIONSHIP_MAPPING__OPTIONAL);
- iManyToOneEClass = createEClass(IMANY_TO_ONE);
- iOneToOneEClass = createEClass(IONE_TO_ONE);
- iJoinTableEClass = createEClass(IJOIN_TABLE);
- createEReference(iJoinTableEClass, IJOIN_TABLE__JOIN_COLUMNS);
- createEReference(iJoinTableEClass, IJOIN_TABLE__SPECIFIED_JOIN_COLUMNS);
- createEReference(iJoinTableEClass, IJOIN_TABLE__DEFAULT_JOIN_COLUMNS);
- createEReference(iJoinTableEClass, IJOIN_TABLE__INVERSE_JOIN_COLUMNS);
- createEReference(iJoinTableEClass, IJOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS);
- createEReference(iJoinTableEClass, IJOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS);
- iAbstractJoinColumnEClass = createEClass(IABSTRACT_JOIN_COLUMN);
- createEAttribute(iAbstractJoinColumnEClass, IABSTRACT_JOIN_COLUMN__REFERENCED_COLUMN_NAME);
- createEAttribute(iAbstractJoinColumnEClass, IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME);
- createEAttribute(iAbstractJoinColumnEClass, IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME);
- iJoinColumnEClass = createEClass(IJOIN_COLUMN);
- iOverrideEClass = createEClass(IOVERRIDE);
- createEAttribute(iOverrideEClass, IOVERRIDE__NAME);
- iAttributeOverrideEClass = createEClass(IATTRIBUTE_OVERRIDE);
- createEReference(iAttributeOverrideEClass, IATTRIBUTE_OVERRIDE__COLUMN);
- iAssociationOverrideEClass = createEClass(IASSOCIATION_OVERRIDE);
- createEReference(iAssociationOverrideEClass, IASSOCIATION_OVERRIDE__JOIN_COLUMNS);
- createEReference(iAssociationOverrideEClass, IASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS);
- createEReference(iAssociationOverrideEClass, IASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS);
- iDiscriminatorColumnEClass = createEClass(IDISCRIMINATOR_COLUMN);
- createEAttribute(iDiscriminatorColumnEClass, IDISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE);
- createEAttribute(iDiscriminatorColumnEClass, IDISCRIMINATOR_COLUMN__DEFAULT_LENGTH);
- createEAttribute(iDiscriminatorColumnEClass, IDISCRIMINATOR_COLUMN__SPECIFIED_LENGTH);
- createEAttribute(iDiscriminatorColumnEClass, IDISCRIMINATOR_COLUMN__LENGTH);
- iSecondaryTableEClass = createEClass(ISECONDARY_TABLE);
- createEReference(iSecondaryTableEClass, ISECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS);
- createEReference(iSecondaryTableEClass, ISECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS);
- createEReference(iSecondaryTableEClass, ISECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS);
- iPrimaryKeyJoinColumnEClass = createEClass(IPRIMARY_KEY_JOIN_COLUMN);
- iGeneratorEClass = createEClass(IGENERATOR);
- createEAttribute(iGeneratorEClass, IGENERATOR__NAME);
- createEAttribute(iGeneratorEClass, IGENERATOR__INITIAL_VALUE);
- createEAttribute(iGeneratorEClass, IGENERATOR__SPECIFIED_INITIAL_VALUE);
- createEAttribute(iGeneratorEClass, IGENERATOR__DEFAULT_INITIAL_VALUE);
- createEAttribute(iGeneratorEClass, IGENERATOR__ALLOCATION_SIZE);
- createEAttribute(iGeneratorEClass, IGENERATOR__SPECIFIED_ALLOCATION_SIZE);
- createEAttribute(iGeneratorEClass, IGENERATOR__DEFAULT_ALLOCATION_SIZE);
- iTableGeneratorEClass = createEClass(ITABLE_GENERATOR);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__TABLE);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__SPECIFIED_TABLE);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__DEFAULT_TABLE);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__CATALOG);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__SPECIFIED_CATALOG);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__DEFAULT_CATALOG);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__SCHEMA);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__SPECIFIED_SCHEMA);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__DEFAULT_SCHEMA);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__PK_COLUMN_NAME);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__VALUE_COLUMN_NAME);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__PK_COLUMN_VALUE);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE);
- createEAttribute(iTableGeneratorEClass, ITABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE);
- createEReference(iTableGeneratorEClass, ITABLE_GENERATOR__UNIQUE_CONSTRAINTS);
- iSequenceGeneratorEClass = createEClass(ISEQUENCE_GENERATOR);
- createEAttribute(iSequenceGeneratorEClass, ISEQUENCE_GENERATOR__SEQUENCE_NAME);
- createEAttribute(iSequenceGeneratorEClass, ISEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME);
- createEAttribute(iSequenceGeneratorEClass, ISEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME);
- iGeneratedValueEClass = createEClass(IGENERATED_VALUE);
- createEAttribute(iGeneratedValueEClass, IGENERATED_VALUE__STRATEGY);
- createEAttribute(iGeneratedValueEClass, IGENERATED_VALUE__GENERATOR);
- iQueryEClass = createEClass(IQUERY);
- createEAttribute(iQueryEClass, IQUERY__NAME);
- createEAttribute(iQueryEClass, IQUERY__QUERY);
- createEReference(iQueryEClass, IQUERY__HINTS);
- iNamedQueryEClass = createEClass(INAMED_QUERY);
- iNamedNativeQueryEClass = createEClass(INAMED_NATIVE_QUERY);
- createEAttribute(iNamedNativeQueryEClass, INAMED_NATIVE_QUERY__RESULT_CLASS);
- createEAttribute(iNamedNativeQueryEClass, INAMED_NATIVE_QUERY__RESULT_SET_MAPPING);
- iQueryHintEClass = createEClass(IQUERY_HINT);
- createEAttribute(iQueryHintEClass, IQUERY_HINT__NAME);
- createEAttribute(iQueryHintEClass, IQUERY_HINT__VALUE);
- iCascadeEClass = createEClass(ICASCADE);
- createEAttribute(iCascadeEClass, ICASCADE__ALL);
- createEAttribute(iCascadeEClass, ICASCADE__PERSIST);
- createEAttribute(iCascadeEClass, ICASCADE__MERGE);
- createEAttribute(iCascadeEClass, ICASCADE__REMOVE);
- createEAttribute(iCascadeEClass, ICASCADE__REFRESH);
- // Create enums
- defaultEagerFetchTypeEEnum = createEEnum(DEFAULT_EAGER_FETCH_TYPE);
- defaultLazyFetchTypeEEnum = createEEnum(DEFAULT_LAZY_FETCH_TYPE);
- defaultFalseBooleanEEnum = createEEnum(DEFAULT_FALSE_BOOLEAN);
- defaultTrueBooleanEEnum = createEEnum(DEFAULT_TRUE_BOOLEAN);
- temporalTypeEEnum = createEEnum(TEMPORAL_TYPE);
- inheritanceTypeEEnum = createEEnum(INHERITANCE_TYPE);
- discriminatorTypeEEnum = createEEnum(DISCRIMINATOR_TYPE);
- generationTypeEEnum = createEEnum(GENERATION_TYPE);
- enumTypeEEnum = createEEnum(ENUM_TYPE);
- cascadeTypeEEnum = createEEnum(CASCADE_TYPE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isInitialized = false;
-
- /**
- * Complete the initialization of the package and its meta-model. This
- * method is guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void initializePackageContents() {
- if (isInitialized)
- return;
- isInitialized = true;
- // Initialize package
- setName(eNAME);
- setNsPrefix(eNS_PREFIX);
- setNsURI(eNS_URI);
- // Obtain other dependent packages
- JpaCorePackage theJpaCorePackage = (JpaCorePackage) EPackage.Registry.INSTANCE.getEPackage(JpaCorePackage.eNS_URI);
- EcorePackage theEcorePackage = (EcorePackage) EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
- // Create type parameters
- // Set bounds for type parameters
- // Add supertypes to classes
- iMappedSuperclassEClass.getESuperTypes().add(theJpaCorePackage.getITypeMapping());
- iEntityEClass.getESuperTypes().add(theJpaCorePackage.getITypeMapping());
- iEmbeddableEClass.getESuperTypes().add(theJpaCorePackage.getITypeMapping());
- iTableEClass.getESuperTypes().add(theJpaCorePackage.getIJpaSourceObject());
- iUniqueConstraintEClass.getESuperTypes().add(theJpaCorePackage.getIJpaSourceObject());
- iNamedColumnEClass.getESuperTypes().add(theJpaCorePackage.getIJpaSourceObject());
- iAbstractColumnEClass.getESuperTypes().add(this.getINamedColumn());
- iColumnEClass.getESuperTypes().add(this.getIAbstractColumn());
- iBasicEClass.getESuperTypes().add(theJpaCorePackage.getIAttributeMapping());
- iBasicEClass.getESuperTypes().add(this.getIColumnMapping());
- iIdEClass.getESuperTypes().add(theJpaCorePackage.getIAttributeMapping());
- iIdEClass.getESuperTypes().add(this.getIColumnMapping());
- iTransientEClass.getESuperTypes().add(theJpaCorePackage.getIAttributeMapping());
- iVersionEClass.getESuperTypes().add(theJpaCorePackage.getIAttributeMapping());
- iVersionEClass.getESuperTypes().add(this.getIColumnMapping());
- iEmbeddedIdEClass.getESuperTypes().add(theJpaCorePackage.getIAttributeMapping());
- iEmbeddedEClass.getESuperTypes().add(theJpaCorePackage.getIAttributeMapping());
- iRelationshipMappingEClass.getESuperTypes().add(theJpaCorePackage.getIAttributeMapping());
- iNonOwningMappingEClass.getESuperTypes().add(this.getIRelationshipMapping());
- iMultiRelationshipMappingEClass.getESuperTypes().add(this.getINonOwningMapping());
- iOneToManyEClass.getESuperTypes().add(this.getIMultiRelationshipMapping());
- iManyToManyEClass.getESuperTypes().add(this.getIMultiRelationshipMapping());
- iSingleRelationshipMappingEClass.getESuperTypes().add(this.getIRelationshipMapping());
- iManyToOneEClass.getESuperTypes().add(this.getISingleRelationshipMapping());
- iOneToOneEClass.getESuperTypes().add(this.getISingleRelationshipMapping());
- iOneToOneEClass.getESuperTypes().add(this.getINonOwningMapping());
- iJoinTableEClass.getESuperTypes().add(this.getITable());
- iAbstractJoinColumnEClass.getESuperTypes().add(this.getINamedColumn());
- iJoinColumnEClass.getESuperTypes().add(this.getIAbstractColumn());
- iJoinColumnEClass.getESuperTypes().add(this.getIAbstractJoinColumn());
- iOverrideEClass.getESuperTypes().add(theJpaCorePackage.getIJpaSourceObject());
- iAttributeOverrideEClass.getESuperTypes().add(this.getIOverride());
- iAttributeOverrideEClass.getESuperTypes().add(this.getIColumnMapping());
- iAssociationOverrideEClass.getESuperTypes().add(this.getIOverride());
- iDiscriminatorColumnEClass.getESuperTypes().add(this.getINamedColumn());
- iSecondaryTableEClass.getESuperTypes().add(this.getITable());
- iPrimaryKeyJoinColumnEClass.getESuperTypes().add(this.getIAbstractJoinColumn());
- iGeneratorEClass.getESuperTypes().add(theJpaCorePackage.getIJpaSourceObject());
- iTableGeneratorEClass.getESuperTypes().add(this.getIGenerator());
- iSequenceGeneratorEClass.getESuperTypes().add(this.getIGenerator());
- iGeneratedValueEClass.getESuperTypes().add(theJpaCorePackage.getIJpaSourceObject());
- iQueryEClass.getESuperTypes().add(theJpaCorePackage.getIJpaSourceObject());
- iNamedQueryEClass.getESuperTypes().add(theJpaCorePackage.getIJpaSourceObject());
- iNamedQueryEClass.getESuperTypes().add(this.getIQuery());
- iNamedNativeQueryEClass.getESuperTypes().add(theJpaCorePackage.getIJpaSourceObject());
- iNamedNativeQueryEClass.getESuperTypes().add(this.getIQuery());
- iQueryHintEClass.getESuperTypes().add(theJpaCorePackage.getIJpaSourceObject());
- iCascadeEClass.getESuperTypes().add(theJpaCorePackage.getIJpaSourceObject());
- // Initialize classes and features; add operations and parameters
- initEClass(iMappedSuperclassEClass, IMappedSuperclass.class, "IMappedSuperclass", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getIMappedSuperclass_IdClass(), theEcorePackage.getEString(), "idClass", null, 0, 1, IMappedSuperclass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iEntityEClass, IEntity.class, "IEntity", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getIEntity_SpecifiedName(), ecorePackage.getEString(), "specifiedName", null, 0, 1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIEntity_DefaultName(), ecorePackage.getEString(), "defaultName", null, 0, 1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEntity_Table(), this.getITable(), null, "table", null, 1, 1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEntity_SpecifiedSecondaryTables(), this.getISecondaryTable(), null, "specifiedSecondaryTables", null, 0, -1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEntity_PrimaryKeyJoinColumns(), this.getIPrimaryKeyJoinColumn(), null, "primaryKeyJoinColumns", null, 0, -1, IEntity.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEntity_SpecifiedPrimaryKeyJoinColumns(), this.getIPrimaryKeyJoinColumn(), null, "specifiedPrimaryKeyJoinColumns", null, 0, -1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEntity_DefaultPrimaryKeyJoinColumns(), this.getIPrimaryKeyJoinColumn(), null, "defaultPrimaryKeyJoinColumns", null, 0, -1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIEntity_InheritanceStrategy(), this.getInheritanceType(), "inheritanceStrategy", null, 0, 1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIEntity_DefaultDiscriminatorValue(), theEcorePackage.getEString(), "defaultDiscriminatorValue", null, 0, 1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIEntity_SpecifiedDiscriminatorValue(), theEcorePackage.getEString(), "specifiedDiscriminatorValue", null, 0, 1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIEntity_DiscriminatorValue(), theEcorePackage.getEString(), "discriminatorValue", null, 0, 1, IEntity.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEReference(getIEntity_DiscriminatorColumn(), this.getIDiscriminatorColumn(), null, "discriminatorColumn", null, 0, 1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEntity_SequenceGenerator(), this.getISequenceGenerator(), null, "sequenceGenerator", null, 0, 1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEntity_TableGenerator(), this.getITableGenerator(), null, "tableGenerator", null, 0, 1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEntity_AttributeOverrides(), this.getIAttributeOverride(), null, "attributeOverrides", null, 0, -1, IEntity.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEntity_SpecifiedAttributeOverrides(), this.getIAttributeOverride(), null, "specifiedAttributeOverrides", null, 0, -1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEntity_DefaultAttributeOverrides(), this.getIAttributeOverride(), null, "defaultAttributeOverrides", null, 0, -1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEntity_AssociationOverrides(), this.getIAssociationOverride(), null, "associationOverrides", null, 0, -1, IEntity.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEntity_SpecifiedAssociationOverrides(), this.getIAssociationOverride(), null, "specifiedAssociationOverrides", null, 0, -1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEntity_DefaultAssociationOverrides(), this.getIAssociationOverride(), null, "defaultAssociationOverrides", null, 0, -1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEntity_NamedQueries(), this.getINamedQuery(), null, "namedQueries", null, 0, -1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEntity_NamedNativeQueries(), this.getINamedNativeQuery(), null, "namedNativeQueries", null, 0, -1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIEntity_IdClass(), theEcorePackage.getEString(), "idClass", null, 0, 1, IEntity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- addEOperation(iEntityEClass, ecorePackage.getEBoolean(), "discriminatorValueIsAllowed", 0, 1, IS_UNIQUE, IS_ORDERED);
- addEOperation(iEntityEClass, this.getISecondaryTable(), "getSecondaryTables", 0, -1, IS_UNIQUE, IS_ORDERED);
- addEOperation(iEntityEClass, this.getIEntity(), "parentEntity", 0, 1, IS_UNIQUE, IS_ORDERED);
- addEOperation(iEntityEClass, this.getIEntity(), "rootEntity", 0, 1, IS_UNIQUE, IS_ORDERED);
- initEClass(iEmbeddableEClass, IEmbeddable.class, "IEmbeddable", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iTableEClass, ITable.class, "ITable", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getITable_Name(), ecorePackage.getEString(), "name", null, 0, 1, ITable.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getITable_SpecifiedName(), ecorePackage.getEString(), "specifiedName", null, 0, 1, ITable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getITable_DefaultName(), ecorePackage.getEString(), "defaultName", null, 0, 1, ITable.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getITable_Catalog(), ecorePackage.getEString(), "catalog", null, 0, 1, ITable.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getITable_SpecifiedCatalog(), ecorePackage.getEString(), "specifiedCatalog", null, 0, 1, ITable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getITable_DefaultCatalog(), ecorePackage.getEString(), "defaultCatalog", null, 0, 1, ITable.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getITable_Schema(), ecorePackage.getEString(), "schema", null, 0, 1, ITable.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getITable_SpecifiedSchema(), ecorePackage.getEString(), "specifiedSchema", null, 0, 1, ITable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getITable_DefaultSchema(), ecorePackage.getEString(), "defaultSchema", null, 0, 1, ITable.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getITable_UniqueConstraints(), this.getIUniqueConstraint(), null, "uniqueConstraints", null, 0, -1, ITable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iUniqueConstraintEClass, IUniqueConstraint.class, "IUniqueConstraint", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getIUniqueConstraint_ColumnNames(), theEcorePackage.getEString(), "columnNames", null, 0, -1, IUniqueConstraint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iNamedColumnEClass, INamedColumn.class, "INamedColumn", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getINamedColumn_Name(), ecorePackage.getEString(), "name", null, 0, 1, INamedColumn.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getINamedColumn_SpecifiedName(), ecorePackage.getEString(), "specifiedName", null, 0, 1, INamedColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getINamedColumn_DefaultName(), ecorePackage.getEString(), "defaultName", null, 0, 1, INamedColumn.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getINamedColumn_ColumnDefinition(), ecorePackage.getEString(), "columnDefinition", null, 0, 1, INamedColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iAbstractColumnEClass, IAbstractColumn.class, "IAbstractColumn", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getIAbstractColumn_Unique(), this.getDefaultFalseBoolean(), "unique", null, 0, 1, IAbstractColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIAbstractColumn_Nullable(), this.getDefaultTrueBoolean(), "nullable", null, 0, 1, IAbstractColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIAbstractColumn_Insertable(), this.getDefaultTrueBoolean(), "insertable", null, 0, 1, IAbstractColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIAbstractColumn_Updatable(), this.getDefaultTrueBoolean(), "updatable", null, 0, 1, IAbstractColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIAbstractColumn_Table(), ecorePackage.getEString(), "table", null, 0, 1, IAbstractColumn.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getIAbstractColumn_SpecifiedTable(), ecorePackage.getEString(), "specifiedTable", null, 0, 1, IAbstractColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIAbstractColumn_DefaultTable(), ecorePackage.getEString(), "defaultTable", null, 0, 1, IAbstractColumn.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iColumnEClass, IColumn.class, "IColumn", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getIColumn_Length(), ecorePackage.getEInt(), "length", null, 0, 1, IColumn.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getIColumn_SpecifiedLength(), theEcorePackage.getEInt(), "specifiedLength", "-1", 0, 1, IColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIColumn_Precision(), ecorePackage.getEInt(), "precision", null, 0, 1, IColumn.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getIColumn_SpecifiedPrecision(), theEcorePackage.getEInt(), "specifiedPrecision", "-1", 0, 1, IColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIColumn_Scale(), ecorePackage.getEInt(), "scale", null, 0, 1, IColumn.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getIColumn_SpecifiedScale(), theEcorePackage.getEInt(), "specifiedScale", "-1", 0, 1, IColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- addEOperation(iColumnEClass, theEcorePackage.getEInt(), "getDefaultLength", 0, 1, IS_UNIQUE, IS_ORDERED);
- addEOperation(iColumnEClass, theEcorePackage.getEInt(), "getDefaultPrecision", 0, 1, IS_UNIQUE, IS_ORDERED);
- addEOperation(iColumnEClass, theEcorePackage.getEInt(), "getDefaultScale", 0, 1, IS_UNIQUE, IS_ORDERED);
- initEClass(iColumnMappingEClass, IColumnMapping.class, "IColumnMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- addEOperation(iColumnMappingEClass, this.getIColumn(), "getColumn", 0, 1, IS_UNIQUE, IS_ORDERED);
- initEClass(iBasicEClass, IBasic.class, "IBasic", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getIBasic_Fetch(), this.getDefaultEagerFetchType(), "fetch", null, 0, 1, IBasic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIBasic_Optional(), this.getDefaultTrueBoolean(), "optional", null, 0, 1, IBasic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIBasic_Column(), this.getIColumn(), null, "column", null, 1, 1, IBasic.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIBasic_Lob(), ecorePackage.getEBoolean(), "lob", null, 0, 1, IBasic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIBasic_Temporal(), this.getTemporalType(), "temporal", null, 0, 1, IBasic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIBasic_Enumerated(), this.getEnumType(), "enumerated", null, 0, 1, IBasic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iIdEClass, IId.class, "IId", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getIId_Column(), this.getIColumn(), null, "column", null, 1, 1, IId.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIId_GeneratedValue(), this.getIGeneratedValue(), null, "generatedValue", null, 0, 1, IId.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIId_Temporal(), this.getTemporalType(), "temporal", null, 0, 1, IId.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIId_TableGenerator(), this.getITableGenerator(), null, "tableGenerator", null, 0, 1, IId.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIId_SequenceGenerator(), this.getISequenceGenerator(), null, "sequenceGenerator", null, 0, 1, IId.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iTransientEClass, ITransient.class, "ITransient", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iVersionEClass, IVersion.class, "IVersion", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getIVersion_Column(), this.getIColumn(), null, "column", null, 1, 1, IVersion.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIVersion_Temporal(), this.getTemporalType(), "temporal", null, 0, 1, IVersion.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iEmbeddedIdEClass, IEmbeddedId.class, "IEmbeddedId", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iEmbeddedEClass, IEmbedded.class, "IEmbedded", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getIEmbedded_AttributeOverrides(), this.getIAttributeOverride(), null, "attributeOverrides", null, 0, -1, IEmbedded.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEmbedded_SpecifiedAttributeOverrides(), this.getIAttributeOverride(), null, "specifiedAttributeOverrides", null, 0, -1, IEmbedded.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIEmbedded_DefaultAttributeOverrides(), this.getIAttributeOverride(), null, "defaultAttributeOverrides", null, 0, -1, IEmbedded.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- addEOperation(iEmbeddedEClass, this.getIEmbeddable(), "embeddable", 0, 1, IS_UNIQUE, IS_ORDERED);
- initEClass(iRelationshipMappingEClass, IRelationshipMapping.class, "IRelationshipMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getIRelationshipMapping_TargetEntity(), ecorePackage.getEString(), "targetEntity", null, 0, 1, IRelationshipMapping.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getIRelationshipMapping_SpecifiedTargetEntity(), ecorePackage.getEString(), "specifiedTargetEntity", null, 0, 1, IRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIRelationshipMapping_DefaultTargetEntity(), ecorePackage.getEString(), "defaultTargetEntity", null, 0, 1, IRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIRelationshipMapping_ResolvedTargetEntity(), this.getIEntity(), null, "resolvedTargetEntity", null, 0, 1, IRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIRelationshipMapping_Cascade(), this.getICascade(), null, "cascade", null, 0, 1, IRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iNonOwningMappingEClass, INonOwningMapping.class, "INonOwningMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getINonOwningMapping_MappedBy(), theEcorePackage.getEString(), "mappedBy", null, 0, 1, INonOwningMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iMultiRelationshipMappingEClass, IMultiRelationshipMapping.class, "IMultiRelationshipMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getIMultiRelationshipMapping_OrderBy(), theEcorePackage.getEString(), "orderBy", null, 0, 1, IMultiRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
- initEAttribute(getIMultiRelationshipMapping_Fetch(), this.getDefaultLazyFetchType(), "fetch", null, 0, 1, IMultiRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIMultiRelationshipMapping_JoinTable(), this.getIJoinTable(), null, "joinTable", null, 1, 1, IMultiRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIMultiRelationshipMapping_MapKey(), theEcorePackage.getEString(), "mapKey", null, 0, 1, IMultiRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- addEOperation(iMultiRelationshipMappingEClass, ecorePackage.getEBoolean(), "isNoOrdering", 1, 1, !IS_UNIQUE, !IS_ORDERED);
- addEOperation(iMultiRelationshipMappingEClass, null, "setNoOrdering", 0, 1, !IS_UNIQUE, !IS_ORDERED);
- addEOperation(iMultiRelationshipMappingEClass, theEcorePackage.getEBoolean(), "isOrderByPk", 1, 1, !IS_UNIQUE, !IS_ORDERED);
- addEOperation(iMultiRelationshipMappingEClass, null, "setOrderByPk", 0, 1, !IS_UNIQUE, !IS_ORDERED);
- addEOperation(iMultiRelationshipMappingEClass, theEcorePackage.getEBoolean(), "isCustomOrdering", 1, 1, !IS_UNIQUE, !IS_ORDERED);
- initEClass(iOneToManyEClass, IOneToMany.class, "IOneToMany", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iManyToManyEClass, IManyToMany.class, "IManyToMany", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iSingleRelationshipMappingEClass, ISingleRelationshipMapping.class, "ISingleRelationshipMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getISingleRelationshipMapping_Fetch(), this.getDefaultEagerFetchType(), "fetch", null, 0, 1, ISingleRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getISingleRelationshipMapping_JoinColumns(), this.getIJoinColumn(), null, "joinColumns", null, 0, -1, ISingleRelationshipMapping.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getISingleRelationshipMapping_SpecifiedJoinColumns(), this.getIJoinColumn(), null, "specifiedJoinColumns", null, 0, -1, ISingleRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getISingleRelationshipMapping_DefaultJoinColumns(), this.getIJoinColumn(), null, "defaultJoinColumns", null, 0, -1, ISingleRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getISingleRelationshipMapping_Optional(), this.getDefaultTrueBoolean(), "optional", null, 0, 1, ISingleRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iManyToOneEClass, IManyToOne.class, "IManyToOne", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iOneToOneEClass, IOneToOne.class, "IOneToOne", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iJoinTableEClass, IJoinTable.class, "IJoinTable", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getIJoinTable_JoinColumns(), this.getIJoinColumn(), null, "joinColumns", null, 0, -1, IJoinTable.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIJoinTable_SpecifiedJoinColumns(), this.getIJoinColumn(), null, "specifiedJoinColumns", null, 0, -1, IJoinTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIJoinTable_DefaultJoinColumns(), this.getIJoinColumn(), null, "defaultJoinColumns", null, 0, -1, IJoinTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIJoinTable_InverseJoinColumns(), this.getIJoinColumn(), null, "inverseJoinColumns", null, 0, -1, IJoinTable.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIJoinTable_SpecifiedInverseJoinColumns(), this.getIJoinColumn(), null, "specifiedInverseJoinColumns", null, 0, -1, IJoinTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIJoinTable_DefaultInverseJoinColumns(), this.getIJoinColumn(), null, "defaultInverseJoinColumns", null, 0, -1, IJoinTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iAbstractJoinColumnEClass, IAbstractJoinColumn.class, "IAbstractJoinColumn", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getIAbstractJoinColumn_ReferencedColumnName(), ecorePackage.getEString(), "referencedColumnName", null, 0, 1, IAbstractJoinColumn.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getIAbstractJoinColumn_SpecifiedReferencedColumnName(), ecorePackage.getEString(), "specifiedReferencedColumnName", null, 0, 1, IAbstractJoinColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIAbstractJoinColumn_DefaultReferencedColumnName(), ecorePackage.getEString(), "defaultReferencedColumnName", null, 0, 1, IAbstractJoinColumn.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iJoinColumnEClass, IJoinColumn.class, "IJoinColumn", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iOverrideEClass, IOverride.class, "IOverride", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getIOverride_Name(), theEcorePackage.getEString(), "name", null, 0, 1, IOverride.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iAttributeOverrideEClass, IAttributeOverride.class, "IAttributeOverride", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getIAttributeOverride_Column(), this.getIColumn(), null, "column", null, 1, 1, IAttributeOverride.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iAssociationOverrideEClass, IAssociationOverride.class, "IAssociationOverride", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getIAssociationOverride_JoinColumns(), this.getIJoinColumn(), null, "joinColumns", null, 0, -1, IAssociationOverride.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIAssociationOverride_SpecifiedJoinColumns(), this.getIJoinColumn(), null, "specifiedJoinColumns", null, 0, -1, IAssociationOverride.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIAssociationOverride_DefaultJoinColumns(), this.getIJoinColumn(), null, "defaultJoinColumns", null, 0, -1, IAssociationOverride.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iDiscriminatorColumnEClass, IDiscriminatorColumn.class, "IDiscriminatorColumn", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getIDiscriminatorColumn_DiscriminatorType(), this.getDiscriminatorType(), "discriminatorType", null, 0, 1, IDiscriminatorColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIDiscriminatorColumn_DefaultLength(), theEcorePackage.getEInt(), "defaultLength", "31", 0, 1, IDiscriminatorColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIDiscriminatorColumn_SpecifiedLength(), theEcorePackage.getEInt(), "specifiedLength", "-1", 0, 1, IDiscriminatorColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIDiscriminatorColumn_Length(), theEcorePackage.getEInt(), "length", null, 0, 1, IDiscriminatorColumn.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEClass(iSecondaryTableEClass, ISecondaryTable.class, "ISecondaryTable", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getISecondaryTable_PrimaryKeyJoinColumns(), this.getIPrimaryKeyJoinColumn(), null, "primaryKeyJoinColumns", null, 0, -1, ISecondaryTable.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getISecondaryTable_SpecifiedPrimaryKeyJoinColumns(), this.getIPrimaryKeyJoinColumn(), null, "specifiedPrimaryKeyJoinColumns", null, 0, -1, ISecondaryTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getISecondaryTable_DefaultPrimaryKeyJoinColumns(), this.getIPrimaryKeyJoinColumn(), null, "defaultPrimaryKeyJoinColumns", null, 0, -1, ISecondaryTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- addEOperation(iSecondaryTableEClass, theJpaCorePackage.getITypeMapping(), "typeMapping", 0, 1, IS_UNIQUE, IS_ORDERED);
- initEClass(iPrimaryKeyJoinColumnEClass, IPrimaryKeyJoinColumn.class, "IPrimaryKeyJoinColumn", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iGeneratorEClass, IGenerator.class, "IGenerator", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getIGenerator_Name(), ecorePackage.getEString(), "name", null, 0, 1, IGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIGenerator_InitialValue(), theEcorePackage.getEInt(), "initialValue", null, 0, 1, IGenerator.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getIGenerator_SpecifiedInitialValue(), theEcorePackage.getEInt(), "specifiedInitialValue", "-1", 0, 1, IGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIGenerator_DefaultInitialValue(), theEcorePackage.getEInt(), "defaultInitialValue", null, 0, 1, IGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIGenerator_AllocationSize(), theEcorePackage.getEInt(), "allocationSize", null, 0, 1, IGenerator.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getIGenerator_SpecifiedAllocationSize(), theEcorePackage.getEInt(), "specifiedAllocationSize", "-1", 0, 1, IGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIGenerator_DefaultAllocationSize(), theEcorePackage.getEInt(), "defaultAllocationSize", null, 0, 1, IGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iTableGeneratorEClass, ITableGenerator.class, "ITableGenerator", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getITableGenerator_Table(), ecorePackage.getEString(), "table", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_SpecifiedTable(), ecorePackage.getEString(), "specifiedTable", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_DefaultTable(), ecorePackage.getEString(), "defaultTable", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_Catalog(), ecorePackage.getEString(), "catalog", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_SpecifiedCatalog(), ecorePackage.getEString(), "specifiedCatalog", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_DefaultCatalog(), ecorePackage.getEString(), "defaultCatalog", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_Schema(), ecorePackage.getEString(), "schema", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_SpecifiedSchema(), ecorePackage.getEString(), "specifiedSchema", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_DefaultSchema(), ecorePackage.getEString(), "defaultSchema", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_PkColumnName(), ecorePackage.getEString(), "pkColumnName", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_SpecifiedPkColumnName(), ecorePackage.getEString(), "specifiedPkColumnName", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_DefaultPkColumnName(), ecorePackage.getEString(), "defaultPkColumnName", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_ValueColumnName(), ecorePackage.getEString(), "valueColumnName", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_SpecifiedValueColumnName(), ecorePackage.getEString(), "specifiedValueColumnName", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_DefaultValueColumnName(), ecorePackage.getEString(), "defaultValueColumnName", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_PkColumnValue(), ecorePackage.getEString(), "pkColumnValue", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_SpecifiedPkColumnValue(), ecorePackage.getEString(), "specifiedPkColumnValue", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getITableGenerator_DefaultPkColumnValue(), ecorePackage.getEString(), "defaultPkColumnValue", null, 0, 1, ITableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getITableGenerator_UniqueConstraints(), this.getIUniqueConstraint(), null, "uniqueConstraints", null, 0, -1, ITableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iSequenceGeneratorEClass, ISequenceGenerator.class, "ISequenceGenerator", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getISequenceGenerator_SequenceName(), ecorePackage.getEString(), "sequenceName", null, 0, 1, ISequenceGenerator.class, !IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getISequenceGenerator_SpecifiedSequenceName(), ecorePackage.getEString(), "specifiedSequenceName", null, 0, 1, ISequenceGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getISequenceGenerator_DefaultSequenceName(), ecorePackage.getEString(), "defaultSequenceName", null, 0, 1, ISequenceGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iGeneratedValueEClass, IGeneratedValue.class, "IGeneratedValue", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getIGeneratedValue_Strategy(), this.getGenerationType(), "strategy", null, 0, 1, IGeneratedValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIGeneratedValue_Generator(), theEcorePackage.getEString(), "generator", null, 0, 1, IGeneratedValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iQueryEClass, IQuery.class, "IQuery", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getIQuery_Name(), theEcorePackage.getEString(), "name", null, 0, 1, IQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIQuery_Query(), theEcorePackage.getEString(), "query", null, 0, 1, IQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getIQuery_Hints(), this.getIQueryHint(), null, "hints", null, 0, -1, IQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iNamedQueryEClass, INamedQuery.class, "INamedQuery", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEClass(iNamedNativeQueryEClass, INamedNativeQuery.class, "INamedNativeQuery", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getINamedNativeQuery_ResultClass(), theEcorePackage.getEString(), "resultClass", null, 0, 1, INamedNativeQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getINamedNativeQuery_ResultSetMapping(), theEcorePackage.getEString(), "resultSetMapping", null, 0, 1, INamedNativeQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iQueryHintEClass, IQueryHint.class, "IQueryHint", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getIQueryHint_Name(), theEcorePackage.getEString(), "name", null, 0, 1, IQueryHint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getIQueryHint_Value(), theEcorePackage.getEString(), "value", null, 0, 1, IQueryHint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(iCascadeEClass, ICascade.class, "ICascade", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getICascade_All(), theEcorePackage.getEBoolean(), "all", null, 0, 1, ICascade.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getICascade_Persist(), theEcorePackage.getEBoolean(), "persist", null, 0, 1, ICascade.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getICascade_Merge(), theEcorePackage.getEBoolean(), "merge", null, 0, 1, ICascade.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getICascade_Remove(), theEcorePackage.getEBoolean(), "remove", null, 0, 1, ICascade.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getICascade_Refresh(), theEcorePackage.getEBoolean(), "refresh", null, 0, 1, ICascade.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- // Initialize enums and add enum literals
- initEEnum(defaultEagerFetchTypeEEnum, DefaultEagerFetchType.class, "DefaultEagerFetchType");
- addEEnumLiteral(defaultEagerFetchTypeEEnum, DefaultEagerFetchType.DEFAULT);
- addEEnumLiteral(defaultEagerFetchTypeEEnum, DefaultEagerFetchType.EAGER);
- addEEnumLiteral(defaultEagerFetchTypeEEnum, DefaultEagerFetchType.LAZY);
- initEEnum(defaultLazyFetchTypeEEnum, DefaultLazyFetchType.class, "DefaultLazyFetchType");
- addEEnumLiteral(defaultLazyFetchTypeEEnum, DefaultLazyFetchType.DEFAULT);
- addEEnumLiteral(defaultLazyFetchTypeEEnum, DefaultLazyFetchType.LAZY);
- addEEnumLiteral(defaultLazyFetchTypeEEnum, DefaultLazyFetchType.EAGER);
- initEEnum(defaultFalseBooleanEEnum, DefaultFalseBoolean.class, "DefaultFalseBoolean");
- addEEnumLiteral(defaultFalseBooleanEEnum, DefaultFalseBoolean.DEFAULT);
- addEEnumLiteral(defaultFalseBooleanEEnum, DefaultFalseBoolean.FALSE);
- addEEnumLiteral(defaultFalseBooleanEEnum, DefaultFalseBoolean.TRUE);
- initEEnum(defaultTrueBooleanEEnum, DefaultTrueBoolean.class, "DefaultTrueBoolean");
- addEEnumLiteral(defaultTrueBooleanEEnum, DefaultTrueBoolean.DEFAULT);
- addEEnumLiteral(defaultTrueBooleanEEnum, DefaultTrueBoolean.TRUE);
- addEEnumLiteral(defaultTrueBooleanEEnum, DefaultTrueBoolean.FALSE);
- initEEnum(temporalTypeEEnum, TemporalType.class, "TemporalType");
- addEEnumLiteral(temporalTypeEEnum, TemporalType.NULL);
- addEEnumLiteral(temporalTypeEEnum, TemporalType.DATE);
- addEEnumLiteral(temporalTypeEEnum, TemporalType.TIME);
- addEEnumLiteral(temporalTypeEEnum, TemporalType.TIMESTAMP);
- initEEnum(inheritanceTypeEEnum, InheritanceType.class, "InheritanceType");
- addEEnumLiteral(inheritanceTypeEEnum, InheritanceType.DEFAULT);
- addEEnumLiteral(inheritanceTypeEEnum, InheritanceType.SINGLE_TABLE);
- addEEnumLiteral(inheritanceTypeEEnum, InheritanceType.JOINED);
- addEEnumLiteral(inheritanceTypeEEnum, InheritanceType.TABLE_PER_CLASS);
- initEEnum(discriminatorTypeEEnum, DiscriminatorType.class, "DiscriminatorType");
- addEEnumLiteral(discriminatorTypeEEnum, DiscriminatorType.DEFAULT);
- addEEnumLiteral(discriminatorTypeEEnum, DiscriminatorType.STRING);
- addEEnumLiteral(discriminatorTypeEEnum, DiscriminatorType.CHAR);
- addEEnumLiteral(discriminatorTypeEEnum, DiscriminatorType.INTEGER);
- initEEnum(generationTypeEEnum, GenerationType.class, "GenerationType");
- addEEnumLiteral(generationTypeEEnum, GenerationType.DEFAULT);
- addEEnumLiteral(generationTypeEEnum, GenerationType.AUTO);
- addEEnumLiteral(generationTypeEEnum, GenerationType.IDENTITY);
- addEEnumLiteral(generationTypeEEnum, GenerationType.SEQUENCE);
- addEEnumLiteral(generationTypeEEnum, GenerationType.TABLE);
- initEEnum(enumTypeEEnum, EnumType.class, "EnumType");
- addEEnumLiteral(enumTypeEEnum, EnumType.DEFAULT);
- addEEnumLiteral(enumTypeEEnum, EnumType.ORDINAL);
- addEEnumLiteral(enumTypeEEnum, EnumType.STRING);
- initEEnum(cascadeTypeEEnum, CascadeType.class, "CascadeType");
- addEEnumLiteral(cascadeTypeEEnum, CascadeType.ALL);
- addEEnumLiteral(cascadeTypeEEnum, CascadeType.PERSIST);
- addEEnumLiteral(cascadeTypeEEnum, CascadeType.MERGE);
- addEEnumLiteral(cascadeTypeEEnum, CascadeType.REMOVE);
- addEEnumLiteral(cascadeTypeEEnum, CascadeType.REFRESH);
- }
-
-
- /**
- * <!-- begin-user-doc -->
- * Defines literals for the meta objects that represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @generated
- */
- public interface Literals
- {
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IMappedSuperclass <em>IMapped Superclass</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IMappedSuperclass
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIMappedSuperclass()
- * @generated
- */
- public static final EClass IMAPPED_SUPERCLASS = eINSTANCE.getIMappedSuperclass();
-
- /**
- * The meta object literal for the '<em><b>Id Class</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IMAPPED_SUPERCLASS__ID_CLASS = eINSTANCE.getIMappedSuperclass_IdClass();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IEntity <em>IEntity</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IEntity
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEntity()
- * @generated
- */
- public static final EClass IENTITY = eINSTANCE.getIEntity();
-
- /**
- * The meta object literal for the '<em><b>Specified Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IENTITY__SPECIFIED_NAME = eINSTANCE.getIEntity_SpecifiedName();
-
- /**
- * The meta object literal for the '<em><b>Default Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IENTITY__DEFAULT_NAME = eINSTANCE.getIEntity_DefaultName();
-
- /**
- * The meta object literal for the '<em><b>Table</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IENTITY__TABLE = eINSTANCE.getIEntity_Table();
-
- /**
- * The meta object literal for the '<em><b>Specified Secondary Tables</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IENTITY__SPECIFIED_SECONDARY_TABLES = eINSTANCE.getIEntity_SpecifiedSecondaryTables();
-
- /**
- * The meta object literal for the '<em><b>Inheritance Strategy</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IENTITY__INHERITANCE_STRATEGY = eINSTANCE.getIEntity_InheritanceStrategy();
-
- /**
- * The meta object literal for the '<em><b>Discriminator Column</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IENTITY__DISCRIMINATOR_COLUMN = eINSTANCE.getIEntity_DiscriminatorColumn();
-
- /**
- * The meta object literal for the '<em><b>Sequence Generator</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IENTITY__SEQUENCE_GENERATOR = eINSTANCE.getIEntity_SequenceGenerator();
-
- /**
- * The meta object literal for the '<em><b>Table Generator</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IENTITY__TABLE_GENERATOR = eINSTANCE.getIEntity_TableGenerator();
-
- /**
- * The meta object literal for the '<em><b>Default Discriminator Value</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IENTITY__DEFAULT_DISCRIMINATOR_VALUE = eINSTANCE.getIEntity_DefaultDiscriminatorValue();
-
- /**
- * The meta object literal for the '<em><b>Specified Discriminator Value</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IENTITY__SPECIFIED_DISCRIMINATOR_VALUE = eINSTANCE.getIEntity_SpecifiedDiscriminatorValue();
-
- /**
- * The meta object literal for the '<em><b>Discriminator Value</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IENTITY__DISCRIMINATOR_VALUE = eINSTANCE.getIEntity_DiscriminatorValue();
-
- /**
- * The meta object literal for the '<em><b>Primary Key Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IENTITY__PRIMARY_KEY_JOIN_COLUMNS = eINSTANCE.getIEntity_PrimaryKeyJoinColumns();
-
- /**
- * The meta object literal for the '<em><b>Specified Primary Key Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS = eINSTANCE.getIEntity_SpecifiedPrimaryKeyJoinColumns();
-
- /**
- * The meta object literal for the '<em><b>Default Primary Key Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IENTITY__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS = eINSTANCE.getIEntity_DefaultPrimaryKeyJoinColumns();
-
- /**
- * The meta object literal for the '<em><b>Attribute Overrides</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IENTITY__ATTRIBUTE_OVERRIDES = eINSTANCE.getIEntity_AttributeOverrides();
-
- /**
- * The meta object literal for the '<em><b>Specified Attribute Overrides</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES = eINSTANCE.getIEntity_SpecifiedAttributeOverrides();
-
- /**
- * The meta object literal for the '<em><b>Default Attribute Overrides</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IENTITY__DEFAULT_ATTRIBUTE_OVERRIDES = eINSTANCE.getIEntity_DefaultAttributeOverrides();
-
- /**
- * The meta object literal for the '<em><b>Association Overrides</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IENTITY__ASSOCIATION_OVERRIDES = eINSTANCE.getIEntity_AssociationOverrides();
-
- /**
- * The meta object literal for the '<em><b>Specified Association Overrides</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IENTITY__SPECIFIED_ASSOCIATION_OVERRIDES = eINSTANCE.getIEntity_SpecifiedAssociationOverrides();
-
- /**
- * The meta object literal for the '<em><b>Default Association Overrides</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IENTITY__DEFAULT_ASSOCIATION_OVERRIDES = eINSTANCE.getIEntity_DefaultAssociationOverrides();
-
- /**
- * The meta object literal for the '<em><b>Named Queries</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IENTITY__NAMED_QUERIES = eINSTANCE.getIEntity_NamedQueries();
-
- /**
- * The meta object literal for the '<em><b>Named Native Queries</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IENTITY__NAMED_NATIVE_QUERIES = eINSTANCE.getIEntity_NamedNativeQueries();
-
- /**
- * The meta object literal for the '<em><b>Id Class</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IENTITY__ID_CLASS = eINSTANCE.getIEntity_IdClass();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IEmbeddable <em>IEmbeddable</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IEmbeddable
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEmbeddable()
- * @generated
- */
- public static final EClass IEMBEDDABLE = eINSTANCE.getIEmbeddable();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.ITable <em>ITable</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.ITable
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITable()
- * @generated
- */
- public static final EClass ITABLE = eINSTANCE.getITable();
-
- /**
- * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE__NAME = eINSTANCE.getITable_Name();
-
- /**
- * The meta object literal for the '<em><b>Specified Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE__SPECIFIED_NAME = eINSTANCE.getITable_SpecifiedName();
-
- /**
- * The meta object literal for the '<em><b>Default Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE__DEFAULT_NAME = eINSTANCE.getITable_DefaultName();
-
- /**
- * The meta object literal for the '<em><b>Catalog</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE__CATALOG = eINSTANCE.getITable_Catalog();
-
- /**
- * The meta object literal for the '<em><b>Specified Catalog</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE__SPECIFIED_CATALOG = eINSTANCE.getITable_SpecifiedCatalog();
-
- /**
- * The meta object literal for the '<em><b>Default Catalog</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE__DEFAULT_CATALOG = eINSTANCE.getITable_DefaultCatalog();
-
- /**
- * The meta object literal for the '<em><b>Schema</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE__SCHEMA = eINSTANCE.getITable_Schema();
-
- /**
- * The meta object literal for the '<em><b>Specified Schema</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE__SPECIFIED_SCHEMA = eINSTANCE.getITable_SpecifiedSchema();
-
- /**
- * The meta object literal for the '<em><b>Default Schema</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE__DEFAULT_SCHEMA = eINSTANCE.getITable_DefaultSchema();
-
- /**
- * The meta object literal for the '<em><b>Unique Constraints</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ITABLE__UNIQUE_CONSTRAINTS = eINSTANCE.getITable_UniqueConstraints();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IUniqueConstraint <em>IUnique Constraint</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IUniqueConstraint
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIUniqueConstraint()
- * @generated
- */
- public static final EClass IUNIQUE_CONSTRAINT = eINSTANCE.getIUniqueConstraint();
-
- /**
- * The meta object literal for the '<em><b>Column Names</b></em>' attribute list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IUNIQUE_CONSTRAINT__COLUMN_NAMES = eINSTANCE.getIUniqueConstraint_ColumnNames();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.INamedColumn <em>INamed Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.INamedColumn
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINamedColumn()
- * @generated
- */
- public static final EClass INAMED_COLUMN = eINSTANCE.getINamedColumn();
-
- /**
- * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute INAMED_COLUMN__NAME = eINSTANCE.getINamedColumn_Name();
-
- /**
- * The meta object literal for the '<em><b>Specified Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute INAMED_COLUMN__SPECIFIED_NAME = eINSTANCE.getINamedColumn_SpecifiedName();
-
- /**
- * The meta object literal for the '<em><b>Default Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute INAMED_COLUMN__DEFAULT_NAME = eINSTANCE.getINamedColumn_DefaultName();
-
- /**
- * The meta object literal for the '<em><b>Column Definition</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute INAMED_COLUMN__COLUMN_DEFINITION = eINSTANCE.getINamedColumn_ColumnDefinition();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn <em>IAbstract Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractColumn
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAbstractColumn()
- * @generated
- */
- public static final EClass IABSTRACT_COLUMN = eINSTANCE.getIAbstractColumn();
-
- /**
- * The meta object literal for the '<em><b>Unique</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IABSTRACT_COLUMN__UNIQUE = eINSTANCE.getIAbstractColumn_Unique();
-
- /**
- * The meta object literal for the '<em><b>Nullable</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IABSTRACT_COLUMN__NULLABLE = eINSTANCE.getIAbstractColumn_Nullable();
-
- /**
- * The meta object literal for the '<em><b>Insertable</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IABSTRACT_COLUMN__INSERTABLE = eINSTANCE.getIAbstractColumn_Insertable();
-
- /**
- * The meta object literal for the '<em><b>Updatable</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IABSTRACT_COLUMN__UPDATABLE = eINSTANCE.getIAbstractColumn_Updatable();
-
- /**
- * The meta object literal for the '<em><b>Table</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IABSTRACT_COLUMN__TABLE = eINSTANCE.getIAbstractColumn_Table();
-
- /**
- * The meta object literal for the '<em><b>Specified Table</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IABSTRACT_COLUMN__SPECIFIED_TABLE = eINSTANCE.getIAbstractColumn_SpecifiedTable();
-
- /**
- * The meta object literal for the '<em><b>Default Table</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IABSTRACT_COLUMN__DEFAULT_TABLE = eINSTANCE.getIAbstractColumn_DefaultTable();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IColumn <em>IColumn</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IColumn
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIColumn()
- * @generated
- */
- public static final EClass ICOLUMN = eINSTANCE.getIColumn();
-
- /**
- * The meta object literal for the '<em><b>Length</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ICOLUMN__LENGTH = eINSTANCE.getIColumn_Length();
-
- /**
- * The meta object literal for the '<em><b>Specified Length</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ICOLUMN__SPECIFIED_LENGTH = eINSTANCE.getIColumn_SpecifiedLength();
-
- /**
- * The meta object literal for the '<em><b>Precision</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ICOLUMN__PRECISION = eINSTANCE.getIColumn_Precision();
-
- /**
- * The meta object literal for the '<em><b>Specified Precision</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ICOLUMN__SPECIFIED_PRECISION = eINSTANCE.getIColumn_SpecifiedPrecision();
-
- /**
- * The meta object literal for the '<em><b>Scale</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ICOLUMN__SCALE = eINSTANCE.getIColumn_Scale();
-
- /**
- * The meta object literal for the '<em><b>Specified Scale</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ICOLUMN__SPECIFIED_SCALE = eINSTANCE.getIColumn_SpecifiedScale();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IColumnMapping <em>IColumn Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IColumnMapping
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIColumnMapping()
- * @generated
- */
- public static final EClass ICOLUMN_MAPPING = eINSTANCE.getIColumnMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IBasic <em>IBasic</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IBasic
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIBasic()
- * @generated
- */
- public static final EClass IBASIC = eINSTANCE.getIBasic();
-
- /**
- * The meta object literal for the '<em><b>Fetch</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IBASIC__FETCH = eINSTANCE.getIBasic_Fetch();
-
- /**
- * The meta object literal for the '<em><b>Optional</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IBASIC__OPTIONAL = eINSTANCE.getIBasic_Optional();
-
- /**
- * The meta object literal for the '<em><b>Column</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IBASIC__COLUMN = eINSTANCE.getIBasic_Column();
-
- /**
- * The meta object literal for the '<em><b>Lob</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IBASIC__LOB = eINSTANCE.getIBasic_Lob();
-
- /**
- * The meta object literal for the '<em><b>Temporal</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IBASIC__TEMPORAL = eINSTANCE.getIBasic_Temporal();
-
- /**
- * The meta object literal for the '<em><b>Enumerated</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IBASIC__ENUMERATED = eINSTANCE.getIBasic_Enumerated();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IId <em>IId</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IId
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIId()
- * @generated
- */
- public static final EClass IID = eINSTANCE.getIId();
-
- /**
- * The meta object literal for the '<em><b>Column</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IID__COLUMN = eINSTANCE.getIId_Column();
-
- /**
- * The meta object literal for the '<em><b>Generated Value</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IID__GENERATED_VALUE = eINSTANCE.getIId_GeneratedValue();
-
- /**
- * The meta object literal for the '<em><b>Temporal</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IID__TEMPORAL = eINSTANCE.getIId_Temporal();
-
- /**
- * The meta object literal for the '<em><b>Table Generator</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IID__TABLE_GENERATOR = eINSTANCE.getIId_TableGenerator();
-
- /**
- * The meta object literal for the '<em><b>Sequence Generator</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IID__SEQUENCE_GENERATOR = eINSTANCE.getIId_SequenceGenerator();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.ITransient <em>ITransient</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.ITransient
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITransient()
- * @generated
- */
- public static final EClass ITRANSIENT = eINSTANCE.getITransient();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IVersion <em>IVersion</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IVersion
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIVersion()
- * @generated
- */
- public static final EClass IVERSION = eINSTANCE.getIVersion();
-
- /**
- * The meta object literal for the '<em><b>Column</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IVERSION__COLUMN = eINSTANCE.getIVersion_Column();
-
- /**
- * The meta object literal for the '<em><b>Temporal</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IVERSION__TEMPORAL = eINSTANCE.getIVersion_Temporal();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IEmbeddedId <em>IEmbedded Id</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IEmbeddedId
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEmbeddedId()
- * @generated
- */
- public static final EClass IEMBEDDED_ID = eINSTANCE.getIEmbeddedId();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IEmbedded <em>IEmbedded</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IEmbedded
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIEmbedded()
- * @generated
- */
- public static final EClass IEMBEDDED = eINSTANCE.getIEmbedded();
-
- /**
- * The meta object literal for the '<em><b>Attribute Overrides</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IEMBEDDED__ATTRIBUTE_OVERRIDES = eINSTANCE.getIEmbedded_AttributeOverrides();
-
- /**
- * The meta object literal for the '<em><b>Specified Attribute Overrides</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IEMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES = eINSTANCE.getIEmbedded_SpecifiedAttributeOverrides();
-
- /**
- * The meta object literal for the '<em><b>Default Attribute Overrides</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IEMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES = eINSTANCE.getIEmbedded_DefaultAttributeOverrides();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping <em>IRelationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IRelationshipMapping
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIRelationshipMapping()
- * @generated
- */
- public static final EClass IRELATIONSHIP_MAPPING = eINSTANCE.getIRelationshipMapping();
-
- /**
- * The meta object literal for the '<em><b>Target Entity</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IRELATIONSHIP_MAPPING__TARGET_ENTITY = eINSTANCE.getIRelationshipMapping_TargetEntity();
-
- /**
- * The meta object literal for the '<em><b>Specified Target Entity</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IRELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY = eINSTANCE.getIRelationshipMapping_SpecifiedTargetEntity();
-
- /**
- * The meta object literal for the '<em><b>Default Target Entity</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IRELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY = eINSTANCE.getIRelationshipMapping_DefaultTargetEntity();
-
- /**
- * The meta object literal for the '<em><b>Resolved Target Entity</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IRELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY = eINSTANCE.getIRelationshipMapping_ResolvedTargetEntity();
-
- /**
- * The meta object literal for the '<em><b>Cascade</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IRELATIONSHIP_MAPPING__CASCADE = eINSTANCE.getIRelationshipMapping_Cascade();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.INonOwningMapping <em>INon Owning Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.INonOwningMapping
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINonOwningMapping()
- * @generated
- */
- public static final EClass INON_OWNING_MAPPING = eINSTANCE.getINonOwningMapping();
-
- /**
- * The meta object literal for the '<em><b>Mapped By</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute INON_OWNING_MAPPING__MAPPED_BY = eINSTANCE.getINonOwningMapping_MappedBy();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping <em>IMulti Relationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIMultiRelationshipMapping()
- * @generated
- */
- public static final EClass IMULTI_RELATIONSHIP_MAPPING = eINSTANCE.getIMultiRelationshipMapping();
-
- /**
- * The meta object literal for the '<em><b>Order By</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IMULTI_RELATIONSHIP_MAPPING__ORDER_BY = eINSTANCE.getIMultiRelationshipMapping_OrderBy();
-
- /**
- * The meta object literal for the '<em><b>Fetch</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IMULTI_RELATIONSHIP_MAPPING__FETCH = eINSTANCE.getIMultiRelationshipMapping_Fetch();
-
- /**
- * The meta object literal for the '<em><b>Join Table</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IMULTI_RELATIONSHIP_MAPPING__JOIN_TABLE = eINSTANCE.getIMultiRelationshipMapping_JoinTable();
-
- /**
- * The meta object literal for the '<em><b>Map Key</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IMULTI_RELATIONSHIP_MAPPING__MAP_KEY = eINSTANCE.getIMultiRelationshipMapping_MapKey();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IOneToMany <em>IOne To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IOneToMany
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIOneToMany()
- * @generated
- */
- public static final EClass IONE_TO_MANY = eINSTANCE.getIOneToMany();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IManyToMany <em>IMany To Many</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IManyToMany
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIManyToMany()
- * @generated
- */
- public static final EClass IMANY_TO_MANY = eINSTANCE.getIManyToMany();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping <em>ISingle Relationship Mapping</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISingleRelationshipMapping()
- * @generated
- */
- public static final EClass ISINGLE_RELATIONSHIP_MAPPING = eINSTANCE.getISingleRelationshipMapping();
-
- /**
- * The meta object literal for the '<em><b>Fetch</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ISINGLE_RELATIONSHIP_MAPPING__FETCH = eINSTANCE.getISingleRelationshipMapping_Fetch();
-
- /**
- * The meta object literal for the '<em><b>Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ISINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS = eINSTANCE.getISingleRelationshipMapping_JoinColumns();
-
- /**
- * The meta object literal for the '<em><b>Specified Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ISINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS = eINSTANCE.getISingleRelationshipMapping_SpecifiedJoinColumns();
-
- /**
- * The meta object literal for the '<em><b>Default Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ISINGLE_RELATIONSHIP_MAPPING__DEFAULT_JOIN_COLUMNS = eINSTANCE.getISingleRelationshipMapping_DefaultJoinColumns();
-
- /**
- * The meta object literal for the '<em><b>Optional</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ISINGLE_RELATIONSHIP_MAPPING__OPTIONAL = eINSTANCE.getISingleRelationshipMapping_Optional();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IManyToOne <em>IMany To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IManyToOne
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIManyToOne()
- * @generated
- */
- public static final EClass IMANY_TO_ONE = eINSTANCE.getIManyToOne();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IOneToOne <em>IOne To One</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IOneToOne
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIOneToOne()
- * @generated
- */
- public static final EClass IONE_TO_ONE = eINSTANCE.getIOneToOne();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IJoinTable <em>IJoin Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IJoinTable
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIJoinTable()
- * @generated
- */
- public static final EClass IJOIN_TABLE = eINSTANCE.getIJoinTable();
-
- /**
- * The meta object literal for the '<em><b>Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IJOIN_TABLE__JOIN_COLUMNS = eINSTANCE.getIJoinTable_JoinColumns();
-
- /**
- * The meta object literal for the '<em><b>Specified Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IJOIN_TABLE__SPECIFIED_JOIN_COLUMNS = eINSTANCE.getIJoinTable_SpecifiedJoinColumns();
-
- /**
- * The meta object literal for the '<em><b>Default Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IJOIN_TABLE__DEFAULT_JOIN_COLUMNS = eINSTANCE.getIJoinTable_DefaultJoinColumns();
-
- /**
- * The meta object literal for the '<em><b>Inverse Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IJOIN_TABLE__INVERSE_JOIN_COLUMNS = eINSTANCE.getIJoinTable_InverseJoinColumns();
-
- /**
- * The meta object literal for the '<em><b>Specified Inverse Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IJOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS = eINSTANCE.getIJoinTable_SpecifiedInverseJoinColumns();
-
- /**
- * The meta object literal for the '<em><b>Default Inverse Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IJOIN_TABLE__DEFAULT_INVERSE_JOIN_COLUMNS = eINSTANCE.getIJoinTable_DefaultInverseJoinColumns();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn <em>IAbstract Join Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAbstractJoinColumn()
- * @generated
- */
- public static final EClass IABSTRACT_JOIN_COLUMN = eINSTANCE.getIAbstractJoinColumn();
-
- /**
- * The meta object literal for the '<em><b>Referenced Column Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IABSTRACT_JOIN_COLUMN__REFERENCED_COLUMN_NAME = eINSTANCE.getIAbstractJoinColumn_ReferencedColumnName();
-
- /**
- * The meta object literal for the '<em><b>Specified Referenced Column Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME = eINSTANCE.getIAbstractJoinColumn_SpecifiedReferencedColumnName();
-
- /**
- * The meta object literal for the '<em><b>Default Referenced Column Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME = eINSTANCE.getIAbstractJoinColumn_DefaultReferencedColumnName();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IJoinColumn <em>IJoin Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IJoinColumn
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIJoinColumn()
- * @generated
- */
- public static final EClass IJOIN_COLUMN = eINSTANCE.getIJoinColumn();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IOverride <em>IOverride</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IOverride
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIOverride()
- * @generated
- */
- public static final EClass IOVERRIDE = eINSTANCE.getIOverride();
-
- /**
- * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IOVERRIDE__NAME = eINSTANCE.getIOverride_Name();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride <em>IAttribute Override</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IAttributeOverride
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAttributeOverride()
- * @generated
- */
- public static final EClass IATTRIBUTE_OVERRIDE = eINSTANCE.getIAttributeOverride();
-
- /**
- * The meta object literal for the '<em><b>Column</b></em>' containment reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IATTRIBUTE_OVERRIDE__COLUMN = eINSTANCE.getIAttributeOverride_Column();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride <em>IAssociation Override</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IAssociationOverride
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIAssociationOverride()
- * @generated
- */
- public static final EClass IASSOCIATION_OVERRIDE = eINSTANCE.getIAssociationOverride();
-
- /**
- * The meta object literal for the '<em><b>Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IASSOCIATION_OVERRIDE__JOIN_COLUMNS = eINSTANCE.getIAssociationOverride_JoinColumns();
-
- /**
- * The meta object literal for the '<em><b>Specified Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS = eINSTANCE.getIAssociationOverride_SpecifiedJoinColumns();
-
- /**
- * The meta object literal for the '<em><b>Default Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IASSOCIATION_OVERRIDE__DEFAULT_JOIN_COLUMNS = eINSTANCE.getIAssociationOverride_DefaultJoinColumns();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn <em>IDiscriminator Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIDiscriminatorColumn()
- * @generated
- */
- public static final EClass IDISCRIMINATOR_COLUMN = eINSTANCE.getIDiscriminatorColumn();
-
- /**
- * The meta object literal for the '<em><b>Discriminator Type</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IDISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE = eINSTANCE.getIDiscriminatorColumn_DiscriminatorType();
-
- /**
- * The meta object literal for the '<em><b>Default Length</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IDISCRIMINATOR_COLUMN__DEFAULT_LENGTH = eINSTANCE.getIDiscriminatorColumn_DefaultLength();
-
- /**
- * The meta object literal for the '<em><b>Specified Length</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IDISCRIMINATOR_COLUMN__SPECIFIED_LENGTH = eINSTANCE.getIDiscriminatorColumn_SpecifiedLength();
-
- /**
- * The meta object literal for the '<em><b>Length</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IDISCRIMINATOR_COLUMN__LENGTH = eINSTANCE.getIDiscriminatorColumn_Length();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable <em>ISecondary Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.ISecondaryTable
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISecondaryTable()
- * @generated
- */
- public static final EClass ISECONDARY_TABLE = eINSTANCE.getISecondaryTable();
-
- /**
- * The meta object literal for the '<em><b>Primary Key Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ISECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS = eINSTANCE.getISecondaryTable_PrimaryKeyJoinColumns();
-
- /**
- * The meta object literal for the '<em><b>Specified Primary Key Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ISECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS = eINSTANCE.getISecondaryTable_SpecifiedPrimaryKeyJoinColumns();
-
- /**
- * The meta object literal for the '<em><b>Default Primary Key Join Columns</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ISECONDARY_TABLE__DEFAULT_PRIMARY_KEY_JOIN_COLUMNS = eINSTANCE.getISecondaryTable_DefaultPrimaryKeyJoinColumns();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn <em>IPrimary Key Join Column</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIPrimaryKeyJoinColumn()
- * @generated
- */
- public static final EClass IPRIMARY_KEY_JOIN_COLUMN = eINSTANCE.getIPrimaryKeyJoinColumn();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IGenerator <em>IGenerator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IGenerator
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIGenerator()
- * @generated
- */
- public static final EClass IGENERATOR = eINSTANCE.getIGenerator();
-
- /**
- * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IGENERATOR__NAME = eINSTANCE.getIGenerator_Name();
-
- /**
- * The meta object literal for the '<em><b>Initial Value</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IGENERATOR__INITIAL_VALUE = eINSTANCE.getIGenerator_InitialValue();
-
- /**
- * The meta object literal for the '<em><b>Specified Initial Value</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IGENERATOR__SPECIFIED_INITIAL_VALUE = eINSTANCE.getIGenerator_SpecifiedInitialValue();
-
- /**
- * The meta object literal for the '<em><b>Default Initial Value</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IGENERATOR__DEFAULT_INITIAL_VALUE = eINSTANCE.getIGenerator_DefaultInitialValue();
-
- /**
- * The meta object literal for the '<em><b>Allocation Size</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IGENERATOR__ALLOCATION_SIZE = eINSTANCE.getIGenerator_AllocationSize();
-
- /**
- * The meta object literal for the '<em><b>Specified Allocation Size</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IGENERATOR__SPECIFIED_ALLOCATION_SIZE = eINSTANCE.getIGenerator_SpecifiedAllocationSize();
-
- /**
- * The meta object literal for the '<em><b>Default Allocation Size</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IGENERATOR__DEFAULT_ALLOCATION_SIZE = eINSTANCE.getIGenerator_DefaultAllocationSize();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator <em>ITable Generator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITableGenerator()
- * @generated
- */
- public static final EClass ITABLE_GENERATOR = eINSTANCE.getITableGenerator();
-
- /**
- * The meta object literal for the '<em><b>Table</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__TABLE = eINSTANCE.getITableGenerator_Table();
-
- /**
- * The meta object literal for the '<em><b>Specified Table</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__SPECIFIED_TABLE = eINSTANCE.getITableGenerator_SpecifiedTable();
-
- /**
- * The meta object literal for the '<em><b>Default Table</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__DEFAULT_TABLE = eINSTANCE.getITableGenerator_DefaultTable();
-
- /**
- * The meta object literal for the '<em><b>Catalog</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__CATALOG = eINSTANCE.getITableGenerator_Catalog();
-
- /**
- * The meta object literal for the '<em><b>Specified Catalog</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__SPECIFIED_CATALOG = eINSTANCE.getITableGenerator_SpecifiedCatalog();
-
- /**
- * The meta object literal for the '<em><b>Default Catalog</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__DEFAULT_CATALOG = eINSTANCE.getITableGenerator_DefaultCatalog();
-
- /**
- * The meta object literal for the '<em><b>Schema</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__SCHEMA = eINSTANCE.getITableGenerator_Schema();
-
- /**
- * The meta object literal for the '<em><b>Specified Schema</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__SPECIFIED_SCHEMA = eINSTANCE.getITableGenerator_SpecifiedSchema();
-
- /**
- * The meta object literal for the '<em><b>Default Schema</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__DEFAULT_SCHEMA = eINSTANCE.getITableGenerator_DefaultSchema();
-
- /**
- * The meta object literal for the '<em><b>Pk Column Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__PK_COLUMN_NAME = eINSTANCE.getITableGenerator_PkColumnName();
-
- /**
- * The meta object literal for the '<em><b>Specified Pk Column Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME = eINSTANCE.getITableGenerator_SpecifiedPkColumnName();
-
- /**
- * The meta object literal for the '<em><b>Default Pk Column Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__DEFAULT_PK_COLUMN_NAME = eINSTANCE.getITableGenerator_DefaultPkColumnName();
-
- /**
- * The meta object literal for the '<em><b>Value Column Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__VALUE_COLUMN_NAME = eINSTANCE.getITableGenerator_ValueColumnName();
-
- /**
- * The meta object literal for the '<em><b>Specified Value Column Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME = eINSTANCE.getITableGenerator_SpecifiedValueColumnName();
-
- /**
- * The meta object literal for the '<em><b>Default Value Column Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__DEFAULT_VALUE_COLUMN_NAME = eINSTANCE.getITableGenerator_DefaultValueColumnName();
-
- /**
- * The meta object literal for the '<em><b>Pk Column Value</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__PK_COLUMN_VALUE = eINSTANCE.getITableGenerator_PkColumnValue();
-
- /**
- * The meta object literal for the '<em><b>Specified Pk Column Value</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE = eINSTANCE.getITableGenerator_SpecifiedPkColumnValue();
-
- /**
- * The meta object literal for the '<em><b>Default Pk Column Value</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ITABLE_GENERATOR__DEFAULT_PK_COLUMN_VALUE = eINSTANCE.getITableGenerator_DefaultPkColumnValue();
-
- /**
- * The meta object literal for the '<em><b>Unique Constraints</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference ITABLE_GENERATOR__UNIQUE_CONSTRAINTS = eINSTANCE.getITableGenerator_UniqueConstraints();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.ISequenceGenerator <em>ISequence Generator</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.ISequenceGenerator
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getISequenceGenerator()
- * @generated
- */
- public static final EClass ISEQUENCE_GENERATOR = eINSTANCE.getISequenceGenerator();
-
- /**
- * The meta object literal for the '<em><b>Sequence Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ISEQUENCE_GENERATOR__SEQUENCE_NAME = eINSTANCE.getISequenceGenerator_SequenceName();
-
- /**
- * The meta object literal for the '<em><b>Specified Sequence Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ISEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME = eINSTANCE.getISequenceGenerator_SpecifiedSequenceName();
-
- /**
- * The meta object literal for the '<em><b>Default Sequence Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ISEQUENCE_GENERATOR__DEFAULT_SEQUENCE_NAME = eINSTANCE.getISequenceGenerator_DefaultSequenceName();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IGeneratedValue <em>IGenerated Value</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IGeneratedValue
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIGeneratedValue()
- * @generated
- */
- public static final EClass IGENERATED_VALUE = eINSTANCE.getIGeneratedValue();
-
- /**
- * The meta object literal for the '<em><b>Strategy</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IGENERATED_VALUE__STRATEGY = eINSTANCE.getIGeneratedValue_Strategy();
-
- /**
- * The meta object literal for the '<em><b>Generator</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IGENERATED_VALUE__GENERATOR = eINSTANCE.getIGeneratedValue_Generator();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IQuery <em>IQuery</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IQuery
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIQuery()
- * @generated
- */
- public static final EClass IQUERY = eINSTANCE.getIQuery();
-
- /**
- * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IQUERY__NAME = eINSTANCE.getIQuery_Name();
-
- /**
- * The meta object literal for the '<em><b>Query</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IQUERY__QUERY = eINSTANCE.getIQuery_Query();
-
- /**
- * The meta object literal for the '<em><b>Hints</b></em>' containment reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EReference IQUERY__HINTS = eINSTANCE.getIQuery_Hints();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.INamedQuery <em>INamed Query</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.INamedQuery
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINamedQuery()
- * @generated
- */
- public static final EClass INAMED_QUERY = eINSTANCE.getINamedQuery();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.INamedNativeQuery <em>INamed Native Query</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.INamedNativeQuery
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getINamedNativeQuery()
- * @generated
- */
- public static final EClass INAMED_NATIVE_QUERY = eINSTANCE.getINamedNativeQuery();
-
- /**
- * The meta object literal for the '<em><b>Result Class</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute INAMED_NATIVE_QUERY__RESULT_CLASS = eINSTANCE.getINamedNativeQuery_ResultClass();
-
- /**
- * The meta object literal for the '<em><b>Result Set Mapping</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute INAMED_NATIVE_QUERY__RESULT_SET_MAPPING = eINSTANCE.getINamedNativeQuery_ResultSetMapping();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.IQueryHint <em>IQuery Hint</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.IQueryHint
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIQueryHint()
- * @generated
- */
- public static final EClass IQUERY_HINT = eINSTANCE.getIQueryHint();
-
- /**
- * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IQUERY_HINT__NAME = eINSTANCE.getIQueryHint_Name();
-
- /**
- * The meta object literal for the '<em><b>Value</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute IQUERY_HINT__VALUE = eINSTANCE.getIQueryHint_Value();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.ICascade <em>ICascade</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.ICascade
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getICascade()
- * @generated
- */
- public static final EClass ICASCADE = eINSTANCE.getICascade();
-
- /**
- * The meta object literal for the '<em><b>All</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ICASCADE__ALL = eINSTANCE.getICascade_All();
-
- /**
- * The meta object literal for the '<em><b>Persist</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ICASCADE__PERSIST = eINSTANCE.getICascade_Persist();
-
- /**
- * The meta object literal for the '<em><b>Merge</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ICASCADE__MERGE = eINSTANCE.getICascade_Merge();
-
- /**
- * The meta object literal for the '<em><b>Remove</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ICASCADE__REMOVE = eINSTANCE.getICascade_Remove();
-
- /**
- * The meta object literal for the '<em><b>Refresh</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final EAttribute ICASCADE__REFRESH = eINSTANCE.getICascade_Refresh();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType <em>Default Eager Fetch Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getDefaultEagerFetchType()
- * @generated
- */
- public static final EEnum DEFAULT_EAGER_FETCH_TYPE = eINSTANCE.getDefaultEagerFetchType();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType <em>Default Lazy Fetch Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getDefaultLazyFetchType()
- * @generated
- */
- public static final EEnum DEFAULT_LAZY_FETCH_TYPE = eINSTANCE.getDefaultLazyFetchType();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean <em>Default False Boolean</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getDefaultFalseBoolean()
- * @generated
- */
- public static final EEnum DEFAULT_FALSE_BOOLEAN = eINSTANCE.getDefaultFalseBoolean();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean <em>Default True Boolean</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getDefaultTrueBoolean()
- * @generated
- */
- public static final EEnum DEFAULT_TRUE_BOOLEAN = eINSTANCE.getDefaultTrueBoolean();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.TemporalType <em>Temporal Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getTemporalType()
- * @generated
- */
- public static final EEnum TEMPORAL_TYPE = eINSTANCE.getTemporalType();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.InheritanceType <em>Inheritance Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.InheritanceType
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getInheritanceType()
- * @generated
- */
- public static final EEnum INHERITANCE_TYPE = eINSTANCE.getInheritanceType();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.DiscriminatorType <em>Discriminator Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.DiscriminatorType
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getDiscriminatorType()
- * @generated
- */
- public static final EEnum DISCRIMINATOR_TYPE = eINSTANCE.getDiscriminatorType();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.GenerationType <em>Generation Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.GenerationType
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getGenerationType()
- * @generated
- */
- public static final EEnum GENERATION_TYPE = eINSTANCE.getGenerationType();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.EnumType <em>Enum Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.EnumType
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getEnumType()
- * @generated
- */
- public static final EEnum ENUM_TYPE = eINSTANCE.getEnumType();
-
- /**
- * The meta object literal for the '{@link org.eclipse.jpt.core.internal.mappings.CascadeType <em>Cascade Type</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.CascadeType
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getCascadeType()
- * @generated
- */
- public static final EEnum CASCADE_TYPE = eINSTANCE.getCascadeType();
- }
-} //JpaCoreMappingsPackage
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/OrderingType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/OrderingType.java
deleted file mode 100644
index 0eb6c45af5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/OrderingType.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.mappings;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.emf.common.util.Enumerator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the literals of the enumeration '<em><b>Ordering Type</b></em>',
- * and utility methods for working with them.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getOrderingType()
- * @model
- * @generated
- */
-public enum OrderingType implements Enumerator {
- /**
- * The '<em><b>NONE</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #NONE_VALUE
- * @generated
- * @ordered
- */
- NONE(0, "NONE", "None"),
- /**
- * The '<em><b>PRIMARY KEY</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #PRIMARY_KEY_VALUE
- * @generated
- * @ordered
- */
- PRIMARY_KEY(1, "PRIMARY_KEY", "Primary Key"),
- /**
- * The '<em><b>CUSTOM</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #CUSTOM_VALUE
- * @generated
- * @ordered
- */
- CUSTOM(2, "CUSTOM", "Custom");
- /**
- * The '<em><b>NONE</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>NONE</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #NONE
- * @model literal="None"
- * @generated
- * @ordered
- */
- public static final int NONE_VALUE = 0;
-
- /**
- * The '<em><b>PRIMARY KEY</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>PRIMARY KEY</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #PRIMARY_KEY
- * @model literal="Primary Key"
- * @generated
- * @ordered
- */
- public static final int PRIMARY_KEY_VALUE = 1;
-
- /**
- * The '<em><b>CUSTOM</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>CUSTOM</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #CUSTOM
- * @model literal="Custom"
- * @generated
- * @ordered
- */
- public static final int CUSTOM_VALUE = 2;
-
- /**
- * An array of all the '<em><b>Ordering Type</b></em>' enumerators.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static final OrderingType[] VALUES_ARRAY = new OrderingType[] {
- NONE, PRIMARY_KEY, CUSTOM,
- };
-
- /**
- * A public read-only list of all the '<em><b>Ordering Type</b></em>' enumerators.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final List<OrderingType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
-
- /**
- * Returns the '<em><b>Ordering Type</b></em>' literal with the specified literal value.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static OrderingType get(String literal) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
- OrderingType result = VALUES_ARRAY[i];
- if (result.toString().equals(literal)) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the '<em><b>Ordering Type</b></em>' literal with the specified name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static OrderingType getByName(String name) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
- OrderingType result = VALUES_ARRAY[i];
- if (result.getName().equals(name)) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the '<em><b>Ordering Type</b></em>' literal with the specified integer value.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static OrderingType get(int value) {
- switch (value) {
- case NONE_VALUE :
- return NONE;
- case PRIMARY_KEY_VALUE :
- return PRIMARY_KEY;
- case CUSTOM_VALUE :
- return CUSTOM;
- }
- return null;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final int value;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final String name;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final String literal;
-
- /**
- * Only this class can construct instances.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private OrderingType(int value, String name, String literal) {
- this.value = value;
- this.name = name;
- this.literal = literal;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public int getValue() {
- return value;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getLiteral() {
- return literal;
- }
-
- /**
- * Returns the literal value of the enumerator, which is its string representation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- return literal;
- }
-} //OrderingType
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/util/JpaCoreMappingsAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/util/JpaCoreMappingsAdapterFactory.java
deleted file mode 100644
index 5f9c7d97de..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/util/JpaCoreMappingsAdapterFactory.java
+++ /dev/null
@@ -1,1004 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings.util;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IJpaEObject;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.mappings.IAbstractColumn;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.ICascade;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddable;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddedId;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
-import org.eclipse.jpt.core.internal.mappings.IGenerator;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.IManyToMany;
-import org.eclipse.jpt.core.internal.mappings.IManyToOne;
-import org.eclipse.jpt.core.internal.mappings.IMappedSuperclass;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedNativeQuery;
-import org.eclipse.jpt.core.internal.mappings.INamedQuery;
-import org.eclipse.jpt.core.internal.mappings.INonOwningMapping;
-import org.eclipse.jpt.core.internal.mappings.IOneToMany;
-import org.eclipse.jpt.core.internal.mappings.IOneToOne;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IQuery;
-import org.eclipse.jpt.core.internal.mappings.IQueryHint;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.mappings.ITransient;
-import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint;
-import org.eclipse.jpt.core.internal.mappings.IVersion;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Adapter Factory</b> for the model.
- * It provides an adapter <code>createXXX</code> method for each class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage
- * @generated
- */
-public class JpaCoreMappingsAdapterFactory extends AdapterFactoryImpl
-{
- /**
- * The cached model package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static JpaCoreMappingsPackage modelPackage;
-
- /**
- * Creates an instance of the adapter factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaCoreMappingsAdapterFactory() {
- if (modelPackage == null) {
- modelPackage = JpaCoreMappingsPackage.eINSTANCE;
- }
- }
-
- /**
- * Returns whether this factory is applicable for the type of the object.
- * <!-- begin-user-doc -->
- * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
- * <!-- end-user-doc -->
- * @return whether this factory is applicable for the type of the object.
- * @generated
- */
- @Override
- public boolean isFactoryForType(Object object) {
- if (object == modelPackage) {
- return true;
- }
- if (object instanceof EObject) {
- return ((EObject) object).eClass().getEPackage() == modelPackage;
- }
- return false;
- }
-
- /**
- * The switch the delegates to the <code>createXXX</code> methods.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected JpaCoreMappingsSwitch<Adapter> modelSwitch = new JpaCoreMappingsSwitch<Adapter>() {
- @Override
- public Adapter caseIMappedSuperclass(IMappedSuperclass object) {
- return createIMappedSuperclassAdapter();
- }
-
- @Override
- public Adapter caseIEntity(IEntity object) {
- return createIEntityAdapter();
- }
-
- @Override
- public Adapter caseIEmbeddable(IEmbeddable object) {
- return createIEmbeddableAdapter();
- }
-
- @Override
- public Adapter caseITable(ITable object) {
- return createITableAdapter();
- }
-
- @Override
- public Adapter caseIUniqueConstraint(IUniqueConstraint object) {
- return createIUniqueConstraintAdapter();
- }
-
- @Override
- public Adapter caseINamedColumn(INamedColumn object) {
- return createINamedColumnAdapter();
- }
-
- @Override
- public Adapter caseIAbstractColumn(IAbstractColumn object) {
- return createIAbstractColumnAdapter();
- }
-
- @Override
- public Adapter caseIColumn(IColumn object) {
- return createIColumnAdapter();
- }
-
- @Override
- public Adapter caseIColumnMapping(IColumnMapping object) {
- return createIColumnMappingAdapter();
- }
-
- @Override
- public Adapter caseIBasic(IBasic object) {
- return createIBasicAdapter();
- }
-
- @Override
- public Adapter caseIId(IId object) {
- return createIIdAdapter();
- }
-
- @Override
- public Adapter caseITransient(ITransient object) {
- return createITransientAdapter();
- }
-
- @Override
- public Adapter caseIVersion(IVersion object) {
- return createIVersionAdapter();
- }
-
- @Override
- public Adapter caseIEmbeddedId(IEmbeddedId object) {
- return createIEmbeddedIdAdapter();
- }
-
- @Override
- public Adapter caseIEmbedded(IEmbedded object) {
- return createIEmbeddedAdapter();
- }
-
- @Override
- public Adapter caseIRelationshipMapping(IRelationshipMapping object) {
- return createIRelationshipMappingAdapter();
- }
-
- @Override
- public Adapter caseINonOwningMapping(INonOwningMapping object) {
- return createINonOwningMappingAdapter();
- }
-
- @Override
- public Adapter caseIMultiRelationshipMapping(IMultiRelationshipMapping object) {
- return createIMultiRelationshipMappingAdapter();
- }
-
- @Override
- public Adapter caseIOneToMany(IOneToMany object) {
- return createIOneToManyAdapter();
- }
-
- @Override
- public Adapter caseIManyToMany(IManyToMany object) {
- return createIManyToManyAdapter();
- }
-
- @Override
- public Adapter caseISingleRelationshipMapping(ISingleRelationshipMapping object) {
- return createISingleRelationshipMappingAdapter();
- }
-
- @Override
- public Adapter caseIManyToOne(IManyToOne object) {
- return createIManyToOneAdapter();
- }
-
- @Override
- public Adapter caseIOneToOne(IOneToOne object) {
- return createIOneToOneAdapter();
- }
-
- @Override
- public Adapter caseIJoinTable(IJoinTable object) {
- return createIJoinTableAdapter();
- }
-
- @Override
- public Adapter caseIAbstractJoinColumn(IAbstractJoinColumn object) {
- return createIAbstractJoinColumnAdapter();
- }
-
- @Override
- public Adapter caseIJoinColumn(IJoinColumn object) {
- return createIJoinColumnAdapter();
- }
-
- @Override
- public Adapter caseIOverride(IOverride object) {
- return createIOverrideAdapter();
- }
-
- @Override
- public Adapter caseIAttributeOverride(IAttributeOverride object) {
- return createIAttributeOverrideAdapter();
- }
-
- @Override
- public Adapter caseIAssociationOverride(IAssociationOverride object) {
- return createIAssociationOverrideAdapter();
- }
-
- @Override
- public Adapter caseIDiscriminatorColumn(IDiscriminatorColumn object) {
- return createIDiscriminatorColumnAdapter();
- }
-
- @Override
- public Adapter caseISecondaryTable(ISecondaryTable object) {
- return createISecondaryTableAdapter();
- }
-
- @Override
- public Adapter caseIPrimaryKeyJoinColumn(IPrimaryKeyJoinColumn object) {
- return createIPrimaryKeyJoinColumnAdapter();
- }
-
- @Override
- public Adapter caseIGenerator(IGenerator object) {
- return createIGeneratorAdapter();
- }
-
- @Override
- public Adapter caseITableGenerator(ITableGenerator object) {
- return createITableGeneratorAdapter();
- }
-
- @Override
- public Adapter caseISequenceGenerator(ISequenceGenerator object) {
- return createISequenceGeneratorAdapter();
- }
-
- @Override
- public Adapter caseIGeneratedValue(IGeneratedValue object) {
- return createIGeneratedValueAdapter();
- }
-
- @Override
- public Adapter caseIQuery(IQuery object) {
- return createIQueryAdapter();
- }
-
- @Override
- public Adapter caseINamedQuery(INamedQuery object) {
- return createINamedQueryAdapter();
- }
-
- @Override
- public Adapter caseINamedNativeQuery(INamedNativeQuery object) {
- return createINamedNativeQueryAdapter();
- }
-
- @Override
- public Adapter caseIQueryHint(IQueryHint object) {
- return createIQueryHintAdapter();
- }
-
- @Override
- public Adapter caseICascade(ICascade object) {
- return createICascadeAdapter();
- }
-
- @Override
- public Adapter caseIJpaEObject(IJpaEObject object) {
- return createIJpaEObjectAdapter();
- }
-
- @Override
- public Adapter caseIJpaSourceObject(IJpaSourceObject object) {
- return createIJpaSourceObjectAdapter();
- }
-
- @Override
- public Adapter caseITypeMapping(ITypeMapping object) {
- return createITypeMappingAdapter();
- }
-
- @Override
- public Adapter caseIAttributeMapping(IAttributeMapping object) {
- return createIAttributeMappingAdapter();
- }
-
- @Override
- public Adapter defaultCase(EObject object) {
- return createEObjectAdapter();
- }
- };
-
- /**
- * Creates an adapter for the <code>target</code>.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param target the object to adapt.
- * @return the adapter for the <code>target</code>.
- * @generated
- */
- @Override
- public Adapter createAdapter(Notifier target) {
- return modelSwitch.doSwitch((EObject) target);
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IMappedSuperclass <em>IMapped Superclass</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IMappedSuperclass
- * @generated
- */
- public Adapter createIMappedSuperclassAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IEntity <em>IEntity</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IEntity
- * @generated
- */
- public Adapter createIEntityAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ITable <em>ITable</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ITable
- * @generated
- */
- public Adapter createITableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IUniqueConstraint <em>IUnique Constraint</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IUniqueConstraint
- * @generated
- */
- public Adapter createIUniqueConstraintAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.INamedColumn <em>INamed Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.INamedColumn
- * @generated
- */
- public Adapter createINamedColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IAbstractColumn <em>IAbstract Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractColumn
- * @generated
- */
- public Adapter createIAbstractColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IColumn <em>IColumn</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IColumn
- * @generated
- */
- public Adapter createIColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IColumnMapping <em>IColumn Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IColumnMapping
- * @generated
- */
- public Adapter createIColumnMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IEmbeddable <em>IEmbeddable</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IEmbeddable
- * @generated
- */
- public Adapter createIEmbeddableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IBasic <em>IBasic</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IBasic
- * @generated
- */
- public Adapter createIBasicAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IId <em>IId</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IId
- * @generated
- */
- public Adapter createIIdAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ITransient <em>ITransient</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ITransient
- * @generated
- */
- public Adapter createITransientAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IVersion <em>IVersion</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IVersion
- * @generated
- */
- public Adapter createIVersionAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IEmbeddedId <em>IEmbedded Id</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IEmbeddedId
- * @generated
- */
- public Adapter createIEmbeddedIdAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IEmbedded <em>IEmbedded</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IEmbedded
- * @generated
- */
- public Adapter createIEmbeddedAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IRelationshipMapping <em>IRelationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IRelationshipMapping
- * @generated
- */
- public Adapter createIRelationshipMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.INonOwningMapping <em>INon Owning Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.INonOwningMapping
- * @generated
- */
- public Adapter createINonOwningMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping <em>IMulti Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping
- * @generated
- */
- public Adapter createIMultiRelationshipMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IOneToMany <em>IOne To Many</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IOneToMany
- * @generated
- */
- public Adapter createIOneToManyAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IManyToMany <em>IMany To Many</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IManyToMany
- * @generated
- */
- public Adapter createIManyToManyAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping <em>ISingle Relationship Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping
- * @generated
- */
- public Adapter createISingleRelationshipMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IManyToOne <em>IMany To One</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IManyToOne
- * @generated
- */
- public Adapter createIManyToOneAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IOneToOne <em>IOne To One</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IOneToOne
- * @generated
- */
- public Adapter createIOneToOneAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IJoinTable <em>IJoin Table</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IJoinTable
- * @generated
- */
- public Adapter createIJoinTableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn <em>IAbstract Join Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn
- * @generated
- */
- public Adapter createIAbstractJoinColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IJoinColumn <em>IJoin Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IJoinColumn
- * @generated
- */
- public Adapter createIJoinColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IOverride <em>IOverride</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IOverride
- * @generated
- */
- public Adapter createIOverrideAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IAttributeOverride <em>IAttribute Override</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IAttributeOverride
- * @generated
- */
- public Adapter createIAttributeOverrideAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IAssociationOverride <em>IAssociation Override</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IAssociationOverride
- * @generated
- */
- public Adapter createIAssociationOverrideAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn <em>IDiscriminator Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn
- * @generated
- */
- public Adapter createIDiscriminatorColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ISecondaryTable <em>ISecondary Table</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ISecondaryTable
- * @generated
- */
- public Adapter createISecondaryTableAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn <em>IPrimary Key Join Column</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn
- * @generated
- */
- public Adapter createIPrimaryKeyJoinColumnAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IGenerator <em>IGenerator</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IGenerator
- * @generated
- */
- public Adapter createIGeneratorAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ITableGenerator <em>ITable Generator</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ITableGenerator
- * @generated
- */
- public Adapter createITableGeneratorAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ISequenceGenerator <em>ISequence Generator</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ISequenceGenerator
- * @generated
- */
- public Adapter createISequenceGeneratorAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IGeneratedValue <em>IGenerated Value</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IGeneratedValue
- * @generated
- */
- public Adapter createIGeneratedValueAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IQuery <em>IQuery</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IQuery
- * @generated
- */
- public Adapter createIQueryAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.INamedQuery <em>INamed Query</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.INamedQuery
- * @generated
- */
- public Adapter createINamedQueryAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.INamedNativeQuery <em>INamed Native Query</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.INamedNativeQuery
- * @generated
- */
- public Adapter createINamedNativeQueryAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.IQueryHint <em>IQuery Hint</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.IQueryHint
- * @generated
- */
- public Adapter createIQueryHintAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.mappings.ICascade <em>ICascade</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.mappings.ICascade
- * @generated
- */
- public Adapter createICascadeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaEObject <em>IJpa EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaEObject
- * @generated
- */
- public Adapter createIJpaEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaSourceObject <em>IJpa Source Object</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaSourceObject
- * @generated
- */
- public Adapter createIJpaSourceObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.ITypeMapping <em>IType Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.ITypeMapping
- * @generated
- */
- public Adapter createITypeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IAttributeMapping <em>IAttribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IAttributeMapping
- * @generated
- */
- public Adapter createIAttributeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for the default case.
- * <!-- begin-user-doc -->
- * This default implementation returns null.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @generated
- */
- public Adapter createEObjectAdapter() {
- return null;
- }
-} //JpaCoreMappingsAdapterFactory
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/util/JpaCoreMappingsSwitch.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/util/JpaCoreMappingsSwitch.java
deleted file mode 100644
index 790a6fbfaa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/util/JpaCoreMappingsSwitch.java
+++ /dev/null
@@ -1,1383 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.mappings.util;
-
-import java.util.List;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IJpaEObject;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.mappings.IAbstractColumn;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.ICascade;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddable;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddedId;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
-import org.eclipse.jpt.core.internal.mappings.IGenerator;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.IManyToMany;
-import org.eclipse.jpt.core.internal.mappings.IManyToOne;
-import org.eclipse.jpt.core.internal.mappings.IMappedSuperclass;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedNativeQuery;
-import org.eclipse.jpt.core.internal.mappings.INamedQuery;
-import org.eclipse.jpt.core.internal.mappings.INonOwningMapping;
-import org.eclipse.jpt.core.internal.mappings.IOneToMany;
-import org.eclipse.jpt.core.internal.mappings.IOneToOne;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IQuery;
-import org.eclipse.jpt.core.internal.mappings.IQueryHint;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.mappings.ITransient;
-import org.eclipse.jpt.core.internal.mappings.IUniqueConstraint;
-import org.eclipse.jpt.core.internal.mappings.IVersion;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Switch</b> for the model's inheritance hierarchy.
- * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
- * to invoke the <code>caseXXX</code> method for each class of the model,
- * starting with the actual class of the object
- * and proceeding up the inheritance hierarchy
- * until a non-null result is returned,
- * which is the result of the switch.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage
- * @generated
- */
-public class JpaCoreMappingsSwitch<T>
-{
- /**
- * The cached model package
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static JpaCoreMappingsPackage modelPackage;
-
- /**
- * Creates an instance of the switch.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaCoreMappingsSwitch() {
- if (modelPackage == null) {
- modelPackage = JpaCoreMappingsPackage.eINSTANCE;
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- public T doSwitch(EObject theEObject) {
- return doSwitch(theEObject.eClass(), theEObject);
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(EClass theEClass, EObject theEObject) {
- if (theEClass.eContainer() == modelPackage) {
- return doSwitch(theEClass.getClassifierID(), theEObject);
- }
- else {
- List<EClass> eSuperTypes = theEClass.getESuperTypes();
- return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), theEObject);
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(int classifierID, EObject theEObject) {
- switch (classifierID) {
- case JpaCoreMappingsPackage.IMAPPED_SUPERCLASS : {
- IMappedSuperclass iMappedSuperclass = (IMappedSuperclass) theEObject;
- T result = caseIMappedSuperclass(iMappedSuperclass);
- if (result == null)
- result = caseITypeMapping(iMappedSuperclass);
- if (result == null)
- result = caseIJpaSourceObject(iMappedSuperclass);
- if (result == null)
- result = caseIJpaEObject(iMappedSuperclass);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IENTITY : {
- IEntity iEntity = (IEntity) theEObject;
- T result = caseIEntity(iEntity);
- if (result == null)
- result = caseITypeMapping(iEntity);
- if (result == null)
- result = caseIJpaSourceObject(iEntity);
- if (result == null)
- result = caseIJpaEObject(iEntity);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IEMBEDDABLE : {
- IEmbeddable iEmbeddable = (IEmbeddable) theEObject;
- T result = caseIEmbeddable(iEmbeddable);
- if (result == null)
- result = caseITypeMapping(iEmbeddable);
- if (result == null)
- result = caseIJpaSourceObject(iEmbeddable);
- if (result == null)
- result = caseIJpaEObject(iEmbeddable);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.ITABLE : {
- ITable iTable = (ITable) theEObject;
- T result = caseITable(iTable);
- if (result == null)
- result = caseIJpaSourceObject(iTable);
- if (result == null)
- result = caseIJpaEObject(iTable);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IUNIQUE_CONSTRAINT : {
- IUniqueConstraint iUniqueConstraint = (IUniqueConstraint) theEObject;
- T result = caseIUniqueConstraint(iUniqueConstraint);
- if (result == null)
- result = caseIJpaSourceObject(iUniqueConstraint);
- if (result == null)
- result = caseIJpaEObject(iUniqueConstraint);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.INAMED_COLUMN : {
- INamedColumn iNamedColumn = (INamedColumn) theEObject;
- T result = caseINamedColumn(iNamedColumn);
- if (result == null)
- result = caseIJpaSourceObject(iNamedColumn);
- if (result == null)
- result = caseIJpaEObject(iNamedColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IABSTRACT_COLUMN : {
- IAbstractColumn iAbstractColumn = (IAbstractColumn) theEObject;
- T result = caseIAbstractColumn(iAbstractColumn);
- if (result == null)
- result = caseINamedColumn(iAbstractColumn);
- if (result == null)
- result = caseIJpaSourceObject(iAbstractColumn);
- if (result == null)
- result = caseIJpaEObject(iAbstractColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.ICOLUMN : {
- IColumn iColumn = (IColumn) theEObject;
- T result = caseIColumn(iColumn);
- if (result == null)
- result = caseIAbstractColumn(iColumn);
- if (result == null)
- result = caseINamedColumn(iColumn);
- if (result == null)
- result = caseIJpaSourceObject(iColumn);
- if (result == null)
- result = caseIJpaEObject(iColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.ICOLUMN_MAPPING : {
- IColumnMapping iColumnMapping = (IColumnMapping) theEObject;
- T result = caseIColumnMapping(iColumnMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IBASIC : {
- IBasic iBasic = (IBasic) theEObject;
- T result = caseIBasic(iBasic);
- if (result == null)
- result = caseIAttributeMapping(iBasic);
- if (result == null)
- result = caseIColumnMapping(iBasic);
- if (result == null)
- result = caseIJpaSourceObject(iBasic);
- if (result == null)
- result = caseIJpaEObject(iBasic);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IID : {
- IId iId = (IId) theEObject;
- T result = caseIId(iId);
- if (result == null)
- result = caseIAttributeMapping(iId);
- if (result == null)
- result = caseIColumnMapping(iId);
- if (result == null)
- result = caseIJpaSourceObject(iId);
- if (result == null)
- result = caseIJpaEObject(iId);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.ITRANSIENT : {
- ITransient iTransient = (ITransient) theEObject;
- T result = caseITransient(iTransient);
- if (result == null)
- result = caseIAttributeMapping(iTransient);
- if (result == null)
- result = caseIJpaSourceObject(iTransient);
- if (result == null)
- result = caseIJpaEObject(iTransient);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IVERSION : {
- IVersion iVersion = (IVersion) theEObject;
- T result = caseIVersion(iVersion);
- if (result == null)
- result = caseIAttributeMapping(iVersion);
- if (result == null)
- result = caseIColumnMapping(iVersion);
- if (result == null)
- result = caseIJpaSourceObject(iVersion);
- if (result == null)
- result = caseIJpaEObject(iVersion);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IEMBEDDED_ID : {
- IEmbeddedId iEmbeddedId = (IEmbeddedId) theEObject;
- T result = caseIEmbeddedId(iEmbeddedId);
- if (result == null)
- result = caseIAttributeMapping(iEmbeddedId);
- if (result == null)
- result = caseIJpaSourceObject(iEmbeddedId);
- if (result == null)
- result = caseIJpaEObject(iEmbeddedId);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IEMBEDDED : {
- IEmbedded iEmbedded = (IEmbedded) theEObject;
- T result = caseIEmbedded(iEmbedded);
- if (result == null)
- result = caseIAttributeMapping(iEmbedded);
- if (result == null)
- result = caseIJpaSourceObject(iEmbedded);
- if (result == null)
- result = caseIJpaEObject(iEmbedded);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING : {
- IRelationshipMapping iRelationshipMapping = (IRelationshipMapping) theEObject;
- T result = caseIRelationshipMapping(iRelationshipMapping);
- if (result == null)
- result = caseIAttributeMapping(iRelationshipMapping);
- if (result == null)
- result = caseIJpaSourceObject(iRelationshipMapping);
- if (result == null)
- result = caseIJpaEObject(iRelationshipMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.INON_OWNING_MAPPING : {
- INonOwningMapping iNonOwningMapping = (INonOwningMapping) theEObject;
- T result = caseINonOwningMapping(iNonOwningMapping);
- if (result == null)
- result = caseIRelationshipMapping(iNonOwningMapping);
- if (result == null)
- result = caseIAttributeMapping(iNonOwningMapping);
- if (result == null)
- result = caseIJpaSourceObject(iNonOwningMapping);
- if (result == null)
- result = caseIJpaEObject(iNonOwningMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING : {
- IMultiRelationshipMapping iMultiRelationshipMapping = (IMultiRelationshipMapping) theEObject;
- T result = caseIMultiRelationshipMapping(iMultiRelationshipMapping);
- if (result == null)
- result = caseINonOwningMapping(iMultiRelationshipMapping);
- if (result == null)
- result = caseIRelationshipMapping(iMultiRelationshipMapping);
- if (result == null)
- result = caseIAttributeMapping(iMultiRelationshipMapping);
- if (result == null)
- result = caseIJpaSourceObject(iMultiRelationshipMapping);
- if (result == null)
- result = caseIJpaEObject(iMultiRelationshipMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IONE_TO_MANY : {
- IOneToMany iOneToMany = (IOneToMany) theEObject;
- T result = caseIOneToMany(iOneToMany);
- if (result == null)
- result = caseIMultiRelationshipMapping(iOneToMany);
- if (result == null)
- result = caseINonOwningMapping(iOneToMany);
- if (result == null)
- result = caseIRelationshipMapping(iOneToMany);
- if (result == null)
- result = caseIAttributeMapping(iOneToMany);
- if (result == null)
- result = caseIJpaSourceObject(iOneToMany);
- if (result == null)
- result = caseIJpaEObject(iOneToMany);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IMANY_TO_MANY : {
- IManyToMany iManyToMany = (IManyToMany) theEObject;
- T result = caseIManyToMany(iManyToMany);
- if (result == null)
- result = caseIMultiRelationshipMapping(iManyToMany);
- if (result == null)
- result = caseINonOwningMapping(iManyToMany);
- if (result == null)
- result = caseIRelationshipMapping(iManyToMany);
- if (result == null)
- result = caseIAttributeMapping(iManyToMany);
- if (result == null)
- result = caseIJpaSourceObject(iManyToMany);
- if (result == null)
- result = caseIJpaEObject(iManyToMany);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING : {
- ISingleRelationshipMapping iSingleRelationshipMapping = (ISingleRelationshipMapping) theEObject;
- T result = caseISingleRelationshipMapping(iSingleRelationshipMapping);
- if (result == null)
- result = caseIRelationshipMapping(iSingleRelationshipMapping);
- if (result == null)
- result = caseIAttributeMapping(iSingleRelationshipMapping);
- if (result == null)
- result = caseIJpaSourceObject(iSingleRelationshipMapping);
- if (result == null)
- result = caseIJpaEObject(iSingleRelationshipMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IMANY_TO_ONE : {
- IManyToOne iManyToOne = (IManyToOne) theEObject;
- T result = caseIManyToOne(iManyToOne);
- if (result == null)
- result = caseISingleRelationshipMapping(iManyToOne);
- if (result == null)
- result = caseIRelationshipMapping(iManyToOne);
- if (result == null)
- result = caseIAttributeMapping(iManyToOne);
- if (result == null)
- result = caseIJpaSourceObject(iManyToOne);
- if (result == null)
- result = caseIJpaEObject(iManyToOne);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IONE_TO_ONE : {
- IOneToOne iOneToOne = (IOneToOne) theEObject;
- T result = caseIOneToOne(iOneToOne);
- if (result == null)
- result = caseISingleRelationshipMapping(iOneToOne);
- if (result == null)
- result = caseINonOwningMapping(iOneToOne);
- if (result == null)
- result = caseIRelationshipMapping(iOneToOne);
- if (result == null)
- result = caseIAttributeMapping(iOneToOne);
- if (result == null)
- result = caseIJpaSourceObject(iOneToOne);
- if (result == null)
- result = caseIJpaEObject(iOneToOne);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IJOIN_TABLE : {
- IJoinTable iJoinTable = (IJoinTable) theEObject;
- T result = caseIJoinTable(iJoinTable);
- if (result == null)
- result = caseITable(iJoinTable);
- if (result == null)
- result = caseIJpaSourceObject(iJoinTable);
- if (result == null)
- result = caseIJpaEObject(iJoinTable);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN : {
- IAbstractJoinColumn iAbstractJoinColumn = (IAbstractJoinColumn) theEObject;
- T result = caseIAbstractJoinColumn(iAbstractJoinColumn);
- if (result == null)
- result = caseINamedColumn(iAbstractJoinColumn);
- if (result == null)
- result = caseIJpaSourceObject(iAbstractJoinColumn);
- if (result == null)
- result = caseIJpaEObject(iAbstractJoinColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IJOIN_COLUMN : {
- IJoinColumn iJoinColumn = (IJoinColumn) theEObject;
- T result = caseIJoinColumn(iJoinColumn);
- if (result == null)
- result = caseIAbstractColumn(iJoinColumn);
- if (result == null)
- result = caseIAbstractJoinColumn(iJoinColumn);
- if (result == null)
- result = caseINamedColumn(iJoinColumn);
- if (result == null)
- result = caseIJpaSourceObject(iJoinColumn);
- if (result == null)
- result = caseIJpaEObject(iJoinColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IOVERRIDE : {
- IOverride iOverride = (IOverride) theEObject;
- T result = caseIOverride(iOverride);
- if (result == null)
- result = caseIJpaSourceObject(iOverride);
- if (result == null)
- result = caseIJpaEObject(iOverride);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IATTRIBUTE_OVERRIDE : {
- IAttributeOverride iAttributeOverride = (IAttributeOverride) theEObject;
- T result = caseIAttributeOverride(iAttributeOverride);
- if (result == null)
- result = caseIOverride(iAttributeOverride);
- if (result == null)
- result = caseIColumnMapping(iAttributeOverride);
- if (result == null)
- result = caseIJpaSourceObject(iAttributeOverride);
- if (result == null)
- result = caseIJpaEObject(iAttributeOverride);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IASSOCIATION_OVERRIDE : {
- IAssociationOverride iAssociationOverride = (IAssociationOverride) theEObject;
- T result = caseIAssociationOverride(iAssociationOverride);
- if (result == null)
- result = caseIOverride(iAssociationOverride);
- if (result == null)
- result = caseIJpaSourceObject(iAssociationOverride);
- if (result == null)
- result = caseIJpaEObject(iAssociationOverride);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN : {
- IDiscriminatorColumn iDiscriminatorColumn = (IDiscriminatorColumn) theEObject;
- T result = caseIDiscriminatorColumn(iDiscriminatorColumn);
- if (result == null)
- result = caseINamedColumn(iDiscriminatorColumn);
- if (result == null)
- result = caseIJpaSourceObject(iDiscriminatorColumn);
- if (result == null)
- result = caseIJpaEObject(iDiscriminatorColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.ISECONDARY_TABLE : {
- ISecondaryTable iSecondaryTable = (ISecondaryTable) theEObject;
- T result = caseISecondaryTable(iSecondaryTable);
- if (result == null)
- result = caseITable(iSecondaryTable);
- if (result == null)
- result = caseIJpaSourceObject(iSecondaryTable);
- if (result == null)
- result = caseIJpaEObject(iSecondaryTable);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IPRIMARY_KEY_JOIN_COLUMN : {
- IPrimaryKeyJoinColumn iPrimaryKeyJoinColumn = (IPrimaryKeyJoinColumn) theEObject;
- T result = caseIPrimaryKeyJoinColumn(iPrimaryKeyJoinColumn);
- if (result == null)
- result = caseIAbstractJoinColumn(iPrimaryKeyJoinColumn);
- if (result == null)
- result = caseINamedColumn(iPrimaryKeyJoinColumn);
- if (result == null)
- result = caseIJpaSourceObject(iPrimaryKeyJoinColumn);
- if (result == null)
- result = caseIJpaEObject(iPrimaryKeyJoinColumn);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IGENERATOR : {
- IGenerator iGenerator = (IGenerator) theEObject;
- T result = caseIGenerator(iGenerator);
- if (result == null)
- result = caseIJpaSourceObject(iGenerator);
- if (result == null)
- result = caseIJpaEObject(iGenerator);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.ITABLE_GENERATOR : {
- ITableGenerator iTableGenerator = (ITableGenerator) theEObject;
- T result = caseITableGenerator(iTableGenerator);
- if (result == null)
- result = caseIGenerator(iTableGenerator);
- if (result == null)
- result = caseIJpaSourceObject(iTableGenerator);
- if (result == null)
- result = caseIJpaEObject(iTableGenerator);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.ISEQUENCE_GENERATOR : {
- ISequenceGenerator iSequenceGenerator = (ISequenceGenerator) theEObject;
- T result = caseISequenceGenerator(iSequenceGenerator);
- if (result == null)
- result = caseIGenerator(iSequenceGenerator);
- if (result == null)
- result = caseIJpaSourceObject(iSequenceGenerator);
- if (result == null)
- result = caseIJpaEObject(iSequenceGenerator);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IGENERATED_VALUE : {
- IGeneratedValue iGeneratedValue = (IGeneratedValue) theEObject;
- T result = caseIGeneratedValue(iGeneratedValue);
- if (result == null)
- result = caseIJpaSourceObject(iGeneratedValue);
- if (result == null)
- result = caseIJpaEObject(iGeneratedValue);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IQUERY : {
- IQuery iQuery = (IQuery) theEObject;
- T result = caseIQuery(iQuery);
- if (result == null)
- result = caseIJpaSourceObject(iQuery);
- if (result == null)
- result = caseIJpaEObject(iQuery);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.INAMED_QUERY : {
- INamedQuery iNamedQuery = (INamedQuery) theEObject;
- T result = caseINamedQuery(iNamedQuery);
- if (result == null)
- result = caseIJpaSourceObject(iNamedQuery);
- if (result == null)
- result = caseIQuery(iNamedQuery);
- if (result == null)
- result = caseIJpaEObject(iNamedQuery);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.INAMED_NATIVE_QUERY : {
- INamedNativeQuery iNamedNativeQuery = (INamedNativeQuery) theEObject;
- T result = caseINamedNativeQuery(iNamedNativeQuery);
- if (result == null)
- result = caseIJpaSourceObject(iNamedNativeQuery);
- if (result == null)
- result = caseIQuery(iNamedNativeQuery);
- if (result == null)
- result = caseIJpaEObject(iNamedNativeQuery);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.IQUERY_HINT : {
- IQueryHint iQueryHint = (IQueryHint) theEObject;
- T result = caseIQueryHint(iQueryHint);
- if (result == null)
- result = caseIJpaSourceObject(iQueryHint);
- if (result == null)
- result = caseIJpaEObject(iQueryHint);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCoreMappingsPackage.ICASCADE : {
- ICascade iCascade = (ICascade) theEObject;
- T result = caseICascade(iCascade);
- if (result == null)
- result = caseIJpaSourceObject(iCascade);
- if (result == null)
- result = caseIJpaEObject(iCascade);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- default :
- return defaultCase(theEObject);
- }
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IMapped Superclass</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IMapped Superclass</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIMappedSuperclass(IMappedSuperclass object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IEntity</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IEntity</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIEntity(IEntity object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ITable</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ITable</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseITable(ITable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IUnique Constraint</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IUnique Constraint</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIUniqueConstraint(IUniqueConstraint object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>INamed Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>INamed Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseINamedColumn(INamedColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAbstract Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAbstract Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAbstractColumn(IAbstractColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IColumn</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IColumn</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIColumn(IColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IColumn Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IColumn Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIColumnMapping(IColumnMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IEmbeddable</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IEmbeddable</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIEmbeddable(IEmbeddable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IBasic</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IBasic</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIBasic(IBasic object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IId</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IId</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIId(IId object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ITransient</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ITransient</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseITransient(ITransient object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IVersion</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IVersion</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIVersion(IVersion object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IEmbedded Id</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IEmbedded Id</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIEmbeddedId(IEmbeddedId object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IEmbedded</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IEmbedded</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIEmbedded(IEmbedded object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IRelationship Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IRelationship Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIRelationshipMapping(IRelationshipMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>INon Owning Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>INon Owning Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseINonOwningMapping(INonOwningMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IMulti Relationship Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IMulti Relationship Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIMultiRelationshipMapping(IMultiRelationshipMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IOne To Many</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IOne To Many</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIOneToMany(IOneToMany object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IMany To Many</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IMany To Many</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIManyToMany(IManyToMany object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ISingle Relationship Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ISingle Relationship Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseISingleRelationshipMapping(ISingleRelationshipMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IMany To One</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IMany To One</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIManyToOne(IManyToOne object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IOne To One</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IOne To One</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIOneToOne(IOneToOne object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJoin Table</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJoin Table</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJoinTable(IJoinTable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAbstract Join Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAbstract Join Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAbstractJoinColumn(IAbstractJoinColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJoin Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJoin Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJoinColumn(IJoinColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IOverride</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IOverride</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIOverride(IOverride object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAttribute Override</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAttribute Override</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAttributeOverride(IAttributeOverride object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAssociation Override</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAssociation Override</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAssociationOverride(IAssociationOverride object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IDiscriminator Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IDiscriminator Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIDiscriminatorColumn(IDiscriminatorColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ISecondary Table</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ISecondary Table</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseISecondaryTable(ISecondaryTable object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IPrimary Key Join Column</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IPrimary Key Join Column</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIPrimaryKeyJoinColumn(IPrimaryKeyJoinColumn object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IGenerator</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IGenerator</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIGenerator(IGenerator object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ITable Generator</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ITable Generator</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseITableGenerator(ITableGenerator object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ISequence Generator</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ISequence Generator</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseISequenceGenerator(ISequenceGenerator object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IGenerated Value</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IGenerated Value</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIGeneratedValue(IGeneratedValue object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IQuery</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IQuery</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIQuery(IQuery object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>INamed Query</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>INamed Query</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseINamedQuery(INamedQuery object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>INamed Native Query</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>INamed Native Query</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseINamedNativeQuery(INamedNativeQuery object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IQuery Hint</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IQuery Hint</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIQueryHint(IQueryHint object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>ICascade</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>ICascade</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseICascade(ICascade object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaEObject(IJpaEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa Source Object</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa Source Object</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaSourceObject(IJpaSourceObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IType Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IType Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseITypeMapping(ITypeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAttribute Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAttribute Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAttributeMapping(IAttributeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch, but this is the last case anyway.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject)
- * @generated
- */
- public T defaultCase(EObject object) {
- return null;
- }
-} //JpaCoreMappingsSwitch
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/AbstractJoinColumnContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/AbstractJoinColumnContext.java
deleted file mode 100644
index cf4dc2ffad..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/AbstractJoinColumnContext.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-
-public abstract class AbstractJoinColumnContext<E extends IAbstractJoinColumn> extends BaseContext
-{
- protected E column;
-
- public AbstractJoinColumnContext(IContext parentContext, E column) {
- super(parentContext);
- this.column = column;
- }
-
- @Override
- protected void initialize() {}
-
- public E getColumn() {
- return this.column;
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- this.column.refreshDefaults(wrapDefaultsContext(defaultsContext));
- }
-
- public DefaultsContext wrapDefaultsContext(DefaultsContext defaultsContext) {
- return new DefaultsContextWrapper(defaultsContext) {
- public Object getDefault(String key) {
- if (key.equals(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_NAME_KEY)) {
- return buildDefaultName();
- }
- if (key.equals(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_REFERENCED_COLUMN_NAME_KEY)) {
- return buildDefaultReferencedColumnName();
- }
- return super.getDefault(key);
- }
- };
- }
-
- protected abstract String buildDefaultName();
-
- protected abstract String buildDefaultReferencedColumnName();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/AssociationOverrideContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/AssociationOverrideContext.java
deleted file mode 100644
index e8d0a29475..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/AssociationOverrideContext.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class AssociationOverrideContext extends BaseContext
-{
- IAssociationOverride associationOverride;
-
- private Collection<JoinColumnContext> joinColumnContexts;
-
- public AssociationOverrideContext(IContext parentContext, IAssociationOverride associationOverride) {
- super(parentContext);
- this.associationOverride = associationOverride;
- this.joinColumnContexts = buildJoinColumnContexts();
- }
-
- @Override
- protected void initialize() {
- }
-
- protected Collection<JoinColumnContext> buildJoinColumnContexts() {
- Collection<JoinColumnContext> contexts = new ArrayList<JoinColumnContext>();
- for (IJoinColumn joinColumn : this.associationOverride.getJoinColumns() ) {
- contexts.add(new JoinColumnContext(this, joinColumn));
- }
- return contexts;
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- for (JoinColumnContext context : this.joinColumnContexts) {
- context.refreshDefaults(defaultsContext, monitor);
- }
- }
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- addJoinColumnMessages(messages);
- }
-
- protected void addJoinColumnMessages(List<IMessage> messages) {
- ITypeMapping typeMapping = associationOverride.typeMapping();
-
- for (IJoinColumn joinColumn : associationOverride.getJoinColumns()) {
- String table = joinColumn.getTable();
- boolean doContinue = joinColumn.isConnected();
-
- if (doContinue && typeMapping.tableNameIsInvalid(table)) {
- if (associationOverride.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_TABLE,
- new String[] {associationOverride.getName(), table, joinColumn.getName()},
- joinColumn, joinColumn.tableTextRange())
- );
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_COLUMN_UNRESOLVED_TABLE,
- new String[] {table, joinColumn.getName()},
- joinColumn, joinColumn.tableTextRange())
- );
- }
- doContinue = false;
- }
-
- if (doContinue && ! joinColumn.isResolved()) {
- if (associationOverride.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {associationOverride.getName(), joinColumn.getName()},
- joinColumn, joinColumn.nameTextRange())
- );
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getName()},
- joinColumn, joinColumn.nameTextRange())
- );
- }
- }
-
- if (doContinue && ! joinColumn.isReferencedColumnResolved()) {
- if (associationOverride.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {associationOverride.getName(), joinColumn.getReferencedColumnName(), joinColumn.getName()},
- joinColumn, joinColumn.referencedColumnNameTextRange())
- );
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getReferencedColumnName(), joinColumn.getName()},
- joinColumn, joinColumn.referencedColumnNameTextRange())
- );
- }
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/AttributeOverrideContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/AttributeOverrideContext.java
deleted file mode 100644
index 667381949f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/AttributeOverrideContext.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class AttributeOverrideContext extends BaseContext
-{
- IAttributeOverride attributeOverride;
-
- ColumnContext columnContext;
-
- public AttributeOverrideContext(IContext parentContext, IAttributeOverride attributeOverride) {
- super(parentContext);
- this.attributeOverride = attributeOverride;
- this.columnContext = buildColumnContext();
- }
-
- @Override
- protected void initialize() {}
-
- protected ColumnContext buildColumnContext() {
- return new ColumnContext(this, this.attributeOverride.getColumn());
- }
-
- public DefaultsContext wrapDefaultsContext(DefaultsContext defaultsContext) {
- return new DefaultsContextWrapper(defaultsContext) {
- public Object getDefault(String key) {
- if (key.equals(BaseJpaPlatform.DEFAULT_COLUMN_NAME_KEY)) {
- return buildDefaultColumnName();
- }
- else if (key.equals(BaseJpaPlatform.DEFAULT_COLUMN_TABLE_KEY)) {
- String tableName = buildDefaultTableName();
- if (tableName != null) {
- return tableName;
- }
-
- }
- return super.getDefault(key);
- }
- };
- }
-
- /**
- * The mapping that the attribute override is overriding
- */
- protected IColumnMapping columnMapping() {
- return (IColumnMapping) this.attributeOverride.getOwner().attributeMapping(this.attributeOverride.getName());
- }
-
- protected String buildDefaultColumnName() {
- IColumnMapping columnMapping = columnMapping();
- if (columnMapping == null) {
- return null;
- }
- return columnMapping.getColumn().getName();
- }
-
- protected String buildDefaultTableName() {
- IColumnMapping columnMapping = columnMapping();
- if (columnMapping == null) {
- return null;
- }
- return columnMapping.getColumn().getSpecifiedTable();
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- this.columnContext.refreshDefaults(wrapDefaultsContext(defaultsContext), monitor);
- }
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- addColumnMessages(messages);
- }
-
- protected void addColumnMessages(List<IMessage> messages) {
- ITypeMapping typeMapping = attributeOverride.getOwner().getTypeMapping();
- IColumn column = attributeOverride.getColumn();
- String table = column.getTable();
- boolean doContinue = column.isConnected();
-
- if (doContinue && typeMapping.tableNameIsInvalid(table)) {
- if (attributeOverride.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_TABLE,
- new String[] {attributeOverride.getName(), table, column.getName()},
- column, column.tableTextRange())
- );
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
- new String[] {table, column.getName()},
- column, column.tableTextRange())
- );
- }
- doContinue = false;
- }
-
- if (doContinue && ! column.isResolved()) {
- if (attributeOverride.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME,
- new String[] {attributeOverride.getName(), column.getName()},
- column, column.nameTextRange())
- );
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName()},
- column, column.nameTextRange())
- );
- }
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseContext.java
deleted file mode 100644
index 6fc20bba85..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseContext.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.IJpaPlatform;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public abstract class BaseContext implements IContext
-{
- private IContext parentContext;
-
-
- public BaseContext(IContext parentContext) {
- super();
- this.parentContext = parentContext;
- }
-
- /**
- * All inter-context based initialization should be done here
- * (i.e. all initialization based on other contexts, parent or otherwise)
- */
- protected abstract void initialize();
-
- public IJpaPlatform getPlatform() {
- return getParentContext().getPlatform();
- }
-
- public IContext getParentContext() {
- return parentContext;
- }
-
- /**
- * All subclass implementation {@link #refreshDefaults(DefaultsContext)}
- * should be preceded by a "super" call to this method
- */
- public void refreshDefaults(DefaultsContext parentDefaults, IProgressMonitor monitor) {
- initialize();
- }
-
- /**
- * All subclass implementation {@link #refreshDefaults(DefaultsContext)}
- * should be preceded by a "super" call to this method
- */
- public void addToMessages(List<IMessage> messages) {
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseJpaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseJpaFactory.java
deleted file mode 100644
index d9a10711bc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseJpaFactory.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jpt.core.internal.IJpaDataSource;
-import org.eclipse.jpt.core.internal.IJpaFactory;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IJpaFileContentProvider;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.JpaCoreFactory;
-import org.eclipse.jpt.core.internal.JpaProject;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaBasic;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddable;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbedded;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaEmbeddedId;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaEntity;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaId;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToMany;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaManyToOne;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaMappedSuperclass;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToMany;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaOneToOne;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaTransient;
-import org.eclipse.jpt.core.internal.content.java.mappings.IJavaVersion;
-import org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsFactory;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
-
-public abstract class BaseJpaFactory implements IJpaFactory
-{
- public IJpaProject createJpaProject(IJpaProject.Config config) throws CoreException {
- return new JpaProject(config);
- }
-
- public IJpaDataSource createDataSource(IJpaProject jpaProject, String connectionProfileName) {
- return JpaCoreFactory.eINSTANCE.createJpaDataSource(jpaProject, connectionProfileName);
- }
-
- public IJpaFile createJpaFile(IJpaProject jpaProject, IFile file, IJpaFileContentProvider provider) {
- return JpaCoreFactory.eINSTANCE.createJpaFile(jpaProject, file, provider);
- }
-
- public IJavaEntity createJavaEntity(Type type) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaEntity(type);
- }
-
- public IJavaEmbeddable createJavaEmbeddable(Type type) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaEmbeddable(type);
- }
-
- public IJavaMappedSuperclass createJavaMappedSuperclass(Type type) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaMappedSuperclass(type);
- }
-
- public IJavaBasic createJavaBasic(Attribute attribute) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaBasic(attribute);
- }
-
- public IJavaEmbedded createJavaEmbedded(Attribute attribute) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaEmbedded(attribute);
- }
-
- public IJavaEmbeddedId createJavaEmbeddedId(Attribute attribute) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaEmbeddedId(attribute);
- }
-
- public IJavaId createJavaId(Attribute attribute) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaId(attribute);
- }
-
- public IJavaManyToMany createJavaManyToMany(Attribute attribute) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaManyToMany(attribute);
- }
-
- public IJavaManyToOne createJavaManyToOne(Attribute attribute) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaManyToOne(attribute);
- }
-
- public IJavaOneToMany createJavaOneToMany(Attribute attribute) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaOneToMany(attribute);
- }
-
- public IJavaOneToOne createJavaOneToOne(Attribute attribute) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaOneToOne(attribute);
- }
-
- public IJavaTransient createJavaTransient(Attribute attribute) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaTransient(attribute);
- }
-
- public IJavaVersion createJavaVersion(Attribute attribute) {
- return JpaJavaMappingsFactory.eINSTANCE.createJavaVersion(attribute);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseJpaPlatform.java
deleted file mode 100644
index 13380dd91a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseJpaPlatform.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.platform;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.internal.IJpaFactory;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IJpaFileContentProvider;
-import org.eclipse.jpt.core.internal.IJpaPlatform;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.core.internal.content.java.IDefaultJavaAttributeMappingProvider;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMappingProvider;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMappingProvider;
-import org.eclipse.jpt.core.internal.content.java.JavaJpaFileContentProvider;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaBasicProvider;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddable;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddableProvider;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbedded;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddedId;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddedIdProvider;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddedProvider;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEntityProvider;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaId;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaIdProvider;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToMany;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToManyProvider;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToOne;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToOneProvider;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaMappedSuperclass;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaMappedSuperclassProvider;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaNullAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaNullTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToMany;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToManyProvider;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToOne;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToOneProvider;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaTransient;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaTransientProvider;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaVersion;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaVersionProvider;
-import org.eclipse.jpt.core.internal.content.orm.OrmXmlJpaFileContentProvider;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlJpaFileContentProvider;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-public abstract class BaseJpaPlatform implements IJpaPlatform
-{
- public static final String DEFAULT_TABLE_SCHEMA_KEY = "table.schema";
- public static final String DEFAULT_TABLE_CATALOG_KEY = "table.catalog";
- public static final String DEFAULT_TABLE_NAME_KEY = "table.name";
- public static final String DEFAULT_ACCESS_KEY = "access";
- public static final String DEFAULT_ENTITY_NAME_KEY = "entity.name";
- public static final String DEFAULT_COLUMN_TABLE_KEY = "column.table";
- public static final String DEFAULT_COLUMN_NAME_KEY = "column.name";
- public static final String DEFAULT_JOIN_TABLE_NAME_KEY = "joinTable.name";
- public static final String DEFAULT_TARGET_ENTITY_KEY = "oneToMany.targetEntity";
- public static final String DEFAULT_JOIN_COLUMN_TABLE_KEY = "joinColumn.table";
- public static final String DEFAULT_JOIN_COLUMN_NAME_KEY = "joinColumn.name";
- public static final String DEFAULT_JOIN_COLUMN_REFERENCED_COLUMN_NAME_KEY = "joinColumn.referencedColumnName";
- public static final String DEFAULT_TABLE_GENERATOR_SCHEMA_KEY = "tableGenerator.schema";
-
- private String id;
-
- protected IJpaProject project; // TODO this must go ~bjv
-
- private Collection<IJpaFileContentProvider> contentProviders;
-
- private Collection<IJavaAttributeMappingProvider> javaAttributeMappingProviders;
-
- private List<IDefaultJavaAttributeMappingProvider> defaultJavaAttributeMappingProviders;
-
- private Collection<IJavaTypeMappingProvider> javaTypeMappingProviders;
-
- private IJpaFactory jpaFactory;
-
- private IContext context; // TODO this must go ~bjv
-
- protected BaseJpaPlatform() {
- super();
- this.jpaFactory = buildJpaFactory();
- }
-
- protected abstract IJpaFactory buildJpaFactory();
-
- public String getId() {
- return this.id;
- }
-
- /**
- * *************
- * * IMPORTANT * For INTERNAL use only !!
- * *************
- */
- public void setId(String theId) {
- this.id = theId;
- }
-
- public IJpaProject getProject() {
- return this.project;
- }
-
- public void setProject(IJpaProject jpaProject) {
- this.project = jpaProject;
- }
-
- public IJpaFactory getJpaFactory() {
- return this.jpaFactory;
- }
-
- public IJpaFile createJpaFile(IJpaProject jpaProject, IFile file) {
- if ( ! jpaProject.javaProject().isOnClasspath(file)) {
- return null; // skip the file if it is not on the Java project's classpath
- }
-
- IContentType contentType = this.contentType(file);
- if (contentType == null) {
- return null; // skip the file if its content type is unknown
- }
-
- IJpaFileContentProvider provider = this.fileContentProvider(contentType.getId());
- if (provider == null) {
- return null; // no JPA file if we don't have a JPA file content provider for its content
- }
- return this.jpaFactory.createJpaFile(jpaProject, file, provider);
- }
-
- /**
- * Return the content type of the specified file.
- * This cannot be based solely on the file's name (i.e. the file's extension)
- * because in the case of XML the content type is based on the root
- * element name (which is inside the file).
- */
- protected IContentType contentType(IFile file) {
- try {
- return Platform.getContentTypeManager().findContentTypeFor(file.getContents(), file.getName());
- } catch (IOException ex) {
- JptCorePlugin.log(ex);
- } catch (CoreException ex) {
- JptCorePlugin.log(ex);
- }
- return null; // return null if any exceptions occur
- }
-
- // ********** Persistence Unit ********************************************
-
- public boolean containsPersistenceUnitNamed(String name) {
- return ((BaseJpaProjectContext)this.context).containsPersistenceUnitNamed(name);
- }
-
- public PersistenceUnit persistenceUnitNamed(String name) {
- return ((BaseJpaProjectContext)this.context).persistenceUnitNamed(name);
- }
-
- public Iterator<PersistenceUnit> persistenceUnits() {
- return ((BaseJpaProjectContext)this.context).persistenceUnits();
- }
-
- public int persistenceUnitSize() {
- return ((BaseJpaProjectContext)this.context).persistenceUnitContextsSize();
- }
-
-
- // ********** Persistent Types ********************************************
-
- public Iterator<IPersistentType> persistentTypes(String persistenceUnitName) {
- PersistenceUnitContext puContext =
- ((BaseJpaProjectContext) this.context).persistenceUnitContext(persistenceUnitName);
- return (puContext == null) ? EmptyIterator.<IPersistentType>instance() : puContext.persistentTypes();
- }
-
-
- // ************************************************************************
-
- public Iterator<IJpaFileContentProvider> jpaFileContentProviders() {
- if (this.contentProviders == null) {
- this.contentProviders = new ArrayList<IJpaFileContentProvider>();
- addJpaFileContentProvidersTo(this.contentProviders);
- }
- return new CloneIterator<IJpaFileContentProvider>(this.contentProviders);
- }
-
- public IJpaFileContentProvider fileContentProvider(String contentTypeId) {
- for (Iterator<IJpaFileContentProvider> i = this.jpaFileContentProviders(); i.hasNext(); ) {
- IJpaFileContentProvider provider = i.next();
- if (provider.contentType().equals(contentTypeId)) {
- return provider;
- }
- }
- return null;
- }
-
- /**
- * Override this to specify more or different JPA file content providers.
- * The default includes the JPA spec-defined content providers of
- * persistence.xml, orm.xml, and java files.
- */
- protected void addJpaFileContentProvidersTo(Collection<IJpaFileContentProvider> providers) {
- providers.add(PersistenceXmlJpaFileContentProvider.instance());
- providers.add(JavaJpaFileContentProvider.instance());
- providers.add(OrmXmlJpaFileContentProvider.instance());
- }
-
- public Iterator<IJavaTypeMappingProvider> javaTypeMappingProviders() {
- if (this.javaTypeMappingProviders == null) {
- this.javaTypeMappingProviders = new ArrayList<IJavaTypeMappingProvider>();
- this.addJavaTypeMappingProvidersTo(this.javaTypeMappingProviders);
- }
- return new CloneIterator<IJavaTypeMappingProvider>(this.javaTypeMappingProviders);
- }
-
- /**
- * Override this to specify more or different type mapping providers.
- * The default includes the JPA spec-defined type mappings of
- * Entity, MappedSuperclass, and Embeddable
- */
- protected void addJavaTypeMappingProvidersTo(Collection<IJavaTypeMappingProvider> providers) {
- providers.add(JavaEntityProvider.instance());
- providers.add(JavaMappedSuperclassProvider.instance());
- providers.add(JavaEmbeddableProvider.instance());
- }
-
- public IJavaTypeMappingProvider javaTypeMappingProvider(String typeMappingKey) {
- for (Iterator<IJavaTypeMappingProvider> i = this.javaTypeMappingProviders(); i.hasNext(); ) {
- IJavaTypeMappingProvider provider = i.next();
- if (provider.key() == typeMappingKey) {
- return provider;
- }
- }
- return null;
- }
-
- public Iterator<IJavaAttributeMappingProvider> javaAttributeMappingProviders() {
- if (this.javaAttributeMappingProviders == null) {
- this.javaAttributeMappingProviders = new ArrayList<IJavaAttributeMappingProvider>();
- this.addJavaAttributeMappingProvidersTo(this.javaAttributeMappingProviders);
- }
- return new CloneIterator<IJavaAttributeMappingProvider>(this.javaAttributeMappingProviders);
- }
-
- /**
- * Override this to specify more or different attribute mapping providers.
- * The default includes the JPA spec-defined attribute mappings of
- * Basic, Id, Transient OneToOne, OneToMany, ManyToOne, ManyToMany, Embeddable, EmbeddedId, Version.
- */
- protected void addJavaAttributeMappingProvidersTo(Collection<IJavaAttributeMappingProvider> providers) {
- providers.add(JavaBasicProvider.instance());
- providers.add(JavaIdProvider.instance());
- providers.add(JavaTransientProvider.instance());
- providers.add(JavaOneToManyProvider.instance());
- providers.add(JavaManyToOneProvider.instance());
- providers.add(JavaManyToManyProvider.instance());
- providers.add(JavaOneToOneProvider.instance());
- providers.add(JavaEmbeddedProvider.instance());
- providers.add(JavaEmbeddedIdProvider.instance());
- providers.add(JavaVersionProvider.instance());
- }
-
- /**
- * throw an exception if the provider is not found
- */
- public IJavaAttributeMappingProvider javaAttributeMappingProvider(String attributeMappingKey) {
- for (Iterator<IJavaAttributeMappingProvider> i = this.javaAttributeMappingProviders(); i.hasNext(); ) {
- IJavaAttributeMappingProvider provider = i.next();
- if (provider.key() == attributeMappingKey) {
- return provider;
- }
- }
- throw new IllegalArgumentException("Unsupported java attribute mapping key: " + attributeMappingKey);
- }
-
- public ListIterator<IDefaultJavaAttributeMappingProvider> defaultJavaAttributeMappingProviders() {
- if (this.defaultJavaAttributeMappingProviders == null) {
- this.defaultJavaAttributeMappingProviders = new ArrayList<IDefaultJavaAttributeMappingProvider>();
- this.addDefaultAttributeMappingProvidersTo(this.defaultJavaAttributeMappingProviders);
- }
- return new CloneListIterator<IDefaultJavaAttributeMappingProvider>(this.defaultJavaAttributeMappingProviders);
- }
-
- /**
- * Override this to specify more or different default attribute mapping providers.
- * The default includes the JPA spec-defined attribute mappings of
- * Embedded and Basic.
- */
- protected void addDefaultAttributeMappingProvidersTo(List<IDefaultJavaAttributeMappingProvider> providers) {
- providers.add(JavaEmbeddedProvider.instance()); //bug 190344 need to test default embedded before basic
- providers.add(JavaBasicProvider.instance());
- }
-
- public IContext buildProjectContext() {
- this.context = new BaseJpaProjectContext(getProject());
- return this.context;
- }
-
- public Iterator<IJpaFile> validPersistenceXmlFiles(){
- return ((BaseJpaProjectContext)this.context).validPersistenceXmlFiles();
- }
-
- public IContext buildJavaTypeContext(IContext parentContext, IJavaTypeMapping typeMapping) {
- String key = typeMapping.getKey();
- if (key == IMappingKeys.ENTITY_TYPE_MAPPING_KEY) {
- return new JavaEntityContext(parentContext, (JavaEntity) typeMapping);
- }
- else if (key == IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY) {
- return new JavaEmbeddableContext(parentContext, (JavaEmbeddable) typeMapping);
- }
- else if (key == IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY) {
- return new JavaMappedSuperclassContext(parentContext, (JavaMappedSuperclass) typeMapping);
- }
- else if (key == null) {
- return new JavaNullTypeMappingContext(parentContext, (JavaNullTypeMapping) typeMapping);
- }
- else {
- throw new IllegalArgumentException(typeMapping.toString());
- }
- }
-
- public IContext buildJavaAttributeContext(IContext parentContext, IJavaAttributeMapping attributeMapping) {
- String key = attributeMapping.getKey();
- if (key == IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY) {
- return new JavaBasicContext(parentContext, (JavaBasic) attributeMapping);
- }
- else if (key == IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY) {
- return new JavaIdContext(parentContext, (JavaId) attributeMapping);
- }
- else if (key == IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY) {
- return new JavaVersionContext(parentContext, (JavaVersion) attributeMapping);
- }
- else if (key == IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY) {
- return new JavaEmbeddedContext(parentContext, (JavaEmbedded) attributeMapping);
- }
- else if (key == IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY) {
- return new JavaEmbeddedIdContext(parentContext, (JavaEmbeddedId) attributeMapping);
- }
- else if (key == IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
- return new JavaOneToOneContext(parentContext, (JavaOneToOne) attributeMapping);
- }
- else if (key == IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
- return new JavaOneToManyContext(parentContext, (JavaOneToMany) attributeMapping);
- }
- else if (key == IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
- return new JavaManyToOneContext(parentContext, (JavaManyToOne) attributeMapping);
- }
- else if (key == IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
- return new JavaManyToManyContext(parentContext, (JavaManyToMany) attributeMapping);
- }
- else if (key == IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY) {
- return new JavaTransientContext(parentContext, (JavaTransient) attributeMapping);
- }
- else if (key == null) {
- return new JavaNullAttributeMappingContext(parentContext, (JavaNullAttributeMapping) attributeMapping);
- }
- else {
- throw new IllegalArgumentException(attributeMapping.toString());
- }
- }
-
- public void resynch(IContext contextHierarchy, IProgressMonitor monitor) {
- ((BaseJpaProjectContext) contextHierarchy).refreshDefaults(monitor);
- }
-
- @SuppressWarnings("restriction")
- public void addToMessages(List<org.eclipse.wst.validation.internal.provisional.core.IMessage> messages) {
- //I believe we need to be calling JpaProject.update() here.
- //How can we handle this, we need to resynch and then wait until it is done
- //resynching before calling this. what happens if something changes out from
- //under us while we are resynching??
- BaseJpaProjectContext ctx = (BaseJpaProjectContext) buildProjectContext();
- ctx.refreshDefaults(new NullProgressMonitor());
- ctx.addToMessages(messages);
- }
-
-// public IGeneratorRepository generatorRepository(IPersistentType persistentType) {
-// return ((BaseJpaProjectContext) context).generatorRepository(persistentType);
-// }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseJpaProjectContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseJpaProjectContext.java
deleted file mode 100644
index fe3d131073..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/BaseJpaProjectContext.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IJpaPlatform;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.content.persistence.Persistence;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.jst.j2ee.internal.J2EEConstants;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-/**
- * The jpaProject context used for base jpa projects. It is assumed that
- * the jpaProject contains at least 1 persistence.xml file. Multiple persistence.xml
- * files will be treated as an error condition, no defaults or validation based
- * on the context of a persistence-unit will be given. Currently no support for default orm.xml
- * files or defaulting annotated java files, we don't know how the information will be packaged.
- *
- * Multiple persistence-units can be supported, but the resulting defaults/validation
- * may be incorrect. If the persistence-units have overlap in the java files they specify
- * as mapped, then the defaults could be wrong depending on the context. We can only use 1 set
- * of defaults in our tooling.
- */
-public class BaseJpaProjectContext extends BaseContext
-{
- private IJpaProject jpaProject;
-
- private List<IJpaFile> validPersistenceXmlFiles;
- private List<IJpaFile> invalidPersistenceXmlFiles;
-
- private Collection<PersistenceUnitContext> persistenceUnitContexts;
-
- public BaseJpaProjectContext(IJpaProject theJpaProject) {
- super(null);
- jpaProject = theJpaProject;
- validPersistenceXmlFiles = new ArrayList<IJpaFile>();
- invalidPersistenceXmlFiles = new ArrayList<IJpaFile>();
- persistenceUnitContexts = new ArrayList<PersistenceUnitContext>();
- }
-
- @Override
- protected void initialize() {
- sortPersistenceXmlFiles();
- buildPersistenceUnitContexts();
- }
-
- private void sortPersistenceXmlFiles() {
- for (Iterator<IJpaFile> stream = this.persistenceXmlFiles(); stream.hasNext(); ) {
- IJpaFile jpaFile = stream.next();
- if (isValidPersistenceXmlLocation(jpaFile)) {
- validPersistenceXmlFiles.add(jpaFile);
- }
- else {
- invalidPersistenceXmlFiles.add(jpaFile);
- }
- }
- }
-
- private Iterator<IJpaFile> persistenceXmlFiles() {
- return this.jpaProject.jpaFiles(JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE);
- }
-
- private boolean isValidPersistenceXmlLocation(IJpaFile jpaFile) {
- IFile file = jpaFile.getFile();
- IProject project = jpaProject.project();
-
- // check flexible jpaProject structure
- IVirtualComponent component = ComponentCore.createComponent(project);
- IVirtualFolder rootFolder = component.getRootFolder();
- IVirtualFolder metaInfFolder = rootFolder.getFolder(new Path(jpaProject.rootDeployLocation() + '/' + J2EEConstants.META_INF));
- return metaInfFolder.exists() && CollectionTools.contains(metaInfFolder.getUnderlyingFolders(), file.getParent());
- }
-
- //TODO need to handle clearing out defaults for JpaFiles that aren't in a persistenceUnit
- // or for when there are multiple persistence.xml files
- //TODO how do we handle files being in multiple persistenceUnits? this is valid, but
- //our tool can really only show defaults for one or the other. should clear out defaults and
- //probably have a warning letting the user know why they get no defaults or validation
- protected void buildPersistenceUnitContexts() {
- // we currently only support *one* persistence.xml file per jpaProject,
- // so we provide no defaults or validation for those that have more or less
- if (validPersistenceXmlFiles.size() == 1) {
- IJpaFile file = validPersistenceXmlFiles.get(0);
- buildPersistenceUnitContexts(getPersistence(file));
- }
- }
-
- protected void buildPersistenceUnitContexts(Persistence persistence) {
- if (persistence != null) {
- for (Iterator stream = persistence.getPersistenceUnits().iterator(); stream.hasNext();) {
- PersistenceUnit persistenceUnit = (PersistenceUnit) stream.next();
- PersistenceUnitContext persistenceUnitContext = new PersistenceUnitContext(this, persistenceUnit);
- persistenceUnitContexts.add(persistenceUnitContext);
- }
- }
- }
-
- protected Persistence getPersistence(IJpaFile persistenceXmlFile) {
- return ((PersistenceXmlRootContentNode) persistenceXmlFile.getContent()).getPersistence();
- }
-
- @Override
- public IJpaPlatform getPlatform() {
- return this.jpaProject.jpaPlatform();
- }
-
- protected Iterator<IJpaFile> validPersistenceXmlFiles(){
- return validPersistenceXmlFiles.iterator();
- }
-
- public void refreshDefaults(IProgressMonitor monitor) {
- refreshDefaults(null, monitor);
- }
-
- @Override
- public void refreshDefaults(DefaultsContext parentDefaults, IProgressMonitor monitor) {
- super.refreshDefaults(parentDefaults, monitor);
- DefaultsContext defaultsContext = buildDefaultsContext();
- for (PersistenceUnitContext context : this.persistenceUnitContexts) {
- checkCanceled(monitor);
- context.refreshDefaults(defaultsContext, monitor);
- }
- }
-
- private void checkCanceled(IProgressMonitor monitor) {
- if (monitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- }
-
- private DefaultsContext buildDefaultsContext() {
- return new DefaultsContext(){
- public Object getDefault(String key) {
- if (key.equals(BaseJpaPlatform.DEFAULT_TABLE_SCHEMA_KEY)
- || key.equals(BaseJpaPlatform.DEFAULT_TABLE_GENERATOR_SCHEMA_KEY)) {
- return getDefaultSchema();
- }
- else if (key.equals(BaseJpaPlatform.DEFAULT_TABLE_CATALOG_KEY)) {
- return getProjectUserCatalog();
- }
- return null;
- }
- public IPersistentType persistentType(String fullyQualifiedTypeName) {
- return null;
- }
- public CompilationUnit astRoot() {
- return null;
- }
- };
- }
-
- protected ConnectionProfile getProjectConnectionProfile() {
- return this.jpaProject.connectionProfile();
- }
-
- private String getDefaultSchema() {
- ConnectionProfile profile = this.getProjectConnectionProfile();
- return profile.getDefaultSchema();
- }
-
- private String getProjectUserCatalog() {
- ConnectionProfile profile = this.getProjectConnectionProfile();
- return profile.getCatalogName();
- }
-
- public boolean contains(IPersistentType persistentType) {
- for (PersistenceUnitContext context : this.persistenceUnitContexts) {
- if (context.contains(persistentType)) {
- return true;
- }
- }
- return false;
- }
-
- private Iterator<PersistenceUnitContext> persistenceUnitContexts() {
- return this.persistenceUnitContexts.iterator();
- }
-
- int persistenceUnitContextsSize() {
- return this.persistenceUnitContexts.size();
- }
-
- PersistenceUnitContext persistenceUnitContext(String persistenceUnitName) {
- for (Iterator<PersistenceUnitContext> stream = persistenceUnitContexts(); stream.hasNext(); ) {
- PersistenceUnitContext puContext = stream.next();
- if (puContext.persistenceUnit().getName().equals(persistenceUnitName)) {
- return puContext;
- }
- }
- return null;
- }
-
- Iterator<PersistenceUnit> persistenceUnits() {
- return new TransformationIterator<PersistenceUnitContext, PersistenceUnit>(this.persistenceUnitContexts()) {
- @Override
- protected PersistenceUnit transform(PersistenceUnitContext next) {
- return next.persistenceUnit();
- }
- };
- }
-
- public boolean containsPersistenceUnitNamed(String name) {
- return this.persistenceUnitNamed(name) != null;
- }
-
- PersistenceUnit persistenceUnitNamed(String name) {
- for (PersistenceUnitContext context : this.persistenceUnitContexts) {
- if( context.persistenceUnit().getName().equals(name)) {
- return context.persistenceUnit();
- }
- }
- return null;
- }
-
-// public IGeneratorRepository generatorRepository(IPersistentType persistentType) {
-// for (PersistenceUnitContext context : this.persistenceUnitContexts) {
-// if (context.contains(persistentType)) {
-// context.getGeneratorRepository();
-// }
-// }
-// return NullGeneratorRepository.instance();
-// }
-
- /* If this is true, it may be assumed that all the requirements are valid
- * for further validation. For example, if this is true at the point we
- * are validating persistence units, it may be assumed that there is a
- * single persistence.xml and that it has valid content down to the
- * persistence unit level. */
- private boolean okToContinueValidation = true;
-
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
- addProjectLevelMessages(messages);
- if (okToContinueValidation) {
- for (PersistenceUnitContext context : persistenceUnitContexts) {
- context.addToMessages(messages);
- }
- }
- addOrphanedJavaClassMessages(messages);
- }
-
- protected void addProjectLevelMessages(List<IMessage> messages) {
- addConnectionMessages(messages);
- addNoPersistenceXmlMessage(messages);
- addMultiplePersistenceXmlMessage(messages);
- addInvalidPersistenceXmlContentMessage(messages);
- addNoPersistenceUnitMessage(messages);
- addMultiplePersistenceUnitMessage(messages);
- }
-
- protected void addConnectionMessages(List<IMessage> messages) {
- addNoConnectionMessage(messages);
- addInactiveConnectionMessage(messages);
- }
-
- protected boolean okToProceedForConnectionValidation = true;
-
- protected void addNoConnectionMessage(List<IMessage> messages) {
- if (! jpaProject.dataSource().hasAConnection()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- IJpaValidationMessages.PROJECT_NO_CONNECTION,
- jpaProject)
- );
- okToProceedForConnectionValidation = false;
- }
- }
-
- protected void addInactiveConnectionMessage(List<IMessage> messages) {
- if (okToProceedForConnectionValidation && ! jpaProject.dataSource().isConnected()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- IJpaValidationMessages.PROJECT_INACTIVE_CONNECTION,
- new String[] {jpaProject.dataSource().getConnectionProfileName()},
- jpaProject)
- );
- }
- okToProceedForConnectionValidation = true;
- }
-
- protected void addNoPersistenceXmlMessage(List<IMessage> messages) {
- if (validPersistenceXmlFiles.isEmpty()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PROJECT_NO_PERSISTENCE_XML,
- jpaProject)
- );
- okToContinueValidation = false;
- }
- }
-
- protected void addMultiplePersistenceXmlMessage(List<IMessage> messages) {
- if (validPersistenceXmlFiles.size() > 1) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PROJECT_MULTIPLE_PERSISTENCE_XML,
- jpaProject)
- );
- okToContinueValidation = false;
- }
- }
-
- protected void addInvalidPersistenceXmlContentMessage(List<IMessage> messages) {
- if (validPersistenceXmlFiles.size() == 1) {
- IJpaFile persistenceXmlFile = validPersistenceXmlFiles.get(0);
- if (getPersistence(persistenceXmlFile) == null) {
- PersistenceXmlRootContentNode root =
- (PersistenceXmlRootContentNode) persistenceXmlFile.getContent();
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENCE_XML_INVALID_CONTENT,
- root, root.validationTextRange())
- );
- okToContinueValidation = false;
- }
- }
- }
-
- protected void addNoPersistenceUnitMessage(List<IMessage> messages) {
- if (okToContinueValidation && persistenceUnitContexts.size() == 0) {
- IJpaFile validPersistenceXml = validPersistenceXmlFiles.get(0);
- Persistence persistence = getPersistence(validPersistenceXml);
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENCE_NO_PERSISTENCE_UNIT,
- persistence, persistence.validationTextRange())
- );
- okToContinueValidation = false;
- }
- }
-
- protected void addMultiplePersistenceUnitMessage(List<IMessage> messages) {
- if (okToContinueValidation && persistenceUnitContexts.size() > 1) {
- IJpaFile validPersistenceXml = validPersistenceXmlFiles.get(0);
- Persistence persistence = getPersistence(validPersistenceXml);
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS,
- persistence, persistence.validationTextRange())
- );
- okToContinueValidation = false;
- }
- }
-
- protected void addOrphanedJavaClassMessages(List<IMessage> messages) {
- for (Iterator<JavaPersistentType> stream = jpaProject.javaPersistentTypes(); stream.hasNext(); ) {
- JavaPersistentType jpType = stream.next();
- if (jpType.getMappingKey() != IMappingKeys.NULL_TYPE_MAPPING_KEY && ! contains(jpType)) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENT_TYPE_UNSPECIFIED_CONTEXT,
- jpType.getMapping(), jpType.getMapping().validationTextRange())
- );
- }
- }
- }
-
- public String toString() {
- return StringTools.buildToStringFor( this, this.jpaProject.javaProject().getProject().getName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/ColumnContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/ColumnContext.java
deleted file mode 100644
index 6962951124..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/ColumnContext.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-
-public class ColumnContext extends BaseContext
-{
- private IColumn column;
-
- public ColumnContext(IContext parentContext, IColumn column) {
- super(parentContext);
- this.column = column;
- }
-
- @Override
- protected void initialize() {}
-
- public IColumn getColumn() {
- return this.column;
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- this.column.refreshDefaults(defaultsContext);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/DefaultsContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/DefaultsContext.java
deleted file mode 100644
index 985cb52495..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/DefaultsContext.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.platform;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IPersistentType;
-
-public interface DefaultsContext
-{
- /**
- * Return the default for the given key. Se BaseJpaPlatform
- * for the defaults supported by it.
- * @param key
- * @return
- */
- Object getDefault(String key);
-
- /**
- * Return the IPersistentType with the given name found in the scope
- * of the persistence unit
- * @param fullyQualifiedTypeName
- * @return
- */
- IPersistentType persistentType(String fullyQualifiedTypeName);
-
- /**
- * Return null in instances where the scope is not within a PersistentType.
- * Otherwise return the CompilationUnit for the persistentType so that we
- * don't have to build this everything. It is costly to build and resolve bindings.
- * @return
- */
- CompilationUnit astRoot();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GeneratorRepository.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GeneratorRepository.java
deleted file mode 100644
index e116ab9b2d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/GeneratorRepository.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import org.eclipse.jpt.core.internal.mappings.IGenerator;
-
-/**
- * For now we are not going to handle duplicates. The spec says that it is undefined
- * when you have multiple generators with the same name. A generator with the
- * same name in an orm.xml file overrides one in the java. Duplicates will just
- * be handled in a last in wins fashion.
- *
- * At some point we could handle duplicates that aren't overrides with a warning. It
- * is difficult to tell the difference between an override and a duplicate so
- * right now we are not handling it.
- */
-public class GeneratorRepository implements IGeneratorRepository
-{
-
- private Map<String, IGenerator> generators;
-
- public GeneratorRepository() {
- super();
- this.generators = new HashMap<String, IGenerator>();
- }
-
- /**
- * Add the given IGenerator to the Map of generators. If there is
- * already a generator with the given name it will be replaced in the map
- * by the new one.
- * @param generator
- */
- public void addGenerator(IGenerator generator) {
- this.generators.put(generator.getName(), generator);
- }
-
- public IGenerator generator(String name) {
- return this.generators.get(name);
- }
-
- public Iterator<String> generatorNames() {
- return this.generators.keySet().iterator();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/IContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/IContext.java
deleted file mode 100644
index b807b57793..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/IContext.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.IJpaPlatform;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public interface IContext
-{
- IJpaPlatform getPlatform();
-
- IContext getParentContext();
-
- void refreshDefaults(DefaultsContext defaults, IProgressMonitor monitor);
-
- void addToMessages(List<IMessage> messages);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/IGeneratorRepository.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/IGeneratorRepository.java
deleted file mode 100644
index c904fbb305..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/IGeneratorRepository.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.Iterator;
-import org.eclipse.jpt.core.internal.mappings.IGenerator;
-
-public interface IGeneratorRepository
-{
- /**
- * Return all generator names for this persistence unit.
- * 1 namespace per persistence unit for all generators in xml and java
- * @return
- */
- Iterator<String> generatorNames();
-
- /**
- * Return the Generator with the given name
- * @param name
- * @return
- */
- IGenerator generator(String name);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaAttributeContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaAttributeContext.java
deleted file mode 100644
index 5f5bf74723..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaAttributeContext.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public abstract class JavaAttributeContext extends BaseContext
-{
- protected IJavaAttributeMapping attributeMapping;
-
- public JavaAttributeContext(IContext parentContext, IJavaAttributeMapping javaAttributeMapping) {
- super(parentContext);
- this.attributeMapping = javaAttributeMapping;
- }
-
- @Override
- protected void initialize() {}
-
- protected void populateGeneratorRepository(GeneratorRepository generatorRepository) {
- //do nothing, override as necessary
- }
-
- protected PersistenceUnitContext persistenceUnitContext() {
- return (PersistenceUnitContext) persistentAttributeContext().javaTypeContext().getParentContext();
- }
-
- protected JavaPersistentAttributeContext persistentAttributeContext() {
- return (JavaPersistentAttributeContext) getParentContext();
- }
-
- protected boolean embeddableOwned() {
- return getMapping().typeMapping().getKey() == IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
- }
-
- protected boolean entityOwned() {
- return getMapping().typeMapping().getKey() == IMappingKeys.ENTITY_TYPE_MAPPING_KEY;
- }
-
- @Override
- public final void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- defaultsContext = wrapDefaultsContext(defaultsContext);
- refreshDefaultsInternal(defaultsContext, monitor);
- }
-
- protected void refreshDefaultsInternal(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- this.attributeMapping.refreshDefaults(defaultsContext);
- }
-
- protected IAttributeMapping getMapping() {
- return this.attributeMapping;
- }
-
- public final DefaultsContext wrapDefaultsContext(DefaultsContext defaultsContext) {
- return new DefaultsContextWrapper(defaultsContext) {
- public Object getDefault(String key) {
- return JavaAttributeContext.this.getDefault(key, getWrappedDefaultsContext());
- }
- };
- }
-
- protected Object getDefault(String key, DefaultsContext defaultsContext) {
- if (key.equals(BaseJpaPlatform.DEFAULT_COLUMN_NAME_KEY)) {
- return getMapping().getPersistentAttribute().getName();
- }
- return defaultsContext.getDefault(key);
- }
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- addModifierMessages(messages);
-
- addInvalidMappingMessage(messages);
- }
-
- protected void addModifierMessages(List<IMessage> messages) {
- JavaPersistentAttribute attribute =
- (JavaPersistentAttribute) attributeMapping.getPersistentAttribute();
- if (attribute.getMapping().getKey() != IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY
- && attribute.getAttribute().isField()) {
- int flags;
-
- try {
- flags = attribute.getAttribute().getJdtMember().getFlags();
- } catch (JavaModelException jme) {
- /* no error to log, in that case */
- return;
- }
-
- if (Flags.isFinal(flags)) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_FIELD,
- new String[] {attribute.getName()},
- attribute, attribute.validationTextRange())
- );
- }
-
- if (Flags.isPublic(flags)) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENT_ATTRIBUTE_PUBLIC_FIELD,
- new String[] {attribute.getName()},
- attribute, attribute.validationTextRange())
- );
-
- }
- }
- }
-
- protected void addInvalidMappingMessage(List<IMessage> messages) {
- IAttributeMapping attributeMapping = getMapping();
- ITypeMapping typeMapping = attributeMapping.typeMapping();
- if (! typeMapping.attributeMappingKeyAllowed(attributeMapping.getKey())) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_MAPPING,
- new String[] {attributeMapping.getPersistentAttribute().getName()},
- attributeMapping, attributeMapping.validationTextRange())
- );
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaBasicContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaBasicContext.java
deleted file mode 100644
index 13779984de..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaBasicContext.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class JavaBasicContext extends JavaAttributeContext
-{
- private ColumnContext columnContext;
-
- public JavaBasicContext(IContext parentContext, JavaBasic javaBasic) {
- super(parentContext, javaBasic);
- this.columnContext = new ColumnContext(this, javaBasic.getColumn());
- }
-
- protected JavaBasic getBasic() {
- return (JavaBasic) attributeMapping;
- }
-
- @Override
- protected void refreshDefaultsInternal(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaultsInternal(defaultsContext, monitor);
- this.columnContext.refreshDefaults(defaultsContext, monitor);
- }
-
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- addColumnMessages(messages);
- }
-
- protected void addColumnMessages(List<IMessage> messages) {
- JavaBasic basic = getBasic();
- ITypeMapping typeMapping = basic.typeMapping();
- IColumn column = basic.getColumn();
- String table = column.getTable();
- boolean doContinue = entityOwned() && column.isConnected();
-
- if (doContinue && typeMapping.tableNameIsInvalid(table)) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
- new String[] {table, column.getName()},
- column, column.tableTextRange())
- );
- doContinue = false;
- }
-
- if (doContinue && ! column.isResolved()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName()},
- column, column.nameTextRange())
- );
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEmbeddableContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEmbeddableContext.java
deleted file mode 100644
index 5a2500aafb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEmbeddableContext.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddable;
-
-public class JavaEmbeddableContext extends JavaTypeContext
-{
- public JavaEmbeddableContext(IContext parentContext, JavaEmbeddable mapping) {
- super(parentContext, mapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEmbeddedContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEmbeddedContext.java
deleted file mode 100644
index dbc7d7f8f0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEmbeddedContext.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeOverride;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbedded;
-import org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsFactory;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class JavaEmbeddedContext extends JavaAttributeContext
-{
- private Collection<AttributeOverrideContext> attributeOverrideContexts;
-
- public JavaEmbeddedContext(IContext parentContext, JavaEmbedded javaEmbedded) {
- super(parentContext, javaEmbedded);
- this.attributeOverrideContexts = buildAttributeOverrideContexts();
- }
-
- protected Collection<AttributeOverrideContext> buildAttributeOverrideContexts() {
- Collection<AttributeOverrideContext> contexts = new ArrayList<AttributeOverrideContext>();
- for (IAttributeOverride attributeOverride : getEmbedded().getAttributeOverrides()) {
- contexts.add(new AttributeOverrideContext(this, attributeOverride));
- }
-
- return contexts;
- }
-
- private IEmbedded getEmbedded() {
- return (IEmbedded) getMapping();
- }
-
- protected void refreshDefaultsInternal(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaultsInternal(defaultsContext, monitor);
- refreshDefaultAttributeOverrides();
- for (AttributeOverrideContext context : this.attributeOverrideContexts) {
- context.refreshDefaults(defaultsContext, monitor);
- }
- }
-
- protected void refreshDefaultAttributeOverrides() {
- for (Iterator<String> i = getEmbedded().allOverridableAttributeNames(); i.hasNext(); ) {
- String override = i.next();
- if (!getEmbedded().containsAttributeOverride(override)) {
- JavaAttributeOverride attributeOverride = JpaJavaMappingsFactory.eINSTANCE.createJavaAttributeOverride(new IEmbedded.AttributeOverrideOwner(getEmbedded()), getEmbedded().getPersistentAttribute().getAttribute());
- getEmbedded().getDefaultAttributeOverrides().add(attributeOverride);
- attributeOverride.setName(override);
- }
- }
-
- Collection<String> attributeNames = CollectionTools.collection(getEmbedded().allOverridableAttributeNames());
-
- //remove any default mappings that are not included in the attributeNames collection
- Collection<IAttributeOverride> overridesToRemove = new ArrayList<IAttributeOverride>();
- for (IAttributeOverride attributeOverride : getEmbedded().getDefaultAttributeOverrides()) {
- if (!attributeNames.contains(attributeOverride.getName())
- || getEmbedded().containsSpecifiedAttributeOverride(attributeOverride.getName())) {
- overridesToRemove.add(attributeOverride);
- }
- }
-
- getEmbedded().getDefaultAttributeOverrides().removeAll(overridesToRemove);
- }
-
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- for (AttributeOverrideContext aoContext : attributeOverrideContexts) {
- aoContext.addToMessages(messages);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEmbeddedIdContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEmbeddedIdContext.java
deleted file mode 100644
index 99be7d12fd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEmbeddedIdContext.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbeddedId;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class JavaEmbeddedIdContext extends JavaAttributeContext
-{
- public JavaEmbeddedIdContext(IContext parentContext, JavaEmbeddedId javaEmbeddedId) {
- super(parentContext, javaEmbeddedId);
- }
-
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEntityContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEntityContext.java
deleted file mode 100644
index 571d1e80c6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEntityContext.java
+++ /dev/null
@@ -1,307 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.platform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaAssociationOverride;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaAttributeOverride;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity;
-import org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsFactory;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class JavaEntityContext extends JavaTypeContext
-{
- private TableContext tableContext;
-
- private Collection<SecondaryTableContext> secondaryTableContexts;
-
- private Collection<AttributeOverrideContext> attributeOverrideContexts;
-
- private Collection<AssociationOverrideContext> associationOverrideContexts;
-
- private Collection<PrimaryKeyJoinColumnContext> pkJoinColumnContexts;
-
- public JavaEntityContext(IContext parentContext, JavaEntity javaEntity) {
- super(parentContext, javaEntity);
- this.tableContext = buildTableContext(javaEntity);
- this.attributeOverrideContexts = buildAttributeOverrideContexts();
- this.associationOverrideContexts = buildAssociationOverrideContexts();
- this.secondaryTableContexts = buildSecondaryTableContexts();
- this.pkJoinColumnContexts = buildPkJoinColumnContexts();
- }
-
- protected JavaEntity getEntity() {
- return (JavaEntity) getTypeMapping();
- }
-
- protected TableContext buildTableContext(JavaEntity javaEntity) {
- return new TableContext(this, javaEntity.getTable());
- }
-
- protected Collection<AttributeOverrideContext> buildAttributeOverrideContexts() {
- Collection<AttributeOverrideContext> contexts = new ArrayList<AttributeOverrideContext>();
- for (IAttributeOverride attributeOverride : getEntity().getAttributeOverrides()) {
- contexts.add(new AttributeOverrideContext(this, attributeOverride));
- }
-
- return contexts;
- }
-
- //only support default joinColumn information for the default association overrides,
- //AssociationOverride has no defaults, the name and joinColumns must be specified
- protected Collection<AssociationOverrideContext> buildAssociationOverrideContexts() {
- Collection<AssociationOverrideContext> contexts = new ArrayList<AssociationOverrideContext>();
- for (IAssociationOverride associationOverride : getEntity().getDefaultAssociationOverrides()) {
- contexts.add(new AssociationOverrideContext(this, associationOverride));
- }
-
- return contexts;
- }
-
- protected Collection<SecondaryTableContext> buildSecondaryTableContexts() {
- Collection<SecondaryTableContext> contexts = new ArrayList<SecondaryTableContext>();
- for (ISecondaryTable secondaryTable : getEntity().getSecondaryTables()) {
- contexts.add(new SecondaryTableContext(this, secondaryTable));
- }
-
- return contexts;
- }
-
- protected Collection<PrimaryKeyJoinColumnContext> buildPkJoinColumnContexts() {
- Collection<PrimaryKeyJoinColumnContext> contexts = new ArrayList<PrimaryKeyJoinColumnContext>();
- for (IPrimaryKeyJoinColumn pkJoinColumn : getEntity().getPrimaryKeyJoinColumns()) {
- contexts.add(new PrimaryKeyJoinColumnContext(this, pkJoinColumn));
- }
-
- return contexts;
- }
-
- /**
- * Mappings files will populate the generator repository after Java files.
- * This will cause the mapping files to override any generators with the same name
- * in the java
- */
- protected void populateGeneratorRepository(GeneratorRepository generatorRepository) {
- super.populateGeneratorRepository(generatorRepository);
- ITableGenerator tableGenerator = getEntity().getTableGenerator();
- if (tableGenerator != null) {
- generatorRepository.addGenerator(tableGenerator);
- }
- ISequenceGenerator sequenceGenerator = getEntity().getSequenceGenerator();
- if (sequenceGenerator != null) {
- generatorRepository.addGenerator(sequenceGenerator);
- }
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- defaultsContext = wrapDefaultsContext(defaultsContext);
-
- if (this.tableContext != null) {
- this.tableContext.refreshDefaults(defaultsContext, monitor);
- }
- //refresh table defaults before attribute mapping defaults, since column mapping
- //defaults depend on table defaults
- super.refreshDefaults(defaultsContext, monitor);
- refreshDefaultAttributeOverrides();
- refreshDefaultAssociationOverrides();
- for (SecondaryTableContext context : this.secondaryTableContexts) {
- context.refreshDefaults(defaultsContext, monitor);
- }
- for (AttributeOverrideContext context : this.attributeOverrideContexts) {
- context.refreshDefaults(defaultsContext, monitor);
- }
- for (AssociationOverrideContext context : this.associationOverrideContexts) {
- context.refreshDefaults(defaultsContext, monitor);
- }
- for (PrimaryKeyJoinColumnContext context : this.pkJoinColumnContexts) {
- context.refreshDefaults(defaultsContext, monitor);
- }
- }
-
- //TODO the relationship between this class and JavaTypeContext is very confused
- //we end up wrapping the defaults context multiple times. Maybe we should
- //make this more like JavaAttributeContext. or maybe we need a JavaPersistentTypeContext
- //I tried to minimize the change so as not to break the defaults calculations
- private DefaultsContext wrapDefaultsContext(final DefaultsContext defaultsContext) {
- DefaultsContext wrappedDefaultsContext = new DefaultsContext() {
- public Object getDefault(String key) {
- if (key.equals(BaseJpaPlatform.DEFAULT_TABLE_NAME_KEY)) {
- if (getEntity().rootEntity().getInheritanceStrategy().isSingleTable()) {
- IEntity rootEntity = getEntity().rootEntity();
- if (rootEntity == getEntity()) {
- return rootEntity.getName();
- }
- return rootEntity.getTable().getName();
- }
- return getEntity().getName();
- }
- return defaultsContext.getDefault(key);
- }
-
- public IPersistentType persistentType(String fullyQualifiedTypeName) {
- return defaultsContext.persistentType(fullyQualifiedTypeName);
- }
- public CompilationUnit astRoot() {
- return getAstRoot();
- }
- };
- if (this.tableContext != null) {
- return this.tableContext.wrapDefaultsContext(wrappedDefaultsContext);
- }
- return wrappedDefaultsContext;
- }
-
- protected void refreshDefaultAttributeOverrides() {
- for (Iterator<String> i = getEntity().allOverridableAttributeNames(); i.hasNext(); ) {
- String override = i.next();
- if (!getEntity().containsAttributeOverride(override)) {
- JavaAttributeOverride attributeOverride = JpaJavaMappingsFactory.eINSTANCE.createJavaAttributeOverride(new IEntity.AttributeOverrideOwner(getEntity()), getEntity().getType());
- getEntity().getDefaultAttributeOverrides().add(attributeOverride);
- attributeOverride.setName(override);
- }
-
- }
-
- Collection<String> attributeNames = CollectionTools.collection(getEntity().allOverridableAttributeNames());
-
- //remove any default mappings that are not included in the attributeNames collection
- Collection<IAttributeOverride> overridesToRemove = new ArrayList<IAttributeOverride>();
- for (IAttributeOverride attributeOverride : getEntity().getDefaultAttributeOverrides()) {
- if (!attributeNames.contains(attributeOverride.getName())
- || getEntity().containsSpecifiedAttributeOverride(attributeOverride.getName())) {
- overridesToRemove.add(attributeOverride);
- }
- }
-
- getEntity().getDefaultAttributeOverrides().removeAll(overridesToRemove);
- }
-
- protected void refreshDefaultAssociationOverrides() {
- for (Iterator<String> i = getEntity().allOverridableAssociationNames(); i.hasNext(); ) {
- String override = i.next();
- if (!getEntity().containsAssociationOverride(override)) {
- JavaAssociationOverride associationOverride = JpaJavaMappingsFactory.eINSTANCE.createJavaAssociationOverride(new IEntity.AssociationOverrideOwner(getEntity()), getEntity().getType());
- getEntity().getDefaultAssociationOverrides().add(associationOverride);
- associationOverride.setName(override);
- }
-
- }
-
- Collection<String> attributeNames = CollectionTools.collection(getEntity().allOverridableAssociationNames());
-
- //remove any default mappings that are not included in the attributeNames collection
- Collection<IAssociationOverride> overridesToRemove = new ArrayList<IAssociationOverride>();
- for (IAssociationOverride associationOverride : getEntity().getDefaultAssociationOverrides()) {
- if (!attributeNames.contains(associationOverride.getName())
- || getEntity().containsSpecifiedAssociationOverride(associationOverride.getName())) {
- overridesToRemove.add(associationOverride);
- }
- }
-
- getEntity().getDefaultAssociationOverrides().removeAll(overridesToRemove);
- }
-
-
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
- addTableMessages(messages);
- addIdMessages(messages);
-
- for (SecondaryTableContext context : secondaryTableContexts) {
- context.addToMessages(messages);
- }
-
- for (AttributeOverrideContext aoContext : attributeOverrideContexts) {
- aoContext.addToMessages(messages);
- }
-
- for (AssociationOverrideContext aoContext : associationOverrideContexts) {
- aoContext.addToMessages(messages);
- }
- }
-
- protected void addTableMessages(List<IMessage> messages) {
- ITable table = getEntity().getTable();
- boolean doContinue = table.isConnected();
- String schema = table.getSchema();
-
- if (doContinue && ! table.hasResolvedSchema()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.TABLE_UNRESOLVED_SCHEMA,
- new String[] {schema, table.getName()},
- table, table.schemaTextRange())
- );
- doContinue = false;
- }
-
- if (doContinue && ! table.isResolved()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.TABLE_UNRESOLVED_NAME,
- new String[] {table.getName()},
- table, table.nameTextRange())
- );
- }
- }
-
- protected void addIdMessages(List<IMessage> messages) {
- addNoIdMessage(messages);
-
- }
-
- protected void addNoIdMessage(List<IMessage> messages) {
- IEntity entity = getEntity();
- if (entityHasNoId()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.ENTITY_NO_ID,
- new String[] {entity.getName()},
- entity, entity.validationTextRange())
- );
- }
- }
-
- private boolean entityHasNoId() {
- return ! this.entityHasId();
- }
-
- private boolean entityHasId() {
- for (Iterator<IPersistentAttribute> stream = this.getEntity().getPersistentType().allAttributes(); stream.hasNext(); ) {
- if (stream.next().isIdAttribute()) {
- return true;
- }
- }
- return false;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaIdContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaIdContext.java
deleted file mode 100644
index c5ac1c4860..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaIdContext.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaId;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
-import org.eclipse.jpt.core.internal.mappings.IGenerator;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class JavaIdContext extends JavaAttributeContext
-{
- private ColumnContext columnContext;
-
- public JavaIdContext(IContext parentContext, JavaId javaId) {
- super(parentContext, javaId);
- this.columnContext = new ColumnContext(this, javaId.getColumn());
- }
-
- protected JavaId getId() {
- return (JavaId) attributeMapping;
- }
-
- protected void populateGeneratorRepository(GeneratorRepository generatorRepository) {
- ITableGenerator tableGenerator = getId().getTableGenerator();
- if (tableGenerator != null) {
- generatorRepository.addGenerator(tableGenerator);
- }
- ISequenceGenerator sequenceGenerator = getId().getSequenceGenerator();
- if (sequenceGenerator != null) {
- generatorRepository.addGenerator(sequenceGenerator);
- }
- }
-
- @Override
- protected void refreshDefaultsInternal(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaultsInternal(defaultsContext, monitor);
- this.columnContext.refreshDefaults(defaultsContext, monitor);
- ITableGenerator tableGenerator = getId().getTableGenerator();
- if (tableGenerator != null) {
- tableGenerator.refreshDefaults(defaultsContext);
- }
- }
-
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- addColumnMessages(messages);
- addGeneratorMessages(messages);
- }
-
- protected void addColumnMessages(List<IMessage> messages) {
- JavaId id = getId();
- ITypeMapping typeMapping = id.typeMapping();
- IColumn column = id.getColumn();
- String table = column.getTable();
- boolean doContinue = entityOwned() && column.isConnected();
-
- if (doContinue && typeMapping.tableNameIsInvalid(table)) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
- new String[] {table, column.getName()},
- column, column.tableTextRange())
- );
- doContinue = false;
- }
-
- if (doContinue && ! column.isResolved()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName()},
- column, column.nameTextRange())
- );
- }
- }
-
- protected void addGeneratorMessages(List<IMessage> messages) {
- JavaId id = getId();
- IGeneratedValue generatedValue = id.getGeneratedValue();
- if (generatedValue == null) {
- return;
- }
- String generatorName = generatedValue.getGenerator();
- if (generatorName == null) {
- return;
- }
- IGeneratorRepository generatorRepository = persistenceUnitContext().getGeneratorRepository();
- IGenerator generator = generatorRepository.generator(generatorName);
-
- if (generator == null) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.GENERATED_VALUE_UNRESOLVED_GENERATOR,
- new String[] {generatorName},
- generatedValue, generatedValue.generatorTextRange())
- );
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaManyToManyContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaManyToManyContext.java
deleted file mode 100644
index 14849d2dc1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaManyToManyContext.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToMany;
-
-public class JavaManyToManyContext extends JavaMultiRelationshipMappingContext
-{
- public JavaManyToManyContext(IContext parentContext, JavaManyToMany javaManyToMany) {
- super(parentContext, javaManyToMany);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaManyToOneContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaManyToOneContext.java
deleted file mode 100644
index 828ecaee82..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaManyToOneContext.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaManyToOne;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class JavaManyToOneContext extends JavaSingleRelationshipMappingContext
-{
- public JavaManyToOneContext(IContext parentContext, JavaManyToOne javaManyToOne) {
- super(parentContext, javaManyToOne);
- }
-
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
- }
-
- //ManyToOne mapping is always the owning side
- protected boolean isOwningSide() {
- return true;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaMappedSuperclassContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaMappedSuperclassContext.java
deleted file mode 100644
index 3943b474ab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaMappedSuperclassContext.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaMappedSuperclass;
-
-public class JavaMappedSuperclassContext extends JavaTypeContext
-{
- public JavaMappedSuperclassContext(IContext parentContext, JavaMappedSuperclass mapping) {
- super(parentContext, mapping);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaMultiRelationshipMappingContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaMultiRelationshipMappingContext.java
deleted file mode 100644
index 01545a8fb6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaMultiRelationshipMappingContext.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.INonOwningMapping;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public abstract class JavaMultiRelationshipMappingContext extends JavaRelationshipMappingContext
-{
- private JoinTableContext joinTableContext;
-
- protected JavaMultiRelationshipMappingContext(
- IContext parentContext, JavaMultiRelationshipMapping mapping) {
- super(parentContext, mapping);
- this.joinTableContext = new JoinTableContext(this, mapping.getJoinTable());
- }
-
- @Override
- protected void refreshDefaultsInternal(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaultsInternal(defaultsContext, monitor);
- this.joinTableContext.refreshDefaults(defaultsContext, monitor);
- }
-
- protected JavaMultiRelationshipMapping getMapping() {
- return (JavaMultiRelationshipMapping) super.getMapping();
- }
-
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
- JavaMultiRelationshipMapping mapping = getMapping();
-
- if (mapping.isJoinTableSpecified()) {
- addJoinTableMessages(messages);
- }
- if (mapping.getMappedBy() != null) {
- addMappedByMessages(messages);
- }
- }
-
- protected void addJoinTableMessages(List<IMessage> messages) {
- JavaMultiRelationshipMapping mapping = getMapping();
- IJoinTable joinTable = mapping.getJoinTable();
-
- boolean doContinue = joinTable.isConnected();
- String schema = joinTable.getSchema();
-
- if (doContinue && ! joinTable.hasResolvedSchema()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_TABLE_UNRESOLVED_SCHEMA,
- new String[] {schema, joinTable.getName()},
- joinTable, joinTable.schemaTextRange())
- );
- doContinue = false;
- }
-
- if (doContinue && ! joinTable.isResolved()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_TABLE_UNRESOLVED_NAME,
- new String[] {joinTable.getName()},
- joinTable, joinTable.nameTextRange())
- );
- doContinue = false;
- }
-
- for (Iterator<IJoinColumn> stream = joinTable.getJoinColumns().iterator(); stream.hasNext(); ) {
- IJoinColumn joinColumn = stream.next();
-
- if (doContinue && ! joinColumn.isResolved()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getName()},
- joinColumn, joinColumn.nameTextRange())
- );
- }
-
- if (doContinue && ! joinColumn.isReferencedColumnResolved()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getReferencedColumnName(), joinColumn.getName()},
- joinColumn, joinColumn.referencedColumnNameTextRange())
- );
- }
- }
-
- for (Iterator<IJoinColumn> stream = joinTable.getInverseJoinColumns().iterator(); stream.hasNext(); ) {
- IJoinColumn joinColumn = stream.next();
-
- if (doContinue && ! joinColumn.isResolved()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getName()},
- joinColumn, joinColumn.nameTextRange())
- );
- }
-
- if (doContinue && ! joinColumn.isReferencedColumnResolved()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getReferencedColumnName(), joinColumn.getName()},
- joinColumn, joinColumn.referencedColumnNameTextRange())
- );
- }
- }
- }
-
- protected void addMappedByMessages(List<IMessage> messages) {
- JavaMultiRelationshipMapping mapping = getMapping();
- String mappedBy = mapping.getMappedBy();
-
- if (mapping.isJoinTableSpecified()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.MAPPING_MAPPED_BY_WITH_JOIN_TABLE,
- mapping.getJoinTable(), mapping.getJoinTable().validationTextRange())
- );
-
- }
-
- IEntity targetEntity = mapping.getResolvedTargetEntity();
-
- if (targetEntity == null) {
- // already have validation messages for that
- return;
- }
-
- IPersistentAttribute attribute = targetEntity.getPersistentType().resolveAttribute(mappedBy);
-
- if (attribute == null) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.MAPPING_UNRESOLVED_MAPPED_BY,
- new String[] {mappedBy},
- mapping, mapping.mappedByTextRange())
- );
- return;
- }
-
- if (! mapping.mappedByIsValid(attribute.getMapping())) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.MAPPING_INVALID_MAPPED_BY,
- new String[] {mappedBy},
- mapping, mapping.mappedByTextRange())
- );
- return;
- }
-
- INonOwningMapping mappedByMapping;
- try {
- mappedByMapping = (INonOwningMapping) attribute.getMapping();
- } catch (ClassCastException cce) {
- // there is no error then
- return;
- }
-
- if (mappedByMapping.getMappedBy() != null) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.MAPPING_MAPPED_BY_ON_BOTH_SIDES,
- mapping, mapping.mappedByTextRange())
- );
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaNullAttributeMappingContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaNullAttributeMappingContext.java
deleted file mode 100644
index 36c85345bc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaNullAttributeMappingContext.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaNullAttributeMapping;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class JavaNullAttributeMappingContext extends JavaAttributeContext
-{
- public JavaNullAttributeMappingContext(
- IContext parentContext, JavaNullAttributeMapping javaNullAttributeMapping) {
- super(parentContext, javaNullAttributeMapping);
- }
-
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaNullTypeMappingContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaNullTypeMappingContext.java
deleted file mode 100644
index 93d371fb43..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaNullTypeMappingContext.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaNullTypeMapping;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class JavaNullTypeMappingContext extends JavaTypeContext
-{
- public JavaNullTypeMappingContext(IContext parentContext, JavaNullTypeMapping mapping) {
- super(parentContext, mapping);
- }
-
- public void addToMessages(List<IMessage> messages) {
- // no-op, nothing to really add
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaOneToManyContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaOneToManyContext.java
deleted file mode 100644
index 603d50f56e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaOneToManyContext.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToMany;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class JavaOneToManyContext extends JavaMultiRelationshipMappingContext
-{
- public JavaOneToManyContext(IContext parentContext, JavaOneToMany javaOneToMany) {
- super(parentContext, javaOneToMany);
- }
-
- @Override
- protected void addJoinTableMessages(List<IMessage> messages) {
- // TODO
- // a 1-M doesn't *have* to have a join table
- return;
-
- //super.addJoinTableMessages(messages);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaOneToOneContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaOneToOneContext.java
deleted file mode 100644
index ab3a6c2674..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaOneToOneContext.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaOneToOne;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.INonOwningMapping;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class JavaOneToOneContext extends JavaSingleRelationshipMappingContext
-{
- public JavaOneToOneContext(IContext parentContext, JavaOneToOne javaOneToOne) {
- super(parentContext, javaOneToOne);
- }
-
- protected JavaOneToOne getMapping() {
- return (JavaOneToOne) super.getMapping();
- }
-
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- if (getMapping().getMappedBy() != null) {
- addMappedByMessages(messages);
- }
- }
-
- protected void addMappedByMessages(List<IMessage> messages) {
- JavaOneToOne mapping = getMapping();
- String mappedBy = mapping.getMappedBy();
- IEntity targetEntity = mapping.getResolvedTargetEntity();
-
- if (targetEntity == null) {
- // already have validation messages for that
- return;
- }
-
- IPersistentAttribute attribute = targetEntity.getPersistentType().resolveAttribute(mappedBy);
-
- if (attribute == null) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.MAPPING_UNRESOLVED_MAPPED_BY,
- new String[] {mappedBy},
- mapping, mapping.mappedByTextRange())
- );
- return;
- }
-
- if (! mapping.mappedByIsValid(attribute.getMapping())) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.MAPPING_INVALID_MAPPED_BY,
- new String[] {mappedBy},
- mapping, mapping.mappedByTextRange())
- );
- return;
- }
-
- INonOwningMapping mappedByMapping;
- try {
- mappedByMapping = (INonOwningMapping) attribute.getMapping();
- } catch (ClassCastException cce) {
- // there is no error then
- return;
- }
-
- if (mappedByMapping.getMappedBy() != null) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.MAPPING_MAPPED_BY_ON_BOTH_SIDES,
- mapping, mapping.mappedByTextRange())
- );
- }
- }
-
- @Override
- protected boolean isOwningSide() {
- return getMapping().getMappedBy() == null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaPersistentAttributeContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaPersistentAttributeContext.java
deleted file mode 100644
index b537737b56..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaPersistentAttributeContext.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.content.java.IJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class JavaPersistentAttributeContext extends BaseContext
-{
- private JavaPersistentAttribute javaPersistentAttribute;
-
- private JavaAttributeContext javaAttributeMappingContext;
-
- private JavaAttributeContext defaultJavaAttributeMappingContext;
-
- public JavaPersistentAttributeContext(IContext parentContext, JavaPersistentAttribute javaPersistentAttribute) {
- super(parentContext);
- this.javaPersistentAttribute = javaPersistentAttribute;
- this.javaAttributeMappingContext = buildJavaAttributeMappingContext();
- }
-
- protected JavaTypeContext javaTypeContext() {
- return (JavaTypeContext) getParentContext();
- }
-
- protected JavaAttributeContext buildJavaAttributeMappingContext() {
- IJavaAttributeMapping javaAttributeMapping = this.javaPersistentAttribute.getSpecifiedMapping();
- if (javaAttributeMapping != null) {
- return (JavaAttributeContext) getPlatform().buildJavaAttributeContext(this,javaAttributeMapping );
- }
- return null;
- }
-
- @Override
- protected void initialize() {}
-
- protected void populateGeneratorRepository(GeneratorRepository generatorRepository) {
- if (this.javaAttributeMappingContext != null) {
- this.javaAttributeMappingContext.populateGeneratorRepository(generatorRepository);
- }
- }
-
- protected boolean embeddableOwned() {
- return getPersistentAttribute().typeMapping().getKey() == IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
- }
-
- protected boolean entityOwned() {
- return getPersistentAttribute().typeMapping().getKey() == IMappingKeys.ENTITY_TYPE_MAPPING_KEY;
- }
-
- @Override
- public final void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- defaultsContext = wrapDefaultsContext(defaultsContext);
- refreshDefaultsInternal(defaultsContext, monitor);
- }
-
- protected void refreshDefaultsInternal(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- this.javaPersistentAttribute.refreshDefaults(defaultsContext);
-
- if (this.javaAttributeMappingContext != null) {
- this.javaAttributeMappingContext.refreshDefaults(defaultsContext, monitor);
- this.defaultJavaAttributeMappingContext = null;
- }
- else {
- IJavaAttributeMapping javaAttributeMapping = this.javaPersistentAttribute.getDefaultMapping();
- if (javaAttributeMapping != null) {
- this.defaultJavaAttributeMappingContext = (JavaAttributeContext) getPlatform().buildJavaAttributeContext(this, javaAttributeMapping);
- this.defaultJavaAttributeMappingContext.refreshDefaults(defaultsContext, monitor);
- }
- }
- }
-
- protected JavaPersistentAttribute getPersistentAttribute() {
- return this.javaPersistentAttribute;
- }
-
- public final DefaultsContext wrapDefaultsContext(DefaultsContext defaultsContext) {
- return new DefaultsContextWrapper(defaultsContext) {
- public Object getDefault(String key) {
- return JavaPersistentAttributeContext.this.getDefault(key, getWrappedDefaultsContext());
- }
- };
- }
-
- protected Object getDefault(String key, DefaultsContext defaultsContext) {
- if (key.equals(BaseJpaPlatform.DEFAULT_COLUMN_NAME_KEY)) {
- return getPersistentAttribute().getName();
- }
- return defaultsContext.getDefault(key);
- }
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
- if (this.javaAttributeMappingContext != null) {
- this.javaAttributeMappingContext.addToMessages(messages);
- }
- else if (this.defaultJavaAttributeMappingContext != null) {
- this.defaultJavaAttributeMappingContext.addToMessages(messages);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaRelationshipMappingContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaRelationshipMappingContext.java
deleted file mode 100644
index 816ea4eb93..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaRelationshipMappingContext.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-
-public abstract class JavaRelationshipMappingContext extends JavaAttributeContext
-{
- protected JavaRelationshipMappingContext(IContext parentContext, JavaRelationshipMapping mapping) {
- super(parentContext, mapping);
- }
-
- protected IRelationshipMapping getMapping() {
- return (IRelationshipMapping) super.getMapping();
- }
-
- @Override
- protected Object getDefault(String key, DefaultsContext defaultsContext) {
- if (key.equals(BaseJpaPlatform.DEFAULT_TARGET_ENTITY_KEY)) {
- return getMapping().fullyQualifiedTargetEntity(defaultsContext.astRoot());
- }
- return super.getDefault(key, defaultsContext);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaSingleRelationshipMappingContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaSingleRelationshipMappingContext.java
deleted file mode 100644
index d9fed1484d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaSingleRelationshipMappingContext.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaSingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public abstract class JavaSingleRelationshipMappingContext
- extends JavaRelationshipMappingContext
-{
- private Collection<JoinColumnContext> joinColumnContexts;
-
- protected JavaSingleRelationshipMappingContext(
- IContext parentContext, JavaSingleRelationshipMapping mapping) {
- super(parentContext, mapping);
- this.joinColumnContexts = buildJoinColumnContexts();
- }
-
- protected Collection<JoinColumnContext> buildJoinColumnContexts() {
- Collection<JoinColumnContext> contexts = new ArrayList<JoinColumnContext>();
- for (Iterator i = getMapping().getJoinColumns().iterator(); i.hasNext(); ) {
- IJoinColumn column = (IJoinColumn) i.next();
- contexts.add(new JoinColumnContext(this, column));
- }
- return contexts;
- }
-
- protected ISingleRelationshipMapping getMapping() {
- return (ISingleRelationshipMapping) super.getMapping();
- }
-
- protected ITable getTable() {
- IEntity entity = getMapping().getEntity();
- if (entity == null) {
- return null;
- }
- return entity.getTable();
- }
-
- @Override
- protected void refreshDefaultsInternal(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaultsInternal(defaultsContext, monitor);
- DefaultsContext joinColumnsDefaultsContext = wrapDefaultsContextForJoinColumn(defaultsContext);
- for (JoinColumnContext context : this.joinColumnContexts) {
- context.refreshDefaults(joinColumnsDefaultsContext, monitor);
- }
- }
-
- protected DefaultsContext wrapDefaultsContextForJoinColumn(DefaultsContext defaultsContext) {
- return new DefaultsContextWrapper(defaultsContext) {
- public Object getDefault(String key) {
- if (key.equals(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_TABLE_KEY)) {
- ITable table = getTable();
- if (table == null) {
- return null;
- }
- return table.getName();
- }
- return super.getDefault(key);
- }
- };
- }
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- //bug 192287 - do not want joinColumn validation errors on the non-owning side
- //of a bidirectional relationship. This is a low risk fix for RC3, but a better
- //solution would be to not have the default joinColumns on the non-owning side.
- //This would fix another bug that we show default joinColumns in this situation.
- if (entityOwned() && isOwningSide()) {
- addJoinColumnMessages(messages);
- }
- }
-
- protected abstract boolean isOwningSide();
-
- protected void addJoinColumnMessages(List<IMessage> messages) {
- ISingleRelationshipMapping mapping = getMapping();
- ITypeMapping typeMapping = mapping.typeMapping();
-
- for (IJoinColumn joinColumn : mapping.getJoinColumns()) {
- String table = joinColumn.getTable();
- boolean doContinue = joinColumn.isConnected();
-
- if (doContinue && typeMapping.tableNameIsInvalid(table)) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_COLUMN_UNRESOLVED_TABLE,
- new String[] {table, joinColumn.getName()},
- joinColumn, joinColumn.tableTextRange())
- );
- doContinue = false;
- }
-
- if (doContinue && ! joinColumn.isResolved()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getName()},
- joinColumn, joinColumn.nameTextRange())
- );
- }
-
- if (doContinue && ! joinColumn.isReferencedColumnResolved()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getReferencedColumnName(), joinColumn.getName()},
- joinColumn, joinColumn.referencedColumnNameTextRange())
- );
- }
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaTypeContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaTypeContext.java
deleted file mode 100644
index 4d91450b43..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaTypeContext.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentType;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public abstract class JavaTypeContext extends BaseContext
- implements TypeContext
-{
- private IJavaTypeMapping typeMapping;
-
- private Collection<JavaPersistentAttributeContext> javaPersistentAttributeContexts;
-
- private boolean refreshed;
-
- private CompilationUnit astRoot;
-
- public JavaTypeContext(IContext parentContext, IJavaTypeMapping typeMapping) {
- super(parentContext);
- this.typeMapping = typeMapping;
- this.javaPersistentAttributeContexts = buildJavaPersistentAttributeContexts();
- }
-
- protected Collection<JavaPersistentAttributeContext> buildJavaPersistentAttributeContexts() {
- Collection<JavaPersistentAttributeContext> persistentAttributes = new ArrayList<JavaPersistentAttributeContext>();
- for (Iterator<JavaPersistentAttribute> i = getPersistentType().getAttributes().iterator(); i.hasNext(); ) {
- persistentAttributes.add(new JavaPersistentAttributeContext(this, i.next()));
- }
-
- return persistentAttributes;
- }
-
-
- @Override
- protected void initialize() {}
-
- protected void populateGeneratorRepository(GeneratorRepository generatorRepository) {
- for (JavaPersistentAttributeContext context : getJavaPersistentAttributeContexts()) {
- context.populateGeneratorRepository(generatorRepository);
- }
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- this.refreshed = true;
- DefaultsContext wrappedDefaultsContext = wrapDefaultsContext(defaultsContext);
- this.getPersistentType().refreshDefaults(wrappedDefaultsContext);
- for (JavaPersistentAttributeContext context : this.javaPersistentAttributeContexts) {
- checkCanceled(monitor);
- context.refreshDefaults(wrappedDefaultsContext, monitor);
- }
- }
-
- private void checkCanceled(IProgressMonitor monitor) {
- if (monitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- }
-
- private DefaultsContext wrapDefaultsContext(DefaultsContext defaultsContext) {
- return new DefaultsContextWrapper(defaultsContext) {
- @Override
- public CompilationUnit astRoot() {
- return JavaTypeContext.this.getAstRoot();
- }
- };
- }
-
- protected CompilationUnit getAstRoot() {
- if (this.astRoot == null) {
- this.astRoot = getPersistentType().getType().astRoot();
- }
- return this.astRoot;
-
- }
-
- public JavaPersistentType getPersistentType() {
- return (JavaPersistentType) typeMapping.getPersistentType();
- }
-
- protected IJavaTypeMapping getTypeMapping() {
- return typeMapping;
- }
-
- protected Collection<JavaPersistentAttributeContext> getJavaPersistentAttributeContexts() {
- return this.javaPersistentAttributeContexts;
- }
-
- public boolean isRefreshed() {
- return this.refreshed;
- }
-
- public boolean contains(IPersistentType persistentType) {
- return persistentType == getPersistentType();
- }
-
- public void addToMessages(List<IMessage> messages) {
- addAttributeMessages(messages);
- }
-
- protected void addAttributeMessages(List<IMessage> messages) {
- for (JavaPersistentAttributeContext attributeContext : javaPersistentAttributeContexts) {
- attributeContext.addToMessages(messages);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaVersionContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaVersionContext.java
deleted file mode 100644
index ae2959c513..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaVersionContext.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaVersion;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class JavaVersionContext extends JavaAttributeContext
-{
- private ColumnContext columnContext;
-
- public JavaVersionContext(IContext parentContext, JavaVersion javaVersion) {
- super(parentContext, javaVersion);
- this.columnContext = new ColumnContext(this, javaVersion.getColumn());
- }
-
- protected JavaVersion version() {
- return (JavaVersion) attributeMapping;
- }
-
- @Override
- protected void refreshDefaultsInternal(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaultsInternal(defaultsContext, monitor);
- this.columnContext.refreshDefaults(defaultsContext, monitor);
- }
-
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- addColumnMessages(messages);
- }
-
- protected void addColumnMessages(List<IMessage> messages) {
- JavaVersion version = version();
- ITypeMapping typeMapping = version.typeMapping();
- IColumn column = version.getColumn();
- String table = column.getTable();
- boolean doContinue = entityOwned() && column.isConnected();
-
- if (doContinue && typeMapping.tableNameIsInvalid(table)) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
- new String[] {table, column.getName()},
- column, column.tableTextRange())
- );
- doContinue = false;
- }
-
- if (doContinue && ! column.isResolved()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName()},
- column, column.nameTextRange())
- );
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JoinColumnContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JoinColumnContext.java
deleted file mode 100644
index 0d9a3168cd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JoinColumnContext.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.jpt.core.internal.content.orm.XmlRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class JoinColumnContext extends AbstractJoinColumnContext<IJoinColumn>
-{
- public JoinColumnContext(IContext parentContext, IJoinColumn column) {
- super(parentContext, column);
- }
-
- /**
- * return the join column's default name;
- * which is typically &lt;attribute name&gt;_&lt;referenced column name&gt;
- * but, if we don't have an attribute name (e.g. in a unidirectional
- * OneToMany or ManyToMany) is
- * &lt;target entity name&gt;_&lt;referenced column name&gt;
- */
- // <attribute name>_<referenced column name>
- // or
- // <target entity name>_<referenced column name>
- protected String buildDefaultName() {
- if (getColumn().getOwner().joinColumns().size() != 1) {
- return null;
- }
- String prefix = getColumn().getOwner().attributeName();
- if (prefix == null) {
- prefix = targetEntityName();
- }
- if (prefix == null) {
- return null;
- }
- // TODO not sure which of these is correct...
- // (the spec implies that the referenced column is always the
- // primary key column of the target entity)
- // String targetColumn = this.targetPrimaryKeyColumnName();
- String targetColumn = getColumn().getReferencedColumnName();
- if (targetColumn == null) {
- return null;
- }
- return prefix + "_" + targetColumn;
- }
-
- /**
- * return the name of the target entity
- */
- private String targetEntityName() {
- IEntity targetEntity = getColumn().getOwner().targetEntity();
- return (targetEntity == null) ? null : targetEntity.getName();
- }
-
- protected String buildDefaultReferencedColumnName() {
- if (getColumn().getOwner().joinColumns().size() != 1) {
- return null;
- }
- return this.targetPrimaryKeyColumnName();
- }
- /**
- * return the name of the single primary key column of the target entity
- */
- private String targetPrimaryKeyColumnName() {
- IEntity targetEntity = getColumn().getOwner().targetEntity();
- return (targetEntity == null) ? null : targetEntity.primaryKeyColumnName();
- }
-
- /** used internally as a mechanism to short circuit continued message adding */
- private boolean doContinue;
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- //String table = column.getTable();
- XmlRelationshipMapping mapping =
- (XmlRelationshipMapping) column.getOwner().getRelationshipMapping();
- //XmlTypeMapping typeMapping =
- // (XmlTypeMapping) column.getOwner().getTypeMapping();
- doContinue = column.isConnected();
-
-// if (doContinue && typeMapping.tableNameIsInvalid(table)) {
-// if (mapping.isVirtual()) {
-// messages.add(
-// JpaValidationMessages.buildMessage(
-// IMessage.HIGH_SEVERITY,
-// IJpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_TABLE,
-// new String[] {mapping.getPersistentAttribute().getName(), table, column.getName()},
-// column, column.getTableTextRange())
-// );
-// }
-// else {
-// messages.add(
-// JpaValidationMessages.buildMessage(
-// IMessage.HIGH_SEVERITY,
-// IJpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
-// new String[] {table, column.getName()},
-// column, column.getTableTextRange())
-// );
-// }
-// doContinue = false;
-// }
-//
- if (doContinue && ! column.isResolved()) {
- if (mapping.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME,
- new String[] {mapping.getPersistentAttribute().getName(), column.getName()},
- column, column.nameTextRange())
- );
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName()},
- column, column.nameTextRange())
- );
- }
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JoinTableContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JoinTableContext.java
deleted file mode 100644
index 130f911231..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JoinTableContext.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class JoinTableContext extends BaseContext
-{
- private IJoinTable table;
-
- private Collection<JoinColumnContext> joinColumnContexts;
-
- private Collection<JoinColumnContext> inverseJoinColumnContexts;
-
- public JoinTableContext(IContext parentContext, IJoinTable table) {
- super(parentContext);
- this.table = table;
- this.joinColumnContexts = buildJoinColumnContexts();
- this.inverseJoinColumnContexts = buildInverseJoinColumnContexts();
- }
-
- @Override
- protected void initialize() {}
-
- protected Collection<JoinColumnContext> buildJoinColumnContexts() {
- Collection<JoinColumnContext> contexts = new ArrayList<JoinColumnContext>();
- for (IJoinColumn joinColumn : this.table.getJoinColumns() ) {
- contexts.add(buildJoinColumnContext(joinColumn));
- }
- return contexts;
- }
-
- protected JoinColumnContext buildJoinColumnContext(IJoinColumn joinColumn) {
- return new JoinColumnContext(this, joinColumn);
- }
-
- protected Collection<JoinColumnContext> buildInverseJoinColumnContexts() {
- Collection<JoinColumnContext> contexts = new ArrayList<JoinColumnContext>();
- for (IJoinColumn joinColumn : this.table.getInverseJoinColumns() ) {
- contexts.add(buildInverseJoinColumnContext(joinColumn));
- }
- return contexts;
- }
-
- protected JoinColumnContext buildInverseJoinColumnContext(IJoinColumn joinColumn) {
- return new JoinColumnContext(this, joinColumn);
- }
-
- public IJoinTable getTable() {
- return this.table;
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- this.table.refreshDefaults(wrapDefaultsContext(defaultsContext));
- DefaultsContext joinColumnsDefaultsContext = wrapDefaultsContextForJoinColumn(defaultsContext);
- for (JoinColumnContext context : this.joinColumnContexts) {
- context.refreshDefaults(joinColumnsDefaultsContext, monitor);
- }
- DefaultsContext inverseJoinColumnsDefaultsContext = wrapDefaultsContextForInverseJoinColumn(defaultsContext);
- for (JoinColumnContext context : this.inverseJoinColumnContexts) {
- context.refreshDefaults(inverseJoinColumnsDefaultsContext, monitor);
- }
- }
-
- protected DefaultsContext wrapDefaultsContext(DefaultsContext defaultsContext) {
- return new DefaultsContextWrapper(defaultsContext) {
- public Object getDefault(String key) {
- if (key.equals(BaseJpaPlatform.DEFAULT_JOIN_TABLE_NAME_KEY)) {
- return joinTableDefaultName(this);
- }
- return super.getDefault(key);
- }
- };
- }
-
- protected DefaultsContext wrapDefaultsContextForJoinColumn(DefaultsContext defaultsContext) {
- return new DefaultsContextWrapper(defaultsContext) {
- public Object getDefault(String key) {
- /**
- * by default, the join column is, obviously, in the join table;
- * not sure whether it can be anywhere else...
- */
- if (key.equals(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_TABLE_KEY)) {
- return getTable().getName();
- }
- return super.getDefault(key);
- }
- };
- }
-
- protected DefaultsContext wrapDefaultsContextForInverseJoinColumn(DefaultsContext defaultsContext) {
- return new DefaultsContextWrapper(defaultsContext) {
- public Object getDefault(String key) {
- if (key.equals(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_TABLE_KEY)) {
- return getTable().getName();
- }
- return super.getDefault(key);
- }
- };
- }
-
- protected String joinTableDefaultName(DefaultsContext defaultsContext) {
- String tableName = relationshipMapping().typeMapping().getTableName();
- if (tableName == null) {
- return null;
- }
- IEntity targetEntity = targetEntity(defaultsContext);
- if (targetEntity == null) {
- return null;
- }
- ITable targetTable = targetEntity.getTable();
- return (targetTable == null) ? null : tableName + "_" + targetTable.getName();
- }
-
- protected IEntity targetEntity(DefaultsContext defaultsContext) {
- String targetEntity = relationshipMapping().fullyQualifiedTargetEntity(defaultsContext.astRoot());
- if (targetEntity == null) {
- return null;
- }
- IPersistentType persistentType = defaultsContext.persistentType(targetEntity);
- if (persistentType == null) {
- return null;
- }
- ITypeMapping typeMapping = persistentType.getMapping();
- if (typeMapping instanceof IEntity) {
- return (IEntity) typeMapping;
- }
- return null;
- }
-
- protected IRelationshipMapping relationshipMapping() {
- return this.table.relationshipMapping();
- }
-
- /** used internally as a mechanism to short circuit continued message adding */
- private boolean doContinue;
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- addTableMessages(messages);
-
- if (doContinue) {
- for (JoinColumnContext context : joinColumnContexts) {
- context.addToMessages(messages);
- }
-
- for (JoinColumnContext context : inverseJoinColumnContexts) {
- context.addToMessages(messages);
- }
- }
- }
-
- protected void addTableMessages(List<IMessage> messages) {
- doContinue = table.isConnected();
- String schema = table.getSchema();
- XmlRelationshipMapping mapping = (XmlRelationshipMapping) table.relationshipMapping();
-
- if (doContinue && ! table.hasResolvedSchema()) {
- if (mapping.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA,
- new String[] {mapping.getPersistentAttribute().getName(), schema, table.getName()},
- table, table.schemaTextRange())
- );
-
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_TABLE_UNRESOLVED_SCHEMA,
- new String[] {schema, table.getName()},
- table, table.schemaTextRange())
- );
- }
- doContinue = false;
- }
-
- if (doContinue && ! table.isResolved()) {
- if (mapping.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME,
- new String[] {mapping.getPersistentAttribute().getName(), table.getName()},
- table, table.nameTextRange())
- );
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_TABLE_UNRESOLVED_NAME,
- new String[] {table.getName()},
- table, table.nameTextRange())
- );
- }
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformRegistry.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JpaPlatformRegistry.java
index c812684c1b..e5a0f56438 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformRegistry.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JpaPlatformRegistry.java
@@ -7,7 +7,7 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal;
+package org.eclipse.jpt.core.internal.platform;
import java.util.HashMap;
import java.util.Iterator;
@@ -16,6 +16,8 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jpt.core.internal.IJpaPlatform;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
import org.eclipse.jpt.utility.internal.iterators.ReadOnlyIterator;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/MappingFileContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/MappingFileContext.java
deleted file mode 100644
index 66dc59315e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/MappingFileContext.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.platform;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlEmbeddable;
-import org.eclipse.jpt.core.internal.content.orm.XmlEntity;
-import org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass;
-import org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode;
-import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class MappingFileContext extends BaseContext
-{
- private XmlRootContentNode ormRoot;
-
- private List<XmlTypeContext> xmlTypeContexts;
-
-
- public MappingFileContext(
- PersistenceUnitContext parentContext, XmlRootContentNode xmlRootContentNode) {
- super(parentContext);
- this.ormRoot = xmlRootContentNode;
- this.xmlTypeContexts = buildXmlTypeContexts();
- }
-
- protected List<XmlTypeContext> buildXmlTypeContexts() {
- List<XmlTypeContext> contexts = new ArrayList<XmlTypeContext>();
- for (XmlTypeMapping typeMapping : this.ormRoot.getEntityMappings().getTypeMappings()) {
- XmlTypeContext xmlTypeContext = buildContext(typeMapping);
- contexts.add(xmlTypeContext);
- }
- return contexts;
- }
-
- protected void populateGeneratorRepository(GeneratorRepository generatorRepository) {
- for (ISequenceGenerator generator : this.ormRoot.getEntityMappings().getSequenceGenerators()) {
- generatorRepository.addGenerator(generator);
- }
- for (ITableGenerator generator : this.ormRoot.getEntityMappings().getTableGenerators()) {
- generatorRepository.addGenerator(generator);
- }
- for (XmlTypeContext context : this.xmlTypeContexts) {
- context.populateGeneratorRepository(generatorRepository);
- }
- }
-
- @Override
- protected void initialize() {
- // nothing yet ...
- }
-
- protected XmlTypeContext buildContext(XmlTypeMapping typeMapping) {
- String key = typeMapping.getKey();
- if (key == IMappingKeys.ENTITY_TYPE_MAPPING_KEY) {
- return new XmlEntityContext(this, (XmlEntity) typeMapping);
- }
- else if (key == IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY) {
- return new XmlEmbeddableContext(this, (XmlEmbeddable) typeMapping);
- }
- else if (key == IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY) {
- return new XmlMappedSuperclassContext(this, (XmlMappedSuperclass) typeMapping);
- }
- else {
- throw new IllegalArgumentException(typeMapping.toString());
- }
- }
-
- protected XmlTypeContext xmlTypeMappingContextFor(IJavaTypeMapping javaTypeMapping) {
- for (XmlTypeContext context : this.xmlTypeContexts) {
- if (javaTypeMapping == context.getJavaTypeMapping()) {
- return context;
- }
- }
- return null;
- }
-
- @Override
- public void refreshDefaults(DefaultsContext parentDefaults, IProgressMonitor monitor) {
- super.refreshDefaults(parentDefaults, monitor);
- ormRoot.getEntityMappings().refreshDefaults(parentDefaults);
- DefaultsContext wrappedDefaultsContext = wrapDefaultsContext(parentDefaults);
- for (XmlTypeContext context : this.xmlTypeContexts) {
- checkCanceled(monitor);
- if (!context.isRefreshed()) {
- context.refreshDefaults(wrappedDefaultsContext, monitor);
- }
- }
- }
-
- private void checkCanceled(IProgressMonitor monitor) {
- if (monitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- }
-
- private DefaultsContext wrapDefaultsContext(DefaultsContext defaultsContext) {
- return new DefaultsContextWrapper(defaultsContext) {
- public Object getDefault(String key) {
- if (key.equals(BaseJpaPlatform.DEFAULT_TABLE_SCHEMA_KEY)
- || key.equals(BaseJpaPlatform.DEFAULT_TABLE_GENERATOR_SCHEMA_KEY)) {
- String schema = ormRoot.getEntityMappings().getSchema();
- if (schema != null) {
- return schema;
- }
- }
- if (key.equals(BaseJpaPlatform.DEFAULT_TABLE_CATALOG_KEY)) {
- String catalog = ormRoot.getEntityMappings().getCatalog();
- if (catalog != null) {
- return catalog;
- }
- }
-
- return super.getDefault(key);
- }
- };
- }
-
- public XmlRootContentNode getXmlRootContentNode() {
- return ormRoot;
- }
-
- public PersistenceUnitContext getPersistenceUnitContext() {
- return (PersistenceUnitContext) getParentContext();
- }
-
- public Iterator<XmlTypeContext> typeContexts() {
- return this.xmlTypeContexts.iterator();
- }
-
- public boolean contains(IPersistentType persistentType) {
- for (XmlTypeContext context : this.xmlTypeContexts) {
- if (persistentType == context.getPersistentType()) {
- return true;
- }
- if (persistentType == context.javaPersistentType()) {
- return true;
- }
- }
- return false;
- }
-
- Iterator<IPersistentType> persistentTypes() {
- return new TransformationIterator<XmlTypeContext, IPersistentType>(xmlTypeContexts.iterator()) {
- @Override
- protected IPersistentType transform(XmlTypeContext next) {
- return next.getPersistentType();
- }
- };
- }
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- for (XmlTypeContext typeMappingContext : this.xmlTypeContexts) {
- typeMappingContext.addToMessages(messages);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/NullGeneratorRepository.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/NullGeneratorRepository.java
deleted file mode 100644
index dc329d473f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/NullGeneratorRepository.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.Iterator;
-import org.eclipse.jpt.core.internal.mappings.IGenerator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-public class NullGeneratorRepository implements IGeneratorRepository
-{
- // singleton
- private static final NullGeneratorRepository INSTANCE = new NullGeneratorRepository();
-
- /**
- * Return the singleton.
- */
- public static NullGeneratorRepository instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private NullGeneratorRepository() {
- super();
- }
-
- public IGenerator generator(String name) {
- return null;
- }
-
- public Iterator<String> generatorNames() {
- return EmptyIterator.instance();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/PersistenceUnitContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/PersistenceUnitContext.java
deleted file mode 100644
index 757fcd30c3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/PersistenceUnitContext.java
+++ /dev/null
@@ -1,613 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.platform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.core.internal.AccessType;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata;
-import org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode;
-import org.eclipse.jpt.core.internal.content.persistence.JavaClassRef;
-import org.eclipse.jpt.core.internal.content.persistence.MappingFileRef;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.HashBag;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-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.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class PersistenceUnitContext extends BaseContext
-{
- protected final static String IMPLIED_MAPPING_FILE_LOCATION = "META-INF/orm.xml";
-
- private PersistenceUnit persistenceUnit;
-
- private List<PersistenceUnitMetadata> persistenceUnitMetadatas; // datas ?? datae ?? datata ??
-
- private List<MappingFileContext> mappingFileContexts;
- private List<JavaTypeContext> javaPersistentTypeContexts;
- //private Collection<JarFileContext> jarFilesContexts;
-
- private IGeneratorRepository generatorRepository;
-
- /**
- * Stores the JavaPersistentTypeContext for JavaPersistentTypes that are referenced
- * by more than one orm.xml file. An error will be given to the user for this condition
- * and the defaults will not be based on a persistence unit or orm.xml file.
- */
- private Collection<JavaTypeContext> duplicateJavaPersistentTypes;
-
-
- public PersistenceUnitContext(IContext parentContext, PersistenceUnit persistenceUnit) {
- super(parentContext);
- this.persistenceUnit = persistenceUnit;
- this.persistenceUnitMetadatas = buildPersistenceUnitMetadatas();
- this.duplicateJavaPersistentTypes = new ArrayList<JavaTypeContext>();
- this.mappingFileContexts = buildMappingFileContexts();
- this.javaPersistentTypeContexts = buildJavaClassesContexts();
- this.generatorRepository = buildGeneratorRepository();
- }
-
- @Override
- protected void initialize() {
- }
-
- private List<PersistenceUnitMetadata> buildPersistenceUnitMetadatas() {
- List<PersistenceUnitMetadata> metadatas = new ArrayList<PersistenceUnitMetadata>();
- for (MappingFileRef mappingFileRef : persistenceUnit.getMappingFiles()) {
- XmlRootContentNode content = xmlRootContentNodeFor(mappingFileRef);
- if (content != null && content.getEntityMappings() != null
- && ! content.getEntityMappings().getPersistenceUnitMetadata().isAllFeaturesUnset()) {
- metadatas.add(content.getEntityMappings().getPersistenceUnitMetadata());
- }
- }
- return metadatas;
- }
-
- protected List<MappingFileContext> buildMappingFileContexts() {
- List<MappingFileContext> contexts = new ArrayList<MappingFileContext>();
- for (XmlRootContentNode content : allUniqueMappingFileContents()) {
- contexts.add(new MappingFileContext(this, content));
- }
- return contexts;
- }
-
- protected List<XmlRootContentNode> allUniqueMappingFileContents() {
- List<XmlRootContentNode> contents = new ArrayList<XmlRootContentNode>();
- for (MappingFileRef mappingFileRef : persistenceUnit.getMappingFiles()) {
- XmlRootContentNode xmlRootContentNode = xmlRootContentNodeFor(mappingFileRef);
- if (xmlRootContentNode != null
- && xmlRootContentNode.getEntityMappings() != null
- && ! contents.contains(xmlRootContentNode)) {
- contents.add(xmlRootContentNode);
- }
- }
- XmlRootContentNode impliedMappingFileContent = impliedMappingFileContent();
- if (impliedMappingFileContent != null
- && impliedMappingFileContent.getEntityMappings() != null
- && ! contents.contains(impliedMappingFileContent)) {
- contents.add(impliedMappingFileContent);
- }
- return contents;
- }
-
- private XmlRootContentNode xmlRootContentNodeFor(MappingFileRef mappingFileRef) {
- IJpaFile jpaFile = mappingFileRef.getMappingFile();
- if (jpaFile != null) {
- try {
- return (XmlRootContentNode) jpaFile.getContent();
- }
- catch (ClassCastException cce) { /* do nothing, return null */ }
- }
- return null;
- }
-
- protected XmlRootContentNode impliedMappingFileContent() {
- // check flexible project structure
- IVirtualComponent component = ComponentCore.createComponent(persistenceUnit.getJpaProject().project());
- IVirtualFolder virtualRootFolder = component.getRootFolder();
- IVirtualFile virtualMappingFile = virtualRootFolder.getFile(new Path(IMPLIED_MAPPING_FILE_LOCATION));
- // keep track of whether one has been found so that we may know if multiple exist
- IJpaFile mappingFile = null;
- for (IFile underlyingFile : virtualMappingFile.getUnderlyingFiles()) {
- IJpaFile jpaFile = JptCorePlugin.jpaFile(underlyingFile);
- if (jpaFile != null) {
- if (mappingFile != null) {
- return null; // multiple do exist
- }
- else {
- mappingFile = jpaFile;
- }
- }
- }
- if (mappingFile != null) {
- try {
- return (XmlRootContentNode) mappingFile.getContent();
- }
- catch (ClassCastException cce) { /* do nothing, return null */ }
- }
- return null;
- }
-
- protected List<JavaTypeContext> buildJavaClassesContexts() {
- List<JavaTypeContext> javaPersistentTypeContexts = new ArrayList<JavaTypeContext>();
- for (JavaPersistentType jpType : allIncludedJavaPersistentTypes()) {
- //if it's already specified in an orm.xml file then that is its context,
- //no need to add a javaTypeMappingContext
- if (xmlTypeMappingContextFor(jpType.getMapping()) == null) {
- JavaTypeContext javaTypeContext =
- (JavaTypeContext) getPlatform().buildJavaTypeContext(this, jpType.getMapping());
- javaPersistentTypeContexts.add(javaTypeContext);
- }
- }
- return javaPersistentTypeContexts;
- }
-
- protected List<JavaPersistentType> allIncludedJavaPersistentTypes() {
- List<JavaPersistentType> jpTypes = new ArrayList<JavaPersistentType>();
- for (Iterator<JavaPersistentType> stream = listedJavaPersistentTypes(); stream.hasNext(); ) {
- JavaPersistentType listedJpType = stream.next();
- if (listedJpType != null && ! jpTypes.contains(listedJpType)) {
- jpTypes.add(listedJpType);
- }
- }
- for (Iterator<JavaPersistentType> stream = discoveredJavaPersistentTypes(); stream.hasNext(); ) {
- JavaPersistentType discoveredJpType = stream.next();
- if (discoveredJpType != null && discoveredJpType.getMappingKey() != IMappingKeys.NULL_TYPE_MAPPING_KEY && ! jpTypes.contains(discoveredJpType)) {
- jpTypes.add(discoveredJpType);
- }
- }
- return jpTypes;
- }
-
- protected Iterator<JavaPersistentType> listedJavaPersistentTypes() {
- return new TransformationIterator<JavaClassRef, JavaPersistentType>(new CloneIterator<JavaClassRef>(persistenceUnit.getClasses())) {
- @Override
- protected JavaPersistentType transform(JavaClassRef next) {
- return javaPersistentTypeFor(next);
- }
- };
- }
-
- protected Iterator<JavaPersistentType> discoveredJavaPersistentTypes() {
- if (! persistenceUnit.getJpaProject().discoversAnnotatedClasses()) {
- return EmptyIterator.instance();
- }
- return persistenceUnit.getJpaProject().javaPersistentTypes();
- }
-
- /**
- * Iterate JavaTypeContexts firt to add generators to the repository.
- * Then iterator through the MappingFileContexts and override any generators
- * with the same name in the java
- *
- * @return
- */
- protected IGeneratorRepository buildGeneratorRepository() {
- GeneratorRepository generatorRepository = new GeneratorRepository();
- for (JavaTypeContext context : this.javaPersistentTypeContexts) {
- context.populateGeneratorRepository(generatorRepository);
- }
- for (MappingFileContext context : this.mappingFileContexts) {
- context.populateGeneratorRepository(generatorRepository);
- }
-
- return generatorRepository;
- }
-
- private JavaPersistentType javaPersistentTypeFor(JavaClassRef javaClassRef) {
- IType type = javaClassRef.findJdtType();
- return jpaProject().javaPersistentType(type);
- }
-
- /**
- * Find an XmlTypeMappingContext that references the given IJavaTYpeMapping by
- * specifying that java class for one of its entities, embeddables, or mapped superclasses
-
- */
- public XmlTypeContext xmlTypeMappingContextFor(IJavaTypeMapping javaTypeMapping) {
- for (MappingFileContext context : this.mappingFileContexts) {
- XmlTypeContext xmlTypeMappingContext = context.xmlTypeMappingContextFor(javaTypeMapping);
- if (xmlTypeMappingContext != null) {
- return xmlTypeMappingContext;
- }
- }
- return null;
- }
-
- protected IJpaProject jpaProject() {
- return this.persistenceUnit.getJpaProject();
- }
-
- PersistenceUnit persistenceUnit() {
- return this.persistenceUnit;
- }
-
- Iterator<IPersistentType> persistentTypes() {
- return
- new CompositeIterator<IPersistentType>(
- new CompositeIterator<IPersistentType>(
- new TransformationIterator<MappingFileContext, Iterator<IPersistentType>>(mappingFileContexts.iterator()) {
- @Override
- protected Iterator<IPersistentType> transform(MappingFileContext next) {
- return next.persistentTypes();
- }
- }
- ),
- new TransformationIterator<JavaTypeContext, IPersistentType>(javaPersistentTypeContexts.iterator()) {
- @Override
- protected IPersistentType transform(JavaTypeContext next) {
- return next.getPersistentType();
- }
- }
- );
- }
-
- @Override
- public void refreshDefaults(DefaultsContext parentDefaults, IProgressMonitor monitor) {
- super.refreshDefaults(parentDefaults, monitor);
- for (JavaTypeContext context : this.duplicateJavaPersistentTypes) {
- checkCanceled(monitor);
- // context for duplicates not be based on the persistenceUnit defaults,
- // so we're going to use the one passed here without wrapping it
- context.refreshDefaults(parentDefaults, monitor);
- }
- DefaultsContext defaults = wrapDefaultsContext(parentDefaults, monitor);
- for (MappingFileContext context : this.mappingFileContexts) {
- checkCanceled(monitor);
- context.refreshDefaults(defaults, monitor);
- }
- for (JavaTypeContext context : this.javaPersistentTypeContexts) {
- checkCanceled(monitor);
- context.refreshDefaults(defaults, monitor);
- }
-
- //TODO somehow need to clear out defaults for the duplicateJpaFiles,
- //do i have to build JavaTypeContext for those as well?
- }
-
- private void checkCanceled(IProgressMonitor monitor) {
- if (monitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- }
-
- protected DefaultsContext wrapDefaultsContext(DefaultsContext defaults, final IProgressMonitor monitor) {
- DefaultsContext puDefaults = buildPersistenceUnitDefaults(defaults);
- return new DefaultsContextWrapper(puDefaults){
- public IPersistentType persistentType(String fullyQualifiedTypeName) {
- for (Iterator<TypeContext> i = typeContexts(); i.hasNext(); ) {
- TypeContext typeContext = i.next();
- IPersistentType persistentType = typeContext.getPersistentType();
- IType jdtType = persistentType.findJdtType();
- if (jdtType != null
- && fullyQualifiedTypeName.equals(jdtType.getFullyQualifiedName())) {
- if (! typeContext.isRefreshed()) {
- typeContext.refreshDefaults(this, monitor);
- }
- return persistentType;
- }
- }
- return null;
- }
- };
- }
-
- protected DefaultsContext buildPersistenceUnitDefaults(DefaultsContext defaults) {
- if (persistenceUnitMetadatas.size() == 1) {
- final PersistenceUnitDefaults puDefaults = persistenceUnitMetadatas.get(0).getPersistenceUnitDefaults();
- if (puDefaults.isAllFeaturesUnset()) {
- return defaults;
- }
-
- return new DefaultsContextWrapper(defaults) {
- public Object getDefault(String key) {
- if (key.equals(BaseJpaPlatform.DEFAULT_TABLE_SCHEMA_KEY)
- || key.equals(BaseJpaPlatform.DEFAULT_TABLE_GENERATOR_SCHEMA_KEY)) {
- String schema = puDefaults.getSchema();
- if (schema != null) {
- return schema;
- }
- }
- if (key.equals(BaseJpaPlatform.DEFAULT_TABLE_CATALOG_KEY)) {
- String catalog = puDefaults.getCatalog();
- if (catalog != null) {
- return catalog;
- }
- }
- if (key.equals(BaseJpaPlatform.DEFAULT_ACCESS_KEY)) {
- AccessType access = puDefaults.getAccess();
- if (access != null) {
- return access;
- }
- }
- return super.getDefault(key);
- }
- };
- }
-
- return defaults;
- }
-
- private Iterator<TypeContext> typeContexts() {
- return new CompositeIterator<TypeContext>(mappingFileTypeContexts(), javaTypeContexts());
- }
-
- private Iterator mappingFileTypeContexts() {
- return new CompositeIterator(
- new TransformationIterator(this.mappingFileContexts.iterator()) {
- protected Object transform(Object next) {
- return ((MappingFileContext) next).typeContexts();
- }
- }
- );
- }
-
- private Iterator javaTypeContexts() {
- return this.javaPersistentTypeContexts.iterator();
- }
-
- public void addDuplicateJpaFile(JavaTypeContext javaPersistentTypeContext) {
- this.duplicateJavaPersistentTypes.add(javaPersistentTypeContext);
- }
-
- public boolean containsDuplicateJavaPersistentType(JavaPersistentType javaPersistentType) {
- for (JavaTypeContext context : this.duplicateJavaPersistentTypes) {
- if (context.getPersistentType() == javaPersistentType) {
- return true;
- }
- }
- return false;
- }
-
- public boolean contains(IPersistentType persistentType) {
- for (MappingFileContext context : this.mappingFileContexts) {
- if (context.contains(persistentType)) {
- return true;
- }
- }
- for (JavaTypeContext context : this.javaPersistentTypeContexts) {
- if (context.contains(persistentType)) {
- return true;
- }
- }
- return false;
- }
-
- public IGeneratorRepository getGeneratorRepository() {
- return this.generatorRepository;
- }
-
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
- addMappingFileMessages(messages);
- addClassMessages(messages);
- }
-
- protected void addMappingFileMessages(List<IMessage> messages) {
- addMultipleMetadataMessages(messages);
- addUnspecifiedMappingFileMessages(messages);
- addUnresolvedMappingFileMessages(messages);
- addInvalidMappingFileContentMessage(messages);
- addDuplicateMappingFileMessages(messages);
-
- for (MappingFileContext mappingFileContext : mappingFileContexts) {
- mappingFileContext.addToMessages(messages);
- }
- }
-
- protected void addMultipleMetadataMessages(List<IMessage> messages) {
- if (persistenceUnitMetadatas.size() > 1) {
- for (PersistenceUnitMetadata metadata : persistenceUnitMetadatas) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.ENTITY_MAPPINGS_MULTIPLE_METADATA,
- new String[] {persistenceUnit.getName()},
- metadata, metadata.validationTextRange())
- );
- }
- }
- }
-
- protected void addUnspecifiedMappingFileMessages(List<IMessage> messages) {
- for (MappingFileRef mappingFileRef : persistenceUnit.getMappingFiles()) {
- if (mappingFileRef.getFileName() == null || mappingFileRef.getFileName().equals("")) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENCE_UNIT_UNSPECIFIED_MAPPING_FILE,
- mappingFileRef, mappingFileRef.validationTextRange())
- );
- }
- }
- }
-
- protected void addUnresolvedMappingFileMessages(List<IMessage> messages) {
- for (Iterator stream = persistenceUnit.getMappingFiles().iterator(); stream.hasNext(); ) {
- MappingFileRef mappingFileRef = (MappingFileRef) stream.next();
- if (! (mappingFileRef.getFileName() == null || mappingFileRef.getFileName().equals(""))
- && mappingFileRef.getMappingFile() == null) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENCE_UNIT_NONEXISTENT_MAPPING_FILE,
- new String[] {mappingFileRef.getFileName()},
- mappingFileRef, mappingFileRef.validationTextRange())
- );
- }
- }
- }
-
- protected void addInvalidMappingFileContentMessage(List<IMessage> messages) {
- for (Iterator stream = persistenceUnit.getMappingFiles().iterator(); stream.hasNext(); ) {
- MappingFileRef mappingFileRef = (MappingFileRef) stream.next();
- if (mappingFileRef.getMappingFile() != null
- && xmlRootContentNodeFor(mappingFileRef) == null) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENCE_UNIT_INVALID_MAPPING_FILE,
- new String[] {mappingFileRef.getFileName()},
- mappingFileRef, mappingFileRef.validationTextRange())
- );
- }
- }
- }
-
- protected HashBag<String> mappingFileNameBag() {
- List<MappingFileRef> refs = this.persistenceUnit.getMappingFiles();
- HashBag<String> fileNameBag = new HashBag<String>(refs.size());
- CollectionTools.addAll(fileNameBag, this.fileRefNames(refs.iterator()));
- return fileNameBag;
- }
-
- protected Iterator<String> fileRefNames(Iterator<MappingFileRef> refs) {
- return new TransformationIterator<MappingFileRef, String>(refs) {
- @Override
- protected String transform(MappingFileRef ref) {
- return ref.getFileName();
- }
- };
- }
-
- protected void addDuplicateMappingFileMessages(List<IMessage> messages) {
- HashBag<String> fileNameBag = this.mappingFileNameBag();
- for (MappingFileRef mappingFileRef : persistenceUnit.getMappingFiles()) {
- if (fileNameBag.count(mappingFileRef.getFileName()) > 1) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_MAPPING_FILE,
- new String[] {mappingFileRef.getFileName()},
- mappingFileRef, mappingFileRef.validationTextRange())
- );
- }
- }
- }
-
- protected void addClassMessages(List<IMessage> messages) {
- addUnspecifiedClassMessages(messages);
- addUnresolvedClassMessages(messages);
- addInvalidClassContentMessages(messages);
- addDuplicateClassMessages(messages);
-
- for (JavaTypeContext persistentTypeContext : javaPersistentTypeContexts) {
- persistentTypeContext.addToMessages(messages);
- }
- }
-
- protected void addUnspecifiedClassMessages(List<IMessage> messages) {
- for (JavaClassRef javaClassRef : persistenceUnit.getClasses()) {
- String javaClass = javaClassRef.getJavaClass();
- if (StringTools.stringIsEmpty(javaClass)) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENCE_UNIT_UNSPECIFIED_CLASS,
- javaClassRef, javaClassRef.validationTextRange())
- );
- }
- }
- }
-
- protected void addUnresolvedClassMessages(List<IMessage> messages) {
- for (JavaClassRef javaClassRef : persistenceUnit.getClasses()) {
- String javaClass = javaClassRef.getJavaClass();
- if (! StringTools.stringIsEmpty(javaClass) && javaClassRef.findJdtType() == null) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENCE_UNIT_NONEXISTENT_CLASS,
- new String[] {javaClass},
- javaClassRef, javaClassRef.validationTextRange())
- );
- }
- }
- }
-
- protected void addInvalidClassContentMessages(List<IMessage> messages) {
- for (JavaClassRef javaClassRef : persistenceUnit.getClasses()) {
- String javaClass = javaClassRef.getJavaClass();
- if (! StringTools.stringIsEmpty(javaClass) && javaClassRef.findJdtType() != null
- && (javaPersistentTypeFor(javaClassRef) == null
- || javaPersistentTypeFor(javaClassRef).getMappingKey() == IMappingKeys.NULL_TYPE_MAPPING_KEY)) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENCE_UNIT_INVALID_CLASS,
- new String[] {javaClassRef.getJavaClass()},
- javaClassRef, javaClassRef.validationTextRange())
- );
- }
- }
- }
-
- protected HashBag<String> classNameBag() {
- List<JavaClassRef> refs = this.persistenceUnit.getClasses();
- HashBag<String> classNameBag = new HashBag<String>(refs.size());
- CollectionTools.addAll(classNameBag, this.classRefNames(refs.iterator()));
- return classNameBag;
- }
-
- protected Iterator<String> classRefNames(Iterator<JavaClassRef> refs) {
- return new TransformationIterator<JavaClassRef, String>(refs) {
- @Override
- protected String transform(JavaClassRef ref) {
- return ref.getJavaClass();
- }
- };
- }
-
- protected void addDuplicateClassMessages(List<IMessage> messages) {
- HashBag<String> classNameBag = this.classNameBag();
- for (JavaClassRef javaClassRef : persistenceUnit.getClasses()) {
- if (javaClassRef.getJavaClass() != null
- && classNameBag.count(javaClassRef.getJavaClass()) > 1) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_CLASS,
- new String[] {javaClassRef.getJavaClass()},
- javaClassRef, javaClassRef.validationTextRange())
- );
- }
- }
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor( this, this.persistenceUnit.getName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/PrimaryKeyJoinColumnContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/PrimaryKeyJoinColumnContext.java
deleted file mode 100644
index 7b289fe6f6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/PrimaryKeyJoinColumnContext.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class PrimaryKeyJoinColumnContext extends AbstractJoinColumnContext<IPrimaryKeyJoinColumn>
-{
-
- public PrimaryKeyJoinColumnContext(IContext parentContext, IPrimaryKeyJoinColumn column) {
- super(parentContext, column);
- }
-
- //TODO This default is different for oneToOne mappings, we don't yet support pkJoinColumns there
- protected String buildDefaultReferencedColumnName() {
- return this.buildDefaultName();
- }
-
- protected String buildDefaultName() {
- if (getColumn().getOwner().joinColumns().size() != 1) {
- return null;
- }
- IEntity entity = (IEntity) getColumn().getOwner().getTypeMapping();
- String pkColumnName = entity.parentEntity().primaryKeyColumnName();
- return pkColumnName;
- }
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- boolean doContinue = column.isConnected();
- if (doContinue && ! column.isResolved()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName()},
- column, column.nameTextRange())
- );
- }
-
- if (doContinue && ! column.isReferencedColumnResolved()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME,
- new String[] {column.getReferencedColumnName(), column.getName()},
- column, column.referencedColumnNameTextRange())
- );
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/SecondaryTableContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/SecondaryTableContext.java
deleted file mode 100644
index 3328844415..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/SecondaryTableContext.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class SecondaryTableContext extends BaseContext
-{
- private ISecondaryTable secondaryTable;
-
- private Collection<PrimaryKeyJoinColumnContext> pkJoinColumnContexts;
-
- public SecondaryTableContext(IContext parentContext, ISecondaryTable secondaryTable) {
- super(parentContext);
- this.secondaryTable = secondaryTable;
- this.pkJoinColumnContexts = buildPkJoinColumnContexts();
- }
-
- protected Collection<PrimaryKeyJoinColumnContext> buildPkJoinColumnContexts() {
- Collection<PrimaryKeyJoinColumnContext> contexts = new ArrayList<PrimaryKeyJoinColumnContext>();
- for (IPrimaryKeyJoinColumn pkJoinColumn : getSecondaryTable().getPrimaryKeyJoinColumns()) {
- contexts.add(buildPrimaryKeyJoinColumnContext(pkJoinColumn));
- }
-
- return contexts;
- }
-
- protected PrimaryKeyJoinColumnContext buildPrimaryKeyJoinColumnContext(IPrimaryKeyJoinColumn pkJoinColumn) {
- return new PrimaryKeyJoinColumnContext(this, pkJoinColumn);
- }
-
- @Override
- protected void initialize() {}
-
- public ISecondaryTable getSecondaryTable() {
- return this.secondaryTable;
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- this.secondaryTable.refreshDefaults(defaultsContext);
- for (PrimaryKeyJoinColumnContext context : this.pkJoinColumnContexts) {
- context.refreshDefaults(defaultsContext, monitor);
- }
- }
-
- public DefaultsContext wrapDefaultsContext(DefaultsContext defaultsContext) {
- return new DefaultsContextWrapper(defaultsContext) {
- public Object getDefault(String key) {
- //TODO hmm, why is this commented out??? this wrapper is doing nothing - kfm 8/17/07
-// if (key.equals(BaseJpaPlatform.DEFAULT_COLUMN_TABLE_KEY)) {
-// return getTable().getName();
-// }
- return super.getDefault(key);
- }
- };
- }
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
- addTableMessages(messages);
- for (PrimaryKeyJoinColumnContext context : this.pkJoinColumnContexts) {
- context.addToMessages(messages);
- }
- }
-
- protected void addTableMessages(List<IMessage> messages) {
- boolean doContinue = secondaryTable.isConnected();
- String schema = secondaryTable.getSchema();
-
- if (doContinue && ! secondaryTable.hasResolvedSchema()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_SCHEMA,
- new String[] {schema, secondaryTable.getName()},
- secondaryTable, secondaryTable.schemaTextRange())
- );
- doContinue = false;
- }
-
- if (doContinue && ! secondaryTable.isResolved()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_NAME,
- new String[] {secondaryTable.getName()},
- secondaryTable, secondaryTable.nameTextRange())
- );
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/TableContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/TableContext.java
deleted file mode 100644
index 83bba72cfd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/TableContext.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class TableContext extends BaseContext
-{
- private ITable table;
-
- public TableContext(IContext parentContext, ITable table) {
- super(parentContext);
- this.table = table;
- }
-
- @Override
- protected void initialize() {}
-
- public ITable getTable() {
- return this.table;
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- this.table.refreshDefaults(defaultsContext);
- }
-
- public DefaultsContext wrapDefaultsContext(DefaultsContext defaultsContext) {
- return new DefaultsContextWrapper(defaultsContext) {
- public Object getDefault(String key) {
- if (key.equals(BaseJpaPlatform.DEFAULT_COLUMN_TABLE_KEY)) {
- return getTable().getName();
- }
- return super.getDefault(key);
- }
- };
- }
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- boolean doContinue = table.isConnected();
- String schema = table.getSchema();
-
- if (doContinue && ! table.hasResolvedSchema()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.TABLE_UNRESOLVED_SCHEMA,
- new String[] {schema, table.getName()},
- table, table.schemaTextRange())
- );
- doContinue = false;
- }
-
- if (doContinue && ! table.isResolved()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.TABLE_UNRESOLVED_NAME,
- new String[] {table.getName()},
- table, table.nameTextRange())
- );
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/TypeContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/TypeContext.java
deleted file mode 100644
index 48f84dd5b4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/TypeContext.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.IPersistentType;
-
-public interface TypeContext
-{
- IPersistentType getPersistentType();
-
- void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor);
-
- boolean isRefreshed();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlAttributeContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlAttributeContext.java
deleted file mode 100644
index 4a488f8101..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlAttributeContext.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public abstract class XmlAttributeContext extends BaseContext
-{
- private XmlAttributeMapping xmlAttributeMapping;
-
- private JavaAttributeContext javaAttributeContext;
-
- protected XmlAttributeContext(IContext parentContext, XmlAttributeMapping xmlAttributeMapping) {
- super(parentContext);
- this.xmlAttributeMapping = xmlAttributeMapping;
- }
-
- @Override
- protected void initialize() {
-
- }
-
- public XmlPersistentAttribute getAttribute() {
- return xmlAttributeMapping.getPersistentAttribute();
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- JavaPersistentType javaPersistentType = this.xmlAttributeMapping.getPersistentType().findJavaPersistentType();
- String name = this.xmlAttributeMapping.getPersistentAttribute().getName();
- if (name != null && javaPersistentType != null) {
- JavaPersistentAttribute javaPersistentAttribute = javaPersistentType.attributeNamed(name);
- if (javaPersistentAttribute != null) {
- this.javaAttributeContext =
- (JavaAttributeContext) getPlatform().buildJavaAttributeContext(this, javaPersistentAttribute.getMapping());
- }
- }
- this.xmlAttributeMapping.refreshDefaults(defaultsContext);
- }
-
- protected XmlAttributeMapping attributeMapping() {
- return this.xmlAttributeMapping;
- }
-
- protected IAttributeMapping javaAttributeMapping() {
- if (this.javaAttributeContext != null) {
- return this.javaAttributeContext.getMapping();
- }
- return null;
- }
-
- protected boolean embeddableOwned() {
- return attributeMapping().typeMapping().getKey() == IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
- }
-
- protected boolean entityOwned() {
- return attributeMapping().typeMapping().getKey() == IMappingKeys.ENTITY_TYPE_MAPPING_KEY;
- }
-
- public final DefaultsContext wrapDefaultsContext(DefaultsContext defaultsContext) {
- return new DefaultsContextWrapper(defaultsContext) {
- public Object getDefault(String key) {
- return XmlAttributeContext.this.getDefault(key, getWrappedDefaultsContext());
- }
- };
- }
-
- protected Object getDefault(String key, DefaultsContext defaultsContext) {
- return defaultsContext.getDefault(key);
- }
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
- addAttributeMessages(messages);
- addInvalidMappingMessage(messages);
- }
-
- protected void addAttributeMessages(List<IMessage> messages) {
- addUnspecifiedAttributeMessage(messages);
- addUnresolvedAttributeMessage(messages);
- addModifierMessages(messages);
- }
-
- protected void addUnspecifiedAttributeMessage(List<IMessage> messages) {
- XmlPersistentAttribute persistentAttribute = xmlAttributeMapping.getPersistentAttribute();
- if (StringTools.stringIsEmpty(persistentAttribute.getName())) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENT_ATTRIBUTE_UNSPECIFIED_NAME,
- persistentAttribute, persistentAttribute.nameTextRange())
- );
- }
- }
-
- protected void addUnresolvedAttributeMessage(List<IMessage> messages) {
- XmlPersistentAttribute persistentAttribute = xmlAttributeMapping.getPersistentAttribute();
- if (! StringTools.stringIsEmpty(persistentAttribute.getName())
- && persistentAttribute.persistentType().findJdtType() != null
- && persistentAttribute.getAttribute() == null) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENT_ATTRIBUTE_UNRESOLVED_NAME,
- new String[] {persistentAttribute.getName(), persistentAttribute.persistentType().getClass_()},
- persistentAttribute, persistentAttribute.nameTextRange())
- );
- }
- }
-
- protected void addModifierMessages(List<IMessage> messages) {
- XmlPersistentAttribute attribute = xmlAttributeMapping.getPersistentAttribute();
-
- if (attribute.getMapping().getKey() != IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY
- && attribute.getAttribute() != null
- && attribute.getAttribute().isField()) {
- int flags;
- try {
- flags = attribute.getAttribute().getJdtMember().getFlags();
- } catch (JavaModelException jme) {
- /* no error to log, in that case */
- return;
- }
-
- if (Flags.isFinal(flags)) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_FIELD,
- new String[] {attribute.getName()},
- attribute, attribute.validationTextRange())
- );
- }
-
- if (Flags.isPublic(flags)) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENT_ATTRIBUTE_PUBLIC_FIELD,
- new String[] {attribute.getName()},
- attribute, attribute.validationTextRange())
- );
-
- }
- }
- }
-
- protected void addInvalidMappingMessage(List<IMessage> messages) {
- IAttributeMapping attributeMapping = attributeMapping();
- ITypeMapping typeMapping = attributeMapping.typeMapping();
- if (! typeMapping.attributeMappingKeyAllowed(attributeMapping.getKey())) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_MAPPING,
- new String[] {attributeMapping.getPersistentAttribute().getName()},
- attributeMapping, attributeMapping.validationTextRange())
- );
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlAttributeOverrideContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlAttributeOverrideContext.java
deleted file mode 100644
index ed9c2799c9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlAttributeOverrideContext.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IColumnMapping;
-
-public class XmlAttributeOverrideContext extends AttributeOverrideContext
-{
-
- public XmlAttributeOverrideContext(ParentContext parentContext, IAttributeOverride attributeOverride) {
- super(parentContext, attributeOverride);
- this.attributeOverride = attributeOverride;
- }
-
- @Override
- public ParentContext getParentContext() {
- return (ParentContext) super.getParentContext();
- }
-
- @Override
- protected String buildDefaultColumnName() {
- IColumnMapping columnMapping = columnMapping();
- if (columnMapping == null) {
- return null;
- }
- if (this.attributeOverride.isVirtual()) {
- if (!((XmlTypeMapping) this.attributeOverride.getOwner().getTypeMapping()).isXmlMetadataComplete()) {
- IAttributeOverride javaAttributeOverride = javaAttributeOverride();
- if (javaAttributeOverride != null) {
- return javaAttributeOverride.getColumn().getName();
- }
- }
- return columnMapping.getColumn().getName();
- }
-
- return columnMapping.getColumn().getName();
- }
-
- @Override
- protected String buildDefaultTableName() {
- IColumnMapping columnMapping = columnMapping();
- if (columnMapping == null) {
- return null;
- }
- if (this.attributeOverride.isVirtual()) {
- if (!((XmlTypeMapping) this.attributeOverride.getOwner().getTypeMapping()).isXmlMetadataComplete()) {
- IAttributeOverride javaAttributeOverride = javaAttributeOverride();
- if (javaAttributeOverride != null) {
- return javaAttributeOverride.getColumn().getTable();
- }
- }
- return columnMapping.getColumn().getTable();
- }
-
- return columnMapping.getColumn().getTable();
- }
-
- public interface ParentContext extends IContext {
- /**
- * Return the JavaAttributeOverride that corresponds to the xml attribute override
- * with the given name. Return null if it does not exist
- */
- IAttributeOverride javaAttributeOverride(String overrideName);
- }
-
- private IAttributeOverride javaAttributeOverride() {
- return getParentContext().javaAttributeOverride(this.attributeOverride.getName());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlBasicContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlBasicContext.java
deleted file mode 100644
index d50f129742..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlBasicContext.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaBasic;
-import org.eclipse.jpt.core.internal.content.orm.XmlBasic;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class XmlBasicContext extends XmlAttributeContext
-{
- private ColumnContext columnContext;
-
- public XmlBasicContext(IContext parentContext, XmlBasic xmlBasic) {
- super(parentContext, xmlBasic);
- this.columnContext = new ColumnContext(this, xmlBasic.getColumn());
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- this.columnContext.refreshDefaults(defaultsContext, monitor);
- }
-
- @Override
- protected Object getDefault(String key, DefaultsContext defaultsContext) {
- if (key.equals(BaseJpaPlatform.DEFAULT_COLUMN_NAME_KEY)) {
- if (attributeMapping().getPersistentAttribute().isVirtual()) {
- if (javaBasicMapping() != null) {
- if (!attributeMapping().getPersistentType().getMapping().isXmlMetadataComplete()) {
- return javaBasicMapping().getColumn().getName();
- }
- return javaBasicMapping().getColumn().getDefaultName();
- }
- }
- //doesn't matter what's in the java @Column annotation because it is completely
- //overriden as soon as you specify the attribute in xml.
- return attributeMapping().getPersistentAttribute().getName();
- }
-
- return super.getDefault(key, defaultsContext);
- }
-
- protected JavaBasic javaBasicMapping() {
- IAttributeMapping attributeMapping = javaAttributeMapping();
- if (attributeMapping.getKey() == IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY) {
- return (JavaBasic) attributeMapping;
- }
- return null;
- }
-
- protected XmlBasic getBasic() {
- return (XmlBasic) attributeMapping();
- }
-
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
- if (entityOwned()) {
- addColumnMessages(messages);
- }
- }
-
- protected void addColumnMessages(List<IMessage> messages) {
- XmlBasic basic = getBasic();
- ITypeMapping typeMapping = basic.typeMapping();
- IColumn column = basic.getColumn();
- String table = column.getTable();
- boolean doContinue = column.isConnected();
-
- if (doContinue && typeMapping.tableNameIsInvalid(table)) {
- if (basic.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_TABLE,
- new String[] {basic.getPersistentAttribute().getName(), table, column.getName()},
- column, column.tableTextRange())
- );
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
- new String[] {table, column.getName()},
- column, column.tableTextRange())
- );
- }
- doContinue = false;
- }
-
- if (doContinue && ! column.isResolved()) {
- if (basic.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME,
- new String[] {basic.getPersistentAttribute().getName(), column.getName()},
- column, column.nameTextRange())
- );
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName()},
- column, column.nameTextRange())
- );
- }
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlEmbeddableContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlEmbeddableContext.java
deleted file mode 100644
index 891269c1dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlEmbeddableContext.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import org.eclipse.jpt.core.internal.content.orm.XmlEmbeddable;
-
-public class XmlEmbeddableContext extends XmlTypeContext
-{
- public XmlEmbeddableContext(MappingFileContext parentContext, XmlEmbeddable xmlEmbeddable) {
- super(parentContext, xmlEmbeddable);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlEmbeddedContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlEmbeddedContext.java
deleted file mode 100644
index d3f8332ca1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlEmbeddedContext.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IJpaPlatform;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEmbedded;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.internal.content.orm.XmlEmbedded;
-import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.core.internal.platform.XmlAttributeOverrideContext.ParentContext;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class XmlEmbeddedContext
- extends XmlAttributeContext
-{
- private Collection<XmlAttributeOverrideContext> attributeOverrideContexts;
-
- public XmlEmbeddedContext(IContext parentContext, XmlEmbedded mapping) {
- super(parentContext, mapping);
- this.attributeOverrideContexts = buildAttributeOverrideContexts();
- }
-
- protected Collection<XmlAttributeOverrideContext> buildAttributeOverrideContexts() {
- Collection<XmlAttributeOverrideContext> contexts = new ArrayList<XmlAttributeOverrideContext>();
- for (IAttributeOverride attributeOverride : getEmbedded().getAttributeOverrides()) {
- contexts.add(new XmlAttributeOverrideContext(buildParentContext(), attributeOverride));
- }
-
- return contexts;
- }
- private ParentContext buildParentContext() {
- return new XmlAttributeOverrideContext.ParentContext() {
- public void refreshDefaults(DefaultsContext defaults, IProgressMonitor monitor) {
- XmlEmbeddedContext.this.refreshDefaults(defaults, monitor);
- }
- public IJpaPlatform getPlatform() {
- return XmlEmbeddedContext.this.getPlatform();
- }
- public IContext getParentContext() {
- return XmlEmbeddedContext.this.getParentContext();
- }
- public void addToMessages(List<IMessage> messages) {
- XmlEmbeddedContext.this.addToMessages(messages);
- }
- public IAttributeOverride javaAttributeOverride(String overrideName) {
- if (getEmbedded().isVirtual()) {
- return getJavaEmbedded().attributeOverrideNamed(overrideName);
- }
- //if the xml mapping is specified, then it is as if no annotations are
- //specified on the java mapping, so return null
- return null;
- }
- };
- }
-
- @Override
- public void refreshDefaults(DefaultsContext parentDefaults, IProgressMonitor monitor) {
- super.refreshDefaults(parentDefaults, monitor);
- refreshDefaultAttributeOverrides();
- for (XmlAttributeOverrideContext context : this.attributeOverrideContexts) {
- context.refreshDefaults(parentDefaults, monitor);
- }
- }
-
-
- protected void refreshDefaultAttributeOverrides() {
- for (Iterator<String> i = getEmbedded().allOverridableAttributeNames(); i.hasNext(); ) {
- String override = i.next();
- if (!getEmbedded().containsAttributeOverride(override)) {
- XmlAttributeOverride attributeOverride = OrmFactory.eINSTANCE.createXmlAttributeOverride(new IEmbedded.AttributeOverrideOwner(getEmbedded()));
- getEmbedded().getDefaultAttributeOverrides().add(attributeOverride);
- attributeOverride.setName(override);
- }
- }
-
- Collection<String> attributeNames = CollectionTools.collection(getEmbedded().allOverridableAttributeNames());
-
- //remove any default mappings that are not included in the attributeNames collection
- Collection<IAttributeOverride> overridesToRemove = new ArrayList<IAttributeOverride>();
- for (IAttributeOverride attributeOverride : getEmbedded().getDefaultAttributeOverrides()) {
- if (!attributeNames.contains(attributeOverride.getName())
- || getEmbedded().containsSpecifiedAttributeOverride(attributeOverride.getName())) {
- overridesToRemove.add(attributeOverride);
- }
- }
-
- getEmbedded().getDefaultAttributeOverrides().removeAll(overridesToRemove);
- }
-
- protected XmlTypeMapping getXmlTypeMapping() {
- return getEmbedded().getPersistentAttribute().typeMapping();
- }
-
- private XmlEmbedded getEmbedded() {
- return (XmlEmbedded) attributeMapping();
- }
-
- protected JavaEmbedded getJavaEmbedded() {
- IAttributeMapping javaAttributeMapping = javaAttributeMapping();
- if (javaAttributeMapping != null
- && javaAttributeMapping.getKey() == IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY) {
- return (JavaEmbedded) javaAttributeMapping;
- }
- return null;
- }
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- for (XmlAttributeOverrideContext aoContext : this.attributeOverrideContexts) {
- aoContext.addToMessages(messages);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlEntityContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlEntityContext.java
deleted file mode 100644
index 65a4a30a0b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlEntityContext.java
+++ /dev/null
@@ -1,417 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.platform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.IJpaPlatform;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaEntity;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaTable;
-import org.eclipse.jpt.core.internal.content.orm.XmlEntity;
-import org.eclipse.jpt.core.internal.content.orm.XmlTable;
-import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.platform.XmlAttributeOverrideContext.ParentContext;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.utility.internal.ClassTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class XmlEntityContext extends XmlTypeContext implements XmlSecondaryTableContext.ParentContext
-{
- private TableContext tableContext;
-
- private Collection<XmlSecondaryTableContext> secondaryTableContexts;
-
- private JavaTable javaTable;
-
- private Collection<XmlAttributeOverrideContext> attributeOverrideContexts;
-
- private Collection<AssociationOverrideContext> associationOverrideContexts;
-
- public XmlEntityContext(MappingFileContext parentContext, XmlEntity xmlEntity) {
- super(parentContext, (XmlTypeMapping) xmlEntity);
- this.attributeOverrideContexts = buildAttributeOverrideContexts();
- this.associationOverrideContexts = buildAssociationOverrideContexts();
- this.secondaryTableContexts = buildSecondaryTableContexts();
- }
-
- protected Collection<XmlAttributeOverrideContext> buildAttributeOverrideContexts() {
- Collection<XmlAttributeOverrideContext> contexts = new ArrayList<XmlAttributeOverrideContext>();
- for (IAttributeOverride attributeOverride : getEntity().getAttributeOverrides()) {
- contexts.add(new XmlAttributeOverrideContext(buildParentContext(), attributeOverride));
- }
-
- return contexts;
- }
-
- private ParentContext buildParentContext() {
- return new XmlAttributeOverrideContext.ParentContext() {
- public void refreshDefaults(DefaultsContext defaults, IProgressMonitor monitor) {
- XmlEntityContext.this.refreshDefaults(defaults, monitor);
- }
- public IJpaPlatform getPlatform() {
- return XmlEntityContext.this.getPlatform();
- }
- public IContext getParentContext() {
- return XmlEntityContext.this.getParentContext();
- }
- public void addToMessages(List<IMessage> messages) {
- XmlEntityContext.this.addToMessages(messages);
- }
- public IAttributeOverride javaAttributeOverride(String overrideName) {
- JavaEntity javaEntity = getJavaEntity();
- if (javaEntity == null) {
- return null;
- }
- return javaEntity.attributeOverrideNamed(overrideName);
- }
- };
- }
-
- //only support default joinColumn information for the default association overrides,
- //AssociationOverride has no defaults, the name and joinColumns must be specified
- protected Collection<AssociationOverrideContext> buildAssociationOverrideContexts() {
- Collection<AssociationOverrideContext> contexts = new ArrayList<AssociationOverrideContext>();
- for (IAssociationOverride associationOverride : getEntity().getDefaultAssociationOverrides()) {
- contexts.add(new AssociationOverrideContext(this, associationOverride));
- }
-
- return contexts;
- }
-
- protected Collection<XmlSecondaryTableContext> buildSecondaryTableContexts() {
- Collection<XmlSecondaryTableContext> contexts = new ArrayList<XmlSecondaryTableContext>();
- for (ISecondaryTable secondaryTable : getEntity().getSecondaryTables()) {
- contexts.add(new XmlSecondaryTableContext(this, secondaryTable));
- }
-
- return contexts;
- }
-
- public ISecondaryTable javaSecondaryTable(int index) {
- JavaEntity javaEntity = getJavaEntity();
- return javaEntity == null ? null : javaEntity.getSpecifiedSecondaryTables().get(index);
- }
-
- protected XmlEntity getEntity() {
- return (XmlEntity) getXmlTypeMapping();
- }
-
- protected JavaEntity getJavaEntity() {
- IJavaTypeMapping javaTypeMapping = javaTypeMapping();
- if (javaTypeMapping != null
- && javaTypeMapping.getKey() == IMappingKeys.ENTITY_TYPE_MAPPING_KEY) {
- return (JavaEntity) javaTypeMapping;
- }
- return null;
- }
-
- @Override
- public void initialize() {
- super.initialize();
- IJavaTypeMapping javaTypeMapping = javaTypeMapping();
- XmlTable xmlTable = (XmlTable)((XmlEntity) getXmlTypeMapping()).getTable();
- if (javaTypeMapping instanceof IEntity) {
- this.javaTable = (JavaTable) ((IEntity) javaTypeMapping).getTable();
- }
- this.tableContext = new TableContext(this, xmlTable);
- }
-
- /**
- * XmlIdContexts will populate the generatorRepository themselves.
- * XmlAttributeContexts are not built until the initialize method, so we
- * don't have any yet to populate the generatorRepository.
- */
- protected void populateGeneratorRepository(GeneratorRepository generatorRepository) {
- if (getEntity().getTableGenerator() != null) {
- generatorRepository.addGenerator(getEntity().getTableGenerator());
- }
- if (getEntity().getSequenceGenerator() != null) {
- generatorRepository.addGenerator(getEntity().getSequenceGenerator());
- }
- }
-
- public PersistenceUnitContext getPersistenceUnitContext() {
- return ((MappingFileContext) getParentContext()).getPersistenceUnitContext();
- }
-
- @Override
- public void refreshDefaults(DefaultsContext parentDefaults, IProgressMonitor monitor) {
- super.refreshDefaults(parentDefaults, monitor);
- DefaultsContext defaultsContext = wrapDefaultsContext(parentDefaults);
- refreshDefaultAttributeOverrides();
- refreshDefaultAssociationOverrides();
- refreshDefaultSecondaryTables();
- for (XmlSecondaryTableContext context : this.secondaryTableContexts) {
- context.refreshDefaults(defaultsContext, monitor);
- }
- for (XmlAttributeOverrideContext context : this.attributeOverrideContexts) {
- context.refreshDefaults(defaultsContext, monitor);
- }
- for (AssociationOverrideContext context : this.associationOverrideContexts) {
- context.refreshDefaults(defaultsContext, monitor);
- }
- }
-
- protected void refreshTableContext(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- this.tableContext.refreshDefaults(defaultsContext, monitor);
- }
-
- protected void refreshDefaultAttributeOverrides() {
-
- JavaEntity javaEntity = getJavaEntity();
- if (javaEntity != null && !getXmlTypeMapping().isXmlMetadataComplete()) {
- for (IAttributeOverride attributeOverride : javaEntity.getAttributeOverrides()) {
- if (!getEntity().containsAttributeOverride(attributeOverride.getName())) {
- IAttributeOverride defaultAttributeOverride = getEntity().createAttributeOverride(0);
- defaultAttributeOverride.setName(attributeOverride.getName());
- getEntity().getDefaultAttributeOverrides().add(defaultAttributeOverride);
- }
- }
- }
- else {
- for (Iterator<String> i = getEntity().allOverridableAttributeNames(); i.hasNext(); ) {
- String override = i.next();
- if (!getEntity().containsAttributeOverride(override)) {
- IAttributeOverride defaultAttributeOverride = getEntity().createAttributeOverride(0);
- defaultAttributeOverride.setName(override);
- getEntity().getDefaultAttributeOverrides().add(defaultAttributeOverride);
- }
-
- }
- }
-
- Collection<String> attributeNames = CollectionTools.collection(getEntity().allOverridableAttributeNames());
-
- //remove any default mappings that are not included in the attributeNames collection
- Collection<IAttributeOverride> overridesToRemove = new ArrayList<IAttributeOverride>();
- for (IAttributeOverride attributeOverride : getEntity().getDefaultAttributeOverrides()) {
- if (getEntity().containsSpecifiedAttributeOverride(attributeOverride.getName())) {
- overridesToRemove.add(attributeOverride);
- }
- else if (!attributeNames.contains(attributeOverride.getName())) {
- if (javaEntity == null) {
- overridesToRemove.add(attributeOverride);
- }
- else if (getXmlTypeMapping().isXmlMetadataComplete()) {
- if (!javaEntity.containsDefaultAttributeOverride(attributeOverride.getName())) {
- overridesToRemove.add(attributeOverride);
- }
- }
- else if (!javaEntity.containsSpecifiedAttributeOverride(attributeOverride.getName())) {
- overridesToRemove.add(attributeOverride);
- }
- }
- }
-
- getEntity().getDefaultAttributeOverrides().removeAll(overridesToRemove);
- }
-
- protected void refreshDefaultAssociationOverrides() {
-
- JavaEntity javaEntity = getJavaEntity();
- if (javaEntity != null && !getXmlTypeMapping().isXmlMetadataComplete()) {
- for (IAssociationOverride associationOverride : javaEntity.getAssociationOverrides()) {
- if (!getEntity().containsAssociationOverride(associationOverride.getName())) {
- IAssociationOverride defaultAssociationOverride = getEntity().createAssociationOverride(0);
- defaultAssociationOverride.setName(associationOverride.getName());
- getEntity().getDefaultAssociationOverrides().add(defaultAssociationOverride);
- }
- }
- }
- else {
- for (Iterator<String> i = getEntity().allOverridableAssociationNames(); i.hasNext(); ) {
- String override = i.next();
- if (!getEntity().containsAssociationOverride(override)) {
- IAssociationOverride defaultAssociationOverride = getEntity().createAssociationOverride(0);
- defaultAssociationOverride.setName(override);
- getEntity().getDefaultAssociationOverrides().add(defaultAssociationOverride);
- }
-
- }
- }
-
- Collection<String> attributeNames = CollectionTools.collection(getEntity().allOverridableAssociationNames());
-
- //remove any default mappings that are not included in the attributeNames collection
- Collection<IAssociationOverride> overridesToRemove = new ArrayList<IAssociationOverride>();
- for (IAssociationOverride associationOverride : getEntity().getDefaultAssociationOverrides()) {
- if (getEntity().containsSpecifiedAssociationOverride(associationOverride.getName())) {
- overridesToRemove.add(associationOverride);
- }
- else if (!attributeNames.contains(associationOverride.getName())) {
- if (javaEntity == null) {
- overridesToRemove.add(associationOverride);
- }
- else if (getXmlTypeMapping().isXmlMetadataComplete()) {
- if (!javaEntity.containsDefaultAssociationOverride(associationOverride.getName())) {
- overridesToRemove.add(associationOverride);
- }
- }
- else if (!javaEntity.containsSpecifiedAssociationOverride(associationOverride.getName())) {
- overridesToRemove.add(associationOverride);
- }
- }
- }
-
- getEntity().getDefaultAssociationOverrides().removeAll(overridesToRemove);
- }
-
- protected void refreshDefaultSecondaryTables() {
- JavaEntity javaEntity = getJavaEntity();
- if (javaEntity != null && !getXmlTypeMapping().isXmlMetadataComplete()) {
- for (ISecondaryTable secondaryTable : javaEntity.getSecondaryTables()) {
- if (secondaryTable.getName() != null) {
- if (!getEntity().containsSecondaryTable(secondaryTable.getName())) {
- ISecondaryTable defaultSecondaryTable = getEntity().createSecondaryTable(0);
- defaultSecondaryTable.setSpecifiedName(secondaryTable.getName());
- getEntity().getVirtualSecondaryTables().add(defaultSecondaryTable);
- }
- }
- }
- }
- Collection<ISecondaryTable> secondaryTablesToRemove = new ArrayList<ISecondaryTable>();
-
- for (Iterator<ISecondaryTable> i = getEntity().getVirtualSecondaryTables().iterator(); i.hasNext(); ) {
- ISecondaryTable secondaryTable = i.next();
-
- if (getXmlTypeMapping().isXmlMetadataComplete() || getEntity().containsSpecifiedSecondaryTable(secondaryTable.getName())) {
- secondaryTablesToRemove.add(secondaryTable);
- continue;
- }
- if (javaEntity == null) {
- secondaryTablesToRemove.add(secondaryTable);
- }
- else if (!javaEntity.containsSecondaryTable(secondaryTable.getName())) {
- secondaryTablesToRemove.add(secondaryTable);
- }
- }
- getEntity().getVirtualSecondaryTables().removeAll(secondaryTablesToRemove);
-
- }
-
- @Override
- public DefaultsContext wrapDefaultsContext(DefaultsContext defaultsContext) {
- return super.wrapDefaultsContext(this.tableContext.wrapDefaultsContext(defaultsContext));
- }
-
- @Override
- protected Object getDefault(String key, DefaultsContext defaultsContext) {
- if (key.equals(BaseJpaPlatform.DEFAULT_ENTITY_NAME_KEY)) {
- String className = getPersistentType().getClass_();
- if (className != null) {
- return ClassTools.shortNameForClassNamed(className);
- }
- }
-
- XmlTable xmlTable = getXmlTable();
- if (javaTable != null) {
- if (getXmlTypeMapping().isXmlMetadataComplete() || xmlTable.getNode() != null) {
- if (key.equals(BaseJpaPlatform.DEFAULT_TABLE_SCHEMA_KEY)) {
- return javaTable.getDefaultSchema();
- }
- if (key.equals(BaseJpaPlatform.DEFAULT_TABLE_CATALOG_KEY)) {
- return javaTable.getDefaultCatalog();
- }
- if (key.equals(BaseJpaPlatform.DEFAULT_TABLE_NAME_KEY)) {
- return javaTable.getDefaultName();
- }
- }
- else {
- if (key.equals(BaseJpaPlatform.DEFAULT_TABLE_SCHEMA_KEY)) {
- return javaTable.getSchema();
- }
- if (key.equals(BaseJpaPlatform.DEFAULT_TABLE_CATALOG_KEY)) {
- return javaTable.getCatalog();
- }
- if (key.equals(BaseJpaPlatform.DEFAULT_TABLE_NAME_KEY)) {
- return javaTable.getName();
- }
- }
- }
- else if (key.equals(BaseJpaPlatform.DEFAULT_TABLE_NAME_KEY)) {
- if (getEntity().rootEntity().getInheritanceStrategy().isSingleTable()) {
- IEntity rootEntity = getEntity().rootEntity();
- if (rootEntity == getEntity()) {
- return rootEntity.getName();
- }
- return rootEntity.getTable().getName();
- }
- return getEntity().getName();
- }
- return super.getDefault(key, defaultsContext);
- }
-
- private XmlTable getXmlTable() {
- return (XmlTable) ((XmlEntity) getXmlTypeMapping()).getTable();
- }
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
- tableContext.addToMessages(messages);
- addIdMessages(messages);
-
- for (SecondaryTableContext context : secondaryTableContexts) {
- context.addToMessages(messages);
- }
-
- for (XmlAttributeOverrideContext aoContext : attributeOverrideContexts) {
- aoContext.addToMessages(messages);
- }
-
- for (AssociationOverrideContext aoContext : associationOverrideContexts) {
- aoContext.addToMessages(messages);
- }
- }
-
- protected void addIdMessages(List<IMessage> messages) {
- addNoIdMessage(messages);
-
- }
-
- protected void addNoIdMessage(List<IMessage> messages) {
- IEntity entity = getEntity();
- if (entityHasNoId()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.ENTITY_NO_ID,
- new String[] {entity.getName()},
- entity, entity.validationTextRange())
- );
- }
- }
-
- private boolean entityHasNoId() {
- return ! this.entityHasId();
- }
-
- private boolean entityHasId() {
- for (Iterator<IPersistentAttribute> stream = this.getEntity().getPersistentType().allAttributes(); stream.hasNext(); ) {
- if (stream.next().isIdAttribute()) {
- return true;
- }
- }
- return false;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlIdContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlIdContext.java
deleted file mode 100644
index 1ab264eea2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlIdContext.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaId;
-import org.eclipse.jpt.core.internal.content.orm.XmlId;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
-import org.eclipse.jpt.core.internal.mappings.IGenerator;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class XmlIdContext extends XmlAttributeContext
-{
-
- private ColumnContext columnContext;
-
- public XmlIdContext(IContext parentContext, XmlId xmlId) {
- super(parentContext, xmlId);
- this.columnContext = new ColumnContext(this, xmlId.getColumn());
- populateGeneratorRepository((GeneratorRepository) getPersistenceUnitContext().getGeneratorRepository());
- }
-
- protected PersistenceUnitContext getPersistenceUnitContext() {
- return ((MappingFileContext) getParentContext().getParentContext()).getPersistenceUnitContext();
- }
-
- protected void populateGeneratorRepository(GeneratorRepository generatorRepository) {
- ITableGenerator tableGenerator = getId().getTableGenerator();
- if (tableGenerator != null) {
- generatorRepository.addGenerator(tableGenerator);
- }
- ISequenceGenerator sequenceGenerator = getId().getSequenceGenerator();
- if (sequenceGenerator != null) {
- generatorRepository.addGenerator(sequenceGenerator);
- }
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- this.columnContext.refreshDefaults(defaultsContext, monitor);
- ITableGenerator tableGenerator = getId().getTableGenerator();
- if (tableGenerator != null) {
- tableGenerator.refreshDefaults(defaultsContext);
- }
- }
-
- @Override
- protected Object getDefault(String key, DefaultsContext defaultsContext) {
- if (key.equals(BaseJpaPlatform.DEFAULT_COLUMN_NAME_KEY)) {
- if (attributeMapping().getPersistentAttribute().isVirtual()) {
- if (javaIdMapping() != null) {
- if (!attributeMapping().getPersistentType().getMapping().isXmlMetadataComplete()) {
- return javaIdMapping().getColumn().getName();
- }
- return javaIdMapping().getColumn().getDefaultName();
- }
- }
- //doesn't matter what's in the java @Column annotation because it is completely
- //overriden as soon as you specify the attribute in xml.
- return attributeMapping().getPersistentAttribute().getName();
- }
-
- return super.getDefault(key, defaultsContext);
- }
-
- protected JavaId javaIdMapping() {
- IAttributeMapping attributeMapping = javaAttributeMapping();
- if (attributeMapping.getKey() == IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY) {
- return (JavaId) attributeMapping;
- }
- return null;
- }
-
- protected XmlId getId() {
- return (XmlId) attributeMapping();
- }
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- if (entityOwned()) {
- addColumnMessages(messages);
- }
- addGeneratorMessages(messages);
- }
-
- protected void addColumnMessages(List<IMessage> messages) {
- XmlId id = getId();
- ITypeMapping typeMapping = id.typeMapping();
- IColumn column = id.getColumn();
- String table = column.getTable();
- boolean doContinue = column.isConnected();
-
- if (doContinue && typeMapping.tableNameIsInvalid(table)) {
- if (id.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_TABLE,
- new String[] {id.getPersistentAttribute().getName(), table, column.getName()},
- column, column.tableTextRange())
- );
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
- new String[] {table, column.getName()},
- column, column.tableTextRange())
- );
- }
- doContinue = false;
- }
-
- if (doContinue && ! column.isResolved()) {
- if (id.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME,
- new String[] {id.getPersistentAttribute().getName(), column.getName()},
- column, column.nameTextRange())
- );
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName()},
- column, column.nameTextRange())
- );
- }
- }
- }
-
- protected void addGeneratorMessages(List<IMessage> messages) {
- XmlId id = getId();
- IGeneratedValue generatedValue = id.getGeneratedValue();
- if (generatedValue == null) {
- return;
- }
- String generatorName = generatedValue.getGenerator();
- if (generatorName == null) {
- return;
- }
- IGeneratorRepository generatorRepository = getPersistenceUnitContext().getGeneratorRepository();
- IGenerator generator = generatorRepository.generator(generatorName);
-
- if (generator == null) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.GENERATED_VALUE_UNRESOLVED_GENERATOR,
- new String[] {generatorName},
- generatedValue, generatedValue.validationTextRange())
- );
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlManyToManyContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlManyToManyContext.java
deleted file mode 100644
index 37fb8b51aa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlManyToManyContext.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import org.eclipse.jpt.core.internal.content.orm.XmlManyToMany;
-
-public class XmlManyToManyContext extends XmlMultiRelationshipMappingContext
-{
- public XmlManyToManyContext(IContext parentContext, XmlManyToMany mapping) {
- super(parentContext, mapping);
- }
-
- protected XmlManyToMany getManyToMany() {
- return (XmlManyToMany) attributeMapping();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlManyToOneContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlManyToOneContext.java
deleted file mode 100644
index 9f1bdf6b7a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlManyToOneContext.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import org.eclipse.jpt.core.internal.content.orm.XmlManyToOne;
-
-public class XmlManyToOneContext
- extends XmlSingleRelationshipMappingContext
-{
- public XmlManyToOneContext(IContext parentContext, XmlManyToOne mapping) {
- super(parentContext, mapping);
- }
-
- //ManyToOne mapping is always the owning side
- protected boolean isOwningSide() {
- return true;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlMappedSuperclassContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlMappedSuperclassContext.java
deleted file mode 100644
index 83e71b6e7a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlMappedSuperclassContext.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import org.eclipse.jpt.core.internal.content.orm.XmlMappedSuperclass;
-
-public class XmlMappedSuperclassContext extends XmlTypeContext
-{
- public XmlMappedSuperclassContext(MappingFileContext parentContext, XmlMappedSuperclass xmlMappedSuperclass) {
- super(parentContext, xmlMappedSuperclass);
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlMultiRelationshipMappingContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlMultiRelationshipMappingContext.java
deleted file mode 100644
index 0de4f10221..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlMultiRelationshipMappingContext.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlMultiRelationshipMappingInternal;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.INonOwningMapping;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public abstract class XmlMultiRelationshipMappingContext
- extends XmlRelationshipMappingContext implements XmlJoinTableContext.ParentContext
-{
- private XmlJoinTableContext joinTableContext;
-
- protected XmlMultiRelationshipMappingContext(
- IContext parentContext, XmlMultiRelationshipMappingInternal mapping) {
- super(parentContext, mapping);
- this.joinTableContext = new XmlJoinTableContext(this, mapping.getJoinTable());
- }
-
- @Override
- public void refreshDefaults(final DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- this.joinTableContext.refreshDefaults(defaultsContext, monitor);
- }
-
- protected XmlMultiRelationshipMappingInternal multiRelationshipMapping() {
- return (XmlMultiRelationshipMappingInternal) relationshipMapping();
- }
-
- @Override
- public IMultiRelationshipMapping javaRelationshipMapping() {
- IAttributeMapping javaAttributeMapping = javaAttributeMapping();
- if (javaAttributeMapping instanceof IMultiRelationshipMapping) {
- return ((IMultiRelationshipMapping) javaAttributeMapping);
- }
- return null;
- }
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- if (multiRelationshipMapping().getMappedBy() != null) {
- addMappedByMessages(messages);
- }
- else if (entityOwned()) {
- addJoinTableMessages(messages);
- }
- }
-
- protected void addJoinTableMessages(List<IMessage> messages) {
- joinTableContext.addToMessages(messages);
- }
-
- protected void addMappedByMessages(List<IMessage> messages) {
- XmlMultiRelationshipMapping mapping = multiRelationshipMapping();
- String mappedBy = mapping.getMappedBy();
-
- if (mapping.isJoinTableSpecified()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.MAPPING_MAPPED_BY_WITH_JOIN_TABLE,
- mapping.getJoinTable(), mapping.getJoinTable().validationTextRange())
- );
-
- }
-
- IEntity targetEntity = mapping.getResolvedTargetEntity();
-
- if (targetEntity == null) {
- // already have validation messages for that
- return;
- }
-
- IPersistentAttribute attribute = targetEntity.getPersistentType().resolveAttribute(mappedBy);
-
- if (attribute == null) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.MAPPING_UNRESOLVED_MAPPED_BY,
- new String[] {mappedBy},
- mapping, mapping.mappedByTextRange())
- );
- return;
- }
-
- if (! mapping.mappedByIsValid(attribute.getMapping())) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.MAPPING_INVALID_MAPPED_BY,
- new String[] {mappedBy},
- mapping, mapping.mappedByTextRange())
- );
- return;
- }
-
- INonOwningMapping mappedByMapping;
- try {
- mappedByMapping = (INonOwningMapping) attribute.getMapping();
- } catch (ClassCastException cce) {
- // there is no error then
- return;
- }
-
- if (mappedByMapping.getMappedBy() != null) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.MAPPING_MAPPED_BY_ON_BOTH_SIDES,
- mapping, mapping.mappedByTextRange())
- );
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlNullAttributeMappingContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlNullAttributeMappingContext.java
deleted file mode 100644
index 6ee8dd748c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlNullAttributeMappingContext.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import org.eclipse.jpt.core.internal.content.orm.XmlNullAttributeMapping;
-
-public class XmlNullAttributeMappingContext extends XmlAttributeContext
-{
- public XmlNullAttributeMappingContext(
- IContext parentContext, XmlNullAttributeMapping xmlNullAttributeMapping) {
- super(parentContext, xmlNullAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlOneToManyContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlOneToManyContext.java
deleted file mode 100644
index 8a18f1d739..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlOneToManyContext.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.jpt.core.internal.content.orm.XmlOneToMany;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class XmlOneToManyContext extends XmlMultiRelationshipMappingContext
-{
- public XmlOneToManyContext(IContext parentContext, XmlOneToMany mapping) {
- super(parentContext, mapping);
- }
-
- @Override
- protected void addJoinTableMessages(List<IMessage> messages) {
- // TODO
- // a 1-M doesn't *have* to have a join table
- return;
-
- //super.addJoinTableMessages(messages);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlOneToOneContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlOneToOneContext.java
deleted file mode 100644
index ebd501b23f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlOneToOneContext.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.orm.XmlOneToOne;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.INonOwningMapping;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class XmlOneToOneContext
- extends XmlSingleRelationshipMappingContext
-{
- public XmlOneToOneContext(IContext parentContext, XmlOneToOne mapping) {
- super(parentContext, mapping);
- }
-
- protected XmlOneToOne getMapping() {
- return (XmlOneToOne) super.attributeMapping();
- }
-
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- if (getMapping().getMappedBy() != null) {
- addMappedByMessages(messages);
- }
- }
-
- protected void addMappedByMessages(List<IMessage> messages) {
- XmlOneToOne mapping = getMapping();
- String mappedBy = mapping.getMappedBy();
- IEntity targetEntity = mapping.getResolvedTargetEntity();
-
- if (targetEntity == null) {
- // already have validation messages for that
- return;
- }
-
- IPersistentAttribute attribute = targetEntity.getPersistentType().resolveAttribute(mappedBy);
-
- if (attribute == null) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.MAPPING_UNRESOLVED_MAPPED_BY,
- new String[] {mappedBy},
- mapping, mapping.mappedByTextRange())
- );
- return;
- }
-
- if (! mapping.mappedByIsValid(attribute.getMapping())) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.MAPPING_INVALID_MAPPED_BY,
- new String[] {mappedBy},
- mapping, mapping.mappedByTextRange())
- );
- return;
- }
-
- INonOwningMapping mappedByMapping;
- try {
- mappedByMapping = (INonOwningMapping) attribute.getMapping();
- } catch (ClassCastException cce) {
- // there is no error then
- return;
- }
-
- if (mappedByMapping.getMappedBy() != null) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.MAPPING_MAPPED_BY_ON_BOTH_SIDES,
- mapping, mapping.mappedByTextRange())
- );
- }
- }
-
- @Override
- protected boolean isOwningSide() {
- return getMapping().getMappedBy() == null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlRelationshipMappingContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlRelationshipMappingContext.java
deleted file mode 100644
index 35db89e0e2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlRelationshipMappingContext.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlRelationshipMapping;
-import org.eclipse.jpt.core.internal.jdtutility.Attribute;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-
-public abstract class XmlRelationshipMappingContext extends XmlAttributeContext
-{
- protected XmlRelationshipMappingContext(IContext parentContext, XmlRelationshipMapping mapping) {
- super(parentContext, mapping);
- }
-
- protected XmlRelationshipMapping relationshipMapping() {
- return (XmlRelationshipMapping) attributeMapping();
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- relationshipMapping().refreshDefaults(defaultsContext);
- }
-
- protected IRelationshipMapping javaRelationshipMapping() {
- IAttributeMapping javaAttributeMapping = javaAttributeMapping();
- if (javaAttributeMapping instanceof IRelationshipMapping) {
- return ((IRelationshipMapping) javaAttributeMapping);
- }
- return null;
- }
-
- protected Object getDefault(String key, DefaultsContext defaultsContext) {
- if (key.equals(BaseJpaPlatform.DEFAULT_TARGET_ENTITY_KEY)) {
- IRelationshipMapping javaMapping = javaRelationshipMapping();
- if (javaMapping != null) {
- if (!relationshipMapping().isVirtual() && relationshipMapping().getPersistentType().getMapping().isXmlMetadataComplete()) {
- return javaMapping.getDefaultTargetEntity();
- }
- return javaMapping.getTargetEntity();
- }
- Attribute attribute = relationshipMapping().getPersistentAttribute().getAttribute();
- if (attribute != null) {
- IType iType = relationshipMapping().getPersistentType().findJdtType();
- if (iType != null) {
- return relationshipMapping().javaDefaultTargetEntity(defaultsContext.astRoot());
- }
- }
- }
- return super.getDefault(key, defaultsContext);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlSingleRelationshipMappingContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlSingleRelationshipMappingContext.java
deleted file mode 100644
index 87465aeee6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlSingleRelationshipMappingContext.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IJpaPlatform;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlSingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public abstract class XmlSingleRelationshipMappingContext
- extends XmlRelationshipMappingContext
-{
- private Collection<JoinColumnContext> joinColumnContexts;
-
- protected XmlSingleRelationshipMappingContext(
- IContext parentContext, XmlSingleRelationshipMapping mapping) {
- super(parentContext, mapping);
- this.joinColumnContexts = buildJoinColumnContexts();
- }
-
- protected Collection<JoinColumnContext> buildJoinColumnContexts() {
- Collection<JoinColumnContext> contexts = new ArrayList<JoinColumnContext>();
- for (Iterator<IJoinColumn> i = singleRelationshipMapping().getJoinColumns().iterator(); i.hasNext(); ) {
- contexts.add(new XmlJoinColumnContext(buildJoinColumnParentContext(), i.next()));
- }
- return contexts;
- }
-
- protected XmlJoinColumnContext.ParentContext buildJoinColumnParentContext() {
- return new XmlJoinColumnContext.ParentContext() {
- public void refreshDefaults(DefaultsContext defaults, IProgressMonitor monitor) {
- XmlSingleRelationshipMappingContext.this.refreshDefaults(defaults, monitor);
- }
-
- public IJpaPlatform getPlatform() {
- return XmlSingleRelationshipMappingContext.this.getPlatform();
- }
-
- public IContext getParentContext() {
- return XmlSingleRelationshipMappingContext.this.getParentContext();
- }
-
- public void addToMessages(List<IMessage> messages) {
- XmlSingleRelationshipMappingContext.this.addToMessages(messages);
- }
-
- public IJoinColumn javaJoinColumn(int index) {
- //if the mapping is specified in the xml, then nothing specified in java should be used
- if (relationshipMapping().isVirtual()) {
- return javaRelationshipMapping().getJoinColumns().get(index);
- }
- return null;
- }
- };
- }
-
- protected XmlSingleRelationshipMapping singleRelationshipMapping() {
- return (XmlSingleRelationshipMapping) relationshipMapping();
- }
-
-
- public ISingleRelationshipMapping javaRelationshipMapping() {
- IAttributeMapping javaAttributeMapping = javaAttributeMapping();
- if (javaAttributeMapping instanceof ISingleRelationshipMapping) {
- return ((ISingleRelationshipMapping) javaAttributeMapping);
- }
- return null;
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- for (JoinColumnContext context : this.joinColumnContexts) {
- context.refreshDefaults(defaultsContext, monitor);
- }
- }
-
- @Override
- protected Object getDefault(String key, DefaultsContext defaultsContext) {
- /**
- * by default, the join column is in the type mapping's primary table
- */
- if (key.equals(BaseJpaPlatform.DEFAULT_JOIN_COLUMN_TABLE_KEY)) {
- return singleRelationshipMapping().typeMapping().getTableName();
- }
- return super.getDefault(key, defaultsContext);
- }
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- //bug 192287 - do not want joinColumn validation errors on the non-owning side
- //of a bidirectional relationship. This is a low risk fix for RC3, but a better
- //solution would be to not have the default joinColumns on the non-owning side.
- //This would fix another bug that we show default joinColumns in this situation.
- if (entityOwned() && isOwningSide()) {
- addJoinColumnMessages(messages);
- }
- }
-
- protected abstract boolean isOwningSide();
-
-
- protected void addJoinColumnMessages(List<IMessage> messages) {
- XmlSingleRelationshipMapping mapping = singleRelationshipMapping();
- ITypeMapping typeMapping = mapping.typeMapping();
-
- for (IJoinColumn joinColumn : mapping.getJoinColumns()) {
- String table = joinColumn.getTable();
- boolean doContinue = joinColumn.isConnected();
-
- if (doContinue && typeMapping.tableNameIsInvalid(table)) {
- if (mapping.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_TABLE,
- new String[] {mapping.getPersistentAttribute().getName(), table, joinColumn.getName()},
- joinColumn, joinColumn.tableTextRange())
- );
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_COLUMN_UNRESOLVED_TABLE,
- new String[] {table, joinColumn.getName()},
- joinColumn, joinColumn.tableTextRange())
- );
- }
- doContinue = false;
- }
-
- if (doContinue && ! joinColumn.isResolved()) {
- if (mapping.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {mapping.getPersistentAttribute().getName(), joinColumn.getName()},
- joinColumn, joinColumn.nameTextRange())
- );
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getName()},
- joinColumn, joinColumn.nameTextRange())
- );
- }
- }
-
- if (doContinue && ! joinColumn.isReferencedColumnResolved()) {
- if (mapping.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {mapping.getPersistentAttribute().getName(), joinColumn.getReferencedColumnName(), joinColumn.getName()},
- joinColumn, joinColumn.referencedColumnNameTextRange())
- );
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME,
- new String[] {joinColumn.getReferencedColumnName(), joinColumn.getName()},
- joinColumn, joinColumn.referencedColumnNameTextRange())
- );
- }
- }
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlTypeContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlTypeContext.java
deleted file mode 100644
index aa221e58da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlTypeContext.java
+++ /dev/null
@@ -1,406 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.platform;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlBasic;
-import org.eclipse.jpt.core.internal.content.orm.XmlEmbedded;
-import org.eclipse.jpt.core.internal.content.orm.XmlEmbeddedId;
-import org.eclipse.jpt.core.internal.content.orm.XmlId;
-import org.eclipse.jpt.core.internal.content.orm.XmlManyToMany;
-import org.eclipse.jpt.core.internal.content.orm.XmlManyToOne;
-import org.eclipse.jpt.core.internal.content.orm.XmlNullAttributeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlOneToMany;
-import org.eclipse.jpt.core.internal.content.orm.XmlOneToOne;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentType;
-import org.eclipse.jpt.core.internal.content.orm.XmlTransient;
-import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlVersion;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public abstract class XmlTypeContext extends BaseContext
- implements TypeContext
-{
- private XmlTypeMapping xmlTypeMapping;
-
- private JavaTypeContext javaTypeContext;
-
- private Collection<XmlAttributeContext> attributeMappingContexts;
-
- private Collection<XmlAttributeContext> virtualAttributeMappingContexts;
-
- private boolean refreshed;
-
- public XmlTypeContext(MappingFileContext parentContext, XmlTypeMapping xmlTypeMapping) {
- super(parentContext);
- this.xmlTypeMapping = xmlTypeMapping;
- this.attributeMappingContexts = new ArrayList<XmlAttributeContext>();
- this.virtualAttributeMappingContexts = new ArrayList<XmlAttributeContext>();
- }
-
- public void initialize() {
- JavaPersistentType javaPersistentType = javaPersistentType();
- PersistenceUnitContext puContext = getMappingFileContext().getPersistenceUnitContext();
- if (javaPersistentType != null) {
- if (puContext.containsDuplicateJavaPersistentType(javaPersistentType)) {
- return;
- }
- JavaTypeContext javaContext =
- (JavaTypeContext) getPlatform().buildJavaTypeContext(this, javaPersistentType.getMapping());
- XmlTypeContext duplicate = puContext.xmlTypeMappingContextFor(javaPersistentType.getMapping());
- if (duplicate != null) {
- duplicate.setDuplicateJavaTypeMapping();
- puContext.addDuplicateJpaFile(javaContext);
- return;
- }
- this.javaTypeContext = javaContext;
- }
-
- initializeAttributeMappingContexts();
- }
-
- protected void initializeAttributeMappingContexts() {
- for (XmlAttributeMapping xmlAttributeMapping: this.xmlTypeMapping.getPersistentType().getSpecifiedAttributeMappings()) {
- this.attributeMappingContexts.add(buildContext(xmlAttributeMapping));
- }
- }
-
- protected XmlAttributeContext buildContext(XmlAttributeMapping attributeMapping) {
- String key = attributeMapping.getKey();
- if (key == IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY) {
- return new XmlIdContext(this, (XmlId) attributeMapping);
- }
- else if (key == IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY) {
- return new XmlBasicContext(this, (XmlBasic) attributeMapping);
- }
- else if (key == IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
- return new XmlOneToManyContext(this, (XmlOneToMany) attributeMapping);
- }
- else if (key == IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
- return new XmlManyToOneContext(this, (XmlManyToOne) attributeMapping);
- }
- else if (key == IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
- return new XmlManyToManyContext(this, (XmlManyToMany) attributeMapping);
- }
- else if (key == IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY) {
- return new XmlTransientContext(this, (XmlTransient) attributeMapping);
- }
- else if (key == IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY) {
- return new XmlEmbeddedContext(this, (XmlEmbedded) attributeMapping);
- }
- else if (key == IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY) {
- return new XmlEmbeddedIdContext(this, (XmlEmbeddedId) attributeMapping);
- }
- else if (key == IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY) {
- return new XmlVersionContext(this, (XmlVersion) attributeMapping);
- }
- else if (key == IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
- return new XmlOneToOneContext(this, (XmlOneToOne) attributeMapping);
- }
- else if (key == null) {
- return new XmlNullAttributeMappingContext(this, (XmlNullAttributeMapping) attributeMapping);
- }
- else {
- throw new IllegalArgumentException(attributeMapping.toString());
- }
- }
-
- protected void populateGeneratorRepository(GeneratorRepository generatorRepository) {
- //override as necessary
- }
-
- protected Collection<XmlAttributeContext> getXmlAttributeContexts() {
- return this.attributeMappingContexts;
- }
-
- protected MappingFileContext getMappingFileContext() {
- return (MappingFileContext) getParentContext();
- }
-
- protected XmlTypeMapping getXmlTypeMapping() {
- return this.xmlTypeMapping;
- }
-
- protected JavaTypeContext getJavaPersistentTypeContext() {
- return this.javaTypeContext;
- }
-
- protected IJavaTypeMapping getJavaTypeMapping() {
- if (this.javaTypeContext != null) {
- return this.javaTypeContext.getPersistentType().getMapping();
- }
- return null;
- }
-
- protected JavaPersistentType javaPersistentType() {
- return this.xmlTypeMapping.getPersistentType().findJavaPersistentType();
- }
-
- protected IJavaTypeMapping javaTypeMapping() {
- JavaPersistentType javaPersistentType = javaPersistentType();
- if (javaPersistentType != null) {
- return javaPersistentType.getMapping();
- }
- return null;
- }
- /**
- * A java class is specified to be mapped in to orm.xml files in the same persistence unit.
- * Null out the javaTypeMapping for this case, so that the context is no longer a particular
- * orm.xml file.
- */
- public void setDuplicateJavaTypeMapping() {
- this.javaTypeContext = null;
- }
-
- public DefaultsContext wrapDefaultsContext(DefaultsContext defaultsContext) {
- return new DefaultsContextWrapper(defaultsContext) {
- public Object getDefault(String key) {
- return XmlTypeContext.this.getDefault(key, getWrappedDefaultsContext());
- }
- @Override
- public CompilationUnit astRoot() {
- //TODO need to somehow not build this astRoot every time. can we store the JavaPersistentType we are finding?
- return javaPersistentType().getType().astRoot();
- }
- };
- }
-
-
- protected Object getDefault(String key, DefaultsContext defaultsContext) {
- return defaultsContext.getDefault(key);
- }
-
- public XmlPersistentType getPersistentType() {
- return getXmlTypeMapping().getPersistentType();
- }
-
- public boolean isRefreshed() {
- return this.refreshed;
- }
-
- private void checkCanceled(IProgressMonitor monitor) {
- if (monitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- }
-
- @Override
- public void refreshDefaults(DefaultsContext parentDefaults, IProgressMonitor monitor) {
- super.refreshDefaults(parentDefaults, monitor);
- this.refreshed = true;
- if (this.javaTypeContext != null) {
- this.javaTypeContext.refreshDefaults(parentDefaults, monitor);
- }
- refreshPersistentType(parentDefaults, monitor);
- DefaultsContext wrappedDefaultsContext = wrapDefaultsContext(parentDefaults);
- refreshTableContext(wrappedDefaultsContext, monitor);
- this.xmlTypeMapping.refreshDefaults(wrappedDefaultsContext);
-
- refreshAttributeMappingContextDefaults(wrappedDefaultsContext, monitor);
- }
-
- protected void refreshTableContext(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- }
-
- public void refreshAttributeMappingContextDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- for (XmlAttributeContext context : this.attributeMappingContexts) {
- checkCanceled(monitor);
- context.refreshDefaults(context.wrapDefaultsContext(defaultsContext), monitor);
- }
- for (XmlAttributeContext context : this.virtualAttributeMappingContexts) {
- checkCanceled(monitor);
- context.refreshDefaults(context.wrapDefaultsContext(defaultsContext), monitor);
- }
- }
-
- protected void refreshPersistentType(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- XmlPersistentType xmlPersistentType = this.getXmlTypeMapping().getPersistentType();
- xmlPersistentType.refreshDefaults(defaultsContext);
- //get the java attribute names
- //check the specified xml attributes (those with an element in the xml), add
- //a xmlAttribute mapping for any java attribute name with default = true
- //if we already have an xml attribute mapping, then do nothing,
- //the defaults refresh will get forwarded on the attribute mappings later.
- Collection<IPersistentAttribute> javaAttributes = javaAttributes();
- Collection<String> javaAttributeNames = new ArrayList<String>();
- for (IPersistentAttribute javaAttribute : javaAttributes) {
- checkCanceled(monitor);
- String javaAttributeName = javaAttribute.getName();
- javaAttributeNames.add(javaAttributeName);
- XmlPersistentAttribute xmlAttribute = xmlPersistentType.attributeNamed(javaAttributeName);
- if (xmlAttribute == null) {
- createAndAddXmlAttributeFrom(javaAttribute, xmlPersistentType);
- }
- else {
- if (xmlAttribute.isVirtual()) {
- if (xmlAttribute.typeMapping().isXmlMetadataComplete()) {
- xmlAttribute.setSpecifiedMappingKey(javaAttribute.defaultMappingKey());
- }
- else {
- xmlAttribute.setSpecifiedMappingKey(javaAttribute.mappingKey());
- }
- }
- }
- }
-
- Collection<String> specifiedXmlAttributeNames = new ArrayList<String>();
- for (XmlPersistentAttribute specifiedAttribute : xmlPersistentType.getSpecifiedPersistentAttributes()) {
- checkCanceled(monitor);
- String attributeName = specifiedAttribute.getName();
- if (! StringTools.stringIsEmpty(attributeName)) {
- specifiedXmlAttributeNames.add(attributeName);
- }
- }
-
- // remove virtual attribute if there's no java representation
- // *or* if it is mapped specifically
- Collection<XmlAttributeMapping> mappingsToRemove = new ArrayList<XmlAttributeMapping>();
- for (XmlAttributeMapping mapping : xmlPersistentType.getVirtualAttributeMappings()) {
- checkCanceled(monitor);
- String attributeName = mapping.getPersistentAttribute().getName();
- if (! javaAttributeNames.contains(attributeName)
- || specifiedXmlAttributeNames.contains(attributeName)) {
- mappingsToRemove.add(mapping);
- }
- }
-
- for (XmlAttributeMapping xmlAttributeMapping : mappingsToRemove) {
- xmlPersistentType.getVirtualAttributeMappings().remove(xmlAttributeMapping);
- }
-
- for (XmlAttributeMapping xmlAttributeMapping : this.xmlTypeMapping.getPersistentType().getVirtualAttributeMappings()) {
- this.virtualAttributeMappingContexts.add(buildContext(xmlAttributeMapping));
- }
- }
-
- private void createAndAddXmlAttributeFrom(IPersistentAttribute javaAttribute, XmlPersistentType persistentType) {
- //TODO also need to check xml mapping meta data complete flags and
- //probably move all of this code to the context classes
- XmlAttributeMapping xmlAttributeMapping = null;
- String mappingKey;
- if (persistentType.getMapping().isXmlMetadataComplete()) {
- mappingKey = javaAttribute.defaultMappingKey();
- }
- else {
- mappingKey = javaAttribute.getMapping().getKey();
- }
- if (mappingKey == IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY) {
- xmlAttributeMapping = OrmFactory.eINSTANCE.createXmlBasic();
- }
- else if (mappingKey == IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY) {
- xmlAttributeMapping = OrmFactory.eINSTANCE.createXmlId();
- }
- else if (mappingKey == IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
- xmlAttributeMapping = OrmFactory.eINSTANCE.createXmlManyToMany();
- }
- else if (mappingKey == IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
- xmlAttributeMapping = OrmFactory.eINSTANCE.createXmlManyToOne();
- }
- else if (mappingKey == IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
- xmlAttributeMapping = OrmFactory.eINSTANCE.createXmlOneToMany();
- }
- else if (mappingKey == IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY) {
- xmlAttributeMapping = OrmFactory.eINSTANCE.createXmlTransient();
- }
- else if (mappingKey == IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY) {
- xmlAttributeMapping = OrmFactory.eINSTANCE.createXmlEmbedded();
- }
- else if (mappingKey == IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY) {
- xmlAttributeMapping = OrmFactory.eINSTANCE.createXmlEmbeddedId();
- }
- else if (mappingKey == IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY) {
- xmlAttributeMapping = OrmFactory.eINSTANCE.createXmlVersion();
- }
- else if (mappingKey == IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
- xmlAttributeMapping = OrmFactory.eINSTANCE.createXmlOneToOne();
- }
- else if (mappingKey == null) {
- xmlAttributeMapping = OrmFactory.eINSTANCE.createXmlNullAttributeMapping();
- }
- //TODO this isn't the way to do it, should update all the settings on the default mapping
- // during the refresh defaults of attribute mappings
- //xmlAttributeMapping.initializeFromAttributeMapping(javaAttribute.getMapping());
- persistentType.getVirtualAttributeMappings().add(xmlAttributeMapping);
- xmlAttributeMapping.getPersistentAttribute().setName(javaAttribute.getName());
- }
-
- protected Collection<IPersistentAttribute> javaAttributes() {
- Collection<IPersistentAttribute> javaAttributes = new ArrayList<IPersistentAttribute>();
- JavaPersistentType javaPersistentType = javaPersistentType();
- if (javaPersistentType != null) {
- for (Iterator<JavaPersistentAttribute> i = javaPersistentType.attributes(); i.hasNext(); ) {
- JavaPersistentAttribute persistentAttribute = i.next();
- javaAttributes.add(persistentAttribute);
- }
- }
- return javaAttributes;
- }
-
- @Override
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
- addClassMessages(messages);
-
- for (XmlAttributeContext context : this.attributeMappingContexts) {
- context.addToMessages(messages);
- }
- for (XmlAttributeContext context : this.virtualAttributeMappingContexts) {
- context.addToMessages(messages);
- }
- }
-
- protected void addClassMessages(List<IMessage> messages) {
- addUnspecifiedClassMessage(messages);
- addUnresolvedClassMessage(messages);
- }
-
- protected void addUnspecifiedClassMessage(List<IMessage> messages) {
- XmlPersistentType persistentType = xmlTypeMapping.getPersistentType();
- if (StringTools.stringIsEmpty(persistentType.getClass_())) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENT_TYPE_UNSPECIFIED_CLASS,
- persistentType, persistentType.classTextRange())
- );
- }
- }
-
- protected void addUnresolvedClassMessage(List<IMessage> messages) {
- XmlPersistentType persistentType = xmlTypeMapping.getPersistentType();
- if (! StringTools.stringIsEmpty(persistentType.getClass_())
- && persistentType.findJdtType() == null) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.PERSISTENT_TYPE_UNRESOLVED_CLASS,
- new String[] {persistentType.getClass_()},
- persistentType, persistentType.classTextRange())
- );
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlVersionContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlVersionContext.java
deleted file mode 100644
index 7f7f313ade..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlVersionContext.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.platform;
-
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JavaVersion;
-import org.eclipse.jpt.core.internal.content.orm.XmlVersion;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.validation.IJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class XmlVersionContext
- extends XmlAttributeContext
-{
- private ColumnContext columnContext;
-
- public XmlVersionContext(
- IContext parentContext, XmlVersion xmlVersion) {
- super(parentContext, xmlVersion);
- this.columnContext = new ColumnContext(this, xmlVersion.getColumn());
- }
-
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext, IProgressMonitor monitor) {
- super.refreshDefaults(defaultsContext, monitor);
- this.columnContext.refreshDefaults(defaultsContext, monitor);
- }
-
- @Override
- protected Object getDefault(String key, DefaultsContext defaultsContext) {
- if (key.equals(BaseJpaPlatform.DEFAULT_COLUMN_NAME_KEY)) {
- if (attributeMapping().getPersistentAttribute().isVirtual()) {
- if (javaVersionMapping() != null) {
- if (!attributeMapping().getPersistentType().getMapping().isXmlMetadataComplete()) {
- return javaVersionMapping().getColumn().getName();
- }
- return javaVersionMapping().getColumn().getDefaultName();
- }
- }
- //doesn't matter what's in the java @Column annotation because it is completely
- //overriden as soon as you specify the attribute in xml.
- return attributeMapping().getPersistentAttribute().getName();
- }
-
- return super.getDefault(key, defaultsContext);
- }
-
- protected JavaVersion javaVersionMapping() {
- IAttributeMapping attributeMapping = javaAttributeMapping();
- if (attributeMapping.getKey() == IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY) {
- return (JavaVersion) attributeMapping;
- }
- return null;
- }
-
- protected XmlVersion getVersion() {
- return (XmlVersion) attributeMapping();
- }
-
- public void addToMessages(List<IMessage> messages) {
- super.addToMessages(messages);
-
- if (entityOwned()) {
- addColumnMessages(messages);
- }
- }
-
- protected void addColumnMessages(List<IMessage> messages) {
- XmlVersion version = getVersion();
- ITypeMapping typeMapping = version.typeMapping();
- IColumn column = version.getColumn();
- String table = column.getTable();
- boolean doContinue = entityOwned() && column.isConnected();
-
- if (doContinue && typeMapping.tableNameIsInvalid(table)) {
- if (version.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_TABLE,
- new String[] {version.getPersistentAttribute().getName(), table, column.getName()},
- column, column.tableTextRange())
- );
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.COLUMN_UNRESOLVED_TABLE,
- new String[] {table, column.getName()},
- column, column.tableTextRange())
- );
- }
- doContinue = false;
- }
-
- if (doContinue && ! column.isResolved()) {
- if (version.isVirtual()) {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME,
- new String[] {version.getPersistentAttribute().getName(), column.getName()},
- column, column.nameTextRange())
- );
- }
- else {
- messages.add(
- JpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- IJpaValidationMessages.COLUMN_UNRESOLVED_NAME,
- new String[] {column.getName()},
- column, column.nameTextRange())
- );
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/base/BaseJpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/base/BaseJpaAnnotationProvider.java
new file mode 100644
index 0000000000..5950f21c60
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/base/BaseJpaAnnotationProvider.java
@@ -0,0 +1,326 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.platform.base;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.IJpaAnnotationProvider;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.Type;
+import org.eclipse.jpt.core.internal.resource.java.Annotation;
+import org.eclipse.jpt.core.internal.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.AssociationOverrideImpl.AssociationOverrideAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.AssociationOverridesImpl.AssociationOverridesAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverrideImpl.AttributeOverrideAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverridesImpl.AttributeOverridesAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.BasicImpl.BasicAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.ColumnImpl.ColumnAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.DiscriminatorColumnImpl.DiscriminatorColumnAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.DiscriminatorValueImpl.DiscriminatorValueAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddableImpl.EmbeddableAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddedIdImpl.EmbeddedIdAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddedImpl.EmbeddedAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.EntityImpl.EntityAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.EnumeratedImpl.EnumeratedAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.GeneratedValueImpl.GeneratedValueAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.IdClassImpl.IdClassAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.IdImpl.IdAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.InheritanceImpl.InheritanceAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumnImpl.JoinColumnAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumnsImpl.JoinColumnsAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.JoinTableImpl.JoinTableAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.LobImpl.LobAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.ManyToManyImpl.ManyToManyAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.ManyToOneImpl.ManyToOneAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.MapKeyImpl.MapKeyAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.MappedSuperclassImpl.MappedSuperclassAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueriesImpl.NamedNativeQueriesAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueryImpl.NamedNativeQueryAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.NamedQueriesImpl.NamedQueriesAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.NamedQueryImpl.NamedQueryAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.OneToManyImpl.OneToManyAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.OneToOneImpl.OneToOneAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.OrderByImpl.OrderByAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumnImpl.PrimaryKeyJoinColumnAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumnsImpl.PrimaryKeyJoinColumnsAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.SecondaryTableImpl.SecondaryTableAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.SecondaryTablesImpl.SecondaryTablesAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.SequenceGeneratorImpl.SequenceGeneratorAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.TableGeneratorImpl.TableGeneratorAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.TableImpl.TableAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.TemporalImpl.TemporalAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.TransientImpl.TransientAnnotationDefinition;
+import org.eclipse.jpt.core.internal.resource.java.VersionImpl.VersionAnnotationDefinition;
+import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.utility.internal.iterators.TransformationListIterator;
+
+public abstract class BaseJpaAnnotationProvider implements IJpaAnnotationProvider
+{
+ /**
+ * Ordered list of possible type mapping annotations. Ordered because this
+ * is used to determine the mapping in the case where 2 mapping annotations exist
+ */
+ private List<AnnotationDefinition> typeMappingAnnotationDefinitions;
+
+ private Collection<AnnotationDefinition> typeAnnotationDefinitions;
+
+ /**
+ * Ordered list of possible attribute mapping annotations. Ordered because this
+ * is used to determine the mapping in the case where 2 mapping annotations exist
+ */
+ private List<AnnotationDefinition> attributeMappingAnnotationDefinitions;
+
+ private Collection<AnnotationDefinition> attributeAnnotationDefinitions;
+
+
+ protected BaseJpaAnnotationProvider() {
+ super();
+ }
+
+
+ protected ListIterator<AnnotationDefinition> typeMappingAnnotationDefinitions() {
+ if (this.typeMappingAnnotationDefinitions == null) {
+ this.typeMappingAnnotationDefinitions = new ArrayList<AnnotationDefinition>();
+ this.addTypeMappingAnnotationDefinitionsTo(this.typeMappingAnnotationDefinitions);
+ }
+ return new CloneListIterator<AnnotationDefinition>(this.typeMappingAnnotationDefinitions);
+ }
+
+ /**
+ * Override this to specify more or different type mapping definitions.
+ * The default includes the JPA spec-defined type mappings of
+ * Embeddable, Entity, MappedSuperclass
+ */
+ protected void addTypeMappingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
+ definitions.add(EmbeddableAnnotationDefinition.instance());
+ definitions.add(EntityAnnotationDefinition.instance());
+ definitions.add(MappedSuperclassAnnotationDefinition.instance());
+ }
+
+ protected Iterator<AnnotationDefinition> typeAnnotationDefinitions() {
+ if (this.typeAnnotationDefinitions == null) {
+ this.typeAnnotationDefinitions = new ArrayList<AnnotationDefinition>();
+ this.addTypeAnnotationDefinitionsTo(this.typeAnnotationDefinitions);
+ }
+ return new CloneIterator<AnnotationDefinition>(this.typeAnnotationDefinitions);
+ }
+
+ /**
+ * Override this to specify more or different type annotation definitions.
+ * The default includes the JPA spec-defined annotations.
+ */
+ protected void addTypeAnnotationDefinitionsTo(Collection<AnnotationDefinition> definitions) {
+ definitions.add(AssociationOverrideAnnotationDefinition.instance());
+ definitions.add(AssociationOverridesAnnotationDefinition.instance());
+ definitions.add(AttributeOverrideAnnotationDefinition.instance());
+ definitions.add(AttributeOverrideAnnotationDefinition.instance());
+ definitions.add(AttributeOverridesAnnotationDefinition.instance());
+ definitions.add(DiscriminatorColumnAnnotationDefinition.instance());
+ definitions.add(DiscriminatorValueAnnotationDefinition.instance());
+ definitions.add(IdClassAnnotationDefinition.instance());
+ definitions.add(InheritanceAnnotationDefinition.instance());
+ definitions.add(NamedQueryAnnotationDefinition.instance());
+ definitions.add(NamedQueriesAnnotationDefinition.instance());
+ definitions.add(NamedNativeQueryAnnotationDefinition.instance());
+ definitions.add(NamedNativeQueriesAnnotationDefinition.instance());
+ definitions.add(PrimaryKeyJoinColumnAnnotationDefinition.instance());
+ definitions.add(PrimaryKeyJoinColumnsAnnotationDefinition.instance());
+ definitions.add(SecondaryTableAnnotationDefinition.instance());
+ definitions.add(SecondaryTablesAnnotationDefinition.instance());
+ definitions.add(SequenceGeneratorAnnotationDefinition.instance());
+ definitions.add(TableAnnotationDefinition.instance());
+ definitions.add(TableGeneratorAnnotationDefinition.instance());
+ }
+
+ protected ListIterator<AnnotationDefinition> attributeMappingAnnotationDefinitions() {
+ if (this.attributeMappingAnnotationDefinitions == null) {
+ this.attributeMappingAnnotationDefinitions = new ArrayList<AnnotationDefinition>();
+ this.addAttributeMappingAnnotationDefinitionsTo(this.attributeMappingAnnotationDefinitions);
+ }
+ return new CloneListIterator<AnnotationDefinition>(this.attributeMappingAnnotationDefinitions);
+ }
+
+ /**
+ * Override this to specify more or different attribute mapping definitions.
+ * The default includes the JPA spec-defined attribute mappings of
+ * Basic, Id, Transient OneToOne, OneToMany, ManyToOne, ManyToMany, Embedded, EmbeddedId, Version.
+ */
+ protected void addAttributeMappingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
+ definitions.add(BasicAnnotationDefinition.instance());
+ definitions.add(EmbeddedAnnotationDefinition.instance());
+ definitions.add(EmbeddedIdAnnotationDefinition.instance());
+ definitions.add(IdAnnotationDefinition.instance());
+ definitions.add(ManyToManyAnnotationDefinition.instance());
+ definitions.add(ManyToOneAnnotationDefinition.instance());
+ definitions.add(OneToManyAnnotationDefinition.instance());
+ definitions.add(OneToOneAnnotationDefinition.instance());
+ definitions.add(TransientAnnotationDefinition.instance());
+ definitions.add(VersionAnnotationDefinition.instance());
+ }
+
+ protected Iterator<AnnotationDefinition> attributeAnnotationDefinitions() {
+ if (this.attributeAnnotationDefinitions == null) {
+ this.attributeAnnotationDefinitions = new ArrayList<AnnotationDefinition>();
+ this.addAttributeAnnotationDefinitionsTo(this.attributeAnnotationDefinitions);
+ }
+ return new CloneIterator<AnnotationDefinition>(this.attributeAnnotationDefinitions);
+ }
+
+ /**
+ * Override this to specify more or different attribute annotation definitions.
+ * The default includes the JPA spec-defined annotations.
+ */
+ protected void addAttributeAnnotationDefinitionsTo(Collection<AnnotationDefinition> definitions) {
+ definitions.add(AssociationOverrideAnnotationDefinition.instance());
+ definitions.add(AssociationOverridesAnnotationDefinition.instance());
+ definitions.add(AttributeOverrideAnnotationDefinition.instance());
+ definitions.add(AttributeOverridesAnnotationDefinition.instance());
+ definitions.add(ColumnAnnotationDefinition.instance());
+ definitions.add(EnumeratedAnnotationDefinition.instance());
+ definitions.add(GeneratedValueAnnotationDefinition.instance());
+ definitions.add(JoinColumnAnnotationDefinition.instance());
+ definitions.add(JoinColumnsAnnotationDefinition.instance());
+ definitions.add(JoinTableAnnotationDefinition.instance());
+ definitions.add(LobAnnotationDefinition.instance());
+ definitions.add(MapKeyAnnotationDefinition.instance());
+ definitions.add(OrderByAnnotationDefinition.instance());
+ definitions.add(PrimaryKeyJoinColumnAnnotationDefinition.instance());
+ definitions.add(PrimaryKeyJoinColumnsAnnotationDefinition.instance());
+ definitions.add(SequenceGeneratorAnnotationDefinition.instance());
+ definitions.add(TableGeneratorAnnotationDefinition.instance());
+ definitions.add(TemporalAnnotationDefinition.instance());
+ }
+
+ //********************* IJpaPlatform implementation *************************
+
+ public Annotation buildTypeMappingAnnotation(JavaPersistentTypeResource parent, Type type, String mappingAnnotationName) {
+ AnnotationDefinition annotationDefinition = typeMappingAnnotationDefinition(mappingAnnotationName);
+ return annotationDefinition.buildAnnotation(parent, type);
+ }
+
+ public Annotation buildNullTypeMappingAnnotation(JavaPersistentTypeResource parent, Type type, String mappingAnnotationName) {
+ AnnotationDefinition annotationDefinition = typeMappingAnnotationDefinition(mappingAnnotationName);
+ return annotationDefinition.buildNullAnnotation(parent, type);
+ }
+
+ public Annotation buildTypeAnnotation(JavaPersistentTypeResource parent, Type type, String annotationName) {
+ AnnotationDefinition annotationDefinition = typeAnnotationDefinition(annotationName);
+ return annotationDefinition.buildAnnotation(parent, type);
+ }
+
+ public Annotation buildNullTypeAnnotation(JavaPersistentTypeResource parent, Type type, String annotationName) {
+ AnnotationDefinition annotationDefinition = typeAnnotationDefinition(annotationName);
+ return annotationDefinition.buildNullAnnotation(parent, type);
+ }
+
+ public ListIterator<String> typeMappingAnnotationNames() {
+ return new TransformationListIterator<AnnotationDefinition, String>(typeMappingAnnotationDefinitions()) {
+ @Override
+ protected String transform(AnnotationDefinition next) {
+ return next.getAnnotationName();
+ }
+ };
+ }
+
+ public Iterator<String> typeAnnotationNames() {
+ return new TransformationIterator<AnnotationDefinition, String>(typeAnnotationDefinitions()) {
+ @Override
+ protected String transform(AnnotationDefinition next) {
+ return next.getAnnotationName();
+ }
+ };
+ }
+
+ public Annotation buildAttributeMappingAnnotation(JavaPersistentAttributeResource parent, Attribute attribute, String mappingAnnotationName) {
+ AnnotationDefinition annotationDefinition = attributeMappingAnnotationDefinition(mappingAnnotationName);
+ return annotationDefinition.buildAnnotation(parent, attribute);
+ }
+
+ public Annotation buildNullAttributeMappingAnnotation(JavaPersistentAttributeResource parent, Attribute attribute, String annotationName) {
+ AnnotationDefinition annotationDefinition = attributeMappingAnnotationDefinition(annotationName);
+ return annotationDefinition.buildNullAnnotation(parent, attribute);
+ }
+
+ public Annotation buildAttributeAnnotation(JavaPersistentAttributeResource parent, Attribute attribute, String annotationName) {
+ AnnotationDefinition annotationDefinition = attributeAnnotationDefinition(annotationName);
+ return annotationDefinition.buildAnnotation(parent, attribute);
+ }
+
+ public Annotation buildNullAttributeAnnotation(JavaPersistentAttributeResource parent, Attribute attribute, String annotationName) {
+ AnnotationDefinition annotationDefinition = attributeAnnotationDefinition(annotationName);
+ return annotationDefinition.buildNullAnnotation(parent, attribute);
+ }
+
+ public ListIterator<String> attributeMappingAnnotationNames() {
+ return new TransformationListIterator<AnnotationDefinition, String>(attributeMappingAnnotationDefinitions()) {
+ @Override
+ protected String transform(AnnotationDefinition next) {
+ return next.getAnnotationName();
+ }
+ };
+ }
+
+ public Iterator<String> attributeAnnotationNames() {
+ return new TransformationIterator<AnnotationDefinition, String>(attributeAnnotationDefinitions()) {
+ @Override
+ protected String transform(AnnotationDefinition next) {
+ return next.getAnnotationName();
+ }
+ };
+ }
+
+ private AnnotationDefinition typeMappingAnnotationDefinition(String mappingAnnotationName) {
+ for (ListIterator<AnnotationDefinition> i = typeMappingAnnotationDefinitions(); i.hasNext(); ) {
+ AnnotationDefinition definition = i.next();
+ if (definition.getAnnotationName().equals(mappingAnnotationName)) {
+ return definition;
+ }
+ }
+ throw new IllegalArgumentException(mappingAnnotationName + " is an unsupported type mapping annotation");
+ }
+
+ private AnnotationDefinition typeAnnotationDefinition(String annotationName) {
+ for (Iterator<AnnotationDefinition> i = typeAnnotationDefinitions(); i.hasNext(); ) {
+ AnnotationDefinition definition = i.next();
+ if (definition.getAnnotationName().equals(annotationName)) {
+ return definition;
+ }
+ }
+ throw new IllegalArgumentException(annotationName + " is an unsupported type annotation");
+ }
+
+ private AnnotationDefinition attributeMappingAnnotationDefinition(String mappingAnnotationName) {
+ for (ListIterator<AnnotationDefinition> i = attributeMappingAnnotationDefinitions(); i.hasNext(); ) {
+ AnnotationDefinition definition = i.next();
+ if (definition.getAnnotationName().equals(mappingAnnotationName)) {
+ return definition;
+ }
+ }
+ throw new IllegalArgumentException(mappingAnnotationName + " is an unsupported attribute mapping annotation");
+ }
+
+ private AnnotationDefinition attributeAnnotationDefinition(String annotationName) {
+ for (Iterator<AnnotationDefinition> i = attributeAnnotationDefinitions(); i.hasNext(); ) {
+ AnnotationDefinition definition = i.next();
+ if (definition.getAnnotationName().equals(annotationName)) {
+ return definition;
+ }
+ }
+ throw new IllegalArgumentException(annotationName + " is an unsupported attribute annotation");
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/base/BaseJpaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/base/BaseJpaFactory.java
new file mode 100644
index 0000000000..e0d97f71ce
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/base/BaseJpaFactory.java
@@ -0,0 +1,424 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.platform.base;
+
+import java.io.IOException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jpt.core.internal.IContextModel;
+import org.eclipse.jpt.core.internal.IJpaDataSource;
+import org.eclipse.jpt.core.internal.IJpaFile;
+import org.eclipse.jpt.core.internal.IJpaProject;
+import org.eclipse.jpt.core.internal.IResourceModel;
+import org.eclipse.jpt.core.internal.JpaDataSource;
+import org.eclipse.jpt.core.internal.JpaFile;
+import org.eclipse.jpt.core.internal.JpaProject;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.BaseJpaContent;
+import org.eclipse.jpt.core.internal.context.base.ClassRef;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IBaseJpaContent;
+import org.eclipse.jpt.core.internal.context.base.IClassRef;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.IMappingFileRef;
+import org.eclipse.jpt.core.internal.context.base.INamedColumn;
+import org.eclipse.jpt.core.internal.context.base.IPersistence;
+import org.eclipse.jpt.core.internal.context.base.IPersistenceUnit;
+import org.eclipse.jpt.core.internal.context.base.IPersistenceXml;
+import org.eclipse.jpt.core.internal.context.base.IProperty;
+import org.eclipse.jpt.core.internal.context.base.MappingFileRef;
+import org.eclipse.jpt.core.internal.context.base.Persistence;
+import org.eclipse.jpt.core.internal.context.base.PersistenceUnit;
+import org.eclipse.jpt.core.internal.context.base.PersistenceXml;
+import org.eclipse.jpt.core.internal.context.base.Property;
+import org.eclipse.jpt.core.internal.context.base.IOverride.Owner;
+import org.eclipse.jpt.core.internal.context.java.IJavaAssociationOverride;
+import org.eclipse.jpt.core.internal.context.java.IJavaAttributeMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaAttributeOverride;
+import org.eclipse.jpt.core.internal.context.java.IJavaBasicMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaColumn;
+import org.eclipse.jpt.core.internal.context.java.IJavaDiscriminatorColumn;
+import org.eclipse.jpt.core.internal.context.java.IJavaEmbeddable;
+import org.eclipse.jpt.core.internal.context.java.IJavaEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaEntity;
+import org.eclipse.jpt.core.internal.context.java.IJavaGeneratedValue;
+import org.eclipse.jpt.core.internal.context.java.IJavaIdMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaJoinColumn;
+import org.eclipse.jpt.core.internal.context.java.IJavaJoinTable;
+import org.eclipse.jpt.core.internal.context.java.IJavaJpaContextNode;
+import org.eclipse.jpt.core.internal.context.java.IJavaManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaMappedSuperclass;
+import org.eclipse.jpt.core.internal.context.java.IJavaNamedNativeQuery;
+import org.eclipse.jpt.core.internal.context.java.IJavaNamedQuery;
+import org.eclipse.jpt.core.internal.context.java.IJavaOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.context.java.IJavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.context.java.IJavaQuery;
+import org.eclipse.jpt.core.internal.context.java.IJavaQueryHint;
+import org.eclipse.jpt.core.internal.context.java.IJavaRelationshipMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaSecondaryTable;
+import org.eclipse.jpt.core.internal.context.java.IJavaSequenceGenerator;
+import org.eclipse.jpt.core.internal.context.java.IJavaTable;
+import org.eclipse.jpt.core.internal.context.java.IJavaTableGenerator;
+import org.eclipse.jpt.core.internal.context.java.IJavaTransientMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaTypeMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaVersionMapping;
+import org.eclipse.jpt.core.internal.context.java.JavaAssociationOverride;
+import org.eclipse.jpt.core.internal.context.java.JavaAttributeOverride;
+import org.eclipse.jpt.core.internal.context.java.JavaBasicMapping;
+import org.eclipse.jpt.core.internal.context.java.JavaColumn;
+import org.eclipse.jpt.core.internal.context.java.JavaDiscriminatorColumn;
+import org.eclipse.jpt.core.internal.context.java.JavaEmbeddable;
+import org.eclipse.jpt.core.internal.context.java.JavaEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.java.JavaEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.java.JavaEntity;
+import org.eclipse.jpt.core.internal.context.java.JavaGeneratedValue;
+import org.eclipse.jpt.core.internal.context.java.JavaIdMapping;
+import org.eclipse.jpt.core.internal.context.java.JavaJoinColumn;
+import org.eclipse.jpt.core.internal.context.java.JavaJoinTable;
+import org.eclipse.jpt.core.internal.context.java.JavaManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.java.JavaManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.java.JavaMappedSuperclass;
+import org.eclipse.jpt.core.internal.context.java.JavaNamedNativeQuery;
+import org.eclipse.jpt.core.internal.context.java.JavaNamedQuery;
+import org.eclipse.jpt.core.internal.context.java.JavaNullAttributeMapping;
+import org.eclipse.jpt.core.internal.context.java.JavaNullTypeMapping;
+import org.eclipse.jpt.core.internal.context.java.JavaOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.java.JavaOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.JavaPersistentType;
+import org.eclipse.jpt.core.internal.context.java.JavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.context.java.JavaQueryHint;
+import org.eclipse.jpt.core.internal.context.java.JavaSecondaryTable;
+import org.eclipse.jpt.core.internal.context.java.JavaSequenceGenerator;
+import org.eclipse.jpt.core.internal.context.java.JavaTable;
+import org.eclipse.jpt.core.internal.context.java.JavaTableGenerator;
+import org.eclipse.jpt.core.internal.context.java.JavaTransientMapping;
+import org.eclipse.jpt.core.internal.context.java.JavaVersionMapping;
+import org.eclipse.jpt.core.internal.context.orm.EntityMappings;
+import org.eclipse.jpt.core.internal.context.orm.EntityMappingsImpl;
+import org.eclipse.jpt.core.internal.context.orm.OrmXml;
+import org.eclipse.jpt.core.internal.context.orm.OrmXmlImpl;
+import org.eclipse.jpt.core.internal.context.orm.PersistenceUnitDefaults;
+import org.eclipse.jpt.core.internal.context.orm.PersistenceUnitDefaultsImpl;
+import org.eclipse.jpt.core.internal.context.orm.PersistenceUnitMetadata;
+import org.eclipse.jpt.core.internal.context.orm.PersistenceUnitMetadataImpl;
+import org.eclipse.jpt.core.internal.context.orm.XmlEmbeddable;
+import org.eclipse.jpt.core.internal.context.orm.XmlEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlMappedSuperclass;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.jdtutility.DefaultAnnotationEditFormatter;
+import org.eclipse.jpt.core.internal.resource.java.JavaResourceModel;
+import org.eclipse.jpt.core.internal.resource.orm.OrmResourceModel;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResourceModel;
+
+public abstract class BaseJpaFactory implements IJpaBaseContextFactory
+{
+ protected BaseJpaFactory() {
+ super();
+ }
+
+
+ // **************** Core objects ******************************************
+
+ public IJpaProject createJpaProject(IJpaProject.Config config) throws CoreException {
+ return new JpaProject(config);
+ }
+
+ public IJpaDataSource createJpaDataSource(IJpaProject jpaProject, String connectionProfileName) {
+ return new JpaDataSource(jpaProject, connectionProfileName);
+ }
+
+ public IJpaFile createJpaFile(IJpaProject jpaProject, IFile file, IResourceModel resourceModel) {
+ return new JpaFile(jpaProject, file, resourceModel);
+ }
+
+
+ // **************** Resource objects **************************************
+
+ public boolean hasRelevantContent(IFile file) {
+ if (! JavaCore.create(file.getProject()).isOnClasspath(file)) {
+ return false;
+ }
+ IContentType contentType = this.contentType(file);
+ if (contentType == null) {
+ return false;
+ }
+ String contentTypeId = contentType.getId();
+ return supportsContentType(contentTypeId);
+ }
+
+ protected boolean supportsContentType(String contentTypeId) {
+ return contentTypeId.equals(JavaCore.JAVA_SOURCE_CONTENT_TYPE)
+ || contentTypeId.equals(JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)
+ || contentTypeId.equals(JptCorePlugin.ORM_XML_CONTENT_TYPE);
+ }
+
+ public IResourceModel buildResourceModel(IJpaProject jpaProject, IFile file) {
+ if (! JavaCore.create(jpaProject.project()).isOnClasspath(file)) {
+ throw new IllegalArgumentException("The file" + file + " is not on the project classpath");
+ }
+ IContentType contentType = this.contentType(file);
+ if (contentType == null) {
+ throw new IllegalArgumentException("The file" + file + " does not have a supported content type");
+ }
+ String contentTypeId = contentType.getId();
+ return buildResourceModel(jpaProject, file, contentTypeId);
+ }
+
+ protected IResourceModel buildResourceModel(IJpaProject jpaProject, IFile file, String contentTypeId) {
+ if (JavaCore.JAVA_SOURCE_CONTENT_TYPE.equals(contentTypeId)) {
+ return buildJavaResourceModel(jpaProject, file);
+ }
+ else if (JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE.equals(contentTypeId)) {
+ return buildPersistenceResourceModel(file);
+ }
+ else if (JptCorePlugin.ORM_XML_CONTENT_TYPE.equals(contentTypeId)) {
+ return buildOrmResourceModel(file);
+ }
+
+ return null;
+ }
+
+ protected IResourceModel buildJavaResourceModel(IJpaProject jpaProject, IFile file) {
+ return new JavaResourceModel(
+ file, jpaProject.jpaPlatform().annotationProvider(),
+ jpaProject.modifySharedDocumentCommandExecutorProvider(),
+ DefaultAnnotationEditFormatter.instance());
+ }
+
+ protected IResourceModel buildPersistenceResourceModel(IFile file) {
+ return new PersistenceResourceModel(file);
+ }
+
+ protected IResourceModel buildOrmResourceModel(IFile file) {
+ return new OrmResourceModel(file);
+ }
+
+ // attempting to get the contentType based on the file contents.
+ // have to check the file contents instead of just the file name
+ // because for xml we base it on the rootElement name
+ private IContentType contentType(IFile file) {
+ try {
+ return Platform.getContentTypeManager().findContentTypeFor(file.getContents(), file.getName());
+ }
+ catch (IOException ex) {
+ JptCorePlugin.log(ex);
+ }
+ catch (CoreException ex) {
+ JptCorePlugin.log(ex);
+ }
+ return null;
+ }
+
+
+ // **************** Context objects ***************************************
+
+ public IContextModel buildContextModel(IJpaProject parent) {
+ return new BaseJpaContent(parent);
+ }
+
+ public IPersistenceXml createPersistenceXml(IBaseJpaContent parent) {
+ return new PersistenceXml(parent);
+ }
+
+ public OrmXml createOrmXml(IMappingFileRef parent) {
+ return new OrmXmlImpl(parent);
+ }
+
+ public EntityMappings createEntityMappings(OrmXml parent) {
+ return new EntityMappingsImpl(parent);
+ }
+
+ public PersistenceUnitMetadata createPersistenceUnitMetadata(EntityMappings parent) {
+ return new PersistenceUnitMetadataImpl(parent);
+ }
+
+ public PersistenceUnitDefaults createPersistenceUnitDefaults(PersistenceUnitMetadata parent) {
+ return new PersistenceUnitDefaultsImpl(parent);
+ }
+
+ public IPersistence createPersistence(IPersistenceXml parent) {
+ return new Persistence(parent);
+ }
+
+ public IPersistenceUnit createPersistenceUnit(IPersistence parent) {
+ return new PersistenceUnit(parent);
+ }
+
+ public IMappingFileRef createMappingFileRef(IPersistenceUnit parent) {
+ return new MappingFileRef(parent);
+ }
+
+ public IClassRef createClassRef(IPersistenceUnit parent) {
+ return new ClassRef(parent);
+ }
+
+ public IProperty createProperty(IPersistenceUnit parent) {
+ return new Property(parent);
+ }
+
+ public IJavaPersistentType createJavaPersistentType(IJpaContextNode parent) {
+ return new JavaPersistentType(parent);
+ }
+
+ public IJavaPersistentAttribute createJavaPersistentAttribute(IJavaPersistentType parent) {
+ return new JavaPersistentAttribute(parent);
+ }
+
+ public IJavaTypeMapping createJavaNullTypeMapping(IJavaPersistentType parent) {
+ return new JavaNullTypeMapping(parent);
+ }
+
+ public IJavaEntity createJavaEntity(IJavaPersistentType parent) {
+ return new JavaEntity(parent);
+ }
+
+ public IJavaMappedSuperclass createJavaMappedSuperclass(IJavaPersistentType parent) {
+ return new JavaMappedSuperclass(parent);
+ }
+
+ public IJavaEmbeddable createJavaEmbeddable(IJavaPersistentType parent) {
+ return new JavaEmbeddable(parent);
+ }
+
+ public IJavaTable createJavaTable(IJavaEntity parent) {
+ return new JavaTable(parent);
+ }
+
+ public IJavaColumn createJavaColumn(IJavaJpaContextNode parent, IJavaColumn.Owner owner) {
+ return new JavaColumn(parent, owner);
+ }
+
+ public IJavaDiscriminatorColumn createJavaDiscriminatorColumn(IJavaEntity parent, INamedColumn.Owner owner) {
+ return new JavaDiscriminatorColumn(parent, owner);
+ }
+
+ public IJavaJoinColumn createJavaJoinColumn(IJavaJpaContextNode parent, IJoinColumn.Owner owner) {
+ return new JavaJoinColumn(parent, owner);
+ }
+
+ public IJavaJoinTable createJavaJoinTable(IJavaRelationshipMapping parent) {
+ return new JavaJoinTable(parent);
+ }
+
+ public IJavaSecondaryTable createJavaSecondaryTable(IJavaEntity parent) {
+ return new JavaSecondaryTable(parent);
+ }
+
+ public IJavaBasicMapping createJavaBasicMapping(IJavaPersistentAttribute parent) {
+ return new JavaBasicMapping(parent);
+ }
+
+ public IJavaEmbeddedIdMapping createJavaEmbeddedIdMapping(IJavaPersistentAttribute parent) {
+ return new JavaEmbeddedIdMapping(parent);
+ }
+
+ public IJavaEmbeddedMapping createJavaEmbeddedMapping(IJavaPersistentAttribute parent) {
+ return new JavaEmbeddedMapping(parent);
+ }
+
+ public IJavaIdMapping createJavaIdMapping(IJavaPersistentAttribute parent) {
+ return new JavaIdMapping(parent);
+ }
+
+ public IJavaManyToManyMapping createJavaManyToManyMapping(IJavaPersistentAttribute parent) {
+ return new JavaManyToManyMapping(parent);
+ }
+
+ public IJavaManyToOneMapping createJavaManyToOneMapping(IJavaPersistentAttribute parent) {
+ return new JavaManyToOneMapping(parent);
+ }
+
+ public IJavaOneToManyMapping createJavaOneToManyMapping(IJavaPersistentAttribute parent) {
+ return new JavaOneToManyMapping(parent);
+ }
+
+ public IJavaOneToOneMapping createJavaOneToOneMapping(IJavaPersistentAttribute parent) {
+ return new JavaOneToOneMapping(parent);
+ }
+
+ public IJavaTransientMapping createJavaTransientMapping(IJavaPersistentAttribute parent) {
+ return new JavaTransientMapping(parent);
+ }
+
+ public IJavaVersionMapping createJavaVersionMapping(IJavaPersistentAttribute parent) {
+ return new JavaVersionMapping(parent);
+ }
+
+ public IJavaAttributeMapping createJavaNullAttributeMapping(IJavaPersistentAttribute parent) {
+ return new JavaNullAttributeMapping(parent);
+ }
+
+ public IJavaSequenceGenerator createJavaSequenceGenerator(IJavaJpaContextNode parent) {
+ return new JavaSequenceGenerator(parent);
+ }
+
+ public IJavaTableGenerator createJavaTableGenerator(IJavaJpaContextNode parent) {
+ return new JavaTableGenerator(parent);
+ }
+
+ public IJavaGeneratedValue createJavaGeneratedValue(IJavaAttributeMapping parent) {
+ return new JavaGeneratedValue(parent);
+ }
+
+ public IJavaPrimaryKeyJoinColumn createJavaPrimaryKeyJoinColumn(IJavaJpaContextNode parent, IAbstractJoinColumn.Owner owner) {
+ return new JavaPrimaryKeyJoinColumn(parent, owner);
+ }
+
+ public IJavaAttributeOverride createJavaAttributeOverride(IJavaJpaContextNode parent, Owner owner) {
+ return new JavaAttributeOverride(parent, owner);
+ }
+
+ public IJavaAssociationOverride createJavaAssociationOverride(IJavaJpaContextNode parent, Owner owner) {
+ return new JavaAssociationOverride(parent, owner);
+ }
+
+ public IJavaNamedQuery createJavaNamedQuery(IJavaJpaContextNode parent) {
+ return new JavaNamedQuery(parent);
+ }
+
+ public IJavaNamedNativeQuery createJavaNamedNativeQuery(IJavaJpaContextNode parent) {
+ return new JavaNamedNativeQuery(parent);
+ }
+
+ public IJavaQueryHint createJavaQueryHint(IJavaQuery<?> parent) {
+ return new JavaQueryHint(parent);
+ }
+
+ public XmlPersistentType createXmlPersistentType(EntityMappings parent, String mappingKey) {
+ return new XmlPersistentType(parent, mappingKey);
+ }
+
+ public XmlEntity createXmlEntity(XmlPersistentType parent) {
+ return new XmlEntity(parent);
+ }
+
+ public XmlMappedSuperclass createXmlMappedSuperclass(XmlPersistentType parent) {
+ return new XmlMappedSuperclass(parent);
+ }
+
+ public XmlEmbeddable createXmlEmbeddable(XmlPersistentType parent) {
+ return new XmlEmbeddable(parent);
+ }
+
+ public XmlPersistentAttribute createXmlPersistentAttribute(XmlPersistentType parent, String mappingKey) {
+ return new XmlPersistentAttribute(parent, mappingKey);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/base/BaseJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/base/BaseJpaPlatform.java
new file mode 100644
index 0000000000..78f3d4de62
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/base/BaseJpaPlatform.java
@@ -0,0 +1,275 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.platform.base;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jpt.core.internal.IJpaAnnotationProvider;
+import org.eclipse.jpt.core.internal.IJpaFactory;
+import org.eclipse.jpt.core.internal.IJpaFile;
+import org.eclipse.jpt.core.internal.IJpaPlatform;
+import org.eclipse.jpt.core.internal.IJpaProject;
+import org.eclipse.jpt.core.internal.IResourceModel;
+import org.eclipse.jpt.core.internal.context.base.BaseJpaContent;
+import org.eclipse.jpt.core.internal.context.java.IDefaultJavaAttributeMappingProvider;
+import org.eclipse.jpt.core.internal.context.java.IJavaAttributeMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaAttributeMappingProvider;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.context.java.IJavaTypeMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaTypeMappingProvider;
+import org.eclipse.jpt.core.internal.context.java.JavaBasicMappingProvider;
+import org.eclipse.jpt.core.internal.context.java.JavaEmbeddableProvider;
+import org.eclipse.jpt.core.internal.context.java.JavaEmbeddedIdMappingProvider;
+import org.eclipse.jpt.core.internal.context.java.JavaEmbeddedMappingProvider;
+import org.eclipse.jpt.core.internal.context.java.JavaEntityProvider;
+import org.eclipse.jpt.core.internal.context.java.JavaIdMappingProvider;
+import org.eclipse.jpt.core.internal.context.java.JavaManyToManyMappingProvider;
+import org.eclipse.jpt.core.internal.context.java.JavaManyToOneMappingProvider;
+import org.eclipse.jpt.core.internal.context.java.JavaMappedSuperclassProvider;
+import org.eclipse.jpt.core.internal.context.java.JavaNullAttributeMappingProvider;
+import org.eclipse.jpt.core.internal.context.java.JavaNullTypeMappingProvider;
+import org.eclipse.jpt.core.internal.context.java.JavaOneToManyMappingProvider;
+import org.eclipse.jpt.core.internal.context.java.JavaOneToOneMappingProvider;
+import org.eclipse.jpt.core.internal.context.java.JavaTransientMappingProvider;
+import org.eclipse.jpt.core.internal.context.java.JavaVersionMappingProvider;
+import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public abstract class BaseJpaPlatform implements IJpaPlatform
+{
+ private String id;
+
+ protected IJpaFactory jpaFactory;
+
+ protected IJpaAnnotationProvider annotationProvider;
+
+ protected Collection<IJavaTypeMappingProvider> javaTypeMappingProviders;
+
+ protected Collection<IJavaAttributeMappingProvider> javaAttributeMappingProviders;
+
+ protected List<IDefaultJavaAttributeMappingProvider> defaultJavaAttributeMappingProviders;
+
+ protected BaseJpaPlatform() {
+ super();
+ }
+
+
+ public String getId() {
+ return this.id;
+ }
+
+ /**
+ * *************
+ * * IMPORTANT * For INTERNAL use only !!
+ * *************
+ *
+ * @see IJpaPlatform#setId(String)
+ */
+ public void setId(String theId) {
+ this.id = theId;
+ }
+
+
+ // **************** Model construction / updating **************************
+
+ public IJpaFactory jpaFactory() {
+ if (this.jpaFactory == null) {
+ this.jpaFactory = buildJpaFactory();
+ }
+ return this.jpaFactory;
+ }
+
+ protected abstract IJpaFactory buildJpaFactory();
+
+ public IJpaFile buildJpaFile(IJpaProject jpaProject, IFile file) {
+ if (jpaFactory().hasRelevantContent(file)) {
+ IResourceModel resourceModel = jpaFactory().buildResourceModel(jpaProject, file);
+ return jpaFactory().createJpaFile(jpaProject, file, resourceModel);
+ }
+
+ return null;
+ }
+
+
+ // **************** java annotation support ********************************
+
+ public IJpaAnnotationProvider annotationProvider() {
+ if (this.annotationProvider == null) {
+ this.annotationProvider = buildAnnotationProvider();
+ }
+ return this.annotationProvider;
+ }
+
+ protected abstract IJpaAnnotationProvider buildAnnotationProvider();
+
+
+ // **************** type mapping support ********************************
+
+ public IJavaTypeMapping createJavaTypeMappingFromMappingKey(String typeMappingKey, IJavaPersistentType parent) {
+ //TODO I don't like that i am casting to IJpaBaseContextFactory here, not sure what to do about it
+ return javaTypeMappingProviderFromMappingKey(typeMappingKey).buildMapping(parent, (IJpaBaseContextFactory) jpaFactory());
+ }
+
+ public IJavaTypeMapping createJavaTypeMappingFromAnnotation(String mappingAnnotationName, IJavaPersistentType parent) {
+ //TODO I don't like that i am casting to IJpaBaseContextFactory here, not sure what to do about it
+ return javaTypeMappingProviderFromAnnotation(mappingAnnotationName).buildMapping(parent, (IJpaBaseContextFactory) jpaFactory());
+ }
+
+ public IJavaAttributeMapping createJavaAttributeMappingFromMappingKey(String attributeMappingKey, IJavaPersistentAttribute parent) {
+ return javaAttributeMappingProviderFromMappingKey(attributeMappingKey).buildMapping(parent, (IJpaBaseContextFactory) jpaFactory());
+ }
+
+ public IJavaAttributeMapping createJavaAttributeMappingFromAnnotation(String mappingAnnotationName, IJavaPersistentAttribute parent) {
+ return javaAttributeMappingProviderFromAnnotation(mappingAnnotationName).buildMapping(parent, (IJpaBaseContextFactory) jpaFactory());
+ }
+
+ public IJavaAttributeMapping createDefaultJavaAttributeMapping(IJavaPersistentAttribute parent) {
+ return defaultJavaAttributeMappingProvider(parent).buildMapping(parent, (IJpaBaseContextFactory) jpaFactory());
+ }
+
+ protected Iterator<IJavaTypeMappingProvider> javaTypeMappingProviders() {
+ if (this.javaTypeMappingProviders == null) {
+ this.javaTypeMappingProviders = new ArrayList<IJavaTypeMappingProvider>();
+ this.addJavaTypeMappingProvidersTo(this.javaTypeMappingProviders);
+ }
+ return new CloneIterator<IJavaTypeMappingProvider>(this.javaTypeMappingProviders);
+ }
+
+ /**
+ * Override this to specify more or different type mapping providers.
+ * The default includes the JPA spec-defined type mappings of
+ * Entity, MappedSuperclass, and Embeddable
+ */
+ protected void addJavaTypeMappingProvidersTo(Collection<IJavaTypeMappingProvider> providers) {
+ providers.add(JavaEntityProvider.instance());
+ providers.add(JavaMappedSuperclassProvider.instance());
+ providers.add(JavaEmbeddableProvider.instance());
+ providers.add(JavaNullTypeMappingProvider.instance());
+ }
+
+ protected IJavaTypeMappingProvider javaTypeMappingProviderFromMappingKey(String typeMappingKey) {
+ for (Iterator<IJavaTypeMappingProvider> i = this.javaTypeMappingProviders(); i.hasNext(); ) {
+ IJavaTypeMappingProvider provider = i.next();
+ if (provider.key() == typeMappingKey) {
+ return provider;
+ }
+ }
+ throw new IllegalArgumentException("Illegal type mapping key: " + typeMappingKey);
+ }
+
+ protected IJavaTypeMappingProvider javaTypeMappingProviderFromAnnotation(String annotationName) {
+ for (Iterator<IJavaTypeMappingProvider> i = this.javaTypeMappingProviders(); i.hasNext(); ) {
+ IJavaTypeMappingProvider provider = i.next();
+ if (provider.annotationName() == annotationName) {
+ return provider;
+ }
+ }
+ throw new IllegalArgumentException("Illegal annotation name: " + annotationName);
+ }
+
+ protected Iterator<IJavaAttributeMappingProvider> javaAttributeMappingProviders() {
+ if (this.javaAttributeMappingProviders == null) {
+ this.javaAttributeMappingProviders = new ArrayList<IJavaAttributeMappingProvider>();
+ this.addJavaAttributeMappingProvidersTo(this.javaAttributeMappingProviders);
+ }
+ return new CloneIterator<IJavaAttributeMappingProvider>(this.javaAttributeMappingProviders);
+ }
+
+ /**
+ * Override this to specify more or different attribute mapping providers.
+ * The default includes the JPA spec-defined attribute mappings of
+ * Basic, Id, Transient OneToOne, OneToMany, ManyToOne, ManyToMany, Embeddable, EmbeddedId, Version.
+ */
+ protected void addJavaAttributeMappingProvidersTo(Collection<IJavaAttributeMappingProvider> providers) {
+ providers.add(JavaBasicMappingProvider.instance());
+ providers.add(JavaEmbeddedMappingProvider.instance());
+ providers.add(JavaEmbeddedIdMappingProvider.instance());
+ providers.add(JavaIdMappingProvider.instance());
+ providers.add(JavaManyToManyMappingProvider.instance());
+ providers.add(JavaManyToOneMappingProvider.instance());
+ providers.add(JavaOneToManyMappingProvider.instance());
+ providers.add(JavaOneToOneMappingProvider.instance());
+ providers.add(JavaTransientMappingProvider.instance());
+ providers.add(JavaVersionMappingProvider.instance());
+ }
+
+ protected IJavaAttributeMappingProvider javaAttributeMappingProviderFromMappingKey(String attributeMappingKey) {
+ for (Iterator<IJavaAttributeMappingProvider> i = this.javaAttributeMappingProviders(); i.hasNext(); ) {
+ IJavaAttributeMappingProvider provider = i.next();
+ if (provider.key() == attributeMappingKey) {
+ return provider;
+ }
+ }
+ throw new IllegalArgumentException("Illegal attribute mapping key: " + attributeMappingKey);
+ }
+
+ protected IJavaAttributeMappingProvider javaAttributeMappingProviderFromAnnotation(String annotationName) {
+ for (Iterator<IJavaAttributeMappingProvider> i = this.javaAttributeMappingProviders(); i.hasNext(); ) {
+ IJavaAttributeMappingProvider provider = i.next();
+ if (provider.annotationName() == annotationName) {
+ return provider;
+ }
+ }
+ throw new IllegalArgumentException("Illegal annotation name: " + annotationName);
+ }
+
+ protected ListIterator<IDefaultJavaAttributeMappingProvider> defaultJavaAttributeMappingProviders() {
+ if (this.defaultJavaAttributeMappingProviders == null) {
+ this.defaultJavaAttributeMappingProviders = new ArrayList<IDefaultJavaAttributeMappingProvider>();
+ this.addDefaultJavaAttributeMappingProvidersTo(this.defaultJavaAttributeMappingProviders);
+ }
+ return new CloneListIterator<IDefaultJavaAttributeMappingProvider>(this.defaultJavaAttributeMappingProviders);
+ }
+
+ /**
+ * Override this to specify more or different default attribute mapping providers.
+ * The default includes the JPA spec-defined attribute mappings of
+ * Embedded and Basic.
+ */
+ protected void addDefaultJavaAttributeMappingProvidersTo(List<IDefaultJavaAttributeMappingProvider> providers) {
+ providers.add(JavaEmbeddedMappingProvider.instance()); //bug 190344 need to test default embedded before basic
+ providers.add(JavaBasicMappingProvider.instance());
+ }
+
+ protected IJavaAttributeMappingProvider defaultJavaAttributeMappingProvider(IJavaPersistentAttribute persistentAttribute) {
+ for (Iterator<IDefaultJavaAttributeMappingProvider> i = this.defaultJavaAttributeMappingProviders(); i.hasNext(); ) {
+ IDefaultJavaAttributeMappingProvider provider = i.next();
+ if (provider.defaultApplies(persistentAttribute)) {
+ return provider;
+ }
+ }
+
+ return nullAttributeMappingProvider();
+ }
+
+ public String defaultJavaAttributeMappingKey(IJavaPersistentAttribute persistentAttribute) {
+ return defaultJavaAttributeMappingProvider(persistentAttribute).key();
+ }
+
+ /**
+ * the "null" attribute mapping is used when the attribute is neither
+ * modified with a mapping annotation nor mapped by a "default" mapping
+ */
+ protected IJavaAttributeMappingProvider nullAttributeMappingProvider() {
+ return JavaNullAttributeMappingProvider.instance();
+ }
+
+ // **************** Validation *********************************************
+
+ public void addToMessages(IJpaProject project, List<IMessage> messages) {
+ project.addToMessages(messages, null);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/base/IJpaBaseContextFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/base/IJpaBaseContextFactory.java
new file mode 100644
index 0000000000..e917038610
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/base/IJpaBaseContextFactory.java
@@ -0,0 +1,182 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.platform.base;
+
+import org.eclipse.jpt.core.internal.IJpaFactory;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IBaseJpaContent;
+import org.eclipse.jpt.core.internal.context.base.IClassRef;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.IMappingFileRef;
+import org.eclipse.jpt.core.internal.context.base.INamedColumn;
+import org.eclipse.jpt.core.internal.context.base.IOverride;
+import org.eclipse.jpt.core.internal.context.base.IPersistence;
+import org.eclipse.jpt.core.internal.context.base.IPersistenceUnit;
+import org.eclipse.jpt.core.internal.context.base.IPersistenceXml;
+import org.eclipse.jpt.core.internal.context.base.IProperty;
+import org.eclipse.jpt.core.internal.context.java.IJavaAssociationOverride;
+import org.eclipse.jpt.core.internal.context.java.IJavaAttributeMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaAttributeOverride;
+import org.eclipse.jpt.core.internal.context.java.IJavaBasicMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaColumn;
+import org.eclipse.jpt.core.internal.context.java.IJavaDiscriminatorColumn;
+import org.eclipse.jpt.core.internal.context.java.IJavaEmbeddable;
+import org.eclipse.jpt.core.internal.context.java.IJavaEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaEntity;
+import org.eclipse.jpt.core.internal.context.java.IJavaGeneratedValue;
+import org.eclipse.jpt.core.internal.context.java.IJavaIdMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaJoinColumn;
+import org.eclipse.jpt.core.internal.context.java.IJavaJoinTable;
+import org.eclipse.jpt.core.internal.context.java.IJavaJpaContextNode;
+import org.eclipse.jpt.core.internal.context.java.IJavaManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaMappedSuperclass;
+import org.eclipse.jpt.core.internal.context.java.IJavaNamedNativeQuery;
+import org.eclipse.jpt.core.internal.context.java.IJavaNamedQuery;
+import org.eclipse.jpt.core.internal.context.java.IJavaOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.context.java.IJavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.context.java.IJavaQuery;
+import org.eclipse.jpt.core.internal.context.java.IJavaQueryHint;
+import org.eclipse.jpt.core.internal.context.java.IJavaRelationshipMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaSecondaryTable;
+import org.eclipse.jpt.core.internal.context.java.IJavaSequenceGenerator;
+import org.eclipse.jpt.core.internal.context.java.IJavaTable;
+import org.eclipse.jpt.core.internal.context.java.IJavaTableGenerator;
+import org.eclipse.jpt.core.internal.context.java.IJavaTransientMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaTypeMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaVersionMapping;
+import org.eclipse.jpt.core.internal.context.orm.EntityMappings;
+import org.eclipse.jpt.core.internal.context.orm.OrmXml;
+import org.eclipse.jpt.core.internal.context.orm.PersistenceUnitDefaults;
+import org.eclipse.jpt.core.internal.context.orm.PersistenceUnitMetadata;
+import org.eclipse.jpt.core.internal.context.orm.XmlEmbeddable;
+import org.eclipse.jpt.core.internal.context.orm.XmlEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlMappedSuperclass;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+
+/**
+ * An IJpaFactory that also assumes a base JPA project context structure
+ * corresponding to the JPA spec:
+ *
+ * RootContent
+ * |- persistence.xml
+ * |- persistence unit(s)
+ * |- mapping file(s) (e.g. orm.xml)
+ * | |- persistent type mapping(s) (e.g. Entity)
+ * | |- persistent attribute mapping(s) (e.g. Basic)
+ * |- persistent type mapping(s)
+ *
+ * ... and associated objects.
+ */
+public interface IJpaBaseContextFactory extends IJpaFactory
+{
+ IPersistenceXml createPersistenceXml(IBaseJpaContent parent);
+
+ IPersistence createPersistence(IPersistenceXml parent);
+
+ OrmXml createOrmXml(IMappingFileRef parent);
+
+ EntityMappings createEntityMappings(OrmXml parent);
+
+ PersistenceUnitMetadata createPersistenceUnitMetadata(EntityMappings parent);
+
+ PersistenceUnitDefaults createPersistenceUnitDefaults(PersistenceUnitMetadata parent);
+
+ IPersistenceUnit createPersistenceUnit(IPersistence parent);
+
+ IMappingFileRef createMappingFileRef(IPersistenceUnit parent);
+
+ IClassRef createClassRef(IPersistenceUnit parent);
+
+ IProperty createProperty(IPersistenceUnit parent);
+
+ IJavaPersistentType createJavaPersistentType(IJpaContextNode parent);
+
+ IJavaPersistentAttribute createJavaPersistentAttribute(IJavaPersistentType parent);
+
+ IJavaTypeMapping createJavaNullTypeMapping(IJavaPersistentType parent);
+
+ IJavaEntity createJavaEntity(IJavaPersistentType parent);
+
+ IJavaMappedSuperclass createJavaMappedSuperclass(IJavaPersistentType parent);
+
+ IJavaEmbeddable createJavaEmbeddable(IJavaPersistentType parent);
+
+ IJavaTable createJavaTable(IJavaEntity parent);
+
+ IJavaJoinTable createJavaJoinTable(IJavaRelationshipMapping parent);
+
+ IJavaColumn createJavaColumn(IJavaJpaContextNode parent, IJavaColumn.Owner owner);
+
+ IJavaDiscriminatorColumn createJavaDiscriminatorColumn(IJavaEntity parent, INamedColumn.Owner owner);
+
+ IJavaJoinColumn createJavaJoinColumn(IJavaJpaContextNode parent, IJoinColumn.Owner owner);
+
+ IJavaSecondaryTable createJavaSecondaryTable(IJavaEntity parent);
+
+ IJavaBasicMapping createJavaBasicMapping(IJavaPersistentAttribute parent);
+
+ IJavaEmbeddedIdMapping createJavaEmbeddedIdMapping(IJavaPersistentAttribute parent);
+
+ IJavaEmbeddedMapping createJavaEmbeddedMapping(IJavaPersistentAttribute parent);
+
+ IJavaIdMapping createJavaIdMapping(IJavaPersistentAttribute parent);
+
+ IJavaManyToManyMapping createJavaManyToManyMapping(IJavaPersistentAttribute parent);
+
+ IJavaManyToOneMapping createJavaManyToOneMapping(IJavaPersistentAttribute parent);
+
+ IJavaOneToManyMapping createJavaOneToManyMapping(IJavaPersistentAttribute parent);
+
+ IJavaOneToOneMapping createJavaOneToOneMapping(IJavaPersistentAttribute parent);
+
+ IJavaTransientMapping createJavaTransientMapping(IJavaPersistentAttribute parent);
+
+ IJavaVersionMapping createJavaVersionMapping(IJavaPersistentAttribute parent);
+
+ IJavaAttributeMapping createJavaNullAttributeMapping(IJavaPersistentAttribute parent);
+
+ IJavaSequenceGenerator createJavaSequenceGenerator(IJavaJpaContextNode parent);
+
+ IJavaTableGenerator createJavaTableGenerator(IJavaJpaContextNode parent);
+
+ IJavaGeneratedValue createJavaGeneratedValue(IJavaAttributeMapping parent);
+
+ IJavaPrimaryKeyJoinColumn createJavaPrimaryKeyJoinColumn(IJavaJpaContextNode parent, IAbstractJoinColumn.Owner owner);
+
+ IJavaAttributeOverride createJavaAttributeOverride(IJavaJpaContextNode parent, IOverride.Owner owner);
+
+ IJavaAssociationOverride createJavaAssociationOverride(IJavaJpaContextNode parent, IOverride.Owner owner);
+
+ IJavaNamedQuery createJavaNamedQuery(IJavaJpaContextNode parent);
+
+ IJavaNamedNativeQuery createJavaNamedNativeQuery(IJavaJpaContextNode parent);
+
+ IJavaQueryHint createJavaQueryHint(IJavaQuery<?> parent);
+
+ //TODO need an interface??
+ XmlPersistentType createXmlPersistentType(EntityMappings parent, String mappingKey);
+
+ XmlEntity createXmlEntity(XmlPersistentType parent);
+
+ XmlMappedSuperclass createXmlMappedSuperclass(XmlPersistentType parent);
+
+ XmlEmbeddable createXmlEmbeddable(XmlPersistentType parent);
+
+ XmlPersistentAttribute createXmlPersistentAttribute(XmlPersistentType parent, String mappingKey);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/generic/GenericJpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/generic/GenericJpaAnnotationProvider.java
new file mode 100644
index 0000000000..0ac9aafea5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/generic/GenericJpaAnnotationProvider.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.platform.generic;
+
+import org.eclipse.jpt.core.internal.platform.base.BaseJpaAnnotationProvider;
+
+public class GenericJpaAnnotationProvider extends BaseJpaAnnotationProvider
+{
+ public GenericJpaAnnotationProvider() {
+ super();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/generic/GenericJpaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/generic/GenericJpaFactory.java
index 8d5fa90ffe..cc1f5e5665 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/generic/GenericJpaFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/generic/GenericJpaFactory.java
@@ -9,8 +9,11 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.platform.generic;
-import org.eclipse.jpt.core.internal.platform.BaseJpaFactory;
+import org.eclipse.jpt.core.internal.platform.base.BaseJpaFactory;
-public class GenericJpaFactory extends BaseJpaFactory {
- // nothing for now... just take everything from the abstract superclass
+public class GenericJpaFactory extends BaseJpaFactory
+{
+ public GenericJpaFactory() {
+ super();
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/generic/GenericJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/generic/GenericJpaPlatform.java
new file mode 100644
index 0000000000..208854fb04
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/generic/GenericJpaPlatform.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.platform.generic;
+
+import org.eclipse.jpt.core.internal.IJpaAnnotationProvider;
+import org.eclipse.jpt.core.internal.IJpaFactory;
+import org.eclipse.jpt.core.internal.platform.base.BaseJpaPlatform;
+
+
+public class GenericJpaPlatform extends BaseJpaPlatform
+{
+ public static String ID = "generic";
+
+
+ public GenericJpaPlatform() {
+ super();
+ }
+
+
+ // **************** Model construction / updating **************************
+
+ @Override
+ protected IJpaFactory buildJpaFactory() {
+ return new GenericJpaFactory();
+ }
+
+
+ // **************** java annotation support ********************************
+
+ @Override
+ protected IJpaAnnotationProvider buildAnnotationProvider() {
+ return new GenericJpaAnnotationProvider();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/IJpaEObject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/IJpaEObject.java
new file mode 100644
index 0000000000..1b6068aa23
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/IJpaEObject.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.common;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+public interface IJpaEObject extends EObject
+{
+ /**
+ * Return the resource that most directly contains this object
+ */
+ IResource platformResource();
+
+ /**
+ * Return the JpaXmlResource containing this object.
+ */
+ JpaXmlResource resource();
+
+ /**
+ * Return the root object of the model
+ */
+ IJpaEObject root();
+
+ /**
+ * Return the text range to be used for validation. This is the source
+ * range that will be highlighted for a validation error.
+ */
+ ITextRange validationTextRange();
+
+ boolean isAllFeaturesUnset();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/JpaArtifactEdit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/JpaArtifactEdit.java
new file mode 100644
index 0000000000..56bc770b7c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/JpaArtifactEdit.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.common;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.wst.common.componentcore.ArtifactEdit;
+
+public abstract class JpaArtifactEdit extends ArtifactEdit
+{
+ public JpaArtifactEdit(IProject aProject, boolean toAccessAsReadOnly)
+ throws IllegalArgumentException {
+ super(aProject, toAccessAsReadOnly);
+ }
+
+
+ /**
+ * @return a resource for the given file
+ */
+ public abstract JpaXmlResource getResource(IFile file);
+
+ /**
+ * @param deployURI - this must be in a deployment relevant form
+ * (e.g "META-INF/persistence.xml" instead of "src/META-INF/persistence.xml")
+ * @return a resource for the given deployment file URI
+ */
+ public abstract JpaXmlResource getResource(String deployURI);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/XmlEObject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/JpaEObject.java
index a88c60e190..af2a4d1bfd 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/XmlEObject.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/JpaEObject.java
@@ -7,20 +7,21 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal;
-import java.util.Collection;
+package org.eclipse.jpt.core.internal.resource.common;
+
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IResource;
import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.jpt.core.internal.ITextRange;
import org.eclipse.jpt.utility.internal.ClassTools;
import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.wst.common.internal.emf.resource.EMF2DOMAdapter;
@@ -34,54 +35,129 @@ import org.w3c.dom.Node;
* <!-- end-user-doc -->
*
*
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getXmlEObject()
+ * @see org.eclipse.jpt.core.internal.resource.common.CommonPackage#getXmlEObject()
* @model kind="class" abstract="true"
* @generated
*/
-public abstract class XmlEObject extends JpaEObject implements IXmlEObject
+public abstract class JpaEObject extends EObjectImpl implements IJpaEObject
{
protected IDOMNode node;
-
+
/**
* Sets of "insignificant" feature ids, keyed by class.
* This is built up lazily, as the objects are modified.
*/
- private static final Map<Class, Set<Integer>> insignificantXmlFeatureIdSets = new Hashtable<Class, Set<Integer>>();
-
+ private static final Map<Class, Set<Integer>> insignificantFeatureIdSets = new Hashtable<Class, Set<Integer>>();
+
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- protected XmlEObject() {
+ protected JpaEObject() {
super();
}
-
+
+
+ // **************** IJpaEObject implementation *****************************
+
+ public IResource platformResource() {
+ return resource().getFile();
+ }
+
+ public JpaXmlResource resource() {
+ return (JpaXmlResource) eResource();
+ }
+
+ /*
+ * Must be overridden by actual root object to return itself
+ */
+ public IJpaEObject root() {
+ return ((IJpaEObject) eContainer()).root();
+
+ }
+
+
+ // **************** change notification ************************************
+
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
+ * override to prevent notification when the object's state is unchanged
*/
@Override
- protected EClass eStaticClass() {
- return JpaCorePackage.Literals.XML_EOBJECT;
+ public void eNotify(Notification notification) {
+ if (!notification.isTouch()) {
+ super.eNotify(notification);
+ this.featureChanged(notification.getFeatureID(this.getClass()));
+ }
}
-
+
+ protected void featureChanged(int featureId) {
+ if (this.featureIsSignificant(featureId)) {
+ resource().resourceChanged();
+ }
+ }
+
+ protected boolean featureIsSignificant(int featureId) {
+ return ! this.featureIsInsignificant(featureId);
+ }
+
+ protected boolean featureIsInsignificant(int featureId) {
+ return this.insignificantFeatureIds().contains(featureId);
+ }
+
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model kind="operation"
- * @generated NOT
+ * Return a set of the object's "insignificant" feature ids.
+ * These are the EMF features that will not be used to determine if all
+ * the features are unset. We use this to determine when to remove
+ * an element from the xml.
+ *
+ * If you need instance-based calculation of your xml "insignificant" aspects,
+ * override this method. If class-based calculation is sufficient,
+ * override #addInsignificantXmlFeatureIdsTo(Set).
+ *
+ * @see isAllFeaturesUnset()
*/
- public IJpaFile getJpaFile() {
- IJpaRootContentNode root = getRoot();
- return (root == null) ? null : root.getJpaFile();
+ protected Set<Integer> insignificantFeatureIds() {
+ synchronized (insignificantFeatureIdSets) {
+ Set<Integer> insignificantXmlFeatureIds = insignificantFeatureIdSets.get(this.getClass());
+ if (insignificantXmlFeatureIds == null) {
+ insignificantXmlFeatureIds = new HashSet<Integer>();
+ this.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
+ insignificantFeatureIdSets.put(this.getClass(), insignificantXmlFeatureIds);
+ }
+ return insignificantXmlFeatureIds;
+ }
+ }
+
+ /**
+ * Add the object's "insignificant" feature ids to the specified set.
+ * These are the EMF features that, when they change, will NOT cause the
+ * object (or its containing tree) to be resynched, i.e. defaults calculated.
+ * If class-based calculation of your "insignificant" features is sufficient,
+ * override this method. If you need instance-based calculation,
+ * override #insignificantXmlFeatureIds().
+ */
+ protected void addInsignificantXmlFeatureIdsTo(Set<Integer> insignificantXmlFeatureIds) {
+ // when you override this method, don't forget to include:
+ // super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
+ }
+
+
+ // *************************************************************************
+
+ public boolean isAllFeaturesUnset() {
+ for (EStructuralFeature feature : eClass().getEAllStructuralFeatures()) {
+ if (eIsSet(feature)) {
+ return false;
+ }
+ }
+ return true;
}
@Override
public EList<Adapter> eAdapters() {
if (this.eAdapters == null) {
- this.eAdapters = new XmlEAdapterList(this);
+ this.eAdapters = new XmlEAdapterList<Adapter>(this);
}
return this.eAdapters;
}
@@ -91,14 +167,14 @@ public abstract class XmlEObject extends JpaEObject implements IXmlEObject
}
- protected class XmlEAdapterList extends EAdapterList
+ protected class XmlEAdapterList<E extends Object & Adapter> extends EAdapterList<E>
{
public XmlEAdapterList(Notifier notifier) {
super(notifier);
}
@Override
- protected void didAdd(int index, Object newObject) {
+ protected void didAdd(int index, E newObject) {
super.didAdd(index, newObject);
try {
node = (IDOMNode) ClassTools.executeMethod(newObject, "getNode");
@@ -109,114 +185,34 @@ public abstract class XmlEObject extends JpaEObject implements IXmlEObject
}
@Override
- protected void didRemove(int index, Object oldObject) {
+ protected void didRemove(int index, E oldObject) {
super.didRemove(index, oldObject);
- if ((oldObject instanceof EMF2DOMAdapter) && (((EMF2DOMAdapter) oldObject).getNode() == XmlEObject.this.node)) {
- XmlEObject.this.node = null;
+ if ((oldObject instanceof EMF2DOMAdapter) && (((EMF2DOMAdapter) oldObject).getNode() == JpaEObject.this.node)) {
+ JpaEObject.this.node = null;
}
}
}
-
- public boolean isAllFeaturesUnset() {
- for (EStructuralFeature feature : eClass().getEAllStructuralFeatures()) {
- if (xmlFeatureIsInsignificant(feature.getFeatureID())) {
- continue;
- }
- if (feature instanceof EReference) {
- Object object = eGet(feature);
- if (object instanceof Collection) {
- if (eIsSet(feature)) {
- return false;
- }
- }
- else {
- XmlEObject eObject = (XmlEObject) eGet(feature);
- if (eObject != null) {
- return eObject.isAllFeaturesUnset();
- }
- }
- }
- else if (eIsSet(feature)) {
- return false;
- }
- }
- return true;
- }
-
- public IJpaRootContentNode getRoot() {
- XmlEObject container = (XmlEObject) eContainer();
- return (container == null) ? null : container.getRoot();
- }
-
- public IResource getResource() {
- return getJpaFile().getResource();
- }
-
+
public ITextRange validationTextRange() {
return fullTextRange();
}
-
+
public ITextRange selectionTextRange() {
return fullTextRange();
}
-
+
public ITextRange fullTextRange() {
return buildTextRange(this.node);
}
-
+
protected ITextRange buildTextRange(IDOMNode domNode) {
if (domNode == null) {
return null;
}
return new DOMNodeTextRange(domNode);
}
-
- protected boolean xmlFeatureIsSignificant(int featureId) {
- return !this.xmlFeatureIsInsignificant(featureId);
- }
-
- protected boolean xmlFeatureIsInsignificant(int featureId) {
- return this.insignificantXmlFeatureIds().contains(featureId);
- }
-
- /**
- * Return a set of the xml object's "insignificant" feature ids.
- * These are the EMF features that will not be used to determine if all
- * the features are unset. We use this to determine when to remove
- * an element from the xml.
- *
- * If you need instance-based calculation of your xml "insignificant" aspects,
- * override this method. If class-based calculation is sufficient,
- * override #addInsignificantXmlFeatureIdsTo(Set).
- *
- * @see isAllFeaturesUnset()
- */
- protected Set<Integer> insignificantXmlFeatureIds() {
- synchronized (insignificantXmlFeatureIdSets) {
- Set<Integer> insignificantXmlFeatureIds = insignificantXmlFeatureIdSets.get(this.getClass());
- if (insignificantXmlFeatureIds == null) {
- insignificantXmlFeatureIds = new HashSet<Integer>();
- this.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
- insignificantXmlFeatureIdSets.put(this.getClass(), insignificantXmlFeatureIds);
- }
- return insignificantXmlFeatureIds;
- }
- }
-
- /**
- * Add the object's "insignificant" feature ids to the specified set.
- * These are the EMF features that, when they change, will NOT cause the
- * object (or its containing tree) to be resynched, i.e. defaults calculated.
- * If class-based calculation of your "insignificant" features is sufficient,
- * override this method. If you need instance-based calculation,
- * override #insignificantXmlFeatureIds().
- */
- protected void addInsignificantXmlFeatureIdsTo(Set<Integer> insignificantXmlFeatureIds) {
- // when you override this method, don't forget to include:
- // super.addInsignificantXmlFeatureIdsTo(insignificantXmlFeatureIds);
- }
-
-
+
+
/**
* Implementation of ITextRange that adapts a IDOMNode.
*/
@@ -284,4 +280,4 @@ public abstract class XmlEObject extends JpaEObject implements IXmlEObject
return StringTools.buildToStringFor(this, start + ", " + end);
}
}
-} \ No newline at end of file
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/PersistenceResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/JpaXmlResource.java
index 178ba8a88b..2bb5774830 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/PersistenceResource.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/JpaXmlResource.java
@@ -1,37 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.content.persistence.resource;
+package org.eclipse.jpt.core.internal.resource.common;
+import java.util.ArrayList;
+import java.util.Collection;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.jdt.core.ElementChangedEvent;
import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
import org.eclipse.jem.util.plugin.JEMUtilPlugin;
-import org.eclipse.jpt.core.internal.content.persistence.Persistence;
+import org.eclipse.jpt.core.internal.IJpaContentNode;
+import org.eclipse.jpt.core.internal.IResourceModelListener;
import org.eclipse.wst.common.internal.emf.resource.Renderer;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
import org.eclipse.wst.common.internal.emf.resource.TranslatorResource;
import org.eclipse.wst.common.internal.emf.resource.TranslatorResourceImpl;
-public class PersistenceResource extends TranslatorResourceImpl
+public abstract class JpaXmlResource extends TranslatorResourceImpl
{
- public PersistenceResource(Renderer aRenderer) {
+ protected JpaXmlResourceModel resourceModel;
+
+ protected final Collection<IResourceModelListener> resourceModelListeners;
+
+
+ protected JpaXmlResource(Renderer aRenderer) {
super(aRenderer);
+ this.resourceModelListeners = new ArrayList<IResourceModelListener>();
}
-
- public PersistenceResource(URI uri, Renderer aRenderer) {
+
+ protected JpaXmlResource(URI uri, Renderer aRenderer) {
super(uri, aRenderer);
+ this.resourceModelListeners = new ArrayList<IResourceModelListener>();
}
/**
+ * override to prevent notification when the object's state is unchanged
+ */
+ @Override
+ public void eNotify(Notification notification) {
+ if (!notification.isTouch() && isLoaded()) {
+ super.eNotify(notification);
+ resourceChanged();
+ }
+ }
+
+ /**
* @see TranslatorResourceImpl#getDefaultPublicId()
*/
protected String getDefaultPublicId() {
@@ -64,20 +78,6 @@ public class PersistenceResource extends TranslatorResourceImpl
// only applicable for DTD-based files
}
- /**
- * @see TranslatorResource#getRootTranslator()
- */
- public Translator getRootTranslator() {
- return PersistenceTranslator.INSTANCE;
- }
-
- /**
- * @see PersistenceResource#getPersistence()
- */
- public Persistence getPersistence() {
- return (Persistence) getRootObject();
- }
-
public IFile getFile() {
IFile file = null;
file = getFile(getURI());
@@ -105,4 +105,40 @@ public class PersistenceResource extends TranslatorResourceImpl
}
return null;
}
+
+ public boolean exists() {
+ return getFile().exists();
+ }
+
+ public abstract IJpaContentNode getContentNode(int offset);
+
+ public abstract void handleJavaElementChangedEvent(ElementChangedEvent event);
+
+ public JpaXmlResourceModel resourceModel() {
+ return resourceModel;
+ }
+
+ public void setResourceModel(JpaXmlResourceModel resourceModel) {
+ this.resourceModel = resourceModel;
+ }
+
+ public void resourceChanged() {
+ for (IResourceModelListener listener : this.resourceModelListeners) {
+ listener.resourceModelChanged();
+ }
+ }
+
+ public void addResourceModelChangeListener(IResourceModelListener listener) {
+ if (listener == null) {
+ throw new IllegalArgumentException("Listener cannot be null");
+ }
+ this.resourceModelListeners.add(listener);
+ }
+
+ public void removeResourceModelChangeListener(IResourceModelListener listener) {
+ if (!this.resourceModelListeners.contains(listener)) {
+ throw new IllegalArgumentException("Listener " + listener + " was never added");
+ }
+ this.resourceModelListeners.add(listener);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/JpaXmlResourceModel.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/JpaXmlResourceModel.java
new file mode 100644
index 0000000000..56cf945b38
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/JpaXmlResourceModel.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.common;
+
+import java.io.IOException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.core.ElementChangedEvent;
+import org.eclipse.jpt.core.internal.AbstractResourceModel;
+import org.eclipse.jpt.core.internal.IResourceModelListener;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.wst.common.internal.emfworkbench.integration.EditModelEvent;
+import org.eclipse.wst.common.internal.emfworkbench.integration.EditModelListener;
+
+public abstract class JpaXmlResourceModel extends AbstractResourceModel
+{
+ protected JpaArtifactEdit artifactEdit;
+
+ protected JpaXmlResource resource;
+
+
+ protected JpaXmlResourceModel(IFile file) {
+ super();
+ this.artifactEdit = buildArtifactEdit(file.getProject());
+ this.resource = this.artifactEdit.getResource(file);
+ this.resource.setResourceModel(this);
+ this.artifactEdit.addListener(buildReloadListener(this.resource));
+ }
+
+
+ protected abstract JpaArtifactEdit buildArtifactEdit(IProject project);
+
+ private EditModelListener buildReloadListener(JpaXmlResource resource) {
+ return new ReloadListener(resource);
+ }
+
+ @Override
+ public JpaXmlResource resource() {
+ return this.resource;
+ }
+
+ public void handleJavaElementChangedEvent(ElementChangedEvent event) {
+ resource().handleJavaElementChangedEvent(event);
+ }
+
+ public void addResourceModelChangeListener(IResourceModelListener listener) {
+ resource().addResourceModelChangeListener(listener);
+ }
+
+ public void removeResourceModelChangeListener(IResourceModelListener listener) {
+ resource().removeResourceModelChangeListener(listener);
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ this.artifactEdit.dispose();
+ }
+
+ public void resolveTypes() {
+ //nothing to do here, JavaResourceModel needs this
+ }
+
+ private class ReloadListener implements EditModelListener
+ {
+ final JpaXmlResource resource;
+
+
+ ReloadListener(JpaXmlResource resource) {
+ super();
+ this.resource = resource;
+ }
+
+
+ public void editModelChanged(EditModelEvent anEvent) {
+ switch (anEvent.getEventCode()) {
+ case EditModelEvent.UNLOADED_RESOURCE :
+ if (anEvent.getChangedResources().contains(resource)
+ && ! resource.isLoaded()) {
+ try {
+ resource.load(resource.getResourceSet().getLoadOptions());
+ }
+ catch (IOException ioe) {
+ JptCorePlugin.log(ioe);
+ }
+ }
+ break;
+ case EditModelEvent.REMOVED_RESOURCE :
+ if (anEvent.getChangedResources().contains(resource)) {
+ anEvent.getEditModel().removeListener(this);
+ }
+ break;
+// case EditModelEvent.SAVE :
+// case EditModelEvent.PRE_DISPOSE :
+ }
+
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/BooleanTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/translators/BooleanTranslator.java
index 14d7b96c12..8dcc16aaf0 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/BooleanTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/common/translators/BooleanTranslator.java
@@ -1,12 +1,15 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 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
+ * Copyright (c) 2006, 2007 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.content.persistence.resource;
+
+package org.eclipse.jpt.core.internal.resource.common.translators;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -21,11 +24,13 @@ public class BooleanTranslator extends Translator
public BooleanTranslator(String domNameAndPath, EStructuralFeature aFeature, int style) {
super(domNameAndPath, aFeature, BOOLEAN_FEATURE | BOOLEAN_LOWERCASE | style);
}
-
+
+ @Override
public Object convertStringToValue(String strValue, EObject owner) {
return Boolean.valueOf(strValue);
}
+ @Override
public String convertValueToString(Object value, EObject owner) {
return ((Boolean) value).toString();
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractAnnotationResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractAnnotationResource.java
new file mode 100644
index 0000000000..34ee901217
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractAnnotationResource.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
+
+public abstract class AbstractAnnotationResource<E extends Member> extends AbstractMemberResource<E>
+ implements Annotation
+{
+ private final DeclarationAnnotationAdapter daa;
+
+ private final AnnotationAdapter annotationAdapter;
+
+ protected AbstractAnnotationResource(JavaResource parent, E member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member);
+ this.daa = daa;
+ this.annotationAdapter = annotationAdapter;
+ }
+
+ protected AbstractAnnotationResource(JavaResource parent, E member, DeclarationAnnotationAdapter daa) {
+ this(parent, member, daa, new MemberAnnotationAdapter(member, daa));
+ }
+
+
+ public AnnotationAdapter getAnnotationAdapter() {
+ return this.annotationAdapter;
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation jdtAnnotation(CompilationUnit astRoot) {
+ return getAnnotationAdapter().getAnnotation(astRoot);
+ }
+
+ public DeclarationAnnotationAdapter getDeclarationAnnotationAdapter() {
+ return this.daa;
+ }
+
+ public void removeAnnotation() {
+ getAnnotationAdapter().removeAnnotation();
+ }
+
+ public void newAnnotation() {
+ getAnnotationAdapter().newMarkerAnnotation();
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return getMember().annotationTextRange(this.daa, astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractColumn.java
new file mode 100644
index 0000000000..11770dfe3c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractColumn.java
@@ -0,0 +1,121 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public interface AbstractColumn extends NamedColumn
+{
+
+ /**
+ * Corresponds to the unique element of the *Column annotation.
+ * Returns null if the unique valuePair does not exist in the annotation
+ */
+ Boolean getUnique();
+
+ /**
+ * Corresponds to the unique element of the *Column annotation.
+ * Set to null to remove the unique valuePair from the annotation
+ */
+ void setUnique(Boolean unique);
+ String UNIQUE_PROPERTY = "uniqueProperty";
+
+ /**
+ * Corresponds to the nullable element of the *Column annotation.
+ * Returns null if the nullable valuePair does not exist in the annotation
+ */
+ Boolean getNullable();
+
+ /**
+ * Corresponds to the nullable element of the *Column annotation.
+ * Set to null to remove the nullable valuePair from the annotation
+ */
+ void setNullable(Boolean nullable);
+ String NULLABLE_PROPERTY = "nullableProperty";
+
+ /**
+ * Corresponds to the insertable element of the *Column annotation.
+ * Returns null if the insertable valuePair does not exist in the annotation
+ */
+ Boolean getInsertable();
+
+ /**
+ * Corresponds to the insertable element of the *Column annotation.
+ * Set to null to remove the insertable valuePair from the annotation
+ */
+ void setInsertable(Boolean insertable);
+ String INSERTABLE_PROPERTY = "insertableProperty";
+
+ /**
+ * Corresponds to the updatable element of the *Column annotation.
+ * Returns null if the updatable valuePair does not exist in the annotation
+ */
+ Boolean getUpdatable();
+
+ /**
+ * Corresponds to the updatable element of the *Column annotation.
+ * Set to null to remove the updatable valuePair from the annotation
+ */
+ void setUpdatable(Boolean updatable);
+ String UPDATABLE_PROPERTY = "updatableProperty";
+
+ /**
+ * Corresponds to the table element of the *Column annotation.
+ * Returns null if the table valuePair does not exist in the annotation
+ */
+ String getTable();
+
+ /**
+ * Corresponds to the table element of the *Column annotation.
+ * Set to null to remove the table valuePair from the annotation
+ */
+ void setTable(String table);
+ String TABLE_PROPERTY = "tableProperty";
+
+
+ /**
+ * Return the ITextRange for the unique element. If the unique element
+ * does not exist return the ITextRange for the *Column annotation.
+ */
+ ITextRange uniqueTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the nullable element. If the nullable element
+ * does not exist return the ITextRange for the *Column annotation.
+ */
+ ITextRange nullableTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the insertable element. If the insertable element
+ * does not exist return the ITextRange for the *Column annotation.
+ */
+ ITextRange insertableTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the updatable element. If the updatable element
+ * does not exist return the ITextRange for the *Column annotation.
+ */
+ ITextRange updatableTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the table element. If the table element
+ * does not exist return the ITextRange for the *Column annotation.
+ */
+ ITextRange tableTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified postition touches the table element.
+ * Return false if the table element does not exist.
+ */
+ boolean tableTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractColumnImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractColumnImpl.java
new file mode 100644
index 0000000000..ffbf8f9373
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractColumnImpl.java
@@ -0,0 +1,215 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
+
+public abstract class AbstractColumnImpl extends AbstractNamedColumn implements AbstractColumn
+{
+ // hold this so we can get the 'table' text range
+ private final DeclarationAnnotationElementAdapter<String> tableDeclarationAdapter;
+
+ // hold this so we can get the 'unique' text range
+ private final DeclarationAnnotationElementAdapter<Boolean> uniqueDeclarationAdapter;
+
+ // hold this so we can get the 'nullable' text range
+ private final DeclarationAnnotationElementAdapter<Boolean> nullableDeclarationAdapter;
+
+ // hold this so we can get the 'insertable' text range
+ private final DeclarationAnnotationElementAdapter<Boolean> insertableDeclarationAdapter;
+
+ // hold this so we can get the 'updatable' text range
+ private final DeclarationAnnotationElementAdapter<Boolean> updatableDeclarationAdapter;
+
+ private final AnnotationElementAdapter<String> tableAdapter;
+
+ private final AnnotationElementAdapter<Boolean> uniqueAdapter;
+
+ private final AnnotationElementAdapter<Boolean> nullableAdapter;
+
+ private final AnnotationElementAdapter<Boolean> insertableAdapter;
+
+ private final AnnotationElementAdapter<Boolean> updatableAdapter;
+
+ private String table;
+ private Boolean unique;
+ private Boolean nullable;
+ private Boolean insertable;
+ private Boolean updatable;
+
+
+ public AbstractColumnImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa) {
+ this(parent, member, daa, new MemberAnnotationAdapter(member, daa));
+ }
+
+ public AbstractColumnImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.tableDeclarationAdapter = this.buildStringElementAdapter(this.tableElementName());
+ this.tableAdapter = this.buildShortCircuitElementAdapter(this.tableDeclarationAdapter);
+ this.uniqueDeclarationAdapter = this.buildBooleanElementAdapter(this.uniqueElementName());
+ this.uniqueAdapter = this.buildShortCircuitBooleanElementAdapter(this.uniqueDeclarationAdapter);
+ this.nullableDeclarationAdapter = this.buildBooleanElementAdapter(this.nullableElementName());
+ this.nullableAdapter = this.buildShortCircuitBooleanElementAdapter(this.nullableDeclarationAdapter);
+ this.insertableDeclarationAdapter = this.buildBooleanElementAdapter(this.insertableElementName());
+ this.insertableAdapter = this.buildShortCircuitBooleanElementAdapter(this.insertableDeclarationAdapter);
+ this.updatableDeclarationAdapter = this.buildBooleanElementAdapter(this.updatableElementName());
+ this.updatableAdapter = this.buildShortCircuitBooleanElementAdapter(this.updatableDeclarationAdapter);
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.table = this.table(astRoot);
+ this.unique = this.unique(astRoot);
+ this.nullable = this.nullable(astRoot);
+ this.insertable = this.insertable(astRoot);
+ this.updatable = this.updatable(astRoot);
+ }
+
+ protected abstract String tableElementName();
+
+ protected abstract String uniqueElementName();
+
+ protected abstract String nullableElementName();
+
+ protected abstract String insertableElementName();
+
+ protected abstract String updatableElementName();
+
+ @Override
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ super.initializeFrom(oldAnnotation);
+ AbstractColumn oldColumn = (AbstractColumn) oldAnnotation;
+ setTable(oldColumn.getTable());
+ setUnique(oldColumn.getUnique());
+ setNullable(oldColumn.getNullable());
+ setInsertable(oldColumn.getInsertable());
+ setUpdatable(oldColumn.getUpdatable());
+ }
+
+ //************* AbstractColumn implementation *************
+ public String getTable() {
+ return this.table;
+ }
+
+ public void setTable(String newTable) {
+ String oldTable = this.table;
+ this.table = newTable;
+ this.tableAdapter.setValue(newTable);
+ firePropertyChanged(TABLE_PROPERTY, oldTable, newTable);
+ }
+
+ public Boolean getUnique() {
+ return this.unique;
+ }
+
+ public void setUnique(Boolean newUnique) {
+ Boolean oldUnique = this.unique;
+ this.unique = newUnique;
+ this.uniqueAdapter.setValue(newUnique);
+ firePropertyChanged(UNIQUE_PROPERTY, oldUnique, newUnique);
+ }
+
+ public Boolean getNullable() {
+ return this.nullable;
+ }
+
+ public void setNullable(Boolean newNullable) {
+ Boolean oldNullable = this.nullable;
+ this.nullable = newNullable;
+ this.nullableAdapter.setValue(newNullable);
+ firePropertyChanged(NULLABLE_PROPERTY, oldNullable, newNullable);
+ }
+
+ public Boolean getInsertable() {
+ return this.insertable;
+ }
+
+ public void setInsertable(Boolean newInsertable) {
+ Boolean oldInsertable = this.insertable;
+ this.insertable = newInsertable;
+ this.insertableAdapter.setValue(newInsertable);
+ firePropertyChanged(INSERTABLE_PROPERTY, oldInsertable, newInsertable);
+ }
+
+ public Boolean getUpdatable() {
+ return this.updatable;
+ }
+
+ public void setUpdatable(Boolean newUpdatable) {
+ Boolean oldUpdatable = this.updatable;
+ this.updatable = newUpdatable;
+ this.updatableAdapter.setValue(newUpdatable);
+ firePropertyChanged(UPDATABLE_PROPERTY, oldUpdatable, newUpdatable);
+ }
+
+ public ITextRange nullableTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.nullableDeclarationAdapter, astRoot);
+ }
+
+ public ITextRange insertableTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.insertableDeclarationAdapter, astRoot);
+ }
+
+ public ITextRange uniqueTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.uniqueDeclarationAdapter, astRoot);
+ }
+
+ public ITextRange updatableTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.updatableDeclarationAdapter, astRoot);
+ }
+
+ public ITextRange tableTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.tableDeclarationAdapter, astRoot);
+ }
+
+ public boolean tableTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.tableDeclarationAdapter, pos, astRoot);
+ }
+
+
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.setTable(this.table(astRoot));
+ this.setUnique(this.unique(astRoot));
+ this.setNullable(this.nullable(astRoot));
+ this.setInsertable(this.insertable(astRoot));
+ this.setUpdatable(this.updatable(astRoot));
+ }
+
+ protected String table(CompilationUnit astRoot) {
+ return this.tableAdapter.getValue(astRoot);
+ }
+
+ protected Boolean unique(CompilationUnit astRoot) {
+ return this.uniqueAdapter.getValue(astRoot);
+ }
+
+ protected Boolean nullable(CompilationUnit astRoot) {
+ return this.nullableAdapter.getValue(astRoot);
+ }
+
+ protected Boolean insertable(CompilationUnit astRoot) {
+ return this.insertableAdapter.getValue(astRoot);
+ }
+
+ protected Boolean updatable(CompilationUnit astRoot) {
+ return this.updatableAdapter.getValue(astRoot);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractJavaPersistentResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractJavaPersistentResource.java
new file mode 100644
index 0000000000..678960fd6c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractJavaPersistentResource.java
@@ -0,0 +1,486 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.dom.ASTVisitor;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.MarkerAnnotation;
+import org.eclipse.jdt.core.dom.NormalAnnotation;
+import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
+import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator;
+
+public abstract class AbstractJavaPersistentResource<E extends Member> extends AbstractMemberResource<E>
+ implements JavaPersistentResource
+{
+ /**
+ * stores all annotations(non-mapping) except duplicates, java compiler has an error for duplicates
+ */
+ private final Collection<Annotation> annotations;
+
+ /**
+ * stores all mapping annotations except duplicates, java compiler has an error for duplicates
+ */
+ private final Collection<Annotation> mappingAnnotations;
+
+ private boolean persistable;
+
+ public AbstractJavaPersistentResource(JavaResource parent, E member){
+ super(parent, member);
+ this.annotations = new ArrayList<Annotation>();
+ this.mappingAnnotations = new ArrayList<Annotation>();
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ getMember().bodyDeclaration(astRoot).accept(initializeAnnotationVisitor(astRoot));
+ this.persistable = calculatePersistability(astRoot);
+ }
+
+ protected ASTVisitor initializeAnnotationVisitor(final CompilationUnit astRoot) {
+ return new ASTVisitor() {
+ @Override
+ public boolean visit(SingleMemberAnnotation node) {
+ return visit((org.eclipse.jdt.core.dom.Annotation) node);
+ }
+
+ @Override
+ public boolean visit(NormalAnnotation node) {
+ return visit((org.eclipse.jdt.core.dom.Annotation) node);
+ }
+
+ @Override
+ public boolean visit(MarkerAnnotation node) {
+ return visit((org.eclipse.jdt.core.dom.Annotation) node);
+ }
+
+ private boolean visit(org.eclipse.jdt.core.dom.Annotation node) {
+ if (node.getParent() != getMember().bodyDeclaration(astRoot)) {
+ //we don't want to look at annotations for child members, only this member
+ return false;
+ }
+ addInitialAnnotation(node, astRoot);
+ return false;
+ }
+ };
+ }
+
+ protected void addInitialAnnotation(org.eclipse.jdt.core.dom.Annotation node, CompilationUnit astRoot) {
+ String qualifiedAnnotationName = JDTTools.resolveAnnotation(node);
+ if (qualifiedAnnotationName == null) {
+ return;
+ }
+ if (isPossibleAnnotation(qualifiedAnnotationName)) {
+ if (annotation(qualifiedAnnotationName) == null) { //don't want duplicates
+ Annotation annotation = buildAnnotation(qualifiedAnnotationName);
+ annotation.initialize(astRoot);
+ this.annotations.add(annotation);
+ }
+ }
+ else if (isPossibleMappingAnnotation(qualifiedAnnotationName)) {
+ if (mappingAnnotation(qualifiedAnnotationName) == null) { //don't want duplicates
+ Annotation annotation = buildMappingAnnotation(qualifiedAnnotationName);
+ annotation.initialize(astRoot);
+ this.mappingAnnotations.add(annotation);
+ }
+ }
+ }
+
+ protected abstract Annotation buildAnnotation(String annotationName);
+
+ protected abstract Annotation buildNullAnnotation(String annotationName);
+
+ protected abstract Annotation buildMappingAnnotation(String mappingAnnotationName);
+
+ protected abstract Annotation buildNullMappingAnnotation(String annotationName);
+
+ protected abstract ListIterator<String> possibleMappingAnnotationNames();
+
+ protected abstract boolean isPossibleAnnotation(String annotationName);
+
+ protected abstract boolean isPossibleMappingAnnotation(String annotationName);
+
+ protected abstract boolean calculatePersistability(CompilationUnit astRoot);
+
+ public Annotation annotation(String annotationName) {
+ for (Iterator<Annotation> i = annotations(); i.hasNext(); ) {
+ Annotation annotation = i.next();
+ if (annotation.getAnnotationName().equals(annotationName)) {
+ return annotation;
+ }
+ }
+ return null;
+ }
+
+ public JavaResource nonNullAnnotation(String annotationName) {
+ Annotation annotation = annotation(annotationName);
+ if (annotation == null) {
+ return buildNullAnnotation(annotationName);
+ }
+ return annotation;
+ }
+
+ public Annotation mappingAnnotation(String annotationName) {
+ for (Iterator<Annotation> i = mappingAnnotations(); i.hasNext(); ) {
+ Annotation mappingAnnotation = i.next();
+ if (mappingAnnotation.getAnnotationName().equals(annotationName)) {
+ return mappingAnnotation;
+ }
+ }
+ return null;
+ }
+
+ public JavaResource nonNullMappingAnnotation(String annotationName) {
+ Annotation annotation = mappingAnnotation(annotationName);
+ if (annotation == null) {
+ return buildNullMappingAnnotation(annotationName);
+ }
+ return annotation;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Iterator<Annotation> annotations() {
+ return new CloneIterator<Annotation>(this.annotations);
+ }
+
+ public Annotation addAnnotation(String annotationName) {
+ Annotation annotation = buildAnnotation(annotationName);
+ this.annotations.add(annotation);
+ annotation.newAnnotation();
+ this.fireItemAdded(ANNOTATIONS_COLLECTION, annotation);
+ return annotation;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected ContainerAnnotation<NestableAnnotation> addContainerAnnotation(String containerAnnotationName) {
+ return (ContainerAnnotation<NestableAnnotation>) addAnnotation(containerAnnotationName);
+ }
+
+ protected ContainerAnnotation<NestableAnnotation> addContainerAnnotationTwoNestableAnnotations(String containerAnnotationName) {
+ ContainerAnnotation<NestableAnnotation> containerAnnotation = buildContainerAnnotation(containerAnnotationName);
+ this.annotations.add(containerAnnotation);
+ containerAnnotation.newAnnotation();
+ containerAnnotation.addInternal(0).newAnnotation();
+ containerAnnotation.addInternal(1).newAnnotation();
+ return containerAnnotation;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected ContainerAnnotation<NestableAnnotation> buildContainerAnnotation(String containerAnnotationName) {
+ return (ContainerAnnotation<NestableAnnotation>) buildAnnotation(containerAnnotationName);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected ContainerAnnotation<NestableAnnotation> containerAnnotation(String containerAnnotationName) {
+ return (ContainerAnnotation<NestableAnnotation>) annotation(containerAnnotationName);
+ }
+
+ protected NestableAnnotation nestableAnnotation(String nestableAnnotationName) {
+ return (NestableAnnotation) annotation(nestableAnnotationName);
+ }
+
+ protected NestableAnnotation addNestableAnnotation(String nestableAnnotationName) {
+ return (NestableAnnotation) addAnnotation(nestableAnnotationName);
+ }
+
+ //TODO it seems we should be firing one change notification here, that a new nestable annotation was added.
+ public NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
+ NestableAnnotation nestedAnnotation = (NestableAnnotation) annotation(nestableAnnotationName);
+
+ ContainerAnnotation<NestableAnnotation> containerAnnotation = containerAnnotation(containerAnnotationName);
+
+ if (containerAnnotation != null) {
+ //ignore any nestableAnnotation and just add to the plural one
+ NestableAnnotation newNestedAnnotation = ContainerAnnotationTools.addNestedAnnotation(index, containerAnnotation);
+ //TODO any event notification being fired for the add???
+ return newNestedAnnotation;
+ }
+ if (nestedAnnotation == null) {
+ //add the nestable since neither nestable or container exists
+ return addNestableAnnotation(nestableAnnotationName);
+ }
+ //move the nestable to a new container annotation and add to it
+ ContainerAnnotation<NestableAnnotation> newContainerAnnotation = addContainerAnnotationTwoNestableAnnotations(containerAnnotationName);
+ if (index == 0) {
+ newContainerAnnotation.nestedAnnotationAt(1).initializeFrom(nestedAnnotation);
+ }
+ else {
+ newContainerAnnotation.nestedAnnotationAt(0).initializeFrom(nestedAnnotation);
+ }
+ removeAnnotation(nestedAnnotation);
+ return newContainerAnnotation.nestedAnnotationAt(index);
+ }
+
+ public void move(int targetIndex, int sourceIndex, String containerAnnotationName) {
+ move(targetIndex, sourceIndex, containerAnnotation(containerAnnotationName));
+ }
+
+ protected void move(int targetIndex, int sourceIndex, ContainerAnnotation<NestableAnnotation> containerAnnotation) {
+ containerAnnotation.move(targetIndex, sourceIndex);
+ ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, containerAnnotation);
+ }
+
+ protected void addAnnotation(Annotation annotation) {
+ addItemToCollection(annotation, this.annotations, ANNOTATIONS_COLLECTION);
+ }
+
+ protected void removeAnnotation(Annotation annotation) {
+ removeItemFromCollection(annotation, this.annotations, ANNOTATIONS_COLLECTION);
+ //TODO looks odd that we remove the annotation here, but in addAnnotation(Annotation) we don't do the same
+ annotation.removeAnnotation();
+ }
+
+ protected void addMappingAnnotation(String mappingAnnotationName) {
+ if (mappingAnnotation(mappingAnnotationName) != null) {
+ return;
+ }
+ Annotation mappingAnnotation = buildMappingAnnotation(mappingAnnotationName);
+ addMappingAnnotation(mappingAnnotation);
+ //TODO should this be done here or should creating the Annotation do this??
+ mappingAnnotation.newAnnotation();
+ }
+
+ protected void addMappingAnnotation(Annotation annotation) {
+ addItemToCollection(annotation, this.mappingAnnotations, MAPPING_ANNOTATIONS_COLLECTION);
+ }
+
+ protected void removeMappingAnnotation(Annotation annotation) {
+ removeItemFromCollection(annotation, this.mappingAnnotations, MAPPING_ANNOTATIONS_COLLECTION);
+ annotation.removeAnnotation();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Iterator<Annotation> mappingAnnotations() {
+ return new CloneIterator<Annotation>(this.mappingAnnotations);
+ }
+
+ public void removeAnnotation(String annotationName) {
+ Annotation annotation = annotation(annotationName);
+ if (annotation != null) {
+ removeAnnotation(annotation);
+ }
+ }
+
+ public void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
+ ContainerAnnotation<NestableAnnotation> containerAnnotation = containerAnnotation(containerAnnotationName);
+ if (containerAnnotation == null) {
+ Annotation annotation = annotation(nestableAnnotationName);
+ removeAnnotation(annotation);
+ }
+ else {
+ removeAnnotation(index, containerAnnotation);
+ }
+ }
+
+ protected void removeAnnotation(int index, ContainerAnnotation<NestableAnnotation> containerAnnotation) {
+ NestableAnnotation nestableAnnotation = containerAnnotation.nestedAnnotationAt(index);
+ containerAnnotation.remove(index);
+ //TODO move these 2 lines to the ContainerAnnotation implementation, i think
+ nestableAnnotation.removeAnnotation();
+ ContainerAnnotationTools.synchAnnotationsAfterRemove(index, containerAnnotation);
+
+ if (containerAnnotation.nestedAnnotationsSize() == 0) {
+ removeAnnotation(containerAnnotation);
+ }
+ else if (containerAnnotation.nestedAnnotationsSize() == 1) {
+ NestableAnnotation nestedAnnotation = containerAnnotation.nestedAnnotationAt(0);
+ removeAnnotation(containerAnnotation);
+ NestableAnnotation newAnnotation = (NestableAnnotation) addAnnotation(containerAnnotation.getNestableAnnotationName());
+ newAnnotation.initializeFrom(nestedAnnotation);
+ }
+ }
+
+ //TODO how to handle calling setMappingAnnotation with the same annotation as already exists? is this an error?
+ //or should we remove it and add it back as an empty annotation??
+ public void setMappingAnnotation(String annotationName) {
+ Annotation oldMapping = mappingAnnotation();
+ if (oldMapping != null) {
+ removeUnnecessaryAnnotations(oldMapping.getAnnotationName(), annotationName);
+ }
+ if (annotationName != null) {
+ addMappingAnnotation(annotationName);
+ }
+ }
+
+ /**
+ * Remove all mapping annotations that already exist
+ */
+ protected void removeUnnecessaryAnnotations(String oldMappingAnnotationName, String newMappingAnnotationName) {
+
+ for (ListIterator<String> i = possibleMappingAnnotationNames(); i.hasNext(); ) {
+ String mappingAnnotationName = i.next();
+ if (mappingAnnotationName != newMappingAnnotationName) {
+ Annotation mappingAnnotation = mappingAnnotation(mappingAnnotationName);
+ if (mappingAnnotation != null) {
+ removeMappingAnnotation(mappingAnnotation);
+ }
+ }
+ }
+ }
+
+ //TODO need property change notification on this mappingAnnotation changing
+ //from the context model we don't really care if their are multiple mapping annotations,
+ //just which one we need to use
+ public Annotation mappingAnnotation() {
+ for (ListIterator<String> i = possibleMappingAnnotationNames(); i.hasNext(); ) {
+ String mappingAnnotationName = i.next();
+ for (Iterator<Annotation> j = mappingAnnotations(); j.hasNext(); ) {
+ Annotation mappingAnnotation = j.next();
+ if (mappingAnnotationName == mappingAnnotation.getAnnotationName()) {
+ return mappingAnnotation;
+ }
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public ListIterator<NestableAnnotation> annotations(String nestableAnnotationName, String containerAnnotationName) {
+ ContainerAnnotation<NestableAnnotation> containerAnnotation = containerAnnotation(containerAnnotationName);
+ if (containerAnnotation != null) {
+ return containerAnnotation.nestedAnnotations();
+ }
+ NestableAnnotation nestableAnnotation = nestableAnnotation(nestableAnnotationName);
+ if (nestableAnnotation != null) {
+ return new SingleElementListIterator<NestableAnnotation>(nestableAnnotation);
+ }
+ return EmptyListIterator.instance();
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ updateAnnotations(astRoot);
+ setPersistable(calculatePersistability(astRoot));
+ }
+
+ @Override
+ public void resolveTypes(CompilationUnit astRoot) {
+ super.resolveTypes(astRoot);
+ setPersistable(calculatePersistability(astRoot));
+ }
+
+ protected void updateAnnotations(CompilationUnit astRoot) {
+ getMember().bodyDeclaration(astRoot).accept(annotationVisitor(astRoot));
+ removeAnnotationsNotInSource(astRoot);
+ removeMappingAnnotationsNotInSource(astRoot);
+ }
+
+ protected void removeAnnotationsNotInSource(CompilationUnit astRoot) {
+ for (Annotation annotation : CollectionTools.iterable(annotations())) {
+ if (annotation.jdtAnnotation(astRoot) == null) {
+ removeAnnotation(annotation);
+ }
+ }
+ }
+
+ protected void removeMappingAnnotationsNotInSource(CompilationUnit astRoot) {
+ for (Annotation mappingAnnotation : CollectionTools.iterable(mappingAnnotations())) {
+ if (mappingAnnotation.jdtAnnotation(astRoot) == null) {
+ removeMappingAnnotation(mappingAnnotation);
+ }
+ }
+ }
+
+ protected ASTVisitor annotationVisitor(final CompilationUnit astRoot) {
+ return new ASTVisitor() {
+ @Override
+ public boolean visit(SingleMemberAnnotation node) {
+ return visit((org.eclipse.jdt.core.dom.Annotation) node);
+ }
+
+ @Override
+ public boolean visit(NormalAnnotation node) {
+ return visit((org.eclipse.jdt.core.dom.Annotation) node);
+ }
+
+ @Override
+ public boolean visit(MarkerAnnotation node) {
+ return visit((org.eclipse.jdt.core.dom.Annotation) node);
+ }
+
+ private boolean visit(org.eclipse.jdt.core.dom.Annotation node) {
+ if (node.getParent() != getMember().bodyDeclaration(astRoot)) {
+ //we don't want to look at annotations for child members, only this member
+ return false;
+ }
+ addOrUpdateAnnotation(node, astRoot);
+ return false;
+ }
+ };
+ }
+
+ protected void addOrUpdateAnnotation(org.eclipse.jdt.core.dom.Annotation node, CompilationUnit astRoot) {
+ String qualifiedAnnotationName = JDTTools.resolveAnnotation(node);
+ if (qualifiedAnnotationName == null) {
+ return;
+ }
+ if (isPossibleAnnotation(qualifiedAnnotationName)) {
+ Annotation annotation = annotation(qualifiedAnnotationName);
+ if (annotation != null) {
+ annotation.updateFromJava(astRoot);
+ }
+ else {
+ annotation = buildAnnotation(qualifiedAnnotationName);
+ annotation.initialize(astRoot);
+ addAnnotation(annotation);
+ }
+ }
+ else if (isPossibleMappingAnnotation(qualifiedAnnotationName)) {
+ Annotation annotation = mappingAnnotation(qualifiedAnnotationName);
+ if (annotation != null) {
+ annotation.updateFromJava(astRoot);
+ }
+ else {
+ annotation = buildMappingAnnotation(qualifiedAnnotationName);
+ annotation.initialize(astRoot);
+ addMappingAnnotation(annotation);
+ }
+ }
+ }
+
+ public boolean isFor(IMember member) {
+ return getMember().wraps(member);
+ }
+
+ public boolean isPersistable() {
+ return this.persistable;
+ }
+
+ protected void setPersistable(boolean newPersistable) {
+ boolean oldPersistable = this.persistable;
+ this.persistable = newPersistable;
+ firePropertyChanged(PERSISTABLE_PROPERTY, oldPersistable, newPersistable);
+ //TODO change notification to parent so that the context model gets notification
+ //that the list of persistable fields has been updated
+ //
+ }
+
+
+ public ITextRange fullTextRange(CompilationUnit astRoot) {
+ return this.getMember().textRange(astRoot);
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return this.selectionTextRange(astRoot);
+ }
+
+ public ITextRange selectionTextRange(CompilationUnit astRoot) {
+ return this.getMember().nameTextRange(astRoot);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractMemberResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractMemberResource.java
new file mode 100644
index 0000000000..7eebdbae71
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractMemberResource.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+
+public abstract class AbstractMemberResource<E extends Member> extends AbstractResource
+{
+ private final E member;
+
+
+ protected AbstractMemberResource(JavaResource parent, E member) {
+ super(parent);
+ this.member = member;
+ }
+
+
+ public E getMember() {
+ return this.member;
+ }
+
+ protected ITextRange elementTextRange(DeclarationAnnotationElementAdapter<?> elementAdapter, CompilationUnit astRoot) {
+ return this.elementTextRange(this.member.annotationElementTextRange(elementAdapter, astRoot), astRoot);
+ }
+
+ /**
+ * Convenience method. If the specified element text range is null
+ * return the Java object's text range instead (which is usually the
+ * annotation's text range).
+ */
+ protected ITextRange elementTextRange(ITextRange elementTextRange, CompilationUnit astRoot) {
+ return (elementTextRange != null) ? elementTextRange : this.textRange(astRoot);
+ }
+
+ /**
+ * Convenience method. Return whether the specified position touches the element.
+ * Returns false if the element does not exist
+ */
+ protected boolean elementTouches(DeclarationAnnotationElementAdapter<?> elementAdapter, int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.member.annotationElementTextRange(elementAdapter, astRoot), pos);
+ }
+
+ /**
+ * Convenience method. Return whether element's text range is not
+ * null (meaning the element exists) and the specified position touches it.
+ */
+ protected boolean elementTouches(ITextRange elementTextRange, int pos) {
+ return (elementTextRange != null) && elementTextRange.touches(pos);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractNamedColumn.java
new file mode 100644
index 0000000000..c51023c023
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractNamedColumn.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.BooleanExpressionConverter;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.NumberIntegerExpressionConverter;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+
+public abstract class AbstractNamedColumn extends AbstractAnnotationResource<Member> implements NamedColumn
+{
+ // hold this so we can get the 'name' text range
+ private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
+
+ // hold this so we can get the 'columnDefinition' text range
+ private final DeclarationAnnotationElementAdapter<String> columnDefinitionDeclarationAdapter;
+
+ private final AnnotationElementAdapter<String> nameAdapter;
+
+ private final AnnotationElementAdapter<String> columnDefinitionAdapter;
+
+ private String name;
+ private String columnDefinition;
+
+ public AbstractNamedColumn(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.nameDeclarationAdapter = this.buildStringElementAdapter(this.nameElementName());
+ this.nameAdapter = this.buildShortCircuitElementAdapter(this.nameDeclarationAdapter);
+ this.columnDefinitionDeclarationAdapter = this.buildStringElementAdapter(this.columnDefinitionElementName());
+ this.columnDefinitionAdapter = this.buildShortCircuitElementAdapter(this.columnDefinitionDeclarationAdapter);
+ }
+
+ protected DeclarationAnnotationElementAdapter<String> buildStringElementAdapter(String elementName) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(getDeclarationAnnotationAdapter(), elementName);
+ }
+
+ protected DeclarationAnnotationElementAdapter<Boolean> buildBooleanElementAdapter(String elementName) {
+ return new ConversionDeclarationAnnotationElementAdapter<Boolean>(getDeclarationAnnotationAdapter(), elementName, BooleanExpressionConverter.instance());
+ }
+
+ protected DeclarationAnnotationElementAdapter<Integer> buildIntegerElementAdapter(String elementName) {
+ return new ConversionDeclarationAnnotationElementAdapter<Integer>(getDeclarationAnnotationAdapter(), elementName, NumberIntegerExpressionConverter.instance());
+ }
+
+ protected AnnotationElementAdapter<String> buildShortCircuitElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ return new ShortCircuitAnnotationElementAdapter<String>(getMember(), daea);
+ }
+
+ protected AnnotationElementAdapter<Boolean> buildShortCircuitBooleanElementAdapter(DeclarationAnnotationElementAdapter<Boolean> daea) {
+ return new ShortCircuitAnnotationElementAdapter<Boolean>(getMember(), daea);
+ }
+
+ protected AnnotationElementAdapter<Integer> buildShortCircuitIntegerElementAdapter(DeclarationAnnotationElementAdapter<Integer> daea) {
+ return new ShortCircuitAnnotationElementAdapter<Integer>(getMember(), daea);
+ }
+
+ protected AnnotationElementAdapter<String> buildShortCircuitStringElementAdapter(String elementName) {
+ return this.buildShortCircuitElementAdapter(this.buildStringElementAdapter(elementName));
+ }
+ protected abstract String nameElementName();
+
+ protected abstract String columnDefinitionElementName();
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.name(astRoot);
+ this.columnDefinition = this.columnDefinition(astRoot);
+ }
+
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ NamedColumn oldColumn = (NamedColumn) oldAnnotation;
+ setName(oldColumn.getName());
+ setColumnDefinition(oldColumn.getColumnDefinition());
+ }
+
+ //************* NamedColumn implementation **************
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.nameAdapter.setValue(newName);
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public String getColumnDefinition() {
+ return this.columnDefinition;
+ }
+
+ public void setColumnDefinition(String newColumnDefinition) {
+ String oldColumnDefinition = this.columnDefinition;
+ this.columnDefinition = newColumnDefinition;
+ this.columnDefinitionAdapter.setValue(newColumnDefinition);
+ firePropertyChanged(COLUMN_DEFINITION_PROPERTY, oldColumnDefinition, newColumnDefinition);
+ }
+
+ public ITextRange nameTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.nameDeclarationAdapter, astRoot);
+ }
+
+ public ITextRange columnDefinitionTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.columnDefinitionDeclarationAdapter, astRoot);
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.nameDeclarationAdapter, pos, astRoot);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setName(this.name(astRoot));
+ this.setColumnDefinition(this.columnDefinition(astRoot));
+ }
+
+ protected String name(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ protected String columnDefinition(CompilationUnit astRoot) {
+ return this.columnDefinitionAdapter.getValue(astRoot);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractNamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractNamedQuery.java
new file mode 100644
index 0000000000..7f38a83ed6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractNamedQuery.java
@@ -0,0 +1,296 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Type;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+public abstract class AbstractNamedQuery extends AbstractAnnotationResource<Type>
+ implements Query
+{
+ // hold this so we can get the 'name' text range
+ private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
+
+ // hold this so we can get the 'query' text range
+ private final DeclarationAnnotationElementAdapter<String> queryDeclarationAdapter;
+
+ private final AnnotationElementAdapter<String> nameAdapter;
+
+ private final AnnotationElementAdapter<String> queryAdapter;
+
+ private String name;
+
+ private String query;
+
+ private final List<NestableQueryHint> hints;
+ private final HintsContainerAnnotation hintsContainerAnnotation;
+
+ protected AbstractNamedQuery(JavaResource parent, Type type,DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, type, daa, annotationAdapter);
+ this.nameDeclarationAdapter = nameAdapter(daa);
+ this.queryDeclarationAdapter = queryAdapter(daa);
+ this.nameAdapter = this.buildAdapter(this.nameDeclarationAdapter);
+ this.queryAdapter = this.buildAdapter(this.queryDeclarationAdapter);
+ this.hints = new ArrayList<NestableQueryHint>();
+ this.hintsContainerAnnotation = new HintsContainerAnnotation();
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.name(astRoot);
+ this.query = this.query(astRoot);
+ ContainerAnnotationTools.initializeNestedAnnotations(astRoot, this.hintsContainerAnnotation);
+ }
+
+
+ // ********** initialization **********
+ protected AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ return new ShortCircuitAnnotationElementAdapter<String>(getMember(), daea);
+ }
+
+ protected DeclarationAnnotationElementAdapter<String> nameAdapter(DeclarationAnnotationAdapter daa) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, nameElementName());
+ }
+
+ protected DeclarationAnnotationElementAdapter<String> queryAdapter(DeclarationAnnotationAdapter daa) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, queryElementName());
+ }
+
+ protected abstract String nameElementName();
+
+ protected abstract String queryElementName();
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.nameAdapter.setValue(newName);
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public String getQuery() {
+ return this.query;
+ }
+
+ public void setQuery(String newQuery) {
+ String oldQuery = this.query;
+ this.query = newQuery;
+ this.queryAdapter.setValue(newQuery);
+ firePropertyChanged(QUERY_PROPERTY, oldQuery, newQuery);
+ }
+
+ public ListIterator<QueryHint> hints() {
+ return new CloneListIterator<QueryHint>(this.hints);
+ }
+
+ public int hintsSize() {
+ return this.hints.size();
+ }
+
+ public NestableQueryHint hintAt(int index) {
+ return this.hints.get(index);
+ }
+
+ public int indexOfHint(QueryHint queryHint) {
+ return this.hints.indexOf(queryHint);
+ }
+
+ public NestableQueryHint addHint(int index) {
+ NestableQueryHint queryHint = (NestableQueryHint) ContainerAnnotationTools.addNestedAnnotation(index, this.hintsContainerAnnotation);
+ fireItemAdded(Query.HINTS_LIST, index, queryHint);
+ return queryHint;
+ }
+
+ private void addHint(int index, NestableQueryHint queryHint) {
+ addItemToList(index, queryHint, this.hints, HINTS_LIST);
+ }
+
+ public void removeHint(int index) {
+ NestableQueryHint queryHint = hintAt(index);
+ removeHint(queryHint);
+ queryHint.removeAnnotation();
+ ContainerAnnotationTools.synchAnnotationsAfterRemove(index, this.hintsContainerAnnotation);
+ }
+
+ private void removeHint(NestableQueryHint queryHint) {
+ removeItemFromList(queryHint, this.hints, HINTS_LIST);
+ }
+
+ public void moveHint(int targetIndex, int sourceIndex) {
+ moveHintInternal(targetIndex, sourceIndex);
+ ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, this.hintsContainerAnnotation);
+ fireItemMoved(Query.HINTS_LIST, targetIndex, sourceIndex);
+ }
+
+ protected void moveHintInternal(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.hints, targetIndex, sourceIndex);
+ }
+
+ public ITextRange nameTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.nameDeclarationAdapter, astRoot);
+ }
+
+ public ITextRange queryTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.queryDeclarationAdapter, astRoot);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setName(this.name(astRoot));
+ this.setQuery(this.query(astRoot));
+ this.updateQueryHintsFromJava(astRoot);
+ }
+
+ protected String name(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ protected String query(CompilationUnit astRoot) {
+ return this.queryAdapter.getValue(astRoot);
+ }
+
+ private void updateQueryHintsFromJava(CompilationUnit astRoot) {
+ ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this.hintsContainerAnnotation);
+ }
+
+ protected abstract NestableQueryHint createQueryHint(int index);
+
+ // ********** persistence model -> java annotations **********
+ public IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
+ return (IndexedAnnotationAdapter) super.getAnnotationAdapter();
+ }
+
+ public void moveAnnotation(int newIndex) {
+ getIndexedAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ AbstractNamedQuery oldNamedQuery = (AbstractNamedQuery) oldAnnotation;
+ setName(oldNamedQuery.getName());
+ setQuery(oldNamedQuery.getQuery());
+ for (QueryHint queryHint : CollectionTools.iterable(oldNamedQuery.hints())) {
+ NestableQueryHint newQueryHint = addHint(oldNamedQuery.indexOfHint(queryHint));
+ newQueryHint.initializeFrom((NestableQueryHint) queryHint);
+ }
+ }
+
+
+ private class HintsContainerAnnotation extends AbstractResource implements ContainerAnnotation<NestableQueryHint> {
+
+ public HintsContainerAnnotation() {
+ super(AbstractNamedQuery.this);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ // nothing to initialize
+ }
+
+ public NestableQueryHint add(int index) {
+ NestableQueryHint queryHint = AbstractNamedQuery.this.createQueryHint(index);
+ AbstractNamedQuery.this.addHint(index, queryHint);
+ return queryHint;
+ }
+
+ public NestableQueryHint addInternal(int index) {
+ NestableQueryHint queryHint = AbstractNamedQuery.this.createQueryHint(index);
+ AbstractNamedQuery.this.hints.add(index, queryHint);
+ return queryHint;
+ }
+
+ public String getAnnotationName() {
+ return AbstractNamedQuery.this.getAnnotationName();
+ }
+
+ public String getNestableAnnotationName() {
+ return JPA.QUERY_HINT;
+ }
+
+ public int indexOf(NestableQueryHint hint) {
+ return AbstractNamedQuery.this.indexOfHint(hint);
+ }
+
+ public void move(int targetIndex, int sourceIndex) {
+ AbstractNamedQuery.this.moveHint(targetIndex, sourceIndex);
+ }
+
+ public void moveInternal(int targetIndex, int sourceIndex) {
+ AbstractNamedQuery.this.moveHintInternal(targetIndex, sourceIndex);
+ }
+
+ public NestableQueryHint nestedAnnotationAt(int index) {
+ return AbstractNamedQuery.this.hintAt(index);
+ }
+
+ public NestableQueryHint nestedAnnotationFor(Annotation jdtAnnotation) {
+ for (NestableQueryHint uniqueConstraint : CollectionTools.iterable(nestedAnnotations())) {
+ if (jdtAnnotation == uniqueConstraint.jdtAnnotation((CompilationUnit) jdtAnnotation.getRoot())) {
+ return uniqueConstraint;
+ }
+ }
+ return null;
+ }
+
+ public ListIterator<NestableQueryHint> nestedAnnotations() {
+ return new CloneListIterator<NestableQueryHint>(AbstractNamedQuery.this.hints);
+ }
+
+ public int nestedAnnotationsSize() {
+ return AbstractNamedQuery.this.hintsSize();
+ }
+
+ public void remove(NestableQueryHint queryHint) {
+ AbstractNamedQuery.this.removeHint(queryHint);
+ }
+
+ public void remove(int index) {
+ AbstractNamedQuery.this.removeHint(nestedAnnotationAt(index));
+ }
+
+ public Annotation jdtAnnotation(CompilationUnit astRoot) {
+ return AbstractNamedQuery.this.jdtAnnotation(astRoot);
+ }
+
+ public void newAnnotation() {
+ AbstractNamedQuery.this.newAnnotation();
+ }
+
+ public void removeAnnotation() {
+ AbstractNamedQuery.this.removeAnnotation();
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ AbstractNamedQuery.this.updateFromJava(astRoot);
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return AbstractNamedQuery.this.textRange(astRoot);
+ }
+
+ public String getElementName() {
+ return "hints";
+ }
+
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractRelationshipMappingAnnotation.java
new file mode 100644
index 0000000000..277816a4f3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractRelationshipMappingAnnotation.java
@@ -0,0 +1,279 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.List;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.EnumArrayDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ExpressionConverter;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitArrayAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+
+
+public abstract class AbstractRelationshipMappingAnnotation extends AbstractAnnotationResource<Attribute> implements RelationshipMapping
+{
+ // hold this so we can get the 'targetEntity' text range
+ private final DeclarationAnnotationElementAdapter<String> targetEntityDeclarationAdapter;
+
+ // hold this so we can get the 'fetch' text range
+ private final DeclarationAnnotationElementAdapter<String> fetchDeclarationAdapter;
+
+ // hold this so we can get the 'cascade' text range
+ private final DeclarationAnnotationElementAdapter<String[]> cascadeDeclarationAdapter;
+
+ private final AnnotationElementAdapter<String> targetEntityAdapter;
+
+ private final AnnotationElementAdapter<String> fetchAdapter;
+
+ private final AnnotationElementAdapter<String[]> cascadeAdapter;
+
+ private String targetEntity;
+
+ private String fullyQualifiedTargetEntity;
+
+ private FetchType fetch;
+
+ private CascadeType[] cascadeTypes;
+
+ public AbstractRelationshipMappingAnnotation(JavaPersistentAttributeResource parent, Attribute attribute, DeclarationAnnotationAdapter daa) {
+ super(parent, attribute, daa);
+ this.targetEntityDeclarationAdapter = targetEntityAdapter();
+ this.targetEntityAdapter = buildAnnotationElementAdapter(this.targetEntityDeclarationAdapter);
+ this.fetchDeclarationAdapter = fetchAdapter();
+ this.fetchAdapter = buildAnnotationElementAdapter(this.fetchDeclarationAdapter);
+ this.cascadeDeclarationAdapter = cascadeAdapter();
+ this.cascadeAdapter = new ShortCircuitArrayAnnotationElementAdapter<String>(attribute, this.cascadeDeclarationAdapter);
+ this.cascadeTypes = new CascadeType[0];
+ }
+
+ protected AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ return new ShortCircuitAnnotationElementAdapter<String>(this.getMember(), daea);
+ }
+
+ protected AnnotationElementAdapter<Boolean> buildBooleanAnnotationElementAdapter(DeclarationAnnotationElementAdapter<Boolean> daea) {
+ return new ShortCircuitAnnotationElementAdapter<Boolean>(this.getMember(), daea);
+ }
+
+ /**
+ * return the Java adapter's 'targetEntity' element adapter config
+ */
+ protected abstract DeclarationAnnotationElementAdapter<String> targetEntityAdapter();
+
+ /**
+ * return the Java adapter's 'cascade' element adapter config
+ */
+ protected abstract DeclarationAnnotationElementAdapter<String[]> cascadeAdapter();
+
+ /**
+ * return the Java adapter's 'fetch' element adapter config
+ */
+ protected abstract DeclarationAnnotationElementAdapter<String> fetchAdapter();
+
+ public void initialize(CompilationUnit astRoot) {
+ this.targetEntity = this.targetEntity(astRoot);
+ this.fullyQualifiedTargetEntity = this.fullyQualifiedTargetEntity(astRoot);
+ this.fetch = this.fetch(astRoot);
+ this.initializeCascadeTypes(astRoot);
+ }
+
+ protected void initializeCascadeTypes(CompilationUnit astRoot) {
+ String[] javaValue = this.cascadeAdapter.getValue(astRoot);
+ this.cascadeTypes = CascadeType.fromJavaAnnotationValue(javaValue);
+ }
+
+ public String getTargetEntity() {
+ return this.targetEntity;
+ }
+
+ public void setTargetEntity(String newTargetEntity) {
+ String oldTargetEntity = this.targetEntity;
+ this.targetEntity = newTargetEntity;
+ this.targetEntityAdapter.setValue(newTargetEntity);
+ firePropertyChanged(TARGET_ENTITY_PROPERTY, oldTargetEntity, newTargetEntity);
+ }
+
+ public String getFullyQualifiedTargetEntity() {
+ return this.fullyQualifiedTargetEntity;
+ }
+
+ protected void setFullyQualifiedTargetEntity(String newTargetEntity) {
+ String oldTargetEntity = this.fullyQualifiedTargetEntity;
+ this.fullyQualifiedTargetEntity = newTargetEntity;
+ firePropertyChanged(FULLY_QUALFIEID_TARGET_ENTITY_PROPERTY, oldTargetEntity, newTargetEntity);
+ }
+
+ public FetchType getFetch() {
+ return this.fetch;
+ }
+
+ public void setFetch(FetchType newFetch) {
+ FetchType oldFetch = this.fetch;
+ this.fetch = newFetch;
+ this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(newFetch));
+ firePropertyChanged(FETCH_PROPERTY, oldFetch, newFetch);
+ }
+
+ public boolean isCascadeAll() {
+ return CollectionTools.contains(this.cascadeTypes, CascadeType.ALL);
+ }
+
+ public void setCascadeAll(boolean newCascadeAll) {
+ boolean oldCascadeAll = isCascadeAll();
+ setCascade(newCascadeAll, CascadeType.ALL);
+ firePropertyChanged(CASCADE_ALL_PROPERTY, oldCascadeAll, newCascadeAll);
+ }
+
+ public boolean isCascadePersist() {
+ return CollectionTools.contains(this.cascadeTypes, CascadeType.PERSIST);
+ }
+
+ public void setCascadePersist(boolean newCascadePersist) {
+ boolean oldCascadePersist = isCascadePersist();
+ setCascade(newCascadePersist, CascadeType.PERSIST);
+ firePropertyChanged(CASCADE_PERSIST_PROPERTY, oldCascadePersist, newCascadePersist);
+ }
+
+ public boolean isCascadeMerge() {
+ return CollectionTools.contains(this.cascadeTypes, CascadeType.MERGE);
+ }
+
+ public void setCascadeMerge(boolean newCascadeMerge) {
+ boolean oldCascadeMerge = isCascadeMerge();
+ setCascade(newCascadeMerge, CascadeType.MERGE);
+ firePropertyChanged(CASCADE_MERGE_PROPERTY, oldCascadeMerge, newCascadeMerge);
+ }
+
+ public boolean isCascadeRemove() {
+ return CollectionTools.contains(this.cascadeTypes, CascadeType.REMOVE);
+ }
+
+ public void setCascadeRemove(boolean newCascadeRemove) {
+ boolean oldCascadeRemove = isCascadeRemove();
+ setCascade(newCascadeRemove, CascadeType.REMOVE);
+ firePropertyChanged(CASCADE_REMOVE_PROPERTY, oldCascadeRemove, newCascadeRemove);
+ }
+
+ public boolean isCascadeRefresh() {
+ return CollectionTools.contains(this.cascadeTypes, CascadeType.REFRESH);
+ }
+
+ public void setCascadeRefresh(boolean newCascadeRefresh) {
+ boolean oldCascadeRefresh = isCascadeRefresh();
+ setCascade(newCascadeRefresh, CascadeType.REFRESH);
+ firePropertyChanged(CASCADE_REFRESH_PROPERTY, oldCascadeRefresh, newCascadeRefresh);
+ }
+
+ private void addCascadeType(CascadeType cascadeType) {
+ List<CascadeType> cascadeCollection = CollectionTools.list(this.cascadeTypes);
+ cascadeCollection.add(cascadeType);
+ setCascadeTypes(cascadeCollection.toArray(new CascadeType[cascadeCollection.size()]));
+ }
+
+ private void removeCascadeType(CascadeType cascadeType) {
+ List<CascadeType> cascadeCollection = CollectionTools.list(this.cascadeTypes);
+ cascadeCollection.remove(cascadeType);
+ setCascadeTypes(cascadeCollection.toArray(new CascadeType[cascadeCollection.size()]));
+ }
+
+ private void setCascadeTypes(CascadeType[] cascadeTypes) {
+ this.cascadeTypes = cascadeTypes;
+ String[] newJavaValue = CascadeType.toJavaAnnotationValue(cascadeTypes);
+ this.cascadeAdapter.setValue(newJavaValue);
+ }
+
+ private void setCascade(boolean isSet, CascadeType cascadeType) {
+ List<CascadeType> cascadeCollection = CollectionTools.list(this.cascadeTypes);
+ if (cascadeCollection.contains(cascadeType)) {
+ if (!isSet) {
+ removeCascadeType(cascadeType);
+ }
+ }
+ else {
+ if (isSet) {
+ addCascadeType(cascadeType);
+ }
+ }
+ }
+
+ public ITextRange targetEntityTextRange(CompilationUnit astRoot) {
+ return elementTextRange(this.targetEntityDeclarationAdapter, astRoot);
+ }
+
+ public ITextRange fetchTextRange(CompilationUnit astRoot) {
+ return elementTextRange(this.fetchDeclarationAdapter, astRoot);
+ }
+
+ public ITextRange cascadeTextRange(CompilationUnit astRoot) {
+ return elementTextRange(this.cascadeDeclarationAdapter, astRoot);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setFetch(this.fetch(astRoot));
+ this.setTargetEntity(this.targetEntity(astRoot));
+ this.setFullyQualifiedTargetEntity(this.fullyQualifiedTargetEntity(astRoot));
+ this.updateCascadeFromJava(astRoot);
+ }
+
+ protected FetchType fetch(CompilationUnit astRoot) {
+ return FetchType.fromJavaAnnotationValue(this.fetchAdapter.getValue(astRoot));
+ }
+
+ protected String targetEntity(CompilationUnit astRoot) {
+ return this.targetEntityAdapter.getValue(astRoot);
+ }
+
+ private void updateCascadeFromJava(CompilationUnit astRoot) {
+ String[] javaValue = this.cascadeAdapter.getValue(astRoot);
+ CascadeType[] cascadeTypes = CascadeType.fromJavaAnnotationValue(javaValue);
+ //TODO need to test this, i think it might result in incorrect java
+ setCascadeAll(CollectionTools.contains(cascadeTypes, CascadeType.ALL));
+ setCascadeMerge(CollectionTools.contains(cascadeTypes, CascadeType.MERGE));
+ setCascadePersist(CollectionTools.contains(cascadeTypes, CascadeType.PERSIST));
+ setCascadeRefresh(CollectionTools.contains(cascadeTypes, CascadeType.REFRESH));
+ setCascadeRemove(CollectionTools.contains(cascadeTypes, CascadeType.REMOVE));
+ }
+
+ private String fullyQualifiedTargetEntity(CompilationUnit astRoot) {
+ if (getTargetEntity() == null) {
+ return null;
+ }
+ return JDTTools.resolveFullyQualifiedName(this.targetEntityAdapter.expression(astRoot));
+ }
+
+ // ********** static methods **********
+
+ protected static DeclarationAnnotationElementAdapter<String> buildTargetEntityAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ // TODO what about QualifiedType?
+ return buildAnnotationElementAdapter(annotationAdapter, elementName, SimpleTypeStringExpressionConverter.instance());
+ }
+
+ protected static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) {
+ return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, false, converter);
+ }
+
+ protected static DeclarationAnnotationElementAdapter<String> buildFetchAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return new EnumDeclarationAnnotationElementAdapter(annotationAdapter, elementName, false);
+ }
+
+ protected static DeclarationAnnotationElementAdapter<String[]> buildEnumArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return new EnumArrayDeclarationAnnotationElementAdapter(annotationAdapter, elementName, false);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractResource.java
new file mode 100644
index 0000000000..bb1cfbab61
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractResource.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IJpaAnnotationProvider;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationEditFormatter;
+import org.eclipse.jpt.utility.internal.CommandExecutorProvider;
+import org.eclipse.jpt.utility.internal.node.AbstractNode;
+import org.eclipse.jpt.utility.internal.node.Node;
+
+public abstract class AbstractResource extends AbstractNode
+ implements JavaResource
+{
+ protected AbstractResource(JavaResource parent) {
+ super(parent);
+ }
+
+
+ // **************** overrides **********************************************
+
+ @Override
+ public JavaResource parent() {
+ return (JavaResource) super.parent();
+ }
+
+ @Override
+ public JpaCompilationUnitResource root() {
+ return (JpaCompilationUnitResource) super.root();
+ }
+
+
+ // **************** JavaResource implementation ****************************
+
+ public IJpaAnnotationProvider annotationProvider() {
+ return root().annotationProvider();
+ }
+
+ public CommandExecutorProvider modifySharedDocumentCommandExecutorProvider() {
+ return root().modifySharedDocumentCommandExecutorProvider();
+ }
+
+ public AnnotationEditFormatter annotationEditFormatter() {
+ return root().annotationEditFormatter();
+ }
+
+ public JavaResourceModel resourceModel() {
+ return root().resourceModel();
+ }
+
+ public void resolveTypes(CompilationUnit astRoot) {
+ }
+
+ /**
+ * @see Node#displayString()
+ *
+ * Return simple toString. Override if this class is to be displayed.
+ */
+ public String displayString() {
+ return toString();
+ }
+
+ @Override
+ protected void aspectChanged(String aspectName) {
+ super.aspectChanged(aspectName);
+ root().resourceChanged();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractTableResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractTableResource.java
new file mode 100644
index 0000000000..f824448582
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractTableResource.java
@@ -0,0 +1,324 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+public abstract class AbstractTableResource extends AbstractAnnotationResource<Member> implements Table
+{
+ // hold this so we can get the 'name' text range
+ private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
+
+ // hold this so we can get the 'schema' text range
+ private final DeclarationAnnotationElementAdapter<String> schemaDeclarationAdapter;
+
+ // hold this so we can get the 'catalog' text range
+ private final DeclarationAnnotationElementAdapter<String> catalogDeclarationAdapter;
+
+ private final AnnotationElementAdapter<String> nameAdapter;
+
+ private final AnnotationElementAdapter<String> schemaAdapter;
+
+ private final AnnotationElementAdapter<String> catalogAdapter;
+
+ private String name;
+
+ private String catalog;
+
+ private String schema;
+
+ private final List<NestableUniqueConstraint> uniqueConstraints;
+
+ private final UniqueConstraintsContainerAnnotation uniqueConstraintsContainerAnnotation;
+
+ protected AbstractTableResource(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.nameDeclarationAdapter = this.nameAdapter(daa);
+ this.schemaDeclarationAdapter = this.schemaAdapter(daa);
+ this.catalogDeclarationAdapter = this.catalogAdapter(daa);
+ this.nameAdapter = buildAnnotationElementAdapter(this.nameDeclarationAdapter);
+ this.schemaAdapter = buildAnnotationElementAdapter(this.schemaDeclarationAdapter);
+ this.catalogAdapter = buildAnnotationElementAdapter(this.catalogDeclarationAdapter);
+ this.uniqueConstraints = new ArrayList<NestableUniqueConstraint>();
+ this.uniqueConstraintsContainerAnnotation = new UniqueConstraintsContainerAnnotation();
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.name(astRoot);
+ this.catalog = this.catalog(astRoot);
+ this.schema = this.schema(astRoot);
+ ContainerAnnotationTools.initializeNestedAnnotations(astRoot, this.uniqueConstraintsContainerAnnotation);
+ }
+
+ protected AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ return new ShortCircuitAnnotationElementAdapter<String>(this.getMember(), daea);
+ }
+
+ /**
+ * Build and return a declaration element adapter for the table's 'name' element
+ */
+ protected abstract DeclarationAnnotationElementAdapter<String> nameAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter);
+
+ /**
+ * Build and return a declaration element adapter for the table's 'schema' element
+ */
+ protected abstract DeclarationAnnotationElementAdapter<String> schemaAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter);
+
+ /**
+ * Build and return a declaration element adapter for the table's 'catalog' element
+ */
+ protected abstract DeclarationAnnotationElementAdapter<String> catalogAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter);
+
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.nameAdapter.setValue(newName);
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public String getCatalog() {
+ return this.catalog;
+ }
+
+ public void setCatalog(String newCatalog) {
+ String oldCatalog = this.catalog;
+ this.catalog = newCatalog;
+ this.catalogAdapter.setValue(newCatalog);
+ firePropertyChanged(CATALOG_PROPERTY, oldCatalog, newCatalog);
+ }
+
+ public String getSchema() {
+ return this.schema;
+ }
+
+ public void setSchema(String newSchema) {
+ String oldSchema = this.schema;
+ this.schema = newSchema;
+ this.schemaAdapter.setValue(newSchema);
+ firePropertyChanged(SCHEMA_PROPERTY, oldSchema, newSchema);
+ }
+
+ public ListIterator<UniqueConstraint> uniqueConstraints() {
+ return new CloneListIterator<UniqueConstraint>(this.uniqueConstraints);
+ }
+
+ public int uniqueConstraintsSize() {
+ return this.uniqueConstraints.size();
+ }
+
+ public NestableUniqueConstraint uniqueConstraintAt(int index) {
+ return this.uniqueConstraints.get(index);
+ }
+
+ public int indexOfUniqueConstraint(UniqueConstraint uniqueConstraint) {
+ return this.uniqueConstraints.indexOf(uniqueConstraint);
+ }
+
+ public NestableUniqueConstraint addUniqueConstraint(int index) {
+ NestableUniqueConstraint uniqueConstraint = (NestableUniqueConstraint) ContainerAnnotationTools.addNestedAnnotation(index, this.uniqueConstraintsContainerAnnotation);
+ fireItemAdded(Table.UNIQUE_CONSTRAINTS_LIST, index, uniqueConstraint);
+ return uniqueConstraint;
+ }
+
+ private void addUniqueConstraint(int index, NestableUniqueConstraint uniqueConstraint) {
+ addItemToList(index, uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ public void removeUniqueConstraint(int index) {
+ NestableUniqueConstraint uniqueConstraint = this.uniqueConstraintAt(index);
+ removeUniqueConstraint(uniqueConstraint);
+ uniqueConstraint.removeAnnotation();
+ ContainerAnnotationTools.synchAnnotationsAfterRemove(index, this.uniqueConstraintsContainerAnnotation);
+ }
+
+ private void removeUniqueConstraint(NestableUniqueConstraint uniqueConstraint) {
+ removeItemFromList(uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
+ moveUniqueConstraintInternal(targetIndex, sourceIndex);
+ ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, this.uniqueConstraintsContainerAnnotation);
+ fireItemMoved(Table.UNIQUE_CONSTRAINTS_LIST, targetIndex, sourceIndex);
+ }
+
+ protected void moveUniqueConstraintInternal(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.uniqueConstraints, targetIndex, sourceIndex);
+ }
+
+ protected abstract NestableUniqueConstraint createUniqueConstraint(int index);
+
+ public ITextRange nameTextRange(CompilationUnit astRoot) {
+ return elementTextRange(this.nameDeclarationAdapter, astRoot);
+ }
+
+ public ITextRange schemaTextRange(CompilationUnit astRoot) {
+ return elementTextRange(this.schemaDeclarationAdapter, astRoot);
+ }
+
+ public ITextRange catalogTextRange(CompilationUnit astRoot) {
+ return elementTextRange(this.catalogDeclarationAdapter, astRoot);
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.nameDeclarationAdapter, pos, astRoot);
+ }
+
+ public boolean catalogTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.catalogDeclarationAdapter, pos, astRoot);
+ }
+
+ public boolean schemaTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.schemaDeclarationAdapter, pos, astRoot);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setName(this.name(astRoot));
+ this.setSchema(this.schema(astRoot));
+ this.setCatalog(this.catalog(astRoot));
+ this.updateUniqueConstraintsFromJava(astRoot);
+ }
+
+ protected String name(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ protected String schema(CompilationUnit astRoot) {
+ return this.schemaAdapter.getValue(astRoot);
+ }
+
+ protected String catalog(CompilationUnit astRoot) {
+ return this.catalogAdapter.getValue(astRoot);
+ }
+
+ /**
+ * here we just worry about getting the unique constraints lists the same size;
+ * then we delegate to the unique constraints to synch themselves up
+ */
+ private void updateUniqueConstraintsFromJava(CompilationUnit astRoot) {
+ ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this.uniqueConstraintsContainerAnnotation);
+ }
+
+
+ private class UniqueConstraintsContainerAnnotation extends AbstractResource
+ implements ContainerAnnotation<NestableUniqueConstraint>
+ {
+ public UniqueConstraintsContainerAnnotation() {
+ super(AbstractTableResource.this);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //nothing to initialize
+ }
+
+ public NestableUniqueConstraint addInternal(int index) {
+ NestableUniqueConstraint uniqueConstraint = AbstractTableResource.this.createUniqueConstraint(index);
+ AbstractTableResource.this.uniqueConstraints.add(index, uniqueConstraint);
+ return uniqueConstraint;
+ }
+
+ public NestableUniqueConstraint add(int index) {
+ NestableUniqueConstraint uniqueConstraint = AbstractTableResource.this.createUniqueConstraint(index);
+ AbstractTableResource.this.addUniqueConstraint(index, uniqueConstraint);
+ return uniqueConstraint;
+ }
+
+ public String getAnnotationName() {
+ return AbstractTableResource.this.getAnnotationName();
+ }
+
+ public String getNestableAnnotationName() {
+ return JPA.UNIQUE_CONSTRAINT;
+ }
+
+ public int indexOf(NestableUniqueConstraint uniqueConstraint) {
+ return AbstractTableResource.this.indexOfUniqueConstraint(uniqueConstraint);
+ }
+
+ public void move(int targetIndex, int sourceIndex) {
+ AbstractTableResource.this.moveUniqueConstraint(targetIndex, sourceIndex);
+ }
+
+ public void moveInternal(int targetIndex, int sourceIndex) {
+ AbstractTableResource.this.moveUniqueConstraintInternal(targetIndex, sourceIndex);
+ }
+
+ public NestableUniqueConstraint nestedAnnotationAt(int index) {
+ return AbstractTableResource.this.uniqueConstraintAt(index);
+ }
+
+ public NestableUniqueConstraint nestedAnnotationFor(Annotation jdtAnnotation) {
+ for (NestableUniqueConstraint uniqueConstraint : CollectionTools.iterable(nestedAnnotations())) {
+ if (jdtAnnotation == uniqueConstraint.jdtAnnotation((CompilationUnit) jdtAnnotation.getRoot())) {
+ return uniqueConstraint;
+ }
+ }
+ return null;
+ }
+
+ public ListIterator<NestableUniqueConstraint> nestedAnnotations() {
+ return new CloneListIterator<NestableUniqueConstraint>(AbstractTableResource.this.uniqueConstraints);
+ }
+
+ public int nestedAnnotationsSize() {
+ return AbstractTableResource.this.uniqueConstraintsSize();
+ }
+
+ public void remove(NestableUniqueConstraint uniqueConstraint) {
+ AbstractTableResource.this.removeUniqueConstraint(uniqueConstraint);
+ }
+
+ public void remove(int index) {
+ this.remove(nestedAnnotationAt(index));
+ }
+
+ public Annotation jdtAnnotation(CompilationUnit astRoot) {
+ return AbstractTableResource.this.jdtAnnotation(astRoot);
+ }
+
+ public void newAnnotation() {
+ AbstractTableResource.this.newAnnotation();
+ }
+
+ public void removeAnnotation() {
+ AbstractTableResource.this.removeAnnotation();
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ AbstractTableResource.this.updateFromJava(astRoot);
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return AbstractTableResource.this.textRange(astRoot);
+ }
+
+ public String getElementName() {
+ return "uniqueConstraints";
+ }
+
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AccessType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AccessType.java
new file mode 100644
index 0000000000..0ce01c1820
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AccessType.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public enum AccessType {
+
+ PROPERTY,
+ FIELD;
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Annotation.java
new file mode 100644
index 0000000000..627404890f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Annotation.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+
+public interface Annotation extends JavaResource
+{
+ /**
+ * Return the fully qualified annotation name.
+ * @see JPA
+ */
+ String getAnnotationName();
+
+ org.eclipse.jdt.core.dom.Annotation jdtAnnotation(CompilationUnit astRoot);
+
+ /**
+ * Removing the underyling Java annotation
+ */
+ void removeAnnotation();
+
+ /**
+ * Create and add Java annotation
+ */
+ void newAnnotation();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AnnotationDefinition.java
new file mode 100644
index 0000000000..7b2a2758e9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AnnotationDefinition.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.platform.base.BaseJpaPlatform;
+
+/**
+ * Used for building new Annotations.
+ * These should be used to define non-mapping annotations. If you
+ * want to provide new AnnotationDefinitions you will need
+ * to create a new JpaPlatform by extending BaseJpaPlatform.
+ *
+ * @see MappingAnnotation
+ * @see BaseJpaPlatform
+ */
+public interface AnnotationDefinition
+{
+ /**
+ * Return the fully qualified annotation name
+ */
+ String getAnnotationName();
+
+ /**
+ * Build and return an Annotation given the Member
+ */
+ Annotation buildAnnotation(JavaResource parent, Member member);
+
+ Annotation buildNullAnnotation(JavaResource parent, Member member);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverride.java
new file mode 100644
index 0000000000..0bb5487ecb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverride.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ListIterator;
+
+/**
+ * Corresponds to the javax.persistence.AssociationOverride annotation
+ */
+public interface AssociationOverride extends OverrideResource
+{
+ String ANNOTATION_NAME = JPA.ASSOCIATION_OVERRIDE;
+
+
+ /**
+ * Corresponds to the joinColumns element of the AssociationOverride annotation.
+ * Returns an empty iterator if the joinColumns element does not exist in java.
+ */
+ ListIterator<JoinColumn> joinColumns();
+
+ JoinColumn joinColumnAt(int index);
+
+ int indexOfJoinColumn(JoinColumn joinColumn);
+
+ int joinColumnsSize();
+
+ JoinColumn addJoinColumn(int index);
+
+ void removeJoinColumn(int index);
+
+ void moveJoinColumn(int targetIndex, int sourceIndex);
+
+ String JOIN_COLUMNS_LIST = "joinColumnsList";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrideImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrideImpl.java
new file mode 100644
index 0000000000..602a60e75c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrideImpl.java
@@ -0,0 +1,274 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+public class AssociationOverrideImpl
+ extends OverrideImpl
+ implements NestableAssociationOverride
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final List<NestableJoinColumn> joinColumns;
+
+ private final JoinColumnsContainerAnnotation joinColumnsContainerAnnotation;
+
+ protected AssociationOverrideImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.joinColumns = new ArrayList<NestableJoinColumn>();
+ this.joinColumnsContainerAnnotation = new JoinColumnsContainerAnnotation();
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ ContainerAnnotationTools.initializeNestedAnnotations(astRoot, this.joinColumnsContainerAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return AssociationOverride.ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ super.initializeFrom(oldAnnotation);
+ AssociationOverride oldAssociationOverride = (AssociationOverride) oldAnnotation;
+ for (JoinColumn joinColumn : CollectionTools.iterable(oldAssociationOverride.joinColumns())) {
+ NestableJoinColumn newJoinColumn = addJoinColumn(oldAssociationOverride.indexOfJoinColumn(joinColumn));
+ newJoinColumn.initializeFrom((NestableAnnotation) joinColumn);
+ }
+ }
+
+
+ // ************* Association implementation *******************
+
+ public ListIterator<JoinColumn> joinColumns() {
+ return new CloneListIterator<JoinColumn>(this.joinColumns);
+ }
+
+ public int joinColumnsSize() {
+ return this.joinColumns.size();
+ }
+
+ public NestableJoinColumn joinColumnAt(int index) {
+ return this.joinColumns.get(index);
+ }
+
+ public int indexOfJoinColumn(JoinColumn joinColumn) {
+ return this.joinColumns.indexOf(joinColumn);
+ }
+
+ public NestableJoinColumn addJoinColumn(int index) {
+ NestableJoinColumn joinColumn = (NestableJoinColumn) ContainerAnnotationTools.addNestedAnnotation(index, this.joinColumnsContainerAnnotation);
+ fireItemAdded(AssociationOverride.JOIN_COLUMNS_LIST, index, joinColumn);
+ return joinColumn;
+ }
+
+ private void addJoinColumn(int index, NestableJoinColumn joinColumn) {
+ addItemToList(index, joinColumn, this.joinColumns, AssociationOverride.JOIN_COLUMNS_LIST);
+ }
+
+ public void removeJoinColumn(int index) {
+ NestableJoinColumn joinColumn = this.joinColumns.get(index);
+ removeJoinColumn(joinColumn);
+ joinColumn.removeAnnotation();
+ ContainerAnnotationTools.synchAnnotationsAfterRemove(index, this.joinColumnsContainerAnnotation);
+ }
+
+ private void removeJoinColumn(NestableJoinColumn joinColumn) {
+ removeItemFromList(joinColumn, this.joinColumns, AssociationOverride.JOIN_COLUMNS_LIST);
+ }
+
+ public void moveJoinColumn(int targetIndex, int sourceIndex) {
+ moveJoinColumnInternal(targetIndex, sourceIndex);
+ ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, this.joinColumnsContainerAnnotation);
+ fireItemMoved(AssociationOverride.JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
+ }
+
+ protected void moveJoinColumnInternal(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.joinColumns, targetIndex, sourceIndex);
+ }
+
+ protected NestableJoinColumn createJoinColumn(int index) {
+ return JoinColumnImpl.createAssociationOverrideJoinColumn(getDeclarationAnnotationAdapter(), this, getMember(), index);
+ }
+
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.updateJoinColumnsFromJava(astRoot);
+ }
+
+ private void updateJoinColumnsFromJava(CompilationUnit astRoot) {
+ ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this.joinColumnsContainerAnnotation);
+ }
+
+
+ // ********** static methods **********
+ static AssociationOverrideImpl createAssociationOverride(JavaResource parent, Member member) {
+ return new AssociationOverrideImpl(parent, member, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
+ }
+
+ static AssociationOverrideImpl createNestedAssociationOverride(JavaResource parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter);
+ IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
+ return new AssociationOverrideImpl(parent, member, idaa, annotationAdapter);
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
+ return new NestedIndexedDeclarationAnnotationAdapter(attributeOverridesAdapter, index, JPA.ASSOCIATION_OVERRIDE);
+ }
+
+ private class JoinColumnsContainerAnnotation extends AbstractResource
+ implements ContainerAnnotation<NestableJoinColumn>
+ {
+ public JoinColumnsContainerAnnotation() {
+ super(AssociationOverrideImpl.this);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //nothing to initialize
+ }
+
+ public NestableJoinColumn addInternal(int index) {
+ NestableJoinColumn joinColumn = AssociationOverrideImpl.this.createJoinColumn(index);
+ AssociationOverrideImpl.this.joinColumns.add(index, joinColumn);
+ return joinColumn;
+ }
+
+ public NestableJoinColumn add(int index) {
+ NestableJoinColumn joinColumn = AssociationOverrideImpl.this.createJoinColumn(index);
+ AssociationOverrideImpl.this.addJoinColumn(index, joinColumn);
+ return joinColumn;
+ }
+
+ public int indexOf(NestableJoinColumn pkJoinColumn) {
+ return AssociationOverrideImpl.this.indexOfJoinColumn(pkJoinColumn);
+ }
+
+ public void move(int targetIndex, int sourceIndex) {
+ AssociationOverrideImpl.this.moveJoinColumn(targetIndex, sourceIndex);
+ }
+
+ public void moveInternal(int targetIndex, int sourceIndex) {
+ AssociationOverrideImpl.this.moveJoinColumnInternal(targetIndex, sourceIndex);
+ }
+
+ public NestableJoinColumn nestedAnnotationAt(int index) {
+ return AssociationOverrideImpl.this.joinColumnAt(index);
+ }
+
+ public ListIterator<NestableJoinColumn> nestedAnnotations() {
+ return new CloneListIterator<NestableJoinColumn>(AssociationOverrideImpl.this.joinColumns);
+ }
+
+ public int nestedAnnotationsSize() {
+ return joinColumnsSize();
+ }
+
+ public void remove(int index) {
+ this.remove(nestedAnnotationAt(index));
+ }
+
+ public void remove(NestableJoinColumn joinColumn) {
+ AssociationOverrideImpl.this.removeJoinColumn(joinColumn);
+ }
+
+ public String getAnnotationName() {
+ return AssociationOverrideImpl.this.getAnnotationName();
+ }
+
+ public String getNestableAnnotationName() {
+ return JPA.JOIN_COLUMN;
+ }
+
+ public NestableJoinColumn nestedAnnotationFor(org.eclipse.jdt.core.dom.Annotation jdtAnnotation) {
+ for (NestableJoinColumn pkJoinColumn : CollectionTools.iterable(nestedAnnotations())) {
+ if (jdtAnnotation == pkJoinColumn.jdtAnnotation((CompilationUnit) jdtAnnotation.getRoot())) {
+ return pkJoinColumn;
+ }
+ }
+ return null;
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation jdtAnnotation(CompilationUnit astRoot) {
+ return AssociationOverrideImpl.this.jdtAnnotation(astRoot);
+ }
+
+ public void newAnnotation() {
+ AssociationOverrideImpl.this.newAnnotation();
+ }
+
+ public void removeAnnotation() {
+ AssociationOverrideImpl.this.removeAnnotation();
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ AssociationOverrideImpl.this.updateFromJava(astRoot);
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return AssociationOverrideImpl.this.textRange(astRoot);
+ }
+
+ public String getElementName() {
+ return "joinColumns";
+ }
+
+ }
+
+ public static class AssociationOverrideAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final AssociationOverrideAnnotationDefinition INSTANCE = new AssociationOverrideAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private AssociationOverrideAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return AssociationOverrideImpl.createAssociationOverride(parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return AssociationOverride.ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrides.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrides.java
new file mode 100644
index 0000000000..117958ddf5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrides.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public interface AssociationOverrides extends ContainerAnnotation<NestableAssociationOverride>
+{
+ String ANNOTATION_NAME = JPA.ASSOCIATION_OVERRIDES;
+
+ String ASSOCIATION_OVERRIDES_LIST = "associationOveridesList";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverridesImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverridesImpl.java
new file mode 100644
index 0000000000..b0defa413c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverridesImpl.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+public class AssociationOverridesImpl extends AbstractAnnotationResource<Member> implements AssociationOverrides
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ protected final List<NestableAssociationOverride> associationOverrides;
+
+ protected AssociationOverridesImpl(JavaResource parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ this.associationOverrides = new ArrayList<NestableAssociationOverride>();
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ ContainerAnnotationTools.initializeNestedAnnotations(astRoot, this);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public String getNestableAnnotationName() {
+ return AssociationOverride.ANNOTATION_NAME;
+ }
+
+ public ListIterator<NestableAssociationOverride> nestedAnnotations() {
+ return new CloneListIterator<NestableAssociationOverride>(this.associationOverrides);
+ }
+
+ public int nestedAnnotationsSize() {
+ return this.associationOverrides.size();
+ }
+
+ public NestableAssociationOverride addInternal(int index) {
+ NestableAssociationOverride associationOverride = createAssociationOverride(index);
+ this.associationOverrides.add(index, associationOverride);
+ return associationOverride;
+ }
+
+ public NestableAssociationOverride add(int index) {
+ NestableAssociationOverride associationOverride = createAssociationOverride(index);
+ add(index, associationOverride);
+ return associationOverride;
+ }
+
+ private void add(int index, NestableAssociationOverride associationOverride) {
+ addItemToList(index, associationOverride, this.associationOverrides, ASSOCIATION_OVERRIDES_LIST);
+ }
+
+ public void remove(NestableAssociationOverride associationOverride) {
+ removeItemFromList(associationOverride, this.associationOverrides, ASSOCIATION_OVERRIDES_LIST);
+ }
+
+ public void remove(int index) {
+ removeItemFromList(index, this.associationOverrides, ASSOCIATION_OVERRIDES_LIST);
+ }
+
+ public int indexOf(NestableAssociationOverride associationOverride) {
+ return this.associationOverrides.indexOf(associationOverride);
+ }
+
+ public NestableAssociationOverride nestedAnnotationAt(int index) {
+ return this.associationOverrides.get(index);
+ }
+
+ public NestableAssociationOverride nestedAnnotationFor(Annotation jdtAnnotation) {
+ for (NestableAssociationOverride associationOverride : this.associationOverrides) {
+ if (jdtAnnotation == associationOverride.jdtAnnotation((CompilationUnit) jdtAnnotation.getRoot())) {
+ return associationOverride;
+ }
+ }
+ return null;
+ }
+
+ public void move(int targetIndex, int sourceIndex) {
+ moveItemInList(targetIndex, sourceIndex, this.associationOverrides, ASSOCIATION_OVERRIDES_LIST);
+ }
+
+ public void moveInternal(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.associationOverrides, targetIndex, sourceIndex);
+ }
+
+ public String getElementName() {
+ return "value";
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this);
+ }
+
+ private AssociationOverrideImpl createAssociationOverride(int index) {
+ return AssociationOverrideImpl.createNestedAssociationOverride(this, getMember(), index, getDeclarationAnnotationAdapter());
+ }
+
+ public static class AssociationOverridesAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final AssociationOverridesAnnotationDefinition INSTANCE = new AssociationOverridesAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private AssociationOverridesAnnotationDefinition() {
+ super();
+ }
+
+ public AssociationOverrides buildAnnotation(JavaResource parent, Member member) {
+ return new AssociationOverridesImpl(parent, member);
+ }
+
+ public AssociationOverrides buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverride.java
new file mode 100644
index 0000000000..87075273ec
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverride.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+/**
+ * Corresponds to the javax.persistence.AttributeOverride annotation
+ */
+public interface AttributeOverride extends OverrideResource
+{
+ String ANNOTATION_NAME = JPA.ATTRIBUTE_OVERRIDE;
+
+ /**
+ * Corresponds to the column element of the AttributeOverride annotation.
+ * Returns null if the column element does not exist in java.
+ */
+ Column getColumn();
+
+ /**
+ * Add the column element to the AttributeOverride annotation.
+ */
+ Column addColumn();
+
+ /**
+ * Remove the column element from the AttributeOverride annotation.
+ */
+ void removeColumn();
+
+ Column getNonNullColumn();
+
+ String COLUMN_PROPERTY = "columnProperty";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrideImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrideImpl.java
new file mode 100644
index 0000000000..b764109723
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrideImpl.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class AttributeOverrideImpl
+ extends OverrideImpl
+ implements NestableAttributeOverride
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final MemberAnnotationAdapter columnAdapter;
+
+ private ColumnImpl column;
+
+
+ protected AttributeOverrideImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.columnAdapter = new MemberAnnotationAdapter(getMember(), ColumnImpl.buildAttributeOverrideAnnotationAdapter(getDeclarationAnnotationAdapter()));
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ if (this.columnAdapter.getAnnotation(astRoot) != null) {
+ this.column = ColumnImpl.createAttributeOverrideColumn(this, getMember(), getDeclarationAnnotationAdapter());
+ this.column.initialize(astRoot);
+ }
+ }
+
+ public String getAnnotationName() {
+ return AttributeOverride.ANNOTATION_NAME;
+ }
+
+ @Override
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ super.initializeFrom(oldAnnotation);
+ AttributeOverride oldAttributeOverride = (AttributeOverride) oldAnnotation;
+ if (oldAttributeOverride.getColumn() != null) {
+ Column column = addColumn();
+ ((NestableAnnotation) column).initializeFrom((NestableAnnotation) oldAttributeOverride.getColumn());
+ }
+ }
+
+ //************ AttriubteOverride implementation ****************
+
+ public Column getNonNullColumn() {
+ return (getColumn() != null) ? getColumn() : new NullColumn(this);
+ }
+
+ public Column getColumn() {
+ return this.column;
+ }
+
+ public Column addColumn() {
+ ColumnImpl column = ColumnImpl.createAttributeOverrideColumn(this, getMember(), getDeclarationAnnotationAdapter());
+ column.newAnnotation();
+ setColumn(column);
+ return column;
+ }
+
+ public void removeColumn() {
+ this.column.removeAnnotation();
+ setColumn(null);
+ }
+
+ protected void setColumn(ColumnImpl newColumn) {
+ ColumnImpl oldColumn = this.column;
+ this.column = newColumn;
+ firePropertyChanged(AttributeOverride.COLUMN_PROPERTY, oldColumn, newColumn);
+ }
+
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ if (this.columnAdapter.getAnnotation(astRoot) == null) {
+ this.setColumn(null);
+ }
+ else {
+ if (getColumn() != null) {
+ getColumn().updateFromJava(astRoot);
+ }
+ else {
+ ColumnImpl column = ColumnImpl.createAttributeOverrideColumn(this, getMember(), getDeclarationAnnotationAdapter());
+ column.initialize(astRoot);
+ this.setColumn(column);
+ }
+ }
+ }
+
+ // ********** static methods **********
+ static AttributeOverrideImpl createAttributeOverride(JavaResource parent, Member member) {
+ return new AttributeOverrideImpl(parent, member, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
+ }
+
+ static AttributeOverrideImpl createNestedAttributeOverride(JavaResource parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter);
+ IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
+ return new AttributeOverrideImpl(parent, member, idaa, annotationAdapter);
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
+ return new NestedIndexedDeclarationAnnotationAdapter(attributeOverridesAdapter, index, JPA.ATTRIBUTE_OVERRIDE);
+ }
+
+ public static class AttributeOverrideAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final AttributeOverrideAnnotationDefinition INSTANCE = new AttributeOverrideAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private AttributeOverrideAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return AttributeOverrideImpl.createAttributeOverride(parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return AttributeOverride.ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrides.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrides.java
new file mode 100644
index 0000000000..d39825b3e7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrides.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public interface AttributeOverrides extends ContainerAnnotation<NestableAttributeOverride>
+{
+ String ANNOTATION_NAME = JPA.ATTRIBUTE_OVERRIDES;
+
+ String ATTRIBUTE_OVERRIDES_LIST = "attributeOverridesList";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverridesImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverridesImpl.java
new file mode 100644
index 0000000000..b937f0344c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverridesImpl.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+public class AttributeOverridesImpl extends AbstractAnnotationResource<Member> implements AttributeOverrides
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final List<NestableAttributeOverride> attributesOverrides;
+
+ protected AttributeOverridesImpl(JavaResource parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ this.attributesOverrides = new ArrayList<NestableAttributeOverride>();
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ ContainerAnnotationTools.initializeNestedAnnotations(astRoot, this);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public String getNestableAnnotationName() {
+ return AttributeOverride.ANNOTATION_NAME;
+ }
+
+ public ListIterator<NestableAttributeOverride> nestedAnnotations() {
+ return new CloneListIterator<NestableAttributeOverride>(this.attributesOverrides);
+ }
+
+ public int nestedAnnotationsSize() {
+ return this.attributesOverrides.size();
+ }
+
+ public NestableAttributeOverride addInternal(int index) {
+ NestableAttributeOverride attributeOverride = createAttributeOverride(index);
+ this.attributesOverrides.add(index, attributeOverride);
+ return attributeOverride;
+ }
+
+ public NestableAttributeOverride add(int index) {
+ NestableAttributeOverride attributeOverride = createAttributeOverride(index);
+ add(index, attributeOverride);
+ return attributeOverride;
+ }
+
+ private void add(int index, NestableAttributeOverride attributeOverride) {
+ addItemToList(index, attributeOverride, this.attributesOverrides, ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public void remove(NestableAttributeOverride attributeOverride) {
+ removeItemFromList(attributeOverride, this.attributesOverrides, ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public void remove(int index) {
+ removeItemFromList(index, this.attributesOverrides, ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public int indexOf(NestableAttributeOverride attributeOverride) {
+ return this.attributesOverrides.indexOf(attributeOverride);
+ }
+
+ public NestableAttributeOverride nestedAnnotationAt(int index) {
+ return this.attributesOverrides.get(index);
+ }
+
+ public NestableAttributeOverride nestedAnnotationFor(Annotation jdtAnnotation) {
+ for (NestableAttributeOverride attributeOverride : this.attributesOverrides) {
+ if (jdtAnnotation == attributeOverride.jdtAnnotation((CompilationUnit) jdtAnnotation.getRoot())) {
+ return attributeOverride;
+ }
+ }
+ return null;
+ }
+
+ public void move(int targetIndex, int sourceIndex) {
+ moveItemInList(targetIndex, sourceIndex, this.attributesOverrides, ATTRIBUTE_OVERRIDES_LIST);
+ }
+
+ public void moveInternal(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.attributesOverrides, targetIndex, sourceIndex);
+ }
+
+ public String getElementName() {
+ return "value";
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this);
+ }
+
+ private AttributeOverrideImpl createAttributeOverride(int index) {
+ return AttributeOverrideImpl.createNestedAttributeOverride(this, getMember(), index, getDeclarationAnnotationAdapter());
+ }
+
+
+ public static class AttributeOverridesAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final AttributeOverridesAnnotationDefinition INSTANCE = new AttributeOverridesAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private AttributeOverridesAnnotationDefinition() {
+ super();
+ }
+
+ public AttributeOverrides buildAnnotation(JavaResource parent, Member member) {
+ return new AttributeOverridesImpl(parent, member);
+ }
+
+ public AttributeOverrides buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Basic.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Basic.java
new file mode 100644
index 0000000000..7ca3722186
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Basic.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public interface Basic extends JavaResource
+{
+
+ String ANNOTATION_NAME = JPA.BASIC;
+
+ /**
+ * Corresponds to the fetch element of the Basic annotation.
+ * Returns null if the fetch element does not exist in java.
+ */
+ FetchType getFetch();
+
+ /**
+ * Corresponds to the fetch element of the Basic annotation.
+ * Set to null to remove the fetch element.
+ */
+ void setFetch(FetchType fetch);
+ String FETCH_PROPERTY = "fetchProperty";
+
+ /**
+ * Corresponds to the optional element of the Basic annotation.
+ * Returns null if the optional element does not exist in java.
+ */
+ Boolean getOptional();
+
+ /**
+ * Corresponds to the optional element of the Basic annotation.
+ * Set to null to remove the optional element.
+ */
+ void setOptional(Boolean optional);
+ String OPTIONAL_PROPERTY = "optionalProperty";
+
+ /**
+ * Return the ITextRange for the fetch element. If the fetch element
+ * does not exist return the ITextRange for the Basic annotation.
+ */
+ ITextRange fetchTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the optional element. If the optional element
+ * does not exist return the ITextRange for the Basic annotation.
+ */
+ ITextRange optionalTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/BasicImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/BasicImpl.java
new file mode 100644
index 0000000000..e99fe81600
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/BasicImpl.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.BooleanExpressionConverter;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+
+public class BasicImpl extends AbstractAnnotationResource<Attribute> implements Basic
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final AnnotationElementAdapter<Boolean> optionalAdapter;
+
+ private final AnnotationElementAdapter<String> fetchAdapter;
+
+ private static final DeclarationAnnotationElementAdapter<Boolean> OPTIONAL_ADAPTER = buildOptionalAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter();
+
+ private Boolean optional;
+
+ private FetchType fetch;
+
+ protected BasicImpl(JavaPersistentAttributeResource parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.optionalAdapter = new ShortCircuitAnnotationElementAdapter<Boolean>(attribute, OPTIONAL_ADAPTER);
+ this.fetchAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, FETCH_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.optional = this.optional(astRoot);
+ this.fetch = this.fetch(astRoot);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ //*************** Basic implementation ****************
+ public Boolean getOptional() {
+ return this.optional;
+ }
+
+ public void setOptional(Boolean newOptional) {
+ Boolean oldOptional = this.optional;
+ this.optional = newOptional;
+ this.optionalAdapter.setValue(newOptional);
+ firePropertyChanged(OPTIONAL_PROPERTY, oldOptional, newOptional);
+ }
+
+ public FetchType getFetch() {
+ return this.fetch;
+ }
+
+ public void setFetch(FetchType newFetch) {
+ FetchType oldFetch = this.fetch;
+ this.fetch = newFetch;
+ this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(newFetch));
+ firePropertyChanged(FETCH_PROPERTY, oldFetch, newFetch);
+ }
+
+ public ITextRange fetchTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(FETCH_ADAPTER, astRoot);
+ }
+
+ public ITextRange optionalTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(OPTIONAL_ADAPTER, astRoot);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setOptional(this.optional(astRoot));
+ this.setFetch(this.fetch(astRoot));
+ }
+
+ protected FetchType fetch(CompilationUnit astRoot) {
+ return FetchType.fromJavaAnnotationValue(this.fetchAdapter.getValue(astRoot));
+ }
+
+ protected Boolean optional(CompilationUnit astRoot) {
+ return this.optionalAdapter.getValue(astRoot);
+ }
+
+ // ********** static methods **********
+ private static DeclarationAnnotationElementAdapter<Boolean> buildOptionalAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, JPA.BASIC__OPTIONAL, false, BooleanExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.BASIC__FETCH, false);
+ }
+
+ public static class BasicAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final BasicAnnotationDefinition INSTANCE = new BasicAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static BasicAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private BasicAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new BasicImpl((JavaPersistentAttributeResource) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return new NullBasic(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/CascadeType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/CascadeType.java
new file mode 100644
index 0000000000..ce100d7cc9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/CascadeType.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public enum CascadeType {
+
+ ALL(JPA.CASCADE_TYPE__ALL),
+ PERSIST(JPA.CASCADE_TYPE__PERSIST),
+ MERGE(JPA.CASCADE_TYPE__MERGE),
+ REMOVE(JPA.CASCADE_TYPE__REMOVE),
+ REFRESH(JPA.CASCADE_TYPE__REFRESH);
+
+ private String javaAnnotationValue;
+
+ CascadeType(String javaAnnotationValue) {
+ this.javaAnnotationValue = javaAnnotationValue;
+ }
+
+ public String getJavaAnnotationValue() {
+ return this.javaAnnotationValue;
+ }
+
+ public static CascadeType[] fromJavaAnnotationValue(String[] javaAnnotationValues) {
+ if (javaAnnotationValues == null) {
+ return new CascadeType[0];
+ }
+ CascadeType[] cascadeTypes = new CascadeType[javaAnnotationValues.length];
+ for (int i = 0; i < javaAnnotationValues.length; i++) {
+ String javaAnnotationValue = javaAnnotationValues[i];
+ if (javaAnnotationValue != null) {
+ cascadeTypes[i] = cascadeType(javaAnnotationValue);
+ }
+ }
+ return cascadeTypes;
+ }
+
+ private static CascadeType cascadeType(String javaAnnotationValue) {
+ if (javaAnnotationValue.equals(ALL.getJavaAnnotationValue())) {
+ return ALL;
+ }
+ else if (javaAnnotationValue.equals(PERSIST.getJavaAnnotationValue())) {
+ return PERSIST;
+ }
+ else if (javaAnnotationValue.equals(MERGE.getJavaAnnotationValue())) {
+ return MERGE;
+ }
+ else if (javaAnnotationValue.equals(REMOVE.getJavaAnnotationValue())) {
+ return REMOVE;
+ }
+ else if (javaAnnotationValue.equals(REFRESH.getJavaAnnotationValue())) {
+ return REFRESH;
+ }
+ throw new IllegalArgumentException("Unknown cascade type: " + javaAnnotationValue);
+ }
+
+ public static String[] toJavaAnnotationValue(CascadeType[] cascadeTypes) {
+ String[] javaAnnotationValues = new String[cascadeTypes.length];
+ for (int i = 0; i < cascadeTypes.length; i++) {
+ CascadeType cascadeType = cascadeTypes[i];
+ javaAnnotationValues[i] = cascadeType.javaAnnotationValue;
+ }
+ return javaAnnotationValues;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Column.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Column.java
new file mode 100644
index 0000000000..0885748875
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Column.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public interface Column extends AbstractColumn
+{
+ String ANNOTATION_NAME = JPA.COLUMN;
+
+ /**
+ * Corresponds to the length element of the javax.persistence.Column annotation.
+ * Returns null if the length valuePair does not exist in the annotation
+ */
+ Integer getLength();
+
+ /**
+ * Corresponds to the length element of the javax.persistence.Column annotation.
+ * Set to null to remove the length valuePair from the annotation
+ */
+ void setLength(Integer length);
+ String LENGTH_PROPERTY = "lengthProperty";
+
+ /**
+ * Corresponds to the precision element of the javax.persistence.Column annotation.
+ * Returns null if the precision valuePair does not exist in the annotation
+ */
+ Integer getPrecision();
+
+ /**
+ * Corresponds to the precision element of the javax.persistence.Column annotation.
+ * Set to null to remove the precision valuePair from the annotation
+ */
+ void setPrecision(Integer precision);
+ String PRECISION_PROPERTY = "precisionProperty";
+
+ /**
+ * Corresponds to the scale element of the javax.persistence.Column annotation.
+ * Returns null if the scale valuePair does not exist in the annotation
+ */
+ Integer getScale();
+
+ /**
+ * Corresponds to the scale element of the javax.persistence.Column annotation.
+ * Set to null to remove the scale valuePair from the annotation
+ */
+ void setScale(Integer scale);
+ String SCALE_PROPERTY = "scaleProperty";
+
+ /**
+ * Return the ITextRange for the length element. If length element
+ * does not exist return the ITextRange for the Column annotation.
+ */
+ ITextRange lengthTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the precision element. If precision element
+ * does not exist return the ITextRange for the Column annotation.
+ */
+ ITextRange precisionTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the scale element. If scale element
+ * does not exist return the ITextRange for the Column annotation.
+ */
+ ITextRange scaleTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ColumnImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ColumnImpl.java
new file mode 100644
index 0000000000..84c7ab8ee0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ColumnImpl.java
@@ -0,0 +1,226 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.NestedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class ColumnImpl extends AbstractColumnImpl implements Column, NestableAnnotation
+{
+ // this adapter is only used by a Column annotation associated with a mapping annotation (e.g. Basic)
+ public static final DeclarationAnnotationAdapter MAPPING_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ // hold this so we can get the 'length' text range
+ private final DeclarationAnnotationElementAdapter<Integer> lengthDeclarationAdapter;
+
+ // hold this so we can get the 'precision' text range
+ private final DeclarationAnnotationElementAdapter<Integer> precisionDeclarationAdapter;
+
+ // hold this so we can get the 'scale' text range
+ private final DeclarationAnnotationElementAdapter<Integer> scaleDeclarationAdapter;
+
+ private final AnnotationElementAdapter<Integer> lengthAdapter;
+
+ private final AnnotationElementAdapter<Integer> precisionAdapter;
+
+ private final AnnotationElementAdapter<Integer> scaleAdapter;
+
+ private Integer length;
+
+ private Integer precision;
+
+ private Integer scale;
+
+ protected ColumnImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa) {
+ super(parent, member, daa);
+ this.lengthDeclarationAdapter = this.buildIntegerElementAdapter(JPA.COLUMN__LENGTH);
+ this.lengthAdapter = this.buildShortCircuitIntegerElementAdapter(this.lengthDeclarationAdapter);
+ this.precisionDeclarationAdapter = this.buildIntegerElementAdapter(JPA.COLUMN__PRECISION);
+ this.precisionAdapter = this.buildShortCircuitIntegerElementAdapter(this.precisionDeclarationAdapter);
+ this.scaleDeclarationAdapter = this.buildIntegerElementAdapter(JPA.COLUMN__SCALE);
+ this.scaleAdapter = this.buildShortCircuitIntegerElementAdapter(this.scaleDeclarationAdapter);
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.length = this.length(astRoot);
+ this.precision = this.precision(astRoot);
+ this.scale = this.scale(astRoot);
+ }
+
+ @Override
+ protected String nameElementName() {
+ return JPA.COLUMN__NAME;
+ }
+
+ @Override
+ protected String columnDefinitionElementName() {
+ return JPA.COLUMN__COLUMN_DEFINITION;
+ }
+
+ @Override
+ protected String tableElementName() {
+ return JPA.COLUMN__TABLE;
+ }
+
+ @Override
+ protected String uniqueElementName() {
+ return JPA.COLUMN__UNIQUE;
+ }
+
+ @Override
+ protected String nullableElementName() {
+ return JPA.COLUMN__NULLABLE;
+ }
+
+ @Override
+ protected String insertableElementName() {
+ return JPA.COLUMN__INSERTABLE;
+ }
+
+ @Override
+ protected String updatableElementName() {
+ return JPA.COLUMN__UPDATABLE;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void moveAnnotation(int newIndex) {
+ //TODO move makes no sense for Column. maybe NestableAnnotation
+ //needs to be split up and we could have IndexableAnnotation
+ }
+
+ @Override
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ super.initializeFrom(oldAnnotation);
+ Column oldColumn = (Column) oldAnnotation;
+ setLength(oldColumn.getLength());
+ setPrecision(oldColumn.getPrecision());
+ setScale(oldColumn.getScale());
+ }
+
+ //************** Column implementation **************
+ public Integer getLength() {
+ return this.length;
+ }
+
+ public void setLength(Integer newLength) {
+ Integer oldLength = this.length;
+ this.length = newLength;
+ this.lengthAdapter.setValue(newLength);
+ firePropertyChanged(LENGTH_PROPERTY, oldLength, newLength);
+ }
+
+ public Integer getPrecision() {
+ return this.precision;
+ }
+
+ public void setPrecision(Integer newPrecision) {
+ Integer oldPrecision = this.precision;
+ this.precision = newPrecision;
+ this.precisionAdapter.setValue(newPrecision);
+ firePropertyChanged(PRECISION_PROPERTY, oldPrecision, newPrecision);
+ }
+
+ public Integer getScale() {
+ return this.scale;
+ }
+
+ public void setScale(Integer newScale) {
+ Integer oldScale = this.scale;
+ this.scale = newScale;
+ this.scaleAdapter.setValue(newScale);
+ firePropertyChanged(SCALE_PROPERTY, oldScale, newScale);
+ }
+
+ public ITextRange lengthTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.lengthDeclarationAdapter, astRoot);
+ }
+
+ public ITextRange precisionTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.precisionDeclarationAdapter, astRoot);
+ }
+
+ public ITextRange scaleTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.scaleDeclarationAdapter, astRoot);
+ }
+
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.setLength(this.length(astRoot));
+ this.setPrecision(this.precision(astRoot));
+ this.setScale(this.scale(astRoot));
+ }
+
+ protected Integer length(CompilationUnit astRoot) {
+ return this.lengthAdapter.getValue(astRoot);
+ }
+
+ protected Integer precision(CompilationUnit astRoot) {
+ return this.precisionAdapter.getValue(astRoot);
+ }
+
+ protected Integer scale(CompilationUnit astRoot) {
+ return this.scaleAdapter.getValue(astRoot);
+ }
+
+ // ********** static methods **********
+
+ static ColumnImpl createAttributeOverrideColumn(JavaResource parent, Member member, DeclarationAnnotationAdapter attributeOverrideAnnotationAdapter) {
+ return new ColumnImpl(parent, member, buildAttributeOverrideAnnotationAdapter(attributeOverrideAnnotationAdapter));
+ }
+
+ static DeclarationAnnotationAdapter buildAttributeOverrideAnnotationAdapter(DeclarationAnnotationAdapter attributeOverrideAnnotationAdapter) {
+ return new NestedDeclarationAnnotationAdapter(attributeOverrideAnnotationAdapter, JPA.ATTRIBUTE_OVERRIDE__COLUMN, JPA.COLUMN);
+ }
+
+ public static class ColumnAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final ColumnAnnotationDefinition INSTANCE = new ColumnAnnotationDefinition();
+
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private ColumnAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new ColumnImpl(parent, member, ColumnImpl.MAPPING_DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return new NullColumn(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ContainerAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ContainerAnnotation.java
new file mode 100644
index 0000000000..0a6aad284f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ContainerAnnotation.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ListIterator;
+
+public interface ContainerAnnotation<T extends NestableAnnotation> extends Annotation
+{
+ /**
+ * Return the fully qualified nestable annotation name.
+ */
+ String getNestableAnnotationName();
+
+ /**
+ * Return the element name of the nestable annotation when
+ * it is nested withing the container annotatio as a member value pai
+ */
+ String getElementName();
+
+ ListIterator<T> nestedAnnotations();
+
+ int nestedAnnotationsSize();
+
+ T nestedAnnotationAt(int index);
+
+ T nestedAnnotationFor(org.eclipse.jdt.core.dom.Annotation jdtAnnotation);
+
+ int indexOf(T nestedAnnotation);
+
+ T add(int index);
+
+ /**
+ * Add directly to the List without firing change notification.
+ */
+ T addInternal(int index);
+
+ void remove(T nestedAnnotation);
+
+ void remove(int index);
+
+ /**
+ * Move in the List without firing change notification.
+ */
+ void moveInternal(int targetIndex, int sourceIndex);
+
+ void move(int targetIndex, int sourceIndex);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ContainerAnnotationTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ContainerAnnotationTools.java
new file mode 100644
index 0000000000..3334876cc4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ContainerAnnotationTools.java
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.List;
+import org.eclipse.jdt.core.dom.ASTVisitor;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.MarkerAnnotation;
+import org.eclipse.jdt.core.dom.MemberValuePair;
+import org.eclipse.jdt.core.dom.NormalAnnotation;
+import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+
+public class ContainerAnnotationTools
+{
+
+ public static NestableAnnotation addNestedAnnotation(int index, ContainerAnnotation<? extends NestableAnnotation> containerAnnotation) {
+ int size = containerAnnotation.nestedAnnotationsSize();
+ NestableAnnotation nestedAnnotation = containerAnnotation.addInternal(size);
+ nestedAnnotation.newAnnotation();
+ containerAnnotation.moveInternal(index, size);
+ synchAnnotationsAfterMove(index, size, containerAnnotation);
+ return nestedAnnotation;
+ }
+
+ /**
+ * synchronize the source annotations with the model nestableAnnotations,
+ * starting at the end of the list to prevent overlap
+ */
+ public static void synchAnnotationsAfterAdd(int index, ContainerAnnotation<? extends NestableAnnotation> containerAnnotation) {
+ List<NestableAnnotation> nestableAnnotations = CollectionTools.list(containerAnnotation.nestedAnnotations());
+ for (int i = nestableAnnotations.size(); i-- > index;) {
+ synch(nestableAnnotations.get(i), i);
+ }
+ }
+
+ /**
+ * synchronize the source annotations with the model nestableAnnotations,
+ * starting at the specified index to prevent overlap
+ */
+ public static void synchAnnotationsAfterRemove(int index, ContainerAnnotation<? extends NestableAnnotation> pluralAnnotation) {
+ List<NestableAnnotation> nestableAnnotations = CollectionTools.list(pluralAnnotation.nestedAnnotations());
+ for (int i = index; i < nestableAnnotations.size(); i++) {
+ synch(nestableAnnotations.get(i), i);
+ }
+ }
+
+ private static void synch(NestableAnnotation nestableAnnotation, int index) {
+ nestableAnnotation.moveAnnotation(index);
+ }
+
+ /**
+ * synchronize the annotations with the model nestableAnnotations
+ */
+ public static void synchAnnotationsAfterMove(int targetIndex, int sourceIndex, ContainerAnnotation<? extends NestableAnnotation> containerAnnotation) {
+ NestableAnnotation nestableAnnotation = containerAnnotation.nestedAnnotationAt(targetIndex);
+
+ synch(nestableAnnotation, containerAnnotation.nestedAnnotationsSize());
+
+ List<NestableAnnotation> nestableAnnotations = CollectionTools.list(containerAnnotation.nestedAnnotations());
+ if (sourceIndex < targetIndex) {
+ for (int i = sourceIndex; i < targetIndex; i++) {
+ synch(nestableAnnotations.get(i), i);
+ }
+ }
+ else {
+ for (int i = sourceIndex; i > targetIndex; i-- ) {
+ synch(nestableAnnotations.get(i), i);
+ }
+ }
+ synch(nestableAnnotation, targetIndex);
+ }
+
+
+ public static void initializeNestedAnnotations(CompilationUnit astRoot, ContainerAnnotation<?> containerAnnotation) {
+ addAnnotationsFromSource(astRoot, containerAnnotation);
+ }
+
+ private static void addAnnotationsFromSource(CompilationUnit astRoot, ContainerAnnotation<? extends NestableAnnotation> containerAnnotation) {
+ containerAnnotation.jdtAnnotation(astRoot).accept(initialJavaMemberAnnotationAstVisitor(astRoot, containerAnnotation));
+ }
+
+ /**
+ * Only visit the member value pair with the given element name.
+ * If there is no element name (like in the case of value elements)
+ * then we will visit all annotations with the annotation name inside
+ * the given container annotation
+ */
+ private static ASTVisitor initialJavaMemberAnnotationAstVisitor(final CompilationUnit astRoot, final ContainerAnnotation<? extends NestableAnnotation> containerAnnotation) {
+ return new ASTVisitor() {
+ @Override
+ public boolean visit(MemberValuePair node) {
+ return node.getName().getFullyQualifiedName().equals(containerAnnotation.getElementName());
+ }
+ @Override
+ public boolean visit(SingleMemberAnnotation node) {
+ return visit((org.eclipse.jdt.core.dom.Annotation) node);
+ }
+
+ @Override
+ public boolean visit(NormalAnnotation node) {
+ return visit((org.eclipse.jdt.core.dom.Annotation) node);
+ }
+
+ @Override
+ public boolean visit(MarkerAnnotation node) {
+ return visit((org.eclipse.jdt.core.dom.Annotation) node);
+ }
+
+ private boolean visit(org.eclipse.jdt.core.dom.Annotation node) {
+ if (containerAnnotation.getAnnotationName().equals(JDTTools.resolveAnnotation(node))) {
+ return true;
+ }
+ if (containerAnnotation.getNestableAnnotationName().equals(JDTTools.resolveAnnotation(node))) {
+ Annotation nestedAnnotation = containerAnnotation.addInternal(containerAnnotation.nestedAnnotationsSize());
+ nestedAnnotation.initialize(astRoot);
+ }
+ return false;
+ }
+ };
+ }
+
+ public static void updateNestedAnnotationsFromJava(CompilationUnit astRoot, ContainerAnnotation<?> containerAnnotation) {
+ addOrUpdateAnnotationInSource(astRoot, containerAnnotation);
+ //TODO not sure how to handle generics here and get rid of this warning
+ removeAnnotationsNotInSource(astRoot, (ContainerAnnotation<NestableAnnotation>) containerAnnotation);
+ }
+
+ private static void addOrUpdateAnnotationInSource(CompilationUnit astRoot, ContainerAnnotation<? extends NestableAnnotation> containerAnnotation) {
+ containerAnnotation.jdtAnnotation(astRoot).accept(javaMemberAnnotationAstVisitor(astRoot, containerAnnotation));
+ }
+
+ private static void removeAnnotationsNotInSource(CompilationUnit astRoot, ContainerAnnotation<NestableAnnotation> containerAnnotation) {
+ for (NestableAnnotation annotation : CollectionTools.iterable(containerAnnotation.nestedAnnotations())) {
+ if (annotation.jdtAnnotation(astRoot) == null) {
+ containerAnnotation.remove(annotation);
+ }
+ }
+ }
+
+ /**
+ * Only visit the member value pair with the given element name.
+ * If there is no element name (like in the case of value elements)
+ * then we will visit all annotations with the annotation name inside
+ * the given container annotation
+ */
+ private static ASTVisitor javaMemberAnnotationAstVisitor(final CompilationUnit astRoot, final ContainerAnnotation<? extends NestableAnnotation> containerAnnotation) {
+ return new ASTVisitor() {
+ @Override
+ public boolean visit(MemberValuePair node) {
+ return node.getName().getFullyQualifiedName().equals(containerAnnotation.getElementName());
+ }
+
+ @Override
+ public boolean visit(SingleMemberAnnotation node) {
+ return visit((org.eclipse.jdt.core.dom.Annotation) node);
+ }
+
+ @Override
+ public boolean visit(NormalAnnotation node) {
+ return visit((org.eclipse.jdt.core.dom.Annotation) node);
+ }
+
+ @Override
+ public boolean visit(MarkerAnnotation node) {
+ return visit((org.eclipse.jdt.core.dom.Annotation) node);
+ }
+
+ private boolean visit(org.eclipse.jdt.core.dom.Annotation node) {
+ if (containerAnnotation.getAnnotationName().equals(JDTTools.resolveAnnotation(node))) {
+ return true;
+ }
+ if (containerAnnotation.getNestableAnnotationName().equals(JDTTools.resolveAnnotation(node))) {
+ NestableAnnotation nestedAnnotation = containerAnnotation.nestedAnnotationFor(node);
+ if (nestedAnnotation != null) {
+ nestedAnnotation.updateFromJava(astRoot);
+ }
+ else {
+ nestedAnnotation = containerAnnotation.add(containerAnnotation.nestedAnnotationsSize());
+ nestedAnnotation.initialize(astRoot);
+ }
+ }
+ return false;
+ }
+ };
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumn.java
new file mode 100644
index 0000000000..493a2472b0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumn.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+/**
+ * Corresponds to the javax.persistence.DiscriminatorColumn annotation
+ */
+public interface DiscriminatorColumn extends NamedColumn
+{
+ String ANNOTATION_NAME = JPA.DISCRIMINATOR_COLUMN;
+
+ /**
+ * Corresponds to the discriminatorType element of the javax.persistence.DiscriminatorColumn annotation.
+ * Returns null if the discriminatorType valuePair does not exist in the annotation
+ */
+ DiscriminatorType getDiscriminatorType();
+
+ /**
+ * Corresponds to the discriminatorType element of the javax.persistence.OrderBy annotation.
+ * Set the discriminatorType to null to remove the discriminatorType valuePair
+ */
+ void setDiscriminatorType(DiscriminatorType discriminatorType);
+ String DISCRIMINATOR_TYPE_PROPERTY = "discriminatorTypeProperty";
+
+ /**
+ * Corresponds to the length element of the javax.persistence.DiscriminatorColumn annotation.
+ * Returns null if the length valuePair does not exist in the annotation
+ */
+ Integer getLength();
+
+ /**
+ * Corresponds to the length element of the javax.persistence.OrderBy annotation.
+ * Set the length to null to remove the length valuePair
+ */
+ void setLength(Integer length);
+ String LENGTH_PROPERTY = "lengthProperty";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumnImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumnImpl.java
new file mode 100644
index 0000000000..04a0749f5e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumnImpl.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class DiscriminatorColumnImpl extends AbstractNamedColumn implements DiscriminatorColumn
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> DISCRIMINATOR_TYPE_ADAPTER = buildDiscriminatorTypeAdapter();
+
+ // hold this so we can get the 'length' text range
+ private final DeclarationAnnotationElementAdapter<Integer> lengthDeclarationAdapter;
+
+ private final AnnotationElementAdapter<String> discriminatorTypeAdapter;
+
+ private final AnnotationElementAdapter<Integer> lengthAdapter;
+
+ private DiscriminatorType discriminatorType;
+
+ private Integer length;
+
+ protected DiscriminatorColumnImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa) {
+ super(parent, member, daa, new MemberAnnotationAdapter(member, daa));
+ this.discriminatorTypeAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, DISCRIMINATOR_TYPE_ADAPTER);
+ this.lengthDeclarationAdapter = this.buildIntegerElementAdapter(JPA.DISCRIMINATOR_COLUMN__LENGTH);
+ this.lengthAdapter = this.buildShortCircuitIntegerElementAdapter(this.lengthDeclarationAdapter);
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.discriminatorType = this.discriminatorType(astRoot);
+ this.length = this.length(astRoot);
+ }
+
+ @Override
+ protected String nameElementName() {
+ return JPA.DISCRIMINATOR_COLUMN__NAME;
+ }
+
+ @Override
+ protected String columnDefinitionElementName() {
+ return JPA.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void moveAnnotation(int newIndex) {
+ //TODO move makes no sense for DiscriminatorColumn. maybe NestableAnnotation
+ //needs to be split up and we could have IndexableAnnotation
+ }
+
+ @Override
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ super.initializeFrom(oldAnnotation);
+ DiscriminatorColumn oldColumn = (DiscriminatorColumn) oldAnnotation;
+ setLength(oldColumn.getLength());
+ setDiscriminatorType(oldColumn.getDiscriminatorType());
+ }
+
+ public DiscriminatorType getDiscriminatorType() {
+ return this.discriminatorType;
+ }
+
+ public void setDiscriminatorType(DiscriminatorType newDiscriminatorType) {
+ DiscriminatorType oldDiscriminatorType = this.discriminatorType;
+ this.discriminatorType = newDiscriminatorType;
+ this.discriminatorTypeAdapter.setValue(DiscriminatorType.toJavaAnnotationValue(newDiscriminatorType));
+ firePropertyChanged(DISCRIMINATOR_TYPE_PROPERTY, oldDiscriminatorType, newDiscriminatorType);
+ }
+
+ public Integer getLength() {
+ return this.length;
+ }
+
+ public void setLength(Integer newLength) {
+ Integer oldLength = this.length;
+ this.length = newLength;
+ this.lengthAdapter.setValue(newLength);
+ firePropertyChanged(LENGTH_PROPERTY, oldLength, newLength);
+ }
+
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.setLength(this.length(astRoot));
+ this.setDiscriminatorType(this.discriminatorType(astRoot));
+ }
+
+ protected Integer length(CompilationUnit astRoot) {
+ return this.lengthAdapter.getValue(astRoot);
+ }
+
+ protected DiscriminatorType discriminatorType(CompilationUnit astRoot) {
+ return DiscriminatorType.fromJavaAnnotationValue(this.discriminatorTypeAdapter.getValue(astRoot));
+ }
+
+ // ********** static methods **********
+ private static DeclarationAnnotationElementAdapter<String> buildDiscriminatorTypeAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE);
+ }
+
+ public static class DiscriminatorColumnAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final DiscriminatorColumnAnnotationDefinition INSTANCE = new DiscriminatorColumnAnnotationDefinition();
+
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private DiscriminatorColumnAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new DiscriminatorColumnImpl(parent, member, DiscriminatorColumnImpl.DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return new NullDiscriminatorColumn(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorType.java
new file mode 100644
index 0000000000..a59d492490
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorType.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public enum DiscriminatorType {
+
+ STRING,
+ CHAR,
+ INTEGER;
+
+
+ public static DiscriminatorType fromJavaAnnotationValue(Object javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ return null;
+ }
+ if (javaAnnotationValue.equals(JPA.DISCRIMINATOR_TYPE__STRING)) {
+ return STRING;
+ }
+ if (javaAnnotationValue.equals(JPA.DISCRIMINATOR_TYPE__CHAR)) {
+ return CHAR;
+ }
+ if (javaAnnotationValue.equals(JPA.DISCRIMINATOR_TYPE__INTEGER)) {
+ return INTEGER;
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(DiscriminatorType discriminatorType) {
+ if (discriminatorType == null) {
+ return null;
+ }
+ switch (discriminatorType) {
+ case STRING :
+ return JPA.DISCRIMINATOR_TYPE__STRING;
+ case CHAR :
+ return JPA.DISCRIMINATOR_TYPE__CHAR;
+ case INTEGER :
+ return JPA.DISCRIMINATOR_TYPE__INTEGER;
+ default :
+ throw new IllegalArgumentException("unknown discriminator type: " + discriminatorType);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValue.java
new file mode 100644
index 0000000000..2e82140dfe
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValue.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+/**
+ * Corresponds to the javax.persistence.OrderBy annotation
+ */
+public interface DiscriminatorValue extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.DISCRIMINATOR_VALUE;
+
+ /**
+ * Corresponds to the value element of the javax.persistence.OrderBy annotation.
+ * Returns null if the value valuePair does not exist in the annotation
+ */
+ String getValue();
+
+ /**
+ * Corresponds to the value element of the javax.persistence.OrderBy annotation.
+ * Setting the value to null will not remove the OrderBy annotation
+ */
+ void setValue(String value);
+ String VALUE_PROPERTY = "valueProperty";
+
+ /**
+ * Return the ITextRange for the value element. If value element
+ * does not exist return the ITextRange for the DisriminatorValue annotation.
+ */
+ ITextRange valueTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValueImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValueImpl.java
new file mode 100644
index 0000000000..c8a839e25b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValueImpl.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Type;
+
+public class DiscriminatorValueImpl extends AbstractAnnotationResource<Type> implements DiscriminatorValue
+{
+ 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;
+
+ protected DiscriminatorValueImpl(JavaResource parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, VALUE_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.value(astRoot);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String newValue) {
+ String oldValue = this.value;
+ this.value = newValue;
+ this.valueAdapter.setValue(newValue);
+ firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
+ }
+
+ public ITextRange valueTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setValue(this.value(astRoot));
+ }
+
+ protected String value(CompilationUnit astRoot) {
+ return this.valueAdapter.getValue(astRoot);
+ }
+
+ // ********** static methods **********
+ private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.DISCRIMINATOR_VALUE__VALUE);
+ }
+
+
+ public static class DiscriminatorValueAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final DiscriminatorValueAnnotationDefinition INSTANCE = new DiscriminatorValueAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private DiscriminatorValueAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new DiscriminatorValueImpl(parent, (Type) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return new NullDiscriminatorValue(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Embeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Embeddable.java
new file mode 100644
index 0000000000..b78326bda5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Embeddable.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+/**
+ * Corresponds to the javax.persistence.Embeddable annotation
+ */
+public interface Embeddable extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.EMBEDDABLE;
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddableImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddableImpl.java
new file mode 100644
index 0000000000..80486e0f97
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddableImpl.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Type;
+
+
+public class EmbeddableImpl extends AbstractAnnotationResource<Type> implements Embeddable
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ protected EmbeddableImpl(JavaPersistentTypeResource parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //nothing to initialize
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ //no annotation members
+ }
+
+
+ public static class EmbeddableAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final EmbeddableAnnotationDefinition INSTANCE = new EmbeddableAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static EmbeddableAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private EmbeddableAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new EmbeddableImpl((JavaPersistentTypeResource) parent, (Type) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Embedded.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Embedded.java
new file mode 100644
index 0000000000..d2dd8fd9a6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Embedded.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public interface Embedded extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.EMBEDDED;
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedId.java
new file mode 100644
index 0000000000..b97543553c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedId.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public interface EmbeddedId extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.EMBEDDED_ID;
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedIdImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedIdImpl.java
new file mode 100644
index 0000000000..0abe61baaa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedIdImpl.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class EmbeddedIdImpl extends AbstractAnnotationResource<Attribute> implements EmbeddedId
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ protected EmbeddedIdImpl(JavaPersistentAttributeResource parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //nothing to initialize
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ //no annotation members
+ }
+
+
+ public static class EmbeddedIdAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final EmbeddedIdAnnotationDefinition INSTANCE = new EmbeddedIdAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static EmbeddedIdAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private EmbeddedIdAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new EmbeddedIdImpl((JavaPersistentAttributeResource) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ //TODO put this in the java context model when JavaOneToOneMapping exists
+// public Iterator<String> correspondingAnnotationNames() {
+// return new ArrayIterator<String>(
+// JPA.ATTRIBUTE_OVERRIDE,
+// JPA.ATTRIBUTE_OVERRIDES);
+// }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedImpl.java
new file mode 100644
index 0000000000..0fdea565fc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedImpl.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+
+public class EmbeddedImpl extends AbstractAnnotationResource<Attribute> implements Embedded
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ protected EmbeddedImpl(JavaPersistentAttributeResource parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //nothing to initialize
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ //no annotation members
+ }
+
+ public static class EmbeddedAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final EmbeddedAnnotationDefinition INSTANCE = new EmbeddedAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static EmbeddedAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private EmbeddedAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new EmbeddedImpl((JavaPersistentAttributeResource) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Entity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Entity.java
new file mode 100644
index 0000000000..3d2420014f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Entity.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+/**
+ * Corresponds to the javax.persistence.Entity annotation
+ */
+public interface Entity extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.ENTITY;
+
+ /**
+ * Corresponds to the name element of the Entity annotation.
+ * Returns null if the name element does not exist in java.
+ */
+ String getName();
+
+ /**
+ * Corresponds to the name element of the Entity annotation.
+ * Set to null to remove the name element.
+ */
+ void setName(String name);
+
+ String NAME_PROPERTY = "nameProperty";
+
+ /**
+ * Return the ITextRange for the name element. If the name element
+ * does not exist return the ITextRange for the Entity annotation.
+ */
+ ITextRange nameTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EntityImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EntityImpl.java
new file mode 100644
index 0000000000..5fc5125d2c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EntityImpl.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Type;
+
+
+public class EntityImpl extends AbstractAnnotationResource<Type> implements Entity
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final AnnotationElementAdapter<String> nameAdapter;
+
+ private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildNameAdapter();
+
+ private String name;
+
+ protected EntityImpl(JavaPersistentTypeResource parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(getMember(), NAME_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.name(astRoot);
+ }
+
+ //*********** Annotation implementation ****************
+ public String getAnnotationName() {
+ return Entity.ANNOTATION_NAME;
+ }
+
+ //*********** Entity implementation ****************
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.nameAdapter.setValue(newName);
+ firePropertyChanged(Entity.NAME_PROPERTY, oldName, newName);
+ }
+
+ public ITextRange nameTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(NAME_ADAPTER, astRoot);
+ }
+
+ //*********** JavaResource implementation ****************
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setName(this.name(astRoot));
+ }
+
+ protected String name(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ //*********** static methods ****************
+ private static DeclarationAnnotationElementAdapter<String> buildNameAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.ENTITY__NAME, false); // false = do not remove annotation when empty
+ }
+
+
+ public static class EntityAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final EntityAnnotationDefinition INSTANCE = new EntityAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static EntityAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private EntityAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new EntityImpl((JavaPersistentTypeResource) parent, (Type) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+
+ public String getAnnotationName() {
+ return Entity.ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumType.java
new file mode 100644
index 0000000000..6670795056
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumType.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public enum EnumType {
+
+ ORDINAL,
+ STRING;
+
+
+ public static EnumType fromJavaAnnotationValue(Object javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ return null;
+ }
+ if (javaAnnotationValue.equals(JPA.ENUM_TYPE__ORDINAL)) {
+ return ORDINAL;
+ }
+ if (javaAnnotationValue.equals(JPA.ENUM_TYPE__STRING)) {
+ return STRING;
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(EnumType enumType) {
+ if (enumType == null) {
+ return null;
+ }
+ switch (enumType) {
+ case ORDINAL :
+ return JPA.ENUM_TYPE__ORDINAL;
+ case STRING :
+ return JPA.ENUM_TYPE__STRING;
+ default :
+ throw new IllegalArgumentException("unknown enum type: " + enumType);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Enumerated.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Enumerated.java
new file mode 100644
index 0000000000..010c7bd3c2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Enumerated.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+/**
+ * Corresponds to the javax.persistence.Enumerated annotation
+ */
+public interface Enumerated extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.ENUMERATED;
+
+ /**
+ * Corresponds to the value element of the Enumerated annotation.
+ * Returns null if the value element does not exist in java.
+ */
+ EnumType getValue();
+
+ /**
+ * Corresponds to the value element of the Enumerated annotation.
+ * Set to null to remove the value element.
+ */
+ void setValue(EnumType value);
+ String VALUE_PROPERTY = "valueProperty";
+
+ /**
+ * Return the ITextRange for the value element. If the value element
+ * does not exist return the ITextRange for the Enumerated annotation.
+ */
+ ITextRange valueTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedImpl.java
new file mode 100644
index 0000000000..42b7787050
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedImpl.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class EnumeratedImpl extends AbstractAnnotationResource<Attribute> implements Enumerated
+{
+
+ 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 EnumType value;
+
+ protected EnumeratedImpl(JavaResource parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.value(astRoot);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public EnumType getValue() {
+ return this.value;
+ }
+
+ public void setValue(EnumType newValue) {
+ EnumType oldValue = this.value;
+ this.value = newValue;
+ this.valueAdapter.setValue(EnumType.toJavaAnnotationValue(newValue));
+ firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
+ }
+
+ public ITextRange valueTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setValue(this.value(astRoot));
+ }
+
+ protected EnumType value(CompilationUnit astRoot) {
+ return EnumType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot));
+ }
+
+ // ********** static methods **********
+ private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ENUMERATED__VALUE);
+ }
+
+ public static class EnumeratedAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final EnumeratedAnnotationDefinition INSTANCE = new EnumeratedAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private EnumeratedAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new EnumeratedImpl(parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return new NullEnumerated(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/FetchType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/FetchType.java
new file mode 100644
index 0000000000..4768e64a88
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/FetchType.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public enum FetchType {
+
+ EAGER,
+ LAZY;
+
+
+ public static FetchType fromJavaAnnotationValue(Object javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ return null;
+ }
+ if (javaAnnotationValue.equals(JPA.FETCH_TYPE__EAGER)) {
+ return EAGER;
+ }
+ if (javaAnnotationValue.equals(JPA.FETCH_TYPE__LAZY)) {
+ return LAZY;
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(FetchType fetchType) {
+ if (fetchType == null) {
+ return null;
+ }
+ switch (fetchType) {
+ case EAGER :
+ return JPA.FETCH_TYPE__EAGER;
+ case LAZY :
+ return JPA.FETCH_TYPE__LAZY;
+ default :
+ throw new IllegalArgumentException("unknown fetch type: " + fetchType);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValue.java
new file mode 100644
index 0000000000..57e0cb2752
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValue.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+/**
+ * Corresponds to the javax.persistence.GeneratedValue annotation
+ */
+public interface GeneratedValue extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.GENERATED_VALUE;
+
+ /**
+ * Corresponds to the strategy element of the GeneratedValue annotation.
+ * Returns null if the strategy element does not exist in java.
+ */
+ GenerationType getStrategy();
+
+ /**
+ * Corresponds to the strategy element of the GeneratedValue annotation.
+ * Set to null to remove the strategy element.
+ */
+ void setStrategy(GenerationType strategy);
+ String STRATEGY_PROPERTY = "strategyProperty";
+
+ /**
+ * Corresponds to the generator element of the GeneratedValue annotation.
+ * Returns null if the generator element does not exist in java.
+ */
+ String getGenerator();
+
+ /**
+ * Corresponds to the generator element of the GeneratedValue annotation.
+ * Set to null to remove the generator element.
+ */
+ void setGenerator(String generator);
+ String GENERATOR_PROPERTY = "generatorProperty";
+
+
+ /**
+ * Return the ITextRange for the generator element. If the generator element
+ * does not exist return the ITextRange for the Enumerated annotation.
+ */
+ ITextRange generatorTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the strategy element. If the strategy element
+ * does not exist return the ITextRange for the Enumerated annotation.
+ */
+ ITextRange strategyTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValueImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValueImpl.java
new file mode 100644
index 0000000000..294a9671ed
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValueImpl.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class GeneratedValueImpl extends AbstractAnnotationResource<Member> implements GeneratedValue
+{
+ private final AnnotationElementAdapter<String> strategyAdapter;
+
+ private final AnnotationElementAdapter<String> generatorAdapter;
+
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> STRATEGY_ADAPTER = buildStrategyAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String> GENERATOR_ADAPTER = buildGeneratorAdapter();
+
+ private GenerationType strategy;
+
+ private String generator;
+
+
+ protected GeneratedValueImpl(JavaResource parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ this.strategyAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, STRATEGY_ADAPTER);
+ this.generatorAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, GENERATOR_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.strategy = this.strategy(astRoot);
+ this.generator = this.generator(astRoot);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public GenerationType getStrategy() {
+ return this.strategy;
+ }
+
+ public void setStrategy(GenerationType newStrategy) {
+ GenerationType oldStrategy = this.strategy;
+ this.strategy = newStrategy;
+ this.strategyAdapter.setValue(GenerationType.toJavaAnnotationValue(newStrategy));
+ firePropertyChanged(STRATEGY_PROPERTY, oldStrategy, newStrategy);
+ }
+
+ public String getGenerator() {
+ return this.generator;
+ }
+
+ public void setGenerator(String newGenerator) {
+ String oldGenerator = this.generator;
+ this.generator = newGenerator;
+ this.generatorAdapter.setValue(newGenerator);
+ firePropertyChanged(GENERATOR_PROPERTY, oldGenerator, newGenerator);
+ }
+
+ public ITextRange strategyTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(STRATEGY_ADAPTER, astRoot);
+ }
+
+ public ITextRange generatorTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(GENERATOR_ADAPTER, astRoot);
+ }
+
+ // ********** java annotations -> persistence model **********
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setStrategy(this.strategy(astRoot));
+ this.setGenerator(this.generator(astRoot));
+ }
+
+ protected GenerationType strategy(CompilationUnit astRoot) {
+ return GenerationType.fromJavaAnnotationValue(this.strategyAdapter.getValue(astRoot));
+ }
+
+ protected String generator(CompilationUnit astRoot) {
+ return this.generatorAdapter.getValue(astRoot);
+ }
+
+ // ********** static methods **********
+ private static DeclarationAnnotationElementAdapter<String> buildStrategyAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.GENERATED_VALUE__STRATEGY, false);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildGeneratorAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.GENERATED_VALUE__GENERATOR, false);
+ }
+
+ public static class GeneratedValueAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final GeneratedValueAnnotationDefinition INSTANCE = new GeneratedValueAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private GeneratedValueAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new GeneratedValueImpl(parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GenerationType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GenerationType.java
new file mode 100644
index 0000000000..6e5d7b7244
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GenerationType.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public enum GenerationType {
+
+ TABLE,
+ SEQUENCE,
+ IDENTITY,
+ AUTO;
+
+
+ public static GenerationType fromJavaAnnotationValue(Object javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ return null;
+ }
+ if (javaAnnotationValue.equals(JPA.GENERATION_TYPE__TABLE)) {
+ return TABLE;
+ }
+ if (javaAnnotationValue.equals(JPA.GENERATION_TYPE__SEQUENCE)) {
+ return SEQUENCE;
+ }
+ if (javaAnnotationValue.equals(JPA.GENERATION_TYPE__IDENTITY)) {
+ return IDENTITY;
+ }
+ if (javaAnnotationValue.equals(JPA.GENERATION_TYPE__AUTO)) {
+ return AUTO;
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(GenerationType generationType) {
+ if (generationType == null) {
+ return null;
+ }
+ switch (generationType) {
+ case TABLE :
+ return JPA.GENERATION_TYPE__TABLE;
+ case SEQUENCE :
+ return JPA.GENERATION_TYPE__SEQUENCE;
+ case IDENTITY :
+ return JPA.GENERATION_TYPE__IDENTITY;
+ case AUTO :
+ return JPA.GENERATION_TYPE__AUTO;
+ default :
+ throw new IllegalArgumentException("unknown generation type: " + generationType);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Generator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Generator.java
new file mode 100644
index 0000000000..1da98e781d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Generator.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public interface Generator extends JavaResource
+{
+ /**
+ * Corresponds to the name element of the TableGenerator or SequenceGenerator annotation.
+ * Returns null if the name element does not exist in java. If no other memberValuePairs exist
+ * the *Generator annotation will be removed as well.
+ */
+ String getName();
+
+ /**
+ * Corresponds to the name element of the TableGenerator or SequenceGenerator annotation.
+ * Set to null to remove the name element. If no other memberValuePairs exist
+ * the *Generator annotation will be removed as well.
+ */
+ void setName(String name);
+ String NAME_PROPERTY = "nameProperty";
+
+ /**
+ * Corresponds to the initialValue element of the TableGenerator or SequenceGenerator annotation.
+ * Returns null if the initialValue element does not exist in java. If no other memberValuePairs exist
+ * the *Generator annotation will be removed as well.
+ */
+ Integer getInitialValue();
+
+ /**
+ * Corresponds to the initialValue element of the TableGenerator or SequenceGenerator annotation.
+ * Set to null to remove the initialValue element. If no other memberValuePairs exist
+ * the *Generator annotation will be removed as well.
+ */
+ void setInitialValue(Integer initialValue);
+ String INITIAL_VALUE_PROPERTY = "initialValueProperty";
+
+ /**
+ * Corresponds to the allocationSize element of the TableGenerator or SequenceGenerator annotation.
+ * Returns null if the allocationSize element does not exist in java. If no other memberValuePairs exist
+ * the *Generator annotation will be removed as well.
+ */
+ Integer getAllocationSize();
+
+ /**
+ * Corresponds to the allocationSize element of the TableGenerator or SequenceGenerator annotation.
+ * Set to null to remove the allocationSize element. If no other memberValuePairs exist
+ * the *Generator annotation will be removed as well.
+ */
+ void setAllocationSize(Integer allocationSize);
+ String ALLOCATION_SIZE_PROPERTY = "allocationSizeProperty";
+
+ /**
+ * Return the ITextRange for the name element. If the name element
+ * does not exist return the ITextRange for the *Generator annotation.
+ */
+ ITextRange nameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the initialValue element. If the initialValue element
+ * does not exist return the ITextRange for the *Generator annotation.
+ */
+ ITextRange initialValueTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the allocationSize element. If the allocationSize element
+ * does not exist return the ITextRange for the *Generator annotation.
+ */
+ ITextRange allocationSizeTextRange(CompilationUnit astRoot);
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratorImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratorImpl.java
new file mode 100644
index 0000000000..e8221904ef
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratorImpl.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.NumberIntegerExpressionConverter;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+
+public abstract class GeneratorImpl extends AbstractAnnotationResource<Member> implements Generator
+{
+ // hold this so we can get the 'name' text range
+ private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
+
+ // hold this so we can get the 'initialValue' text range
+ private final DeclarationAnnotationElementAdapter<Integer> initialValueDeclarationAdapter;
+
+ // hold this so we can get the 'allocationSize' text range
+ private final DeclarationAnnotationElementAdapter<Integer> allocationSizeDeclarationAdapter;
+
+ private final AnnotationElementAdapter<String> nameAdapter;
+
+ private final AnnotationElementAdapter<Integer> initialValueAdapter;
+
+ private final AnnotationElementAdapter<Integer> allocationSizeAdapter;
+
+ private String name;
+
+ private Integer initialValue;
+
+ private Integer allocationSize;
+
+ public GeneratorImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa) {
+ super(parent, member, daa);
+ this.nameDeclarationAdapter = this.nameAdapter();
+ this.nameAdapter = this.buildAdapter(this.nameDeclarationAdapter);
+ this.initialValueDeclarationAdapter = this.initialValueAdapter();
+ this.initialValueAdapter = this.buildIntegerAdapter(this.initialValueDeclarationAdapter);
+ this.allocationSizeDeclarationAdapter = this.allocationSizeAdapter();
+ this.allocationSizeAdapter = this.buildIntegerAdapter(this.allocationSizeDeclarationAdapter);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.name(astRoot);
+ this.initialValue = this.initialValue(astRoot);
+ this.allocationSize = this.allocationSize(astRoot);
+ }
+
+ // ********** initialization **********
+ protected AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ return new ShortCircuitAnnotationElementAdapter<String>(getMember(), daea);
+ }
+
+ protected AnnotationElementAdapter<Integer> buildIntegerAdapter(DeclarationAnnotationElementAdapter<Integer> daea) {
+ return new ShortCircuitAnnotationElementAdapter<Integer>(getMember(), daea);
+ }
+
+ protected abstract DeclarationAnnotationAdapter annotationAdapter();
+
+ protected abstract DeclarationAnnotationElementAdapter<String> nameAdapter();
+
+ protected abstract DeclarationAnnotationElementAdapter<Integer> initialValueAdapter();
+
+ protected abstract DeclarationAnnotationElementAdapter<Integer> allocationSizeAdapter();
+
+
+
+ public Integer getAllocationSize() {
+ return this.allocationSize;
+ }
+
+ public void setAllocationSize(Integer newAllocationSize) {
+ Integer oldAllocationSize = this.allocationSize;
+ this.allocationSize = newAllocationSize;
+ this.allocationSizeAdapter.setValue(newAllocationSize);
+ firePropertyChanged(ALLOCATION_SIZE_PROPERTY, oldAllocationSize, newAllocationSize);
+ }
+
+ public Integer getInitialValue() {
+ return this.initialValue;
+ }
+
+ public void setInitialValue(Integer newInitialValue) {
+ Integer oldInitialValue = this.initialValue;
+ this.initialValue = newInitialValue;
+ this.initialValueAdapter.setValue(newInitialValue);
+ firePropertyChanged(INITIAL_VALUE_PROPERTY, oldInitialValue, newInitialValue);
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.nameAdapter.setValue(newName);
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public ITextRange nameTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.nameDeclarationAdapter, astRoot);
+ }
+
+ public ITextRange initialValueTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.initialValueDeclarationAdapter, astRoot);
+ }
+
+ public ITextRange allocationSizeTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.allocationSizeDeclarationAdapter, astRoot);
+ }
+
+ // ********** java annotations -> persistence model **********
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setName(this.name(astRoot));
+ this.setAllocationSize(this.allocationSize(astRoot));
+ this.setInitialValue(this.initialValue(astRoot));
+ }
+
+ protected String name(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ protected Integer allocationSize(CompilationUnit astRoot) {
+ return this.allocationSizeAdapter.getValue(astRoot);
+ }
+
+ protected Integer initialValue(CompilationUnit astRoot) {
+ return this.initialValueAdapter.getValue(astRoot);
+ }
+
+ // ********** static methods **********
+ protected static DeclarationAnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(annotationAdapter, elementName);
+ }
+
+ protected static DeclarationAnnotationElementAdapter<Integer> buildIntegerAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return new ConversionDeclarationAnnotationElementAdapter<Integer>(annotationAdapter, elementName, NumberIntegerExpressionConverter.instance());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Id.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Id.java
new file mode 100644
index 0000000000..af2fe66442
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Id.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public interface Id extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.ID;
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClass.java
new file mode 100644
index 0000000000..58b4eeafda
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClass.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+/**
+ * This interface corresponds to the javax.persistence.IdClass annotation
+ */
+public interface IdClass extends JavaResource
+{
+ final String ANNOTATION_NAME = JPA.ID_CLASS;
+
+ /**
+ * Corresponds to the value element of the IdClass annotation.
+ * Returns null if the value element does not exist in java.
+ * Returns the portion of the value preceding the .class.
+ * <p>
+ * &#64;IdClass(value=Employee.class)
+ * </p>
+ * will return "Employee"
+ **/
+ String getValue();
+
+ /**
+ * Corresponds to the value element of the IdClass annotation.
+ * Set to null to remove the value element. This will also remove the IdClass
+ * annotation itself.
+ */
+ void setValue(String value);
+ String VALUE_PROPERTY = "valueProperty";
+
+ /**
+ * Returns the qualified value name as it is resolved in the AST
+ * <p>
+ * &#64;IdClass(Employee.class)
+ * </p>
+ * will return "model.Employee" if there is an import for model.Employee
+ * @return
+ */
+ String getFullyQualifiedClass();
+ String FULLY_QUALIFIED_CLASS_PROPERTY = "fullyQualifiedClassProperty";
+
+ /**
+ * Return the ITextRange for the value element. If the value element
+ * does not exist return the ITextRange for the IdClass annotation.
+ */
+ ITextRange valueTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClassImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClassImpl.java
new file mode 100644
index 0000000000..e765c2d317
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClassImpl.java
@@ -0,0 +1,121 @@
+package org.eclipse.jpt.core.internal.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.core.internal.jdtutility.Type;
+
+public class IdClassImpl extends AbstractAnnotationResource<Type> implements IdClass
+{
+ private final AnnotationElementAdapter<String> valueAdapter;
+
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter();
+
+ private String value;
+
+ private String fullyQualifiedValue;
+
+ public IdClassImpl(JavaResource parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, VALUE_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.value(astRoot);
+ this.fullyQualifiedValue = fullyQualifiedClass(astRoot);
+ }
+
+ public String getAnnotationName() {
+ return IdClass.ANNOTATION_NAME;
+ }
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String newValue) {
+ String oldValue = this.value;
+ this.value = newValue;
+ this.valueAdapter.setValue(newValue);
+ firePropertyChanged(IdClass.VALUE_PROPERTY, oldValue, newValue);
+ }
+
+ public String getFullyQualifiedClass() {
+ return this.fullyQualifiedValue;
+ }
+
+ private void setFullyQualifiedClass(String newQualifiedClass) {
+ String oldQualifiedClass = this.fullyQualifiedValue;
+ this.fullyQualifiedValue = newQualifiedClass;
+ firePropertyChanged(IdClass.FULLY_QUALIFIED_CLASS_PROPERTY, oldQualifiedClass, newQualifiedClass);
+ }
+
+ public ITextRange valueTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setValue(this.value(astRoot));
+ this.setFullyQualifiedClass(this.fullyQualifiedClass(astRoot));
+ }
+
+ protected String value(CompilationUnit astRoot) {
+ return this.valueAdapter.getValue(astRoot);
+ }
+
+ private String fullyQualifiedClass(CompilationUnit astRoot) {
+ if (getValue() == null) {
+ return null;
+ }
+ return JDTTools.resolveFullyQualifiedName(this.valueAdapter.expression(astRoot));
+ }
+
+ // ********** static methods **********
+ protected static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, JPA.ID_CLASS__VALUE, SimpleTypeStringExpressionConverter.instance());
+ }
+
+
+ public static class IdClassAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final IdClassAnnotationDefinition INSTANCE = new IdClassAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private IdClassAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new IdClassImpl(parent, (Type) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdImpl.java
new file mode 100644
index 0000000000..574bd32822
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdImpl.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+
+public class IdImpl extends AbstractAnnotationResource<Attribute> implements Id
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ protected IdImpl(JavaPersistentAttributeResource parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //nothing to initialize
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ //no annotation members
+ }
+
+ public static class IdAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final IdAnnotationDefinition INSTANCE = new IdAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static IdAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private IdAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new IdImpl((JavaPersistentAttributeResource) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Inheritance.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Inheritance.java
new file mode 100644
index 0000000000..cc04587a4c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Inheritance.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+/**
+ * Corresponds to the javax.persistence.Inheritance annotation
+ */
+public interface Inheritance extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.INHERITANCE;
+
+ InheritanceType getStrategy();
+
+ void setStrategy(InheritanceType strategy);
+ String STRATEGY_PROPERTY = "strategyProperty";
+
+ /**
+ * Return the ITextRange for the strategy element. If the strategy element
+ * does not exist return the ITextRange for the Inheritance annotation.
+ */
+ ITextRange strategyTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceImpl.java
new file mode 100644
index 0000000000..61bfffc857
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceImpl.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Type;
+
+public class InheritanceImpl extends AbstractAnnotationResource<Type> implements Inheritance
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+ private static final DeclarationAnnotationElementAdapter<String> STRATEGY_ADAPTER = buildStrategyAdapter();
+
+ private final AnnotationElementAdapter<String> strategyAdapter;
+
+ private InheritanceType strategy;
+
+ protected InheritanceImpl(JavaResource parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.strategyAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, STRATEGY_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.strategy = this.strategy(astRoot);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public InheritanceType getStrategy() {
+ return this.strategy;
+ }
+
+ public void setStrategy(InheritanceType newStrategy) {
+ InheritanceType oldStrategy = this.strategy;
+ this.strategy = newStrategy;
+ this.strategyAdapter.setValue(InheritanceType.toJavaAnnotationValue(newStrategy));
+ firePropertyChanged(STRATEGY_PROPERTY, oldStrategy, newStrategy);
+ }
+
+ public ITextRange strategyTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(STRATEGY_ADAPTER, astRoot);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setStrategy(this.strategy(astRoot));
+ }
+
+ protected InheritanceType strategy(CompilationUnit astRoot) {
+ return InheritanceType.fromJavaAnnotationValue(this.strategyAdapter.getValue(astRoot));
+ }
+
+ // ********** static methods **********
+ private static DeclarationAnnotationElementAdapter<String> buildStrategyAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.INHERITANCE__STRATEGY);
+ }
+
+ public static class InheritanceAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final InheritanceAnnotationDefinition INSTANCE = new InheritanceAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private InheritanceAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new InheritanceImpl(parent, (Type) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return new NullInheritance(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceType.java
new file mode 100644
index 0000000000..65cada71e9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceType.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public enum InheritanceType {
+
+ SINGLE_TABLE,
+ JOINED,
+ TABLE_PER_CLASS;
+
+
+ public static InheritanceType fromJavaAnnotationValue(Object javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ return null;
+ }
+ if (javaAnnotationValue.equals(JPA.INHERITANCE_TYPE__SINGLE_TABLE)) {
+ return SINGLE_TABLE;
+ }
+ if (javaAnnotationValue.equals(JPA.INHERITANCE_TYPE__JOINED)) {
+ return JOINED;
+ }
+ if (javaAnnotationValue.equals(JPA.INHERITANCE_TYPE__TABLE_PER_CLASS)) {
+ return TABLE_PER_CLASS;
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(InheritanceType inheritanceType) {
+ if (inheritanceType == null) {
+ return null;
+ }
+ switch (inheritanceType) {
+ case SINGLE_TABLE :
+ return JPA.INHERITANCE_TYPE__SINGLE_TABLE;
+ case JOINED :
+ return JPA.INHERITANCE_TYPE__JOINED;
+ case TABLE_PER_CLASS :
+ return JPA.INHERITANCE_TYPE__TABLE_PER_CLASS;
+ default :
+ throw new IllegalArgumentException("unknown inheritance type: " + inheritanceType);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JPA.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JPA.java
index 8675c6da6f..810960b68b 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JPA.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JPA.java
@@ -7,7 +7,7 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.java.mappings;
+package org.eclipse.jpt.core.internal.resource.java;
/**
@@ -149,7 +149,7 @@ public interface JPA {
String PERSISTENCE_CONTEXT__TYPE = "type";
String PERSISTENCE_CONTEXTS = PACKAGE_ + "PersistenceContexts";
String PERSISTENCE_CONTEXTS__VALUE = "value";
- String PERSISTENCE_UNIT = PACKAGE_ + "PersistenceUnit";
+ String PERSISTENCE_UNIT = PACKAGE_ + "XmlPersistenceUnit";
String PERSISTENCE_UNIT__NAME = "name";
String PERSISTENCE_UNIT__UNIT_NAME = "unitName";
String PERSISTENCE_UNITS = PACKAGE_ + "PersistenceUnits";
@@ -272,7 +272,7 @@ public interface JPA {
String QUERY = PACKAGE_ + "Query";
// JPA classes
- String PERSISTENCE = PACKAGE_ + "Persistence";
+ String PERSISTENCE = PACKAGE_ + "XmlPersistence";
// JPA exceptions
String NON_UNIQUE_RESULT_EXCEPTION = PACKAGE_ + "NonUniqueResultException";
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentAttributeResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentAttributeResource.java
new file mode 100644
index 0000000000..0e9573aa70
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentAttributeResource.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+
+
+//TODO how do we handle:
+// @Basic
+// private String foo, bar;
+
+public interface JavaPersistentAttributeResource extends JavaPersistentResource
+{
+ String getName();
+
+ Member getMember();
+
+ boolean isForField();
+
+ boolean isForProperty();
+
+ boolean typeIsBasic();
+ String TYPE_IS_BASIC_PROPERTY = "typeIsBasicProperty";
+
+ /**
+ * Return true if the attribute type is a container:
+ * java.util.Collection
+ * java.util.Set
+ * java.util.List
+ * java.util.Map
+ * @return
+ */
+ boolean typeIsContainer();
+ String TYPE_IS_CONTAINER_PROPERTY = "typeIsContainerProperty";
+
+ /**
+ * Returns the resolved qualfied type name for the attribute
+ */
+ String getQualifiedTypeName();
+ String QUALFIED_TYPE_NAME_PROPERTY = "qualfiedTypeNameProperty";
+
+ /**
+ * Returns the resolved qualfied type name for the attribute
+ * if it as valid as a target entity type. i.e. not an array.
+ * see typeIsContainer() to be used with this
+ */
+ String getQualifiedReferenceEntityTypeName();
+ String QUALFIED_REFERENCE_ENTITY_TYPE_NAME_PROPERTY = "qualfiedReferenceEntityTypeNameProperty";
+
+ /**
+ * Returns the fully qualified type parameter for use as a target entity
+ */
+ String getQualifiedReferenceEntityElementTypeName();
+ String QUALFIED_REFERENCE_ENTITY_ELEMENT_TYPE_NAME_PROPERTY = "qualfiedReferenceEntityElementTypeNameProperty";
+
+ /**
+ * Return true if this attribute has any mapping or non-mapping annotations
+ * (of course only persistence related annotations)
+ */
+ boolean hasAnyAnnotation();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentAttributeResourceImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentAttributeResourceImpl.java
new file mode 100644
index 0000000000..1099a5fa09
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentAttributeResourceImpl.java
@@ -0,0 +1,402 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.IBinding;
+import org.eclipse.jdt.core.dom.IMethodBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.IVariableBinding;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.JPTTools;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+
+public class JavaPersistentAttributeResourceImpl
+ extends AbstractJavaPersistentResource<Attribute>
+ implements JavaPersistentAttributeResource
+{
+
+ private boolean typeIsBasic;
+
+ private String qualifiedTypeName;
+
+ private boolean typeIsContainer;
+
+ private String qualifiedReferenceEntityTypeName;
+
+ private String qualifiedReferenceEntityElementTypeName;
+
+ public JavaPersistentAttributeResourceImpl(JavaPersistentTypeResource parent, Attribute attribute){
+ super(parent, attribute);
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.typeIsBasic = this.typeIsBasic(astRoot);
+ this.qualifiedTypeName = this.qualifiedTypeName(astRoot);
+ }
+
+ public String getName() {
+ return getMember().attributeName();
+ }
+
+ // ******** AbstractJavaPersistentResource implementation ********
+
+ @Override
+ protected Annotation buildMappingAnnotation(String mappingAnnotationName) {
+ return annotationProvider().buildAttributeMappingAnnotation(this, getMember(), mappingAnnotationName);
+ }
+
+ @Override
+ protected Annotation buildAnnotation(String annotationName) {
+ return annotationProvider().buildAttributeAnnotation(this, getMember(), annotationName);
+ }
+
+ @Override
+ protected Annotation buildNullAnnotation(String annotationName) {
+ return annotationProvider().buildNullAttributeAnnotation(this, getMember(), annotationName);
+ }
+
+ @Override
+ protected Annotation buildNullMappingAnnotation(String annotationName) {
+ return annotationProvider().buildNullAttributeMappingAnnotation(this, getMember(), annotationName);
+ }
+
+ @Override
+ protected ListIterator<String> possibleMappingAnnotationNames() {
+ return annotationProvider().attributeMappingAnnotationNames();
+ }
+
+ @Override
+ protected boolean isPossibleAnnotation(String annotationName) {
+ return CollectionTools.contains(annotationProvider().attributeAnnotationNames(), annotationName);
+ }
+
+ @Override
+ protected boolean isPossibleMappingAnnotation(String annotationName) {
+ return CollectionTools.contains(annotationProvider().attributeMappingAnnotationNames(), annotationName);
+ }
+
+ @Override
+ protected boolean calculatePersistability(CompilationUnit astRoot) {
+ IBinding binding = getMember().binding(astRoot);
+ if (binding == null) {
+ return false;
+ }
+ if (isForField()) {
+ return JPTTools.fieldIsPersistable((IVariableBinding) binding);
+ }
+ return JPTTools.methodIsPersistablePropertyGetter((IMethodBinding) binding);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ //overriding purely to suppress the warning you get at the class level
+ public ListIterator<NestableAnnotation> annotations(String nestableAnnotationName, String containerAnnotationName) {
+ return super.annotations(nestableAnnotationName, containerAnnotationName);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ //overriding purely to suppress the warning you get at the class level
+ public Iterator<Annotation> mappingAnnotations() {
+ return super.mappingAnnotations();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ //overriding purely to suppress the warning you get at the class level
+ public Iterator<Annotation> annotations() {
+ return super.annotations();
+ }
+
+ // ******** JavaPersistentAttributeResource implementation ********
+
+ public boolean isForField() {
+ return getMember().isField();
+ }
+
+ public boolean isForProperty() {
+ return !isForField();
+ }
+
+ public boolean hasAnyAnnotation() {
+ if (CollectionTools.size(mappingAnnotations()) > 0) {
+ return true;
+ }
+ if (CollectionTools.size(annotations()) > 0) {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean typeIsBasic() {
+ return this.typeIsBasic;
+ }
+
+ protected void setTypeIsBasic(boolean newTypeIsBasic) {
+ boolean oldTypeIsBasic = this.typeIsBasic;
+ this.typeIsBasic = newTypeIsBasic;
+ firePropertyChanged(TYPE_IS_BASIC_PROPERTY, oldTypeIsBasic, newTypeIsBasic);
+ }
+
+ public String getQualifiedTypeName() {
+ return this.qualifiedTypeName;
+ }
+
+ protected void setQualifiedTypeName(String newQualifiedTypeName) {
+ String oldQualifiedTypeName = this.qualifiedTypeName;
+ this.qualifiedTypeName = newQualifiedTypeName;
+ firePropertyChanged(QUALFIED_TYPE_NAME_PROPERTY, oldQualifiedTypeName, newQualifiedTypeName);
+ }
+
+ public String getQualifiedReferenceEntityTypeName() {
+ return this.qualifiedReferenceEntityTypeName;
+ }
+
+ public void setQualifiedReferenceEntityTypeName(String newQualifiedReferenceEntityTypeName) {
+ String oldQualifiedReferenceEntityTypeName = this.qualifiedReferenceEntityTypeName;
+ this.qualifiedReferenceEntityTypeName = newQualifiedReferenceEntityTypeName;
+ firePropertyChanged(QUALFIED_REFERENCE_ENTITY_TYPE_NAME_PROPERTY, oldQualifiedReferenceEntityTypeName, newQualifiedReferenceEntityTypeName);
+ }
+
+ public String getQualifiedReferenceEntityElementTypeName() {
+ return this.qualifiedReferenceEntityElementTypeName;
+ }
+
+ public void setQualifiedReferenceEntityElementTypeName(String newQualifiedReferenceEntityElementTypeName) {
+ String oldQualifiedReferenceEntityElementTypeName = this.qualifiedReferenceEntityElementTypeName;
+ this.qualifiedReferenceEntityElementTypeName = newQualifiedReferenceEntityElementTypeName;
+ firePropertyChanged(QUALFIED_REFERENCE_ENTITY_ELEMENT_TYPE_NAME_PROPERTY, oldQualifiedReferenceEntityElementTypeName, newQualifiedReferenceEntityElementTypeName);
+ }
+
+ public boolean typeIsContainer() {
+ return this.typeIsContainer;
+ }
+
+ protected void setTypeIsContainer(boolean typeIsContainer) {
+ boolean oldTypeIsContainer = this.typeIsContainer;
+ this.typeIsContainer = typeIsContainer;
+ firePropertyChanged(TYPE_IS_BASIC_PROPERTY, oldTypeIsContainer, typeIsContainer);
+ }
+
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.setTypeIsBasic(this.typeIsBasic(astRoot));
+ this.setQualifiedTypeName(this.qualifiedTypeName(astRoot));
+ this.setQualifiedReferenceEntityTypeName(this.qualifiedReferenceEntityTypeName(astRoot));
+ this.setQualifiedReferenceEntityElementTypeName(this.qualifiedReferenceEntityElementTypeName(astRoot));
+ this.setTypeIsContainer(this.typeIsContainer(astRoot));
+ }
+
+ @Override
+ public void resolveTypes(CompilationUnit astRoot) {
+ super.resolveTypes(astRoot);
+ this.setTypeIsBasic(this.typeIsBasic(astRoot));
+ this.setQualifiedTypeName(this.qualifiedTypeName(astRoot));
+ this.setQualifiedReferenceEntityTypeName(this.qualifiedReferenceEntityTypeName(astRoot));
+ this.setQualifiedReferenceEntityElementTypeName(this.qualifiedReferenceEntityElementTypeName(astRoot));
+ this.setTypeIsContainer(this.typeIsContainer(astRoot));
+ }
+
+ protected boolean typeIsBasic(CompilationUnit astRoot) {
+ return typeIsBasic(getMember().typeBinding(astRoot), astRoot.getAST());
+ }
+
+ protected String qualifiedReferenceEntityTypeName(CompilationUnit astRoot) {
+ ITypeBinding typeBinding = getMember().typeBinding(astRoot);
+ if (typeBinding == null) {
+ return null;
+ }
+ return buildReferenceEntityTypeName(typeBinding);
+ }
+
+ public static String buildReferenceEntityTypeName(ITypeBinding typeBinding) {
+ if (typeBinding != null && !typeBinding.isArray()) { // arrays cannot be entities
+ return typeBinding.getTypeDeclaration().getQualifiedName();
+ }
+ return null;
+ }
+
+ protected String qualifiedReferenceEntityElementTypeName(CompilationUnit astRoot) {
+ ITypeBinding typeBinding = getMember().typeBinding(astRoot);
+ if (typeBinding == null) {
+ return null;
+ }
+
+ ITypeBinding[] typeArguments = typeBinding.getTypeArguments();
+ if (typeArguments.length != 1) {
+ return null;
+ }
+ ITypeBinding elementTypeBinding = typeArguments[0];
+ String elementTypeName = buildReferenceEntityTypeName(elementTypeBinding);
+ return typeNamedIsContainer(elementTypeName) ? null : elementTypeName;
+ }
+
+
+ protected boolean typeIsContainer(CompilationUnit astRoot) {
+ String typeName = buildReferenceEntityTypeName(getMember().typeBinding(astRoot));
+ return typeName == null ? false : typeNamedIsContainer(typeName);
+ }
+
+ /**
+ * return whether the specified non-array type is one of the container
+ * types allowed by the JPA spec
+ */
+ public static boolean typeNamedIsContainer(String typeName) {
+ return CollectionTools.contains(CONTAINER_TYPE_NAMES, typeName);
+ }
+
+ private static final String[] CONTAINER_TYPE_NAMES = {
+ java.util.Collection.class.getName(),
+ java.util.Set.class.getName(),
+ java.util.List.class.getName(),
+ java.util.Map.class.getName()
+ };
+
+ protected String qualifiedTypeName(CompilationUnit astRoot) {
+ ITypeBinding typeBinding = getMember().typeBinding(astRoot);
+ if (typeBinding == null) {
+ return null;
+ }
+ return typeBinding.getQualifiedName();
+ }
+
+
+ /**
+ * From the JPA spec, when the basic mapping applies:
+ * If the type of the attribute (field or property) is one of the following
+ * it must be mapped as @Basic:
+ * primitive types
+ * byte[]
+ * Byte[]
+ * char[]
+ * Character[]
+ * primitive wrappers
+ * java.lang.String
+ * java.math.BigInteger
+ * java.math.BigDecimal
+ * java.util.Date
+ * java.util.Calendar
+ * java.sql.Date
+ * java.sql.Time
+ * java.sql.Timestamp
+ * enums
+ * any other type that implements java.io.Serializable
+ */
+ public static boolean typeIsBasic(ITypeBinding typeBinding, AST ast) {
+ if (typeBinding == null) {
+ return false; // type not found
+ }
+ if (typeBinding.isPrimitive()) {
+ return true;
+ }
+ if (typeBinding.isArray()) {
+ if (typeBinding.getDimensions() > 1) {
+ return false; // multi-dimensional arrays are not supported
+ }
+ ITypeBinding elementTypeBinding = typeBinding.getElementType();
+ if (elementTypeBinding == null) {
+ return false;// unable to resolve the type
+ }
+ return elementTypeIsValid(elementTypeBinding.getQualifiedName());
+ }
+ String typeName = typeBinding.getQualifiedName();
+ if (typeIsPrimitiveWrapper(typeName)) {
+ return true;
+ }
+ if (typeIsOtherSupportedType(typeName)) {
+ return true;
+ }
+ if (typeBinding.isEnum()) {
+ return true;
+ }
+ if (typeImplementsSerializable(typeBinding, ast)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Return whether the specified type is a valid element type for
+ * a one-dimensional array:
+ * byte
+ * char
+ * java.lang.Byte
+ * java.lang.Character
+ */
+ private static boolean elementTypeIsValid(String elementTypeName) {
+ return CollectionTools.contains(VALID_ELEMENT_TYPE_NAMES, elementTypeName);
+ }
+
+ private static final String[] VALID_ELEMENT_TYPE_NAMES = {
+ byte.class.getName(),
+ char.class.getName(),
+ java.lang.Byte.class.getName(),
+ java.lang.Character.class.getName()
+ };
+
+ /**
+ * Return whether the specified type is a primitive wrapper.
+ */
+ private static boolean typeIsPrimitiveWrapper(String typeName) {
+ return CollectionTools.contains(PRIMITIVE_WRAPPER_TYPE_NAMES, typeName);
+ }
+
+ private static final String[] PRIMITIVE_WRAPPER_TYPE_NAMES = {
+ java.lang.Byte.class.getName(),
+ java.lang.Character.class.getName(),
+ java.lang.Double.class.getName(),
+ java.lang.Float.class.getName(),
+ java.lang.Integer.class.getName(),
+ java.lang.Long.class.getName(),
+ java.lang.Short.class.getName(),
+ java.lang.Boolean.class.getName(),
+ };
+
+ /**
+ * Return whether the specified type is among the various other types
+ * that default to a Basic mapping.
+ */
+ private static boolean typeIsOtherSupportedType(String typeName) {
+ return CollectionTools.contains(OTHER_SUPPORTED_TYPE_NAMES, typeName);
+ }
+
+ private static final String[] OTHER_SUPPORTED_TYPE_NAMES = {
+ java.lang.String.class.getName(),
+ java.math.BigInteger.class.getName(),
+ java.math.BigDecimal.class.getName(),
+ java.util.Date.class.getName(),
+ java.util.Calendar.class.getName(),
+ java.sql.Date.class.getName(),
+ java.sql.Time.class.getName(),
+ java.sql.Timestamp.class.getName(),
+ };
+
+ /**
+ * Return whether the specified type implements java.io.Serializable.
+ */
+ private static boolean typeImplementsSerializable(ITypeBinding typeBinding, AST ast) {
+ ITypeBinding serializableTypeBinding = ast.resolveWellKnownType(SERIALIZABLE_TYPE_NAME);
+ return typeBinding.isAssignmentCompatible(serializableTypeBinding);
+ }
+
+ private static final String SERIALIZABLE_TYPE_NAME = java.io.Serializable.class.getName();
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(getName());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentResource.java
new file mode 100644
index 0000000000..a5fca865f9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentResource.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jpt.core.internal.platform.base.BaseJpaPlatform;
+
+public interface JavaPersistentResource extends JavaResource
+{
+
+ /**
+ * Return all <code>JavaResource</code>s that correspond to type
+ * mapping annotations specified in the source code. In JPA these could be
+ * Entity, MappedSuperclass, Embeddable.
+ * <p>Does not return duplicate annotations as this error is handled by the java compiler.
+ */
+ <T extends JavaResource> Iterator<T> mappingAnnotations();
+
+ String MAPPING_ANNOTATIONS_COLLECTION = "mappingAnnotationsCollection";
+
+ /**
+ * Return the <code>JavaResource</code> specified on this JavaPersistentResource
+ * In the case of multiples the first one will be returned as defined by the order of
+ * {@link BaseJpaPlatform#typeMappingAnnotationDefinitions()} or
+ * {@link BaseJpaPlatform#attributeMappingAnnotationDefinitions()}
+ * @return
+ */
+ JavaResource mappingAnnotation();
+
+ /**
+ * Returns the <code>JavaResource</code> with this fully qualifed annotation name.
+ * In JPA the valid annotations are "javax.persistence.Embedddable", "javax.persistence.Entity",
+ * and "javax.persistence.MappedSuperclass"
+ * Return the first if there are duplicates in the source code
+ * @param annotationName - fully qualified annotation name
+ * @return
+ */
+ //TODO not sure we need this API, first 2 seem sufficient
+ JavaResource mappingAnnotation(String annotationName);
+
+ /**
+ * Use this to change the type mapping annotation. This will only remove
+ * other mapping annotations in case there were multiple before. It
+ * will not remove any non-mapping annotations
+ * @param annotationName - fully qualified annotation name
+ */
+ void setMappingAnnotation(String annotationName);
+
+ /**
+ * Return all <code>JavaResource</code>s that correspond to annotations in the source code.
+ * Does not return duplicate annotations as this error is handled by the java compiler.
+ * No <code>MappingAnnotation</code>s should be included.
+ * @see #mappingAnnotations()
+ */
+ <T extends JavaResource> Iterator<T> annotations();
+
+ String ANNOTATIONS_COLLECTION = "annotationsCollection";
+
+ //TODO tie the singular and plural annotations together somehow in the resource model so we can give
+ //a validation error for the case of both being specified
+ /**
+ * Given a nestable and container annotation name return the specified <code>JavaResource</code>s.
+ * If both the nestable and container annotations are specified on the Type, then only
+ * return the nestable annotations specified within the container annotation. This is
+ * only going to return JavaResources that match the nestableAnnotationName
+ */
+ <T extends JavaResource> ListIterator<T> annotations(String nestableAnnotationName, String containerAnnotationName);
+
+
+ /**
+ * Returns the <code>JavaResource</code> with this fully qualifed annotation name.
+ * Return the first if there are duplicates in the source code.
+ * @param annotationName
+ * @return
+ */
+ JavaResource annotation(String annotationName);
+
+ /**
+ * Returns the <code>JavaResource</code> with this fully qualifed annotation name.
+ * Return the first if there are duplicates in the source code. Will not return null,
+ * but a null Object instead if no annotation with this name exists in the java source.
+ * @param annotationName
+ * @return
+ */
+ JavaResource nonNullAnnotation(String annotationName);
+
+ /**
+ * Returns the <code>JavaResource</code> with this fully qualifed annotation name.
+ * Return the first if there are duplicates in the source code. Will not return null,
+ * but a null Object instead if no annotation with this name exists in the java source.
+ * @param annotationName
+ * @return
+ */
+ JavaResource nonNullMappingAnnotation(String annotationName);
+
+ /**
+ * Add an annotation for the given fully qualified annotation name
+ */
+ JavaResource addAnnotation(String annotationName);
+
+ void removeAnnotation(String annotationName);
+
+ /**
+ * Add a new NestableAnnotation named nestableAnnotationName. Create a new container annotation
+ * if necessary and add the nestable annotation to it. If both nestable and container already
+ * exist then add to the container annotation leaving the existing nestable annotaion alone.
+ * If only nestable exists, then create the new container annotation and move the nestable to it
+ * also adding the new one. If neither exists, create a new nestable annotation.
+ * @return the new JavaResource with the name nestableAnnotationName
+ */
+ JavaResource addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName);
+
+ void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName);
+
+ /**
+ * Move nestableAnnotation found in the containerAnnotation from the specified source
+ * index to the specified target index.
+ */
+ void move(int targetIndex, int sourceIndex, String containerAnnotationName);
+
+ /**
+ * Return whether the underlying JDT member is persistable according to the JPA spec
+ * @return
+ */
+ boolean isPersistable();
+ String PERSISTABLE_PROPERTY = "persistableProperty";
+
+ /**
+ * Return true if this JavaPersistentResource represents the underlying JDT IMeber
+ * @param member
+ * @return
+ */
+ boolean isFor(IMember member);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentTypeResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentTypeResource.java
new file mode 100644
index 0000000000..f9ab8d317c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentTypeResource.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.Iterator;
+
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+
+public interface JavaPersistentTypeResource extends JavaPersistentResource
+{
+ /**
+ * Return only the persistable nestedTypes
+ */
+ Iterator<JavaPersistentTypeResource> nestedTypes();
+ String NESTED_TYPES_COLLECTION = "nestedTypesCollection";
+
+ /**
+ * Return only the persistable attributes, those that respond true to
+ * {@link JavaPersistentAttributeResource#isPersistable()}
+ * This returns fields and properties
+ * @return
+ */
+ Iterator<JavaPersistentAttributeResource> attributes();
+ String ATTRIBUTES_COLLECTION = "attributesCollection";
+
+ /**
+ * Return only the persistable fields, those that respond true to
+ * {@link JavaPersistentAttributeResource#isPersistable()}
+ * This returns filters out all properties and only returns fields
+ * @return
+ */
+ Iterator<JavaPersistentAttributeResource> fields();
+
+ /**
+ * Return only the persistable fields, those that respond true to
+ * {@link JavaPersistentAttributeResource#isPersistable()}
+ * This returns filters out all fields and only returns properties
+ * @return
+ */
+ Iterator<JavaPersistentAttributeResource> properties();
+
+ JavaPersistentTypeResource javaPersistentTypeResource(String fullyQualifiedTypeName);
+
+ /**
+ * Return the fully qualified type name
+ */
+ String getQualifiedName();
+ String QUALIFIED_NAME_PROPERTY = "qualifiedNameProperty";
+
+ /**
+ * Return the fully unqualified type name
+ */
+ String getName();
+ String NAME_PROPERTY = "nameProperty";
+
+ String getSuperClassQualifiedName();
+ String SUPER_CLASS_QUALIFIED_NAME_PROPERTY = "superClassQualifiedNameProperty";
+
+ AccessType getAccess();
+ String ACCESS_PROPERTY = "accessProperty";
+
+ boolean isAbstract();
+ String ABSTRACT_PROPERTY = "abstractProperty";
+
+ Member getMember();
+
+ /**
+ * Return whether any attributes in this persistentType have
+ * JPA annotations on them.
+ */
+ boolean hasAnyAttributeAnnotations();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentTypeResourceImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentTypeResourceImpl.java
new file mode 100644
index 0000000000..3f57c7e21b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaPersistentTypeResourceImpl.java
@@ -0,0 +1,484 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationEditFormatter;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.FieldAttribute;
+import org.eclipse.jpt.core.internal.jdtutility.JPTTools;
+import org.eclipse.jpt.core.internal.jdtutility.MethodAttribute;
+import org.eclipse.jpt.core.internal.jdtutility.Type;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.CommandExecutorProvider;
+import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+
+public class JavaPersistentTypeResourceImpl extends AbstractJavaPersistentResource<Type> implements JavaPersistentTypeResource
+{
+ /**
+ * store all member types including those that aren't persistable so we can include validation errors.
+ */
+ private final Collection<JavaPersistentTypeResource> nestedTypes;
+
+ private final Collection<JavaPersistentAttributeResource> attributes;
+
+ private AccessType accessType;
+
+ private String superClassQualifiedName;
+
+ private String qualifiedName;
+
+ private String name;
+
+ private boolean isAbstract;
+
+ public JavaPersistentTypeResourceImpl(JavaResource parent, Type type){
+ super(parent, type);
+ this.nestedTypes = new ArrayList<JavaPersistentTypeResource>();
+ this.attributes = new ArrayList<JavaPersistentAttributeResource>();
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.qualifiedName = this.qualifiedName(astRoot);
+ this.name = this.name(astRoot);
+ this.initializeNestedTypes(astRoot);
+ this.initializeAttributes(astRoot);
+ this.accessType = this.calculateAccessType();
+ this.superClassQualifiedName = this.superClassQualifiedName(astRoot);
+ this.isAbstract = this.isAbstract(astRoot);
+ }
+
+ protected void initializeNestedTypes(CompilationUnit astRoot) {
+ for (IType declaredType : getMember().declaredTypes()) {
+ this.nestedTypes.add(createJavaPersistentType(declaredType, astRoot));
+ }
+ }
+
+ protected void initializeAttributes(CompilationUnit astRoot) {
+ for (IField field : getMember().fields()) {
+ this.attributes.add(createJavaPersistentAttribute(field, astRoot));
+ }
+ for (IMethod method : getMember().methods()) {
+ this.attributes.add(createJavaPersistentAttribute(method, astRoot));
+ }
+ }
+
+ // ******** AbstractJavaPersistentResource implementation ********
+
+ @Override
+ protected Annotation buildMappingAnnotation(String mappingAnnotationName) {
+ return annotationProvider().buildTypeMappingAnnotation(this, getMember(), mappingAnnotationName);
+ }
+
+ @Override
+ protected Annotation buildNullMappingAnnotation(String annotationName) {
+ return annotationProvider().buildNullTypeMappingAnnotation(this, getMember(), annotationName);
+ }
+
+ @Override
+ protected Annotation buildAnnotation(String annotationName) {
+ return annotationProvider().buildTypeAnnotation(this, getMember(), annotationName);
+ }
+
+ @Override
+ protected Annotation buildNullAnnotation(String annotationName) {
+ return annotationProvider().buildNullTypeAnnotation(this, getMember(), annotationName);
+ }
+
+ @Override
+ protected ListIterator<String> possibleMappingAnnotationNames() {
+ return annotationProvider().typeMappingAnnotationNames();
+ }
+
+ @Override
+ protected boolean isPossibleAnnotation(String annotationName) {
+ return CollectionTools.contains(annotationProvider().typeAnnotationNames(), annotationName);
+ }
+
+ @Override
+ protected boolean isPossibleMappingAnnotation(String annotationName) {
+ return CollectionTools.contains(annotationProvider().typeMappingAnnotationNames(), annotationName);
+ }
+
+ @Override
+ protected boolean calculatePersistability(CompilationUnit astRoot) {
+ return JPTTools.typeIsPersistable(getMember().binding(astRoot));
+ }
+
+
+ @Override
+ @SuppressWarnings("unchecked")
+ //overriding purely to suppress the warning you get at the class level
+ public ListIterator<NestableAnnotation> annotations(String nestableAnnotationName, String containerAnnotationName) {
+ return super.annotations(nestableAnnotationName, containerAnnotationName);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ //overriding purely to suppress the warning you get at the class level
+ public Iterator<Annotation> mappingAnnotations() {
+ return super.mappingAnnotations();
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ //overriding purely to suppress the warning you get at the class level
+ public Iterator<Annotation> annotations() {
+ return super.annotations();
+ }
+
+
+ // ******** JavaPersistentTypeResource implementation ********
+ public JavaPersistentTypeResource javaPersistentTypeResource(String fullyQualifiedTypeName) {
+ if (getQualifiedName().equals(fullyQualifiedTypeName)) {
+ return this;
+ }
+ for (JavaPersistentTypeResource jptr : CollectionTools.iterable(nestedTypes())) {
+ if (jptr.getQualifiedName().equals(fullyQualifiedTypeName)) {
+ return jptr;
+ }
+ }
+ return null;
+ }
+
+ public Iterator<JavaPersistentTypeResource> nestedTypes() {
+ //TODO since we are filtering how do we handle the case where a type becomes persistable?
+ //what kind of change notificiation for that case?
+ return new FilteringIterator<JavaPersistentTypeResource, JavaPersistentTypeResource>(new CloneIterator<JavaPersistentTypeResource>(this.nestedTypes)) {
+ @Override
+ protected boolean accept(JavaPersistentTypeResource o) {
+ return o.isPersistable();
+ }
+ };
+ }
+
+ protected JavaPersistentTypeResource nestedTypeFor(IType type) {
+ for (JavaPersistentTypeResource nestedType : this.nestedTypes) {
+ if (nestedType.isFor(type)) {
+ return nestedType;
+ }
+ }
+ return null;
+ }
+
+ protected JavaPersistentTypeResource addNestedType(IType nestedType, CompilationUnit astRoot) {
+ JavaPersistentTypeResource persistentType = createJavaPersistentType(nestedType, astRoot);
+ addNestedType(persistentType);
+ return persistentType;
+ }
+
+ protected void addNestedType(JavaPersistentTypeResource nestedType) {
+ addItemToCollection(nestedType, this.nestedTypes, NESTED_TYPES_COLLECTION);
+ }
+
+ protected void removeNestedType(JavaPersistentTypeResource nestedType) {
+ removeItemFromCollection(nestedType, this.nestedTypes, NESTED_TYPES_COLLECTION);
+ }
+
+ protected JavaPersistentTypeResource createJavaPersistentType(IType nestedType, CompilationUnit astRoot) {
+ return createJavaPersistentType(this, nestedType, modifySharedDocumentCommandExecutorProvider(), annotationEditFormatter(), astRoot);
+ }
+
+ public static JavaPersistentTypeResource createJavaPersistentType(
+ JavaResource parent,
+ IType nestedType,
+ CommandExecutorProvider modifySharedDocumentCommandExecutorProvider,
+ AnnotationEditFormatter annotationEditFormatter,
+ CompilationUnit astRoot) {
+
+ Type type = new Type(nestedType, modifySharedDocumentCommandExecutorProvider, annotationEditFormatter);
+ JavaPersistentTypeResourceImpl javaPersistentType = new JavaPersistentTypeResourceImpl(parent, type);
+ javaPersistentType.initialize(astRoot);
+ return javaPersistentType;
+ }
+
+ public Iterator<JavaPersistentAttributeResource> attributes() {
+ //TODO since we are filtering how do we handle the case where an attribute becomes persistable?
+ //what kind of change notificiation for that case?
+ return new FilteringIterator<JavaPersistentAttributeResource, JavaPersistentAttributeResource>(new CloneIterator<JavaPersistentAttributeResource>(this.attributes)) {
+ @Override
+ protected boolean accept(JavaPersistentAttributeResource o) {
+ return o.isPersistable();
+ }
+ };
+ }
+
+ public Iterator<JavaPersistentAttributeResource> fields() {
+ return new FilteringIterator<JavaPersistentAttributeResource, JavaPersistentAttributeResource>(attributes()) {
+ @Override
+ protected boolean accept(JavaPersistentAttributeResource o) {
+ return o.isForField();
+ }
+ };
+ }
+
+ public Iterator<JavaPersistentAttributeResource> properties() {
+ return new FilteringIterator<JavaPersistentAttributeResource, JavaPersistentAttributeResource>(attributes()) {
+ @Override
+ protected boolean accept(JavaPersistentAttributeResource o) {
+ return o.isForProperty();
+ }
+ };
+ }
+
+ protected JavaPersistentAttributeResource addAttribute(IMember jdtMember, CompilationUnit astRoot) {
+ JavaPersistentAttributeResource persistentAttribute = createJavaPersistentAttribute(jdtMember, astRoot);
+ addAttribute(persistentAttribute);
+ return persistentAttribute;
+ }
+
+ protected void addAttribute(JavaPersistentAttributeResource attribute) {
+ addItemToCollection(attribute, this.attributes, ATTRIBUTES_COLLECTION);
+ }
+
+ protected JavaPersistentAttributeResource createJavaPersistentAttribute(IMember member, CompilationUnit astRoot) {
+ Attribute attribute = null;
+ if (member instanceof IField) {
+ attribute = new FieldAttribute((IField) member, this.modifySharedDocumentCommandExecutorProvider(), this.annotationEditFormatter());
+ }
+ else if (member instanceof IMethod) {
+ attribute = new MethodAttribute((IMethod) member, this.modifySharedDocumentCommandExecutorProvider(), this.annotationEditFormatter());
+ }
+ else {
+ throw new IllegalArgumentException();
+ }
+ JavaPersistentAttributeResource javaPersistentAttribute = new JavaPersistentAttributeResourceImpl(this, attribute);
+ javaPersistentAttribute.initialize(astRoot);
+ return javaPersistentAttribute;
+ }
+
+ protected void removeAttribute(JavaPersistentAttributeResource attribute) {
+ removeItemFromCollection(attribute, this.attributes, ATTRIBUTES_COLLECTION);
+ }
+
+ protected JavaPersistentAttributeResource attributeFor(IMember member) {
+ for (JavaPersistentAttributeResource persistentAttribute : this.attributes) {
+ if (persistentAttribute.isFor(member)) {
+ return persistentAttribute;
+ }
+ }
+ return null;
+ }
+
+ public AccessType getAccess() {
+ return this.accessType;
+ }
+
+ //seems we could have a public changeAccess() api which would
+ //move all annotations from fields to their corresponding methods or vice versa
+ //though of course it's more complicated than that since what if the
+ //corresponding field/method does not exist?
+ //making this internal since it should only be set based on changes in the source, the
+ //context model should not need to set this
+ protected void setAccess(AccessType newAccess) {
+ AccessType oldAccess = this.accessType;
+ this.accessType = newAccess;
+ firePropertyChanged(ACCESS_PROPERTY, oldAccess, newAccess);
+ }
+
+ public String getSuperClassQualifiedName() {
+ return this.superClassQualifiedName;
+ }
+
+ private void setSuperClassQualifiedName(String newSuperClassQualifiedName) {
+ String oldSuperClassQualifiedName = this.superClassQualifiedName;
+ this.superClassQualifiedName = newSuperClassQualifiedName;
+ firePropertyChanged(SUPER_CLASS_QUALIFIED_NAME_PROPERTY, oldSuperClassQualifiedName, newSuperClassQualifiedName);
+ }
+
+ public String getQualifiedName() {
+ return this.qualifiedName;
+ }
+
+ protected void setQualifiedName(String newQualifiedName) {
+ String oldQualifiedName = this.qualifiedName;
+ this.qualifiedName = newQualifiedName;
+ firePropertyChanged(QUALIFIED_NAME_PROPERTY, oldQualifiedName, newQualifiedName);
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ protected void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public boolean isAbstract() {
+ return this.isAbstract;
+ }
+
+ protected void setAbstract(boolean newAbstract) {
+ boolean oldAbstract = this.isAbstract;
+ this.isAbstract = newAbstract;
+ firePropertyChanged(ABSTRACT_PROPERTY, oldAbstract, newAbstract);
+ }
+
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.setQualifiedName(this.qualifiedName(astRoot));
+ this.setName(this.name(astRoot));
+ this.updateNestedTypes(astRoot);
+ this.updatePersistentAttributes(astRoot);
+ this.setAccess(this.calculateAccessType());
+ this.setSuperClassQualifiedName(this.superClassQualifiedName(astRoot));
+ this.setAbstract(isAbstract(astRoot));
+ }
+
+ @Override
+ public void resolveTypes(CompilationUnit astRoot) {
+ super.resolveTypes(astRoot);
+ for (JavaPersistentAttributeResource attribute : this.attributes) {
+ attribute.resolveTypes(astRoot);
+ }
+ for (JavaPersistentTypeResource persistentType : this.nestedTypes) {
+ persistentType.resolveTypes(astRoot);
+ }
+ }
+
+ protected boolean isAbstract(CompilationUnit astRoot) {
+ return JPTTools.typeIsAbstract(getMember().binding(astRoot));
+ }
+
+ protected String qualifiedName(CompilationUnit astRoot) {
+ return getMember().binding(astRoot).getQualifiedName();
+ }
+
+ protected String name(CompilationUnit astRoot) {
+ return getMember().binding(astRoot).getName();
+ }
+
+ protected void updateNestedTypes(CompilationUnit astRoot) {
+ IType[] declaredTypes = getMember().declaredTypes();
+
+ List<JavaPersistentTypeResource> nestedTypesToRemove = new ArrayList<JavaPersistentTypeResource>(this.nestedTypes);
+ for (IType declaredType : declaredTypes) {
+ JavaPersistentTypeResource nestedType = nestedTypeFor(declaredType);
+ if (nestedType == null) {
+ nestedType = addNestedType(declaredType, astRoot);
+ }
+ else {
+ nestedTypesToRemove.remove(nestedType);
+ }
+ nestedType.updateFromJava(astRoot);
+ }
+ for (JavaPersistentTypeResource nestedType : nestedTypesToRemove) {
+ removeNestedType(nestedType);
+ }
+ }
+
+ protected void updatePersistentAttributes(CompilationUnit astRoot) {
+ List<JavaPersistentAttributeResource> persistentAttributesToRemove = new ArrayList<JavaPersistentAttributeResource>(this.attributes);
+ updatePersistentFields(astRoot, persistentAttributesToRemove);
+ updatePersistentProperties(astRoot, persistentAttributesToRemove);
+ for (JavaPersistentAttributeResource persistentAttribute : persistentAttributesToRemove) {
+ removeAttribute(persistentAttribute);
+ }
+ }
+
+ protected void updatePersistentFields(CompilationUnit astRoot, List<JavaPersistentAttributeResource> persistentAttributesToRemove) {
+ updatePersistentAttributes(astRoot, persistentAttributesToRemove, getMember().fields());
+ }
+
+ protected void updatePersistentProperties(CompilationUnit astRoot, List<JavaPersistentAttributeResource> persistentAttributesToRemove) {
+ updatePersistentAttributes(astRoot, persistentAttributesToRemove, getMember().methods());
+ }
+
+ protected void updatePersistentAttributes(CompilationUnit astRoot, List<JavaPersistentAttributeResource> persistentAttributesToRemove, IMember[] members) {
+ for (IMember member : members) {
+ JavaPersistentAttributeResource persistentAttribute = attributeFor(member);
+ if (persistentAttribute == null) {
+ persistentAttribute = addAttribute(member, astRoot);
+ }
+ else {
+ persistentAttributesToRemove.remove(persistentAttribute);
+ }
+ persistentAttribute.updateFromJava(astRoot);
+ }
+ }
+
+ public boolean hasAnyAttributeAnnotations() {
+ for (JavaPersistentAttributeResource attribute : CollectionTools.iterable(attributes())) {
+ if (attribute.hasAnyAnnotation()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return the AccessType currently implied by the Java source code:
+ * - if only Fields are annotated => FIELD
+ * - if only Properties are annotated => PROPERTY
+ * - if both Fields and Properties are annotated => FIELD
+ * - if nothing is annotated
+ * - and fields exist => FIELD
+ * - and properties exist, but no fields exist => PROPERTY
+ * - and neither fields nor properties exist => null at this level (FIELD in the context model)
+ */
+ private AccessType calculateAccessType() {
+ boolean hasPersistableFields = false;
+ boolean hasPersistableProperties = false;
+ for (JavaPersistentAttributeResource field : CollectionTools.iterable(fields())) {
+ hasPersistableFields = true;
+ if (field.hasAnyAnnotation()) {
+ // any field is annotated => FIELD
+ return AccessType.FIELD;
+ }
+ }
+ for (JavaPersistentAttributeResource property : CollectionTools.iterable(properties())) {
+ hasPersistableProperties = true;
+ if (property.hasAnyAnnotation()) {
+ // none of the fields are annotated and a getter is annotated => PROPERTY
+ return AccessType.PROPERTY;
+ }
+ }
+
+ if (hasPersistableProperties && !hasPersistableFields) {
+ return AccessType.PROPERTY;
+ }
+ //no annotations exist, access is null at the resource model level
+ return null;
+ }
+
+ private String superClassQualifiedName(CompilationUnit astRoot) {
+ ITypeBinding typeBinding = getMember().binding(astRoot);
+ if (typeBinding == null) {
+ return null;
+ }
+ ITypeBinding superClassTypeBinding = typeBinding.getSuperclass();
+ if (superClassTypeBinding == null) {
+ return null;
+ }
+ return superClassTypeBinding.getQualifiedName();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(getName());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaResource.java
new file mode 100644
index 0000000000..1293852736
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaResource.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IJpaAnnotationProvider;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.utility.internal.CommandExecutorProvider;
+import org.eclipse.jpt.utility.internal.node.Node;
+
+public interface JavaResource extends Node
+{
+ void initialize(CompilationUnit astRoot);
+
+ JavaResourceModel resourceModel();
+
+ JpaCompilationUnitResource root();
+
+ IJpaAnnotationProvider annotationProvider();
+
+ CommandExecutorProvider modifySharedDocumentCommandExecutorProvider();
+
+ void updateFromJava(CompilationUnit astRoot);
+
+ /**
+ * Use to resolve type information that could be dependent on other files being added/removed
+ */
+ void resolveTypes(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange
+ */
+ ITextRange textRange(CompilationUnit astRoot);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaResourceModel.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaResourceModel.java
new file mode 100644
index 0000000000..046e52c309
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JavaResourceModel.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jdt.core.ElementChangedEvent;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaElementDelta;
+import org.eclipse.jpt.core.internal.AbstractResourceModel;
+import org.eclipse.jpt.core.internal.IJpaAnnotationProvider;
+import org.eclipse.jpt.core.internal.IResourceModelListener;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationEditFormatter;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.utility.internal.BitTools;
+import org.eclipse.jpt.utility.internal.CommandExecutorProvider;
+
+public class JavaResourceModel extends AbstractResourceModel
+{
+ private final Collection<IResourceModelListener> resourceModelListeners;
+
+ private final JpaCompilationUnitResource compilationUnitResource;
+
+
+ public JavaResourceModel(
+ IFile file, IJpaAnnotationProvider annotationProvider,
+ CommandExecutorProvider modifySharedDocumentCommandExecutorProvider,
+ AnnotationEditFormatter annotationEditFormatter) {
+ super();
+ this.resourceModelListeners = new ArrayList<IResourceModelListener>();
+ this.compilationUnitResource =
+ new JpaCompilationUnitResource(file, annotationProvider, modifySharedDocumentCommandExecutorProvider, annotationEditFormatter, this);
+ }
+
+ public String getResourceType() {
+ return JAVA_RESOURCE_TYPE;
+ }
+
+ @Override
+ public JpaCompilationUnitResource resource() {
+ return this.compilationUnitResource;
+ }
+
+ public void addResourceModelChangeListener(IResourceModelListener listener) {
+ if (listener == null) {
+ throw new IllegalArgumentException("Listener cannot be null");
+ }
+ if (this.resourceModelListeners.contains(listener)) {
+ throw new IllegalArgumentException("Listener " + listener + " already added");
+ }
+ this.resourceModelListeners.add(listener);
+ }
+
+ public void removeResourceModelChangeListener(IResourceModelListener listener) {
+ if (!this.resourceModelListeners.contains(listener)) {
+ throw new IllegalArgumentException("Listener " + listener + " was never added");
+ }
+ this.resourceModelListeners.add(listener);
+ }
+
+ public void resourceChanged() {
+ if (resource() == null) {
+ throw new IllegalStateException("Change events should not be fired during construction");
+ }
+ for (IResourceModelListener listener : this.resourceModelListeners) {
+ listener.resourceModelChanged();
+ }
+ }
+
+ public void handleJavaElementChangedEvent(ElementChangedEvent event) {
+ synchWithJavaDelta(event.getDelta());
+ }
+
+ private void synchWithJavaDelta(IJavaElementDelta delta) {
+ switch (delta.getElement().getElementType()) {
+ case IJavaElement.JAVA_MODEL :
+ case IJavaElement.JAVA_PROJECT :
+ case IJavaElement.PACKAGE_FRAGMENT_ROOT :
+ case IJavaElement.PACKAGE_FRAGMENT :
+ this.synchChildrenWithJavaDelta(delta);
+ break;
+ case IJavaElement.COMPILATION_UNIT :
+ this.synchCompilationUnitWithJavaDelta(delta);
+ break;
+ default :
+ break; // the event is somehow lower than a compilation unit
+ }
+ }
+
+ private void synchChildrenWithJavaDelta(IJavaElementDelta delta) {
+ for (IJavaElementDelta child : delta.getAffectedChildren()) {
+ this.synchWithJavaDelta(child); // recurse
+ }
+ }
+
+ private void synchCompilationUnitWithJavaDelta(IJavaElementDelta delta) {
+ // ignore changes to/from primary working copy - no content has changed;
+ // and make sure there are no other flags set that indicate both a change to/from
+ // primary working copy AND content has changed
+ if (BitTools.onlyFlagIsSet(delta.getFlags(), IJavaElementDelta.F_PRIMARY_WORKING_COPY)) {
+ return;
+ }
+ if (delta.getElement().equals(this.compilationUnitResource.getCompilationUnit())) {
+ //TODO possibly hop on the UI thread here so that we know only 1 thread is changing our model
+ this.compilationUnitResource.updateFromJava(JDTTools.buildASTRoot(this.compilationUnitResource.getCompilationUnit()));
+ }
+ }
+
+ public void resolveTypes() {
+ this.compilationUnitResource.resolveTypes(JDTTools.buildASTRoot(this.compilationUnitResource.getCompilationUnit()));
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumn.java
new file mode 100644
index 0000000000..64ba213410
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumn.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public interface JoinColumn extends AbstractColumn
+{
+ String ANNOTATION_NAME = JPA.JOIN_COLUMN;
+
+ /**
+ * Corresponds to the referencedColumnName element of the javax.persistence.JoinColumn annotation.
+ * Returns null if the referencedColumnName valuePair does not exist in the annotation
+ */
+ String getReferencedColumnName();
+
+ /**
+ * Corresponds to the referencedColumnName element of the javax.persistence.JoinColumn annotation.
+ * Set to null to remove the referencedColumnName valuePait from the Annotation
+ */
+ void setReferencedColumnName(String referencedColumnName);
+ String REFERENCED_COLUMN_NAME_PROPERTY = "referencedColumnNameProperty";
+
+ /**
+ * Return the ITextRange for the referencedColumnName element. If the
+ * referencedColumnName element does not exist return the ITextRange
+ * for the JoinColumn annotation.
+ */
+ ITextRange referencedColumnNameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified postition touches the referencedColumnName element.
+ * Return false if the referencedColumnName element does not exist.
+ */
+ boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnImpl.java
new file mode 100644
index 0000000000..bdee9b6b8f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnImpl.java
@@ -0,0 +1,214 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class JoinColumnImpl extends AbstractColumnImpl implements NestableJoinColumn
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ // hold this so we can get the 'referenced column name' text range
+ private final DeclarationAnnotationElementAdapter<String> referencedColumnNameDeclarationAdapter;
+
+ private final AnnotationElementAdapter<String> referencedColumnNameAdapter;
+
+ private String referencedColumnName;
+
+ public JoinColumnImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.referencedColumnNameDeclarationAdapter = this.buildStringElementAdapter(JPA.JOIN_COLUMN__REFERENCED_COLUMN_NAME);
+ this.referencedColumnNameAdapter = this.buildShortCircuitElementAdapter(this.referencedColumnNameDeclarationAdapter);
+ }
+
+ public JoinColumnImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa) {
+ this(parent, member, daa, new MemberAnnotationAdapter(member, daa));
+ }
+
+ public JoinColumnImpl(JavaResource parent, Member member, IndexedDeclarationAnnotationAdapter idaa) {
+ this(parent, member, idaa, new MemberIndexedAnnotationAdapter(member, idaa));
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.referencedColumnName = this.referencedColumnName(astRoot);
+ }
+
+ @Override
+ protected String nameElementName() {
+ return JPA.JOIN_COLUMN__NAME;
+ }
+
+ @Override
+ protected String columnDefinitionElementName() {
+ return JPA.JOIN_COLUMN__COLUMN_DEFINITION;
+ }
+
+ @Override
+ protected String tableElementName() {
+ return JPA.JOIN_COLUMN__TABLE;
+ }
+
+ @Override
+ protected String uniqueElementName() {
+ return JPA.JOIN_COLUMN__UNIQUE;
+ }
+
+ @Override
+ protected String nullableElementName() {
+ return JPA.JOIN_COLUMN__NULLABLE;
+ }
+
+ @Override
+ protected String insertableElementName() {
+ return JPA.JOIN_COLUMN__INSERTABLE;
+ }
+
+ @Override
+ protected String updatableElementName() {
+ return JPA.JOIN_COLUMN__UPDATABLE;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ private IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
+ return (IndexedAnnotationAdapter) super.getAnnotationAdapter();
+ }
+
+ public void moveAnnotation(int newIndex) {
+ getIndexedAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+ @Override
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ super.initializeFrom(oldAnnotation);
+ JoinColumn oldColumn = (JoinColumn) oldAnnotation;
+ setReferencedColumnName(oldColumn.getReferencedColumnName());
+ }
+
+ //************ JoinColumn implementation ***************
+ public String getReferencedColumnName() {
+ return this.referencedColumnName;
+ }
+
+ public void setReferencedColumnName(String newReferencedColumnName) {
+ String oldReferencedColumnName = this.referencedColumnName;
+ this.referencedColumnName = newReferencedColumnName;
+ this.referencedColumnNameAdapter.setValue(newReferencedColumnName);
+ firePropertyChanged(REFERENCED_COLUMN_NAME_PROPERTY, oldReferencedColumnName, newReferencedColumnName);
+ }
+
+ public ITextRange referencedColumnNameTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.referencedColumnNameDeclarationAdapter, astRoot);
+ }
+
+ public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.referencedColumnNameDeclarationAdapter, pos, astRoot);
+ }
+
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.setReferencedColumnName(this.referencedColumnName(astRoot));
+ }
+
+ protected String referencedColumnName(CompilationUnit astRoot) {
+ return this.referencedColumnNameAdapter.getValue(astRoot);
+ }
+
+ // ********** static methods **********
+
+ static JoinColumnImpl createJoinColumn(JavaResource parent, Member member) {
+ return new JoinColumnImpl(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ static JoinColumnImpl createNestedJoinColumn(JavaResource parent, Member member, int index, DeclarationAnnotationAdapter joinColumnsAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, joinColumnsAdapter);
+ IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
+ return new JoinColumnImpl(parent, member, idaa, annotationAdapter);
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter joinColumnsAdapter) {
+ return new NestedIndexedDeclarationAnnotationAdapter(joinColumnsAdapter, index, JPA.JOIN_COLUMN);
+ }
+ static NestableJoinColumn createJoinTableJoinColumn(JavaResource parent, Member member, int index) {
+ return new JoinColumnImpl(parent, member, buildJoinTableAnnotationAdapter(index));
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildJoinTableAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(JoinTableImpl.DECLARATION_ANNOTATION_ADAPTER, JPA.JOIN_TABLE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
+ }
+
+ static NestableJoinColumn createJoinTableInverseJoinColumn(JavaResource parent, Member member, int index) {
+ return new JoinColumnImpl(parent, member, buildJoinTableInverseAnnotationAdapter(index));
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildJoinTableInverseAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(JoinTableImpl.DECLARATION_ANNOTATION_ADAPTER, JPA.JOIN_TABLE__INVERSE_JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
+ }
+
+
+ static NestableJoinColumn createAssociationOverrideJoinColumn(DeclarationAnnotationAdapter associationOverrideAdapter, JavaResource parent, Member member, int index) {
+ return new JoinColumnImpl(parent, member, buildAssociationOverrideAnnotationAdapter(associationOverrideAdapter, index));
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildAssociationOverrideAnnotationAdapter(DeclarationAnnotationAdapter associationOverrideAdapter, int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(associationOverrideAdapter, JPA.ASSOCIATION_OVERRIDE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
+ }
+
+
+ public static class JoinColumnAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final JoinColumnAnnotationDefinition INSTANCE = new JoinColumnAnnotationDefinition();
+
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private JoinColumnAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return JoinColumnImpl.createJoinColumn(parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlEmbeddedIdContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumns.java
index dc9e55f323..fe16741052 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlEmbeddedIdContext.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumns.java
@@ -7,15 +7,13 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.platform;
+package org.eclipse.jpt.core.internal.resource.java;
-import org.eclipse.jpt.core.internal.content.orm.XmlEmbeddedId;
-public class XmlEmbeddedIdContext
- extends XmlAttributeContext
+public interface JoinColumns extends ContainerAnnotation<NestableJoinColumn>
{
- public XmlEmbeddedIdContext(IContext parentContext, XmlEmbeddedId mapping) {
- super(parentContext, mapping);
- }
+ String ANNOTATION_NAME = JPA.JOIN_COLUMNS;
+
+ String JOIN_COLUMNS_LIST = "joinColumnsList";
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnsImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnsImpl.java
new file mode 100644
index 0000000000..f01f263fd0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnsImpl.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+public class JoinColumnsImpl extends AbstractAnnotationResource<Member> implements JoinColumns
+{
+
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private List<NestableJoinColumn> joinColumns;
+
+ protected JoinColumnsImpl(JavaResource parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ this.joinColumns = new ArrayList<NestableJoinColumn>();
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ ContainerAnnotationTools.initializeNestedAnnotations(astRoot, this);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public String getNestableAnnotationName() {
+ return JoinColumn.ANNOTATION_NAME;
+ }
+
+ public ListIterator<NestableJoinColumn> nestedAnnotations() {
+ return new CloneListIterator<NestableJoinColumn>(this.joinColumns);
+ }
+
+ public int nestedAnnotationsSize() {
+ return this.joinColumns.size();
+ }
+
+ public NestableJoinColumn addInternal(int index) {
+ JoinColumnImpl joinColumn = createJoinColumn(index);
+ this.joinColumns.add(index, joinColumn);
+ return joinColumn;
+ }
+
+ public NestableJoinColumn add(int index) {
+ JoinColumnImpl joinColumn = createJoinColumn(index);
+ add(index, joinColumn);
+ return joinColumn;
+ }
+
+ protected void add(int index, NestableJoinColumn joinColumn) {
+ addItemToList(index, joinColumn, this.joinColumns, JOIN_COLUMNS_LIST);
+ }
+
+ public void remove(NestableJoinColumn joinColumn) {
+ removeItemFromList(joinColumn, this.joinColumns, JOIN_COLUMNS_LIST);
+ }
+
+ public void remove(int index) {
+ removeItemFromList(index, this.joinColumns, JOIN_COLUMNS_LIST);
+ }
+
+ public int indexOf(NestableJoinColumn joinColumn) {
+ return this.joinColumns.indexOf(joinColumn);
+ }
+
+ public NestableJoinColumn nestedAnnotationAt(int index) {
+ return this.joinColumns.get(index);
+ }
+
+ public NestableJoinColumn nestedAnnotationFor(Annotation jdtAnnotation) {
+ for (NestableJoinColumn joinColumn : this.joinColumns) {
+ if (jdtAnnotation == joinColumn.jdtAnnotation((CompilationUnit) jdtAnnotation.getRoot())) {
+ return joinColumn;
+ }
+ }
+ return null;
+ }
+
+ public void move(int targetIndex, int sourceIndex) {
+ moveItemInList(targetIndex, sourceIndex, this.joinColumns, JOIN_COLUMNS_LIST);
+ }
+
+ public void moveInternal(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.joinColumns, targetIndex, sourceIndex);
+ }
+
+ public String getElementName() {
+ return "value";
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this);
+ }
+
+ private JoinColumnImpl createJoinColumn(int index) {
+ return JoinColumnImpl.createNestedJoinColumn(this, getMember(), index, getDeclarationAnnotationAdapter());
+ }
+
+
+ public static class JoinColumnsAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final JoinColumnsAnnotationDefinition INSTANCE = new JoinColumnsAnnotationDefinition();
+
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private JoinColumnsAnnotationDefinition() {
+ super();
+ }
+
+ public JoinColumns buildAnnotation(JavaResource parent, Member member) {
+ return new JoinColumnsImpl(parent, member);
+ }
+
+ public JoinColumns buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTable.java
new file mode 100644
index 0000000000..2b0e2eecb2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTable.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ListIterator;
+
+public interface JoinTable extends Table
+{
+ String ANNOTATION_NAME = JPA.JOIN_TABLE;
+
+ ListIterator<JoinColumn> joinColumns();
+
+ JoinColumn joinColumnAt(int index);
+
+ int indexOfJoinColumn(JoinColumn joinColumn);
+
+ int joinColumnsSize();
+
+ JoinColumn addJoinColumn(int index);
+
+ void removeJoinColumn(int index);
+
+ void moveJoinColumn(int targetIndex, int sourceIndex);
+ String JOIN_COLUMNS_LIST = "joinColumnsList";
+
+ ListIterator<JoinColumn> inverseJoinColumns();
+
+ JoinColumn inverseJoinColumnAt(int index);
+
+ int indexOfInverseJoinColumn(JoinColumn joinColumn);
+
+ int inverseJoinColumnsSize();
+
+ JoinColumn addInverseJoinColumn(int index);
+
+ void removeInverseJoinColumn(int index);
+
+ void moveInverseJoinColumn(int targetIndex, int sourceIndex);
+ String INVERSE_JOIN_COLUMNS_LIST = "inverseJoinColumnsList";
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTableImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTableImpl.java
new file mode 100644
index 0000000000..dd9468153b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTableImpl.java
@@ -0,0 +1,379 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+public class JoinTableImpl extends AbstractTableResource implements JoinTable
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JoinTable.ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.JOIN_TABLE__NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> SCHEMA_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.JOIN_TABLE__SCHEMA);
+
+ private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.JOIN_TABLE__CATALOG);
+
+ private final List<NestableJoinColumn> joinColumns;
+
+ private final List<NestableJoinColumn> inverseJoinColumns;
+
+ private final JoinColumnsContainerAnnotation joinColumnsContainerAnnotation;
+
+ private final InverseJoinColumnsContainerAnnotation inverseJoinColumnsContainerAnnotation;
+
+ protected JoinTableImpl(JavaResource parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
+ this.joinColumns = new ArrayList<NestableJoinColumn>();
+ this.inverseJoinColumns = new ArrayList<NestableJoinColumn>();
+ this.joinColumnsContainerAnnotation = new JoinColumnsContainerAnnotation();
+ this.inverseJoinColumnsContainerAnnotation = new InverseJoinColumnsContainerAnnotation();
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ ContainerAnnotationTools.initializeNestedAnnotations(astRoot, this.joinColumnsContainerAnnotation);
+ ContainerAnnotationTools.initializeNestedAnnotations(astRoot, this.inverseJoinColumnsContainerAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return JoinTable.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> nameAdapter(@SuppressWarnings("unused") DeclarationAnnotationAdapter declarationAnnotationAdapter) {
+ // ignore the daa passed in, @JoinTable is never nested
+ return NAME_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> schemaAdapter(@SuppressWarnings("unused") DeclarationAnnotationAdapter declarationAnnotationAdapter) {
+ // ignore the daa passed in, @JoinTable is never nested
+ return SCHEMA_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> catalogAdapter(@SuppressWarnings("unused") DeclarationAnnotationAdapter declarationAnnotationAdapter) {
+ // ignore the daa passed in, @JoinTable is never nested
+ return CATALOG_ADAPTER;
+ }
+
+ @Override
+ protected NestableUniqueConstraint createUniqueConstraint(int index) {
+ return UniqueConstraintImpl.createJoinTableUniqueConstraint(this, this.getMember(), index);
+ }
+
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.updateJoinColumnsFromJava(astRoot);
+ this.updateInverseJoinColumnsFromJava(astRoot);
+ }
+
+ private void updateJoinColumnsFromJava(CompilationUnit astRoot) {
+ ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this.joinColumnsContainerAnnotation);
+ }
+
+ private void updateInverseJoinColumnsFromJava(CompilationUnit astRoot) {
+ ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this.inverseJoinColumnsContainerAnnotation);
+ }
+
+ public ListIterator<JoinColumn> joinColumns() {
+ return new CloneListIterator<JoinColumn>(this.joinColumns);
+ }
+
+ public int joinColumnsSize() {
+ return this.joinColumns.size();
+ }
+
+ public NestableJoinColumn joinColumnAt(int index) {
+ return this.joinColumns.get(index);
+ }
+
+ public int indexOfJoinColumn(JoinColumn joinColumn) {
+ return this.joinColumns.indexOf(joinColumn);
+ }
+
+ public JoinColumn addJoinColumn(int index) {
+ NestableJoinColumn joinColumn = (NestableJoinColumn) ContainerAnnotationTools.addNestedAnnotation(index, this.joinColumnsContainerAnnotation);
+ fireItemAdded(JoinTable.JOIN_COLUMNS_LIST, index, joinColumn);
+ return joinColumn;
+ }
+
+ protected void addJoinColumn(int index, NestableJoinColumn joinColumn) {
+ addItemToList(index, joinColumn, this.joinColumns, JOIN_COLUMNS_LIST);
+ }
+
+ public void removeJoinColumn(int index) {
+ NestableJoinColumn joinColumn = this.joinColumns.get(index);
+ removeJoinColumn(joinColumn);
+ joinColumn.removeAnnotation();
+ ContainerAnnotationTools.synchAnnotationsAfterRemove(index, this.joinColumnsContainerAnnotation);
+ }
+
+ protected void removeJoinColumn(NestableJoinColumn joinColumn) {
+ removeItemFromList(joinColumn, this.joinColumns, JOIN_COLUMNS_LIST);
+ }
+
+ public void moveJoinColumn(int targetIndex, int sourceIndex) {
+ moveJoinColumnInternal(targetIndex, sourceIndex);
+ ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, this.joinColumnsContainerAnnotation);
+ fireItemMoved(JoinTable.JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
+ }
+
+ protected void moveJoinColumnInternal(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.joinColumns, targetIndex, sourceIndex);
+ }
+
+ public ListIterator<JoinColumn> inverseJoinColumns() {
+ return new CloneListIterator<JoinColumn>(this.inverseJoinColumns);
+ }
+
+ public int inverseJoinColumnsSize() {
+ return this.inverseJoinColumns.size();
+ }
+
+ public NestableJoinColumn inverseJoinColumnAt(int index) {
+ return this.inverseJoinColumns.get(index);
+ }
+
+ public int indexOfInverseJoinColumn(JoinColumn joinColumn) {
+ return this.inverseJoinColumns.indexOf(joinColumn);
+ }
+
+ public JoinColumn addInverseJoinColumn(int index) {
+ NestableJoinColumn inverseJoinColumn = (NestableJoinColumn) ContainerAnnotationTools.addNestedAnnotation(index, this.inverseJoinColumnsContainerAnnotation);
+ fireItemAdded(JoinTable.INVERSE_JOIN_COLUMNS_LIST, index, inverseJoinColumn);
+ return inverseJoinColumn;
+ }
+
+ private void addInverseJoinColumn(int index, NestableJoinColumn joinColumn) {
+ addItemToList(index, joinColumn, this.inverseJoinColumns, INVERSE_JOIN_COLUMNS_LIST);
+ }
+
+ public void removeInverseJoinColumn(int index) {
+ NestableJoinColumn joinColumn = this.inverseJoinColumns.get(index);
+ this.removeInverseJoinColumn(joinColumn);
+ joinColumn.removeAnnotation();
+ ContainerAnnotationTools.synchAnnotationsAfterRemove(index, this.inverseJoinColumnsContainerAnnotation);
+ }
+
+ protected void removeInverseJoinColumn(NestableJoinColumn joinColumn) {
+ removeItemFromList(joinColumn, this.inverseJoinColumns, INVERSE_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveInverseJoinColumn(int targetIndex, int sourceIndex) {
+ moveInverseJoinColumnInternal(targetIndex, sourceIndex);
+ ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, this.inverseJoinColumnsContainerAnnotation);
+ fireItemMoved(JoinTable.INVERSE_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
+ }
+
+ protected void moveInverseJoinColumnInternal(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.inverseJoinColumns, targetIndex, sourceIndex);
+ }
+
+ protected NestableJoinColumn createJoinColumn(int index) {
+ return JoinColumnImpl.createJoinTableJoinColumn(this, getMember(), index);
+ }
+
+ protected NestableJoinColumn createInverseJoinColumn(int index) {
+ return JoinColumnImpl.createJoinTableInverseJoinColumn(this, getMember(), index);
+ }
+
+ private class JoinColumnsContainerAnnotation extends AbstractContainerAnnotation {
+
+ public NestableJoinColumn addInternal(int index) {
+ NestableJoinColumn joinColumn = JoinTableImpl.this.createJoinColumn(index);
+ JoinTableImpl.this.joinColumns.add(index, joinColumn);
+ return joinColumn;
+ }
+
+ public NestableJoinColumn add(int index) {
+ NestableJoinColumn joinColumn = JoinTableImpl.this.createJoinColumn(index);
+ JoinTableImpl.this.addJoinColumn(index, joinColumn);
+ return joinColumn;
+ }
+
+ public int indexOf(NestableJoinColumn joinColumn) {
+ return JoinTableImpl.this.indexOfJoinColumn(joinColumn);
+ }
+
+ public void move(int targetIndex, int sourceIndex) {
+ JoinTableImpl.this.moveJoinColumn(targetIndex, sourceIndex);
+ }
+
+ public void moveInternal(int targetIndex, int sourceIndex) {
+ JoinTableImpl.this.moveJoinColumnInternal(targetIndex, sourceIndex);
+ }
+
+ public NestableJoinColumn nestedAnnotationAt(int index) {
+ return JoinTableImpl.this.joinColumnAt(index);
+ }
+
+ public ListIterator<NestableJoinColumn> nestedAnnotations() {
+ return new CloneListIterator<NestableJoinColumn>(JoinTableImpl.this.joinColumns);
+ }
+
+ public int nestedAnnotationsSize() {
+ return joinColumnsSize();
+ }
+
+ public void remove(NestableJoinColumn nestedAnnotation) {
+ JoinTableImpl.this.removeJoinColumn(nestedAnnotation);
+ }
+ public String getElementName() {
+ return "joinColumns";
+ }
+ }
+
+ private class InverseJoinColumnsContainerAnnotation extends AbstractContainerAnnotation {
+
+ public NestableJoinColumn addInternal(int index) {
+ NestableJoinColumn joinColumn = JoinTableImpl.this.createInverseJoinColumn(index);
+ JoinTableImpl.this.inverseJoinColumns.add(index, joinColumn);
+ return joinColumn;
+ }
+
+ public NestableJoinColumn add(int index) {
+ NestableJoinColumn joinColumn = JoinTableImpl.this.createInverseJoinColumn(index);
+ JoinTableImpl.this.addInverseJoinColumn(index, joinColumn);
+ return joinColumn;
+ }
+
+ public int indexOf(NestableJoinColumn joinColumn) {
+ return JoinTableImpl.this.indexOfInverseJoinColumn(joinColumn);
+ }
+
+ public void move(int targetIndex, int sourceIndex) {
+ JoinTableImpl.this.moveInverseJoinColumn(targetIndex, sourceIndex);
+ }
+
+ public void moveInternal(int targetIndex, int sourceIndex) {
+ JoinTableImpl.this.moveInverseJoinColumnInternal(targetIndex, sourceIndex);
+ }
+
+ public NestableJoinColumn nestedAnnotationAt(int index) {
+ return JoinTableImpl.this.inverseJoinColumnAt(index);
+ }
+
+ public ListIterator<NestableJoinColumn> nestedAnnotations() {
+ return new CloneListIterator<NestableJoinColumn>(JoinTableImpl.this.inverseJoinColumns);
+ }
+
+ public int nestedAnnotationsSize() {
+ return inverseJoinColumnsSize();
+ }
+
+ public void remove(NestableJoinColumn nestedAnnotation) {
+ JoinTableImpl.this.removeInverseJoinColumn(nestedAnnotation);
+ }
+
+ public String getElementName() {
+ return "inverseJoinColumns";
+ }
+ }
+
+ private abstract class AbstractContainerAnnotation extends AbstractResource implements ContainerAnnotation<NestableJoinColumn> {
+
+ public AbstractContainerAnnotation() {
+ super(JoinTableImpl.this);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //nothing to initialize
+ }
+
+ public String getAnnotationName() {
+ return JoinTableImpl.this.getAnnotationName();
+ }
+
+ public String getNestableAnnotationName() {
+ return JPA.JOIN_COLUMN;
+ }
+
+ public void remove(int index) {
+ this.remove(nestedAnnotationAt(index));
+ }
+
+ public NestableJoinColumn nestedAnnotationFor(org.eclipse.jdt.core.dom.Annotation jdtAnnotation) {
+ for (NestableJoinColumn joinColumn : CollectionTools.iterable(nestedAnnotations())) {
+ if (jdtAnnotation == joinColumn.jdtAnnotation((CompilationUnit) jdtAnnotation.getRoot())) {
+ return joinColumn;
+ }
+ }
+ return null;
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation jdtAnnotation(CompilationUnit astRoot) {
+ return JoinTableImpl.this.jdtAnnotation(astRoot);
+ }
+
+ public void newAnnotation() {
+ JoinTableImpl.this.newAnnotation();
+ }
+
+ public void removeAnnotation() {
+ JoinTableImpl.this.removeAnnotation();
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ JoinTableImpl.this.updateFromJava(astRoot);
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return JoinTableImpl.this.textRange(astRoot);
+ }
+ }
+ public static class JoinTableAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final JoinTableAnnotationDefinition INSTANCE = new JoinTableAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private JoinTableAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new JoinTableImpl(parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return new NullJoinTable(parent);
+ }
+
+ public String getAnnotationName() {
+ return JoinTable.ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JpaCompilationUnitResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JpaCompilationUnitResource.java
new file mode 100644
index 0000000000..522ffe59ea
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JpaCompilationUnitResource.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.IJpaAnnotationProvider;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationEditFormatter;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.utility.internal.CommandExecutorProvider;
+import org.eclipse.jpt.utility.internal.node.Node;
+
+public class JpaCompilationUnitResource extends AbstractResource implements JavaResource
+{
+ protected final IJpaAnnotationProvider annotationProvider;
+
+ protected final CommandExecutorProvider modifySharedDocumentCommandExecutorProvider;
+
+ protected final AnnotationEditFormatter annotationEditFormatter;
+
+ protected final ICompilationUnit compilationUnit;
+
+ /**
+ * The primary type of the CompilationUnit. Not going to handle
+ * multiple Types defined in a compilation unit. Entities must have
+ * a public/protected no-arg constructor and there is no way to access
+ * it in a non-public/protected class.
+ */
+ protected JavaPersistentTypeResource persistentType;
+ public static final String PERSISTENT_TYPE_PROPERTY = "persistentTypeProperty";
+
+ protected final JavaResourceModel javaResourceModel;
+
+ public JpaCompilationUnitResource(
+ IFile file,
+ IJpaAnnotationProvider annotationProvider,
+ CommandExecutorProvider modifySharedDocumentCommandExecutorProvider,
+ AnnotationEditFormatter annotationEditFormatter,
+ JavaResourceModel javaResourceModel) {
+ // The jpa compilation unit is the root of its sub-tree
+ super(null);
+ this.annotationProvider = annotationProvider;
+ this.modifySharedDocumentCommandExecutorProvider = modifySharedDocumentCommandExecutorProvider;
+ this.annotationEditFormatter = annotationEditFormatter;
+ this.javaResourceModel = javaResourceModel;
+ this.compilationUnit = compilationUnitFrom(file);
+ this.initialize(JDTTools.buildASTRoot(this.compilationUnit));
+ }
+
+ protected ICompilationUnit compilationUnitFrom(IFile file) {
+ ICompilationUnit compilationUnit = JavaCore.createCompilationUnitFrom(file);
+ try {
+ compilationUnit.open(null);
+ }
+ catch (JavaModelException jme) {
+ // do nothing - we just won't have a primary type in this case
+ }
+ return compilationUnit;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ IType iType = this.compilationUnit.findPrimaryType();
+ if (iType != null) {
+ this.persistentType = createJavaPersistentType(iType, astRoot);
+ }
+ }
+
+ // **************** overrides **********************************************
+
+
+ @Override
+ public Validator validator() {
+ return Node.NULL_VALIDATOR;
+ }
+
+ @Override
+ protected void checkParent(Node parentNode) {
+ if (parentNode != null) {
+ throw new IllegalArgumentException("The parent node must be null");
+ }
+ }
+
+ @Override
+ public IJpaAnnotationProvider annotationProvider() {
+ return this.annotationProvider;
+ }
+
+ @Override
+ public CommandExecutorProvider modifySharedDocumentCommandExecutorProvider() {
+ return this.modifySharedDocumentCommandExecutorProvider;
+ }
+
+ @Override
+ public AnnotationEditFormatter annotationEditFormatter() {
+ return this.annotationEditFormatter;
+ }
+
+ @Override
+ public JavaResourceModel resourceModel() {
+ return javaResourceModel;
+ }
+
+
+ // *************************************************************************
+
+ public ICompilationUnit getCompilationUnit() {
+ return this.compilationUnit;
+ }
+
+ public JavaPersistentTypeResource javaPersistentTypeResource(String fullyQualifiedTypeName) {
+ return getPersistentType().javaPersistentTypeResource(fullyQualifiedTypeName);
+ }
+
+ /**
+ * The persistentType resource for the compilation unit's primary type.
+ * Will be null if the primary type is null.
+ */
+ public JavaPersistentTypeResource getPersistentType() {
+ return this.persistentType;
+ //TODO should i only be returning this if it returns true to isPersistable?
+ //that's how we handle nestedTypes on JavaPersistentTypeResource
+
+// if (this.persistentType.isPersistable()) {
+// return this.persistentType;
+// }
+// return null;
+ }
+
+ protected void setPersistentType(JavaPersistentTypeResource newPersistentType) {
+ JavaPersistentTypeResource oldPersistentType = this.persistentType;
+ this.persistentType = newPersistentType;
+ firePropertyChanged(PERSISTENT_TYPE_PROPERTY, oldPersistentType, newPersistentType);
+ }
+
+ private JavaPersistentTypeResource createJavaPersistentType(IType iType, CompilationUnit astRoot) {
+ return
+ JavaPersistentTypeResourceImpl.createJavaPersistentType(this,
+ iType,
+ modifySharedDocumentCommandExecutorProvider(),
+ annotationEditFormatter(),
+ astRoot);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ IType iType = this.compilationUnit.findPrimaryType();
+ if (iType == null) {
+ setPersistentType(null);
+ }
+ else {
+ if (getPersistentType() == null) {
+ setPersistentType(createJavaPersistentType(iType, astRoot));
+ }
+ else {
+ getPersistentType().updateFromJava(astRoot);
+ }
+ }
+ }
+
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return null;//this.selectionTextRange();
+ }
+
+// /**
+// * Return null for selection textRange. Entire java file will appear selected when
+// * switching files otherwise
+// */
+// public ITextRange selectionTextRange() {
+// return null;
+// }
+
+ public void resourceChanged() {
+ this.javaResourceModel.resourceChanged();
+ }
+
+ @Override
+ public void resolveTypes(CompilationUnit astRoot) {
+ if (getPersistentType() != null) {
+ getPersistentType().resolveTypes(astRoot);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Lob.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Lob.java
new file mode 100644
index 0000000000..8000242ad4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Lob.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+/**
+ * Corresponds to the javax.persistence.Lob annotation
+ */
+public interface Lob extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.LOB;
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/LobImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/LobImpl.java
new file mode 100644
index 0000000000..190a0e202c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/LobImpl.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class LobImpl extends AbstractAnnotationResource<Attribute> implements Lob
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ protected LobImpl(JavaResource parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //nothing to initialize
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ //nothing to update
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ public static class LobAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final LobAnnotationDefinition INSTANCE = new LobAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private LobAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new LobImpl(parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToMany.java
new file mode 100644
index 0000000000..db1281ce13
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToMany.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public interface ManyToMany extends RelationshipMapping
+{
+ String ANNOTATION_NAME = JPA.MANY_TO_MANY;
+
+ /**
+ * Corresponds to the mappedBy element of the ManyToMany annotation.
+ * Returns null if the mappedBy element does not exist in java.
+ */
+ String getMappedBy();
+
+ /**
+ * Corresponds to the mappedBy element of the ManyToMany annotation.
+ * Set to null to remove the mappedBy element.
+ */
+ void setMappedBy(String mappedBy);
+ String MAPPED_BY_PROPERTY = "mappedByProperty";
+
+ /**
+ * Return the ITextRange for the mappedBy element. If the mappedBy element
+ * does not exist return the ITextRange for the ManyToMany annotation.
+ */
+ ITextRange mappedByTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified postition touches the mappedBy element.
+ * Return false if the mappedBy element does not exist.
+ */
+ boolean mappedByTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToManyImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToManyImpl.java
new file mode 100644
index 0000000000..435764caff
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToManyImpl.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+
+public class ManyToManyImpl extends AbstractRelationshipMappingAnnotation implements ManyToMany
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> TARGET_ENTITY_ADAPTER = buildTargetEntityAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String[]> CASCADE_ADAPTER = buildCascadeAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String> MAPPED_BY_ADAPTER = buildMappedByAdapter();
+
+ private final AnnotationElementAdapter<String> mappedByAdapter;
+
+ private String mappedBy;
+
+ protected ManyToManyImpl(JavaPersistentAttributeResource parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.mappedByAdapter = buildAnnotationElementAdapter(MAPPED_BY_ADAPTER);
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.mappedBy = this.mappedBy(astRoot);
+ }
+
+ //**************** AbstractRelationshipMappingAnnotation implementation **************
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> targetEntityAdapter() {
+ return TARGET_ENTITY_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String[]> cascadeAdapter() {
+ return CASCADE_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> fetchAdapter() {
+ return FETCH_ADAPTER;
+ }
+
+
+ //**************** Annotation implementation **************
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ public String getMappedBy() {
+ return this.mappedBy;
+ }
+
+ public void setMappedBy(String newMappedBy) {
+ String oldMappedBy = this.mappedBy;
+ this.mappedBy = newMappedBy;
+ this.mappedByAdapter.setValue(newMappedBy);
+ firePropertyChanged(MAPPED_BY_PROPERTY, oldMappedBy, newMappedBy);
+ }
+
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.setMappedBy(this.mappedBy(astRoot));
+ }
+
+ protected String mappedBy(CompilationUnit astRoot) {
+ return this.mappedByAdapter.getValue(astRoot);
+ }
+
+ public ITextRange mappedByTextRange(CompilationUnit astRoot) {
+ return elementTextRange(MAPPED_BY_ADAPTER, astRoot);
+ }
+
+ public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(MAPPED_BY_ADAPTER, pos, astRoot);
+ }
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildTargetEntityAdapter() {
+ return buildTargetEntityAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__TARGET_ENTITY);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String[]> buildCascadeAdapter() {
+ return buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__CASCADE);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
+ return buildFetchAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__FETCH);
+ }
+
+
+ private static DeclarationAnnotationElementAdapter<String> buildMappedByAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__MAPPED_BY, false); // false = do not remove annotation when empty
+ }
+
+
+ public static class ManyToManyAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final ManyToManyAnnotationDefinition INSTANCE = new ManyToManyAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static ManyToManyAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private ManyToManyAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new ManyToManyImpl((JavaPersistentAttributeResource) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOne.java
new file mode 100644
index 0000000000..8da89e934b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOne.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public interface ManyToOne extends RelationshipMapping
+{
+ String ANNOTATION_NAME = JPA.MANY_TO_ONE;
+
+ /**
+ * Corresponds to the optional element of the ManyToOne annotation.
+ * Returns null if the optional element does not exist in java.
+ */
+ Boolean getOptional();
+
+ /**
+ * Corresponds to the optional element of the ManyToOne annotation.
+ * Set to null to remove the optional element.
+ */
+ void setOptional(Boolean optional);
+ String OPTIONAL_PROPERTY = "optionalProperty";
+
+ /**
+ * Return the ITextRange for the optional element. If the optional element
+ * does not exist return the ITextRange for the ManyToOne annotation.
+ */
+ ITextRange optionalTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOneImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOneImpl.java
new file mode 100644
index 0000000000..a3840aff88
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOneImpl.java
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.BooleanExpressionConverter;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+
+public class ManyToOneImpl extends AbstractRelationshipMappingAnnotation implements ManyToOne
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> TARGET_ENTITY_ADAPTER = buildTargetEntityAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String[]> CASCADE_ADAPTER = buildCascadeAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<Boolean> OPTIONAL_ADAPTER = buildOptionalAdapter();
+
+ private final AnnotationElementAdapter<Boolean> optionalAdapter;
+
+ private Boolean optional;
+
+ protected ManyToOneImpl(JavaPersistentAttributeResource parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.optionalAdapter = this.buildBooleanAnnotationElementAdapter(OPTIONAL_ADAPTER);
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.optional = this.optional(astRoot);
+ }
+
+ //**************** AbstractRelationshipMappingAnnotation implementation **************
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> targetEntityAdapter() {
+ return TARGET_ENTITY_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String[]> cascadeAdapter() {
+ return CASCADE_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> fetchAdapter() {
+ return FETCH_ADAPTER;
+ }
+
+ //**************** Annotation implementation **************
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ public Boolean getOptional() {
+ return this.optional;
+ }
+
+ public void setOptional(Boolean newOptional) {
+ Boolean oldOptional = this.optional;
+ this.optional = newOptional;
+ this.optionalAdapter.setValue(newOptional);
+ firePropertyChanged(OPTIONAL_PROPERTY, oldOptional, newOptional);
+ }
+
+ public ITextRange optionalTextRange(CompilationUnit astRoot) {
+ return elementTextRange(OPTIONAL_ADAPTER, astRoot);
+ }
+
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.setOptional(this.optional(astRoot));
+ }
+
+ protected Boolean optional(CompilationUnit astRoot) {
+ return this.optionalAdapter.getValue(astRoot);
+ }
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildTargetEntityAdapter() {
+ return buildTargetEntityAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_ONE__TARGET_ENTITY);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String[]> buildCascadeAdapter() {
+ return buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_ONE__CASCADE);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
+ return buildFetchAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_ONE__FETCH);
+ }
+
+ private static DeclarationAnnotationElementAdapter<Boolean> buildOptionalAdapter() {
+ return buildOptionalAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_ONE__OPTIONAL);
+ }
+
+ private static DeclarationAnnotationElementAdapter<Boolean> buildOptionalAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return new ConversionDeclarationAnnotationElementAdapter<Boolean>(annotationAdapter, elementName, false, BooleanExpressionConverter.instance());
+ }
+
+
+ public static class ManyToOneAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final ManyToOneAnnotationDefinition INSTANCE = new ManyToOneAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static ManyToOneAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private ManyToOneAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new ManyToOneImpl((JavaPersistentAttributeResource) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKey.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKey.java
new file mode 100644
index 0000000000..6b3ef7cfb7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKey.java
@@ -0,0 +1,28 @@
+package org.eclipse.jpt.core.internal.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+/**
+ * Corresponds to the javax.persistence.MapKey annotation
+ */
+public interface MapKey extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.MAP_KEY;
+
+ String getName();
+ void setName(String name);
+ String NAME_PROPERTY = "nameProperty";
+
+ /**
+ * Return the ITextRange for the name element. If the name element
+ * does not exist return the ITextRange for the MapKey annotation.
+ */
+ ITextRange nameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified postition touches the name element.
+ * Return false if the name element does not exist.
+ */
+ public boolean nameTouches(int pos, CompilationUnit astRoot);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKeyImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKeyImpl.java
new file mode 100644
index 0000000000..c5fd357ade
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKeyImpl.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class MapKeyImpl extends AbstractAnnotationResource<Attribute> implements MapKey
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildNameAdapter();
+
+
+ private final AnnotationElementAdapter<String> nameAdapter;
+
+ private String name;
+
+ protected MapKeyImpl(JavaResource parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, NAME_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = name(astRoot);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.nameAdapter.setValue(newName);
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public ITextRange nameTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(NAME_ADAPTER, astRoot);
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(NAME_ADAPTER, pos, astRoot);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setName(this.name(astRoot));
+ }
+
+ protected String name(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ // ********** static methods **********
+ private static DeclarationAnnotationElementAdapter<String> buildNameAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.MAP_KEY__NAME, false);
+ }
+
+
+ public static class MapKeyAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final MapKeyAnnotationDefinition INSTANCE = new MapKeyAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private MapKeyAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new MapKeyImpl(parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclass.java
new file mode 100644
index 0000000000..c2176c5141
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclass.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public interface MappedSuperclass extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.MAPPED_SUPERCLASS;
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclassImpl.java
new file mode 100644
index 0000000000..e46f14a12e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclassImpl.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Type;
+
+
+public class MappedSuperclassImpl extends AbstractAnnotationResource<Type> implements MappedSuperclass
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ protected MappedSuperclassImpl(JavaPersistentTypeResource parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //nothing to initialize
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ //no annotation members
+ }
+
+ public static class MappedSuperclassAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final MappedSuperclassAnnotationDefinition INSTANCE = new MappedSuperclassAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static MappedSuperclassAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private MappedSuperclassAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new MappedSuperclassImpl((JavaPersistentTypeResource) parent, (Type) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedColumn.java
new file mode 100644
index 0000000000..2b74348f53
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedColumn.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public interface NamedColumn extends JavaResource
+{
+ /**
+ * Corresponds to the name element of the *Column annotation.
+ * Returns null if the name valuePair does not exist in the annotation
+ */
+ String getName();
+
+ /**
+ * Corresponds to the name element of the *Column annotation.
+ * Set to null to remove the name valuePair from the annotation
+ */
+ void setName(String name);
+ String NAME_PROPERTY = "nameProperty";
+
+ /**
+ * Corresponds to the columnDefinition element of the *Column annotation.
+ * Returns null if the columnDefinition valuePair does not exist in the annotation
+ */
+ String getColumnDefinition();
+
+ /**
+ * Corresponds to the columnDefinition element of the *Column annotation.
+ * Set to null to remove the columnDefinition valuePair from the annotation
+ */
+ void setColumnDefinition(String columnDefinition);
+ String COLUMN_DEFINITION_PROPERTY = "columnDefinitionPropety";
+
+ /**
+ * Return the ITextRange for the name element. If the name element
+ * does not exist return the ITextRange for the *Column annotation.
+ */
+ ITextRange nameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the columnDefinition element. If the columnDefinition
+ * element does not exist return the ITextRange for the *Column annotation.
+ */
+ ITextRange columnDefinitionTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified postition touches the name element.
+ * Return false if the name element does not exist.
+ */
+ boolean nameTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueries.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueries.java
new file mode 100644
index 0000000000..6c5411798d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueries.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public interface NamedNativeQueries extends ContainerAnnotation<NestableNamedNativeQuery>
+{
+ String ANNOTATION_NAME = JPA.NAMED_NATIVE_QUERIES;
+
+ String NAMED_NATIVE_QUERIES_LIST = "namedNativeQueriesList";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueriesImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueriesImpl.java
new file mode 100644
index 0000000000..f7de36f461
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueriesImpl.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Type;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+public class NamedNativeQueriesImpl extends AbstractAnnotationResource<Type> implements NamedNativeQueries
+{
+
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private List<NestableNamedNativeQuery> namedNativeQueries;
+
+ protected NamedNativeQueriesImpl(JavaResource parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.namedNativeQueries = new ArrayList<NestableNamedNativeQuery>();
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ ContainerAnnotationTools.initializeNestedAnnotations(astRoot, this);
+ }
+
+ public String getAnnotationName() {
+ return NamedNativeQueries.ANNOTATION_NAME;
+ }
+
+ public String getNestableAnnotationName() {
+ return NamedNativeQuery.ANNOTATION_NAME;
+ }
+
+ public String getElementName() {
+ return "value";
+ }
+
+ public ListIterator<NestableNamedNativeQuery> nestedAnnotations() {
+ return new CloneListIterator<NestableNamedNativeQuery>(this.namedNativeQueries);
+ }
+
+ public int nestedAnnotationsSize() {
+ return this.namedNativeQueries.size();
+ }
+
+ public NestableNamedNativeQuery addInternal(int index) {
+ NestableNamedNativeQuery namedNativeQuery = createNamedNativeQuery(index);
+ this.namedNativeQueries.add(index, namedNativeQuery);
+ return namedNativeQuery;
+ }
+
+ public NestableNamedNativeQuery add(int index) {
+ NestableNamedNativeQuery namedNativeQuery = createNamedNativeQuery(index);
+ add(index, namedNativeQuery);
+ return namedNativeQuery;
+ }
+
+ protected void add(int index, NestableNamedNativeQuery query) {
+ addItemToList(index, query, this.namedNativeQueries, NamedNativeQueries.NAMED_NATIVE_QUERIES_LIST);
+ }
+
+ public void remove(NestableNamedNativeQuery query) {
+ removeItemFromList(query, this.namedNativeQueries, NamedNativeQueries.NAMED_NATIVE_QUERIES_LIST);
+ }
+
+ public void remove(int index) {
+ removeItemFromList(index, this.namedNativeQueries, NamedNativeQueries.NAMED_NATIVE_QUERIES_LIST);
+ }
+
+ public int indexOf(NestableNamedNativeQuery query) {
+ return this.namedNativeQueries.indexOf(query);
+ }
+
+ public NestableNamedNativeQuery nestedAnnotationAt(int index) {
+ return this.namedNativeQueries.get(index);
+ }
+
+ public NestableNamedNativeQuery nestedAnnotationFor(org.eclipse.jdt.core.dom.Annotation jdtAnnotation) {
+ for (NestableNamedNativeQuery namedQuery : this.namedNativeQueries) {
+ if (jdtAnnotation == namedQuery.jdtAnnotation((CompilationUnit) jdtAnnotation.getRoot())) {
+ return namedQuery;
+ }
+ }
+ return null;
+ }
+
+ public void move(int targetIndex, int sourceIndex) {
+ moveItemInList(targetIndex, sourceIndex, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST);
+ }
+
+ public void moveInternal(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.namedNativeQueries, targetIndex, sourceIndex);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this);
+ }
+
+ private NamedNativeQueryImpl createNamedNativeQuery(int index) {
+ return NamedNativeQueryImpl.createNestedNamedNativeQuery(this, getMember(), index, getDeclarationAnnotationAdapter());
+ }
+
+
+ public static class NamedNativeQueriesAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final NamedNativeQueriesAnnotationDefinition INSTANCE = new NamedNativeQueriesAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private NamedNativeQueriesAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new NamedNativeQueriesImpl(parent, (Type) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQuery.java
new file mode 100644
index 0000000000..031805f3b1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQuery.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+/**
+ * Corresponds to the javax.persistence.NamedNativeQuery annotation
+ */
+public interface NamedNativeQuery extends Query
+{
+ String ANNOTATION_NAME = JPA.NAMED_NATIVE_QUERY;
+
+ /**
+ * Corresponds to the resultClass element of the NamedNativeQuery annotation.
+ * Returns null if the resultClass element does not exist in java.
+ */
+ String getResultClass();
+
+ /**
+ * Corresponds to the resultClass element of the NamedNativeQuery annotation.
+ * Set to null to remove the resultClass element.
+ */
+ void setResultClass(String resultClass);
+ String RESULT_CLASS_PROPERTY = "resultClassProperty";
+
+ /**
+ * Corresponds to the resultSetMapping element of the NamedNativeQuery annotation.
+ * Returns null if the resultSetMapping element does not exist in java.
+ */
+ String getResultSetMapping();
+
+ /**
+ * Corresponds to the resultSetMapping element of the NamedNativeQuery annotation.
+ * Set to null to remove the resultSetMapping element.
+ */
+ void setResultSetMapping(String resultSetMapping);
+ String RESULT_SET_MAPPING_PROPERTY = "resultSetMappingProperty";
+
+ String getFullyQualifiedResultClass();
+ String FULLY_QUALIFIED_RESULT_CLASS_PROPERTY = "fullyQualifiedResultClassProperty";
+
+ /**
+ * Return the ITextRange for the resultClass element. If resultClass element
+ * does not exist return the ITextRange for the NamedNativeQuery annotation.
+ */
+ ITextRange resultClassTextRange(CompilationUnit astRoot);
+
+
+ /**
+ * Return the ITextRange for the resultSetMapping element. If resultSetMapping element
+ * does not exist return the ITextRange for the NamedNativeQuery annotation.
+ */
+ ITextRange resultSetMappingTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueryImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueryImpl.java
new file mode 100644
index 0000000000..141dfb6686
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueryImpl.java
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.core.internal.jdtutility.Type;
+
+public class NamedNativeQueryImpl extends AbstractNamedQuery
+ implements NestableNamedNativeQuery
+{
+
+ public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ // hold this so we can get the 'resultClass' text range
+ private final DeclarationAnnotationElementAdapter<String> resultClassDeclarationAdapter;
+
+ // hold this so we can get the 'resultSetMapping' text range
+ private final DeclarationAnnotationElementAdapter<String> resultSetMappingDeclarationAdapter;
+
+
+ private final AnnotationElementAdapter<String> resultClassAdapter;
+
+ private final AnnotationElementAdapter<String> resultSetMappingAdapter;
+
+ private String resultClass;
+
+ private String fullyQualifiedResultClass;
+
+ private String resultSetMapping;
+
+ protected NamedNativeQueryImpl(JavaResource parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, type, daa, annotationAdapter);
+ this.resultClassDeclarationAdapter = resultClassAdapter(daa);
+ this.resultClassAdapter = this.buildAdapter(this.resultClassDeclarationAdapter);
+ this.resultSetMappingDeclarationAdapter = resultSetMappingAdapter(daa);
+ this.resultSetMappingAdapter = this.buildAdapter(this.resultSetMappingDeclarationAdapter);
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.resultClass = this.resultClass(astRoot);
+ this.fullyQualifiedResultClass = this.fullyQualifiedResultClass(astRoot);
+ this.resultSetMapping = this.resultSetMapping(astRoot);
+ }
+
+
+ // ********** initialization **********
+ protected DeclarationAnnotationElementAdapter<String> resultClassAdapter(DeclarationAnnotationAdapter daa) {
+ return new ConversionDeclarationAnnotationElementAdapter<String>(daa, JPA.NAMED_NATIVE_QUERY__RESULT_CLASS, SimpleTypeStringExpressionConverter.instance());
+ }
+
+ protected DeclarationAnnotationElementAdapter<String> resultSetMappingAdapter(DeclarationAnnotationAdapter daa) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JPA.NAMED_NATIVE_QUERY__RESULT_SET_MAPPING);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ //************* AbstractNamedQuery implementation *************
+
+ @Override
+ protected String nameElementName() {
+ return JPA.NAMED_NATIVE_QUERY__NAME;
+ }
+
+ @Override
+ protected String queryElementName() {
+ return JPA.NAMED_NATIVE_QUERY__QUERY;
+ }
+
+ @Override
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ super.initializeFrom(oldAnnotation);
+ NamedNativeQuery oldNamedQuery = (NamedNativeQuery) oldAnnotation;
+ setResultClass(oldNamedQuery.getResultClass());
+ setResultSetMapping(oldNamedQuery.getResultSetMapping());
+ }
+
+ public String getResultClass() {
+ return this.resultClass;
+ }
+
+ public void setResultClass(String newResultClass) {
+ String oldResultClass = this.resultClass;
+ this.resultClass = newResultClass;
+ this.resultClassAdapter.setValue(newResultClass);
+ firePropertyChanged(RESULT_CLASS_PROPERTY, oldResultClass, newResultClass);
+ }
+
+ public String getFullyQualifiedResultClass() {
+ return this.fullyQualifiedResultClass;
+ }
+
+ protected void setFullyQualifiedResultClass(String newQualifiedResultClass) {
+ String oldFullyQualifiedResultClass = this.fullyQualifiedResultClass;
+ this.fullyQualifiedResultClass = newQualifiedResultClass;
+ firePropertyChanged(FULLY_QUALIFIED_RESULT_CLASS_PROPERTY, oldFullyQualifiedResultClass, newQualifiedResultClass);
+ }
+
+ public String getResultSetMapping() {
+ return this.resultSetMapping;
+ }
+
+ public void setResultSetMapping(String newResultSetMapping) {
+ String oldResultSetMapping = this.resultSetMapping;
+ this.resultSetMapping = newResultSetMapping;
+ this.resultSetMappingAdapter.setValue(newResultSetMapping);
+ firePropertyChanged(RESULT_SET_MAPPING_PROPERTY, oldResultSetMapping, newResultSetMapping);
+ }
+
+ public ITextRange resultClassTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.resultClassDeclarationAdapter, astRoot);
+ }
+
+ public ITextRange resultSetMappingTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.resultSetMappingDeclarationAdapter, astRoot);
+ }
+
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.setResultClass(this.resultClass(astRoot));
+ this.setFullyQualifiedResultClass(this.fullyQualifiedResultClass(astRoot));
+ this.setResultSetMapping(this.resultSetMapping(astRoot));
+ }
+
+ protected String resultClass(CompilationUnit astRoot) {
+ return this.resultClassAdapter.getValue(astRoot);
+ }
+
+ protected String resultSetMapping(CompilationUnit astRoot) {
+ return this.resultSetMappingAdapter.getValue(astRoot);
+ }
+
+ protected String fullyQualifiedResultClass(CompilationUnit astRoot) {
+ if (getResultClass() == null) {
+ return null;
+ }
+ return JDTTools.resolveFullyQualifiedName(this.resultClassAdapter.expression(astRoot));
+ }
+
+ @Override
+ protected NestableQueryHint createQueryHint(int index) {
+ return QueryHintImpl.createNamedNativeQueryQueryHint(this, this.getMember(), this.getDeclarationAnnotationAdapter(), index);
+ }
+
+ // ********** static methods **********
+ static NamedNativeQueryImpl createNamedNativeQuery(JavaResource parent, Type type) {
+ return new NamedNativeQueryImpl(parent, type, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(type, DECLARATION_ANNOTATION_ADAPTER));
+ }
+
+ static NamedNativeQueryImpl createNestedNamedNativeQuery(JavaResource parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter);
+ IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(type, idaa);
+ return new NamedNativeQueryImpl(parent, type, idaa, annotationAdapter);
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter namedQueriesAdapter) {
+ return new NestedIndexedDeclarationAnnotationAdapter(namedQueriesAdapter, index, JPA.NAMED_NATIVE_QUERY);
+ }
+
+ public static class NamedNativeQueryAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final NamedNativeQueryAnnotationDefinition INSTANCE = new NamedNativeQueryAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private NamedNativeQueryAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return NamedNativeQueryImpl.createNamedNativeQuery(parent, (Type) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueries.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueries.java
new file mode 100644
index 0000000000..aa4d867556
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueries.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public interface NamedQueries extends ContainerAnnotation<NestableNamedQuery>
+{
+ String ANNOTATION_NAME = JPA.NAMED_QUERIES;
+
+ String NAMED_QUERIES_LIST = "namedQueriesList";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueriesImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueriesImpl.java
new file mode 100644
index 0000000000..1f565dc144
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueriesImpl.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Type;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+public class NamedQueriesImpl extends AbstractAnnotationResource<Type> implements NamedQueries
+{
+
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(NamedQueries.ANNOTATION_NAME);
+
+ private List<NestableNamedQuery> namedQueries;
+
+ protected NamedQueriesImpl(JavaResource parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.namedQueries = new ArrayList<NestableNamedQuery>();
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ ContainerAnnotationTools.initializeNestedAnnotations(astRoot, this);
+ }
+
+ public String getAnnotationName() {
+ return NamedQueries.ANNOTATION_NAME;
+ }
+
+ public String getNestableAnnotationName() {
+ return NamedQuery.ANNOTATION_NAME;
+ }
+
+ public String getElementName() {
+ return "value";
+ }
+
+ public ListIterator<NestableNamedQuery> nestedAnnotations() {
+ return new CloneListIterator<NestableNamedQuery>(this.namedQueries);
+ }
+
+ public int nestedAnnotationsSize() {
+ return this.namedQueries.size();
+ }
+
+ public NestableNamedQuery addInternal(int index) {
+ NestableNamedQuery namedQuery = createNamedQuery(index);
+ this.namedQueries.add(index, namedQuery);
+ return namedQuery;
+ }
+
+ public NestableNamedQuery add(int index) {
+ NestableNamedQuery namedQuery = createNamedQuery(index);
+ add(index, namedQuery);
+ return namedQuery;
+ }
+
+ protected void add(int index, NestableNamedQuery namedQuery) {
+ addItemToList(index, namedQuery, this.namedQueries, NamedQueries.NAMED_QUERIES_LIST);
+ }
+
+ public void remove(NestableNamedQuery namedQuery) {
+ removeItemFromList(namedQuery, this.namedQueries, NamedQueries.NAMED_QUERIES_LIST);
+ }
+
+ public void remove(int index) {
+ removeItemFromList(index, this.namedQueries, NamedQueries.NAMED_QUERIES_LIST);
+ }
+
+ public int indexOf(NestableNamedQuery attributeOverride) {
+ return this.namedQueries.indexOf(attributeOverride);
+ }
+
+ public NestableNamedQuery nestedAnnotationAt(int index) {
+ return this.namedQueries.get(index);
+ }
+
+ public NestableNamedQuery nestedAnnotationFor(org.eclipse.jdt.core.dom.Annotation jdtAnnotation) {
+ for (NestableNamedQuery namedQuery : this.namedQueries) {
+ if (jdtAnnotation == namedQuery.jdtAnnotation((CompilationUnit) jdtAnnotation.getRoot())) {
+ return namedQuery;
+ }
+ }
+ return null;
+ }
+
+ public void move(int targetIndex, int sourceIndex) {
+ moveItemInList(targetIndex, sourceIndex, this.namedQueries, NamedQueries.NAMED_QUERIES_LIST);
+ }
+
+ public void moveInternal(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.namedQueries, targetIndex, sourceIndex);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this);
+ }
+
+ private NamedQueryImpl createNamedQuery(int index) {
+ return NamedQueryImpl.createNestedNamedQuery(this, getMember(), index, getDeclarationAnnotationAdapter());
+ }
+
+ public static class NamedQueriesAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final NamedQueriesAnnotationDefinition INSTANCE = new NamedQueriesAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private NamedQueriesAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new NamedQueriesImpl(parent, (Type) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQuery.java
new file mode 100644
index 0000000000..65ed8460bb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQuery.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+/**
+ * Corresponds to the javax.persistence.NamedQuery annotation
+ */
+public interface NamedQuery extends Query
+{
+ String ANNOTATION_NAME = JPA.NAMED_QUERY;
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueryImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueryImpl.java
new file mode 100644
index 0000000000..c4d9864705
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueryImpl.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Type;
+
+public class NamedQueryImpl extends AbstractNamedQuery
+ implements NestableNamedQuery
+{
+
+ public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ protected NamedQueryImpl(JavaResource parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, type, daa, annotationAdapter);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ //************* AbstractNamedQuery implementation *************
+ @Override
+ protected String nameElementName() {
+ return JPA.NAMED_QUERY__NAME;
+ }
+
+ @Override
+ protected String queryElementName() {
+ return JPA.NAMED_QUERY__QUERY;
+ }
+
+ @Override
+ protected NestableQueryHint createQueryHint(int index) {
+ return QueryHintImpl.createNamedQueryQueryHint(this, getMember(), this.getDeclarationAnnotationAdapter(), index);
+ }
+
+ // ********** static methods **********
+ static NamedQueryImpl createNamedQuery(JavaResource parent, Type type) {
+ return new NamedQueryImpl(parent, type, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(type, DECLARATION_ANNOTATION_ADAPTER));
+ }
+
+ static NamedQueryImpl createNestedNamedQuery(JavaResource parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter);
+ IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(type, idaa);
+ return new NamedQueryImpl(parent, type, idaa, annotationAdapter);
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter namedQueriesAdapter) {
+ return new NestedIndexedDeclarationAnnotationAdapter(namedQueriesAdapter, index, JPA.NAMED_QUERY);
+ }
+
+ public static class NamedQueryAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final NamedQueryAnnotationDefinition INSTANCE = new NamedQueryAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private NamedQueryAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return NamedQueryImpl.createNamedQuery(parent, (Type) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAnnotation.java
new file mode 100644
index 0000000000..36229ce0d3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAnnotation.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public interface NestableAnnotation extends Annotation
+{
+ //currently using this when the NestableAnnotation is moved from
+ //standalone to nested or from nested to standalone.
+ //not the greatest since you have to make sure to call all setter methods
+ void initializeFrom(NestableAnnotation oldAnnotation);
+
+ /**
+ * Should only be called when the NestableAnnotation is actually nested
+ * @param newIndex
+ */
+ void moveAnnotation(int newIndex);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAssociationOverride.java
new file mode 100644
index 0000000000..9b698a89cf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAssociationOverride.java
@@ -0,0 +1,5 @@
+package org.eclipse.jpt.core.internal.resource.java;
+
+public interface NestableAssociationOverride
+ extends AssociationOverride, NestableAnnotation
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAttributeOverride.java
new file mode 100644
index 0000000000..7e0dcc41fd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableAttributeOverride.java
@@ -0,0 +1,5 @@
+package org.eclipse.jpt.core.internal.resource.java;
+
+public interface NestableAttributeOverride
+ extends AttributeOverride, NestableAnnotation
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableJoinColumn.java
new file mode 100644
index 0000000000..003b2afc9c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableJoinColumn.java
@@ -0,0 +1,4 @@
+package org.eclipse.jpt.core.internal.resource.java;
+
+interface NestableJoinColumn extends JoinColumn, NestableAnnotation
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableNamedNativeQuery.java
new file mode 100644
index 0000000000..05ee12d7fa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableNamedNativeQuery.java
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+public interface NestableNamedNativeQuery extends NamedNativeQuery, NestableAnnotation
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableNamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableNamedQuery.java
new file mode 100644
index 0000000000..85d0cb8ed5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableNamedQuery.java
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+public interface NestableNamedQuery extends NamedQuery, NestableAnnotation
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestablePrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestablePrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..1a7f8741ac
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestablePrimaryKeyJoinColumn.java
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+interface NestablePrimaryKeyJoinColumn extends PrimaryKeyJoinColumn, NestableAnnotation
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableQueryHint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableQueryHint.java
new file mode 100644
index 0000000000..b64e966b60
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableQueryHint.java
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+public interface NestableQueryHint extends QueryHint, NestableAnnotation
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableSecondaryTable.java
new file mode 100644
index 0000000000..aab4dffc23
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableSecondaryTable.java
@@ -0,0 +1,4 @@
+package org.eclipse.jpt.core.internal.resource.java;
+
+public interface NestableSecondaryTable extends SecondaryTable, NestableAnnotation
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableUniqueConstraint.java
new file mode 100644
index 0000000000..366206bbcb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NestableUniqueConstraint.java
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+public interface NestableUniqueConstraint extends UniqueConstraint, NestableAnnotation
+{}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAbstractColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAbstractColumn.java
new file mode 100644
index 0000000000..7a2a0d5a47
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAbstractColumn.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public abstract class NullAbstractColumn extends NullNamedColumn implements AbstractColumn, Annotation
+{
+ protected NullAbstractColumn(JavaResource parent) {
+ super(parent);
+ }
+
+ @Override
+ protected AbstractColumn createColumnResource() {
+ return (AbstractColumn) super.createColumnResource();
+ }
+
+ public String getTable() {
+ return null;
+ }
+
+ public void setTable(String table) {
+ if (table != null) {
+ createColumnResource().setTable(table);
+ }
+ }
+
+ public Boolean getUnique() {
+ return null;
+ }
+
+ public void setUnique(Boolean unique) {
+ if (unique != null) {
+ createColumnResource().setUnique(unique);
+ }
+ }
+
+ public Boolean getUpdatable() {
+ return null;
+ }
+
+ public void setUpdatable(Boolean updatable) {
+ if (updatable != null) {
+ createColumnResource().setUpdatable(updatable);
+ }
+ }
+
+ public Boolean getInsertable() {
+ return null;
+ }
+
+ public void setInsertable(Boolean insertable) {
+ if (insertable != null) {
+ createColumnResource().setInsertable(insertable);
+ }
+ }
+
+ public Boolean getNullable() {
+ return null;
+ }
+
+ public void setNullable(Boolean nullable) {
+ if (nullable != null) {
+ createColumnResource().setNullable(nullable);
+ }
+ }
+
+ public ITextRange tableTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange uniqueTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange updatableTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange insertableTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange nullableTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public boolean tableTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAbstractTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAbstractTable.java
new file mode 100644
index 0000000000..ccfd6c4106
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAbstractTable.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
+
+public abstract class NullAbstractTable extends AbstractResource implements Table, Annotation
+{
+ protected NullAbstractTable(JavaResource parent) {
+ super(parent);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //null, nothing to initialize
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation jdtAnnotation(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public void newAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public JavaPersistentResource parent() {
+ return (JavaPersistentResource) super.parent();
+ }
+
+ protected Table createTableResource() {
+ return (Table) parent().addAnnotation(getAnnotationName());
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public void setName(String name) {
+ if (name != null) {
+ createTableResource().setName(name);
+ }
+ }
+
+ public String getCatalog() {
+ return null;
+ }
+
+ public void setCatalog(String catalog) {
+ if (catalog != null) {
+ createTableResource().setCatalog(catalog);
+ }
+ }
+
+ public String getSchema() {
+ return null;
+ }
+
+ public void setSchema(String schema) {
+ if (schema != null) {
+ createTableResource().setSchema(schema);
+ }
+ }
+
+ public UniqueConstraint addUniqueConstraint(int index) {
+ return createTableResource().addUniqueConstraint(index);
+ }
+
+ public void removeUniqueConstraint(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public int indexOfUniqueConstraint(UniqueConstraint uniqueConstraint) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+ public UniqueConstraint uniqueConstraintAt(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public ListIterator<UniqueConstraint> uniqueConstraints() {
+ return EmptyListIterator.instance();
+ }
+
+ public int uniqueConstraintsSize() {
+ return 0;
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange nameTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange catalogTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange schemaTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+
+ public boolean catalogTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+
+ public boolean schemaTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAssociationOverride.java
new file mode 100644
index 0000000000..8528e3dff3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAssociationOverride.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.java;
+
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
+
+
+public class NullAssociationOverride extends AbstractResource implements AssociationOverride, Annotation
+{
+ private String name;
+
+ public NullAssociationOverride(JavaResource parent, String name) {
+ super(parent);
+ this.name = name;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //null, nothing to initialize
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation jdtAnnotation(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public void newAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getAnnotationName() {
+ return AssociationOverride.ANNOTATION_NAME;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ if (name != null) {
+ createAssociationOverrideResource().setName(name);
+ }
+ }
+
+ public ListIterator<JoinColumn> joinColumns() {
+ return EmptyListIterator.instance();
+ }
+
+ public JoinColumn joinColumnAt(int index) {
+ return null;
+ }
+
+ public int indexOfJoinColumn(JoinColumn joinColumn) {
+ throw new UnsupportedOperationException();
+ }
+
+ public int joinColumnsSize() {
+ return 0;
+ }
+
+ public JoinColumn addJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveJoinColumn(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public JavaPersistentResource parent() {
+ return (JavaPersistentResource) super.parent();
+ }
+
+ protected AssociationOverride createAssociationOverrideResource() {
+ return (AssociationOverride) parent().addAnnotation(getAnnotationName());
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+
+ public ITextRange nameTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverride.java
new file mode 100644
index 0000000000..029e484fbe
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverride.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public class NullAttributeOverride extends AbstractResource implements AttributeOverride, Annotation
+{
+ //TODO should I hold on to the IColumnMapping that this attribute override is built from?
+ //this would make it more similar to the Virtual mappings concept in xml
+
+
+ private final NullColumn column;
+
+ private String name;
+
+ public NullAttributeOverride(JavaResource parent, String name) {
+ super(parent);
+ this.name = name;
+ this.column = new NullColumn(this);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //null, nothing to initialize
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation jdtAnnotation(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public void newAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getAnnotationName() {
+ return AttributeOverride.ANNOTATION_NAME;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ if (name != null) {
+ createAttributeOverrideResource().setName(name);
+ }
+ }
+
+ public Column getNonNullColumn() {
+ return getColumn();
+ }
+
+ public Column getColumn() {
+ return this.column;
+ }
+
+ public Column addColumn() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeColumn() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public JavaPersistentResource parent() {
+ return (JavaPersistentResource) super.parent();
+ }
+
+ protected AttributeOverride createAttributeOverrideResource() {
+ return (AttributeOverride) parent().addAnnotation(getAnnotationName());
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+
+ public ITextRange nameTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBasic.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBasic.java
new file mode 100644
index 0000000000..d8ea2e17f0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBasic.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public class NullBasic extends AbstractResource implements Basic, Annotation
+{
+ protected NullBasic(JavaResource parent) {
+ super(parent);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //null, nothing to initialize
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation jdtAnnotation(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public void newAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getAnnotationName() {
+ return Basic.ANNOTATION_NAME;
+ }
+
+ @Override
+ public JavaPersistentResource parent() {
+ return (JavaPersistentResource) super.parent();
+ }
+
+ protected Basic createBasicResource() {
+ parent().setMappingAnnotation(getAnnotationName());
+ return (Basic) parent().mappingAnnotation();
+ }
+
+ public FetchType getFetch() {
+ return null;
+ }
+
+ public void setFetch(FetchType fetch) {
+ if (fetch != null) {
+ createBasicResource().setFetch(fetch);
+ }
+ }
+
+ public Boolean getOptional() {
+ return null;
+ }
+
+ public void setOptional(Boolean optional) {
+ if (optional != null) {
+ createBasicResource().setOptional(optional);
+ }
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange fetchTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange optionalTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumn.java
new file mode 100644
index 0000000000..62e8221100
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumn.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public class NullColumn extends NullAbstractColumn implements Column, Annotation
+{
+ public NullColumn(JavaResource parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return Column.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected Column createColumnResource() {
+ return (Column) super.createColumnResource();
+ }
+
+
+ public Integer getLength() {
+ return null;
+ }
+
+ public void setLength(Integer length) {
+ if (length != null) {
+ createColumnResource().setLength(length);
+ }
+ }
+
+ public Integer getScale() {
+ return null;
+ }
+
+ public void setScale(Integer scale) {
+ if (scale != null) {
+ createColumnResource().setScale(scale);
+ }
+ }
+
+ public Integer getPrecision() {
+ return null;
+ }
+
+ public void setPrecision(Integer precision) {
+ if (precision != null) {
+ createColumnResource().setPrecision(precision);
+ }
+ }
+
+ public ITextRange scaleTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange lengthTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange precisionTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumn.java
new file mode 100644
index 0000000000..c95ed5a815
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumn.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+
+public class NullDiscriminatorColumn extends NullNamedColumn implements DiscriminatorColumn, Annotation
+{
+ public NullDiscriminatorColumn(JavaResource parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return DiscriminatorColumn.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected DiscriminatorColumn createColumnResource() {
+ return (DiscriminatorColumn) super.createColumnResource();
+ }
+
+ public DiscriminatorType getDiscriminatorType() {
+ return null;
+ }
+
+ public void setDiscriminatorType(DiscriminatorType discriminatorType) {
+ if (discriminatorType != null) {
+ createColumnResource().setDiscriminatorType(discriminatorType);
+ }
+ }
+
+ public Integer getLength() {
+ return null;
+ }
+
+ public void setLength(Integer length) {
+ if (length != null) {
+ createColumnResource().setLength(length);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValue.java
new file mode 100644
index 0000000000..2e62a6bf03
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValue.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public class NullDiscriminatorValue extends AbstractResource implements DiscriminatorValue, Annotation
+{
+ protected NullDiscriminatorValue(JavaResource parent) {
+ super(parent);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //null, nothing to initialize
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation jdtAnnotation(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public void newAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getAnnotationName() {
+ return DiscriminatorValue.ANNOTATION_NAME;
+ }
+
+ public String getValue() {
+ return null;
+ }
+
+ public void setValue(String value) {
+ if (value != null) {
+ createDiscriminatorValueResource().setValue(value);
+ }
+ }
+
+ @Override
+ public JavaPersistentResource parent() {
+ return (JavaPersistentResource) super.parent();
+ }
+
+ protected DiscriminatorValue createDiscriminatorValueResource() {
+ return (DiscriminatorValue) parent().addAnnotation(getAnnotationName());
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+
+ }
+
+ public ITextRange valueTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumerated.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumerated.java
new file mode 100644
index 0000000000..c9ab8c4536
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumerated.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public class NullEnumerated extends AbstractResource implements Enumerated, Annotation
+{
+ protected NullEnumerated(JavaResource parent) {
+ super(parent);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //null, nothing to initialize
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation jdtAnnotation(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public void newAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getAnnotationName() {
+ return Enumerated.ANNOTATION_NAME;
+ }
+
+ @Override
+ public JavaPersistentResource parent() {
+ return (JavaPersistentResource) super.parent();
+ }
+
+ protected Enumerated createEnumeratedResource() {
+ return (Enumerated) parent().addAnnotation(getAnnotationName());
+ }
+
+
+ public EnumType getValue() {
+ return null;
+ }
+
+ public void setValue(EnumType value) {
+ if (value != null) {
+ createEnumeratedResource().setValue(value);
+ }
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange valueTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritance.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritance.java
new file mode 100644
index 0000000000..2e2e4cb585
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritance.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public class NullInheritance extends AbstractResource implements Inheritance, Annotation
+{
+ protected NullInheritance(JavaResource parent) {
+ super(parent);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //null, nothing to initialize
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation jdtAnnotation(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public void newAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getAnnotationName() {
+ return Inheritance.ANNOTATION_NAME;
+ }
+
+ public InheritanceType getStrategy() {
+ return null;
+ }
+
+ public void setStrategy(InheritanceType strategy) {
+ if (strategy != null) {
+ createInheritanceResource().setStrategy(strategy);
+ }
+
+ }
+
+ @Override
+ public JavaPersistentResource parent() {
+ return (JavaPersistentResource) super.parent();
+ }
+
+ protected Inheritance createInheritanceResource() {
+ return (Inheritance) parent().addAnnotation(getAnnotationName());
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+
+ }
+
+ public ITextRange strategyTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinColumn.java
new file mode 100644
index 0000000000..b3e9fde78f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinColumn.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+
+public class NullJoinColumn extends NullAbstractColumn implements JoinColumn, Annotation
+{
+ public NullJoinColumn(JavaResource parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return JoinColumn.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected JoinColumn createColumnResource() {
+ return (JoinColumn) super.createColumnResource();
+ }
+
+ public String getReferencedColumnName() {
+ return null;
+ }
+
+ public void setReferencedColumnName(String referencedColumnName) {
+ if (referencedColumnName != null) {
+ createColumnResource().setReferencedColumnName(referencedColumnName);
+ }
+ }
+
+ public ITextRange referencedColumnNameTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTable.java
new file mode 100644
index 0000000000..652fe1558a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTable.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
+
+
+public class NullJoinTable extends NullAbstractTable implements JoinTable
+{
+ protected NullJoinTable(JavaResource parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return JoinTable.ANNOTATION_NAME;
+ }
+
+ public JoinColumn addInverseJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public JoinColumn addJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public int indexOfInverseJoinColumn(JoinColumn joinColumn) {
+ throw new UnsupportedOperationException();
+ }
+
+ public int indexOfJoinColumn(JoinColumn joinColumn) {
+ throw new UnsupportedOperationException();
+ }
+
+ public JoinColumn inverseJoinColumnAt(int index) {
+ return null;
+ }
+
+ public ListIterator<JoinColumn> inverseJoinColumns() {
+ return EmptyListIterator.instance();
+ }
+
+ public int inverseJoinColumnsSize() {
+ return 0;
+ }
+
+ public JoinColumn joinColumnAt(int index) {
+ return null;
+ }
+
+ public ListIterator<JoinColumn> joinColumns() {
+ return EmptyListIterator.instance();
+ }
+
+ public int joinColumnsSize() {
+ return 0;
+ }
+
+ public void moveInverseJoinColumn(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveJoinColumn(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeInverseJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeJoinColumn(int index) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumn.java
new file mode 100644
index 0000000000..49d43a2bfd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumn.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public abstract class NullNamedColumn extends AbstractResource implements NamedColumn, Annotation
+{
+ protected NullNamedColumn(JavaResource parent) {
+ super(parent);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //null, nothing to initialize
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation jdtAnnotation(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public void newAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public JavaPersistentResource parent() {
+ return (JavaPersistentResource) super.parent();
+ }
+
+ protected NamedColumn createColumnResource() {
+ return (NamedColumn) parent().addAnnotation(getAnnotationName());
+ }
+
+
+ public String getName() {
+ return null;
+ }
+
+ public void setName(String name) {
+ if (name != null) {
+ createColumnResource().setName(name);
+ }
+ }
+
+ public String getColumnDefinition() {
+ return null;
+ }
+
+ public void setColumnDefinition(String columnDefinition) {
+ if (columnDefinition != null) {
+ createColumnResource().setColumnDefinition(columnDefinition);
+ }
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange columnDefinitionTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange nameTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullPrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..5c7ccfd1aa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullPrimaryKeyJoinColumn.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+
+public class NullPrimaryKeyJoinColumn extends NullNamedColumn implements PrimaryKeyJoinColumn, Annotation
+{
+ public NullPrimaryKeyJoinColumn(JavaResource parent) {
+ super(parent);
+ }
+
+ public String getAnnotationName() {
+ return PrimaryKeyJoinColumn.ANNOTATION_NAME;
+ }
+
+ @Override
+ protected PrimaryKeyJoinColumn createColumnResource() {
+ return (PrimaryKeyJoinColumn) super.createColumnResource();
+ }
+
+ public String getReferencedColumnName() {
+ return null;
+ }
+
+ public void setReferencedColumnName(String referencedColumnName) {
+ if (referencedColumnName != null) {
+ createColumnResource().setReferencedColumnName(referencedColumnName);
+ }
+ }
+
+ public ITextRange referencedColumnNameTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
+ return false;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrderByTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTable.java
index 78f118d7d5..d74fb14c3a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OrderByTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTable.java
@@ -7,14 +7,19 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm.resource;
+package org.eclipse.jpt.core.internal.resource.java;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.common.internal.emf.resource.Translator;
-public class OrderByTranslator extends Translator implements OrmXmlMapper
-{
- public OrderByTranslator() {
- super(ORDER_BY, JpaCoreMappingsPackage.eINSTANCE.getIMultiRelationshipMapping_OrderBy(), END_TAG_NO_INDENT);
+public class NullTable extends NullAbstractTable implements Table
+{
+ protected NullTable(JavaResource parent) {
+ super(parent);
}
+
+ public String getAnnotationName() {
+ return Table.ANNOTATION_NAME;
+ }
+
+
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporal.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporal.java
new file mode 100644
index 0000000000..788b836664
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporal.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public class NullTemporal extends AbstractResource implements Temporal, Annotation
+{
+ protected NullTemporal(JavaResource parent) {
+ super(parent);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //null, nothing to initialize
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation jdtAnnotation(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public void newAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeAnnotation() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getAnnotationName() {
+ return Temporal.ANNOTATION_NAME;
+ }
+
+ @Override
+ public JavaPersistentResource parent() {
+ return (JavaPersistentResource) super.parent();
+ }
+
+ protected Temporal createTemporalResource() {
+ return (Temporal) parent().addAnnotation(getAnnotationName());
+ }
+
+
+ public TemporalType getValue() {
+ return null;
+ }
+
+ public void setValue(TemporalType value) {
+ if (value != null) {
+ createTemporalResource().setValue(value);
+ }
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ throw new UnsupportedOperationException();
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return null;
+ }
+
+ public ITextRange valueTextRange(CompilationUnit astRoot) {
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToMany.java
new file mode 100644
index 0000000000..d243d76c19
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToMany.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public interface OneToMany extends RelationshipMapping
+{
+ String ANNOTATION_NAME = JPA.ONE_TO_MANY;
+
+ /**
+ * Corresponds to the mappedBy element of the OneToMany annotation.
+ * Returns null if the mappedBy element does not exist in java.
+ */
+ String getMappedBy();
+
+ /**
+ * Corresponds to the mappedBy element of the OneToMany annotation.
+ * Set to null to remove the mappedBy element.
+ */
+ void setMappedBy(String mappedBy);
+ String MAPPED_BY_PROPERTY = "mappedByProperty";
+
+ /**
+ * Return the ITextRange for the mappedBy element. If the mappedBy element
+ * does not exist return the ITextRange for the OneToMany annotation.
+ */
+ ITextRange mappedByTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified postition touches the mappedBy element.
+ * Return false if the mappedBy element does not exist.
+ */
+ boolean mappedByTouches(int pos, CompilationUnit astRoot);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToManyImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToManyImpl.java
new file mode 100644
index 0000000000..c59568a9d9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToManyImpl.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class OneToManyImpl extends AbstractRelationshipMappingAnnotation implements OneToMany
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> TARGET_ENTITY_ADAPTER = buildTargetEntityAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String[]> CASCADE_ADAPTER = buildCascadeAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String> MAPPED_BY_ADAPTER = buildMappedByAdapter();
+
+ private final AnnotationElementAdapter<String> mappedByAdapter;
+
+ private String mappedBy;
+
+ protected OneToManyImpl(JavaPersistentAttributeResource parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.mappedByAdapter = buildAnnotationElementAdapter(MAPPED_BY_ADAPTER);
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.mappedBy = this.mappedBy(astRoot);
+ }
+
+ //**************** AbstractRelationshipMappingAnnotation implementation **************
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> targetEntityAdapter() {
+ return TARGET_ENTITY_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String[]> cascadeAdapter() {
+ return CASCADE_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> fetchAdapter() {
+ return FETCH_ADAPTER;
+ }
+
+ //**************** Annotation implementation **************
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ public String getMappedBy() {
+ return this.mappedBy;
+ }
+
+ public void setMappedBy(String newMappedBy) {
+ String oldMappedBy = this.mappedBy;
+ this.mappedBy = newMappedBy;
+ this.mappedByAdapter.setValue(newMappedBy);
+ firePropertyChanged(MAPPED_BY_PROPERTY, oldMappedBy, newMappedBy);
+ }
+
+ public ITextRange mappedByTextRange(CompilationUnit astRoot) {
+ return elementTextRange(MAPPED_BY_ADAPTER, astRoot);
+ }
+
+ public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(MAPPED_BY_ADAPTER, pos, astRoot);
+ }
+
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.setMappedBy(this.mappedBy(astRoot));
+ }
+
+ protected String mappedBy(CompilationUnit astRoot) {
+ return this.mappedByAdapter.getValue(astRoot);
+ }
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildTargetEntityAdapter() {
+ return buildTargetEntityAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_MANY__TARGET_ENTITY);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String[]> buildCascadeAdapter() {
+ return buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_MANY__CASCADE);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
+ return buildFetchAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_MANY__FETCH);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildMappedByAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_MANY__MAPPED_BY, false); // false = do not remove annotation when empty
+ }
+
+ public static class OneToManyAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final OneToManyAnnotationDefinition INSTANCE = new OneToManyAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static OneToManyAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private OneToManyAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new OneToManyImpl((JavaPersistentAttributeResource) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOne.java
new file mode 100644
index 0000000000..bc7524d5bd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOne.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+public interface OneToOne extends RelationshipMapping
+{
+ String ANNOTATION_NAME = JPA.ONE_TO_ONE;
+
+ /**
+ * Corresponds to the optional element of the OneToOne annotation.
+ * Returns null if the optional element does not exist in java.
+ */
+ Boolean getOptional();
+
+ /**
+ * Corresponds to the optional element of the OneToOne annotation.
+ * Set to null to remove the optional element.
+ */
+ void setOptional(Boolean optional);
+ String OPTIONAL_PROPERTY = "optionalProperty";
+
+ /**
+ * Corresponds to the mappedBy element of the OneToOne annotation.
+ * Returns null if the mappedBy element does not exist in java.
+ */
+ String getMappedBy();
+
+ /**
+ * Corresponds to the mappedBy element of the OneToOne annotation.
+ * Set to null to remove the mappedBy element.
+ */
+ void setMappedBy(String mappedBy);
+ String MAPPED_BY_PROPERTY = "mappedByProperty";
+
+ /**
+ * Return the ITextRange for the mappedBy element. If the mappedBy element
+ * does not exist return the ITextRange for the OneToOne annotation.
+ */
+ ITextRange mappedByTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the optional element. If the optional element
+ * does not exist return the ITextRange for the OneToOne annotation.
+ */
+ ITextRange optionalTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified postition touches the mappedBy element.
+ * Return false if the mappedBy element does not exist.
+ */
+ boolean mappedByTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOneImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOneImpl.java
new file mode 100644
index 0000000000..8d10fdfe17
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOneImpl.java
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.BooleanExpressionConverter;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class OneToOneImpl extends AbstractRelationshipMappingAnnotation implements OneToOne
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ static final DeclarationAnnotationElementAdapter<String> TARGET_ENTITY_ADAPTER = buildTargetEntityAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String[]> CASCADE_ADAPTER = buildCascadeAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<Boolean> OPTIONAL_ADAPTER = buildOptionalAdapter();
+
+ private static final DeclarationAnnotationElementAdapter<String> MAPPED_BY_ADAPTER = buildMappedByAdapter();
+
+ private final AnnotationElementAdapter<Boolean> optionalAdapter;
+
+ private final AnnotationElementAdapter<String> mappedByAdapter;
+
+
+ private Boolean optional;
+
+ private String mappedBy;
+
+ public OneToOneImpl(JavaPersistentAttributeResource parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.mappedByAdapter = buildAnnotationElementAdapter(MAPPED_BY_ADAPTER);
+ this.optionalAdapter = this.buildBooleanAnnotationElementAdapter(OPTIONAL_ADAPTER);
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.mappedBy = this.mappedBy(astRoot);
+ this.optional = this.optional(astRoot);
+ }
+
+ //**************** AbstractRelationshipMappingAnnotation implementation **************
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> targetEntityAdapter() {
+ return TARGET_ENTITY_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String[]> cascadeAdapter() {
+ return CASCADE_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> fetchAdapter() {
+ return FETCH_ADAPTER;
+ }
+
+ //**************** Annotation implementation **************
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ public Boolean getOptional() {
+ return this.optional;
+ }
+
+ public void setOptional(Boolean newOptional) {
+ Boolean oldOptional = this.optional;
+ this.optional = newOptional;
+ this.optionalAdapter.setValue(newOptional);
+ firePropertyChanged(OPTIONAL_PROPERTY, oldOptional, newOptional);
+ }
+
+ public String getMappedBy() {
+ return this.mappedBy;
+ }
+
+ public void setMappedBy(String newMappedBy) {
+ String oldMappedBy = this.mappedBy;
+ this.mappedBy = newMappedBy;
+ this.mappedByAdapter.setValue(newMappedBy);
+ firePropertyChanged(MAPPED_BY_PROPERTY, oldMappedBy, newMappedBy);
+ }
+
+ public ITextRange mappedByTextRange(CompilationUnit astRoot) {
+ return elementTextRange(MAPPED_BY_ADAPTER, astRoot);
+ }
+
+ public ITextRange optionalTextRange(CompilationUnit astRoot) {
+ return elementTextRange(OPTIONAL_ADAPTER, astRoot);
+ }
+
+ public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(MAPPED_BY_ADAPTER, pos, astRoot);
+ }
+
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.setOptional(this.optional(astRoot));
+ this.setMappedBy(this.mappedByAdapter.getValue(astRoot));
+ }
+
+ protected String mappedBy(CompilationUnit astRoot) {
+ return this.mappedByAdapter.getValue(astRoot);
+ }
+
+ protected Boolean optional(CompilationUnit astRoot) {
+ return this.optionalAdapter.getValue(astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildTargetEntityAdapter() {
+ return buildTargetEntityAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__TARGET_ENTITY);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String[]> buildCascadeAdapter() {
+ return buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__CASCADE);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
+ return buildFetchAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__FETCH);
+ }
+
+ private static DeclarationAnnotationElementAdapter<Boolean> buildOptionalAdapter() {
+ return buildOptionalAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__OPTIONAL);
+ }
+
+ private static DeclarationAnnotationElementAdapter<Boolean> buildOptionalAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return new ConversionDeclarationAnnotationElementAdapter<Boolean>(annotationAdapter, elementName, false, BooleanExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildMappedByAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__MAPPED_BY, false); // false = do not remove annotation when empty
+ }
+
+ public static class OneToOneAnnotationDefinition implements AnnotationDefinition
+ {
+
+ // singleton
+ private static final OneToOneAnnotationDefinition INSTANCE = new OneToOneAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static OneToOneAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private OneToOneAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new OneToOneImpl((JavaPersistentAttributeResource) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderBy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderBy.java
new file mode 100644
index 0000000000..840bda9f89
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderBy.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+/**
+ * Corresponds to the javax.persistence.OrderBy annotation
+ */
+public interface OrderBy extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.ORDER_BY;
+
+ /**
+ * Corresponds to the value element of the javax.persistence.OrderBy annotation.
+ * Returns null if the value valuePair does not exist in the annotation
+ */
+ String getValue();
+
+ /**
+ * Corresponds to the value element of the javax.persistence.OrderBy annotation.
+ * Setting the value to null will not remove the OrderBy annotation
+ */
+ void setValue(String value);
+ String VALUE_PROPERTY = "valueProperty";
+
+ /**
+ * Return the ITextRange for the value element. If the value element
+ * does not exist return the ITextRange for the OrderBy annotation.
+ */
+ ITextRange valueTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderByImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderByImpl.java
new file mode 100644
index 0000000000..3188abddba
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderByImpl.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class OrderByImpl extends AbstractAnnotationResource<Attribute> implements OrderBy
+{
+ 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;
+
+ protected OrderByImpl(JavaResource parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.value(astRoot);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String newValue) {
+ String oldValue = this.value;
+ this.value = newValue;
+ this.valueAdapter.setValue(newValue);
+ firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
+ }
+
+ public ITextRange valueTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setValue(this.value(astRoot));
+ }
+
+ protected String value(CompilationUnit astRoot) {
+ return this.valueAdapter.getValue(astRoot);
+ }
+
+ // ********** static methods **********
+ private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.ORDER_BY__VALUE, false);
+ }
+
+
+ public static class OrderByAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final OrderByAnnotationDefinition INSTANCE = new OrderByAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private OrderByAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new OrderByImpl(parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideImpl.java
new file mode 100644
index 0000000000..9c939d5cfb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideImpl.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+
+public abstract class OverrideImpl
+ extends AbstractAnnotationResource<Member>
+ implements OverrideResource
+{
+ // hold this so we can get the 'name' text range
+ private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
+
+ private final AnnotationElementAdapter<String> nameAdapter;
+
+ private String name;
+
+
+ protected OverrideImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.nameDeclarationAdapter = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JPA.ATTRIBUTE_OVERRIDE__NAME, false); // false = do not remove annotation when empty
+ this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(getMember(),this.nameDeclarationAdapter);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.name(astRoot);
+ }
+
+ public IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
+ return (IndexedAnnotationAdapter) super.getAnnotationAdapter();
+ }
+
+ public void moveAnnotation(int newIndex) {
+ getIndexedAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ OverrideResource oldOverride = (OverrideResource) oldAnnotation;
+ setName(oldOverride.getName());
+ }
+
+ //************ AttriubteOverride implementation ****************
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.nameAdapter.setValue(newName);
+ firePropertyChanged(OverrideResource.NAME_PROPERTY, oldName, newName);
+ }
+
+ public ITextRange nameTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.nameDeclarationAdapter, astRoot);
+ }
+
+ public boolean nameTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.nameDeclarationAdapter, pos, astRoot);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setName(this.name(astRoot));
+ }
+
+ protected String name(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideResource.java
new file mode 100644
index 0000000000..a2bcce1a13
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OverrideResource.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+/**
+ * Corresponds to the javax.persistence.AttributeOverride annotation
+ */
+public interface OverrideResource extends JavaResource
+{
+
+ /**
+ * Corresponds to the name element of the AttributeOverride annotation.
+ * Returns null if the name element does not exist in java.
+ */
+ String getName();
+
+ /**
+ * Corresponds to the name element of the AttributeOverride annotation.
+ * Set to null to remove the name element.
+ */
+ void setName(String name);
+ String NAME_PROPERTY = "nameProperty";
+
+ /**
+ * Return the ITextRange for the name element. If name element
+ * does not exist return the ITextRange for the AttributeOverride annotation.
+ */
+ ITextRange nameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified postition touches the table element.
+ * Return false if the table element does not exist.
+ */
+ boolean nameTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..9beeb4d454
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumn.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+public interface PrimaryKeyJoinColumn extends NamedColumn
+{
+ String ANNOTATION_NAME = JPA.PRIMARY_KEY_JOIN_COLUMN;
+
+ String getReferencedColumnName();
+
+ void setReferencedColumnName(String referencedColumnName);
+ String REFERENCED_COLUMN_NAME_PROPERTY = "referencedColumnNameProperty";
+
+ /**
+ * Return whether the specified postition touches the referencedColumnName element.
+ * Return false if the referencedColumnName element does not exist.
+ */
+ boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the referencedColumnName element. If the referencedColumnName
+ * element does not exist return the ITextRange for the PrimaryKeyJoinColumn annotation.
+ */
+ ITextRange referencedColumnNameTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnImpl.java
new file mode 100644
index 0000000000..349ecfd0eb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnImpl.java
@@ -0,0 +1,173 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class PrimaryKeyJoinColumnImpl extends AbstractNamedColumn implements NestablePrimaryKeyJoinColumn
+{
+
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ // hold this so we can get the 'referenced column name' text range
+ private final DeclarationAnnotationElementAdapter<String> referencedColumnNameDeclarationAdapter;
+
+ private final AnnotationElementAdapter<String> referencedColumnNameAdapter;
+
+ private String referencedColumnName;
+
+ protected PrimaryKeyJoinColumnImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.referencedColumnNameDeclarationAdapter = this.buildStringElementAdapter(JPA.PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME);
+ this.referencedColumnNameAdapter = this.buildShortCircuitElementAdapter(this.referencedColumnNameDeclarationAdapter);
+ }
+
+ protected PrimaryKeyJoinColumnImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa) {
+ this(parent, member, daa, new MemberAnnotationAdapter(member, daa));
+ }
+
+ protected PrimaryKeyJoinColumnImpl(JavaResource parent, Member member, IndexedDeclarationAnnotationAdapter idaa) {
+ this(parent, member, idaa, new MemberIndexedAnnotationAdapter(member, idaa));
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.referencedColumnName = this.referencedColumnName(astRoot);
+ }
+
+ @Override
+ protected String nameElementName() {
+ return JPA.PRIMARY_KEY_JOIN_COLUMN__NAME;
+ }
+
+ @Override
+ protected String columnDefinitionElementName() {
+ return JPA.PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ private IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
+ return (IndexedAnnotationAdapter) super.getAnnotationAdapter();
+ }
+
+ public void moveAnnotation(int newIndex) {
+ getIndexedAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+ @Override
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ super.initializeFrom(oldAnnotation);
+ PrimaryKeyJoinColumn oldColumn = (PrimaryKeyJoinColumn) oldAnnotation;
+ setReferencedColumnName(oldColumn.getReferencedColumnName());
+ }
+
+ public String getReferencedColumnName() {
+ return this.referencedColumnName;
+ }
+
+ public void setReferencedColumnName(String newReferencedColumnName) {
+ String oldReferencedColumnName = this.referencedColumnName;
+ this.referencedColumnName = newReferencedColumnName;
+ this.referencedColumnNameAdapter.setValue(newReferencedColumnName);
+ firePropertyChanged(REFERENCED_COLUMN_NAME_PROPERTY, oldReferencedColumnName, newReferencedColumnName);
+ }
+
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.setReferencedColumnName(this.referencedColumnName(astRoot));
+ }
+
+ protected String referencedColumnName(CompilationUnit astRoot) {
+ return this.referencedColumnNameAdapter.getValue(astRoot);
+ }
+
+ public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.referencedColumnNameDeclarationAdapter, pos, astRoot);
+ }
+
+ public ITextRange referencedColumnNameTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.referencedColumnNameDeclarationAdapter, astRoot);
+ }
+
+ // ********** static methods **********
+
+ static PrimaryKeyJoinColumnImpl createPrimaryKeyJoinColumn(JavaResource parent, Member member) {
+ return new PrimaryKeyJoinColumnImpl(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ static PrimaryKeyJoinColumnImpl createNestedPrimaryKeyJoinColumn(JavaResource parent, Member member, int index, DeclarationAnnotationAdapter pkJoinColumnsAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, pkJoinColumnsAdapter);
+ IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
+ return new PrimaryKeyJoinColumnImpl(parent, member, idaa, annotationAdapter);
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter pkJoinColumnsAdapter) {
+ return new NestedIndexedDeclarationAnnotationAdapter(pkJoinColumnsAdapter, index, JPA.PRIMARY_KEY_JOIN_COLUMN);
+ }
+
+
+ static NestablePrimaryKeyJoinColumn createSecondaryTablePrimaryKeyJoinColumn(DeclarationAnnotationAdapter secondaryTableAdapter, JavaResource parent, Member member, int index) {
+ return new PrimaryKeyJoinColumnImpl(parent, member, buildSecondaryTableAnnotationAdapter(secondaryTableAdapter, index));
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildSecondaryTableAnnotationAdapter(DeclarationAnnotationAdapter secondaryTableAdapter, int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(secondaryTableAdapter, JPA.SECONDARY_TABLE__PK_JOIN_COLUMNS, index, JPA.PRIMARY_KEY_JOIN_COLUMN);
+ }
+
+ public static class PrimaryKeyJoinColumnAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final PrimaryKeyJoinColumnAnnotationDefinition INSTANCE = new PrimaryKeyJoinColumnAnnotationDefinition();
+
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private PrimaryKeyJoinColumnAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return PrimaryKeyJoinColumnImpl.createPrimaryKeyJoinColumn(parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return new NullPrimaryKeyJoinColumn(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumns.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumns.java
new file mode 100644
index 0000000000..aa138896f6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumns.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public interface PrimaryKeyJoinColumns extends ContainerAnnotation<NestablePrimaryKeyJoinColumn>
+{
+ String ANNOTATION_NAME = JPA.PRIMARY_KEY_JOIN_COLUMNS;
+
+ String PK_JOIN_COLUMNS_LIST = "pkJoinColumnsList";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnsImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnsImpl.java
new file mode 100644
index 0000000000..d03970766c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnsImpl.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.Annotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+public class PrimaryKeyJoinColumnsImpl extends AbstractAnnotationResource<Member> implements PrimaryKeyJoinColumns
+{
+
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private List<NestablePrimaryKeyJoinColumn> pkJoinColumns;
+
+ protected PrimaryKeyJoinColumnsImpl(JavaResource parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ this.pkJoinColumns = new ArrayList<NestablePrimaryKeyJoinColumn>();
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ ContainerAnnotationTools.initializeNestedAnnotations(astRoot, this);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public String getNestableAnnotationName() {
+ return PrimaryKeyJoinColumn.ANNOTATION_NAME;
+ }
+
+ public String getElementName() {
+ return "value";
+ }
+
+ public ListIterator<NestablePrimaryKeyJoinColumn> nestedAnnotations() {
+ return new CloneListIterator<NestablePrimaryKeyJoinColumn>(this.pkJoinColumns);
+ }
+
+ public int nestedAnnotationsSize() {
+ return this.pkJoinColumns.size();
+ }
+
+ public NestablePrimaryKeyJoinColumn addInternal(int index) {
+ NestablePrimaryKeyJoinColumn pkJoinColumn = createPrimaryKeyJoinColumn(index);
+ this.pkJoinColumns.add(index, pkJoinColumn);
+ return pkJoinColumn;
+ }
+
+ public NestablePrimaryKeyJoinColumn add(int index) {
+ NestablePrimaryKeyJoinColumn pkJoinColumn = createPrimaryKeyJoinColumn(index);
+ add(index, pkJoinColumn);
+ return pkJoinColumn;
+ }
+
+ protected void add(int index, NestablePrimaryKeyJoinColumn pkJoinColumn) {
+ addItemToList(index, pkJoinColumn, this.pkJoinColumns, PK_JOIN_COLUMNS_LIST);
+ }
+
+ public void remove(NestablePrimaryKeyJoinColumn pkJoinColumn) {
+ removeItemFromList(pkJoinColumn, this.pkJoinColumns, PK_JOIN_COLUMNS_LIST);
+ }
+
+ public void remove(int index) {
+ removeItemFromList(index, this.pkJoinColumns, PK_JOIN_COLUMNS_LIST);
+ }
+
+ public int indexOf(NestablePrimaryKeyJoinColumn pkJoinColumn) {
+ return this.pkJoinColumns.indexOf(pkJoinColumn);
+ }
+
+ public NestablePrimaryKeyJoinColumn nestedAnnotationAt(int index) {
+ return this.pkJoinColumns.get(index);
+ }
+
+ public NestablePrimaryKeyJoinColumn nestedAnnotationFor(Annotation jdtAnnotation) {
+ for (NestablePrimaryKeyJoinColumn pkJoinColumn : this.pkJoinColumns) {
+ if (jdtAnnotation == pkJoinColumn.jdtAnnotation((CompilationUnit) jdtAnnotation.getRoot())) {
+ return pkJoinColumn;
+ }
+ }
+ return null;
+ }
+
+ public void move(int targetIndex, int sourceIndex) {
+ moveItemInList(targetIndex, sourceIndex, this.pkJoinColumns, PK_JOIN_COLUMNS_LIST);
+ }
+
+ public void moveInternal(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.pkJoinColumns, targetIndex, sourceIndex);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this);
+ }
+
+ private PrimaryKeyJoinColumnImpl createPrimaryKeyJoinColumn(int index) {
+ return PrimaryKeyJoinColumnImpl.createNestedPrimaryKeyJoinColumn(this, getMember(), index, getDeclarationAnnotationAdapter());
+ }
+
+
+ public static class PrimaryKeyJoinColumnsAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final PrimaryKeyJoinColumnsAnnotationDefinition INSTANCE = new PrimaryKeyJoinColumnsAnnotationDefinition();
+
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private PrimaryKeyJoinColumnsAnnotationDefinition() {
+ super();
+ }
+
+ public PrimaryKeyJoinColumns buildAnnotation(JavaResource parent, Member member) {
+ return new PrimaryKeyJoinColumnsImpl(parent, member);
+ }
+
+ public PrimaryKeyJoinColumns buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Query.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Query.java
new file mode 100644
index 0000000000..2b773ab540
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Query.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+public interface Query extends JavaResource
+{
+ String getName();
+ void setName(String name);
+ String NAME_PROPERTY = "nameProperty";
+
+ String getQuery();
+ void setQuery(String query);
+ String QUERY_PROPERTY = "queryProperty";
+
+ ListIterator<QueryHint> hints();
+
+ QueryHint hintAt(int index);
+
+ int indexOfHint(QueryHint hint);
+
+ int hintsSize();
+
+ QueryHint addHint(int index);
+
+ void removeHint(int index);
+
+ void moveHint(int targetIndex, int sourceIndex);
+ String HINTS_LIST = "hintsList";
+
+ /**
+ * Return the ITextRange for the name element. If name element
+ * does not exist return the ITextRange for the *Query annotation.
+ */
+ ITextRange nameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the query element. If query element
+ * does not exist return the ITextRange for the *Query annotation.
+ */
+ ITextRange queryTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/QueryHint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/QueryHint.java
new file mode 100644
index 0000000000..ae34487564
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/QueryHint.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+/**
+ * Corresponds to the javax.persistence.QueryHint annotation
+ */
+public interface QueryHint extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.QUERY_HINT;
+
+ /**
+ * Corresponds to the name element of the QueryHint annotation.
+ * Returns null if the name valuePair does not exist in the annotation
+ */
+ String getName();
+
+ /**
+ * Corresponds to the name element of the QueryHint annotation.
+ * Setting to null will remove the name valuePair
+ */
+ void setName(String name);
+ String NAME_PROPERTY = "nameProperty";
+
+ /**
+ * Corresponds to the value element of the QueryHint annotation.
+ * Returns null if the value valuePair does not exist in the annotation
+ */
+ String getValue();
+
+ /**
+ * Corresponds to the value element of the QueryHint annotation.
+ * Setting to null will remove the value valuePair
+ */
+ void setValue(String value);
+ String VALUE_PROPERTY = "valueProperty";
+
+ /**
+ * Return the ITextRange for the name element. If the name element
+ * does not exist return the ITextRange for the QueryHint annotation.
+ */
+ ITextRange nameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the value element. If the value element
+ * does not exist return the ITextRange for the QueryHint annotation.
+ */
+ ITextRange valueTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/QueryHintImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/QueryHintImpl.java
new file mode 100644
index 0000000000..0e342e39aa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/QueryHintImpl.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Type;
+
+public class QueryHintImpl extends AbstractAnnotationResource<Type>
+ implements NestableQueryHint
+{
+
+ // hold this so we can get the 'name' text range
+ private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
+
+ // hold this so we can get the 'value' text range
+ private final DeclarationAnnotationElementAdapter<String> valueDeclarationAdapter;
+
+ private final AnnotationElementAdapter<String> nameAdapter;
+
+ private final AnnotationElementAdapter<String> valueAdapter;
+
+ private String name;
+
+ private String value;
+
+ public QueryHintImpl(JavaResource parent, Type type, IndexedDeclarationAnnotationAdapter idaa) {
+ super(parent, type, idaa, new MemberIndexedAnnotationAdapter(type, idaa));
+ this.nameDeclarationAdapter = this.nameAdapter(idaa);
+ this.nameAdapter = this.buildAdapter(this.nameDeclarationAdapter);
+ this.valueDeclarationAdapter = this.valueAdapter(idaa);
+ this.valueAdapter = this.buildAdapter(this.valueDeclarationAdapter);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.name(astRoot);
+ this.value = this.value(astRoot);
+ }
+
+ // ********** initialization **********
+ protected AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ return new ShortCircuitAnnotationElementAdapter<String>(getMember(), daea);
+ }
+
+ protected DeclarationAnnotationElementAdapter<String> nameAdapter(DeclarationAnnotationAdapter daa) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JPA.QUERY_HINT__NAME);
+ }
+
+ protected DeclarationAnnotationElementAdapter<String> valueAdapter(DeclarationAnnotationAdapter daa) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JPA.QUERY_HINT__VALUE);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public IndexedAnnotationAdapter getAnnotationAdapter() {
+ return (IndexedAnnotationAdapter) super.getAnnotationAdapter();
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String newName) {
+ String oldName = this.name;
+ this.name = newName;
+ this.nameAdapter.setValue(newName);
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String newValue) {
+ String oldValue = this.value;
+ this.value = newValue;
+ this.valueAdapter.setValue(newValue);
+ firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
+ }
+
+ public ITextRange nameTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.nameDeclarationAdapter, astRoot);
+ }
+
+ public ITextRange valueTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(this.valueDeclarationAdapter, astRoot);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setName(this.name(astRoot));
+ this.setValue(this.value(astRoot));
+ }
+
+ protected String name(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ protected String value(CompilationUnit astRoot) {
+ return this.valueAdapter.getValue(astRoot);
+ }
+
+ // ********** persistence model -> java annotations **********
+ public void moveAnnotation(int newIndex) {
+ getAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ QueryHint oldQueryHint = (QueryHint) oldAnnotation;
+ setName(oldQueryHint.getName());
+ setValue(oldQueryHint.getValue());
+ }
+
+ // ********** static methods **********
+ static QueryHintImpl createNamedQueryQueryHint(JavaResource parent, Type type, DeclarationAnnotationAdapter namedQueryAdapter, int index) {
+ return new QueryHintImpl(parent, type, buildNamedQueryQueryHintAnnotationAdapter(namedQueryAdapter, index));
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildNamedQueryQueryHintAnnotationAdapter(DeclarationAnnotationAdapter namedQueryAdapter, int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(namedQueryAdapter, JPA.NAMED_QUERY__HINTS, index, JPA.QUERY_HINT);
+ }
+
+ static QueryHintImpl createNamedNativeQueryQueryHint(JavaResource parent, Type type, DeclarationAnnotationAdapter namedNativeQueryAdapter, int index) {
+ return new QueryHintImpl(parent, type, buildNamedNativeQueryQueryHintAnnotationAdapter(namedNativeQueryAdapter, index));
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildNamedNativeQueryQueryHintAnnotationAdapter(DeclarationAnnotationAdapter namedNativeQueryAdapter, int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(namedNativeQueryAdapter, JPA.NAMED_NATIVE_QUERY__HINTS, index, JPA.QUERY_HINT);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/RelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/RelationshipMapping.java
new file mode 100644
index 0000000000..86f713160e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/RelationshipMapping.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+
+public interface RelationshipMapping extends JavaResource
+{
+ /**
+ * Corresponds to the targetEntity element of the relationship
+ * annotations (ManyToMany, OneToMany, ManyToOne, OneToOne).
+ * Returns null if the targetEntity element does not exist in java.
+ * Returns the portion of the targetEntity preceding the .class.
+ * <p>
+ * &#64;ManyToMany(targetEntity=Employee.class)
+ * </p>
+ * will return "Employee"
+ **/
+ String getTargetEntity();
+
+ /**
+ * Corresponds to the targetEntity of the relationship
+ * annotations (ManyToMany, OneToMany, ManyToOne, OneToOne).
+ * Set to null to remove the targetEntity element.
+ */
+ void setTargetEntity(String targetEntity);
+ String TARGET_ENTITY_PROPERTY = "targetEntityProperty";
+
+ /**
+ * Returns the qualified targetEntity name as it is resolved in the AST
+ * <p>
+ * &#64;ManyToMany(targetEntity=Employee.class)
+ * </p>
+ * will return "model.Employee" if there is an import for model.Employee
+ * @return
+ */
+ String getFullyQualifiedTargetEntity();
+ String FULLY_QUALFIEID_TARGET_ENTITY_PROPERTY = "fullyQualifiedTargetEntityProperty";
+
+ /**
+ * Corresponds to the fetch element of the relationship
+ * annotations (ManyToMany, OneToMany, ManyToOne, OneToOne).
+ * Returns null if the fetch element does not exist in java.
+ */
+ FetchType getFetch();
+
+ /**
+ * Corresponds to the fetch element of the relationship
+ * annotations (ManyToMany, OneToMany, ManyToOne, OneToOne).
+ * Set to null to remove the fetch element.
+ */
+ void setFetch(FetchType fetch);
+ String FETCH_PROPERTY = "fetchProperty";
+
+ boolean isCascadeAll();
+ void setCascadeAll(boolean all);
+ String CASCADE_ALL_PROPERTY = "cascadeAllProperty";
+
+ boolean isCascadeMerge();
+ void setCascadeMerge(boolean merge);
+ String CASCADE_MERGE_PROPERTY = "cascadeMergeProperty";
+
+ boolean isCascadePersist();
+ void setCascadePersist(boolean persist);
+ String CASCADE_PERSIST_PROPERTY = "cascadePersistProperty";
+
+ boolean isCascadeRefresh();
+ void setCascadeRefresh(boolean refresh);
+ String CASCADE_REFRESH_PROPERTY = "cascadeRefreshProperty";
+
+ boolean isCascadeRemove();
+ void setCascadeRemove(boolean remove);
+ String CASCADE_REMOVE_PROPERTY = "cascadeRemoveProperty";
+
+
+ /**
+ * Return the ITextRange for the targetEntity element. If the targetEntity element
+ * does not exist return the ITextRange for the mapping annotation.
+ */
+ ITextRange targetEntityTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the fetch element. If the fetch element
+ * does not exist return the ITextRange for the mapping annotation.
+ */
+ ITextRange fetchTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the cascade element. If the cascade element
+ * does not exist return the ITextRange for the mapping annotation.
+ */
+ ITextRange cascadeTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTable.java
new file mode 100644
index 0000000000..5873e8b101
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTable.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ListIterator;
+
+
+public interface SecondaryTable extends Table
+{
+ String ANNOTATION_NAME = JPA.SECONDARY_TABLE;
+
+ ListIterator<PrimaryKeyJoinColumn> pkJoinColumns();
+
+ PrimaryKeyJoinColumn pkJoinColumnAt(int index);
+
+ int indexOfPkJoinColumn(PrimaryKeyJoinColumn pkJoinColumn);
+
+ int pkJoinColumnsSize();
+
+ PrimaryKeyJoinColumn addPkJoinColumn(int index);
+
+ void removePkJoinColumn(int index);
+
+ void movePkJoinColumn(int targetIndex, int sourceIndex);
+
+ String PK_JOIN_COLUMNS_LIST = "pkJoinColumnsList";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTableImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTableImpl.java
new file mode 100644
index 0000000000..2aa7d2ba70
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTableImpl.java
@@ -0,0 +1,306 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+public class SecondaryTableImpl extends AbstractTableResource implements NestableSecondaryTable
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(SecondaryTable.ANNOTATION_NAME);
+
+ private final List<NestablePrimaryKeyJoinColumn> pkJoinColumns;
+
+ private final PkJoinColumnsContainerAnnotation pkJoinColumnsContainerAnnotation;
+
+
+ protected SecondaryTableImpl(JavaResource parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.pkJoinColumns = new ArrayList<NestablePrimaryKeyJoinColumn>();
+ this.pkJoinColumnsContainerAnnotation = new PkJoinColumnsContainerAnnotation();
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ ContainerAnnotationTools.initializeNestedAnnotations(astRoot, this.pkJoinColumnsContainerAnnotation);
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> catalogAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(declarationAnnotationAdapter, JPA.SECONDARY_TABLE__CATALOG);
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> nameAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(declarationAnnotationAdapter, JPA.SECONDARY_TABLE__NAME);
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> schemaAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(declarationAnnotationAdapter, JPA.SECONDARY_TABLE__SCHEMA);
+ }
+
+ public IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
+ return (IndexedAnnotationAdapter) super.getAnnotationAdapter();
+ }
+
+ public String getAnnotationName() {
+ return SecondaryTable.ANNOTATION_NAME;
+ }
+
+ public void moveAnnotation(int newIndex) {
+ getIndexedAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ SecondaryTable oldSecondaryTable = (SecondaryTable) oldAnnotation;
+ setName(oldSecondaryTable.getName());
+ setCatalog(oldSecondaryTable.getCatalog());
+ setSchema(oldSecondaryTable.getSchema());
+ for (UniqueConstraint uniqueConstraint : CollectionTools.iterable(oldSecondaryTable.uniqueConstraints())) {
+ NestableUniqueConstraint newUniqueConstraint = addUniqueConstraint(oldSecondaryTable.indexOfUniqueConstraint(uniqueConstraint));
+ newUniqueConstraint.initializeFrom((NestableAnnotation) uniqueConstraint);
+ }
+ }
+
+ @Override
+ protected NestableUniqueConstraint createUniqueConstraint(int index) {
+ return UniqueConstraintImpl.createSecondaryTableUniqueConstraint(this, this.getMember(), this.getDeclarationAnnotationAdapter(), index);
+ }
+
+ // ************* SecondaryTable implementation *******************
+
+
+ public ListIterator<PrimaryKeyJoinColumn> pkJoinColumns() {
+ return new CloneListIterator<PrimaryKeyJoinColumn>(this.pkJoinColumns);
+ }
+
+ public int pkJoinColumnsSize() {
+ return this.pkJoinColumns.size();
+ }
+
+ public NestablePrimaryKeyJoinColumn pkJoinColumnAt(int index) {
+ return this.pkJoinColumns.get(index);
+ }
+
+ public int indexOfPkJoinColumn(PrimaryKeyJoinColumn joinColumn) {
+ return this.pkJoinColumns.indexOf(joinColumn);
+ }
+
+
+ public PrimaryKeyJoinColumn addPkJoinColumn(int index) {
+ NestablePrimaryKeyJoinColumn pkJoinColumn = (NestablePrimaryKeyJoinColumn) ContainerAnnotationTools.addNestedAnnotation(index, this.pkJoinColumnsContainerAnnotation);
+ fireItemAdded(SecondaryTable.PK_JOIN_COLUMNS_LIST, index, pkJoinColumn);
+ return pkJoinColumn;
+ }
+
+ protected void addPkJoinColumn(int index, NestablePrimaryKeyJoinColumn pkJoinColumn) {
+ addItemToList(index, pkJoinColumn, this.pkJoinColumns, PK_JOIN_COLUMNS_LIST);
+ }
+
+ public void removePkJoinColumn(int index) {
+ NestablePrimaryKeyJoinColumn pkJoinColumn = this.pkJoinColumns.get(index);
+ removePkJoinColumn(pkJoinColumn);
+ pkJoinColumn.removeAnnotation();
+ ContainerAnnotationTools.synchAnnotationsAfterRemove(index, this.pkJoinColumnsContainerAnnotation);
+ }
+
+ protected void removePkJoinColumn(NestablePrimaryKeyJoinColumn pkJoinColumn) {
+ removeItemFromList(pkJoinColumn, this.pkJoinColumns, SecondaryTable.PK_JOIN_COLUMNS_LIST);
+ }
+
+ public void movePkJoinColumn(int targetIndex, int sourceIndex) {
+ movePkJoinColumnInternal(targetIndex, sourceIndex);
+ ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, this.pkJoinColumnsContainerAnnotation);
+ fireItemMoved(SecondaryTable.PK_JOIN_COLUMNS_LIST, targetIndex, sourceIndex);
+ }
+
+ protected void movePkJoinColumnInternal(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.pkJoinColumns, targetIndex, sourceIndex);
+ }
+
+
+ protected NestablePrimaryKeyJoinColumn createPrimaryKeyJoinColumn(int index) {
+ return PrimaryKeyJoinColumnImpl.createSecondaryTablePrimaryKeyJoinColumn(getDeclarationAnnotationAdapter(), this, getMember(), index);
+ }
+
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.updatePkJoinColumnsFromJava(astRoot);
+ }
+
+ private void updatePkJoinColumnsFromJava(CompilationUnit astRoot) {
+ ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this.pkJoinColumnsContainerAnnotation);
+ }
+
+ // ********** static methods **********
+ static SecondaryTableImpl createSecondaryTable(JavaResource parent, Member member) {
+ return new SecondaryTableImpl(parent, member, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
+ }
+
+ static SecondaryTableImpl createNestedSecondaryTable(JavaResource parent, Member member, int index, DeclarationAnnotationAdapter secondaryTablesAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, secondaryTablesAdapter);
+ IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
+ return new SecondaryTableImpl(parent, member, idaa, annotationAdapter);
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildNestedDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter secondaryTablesAdapter) {
+ return new NestedIndexedDeclarationAnnotationAdapter(secondaryTablesAdapter, index, JPA.SECONDARY_TABLE);
+ }
+
+
+ private class PkJoinColumnsContainerAnnotation extends AbstractResource
+ implements ContainerAnnotation<NestablePrimaryKeyJoinColumn>
+ {
+ public PkJoinColumnsContainerAnnotation() {
+ super(SecondaryTableImpl.this);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //nothing to initialize
+ }
+
+ public NestablePrimaryKeyJoinColumn addInternal(int index) {
+ NestablePrimaryKeyJoinColumn pKJoinColumn = SecondaryTableImpl.this.createPrimaryKeyJoinColumn(index);
+ SecondaryTableImpl.this.pkJoinColumns.add(index, pKJoinColumn);
+ return pKJoinColumn;
+ }
+
+ public NestablePrimaryKeyJoinColumn add(int index) {
+ NestablePrimaryKeyJoinColumn pKJoinColumn = SecondaryTableImpl.this.createPrimaryKeyJoinColumn(index);
+ SecondaryTableImpl.this.addPkJoinColumn(index, pKJoinColumn);
+ return pKJoinColumn;
+ }
+
+ public int indexOf(NestablePrimaryKeyJoinColumn pkJoinColumn) {
+ return SecondaryTableImpl.this.indexOfPkJoinColumn(pkJoinColumn);
+ }
+
+ public void move(int targetIndex, int sourceIndex) {
+ SecondaryTableImpl.this.movePkJoinColumn(targetIndex, sourceIndex);
+ }
+
+ public void moveInternal(int targetIndex, int sourceIndex) {
+ SecondaryTableImpl.this.movePkJoinColumnInternal(targetIndex, sourceIndex);
+ }
+
+ public NestablePrimaryKeyJoinColumn nestedAnnotationAt(int index) {
+ return SecondaryTableImpl.this.pkJoinColumnAt(index);
+ }
+
+ public ListIterator<NestablePrimaryKeyJoinColumn> nestedAnnotations() {
+ return new CloneListIterator<NestablePrimaryKeyJoinColumn>(SecondaryTableImpl.this.pkJoinColumns);
+ }
+
+ public int nestedAnnotationsSize() {
+ return pkJoinColumnsSize();
+ }
+
+ public String getAnnotationName() {
+ return SecondaryTableImpl.this.getAnnotationName();
+ }
+
+ public String getNestableAnnotationName() {
+ return JPA.PRIMARY_KEY_JOIN_COLUMN;
+ }
+
+ public NestablePrimaryKeyJoinColumn nestedAnnotationFor(org.eclipse.jdt.core.dom.Annotation jdtAnnotation) {
+ for (NestablePrimaryKeyJoinColumn pkJoinColumn : CollectionTools.iterable(nestedAnnotations())) {
+ if (jdtAnnotation == pkJoinColumn.jdtAnnotation((CompilationUnit) jdtAnnotation.getRoot())) {
+ return pkJoinColumn;
+ }
+ }
+ return null;
+ }
+
+ public void remove(int index) {
+ this.remove(nestedAnnotationAt(index));
+ }
+
+ public void remove(NestablePrimaryKeyJoinColumn pkJoinColumn) {
+ SecondaryTableImpl.this.removePkJoinColumn(pkJoinColumn);
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation jdtAnnotation(CompilationUnit astRoot) {
+ return SecondaryTableImpl.this.jdtAnnotation(astRoot);
+ }
+
+ public void newAnnotation() {
+ SecondaryTableImpl.this.newAnnotation();
+ }
+
+ public void removeAnnotation() {
+ SecondaryTableImpl.this.removeAnnotation();
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ SecondaryTableImpl.this.updateFromJava(astRoot);
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return SecondaryTableImpl.this.textRange(astRoot);
+ }
+
+ public String getElementName() {
+ return "pkJoinColumns";
+ }
+ }
+
+ public static class SecondaryTableAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final SecondaryTableAnnotationDefinition INSTANCE = new SecondaryTableAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private SecondaryTableAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return SecondaryTableImpl.createSecondaryTable(parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return SecondaryTable.ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTables.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTables.java
new file mode 100644
index 0000000000..df10a3cabc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTables.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public interface SecondaryTables extends ContainerAnnotation<NestableSecondaryTable>
+{
+ String ANNOTATION_NAME = JPA.SECONDARY_TABLES;
+
+ String SECONDARY_TABLES_LIST = "secondaryTablesList";
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTablesImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTablesImpl.java
new file mode 100644
index 0000000000..999b423a9d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTablesImpl.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+public class SecondaryTablesImpl extends AbstractAnnotationResource<Member> implements SecondaryTables
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final List<NestableSecondaryTable> secondaryTables;
+
+ protected SecondaryTablesImpl(JavaPersistentTypeResource parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ this.secondaryTables = new ArrayList<NestableSecondaryTable>();
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ ContainerAnnotationTools.initializeNestedAnnotations(astRoot, this);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public String getNestableAnnotationName() {
+ return SecondaryTable.ANNOTATION_NAME;
+ }
+
+ public String getElementName() {
+ return "value";
+ }
+
+ public ListIterator<NestableSecondaryTable> nestedAnnotations() {
+ return new CloneListIterator<NestableSecondaryTable>(this.secondaryTables);
+ }
+
+ public int nestedAnnotationsSize() {
+ return this.secondaryTables.size();
+ }
+
+ public NestableSecondaryTable addInternal(int index) {
+ NestableSecondaryTable secondaryTable = createSecondaryTable(index);
+ this.secondaryTables.add(index, secondaryTable);
+ return secondaryTable;
+ }
+
+ public NestableSecondaryTable add(int index) {
+ NestableSecondaryTable secondaryTable = createSecondaryTable(index);
+ this.add(index, secondaryTable);
+ return secondaryTable;
+ }
+
+ protected void add(int index, NestableSecondaryTable secondaryTable) {
+ addItemToList(index, secondaryTable, this.secondaryTables, SecondaryTables.SECONDARY_TABLES_LIST);
+ }
+
+ public void remove(NestableSecondaryTable secondaryTable) {
+ removeItemFromList(secondaryTable, this.secondaryTables, SecondaryTables.SECONDARY_TABLES_LIST);
+ }
+
+ public void remove(int index) {
+ removeItemFromList(index, this.secondaryTables, SecondaryTables.SECONDARY_TABLES_LIST);
+ }
+
+ public int indexOf(NestableSecondaryTable secondaryTable) {
+ return this.secondaryTables.indexOf(secondaryTable);
+ }
+
+ public NestableSecondaryTable nestedAnnotationAt(int index) {
+ return this.secondaryTables.get(index);
+ }
+
+ public NestableSecondaryTable nestedAnnotationFor(org.eclipse.jdt.core.dom.Annotation jdtAnnotation) {
+ for (NestableSecondaryTable secondaryTable : this.secondaryTables) {
+ if (jdtAnnotation == secondaryTable.jdtAnnotation((CompilationUnit) jdtAnnotation.getRoot())) {
+ return secondaryTable;
+ }
+ }
+ return null;
+ }
+
+ public void move(int targetIndex, int sourceIndex) {
+ moveItemInList(targetIndex, sourceIndex, this.secondaryTables, SecondaryTables.SECONDARY_TABLES_LIST);
+ }
+ //TODO this move is different than how we handle SecondarTable.pkJoinColumns
+// public void movePkJoinColumn(int oldIndex, int newIndex) {
+// movePkJoinColumnInternal(oldIndex, newIndex);
+// ContainerAnnotationTools.synchAnnotationsAfterMove(newIndex, oldIndex, this.pkJoinColumnsContainerAnnotation);
+// fireItemMoved(SecondaryTable.PK_JOIN_COLUMNS_LIST, newIndex, oldIndex);
+// }
+
+ public void moveInternal(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.secondaryTables, targetIndex, sourceIndex);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this);
+ }
+
+ private SecondaryTableImpl createSecondaryTable(int index) {
+ return SecondaryTableImpl.createNestedSecondaryTable(this, getMember(), index, getDeclarationAnnotationAdapter());
+ }
+
+ public static class SecondaryTablesAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final SecondaryTablesAnnotationDefinition INSTANCE = new SecondaryTablesAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private SecondaryTablesAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new SecondaryTablesImpl((JavaPersistentTypeResource) parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGenerator.java
new file mode 100644
index 0000000000..5d7510ea56
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGenerator.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+
+/**
+ * Corresponds to the javax.persistence.SequenceGenerator annotation
+ */
+public interface SequenceGenerator extends Generator
+{
+ String ANNOTATION_NAME = JPA.SEQUENCE_GENERATOR;
+
+ /**
+ * Corresponds to the sequenceName element of the SequenceGenerator annotation.
+ * Returns null if the sequenceName element does not exist in java. If no other memberValuePairs exist
+ * the SequenceGenerator annotation will be removed as well.
+ */
+ String getSequenceName();
+
+ /**
+ * Corresponds to the sequenceName element of the SequenceGenerator annotation.
+ * Set to null to remove the sequenceName element. If no other memberValuePairs exist
+ * the SequenceGenerator annotation will be removed as well.
+ */
+ void setSequenceName(String sequenceName);
+ String SEQUENCE_NAME_PROPERTY = "sequenceNameProperty";
+
+ /**
+ * Return the ITextRange for the sequenceName element. If the sequenceName element
+ * does not exist return the ITextRange for the SequenceGenerator annotation.
+ */
+ ITextRange sequenceNameTextRange(CompilationUnit astRoot);
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGeneratorImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGeneratorImpl.java
new file mode 100644
index 0000000000..03a24298bc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGeneratorImpl.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class SequenceGeneratorImpl extends GeneratorImpl implements SequenceGenerator
+{
+ private final AnnotationElementAdapter<String> sequenceNameAdapter;
+
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildAdapter(JPA.SEQUENCE_GENERATOR__NAME);
+
+ private static final DeclarationAnnotationElementAdapter<Integer> INITIAL_VALUE_ADAPTER = buildIntegerAdapter(JPA.SEQUENCE_GENERATOR__INITIAL_VALUE);
+
+ private static final DeclarationAnnotationElementAdapter<Integer> ALLOCATION_SIZE_ADAPTER = buildIntegerAdapter(JPA.SEQUENCE_GENERATOR__ALLOCATION_SIZE);
+
+ private static final DeclarationAnnotationElementAdapter<String> SEQUENCE_NAME_ADAPTER = buildAdapter(JPA.SEQUENCE_GENERATOR__SEQUENCE_NAME);
+
+ private String sequenceName;
+
+ protected SequenceGeneratorImpl(JavaResource parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ this.sequenceNameAdapter = this.buildAdapter(SEQUENCE_NAME_ADAPTER);
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.sequenceName = this.sequenceName(astRoot);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ //************ GeneratorImpl implementation **************
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<Integer> allocationSizeAdapter() {
+ return ALLOCATION_SIZE_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationAdapter annotationAdapter() {
+ return DECLARATION_ANNOTATION_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<Integer> initialValueAdapter() {
+ return INITIAL_VALUE_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> nameAdapter() {
+ return NAME_ADAPTER;
+ }
+
+
+ public String getSequenceName() {
+ return this.sequenceName;
+ }
+
+ public void setSequenceName(String newSequenceName) {
+ String oldSequenceName = this.sequenceName;
+ this.sequenceName = newSequenceName;
+ this.sequenceNameAdapter.setValue(newSequenceName);
+ firePropertyChanged(SEQUENCE_NAME_PROPERTY, oldSequenceName, newSequenceName);
+ }
+
+ public ITextRange sequenceNameTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(SEQUENCE_NAME_ADAPTER, astRoot);
+ }
+
+ // ********** java annotations -> persistence model **********
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.setSequenceName(this.sequenceName(astRoot));
+ }
+
+ protected String sequenceName(CompilationUnit astRoot) {
+ return this.sequenceNameAdapter.getValue(astRoot);
+ }
+
+ // ********** static methods **********
+ private static DeclarationAnnotationElementAdapter<String> buildAdapter(String elementName) {
+ return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
+ }
+
+ private static DeclarationAnnotationElementAdapter<Integer> buildIntegerAdapter(String elementName) {
+ return buildIntegerAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
+ }
+
+ public static class SequenceGeneratorAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final SequenceGeneratorAnnotationDefinition INSTANCE = new SequenceGeneratorAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private SequenceGeneratorAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new SequenceGeneratorImpl(parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Table.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Table.java
new file mode 100644
index 0000000000..9c3db55e29
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Table.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+public interface Table extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.TABLE;
+
+ String getName();
+ void setName(String name);
+ String NAME_PROPERTY = "nameProperty";
+
+ String getCatalog();
+ void setCatalog(String catalog);
+ String CATALOG_PROPERTY = "catalogProperty";
+
+ String getSchema();
+ void setSchema(String schema);
+ String SCHEMA_PROPERTY = "schemaProperty";
+
+ ListIterator<UniqueConstraint> uniqueConstraints();
+
+ UniqueConstraint uniqueConstraintAt(int index);
+
+ int indexOfUniqueConstraint(UniqueConstraint uniqueConstraint);
+
+ int uniqueConstraintsSize();
+
+ UniqueConstraint addUniqueConstraint(int index);
+
+ void removeUniqueConstraint(int index);
+
+ void moveUniqueConstraint(int targetIndex, int sourceIndex);
+ String UNIQUE_CONSTRAINTS_LIST = "uniqueConstraintsList";
+
+ /**
+ * Return the ITextRange for the name element. If the name element
+ * does not exist return the ITextRange for the *Table annotation.
+ */
+ ITextRange nameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the catalog element. If the catalog element
+ * does not exist return the ITextRange for the *Table annotation.
+ */
+ ITextRange catalogTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the schema element. If the schema element
+ * does not exist return the ITextRange for the *Table annotation.
+ */
+ ITextRange schemaTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified postition touches the name element.
+ * Return false if the name element does not exist.
+ */
+ boolean nameTouches(int pos, CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified postition touches the schema element.
+ * Return false if the name element does not exist.
+ */
+ boolean schemaTouches(int pos, CompilationUnit astRoot);
+
+ /**
+ * Return whether the specified postition touches the catalog element.
+ * Return false if the name element does not exist.
+ */
+ boolean catalogTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGenerator.java
new file mode 100644
index 0000000000..87b6897a0b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGenerator.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+/**
+ * Corresponds to the javax.persistence.TableGenerator annotation
+ */
+public interface TableGenerator extends Generator
+{
+
+ String ANNOTATION_NAME = JPA.TABLE_GENERATOR;
+
+ /**
+ * Corresponds to the table element of the TableGenerator annotation.
+ * Returns null if the table element does not exist in java. If no other memberValuePairs exist
+ * the TableGenerator annotation will be removed as well.
+ */
+ String getTable();
+
+ /**
+ * Corresponds to the table element of the TableGenerator annotation.
+ * Set to null to remove the table element. If no other memberValuePairs exist
+ * the TableGenerator annotation will be removed as well.
+ */
+ void setTable(String table);
+ String TABLE_PROPERTY = "tableProperty";
+
+ /**
+ * Corresponds to the catalog element of the TableGenerator annotation.
+ * Returns null if the catalog element does not exist in java. If no other memberValuePairs exist
+ * the TableGenerator annotation will be removed as well.
+ */
+ String getCatalog();
+
+ /**
+ * Corresponds to the catalog element of the TableGenerator annotation.
+ * Set to null to remove the catalog element. If no other memberValuePairs exist
+ * the TableGenerator annotation will be removed as well.
+ */
+ void setCatalog(String catalog);
+ String CATALOG_PROPERTY = "catalogProperty";
+
+ /**
+ * Corresponds to the schema element of the TableGenerator annotation.
+ * Returns null if the schema element does not exist in java. If no other memberValuePairs exist
+ * the TableGenerator annotation will be removed as well.
+ */
+ String getSchema();
+
+ /**
+ * Corresponds to the schema element of the TableGenerator annotation.
+ * Set to null to remove the schema element. If no other memberValuePairs exist
+ * the TableGenerator annotation will be removed as well.
+ */
+ void setSchema(String schema);
+ String SCHEMA_PROPERTY = "schemaProperty";
+
+ /**
+ * Corresponds to the pkColumnName element of the TableGenerator annotation.
+ * Returns null if the pkColumnName element does not exist in java. If no other memberValuePairs exist
+ * the TableGenerator annotation will be removed as well.
+ */
+ String getPkColumnName();
+
+ /**
+ * Corresponds to the pkColumnName element of the TableGenerator annotation.
+ * Set to null to remove the pkColumnName element. If no other memberValuePairs exist
+ * the TableGenerator annotation will be removed as well.
+ */
+ void setPkColumnName(String pkColumnName);
+ String PK_COLUMN_NAME_PROPERTY = "pkColumnNameProperty";
+
+ /**
+ * Corresponds to the valueColumnName element of the TableGenerator annotation.
+ * Returns null if the valueColumnName element does not exist in java. If no other memberValuePairs exist
+ * the TableGenerator annotation will be removed as well.
+ */
+ String getValueColumnName();
+
+ /**
+ * Corresponds to the valueColumnName element of the TableGenerator annotation.
+ * Set to null to remove the valueColumnName element. If no other memberValuePairs exist
+ * the TableGenerator annotation will be removed as well.
+ */
+ void setValueColumnName(String valueColumnName);
+ String VALUE_COLUMN_NAME_PROPERTY = "valueColumnNameProperty";
+
+ /**
+ * Corresponds to the pkColumnValue element of the TableGenerator annotation.
+ * Returns null if the pkColumnValue element does not exist in java. If no other memberValuePairs exist
+ * the TableGenerator annotation will be removed as well.
+ */
+ String getPkColumnValue();
+
+ /**
+ * Corresponds to the pkColumnValue element of the TableGenerator annotation.
+ * Set to null to remove the pkColumnValue element. If no other memberValuePairs exist
+ * the TableGenerator annotation will be removed as well.
+ */
+ void setPkColumnValue(String pkColumnValue);
+ String PK_COLUMN_VALUE_PROPERTY = "pkColumnValueProperty";
+
+ ListIterator<UniqueConstraint> uniqueConstraints();
+
+ UniqueConstraint uniqueConstraintAt(int index);
+
+ int indexOfUniqueConstraint(UniqueConstraint uniqueConstraint);
+
+ int uniqueConstraintsSize();
+
+ UniqueConstraint addUniqueConstraint(int index);
+
+ void removeUniqueConstraint(int index);
+
+ void moveUniqueConstraint(int targetIndex, int sourceIndex);
+ String UNIQUE_CONSTRAINTS_LIST = "uniqueConstraintsList";
+
+ /**
+ * Return the ITextRange for the table element. If the table element
+ * does not exist return the ITextRange for the TableGenerator annotation.
+ */
+ ITextRange tableTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the catalog element. If the catalog element
+ * does not exist return the ITextRange for the TableGenerator annotation.
+ */
+ ITextRange catalogTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the schema element. If the schema element
+ * does not exist return the ITextRange for the TableGenerator annotation.
+ */
+ ITextRange schemaTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the pkColumnName element. If the pkColumnName element
+ * does not exist return the ITextRange for the TableGenerator annotation.
+ */
+ ITextRange pkColumnNameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the valueColumnName element. If the valueColumnName element
+ * does not exist return the ITextRange for the TableGenerator annotation.
+ */
+ ITextRange valueColumnNameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the ITextRange for the pkColumnValue element. If the pkColumnValue element
+ * does not exist return the ITextRange for the TableGenerator annotation.
+ */
+ ITextRange pkColumnValueTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGeneratorImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGeneratorImpl.java
new file mode 100644
index 0000000000..a044ff5d72
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGeneratorImpl.java
@@ -0,0 +1,455 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+public class TableGeneratorImpl extends GeneratorImpl implements TableGenerator
+{
+ private final AnnotationElementAdapter<String> tableAdapter;
+
+ private final AnnotationElementAdapter<String> catalogAdapter;
+
+ private final AnnotationElementAdapter<String> schemaAdapter;
+
+ private final AnnotationElementAdapter<String> pkColumnNameAdapter;
+
+ private final AnnotationElementAdapter<String> valueColumnNameAdapter;
+
+ private final AnnotationElementAdapter<String> pkColumnValueAdapter;
+
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__NAME);
+
+ private static final DeclarationAnnotationElementAdapter<Integer> INITIAL_VALUE_ADAPTER = buildIntegerAdapter(JPA.TABLE_GENERATOR__INITIAL_VALUE);
+
+ private static final DeclarationAnnotationElementAdapter<Integer> ALLOCATION_SIZE_ADAPTER = buildIntegerAdapter(JPA.TABLE_GENERATOR__ALLOCATION_SIZE);
+
+ private static final DeclarationAnnotationElementAdapter<String> TABLE_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__TABLE);
+
+ private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__CATALOG);
+
+ private static final DeclarationAnnotationElementAdapter<String> SCHEMA_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__SCHEMA);
+
+ private static final DeclarationAnnotationElementAdapter<String> PK_COLUMN_NAME_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__PK_COLUMN_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> VALUE_COLUMN_NAME_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__VALUE_COLUMN_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> PK_COLUMN_VALUE_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__PK_COLUMN_VALUE);
+
+ private String table;
+
+ private String catalog;
+
+ private String schema;
+
+ private String pkColumnName;
+
+ private String valueColumnName;
+
+ private String pkColumnValue;
+
+ private final List<NestableUniqueConstraint> uniqueConstraints;
+
+ private final UniqueConstraintsContainerAnnotation uniqueConstraintsContainerAnnotation;
+
+
+ protected TableGeneratorImpl(JavaResource parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ this.tableAdapter = this.buildAdapter(TABLE_ADAPTER);
+ this.catalogAdapter = this.buildAdapter(CATALOG_ADAPTER);
+ this.schemaAdapter = this.buildAdapter(SCHEMA_ADAPTER);
+ this.pkColumnNameAdapter = this.buildAdapter(PK_COLUMN_NAME_ADAPTER);
+ this.valueColumnNameAdapter = this.buildAdapter(VALUE_COLUMN_NAME_ADAPTER);
+ this.pkColumnValueAdapter = this.buildAdapter(PK_COLUMN_VALUE_ADAPTER);
+ this.uniqueConstraints = new ArrayList<NestableUniqueConstraint>();
+ this.uniqueConstraintsContainerAnnotation = new UniqueConstraintsContainerAnnotation();
+ }
+
+ @Override
+ public void initialize(CompilationUnit astRoot) {
+ super.initialize(astRoot);
+ this.table = this.table(astRoot);
+ this.catalog = this.catalog(astRoot);
+ this.schema = this.schema(astRoot);
+ this.pkColumnName = this.pkColumnName(astRoot);
+ this.valueColumnName = this.valueColumnName(astRoot);
+ this.pkColumnValue = this.pkColumnValue(astRoot);
+ ContainerAnnotationTools.initializeNestedAnnotations(astRoot, this.uniqueConstraintsContainerAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+
+ //************ GeneratorImpl implementation **************
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<Integer> allocationSizeAdapter() {
+ return ALLOCATION_SIZE_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationAdapter annotationAdapter() {
+ return DECLARATION_ANNOTATION_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<Integer> initialValueAdapter() {
+ return INITIAL_VALUE_ADAPTER;
+ }
+
+ @Override
+ protected DeclarationAnnotationElementAdapter<String> nameAdapter() {
+ return NAME_ADAPTER;
+ }
+
+ public String getTable() {
+ return this.table;
+ }
+
+ public void setTable(String newTable) {
+ String oldTable = this.table;
+ this.table = newTable;
+ this.tableAdapter.setValue(newTable);
+ firePropertyChanged(TABLE_PROPERTY, oldTable, newTable);
+ }
+
+ public String getCatalog() {
+ return this.catalog;
+ }
+
+ public void setCatalog(String newCatalog) {
+ String oldCatalog = this.catalog;
+ this.catalog = newCatalog;
+ this.catalogAdapter.setValue(newCatalog);
+ firePropertyChanged(CATALOG_PROPERTY, oldCatalog, newCatalog);
+ }
+
+ public String getSchema() {
+ return this.schema;
+ }
+
+ public void setSchema(String newSchema) {
+ String oldSchema = this.schema;
+ this.schema = newSchema;
+ this.schemaAdapter.setValue(newSchema);
+ firePropertyChanged(SCHEMA_PROPERTY, oldSchema, newSchema);
+ }
+
+ public String getPkColumnName() {
+ return this.pkColumnName;
+ }
+
+ public void setPkColumnName(String newPkColumnName) {
+ String oldPkColumnName = this.pkColumnName;
+ this.pkColumnName = newPkColumnName;
+ this.pkColumnNameAdapter.setValue(newPkColumnName);
+ firePropertyChanged(PK_COLUMN_NAME_PROPERTY, oldPkColumnName, newPkColumnName);
+ }
+
+ public String getValueColumnName() {
+ return this.valueColumnName;
+ }
+
+ public void setValueColumnName(String newValueColumnName) {
+ String oldValueColumnName = this.valueColumnName;
+ this.valueColumnName = newValueColumnName;
+ this.valueColumnNameAdapter.setValue(newValueColumnName);
+ firePropertyChanged(VALUE_COLUMN_NAME_PROPERTY, oldValueColumnName, newValueColumnName);
+ }
+
+ public String getPkColumnValue() {
+ return this.pkColumnValue;
+ }
+
+ public void setPkColumnValue(String newPkColumnValue) {
+ String oldPkColumnValue = this.pkColumnValue;
+ this.pkColumnValue = newPkColumnValue;
+ this.pkColumnValueAdapter.setValue(newPkColumnValue);
+ firePropertyChanged(PK_COLUMN_VALUE_PROPERTY, oldPkColumnValue, newPkColumnValue);
+ }
+
+ public ListIterator<UniqueConstraint> uniqueConstraints() {
+ return new CloneListIterator<UniqueConstraint>(this.uniqueConstraints);
+ }
+
+ public int uniqueConstraintsSize() {
+ return this.uniqueConstraints.size();
+ }
+
+ public NestableUniqueConstraint uniqueConstraintAt(int index) {
+ return this.uniqueConstraints.get(index);
+ }
+
+ public int indexOfUniqueConstraint(UniqueConstraint uniqueConstraint) {
+ return this.uniqueConstraints.indexOf(uniqueConstraint);
+ }
+
+ public NestableUniqueConstraint addUniqueConstraint(int index) {
+ NestableUniqueConstraint uniqueConstraint = (NestableUniqueConstraint) ContainerAnnotationTools.addNestedAnnotation(index, this.uniqueConstraintsContainerAnnotation);
+ fireItemAdded(TableGenerator.UNIQUE_CONSTRAINTS_LIST, index, uniqueConstraint);
+ return uniqueConstraint;
+ }
+
+ private void addUniqueConstraint(int index, NestableUniqueConstraint uniqueConstraint) {
+ addItemToList(index, uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ public void removeUniqueConstraint(int index) {
+ NestableUniqueConstraint uniqueConstraint = this.uniqueConstraints.get(index);
+ removeUniqueConstraint(uniqueConstraint);
+ uniqueConstraint.removeAnnotation();
+ synchUniqueConstraintAnnotationsAfterRemove(index);
+ }
+
+ protected void removeUniqueConstraint(NestableUniqueConstraint uniqueConstraint) {
+ removeItemFromList(uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST);
+ }
+
+ public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
+ moveUniqueConstraintInternal(targetIndex, sourceIndex);
+ ContainerAnnotationTools.synchAnnotationsAfterMove(targetIndex, sourceIndex, this.uniqueConstraintsContainerAnnotation);
+ fireItemMoved(Table.UNIQUE_CONSTRAINTS_LIST, targetIndex, sourceIndex);
+ }
+
+ protected void moveUniqueConstraintInternal(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.uniqueConstraints, targetIndex, sourceIndex);
+ }
+
+ /**
+ * synchronize the annotations with the model join columns,
+ * starting at the specified index to prevent overlap
+ */
+ private void synchUniqueConstraintAnnotationsAfterRemove(int index) {
+ ContainerAnnotationTools.synchAnnotationsAfterRemove(index, this.uniqueConstraintsContainerAnnotation);
+ }
+
+ protected NestableUniqueConstraint createUniqueConstraint(int index) {
+ return UniqueConstraintImpl.createTableGeneratorUniqueConstraint(this, this.getMember(), index);
+ }
+
+ public ITextRange tableTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(TABLE_ADAPTER, astRoot);
+ }
+
+ public ITextRange catalogTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(CATALOG_ADAPTER, astRoot);
+ }
+
+ public ITextRange schemaTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(SCHEMA_ADAPTER, astRoot);
+ }
+
+ public ITextRange pkColumnNameTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(PK_COLUMN_NAME_ADAPTER, astRoot);
+ }
+
+ public ITextRange pkColumnValueTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(PK_COLUMN_VALUE_ADAPTER, astRoot);
+ }
+
+ public ITextRange valueColumnNameTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(VALUE_COLUMN_NAME_ADAPTER, astRoot);
+ }
+
+ // ********** java annotations -> persistence model **********
+ @Override
+ public void updateFromJava(CompilationUnit astRoot) {
+ super.updateFromJava(astRoot);
+ this.setTable(this.table(astRoot));
+ this.setCatalog(this.catalog(astRoot));
+ this.setSchema(this.schema(astRoot));
+ this.setPkColumnName(this.pkColumnName(astRoot));
+ this.setValueColumnName(this.valueColumnName(astRoot));
+ this.setPkColumnValue(this.pkColumnValue(astRoot));
+ this.updateUniqueConstraintsFromJava(astRoot);
+ }
+
+ protected String table(CompilationUnit astRoot) {
+ return this.tableAdapter.getValue(astRoot);
+ }
+ protected String catalog(CompilationUnit astRoot) {
+ return this.catalogAdapter.getValue(astRoot);
+ }
+ protected String schema(CompilationUnit astRoot) {
+ return this.schemaAdapter.getValue(astRoot);
+ }
+ protected String pkColumnName(CompilationUnit astRoot) {
+ return this.pkColumnNameAdapter.getValue(astRoot);
+ }
+ protected String valueColumnName(CompilationUnit astRoot) {
+ return this.valueColumnNameAdapter.getValue(astRoot);
+ }
+ protected String pkColumnValue(CompilationUnit astRoot) {
+ return this.pkColumnValueAdapter.getValue(astRoot);
+ }
+
+ /**
+ * here we just worry about getting the unique constraints lists the same size;
+ * then we delegate to the unique constraints to synch themselves up
+ */
+ private void updateUniqueConstraintsFromJava(CompilationUnit astRoot) {
+ ContainerAnnotationTools.updateNestedAnnotationsFromJava(astRoot, this.uniqueConstraintsContainerAnnotation);
+ }
+
+ // ********** static methods **********
+ private static DeclarationAnnotationElementAdapter<String> buildAdapter(String elementName) {
+ return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
+ }
+
+ private static DeclarationAnnotationElementAdapter<Integer> buildIntegerAdapter(String elementName) {
+ return buildIntegerAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
+ }
+
+
+ private class UniqueConstraintsContainerAnnotation extends AbstractResource
+ implements ContainerAnnotation<NestableUniqueConstraint>
+ {
+ public UniqueConstraintsContainerAnnotation() {
+ super(TableGeneratorImpl.this);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //nothing to initialize
+ }
+
+ public NestableUniqueConstraint addInternal(int index) {
+ NestableUniqueConstraint uniqueConstraint = TableGeneratorImpl.this.createUniqueConstraint(index);
+ TableGeneratorImpl.this.uniqueConstraints.add(index, uniqueConstraint);
+ return uniqueConstraint;
+ }
+
+ public NestableUniqueConstraint add(int index) {
+ NestableUniqueConstraint uniqueConstraint = TableGeneratorImpl.this.createUniqueConstraint(index);
+ TableGeneratorImpl.this.addUniqueConstraint(index, uniqueConstraint);
+ return uniqueConstraint;
+ }
+
+ public String getAnnotationName() {
+ return TableGeneratorImpl.this.getAnnotationName();
+ }
+
+ public String getNestableAnnotationName() {
+ return JPA.UNIQUE_CONSTRAINT;
+ }
+
+ public int indexOf(NestableUniqueConstraint uniqueConstraint) {
+ return TableGeneratorImpl.this.indexOfUniqueConstraint(uniqueConstraint);
+ }
+
+ public void move(int targetIndex, int sourceIndex) {
+ TableGeneratorImpl.this.moveUniqueConstraint(targetIndex, sourceIndex);
+ }
+
+ public void moveInternal(int targetIndex, int sourceIndex) {
+ TableGeneratorImpl.this.moveUniqueConstraintInternal(targetIndex, sourceIndex);
+ }
+
+ public NestableUniqueConstraint nestedAnnotationAt(int index) {
+ return TableGeneratorImpl.this.uniqueConstraintAt(index);
+ }
+
+ public NestableUniqueConstraint nestedAnnotationFor(org.eclipse.jdt.core.dom.Annotation jdtAnnotation) {
+ for (NestableUniqueConstraint uniqueConstraint : CollectionTools.iterable(nestedAnnotations())) {
+ if (jdtAnnotation == uniqueConstraint.jdtAnnotation((CompilationUnit) jdtAnnotation.getRoot())) {
+ return uniqueConstraint;
+ }
+ }
+ return null;
+ }
+
+ public ListIterator<NestableUniqueConstraint> nestedAnnotations() {
+ return new CloneListIterator<NestableUniqueConstraint>(TableGeneratorImpl.this.uniqueConstraints);
+ }
+
+ public int nestedAnnotationsSize() {
+ return TableGeneratorImpl.this.uniqueConstraints.size();
+ }
+
+ public void remove(NestableUniqueConstraint uniqueConstraint) {
+ TableGeneratorImpl.this.removeUniqueConstraint(uniqueConstraint);
+ }
+
+ public void remove(int index) {
+ this.remove(nestedAnnotationAt(index));
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation jdtAnnotation(CompilationUnit astRoot) {
+ return TableGeneratorImpl.this.jdtAnnotation(astRoot);
+ }
+
+ public void newAnnotation() {
+ TableGeneratorImpl.this.newAnnotation();
+ }
+
+ public void removeAnnotation() {
+ TableGeneratorImpl.this.removeAnnotation();
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ TableGeneratorImpl.this.updateFromJava(astRoot);
+ }
+
+ public ITextRange textRange(CompilationUnit astRoot) {
+ return TableGeneratorImpl.this.textRange(astRoot);
+ }
+
+ public String getElementName() {
+ return "uniqueConstraints";
+ }
+ }
+
+ public static class TableGeneratorAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final TableGeneratorAnnotationDefinition INSTANCE = new TableGeneratorAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private TableGeneratorAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new TableGeneratorImpl(parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableImpl.java
index 85f8693b50..9502d6868a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaTable.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007 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.
@@ -7,82 +7,88 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.java.mappings;
+package org.eclipse.jpt.core.internal.resource.java;
-import org.eclipse.emf.ecore.EClass;
import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationAdapter;
import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.platform.BaseJpaPlatform;
-import org.eclipse.jpt.core.internal.platform.DefaultsContext;
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Java Table</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.jpt.core.internal.content.java.mappings.JpaJavaMappingsPackage#getJavaTable()
- * @model kind="class"
- * @generated
- */
-public class JavaTable extends AbstractJavaTable
+public class TableImpl extends AbstractTableResource
{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.TABLE);
+ private static final String ANNOTATION_NAME = JPA.TABLE;
+
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.TABLE__NAME);
private static final DeclarationAnnotationElementAdapter<String> SCHEMA_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.TABLE__SCHEMA);
private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.TABLE__CATALOG);
-
- protected JavaTable() {
- super();
- throw new UnsupportedOperationException("Use JavaSecondaryTable(Owner, Member) instead");
+
+ protected TableImpl(JavaResource parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
}
- protected JavaTable(Owner owner, Member member) {
- super(owner, member, DECLARATION_ANNOTATION_ADAPTER);
+ public String getAnnotationName() {
+ return Table.ANNOTATION_NAME;
}
-
+
@Override
- protected DeclarationAnnotationElementAdapter<String> nameAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
+ protected DeclarationAnnotationElementAdapter<String> nameAdapter(@SuppressWarnings("unused") DeclarationAnnotationAdapter declarationAnnotationAdapter) {
// ignore the daa passed in, @Table is never nested
return NAME_ADAPTER;
}
@Override
- protected DeclarationAnnotationElementAdapter<String> schemaAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
+ protected DeclarationAnnotationElementAdapter<String> schemaAdapter(@SuppressWarnings("unused") DeclarationAnnotationAdapter declarationAnnotationAdapter) {
// ignore the daa passed in, @Table is never nested
return SCHEMA_ADAPTER;
}
@Override
- protected DeclarationAnnotationElementAdapter<String> catalogAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter) {
+ protected DeclarationAnnotationElementAdapter<String> catalogAdapter(@SuppressWarnings("unused") DeclarationAnnotationAdapter declarationAnnotationAdapter) {
// ignore the daa passed in, @Table is never nested
return CATALOG_ADAPTER;
}
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
+
@Override
- protected EClass eStaticClass() {
- return JpaJavaMappingsPackage.Literals.JAVA_TABLE;
+ protected NestableUniqueConstraint createUniqueConstraint(int index) {
+ return UniqueConstraintImpl.createTableUniqueConstraint(this, this.getMember(), index);
}
+
+ public static class TableAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final TableAnnotationDefinition INSTANCE = new TableAnnotationDefinition();
- @Override
- public void refreshDefaults(DefaultsContext defaultsContext) {
- super.refreshDefaults(defaultsContext);
- this.setDefaultName((String) defaultsContext.getDefault(BaseJpaPlatform.DEFAULT_TABLE_NAME_KEY));
- }
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
- @Override
- protected JavaUniqueConstraint createJavaUniqueConstraint(int index) {
- return JavaUniqueConstraint.createTableUniqueConstraint(new UniqueConstraintOwner(this), this.getMember(), index);
+ /**
+ * Ensure non-instantiability.
+ */
+ private TableAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new TableImpl(parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return new NullTable(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
}
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Temporal.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Temporal.java
new file mode 100644
index 0000000000..2e7a1a8eb0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Temporal.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+
+/**
+ * Corresponds to the javax.persistence.Temporal annotation
+ */
+public interface Temporal extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.TEMPORAL;
+
+ /**
+ * Corresponds to the value element of the Temporal annotation.
+ * Returns null if the value element does not exist in java.
+ */
+ TemporalType getValue();
+
+ /**
+ * Corresponds to the value element of the Temporal annotation.
+ * Set to null to remove the value element.
+ */
+ void setValue(TemporalType value);
+ String VALUE_PROPERTY = "valueProperty";
+
+ /**
+ * Return the ITextRange for the value element. If the value element
+ * does not exist return the ITextRange for the Temporal annotation.
+ */
+ ITextRange valueTextRange(CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalImpl.java
new file mode 100644
index 0000000000..fa61cd9d45
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalImpl.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class TemporalImpl extends AbstractAnnotationResource<Attribute> implements Temporal
+{
+ 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 TemporalType value;
+
+ protected TemporalImpl(JavaResource parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(attribute, VALUE_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.value(astRoot);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public TemporalType getValue() {
+ return this.value;
+ }
+
+ public void setValue(TemporalType newValue) {
+ TemporalType oldValue = this.value;
+ this.value = newValue;
+ this.valueAdapter.setValue(TemporalType.toJavaAnnotationValue(newValue));
+ firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
+ }
+
+ public ITextRange valueTextRange(CompilationUnit astRoot) {
+ return this.elementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.setValue(this.value(astRoot));
+ }
+
+ protected TemporalType value(CompilationUnit astRoot) {
+ return TemporalType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot));
+ }
+
+ // ********** static methods **********
+ private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
+ return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.TEMPORAL__VALUE);
+ }
+
+ public static class TemporalAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final TemporalAnnotationDefinition INSTANCE = new TemporalAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private TemporalAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new TemporalImpl(parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return new NullTemporal(parent);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalType.java
new file mode 100644
index 0000000000..add5a13e9a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalType.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+public enum TemporalType {
+
+ DATE,
+ TIME,
+ TIMESTAMP;
+
+
+ public static TemporalType fromJavaAnnotationValue(Object javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ return null;
+ }
+ if (javaAnnotationValue.equals(JPA.TEMPORAL_TYPE__DATE)) {
+ return DATE;
+ }
+ if (javaAnnotationValue.equals(JPA.TEMPORAL_TYPE__TIME)) {
+ return TIME;
+ }
+ if (javaAnnotationValue.equals(JPA.TEMPORAL_TYPE__TIMESTAMP)) {
+ return TIMESTAMP;
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(TemporalType temporalType) {
+ if (temporalType == null) {
+ return null;
+ }
+ switch (temporalType) {
+ case DATE :
+ return JPA.TEMPORAL_TYPE__DATE;
+ case TIME :
+ return JPA.TEMPORAL_TYPE__TIME;
+ case TIMESTAMP :
+ return JPA.TEMPORAL_TYPE__TIMESTAMP;
+ default :
+ throw new IllegalArgumentException("unknown temporal type: " + temporalType);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Transient.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Transient.java
new file mode 100644
index 0000000000..4d86d7451e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Transient.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+/**
+ * Corresponds to the javax.persistence.Transient annotation
+ */
+public interface Transient extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.TRANSIENT;
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TransientImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TransientImpl.java
new file mode 100644
index 0000000000..02b3f54677
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TransientImpl.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class TransientImpl extends AbstractAnnotationResource<Attribute> implements Transient
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ protected TransientImpl(JavaPersistentAttributeResource parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //nothing to initialize
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ //no annotation members
+ }
+
+ public static class TransientAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final TransientAnnotationDefinition INSTANCE = new TransientAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static TransientAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private TransientAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new TransientImpl((JavaPersistentAttributeResource) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/UniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/UniqueConstraint.java
new file mode 100644
index 0000000000..e0913f94ec
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/UniqueConstraint.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+
+/**
+ * Corresponds to the javax.persistence.UniqueConstraint annotation
+ */
+public interface UniqueConstraint extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.UNIQUE_CONSTRAINT;
+
+ ListIterator<String> columnNames();
+
+ int columnNamesSize();
+
+ void addColumnName(String columnName);
+
+ void removeColumnName(String columnName);
+ String COLUMN_NAMES_LIST = "columnNamesList";
+
+ /**
+ * Return whether the specified postition touches the columnNames element.
+ * Return false if the columnNames element does not exist.
+ */
+ boolean columnNamesTouches(int pos, CompilationUnit astRoot);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/UniqueConstraintImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/UniqueConstraintImpl.java
new file mode 100644
index 0000000000..5060256f4f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/UniqueConstraintImpl.java
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.AnnotationStringArrayExpressionConverter;
+import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ExpressionConverter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.MemberIndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.ShortCircuitArrayAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+public class UniqueConstraintImpl extends AbstractAnnotationResource<Member> implements NestableUniqueConstraint
+{
+
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.UNIQUE_CONSTRAINT);
+
+ private final DeclarationAnnotationElementAdapter<String[]> columnNamesDeclarationAdapter;
+
+ private final AnnotationElementAdapter<String[]> columnNamesAdapter;
+
+ private final List<String> columnNames;
+
+
+ public UniqueConstraintImpl(JavaResource parent, Member member, IndexedDeclarationAnnotationAdapter idaa) {
+ super(parent, member, idaa, new MemberIndexedAnnotationAdapter(member, idaa));
+ this.columnNamesDeclarationAdapter = buildArrayAnnotationElementAdapter(idaa, JPA.UNIQUE_CONSTRAINT__COLUMN_NAMES);
+ this.columnNamesAdapter = this.buildAnnotationElementAdapter(this.columnNamesDeclarationAdapter);
+ this.columnNames = new ArrayList<String>();
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ String[] javaColumnNames = this.columnNamesAdapter.getValue(astRoot);
+ for (int i = 0; i < javaColumnNames.length; i++) {
+ this.columnNames.add(javaColumnNames[i]);
+ }
+ }
+
+ protected AnnotationElementAdapter<String[]> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String[]> daea) {
+ return new ShortCircuitArrayAnnotationElementAdapter<String>(getMember(), daea);
+ }
+
+ protected static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return buildArrayAnnotationElementAdapter(annotationAdapter, elementName, AnnotationStringArrayExpressionConverter.forStrings());
+ }
+
+ protected static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String[]> converter) {
+ return new ConversionDeclarationAnnotationElementAdapter<String[]>(annotationAdapter, elementName, false, converter);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public IndexedAnnotationAdapter getAnnotationAdapter() {
+ return (IndexedAnnotationAdapter) super.getAnnotationAdapter();
+ }
+
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ UniqueConstraint oldUniqueConstraint = (UniqueConstraint) oldAnnotation;
+ for (String columnName : CollectionTools.iterable(oldUniqueConstraint.columnNames())) {
+ addColumnName(columnName);
+ }
+ }
+
+ public ListIterator<String> columnNames() {
+ return new CloneListIterator<String>(this.columnNames);
+ }
+
+ public int columnNamesSize() {
+ return this.columnNames.size();
+ }
+
+ public void addColumnName(String columnName) {
+ addItemToList(columnName, this.columnNames, COLUMN_NAMES_LIST);
+ this.columnNamesAdapter.setValue(this.columnNames.toArray(new String[this.columnNames.size()]));
+ }
+
+ public void removeColumnName(String columnName) {
+ removeItemFromList(columnName, this.columnNames, COLUMN_NAMES_LIST);
+ this.columnNamesAdapter.setValue(this.columnNames.toArray(new String[this.columnNames.size()]));
+ }
+
+ public boolean columnNamesTouches(int pos, CompilationUnit astRoot) {
+ return this.elementTouches(this.columnNamesDeclarationAdapter, pos, astRoot);
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ this.updateColumnNamesFromJava(astRoot);
+ }
+
+ protected void updateColumnNamesFromJava(CompilationUnit astRoot) {
+ String[] javaColumnNames = this.columnNamesAdapter.getValue(astRoot);
+ //TODO hmm, seems we need change notification for this
+ CollectionTools.retainAll(this.columnNames, javaColumnNames);
+ for (int i = 0; i < javaColumnNames.length; i++) {
+ String columnName = javaColumnNames[i];
+ if (!this.columnNames.contains(columnName)) {
+ addColumnName(columnName);
+ }
+ }
+ }
+
+ // ********** persistence model -> java annotations **********
+ public void moveAnnotation(int newIndex) {
+ getAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+ // ********** static methods **********
+ static NestableUniqueConstraint createSecondaryTableUniqueConstraint(JavaResource parent, Member member, DeclarationAnnotationAdapter declarationAnnotationAdapter, int index) {
+ return new UniqueConstraintImpl(parent, member, buildSecondaryTableUniqueConstraintAnnotationAdapter(declarationAnnotationAdapter, index));
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildSecondaryTableUniqueConstraintAnnotationAdapter(DeclarationAnnotationAdapter declarationAnnotationAdapter, int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(declarationAnnotationAdapter, JPA.SECONDARY_TABLE__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT);
+ }
+
+ static NestableUniqueConstraint createJoinTableUniqueConstraint(JavaResource parent, Member member, int index) {
+ return new UniqueConstraintImpl(parent, member, buildJoinTableUniqueConstraintAnnotationAdapter(index));
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildJoinTableUniqueConstraintAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(JoinTableImpl.DECLARATION_ANNOTATION_ADAPTER, JPA.JOIN_TABLE__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT);
+ }
+
+ static NestableUniqueConstraint createTableUniqueConstraint(JavaResource parent, Member member, int index) {
+ return new UniqueConstraintImpl(parent, member, buildTableUniqueConstraintAnnotationAdapter(index));
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildTableUniqueConstraintAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(TableImpl.DECLARATION_ANNOTATION_ADAPTER, JPA.TABLE__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT);
+ }
+
+ static NestableUniqueConstraint createTableGeneratorUniqueConstraint(JavaResource parent, Member member, int index) {
+ return new UniqueConstraintImpl(parent, member, buildTableGeneratorUniqueConstraintAnnotationAdapter(index));
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildTableGeneratorUniqueConstraintAnnotationAdapter(int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(TableGeneratorImpl.DECLARATION_ANNOTATION_ADAPTER, JPA.TABLE_GENERATOR__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Version.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Version.java
new file mode 100644
index 0000000000..29172ed4bb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/Version.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+
+/**
+ * Corresponds to the javax.persistence.Version annotation
+ */
+public interface Version extends JavaResource
+{
+ String ANNOTATION_NAME = JPA.VERSION;
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/VersionImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/VersionImpl.java
new file mode 100644
index 0000000000..2030be095a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/VersionImpl.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.jdtutility.Attribute;
+import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.jdtutility.Member;
+import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
+
+public class VersionImpl extends AbstractAnnotationResource<Attribute> implements Version
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ public VersionImpl(JavaPersistentAttributeResource parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ //nothing to initialize
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void updateFromJava(CompilationUnit astRoot) {
+ //no annotation members
+ }
+
+ public static class VersionAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final VersionAnnotationDefinition INSTANCE = new VersionAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static VersionAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private VersionAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResource parent, Member member) {
+ return new VersionImpl((JavaPersistentAttributeResource) parent, (Attribute) member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResource parent, Member member) {
+ return null;
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AbstractColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AbstractColumn.java
new file mode 100644
index 0000000000..7830e660e6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AbstractColumn.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Abstract Column</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getInsertable <em>Insertable</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getNullable <em>Nullable</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getTable <em>Table</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getUnique <em>Unique</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getUpdatable <em>Updatable</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface AbstractColumn extends NamedColumn
+{
+ /**
+ * Returns the value of the '<em><b>Insertable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Insertable</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Insertable</em>' attribute.
+ * @see #setInsertable(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn_Insertable()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ Boolean getInsertable();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getInsertable <em>Insertable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Insertable</em>' attribute.
+ * @see #getInsertable()
+ * @generated
+ */
+ void setInsertable(Boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Nullable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Nullable</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Nullable</em>' attribute.
+ * @see #setNullable(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn_Nullable()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ Boolean getNullable();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getNullable <em>Nullable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Nullable</em>' attribute.
+ * @see #getNullable()
+ * @generated
+ */
+ void setNullable(Boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Table</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Table</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Table</em>' attribute.
+ * @see #setTable(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn_Table()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getTable();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getTable <em>Table</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Table</em>' attribute.
+ * @see #getTable()
+ * @generated
+ */
+ void setTable(String value);
+
+ /**
+ * Returns the value of the '<em><b>Unique</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Unique</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Unique</em>' attribute.
+ * @see #setUnique(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn_Unique()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ Boolean getUnique();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getUnique <em>Unique</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Unique</em>' attribute.
+ * @see #getUnique()
+ * @generated
+ */
+ void setUnique(Boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Updatable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Updatable</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Updatable</em>' attribute.
+ * @see #setUpdatable(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn_Updatable()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ Boolean getUpdatable();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getUpdatable <em>Updatable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Updatable</em>' attribute.
+ * @see #getUpdatable()
+ * @generated
+ */
+ void setUpdatable(Boolean value);
+
+} // AbstractColumn
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AbstractTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AbstractTable.java
new file mode 100644
index 0000000000..77ee3f346f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AbstractTable.java
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Abstract Table</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.AbstractTable#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.AbstractTable#getCatalog <em>Catalog</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.AbstractTable#getSchema <em>Schema</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.AbstractTable#getUniqueConstraints <em>Unique Constraints</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends IJpaEObject
+ * @generated
+ */
+public interface AbstractTable extends IJpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractTable#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Catalog</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Catalog</em>' attribute.
+ * @see #setCatalog(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_Catalog()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getCatalog();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractTable#getCatalog <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Catalog</em>' attribute.
+ * @see #getCatalog()
+ * @generated
+ */
+ void setCatalog(String value);
+
+ /**
+ * Returns the value of the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Schema</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Schema</em>' attribute.
+ * @see #setSchema(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_Schema()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getSchema();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractTable#getSchema <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Schema</em>' attribute.
+ * @see #getSchema()
+ * @generated
+ */
+ void setSchema(String value);
+
+ /**
+ * Returns the value of the '<em><b>Unique Constraints</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Unique Constraints</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Unique Constraints</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_UniqueConstraints()
+ * @model containment="true"
+ * @generated
+ */
+ EList<UniqueConstraint> getUniqueConstraints();
+
+} // AbstractTable
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AccessType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AccessType.java
index 26706f251c..b89bae74d3 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AccessType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AccessType.java
@@ -1,14 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2007 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;
+ * Copyright (c) 2007 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.resource.orm;
import java.util.Arrays;
import java.util.Collections;
@@ -20,20 +19,12 @@ import org.eclipse.emf.common.util.Enumerator;
* A representation of the literals of the enumeration '<em><b>Access Type</b></em>',
* and utility methods for working with them.
* <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.JpaCorePackage#getAccessType()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAccessType()
* @model
* @generated
*/
-public enum AccessType implements Enumerator {
- /**
- * The '<em><b>Default</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #DEFAULT_VALUE
- * @generated
- * @ordered
- */
- DEFAULT(0, "Default", "Default"),
+public enum AccessType implements Enumerator
+{
/**
* The '<em><b>PROPERTY</b></em>' literal object.
* <!-- begin-user-doc -->
@@ -42,7 +33,8 @@ public enum AccessType implements Enumerator {
* @generated
* @ordered
*/
- PROPERTY(1, "PROPERTY", "Property"),
+ PROPERTY(0, "PROPERTY", "PROPERTY"),
+
/**
* The '<em><b>FIELD</b></em>' literal object.
* <!-- begin-user-doc -->
@@ -51,21 +43,7 @@ public enum AccessType implements Enumerator {
* @generated
* @ordered
*/
- FIELD(2, "FIELD", "Field");
- /**
- * The '<em><b>Default</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>Default</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #DEFAULT
- * @model name="Default"
- * @generated
- * @ordered
- */
- public static final int DEFAULT_VALUE = 0;
+ FIELD(1, "FIELD", "FIELD");
/**
* The '<em><b>PROPERTY</b></em>' literal value.
@@ -76,11 +54,11 @@ public enum AccessType implements Enumerator {
* </p>
* <!-- end-user-doc -->
* @see #PROPERTY
- * @model literal="Property"
+ * @model
* @generated
* @ordered
*/
- public static final int PROPERTY_VALUE = 1;
+ public static final int PROPERTY_VALUE = 0;
/**
* The '<em><b>FIELD</b></em>' literal value.
@@ -91,11 +69,11 @@ public enum AccessType implements Enumerator {
* </p>
* <!-- end-user-doc -->
* @see #FIELD
- * @model literal="Field"
+ * @model
* @generated
* @ordered
*/
- public static final int FIELD_VALUE = 2;
+ public static final int FIELD_VALUE = 1;
/**
* An array of all the '<em><b>Access Type</b></em>' enumerators.
@@ -103,9 +81,12 @@ public enum AccessType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- private static final AccessType[] VALUES_ARRAY = new AccessType[] {
- DEFAULT, PROPERTY, FIELD,
- };
+ private static final AccessType[] VALUES_ARRAY =
+ new AccessType[]
+ {
+ PROPERTY,
+ FIELD,
+ };
/**
* A public read-only list of all the '<em><b>Access Type</b></em>' enumerators.
@@ -121,10 +102,13 @@ public enum AccessType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static AccessType get(String literal) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ public static AccessType get(String literal)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
AccessType result = VALUES_ARRAY[i];
- if (result.toString().equals(literal)) {
+ if (result.toString().equals(literal))
+ {
return result;
}
}
@@ -137,10 +121,13 @@ public enum AccessType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static AccessType getByName(String name) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ public static AccessType getByName(String name)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
AccessType result = VALUES_ARRAY[i];
- if (result.getName().equals(name)) {
+ if (result.getName().equals(name))
+ {
return result;
}
}
@@ -153,14 +140,12 @@ public enum AccessType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static AccessType get(int value) {
- switch (value) {
- case DEFAULT_VALUE :
- return DEFAULT;
- case PROPERTY_VALUE :
- return PROPERTY;
- case FIELD_VALUE :
- return FIELD;
+ public static AccessType get(int value)
+ {
+ switch (value)
+ {
+ case PROPERTY_VALUE: return PROPERTY;
+ case FIELD_VALUE: return FIELD;
}
return null;
}
@@ -192,7 +177,8 @@ public enum AccessType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- private AccessType(int value, String name, String literal) {
+ private AccessType(int value, String name, String literal)
+ {
this.value = value;
this.name = name;
this.literal = literal;
@@ -203,8 +189,9 @@ public enum AccessType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public int getValue() {
- return value;
+ public int getValue()
+ {
+ return value;
}
/**
@@ -212,8 +199,9 @@ public enum AccessType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public String getName() {
- return name;
+ public String getName()
+ {
+ return name;
}
/**
@@ -221,8 +209,9 @@ public enum AccessType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public String getLiteral() {
- return literal;
+ public String getLiteral()
+ {
+ return literal;
}
/**
@@ -232,7 +221,9 @@ public enum AccessType implements Enumerator {
* @generated
*/
@Override
- public String toString() {
+ public String toString()
+ {
return literal;
}
-} //AccessType
+
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AssociationOverride.java
new file mode 100644
index 0000000000..44dccb6c8c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AssociationOverride.java
@@ -0,0 +1,264 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Association Override</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.AssociationOverride#getJoinColumns <em>Join Columns</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.AssociationOverride#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAssociationOverride()
+ * @model kind="class"
+ * @extends IJpaEObject
+ * @generated
+ */
+public class AssociationOverride extends JpaEObject implements IJpaEObject
+{
+ /**
+ * The cached value of the '{@link #getJoinColumns() <em>Join Columns</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJoinColumns()
+ * @generated
+ * @ordered
+ */
+ protected EList<JoinColumn> joinColumns;
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AssociationOverride()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ASSOCIATION_OVERRIDE;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Join Columns</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAssociationOverride_JoinColumns()
+ * @model containment="true" required="true"
+ * @generated
+ */
+ public EList<JoinColumn> getJoinColumns()
+ {
+ if (joinColumns == null)
+ {
+ joinColumns = new EObjectContainmentEList<JoinColumn>(JoinColumn.class, this, OrmPackage.ASSOCIATION_OVERRIDE__JOIN_COLUMNS);
+ }
+ return joinColumns;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAssociationOverride_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.AssociationOverride#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ASSOCIATION_OVERRIDE__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ASSOCIATION_OVERRIDE__JOIN_COLUMNS:
+ return ((InternalEList<?>)getJoinColumns()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ASSOCIATION_OVERRIDE__JOIN_COLUMNS:
+ return getJoinColumns();
+ case OrmPackage.ASSOCIATION_OVERRIDE__NAME:
+ return getName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ASSOCIATION_OVERRIDE__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ getJoinColumns().addAll((Collection<? extends JoinColumn>)newValue);
+ return;
+ case OrmPackage.ASSOCIATION_OVERRIDE__NAME:
+ setName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ASSOCIATION_OVERRIDE__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ return;
+ case OrmPackage.ASSOCIATION_OVERRIDE__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ASSOCIATION_OVERRIDE__JOIN_COLUMNS:
+ return joinColumns != null && !joinColumns.isEmpty();
+ case OrmPackage.ASSOCIATION_OVERRIDE__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} // AssociationOverride
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AttributeMapping.java
new file mode 100644
index 0000000000..d59a56ac21
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AttributeMapping.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Attribute Mapping</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.AttributeMapping#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeMapping()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends IJpaEObject
+ * @generated
+ */
+public interface AttributeMapping extends IJpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeMapping_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeMapping#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+} // AttributeMapping
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IQueryHint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AttributeOverride.java
index 3d092622f5..c7d755f1e4 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IQueryHint.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AttributeOverride.java
@@ -7,78 +7,80 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.mappings;
+package org.eclipse.jpt.core.internal.resource.orm;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
/**
* <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IQuery Hint</b></em>'.
+ * A representation of the model object '<em><b>Attribute Override</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IQueryHint#getName <em>Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IQueryHint#getValue <em>Value</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverride#getColumn <em>Column</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverride#getName <em>Name</em>}</li>
* </ul>
* </p>
*
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIQueryHint()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeOverride()
* @model kind="class" interface="true" abstract="true"
+ * @extends IJpaEObject
* @generated
*/
-public interface IQueryHint extends IJpaSourceObject
+public interface AttributeOverride extends IJpaEObject
{
/**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * Returns the value of the '<em><b>Column</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * If the meaning of the '<em>Column</em>' containment reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see #setName(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIQueryHint_Name()
- * @model
+ * @return the value of the '<em>Column</em>' containment reference.
+ * @see #setColumn(Column)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeOverride_Column()
+ * @model containment="true" required="true"
* @generated
*/
- String getName();
+ Column getColumn();
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IQueryHint#getName <em>Name</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverride#getColumn <em>Column</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @param value the new value of the '<em>Name</em>' attribute.
- * @see #getName()
+ * @param value the new value of the '<em>Column</em>' containment reference.
+ * @see #getColumn()
* @generated
*/
- void setName(String value);
+ void setColumn(Column value);
/**
- * Returns the value of the '<em><b>Value</b></em>' attribute.
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Value</em>' attribute isn't clear,
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- * @return the value of the '<em>Value</em>' attribute.
- * @see #setValue(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIQueryHint_Value()
- * @model
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeOverride_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
* @generated
*/
- String getValue();
+ String getName();
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IQueryHint#getValue <em>Value</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverride#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @param value the new value of the '<em>Value</em>' attribute.
- * @see #getValue()
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
* @generated
*/
- void setValue(String value);
-} // IQueryHint
+ void setName(String value);
+
+} // AttributeOverride
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AttributeOverrideImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AttributeOverrideImpl.java
new file mode 100644
index 0000000000..b810efc97b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/AttributeOverrideImpl.java
@@ -0,0 +1,286 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Attribute Override</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeOverrideImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class AttributeOverrideImpl extends JpaEObject implements AttributeOverride
+{
+ /**
+ * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumn()
+ * @generated
+ * @ordered
+ */
+ protected Column column;
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AttributeOverrideImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ATTRIBUTE_OVERRIDE_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Column</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Column</em>' containment reference.
+ * @see #setColumn(Column)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeOverride_Column()
+ * @model containment="true" required="true"
+ * @generated
+ */
+ public Column getColumn()
+ {
+ return column;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetColumn(Column newColumn, NotificationChain msgs)
+ {
+ Column oldColumn = column;
+ column = newColumn;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ATTRIBUTE_OVERRIDE_IMPL__COLUMN, oldColumn, newColumn);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverrideImpl#getColumn <em>Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Column</em>' containment reference.
+ * @see #getColumn()
+ * @generated
+ */
+ public void setColumn(Column newColumn)
+ {
+ if (newColumn != column)
+ {
+ NotificationChain msgs = null;
+ if (column != null)
+ msgs = ((InternalEObject)column).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ATTRIBUTE_OVERRIDE_IMPL__COLUMN, null, msgs);
+ if (newColumn != null)
+ msgs = ((InternalEObject)newColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ATTRIBUTE_OVERRIDE_IMPL__COLUMN, null, msgs);
+ msgs = basicSetColumn(newColumn, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ATTRIBUTE_OVERRIDE_IMPL__COLUMN, newColumn, newColumn));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeOverride_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverrideImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ATTRIBUTE_OVERRIDE_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ATTRIBUTE_OVERRIDE_IMPL__COLUMN:
+ return basicSetColumn(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ATTRIBUTE_OVERRIDE_IMPL__COLUMN:
+ return getColumn();
+ case OrmPackage.ATTRIBUTE_OVERRIDE_IMPL__NAME:
+ return getName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ATTRIBUTE_OVERRIDE_IMPL__COLUMN:
+ setColumn((Column)newValue);
+ return;
+ case OrmPackage.ATTRIBUTE_OVERRIDE_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ATTRIBUTE_OVERRIDE_IMPL__COLUMN:
+ setColumn((Column)null);
+ return;
+ case OrmPackage.ATTRIBUTE_OVERRIDE_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ATTRIBUTE_OVERRIDE_IMPL__COLUMN:
+ return column != null;
+ case OrmPackage.ATTRIBUTE_OVERRIDE_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} // AttributeOverride
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Attributes.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Attributes.java
new file mode 100644
index 0000000000..f5aa775803
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Attributes.java
@@ -0,0 +1,602 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Attributes</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getIds <em>Ids</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getEmbeddedIds <em>Embedded Ids</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getBasics <em>Basics</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getVersions <em>Versions</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getManyToOnes <em>Many To Ones</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getOneToManys <em>One To Manys</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getOneToOnes <em>One To Ones</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getManyToManys <em>Many To Manys</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getEmbeddeds <em>Embeddeds</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getTransients <em>Transients</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributes()
+ * @model kind="class"
+ * @extends IJpaEObject
+ * @generated
+ */
+public class Attributes extends JpaEObject implements IJpaEObject
+{
+ /**
+ * The cached value of the '{@link #getIds() <em>Ids</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getIds()
+ * @generated
+ * @ordered
+ */
+ protected EList<IdImpl> ids;
+
+ /**
+ * The cached value of the '{@link #getEmbeddedIds() <em>Embedded Ids</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEmbeddedIds()
+ * @generated
+ * @ordered
+ */
+ protected EList<EmbeddedIdImpl> embeddedIds;
+
+ /**
+ * The cached value of the '{@link #getBasics() <em>Basics</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getBasics()
+ * @generated
+ * @ordered
+ */
+ protected EList<BasicImpl> basics;
+
+ /**
+ * The cached value of the '{@link #getVersions() <em>Versions</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getVersions()
+ * @generated
+ * @ordered
+ */
+ protected EList<VersionImpl> versions;
+
+ /**
+ * The cached value of the '{@link #getManyToOnes() <em>Many To Ones</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getManyToOnes()
+ * @generated
+ * @ordered
+ */
+ protected EList<ManyToOneImpl> manyToOnes;
+
+ /**
+ * The cached value of the '{@link #getOneToManys() <em>One To Manys</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOneToManys()
+ * @generated
+ * @ordered
+ */
+ protected EList<OneToManyImpl> oneToManys;
+
+ /**
+ * The cached value of the '{@link #getOneToOnes() <em>One To Ones</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOneToOnes()
+ * @generated
+ * @ordered
+ */
+ protected EList<OneToOneImpl> oneToOnes;
+
+ /**
+ * The cached value of the '{@link #getManyToManys() <em>Many To Manys</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getManyToManys()
+ * @generated
+ * @ordered
+ */
+ protected EList<ManyToManyImpl> manyToManys;
+
+ /**
+ * The cached value of the '{@link #getEmbeddeds() <em>Embeddeds</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEmbeddeds()
+ * @generated
+ * @ordered
+ */
+ protected EList<EmbeddedImpl> embeddeds;
+
+ /**
+ * The cached value of the '{@link #getTransients() <em>Transients</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTransients()
+ * @generated
+ * @ordered
+ */
+ protected EList<TransientImpl> transients;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Attributes()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ATTRIBUTES;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Ids</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.IdImpl}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Ids</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Ids</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributes_Ids()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<IdImpl> getIds()
+ {
+ if (ids == null)
+ {
+ ids = new EObjectContainmentEList<IdImpl>(IdImpl.class, this, OrmPackage.ATTRIBUTES__IDS);
+ }
+ return ids;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Embedded Ids</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedIdImpl}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Embedded Ids</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Embedded Ids</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributes_EmbeddedIds()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<EmbeddedIdImpl> getEmbeddedIds()
+ {
+ if (embeddedIds == null)
+ {
+ embeddedIds = new EObjectContainmentEList<EmbeddedIdImpl>(EmbeddedIdImpl.class, this, OrmPackage.ATTRIBUTES__EMBEDDED_IDS);
+ }
+ return embeddedIds;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Basics</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.BasicImpl}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Basics</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Basics</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributes_Basics()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<BasicImpl> getBasics()
+ {
+ if (basics == null)
+ {
+ basics = new EObjectContainmentEList<BasicImpl>(BasicImpl.class, this, OrmPackage.ATTRIBUTES__BASICS);
+ }
+ return basics;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Versions</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.VersionImpl}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Versions</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Versions</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributes_Versions()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<VersionImpl> getVersions()
+ {
+ if (versions == null)
+ {
+ versions = new EObjectContainmentEList<VersionImpl>(VersionImpl.class, this, OrmPackage.ATTRIBUTES__VERSIONS);
+ }
+ return versions;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Many To Ones</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Many To Ones</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Many To Ones</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributes_ManyToOnes()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<ManyToOneImpl> getManyToOnes()
+ {
+ if (manyToOnes == null)
+ {
+ manyToOnes = new EObjectContainmentEList<ManyToOneImpl>(ManyToOneImpl.class, this, OrmPackage.ATTRIBUTES__MANY_TO_ONES);
+ }
+ return manyToOnes;
+ }
+
+ /**
+ * Returns the value of the '<em><b>One To Manys</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>One To Manys</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>One To Manys</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributes_OneToManys()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<OneToManyImpl> getOneToManys()
+ {
+ if (oneToManys == null)
+ {
+ oneToManys = new EObjectContainmentEList<OneToManyImpl>(OneToManyImpl.class, this, OrmPackage.ATTRIBUTES__ONE_TO_MANYS);
+ }
+ return oneToManys;
+ }
+
+ /**
+ * Returns the value of the '<em><b>One To Ones</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>One To Ones</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>One To Ones</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributes_OneToOnes()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<OneToOneImpl> getOneToOnes()
+ {
+ if (oneToOnes == null)
+ {
+ oneToOnes = new EObjectContainmentEList<OneToOneImpl>(OneToOneImpl.class, this, OrmPackage.ATTRIBUTES__ONE_TO_ONES);
+ }
+ return oneToOnes;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Many To Manys</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Many To Manys</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Many To Manys</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributes_ManyToManys()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<ManyToManyImpl> getManyToManys()
+ {
+ if (manyToManys == null)
+ {
+ manyToManys = new EObjectContainmentEList<ManyToManyImpl>(ManyToManyImpl.class, this, OrmPackage.ATTRIBUTES__MANY_TO_MANYS);
+ }
+ return manyToManys;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Embeddeds</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedImpl}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Embeddeds</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Embeddeds</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributes_Embeddeds()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<EmbeddedImpl> getEmbeddeds()
+ {
+ if (embeddeds == null)
+ {
+ embeddeds = new EObjectContainmentEList<EmbeddedImpl>(EmbeddedImpl.class, this, OrmPackage.ATTRIBUTES__EMBEDDEDS);
+ }
+ return embeddeds;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Transients</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.TransientImpl}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Transients</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Transients</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributes_Transients()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<TransientImpl> getTransients()
+ {
+ if (transients == null)
+ {
+ transients = new EObjectContainmentEList<TransientImpl>(TransientImpl.class, this, OrmPackage.ATTRIBUTES__TRANSIENTS);
+ }
+ return transients;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ATTRIBUTES__IDS:
+ return ((InternalEList<?>)getIds()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ATTRIBUTES__EMBEDDED_IDS:
+ return ((InternalEList<?>)getEmbeddedIds()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ATTRIBUTES__BASICS:
+ return ((InternalEList<?>)getBasics()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ATTRIBUTES__VERSIONS:
+ return ((InternalEList<?>)getVersions()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ATTRIBUTES__MANY_TO_ONES:
+ return ((InternalEList<?>)getManyToOnes()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ATTRIBUTES__ONE_TO_MANYS:
+ return ((InternalEList<?>)getOneToManys()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ATTRIBUTES__ONE_TO_ONES:
+ return ((InternalEList<?>)getOneToOnes()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ATTRIBUTES__MANY_TO_MANYS:
+ return ((InternalEList<?>)getManyToManys()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ATTRIBUTES__EMBEDDEDS:
+ return ((InternalEList<?>)getEmbeddeds()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ATTRIBUTES__TRANSIENTS:
+ return ((InternalEList<?>)getTransients()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ATTRIBUTES__IDS:
+ return getIds();
+ case OrmPackage.ATTRIBUTES__EMBEDDED_IDS:
+ return getEmbeddedIds();
+ case OrmPackage.ATTRIBUTES__BASICS:
+ return getBasics();
+ case OrmPackage.ATTRIBUTES__VERSIONS:
+ return getVersions();
+ case OrmPackage.ATTRIBUTES__MANY_TO_ONES:
+ return getManyToOnes();
+ case OrmPackage.ATTRIBUTES__ONE_TO_MANYS:
+ return getOneToManys();
+ case OrmPackage.ATTRIBUTES__ONE_TO_ONES:
+ return getOneToOnes();
+ case OrmPackage.ATTRIBUTES__MANY_TO_MANYS:
+ return getManyToManys();
+ case OrmPackage.ATTRIBUTES__EMBEDDEDS:
+ return getEmbeddeds();
+ case OrmPackage.ATTRIBUTES__TRANSIENTS:
+ return getTransients();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ATTRIBUTES__IDS:
+ getIds().clear();
+ getIds().addAll((Collection<? extends IdImpl>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__EMBEDDED_IDS:
+ getEmbeddedIds().clear();
+ getEmbeddedIds().addAll((Collection<? extends EmbeddedIdImpl>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__BASICS:
+ getBasics().clear();
+ getBasics().addAll((Collection<? extends BasicImpl>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__VERSIONS:
+ getVersions().clear();
+ getVersions().addAll((Collection<? extends VersionImpl>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__MANY_TO_ONES:
+ getManyToOnes().clear();
+ getManyToOnes().addAll((Collection<? extends ManyToOneImpl>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__ONE_TO_MANYS:
+ getOneToManys().clear();
+ getOneToManys().addAll((Collection<? extends OneToManyImpl>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__ONE_TO_ONES:
+ getOneToOnes().clear();
+ getOneToOnes().addAll((Collection<? extends OneToOneImpl>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__MANY_TO_MANYS:
+ getManyToManys().clear();
+ getManyToManys().addAll((Collection<? extends ManyToManyImpl>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__EMBEDDEDS:
+ getEmbeddeds().clear();
+ getEmbeddeds().addAll((Collection<? extends EmbeddedImpl>)newValue);
+ return;
+ case OrmPackage.ATTRIBUTES__TRANSIENTS:
+ getTransients().clear();
+ getTransients().addAll((Collection<? extends TransientImpl>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ATTRIBUTES__IDS:
+ getIds().clear();
+ return;
+ case OrmPackage.ATTRIBUTES__EMBEDDED_IDS:
+ getEmbeddedIds().clear();
+ return;
+ case OrmPackage.ATTRIBUTES__BASICS:
+ getBasics().clear();
+ return;
+ case OrmPackage.ATTRIBUTES__VERSIONS:
+ getVersions().clear();
+ return;
+ case OrmPackage.ATTRIBUTES__MANY_TO_ONES:
+ getManyToOnes().clear();
+ return;
+ case OrmPackage.ATTRIBUTES__ONE_TO_MANYS:
+ getOneToManys().clear();
+ return;
+ case OrmPackage.ATTRIBUTES__ONE_TO_ONES:
+ getOneToOnes().clear();
+ return;
+ case OrmPackage.ATTRIBUTES__MANY_TO_MANYS:
+ getManyToManys().clear();
+ return;
+ case OrmPackage.ATTRIBUTES__EMBEDDEDS:
+ getEmbeddeds().clear();
+ return;
+ case OrmPackage.ATTRIBUTES__TRANSIENTS:
+ getTransients().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ATTRIBUTES__IDS:
+ return ids != null && !ids.isEmpty();
+ case OrmPackage.ATTRIBUTES__EMBEDDED_IDS:
+ return embeddedIds != null && !embeddedIds.isEmpty();
+ case OrmPackage.ATTRIBUTES__BASICS:
+ return basics != null && !basics.isEmpty();
+ case OrmPackage.ATTRIBUTES__VERSIONS:
+ return versions != null && !versions.isEmpty();
+ case OrmPackage.ATTRIBUTES__MANY_TO_ONES:
+ return manyToOnes != null && !manyToOnes.isEmpty();
+ case OrmPackage.ATTRIBUTES__ONE_TO_MANYS:
+ return oneToManys != null && !oneToManys.isEmpty();
+ case OrmPackage.ATTRIBUTES__ONE_TO_ONES:
+ return oneToOnes != null && !oneToOnes.isEmpty();
+ case OrmPackage.ATTRIBUTES__MANY_TO_MANYS:
+ return manyToManys != null && !manyToManys.isEmpty();
+ case OrmPackage.ATTRIBUTES__EMBEDDEDS:
+ return embeddeds != null && !embeddeds.isEmpty();
+ case OrmPackage.ATTRIBUTES__TRANSIENTS:
+ return transients != null && !transients.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+} // Attributes
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IBasic.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Basic.java
index 434bb7de51..39d0f78fb7 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IBasic.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Basic.java
@@ -1,15 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 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.
+ * Copyright (c) 2007, 2008 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.mappings;
+package org.eclipse.jpt.core.internal.resource.orm;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
/**
* <!-- begin-user-doc -->
@@ -19,24 +18,24 @@ import org.eclipse.jpt.core.internal.IAttributeMapping;
* <p>
* The following features are supported:
* <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IBasic#getFetch <em>Fetch</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IBasic#getOptional <em>Optional</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IBasic#getColumn <em>Column</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IBasic#isLob <em>Lob</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IBasic#getTemporal <em>Temporal</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IBasic#getEnumerated <em>Enumerated</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Basic#getFetch <em>Fetch</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Basic#getOptional <em>Optional</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Basic#isLob <em>Lob</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Basic#getTemporal <em>Temporal</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Basic#getEnumerated <em>Enumerated</em>}</li>
* </ul>
* </p>
*
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIBasic()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getBasic()
* @model kind="class" interface="true" abstract="true"
* @generated
*/
-public interface IBasic extends IAttributeMapping, IColumnMapping
+public interface Basic extends AttributeMapping, ColumnMapping
{
/**
* Returns the value of the '<em><b>Fetch</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType}.
+ * The default value is <code>"LAZY"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.FetchType}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Fetch</em>' attribute isn't clear,
@@ -44,28 +43,27 @@ public interface IBasic extends IAttributeMapping, IColumnMapping
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType
- * @see #setFetch(DefaultEagerFetchType)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIBasic_Fetch()
- * @model
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
+ * @see #setFetch(FetchType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getBasic_Fetch()
+ * @model default="LAZY"
* @generated
*/
- DefaultEagerFetchType getFetch();
+ FetchType getFetch();
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IBasic#getFetch <em>Fetch</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Basic#getFetch <em>Fetch</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Fetch</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
* @see #getFetch()
* @generated
*/
- void setFetch(DefaultEagerFetchType value);
+ void setFetch(FetchType value);
/**
* Returns the value of the '<em><b>Optional</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Optional</em>' attribute isn't clear,
@@ -73,39 +71,22 @@ public interface IBasic extends IAttributeMapping, IColumnMapping
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Optional</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
- * @see #setOptional(DefaultTrueBoolean)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIBasic_Optional()
- * @model
+ * @see #setOptional(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getBasic_Optional()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
* @generated
*/
- DefaultTrueBoolean getOptional();
+ Boolean getOptional();
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IBasic#getOptional <em>Optional</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Basic#getOptional <em>Optional</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Optional</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean
* @see #getOptional()
* @generated
*/
- void setOptional(DefaultTrueBoolean value);
-
- /**
- * Returns the value of the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIBasic_Column()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- IColumn getColumn();
+ void setOptional(Boolean value);
/**
* Returns the value of the '<em><b>Lob</b></em>' attribute.
@@ -117,14 +98,14 @@ public interface IBasic extends IAttributeMapping, IColumnMapping
* <!-- end-user-doc -->
* @return the value of the '<em>Lob</em>' attribute.
* @see #setLob(boolean)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIBasic_Lob()
- * @model
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getBasic_Lob()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
* @generated
*/
boolean isLob();
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IBasic#isLob <em>Lob</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Basic#isLob <em>Lob</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Lob</em>' attribute.
@@ -135,28 +116,28 @@ public interface IBasic extends IAttributeMapping, IColumnMapping
/**
* Returns the value of the '<em><b>Temporal</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.TemporalType}.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.TemporalType}.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Temporal</em>' containment reference isn't clear,
+ * If the meaning of the '<em>Temporal</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
+ * @see org.eclipse.jpt.core.internal.resource.orm.TemporalType
* @see #setTemporal(TemporalType)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIBasic_Temporal()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getBasic_Temporal()
* @model
* @generated
*/
TemporalType getTemporal();
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IBasic#getTemporal <em>Temporal</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Basic#getTemporal <em>Temporal</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
+ * @see org.eclipse.jpt.core.internal.resource.orm.TemporalType
* @see #getTemporal()
* @generated
*/
@@ -164,7 +145,7 @@ public interface IBasic extends IAttributeMapping, IColumnMapping
/**
* Returns the value of the '<em><b>Enumerated</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.EnumType}.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.EnumType}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Enumerated</em>' attribute isn't clear,
@@ -172,22 +153,23 @@ public interface IBasic extends IAttributeMapping, IColumnMapping
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Enumerated</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.EnumType
+ * @see org.eclipse.jpt.core.internal.resource.orm.EnumType
* @see #setEnumerated(EnumType)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIBasic_Enumerated()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getBasic_Enumerated()
* @model
* @generated
*/
EnumType getEnumerated();
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IBasic#getEnumerated <em>Enumerated</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Basic#getEnumerated <em>Enumerated</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Enumerated</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.EnumType
+ * @see org.eclipse.jpt.core.internal.resource.orm.EnumType
* @see #getEnumerated()
* @generated
*/
void setEnumerated(EnumType value);
+
} // Basic
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/BasicImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/BasicImpl.java
new file mode 100644
index 0000000000..12091c7028
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/BasicImpl.java
@@ -0,0 +1,660 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Basic Impl</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getBasicImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class BasicImpl extends JpaEObject implements Basic
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumn()
+ * @generated
+ * @ordered
+ */
+ protected Column column;
+
+ /**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final FetchType FETCH_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFetch()
+ * @generated
+ * @ordered
+ */
+ protected FetchType fetch = FETCH_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getOptional() <em>Optional</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOptional()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean OPTIONAL_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getOptional() <em>Optional</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOptional()
+ * @generated
+ * @ordered
+ */
+ protected Boolean optional = OPTIONAL_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #isLob() <em>Lob</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isLob()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean LOB_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isLob() <em>Lob</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isLob()
+ * @generated
+ * @ordered
+ */
+ protected boolean lob = LOB_EDEFAULT;
+
+ /**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final TemporalType TEMPORAL_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTemporal()
+ * @generated
+ * @ordered
+ */
+ protected TemporalType temporal = TEMPORAL_EDEFAULT;
+
+ /**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final EnumType ENUMERATED_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getEnumerated() <em>Enumerated</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEnumerated()
+ * @generated
+ * @ordered
+ */
+ protected EnumType enumerated = ENUMERATED_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected BasicImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.BASIC_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeMapping_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.BasicImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.BASIC_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Column</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Column</em>' containment reference.
+ * @see #setColumn(Column)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumnMapping_Column()
+ * @model containment="true"
+ * @generated
+ */
+ public Column getColumn()
+ {
+ return column;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetColumn(Column newColumn, NotificationChain msgs)
+ {
+ Column oldColumn = column;
+ column = newColumn;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.BASIC_IMPL__COLUMN, oldColumn, newColumn);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.BasicImpl#getColumn <em>Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Column</em>' containment reference.
+ * @see #getColumn()
+ * @generated
+ */
+ public void setColumn(Column newColumn)
+ {
+ if (newColumn != column)
+ {
+ NotificationChain msgs = null;
+ if (column != null)
+ msgs = ((InternalEObject)column).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.BASIC_IMPL__COLUMN, null, msgs);
+ if (newColumn != null)
+ msgs = ((InternalEObject)newColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.BASIC_IMPL__COLUMN, null, msgs);
+ msgs = basicSetColumn(newColumn, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.BASIC_IMPL__COLUMN, newColumn, newColumn));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Fetch</b></em>' attribute.
+ * The default value is <code>"LAZY"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.FetchType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Fetch</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Fetch</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
+ * @see #setFetch(FetchType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getBasic_Fetch()
+ * @model default="LAZY"
+ * @generated
+ */
+ public FetchType getFetch()
+ {
+ return fetch;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.BasicImpl#getFetch <em>Fetch</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Fetch</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
+ * @see #getFetch()
+ * @generated
+ */
+ public void setFetch(FetchType newFetch)
+ {
+ FetchType oldFetch = fetch;
+ fetch = newFetch == null ? FETCH_EDEFAULT : newFetch;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.BASIC_IMPL__FETCH, oldFetch, fetch));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Optional</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Optional</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Optional</em>' attribute.
+ * @see #setOptional(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getBasic_Optional()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getOptional()
+ {
+ return optional;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.BasicImpl#getOptional <em>Optional</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Optional</em>' attribute.
+ * @see #getOptional()
+ * @generated
+ */
+ public void setOptional(Boolean newOptional)
+ {
+ Boolean oldOptional = optional;
+ optional = newOptional;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.BASIC_IMPL__OPTIONAL, oldOptional, optional));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Lob</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Lob</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Lob</em>' attribute.
+ * @see #setLob(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getBasic_Lob()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ public boolean isLob()
+ {
+ return lob;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.BasicImpl#isLob <em>Lob</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Lob</em>' attribute.
+ * @see #isLob()
+ * @generated
+ */
+ public void setLob(boolean newLob)
+ {
+ boolean oldLob = lob;
+ lob = newLob;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.BASIC_IMPL__LOB, oldLob, lob));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Temporal</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.TemporalType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Temporal</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Temporal</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TemporalType
+ * @see #setTemporal(TemporalType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getBasic_Temporal()
+ * @model
+ * @generated
+ */
+ public TemporalType getTemporal()
+ {
+ return temporal;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.BasicImpl#getTemporal <em>Temporal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Temporal</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TemporalType
+ * @see #getTemporal()
+ * @generated
+ */
+ public void setTemporal(TemporalType newTemporal)
+ {
+ TemporalType oldTemporal = temporal;
+ temporal = newTemporal == null ? TEMPORAL_EDEFAULT : newTemporal;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.BASIC_IMPL__TEMPORAL, oldTemporal, temporal));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Enumerated</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.EnumType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Enumerated</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Enumerated</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EnumType
+ * @see #setEnumerated(EnumType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getBasic_Enumerated()
+ * @model
+ * @generated
+ */
+ public EnumType getEnumerated()
+ {
+ return enumerated;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.BasicImpl#getEnumerated <em>Enumerated</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Enumerated</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EnumType
+ * @see #getEnumerated()
+ * @generated
+ */
+ public void setEnumerated(EnumType newEnumerated)
+ {
+ EnumType oldEnumerated = enumerated;
+ enumerated = newEnumerated == null ? ENUMERATED_EDEFAULT : newEnumerated;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.BASIC_IMPL__ENUMERATED, oldEnumerated, enumerated));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.BASIC_IMPL__COLUMN:
+ return basicSetColumn(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.BASIC_IMPL__NAME:
+ return getName();
+ case OrmPackage.BASIC_IMPL__COLUMN:
+ return getColumn();
+ case OrmPackage.BASIC_IMPL__FETCH:
+ return getFetch();
+ case OrmPackage.BASIC_IMPL__OPTIONAL:
+ return getOptional();
+ case OrmPackage.BASIC_IMPL__LOB:
+ return isLob() ? Boolean.TRUE : Boolean.FALSE;
+ case OrmPackage.BASIC_IMPL__TEMPORAL:
+ return getTemporal();
+ case OrmPackage.BASIC_IMPL__ENUMERATED:
+ return getEnumerated();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.BASIC_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.BASIC_IMPL__COLUMN:
+ setColumn((Column)newValue);
+ return;
+ case OrmPackage.BASIC_IMPL__FETCH:
+ setFetch((FetchType)newValue);
+ return;
+ case OrmPackage.BASIC_IMPL__OPTIONAL:
+ setOptional((Boolean)newValue);
+ return;
+ case OrmPackage.BASIC_IMPL__LOB:
+ setLob(((Boolean)newValue).booleanValue());
+ return;
+ case OrmPackage.BASIC_IMPL__TEMPORAL:
+ setTemporal((TemporalType)newValue);
+ return;
+ case OrmPackage.BASIC_IMPL__ENUMERATED:
+ setEnumerated((EnumType)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.BASIC_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.BASIC_IMPL__COLUMN:
+ setColumn((Column)null);
+ return;
+ case OrmPackage.BASIC_IMPL__FETCH:
+ setFetch(FETCH_EDEFAULT);
+ return;
+ case OrmPackage.BASIC_IMPL__OPTIONAL:
+ setOptional(OPTIONAL_EDEFAULT);
+ return;
+ case OrmPackage.BASIC_IMPL__LOB:
+ setLob(LOB_EDEFAULT);
+ return;
+ case OrmPackage.BASIC_IMPL__TEMPORAL:
+ setTemporal(TEMPORAL_EDEFAULT);
+ return;
+ case OrmPackage.BASIC_IMPL__ENUMERATED:
+ setEnumerated(ENUMERATED_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.BASIC_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.BASIC_IMPL__COLUMN:
+ return column != null;
+ case OrmPackage.BASIC_IMPL__FETCH:
+ return fetch != FETCH_EDEFAULT;
+ case OrmPackage.BASIC_IMPL__OPTIONAL:
+ return OPTIONAL_EDEFAULT == null ? optional != null : !OPTIONAL_EDEFAULT.equals(optional);
+ case OrmPackage.BASIC_IMPL__LOB:
+ return lob != LOB_EDEFAULT;
+ case OrmPackage.BASIC_IMPL__TEMPORAL:
+ return temporal != TEMPORAL_EDEFAULT;
+ case OrmPackage.BASIC_IMPL__ENUMERATED:
+ return enumerated != ENUMERATED_EDEFAULT;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == ColumnMapping.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.BASIC_IMPL__COLUMN: return OrmPackage.COLUMN_MAPPING__COLUMN;
+ default: return -1;
+ }
+ }
+ return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == ColumnMapping.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.COLUMN_MAPPING__COLUMN: return OrmPackage.BASIC_IMPL__COLUMN;
+ default: return -1;
+ }
+ }
+ return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", fetch: ");
+ result.append(fetch);
+ result.append(", optional: ");
+ result.append(optional);
+ result.append(", lob: ");
+ result.append(lob);
+ result.append(", temporal: ");
+ result.append(temporal);
+ result.append(", enumerated: ");
+ result.append(enumerated);
+ result.append(')');
+ return result.toString();
+ }
+
+} // BasicImpl
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/CascadeType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/CascadeType.java
new file mode 100644
index 0000000000..27284069c4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/CascadeType.java
@@ -0,0 +1,167 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Cascade Type</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadeAll <em>Cascade All</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadePersist <em>Cascade Persist</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadeMerge <em>Cascade Merge</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadeRemove <em>Cascade Remove</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadeRefresh <em>Cascade Refresh</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getCascadeType()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends IJpaEObject
+ * @generated
+ */
+public interface CascadeType extends IJpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Cascade All</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade All</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cascade All</em>' attribute.
+ * @see #setCascadeAll(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getCascadeType_CascadeAll()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ boolean isCascadeAll();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadeAll <em>Cascade All</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade All</em>' attribute.
+ * @see #isCascadeAll()
+ * @generated
+ */
+ void setCascadeAll(boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Cascade Persist</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade Persist</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cascade Persist</em>' attribute.
+ * @see #setCascadePersist(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getCascadeType_CascadePersist()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ boolean isCascadePersist();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadePersist <em>Cascade Persist</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade Persist</em>' attribute.
+ * @see #isCascadePersist()
+ * @generated
+ */
+ void setCascadePersist(boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Cascade Merge</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade Merge</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cascade Merge</em>' attribute.
+ * @see #setCascadeMerge(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getCascadeType_CascadeMerge()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ boolean isCascadeMerge();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadeMerge <em>Cascade Merge</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade Merge</em>' attribute.
+ * @see #isCascadeMerge()
+ * @generated
+ */
+ void setCascadeMerge(boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Cascade Remove</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade Remove</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cascade Remove</em>' attribute.
+ * @see #setCascadeRemove(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getCascadeType_CascadeRemove()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ boolean isCascadeRemove();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadeRemove <em>Cascade Remove</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade Remove</em>' attribute.
+ * @see #isCascadeRemove()
+ * @generated
+ */
+ void setCascadeRemove(boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Cascade Refresh</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade Refresh</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cascade Refresh</em>' attribute.
+ * @see #setCascadeRefresh(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getCascadeType_CascadeRefresh()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ boolean isCascadeRefresh();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadeRefresh <em>Cascade Refresh</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade Refresh</em>' attribute.
+ * @see #isCascadeRefresh()
+ * @generated
+ */
+ void setCascadeRefresh(boolean value);
+
+} // CascadeType
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/CascadeTypeImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/CascadeTypeImpl.java
new file mode 100644
index 0000000000..a7d4efa0df
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/CascadeTypeImpl.java
@@ -0,0 +1,456 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Cascade Type</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getCascadeTypeImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class CascadeTypeImpl extends JpaEObject implements CascadeType
+{
+ /**
+ * The default value of the '{@link #isCascadeAll() <em>Cascade All</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isCascadeAll()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean CASCADE_ALL_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isCascadeAll() <em>Cascade All</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isCascadeAll()
+ * @generated
+ * @ordered
+ */
+ protected boolean cascadeAll = CASCADE_ALL_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #isCascadePersist() <em>Cascade Persist</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isCascadePersist()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean CASCADE_PERSIST_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isCascadePersist() <em>Cascade Persist</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isCascadePersist()
+ * @generated
+ * @ordered
+ */
+ protected boolean cascadePersist = CASCADE_PERSIST_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #isCascadeMerge() <em>Cascade Merge</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isCascadeMerge()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean CASCADE_MERGE_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isCascadeMerge() <em>Cascade Merge</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isCascadeMerge()
+ * @generated
+ * @ordered
+ */
+ protected boolean cascadeMerge = CASCADE_MERGE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #isCascadeRemove() <em>Cascade Remove</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isCascadeRemove()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean CASCADE_REMOVE_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isCascadeRemove() <em>Cascade Remove</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isCascadeRemove()
+ * @generated
+ * @ordered
+ */
+ protected boolean cascadeRemove = CASCADE_REMOVE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #isCascadeRefresh() <em>Cascade Refresh</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isCascadeRefresh()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean CASCADE_REFRESH_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isCascadeRefresh() <em>Cascade Refresh</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isCascadeRefresh()
+ * @generated
+ * @ordered
+ */
+ protected boolean cascadeRefresh = CASCADE_REFRESH_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected CascadeTypeImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.CASCADE_TYPE_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Cascade All</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade All</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cascade All</em>' attribute.
+ * @see #setCascadeAll(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getCascadeType_CascadeAll()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ public boolean isCascadeAll()
+ {
+ return cascadeAll;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeTypeImpl#isCascadeAll <em>Cascade All</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade All</em>' attribute.
+ * @see #isCascadeAll()
+ * @generated
+ */
+ public void setCascadeAll(boolean newCascadeAll)
+ {
+ boolean oldCascadeAll = cascadeAll;
+ cascadeAll = newCascadeAll;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.CASCADE_TYPE_IMPL__CASCADE_ALL, oldCascadeAll, cascadeAll));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Cascade Persist</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade Persist</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cascade Persist</em>' attribute.
+ * @see #setCascadePersist(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getCascadeType_CascadePersist()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ public boolean isCascadePersist()
+ {
+ return cascadePersist;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeTypeImpl#isCascadePersist <em>Cascade Persist</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade Persist</em>' attribute.
+ * @see #isCascadePersist()
+ * @generated
+ */
+ public void setCascadePersist(boolean newCascadePersist)
+ {
+ boolean oldCascadePersist = cascadePersist;
+ cascadePersist = newCascadePersist;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.CASCADE_TYPE_IMPL__CASCADE_PERSIST, oldCascadePersist, cascadePersist));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Cascade Merge</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade Merge</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cascade Merge</em>' attribute.
+ * @see #setCascadeMerge(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getCascadeType_CascadeMerge()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ public boolean isCascadeMerge()
+ {
+ return cascadeMerge;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeTypeImpl#isCascadeMerge <em>Cascade Merge</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade Merge</em>' attribute.
+ * @see #isCascadeMerge()
+ * @generated
+ */
+ public void setCascadeMerge(boolean newCascadeMerge)
+ {
+ boolean oldCascadeMerge = cascadeMerge;
+ cascadeMerge = newCascadeMerge;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.CASCADE_TYPE_IMPL__CASCADE_MERGE, oldCascadeMerge, cascadeMerge));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Cascade Remove</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade Remove</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cascade Remove</em>' attribute.
+ * @see #setCascadeRemove(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getCascadeType_CascadeRemove()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ public boolean isCascadeRemove()
+ {
+ return cascadeRemove;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeTypeImpl#isCascadeRemove <em>Cascade Remove</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade Remove</em>' attribute.
+ * @see #isCascadeRemove()
+ * @generated
+ */
+ public void setCascadeRemove(boolean newCascadeRemove)
+ {
+ boolean oldCascadeRemove = cascadeRemove;
+ cascadeRemove = newCascadeRemove;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.CASCADE_TYPE_IMPL__CASCADE_REMOVE, oldCascadeRemove, cascadeRemove));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Cascade Refresh</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade Refresh</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cascade Refresh</em>' attribute.
+ * @see #setCascadeRefresh(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getCascadeType_CascadeRefresh()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ public boolean isCascadeRefresh()
+ {
+ return cascadeRefresh;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeTypeImpl#isCascadeRefresh <em>Cascade Refresh</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade Refresh</em>' attribute.
+ * @see #isCascadeRefresh()
+ * @generated
+ */
+ public void setCascadeRefresh(boolean newCascadeRefresh)
+ {
+ boolean oldCascadeRefresh = cascadeRefresh;
+ cascadeRefresh = newCascadeRefresh;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.CASCADE_TYPE_IMPL__CASCADE_REFRESH, oldCascadeRefresh, cascadeRefresh));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_ALL:
+ return isCascadeAll() ? Boolean.TRUE : Boolean.FALSE;
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_PERSIST:
+ return isCascadePersist() ? Boolean.TRUE : Boolean.FALSE;
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_MERGE:
+ return isCascadeMerge() ? Boolean.TRUE : Boolean.FALSE;
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_REMOVE:
+ return isCascadeRemove() ? Boolean.TRUE : Boolean.FALSE;
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_REFRESH:
+ return isCascadeRefresh() ? Boolean.TRUE : Boolean.FALSE;
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_ALL:
+ setCascadeAll(((Boolean)newValue).booleanValue());
+ return;
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_PERSIST:
+ setCascadePersist(((Boolean)newValue).booleanValue());
+ return;
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_MERGE:
+ setCascadeMerge(((Boolean)newValue).booleanValue());
+ return;
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_REMOVE:
+ setCascadeRemove(((Boolean)newValue).booleanValue());
+ return;
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_REFRESH:
+ setCascadeRefresh(((Boolean)newValue).booleanValue());
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_ALL:
+ setCascadeAll(CASCADE_ALL_EDEFAULT);
+ return;
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_PERSIST:
+ setCascadePersist(CASCADE_PERSIST_EDEFAULT);
+ return;
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_MERGE:
+ setCascadeMerge(CASCADE_MERGE_EDEFAULT);
+ return;
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_REMOVE:
+ setCascadeRemove(CASCADE_REMOVE_EDEFAULT);
+ return;
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_REFRESH:
+ setCascadeRefresh(CASCADE_REFRESH_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_ALL:
+ return cascadeAll != CASCADE_ALL_EDEFAULT;
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_PERSIST:
+ return cascadePersist != CASCADE_PERSIST_EDEFAULT;
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_MERGE:
+ return cascadeMerge != CASCADE_MERGE_EDEFAULT;
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_REMOVE:
+ return cascadeRemove != CASCADE_REMOVE_EDEFAULT;
+ case OrmPackage.CASCADE_TYPE_IMPL__CASCADE_REFRESH:
+ return cascadeRefresh != CASCADE_REFRESH_EDEFAULT;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (cascadeAll: ");
+ result.append(cascadeAll);
+ result.append(", cascadePersist: ");
+ result.append(cascadePersist);
+ result.append(", cascadeMerge: ");
+ result.append(cascadeMerge);
+ result.append(", cascadeRemove: ");
+ result.append(cascadeRemove);
+ result.append(", cascadeRefresh: ");
+ result.append(cascadeRefresh);
+ result.append(')');
+ return result.toString();
+ }
+
+} // CascadeType
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Column.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Column.java
new file mode 100644
index 0000000000..eaa1311fd6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Column.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Column</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Column#getLength <em>Length</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Column#getPrecision <em>Precision</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Column#getScale <em>Scale</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumn()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface Column extends AbstractColumn
+{
+ /**
+ * Returns the value of the '<em><b>Length</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Length</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Length</em>' attribute.
+ * @see #setLength(Integer)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumn_Length()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.IntObject"
+ * @generated
+ */
+ Integer getLength();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Column#getLength <em>Length</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Length</em>' attribute.
+ * @see #getLength()
+ * @generated
+ */
+ void setLength(Integer value);
+
+ /**
+ * Returns the value of the '<em><b>Precision</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Precision</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Precision</em>' attribute.
+ * @see #setPrecision(Integer)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumn_Precision()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.IntObject"
+ * @generated
+ */
+ Integer getPrecision();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Column#getPrecision <em>Precision</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Precision</em>' attribute.
+ * @see #getPrecision()
+ * @generated
+ */
+ void setPrecision(Integer value);
+
+ /**
+ * Returns the value of the '<em><b>Scale</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Scale</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Scale</em>' attribute.
+ * @see #setScale(Integer)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumn_Scale()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.IntObject"
+ * @generated
+ */
+ Integer getScale();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Column#getScale <em>Scale</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Scale</em>' attribute.
+ * @see #getScale()
+ * @generated
+ */
+ void setScale(Integer value);
+
+} // Column
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ColumnImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ColumnImpl.java
new file mode 100644
index 0000000000..55bfc9192e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ColumnImpl.java
@@ -0,0 +1,794 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Column Impl</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumnImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class ColumnImpl extends JpaEObject implements Column
+{
+ /**
+ * The default value of the '{@link #getColumnDefinition() <em>Column Definition</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumnDefinition()
+ * @generated
+ * @ordered
+ */
+ protected static final String COLUMN_DEFINITION_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getColumnDefinition() <em>Column Definition</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumnDefinition()
+ * @generated
+ * @ordered
+ */
+ protected String columnDefinition = COLUMN_DEFINITION_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getInsertable() <em>Insertable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInsertable()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean INSERTABLE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getInsertable() <em>Insertable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInsertable()
+ * @generated
+ * @ordered
+ */
+ protected Boolean insertable = INSERTABLE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getNullable() <em>Nullable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getNullable()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean NULLABLE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getNullable() <em>Nullable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getNullable()
+ * @generated
+ * @ordered
+ */
+ protected Boolean nullable = NULLABLE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getTable() <em>Table</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTable()
+ * @generated
+ * @ordered
+ */
+ protected static final String TABLE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTable() <em>Table</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTable()
+ * @generated
+ * @ordered
+ */
+ protected String table = TABLE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getUnique() <em>Unique</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getUnique()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean UNIQUE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getUnique() <em>Unique</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getUnique()
+ * @generated
+ * @ordered
+ */
+ protected Boolean unique = UNIQUE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getUpdatable() <em>Updatable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getUpdatable()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean UPDATABLE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getUpdatable() <em>Updatable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getUpdatable()
+ * @generated
+ * @ordered
+ */
+ protected Boolean updatable = UPDATABLE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getLength() <em>Length</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLength()
+ * @generated
+ * @ordered
+ */
+ protected static final Integer LENGTH_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getLength() <em>Length</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLength()
+ * @generated
+ * @ordered
+ */
+ protected Integer length = LENGTH_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getPrecision() <em>Precision</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPrecision()
+ * @generated
+ * @ordered
+ */
+ protected static final Integer PRECISION_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getPrecision() <em>Precision</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPrecision()
+ * @generated
+ * @ordered
+ */
+ protected Integer precision = PRECISION_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getScale() <em>Scale</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getScale()
+ * @generated
+ * @ordered
+ */
+ protected static final Integer SCALE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getScale() <em>Scale</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getScale()
+ * @generated
+ * @ordered
+ */
+ protected Integer scale = SCALE_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ColumnImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.COLUMN_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Column Definition</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Column Definition</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Column Definition</em>' attribute.
+ * @see #setColumnDefinition(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedColumn_ColumnDefinition()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getColumnDefinition()
+ {
+ return columnDefinition;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnImpl#getColumnDefinition <em>Column Definition</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Column Definition</em>' attribute.
+ * @see #getColumnDefinition()
+ * @generated
+ */
+ public void setColumnDefinition(String newColumnDefinition)
+ {
+ String oldColumnDefinition = columnDefinition;
+ columnDefinition = newColumnDefinition;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.COLUMN_IMPL__COLUMN_DEFINITION, oldColumnDefinition, columnDefinition));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedColumn_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.COLUMN_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Insertable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Insertable</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Insertable</em>' attribute.
+ * @see #setInsertable(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn_Insertable()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getInsertable()
+ {
+ return insertable;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnImpl#getInsertable <em>Insertable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Insertable</em>' attribute.
+ * @see #getInsertable()
+ * @generated
+ */
+ public void setInsertable(Boolean newInsertable)
+ {
+ Boolean oldInsertable = insertable;
+ insertable = newInsertable;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.COLUMN_IMPL__INSERTABLE, oldInsertable, insertable));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Nullable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Nullable</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Nullable</em>' attribute.
+ * @see #setNullable(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn_Nullable()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getNullable()
+ {
+ return nullable;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnImpl#getNullable <em>Nullable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Nullable</em>' attribute.
+ * @see #getNullable()
+ * @generated
+ */
+ public void setNullable(Boolean newNullable)
+ {
+ Boolean oldNullable = nullable;
+ nullable = newNullable;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.COLUMN_IMPL__NULLABLE, oldNullable, nullable));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Table</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Table</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Table</em>' attribute.
+ * @see #setTable(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn_Table()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getTable()
+ {
+ return table;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnImpl#getTable <em>Table</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Table</em>' attribute.
+ * @see #getTable()
+ * @generated
+ */
+ public void setTable(String newTable)
+ {
+ String oldTable = table;
+ table = newTable;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.COLUMN_IMPL__TABLE, oldTable, table));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Unique</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Unique</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Unique</em>' attribute.
+ * @see #setUnique(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn_Unique()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getUnique()
+ {
+ return unique;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnImpl#getUnique <em>Unique</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Unique</em>' attribute.
+ * @see #getUnique()
+ * @generated
+ */
+ public void setUnique(Boolean newUnique)
+ {
+ Boolean oldUnique = unique;
+ unique = newUnique;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.COLUMN_IMPL__UNIQUE, oldUnique, unique));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Updatable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Updatable</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Updatable</em>' attribute.
+ * @see #setUpdatable(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn_Updatable()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getUpdatable()
+ {
+ return updatable;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnImpl#getUpdatable <em>Updatable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Updatable</em>' attribute.
+ * @see #getUpdatable()
+ * @generated
+ */
+ public void setUpdatable(Boolean newUpdatable)
+ {
+ Boolean oldUpdatable = updatable;
+ updatable = newUpdatable;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.COLUMN_IMPL__UPDATABLE, oldUpdatable, updatable));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Length</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Length</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Length</em>' attribute.
+ * @see #setLength(Integer)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumn_Length()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.IntObject"
+ * @generated
+ */
+ public Integer getLength()
+ {
+ return length;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnImpl#getLength <em>Length</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Length</em>' attribute.
+ * @see #getLength()
+ * @generated
+ */
+ public void setLength(Integer newLength)
+ {
+ Integer oldLength = length;
+ length = newLength;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.COLUMN_IMPL__LENGTH, oldLength, length));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Precision</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Precision</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Precision</em>' attribute.
+ * @see #setPrecision(Integer)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumn_Precision()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.IntObject"
+ * @generated
+ */
+ public Integer getPrecision()
+ {
+ return precision;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnImpl#getPrecision <em>Precision</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Precision</em>' attribute.
+ * @see #getPrecision()
+ * @generated
+ */
+ public void setPrecision(Integer newPrecision)
+ {
+ Integer oldPrecision = precision;
+ precision = newPrecision;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.COLUMN_IMPL__PRECISION, oldPrecision, precision));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Scale</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Scale</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Scale</em>' attribute.
+ * @see #setScale(Integer)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumn_Scale()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.IntObject"
+ * @generated
+ */
+ public Integer getScale()
+ {
+ return scale;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnImpl#getScale <em>Scale</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Scale</em>' attribute.
+ * @see #getScale()
+ * @generated
+ */
+ public void setScale(Integer newScale)
+ {
+ Integer oldScale = scale;
+ scale = newScale;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.COLUMN_IMPL__SCALE, oldScale, scale));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.COLUMN_IMPL__COLUMN_DEFINITION:
+ return getColumnDefinition();
+ case OrmPackage.COLUMN_IMPL__NAME:
+ return getName();
+ case OrmPackage.COLUMN_IMPL__INSERTABLE:
+ return getInsertable();
+ case OrmPackage.COLUMN_IMPL__NULLABLE:
+ return getNullable();
+ case OrmPackage.COLUMN_IMPL__TABLE:
+ return getTable();
+ case OrmPackage.COLUMN_IMPL__UNIQUE:
+ return getUnique();
+ case OrmPackage.COLUMN_IMPL__UPDATABLE:
+ return getUpdatable();
+ case OrmPackage.COLUMN_IMPL__LENGTH:
+ return getLength();
+ case OrmPackage.COLUMN_IMPL__PRECISION:
+ return getPrecision();
+ case OrmPackage.COLUMN_IMPL__SCALE:
+ return getScale();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.COLUMN_IMPL__COLUMN_DEFINITION:
+ setColumnDefinition((String)newValue);
+ return;
+ case OrmPackage.COLUMN_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.COLUMN_IMPL__INSERTABLE:
+ setInsertable((Boolean)newValue);
+ return;
+ case OrmPackage.COLUMN_IMPL__NULLABLE:
+ setNullable((Boolean)newValue);
+ return;
+ case OrmPackage.COLUMN_IMPL__TABLE:
+ setTable((String)newValue);
+ return;
+ case OrmPackage.COLUMN_IMPL__UNIQUE:
+ setUnique((Boolean)newValue);
+ return;
+ case OrmPackage.COLUMN_IMPL__UPDATABLE:
+ setUpdatable((Boolean)newValue);
+ return;
+ case OrmPackage.COLUMN_IMPL__LENGTH:
+ setLength((Integer)newValue);
+ return;
+ case OrmPackage.COLUMN_IMPL__PRECISION:
+ setPrecision((Integer)newValue);
+ return;
+ case OrmPackage.COLUMN_IMPL__SCALE:
+ setScale((Integer)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.COLUMN_IMPL__COLUMN_DEFINITION:
+ setColumnDefinition(COLUMN_DEFINITION_EDEFAULT);
+ return;
+ case OrmPackage.COLUMN_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.COLUMN_IMPL__INSERTABLE:
+ setInsertable(INSERTABLE_EDEFAULT);
+ return;
+ case OrmPackage.COLUMN_IMPL__NULLABLE:
+ setNullable(NULLABLE_EDEFAULT);
+ return;
+ case OrmPackage.COLUMN_IMPL__TABLE:
+ setTable(TABLE_EDEFAULT);
+ return;
+ case OrmPackage.COLUMN_IMPL__UNIQUE:
+ setUnique(UNIQUE_EDEFAULT);
+ return;
+ case OrmPackage.COLUMN_IMPL__UPDATABLE:
+ setUpdatable(UPDATABLE_EDEFAULT);
+ return;
+ case OrmPackage.COLUMN_IMPL__LENGTH:
+ setLength(LENGTH_EDEFAULT);
+ return;
+ case OrmPackage.COLUMN_IMPL__PRECISION:
+ setPrecision(PRECISION_EDEFAULT);
+ return;
+ case OrmPackage.COLUMN_IMPL__SCALE:
+ setScale(SCALE_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.COLUMN_IMPL__COLUMN_DEFINITION:
+ return COLUMN_DEFINITION_EDEFAULT == null ? columnDefinition != null : !COLUMN_DEFINITION_EDEFAULT.equals(columnDefinition);
+ case OrmPackage.COLUMN_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.COLUMN_IMPL__INSERTABLE:
+ return INSERTABLE_EDEFAULT == null ? insertable != null : !INSERTABLE_EDEFAULT.equals(insertable);
+ case OrmPackage.COLUMN_IMPL__NULLABLE:
+ return NULLABLE_EDEFAULT == null ? nullable != null : !NULLABLE_EDEFAULT.equals(nullable);
+ case OrmPackage.COLUMN_IMPL__TABLE:
+ return TABLE_EDEFAULT == null ? table != null : !TABLE_EDEFAULT.equals(table);
+ case OrmPackage.COLUMN_IMPL__UNIQUE:
+ return UNIQUE_EDEFAULT == null ? unique != null : !UNIQUE_EDEFAULT.equals(unique);
+ case OrmPackage.COLUMN_IMPL__UPDATABLE:
+ return UPDATABLE_EDEFAULT == null ? updatable != null : !UPDATABLE_EDEFAULT.equals(updatable);
+ case OrmPackage.COLUMN_IMPL__LENGTH:
+ return LENGTH_EDEFAULT == null ? length != null : !LENGTH_EDEFAULT.equals(length);
+ case OrmPackage.COLUMN_IMPL__PRECISION:
+ return PRECISION_EDEFAULT == null ? precision != null : !PRECISION_EDEFAULT.equals(precision);
+ case OrmPackage.COLUMN_IMPL__SCALE:
+ return SCALE_EDEFAULT == null ? scale != null : !SCALE_EDEFAULT.equals(scale);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (columnDefinition: ");
+ result.append(columnDefinition);
+ result.append(", name: ");
+ result.append(name);
+ result.append(", insertable: ");
+ result.append(insertable);
+ result.append(", nullable: ");
+ result.append(nullable);
+ result.append(", table: ");
+ result.append(table);
+ result.append(", unique: ");
+ result.append(unique);
+ result.append(", updatable: ");
+ result.append(updatable);
+ result.append(", length: ");
+ result.append(length);
+ result.append(", precision: ");
+ result.append(precision);
+ result.append(", scale: ");
+ result.append(scale);
+ result.append(')');
+ return result.toString();
+ }
+
+} // ColumnImpl
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ColumnMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ColumnMapping.java
new file mode 100644
index 0000000000..8d9f7866c7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ColumnMapping.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Column Mapping</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.ColumnMapping#getColumn <em>Column</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumnMapping()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends IJpaEObject
+ * @generated
+ */
+public interface ColumnMapping extends IJpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Column</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Column</em>' containment reference.
+ * @see #setColumn(Column)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumnMapping_Column()
+ * @model containment="true"
+ * @generated
+ */
+ Column getColumn();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnMapping#getColumn <em>Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Column</em>' containment reference.
+ * @see #getColumn()
+ * @generated
+ */
+ void setColumn(Column value);
+
+} // ColumnMapping
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMapKey.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ColumnResult.java
index c2a9fa38ff..eccbb8573a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlMapKey.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ColumnResult.java
@@ -1,42 +1,38 @@
/*******************************************************************************
* Copyright (c) 2007 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.
+ * 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.content.orm;
+package org.eclipse.jpt.core.internal.resource.orm;
-import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.XmlEObject;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
/**
* <!-- begin-user-doc -->
- * This class is purely used to hack around a problem with the translators and representing
- * the IMultiRelationshipMapping.mapKey feature in the xml. Added this object to correspend to the
- * map-key type in the xml since the translator path approach caused the map-key element
- * to be added even when the mapKey String was null. This occurred when you added a new 1-m or m-m
- * mapping to the orm.xml via the structure view.
+ * A representation of the model object '<em><b>Column Result</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.orm.XmlMapKey#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.ColumnResult#getName <em>Name</em>}</li>
* </ul>
* </p>
*
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMapKey()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumnResult()
* @model kind="class"
+ * @extends IJpaEObject
* @generated
*/
-public class XmlMapKey extends XmlEObject
+public class ColumnResult extends JpaEObject implements IJpaEObject
{
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
@@ -58,36 +54,14 @@ public class XmlMapKey extends XmlEObject
*/
protected String name = NAME_EDEFAULT;
- protected XmlMapKey() {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ColumnResult()
+ {
super();
- this.eAdapters().add(this.buildListener());
- }
-
- protected Adapter buildListener() {
- return new AdapterImpl() {
- @Override
- public void notifyChanged(Notification notification) {
- XmlMapKey.this.notifyChanged(notification);
- }
- };
- }
-
- protected void notifyChanged(Notification notification) {
- switch (notification.getFeatureID(XmlMapKey.class)) {
- case OrmPackage.XML_MAP_KEY__NAME :
- nameChanged();
- break;
- default :
- break;
- }
- }
-
- private XmlMultiRelationshipMapping xmlMultiRelationshipMapping() {
- return (XmlMultiRelationshipMapping) eContainer();
- }
-
- protected void nameChanged() {
- xmlMultiRelationshipMapping().setMapKey(getName());
}
/**
@@ -96,8 +70,9 @@ public class XmlMapKey extends XmlEObject
* @generated
*/
@Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_MAP_KEY;
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.COLUMN_RESULT;
}
/**
@@ -110,27 +85,29 @@ public class XmlMapKey extends XmlEObject
* <!-- end-user-doc -->
* @return the value of the '<em>Name</em>' attribute.
* @see #setName(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlMapKey_Name()
- * @model
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumnResult_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
* @generated
*/
- public String getName() {
+ public String getName()
+ {
return name;
}
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlMapKey#getName <em>Name</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnResult#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
* @see #getName()
* @generated
*/
- public void setName(String newName) {
+ public void setName(String newName)
+ {
String oldName = name;
name = newName;
if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_MAP_KEY__NAME, oldName, name));
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.COLUMN_RESULT__NAME, oldName, name));
}
/**
@@ -139,9 +116,11 @@ public class XmlMapKey extends XmlEObject
* @generated
*/
@Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_MAP_KEY__NAME :
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.COLUMN_RESULT__NAME:
return getName();
}
return super.eGet(featureID, resolve, coreType);
@@ -153,10 +132,12 @@ public class XmlMapKey extends XmlEObject
* @generated
*/
@Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_MAP_KEY__NAME :
- setName((String) newValue);
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.COLUMN_RESULT__NAME:
+ setName((String)newValue);
return;
}
super.eSet(featureID, newValue);
@@ -168,9 +149,11 @@ public class XmlMapKey extends XmlEObject
* @generated
*/
@Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_MAP_KEY__NAME :
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.COLUMN_RESULT__NAME:
setName(NAME_EDEFAULT);
return;
}
@@ -183,9 +166,11 @@ public class XmlMapKey extends XmlEObject
* @generated
*/
@Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_MAP_KEY__NAME :
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.COLUMN_RESULT__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
}
return super.eIsSet(featureID);
@@ -197,13 +182,15 @@ public class XmlMapKey extends XmlEObject
* @generated
*/
@Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
StringBuffer result = new StringBuffer(super.toString());
result.append(" (name: ");
result.append(name);
result.append(')');
return result.toString();
}
-} // XmlMapKey
+
+} // ColumnResult
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/DiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/DiscriminatorColumn.java
new file mode 100644
index 0000000000..363a4f004b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/DiscriminatorColumn.java
@@ -0,0 +1,396 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Discriminator Column</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn#getDiscriminatorType <em>Discriminator Type</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn#getLength <em>Length</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getDiscriminatorColumn()
+ * @model kind="class"
+ * @generated
+ */
+public class DiscriminatorColumn extends JpaEObject implements NamedColumn
+{
+ /**
+ * The default value of the '{@link #getColumnDefinition() <em>Column Definition</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumnDefinition()
+ * @generated
+ * @ordered
+ */
+ protected static final String COLUMN_DEFINITION_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getColumnDefinition() <em>Column Definition</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumnDefinition()
+ * @generated
+ * @ordered
+ */
+ protected String columnDefinition = COLUMN_DEFINITION_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final DiscriminatorType DISCRIMINATOR_TYPE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getDiscriminatorType() <em>Discriminator Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDiscriminatorType()
+ * @generated
+ * @ordered
+ */
+ protected DiscriminatorType discriminatorType = DISCRIMINATOR_TYPE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getLength() <em>Length</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLength()
+ * @generated
+ * @ordered
+ */
+ protected static final Integer LENGTH_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getLength() <em>Length</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLength()
+ * @generated
+ * @ordered
+ */
+ protected Integer length = LENGTH_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected DiscriminatorColumn()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.DISCRIMINATOR_COLUMN;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Column Definition</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Column Definition</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Column Definition</em>' attribute.
+ * @see #setColumnDefinition(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedColumn_ColumnDefinition()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getColumnDefinition()
+ {
+ return columnDefinition;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn#getColumnDefinition <em>Column Definition</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Column Definition</em>' attribute.
+ * @see #getColumnDefinition()
+ * @generated
+ */
+ public void setColumnDefinition(String newColumnDefinition)
+ {
+ String oldColumnDefinition = columnDefinition;
+ columnDefinition = newColumnDefinition;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION, oldColumnDefinition, columnDefinition));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Discriminator Type</b></em>' attribute.
+ * The default value is <code>"STRING"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Discriminator Type</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Discriminator Type</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType
+ * @see #setDiscriminatorType(DiscriminatorType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getDiscriminatorColumn_DiscriminatorType()
+ * @model default="STRING"
+ * @generated
+ */
+ public DiscriminatorType getDiscriminatorType()
+ {
+ return discriminatorType;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn#getDiscriminatorType <em>Discriminator Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Discriminator Type</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType
+ * @see #getDiscriminatorType()
+ * @generated
+ */
+ public void setDiscriminatorType(DiscriminatorType newDiscriminatorType)
+ {
+ DiscriminatorType oldDiscriminatorType = discriminatorType;
+ discriminatorType = newDiscriminatorType == null ? DISCRIMINATOR_TYPE_EDEFAULT : newDiscriminatorType;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE, oldDiscriminatorType, discriminatorType));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Length</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Length</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Length</em>' attribute.
+ * @see #setLength(Integer)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getDiscriminatorColumn_Length()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.IntObject"
+ * @generated
+ */
+ public Integer getLength()
+ {
+ return length;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn#getLength <em>Length</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Length</em>' attribute.
+ * @see #getLength()
+ * @generated
+ */
+ public void setLength(Integer newLength)
+ {
+ Integer oldLength = length;
+ length = newLength;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.DISCRIMINATOR_COLUMN__LENGTH, oldLength, length));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedColumn_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.DISCRIMINATOR_COLUMN__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION:
+ return getColumnDefinition();
+ case OrmPackage.DISCRIMINATOR_COLUMN__NAME:
+ return getName();
+ case OrmPackage.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE:
+ return getDiscriminatorType();
+ case OrmPackage.DISCRIMINATOR_COLUMN__LENGTH:
+ return getLength();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION:
+ setColumnDefinition((String)newValue);
+ return;
+ case OrmPackage.DISCRIMINATOR_COLUMN__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE:
+ setDiscriminatorType((DiscriminatorType)newValue);
+ return;
+ case OrmPackage.DISCRIMINATOR_COLUMN__LENGTH:
+ setLength((Integer)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION:
+ setColumnDefinition(COLUMN_DEFINITION_EDEFAULT);
+ return;
+ case OrmPackage.DISCRIMINATOR_COLUMN__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE:
+ setDiscriminatorType(DISCRIMINATOR_TYPE_EDEFAULT);
+ return;
+ case OrmPackage.DISCRIMINATOR_COLUMN__LENGTH:
+ setLength(LENGTH_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION:
+ return COLUMN_DEFINITION_EDEFAULT == null ? columnDefinition != null : !COLUMN_DEFINITION_EDEFAULT.equals(columnDefinition);
+ case OrmPackage.DISCRIMINATOR_COLUMN__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE:
+ return discriminatorType != DISCRIMINATOR_TYPE_EDEFAULT;
+ case OrmPackage.DISCRIMINATOR_COLUMN__LENGTH:
+ return LENGTH_EDEFAULT == null ? length != null : !LENGTH_EDEFAULT.equals(length);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (columnDefinition: ");
+ result.append(columnDefinition);
+ result.append(", name: ");
+ result.append(name);
+ result.append(", discriminatorType: ");
+ result.append(discriminatorType);
+ result.append(", length: ");
+ result.append(length);
+ result.append(')');
+ return result.toString();
+ }
+
+} // DiscriminatorColumn
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DiscriminatorType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/DiscriminatorType.java
index 77811e98a3..d2773d8b83 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/DiscriminatorType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/DiscriminatorType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007 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.
@@ -7,33 +7,24 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.mappings;
+package org.eclipse.jpt.core.internal.resource.orm;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.eclipse.emf.common.util.Enumerator;
-import org.eclipse.jpt.core.internal.content.java.mappings.JPA;
/**
* <!-- begin-user-doc -->
* A representation of the literals of the enumeration '<em><b>Discriminator Type</b></em>',
* and utility methods for working with them.
* <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getDiscriminatorType()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getDiscriminatorType()
* @model
* @generated
*/
-public enum DiscriminatorType implements Enumerator {
- /**
- * The '<em><b>Default</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #DEFAULT_VALUE
- * @generated
- * @ordered
- */
- DEFAULT(0, "Default", "Default (String)"),
+public enum DiscriminatorType implements Enumerator
+{
/**
* The '<em><b>STRING</b></em>' literal object.
* <!-- begin-user-doc -->
@@ -42,7 +33,8 @@ public enum DiscriminatorType implements Enumerator {
* @generated
* @ordered
*/
- STRING(1, "STRING", "String"),
+ STRING(0, "STRING", "STRING"),
+
/**
* The '<em><b>CHAR</b></em>' literal object.
* <!-- begin-user-doc -->
@@ -51,7 +43,8 @@ public enum DiscriminatorType implements Enumerator {
* @generated
* @ordered
*/
- CHAR(2, "CHAR", "Char"),
+ CHAR(1, "CHAR", "CHAR"),
+
/**
* The '<em><b>INTEGER</b></em>' literal object.
* <!-- begin-user-doc -->
@@ -60,66 +53,52 @@ public enum DiscriminatorType implements Enumerator {
* @generated
* @ordered
*/
- INTEGER(3, "INTEGER", "Integer");
- /**
- * The '<em><b>Default</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>Default</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #DEFAULT
- * @model name="Default" literal="Default (String)"
- * @generated
- * @ordered
- */
- public static final int DEFAULT_VALUE = 0;
+ INTEGER(2, "INTEGER", "INTEGER");
/**
* The '<em><b>STRING</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of '<em><b>String</b></em>' literal object isn't clear,
+ * If the meaning of '<em><b>STRING</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #STRING
- * @model literal="String"
+ * @model
* @generated
* @ordered
*/
- public static final int STRING_VALUE = 1;
+ public static final int STRING_VALUE = 0;
/**
* The '<em><b>CHAR</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of '<em><b>Char</b></em>' literal object isn't clear,
+ * If the meaning of '<em><b>CHAR</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #CHAR
- * @model literal="Char"
+ * @model
* @generated
* @ordered
*/
- public static final int CHAR_VALUE = 2;
+ public static final int CHAR_VALUE = 1;
/**
* The '<em><b>INTEGER</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of '<em><b>Integer</b></em>' literal object isn't clear,
+ * If the meaning of '<em><b>INTEGER</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #INTEGER
- * @model literal="Integer"
+ * @model
* @generated
* @ordered
*/
- public static final int INTEGER_VALUE = 3;
+ public static final int INTEGER_VALUE = 2;
/**
* An array of all the '<em><b>Discriminator Type</b></em>' enumerators.
@@ -127,9 +106,13 @@ public enum DiscriminatorType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- private static final DiscriminatorType[] VALUES_ARRAY = new DiscriminatorType[] {
- DEFAULT, STRING, CHAR, INTEGER,
- };
+ private static final DiscriminatorType[] VALUES_ARRAY =
+ new DiscriminatorType[]
+ {
+ STRING,
+ CHAR,
+ INTEGER,
+ };
/**
* A public read-only list of all the '<em><b>Discriminator Type</b></em>' enumerators.
@@ -145,10 +128,13 @@ public enum DiscriminatorType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static DiscriminatorType get(String literal) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ public static DiscriminatorType get(String literal)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
DiscriminatorType result = VALUES_ARRAY[i];
- if (result.toString().equals(literal)) {
+ if (result.toString().equals(literal))
+ {
return result;
}
}
@@ -161,10 +147,13 @@ public enum DiscriminatorType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static DiscriminatorType getByName(String name) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ public static DiscriminatorType getByName(String name)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
DiscriminatorType result = VALUES_ARRAY[i];
- if (result.getName().equals(name)) {
+ if (result.getName().equals(name))
+ {
return result;
}
}
@@ -177,16 +166,13 @@ public enum DiscriminatorType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static DiscriminatorType get(int value) {
- switch (value) {
- case DEFAULT_VALUE :
- return DEFAULT;
- case STRING_VALUE :
- return STRING;
- case CHAR_VALUE :
- return CHAR;
- case INTEGER_VALUE :
- return INTEGER;
+ public static DiscriminatorType get(int value)
+ {
+ switch (value)
+ {
+ case STRING_VALUE: return STRING;
+ case CHAR_VALUE: return CHAR;
+ case INTEGER_VALUE: return INTEGER;
}
return null;
}
@@ -218,7 +204,8 @@ public enum DiscriminatorType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- private DiscriminatorType(int value, String name, String literal) {
+ private DiscriminatorType(int value, String name, String literal)
+ {
this.value = value;
this.name = name;
this.literal = literal;
@@ -229,8 +216,9 @@ public enum DiscriminatorType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public int getValue() {
- return value;
+ public int getValue()
+ {
+ return value;
}
/**
@@ -238,8 +226,9 @@ public enum DiscriminatorType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public String getName() {
- return name;
+ public String getName()
+ {
+ return name;
}
/**
@@ -247,8 +236,9 @@ public enum DiscriminatorType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public String getLiteral() {
- return literal;
+ public String getLiteral()
+ {
+ return literal;
}
/**
@@ -258,42 +248,9 @@ public enum DiscriminatorType implements Enumerator {
* @generated
*/
@Override
- public String toString() {
+ public String toString()
+ {
return literal;
}
-
- public static DiscriminatorType fromJavaAnnotationValue(Object javaAnnotationValue) {
- if (javaAnnotationValue == null) {
- return DEFAULT;
- }
- if (javaAnnotationValue.equals(JPA.DISCRIMINATOR_TYPE__CHAR)) {
- return CHAR;
- }
- if (javaAnnotationValue.equals(JPA.DISCRIMINATOR_TYPE__INTEGER)) {
- return INTEGER;
- }
- if (javaAnnotationValue.equals(JPA.DISCRIMINATOR_TYPE__STRING)) {
- return STRING;
- }
- return DEFAULT;
- }
-
- public String convertToJavaAnnotationValue() {
- switch (this.getValue()) {
- case DiscriminatorType.DEFAULT_VALUE :
- return null;
- case CHAR_VALUE :
- return JPA.DISCRIMINATOR_TYPE__CHAR;
- case INTEGER_VALUE :
- return JPA.DISCRIMINATOR_TYPE__INTEGER;
- case STRING_VALUE :
- return JPA.DISCRIMINATOR_TYPE__STRING;
- default :
- throw new IllegalArgumentException("unknown discriminator type: " + this);
- }
- }
-
- public boolean isString() {
- return (this.getValue() == DEFAULT_VALUE) || (this.getValue() == STRING_VALUE);
- }
+
} //DiscriminatorType
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddedId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Embeddable.java
index 0cf1d64b91..90062b0821 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEmbeddedId.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Embeddable.java
@@ -7,36 +7,40 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.resource.orm;
import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddedId;
/**
* <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Embedded Id</b></em>'.
+ * A representation of the model object '<em><b>Embeddable</b></em>'.
* <!-- end-user-doc -->
*
*
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlEmbeddedId()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbeddable()
* @model kind="class"
* @generated
*/
-public class XmlEmbeddedId extends XmlAttributeMapping implements IEmbeddedId
+public class Embeddable extends TypeMapping
{
/**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final AccessType ACCESS_EDEFAULT = null;
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- protected XmlEmbeddedId() {
+ protected Embeddable()
+ {
super();
}
-
- @Override
- protected void initializeOn(XmlAttributeMapping newMapping) {
- newMapping.initializeFromXmlEmbeddedIdMapping(this);
+
+ public EntityMappings entityMappings() {
+ return (EntityMappings) eContainer();
}
/**
@@ -45,21 +49,9 @@ public class XmlEmbeddedId extends XmlAttributeMapping implements IEmbeddedId
* @generated
*/
@Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_EMBEDDED_ID;
- }
-
- @Override
- public int xmlSequence() {
- return 0;
- }
-
- public String getKey() {
- return IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.EMBEDDABLE;
}
- @Override
- public boolean isIdMapping() {
- return true;
- }
-}
+} // Embeddable
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Embedded.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Embedded.java
new file mode 100644
index 0000000000..b17c7fe4b8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Embedded.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Embedded</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Embedded#getAttributeOverrides <em>Attribute Overrides</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbedded()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface Embedded extends AttributeMapping
+{
+ /**
+ * Returns the value of the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverride}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Attribute Overrides</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Attribute Overrides</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbedded_AttributeOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ EList<AttributeOverride> getAttributeOverrides();
+
+} // Embedded
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EmbeddedId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EmbeddedId.java
new file mode 100644
index 0000000000..f69d0c4582
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EmbeddedId.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Embedded Id</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedId#getAttributeOverrides <em>Attribute Overrides</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbeddedId()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface EmbeddedId extends AttributeMapping
+{
+ /**
+ * Returns the value of the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverride}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Attribute Overrides</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Attribute Overrides</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbeddedId_AttributeOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ EList<AttributeOverride> getAttributeOverrides();
+
+} // EmbeddedId
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EmbeddedIdImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EmbeddedIdImpl.java
new file mode 100644
index 0000000000..c6d495c88e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EmbeddedIdImpl.java
@@ -0,0 +1,255 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Embedded Id</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbeddedIdImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class EmbeddedIdImpl extends JpaEObject implements EmbeddedId
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getAttributeOverrides() <em>Attribute Overrides</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAttributeOverrides()
+ * @generated
+ * @ordered
+ */
+ protected EList<AttributeOverride> attributeOverrides;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EmbeddedIdImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.EMBEDDED_ID_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeMapping_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedIdImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.EMBEDDED_ID_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverride}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Attribute Overrides</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Attribute Overrides</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbeddedId_AttributeOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<AttributeOverride> getAttributeOverrides()
+ {
+ if (attributeOverrides == null)
+ {
+ attributeOverrides = new EObjectContainmentEList<AttributeOverride>(AttributeOverride.class, this, OrmPackage.EMBEDDED_ID_IMPL__ATTRIBUTE_OVERRIDES);
+ }
+ return attributeOverrides;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.EMBEDDED_ID_IMPL__ATTRIBUTE_OVERRIDES:
+ return ((InternalEList<?>)getAttributeOverrides()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.EMBEDDED_ID_IMPL__NAME:
+ return getName();
+ case OrmPackage.EMBEDDED_ID_IMPL__ATTRIBUTE_OVERRIDES:
+ return getAttributeOverrides();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.EMBEDDED_ID_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.EMBEDDED_ID_IMPL__ATTRIBUTE_OVERRIDES:
+ getAttributeOverrides().clear();
+ getAttributeOverrides().addAll((Collection<? extends AttributeOverride>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.EMBEDDED_ID_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.EMBEDDED_ID_IMPL__ATTRIBUTE_OVERRIDES:
+ getAttributeOverrides().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.EMBEDDED_ID_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.EMBEDDED_ID_IMPL__ATTRIBUTE_OVERRIDES:
+ return attributeOverrides != null && !attributeOverrides.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} // EmbeddedId
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EmbeddedImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EmbeddedImpl.java
new file mode 100644
index 0000000000..f418fb67bd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EmbeddedImpl.java
@@ -0,0 +1,255 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Embedded</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbeddedImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class EmbeddedImpl extends JpaEObject implements Embedded
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getAttributeOverrides() <em>Attribute Overrides</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAttributeOverrides()
+ * @generated
+ * @ordered
+ */
+ protected EList<AttributeOverride> attributeOverrides;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EmbeddedImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.EMBEDDED_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeMapping_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.EMBEDDED_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverride}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Attribute Overrides</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Attribute Overrides</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbedded_AttributeOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<AttributeOverride> getAttributeOverrides()
+ {
+ if (attributeOverrides == null)
+ {
+ attributeOverrides = new EObjectContainmentEList<AttributeOverride>(AttributeOverride.class, this, OrmPackage.EMBEDDED_IMPL__ATTRIBUTE_OVERRIDES);
+ }
+ return attributeOverrides;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.EMBEDDED_IMPL__ATTRIBUTE_OVERRIDES:
+ return ((InternalEList<?>)getAttributeOverrides()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.EMBEDDED_IMPL__NAME:
+ return getName();
+ case OrmPackage.EMBEDDED_IMPL__ATTRIBUTE_OVERRIDES:
+ return getAttributeOverrides();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.EMBEDDED_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.EMBEDDED_IMPL__ATTRIBUTE_OVERRIDES:
+ getAttributeOverrides().clear();
+ getAttributeOverrides().addAll((Collection<? extends AttributeOverride>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.EMBEDDED_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.EMBEDDED_IMPL__ATTRIBUTE_OVERRIDES:
+ getAttributeOverrides().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.EMBEDDED_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.EMBEDDED_IMPL__ATTRIBUTE_OVERRIDES:
+ return attributeOverrides != null && !attributeOverrides.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} // Embedded
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Entity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Entity.java
new file mode 100644
index 0000000000..bdfdcdf2bf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Entity.java
@@ -0,0 +1,1919 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Entity</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getTable <em>Table</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getSecondaryTables <em>Secondary Tables</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPrimaryKeyJoinColumns <em>Primary Key Join Columns</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getIdClass <em>Id Class</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getInheritance <em>Inheritance</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getDiscriminatorValue <em>Discriminator Value</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getDiscriminatorColumn <em>Discriminator Column</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getSequenceGenerator <em>Sequence Generator</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getTableGenerator <em>Table Generator</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getNamedQueries <em>Named Queries</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getNamedNativeQueries <em>Named Native Queries</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getSqlResultSetMappings <em>Sql Result Set Mappings</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#isExcludeDefaultListeners <em>Exclude Default Listeners</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#isExcludeSuperclassListeners <em>Exclude Superclass Listeners</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getEntityListeners <em>Entity Listeners</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPrePersist <em>Pre Persist</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPostPersist <em>Post Persist</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPreRemove <em>Pre Remove</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPostRemove <em>Post Remove</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPreUpdate <em>Pre Update</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPostUpdate <em>Post Update</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPostLoad <em>Post Load</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getAttributeOverrides <em>Attribute Overrides</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getAssociationOverrides <em>Association Overrides</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity()
+ * @model kind="class"
+ * @generated
+ */
+public class Entity extends TypeMapping
+{
+ /**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final AccessType ACCESS_EDEFAULT = null;
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getTable() <em>Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTable()
+ * @generated
+ * @ordered
+ */
+ protected Table table;
+
+ /**
+ * The cached value of the '{@link #getSecondaryTables() <em>Secondary Tables</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSecondaryTables()
+ * @generated
+ * @ordered
+ */
+ protected EList<SecondaryTable> secondaryTables;
+
+ /**
+ * The cached value of the '{@link #getPrimaryKeyJoinColumns() <em>Primary Key Join Columns</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPrimaryKeyJoinColumns()
+ * @generated
+ * @ordered
+ */
+ protected EList<PrimaryKeyJoinColumn> primaryKeyJoinColumns;
+
+ /**
+ * The cached value of the '{@link #getIdClass() <em>Id Class</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getIdClass()
+ * @generated
+ * @ordered
+ */
+ protected IdClass idClass;
+
+ /**
+ * The cached value of the '{@link #getInheritance() <em>Inheritance</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInheritance()
+ * @generated
+ * @ordered
+ */
+ protected Inheritance inheritance;
+
+ /**
+ * The default value of the '{@link #getDiscriminatorValue() <em>Discriminator Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDiscriminatorValue()
+ * @generated
+ * @ordered
+ */
+ protected static final String DISCRIMINATOR_VALUE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getDiscriminatorValue() <em>Discriminator Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDiscriminatorValue()
+ * @generated
+ * @ordered
+ */
+ protected String discriminatorValue = DISCRIMINATOR_VALUE_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getDiscriminatorColumn() <em>Discriminator Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDiscriminatorColumn()
+ * @generated
+ * @ordered
+ */
+ protected DiscriminatorColumn discriminatorColumn;
+
+ /**
+ * The cached value of the '{@link #getSequenceGenerator() <em>Sequence Generator</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSequenceGenerator()
+ * @generated
+ * @ordered
+ */
+ protected SequenceGenerator sequenceGenerator;
+
+ /**
+ * The cached value of the '{@link #getTableGenerator() <em>Table Generator</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTableGenerator()
+ * @generated
+ * @ordered
+ */
+ protected TableGenerator tableGenerator;
+
+ /**
+ * The cached value of the '{@link #getNamedQueries() <em>Named Queries</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getNamedQueries()
+ * @generated
+ * @ordered
+ */
+ protected EList<NamedQuery> namedQueries;
+
+ /**
+ * The cached value of the '{@link #getNamedNativeQueries() <em>Named Native Queries</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getNamedNativeQueries()
+ * @generated
+ * @ordered
+ */
+ protected EList<NamedNativeQuery> namedNativeQueries;
+
+ /**
+ * The cached value of the '{@link #getSqlResultSetMappings() <em>Sql Result Set Mappings</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSqlResultSetMappings()
+ * @generated
+ * @ordered
+ */
+ protected EList<SqlResultSetMapping> sqlResultSetMappings;
+
+ /**
+ * The default value of the '{@link #isExcludeDefaultListeners() <em>Exclude Default Listeners</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isExcludeDefaultListeners()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean EXCLUDE_DEFAULT_LISTENERS_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isExcludeDefaultListeners() <em>Exclude Default Listeners</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isExcludeDefaultListeners()
+ * @generated
+ * @ordered
+ */
+ protected boolean excludeDefaultListeners = EXCLUDE_DEFAULT_LISTENERS_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #isExcludeSuperclassListeners() <em>Exclude Superclass Listeners</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isExcludeSuperclassListeners()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean EXCLUDE_SUPERCLASS_LISTENERS_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isExcludeSuperclassListeners() <em>Exclude Superclass Listeners</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isExcludeSuperclassListeners()
+ * @generated
+ * @ordered
+ */
+ protected boolean excludeSuperclassListeners = EXCLUDE_SUPERCLASS_LISTENERS_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getEntityListeners() <em>Entity Listeners</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEntityListeners()
+ * @generated
+ * @ordered
+ */
+ protected EntityListeners entityListeners;
+
+ /**
+ * The cached value of the '{@link #getPrePersist() <em>Pre Persist</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPrePersist()
+ * @generated
+ * @ordered
+ */
+ protected PrePersist prePersist;
+
+ /**
+ * The cached value of the '{@link #getPostPersist() <em>Post Persist</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPostPersist()
+ * @generated
+ * @ordered
+ */
+ protected PostPersist postPersist;
+
+ /**
+ * The cached value of the '{@link #getPreRemove() <em>Pre Remove</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPreRemove()
+ * @generated
+ * @ordered
+ */
+ protected PreRemove preRemove;
+
+ /**
+ * The cached value of the '{@link #getPostRemove() <em>Post Remove</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPostRemove()
+ * @generated
+ * @ordered
+ */
+ protected PostRemove postRemove;
+
+ /**
+ * The cached value of the '{@link #getPreUpdate() <em>Pre Update</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPreUpdate()
+ * @generated
+ * @ordered
+ */
+ protected PreUpdate preUpdate;
+
+ /**
+ * The cached value of the '{@link #getPostUpdate() <em>Post Update</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPostUpdate()
+ * @generated
+ * @ordered
+ */
+ protected PostUpdate postUpdate;
+
+ /**
+ * The cached value of the '{@link #getPostLoad() <em>Post Load</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPostLoad()
+ * @generated
+ * @ordered
+ */
+ protected PostLoad postLoad;
+
+ /**
+ * The cached value of the '{@link #getAttributeOverrides() <em>Attribute Overrides</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAttributeOverrides()
+ * @generated
+ * @ordered
+ */
+ protected EList<AttributeOverride> attributeOverrides;
+
+ /**
+ * The cached value of the '{@link #getAssociationOverrides() <em>Association Overrides</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAssociationOverrides()
+ * @generated
+ * @ordered
+ */
+ protected EList<AssociationOverride> associationOverrides;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Entity()
+ {
+ super();
+ }
+
+ public EntityMappings entityMappings() {
+ return (EntityMappings) eContainer();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ENTITY;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Table</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Table</em>' containment reference.
+ * @see #setTable(Table)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_Table()
+ * @model containment="true"
+ * @generated
+ */
+ public Table getTable()
+ {
+ return table;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetTable(Table newTable, NotificationChain msgs)
+ {
+ Table oldTable = table;
+ table = newTable;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__TABLE, oldTable, newTable);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getTable <em>Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Table</em>' containment reference.
+ * @see #getTable()
+ * @generated
+ */
+ public void setTable(Table newTable)
+ {
+ if (newTable != table)
+ {
+ NotificationChain msgs = null;
+ if (table != null)
+ msgs = ((InternalEObject)table).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__TABLE, null, msgs);
+ if (newTable != null)
+ msgs = ((InternalEObject)newTable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__TABLE, null, msgs);
+ msgs = basicSetTable(newTable, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__TABLE, newTable, newTable));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Secondary Tables</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.SecondaryTable}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Secondary Tables</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Secondary Tables</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_SecondaryTables()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<SecondaryTable> getSecondaryTables()
+ {
+ if (secondaryTables == null)
+ {
+ secondaryTables = new EObjectContainmentEList<SecondaryTable>(SecondaryTable.class, this, OrmPackage.ENTITY__SECONDARY_TABLES);
+ }
+ return secondaryTables;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Primary Key Join Columns</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Primary Key Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_PrimaryKeyJoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<PrimaryKeyJoinColumn> getPrimaryKeyJoinColumns()
+ {
+ if (primaryKeyJoinColumns == null)
+ {
+ primaryKeyJoinColumns = new EObjectContainmentEList<PrimaryKeyJoinColumn>(PrimaryKeyJoinColumn.class, this, OrmPackage.ENTITY__PRIMARY_KEY_JOIN_COLUMNS);
+ }
+ return primaryKeyJoinColumns;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Id Class</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Id Class</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Id Class</em>' containment reference.
+ * @see #setIdClass(IdClass)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_IdClass()
+ * @model containment="true"
+ * @generated
+ */
+ public IdClass getIdClass()
+ {
+ return idClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetIdClass(IdClass newIdClass, NotificationChain msgs)
+ {
+ IdClass oldIdClass = idClass;
+ idClass = newIdClass;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__ID_CLASS, oldIdClass, newIdClass);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getIdClass <em>Id Class</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Id Class</em>' containment reference.
+ * @see #getIdClass()
+ * @generated
+ */
+ public void setIdClass(IdClass newIdClass)
+ {
+ if (newIdClass != idClass)
+ {
+ NotificationChain msgs = null;
+ if (idClass != null)
+ msgs = ((InternalEObject)idClass).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__ID_CLASS, null, msgs);
+ if (newIdClass != null)
+ msgs = ((InternalEObject)newIdClass).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__ID_CLASS, null, msgs);
+ msgs = basicSetIdClass(newIdClass, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__ID_CLASS, newIdClass, newIdClass));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Inheritance</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Inheritance</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Inheritance</em>' containment reference.
+ * @see #setInheritance(Inheritance)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_Inheritance()
+ * @model containment="true"
+ * @generated
+ */
+ public Inheritance getInheritance()
+ {
+ return inheritance;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetInheritance(Inheritance newInheritance, NotificationChain msgs)
+ {
+ Inheritance oldInheritance = inheritance;
+ inheritance = newInheritance;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__INHERITANCE, oldInheritance, newInheritance);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getInheritance <em>Inheritance</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Inheritance</em>' containment reference.
+ * @see #getInheritance()
+ * @generated
+ */
+ public void setInheritance(Inheritance newInheritance)
+ {
+ if (newInheritance != inheritance)
+ {
+ NotificationChain msgs = null;
+ if (inheritance != null)
+ msgs = ((InternalEObject)inheritance).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__INHERITANCE, null, msgs);
+ if (newInheritance != null)
+ msgs = ((InternalEObject)newInheritance).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__INHERITANCE, null, msgs);
+ msgs = basicSetInheritance(newInheritance, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__INHERITANCE, newInheritance, newInheritance));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Discriminator Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Discriminator Value</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Discriminator Value</em>' attribute.
+ * @see #setDiscriminatorValue(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_DiscriminatorValue()
+ * @model dataType="org.eclipse.jpt.core.internal.resource.orm.DiscriminatorValue"
+ * @generated
+ */
+ public String getDiscriminatorValue()
+ {
+ return discriminatorValue;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getDiscriminatorValue <em>Discriminator Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Discriminator Value</em>' attribute.
+ * @see #getDiscriminatorValue()
+ * @generated
+ */
+ public void setDiscriminatorValue(String newDiscriminatorValue)
+ {
+ String oldDiscriminatorValue = discriminatorValue;
+ discriminatorValue = newDiscriminatorValue;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__DISCRIMINATOR_VALUE, oldDiscriminatorValue, discriminatorValue));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Discriminator Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Discriminator Column</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Discriminator Column</em>' containment reference.
+ * @see #setDiscriminatorColumn(DiscriminatorColumn)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_DiscriminatorColumn()
+ * @model containment="true"
+ * @generated
+ */
+ public DiscriminatorColumn getDiscriminatorColumn()
+ {
+ return discriminatorColumn;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetDiscriminatorColumn(DiscriminatorColumn newDiscriminatorColumn, NotificationChain msgs)
+ {
+ DiscriminatorColumn oldDiscriminatorColumn = discriminatorColumn;
+ discriminatorColumn = newDiscriminatorColumn;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__DISCRIMINATOR_COLUMN, oldDiscriminatorColumn, newDiscriminatorColumn);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getDiscriminatorColumn <em>Discriminator Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Discriminator Column</em>' containment reference.
+ * @see #getDiscriminatorColumn()
+ * @generated
+ */
+ public void setDiscriminatorColumn(DiscriminatorColumn newDiscriminatorColumn)
+ {
+ if (newDiscriminatorColumn != discriminatorColumn)
+ {
+ NotificationChain msgs = null;
+ if (discriminatorColumn != null)
+ msgs = ((InternalEObject)discriminatorColumn).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__DISCRIMINATOR_COLUMN, null, msgs);
+ if (newDiscriminatorColumn != null)
+ msgs = ((InternalEObject)newDiscriminatorColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__DISCRIMINATOR_COLUMN, null, msgs);
+ msgs = basicSetDiscriminatorColumn(newDiscriminatorColumn, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__DISCRIMINATOR_COLUMN, newDiscriminatorColumn, newDiscriminatorColumn));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Sequence Generator</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Sequence Generator</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Sequence Generator</em>' containment reference.
+ * @see #setSequenceGenerator(SequenceGenerator)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_SequenceGenerator()
+ * @model containment="true"
+ * @generated
+ */
+ public SequenceGenerator getSequenceGenerator()
+ {
+ return sequenceGenerator;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetSequenceGenerator(SequenceGenerator newSequenceGenerator, NotificationChain msgs)
+ {
+ SequenceGenerator oldSequenceGenerator = sequenceGenerator;
+ sequenceGenerator = newSequenceGenerator;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__SEQUENCE_GENERATOR, oldSequenceGenerator, newSequenceGenerator);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getSequenceGenerator <em>Sequence Generator</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Sequence Generator</em>' containment reference.
+ * @see #getSequenceGenerator()
+ * @generated
+ */
+ public void setSequenceGenerator(SequenceGenerator newSequenceGenerator)
+ {
+ if (newSequenceGenerator != sequenceGenerator)
+ {
+ NotificationChain msgs = null;
+ if (sequenceGenerator != null)
+ msgs = ((InternalEObject)sequenceGenerator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__SEQUENCE_GENERATOR, null, msgs);
+ if (newSequenceGenerator != null)
+ msgs = ((InternalEObject)newSequenceGenerator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__SEQUENCE_GENERATOR, null, msgs);
+ msgs = basicSetSequenceGenerator(newSequenceGenerator, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__SEQUENCE_GENERATOR, newSequenceGenerator, newSequenceGenerator));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Table Generator</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Table Generator</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Table Generator</em>' containment reference.
+ * @see #setTableGenerator(TableGenerator)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_TableGenerator()
+ * @model containment="true"
+ * @generated
+ */
+ public TableGenerator getTableGenerator()
+ {
+ return tableGenerator;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetTableGenerator(TableGenerator newTableGenerator, NotificationChain msgs)
+ {
+ TableGenerator oldTableGenerator = tableGenerator;
+ tableGenerator = newTableGenerator;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__TABLE_GENERATOR, oldTableGenerator, newTableGenerator);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getTableGenerator <em>Table Generator</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Table Generator</em>' containment reference.
+ * @see #getTableGenerator()
+ * @generated
+ */
+ public void setTableGenerator(TableGenerator newTableGenerator)
+ {
+ if (newTableGenerator != tableGenerator)
+ {
+ NotificationChain msgs = null;
+ if (tableGenerator != null)
+ msgs = ((InternalEObject)tableGenerator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__TABLE_GENERATOR, null, msgs);
+ if (newTableGenerator != null)
+ msgs = ((InternalEObject)newTableGenerator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__TABLE_GENERATOR, null, msgs);
+ msgs = basicSetTableGenerator(newTableGenerator, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__TABLE_GENERATOR, newTableGenerator, newTableGenerator));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Named Queries</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.NamedQuery}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Named Queries</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Named Queries</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_NamedQueries()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<NamedQuery> getNamedQueries()
+ {
+ if (namedQueries == null)
+ {
+ namedQueries = new EObjectContainmentEList<NamedQuery>(NamedQuery.class, this, OrmPackage.ENTITY__NAMED_QUERIES);
+ }
+ return namedQueries;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Named Native Queries</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Named Native Queries</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Named Native Queries</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_NamedNativeQueries()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<NamedNativeQuery> getNamedNativeQueries()
+ {
+ if (namedNativeQueries == null)
+ {
+ namedNativeQueries = new EObjectContainmentEList<NamedNativeQuery>(NamedNativeQuery.class, this, OrmPackage.ENTITY__NAMED_NATIVE_QUERIES);
+ }
+ return namedNativeQueries;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Sql Result Set Mappings</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Sql Result Set Mappings</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Sql Result Set Mappings</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_SqlResultSetMappings()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<SqlResultSetMapping> getSqlResultSetMappings()
+ {
+ if (sqlResultSetMappings == null)
+ {
+ sqlResultSetMappings = new EObjectContainmentEList<SqlResultSetMapping>(SqlResultSetMapping.class, this, OrmPackage.ENTITY__SQL_RESULT_SET_MAPPINGS);
+ }
+ return sqlResultSetMappings;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Exclude Default Listeners</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Exclude Default Listeners</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Exclude Default Listeners</em>' attribute.
+ * @see #setExcludeDefaultListeners(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_ExcludeDefaultListeners()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ public boolean isExcludeDefaultListeners()
+ {
+ return excludeDefaultListeners;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#isExcludeDefaultListeners <em>Exclude Default Listeners</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Exclude Default Listeners</em>' attribute.
+ * @see #isExcludeDefaultListeners()
+ * @generated
+ */
+ public void setExcludeDefaultListeners(boolean newExcludeDefaultListeners)
+ {
+ boolean oldExcludeDefaultListeners = excludeDefaultListeners;
+ excludeDefaultListeners = newExcludeDefaultListeners;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__EXCLUDE_DEFAULT_LISTENERS, oldExcludeDefaultListeners, excludeDefaultListeners));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Exclude Superclass Listeners</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Exclude Superclass Listeners</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Exclude Superclass Listeners</em>' attribute.
+ * @see #setExcludeSuperclassListeners(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_ExcludeSuperclassListeners()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ public boolean isExcludeSuperclassListeners()
+ {
+ return excludeSuperclassListeners;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#isExcludeSuperclassListeners <em>Exclude Superclass Listeners</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Exclude Superclass Listeners</em>' attribute.
+ * @see #isExcludeSuperclassListeners()
+ * @generated
+ */
+ public void setExcludeSuperclassListeners(boolean newExcludeSuperclassListeners)
+ {
+ boolean oldExcludeSuperclassListeners = excludeSuperclassListeners;
+ excludeSuperclassListeners = newExcludeSuperclassListeners;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__EXCLUDE_SUPERCLASS_LISTENERS, oldExcludeSuperclassListeners, excludeSuperclassListeners));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Entity Listeners</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Entity Listeners</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Entity Listeners</em>' containment reference.
+ * @see #setEntityListeners(EntityListeners)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_EntityListeners()
+ * @model containment="true"
+ * @generated
+ */
+ public EntityListeners getEntityListeners()
+ {
+ return entityListeners;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetEntityListeners(EntityListeners newEntityListeners, NotificationChain msgs)
+ {
+ EntityListeners oldEntityListeners = entityListeners;
+ entityListeners = newEntityListeners;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__ENTITY_LISTENERS, oldEntityListeners, newEntityListeners);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getEntityListeners <em>Entity Listeners</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Entity Listeners</em>' containment reference.
+ * @see #getEntityListeners()
+ * @generated
+ */
+ public void setEntityListeners(EntityListeners newEntityListeners)
+ {
+ if (newEntityListeners != entityListeners)
+ {
+ NotificationChain msgs = null;
+ if (entityListeners != null)
+ msgs = ((InternalEObject)entityListeners).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__ENTITY_LISTENERS, null, msgs);
+ if (newEntityListeners != null)
+ msgs = ((InternalEObject)newEntityListeners).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__ENTITY_LISTENERS, null, msgs);
+ msgs = basicSetEntityListeners(newEntityListeners, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__ENTITY_LISTENERS, newEntityListeners, newEntityListeners));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Pre Persist</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Pre Persist</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Pre Persist</em>' containment reference.
+ * @see #setPrePersist(PrePersist)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_PrePersist()
+ * @model containment="true"
+ * @generated
+ */
+ public PrePersist getPrePersist()
+ {
+ return prePersist;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPrePersist(PrePersist newPrePersist, NotificationChain msgs)
+ {
+ PrePersist oldPrePersist = prePersist;
+ prePersist = newPrePersist;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__PRE_PERSIST, oldPrePersist, newPrePersist);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPrePersist <em>Pre Persist</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Pre Persist</em>' containment reference.
+ * @see #getPrePersist()
+ * @generated
+ */
+ public void setPrePersist(PrePersist newPrePersist)
+ {
+ if (newPrePersist != prePersist)
+ {
+ NotificationChain msgs = null;
+ if (prePersist != null)
+ msgs = ((InternalEObject)prePersist).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__PRE_PERSIST, null, msgs);
+ if (newPrePersist != null)
+ msgs = ((InternalEObject)newPrePersist).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__PRE_PERSIST, null, msgs);
+ msgs = basicSetPrePersist(newPrePersist, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__PRE_PERSIST, newPrePersist, newPrePersist));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Post Persist</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Post Persist</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Post Persist</em>' containment reference.
+ * @see #setPostPersist(PostPersist)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_PostPersist()
+ * @model containment="true"
+ * @generated
+ */
+ public PostPersist getPostPersist()
+ {
+ return postPersist;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPostPersist(PostPersist newPostPersist, NotificationChain msgs)
+ {
+ PostPersist oldPostPersist = postPersist;
+ postPersist = newPostPersist;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__POST_PERSIST, oldPostPersist, newPostPersist);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPostPersist <em>Post Persist</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Post Persist</em>' containment reference.
+ * @see #getPostPersist()
+ * @generated
+ */
+ public void setPostPersist(PostPersist newPostPersist)
+ {
+ if (newPostPersist != postPersist)
+ {
+ NotificationChain msgs = null;
+ if (postPersist != null)
+ msgs = ((InternalEObject)postPersist).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__POST_PERSIST, null, msgs);
+ if (newPostPersist != null)
+ msgs = ((InternalEObject)newPostPersist).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__POST_PERSIST, null, msgs);
+ msgs = basicSetPostPersist(newPostPersist, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__POST_PERSIST, newPostPersist, newPostPersist));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Pre Remove</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Pre Remove</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Pre Remove</em>' containment reference.
+ * @see #setPreRemove(PreRemove)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_PreRemove()
+ * @model containment="true"
+ * @generated
+ */
+ public PreRemove getPreRemove()
+ {
+ return preRemove;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPreRemove(PreRemove newPreRemove, NotificationChain msgs)
+ {
+ PreRemove oldPreRemove = preRemove;
+ preRemove = newPreRemove;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__PRE_REMOVE, oldPreRemove, newPreRemove);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPreRemove <em>Pre Remove</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Pre Remove</em>' containment reference.
+ * @see #getPreRemove()
+ * @generated
+ */
+ public void setPreRemove(PreRemove newPreRemove)
+ {
+ if (newPreRemove != preRemove)
+ {
+ NotificationChain msgs = null;
+ if (preRemove != null)
+ msgs = ((InternalEObject)preRemove).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__PRE_REMOVE, null, msgs);
+ if (newPreRemove != null)
+ msgs = ((InternalEObject)newPreRemove).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__PRE_REMOVE, null, msgs);
+ msgs = basicSetPreRemove(newPreRemove, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__PRE_REMOVE, newPreRemove, newPreRemove));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Post Remove</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Post Remove</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Post Remove</em>' containment reference.
+ * @see #setPostRemove(PostRemove)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_PostRemove()
+ * @model containment="true"
+ * @generated
+ */
+ public PostRemove getPostRemove()
+ {
+ return postRemove;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPostRemove(PostRemove newPostRemove, NotificationChain msgs)
+ {
+ PostRemove oldPostRemove = postRemove;
+ postRemove = newPostRemove;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__POST_REMOVE, oldPostRemove, newPostRemove);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPostRemove <em>Post Remove</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Post Remove</em>' containment reference.
+ * @see #getPostRemove()
+ * @generated
+ */
+ public void setPostRemove(PostRemove newPostRemove)
+ {
+ if (newPostRemove != postRemove)
+ {
+ NotificationChain msgs = null;
+ if (postRemove != null)
+ msgs = ((InternalEObject)postRemove).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__POST_REMOVE, null, msgs);
+ if (newPostRemove != null)
+ msgs = ((InternalEObject)newPostRemove).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__POST_REMOVE, null, msgs);
+ msgs = basicSetPostRemove(newPostRemove, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__POST_REMOVE, newPostRemove, newPostRemove));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Pre Update</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Pre Update</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Pre Update</em>' containment reference.
+ * @see #setPreUpdate(PreUpdate)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_PreUpdate()
+ * @model containment="true"
+ * @generated
+ */
+ public PreUpdate getPreUpdate()
+ {
+ return preUpdate;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPreUpdate(PreUpdate newPreUpdate, NotificationChain msgs)
+ {
+ PreUpdate oldPreUpdate = preUpdate;
+ preUpdate = newPreUpdate;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__PRE_UPDATE, oldPreUpdate, newPreUpdate);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPreUpdate <em>Pre Update</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Pre Update</em>' containment reference.
+ * @see #getPreUpdate()
+ * @generated
+ */
+ public void setPreUpdate(PreUpdate newPreUpdate)
+ {
+ if (newPreUpdate != preUpdate)
+ {
+ NotificationChain msgs = null;
+ if (preUpdate != null)
+ msgs = ((InternalEObject)preUpdate).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__PRE_UPDATE, null, msgs);
+ if (newPreUpdate != null)
+ msgs = ((InternalEObject)newPreUpdate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__PRE_UPDATE, null, msgs);
+ msgs = basicSetPreUpdate(newPreUpdate, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__PRE_UPDATE, newPreUpdate, newPreUpdate));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Post Update</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Post Update</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Post Update</em>' containment reference.
+ * @see #setPostUpdate(PostUpdate)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_PostUpdate()
+ * @model containment="true"
+ * @generated
+ */
+ public PostUpdate getPostUpdate()
+ {
+ return postUpdate;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPostUpdate(PostUpdate newPostUpdate, NotificationChain msgs)
+ {
+ PostUpdate oldPostUpdate = postUpdate;
+ postUpdate = newPostUpdate;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__POST_UPDATE, oldPostUpdate, newPostUpdate);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPostUpdate <em>Post Update</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Post Update</em>' containment reference.
+ * @see #getPostUpdate()
+ * @generated
+ */
+ public void setPostUpdate(PostUpdate newPostUpdate)
+ {
+ if (newPostUpdate != postUpdate)
+ {
+ NotificationChain msgs = null;
+ if (postUpdate != null)
+ msgs = ((InternalEObject)postUpdate).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__POST_UPDATE, null, msgs);
+ if (newPostUpdate != null)
+ msgs = ((InternalEObject)newPostUpdate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__POST_UPDATE, null, msgs);
+ msgs = basicSetPostUpdate(newPostUpdate, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__POST_UPDATE, newPostUpdate, newPostUpdate));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Post Load</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Post Load</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Post Load</em>' containment reference.
+ * @see #setPostLoad(PostLoad)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_PostLoad()
+ * @model containment="true"
+ * @generated
+ */
+ public PostLoad getPostLoad()
+ {
+ return postLoad;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPostLoad(PostLoad newPostLoad, NotificationChain msgs)
+ {
+ PostLoad oldPostLoad = postLoad;
+ postLoad = newPostLoad;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__POST_LOAD, oldPostLoad, newPostLoad);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPostLoad <em>Post Load</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Post Load</em>' containment reference.
+ * @see #getPostLoad()
+ * @generated
+ */
+ public void setPostLoad(PostLoad newPostLoad)
+ {
+ if (newPostLoad != postLoad)
+ {
+ NotificationChain msgs = null;
+ if (postLoad != null)
+ msgs = ((InternalEObject)postLoad).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__POST_LOAD, null, msgs);
+ if (newPostLoad != null)
+ msgs = ((InternalEObject)newPostLoad).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY__POST_LOAD, null, msgs);
+ msgs = basicSetPostLoad(newPostLoad, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY__POST_LOAD, newPostLoad, newPostLoad));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverride}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Attribute Overrides</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Attribute Overrides</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_AttributeOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<AttributeOverride> getAttributeOverrides()
+ {
+ if (attributeOverrides == null)
+ {
+ attributeOverrides = new EObjectContainmentEList<AttributeOverride>(AttributeOverride.class, this, OrmPackage.ENTITY__ATTRIBUTE_OVERRIDES);
+ }
+ return attributeOverrides;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Association Overrides</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.AssociationOverride}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Association Overrides</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Association Overrides</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity_AssociationOverrides()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<AssociationOverride> getAssociationOverrides()
+ {
+ if (associationOverrides == null)
+ {
+ associationOverrides = new EObjectContainmentEList<AssociationOverride>(AssociationOverride.class, this, OrmPackage.ENTITY__ASSOCIATION_OVERRIDES);
+ }
+ return associationOverrides;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY__TABLE:
+ return basicSetTable(null, msgs);
+ case OrmPackage.ENTITY__SECONDARY_TABLES:
+ return ((InternalEList<?>)getSecondaryTables()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ENTITY__PRIMARY_KEY_JOIN_COLUMNS:
+ return ((InternalEList<?>)getPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ENTITY__ID_CLASS:
+ return basicSetIdClass(null, msgs);
+ case OrmPackage.ENTITY__INHERITANCE:
+ return basicSetInheritance(null, msgs);
+ case OrmPackage.ENTITY__DISCRIMINATOR_COLUMN:
+ return basicSetDiscriminatorColumn(null, msgs);
+ case OrmPackage.ENTITY__SEQUENCE_GENERATOR:
+ return basicSetSequenceGenerator(null, msgs);
+ case OrmPackage.ENTITY__TABLE_GENERATOR:
+ return basicSetTableGenerator(null, msgs);
+ case OrmPackage.ENTITY__NAMED_QUERIES:
+ return ((InternalEList<?>)getNamedQueries()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ENTITY__NAMED_NATIVE_QUERIES:
+ return ((InternalEList<?>)getNamedNativeQueries()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ENTITY__SQL_RESULT_SET_MAPPINGS:
+ return ((InternalEList<?>)getSqlResultSetMappings()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ENTITY__ENTITY_LISTENERS:
+ return basicSetEntityListeners(null, msgs);
+ case OrmPackage.ENTITY__PRE_PERSIST:
+ return basicSetPrePersist(null, msgs);
+ case OrmPackage.ENTITY__POST_PERSIST:
+ return basicSetPostPersist(null, msgs);
+ case OrmPackage.ENTITY__PRE_REMOVE:
+ return basicSetPreRemove(null, msgs);
+ case OrmPackage.ENTITY__POST_REMOVE:
+ return basicSetPostRemove(null, msgs);
+ case OrmPackage.ENTITY__PRE_UPDATE:
+ return basicSetPreUpdate(null, msgs);
+ case OrmPackage.ENTITY__POST_UPDATE:
+ return basicSetPostUpdate(null, msgs);
+ case OrmPackage.ENTITY__POST_LOAD:
+ return basicSetPostLoad(null, msgs);
+ case OrmPackage.ENTITY__ATTRIBUTE_OVERRIDES:
+ return ((InternalEList<?>)getAttributeOverrides()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ENTITY__ASSOCIATION_OVERRIDES:
+ return ((InternalEList<?>)getAssociationOverrides()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY__NAME:
+ return getName();
+ case OrmPackage.ENTITY__TABLE:
+ return getTable();
+ case OrmPackage.ENTITY__SECONDARY_TABLES:
+ return getSecondaryTables();
+ case OrmPackage.ENTITY__PRIMARY_KEY_JOIN_COLUMNS:
+ return getPrimaryKeyJoinColumns();
+ case OrmPackage.ENTITY__ID_CLASS:
+ return getIdClass();
+ case OrmPackage.ENTITY__INHERITANCE:
+ return getInheritance();
+ case OrmPackage.ENTITY__DISCRIMINATOR_VALUE:
+ return getDiscriminatorValue();
+ case OrmPackage.ENTITY__DISCRIMINATOR_COLUMN:
+ return getDiscriminatorColumn();
+ case OrmPackage.ENTITY__SEQUENCE_GENERATOR:
+ return getSequenceGenerator();
+ case OrmPackage.ENTITY__TABLE_GENERATOR:
+ return getTableGenerator();
+ case OrmPackage.ENTITY__NAMED_QUERIES:
+ return getNamedQueries();
+ case OrmPackage.ENTITY__NAMED_NATIVE_QUERIES:
+ return getNamedNativeQueries();
+ case OrmPackage.ENTITY__SQL_RESULT_SET_MAPPINGS:
+ return getSqlResultSetMappings();
+ case OrmPackage.ENTITY__EXCLUDE_DEFAULT_LISTENERS:
+ return isExcludeDefaultListeners() ? Boolean.TRUE : Boolean.FALSE;
+ case OrmPackage.ENTITY__EXCLUDE_SUPERCLASS_LISTENERS:
+ return isExcludeSuperclassListeners() ? Boolean.TRUE : Boolean.FALSE;
+ case OrmPackage.ENTITY__ENTITY_LISTENERS:
+ return getEntityListeners();
+ case OrmPackage.ENTITY__PRE_PERSIST:
+ return getPrePersist();
+ case OrmPackage.ENTITY__POST_PERSIST:
+ return getPostPersist();
+ case OrmPackage.ENTITY__PRE_REMOVE:
+ return getPreRemove();
+ case OrmPackage.ENTITY__POST_REMOVE:
+ return getPostRemove();
+ case OrmPackage.ENTITY__PRE_UPDATE:
+ return getPreUpdate();
+ case OrmPackage.ENTITY__POST_UPDATE:
+ return getPostUpdate();
+ case OrmPackage.ENTITY__POST_LOAD:
+ return getPostLoad();
+ case OrmPackage.ENTITY__ATTRIBUTE_OVERRIDES:
+ return getAttributeOverrides();
+ case OrmPackage.ENTITY__ASSOCIATION_OVERRIDES:
+ return getAssociationOverrides();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.ENTITY__TABLE:
+ setTable((Table)newValue);
+ return;
+ case OrmPackage.ENTITY__SECONDARY_TABLES:
+ getSecondaryTables().clear();
+ getSecondaryTables().addAll((Collection<? extends SecondaryTable>)newValue);
+ return;
+ case OrmPackage.ENTITY__PRIMARY_KEY_JOIN_COLUMNS:
+ getPrimaryKeyJoinColumns().clear();
+ getPrimaryKeyJoinColumns().addAll((Collection<? extends PrimaryKeyJoinColumn>)newValue);
+ return;
+ case OrmPackage.ENTITY__ID_CLASS:
+ setIdClass((IdClass)newValue);
+ return;
+ case OrmPackage.ENTITY__INHERITANCE:
+ setInheritance((Inheritance)newValue);
+ return;
+ case OrmPackage.ENTITY__DISCRIMINATOR_VALUE:
+ setDiscriminatorValue((String)newValue);
+ return;
+ case OrmPackage.ENTITY__DISCRIMINATOR_COLUMN:
+ setDiscriminatorColumn((DiscriminatorColumn)newValue);
+ return;
+ case OrmPackage.ENTITY__SEQUENCE_GENERATOR:
+ setSequenceGenerator((SequenceGenerator)newValue);
+ return;
+ case OrmPackage.ENTITY__TABLE_GENERATOR:
+ setTableGenerator((TableGenerator)newValue);
+ return;
+ case OrmPackage.ENTITY__NAMED_QUERIES:
+ getNamedQueries().clear();
+ getNamedQueries().addAll((Collection<? extends NamedQuery>)newValue);
+ return;
+ case OrmPackage.ENTITY__NAMED_NATIVE_QUERIES:
+ getNamedNativeQueries().clear();
+ getNamedNativeQueries().addAll((Collection<? extends NamedNativeQuery>)newValue);
+ return;
+ case OrmPackage.ENTITY__SQL_RESULT_SET_MAPPINGS:
+ getSqlResultSetMappings().clear();
+ getSqlResultSetMappings().addAll((Collection<? extends SqlResultSetMapping>)newValue);
+ return;
+ case OrmPackage.ENTITY__EXCLUDE_DEFAULT_LISTENERS:
+ setExcludeDefaultListeners(((Boolean)newValue).booleanValue());
+ return;
+ case OrmPackage.ENTITY__EXCLUDE_SUPERCLASS_LISTENERS:
+ setExcludeSuperclassListeners(((Boolean)newValue).booleanValue());
+ return;
+ case OrmPackage.ENTITY__ENTITY_LISTENERS:
+ setEntityListeners((EntityListeners)newValue);
+ return;
+ case OrmPackage.ENTITY__PRE_PERSIST:
+ setPrePersist((PrePersist)newValue);
+ return;
+ case OrmPackage.ENTITY__POST_PERSIST:
+ setPostPersist((PostPersist)newValue);
+ return;
+ case OrmPackage.ENTITY__PRE_REMOVE:
+ setPreRemove((PreRemove)newValue);
+ return;
+ case OrmPackage.ENTITY__POST_REMOVE:
+ setPostRemove((PostRemove)newValue);
+ return;
+ case OrmPackage.ENTITY__PRE_UPDATE:
+ setPreUpdate((PreUpdate)newValue);
+ return;
+ case OrmPackage.ENTITY__POST_UPDATE:
+ setPostUpdate((PostUpdate)newValue);
+ return;
+ case OrmPackage.ENTITY__POST_LOAD:
+ setPostLoad((PostLoad)newValue);
+ return;
+ case OrmPackage.ENTITY__ATTRIBUTE_OVERRIDES:
+ getAttributeOverrides().clear();
+ getAttributeOverrides().addAll((Collection<? extends AttributeOverride>)newValue);
+ return;
+ case OrmPackage.ENTITY__ASSOCIATION_OVERRIDES:
+ getAssociationOverrides().clear();
+ getAssociationOverrides().addAll((Collection<? extends AssociationOverride>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.ENTITY__TABLE:
+ setTable((Table)null);
+ return;
+ case OrmPackage.ENTITY__SECONDARY_TABLES:
+ getSecondaryTables().clear();
+ return;
+ case OrmPackage.ENTITY__PRIMARY_KEY_JOIN_COLUMNS:
+ getPrimaryKeyJoinColumns().clear();
+ return;
+ case OrmPackage.ENTITY__ID_CLASS:
+ setIdClass((IdClass)null);
+ return;
+ case OrmPackage.ENTITY__INHERITANCE:
+ setInheritance((Inheritance)null);
+ return;
+ case OrmPackage.ENTITY__DISCRIMINATOR_VALUE:
+ setDiscriminatorValue(DISCRIMINATOR_VALUE_EDEFAULT);
+ return;
+ case OrmPackage.ENTITY__DISCRIMINATOR_COLUMN:
+ setDiscriminatorColumn((DiscriminatorColumn)null);
+ return;
+ case OrmPackage.ENTITY__SEQUENCE_GENERATOR:
+ setSequenceGenerator((SequenceGenerator)null);
+ return;
+ case OrmPackage.ENTITY__TABLE_GENERATOR:
+ setTableGenerator((TableGenerator)null);
+ return;
+ case OrmPackage.ENTITY__NAMED_QUERIES:
+ getNamedQueries().clear();
+ return;
+ case OrmPackage.ENTITY__NAMED_NATIVE_QUERIES:
+ getNamedNativeQueries().clear();
+ return;
+ case OrmPackage.ENTITY__SQL_RESULT_SET_MAPPINGS:
+ getSqlResultSetMappings().clear();
+ return;
+ case OrmPackage.ENTITY__EXCLUDE_DEFAULT_LISTENERS:
+ setExcludeDefaultListeners(EXCLUDE_DEFAULT_LISTENERS_EDEFAULT);
+ return;
+ case OrmPackage.ENTITY__EXCLUDE_SUPERCLASS_LISTENERS:
+ setExcludeSuperclassListeners(EXCLUDE_SUPERCLASS_LISTENERS_EDEFAULT);
+ return;
+ case OrmPackage.ENTITY__ENTITY_LISTENERS:
+ setEntityListeners((EntityListeners)null);
+ return;
+ case OrmPackage.ENTITY__PRE_PERSIST:
+ setPrePersist((PrePersist)null);
+ return;
+ case OrmPackage.ENTITY__POST_PERSIST:
+ setPostPersist((PostPersist)null);
+ return;
+ case OrmPackage.ENTITY__PRE_REMOVE:
+ setPreRemove((PreRemove)null);
+ return;
+ case OrmPackage.ENTITY__POST_REMOVE:
+ setPostRemove((PostRemove)null);
+ return;
+ case OrmPackage.ENTITY__PRE_UPDATE:
+ setPreUpdate((PreUpdate)null);
+ return;
+ case OrmPackage.ENTITY__POST_UPDATE:
+ setPostUpdate((PostUpdate)null);
+ return;
+ case OrmPackage.ENTITY__POST_LOAD:
+ setPostLoad((PostLoad)null);
+ return;
+ case OrmPackage.ENTITY__ATTRIBUTE_OVERRIDES:
+ getAttributeOverrides().clear();
+ return;
+ case OrmPackage.ENTITY__ASSOCIATION_OVERRIDES:
+ getAssociationOverrides().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.ENTITY__TABLE:
+ return table != null;
+ case OrmPackage.ENTITY__SECONDARY_TABLES:
+ return secondaryTables != null && !secondaryTables.isEmpty();
+ case OrmPackage.ENTITY__PRIMARY_KEY_JOIN_COLUMNS:
+ return primaryKeyJoinColumns != null && !primaryKeyJoinColumns.isEmpty();
+ case OrmPackage.ENTITY__ID_CLASS:
+ return idClass != null;
+ case OrmPackage.ENTITY__INHERITANCE:
+ return inheritance != null;
+ case OrmPackage.ENTITY__DISCRIMINATOR_VALUE:
+ return DISCRIMINATOR_VALUE_EDEFAULT == null ? discriminatorValue != null : !DISCRIMINATOR_VALUE_EDEFAULT.equals(discriminatorValue);
+ case OrmPackage.ENTITY__DISCRIMINATOR_COLUMN:
+ return discriminatorColumn != null;
+ case OrmPackage.ENTITY__SEQUENCE_GENERATOR:
+ return sequenceGenerator != null;
+ case OrmPackage.ENTITY__TABLE_GENERATOR:
+ return tableGenerator != null;
+ case OrmPackage.ENTITY__NAMED_QUERIES:
+ return namedQueries != null && !namedQueries.isEmpty();
+ case OrmPackage.ENTITY__NAMED_NATIVE_QUERIES:
+ return namedNativeQueries != null && !namedNativeQueries.isEmpty();
+ case OrmPackage.ENTITY__SQL_RESULT_SET_MAPPINGS:
+ return sqlResultSetMappings != null && !sqlResultSetMappings.isEmpty();
+ case OrmPackage.ENTITY__EXCLUDE_DEFAULT_LISTENERS:
+ return excludeDefaultListeners != EXCLUDE_DEFAULT_LISTENERS_EDEFAULT;
+ case OrmPackage.ENTITY__EXCLUDE_SUPERCLASS_LISTENERS:
+ return excludeSuperclassListeners != EXCLUDE_SUPERCLASS_LISTENERS_EDEFAULT;
+ case OrmPackage.ENTITY__ENTITY_LISTENERS:
+ return entityListeners != null;
+ case OrmPackage.ENTITY__PRE_PERSIST:
+ return prePersist != null;
+ case OrmPackage.ENTITY__POST_PERSIST:
+ return postPersist != null;
+ case OrmPackage.ENTITY__PRE_REMOVE:
+ return preRemove != null;
+ case OrmPackage.ENTITY__POST_REMOVE:
+ return postRemove != null;
+ case OrmPackage.ENTITY__PRE_UPDATE:
+ return preUpdate != null;
+ case OrmPackage.ENTITY__POST_UPDATE:
+ return postUpdate != null;
+ case OrmPackage.ENTITY__POST_LOAD:
+ return postLoad != null;
+ case OrmPackage.ENTITY__ATTRIBUTE_OVERRIDES:
+ return attributeOverrides != null && !attributeOverrides.isEmpty();
+ case OrmPackage.ENTITY__ASSOCIATION_OVERRIDES:
+ return associationOverrides != null && !associationOverrides.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", discriminatorValue: ");
+ result.append(discriminatorValue);
+ result.append(", excludeDefaultListeners: ");
+ result.append(excludeDefaultListeners);
+ result.append(", excludeSuperclassListeners: ");
+ result.append(excludeSuperclassListeners);
+ result.append(')');
+ return result.toString();
+ }
+
+} // Entity
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EntityListener.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EntityListener.java
new file mode 100644
index 0000000000..c141a5d5f5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EntityListener.java
@@ -0,0 +1,793 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Entity Listener</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getClassName <em>Class Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPrePersist <em>Pre Persist</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPostPersist <em>Post Persist</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPreRemove <em>Pre Remove</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPostRemove <em>Post Remove</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPreUpdate <em>Pre Update</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPostUpdate <em>Post Update</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPostLoad <em>Post Load</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityListener()
+ * @model kind="class"
+ * @extends IJpaEObject
+ * @generated
+ */
+public class EntityListener extends JpaEObject implements IJpaEObject
+{
+ /**
+ * The default value of the '{@link #getClassName() <em>Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getClassName()
+ * @generated
+ * @ordered
+ */
+ protected static final String CLASS_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getClassName() <em>Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getClassName()
+ * @generated
+ * @ordered
+ */
+ protected String className = CLASS_NAME_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getPrePersist() <em>Pre Persist</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPrePersist()
+ * @generated
+ * @ordered
+ */
+ protected PrePersist prePersist;
+
+ /**
+ * The cached value of the '{@link #getPostPersist() <em>Post Persist</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPostPersist()
+ * @generated
+ * @ordered
+ */
+ protected PostPersist postPersist;
+
+ /**
+ * The cached value of the '{@link #getPreRemove() <em>Pre Remove</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPreRemove()
+ * @generated
+ * @ordered
+ */
+ protected PreRemove preRemove;
+
+ /**
+ * The cached value of the '{@link #getPostRemove() <em>Post Remove</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPostRemove()
+ * @generated
+ * @ordered
+ */
+ protected PostRemove postRemove;
+
+ /**
+ * The cached value of the '{@link #getPreUpdate() <em>Pre Update</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPreUpdate()
+ * @generated
+ * @ordered
+ */
+ protected PreUpdate preUpdate;
+
+ /**
+ * The cached value of the '{@link #getPostUpdate() <em>Post Update</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPostUpdate()
+ * @generated
+ * @ordered
+ */
+ protected PostUpdate postUpdate;
+
+ /**
+ * The cached value of the '{@link #getPostLoad() <em>Post Load</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPostLoad()
+ * @generated
+ * @ordered
+ */
+ protected PostLoad postLoad;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EntityListener()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ENTITY_LISTENER;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Class Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Class Name</em>' attribute.
+ * @see #setClassName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityListener_ClassName()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getClassName()
+ {
+ return className;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getClassName <em>Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Class Name</em>' attribute.
+ * @see #getClassName()
+ * @generated
+ */
+ public void setClassName(String newClassName)
+ {
+ String oldClassName = className;
+ className = newClassName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_LISTENER__CLASS_NAME, oldClassName, className));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Pre Persist</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Pre Persist</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Pre Persist</em>' containment reference.
+ * @see #setPrePersist(PrePersist)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityListener_PrePersist()
+ * @model containment="true"
+ * @generated
+ */
+ public PrePersist getPrePersist()
+ {
+ return prePersist;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPrePersist(PrePersist newPrePersist, NotificationChain msgs)
+ {
+ PrePersist oldPrePersist = prePersist;
+ prePersist = newPrePersist;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_LISTENER__PRE_PERSIST, oldPrePersist, newPrePersist);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPrePersist <em>Pre Persist</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Pre Persist</em>' containment reference.
+ * @see #getPrePersist()
+ * @generated
+ */
+ public void setPrePersist(PrePersist newPrePersist)
+ {
+ if (newPrePersist != prePersist)
+ {
+ NotificationChain msgs = null;
+ if (prePersist != null)
+ msgs = ((InternalEObject)prePersist).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_LISTENER__PRE_PERSIST, null, msgs);
+ if (newPrePersist != null)
+ msgs = ((InternalEObject)newPrePersist).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_LISTENER__PRE_PERSIST, null, msgs);
+ msgs = basicSetPrePersist(newPrePersist, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_LISTENER__PRE_PERSIST, newPrePersist, newPrePersist));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Post Persist</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Post Persist</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Post Persist</em>' containment reference.
+ * @see #setPostPersist(PostPersist)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityListener_PostPersist()
+ * @model containment="true"
+ * @generated
+ */
+ public PostPersist getPostPersist()
+ {
+ return postPersist;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPostPersist(PostPersist newPostPersist, NotificationChain msgs)
+ {
+ PostPersist oldPostPersist = postPersist;
+ postPersist = newPostPersist;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_LISTENER__POST_PERSIST, oldPostPersist, newPostPersist);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPostPersist <em>Post Persist</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Post Persist</em>' containment reference.
+ * @see #getPostPersist()
+ * @generated
+ */
+ public void setPostPersist(PostPersist newPostPersist)
+ {
+ if (newPostPersist != postPersist)
+ {
+ NotificationChain msgs = null;
+ if (postPersist != null)
+ msgs = ((InternalEObject)postPersist).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_LISTENER__POST_PERSIST, null, msgs);
+ if (newPostPersist != null)
+ msgs = ((InternalEObject)newPostPersist).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_LISTENER__POST_PERSIST, null, msgs);
+ msgs = basicSetPostPersist(newPostPersist, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_LISTENER__POST_PERSIST, newPostPersist, newPostPersist));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Pre Remove</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Pre Remove</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Pre Remove</em>' containment reference.
+ * @see #setPreRemove(PreRemove)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityListener_PreRemove()
+ * @model containment="true"
+ * @generated
+ */
+ public PreRemove getPreRemove()
+ {
+ return preRemove;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPreRemove(PreRemove newPreRemove, NotificationChain msgs)
+ {
+ PreRemove oldPreRemove = preRemove;
+ preRemove = newPreRemove;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_LISTENER__PRE_REMOVE, oldPreRemove, newPreRemove);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPreRemove <em>Pre Remove</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Pre Remove</em>' containment reference.
+ * @see #getPreRemove()
+ * @generated
+ */
+ public void setPreRemove(PreRemove newPreRemove)
+ {
+ if (newPreRemove != preRemove)
+ {
+ NotificationChain msgs = null;
+ if (preRemove != null)
+ msgs = ((InternalEObject)preRemove).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_LISTENER__PRE_REMOVE, null, msgs);
+ if (newPreRemove != null)
+ msgs = ((InternalEObject)newPreRemove).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_LISTENER__PRE_REMOVE, null, msgs);
+ msgs = basicSetPreRemove(newPreRemove, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_LISTENER__PRE_REMOVE, newPreRemove, newPreRemove));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Post Remove</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Post Remove</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Post Remove</em>' containment reference.
+ * @see #setPostRemove(PostRemove)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityListener_PostRemove()
+ * @model containment="true"
+ * @generated
+ */
+ public PostRemove getPostRemove()
+ {
+ return postRemove;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPostRemove(PostRemove newPostRemove, NotificationChain msgs)
+ {
+ PostRemove oldPostRemove = postRemove;
+ postRemove = newPostRemove;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_LISTENER__POST_REMOVE, oldPostRemove, newPostRemove);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPostRemove <em>Post Remove</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Post Remove</em>' containment reference.
+ * @see #getPostRemove()
+ * @generated
+ */
+ public void setPostRemove(PostRemove newPostRemove)
+ {
+ if (newPostRemove != postRemove)
+ {
+ NotificationChain msgs = null;
+ if (postRemove != null)
+ msgs = ((InternalEObject)postRemove).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_LISTENER__POST_REMOVE, null, msgs);
+ if (newPostRemove != null)
+ msgs = ((InternalEObject)newPostRemove).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_LISTENER__POST_REMOVE, null, msgs);
+ msgs = basicSetPostRemove(newPostRemove, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_LISTENER__POST_REMOVE, newPostRemove, newPostRemove));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Pre Update</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Pre Update</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Pre Update</em>' containment reference.
+ * @see #setPreUpdate(PreUpdate)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityListener_PreUpdate()
+ * @model containment="true"
+ * @generated
+ */
+ public PreUpdate getPreUpdate()
+ {
+ return preUpdate;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPreUpdate(PreUpdate newPreUpdate, NotificationChain msgs)
+ {
+ PreUpdate oldPreUpdate = preUpdate;
+ preUpdate = newPreUpdate;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_LISTENER__PRE_UPDATE, oldPreUpdate, newPreUpdate);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPreUpdate <em>Pre Update</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Pre Update</em>' containment reference.
+ * @see #getPreUpdate()
+ * @generated
+ */
+ public void setPreUpdate(PreUpdate newPreUpdate)
+ {
+ if (newPreUpdate != preUpdate)
+ {
+ NotificationChain msgs = null;
+ if (preUpdate != null)
+ msgs = ((InternalEObject)preUpdate).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_LISTENER__PRE_UPDATE, null, msgs);
+ if (newPreUpdate != null)
+ msgs = ((InternalEObject)newPreUpdate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_LISTENER__PRE_UPDATE, null, msgs);
+ msgs = basicSetPreUpdate(newPreUpdate, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_LISTENER__PRE_UPDATE, newPreUpdate, newPreUpdate));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Post Update</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Post Update</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Post Update</em>' containment reference.
+ * @see #setPostUpdate(PostUpdate)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityListener_PostUpdate()
+ * @model containment="true"
+ * @generated
+ */
+ public PostUpdate getPostUpdate()
+ {
+ return postUpdate;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPostUpdate(PostUpdate newPostUpdate, NotificationChain msgs)
+ {
+ PostUpdate oldPostUpdate = postUpdate;
+ postUpdate = newPostUpdate;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_LISTENER__POST_UPDATE, oldPostUpdate, newPostUpdate);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPostUpdate <em>Post Update</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Post Update</em>' containment reference.
+ * @see #getPostUpdate()
+ * @generated
+ */
+ public void setPostUpdate(PostUpdate newPostUpdate)
+ {
+ if (newPostUpdate != postUpdate)
+ {
+ NotificationChain msgs = null;
+ if (postUpdate != null)
+ msgs = ((InternalEObject)postUpdate).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_LISTENER__POST_UPDATE, null, msgs);
+ if (newPostUpdate != null)
+ msgs = ((InternalEObject)newPostUpdate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_LISTENER__POST_UPDATE, null, msgs);
+ msgs = basicSetPostUpdate(newPostUpdate, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_LISTENER__POST_UPDATE, newPostUpdate, newPostUpdate));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Post Load</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Post Load</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Post Load</em>' containment reference.
+ * @see #setPostLoad(PostLoad)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityListener_PostLoad()
+ * @model containment="true"
+ * @generated
+ */
+ public PostLoad getPostLoad()
+ {
+ return postLoad;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPostLoad(PostLoad newPostLoad, NotificationChain msgs)
+ {
+ PostLoad oldPostLoad = postLoad;
+ postLoad = newPostLoad;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_LISTENER__POST_LOAD, oldPostLoad, newPostLoad);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPostLoad <em>Post Load</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Post Load</em>' containment reference.
+ * @see #getPostLoad()
+ * @generated
+ */
+ public void setPostLoad(PostLoad newPostLoad)
+ {
+ if (newPostLoad != postLoad)
+ {
+ NotificationChain msgs = null;
+ if (postLoad != null)
+ msgs = ((InternalEObject)postLoad).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_LISTENER__POST_LOAD, null, msgs);
+ if (newPostLoad != null)
+ msgs = ((InternalEObject)newPostLoad).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_LISTENER__POST_LOAD, null, msgs);
+ msgs = basicSetPostLoad(newPostLoad, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_LISTENER__POST_LOAD, newPostLoad, newPostLoad));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_LISTENER__PRE_PERSIST:
+ return basicSetPrePersist(null, msgs);
+ case OrmPackage.ENTITY_LISTENER__POST_PERSIST:
+ return basicSetPostPersist(null, msgs);
+ case OrmPackage.ENTITY_LISTENER__PRE_REMOVE:
+ return basicSetPreRemove(null, msgs);
+ case OrmPackage.ENTITY_LISTENER__POST_REMOVE:
+ return basicSetPostRemove(null, msgs);
+ case OrmPackage.ENTITY_LISTENER__PRE_UPDATE:
+ return basicSetPreUpdate(null, msgs);
+ case OrmPackage.ENTITY_LISTENER__POST_UPDATE:
+ return basicSetPostUpdate(null, msgs);
+ case OrmPackage.ENTITY_LISTENER__POST_LOAD:
+ return basicSetPostLoad(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_LISTENER__CLASS_NAME:
+ return getClassName();
+ case OrmPackage.ENTITY_LISTENER__PRE_PERSIST:
+ return getPrePersist();
+ case OrmPackage.ENTITY_LISTENER__POST_PERSIST:
+ return getPostPersist();
+ case OrmPackage.ENTITY_LISTENER__PRE_REMOVE:
+ return getPreRemove();
+ case OrmPackage.ENTITY_LISTENER__POST_REMOVE:
+ return getPostRemove();
+ case OrmPackage.ENTITY_LISTENER__PRE_UPDATE:
+ return getPreUpdate();
+ case OrmPackage.ENTITY_LISTENER__POST_UPDATE:
+ return getPostUpdate();
+ case OrmPackage.ENTITY_LISTENER__POST_LOAD:
+ return getPostLoad();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_LISTENER__CLASS_NAME:
+ setClassName((String)newValue);
+ return;
+ case OrmPackage.ENTITY_LISTENER__PRE_PERSIST:
+ setPrePersist((PrePersist)newValue);
+ return;
+ case OrmPackage.ENTITY_LISTENER__POST_PERSIST:
+ setPostPersist((PostPersist)newValue);
+ return;
+ case OrmPackage.ENTITY_LISTENER__PRE_REMOVE:
+ setPreRemove((PreRemove)newValue);
+ return;
+ case OrmPackage.ENTITY_LISTENER__POST_REMOVE:
+ setPostRemove((PostRemove)newValue);
+ return;
+ case OrmPackage.ENTITY_LISTENER__PRE_UPDATE:
+ setPreUpdate((PreUpdate)newValue);
+ return;
+ case OrmPackage.ENTITY_LISTENER__POST_UPDATE:
+ setPostUpdate((PostUpdate)newValue);
+ return;
+ case OrmPackage.ENTITY_LISTENER__POST_LOAD:
+ setPostLoad((PostLoad)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_LISTENER__CLASS_NAME:
+ setClassName(CLASS_NAME_EDEFAULT);
+ return;
+ case OrmPackage.ENTITY_LISTENER__PRE_PERSIST:
+ setPrePersist((PrePersist)null);
+ return;
+ case OrmPackage.ENTITY_LISTENER__POST_PERSIST:
+ setPostPersist((PostPersist)null);
+ return;
+ case OrmPackage.ENTITY_LISTENER__PRE_REMOVE:
+ setPreRemove((PreRemove)null);
+ return;
+ case OrmPackage.ENTITY_LISTENER__POST_REMOVE:
+ setPostRemove((PostRemove)null);
+ return;
+ case OrmPackage.ENTITY_LISTENER__PRE_UPDATE:
+ setPreUpdate((PreUpdate)null);
+ return;
+ case OrmPackage.ENTITY_LISTENER__POST_UPDATE:
+ setPostUpdate((PostUpdate)null);
+ return;
+ case OrmPackage.ENTITY_LISTENER__POST_LOAD:
+ setPostLoad((PostLoad)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_LISTENER__CLASS_NAME:
+ return CLASS_NAME_EDEFAULT == null ? className != null : !CLASS_NAME_EDEFAULT.equals(className);
+ case OrmPackage.ENTITY_LISTENER__PRE_PERSIST:
+ return prePersist != null;
+ case OrmPackage.ENTITY_LISTENER__POST_PERSIST:
+ return postPersist != null;
+ case OrmPackage.ENTITY_LISTENER__PRE_REMOVE:
+ return preRemove != null;
+ case OrmPackage.ENTITY_LISTENER__POST_REMOVE:
+ return postRemove != null;
+ case OrmPackage.ENTITY_LISTENER__PRE_UPDATE:
+ return preUpdate != null;
+ case OrmPackage.ENTITY_LISTENER__POST_UPDATE:
+ return postUpdate != null;
+ case OrmPackage.ENTITY_LISTENER__POST_LOAD:
+ return postLoad != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (className: ");
+ result.append(className);
+ result.append(')');
+ return result.toString();
+ }
+
+} // EntityListener
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EntityListeners.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EntityListeners.java
new file mode 100644
index 0000000000..490f8a261e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EntityListeners.java
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Entity Listeners</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityListeners#getEntityListeners <em>Entity Listeners</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityListeners()
+ * @model kind="class"
+ * @extends IJpaEObject
+ * @generated
+ */
+public class EntityListeners extends JpaEObject implements IJpaEObject
+{
+ /**
+ * The cached value of the '{@link #getEntityListeners() <em>Entity Listeners</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEntityListeners()
+ * @generated
+ * @ordered
+ */
+ protected EList<EntityListener> entityListeners;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EntityListeners()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ENTITY_LISTENERS;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Entity Listeners</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.EntityListener}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Entity Listeners</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Entity Listeners</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityListeners_EntityListeners()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<EntityListener> getEntityListeners()
+ {
+ if (entityListeners == null)
+ {
+ entityListeners = new EObjectContainmentEList<EntityListener>(EntityListener.class, this, OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENERS);
+ }
+ return entityListeners;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENERS:
+ return ((InternalEList<?>)getEntityListeners()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENERS:
+ return getEntityListeners();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENERS:
+ getEntityListeners().clear();
+ getEntityListeners().addAll((Collection<? extends EntityListener>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENERS:
+ getEntityListeners().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENERS:
+ return entityListeners != null && !entityListeners.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+} // EntityListeners
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EntityMappings.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EntityMappings.java
new file mode 100644
index 0000000000..2ae5b1e52b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EntityMappings.java
@@ -0,0 +1,1073 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Entity Mappings</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getVersion <em>Version</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getDescription <em>Description</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getPersistenceUnitMetadata <em>Persistence Unit Metadata</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getPackage <em>Package</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getSchema <em>Schema</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getCatalog <em>Catalog</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getAccess <em>Access</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getSequenceGenerators <em>Sequence Generators</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getTableGenerators <em>Table Generators</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getNamedQueries <em>Named Queries</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getNamedNativeQueries <em>Named Native Queries</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getSqlResultSetMappings <em>Sql Result Set Mappings</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getMappedSuperclasses <em>Mapped Superclasses</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getEntities <em>Entities</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getEmbeddables <em>Embeddables</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings()
+ * @model kind="class"
+ * @extends IJpaEObject
+ * @generated
+ */
+public class EntityMappings extends JpaEObject implements IJpaEObject
+{
+ /**
+ * The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getVersion()
+ * @generated
+ * @ordered
+ */
+ protected static final String VERSION_EDEFAULT = "1.0";
+
+ /**
+ * The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getVersion()
+ * @generated
+ * @ordered
+ */
+ protected String version = VERSION_EDEFAULT;
+
+ /**
+ * This is true if the Version attribute has been set.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ protected boolean versionESet;
+
+ /**
+ * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDescription()
+ * @generated
+ * @ordered
+ */
+ protected static final String DESCRIPTION_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDescription()
+ * @generated
+ * @ordered
+ */
+ protected String description = DESCRIPTION_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getPersistenceUnitMetadata() <em>Persistence Unit Metadata</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPersistenceUnitMetadata()
+ * @generated
+ * @ordered
+ */
+ protected PersistenceUnitMetadata persistenceUnitMetadata;
+
+ /**
+ * The default value of the '{@link #getPackage() <em>Package</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPackage()
+ * @generated
+ * @ordered
+ */
+ protected static final String PACKAGE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getPackage() <em>Package</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPackage()
+ * @generated
+ * @ordered
+ */
+ protected String package_ = PACKAGE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getSchema() <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSchema()
+ * @generated
+ * @ordered
+ */
+ protected static final String SCHEMA_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getSchema() <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSchema()
+ * @generated
+ * @ordered
+ */
+ protected String schema = SCHEMA_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCatalog()
+ * @generated
+ * @ordered
+ */
+ protected static final String CATALOG_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCatalog()
+ * @generated
+ * @ordered
+ */
+ protected String catalog = CATALOG_EDEFAULT;
+
+ /**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final AccessType ACCESS_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getAccess() <em>Access</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAccess()
+ * @generated
+ * @ordered
+ */
+ protected AccessType access = ACCESS_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getSequenceGenerators() <em>Sequence Generators</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSequenceGenerators()
+ * @generated
+ * @ordered
+ */
+ protected EList<SequenceGenerator> sequenceGenerators;
+
+ /**
+ * The cached value of the '{@link #getTableGenerators() <em>Table Generators</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTableGenerators()
+ * @generated
+ * @ordered
+ */
+ protected EList<TableGenerator> tableGenerators;
+
+ /**
+ * The cached value of the '{@link #getNamedQueries() <em>Named Queries</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getNamedQueries()
+ * @generated
+ * @ordered
+ */
+ protected EList<NamedQuery> namedQueries;
+
+ /**
+ * The cached value of the '{@link #getNamedNativeQueries() <em>Named Native Queries</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getNamedNativeQueries()
+ * @generated
+ * @ordered
+ */
+ protected EList<NamedNativeQuery> namedNativeQueries;
+
+ /**
+ * The cached value of the '{@link #getSqlResultSetMappings() <em>Sql Result Set Mappings</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSqlResultSetMappings()
+ * @generated
+ * @ordered
+ */
+ protected EList<SqlResultSetMapping> sqlResultSetMappings;
+
+ /**
+ * The cached value of the '{@link #getMappedSuperclasses() <em>Mapped Superclasses</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMappedSuperclasses()
+ * @generated
+ * @ordered
+ */
+ protected EList<MappedSuperclass> mappedSuperclasses;
+
+ /**
+ * The cached value of the '{@link #getEntities() <em>Entities</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEntities()
+ * @generated
+ * @ordered
+ */
+ protected EList<Entity> entities;
+
+ /**
+ * The cached value of the '{@link #getEmbeddables() <em>Embeddables</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEmbeddables()
+ * @generated
+ * @ordered
+ */
+ protected EList<Embeddable> embeddables;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EntityMappings()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ENTITY_MAPPINGS;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Version</b></em>' attribute.
+ * The default value is <code>"1.0"</code>.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Version</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Version</em>' attribute.
+ * @see #isSetVersion()
+ * @see #unsetVersion()
+ * @see #setVersion(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings_Version()
+ * @model default="1.0" unsettable="true" dataType="org.eclipse.jpt.core.internal.resource.orm.VersionType" required="true"
+ * @generated
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getVersion <em>Version</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Version</em>' attribute.
+ * @see #isSetVersion()
+ * @see #unsetVersion()
+ * @see #getVersion()
+ * @generated
+ */
+ public void setVersion(String newVersion)
+ {
+ String oldVersion = version;
+ version = newVersion;
+ boolean oldVersionESet = versionESet;
+ versionESet = true;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS__VERSION, oldVersion, version, !oldVersionESet));
+ }
+
+ /**
+ * Unsets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getVersion <em>Version</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isSetVersion()
+ * @see #getVersion()
+ * @see #setVersion(String)
+ * @generated
+ */
+ public void unsetVersion()
+ {
+ String oldVersion = version;
+ boolean oldVersionESet = versionESet;
+ version = VERSION_EDEFAULT;
+ versionESet = false;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.UNSET, OrmPackage.ENTITY_MAPPINGS__VERSION, oldVersion, VERSION_EDEFAULT, oldVersionESet));
+ }
+
+ /**
+ * Returns whether the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getVersion <em>Version</em>}' attribute is set.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return whether the value of the '<em>Version</em>' attribute is set.
+ * @see #unsetVersion()
+ * @see #getVersion()
+ * @see #setVersion(String)
+ * @generated
+ */
+ public boolean isSetVersion()
+ {
+ return versionESet;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Description</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Description</em>' attribute.
+ * @see #setDescription(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings_Description()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getDescription <em>Description</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Description</em>' attribute.
+ * @see #getDescription()
+ * @generated
+ */
+ public void setDescription(String newDescription)
+ {
+ String oldDescription = description;
+ description = newDescription;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS__DESCRIPTION, oldDescription, description));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Persistence Unit Metadata</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>XmlPersistence Unit Metadata</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Persistence Unit Metadata</em>' containment reference.
+ * @see #setPersistenceUnitMetadata(PersistenceUnitMetadata)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings_PersistenceUnitMetadata()
+ * @model containment="true"
+ * @generated
+ */
+ public PersistenceUnitMetadata getPersistenceUnitMetadata()
+ {
+ return persistenceUnitMetadata;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPersistenceUnitMetadata(PersistenceUnitMetadata newPersistenceUnitMetadata, NotificationChain msgs)
+ {
+ PersistenceUnitMetadata oldPersistenceUnitMetadata = persistenceUnitMetadata;
+ persistenceUnitMetadata = newPersistenceUnitMetadata;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA, oldPersistenceUnitMetadata, newPersistenceUnitMetadata);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getPersistenceUnitMetadata <em>Persistence Unit Metadata</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Persistence Unit Metadata</em>' containment reference.
+ * @see #getPersistenceUnitMetadata()
+ * @generated
+ */
+ public void setPersistenceUnitMetadata(PersistenceUnitMetadata newPersistenceUnitMetadata)
+ {
+ if (newPersistenceUnitMetadata != persistenceUnitMetadata)
+ {
+ NotificationChain msgs = null;
+ if (persistenceUnitMetadata != null)
+ msgs = ((InternalEObject)persistenceUnitMetadata).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA, null, msgs);
+ if (newPersistenceUnitMetadata != null)
+ msgs = ((InternalEObject)newPersistenceUnitMetadata).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA, null, msgs);
+ msgs = basicSetPersistenceUnitMetadata(newPersistenceUnitMetadata, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA, newPersistenceUnitMetadata, newPersistenceUnitMetadata));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Package</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Package</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Package</em>' attribute.
+ * @see #setPackage(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings_Package()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getPackage()
+ {
+ return package_;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getPackage <em>Package</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Package</em>' attribute.
+ * @see #getPackage()
+ * @generated
+ */
+ public void setPackage(String newPackage)
+ {
+ String oldPackage = package_;
+ package_ = newPackage;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS__PACKAGE, oldPackage, package_));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Schema</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Schema</em>' attribute.
+ * @see #setSchema(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings_Schema()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getSchema()
+ {
+ return schema;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getSchema <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Schema</em>' attribute.
+ * @see #getSchema()
+ * @generated
+ */
+ public void setSchema(String newSchema)
+ {
+ String oldSchema = schema;
+ schema = newSchema;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS__SCHEMA, oldSchema, schema));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Catalog</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Catalog</em>' attribute.
+ * @see #setCatalog(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings_Catalog()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getCatalog()
+ {
+ return catalog;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getCatalog <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Catalog</em>' attribute.
+ * @see #getCatalog()
+ * @generated
+ */
+ public void setCatalog(String newCatalog)
+ {
+ String oldCatalog = catalog;
+ catalog = newCatalog;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS__CATALOG, oldCatalog, catalog));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Access</b></em>' attribute.
+ * The default value is <code>"PROPERTY"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.AccessType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Access</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Access</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AccessType
+ * @see #setAccess(AccessType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings_Access()
+ * @model default="PROPERTY"
+ * @generated
+ */
+ public AccessType getAccess()
+ {
+ return access;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getAccess <em>Access</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Access</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AccessType
+ * @see #getAccess()
+ * @generated
+ */
+ public void setAccess(AccessType newAccess)
+ {
+ AccessType oldAccess = access;
+ access = newAccess == null ? ACCESS_EDEFAULT : newAccess;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_MAPPINGS__ACCESS, oldAccess, access));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Sequence Generators</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Sequence Generators</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Sequence Generators</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings_SequenceGenerators()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<SequenceGenerator> getSequenceGenerators()
+ {
+ if (sequenceGenerators == null)
+ {
+ sequenceGenerators = new EObjectContainmentEList<SequenceGenerator>(SequenceGenerator.class, this, OrmPackage.ENTITY_MAPPINGS__SEQUENCE_GENERATORS);
+ }
+ return sequenceGenerators;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Table Generators</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Table Generators</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Table Generators</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings_TableGenerators()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<TableGenerator> getTableGenerators()
+ {
+ if (tableGenerators == null)
+ {
+ tableGenerators = new EObjectContainmentEList<TableGenerator>(TableGenerator.class, this, OrmPackage.ENTITY_MAPPINGS__TABLE_GENERATORS);
+ }
+ return tableGenerators;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Named Queries</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.NamedQuery}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Named Queries</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Named Queries</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings_NamedQueries()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<NamedQuery> getNamedQueries()
+ {
+ if (namedQueries == null)
+ {
+ namedQueries = new EObjectContainmentEList<NamedQuery>(NamedQuery.class, this, OrmPackage.ENTITY_MAPPINGS__NAMED_QUERIES);
+ }
+ return namedQueries;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Named Native Queries</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Named Native Queries</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Named Native Queries</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings_NamedNativeQueries()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<NamedNativeQuery> getNamedNativeQueries()
+ {
+ if (namedNativeQueries == null)
+ {
+ namedNativeQueries = new EObjectContainmentEList<NamedNativeQuery>(NamedNativeQuery.class, this, OrmPackage.ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES);
+ }
+ return namedNativeQueries;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Sql Result Set Mappings</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Sql Result Set Mappings</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Sql Result Set Mappings</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings_SqlResultSetMappings()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<SqlResultSetMapping> getSqlResultSetMappings()
+ {
+ if (sqlResultSetMappings == null)
+ {
+ sqlResultSetMappings = new EObjectContainmentEList<SqlResultSetMapping>(SqlResultSetMapping.class, this, OrmPackage.ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS);
+ }
+ return sqlResultSetMappings;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Mapped Superclasses</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Mapped Superclasses</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Mapped Superclasses</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings_MappedSuperclasses()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<MappedSuperclass> getMappedSuperclasses()
+ {
+ if (mappedSuperclasses == null)
+ {
+ mappedSuperclasses = new EObjectContainmentEList<MappedSuperclass>(MappedSuperclass.class, this, OrmPackage.ENTITY_MAPPINGS__MAPPED_SUPERCLASSES);
+ }
+ return mappedSuperclasses;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Entities</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.Entity}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Entities</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Entities</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings_Entities()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<Entity> getEntities()
+ {
+ if (entities == null)
+ {
+ entities = new EObjectContainmentEList<Entity>(Entity.class, this, OrmPackage.ENTITY_MAPPINGS__ENTITIES);
+ }
+ return entities;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Embeddables</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.Embeddable}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Embeddables</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Embeddables</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings_Embeddables()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<Embeddable> getEmbeddables()
+ {
+ if (embeddables == null)
+ {
+ embeddables = new EObjectContainmentEList<Embeddable>(Embeddable.class, this, OrmPackage.ENTITY_MAPPINGS__EMBEDDABLES);
+ }
+ return embeddables;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA:
+ return basicSetPersistenceUnitMetadata(null, msgs);
+ case OrmPackage.ENTITY_MAPPINGS__SEQUENCE_GENERATORS:
+ return ((InternalEList<?>)getSequenceGenerators()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ENTITY_MAPPINGS__TABLE_GENERATORS:
+ return ((InternalEList<?>)getTableGenerators()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ENTITY_MAPPINGS__NAMED_QUERIES:
+ return ((InternalEList<?>)getNamedQueries()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES:
+ return ((InternalEList<?>)getNamedNativeQueries()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS:
+ return ((InternalEList<?>)getSqlResultSetMappings()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ENTITY_MAPPINGS__MAPPED_SUPERCLASSES:
+ return ((InternalEList<?>)getMappedSuperclasses()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ENTITY_MAPPINGS__ENTITIES:
+ return ((InternalEList<?>)getEntities()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ENTITY_MAPPINGS__EMBEDDABLES:
+ return ((InternalEList<?>)getEmbeddables()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_MAPPINGS__VERSION:
+ return getVersion();
+ case OrmPackage.ENTITY_MAPPINGS__DESCRIPTION:
+ return getDescription();
+ case OrmPackage.ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA:
+ return getPersistenceUnitMetadata();
+ case OrmPackage.ENTITY_MAPPINGS__PACKAGE:
+ return getPackage();
+ case OrmPackage.ENTITY_MAPPINGS__SCHEMA:
+ return getSchema();
+ case OrmPackage.ENTITY_MAPPINGS__CATALOG:
+ return getCatalog();
+ case OrmPackage.ENTITY_MAPPINGS__ACCESS:
+ return getAccess();
+ case OrmPackage.ENTITY_MAPPINGS__SEQUENCE_GENERATORS:
+ return getSequenceGenerators();
+ case OrmPackage.ENTITY_MAPPINGS__TABLE_GENERATORS:
+ return getTableGenerators();
+ case OrmPackage.ENTITY_MAPPINGS__NAMED_QUERIES:
+ return getNamedQueries();
+ case OrmPackage.ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES:
+ return getNamedNativeQueries();
+ case OrmPackage.ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS:
+ return getSqlResultSetMappings();
+ case OrmPackage.ENTITY_MAPPINGS__MAPPED_SUPERCLASSES:
+ return getMappedSuperclasses();
+ case OrmPackage.ENTITY_MAPPINGS__ENTITIES:
+ return getEntities();
+ case OrmPackage.ENTITY_MAPPINGS__EMBEDDABLES:
+ return getEmbeddables();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_MAPPINGS__VERSION:
+ setVersion((String)newValue);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA:
+ setPersistenceUnitMetadata((PersistenceUnitMetadata)newValue);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__PACKAGE:
+ setPackage((String)newValue);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__SCHEMA:
+ setSchema((String)newValue);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__CATALOG:
+ setCatalog((String)newValue);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__ACCESS:
+ setAccess((AccessType)newValue);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__SEQUENCE_GENERATORS:
+ getSequenceGenerators().clear();
+ getSequenceGenerators().addAll((Collection<? extends SequenceGenerator>)newValue);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__TABLE_GENERATORS:
+ getTableGenerators().clear();
+ getTableGenerators().addAll((Collection<? extends TableGenerator>)newValue);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__NAMED_QUERIES:
+ getNamedQueries().clear();
+ getNamedQueries().addAll((Collection<? extends NamedQuery>)newValue);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES:
+ getNamedNativeQueries().clear();
+ getNamedNativeQueries().addAll((Collection<? extends NamedNativeQuery>)newValue);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS:
+ getSqlResultSetMappings().clear();
+ getSqlResultSetMappings().addAll((Collection<? extends SqlResultSetMapping>)newValue);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__MAPPED_SUPERCLASSES:
+ getMappedSuperclasses().clear();
+ getMappedSuperclasses().addAll((Collection<? extends MappedSuperclass>)newValue);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__ENTITIES:
+ getEntities().clear();
+ getEntities().addAll((Collection<? extends Entity>)newValue);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__EMBEDDABLES:
+ getEmbeddables().clear();
+ getEmbeddables().addAll((Collection<? extends Embeddable>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_MAPPINGS__VERSION:
+ unsetVersion();
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA:
+ setPersistenceUnitMetadata((PersistenceUnitMetadata)null);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__PACKAGE:
+ setPackage(PACKAGE_EDEFAULT);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__SCHEMA:
+ setSchema(SCHEMA_EDEFAULT);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__CATALOG:
+ setCatalog(CATALOG_EDEFAULT);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__ACCESS:
+ setAccess(ACCESS_EDEFAULT);
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__SEQUENCE_GENERATORS:
+ getSequenceGenerators().clear();
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__TABLE_GENERATORS:
+ getTableGenerators().clear();
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__NAMED_QUERIES:
+ getNamedQueries().clear();
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES:
+ getNamedNativeQueries().clear();
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS:
+ getSqlResultSetMappings().clear();
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__MAPPED_SUPERCLASSES:
+ getMappedSuperclasses().clear();
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__ENTITIES:
+ getEntities().clear();
+ return;
+ case OrmPackage.ENTITY_MAPPINGS__EMBEDDABLES:
+ getEmbeddables().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_MAPPINGS__VERSION:
+ return isSetVersion();
+ case OrmPackage.ENTITY_MAPPINGS__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ case OrmPackage.ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA:
+ return persistenceUnitMetadata != null;
+ case OrmPackage.ENTITY_MAPPINGS__PACKAGE:
+ return PACKAGE_EDEFAULT == null ? package_ != null : !PACKAGE_EDEFAULT.equals(package_);
+ case OrmPackage.ENTITY_MAPPINGS__SCHEMA:
+ return SCHEMA_EDEFAULT == null ? schema != null : !SCHEMA_EDEFAULT.equals(schema);
+ case OrmPackage.ENTITY_MAPPINGS__CATALOG:
+ return CATALOG_EDEFAULT == null ? catalog != null : !CATALOG_EDEFAULT.equals(catalog);
+ case OrmPackage.ENTITY_MAPPINGS__ACCESS:
+ return access != ACCESS_EDEFAULT;
+ case OrmPackage.ENTITY_MAPPINGS__SEQUENCE_GENERATORS:
+ return sequenceGenerators != null && !sequenceGenerators.isEmpty();
+ case OrmPackage.ENTITY_MAPPINGS__TABLE_GENERATORS:
+ return tableGenerators != null && !tableGenerators.isEmpty();
+ case OrmPackage.ENTITY_MAPPINGS__NAMED_QUERIES:
+ return namedQueries != null && !namedQueries.isEmpty();
+ case OrmPackage.ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES:
+ return namedNativeQueries != null && !namedNativeQueries.isEmpty();
+ case OrmPackage.ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS:
+ return sqlResultSetMappings != null && !sqlResultSetMappings.isEmpty();
+ case OrmPackage.ENTITY_MAPPINGS__MAPPED_SUPERCLASSES:
+ return mappedSuperclasses != null && !mappedSuperclasses.isEmpty();
+ case OrmPackage.ENTITY_MAPPINGS__ENTITIES:
+ return entities != null && !entities.isEmpty();
+ case OrmPackage.ENTITY_MAPPINGS__EMBEDDABLES:
+ return embeddables != null && !embeddables.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+
+ // **************** overrides **********************************************
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (version: ");
+ if (versionESet) result.append(version); else result.append("<unset>");
+ result.append(", description: ");
+ result.append(description);
+ result.append(", package: ");
+ result.append(package_);
+ result.append(", schema: ");
+ result.append(schema);
+ result.append(", catalog: ");
+ result.append(catalog);
+ result.append(", access: ");
+ result.append(access);
+ result.append(')');
+ return result.toString();
+ }
+
+ @Override
+ public IJpaEObject root() {
+ return this;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EntityResult.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EntityResult.java
new file mode 100644
index 0000000000..cc851b4dc5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EntityResult.java
@@ -0,0 +1,332 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Entity Result</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityResult#getDiscriminatorColumn <em>Discriminator Column</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityResult#getEntityClass <em>Entity Class</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EntityResult#getFieldResults <em>Field Results</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityResult()
+ * @model kind="class"
+ * @extends IJpaEObject
+ * @generated
+ */
+public class EntityResult extends JpaEObject implements IJpaEObject
+{
+ /**
+ * The default value of the '{@link #getDiscriminatorColumn() <em>Discriminator Column</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDiscriminatorColumn()
+ * @generated
+ * @ordered
+ */
+ protected static final String DISCRIMINATOR_COLUMN_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getDiscriminatorColumn() <em>Discriminator Column</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDiscriminatorColumn()
+ * @generated
+ * @ordered
+ */
+ protected String discriminatorColumn = DISCRIMINATOR_COLUMN_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getEntityClass() <em>Entity Class</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEntityClass()
+ * @generated
+ * @ordered
+ */
+ protected static final String ENTITY_CLASS_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getEntityClass() <em>Entity Class</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEntityClass()
+ * @generated
+ * @ordered
+ */
+ protected String entityClass = ENTITY_CLASS_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getFieldResults() <em>Field Results</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFieldResults()
+ * @generated
+ * @ordered
+ */
+ protected EList<FieldResult> fieldResults;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EntityResult()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ENTITY_RESULT;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Discriminator Column</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Discriminator Column</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Discriminator Column</em>' attribute.
+ * @see #setDiscriminatorColumn(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityResult_DiscriminatorColumn()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getDiscriminatorColumn()
+ {
+ return discriminatorColumn;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityResult#getDiscriminatorColumn <em>Discriminator Column</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Discriminator Column</em>' attribute.
+ * @see #getDiscriminatorColumn()
+ * @generated
+ */
+ public void setDiscriminatorColumn(String newDiscriminatorColumn)
+ {
+ String oldDiscriminatorColumn = discriminatorColumn;
+ discriminatorColumn = newDiscriminatorColumn;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_RESULT__DISCRIMINATOR_COLUMN, oldDiscriminatorColumn, discriminatorColumn));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Entity Class</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Entity Class</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Entity Class</em>' attribute.
+ * @see #setEntityClass(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityResult_EntityClass()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getEntityClass()
+ {
+ return entityClass;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityResult#getEntityClass <em>Entity Class</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Entity Class</em>' attribute.
+ * @see #getEntityClass()
+ * @generated
+ */
+ public void setEntityClass(String newEntityClass)
+ {
+ String oldEntityClass = entityClass;
+ entityClass = newEntityClass;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ENTITY_RESULT__ENTITY_CLASS, oldEntityClass, entityClass));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Field Results</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.FieldResult}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Field Results</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Field Results</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityResult_FieldResults()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<FieldResult> getFieldResults()
+ {
+ if (fieldResults == null)
+ {
+ fieldResults = new EObjectContainmentEList<FieldResult>(FieldResult.class, this, OrmPackage.ENTITY_RESULT__FIELD_RESULTS);
+ }
+ return fieldResults;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_RESULT__FIELD_RESULTS:
+ return ((InternalEList<?>)getFieldResults()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_RESULT__DISCRIMINATOR_COLUMN:
+ return getDiscriminatorColumn();
+ case OrmPackage.ENTITY_RESULT__ENTITY_CLASS:
+ return getEntityClass();
+ case OrmPackage.ENTITY_RESULT__FIELD_RESULTS:
+ return getFieldResults();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_RESULT__DISCRIMINATOR_COLUMN:
+ setDiscriminatorColumn((String)newValue);
+ return;
+ case OrmPackage.ENTITY_RESULT__ENTITY_CLASS:
+ setEntityClass((String)newValue);
+ return;
+ case OrmPackage.ENTITY_RESULT__FIELD_RESULTS:
+ getFieldResults().clear();
+ getFieldResults().addAll((Collection<? extends FieldResult>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_RESULT__DISCRIMINATOR_COLUMN:
+ setDiscriminatorColumn(DISCRIMINATOR_COLUMN_EDEFAULT);
+ return;
+ case OrmPackage.ENTITY_RESULT__ENTITY_CLASS:
+ setEntityClass(ENTITY_CLASS_EDEFAULT);
+ return;
+ case OrmPackage.ENTITY_RESULT__FIELD_RESULTS:
+ getFieldResults().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ENTITY_RESULT__DISCRIMINATOR_COLUMN:
+ return DISCRIMINATOR_COLUMN_EDEFAULT == null ? discriminatorColumn != null : !DISCRIMINATOR_COLUMN_EDEFAULT.equals(discriminatorColumn);
+ case OrmPackage.ENTITY_RESULT__ENTITY_CLASS:
+ return ENTITY_CLASS_EDEFAULT == null ? entityClass != null : !ENTITY_CLASS_EDEFAULT.equals(entityClass);
+ case OrmPackage.ENTITY_RESULT__FIELD_RESULTS:
+ return fieldResults != null && !fieldResults.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (discriminatorColumn: ");
+ result.append(discriminatorColumn);
+ result.append(", entityClass: ");
+ result.append(entityClass);
+ result.append(')');
+ return result.toString();
+ }
+
+} // EntityResult
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/EnumType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EnumType.java
index c205679964..a5074a36b9 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/EnumType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EnumType.java
@@ -1,39 +1,31 @@
/*******************************************************************************
* Copyright (c) 2007 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.
+ * 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.mappings;
+package org.eclipse.jpt.core.internal.resource.orm;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.eclipse.emf.common.util.Enumerator;
-import org.eclipse.jpt.core.internal.content.java.mappings.JPA;
/**
* <!-- begin-user-doc -->
* A representation of the literals of the enumeration '<em><b>Enum Type</b></em>',
* and utility methods for working with them.
* <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getEnumType()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEnumType()
* @model
* @generated
*/
-public enum EnumType implements Enumerator {
+public enum EnumType implements Enumerator
+{
/**
- * The '<em><b>Default</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #DEFAULT_VALUE
- * @generated
- * @ordered
- */
- DEFAULT(0, "Default", "Default (Ordinal)"), /**
* The '<em><b>ORDINAL</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -41,7 +33,8 @@ public enum EnumType implements Enumerator {
* @generated
* @ordered
*/
- ORDINAL(1, "ORDINAL", "Ordinal"),
+ ORDINAL(0, "ORDINAL", "ORDINAL"),
+
/**
* The '<em><b>STRING</b></em>' literal object.
* <!-- begin-user-doc -->
@@ -50,21 +43,7 @@ public enum EnumType implements Enumerator {
* @generated
* @ordered
*/
- STRING(2, "STRING", "String");
- /**
- * The '<em><b>Default</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>Default</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #DEFAULT
- * @model name="Default" literal="Default (Ordinal)"
- * @generated
- * @ordered
- */
- public static final int DEFAULT_VALUE = 0;
+ STRING(1, "STRING", "STRING");
/**
* The '<em><b>ORDINAL</b></em>' literal value.
@@ -75,11 +54,11 @@ public enum EnumType implements Enumerator {
* </p>
* <!-- end-user-doc -->
* @see #ORDINAL
- * @model literal="Ordinal"
+ * @model
* @generated
* @ordered
*/
- public static final int ORDINAL_VALUE = 1;
+ public static final int ORDINAL_VALUE = 0;
/**
* The '<em><b>STRING</b></em>' literal value.
@@ -90,11 +69,11 @@ public enum EnumType implements Enumerator {
* </p>
* <!-- end-user-doc -->
* @see #STRING
- * @model literal="String"
+ * @model
* @generated
* @ordered
*/
- public static final int STRING_VALUE = 2;
+ public static final int STRING_VALUE = 1;
/**
* An array of all the '<em><b>Enum Type</b></em>' enumerators.
@@ -102,9 +81,12 @@ public enum EnumType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- private static final EnumType[] VALUES_ARRAY = new EnumType[] {
- DEFAULT, ORDINAL, STRING,
- };
+ private static final EnumType[] VALUES_ARRAY =
+ new EnumType[]
+ {
+ ORDINAL,
+ STRING,
+ };
/**
* A public read-only list of all the '<em><b>Enum Type</b></em>' enumerators.
@@ -120,10 +102,13 @@ public enum EnumType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static EnumType get(String literal) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ public static EnumType get(String literal)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
EnumType result = VALUES_ARRAY[i];
- if (result.toString().equals(literal)) {
+ if (result.toString().equals(literal))
+ {
return result;
}
}
@@ -136,10 +121,13 @@ public enum EnumType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static EnumType getByName(String name) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ public static EnumType getByName(String name)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
EnumType result = VALUES_ARRAY[i];
- if (result.getName().equals(name)) {
+ if (result.getName().equals(name))
+ {
return result;
}
}
@@ -152,14 +140,12 @@ public enum EnumType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static EnumType get(int value) {
- switch (value) {
- case DEFAULT_VALUE :
- return DEFAULT;
- case ORDINAL_VALUE :
- return ORDINAL;
- case STRING_VALUE :
- return STRING;
+ public static EnumType get(int value)
+ {
+ switch (value)
+ {
+ case ORDINAL_VALUE: return ORDINAL;
+ case STRING_VALUE: return STRING;
}
return null;
}
@@ -191,7 +177,8 @@ public enum EnumType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- private EnumType(int value, String name, String literal) {
+ private EnumType(int value, String name, String literal)
+ {
this.value = value;
this.name = name;
this.literal = literal;
@@ -202,8 +189,9 @@ public enum EnumType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public int getValue() {
- return value;
+ public int getValue()
+ {
+ return value;
}
/**
@@ -211,8 +199,9 @@ public enum EnumType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public String getName() {
- return name;
+ public String getName()
+ {
+ return name;
}
/**
@@ -220,8 +209,9 @@ public enum EnumType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public String getLiteral() {
- return literal;
+ public String getLiteral()
+ {
+ return literal;
}
/**
@@ -231,33 +221,9 @@ public enum EnumType implements Enumerator {
* @generated
*/
@Override
- public String toString() {
+ public String toString()
+ {
return literal;
}
-
- public static EnumType fromJavaAnnotationValue(Object javaAnnotationValue) {
- if (javaAnnotationValue == null) {
- return DEFAULT;
- }
- if (javaAnnotationValue.equals(JPA.ENUM_TYPE__ORDINAL)) {
- return ORDINAL;
- }
- if (javaAnnotationValue.equals(JPA.ENUM_TYPE__STRING)) {
- return STRING;
- }
- return DEFAULT;
- }
-
- public String convertToJavaAnnotationValue() {
- switch (this.getValue()) {
- case DEFAULT_VALUE :
- return null;
- case ORDINAL_VALUE :
- return JPA.ENUM_TYPE__ORDINAL;
- case STRING_VALUE :
- return JPA.ENUM_TYPE__STRING;
- default :
- throw new IllegalArgumentException("unknown enum type: " + this);
- }
- }
+
} //EnumType
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EventMethod.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EventMethod.java
new file mode 100644
index 0000000000..5f5f922b34
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/EventMethod.java
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Event Method</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.EventMethod#getMethodName <em>Method Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEventMethod()
+ * @model kind="class"
+ * @extends IJpaEObject
+ * @generated
+ */
+public class EventMethod extends JpaEObject implements IJpaEObject
+{
+ /**
+ * The default value of the '{@link #getMethodName() <em>Method Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMethodName()
+ * @generated
+ * @ordered
+ */
+ protected static final String METHOD_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getMethodName() <em>Method Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMethodName()
+ * @generated
+ * @ordered
+ */
+ protected String methodName = METHOD_NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EventMethod()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.EVENT_METHOD;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Method Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Method Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Method Name</em>' attribute.
+ * @see #setMethodName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEventMethod_MethodName()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getMethodName()
+ {
+ return methodName;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.EventMethod#getMethodName <em>Method Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Method Name</em>' attribute.
+ * @see #getMethodName()
+ * @generated
+ */
+ public void setMethodName(String newMethodName)
+ {
+ String oldMethodName = methodName;
+ methodName = newMethodName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.EVENT_METHOD__METHOD_NAME, oldMethodName, methodName));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.EVENT_METHOD__METHOD_NAME:
+ return getMethodName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.EVENT_METHOD__METHOD_NAME:
+ setMethodName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.EVENT_METHOD__METHOD_NAME:
+ setMethodName(METHOD_NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.EVENT_METHOD__METHOD_NAME:
+ return METHOD_NAME_EDEFAULT == null ? methodName != null : !METHOD_NAME_EDEFAULT.equals(methodName);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (methodName: ");
+ result.append(methodName);
+ result.append(')');
+ return result.toString();
+ }
+
+} // EventMethod
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/FetchType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/FetchType.java
new file mode 100644
index 0000000000..d2d24f432a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/FetchType.java
@@ -0,0 +1,229 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import org.eclipse.emf.common.util.Enumerator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the literals of the enumeration '<em><b>Fetch Type</b></em>',
+ * and utility methods for working with them.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getFetchType()
+ * @model
+ * @generated
+ */
+public enum FetchType implements Enumerator
+{
+ /**
+ * The '<em><b>LAZY</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #LAZY_VALUE
+ * @generated
+ * @ordered
+ */
+ LAZY(0, "LAZY", "LAZY"),
+
+ /**
+ * The '<em><b>EAGER</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #EAGER_VALUE
+ * @generated
+ * @ordered
+ */
+ EAGER(1, "EAGER", "EAGER");
+
+ /**
+ * The '<em><b>LAZY</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>LAZY</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #LAZY
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int LAZY_VALUE = 0;
+
+ /**
+ * The '<em><b>EAGER</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>EAGER</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #EAGER
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int EAGER_VALUE = 1;
+
+ /**
+ * An array of all the '<em><b>Fetch Type</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final FetchType[] VALUES_ARRAY =
+ new FetchType[]
+ {
+ LAZY,
+ EAGER,
+ };
+
+ /**
+ * A public read-only list of all the '<em><b>Fetch Type</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<FetchType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Fetch Type</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static FetchType get(String literal)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ FetchType result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Fetch Type</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static FetchType getByName(String name)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ FetchType result = VALUES_ARRAY[i];
+ if (result.getName().equals(name))
+ {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Fetch Type</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static FetchType get(int value)
+ {
+ switch (value)
+ {
+ case LAZY_VALUE: return LAZY;
+ case EAGER_VALUE: return EAGER;
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final int value;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String name;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String literal;
+
+ /**
+ * Only this class can construct instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private FetchType(int value, String name, String literal)
+ {
+ this.value = value;
+ this.name = name;
+ this.literal = literal;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getValue()
+ {
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLiteral()
+ {
+ return literal;
+ }
+
+ /**
+ * Returns the literal value of the enumerator, which is its string representation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ return literal;
+ }
+
+} //FetchType
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/FieldResult.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/FieldResult.java
new file mode 100644
index 0000000000..afb5d25df2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/FieldResult.java
@@ -0,0 +1,264 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Field Result</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.FieldResult#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.FieldResult#getColumn <em>Column</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getFieldResult()
+ * @model kind="class"
+ * @extends IJpaEObject
+ * @generated
+ */
+public class FieldResult extends JpaEObject implements IJpaEObject
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getColumn() <em>Column</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumn()
+ * @generated
+ * @ordered
+ */
+ protected static final String COLUMN_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getColumn() <em>Column</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumn()
+ * @generated
+ * @ordered
+ */
+ protected String column = COLUMN_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected FieldResult()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.FIELD_RESULT;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getFieldResult_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.FieldResult#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.FIELD_RESULT__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Column</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Column</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Column</em>' attribute.
+ * @see #setColumn(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getFieldResult_Column()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getColumn()
+ {
+ return column;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.FieldResult#getColumn <em>Column</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Column</em>' attribute.
+ * @see #getColumn()
+ * @generated
+ */
+ public void setColumn(String newColumn)
+ {
+ String oldColumn = column;
+ column = newColumn;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.FIELD_RESULT__COLUMN, oldColumn, column));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.FIELD_RESULT__NAME:
+ return getName();
+ case OrmPackage.FIELD_RESULT__COLUMN:
+ return getColumn();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.FIELD_RESULT__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.FIELD_RESULT__COLUMN:
+ setColumn((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.FIELD_RESULT__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.FIELD_RESULT__COLUMN:
+ setColumn(COLUMN_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.FIELD_RESULT__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.FIELD_RESULT__COLUMN:
+ return COLUMN_EDEFAULT == null ? column != null : !COLUMN_EDEFAULT.equals(column);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", column: ");
+ result.append(column);
+ result.append(')');
+ return result.toString();
+ }
+
+} // FieldResult
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/GeneratedValue.java
index 48627ea1d9..eb9d051d52 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IGeneratedValue.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/GeneratedValue.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -7,87 +7,84 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.mappings;
+package org.eclipse.jpt.core.internal.resource.orm;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.ITextRange;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
/**
* <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IGenerated Value</b></em>'.
+ * A representation of the model object '<em><b>Generated Value</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IGeneratedValue#getStrategy <em>Strategy</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IGeneratedValue#getGenerator <em>Generator</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.GeneratedValue#getGenerator <em>Generator</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.GeneratedValue#getStrategy <em>Strategy</em>}</li>
* </ul>
* </p>
*
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIGeneratedValue()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGeneratedValue()
* @model kind="class" interface="true" abstract="true"
+ * @extends IJpaEObject
* @generated
*/
-public interface IGeneratedValue extends IJpaSourceObject
+public interface GeneratedValue extends IJpaEObject
{
/**
- * Returns the value of the '<em><b>Strategy</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.GenerationType}.
+ * Returns the value of the '<em><b>Generator</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Strategy</em>' attribute isn't clear,
+ * If the meaning of the '<em>Generator</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- * @return the value of the '<em>Strategy</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.GenerationType
- * @see #setStrategy(GenerationType)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIGeneratedValue_Strategy()
- * @model
+ * @return the value of the '<em>Generator</em>' attribute.
+ * @see #setGenerator(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGeneratedValue_Generator()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
* @generated
*/
- GenerationType getStrategy();
+ String getGenerator();
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IGeneratedValue#getStrategy <em>Strategy</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.GeneratedValue#getGenerator <em>Generator</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @param value the new value of the '<em>Strategy</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.GenerationType
- * @see #getStrategy()
+ * @param value the new value of the '<em>Generator</em>' attribute.
+ * @see #getGenerator()
* @generated
*/
- void setStrategy(GenerationType value);
+ void setGenerator(String value);
/**
- * Returns the value of the '<em><b>Generator</b></em>' attribute.
+ * Returns the value of the '<em><b>Strategy</b></em>' attribute.
+ * The default value is <code>"TABLE"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.GenerationType}.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Generator</em>' attribute isn't clear,
+ * If the meaning of the '<em>Strategy</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- * @return the value of the '<em>Generator</em>' attribute.
- * @see #setGenerator(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIGeneratedValue_Generator()
- * @model
+ * @return the value of the '<em>Strategy</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.GenerationType
+ * @see #setStrategy(GenerationType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGeneratedValue_Strategy()
+ * @model default="TABLE"
* @generated
*/
- String getGenerator();
+ GenerationType getStrategy();
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IGeneratedValue#getGenerator <em>Generator</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.GeneratedValue#getStrategy <em>Strategy</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @param value the new value of the '<em>Generator</em>' attribute.
- * @see #getGenerator()
+ * @param value the new value of the '<em>Strategy</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.GenerationType
+ * @see #getStrategy()
* @generated
*/
- void setGenerator(String value);
+ void setStrategy(GenerationType value);
- /**
- * Return the (best guess) text location of the generator.
- */
- ITextRange generatorTextRange();
-} // IGeneratedValue
+} // GeneratedValue
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/GeneratedValueImpl.java
index f0aa80d772..9ee9153545 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlGeneratedValue.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/GeneratedValueImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -7,78 +7,68 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.resource.orm;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.orm.resource.OrmXmlMapper;
-import org.eclipse.jpt.core.internal.emfutility.DOMUtilities;
-import org.eclipse.jpt.core.internal.mappings.GenerationType;
-import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
/**
* <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Generated Value</b></em>'.
+ * A representation of the model object '<em><b>Generated Value</b></em>'.
* <!-- end-user-doc -->
*
*
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlGeneratedValue()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGeneratedValueImpl()
* @model kind="class"
* @generated
*/
-public class XmlGeneratedValue extends XmlEObject implements IGeneratedValue
+public class GeneratedValueImpl extends JpaEObject implements GeneratedValue
{
/**
- * The default value of the '{@link #getStrategy() <em>Strategy</em>}' attribute.
+ * The default value of the '{@link #getGenerator() <em>Generator</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see #getStrategy()
+ * @see #getGenerator()
* @generated
* @ordered
*/
- protected static final GenerationType STRATEGY_EDEFAULT = GenerationType.DEFAULT;
+ protected static final String GENERATOR_EDEFAULT = null;
/**
- * The cached value of the '{@link #getStrategy() <em>Strategy</em>}' attribute.
+ * The cached value of the '{@link #getGenerator() <em>Generator</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see #getStrategy()
+ * @see #getGenerator()
* @generated
* @ordered
*/
- protected GenerationType strategy = STRATEGY_EDEFAULT;
+ protected String generator = GENERATOR_EDEFAULT;
/**
- * The default value of the '{@link #getGenerator() <em>Generator</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getGenerator()
- * @generated
- * @ordered
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
*/
- protected static final String GENERATOR_EDEFAULT = null;
+ protected static final GenerationType STRATEGY_EDEFAULT = null;
/**
- * The cached value of the '{@link #getGenerator() <em>Generator</em>}' attribute.
+ * The cached value of the '{@link #getStrategy() <em>Strategy</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see #getGenerator()
+ * @see #getStrategy()
* @generated
* @ordered
*/
- protected String generator = GENERATOR_EDEFAULT;
+ protected GenerationType strategy = STRATEGY_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- protected XmlGeneratedValue() {
+ protected GeneratedValueImpl()
+ {
super();
}
@@ -88,77 +78,83 @@ public class XmlGeneratedValue extends XmlEObject implements IGeneratedValue
* @generated
*/
@Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_GENERATED_VALUE;
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.GENERATED_VALUE_IMPL;
}
/**
- * Returns the value of the '<em><b>Strategy</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.GenerationType}.
+ * Returns the value of the '<em><b>Generator</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Strategy</em>' attribute isn't clear,
+ * If the meaning of the '<em>Generator</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- * @return the value of the '<em>Strategy</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.GenerationType
- * @see #setStrategy(GenerationType)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIGeneratedValue_Strategy()
- * @model
+ * @return the value of the '<em>Generator</em>' attribute.
+ * @see #setGenerator(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGeneratedValue_Generator()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
* @generated
*/
- public GenerationType getStrategy() {
- return strategy;
+ public String getGenerator()
+ {
+ return generator;
}
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlGeneratedValue#getStrategy <em>Strategy</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.GeneratedValueImpl#getGenerator <em>Generator</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @param value the new value of the '<em>Strategy</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.GenerationType
- * @see #getStrategy()
+ * @param value the new value of the '<em>Generator</em>' attribute.
+ * @see #getGenerator()
* @generated
*/
- public void setStrategy(GenerationType newStrategy) {
- GenerationType oldStrategy = strategy;
- strategy = newStrategy == null ? STRATEGY_EDEFAULT : newStrategy;
+ public void setGenerator(String newGenerator)
+ {
+ String oldGenerator = generator;
+ generator = newGenerator;
if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_GENERATED_VALUE__STRATEGY, oldStrategy, strategy));
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.GENERATED_VALUE_IMPL__GENERATOR, oldGenerator, generator));
}
/**
- * Returns the value of the '<em><b>Generator</b></em>' attribute.
+ * Returns the value of the '<em><b>Strategy</b></em>' attribute.
+ * The default value is <code>"TABLE"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.GenerationType}.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Generator</em>' attribute isn't clear,
+ * If the meaning of the '<em>Strategy</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- * @return the value of the '<em>Generator</em>' attribute.
- * @see #setGenerator(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIGeneratedValue_Generator()
- * @model
+ * @return the value of the '<em>Strategy</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.GenerationType
+ * @see #setStrategy(GenerationType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGeneratedValue_Strategy()
+ * @model default="TABLE"
* @generated
*/
- public String getGenerator() {
- return generator;
+ public GenerationType getStrategy()
+ {
+ return strategy;
}
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlGeneratedValue#getGenerator <em>Generator</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.GeneratedValueImpl#getStrategy <em>Strategy</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @param value the new value of the '<em>Generator</em>' attribute.
- * @see #getGenerator()
+ * @param value the new value of the '<em>Strategy</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.GenerationType
+ * @see #getStrategy()
* @generated
*/
- public void setGenerator(String newGenerator) {
- String oldGenerator = generator;
- generator = newGenerator;
+ public void setStrategy(GenerationType newStrategy)
+ {
+ GenerationType oldStrategy = strategy;
+ strategy = newStrategy == null ? STRATEGY_EDEFAULT : newStrategy;
if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_GENERATED_VALUE__GENERATOR, oldGenerator, generator));
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.GENERATED_VALUE_IMPL__STRATEGY, oldStrategy, strategy));
}
/**
@@ -167,12 +163,14 @@ public class XmlGeneratedValue extends XmlEObject implements IGeneratedValue
* @generated
*/
@Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_GENERATED_VALUE__STRATEGY :
- return getStrategy();
- case OrmPackage.XML_GENERATED_VALUE__GENERATOR :
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.GENERATED_VALUE_IMPL__GENERATOR:
return getGenerator();
+ case OrmPackage.GENERATED_VALUE_IMPL__STRATEGY:
+ return getStrategy();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -183,13 +181,15 @@ public class XmlGeneratedValue extends XmlEObject implements IGeneratedValue
* @generated
*/
@Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_GENERATED_VALUE__STRATEGY :
- setStrategy((GenerationType) newValue);
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.GENERATED_VALUE_IMPL__GENERATOR:
+ setGenerator((String)newValue);
return;
- case OrmPackage.XML_GENERATED_VALUE__GENERATOR :
- setGenerator((String) newValue);
+ case OrmPackage.GENERATED_VALUE_IMPL__STRATEGY:
+ setStrategy((GenerationType)newValue);
return;
}
super.eSet(featureID, newValue);
@@ -201,14 +201,16 @@ public class XmlGeneratedValue extends XmlEObject implements IGeneratedValue
* @generated
*/
@Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_GENERATED_VALUE__STRATEGY :
- setStrategy(STRATEGY_EDEFAULT);
- return;
- case OrmPackage.XML_GENERATED_VALUE__GENERATOR :
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.GENERATED_VALUE_IMPL__GENERATOR:
setGenerator(GENERATOR_EDEFAULT);
return;
+ case OrmPackage.GENERATED_VALUE_IMPL__STRATEGY:
+ setStrategy(STRATEGY_EDEFAULT);
+ return;
}
super.eUnset(featureID);
}
@@ -219,12 +221,14 @@ public class XmlGeneratedValue extends XmlEObject implements IGeneratedValue
* @generated
*/
@Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_GENERATED_VALUE__STRATEGY :
- return strategy != STRATEGY_EDEFAULT;
- case OrmPackage.XML_GENERATED_VALUE__GENERATOR :
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.GENERATED_VALUE_IMPL__GENERATOR:
return GENERATOR_EDEFAULT == null ? generator != null : !GENERATOR_EDEFAULT.equals(generator);
+ case OrmPackage.GENERATED_VALUE_IMPL__STRATEGY:
+ return strategy != STRATEGY_EDEFAULT;
}
return super.eIsSet(featureID);
}
@@ -235,63 +239,17 @@ public class XmlGeneratedValue extends XmlEObject implements IGeneratedValue
* @generated
*/
@Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IGeneratedValue.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_GENERATED_VALUE__STRATEGY :
- return JpaCoreMappingsPackage.IGENERATED_VALUE__STRATEGY;
- case OrmPackage.XML_GENERATED_VALUE__GENERATOR :
- return JpaCoreMappingsPackage.IGENERATED_VALUE__GENERATOR;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IGeneratedValue.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IGENERATED_VALUE__STRATEGY :
- return OrmPackage.XML_GENERATED_VALUE__STRATEGY;
- case JpaCoreMappingsPackage.IGENERATED_VALUE__GENERATOR :
- return OrmPackage.XML_GENERATED_VALUE__GENERATOR;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
StringBuffer result = new StringBuffer(super.toString());
- result.append(" (strategy: ");
- result.append(strategy);
- result.append(", generator: ");
+ result.append(" (generator: ");
result.append(generator);
+ result.append(", strategy: ");
+ result.append(strategy);
result.append(')');
return result.toString();
}
- public ITextRange generatorTextRange() {
- if (node == null) {
- return ((XmlEObject) eContainer()).validationTextRange();
- }
- IDOMNode nameNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.GENERATED_VALUE__GENERATOR);
- return (nameNode == null) ? validationTextRange() : buildTextRange(nameNode);
- }
-} // XmlGeneratedValue
+} // GeneratedValue
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/GenerationType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/GenerationType.java
index 9348b70d55..897d11b5e1 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/GenerationType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/GenerationType.java
@@ -7,42 +7,44 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.mappings;
+package org.eclipse.jpt.core.internal.resource.orm;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.eclipse.emf.common.util.Enumerator;
-import org.eclipse.jpt.core.internal.content.java.mappings.JPA;
/**
* <!-- begin-user-doc -->
* A representation of the literals of the enumeration '<em><b>Generation Type</b></em>',
* and utility methods for working with them.
* <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getGenerationType()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGenerationType()
* @model
* @generated
*/
-public enum GenerationType implements Enumerator {
+public enum GenerationType implements Enumerator
+{
/**
- * The '<em><b>Default</b></em>' literal object.
+ * The '<em><b>TABLE</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see #DEFAULT_VALUE
+ * @see #TABLE_VALUE
* @generated
* @ordered
*/
- DEFAULT(0, "Default", "Default (Auto)"),
+ TABLE(0, "TABLE", "TABLE"),
+
/**
- * The '<em><b>AUTO</b></em>' literal object.
+ * The '<em><b>SEQUENCE</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see #AUTO_VALUE
+ * @see #SEQUENCE_VALUE
* @generated
* @ordered
*/
- AUTO(1, "AUTO", "Auto"),
+ SEQUENCE(1, "SEQUENCE", "SEQUENCE"),
+
/**
* The '<em><b>IDENTITY</b></em>' literal object.
* <!-- begin-user-doc -->
@@ -51,99 +53,77 @@ public enum GenerationType implements Enumerator {
* @generated
* @ordered
*/
- IDENTITY(2, "IDENTITY", "Identity"),
- /**
- * The '<em><b>SEQUENCE</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #SEQUENCE_VALUE
- * @generated
- * @ordered
- */
- SEQUENCE(3, "SEQUENCE", "Sequence"),
+ IDENTITY(2, "IDENTITY", "IDENTITY"),
+
/**
- * The '<em><b>TABLE</b></em>' literal object.
+ * The '<em><b>AUTO</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see #TABLE_VALUE
+ * @see #AUTO_VALUE
* @generated
* @ordered
*/
- TABLE(4, "TABLE", "Table");
+ AUTO(3, "AUTO", "AUTO");
+
/**
- * The '<em><b>Default</b></em>' literal value.
+ * The '<em><b>TABLE</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of '<em><b>Default</b></em>' literal object isn't clear,
+ * If the meaning of '<em><b>TABLE</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- * @see #DEFAULT
- * @model name="Default" literal="Default (Auto)"
+ * @see #TABLE
+ * @model
* @generated
* @ordered
*/
- public static final int DEFAULT_VALUE = 0;
+ public static final int TABLE_VALUE = 0;
/**
- * The '<em><b>AUTO</b></em>' literal value.
+ * The '<em><b>SEQUENCE</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of '<em><b>Auto</b></em>' literal object isn't clear,
+ * If the meaning of '<em><b>SEQUENCE</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- * @see #AUTO
- * @model literal="Auto"
+ * @see #SEQUENCE
+ * @model
* @generated
* @ordered
*/
- public static final int AUTO_VALUE = 1;
+ public static final int SEQUENCE_VALUE = 1;
/**
* The '<em><b>IDENTITY</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of '<em><b>Identity</b></em>' literal object isn't clear,
+ * If the meaning of '<em><b>IDENTITY</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #IDENTITY
- * @model literal="Identity"
+ * @model
* @generated
* @ordered
*/
public static final int IDENTITY_VALUE = 2;
/**
- * The '<em><b>SEQUENCE</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>Sequence</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #SEQUENCE
- * @model literal="Sequence"
- * @generated
- * @ordered
- */
- public static final int SEQUENCE_VALUE = 3;
-
- /**
- * The '<em><b>TABLE</b></em>' literal value.
+ * The '<em><b>AUTO</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of '<em><b>Table</b></em>' literal object isn't clear,
+ * If the meaning of '<em><b>AUTO</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- * @see #TABLE
- * @model literal="Table"
+ * @see #AUTO
+ * @model
* @generated
* @ordered
*/
- public static final int TABLE_VALUE = 4;
+ public static final int AUTO_VALUE = 3;
/**
* An array of all the '<em><b>Generation Type</b></em>' enumerators.
@@ -151,9 +131,14 @@ public enum GenerationType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- private static final GenerationType[] VALUES_ARRAY = new GenerationType[] {
- DEFAULT, AUTO, IDENTITY, SEQUENCE, TABLE,
- };
+ private static final GenerationType[] VALUES_ARRAY =
+ new GenerationType[]
+ {
+ TABLE,
+ SEQUENCE,
+ IDENTITY,
+ AUTO,
+ };
/**
* A public read-only list of all the '<em><b>Generation Type</b></em>' enumerators.
@@ -169,10 +154,13 @@ public enum GenerationType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static GenerationType get(String literal) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ public static GenerationType get(String literal)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
GenerationType result = VALUES_ARRAY[i];
- if (result.toString().equals(literal)) {
+ if (result.toString().equals(literal))
+ {
return result;
}
}
@@ -185,10 +173,13 @@ public enum GenerationType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static GenerationType getByName(String name) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ public static GenerationType getByName(String name)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
GenerationType result = VALUES_ARRAY[i];
- if (result.getName().equals(name)) {
+ if (result.getName().equals(name))
+ {
return result;
}
}
@@ -201,18 +192,14 @@ public enum GenerationType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static GenerationType get(int value) {
- switch (value) {
- case DEFAULT_VALUE :
- return DEFAULT;
- case AUTO_VALUE :
- return AUTO;
- case IDENTITY_VALUE :
- return IDENTITY;
- case SEQUENCE_VALUE :
- return SEQUENCE;
- case TABLE_VALUE :
- return TABLE;
+ public static GenerationType get(int value)
+ {
+ switch (value)
+ {
+ case TABLE_VALUE: return TABLE;
+ case SEQUENCE_VALUE: return SEQUENCE;
+ case IDENTITY_VALUE: return IDENTITY;
+ case AUTO_VALUE: return AUTO;
}
return null;
}
@@ -244,7 +231,8 @@ public enum GenerationType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- private GenerationType(int value, String name, String literal) {
+ private GenerationType(int value, String name, String literal)
+ {
this.value = value;
this.name = name;
this.literal = literal;
@@ -255,8 +243,9 @@ public enum GenerationType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public int getValue() {
- return value;
+ public int getValue()
+ {
+ return value;
}
/**
@@ -264,8 +253,9 @@ public enum GenerationType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public String getName() {
- return name;
+ public String getName()
+ {
+ return name;
}
/**
@@ -273,8 +263,9 @@ public enum GenerationType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public String getLiteral() {
- return literal;
+ public String getLiteral()
+ {
+ return literal;
}
/**
@@ -284,43 +275,9 @@ public enum GenerationType implements Enumerator {
* @generated
*/
@Override
- public String toString() {
+ public String toString()
+ {
return literal;
}
-
- public static GenerationType fromJavaAnnotationValue(Object javaAnnotationValue) {
- if (javaAnnotationValue == null) {
- return DEFAULT;
- }
- if (javaAnnotationValue.equals(JPA.GENERATION_TYPE__AUTO)) {
- return AUTO;
- }
- if (javaAnnotationValue.equals(JPA.GENERATION_TYPE__IDENTITY)) {
- return IDENTITY;
- }
- if (javaAnnotationValue.equals(JPA.GENERATION_TYPE__SEQUENCE)) {
- return SEQUENCE;
- }
- if (javaAnnotationValue.equals(JPA.GENERATION_TYPE__TABLE)) {
- return TABLE;
- }
- return DEFAULT;
- }
-
- public String convertToJavaAnnotationValue() {
- switch (this.getValue()) {
- case DEFAULT_VALUE :
- return null;
- case AUTO_VALUE :
- return JPA.GENERATION_TYPE__AUTO;
- case IDENTITY_VALUE :
- return JPA.GENERATION_TYPE__IDENTITY;
- case SEQUENCE_VALUE :
- return JPA.GENERATION_TYPE__SEQUENCE;
- case TABLE_VALUE :
- return JPA.GENERATION_TYPE__TABLE;
- default :
- throw new IllegalArgumentException("unknown generation type: " + this);
- }
- }
+
} //GenerationType
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Generator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Generator.java
new file mode 100644
index 0000000000..b52445fb45
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Generator.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Generator</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Generator#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Generator#getInitialValue <em>Initial Value</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Generator#getAllocationSize <em>Allocation Size</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGenerator()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends IJpaEObject
+ * @generated
+ */
+public interface Generator extends IJpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGenerator_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Generator#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Initial Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Initial Value</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Initial Value</em>' attribute.
+ * @see #setInitialValue(Integer)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGenerator_InitialValue()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.IntObject"
+ * @generated
+ */
+ Integer getInitialValue();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Generator#getInitialValue <em>Initial Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Initial Value</em>' attribute.
+ * @see #getInitialValue()
+ * @generated
+ */
+ void setInitialValue(Integer value);
+
+ /**
+ * Returns the value of the '<em><b>Allocation Size</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Allocation Size</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Allocation Size</em>' attribute.
+ * @see #setAllocationSize(Integer)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGenerator_AllocationSize()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.IntObject"
+ * @generated
+ */
+ Integer getAllocationSize();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Generator#getAllocationSize <em>Allocation Size</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Allocation Size</em>' attribute.
+ * @see #getAllocationSize()
+ * @generated
+ */
+ void setAllocationSize(Integer value);
+
+} // Generator
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Id.java
index cae3c2baa8..1defecb7bf 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IId.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Id.java
@@ -1,15 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 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.
+ * Copyright (c) 2007, 2008 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.mappings;
+package org.eclipse.jpt.core.internal.resource.orm;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
/**
* <!-- begin-user-doc -->
@@ -19,64 +18,48 @@ import org.eclipse.jpt.core.internal.IAttributeMapping;
* <p>
* The following features are supported:
* <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IId#getColumn <em>Column</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IId#getGeneratedValue <em>Generated Value</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IId#getTemporal <em>Temporal</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IId#getTableGenerator <em>Table Generator</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IId#getSequenceGenerator <em>Sequence Generator</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Id#getGeneratedValue <em>Generated Value</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Id#getTemporal <em>Temporal</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Id#getTableGenerator <em>Table Generator</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Id#getSequenceGenerator <em>Sequence Generator</em>}</li>
* </ul>
* </p>
*
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIId()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getId()
* @model kind="class" interface="true" abstract="true"
* @generated
*/
-public interface IId extends IAttributeMapping, IColumnMapping
+public interface Id extends AttributeMapping, ColumnMapping
{
/**
- * Returns the value of the '<em><b>Column</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Column</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Column</em>' containment reference.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIId_Column()
- * @model containment="true" required="true" changeable="false"
- * @generated
- */
- IColumn getColumn();
-
- /**
* Returns the value of the '<em><b>Generated Value</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Generated Value</em>' reference isn't clear,
+ * If the meaning of the '<em>Generated Value</em>' containment reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Generated Value</em>' containment reference.
- * @see #setGeneratedValue(IGeneratedValue)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIId_GeneratedValue()
+ * @see #setGeneratedValue(GeneratedValue)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getId_GeneratedValue()
* @model containment="true"
* @generated
*/
- IGeneratedValue getGeneratedValue();
+ GeneratedValue getGeneratedValue();
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IId#getGeneratedValue <em>Generated Value</em>}' containment reference.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Id#getGeneratedValue <em>Generated Value</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Generated Value</em>' containment reference.
* @see #getGeneratedValue()
* @generated
*/
- void setGeneratedValue(IGeneratedValue value);
+ void setGeneratedValue(GeneratedValue value);
/**
* Returns the value of the '<em><b>Temporal</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.mappings.TemporalType}.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.TemporalType}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Temporal</em>' attribute isn't clear,
@@ -84,20 +67,20 @@ public interface IId extends IAttributeMapping, IColumnMapping
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
+ * @see org.eclipse.jpt.core.internal.resource.orm.TemporalType
* @see #setTemporal(TemporalType)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIId_Temporal()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getId_Temporal()
* @model
* @generated
*/
TemporalType getTemporal();
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IId#getTemporal <em>Temporal</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Id#getTemporal <em>Temporal</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Temporal</em>' attribute.
- * @see org.eclipse.jpt.core.internal.mappings.TemporalType
+ * @see org.eclipse.jpt.core.internal.resource.orm.TemporalType
* @see #getTemporal()
* @generated
*/
@@ -107,57 +90,52 @@ public interface IId extends IAttributeMapping, IColumnMapping
* Returns the value of the '<em><b>Table Generator</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Table Generator</em>' reference isn't clear,
+ * If the meaning of the '<em>Table Generator</em>' containment reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Table Generator</em>' containment reference.
- * @see #setTableGenerator(ITableGenerator)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIId_TableGenerator()
+ * @see #setTableGenerator(TableGenerator)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getId_TableGenerator()
* @model containment="true"
* @generated
*/
- ITableGenerator getTableGenerator();
+ TableGenerator getTableGenerator();
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IId#getTableGenerator <em>Table Generator</em>}' containment reference.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Id#getTableGenerator <em>Table Generator</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Table Generator</em>' containment reference.
* @see #getTableGenerator()
* @generated
*/
- void setTableGenerator(ITableGenerator value);
+ void setTableGenerator(TableGenerator value);
/**
* Returns the value of the '<em><b>Sequence Generator</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Sequence Generator</em>' reference isn't clear,
+ * If the meaning of the '<em>Sequence Generator</em>' containment reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Sequence Generator</em>' containment reference.
- * @see #setSequenceGenerator(ISequenceGenerator)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIId_SequenceGenerator()
+ * @see #setSequenceGenerator(SequenceGenerator)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getId_SequenceGenerator()
* @model containment="true"
* @generated
*/
- ISequenceGenerator getSequenceGenerator();
+ SequenceGenerator getSequenceGenerator();
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IId#getSequenceGenerator <em>Sequence Generator</em>}' containment reference.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Id#getSequenceGenerator <em>Sequence Generator</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Sequence Generator</em>' containment reference.
* @see #getSequenceGenerator()
* @generated
*/
- void setSequenceGenerator(ISequenceGenerator value);
-
- IGeneratedValue createGeneratedValue();
-
- ITableGenerator createTableGenerator();
+ void setSequenceGenerator(SequenceGenerator value);
- ISequenceGenerator createSequenceGenerator();
} // Id
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/IdClass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/IdClass.java
new file mode 100644
index 0000000000..740e692371
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/IdClass.java
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Id Class</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.IdClass#getClassName <em>Class Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getIdClass()
+ * @model kind="class"
+ * @extends IJpaEObject
+ * @generated
+ */
+public class IdClass extends JpaEObject implements IJpaEObject
+{
+ /**
+ * The default value of the '{@link #getClassName() <em>Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getClassName()
+ * @generated
+ * @ordered
+ */
+ protected static final String CLASS_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getClassName() <em>Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getClassName()
+ * @generated
+ * @ordered
+ */
+ protected String className = CLASS_NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IdClass()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ID_CLASS;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Class Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Class Name</em>' attribute.
+ * @see #setClassName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getIdClass_ClassName()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getClassName()
+ {
+ return className;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.IdClass#getClassName <em>Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Class Name</em>' attribute.
+ * @see #getClassName()
+ * @generated
+ */
+ public void setClassName(String newClassName)
+ {
+ String oldClassName = className;
+ className = newClassName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ID_CLASS__CLASS_NAME, oldClassName, className));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ID_CLASS__CLASS_NAME:
+ return getClassName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ID_CLASS__CLASS_NAME:
+ setClassName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ID_CLASS__CLASS_NAME:
+ setClassName(CLASS_NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ID_CLASS__CLASS_NAME:
+ return CLASS_NAME_EDEFAULT == null ? className != null : !CLASS_NAME_EDEFAULT.equals(className);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (className: ");
+ result.append(className);
+ result.append(')');
+ return result.toString();
+ }
+
+} // IdClass
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/IdImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/IdImpl.java
new file mode 100644
index 0000000000..cf90587bb6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/IdImpl.java
@@ -0,0 +1,636 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Id</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getIdImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class IdImpl extends JpaEObject implements Id
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumn()
+ * @generated
+ * @ordered
+ */
+ protected Column column;
+
+ /**
+ * The cached value of the '{@link #getGeneratedValue() <em>Generated Value</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getGeneratedValue()
+ * @generated
+ * @ordered
+ */
+ protected GeneratedValue generatedValue;
+
+ /**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final TemporalType TEMPORAL_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTemporal()
+ * @generated
+ * @ordered
+ */
+ protected TemporalType temporal = TEMPORAL_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getTableGenerator() <em>Table Generator</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTableGenerator()
+ * @generated
+ * @ordered
+ */
+ protected TableGenerator tableGenerator;
+
+ /**
+ * The cached value of the '{@link #getSequenceGenerator() <em>Sequence Generator</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSequenceGenerator()
+ * @generated
+ * @ordered
+ */
+ protected SequenceGenerator sequenceGenerator;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IdImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ID_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeMapping_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.IdImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ID_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Column</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Column</em>' containment reference.
+ * @see #setColumn(Column)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumnMapping_Column()
+ * @model containment="true"
+ * @generated
+ */
+ public Column getColumn()
+ {
+ return column;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetColumn(Column newColumn, NotificationChain msgs)
+ {
+ Column oldColumn = column;
+ column = newColumn;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ID_IMPL__COLUMN, oldColumn, newColumn);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.IdImpl#getColumn <em>Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Column</em>' containment reference.
+ * @see #getColumn()
+ * @generated
+ */
+ public void setColumn(Column newColumn)
+ {
+ if (newColumn != column)
+ {
+ NotificationChain msgs = null;
+ if (column != null)
+ msgs = ((InternalEObject)column).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ID_IMPL__COLUMN, null, msgs);
+ if (newColumn != null)
+ msgs = ((InternalEObject)newColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ID_IMPL__COLUMN, null, msgs);
+ msgs = basicSetColumn(newColumn, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ID_IMPL__COLUMN, newColumn, newColumn));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Generated Value</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Generated Value</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Generated Value</em>' containment reference.
+ * @see #setGeneratedValue(GeneratedValue)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getId_GeneratedValue()
+ * @model containment="true"
+ * @generated
+ */
+ public GeneratedValue getGeneratedValue()
+ {
+ return generatedValue;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetGeneratedValue(GeneratedValue newGeneratedValue, NotificationChain msgs)
+ {
+ GeneratedValue oldGeneratedValue = generatedValue;
+ generatedValue = newGeneratedValue;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ID_IMPL__GENERATED_VALUE, oldGeneratedValue, newGeneratedValue);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.IdImpl#getGeneratedValue <em>Generated Value</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Generated Value</em>' containment reference.
+ * @see #getGeneratedValue()
+ * @generated
+ */
+ public void setGeneratedValue(GeneratedValue newGeneratedValue)
+ {
+ if (newGeneratedValue != generatedValue)
+ {
+ NotificationChain msgs = null;
+ if (generatedValue != null)
+ msgs = ((InternalEObject)generatedValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ID_IMPL__GENERATED_VALUE, null, msgs);
+ if (newGeneratedValue != null)
+ msgs = ((InternalEObject)newGeneratedValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ID_IMPL__GENERATED_VALUE, null, msgs);
+ msgs = basicSetGeneratedValue(newGeneratedValue, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ID_IMPL__GENERATED_VALUE, newGeneratedValue, newGeneratedValue));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Temporal</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.TemporalType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Temporal</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Temporal</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TemporalType
+ * @see #setTemporal(TemporalType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getId_Temporal()
+ * @model
+ * @generated
+ */
+ public TemporalType getTemporal()
+ {
+ return temporal;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.IdImpl#getTemporal <em>Temporal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Temporal</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TemporalType
+ * @see #getTemporal()
+ * @generated
+ */
+ public void setTemporal(TemporalType newTemporal)
+ {
+ TemporalType oldTemporal = temporal;
+ temporal = newTemporal == null ? TEMPORAL_EDEFAULT : newTemporal;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ID_IMPL__TEMPORAL, oldTemporal, temporal));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Table Generator</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Table Generator</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Table Generator</em>' containment reference.
+ * @see #setTableGenerator(TableGenerator)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getId_TableGenerator()
+ * @model containment="true"
+ * @generated
+ */
+ public TableGenerator getTableGenerator()
+ {
+ return tableGenerator;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetTableGenerator(TableGenerator newTableGenerator, NotificationChain msgs)
+ {
+ TableGenerator oldTableGenerator = tableGenerator;
+ tableGenerator = newTableGenerator;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ID_IMPL__TABLE_GENERATOR, oldTableGenerator, newTableGenerator);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.IdImpl#getTableGenerator <em>Table Generator</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Table Generator</em>' containment reference.
+ * @see #getTableGenerator()
+ * @generated
+ */
+ public void setTableGenerator(TableGenerator newTableGenerator)
+ {
+ if (newTableGenerator != tableGenerator)
+ {
+ NotificationChain msgs = null;
+ if (tableGenerator != null)
+ msgs = ((InternalEObject)tableGenerator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ID_IMPL__TABLE_GENERATOR, null, msgs);
+ if (newTableGenerator != null)
+ msgs = ((InternalEObject)newTableGenerator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ID_IMPL__TABLE_GENERATOR, null, msgs);
+ msgs = basicSetTableGenerator(newTableGenerator, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ID_IMPL__TABLE_GENERATOR, newTableGenerator, newTableGenerator));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Sequence Generator</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Sequence Generator</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Sequence Generator</em>' containment reference.
+ * @see #setSequenceGenerator(SequenceGenerator)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getId_SequenceGenerator()
+ * @model containment="true"
+ * @generated
+ */
+ public SequenceGenerator getSequenceGenerator()
+ {
+ return sequenceGenerator;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetSequenceGenerator(SequenceGenerator newSequenceGenerator, NotificationChain msgs)
+ {
+ SequenceGenerator oldSequenceGenerator = sequenceGenerator;
+ sequenceGenerator = newSequenceGenerator;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ID_IMPL__SEQUENCE_GENERATOR, oldSequenceGenerator, newSequenceGenerator);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.IdImpl#getSequenceGenerator <em>Sequence Generator</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Sequence Generator</em>' containment reference.
+ * @see #getSequenceGenerator()
+ * @generated
+ */
+ public void setSequenceGenerator(SequenceGenerator newSequenceGenerator)
+ {
+ if (newSequenceGenerator != sequenceGenerator)
+ {
+ NotificationChain msgs = null;
+ if (sequenceGenerator != null)
+ msgs = ((InternalEObject)sequenceGenerator).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ID_IMPL__SEQUENCE_GENERATOR, null, msgs);
+ if (newSequenceGenerator != null)
+ msgs = ((InternalEObject)newSequenceGenerator).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ID_IMPL__SEQUENCE_GENERATOR, null, msgs);
+ msgs = basicSetSequenceGenerator(newSequenceGenerator, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ID_IMPL__SEQUENCE_GENERATOR, newSequenceGenerator, newSequenceGenerator));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ID_IMPL__COLUMN:
+ return basicSetColumn(null, msgs);
+ case OrmPackage.ID_IMPL__GENERATED_VALUE:
+ return basicSetGeneratedValue(null, msgs);
+ case OrmPackage.ID_IMPL__TABLE_GENERATOR:
+ return basicSetTableGenerator(null, msgs);
+ case OrmPackage.ID_IMPL__SEQUENCE_GENERATOR:
+ return basicSetSequenceGenerator(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ID_IMPL__NAME:
+ return getName();
+ case OrmPackage.ID_IMPL__COLUMN:
+ return getColumn();
+ case OrmPackage.ID_IMPL__GENERATED_VALUE:
+ return getGeneratedValue();
+ case OrmPackage.ID_IMPL__TEMPORAL:
+ return getTemporal();
+ case OrmPackage.ID_IMPL__TABLE_GENERATOR:
+ return getTableGenerator();
+ case OrmPackage.ID_IMPL__SEQUENCE_GENERATOR:
+ return getSequenceGenerator();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ID_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.ID_IMPL__COLUMN:
+ setColumn((Column)newValue);
+ return;
+ case OrmPackage.ID_IMPL__GENERATED_VALUE:
+ setGeneratedValue((GeneratedValue)newValue);
+ return;
+ case OrmPackage.ID_IMPL__TEMPORAL:
+ setTemporal((TemporalType)newValue);
+ return;
+ case OrmPackage.ID_IMPL__TABLE_GENERATOR:
+ setTableGenerator((TableGenerator)newValue);
+ return;
+ case OrmPackage.ID_IMPL__SEQUENCE_GENERATOR:
+ setSequenceGenerator((SequenceGenerator)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ID_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.ID_IMPL__COLUMN:
+ setColumn((Column)null);
+ return;
+ case OrmPackage.ID_IMPL__GENERATED_VALUE:
+ setGeneratedValue((GeneratedValue)null);
+ return;
+ case OrmPackage.ID_IMPL__TEMPORAL:
+ setTemporal(TEMPORAL_EDEFAULT);
+ return;
+ case OrmPackage.ID_IMPL__TABLE_GENERATOR:
+ setTableGenerator((TableGenerator)null);
+ return;
+ case OrmPackage.ID_IMPL__SEQUENCE_GENERATOR:
+ setSequenceGenerator((SequenceGenerator)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ID_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.ID_IMPL__COLUMN:
+ return column != null;
+ case OrmPackage.ID_IMPL__GENERATED_VALUE:
+ return generatedValue != null;
+ case OrmPackage.ID_IMPL__TEMPORAL:
+ return temporal != TEMPORAL_EDEFAULT;
+ case OrmPackage.ID_IMPL__TABLE_GENERATOR:
+ return tableGenerator != null;
+ case OrmPackage.ID_IMPL__SEQUENCE_GENERATOR:
+ return sequenceGenerator != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == ColumnMapping.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.ID_IMPL__COLUMN: return OrmPackage.COLUMN_MAPPING__COLUMN;
+ default: return -1;
+ }
+ }
+ return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == ColumnMapping.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.COLUMN_MAPPING__COLUMN: return OrmPackage.ID_IMPL__COLUMN;
+ default: return -1;
+ }
+ }
+ return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", temporal: ");
+ result.append(temporal);
+ result.append(')');
+ return result.toString();
+ }
+
+} // Id
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Inheritance.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Inheritance.java
new file mode 100644
index 0000000000..b892fb5591
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Inheritance.java
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Inheritance</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Inheritance#getStrategy <em>Strategy</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getInheritance()
+ * @model kind="class"
+ * @extends IJpaEObject
+ * @generated
+ */
+public class Inheritance extends JpaEObject implements IJpaEObject
+{
+ /**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final InheritanceType STRATEGY_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getStrategy() <em>Strategy</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getStrategy()
+ * @generated
+ * @ordered
+ */
+ protected InheritanceType strategy = STRATEGY_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Inheritance()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.INHERITANCE;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Strategy</b></em>' attribute.
+ * The default value is <code>"SINGLE_TABLE"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.InheritanceType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Strategy</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Strategy</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.InheritanceType
+ * @see #setStrategy(InheritanceType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getInheritance_Strategy()
+ * @model default="SINGLE_TABLE"
+ * @generated
+ */
+ public InheritanceType getStrategy()
+ {
+ return strategy;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Inheritance#getStrategy <em>Strategy</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Strategy</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.InheritanceType
+ * @see #getStrategy()
+ * @generated
+ */
+ public void setStrategy(InheritanceType newStrategy)
+ {
+ InheritanceType oldStrategy = strategy;
+ strategy = newStrategy == null ? STRATEGY_EDEFAULT : newStrategy;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.INHERITANCE__STRATEGY, oldStrategy, strategy));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.INHERITANCE__STRATEGY:
+ return getStrategy();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.INHERITANCE__STRATEGY:
+ setStrategy((InheritanceType)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.INHERITANCE__STRATEGY:
+ setStrategy(STRATEGY_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.INHERITANCE__STRATEGY:
+ return strategy != STRATEGY_EDEFAULT;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (strategy: ");
+ result.append(strategy);
+ result.append(')');
+ return result.toString();
+ }
+
+} // Inheritance
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/InheritanceType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/InheritanceType.java
index 5f216d2d98..96cdc79463 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/InheritanceType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/InheritanceType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007 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.
@@ -7,33 +7,24 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.mappings;
+package org.eclipse.jpt.core.internal.resource.orm;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.eclipse.emf.common.util.Enumerator;
-import org.eclipse.jpt.core.internal.content.java.mappings.JPA;
/**
* <!-- begin-user-doc -->
* A representation of the literals of the enumeration '<em><b>Inheritance Type</b></em>',
* and utility methods for working with them.
* <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getInheritanceType()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getInheritanceType()
* @model
* @generated
*/
-public enum InheritanceType implements Enumerator {
- /**
- * The '<em><b>Default</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #DEFAULT_VALUE
- * @generated
- * @ordered
- */
- DEFAULT(0, "Default", "Default (Single Table)"),
+public enum InheritanceType implements Enumerator
+{
/**
* The '<em><b>SINGLE TABLE</b></em>' literal object.
* <!-- begin-user-doc -->
@@ -42,8 +33,7 @@ public enum InheritanceType implements Enumerator {
* @generated
* @ordered
*/
- SINGLE_TABLE(1, "SINGLE_TABLE", "Single Table"),
- /**
+ SINGLE_TABLE(0, "SINGLE_TABLE", "SINGLE_TABLE"), /**
* The '<em><b>JOINED</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -51,7 +41,8 @@ public enum InheritanceType implements Enumerator {
* @generated
* @ordered
*/
- JOINED(2, "JOINED", "Joined"),
+ JOINED(1, "JOINED", "JOINED"),
+
/**
* The '<em><b>TABLE PER CLASS</b></em>' literal object.
* <!-- begin-user-doc -->
@@ -60,66 +51,52 @@ public enum InheritanceType implements Enumerator {
* @generated
* @ordered
*/
- TABLE_PER_CLASS(3, "TABLE_PER_CLASS", "Table per Class");
- /**
- * The '<em><b>Default</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>Default</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #DEFAULT
- * @model name="Default" literal="Default (Single Table)"
- * @generated
- * @ordered
- */
- public static final int DEFAULT_VALUE = 0;
+ TABLE_PER_CLASS(2, "TABLE_PER_CLASS", "TABLE_PER_CLASS");
/**
* The '<em><b>SINGLE TABLE</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of '<em><b>Single Table</b></em>' literal object isn't clear,
+ * If the meaning of '<em><b>SINGLE TABLE</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #SINGLE_TABLE
- * @model literal="Single Table"
+ * @model
* @generated
* @ordered
*/
- public static final int SINGLE_TABLE_VALUE = 1;
+ public static final int SINGLE_TABLE_VALUE = 0;
/**
* The '<em><b>JOINED</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of '<em><b>Joined</b></em>' literal object isn't clear,
+ * If the meaning of '<em><b>JOINED</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #JOINED
- * @model literal="Joined"
+ * @model
* @generated
* @ordered
*/
- public static final int JOINED_VALUE = 2;
+ public static final int JOINED_VALUE = 1;
/**
* The '<em><b>TABLE PER CLASS</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of '<em><b>Table Per Class</b></em>' literal object isn't clear,
+ * If the meaning of '<em><b>TABLE PER CLASS</b></em>' literal object isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @see #TABLE_PER_CLASS
- * @model literal="Table per Class"
+ * @model
* @generated
* @ordered
*/
- public static final int TABLE_PER_CLASS_VALUE = 3;
+ public static final int TABLE_PER_CLASS_VALUE = 2;
/**
* An array of all the '<em><b>Inheritance Type</b></em>' enumerators.
@@ -127,9 +104,13 @@ public enum InheritanceType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- private static final InheritanceType[] VALUES_ARRAY = new InheritanceType[] {
- DEFAULT, SINGLE_TABLE, JOINED, TABLE_PER_CLASS,
- };
+ private static final InheritanceType[] VALUES_ARRAY =
+ new InheritanceType[]
+ {
+ SINGLE_TABLE,
+ JOINED,
+ TABLE_PER_CLASS,
+ };
/**
* A public read-only list of all the '<em><b>Inheritance Type</b></em>' enumerators.
@@ -145,10 +126,13 @@ public enum InheritanceType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static InheritanceType get(String literal) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ public static InheritanceType get(String literal)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
InheritanceType result = VALUES_ARRAY[i];
- if (result.toString().equals(literal)) {
+ if (result.toString().equals(literal))
+ {
return result;
}
}
@@ -161,10 +145,13 @@ public enum InheritanceType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static InheritanceType getByName(String name) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ public static InheritanceType getByName(String name)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
InheritanceType result = VALUES_ARRAY[i];
- if (result.getName().equals(name)) {
+ if (result.getName().equals(name))
+ {
return result;
}
}
@@ -177,16 +164,13 @@ public enum InheritanceType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static InheritanceType get(int value) {
- switch (value) {
- case DEFAULT_VALUE :
- return DEFAULT;
- case SINGLE_TABLE_VALUE :
- return SINGLE_TABLE;
- case JOINED_VALUE :
- return JOINED;
- case TABLE_PER_CLASS_VALUE :
- return TABLE_PER_CLASS;
+ public static InheritanceType get(int value)
+ {
+ switch (value)
+ {
+ case SINGLE_TABLE_VALUE: return SINGLE_TABLE;
+ case JOINED_VALUE: return JOINED;
+ case TABLE_PER_CLASS_VALUE: return TABLE_PER_CLASS;
}
return null;
}
@@ -218,7 +202,8 @@ public enum InheritanceType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- private InheritanceType(int value, String name, String literal) {
+ private InheritanceType(int value, String name, String literal)
+ {
this.value = value;
this.name = name;
this.literal = literal;
@@ -229,8 +214,9 @@ public enum InheritanceType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public int getValue() {
- return value;
+ public int getValue()
+ {
+ return value;
}
/**
@@ -238,8 +224,9 @@ public enum InheritanceType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public String getName() {
- return name;
+ public String getName()
+ {
+ return name;
}
/**
@@ -247,8 +234,9 @@ public enum InheritanceType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public String getLiteral() {
- return literal;
+ public String getLiteral()
+ {
+ return literal;
}
/**
@@ -258,42 +246,9 @@ public enum InheritanceType implements Enumerator {
* @generated
*/
@Override
- public String toString() {
+ public String toString()
+ {
return literal;
}
-
- public static InheritanceType fromJavaAnnotationValue(Object javaAnnotationValue) {
- if (javaAnnotationValue == null) {
- return DEFAULT;
- }
- if (javaAnnotationValue.equals(JPA.INHERITANCE_TYPE__JOINED)) {
- return JOINED;
- }
- if (javaAnnotationValue.equals(JPA.INHERITANCE_TYPE__SINGLE_TABLE)) {
- return SINGLE_TABLE;
- }
- if (javaAnnotationValue.equals(JPA.INHERITANCE_TYPE__TABLE_PER_CLASS)) {
- return TABLE_PER_CLASS;
- }
- return DEFAULT;
- }
-
- public String convertToJavaAnnotationValue() {
- switch (this.getValue()) {
- case DEFAULT_VALUE :
- return null;
- case JOINED_VALUE :
- return JPA.INHERITANCE_TYPE__JOINED;
- case SINGLE_TABLE_VALUE :
- return JPA.INHERITANCE_TYPE__SINGLE_TABLE;
- case TABLE_PER_CLASS_VALUE :
- return JPA.INHERITANCE_TYPE__TABLE_PER_CLASS;
- default :
- throw new IllegalArgumentException("unknown inheritance type: " + this);
- }
- }
-
- public boolean isSingleTable() {
- return (this.getValue() == DEFAULT_VALUE) || (this.getValue() == SINGLE_TABLE_VALUE);
- }
+
} //InheritanceType
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/JoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/JoinColumn.java
new file mode 100644
index 0000000000..06bb70e48b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/JoinColumn.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Join Column</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn#getReferencedColumnName <em>Referenced Column Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinColumn()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface JoinColumn extends AbstractColumn
+{
+ /**
+ * Returns the value of the '<em><b>Referenced Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Referenced Column Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Referenced Column Name</em>' attribute.
+ * @see #setReferencedColumnName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinColumn_ReferencedColumnName()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getReferencedColumnName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn#getReferencedColumnName <em>Referenced Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Referenced Column Name</em>' attribute.
+ * @see #getReferencedColumnName()
+ * @generated
+ */
+ void setReferencedColumnName(String value);
+
+} // JoinColumn
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/JoinColumnImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/JoinColumnImpl.java
new file mode 100644
index 0000000000..466466606c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/JoinColumnImpl.java
@@ -0,0 +1,657 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Join Column</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinColumnImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class JoinColumnImpl extends JpaEObject implements JoinColumn
+{
+ /**
+ * The default value of the '{@link #getColumnDefinition() <em>Column Definition</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumnDefinition()
+ * @generated
+ * @ordered
+ */
+ protected static final String COLUMN_DEFINITION_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getColumnDefinition() <em>Column Definition</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumnDefinition()
+ * @generated
+ * @ordered
+ */
+ protected String columnDefinition = COLUMN_DEFINITION_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getInsertable() <em>Insertable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInsertable()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean INSERTABLE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getInsertable() <em>Insertable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInsertable()
+ * @generated
+ * @ordered
+ */
+ protected Boolean insertable = INSERTABLE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getNullable() <em>Nullable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getNullable()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean NULLABLE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getNullable() <em>Nullable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getNullable()
+ * @generated
+ * @ordered
+ */
+ protected Boolean nullable = NULLABLE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getTable() <em>Table</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTable()
+ * @generated
+ * @ordered
+ */
+ protected static final String TABLE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTable() <em>Table</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTable()
+ * @generated
+ * @ordered
+ */
+ protected String table = TABLE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getUnique() <em>Unique</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getUnique()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean UNIQUE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getUnique() <em>Unique</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getUnique()
+ * @generated
+ * @ordered
+ */
+ protected Boolean unique = UNIQUE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getUpdatable() <em>Updatable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getUpdatable()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean UPDATABLE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getUpdatable() <em>Updatable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getUpdatable()
+ * @generated
+ * @ordered
+ */
+ protected Boolean updatable = UPDATABLE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getReferencedColumnName() <em>Referenced Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getReferencedColumnName()
+ * @generated
+ * @ordered
+ */
+ protected static final String REFERENCED_COLUMN_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getReferencedColumnName() <em>Referenced Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getReferencedColumnName()
+ * @generated
+ * @ordered
+ */
+ protected String referencedColumnName = REFERENCED_COLUMN_NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected JoinColumnImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.JOIN_COLUMN_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedColumn_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumnImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.JOIN_COLUMN_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Insertable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Insertable</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Insertable</em>' attribute.
+ * @see #setInsertable(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn_Insertable()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getInsertable()
+ {
+ return insertable;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumnImpl#getInsertable <em>Insertable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Insertable</em>' attribute.
+ * @see #getInsertable()
+ * @generated
+ */
+ public void setInsertable(Boolean newInsertable)
+ {
+ Boolean oldInsertable = insertable;
+ insertable = newInsertable;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.JOIN_COLUMN_IMPL__INSERTABLE, oldInsertable, insertable));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Nullable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Nullable</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Nullable</em>' attribute.
+ * @see #setNullable(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn_Nullable()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getNullable()
+ {
+ return nullable;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumnImpl#getNullable <em>Nullable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Nullable</em>' attribute.
+ * @see #getNullable()
+ * @generated
+ */
+ public void setNullable(Boolean newNullable)
+ {
+ Boolean oldNullable = nullable;
+ nullable = newNullable;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.JOIN_COLUMN_IMPL__NULLABLE, oldNullable, nullable));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Column Definition</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Column Definition</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Column Definition</em>' attribute.
+ * @see #setColumnDefinition(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedColumn_ColumnDefinition()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getColumnDefinition()
+ {
+ return columnDefinition;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumnImpl#getColumnDefinition <em>Column Definition</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Column Definition</em>' attribute.
+ * @see #getColumnDefinition()
+ * @generated
+ */
+ public void setColumnDefinition(String newColumnDefinition)
+ {
+ String oldColumnDefinition = columnDefinition;
+ columnDefinition = newColumnDefinition;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.JOIN_COLUMN_IMPL__COLUMN_DEFINITION, oldColumnDefinition, columnDefinition));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Table</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Table</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Table</em>' attribute.
+ * @see #setTable(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn_Table()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getTable()
+ {
+ return table;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumnImpl#getTable <em>Table</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Table</em>' attribute.
+ * @see #getTable()
+ * @generated
+ */
+ public void setTable(String newTable)
+ {
+ String oldTable = table;
+ table = newTable;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.JOIN_COLUMN_IMPL__TABLE, oldTable, table));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Unique</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Unique</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Unique</em>' attribute.
+ * @see #setUnique(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn_Unique()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getUnique()
+ {
+ return unique;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumnImpl#getUnique <em>Unique</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Unique</em>' attribute.
+ * @see #getUnique()
+ * @generated
+ */
+ public void setUnique(Boolean newUnique)
+ {
+ Boolean oldUnique = unique;
+ unique = newUnique;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.JOIN_COLUMN_IMPL__UNIQUE, oldUnique, unique));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Updatable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Updatable</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Updatable</em>' attribute.
+ * @see #setUpdatable(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn_Updatable()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getUpdatable()
+ {
+ return updatable;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumnImpl#getUpdatable <em>Updatable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Updatable</em>' attribute.
+ * @see #getUpdatable()
+ * @generated
+ */
+ public void setUpdatable(Boolean newUpdatable)
+ {
+ Boolean oldUpdatable = updatable;
+ updatable = newUpdatable;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.JOIN_COLUMN_IMPL__UPDATABLE, oldUpdatable, updatable));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Referenced Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Referenced Column Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Referenced Column Name</em>' attribute.
+ * @see #setReferencedColumnName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinColumn_ReferencedColumnName()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getReferencedColumnName()
+ {
+ return referencedColumnName;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumnImpl#getReferencedColumnName <em>Referenced Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Referenced Column Name</em>' attribute.
+ * @see #getReferencedColumnName()
+ * @generated
+ */
+ public void setReferencedColumnName(String newReferencedColumnName)
+ {
+ String oldReferencedColumnName = referencedColumnName;
+ referencedColumnName = newReferencedColumnName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.JOIN_COLUMN_IMPL__REFERENCED_COLUMN_NAME, oldReferencedColumnName, referencedColumnName));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.JOIN_COLUMN_IMPL__COLUMN_DEFINITION:
+ return getColumnDefinition();
+ case OrmPackage.JOIN_COLUMN_IMPL__NAME:
+ return getName();
+ case OrmPackage.JOIN_COLUMN_IMPL__INSERTABLE:
+ return getInsertable();
+ case OrmPackage.JOIN_COLUMN_IMPL__NULLABLE:
+ return getNullable();
+ case OrmPackage.JOIN_COLUMN_IMPL__TABLE:
+ return getTable();
+ case OrmPackage.JOIN_COLUMN_IMPL__UNIQUE:
+ return getUnique();
+ case OrmPackage.JOIN_COLUMN_IMPL__UPDATABLE:
+ return getUpdatable();
+ case OrmPackage.JOIN_COLUMN_IMPL__REFERENCED_COLUMN_NAME:
+ return getReferencedColumnName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.JOIN_COLUMN_IMPL__COLUMN_DEFINITION:
+ setColumnDefinition((String)newValue);
+ return;
+ case OrmPackage.JOIN_COLUMN_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.JOIN_COLUMN_IMPL__INSERTABLE:
+ setInsertable((Boolean)newValue);
+ return;
+ case OrmPackage.JOIN_COLUMN_IMPL__NULLABLE:
+ setNullable((Boolean)newValue);
+ return;
+ case OrmPackage.JOIN_COLUMN_IMPL__TABLE:
+ setTable((String)newValue);
+ return;
+ case OrmPackage.JOIN_COLUMN_IMPL__UNIQUE:
+ setUnique((Boolean)newValue);
+ return;
+ case OrmPackage.JOIN_COLUMN_IMPL__UPDATABLE:
+ setUpdatable((Boolean)newValue);
+ return;
+ case OrmPackage.JOIN_COLUMN_IMPL__REFERENCED_COLUMN_NAME:
+ setReferencedColumnName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.JOIN_COLUMN_IMPL__COLUMN_DEFINITION:
+ setColumnDefinition(COLUMN_DEFINITION_EDEFAULT);
+ return;
+ case OrmPackage.JOIN_COLUMN_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.JOIN_COLUMN_IMPL__INSERTABLE:
+ setInsertable(INSERTABLE_EDEFAULT);
+ return;
+ case OrmPackage.JOIN_COLUMN_IMPL__NULLABLE:
+ setNullable(NULLABLE_EDEFAULT);
+ return;
+ case OrmPackage.JOIN_COLUMN_IMPL__TABLE:
+ setTable(TABLE_EDEFAULT);
+ return;
+ case OrmPackage.JOIN_COLUMN_IMPL__UNIQUE:
+ setUnique(UNIQUE_EDEFAULT);
+ return;
+ case OrmPackage.JOIN_COLUMN_IMPL__UPDATABLE:
+ setUpdatable(UPDATABLE_EDEFAULT);
+ return;
+ case OrmPackage.JOIN_COLUMN_IMPL__REFERENCED_COLUMN_NAME:
+ setReferencedColumnName(REFERENCED_COLUMN_NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.JOIN_COLUMN_IMPL__COLUMN_DEFINITION:
+ return COLUMN_DEFINITION_EDEFAULT == null ? columnDefinition != null : !COLUMN_DEFINITION_EDEFAULT.equals(columnDefinition);
+ case OrmPackage.JOIN_COLUMN_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.JOIN_COLUMN_IMPL__INSERTABLE:
+ return INSERTABLE_EDEFAULT == null ? insertable != null : !INSERTABLE_EDEFAULT.equals(insertable);
+ case OrmPackage.JOIN_COLUMN_IMPL__NULLABLE:
+ return NULLABLE_EDEFAULT == null ? nullable != null : !NULLABLE_EDEFAULT.equals(nullable);
+ case OrmPackage.JOIN_COLUMN_IMPL__TABLE:
+ return TABLE_EDEFAULT == null ? table != null : !TABLE_EDEFAULT.equals(table);
+ case OrmPackage.JOIN_COLUMN_IMPL__UNIQUE:
+ return UNIQUE_EDEFAULT == null ? unique != null : !UNIQUE_EDEFAULT.equals(unique);
+ case OrmPackage.JOIN_COLUMN_IMPL__UPDATABLE:
+ return UPDATABLE_EDEFAULT == null ? updatable != null : !UPDATABLE_EDEFAULT.equals(updatable);
+ case OrmPackage.JOIN_COLUMN_IMPL__REFERENCED_COLUMN_NAME:
+ return REFERENCED_COLUMN_NAME_EDEFAULT == null ? referencedColumnName != null : !REFERENCED_COLUMN_NAME_EDEFAULT.equals(referencedColumnName);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (columnDefinition: ");
+ result.append(columnDefinition);
+ result.append(", name: ");
+ result.append(name);
+ result.append(", insertable: ");
+ result.append(insertable);
+ result.append(", nullable: ");
+ result.append(nullable);
+ result.append(", table: ");
+ result.append(table);
+ result.append(", unique: ");
+ result.append(unique);
+ result.append(", updatable: ");
+ result.append(updatable);
+ result.append(", referencedColumnName: ");
+ result.append(referencedColumnName);
+ result.append(')');
+ return result.toString();
+ }
+
+} // JoinColumn
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/JoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/JoinTable.java
new file mode 100644
index 0000000000..af658b163a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/JoinTable.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Join Table</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.JoinTable#getJoinColumns <em>Join Columns</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.JoinTable#getInverseJoinColumns <em>Inverse Join Columns</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinTable()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface JoinTable extends AbstractTable
+{
+ /**
+ * Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Join Columns</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinTable_JoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ EList<JoinColumn> getJoinColumns();
+
+ /**
+ * Returns the value of the '<em><b>Inverse Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Inverse Join Columns</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Inverse Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinTable_InverseJoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ EList<JoinColumn> getInverseJoinColumns();
+
+} // JoinTable
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/JoinTableImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/JoinTableImpl.java
new file mode 100644
index 0000000000..35f139e0e3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/JoinTableImpl.java
@@ -0,0 +1,474 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Join Table</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinTableImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class JoinTableImpl extends JpaEObject implements JoinTable
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+ /**
+ * The default value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCatalog()
+ * @generated
+ * @ordered
+ */
+ protected static final String CATALOG_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCatalog()
+ * @generated
+ * @ordered
+ */
+ protected String catalog = CATALOG_EDEFAULT;
+ /**
+ * The default value of the '{@link #getSchema() <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSchema()
+ * @generated
+ * @ordered
+ */
+ protected static final String SCHEMA_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getSchema() <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSchema()
+ * @generated
+ * @ordered
+ */
+ protected String schema = SCHEMA_EDEFAULT;
+ /**
+ * The cached value of the '{@link #getUniqueConstraints() <em>Unique Constraints</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getUniqueConstraints()
+ * @generated
+ * @ordered
+ */
+ protected EList<UniqueConstraint> uniqueConstraints;
+
+ /**
+ * The cached value of the '{@link #getJoinColumns() <em>Join Columns</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJoinColumns()
+ * @generated
+ * @ordered
+ */
+ protected EList<JoinColumn> joinColumns;
+ /**
+ * The cached value of the '{@link #getInverseJoinColumns() <em>Inverse Join Columns</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInverseJoinColumns()
+ * @generated
+ * @ordered
+ */
+ protected EList<JoinColumn> inverseJoinColumns;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected JoinTableImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.JOIN_TABLE_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinTableImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.JOIN_TABLE_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Catalog</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Catalog</em>' attribute.
+ * @see #setCatalog(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_Catalog()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getCatalog()
+ {
+ return catalog;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinTableImpl#getCatalog <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Catalog</em>' attribute.
+ * @see #getCatalog()
+ * @generated
+ */
+ public void setCatalog(String newCatalog)
+ {
+ String oldCatalog = catalog;
+ catalog = newCatalog;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.JOIN_TABLE_IMPL__CATALOG, oldCatalog, catalog));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Schema</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Schema</em>' attribute.
+ * @see #setSchema(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_Schema()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getSchema()
+ {
+ return schema;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinTableImpl#getSchema <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Schema</em>' attribute.
+ * @see #getSchema()
+ * @generated
+ */
+ public void setSchema(String newSchema)
+ {
+ String oldSchema = schema;
+ schema = newSchema;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.JOIN_TABLE_IMPL__SCHEMA, oldSchema, schema));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Unique Constraints</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Unique Constraints</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Unique Constraints</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_UniqueConstraints()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<UniqueConstraint> getUniqueConstraints()
+ {
+ if (uniqueConstraints == null)
+ {
+ uniqueConstraints = new EObjectContainmentEList<UniqueConstraint>(UniqueConstraint.class, this, OrmPackage.JOIN_TABLE_IMPL__UNIQUE_CONSTRAINTS);
+ }
+ return uniqueConstraints;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Join Columns</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinTable_JoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<JoinColumn> getJoinColumns()
+ {
+ if (joinColumns == null)
+ {
+ joinColumns = new EObjectContainmentEList<JoinColumn>(JoinColumn.class, this, OrmPackage.JOIN_TABLE_IMPL__JOIN_COLUMNS);
+ }
+ return joinColumns;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Inverse Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Inverse Join Columns</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Inverse Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinTable_InverseJoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<JoinColumn> getInverseJoinColumns()
+ {
+ if (inverseJoinColumns == null)
+ {
+ inverseJoinColumns = new EObjectContainmentEList<JoinColumn>(JoinColumn.class, this, OrmPackage.JOIN_TABLE_IMPL__INVERSE_JOIN_COLUMNS);
+ }
+ return inverseJoinColumns;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.JOIN_TABLE_IMPL__UNIQUE_CONSTRAINTS:
+ return ((InternalEList<?>)getUniqueConstraints()).basicRemove(otherEnd, msgs);
+ case OrmPackage.JOIN_TABLE_IMPL__JOIN_COLUMNS:
+ return ((InternalEList<?>)getJoinColumns()).basicRemove(otherEnd, msgs);
+ case OrmPackage.JOIN_TABLE_IMPL__INVERSE_JOIN_COLUMNS:
+ return ((InternalEList<?>)getInverseJoinColumns()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.JOIN_TABLE_IMPL__NAME:
+ return getName();
+ case OrmPackage.JOIN_TABLE_IMPL__CATALOG:
+ return getCatalog();
+ case OrmPackage.JOIN_TABLE_IMPL__SCHEMA:
+ return getSchema();
+ case OrmPackage.JOIN_TABLE_IMPL__UNIQUE_CONSTRAINTS:
+ return getUniqueConstraints();
+ case OrmPackage.JOIN_TABLE_IMPL__JOIN_COLUMNS:
+ return getJoinColumns();
+ case OrmPackage.JOIN_TABLE_IMPL__INVERSE_JOIN_COLUMNS:
+ return getInverseJoinColumns();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.JOIN_TABLE_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.JOIN_TABLE_IMPL__CATALOG:
+ setCatalog((String)newValue);
+ return;
+ case OrmPackage.JOIN_TABLE_IMPL__SCHEMA:
+ setSchema((String)newValue);
+ return;
+ case OrmPackage.JOIN_TABLE_IMPL__UNIQUE_CONSTRAINTS:
+ getUniqueConstraints().clear();
+ getUniqueConstraints().addAll((Collection<? extends UniqueConstraint>)newValue);
+ return;
+ case OrmPackage.JOIN_TABLE_IMPL__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ getJoinColumns().addAll((Collection<? extends JoinColumn>)newValue);
+ return;
+ case OrmPackage.JOIN_TABLE_IMPL__INVERSE_JOIN_COLUMNS:
+ getInverseJoinColumns().clear();
+ getInverseJoinColumns().addAll((Collection<? extends JoinColumn>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.JOIN_TABLE_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.JOIN_TABLE_IMPL__CATALOG:
+ setCatalog(CATALOG_EDEFAULT);
+ return;
+ case OrmPackage.JOIN_TABLE_IMPL__SCHEMA:
+ setSchema(SCHEMA_EDEFAULT);
+ return;
+ case OrmPackage.JOIN_TABLE_IMPL__UNIQUE_CONSTRAINTS:
+ getUniqueConstraints().clear();
+ return;
+ case OrmPackage.JOIN_TABLE_IMPL__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ return;
+ case OrmPackage.JOIN_TABLE_IMPL__INVERSE_JOIN_COLUMNS:
+ getInverseJoinColumns().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.JOIN_TABLE_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.JOIN_TABLE_IMPL__CATALOG:
+ return CATALOG_EDEFAULT == null ? catalog != null : !CATALOG_EDEFAULT.equals(catalog);
+ case OrmPackage.JOIN_TABLE_IMPL__SCHEMA:
+ return SCHEMA_EDEFAULT == null ? schema != null : !SCHEMA_EDEFAULT.equals(schema);
+ case OrmPackage.JOIN_TABLE_IMPL__UNIQUE_CONSTRAINTS:
+ return uniqueConstraints != null && !uniqueConstraints.isEmpty();
+ case OrmPackage.JOIN_TABLE_IMPL__JOIN_COLUMNS:
+ return joinColumns != null && !joinColumns.isEmpty();
+ case OrmPackage.JOIN_TABLE_IMPL__INVERSE_JOIN_COLUMNS:
+ return inverseJoinColumns != null && !inverseJoinColumns.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", catalog: ");
+ result.append(catalog);
+ result.append(", schema: ");
+ result.append(schema);
+ result.append(')');
+ return result.toString();
+ }
+
+} // JoinTable
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Lob.java
index d296e94131..dda8c8fcf5 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlNullAttributeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Lob.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007 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.
@@ -7,28 +7,32 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.resource.orm;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
/**
* <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Null Attribute Mapping</b></em>'.
+ * A representation of the model object '<em><b>Lob</b></em>'.
* <!-- end-user-doc -->
*
*
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlNullAttributeMapping()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getLob()
* @model kind="class"
+ * @extends IJpaEObject
* @generated
*/
-public class XmlNullAttributeMapping extends XmlAttributeMapping
+public class Lob extends JpaEObject implements IJpaEObject
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- protected XmlNullAttributeMapping() {
+ protected Lob()
+ {
super();
}
@@ -38,21 +42,9 @@ public class XmlNullAttributeMapping extends XmlAttributeMapping
* @generated
*/
@Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_NULL_ATTRIBUTE_MAPPING;
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.LOB;
}
- @Override
- public int xmlSequence() {
- return -1;
- }
-
- @Override
- protected void initializeOn(XmlAttributeMapping newMapping) {
- newMapping.initializeFromXmlAttributeMapping(this);
- }
-
- public String getKey() {
- return null;
- }
-} \ No newline at end of file
+} // Lob
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ManyToMany.java
index 79235c8643..7d0eed9e93 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IPrimaryKeyJoinColumn.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ManyToMany.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -7,17 +7,19 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.mappings;
+package org.eclipse.jpt.core.internal.resource.orm;
+
/**
* <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IPrimary Key Join Column</b></em>'.
+ * A representation of the model object '<em><b>Many To Many</b></em>'.
* <!-- end-user-doc -->
*
*
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIPrimaryKeyJoinColumn()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getManyToMany()
* @model kind="class" interface="true" abstract="true"
* @generated
*/
-public interface IPrimaryKeyJoinColumn extends IAbstractJoinColumn
-{} \ No newline at end of file
+public interface ManyToMany extends MultiRelationshipMapping
+{
+} // ManyToMany
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ManyToManyImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ManyToManyImpl.java
new file mode 100644
index 0000000000..74a695ab58
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ManyToManyImpl.java
@@ -0,0 +1,718 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Many To Many</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getManyToManyImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class ManyToManyImpl extends JpaEObject implements ManyToMany
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getTargetEntity() <em>Target Entity</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetEntity()
+ * @generated
+ * @ordered
+ */
+ protected static final String TARGET_ENTITY_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTargetEntity() <em>Target Entity</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetEntity()
+ * @generated
+ * @ordered
+ */
+ protected String targetEntity = TARGET_ENTITY_EDEFAULT;
+
+ /**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final FetchType FETCH_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFetch()
+ * @generated
+ * @ordered
+ */
+ protected FetchType fetch = FETCH_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getJoinTable() <em>Join Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJoinTable()
+ * @generated
+ * @ordered
+ */
+ protected JoinTable joinTable;
+
+ /**
+ * The cached value of the '{@link #getCascade() <em>Cascade</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCascade()
+ * @generated
+ * @ordered
+ */
+ protected CascadeType cascade;
+
+ /**
+ * The default value of the '{@link #getMappedBy() <em>Mapped By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMappedBy()
+ * @generated
+ * @ordered
+ */
+ protected static final String MAPPED_BY_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getMappedBy() <em>Mapped By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMappedBy()
+ * @generated
+ * @ordered
+ */
+ protected String mappedBy = MAPPED_BY_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getOrderBy() <em>Order By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOrderBy()
+ * @generated
+ * @ordered
+ */
+ protected static final String ORDER_BY_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getOrderBy() <em>Order By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOrderBy()
+ * @generated
+ * @ordered
+ */
+ protected String orderBy = ORDER_BY_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getMapKey() <em>Map Key</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapKey()
+ * @generated
+ * @ordered
+ */
+ protected MapKey mapKey;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ManyToManyImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.MANY_TO_MANY_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeMapping_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_MANY_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Target Entity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Target Entity</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Target Entity</em>' attribute.
+ * @see #setTargetEntity(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_TargetEntity()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getTargetEntity()
+ {
+ return targetEntity;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl#getTargetEntity <em>Target Entity</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Target Entity</em>' attribute.
+ * @see #getTargetEntity()
+ * @generated
+ */
+ public void setTargetEntity(String newTargetEntity)
+ {
+ String oldTargetEntity = targetEntity;
+ targetEntity = newTargetEntity;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_MANY_IMPL__TARGET_ENTITY, oldTargetEntity, targetEntity));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Fetch</b></em>' attribute.
+ * The default value is <code>"LAZY"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.FetchType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Fetch</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Fetch</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
+ * @see #setFetch(FetchType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_Fetch()
+ * @model default="LAZY"
+ * @generated
+ */
+ public FetchType getFetch()
+ {
+ return fetch;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl#getFetch <em>Fetch</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Fetch</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
+ * @see #getFetch()
+ * @generated
+ */
+ public void setFetch(FetchType newFetch)
+ {
+ FetchType oldFetch = fetch;
+ fetch = newFetch == null ? FETCH_EDEFAULT : newFetch;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_MANY_IMPL__FETCH, oldFetch, fetch));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Mapped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Mapped By</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Mapped By</em>' attribute.
+ * @see #setMappedBy(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMultiRelationshipMapping_MappedBy()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getMappedBy()
+ {
+ return mappedBy;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl#getMappedBy <em>Mapped By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Mapped By</em>' attribute.
+ * @see #getMappedBy()
+ * @generated
+ */
+ public void setMappedBy(String newMappedBy)
+ {
+ String oldMappedBy = mappedBy;
+ mappedBy = newMappedBy;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_MANY_IMPL__MAPPED_BY, oldMappedBy, mappedBy));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Order By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Order By</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Order By</em>' attribute.
+ * @see #setOrderBy(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMultiRelationshipMapping_OrderBy()
+ * @model dataType="org.eclipse.jpt.core.internal.resource.orm.OrderBy"
+ * @generated
+ */
+ public String getOrderBy()
+ {
+ return orderBy;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl#getOrderBy <em>Order By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Order By</em>' attribute.
+ * @see #getOrderBy()
+ * @generated
+ */
+ public void setOrderBy(String newOrderBy)
+ {
+ String oldOrderBy = orderBy;
+ orderBy = newOrderBy;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_MANY_IMPL__ORDER_BY, oldOrderBy, orderBy));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Map Key</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Map Key</em>' containment reference.
+ * @see #setMapKey(MapKey)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMultiRelationshipMapping_MapKey()
+ * @model containment="true"
+ * @generated
+ */
+ public MapKey getMapKey()
+ {
+ return mapKey;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetMapKey(MapKey newMapKey, NotificationChain msgs)
+ {
+ MapKey oldMapKey = mapKey;
+ mapKey = newMapKey;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_MANY_IMPL__MAP_KEY, oldMapKey, newMapKey);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl#getMapKey <em>Map Key</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key</em>' containment reference.
+ * @see #getMapKey()
+ * @generated
+ */
+ public void setMapKey(MapKey newMapKey)
+ {
+ if (newMapKey != mapKey)
+ {
+ NotificationChain msgs = null;
+ if (mapKey != null)
+ msgs = ((InternalEObject)mapKey).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MANY_TO_MANY_IMPL__MAP_KEY, null, msgs);
+ if (newMapKey != null)
+ msgs = ((InternalEObject)newMapKey).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MANY_TO_MANY_IMPL__MAP_KEY, null, msgs);
+ msgs = basicSetMapKey(newMapKey, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_MANY_IMPL__MAP_KEY, newMapKey, newMapKey));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Join Table</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Join Table</em>' containment reference.
+ * @see #setJoinTable(JoinTable)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_JoinTable()
+ * @model containment="true"
+ * @generated
+ */
+ public JoinTable getJoinTable()
+ {
+ return joinTable;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetJoinTable(JoinTable newJoinTable, NotificationChain msgs)
+ {
+ JoinTable oldJoinTable = joinTable;
+ joinTable = newJoinTable;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_MANY_IMPL__JOIN_TABLE, oldJoinTable, newJoinTable);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl#getJoinTable <em>Join Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Join Table</em>' containment reference.
+ * @see #getJoinTable()
+ * @generated
+ */
+ public void setJoinTable(JoinTable newJoinTable)
+ {
+ if (newJoinTable != joinTable)
+ {
+ NotificationChain msgs = null;
+ if (joinTable != null)
+ msgs = ((InternalEObject)joinTable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MANY_TO_MANY_IMPL__JOIN_TABLE, null, msgs);
+ if (newJoinTable != null)
+ msgs = ((InternalEObject)newJoinTable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MANY_TO_MANY_IMPL__JOIN_TABLE, null, msgs);
+ msgs = basicSetJoinTable(newJoinTable, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_MANY_IMPL__JOIN_TABLE, newJoinTable, newJoinTable));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cascade</em>' containment reference.
+ * @see #setCascade(CascadeType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_Cascade()
+ * @model containment="true"
+ * @generated
+ */
+ public CascadeType getCascade()
+ {
+ return cascade;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetCascade(CascadeType newCascade, NotificationChain msgs)
+ {
+ CascadeType oldCascade = cascade;
+ cascade = newCascade;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_MANY_IMPL__CASCADE, oldCascade, newCascade);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl#getCascade <em>Cascade</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade</em>' containment reference.
+ * @see #getCascade()
+ * @generated
+ */
+ public void setCascade(CascadeType newCascade)
+ {
+ if (newCascade != cascade)
+ {
+ NotificationChain msgs = null;
+ if (cascade != null)
+ msgs = ((InternalEObject)cascade).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MANY_TO_MANY_IMPL__CASCADE, null, msgs);
+ if (newCascade != null)
+ msgs = ((InternalEObject)newCascade).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MANY_TO_MANY_IMPL__CASCADE, null, msgs);
+ msgs = basicSetCascade(newCascade, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_MANY_IMPL__CASCADE, newCascade, newCascade));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MANY_TO_MANY_IMPL__JOIN_TABLE:
+ return basicSetJoinTable(null, msgs);
+ case OrmPackage.MANY_TO_MANY_IMPL__CASCADE:
+ return basicSetCascade(null, msgs);
+ case OrmPackage.MANY_TO_MANY_IMPL__MAP_KEY:
+ return basicSetMapKey(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MANY_TO_MANY_IMPL__NAME:
+ return getName();
+ case OrmPackage.MANY_TO_MANY_IMPL__TARGET_ENTITY:
+ return getTargetEntity();
+ case OrmPackage.MANY_TO_MANY_IMPL__FETCH:
+ return getFetch();
+ case OrmPackage.MANY_TO_MANY_IMPL__JOIN_TABLE:
+ return getJoinTable();
+ case OrmPackage.MANY_TO_MANY_IMPL__CASCADE:
+ return getCascade();
+ case OrmPackage.MANY_TO_MANY_IMPL__MAPPED_BY:
+ return getMappedBy();
+ case OrmPackage.MANY_TO_MANY_IMPL__ORDER_BY:
+ return getOrderBy();
+ case OrmPackage.MANY_TO_MANY_IMPL__MAP_KEY:
+ return getMapKey();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MANY_TO_MANY_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.MANY_TO_MANY_IMPL__TARGET_ENTITY:
+ setTargetEntity((String)newValue);
+ return;
+ case OrmPackage.MANY_TO_MANY_IMPL__FETCH:
+ setFetch((FetchType)newValue);
+ return;
+ case OrmPackage.MANY_TO_MANY_IMPL__JOIN_TABLE:
+ setJoinTable((JoinTable)newValue);
+ return;
+ case OrmPackage.MANY_TO_MANY_IMPL__CASCADE:
+ setCascade((CascadeType)newValue);
+ return;
+ case OrmPackage.MANY_TO_MANY_IMPL__MAPPED_BY:
+ setMappedBy((String)newValue);
+ return;
+ case OrmPackage.MANY_TO_MANY_IMPL__ORDER_BY:
+ setOrderBy((String)newValue);
+ return;
+ case OrmPackage.MANY_TO_MANY_IMPL__MAP_KEY:
+ setMapKey((MapKey)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MANY_TO_MANY_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.MANY_TO_MANY_IMPL__TARGET_ENTITY:
+ setTargetEntity(TARGET_ENTITY_EDEFAULT);
+ return;
+ case OrmPackage.MANY_TO_MANY_IMPL__FETCH:
+ setFetch(FETCH_EDEFAULT);
+ return;
+ case OrmPackage.MANY_TO_MANY_IMPL__JOIN_TABLE:
+ setJoinTable((JoinTable)null);
+ return;
+ case OrmPackage.MANY_TO_MANY_IMPL__CASCADE:
+ setCascade((CascadeType)null);
+ return;
+ case OrmPackage.MANY_TO_MANY_IMPL__MAPPED_BY:
+ setMappedBy(MAPPED_BY_EDEFAULT);
+ return;
+ case OrmPackage.MANY_TO_MANY_IMPL__ORDER_BY:
+ setOrderBy(ORDER_BY_EDEFAULT);
+ return;
+ case OrmPackage.MANY_TO_MANY_IMPL__MAP_KEY:
+ setMapKey((MapKey)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MANY_TO_MANY_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.MANY_TO_MANY_IMPL__TARGET_ENTITY:
+ return TARGET_ENTITY_EDEFAULT == null ? targetEntity != null : !TARGET_ENTITY_EDEFAULT.equals(targetEntity);
+ case OrmPackage.MANY_TO_MANY_IMPL__FETCH:
+ return fetch != FETCH_EDEFAULT;
+ case OrmPackage.MANY_TO_MANY_IMPL__JOIN_TABLE:
+ return joinTable != null;
+ case OrmPackage.MANY_TO_MANY_IMPL__CASCADE:
+ return cascade != null;
+ case OrmPackage.MANY_TO_MANY_IMPL__MAPPED_BY:
+ return MAPPED_BY_EDEFAULT == null ? mappedBy != null : !MAPPED_BY_EDEFAULT.equals(mappedBy);
+ case OrmPackage.MANY_TO_MANY_IMPL__ORDER_BY:
+ return ORDER_BY_EDEFAULT == null ? orderBy != null : !ORDER_BY_EDEFAULT.equals(orderBy);
+ case OrmPackage.MANY_TO_MANY_IMPL__MAP_KEY:
+ return mapKey != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", targetEntity: ");
+ result.append(targetEntity);
+ result.append(", fetch: ");
+ result.append(fetch);
+ result.append(", mappedBy: ");
+ result.append(mappedBy);
+ result.append(", orderBy: ");
+ result.append(orderBy);
+ result.append(')');
+ return result.toString();
+ }
+
+} // ManyToMany
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IOneToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ManyToOne.java
index c44b7b5ba1..ce170d76fe 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IOneToOne.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ManyToOne.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -7,18 +7,19 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.mappings;
+package org.eclipse.jpt.core.internal.resource.orm;
+
/**
* <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IOne To One</b></em>'.
+ * A representation of the model object '<em><b>Many To One</b></em>'.
* <!-- end-user-doc -->
*
*
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIOneToOne()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getManyToOne()
* @model kind="class" interface="true" abstract="true"
* @generated
*/
-public interface IOneToOne
- extends ISingleRelationshipMapping, INonOwningMapping
-{} // IOneToOne
+public interface ManyToOne extends SingleRelationshipMapping
+{
+} // ManyToOne
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ManyToOneImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ManyToOneImpl.java
new file mode 100644
index 0000000000..46fb308a34
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/ManyToOneImpl.java
@@ -0,0 +1,620 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Many To One</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getManyToOneImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class ManyToOneImpl extends JpaEObject implements ManyToOne
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getTargetEntity() <em>Target Entity</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetEntity()
+ * @generated
+ * @ordered
+ */
+ protected static final String TARGET_ENTITY_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTargetEntity() <em>Target Entity</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetEntity()
+ * @generated
+ * @ordered
+ */
+ protected String targetEntity = TARGET_ENTITY_EDEFAULT;
+
+ /**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final FetchType FETCH_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFetch()
+ * @generated
+ * @ordered
+ */
+ protected FetchType fetch = FETCH_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getJoinTable() <em>Join Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJoinTable()
+ * @generated
+ * @ordered
+ */
+ protected JoinTable joinTable;
+
+ /**
+ * The cached value of the '{@link #getCascade() <em>Cascade</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCascade()
+ * @generated
+ * @ordered
+ */
+ protected CascadeType cascade;
+
+ /**
+ * The default value of the '{@link #getOptional() <em>Optional</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOptional()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean OPTIONAL_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getOptional() <em>Optional</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOptional()
+ * @generated
+ * @ordered
+ */
+ protected Boolean optional = OPTIONAL_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getJoinColumns() <em>Join Columns</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJoinColumns()
+ * @generated
+ * @ordered
+ */
+ protected EList<JoinColumn> joinColumns;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ManyToOneImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.MANY_TO_ONE_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeMapping_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_ONE_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Target Entity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Target Entity</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Target Entity</em>' attribute.
+ * @see #setTargetEntity(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_TargetEntity()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getTargetEntity()
+ {
+ return targetEntity;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl#getTargetEntity <em>Target Entity</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Target Entity</em>' attribute.
+ * @see #getTargetEntity()
+ * @generated
+ */
+ public void setTargetEntity(String newTargetEntity)
+ {
+ String oldTargetEntity = targetEntity;
+ targetEntity = newTargetEntity;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_ONE_IMPL__TARGET_ENTITY, oldTargetEntity, targetEntity));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Fetch</b></em>' attribute.
+ * The default value is <code>"LAZY"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.FetchType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Fetch</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Fetch</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
+ * @see #setFetch(FetchType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_Fetch()
+ * @model default="LAZY"
+ * @generated
+ */
+ public FetchType getFetch()
+ {
+ return fetch;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl#getFetch <em>Fetch</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Fetch</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
+ * @see #getFetch()
+ * @generated
+ */
+ public void setFetch(FetchType newFetch)
+ {
+ FetchType oldFetch = fetch;
+ fetch = newFetch == null ? FETCH_EDEFAULT : newFetch;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_ONE_IMPL__FETCH, oldFetch, fetch));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Optional</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Optional</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Optional</em>' attribute.
+ * @see #setOptional(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSingleRelationshipMapping_Optional()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getOptional()
+ {
+ return optional;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl#getOptional <em>Optional</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Optional</em>' attribute.
+ * @see #getOptional()
+ * @generated
+ */
+ public void setOptional(Boolean newOptional)
+ {
+ Boolean oldOptional = optional;
+ optional = newOptional;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_ONE_IMPL__OPTIONAL, oldOptional, optional));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Join Columns</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSingleRelationshipMapping_JoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<JoinColumn> getJoinColumns()
+ {
+ if (joinColumns == null)
+ {
+ joinColumns = new EObjectContainmentEList<JoinColumn>(JoinColumn.class, this, OrmPackage.MANY_TO_ONE_IMPL__JOIN_COLUMNS);
+ }
+ return joinColumns;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Join Table</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Join Table</em>' containment reference.
+ * @see #setJoinTable(JoinTable)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_JoinTable()
+ * @model containment="true"
+ * @generated
+ */
+ public JoinTable getJoinTable()
+ {
+ return joinTable;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetJoinTable(JoinTable newJoinTable, NotificationChain msgs)
+ {
+ JoinTable oldJoinTable = joinTable;
+ joinTable = newJoinTable;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_ONE_IMPL__JOIN_TABLE, oldJoinTable, newJoinTable);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl#getJoinTable <em>Join Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Join Table</em>' containment reference.
+ * @see #getJoinTable()
+ * @generated
+ */
+ public void setJoinTable(JoinTable newJoinTable)
+ {
+ if (newJoinTable != joinTable)
+ {
+ NotificationChain msgs = null;
+ if (joinTable != null)
+ msgs = ((InternalEObject)joinTable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MANY_TO_ONE_IMPL__JOIN_TABLE, null, msgs);
+ if (newJoinTable != null)
+ msgs = ((InternalEObject)newJoinTable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MANY_TO_ONE_IMPL__JOIN_TABLE, null, msgs);
+ msgs = basicSetJoinTable(newJoinTable, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_ONE_IMPL__JOIN_TABLE, newJoinTable, newJoinTable));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cascade</em>' containment reference.
+ * @see #setCascade(CascadeType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_Cascade()
+ * @model containment="true"
+ * @generated
+ */
+ public CascadeType getCascade()
+ {
+ return cascade;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetCascade(CascadeType newCascade, NotificationChain msgs)
+ {
+ CascadeType oldCascade = cascade;
+ cascade = newCascade;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_ONE_IMPL__CASCADE, oldCascade, newCascade);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl#getCascade <em>Cascade</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade</em>' containment reference.
+ * @see #getCascade()
+ * @generated
+ */
+ public void setCascade(CascadeType newCascade)
+ {
+ if (newCascade != cascade)
+ {
+ NotificationChain msgs = null;
+ if (cascade != null)
+ msgs = ((InternalEObject)cascade).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MANY_TO_ONE_IMPL__CASCADE, null, msgs);
+ if (newCascade != null)
+ msgs = ((InternalEObject)newCascade).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MANY_TO_ONE_IMPL__CASCADE, null, msgs);
+ msgs = basicSetCascade(newCascade, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MANY_TO_ONE_IMPL__CASCADE, newCascade, newCascade));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MANY_TO_ONE_IMPL__JOIN_TABLE:
+ return basicSetJoinTable(null, msgs);
+ case OrmPackage.MANY_TO_ONE_IMPL__CASCADE:
+ return basicSetCascade(null, msgs);
+ case OrmPackage.MANY_TO_ONE_IMPL__JOIN_COLUMNS:
+ return ((InternalEList<?>)getJoinColumns()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MANY_TO_ONE_IMPL__NAME:
+ return getName();
+ case OrmPackage.MANY_TO_ONE_IMPL__TARGET_ENTITY:
+ return getTargetEntity();
+ case OrmPackage.MANY_TO_ONE_IMPL__FETCH:
+ return getFetch();
+ case OrmPackage.MANY_TO_ONE_IMPL__JOIN_TABLE:
+ return getJoinTable();
+ case OrmPackage.MANY_TO_ONE_IMPL__CASCADE:
+ return getCascade();
+ case OrmPackage.MANY_TO_ONE_IMPL__OPTIONAL:
+ return getOptional();
+ case OrmPackage.MANY_TO_ONE_IMPL__JOIN_COLUMNS:
+ return getJoinColumns();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MANY_TO_ONE_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.MANY_TO_ONE_IMPL__TARGET_ENTITY:
+ setTargetEntity((String)newValue);
+ return;
+ case OrmPackage.MANY_TO_ONE_IMPL__FETCH:
+ setFetch((FetchType)newValue);
+ return;
+ case OrmPackage.MANY_TO_ONE_IMPL__JOIN_TABLE:
+ setJoinTable((JoinTable)newValue);
+ return;
+ case OrmPackage.MANY_TO_ONE_IMPL__CASCADE:
+ setCascade((CascadeType)newValue);
+ return;
+ case OrmPackage.MANY_TO_ONE_IMPL__OPTIONAL:
+ setOptional((Boolean)newValue);
+ return;
+ case OrmPackage.MANY_TO_ONE_IMPL__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ getJoinColumns().addAll((Collection<? extends JoinColumn>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MANY_TO_ONE_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.MANY_TO_ONE_IMPL__TARGET_ENTITY:
+ setTargetEntity(TARGET_ENTITY_EDEFAULT);
+ return;
+ case OrmPackage.MANY_TO_ONE_IMPL__FETCH:
+ setFetch(FETCH_EDEFAULT);
+ return;
+ case OrmPackage.MANY_TO_ONE_IMPL__JOIN_TABLE:
+ setJoinTable((JoinTable)null);
+ return;
+ case OrmPackage.MANY_TO_ONE_IMPL__CASCADE:
+ setCascade((CascadeType)null);
+ return;
+ case OrmPackage.MANY_TO_ONE_IMPL__OPTIONAL:
+ setOptional(OPTIONAL_EDEFAULT);
+ return;
+ case OrmPackage.MANY_TO_ONE_IMPL__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MANY_TO_ONE_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.MANY_TO_ONE_IMPL__TARGET_ENTITY:
+ return TARGET_ENTITY_EDEFAULT == null ? targetEntity != null : !TARGET_ENTITY_EDEFAULT.equals(targetEntity);
+ case OrmPackage.MANY_TO_ONE_IMPL__FETCH:
+ return fetch != FETCH_EDEFAULT;
+ case OrmPackage.MANY_TO_ONE_IMPL__JOIN_TABLE:
+ return joinTable != null;
+ case OrmPackage.MANY_TO_ONE_IMPL__CASCADE:
+ return cascade != null;
+ case OrmPackage.MANY_TO_ONE_IMPL__OPTIONAL:
+ return OPTIONAL_EDEFAULT == null ? optional != null : !OPTIONAL_EDEFAULT.equals(optional);
+ case OrmPackage.MANY_TO_ONE_IMPL__JOIN_COLUMNS:
+ return joinColumns != null && !joinColumns.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", targetEntity: ");
+ result.append(targetEntity);
+ result.append(", fetch: ");
+ result.append(fetch);
+ result.append(", optional: ");
+ result.append(optional);
+ result.append(')');
+ return result.toString();
+ }
+
+} // ManyToOne
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/MapKey.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/MapKey.java
new file mode 100644
index 0000000000..8028d1e090
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/MapKey.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Map Key</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.MapKey#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMapKey()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends IJpaEObject
+ * @generated
+ */
+public interface MapKey extends IJpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMapKey_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.MapKey#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+} // MapKey
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/MapKeyImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/MapKeyImpl.java
new file mode 100644
index 0000000000..c106aad681
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/MapKeyImpl.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Map Key</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMapKeyImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class MapKeyImpl extends JpaEObject implements MapKey
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected MapKeyImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.MAP_KEY_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMapKey_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.MapKeyImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MAP_KEY_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MAP_KEY_IMPL__NAME:
+ return getName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MAP_KEY_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MAP_KEY_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MAP_KEY_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} // MapKey
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/MappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/MappedSuperclass.java
new file mode 100644
index 0000000000..3ef74c5d21
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/MappedSuperclass.java
@@ -0,0 +1,1034 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Mapped Superclass</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getIdClass <em>Id Class</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#isExcludeDefaultListeners <em>Exclude Default Listeners</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#isExcludeSuperclassListeners <em>Exclude Superclass Listeners</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getEntityListeners <em>Entity Listeners</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPrePersist <em>Pre Persist</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPostPersist <em>Post Persist</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPreRemove <em>Pre Remove</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPostRemove <em>Post Remove</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPreUpdate <em>Pre Update</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPostUpdate <em>Post Update</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPostLoad <em>Post Load</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMappedSuperclass()
+ * @model kind="class"
+ * @generated
+ */
+public class MappedSuperclass extends TypeMapping
+{
+ /**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final AccessType ACCESS_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getIdClass() <em>Id Class</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getIdClass()
+ * @generated
+ * @ordered
+ */
+ protected IdClass idClass;
+
+ /**
+ * The default value of the '{@link #isExcludeDefaultListeners() <em>Exclude Default Listeners</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isExcludeDefaultListeners()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean EXCLUDE_DEFAULT_LISTENERS_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isExcludeDefaultListeners() <em>Exclude Default Listeners</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isExcludeDefaultListeners()
+ * @generated
+ * @ordered
+ */
+ protected boolean excludeDefaultListeners = EXCLUDE_DEFAULT_LISTENERS_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #isExcludeSuperclassListeners() <em>Exclude Superclass Listeners</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isExcludeSuperclassListeners()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean EXCLUDE_SUPERCLASS_LISTENERS_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isExcludeSuperclassListeners() <em>Exclude Superclass Listeners</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isExcludeSuperclassListeners()
+ * @generated
+ * @ordered
+ */
+ protected boolean excludeSuperclassListeners = EXCLUDE_SUPERCLASS_LISTENERS_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getEntityListeners() <em>Entity Listeners</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEntityListeners()
+ * @generated
+ * @ordered
+ */
+ protected EntityListeners entityListeners;
+
+ /**
+ * The cached value of the '{@link #getPrePersist() <em>Pre Persist</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPrePersist()
+ * @generated
+ * @ordered
+ */
+ protected PrePersist prePersist;
+
+ /**
+ * The cached value of the '{@link #getPostPersist() <em>Post Persist</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPostPersist()
+ * @generated
+ * @ordered
+ */
+ protected PostPersist postPersist;
+
+ /**
+ * The cached value of the '{@link #getPreRemove() <em>Pre Remove</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPreRemove()
+ * @generated
+ * @ordered
+ */
+ protected PreRemove preRemove;
+
+ /**
+ * The cached value of the '{@link #getPostRemove() <em>Post Remove</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPostRemove()
+ * @generated
+ * @ordered
+ */
+ protected PostRemove postRemove;
+
+ /**
+ * The cached value of the '{@link #getPreUpdate() <em>Pre Update</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPreUpdate()
+ * @generated
+ * @ordered
+ */
+ protected PreUpdate preUpdate;
+
+ /**
+ * The cached value of the '{@link #getPostUpdate() <em>Post Update</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPostUpdate()
+ * @generated
+ * @ordered
+ */
+ protected PostUpdate postUpdate;
+
+ /**
+ * The cached value of the '{@link #getPostLoad() <em>Post Load</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPostLoad()
+ * @generated
+ * @ordered
+ */
+ protected PostLoad postLoad;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected MappedSuperclass()
+ {
+ super();
+ }
+
+ public EntityMappings entityMappings() {
+ return (EntityMappings) eContainer();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.MAPPED_SUPERCLASS;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Id Class</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Id Class</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Id Class</em>' containment reference.
+ * @see #setIdClass(IdClass)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMappedSuperclass_IdClass()
+ * @model containment="true"
+ * @generated
+ */
+ public IdClass getIdClass()
+ {
+ return idClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetIdClass(IdClass newIdClass, NotificationChain msgs)
+ {
+ IdClass oldIdClass = idClass;
+ idClass = newIdClass;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__ID_CLASS, oldIdClass, newIdClass);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getIdClass <em>Id Class</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Id Class</em>' containment reference.
+ * @see #getIdClass()
+ * @generated
+ */
+ public void setIdClass(IdClass newIdClass)
+ {
+ if (newIdClass != idClass)
+ {
+ NotificationChain msgs = null;
+ if (idClass != null)
+ msgs = ((InternalEObject)idClass).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__ID_CLASS, null, msgs);
+ if (newIdClass != null)
+ msgs = ((InternalEObject)newIdClass).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__ID_CLASS, null, msgs);
+ msgs = basicSetIdClass(newIdClass, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__ID_CLASS, newIdClass, newIdClass));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Exclude Default Listeners</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Exclude Default Listeners</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Exclude Default Listeners</em>' attribute.
+ * @see #setExcludeDefaultListeners(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMappedSuperclass_ExcludeDefaultListeners()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ public boolean isExcludeDefaultListeners()
+ {
+ return excludeDefaultListeners;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#isExcludeDefaultListeners <em>Exclude Default Listeners</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Exclude Default Listeners</em>' attribute.
+ * @see #isExcludeDefaultListeners()
+ * @generated
+ */
+ public void setExcludeDefaultListeners(boolean newExcludeDefaultListeners)
+ {
+ boolean oldExcludeDefaultListeners = excludeDefaultListeners;
+ excludeDefaultListeners = newExcludeDefaultListeners;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__EXCLUDE_DEFAULT_LISTENERS, oldExcludeDefaultListeners, excludeDefaultListeners));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Exclude Superclass Listeners</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Exclude Superclass Listeners</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Exclude Superclass Listeners</em>' attribute.
+ * @see #setExcludeSuperclassListeners(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMappedSuperclass_ExcludeSuperclassListeners()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ public boolean isExcludeSuperclassListeners()
+ {
+ return excludeSuperclassListeners;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#isExcludeSuperclassListeners <em>Exclude Superclass Listeners</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Exclude Superclass Listeners</em>' attribute.
+ * @see #isExcludeSuperclassListeners()
+ * @generated
+ */
+ public void setExcludeSuperclassListeners(boolean newExcludeSuperclassListeners)
+ {
+ boolean oldExcludeSuperclassListeners = excludeSuperclassListeners;
+ excludeSuperclassListeners = newExcludeSuperclassListeners;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__EXCLUDE_SUPERCLASS_LISTENERS, oldExcludeSuperclassListeners, excludeSuperclassListeners));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Entity Listeners</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Entity Listeners</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Entity Listeners</em>' containment reference.
+ * @see #setEntityListeners(EntityListeners)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMappedSuperclass_EntityListeners()
+ * @model containment="true"
+ * @generated
+ */
+ public EntityListeners getEntityListeners()
+ {
+ return entityListeners;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetEntityListeners(EntityListeners newEntityListeners, NotificationChain msgs)
+ {
+ EntityListeners oldEntityListeners = entityListeners;
+ entityListeners = newEntityListeners;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__ENTITY_LISTENERS, oldEntityListeners, newEntityListeners);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getEntityListeners <em>Entity Listeners</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Entity Listeners</em>' containment reference.
+ * @see #getEntityListeners()
+ * @generated
+ */
+ public void setEntityListeners(EntityListeners newEntityListeners)
+ {
+ if (newEntityListeners != entityListeners)
+ {
+ NotificationChain msgs = null;
+ if (entityListeners != null)
+ msgs = ((InternalEObject)entityListeners).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__ENTITY_LISTENERS, null, msgs);
+ if (newEntityListeners != null)
+ msgs = ((InternalEObject)newEntityListeners).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__ENTITY_LISTENERS, null, msgs);
+ msgs = basicSetEntityListeners(newEntityListeners, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__ENTITY_LISTENERS, newEntityListeners, newEntityListeners));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Pre Persist</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Pre Persist</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Pre Persist</em>' containment reference.
+ * @see #setPrePersist(PrePersist)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMappedSuperclass_PrePersist()
+ * @model containment="true"
+ * @generated
+ */
+ public PrePersist getPrePersist()
+ {
+ return prePersist;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPrePersist(PrePersist newPrePersist, NotificationChain msgs)
+ {
+ PrePersist oldPrePersist = prePersist;
+ prePersist = newPrePersist;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__PRE_PERSIST, oldPrePersist, newPrePersist);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPrePersist <em>Pre Persist</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Pre Persist</em>' containment reference.
+ * @see #getPrePersist()
+ * @generated
+ */
+ public void setPrePersist(PrePersist newPrePersist)
+ {
+ if (newPrePersist != prePersist)
+ {
+ NotificationChain msgs = null;
+ if (prePersist != null)
+ msgs = ((InternalEObject)prePersist).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__PRE_PERSIST, null, msgs);
+ if (newPrePersist != null)
+ msgs = ((InternalEObject)newPrePersist).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__PRE_PERSIST, null, msgs);
+ msgs = basicSetPrePersist(newPrePersist, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__PRE_PERSIST, newPrePersist, newPrePersist));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Post Persist</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Post Persist</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Post Persist</em>' containment reference.
+ * @see #setPostPersist(PostPersist)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMappedSuperclass_PostPersist()
+ * @model containment="true"
+ * @generated
+ */
+ public PostPersist getPostPersist()
+ {
+ return postPersist;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPostPersist(PostPersist newPostPersist, NotificationChain msgs)
+ {
+ PostPersist oldPostPersist = postPersist;
+ postPersist = newPostPersist;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__POST_PERSIST, oldPostPersist, newPostPersist);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPostPersist <em>Post Persist</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Post Persist</em>' containment reference.
+ * @see #getPostPersist()
+ * @generated
+ */
+ public void setPostPersist(PostPersist newPostPersist)
+ {
+ if (newPostPersist != postPersist)
+ {
+ NotificationChain msgs = null;
+ if (postPersist != null)
+ msgs = ((InternalEObject)postPersist).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__POST_PERSIST, null, msgs);
+ if (newPostPersist != null)
+ msgs = ((InternalEObject)newPostPersist).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__POST_PERSIST, null, msgs);
+ msgs = basicSetPostPersist(newPostPersist, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__POST_PERSIST, newPostPersist, newPostPersist));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Pre Remove</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Pre Remove</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Pre Remove</em>' containment reference.
+ * @see #setPreRemove(PreRemove)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMappedSuperclass_PreRemove()
+ * @model containment="true"
+ * @generated
+ */
+ public PreRemove getPreRemove()
+ {
+ return preRemove;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPreRemove(PreRemove newPreRemove, NotificationChain msgs)
+ {
+ PreRemove oldPreRemove = preRemove;
+ preRemove = newPreRemove;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__PRE_REMOVE, oldPreRemove, newPreRemove);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPreRemove <em>Pre Remove</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Pre Remove</em>' containment reference.
+ * @see #getPreRemove()
+ * @generated
+ */
+ public void setPreRemove(PreRemove newPreRemove)
+ {
+ if (newPreRemove != preRemove)
+ {
+ NotificationChain msgs = null;
+ if (preRemove != null)
+ msgs = ((InternalEObject)preRemove).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__PRE_REMOVE, null, msgs);
+ if (newPreRemove != null)
+ msgs = ((InternalEObject)newPreRemove).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__PRE_REMOVE, null, msgs);
+ msgs = basicSetPreRemove(newPreRemove, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__PRE_REMOVE, newPreRemove, newPreRemove));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Post Remove</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Post Remove</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Post Remove</em>' containment reference.
+ * @see #setPostRemove(PostRemove)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMappedSuperclass_PostRemove()
+ * @model containment="true"
+ * @generated
+ */
+ public PostRemove getPostRemove()
+ {
+ return postRemove;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPostRemove(PostRemove newPostRemove, NotificationChain msgs)
+ {
+ PostRemove oldPostRemove = postRemove;
+ postRemove = newPostRemove;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__POST_REMOVE, oldPostRemove, newPostRemove);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPostRemove <em>Post Remove</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Post Remove</em>' containment reference.
+ * @see #getPostRemove()
+ * @generated
+ */
+ public void setPostRemove(PostRemove newPostRemove)
+ {
+ if (newPostRemove != postRemove)
+ {
+ NotificationChain msgs = null;
+ if (postRemove != null)
+ msgs = ((InternalEObject)postRemove).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__POST_REMOVE, null, msgs);
+ if (newPostRemove != null)
+ msgs = ((InternalEObject)newPostRemove).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__POST_REMOVE, null, msgs);
+ msgs = basicSetPostRemove(newPostRemove, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__POST_REMOVE, newPostRemove, newPostRemove));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Pre Update</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Pre Update</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Pre Update</em>' containment reference.
+ * @see #setPreUpdate(PreUpdate)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMappedSuperclass_PreUpdate()
+ * @model containment="true"
+ * @generated
+ */
+ public PreUpdate getPreUpdate()
+ {
+ return preUpdate;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPreUpdate(PreUpdate newPreUpdate, NotificationChain msgs)
+ {
+ PreUpdate oldPreUpdate = preUpdate;
+ preUpdate = newPreUpdate;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__PRE_UPDATE, oldPreUpdate, newPreUpdate);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPreUpdate <em>Pre Update</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Pre Update</em>' containment reference.
+ * @see #getPreUpdate()
+ * @generated
+ */
+ public void setPreUpdate(PreUpdate newPreUpdate)
+ {
+ if (newPreUpdate != preUpdate)
+ {
+ NotificationChain msgs = null;
+ if (preUpdate != null)
+ msgs = ((InternalEObject)preUpdate).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__PRE_UPDATE, null, msgs);
+ if (newPreUpdate != null)
+ msgs = ((InternalEObject)newPreUpdate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__PRE_UPDATE, null, msgs);
+ msgs = basicSetPreUpdate(newPreUpdate, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__PRE_UPDATE, newPreUpdate, newPreUpdate));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Post Update</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Post Update</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Post Update</em>' containment reference.
+ * @see #setPostUpdate(PostUpdate)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMappedSuperclass_PostUpdate()
+ * @model containment="true"
+ * @generated
+ */
+ public PostUpdate getPostUpdate()
+ {
+ return postUpdate;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPostUpdate(PostUpdate newPostUpdate, NotificationChain msgs)
+ {
+ PostUpdate oldPostUpdate = postUpdate;
+ postUpdate = newPostUpdate;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__POST_UPDATE, oldPostUpdate, newPostUpdate);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPostUpdate <em>Post Update</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Post Update</em>' containment reference.
+ * @see #getPostUpdate()
+ * @generated
+ */
+ public void setPostUpdate(PostUpdate newPostUpdate)
+ {
+ if (newPostUpdate != postUpdate)
+ {
+ NotificationChain msgs = null;
+ if (postUpdate != null)
+ msgs = ((InternalEObject)postUpdate).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__POST_UPDATE, null, msgs);
+ if (newPostUpdate != null)
+ msgs = ((InternalEObject)newPostUpdate).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__POST_UPDATE, null, msgs);
+ msgs = basicSetPostUpdate(newPostUpdate, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__POST_UPDATE, newPostUpdate, newPostUpdate));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Post Load</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Post Load</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Post Load</em>' containment reference.
+ * @see #setPostLoad(PostLoad)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMappedSuperclass_PostLoad()
+ * @model containment="true"
+ * @generated
+ */
+ public PostLoad getPostLoad()
+ {
+ return postLoad;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPostLoad(PostLoad newPostLoad, NotificationChain msgs)
+ {
+ PostLoad oldPostLoad = postLoad;
+ postLoad = newPostLoad;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__POST_LOAD, oldPostLoad, newPostLoad);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPostLoad <em>Post Load</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Post Load</em>' containment reference.
+ * @see #getPostLoad()
+ * @generated
+ */
+ public void setPostLoad(PostLoad newPostLoad)
+ {
+ if (newPostLoad != postLoad)
+ {
+ NotificationChain msgs = null;
+ if (postLoad != null)
+ msgs = ((InternalEObject)postLoad).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__POST_LOAD, null, msgs);
+ if (newPostLoad != null)
+ msgs = ((InternalEObject)newPostLoad).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.MAPPED_SUPERCLASS__POST_LOAD, null, msgs);
+ msgs = basicSetPostLoad(newPostLoad, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.MAPPED_SUPERCLASS__POST_LOAD, newPostLoad, newPostLoad));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MAPPED_SUPERCLASS__ID_CLASS:
+ return basicSetIdClass(null, msgs);
+ case OrmPackage.MAPPED_SUPERCLASS__ENTITY_LISTENERS:
+ return basicSetEntityListeners(null, msgs);
+ case OrmPackage.MAPPED_SUPERCLASS__PRE_PERSIST:
+ return basicSetPrePersist(null, msgs);
+ case OrmPackage.MAPPED_SUPERCLASS__POST_PERSIST:
+ return basicSetPostPersist(null, msgs);
+ case OrmPackage.MAPPED_SUPERCLASS__PRE_REMOVE:
+ return basicSetPreRemove(null, msgs);
+ case OrmPackage.MAPPED_SUPERCLASS__POST_REMOVE:
+ return basicSetPostRemove(null, msgs);
+ case OrmPackage.MAPPED_SUPERCLASS__PRE_UPDATE:
+ return basicSetPreUpdate(null, msgs);
+ case OrmPackage.MAPPED_SUPERCLASS__POST_UPDATE:
+ return basicSetPostUpdate(null, msgs);
+ case OrmPackage.MAPPED_SUPERCLASS__POST_LOAD:
+ return basicSetPostLoad(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MAPPED_SUPERCLASS__ID_CLASS:
+ return getIdClass();
+ case OrmPackage.MAPPED_SUPERCLASS__EXCLUDE_DEFAULT_LISTENERS:
+ return isExcludeDefaultListeners() ? Boolean.TRUE : Boolean.FALSE;
+ case OrmPackage.MAPPED_SUPERCLASS__EXCLUDE_SUPERCLASS_LISTENERS:
+ return isExcludeSuperclassListeners() ? Boolean.TRUE : Boolean.FALSE;
+ case OrmPackage.MAPPED_SUPERCLASS__ENTITY_LISTENERS:
+ return getEntityListeners();
+ case OrmPackage.MAPPED_SUPERCLASS__PRE_PERSIST:
+ return getPrePersist();
+ case OrmPackage.MAPPED_SUPERCLASS__POST_PERSIST:
+ return getPostPersist();
+ case OrmPackage.MAPPED_SUPERCLASS__PRE_REMOVE:
+ return getPreRemove();
+ case OrmPackage.MAPPED_SUPERCLASS__POST_REMOVE:
+ return getPostRemove();
+ case OrmPackage.MAPPED_SUPERCLASS__PRE_UPDATE:
+ return getPreUpdate();
+ case OrmPackage.MAPPED_SUPERCLASS__POST_UPDATE:
+ return getPostUpdate();
+ case OrmPackage.MAPPED_SUPERCLASS__POST_LOAD:
+ return getPostLoad();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MAPPED_SUPERCLASS__ID_CLASS:
+ setIdClass((IdClass)newValue);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__EXCLUDE_DEFAULT_LISTENERS:
+ setExcludeDefaultListeners(((Boolean)newValue).booleanValue());
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__EXCLUDE_SUPERCLASS_LISTENERS:
+ setExcludeSuperclassListeners(((Boolean)newValue).booleanValue());
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__ENTITY_LISTENERS:
+ setEntityListeners((EntityListeners)newValue);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__PRE_PERSIST:
+ setPrePersist((PrePersist)newValue);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__POST_PERSIST:
+ setPostPersist((PostPersist)newValue);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__PRE_REMOVE:
+ setPreRemove((PreRemove)newValue);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__POST_REMOVE:
+ setPostRemove((PostRemove)newValue);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__PRE_UPDATE:
+ setPreUpdate((PreUpdate)newValue);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__POST_UPDATE:
+ setPostUpdate((PostUpdate)newValue);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__POST_LOAD:
+ setPostLoad((PostLoad)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MAPPED_SUPERCLASS__ID_CLASS:
+ setIdClass((IdClass)null);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__EXCLUDE_DEFAULT_LISTENERS:
+ setExcludeDefaultListeners(EXCLUDE_DEFAULT_LISTENERS_EDEFAULT);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__EXCLUDE_SUPERCLASS_LISTENERS:
+ setExcludeSuperclassListeners(EXCLUDE_SUPERCLASS_LISTENERS_EDEFAULT);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__ENTITY_LISTENERS:
+ setEntityListeners((EntityListeners)null);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__PRE_PERSIST:
+ setPrePersist((PrePersist)null);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__POST_PERSIST:
+ setPostPersist((PostPersist)null);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__PRE_REMOVE:
+ setPreRemove((PreRemove)null);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__POST_REMOVE:
+ setPostRemove((PostRemove)null);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__PRE_UPDATE:
+ setPreUpdate((PreUpdate)null);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__POST_UPDATE:
+ setPostUpdate((PostUpdate)null);
+ return;
+ case OrmPackage.MAPPED_SUPERCLASS__POST_LOAD:
+ setPostLoad((PostLoad)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.MAPPED_SUPERCLASS__ID_CLASS:
+ return idClass != null;
+ case OrmPackage.MAPPED_SUPERCLASS__EXCLUDE_DEFAULT_LISTENERS:
+ return excludeDefaultListeners != EXCLUDE_DEFAULT_LISTENERS_EDEFAULT;
+ case OrmPackage.MAPPED_SUPERCLASS__EXCLUDE_SUPERCLASS_LISTENERS:
+ return excludeSuperclassListeners != EXCLUDE_SUPERCLASS_LISTENERS_EDEFAULT;
+ case OrmPackage.MAPPED_SUPERCLASS__ENTITY_LISTENERS:
+ return entityListeners != null;
+ case OrmPackage.MAPPED_SUPERCLASS__PRE_PERSIST:
+ return prePersist != null;
+ case OrmPackage.MAPPED_SUPERCLASS__POST_PERSIST:
+ return postPersist != null;
+ case OrmPackage.MAPPED_SUPERCLASS__PRE_REMOVE:
+ return preRemove != null;
+ case OrmPackage.MAPPED_SUPERCLASS__POST_REMOVE:
+ return postRemove != null;
+ case OrmPackage.MAPPED_SUPERCLASS__PRE_UPDATE:
+ return preUpdate != null;
+ case OrmPackage.MAPPED_SUPERCLASS__POST_UPDATE:
+ return postUpdate != null;
+ case OrmPackage.MAPPED_SUPERCLASS__POST_LOAD:
+ return postLoad != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (excludeDefaultListeners: ");
+ result.append(excludeDefaultListeners);
+ result.append(", excludeSuperclassListeners: ");
+ result.append(excludeSuperclassListeners);
+ result.append(')');
+ return result.toString();
+ }
+
+} // MappedSuperclass
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/MultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/MultiRelationshipMapping.java
new file mode 100644
index 0000000000..d367a2fb98
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/MultiRelationshipMapping.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Multi Relationship Mapping</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping#getMappedBy <em>Mapped By</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping#getOrderBy <em>Order By</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping#getMapKey <em>Map Key</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMultiRelationshipMapping()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface MultiRelationshipMapping extends RelationshipMapping
+{
+ /**
+ * Returns the value of the '<em><b>Order By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Order By</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Order By</em>' attribute.
+ * @see #setOrderBy(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMultiRelationshipMapping_OrderBy()
+ * @model dataType="org.eclipse.jpt.core.internal.resource.orm.OrderBy"
+ * @generated
+ */
+ String getOrderBy();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping#getOrderBy <em>Order By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Order By</em>' attribute.
+ * @see #getOrderBy()
+ * @generated
+ */
+ void setOrderBy(String value);
+
+ /**
+ * Returns the value of the '<em><b>Map Key</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Map Key</em>' containment reference.
+ * @see #setMapKey(MapKey)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMultiRelationshipMapping_MapKey()
+ * @model containment="true"
+ * @generated
+ */
+ MapKey getMapKey();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping#getMapKey <em>Map Key</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key</em>' containment reference.
+ * @see #getMapKey()
+ * @generated
+ */
+ void setMapKey(MapKey value);
+
+ /**
+ * Returns the value of the '<em><b>Mapped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Mapped By</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Mapped By</em>' attribute.
+ * @see #setMappedBy(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMultiRelationshipMapping_MappedBy()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getMappedBy();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping#getMappedBy <em>Mapped By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Mapped By</em>' attribute.
+ * @see #getMappedBy()
+ * @generated
+ */
+ void setMappedBy(String value);
+
+} // MultiRelationshipMapping
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/NamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/NamedColumn.java
new file mode 100644
index 0000000000..0f6e8e1fa3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/NamedColumn.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Named Column</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.NamedColumn#getColumnDefinition <em>Column Definition</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.NamedColumn#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedColumn()
+ * @model kind="class" interface="true" abstract="true"
+ * @extends IJpaEObject
+ * @generated
+ */
+public interface NamedColumn extends IJpaEObject
+{
+ /**
+ * Returns the value of the '<em><b>Column Definition</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Column Definition</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Column Definition</em>' attribute.
+ * @see #setColumnDefinition(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedColumn_ColumnDefinition()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getColumnDefinition();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.NamedColumn#getColumnDefinition <em>Column Definition</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Column Definition</em>' attribute.
+ * @see #getColumnDefinition()
+ * @generated
+ */
+ void setColumnDefinition(String value);
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedColumn_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.NamedColumn#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+} // NamedColumn
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/NamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/NamedNativeQuery.java
new file mode 100644
index 0000000000..3d90888339
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/NamedNativeQuery.java
@@ -0,0 +1,464 @@
+/**
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Named Native Query</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery#getResultClass <em>Result Class</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery#getResultSetMapping <em>Result Set Mapping</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedNativeQuery()
+ * @model kind="class"
+ * @generated
+ */
+public class NamedNativeQuery extends JpaEObject implements Query
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getQuery() <em>Query</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getQuery()
+ * @generated
+ * @ordered
+ */
+ protected static final String QUERY_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getQuery() <em>Query</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getQuery()
+ * @generated
+ * @ordered
+ */
+ protected String query = QUERY_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getHints() <em>Hints</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getHints()
+ * @generated
+ * @ordered
+ */
+ protected EList<QueryHint> hints;
+
+ /**
+ * The default value of the '{@link #getResultClass() <em>Result Class</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getResultClass()
+ * @generated
+ * @ordered
+ */
+ protected static final String RESULT_CLASS_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getResultClass() <em>Result Class</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getResultClass()
+ * @generated
+ * @ordered
+ */
+ protected String resultClass = RESULT_CLASS_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getResultSetMapping() <em>Result Set Mapping</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getResultSetMapping()
+ * @generated
+ * @ordered
+ */
+ protected static final String RESULT_SET_MAPPING_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getResultSetMapping() <em>Result Set Mapping</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getResultSetMapping()
+ * @generated
+ * @ordered
+ */
+ protected String resultSetMapping = RESULT_SET_MAPPING_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected NamedNativeQuery()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.NAMED_NATIVE_QUERY;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQuery_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.NAMED_NATIVE_QUERY__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Result Class</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Result Class</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Result Class</em>' attribute.
+ * @see #setResultClass(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedNativeQuery_ResultClass()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getResultClass()
+ {
+ return resultClass;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery#getResultClass <em>Result Class</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Result Class</em>' attribute.
+ * @see #getResultClass()
+ * @generated
+ */
+ public void setResultClass(String newResultClass)
+ {
+ String oldResultClass = resultClass;
+ resultClass = newResultClass;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.NAMED_NATIVE_QUERY__RESULT_CLASS, oldResultClass, resultClass));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Result Set Mapping</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Result Set Mapping</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Result Set Mapping</em>' attribute.
+ * @see #setResultSetMapping(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedNativeQuery_ResultSetMapping()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getResultSetMapping()
+ {
+ return resultSetMapping;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery#getResultSetMapping <em>Result Set Mapping</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Result Set Mapping</em>' attribute.
+ * @see #getResultSetMapping()
+ * @generated
+ */
+ public void setResultSetMapping(String newResultSetMapping)
+ {
+ String oldResultSetMapping = resultSetMapping;
+ resultSetMapping = newResultSetMapping;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.NAMED_NATIVE_QUERY__RESULT_SET_MAPPING, oldResultSetMapping, resultSetMapping));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Query</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Query</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Query</em>' attribute.
+ * @see #setQuery(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQuery_Query()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getQuery()
+ {
+ return query;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery#getQuery <em>Query</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Query</em>' attribute.
+ * @see #getQuery()
+ * @generated
+ */
+ public void setQuery(String newQuery)
+ {
+ String oldQuery = query;
+ query = newQuery;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.NAMED_NATIVE_QUERY__QUERY, oldQuery, query));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Hints</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.QueryHint}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Hints</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Hints</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQuery_Hints()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<QueryHint> getHints()
+ {
+ if (hints == null)
+ {
+ hints = new EObjectContainmentEList<QueryHint>(QueryHint.class, this, OrmPackage.NAMED_NATIVE_QUERY__HINTS);
+ }
+ return hints;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.NAMED_NATIVE_QUERY__HINTS:
+ return ((InternalEList<?>)getHints()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.NAMED_NATIVE_QUERY__NAME:
+ return getName();
+ case OrmPackage.NAMED_NATIVE_QUERY__QUERY:
+ return getQuery();
+ case OrmPackage.NAMED_NATIVE_QUERY__HINTS:
+ return getHints();
+ case OrmPackage.NAMED_NATIVE_QUERY__RESULT_CLASS:
+ return getResultClass();
+ case OrmPackage.NAMED_NATIVE_QUERY__RESULT_SET_MAPPING:
+ return getResultSetMapping();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.NAMED_NATIVE_QUERY__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.NAMED_NATIVE_QUERY__QUERY:
+ setQuery((String)newValue);
+ return;
+ case OrmPackage.NAMED_NATIVE_QUERY__HINTS:
+ getHints().clear();
+ getHints().addAll((Collection<? extends QueryHint>)newValue);
+ return;
+ case OrmPackage.NAMED_NATIVE_QUERY__RESULT_CLASS:
+ setResultClass((String)newValue);
+ return;
+ case OrmPackage.NAMED_NATIVE_QUERY__RESULT_SET_MAPPING:
+ setResultSetMapping((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.NAMED_NATIVE_QUERY__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.NAMED_NATIVE_QUERY__QUERY:
+ setQuery(QUERY_EDEFAULT);
+ return;
+ case OrmPackage.NAMED_NATIVE_QUERY__HINTS:
+ getHints().clear();
+ return;
+ case OrmPackage.NAMED_NATIVE_QUERY__RESULT_CLASS:
+ setResultClass(RESULT_CLASS_EDEFAULT);
+ return;
+ case OrmPackage.NAMED_NATIVE_QUERY__RESULT_SET_MAPPING:
+ setResultSetMapping(RESULT_SET_MAPPING_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.NAMED_NATIVE_QUERY__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.NAMED_NATIVE_QUERY__QUERY:
+ return QUERY_EDEFAULT == null ? query != null : !QUERY_EDEFAULT.equals(query);
+ case OrmPackage.NAMED_NATIVE_QUERY__HINTS:
+ return hints != null && !hints.isEmpty();
+ case OrmPackage.NAMED_NATIVE_QUERY__RESULT_CLASS:
+ return RESULT_CLASS_EDEFAULT == null ? resultClass != null : !RESULT_CLASS_EDEFAULT.equals(resultClass);
+ case OrmPackage.NAMED_NATIVE_QUERY__RESULT_SET_MAPPING:
+ return RESULT_SET_MAPPING_EDEFAULT == null ? resultSetMapping != null : !RESULT_SET_MAPPING_EDEFAULT.equals(resultSetMapping);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", query: ");
+ result.append(query);
+ result.append(", resultClass: ");
+ result.append(resultClass);
+ result.append(", resultSetMapping: ");
+ result.append(resultSetMapping);
+ result.append(')');
+ return result.toString();
+ }
+
+} // NamedNativeQuery
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/AbstractXmlQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/NamedQuery.java
index 7b7e7b6b82..5a99792c69 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/AbstractXmlQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/NamedQuery.java
@@ -7,7 +7,7 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.resource.orm;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
@@ -18,22 +18,19 @@ import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.mappings.IQuery;
-import org.eclipse.jpt.core.internal.mappings.IQueryHint;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
/**
* <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Abstract Xml Query</b></em>'.
+ * A representation of the model object '<em><b>Named Query</b></em>'.
* <!-- end-user-doc -->
*
*
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getAbstractXmlQuery()
- * @model kind="class" abstract="true"
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedQuery()
+ * @model kind="class"
* @generated
*/
-public abstract class AbstractXmlQuery extends XmlEObject implements IQuery
+public class NamedQuery extends JpaEObject implements Query
{
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
@@ -83,14 +80,15 @@ public abstract class AbstractXmlQuery extends XmlEObject implements IQuery
* @generated
* @ordered
*/
- protected EList<IQueryHint> hints;
+ protected EList<QueryHint> hints;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- protected AbstractXmlQuery() {
+ protected NamedQuery()
+ {
super();
}
@@ -100,8 +98,9 @@ public abstract class AbstractXmlQuery extends XmlEObject implements IQuery
* @generated
*/
@Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.ABSTRACT_XML_QUERY;
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.NAMED_QUERY;
}
/**
@@ -114,27 +113,29 @@ public abstract class AbstractXmlQuery extends XmlEObject implements IQuery
* <!-- end-user-doc -->
* @return the value of the '<em>Name</em>' attribute.
* @see #setName(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIQuery_Name()
- * @model
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQuery_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
* @generated
*/
- public String getName() {
+ public String getName()
+ {
return name;
}
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlQuery#getName <em>Name</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.NamedQuery#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
* @see #getName()
* @generated
*/
- public void setName(String newName) {
+ public void setName(String newName)
+ {
String oldName = name;
name = newName;
if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_QUERY__NAME, oldName, name));
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.NAMED_QUERY__NAME, oldName, name));
}
/**
@@ -147,32 +148,34 @@ public abstract class AbstractXmlQuery extends XmlEObject implements IQuery
* <!-- end-user-doc -->
* @return the value of the '<em>Query</em>' attribute.
* @see #setQuery(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIQuery_Query()
- * @model
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQuery_Query()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
* @generated
*/
- public String getQuery() {
+ public String getQuery()
+ {
return query;
}
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.AbstractXmlQuery#getQuery <em>Query</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.NamedQuery#getQuery <em>Query</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Query</em>' attribute.
* @see #getQuery()
* @generated
*/
- public void setQuery(String newQuery) {
+ public void setQuery(String newQuery)
+ {
String oldQuery = query;
query = newQuery;
if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ABSTRACT_XML_QUERY__QUERY, oldQuery, query));
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.NAMED_QUERY__QUERY, oldQuery, query));
}
/**
* Returns the value of the '<em><b>Hints</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IQueryHint}.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.QueryHint}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Hints</em>' containment reference list isn't clear,
@@ -180,13 +183,15 @@ public abstract class AbstractXmlQuery extends XmlEObject implements IQuery
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Hints</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIQuery_Hints()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQuery_Hints()
* @model containment="true"
* @generated
*/
- public EList<IQueryHint> getHints() {
- if (hints == null) {
- hints = new EObjectContainmentEList<IQueryHint>(IQueryHint.class, this, OrmPackage.ABSTRACT_XML_QUERY__HINTS);
+ public EList<QueryHint> getHints()
+ {
+ if (hints == null)
+ {
+ hints = new EObjectContainmentEList<QueryHint>(QueryHint.class, this, OrmPackage.NAMED_QUERY__HINTS);
}
return hints;
}
@@ -197,10 +202,12 @@ public abstract class AbstractXmlQuery extends XmlEObject implements IQuery
* @generated
*/
@Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_QUERY__HINTS :
- return ((InternalEList<?>) getHints()).basicRemove(otherEnd, msgs);
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.NAMED_QUERY__HINTS:
+ return ((InternalEList<?>)getHints()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
@@ -211,13 +218,15 @@ public abstract class AbstractXmlQuery extends XmlEObject implements IQuery
* @generated
*/
@Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_QUERY__NAME :
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.NAMED_QUERY__NAME:
return getName();
- case OrmPackage.ABSTRACT_XML_QUERY__QUERY :
+ case OrmPackage.NAMED_QUERY__QUERY:
return getQuery();
- case OrmPackage.ABSTRACT_XML_QUERY__HINTS :
+ case OrmPackage.NAMED_QUERY__HINTS:
return getHints();
}
return super.eGet(featureID, resolve, coreType);
@@ -230,17 +239,19 @@ public abstract class AbstractXmlQuery extends XmlEObject implements IQuery
*/
@SuppressWarnings("unchecked")
@Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_QUERY__NAME :
- setName((String) newValue);
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.NAMED_QUERY__NAME:
+ setName((String)newValue);
return;
- case OrmPackage.ABSTRACT_XML_QUERY__QUERY :
- setQuery((String) newValue);
+ case OrmPackage.NAMED_QUERY__QUERY:
+ setQuery((String)newValue);
return;
- case OrmPackage.ABSTRACT_XML_QUERY__HINTS :
+ case OrmPackage.NAMED_QUERY__HINTS:
getHints().clear();
- getHints().addAll((Collection<? extends IQueryHint>) newValue);
+ getHints().addAll((Collection<? extends QueryHint>)newValue);
return;
}
super.eSet(featureID, newValue);
@@ -252,15 +263,17 @@ public abstract class AbstractXmlQuery extends XmlEObject implements IQuery
* @generated
*/
@Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_QUERY__NAME :
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.NAMED_QUERY__NAME:
setName(NAME_EDEFAULT);
return;
- case OrmPackage.ABSTRACT_XML_QUERY__QUERY :
+ case OrmPackage.NAMED_QUERY__QUERY:
setQuery(QUERY_EDEFAULT);
return;
- case OrmPackage.ABSTRACT_XML_QUERY__HINTS :
+ case OrmPackage.NAMED_QUERY__HINTS:
getHints().clear();
return;
}
@@ -273,13 +286,15 @@ public abstract class AbstractXmlQuery extends XmlEObject implements IQuery
* @generated
*/
@Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.ABSTRACT_XML_QUERY__NAME :
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.NAMED_QUERY__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
- case OrmPackage.ABSTRACT_XML_QUERY__QUERY :
+ case OrmPackage.NAMED_QUERY__QUERY:
return QUERY_EDEFAULT == null ? query != null : !QUERY_EDEFAULT.equals(query);
- case OrmPackage.ABSTRACT_XML_QUERY__HINTS :
+ case OrmPackage.NAMED_QUERY__HINTS:
return hints != null && !hints.isEmpty();
}
return super.eIsSet(featureID);
@@ -291,53 +306,10 @@ public abstract class AbstractXmlQuery extends XmlEObject implements IQuery
* @generated
*/
@Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IQuery.class) {
- switch (derivedFeatureID) {
- case OrmPackage.ABSTRACT_XML_QUERY__NAME :
- return JpaCoreMappingsPackage.IQUERY__NAME;
- case OrmPackage.ABSTRACT_XML_QUERY__QUERY :
- return JpaCoreMappingsPackage.IQUERY__QUERY;
- case OrmPackage.ABSTRACT_XML_QUERY__HINTS :
- return JpaCoreMappingsPackage.IQUERY__HINTS;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IQuery.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IQUERY__NAME :
- return OrmPackage.ABSTRACT_XML_QUERY__NAME;
- case JpaCoreMappingsPackage.IQUERY__QUERY :
- return OrmPackage.ABSTRACT_XML_QUERY__QUERY;
- case JpaCoreMappingsPackage.IQUERY__HINTS :
- return OrmPackage.ABSTRACT_XML_QUERY__HINTS;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (name: ");
result.append(name);
@@ -347,7 +319,4 @@ public abstract class AbstractXmlQuery extends XmlEObject implements IQuery
return result.toString();
}
- public XmlQueryHint createQueryHint(int index) {
- return OrmFactory.eINSTANCE.createXmlQueryHint();
- }
-} // AbstractXmlQuery
+} // NamedQuery
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OneToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OneToMany.java
new file mode 100644
index 0000000000..c18b416372
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OneToMany.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>One To Many</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.OneToMany#getJoinColumns <em>Join Columns</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToMany()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface OneToMany extends MultiRelationshipMapping
+{
+ /**
+ * Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Join Columns</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToMany_JoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ EList<JoinColumn> getJoinColumns();
+
+} // OneToMany
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OneToManyImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OneToManyImpl.java
new file mode 100644
index 0000000000..f10396b88e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OneToManyImpl.java
@@ -0,0 +1,769 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>One To Many</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToManyImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class OneToManyImpl extends JpaEObject implements OneToMany
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getTargetEntity() <em>Target Entity</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetEntity()
+ * @generated
+ * @ordered
+ */
+ protected static final String TARGET_ENTITY_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTargetEntity() <em>Target Entity</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetEntity()
+ * @generated
+ * @ordered
+ */
+ protected String targetEntity = TARGET_ENTITY_EDEFAULT;
+
+ /**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final FetchType FETCH_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFetch()
+ * @generated
+ * @ordered
+ */
+ protected FetchType fetch = FETCH_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getJoinTable() <em>Join Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJoinTable()
+ * @generated
+ * @ordered
+ */
+ protected JoinTable joinTable;
+
+ /**
+ * The cached value of the '{@link #getCascade() <em>Cascade</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCascade()
+ * @generated
+ * @ordered
+ */
+ protected CascadeType cascade;
+
+ /**
+ * The default value of the '{@link #getMappedBy() <em>Mapped By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMappedBy()
+ * @generated
+ * @ordered
+ */
+ protected static final String MAPPED_BY_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getMappedBy() <em>Mapped By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMappedBy()
+ * @generated
+ * @ordered
+ */
+ protected String mappedBy = MAPPED_BY_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getOrderBy() <em>Order By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOrderBy()
+ * @generated
+ * @ordered
+ */
+ protected static final String ORDER_BY_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getOrderBy() <em>Order By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOrderBy()
+ * @generated
+ * @ordered
+ */
+ protected String orderBy = ORDER_BY_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getMapKey() <em>Map Key</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMapKey()
+ * @generated
+ * @ordered
+ */
+ protected MapKey mapKey;
+
+ /**
+ * The cached value of the '{@link #getJoinColumns() <em>Join Columns</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJoinColumns()
+ * @generated
+ * @ordered
+ */
+ protected EList<JoinColumn> joinColumns;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected OneToManyImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ONE_TO_MANY_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeMapping_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_MANY_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Target Entity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Target Entity</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Target Entity</em>' attribute.
+ * @see #setTargetEntity(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_TargetEntity()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getTargetEntity()
+ {
+ return targetEntity;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl#getTargetEntity <em>Target Entity</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Target Entity</em>' attribute.
+ * @see #getTargetEntity()
+ * @generated
+ */
+ public void setTargetEntity(String newTargetEntity)
+ {
+ String oldTargetEntity = targetEntity;
+ targetEntity = newTargetEntity;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_MANY_IMPL__TARGET_ENTITY, oldTargetEntity, targetEntity));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Fetch</b></em>' attribute.
+ * The default value is <code>"LAZY"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.FetchType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Fetch</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Fetch</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
+ * @see #setFetch(FetchType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_Fetch()
+ * @model default="LAZY"
+ * @generated
+ */
+ public FetchType getFetch()
+ {
+ return fetch;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl#getFetch <em>Fetch</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Fetch</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
+ * @see #getFetch()
+ * @generated
+ */
+ public void setFetch(FetchType newFetch)
+ {
+ FetchType oldFetch = fetch;
+ fetch = newFetch == null ? FETCH_EDEFAULT : newFetch;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_MANY_IMPL__FETCH, oldFetch, fetch));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Mapped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Mapped By</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Mapped By</em>' attribute.
+ * @see #setMappedBy(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMultiRelationshipMapping_MappedBy()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getMappedBy()
+ {
+ return mappedBy;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl#getMappedBy <em>Mapped By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Mapped By</em>' attribute.
+ * @see #getMappedBy()
+ * @generated
+ */
+ public void setMappedBy(String newMappedBy)
+ {
+ String oldMappedBy = mappedBy;
+ mappedBy = newMappedBy;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_MANY_IMPL__MAPPED_BY, oldMappedBy, mappedBy));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Order By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Order By</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Order By</em>' attribute.
+ * @see #setOrderBy(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMultiRelationshipMapping_OrderBy()
+ * @model dataType="org.eclipse.jpt.core.internal.resource.orm.OrderBy"
+ * @generated
+ */
+ public String getOrderBy()
+ {
+ return orderBy;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl#getOrderBy <em>Order By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Order By</em>' attribute.
+ * @see #getOrderBy()
+ * @generated
+ */
+ public void setOrderBy(String newOrderBy)
+ {
+ String oldOrderBy = orderBy;
+ orderBy = newOrderBy;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_MANY_IMPL__ORDER_BY, oldOrderBy, orderBy));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Map Key</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Map Key</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Map Key</em>' containment reference.
+ * @see #setMapKey(MapKey)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMultiRelationshipMapping_MapKey()
+ * @model containment="true"
+ * @generated
+ */
+ public MapKey getMapKey()
+ {
+ return mapKey;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetMapKey(MapKey newMapKey, NotificationChain msgs)
+ {
+ MapKey oldMapKey = mapKey;
+ mapKey = newMapKey;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_MANY_IMPL__MAP_KEY, oldMapKey, newMapKey);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl#getMapKey <em>Map Key</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Map Key</em>' containment reference.
+ * @see #getMapKey()
+ * @generated
+ */
+ public void setMapKey(MapKey newMapKey)
+ {
+ if (newMapKey != mapKey)
+ {
+ NotificationChain msgs = null;
+ if (mapKey != null)
+ msgs = ((InternalEObject)mapKey).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ONE_TO_MANY_IMPL__MAP_KEY, null, msgs);
+ if (newMapKey != null)
+ msgs = ((InternalEObject)newMapKey).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ONE_TO_MANY_IMPL__MAP_KEY, null, msgs);
+ msgs = basicSetMapKey(newMapKey, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_MANY_IMPL__MAP_KEY, newMapKey, newMapKey));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Join Table</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Join Table</em>' containment reference.
+ * @see #setJoinTable(JoinTable)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_JoinTable()
+ * @model containment="true"
+ * @generated
+ */
+ public JoinTable getJoinTable()
+ {
+ return joinTable;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetJoinTable(JoinTable newJoinTable, NotificationChain msgs)
+ {
+ JoinTable oldJoinTable = joinTable;
+ joinTable = newJoinTable;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_MANY_IMPL__JOIN_TABLE, oldJoinTable, newJoinTable);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl#getJoinTable <em>Join Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Join Table</em>' containment reference.
+ * @see #getJoinTable()
+ * @generated
+ */
+ public void setJoinTable(JoinTable newJoinTable)
+ {
+ if (newJoinTable != joinTable)
+ {
+ NotificationChain msgs = null;
+ if (joinTable != null)
+ msgs = ((InternalEObject)joinTable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ONE_TO_MANY_IMPL__JOIN_TABLE, null, msgs);
+ if (newJoinTable != null)
+ msgs = ((InternalEObject)newJoinTable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ONE_TO_MANY_IMPL__JOIN_TABLE, null, msgs);
+ msgs = basicSetJoinTable(newJoinTable, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_MANY_IMPL__JOIN_TABLE, newJoinTable, newJoinTable));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Join Columns</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToMany_JoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<JoinColumn> getJoinColumns()
+ {
+ if (joinColumns == null)
+ {
+ joinColumns = new EObjectContainmentEList<JoinColumn>(JoinColumn.class, this, OrmPackage.ONE_TO_MANY_IMPL__JOIN_COLUMNS);
+ }
+ return joinColumns;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cascade</em>' containment reference.
+ * @see #setCascade(CascadeType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_Cascade()
+ * @model containment="true"
+ * @generated
+ */
+ public CascadeType getCascade()
+ {
+ return cascade;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetCascade(CascadeType newCascade, NotificationChain msgs)
+ {
+ CascadeType oldCascade = cascade;
+ cascade = newCascade;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_MANY_IMPL__CASCADE, oldCascade, newCascade);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl#getCascade <em>Cascade</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade</em>' containment reference.
+ * @see #getCascade()
+ * @generated
+ */
+ public void setCascade(CascadeType newCascade)
+ {
+ if (newCascade != cascade)
+ {
+ NotificationChain msgs = null;
+ if (cascade != null)
+ msgs = ((InternalEObject)cascade).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ONE_TO_MANY_IMPL__CASCADE, null, msgs);
+ if (newCascade != null)
+ msgs = ((InternalEObject)newCascade).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ONE_TO_MANY_IMPL__CASCADE, null, msgs);
+ msgs = basicSetCascade(newCascade, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_MANY_IMPL__CASCADE, newCascade, newCascade));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ONE_TO_MANY_IMPL__JOIN_TABLE:
+ return basicSetJoinTable(null, msgs);
+ case OrmPackage.ONE_TO_MANY_IMPL__CASCADE:
+ return basicSetCascade(null, msgs);
+ case OrmPackage.ONE_TO_MANY_IMPL__MAP_KEY:
+ return basicSetMapKey(null, msgs);
+ case OrmPackage.ONE_TO_MANY_IMPL__JOIN_COLUMNS:
+ return ((InternalEList<?>)getJoinColumns()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ONE_TO_MANY_IMPL__NAME:
+ return getName();
+ case OrmPackage.ONE_TO_MANY_IMPL__TARGET_ENTITY:
+ return getTargetEntity();
+ case OrmPackage.ONE_TO_MANY_IMPL__FETCH:
+ return getFetch();
+ case OrmPackage.ONE_TO_MANY_IMPL__JOIN_TABLE:
+ return getJoinTable();
+ case OrmPackage.ONE_TO_MANY_IMPL__CASCADE:
+ return getCascade();
+ case OrmPackage.ONE_TO_MANY_IMPL__MAPPED_BY:
+ return getMappedBy();
+ case OrmPackage.ONE_TO_MANY_IMPL__ORDER_BY:
+ return getOrderBy();
+ case OrmPackage.ONE_TO_MANY_IMPL__MAP_KEY:
+ return getMapKey();
+ case OrmPackage.ONE_TO_MANY_IMPL__JOIN_COLUMNS:
+ return getJoinColumns();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ONE_TO_MANY_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.ONE_TO_MANY_IMPL__TARGET_ENTITY:
+ setTargetEntity((String)newValue);
+ return;
+ case OrmPackage.ONE_TO_MANY_IMPL__FETCH:
+ setFetch((FetchType)newValue);
+ return;
+ case OrmPackage.ONE_TO_MANY_IMPL__JOIN_TABLE:
+ setJoinTable((JoinTable)newValue);
+ return;
+ case OrmPackage.ONE_TO_MANY_IMPL__CASCADE:
+ setCascade((CascadeType)newValue);
+ return;
+ case OrmPackage.ONE_TO_MANY_IMPL__MAPPED_BY:
+ setMappedBy((String)newValue);
+ return;
+ case OrmPackage.ONE_TO_MANY_IMPL__ORDER_BY:
+ setOrderBy((String)newValue);
+ return;
+ case OrmPackage.ONE_TO_MANY_IMPL__MAP_KEY:
+ setMapKey((MapKey)newValue);
+ return;
+ case OrmPackage.ONE_TO_MANY_IMPL__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ getJoinColumns().addAll((Collection<? extends JoinColumn>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ONE_TO_MANY_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.ONE_TO_MANY_IMPL__TARGET_ENTITY:
+ setTargetEntity(TARGET_ENTITY_EDEFAULT);
+ return;
+ case OrmPackage.ONE_TO_MANY_IMPL__FETCH:
+ setFetch(FETCH_EDEFAULT);
+ return;
+ case OrmPackage.ONE_TO_MANY_IMPL__JOIN_TABLE:
+ setJoinTable((JoinTable)null);
+ return;
+ case OrmPackage.ONE_TO_MANY_IMPL__CASCADE:
+ setCascade((CascadeType)null);
+ return;
+ case OrmPackage.ONE_TO_MANY_IMPL__MAPPED_BY:
+ setMappedBy(MAPPED_BY_EDEFAULT);
+ return;
+ case OrmPackage.ONE_TO_MANY_IMPL__ORDER_BY:
+ setOrderBy(ORDER_BY_EDEFAULT);
+ return;
+ case OrmPackage.ONE_TO_MANY_IMPL__MAP_KEY:
+ setMapKey((MapKey)null);
+ return;
+ case OrmPackage.ONE_TO_MANY_IMPL__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ONE_TO_MANY_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.ONE_TO_MANY_IMPL__TARGET_ENTITY:
+ return TARGET_ENTITY_EDEFAULT == null ? targetEntity != null : !TARGET_ENTITY_EDEFAULT.equals(targetEntity);
+ case OrmPackage.ONE_TO_MANY_IMPL__FETCH:
+ return fetch != FETCH_EDEFAULT;
+ case OrmPackage.ONE_TO_MANY_IMPL__JOIN_TABLE:
+ return joinTable != null;
+ case OrmPackage.ONE_TO_MANY_IMPL__CASCADE:
+ return cascade != null;
+ case OrmPackage.ONE_TO_MANY_IMPL__MAPPED_BY:
+ return MAPPED_BY_EDEFAULT == null ? mappedBy != null : !MAPPED_BY_EDEFAULT.equals(mappedBy);
+ case OrmPackage.ONE_TO_MANY_IMPL__ORDER_BY:
+ return ORDER_BY_EDEFAULT == null ? orderBy != null : !ORDER_BY_EDEFAULT.equals(orderBy);
+ case OrmPackage.ONE_TO_MANY_IMPL__MAP_KEY:
+ return mapKey != null;
+ case OrmPackage.ONE_TO_MANY_IMPL__JOIN_COLUMNS:
+ return joinColumns != null && !joinColumns.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", targetEntity: ");
+ result.append(targetEntity);
+ result.append(", fetch: ");
+ result.append(fetch);
+ result.append(", mappedBy: ");
+ result.append(mappedBy);
+ result.append(", orderBy: ");
+ result.append(orderBy);
+ result.append(')');
+ return result.toString();
+ }
+
+} // OneToMany
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OneToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OneToOne.java
new file mode 100644
index 0000000000..3be21cc861
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OneToOne.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>One To One</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.OneToOne#getMappedBy <em>Mapped By</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.OneToOne#getPrimaryKeyJoinColumns <em>Primary Key Join Columns</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToOne()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface OneToOne extends SingleRelationshipMapping
+{
+ /**
+ * Returns the value of the '<em><b>Mapped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Mapped By</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Mapped By</em>' attribute.
+ * @see #setMappedBy(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToOne_MappedBy()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getMappedBy();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOne#getMappedBy <em>Mapped By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Mapped By</em>' attribute.
+ * @see #getMappedBy()
+ * @generated
+ */
+ void setMappedBy(String value);
+
+ /**
+ * Returns the value of the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Primary Key Join Columns</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Primary Key Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToOne_PrimaryKeyJoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ EList<PrimaryKeyJoinColumn> getPrimaryKeyJoinColumns();
+
+} // OneToOne
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OneToOneImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OneToOneImpl.java
new file mode 100644
index 0000000000..065341e7cb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OneToOneImpl.java
@@ -0,0 +1,733 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>One To One</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToOneImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class OneToOneImpl extends JpaEObject implements OneToOne
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getTargetEntity() <em>Target Entity</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetEntity()
+ * @generated
+ * @ordered
+ */
+ protected static final String TARGET_ENTITY_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTargetEntity() <em>Target Entity</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetEntity()
+ * @generated
+ * @ordered
+ */
+ protected String targetEntity = TARGET_ENTITY_EDEFAULT;
+
+ /**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final FetchType FETCH_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getFetch() <em>Fetch</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFetch()
+ * @generated
+ * @ordered
+ */
+ protected FetchType fetch = FETCH_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getJoinTable() <em>Join Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJoinTable()
+ * @generated
+ * @ordered
+ */
+ protected JoinTable joinTable;
+
+ /**
+ * The cached value of the '{@link #getCascade() <em>Cascade</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCascade()
+ * @generated
+ * @ordered
+ */
+ protected CascadeType cascade;
+
+ /**
+ * The default value of the '{@link #getOptional() <em>Optional</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOptional()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean OPTIONAL_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getOptional() <em>Optional</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getOptional()
+ * @generated
+ * @ordered
+ */
+ protected Boolean optional = OPTIONAL_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getJoinColumns() <em>Join Columns</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJoinColumns()
+ * @generated
+ * @ordered
+ */
+ protected EList<JoinColumn> joinColumns;
+
+ /**
+ * The default value of the '{@link #getMappedBy() <em>Mapped By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMappedBy()
+ * @generated
+ * @ordered
+ */
+ protected static final String MAPPED_BY_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getMappedBy() <em>Mapped By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMappedBy()
+ * @generated
+ * @ordered
+ */
+ protected String mappedBy = MAPPED_BY_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getPrimaryKeyJoinColumns() <em>Primary Key Join Columns</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPrimaryKeyJoinColumns()
+ * @generated
+ * @ordered
+ */
+ protected EList<PrimaryKeyJoinColumn> primaryKeyJoinColumns;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected OneToOneImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.ONE_TO_ONE_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeMapping_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_ONE_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Target Entity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Target Entity</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Target Entity</em>' attribute.
+ * @see #setTargetEntity(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_TargetEntity()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getTargetEntity()
+ {
+ return targetEntity;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl#getTargetEntity <em>Target Entity</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Target Entity</em>' attribute.
+ * @see #getTargetEntity()
+ * @generated
+ */
+ public void setTargetEntity(String newTargetEntity)
+ {
+ String oldTargetEntity = targetEntity;
+ targetEntity = newTargetEntity;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_ONE_IMPL__TARGET_ENTITY, oldTargetEntity, targetEntity));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Fetch</b></em>' attribute.
+ * The default value is <code>"LAZY"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.FetchType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Fetch</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Fetch</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
+ * @see #setFetch(FetchType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_Fetch()
+ * @model default="LAZY"
+ * @generated
+ */
+ public FetchType getFetch()
+ {
+ return fetch;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl#getFetch <em>Fetch</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Fetch</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
+ * @see #getFetch()
+ * @generated
+ */
+ public void setFetch(FetchType newFetch)
+ {
+ FetchType oldFetch = fetch;
+ fetch = newFetch == null ? FETCH_EDEFAULT : newFetch;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_ONE_IMPL__FETCH, oldFetch, fetch));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Optional</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Optional</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Optional</em>' attribute.
+ * @see #setOptional(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSingleRelationshipMapping_Optional()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getOptional()
+ {
+ return optional;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl#getOptional <em>Optional</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Optional</em>' attribute.
+ * @see #getOptional()
+ * @generated
+ */
+ public void setOptional(Boolean newOptional)
+ {
+ Boolean oldOptional = optional;
+ optional = newOptional;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_ONE_IMPL__OPTIONAL, oldOptional, optional));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Mapped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Mapped By</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Mapped By</em>' attribute.
+ * @see #setMappedBy(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToOne_MappedBy()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getMappedBy()
+ {
+ return mappedBy;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl#getMappedBy <em>Mapped By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Mapped By</em>' attribute.
+ * @see #getMappedBy()
+ * @generated
+ */
+ public void setMappedBy(String newMappedBy)
+ {
+ String oldMappedBy = mappedBy;
+ mappedBy = newMappedBy;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_ONE_IMPL__MAPPED_BY, oldMappedBy, mappedBy));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Primary Key Join Columns</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Primary Key Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToOne_PrimaryKeyJoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<PrimaryKeyJoinColumn> getPrimaryKeyJoinColumns()
+ {
+ if (primaryKeyJoinColumns == null)
+ {
+ primaryKeyJoinColumns = new EObjectContainmentEList<PrimaryKeyJoinColumn>(PrimaryKeyJoinColumn.class, this, OrmPackage.ONE_TO_ONE_IMPL__PRIMARY_KEY_JOIN_COLUMNS);
+ }
+ return primaryKeyJoinColumns;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Join Columns</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSingleRelationshipMapping_JoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<JoinColumn> getJoinColumns()
+ {
+ if (joinColumns == null)
+ {
+ joinColumns = new EObjectContainmentEList<JoinColumn>(JoinColumn.class, this, OrmPackage.ONE_TO_ONE_IMPL__JOIN_COLUMNS);
+ }
+ return joinColumns;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Join Table</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Join Table</em>' containment reference.
+ * @see #setJoinTable(JoinTable)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_JoinTable()
+ * @model containment="true"
+ * @generated
+ */
+ public JoinTable getJoinTable()
+ {
+ return joinTable;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetJoinTable(JoinTable newJoinTable, NotificationChain msgs)
+ {
+ JoinTable oldJoinTable = joinTable;
+ joinTable = newJoinTable;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_ONE_IMPL__JOIN_TABLE, oldJoinTable, newJoinTable);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl#getJoinTable <em>Join Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Join Table</em>' containment reference.
+ * @see #getJoinTable()
+ * @generated
+ */
+ public void setJoinTable(JoinTable newJoinTable)
+ {
+ if (newJoinTable != joinTable)
+ {
+ NotificationChain msgs = null;
+ if (joinTable != null)
+ msgs = ((InternalEObject)joinTable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ONE_TO_ONE_IMPL__JOIN_TABLE, null, msgs);
+ if (newJoinTable != null)
+ msgs = ((InternalEObject)newJoinTable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ONE_TO_ONE_IMPL__JOIN_TABLE, null, msgs);
+ msgs = basicSetJoinTable(newJoinTable, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_ONE_IMPL__JOIN_TABLE, newJoinTable, newJoinTable));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cascade</em>' containment reference.
+ * @see #setCascade(CascadeType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_Cascade()
+ * @model containment="true"
+ * @generated
+ */
+ public CascadeType getCascade()
+ {
+ return cascade;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetCascade(CascadeType newCascade, NotificationChain msgs)
+ {
+ CascadeType oldCascade = cascade;
+ cascade = newCascade;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_ONE_IMPL__CASCADE, oldCascade, newCascade);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl#getCascade <em>Cascade</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade</em>' containment reference.
+ * @see #getCascade()
+ * @generated
+ */
+ public void setCascade(CascadeType newCascade)
+ {
+ if (newCascade != cascade)
+ {
+ NotificationChain msgs = null;
+ if (cascade != null)
+ msgs = ((InternalEObject)cascade).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ONE_TO_ONE_IMPL__CASCADE, null, msgs);
+ if (newCascade != null)
+ msgs = ((InternalEObject)newCascade).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.ONE_TO_ONE_IMPL__CASCADE, null, msgs);
+ msgs = basicSetCascade(newCascade, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.ONE_TO_ONE_IMPL__CASCADE, newCascade, newCascade));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ONE_TO_ONE_IMPL__JOIN_TABLE:
+ return basicSetJoinTable(null, msgs);
+ case OrmPackage.ONE_TO_ONE_IMPL__CASCADE:
+ return basicSetCascade(null, msgs);
+ case OrmPackage.ONE_TO_ONE_IMPL__JOIN_COLUMNS:
+ return ((InternalEList<?>)getJoinColumns()).basicRemove(otherEnd, msgs);
+ case OrmPackage.ONE_TO_ONE_IMPL__PRIMARY_KEY_JOIN_COLUMNS:
+ return ((InternalEList<?>)getPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ONE_TO_ONE_IMPL__NAME:
+ return getName();
+ case OrmPackage.ONE_TO_ONE_IMPL__TARGET_ENTITY:
+ return getTargetEntity();
+ case OrmPackage.ONE_TO_ONE_IMPL__FETCH:
+ return getFetch();
+ case OrmPackage.ONE_TO_ONE_IMPL__JOIN_TABLE:
+ return getJoinTable();
+ case OrmPackage.ONE_TO_ONE_IMPL__CASCADE:
+ return getCascade();
+ case OrmPackage.ONE_TO_ONE_IMPL__OPTIONAL:
+ return getOptional();
+ case OrmPackage.ONE_TO_ONE_IMPL__JOIN_COLUMNS:
+ return getJoinColumns();
+ case OrmPackage.ONE_TO_ONE_IMPL__MAPPED_BY:
+ return getMappedBy();
+ case OrmPackage.ONE_TO_ONE_IMPL__PRIMARY_KEY_JOIN_COLUMNS:
+ return getPrimaryKeyJoinColumns();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ONE_TO_ONE_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.ONE_TO_ONE_IMPL__TARGET_ENTITY:
+ setTargetEntity((String)newValue);
+ return;
+ case OrmPackage.ONE_TO_ONE_IMPL__FETCH:
+ setFetch((FetchType)newValue);
+ return;
+ case OrmPackage.ONE_TO_ONE_IMPL__JOIN_TABLE:
+ setJoinTable((JoinTable)newValue);
+ return;
+ case OrmPackage.ONE_TO_ONE_IMPL__CASCADE:
+ setCascade((CascadeType)newValue);
+ return;
+ case OrmPackage.ONE_TO_ONE_IMPL__OPTIONAL:
+ setOptional((Boolean)newValue);
+ return;
+ case OrmPackage.ONE_TO_ONE_IMPL__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ getJoinColumns().addAll((Collection<? extends JoinColumn>)newValue);
+ return;
+ case OrmPackage.ONE_TO_ONE_IMPL__MAPPED_BY:
+ setMappedBy((String)newValue);
+ return;
+ case OrmPackage.ONE_TO_ONE_IMPL__PRIMARY_KEY_JOIN_COLUMNS:
+ getPrimaryKeyJoinColumns().clear();
+ getPrimaryKeyJoinColumns().addAll((Collection<? extends PrimaryKeyJoinColumn>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ONE_TO_ONE_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.ONE_TO_ONE_IMPL__TARGET_ENTITY:
+ setTargetEntity(TARGET_ENTITY_EDEFAULT);
+ return;
+ case OrmPackage.ONE_TO_ONE_IMPL__FETCH:
+ setFetch(FETCH_EDEFAULT);
+ return;
+ case OrmPackage.ONE_TO_ONE_IMPL__JOIN_TABLE:
+ setJoinTable((JoinTable)null);
+ return;
+ case OrmPackage.ONE_TO_ONE_IMPL__CASCADE:
+ setCascade((CascadeType)null);
+ return;
+ case OrmPackage.ONE_TO_ONE_IMPL__OPTIONAL:
+ setOptional(OPTIONAL_EDEFAULT);
+ return;
+ case OrmPackage.ONE_TO_ONE_IMPL__JOIN_COLUMNS:
+ getJoinColumns().clear();
+ return;
+ case OrmPackage.ONE_TO_ONE_IMPL__MAPPED_BY:
+ setMappedBy(MAPPED_BY_EDEFAULT);
+ return;
+ case OrmPackage.ONE_TO_ONE_IMPL__PRIMARY_KEY_JOIN_COLUMNS:
+ getPrimaryKeyJoinColumns().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.ONE_TO_ONE_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.ONE_TO_ONE_IMPL__TARGET_ENTITY:
+ return TARGET_ENTITY_EDEFAULT == null ? targetEntity != null : !TARGET_ENTITY_EDEFAULT.equals(targetEntity);
+ case OrmPackage.ONE_TO_ONE_IMPL__FETCH:
+ return fetch != FETCH_EDEFAULT;
+ case OrmPackage.ONE_TO_ONE_IMPL__JOIN_TABLE:
+ return joinTable != null;
+ case OrmPackage.ONE_TO_ONE_IMPL__CASCADE:
+ return cascade != null;
+ case OrmPackage.ONE_TO_ONE_IMPL__OPTIONAL:
+ return OPTIONAL_EDEFAULT == null ? optional != null : !OPTIONAL_EDEFAULT.equals(optional);
+ case OrmPackage.ONE_TO_ONE_IMPL__JOIN_COLUMNS:
+ return joinColumns != null && !joinColumns.isEmpty();
+ case OrmPackage.ONE_TO_ONE_IMPL__MAPPED_BY:
+ return MAPPED_BY_EDEFAULT == null ? mappedBy != null : !MAPPED_BY_EDEFAULT.equals(mappedBy);
+ case OrmPackage.ONE_TO_ONE_IMPL__PRIMARY_KEY_JOIN_COLUMNS:
+ return primaryKeyJoinColumns != null && !primaryKeyJoinColumns.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", targetEntity: ");
+ result.append(targetEntity);
+ result.append(", fetch: ");
+ result.append(fetch);
+ result.append(", optional: ");
+ result.append(optional);
+ result.append(", mappedBy: ");
+ result.append(mappedBy);
+ result.append(')');
+ return result.toString();
+ }
+
+} // OneToOne
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmArtifactEdit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmArtifactEdit.java
new file mode 100644
index 0000000000..5197c4ee11
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmArtifactEdit.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.io.IOException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.resource.common.JpaArtifactEdit;
+
+public class OrmArtifactEdit extends JpaArtifactEdit
+{
+ /**
+ * @param aProject
+ * @return an orm artifact for the project aProject.
+ * Opened only for read access (no write)
+ */
+ public static OrmArtifactEdit getArtifactEditForRead(IProject aProject) {
+ OrmArtifactEdit artifactEdit = null;
+ try {
+ artifactEdit = new OrmArtifactEdit(aProject, true);
+ }
+ catch (IllegalArgumentException iae) {
+ // suppress illegal argument exception
+ JptCorePlugin.log(iae);
+ }
+ return artifactEdit;
+ }
+
+ /**
+ * @param aProject
+ * @return an orm artifact for the project aProject.
+ * Opened for both write and read access
+ */
+ public static OrmArtifactEdit getArtifactEditForWrite(IProject aProject) {
+ OrmArtifactEdit artifactEdit = null;
+ try {
+ artifactEdit = new OrmArtifactEdit(aProject, false);
+ }
+ catch (IllegalArgumentException iae) {
+ // suppress illegal argument exception
+ JptCorePlugin.log(iae);
+ }
+ return artifactEdit;
+ }
+
+
+ public OrmArtifactEdit(IProject aProject, boolean toAccessAsReadOnly)
+ throws IllegalArgumentException {
+ super(aProject, toAccessAsReadOnly);
+ }
+
+
+ @Override
+ public OrmResource getResource(IFile file) {
+ // This *seems* to do the same basic thing as below, but circumvents the
+ // URI munging that ArtifactEditModel does (see bug 209093)
+ try {
+ OrmResource resource =
+ (OrmResource) getArtifactEditModel().createResource(URI.createPlatformResourceURI(file.getFullPath().toString()));
+ if (! resource.isLoaded()) {
+ resource.load(getArtifactEditModel().getResourceSet().getLoadOptions());
+ }
+ return resource;
+ }
+ catch (ClassCastException cce) {
+ return null;
+ }
+ catch (IOException ioe) {
+ JptCorePlugin.log(ioe);
+ return null;
+ }
+ }
+
+ @Override
+ public OrmResource getResource(String fileURI) {
+ try {
+ return (OrmResource) getArtifactEditModel().getResource(URI.createURI(fileURI));
+ }
+ catch (ClassCastException cce) {
+ return null;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmFactory.java
new file mode 100644
index 0000000000..5c0ac9371d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmFactory.java
@@ -0,0 +1,1041 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.util.Enumerator;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage
+ * @generated
+ */
+public class OrmFactory extends EFactoryImpl
+{
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final OrmFactory eINSTANCE = init();
+
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static OrmFactory init()
+ {
+ try
+ {
+ OrmFactory theOrmFactory = (OrmFactory)EPackage.Registry.INSTANCE.getEFactory("jpt.orm.xmi");
+ if (theOrmFactory != null)
+ {
+ return theOrmFactory;
+ }
+ }
+ catch (Exception exception)
+ {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new OrmFactory();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public OrmFactory()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass)
+ {
+ switch (eClass.getClassifierID())
+ {
+ case OrmPackage.ENTITY_MAPPINGS: return (EObject)createEntityMappings();
+ case OrmPackage.PERSISTENCE_UNIT_METADATA: return (EObject)createPersistenceUnitMetadata();
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS: return (EObject)createPersistenceUnitDefaults();
+ case OrmPackage.MAPPED_SUPERCLASS: return (EObject)createMappedSuperclass();
+ case OrmPackage.ENTITY: return (EObject)createEntity();
+ case OrmPackage.EMBEDDABLE: return (EObject)createEmbeddable();
+ case OrmPackage.ATTRIBUTES: return (EObject)createAttributes();
+ case OrmPackage.ID_IMPL: return (EObject)createIdImpl();
+ case OrmPackage.EMBEDDED_ID_IMPL: return (EObject)createEmbeddedIdImpl();
+ case OrmPackage.BASIC_IMPL: return (EObject)createBasicImpl();
+ case OrmPackage.VERSION_IMPL: return (EObject)createVersionImpl();
+ case OrmPackage.MANY_TO_ONE_IMPL: return (EObject)createManyToOneImpl();
+ case OrmPackage.ONE_TO_MANY_IMPL: return (EObject)createOneToManyImpl();
+ case OrmPackage.ONE_TO_ONE_IMPL: return (EObject)createOneToOneImpl();
+ case OrmPackage.MANY_TO_MANY_IMPL: return (EObject)createManyToManyImpl();
+ case OrmPackage.EMBEDDED_IMPL: return (EObject)createEmbeddedImpl();
+ case OrmPackage.TRANSIENT_IMPL: return (EObject)createTransientImpl();
+ case OrmPackage.ASSOCIATION_OVERRIDE: return (EObject)createAssociationOverride();
+ case OrmPackage.ATTRIBUTE_OVERRIDE_IMPL: return (EObject)createAttributeOverrideImpl();
+ case OrmPackage.CASCADE_TYPE_IMPL: return (EObject)createCascadeTypeImpl();
+ case OrmPackage.COLUMN_IMPL: return (EObject)createColumnImpl();
+ case OrmPackage.COLUMN_RESULT: return (EObject)createColumnResult();
+ case OrmPackage.DISCRIMINATOR_COLUMN: return (EObject)createDiscriminatorColumn();
+ case OrmPackage.ENTITY_LISTENERS: return (EObject)createEntityListeners();
+ case OrmPackage.ENTITY_LISTENER: return (EObject)createEntityListener();
+ case OrmPackage.ENTITY_RESULT: return (EObject)createEntityResult();
+ case OrmPackage.EVENT_METHOD: return (EObject)createEventMethod();
+ case OrmPackage.FIELD_RESULT: return (EObject)createFieldResult();
+ case OrmPackage.GENERATED_VALUE_IMPL: return (EObject)createGeneratedValueImpl();
+ case OrmPackage.ID_CLASS: return (EObject)createIdClass();
+ case OrmPackage.INHERITANCE: return (EObject)createInheritance();
+ case OrmPackage.JOIN_COLUMN_IMPL: return (EObject)createJoinColumnImpl();
+ case OrmPackage.JOIN_TABLE_IMPL: return (EObject)createJoinTableImpl();
+ case OrmPackage.LOB: return (EObject)createLob();
+ case OrmPackage.MAP_KEY_IMPL: return (EObject)createMapKeyImpl();
+ case OrmPackage.NAMED_NATIVE_QUERY: return (EObject)createNamedNativeQuery();
+ case OrmPackage.NAMED_QUERY: return (EObject)createNamedQuery();
+ case OrmPackage.POST_LOAD: return (EObject)createPostLoad();
+ case OrmPackage.POST_PERSIST: return (EObject)createPostPersist();
+ case OrmPackage.POST_REMOVE: return (EObject)createPostRemove();
+ case OrmPackage.POST_UPDATE: return (EObject)createPostUpdate();
+ case OrmPackage.PRE_PERSIST: return (EObject)createPrePersist();
+ case OrmPackage.PRE_REMOVE: return (EObject)createPreRemove();
+ case OrmPackage.PRE_UPDATE: return (EObject)createPreUpdate();
+ case OrmPackage.PRIMARY_KEY_JOIN_COLUMN: return (EObject)createPrimaryKeyJoinColumn();
+ case OrmPackage.QUERY_HINT: return (EObject)createQueryHint();
+ case OrmPackage.TABLE: return (EObject)createTable();
+ case OrmPackage.SECONDARY_TABLE: return (EObject)createSecondaryTable();
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL: return (EObject)createSequenceGeneratorImpl();
+ case OrmPackage.SQL_RESULT_SET_MAPPING: return (EObject)createSqlResultSetMapping();
+ case OrmPackage.TABLE_GENERATOR_IMPL: return (EObject)createTableGeneratorImpl();
+ case OrmPackage.UNIQUE_CONSTRAINT: return (EObject)createUniqueConstraint();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object createFromString(EDataType eDataType, String initialValue)
+ {
+ switch (eDataType.getClassifierID())
+ {
+ case OrmPackage.ACCESS_TYPE:
+ return createAccessTypeFromString(eDataType, initialValue);
+ case OrmPackage.DISCRIMINATOR_TYPE:
+ return createDiscriminatorTypeFromString(eDataType, initialValue);
+ case OrmPackage.ENUM_TYPE:
+ return createEnumTypeFromString(eDataType, initialValue);
+ case OrmPackage.FETCH_TYPE:
+ return createFetchTypeFromString(eDataType, initialValue);
+ case OrmPackage.GENERATION_TYPE:
+ return createGenerationTypeFromString(eDataType, initialValue);
+ case OrmPackage.INHERITANCE_TYPE:
+ return createInheritanceTypeFromString(eDataType, initialValue);
+ case OrmPackage.TEMPORAL_TYPE:
+ return createTemporalTypeFromString(eDataType, initialValue);
+ case OrmPackage.DISCRIMINATOR_VALUE:
+ return createDiscriminatorValueFromString(eDataType, initialValue);
+ case OrmPackage.ENUMERATED:
+ return createEnumeratedFromString(eDataType, initialValue);
+ case OrmPackage.ORDER_BY:
+ return createOrderByFromString(eDataType, initialValue);
+ case OrmPackage.VERSION_TYPE:
+ return createVersionTypeFromString(eDataType, initialValue);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String convertToString(EDataType eDataType, Object instanceValue)
+ {
+ switch (eDataType.getClassifierID())
+ {
+ case OrmPackage.ACCESS_TYPE:
+ return convertAccessTypeToString(eDataType, instanceValue);
+ case OrmPackage.DISCRIMINATOR_TYPE:
+ return convertDiscriminatorTypeToString(eDataType, instanceValue);
+ case OrmPackage.ENUM_TYPE:
+ return convertEnumTypeToString(eDataType, instanceValue);
+ case OrmPackage.FETCH_TYPE:
+ return convertFetchTypeToString(eDataType, instanceValue);
+ case OrmPackage.GENERATION_TYPE:
+ return convertGenerationTypeToString(eDataType, instanceValue);
+ case OrmPackage.INHERITANCE_TYPE:
+ return convertInheritanceTypeToString(eDataType, instanceValue);
+ case OrmPackage.TEMPORAL_TYPE:
+ return convertTemporalTypeToString(eDataType, instanceValue);
+ case OrmPackage.DISCRIMINATOR_VALUE:
+ return convertDiscriminatorValueToString(eDataType, instanceValue);
+ case OrmPackage.ENUMERATED:
+ return convertEnumeratedToString(eDataType, instanceValue);
+ case OrmPackage.ORDER_BY:
+ return convertOrderByToString(eDataType, instanceValue);
+ case OrmPackage.VERSION_TYPE:
+ return convertVersionTypeToString(eDataType, instanceValue);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EntityMappings createEntityMappings()
+ {
+ EntityMappings entityMappings = new EntityMappings();
+ return entityMappings;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PersistenceUnitMetadata createPersistenceUnitMetadata()
+ {
+ PersistenceUnitMetadata persistenceUnitMetadata = new PersistenceUnitMetadata();
+ return persistenceUnitMetadata;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PersistenceUnitDefaults createPersistenceUnitDefaults()
+ {
+ PersistenceUnitDefaults persistenceUnitDefaults = new PersistenceUnitDefaults();
+ return persistenceUnitDefaults;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public MappedSuperclass createMappedSuperclass()
+ {
+ MappedSuperclass mappedSuperclass = new MappedSuperclass();
+ return mappedSuperclass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Entity createEntity()
+ {
+ Entity entity = new Entity();
+ return entity;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Embeddable createEmbeddable()
+ {
+ Embeddable embeddable = new Embeddable();
+ return embeddable;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Attributes createAttributes()
+ {
+ Attributes attributes = new Attributes();
+ return attributes;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IdImpl createIdImpl()
+ {
+ IdImpl idImpl = new IdImpl();
+ return idImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EmbeddedIdImpl createEmbeddedIdImpl()
+ {
+ EmbeddedIdImpl embeddedIdImpl = new EmbeddedIdImpl();
+ return embeddedIdImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public BasicImpl createBasicImpl()
+ {
+ BasicImpl basicImpl = new BasicImpl();
+ return basicImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public VersionImpl createVersionImpl()
+ {
+ VersionImpl versionImpl = new VersionImpl();
+ return versionImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ManyToOneImpl createManyToOneImpl()
+ {
+ ManyToOneImpl manyToOneImpl = new ManyToOneImpl();
+ return manyToOneImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public OneToManyImpl createOneToManyImpl()
+ {
+ OneToManyImpl oneToManyImpl = new OneToManyImpl();
+ return oneToManyImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public OneToOneImpl createOneToOneImpl()
+ {
+ OneToOneImpl oneToOneImpl = new OneToOneImpl();
+ return oneToOneImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ManyToManyImpl createManyToManyImpl()
+ {
+ ManyToManyImpl manyToManyImpl = new ManyToManyImpl();
+ return manyToManyImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EmbeddedImpl createEmbeddedImpl()
+ {
+ EmbeddedImpl embeddedImpl = new EmbeddedImpl();
+ return embeddedImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public TransientImpl createTransientImpl()
+ {
+ TransientImpl transientImpl = new TransientImpl();
+ return transientImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AssociationOverride createAssociationOverride()
+ {
+ AssociationOverride associationOverride = new AssociationOverride();
+ return associationOverride;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AttributeOverrideImpl createAttributeOverrideImpl()
+ {
+ AttributeOverrideImpl attributeOverrideImpl = new AttributeOverrideImpl();
+ return attributeOverrideImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CascadeTypeImpl createCascadeTypeImpl()
+ {
+ CascadeTypeImpl cascadeTypeImpl = new CascadeTypeImpl();
+ return cascadeTypeImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ColumnImpl createColumnImpl()
+ {
+ ColumnImpl columnImpl = new ColumnImpl();
+ return columnImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ColumnResult createColumnResult()
+ {
+ ColumnResult columnResult = new ColumnResult();
+ return columnResult;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DiscriminatorColumn createDiscriminatorColumn()
+ {
+ DiscriminatorColumn discriminatorColumn = new DiscriminatorColumn();
+ return discriminatorColumn;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EntityListeners createEntityListeners()
+ {
+ EntityListeners entityListeners = new EntityListeners();
+ return entityListeners;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EntityListener createEntityListener()
+ {
+ EntityListener entityListener = new EntityListener();
+ return entityListener;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EntityResult createEntityResult()
+ {
+ EntityResult entityResult = new EntityResult();
+ return entityResult;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FieldResult createFieldResult()
+ {
+ FieldResult fieldResult = new FieldResult();
+ return fieldResult;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public GeneratedValueImpl createGeneratedValueImpl()
+ {
+ GeneratedValueImpl generatedValueImpl = new GeneratedValueImpl();
+ return generatedValueImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IdClass createIdClass()
+ {
+ IdClass idClass = new IdClass();
+ return idClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Inheritance createInheritance()
+ {
+ Inheritance inheritance = new Inheritance();
+ return inheritance;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public JoinColumnImpl createJoinColumnImpl()
+ {
+ JoinColumnImpl joinColumnImpl = new JoinColumnImpl();
+ return joinColumnImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public JoinTableImpl createJoinTableImpl()
+ {
+ JoinTableImpl joinTableImpl = new JoinTableImpl();
+ return joinTableImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Lob createLob()
+ {
+ Lob lob = new Lob();
+ return lob;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public MapKeyImpl createMapKeyImpl()
+ {
+ MapKeyImpl mapKeyImpl = new MapKeyImpl();
+ return mapKeyImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EventMethod createEventMethod()
+ {
+ EventMethod eventMethod = new EventMethod();
+ return eventMethod;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NamedNativeQuery createNamedNativeQuery()
+ {
+ NamedNativeQuery namedNativeQuery = new NamedNativeQuery();
+ return namedNativeQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NamedQuery createNamedQuery()
+ {
+ NamedQuery namedQuery = new NamedQuery();
+ return namedQuery;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PostLoad createPostLoad()
+ {
+ PostLoad postLoad = new PostLoad();
+ return postLoad;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PostPersist createPostPersist()
+ {
+ PostPersist postPersist = new PostPersist();
+ return postPersist;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PostRemove createPostRemove()
+ {
+ PostRemove postRemove = new PostRemove();
+ return postRemove;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PostUpdate createPostUpdate()
+ {
+ PostUpdate postUpdate = new PostUpdate();
+ return postUpdate;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PrePersist createPrePersist()
+ {
+ PrePersist prePersist = new PrePersist();
+ return prePersist;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PreRemove createPreRemove()
+ {
+ PreRemove preRemove = new PreRemove();
+ return preRemove;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PreUpdate createPreUpdate()
+ {
+ PreUpdate preUpdate = new PreUpdate();
+ return preUpdate;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public QueryHint createQueryHint()
+ {
+ QueryHint queryHint = new QueryHint();
+ return queryHint;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SqlResultSetMapping createSqlResultSetMapping()
+ {
+ SqlResultSetMapping sqlResultSetMapping = new SqlResultSetMapping();
+ return sqlResultSetMapping;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public TableGeneratorImpl createTableGeneratorImpl()
+ {
+ TableGeneratorImpl tableGeneratorImpl = new TableGeneratorImpl();
+ return tableGeneratorImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PrimaryKeyJoinColumn createPrimaryKeyJoinColumn()
+ {
+ PrimaryKeyJoinColumn primaryKeyJoinColumn = new PrimaryKeyJoinColumn();
+ return primaryKeyJoinColumn;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SecondaryTable createSecondaryTable()
+ {
+ SecondaryTable secondaryTable = new SecondaryTable();
+ return secondaryTable;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SequenceGeneratorImpl createSequenceGeneratorImpl()
+ {
+ SequenceGeneratorImpl sequenceGeneratorImpl = new SequenceGeneratorImpl();
+ return sequenceGeneratorImpl;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Table createTable()
+ {
+ Table table = new Table();
+ return table;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public UniqueConstraint createUniqueConstraint()
+ {
+ UniqueConstraint uniqueConstraint = new UniqueConstraint();
+ return uniqueConstraint;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AccessType createAccessTypeFromString(EDataType eDataType, String initialValue)
+ {
+ AccessType result = AccessType.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertAccessTypeToString(EDataType eDataType, Object instanceValue)
+ {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DiscriminatorType createDiscriminatorTypeFromString(EDataType eDataType, String initialValue)
+ {
+ DiscriminatorType result = DiscriminatorType.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertDiscriminatorTypeToString(EDataType eDataType, Object instanceValue)
+ {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EnumType createEnumTypeFromString(EDataType eDataType, String initialValue)
+ {
+ EnumType result = EnumType.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertEnumTypeToString(EDataType eDataType, Object instanceValue)
+ {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public FetchType createFetchTypeFromString(EDataType eDataType, String initialValue)
+ {
+ FetchType result = FetchType.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertFetchTypeToString(EDataType eDataType, Object instanceValue)
+ {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public GenerationType createGenerationTypeFromString(EDataType eDataType, String initialValue)
+ {
+ GenerationType result = GenerationType.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertGenerationTypeToString(EDataType eDataType, Object instanceValue)
+ {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public InheritanceType createInheritanceTypeFromString(EDataType eDataType, String initialValue)
+ {
+ InheritanceType result = InheritanceType.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertInheritanceTypeToString(EDataType eDataType, Object instanceValue)
+ {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public TemporalType createTemporalTypeFromString(EDataType eDataType, String initialValue)
+ {
+ TemporalType result = TemporalType.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertTemporalTypeToString(EDataType eDataType, Object instanceValue)
+ {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String createDiscriminatorValueFromString(EDataType eDataType, String initialValue)
+ {
+ return (String)super.createFromString(eDataType, initialValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertDiscriminatorValueToString(EDataType eDataType, Object instanceValue)
+ {
+ return super.convertToString(eDataType, instanceValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Enumerator createEnumeratedFromString(EDataType eDataType, String initialValue)
+ {
+ return (Enumerator)super.createFromString(eDataType, initialValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertEnumeratedToString(EDataType eDataType, Object instanceValue)
+ {
+ return super.convertToString(eDataType, instanceValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String createOrderByFromString(EDataType eDataType, String initialValue)
+ {
+ return (String)super.createFromString(eDataType, initialValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertOrderByToString(EDataType eDataType, Object instanceValue)
+ {
+ return super.convertToString(eDataType, instanceValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String createVersionTypeFromString(EDataType eDataType, String initialValue)
+ {
+ return (String)super.createFromString(eDataType, initialValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertVersionTypeToString(EDataType eDataType, Object instanceValue)
+ {
+ return super.convertToString(eDataType, instanceValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public OrmPackage getOrmPackage()
+ {
+ return (OrmPackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static OrmPackage getPackage()
+ {
+ return OrmPackage.eINSTANCE;
+ }
+
+} //OrmFactory
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmPackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmPackage.java
new file mode 100644
index 0000000000..56db1868e7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmPackage.java
@@ -0,0 +1,12851 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.util.Enumerator;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmFactory
+ * @model kind="package"
+ * @generated
+ */
+public class OrmPackage extends EPackageImpl
+{
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String eNAME = "orm";
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String eNS_URI = "jpt.orm.xmi";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String eNS_PREFIX = "org.eclipse.jpt.core.resource.orm";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final OrmPackage eINSTANCE = org.eclipse.jpt.core.internal.resource.orm.OrmPackage.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings <em>Entity Mappings</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings()
+ * @generated
+ */
+ public static final int ENTITY_MAPPINGS = 0;
+
+ /**
+ * The feature id for the '<em><b>Version</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_MAPPINGS__VERSION = 0;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_MAPPINGS__DESCRIPTION = 1;
+
+ /**
+ * The feature id for the '<em><b>Persistence Unit Metadata</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA = 2;
+
+ /**
+ * The feature id for the '<em><b>Package</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_MAPPINGS__PACKAGE = 3;
+
+ /**
+ * The feature id for the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_MAPPINGS__SCHEMA = 4;
+
+ /**
+ * The feature id for the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_MAPPINGS__CATALOG = 5;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_MAPPINGS__ACCESS = 6;
+
+ /**
+ * The feature id for the '<em><b>Sequence Generators</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_MAPPINGS__SEQUENCE_GENERATORS = 7;
+
+ /**
+ * The feature id for the '<em><b>Table Generators</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_MAPPINGS__TABLE_GENERATORS = 8;
+
+ /**
+ * The feature id for the '<em><b>Named Queries</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_MAPPINGS__NAMED_QUERIES = 9;
+
+ /**
+ * The feature id for the '<em><b>Named Native Queries</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES = 10;
+
+ /**
+ * The feature id for the '<em><b>Sql Result Set Mappings</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS = 11;
+
+ /**
+ * The feature id for the '<em><b>Mapped Superclasses</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_MAPPINGS__MAPPED_SUPERCLASSES = 12;
+
+ /**
+ * The feature id for the '<em><b>Entities</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_MAPPINGS__ENTITIES = 13;
+
+ /**
+ * The feature id for the '<em><b>Embeddables</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_MAPPINGS__EMBEDDABLES = 14;
+
+ /**
+ * The number of structural features of the '<em>Entity Mappings</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_MAPPINGS_FEATURE_COUNT = 15;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata <em>Persistence Unit Metadata</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPersistenceUnitMetadata()
+ * @generated
+ */
+ public static final int PERSISTENCE_UNIT_METADATA = 1;
+
+ /**
+ * The feature id for the '<em><b>Xml Mapping Metadata Complete</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE = 0;
+
+ /**
+ * The feature id for the '<em><b>Persistence Unit Defaults</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS = 1;
+
+ /**
+ * The number of structural features of the '<em>Persistence Unit Metadata</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PERSISTENCE_UNIT_METADATA_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults <em>Persistence Unit Defaults</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPersistenceUnitDefaults()
+ * @generated
+ */
+ public static final int PERSISTENCE_UNIT_DEFAULTS = 2;
+
+ /**
+ * The feature id for the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PERSISTENCE_UNIT_DEFAULTS__SCHEMA = 0;
+
+ /**
+ * The feature id for the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PERSISTENCE_UNIT_DEFAULTS__CATALOG = 1;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PERSISTENCE_UNIT_DEFAULTS__ACCESS = 2;
+
+ /**
+ * The feature id for the '<em><b>Cascade Persist</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST = 3;
+
+ /**
+ * The feature id for the '<em><b>Entity Listeners</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS = 4;
+
+ /**
+ * The number of structural features of the '<em>Persistence Unit Defaults</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PERSISTENCE_UNIT_DEFAULTS_FEATURE_COUNT = 5;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping <em>Type Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.TypeMapping
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTypeMapping()
+ * @generated
+ */
+ public static final int TYPE_MAPPING = 3;
+
+ /**
+ * The feature id for the '<em><b>Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TYPE_MAPPING__CLASS_NAME = 0;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TYPE_MAPPING__ACCESS = 1;
+
+ /**
+ * The feature id for the '<em><b>Metadata Complete</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TYPE_MAPPING__METADATA_COMPLETE = 2;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TYPE_MAPPING__DESCRIPTION = 3;
+
+ /**
+ * The feature id for the '<em><b>Attributes</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TYPE_MAPPING__ATTRIBUTES = 4;
+
+ /**
+ * The number of structural features of the '<em>Type Mapping</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TYPE_MAPPING_FEATURE_COUNT = 5;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass <em>Mapped Superclass</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMappedSuperclass()
+ * @generated
+ */
+ public static final int MAPPED_SUPERCLASS = 4;
+
+ /**
+ * The feature id for the '<em><b>Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS__CLASS_NAME = TYPE_MAPPING__CLASS_NAME;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS__ACCESS = TYPE_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Metadata Complete</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS__METADATA_COMPLETE = TYPE_MAPPING__METADATA_COMPLETE;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS__DESCRIPTION = TYPE_MAPPING__DESCRIPTION;
+
+ /**
+ * The feature id for the '<em><b>Attributes</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS__ATTRIBUTES = TYPE_MAPPING__ATTRIBUTES;
+
+ /**
+ * The feature id for the '<em><b>Id Class</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS__ID_CLASS = TYPE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Exclude Default Listeners</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS__EXCLUDE_DEFAULT_LISTENERS = TYPE_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Exclude Superclass Listeners</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS__EXCLUDE_SUPERCLASS_LISTENERS = TYPE_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Entity Listeners</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS__ENTITY_LISTENERS = TYPE_MAPPING_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Pre Persist</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS__PRE_PERSIST = TYPE_MAPPING_FEATURE_COUNT + 4;
+
+ /**
+ * The feature id for the '<em><b>Post Persist</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS__POST_PERSIST = TYPE_MAPPING_FEATURE_COUNT + 5;
+
+ /**
+ * The feature id for the '<em><b>Pre Remove</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS__PRE_REMOVE = TYPE_MAPPING_FEATURE_COUNT + 6;
+
+ /**
+ * The feature id for the '<em><b>Post Remove</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS__POST_REMOVE = TYPE_MAPPING_FEATURE_COUNT + 7;
+
+ /**
+ * The feature id for the '<em><b>Pre Update</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS__PRE_UPDATE = TYPE_MAPPING_FEATURE_COUNT + 8;
+
+ /**
+ * The feature id for the '<em><b>Post Update</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS__POST_UPDATE = TYPE_MAPPING_FEATURE_COUNT + 9;
+
+ /**
+ * The feature id for the '<em><b>Post Load</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS__POST_LOAD = TYPE_MAPPING_FEATURE_COUNT + 10;
+
+ /**
+ * The number of structural features of the '<em>Mapped Superclass</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAPPED_SUPERCLASS_FEATURE_COUNT = TYPE_MAPPING_FEATURE_COUNT + 11;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity <em>Entity</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity()
+ * @generated
+ */
+ public static final int ENTITY = 5;
+
+ /**
+ * The feature id for the '<em><b>Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__CLASS_NAME = TYPE_MAPPING__CLASS_NAME;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__ACCESS = TYPE_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Metadata Complete</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__METADATA_COMPLETE = TYPE_MAPPING__METADATA_COMPLETE;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__DESCRIPTION = TYPE_MAPPING__DESCRIPTION;
+
+ /**
+ * The feature id for the '<em><b>Attributes</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__ATTRIBUTES = TYPE_MAPPING__ATTRIBUTES;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__NAME = TYPE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__TABLE = TYPE_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Secondary Tables</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__SECONDARY_TABLES = TYPE_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__PRIMARY_KEY_JOIN_COLUMNS = TYPE_MAPPING_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Id Class</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__ID_CLASS = TYPE_MAPPING_FEATURE_COUNT + 4;
+
+ /**
+ * The feature id for the '<em><b>Inheritance</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__INHERITANCE = TYPE_MAPPING_FEATURE_COUNT + 5;
+
+ /**
+ * The feature id for the '<em><b>Discriminator Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__DISCRIMINATOR_VALUE = TYPE_MAPPING_FEATURE_COUNT + 6;
+
+ /**
+ * The feature id for the '<em><b>Discriminator Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__DISCRIMINATOR_COLUMN = TYPE_MAPPING_FEATURE_COUNT + 7;
+
+ /**
+ * The feature id for the '<em><b>Sequence Generator</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__SEQUENCE_GENERATOR = TYPE_MAPPING_FEATURE_COUNT + 8;
+
+ /**
+ * The feature id for the '<em><b>Table Generator</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__TABLE_GENERATOR = TYPE_MAPPING_FEATURE_COUNT + 9;
+
+ /**
+ * The feature id for the '<em><b>Named Queries</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__NAMED_QUERIES = TYPE_MAPPING_FEATURE_COUNT + 10;
+
+ /**
+ * The feature id for the '<em><b>Named Native Queries</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__NAMED_NATIVE_QUERIES = TYPE_MAPPING_FEATURE_COUNT + 11;
+
+ /**
+ * The feature id for the '<em><b>Sql Result Set Mappings</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__SQL_RESULT_SET_MAPPINGS = TYPE_MAPPING_FEATURE_COUNT + 12;
+
+ /**
+ * The feature id for the '<em><b>Exclude Default Listeners</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__EXCLUDE_DEFAULT_LISTENERS = TYPE_MAPPING_FEATURE_COUNT + 13;
+
+ /**
+ * The feature id for the '<em><b>Exclude Superclass Listeners</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__EXCLUDE_SUPERCLASS_LISTENERS = TYPE_MAPPING_FEATURE_COUNT + 14;
+
+ /**
+ * The feature id for the '<em><b>Entity Listeners</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__ENTITY_LISTENERS = TYPE_MAPPING_FEATURE_COUNT + 15;
+
+ /**
+ * The feature id for the '<em><b>Pre Persist</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__PRE_PERSIST = TYPE_MAPPING_FEATURE_COUNT + 16;
+
+ /**
+ * The feature id for the '<em><b>Post Persist</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__POST_PERSIST = TYPE_MAPPING_FEATURE_COUNT + 17;
+
+ /**
+ * The feature id for the '<em><b>Pre Remove</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__PRE_REMOVE = TYPE_MAPPING_FEATURE_COUNT + 18;
+
+ /**
+ * The feature id for the '<em><b>Post Remove</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__POST_REMOVE = TYPE_MAPPING_FEATURE_COUNT + 19;
+
+ /**
+ * The feature id for the '<em><b>Pre Update</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__PRE_UPDATE = TYPE_MAPPING_FEATURE_COUNT + 20;
+
+ /**
+ * The feature id for the '<em><b>Post Update</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__POST_UPDATE = TYPE_MAPPING_FEATURE_COUNT + 21;
+
+ /**
+ * The feature id for the '<em><b>Post Load</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__POST_LOAD = TYPE_MAPPING_FEATURE_COUNT + 22;
+
+ /**
+ * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__ATTRIBUTE_OVERRIDES = TYPE_MAPPING_FEATURE_COUNT + 23;
+
+ /**
+ * The feature id for the '<em><b>Association Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY__ASSOCIATION_OVERRIDES = TYPE_MAPPING_FEATURE_COUNT + 24;
+
+ /**
+ * The number of structural features of the '<em>Entity</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_FEATURE_COUNT = TYPE_MAPPING_FEATURE_COUNT + 25;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.Embeddable <em>Embeddable</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Embeddable
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbeddable()
+ * @generated
+ */
+ public static final int EMBEDDABLE = 6;
+
+ /**
+ * The feature id for the '<em><b>Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDABLE__CLASS_NAME = TYPE_MAPPING__CLASS_NAME;
+
+ /**
+ * The feature id for the '<em><b>Access</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDABLE__ACCESS = TYPE_MAPPING__ACCESS;
+
+ /**
+ * The feature id for the '<em><b>Metadata Complete</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDABLE__METADATA_COMPLETE = TYPE_MAPPING__METADATA_COMPLETE;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDABLE__DESCRIPTION = TYPE_MAPPING__DESCRIPTION;
+
+ /**
+ * The feature id for the '<em><b>Attributes</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDABLE__ATTRIBUTES = TYPE_MAPPING__ATTRIBUTES;
+
+ /**
+ * The number of structural features of the '<em>Embeddable</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDABLE_FEATURE_COUNT = TYPE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.Attributes <em>Attributes</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Attributes
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributes()
+ * @generated
+ */
+ public static final int ATTRIBUTES = 7;
+
+ /**
+ * The feature id for the '<em><b>Ids</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTES__IDS = 0;
+
+ /**
+ * The feature id for the '<em><b>Embedded Ids</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTES__EMBEDDED_IDS = 1;
+
+ /**
+ * The feature id for the '<em><b>Basics</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTES__BASICS = 2;
+
+ /**
+ * The feature id for the '<em><b>Versions</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTES__VERSIONS = 3;
+
+ /**
+ * The feature id for the '<em><b>Many To Ones</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTES__MANY_TO_ONES = 4;
+
+ /**
+ * The feature id for the '<em><b>One To Manys</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTES__ONE_TO_MANYS = 5;
+
+ /**
+ * The feature id for the '<em><b>One To Ones</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTES__ONE_TO_ONES = 6;
+
+ /**
+ * The feature id for the '<em><b>Many To Manys</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTES__MANY_TO_MANYS = 7;
+
+ /**
+ * The feature id for the '<em><b>Embeddeds</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTES__EMBEDDEDS = 8;
+
+ /**
+ * The feature id for the '<em><b>Transients</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTES__TRANSIENTS = 9;
+
+ /**
+ * The number of structural features of the '<em>Attributes</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTES_FEATURE_COUNT = 10;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeMapping <em>Attribute Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.AttributeMapping
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeMapping()
+ * @generated
+ */
+ public static final int ATTRIBUTE_MAPPING = 8;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTE_MAPPING__NAME = 0;
+
+ /**
+ * The number of structural features of the '<em>Attribute Mapping</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTE_MAPPING_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnMapping <em>Column Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.ColumnMapping
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumnMapping()
+ * @generated
+ */
+ public static final int COLUMN_MAPPING = 9;
+
+ /**
+ * The feature id for the '<em><b>Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN_MAPPING__COLUMN = 0;
+
+ /**
+ * The number of structural features of the '<em>Column Mapping</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN_MAPPING_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping <em>Relationship Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping()
+ * @generated
+ */
+ public static final int RELATIONSHIP_MAPPING = 10;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int RELATIONSHIP_MAPPING__NAME = ATTRIBUTE_MAPPING__NAME;
+
+ /**
+ * The feature id for the '<em><b>Target Entity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int RELATIONSHIP_MAPPING__TARGET_ENTITY = ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int RELATIONSHIP_MAPPING__FETCH = ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int RELATIONSHIP_MAPPING__JOIN_TABLE = ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int RELATIONSHIP_MAPPING__CASCADE = ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
+
+ /**
+ * The number of structural features of the '<em>Relationship Mapping</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int RELATIONSHIP_MAPPING_FEATURE_COUNT = ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping <em>Multi Relationship Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMultiRelationshipMapping()
+ * @generated
+ */
+ public static final int MULTI_RELATIONSHIP_MAPPING = 11;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MULTI_RELATIONSHIP_MAPPING__NAME = RELATIONSHIP_MAPPING__NAME;
+
+ /**
+ * The feature id for the '<em><b>Target Entity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MULTI_RELATIONSHIP_MAPPING__TARGET_ENTITY = RELATIONSHIP_MAPPING__TARGET_ENTITY;
+
+ /**
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MULTI_RELATIONSHIP_MAPPING__FETCH = RELATIONSHIP_MAPPING__FETCH;
+
+ /**
+ * The feature id for the '<em><b>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE = RELATIONSHIP_MAPPING__JOIN_TABLE;
+
+ /**
+ * The feature id for the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MULTI_RELATIONSHIP_MAPPING__CASCADE = RELATIONSHIP_MAPPING__CASCADE;
+
+ /**
+ * The feature id for the '<em><b>Mapped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MULTI_RELATIONSHIP_MAPPING__MAPPED_BY = RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Order By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MULTI_RELATIONSHIP_MAPPING__ORDER_BY = RELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Map Key</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MULTI_RELATIONSHIP_MAPPING__MAP_KEY = RELATIONSHIP_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The number of structural features of the '<em>Multi Relationship Mapping</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT = RELATIONSHIP_MAPPING_FEATURE_COUNT + 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping <em>Single Relationship Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSingleRelationshipMapping()
+ * @generated
+ */
+ public static final int SINGLE_RELATIONSHIP_MAPPING = 12;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SINGLE_RELATIONSHIP_MAPPING__NAME = RELATIONSHIP_MAPPING__NAME;
+
+ /**
+ * The feature id for the '<em><b>Target Entity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SINGLE_RELATIONSHIP_MAPPING__TARGET_ENTITY = RELATIONSHIP_MAPPING__TARGET_ENTITY;
+
+ /**
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SINGLE_RELATIONSHIP_MAPPING__FETCH = RELATIONSHIP_MAPPING__FETCH;
+
+ /**
+ * The feature id for the '<em><b>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SINGLE_RELATIONSHIP_MAPPING__JOIN_TABLE = RELATIONSHIP_MAPPING__JOIN_TABLE;
+
+ /**
+ * The feature id for the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SINGLE_RELATIONSHIP_MAPPING__CASCADE = RELATIONSHIP_MAPPING__CASCADE;
+
+ /**
+ * The feature id for the '<em><b>Optional</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SINGLE_RELATIONSHIP_MAPPING__OPTIONAL = RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS = RELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Single Relationship Mapping</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT = RELATIONSHIP_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.Id <em>Id</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Id
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getId()
+ * @generated
+ */
+ public static final int ID = 13;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ID__NAME = ATTRIBUTE_MAPPING__NAME;
+
+ /**
+ * The feature id for the '<em><b>Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ID__COLUMN = ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Generated Value</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ID__GENERATED_VALUE = ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Temporal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ID__TEMPORAL = ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Table Generator</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ID__TABLE_GENERATOR = ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Sequence Generator</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ID__SEQUENCE_GENERATOR = ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
+
+ /**
+ * The number of structural features of the '<em>Id</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ID_FEATURE_COUNT = ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.IdImpl <em>Id Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.IdImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getIdImpl()
+ * @generated
+ */
+ public static final int ID_IMPL = 14;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ID_IMPL__NAME = ID__NAME;
+
+ /**
+ * The feature id for the '<em><b>Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ID_IMPL__COLUMN = ID__COLUMN;
+
+ /**
+ * The feature id for the '<em><b>Generated Value</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ID_IMPL__GENERATED_VALUE = ID__GENERATED_VALUE;
+
+ /**
+ * The feature id for the '<em><b>Temporal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ID_IMPL__TEMPORAL = ID__TEMPORAL;
+
+ /**
+ * The feature id for the '<em><b>Table Generator</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ID_IMPL__TABLE_GENERATOR = ID__TABLE_GENERATOR;
+
+ /**
+ * The feature id for the '<em><b>Sequence Generator</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ID_IMPL__SEQUENCE_GENERATOR = ID__SEQUENCE_GENERATOR;
+
+ /**
+ * The number of structural features of the '<em>Id Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ID_IMPL_FEATURE_COUNT = ID_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedId <em>Embedded Id</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EmbeddedId
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbeddedId()
+ * @generated
+ */
+ public static final int EMBEDDED_ID = 15;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDED_ID__NAME = ATTRIBUTE_MAPPING__NAME;
+
+ /**
+ * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDED_ID__ATTRIBUTE_OVERRIDES = ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Embedded Id</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDED_ID_FEATURE_COUNT = ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedIdImpl <em>Embedded Id Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EmbeddedIdImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbeddedIdImpl()
+ * @generated
+ */
+ public static final int EMBEDDED_ID_IMPL = 16;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDED_ID_IMPL__NAME = EMBEDDED_ID__NAME;
+
+ /**
+ * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDED_ID_IMPL__ATTRIBUTE_OVERRIDES = EMBEDDED_ID__ATTRIBUTE_OVERRIDES;
+
+ /**
+ * The number of structural features of the '<em>Embedded Id Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDED_ID_IMPL_FEATURE_COUNT = EMBEDDED_ID_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.Basic <em>Basic</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Basic
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getBasic()
+ * @generated
+ */
+ public static final int BASIC = 17;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int BASIC__NAME = ATTRIBUTE_MAPPING__NAME;
+
+ /**
+ * The feature id for the '<em><b>Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int BASIC__COLUMN = ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int BASIC__FETCH = ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Optional</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int BASIC__OPTIONAL = ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Lob</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int BASIC__LOB = ATTRIBUTE_MAPPING_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Temporal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int BASIC__TEMPORAL = ATTRIBUTE_MAPPING_FEATURE_COUNT + 4;
+
+ /**
+ * The feature id for the '<em><b>Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int BASIC__ENUMERATED = ATTRIBUTE_MAPPING_FEATURE_COUNT + 5;
+
+ /**
+ * The number of structural features of the '<em>Basic</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int BASIC_FEATURE_COUNT = ATTRIBUTE_MAPPING_FEATURE_COUNT + 6;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.BasicImpl <em>Basic Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.BasicImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getBasicImpl()
+ * @generated
+ */
+ public static final int BASIC_IMPL = 18;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int BASIC_IMPL__NAME = BASIC__NAME;
+
+ /**
+ * The feature id for the '<em><b>Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int BASIC_IMPL__COLUMN = BASIC__COLUMN;
+
+ /**
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int BASIC_IMPL__FETCH = BASIC__FETCH;
+
+ /**
+ * The feature id for the '<em><b>Optional</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int BASIC_IMPL__OPTIONAL = BASIC__OPTIONAL;
+
+ /**
+ * The feature id for the '<em><b>Lob</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int BASIC_IMPL__LOB = BASIC__LOB;
+
+ /**
+ * The feature id for the '<em><b>Temporal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int BASIC_IMPL__TEMPORAL = BASIC__TEMPORAL;
+
+ /**
+ * The feature id for the '<em><b>Enumerated</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int BASIC_IMPL__ENUMERATED = BASIC__ENUMERATED;
+
+ /**
+ * The number of structural features of the '<em>Basic Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int BASIC_IMPL_FEATURE_COUNT = BASIC_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.Version <em>Version</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Version
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getVersion()
+ * @generated
+ */
+ public static final int VERSION = 19;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int VERSION__NAME = ATTRIBUTE_MAPPING__NAME;
+
+ /**
+ * The feature id for the '<em><b>Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int VERSION__COLUMN = ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Temporal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int VERSION__TEMPORAL = ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Version</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int VERSION_FEATURE_COUNT = ATTRIBUTE_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.VersionImpl <em>Version Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.VersionImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getVersionImpl()
+ * @generated
+ */
+ public static final int VERSION_IMPL = 20;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int VERSION_IMPL__NAME = VERSION__NAME;
+
+ /**
+ * The feature id for the '<em><b>Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int VERSION_IMPL__COLUMN = VERSION__COLUMN;
+
+ /**
+ * The feature id for the '<em><b>Temporal</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int VERSION_IMPL__TEMPORAL = VERSION__TEMPORAL;
+
+ /**
+ * The number of structural features of the '<em>Version Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int VERSION_IMPL_FEATURE_COUNT = VERSION_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToOne <em>Many To One</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.ManyToOne
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getManyToOne()
+ * @generated
+ */
+ public static final int MANY_TO_ONE = 21;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_ONE__NAME = SINGLE_RELATIONSHIP_MAPPING__NAME;
+
+ /**
+ * The feature id for the '<em><b>Target Entity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_ONE__TARGET_ENTITY = SINGLE_RELATIONSHIP_MAPPING__TARGET_ENTITY;
+
+ /**
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_ONE__FETCH = SINGLE_RELATIONSHIP_MAPPING__FETCH;
+
+ /**
+ * The feature id for the '<em><b>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_ONE__JOIN_TABLE = SINGLE_RELATIONSHIP_MAPPING__JOIN_TABLE;
+
+ /**
+ * The feature id for the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_ONE__CASCADE = SINGLE_RELATIONSHIP_MAPPING__CASCADE;
+
+ /**
+ * The feature id for the '<em><b>Optional</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_ONE__OPTIONAL = SINGLE_RELATIONSHIP_MAPPING__OPTIONAL;
+
+ /**
+ * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_ONE__JOIN_COLUMNS = SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS;
+
+ /**
+ * The number of structural features of the '<em>Many To One</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_ONE_FEATURE_COUNT = SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl <em>Many To One Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getManyToOneImpl()
+ * @generated
+ */
+ public static final int MANY_TO_ONE_IMPL = 22;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_ONE_IMPL__NAME = MANY_TO_ONE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Target Entity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_ONE_IMPL__TARGET_ENTITY = MANY_TO_ONE__TARGET_ENTITY;
+
+ /**
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_ONE_IMPL__FETCH = MANY_TO_ONE__FETCH;
+
+ /**
+ * The feature id for the '<em><b>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_ONE_IMPL__JOIN_TABLE = MANY_TO_ONE__JOIN_TABLE;
+
+ /**
+ * The feature id for the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_ONE_IMPL__CASCADE = MANY_TO_ONE__CASCADE;
+
+ /**
+ * The feature id for the '<em><b>Optional</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_ONE_IMPL__OPTIONAL = MANY_TO_ONE__OPTIONAL;
+
+ /**
+ * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_ONE_IMPL__JOIN_COLUMNS = MANY_TO_ONE__JOIN_COLUMNS;
+
+ /**
+ * The number of structural features of the '<em>Many To One Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_ONE_IMPL_FEATURE_COUNT = MANY_TO_ONE_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToMany <em>One To Many</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToMany
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToMany()
+ * @generated
+ */
+ public static final int ONE_TO_MANY = 23;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY__NAME = MULTI_RELATIONSHIP_MAPPING__NAME;
+
+ /**
+ * The feature id for the '<em><b>Target Entity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY__TARGET_ENTITY = MULTI_RELATIONSHIP_MAPPING__TARGET_ENTITY;
+
+ /**
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY__FETCH = MULTI_RELATIONSHIP_MAPPING__FETCH;
+
+ /**
+ * The feature id for the '<em><b>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY__JOIN_TABLE = MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE;
+
+ /**
+ * The feature id for the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY__CASCADE = MULTI_RELATIONSHIP_MAPPING__CASCADE;
+
+ /**
+ * The feature id for the '<em><b>Mapped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY__MAPPED_BY = MULTI_RELATIONSHIP_MAPPING__MAPPED_BY;
+
+ /**
+ * The feature id for the '<em><b>Order By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY__ORDER_BY = MULTI_RELATIONSHIP_MAPPING__ORDER_BY;
+
+ /**
+ * The feature id for the '<em><b>Map Key</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY__MAP_KEY = MULTI_RELATIONSHIP_MAPPING__MAP_KEY;
+
+ /**
+ * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY__JOIN_COLUMNS = MULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>One To Many</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY_FEATURE_COUNT = MULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl <em>One To Many Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToManyImpl()
+ * @generated
+ */
+ public static final int ONE_TO_MANY_IMPL = 24;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY_IMPL__NAME = ONE_TO_MANY__NAME;
+
+ /**
+ * The feature id for the '<em><b>Target Entity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY_IMPL__TARGET_ENTITY = ONE_TO_MANY__TARGET_ENTITY;
+
+ /**
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY_IMPL__FETCH = ONE_TO_MANY__FETCH;
+
+ /**
+ * The feature id for the '<em><b>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY_IMPL__JOIN_TABLE = ONE_TO_MANY__JOIN_TABLE;
+
+ /**
+ * The feature id for the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY_IMPL__CASCADE = ONE_TO_MANY__CASCADE;
+
+ /**
+ * The feature id for the '<em><b>Mapped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY_IMPL__MAPPED_BY = ONE_TO_MANY__MAPPED_BY;
+
+ /**
+ * The feature id for the '<em><b>Order By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY_IMPL__ORDER_BY = ONE_TO_MANY__ORDER_BY;
+
+ /**
+ * The feature id for the '<em><b>Map Key</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY_IMPL__MAP_KEY = ONE_TO_MANY__MAP_KEY;
+
+ /**
+ * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY_IMPL__JOIN_COLUMNS = ONE_TO_MANY__JOIN_COLUMNS;
+
+ /**
+ * The number of structural features of the '<em>One To Many Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_MANY_IMPL_FEATURE_COUNT = ONE_TO_MANY_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOne <em>One To One</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToOne
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToOne()
+ * @generated
+ */
+ public static final int ONE_TO_ONE = 25;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE__NAME = SINGLE_RELATIONSHIP_MAPPING__NAME;
+
+ /**
+ * The feature id for the '<em><b>Target Entity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE__TARGET_ENTITY = SINGLE_RELATIONSHIP_MAPPING__TARGET_ENTITY;
+
+ /**
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE__FETCH = SINGLE_RELATIONSHIP_MAPPING__FETCH;
+
+ /**
+ * The feature id for the '<em><b>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE__JOIN_TABLE = SINGLE_RELATIONSHIP_MAPPING__JOIN_TABLE;
+
+ /**
+ * The feature id for the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE__CASCADE = SINGLE_RELATIONSHIP_MAPPING__CASCADE;
+
+ /**
+ * The feature id for the '<em><b>Optional</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE__OPTIONAL = SINGLE_RELATIONSHIP_MAPPING__OPTIONAL;
+
+ /**
+ * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE__JOIN_COLUMNS = SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS;
+
+ /**
+ * The feature id for the '<em><b>Mapped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE__MAPPED_BY = SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE__PRIMARY_KEY_JOIN_COLUMNS = SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>One To One</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE_FEATURE_COUNT = SINGLE_RELATIONSHIP_MAPPING_FEATURE_COUNT + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl <em>One To One Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToOneImpl()
+ * @generated
+ */
+ public static final int ONE_TO_ONE_IMPL = 26;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE_IMPL__NAME = ONE_TO_ONE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Target Entity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE_IMPL__TARGET_ENTITY = ONE_TO_ONE__TARGET_ENTITY;
+
+ /**
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE_IMPL__FETCH = ONE_TO_ONE__FETCH;
+
+ /**
+ * The feature id for the '<em><b>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE_IMPL__JOIN_TABLE = ONE_TO_ONE__JOIN_TABLE;
+
+ /**
+ * The feature id for the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE_IMPL__CASCADE = ONE_TO_ONE__CASCADE;
+
+ /**
+ * The feature id for the '<em><b>Optional</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE_IMPL__OPTIONAL = ONE_TO_ONE__OPTIONAL;
+
+ /**
+ * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE_IMPL__JOIN_COLUMNS = ONE_TO_ONE__JOIN_COLUMNS;
+
+ /**
+ * The feature id for the '<em><b>Mapped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE_IMPL__MAPPED_BY = ONE_TO_ONE__MAPPED_BY;
+
+ /**
+ * The feature id for the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE_IMPL__PRIMARY_KEY_JOIN_COLUMNS = ONE_TO_ONE__PRIMARY_KEY_JOIN_COLUMNS;
+
+ /**
+ * The number of structural features of the '<em>One To One Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ONE_TO_ONE_IMPL_FEATURE_COUNT = ONE_TO_ONE_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToMany <em>Many To Many</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.ManyToMany
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getManyToMany()
+ * @generated
+ */
+ public static final int MANY_TO_MANY = 27;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY__NAME = MULTI_RELATIONSHIP_MAPPING__NAME;
+
+ /**
+ * The feature id for the '<em><b>Target Entity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY__TARGET_ENTITY = MULTI_RELATIONSHIP_MAPPING__TARGET_ENTITY;
+
+ /**
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY__FETCH = MULTI_RELATIONSHIP_MAPPING__FETCH;
+
+ /**
+ * The feature id for the '<em><b>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY__JOIN_TABLE = MULTI_RELATIONSHIP_MAPPING__JOIN_TABLE;
+
+ /**
+ * The feature id for the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY__CASCADE = MULTI_RELATIONSHIP_MAPPING__CASCADE;
+
+ /**
+ * The feature id for the '<em><b>Mapped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY__MAPPED_BY = MULTI_RELATIONSHIP_MAPPING__MAPPED_BY;
+
+ /**
+ * The feature id for the '<em><b>Order By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY__ORDER_BY = MULTI_RELATIONSHIP_MAPPING__ORDER_BY;
+
+ /**
+ * The feature id for the '<em><b>Map Key</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY__MAP_KEY = MULTI_RELATIONSHIP_MAPPING__MAP_KEY;
+
+ /**
+ * The number of structural features of the '<em>Many To Many</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY_FEATURE_COUNT = MULTI_RELATIONSHIP_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl <em>Many To Many Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getManyToManyImpl()
+ * @generated
+ */
+ public static final int MANY_TO_MANY_IMPL = 28;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY_IMPL__NAME = MANY_TO_MANY__NAME;
+
+ /**
+ * The feature id for the '<em><b>Target Entity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY_IMPL__TARGET_ENTITY = MANY_TO_MANY__TARGET_ENTITY;
+
+ /**
+ * The feature id for the '<em><b>Fetch</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY_IMPL__FETCH = MANY_TO_MANY__FETCH;
+
+ /**
+ * The feature id for the '<em><b>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY_IMPL__JOIN_TABLE = MANY_TO_MANY__JOIN_TABLE;
+
+ /**
+ * The feature id for the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY_IMPL__CASCADE = MANY_TO_MANY__CASCADE;
+
+ /**
+ * The feature id for the '<em><b>Mapped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY_IMPL__MAPPED_BY = MANY_TO_MANY__MAPPED_BY;
+
+ /**
+ * The feature id for the '<em><b>Order By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY_IMPL__ORDER_BY = MANY_TO_MANY__ORDER_BY;
+
+ /**
+ * The feature id for the '<em><b>Map Key</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY_IMPL__MAP_KEY = MANY_TO_MANY__MAP_KEY;
+
+ /**
+ * The number of structural features of the '<em>Many To Many Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MANY_TO_MANY_IMPL_FEATURE_COUNT = MANY_TO_MANY_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.Embedded <em>Embedded</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Embedded
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbedded()
+ * @generated
+ */
+ public static final int EMBEDDED = 29;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDED__NAME = ATTRIBUTE_MAPPING__NAME;
+
+ /**
+ * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDED__ATTRIBUTE_OVERRIDES = ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Embedded</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDED_FEATURE_COUNT = ATTRIBUTE_MAPPING_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedImpl <em>Embedded Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EmbeddedImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbeddedImpl()
+ * @generated
+ */
+ public static final int EMBEDDED_IMPL = 30;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDED_IMPL__NAME = EMBEDDED__NAME;
+
+ /**
+ * The feature id for the '<em><b>Attribute Overrides</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDED_IMPL__ATTRIBUTE_OVERRIDES = EMBEDDED__ATTRIBUTE_OVERRIDES;
+
+ /**
+ * The number of structural features of the '<em>Embedded Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EMBEDDED_IMPL_FEATURE_COUNT = EMBEDDED_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.Transient <em>Transient</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Transient
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTransient()
+ * @generated
+ */
+ public static final int TRANSIENT = 31;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TRANSIENT__NAME = ATTRIBUTE_MAPPING__NAME;
+
+ /**
+ * The number of structural features of the '<em>Transient</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TRANSIENT_FEATURE_COUNT = ATTRIBUTE_MAPPING_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.TransientImpl <em>Transient Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.TransientImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTransientImpl()
+ * @generated
+ */
+ public static final int TRANSIENT_IMPL = 32;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TRANSIENT_IMPL__NAME = TRANSIENT__NAME;
+
+ /**
+ * The number of structural features of the '<em>Transient Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TRANSIENT_IMPL_FEATURE_COUNT = TRANSIENT_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.AssociationOverride <em>Association Override</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.AssociationOverride
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAssociationOverride()
+ * @generated
+ */
+ public static final int ASSOCIATION_OVERRIDE = 33;
+
+ /**
+ * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ASSOCIATION_OVERRIDE__JOIN_COLUMNS = 0;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ASSOCIATION_OVERRIDE__NAME = 1;
+
+ /**
+ * The number of structural features of the '<em>Association Override</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ASSOCIATION_OVERRIDE_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverride <em>Attribute Override</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.AttributeOverride
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeOverride()
+ * @generated
+ */
+ public static final int ATTRIBUTE_OVERRIDE = 34;
+
+ /**
+ * The feature id for the '<em><b>Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTE_OVERRIDE__COLUMN = 0;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTE_OVERRIDE__NAME = 1;
+
+ /**
+ * The number of structural features of the '<em>Attribute Override</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTE_OVERRIDE_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverrideImpl <em>Attribute Override Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.AttributeOverrideImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeOverrideImpl()
+ * @generated
+ */
+ public static final int ATTRIBUTE_OVERRIDE_IMPL = 35;
+
+ /**
+ * The feature id for the '<em><b>Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTE_OVERRIDE_IMPL__COLUMN = ATTRIBUTE_OVERRIDE__COLUMN;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTE_OVERRIDE_IMPL__NAME = ATTRIBUTE_OVERRIDE__NAME;
+
+ /**
+ * The number of structural features of the '<em>Attribute Override Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ATTRIBUTE_OVERRIDE_IMPL_FEATURE_COUNT = ATTRIBUTE_OVERRIDE_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType <em>Cascade Type</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.CascadeType
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getCascadeType()
+ * @generated
+ */
+ public static final int CASCADE_TYPE = 36;
+
+ /**
+ * The feature id for the '<em><b>Cascade All</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int CASCADE_TYPE__CASCADE_ALL = 0;
+
+ /**
+ * The feature id for the '<em><b>Cascade Persist</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int CASCADE_TYPE__CASCADE_PERSIST = 1;
+
+ /**
+ * The feature id for the '<em><b>Cascade Merge</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int CASCADE_TYPE__CASCADE_MERGE = 2;
+
+ /**
+ * The feature id for the '<em><b>Cascade Remove</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int CASCADE_TYPE__CASCADE_REMOVE = 3;
+
+ /**
+ * The feature id for the '<em><b>Cascade Refresh</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int CASCADE_TYPE__CASCADE_REFRESH = 4;
+
+ /**
+ * The number of structural features of the '<em>Cascade Type</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int CASCADE_TYPE_FEATURE_COUNT = 5;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeTypeImpl <em>Cascade Type Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.CascadeTypeImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getCascadeTypeImpl()
+ * @generated
+ */
+ public static final int CASCADE_TYPE_IMPL = 37;
+
+ /**
+ * The feature id for the '<em><b>Cascade All</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int CASCADE_TYPE_IMPL__CASCADE_ALL = CASCADE_TYPE__CASCADE_ALL;
+
+ /**
+ * The feature id for the '<em><b>Cascade Persist</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int CASCADE_TYPE_IMPL__CASCADE_PERSIST = CASCADE_TYPE__CASCADE_PERSIST;
+
+ /**
+ * The feature id for the '<em><b>Cascade Merge</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int CASCADE_TYPE_IMPL__CASCADE_MERGE = CASCADE_TYPE__CASCADE_MERGE;
+
+ /**
+ * The feature id for the '<em><b>Cascade Remove</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int CASCADE_TYPE_IMPL__CASCADE_REMOVE = CASCADE_TYPE__CASCADE_REMOVE;
+
+ /**
+ * The feature id for the '<em><b>Cascade Refresh</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int CASCADE_TYPE_IMPL__CASCADE_REFRESH = CASCADE_TYPE__CASCADE_REFRESH;
+
+ /**
+ * The number of structural features of the '<em>Cascade Type Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int CASCADE_TYPE_IMPL_FEATURE_COUNT = CASCADE_TYPE_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.NamedColumn <em>Named Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.NamedColumn
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedColumn()
+ * @generated
+ */
+ public static final int NAMED_COLUMN = 38;
+
+ /**
+ * The feature id for the '<em><b>Column Definition</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int NAMED_COLUMN__COLUMN_DEFINITION = 0;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int NAMED_COLUMN__NAME = 1;
+
+ /**
+ * The number of structural features of the '<em>Named Column</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int NAMED_COLUMN_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn <em>Abstract Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractColumn
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn()
+ * @generated
+ */
+ public static final int ABSTRACT_COLUMN = 39;
+
+ /**
+ * The feature id for the '<em><b>Column Definition</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_COLUMN__COLUMN_DEFINITION = NAMED_COLUMN__COLUMN_DEFINITION;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_COLUMN__NAME = NAMED_COLUMN__NAME;
+
+ /**
+ * The feature id for the '<em><b>Insertable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_COLUMN__INSERTABLE = NAMED_COLUMN_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Nullable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_COLUMN__NULLABLE = NAMED_COLUMN_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Table</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_COLUMN__TABLE = NAMED_COLUMN_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Unique</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_COLUMN__UNIQUE = NAMED_COLUMN_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Updatable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_COLUMN__UPDATABLE = NAMED_COLUMN_FEATURE_COUNT + 4;
+
+ /**
+ * The number of structural features of the '<em>Abstract Column</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_COLUMN_FEATURE_COUNT = NAMED_COLUMN_FEATURE_COUNT + 5;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.Column <em>Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Column
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumn()
+ * @generated
+ */
+ public static final int COLUMN = 40;
+
+ /**
+ * The feature id for the '<em><b>Column Definition</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN__COLUMN_DEFINITION = ABSTRACT_COLUMN__COLUMN_DEFINITION;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN__NAME = ABSTRACT_COLUMN__NAME;
+
+ /**
+ * The feature id for the '<em><b>Insertable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN__INSERTABLE = ABSTRACT_COLUMN__INSERTABLE;
+
+ /**
+ * The feature id for the '<em><b>Nullable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN__NULLABLE = ABSTRACT_COLUMN__NULLABLE;
+
+ /**
+ * The feature id for the '<em><b>Table</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN__TABLE = ABSTRACT_COLUMN__TABLE;
+
+ /**
+ * The feature id for the '<em><b>Unique</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN__UNIQUE = ABSTRACT_COLUMN__UNIQUE;
+
+ /**
+ * The feature id for the '<em><b>Updatable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN__UPDATABLE = ABSTRACT_COLUMN__UPDATABLE;
+
+ /**
+ * The feature id for the '<em><b>Length</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN__LENGTH = ABSTRACT_COLUMN_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Precision</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN__PRECISION = ABSTRACT_COLUMN_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Scale</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN__SCALE = ABSTRACT_COLUMN_FEATURE_COUNT + 2;
+
+ /**
+ * The number of structural features of the '<em>Column</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN_FEATURE_COUNT = ABSTRACT_COLUMN_FEATURE_COUNT + 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnImpl <em>Column Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.ColumnImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumnImpl()
+ * @generated
+ */
+ public static final int COLUMN_IMPL = 41;
+
+ /**
+ * The feature id for the '<em><b>Column Definition</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN_IMPL__COLUMN_DEFINITION = COLUMN__COLUMN_DEFINITION;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN_IMPL__NAME = COLUMN__NAME;
+
+ /**
+ * The feature id for the '<em><b>Insertable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN_IMPL__INSERTABLE = COLUMN__INSERTABLE;
+
+ /**
+ * The feature id for the '<em><b>Nullable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN_IMPL__NULLABLE = COLUMN__NULLABLE;
+
+ /**
+ * The feature id for the '<em><b>Table</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN_IMPL__TABLE = COLUMN__TABLE;
+
+ /**
+ * The feature id for the '<em><b>Unique</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN_IMPL__UNIQUE = COLUMN__UNIQUE;
+
+ /**
+ * The feature id for the '<em><b>Updatable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN_IMPL__UPDATABLE = COLUMN__UPDATABLE;
+
+ /**
+ * The feature id for the '<em><b>Length</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN_IMPL__LENGTH = COLUMN__LENGTH;
+
+ /**
+ * The feature id for the '<em><b>Precision</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN_IMPL__PRECISION = COLUMN__PRECISION;
+
+ /**
+ * The feature id for the '<em><b>Scale</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN_IMPL__SCALE = COLUMN__SCALE;
+
+ /**
+ * The number of structural features of the '<em>Column Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN_IMPL_FEATURE_COUNT = COLUMN_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnResult <em>Column Result</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.ColumnResult
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumnResult()
+ * @generated
+ */
+ public static final int COLUMN_RESULT = 42;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN_RESULT__NAME = 0;
+
+ /**
+ * The number of structural features of the '<em>Column Result</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int COLUMN_RESULT_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn <em>Discriminator Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getDiscriminatorColumn()
+ * @generated
+ */
+ public static final int DISCRIMINATOR_COLUMN = 43;
+
+ /**
+ * The feature id for the '<em><b>Column Definition</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DISCRIMINATOR_COLUMN__COLUMN_DEFINITION = NAMED_COLUMN__COLUMN_DEFINITION;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DISCRIMINATOR_COLUMN__NAME = NAMED_COLUMN__NAME;
+
+ /**
+ * The feature id for the '<em><b>Discriminator Type</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE = NAMED_COLUMN_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Length</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DISCRIMINATOR_COLUMN__LENGTH = NAMED_COLUMN_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Discriminator Column</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DISCRIMINATOR_COLUMN_FEATURE_COUNT = NAMED_COLUMN_FEATURE_COUNT + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListeners <em>Entity Listeners</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListeners
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityListeners()
+ * @generated
+ */
+ public static final int ENTITY_LISTENERS = 44;
+
+ /**
+ * The feature id for the '<em><b>Entity Listeners</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_LISTENERS__ENTITY_LISTENERS = 0;
+
+ /**
+ * The number of structural features of the '<em>Entity Listeners</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_LISTENERS_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener <em>Entity Listener</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListener
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityListener()
+ * @generated
+ */
+ public static final int ENTITY_LISTENER = 45;
+
+ /**
+ * The feature id for the '<em><b>Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_LISTENER__CLASS_NAME = 0;
+
+ /**
+ * The feature id for the '<em><b>Pre Persist</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_LISTENER__PRE_PERSIST = 1;
+
+ /**
+ * The feature id for the '<em><b>Post Persist</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_LISTENER__POST_PERSIST = 2;
+
+ /**
+ * The feature id for the '<em><b>Pre Remove</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_LISTENER__PRE_REMOVE = 3;
+
+ /**
+ * The feature id for the '<em><b>Post Remove</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_LISTENER__POST_REMOVE = 4;
+
+ /**
+ * The feature id for the '<em><b>Pre Update</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_LISTENER__PRE_UPDATE = 5;
+
+ /**
+ * The feature id for the '<em><b>Post Update</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_LISTENER__POST_UPDATE = 6;
+
+ /**
+ * The feature id for the '<em><b>Post Load</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_LISTENER__POST_LOAD = 7;
+
+ /**
+ * The number of structural features of the '<em>Entity Listener</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_LISTENER_FEATURE_COUNT = 8;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityResult <em>Entity Result</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityResult
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityResult()
+ * @generated
+ */
+ public static final int ENTITY_RESULT = 46;
+
+ /**
+ * The feature id for the '<em><b>Discriminator Column</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_RESULT__DISCRIMINATOR_COLUMN = 0;
+
+ /**
+ * The feature id for the '<em><b>Entity Class</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_RESULT__ENTITY_CLASS = 1;
+
+ /**
+ * The feature id for the '<em><b>Field Results</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_RESULT__FIELD_RESULTS = 2;
+
+ /**
+ * The number of structural features of the '<em>Entity Result</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ENTITY_RESULT_FEATURE_COUNT = 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.FieldResult <em>Field Result</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.FieldResult
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getFieldResult()
+ * @generated
+ */
+ public static final int FIELD_RESULT = 48;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.GeneratedValue <em>Generated Value</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.GeneratedValue
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGeneratedValue()
+ * @generated
+ */
+ public static final int GENERATED_VALUE = 49;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.IdClass <em>Id Class</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.IdClass
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getIdClass()
+ * @generated
+ */
+ public static final int ID_CLASS = 51;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.Inheritance <em>Inheritance</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Inheritance
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getInheritance()
+ * @generated
+ */
+ public static final int INHERITANCE = 52;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn <em>Join Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinColumn
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinColumn()
+ * @generated
+ */
+ public static final int JOIN_COLUMN = 53;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinTable <em>Join Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinTable
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinTable()
+ * @generated
+ */
+ public static final int JOIN_TABLE = 55;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.Lob <em>Lob</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Lob
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getLob()
+ * @generated
+ */
+ public static final int LOB = 57;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.MapKey <em>Map Key</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.MapKey
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMapKey()
+ * @generated
+ */
+ public static final int MAP_KEY = 58;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.EventMethod <em>Event Method</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EventMethod
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEventMethod()
+ * @generated
+ */
+ public static final int EVENT_METHOD = 47;
+
+ /**
+ * The feature id for the '<em><b>Method Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EVENT_METHOD__METHOD_NAME = 0;
+
+ /**
+ * The number of structural features of the '<em>Event Method</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int EVENT_METHOD_FEATURE_COUNT = 1;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int FIELD_RESULT__NAME = 0;
+
+ /**
+ * The feature id for the '<em><b>Column</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int FIELD_RESULT__COLUMN = 1;
+
+ /**
+ * The number of structural features of the '<em>Field Result</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int FIELD_RESULT_FEATURE_COUNT = 2;
+
+ /**
+ * The feature id for the '<em><b>Generator</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int GENERATED_VALUE__GENERATOR = 0;
+
+ /**
+ * The feature id for the '<em><b>Strategy</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int GENERATED_VALUE__STRATEGY = 1;
+
+ /**
+ * The number of structural features of the '<em>Generated Value</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int GENERATED_VALUE_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.GeneratedValueImpl <em>Generated Value Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.GeneratedValueImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGeneratedValueImpl()
+ * @generated
+ */
+ public static final int GENERATED_VALUE_IMPL = 50;
+
+ /**
+ * The feature id for the '<em><b>Generator</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int GENERATED_VALUE_IMPL__GENERATOR = GENERATED_VALUE__GENERATOR;
+
+ /**
+ * The feature id for the '<em><b>Strategy</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int GENERATED_VALUE_IMPL__STRATEGY = GENERATED_VALUE__STRATEGY;
+
+ /**
+ * The number of structural features of the '<em>Generated Value Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int GENERATED_VALUE_IMPL_FEATURE_COUNT = GENERATED_VALUE_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ID_CLASS__CLASS_NAME = 0;
+
+ /**
+ * The number of structural features of the '<em>Id Class</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ID_CLASS_FEATURE_COUNT = 1;
+
+ /**
+ * The feature id for the '<em><b>Strategy</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int INHERITANCE__STRATEGY = 0;
+
+ /**
+ * The number of structural features of the '<em>Inheritance</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int INHERITANCE_FEATURE_COUNT = 1;
+
+ /**
+ * The feature id for the '<em><b>Column Definition</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN__COLUMN_DEFINITION = ABSTRACT_COLUMN__COLUMN_DEFINITION;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN__NAME = ABSTRACT_COLUMN__NAME;
+
+ /**
+ * The feature id for the '<em><b>Insertable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN__INSERTABLE = ABSTRACT_COLUMN__INSERTABLE;
+
+ /**
+ * The feature id for the '<em><b>Nullable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN__NULLABLE = ABSTRACT_COLUMN__NULLABLE;
+
+ /**
+ * The feature id for the '<em><b>Table</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN__TABLE = ABSTRACT_COLUMN__TABLE;
+
+ /**
+ * The feature id for the '<em><b>Unique</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN__UNIQUE = ABSTRACT_COLUMN__UNIQUE;
+
+ /**
+ * The feature id for the '<em><b>Updatable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN__UPDATABLE = ABSTRACT_COLUMN__UPDATABLE;
+
+ /**
+ * The feature id for the '<em><b>Referenced Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN__REFERENCED_COLUMN_NAME = ABSTRACT_COLUMN_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Join Column</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN_FEATURE_COUNT = ABSTRACT_COLUMN_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumnImpl <em>Join Column Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinColumnImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinColumnImpl()
+ * @generated
+ */
+ public static final int JOIN_COLUMN_IMPL = 54;
+
+ /**
+ * The feature id for the '<em><b>Column Definition</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN_IMPL__COLUMN_DEFINITION = JOIN_COLUMN__COLUMN_DEFINITION;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN_IMPL__NAME = JOIN_COLUMN__NAME;
+
+ /**
+ * The feature id for the '<em><b>Insertable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN_IMPL__INSERTABLE = JOIN_COLUMN__INSERTABLE;
+
+ /**
+ * The feature id for the '<em><b>Nullable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN_IMPL__NULLABLE = JOIN_COLUMN__NULLABLE;
+
+ /**
+ * The feature id for the '<em><b>Table</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN_IMPL__TABLE = JOIN_COLUMN__TABLE;
+
+ /**
+ * The feature id for the '<em><b>Unique</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN_IMPL__UNIQUE = JOIN_COLUMN__UNIQUE;
+
+ /**
+ * The feature id for the '<em><b>Updatable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN_IMPL__UPDATABLE = JOIN_COLUMN__UPDATABLE;
+
+ /**
+ * The feature id for the '<em><b>Referenced Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN_IMPL__REFERENCED_COLUMN_NAME = JOIN_COLUMN__REFERENCED_COLUMN_NAME;
+
+ /**
+ * The number of structural features of the '<em>Join Column Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_COLUMN_IMPL_FEATURE_COUNT = JOIN_COLUMN_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractTable <em>Abstract Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractTable
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable()
+ * @generated
+ */
+ public static final int ABSTRACT_TABLE = 72;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_TABLE__NAME = 0;
+
+ /**
+ * The feature id for the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_TABLE__CATALOG = 1;
+
+ /**
+ * The feature id for the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_TABLE__SCHEMA = 2;
+
+ /**
+ * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_TABLE__UNIQUE_CONSTRAINTS = 3;
+
+ /**
+ * The number of structural features of the '<em>Abstract Table</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int ABSTRACT_TABLE_FEATURE_COUNT = 4;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_TABLE__NAME = ABSTRACT_TABLE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_TABLE__CATALOG = ABSTRACT_TABLE__CATALOG;
+
+ /**
+ * The feature id for the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_TABLE__SCHEMA = ABSTRACT_TABLE__SCHEMA;
+
+ /**
+ * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_TABLE__UNIQUE_CONSTRAINTS = ABSTRACT_TABLE__UNIQUE_CONSTRAINTS;
+
+ /**
+ * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_TABLE__JOIN_COLUMNS = ABSTRACT_TABLE_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Inverse Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_TABLE__INVERSE_JOIN_COLUMNS = ABSTRACT_TABLE_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Join Table</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_TABLE_FEATURE_COUNT = ABSTRACT_TABLE_FEATURE_COUNT + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinTableImpl <em>Join Table Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinTableImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinTableImpl()
+ * @generated
+ */
+ public static final int JOIN_TABLE_IMPL = 56;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_TABLE_IMPL__NAME = JOIN_TABLE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_TABLE_IMPL__CATALOG = JOIN_TABLE__CATALOG;
+
+ /**
+ * The feature id for the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_TABLE_IMPL__SCHEMA = JOIN_TABLE__SCHEMA;
+
+ /**
+ * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_TABLE_IMPL__UNIQUE_CONSTRAINTS = JOIN_TABLE__UNIQUE_CONSTRAINTS;
+
+ /**
+ * The feature id for the '<em><b>Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_TABLE_IMPL__JOIN_COLUMNS = JOIN_TABLE__JOIN_COLUMNS;
+
+ /**
+ * The feature id for the '<em><b>Inverse Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_TABLE_IMPL__INVERSE_JOIN_COLUMNS = JOIN_TABLE__INVERSE_JOIN_COLUMNS;
+
+ /**
+ * The number of structural features of the '<em>Join Table Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int JOIN_TABLE_IMPL_FEATURE_COUNT = JOIN_TABLE_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Lob</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int LOB_FEATURE_COUNT = 0;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAP_KEY__NAME = 0;
+
+ /**
+ * The number of structural features of the '<em>Map Key</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAP_KEY_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.MapKeyImpl <em>Map Key Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.MapKeyImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMapKeyImpl()
+ * @generated
+ */
+ public static final int MAP_KEY_IMPL = 59;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAP_KEY_IMPL__NAME = MAP_KEY__NAME;
+
+ /**
+ * The number of structural features of the '<em>Map Key Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int MAP_KEY_IMPL_FEATURE_COUNT = MAP_KEY_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.Query <em>Query</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Query
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQuery()
+ * @generated
+ */
+ public static final int QUERY = 60;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int QUERY__NAME = 0;
+
+ /**
+ * The feature id for the '<em><b>Query</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int QUERY__QUERY = 1;
+
+ /**
+ * The feature id for the '<em><b>Hints</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int QUERY__HINTS = 2;
+
+ /**
+ * The number of structural features of the '<em>Query</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int QUERY_FEATURE_COUNT = 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery <em>Named Native Query</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedNativeQuery()
+ * @generated
+ */
+ public static final int NAMED_NATIVE_QUERY = 61;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int NAMED_NATIVE_QUERY__NAME = QUERY__NAME;
+
+ /**
+ * The feature id for the '<em><b>Query</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int NAMED_NATIVE_QUERY__QUERY = QUERY__QUERY;
+
+ /**
+ * The feature id for the '<em><b>Hints</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int NAMED_NATIVE_QUERY__HINTS = QUERY__HINTS;
+
+ /**
+ * The feature id for the '<em><b>Result Class</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int NAMED_NATIVE_QUERY__RESULT_CLASS = QUERY_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Result Set Mapping</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int NAMED_NATIVE_QUERY__RESULT_SET_MAPPING = QUERY_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Named Native Query</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int NAMED_NATIVE_QUERY_FEATURE_COUNT = QUERY_FEATURE_COUNT + 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.NamedQuery <em>Named Query</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.NamedQuery
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedQuery()
+ * @generated
+ */
+ public static final int NAMED_QUERY = 62;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int NAMED_QUERY__NAME = QUERY__NAME;
+
+ /**
+ * The feature id for the '<em><b>Query</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int NAMED_QUERY__QUERY = QUERY__QUERY;
+
+ /**
+ * The feature id for the '<em><b>Hints</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int NAMED_QUERY__HINTS = QUERY__HINTS;
+
+ /**
+ * The number of structural features of the '<em>Named Query</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int NAMED_QUERY_FEATURE_COUNT = QUERY_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.PostLoad <em>Post Load</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PostLoad
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPostLoad()
+ * @generated
+ */
+ public static final int POST_LOAD = 63;
+
+ /**
+ * The feature id for the '<em><b>Method Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int POST_LOAD__METHOD_NAME = EVENT_METHOD__METHOD_NAME;
+
+ /**
+ * The number of structural features of the '<em>Post Load</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int POST_LOAD_FEATURE_COUNT = EVENT_METHOD_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.PostPersist <em>Post Persist</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PostPersist
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPostPersist()
+ * @generated
+ */
+ public static final int POST_PERSIST = 64;
+
+ /**
+ * The feature id for the '<em><b>Method Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int POST_PERSIST__METHOD_NAME = EVENT_METHOD__METHOD_NAME;
+
+ /**
+ * The number of structural features of the '<em>Post Persist</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int POST_PERSIST_FEATURE_COUNT = EVENT_METHOD_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.PostRemove <em>Post Remove</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PostRemove
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPostRemove()
+ * @generated
+ */
+ public static final int POST_REMOVE = 65;
+
+ /**
+ * The feature id for the '<em><b>Method Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int POST_REMOVE__METHOD_NAME = EVENT_METHOD__METHOD_NAME;
+
+ /**
+ * The number of structural features of the '<em>Post Remove</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int POST_REMOVE_FEATURE_COUNT = EVENT_METHOD_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.PostUpdate <em>Post Update</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PostUpdate
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPostUpdate()
+ * @generated
+ */
+ public static final int POST_UPDATE = 66;
+
+ /**
+ * The feature id for the '<em><b>Method Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int POST_UPDATE__METHOD_NAME = EVENT_METHOD__METHOD_NAME;
+
+ /**
+ * The number of structural features of the '<em>Post Update</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int POST_UPDATE_FEATURE_COUNT = EVENT_METHOD_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.PrePersist <em>Pre Persist</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PrePersist
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPrePersist()
+ * @generated
+ */
+ public static final int PRE_PERSIST = 67;
+
+ /**
+ * The feature id for the '<em><b>Method Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PRE_PERSIST__METHOD_NAME = EVENT_METHOD__METHOD_NAME;
+
+ /**
+ * The number of structural features of the '<em>Pre Persist</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PRE_PERSIST_FEATURE_COUNT = EVENT_METHOD_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.PreRemove <em>Pre Remove</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PreRemove
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPreRemove()
+ * @generated
+ */
+ public static final int PRE_REMOVE = 68;
+
+ /**
+ * The feature id for the '<em><b>Method Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PRE_REMOVE__METHOD_NAME = EVENT_METHOD__METHOD_NAME;
+
+ /**
+ * The number of structural features of the '<em>Pre Remove</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PRE_REMOVE_FEATURE_COUNT = EVENT_METHOD_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.PreUpdate <em>Pre Update</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PreUpdate
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPreUpdate()
+ * @generated
+ */
+ public static final int PRE_UPDATE = 69;
+
+ /**
+ * The feature id for the '<em><b>Method Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PRE_UPDATE__METHOD_NAME = EVENT_METHOD__METHOD_NAME;
+
+ /**
+ * The number of structural features of the '<em>Pre Update</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PRE_UPDATE_FEATURE_COUNT = EVENT_METHOD_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.QueryHint <em>Query Hint</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.QueryHint
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQueryHint()
+ * @generated
+ */
+ public static final int QUERY_HINT = 71;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping <em>Sql Result Set Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSqlResultSetMapping()
+ * @generated
+ */
+ public static final int SQL_RESULT_SET_MAPPING = 78;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn <em>Primary Key Join Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPrimaryKeyJoinColumn()
+ * @generated
+ */
+ public static final int PRIMARY_KEY_JOIN_COLUMN = 70;
+
+ /**
+ * The feature id for the '<em><b>Column Definition</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION = NAMED_COLUMN__COLUMN_DEFINITION;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PRIMARY_KEY_JOIN_COLUMN__NAME = NAMED_COLUMN__NAME;
+
+ /**
+ * The feature id for the '<em><b>Referenced Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME = NAMED_COLUMN_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Primary Key Join Column</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int PRIMARY_KEY_JOIN_COLUMN_FEATURE_COUNT = NAMED_COLUMN_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int QUERY_HINT__NAME = 0;
+
+ /**
+ * The feature id for the '<em><b>Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int QUERY_HINT__VALUE = 1;
+
+ /**
+ * The number of structural features of the '<em>Query Hint</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int QUERY_HINT_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.SecondaryTable <em>Secondary Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.SecondaryTable
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSecondaryTable()
+ * @generated
+ */
+ public static final int SECONDARY_TABLE = 74;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator <em>Sequence Generator</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSequenceGenerator()
+ * @generated
+ */
+ public static final int SEQUENCE_GENERATOR = 76;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.Table <em>Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Table
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTable()
+ * @generated
+ */
+ public static final int TABLE = 73;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE__NAME = ABSTRACT_TABLE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE__CATALOG = ABSTRACT_TABLE__CATALOG;
+
+ /**
+ * The feature id for the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE__SCHEMA = ABSTRACT_TABLE__SCHEMA;
+
+ /**
+ * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE__UNIQUE_CONSTRAINTS = ABSTRACT_TABLE__UNIQUE_CONSTRAINTS;
+
+ /**
+ * The number of structural features of the '<em>Table</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_FEATURE_COUNT = ABSTRACT_TABLE_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SECONDARY_TABLE__NAME = ABSTRACT_TABLE__NAME;
+
+ /**
+ * The feature id for the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SECONDARY_TABLE__CATALOG = ABSTRACT_TABLE__CATALOG;
+
+ /**
+ * The feature id for the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SECONDARY_TABLE__SCHEMA = ABSTRACT_TABLE__SCHEMA;
+
+ /**
+ * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SECONDARY_TABLE__UNIQUE_CONSTRAINTS = ABSTRACT_TABLE__UNIQUE_CONSTRAINTS;
+
+ /**
+ * The feature id for the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS = ABSTRACT_TABLE_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Secondary Table</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SECONDARY_TABLE_FEATURE_COUNT = ABSTRACT_TABLE_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.Generator <em>Generator</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Generator
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGenerator()
+ * @generated
+ */
+ public static final int GENERATOR = 75;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int GENERATOR__NAME = 0;
+
+ /**
+ * The feature id for the '<em><b>Initial Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int GENERATOR__INITIAL_VALUE = 1;
+
+ /**
+ * The feature id for the '<em><b>Allocation Size</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int GENERATOR__ALLOCATION_SIZE = 2;
+
+ /**
+ * The number of structural features of the '<em>Generator</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int GENERATOR_FEATURE_COUNT = 3;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SEQUENCE_GENERATOR__NAME = GENERATOR__NAME;
+
+ /**
+ * The feature id for the '<em><b>Initial Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SEQUENCE_GENERATOR__INITIAL_VALUE = GENERATOR__INITIAL_VALUE;
+
+ /**
+ * The feature id for the '<em><b>Allocation Size</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SEQUENCE_GENERATOR__ALLOCATION_SIZE = GENERATOR__ALLOCATION_SIZE;
+
+ /**
+ * The feature id for the '<em><b>Sequence Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SEQUENCE_GENERATOR__SEQUENCE_NAME = GENERATOR_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Sequence Generator</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SEQUENCE_GENERATOR_FEATURE_COUNT = GENERATOR_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.SequenceGeneratorImpl <em>Sequence Generator Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.SequenceGeneratorImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSequenceGeneratorImpl()
+ * @generated
+ */
+ public static final int SEQUENCE_GENERATOR_IMPL = 77;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SEQUENCE_GENERATOR_IMPL__NAME = SEQUENCE_GENERATOR__NAME;
+
+ /**
+ * The feature id for the '<em><b>Initial Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SEQUENCE_GENERATOR_IMPL__INITIAL_VALUE = SEQUENCE_GENERATOR__INITIAL_VALUE;
+
+ /**
+ * The feature id for the '<em><b>Allocation Size</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SEQUENCE_GENERATOR_IMPL__ALLOCATION_SIZE = SEQUENCE_GENERATOR__ALLOCATION_SIZE;
+
+ /**
+ * The feature id for the '<em><b>Sequence Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SEQUENCE_GENERATOR_IMPL__SEQUENCE_NAME = SEQUENCE_GENERATOR__SEQUENCE_NAME;
+
+ /**
+ * The number of structural features of the '<em>Sequence Generator Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SEQUENCE_GENERATOR_IMPL_FEATURE_COUNT = SEQUENCE_GENERATOR_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SQL_RESULT_SET_MAPPING__NAME = 0;
+
+ /**
+ * The feature id for the '<em><b>Entity Results</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SQL_RESULT_SET_MAPPING__ENTITY_RESULTS = 1;
+
+ /**
+ * The feature id for the '<em><b>Column Results</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SQL_RESULT_SET_MAPPING__COLUMN_RESULTS = 2;
+
+ /**
+ * The number of structural features of the '<em>Sql Result Set Mapping</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int SQL_RESULT_SET_MAPPING_FEATURE_COUNT = 3;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator <em>Table Generator</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.TableGenerator
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator()
+ * @generated
+ */
+ public static final int TABLE_GENERATOR = 79;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR__NAME = GENERATOR__NAME;
+
+ /**
+ * The feature id for the '<em><b>Initial Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR__INITIAL_VALUE = GENERATOR__INITIAL_VALUE;
+
+ /**
+ * The feature id for the '<em><b>Allocation Size</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR__ALLOCATION_SIZE = GENERATOR__ALLOCATION_SIZE;
+
+ /**
+ * The feature id for the '<em><b>Table</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR__TABLE = GENERATOR_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR__CATALOG = GENERATOR_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR__SCHEMA = GENERATOR_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Pk Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR__PK_COLUMN_NAME = GENERATOR_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Value Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR__VALUE_COLUMN_NAME = GENERATOR_FEATURE_COUNT + 4;
+
+ /**
+ * The feature id for the '<em><b>Pk Column Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR__PK_COLUMN_VALUE = GENERATOR_FEATURE_COUNT + 5;
+
+ /**
+ * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR__UNIQUE_CONSTRAINTS = GENERATOR_FEATURE_COUNT + 6;
+
+ /**
+ * The number of structural features of the '<em>Table Generator</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR_FEATURE_COUNT = GENERATOR_FEATURE_COUNT + 7;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl <em>Table Generator Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGeneratorImpl()
+ * @generated
+ */
+ public static final int TABLE_GENERATOR_IMPL = 80;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR_IMPL__NAME = TABLE_GENERATOR__NAME;
+
+ /**
+ * The feature id for the '<em><b>Initial Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR_IMPL__INITIAL_VALUE = TABLE_GENERATOR__INITIAL_VALUE;
+
+ /**
+ * The feature id for the '<em><b>Allocation Size</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR_IMPL__ALLOCATION_SIZE = TABLE_GENERATOR__ALLOCATION_SIZE;
+
+ /**
+ * The feature id for the '<em><b>Table</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR_IMPL__TABLE = TABLE_GENERATOR__TABLE;
+
+ /**
+ * The feature id for the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR_IMPL__CATALOG = TABLE_GENERATOR__CATALOG;
+
+ /**
+ * The feature id for the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR_IMPL__SCHEMA = TABLE_GENERATOR__SCHEMA;
+
+ /**
+ * The feature id for the '<em><b>Pk Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR_IMPL__PK_COLUMN_NAME = TABLE_GENERATOR__PK_COLUMN_NAME;
+
+ /**
+ * The feature id for the '<em><b>Value Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR_IMPL__VALUE_COLUMN_NAME = TABLE_GENERATOR__VALUE_COLUMN_NAME;
+
+ /**
+ * The feature id for the '<em><b>Pk Column Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR_IMPL__PK_COLUMN_VALUE = TABLE_GENERATOR__PK_COLUMN_VALUE;
+
+ /**
+ * The feature id for the '<em><b>Unique Constraints</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR_IMPL__UNIQUE_CONSTRAINTS = TABLE_GENERATOR__UNIQUE_CONSTRAINTS;
+
+ /**
+ * The number of structural features of the '<em>Table Generator Impl</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int TABLE_GENERATOR_IMPL_FEATURE_COUNT = TABLE_GENERATOR_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint <em>Unique Constraint</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getUniqueConstraint()
+ * @generated
+ */
+ public static final int UNIQUE_CONSTRAINT = 81;
+
+ /**
+ * The feature id for the '<em><b>Column Names</b></em>' attribute list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int UNIQUE_CONSTRAINT__COLUMN_NAMES = 0;
+
+ /**
+ * The number of structural features of the '<em>Unique Constraint</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int UNIQUE_CONSTRAINT_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.AccessType <em>Access Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.AccessType
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAccessType()
+ * @generated
+ */
+ public static final int ACCESS_TYPE = 82;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType <em>Discriminator Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getDiscriminatorType()
+ * @generated
+ */
+ public static final int DISCRIMINATOR_TYPE = 83;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.EnumType <em>Enum Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EnumType
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEnumType()
+ * @generated
+ */
+ public static final int ENUM_TYPE = 84;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.FetchType <em>Fetch Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getFetchType()
+ * @generated
+ */
+ public static final int FETCH_TYPE = 85;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.GenerationType <em>Generation Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.GenerationType
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGenerationType()
+ * @generated
+ */
+ public static final int GENERATION_TYPE = 86;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.InheritanceType <em>Inheritance Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.InheritanceType
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getInheritanceType()
+ * @generated
+ */
+ public static final int INHERITANCE_TYPE = 87;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.orm.TemporalType <em>Temporal Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.TemporalType
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTemporalType()
+ * @generated
+ */
+ public static final int TEMPORAL_TYPE = 88;
+
+ /**
+ * The meta object id for the '<em>Discriminator Value</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see java.lang.String
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getDiscriminatorValue()
+ * @generated
+ */
+ public static final int DISCRIMINATOR_VALUE = 89;
+
+ /**
+ * The meta object id for the '<em>Enumerated</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.common.util.Enumerator
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEnumerated()
+ * @generated
+ */
+ public static final int ENUMERATED = 90;
+
+ /**
+ * The meta object id for the '<em>Order By</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see java.lang.String
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOrderBy()
+ * @generated
+ */
+ public static final int ORDER_BY = 91;
+
+ /**
+ * The meta object id for the '<em>Version Type</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see java.lang.String
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getVersionType()
+ * @generated
+ */
+ public static final int VERSION_TYPE = 92;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass entityMappingsEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass persistenceUnitMetadataEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass persistenceUnitDefaultsEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass typeMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass mappedSuperclassEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass entityEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass embeddableEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass attributesEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass attributeMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass columnMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass relationshipMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass multiRelationshipMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass singleRelationshipMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass idEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass idImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass embeddedIdEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass embeddedIdImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass basicEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass basicImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass versionEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass versionImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass manyToOneEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass manyToOneImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass oneToManyEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass oneToManyImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass oneToOneEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass oneToOneImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass manyToManyEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass manyToManyImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass embeddedEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass embeddedImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass transientEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass transientImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass associationOverrideEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass attributeOverrideEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass attributeOverrideImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass cascadeTypeEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass cascadeTypeImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass namedColumnEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass abstractColumnEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass columnEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass columnImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass columnResultEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass discriminatorColumnEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass entityListenersEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass entityListenerEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass entityResultEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass fieldResultEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass generatedValueEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass generatedValueImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass idClassEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass inheritanceEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass joinColumnEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass joinColumnImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass joinTableEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass joinTableImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass lobEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass mapKeyEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass mapKeyImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass queryEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass eventMethodEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass namedNativeQueryEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass namedQueryEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass postLoadEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass postPersistEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass postRemoveEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass postUpdateEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass prePersistEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass preRemoveEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass preUpdateEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass queryHintEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass abstractTableEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass sqlResultSetMappingEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass primaryKeyJoinColumnEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass secondaryTableEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass generatorEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass sequenceGeneratorEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass sequenceGeneratorImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass tableEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass tableGeneratorEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass tableGeneratorImplEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass uniqueConstraintEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum accessTypeEEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum discriminatorTypeEEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum enumTypeEEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum fetchTypeEEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum generationTypeEEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum inheritanceTypeEEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum temporalTypeEEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EDataType discriminatorValueEDataType = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EDataType enumeratedEDataType = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EDataType orderByEDataType = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EDataType versionTypeEDataType = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private OrmPackage()
+ {
+ super(eNS_URI, OrmFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this
+ * model, and for any others upon which it depends. Simple
+ * dependencies are satisfied by calling this method on all
+ * dependent packages before doing anything else. This method drives
+ * initialization for interdependent packages directly, in parallel
+ * with this package, itself.
+ * <p>Of this package and its interdependencies, all packages which
+ * have not yet been registered by their URI values are first created
+ * and registered. The packages are then initialized in two steps:
+ * meta-model objects for all of the packages are created before any
+ * are initialized, since one package's meta-model objects may refer to
+ * those of another.
+ * <p>Invocation of this method will not affect any packages that have
+ * already been initialized.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static OrmPackage init()
+ {
+ if (isInited) return (OrmPackage)EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI);
+
+ // Obtain or create and register package
+ OrmPackage theOrmPackage = (OrmPackage)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof OrmPackage ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new OrmPackage());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ EcorePackage.eINSTANCE.eClass();
+ XMLTypePackage.eINSTANCE.eClass();
+
+ // Obtain or create and register interdependencies
+ PersistencePackage thePersistencePackage = (PersistencePackage)(EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI) instanceof PersistencePackage ? EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI) : PersistencePackage.eINSTANCE);
+
+ // Create package meta-data objects
+ theOrmPackage.createPackageContents();
+ thePersistencePackage.createPackageContents();
+
+ // Initialize created meta-data
+ theOrmPackage.initializePackageContents();
+ thePersistencePackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theOrmPackage.freeze();
+
+ return theOrmPackage;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings <em>Entity Mappings</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Entity Mappings</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings
+ * @generated
+ */
+ public EClass getEntityMappings()
+ {
+ return entityMappingsEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getVersion <em>Version</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Version</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getVersion()
+ * @see #getEntityMappings()
+ * @generated
+ */
+ public EAttribute getEntityMappings_Version()
+ {
+ return (EAttribute)entityMappingsEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getDescription()
+ * @see #getEntityMappings()
+ * @generated
+ */
+ public EAttribute getEntityMappings_Description()
+ {
+ return (EAttribute)entityMappingsEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getPersistenceUnitMetadata <em>Persistence Unit Metadata</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Persistence Unit Metadata</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getPersistenceUnitMetadata()
+ * @see #getEntityMappings()
+ * @generated
+ */
+ public EReference getEntityMappings_PersistenceUnitMetadata()
+ {
+ return (EReference)entityMappingsEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getPackage <em>Package</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Package</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getPackage()
+ * @see #getEntityMappings()
+ * @generated
+ */
+ public EAttribute getEntityMappings_Package()
+ {
+ return (EAttribute)entityMappingsEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getSchema <em>Schema</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Schema</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getSchema()
+ * @see #getEntityMappings()
+ * @generated
+ */
+ public EAttribute getEntityMappings_Schema()
+ {
+ return (EAttribute)entityMappingsEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getCatalog <em>Catalog</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Catalog</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getCatalog()
+ * @see #getEntityMappings()
+ * @generated
+ */
+ public EAttribute getEntityMappings_Catalog()
+ {
+ return (EAttribute)entityMappingsEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getAccess <em>Access</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Access</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getAccess()
+ * @see #getEntityMappings()
+ * @generated
+ */
+ public EAttribute getEntityMappings_Access()
+ {
+ return (EAttribute)entityMappingsEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getSequenceGenerators <em>Sequence Generators</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Sequence Generators</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getSequenceGenerators()
+ * @see #getEntityMappings()
+ * @generated
+ */
+ public EReference getEntityMappings_SequenceGenerators()
+ {
+ return (EReference)entityMappingsEClass.getEStructuralFeatures().get(7);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getTableGenerators <em>Table Generators</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Table Generators</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getTableGenerators()
+ * @see #getEntityMappings()
+ * @generated
+ */
+ public EReference getEntityMappings_TableGenerators()
+ {
+ return (EReference)entityMappingsEClass.getEStructuralFeatures().get(8);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getNamedQueries <em>Named Queries</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Named Queries</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getNamedQueries()
+ * @see #getEntityMappings()
+ * @generated
+ */
+ public EReference getEntityMappings_NamedQueries()
+ {
+ return (EReference)entityMappingsEClass.getEStructuralFeatures().get(9);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getNamedNativeQueries <em>Named Native Queries</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Named Native Queries</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getNamedNativeQueries()
+ * @see #getEntityMappings()
+ * @generated
+ */
+ public EReference getEntityMappings_NamedNativeQueries()
+ {
+ return (EReference)entityMappingsEClass.getEStructuralFeatures().get(10);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getSqlResultSetMappings <em>Sql Result Set Mappings</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Sql Result Set Mappings</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getSqlResultSetMappings()
+ * @see #getEntityMappings()
+ * @generated
+ */
+ public EReference getEntityMappings_SqlResultSetMappings()
+ {
+ return (EReference)entityMappingsEClass.getEStructuralFeatures().get(11);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getMappedSuperclasses <em>Mapped Superclasses</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Mapped Superclasses</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getMappedSuperclasses()
+ * @see #getEntityMappings()
+ * @generated
+ */
+ public EReference getEntityMappings_MappedSuperclasses()
+ {
+ return (EReference)entityMappingsEClass.getEStructuralFeatures().get(12);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getEntities <em>Entities</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Entities</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getEntities()
+ * @see #getEntityMappings()
+ * @generated
+ */
+ public EReference getEntityMappings_Entities()
+ {
+ return (EReference)entityMappingsEClass.getEStructuralFeatures().get(13);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getEmbeddables <em>Embeddables</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Embeddables</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings#getEmbeddables()
+ * @see #getEntityMappings()
+ * @generated
+ */
+ public EReference getEntityMappings_Embeddables()
+ {
+ return (EReference)entityMappingsEClass.getEStructuralFeatures().get(14);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata <em>Persistence Unit Metadata</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Persistence Unit Metadata</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata
+ * @generated
+ */
+ public EClass getPersistenceUnitMetadata()
+ {
+ return persistenceUnitMetadataEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata#isXmlMappingMetadataComplete <em>Xml Mapping Metadata Complete</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Xml Mapping Metadata Complete</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata#isXmlMappingMetadataComplete()
+ * @see #getPersistenceUnitMetadata()
+ * @generated
+ */
+ public EAttribute getPersistenceUnitMetadata_XmlMappingMetadataComplete()
+ {
+ return (EAttribute)persistenceUnitMetadataEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata#getPersistenceUnitDefaults <em>Persistence Unit Defaults</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Persistence Unit Defaults</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata#getPersistenceUnitDefaults()
+ * @see #getPersistenceUnitMetadata()
+ * @generated
+ */
+ public EReference getPersistenceUnitMetadata_PersistenceUnitDefaults()
+ {
+ return (EReference)persistenceUnitMetadataEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults <em>Persistence Unit Defaults</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Persistence Unit Defaults</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults
+ * @generated
+ */
+ public EClass getPersistenceUnitDefaults()
+ {
+ return persistenceUnitDefaultsEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#getSchema <em>Schema</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Schema</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#getSchema()
+ * @see #getPersistenceUnitDefaults()
+ * @generated
+ */
+ public EAttribute getPersistenceUnitDefaults_Schema()
+ {
+ return (EAttribute)persistenceUnitDefaultsEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#getCatalog <em>Catalog</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Catalog</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#getCatalog()
+ * @see #getPersistenceUnitDefaults()
+ * @generated
+ */
+ public EAttribute getPersistenceUnitDefaults_Catalog()
+ {
+ return (EAttribute)persistenceUnitDefaultsEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#getAccess <em>Access</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Access</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#getAccess()
+ * @see #getPersistenceUnitDefaults()
+ * @generated
+ */
+ public EAttribute getPersistenceUnitDefaults_Access()
+ {
+ return (EAttribute)persistenceUnitDefaultsEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#isCascadePersist <em>Cascade Persist</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Cascade Persist</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#isCascadePersist()
+ * @see #getPersistenceUnitDefaults()
+ * @generated
+ */
+ public EAttribute getPersistenceUnitDefaults_CascadePersist()
+ {
+ return (EAttribute)persistenceUnitDefaultsEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#getEntityListeners <em>Entity Listeners</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Entity Listeners</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#getEntityListeners()
+ * @see #getPersistenceUnitDefaults()
+ * @generated
+ */
+ public EReference getPersistenceUnitDefaults_EntityListeners()
+ {
+ return (EReference)persistenceUnitDefaultsEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping <em>Type Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Type Mapping</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TypeMapping
+ * @generated
+ */
+ public EClass getTypeMapping()
+ {
+ return typeMappingEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getClassName <em>Class Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Class Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getClassName()
+ * @see #getTypeMapping()
+ * @generated
+ */
+ public EAttribute getTypeMapping_ClassName()
+ {
+ return (EAttribute)typeMappingEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getAccess <em>Access</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Access</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getAccess()
+ * @see #getTypeMapping()
+ * @generated
+ */
+ public EAttribute getTypeMapping_Access()
+ {
+ return (EAttribute)typeMappingEClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getMetadataComplete <em>Metadata Complete</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Metadata Complete</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getMetadataComplete()
+ * @see #getTypeMapping()
+ * @generated
+ */
+ public EAttribute getTypeMapping_MetadataComplete()
+ {
+ return (EAttribute)typeMappingEClass.getEStructuralFeatures().get(2);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getDescription()
+ * @see #getTypeMapping()
+ * @generated
+ */
+ public EAttribute getTypeMapping_Description()
+ {
+ return (EAttribute)typeMappingEClass.getEStructuralFeatures().get(3);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getAttributes <em>Attributes</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Attributes</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getAttributes()
+ * @see #getTypeMapping()
+ * @generated
+ */
+ public EReference getTypeMapping_Attributes()
+ {
+ return (EReference)typeMappingEClass.getEStructuralFeatures().get(4);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass <em>Mapped Superclass</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Mapped Superclass</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass
+ * @generated
+ */
+ public EClass getMappedSuperclass()
+ {
+ return mappedSuperclassEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getIdClass <em>Id Class</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Id Class</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getIdClass()
+ * @see #getMappedSuperclass()
+ * @generated
+ */
+ public EReference getMappedSuperclass_IdClass()
+ {
+ return (EReference)mappedSuperclassEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#isExcludeDefaultListeners <em>Exclude Default Listeners</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Exclude Default Listeners</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#isExcludeDefaultListeners()
+ * @see #getMappedSuperclass()
+ * @generated
+ */
+ public EAttribute getMappedSuperclass_ExcludeDefaultListeners()
+ {
+ return (EAttribute)mappedSuperclassEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#isExcludeSuperclassListeners <em>Exclude Superclass Listeners</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Exclude Superclass Listeners</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#isExcludeSuperclassListeners()
+ * @see #getMappedSuperclass()
+ * @generated
+ */
+ public EAttribute getMappedSuperclass_ExcludeSuperclassListeners()
+ {
+ return (EAttribute)mappedSuperclassEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getEntityListeners <em>Entity Listeners</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Entity Listeners</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getEntityListeners()
+ * @see #getMappedSuperclass()
+ * @generated
+ */
+ public EReference getMappedSuperclass_EntityListeners()
+ {
+ return (EReference)mappedSuperclassEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPrePersist <em>Pre Persist</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Pre Persist</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPrePersist()
+ * @see #getMappedSuperclass()
+ * @generated
+ */
+ public EReference getMappedSuperclass_PrePersist()
+ {
+ return (EReference)mappedSuperclassEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPostPersist <em>Post Persist</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Post Persist</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPostPersist()
+ * @see #getMappedSuperclass()
+ * @generated
+ */
+ public EReference getMappedSuperclass_PostPersist()
+ {
+ return (EReference)mappedSuperclassEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPreRemove <em>Pre Remove</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Pre Remove</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPreRemove()
+ * @see #getMappedSuperclass()
+ * @generated
+ */
+ public EReference getMappedSuperclass_PreRemove()
+ {
+ return (EReference)mappedSuperclassEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPostRemove <em>Post Remove</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Post Remove</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPostRemove()
+ * @see #getMappedSuperclass()
+ * @generated
+ */
+ public EReference getMappedSuperclass_PostRemove()
+ {
+ return (EReference)mappedSuperclassEClass.getEStructuralFeatures().get(7);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPreUpdate <em>Pre Update</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Pre Update</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPreUpdate()
+ * @see #getMappedSuperclass()
+ * @generated
+ */
+ public EReference getMappedSuperclass_PreUpdate()
+ {
+ return (EReference)mappedSuperclassEClass.getEStructuralFeatures().get(8);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPostUpdate <em>Post Update</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Post Update</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPostUpdate()
+ * @see #getMappedSuperclass()
+ * @generated
+ */
+ public EReference getMappedSuperclass_PostUpdate()
+ {
+ return (EReference)mappedSuperclassEClass.getEStructuralFeatures().get(9);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPostLoad <em>Post Load</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Post Load</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass#getPostLoad()
+ * @see #getMappedSuperclass()
+ * @generated
+ */
+ public EReference getMappedSuperclass_PostLoad()
+ {
+ return (EReference)mappedSuperclassEClass.getEStructuralFeatures().get(10);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.Entity <em>Entity</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Entity</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity
+ * @generated
+ */
+ public EClass getEntity()
+ {
+ return entityEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getName()
+ * @see #getEntity()
+ * @generated
+ */
+ public EAttribute getEntity_Name()
+ {
+ return (EAttribute)entityEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getTable <em>Table</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Table</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getTable()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_Table()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getSecondaryTables <em>Secondary Tables</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Secondary Tables</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getSecondaryTables()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_SecondaryTables()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPrimaryKeyJoinColumns <em>Primary Key Join Columns</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Primary Key Join Columns</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getPrimaryKeyJoinColumns()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_PrimaryKeyJoinColumns()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getIdClass <em>Id Class</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Id Class</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getIdClass()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_IdClass()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getInheritance <em>Inheritance</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Inheritance</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getInheritance()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_Inheritance()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getDiscriminatorValue <em>Discriminator Value</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Discriminator Value</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getDiscriminatorValue()
+ * @see #getEntity()
+ * @generated
+ */
+ public EAttribute getEntity_DiscriminatorValue()
+ {
+ return (EAttribute)entityEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getDiscriminatorColumn <em>Discriminator Column</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Discriminator Column</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getDiscriminatorColumn()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_DiscriminatorColumn()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(7);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getSequenceGenerator <em>Sequence Generator</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Sequence Generator</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getSequenceGenerator()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_SequenceGenerator()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(8);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getTableGenerator <em>Table Generator</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Table Generator</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getTableGenerator()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_TableGenerator()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(9);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getNamedQueries <em>Named Queries</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Named Queries</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getNamedQueries()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_NamedQueries()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(10);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getNamedNativeQueries <em>Named Native Queries</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Named Native Queries</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getNamedNativeQueries()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_NamedNativeQueries()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(11);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getSqlResultSetMappings <em>Sql Result Set Mappings</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Sql Result Set Mappings</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getSqlResultSetMappings()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_SqlResultSetMappings()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(12);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#isExcludeDefaultListeners <em>Exclude Default Listeners</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Exclude Default Listeners</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#isExcludeDefaultListeners()
+ * @see #getEntity()
+ * @generated
+ */
+ public EAttribute getEntity_ExcludeDefaultListeners()
+ {
+ return (EAttribute)entityEClass.getEStructuralFeatures().get(13);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#isExcludeSuperclassListeners <em>Exclude Superclass Listeners</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Exclude Superclass Listeners</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#isExcludeSuperclassListeners()
+ * @see #getEntity()
+ * @generated
+ */
+ public EAttribute getEntity_ExcludeSuperclassListeners()
+ {
+ return (EAttribute)entityEClass.getEStructuralFeatures().get(14);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getEntityListeners <em>Entity Listeners</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Entity Listeners</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getEntityListeners()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_EntityListeners()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(15);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPrePersist <em>Pre Persist</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Pre Persist</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getPrePersist()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_PrePersist()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(16);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPostPersist <em>Post Persist</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Post Persist</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getPostPersist()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_PostPersist()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(17);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPreRemove <em>Pre Remove</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Pre Remove</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getPreRemove()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_PreRemove()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(18);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPostRemove <em>Post Remove</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Post Remove</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getPostRemove()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_PostRemove()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(19);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPreUpdate <em>Pre Update</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Pre Update</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getPreUpdate()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_PreUpdate()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(20);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPostUpdate <em>Post Update</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Post Update</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getPostUpdate()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_PostUpdate()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(21);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getPostLoad <em>Post Load</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Post Load</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getPostLoad()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_PostLoad()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(22);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getAttributeOverrides <em>Attribute Overrides</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Attribute Overrides</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getAttributeOverrides()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_AttributeOverrides()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(23);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Entity#getAssociationOverrides <em>Association Overrides</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Association Overrides</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity#getAssociationOverrides()
+ * @see #getEntity()
+ * @generated
+ */
+ public EReference getEntity_AssociationOverrides()
+ {
+ return (EReference)entityEClass.getEStructuralFeatures().get(24);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.Embeddable <em>Embeddable</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Embeddable</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Embeddable
+ * @generated
+ */
+ public EClass getEmbeddable()
+ {
+ return embeddableEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.Attributes <em>Attributes</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Attributes</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Attributes
+ * @generated
+ */
+ public EClass getAttributes()
+ {
+ return attributesEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getIds <em>Ids</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Ids</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Attributes#getIds()
+ * @see #getAttributes()
+ * @generated
+ */
+ public EReference getAttributes_Ids()
+ {
+ return (EReference)attributesEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getEmbeddedIds <em>Embedded Ids</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Embedded Ids</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Attributes#getEmbeddedIds()
+ * @see #getAttributes()
+ * @generated
+ */
+ public EReference getAttributes_EmbeddedIds()
+ {
+ return (EReference)attributesEClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getBasics <em>Basics</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Basics</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Attributes#getBasics()
+ * @see #getAttributes()
+ * @generated
+ */
+ public EReference getAttributes_Basics()
+ {
+ return (EReference)attributesEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getVersions <em>Versions</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Versions</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Attributes#getVersions()
+ * @see #getAttributes()
+ * @generated
+ */
+ public EReference getAttributes_Versions()
+ {
+ return (EReference)attributesEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getManyToOnes <em>Many To Ones</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Many To Ones</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Attributes#getManyToOnes()
+ * @see #getAttributes()
+ * @generated
+ */
+ public EReference getAttributes_ManyToOnes()
+ {
+ return (EReference)attributesEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getOneToManys <em>One To Manys</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>One To Manys</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Attributes#getOneToManys()
+ * @see #getAttributes()
+ * @generated
+ */
+ public EReference getAttributes_OneToManys()
+ {
+ return (EReference)attributesEClass.getEStructuralFeatures().get(5);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getOneToOnes <em>One To Ones</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>One To Ones</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Attributes#getOneToOnes()
+ * @see #getAttributes()
+ * @generated
+ */
+ public EReference getAttributes_OneToOnes()
+ {
+ return (EReference)attributesEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getManyToManys <em>Many To Manys</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Many To Manys</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Attributes#getManyToManys()
+ * @see #getAttributes()
+ * @generated
+ */
+ public EReference getAttributes_ManyToManys()
+ {
+ return (EReference)attributesEClass.getEStructuralFeatures().get(7);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getEmbeddeds <em>Embeddeds</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Embeddeds</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Attributes#getEmbeddeds()
+ * @see #getAttributes()
+ * @generated
+ */
+ public EReference getAttributes_Embeddeds()
+ {
+ return (EReference)attributesEClass.getEStructuralFeatures().get(8);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Attributes#getTransients <em>Transients</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Transients</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Attributes#getTransients()
+ * @see #getAttributes()
+ * @generated
+ */
+ public EReference getAttributes_Transients()
+ {
+ return (EReference)attributesEClass.getEStructuralFeatures().get(9);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeMapping <em>Attribute Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Attribute Mapping</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AttributeMapping
+ * @generated
+ */
+ public EClass getAttributeMapping()
+ {
+ return attributeMappingEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeMapping#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AttributeMapping#getName()
+ * @see #getAttributeMapping()
+ * @generated
+ */
+ public EAttribute getAttributeMapping_Name()
+ {
+ return (EAttribute)attributeMappingEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnMapping <em>Column Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Column Mapping</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.ColumnMapping
+ * @generated
+ */
+ public EClass getColumnMapping()
+ {
+ return columnMappingEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnMapping#getColumn <em>Column</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Column</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.ColumnMapping#getColumn()
+ * @see #getColumnMapping()
+ * @generated
+ */
+ public EReference getColumnMapping_Column()
+ {
+ return (EReference)columnMappingEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping <em>Relationship Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Relationship Mapping</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping
+ * @generated
+ */
+ public EClass getRelationshipMapping()
+ {
+ return relationshipMappingEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping#getTargetEntity <em>Target Entity</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Target Entity</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping#getTargetEntity()
+ * @see #getRelationshipMapping()
+ * @generated
+ */
+ public EAttribute getRelationshipMapping_TargetEntity()
+ {
+ return (EAttribute)relationshipMappingEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping#getFetch <em>Fetch</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Fetch</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping#getFetch()
+ * @see #getRelationshipMapping()
+ * @generated
+ */
+ public EAttribute getRelationshipMapping_Fetch()
+ {
+ return (EAttribute)relationshipMappingEClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping#getCascade <em>Cascade</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Cascade</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping#getCascade()
+ * @see #getRelationshipMapping()
+ * @generated
+ */
+ public EReference getRelationshipMapping_Cascade()
+ {
+ return (EReference)relationshipMappingEClass.getEStructuralFeatures().get(3);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping#getJoinTable <em>Join Table</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Join Table</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping#getJoinTable()
+ * @see #getRelationshipMapping()
+ * @generated
+ */
+ public EReference getRelationshipMapping_JoinTable()
+ {
+ return (EReference)relationshipMappingEClass.getEStructuralFeatures().get(2);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping <em>Multi Relationship Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Multi Relationship Mapping</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping
+ * @generated
+ */
+ public EClass getMultiRelationshipMapping()
+ {
+ return multiRelationshipMappingEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping#getOrderBy <em>Order By</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Order By</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping#getOrderBy()
+ * @see #getMultiRelationshipMapping()
+ * @generated
+ */
+ public EAttribute getMultiRelationshipMapping_OrderBy()
+ {
+ return (EAttribute)multiRelationshipMappingEClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping#getMapKey <em>Map Key</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Map Key</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping#getMapKey()
+ * @see #getMultiRelationshipMapping()
+ * @generated
+ */
+ public EReference getMultiRelationshipMapping_MapKey()
+ {
+ return (EReference)multiRelationshipMappingEClass.getEStructuralFeatures().get(2);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping#getMappedBy <em>Mapped By</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Mapped By</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping#getMappedBy()
+ * @see #getMultiRelationshipMapping()
+ * @generated
+ */
+ public EAttribute getMultiRelationshipMapping_MappedBy()
+ {
+ return (EAttribute)multiRelationshipMappingEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping <em>Single Relationship Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Single Relationship Mapping</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping
+ * @generated
+ */
+ public EClass getSingleRelationshipMapping()
+ {
+ return singleRelationshipMappingEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping#getOptional <em>Optional</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Optional</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping#getOptional()
+ * @see #getSingleRelationshipMapping()
+ * @generated
+ */
+ public EAttribute getSingleRelationshipMapping_Optional()
+ {
+ return (EAttribute)singleRelationshipMappingEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping#getJoinColumns <em>Join Columns</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Join Columns</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping#getJoinColumns()
+ * @see #getSingleRelationshipMapping()
+ * @generated
+ */
+ public EReference getSingleRelationshipMapping_JoinColumns()
+ {
+ return (EReference)singleRelationshipMappingEClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.Id <em>Id</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Id</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Id
+ * @generated
+ */
+ public EClass getId()
+ {
+ return idEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Id#getGeneratedValue <em>Generated Value</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Generated Value</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Id#getGeneratedValue()
+ * @see #getId()
+ * @generated
+ */
+ public EReference getId_GeneratedValue()
+ {
+ return (EReference)idEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Id#getTemporal <em>Temporal</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Temporal</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Id#getTemporal()
+ * @see #getId()
+ * @generated
+ */
+ public EAttribute getId_Temporal()
+ {
+ return (EAttribute)idEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Id#getTableGenerator <em>Table Generator</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Table Generator</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Id#getTableGenerator()
+ * @see #getId()
+ * @generated
+ */
+ public EReference getId_TableGenerator()
+ {
+ return (EReference)idEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.Id#getSequenceGenerator <em>Sequence Generator</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Sequence Generator</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Id#getSequenceGenerator()
+ * @see #getId()
+ * @generated
+ */
+ public EReference getId_SequenceGenerator()
+ {
+ return (EReference)idEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.IdImpl <em>Id Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Id Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.IdImpl
+ * @generated
+ */
+ public EClass getIdImpl()
+ {
+ return idImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedId <em>Embedded Id</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Embedded Id</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EmbeddedId
+ * @generated
+ */
+ public EClass getEmbeddedId()
+ {
+ return embeddedIdEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedId#getAttributeOverrides <em>Attribute Overrides</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Attribute Overrides</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EmbeddedId#getAttributeOverrides()
+ * @see #getEmbeddedId()
+ * @generated
+ */
+ public EReference getEmbeddedId_AttributeOverrides()
+ {
+ return (EReference)embeddedIdEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedIdImpl <em>Embedded Id Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Embedded Id Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EmbeddedIdImpl
+ * @generated
+ */
+ public EClass getEmbeddedIdImpl()
+ {
+ return embeddedIdImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.Basic <em>Basic</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Basic</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Basic
+ * @generated
+ */
+ public EClass getBasic()
+ {
+ return basicEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Basic#getFetch <em>Fetch</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Fetch</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Basic#getFetch()
+ * @see #getBasic()
+ * @generated
+ */
+ public EAttribute getBasic_Fetch()
+ {
+ return (EAttribute)basicEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Basic#getOptional <em>Optional</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Optional</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Basic#getOptional()
+ * @see #getBasic()
+ * @generated
+ */
+ public EAttribute getBasic_Optional()
+ {
+ return (EAttribute)basicEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Basic#isLob <em>Lob</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Lob</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Basic#isLob()
+ * @see #getBasic()
+ * @generated
+ */
+ public EAttribute getBasic_Lob()
+ {
+ return (EAttribute)basicEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Basic#getTemporal <em>Temporal</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Temporal</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Basic#getTemporal()
+ * @see #getBasic()
+ * @generated
+ */
+ public EAttribute getBasic_Temporal()
+ {
+ return (EAttribute)basicEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Basic#getEnumerated <em>Enumerated</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Enumerated</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Basic#getEnumerated()
+ * @see #getBasic()
+ * @generated
+ */
+ public EAttribute getBasic_Enumerated()
+ {
+ return (EAttribute)basicEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.BasicImpl <em>Basic Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Basic Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.BasicImpl
+ * @generated
+ */
+ public EClass getBasicImpl()
+ {
+ return basicImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.Version <em>Version</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Version</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Version
+ * @generated
+ */
+ public EClass getVersion()
+ {
+ return versionEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Version#getTemporal <em>Temporal</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Temporal</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Version#getTemporal()
+ * @see #getVersion()
+ * @generated
+ */
+ public EAttribute getVersion_Temporal()
+ {
+ return (EAttribute)versionEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.VersionImpl <em>Version Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Version Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.VersionImpl
+ * @generated
+ */
+ public EClass getVersionImpl()
+ {
+ return versionImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToOne <em>Many To One</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Many To One</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.ManyToOne
+ * @generated
+ */
+ public EClass getManyToOne()
+ {
+ return manyToOneEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl <em>Many To One Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Many To One Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl
+ * @generated
+ */
+ public EClass getManyToOneImpl()
+ {
+ return manyToOneImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.OneToMany <em>One To Many</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>One To Many</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToMany
+ * @generated
+ */
+ public EClass getOneToMany()
+ {
+ return oneToManyEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.OneToMany#getJoinColumns <em>Join Columns</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Join Columns</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToMany#getJoinColumns()
+ * @see #getOneToMany()
+ * @generated
+ */
+ public EReference getOneToMany_JoinColumns()
+ {
+ return (EReference)oneToManyEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl <em>One To Many Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>One To Many Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl
+ * @generated
+ */
+ public EClass getOneToManyImpl()
+ {
+ return oneToManyImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOne <em>One To One</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>One To One</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToOne
+ * @generated
+ */
+ public EClass getOneToOne()
+ {
+ return oneToOneEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOne#getPrimaryKeyJoinColumns <em>Primary Key Join Columns</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Primary Key Join Columns</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToOne#getPrimaryKeyJoinColumns()
+ * @see #getOneToOne()
+ * @generated
+ */
+ public EReference getOneToOne_PrimaryKeyJoinColumns()
+ {
+ return (EReference)oneToOneEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl <em>One To One Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>One To One Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl
+ * @generated
+ */
+ public EClass getOneToOneImpl()
+ {
+ return oneToOneImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOne#getMappedBy <em>Mapped By</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Mapped By</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToOne#getMappedBy()
+ * @see #getOneToOne()
+ * @generated
+ */
+ public EAttribute getOneToOne_MappedBy()
+ {
+ return (EAttribute)oneToOneEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToMany <em>Many To Many</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Many To Many</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.ManyToMany
+ * @generated
+ */
+ public EClass getManyToMany()
+ {
+ return manyToManyEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl <em>Many To Many Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Many To Many Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl
+ * @generated
+ */
+ public EClass getManyToManyImpl()
+ {
+ return manyToManyImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.Embedded <em>Embedded</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Embedded</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Embedded
+ * @generated
+ */
+ public EClass getEmbedded()
+ {
+ return embeddedEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Embedded#getAttributeOverrides <em>Attribute Overrides</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Attribute Overrides</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Embedded#getAttributeOverrides()
+ * @see #getEmbedded()
+ * @generated
+ */
+ public EReference getEmbedded_AttributeOverrides()
+ {
+ return (EReference)embeddedEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedImpl <em>Embedded Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Embedded Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EmbeddedImpl
+ * @generated
+ */
+ public EClass getEmbeddedImpl()
+ {
+ return embeddedImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.Transient <em>Transient</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Transient</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Transient
+ * @generated
+ */
+ public EClass getTransient()
+ {
+ return transientEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.TransientImpl <em>Transient Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Transient Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TransientImpl
+ * @generated
+ */
+ public EClass getTransientImpl()
+ {
+ return transientImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.AssociationOverride <em>Association Override</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Association Override</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AssociationOverride
+ * @generated
+ */
+ public EClass getAssociationOverride()
+ {
+ return associationOverrideEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.AssociationOverride#getJoinColumns <em>Join Columns</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Join Columns</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AssociationOverride#getJoinColumns()
+ * @see #getAssociationOverride()
+ * @generated
+ */
+ public EReference getAssociationOverride_JoinColumns()
+ {
+ return (EReference)associationOverrideEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.AssociationOverride#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AssociationOverride#getName()
+ * @see #getAssociationOverride()
+ * @generated
+ */
+ public EAttribute getAssociationOverride_Name()
+ {
+ return (EAttribute)associationOverrideEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverride <em>Attribute Override</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Attribute Override</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AttributeOverride
+ * @generated
+ */
+ public EClass getAttributeOverride()
+ {
+ return attributeOverrideEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverride#getColumn <em>Column</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Column</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AttributeOverride#getColumn()
+ * @see #getAttributeOverride()
+ * @generated
+ */
+ public EReference getAttributeOverride_Column()
+ {
+ return (EReference)attributeOverrideEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverride#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AttributeOverride#getName()
+ * @see #getAttributeOverride()
+ * @generated
+ */
+ public EAttribute getAttributeOverride_Name()
+ {
+ return (EAttribute)attributeOverrideEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverrideImpl <em>Attribute Override Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Attribute Override Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AttributeOverrideImpl
+ * @generated
+ */
+ public EClass getAttributeOverrideImpl()
+ {
+ return attributeOverrideImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType <em>Cascade Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Cascade Type</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.CascadeType
+ * @generated
+ */
+ public EClass getCascadeType()
+ {
+ return cascadeTypeEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadeAll <em>Cascade All</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Cascade All</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadeAll()
+ * @see #getCascadeType()
+ * @generated
+ */
+ public EAttribute getCascadeType_CascadeAll()
+ {
+ return (EAttribute)cascadeTypeEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadePersist <em>Cascade Persist</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Cascade Persist</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadePersist()
+ * @see #getCascadeType()
+ * @generated
+ */
+ public EAttribute getCascadeType_CascadePersist()
+ {
+ return (EAttribute)cascadeTypeEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadeMerge <em>Cascade Merge</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Cascade Merge</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadeMerge()
+ * @see #getCascadeType()
+ * @generated
+ */
+ public EAttribute getCascadeType_CascadeMerge()
+ {
+ return (EAttribute)cascadeTypeEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadeRemove <em>Cascade Remove</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Cascade Remove</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadeRemove()
+ * @see #getCascadeType()
+ * @generated
+ */
+ public EAttribute getCascadeType_CascadeRemove()
+ {
+ return (EAttribute)cascadeTypeEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadeRefresh <em>Cascade Refresh</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Cascade Refresh</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.CascadeType#isCascadeRefresh()
+ * @see #getCascadeType()
+ * @generated
+ */
+ public EAttribute getCascadeType_CascadeRefresh()
+ {
+ return (EAttribute)cascadeTypeEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeTypeImpl <em>Cascade Type Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Cascade Type Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.CascadeTypeImpl
+ * @generated
+ */
+ public EClass getCascadeTypeImpl()
+ {
+ return cascadeTypeImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.NamedColumn <em>Named Column</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Named Column</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.NamedColumn
+ * @generated
+ */
+ public EClass getNamedColumn()
+ {
+ return namedColumnEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.NamedColumn#getColumnDefinition <em>Column Definition</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Column Definition</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.NamedColumn#getColumnDefinition()
+ * @see #getNamedColumn()
+ * @generated
+ */
+ public EAttribute getNamedColumn_ColumnDefinition()
+ {
+ return (EAttribute)namedColumnEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.NamedColumn#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.NamedColumn#getName()
+ * @see #getNamedColumn()
+ * @generated
+ */
+ public EAttribute getNamedColumn_Name()
+ {
+ return (EAttribute)namedColumnEClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn <em>Abstract Column</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Abstract Column</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractColumn
+ * @generated
+ */
+ public EClass getAbstractColumn()
+ {
+ return abstractColumnEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getInsertable <em>Insertable</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Insertable</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getInsertable()
+ * @see #getAbstractColumn()
+ * @generated
+ */
+ public EAttribute getAbstractColumn_Insertable()
+ {
+ return (EAttribute)abstractColumnEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getNullable <em>Nullable</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Nullable</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getNullable()
+ * @see #getAbstractColumn()
+ * @generated
+ */
+ public EAttribute getAbstractColumn_Nullable()
+ {
+ return (EAttribute)abstractColumnEClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getTable <em>Table</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Table</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getTable()
+ * @see #getAbstractColumn()
+ * @generated
+ */
+ public EAttribute getAbstractColumn_Table()
+ {
+ return (EAttribute)abstractColumnEClass.getEStructuralFeatures().get(2);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getUnique <em>Unique</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Unique</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getUnique()
+ * @see #getAbstractColumn()
+ * @generated
+ */
+ public EAttribute getAbstractColumn_Unique()
+ {
+ return (EAttribute)abstractColumnEClass.getEStructuralFeatures().get(3);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getUpdatable <em>Updatable</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Updatable</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractColumn#getUpdatable()
+ * @see #getAbstractColumn()
+ * @generated
+ */
+ public EAttribute getAbstractColumn_Updatable()
+ {
+ return (EAttribute)abstractColumnEClass.getEStructuralFeatures().get(4);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.Column <em>Column</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Column</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Column
+ * @generated
+ */
+ public EClass getColumn()
+ {
+ return columnEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Column#getLength <em>Length</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Length</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Column#getLength()
+ * @see #getColumn()
+ * @generated
+ */
+ public EAttribute getColumn_Length()
+ {
+ return (EAttribute)columnEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Column#getPrecision <em>Precision</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Precision</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Column#getPrecision()
+ * @see #getColumn()
+ * @generated
+ */
+ public EAttribute getColumn_Precision()
+ {
+ return (EAttribute)columnEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Column#getScale <em>Scale</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Scale</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Column#getScale()
+ * @see #getColumn()
+ * @generated
+ */
+ public EAttribute getColumn_Scale()
+ {
+ return (EAttribute)columnEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnImpl <em>Column Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Column Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.ColumnImpl
+ * @generated
+ */
+ public EClass getColumnImpl()
+ {
+ return columnImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnResult <em>Column Result</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Column Result</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.ColumnResult
+ * @generated
+ */
+ public EClass getColumnResult()
+ {
+ return columnResultEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnResult#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.ColumnResult#getName()
+ * @see #getColumnResult()
+ * @generated
+ */
+ public EAttribute getColumnResult_Name()
+ {
+ return (EAttribute)columnResultEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn <em>Discriminator Column</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Discriminator Column</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn
+ * @generated
+ */
+ public EClass getDiscriminatorColumn()
+ {
+ return discriminatorColumnEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn#getDiscriminatorType <em>Discriminator Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Discriminator Type</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn#getDiscriminatorType()
+ * @see #getDiscriminatorColumn()
+ * @generated
+ */
+ public EAttribute getDiscriminatorColumn_DiscriminatorType()
+ {
+ return (EAttribute)discriminatorColumnEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn#getLength <em>Length</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Length</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn#getLength()
+ * @see #getDiscriminatorColumn()
+ * @generated
+ */
+ public EAttribute getDiscriminatorColumn_Length()
+ {
+ return (EAttribute)discriminatorColumnEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListeners <em>Entity Listeners</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Entity Listeners</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListeners
+ * @generated
+ */
+ public EClass getEntityListeners()
+ {
+ return entityListenersEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListeners#getEntityListeners <em>Entity Listeners</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Entity Listeners</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListeners#getEntityListeners()
+ * @see #getEntityListeners()
+ * @generated
+ */
+ public EReference getEntityListeners_EntityListeners()
+ {
+ return (EReference)entityListenersEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener <em>Entity Listener</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Entity Listener</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListener
+ * @generated
+ */
+ public EClass getEntityListener()
+ {
+ return entityListenerEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getClassName <em>Class Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Class Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListener#getClassName()
+ * @see #getEntityListener()
+ * @generated
+ */
+ public EAttribute getEntityListener_ClassName()
+ {
+ return (EAttribute)entityListenerEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPrePersist <em>Pre Persist</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Pre Persist</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPrePersist()
+ * @see #getEntityListener()
+ * @generated
+ */
+ public EReference getEntityListener_PrePersist()
+ {
+ return (EReference)entityListenerEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPostPersist <em>Post Persist</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Post Persist</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPostPersist()
+ * @see #getEntityListener()
+ * @generated
+ */
+ public EReference getEntityListener_PostPersist()
+ {
+ return (EReference)entityListenerEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPreRemove <em>Pre Remove</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Pre Remove</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPreRemove()
+ * @see #getEntityListener()
+ * @generated
+ */
+ public EReference getEntityListener_PreRemove()
+ {
+ return (EReference)entityListenerEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPostRemove <em>Post Remove</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Post Remove</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPostRemove()
+ * @see #getEntityListener()
+ * @generated
+ */
+ public EReference getEntityListener_PostRemove()
+ {
+ return (EReference)entityListenerEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPreUpdate <em>Pre Update</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Pre Update</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPreUpdate()
+ * @see #getEntityListener()
+ * @generated
+ */
+ public EReference getEntityListener_PreUpdate()
+ {
+ return (EReference)entityListenerEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPostUpdate <em>Post Update</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Post Update</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPostUpdate()
+ * @see #getEntityListener()
+ * @generated
+ */
+ public EReference getEntityListener_PostUpdate()
+ {
+ return (EReference)entityListenerEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPostLoad <em>Post Load</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Post Load</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListener#getPostLoad()
+ * @see #getEntityListener()
+ * @generated
+ */
+ public EReference getEntityListener_PostLoad()
+ {
+ return (EReference)entityListenerEClass.getEStructuralFeatures().get(7);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.EntityResult <em>Entity Result</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Entity Result</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityResult
+ * @generated
+ */
+ public EClass getEntityResult()
+ {
+ return entityResultEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.EntityResult#getDiscriminatorColumn <em>Discriminator Column</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Discriminator Column</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityResult#getDiscriminatorColumn()
+ * @see #getEntityResult()
+ * @generated
+ */
+ public EAttribute getEntityResult_DiscriminatorColumn()
+ {
+ return (EAttribute)entityResultEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.EntityResult#getEntityClass <em>Entity Class</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Entity Class</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityResult#getEntityClass()
+ * @see #getEntityResult()
+ * @generated
+ */
+ public EAttribute getEntityResult_EntityClass()
+ {
+ return (EAttribute)entityResultEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.EntityResult#getFieldResults <em>Field Results</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Field Results</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityResult#getFieldResults()
+ * @see #getEntityResult()
+ * @generated
+ */
+ public EReference getEntityResult_FieldResults()
+ {
+ return (EReference)entityResultEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.FieldResult <em>Field Result</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Field Result</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FieldResult
+ * @generated
+ */
+ public EClass getFieldResult()
+ {
+ return fieldResultEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.FieldResult#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FieldResult#getName()
+ * @see #getFieldResult()
+ * @generated
+ */
+ public EAttribute getFieldResult_Name()
+ {
+ return (EAttribute)fieldResultEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.FieldResult#getColumn <em>Column</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Column</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FieldResult#getColumn()
+ * @see #getFieldResult()
+ * @generated
+ */
+ public EAttribute getFieldResult_Column()
+ {
+ return (EAttribute)fieldResultEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.GeneratedValue <em>Generated Value</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Generated Value</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.GeneratedValue
+ * @generated
+ */
+ public EClass getGeneratedValue()
+ {
+ return generatedValueEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.GeneratedValue#getGenerator <em>Generator</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Generator</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.GeneratedValue#getGenerator()
+ * @see #getGeneratedValue()
+ * @generated
+ */
+ public EAttribute getGeneratedValue_Generator()
+ {
+ return (EAttribute)generatedValueEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.GeneratedValue#getStrategy <em>Strategy</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Strategy</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.GeneratedValue#getStrategy()
+ * @see #getGeneratedValue()
+ * @generated
+ */
+ public EAttribute getGeneratedValue_Strategy()
+ {
+ return (EAttribute)generatedValueEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.GeneratedValueImpl <em>Generated Value Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Generated Value Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.GeneratedValueImpl
+ * @generated
+ */
+ public EClass getGeneratedValueImpl()
+ {
+ return generatedValueImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.IdClass <em>Id Class</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Id Class</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.IdClass
+ * @generated
+ */
+ public EClass getIdClass()
+ {
+ return idClassEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.IdClass#getClassName <em>Class Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Class Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.IdClass#getClassName()
+ * @see #getIdClass()
+ * @generated
+ */
+ public EAttribute getIdClass_ClassName()
+ {
+ return (EAttribute)idClassEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.Inheritance <em>Inheritance</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Inheritance</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Inheritance
+ * @generated
+ */
+ public EClass getInheritance()
+ {
+ return inheritanceEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Inheritance#getStrategy <em>Strategy</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Strategy</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Inheritance#getStrategy()
+ * @see #getInheritance()
+ * @generated
+ */
+ public EAttribute getInheritance_Strategy()
+ {
+ return (EAttribute)inheritanceEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn <em>Join Column</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Join Column</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinColumn
+ * @generated
+ */
+ public EClass getJoinColumn()
+ {
+ return joinColumnEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn#getReferencedColumnName <em>Referenced Column Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Referenced Column Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinColumn#getReferencedColumnName()
+ * @see #getJoinColumn()
+ * @generated
+ */
+ public EAttribute getJoinColumn_ReferencedColumnName()
+ {
+ return (EAttribute)joinColumnEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumnImpl <em>Join Column Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Join Column Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinColumnImpl
+ * @generated
+ */
+ public EClass getJoinColumnImpl()
+ {
+ return joinColumnImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.JoinTable <em>Join Table</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Join Table</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinTable
+ * @generated
+ */
+ public EClass getJoinTable()
+ {
+ return joinTableEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.JoinTable#getJoinColumns <em>Join Columns</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Join Columns</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinTable#getJoinColumns()
+ * @see #getJoinTable()
+ * @generated
+ */
+ public EReference getJoinTable_JoinColumns()
+ {
+ return (EReference)joinTableEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.JoinTable#getInverseJoinColumns <em>Inverse Join Columns</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Inverse Join Columns</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinTable#getInverseJoinColumns()
+ * @see #getJoinTable()
+ * @generated
+ */
+ public EReference getJoinTable_InverseJoinColumns()
+ {
+ return (EReference)joinTableEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.JoinTableImpl <em>Join Table Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Join Table Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinTableImpl
+ * @generated
+ */
+ public EClass getJoinTableImpl()
+ {
+ return joinTableImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.Lob <em>Lob</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Lob</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Lob
+ * @generated
+ */
+ public EClass getLob()
+ {
+ return lobEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.MapKey <em>Map Key</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Map Key</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MapKey
+ * @generated
+ */
+ public EClass getMapKey()
+ {
+ return mapKeyEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.MapKey#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MapKey#getName()
+ * @see #getMapKey()
+ * @generated
+ */
+ public EAttribute getMapKey_Name()
+ {
+ return (EAttribute)mapKeyEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.MapKeyImpl <em>Map Key Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Map Key Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MapKeyImpl
+ * @generated
+ */
+ public EClass getMapKeyImpl()
+ {
+ return mapKeyImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.Query <em>Query</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Query</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Query
+ * @generated
+ */
+ public EClass getQuery()
+ {
+ return queryEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Query#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Query#getName()
+ * @see #getQuery()
+ * @generated
+ */
+ public EAttribute getQuery_Name()
+ {
+ return (EAttribute)queryEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Query#getQuery <em>Query</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Query</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Query#getQuery()
+ * @see #getQuery()
+ * @generated
+ */
+ public EAttribute getQuery_Query()
+ {
+ return (EAttribute)queryEClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.Query#getHints <em>Hints</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Hints</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Query#getHints()
+ * @see #getQuery()
+ * @generated
+ */
+ public EReference getQuery_Hints()
+ {
+ return (EReference)queryEClass.getEStructuralFeatures().get(2);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.EventMethod <em>Event Method</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Event Method</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EventMethod
+ * @generated
+ */
+ public EClass getEventMethod()
+ {
+ return eventMethodEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.EventMethod#getMethodName <em>Method Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Method Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EventMethod#getMethodName()
+ * @see #getEventMethod()
+ * @generated
+ */
+ public EAttribute getEventMethod_MethodName()
+ {
+ return (EAttribute)eventMethodEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery <em>Named Native Query</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Named Native Query</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery
+ * @generated
+ */
+ public EClass getNamedNativeQuery()
+ {
+ return namedNativeQueryEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery#getResultClass <em>Result Class</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Result Class</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery#getResultClass()
+ * @see #getNamedNativeQuery()
+ * @generated
+ */
+ public EAttribute getNamedNativeQuery_ResultClass()
+ {
+ return (EAttribute)namedNativeQueryEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery#getResultSetMapping <em>Result Set Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Result Set Mapping</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery#getResultSetMapping()
+ * @see #getNamedNativeQuery()
+ * @generated
+ */
+ public EAttribute getNamedNativeQuery_ResultSetMapping()
+ {
+ return (EAttribute)namedNativeQueryEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.NamedQuery <em>Named Query</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Named Query</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.NamedQuery
+ * @generated
+ */
+ public EClass getNamedQuery()
+ {
+ return namedQueryEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.PostLoad <em>Post Load</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Post Load</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PostLoad
+ * @generated
+ */
+ public EClass getPostLoad()
+ {
+ return postLoadEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.PostPersist <em>Post Persist</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Post Persist</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PostPersist
+ * @generated
+ */
+ public EClass getPostPersist()
+ {
+ return postPersistEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.PostRemove <em>Post Remove</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Post Remove</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PostRemove
+ * @generated
+ */
+ public EClass getPostRemove()
+ {
+ return postRemoveEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.PostUpdate <em>Post Update</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Post Update</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PostUpdate
+ * @generated
+ */
+ public EClass getPostUpdate()
+ {
+ return postUpdateEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.PrePersist <em>Pre Persist</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Pre Persist</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PrePersist
+ * @generated
+ */
+ public EClass getPrePersist()
+ {
+ return prePersistEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.PreRemove <em>Pre Remove</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Pre Remove</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PreRemove
+ * @generated
+ */
+ public EClass getPreRemove()
+ {
+ return preRemoveEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.PreUpdate <em>Pre Update</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Pre Update</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PreUpdate
+ * @generated
+ */
+ public EClass getPreUpdate()
+ {
+ return preUpdateEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.QueryHint <em>Query Hint</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Query Hint</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.QueryHint
+ * @generated
+ */
+ public EClass getQueryHint()
+ {
+ return queryHintEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.QueryHint#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.QueryHint#getName()
+ * @see #getQueryHint()
+ * @generated
+ */
+ public EAttribute getQueryHint_Name()
+ {
+ return (EAttribute)queryHintEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.QueryHint#getValue <em>Value</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Value</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.QueryHint#getValue()
+ * @see #getQueryHint()
+ * @generated
+ */
+ public EAttribute getQueryHint_Value()
+ {
+ return (EAttribute)queryHintEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractTable <em>Abstract Table</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Abstract Table</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractTable
+ * @generated
+ */
+ public EClass getAbstractTable()
+ {
+ return abstractTableEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractTable#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractTable#getName()
+ * @see #getAbstractTable()
+ * @generated
+ */
+ public EAttribute getAbstractTable_Name()
+ {
+ return (EAttribute)abstractTableEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractTable#getCatalog <em>Catalog</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Catalog</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractTable#getCatalog()
+ * @see #getAbstractTable()
+ * @generated
+ */
+ public EAttribute getAbstractTable_Catalog()
+ {
+ return (EAttribute)abstractTableEClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractTable#getSchema <em>Schema</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Schema</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractTable#getSchema()
+ * @see #getAbstractTable()
+ * @generated
+ */
+ public EAttribute getAbstractTable_Schema()
+ {
+ return (EAttribute)abstractTableEClass.getEStructuralFeatures().get(2);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractTable#getUniqueConstraints <em>Unique Constraints</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Unique Constraints</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractTable#getUniqueConstraints()
+ * @see #getAbstractTable()
+ * @generated
+ */
+ public EReference getAbstractTable_UniqueConstraints()
+ {
+ return (EReference)abstractTableEClass.getEStructuralFeatures().get(3);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping <em>Sql Result Set Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Sql Result Set Mapping</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping
+ * @generated
+ */
+ public EClass getSqlResultSetMapping()
+ {
+ return sqlResultSetMappingEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping#getName()
+ * @see #getSqlResultSetMapping()
+ * @generated
+ */
+ public EAttribute getSqlResultSetMapping_Name()
+ {
+ return (EAttribute)sqlResultSetMappingEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping#getEntityResults <em>Entity Results</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Entity Results</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping#getEntityResults()
+ * @see #getSqlResultSetMapping()
+ * @generated
+ */
+ public EReference getSqlResultSetMapping_EntityResults()
+ {
+ return (EReference)sqlResultSetMappingEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping#getColumnResults <em>Column Results</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Column Results</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping#getColumnResults()
+ * @see #getSqlResultSetMapping()
+ * @generated
+ */
+ public EReference getSqlResultSetMapping_ColumnResults()
+ {
+ return (EReference)sqlResultSetMappingEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn <em>Primary Key Join Column</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Primary Key Join Column</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn
+ * @generated
+ */
+ public EClass getPrimaryKeyJoinColumn()
+ {
+ return primaryKeyJoinColumnEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn#getReferencedColumnName <em>Referenced Column Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Referenced Column Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn#getReferencedColumnName()
+ * @see #getPrimaryKeyJoinColumn()
+ * @generated
+ */
+ public EAttribute getPrimaryKeyJoinColumn_ReferencedColumnName()
+ {
+ return (EAttribute)primaryKeyJoinColumnEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.SecondaryTable <em>Secondary Table</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Secondary Table</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SecondaryTable
+ * @generated
+ */
+ public EClass getSecondaryTable()
+ {
+ return secondaryTableEClass;
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.SecondaryTable#getPrimaryKeyJoinColumns <em>Primary Key Join Columns</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Primary Key Join Columns</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SecondaryTable#getPrimaryKeyJoinColumns()
+ * @see #getSecondaryTable()
+ * @generated
+ */
+ public EReference getSecondaryTable_PrimaryKeyJoinColumns()
+ {
+ return (EReference)secondaryTableEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.Generator <em>Generator</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Generator</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Generator
+ * @generated
+ */
+ public EClass getGenerator()
+ {
+ return generatorEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Generator#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Generator#getName()
+ * @see #getGenerator()
+ * @generated
+ */
+ public EAttribute getGenerator_Name()
+ {
+ return (EAttribute)generatorEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Generator#getInitialValue <em>Initial Value</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Initial Value</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Generator#getInitialValue()
+ * @see #getGenerator()
+ * @generated
+ */
+ public EAttribute getGenerator_InitialValue()
+ {
+ return (EAttribute)generatorEClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.Generator#getAllocationSize <em>Allocation Size</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Allocation Size</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Generator#getAllocationSize()
+ * @see #getGenerator()
+ * @generated
+ */
+ public EAttribute getGenerator_AllocationSize()
+ {
+ return (EAttribute)generatorEClass.getEStructuralFeatures().get(2);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator <em>Sequence Generator</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Sequence Generator</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator
+ * @generated
+ */
+ public EClass getSequenceGenerator()
+ {
+ return sequenceGeneratorEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator#getSequenceName <em>Sequence Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Sequence Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator#getSequenceName()
+ * @see #getSequenceGenerator()
+ * @generated
+ */
+ public EAttribute getSequenceGenerator_SequenceName()
+ {
+ return (EAttribute)sequenceGeneratorEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.SequenceGeneratorImpl <em>Sequence Generator Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Sequence Generator Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SequenceGeneratorImpl
+ * @generated
+ */
+ public EClass getSequenceGeneratorImpl()
+ {
+ return sequenceGeneratorImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.Table <em>Table</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Table</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Table
+ * @generated
+ */
+ public EClass getTable()
+ {
+ return tableEClass;
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator <em>Table Generator</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Table Generator</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TableGenerator
+ * @generated
+ */
+ public EClass getTableGenerator()
+ {
+ return tableGeneratorEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getTable <em>Table</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Table</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getTable()
+ * @see #getTableGenerator()
+ * @generated
+ */
+ public EAttribute getTableGenerator_Table()
+ {
+ return (EAttribute)tableGeneratorEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getCatalog <em>Catalog</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Catalog</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getCatalog()
+ * @see #getTableGenerator()
+ * @generated
+ */
+ public EAttribute getTableGenerator_Catalog()
+ {
+ return (EAttribute)tableGeneratorEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getSchema <em>Schema</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Schema</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getSchema()
+ * @see #getTableGenerator()
+ * @generated
+ */
+ public EAttribute getTableGenerator_Schema()
+ {
+ return (EAttribute)tableGeneratorEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getPkColumnName <em>Pk Column Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Pk Column Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getPkColumnName()
+ * @see #getTableGenerator()
+ * @generated
+ */
+ public EAttribute getTableGenerator_PkColumnName()
+ {
+ return (EAttribute)tableGeneratorEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getValueColumnName <em>Value Column Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Value Column Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getValueColumnName()
+ * @see #getTableGenerator()
+ * @generated
+ */
+ public EAttribute getTableGenerator_ValueColumnName()
+ {
+ return (EAttribute)tableGeneratorEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getPkColumnValue <em>Pk Column Value</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Pk Column Value</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getPkColumnValue()
+ * @see #getTableGenerator()
+ * @generated
+ */
+ public EAttribute getTableGenerator_PkColumnValue()
+ {
+ return (EAttribute)tableGeneratorEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getUniqueConstraints <em>Unique Constraints</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Unique Constraints</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getUniqueConstraints()
+ * @see #getTableGenerator()
+ * @generated
+ */
+ public EReference getTableGenerator_UniqueConstraints()
+ {
+ return (EReference)tableGeneratorEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl <em>Table Generator Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Table Generator Impl</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl
+ * @generated
+ */
+ public EClass getTableGeneratorImpl()
+ {
+ return tableGeneratorImplEClass;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint <em>Unique Constraint</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Unique Constraint</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint
+ * @generated
+ */
+ public EClass getUniqueConstraint()
+ {
+ return uniqueConstraintEClass;
+ }
+
+ /**
+ * Returns the meta object for the attribute list '{@link org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint#getColumnNames <em>Column Names</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute list '<em>Column Names</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint#getColumnNames()
+ * @see #getUniqueConstraint()
+ * @generated
+ */
+ public EAttribute getUniqueConstraint_ColumnNames()
+ {
+ return (EAttribute)uniqueConstraintEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.resource.orm.AccessType <em>Access Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Access Type</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AccessType
+ * @generated
+ */
+ public EEnum getAccessType()
+ {
+ return accessTypeEEnum;
+ }
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType <em>Discriminator Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Discriminator Type</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType
+ * @generated
+ */
+ public EEnum getDiscriminatorType()
+ {
+ return discriminatorTypeEEnum;
+ }
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.resource.orm.EnumType <em>Enum Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Enum Type</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EnumType
+ * @generated
+ */
+ public EEnum getEnumType()
+ {
+ return enumTypeEEnum;
+ }
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.resource.orm.FetchType <em>Fetch Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Fetch Type</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
+ * @generated
+ */
+ public EEnum getFetchType()
+ {
+ return fetchTypeEEnum;
+ }
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.resource.orm.GenerationType <em>Generation Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Generation Type</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.GenerationType
+ * @generated
+ */
+ public EEnum getGenerationType()
+ {
+ return generationTypeEEnum;
+ }
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.resource.orm.InheritanceType <em>Inheritance Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Inheritance Type</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.InheritanceType
+ * @generated
+ */
+ public EEnum getInheritanceType()
+ {
+ return inheritanceTypeEEnum;
+ }
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.resource.orm.TemporalType <em>Temporal Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Temporal Type</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TemporalType
+ * @generated
+ */
+ public EEnum getTemporalType()
+ {
+ return temporalTypeEEnum;
+ }
+
+ /**
+ * Returns the meta object for data type '{@link java.lang.String <em>Discriminator Value</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for data type '<em>Discriminator Value</em>'.
+ * @see java.lang.String
+ * @model instanceClass="java.lang.String"
+ * @generated
+ */
+ public EDataType getDiscriminatorValue()
+ {
+ return discriminatorValueEDataType;
+ }
+
+ /**
+ * Returns the meta object for data type '{@link org.eclipse.emf.common.util.Enumerator <em>Enumerated</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for data type '<em>Enumerated</em>'.
+ * @see org.eclipse.emf.common.util.Enumerator
+ * @model instanceClass="org.eclipse.emf.common.util.Enumerator"
+ * @generated
+ */
+ public EDataType getEnumerated()
+ {
+ return enumeratedEDataType;
+ }
+
+ /**
+ * Returns the meta object for data type '{@link java.lang.String <em>Order By</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for data type '<em>Order By</em>'.
+ * @see java.lang.String
+ * @model instanceClass="java.lang.String"
+ * @generated
+ */
+ public EDataType getOrderBy()
+ {
+ return orderByEDataType;
+ }
+
+ /**
+ * Returns the meta object for data type '{@link java.lang.String <em>Version Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for data type '<em>Version Type</em>'.
+ * @see java.lang.String
+ * @model instanceClass="java.lang.String"
+ * @generated
+ */
+ public EDataType getVersionType()
+ {
+ return versionTypeEDataType;
+ }
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ public OrmFactory getOrmFactory()
+ {
+ return (OrmFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents()
+ {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ entityMappingsEClass = createEClass(ENTITY_MAPPINGS);
+ createEAttribute(entityMappingsEClass, ENTITY_MAPPINGS__VERSION);
+ createEAttribute(entityMappingsEClass, ENTITY_MAPPINGS__DESCRIPTION);
+ createEReference(entityMappingsEClass, ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA);
+ createEAttribute(entityMappingsEClass, ENTITY_MAPPINGS__PACKAGE);
+ createEAttribute(entityMappingsEClass, ENTITY_MAPPINGS__SCHEMA);
+ createEAttribute(entityMappingsEClass, ENTITY_MAPPINGS__CATALOG);
+ createEAttribute(entityMappingsEClass, ENTITY_MAPPINGS__ACCESS);
+ createEReference(entityMappingsEClass, ENTITY_MAPPINGS__SEQUENCE_GENERATORS);
+ createEReference(entityMappingsEClass, ENTITY_MAPPINGS__TABLE_GENERATORS);
+ createEReference(entityMappingsEClass, ENTITY_MAPPINGS__NAMED_QUERIES);
+ createEReference(entityMappingsEClass, ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES);
+ createEReference(entityMappingsEClass, ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS);
+ createEReference(entityMappingsEClass, ENTITY_MAPPINGS__MAPPED_SUPERCLASSES);
+ createEReference(entityMappingsEClass, ENTITY_MAPPINGS__ENTITIES);
+ createEReference(entityMappingsEClass, ENTITY_MAPPINGS__EMBEDDABLES);
+
+ persistenceUnitMetadataEClass = createEClass(PERSISTENCE_UNIT_METADATA);
+ createEAttribute(persistenceUnitMetadataEClass, PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE);
+ createEReference(persistenceUnitMetadataEClass, PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS);
+
+ persistenceUnitDefaultsEClass = createEClass(PERSISTENCE_UNIT_DEFAULTS);
+ createEAttribute(persistenceUnitDefaultsEClass, PERSISTENCE_UNIT_DEFAULTS__SCHEMA);
+ createEAttribute(persistenceUnitDefaultsEClass, PERSISTENCE_UNIT_DEFAULTS__CATALOG);
+ createEAttribute(persistenceUnitDefaultsEClass, PERSISTENCE_UNIT_DEFAULTS__ACCESS);
+ createEAttribute(persistenceUnitDefaultsEClass, PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST);
+ createEReference(persistenceUnitDefaultsEClass, PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS);
+
+ typeMappingEClass = createEClass(TYPE_MAPPING);
+ createEAttribute(typeMappingEClass, TYPE_MAPPING__CLASS_NAME);
+ createEAttribute(typeMappingEClass, TYPE_MAPPING__ACCESS);
+ createEAttribute(typeMappingEClass, TYPE_MAPPING__METADATA_COMPLETE);
+ createEAttribute(typeMappingEClass, TYPE_MAPPING__DESCRIPTION);
+ createEReference(typeMappingEClass, TYPE_MAPPING__ATTRIBUTES);
+
+ mappedSuperclassEClass = createEClass(MAPPED_SUPERCLASS);
+ createEReference(mappedSuperclassEClass, MAPPED_SUPERCLASS__ID_CLASS);
+ createEAttribute(mappedSuperclassEClass, MAPPED_SUPERCLASS__EXCLUDE_DEFAULT_LISTENERS);
+ createEAttribute(mappedSuperclassEClass, MAPPED_SUPERCLASS__EXCLUDE_SUPERCLASS_LISTENERS);
+ createEReference(mappedSuperclassEClass, MAPPED_SUPERCLASS__ENTITY_LISTENERS);
+ createEReference(mappedSuperclassEClass, MAPPED_SUPERCLASS__PRE_PERSIST);
+ createEReference(mappedSuperclassEClass, MAPPED_SUPERCLASS__POST_PERSIST);
+ createEReference(mappedSuperclassEClass, MAPPED_SUPERCLASS__PRE_REMOVE);
+ createEReference(mappedSuperclassEClass, MAPPED_SUPERCLASS__POST_REMOVE);
+ createEReference(mappedSuperclassEClass, MAPPED_SUPERCLASS__PRE_UPDATE);
+ createEReference(mappedSuperclassEClass, MAPPED_SUPERCLASS__POST_UPDATE);
+ createEReference(mappedSuperclassEClass, MAPPED_SUPERCLASS__POST_LOAD);
+
+ entityEClass = createEClass(ENTITY);
+ createEAttribute(entityEClass, ENTITY__NAME);
+ createEReference(entityEClass, ENTITY__TABLE);
+ createEReference(entityEClass, ENTITY__SECONDARY_TABLES);
+ createEReference(entityEClass, ENTITY__PRIMARY_KEY_JOIN_COLUMNS);
+ createEReference(entityEClass, ENTITY__ID_CLASS);
+ createEReference(entityEClass, ENTITY__INHERITANCE);
+ createEAttribute(entityEClass, ENTITY__DISCRIMINATOR_VALUE);
+ createEReference(entityEClass, ENTITY__DISCRIMINATOR_COLUMN);
+ createEReference(entityEClass, ENTITY__SEQUENCE_GENERATOR);
+ createEReference(entityEClass, ENTITY__TABLE_GENERATOR);
+ createEReference(entityEClass, ENTITY__NAMED_QUERIES);
+ createEReference(entityEClass, ENTITY__NAMED_NATIVE_QUERIES);
+ createEReference(entityEClass, ENTITY__SQL_RESULT_SET_MAPPINGS);
+ createEAttribute(entityEClass, ENTITY__EXCLUDE_DEFAULT_LISTENERS);
+ createEAttribute(entityEClass, ENTITY__EXCLUDE_SUPERCLASS_LISTENERS);
+ createEReference(entityEClass, ENTITY__ENTITY_LISTENERS);
+ createEReference(entityEClass, ENTITY__PRE_PERSIST);
+ createEReference(entityEClass, ENTITY__POST_PERSIST);
+ createEReference(entityEClass, ENTITY__PRE_REMOVE);
+ createEReference(entityEClass, ENTITY__POST_REMOVE);
+ createEReference(entityEClass, ENTITY__PRE_UPDATE);
+ createEReference(entityEClass, ENTITY__POST_UPDATE);
+ createEReference(entityEClass, ENTITY__POST_LOAD);
+ createEReference(entityEClass, ENTITY__ATTRIBUTE_OVERRIDES);
+ createEReference(entityEClass, ENTITY__ASSOCIATION_OVERRIDES);
+
+ embeddableEClass = createEClass(EMBEDDABLE);
+
+ attributesEClass = createEClass(ATTRIBUTES);
+ createEReference(attributesEClass, ATTRIBUTES__IDS);
+ createEReference(attributesEClass, ATTRIBUTES__EMBEDDED_IDS);
+ createEReference(attributesEClass, ATTRIBUTES__BASICS);
+ createEReference(attributesEClass, ATTRIBUTES__VERSIONS);
+ createEReference(attributesEClass, ATTRIBUTES__MANY_TO_ONES);
+ createEReference(attributesEClass, ATTRIBUTES__ONE_TO_MANYS);
+ createEReference(attributesEClass, ATTRIBUTES__ONE_TO_ONES);
+ createEReference(attributesEClass, ATTRIBUTES__MANY_TO_MANYS);
+ createEReference(attributesEClass, ATTRIBUTES__EMBEDDEDS);
+ createEReference(attributesEClass, ATTRIBUTES__TRANSIENTS);
+
+ attributeMappingEClass = createEClass(ATTRIBUTE_MAPPING);
+ createEAttribute(attributeMappingEClass, ATTRIBUTE_MAPPING__NAME);
+
+ columnMappingEClass = createEClass(COLUMN_MAPPING);
+ createEReference(columnMappingEClass, COLUMN_MAPPING__COLUMN);
+
+ relationshipMappingEClass = createEClass(RELATIONSHIP_MAPPING);
+ createEAttribute(relationshipMappingEClass, RELATIONSHIP_MAPPING__TARGET_ENTITY);
+ createEAttribute(relationshipMappingEClass, RELATIONSHIP_MAPPING__FETCH);
+ createEReference(relationshipMappingEClass, RELATIONSHIP_MAPPING__JOIN_TABLE);
+ createEReference(relationshipMappingEClass, RELATIONSHIP_MAPPING__CASCADE);
+
+ multiRelationshipMappingEClass = createEClass(MULTI_RELATIONSHIP_MAPPING);
+ createEAttribute(multiRelationshipMappingEClass, MULTI_RELATIONSHIP_MAPPING__MAPPED_BY);
+ createEAttribute(multiRelationshipMappingEClass, MULTI_RELATIONSHIP_MAPPING__ORDER_BY);
+ createEReference(multiRelationshipMappingEClass, MULTI_RELATIONSHIP_MAPPING__MAP_KEY);
+
+ singleRelationshipMappingEClass = createEClass(SINGLE_RELATIONSHIP_MAPPING);
+ createEAttribute(singleRelationshipMappingEClass, SINGLE_RELATIONSHIP_MAPPING__OPTIONAL);
+ createEReference(singleRelationshipMappingEClass, SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS);
+
+ idEClass = createEClass(ID);
+ createEReference(idEClass, ID__GENERATED_VALUE);
+ createEAttribute(idEClass, ID__TEMPORAL);
+ createEReference(idEClass, ID__TABLE_GENERATOR);
+ createEReference(idEClass, ID__SEQUENCE_GENERATOR);
+
+ idImplEClass = createEClass(ID_IMPL);
+
+ embeddedIdEClass = createEClass(EMBEDDED_ID);
+ createEReference(embeddedIdEClass, EMBEDDED_ID__ATTRIBUTE_OVERRIDES);
+
+ embeddedIdImplEClass = createEClass(EMBEDDED_ID_IMPL);
+
+ basicEClass = createEClass(BASIC);
+ createEAttribute(basicEClass, BASIC__FETCH);
+ createEAttribute(basicEClass, BASIC__OPTIONAL);
+ createEAttribute(basicEClass, BASIC__LOB);
+ createEAttribute(basicEClass, BASIC__TEMPORAL);
+ createEAttribute(basicEClass, BASIC__ENUMERATED);
+
+ basicImplEClass = createEClass(BASIC_IMPL);
+
+ versionEClass = createEClass(VERSION);
+ createEAttribute(versionEClass, VERSION__TEMPORAL);
+
+ versionImplEClass = createEClass(VERSION_IMPL);
+
+ manyToOneEClass = createEClass(MANY_TO_ONE);
+
+ manyToOneImplEClass = createEClass(MANY_TO_ONE_IMPL);
+
+ oneToManyEClass = createEClass(ONE_TO_MANY);
+ createEReference(oneToManyEClass, ONE_TO_MANY__JOIN_COLUMNS);
+
+ oneToManyImplEClass = createEClass(ONE_TO_MANY_IMPL);
+
+ oneToOneEClass = createEClass(ONE_TO_ONE);
+ createEAttribute(oneToOneEClass, ONE_TO_ONE__MAPPED_BY);
+ createEReference(oneToOneEClass, ONE_TO_ONE__PRIMARY_KEY_JOIN_COLUMNS);
+
+ oneToOneImplEClass = createEClass(ONE_TO_ONE_IMPL);
+
+ manyToManyEClass = createEClass(MANY_TO_MANY);
+
+ manyToManyImplEClass = createEClass(MANY_TO_MANY_IMPL);
+
+ embeddedEClass = createEClass(EMBEDDED);
+ createEReference(embeddedEClass, EMBEDDED__ATTRIBUTE_OVERRIDES);
+
+ embeddedImplEClass = createEClass(EMBEDDED_IMPL);
+
+ transientEClass = createEClass(TRANSIENT);
+
+ transientImplEClass = createEClass(TRANSIENT_IMPL);
+
+ associationOverrideEClass = createEClass(ASSOCIATION_OVERRIDE);
+ createEReference(associationOverrideEClass, ASSOCIATION_OVERRIDE__JOIN_COLUMNS);
+ createEAttribute(associationOverrideEClass, ASSOCIATION_OVERRIDE__NAME);
+
+ attributeOverrideEClass = createEClass(ATTRIBUTE_OVERRIDE);
+ createEReference(attributeOverrideEClass, ATTRIBUTE_OVERRIDE__COLUMN);
+ createEAttribute(attributeOverrideEClass, ATTRIBUTE_OVERRIDE__NAME);
+
+ attributeOverrideImplEClass = createEClass(ATTRIBUTE_OVERRIDE_IMPL);
+
+ cascadeTypeEClass = createEClass(CASCADE_TYPE);
+ createEAttribute(cascadeTypeEClass, CASCADE_TYPE__CASCADE_ALL);
+ createEAttribute(cascadeTypeEClass, CASCADE_TYPE__CASCADE_PERSIST);
+ createEAttribute(cascadeTypeEClass, CASCADE_TYPE__CASCADE_MERGE);
+ createEAttribute(cascadeTypeEClass, CASCADE_TYPE__CASCADE_REMOVE);
+ createEAttribute(cascadeTypeEClass, CASCADE_TYPE__CASCADE_REFRESH);
+
+ cascadeTypeImplEClass = createEClass(CASCADE_TYPE_IMPL);
+
+ namedColumnEClass = createEClass(NAMED_COLUMN);
+ createEAttribute(namedColumnEClass, NAMED_COLUMN__COLUMN_DEFINITION);
+ createEAttribute(namedColumnEClass, NAMED_COLUMN__NAME);
+
+ abstractColumnEClass = createEClass(ABSTRACT_COLUMN);
+ createEAttribute(abstractColumnEClass, ABSTRACT_COLUMN__INSERTABLE);
+ createEAttribute(abstractColumnEClass, ABSTRACT_COLUMN__NULLABLE);
+ createEAttribute(abstractColumnEClass, ABSTRACT_COLUMN__TABLE);
+ createEAttribute(abstractColumnEClass, ABSTRACT_COLUMN__UNIQUE);
+ createEAttribute(abstractColumnEClass, ABSTRACT_COLUMN__UPDATABLE);
+
+ columnEClass = createEClass(COLUMN);
+ createEAttribute(columnEClass, COLUMN__LENGTH);
+ createEAttribute(columnEClass, COLUMN__PRECISION);
+ createEAttribute(columnEClass, COLUMN__SCALE);
+
+ columnImplEClass = createEClass(COLUMN_IMPL);
+
+ columnResultEClass = createEClass(COLUMN_RESULT);
+ createEAttribute(columnResultEClass, COLUMN_RESULT__NAME);
+
+ discriminatorColumnEClass = createEClass(DISCRIMINATOR_COLUMN);
+ createEAttribute(discriminatorColumnEClass, DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE);
+ createEAttribute(discriminatorColumnEClass, DISCRIMINATOR_COLUMN__LENGTH);
+
+ entityListenersEClass = createEClass(ENTITY_LISTENERS);
+ createEReference(entityListenersEClass, ENTITY_LISTENERS__ENTITY_LISTENERS);
+
+ entityListenerEClass = createEClass(ENTITY_LISTENER);
+ createEAttribute(entityListenerEClass, ENTITY_LISTENER__CLASS_NAME);
+ createEReference(entityListenerEClass, ENTITY_LISTENER__PRE_PERSIST);
+ createEReference(entityListenerEClass, ENTITY_LISTENER__POST_PERSIST);
+ createEReference(entityListenerEClass, ENTITY_LISTENER__PRE_REMOVE);
+ createEReference(entityListenerEClass, ENTITY_LISTENER__POST_REMOVE);
+ createEReference(entityListenerEClass, ENTITY_LISTENER__PRE_UPDATE);
+ createEReference(entityListenerEClass, ENTITY_LISTENER__POST_UPDATE);
+ createEReference(entityListenerEClass, ENTITY_LISTENER__POST_LOAD);
+
+ entityResultEClass = createEClass(ENTITY_RESULT);
+ createEAttribute(entityResultEClass, ENTITY_RESULT__DISCRIMINATOR_COLUMN);
+ createEAttribute(entityResultEClass, ENTITY_RESULT__ENTITY_CLASS);
+ createEReference(entityResultEClass, ENTITY_RESULT__FIELD_RESULTS);
+
+ eventMethodEClass = createEClass(EVENT_METHOD);
+ createEAttribute(eventMethodEClass, EVENT_METHOD__METHOD_NAME);
+
+ fieldResultEClass = createEClass(FIELD_RESULT);
+ createEAttribute(fieldResultEClass, FIELD_RESULT__NAME);
+ createEAttribute(fieldResultEClass, FIELD_RESULT__COLUMN);
+
+ generatedValueEClass = createEClass(GENERATED_VALUE);
+ createEAttribute(generatedValueEClass, GENERATED_VALUE__GENERATOR);
+ createEAttribute(generatedValueEClass, GENERATED_VALUE__STRATEGY);
+
+ generatedValueImplEClass = createEClass(GENERATED_VALUE_IMPL);
+
+ idClassEClass = createEClass(ID_CLASS);
+ createEAttribute(idClassEClass, ID_CLASS__CLASS_NAME);
+
+ inheritanceEClass = createEClass(INHERITANCE);
+ createEAttribute(inheritanceEClass, INHERITANCE__STRATEGY);
+
+ joinColumnEClass = createEClass(JOIN_COLUMN);
+ createEAttribute(joinColumnEClass, JOIN_COLUMN__REFERENCED_COLUMN_NAME);
+
+ joinColumnImplEClass = createEClass(JOIN_COLUMN_IMPL);
+
+ joinTableEClass = createEClass(JOIN_TABLE);
+ createEReference(joinTableEClass, JOIN_TABLE__JOIN_COLUMNS);
+ createEReference(joinTableEClass, JOIN_TABLE__INVERSE_JOIN_COLUMNS);
+
+ joinTableImplEClass = createEClass(JOIN_TABLE_IMPL);
+
+ lobEClass = createEClass(LOB);
+
+ mapKeyEClass = createEClass(MAP_KEY);
+ createEAttribute(mapKeyEClass, MAP_KEY__NAME);
+
+ mapKeyImplEClass = createEClass(MAP_KEY_IMPL);
+
+ queryEClass = createEClass(QUERY);
+ createEAttribute(queryEClass, QUERY__NAME);
+ createEAttribute(queryEClass, QUERY__QUERY);
+ createEReference(queryEClass, QUERY__HINTS);
+
+ namedNativeQueryEClass = createEClass(NAMED_NATIVE_QUERY);
+ createEAttribute(namedNativeQueryEClass, NAMED_NATIVE_QUERY__RESULT_CLASS);
+ createEAttribute(namedNativeQueryEClass, NAMED_NATIVE_QUERY__RESULT_SET_MAPPING);
+
+ namedQueryEClass = createEClass(NAMED_QUERY);
+
+ postLoadEClass = createEClass(POST_LOAD);
+
+ postPersistEClass = createEClass(POST_PERSIST);
+
+ postRemoveEClass = createEClass(POST_REMOVE);
+
+ postUpdateEClass = createEClass(POST_UPDATE);
+
+ prePersistEClass = createEClass(PRE_PERSIST);
+
+ preRemoveEClass = createEClass(PRE_REMOVE);
+
+ preUpdateEClass = createEClass(PRE_UPDATE);
+
+ primaryKeyJoinColumnEClass = createEClass(PRIMARY_KEY_JOIN_COLUMN);
+ createEAttribute(primaryKeyJoinColumnEClass, PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME);
+
+ queryHintEClass = createEClass(QUERY_HINT);
+ createEAttribute(queryHintEClass, QUERY_HINT__NAME);
+ createEAttribute(queryHintEClass, QUERY_HINT__VALUE);
+
+ abstractTableEClass = createEClass(ABSTRACT_TABLE);
+ createEAttribute(abstractTableEClass, ABSTRACT_TABLE__NAME);
+ createEAttribute(abstractTableEClass, ABSTRACT_TABLE__CATALOG);
+ createEAttribute(abstractTableEClass, ABSTRACT_TABLE__SCHEMA);
+ createEReference(abstractTableEClass, ABSTRACT_TABLE__UNIQUE_CONSTRAINTS);
+
+ tableEClass = createEClass(TABLE);
+
+ secondaryTableEClass = createEClass(SECONDARY_TABLE);
+ createEReference(secondaryTableEClass, SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS);
+
+ generatorEClass = createEClass(GENERATOR);
+ createEAttribute(generatorEClass, GENERATOR__NAME);
+ createEAttribute(generatorEClass, GENERATOR__INITIAL_VALUE);
+ createEAttribute(generatorEClass, GENERATOR__ALLOCATION_SIZE);
+
+ sequenceGeneratorEClass = createEClass(SEQUENCE_GENERATOR);
+ createEAttribute(sequenceGeneratorEClass, SEQUENCE_GENERATOR__SEQUENCE_NAME);
+
+ sequenceGeneratorImplEClass = createEClass(SEQUENCE_GENERATOR_IMPL);
+
+ sqlResultSetMappingEClass = createEClass(SQL_RESULT_SET_MAPPING);
+ createEAttribute(sqlResultSetMappingEClass, SQL_RESULT_SET_MAPPING__NAME);
+ createEReference(sqlResultSetMappingEClass, SQL_RESULT_SET_MAPPING__ENTITY_RESULTS);
+ createEReference(sqlResultSetMappingEClass, SQL_RESULT_SET_MAPPING__COLUMN_RESULTS);
+
+ tableGeneratorEClass = createEClass(TABLE_GENERATOR);
+ createEAttribute(tableGeneratorEClass, TABLE_GENERATOR__TABLE);
+ createEAttribute(tableGeneratorEClass, TABLE_GENERATOR__CATALOG);
+ createEAttribute(tableGeneratorEClass, TABLE_GENERATOR__SCHEMA);
+ createEAttribute(tableGeneratorEClass, TABLE_GENERATOR__PK_COLUMN_NAME);
+ createEAttribute(tableGeneratorEClass, TABLE_GENERATOR__VALUE_COLUMN_NAME);
+ createEAttribute(tableGeneratorEClass, TABLE_GENERATOR__PK_COLUMN_VALUE);
+ createEReference(tableGeneratorEClass, TABLE_GENERATOR__UNIQUE_CONSTRAINTS);
+
+ tableGeneratorImplEClass = createEClass(TABLE_GENERATOR_IMPL);
+
+ uniqueConstraintEClass = createEClass(UNIQUE_CONSTRAINT);
+ createEAttribute(uniqueConstraintEClass, UNIQUE_CONSTRAINT__COLUMN_NAMES);
+
+ // Create enums
+ accessTypeEEnum = createEEnum(ACCESS_TYPE);
+ discriminatorTypeEEnum = createEEnum(DISCRIMINATOR_TYPE);
+ enumTypeEEnum = createEEnum(ENUM_TYPE);
+ fetchTypeEEnum = createEEnum(FETCH_TYPE);
+ generationTypeEEnum = createEEnum(GENERATION_TYPE);
+ inheritanceTypeEEnum = createEEnum(INHERITANCE_TYPE);
+ temporalTypeEEnum = createEEnum(TEMPORAL_TYPE);
+
+ // Create data types
+ discriminatorValueEDataType = createEDataType(DISCRIMINATOR_VALUE);
+ enumeratedEDataType = createEDataType(ENUMERATED);
+ orderByEDataType = createEDataType(ORDER_BY);
+ versionTypeEDataType = createEDataType(VERSION_TYPE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents()
+ {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Obtain other dependent packages
+ XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ mappedSuperclassEClass.getESuperTypes().add(this.getTypeMapping());
+ entityEClass.getESuperTypes().add(this.getTypeMapping());
+ embeddableEClass.getESuperTypes().add(this.getTypeMapping());
+ relationshipMappingEClass.getESuperTypes().add(this.getAttributeMapping());
+ multiRelationshipMappingEClass.getESuperTypes().add(this.getRelationshipMapping());
+ singleRelationshipMappingEClass.getESuperTypes().add(this.getRelationshipMapping());
+ idEClass.getESuperTypes().add(this.getAttributeMapping());
+ idEClass.getESuperTypes().add(this.getColumnMapping());
+ idImplEClass.getESuperTypes().add(this.getId());
+ embeddedIdEClass.getESuperTypes().add(this.getAttributeMapping());
+ embeddedIdImplEClass.getESuperTypes().add(this.getEmbeddedId());
+ basicEClass.getESuperTypes().add(this.getAttributeMapping());
+ basicEClass.getESuperTypes().add(this.getColumnMapping());
+ basicImplEClass.getESuperTypes().add(this.getBasic());
+ versionEClass.getESuperTypes().add(this.getAttributeMapping());
+ versionEClass.getESuperTypes().add(this.getColumnMapping());
+ versionImplEClass.getESuperTypes().add(this.getVersion());
+ manyToOneEClass.getESuperTypes().add(this.getSingleRelationshipMapping());
+ manyToOneImplEClass.getESuperTypes().add(this.getManyToOne());
+ oneToManyEClass.getESuperTypes().add(this.getMultiRelationshipMapping());
+ oneToManyImplEClass.getESuperTypes().add(this.getOneToMany());
+ oneToOneEClass.getESuperTypes().add(this.getSingleRelationshipMapping());
+ oneToOneImplEClass.getESuperTypes().add(this.getOneToOne());
+ manyToManyEClass.getESuperTypes().add(this.getMultiRelationshipMapping());
+ manyToManyImplEClass.getESuperTypes().add(this.getManyToMany());
+ embeddedEClass.getESuperTypes().add(this.getAttributeMapping());
+ embeddedImplEClass.getESuperTypes().add(this.getEmbedded());
+ transientEClass.getESuperTypes().add(this.getAttributeMapping());
+ transientImplEClass.getESuperTypes().add(this.getTransient());
+ attributeOverrideImplEClass.getESuperTypes().add(this.getAttributeOverride());
+ cascadeTypeImplEClass.getESuperTypes().add(this.getCascadeType());
+ abstractColumnEClass.getESuperTypes().add(this.getNamedColumn());
+ columnEClass.getESuperTypes().add(this.getAbstractColumn());
+ columnImplEClass.getESuperTypes().add(this.getColumn());
+ discriminatorColumnEClass.getESuperTypes().add(this.getNamedColumn());
+ generatedValueImplEClass.getESuperTypes().add(this.getGeneratedValue());
+ joinColumnEClass.getESuperTypes().add(this.getAbstractColumn());
+ joinColumnImplEClass.getESuperTypes().add(this.getJoinColumn());
+ joinTableEClass.getESuperTypes().add(this.getAbstractTable());
+ joinTableImplEClass.getESuperTypes().add(this.getJoinTable());
+ mapKeyImplEClass.getESuperTypes().add(this.getMapKey());
+ namedNativeQueryEClass.getESuperTypes().add(this.getQuery());
+ namedQueryEClass.getESuperTypes().add(this.getQuery());
+ postLoadEClass.getESuperTypes().add(this.getEventMethod());
+ postPersistEClass.getESuperTypes().add(this.getEventMethod());
+ postRemoveEClass.getESuperTypes().add(this.getEventMethod());
+ postUpdateEClass.getESuperTypes().add(this.getEventMethod());
+ prePersistEClass.getESuperTypes().add(this.getEventMethod());
+ preRemoveEClass.getESuperTypes().add(this.getEventMethod());
+ preUpdateEClass.getESuperTypes().add(this.getEventMethod());
+ primaryKeyJoinColumnEClass.getESuperTypes().add(this.getNamedColumn());
+ tableEClass.getESuperTypes().add(this.getAbstractTable());
+ secondaryTableEClass.getESuperTypes().add(this.getAbstractTable());
+ sequenceGeneratorEClass.getESuperTypes().add(this.getGenerator());
+ sequenceGeneratorImplEClass.getESuperTypes().add(this.getSequenceGenerator());
+ tableGeneratorEClass.getESuperTypes().add(this.getGenerator());
+ tableGeneratorImplEClass.getESuperTypes().add(this.getTableGenerator());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(entityMappingsEClass, EntityMappings.class, "EntityMappings", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getEntityMappings_Version(), this.getVersionType(), "version", "1.0", 1, 1, EntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getEntityMappings_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, EntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityMappings_PersistenceUnitMetadata(), this.getPersistenceUnitMetadata(), null, "persistenceUnitMetadata", null, 0, 1, EntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getEntityMappings_Package(), theXMLTypePackage.getString(), "package", null, 0, 1, EntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getEntityMappings_Schema(), theXMLTypePackage.getString(), "schema", null, 0, 1, EntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getEntityMappings_Catalog(), theXMLTypePackage.getString(), "catalog", null, 0, 1, EntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getEntityMappings_Access(), this.getAccessType(), "access", "PROPERTY", 0, 1, EntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityMappings_SequenceGenerators(), this.getSequenceGenerator(), null, "sequenceGenerators", null, 0, -1, EntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityMappings_TableGenerators(), this.getTableGenerator(), null, "tableGenerators", null, 0, -1, EntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityMappings_NamedQueries(), this.getNamedQuery(), null, "namedQueries", null, 0, -1, EntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityMappings_NamedNativeQueries(), this.getNamedNativeQuery(), null, "namedNativeQueries", null, 0, -1, EntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityMappings_SqlResultSetMappings(), this.getSqlResultSetMapping(), null, "sqlResultSetMappings", null, 0, -1, EntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityMappings_MappedSuperclasses(), this.getMappedSuperclass(), null, "mappedSuperclasses", null, 0, -1, EntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityMappings_Entities(), this.getEntity(), null, "entities", null, 0, -1, EntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityMappings_Embeddables(), this.getEmbeddable(), null, "embeddables", null, 0, -1, EntityMappings.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(persistenceUnitMetadataEClass, PersistenceUnitMetadata.class, "PersistenceUnitMetadata", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getPersistenceUnitMetadata_XmlMappingMetadataComplete(), theXMLTypePackage.getBoolean(), "xmlMappingMetadataComplete", null, 0, 1, PersistenceUnitMetadata.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getPersistenceUnitMetadata_PersistenceUnitDefaults(), this.getPersistenceUnitDefaults(), null, "persistenceUnitDefaults", null, 0, 1, PersistenceUnitMetadata.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(persistenceUnitDefaultsEClass, PersistenceUnitDefaults.class, "PersistenceUnitDefaults", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getPersistenceUnitDefaults_Schema(), theXMLTypePackage.getString(), "schema", null, 0, 1, PersistenceUnitDefaults.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getPersistenceUnitDefaults_Catalog(), theXMLTypePackage.getString(), "catalog", null, 0, 1, PersistenceUnitDefaults.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getPersistenceUnitDefaults_Access(), this.getAccessType(), "access", "PROPERTY", 0, 1, PersistenceUnitDefaults.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getPersistenceUnitDefaults_CascadePersist(), theXMLTypePackage.getBoolean(), "cascadePersist", null, 0, 1, PersistenceUnitDefaults.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getPersistenceUnitDefaults_EntityListeners(), this.getEntityListeners(), null, "entityListeners", null, 0, 1, PersistenceUnitDefaults.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(typeMappingEClass, TypeMapping.class, "TypeMapping", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getTypeMapping_ClassName(), theXMLTypePackage.getString(), "className", null, 1, 1, TypeMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getTypeMapping_Access(), this.getAccessType(), "access", "PROPERTY", 0, 1, TypeMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getTypeMapping_MetadataComplete(), theXMLTypePackage.getBooleanObject(), "metadataComplete", null, 0, 1, TypeMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getTypeMapping_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, TypeMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getTypeMapping_Attributes(), this.getAttributes(), null, "attributes", null, 0, 1, TypeMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(mappedSuperclassEClass, MappedSuperclass.class, "MappedSuperclass", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getMappedSuperclass_IdClass(), this.getIdClass(), null, "idClass", null, 0, 1, MappedSuperclass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getMappedSuperclass_ExcludeDefaultListeners(), theXMLTypePackage.getBoolean(), "excludeDefaultListeners", null, 0, 1, MappedSuperclass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getMappedSuperclass_ExcludeSuperclassListeners(), theXMLTypePackage.getBoolean(), "excludeSuperclassListeners", null, 0, 1, MappedSuperclass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getMappedSuperclass_EntityListeners(), this.getEntityListeners(), null, "entityListeners", null, 0, 1, MappedSuperclass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getMappedSuperclass_PrePersist(), this.getPrePersist(), null, "prePersist", null, 0, 1, MappedSuperclass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getMappedSuperclass_PostPersist(), this.getPostPersist(), null, "postPersist", null, 0, 1, MappedSuperclass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getMappedSuperclass_PreRemove(), this.getPreRemove(), null, "preRemove", null, 0, 1, MappedSuperclass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getMappedSuperclass_PostRemove(), this.getPostRemove(), null, "postRemove", null, 0, 1, MappedSuperclass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getMappedSuperclass_PreUpdate(), this.getPreUpdate(), null, "preUpdate", null, 0, 1, MappedSuperclass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getMappedSuperclass_PostUpdate(), this.getPostUpdate(), null, "postUpdate", null, 0, 1, MappedSuperclass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getMappedSuperclass_PostLoad(), this.getPostLoad(), null, "postLoad", null, 0, 1, MappedSuperclass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(entityEClass, Entity.class, "Entity", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getEntity_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_Table(), this.getTable(), null, "table", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_SecondaryTables(), this.getSecondaryTable(), null, "secondaryTables", null, 0, -1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_PrimaryKeyJoinColumns(), this.getPrimaryKeyJoinColumn(), null, "primaryKeyJoinColumns", null, 0, -1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_IdClass(), this.getIdClass(), null, "idClass", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_Inheritance(), this.getInheritance(), null, "inheritance", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getEntity_DiscriminatorValue(), this.getDiscriminatorValue(), "discriminatorValue", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_DiscriminatorColumn(), this.getDiscriminatorColumn(), null, "discriminatorColumn", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_SequenceGenerator(), this.getSequenceGenerator(), null, "sequenceGenerator", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_TableGenerator(), this.getTableGenerator(), null, "tableGenerator", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_NamedQueries(), this.getNamedQuery(), null, "namedQueries", null, 0, -1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_NamedNativeQueries(), this.getNamedNativeQuery(), null, "namedNativeQueries", null, 0, -1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_SqlResultSetMappings(), this.getSqlResultSetMapping(), null, "sqlResultSetMappings", null, 0, -1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getEntity_ExcludeDefaultListeners(), theXMLTypePackage.getBoolean(), "excludeDefaultListeners", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getEntity_ExcludeSuperclassListeners(), theXMLTypePackage.getBoolean(), "excludeSuperclassListeners", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_EntityListeners(), this.getEntityListeners(), null, "entityListeners", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_PrePersist(), this.getPrePersist(), null, "prePersist", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_PostPersist(), this.getPostPersist(), null, "postPersist", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_PreRemove(), this.getPreRemove(), null, "preRemove", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_PostRemove(), this.getPostRemove(), null, "postRemove", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_PreUpdate(), this.getPreUpdate(), null, "preUpdate", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_PostUpdate(), this.getPostUpdate(), null, "postUpdate", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_PostLoad(), this.getPostLoad(), null, "postLoad", null, 0, 1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_AttributeOverrides(), this.getAttributeOverride(), null, "attributeOverrides", null, 0, -1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntity_AssociationOverrides(), this.getAssociationOverride(), null, "associationOverrides", null, 0, -1, Entity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(embeddableEClass, Embeddable.class, "Embeddable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(attributesEClass, Attributes.class, "Attributes", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getAttributes_Ids(), this.getIdImpl(), null, "ids", null, 0, -1, Attributes.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAttributes_EmbeddedIds(), this.getEmbeddedIdImpl(), null, "embeddedIds", null, 0, -1, Attributes.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAttributes_Basics(), this.getBasicImpl(), null, "basics", null, 0, -1, Attributes.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAttributes_Versions(), this.getVersionImpl(), null, "versions", null, 0, -1, Attributes.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAttributes_ManyToOnes(), this.getManyToOneImpl(), null, "manyToOnes", null, 0, -1, Attributes.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAttributes_OneToManys(), this.getOneToManyImpl(), null, "oneToManys", null, 0, -1, Attributes.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAttributes_OneToOnes(), this.getOneToOneImpl(), null, "oneToOnes", null, 0, -1, Attributes.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAttributes_ManyToManys(), this.getManyToManyImpl(), null, "manyToManys", null, 0, -1, Attributes.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAttributes_Embeddeds(), this.getEmbeddedImpl(), null, "embeddeds", null, 0, -1, Attributes.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAttributes_Transients(), this.getTransientImpl(), null, "transients", null, 0, -1, Attributes.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(attributeMappingEClass, AttributeMapping.class, "AttributeMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getAttributeMapping_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, AttributeMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(columnMappingEClass, ColumnMapping.class, "ColumnMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getColumnMapping_Column(), this.getColumn(), null, "column", null, 0, 1, ColumnMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(relationshipMappingEClass, RelationshipMapping.class, "RelationshipMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getRelationshipMapping_TargetEntity(), theXMLTypePackage.getString(), "targetEntity", null, 0, 1, RelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getRelationshipMapping_Fetch(), this.getFetchType(), "fetch", "LAZY", 0, 1, RelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getRelationshipMapping_JoinTable(), this.getJoinTable(), null, "joinTable", null, 0, 1, RelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getRelationshipMapping_Cascade(), this.getCascadeType(), null, "cascade", null, 0, 1, RelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(multiRelationshipMappingEClass, MultiRelationshipMapping.class, "MultiRelationshipMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getMultiRelationshipMapping_MappedBy(), theXMLTypePackage.getString(), "mappedBy", null, 0, 1, MultiRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getMultiRelationshipMapping_OrderBy(), this.getOrderBy(), "orderBy", null, 0, 1, MultiRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getMultiRelationshipMapping_MapKey(), this.getMapKey(), null, "mapKey", null, 0, 1, MultiRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(singleRelationshipMappingEClass, SingleRelationshipMapping.class, "SingleRelationshipMapping", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getSingleRelationshipMapping_Optional(), theXMLTypePackage.getBooleanObject(), "optional", null, 0, 1, SingleRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getSingleRelationshipMapping_JoinColumns(), this.getJoinColumn(), null, "joinColumns", null, 0, -1, SingleRelationshipMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(idEClass, Id.class, "Id", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getId_GeneratedValue(), this.getGeneratedValue(), null, "generatedValue", null, 0, 1, Id.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getId_Temporal(), this.getTemporalType(), "temporal", null, 0, 1, Id.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getId_TableGenerator(), this.getTableGenerator(), null, "tableGenerator", null, 0, 1, Id.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getId_SequenceGenerator(), this.getSequenceGenerator(), null, "sequenceGenerator", null, 0, 1, Id.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(idImplEClass, IdImpl.class, "IdImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(embeddedIdEClass, EmbeddedId.class, "EmbeddedId", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getEmbeddedId_AttributeOverrides(), this.getAttributeOverride(), null, "attributeOverrides", null, 0, -1, EmbeddedId.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(embeddedIdImplEClass, EmbeddedIdImpl.class, "EmbeddedIdImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(basicEClass, Basic.class, "Basic", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getBasic_Fetch(), this.getFetchType(), "fetch", "LAZY", 0, 1, Basic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getBasic_Optional(), theXMLTypePackage.getBooleanObject(), "optional", null, 0, 1, Basic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getBasic_Lob(), theXMLTypePackage.getBoolean(), "lob", null, 0, 1, Basic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getBasic_Temporal(), this.getTemporalType(), "temporal", null, 0, 1, Basic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getBasic_Enumerated(), this.getEnumType(), "enumerated", null, 0, 1, Basic.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(basicImplEClass, BasicImpl.class, "BasicImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(versionEClass, Version.class, "Version", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getVersion_Temporal(), this.getTemporalType(), "temporal", null, 0, 1, Version.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(versionImplEClass, VersionImpl.class, "VersionImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(manyToOneEClass, ManyToOne.class, "ManyToOne", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(manyToOneImplEClass, ManyToOneImpl.class, "ManyToOneImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(oneToManyEClass, OneToMany.class, "OneToMany", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getOneToMany_JoinColumns(), this.getJoinColumn(), null, "joinColumns", null, 0, -1, OneToMany.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(oneToManyImplEClass, OneToManyImpl.class, "OneToManyImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(oneToOneEClass, OneToOne.class, "OneToOne", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getOneToOne_MappedBy(), theXMLTypePackage.getString(), "mappedBy", null, 0, 1, OneToOne.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getOneToOne_PrimaryKeyJoinColumns(), this.getPrimaryKeyJoinColumn(), null, "primaryKeyJoinColumns", null, 0, -1, OneToOne.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(oneToOneImplEClass, OneToOneImpl.class, "OneToOneImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(manyToManyEClass, ManyToMany.class, "ManyToMany", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(manyToManyImplEClass, ManyToManyImpl.class, "ManyToManyImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(embeddedEClass, Embedded.class, "Embedded", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getEmbedded_AttributeOverrides(), this.getAttributeOverride(), null, "attributeOverrides", null, 0, -1, Embedded.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(embeddedImplEClass, EmbeddedImpl.class, "EmbeddedImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(transientEClass, Transient.class, "Transient", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(transientImplEClass, TransientImpl.class, "TransientImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(associationOverrideEClass, AssociationOverride.class, "AssociationOverride", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getAssociationOverride_JoinColumns(), this.getJoinColumn(), null, "joinColumns", null, 1, -1, AssociationOverride.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAssociationOverride_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, AssociationOverride.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(attributeOverrideEClass, AttributeOverride.class, "AttributeOverride", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getAttributeOverride_Column(), this.getColumn(), null, "column", null, 1, 1, AttributeOverride.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAttributeOverride_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, AttributeOverride.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(attributeOverrideImplEClass, AttributeOverrideImpl.class, "AttributeOverrideImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(cascadeTypeEClass, CascadeType.class, "CascadeType", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getCascadeType_CascadeAll(), theXMLTypePackage.getBoolean(), "cascadeAll", null, 0, 1, CascadeType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getCascadeType_CascadePersist(), theXMLTypePackage.getBoolean(), "cascadePersist", null, 0, 1, CascadeType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getCascadeType_CascadeMerge(), theXMLTypePackage.getBoolean(), "cascadeMerge", null, 0, 1, CascadeType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getCascadeType_CascadeRemove(), theXMLTypePackage.getBoolean(), "cascadeRemove", null, 0, 1, CascadeType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getCascadeType_CascadeRefresh(), theXMLTypePackage.getBoolean(), "cascadeRefresh", null, 0, 1, CascadeType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(cascadeTypeImplEClass, CascadeTypeImpl.class, "CascadeTypeImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(namedColumnEClass, NamedColumn.class, "NamedColumn", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getNamedColumn_ColumnDefinition(), theXMLTypePackage.getString(), "columnDefinition", null, 0, 1, NamedColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getNamedColumn_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, NamedColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(abstractColumnEClass, AbstractColumn.class, "AbstractColumn", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getAbstractColumn_Insertable(), theXMLTypePackage.getBooleanObject(), "insertable", null, 0, 1, AbstractColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractColumn_Nullable(), theXMLTypePackage.getBooleanObject(), "nullable", null, 0, 1, AbstractColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractColumn_Table(), theXMLTypePackage.getString(), "table", null, 0, 1, AbstractColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractColumn_Unique(), theXMLTypePackage.getBooleanObject(), "unique", null, 0, 1, AbstractColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractColumn_Updatable(), theXMLTypePackage.getBooleanObject(), "updatable", null, 0, 1, AbstractColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(columnEClass, Column.class, "Column", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getColumn_Length(), theXMLTypePackage.getIntObject(), "length", null, 0, 1, Column.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getColumn_Precision(), theXMLTypePackage.getIntObject(), "precision", null, 0, 1, Column.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getColumn_Scale(), theXMLTypePackage.getIntObject(), "scale", null, 0, 1, Column.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(columnImplEClass, ColumnImpl.class, "ColumnImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(columnResultEClass, ColumnResult.class, "ColumnResult", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getColumnResult_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, ColumnResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(discriminatorColumnEClass, DiscriminatorColumn.class, "DiscriminatorColumn", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getDiscriminatorColumn_DiscriminatorType(), this.getDiscriminatorType(), "discriminatorType", "STRING", 0, 1, DiscriminatorColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getDiscriminatorColumn_Length(), theXMLTypePackage.getIntObject(), "length", null, 0, 1, DiscriminatorColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(entityListenersEClass, EntityListeners.class, "EntityListeners", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getEntityListeners_EntityListeners(), this.getEntityListener(), null, "entityListeners", null, 0, -1, EntityListeners.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(entityListenerEClass, EntityListener.class, "EntityListener", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getEntityListener_ClassName(), theXMLTypePackage.getString(), "className", null, 1, 1, EntityListener.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityListener_PrePersist(), this.getPrePersist(), null, "prePersist", null, 0, 1, EntityListener.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityListener_PostPersist(), this.getPostPersist(), null, "postPersist", null, 0, 1, EntityListener.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityListener_PreRemove(), this.getPreRemove(), null, "preRemove", null, 0, 1, EntityListener.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityListener_PostRemove(), this.getPostRemove(), null, "postRemove", null, 0, 1, EntityListener.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityListener_PreUpdate(), this.getPreUpdate(), null, "preUpdate", null, 0, 1, EntityListener.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityListener_PostUpdate(), this.getPostUpdate(), null, "postUpdate", null, 0, 1, EntityListener.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityListener_PostLoad(), this.getPostLoad(), null, "postLoad", null, 0, 1, EntityListener.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(entityResultEClass, EntityResult.class, "EntityResult", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getEntityResult_DiscriminatorColumn(), theXMLTypePackage.getString(), "discriminatorColumn", null, 0, 1, EntityResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getEntityResult_EntityClass(), theXMLTypePackage.getString(), "entityClass", null, 1, 1, EntityResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getEntityResult_FieldResults(), this.getFieldResult(), null, "fieldResults", null, 0, -1, EntityResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(eventMethodEClass, EventMethod.class, "EventMethod", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getEventMethod_MethodName(), theXMLTypePackage.getString(), "methodName", null, 1, 1, EventMethod.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(fieldResultEClass, FieldResult.class, "FieldResult", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getFieldResult_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, FieldResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getFieldResult_Column(), theXMLTypePackage.getString(), "column", null, 1, 1, FieldResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(generatedValueEClass, GeneratedValue.class, "GeneratedValue", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getGeneratedValue_Generator(), theXMLTypePackage.getString(), "generator", null, 0, 1, GeneratedValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getGeneratedValue_Strategy(), this.getGenerationType(), "strategy", "TABLE", 0, 1, GeneratedValue.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(generatedValueImplEClass, GeneratedValueImpl.class, "GeneratedValueImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(idClassEClass, IdClass.class, "IdClass", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getIdClass_ClassName(), theXMLTypePackage.getString(), "className", null, 1, 1, IdClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(inheritanceEClass, Inheritance.class, "Inheritance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getInheritance_Strategy(), this.getInheritanceType(), "strategy", "SINGLE_TABLE", 0, 1, Inheritance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(joinColumnEClass, JoinColumn.class, "JoinColumn", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getJoinColumn_ReferencedColumnName(), theXMLTypePackage.getString(), "referencedColumnName", null, 0, 1, JoinColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(joinColumnImplEClass, JoinColumnImpl.class, "JoinColumnImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(joinTableEClass, JoinTable.class, "JoinTable", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getJoinTable_JoinColumns(), this.getJoinColumn(), null, "joinColumns", null, 0, -1, JoinTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getJoinTable_InverseJoinColumns(), this.getJoinColumn(), null, "inverseJoinColumns", null, 0, -1, JoinTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(joinTableImplEClass, JoinTableImpl.class, "JoinTableImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(lobEClass, Lob.class, "Lob", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(mapKeyEClass, MapKey.class, "MapKey", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getMapKey_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, MapKey.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(mapKeyImplEClass, MapKeyImpl.class, "MapKeyImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(queryEClass, Query.class, "Query", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getQuery_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, Query.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getQuery_Query(), theXMLTypePackage.getString(), "query", null, 1, 1, Query.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getQuery_Hints(), this.getQueryHint(), null, "hints", null, 0, -1, Query.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(namedNativeQueryEClass, NamedNativeQuery.class, "NamedNativeQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getNamedNativeQuery_ResultClass(), theXMLTypePackage.getString(), "resultClass", null, 0, 1, NamedNativeQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getNamedNativeQuery_ResultSetMapping(), theXMLTypePackage.getString(), "resultSetMapping", null, 0, 1, NamedNativeQuery.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(namedQueryEClass, NamedQuery.class, "NamedQuery", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(postLoadEClass, PostLoad.class, "PostLoad", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(postPersistEClass, PostPersist.class, "PostPersist", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(postRemoveEClass, PostRemove.class, "PostRemove", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(postUpdateEClass, PostUpdate.class, "PostUpdate", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(prePersistEClass, PrePersist.class, "PrePersist", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(preRemoveEClass, PreRemove.class, "PreRemove", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(preUpdateEClass, PreUpdate.class, "PreUpdate", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(primaryKeyJoinColumnEClass, PrimaryKeyJoinColumn.class, "PrimaryKeyJoinColumn", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getPrimaryKeyJoinColumn_ReferencedColumnName(), theXMLTypePackage.getString(), "referencedColumnName", null, 0, 1, PrimaryKeyJoinColumn.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(queryHintEClass, QueryHint.class, "QueryHint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getQueryHint_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, QueryHint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getQueryHint_Value(), theXMLTypePackage.getString(), "value", null, 1, 1, QueryHint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(abstractTableEClass, AbstractTable.class, "AbstractTable", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getAbstractTable_Name(), theXMLTypePackage.getString(), "name", null, 0, 1, AbstractTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractTable_Catalog(), theXMLTypePackage.getString(), "catalog", null, 0, 1, AbstractTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractTable_Schema(), theXMLTypePackage.getString(), "schema", null, 0, 1, AbstractTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAbstractTable_UniqueConstraints(), this.getUniqueConstraint(), null, "uniqueConstraints", null, 0, -1, AbstractTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(tableEClass, Table.class, "Table", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(secondaryTableEClass, SecondaryTable.class, "SecondaryTable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getSecondaryTable_PrimaryKeyJoinColumns(), this.getPrimaryKeyJoinColumn(), null, "primaryKeyJoinColumns", null, 0, -1, SecondaryTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(generatorEClass, Generator.class, "Generator", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getGenerator_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, Generator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getGenerator_InitialValue(), theXMLTypePackage.getIntObject(), "initialValue", null, 0, 1, Generator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getGenerator_AllocationSize(), theXMLTypePackage.getIntObject(), "allocationSize", null, 0, 1, Generator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(sequenceGeneratorEClass, SequenceGenerator.class, "SequenceGenerator", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getSequenceGenerator_SequenceName(), theXMLTypePackage.getString(), "sequenceName", null, 0, 1, SequenceGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(sequenceGeneratorImplEClass, SequenceGeneratorImpl.class, "SequenceGeneratorImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(sqlResultSetMappingEClass, SqlResultSetMapping.class, "SqlResultSetMapping", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getSqlResultSetMapping_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, SqlResultSetMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getSqlResultSetMapping_EntityResults(), this.getEntityResult(), null, "entityResults", null, 0, -1, SqlResultSetMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getSqlResultSetMapping_ColumnResults(), this.getColumnResult(), null, "columnResults", null, 0, -1, SqlResultSetMapping.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(tableGeneratorEClass, TableGenerator.class, "TableGenerator", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getTableGenerator_Table(), theXMLTypePackage.getString(), "table", null, 0, 1, TableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getTableGenerator_Catalog(), theXMLTypePackage.getString(), "catalog", null, 0, 1, TableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getTableGenerator_Schema(), theXMLTypePackage.getString(), "schema", null, 0, 1, TableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getTableGenerator_PkColumnName(), theXMLTypePackage.getString(), "pkColumnName", null, 0, 1, TableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getTableGenerator_ValueColumnName(), theXMLTypePackage.getString(), "valueColumnName", null, 0, 1, TableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getTableGenerator_PkColumnValue(), theXMLTypePackage.getString(), "pkColumnValue", null, 0, 1, TableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getTableGenerator_UniqueConstraints(), this.getUniqueConstraint(), null, "uniqueConstraints", null, 0, -1, TableGenerator.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(tableGeneratorImplEClass, TableGeneratorImpl.class, "TableGeneratorImpl", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(uniqueConstraintEClass, UniqueConstraint.class, "UniqueConstraint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getUniqueConstraint_ColumnNames(), theXMLTypePackage.getString(), "columnNames", null, 1, -1, UniqueConstraint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Initialize enums and add enum literals
+ initEEnum(accessTypeEEnum, AccessType.class, "AccessType");
+ addEEnumLiteral(accessTypeEEnum, AccessType.PROPERTY);
+ addEEnumLiteral(accessTypeEEnum, AccessType.FIELD);
+
+ initEEnum(discriminatorTypeEEnum, DiscriminatorType.class, "DiscriminatorType");
+ addEEnumLiteral(discriminatorTypeEEnum, DiscriminatorType.STRING);
+ addEEnumLiteral(discriminatorTypeEEnum, DiscriminatorType.CHAR);
+ addEEnumLiteral(discriminatorTypeEEnum, DiscriminatorType.INTEGER);
+
+ initEEnum(enumTypeEEnum, EnumType.class, "EnumType");
+ addEEnumLiteral(enumTypeEEnum, EnumType.ORDINAL);
+ addEEnumLiteral(enumTypeEEnum, EnumType.STRING);
+
+ initEEnum(fetchTypeEEnum, FetchType.class, "FetchType");
+ addEEnumLiteral(fetchTypeEEnum, FetchType.LAZY);
+ addEEnumLiteral(fetchTypeEEnum, FetchType.EAGER);
+
+ initEEnum(generationTypeEEnum, GenerationType.class, "GenerationType");
+ addEEnumLiteral(generationTypeEEnum, GenerationType.TABLE);
+ addEEnumLiteral(generationTypeEEnum, GenerationType.SEQUENCE);
+ addEEnumLiteral(generationTypeEEnum, GenerationType.IDENTITY);
+ addEEnumLiteral(generationTypeEEnum, GenerationType.AUTO);
+
+ initEEnum(inheritanceTypeEEnum, InheritanceType.class, "InheritanceType");
+ addEEnumLiteral(inheritanceTypeEEnum, InheritanceType.SINGLE_TABLE);
+ addEEnumLiteral(inheritanceTypeEEnum, InheritanceType.JOINED);
+ addEEnumLiteral(inheritanceTypeEEnum, InheritanceType.TABLE_PER_CLASS);
+
+ initEEnum(temporalTypeEEnum, TemporalType.class, "TemporalType");
+ addEEnumLiteral(temporalTypeEEnum, TemporalType.DATE);
+ addEEnumLiteral(temporalTypeEEnum, TemporalType.TIME);
+ addEEnumLiteral(temporalTypeEEnum, TemporalType.TIMESTAMP);
+
+ // Initialize data types
+ initEDataType(discriminatorValueEDataType, String.class, "DiscriminatorValue", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
+ initEDataType(enumeratedEDataType, Enumerator.class, "Enumerated", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
+ initEDataType(orderByEDataType, String.class, "OrderBy", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
+ initEDataType(versionTypeEDataType, String.class, "VersionType", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public interface Literals
+ {
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings <em>Entity Mappings</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityMappings()
+ * @generated
+ */
+ public static final EClass ENTITY_MAPPINGS = eINSTANCE.getEntityMappings();
+
+ /**
+ * The meta object literal for the '<em><b>Version</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ENTITY_MAPPINGS__VERSION = eINSTANCE.getEntityMappings_Version();
+
+ /**
+ * The meta object literal for the '<em><b>Description</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ENTITY_MAPPINGS__DESCRIPTION = eINSTANCE.getEntityMappings_Description();
+
+ /**
+ * The meta object literal for the '<em><b>Persistence Unit Metadata</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_MAPPINGS__PERSISTENCE_UNIT_METADATA = eINSTANCE.getEntityMappings_PersistenceUnitMetadata();
+
+ /**
+ * The meta object literal for the '<em><b>Package</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ENTITY_MAPPINGS__PACKAGE = eINSTANCE.getEntityMappings_Package();
+
+ /**
+ * The meta object literal for the '<em><b>Schema</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ENTITY_MAPPINGS__SCHEMA = eINSTANCE.getEntityMappings_Schema();
+
+ /**
+ * The meta object literal for the '<em><b>Catalog</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ENTITY_MAPPINGS__CATALOG = eINSTANCE.getEntityMappings_Catalog();
+
+ /**
+ * The meta object literal for the '<em><b>Access</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ENTITY_MAPPINGS__ACCESS = eINSTANCE.getEntityMappings_Access();
+
+ /**
+ * The meta object literal for the '<em><b>Sequence Generators</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_MAPPINGS__SEQUENCE_GENERATORS = eINSTANCE.getEntityMappings_SequenceGenerators();
+
+ /**
+ * The meta object literal for the '<em><b>Table Generators</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_MAPPINGS__TABLE_GENERATORS = eINSTANCE.getEntityMappings_TableGenerators();
+
+ /**
+ * The meta object literal for the '<em><b>Named Queries</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_MAPPINGS__NAMED_QUERIES = eINSTANCE.getEntityMappings_NamedQueries();
+
+ /**
+ * The meta object literal for the '<em><b>Named Native Queries</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_MAPPINGS__NAMED_NATIVE_QUERIES = eINSTANCE.getEntityMappings_NamedNativeQueries();
+
+ /**
+ * The meta object literal for the '<em><b>Sql Result Set Mappings</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_MAPPINGS__SQL_RESULT_SET_MAPPINGS = eINSTANCE.getEntityMappings_SqlResultSetMappings();
+
+ /**
+ * The meta object literal for the '<em><b>Mapped Superclasses</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_MAPPINGS__MAPPED_SUPERCLASSES = eINSTANCE.getEntityMappings_MappedSuperclasses();
+
+ /**
+ * The meta object literal for the '<em><b>Entities</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_MAPPINGS__ENTITIES = eINSTANCE.getEntityMappings_Entities();
+
+ /**
+ * The meta object literal for the '<em><b>Embeddables</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_MAPPINGS__EMBEDDABLES = eINSTANCE.getEntityMappings_Embeddables();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata <em>Persistence Unit Metadata</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPersistenceUnitMetadata()
+ * @generated
+ */
+ public static final EClass PERSISTENCE_UNIT_METADATA = eINSTANCE.getPersistenceUnitMetadata();
+
+ /**
+ * The meta object literal for the '<em><b>Xml Mapping Metadata Complete</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE = eINSTANCE.getPersistenceUnitMetadata_XmlMappingMetadataComplete();
+
+ /**
+ * The meta object literal for the '<em><b>Persistence Unit Defaults</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS = eINSTANCE.getPersistenceUnitMetadata_PersistenceUnitDefaults();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults <em>Persistence Unit Defaults</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPersistenceUnitDefaults()
+ * @generated
+ */
+ public static final EClass PERSISTENCE_UNIT_DEFAULTS = eINSTANCE.getPersistenceUnitDefaults();
+
+ /**
+ * The meta object literal for the '<em><b>Schema</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute PERSISTENCE_UNIT_DEFAULTS__SCHEMA = eINSTANCE.getPersistenceUnitDefaults_Schema();
+
+ /**
+ * The meta object literal for the '<em><b>Catalog</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute PERSISTENCE_UNIT_DEFAULTS__CATALOG = eINSTANCE.getPersistenceUnitDefaults_Catalog();
+
+ /**
+ * The meta object literal for the '<em><b>Access</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute PERSISTENCE_UNIT_DEFAULTS__ACCESS = eINSTANCE.getPersistenceUnitDefaults_Access();
+
+ /**
+ * The meta object literal for the '<em><b>Cascade Persist</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST = eINSTANCE.getPersistenceUnitDefaults_CascadePersist();
+
+ /**
+ * The meta object literal for the '<em><b>Entity Listeners</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS = eINSTANCE.getPersistenceUnitDefaults_EntityListeners();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping <em>Type Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.TypeMapping
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTypeMapping()
+ * @generated
+ */
+ public static final EClass TYPE_MAPPING = eINSTANCE.getTypeMapping();
+
+ /**
+ * The meta object literal for the '<em><b>Class Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute TYPE_MAPPING__CLASS_NAME = eINSTANCE.getTypeMapping_ClassName();
+
+ /**
+ * The meta object literal for the '<em><b>Access</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute TYPE_MAPPING__ACCESS = eINSTANCE.getTypeMapping_Access();
+
+ /**
+ * The meta object literal for the '<em><b>Metadata Complete</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute TYPE_MAPPING__METADATA_COMPLETE = eINSTANCE.getTypeMapping_MetadataComplete();
+
+ /**
+ * The meta object literal for the '<em><b>Description</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute TYPE_MAPPING__DESCRIPTION = eINSTANCE.getTypeMapping_Description();
+
+ /**
+ * The meta object literal for the '<em><b>Attributes</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference TYPE_MAPPING__ATTRIBUTES = eINSTANCE.getTypeMapping_Attributes();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass <em>Mapped Superclass</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMappedSuperclass()
+ * @generated
+ */
+ public static final EClass MAPPED_SUPERCLASS = eINSTANCE.getMappedSuperclass();
+
+ /**
+ * The meta object literal for the '<em><b>Id Class</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference MAPPED_SUPERCLASS__ID_CLASS = eINSTANCE.getMappedSuperclass_IdClass();
+
+ /**
+ * The meta object literal for the '<em><b>Exclude Default Listeners</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute MAPPED_SUPERCLASS__EXCLUDE_DEFAULT_LISTENERS = eINSTANCE.getMappedSuperclass_ExcludeDefaultListeners();
+
+ /**
+ * The meta object literal for the '<em><b>Exclude Superclass Listeners</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute MAPPED_SUPERCLASS__EXCLUDE_SUPERCLASS_LISTENERS = eINSTANCE.getMappedSuperclass_ExcludeSuperclassListeners();
+
+ /**
+ * The meta object literal for the '<em><b>Entity Listeners</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference MAPPED_SUPERCLASS__ENTITY_LISTENERS = eINSTANCE.getMappedSuperclass_EntityListeners();
+
+ /**
+ * The meta object literal for the '<em><b>Pre Persist</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference MAPPED_SUPERCLASS__PRE_PERSIST = eINSTANCE.getMappedSuperclass_PrePersist();
+
+ /**
+ * The meta object literal for the '<em><b>Post Persist</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference MAPPED_SUPERCLASS__POST_PERSIST = eINSTANCE.getMappedSuperclass_PostPersist();
+
+ /**
+ * The meta object literal for the '<em><b>Pre Remove</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference MAPPED_SUPERCLASS__PRE_REMOVE = eINSTANCE.getMappedSuperclass_PreRemove();
+
+ /**
+ * The meta object literal for the '<em><b>Post Remove</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference MAPPED_SUPERCLASS__POST_REMOVE = eINSTANCE.getMappedSuperclass_PostRemove();
+
+ /**
+ * The meta object literal for the '<em><b>Pre Update</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference MAPPED_SUPERCLASS__PRE_UPDATE = eINSTANCE.getMappedSuperclass_PreUpdate();
+
+ /**
+ * The meta object literal for the '<em><b>Post Update</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference MAPPED_SUPERCLASS__POST_UPDATE = eINSTANCE.getMappedSuperclass_PostUpdate();
+
+ /**
+ * The meta object literal for the '<em><b>Post Load</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference MAPPED_SUPERCLASS__POST_LOAD = eINSTANCE.getMappedSuperclass_PostLoad();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.Entity <em>Entity</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntity()
+ * @generated
+ */
+ public static final EClass ENTITY = eINSTANCE.getEntity();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ENTITY__NAME = eINSTANCE.getEntity_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Table</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__TABLE = eINSTANCE.getEntity_Table();
+
+ /**
+ * The meta object literal for the '<em><b>Secondary Tables</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__SECONDARY_TABLES = eINSTANCE.getEntity_SecondaryTables();
+
+ /**
+ * The meta object literal for the '<em><b>Primary Key Join Columns</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__PRIMARY_KEY_JOIN_COLUMNS = eINSTANCE.getEntity_PrimaryKeyJoinColumns();
+
+ /**
+ * The meta object literal for the '<em><b>Id Class</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__ID_CLASS = eINSTANCE.getEntity_IdClass();
+
+ /**
+ * The meta object literal for the '<em><b>Inheritance</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__INHERITANCE = eINSTANCE.getEntity_Inheritance();
+
+ /**
+ * The meta object literal for the '<em><b>Discriminator Value</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ENTITY__DISCRIMINATOR_VALUE = eINSTANCE.getEntity_DiscriminatorValue();
+
+ /**
+ * The meta object literal for the '<em><b>Discriminator Column</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__DISCRIMINATOR_COLUMN = eINSTANCE.getEntity_DiscriminatorColumn();
+
+ /**
+ * The meta object literal for the '<em><b>Sequence Generator</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__SEQUENCE_GENERATOR = eINSTANCE.getEntity_SequenceGenerator();
+
+ /**
+ * The meta object literal for the '<em><b>Table Generator</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__TABLE_GENERATOR = eINSTANCE.getEntity_TableGenerator();
+
+ /**
+ * The meta object literal for the '<em><b>Named Queries</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__NAMED_QUERIES = eINSTANCE.getEntity_NamedQueries();
+
+ /**
+ * The meta object literal for the '<em><b>Named Native Queries</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__NAMED_NATIVE_QUERIES = eINSTANCE.getEntity_NamedNativeQueries();
+
+ /**
+ * The meta object literal for the '<em><b>Sql Result Set Mappings</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__SQL_RESULT_SET_MAPPINGS = eINSTANCE.getEntity_SqlResultSetMappings();
+
+ /**
+ * The meta object literal for the '<em><b>Exclude Default Listeners</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ENTITY__EXCLUDE_DEFAULT_LISTENERS = eINSTANCE.getEntity_ExcludeDefaultListeners();
+
+ /**
+ * The meta object literal for the '<em><b>Exclude Superclass Listeners</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ENTITY__EXCLUDE_SUPERCLASS_LISTENERS = eINSTANCE.getEntity_ExcludeSuperclassListeners();
+
+ /**
+ * The meta object literal for the '<em><b>Entity Listeners</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__ENTITY_LISTENERS = eINSTANCE.getEntity_EntityListeners();
+
+ /**
+ * The meta object literal for the '<em><b>Pre Persist</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__PRE_PERSIST = eINSTANCE.getEntity_PrePersist();
+
+ /**
+ * The meta object literal for the '<em><b>Post Persist</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__POST_PERSIST = eINSTANCE.getEntity_PostPersist();
+
+ /**
+ * The meta object literal for the '<em><b>Pre Remove</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__PRE_REMOVE = eINSTANCE.getEntity_PreRemove();
+
+ /**
+ * The meta object literal for the '<em><b>Post Remove</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__POST_REMOVE = eINSTANCE.getEntity_PostRemove();
+
+ /**
+ * The meta object literal for the '<em><b>Pre Update</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__PRE_UPDATE = eINSTANCE.getEntity_PreUpdate();
+
+ /**
+ * The meta object literal for the '<em><b>Post Update</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__POST_UPDATE = eINSTANCE.getEntity_PostUpdate();
+
+ /**
+ * The meta object literal for the '<em><b>Post Load</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__POST_LOAD = eINSTANCE.getEntity_PostLoad();
+
+ /**
+ * The meta object literal for the '<em><b>Attribute Overrides</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__ATTRIBUTE_OVERRIDES = eINSTANCE.getEntity_AttributeOverrides();
+
+ /**
+ * The meta object literal for the '<em><b>Association Overrides</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY__ASSOCIATION_OVERRIDES = eINSTANCE.getEntity_AssociationOverrides();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.Embeddable <em>Embeddable</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Embeddable
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbeddable()
+ * @generated
+ */
+ public static final EClass EMBEDDABLE = eINSTANCE.getEmbeddable();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.Attributes <em>Attributes</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Attributes
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributes()
+ * @generated
+ */
+ public static final EClass ATTRIBUTES = eINSTANCE.getAttributes();
+
+ /**
+ * The meta object literal for the '<em><b>Ids</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ATTRIBUTES__IDS = eINSTANCE.getAttributes_Ids();
+
+ /**
+ * The meta object literal for the '<em><b>Embedded Ids</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ATTRIBUTES__EMBEDDED_IDS = eINSTANCE.getAttributes_EmbeddedIds();
+
+ /**
+ * The meta object literal for the '<em><b>Basics</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ATTRIBUTES__BASICS = eINSTANCE.getAttributes_Basics();
+
+ /**
+ * The meta object literal for the '<em><b>Versions</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ATTRIBUTES__VERSIONS = eINSTANCE.getAttributes_Versions();
+
+ /**
+ * The meta object literal for the '<em><b>Many To Ones</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ATTRIBUTES__MANY_TO_ONES = eINSTANCE.getAttributes_ManyToOnes();
+
+ /**
+ * The meta object literal for the '<em><b>One To Manys</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ATTRIBUTES__ONE_TO_MANYS = eINSTANCE.getAttributes_OneToManys();
+
+ /**
+ * The meta object literal for the '<em><b>One To Ones</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ATTRIBUTES__ONE_TO_ONES = eINSTANCE.getAttributes_OneToOnes();
+
+ /**
+ * The meta object literal for the '<em><b>Many To Manys</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ATTRIBUTES__MANY_TO_MANYS = eINSTANCE.getAttributes_ManyToManys();
+
+ /**
+ * The meta object literal for the '<em><b>Embeddeds</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ATTRIBUTES__EMBEDDEDS = eINSTANCE.getAttributes_Embeddeds();
+
+ /**
+ * The meta object literal for the '<em><b>Transients</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ATTRIBUTES__TRANSIENTS = eINSTANCE.getAttributes_Transients();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeMapping <em>Attribute Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.AttributeMapping
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeMapping()
+ * @generated
+ */
+ public static final EClass ATTRIBUTE_MAPPING = eINSTANCE.getAttributeMapping();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ATTRIBUTE_MAPPING__NAME = eINSTANCE.getAttributeMapping_Name();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnMapping <em>Column Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.ColumnMapping
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumnMapping()
+ * @generated
+ */
+ public static final EClass COLUMN_MAPPING = eINSTANCE.getColumnMapping();
+
+ /**
+ * The meta object literal for the '<em><b>Column</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference COLUMN_MAPPING__COLUMN = eINSTANCE.getColumnMapping_Column();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping <em>Relationship Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping()
+ * @generated
+ */
+ public static final EClass RELATIONSHIP_MAPPING = eINSTANCE.getRelationshipMapping();
+
+ /**
+ * The meta object literal for the '<em><b>Target Entity</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute RELATIONSHIP_MAPPING__TARGET_ENTITY = eINSTANCE.getRelationshipMapping_TargetEntity();
+
+ /**
+ * The meta object literal for the '<em><b>Fetch</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute RELATIONSHIP_MAPPING__FETCH = eINSTANCE.getRelationshipMapping_Fetch();
+
+ /**
+ * The meta object literal for the '<em><b>Cascade</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference RELATIONSHIP_MAPPING__CASCADE = eINSTANCE.getRelationshipMapping_Cascade();
+
+ /**
+ * The meta object literal for the '<em><b>Join Table</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference RELATIONSHIP_MAPPING__JOIN_TABLE = eINSTANCE.getRelationshipMapping_JoinTable();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping <em>Multi Relationship Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMultiRelationshipMapping()
+ * @generated
+ */
+ public static final EClass MULTI_RELATIONSHIP_MAPPING = eINSTANCE.getMultiRelationshipMapping();
+
+ /**
+ * The meta object literal for the '<em><b>Order By</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute MULTI_RELATIONSHIP_MAPPING__ORDER_BY = eINSTANCE.getMultiRelationshipMapping_OrderBy();
+
+ /**
+ * The meta object literal for the '<em><b>Map Key</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference MULTI_RELATIONSHIP_MAPPING__MAP_KEY = eINSTANCE.getMultiRelationshipMapping_MapKey();
+
+ /**
+ * The meta object literal for the '<em><b>Mapped By</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute MULTI_RELATIONSHIP_MAPPING__MAPPED_BY = eINSTANCE.getMultiRelationshipMapping_MappedBy();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping <em>Single Relationship Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSingleRelationshipMapping()
+ * @generated
+ */
+ public static final EClass SINGLE_RELATIONSHIP_MAPPING = eINSTANCE.getSingleRelationshipMapping();
+
+ /**
+ * The meta object literal for the '<em><b>Optional</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute SINGLE_RELATIONSHIP_MAPPING__OPTIONAL = eINSTANCE.getSingleRelationshipMapping_Optional();
+
+ /**
+ * The meta object literal for the '<em><b>Join Columns</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference SINGLE_RELATIONSHIP_MAPPING__JOIN_COLUMNS = eINSTANCE.getSingleRelationshipMapping_JoinColumns();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.Id <em>Id</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Id
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getId()
+ * @generated
+ */
+ public static final EClass ID = eINSTANCE.getId();
+
+ /**
+ * The meta object literal for the '<em><b>Generated Value</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ID__GENERATED_VALUE = eINSTANCE.getId_GeneratedValue();
+
+ /**
+ * The meta object literal for the '<em><b>Temporal</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ID__TEMPORAL = eINSTANCE.getId_Temporal();
+
+ /**
+ * The meta object literal for the '<em><b>Table Generator</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ID__TABLE_GENERATOR = eINSTANCE.getId_TableGenerator();
+
+ /**
+ * The meta object literal for the '<em><b>Sequence Generator</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ID__SEQUENCE_GENERATOR = eINSTANCE.getId_SequenceGenerator();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.IdImpl <em>Id Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.IdImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getIdImpl()
+ * @generated
+ */
+ public static final EClass ID_IMPL = eINSTANCE.getIdImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedId <em>Embedded Id</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EmbeddedId
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbeddedId()
+ * @generated
+ */
+ public static final EClass EMBEDDED_ID = eINSTANCE.getEmbeddedId();
+
+ /**
+ * The meta object literal for the '<em><b>Attribute Overrides</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference EMBEDDED_ID__ATTRIBUTE_OVERRIDES = eINSTANCE.getEmbeddedId_AttributeOverrides();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedIdImpl <em>Embedded Id Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EmbeddedIdImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbeddedIdImpl()
+ * @generated
+ */
+ public static final EClass EMBEDDED_ID_IMPL = eINSTANCE.getEmbeddedIdImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.Basic <em>Basic</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Basic
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getBasic()
+ * @generated
+ */
+ public static final EClass BASIC = eINSTANCE.getBasic();
+
+ /**
+ * The meta object literal for the '<em><b>Fetch</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute BASIC__FETCH = eINSTANCE.getBasic_Fetch();
+
+ /**
+ * The meta object literal for the '<em><b>Optional</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute BASIC__OPTIONAL = eINSTANCE.getBasic_Optional();
+
+ /**
+ * The meta object literal for the '<em><b>Lob</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute BASIC__LOB = eINSTANCE.getBasic_Lob();
+
+ /**
+ * The meta object literal for the '<em><b>Temporal</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute BASIC__TEMPORAL = eINSTANCE.getBasic_Temporal();
+
+ /**
+ * The meta object literal for the '<em><b>Enumerated</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute BASIC__ENUMERATED = eINSTANCE.getBasic_Enumerated();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.BasicImpl <em>Basic Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.BasicImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getBasicImpl()
+ * @generated
+ */
+ public static final EClass BASIC_IMPL = eINSTANCE.getBasicImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.Version <em>Version</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Version
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getVersion()
+ * @generated
+ */
+ public static final EClass VERSION = eINSTANCE.getVersion();
+
+ /**
+ * The meta object literal for the '<em><b>Temporal</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute VERSION__TEMPORAL = eINSTANCE.getVersion_Temporal();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.VersionImpl <em>Version Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.VersionImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getVersionImpl()
+ * @generated
+ */
+ public static final EClass VERSION_IMPL = eINSTANCE.getVersionImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToOne <em>Many To One</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.ManyToOne
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getManyToOne()
+ * @generated
+ */
+ public static final EClass MANY_TO_ONE = eINSTANCE.getManyToOne();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl <em>Many To One Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getManyToOneImpl()
+ * @generated
+ */
+ public static final EClass MANY_TO_ONE_IMPL = eINSTANCE.getManyToOneImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToMany <em>One To Many</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToMany
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToMany()
+ * @generated
+ */
+ public static final EClass ONE_TO_MANY = eINSTANCE.getOneToMany();
+
+ /**
+ * The meta object literal for the '<em><b>Join Columns</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ONE_TO_MANY__JOIN_COLUMNS = eINSTANCE.getOneToMany_JoinColumns();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl <em>One To Many Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToManyImpl()
+ * @generated
+ */
+ public static final EClass ONE_TO_MANY_IMPL = eINSTANCE.getOneToManyImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOne <em>One To One</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToOne
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToOne()
+ * @generated
+ */
+ public static final EClass ONE_TO_ONE = eINSTANCE.getOneToOne();
+
+ /**
+ * The meta object literal for the '<em><b>Primary Key Join Columns</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ONE_TO_ONE__PRIMARY_KEY_JOIN_COLUMNS = eINSTANCE.getOneToOne_PrimaryKeyJoinColumns();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl <em>One To One Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOneToOneImpl()
+ * @generated
+ */
+ public static final EClass ONE_TO_ONE_IMPL = eINSTANCE.getOneToOneImpl();
+
+ /**
+ * The meta object literal for the '<em><b>Mapped By</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ONE_TO_ONE__MAPPED_BY = eINSTANCE.getOneToOne_MappedBy();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToMany <em>Many To Many</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.ManyToMany
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getManyToMany()
+ * @generated
+ */
+ public static final EClass MANY_TO_MANY = eINSTANCE.getManyToMany();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl <em>Many To Many Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getManyToManyImpl()
+ * @generated
+ */
+ public static final EClass MANY_TO_MANY_IMPL = eINSTANCE.getManyToManyImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.Embedded <em>Embedded</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Embedded
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbedded()
+ * @generated
+ */
+ public static final EClass EMBEDDED = eINSTANCE.getEmbedded();
+
+ /**
+ * The meta object literal for the '<em><b>Attribute Overrides</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference EMBEDDED__ATTRIBUTE_OVERRIDES = eINSTANCE.getEmbedded_AttributeOverrides();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedImpl <em>Embedded Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EmbeddedImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEmbeddedImpl()
+ * @generated
+ */
+ public static final EClass EMBEDDED_IMPL = eINSTANCE.getEmbeddedImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.Transient <em>Transient</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Transient
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTransient()
+ * @generated
+ */
+ public static final EClass TRANSIENT = eINSTANCE.getTransient();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.TransientImpl <em>Transient Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.TransientImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTransientImpl()
+ * @generated
+ */
+ public static final EClass TRANSIENT_IMPL = eINSTANCE.getTransientImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.AssociationOverride <em>Association Override</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.AssociationOverride
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAssociationOverride()
+ * @generated
+ */
+ public static final EClass ASSOCIATION_OVERRIDE = eINSTANCE.getAssociationOverride();
+
+ /**
+ * The meta object literal for the '<em><b>Join Columns</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ASSOCIATION_OVERRIDE__JOIN_COLUMNS = eINSTANCE.getAssociationOverride_JoinColumns();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ASSOCIATION_OVERRIDE__NAME = eINSTANCE.getAssociationOverride_Name();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverride <em>Attribute Override</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.AttributeOverride
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeOverride()
+ * @generated
+ */
+ public static final EClass ATTRIBUTE_OVERRIDE = eINSTANCE.getAttributeOverride();
+
+ /**
+ * The meta object literal for the '<em><b>Column</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ATTRIBUTE_OVERRIDE__COLUMN = eINSTANCE.getAttributeOverride_Column();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ATTRIBUTE_OVERRIDE__NAME = eINSTANCE.getAttributeOverride_Name();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverrideImpl <em>Attribute Override Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.AttributeOverrideImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeOverrideImpl()
+ * @generated
+ */
+ public static final EClass ATTRIBUTE_OVERRIDE_IMPL = eINSTANCE.getAttributeOverrideImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType <em>Cascade Type</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.CascadeType
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getCascadeType()
+ * @generated
+ */
+ public static final EClass CASCADE_TYPE = eINSTANCE.getCascadeType();
+
+ /**
+ * The meta object literal for the '<em><b>Cascade All</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute CASCADE_TYPE__CASCADE_ALL = eINSTANCE.getCascadeType_CascadeAll();
+
+ /**
+ * The meta object literal for the '<em><b>Cascade Persist</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute CASCADE_TYPE__CASCADE_PERSIST = eINSTANCE.getCascadeType_CascadePersist();
+
+ /**
+ * The meta object literal for the '<em><b>Cascade Merge</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute CASCADE_TYPE__CASCADE_MERGE = eINSTANCE.getCascadeType_CascadeMerge();
+
+ /**
+ * The meta object literal for the '<em><b>Cascade Remove</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute CASCADE_TYPE__CASCADE_REMOVE = eINSTANCE.getCascadeType_CascadeRemove();
+
+ /**
+ * The meta object literal for the '<em><b>Cascade Refresh</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute CASCADE_TYPE__CASCADE_REFRESH = eINSTANCE.getCascadeType_CascadeRefresh();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeTypeImpl <em>Cascade Type Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.CascadeTypeImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getCascadeTypeImpl()
+ * @generated
+ */
+ public static final EClass CASCADE_TYPE_IMPL = eINSTANCE.getCascadeTypeImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.NamedColumn <em>Named Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.NamedColumn
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedColumn()
+ * @generated
+ */
+ public static final EClass NAMED_COLUMN = eINSTANCE.getNamedColumn();
+
+ /**
+ * The meta object literal for the '<em><b>Column Definition</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute NAMED_COLUMN__COLUMN_DEFINITION = eINSTANCE.getNamedColumn_ColumnDefinition();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute NAMED_COLUMN__NAME = eINSTANCE.getNamedColumn_Name();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn <em>Abstract Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractColumn
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractColumn()
+ * @generated
+ */
+ public static final EClass ABSTRACT_COLUMN = eINSTANCE.getAbstractColumn();
+
+ /**
+ * The meta object literal for the '<em><b>Insertable</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ABSTRACT_COLUMN__INSERTABLE = eINSTANCE.getAbstractColumn_Insertable();
+
+ /**
+ * The meta object literal for the '<em><b>Nullable</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ABSTRACT_COLUMN__NULLABLE = eINSTANCE.getAbstractColumn_Nullable();
+
+ /**
+ * The meta object literal for the '<em><b>Table</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ABSTRACT_COLUMN__TABLE = eINSTANCE.getAbstractColumn_Table();
+
+ /**
+ * The meta object literal for the '<em><b>Unique</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ABSTRACT_COLUMN__UNIQUE = eINSTANCE.getAbstractColumn_Unique();
+
+ /**
+ * The meta object literal for the '<em><b>Updatable</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ABSTRACT_COLUMN__UPDATABLE = eINSTANCE.getAbstractColumn_Updatable();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.Column <em>Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Column
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumn()
+ * @generated
+ */
+ public static final EClass COLUMN = eINSTANCE.getColumn();
+
+ /**
+ * The meta object literal for the '<em><b>Length</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute COLUMN__LENGTH = eINSTANCE.getColumn_Length();
+
+ /**
+ * The meta object literal for the '<em><b>Precision</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute COLUMN__PRECISION = eINSTANCE.getColumn_Precision();
+
+ /**
+ * The meta object literal for the '<em><b>Scale</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute COLUMN__SCALE = eINSTANCE.getColumn_Scale();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnImpl <em>Column Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.ColumnImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumnImpl()
+ * @generated
+ */
+ public static final EClass COLUMN_IMPL = eINSTANCE.getColumnImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnResult <em>Column Result</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.ColumnResult
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumnResult()
+ * @generated
+ */
+ public static final EClass COLUMN_RESULT = eINSTANCE.getColumnResult();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute COLUMN_RESULT__NAME = eINSTANCE.getColumnResult_Name();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn <em>Discriminator Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getDiscriminatorColumn()
+ * @generated
+ */
+ public static final EClass DISCRIMINATOR_COLUMN = eINSTANCE.getDiscriminatorColumn();
+
+ /**
+ * The meta object literal for the '<em><b>Discriminator Type</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE = eINSTANCE.getDiscriminatorColumn_DiscriminatorType();
+
+ /**
+ * The meta object literal for the '<em><b>Length</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute DISCRIMINATOR_COLUMN__LENGTH = eINSTANCE.getDiscriminatorColumn_Length();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListeners <em>Entity Listeners</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListeners
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityListeners()
+ * @generated
+ */
+ public static final EClass ENTITY_LISTENERS = eINSTANCE.getEntityListeners();
+
+ /**
+ * The meta object literal for the '<em><b>Entity Listeners</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_LISTENERS__ENTITY_LISTENERS = eINSTANCE.getEntityListeners_EntityListeners();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener <em>Entity Listener</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListener
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityListener()
+ * @generated
+ */
+ public static final EClass ENTITY_LISTENER = eINSTANCE.getEntityListener();
+
+ /**
+ * The meta object literal for the '<em><b>Class Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ENTITY_LISTENER__CLASS_NAME = eINSTANCE.getEntityListener_ClassName();
+
+ /**
+ * The meta object literal for the '<em><b>Pre Persist</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_LISTENER__PRE_PERSIST = eINSTANCE.getEntityListener_PrePersist();
+
+ /**
+ * The meta object literal for the '<em><b>Post Persist</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_LISTENER__POST_PERSIST = eINSTANCE.getEntityListener_PostPersist();
+
+ /**
+ * The meta object literal for the '<em><b>Pre Remove</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_LISTENER__PRE_REMOVE = eINSTANCE.getEntityListener_PreRemove();
+
+ /**
+ * The meta object literal for the '<em><b>Post Remove</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_LISTENER__POST_REMOVE = eINSTANCE.getEntityListener_PostRemove();
+
+ /**
+ * The meta object literal for the '<em><b>Pre Update</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_LISTENER__PRE_UPDATE = eINSTANCE.getEntityListener_PreUpdate();
+
+ /**
+ * The meta object literal for the '<em><b>Post Update</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_LISTENER__POST_UPDATE = eINSTANCE.getEntityListener_PostUpdate();
+
+ /**
+ * The meta object literal for the '<em><b>Post Load</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_LISTENER__POST_LOAD = eINSTANCE.getEntityListener_PostLoad();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.EntityResult <em>Entity Result</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityResult
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEntityResult()
+ * @generated
+ */
+ public static final EClass ENTITY_RESULT = eINSTANCE.getEntityResult();
+
+ /**
+ * The meta object literal for the '<em><b>Discriminator Column</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ENTITY_RESULT__DISCRIMINATOR_COLUMN = eINSTANCE.getEntityResult_DiscriminatorColumn();
+
+ /**
+ * The meta object literal for the '<em><b>Entity Class</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ENTITY_RESULT__ENTITY_CLASS = eINSTANCE.getEntityResult_EntityClass();
+
+ /**
+ * The meta object literal for the '<em><b>Field Results</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ENTITY_RESULT__FIELD_RESULTS = eINSTANCE.getEntityResult_FieldResults();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.FieldResult <em>Field Result</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.FieldResult
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getFieldResult()
+ * @generated
+ */
+ public static final EClass FIELD_RESULT = eINSTANCE.getFieldResult();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute FIELD_RESULT__NAME = eINSTANCE.getFieldResult_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Column</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute FIELD_RESULT__COLUMN = eINSTANCE.getFieldResult_Column();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.GeneratedValue <em>Generated Value</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.GeneratedValue
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGeneratedValue()
+ * @generated
+ */
+ public static final EClass GENERATED_VALUE = eINSTANCE.getGeneratedValue();
+
+ /**
+ * The meta object literal for the '<em><b>Generator</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute GENERATED_VALUE__GENERATOR = eINSTANCE.getGeneratedValue_Generator();
+
+ /**
+ * The meta object literal for the '<em><b>Strategy</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute GENERATED_VALUE__STRATEGY = eINSTANCE.getGeneratedValue_Strategy();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.GeneratedValueImpl <em>Generated Value Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.GeneratedValueImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGeneratedValueImpl()
+ * @generated
+ */
+ public static final EClass GENERATED_VALUE_IMPL = eINSTANCE.getGeneratedValueImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.IdClass <em>Id Class</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.IdClass
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getIdClass()
+ * @generated
+ */
+ public static final EClass ID_CLASS = eINSTANCE.getIdClass();
+
+ /**
+ * The meta object literal for the '<em><b>Class Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ID_CLASS__CLASS_NAME = eINSTANCE.getIdClass_ClassName();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.Inheritance <em>Inheritance</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Inheritance
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getInheritance()
+ * @generated
+ */
+ public static final EClass INHERITANCE = eINSTANCE.getInheritance();
+
+ /**
+ * The meta object literal for the '<em><b>Strategy</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute INHERITANCE__STRATEGY = eINSTANCE.getInheritance_Strategy();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn <em>Join Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinColumn
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinColumn()
+ * @generated
+ */
+ public static final EClass JOIN_COLUMN = eINSTANCE.getJoinColumn();
+
+ /**
+ * The meta object literal for the '<em><b>Referenced Column Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute JOIN_COLUMN__REFERENCED_COLUMN_NAME = eINSTANCE.getJoinColumn_ReferencedColumnName();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumnImpl <em>Join Column Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinColumnImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinColumnImpl()
+ * @generated
+ */
+ public static final EClass JOIN_COLUMN_IMPL = eINSTANCE.getJoinColumnImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinTable <em>Join Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinTable
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinTable()
+ * @generated
+ */
+ public static final EClass JOIN_TABLE = eINSTANCE.getJoinTable();
+
+ /**
+ * The meta object literal for the '<em><b>Join Columns</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference JOIN_TABLE__JOIN_COLUMNS = eINSTANCE.getJoinTable_JoinColumns();
+
+ /**
+ * The meta object literal for the '<em><b>Inverse Join Columns</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference JOIN_TABLE__INVERSE_JOIN_COLUMNS = eINSTANCE.getJoinTable_InverseJoinColumns();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.JoinTableImpl <em>Join Table Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinTableImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getJoinTableImpl()
+ * @generated
+ */
+ public static final EClass JOIN_TABLE_IMPL = eINSTANCE.getJoinTableImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.Lob <em>Lob</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Lob
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getLob()
+ * @generated
+ */
+ public static final EClass LOB = eINSTANCE.getLob();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.MapKey <em>Map Key</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.MapKey
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMapKey()
+ * @generated
+ */
+ public static final EClass MAP_KEY = eINSTANCE.getMapKey();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute MAP_KEY__NAME = eINSTANCE.getMapKey_Name();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.MapKeyImpl <em>Map Key Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.MapKeyImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getMapKeyImpl()
+ * @generated
+ */
+ public static final EClass MAP_KEY_IMPL = eINSTANCE.getMapKeyImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.Query <em>Query</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Query
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQuery()
+ * @generated
+ */
+ public static final EClass QUERY = eINSTANCE.getQuery();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute QUERY__NAME = eINSTANCE.getQuery_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Query</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute QUERY__QUERY = eINSTANCE.getQuery_Query();
+
+ /**
+ * The meta object literal for the '<em><b>Hints</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference QUERY__HINTS = eINSTANCE.getQuery_Hints();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.EventMethod <em>Event Method</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EventMethod
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEventMethod()
+ * @generated
+ */
+ public static final EClass EVENT_METHOD = eINSTANCE.getEventMethod();
+
+ /**
+ * The meta object literal for the '<em><b>Method Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute EVENT_METHOD__METHOD_NAME = eINSTANCE.getEventMethod_MethodName();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery <em>Named Native Query</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedNativeQuery()
+ * @generated
+ */
+ public static final EClass NAMED_NATIVE_QUERY = eINSTANCE.getNamedNativeQuery();
+
+ /**
+ * The meta object literal for the '<em><b>Result Class</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute NAMED_NATIVE_QUERY__RESULT_CLASS = eINSTANCE.getNamedNativeQuery_ResultClass();
+
+ /**
+ * The meta object literal for the '<em><b>Result Set Mapping</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute NAMED_NATIVE_QUERY__RESULT_SET_MAPPING = eINSTANCE.getNamedNativeQuery_ResultSetMapping();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.NamedQuery <em>Named Query</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.NamedQuery
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedQuery()
+ * @generated
+ */
+ public static final EClass NAMED_QUERY = eINSTANCE.getNamedQuery();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.PostLoad <em>Post Load</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PostLoad
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPostLoad()
+ * @generated
+ */
+ public static final EClass POST_LOAD = eINSTANCE.getPostLoad();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.PostPersist <em>Post Persist</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PostPersist
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPostPersist()
+ * @generated
+ */
+ public static final EClass POST_PERSIST = eINSTANCE.getPostPersist();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.PostRemove <em>Post Remove</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PostRemove
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPostRemove()
+ * @generated
+ */
+ public static final EClass POST_REMOVE = eINSTANCE.getPostRemove();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.PostUpdate <em>Post Update</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PostUpdate
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPostUpdate()
+ * @generated
+ */
+ public static final EClass POST_UPDATE = eINSTANCE.getPostUpdate();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.PrePersist <em>Pre Persist</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PrePersist
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPrePersist()
+ * @generated
+ */
+ public static final EClass PRE_PERSIST = eINSTANCE.getPrePersist();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.PreRemove <em>Pre Remove</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PreRemove
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPreRemove()
+ * @generated
+ */
+ public static final EClass PRE_REMOVE = eINSTANCE.getPreRemove();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.PreUpdate <em>Pre Update</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PreUpdate
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPreUpdate()
+ * @generated
+ */
+ public static final EClass PRE_UPDATE = eINSTANCE.getPreUpdate();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.QueryHint <em>Query Hint</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.QueryHint
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQueryHint()
+ * @generated
+ */
+ public static final EClass QUERY_HINT = eINSTANCE.getQueryHint();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute QUERY_HINT__NAME = eINSTANCE.getQueryHint_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Value</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute QUERY_HINT__VALUE = eINSTANCE.getQueryHint_Value();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractTable <em>Abstract Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractTable
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable()
+ * @generated
+ */
+ public static final EClass ABSTRACT_TABLE = eINSTANCE.getAbstractTable();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ABSTRACT_TABLE__NAME = eINSTANCE.getAbstractTable_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Catalog</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ABSTRACT_TABLE__CATALOG = eINSTANCE.getAbstractTable_Catalog();
+
+ /**
+ * The meta object literal for the '<em><b>Schema</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute ABSTRACT_TABLE__SCHEMA = eINSTANCE.getAbstractTable_Schema();
+
+ /**
+ * The meta object literal for the '<em><b>Unique Constraints</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference ABSTRACT_TABLE__UNIQUE_CONSTRAINTS = eINSTANCE.getAbstractTable_UniqueConstraints();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping <em>Sql Result Set Mapping</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSqlResultSetMapping()
+ * @generated
+ */
+ public static final EClass SQL_RESULT_SET_MAPPING = eINSTANCE.getSqlResultSetMapping();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute SQL_RESULT_SET_MAPPING__NAME = eINSTANCE.getSqlResultSetMapping_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Entity Results</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference SQL_RESULT_SET_MAPPING__ENTITY_RESULTS = eINSTANCE.getSqlResultSetMapping_EntityResults();
+
+ /**
+ * The meta object literal for the '<em><b>Column Results</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference SQL_RESULT_SET_MAPPING__COLUMN_RESULTS = eINSTANCE.getSqlResultSetMapping_ColumnResults();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn <em>Primary Key Join Column</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPrimaryKeyJoinColumn()
+ * @generated
+ */
+ public static final EClass PRIMARY_KEY_JOIN_COLUMN = eINSTANCE.getPrimaryKeyJoinColumn();
+
+ /**
+ * The meta object literal for the '<em><b>Referenced Column Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME = eINSTANCE.getPrimaryKeyJoinColumn_ReferencedColumnName();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.SecondaryTable <em>Secondary Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.SecondaryTable
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSecondaryTable()
+ * @generated
+ */
+ public static final EClass SECONDARY_TABLE = eINSTANCE.getSecondaryTable();
+
+ /**
+ * The meta object literal for the '<em><b>Primary Key Join Columns</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS = eINSTANCE.getSecondaryTable_PrimaryKeyJoinColumns();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.Generator <em>Generator</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Generator
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGenerator()
+ * @generated
+ */
+ public static final EClass GENERATOR = eINSTANCE.getGenerator();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute GENERATOR__NAME = eINSTANCE.getGenerator_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Initial Value</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute GENERATOR__INITIAL_VALUE = eINSTANCE.getGenerator_InitialValue();
+
+ /**
+ * The meta object literal for the '<em><b>Allocation Size</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute GENERATOR__ALLOCATION_SIZE = eINSTANCE.getGenerator_AllocationSize();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator <em>Sequence Generator</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSequenceGenerator()
+ * @generated
+ */
+ public static final EClass SEQUENCE_GENERATOR = eINSTANCE.getSequenceGenerator();
+
+ /**
+ * The meta object literal for the '<em><b>Sequence Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute SEQUENCE_GENERATOR__SEQUENCE_NAME = eINSTANCE.getSequenceGenerator_SequenceName();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.SequenceGeneratorImpl <em>Sequence Generator Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.SequenceGeneratorImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSequenceGeneratorImpl()
+ * @generated
+ */
+ public static final EClass SEQUENCE_GENERATOR_IMPL = eINSTANCE.getSequenceGeneratorImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.Table <em>Table</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.Table
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTable()
+ * @generated
+ */
+ public static final EClass TABLE = eINSTANCE.getTable();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator <em>Table Generator</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.TableGenerator
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator()
+ * @generated
+ */
+ public static final EClass TABLE_GENERATOR = eINSTANCE.getTableGenerator();
+
+ /**
+ * The meta object literal for the '<em><b>Table</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute TABLE_GENERATOR__TABLE = eINSTANCE.getTableGenerator_Table();
+
+ /**
+ * The meta object literal for the '<em><b>Catalog</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute TABLE_GENERATOR__CATALOG = eINSTANCE.getTableGenerator_Catalog();
+
+ /**
+ * The meta object literal for the '<em><b>Schema</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute TABLE_GENERATOR__SCHEMA = eINSTANCE.getTableGenerator_Schema();
+
+ /**
+ * The meta object literal for the '<em><b>Pk Column Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute TABLE_GENERATOR__PK_COLUMN_NAME = eINSTANCE.getTableGenerator_PkColumnName();
+
+ /**
+ * The meta object literal for the '<em><b>Value Column Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute TABLE_GENERATOR__VALUE_COLUMN_NAME = eINSTANCE.getTableGenerator_ValueColumnName();
+
+ /**
+ * The meta object literal for the '<em><b>Pk Column Value</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute TABLE_GENERATOR__PK_COLUMN_VALUE = eINSTANCE.getTableGenerator_PkColumnValue();
+
+ /**
+ * The meta object literal for the '<em><b>Unique Constraints</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference TABLE_GENERATOR__UNIQUE_CONSTRAINTS = eINSTANCE.getTableGenerator_UniqueConstraints();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl <em>Table Generator Impl</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGeneratorImpl()
+ * @generated
+ */
+ public static final EClass TABLE_GENERATOR_IMPL = eINSTANCE.getTableGeneratorImpl();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint <em>Unique Constraint</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getUniqueConstraint()
+ * @generated
+ */
+ public static final EClass UNIQUE_CONSTRAINT = eINSTANCE.getUniqueConstraint();
+
+ /**
+ * The meta object literal for the '<em><b>Column Names</b></em>' attribute list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute UNIQUE_CONSTRAINT__COLUMN_NAMES = eINSTANCE.getUniqueConstraint_ColumnNames();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.AccessType <em>Access Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.AccessType
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAccessType()
+ * @generated
+ */
+ public static final EEnum ACCESS_TYPE = eINSTANCE.getAccessType();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType <em>Discriminator Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getDiscriminatorType()
+ * @generated
+ */
+ public static final EEnum DISCRIMINATOR_TYPE = eINSTANCE.getDiscriminatorType();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.EnumType <em>Enum Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.EnumType
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEnumType()
+ * @generated
+ */
+ public static final EEnum ENUM_TYPE = eINSTANCE.getEnumType();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.FetchType <em>Fetch Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getFetchType()
+ * @generated
+ */
+ public static final EEnum FETCH_TYPE = eINSTANCE.getFetchType();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.GenerationType <em>Generation Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.GenerationType
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGenerationType()
+ * @generated
+ */
+ public static final EEnum GENERATION_TYPE = eINSTANCE.getGenerationType();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.InheritanceType <em>Inheritance Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.InheritanceType
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getInheritanceType()
+ * @generated
+ */
+ public static final EEnum INHERITANCE_TYPE = eINSTANCE.getInheritanceType();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.orm.TemporalType <em>Temporal Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.TemporalType
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTemporalType()
+ * @generated
+ */
+ public static final EEnum TEMPORAL_TYPE = eINSTANCE.getTemporalType();
+
+ /**
+ * The meta object literal for the '<em>Discriminator Value</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see java.lang.String
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getDiscriminatorValue()
+ * @generated
+ */
+ public static final EDataType DISCRIMINATOR_VALUE = eINSTANCE.getDiscriminatorValue();
+
+ /**
+ * The meta object literal for the '<em>Enumerated</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.common.util.Enumerator
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getEnumerated()
+ * @generated
+ */
+ public static final EDataType ENUMERATED = eINSTANCE.getEnumerated();
+
+ /**
+ * The meta object literal for the '<em>Order By</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see java.lang.String
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getOrderBy()
+ * @generated
+ */
+ public static final EDataType ORDER_BY = eINSTANCE.getOrderBy();
+
+ /**
+ * The meta object literal for the '<em>Version Type</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see java.lang.String
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getVersionType()
+ * @generated
+ */
+ public static final EDataType VERSION_TYPE = eINSTANCE.getVersionType();
+
+ }
+
+} //OrmPackage
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmResource.java
new file mode 100644
index 0000000000..86649bfce7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmResource.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jdt.core.ElementChangedEvent;
+import org.eclipse.jpt.core.internal.IJpaContentNode;
+import org.eclipse.jpt.core.internal.resource.common.JpaXmlResource;
+import org.eclipse.jpt.core.internal.resource.orm.translators.EntityMappingsTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Renderer;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+import org.eclipse.wst.common.internal.emf.resource.TranslatorResource;
+
+public class OrmResource extends JpaXmlResource
+{
+ public OrmResource(Renderer aRenderer) {
+ super(aRenderer);
+ }
+
+ public OrmResource(URI uri, Renderer aRenderer) {
+ super(uri, aRenderer);
+ }
+
+ /**
+ * @see TranslatorResource#getRootTranslator()
+ */
+ public Translator getRootTranslator() {
+ return EntityMappingsTranslator.INSTANCE;
+ }
+
+ /**
+ * @see JpaXmlResource#getContentNode(int)
+ */
+ @Override
+ public IJpaContentNode getContentNode(int offset) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * @see JpaXmlResource#handleJavaElementChangedEvent(ElementChangedEvent)
+ */
+ @Override
+ public void handleJavaElementChangedEvent(ElementChangedEvent event) {
+ // TODO Auto-generated method stub
+ }
+
+ public EntityMappings getEntityMappings() {
+ return (EntityMappings) getRootObject();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmResourceFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmResourceFactory.java
new file mode 100644
index 0000000000..5a0aeca135
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmResourceFactory.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.wst.common.internal.emf.resource.Renderer;
+import org.eclipse.wst.common.internal.emf.resource.RendererFactory;
+import org.eclipse.wst.common.internal.emf.resource.TranslatorResource;
+import org.eclipse.wst.common.internal.emf.resource.TranslatorResourceFactory;
+
+public class OrmResourceFactory extends TranslatorResourceFactory
+{
+ public OrmResourceFactory() {
+ this(RendererFactory.getDefaultRendererFactory());
+ }
+
+ public OrmResourceFactory(RendererFactory aRendererFactory) {
+ super(aRendererFactory);
+ }
+
+ public OrmResourceFactory(RendererFactory aRendererFactory, boolean listeningForUpdates) {
+ super(aRendererFactory, listeningForUpdates);
+ }
+
+
+ /**
+ * @see TranslatorResourceFactory#createResource(URI, Renderer)
+ */
+ protected TranslatorResource createResource(URI uri, Renderer renderer) {
+ return new OrmResource(uri, renderer);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmResourceModel.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmResourceModel.java
new file mode 100644
index 0000000000..64d2445907
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmResourceModel.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jpt.core.internal.IResourceModel;
+import org.eclipse.jpt.core.internal.resource.common.JpaXmlResourceModel;
+
+public class OrmResourceModel extends JpaXmlResourceModel
+{
+ public OrmResourceModel(IFile file) {
+ super(file);
+ }
+
+
+ /**
+ * @see IResourceModel#getResourceType()
+ */
+ public String getResourceType() {
+ return IResourceModel.ORM_RESOURCE_TYPE;
+ }
+
+ @Override
+ protected OrmArtifactEdit buildArtifactEdit(IProject project) {
+ return OrmArtifactEdit.getArtifactEditForRead(project);
+ }
+
+ @Override
+ public OrmResource resource() {
+ return (OrmResource) super.resource();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PersistenceUnitDefaults.java
new file mode 100644
index 0000000000..3bb964f965
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PersistenceUnitDefaults.java
@@ -0,0 +1,499 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>XmlPersistence Unit Defaults</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#getSchema <em>Schema</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#getCatalog <em>Catalog</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#getAccess <em>Access</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#isCascadePersist <em>Cascade Persist</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#getEntityListeners <em>Entity Listeners</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPersistenceUnitDefaults()
+ * @model kind="class"
+ * @extends IJpaEObject
+ * @generated
+ */
+public class PersistenceUnitDefaults extends JpaEObject implements IJpaEObject
+{
+ /**
+ * The default value of the '{@link #getSchema() <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSchema()
+ * @generated
+ * @ordered
+ */
+ protected static final String SCHEMA_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getSchema() <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSchema()
+ * @generated
+ * @ordered
+ */
+ protected String schema = SCHEMA_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCatalog()
+ * @generated
+ * @ordered
+ */
+ protected static final String CATALOG_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCatalog()
+ * @generated
+ * @ordered
+ */
+ protected String catalog = CATALOG_EDEFAULT;
+
+ /**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final AccessType ACCESS_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getAccess() <em>Access</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAccess()
+ * @generated
+ * @ordered
+ */
+ protected AccessType access = ACCESS_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #isCascadePersist() <em>Cascade Persist</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isCascadePersist()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean CASCADE_PERSIST_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isCascadePersist() <em>Cascade Persist</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isCascadePersist()
+ * @generated
+ * @ordered
+ */
+ protected boolean cascadePersist = CASCADE_PERSIST_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getEntityListeners() <em>Entity Listeners</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEntityListeners()
+ * @generated
+ * @ordered
+ */
+ protected EntityListeners entityListeners;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PersistenceUnitDefaults()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.PERSISTENCE_UNIT_DEFAULTS;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Schema</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Schema</em>' attribute.
+ * @see #setSchema(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPersistenceUnitDefaults_Schema()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getSchema()
+ {
+ return schema;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#getSchema <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Schema</em>' attribute.
+ * @see #getSchema()
+ * @generated
+ */
+ public void setSchema(String newSchema)
+ {
+ String oldSchema = schema;
+ schema = newSchema;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS__SCHEMA, oldSchema, schema));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Catalog</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Catalog</em>' attribute.
+ * @see #setCatalog(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPersistenceUnitDefaults_Catalog()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getCatalog()
+ {
+ return catalog;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#getCatalog <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Catalog</em>' attribute.
+ * @see #getCatalog()
+ * @generated
+ */
+ public void setCatalog(String newCatalog)
+ {
+ String oldCatalog = catalog;
+ catalog = newCatalog;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CATALOG, oldCatalog, catalog));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Access</b></em>' attribute.
+ * The default value is <code>"PROPERTY"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.AccessType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Access</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Access</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AccessType
+ * @see #setAccess(AccessType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPersistenceUnitDefaults_Access()
+ * @model default="PROPERTY"
+ * @generated
+ */
+ public AccessType getAccess()
+ {
+ return access;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#getAccess <em>Access</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Access</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AccessType
+ * @see #getAccess()
+ * @generated
+ */
+ public void setAccess(AccessType newAccess)
+ {
+ AccessType oldAccess = access;
+ access = newAccess == null ? ACCESS_EDEFAULT : newAccess;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ACCESS, oldAccess, access));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Cascade Persist</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade Persist</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cascade Persist</em>' attribute.
+ * @see #setCascadePersist(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPersistenceUnitDefaults_CascadePersist()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ public boolean isCascadePersist()
+ {
+ return cascadePersist;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#isCascadePersist <em>Cascade Persist</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade Persist</em>' attribute.
+ * @see #isCascadePersist()
+ * @generated
+ */
+ public void setCascadePersist(boolean newCascadePersist)
+ {
+ boolean oldCascadePersist = cascadePersist;
+ cascadePersist = newCascadePersist;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST, oldCascadePersist, cascadePersist));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Entity Listeners</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Entity Listeners</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Entity Listeners</em>' containment reference.
+ * @see #setEntityListeners(EntityListeners)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPersistenceUnitDefaults_EntityListeners()
+ * @model containment="true"
+ * @generated
+ */
+ public EntityListeners getEntityListeners()
+ {
+ return entityListeners;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetEntityListeners(EntityListeners newEntityListeners, NotificationChain msgs)
+ {
+ EntityListeners oldEntityListeners = entityListeners;
+ entityListeners = newEntityListeners;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS, oldEntityListeners, newEntityListeners);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults#getEntityListeners <em>Entity Listeners</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Entity Listeners</em>' containment reference.
+ * @see #getEntityListeners()
+ * @generated
+ */
+ public void setEntityListeners(EntityListeners newEntityListeners)
+ {
+ if (newEntityListeners != entityListeners)
+ {
+ NotificationChain msgs = null;
+ if (entityListeners != null)
+ msgs = ((InternalEObject)entityListeners).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS, null, msgs);
+ if (newEntityListeners != null)
+ msgs = ((InternalEObject)newEntityListeners).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS, null, msgs);
+ msgs = basicSetEntityListeners(newEntityListeners, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS, newEntityListeners, newEntityListeners));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS:
+ return basicSetEntityListeners(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__SCHEMA:
+ return getSchema();
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CATALOG:
+ return getCatalog();
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ACCESS:
+ return getAccess();
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST:
+ return isCascadePersist() ? Boolean.TRUE : Boolean.FALSE;
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS:
+ return getEntityListeners();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__SCHEMA:
+ setSchema((String)newValue);
+ return;
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CATALOG:
+ setCatalog((String)newValue);
+ return;
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ACCESS:
+ setAccess((AccessType)newValue);
+ return;
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST:
+ setCascadePersist(((Boolean)newValue).booleanValue());
+ return;
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS:
+ setEntityListeners((EntityListeners)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__SCHEMA:
+ setSchema(SCHEMA_EDEFAULT);
+ return;
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CATALOG:
+ setCatalog(CATALOG_EDEFAULT);
+ return;
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ACCESS:
+ setAccess(ACCESS_EDEFAULT);
+ return;
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST:
+ setCascadePersist(CASCADE_PERSIST_EDEFAULT);
+ return;
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS:
+ setEntityListeners((EntityListeners)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__SCHEMA:
+ return SCHEMA_EDEFAULT == null ? schema != null : !SCHEMA_EDEFAULT.equals(schema);
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CATALOG:
+ return CATALOG_EDEFAULT == null ? catalog != null : !CATALOG_EDEFAULT.equals(catalog);
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ACCESS:
+ return access != ACCESS_EDEFAULT;
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST:
+ return cascadePersist != CASCADE_PERSIST_EDEFAULT;
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ENTITY_LISTENERS:
+ return entityListeners != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (schema: ");
+ result.append(schema);
+ result.append(", catalog: ");
+ result.append(catalog);
+ result.append(", access: ");
+ result.append(access);
+ result.append(", cascadePersist: ");
+ result.append(cascadePersist);
+ result.append(')');
+ return result.toString();
+ }
+
+} // PersistenceUnitDefaults
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PersistenceUnitMetadata.java
new file mode 100644
index 0000000000..18a57e5ce9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PersistenceUnitMetadata.java
@@ -0,0 +1,295 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>XmlPersistence Unit Metadata</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata#isXmlMappingMetadataComplete <em>Xml Mapping Metadata Complete</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata#getPersistenceUnitDefaults <em>Persistence Unit Defaults</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPersistenceUnitMetadata()
+ * @model kind="class"
+ * @extends IJpaEObject
+ * @generated
+ */
+public class PersistenceUnitMetadata extends JpaEObject implements IJpaEObject
+{
+ /**
+ * The default value of the '{@link #isXmlMappingMetadataComplete() <em>Xml Mapping Metadata Complete</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isXmlMappingMetadataComplete()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean XML_MAPPING_METADATA_COMPLETE_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isXmlMappingMetadataComplete() <em>Xml Mapping Metadata Complete</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isXmlMappingMetadataComplete()
+ * @generated
+ * @ordered
+ */
+ protected boolean xmlMappingMetadataComplete = XML_MAPPING_METADATA_COMPLETE_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getPersistenceUnitDefaults() <em>Persistence Unit Defaults</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPersistenceUnitDefaults()
+ * @generated
+ * @ordered
+ */
+ protected PersistenceUnitDefaults persistenceUnitDefaults;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PersistenceUnitMetadata()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.PERSISTENCE_UNIT_METADATA;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Xml Mapping Metadata Complete</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Xml Mapping Metadata Complete</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Xml Mapping Metadata Complete</em>' attribute.
+ * @see #setXmlMappingMetadataComplete(boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPersistenceUnitMetadata_XmlMappingMetadataComplete()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.Boolean"
+ * @generated
+ */
+ public boolean isXmlMappingMetadataComplete()
+ {
+ return xmlMappingMetadataComplete;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata#isXmlMappingMetadataComplete <em>Xml Mapping Metadata Complete</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Xml Mapping Metadata Complete</em>' attribute.
+ * @see #isXmlMappingMetadataComplete()
+ * @generated
+ */
+ public void setXmlMappingMetadataComplete(boolean newXmlMappingMetadataComplete)
+ {
+ boolean oldXmlMappingMetadataComplete = xmlMappingMetadataComplete;
+ xmlMappingMetadataComplete = newXmlMappingMetadataComplete;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE, oldXmlMappingMetadataComplete, xmlMappingMetadataComplete));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Persistence Unit Defaults</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>XmlPersistence Unit Defaults</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Persistence Unit Defaults</em>' containment reference.
+ * @see #setPersistenceUnitDefaults(PersistenceUnitDefaults)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPersistenceUnitMetadata_PersistenceUnitDefaults()
+ * @model containment="true"
+ * @generated
+ */
+ public PersistenceUnitDefaults getPersistenceUnitDefaults()
+ {
+ return persistenceUnitDefaults;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetPersistenceUnitDefaults(PersistenceUnitDefaults newPersistenceUnitDefaults, NotificationChain msgs)
+ {
+ PersistenceUnitDefaults oldPersistenceUnitDefaults = persistenceUnitDefaults;
+ persistenceUnitDefaults = newPersistenceUnitDefaults;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS, oldPersistenceUnitDefaults, newPersistenceUnitDefaults);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata#getPersistenceUnitDefaults <em>Persistence Unit Defaults</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Persistence Unit Defaults</em>' containment reference.
+ * @see #getPersistenceUnitDefaults()
+ * @generated
+ */
+ public void setPersistenceUnitDefaults(PersistenceUnitDefaults newPersistenceUnitDefaults)
+ {
+ if (newPersistenceUnitDefaults != persistenceUnitDefaults)
+ {
+ NotificationChain msgs = null;
+ if (persistenceUnitDefaults != null)
+ msgs = ((InternalEObject)persistenceUnitDefaults).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS, null, msgs);
+ if (newPersistenceUnitDefaults != null)
+ msgs = ((InternalEObject)newPersistenceUnitDefaults).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS, null, msgs);
+ msgs = basicSetPersistenceUnitDefaults(newPersistenceUnitDefaults, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS, newPersistenceUnitDefaults, newPersistenceUnitDefaults));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS:
+ return basicSetPersistenceUnitDefaults(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE:
+ return isXmlMappingMetadataComplete() ? Boolean.TRUE : Boolean.FALSE;
+ case OrmPackage.PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS:
+ return getPersistenceUnitDefaults();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE:
+ setXmlMappingMetadataComplete(((Boolean)newValue).booleanValue());
+ return;
+ case OrmPackage.PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS:
+ setPersistenceUnitDefaults((PersistenceUnitDefaults)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE:
+ setXmlMappingMetadataComplete(XML_MAPPING_METADATA_COMPLETE_EDEFAULT);
+ return;
+ case OrmPackage.PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS:
+ setPersistenceUnitDefaults((PersistenceUnitDefaults)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE:
+ return xmlMappingMetadataComplete != XML_MAPPING_METADATA_COMPLETE_EDEFAULT;
+ case OrmPackage.PERSISTENCE_UNIT_METADATA__PERSISTENCE_UNIT_DEFAULTS:
+ return persistenceUnitDefaults != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (xmlMappingMetadataComplete: ");
+ result.append(xmlMappingMetadataComplete);
+ result.append(')');
+ return result.toString();
+ }
+
+} // PersistenceUnitMetadata
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlNamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PostLoad.java
index 1d63078e2f..503262f677 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlNamedQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PostLoad.java
@@ -7,29 +7,29 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.resource.orm;
import org.eclipse.emf.ecore.EClass;
-import org.eclipse.jpt.core.internal.mappings.INamedQuery;
/**
* <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Named Query</b></em>'.
+ * A representation of the model object '<em><b>Post Load</b></em>'.
* <!-- end-user-doc -->
*
*
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlNamedQuery()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPostLoad()
* @model kind="class"
* @generated
*/
-public class XmlNamedQuery extends AbstractXmlQuery implements INamedQuery
+public class PostLoad extends EventMethod
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- protected XmlNamedQuery() {
+ protected PostLoad()
+ {
super();
}
@@ -39,7 +39,9 @@ public class XmlNamedQuery extends AbstractXmlQuery implements INamedQuery
* @generated
*/
@Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_NAMED_QUERY;
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.POST_LOAD;
}
-} // XmlNamedQuery
+
+} // PostLoad
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PostPersist.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PostPersist.java
new file mode 100644
index 0000000000..8c8538a9d0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PostPersist.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Post Persist</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPostPersist()
+ * @model kind="class"
+ * @generated
+ */
+public class PostPersist extends EventMethod
+{
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PostPersist()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.POST_PERSIST;
+ }
+
+} // PostPersist
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PostRemove.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PostRemove.java
new file mode 100644
index 0000000000..3e83059d86
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PostRemove.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Post Remove</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPostRemove()
+ * @model kind="class"
+ * @generated
+ */
+public class PostRemove extends EventMethod
+{
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PostRemove()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.POST_REMOVE;
+ }
+
+} // PostRemove
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PostUpdate.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PostUpdate.java
new file mode 100644
index 0000000000..2c01b79ce2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PostUpdate.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Post Update</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPostUpdate()
+ * @model kind="class"
+ * @generated
+ */
+public class PostUpdate extends EventMethod
+{
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PostUpdate()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.POST_UPDATE;
+ }
+
+} // PostUpdate
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PrePersist.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PrePersist.java
new file mode 100644
index 0000000000..7d55062ff4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PrePersist.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Pre Persist</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPrePersist()
+ * @model kind="class"
+ * @generated
+ */
+public class PrePersist extends EventMethod
+{
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PrePersist()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.PRE_PERSIST;
+ }
+
+} // PrePersist
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PreRemove.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PreRemove.java
new file mode 100644
index 0000000000..83fc876d28
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PreRemove.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Pre Remove</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPreRemove()
+ * @model kind="class"
+ * @generated
+ */
+public class PreRemove extends EventMethod
+{
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PreRemove()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.PRE_REMOVE;
+ }
+
+} // PreRemove
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PreUpdate.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PreUpdate.java
new file mode 100644
index 0000000000..ea6e163b50
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PreUpdate.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Pre Update</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPreUpdate()
+ * @model kind="class"
+ * @generated
+ */
+public class PreUpdate extends EventMethod
+{
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PreUpdate()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.PRE_UPDATE;
+ }
+
+} // PreUpdate
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PrimaryKeyJoinColumn.java
new file mode 100644
index 0000000000..8ba82f2a41
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/PrimaryKeyJoinColumn.java
@@ -0,0 +1,328 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Primary Key Join Column</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn#getReferencedColumnName <em>Referenced Column Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPrimaryKeyJoinColumn()
+ * @model kind="class"
+ * @generated
+ */
+public class PrimaryKeyJoinColumn extends JpaEObject implements NamedColumn
+{
+ /**
+ * The default value of the '{@link #getColumnDefinition() <em>Column Definition</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumnDefinition()
+ * @generated
+ * @ordered
+ */
+ protected static final String COLUMN_DEFINITION_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getColumnDefinition() <em>Column Definition</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumnDefinition()
+ * @generated
+ * @ordered
+ */
+ protected String columnDefinition = COLUMN_DEFINITION_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getReferencedColumnName() <em>Referenced Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getReferencedColumnName()
+ * @generated
+ * @ordered
+ */
+ protected static final String REFERENCED_COLUMN_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getReferencedColumnName() <em>Referenced Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getReferencedColumnName()
+ * @generated
+ * @ordered
+ */
+ protected String referencedColumnName = REFERENCED_COLUMN_NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PrimaryKeyJoinColumn()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.PRIMARY_KEY_JOIN_COLUMN;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedColumn_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PRIMARY_KEY_JOIN_COLUMN__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Referenced Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Referenced Column Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Referenced Column Name</em>' attribute.
+ * @see #setReferencedColumnName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getPrimaryKeyJoinColumn_ReferencedColumnName()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getReferencedColumnName()
+ {
+ return referencedColumnName;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn#getReferencedColumnName <em>Referenced Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Referenced Column Name</em>' attribute.
+ * @see #getReferencedColumnName()
+ * @generated
+ */
+ public void setReferencedColumnName(String newReferencedColumnName)
+ {
+ String oldReferencedColumnName = referencedColumnName;
+ referencedColumnName = newReferencedColumnName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME, oldReferencedColumnName, referencedColumnName));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Column Definition</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Column Definition</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Column Definition</em>' attribute.
+ * @see #setColumnDefinition(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getNamedColumn_ColumnDefinition()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getColumnDefinition()
+ {
+ return columnDefinition;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn#getColumnDefinition <em>Column Definition</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Column Definition</em>' attribute.
+ * @see #getColumnDefinition()
+ * @generated
+ */
+ public void setColumnDefinition(String newColumnDefinition)
+ {
+ String oldColumnDefinition = columnDefinition;
+ columnDefinition = newColumnDefinition;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION, oldColumnDefinition, columnDefinition));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION:
+ return getColumnDefinition();
+ case OrmPackage.PRIMARY_KEY_JOIN_COLUMN__NAME:
+ return getName();
+ case OrmPackage.PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME:
+ return getReferencedColumnName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION:
+ setColumnDefinition((String)newValue);
+ return;
+ case OrmPackage.PRIMARY_KEY_JOIN_COLUMN__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME:
+ setReferencedColumnName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION:
+ setColumnDefinition(COLUMN_DEFINITION_EDEFAULT);
+ return;
+ case OrmPackage.PRIMARY_KEY_JOIN_COLUMN__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME:
+ setReferencedColumnName(REFERENCED_COLUMN_NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION:
+ return COLUMN_DEFINITION_EDEFAULT == null ? columnDefinition != null : !COLUMN_DEFINITION_EDEFAULT.equals(columnDefinition);
+ case OrmPackage.PRIMARY_KEY_JOIN_COLUMN__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME:
+ return REFERENCED_COLUMN_NAME_EDEFAULT == null ? referencedColumnName != null : !REFERENCED_COLUMN_NAME_EDEFAULT.equals(referencedColumnName);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (columnDefinition: ");
+ result.append(columnDefinition);
+ result.append(", name: ");
+ result.append(name);
+ result.append(", referencedColumnName: ");
+ result.append(referencedColumnName);
+ result.append(')');
+ return result.toString();
+ }
+
+} // PrimaryKeyJoinColumn
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Query.java
index 2a02f11e63..cd5c29a58e 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Query.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2008 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.
@@ -7,30 +7,32 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.mappings;
+package org.eclipse.jpt.core.internal.resource.orm;
import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
+
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
/**
* <!-- begin-user-doc -->
- * A representation of the model object '<em><b>IQuery</b></em>'.
+ * A representation of the model object '<em><b>Query</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IQuery#getName <em>Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IQuery#getQuery <em>Query</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.mappings.IQuery#getHints <em>Hints</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Query#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Query#getQuery <em>Query</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Query#getHints <em>Hints</em>}</li>
* </ul>
* </p>
*
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIQuery()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQuery()
* @model kind="class" interface="true" abstract="true"
+ * @extends IJpaEObject
* @generated
*/
-public interface IQuery extends IJpaSourceObject
+public interface Query extends IJpaEObject
{
/**
* Returns the value of the '<em><b>Name</b></em>' attribute.
@@ -42,14 +44,14 @@ public interface IQuery extends IJpaSourceObject
* <!-- end-user-doc -->
* @return the value of the '<em>Name</em>' attribute.
* @see #setName(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIQuery_Name()
- * @model
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQuery_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
* @generated
*/
String getName();
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IQuery#getName <em>Name</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Query#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
@@ -68,14 +70,14 @@ public interface IQuery extends IJpaSourceObject
* <!-- end-user-doc -->
* @return the value of the '<em>Query</em>' attribute.
* @see #setQuery(String)
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIQuery_Query()
- * @model
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQuery_Query()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
* @generated
*/
String getQuery();
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.mappings.IQuery#getQuery <em>Query</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Query#getQuery <em>Query</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Query</em>' attribute.
@@ -86,7 +88,7 @@ public interface IQuery extends IJpaSourceObject
/**
* Returns the value of the '<em><b>Hints</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.mappings.IQueryHint}.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.QueryHint}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Hints</em>' containment reference list isn't clear,
@@ -94,11 +96,10 @@ public interface IQuery extends IJpaSourceObject
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Hints</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getIQuery_Hints()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQuery_Hints()
* @model containment="true"
* @generated
*/
- EList<IQueryHint> getHints();
+ EList<QueryHint> getHints();
- IQueryHint createQueryHint(int index);
-} // IQuery
+} // Query
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlQueryHint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/QueryHint.java
index a8480f3a3a..3b4c728cf8 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlQueryHint.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/QueryHint.java
@@ -7,26 +7,33 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm;
+package org.eclipse.jpt.core.internal.resource.orm;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.mappings.IQueryHint;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
/**
* <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Xml Query Hint</b></em>'.
+ * A representation of the model object '<em><b>Query Hint</b></em>'.
* <!-- end-user-doc -->
*
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.QueryHint#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.QueryHint#getValue <em>Value</em>}</li>
+ * </ul>
+ * </p>
*
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getXmlQueryHint()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQueryHint()
* @model kind="class"
+ * @extends IJpaEObject
* @generated
*/
-public class XmlQueryHint extends XmlEObject implements IQueryHint
+public class QueryHint extends JpaEObject implements IJpaEObject
{
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
@@ -73,7 +80,8 @@ public class XmlQueryHint extends XmlEObject implements IQueryHint
* <!-- end-user-doc -->
* @generated
*/
- protected XmlQueryHint() {
+ protected QueryHint()
+ {
super();
}
@@ -83,8 +91,9 @@ public class XmlQueryHint extends XmlEObject implements IQueryHint
* @generated
*/
@Override
- protected EClass eStaticClass() {
- return OrmPackage.Literals.XML_QUERY_HINT;
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.QUERY_HINT;
}
/**
@@ -97,27 +106,29 @@ public class XmlQueryHint extends XmlEObject implements IQueryHint
* <!-- end-user-doc -->
* @return the value of the '<em>Name</em>' attribute.
* @see #setName(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIQueryHint_Name()
- * @model
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQueryHint_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
* @generated
*/
- public String getName() {
+ public String getName()
+ {
return name;
}
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlQueryHint#getName <em>Name</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.QueryHint#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
* @see #getName()
* @generated
*/
- public void setName(String newName) {
+ public void setName(String newName)
+ {
String oldName = name;
name = newName;
if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_QUERY_HINT__NAME, oldName, name));
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.QUERY_HINT__NAME, oldName, name));
}
/**
@@ -130,27 +141,29 @@ public class XmlQueryHint extends XmlEObject implements IQueryHint
* <!-- end-user-doc -->
* @return the value of the '<em>Value</em>' attribute.
* @see #setValue(String)
- * @see org.eclipse.jpt.core.internal.content.orm.OrmPackage#getIQueryHint_Value()
- * @model
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getQueryHint_Value()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
* @generated
*/
- public String getValue() {
+ public String getValue()
+ {
return value;
}
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.orm.XmlQueryHint#getValue <em>Value</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.QueryHint#getValue <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Value</em>' attribute.
* @see #getValue()
* @generated
*/
- public void setValue(String newValue) {
+ public void setValue(String newValue)
+ {
String oldValue = value;
value = newValue;
if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.XML_QUERY_HINT__VALUE, oldValue, value));
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.QUERY_HINT__VALUE, oldValue, value));
}
/**
@@ -159,11 +172,13 @@ public class XmlQueryHint extends XmlEObject implements IQueryHint
* @generated
*/
@Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.XML_QUERY_HINT__NAME :
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.QUERY_HINT__NAME:
return getName();
- case OrmPackage.XML_QUERY_HINT__VALUE :
+ case OrmPackage.QUERY_HINT__VALUE:
return getValue();
}
return super.eGet(featureID, resolve, coreType);
@@ -175,13 +190,15 @@ public class XmlQueryHint extends XmlEObject implements IQueryHint
* @generated
*/
@Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.XML_QUERY_HINT__NAME :
- setName((String) newValue);
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.QUERY_HINT__NAME:
+ setName((String)newValue);
return;
- case OrmPackage.XML_QUERY_HINT__VALUE :
- setValue((String) newValue);
+ case OrmPackage.QUERY_HINT__VALUE:
+ setValue((String)newValue);
return;
}
super.eSet(featureID, newValue);
@@ -193,12 +210,14 @@ public class XmlQueryHint extends XmlEObject implements IQueryHint
* @generated
*/
@Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_QUERY_HINT__NAME :
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.QUERY_HINT__NAME:
setName(NAME_EDEFAULT);
return;
- case OrmPackage.XML_QUERY_HINT__VALUE :
+ case OrmPackage.QUERY_HINT__VALUE:
setValue(VALUE_EDEFAULT);
return;
}
@@ -211,11 +230,13 @@ public class XmlQueryHint extends XmlEObject implements IQueryHint
* @generated
*/
@Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.XML_QUERY_HINT__NAME :
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.QUERY_HINT__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
- case OrmPackage.XML_QUERY_HINT__VALUE :
+ case OrmPackage.QUERY_HINT__VALUE:
return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
}
return super.eIsSet(featureID);
@@ -227,49 +248,10 @@ public class XmlQueryHint extends XmlEObject implements IQueryHint
* @generated
*/
@Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- if (baseClass == IQueryHint.class) {
- switch (derivedFeatureID) {
- case OrmPackage.XML_QUERY_HINT__NAME :
- return JpaCoreMappingsPackage.IQUERY_HINT__NAME;
- case OrmPackage.XML_QUERY_HINT__VALUE :
- return JpaCoreMappingsPackage.IQUERY_HINT__VALUE;
- default :
- return -1;
- }
- }
- return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- if (baseClass == IQueryHint.class) {
- switch (baseFeatureID) {
- case JpaCoreMappingsPackage.IQUERY_HINT__NAME :
- return OrmPackage.XML_QUERY_HINT__NAME;
- case JpaCoreMappingsPackage.IQUERY_HINT__VALUE :
- return OrmPackage.XML_QUERY_HINT__VALUE;
- default :
- return -1;
- }
- }
- return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (name: ");
result.append(name);
@@ -278,4 +260,5 @@ public class XmlQueryHint extends XmlEObject implements IQueryHint
result.append(')');
return result.toString();
}
-} // XmlQueryHint
+
+} // QueryHint
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/RelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/RelationshipMapping.java
new file mode 100644
index 0000000000..c7ce04ac90
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/RelationshipMapping.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Relationship Mapping</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping#getTargetEntity <em>Target Entity</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping#getFetch <em>Fetch</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping#getJoinTable <em>Join Table</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping#getCascade <em>Cascade</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface RelationshipMapping extends AttributeMapping
+{
+ /**
+ * Returns the value of the '<em><b>Target Entity</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Target Entity</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Target Entity</em>' attribute.
+ * @see #setTargetEntity(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_TargetEntity()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getTargetEntity();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping#getTargetEntity <em>Target Entity</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Target Entity</em>' attribute.
+ * @see #getTargetEntity()
+ * @generated
+ */
+ void setTargetEntity(String value);
+
+ /**
+ * Returns the value of the '<em><b>Fetch</b></em>' attribute.
+ * The default value is <code>"LAZY"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.FetchType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Fetch</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Fetch</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
+ * @see #setFetch(FetchType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_Fetch()
+ * @model default="LAZY"
+ * @generated
+ */
+ FetchType getFetch();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping#getFetch <em>Fetch</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Fetch</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FetchType
+ * @see #getFetch()
+ * @generated
+ */
+ void setFetch(FetchType value);
+
+ /**
+ * Returns the value of the '<em><b>Cascade</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Cascade</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Cascade</em>' containment reference.
+ * @see #setCascade(CascadeType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_Cascade()
+ * @model containment="true"
+ * @generated
+ */
+ CascadeType getCascade();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping#getCascade <em>Cascade</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Cascade</em>' containment reference.
+ * @see #getCascade()
+ * @generated
+ */
+ void setCascade(CascadeType value);
+
+ /**
+ * Returns the value of the '<em><b>Join Table</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Join Table</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Join Table</em>' containment reference.
+ * @see #setJoinTable(JoinTable)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getRelationshipMapping_JoinTable()
+ * @model containment="true"
+ * @generated
+ */
+ JoinTable getJoinTable();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping#getJoinTable <em>Join Table</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Join Table</em>' containment reference.
+ * @see #getJoinTable()
+ * @generated
+ */
+ void setJoinTable(JoinTable value);
+
+} // RelationshipMapping
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SecondaryTable.java
new file mode 100644
index 0000000000..e385a7e849
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SecondaryTable.java
@@ -0,0 +1,434 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Secondary Table</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.SecondaryTable#getPrimaryKeyJoinColumns <em>Primary Key Join Columns</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSecondaryTable()
+ * @model kind="class"
+ * @generated
+ */
+public class SecondaryTable extends JpaEObject implements AbstractTable
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+ /**
+ * The default value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCatalog()
+ * @generated
+ * @ordered
+ */
+ protected static final String CATALOG_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCatalog()
+ * @generated
+ * @ordered
+ */
+ protected String catalog = CATALOG_EDEFAULT;
+ /**
+ * The default value of the '{@link #getSchema() <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSchema()
+ * @generated
+ * @ordered
+ */
+ protected static final String SCHEMA_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getSchema() <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSchema()
+ * @generated
+ * @ordered
+ */
+ protected String schema = SCHEMA_EDEFAULT;
+ /**
+ * The cached value of the '{@link #getUniqueConstraints() <em>Unique Constraints</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getUniqueConstraints()
+ * @generated
+ * @ordered
+ */
+ protected EList<UniqueConstraint> uniqueConstraints;
+ /**
+ * The cached value of the '{@link #getPrimaryKeyJoinColumns() <em>Primary Key Join Columns</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPrimaryKeyJoinColumns()
+ * @generated
+ * @ordered
+ */
+ protected EList<PrimaryKeyJoinColumn> primaryKeyJoinColumns;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected SecondaryTable()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.SECONDARY_TABLE;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.SecondaryTable#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.SECONDARY_TABLE__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Catalog</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Catalog</em>' attribute.
+ * @see #setCatalog(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_Catalog()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getCatalog()
+ {
+ return catalog;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.SecondaryTable#getCatalog <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Catalog</em>' attribute.
+ * @see #getCatalog()
+ * @generated
+ */
+ public void setCatalog(String newCatalog)
+ {
+ String oldCatalog = catalog;
+ catalog = newCatalog;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.SECONDARY_TABLE__CATALOG, oldCatalog, catalog));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Schema</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Schema</em>' attribute.
+ * @see #setSchema(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_Schema()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getSchema()
+ {
+ return schema;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.SecondaryTable#getSchema <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Schema</em>' attribute.
+ * @see #getSchema()
+ * @generated
+ */
+ public void setSchema(String newSchema)
+ {
+ String oldSchema = schema;
+ schema = newSchema;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.SECONDARY_TABLE__SCHEMA, oldSchema, schema));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Unique Constraints</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Unique Constraints</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Unique Constraints</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_UniqueConstraints()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<UniqueConstraint> getUniqueConstraints()
+ {
+ if (uniqueConstraints == null)
+ {
+ uniqueConstraints = new EObjectContainmentEList<UniqueConstraint>(UniqueConstraint.class, this, OrmPackage.SECONDARY_TABLE__UNIQUE_CONSTRAINTS);
+ }
+ return uniqueConstraints;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Primary Key Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Primary Key Join Columns</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Primary Key Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSecondaryTable_PrimaryKeyJoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<PrimaryKeyJoinColumn> getPrimaryKeyJoinColumns()
+ {
+ if (primaryKeyJoinColumns == null)
+ {
+ primaryKeyJoinColumns = new EObjectContainmentEList<PrimaryKeyJoinColumn>(PrimaryKeyJoinColumn.class, this, OrmPackage.SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS);
+ }
+ return primaryKeyJoinColumns;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.SECONDARY_TABLE__UNIQUE_CONSTRAINTS:
+ return ((InternalEList<?>)getUniqueConstraints()).basicRemove(otherEnd, msgs);
+ case OrmPackage.SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS:
+ return ((InternalEList<?>)getPrimaryKeyJoinColumns()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.SECONDARY_TABLE__NAME:
+ return getName();
+ case OrmPackage.SECONDARY_TABLE__CATALOG:
+ return getCatalog();
+ case OrmPackage.SECONDARY_TABLE__SCHEMA:
+ return getSchema();
+ case OrmPackage.SECONDARY_TABLE__UNIQUE_CONSTRAINTS:
+ return getUniqueConstraints();
+ case OrmPackage.SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS:
+ return getPrimaryKeyJoinColumns();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.SECONDARY_TABLE__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.SECONDARY_TABLE__CATALOG:
+ setCatalog((String)newValue);
+ return;
+ case OrmPackage.SECONDARY_TABLE__SCHEMA:
+ setSchema((String)newValue);
+ return;
+ case OrmPackage.SECONDARY_TABLE__UNIQUE_CONSTRAINTS:
+ getUniqueConstraints().clear();
+ getUniqueConstraints().addAll((Collection<? extends UniqueConstraint>)newValue);
+ return;
+ case OrmPackage.SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS:
+ getPrimaryKeyJoinColumns().clear();
+ getPrimaryKeyJoinColumns().addAll((Collection<? extends PrimaryKeyJoinColumn>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.SECONDARY_TABLE__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.SECONDARY_TABLE__CATALOG:
+ setCatalog(CATALOG_EDEFAULT);
+ return;
+ case OrmPackage.SECONDARY_TABLE__SCHEMA:
+ setSchema(SCHEMA_EDEFAULT);
+ return;
+ case OrmPackage.SECONDARY_TABLE__UNIQUE_CONSTRAINTS:
+ getUniqueConstraints().clear();
+ return;
+ case OrmPackage.SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS:
+ getPrimaryKeyJoinColumns().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.SECONDARY_TABLE__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.SECONDARY_TABLE__CATALOG:
+ return CATALOG_EDEFAULT == null ? catalog != null : !CATALOG_EDEFAULT.equals(catalog);
+ case OrmPackage.SECONDARY_TABLE__SCHEMA:
+ return SCHEMA_EDEFAULT == null ? schema != null : !SCHEMA_EDEFAULT.equals(schema);
+ case OrmPackage.SECONDARY_TABLE__UNIQUE_CONSTRAINTS:
+ return uniqueConstraints != null && !uniqueConstraints.isEmpty();
+ case OrmPackage.SECONDARY_TABLE__PRIMARY_KEY_JOIN_COLUMNS:
+ return primaryKeyJoinColumns != null && !primaryKeyJoinColumns.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", catalog: ");
+ result.append(catalog);
+ result.append(", schema: ");
+ result.append(schema);
+ result.append(')');
+ return result.toString();
+ }
+
+} // SecondaryTable
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SequenceGenerator.java
new file mode 100644
index 0000000000..135eff7806
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SequenceGenerator.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Sequence Generator</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator#getSequenceName <em>Sequence Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSequenceGenerator()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface SequenceGenerator extends Generator
+{
+ /**
+ * Returns the value of the '<em><b>Sequence Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Sequence Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Sequence Name</em>' attribute.
+ * @see #setSequenceName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSequenceGenerator_SequenceName()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getSequenceName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator#getSequenceName <em>Sequence Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Sequence Name</em>' attribute.
+ * @see #getSequenceName()
+ * @generated
+ */
+ void setSequenceName(String value);
+
+} // SequenceGenerator
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SequenceGeneratorImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SequenceGeneratorImpl.java
new file mode 100644
index 0000000000..cedfc52039
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SequenceGeneratorImpl.java
@@ -0,0 +1,389 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Sequence Generator</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSequenceGeneratorImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class SequenceGeneratorImpl extends JpaEObject implements SequenceGenerator
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getInitialValue() <em>Initial Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInitialValue()
+ * @generated
+ * @ordered
+ */
+ protected static final Integer INITIAL_VALUE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getInitialValue() <em>Initial Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInitialValue()
+ * @generated
+ * @ordered
+ */
+ protected Integer initialValue = INITIAL_VALUE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getAllocationSize() <em>Allocation Size</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAllocationSize()
+ * @generated
+ * @ordered
+ */
+ protected static final Integer ALLOCATION_SIZE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getAllocationSize() <em>Allocation Size</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAllocationSize()
+ * @generated
+ * @ordered
+ */
+ protected Integer allocationSize = ALLOCATION_SIZE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getSequenceName() <em>Sequence Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSequenceName()
+ * @generated
+ * @ordered
+ */
+ protected static final String SEQUENCE_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getSequenceName() <em>Sequence Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSequenceName()
+ * @generated
+ * @ordered
+ */
+ protected String sequenceName = SEQUENCE_NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected SequenceGeneratorImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.SEQUENCE_GENERATOR_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGenerator_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.SequenceGeneratorImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.SEQUENCE_GENERATOR_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Sequence Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Sequence Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Sequence Name</em>' attribute.
+ * @see #setSequenceName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSequenceGenerator_SequenceName()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getSequenceName()
+ {
+ return sequenceName;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.SequenceGeneratorImpl#getSequenceName <em>Sequence Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Sequence Name</em>' attribute.
+ * @see #getSequenceName()
+ * @generated
+ */
+ public void setSequenceName(String newSequenceName)
+ {
+ String oldSequenceName = sequenceName;
+ sequenceName = newSequenceName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.SEQUENCE_GENERATOR_IMPL__SEQUENCE_NAME, oldSequenceName, sequenceName));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Initial Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Initial Value</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Initial Value</em>' attribute.
+ * @see #setInitialValue(Integer)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGenerator_InitialValue()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.IntObject"
+ * @generated
+ */
+ public Integer getInitialValue()
+ {
+ return initialValue;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.SequenceGeneratorImpl#getInitialValue <em>Initial Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Initial Value</em>' attribute.
+ * @see #getInitialValue()
+ * @generated
+ */
+ public void setInitialValue(Integer newInitialValue)
+ {
+ Integer oldInitialValue = initialValue;
+ initialValue = newInitialValue;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.SEQUENCE_GENERATOR_IMPL__INITIAL_VALUE, oldInitialValue, initialValue));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Allocation Size</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Allocation Size</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Allocation Size</em>' attribute.
+ * @see #setAllocationSize(Integer)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGenerator_AllocationSize()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.IntObject"
+ * @generated
+ */
+ public Integer getAllocationSize()
+ {
+ return allocationSize;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.SequenceGeneratorImpl#getAllocationSize <em>Allocation Size</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Allocation Size</em>' attribute.
+ * @see #getAllocationSize()
+ * @generated
+ */
+ public void setAllocationSize(Integer newAllocationSize)
+ {
+ Integer oldAllocationSize = allocationSize;
+ allocationSize = newAllocationSize;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.SEQUENCE_GENERATOR_IMPL__ALLOCATION_SIZE, oldAllocationSize, allocationSize));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL__NAME:
+ return getName();
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL__INITIAL_VALUE:
+ return getInitialValue();
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL__ALLOCATION_SIZE:
+ return getAllocationSize();
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL__SEQUENCE_NAME:
+ return getSequenceName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL__INITIAL_VALUE:
+ setInitialValue((Integer)newValue);
+ return;
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL__ALLOCATION_SIZE:
+ setAllocationSize((Integer)newValue);
+ return;
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL__SEQUENCE_NAME:
+ setSequenceName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL__INITIAL_VALUE:
+ setInitialValue(INITIAL_VALUE_EDEFAULT);
+ return;
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL__ALLOCATION_SIZE:
+ setAllocationSize(ALLOCATION_SIZE_EDEFAULT);
+ return;
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL__SEQUENCE_NAME:
+ setSequenceName(SEQUENCE_NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL__INITIAL_VALUE:
+ return INITIAL_VALUE_EDEFAULT == null ? initialValue != null : !INITIAL_VALUE_EDEFAULT.equals(initialValue);
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL__ALLOCATION_SIZE:
+ return ALLOCATION_SIZE_EDEFAULT == null ? allocationSize != null : !ALLOCATION_SIZE_EDEFAULT.equals(allocationSize);
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL__SEQUENCE_NAME:
+ return SEQUENCE_NAME_EDEFAULT == null ? sequenceName != null : !SEQUENCE_NAME_EDEFAULT.equals(sequenceName);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", initialValue: ");
+ result.append(initialValue);
+ result.append(", allocationSize: ");
+ result.append(allocationSize);
+ result.append(", sequenceName: ");
+ result.append(sequenceName);
+ result.append(')');
+ return result.toString();
+ }
+
+} // SequenceGenerator
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SingleRelationshipMapping.java
new file mode 100644
index 0000000000..4c880a77e3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SingleRelationshipMapping.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Single Relationship Mapping</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping#getOptional <em>Optional</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping#getJoinColumns <em>Join Columns</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSingleRelationshipMapping()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface SingleRelationshipMapping extends RelationshipMapping
+{
+ /**
+ * Returns the value of the '<em><b>Optional</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Optional</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Optional</em>' attribute.
+ * @see #setOptional(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSingleRelationshipMapping_Optional()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ Boolean getOptional();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping#getOptional <em>Optional</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Optional</em>' attribute.
+ * @see #getOptional()
+ * @generated
+ */
+ void setOptional(Boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Join Columns</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Join Columns</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Join Columns</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSingleRelationshipMapping_JoinColumns()
+ * @model containment="true"
+ * @generated
+ */
+ EList<JoinColumn> getJoinColumns();
+
+} // SingleRelationshipMapping
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SqlResultSetMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SqlResultSetMapping.java
new file mode 100644
index 0000000000..bbd244cbf7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/SqlResultSetMapping.java
@@ -0,0 +1,311 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Sql Result Set Mapping</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping#getEntityResults <em>Entity Results</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping#getColumnResults <em>Column Results</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSqlResultSetMapping()
+ * @model kind="class"
+ * @extends IJpaEObject
+ * @generated
+ */
+public class SqlResultSetMapping extends JpaEObject implements IJpaEObject
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getEntityResults() <em>Entity Results</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEntityResults()
+ * @generated
+ * @ordered
+ */
+ protected EList<EntityResult> entityResults;
+
+ /**
+ * The cached value of the '{@link #getColumnResults() <em>Column Results</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumnResults()
+ * @generated
+ * @ordered
+ */
+ protected EList<ColumnResult> columnResults;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected SqlResultSetMapping()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.SQL_RESULT_SET_MAPPING;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSqlResultSetMapping_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.SQL_RESULT_SET_MAPPING__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Entity Results</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.EntityResult}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Entity Results</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Entity Results</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSqlResultSetMapping_EntityResults()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<EntityResult> getEntityResults()
+ {
+ if (entityResults == null)
+ {
+ entityResults = new EObjectContainmentEList<EntityResult>(EntityResult.class, this, OrmPackage.SQL_RESULT_SET_MAPPING__ENTITY_RESULTS);
+ }
+ return entityResults;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Column Results</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.ColumnResult}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Column Results</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Column Results</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getSqlResultSetMapping_ColumnResults()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<ColumnResult> getColumnResults()
+ {
+ if (columnResults == null)
+ {
+ columnResults = new EObjectContainmentEList<ColumnResult>(ColumnResult.class, this, OrmPackage.SQL_RESULT_SET_MAPPING__COLUMN_RESULTS);
+ }
+ return columnResults;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.SQL_RESULT_SET_MAPPING__ENTITY_RESULTS:
+ return ((InternalEList<?>)getEntityResults()).basicRemove(otherEnd, msgs);
+ case OrmPackage.SQL_RESULT_SET_MAPPING__COLUMN_RESULTS:
+ return ((InternalEList<?>)getColumnResults()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.SQL_RESULT_SET_MAPPING__NAME:
+ return getName();
+ case OrmPackage.SQL_RESULT_SET_MAPPING__ENTITY_RESULTS:
+ return getEntityResults();
+ case OrmPackage.SQL_RESULT_SET_MAPPING__COLUMN_RESULTS:
+ return getColumnResults();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.SQL_RESULT_SET_MAPPING__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.SQL_RESULT_SET_MAPPING__ENTITY_RESULTS:
+ getEntityResults().clear();
+ getEntityResults().addAll((Collection<? extends EntityResult>)newValue);
+ return;
+ case OrmPackage.SQL_RESULT_SET_MAPPING__COLUMN_RESULTS:
+ getColumnResults().clear();
+ getColumnResults().addAll((Collection<? extends ColumnResult>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.SQL_RESULT_SET_MAPPING__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.SQL_RESULT_SET_MAPPING__ENTITY_RESULTS:
+ getEntityResults().clear();
+ return;
+ case OrmPackage.SQL_RESULT_SET_MAPPING__COLUMN_RESULTS:
+ getColumnResults().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.SQL_RESULT_SET_MAPPING__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.SQL_RESULT_SET_MAPPING__ENTITY_RESULTS:
+ return entityResults != null && !entityResults.isEmpty();
+ case OrmPackage.SQL_RESULT_SET_MAPPING__COLUMN_RESULTS:
+ return columnResults != null && !columnResults.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} // SqlResultSetMapping
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Table.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Table.java
new file mode 100644
index 0000000000..b5f563a29b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Table.java
@@ -0,0 +1,383 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Table</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTable()
+ * @model kind="class"
+ * @generated
+ */
+public class Table extends JpaEObject implements AbstractTable
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+ /**
+ * The default value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCatalog()
+ * @generated
+ * @ordered
+ */
+ protected static final String CATALOG_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCatalog()
+ * @generated
+ * @ordered
+ */
+ protected String catalog = CATALOG_EDEFAULT;
+ /**
+ * The default value of the '{@link #getSchema() <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSchema()
+ * @generated
+ * @ordered
+ */
+ protected static final String SCHEMA_EDEFAULT = null;
+ /**
+ * The cached value of the '{@link #getSchema() <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSchema()
+ * @generated
+ * @ordered
+ */
+ protected String schema = SCHEMA_EDEFAULT;
+ /**
+ * The cached value of the '{@link #getUniqueConstraints() <em>Unique Constraints</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getUniqueConstraints()
+ * @generated
+ * @ordered
+ */
+ protected EList<UniqueConstraint> uniqueConstraints;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Table()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.TABLE;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Table#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TABLE__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Catalog</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Catalog</em>' attribute.
+ * @see #setCatalog(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_Catalog()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getCatalog()
+ {
+ return catalog;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Table#getCatalog <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Catalog</em>' attribute.
+ * @see #getCatalog()
+ * @generated
+ */
+ public void setCatalog(String newCatalog)
+ {
+ String oldCatalog = catalog;
+ catalog = newCatalog;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TABLE__CATALOG, oldCatalog, catalog));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Schema</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Schema</em>' attribute.
+ * @see #setSchema(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_Schema()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getSchema()
+ {
+ return schema;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Table#getSchema <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Schema</em>' attribute.
+ * @see #getSchema()
+ * @generated
+ */
+ public void setSchema(String newSchema)
+ {
+ String oldSchema = schema;
+ schema = newSchema;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TABLE__SCHEMA, oldSchema, schema));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Unique Constraints</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Unique Constraints</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Unique Constraints</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAbstractTable_UniqueConstraints()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<UniqueConstraint> getUniqueConstraints()
+ {
+ if (uniqueConstraints == null)
+ {
+ uniqueConstraints = new EObjectContainmentEList<UniqueConstraint>(UniqueConstraint.class, this, OrmPackage.TABLE__UNIQUE_CONSTRAINTS);
+ }
+ return uniqueConstraints;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TABLE__UNIQUE_CONSTRAINTS:
+ return ((InternalEList<?>)getUniqueConstraints()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TABLE__NAME:
+ return getName();
+ case OrmPackage.TABLE__CATALOG:
+ return getCatalog();
+ case OrmPackage.TABLE__SCHEMA:
+ return getSchema();
+ case OrmPackage.TABLE__UNIQUE_CONSTRAINTS:
+ return getUniqueConstraints();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TABLE__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.TABLE__CATALOG:
+ setCatalog((String)newValue);
+ return;
+ case OrmPackage.TABLE__SCHEMA:
+ setSchema((String)newValue);
+ return;
+ case OrmPackage.TABLE__UNIQUE_CONSTRAINTS:
+ getUniqueConstraints().clear();
+ getUniqueConstraints().addAll((Collection<? extends UniqueConstraint>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TABLE__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.TABLE__CATALOG:
+ setCatalog(CATALOG_EDEFAULT);
+ return;
+ case OrmPackage.TABLE__SCHEMA:
+ setSchema(SCHEMA_EDEFAULT);
+ return;
+ case OrmPackage.TABLE__UNIQUE_CONSTRAINTS:
+ getUniqueConstraints().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TABLE__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.TABLE__CATALOG:
+ return CATALOG_EDEFAULT == null ? catalog != null : !CATALOG_EDEFAULT.equals(catalog);
+ case OrmPackage.TABLE__SCHEMA:
+ return SCHEMA_EDEFAULT == null ? schema != null : !SCHEMA_EDEFAULT.equals(schema);
+ case OrmPackage.TABLE__UNIQUE_CONSTRAINTS:
+ return uniqueConstraints != null && !uniqueConstraints.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", catalog: ");
+ result.append(catalog);
+ result.append(", schema: ");
+ result.append(schema);
+ result.append(')');
+ return result.toString();
+ }
+
+} // Table
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TableGenerator.java
new file mode 100644
index 0000000000..c62d8b0b23
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TableGenerator.java
@@ -0,0 +1,210 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Table Generator</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getTable <em>Table</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getCatalog <em>Catalog</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getSchema <em>Schema</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getPkColumnName <em>Pk Column Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getValueColumnName <em>Value Column Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getPkColumnValue <em>Pk Column Value</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getUniqueConstraints <em>Unique Constraints</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface TableGenerator extends Generator
+{
+ /**
+ * Returns the value of the '<em><b>Table</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Table</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Table</em>' attribute.
+ * @see #setTable(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator_Table()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getTable();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getTable <em>Table</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Table</em>' attribute.
+ * @see #getTable()
+ * @generated
+ */
+ void setTable(String value);
+
+ /**
+ * Returns the value of the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Catalog</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Catalog</em>' attribute.
+ * @see #setCatalog(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator_Catalog()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getCatalog();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getCatalog <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Catalog</em>' attribute.
+ * @see #getCatalog()
+ * @generated
+ */
+ void setCatalog(String value);
+
+ /**
+ * Returns the value of the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Schema</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Schema</em>' attribute.
+ * @see #setSchema(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator_Schema()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getSchema();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getSchema <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Schema</em>' attribute.
+ * @see #getSchema()
+ * @generated
+ */
+ void setSchema(String value);
+
+ /**
+ * Returns the value of the '<em><b>Pk Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Pk Column Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Pk Column Name</em>' attribute.
+ * @see #setPkColumnName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator_PkColumnName()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getPkColumnName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getPkColumnName <em>Pk Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Pk Column Name</em>' attribute.
+ * @see #getPkColumnName()
+ * @generated
+ */
+ void setPkColumnName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Value Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Value Column Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Value Column Name</em>' attribute.
+ * @see #setValueColumnName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator_ValueColumnName()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getValueColumnName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getValueColumnName <em>Value Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Value Column Name</em>' attribute.
+ * @see #getValueColumnName()
+ * @generated
+ */
+ void setValueColumnName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Pk Column Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Pk Column Value</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Pk Column Value</em>' attribute.
+ * @see #setPkColumnValue(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator_PkColumnValue()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ String getPkColumnValue();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator#getPkColumnValue <em>Pk Column Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Pk Column Value</em>' attribute.
+ * @see #getPkColumnValue()
+ * @generated
+ */
+ void setPkColumnValue(String value);
+
+ /**
+ * Returns the value of the '<em><b>Unique Constraints</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Unique Constraints</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Unique Constraints</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator_UniqueConstraints()
+ * @model containment="true"
+ * @generated
+ */
+ EList<UniqueConstraint> getUniqueConstraints();
+
+} // TableGenerator
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TableGeneratorImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TableGeneratorImpl.java
new file mode 100644
index 0000000000..6c7c8e42bf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TableGeneratorImpl.java
@@ -0,0 +1,791 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Table Generator</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGeneratorImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class TableGeneratorImpl extends JpaEObject implements TableGenerator
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getInitialValue() <em>Initial Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInitialValue()
+ * @generated
+ * @ordered
+ */
+ protected static final Integer INITIAL_VALUE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getInitialValue() <em>Initial Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInitialValue()
+ * @generated
+ * @ordered
+ */
+ protected Integer initialValue = INITIAL_VALUE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getAllocationSize() <em>Allocation Size</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAllocationSize()
+ * @generated
+ * @ordered
+ */
+ protected static final Integer ALLOCATION_SIZE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getAllocationSize() <em>Allocation Size</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAllocationSize()
+ * @generated
+ * @ordered
+ */
+ protected Integer allocationSize = ALLOCATION_SIZE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getTable() <em>Table</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTable()
+ * @generated
+ * @ordered
+ */
+ protected static final String TABLE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTable() <em>Table</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTable()
+ * @generated
+ * @ordered
+ */
+ protected String table = TABLE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCatalog()
+ * @generated
+ * @ordered
+ */
+ protected static final String CATALOG_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getCatalog() <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getCatalog()
+ * @generated
+ * @ordered
+ */
+ protected String catalog = CATALOG_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getSchema() <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSchema()
+ * @generated
+ * @ordered
+ */
+ protected static final String SCHEMA_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getSchema() <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSchema()
+ * @generated
+ * @ordered
+ */
+ protected String schema = SCHEMA_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getPkColumnName() <em>Pk Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPkColumnName()
+ * @generated
+ * @ordered
+ */
+ protected static final String PK_COLUMN_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getPkColumnName() <em>Pk Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPkColumnName()
+ * @generated
+ * @ordered
+ */
+ protected String pkColumnName = PK_COLUMN_NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getValueColumnName() <em>Value Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getValueColumnName()
+ * @generated
+ * @ordered
+ */
+ protected static final String VALUE_COLUMN_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getValueColumnName() <em>Value Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getValueColumnName()
+ * @generated
+ * @ordered
+ */
+ protected String valueColumnName = VALUE_COLUMN_NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getPkColumnValue() <em>Pk Column Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPkColumnValue()
+ * @generated
+ * @ordered
+ */
+ protected static final String PK_COLUMN_VALUE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getPkColumnValue() <em>Pk Column Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPkColumnValue()
+ * @generated
+ * @ordered
+ */
+ protected String pkColumnValue = PK_COLUMN_VALUE_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getUniqueConstraints() <em>Unique Constraints</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getUniqueConstraints()
+ * @generated
+ * @ordered
+ */
+ protected EList<UniqueConstraint> uniqueConstraints;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TableGeneratorImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.TABLE_GENERATOR_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGenerator_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TABLE_GENERATOR_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Table</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Table</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Table</em>' attribute.
+ * @see #setTable(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator_Table()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getTable()
+ {
+ return table;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl#getTable <em>Table</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Table</em>' attribute.
+ * @see #getTable()
+ * @generated
+ */
+ public void setTable(String newTable)
+ {
+ String oldTable = table;
+ table = newTable;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TABLE_GENERATOR_IMPL__TABLE, oldTable, table));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Catalog</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Catalog</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Catalog</em>' attribute.
+ * @see #setCatalog(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator_Catalog()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getCatalog()
+ {
+ return catalog;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl#getCatalog <em>Catalog</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Catalog</em>' attribute.
+ * @see #getCatalog()
+ * @generated
+ */
+ public void setCatalog(String newCatalog)
+ {
+ String oldCatalog = catalog;
+ catalog = newCatalog;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TABLE_GENERATOR_IMPL__CATALOG, oldCatalog, catalog));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Schema</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Schema</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Schema</em>' attribute.
+ * @see #setSchema(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator_Schema()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getSchema()
+ {
+ return schema;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl#getSchema <em>Schema</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Schema</em>' attribute.
+ * @see #getSchema()
+ * @generated
+ */
+ public void setSchema(String newSchema)
+ {
+ String oldSchema = schema;
+ schema = newSchema;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TABLE_GENERATOR_IMPL__SCHEMA, oldSchema, schema));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Pk Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Pk Column Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Pk Column Name</em>' attribute.
+ * @see #setPkColumnName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator_PkColumnName()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getPkColumnName()
+ {
+ return pkColumnName;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl#getPkColumnName <em>Pk Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Pk Column Name</em>' attribute.
+ * @see #getPkColumnName()
+ * @generated
+ */
+ public void setPkColumnName(String newPkColumnName)
+ {
+ String oldPkColumnName = pkColumnName;
+ pkColumnName = newPkColumnName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TABLE_GENERATOR_IMPL__PK_COLUMN_NAME, oldPkColumnName, pkColumnName));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Value Column Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Value Column Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Value Column Name</em>' attribute.
+ * @see #setValueColumnName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator_ValueColumnName()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getValueColumnName()
+ {
+ return valueColumnName;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl#getValueColumnName <em>Value Column Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Value Column Name</em>' attribute.
+ * @see #getValueColumnName()
+ * @generated
+ */
+ public void setValueColumnName(String newValueColumnName)
+ {
+ String oldValueColumnName = valueColumnName;
+ valueColumnName = newValueColumnName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TABLE_GENERATOR_IMPL__VALUE_COLUMN_NAME, oldValueColumnName, valueColumnName));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Pk Column Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Pk Column Value</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Pk Column Value</em>' attribute.
+ * @see #setPkColumnValue(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator_PkColumnValue()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getPkColumnValue()
+ {
+ return pkColumnValue;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl#getPkColumnValue <em>Pk Column Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Pk Column Value</em>' attribute.
+ * @see #getPkColumnValue()
+ * @generated
+ */
+ public void setPkColumnValue(String newPkColumnValue)
+ {
+ String oldPkColumnValue = pkColumnValue;
+ pkColumnValue = newPkColumnValue;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TABLE_GENERATOR_IMPL__PK_COLUMN_VALUE, oldPkColumnValue, pkColumnValue));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Initial Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Initial Value</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Initial Value</em>' attribute.
+ * @see #setInitialValue(Integer)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGenerator_InitialValue()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.IntObject"
+ * @generated
+ */
+ public Integer getInitialValue()
+ {
+ return initialValue;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl#getInitialValue <em>Initial Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Initial Value</em>' attribute.
+ * @see #getInitialValue()
+ * @generated
+ */
+ public void setInitialValue(Integer newInitialValue)
+ {
+ Integer oldInitialValue = initialValue;
+ initialValue = newInitialValue;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TABLE_GENERATOR_IMPL__INITIAL_VALUE, oldInitialValue, initialValue));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Allocation Size</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Allocation Size</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Allocation Size</em>' attribute.
+ * @see #setAllocationSize(Integer)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getGenerator_AllocationSize()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.IntObject"
+ * @generated
+ */
+ public Integer getAllocationSize()
+ {
+ return allocationSize;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl#getAllocationSize <em>Allocation Size</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Allocation Size</em>' attribute.
+ * @see #getAllocationSize()
+ * @generated
+ */
+ public void setAllocationSize(Integer newAllocationSize)
+ {
+ Integer oldAllocationSize = allocationSize;
+ allocationSize = newAllocationSize;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TABLE_GENERATOR_IMPL__ALLOCATION_SIZE, oldAllocationSize, allocationSize));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Unique Constraints</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Unique Constraints</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Unique Constraints</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTableGenerator_UniqueConstraints()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<UniqueConstraint> getUniqueConstraints()
+ {
+ if (uniqueConstraints == null)
+ {
+ uniqueConstraints = new EObjectContainmentEList<UniqueConstraint>(UniqueConstraint.class, this, OrmPackage.TABLE_GENERATOR_IMPL__UNIQUE_CONSTRAINTS);
+ }
+ return uniqueConstraints;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TABLE_GENERATOR_IMPL__UNIQUE_CONSTRAINTS:
+ return ((InternalEList<?>)getUniqueConstraints()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TABLE_GENERATOR_IMPL__NAME:
+ return getName();
+ case OrmPackage.TABLE_GENERATOR_IMPL__INITIAL_VALUE:
+ return getInitialValue();
+ case OrmPackage.TABLE_GENERATOR_IMPL__ALLOCATION_SIZE:
+ return getAllocationSize();
+ case OrmPackage.TABLE_GENERATOR_IMPL__TABLE:
+ return getTable();
+ case OrmPackage.TABLE_GENERATOR_IMPL__CATALOG:
+ return getCatalog();
+ case OrmPackage.TABLE_GENERATOR_IMPL__SCHEMA:
+ return getSchema();
+ case OrmPackage.TABLE_GENERATOR_IMPL__PK_COLUMN_NAME:
+ return getPkColumnName();
+ case OrmPackage.TABLE_GENERATOR_IMPL__VALUE_COLUMN_NAME:
+ return getValueColumnName();
+ case OrmPackage.TABLE_GENERATOR_IMPL__PK_COLUMN_VALUE:
+ return getPkColumnValue();
+ case OrmPackage.TABLE_GENERATOR_IMPL__UNIQUE_CONSTRAINTS:
+ return getUniqueConstraints();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TABLE_GENERATOR_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__INITIAL_VALUE:
+ setInitialValue((Integer)newValue);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__ALLOCATION_SIZE:
+ setAllocationSize((Integer)newValue);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__TABLE:
+ setTable((String)newValue);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__CATALOG:
+ setCatalog((String)newValue);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__SCHEMA:
+ setSchema((String)newValue);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__PK_COLUMN_NAME:
+ setPkColumnName((String)newValue);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__VALUE_COLUMN_NAME:
+ setValueColumnName((String)newValue);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__PK_COLUMN_VALUE:
+ setPkColumnValue((String)newValue);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__UNIQUE_CONSTRAINTS:
+ getUniqueConstraints().clear();
+ getUniqueConstraints().addAll((Collection<? extends UniqueConstraint>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TABLE_GENERATOR_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__INITIAL_VALUE:
+ setInitialValue(INITIAL_VALUE_EDEFAULT);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__ALLOCATION_SIZE:
+ setAllocationSize(ALLOCATION_SIZE_EDEFAULT);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__TABLE:
+ setTable(TABLE_EDEFAULT);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__CATALOG:
+ setCatalog(CATALOG_EDEFAULT);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__SCHEMA:
+ setSchema(SCHEMA_EDEFAULT);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__PK_COLUMN_NAME:
+ setPkColumnName(PK_COLUMN_NAME_EDEFAULT);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__VALUE_COLUMN_NAME:
+ setValueColumnName(VALUE_COLUMN_NAME_EDEFAULT);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__PK_COLUMN_VALUE:
+ setPkColumnValue(PK_COLUMN_VALUE_EDEFAULT);
+ return;
+ case OrmPackage.TABLE_GENERATOR_IMPL__UNIQUE_CONSTRAINTS:
+ getUniqueConstraints().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TABLE_GENERATOR_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.TABLE_GENERATOR_IMPL__INITIAL_VALUE:
+ return INITIAL_VALUE_EDEFAULT == null ? initialValue != null : !INITIAL_VALUE_EDEFAULT.equals(initialValue);
+ case OrmPackage.TABLE_GENERATOR_IMPL__ALLOCATION_SIZE:
+ return ALLOCATION_SIZE_EDEFAULT == null ? allocationSize != null : !ALLOCATION_SIZE_EDEFAULT.equals(allocationSize);
+ case OrmPackage.TABLE_GENERATOR_IMPL__TABLE:
+ return TABLE_EDEFAULT == null ? table != null : !TABLE_EDEFAULT.equals(table);
+ case OrmPackage.TABLE_GENERATOR_IMPL__CATALOG:
+ return CATALOG_EDEFAULT == null ? catalog != null : !CATALOG_EDEFAULT.equals(catalog);
+ case OrmPackage.TABLE_GENERATOR_IMPL__SCHEMA:
+ return SCHEMA_EDEFAULT == null ? schema != null : !SCHEMA_EDEFAULT.equals(schema);
+ case OrmPackage.TABLE_GENERATOR_IMPL__PK_COLUMN_NAME:
+ return PK_COLUMN_NAME_EDEFAULT == null ? pkColumnName != null : !PK_COLUMN_NAME_EDEFAULT.equals(pkColumnName);
+ case OrmPackage.TABLE_GENERATOR_IMPL__VALUE_COLUMN_NAME:
+ return VALUE_COLUMN_NAME_EDEFAULT == null ? valueColumnName != null : !VALUE_COLUMN_NAME_EDEFAULT.equals(valueColumnName);
+ case OrmPackage.TABLE_GENERATOR_IMPL__PK_COLUMN_VALUE:
+ return PK_COLUMN_VALUE_EDEFAULT == null ? pkColumnValue != null : !PK_COLUMN_VALUE_EDEFAULT.equals(pkColumnValue);
+ case OrmPackage.TABLE_GENERATOR_IMPL__UNIQUE_CONSTRAINTS:
+ return uniqueConstraints != null && !uniqueConstraints.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", initialValue: ");
+ result.append(initialValue);
+ result.append(", allocationSize: ");
+ result.append(allocationSize);
+ result.append(", table: ");
+ result.append(table);
+ result.append(", catalog: ");
+ result.append(catalog);
+ result.append(", schema: ");
+ result.append(schema);
+ result.append(", pkColumnName: ");
+ result.append(pkColumnName);
+ result.append(", valueColumnName: ");
+ result.append(valueColumnName);
+ result.append(", pkColumnValue: ");
+ result.append(pkColumnValue);
+ result.append(')');
+ return result.toString();
+ }
+
+} // TableGenerator
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/TemporalType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TemporalType.java
index 2d7cd326de..c3e72596b1 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/TemporalType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TemporalType.java
@@ -1,39 +1,31 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 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.
+ * Copyright (c) 2007 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.mappings;
+package org.eclipse.jpt.core.internal.resource.orm;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.eclipse.emf.common.util.Enumerator;
-import org.eclipse.jpt.core.internal.content.java.mappings.JPA;
/**
* <!-- begin-user-doc -->
* A representation of the literals of the enumeration '<em><b>Temporal Type</b></em>',
* and utility methods for working with them.
* <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getTemporalType()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTemporalType()
* @model
* @generated
*/
-public enum TemporalType implements Enumerator {
+public enum TemporalType implements Enumerator
+{
/**
- * The '<em><b>Null</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #NULL_VALUE
- * @generated
- * @ordered
- */
- NULL(0, "Null", ""), /**
* The '<em><b>DATE</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -41,7 +33,9 @@ public enum TemporalType implements Enumerator {
* @generated
* @ordered
*/
- DATE(1, "DATE", "Date"), /**
+ DATE(0, "DATE", "DATE"),
+
+ /**
* The '<em><b>TIME</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -49,7 +43,9 @@ public enum TemporalType implements Enumerator {
* @generated
* @ordered
*/
- TIME(2, "TIME", "Time"), /**
+ TIME(1, "TIME", "TIME"),
+
+ /**
* The '<em><b>TIMESTAMP</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -57,21 +53,7 @@ public enum TemporalType implements Enumerator {
* @generated
* @ordered
*/
- TIMESTAMP(3, "TIMESTAMP", "Timestamp");
- /**
- * The '<em><b>Null</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>Null</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #NULL
- * @model name="Null" literal=""
- * @generated
- * @ordered
- */
- public static final int NULL_VALUE = 0;
+ TIMESTAMP(2, "TIMESTAMP", "TIMESTAMP");
/**
* The '<em><b>DATE</b></em>' literal value.
@@ -82,11 +64,11 @@ public enum TemporalType implements Enumerator {
* </p>
* <!-- end-user-doc -->
* @see #DATE
- * @model literal="Date"
+ * @model
* @generated
* @ordered
*/
- public static final int DATE_VALUE = 1;
+ public static final int DATE_VALUE = 0;
/**
* The '<em><b>TIME</b></em>' literal value.
@@ -97,11 +79,11 @@ public enum TemporalType implements Enumerator {
* </p>
* <!-- end-user-doc -->
* @see #TIME
- * @model literal="Time"
+ * @model
* @generated
* @ordered
*/
- public static final int TIME_VALUE = 2;
+ public static final int TIME_VALUE = 1;
/**
* The '<em><b>TIMESTAMP</b></em>' literal value.
@@ -112,11 +94,11 @@ public enum TemporalType implements Enumerator {
* </p>
* <!-- end-user-doc -->
* @see #TIMESTAMP
- * @model literal="Timestamp"
+ * @model
* @generated
* @ordered
*/
- public static final int TIMESTAMP_VALUE = 3;
+ public static final int TIMESTAMP_VALUE = 2;
/**
* An array of all the '<em><b>Temporal Type</b></em>' enumerators.
@@ -124,9 +106,13 @@ public enum TemporalType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- private static final TemporalType[] VALUES_ARRAY = new TemporalType[] {
- NULL, DATE, TIME, TIMESTAMP,
- };
+ private static final TemporalType[] VALUES_ARRAY =
+ new TemporalType[]
+ {
+ DATE,
+ TIME,
+ TIMESTAMP,
+ };
/**
* A public read-only list of all the '<em><b>Temporal Type</b></em>' enumerators.
@@ -142,10 +128,13 @@ public enum TemporalType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static TemporalType get(String literal) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ public static TemporalType get(String literal)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
TemporalType result = VALUES_ARRAY[i];
- if (result.toString().equals(literal)) {
+ if (result.toString().equals(literal))
+ {
return result;
}
}
@@ -158,10 +147,13 @@ public enum TemporalType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static TemporalType getByName(String name) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ public static TemporalType getByName(String name)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
TemporalType result = VALUES_ARRAY[i];
- if (result.getName().equals(name)) {
+ if (result.getName().equals(name))
+ {
return result;
}
}
@@ -174,16 +166,13 @@ public enum TemporalType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public static TemporalType get(int value) {
- switch (value) {
- case NULL_VALUE :
- return NULL;
- case DATE_VALUE :
- return DATE;
- case TIME_VALUE :
- return TIME;
- case TIMESTAMP_VALUE :
- return TIMESTAMP;
+ public static TemporalType get(int value)
+ {
+ switch (value)
+ {
+ case DATE_VALUE: return DATE;
+ case TIME_VALUE: return TIME;
+ case TIMESTAMP_VALUE: return TIMESTAMP;
}
return null;
}
@@ -215,7 +204,8 @@ public enum TemporalType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- private TemporalType(int value, String name, String literal) {
+ private TemporalType(int value, String name, String literal)
+ {
this.value = value;
this.name = name;
this.literal = literal;
@@ -226,8 +216,9 @@ public enum TemporalType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public int getValue() {
- return value;
+ public int getValue()
+ {
+ return value;
}
/**
@@ -235,8 +226,9 @@ public enum TemporalType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public String getName() {
- return name;
+ public String getName()
+ {
+ return name;
}
/**
@@ -244,8 +236,9 @@ public enum TemporalType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public String getLiteral() {
- return literal;
+ public String getLiteral()
+ {
+ return literal;
}
/**
@@ -255,38 +248,9 @@ public enum TemporalType implements Enumerator {
* @generated
*/
@Override
- public String toString() {
+ public String toString()
+ {
return literal;
}
-
- public static TemporalType fromJavaAnnotationValue(Object javaAnnotationValue) {
- if (javaAnnotationValue == null) {
- return NULL;
- }
- if (javaAnnotationValue.equals(JPA.TEMPORAL_TYPE__DATE)) {
- return DATE;
- }
- if (javaAnnotationValue.equals(JPA.TEMPORAL_TYPE__TIME)) {
- return TIME;
- }
- if (javaAnnotationValue.equals(JPA.TEMPORAL_TYPE__TIMESTAMP)) {
- return TIMESTAMP;
- }
- return NULL;
- }
-
- public String convertToJavaAnnotationValue() {
- switch (this.getValue()) {
- case NULL_VALUE :
- return null;
- case DATE_VALUE :
- return JPA.TEMPORAL_TYPE__DATE;
- case TIME_VALUE :
- return JPA.TEMPORAL_TYPE__TIME;
- case TIMESTAMP_VALUE :
- return JPA.TEMPORAL_TYPE__TIMESTAMP;
- default :
- throw new IllegalArgumentException("unknown temporal type: " + this);
- }
- }
-}
+
+} //TemporalType
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITransient.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Transient.java
index 8024da8f27..73fd7e8cac 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/ITransient.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Transient.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -7,19 +7,19 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.mappings;
+package org.eclipse.jpt.core.internal.resource.orm;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
/**
* <!-- begin-user-doc -->
- * A representation of the model object '<em><b>ITransient</b></em>'.
+ * A representation of the model object '<em><b>Transient</b></em>'.
* <!-- end-user-doc -->
*
*
- * @see org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage#getITransient()
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTransient()
* @model kind="class" interface="true" abstract="true"
* @generated
*/
-public interface ITransient extends IAttributeMapping
-{} // ITransient
+public interface Transient extends AttributeMapping
+{
+} // Transient
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TransientImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TransientImpl.java
new file mode 100644
index 0000000000..1bd58a8d57
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TransientImpl.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Transient</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTransientImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class TransientImpl extends JpaEObject implements Transient
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TransientImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.TRANSIENT_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeMapping_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TransientImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TRANSIENT_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TRANSIENT_IMPL__NAME:
+ return getName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TRANSIENT_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TRANSIENT_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TRANSIENT_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+} // Transient
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TypeMapping.java
new file mode 100644
index 0000000000..97b9df136e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/TypeMapping.java
@@ -0,0 +1,498 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Type Mapping</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getClassName <em>Class Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getAccess <em>Access</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getMetadataComplete <em>Metadata Complete</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getDescription <em>Description</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getAttributes <em>Attributes</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTypeMapping()
+ * @model kind="class" abstract="true"
+ * @extends IJpaEObject
+ * @generated
+ */
+public abstract class TypeMapping extends JpaEObject implements IJpaEObject
+{
+ /**
+ * The default value of the '{@link #getClassName() <em>Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getClassName()
+ * @generated
+ * @ordered
+ */
+ protected static final String CLASS_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getClassName() <em>Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getClassName()
+ * @generated
+ * @ordered
+ */
+ protected String className = CLASS_NAME_EDEFAULT;
+
+ /**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final AccessType ACCESS_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getAccess() <em>Access</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAccess()
+ * @generated
+ * @ordered
+ */
+ protected AccessType access = ACCESS_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getMetadataComplete() <em>Metadata Complete</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMetadataComplete()
+ * @generated
+ * @ordered
+ */
+ protected static final Boolean METADATA_COMPLETE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getMetadataComplete() <em>Metadata Complete</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMetadataComplete()
+ * @generated
+ * @ordered
+ */
+ protected Boolean metadataComplete = METADATA_COMPLETE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDescription()
+ * @generated
+ * @ordered
+ */
+ protected static final String DESCRIPTION_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDescription()
+ * @generated
+ * @ordered
+ */
+ protected String description = DESCRIPTION_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getAttributes() <em>Attributes</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAttributes()
+ * @generated
+ * @ordered
+ */
+ protected Attributes attributes;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TypeMapping()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.TYPE_MAPPING;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Class Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Class Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Class Name</em>' attribute.
+ * @see #setClassName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTypeMapping_ClassName()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getClassName()
+ {
+ return className;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getClassName <em>Class Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Class Name</em>' attribute.
+ * @see #getClassName()
+ * @generated
+ */
+ public void setClassName(String newClassName)
+ {
+ String oldClassName = className;
+ className = newClassName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TYPE_MAPPING__CLASS_NAME, oldClassName, className));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Access</b></em>' attribute.
+ * The default value is <code>"PROPERTY"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.AccessType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Access</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Access</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AccessType
+ * @see #setAccess(AccessType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTypeMapping_Access()
+ * @model default="PROPERTY"
+ * @generated
+ */
+ public AccessType getAccess()
+ {
+ return access;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getAccess <em>Access</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Access</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AccessType
+ * @see #getAccess()
+ * @generated
+ */
+ public void setAccess(AccessType newAccess)
+ {
+ AccessType oldAccess = access;
+ access = newAccess == null ? ACCESS_EDEFAULT : newAccess;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TYPE_MAPPING__ACCESS, oldAccess, access));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Metadata Complete</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Metadata Complete</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Metadata Complete</em>' attribute.
+ * @see #setMetadataComplete(Boolean)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTypeMapping_MetadataComplete()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.BooleanObject"
+ * @generated
+ */
+ public Boolean getMetadataComplete()
+ {
+ return metadataComplete;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getMetadataComplete <em>Metadata Complete</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Metadata Complete</em>' attribute.
+ * @see #getMetadataComplete()
+ * @generated
+ */
+ public void setMetadataComplete(Boolean newMetadataComplete)
+ {
+ Boolean oldMetadataComplete = metadataComplete;
+ metadataComplete = newMetadataComplete;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TYPE_MAPPING__METADATA_COMPLETE, oldMetadataComplete, metadataComplete));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Description</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Description</em>' attribute.
+ * @see #setDescription(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTypeMapping_Description()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * @generated
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getDescription <em>Description</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Description</em>' attribute.
+ * @see #getDescription()
+ * @generated
+ */
+ public void setDescription(String newDescription)
+ {
+ String oldDescription = description;
+ description = newDescription;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TYPE_MAPPING__DESCRIPTION, oldDescription, description));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Attributes</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Attributes</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Attributes</em>' containment reference.
+ * @see #setAttributes(Attributes)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getTypeMapping_Attributes()
+ * @model containment="true"
+ * @generated
+ */
+ public Attributes getAttributes()
+ {
+ return attributes;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetAttributes(Attributes newAttributes, NotificationChain msgs)
+ {
+ Attributes oldAttributes = attributes;
+ attributes = newAttributes;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.TYPE_MAPPING__ATTRIBUTES, oldAttributes, newAttributes);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping#getAttributes <em>Attributes</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Attributes</em>' containment reference.
+ * @see #getAttributes()
+ * @generated
+ */
+ public void setAttributes(Attributes newAttributes)
+ {
+ if (newAttributes != attributes)
+ {
+ NotificationChain msgs = null;
+ if (attributes != null)
+ msgs = ((InternalEObject)attributes).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.TYPE_MAPPING__ATTRIBUTES, null, msgs);
+ if (newAttributes != null)
+ msgs = ((InternalEObject)newAttributes).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.TYPE_MAPPING__ATTRIBUTES, null, msgs);
+ msgs = basicSetAttributes(newAttributes, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.TYPE_MAPPING__ATTRIBUTES, newAttributes, newAttributes));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TYPE_MAPPING__ATTRIBUTES:
+ return basicSetAttributes(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TYPE_MAPPING__CLASS_NAME:
+ return getClassName();
+ case OrmPackage.TYPE_MAPPING__ACCESS:
+ return getAccess();
+ case OrmPackage.TYPE_MAPPING__METADATA_COMPLETE:
+ return getMetadataComplete();
+ case OrmPackage.TYPE_MAPPING__DESCRIPTION:
+ return getDescription();
+ case OrmPackage.TYPE_MAPPING__ATTRIBUTES:
+ return getAttributes();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TYPE_MAPPING__CLASS_NAME:
+ setClassName((String)newValue);
+ return;
+ case OrmPackage.TYPE_MAPPING__ACCESS:
+ setAccess((AccessType)newValue);
+ return;
+ case OrmPackage.TYPE_MAPPING__METADATA_COMPLETE:
+ setMetadataComplete((Boolean)newValue);
+ return;
+ case OrmPackage.TYPE_MAPPING__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ case OrmPackage.TYPE_MAPPING__ATTRIBUTES:
+ setAttributes((Attributes)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TYPE_MAPPING__CLASS_NAME:
+ setClassName(CLASS_NAME_EDEFAULT);
+ return;
+ case OrmPackage.TYPE_MAPPING__ACCESS:
+ setAccess(ACCESS_EDEFAULT);
+ return;
+ case OrmPackage.TYPE_MAPPING__METADATA_COMPLETE:
+ setMetadataComplete(METADATA_COMPLETE_EDEFAULT);
+ return;
+ case OrmPackage.TYPE_MAPPING__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ case OrmPackage.TYPE_MAPPING__ATTRIBUTES:
+ setAttributes((Attributes)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.TYPE_MAPPING__CLASS_NAME:
+ return CLASS_NAME_EDEFAULT == null ? className != null : !CLASS_NAME_EDEFAULT.equals(className);
+ case OrmPackage.TYPE_MAPPING__ACCESS:
+ return access != ACCESS_EDEFAULT;
+ case OrmPackage.TYPE_MAPPING__METADATA_COMPLETE:
+ return METADATA_COMPLETE_EDEFAULT == null ? metadataComplete != null : !METADATA_COMPLETE_EDEFAULT.equals(metadataComplete);
+ case OrmPackage.TYPE_MAPPING__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ case OrmPackage.TYPE_MAPPING__ATTRIBUTES:
+ return attributes != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (className: ");
+ result.append(className);
+ result.append(", access: ");
+ result.append(access);
+ result.append(", metadataComplete: ");
+ result.append(metadataComplete);
+ result.append(", description: ");
+ result.append(description);
+ result.append(')');
+ return result.toString();
+ }
+
+} // TypeMapping
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/UniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/UniqueConstraint.java
new file mode 100644
index 0000000000..ec4a1e19cb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/UniqueConstraint.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import java.util.Collection;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.util.EDataTypeEList;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Unique Constraint</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint#getColumnNames <em>Column Names</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getUniqueConstraint()
+ * @model kind="class"
+ * @extends IJpaEObject
+ * @generated
+ */
+public class UniqueConstraint extends JpaEObject implements IJpaEObject
+{
+ /**
+ * The cached value of the '{@link #getColumnNames() <em>Column Names</em>}' attribute list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumnNames()
+ * @generated
+ * @ordered
+ */
+ protected EList<String> columnNames;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected UniqueConstraint()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.UNIQUE_CONSTRAINT;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Column Names</b></em>' attribute list.
+ * The list contents are of type {@link java.lang.String}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Column Names</em>' attribute list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Column Names</em>' attribute list.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getUniqueConstraint_ColumnNames()
+ * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public EList<String> getColumnNames()
+ {
+ if (columnNames == null)
+ {
+ columnNames = new EDataTypeEList<String>(String.class, this, OrmPackage.UNIQUE_CONSTRAINT__COLUMN_NAMES);
+ }
+ return columnNames;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.UNIQUE_CONSTRAINT__COLUMN_NAMES:
+ return getColumnNames();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.UNIQUE_CONSTRAINT__COLUMN_NAMES:
+ getColumnNames().clear();
+ getColumnNames().addAll((Collection<? extends String>)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.UNIQUE_CONSTRAINT__COLUMN_NAMES:
+ getColumnNames().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.UNIQUE_CONSTRAINT__COLUMN_NAMES:
+ return columnNames != null && !columnNames.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (columnNames: ");
+ result.append(columnNames);
+ result.append(')');
+ return result.toString();
+ }
+
+} // UniqueConstraint
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Version.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Version.java
new file mode 100644
index 0000000000..4c7a8988fc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/Version.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.resource.orm;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Version</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.orm.Version#getTemporal <em>Temporal</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getVersion()
+ * @model kind="class" interface="true" abstract="true"
+ * @generated
+ */
+public interface Version extends AttributeMapping, ColumnMapping
+{
+ /**
+ * Returns the value of the '<em><b>Temporal</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.TemporalType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Temporal</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Temporal</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TemporalType
+ * @see #setTemporal(TemporalType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getVersion_Temporal()
+ * @model
+ * @generated
+ */
+ TemporalType getTemporal();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.Version#getTemporal <em>Temporal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Temporal</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TemporalType
+ * @see #getTemporal()
+ * @generated
+ */
+ void setTemporal(TemporalType value);
+
+} // Version
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VersionImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VersionImpl.java
new file mode 100644
index 0000000000..391371fac1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VersionImpl.java
@@ -0,0 +1,390 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Version</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getVersionImpl()
+ * @model kind="class"
+ * @generated
+ */
+public class VersionImpl extends JpaEObject implements Version
+{
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getColumn() <em>Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getColumn()
+ * @generated
+ * @ordered
+ */
+ protected Column column;
+
+ /**
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
+ */
+ protected static final TemporalType TEMPORAL_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTemporal() <em>Temporal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTemporal()
+ * @generated
+ * @ordered
+ */
+ protected TemporalType temporal = TEMPORAL_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected VersionImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return OrmPackage.Literals.VERSION_IMPL;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getAttributeMapping_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.VersionImpl#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.VERSION_IMPL__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Column</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Column</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Column</em>' containment reference.
+ * @see #setColumn(Column)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getColumnMapping_Column()
+ * @model containment="true"
+ * @generated
+ */
+ public Column getColumn()
+ {
+ return column;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetColumn(Column newColumn, NotificationChain msgs)
+ {
+ Column oldColumn = column;
+ column = newColumn;
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OrmPackage.VERSION_IMPL__COLUMN, oldColumn, newColumn);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.VersionImpl#getColumn <em>Column</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Column</em>' containment reference.
+ * @see #getColumn()
+ * @generated
+ */
+ public void setColumn(Column newColumn)
+ {
+ if (newColumn != column)
+ {
+ NotificationChain msgs = null;
+ if (column != null)
+ msgs = ((InternalEObject)column).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OrmPackage.VERSION_IMPL__COLUMN, null, msgs);
+ if (newColumn != null)
+ msgs = ((InternalEObject)newColumn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OrmPackage.VERSION_IMPL__COLUMN, null, msgs);
+ msgs = basicSetColumn(newColumn, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.VERSION_IMPL__COLUMN, newColumn, newColumn));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Temporal</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.orm.TemporalType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Temporal</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Temporal</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TemporalType
+ * @see #setTemporal(TemporalType)
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage#getVersion_Temporal()
+ * @model
+ * @generated
+ */
+ public TemporalType getTemporal()
+ {
+ return temporal;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.orm.VersionImpl#getTemporal <em>Temporal</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Temporal</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TemporalType
+ * @see #getTemporal()
+ * @generated
+ */
+ public void setTemporal(TemporalType newTemporal)
+ {
+ TemporalType oldTemporal = temporal;
+ temporal = newTemporal == null ? TEMPORAL_EDEFAULT : newTemporal;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, OrmPackage.VERSION_IMPL__TEMPORAL, oldTemporal, temporal));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.VERSION_IMPL__COLUMN:
+ return basicSetColumn(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.VERSION_IMPL__NAME:
+ return getName();
+ case OrmPackage.VERSION_IMPL__COLUMN:
+ return getColumn();
+ case OrmPackage.VERSION_IMPL__TEMPORAL:
+ return getTemporal();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.VERSION_IMPL__NAME:
+ setName((String)newValue);
+ return;
+ case OrmPackage.VERSION_IMPL__COLUMN:
+ setColumn((Column)newValue);
+ return;
+ case OrmPackage.VERSION_IMPL__TEMPORAL:
+ setTemporal((TemporalType)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.VERSION_IMPL__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case OrmPackage.VERSION_IMPL__COLUMN:
+ setColumn((Column)null);
+ return;
+ case OrmPackage.VERSION_IMPL__TEMPORAL:
+ setTemporal(TEMPORAL_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case OrmPackage.VERSION_IMPL__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case OrmPackage.VERSION_IMPL__COLUMN:
+ return column != null;
+ case OrmPackage.VERSION_IMPL__TEMPORAL:
+ return temporal != TEMPORAL_EDEFAULT;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == ColumnMapping.class)
+ {
+ switch (derivedFeatureID)
+ {
+ case OrmPackage.VERSION_IMPL__COLUMN: return OrmPackage.COLUMN_MAPPING__COLUMN;
+ default: return -1;
+ }
+ }
+ return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass)
+ {
+ if (baseClass == ColumnMapping.class)
+ {
+ switch (baseFeatureID)
+ {
+ case OrmPackage.COLUMN_MAPPING__COLUMN: return OrmPackage.VERSION_IMPL__COLUMN;
+ default: return -1;
+ }
+ }
+ return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (name: ");
+ result.append(name);
+ result.append(", temporal: ");
+ result.append(temporal);
+ result.append(')');
+ return result.toString();
+ }
+
+} // Version
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualAttributeOverride.java
new file mode 100644
index 0000000000..26986f20ed
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualAttributeOverride.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.context.java.IJavaAttributeOverride;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+public class VirtualAttributeOverride extends JpaEObject implements AttributeOverride
+{
+
+ protected IJavaAttributeOverride javaAttributeOverride;
+
+ protected final VirtualColumn column;
+
+ protected boolean metadataComplete;
+
+ protected VirtualAttributeOverride(IJavaAttributeOverride javaAttributeOverride, boolean metadataComplete) {
+ super();
+ this.javaAttributeOverride = javaAttributeOverride;
+ this.metadataComplete = metadataComplete;
+ this.column = new VirtualColumn(javaAttributeOverride.getColumn(), metadataComplete);
+ }
+
+
+ public String getName() {
+ if (this.metadataComplete) {
+ return null;//TODO is this right??
+ }
+ return this.javaAttributeOverride.getName();
+ }
+
+ public void setName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+
+ public Column getColumn() {
+ return this.column;
+ }
+
+ public void setColumn(Column value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public void update(IJavaAttributeOverride javaAttributeOverride) {
+ this.javaAttributeOverride = javaAttributeOverride;
+ this.column.update(javaAttributeOverride.getColumn());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualBasic.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualBasic.java
new file mode 100644
index 0000000000..575c94c858
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualBasic.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.context.java.IJavaBasicMapping;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+import org.eclipse.jpt.core.internal.resource.orm.EnumType;
+import org.eclipse.jpt.core.internal.resource.orm.FetchType;
+import org.eclipse.jpt.core.internal.resource.orm.TemporalType;
+
+/**
+ * VirtualBasic is an implementation of Basic used when there is
+ * no tag in the orm.xml and an underlying javaBasicMapping exists.
+ */
+public class VirtualBasic extends JpaEObject implements Basic
+{
+ IJavaBasicMapping javaBasicMapping;
+
+ protected final VirtualColumn column;
+
+ protected boolean metadataComplete;
+
+ public VirtualBasic(IJavaBasicMapping javaBasicMapping, boolean metadataComplete) {
+ super();
+ this.javaBasicMapping = javaBasicMapping;
+ this.metadataComplete = metadataComplete;
+ this.column = new VirtualColumn(javaBasicMapping.getColumn(), metadataComplete);
+ }
+
+ public String getName() {
+ return this.javaBasicMapping.persistentAttribute().getName();
+ }
+
+ public void setName(String newName) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Column getColumn() {
+ return this.column;
+ }
+
+ public void setColumn(Column value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public FetchType getFetch() {
+ if (this.metadataComplete) {
+ return org.eclipse.jpt.core.internal.context.base.FetchType.toOrmResourceModel(this.javaBasicMapping.getDefaultFetch());
+ }
+ return org.eclipse.jpt.core.internal.context.base.FetchType.toOrmResourceModel(this.javaBasicMapping.getFetch());
+ }
+
+ public void setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType newFetch) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Boolean getOptional() {
+ if (this.metadataComplete) {
+ return this.javaBasicMapping.getDefaultOptional();
+ }
+ return this.javaBasicMapping.getOptional();
+ }
+
+ public void setOptional(Boolean newOptional) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public boolean isLob() {
+ if (this.metadataComplete) {
+ return false;
+ }
+ return this.javaBasicMapping.isLob();
+ }
+
+ public void setLob(boolean newLob) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public TemporalType getTemporal() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return org.eclipse.jpt.core.internal.context.base.TemporalType.toOrmResourceModel(this.javaBasicMapping.getTemporal());
+ }
+
+ public void setTemporal(TemporalType newTemporal){
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public EnumType getEnumerated() {
+ if (this.metadataComplete) {
+ return org.eclipse.jpt.core.internal.context.base.EnumType.toOrmResourceModel(this.javaBasicMapping.getDefaultEnumerated());
+ }
+ return org.eclipse.jpt.core.internal.context.base.EnumType.toOrmResourceModel(this.javaBasicMapping.getEnumerated());
+ }
+
+ public void setEnumerated(EnumType newEnumerated) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+
+ public void update(IJavaBasicMapping javaBasicMapping) {
+ this.javaBasicMapping = javaBasicMapping;
+ this.column.update(javaBasicMapping.getColumn());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualCascadeType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualCascadeType.java
new file mode 100644
index 0000000000..75f805767d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualCascadeType.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.context.base.ICascade;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+public class VirtualCascadeType extends JpaEObject implements CascadeType
+{
+ ICascade javaCascade;
+
+ protected boolean metadataComplete;
+
+ public VirtualCascadeType(ICascade javaCascade, boolean metadataComplete) {
+ super();
+ this.javaCascade = javaCascade;
+ this.metadataComplete = metadataComplete;
+ }
+
+ public void update(ICascade javaCascade) {
+ this.javaCascade = javaCascade;
+ }
+
+ public boolean isCascadeAll() {
+ if (this.metadataComplete) {
+ return false;
+ }
+ return this.javaCascade.isAll();
+ }
+
+ public void setCascadeAll(boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public boolean isCascadeMerge() {
+ if (this.metadataComplete) {
+ return false;
+ }
+ return this.javaCascade.isMerge();
+ }
+
+ public void setCascadeMerge(boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public boolean isCascadePersist() {
+ if (this.metadataComplete) {
+ return false;
+ }
+ return this.javaCascade.isPersist();
+ }
+
+ public void setCascadePersist(boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public boolean isCascadeRefresh() {
+ if (this.metadataComplete) {
+ return false;
+ }
+ return this.javaCascade.isRefresh();
+ }
+
+ public void setCascadeRefresh(boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public boolean isCascadeRemove() {
+ if (this.metadataComplete) {
+ return false;
+ }
+ return this.javaCascade.isRemove();
+ }
+
+ public void setCascadeRemove(boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualColumn.java
new file mode 100644
index 0000000000..3c06763bc5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualColumn.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.context.java.IJavaColumn;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+public class VirtualColumn extends JpaEObject implements Column
+{
+
+ protected IJavaColumn javaColumn;
+
+ protected boolean metadataComplete;
+
+ protected VirtualColumn(IJavaColumn javaColumn, boolean metadataComplete) {
+ super();
+ this.javaColumn = javaColumn;
+ this.metadataComplete = metadataComplete;
+ }
+
+ public String getColumnDefinition() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaColumn.getColumnDefinition();
+ }
+
+ public void setColumnDefinition(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Boolean getInsertable() {
+ if (this.metadataComplete) {
+ return this.javaColumn.getDefaultInsertable();
+ }
+ return this.javaColumn.getInsertable();
+ }
+
+ public void setInsertable(Boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Integer getLength() {
+ if (this.metadataComplete) {
+ return this.javaColumn.getDefaultLength();
+ }
+ return this.javaColumn.getLength();
+ }
+
+ public void setLength(Integer value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getName() {
+ if (this.metadataComplete) {
+ return this.javaColumn.getDefaultName();
+ }
+ return this.javaColumn.getName();
+ }
+
+ public void setName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Boolean getNullable() {
+ if (this.metadataComplete) {
+ return this.javaColumn.getDefaultNullable();
+ }
+ return this.javaColumn.getNullable();
+ }
+
+ public void setNullable(Boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Integer getPrecision() {
+ if (this.metadataComplete) {
+ return this.javaColumn.getDefaultPrecision();
+ }
+ return this.javaColumn.getPrecision();
+ }
+
+ public void setPrecision(Integer value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Integer getScale() {
+ if (this.metadataComplete) {
+ return this.javaColumn.getDefaultScale();
+ }
+ return this.javaColumn.getScale();
+ }
+
+ public void setScale(Integer value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getTable() {
+ if (this.metadataComplete) {
+ return this.javaColumn.getDefaultTable();
+ }
+ return this.javaColumn.getTable();
+ }
+
+ public void setTable(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Boolean getUnique() {
+ if (this.metadataComplete) {
+ return this.javaColumn.getDefaultUnique();
+ }
+ return this.javaColumn.getUnique();
+ }
+
+ public void setUnique(Boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Boolean getUpdatable() {
+ if (this.metadataComplete) {
+ return this.javaColumn.getDefaultUpdatable();
+ }
+ return this.javaColumn.getUpdatable();
+ }
+
+ public void setUpdatable(Boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public void update(IJavaColumn javaColumn) {
+ this.javaColumn = javaColumn;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualEmbedded.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualEmbedded.java
new file mode 100644
index 0000000000..79f575ab1f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualEmbedded.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import java.util.ListIterator;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.core.internal.context.java.IJavaAttributeOverride;
+import org.eclipse.jpt.core.internal.context.java.IJavaEmbeddedMapping;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * VirtualEmbedded is an implementation of Embedded used when there is
+ * no tag in the orm.xml and an underlying javaEmbeddedMapping exists.
+ */
+public class VirtualEmbedded extends JpaEObject implements Embedded
+{
+ IJavaEmbeddedMapping javaEmbeddedMapping;
+
+ protected boolean metadataComplete;
+
+ protected EList<AttributeOverride> virtualAttributeOverrides;
+
+
+ public VirtualEmbedded(IJavaEmbeddedMapping javaEmbeddedMapping, boolean metadataComplete) {
+ super();
+ this.javaEmbeddedMapping = javaEmbeddedMapping;
+ this.metadataComplete = metadataComplete;
+ this.initializeAttributeOverrides(javaEmbeddedMapping);
+ }
+
+ protected void initializeAttributeOverrides(IJavaEmbeddedMapping javaEmbeddedMapping) {
+ this.virtualAttributeOverrides = new BasicEList<AttributeOverride>();
+ ListIterator<IJavaAttributeOverride> javaAttributesOverrides;
+ if (this.metadataComplete) {
+ javaAttributesOverrides = this.javaEmbeddedMapping.defaultAttributeOverrides();
+ }
+ else {
+ javaAttributesOverrides = this.javaEmbeddedMapping.attributeOverrides();
+ }
+
+ while (javaAttributesOverrides.hasNext()) {
+ this.virtualAttributeOverrides.add(new VirtualAttributeOverride(javaAttributesOverrides.next(), this.metadataComplete));
+ }
+ }
+
+ public String getName() {
+ return this.javaEmbeddedMapping.persistentAttribute().getName();
+ }
+
+ public void setName(String newName) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+
+ public EList<AttributeOverride> getAttributeOverrides() {
+ return this.virtualAttributeOverrides;
+ }
+
+ public void update(IJavaEmbeddedMapping javaEmbeddedMapping) {
+ this.javaEmbeddedMapping = javaEmbeddedMapping;
+ this.updateAttributeOverrides(javaEmbeddedMapping);
+ }
+
+ protected void updateAttributeOverrides(IJavaEmbeddedMapping javaEmbeddedMapping) {
+ ListIterator<IJavaAttributeOverride> javaAttributesOverrides;
+ ListIterator<AttributeOverride> virtualAttributeOverrides = this.virtualAttributeOverrides.listIterator();
+ if (this.metadataComplete) {
+ javaAttributesOverrides = this.javaEmbeddedMapping.defaultAttributeOverrides();
+ }
+ else {
+ javaAttributesOverrides = this.javaEmbeddedMapping.attributeOverrides();
+ }
+
+ while (javaAttributesOverrides.hasNext()) {
+ IJavaAttributeOverride javaAttributeOverride = javaAttributesOverrides.next();
+ if (virtualAttributeOverrides.hasNext()) {
+ VirtualAttributeOverride virtualAttributeOverride = (VirtualAttributeOverride) virtualAttributeOverrides.next();
+ virtualAttributeOverride.update(javaAttributeOverride);
+ }
+ else {
+ this.virtualAttributeOverrides.add(new VirtualAttributeOverride(javaAttributeOverride, this.metadataComplete));
+ }
+ }
+
+ while(virtualAttributeOverrides.hasNext()) {
+ this.virtualAttributeOverrides.remove(virtualAttributeOverrides.next());
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualEmbeddedId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualEmbeddedId.java
new file mode 100644
index 0000000000..ee62a0c87f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualEmbeddedId.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import java.util.ListIterator;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.core.internal.context.java.IJavaAttributeOverride;
+import org.eclipse.jpt.core.internal.context.java.IJavaEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * VirtualEmbeddedId is an implementation of EmbeddedId used when there is
+ * no tag in the orm.xml and an underlying javaEmbeddedIdMapping exists.
+ */
+public class VirtualEmbeddedId extends JpaEObject implements EmbeddedId
+{
+ IJavaEmbeddedIdMapping javaEmbeddedIdMapping;
+
+ protected boolean metadataComplete;
+
+ protected EList<AttributeOverride> virtualAttributeOverrides;
+
+
+ public VirtualEmbeddedId(IJavaEmbeddedIdMapping javaEmbeddedIdMapping, boolean metadataComplete) {
+ super();
+ this.javaEmbeddedIdMapping = javaEmbeddedIdMapping;
+ this.metadataComplete = metadataComplete;
+ this.initializeAttributeOverrides(javaEmbeddedIdMapping);
+ }
+
+ protected void initializeAttributeOverrides(IJavaEmbeddedIdMapping javaEmbeddedIdMapping) {
+ this.virtualAttributeOverrides = new BasicEList<AttributeOverride>();
+ ListIterator<IJavaAttributeOverride> javaAttributesOverrides;
+ if (this.metadataComplete) {
+ javaAttributesOverrides = this.javaEmbeddedIdMapping.defaultAttributeOverrides();
+ }
+ else {
+ javaAttributesOverrides = this.javaEmbeddedIdMapping.attributeOverrides();
+ }
+
+ while (javaAttributesOverrides.hasNext()) {
+ this.virtualAttributeOverrides.add(new VirtualAttributeOverride(javaAttributesOverrides.next(), this.metadataComplete));
+ }
+ }
+
+ public String getName() {
+ return this.javaEmbeddedIdMapping.persistentAttribute().getName();
+ }
+
+ public void setName(String newName) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+
+ public EList<AttributeOverride> getAttributeOverrides() {
+ return this.virtualAttributeOverrides;
+ }
+
+ public void update(IJavaEmbeddedIdMapping javaEmbeddedIdMapping) {
+ this.javaEmbeddedIdMapping = javaEmbeddedIdMapping;
+ this.updateAttributeOverrides(javaEmbeddedIdMapping);
+ }
+
+ protected void updateAttributeOverrides(IJavaEmbeddedIdMapping javaEmbeddedIdMapping) {
+ ListIterator<IJavaAttributeOverride> javaAttributesOverrides;
+ ListIterator<AttributeOverride> virtualAttributeOverrides = this.virtualAttributeOverrides.listIterator();
+ if (this.metadataComplete) {
+ javaAttributesOverrides = this.javaEmbeddedIdMapping.defaultAttributeOverrides();
+ }
+ else {
+ javaAttributesOverrides = this.javaEmbeddedIdMapping.attributeOverrides();
+ }
+
+ while (javaAttributesOverrides.hasNext()) {
+ IJavaAttributeOverride javaAttributeOverride = javaAttributesOverrides.next();
+ if (virtualAttributeOverrides.hasNext()) {
+ VirtualAttributeOverride virtualAttributeOverride = (VirtualAttributeOverride) virtualAttributeOverrides.next();
+ virtualAttributeOverride.update(javaAttributeOverride);
+ }
+ else {
+ this.virtualAttributeOverrides.add(new VirtualAttributeOverride(javaAttributeOverride, this.metadataComplete));
+ }
+ }
+
+ while(virtualAttributeOverrides.hasNext()) {
+ this.virtualAttributeOverrides.remove(virtualAttributeOverrides.next());
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualGeneratedValue.java
new file mode 100644
index 0000000000..5da46542a7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualGeneratedValue.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.context.java.IJavaGeneratedValue;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+public class VirtualGeneratedValue extends JpaEObject implements GeneratedValue
+{
+ IJavaGeneratedValue javaGeneratedValue;
+
+ protected boolean metadataComplete;
+
+
+ public VirtualGeneratedValue(IJavaGeneratedValue javaGeneratedValue, boolean metadataComplete) {
+ super();
+ this.javaGeneratedValue = javaGeneratedValue;
+ this.metadataComplete = metadataComplete;
+ }
+
+
+ public String getGenerator() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaGeneratedValue.getGenerator();
+ }
+
+ public GenerationType getStrategy() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return org.eclipse.jpt.core.internal.context.base.GenerationType.toOrmResourceModel(this.javaGeneratedValue.getStrategy());
+ }
+
+ public void setGenerator(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public void setStrategy(GenerationType value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+
+
+ public void update(IJavaGeneratedValue javaGeneratedValue) {
+ this.javaGeneratedValue = javaGeneratedValue;
+ }
+
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualId.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualId.java
new file mode 100644
index 0000000000..2eac9b83da
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualId.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.context.java.IJavaIdMapping;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+import org.eclipse.jpt.core.internal.resource.orm.TemporalType;
+
+/**
+ * VirtualId is an implementation of Id used when there is
+ * no tag in the orm.xml and an underlying javaIdMapping exists.
+ */
+public class VirtualId extends JpaEObject implements Id
+{
+ IJavaIdMapping javaIdMapping;
+
+ protected boolean metadataComplete;
+
+ protected final VirtualColumn column;
+
+ protected final VirtualGeneratedValue virtualGeneratedValue;
+
+ protected final VirtualTableGenerator virtualTableGenerator;
+
+ protected final VirtualSequenceGenerator virtualSequenceGenerator;
+
+
+
+ public VirtualId(IJavaIdMapping javaIdMapping, boolean metadataComplete) {
+ super();
+ this.javaIdMapping = javaIdMapping;
+ this.metadataComplete = metadataComplete;
+ this.column = new VirtualColumn(javaIdMapping.getColumn(), metadataComplete);
+ this.virtualGeneratedValue = new VirtualGeneratedValue(javaIdMapping.getGeneratedValue(), metadataComplete);
+ this.virtualTableGenerator = new VirtualTableGenerator(javaIdMapping.getTableGenerator(), metadataComplete);
+ this.virtualSequenceGenerator = new VirtualSequenceGenerator(javaIdMapping.getSequenceGenerator(), metadataComplete);
+ }
+
+ public String getName() {
+ return this.javaIdMapping.persistentAttribute().getName();
+ }
+
+ public void setName(String newName) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Column getColumn() {
+ return this.column;
+ }
+
+ public void setColumn(Column value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public TemporalType getTemporal() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return org.eclipse.jpt.core.internal.context.base.TemporalType.toOrmResourceModel(this.javaIdMapping.getTemporal());
+ }
+
+ public void setTemporal(TemporalType newTemporal){
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+
+ public GeneratedValue getGeneratedValue() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ if (this.javaIdMapping.getGeneratedValue() != null) {
+ return this.virtualGeneratedValue;
+ }
+ return null;
+ }
+
+ public void setGeneratedValue(GeneratedValue value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public SequenceGenerator getSequenceGenerator() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ if (this.javaIdMapping.getSequenceGenerator() != null) {
+ return this.virtualSequenceGenerator;
+ }
+ return null;
+ }
+
+ public void setSequenceGenerator(SequenceGenerator value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public TableGenerator getTableGenerator() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ if (this.javaIdMapping.getTableGenerator() != null) {
+ return this.virtualTableGenerator;
+ }
+ return null;
+ }
+
+ public void setTableGenerator(TableGenerator value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+
+ public void update(IJavaIdMapping javaIdMapping) {
+ this.javaIdMapping = javaIdMapping;
+ this.column.update(javaIdMapping.getColumn());
+ this.virtualGeneratedValue.update(javaIdMapping.getGeneratedValue());
+ this.virtualTableGenerator.update(javaIdMapping.getTableGenerator());
+ this.virtualSequenceGenerator.update(javaIdMapping.getSequenceGenerator());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualJoinColumn.java
new file mode 100644
index 0000000000..8846997e87
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualJoinColumn.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.context.java.IJavaJoinColumn;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+public class VirtualJoinColumn extends JpaEObject implements JoinColumn
+{
+ protected IJavaJoinColumn javaJoinColumn;
+
+ protected boolean metadataComplete;
+
+ protected VirtualJoinColumn(IJavaJoinColumn javaJoinColumn, boolean metadataComplete) {
+ super();
+ this.javaJoinColumn = javaJoinColumn;
+ this.metadataComplete = metadataComplete;
+ }
+
+ public String getColumnDefinition() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaJoinColumn.getColumnDefinition();
+ }
+
+ public void setColumnDefinition(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Boolean getInsertable() {
+ if (this.metadataComplete) {
+ return this.javaJoinColumn.getDefaultInsertable();
+ }
+ return this.javaJoinColumn.getInsertable();
+ }
+
+ public void setInsertable(Boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getName() {
+ if (this.metadataComplete) {
+ return this.javaJoinColumn.getDefaultName();
+ }
+ return this.javaJoinColumn.getName();
+ }
+
+ public void setName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getReferencedColumnName() {
+ if (this.metadataComplete) {
+ return this.javaJoinColumn.getDefaultReferencedColumnName();
+ }
+ return this.javaJoinColumn.getReferencedColumnName();
+ }
+
+ public void setReferencedColumnName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Boolean getNullable() {
+ if (this.metadataComplete) {
+ return this.javaJoinColumn.getDefaultNullable();
+ }
+ return this.javaJoinColumn.getNullable();
+ }
+
+ public void setNullable(Boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getTable() {
+ if (this.metadataComplete) {
+ return this.javaJoinColumn.getDefaultTable();
+ }
+ return this.javaJoinColumn.getTable();
+ }
+
+ public void setTable(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Boolean getUnique() {
+ if (this.metadataComplete) {
+ return this.javaJoinColumn.getDefaultUnique();
+ }
+ return this.javaJoinColumn.getUnique();
+ }
+
+ public void setUnique(Boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Boolean getUpdatable() {
+ if (this.metadataComplete) {
+ return this.javaJoinColumn.getDefaultUpdatable();
+ }
+ return this.javaJoinColumn.getUpdatable();
+ }
+
+ public void setUpdatable(Boolean value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public void update(IJavaJoinColumn javaJoinColumn) {
+ this.javaJoinColumn = javaJoinColumn;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualJoinTable.java
new file mode 100644
index 0000000000..14b1596adc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualJoinTable.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.core.internal.context.java.IJavaJoinTable;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+public class VirtualJoinTable extends JpaEObject implements JoinTable
+{
+
+ protected IJavaJoinTable javaJoinTable;
+
+ protected boolean metadataComplete;
+
+ protected VirtualJoinTable(IJavaJoinTable javaJoinTable, boolean metadataComplete) {
+ super();
+ this.javaJoinTable = javaJoinTable;
+ this.metadataComplete = metadataComplete;
+ }
+
+ public EList<JoinColumn> getInverseJoinColumns() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public EList<JoinColumn> getJoinColumns() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getCatalog() {
+ if (this.metadataComplete) {
+ return this.javaJoinTable.getDefaultCatalog();
+ }
+ return this.javaJoinTable.getCatalog();
+ }
+
+ public void setCatalog(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getName() {
+ if (this.metadataComplete) {
+ return this.javaJoinTable.getDefaultName();
+ }
+ return this.javaJoinTable.getName();
+ }
+
+ public void setName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getSchema() {
+ if (this.metadataComplete) {
+ return this.javaJoinTable.getDefaultSchema();
+ }
+ return this.javaJoinTable.getSchema();
+ }
+
+ public void setSchema(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public EList<UniqueConstraint> getUniqueConstraints() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void update(IJavaJoinTable javaJoinTable) {
+ this.javaJoinTable = javaJoinTable;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualManyToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualManyToMany.java
new file mode 100644
index 0000000000..325d0a22be
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualManyToMany.java
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.core.internal.context.java.IJavaManyToManyMapping;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+import org.eclipse.jpt.core.internal.resource.orm.FetchType;
+
+/**
+ * VirtualManyToMany is an implementation of ManyToMany used when there is
+ * no tag in the orm.xml and an underlying javaManyToManyMapping exists.
+ */
+public class VirtualManyToMany extends JpaEObject implements ManyToMany
+{
+ IJavaManyToManyMapping javaManyToManyMapping;
+
+ protected boolean metadataComplete;
+
+ protected final VirtualJoinTable virtualJoinTable;
+
+ protected final VirtualCascadeType virtualCascadeType;
+
+ protected final MapKey mapKey;
+
+ //TODO joinColumns not yet supported in the context model
+// protected EList<JoinColumn> virtualJoinColumns;
+
+ public VirtualManyToMany(IJavaManyToManyMapping javaManyToManyMapping, boolean metadataComplete) {
+ super();
+ this.javaManyToManyMapping = javaManyToManyMapping;
+ this.metadataComplete = metadataComplete;
+// this.initializeJoinColumns(javaOneToManyMapping);
+ this.virtualCascadeType = new VirtualCascadeType(javaManyToManyMapping.getCascade(), this.metadataComplete);
+ this.virtualJoinTable = new VirtualJoinTable(javaManyToManyMapping.getJoinTable(), metadataComplete);
+ this.mapKey = new VirtualMapKey(javaManyToManyMapping, metadataComplete);
+ }
+
+// protected void initializeJoinColumns(IJavaOneToManyMapping javaOneToManyMapping) {
+// this.virtualJoinColumns = new BasicEList<JoinColumn>();
+// ListIterator<IJavaJoinColumn> javaJoinColumns;
+// if (this.metadataComplete) {
+// javaJoinColumns = this.javaOneToManyMapping.defaultJoinColumns();
+// }
+// else {
+// javaJoinColumns = this.javaOneToManyMapping.joinColumns();
+// }
+//
+// while (javaJoinColumns.hasNext()) {
+// this.virtualJoinColumns.add(new VirtualJoinColumn(javaJoinColumns.next(), this.metadataComplete));
+// }
+// }
+
+ public String getName() {
+ return this.javaManyToManyMapping.persistentAttribute().getName();
+ }
+
+ public void setName(String newName) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public FetchType getFetch() {
+ if (this.metadataComplete) {
+ return org.eclipse.jpt.core.internal.context.base.FetchType.toOrmResourceModel(this.javaManyToManyMapping.getDefaultFetch());
+ }
+ return org.eclipse.jpt.core.internal.context.base.FetchType.toOrmResourceModel(this.javaManyToManyMapping.getFetch());
+ }
+
+ public void setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType newFetch) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public EList<JoinColumn> getJoinColumns() {
+ return null;
+ }
+
+ public CascadeType getCascade() {
+ return this.virtualCascadeType;
+ }
+
+ public void setCascade(CascadeType value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public JoinTable getJoinTable() {
+ //TODO we don't yet support JoinTable in the context model for many-to-one mappings
+ return null;//this.virtualJoinTable;
+ }
+
+ public void setJoinTable(JoinTable value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getTargetEntity() {
+ if (this.metadataComplete) {
+ return this.javaManyToManyMapping.getDefaultTargetEntity();
+ }
+ return this.javaManyToManyMapping.getTargetEntity();
+ }
+
+ public void setTargetEntity(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getMappedBy() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaManyToManyMapping.getMappedBy();
+ }
+
+ public void setMappedBy(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+
+ public MapKey getMapKey() {
+ return this.mapKey;
+ }
+
+ public void setMapKey(MapKey value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getOrderBy() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaManyToManyMapping.getOrderBy();
+ }
+
+ public void setOrderBy(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public void update(IJavaManyToManyMapping javaManyToManyMapping) {
+ this.javaManyToManyMapping = javaManyToManyMapping;
+ this.virtualCascadeType.update(javaManyToManyMapping.getCascade());
+ this.virtualJoinTable.update(javaManyToManyMapping.getJoinTable());
+// this.updateJoinColumns(javaOneToManyMapping);
+ }
+
+// protected void updateJoinColumns(IJavaOneToManyMapping javaOneToManyMapping) {
+// ListIterator<IJavaJoinColumn> javaJoinColumns;
+// ListIterator<JoinColumn> virtualJoinColumns = this.virtualJoinColumns.listIterator();
+// if (this.metadataComplete) {
+// javaJoinColumns = this.javaOneToManyMapping.defaultJoinColumns();
+// }
+// else {
+// javaJoinColumns = this.javaOneToManyMapping.joinColumns();
+// }
+//
+// while (javaJoinColumns.hasNext()) {
+// IJavaJoinColumn javaJoinColumn = javaJoinColumns.next();
+// if (virtualJoinColumns.hasNext()) {
+// VirtualJoinColumn virtualJoinColumn = (VirtualJoinColumn) virtualJoinColumns.next();
+// virtualJoinColumn.update(javaJoinColumn);
+// }
+// else {
+// this.virtualJoinColumns.add(new VirtualJoinColumn(javaJoinColumn, this.metadataComplete));
+// }
+// }
+//
+// while(virtualJoinColumns.hasNext()) {
+// this.virtualJoinColumns.remove(virtualJoinColumns.next());
+// }
+// }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualManyToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualManyToOne.java
new file mode 100644
index 0000000000..6d58aecc82
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualManyToOne.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import java.util.ListIterator;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.core.internal.context.java.IJavaJoinColumn;
+import org.eclipse.jpt.core.internal.context.java.IJavaManyToOneMapping;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+import org.eclipse.jpt.core.internal.resource.orm.FetchType;
+
+/**
+ * VirtualManyToOne is an implementation of ManyToOne used when there is
+ * no tag in the orm.xml and an underlying javaManyToOneMapping exists.
+ */
+public class VirtualManyToOne extends JpaEObject implements ManyToOne
+{
+ IJavaManyToOneMapping javaManyToOneMapping;
+
+ protected boolean metadataComplete;
+
+// protected VirtualJoinTable virtualJoinTable;
+
+ protected final VirtualCascadeType virtualCascadeType;
+
+ protected EList<JoinColumn> virtualJoinColumns;
+
+ public VirtualManyToOne(IJavaManyToOneMapping javaManyToOneMapping, boolean metadataComplete) {
+ super();
+ this.javaManyToOneMapping = javaManyToOneMapping;
+ this.metadataComplete = metadataComplete;
+ this.initializeJoinColumns(javaManyToOneMapping);
+ this.virtualCascadeType = new VirtualCascadeType(javaManyToOneMapping.getCascade(), this.metadataComplete);
+ }
+
+ protected void initializeJoinColumns(IJavaManyToOneMapping javaManyToOneMapping) {
+ this.virtualJoinColumns = new BasicEList<JoinColumn>();
+ ListIterator<IJavaJoinColumn> javaJoinColumns;
+ if (this.metadataComplete) {
+ javaJoinColumns = this.javaManyToOneMapping.defaultJoinColumns();
+ }
+ else {
+ javaJoinColumns = this.javaManyToOneMapping.joinColumns();
+ }
+
+ while (javaJoinColumns.hasNext()) {
+ this.virtualJoinColumns.add(new VirtualJoinColumn(javaJoinColumns.next(), this.metadataComplete));
+ }
+ }
+
+ public String getName() {
+ return this.javaManyToOneMapping.persistentAttribute().getName();
+ }
+
+ public void setName(String newName) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public FetchType getFetch() {
+ if (this.metadataComplete) {
+ return org.eclipse.jpt.core.internal.context.base.FetchType.toOrmResourceModel(this.javaManyToOneMapping.getDefaultFetch());
+ }
+ return org.eclipse.jpt.core.internal.context.base.FetchType.toOrmResourceModel(this.javaManyToOneMapping.getFetch());
+ }
+
+ public void setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType newFetch) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Boolean getOptional() {
+ if (this.metadataComplete) {
+ return this.javaManyToOneMapping.getDefaultOptional();
+ }
+ return this.javaManyToOneMapping.getOptional();
+ }
+
+ public void setOptional(Boolean newOptional) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public EList<JoinColumn> getJoinColumns() {
+ return this.virtualJoinColumns;
+ }
+
+ public CascadeType getCascade() {
+ return this.virtualCascadeType;
+ }
+
+ public void setCascade(CascadeType value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public JoinTable getJoinTable() {
+ //TODO we don't yet support JoinTable in the context model for many-to-one mappings
+ return null;//this.virtualJoinTable;
+ }
+
+ public void setJoinTable(JoinTable value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getTargetEntity() {
+ if (this.metadataComplete) {
+ return this.javaManyToOneMapping.getDefaultTargetEntity();
+ }
+ return this.javaManyToOneMapping.getTargetEntity();
+ }
+
+ public void setTargetEntity(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public void update(IJavaManyToOneMapping javaManyToOneMapping) {
+ this.javaManyToOneMapping = javaManyToOneMapping;
+ this.virtualCascadeType.update(javaManyToOneMapping.getCascade());
+ this.updateJoinColumns(javaManyToOneMapping);
+ }
+
+ protected void updateJoinColumns(IJavaManyToOneMapping javaManyToOneMapping) {
+ ListIterator<IJavaJoinColumn> javaJoinColumns;
+ ListIterator<JoinColumn> virtualJoinColumns = this.virtualJoinColumns.listIterator();
+ if (this.metadataComplete) {
+ javaJoinColumns = this.javaManyToOneMapping.defaultJoinColumns();
+ }
+ else {
+ javaJoinColumns = this.javaManyToOneMapping.joinColumns();
+ }
+
+ while (javaJoinColumns.hasNext()) {
+ IJavaJoinColumn javaJoinColumn = javaJoinColumns.next();
+ if (virtualJoinColumns.hasNext()) {
+ VirtualJoinColumn virtualJoinColumn = (VirtualJoinColumn) virtualJoinColumns.next();
+ virtualJoinColumn.update(javaJoinColumn);
+ }
+ else {
+ this.virtualJoinColumns.add(new VirtualJoinColumn(javaJoinColumn, this.metadataComplete));
+ }
+ }
+
+ while(virtualJoinColumns.hasNext()) {
+ this.virtualJoinColumns.remove(virtualJoinColumns.next());
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualMapKey.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualMapKey.java
new file mode 100644
index 0000000000..e74f79bff7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualMapKey.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.context.java.IJavaMultiRelationshipMapping;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+public class VirtualMapKey extends JpaEObject implements MapKey
+{
+ IJavaMultiRelationshipMapping javaMultiRelationshipMapping;
+
+ protected boolean metadataComplete;
+
+ public VirtualMapKey(IJavaMultiRelationshipMapping javaMultiRelationshipMapping, boolean metadataComplete) {
+ super();
+ this.javaMultiRelationshipMapping = javaMultiRelationshipMapping;
+ this.metadataComplete = metadataComplete;
+ }
+
+ public String getName() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaMultiRelationshipMapping.getMapKey();
+ }
+
+ public void setName(String newName) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public void update(IJavaMultiRelationshipMapping javaMultiRelationshipMapping) {
+ this.javaMultiRelationshipMapping = javaMultiRelationshipMapping;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualOneToMany.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualOneToMany.java
new file mode 100644
index 0000000000..6190856a28
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualOneToMany.java
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.core.internal.context.java.IJavaOneToManyMapping;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+import org.eclipse.jpt.core.internal.resource.orm.FetchType;
+
+/**
+ * VirtualOneToMany is an implementation of OneToMany used when there is
+ * no tag in the orm.xml and an underlying javaOneToManyMapping exists.
+ */
+public class VirtualOneToMany extends JpaEObject implements OneToMany
+{
+ IJavaOneToManyMapping javaOneToManyMapping;
+
+ protected boolean metadataComplete;
+
+ protected final VirtualJoinTable virtualJoinTable;
+
+ protected final VirtualCascadeType virtualCascadeType;
+
+ protected final MapKey mapKey;
+
+ //TODO joinColumns not yet supported in the context model
+// protected EList<JoinColumn> virtualJoinColumns;
+
+ public VirtualOneToMany(IJavaOneToManyMapping javaOneToManyMapping, boolean metadataComplete) {
+ super();
+ this.javaOneToManyMapping = javaOneToManyMapping;
+ this.metadataComplete = metadataComplete;
+// this.initializeJoinColumns(javaOneToManyMapping);
+ this.virtualCascadeType = new VirtualCascadeType(javaOneToManyMapping.getCascade(), this.metadataComplete);
+ this.virtualJoinTable = new VirtualJoinTable(javaOneToManyMapping.getJoinTable(), metadataComplete);
+ this.mapKey = new VirtualMapKey(javaOneToManyMapping, metadataComplete);
+ }
+
+// protected void initializeJoinColumns(IJavaOneToManyMapping javaOneToManyMapping) {
+// this.virtualJoinColumns = new BasicEList<JoinColumn>();
+// ListIterator<IJavaJoinColumn> javaJoinColumns;
+// if (this.metadataComplete) {
+// javaJoinColumns = this.javaOneToManyMapping.defaultJoinColumns();
+// }
+// else {
+// javaJoinColumns = this.javaOneToManyMapping.joinColumns();
+// }
+//
+// while (javaJoinColumns.hasNext()) {
+// this.virtualJoinColumns.add(new VirtualJoinColumn(javaJoinColumns.next(), this.metadataComplete));
+// }
+// }
+
+ public String getName() {
+ return this.javaOneToManyMapping.persistentAttribute().getName();
+ }
+
+ public void setName(String newName) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public FetchType getFetch() {
+ if (this.metadataComplete) {
+ return org.eclipse.jpt.core.internal.context.base.FetchType.toOrmResourceModel(this.javaOneToManyMapping.getDefaultFetch());
+ }
+ return org.eclipse.jpt.core.internal.context.base.FetchType.toOrmResourceModel(this.javaOneToManyMapping.getFetch());
+ }
+
+ public void setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType newFetch) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public EList<JoinColumn> getJoinColumns() {
+ return null;
+ }
+
+ public CascadeType getCascade() {
+ return this.virtualCascadeType;
+ }
+
+ public void setCascade(CascadeType value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public JoinTable getJoinTable() {
+ //TODO we don't yet support JoinTable in the context model for many-to-one mappings
+ return null;//this.virtualJoinTable;
+ }
+
+ public void setJoinTable(JoinTable value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getTargetEntity() {
+ if (this.metadataComplete) {
+ return this.javaOneToManyMapping.getDefaultTargetEntity();
+ }
+ return this.javaOneToManyMapping.getTargetEntity();
+ }
+
+ public void setTargetEntity(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getMappedBy() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaOneToManyMapping.getMappedBy();
+ }
+
+ public void setMappedBy(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+
+ public MapKey getMapKey() {
+ return this.mapKey;
+ }
+
+ public void setMapKey(MapKey value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getOrderBy() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaOneToManyMapping.getOrderBy();
+ }
+
+ public void setOrderBy(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public void update(IJavaOneToManyMapping javaOneToManyMapping) {
+ this.javaOneToManyMapping = javaOneToManyMapping;
+ this.virtualCascadeType.update(javaOneToManyMapping.getCascade());
+ this.virtualJoinTable.update(javaOneToManyMapping.getJoinTable());
+// this.updateJoinColumns(javaOneToManyMapping);
+ }
+
+// protected void updateJoinColumns(IJavaOneToManyMapping javaOneToManyMapping) {
+// ListIterator<IJavaJoinColumn> javaJoinColumns;
+// ListIterator<JoinColumn> virtualJoinColumns = this.virtualJoinColumns.listIterator();
+// if (this.metadataComplete) {
+// javaJoinColumns = this.javaOneToManyMapping.defaultJoinColumns();
+// }
+// else {
+// javaJoinColumns = this.javaOneToManyMapping.joinColumns();
+// }
+//
+// while (javaJoinColumns.hasNext()) {
+// IJavaJoinColumn javaJoinColumn = javaJoinColumns.next();
+// if (virtualJoinColumns.hasNext()) {
+// VirtualJoinColumn virtualJoinColumn = (VirtualJoinColumn) virtualJoinColumns.next();
+// virtualJoinColumn.update(javaJoinColumn);
+// }
+// else {
+// this.virtualJoinColumns.add(new VirtualJoinColumn(javaJoinColumn, this.metadataComplete));
+// }
+// }
+//
+// while(virtualJoinColumns.hasNext()) {
+// this.virtualJoinColumns.remove(virtualJoinColumns.next());
+// }
+// }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualOneToOne.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualOneToOne.java
new file mode 100644
index 0000000000..c9aea3ec72
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualOneToOne.java
@@ -0,0 +1,187 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import java.util.ListIterator;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.core.internal.context.java.IJavaJoinColumn;
+import org.eclipse.jpt.core.internal.context.java.IJavaOneToOneMapping;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+import org.eclipse.jpt.core.internal.resource.orm.FetchType;
+
+/**
+ * VirtualOneToOne is an implementation of OneToOne used when there is
+ * no tag in the orm.xml and an underlying javaOneToOneMapping exists.
+ */
+public class VirtualOneToOne extends JpaEObject implements OneToOne
+{
+ IJavaOneToOneMapping javaOneToOneMapping;
+
+ protected boolean metadataComplete;
+
+// protected VirtualJoinTable virtualJoinTable;
+
+ protected final VirtualCascadeType virtualCascadeType;
+
+ protected EList<JoinColumn> virtualJoinColumns;
+
+// protected EList<PrimaryKeyJoinColumn> virtualPrimaryKeyJoinColumns;
+
+ public VirtualOneToOne(IJavaOneToOneMapping javaOneToOneMapping, boolean metadataComplete) {
+ super();
+ this.javaOneToOneMapping = javaOneToOneMapping;
+ this.metadataComplete = metadataComplete;
+ this.initializeJoinColumns(javaOneToOneMapping);
+// this.initializePrimaryKeyJoinColumns(javaOneToOneMapping);
+ this.virtualCascadeType = new VirtualCascadeType(javaOneToOneMapping.getCascade(), this.metadataComplete);
+ }
+
+ protected void initializeJoinColumns(IJavaOneToOneMapping javaOneToOneMapping) {
+ this.virtualJoinColumns = new BasicEList<JoinColumn>();
+ ListIterator<IJavaJoinColumn> javaJoinColumns;
+ if (this.metadataComplete) {
+ javaJoinColumns = this.javaOneToOneMapping.defaultJoinColumns();
+ }
+ else {
+ javaJoinColumns = this.javaOneToOneMapping.joinColumns();
+ }
+
+ while (javaJoinColumns.hasNext()) {
+ this.virtualJoinColumns.add(new VirtualJoinColumn(javaJoinColumns.next(), this.metadataComplete));
+ }
+ }
+
+// protected void initializePrimaryKeyJoinColumns(IJavaOneToOneMapping javaOneToOneMapping) {
+// this.virtualPrimaryKeyJoinColumns = new BasicEList<PrimaryKeyJoinColumn>();
+// ListIterator<IJavaPrimaryKeyJoinColumn> javaJoinColumns;
+// if (this.metadataComplete) {
+// javaJoinColumns = this.javaOneToOneMapping.defaultJoinColumns();
+// }
+// else {
+// javaJoinColumns = this.javaOneToOneMapping.joinColumns();
+// }
+//
+// while (javaJoinColumns.hasNext()) {
+// this.virtualJoinColumns.add(new VirtualJoinColumn(javaJoinColumns.next(), this.metadataComplete));
+// }
+// }
+
+ public String getName() {
+ return this.javaOneToOneMapping.persistentAttribute().getName();
+ }
+
+ public void setName(String newName) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public FetchType getFetch() {
+ if (this.metadataComplete) {
+ return org.eclipse.jpt.core.internal.context.base.FetchType.toOrmResourceModel(this.javaOneToOneMapping.getDefaultFetch());
+ }
+ return org.eclipse.jpt.core.internal.context.base.FetchType.toOrmResourceModel(this.javaOneToOneMapping.getFetch());
+ }
+
+ public void setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType newFetch) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Boolean getOptional() {
+ if (this.metadataComplete) {
+ return this.javaOneToOneMapping.getDefaultOptional();
+ }
+ return this.javaOneToOneMapping.getOptional();
+ }
+
+ public void setOptional(Boolean newOptional) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public EList<JoinColumn> getJoinColumns() {
+ return this.virtualJoinColumns;
+ }
+
+ public CascadeType getCascade() {
+ return this.virtualCascadeType;
+ }
+
+ public void setCascade(CascadeType value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public JoinTable getJoinTable() {
+ //TODO we don't yet support JoinTable in the context model for many-to-one mappings
+ return null;//this.virtualJoinTable;
+ }
+
+ public void setJoinTable(JoinTable value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getTargetEntity() {
+ if (this.metadataComplete) {
+ return this.javaOneToOneMapping.getDefaultTargetEntity();
+ }
+ return this.javaOneToOneMapping.getTargetEntity();
+ }
+
+ public void setTargetEntity(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getMappedBy() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaOneToOneMapping.getMappedBy();
+ }
+
+ public void setMappedBy(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public EList<PrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
+ // TODO we don't yet support primary key join columns in the context model
+ return null;
+ }
+
+ public void update(IJavaOneToOneMapping javaOneToOneMapping) {
+ this.javaOneToOneMapping = javaOneToOneMapping;
+ this.virtualCascadeType.update(javaOneToOneMapping.getCascade());
+ this.updateJoinColumns(javaOneToOneMapping);
+ }
+
+ protected void updateJoinColumns(IJavaOneToOneMapping javaOneToOneMapping) {
+ ListIterator<IJavaJoinColumn> javaJoinColumns;
+ ListIterator<JoinColumn> virtualJoinColumns = this.virtualJoinColumns.listIterator();
+ if (this.metadataComplete) {
+ javaJoinColumns = this.javaOneToOneMapping.defaultJoinColumns();
+ }
+ else {
+ javaJoinColumns = this.javaOneToOneMapping.joinColumns();
+ }
+
+ while (javaJoinColumns.hasNext()) {
+ IJavaJoinColumn javaJoinColumn = javaJoinColumns.next();
+ if (virtualJoinColumns.hasNext()) {
+ VirtualJoinColumn virtualJoinColumn = (VirtualJoinColumn) virtualJoinColumns.next();
+ virtualJoinColumn.update(javaJoinColumn);
+ }
+ else {
+ this.virtualJoinColumns.add(new VirtualJoinColumn(javaJoinColumn, this.metadataComplete));
+ }
+ }
+
+ while(virtualJoinColumns.hasNext()) {
+ this.virtualJoinColumns.remove(virtualJoinColumns.next());
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualSequenceGenerator.java
new file mode 100644
index 0000000000..dd970700fc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualSequenceGenerator.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.context.java.IJavaSequenceGenerator;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+public class VirtualSequenceGenerator extends JpaEObject implements SequenceGenerator
+{
+ IJavaSequenceGenerator javaSequenceGenerator;
+
+ protected boolean metadataComplete;
+
+
+ public VirtualSequenceGenerator(IJavaSequenceGenerator javaSequenceGenerator, boolean metadataComplete) {
+ super();
+ this.javaSequenceGenerator = javaSequenceGenerator;
+ this.metadataComplete = metadataComplete;
+ }
+
+ public String getSequenceName() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaSequenceGenerator.getSequenceName();
+ }
+
+ public void setSequenceName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Integer getAllocationSize() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaSequenceGenerator.getAllocationSize();
+ }
+
+ public void setAllocationSize(Integer value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Integer getInitialValue() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaSequenceGenerator.getInitialValue();
+ }
+
+ public void setInitialValue(Integer value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getName() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaSequenceGenerator.getName();
+ }
+
+ public void setName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public void update(IJavaSequenceGenerator javaSequenceGenerator) {
+ this.javaSequenceGenerator = javaSequenceGenerator;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualTableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualTableGenerator.java
new file mode 100644
index 0000000000..73c3fd120f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualTableGenerator.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jpt.core.internal.context.java.IJavaTableGenerator;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+public class VirtualTableGenerator extends JpaEObject implements TableGenerator
+{
+ IJavaTableGenerator javaTableGenerator;
+
+ protected boolean metadataComplete;
+
+
+ public VirtualTableGenerator(IJavaTableGenerator javaTableGenerator, boolean metadataComplete) {
+ super();
+ this.javaTableGenerator = javaTableGenerator;
+ this.metadataComplete = metadataComplete;
+ }
+
+ public String getCatalog() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaTableGenerator.getCatalog();
+ }
+
+ public void setCatalog(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getPkColumnName() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaTableGenerator.getPkColumnName();
+ }
+
+ public void setPkColumnName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getPkColumnValue() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaTableGenerator.getPkColumnValue();
+ }
+
+ public void setPkColumnValue(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getSchema() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaTableGenerator.getSchema();
+ }
+
+ public void setSchema(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getTable() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaTableGenerator.getTable();
+ }
+
+ public void setTable(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getValueColumnName() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaTableGenerator.getValueColumnName();
+ }
+
+ public void setValueColumnName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Integer getAllocationSize() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaTableGenerator.getAllocationSize();
+ }
+
+ public void setAllocationSize(Integer value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Integer getInitialValue() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaTableGenerator.getInitialValue();
+ }
+
+ public void setInitialValue(Integer value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public String getName() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return this.javaTableGenerator.getName();
+ }
+
+ public void setName(String value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+
+
+ public EList<UniqueConstraint> getUniqueConstraints() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void update(IJavaTableGenerator javaTableGenerator) {
+ this.javaTableGenerator = javaTableGenerator;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualTransient.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualTransient.java
new file mode 100644
index 0000000000..146612e015
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualTransient.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.context.java.IJavaTransientMapping;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * VirtualTransient is an implementation of Transient used when there is
+ * no tag in the orm.xml and an underlying javaTransientMapping exists.
+ */
+public class VirtualTransient extends JpaEObject implements Transient
+{
+ IJavaTransientMapping javaTransientMapping;
+
+ protected boolean metadataComplete;
+
+ public VirtualTransient(IJavaTransientMapping javaTransientMapping, boolean metadataComplete) {
+ super();
+ this.javaTransientMapping = javaTransientMapping;
+ this.metadataComplete = metadataComplete;
+ }
+
+ public String getName() {
+ return this.javaTransientMapping.persistentAttribute().getName();
+ }
+
+ public void setName(String newName) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public void update(IJavaTransientMapping javaTransientMapping) {
+ this.javaTransientMapping = javaTransientMapping;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualVersion.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualVersion.java
new file mode 100644
index 0000000000..69080ce4ae
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/VirtualVersion.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.resource.orm;
+
+import org.eclipse.jpt.core.internal.context.java.IJavaVersionMapping;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+import org.eclipse.jpt.core.internal.resource.orm.TemporalType;
+
+/**
+ * VirtualVersion is an implementation of Version used when there is
+ * no tag in the orm.xml and an underlying javaVersionMapping exists.
+ */
+public class VirtualVersion extends JpaEObject implements Version
+{
+ IJavaVersionMapping javaVersionMapping;
+
+ protected final VirtualColumn column;
+
+ protected boolean metadataComplete;
+
+ public VirtualVersion(IJavaVersionMapping javaVersionMapping, boolean metadataComplete) {
+ super();
+ this.javaVersionMapping = javaVersionMapping;
+ this.metadataComplete = metadataComplete;
+ this.column = new VirtualColumn(javaVersionMapping.getColumn(), metadataComplete);
+ }
+
+ public String getName() {
+ return this.javaVersionMapping.persistentAttribute().getName();
+ }
+
+ public void setName(String newName) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public Column getColumn() {
+ return this.column;
+ }
+
+ public void setColumn(Column value) {
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public TemporalType getTemporal() {
+ if (this.metadataComplete) {
+ return null;
+ }
+ return org.eclipse.jpt.core.internal.context.base.TemporalType.toOrmResourceModel(this.javaVersionMapping.getTemporal());
+ }
+
+ public void setTemporal(TemporalType newTemporal){
+ throw new UnsupportedOperationException("cannot set values on a virtual mapping");
+ }
+
+ public void update(IJavaVersionMapping javaVersionMapping) {
+ this.javaVersionMapping = javaVersionMapping;
+ this.column.update(javaVersionMapping.getColumn());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/AssociationOverrideTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/AssociationOverrideTranslator.java
new file mode 100644
index 0000000000..aa9b89fba4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/AssociationOverrideTranslator.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class AssociationOverrideTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public AssociationOverrideTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createJoinColumnTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getAssociationOverride_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createJoinColumnTranslator() {
+ return new JoinColumnTranslator(JOIN_COLUMN, ORM_PKG.getAssociationOverride_JoinColumns());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/AttributeOverrideTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/AttributeOverrideTranslator.java
new file mode 100644
index 0000000000..d2b558f9df
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/AttributeOverrideTranslator.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class AttributeOverrideTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public AttributeOverrideTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createColumnTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getAttributeOverride_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createColumnTranslator() {
+ return new ColumnTranslator(COLUMN, ORM_PKG.getAttributeOverride_Column());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/AttributesTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/AttributesTranslator.java
new file mode 100644
index 0000000000..80ee0f83e3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/AttributesTranslator.java
@@ -0,0 +1,80 @@
+package org.eclipse.jpt.core.internal.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class AttributesTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public AttributesTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createIdTranslator(),
+ createEmbeddedIdTranslator(),
+ createBasicTranslator(),
+ createVersionTranslator(),
+ createManyToOneTranslator(),
+ createOneToManyTranslator(),
+ createOneToOneTranslator(),
+ createManyToManyTranslator(),
+ createEmbeddedTranslator(),
+ createTransientTranslator()
+ };
+ }
+
+ private Translator createIdTranslator() {
+ return new IdTranslator(ID, ORM_PKG.getAttributes_Ids());
+ }
+
+ private Translator createEmbeddedIdTranslator() {
+ return new EmbeddedIdTranslator(EMBEDDED_ID, ORM_PKG.getAttributes_EmbeddedIds());
+ }
+
+ private Translator createBasicTranslator() {
+ return new BasicTranslator(BASIC, ORM_PKG.getAttributes_Basics());
+ }
+
+ private Translator createVersionTranslator() {
+ return new VersionTranslator(VERSION, ORM_PKG.getAttributes_Versions());
+ }
+
+ private Translator createManyToOneTranslator() {
+ return new ManyToOneTranslator(MANY_TO_ONE, ORM_PKG.getAttributes_ManyToOnes());
+ }
+
+ private Translator createOneToManyTranslator() {
+ return new OneToManyTranslator(ONE_TO_MANY, ORM_PKG.getAttributes_OneToManys());
+ }
+
+ private Translator createOneToOneTranslator() {
+ return new OneToOneTranslator(ONE_TO_ONE, ORM_PKG.getAttributes_OneToOnes());
+ }
+
+ private Translator createManyToManyTranslator() {
+ return new ManyToManyTranslator(MANY_TO_MANY, ORM_PKG.getAttributes_ManyToManys());
+ }
+
+ private Translator createEmbeddedTranslator() {
+ return new EmbeddedTranslator(EMBEDDED, ORM_PKG.getAttributes_Embeddeds());
+ }
+
+ private Translator createTransientTranslator() {
+ return new TransientTranslator(TRANSIENT, ORM_PKG.getAttributes_Transients());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/BasicTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/BasicTranslator.java
new file mode 100644
index 0000000000..89deed2ef6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/BasicTranslator.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.core.internal.resource.common.translators.BooleanTranslator;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class BasicTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public BasicTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createFetchTranslator(),
+ createOptionalTranslator(),
+ createColumnTranslator(),
+ createLobTranslator(),
+ createTemporalTranslator(),
+ createEnumeratedTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getAttributeMapping_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createFetchTranslator() {
+ return new Translator(FETCH, ORM_PKG.getBasic_Fetch(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createOptionalTranslator() {
+ return new BooleanTranslator(OPTIONAL, ORM_PKG.getBasic_Optional(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createColumnTranslator() {
+ return new ColumnTranslator(COLUMN, ORM_PKG.getColumnMapping_Column());
+ }
+
+ private Translator createLobTranslator() {
+ return new EmptyTagBooleanTranslator(LOB, ORM_PKG.getBasic_Lob());
+ }
+
+ private Translator createTemporalTranslator() {
+ return new Translator(TEMPORAL, ORM_PKG.getBasic_Temporal());
+ }
+
+ private Translator createEnumeratedTranslator() {
+ return new Translator(ENUMERATED, ORM_PKG.getBasic_Enumerated());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/CascadeTypeTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/CascadeTypeTranslator.java
new file mode 100644
index 0000000000..c01e162dbc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/CascadeTypeTranslator.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class CascadeTypeTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public CascadeTypeTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createCascadeAllTranslator(),
+ createCascadePersistTranslator(),
+ createCascadeMergeTranslator(),
+ createCascadeRemoveTranslator(),
+ createCascadeRefreshTranslator()
+ };
+ }
+
+ private Translator createCascadeAllTranslator() {
+ return new EmptyTagBooleanTranslator(CASCADE_ALL, ORM_PKG.getCascadeType_CascadeAll());
+ }
+
+ private Translator createCascadePersistTranslator() {
+ return new EmptyTagBooleanTranslator(CASCADE_PERSIST, ORM_PKG.getCascadeType_CascadePersist());
+ }
+
+ private Translator createCascadeMergeTranslator() {
+ return new EmptyTagBooleanTranslator(CASCADE_MERGE, ORM_PKG.getCascadeType_CascadeMerge());
+ }
+
+ private Translator createCascadeRemoveTranslator() {
+ return new EmptyTagBooleanTranslator(CASCADE_REMOVE, ORM_PKG.getCascadeType_CascadeRemove());
+ }
+
+ private Translator createCascadeRefreshTranslator() {
+ return new EmptyTagBooleanTranslator(CASCADE_REFRESH, ORM_PKG.getCascadeType_CascadeRefresh());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/ColumnResultTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/ColumnResultTranslator.java
new file mode 100644
index 0000000000..1a22562303
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/ColumnResultTranslator.java
@@ -0,0 +1,35 @@
+package org.eclipse.jpt.core.internal.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class ColumnResultTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public ColumnResultTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getColumnResult_Name(), DOM_ATTRIBUTE);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/ColumnTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/ColumnTranslator.java
new file mode 100644
index 0000000000..e3f621959f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/ColumnTranslator.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.core.internal.resource.common.translators.BooleanTranslator;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class ColumnTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public ColumnTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createUniqueTranslator(),
+ createNullableTranslator(),
+ createInsertableTranslator(),
+ createUpdatableTranslator(),
+ createColumnDefinitionTranslator(),
+ createTableTranslator(),
+ createLengthTranslator(),
+ createPrecisionTranslator(),
+ createScaleTranslator(),
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getNamedColumn_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createUniqueTranslator() {
+ return new BooleanTranslator(UNIQUE, ORM_PKG.getAbstractColumn_Unique(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createNullableTranslator() {
+ return new BooleanTranslator(NULLABLE, ORM_PKG.getAbstractColumn_Nullable(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createInsertableTranslator() {
+ return new BooleanTranslator(INSERTABLE, ORM_PKG.getAbstractColumn_Insertable(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createUpdatableTranslator() {
+ return new BooleanTranslator(UPDATABLE, ORM_PKG.getAbstractColumn_Updatable(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createColumnDefinitionTranslator() {
+ return new Translator(COLUMN_DEFINITION, ORM_PKG.getNamedColumn_ColumnDefinition(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createTableTranslator() {
+ return new Translator(TABLE, ORM_PKG.getAbstractColumn_Table(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createLengthTranslator() {
+ return new Translator(LENGTH, ORM_PKG.getColumn_Length(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createPrecisionTranslator() {
+ return new Translator(PRECISION, ORM_PKG.getColumn_Precision(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createScaleTranslator() {
+ return new Translator(SCALE, ORM_PKG.getColumn_Scale(), DOM_ATTRIBUTE);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/DiscriminatorColumnTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/DiscriminatorColumnTranslator.java
index 8f493eeb13..b09e4c5d0f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/DiscriminatorColumnTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/DiscriminatorColumnTranslator.java
@@ -6,53 +6,53 @@
*
* Contributors: Oracle. - initial API and implementation
*******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm.resource;
+package org.eclipse.jpt.core.internal.resource.orm.translators;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
import org.eclipse.wst.common.internal.emf.resource.Translator;
-public class DiscriminatorColumnTranslator extends AbstractColumnTranslator
+public class DiscriminatorColumnTranslator extends Translator
implements OrmXmlMapper
{
+ private Translator[] children;
- private IEntity entity;
-
- public DiscriminatorColumnTranslator() {
- super(ENTITY__DISCRIMINATOR_COLUMN, JPA_CORE_XML_PKG.getXmlEntityForXml_DiscriminatorColumnForXml());
- }
- protected IEntity getEntity() {
- return this.entity;
+ public DiscriminatorColumnTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
}
- void setEntity(IEntity entity) {
- this.entity = entity;
- }
-
@Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return getEntity().getDiscriminatorColumn();
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
}
-
+
protected Translator[] createChildren() {
return new Translator[] {
IDTranslator.INSTANCE,
createNameTranslator(),
createDiscrminiatorTypeTranslator(),
createColumnDefinitionTranslator(),
- createLengthTranslator(),
+ createLengthTranslator()
};
}
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getNamedColumn_Name(), DOM_ATTRIBUTE);
+ }
+
protected Translator createDiscrminiatorTypeTranslator() {
- return new EnumeratorTranslator(DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE, JPA_CORE_XML_PKG.getXmlDiscriminatorColumn_DiscriminatorTypeForXml(), DOM_ATTRIBUTE);
+ return new Translator(DISCRIMINATOR_TYPE, ORM_PKG.getDiscriminatorColumn_DiscriminatorType(), DOM_ATTRIBUTE);
}
- protected Translator createLengthTranslator() {
- return new Translator(DISCRIMINATOR_COLUMN__LENGTH, JPA_CORE_XML_PKG.getXmlDiscriminatorColumn_SpecifiedLengthForXml(), DOM_ATTRIBUTE);
+ private Translator createColumnDefinitionTranslator() {
+ return new Translator(COLUMN_DEFINITION, ORM_PKG.getNamedColumn_ColumnDefinition(), DOM_ATTRIBUTE);
}
-
+ protected Translator createLengthTranslator() {
+ return new Translator(LENGTH, ORM_PKG.getDiscriminatorColumn_Length(), DOM_ATTRIBUTE);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EmbeddableTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EmbeddableTranslator.java
new file mode 100644
index 0000000000..2c3b9b909c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EmbeddableTranslator.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class EmbeddableTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public EmbeddableTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createClassTranslator(),
+ createAccessTranslator(),
+ createMetadataCompleteTranslator(),
+ createDescriptionTranslator(),
+ createAttributesTranslator()
+ };
+ }
+
+ private Translator createClassTranslator() {
+ return new Translator(CLASS, ORM_PKG.getTypeMapping_ClassName(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createAccessTranslator() {
+ return new Translator(ACCESS, ORM_PKG.getTypeMapping_Access(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createMetadataCompleteTranslator() {
+ return new Translator(METADATA_COMPLETE, ORM_PKG.getTypeMapping_MetadataComplete(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createDescriptionTranslator() {
+ return new Translator(DESCRIPTION, ORM_PKG.getTypeMapping_Description());
+ }
+
+ private Translator createAttributesTranslator() {
+ return new AttributesTranslator(ATTRIBUTES, ORM_PKG.getTypeMapping_Attributes());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OneToOneTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EmbeddedIdTranslator.java
index b73ed4760e..f2b73d01fd 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/OneToOneTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EmbeddedIdTranslator.java
@@ -7,41 +7,43 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm.resource;
+package org.eclipse.jpt.core.internal.resource.orm.translators;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
import org.eclipse.wst.common.internal.emf.resource.Translator;
-public class OneToOneTranslator extends SingleRelationshipTranslator
+public class EmbeddedIdTranslator extends Translator
+ implements OrmXmlMapper
{
- public OneToOneTranslator() {
- super(ONE_TO_ONE);
- }
+ private Translator[] children;
- @Override
- protected ISingleRelationshipMapping createMapping() {
- return JPA_CORE_XML_FACTORY.createXmlOneToOne();
+
+ public EmbeddedIdTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
}
@Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
protected Translator[] createChildren() {
return new Translator[] {
IDTranslator.INSTANCE,
createNameTranslator(),
- createTargetEntityTranslator(),
- createFetchTypeTranslator(),
- createOptionalTranslator(),
- createMappedByTranslator(),
- createPlaceHolderTranslator(ONE_TO_ONE__PRIMARY_KEY_JOIN_COLUMNS),
- createJoinColumnsTranslator(),
- createPlaceHolderTranslator(ONE_TO_ONE__JOIN_TABLE),
- createCascadeTranslator()
+ createAttributeOverrideTranslator()
};
}
- private Translator createPlaceHolderTranslator(String domNameAndPath) {
- return new Translator(domNameAndPath, (EStructuralFeature) null);
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getAttributeMapping_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createAttributeOverrideTranslator() {
+ return new AttributeOverrideTranslator(ATTRIBUTE_OVERRIDE, ORM_PKG.getEmbeddedId_AttributeOverrides());
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EmbeddedTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EmbeddedTranslator.java
new file mode 100644
index 0000000000..896578236e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EmbeddedTranslator.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class EmbeddedTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public EmbeddedTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createAttributeOverrideTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getAttributeMapping_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createAttributeOverrideTranslator() {
+ return new AttributeOverrideTranslator(ATTRIBUTE_OVERRIDE, ORM_PKG.getEmbedded_AttributeOverrides());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EmptyTagBooleanTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EmptyTagBooleanTranslator.java
index 1ccac741ba..b5fd85a4f9 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EmptyTagBooleanTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EmptyTagBooleanTranslator.java
@@ -7,7 +7,7 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm.resource;
+package org.eclipse.jpt.core.internal.resource.orm.translators;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -46,7 +46,7 @@ public class EmptyTagBooleanTranslator extends Translator
// but I really don't think that we should have to depend on the boolean
// being "unset" to remove the tag.
Boolean value = (Boolean) super.getMOFValue(mofObject);
- return (value == true) ? value : null;
+ return (value == Boolean.TRUE) ? value : null;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityListenerTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityListenerTranslator.java
new file mode 100644
index 0000000000..6152eb2dde
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityListenerTranslator.java
@@ -0,0 +1,70 @@
+package org.eclipse.jpt.core.internal.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class EntityListenerTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public EntityListenerTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ private Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createClassTranslator(),
+ createPrePersistTranslator(),
+ createPostPersistTranslator(),
+ createPreRemoveTranslator(),
+ createPostRemoveTranslator(),
+ createPreUpdateTranslator(),
+ createPostUpdateTranslator(),
+ createPostLoadTranslator()
+ };
+ }
+
+ private Translator createClassTranslator() {
+ return new Translator(CLASS, ORM_PKG.getEntityListener_ClassName());
+ }
+
+ private Translator createPrePersistTranslator() {
+ return new EventMethodTranslator(PRE_PERSIST, ORM_PKG.getEntityListener_PrePersist());
+ }
+
+ private Translator createPostPersistTranslator() {
+ return new EventMethodTranslator(POST_PERSIST, ORM_PKG.getEntityListener_PostPersist());
+ }
+
+ private Translator createPreRemoveTranslator() {
+ return new EventMethodTranslator(PRE_REMOVE, ORM_PKG.getEntityListener_PreRemove());
+ }
+
+ private Translator createPostRemoveTranslator() {
+ return new EventMethodTranslator(POST_REMOVE, ORM_PKG.getEntityListener_PostRemove());
+ }
+
+ private Translator createPreUpdateTranslator() {
+ return new EventMethodTranslator(PRE_UPDATE, ORM_PKG.getEntityListener_PreUpdate());
+ }
+
+ private Translator createPostUpdateTranslator() {
+ return new EventMethodTranslator(POST_UPDATE, ORM_PKG.getEntityListener_PostUpdate());
+ }
+
+ private Translator createPostLoadTranslator() {
+ return new EventMethodTranslator(POST_LOAD, ORM_PKG.getEntityListener_PostLoad());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityListenersTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityListenersTranslator.java
new file mode 100644
index 0000000000..9ba02f5efc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityListenersTranslator.java
@@ -0,0 +1,35 @@
+package org.eclipse.jpt.core.internal.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class EntityListenersTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public EntityListenersTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ private Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createEntityListenerTranslator()
+ };
+ }
+
+ private Translator createEntityListenerTranslator() {
+ return new EntityListenerTranslator(ENTITY_LISTENER, ORM_PKG.getEntityListeners_EntityListeners());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityMappingsTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityMappingsTranslator.java
new file mode 100644
index 0000000000..693f6f0063
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityMappingsTranslator.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.orm.translators;
+
+import org.eclipse.wst.common.internal.emf.resource.ConstantAttributeTranslator;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.RootTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class EntityMappingsTranslator extends RootTranslator
+ implements OrmXmlMapper
+{
+ public static EntityMappingsTranslator INSTANCE = new EntityMappingsTranslator();
+
+
+ private Translator[] children;
+
+
+ public EntityMappingsTranslator() {
+ super(ENTITY_MAPPINGS, ORM_PKG.getEntityMappings());
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ private Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ new ConstantAttributeTranslator(XML_NS, PERSISTENCE_NS_URL),
+ new ConstantAttributeTranslator(XML_NS_XSI, XSI_NS_URL),
+ new ConstantAttributeTranslator(XSI_SCHEMA_LOCATION, PERSISTENCE_NS_URL + ' ' + ORM_SCHEMA_LOC_1_0),
+ createVersionTranslator(),
+ createDescriptionTranslator(),
+ createPersistenceUnitMetadataTranslator(),
+ createPackageTranslator(),
+ createSchemaTranslator(),
+ createCatalogTranslator(),
+ createAccessTranslator(),
+ createSequenceGeneratorTranslator(),
+ createTableGeneratorTranslator(),
+ createNamedQueryTranslator(),
+ createNamedNativeQueryTranslator(),
+ createSqlResultSetMappingTranslator(),
+ createMappedSuperclassTranslator(),
+ createEntityTranslator(),
+ createEmbeddableTranslator()
+ };
+ }
+
+ private Translator createVersionTranslator() {
+ return new Translator(VERSION, ORM_PKG.getEntityMappings_Version(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createDescriptionTranslator() {
+ return new Translator(DESCRIPTION, ORM_PKG.getEntityMappings_Description());
+ }
+
+ private Translator createPersistenceUnitMetadataTranslator() {
+ return new PersistenceUnitMetadataTranslator(PERSISTENCE_UNIT_METADATA, ORM_PKG.getEntityMappings_PersistenceUnitMetadata());
+ }
+
+ private Translator createPackageTranslator() {
+ return new Translator(PACKAGE, ORM_PKG.getEntityMappings_Package());
+ }
+
+ private Translator createSchemaTranslator() {
+ return new Translator(SCHEMA, ORM_PKG.getEntityMappings_Schema());
+ }
+
+ private Translator createCatalogTranslator() {
+ return new Translator(CATALOG, ORM_PKG.getEntityMappings_Catalog());
+ }
+
+ private Translator createAccessTranslator() {
+ return new Translator(ACCESS, ORM_PKG.getEntityMappings_Access());
+ }
+
+ private Translator createSequenceGeneratorTranslator() {
+ return new SequenceGeneratorTranslator(SEQUENCE_GENERATOR, ORM_PKG.getEntityMappings_SequenceGenerators());
+ }
+
+ private Translator createTableGeneratorTranslator() {
+ return new TableGeneratorTranslator(TABLE_GENERATOR, ORM_PKG.getEntityMappings_TableGenerators());
+ }
+
+ private Translator createNamedQueryTranslator() {
+ return new NamedQueryTranslator(NAMED_QUERY, ORM_PKG.getEntityMappings_NamedQueries());
+ }
+
+ private Translator createNamedNativeQueryTranslator() {
+ return new NamedNativeQueryTranslator(NAMED_NATIVE_QUERY, ORM_PKG.getEntityMappings_NamedNativeQueries());
+ }
+
+ private Translator createSqlResultSetMappingTranslator() {
+ return new SqlResultSetMappingTranslator(SQL_RESULT_SET_MAPPING, ORM_PKG.getEntityMappings_SqlResultSetMappings());
+ }
+
+ private Translator createMappedSuperclassTranslator() {
+ return new MappedSuperclassTranslator(MAPPED_SUPERCLASS, ORM_PKG.getEntityMappings_MappedSuperclasses());
+ }
+
+ private Translator createEntityTranslator() {
+ return new EntityTranslator(ENTITY, ORM_PKG.getEntityMappings_Entities());
+ }
+
+ private Translator createEmbeddableTranslator() {
+ return new EmbeddableTranslator(EMBEDDABLE, ORM_PKG.getEntityMappings_Embeddables());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityResultTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityResultTranslator.java
new file mode 100644
index 0000000000..b09a1965f9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityResultTranslator.java
@@ -0,0 +1,45 @@
+package org.eclipse.jpt.core.internal.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class EntityResultTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public EntityResultTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createEntityClassTranslator(),
+ createDiscriminatorColumnTranslator(),
+ createFieldResultTranslator()
+ };
+ }
+
+ private Translator createEntityClassTranslator() {
+ return new Translator(ENTITY_CLASS, ORM_PKG.getEntityResult_EntityClass(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createDiscriminatorColumnTranslator() {
+ return new Translator(DISCRIMINATOR_COLUMN, ORM_PKG.getEntityResult_DiscriminatorColumn(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createFieldResultTranslator() {
+ return new FieldResultTranslator(FIELD_RESULT, ORM_PKG.getEntityResult_FieldResults());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityTranslator.java
new file mode 100644
index 0000000000..dc948b1229
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EntityTranslator.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class EntityTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public EntityTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createClassTranslator(),
+ createAccessTranslator(),
+ createMetadataCompleteTranslator(),
+ createDescriptionTranslator(),
+ createTableTranslator(),
+ createSecondaryTableTranslator(),
+ createPrimaryKeyJoinColumnTranslator(),
+ createIdClassTranslator(),
+ createInheritanceTranslator(),
+ createDiscriminatorValueTranslator(),
+ createDiscriminatorColumnTranslator(),
+ createSequenceGeneratorTranslator(),
+ createTableGeneratorTranslator(),
+ createNamedQueryTranslator(),
+ createNamedNativeQueryTranslator(),
+ createSqlResultSetMappingTranslator(),
+ createExcludeDefaultListenersTranslator(),
+ createExcludeSuperclassListenersTranslator(),
+ createEntityListenersTranslator(),
+ createPrePersistTranslator(),
+ createPostPersistTranslator(),
+ createPreRemoveTranslator(),
+ createPostRemoveTranslator(),
+ createPreUpdateTranslator(),
+ createPostUpdateTranslator(),
+ createPostLoadTranslator(),
+ createAttributeOverrideTranslator(),
+ createAssociationOverrideTranslator(),
+ createAttributesTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getEntity_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createClassTranslator() {
+ return new Translator(CLASS, ORM_PKG.getTypeMapping_ClassName(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createAccessTranslator() {
+ return new Translator(ACCESS, ORM_PKG.getTypeMapping_Access(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createMetadataCompleteTranslator() {
+ return new Translator(METADATA_COMPLETE, ORM_PKG.getTypeMapping_MetadataComplete(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createDescriptionTranslator() {
+ return new Translator(DESCRIPTION, ORM_PKG.getTypeMapping_Description());
+ }
+
+ private Translator createTableTranslator() {
+ return new TableTranslator(TABLE, ORM_PKG.getEntity_Table());
+ }
+
+ private Translator createSecondaryTableTranslator() {
+ return new SecondaryTableTranslator(SECONDARY_TABLE, ORM_PKG.getEntity_SecondaryTables());
+ }
+
+ private Translator createPrimaryKeyJoinColumnTranslator() {
+ return new PrimaryKeyJoinColumnTranslator(PRIMARY_KEY_JOIN_COLUMN, ORM_PKG.getEntity_PrimaryKeyJoinColumns());
+ }
+
+ private Translator createIdClassTranslator() {
+ return new IdClassTranslator(ID_CLASS, ORM_PKG.getEntity_IdClass());
+ }
+
+ private Translator createInheritanceTranslator() {
+ return new InheritanceTranslator(INHERITANCE, ORM_PKG.getEntity_Inheritance());
+ }
+
+ private Translator createDiscriminatorValueTranslator() {
+ return new Translator(DISCRIMINATOR_VALUE, ORM_PKG.getEntity_DiscriminatorValue());
+ }
+
+ private Translator createDiscriminatorColumnTranslator() {
+ return new DiscriminatorColumnTranslator(DISCRIMINATOR_COLUMN, ORM_PKG.getEntity_DiscriminatorColumn());
+ }
+
+ private Translator createSequenceGeneratorTranslator() {
+ return new SequenceGeneratorTranslator(SEQUENCE_GENERATOR, ORM_PKG.getEntity_SequenceGenerator());
+ }
+
+ private Translator createTableGeneratorTranslator() {
+ return new TableGeneratorTranslator(TABLE_GENERATOR, ORM_PKG.getEntity_TableGenerator());
+ }
+
+ private Translator createNamedQueryTranslator() {
+ return new NamedQueryTranslator(NAMED_QUERY, ORM_PKG.getEntity_NamedQueries());
+ }
+
+ private Translator createNamedNativeQueryTranslator() {
+ return new NamedNativeQueryTranslator(NAMED_NATIVE_QUERY, ORM_PKG.getEntity_NamedNativeQueries());
+ }
+
+ private Translator createSqlResultSetMappingTranslator() {
+ return new SqlResultSetMappingTranslator(SQL_RESULT_SET_MAPPING, ORM_PKG.getEntity_SqlResultSetMappings());
+ }
+
+ private Translator createExcludeDefaultListenersTranslator() {
+ return new EmptyTagBooleanTranslator(EXCLUDE_DEFAULT_LISTENERS, ORM_PKG.getEntity_ExcludeDefaultListeners());
+ }
+
+ private Translator createExcludeSuperclassListenersTranslator() {
+ return new EmptyTagBooleanTranslator(EXCLUDE_SUPERCLASS_LISTENERS, ORM_PKG.getEntity_ExcludeSuperclassListeners());
+ }
+
+ private Translator createEntityListenersTranslator() {
+ return new EntityListenersTranslator(ENTITY_LISTENERS, ORM_PKG.getEntity_EntityListeners());
+ }
+
+ private Translator createPrePersistTranslator() {
+ return new EventMethodTranslator(PRE_PERSIST, ORM_PKG.getEntity_PrePersist());
+ }
+
+ private Translator createPostPersistTranslator() {
+ return new EventMethodTranslator(POST_PERSIST, ORM_PKG.getEntity_PostPersist());
+ }
+
+ private Translator createPreRemoveTranslator() {
+ return new EventMethodTranslator(PRE_REMOVE, ORM_PKG.getEntity_PreRemove());
+ }
+
+ private Translator createPostRemoveTranslator() {
+ return new EventMethodTranslator(POST_REMOVE, ORM_PKG.getEntity_PostRemove());
+ }
+
+ private Translator createPreUpdateTranslator() {
+ return new EventMethodTranslator(PRE_UPDATE, ORM_PKG.getEntity_PreUpdate());
+ }
+
+ private Translator createPostUpdateTranslator() {
+ return new EventMethodTranslator(POST_UPDATE, ORM_PKG.getEntity_PostUpdate());
+ }
+
+ private Translator createPostLoadTranslator() {
+ return new EventMethodTranslator(POST_LOAD, ORM_PKG.getEntity_PostLoad());
+ }
+
+ private Translator createAttributeOverrideTranslator() {
+ return new AttributeOverrideTranslator(ATTRIBUTE_OVERRIDE, ORM_PKG.getEntity_AttributeOverrides());
+ }
+
+ private Translator createAssociationOverrideTranslator() {
+ return new AssociationOverrideTranslator(ASSOCIATION_OVERRIDE, ORM_PKG.getEntity_AssociationOverrides());
+ }
+
+ private Translator createAttributesTranslator() {
+ return new AttributesTranslator(ATTRIBUTES, ORM_PKG.getTypeMapping_Attributes());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EventMethodTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EventMethodTranslator.java
new file mode 100644
index 0000000000..e0158d1a0c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/EventMethodTranslator.java
@@ -0,0 +1,35 @@
+package org.eclipse.jpt.core.internal.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class EventMethodTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public EventMethodTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ private Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createMethodNameTranslator()
+ };
+ }
+
+ private Translator createMethodNameTranslator() {
+ return new Translator(METHOD_NAME, ORM_PKG.getEventMethod_MethodName(), DOM_ATTRIBUTE);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/FieldResultTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/FieldResultTranslator.java
new file mode 100644
index 0000000000..0c2ac780ba
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/FieldResultTranslator.java
@@ -0,0 +1,40 @@
+package org.eclipse.jpt.core.internal.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class FieldResultTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public FieldResultTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createColumnTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getFieldResult_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createColumnTranslator() {
+ return new Translator(COLUMN, ORM_PKG.getFieldResult_Column(), DOM_ATTRIBUTE);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/InheritanceTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/GeneratedValueTranslator.java
index ee3a823835..4bd0396ba8 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/InheritanceTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/GeneratedValueTranslator.java
@@ -6,47 +6,43 @@
*
* Contributors: Oracle. - initial API and implementation
*******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm.resource;
+package org.eclipse.jpt.core.internal.resource.orm.translators;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
import org.eclipse.wst.common.internal.emf.resource.Translator;
-public class InheritanceTranslator extends Translator implements OrmXmlMapper
+public class GeneratedValueTranslator extends Translator
+ implements OrmXmlMapper
{
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
-
-
private Translator[] children;
- public InheritanceTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+
+ public GeneratedValueTranslator(String domNameAndPath, EStructuralFeature aFeature) {
super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
}
+ @Override
public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
+ if (this.children == null) {
+ this.children = createChildren();
}
- return children;
+ return this.children;
}
protected Translator[] createChildren() {
return new Translator[] {
IDTranslator.INSTANCE,
createStrategyTranslator(),
+ createGeneratorTranslator()
};
}
protected Translator createStrategyTranslator() {
- return new EnumeratorTranslator(INHERITANCE__STRATEGY, JPA_CORE_XML_PKG.getXmlInheritance_Strategy(), DOM_ATTRIBUTE);
+ return new Translator(STRATEGY, ORM_PKG.getGeneratedValue_Strategy(), DOM_ATTRIBUTE);
}
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return OrmFactory.eINSTANCE.createXmlInheritance();
+
+ protected Translator createGeneratorTranslator() {
+ return new Translator(GENERATOR, ORM_PKG.getGeneratedValue_Generator(), DOM_ATTRIBUTE);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/IdClassTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/IdClassTranslator.java
index 4d10df1e2f..81b2ba5703 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/IdClassTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/IdClassTranslator.java
@@ -6,47 +6,38 @@
*
* Contributors: Oracle. - initial API and implementation
*******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm.resource;
+package org.eclipse.jpt.core.internal.resource.orm.translators;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
import org.eclipse.wst.common.internal.emf.resource.Translator;
-public class IdClassTranslator extends Translator implements OrmXmlMapper
+public class IdClassTranslator extends Translator
+ implements OrmXmlMapper
{
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
-
-
private Translator[] children;
+
public IdClassTranslator(String domNameAndPath, EStructuralFeature aFeature) {
- super(domNameAndPath, aFeature);
+ super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
}
+ @Override
public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
+ if (this.children == null) {
+ this.children = createChildren();
}
- return children;
+ return this.children;
}
protected Translator[] createChildren() {
return new Translator[] {
IDTranslator.INSTANCE,
- createValueTranslator(),
+ createClassTranslator()
};
}
- protected Translator createValueTranslator() {
- return new Translator(ID_CLASS__CLASS, JPA_CORE_XML_PKG.getXmlIdClass_Value(), DOM_ATTRIBUTE);
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return OrmFactory.eINSTANCE.createXmlIdClass();
+ protected Translator createClassTranslator() {
+ return new Translator(CLASS, ORM_PKG.getIdClass_ClassName(), DOM_ATTRIBUTE);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/IdTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/IdTranslator.java
new file mode 100644
index 0000000000..22eca1024a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/IdTranslator.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class IdTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public IdTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createColumnTranslator(),
+ createGeneratedValueTranslator(),
+ createTemporalTranslator(),
+ createTableGeneratorTranslator(),
+ createSequenceGeneratorTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getAttributeMapping_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createColumnTranslator() {
+ return new Translator(COLUMN, ORM_PKG.getColumnMapping_Column());
+ }
+
+ private Translator createGeneratedValueTranslator() {
+ return new GeneratedValueTranslator(GENERATED_VALUE, ORM_PKG.getId_GeneratedValue());
+ }
+
+ private Translator createTemporalTranslator() {
+ return new Translator(TEMPORAL, ORM_PKG.getId_Temporal());
+ }
+
+ private Translator createTableGeneratorTranslator() {
+ return new TableGeneratorTranslator(TABLE_GENERATOR, ORM_PKG.getId_TableGenerator());
+ }
+
+ private Translator createSequenceGeneratorTranslator() {
+ return new SequenceGeneratorTranslator(SEQUENCE_GENERATOR, ORM_PKG.getId_SequenceGenerator());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/InheritanceTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/InheritanceTranslator.java
new file mode 100644
index 0000000000..8868e8bc88
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/InheritanceTranslator.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class InheritanceTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public InheritanceTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ createStrategyTranslator(),
+ };
+ }
+
+ private Translator createStrategyTranslator() {
+ return new Translator(STRATEGY, ORM_PKG.getInheritance_Strategy(), DOM_ATTRIBUTE);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/JoinColumnTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/JoinColumnTranslator.java
new file mode 100644
index 0000000000..68c14add3e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/JoinColumnTranslator.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.core.internal.resource.common.translators.BooleanTranslator;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class JoinColumnTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public JoinColumnTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createReferencedColumnNameTranslator(),
+ createUniqueTranslator(),
+ createNullableTranslator(),
+ createInsertableTranslator(),
+ createUpdatableTranslator(),
+ createColumnDefinitionTranslator(),
+ createTableTranslator(),
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getNamedColumn_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createReferencedColumnNameTranslator() {
+ return new Translator(REFERENCED_COLUMN_NAME, ORM_PKG.getJoinColumn_ReferencedColumnName(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createUniqueTranslator() {
+ return new BooleanTranslator(UNIQUE, ORM_PKG.getAbstractColumn_Unique(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createNullableTranslator() {
+ return new BooleanTranslator(NULLABLE, ORM_PKG.getAbstractColumn_Nullable(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createInsertableTranslator() {
+ return new BooleanTranslator(INSERTABLE, ORM_PKG.getAbstractColumn_Insertable(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createUpdatableTranslator() {
+ return new BooleanTranslator(UPDATABLE, ORM_PKG.getAbstractColumn_Updatable(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createColumnDefinitionTranslator() {
+ return new Translator(COLUMN_DEFINITION, ORM_PKG.getNamedColumn_ColumnDefinition(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createTableTranslator() {
+ return new Translator(TABLE, ORM_PKG.getAbstractColumn_Table(), DOM_ATTRIBUTE);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/JoinTableTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/JoinTableTranslator.java
new file mode 100644
index 0000000000..1a50d064fe
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/JoinTableTranslator.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class JoinTableTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public JoinTableTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createCatalogTranslator(),
+ createSchemaTranslator(),
+ createJoinColumnTranslator(),
+ createInverseJoinColumnTranslator(),
+ createUniqueConstraintTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getAbstractTable_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createCatalogTranslator() {
+ return new Translator(CATALOG, ORM_PKG.getAbstractTable_Catalog(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createSchemaTranslator() {
+ return new Translator(SCHEMA, ORM_PKG.getAbstractTable_Schema(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createJoinColumnTranslator() {
+ return new JoinColumnTranslator(JOIN_COLUMN, ORM_PKG.getJoinTable_JoinColumns());
+ }
+
+ private Translator createInverseJoinColumnTranslator() {
+ return new JoinColumnTranslator(INVERSE_JOIN_COLUMN, ORM_PKG.getJoinTable_InverseJoinColumns());
+ }
+
+ private Translator createUniqueConstraintTranslator() {
+ return new UniqueConstraintTranslator(UNIQUE_CONSTRAINT, ORM_PKG.getAbstractTable_UniqueConstraints());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/ManyToManyTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/ManyToManyTranslator.java
new file mode 100644
index 0000000000..145f3455ee
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/ManyToManyTranslator.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class ManyToManyTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public ManyToManyTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createTargetEntityTranslator(),
+ createFetchTranslator(),
+ createMappedByTranslator(),
+ createOrderByTranslator(),
+ createMapKeyTranslator(),
+ createJoinTableTranslator(),
+ createCascadeTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getAttributeMapping_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createTargetEntityTranslator() {
+ return new Translator(TARGET_ENTITY, ORM_PKG.getRelationshipMapping_TargetEntity(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createFetchTranslator() {
+ return new Translator(FETCH, ORM_PKG.getRelationshipMapping_Fetch(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createMappedByTranslator() {
+ return new Translator(MAPPED_BY, ORM_PKG.getMultiRelationshipMapping_MappedBy(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createOrderByTranslator() {
+ return new Translator(ORDER_BY, ORM_PKG.getMultiRelationshipMapping_OrderBy());
+ }
+
+ private Translator createMapKeyTranslator() {
+ return new Translator(MAP_KEY, ORM_PKG.getMultiRelationshipMapping_MapKey());
+ }
+
+ private Translator createJoinTableTranslator() {
+ return new JoinTableTranslator(JOIN_TABLE, ORM_PKG.getRelationshipMapping_JoinTable());
+ }
+
+ private Translator createCascadeTranslator() {
+ return new CascadeTypeTranslator(CASCADE, ORM_PKG.getRelationshipMapping_Cascade());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/ManyToOneTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/ManyToOneTranslator.java
new file mode 100644
index 0000000000..3db30b669e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/ManyToOneTranslator.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class ManyToOneTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public ManyToOneTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createTargetEntityTranslator(),
+ createFetchTranslator(),
+ createOptionalTranslator(),
+ createJoinColumnTranslator(),
+ createJoinTableTranslator(),
+ createCascadeTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getAttributeMapping_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createTargetEntityTranslator() {
+ return new Translator(TARGET_ENTITY, ORM_PKG.getRelationshipMapping_TargetEntity(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createFetchTranslator() {
+ return new Translator(FETCH, ORM_PKG.getRelationshipMapping_Fetch(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createOptionalTranslator() {
+ return new Translator(OPTIONAL, ORM_PKG.getSingleRelationshipMapping_Optional(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createJoinColumnTranslator() {
+ return new JoinColumnTranslator(JOIN_COLUMN, ORM_PKG.getSingleRelationshipMapping_JoinColumns());
+ }
+
+ private Translator createJoinTableTranslator() {
+ return new JoinTableTranslator(JOIN_TABLE, ORM_PKG.getRelationshipMapping_JoinTable());
+ }
+
+ private Translator createCascadeTranslator() {
+ return new CascadeTypeTranslator(CASCADE, ORM_PKG.getRelationshipMapping_Cascade());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MapKeyTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/MapKeyTranslator.java
index 8206e09ca3..cc5aaef63a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/MapKeyTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/MapKeyTranslator.java
@@ -6,48 +6,39 @@
*
* Contributors: Oracle. - initial API and implementation
*******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm.resource;
+package org.eclipse.jpt.core.internal.resource.orm.translators;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
import org.eclipse.wst.common.internal.emf.resource.Translator;
-public class MapKeyTranslator extends Translator implements OrmXmlMapper
+public class MapKeyTranslator extends Translator
+ implements OrmXmlMapper
{
- protected static final OrmPackage JPA_CORE_XML_PKG =
- OrmPackage.eINSTANCE;
-
-
private Translator[] children;
+
public MapKeyTranslator(String domNameAndPath, EStructuralFeature aFeature) {
- super(domNameAndPath, aFeature);
+ super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
}
+ @Override
public Translator[] getChildren(Object target, int versionID) {
- if (children == null) {
- children = createChildren();
+ if (this.children == null) {
+ this.children = createChildren();
}
- return children;
+ return this.children;
}
protected Translator[] createChildren() {
return new Translator[] {
IDTranslator.INSTANCE,
- createNameTranslator(),
+ createNameTranslator()
};
}
protected Translator createNameTranslator() {
- return new Translator(MAP_KEY__NAME, JPA_CORE_XML_PKG.getXmlMapKey_Name(), DOM_ATTRIBUTE);
- }
-
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return OrmFactory.eINSTANCE.createXmlIdClass();
+ return new Translator(NAME, ORM_PKG.getMapKey_Name(), DOM_ATTRIBUTE);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/MappedSuperclassTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/MappedSuperclassTranslator.java
new file mode 100644
index 0000000000..cb61364fb1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/MappedSuperclassTranslator.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class MappedSuperclassTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public MappedSuperclassTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createClassTranslator(),
+ createAccessTranslator(),
+ createMetadataCompleteTranslator(),
+ createDescriptionTranslator(),
+ createIdClassTranslator(),
+ createExcludeDefaultListenersTranslator(),
+ createExcludeSuperclassListenersTranslator(),
+ createEntityListenersTranslator(),
+ createPrePersistTranslator(),
+ createPostPersistTranslator(),
+ createPreRemoveTranslator(),
+ createPostRemoveTranslator(),
+ createPreUpdateTranslator(),
+ createPostUpdateTranslator(),
+ createPostLoadTranslator(),
+ createAttributesTranslator()
+ };
+ }
+
+ private Translator createClassTranslator() {
+ return new Translator(CLASS, ORM_PKG.getTypeMapping_ClassName(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createAccessTranslator() {
+ return new Translator(ACCESS, ORM_PKG.getTypeMapping_Access(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createMetadataCompleteTranslator() {
+ return new Translator(METADATA_COMPLETE, ORM_PKG.getTypeMapping_MetadataComplete(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createDescriptionTranslator() {
+ return new Translator(DESCRIPTION, ORM_PKG.getTypeMapping_Description());
+ }
+
+ private Translator createIdClassTranslator() {
+ return new IdClassTranslator(ID_CLASS, ORM_PKG.getMappedSuperclass_IdClass());
+ }
+
+ private Translator createExcludeDefaultListenersTranslator() {
+ return new EmptyTagBooleanTranslator(EXCLUDE_DEFAULT_LISTENERS, ORM_PKG.getMappedSuperclass_ExcludeDefaultListeners());
+ }
+
+ private Translator createExcludeSuperclassListenersTranslator() {
+ return new EmptyTagBooleanTranslator(EXCLUDE_SUPERCLASS_LISTENERS, ORM_PKG.getMappedSuperclass_ExcludeSuperclassListeners());
+ }
+
+ private Translator createEntityListenersTranslator() {
+ return new EntityListenersTranslator(ENTITY_LISTENERS, ORM_PKG.getMappedSuperclass_EntityListeners());
+ }
+
+ private Translator createPrePersistTranslator() {
+ return new EventMethodTranslator(PRE_PERSIST, ORM_PKG.getMappedSuperclass_PrePersist());
+ }
+
+ private Translator createPostPersistTranslator() {
+ return new EventMethodTranslator(POST_PERSIST, ORM_PKG.getMappedSuperclass_PostPersist());
+ }
+
+ private Translator createPreRemoveTranslator() {
+ return new EventMethodTranslator(PRE_REMOVE, ORM_PKG.getMappedSuperclass_PreRemove());
+ }
+
+ private Translator createPostRemoveTranslator() {
+ return new EventMethodTranslator(POST_REMOVE, ORM_PKG.getMappedSuperclass_PostRemove());
+ }
+
+ private Translator createPreUpdateTranslator() {
+ return new EventMethodTranslator(PRE_UPDATE, ORM_PKG.getMappedSuperclass_PreUpdate());
+ }
+
+ private Translator createPostUpdateTranslator() {
+ return new EventMethodTranslator(POST_UPDATE, ORM_PKG.getMappedSuperclass_PostUpdate());
+ }
+
+ private Translator createPostLoadTranslator() {
+ return new EventMethodTranslator(POST_LOAD, ORM_PKG.getMappedSuperclass_PostLoad());
+ }
+
+ private Translator createAttributesTranslator() {
+ return new AttributesTranslator(ATTRIBUTES, ORM_PKG.getTypeMapping_Attributes());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/NamedNativeQueryTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/NamedNativeQueryTranslator.java
new file mode 100644
index 0000000000..7c023a4faa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/NamedNativeQueryTranslator.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class NamedNativeQueryTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public NamedNativeQueryTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createResultClassTranslator(),
+ createResultSetMappingTranslator(),
+ createQueryTranslator(),
+ createHintTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getQuery_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createResultClassTranslator() {
+ return new Translator(RESULT_CLASS, ORM_PKG.getNamedNativeQuery_ResultClass(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createResultSetMappingTranslator() {
+ return new Translator(RESULT_SET_MAPPING, ORM_PKG.getNamedNativeQuery_ResultSetMapping(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createQueryTranslator() {
+ return new Translator(QUERY, ORM_PKG.getQuery_Query());
+ }
+
+ private Translator createHintTranslator() {
+ return new QueryHintTranslator(HINT, ORM_PKG.getQuery_Hints());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/NamedQueryTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/NamedQueryTranslator.java
new file mode 100644
index 0000000000..6bd124d4a5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/NamedQueryTranslator.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class NamedQueryTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public NamedQueryTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createQueryTranslator(),
+ createHintTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getQuery_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createQueryTranslator() {
+ return new Translator(QUERY, ORM_PKG.getQuery_Query());
+ }
+
+ private Translator createHintTranslator() {
+ return new QueryHintTranslator(HINT, ORM_PKG.getQuery_Hints());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/OneToManyTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/OneToManyTranslator.java
new file mode 100644
index 0000000000..a6f1161464
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/OneToManyTranslator.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class OneToManyTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public OneToManyTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createTargetEntityTranslator(),
+ createFetchTranslator(),
+ createMappedByTranslator(),
+ createOrderByTranslator(),
+ createMapKeyTranslator(),
+ createJoinTableTranslator(),
+ createJoinColumnTranslator(),
+ createCascadeTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getAttributeMapping_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createTargetEntityTranslator() {
+ return new Translator(TARGET_ENTITY, ORM_PKG.getRelationshipMapping_TargetEntity(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createFetchTranslator() {
+ return new Translator(FETCH, ORM_PKG.getRelationshipMapping_Fetch(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createMappedByTranslator() {
+ return new Translator(MAPPED_BY, ORM_PKG.getMultiRelationshipMapping_MappedBy(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createOrderByTranslator() {
+ return new Translator(ORDER_BY, ORM_PKG.getMultiRelationshipMapping_OrderBy());
+ }
+
+ private Translator createMapKeyTranslator() {
+ return new MapKeyTranslator(MAP_KEY, ORM_PKG.getMultiRelationshipMapping_MapKey());
+ }
+
+ private Translator createJoinTableTranslator() {
+ return new JoinTableTranslator(JOIN_TABLE, ORM_PKG.getRelationshipMapping_JoinTable());
+ }
+
+ private Translator createJoinColumnTranslator() {
+ return new JoinColumnTranslator(JOIN_COLUMN, ORM_PKG.getOneToMany_JoinColumns());
+ }
+
+ private Translator createCascadeTranslator() {
+ return new CascadeTypeTranslator(CASCADE, ORM_PKG.getRelationshipMapping_Cascade());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/OneToOneTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/OneToOneTranslator.java
new file mode 100644
index 0000000000..826010a158
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/OneToOneTranslator.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class OneToOneTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public OneToOneTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createTargetEntityTranslator(),
+ createFetchTranslator(),
+ createOptionalTranslator(),
+ createMappedByTranslator(),
+ createPrimaryKeyJoinColumnTranslator(),
+ createJoinColumnTranslator(),
+ createJoinTableTranslator(),
+ createCascadeTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getAttributeMapping_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createTargetEntityTranslator() {
+ return new Translator(TARGET_ENTITY, ORM_PKG.getRelationshipMapping_TargetEntity(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createFetchTranslator() {
+ return new Translator(FETCH, ORM_PKG.getRelationshipMapping_Fetch(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createOptionalTranslator() {
+ return new Translator(OPTIONAL, ORM_PKG.getSingleRelationshipMapping_Optional(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createMappedByTranslator() {
+ return new Translator(MAPPED_BY, ORM_PKG.getOneToOne_MappedBy(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createPrimaryKeyJoinColumnTranslator() {
+ return new PrimaryKeyJoinColumnTranslator(PRIMARY_KEY_JOIN_COLUMN, ORM_PKG.getOneToOne_PrimaryKeyJoinColumns());
+ }
+
+ private Translator createJoinColumnTranslator() {
+ return new JoinColumnTranslator(JOIN_COLUMN, ORM_PKG.getSingleRelationshipMapping_JoinColumns());
+ }
+
+ private Translator createJoinTableTranslator() {
+ return new JoinTableTranslator(JOIN_TABLE, ORM_PKG.getRelationshipMapping_JoinTable());
+ }
+
+ private Translator createCascadeTranslator() {
+ return new CascadeTypeTranslator(CASCADE, ORM_PKG.getRelationshipMapping_Cascade());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/OrmXmlMapper.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/OrmXmlMapper.java
new file mode 100644
index 0000000000..910cdb0cb1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/OrmXmlMapper.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.orm.translators;
+
+import org.eclipse.jpt.core.internal.resource.orm.OrmPackage;
+
+public interface OrmXmlMapper
+{
+ OrmPackage ORM_PKG = OrmPackage.eINSTANCE;
+
+ String XML_NS = "xmlns"; //$NON-NLS-1$
+ String XML_NS_XSI = "xmlns:xsi"; //$NON-NLS-1$
+ String XSI_SCHEMA_LOCATION = "xsi:schemaLocation"; //$NON-NLS-1$
+ String XSI_NS_URL = "http://www.w3.org/2001/XMLSchema-instance"; //$NON-NLS-1$
+ String PERSISTENCE_NS_URL = "http://java.sun.com/xml/ns/persistence/orm"; //$NON-NLS-1$
+ String ORM_SCHEMA_LOC_1_0 = "http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"; //$NON-NLS-1$
+
+
+ String ACCESS = "access"; //$NON-NLS-1$
+ String ALLOCATION_SIZE = "allocation-size"; //$NON-NLS-1$
+ String ASSOCIATION_OVERRIDE = "association-override"; //$NON-NLS-1$
+ String ATTRIBUTE_OVERRIDE = "attribute-override"; //$NON-NLS-1$
+ String ATTRIBUTES = "attributes"; //$NON-NLS-1$
+ String BASIC = "basic"; //$NON-NLS-1$
+ String CASCADE = "cascade"; //$NON-NLS-1$
+ String CASCADE_ALL = "cascade-all"; //$NON-NLS-1$
+ String CASCADE_MERGE = "cascade-merge"; //$NON-NLS-1$
+ String CASCADE_PERSIST = "cascade-persist"; //$NON-NLS-1$
+ String CASCADE_REFRESH = "cascade-refresh"; //$NON-NLS-1$
+ String CASCADE_REMOVE = "cascade-remove"; //$NON-NLS-1$
+ String CATALOG = "catalog"; //$NON-NLS-1$
+ String CLASS = "class"; //$NON-NLS-1$
+ String COLUMN = "column"; //$NON-NLS-1$
+ String COLUMN_DEFINITION= "column-definition"; //$NON-NLS-1$
+ String COLUMN_NAME = "column-name"; //$NON-NLS-1$
+ String COLUMN_RESULT = "column-result"; //$NON-NLS-1$
+ String DESCRIPTION = "description"; //$NON-NLS-1$
+ String DISCRIMINATOR_COLUMN = "discriminator-column"; //$NON-NLS-1$
+ String DISCRIMINATOR_TYPE = "discriminator-type"; //$NON-NLS-1$
+ String DISCRIMINATOR_VALUE = "discriminator-value"; //$NON-NLS-1$
+ String EMBEDDABLE = "embeddable"; //$NON-NLS-1$
+ String EMBEDDED = "embedded"; //$NON-NLS-1$
+ String EMBEDDED_ID = "embedded-id"; //$NON-NLS-1$
+ String ENTITY = "entity"; //$NON-NLS-1$
+ String ENTITY_CLASS = "entity-class"; //$NON-NLS-1$
+ String ENTITY_LISTENER = "entity-listener"; //$NON-NLS-1$
+ String ENTITY_LISTENERS = "entity-listeners"; //$NON-NLS-1$
+ String ENTITY_MAPPINGS = "entity-mappings"; //$NON-NLS-1$
+ String ENTITY_RESULT = "entity-result"; //$NON-NLS-1$
+ String ENUMERATED = "enumerated"; //$NON-NLS-1$
+ String EXCLUDE_DEFAULT_LISTENERS = "exclude-default-listeners"; //$NON-NLS-1$
+ String EXCLUDE_SUPERCLASS_LISTENERS = "exclude-superclass-listeners"; //$NON-NLS-1$
+ String FETCH = "fetch"; //$NON-NLS-1$
+ String FIELD_RESULT = "field-result"; //$NON-NLS-1$
+ String GENERATED_VALUE = "generated-value"; //$NON-NLS-1$
+ String GENERATOR = "generator"; //$NON-NLS-1$
+ String HINT = "hint"; //$NON-NLS-1$
+ String ID = "id"; //$NON-NLS-1$
+ String ID_CLASS = "id-class"; //$NON-NLS-1$
+ String INHERITANCE = "inheritance"; //$NON-NLS-1$
+ String INITIAL_VALUE = "initial-value"; //$NON-NLS-1$
+ String INSERTABLE = "insertable"; //$NON-NLS-1$
+ String INVERSE_JOIN_COLUMN = "inverse-join-column"; //$NON-NLS-1$
+ String JOIN_COLUMN = "join-column"; //$NON-NLS-1$
+ String JOIN_TABLE = "join-table"; //$NON-NLS-1$
+ String LENGTH = "length"; //$NON-NLS-1$
+ String LOB = "lob"; //$NON-NLS-1$
+ String MANY_TO_MANY = "many-to-many"; //$NON-NLS-1$
+ String MANY_TO_ONE = "many-to-one"; //$NON-NLS-1$
+ String MAP_KEY = "map-key"; //$NON-NLS-1$
+ String MAPPED_BY = "mapped-by"; //$NON-NLS-1$
+ String MAPPED_SUPERCLASS = "mapped-superclass"; //$NON-NLS-1$
+ String METADATA_COMPLETE = "metadata-complete"; //$NON-NLS-1$
+ String METHOD_NAME = "method-name"; //$NON-NLS-1$
+ String NAME = "name"; //$NON-NLS-1$
+ String NAMED_NATIVE_QUERY = "named-native-query"; //$NON-NLS-1$
+ String NAMED_QUERY = "named-query"; //$NON-NLS-1$
+ String NULLABLE = "nullable"; //$NON-NLS-1$
+ String ONE_TO_MANY = "one-to-many"; //$NON-NLS-1$
+ String ONE_TO_ONE = "one-to-one"; //$NON-NLS-1$
+ String OPTIONAL = "optional"; //$NON-NLS-1$
+ String ORDER_BY = "order-by"; //$NON-NLS-1$
+ String PACKAGE = "package"; //$NON-NLS-1$
+ String PERSISTENCE_UNIT_DEFAULTS = "persistence-unit-defaults"; //$NON-NLS-1$
+ String PERSISTENCE_UNIT_METADATA = "persistence-unit-metadata"; //$NON-NLS-1$
+ String PK_COLUMN_NAME = "pk-column-name"; //$NON-NLS-1$
+ String PK_COLUMN_VALUE = "pk-column-value"; //$NON-NLS-1$
+ String POST_LOAD = "post-load"; //$NON-NLS-1$
+ String POST_PERSIST = "post-persist"; //$NON-NLS-1$
+ String POST_REMOVE = "post-remove"; //$NON-NLS-1$
+ String POST_UPDATE = "post-update"; //$NON-NLS-1$
+ String PRE_PERSIST = "pre-persist"; //$NON-NLS-1$
+ String PRE_REMOVE = "pre-remove"; //$NON-NLS-1$
+ String PRE_UPDATE = "pre-update"; //$NON-NLS-1$
+ String PRECISION= "precision"; //$NON-NLS-1$
+ String PRIMARY_KEY_JOIN_COLUMN = "primary-key-join-column"; //$NON-NLS-1$
+ String QUERY = "query"; //$NON-NLS-1$
+ String REFERENCED_COLUMN_NAME = "referenced-column-name"; //$NON-NLS-1$
+ String RESULT_CLASS = "result-class"; //$NON-NLS-1$
+ String RESULT_SET_MAPPING = "result-set-mapping"; //$NON-NLS-1$
+ String SCALE= "scale"; //$NON-NLS-1$
+ String SCHEMA = "schema"; //$NON-NLS-1$
+ String SECONDARY_TABLE = "secondary-table"; //$NON-NLS-1$
+ String SEQUENCE_GENERATOR = "sequence-generator"; //$NON-NLS-1$
+ String SEQUENCE_NAME = "sequence-name"; //$NON-NLS-1$
+ String SQL_RESULT_SET_MAPPING = "sql-result-set-mapping"; //$NON-NLS-1$
+ String STRATEGY = "strategy"; //$NON-NLS-1$
+ String TABLE = "table"; //$NON-NLS-1$
+ String TABLE_GENERATOR = "table-generator"; //$NON-NLS-1$
+ String TARGET_ENTITY = "target-entity"; //$NON-NLS-1$
+ String TEMPORAL = "temporal"; //$NON-NLS-1$
+ String TRANSIENT = "transient"; //$NON-NLS-1$
+ String UNIQUE = "unique"; //$NON-NLS-1$
+ String UNIQUE_CONSTRAINT = "unique-constraint"; //$NON-NLS-1$
+ String UPDATABLE = "updatable"; //$NON-NLS-1$
+ String VALUE = "value"; //$NON-NLS-1$
+ String VALUE_COLUMN_NAME = "value-column-name"; //$NON-NLS-1$
+ String VERSION = "version"; //$NON-NLS-1$
+ String XML_MAPPING_METADATA_COMPLETE = "xml-mapping-metadata-complete"; //$NON-NLS-1$
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/PersistenceUnitDefaultsTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/PersistenceUnitDefaultsTranslator.java
new file mode 100644
index 0000000000..9c8f80fe55
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/PersistenceUnitDefaultsTranslator.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class PersistenceUnitDefaultsTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public PersistenceUnitDefaultsTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ private Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createSchemaTranslator(),
+ createCatalogTranslator(),
+ createAccessTranslator(),
+ createCascadePersistTranslator(),
+ createEntityListenersTranslator()
+ };
+ }
+
+ private Translator createSchemaTranslator() {
+ return new Translator(SCHEMA, ORM_PKG.getPersistenceUnitDefaults_Schema());
+ }
+
+ private Translator createCatalogTranslator() {
+ return new Translator(CATALOG, ORM_PKG.getPersistenceUnitDefaults_Catalog());
+ }
+
+ private Translator createAccessTranslator() {
+ return new Translator(ACCESS, ORM_PKG.getPersistenceUnitDefaults_Access());
+ }
+
+ private Translator createCascadePersistTranslator() {
+ return new EmptyTagBooleanTranslator(CASCADE_PERSIST, ORM_PKG.getPersistenceUnitDefaults_CascadePersist());
+ }
+
+ private Translator createEntityListenersTranslator() {
+ return new EntityListenersTranslator(ENTITY_LISTENERS, ORM_PKG.getPersistenceUnitDefaults_EntityListeners());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/PersistenceUnitMetadataTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/PersistenceUnitMetadataTranslator.java
new file mode 100644
index 0000000000..6c40ef83cb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/PersistenceUnitMetadataTranslator.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class PersistenceUnitMetadataTranslator extends Translator implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public PersistenceUnitMetadataTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ private Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createXmlMappingMetadataCompleteTranslator(),
+ createPersistenceUnitDefaultsTranslator(),
+ };
+ }
+
+ private Translator createXmlMappingMetadataCompleteTranslator() {
+ return new EmptyTagBooleanTranslator(XML_MAPPING_METADATA_COMPLETE, ORM_PKG.getPersistenceUnitMetadata_XmlMappingMetadataComplete());
+ }
+
+ private Translator createPersistenceUnitDefaultsTranslator() {
+ return new PersistenceUnitDefaultsTranslator(PERSISTENCE_UNIT_DEFAULTS, ORM_PKG.getPersistenceUnitMetadata_PersistenceUnitDefaults());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/PrimaryKeyJoinColumnTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/PrimaryKeyJoinColumnTranslator.java
index 74a14c07a8..9b7fa2b131 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/PrimaryKeyJoinColumnTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/PrimaryKeyJoinColumnTranslator.java
@@ -7,29 +7,30 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm.resource;
+package org.eclipse.jpt.core.internal.resource.orm.translators;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
import org.eclipse.wst.common.internal.emf.resource.Translator;
-public class PrimaryKeyJoinColumnTranslator extends AbstractColumnTranslator
+public class PrimaryKeyJoinColumnTranslator extends Translator
implements OrmXmlMapper
{
- private PrimaryKeyJoinColumnBuilder joinColumnBuilder;
+ private Translator[] children;
- public PrimaryKeyJoinColumnTranslator(String domNameAndPath, EStructuralFeature aFeature, PrimaryKeyJoinColumnBuilder joinColumnBuilder) {
- super(domNameAndPath, aFeature);
- this.joinColumnBuilder = joinColumnBuilder;
+
+ public PrimaryKeyJoinColumnTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
}
-
+
@Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return joinColumnBuilder.createPrimaryKeyJoinColumn();
- }
-
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
protected Translator[] createChildren() {
return new Translator[] {
IDTranslator.INSTANCE,
@@ -39,11 +40,15 @@ public class PrimaryKeyJoinColumnTranslator extends AbstractColumnTranslator
};
}
- protected Translator createReferencedColumnNameTranslator() {
- return new Translator(REFERENCED_COLUMN_NAME, JPA_CORE_XML_PKG.getXmlPrimaryKeyJoinColumn_SpecifiedReferencedColumnNameForXml(), DOM_ATTRIBUTE);
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getNamedColumn_Name(), DOM_ATTRIBUTE);
}
-
- public interface PrimaryKeyJoinColumnBuilder {
- IPrimaryKeyJoinColumn createPrimaryKeyJoinColumn();
+
+ private Translator createReferencedColumnNameTranslator() {
+ return new Translator(REFERENCED_COLUMN_NAME, ORM_PKG.getPrimaryKeyJoinColumn_ReferencedColumnName(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createColumnDefinitionTranslator() {
+ return new Translator(COLUMN_DEFINITION, ORM_PKG.getNamedColumn_ColumnDefinition(), DOM_ATTRIBUTE);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SequenceGeneratorTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/QueryHintTranslator.java
index 054a61078a..c6987d9c94 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SequenceGeneratorTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/QueryHintTranslator.java
@@ -6,37 +6,43 @@
*
* Contributors: Oracle. - initial API and implementation
*******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm.resource;
+package org.eclipse.jpt.core.internal.resource.orm.translators;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
import org.eclipse.wst.common.internal.emf.resource.Translator;
-public class SequenceGeneratorTranslator extends GeneratorTranslator
+public class QueryHintTranslator extends Translator
+ implements OrmXmlMapper
{
+ private Translator[] children;
- public SequenceGeneratorTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+
+ public QueryHintTranslator(String domNameAndPath, EStructuralFeature aFeature) {
super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
}
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
protected Translator[] createChildren() {
return new Translator[] {
IDTranslator.INSTANCE,
createNameTranslator(),
- createSequenceNameTranslator(),
- createInitialValueTranslator(),
- createAllocationSizeTranslator(),
+ createValueTranslator(),
};
}
-
- protected Translator createSequenceNameTranslator() {
- return new Translator(SEQUENCE_GENERATOR__SEQUENCE_NAME, MAPPINGS_PKG.getISequenceGenerator_SpecifiedSequenceName(), DOM_ATTRIBUTE);
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getQueryHint_Name(), DOM_ATTRIBUTE);
}
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return OrmFactory.eINSTANCE.createXmlSequenceGenerator();
+ private Translator createValueTranslator() {
+ return new Translator(VALUE, ORM_PKG.getQueryHint_Value(), DOM_ATTRIBUTE);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/SecondaryTableTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/SecondaryTableTranslator.java
new file mode 100644
index 0000000000..71146281f7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/SecondaryTableTranslator.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class SecondaryTableTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public SecondaryTableTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createCatalogTranslator(),
+ createSchemaTranslator(),
+ createPrimaryKeyJoinColumnsTranslator(),
+ createUniqueConstraintTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getAbstractTable_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createCatalogTranslator() {
+ return new Translator(CATALOG, ORM_PKG.getAbstractTable_Catalog(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createSchemaTranslator() {
+ return new Translator(SCHEMA, ORM_PKG.getAbstractTable_Schema(), DOM_ATTRIBUTE);
+ }
+
+ protected Translator createPrimaryKeyJoinColumnsTranslator() {
+ return new PrimaryKeyJoinColumnTranslator(PRIMARY_KEY_JOIN_COLUMN, ORM_PKG.getSecondaryTable_PrimaryKeyJoinColumns());
+ }
+
+ private Translator createUniqueConstraintTranslator() {
+ return new UniqueConstraintTranslator(UNIQUE_CONSTRAINT, ORM_PKG.getAbstractTable_UniqueConstraints());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/SequenceGeneratorTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/SequenceGeneratorTranslator.java
new file mode 100644
index 0000000000..e7446fb179
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/SequenceGeneratorTranslator.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class SequenceGeneratorTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public SequenceGeneratorTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createSequenceNameTranslator(),
+ createInitialValueTranslator(),
+ createAllocationSizeTranslator(),
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getGenerator_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createSequenceNameTranslator() {
+ return new Translator(SEQUENCE_NAME, ORM_PKG.getSequenceGenerator_SequenceName(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createInitialValueTranslator() {
+ return new Translator(INITIAL_VALUE, ORM_PKG.getGenerator_InitialValue(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createAllocationSizeTranslator() {
+ return new Translator(ALLOCATION_SIZE, ORM_PKG.getGenerator_AllocationSize(), DOM_ATTRIBUTE);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/SqlResultSetMappingTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/SqlResultSetMappingTranslator.java
new file mode 100644
index 0000000000..916225227b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/SqlResultSetMappingTranslator.java
@@ -0,0 +1,45 @@
+package org.eclipse.jpt.core.internal.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class SqlResultSetMappingTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public SqlResultSetMappingTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createEntityResultTranslator(),
+ createColumnResultTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getSqlResultSetMapping_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createEntityResultTranslator() {
+ return new EntityResultTranslator(ENTITY_RESULT, ORM_PKG.getSqlResultSetMapping_EntityResults());
+ }
+
+ private Translator createColumnResultTranslator() {
+ return new ColumnResultTranslator(COLUMN_RESULT, ORM_PKG.getSqlResultSetMapping_ColumnResults());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/TableGeneratorTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/TableGeneratorTranslator.java
new file mode 100644
index 0000000000..790b0c8003
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/TableGeneratorTranslator.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class TableGeneratorTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public TableGeneratorTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createTableTranslator(),
+ createCatalogTranslator(),
+ createSchemaTranslator(),
+ createPkColumnNameTranslator(),
+ createValueColumnNameTranslator(),
+ createPkColumnValueTranslator(),
+ createInitialValueTranslator(),
+ createAllocationSizeTranslator(),
+ createUniqueConstraintTranslator(),
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getGenerator_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createTableTranslator() {
+ return new Translator(TABLE, ORM_PKG.getTableGenerator_Table(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createCatalogTranslator() {
+ return new Translator(CATALOG, ORM_PKG.getTableGenerator_Catalog(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createSchemaTranslator() {
+ return new Translator(SCHEMA, ORM_PKG.getTableGenerator_Schema(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createPkColumnNameTranslator() {
+ return new Translator(PK_COLUMN_NAME, ORM_PKG.getTableGenerator_PkColumnName(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createValueColumnNameTranslator() {
+ return new Translator(VALUE_COLUMN_NAME, ORM_PKG.getTableGenerator_ValueColumnName(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createPkColumnValueTranslator() {
+ return new Translator(PK_COLUMN_VALUE, ORM_PKG.getTableGenerator_PkColumnValue(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createInitialValueTranslator() {
+ return new Translator(INITIAL_VALUE, ORM_PKG.getGenerator_InitialValue(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createAllocationSizeTranslator() {
+ return new Translator(ALLOCATION_SIZE, ORM_PKG.getGenerator_AllocationSize(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createUniqueConstraintTranslator() {
+ return new UniqueConstraintTranslator(UNIQUE_CONSTRAINT, ORM_PKG.getTableGenerator_UniqueConstraints());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/TableTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/TableTranslator.java
new file mode 100644
index 0000000000..2566ea4fe2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/TableTranslator.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class TableTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public TableTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createCatalogTranslator(),
+ createSchemaTranslator(),
+ createUniqueConstraintTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getAbstractTable_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createCatalogTranslator() {
+ return new Translator(CATALOG, ORM_PKG.getAbstractTable_Catalog(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createSchemaTranslator() {
+ return new Translator(SCHEMA, ORM_PKG.getAbstractTable_Schema(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createUniqueConstraintTranslator() {
+ return new UniqueConstraintTranslator(UNIQUE_CONSTRAINT, ORM_PKG.getAbstractTable_UniqueConstraints());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EmbeddedIdTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/TransientTranslator.java
index 1874a2d58c..c341d4c9c9 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EmbeddedIdTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/TransientTranslator.java
@@ -7,35 +7,38 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm.resource;
+package org.eclipse.jpt.core.internal.resource.orm.translators;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
import org.eclipse.wst.common.internal.emf.resource.Translator;
-public class EmbeddedIdTranslator extends AttributeMappingTranslator
+public class TransientTranslator extends Translator
+ implements OrmXmlMapper
{
- public EmbeddedIdTranslator() {
- super(EMBEDDED_ID, NO_STYLE);
- }
+ private Translator[] children;
- @Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return JPA_CORE_XML_FACTORY.createXmlEmbeddedId();
+
+ public TransientTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
}
@Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
protected Translator[] createChildren() {
return new Translator[] {
IDTranslator.INSTANCE,
- createNameTranslator(),
- createPlaceHolderTranslator(EMBEDDED_ID__ATTRIBUTE_OVERRIDE),
+ createNameTranslator()
};
}
- private Translator createPlaceHolderTranslator(String domNameAndPath) {
- return new Translator(domNameAndPath, (EStructuralFeature) null);
- }
-
-
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getAttributeMapping_Name(), DOM_ATTRIBUTE);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EmbeddableTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/UniqueConstraintTranslator.java
index 2ea7194414..daf7e6d1dc 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/EmbeddableTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/UniqueConstraintTranslator.java
@@ -6,40 +6,38 @@
*
* Contributors: Oracle. - initial API and implementation
*******************************************************************************/
-package org.eclipse.jpt.core.internal.content.orm.resource;
+package org.eclipse.jpt.core.internal.resource.orm.translators;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
import org.eclipse.wst.common.internal.emf.resource.Translator;
-public class EmbeddableTranslator extends TypeMappingTranslator
-{
- protected static final OrmPackage XML_PKG =
- OrmPackage.eINSTANCE;
+public class UniqueConstraintTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
- public EmbeddableTranslator() {
- super(EMBEDDABLE);
+ public UniqueConstraintTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
}
-
@Override
- public EObject createEMFObject(String nodeName, String readAheadName) {
- return JPA_CORE_XML_FACTORY.createXmlEmbeddable();
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
}
- @Override
protected Translator[] createChildren() {
return new Translator[] {
IDTranslator.INSTANCE,
- createJavaClassTranslator(),
- createAccessTypeTranslator(),
- createMetadataCompleteTranslator(),
- createPlaceHolderTranslator(EMBEDDABLE__DESCRIPTION),
- createPersistentAttributesTranslator()
+ creatColumnNameTranslator(),
};
}
-
-
+
+ private Translator creatColumnNameTranslator() {
+ return new Translator(COLUMN_NAME, ORM_PKG.getUniqueConstraint_ColumnNames());
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/VersionTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/VersionTranslator.java
new file mode 100644
index 0000000000..42b9f80d39
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/translators/VersionTranslator.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.orm.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class VersionTranslator extends Translator
+ implements OrmXmlMapper
+{
+ private Translator[] children;
+
+
+ public VersionTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+ @Override
+ public Translator[] getChildren(Object target, int versionID) {
+ if (this.children == null) {
+ this.children = createChildren();
+ }
+ return this.children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createColumnTranslator(),
+ createTemporalTranslator(),
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, ORM_PKG.getAttributeMapping_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createColumnTranslator() {
+ return new ColumnTranslator(COLUMN, ORM_PKG.getColumnMapping_Column());
+ }
+
+ private Translator createTemporalTranslator() {
+ return new Translator(TEMPORAL, ORM_PKG.getVersion_Temporal());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/util/OrmAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/util/OrmAdapterFactory.java
new file mode 100644
index 0000000000..6fbc0248d7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/util/OrmAdapterFactory.java
@@ -0,0 +1,1812 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: OrmAdapterFactory.java,v 1.2 2008/02/03 16:40:54 tle Exp $
+ */
+package org.eclipse.jpt.core.internal.resource.orm.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jpt.core.internal.resource.orm.*;
+import org.eclipse.jpt.core.internal.resource.orm.AbstractColumn;
+import org.eclipse.jpt.core.internal.resource.orm.AbstractTable;
+import org.eclipse.jpt.core.internal.resource.orm.AssociationOverride;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.orm.Attributes;
+import org.eclipse.jpt.core.internal.resource.orm.Basic;
+import org.eclipse.jpt.core.internal.resource.orm.CascadeType;
+import org.eclipse.jpt.core.internal.resource.orm.Column;
+import org.eclipse.jpt.core.internal.resource.orm.ColumnMapping;
+import org.eclipse.jpt.core.internal.resource.orm.ColumnResult;
+import org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn;
+import org.eclipse.jpt.core.internal.resource.orm.Embeddable;
+import org.eclipse.jpt.core.internal.resource.orm.Embedded;
+import org.eclipse.jpt.core.internal.resource.orm.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.EntityListener;
+import org.eclipse.jpt.core.internal.resource.orm.EntityListeners;
+import org.eclipse.jpt.core.internal.resource.orm.EntityMappings;
+import org.eclipse.jpt.core.internal.resource.orm.EntityResult;
+import org.eclipse.jpt.core.internal.resource.orm.EventMethod;
+import org.eclipse.jpt.core.internal.resource.orm.FieldResult;
+import org.eclipse.jpt.core.internal.resource.orm.GeneratedValue;
+import org.eclipse.jpt.core.internal.resource.orm.Id;
+import org.eclipse.jpt.core.internal.resource.orm.IdClass;
+import org.eclipse.jpt.core.internal.resource.orm.Inheritance;
+import org.eclipse.jpt.core.internal.resource.orm.JoinColumn;
+import org.eclipse.jpt.core.internal.resource.orm.JoinTable;
+import org.eclipse.jpt.core.internal.resource.orm.Lob;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToOne;
+import org.eclipse.jpt.core.internal.resource.orm.MapKey;
+import org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass;
+import org.eclipse.jpt.core.internal.resource.orm.NamedColumn;
+import org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery;
+import org.eclipse.jpt.core.internal.resource.orm.NamedQuery;
+import org.eclipse.jpt.core.internal.resource.orm.OneToMany;
+import org.eclipse.jpt.core.internal.resource.orm.OneToOne;
+import org.eclipse.jpt.core.internal.resource.orm.OrmPackage;
+import org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults;
+import org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata;
+import org.eclipse.jpt.core.internal.resource.orm.PostLoad;
+import org.eclipse.jpt.core.internal.resource.orm.PostPersist;
+import org.eclipse.jpt.core.internal.resource.orm.PostRemove;
+import org.eclipse.jpt.core.internal.resource.orm.PostUpdate;
+import org.eclipse.jpt.core.internal.resource.orm.PrePersist;
+import org.eclipse.jpt.core.internal.resource.orm.PreRemove;
+import org.eclipse.jpt.core.internal.resource.orm.PreUpdate;
+import org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.orm.QueryHint;
+import org.eclipse.jpt.core.internal.resource.orm.SecondaryTable;
+import org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator;
+import org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping;
+import org.eclipse.jpt.core.internal.resource.orm.Table;
+import org.eclipse.jpt.core.internal.resource.orm.TableGenerator;
+import org.eclipse.jpt.core.internal.resource.orm.Transient;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint;
+import org.eclipse.jpt.core.internal.resource.orm.Version;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage
+ * @generated
+ */
+public class OrmAdapterFactory extends AdapterFactoryImpl
+{
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static OrmPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public OrmAdapterFactory()
+ {
+ if (modelPackage == null)
+ {
+ modelPackage = OrmPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object)
+ {
+ if (object == modelPackage)
+ {
+ return true;
+ }
+ if (object instanceof EObject)
+ {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected OrmSwitch<Adapter> modelSwitch =
+ new OrmSwitch<Adapter>()
+ {
+ @Override
+ public Adapter caseEntityMappings(EntityMappings object)
+ {
+ return createEntityMappingsAdapter();
+ }
+ @Override
+ public Adapter casePersistenceUnitMetadata(PersistenceUnitMetadata object)
+ {
+ return createPersistenceUnitMetadataAdapter();
+ }
+ @Override
+ public Adapter casePersistenceUnitDefaults(PersistenceUnitDefaults object)
+ {
+ return createPersistenceUnitDefaultsAdapter();
+ }
+ @Override
+ public Adapter caseTypeMapping(TypeMapping object)
+ {
+ return createTypeMappingAdapter();
+ }
+ @Override
+ public Adapter caseMappedSuperclass(MappedSuperclass object)
+ {
+ return createMappedSuperclassAdapter();
+ }
+ @Override
+ public Adapter caseEntity(Entity object)
+ {
+ return createEntityAdapter();
+ }
+ @Override
+ public Adapter caseEmbeddable(Embeddable object)
+ {
+ return createEmbeddableAdapter();
+ }
+ @Override
+ public Adapter caseAttributes(Attributes object)
+ {
+ return createAttributesAdapter();
+ }
+ @Override
+ public Adapter caseAttributeMapping(AttributeMapping object)
+ {
+ return createAttributeMappingAdapter();
+ }
+ @Override
+ public Adapter caseColumnMapping(ColumnMapping object)
+ {
+ return createColumnMappingAdapter();
+ }
+ @Override
+ public Adapter caseRelationshipMapping(RelationshipMapping object)
+ {
+ return createRelationshipMappingAdapter();
+ }
+ @Override
+ public Adapter caseMultiRelationshipMapping(MultiRelationshipMapping object)
+ {
+ return createMultiRelationshipMappingAdapter();
+ }
+ @Override
+ public Adapter caseSingleRelationshipMapping(SingleRelationshipMapping object)
+ {
+ return createSingleRelationshipMappingAdapter();
+ }
+ @Override
+ public Adapter caseId(Id object)
+ {
+ return createIdAdapter();
+ }
+ @Override
+ public Adapter caseIdImpl(IdImpl object)
+ {
+ return createIdImplAdapter();
+ }
+ @Override
+ public Adapter caseEmbeddedId(EmbeddedId object)
+ {
+ return createEmbeddedIdAdapter();
+ }
+ @Override
+ public Adapter caseEmbeddedIdImpl(EmbeddedIdImpl object)
+ {
+ return createEmbeddedIdImplAdapter();
+ }
+ @Override
+ public Adapter caseBasic(Basic object)
+ {
+ return createBasicAdapter();
+ }
+ @Override
+ public Adapter caseBasicImpl(BasicImpl object)
+ {
+ return createBasicImplAdapter();
+ }
+ @Override
+ public Adapter caseVersion(Version object)
+ {
+ return createVersionAdapter();
+ }
+ @Override
+ public Adapter caseVersionImpl(VersionImpl object)
+ {
+ return createVersionImplAdapter();
+ }
+ @Override
+ public Adapter caseManyToOne(ManyToOne object)
+ {
+ return createManyToOneAdapter();
+ }
+ @Override
+ public Adapter caseManyToOneImpl(ManyToOneImpl object)
+ {
+ return createManyToOneImplAdapter();
+ }
+ @Override
+ public Adapter caseOneToMany(OneToMany object)
+ {
+ return createOneToManyAdapter();
+ }
+ @Override
+ public Adapter caseOneToManyImpl(OneToManyImpl object)
+ {
+ return createOneToManyImplAdapter();
+ }
+ @Override
+ public Adapter caseOneToOne(OneToOne object)
+ {
+ return createOneToOneAdapter();
+ }
+ @Override
+ public Adapter caseOneToOneImpl(OneToOneImpl object)
+ {
+ return createOneToOneImplAdapter();
+ }
+ @Override
+ public Adapter caseManyToMany(ManyToMany object)
+ {
+ return createManyToManyAdapter();
+ }
+ @Override
+ public Adapter caseManyToManyImpl(ManyToManyImpl object)
+ {
+ return createManyToManyImplAdapter();
+ }
+ @Override
+ public Adapter caseEmbedded(Embedded object)
+ {
+ return createEmbeddedAdapter();
+ }
+ @Override
+ public Adapter caseEmbeddedImpl(EmbeddedImpl object)
+ {
+ return createEmbeddedImplAdapter();
+ }
+ @Override
+ public Adapter caseTransient(Transient object)
+ {
+ return createTransientAdapter();
+ }
+ @Override
+ public Adapter caseTransientImpl(TransientImpl object)
+ {
+ return createTransientImplAdapter();
+ }
+ @Override
+ public Adapter caseAssociationOverride(AssociationOverride object)
+ {
+ return createAssociationOverrideAdapter();
+ }
+ @Override
+ public Adapter caseAttributeOverride(AttributeOverride object)
+ {
+ return createAttributeOverrideAdapter();
+ }
+ @Override
+ public Adapter caseAttributeOverrideImpl(AttributeOverrideImpl object)
+ {
+ return createAttributeOverrideImplAdapter();
+ }
+ @Override
+ public Adapter caseCascadeType(CascadeType object)
+ {
+ return createCascadeTypeAdapter();
+ }
+ @Override
+ public Adapter caseCascadeTypeImpl(CascadeTypeImpl object)
+ {
+ return createCascadeTypeImplAdapter();
+ }
+ @Override
+ public Adapter caseNamedColumn(NamedColumn object)
+ {
+ return createNamedColumnAdapter();
+ }
+ @Override
+ public Adapter caseAbstractColumn(AbstractColumn object)
+ {
+ return createAbstractColumnAdapter();
+ }
+ @Override
+ public Adapter caseColumn(Column object)
+ {
+ return createColumnAdapter();
+ }
+ @Override
+ public Adapter caseColumnImpl(ColumnImpl object)
+ {
+ return createColumnImplAdapter();
+ }
+ @Override
+ public Adapter caseColumnResult(ColumnResult object)
+ {
+ return createColumnResultAdapter();
+ }
+ @Override
+ public Adapter caseDiscriminatorColumn(DiscriminatorColumn object)
+ {
+ return createDiscriminatorColumnAdapter();
+ }
+ @Override
+ public Adapter caseEntityListeners(EntityListeners object)
+ {
+ return createEntityListenersAdapter();
+ }
+ @Override
+ public Adapter caseEntityListener(EntityListener object)
+ {
+ return createEntityListenerAdapter();
+ }
+ @Override
+ public Adapter caseEntityResult(EntityResult object)
+ {
+ return createEntityResultAdapter();
+ }
+ @Override
+ public Adapter caseEventMethod(EventMethod object)
+ {
+ return createEventMethodAdapter();
+ }
+ @Override
+ public Adapter caseFieldResult(FieldResult object)
+ {
+ return createFieldResultAdapter();
+ }
+ @Override
+ public Adapter caseGeneratedValue(GeneratedValue object)
+ {
+ return createGeneratedValueAdapter();
+ }
+ @Override
+ public Adapter caseGeneratedValueImpl(GeneratedValueImpl object)
+ {
+ return createGeneratedValueImplAdapter();
+ }
+ @Override
+ public Adapter caseIdClass(IdClass object)
+ {
+ return createIdClassAdapter();
+ }
+ @Override
+ public Adapter caseInheritance(Inheritance object)
+ {
+ return createInheritanceAdapter();
+ }
+ @Override
+ public Adapter caseJoinColumn(JoinColumn object)
+ {
+ return createJoinColumnAdapter();
+ }
+ @Override
+ public Adapter caseJoinColumnImpl(JoinColumnImpl object)
+ {
+ return createJoinColumnImplAdapter();
+ }
+ @Override
+ public Adapter caseJoinTable(JoinTable object)
+ {
+ return createJoinTableAdapter();
+ }
+ @Override
+ public Adapter caseJoinTableImpl(JoinTableImpl object)
+ {
+ return createJoinTableImplAdapter();
+ }
+ @Override
+ public Adapter caseLob(Lob object)
+ {
+ return createLobAdapter();
+ }
+ @Override
+ public Adapter caseMapKey(MapKey object)
+ {
+ return createMapKeyAdapter();
+ }
+ @Override
+ public Adapter caseMapKeyImpl(MapKeyImpl object)
+ {
+ return createMapKeyImplAdapter();
+ }
+ @Override
+ public Adapter caseQuery(Query object)
+ {
+ return createQueryAdapter();
+ }
+ @Override
+ public Adapter caseNamedNativeQuery(NamedNativeQuery object)
+ {
+ return createNamedNativeQueryAdapter();
+ }
+ @Override
+ public Adapter caseNamedQuery(NamedQuery object)
+ {
+ return createNamedQueryAdapter();
+ }
+ @Override
+ public Adapter casePostLoad(PostLoad object)
+ {
+ return createPostLoadAdapter();
+ }
+ @Override
+ public Adapter casePostPersist(PostPersist object)
+ {
+ return createPostPersistAdapter();
+ }
+ @Override
+ public Adapter casePostRemove(PostRemove object)
+ {
+ return createPostRemoveAdapter();
+ }
+ @Override
+ public Adapter casePostUpdate(PostUpdate object)
+ {
+ return createPostUpdateAdapter();
+ }
+ @Override
+ public Adapter casePrePersist(PrePersist object)
+ {
+ return createPrePersistAdapter();
+ }
+ @Override
+ public Adapter casePreRemove(PreRemove object)
+ {
+ return createPreRemoveAdapter();
+ }
+ @Override
+ public Adapter casePreUpdate(PreUpdate object)
+ {
+ return createPreUpdateAdapter();
+ }
+ @Override
+ public Adapter casePrimaryKeyJoinColumn(PrimaryKeyJoinColumn object)
+ {
+ return createPrimaryKeyJoinColumnAdapter();
+ }
+ @Override
+ public Adapter caseQueryHint(QueryHint object)
+ {
+ return createQueryHintAdapter();
+ }
+ @Override
+ public Adapter caseAbstractTable(AbstractTable object)
+ {
+ return createAbstractTableAdapter();
+ }
+ @Override
+ public Adapter caseTable(Table object)
+ {
+ return createTableAdapter();
+ }
+ @Override
+ public Adapter caseSecondaryTable(SecondaryTable object)
+ {
+ return createSecondaryTableAdapter();
+ }
+ @Override
+ public Adapter caseGenerator(Generator object)
+ {
+ return createGeneratorAdapter();
+ }
+ @Override
+ public Adapter caseSequenceGenerator(SequenceGenerator object)
+ {
+ return createSequenceGeneratorAdapter();
+ }
+ @Override
+ public Adapter caseSequenceGeneratorImpl(SequenceGeneratorImpl object)
+ {
+ return createSequenceGeneratorImplAdapter();
+ }
+ @Override
+ public Adapter caseSqlResultSetMapping(SqlResultSetMapping object)
+ {
+ return createSqlResultSetMappingAdapter();
+ }
+ @Override
+ public Adapter caseTableGenerator(TableGenerator object)
+ {
+ return createTableGeneratorAdapter();
+ }
+ @Override
+ public Adapter caseTableGeneratorImpl(TableGeneratorImpl object)
+ {
+ return createTableGeneratorImplAdapter();
+ }
+ @Override
+ public Adapter caseUniqueConstraint(UniqueConstraint object)
+ {
+ return createUniqueConstraintAdapter();
+ }
+ @Override
+ public Adapter defaultCase(EObject object)
+ {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target)
+ {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.EntityMappings <em>Entity Mappings</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityMappings
+ * @generated
+ */
+ public Adapter createEntityMappingsAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata <em>Persistence Unit Metadata</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata
+ * @generated
+ */
+ public Adapter createPersistenceUnitMetadataAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults <em>Persistence Unit Defaults</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults
+ * @generated
+ */
+ public Adapter createPersistenceUnitDefaultsAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.TypeMapping <em>Type Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TypeMapping
+ * @generated
+ */
+ public Adapter createTypeMappingAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass <em>Mapped Superclass</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass
+ * @generated
+ */
+ public Adapter createMappedSuperclassAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.Entity <em>Entity</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Entity
+ * @generated
+ */
+ public Adapter createEntityAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.Embeddable <em>Embeddable</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Embeddable
+ * @generated
+ */
+ public Adapter createEmbeddableAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.Attributes <em>Attributes</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Attributes
+ * @generated
+ */
+ public Adapter createAttributesAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeMapping <em>Attribute Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AttributeMapping
+ * @generated
+ */
+ public Adapter createAttributeMappingAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnMapping <em>Column Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.ColumnMapping
+ * @generated
+ */
+ public Adapter createColumnMappingAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping <em>Relationship Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.RelationshipMapping
+ * @generated
+ */
+ public Adapter createRelationshipMappingAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping <em>Multi Relationship Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MultiRelationshipMapping
+ * @generated
+ */
+ public Adapter createMultiRelationshipMappingAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping <em>Single Relationship Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SingleRelationshipMapping
+ * @generated
+ */
+ public Adapter createSingleRelationshipMappingAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.Id <em>Id</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Id
+ * @generated
+ */
+ public Adapter createIdAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.IdImpl <em>Id Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.IdImpl
+ * @generated
+ */
+ public Adapter createIdImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedId <em>Embedded Id</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EmbeddedId
+ * @generated
+ */
+ public Adapter createEmbeddedIdAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedIdImpl <em>Embedded Id Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EmbeddedIdImpl
+ * @generated
+ */
+ public Adapter createEmbeddedIdImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.Basic <em>Basic</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Basic
+ * @generated
+ */
+ public Adapter createBasicAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.BasicImpl <em>Basic Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.BasicImpl
+ * @generated
+ */
+ public Adapter createBasicImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.Version <em>Version</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Version
+ * @generated
+ */
+ public Adapter createVersionAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.VersionImpl <em>Version Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.VersionImpl
+ * @generated
+ */
+ public Adapter createVersionImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToOne <em>Many To One</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.ManyToOne
+ * @generated
+ */
+ public Adapter createManyToOneAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl <em>Many To One Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl
+ * @generated
+ */
+ public Adapter createManyToOneImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.OneToMany <em>One To Many</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToMany
+ * @generated
+ */
+ public Adapter createOneToManyAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl <em>One To Many Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl
+ * @generated
+ */
+ public Adapter createOneToManyImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOne <em>One To One</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToOne
+ * @generated
+ */
+ public Adapter createOneToOneAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl <em>One To One Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl
+ * @generated
+ */
+ public Adapter createOneToOneImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToMany <em>Many To Many</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.ManyToMany
+ * @generated
+ */
+ public Adapter createManyToManyAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl <em>Many To Many Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl
+ * @generated
+ */
+ public Adapter createManyToManyImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.Embedded <em>Embedded</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Embedded
+ * @generated
+ */
+ public Adapter createEmbeddedAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.EmbeddedImpl <em>Embedded Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EmbeddedImpl
+ * @generated
+ */
+ public Adapter createEmbeddedImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.Transient <em>Transient</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Transient
+ * @generated
+ */
+ public Adapter createTransientAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.TransientImpl <em>Transient Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TransientImpl
+ * @generated
+ */
+ public Adapter createTransientImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.AssociationOverride <em>Association Override</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AssociationOverride
+ * @generated
+ */
+ public Adapter createAssociationOverrideAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverride <em>Attribute Override</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AttributeOverride
+ * @generated
+ */
+ public Adapter createAttributeOverrideAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.AttributeOverrideImpl <em>Attribute Override Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AttributeOverrideImpl
+ * @generated
+ */
+ public Adapter createAttributeOverrideImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeType <em>Cascade Type</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.CascadeType
+ * @generated
+ */
+ public Adapter createCascadeTypeAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.CascadeTypeImpl <em>Cascade Type Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.CascadeTypeImpl
+ * @generated
+ */
+ public Adapter createCascadeTypeImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.NamedColumn <em>Named Column</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.NamedColumn
+ * @generated
+ */
+ public Adapter createNamedColumnAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractColumn <em>Abstract Column</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractColumn
+ * @generated
+ */
+ public Adapter createAbstractColumnAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.Column <em>Column</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Column
+ * @generated
+ */
+ public Adapter createColumnAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnImpl <em>Column Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.ColumnImpl
+ * @generated
+ */
+ public Adapter createColumnImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.ColumnResult <em>Column Result</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.ColumnResult
+ * @generated
+ */
+ public Adapter createColumnResultAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn <em>Discriminator Column</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn
+ * @generated
+ */
+ public Adapter createDiscriminatorColumnAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListeners <em>Entity Listeners</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListeners
+ * @generated
+ */
+ public Adapter createEntityListenersAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.EntityListener <em>Entity Listener</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityListener
+ * @generated
+ */
+ public Adapter createEntityListenerAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.EntityResult <em>Entity Result</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EntityResult
+ * @generated
+ */
+ public Adapter createEntityResultAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.FieldResult <em>Field Result</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.FieldResult
+ * @generated
+ */
+ public Adapter createFieldResultAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.GeneratedValue <em>Generated Value</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.GeneratedValue
+ * @generated
+ */
+ public Adapter createGeneratedValueAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.GeneratedValueImpl <em>Generated Value Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.GeneratedValueImpl
+ * @generated
+ */
+ public Adapter createGeneratedValueImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.IdClass <em>Id Class</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.IdClass
+ * @generated
+ */
+ public Adapter createIdClassAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.Inheritance <em>Inheritance</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Inheritance
+ * @generated
+ */
+ public Adapter createInheritanceAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumn <em>Join Column</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinColumn
+ * @generated
+ */
+ public Adapter createJoinColumnAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.JoinColumnImpl <em>Join Column Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinColumnImpl
+ * @generated
+ */
+ public Adapter createJoinColumnImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.JoinTable <em>Join Table</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinTable
+ * @generated
+ */
+ public Adapter createJoinTableAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.JoinTableImpl <em>Join Table Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.JoinTableImpl
+ * @generated
+ */
+ public Adapter createJoinTableImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.Lob <em>Lob</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Lob
+ * @generated
+ */
+ public Adapter createLobAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.MapKey <em>Map Key</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MapKey
+ * @generated
+ */
+ public Adapter createMapKeyAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.MapKeyImpl <em>Map Key Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.MapKeyImpl
+ * @generated
+ */
+ public Adapter createMapKeyImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.Query <em>Query</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Query
+ * @generated
+ */
+ public Adapter createQueryAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.EventMethod <em>Event Method</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.EventMethod
+ * @generated
+ */
+ public Adapter createEventMethodAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery <em>Named Native Query</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery
+ * @generated
+ */
+ public Adapter createNamedNativeQueryAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.NamedQuery <em>Named Query</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.NamedQuery
+ * @generated
+ */
+ public Adapter createNamedQueryAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.PostLoad <em>Post Load</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PostLoad
+ * @generated
+ */
+ public Adapter createPostLoadAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.PostPersist <em>Post Persist</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PostPersist
+ * @generated
+ */
+ public Adapter createPostPersistAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.PostRemove <em>Post Remove</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PostRemove
+ * @generated
+ */
+ public Adapter createPostRemoveAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.PostUpdate <em>Post Update</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PostUpdate
+ * @generated
+ */
+ public Adapter createPostUpdateAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.PrePersist <em>Pre Persist</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PrePersist
+ * @generated
+ */
+ public Adapter createPrePersistAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.PreRemove <em>Pre Remove</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PreRemove
+ * @generated
+ */
+ public Adapter createPreRemoveAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.PreUpdate <em>Pre Update</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PreUpdate
+ * @generated
+ */
+ public Adapter createPreUpdateAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.QueryHint <em>Query Hint</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.QueryHint
+ * @generated
+ */
+ public Adapter createQueryHintAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.AbstractTable <em>Abstract Table</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.AbstractTable
+ * @generated
+ */
+ public Adapter createAbstractTableAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping <em>Sql Result Set Mapping</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping
+ * @generated
+ */
+ public Adapter createSqlResultSetMappingAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn <em>Primary Key Join Column</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn
+ * @generated
+ */
+ public Adapter createPrimaryKeyJoinColumnAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.SecondaryTable <em>Secondary Table</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SecondaryTable
+ * @generated
+ */
+ public Adapter createSecondaryTableAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.Generator <em>Generator</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Generator
+ * @generated
+ */
+ public Adapter createGeneratorAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator <em>Sequence Generator</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator
+ * @generated
+ */
+ public Adapter createSequenceGeneratorAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.SequenceGeneratorImpl <em>Sequence Generator Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.SequenceGeneratorImpl
+ * @generated
+ */
+ public Adapter createSequenceGeneratorImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.Table <em>Table</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.Table
+ * @generated
+ */
+ public Adapter createTableAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.TableGenerator <em>Table Generator</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TableGenerator
+ * @generated
+ */
+ public Adapter createTableGeneratorAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl <em>Table Generator Impl</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.TableGeneratorImpl
+ * @generated
+ */
+ public Adapter createTableGeneratorImplAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint <em>Unique Constraint</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint
+ * @generated
+ */
+ public Adapter createUniqueConstraintAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter()
+ {
+ return null;
+ }
+
+} //OrmAdapterFactory
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/util/OrmSwitch.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/util/OrmSwitch.java
new file mode 100644
index 0000000000..3f881d6e19
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/util/OrmSwitch.java
@@ -0,0 +1,2159 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id: OrmSwitch.java,v 1.2 2008/02/03 16:40:54 tle Exp $
+ */
+package org.eclipse.jpt.core.internal.resource.orm.util;
+
+import java.util.List;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jpt.core.internal.resource.orm.*;
+import org.eclipse.jpt.core.internal.resource.orm.AbstractColumn;
+import org.eclipse.jpt.core.internal.resource.orm.AbstractTable;
+import org.eclipse.jpt.core.internal.resource.orm.AssociationOverride;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.orm.Attributes;
+import org.eclipse.jpt.core.internal.resource.orm.Basic;
+import org.eclipse.jpt.core.internal.resource.orm.CascadeType;
+import org.eclipse.jpt.core.internal.resource.orm.Column;
+import org.eclipse.jpt.core.internal.resource.orm.ColumnMapping;
+import org.eclipse.jpt.core.internal.resource.orm.ColumnResult;
+import org.eclipse.jpt.core.internal.resource.orm.DiscriminatorColumn;
+import org.eclipse.jpt.core.internal.resource.orm.Embeddable;
+import org.eclipse.jpt.core.internal.resource.orm.Embedded;
+import org.eclipse.jpt.core.internal.resource.orm.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.EntityListener;
+import org.eclipse.jpt.core.internal.resource.orm.EntityListeners;
+import org.eclipse.jpt.core.internal.resource.orm.EntityMappings;
+import org.eclipse.jpt.core.internal.resource.orm.EntityResult;
+import org.eclipse.jpt.core.internal.resource.orm.EventMethod;
+import org.eclipse.jpt.core.internal.resource.orm.FieldResult;
+import org.eclipse.jpt.core.internal.resource.orm.GeneratedValue;
+import org.eclipse.jpt.core.internal.resource.orm.Id;
+import org.eclipse.jpt.core.internal.resource.orm.IdClass;
+import org.eclipse.jpt.core.internal.resource.orm.Inheritance;
+import org.eclipse.jpt.core.internal.resource.orm.JoinColumn;
+import org.eclipse.jpt.core.internal.resource.orm.JoinTable;
+import org.eclipse.jpt.core.internal.resource.orm.Lob;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToOne;
+import org.eclipse.jpt.core.internal.resource.orm.MapKey;
+import org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass;
+import org.eclipse.jpt.core.internal.resource.orm.NamedColumn;
+import org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery;
+import org.eclipse.jpt.core.internal.resource.orm.NamedQuery;
+import org.eclipse.jpt.core.internal.resource.orm.OneToMany;
+import org.eclipse.jpt.core.internal.resource.orm.OneToOne;
+import org.eclipse.jpt.core.internal.resource.orm.OrmPackage;
+import org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults;
+import org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata;
+import org.eclipse.jpt.core.internal.resource.orm.PostLoad;
+import org.eclipse.jpt.core.internal.resource.orm.PostPersist;
+import org.eclipse.jpt.core.internal.resource.orm.PostRemove;
+import org.eclipse.jpt.core.internal.resource.orm.PostUpdate;
+import org.eclipse.jpt.core.internal.resource.orm.PrePersist;
+import org.eclipse.jpt.core.internal.resource.orm.PreRemove;
+import org.eclipse.jpt.core.internal.resource.orm.PreUpdate;
+import org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.orm.QueryHint;
+import org.eclipse.jpt.core.internal.resource.orm.SecondaryTable;
+import org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator;
+import org.eclipse.jpt.core.internal.resource.orm.SqlResultSetMapping;
+import org.eclipse.jpt.core.internal.resource.orm.Table;
+import org.eclipse.jpt.core.internal.resource.orm.TableGenerator;
+import org.eclipse.jpt.core.internal.resource.orm.Transient;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.UniqueConstraint;
+import org.eclipse.jpt.core.internal.resource.orm.Version;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.orm.OrmPackage
+ * @generated
+ */
+public class OrmSwitch<T>
+{
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static OrmPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public OrmSwitch()
+ {
+ if (modelPackage == null)
+ {
+ modelPackage = OrmPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ public T doSwitch(EObject theEObject)
+ {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(EClass theEClass, EObject theEObject)
+ {
+ if (theEClass.eContainer() == modelPackage)
+ {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else
+ {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return
+ eSuperTypes.isEmpty() ?
+ defaultCase(theEObject) :
+ doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(int classifierID, EObject theEObject)
+ {
+ switch (classifierID)
+ {
+ case OrmPackage.ENTITY_MAPPINGS:
+ {
+ EntityMappings entityMappings = (EntityMappings)theEObject;
+ T result = caseEntityMappings(entityMappings);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.PERSISTENCE_UNIT_METADATA:
+ {
+ PersistenceUnitMetadata persistenceUnitMetadata = (PersistenceUnitMetadata)theEObject;
+ T result = casePersistenceUnitMetadata(persistenceUnitMetadata);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.PERSISTENCE_UNIT_DEFAULTS:
+ {
+ PersistenceUnitDefaults persistenceUnitDefaults = (PersistenceUnitDefaults)theEObject;
+ T result = casePersistenceUnitDefaults(persistenceUnitDefaults);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.TYPE_MAPPING:
+ {
+ TypeMapping typeMapping = (TypeMapping)theEObject;
+ T result = caseTypeMapping(typeMapping);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.MAPPED_SUPERCLASS:
+ {
+ MappedSuperclass mappedSuperclass = (MappedSuperclass)theEObject;
+ T result = caseMappedSuperclass(mappedSuperclass);
+ if (result == null) result = caseTypeMapping(mappedSuperclass);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ENTITY:
+ {
+ Entity entity = (Entity)theEObject;
+ T result = caseEntity(entity);
+ if (result == null) result = caseTypeMapping(entity);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.EMBEDDABLE:
+ {
+ Embeddable embeddable = (Embeddable)theEObject;
+ T result = caseEmbeddable(embeddable);
+ if (result == null) result = caseTypeMapping(embeddable);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ATTRIBUTES:
+ {
+ Attributes attributes = (Attributes)theEObject;
+ T result = caseAttributes(attributes);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ATTRIBUTE_MAPPING:
+ {
+ AttributeMapping attributeMapping = (AttributeMapping)theEObject;
+ T result = caseAttributeMapping(attributeMapping);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.COLUMN_MAPPING:
+ {
+ ColumnMapping columnMapping = (ColumnMapping)theEObject;
+ T result = caseColumnMapping(columnMapping);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.RELATIONSHIP_MAPPING:
+ {
+ RelationshipMapping relationshipMapping = (RelationshipMapping)theEObject;
+ T result = caseRelationshipMapping(relationshipMapping);
+ if (result == null) result = caseAttributeMapping(relationshipMapping);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.MULTI_RELATIONSHIP_MAPPING:
+ {
+ MultiRelationshipMapping multiRelationshipMapping = (MultiRelationshipMapping)theEObject;
+ T result = caseMultiRelationshipMapping(multiRelationshipMapping);
+ if (result == null) result = caseRelationshipMapping(multiRelationshipMapping);
+ if (result == null) result = caseAttributeMapping(multiRelationshipMapping);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.SINGLE_RELATIONSHIP_MAPPING:
+ {
+ SingleRelationshipMapping singleRelationshipMapping = (SingleRelationshipMapping)theEObject;
+ T result = caseSingleRelationshipMapping(singleRelationshipMapping);
+ if (result == null) result = caseRelationshipMapping(singleRelationshipMapping);
+ if (result == null) result = caseAttributeMapping(singleRelationshipMapping);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ID:
+ {
+ Id id = (Id)theEObject;
+ T result = caseId(id);
+ if (result == null) result = caseAttributeMapping(id);
+ if (result == null) result = caseColumnMapping(id);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ID_IMPL:
+ {
+ IdImpl idImpl = (IdImpl)theEObject;
+ T result = caseIdImpl(idImpl);
+ if (result == null) result = caseId(idImpl);
+ if (result == null) result = caseAttributeMapping(idImpl);
+ if (result == null) result = caseColumnMapping(idImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.EMBEDDED_ID:
+ {
+ EmbeddedId embeddedId = (EmbeddedId)theEObject;
+ T result = caseEmbeddedId(embeddedId);
+ if (result == null) result = caseAttributeMapping(embeddedId);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.EMBEDDED_ID_IMPL:
+ {
+ EmbeddedIdImpl embeddedIdImpl = (EmbeddedIdImpl)theEObject;
+ T result = caseEmbeddedIdImpl(embeddedIdImpl);
+ if (result == null) result = caseEmbeddedId(embeddedIdImpl);
+ if (result == null) result = caseAttributeMapping(embeddedIdImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.BASIC:
+ {
+ Basic basic = (Basic)theEObject;
+ T result = caseBasic(basic);
+ if (result == null) result = caseAttributeMapping(basic);
+ if (result == null) result = caseColumnMapping(basic);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.BASIC_IMPL:
+ {
+ BasicImpl basicImpl = (BasicImpl)theEObject;
+ T result = caseBasicImpl(basicImpl);
+ if (result == null) result = caseBasic(basicImpl);
+ if (result == null) result = caseAttributeMapping(basicImpl);
+ if (result == null) result = caseColumnMapping(basicImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.VERSION:
+ {
+ Version version = (Version)theEObject;
+ T result = caseVersion(version);
+ if (result == null) result = caseAttributeMapping(version);
+ if (result == null) result = caseColumnMapping(version);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.VERSION_IMPL:
+ {
+ VersionImpl versionImpl = (VersionImpl)theEObject;
+ T result = caseVersionImpl(versionImpl);
+ if (result == null) result = caseVersion(versionImpl);
+ if (result == null) result = caseAttributeMapping(versionImpl);
+ if (result == null) result = caseColumnMapping(versionImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.MANY_TO_ONE:
+ {
+ ManyToOne manyToOne = (ManyToOne)theEObject;
+ T result = caseManyToOne(manyToOne);
+ if (result == null) result = caseSingleRelationshipMapping(manyToOne);
+ if (result == null) result = caseRelationshipMapping(manyToOne);
+ if (result == null) result = caseAttributeMapping(manyToOne);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.MANY_TO_ONE_IMPL:
+ {
+ ManyToOneImpl manyToOneImpl = (ManyToOneImpl)theEObject;
+ T result = caseManyToOneImpl(manyToOneImpl);
+ if (result == null) result = caseManyToOne(manyToOneImpl);
+ if (result == null) result = caseSingleRelationshipMapping(manyToOneImpl);
+ if (result == null) result = caseRelationshipMapping(manyToOneImpl);
+ if (result == null) result = caseAttributeMapping(manyToOneImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ONE_TO_MANY:
+ {
+ OneToMany oneToMany = (OneToMany)theEObject;
+ T result = caseOneToMany(oneToMany);
+ if (result == null) result = caseMultiRelationshipMapping(oneToMany);
+ if (result == null) result = caseRelationshipMapping(oneToMany);
+ if (result == null) result = caseAttributeMapping(oneToMany);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ONE_TO_MANY_IMPL:
+ {
+ OneToManyImpl oneToManyImpl = (OneToManyImpl)theEObject;
+ T result = caseOneToManyImpl(oneToManyImpl);
+ if (result == null) result = caseOneToMany(oneToManyImpl);
+ if (result == null) result = caseMultiRelationshipMapping(oneToManyImpl);
+ if (result == null) result = caseRelationshipMapping(oneToManyImpl);
+ if (result == null) result = caseAttributeMapping(oneToManyImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ONE_TO_ONE:
+ {
+ OneToOne oneToOne = (OneToOne)theEObject;
+ T result = caseOneToOne(oneToOne);
+ if (result == null) result = caseSingleRelationshipMapping(oneToOne);
+ if (result == null) result = caseRelationshipMapping(oneToOne);
+ if (result == null) result = caseAttributeMapping(oneToOne);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ONE_TO_ONE_IMPL:
+ {
+ OneToOneImpl oneToOneImpl = (OneToOneImpl)theEObject;
+ T result = caseOneToOneImpl(oneToOneImpl);
+ if (result == null) result = caseOneToOne(oneToOneImpl);
+ if (result == null) result = caseSingleRelationshipMapping(oneToOneImpl);
+ if (result == null) result = caseRelationshipMapping(oneToOneImpl);
+ if (result == null) result = caseAttributeMapping(oneToOneImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.MANY_TO_MANY:
+ {
+ ManyToMany manyToMany = (ManyToMany)theEObject;
+ T result = caseManyToMany(manyToMany);
+ if (result == null) result = caseMultiRelationshipMapping(manyToMany);
+ if (result == null) result = caseRelationshipMapping(manyToMany);
+ if (result == null) result = caseAttributeMapping(manyToMany);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.MANY_TO_MANY_IMPL:
+ {
+ ManyToManyImpl manyToManyImpl = (ManyToManyImpl)theEObject;
+ T result = caseManyToManyImpl(manyToManyImpl);
+ if (result == null) result = caseManyToMany(manyToManyImpl);
+ if (result == null) result = caseMultiRelationshipMapping(manyToManyImpl);
+ if (result == null) result = caseRelationshipMapping(manyToManyImpl);
+ if (result == null) result = caseAttributeMapping(manyToManyImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.EMBEDDED:
+ {
+ Embedded embedded = (Embedded)theEObject;
+ T result = caseEmbedded(embedded);
+ if (result == null) result = caseAttributeMapping(embedded);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.EMBEDDED_IMPL:
+ {
+ EmbeddedImpl embeddedImpl = (EmbeddedImpl)theEObject;
+ T result = caseEmbeddedImpl(embeddedImpl);
+ if (result == null) result = caseEmbedded(embeddedImpl);
+ if (result == null) result = caseAttributeMapping(embeddedImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.TRANSIENT:
+ {
+ Transient transient_ = (Transient)theEObject;
+ T result = caseTransient(transient_);
+ if (result == null) result = caseAttributeMapping(transient_);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.TRANSIENT_IMPL:
+ {
+ TransientImpl transientImpl = (TransientImpl)theEObject;
+ T result = caseTransientImpl(transientImpl);
+ if (result == null) result = caseTransient(transientImpl);
+ if (result == null) result = caseAttributeMapping(transientImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ASSOCIATION_OVERRIDE:
+ {
+ AssociationOverride associationOverride = (AssociationOverride)theEObject;
+ T result = caseAssociationOverride(associationOverride);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ATTRIBUTE_OVERRIDE:
+ {
+ AttributeOverride attributeOverride = (AttributeOverride)theEObject;
+ T result = caseAttributeOverride(attributeOverride);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ATTRIBUTE_OVERRIDE_IMPL:
+ {
+ AttributeOverrideImpl attributeOverrideImpl = (AttributeOverrideImpl)theEObject;
+ T result = caseAttributeOverrideImpl(attributeOverrideImpl);
+ if (result == null) result = caseAttributeOverride(attributeOverrideImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.CASCADE_TYPE:
+ {
+ CascadeType cascadeType = (CascadeType)theEObject;
+ T result = caseCascadeType(cascadeType);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.CASCADE_TYPE_IMPL:
+ {
+ CascadeTypeImpl cascadeTypeImpl = (CascadeTypeImpl)theEObject;
+ T result = caseCascadeTypeImpl(cascadeTypeImpl);
+ if (result == null) result = caseCascadeType(cascadeTypeImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.NAMED_COLUMN:
+ {
+ NamedColumn namedColumn = (NamedColumn)theEObject;
+ T result = caseNamedColumn(namedColumn);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ABSTRACT_COLUMN:
+ {
+ AbstractColumn abstractColumn = (AbstractColumn)theEObject;
+ T result = caseAbstractColumn(abstractColumn);
+ if (result == null) result = caseNamedColumn(abstractColumn);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.COLUMN:
+ {
+ Column column = (Column)theEObject;
+ T result = caseColumn(column);
+ if (result == null) result = caseAbstractColumn(column);
+ if (result == null) result = caseNamedColumn(column);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.COLUMN_IMPL:
+ {
+ ColumnImpl columnImpl = (ColumnImpl)theEObject;
+ T result = caseColumnImpl(columnImpl);
+ if (result == null) result = caseColumn(columnImpl);
+ if (result == null) result = caseAbstractColumn(columnImpl);
+ if (result == null) result = caseNamedColumn(columnImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.COLUMN_RESULT:
+ {
+ ColumnResult columnResult = (ColumnResult)theEObject;
+ T result = caseColumnResult(columnResult);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.DISCRIMINATOR_COLUMN:
+ {
+ DiscriminatorColumn discriminatorColumn = (DiscriminatorColumn)theEObject;
+ T result = caseDiscriminatorColumn(discriminatorColumn);
+ if (result == null) result = caseNamedColumn(discriminatorColumn);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ENTITY_LISTENERS:
+ {
+ EntityListeners entityListeners = (EntityListeners)theEObject;
+ T result = caseEntityListeners(entityListeners);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ENTITY_LISTENER:
+ {
+ EntityListener entityListener = (EntityListener)theEObject;
+ T result = caseEntityListener(entityListener);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ENTITY_RESULT:
+ {
+ EntityResult entityResult = (EntityResult)theEObject;
+ T result = caseEntityResult(entityResult);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.EVENT_METHOD:
+ {
+ EventMethod eventMethod = (EventMethod)theEObject;
+ T result = caseEventMethod(eventMethod);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.FIELD_RESULT:
+ {
+ FieldResult fieldResult = (FieldResult)theEObject;
+ T result = caseFieldResult(fieldResult);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.GENERATED_VALUE:
+ {
+ GeneratedValue generatedValue = (GeneratedValue)theEObject;
+ T result = caseGeneratedValue(generatedValue);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.GENERATED_VALUE_IMPL:
+ {
+ GeneratedValueImpl generatedValueImpl = (GeneratedValueImpl)theEObject;
+ T result = caseGeneratedValueImpl(generatedValueImpl);
+ if (result == null) result = caseGeneratedValue(generatedValueImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ID_CLASS:
+ {
+ IdClass idClass = (IdClass)theEObject;
+ T result = caseIdClass(idClass);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.INHERITANCE:
+ {
+ Inheritance inheritance = (Inheritance)theEObject;
+ T result = caseInheritance(inheritance);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.JOIN_COLUMN:
+ {
+ JoinColumn joinColumn = (JoinColumn)theEObject;
+ T result = caseJoinColumn(joinColumn);
+ if (result == null) result = caseAbstractColumn(joinColumn);
+ if (result == null) result = caseNamedColumn(joinColumn);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.JOIN_COLUMN_IMPL:
+ {
+ JoinColumnImpl joinColumnImpl = (JoinColumnImpl)theEObject;
+ T result = caseJoinColumnImpl(joinColumnImpl);
+ if (result == null) result = caseJoinColumn(joinColumnImpl);
+ if (result == null) result = caseAbstractColumn(joinColumnImpl);
+ if (result == null) result = caseNamedColumn(joinColumnImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.JOIN_TABLE:
+ {
+ JoinTable joinTable = (JoinTable)theEObject;
+ T result = caseJoinTable(joinTable);
+ if (result == null) result = caseAbstractTable(joinTable);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.JOIN_TABLE_IMPL:
+ {
+ JoinTableImpl joinTableImpl = (JoinTableImpl)theEObject;
+ T result = caseJoinTableImpl(joinTableImpl);
+ if (result == null) result = caseJoinTable(joinTableImpl);
+ if (result == null) result = caseAbstractTable(joinTableImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.LOB:
+ {
+ Lob lob = (Lob)theEObject;
+ T result = caseLob(lob);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.MAP_KEY:
+ {
+ MapKey mapKey = (MapKey)theEObject;
+ T result = caseMapKey(mapKey);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.MAP_KEY_IMPL:
+ {
+ MapKeyImpl mapKeyImpl = (MapKeyImpl)theEObject;
+ T result = caseMapKeyImpl(mapKeyImpl);
+ if (result == null) result = caseMapKey(mapKeyImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.QUERY:
+ {
+ Query query = (Query)theEObject;
+ T result = caseQuery(query);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.NAMED_NATIVE_QUERY:
+ {
+ NamedNativeQuery namedNativeQuery = (NamedNativeQuery)theEObject;
+ T result = caseNamedNativeQuery(namedNativeQuery);
+ if (result == null) result = caseQuery(namedNativeQuery);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.NAMED_QUERY:
+ {
+ NamedQuery namedQuery = (NamedQuery)theEObject;
+ T result = caseNamedQuery(namedQuery);
+ if (result == null) result = caseQuery(namedQuery);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.POST_LOAD:
+ {
+ PostLoad postLoad = (PostLoad)theEObject;
+ T result = casePostLoad(postLoad);
+ if (result == null) result = caseEventMethod(postLoad);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.POST_PERSIST:
+ {
+ PostPersist postPersist = (PostPersist)theEObject;
+ T result = casePostPersist(postPersist);
+ if (result == null) result = caseEventMethod(postPersist);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.POST_REMOVE:
+ {
+ PostRemove postRemove = (PostRemove)theEObject;
+ T result = casePostRemove(postRemove);
+ if (result == null) result = caseEventMethod(postRemove);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.POST_UPDATE:
+ {
+ PostUpdate postUpdate = (PostUpdate)theEObject;
+ T result = casePostUpdate(postUpdate);
+ if (result == null) result = caseEventMethod(postUpdate);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.PRE_PERSIST:
+ {
+ PrePersist prePersist = (PrePersist)theEObject;
+ T result = casePrePersist(prePersist);
+ if (result == null) result = caseEventMethod(prePersist);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.PRE_REMOVE:
+ {
+ PreRemove preRemove = (PreRemove)theEObject;
+ T result = casePreRemove(preRemove);
+ if (result == null) result = caseEventMethod(preRemove);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.PRE_UPDATE:
+ {
+ PreUpdate preUpdate = (PreUpdate)theEObject;
+ T result = casePreUpdate(preUpdate);
+ if (result == null) result = caseEventMethod(preUpdate);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.PRIMARY_KEY_JOIN_COLUMN:
+ {
+ PrimaryKeyJoinColumn primaryKeyJoinColumn = (PrimaryKeyJoinColumn)theEObject;
+ T result = casePrimaryKeyJoinColumn(primaryKeyJoinColumn);
+ if (result == null) result = caseNamedColumn(primaryKeyJoinColumn);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.QUERY_HINT:
+ {
+ QueryHint queryHint = (QueryHint)theEObject;
+ T result = caseQueryHint(queryHint);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.ABSTRACT_TABLE:
+ {
+ AbstractTable abstractTable = (AbstractTable)theEObject;
+ T result = caseAbstractTable(abstractTable);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.TABLE:
+ {
+ Table table = (Table)theEObject;
+ T result = caseTable(table);
+ if (result == null) result = caseAbstractTable(table);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.SECONDARY_TABLE:
+ {
+ SecondaryTable secondaryTable = (SecondaryTable)theEObject;
+ T result = caseSecondaryTable(secondaryTable);
+ if (result == null) result = caseAbstractTable(secondaryTable);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.GENERATOR:
+ {
+ Generator generator = (Generator)theEObject;
+ T result = caseGenerator(generator);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.SEQUENCE_GENERATOR:
+ {
+ SequenceGenerator sequenceGenerator = (SequenceGenerator)theEObject;
+ T result = caseSequenceGenerator(sequenceGenerator);
+ if (result == null) result = caseGenerator(sequenceGenerator);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.SEQUENCE_GENERATOR_IMPL:
+ {
+ SequenceGeneratorImpl sequenceGeneratorImpl = (SequenceGeneratorImpl)theEObject;
+ T result = caseSequenceGeneratorImpl(sequenceGeneratorImpl);
+ if (result == null) result = caseSequenceGenerator(sequenceGeneratorImpl);
+ if (result == null) result = caseGenerator(sequenceGeneratorImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.SQL_RESULT_SET_MAPPING:
+ {
+ SqlResultSetMapping sqlResultSetMapping = (SqlResultSetMapping)theEObject;
+ T result = caseSqlResultSetMapping(sqlResultSetMapping);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.TABLE_GENERATOR:
+ {
+ TableGenerator tableGenerator = (TableGenerator)theEObject;
+ T result = caseTableGenerator(tableGenerator);
+ if (result == null) result = caseGenerator(tableGenerator);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.TABLE_GENERATOR_IMPL:
+ {
+ TableGeneratorImpl tableGeneratorImpl = (TableGeneratorImpl)theEObject;
+ T result = caseTableGeneratorImpl(tableGeneratorImpl);
+ if (result == null) result = caseTableGenerator(tableGeneratorImpl);
+ if (result == null) result = caseGenerator(tableGeneratorImpl);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case OrmPackage.UNIQUE_CONSTRAINT:
+ {
+ UniqueConstraint uniqueConstraint = (UniqueConstraint)theEObject;
+ T result = caseUniqueConstraint(uniqueConstraint);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Entity Mappings</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Entity Mappings</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEntityMappings(EntityMappings object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Persistence Unit Metadata</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Persistence Unit Metadata</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T casePersistenceUnitMetadata(PersistenceUnitMetadata object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Persistence Unit Defaults</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Persistence Unit Defaults</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T casePersistenceUnitDefaults(PersistenceUnitDefaults object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Type Mapping</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Type Mapping</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseTypeMapping(TypeMapping object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Mapped Superclass</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Mapped Superclass</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseMappedSuperclass(MappedSuperclass object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Entity</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Entity</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEntity(Entity object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Embeddable</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Embeddable</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEmbeddable(Embeddable object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Attributes</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Attributes</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseAttributes(Attributes object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Attribute Mapping</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Attribute Mapping</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseAttributeMapping(AttributeMapping object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Column Mapping</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Column Mapping</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseColumnMapping(ColumnMapping object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Relationship Mapping</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Relationship Mapping</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseRelationshipMapping(RelationshipMapping object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Multi Relationship Mapping</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Multi Relationship Mapping</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseMultiRelationshipMapping(MultiRelationshipMapping object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Single Relationship Mapping</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Single Relationship Mapping</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseSingleRelationshipMapping(SingleRelationshipMapping object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Id</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Id</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseId(Id object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Id Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Id Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseIdImpl(IdImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Embedded Id</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Embedded Id</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEmbeddedId(EmbeddedId object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Embedded Id Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Embedded Id Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEmbeddedIdImpl(EmbeddedIdImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Basic</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Basic</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseBasic(Basic object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Basic Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Basic Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseBasicImpl(BasicImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Version</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Version</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseVersion(Version object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Version Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Version Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseVersionImpl(VersionImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Many To One</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Many To One</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseManyToOne(ManyToOne object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Many To One Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Many To One Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseManyToOneImpl(ManyToOneImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>One To Many</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>One To Many</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseOneToMany(OneToMany object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>One To Many Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>One To Many Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseOneToManyImpl(OneToManyImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>One To One</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>One To One</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseOneToOne(OneToOne object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>One To One Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>One To One Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseOneToOneImpl(OneToOneImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Many To Many</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Many To Many</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseManyToMany(ManyToMany object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Many To Many Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Many To Many Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseManyToManyImpl(ManyToManyImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Embedded</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Embedded</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEmbedded(Embedded object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Embedded Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Embedded Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEmbeddedImpl(EmbeddedImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Transient</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Transient</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseTransient(Transient object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Transient Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Transient Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseTransientImpl(TransientImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Association Override</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Association Override</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseAssociationOverride(AssociationOverride object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Attribute Override</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Attribute Override</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseAttributeOverride(AttributeOverride object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Attribute Override Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Attribute Override Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseAttributeOverrideImpl(AttributeOverrideImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Cascade Type</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Cascade Type</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseCascadeType(CascadeType object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Cascade Type Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Cascade Type Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseCascadeTypeImpl(CascadeTypeImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Named Column</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Named Column</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNamedColumn(NamedColumn object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Abstract Column</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Abstract Column</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseAbstractColumn(AbstractColumn object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Column</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Column</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseColumn(Column object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Column Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Column Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseColumnImpl(ColumnImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Column Result</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Column Result</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseColumnResult(ColumnResult object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Discriminator Column</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Discriminator Column</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseDiscriminatorColumn(DiscriminatorColumn object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Entity Listeners</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Entity Listeners</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEntityListeners(EntityListeners object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Entity Listener</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Entity Listener</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEntityListener(EntityListener object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Entity Result</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Entity Result</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEntityResult(EntityResult object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Field Result</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Field Result</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseFieldResult(FieldResult object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Generated Value</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Generated Value</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseGeneratedValue(GeneratedValue object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Generated Value Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Generated Value Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseGeneratedValueImpl(GeneratedValueImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Id Class</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Id Class</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseIdClass(IdClass object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Inheritance</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Inheritance</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseInheritance(Inheritance object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Join Column</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Join Column</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseJoinColumn(JoinColumn object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Join Column Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Join Column Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseJoinColumnImpl(JoinColumnImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Join Table</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Join Table</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseJoinTable(JoinTable object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Join Table Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Join Table Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseJoinTableImpl(JoinTableImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Lob</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Lob</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseLob(Lob object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Map Key</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Map Key</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseMapKey(MapKey object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Map Key Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Map Key Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseMapKeyImpl(MapKeyImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Query</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Query</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseQuery(Query object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Event Method</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Event Method</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEventMethod(EventMethod object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Named Native Query</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Named Native Query</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNamedNativeQuery(NamedNativeQuery object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Named Query</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Named Query</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseNamedQuery(NamedQuery object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Post Load</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Post Load</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T casePostLoad(PostLoad object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Post Persist</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Post Persist</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T casePostPersist(PostPersist object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Post Remove</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Post Remove</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T casePostRemove(PostRemove object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Post Update</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Post Update</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T casePostUpdate(PostUpdate object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Pre Persist</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Pre Persist</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T casePrePersist(PrePersist object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Pre Remove</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Pre Remove</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T casePreRemove(PreRemove object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Pre Update</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Pre Update</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T casePreUpdate(PreUpdate object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Query Hint</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Query Hint</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseQueryHint(QueryHint object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Abstract Table</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Abstract Table</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseAbstractTable(AbstractTable object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Sql Result Set Mapping</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Sql Result Set Mapping</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseSqlResultSetMapping(SqlResultSetMapping object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Primary Key Join Column</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Primary Key Join Column</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T casePrimaryKeyJoinColumn(PrimaryKeyJoinColumn object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Secondary Table</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Secondary Table</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseSecondaryTable(SecondaryTable object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Generator</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Generator</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseGenerator(Generator object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Sequence Generator</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Sequence Generator</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseSequenceGenerator(SequenceGenerator object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Sequence Generator Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Sequence Generator Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseSequenceGeneratorImpl(SequenceGeneratorImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Table</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Table</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseTable(Table object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Table Generator</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Table Generator</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseTableGenerator(TableGenerator object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Table Generator Impl</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Table Generator Impl</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseTableGeneratorImpl(TableGeneratorImpl object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Unique Constraint</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Unique Constraint</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseUniqueConstraint(UniqueConstraint object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public T defaultCase(EObject object)
+ {
+ return null;
+ }
+
+} //OrmSwitch
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceArtifactEdit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceArtifactEdit.java
new file mode 100644
index 0000000000..2ea1653fb5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceArtifactEdit.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.persistence;
+
+import java.io.IOException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.resource.common.JpaArtifactEdit;
+
+public class PersistenceArtifactEdit extends JpaArtifactEdit
+{
+ /**
+ * @param aProject
+ * @return a persistence artifact for project aProject.
+ * Opened only for read access (no write)
+ */
+ public static PersistenceArtifactEdit getArtifactEditForRead(IProject aProject) {
+ PersistenceArtifactEdit artifactEdit = null;
+ try {
+ artifactEdit = new PersistenceArtifactEdit(aProject, true);
+ }
+ catch (IllegalArgumentException iae) {
+ // suppress illegal argument exception
+ JptCorePlugin.log(iae);
+ }
+ return artifactEdit;
+ }
+
+ /**
+ * @param aProject
+ * @return a persistence artifact for the project aProject.
+ * Opened for both write and read access
+ */
+ public static PersistenceArtifactEdit getArtifactEditForWrite(IProject aProject) {
+ PersistenceArtifactEdit artifactEdit = null;
+ try {
+ artifactEdit = new PersistenceArtifactEdit(aProject, false);
+ }
+ catch (IllegalArgumentException iae) {
+ // suppress illegal argument exception
+ JptCorePlugin.log(iae);
+ }
+ return artifactEdit;
+ }
+
+
+ public PersistenceArtifactEdit(IProject aProject, boolean toAccessAsReadOnly)
+ throws IllegalArgumentException {
+ super(aProject, toAccessAsReadOnly);
+ }
+
+
+ @Override
+ public PersistenceResource getResource(IFile file) {
+ // This *seems* to do the same basic thing as below, but circumvents the
+ // URI munging that ArtifactEditModel does (see bug 209093)
+ try {
+ PersistenceResource resource =
+ (PersistenceResource) getArtifactEditModel().createResource(URI.createPlatformResourceURI(file.getFullPath().toString()));
+ if (! resource.isLoaded()) {
+ resource.load(getArtifactEditModel().getResourceSet().getLoadOptions());
+ }
+ return resource;
+ }
+ catch (ClassCastException cce) {
+ return null;
+ }
+ catch (IOException ioe) {
+ JptCorePlugin.log(ioe);
+ return null;
+ }
+ }
+
+ @Override
+ public PersistenceResource getResource(String fileURI) {
+ try {
+ return (PersistenceResource) getArtifactEditModel().getResource(URI.createURI(fileURI));
+ }
+ catch (ClassCastException cce) {
+ return null;
+ }
+ }
+
+ /**
+ * Return a persistence resource for the default deploy location
+ */
+ public PersistenceResource getResource() {
+ return getResource(JptCorePlugin.persistenceXmlDeploymentURI(getProject()));
+ }
+
+ /**
+ * Create a persistence resource with base defaults
+ */
+ public PersistenceResource createDefaultResource() {
+ PersistenceResource resource = getResource();
+ XmlPersistence persistence = PersistenceFactory.eINSTANCE.createXmlPersistence();
+ persistence.setVersion("1.0");
+ XmlPersistenceUnit pUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
+ pUnit.setName(getProject().getName());
+ persistence.getPersistenceUnits().add(pUnit);
+ resource.getContents().add(persistence);
+ save(null);
+ return resource;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceFactory.java
new file mode 100644
index 0000000000..51bccc6bb4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceFactory.java
@@ -0,0 +1,287 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.persistence;
+
+import org.eclipse.emf.common.util.Enumerator;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage
+ * @generated
+ */
+public class PersistenceFactory extends EFactoryImpl
+{
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final PersistenceFactory eINSTANCE = init();
+
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static PersistenceFactory init()
+ {
+ try
+ {
+ PersistenceFactory thePersistenceFactory = (PersistenceFactory)EPackage.Registry.INSTANCE.getEFactory("jpt.persistence.xmi");
+ if (thePersistenceFactory != null)
+ {
+ return thePersistenceFactory;
+ }
+ }
+ catch (Exception exception)
+ {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new PersistenceFactory();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PersistenceFactory()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass)
+ {
+ switch (eClass.getClassifierID())
+ {
+ case PersistencePackage.XML_PERSISTENCE: return (EObject)createXmlPersistence();
+ case PersistencePackage.XML_PERSISTENCE_UNIT: return (EObject)createXmlPersistenceUnit();
+ case PersistencePackage.XML_MAPPING_FILE_REF: return (EObject)createXmlMappingFileRef();
+ case PersistencePackage.XML_JAVA_CLASS_REF: return (EObject)createXmlJavaClassRef();
+ case PersistencePackage.XML_PROPERTIES: return (EObject)createXmlProperties();
+ case PersistencePackage.XML_PROPERTY: return (EObject)createXmlProperty();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object createFromString(EDataType eDataType, String initialValue)
+ {
+ switch (eDataType.getClassifierID())
+ {
+ case PersistencePackage.XML_PERSISTENCE_UNIT_TRANSACTION_TYPE:
+ return createXmlPersistenceUnitTransactionTypeFromString(eDataType, initialValue);
+ case PersistencePackage.XML_PERSISTENCE_UNIT_TRANSACTION_TYPE_OBJECT:
+ return createXmlPersistenceUnitTransactionTypeObjectFromString(eDataType, initialValue);
+ case PersistencePackage.XML_VERSION:
+ return createXmlVersionFromString(eDataType, initialValue);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String convertToString(EDataType eDataType, Object instanceValue)
+ {
+ switch (eDataType.getClassifierID())
+ {
+ case PersistencePackage.XML_PERSISTENCE_UNIT_TRANSACTION_TYPE:
+ return convertXmlPersistenceUnitTransactionTypeToString(eDataType, instanceValue);
+ case PersistencePackage.XML_PERSISTENCE_UNIT_TRANSACTION_TYPE_OBJECT:
+ return convertXmlPersistenceUnitTransactionTypeObjectToString(eDataType, instanceValue);
+ case PersistencePackage.XML_VERSION:
+ return convertXmlVersionToString(eDataType, instanceValue);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlPersistence createXmlPersistence()
+ {
+ XmlPersistence xmlPersistence = new XmlPersistence();
+ return xmlPersistence;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlPersistenceUnit createXmlPersistenceUnit()
+ {
+ XmlPersistenceUnit xmlPersistenceUnit = new XmlPersistenceUnit();
+ return xmlPersistenceUnit;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlMappingFileRef createXmlMappingFileRef()
+ {
+ XmlMappingFileRef xmlMappingFileRef = new XmlMappingFileRef();
+ return xmlMappingFileRef;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlJavaClassRef createXmlJavaClassRef()
+ {
+ XmlJavaClassRef xmlJavaClassRef = new XmlJavaClassRef();
+ return xmlJavaClassRef;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlProperties createXmlProperties()
+ {
+ XmlProperties xmlProperties = new XmlProperties();
+ return xmlProperties;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlProperty createXmlProperty()
+ {
+ XmlProperty xmlProperty = new XmlProperty();
+ return xmlProperty;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public XmlPersistenceUnitTransactionType createXmlPersistenceUnitTransactionTypeFromString(EDataType eDataType, String initialValue)
+ {
+ XmlPersistenceUnitTransactionType result = XmlPersistenceUnitTransactionType.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertXmlPersistenceUnitTransactionTypeToString(EDataType eDataType, Object instanceValue)
+ {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Enumerator createXmlPersistenceUnitTransactionTypeObjectFromString(EDataType eDataType, String initialValue)
+ {
+ return (Enumerator)super.createFromString(eDataType, initialValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertXmlPersistenceUnitTransactionTypeObjectToString(EDataType eDataType, Object instanceValue)
+ {
+ return super.convertToString(eDataType, instanceValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String createXmlVersionFromString(EDataType eDataType, String initialValue)
+ {
+ return (String)super.createFromString(eDataType, initialValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertXmlVersionToString(EDataType eDataType, Object instanceValue)
+ {
+ return super.convertToString(eDataType, instanceValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PersistencePackage getPersistencePackage()
+ {
+ return (PersistencePackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static PersistencePackage getPackage()
+ {
+ return PersistencePackage.eINSTANCE;
+ }
+
+} //PersistenceFactory
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistencePackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistencePackage.java
new file mode 100644
index 0000000000..b221e37e32
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistencePackage.java
@@ -0,0 +1,1320 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.persistence;
+
+import org.eclipse.emf.common.util.Enumerator;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
+import org.eclipse.jpt.core.internal.resource.orm.OrmPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory
+ * @model kind="package"
+ * @generated
+ */
+public class PersistencePackage extends EPackageImpl
+{
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String eNAME = "persistence";
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String eNS_URI = "jpt.persistence.xmi";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String eNS_PREFIX = "org.eclipse.jpt.core.resource.persistence";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final PersistencePackage eINSTANCE = org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence <em>Xml Persistence</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistence()
+ * @generated
+ */
+ public static final int XML_PERSISTENCE = 0;
+
+ /**
+ * The feature id for the '<em><b>Persistence Units</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE__PERSISTENCE_UNITS = 0;
+
+ /**
+ * The feature id for the '<em><b>Version</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE__VERSION = 1;
+
+ /**
+ * The number of structural features of the '<em>Xml Persistence</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit <em>Xml Persistence Unit</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnit()
+ * @generated
+ */
+ public static final int XML_PERSISTENCE_UNIT = 1;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT__DESCRIPTION = 0;
+
+ /**
+ * The feature id for the '<em><b>Provider</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT__PROVIDER = 1;
+
+ /**
+ * The feature id for the '<em><b>Jta Data Source</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE = 2;
+
+ /**
+ * The feature id for the '<em><b>Non Jta Data Source</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE = 3;
+
+ /**
+ * The feature id for the '<em><b>Mapping Files</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT__MAPPING_FILES = 4;
+
+ /**
+ * The feature id for the '<em><b>Jar Files</b></em>' attribute list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT__JAR_FILES = 5;
+
+ /**
+ * The feature id for the '<em><b>Classes</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT__CLASSES = 6;
+
+ /**
+ * The feature id for the '<em><b>Exclude Unlisted Classes</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES = 7;
+
+ /**
+ * The feature id for the '<em><b>Properties</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT__PROPERTIES = 8;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT__NAME = 9;
+
+ /**
+ * The feature id for the '<em><b>Transaction Type</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT__TRANSACTION_TYPE = 10;
+
+ /**
+ * The number of structural features of the '<em>Xml Persistence Unit</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PERSISTENCE_UNIT_FEATURE_COUNT = 11;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef <em>Xml Mapping File Ref</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlMappingFileRef()
+ * @generated
+ */
+ public static final int XML_MAPPING_FILE_REF = 2;
+
+ /**
+ * The feature id for the '<em><b>File Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MAPPING_FILE_REF__FILE_NAME = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Mapping File Ref</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_MAPPING_FILE_REF_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef <em>Xml Java Class Ref</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlJavaClassRef()
+ * @generated
+ */
+ public static final int XML_JAVA_CLASS_REF = 3;
+
+ /**
+ * The feature id for the '<em><b>Java Class</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_JAVA_CLASS_REF__JAVA_CLASS = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Java Class Ref</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_JAVA_CLASS_REF_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperties <em>Xml Properties</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlProperties
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlProperties()
+ * @generated
+ */
+ public static final int XML_PROPERTIES = 4;
+
+ /**
+ * The feature id for the '<em><b>Properties</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PROPERTIES__PROPERTIES = 0;
+
+ /**
+ * The number of structural features of the '<em>Xml Properties</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PROPERTIES_FEATURE_COUNT = 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperty <em>Xml Property</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlProperty
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlProperty()
+ * @generated
+ */
+ public static final int XML_PROPERTY = 5;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PROPERTY__NAME = 0;
+
+ /**
+ * The feature id for the '<em><b>Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PROPERTY__VALUE = 1;
+
+ /**
+ * The number of structural features of the '<em>Xml Property</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int XML_PROPERTY_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnitTransactionType <em>Xml Persistence Unit Transaction Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnitTransactionType
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnitTransactionType()
+ * @generated
+ */
+ public static final int XML_PERSISTENCE_UNIT_TRANSACTION_TYPE = 6;
+
+ /**
+ * The meta object id for the '<em>Xml Persistence Unit Transaction Type Object</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.common.util.Enumerator
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnitTransactionTypeObject()
+ * @generated
+ */
+ public static final int XML_PERSISTENCE_UNIT_TRANSACTION_TYPE_OBJECT = 7;
+
+ /**
+ * The meta object id for the '<em>Xml Version</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see java.lang.String
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlVersion()
+ * @generated
+ */
+ public static final int XML_VERSION = 8;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlPersistenceEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlPersistenceUnitEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlMappingFileRefEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlJavaClassRefEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlPropertiesEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass xmlPropertyEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum xmlPersistenceUnitTransactionTypeEEnum = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EDataType xmlPersistenceUnitTransactionTypeObjectEDataType = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EDataType xmlVersionEDataType = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private PersistencePackage()
+ {
+ super(eNS_URI, PersistenceFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this
+ * model, and for any others upon which it depends. Simple
+ * dependencies are satisfied by calling this method on all
+ * dependent packages before doing anything else. This method drives
+ * initialization for interdependent packages directly, in parallel
+ * with this package, itself.
+ * <p>Of this package and its interdependencies, all packages which
+ * have not yet been registered by their URI values are first created
+ * and registered. The packages are then initialized in two steps:
+ * meta-model objects for all of the packages are created before any
+ * are initialized, since one package's meta-model objects may refer to
+ * those of another.
+ * <p>Invocation of this method will not affect any packages that have
+ * already been initialized.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static PersistencePackage init()
+ {
+ if (isInited) return (PersistencePackage)EPackage.Registry.INSTANCE.getEPackage(PersistencePackage.eNS_URI);
+
+ // Obtain or create and register package
+ PersistencePackage thePersistencePackage = (PersistencePackage)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof PersistencePackage ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new PersistencePackage());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ EcorePackage.eINSTANCE.eClass();
+ XMLTypePackage.eINSTANCE.eClass();
+
+ // Obtain or create and register interdependencies
+ OrmPackage theOrmPackage = (OrmPackage)(EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) instanceof OrmPackage ? EPackage.Registry.INSTANCE.getEPackage(OrmPackage.eNS_URI) : OrmPackage.eINSTANCE);
+
+ // Create package meta-data objects
+ thePersistencePackage.createPackageContents();
+ theOrmPackage.createPackageContents();
+
+ // Initialize created meta-data
+ thePersistencePackage.initializePackageContents();
+ theOrmPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ thePersistencePackage.freeze();
+
+ return thePersistencePackage;
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence <em>Xml Persistence</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Persistence</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence
+ * @generated
+ */
+ public EClass getXmlPersistence()
+ {
+ return xmlPersistenceEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence#getPersistenceUnits <em>Persistence Units</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Persistence Units</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence#getPersistenceUnits()
+ * @see #getXmlPersistence()
+ * @generated
+ */
+ public EReference getXmlPersistence_PersistenceUnits()
+ {
+ return (EReference)xmlPersistenceEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence#getVersion <em>Version</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Version</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence#getVersion()
+ * @see #getXmlPersistence()
+ * @generated
+ */
+ public EAttribute getXmlPersistence_Version()
+ {
+ return (EAttribute)xmlPersistenceEClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit <em>Xml Persistence Unit</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Persistence Unit</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit
+ * @generated
+ */
+ public EClass getXmlPersistenceUnit()
+ {
+ return xmlPersistenceUnitEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getDescription()
+ * @see #getXmlPersistenceUnit()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnit_Description()
+ {
+ return (EAttribute)xmlPersistenceUnitEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getProvider <em>Provider</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Provider</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getProvider()
+ * @see #getXmlPersistenceUnit()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnit_Provider()
+ {
+ return (EAttribute)xmlPersistenceUnitEClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getJtaDataSource <em>Jta Data Source</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Jta Data Source</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getJtaDataSource()
+ * @see #getXmlPersistenceUnit()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnit_JtaDataSource()
+ {
+ return (EAttribute)xmlPersistenceUnitEClass.getEStructuralFeatures().get(2);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getNonJtaDataSource <em>Non Jta Data Source</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Non Jta Data Source</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getNonJtaDataSource()
+ * @see #getXmlPersistenceUnit()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnit_NonJtaDataSource()
+ {
+ return (EAttribute)xmlPersistenceUnitEClass.getEStructuralFeatures().get(3);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getMappingFiles <em>Mapping Files</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Mapping Files</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getMappingFiles()
+ * @see #getXmlPersistenceUnit()
+ * @generated
+ */
+ public EReference getXmlPersistenceUnit_MappingFiles()
+ {
+ return (EReference)xmlPersistenceUnitEClass.getEStructuralFeatures().get(4);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute list '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getJarFiles <em>Jar Files</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute list '<em>Jar Files</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getJarFiles()
+ * @see #getXmlPersistenceUnit()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnit_JarFiles()
+ {
+ return (EAttribute)xmlPersistenceUnitEClass.getEStructuralFeatures().get(5);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getClasses <em>Classes</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Classes</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getClasses()
+ * @see #getXmlPersistenceUnit()
+ * @generated
+ */
+ public EReference getXmlPersistenceUnit_Classes()
+ {
+ return (EReference)xmlPersistenceUnitEClass.getEStructuralFeatures().get(6);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#isExcludeUnlistedClasses <em>Exclude Unlisted Classes</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Exclude Unlisted Classes</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#isExcludeUnlistedClasses()
+ * @see #getXmlPersistenceUnit()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnit_ExcludeUnlistedClasses()
+ {
+ return (EAttribute)xmlPersistenceUnitEClass.getEStructuralFeatures().get(7);
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getProperties <em>Properties</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Properties</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getProperties()
+ * @see #getXmlPersistenceUnit()
+ * @generated
+ */
+ public EReference getXmlPersistenceUnit_Properties()
+ {
+ return (EReference)xmlPersistenceUnitEClass.getEStructuralFeatures().get(8);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getName()
+ * @see #getXmlPersistenceUnit()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnit_Name()
+ {
+ return (EAttribute)xmlPersistenceUnitEClass.getEStructuralFeatures().get(9);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getTransactionType <em>Transaction Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Transaction Type</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getTransactionType()
+ * @see #getXmlPersistenceUnit()
+ * @generated
+ */
+ public EAttribute getXmlPersistenceUnit_TransactionType()
+ {
+ return (EAttribute)xmlPersistenceUnitEClass.getEStructuralFeatures().get(10);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef <em>Xml Mapping File Ref</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Mapping File Ref</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef
+ * @generated
+ */
+ public EClass getXmlMappingFileRef()
+ {
+ return xmlMappingFileRefEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef#getFileName <em>File Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>File Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef#getFileName()
+ * @see #getXmlMappingFileRef()
+ * @generated
+ */
+ public EAttribute getXmlMappingFileRef_FileName()
+ {
+ return (EAttribute)xmlMappingFileRefEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef <em>Xml Java Class Ref</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Java Class Ref</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef
+ * @generated
+ */
+ public EClass getXmlJavaClassRef()
+ {
+ return xmlJavaClassRefEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef#getJavaClass <em>Java Class</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Java Class</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef#getJavaClass()
+ * @see #getXmlJavaClassRef()
+ * @generated
+ */
+ public EAttribute getXmlJavaClassRef_JavaClass()
+ {
+ return (EAttribute)xmlJavaClassRefEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperties <em>Xml Properties</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Properties</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlProperties
+ * @generated
+ */
+ public EClass getXmlProperties()
+ {
+ return xmlPropertiesEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperties#getProperties <em>Properties</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Properties</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlProperties#getProperties()
+ * @see #getXmlProperties()
+ * @generated
+ */
+ public EReference getXmlProperties_Properties()
+ {
+ return (EReference)xmlPropertiesEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperty <em>Xml Property</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Xml Property</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlProperty
+ * @generated
+ */
+ public EClass getXmlProperty()
+ {
+ return xmlPropertyEClass;
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperty#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlProperty#getName()
+ * @see #getXmlProperty()
+ * @generated
+ */
+ public EAttribute getXmlProperty_Name()
+ {
+ return (EAttribute)xmlPropertyEClass.getEStructuralFeatures().get(0);
+ }
+
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperty#getValue <em>Value</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Value</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlProperty#getValue()
+ * @see #getXmlProperty()
+ * @generated
+ */
+ public EAttribute getXmlProperty_Value()
+ {
+ return (EAttribute)xmlPropertyEClass.getEStructuralFeatures().get(1);
+ }
+
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnitTransactionType <em>Xml Persistence Unit Transaction Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Xml Persistence Unit Transaction Type</em>'.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnitTransactionType
+ * @generated
+ */
+ public EEnum getXmlPersistenceUnitTransactionType()
+ {
+ return xmlPersistenceUnitTransactionTypeEEnum;
+ }
+
+
+ /**
+ * Returns the meta object for data type '{@link org.eclipse.emf.common.util.Enumerator <em>Xml Persistence Unit Transaction Type Object</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for data type '<em>Xml Persistence Unit Transaction Type Object</em>'.
+ * @see org.eclipse.emf.common.util.Enumerator
+ * @model instanceClass="org.eclipse.emf.common.util.Enumerator"
+ * @generated
+ */
+ public EDataType getXmlPersistenceUnitTransactionTypeObject()
+ {
+ return xmlPersistenceUnitTransactionTypeObjectEDataType;
+ }
+
+
+ /**
+ * Returns the meta object for data type '{@link java.lang.String <em>Xml Version</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for data type '<em>Xml Version</em>'.
+ * @see java.lang.String
+ * @model instanceClass="java.lang.String"
+ * @generated
+ */
+ public EDataType getXmlVersion()
+ {
+ return xmlVersionEDataType;
+ }
+
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ public PersistenceFactory getPersistenceFactory()
+ {
+ return (PersistenceFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents()
+ {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ xmlPersistenceEClass = createEClass(XML_PERSISTENCE);
+ createEReference(xmlPersistenceEClass, XML_PERSISTENCE__PERSISTENCE_UNITS);
+ createEAttribute(xmlPersistenceEClass, XML_PERSISTENCE__VERSION);
+
+ xmlPersistenceUnitEClass = createEClass(XML_PERSISTENCE_UNIT);
+ createEAttribute(xmlPersistenceUnitEClass, XML_PERSISTENCE_UNIT__DESCRIPTION);
+ createEAttribute(xmlPersistenceUnitEClass, XML_PERSISTENCE_UNIT__PROVIDER);
+ createEAttribute(xmlPersistenceUnitEClass, XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE);
+ createEAttribute(xmlPersistenceUnitEClass, XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE);
+ createEReference(xmlPersistenceUnitEClass, XML_PERSISTENCE_UNIT__MAPPING_FILES);
+ createEAttribute(xmlPersistenceUnitEClass, XML_PERSISTENCE_UNIT__JAR_FILES);
+ createEReference(xmlPersistenceUnitEClass, XML_PERSISTENCE_UNIT__CLASSES);
+ createEAttribute(xmlPersistenceUnitEClass, XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES);
+ createEReference(xmlPersistenceUnitEClass, XML_PERSISTENCE_UNIT__PROPERTIES);
+ createEAttribute(xmlPersistenceUnitEClass, XML_PERSISTENCE_UNIT__NAME);
+ createEAttribute(xmlPersistenceUnitEClass, XML_PERSISTENCE_UNIT__TRANSACTION_TYPE);
+
+ xmlMappingFileRefEClass = createEClass(XML_MAPPING_FILE_REF);
+ createEAttribute(xmlMappingFileRefEClass, XML_MAPPING_FILE_REF__FILE_NAME);
+
+ xmlJavaClassRefEClass = createEClass(XML_JAVA_CLASS_REF);
+ createEAttribute(xmlJavaClassRefEClass, XML_JAVA_CLASS_REF__JAVA_CLASS);
+
+ xmlPropertiesEClass = createEClass(XML_PROPERTIES);
+ createEReference(xmlPropertiesEClass, XML_PROPERTIES__PROPERTIES);
+
+ xmlPropertyEClass = createEClass(XML_PROPERTY);
+ createEAttribute(xmlPropertyEClass, XML_PROPERTY__NAME);
+ createEAttribute(xmlPropertyEClass, XML_PROPERTY__VALUE);
+
+ // Create enums
+ xmlPersistenceUnitTransactionTypeEEnum = createEEnum(XML_PERSISTENCE_UNIT_TRANSACTION_TYPE);
+
+ // Create data types
+ xmlPersistenceUnitTransactionTypeObjectEDataType = createEDataType(XML_PERSISTENCE_UNIT_TRANSACTION_TYPE_OBJECT);
+ xmlVersionEDataType = createEDataType(XML_VERSION);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents()
+ {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Obtain other dependent packages
+ XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI);
+ EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(xmlPersistenceEClass, XmlPersistence.class, "XmlPersistence", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlPersistence_PersistenceUnits(), this.getXmlPersistenceUnit(), null, "persistenceUnits", null, 0, -1, XmlPersistence.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlPersistence_Version(), this.getXmlVersion(), "version", null, 1, 1, XmlPersistence.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlPersistenceUnitEClass, XmlPersistenceUnit.class, "XmlPersistenceUnit", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlPersistenceUnit_Description(), theXMLTypePackage.getString(), "description", null, 0, 1, XmlPersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlPersistenceUnit_Provider(), theXMLTypePackage.getString(), "provider", null, 0, 1, XmlPersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlPersistenceUnit_JtaDataSource(), theXMLTypePackage.getString(), "jtaDataSource", null, 0, 1, XmlPersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlPersistenceUnit_NonJtaDataSource(), theXMLTypePackage.getString(), "nonJtaDataSource", null, 0, 1, XmlPersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlPersistenceUnit_MappingFiles(), this.getXmlMappingFileRef(), null, "mappingFiles", null, 0, -1, XmlPersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlPersistenceUnit_JarFiles(), theXMLTypePackage.getString(), "jarFiles", null, 0, -1, XmlPersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlPersistenceUnit_Classes(), this.getXmlJavaClassRef(), null, "classes", null, 0, -1, XmlPersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlPersistenceUnit_ExcludeUnlistedClasses(), theXMLTypePackage.getBoolean(), "excludeUnlistedClasses", "false", 0, 1, XmlPersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getXmlPersistenceUnit_Properties(), this.getXmlProperties(), null, "properties", null, 0, 1, XmlPersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlPersistenceUnit_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, XmlPersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlPersistenceUnit_TransactionType(), this.getXmlPersistenceUnitTransactionType(), "transactionType", "JTA", 0, 1, XmlPersistenceUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlMappingFileRefEClass, XmlMappingFileRef.class, "XmlMappingFileRef", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlMappingFileRef_FileName(), theEcorePackage.getEString(), "fileName", "", 0, 1, XmlMappingFileRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
+
+ initEClass(xmlJavaClassRefEClass, XmlJavaClassRef.class, "XmlJavaClassRef", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlJavaClassRef_JavaClass(), theEcorePackage.getEString(), "javaClass", null, 0, 1, XmlJavaClassRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
+
+ initEClass(xmlPropertiesEClass, XmlProperties.class, "XmlProperties", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getXmlProperties_Properties(), this.getXmlProperty(), null, "properties", null, 0, -1, XmlProperties.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(xmlPropertyEClass, XmlProperty.class, "XmlProperty", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getXmlProperty_Name(), theXMLTypePackage.getString(), "name", null, 1, 1, XmlProperty.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getXmlProperty_Value(), theXMLTypePackage.getString(), "value", null, 1, 1, XmlProperty.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Initialize enums and add enum literals
+ initEEnum(xmlPersistenceUnitTransactionTypeEEnum, XmlPersistenceUnitTransactionType.class, "XmlPersistenceUnitTransactionType");
+ addEEnumLiteral(xmlPersistenceUnitTransactionTypeEEnum, XmlPersistenceUnitTransactionType.JTA);
+ addEEnumLiteral(xmlPersistenceUnitTransactionTypeEEnum, XmlPersistenceUnitTransactionType.RESOURCE_LOCAL);
+
+ // Initialize data types
+ initEDataType(xmlPersistenceUnitTransactionTypeObjectEDataType, Enumerator.class, "XmlPersistenceUnitTransactionTypeObject", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
+ initEDataType(xmlVersionEDataType, String.class, "XmlVersion", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public interface Literals
+ {
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence <em>Xml Persistence</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistence()
+ * @generated
+ */
+ public static final EClass XML_PERSISTENCE = eINSTANCE.getXmlPersistence();
+
+ /**
+ * The meta object literal for the '<em><b>Persistence Units</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference XML_PERSISTENCE__PERSISTENCE_UNITS = eINSTANCE.getXmlPersistence_PersistenceUnits();
+
+ /**
+ * The meta object literal for the '<em><b>Version</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_PERSISTENCE__VERSION = eINSTANCE.getXmlPersistence_Version();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit <em>Xml Persistence Unit</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnit()
+ * @generated
+ */
+ public static final EClass XML_PERSISTENCE_UNIT = eINSTANCE.getXmlPersistenceUnit();
+
+ /**
+ * The meta object literal for the '<em><b>Description</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_PERSISTENCE_UNIT__DESCRIPTION = eINSTANCE.getXmlPersistenceUnit_Description();
+
+ /**
+ * The meta object literal for the '<em><b>Provider</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_PERSISTENCE_UNIT__PROVIDER = eINSTANCE.getXmlPersistenceUnit_Provider();
+
+ /**
+ * The meta object literal for the '<em><b>Jta Data Source</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE = eINSTANCE.getXmlPersistenceUnit_JtaDataSource();
+
+ /**
+ * The meta object literal for the '<em><b>Non Jta Data Source</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE = eINSTANCE.getXmlPersistenceUnit_NonJtaDataSource();
+
+ /**
+ * The meta object literal for the '<em><b>Mapping Files</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference XML_PERSISTENCE_UNIT__MAPPING_FILES = eINSTANCE.getXmlPersistenceUnit_MappingFiles();
+
+ /**
+ * The meta object literal for the '<em><b>Jar Files</b></em>' attribute list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_PERSISTENCE_UNIT__JAR_FILES = eINSTANCE.getXmlPersistenceUnit_JarFiles();
+
+ /**
+ * The meta object literal for the '<em><b>Classes</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference XML_PERSISTENCE_UNIT__CLASSES = eINSTANCE.getXmlPersistenceUnit_Classes();
+
+ /**
+ * The meta object literal for the '<em><b>Exclude Unlisted Classes</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES = eINSTANCE.getXmlPersistenceUnit_ExcludeUnlistedClasses();
+
+ /**
+ * The meta object literal for the '<em><b>Properties</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference XML_PERSISTENCE_UNIT__PROPERTIES = eINSTANCE.getXmlPersistenceUnit_Properties();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_PERSISTENCE_UNIT__NAME = eINSTANCE.getXmlPersistenceUnit_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Transaction Type</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_PERSISTENCE_UNIT__TRANSACTION_TYPE = eINSTANCE.getXmlPersistenceUnit_TransactionType();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef <em>Xml Mapping File Ref</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlMappingFileRef()
+ * @generated
+ */
+ public static final EClass XML_MAPPING_FILE_REF = eINSTANCE.getXmlMappingFileRef();
+
+ /**
+ * The meta object literal for the '<em><b>File Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_MAPPING_FILE_REF__FILE_NAME = eINSTANCE.getXmlMappingFileRef_FileName();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef <em>Xml Java Class Ref</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlJavaClassRef()
+ * @generated
+ */
+ public static final EClass XML_JAVA_CLASS_REF = eINSTANCE.getXmlJavaClassRef();
+
+ /**
+ * The meta object literal for the '<em><b>Java Class</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_JAVA_CLASS_REF__JAVA_CLASS = eINSTANCE.getXmlJavaClassRef_JavaClass();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperties <em>Xml Properties</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlProperties
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlProperties()
+ * @generated
+ */
+ public static final EClass XML_PROPERTIES = eINSTANCE.getXmlProperties();
+
+ /**
+ * The meta object literal for the '<em><b>Properties</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EReference XML_PROPERTIES__PROPERTIES = eINSTANCE.getXmlProperties_Properties();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperty <em>Xml Property</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlProperty
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlProperty()
+ * @generated
+ */
+ public static final EClass XML_PROPERTY = eINSTANCE.getXmlProperty();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_PROPERTY__NAME = eINSTANCE.getXmlProperty_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Value</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final EAttribute XML_PROPERTY__VALUE = eINSTANCE.getXmlProperty_Value();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnitTransactionType <em>Xml Persistence Unit Transaction Type</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnitTransactionType
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnitTransactionType()
+ * @generated
+ */
+ public static final EEnum XML_PERSISTENCE_UNIT_TRANSACTION_TYPE = eINSTANCE.getXmlPersistenceUnitTransactionType();
+
+ /**
+ * The meta object literal for the '<em>Xml Persistence Unit Transaction Type Object</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.common.util.Enumerator
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnitTransactionTypeObject()
+ * @generated
+ */
+ public static final EDataType XML_PERSISTENCE_UNIT_TRANSACTION_TYPE_OBJECT = eINSTANCE.getXmlPersistenceUnitTransactionTypeObject();
+
+ /**
+ * The meta object literal for the '<em>Xml Version</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see java.lang.String
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlVersion()
+ * @generated
+ */
+ public static final EDataType XML_VERSION = eINSTANCE.getXmlVersion();
+
+ }
+
+} //PersistencePackage
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceResource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceResource.java
new file mode 100644
index 0000000000..299806ce99
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceResource.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.persistence;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jdt.core.ElementChangedEvent;
+import org.eclipse.jpt.core.internal.IJpaContentNode;
+import org.eclipse.jpt.core.internal.resource.common.JpaXmlResource;
+import org.eclipse.jpt.core.internal.resource.persistence.translators.PersistenceTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Renderer;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+import org.eclipse.wst.common.internal.emf.resource.TranslatorResource;
+
+public class PersistenceResource extends JpaXmlResource
+{
+ public PersistenceResource(Renderer aRenderer) {
+ super(aRenderer);
+ }
+
+ public PersistenceResource(URI uri, Renderer aRenderer) {
+ super(uri, aRenderer);
+ }
+
+ /**
+ * @see TranslatorResource#getRootTranslator()
+ */
+ public Translator getRootTranslator() {
+ return PersistenceTranslator.INSTANCE;
+ }
+
+ /**
+ * @see JpaXmlResource#getContentNode(int)
+ */
+ public IJpaContentNode getContentNode(int offset) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * @see JpaXmlResource#handleJavaElementChangedEvent(ElementChangedEvent)
+ */
+ public void handleJavaElementChangedEvent(ElementChangedEvent event) {
+ // TODO Auto-generated method stub
+ }
+
+ public XmlPersistence getPersistence() {
+ return (XmlPersistence) getRootObject();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceResourceFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceResourceFactory.java
new file mode 100644
index 0000000000..39e6698a09
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceResourceFactory.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.persistence;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.wst.common.internal.emf.resource.Renderer;
+import org.eclipse.wst.common.internal.emf.resource.RendererFactory;
+import org.eclipse.wst.common.internal.emf.resource.TranslatorResource;
+import org.eclipse.wst.common.internal.emf.resource.TranslatorResourceFactory;
+
+public class PersistenceResourceFactory extends TranslatorResourceFactory
+{
+ public PersistenceResourceFactory() {
+ this(RendererFactory.getDefaultRendererFactory());
+ }
+
+ public PersistenceResourceFactory(RendererFactory aRendererFactory) {
+ super(aRendererFactory);
+ }
+
+ public PersistenceResourceFactory(RendererFactory aRendererFactory, boolean listeningForUpdates) {
+ super(aRendererFactory, listeningForUpdates);
+ }
+
+
+ /**
+ * @see TranslatorResourceFactory#createResource(URI, Renderer)
+ */
+ protected TranslatorResource createResource(URI uri, Renderer renderer) {
+ return new PersistenceResource(uri, renderer);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceResourceModel.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceResourceModel.java
new file mode 100644
index 0000000000..a9d6a86614
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceResourceModel.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.resource.persistence;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jpt.core.internal.IResourceModel;
+import org.eclipse.jpt.core.internal.resource.common.JpaXmlResourceModel;
+
+public class PersistenceResourceModel extends JpaXmlResourceModel
+{
+ public PersistenceResourceModel(IFile file) {
+ super(file);
+ }
+
+
+ /**
+ * @see IResourceModel#getResourceType()
+ */
+ public String getResourceType() {
+ return IResourceModel.PERSISTENCE_RESOURCE_TYPE;
+ }
+
+ @Override
+ protected PersistenceArtifactEdit buildArtifactEdit(IProject project) {
+ return PersistenceArtifactEdit.getArtifactEditForRead(project);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/JavaClassRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlJavaClassRef.java
index 834c62bbe9..a75c4cd91a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/JavaClassRef.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlJavaClassRef.java
@@ -1,24 +1,21 @@
/*******************************************************************************
- * Copyright (c) 2007 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.content.persistence;
+ * Copyright (c) 2006, 2007 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.resource.persistence;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.core.internal.ITextRange;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.wst.common.internal.emf.utilities.DOMUtilities;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
/**
* <!-- begin-user-doc -->
@@ -28,15 +25,16 @@ import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
* <p>
* The following features are supported:
* <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.JavaClassRef#getJavaClass <em>Java Class</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef#getJavaClass <em>Java Class</em>}</li>
* </ul>
* </p>
*
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getJavaClassRef()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlJavaClassRef()
* @model kind="class"
+ * @extends IJpaEObject
* @generated
*/
-public class JavaClassRef extends XmlEObject
+public class XmlJavaClassRef extends JpaEObject implements IJpaEObject
{
/**
* The default value of the '{@link #getJavaClass() <em>Java Class</em>}' attribute.
@@ -63,7 +61,8 @@ public class JavaClassRef extends XmlEObject
* <!-- end-user-doc -->
* @generated
*/
- protected JavaClassRef() {
+ protected XmlJavaClassRef()
+ {
super();
}
@@ -73,52 +72,44 @@ public class JavaClassRef extends XmlEObject
* @generated
*/
@Override
- protected EClass eStaticClass() {
- return PersistencePackage.Literals.JAVA_CLASS_REF;
+ protected EClass eStaticClass()
+ {
+ return PersistencePackage.Literals.XML_JAVA_CLASS_REF;
}
/**
* Returns the value of the '<em><b>Java Class</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Java Class</em>' reference isn't clear,
+ * If the meaning of the '<em>Java Class</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Java Class</em>' attribute.
* @see #setJavaClass(String)
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getJavaClassRef_JavaClass()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlJavaClassRef_JavaClass()
* @model unique="false" ordered="false"
* @generated
*/
- public String getJavaClass() {
+ public String getJavaClass()
+ {
return javaClass;
}
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.JavaClassRef#getJavaClass <em>Java Class</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef#getJavaClass <em>Java Class</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Java Class</em>' attribute.
* @see #getJavaClass()
* @generated
*/
- public void setJavaClass(String newJavaClass) {
+ public void setJavaClass(String newJavaClass)
+ {
String oldJavaClass = javaClass;
javaClass = newJavaClass;
if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.JAVA_CLASS_REF__JAVA_CLASS, oldJavaClass, javaClass));
- }
-
- public IType findJdtType() {
- String fqClassName = getJavaClass();
- if (StringTools.stringIsEmpty(fqClassName)) {
- return null;
- }
- int dotIndex = fqClassName.lastIndexOf('.');
- String packageName = (dotIndex >= 0) ? fqClassName.substring(0, dotIndex) : "";
- String className = (dotIndex >= 0) ? fqClassName.substring(dotIndex + 1, fqClassName.length()) : fqClassName;
- return JDTTools.findType(packageName, className, getJpaProject().javaProject());
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_JAVA_CLASS_REF__JAVA_CLASS, oldJavaClass, javaClass));
}
/**
@@ -127,9 +118,11 @@ public class JavaClassRef extends XmlEObject
* @generated
*/
@Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case PersistencePackage.JAVA_CLASS_REF__JAVA_CLASS :
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_JAVA_CLASS_REF__JAVA_CLASS:
return getJavaClass();
}
return super.eGet(featureID, resolve, coreType);
@@ -141,10 +134,12 @@ public class JavaClassRef extends XmlEObject
* @generated
*/
@Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case PersistencePackage.JAVA_CLASS_REF__JAVA_CLASS :
- setJavaClass((String) newValue);
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_JAVA_CLASS_REF__JAVA_CLASS:
+ setJavaClass((String)newValue);
return;
}
super.eSet(featureID, newValue);
@@ -156,9 +151,11 @@ public class JavaClassRef extends XmlEObject
* @generated
*/
@Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case PersistencePackage.JAVA_CLASS_REF__JAVA_CLASS :
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_JAVA_CLASS_REF__JAVA_CLASS:
setJavaClass(JAVA_CLASS_EDEFAULT);
return;
}
@@ -171,9 +168,11 @@ public class JavaClassRef extends XmlEObject
* @generated
*/
@Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case PersistencePackage.JAVA_CLASS_REF__JAVA_CLASS :
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_JAVA_CLASS_REF__JAVA_CLASS:
return JAVA_CLASS_EDEFAULT == null ? javaClass != null : !JAVA_CLASS_EDEFAULT.equals(javaClass);
}
return super.eIsSet(featureID);
@@ -185,9 +184,10 @@ public class JavaClassRef extends XmlEObject
* @generated
*/
@Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
StringBuffer result = new StringBuffer(super.toString());
result.append(" (javaClass: ");
result.append(javaClass);
@@ -195,14 +195,4 @@ public class JavaClassRef extends XmlEObject
return result.toString();
}
- @Override
- public ITextRange validationTextRange() {
- IDOMNode textNode = (IDOMNode) DOMUtilities.getChildTextNode(node);
- if (textNode != null) {
- return buildTextRange(textNode);
- }
- else {
- return buildTextRange(node);
- }
- }
-}
+} // XmlJavaClassRef
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlMappingFileRef.java
new file mode 100644
index 0000000000..d72b15ff16
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlMappingFileRef.java
@@ -0,0 +1,199 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.persistence;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Mapping File Ref</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef#getFileName <em>File Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlMappingFileRef()
+ * @model kind="class"
+ * @extends IJpaEObject
+ * @generated
+ */
+public class XmlMappingFileRef extends JpaEObject implements IJpaEObject
+{
+ /**
+ * The default value of the '{@link #getFileName() <em>File Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFileName()
+ * @generated
+ * @ordered
+ */
+ protected static final String FILE_NAME_EDEFAULT = "";
+
+ /**
+ * The cached value of the '{@link #getFileName() <em>File Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFileName()
+ * @generated
+ * @ordered
+ */
+ protected String fileName = FILE_NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlMappingFileRef()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return PersistencePackage.Literals.XML_MAPPING_FILE_REF;
+ }
+
+ /**
+ * Returns the value of the '<em><b>File Name</b></em>' attribute.
+ * The default value is <code>""</code>.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>File Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>File Name</em>' attribute.
+ * @see #setFileName(String)
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlMappingFileRef_FileName()
+ * @model default="" unique="false" ordered="false"
+ * @generated
+ */
+ public String getFileName()
+ {
+ return fileName;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef#getFileName <em>File Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>File Name</em>' attribute.
+ * @see #getFileName()
+ * @generated
+ */
+ public void setFileName(String newFileName)
+ {
+ String oldFileName = fileName;
+ fileName = newFileName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_MAPPING_FILE_REF__FILE_NAME, oldFileName, fileName));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_MAPPING_FILE_REF__FILE_NAME:
+ return getFileName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_MAPPING_FILE_REF__FILE_NAME:
+ setFileName((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_MAPPING_FILE_REF__FILE_NAME:
+ setFileName(FILE_NAME_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_MAPPING_FILE_REF__FILE_NAME:
+ return FILE_NAME_EDEFAULT == null ? fileName != null : !FILE_NAME_EDEFAULT.equals(fileName);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (fileName: ");
+ result.append(fileName);
+ result.append(')');
+ return result.toString();
+ }
+
+} // XmlMappingFileRef
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlPersistence.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlPersistence.java
new file mode 100644
index 0000000000..2267dcb3bc
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlPersistence.java
@@ -0,0 +1,273 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.persistence;
+
+import java.util.Collection;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>XmlPersistence</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence#getPersistenceUnits <em>Persistence Units</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence#getVersion <em>Version</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistence()
+ * @model kind="class"
+ * @extends IJpaEObject
+ * @generated
+ */
+public class XmlPersistence extends JpaEObject implements IJpaEObject
+{
+ /**
+ * The cached value of the '{@link #getPersistenceUnits() <em>Persistence Units</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPersistenceUnits()
+ * @generated
+ * @ordered
+ */
+ protected EList<XmlPersistenceUnit> persistenceUnits;
+
+ /**
+ * The default value of the '{@link #getVersion() <em>Version</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getVersion()
+ * @generated
+ * @ordered
+ */
+ protected static final String VERSION_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getVersion() <em>Version</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getVersion()
+ * @generated
+ * @ordered
+ */
+ protected String version = VERSION_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XmlPersistence()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass()
+ {
+ return PersistencePackage.Literals.XML_PERSISTENCE;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Version</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Version</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Version</em>' attribute.
+ * @see #setVersion(String)
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistence_Version()
+ * @model unique="false" dataType="org.eclipse.jpt.core.internal.resource.persistence.XmlVersion" required="true"
+ * @generated
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence#getVersion <em>Version</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Version</em>' attribute.
+ * @see #getVersion()
+ * @generated
+ */
+ public void setVersion(String newVersion)
+ {
+ String oldVersion = version;
+ version = newVersion;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE__VERSION, oldVersion, version));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Persistence Units</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>XmlPersistence Units</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Persistence Units</em>' containment reference list.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistence_PersistenceUnits()
+ * @model containment="true"
+ * @generated
+ */
+ public EList<XmlPersistenceUnit> getPersistenceUnits()
+ {
+ if (persistenceUnits == null)
+ {
+ persistenceUnits = new EObjectContainmentEList<XmlPersistenceUnit>(XmlPersistenceUnit.class, this, PersistencePackage.XML_PERSISTENCE__PERSISTENCE_UNITS);
+ }
+ return persistenceUnits;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PERSISTENCE__PERSISTENCE_UNITS:
+ return ((InternalEList<?>)getPersistenceUnits()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PERSISTENCE__PERSISTENCE_UNITS:
+ return getPersistenceUnits();
+ case PersistencePackage.XML_PERSISTENCE__VERSION:
+ return getVersion();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PERSISTENCE__PERSISTENCE_UNITS:
+ getPersistenceUnits().clear();
+ getPersistenceUnits().addAll((Collection<? extends XmlPersistenceUnit>)newValue);
+ return;
+ case PersistencePackage.XML_PERSISTENCE__VERSION:
+ setVersion((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PERSISTENCE__PERSISTENCE_UNITS:
+ getPersistenceUnits().clear();
+ return;
+ case PersistencePackage.XML_PERSISTENCE__VERSION:
+ setVersion(VERSION_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PERSISTENCE__PERSISTENCE_UNITS:
+ return persistenceUnits != null && !persistenceUnits.isEmpty();
+ case PersistencePackage.XML_PERSISTENCE__VERSION:
+ return VERSION_EDEFAULT == null ? version != null : !VERSION_EDEFAULT.equals(version);
+ }
+ return super.eIsSet(featureID);
+ }
+
+
+ // **************** overrides **********************************************
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (version: ");
+ result.append(version);
+ result.append(')');
+ return result.toString();
+ }
+
+ @Override
+ public IJpaEObject root() {
+ return this;
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlPersistenceUnit.java
index e4bb36c638..b7c1b871d2 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlPersistenceUnit.java
@@ -1,12 +1,15 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 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
+ * Copyright (c) 2006, 2007 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.content.persistence;
+
+package org.eclipse.jpt.core.internal.resource.persistence;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
@@ -18,37 +21,37 @@ import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EDataTypeEList;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.persistence.resource.IPersistenceXmlContentNodes;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
/**
* <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Persistence Unit</b></em>'.
+ * A representation of the model object '<em><b>Unit</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getDescription <em>Description</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getProvider <em>Provider</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getJtaDataSource <em>Jta Data Source</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getNonJtaDataSource <em>Non Jta Data Source</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getMappingFiles <em>Mapping Files</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getJarFiles <em>Jar Files</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getClasses <em>Classes</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#isExcludeUnlistedClasses <em>Exclude Unlisted Classes</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getProperties <em>Properties</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getName <em>Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getTransactionType <em>Transaction Type</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getDescription <em>Description</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getProvider <em>Provider</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getJtaDataSource <em>Jta Data Source</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getNonJtaDataSource <em>Non Jta Data Source</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getMappingFiles <em>Mapping Files</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getJarFiles <em>Jar Files</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getClasses <em>Classes</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#isExcludeUnlistedClasses <em>Exclude Unlisted Classes</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getProperties <em>Properties</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getTransactionType <em>Transaction Type</em>}</li>
* </ul>
* </p>
*
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnit()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnit()
* @model kind="class"
+ * @extends IJpaEObject
* @generated
*/
-public class PersistenceUnit extends XmlEObject implements IJpaContentNode
+public class XmlPersistenceUnit extends JpaEObject implements IJpaEObject
{
/**
* The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
@@ -138,7 +141,7 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
* @generated
* @ordered
*/
- protected EList<MappingFileRef> mappingFiles;
+ protected EList<XmlMappingFileRef> mappingFiles;
/**
* The cached value of the '{@link #getJarFiles() <em>Jar Files</em>}' attribute list.
@@ -158,7 +161,7 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
* @generated
* @ordered
*/
- protected EList<JavaClassRef> classes;
+ protected EList<XmlJavaClassRef> classes;
/**
* The default value of the '{@link #isExcludeUnlistedClasses() <em>Exclude Unlisted Classes</em>}' attribute.
@@ -197,7 +200,7 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
* @generated
* @ordered
*/
- protected Properties properties;
+ protected XmlProperties properties;
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
@@ -220,14 +223,10 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
protected String name = NAME_EDEFAULT;
/**
- * The default value of the '{@link #getTransactionType() <em>Transaction Type</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getTransactionType()
- * @generated
- * @ordered
+ * changed this to null and removed the generated flag so emf won't generate over it
+ * we don't want a default for enums, just null if the tag does not exist
*/
- protected static final PersistenceUnitTransactionType TRANSACTION_TYPE_EDEFAULT = PersistenceUnitTransactionType.JTA;
+ protected static final XmlPersistenceUnitTransactionType TRANSACTION_TYPE_EDEFAULT = null;
/**
* The cached value of the '{@link #getTransactionType() <em>Transaction Type</em>}' attribute.
@@ -237,7 +236,7 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
* @generated
* @ordered
*/
- protected PersistenceUnitTransactionType transactionType = TRANSACTION_TYPE_EDEFAULT;
+ protected XmlPersistenceUnitTransactionType transactionType = TRANSACTION_TYPE_EDEFAULT;
/**
* This is true if the Transaction Type attribute has been set.
@@ -253,7 +252,8 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
* <!-- end-user-doc -->
* @generated
*/
- protected PersistenceUnit() {
+ protected XmlPersistenceUnit()
+ {
super();
}
@@ -263,139 +263,284 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
* @generated
*/
@Override
- protected EClass eStaticClass() {
- return PersistencePackage.Literals.PERSISTENCE_UNIT;
+ protected EClass eStaticClass()
+ {
+ return PersistencePackage.Literals.XML_PERSISTENCE_UNIT;
+ }
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnit_Name()
+ * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
+ * @generated
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ public void setName(String newName)
+ {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__NAME, oldName, name));
+ }
+
+ /**
+ * Returns the value of the '<em><b>Transaction Type</b></em>' attribute.
+ * The default value is <code>"JTA"</code>.
+ * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnitTransactionType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Transaction Type</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Transaction Type</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnitTransactionType
+ * @see #isSetTransactionType()
+ * @see #unsetTransactionType()
+ * @see #setTransactionType(XmlPersistenceUnitTransactionType)
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnit_TransactionType()
+ * @model default="JTA" unique="false" unsettable="true"
+ * @generated
+ */
+ public XmlPersistenceUnitTransactionType getTransactionType()
+ {
+ return transactionType;
+ }
+
+ /**
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getTransactionType <em>Transaction Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Transaction Type</em>' attribute.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnitTransactionType
+ * @see #isSetTransactionType()
+ * @see #unsetTransactionType()
+ * @see #getTransactionType()
+ * @generated
+ */
+ public void setTransactionType(XmlPersistenceUnitTransactionType newTransactionType)
+ {
+ XmlPersistenceUnitTransactionType oldTransactionType = transactionType;
+ transactionType = newTransactionType == null ? TRANSACTION_TYPE_EDEFAULT : newTransactionType;
+ boolean oldTransactionTypeESet = transactionTypeESet;
+ transactionTypeESet = true;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__TRANSACTION_TYPE, oldTransactionType, transactionType, !oldTransactionTypeESet));
+ }
+
+ /**
+ * Unsets the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getTransactionType <em>Transaction Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isSetTransactionType()
+ * @see #getTransactionType()
+ * @see #setTransactionType(XmlPersistenceUnitTransactionType)
+ * @generated
+ */
+ public void unsetTransactionType()
+ {
+ XmlPersistenceUnitTransactionType oldTransactionType = transactionType;
+ boolean oldTransactionTypeESet = transactionTypeESet;
+ transactionType = TRANSACTION_TYPE_EDEFAULT;
+ transactionTypeESet = false;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.UNSET, PersistencePackage.XML_PERSISTENCE_UNIT__TRANSACTION_TYPE, oldTransactionType, TRANSACTION_TYPE_EDEFAULT, oldTransactionTypeESet));
+ }
+
+ /**
+ * Returns whether the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getTransactionType <em>Transaction Type</em>}' attribute is set.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return whether the value of the '<em>Transaction Type</em>' attribute is set.
+ * @see #unsetTransactionType()
+ * @see #getTransactionType()
+ * @see #setTransactionType(XmlPersistenceUnitTransactionType)
+ * @generated
+ */
+ public boolean isSetTransactionType()
+ {
+ return transactionTypeESet;
}
/**
* Returns the value of the '<em><b>Description</b></em>' attribute.
* <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Description</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Description</em>' attribute.
* @see #setDescription(String)
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnit_Description()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnit_Description()
* @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String"
* @generated
*/
- public String getDescription() {
+ public String getDescription()
+ {
return description;
}
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getDescription <em>Description</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getDescription <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Description</em>' attribute.
* @see #getDescription()
* @generated
*/
- public void setDescription(String newDescription) {
+ public void setDescription(String newDescription)
+ {
String oldDescription = description;
description = newDescription;
if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.PERSISTENCE_UNIT__DESCRIPTION, oldDescription, description));
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__DESCRIPTION, oldDescription, description));
}
/**
* Returns the value of the '<em><b>Provider</b></em>' attribute.
* <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Provider</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Provider</em>' attribute.
* @see #setProvider(String)
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnit_Provider()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnit_Provider()
* @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String"
* @generated
*/
- public String getProvider() {
+ public String getProvider()
+ {
return provider;
}
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getProvider <em>Provider</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getProvider <em>Provider</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Provider</em>' attribute.
* @see #getProvider()
* @generated
*/
- public void setProvider(String newProvider) {
+ public void setProvider(String newProvider)
+ {
String oldProvider = provider;
provider = newProvider;
if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.PERSISTENCE_UNIT__PROVIDER, oldProvider, provider));
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__PROVIDER, oldProvider, provider));
}
/**
* Returns the value of the '<em><b>Jta Data Source</b></em>' attribute.
* <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Jta Data Source</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Jta Data Source</em>' attribute.
* @see #setJtaDataSource(String)
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnit_JtaDataSource()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnit_JtaDataSource()
* @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String"
* @generated
*/
- public String getJtaDataSource() {
+ public String getJtaDataSource()
+ {
return jtaDataSource;
}
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getJtaDataSource <em>Jta Data Source</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getJtaDataSource <em>Jta Data Source</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Jta Data Source</em>' attribute.
* @see #getJtaDataSource()
* @generated
*/
- public void setJtaDataSource(String newJtaDataSource) {
+ public void setJtaDataSource(String newJtaDataSource)
+ {
String oldJtaDataSource = jtaDataSource;
jtaDataSource = newJtaDataSource;
if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.PERSISTENCE_UNIT__JTA_DATA_SOURCE, oldJtaDataSource, jtaDataSource));
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE, oldJtaDataSource, jtaDataSource));
}
/**
* Returns the value of the '<em><b>Non Jta Data Source</b></em>' attribute.
* <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Non Jta Data Source</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Non Jta Data Source</em>' attribute.
* @see #setNonJtaDataSource(String)
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnit_NonJtaDataSource()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnit_NonJtaDataSource()
* @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String"
* @generated
*/
- public String getNonJtaDataSource() {
+ public String getNonJtaDataSource()
+ {
return nonJtaDataSource;
}
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getNonJtaDataSource <em>Non Jta Data Source</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getNonJtaDataSource <em>Non Jta Data Source</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Non Jta Data Source</em>' attribute.
* @see #getNonJtaDataSource()
* @generated
*/
- public void setNonJtaDataSource(String newNonJtaDataSource) {
+ public void setNonJtaDataSource(String newNonJtaDataSource)
+ {
String oldNonJtaDataSource = nonJtaDataSource;
nonJtaDataSource = newNonJtaDataSource;
if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE, oldNonJtaDataSource, nonJtaDataSource));
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE, oldNonJtaDataSource, nonJtaDataSource));
}
/**
* Returns the value of the '<em><b>Mapping Files</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.persistence.MappingFileRef}.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef}.
* <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Mapping Files</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Mapping Files</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnit_MappingFiles()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnit_MappingFiles()
* @model containment="true"
* @generated
*/
- public EList<MappingFileRef> getMappingFiles() {
- if (mappingFiles == null) {
- mappingFiles = new EObjectContainmentEList<MappingFileRef>(MappingFileRef.class, this, PersistencePackage.PERSISTENCE_UNIT__MAPPING_FILES);
+ public EList<XmlMappingFileRef> getMappingFiles()
+ {
+ if (mappingFiles == null)
+ {
+ mappingFiles = new EObjectContainmentEList<XmlMappingFileRef>(XmlMappingFileRef.class, this, PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES);
}
return mappingFiles;
}
@@ -404,32 +549,44 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
* Returns the value of the '<em><b>Jar Files</b></em>' attribute list.
* The list contents are of type {@link java.lang.String}.
* <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Jar Files</em>' attribute list isn't clear,
+ * there really should be more of a description here...
+ * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Jar Files</em>' attribute list.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnit_JarFiles()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnit_JarFiles()
* @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String"
* @generated
*/
- public EList<String> getJarFiles() {
- if (jarFiles == null) {
- jarFiles = new EDataTypeEList<String>(String.class, this, PersistencePackage.PERSISTENCE_UNIT__JAR_FILES);
+ public EList<String> getJarFiles()
+ {
+ if (jarFiles == null)
+ {
+ jarFiles = new EDataTypeEList<String>(String.class, this, PersistencePackage.XML_PERSISTENCE_UNIT__JAR_FILES);
}
return jarFiles;
}
/**
* Returns the value of the '<em><b>Classes</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.persistence.JavaClassRef}.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef}.
* <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Classes</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Classes</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnit_Classes()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnit_Classes()
* @model containment="true"
* @generated
*/
- public EList<JavaClassRef> getClasses() {
- if (classes == null) {
- classes = new EObjectContainmentEList<JavaClassRef>(JavaClassRef.class, this, PersistencePackage.PERSISTENCE_UNIT__CLASSES);
+ public EList<XmlJavaClassRef> getClasses()
+ {
+ if (classes == null)
+ {
+ classes = new EObjectContainmentEList<XmlJavaClassRef>(XmlJavaClassRef.class, this, PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES);
}
return classes;
}
@@ -438,21 +595,26 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
* Returns the value of the '<em><b>Exclude Unlisted Classes</b></em>' attribute.
* The default value is <code>"false"</code>.
* <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Exclude Unlisted Classes</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Exclude Unlisted Classes</em>' attribute.
* @see #isSetExcludeUnlistedClasses()
* @see #unsetExcludeUnlistedClasses()
* @see #setExcludeUnlistedClasses(boolean)
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnit_ExcludeUnlistedClasses()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnit_ExcludeUnlistedClasses()
* @model default="false" unique="false" unsettable="true" dataType="org.eclipse.emf.ecore.xml.type.Boolean"
* @generated
*/
- public boolean isExcludeUnlistedClasses() {
+ public boolean isExcludeUnlistedClasses()
+ {
return excludeUnlistedClasses;
}
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#isExcludeUnlistedClasses <em>Exclude Unlisted Classes</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#isExcludeUnlistedClasses <em>Exclude Unlisted Classes</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Exclude Unlisted Classes</em>' attribute.
@@ -461,17 +623,18 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
* @see #isExcludeUnlistedClasses()
* @generated
*/
- public void setExcludeUnlistedClasses(boolean newExcludeUnlistedClasses) {
+ public void setExcludeUnlistedClasses(boolean newExcludeUnlistedClasses)
+ {
boolean oldExcludeUnlistedClasses = excludeUnlistedClasses;
excludeUnlistedClasses = newExcludeUnlistedClasses;
boolean oldExcludeUnlistedClassesESet = excludeUnlistedClassesESet;
excludeUnlistedClassesESet = true;
if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES, oldExcludeUnlistedClasses, excludeUnlistedClasses, !oldExcludeUnlistedClassesESet));
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES, oldExcludeUnlistedClasses, excludeUnlistedClasses, !oldExcludeUnlistedClassesESet));
}
/**
- * Unsets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#isExcludeUnlistedClasses <em>Exclude Unlisted Classes</em>}' attribute.
+ * Unsets the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#isExcludeUnlistedClasses <em>Exclude Unlisted Classes</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isSetExcludeUnlistedClasses()
@@ -479,17 +642,18 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
* @see #setExcludeUnlistedClasses(boolean)
* @generated
*/
- public void unsetExcludeUnlistedClasses() {
+ public void unsetExcludeUnlistedClasses()
+ {
boolean oldExcludeUnlistedClasses = excludeUnlistedClasses;
boolean oldExcludeUnlistedClassesESet = excludeUnlistedClassesESet;
excludeUnlistedClasses = EXCLUDE_UNLISTED_CLASSES_EDEFAULT;
excludeUnlistedClassesESet = false;
if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.UNSET, PersistencePackage.PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES, oldExcludeUnlistedClasses, EXCLUDE_UNLISTED_CLASSES_EDEFAULT, oldExcludeUnlistedClassesESet));
+ eNotify(new ENotificationImpl(this, Notification.UNSET, PersistencePackage.XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES, oldExcludeUnlistedClasses, EXCLUDE_UNLISTED_CLASSES_EDEFAULT, oldExcludeUnlistedClassesESet));
}
/**
- * Returns whether the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#isExcludeUnlistedClasses <em>Exclude Unlisted Classes</em>}' attribute is set.
+ * Returns whether the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#isExcludeUnlistedClasses <em>Exclude Unlisted Classes</em>}' attribute is set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return whether the value of the '<em>Exclude Unlisted Classes</em>' attribute is set.
@@ -498,21 +662,27 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
* @see #setExcludeUnlistedClasses(boolean)
* @generated
*/
- public boolean isSetExcludeUnlistedClasses() {
+ public boolean isSetExcludeUnlistedClasses()
+ {
return excludeUnlistedClassesESet;
}
/**
* Returns the value of the '<em><b>Properties</b></em>' containment reference.
* <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>XmlProperties</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Properties</em>' containment reference.
- * @see #setProperties(Properties)
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnit_Properties()
+ * @see #setProperties(XmlProperties)
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnit_Properties()
* @model containment="true"
* @generated
*/
- public Properties getProperties() {
+ public XmlProperties getProperties()
+ {
return properties;
}
@@ -521,140 +691,40 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
* <!-- end-user-doc -->
* @generated
*/
- public NotificationChain basicSetProperties(Properties newProperties, NotificationChain msgs) {
- Properties oldProperties = properties;
+ public NotificationChain basicSetProperties(XmlProperties newProperties, NotificationChain msgs)
+ {
+ XmlProperties oldProperties = properties;
properties = newProperties;
- if (eNotificationRequired()) {
- ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PersistencePackage.PERSISTENCE_UNIT__PROPERTIES, oldProperties, newProperties);
- if (msgs == null)
- msgs = notification;
- else
- msgs.add(notification);
+ if (eNotificationRequired())
+ {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES, oldProperties, newProperties);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getProperties <em>Properties</em>}' containment reference.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit#getProperties <em>Properties</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Properties</em>' containment reference.
* @see #getProperties()
* @generated
*/
- public void setProperties(Properties newProperties) {
- if (newProperties != properties) {
+ public void setProperties(XmlProperties newProperties)
+ {
+ if (newProperties != properties)
+ {
NotificationChain msgs = null;
if (properties != null)
- msgs = ((InternalEObject) properties).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - PersistencePackage.PERSISTENCE_UNIT__PROPERTIES, null, msgs);
+ msgs = ((InternalEObject)properties).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES, null, msgs);
if (newProperties != null)
- msgs = ((InternalEObject) newProperties).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - PersistencePackage.PERSISTENCE_UNIT__PROPERTIES, null, msgs);
+ msgs = ((InternalEObject)newProperties).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES, null, msgs);
msgs = basicSetProperties(newProperties, msgs);
- if (msgs != null)
- msgs.dispatch();
+ if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.PERSISTENCE_UNIT__PROPERTIES, newProperties, newProperties));
- }
-
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see #setName(String)
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnit_Name()
- * @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getName <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Name</em>' attribute.
- * @see #getName()
- * @generated
- */
- public void setName(String newName) {
- String oldName = name;
- name = newName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.PERSISTENCE_UNIT__NAME, oldName, name));
- }
-
- /**
- * Returns the value of the '<em><b>Transaction Type</b></em>' attribute.
- * The default value is <code>"JTA"</code>.
- * The literals are from the enumeration {@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnitTransactionType}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the value of the '<em>Transaction Type</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnitTransactionType
- * @see #isSetTransactionType()
- * @see #unsetTransactionType()
- * @see #setTransactionType(PersistenceUnitTransactionType)
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnit_TransactionType()
- * @model default="JTA" unique="false" unsettable="true"
- * @generated
- */
- public PersistenceUnitTransactionType getTransactionType() {
- return transactionType;
- }
-
- /**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getTransactionType <em>Transaction Type</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Transaction Type</em>' attribute.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistenceUnitTransactionType
- * @see #isSetTransactionType()
- * @see #unsetTransactionType()
- * @see #getTransactionType()
- * @generated
- */
- public void setTransactionType(PersistenceUnitTransactionType newTransactionType) {
- PersistenceUnitTransactionType oldTransactionType = transactionType;
- transactionType = newTransactionType == null ? TRANSACTION_TYPE_EDEFAULT : newTransactionType;
- boolean oldTransactionTypeESet = transactionTypeESet;
- transactionTypeESet = true;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.PERSISTENCE_UNIT__TRANSACTION_TYPE, oldTransactionType, transactionType, !oldTransactionTypeESet));
- }
-
- /**
- * Unsets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getTransactionType <em>Transaction Type</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #isSetTransactionType()
- * @see #getTransactionType()
- * @see #setTransactionType(PersistenceUnitTransactionType)
- * @generated
- */
- public void unsetTransactionType() {
- PersistenceUnitTransactionType oldTransactionType = transactionType;
- boolean oldTransactionTypeESet = transactionTypeESet;
- transactionType = TRANSACTION_TYPE_EDEFAULT;
- transactionTypeESet = false;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.UNSET, PersistencePackage.PERSISTENCE_UNIT__TRANSACTION_TYPE, oldTransactionType, TRANSACTION_TYPE_EDEFAULT, oldTransactionTypeESet));
- }
-
- /**
- * Returns whether the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit#getTransactionType <em>Transaction Type</em>}' attribute is set.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return whether the value of the '<em>Transaction Type</em>' attribute is set.
- * @see #unsetTransactionType()
- * @see #getTransactionType()
- * @see #setTransactionType(PersistenceUnitTransactionType)
- * @generated
- */
- public boolean isSetTransactionType() {
- return transactionTypeESet;
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES, newProperties, newProperties));
}
/**
@@ -663,13 +733,15 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
* @generated
*/
@Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE_UNIT__MAPPING_FILES :
- return ((InternalEList<?>) getMappingFiles()).basicRemove(otherEnd, msgs);
- case PersistencePackage.PERSISTENCE_UNIT__CLASSES :
- return ((InternalEList<?>) getClasses()).basicRemove(otherEnd, msgs);
- case PersistencePackage.PERSISTENCE_UNIT__PROPERTIES :
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES:
+ return ((InternalEList<?>)getMappingFiles()).basicRemove(otherEnd, msgs);
+ case PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES:
+ return ((InternalEList<?>)getClasses()).basicRemove(otherEnd, msgs);
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES:
return basicSetProperties(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
@@ -681,29 +753,31 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
* @generated
*/
@Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE_UNIT__DESCRIPTION :
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PERSISTENCE_UNIT__DESCRIPTION:
return getDescription();
- case PersistencePackage.PERSISTENCE_UNIT__PROVIDER :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROVIDER:
return getProvider();
- case PersistencePackage.PERSISTENCE_UNIT__JTA_DATA_SOURCE :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE:
return getJtaDataSource();
- case PersistencePackage.PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE:
return getNonJtaDataSource();
- case PersistencePackage.PERSISTENCE_UNIT__MAPPING_FILES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES:
return getMappingFiles();
- case PersistencePackage.PERSISTENCE_UNIT__JAR_FILES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__JAR_FILES:
return getJarFiles();
- case PersistencePackage.PERSISTENCE_UNIT__CLASSES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES:
return getClasses();
- case PersistencePackage.PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES:
return isExcludeUnlistedClasses() ? Boolean.TRUE : Boolean.FALSE;
- case PersistencePackage.PERSISTENCE_UNIT__PROPERTIES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES:
return getProperties();
- case PersistencePackage.PERSISTENCE_UNIT__NAME :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__NAME:
return getName();
- case PersistencePackage.PERSISTENCE_UNIT__TRANSACTION_TYPE :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__TRANSACTION_TYPE:
return getTransactionType();
}
return super.eGet(featureID, resolve, coreType);
@@ -716,43 +790,45 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
*/
@SuppressWarnings("unchecked")
@Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE_UNIT__DESCRIPTION :
- setDescription((String) newValue);
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PERSISTENCE_UNIT__DESCRIPTION:
+ setDescription((String)newValue);
return;
- case PersistencePackage.PERSISTENCE_UNIT__PROVIDER :
- setProvider((String) newValue);
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROVIDER:
+ setProvider((String)newValue);
return;
- case PersistencePackage.PERSISTENCE_UNIT__JTA_DATA_SOURCE :
- setJtaDataSource((String) newValue);
+ case PersistencePackage.XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE:
+ setJtaDataSource((String)newValue);
return;
- case PersistencePackage.PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE :
- setNonJtaDataSource((String) newValue);
+ case PersistencePackage.XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE:
+ setNonJtaDataSource((String)newValue);
return;
- case PersistencePackage.PERSISTENCE_UNIT__MAPPING_FILES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES:
getMappingFiles().clear();
- getMappingFiles().addAll((Collection<? extends MappingFileRef>) newValue);
+ getMappingFiles().addAll((Collection<? extends XmlMappingFileRef>)newValue);
return;
- case PersistencePackage.PERSISTENCE_UNIT__JAR_FILES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__JAR_FILES:
getJarFiles().clear();
- getJarFiles().addAll((Collection<? extends String>) newValue);
+ getJarFiles().addAll((Collection<? extends String>)newValue);
return;
- case PersistencePackage.PERSISTENCE_UNIT__CLASSES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES:
getClasses().clear();
- getClasses().addAll((Collection<? extends JavaClassRef>) newValue);
+ getClasses().addAll((Collection<? extends XmlJavaClassRef>)newValue);
return;
- case PersistencePackage.PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES :
- setExcludeUnlistedClasses(((Boolean) newValue).booleanValue());
+ case PersistencePackage.XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES:
+ setExcludeUnlistedClasses(((Boolean)newValue).booleanValue());
return;
- case PersistencePackage.PERSISTENCE_UNIT__PROPERTIES :
- setProperties((Properties) newValue);
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES:
+ setProperties((XmlProperties)newValue);
return;
- case PersistencePackage.PERSISTENCE_UNIT__NAME :
- setName((String) newValue);
+ case PersistencePackage.XML_PERSISTENCE_UNIT__NAME:
+ setName((String)newValue);
return;
- case PersistencePackage.PERSISTENCE_UNIT__TRANSACTION_TYPE :
- setTransactionType((PersistenceUnitTransactionType) newValue);
+ case PersistencePackage.XML_PERSISTENCE_UNIT__TRANSACTION_TYPE:
+ setTransactionType((XmlPersistenceUnitTransactionType)newValue);
return;
}
super.eSet(featureID, newValue);
@@ -764,39 +840,41 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
* @generated
*/
@Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE_UNIT__DESCRIPTION :
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PERSISTENCE_UNIT__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
- case PersistencePackage.PERSISTENCE_UNIT__PROVIDER :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROVIDER:
setProvider(PROVIDER_EDEFAULT);
return;
- case PersistencePackage.PERSISTENCE_UNIT__JTA_DATA_SOURCE :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE:
setJtaDataSource(JTA_DATA_SOURCE_EDEFAULT);
return;
- case PersistencePackage.PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE:
setNonJtaDataSource(NON_JTA_DATA_SOURCE_EDEFAULT);
return;
- case PersistencePackage.PERSISTENCE_UNIT__MAPPING_FILES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES:
getMappingFiles().clear();
return;
- case PersistencePackage.PERSISTENCE_UNIT__JAR_FILES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__JAR_FILES:
getJarFiles().clear();
return;
- case PersistencePackage.PERSISTENCE_UNIT__CLASSES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES:
getClasses().clear();
return;
- case PersistencePackage.PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES:
unsetExcludeUnlistedClasses();
return;
- case PersistencePackage.PERSISTENCE_UNIT__PROPERTIES :
- setProperties((Properties) null);
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES:
+ setProperties((XmlProperties)null);
return;
- case PersistencePackage.PERSISTENCE_UNIT__NAME :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__NAME:
setName(NAME_EDEFAULT);
return;
- case PersistencePackage.PERSISTENCE_UNIT__TRANSACTION_TYPE :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__TRANSACTION_TYPE:
unsetTransactionType();
return;
}
@@ -809,47 +887,46 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
* @generated
*/
@Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case PersistencePackage.PERSISTENCE_UNIT__DESCRIPTION :
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PERSISTENCE_UNIT__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
- case PersistencePackage.PERSISTENCE_UNIT__PROVIDER :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROVIDER:
return PROVIDER_EDEFAULT == null ? provider != null : !PROVIDER_EDEFAULT.equals(provider);
- case PersistencePackage.PERSISTENCE_UNIT__JTA_DATA_SOURCE :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__JTA_DATA_SOURCE:
return JTA_DATA_SOURCE_EDEFAULT == null ? jtaDataSource != null : !JTA_DATA_SOURCE_EDEFAULT.equals(jtaDataSource);
- case PersistencePackage.PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__NON_JTA_DATA_SOURCE:
return NON_JTA_DATA_SOURCE_EDEFAULT == null ? nonJtaDataSource != null : !NON_JTA_DATA_SOURCE_EDEFAULT.equals(nonJtaDataSource);
- case PersistencePackage.PERSISTENCE_UNIT__MAPPING_FILES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__MAPPING_FILES:
return mappingFiles != null && !mappingFiles.isEmpty();
- case PersistencePackage.PERSISTENCE_UNIT__JAR_FILES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__JAR_FILES:
return jarFiles != null && !jarFiles.isEmpty();
- case PersistencePackage.PERSISTENCE_UNIT__CLASSES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__CLASSES:
return classes != null && !classes.isEmpty();
- case PersistencePackage.PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__EXCLUDE_UNLISTED_CLASSES:
return isSetExcludeUnlistedClasses();
- case PersistencePackage.PERSISTENCE_UNIT__PROPERTIES :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__PROPERTIES:
return properties != null;
- case PersistencePackage.PERSISTENCE_UNIT__NAME :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
- case PersistencePackage.PERSISTENCE_UNIT__TRANSACTION_TYPE :
+ case PersistencePackage.XML_PERSISTENCE_UNIT__TRANSACTION_TYPE:
return isSetTransactionType();
}
return super.eIsSet(featureID);
}
- public Persistence getPersistence() {
- return (Persistence) eContainer();
- }
-
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
StringBuffer result = new StringBuffer(super.toString());
result.append(" (description: ");
result.append(description);
@@ -862,22 +939,13 @@ public class PersistenceUnit extends XmlEObject implements IJpaContentNode
result.append(", jarFiles: ");
result.append(jarFiles);
result.append(", excludeUnlistedClasses: ");
- if (excludeUnlistedClassesESet)
- result.append(excludeUnlistedClasses);
- else
- result.append("<unset>");
+ if (excludeUnlistedClassesESet) result.append(excludeUnlistedClasses); else result.append("<unset>");
result.append(", name: ");
result.append(name);
result.append(", transactionType: ");
- if (transactionTypeESet)
- result.append(transactionType);
- else
- result.append("<unset>");
+ if (transactionTypeESet) result.append(transactionType); else result.append("<unset>");
result.append(')');
return result.toString();
}
- public Object getId() {
- return IPersistenceXmlContentNodes.PERSISTENCE_UNIT_ID;
- }
-}
+} // XmlPersistenceUnit
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceUnitTransactionType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlPersistenceUnitTransactionType.java
index cc3658a166..326632231d 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/PersistenceUnitTransactionType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlPersistenceUnitTransactionType.java
@@ -1,12 +1,15 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 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
+ * Copyright (c) 2006, 2007 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.content.persistence;
+
+package org.eclipse.jpt.core.internal.resource.persistence;
import java.util.Arrays;
import java.util.Collections;
@@ -15,14 +18,15 @@ import org.eclipse.emf.common.util.Enumerator;
/**
* <!-- begin-user-doc -->
- * A representation of the literals of the enumeration '<em><b>Persistence Unit Transaction Type</b></em>',
+ * A representation of the literals of the enumeration '<em><b>Unit Transaction Type</b></em>',
* and utility methods for working with them.
* <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getPersistenceUnitTransactionType()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlPersistenceUnitTransactionType()
* @model
* @generated
*/
-public enum PersistenceUnitTransactionType implements Enumerator {
+public enum XmlPersistenceUnitTransactionType implements Enumerator
+{
/**
* The '<em><b>JTA</b></em>' literal object.
* <!-- begin-user-doc -->
@@ -32,6 +36,7 @@ public enum PersistenceUnitTransactionType implements Enumerator {
* @ordered
*/
JTA(0, "JTA", "JTA"),
+
/**
* The '<em><b>RESOURCE LOCAL</b></em>' literal object.
* <!-- begin-user-doc -->
@@ -41,6 +46,7 @@ public enum PersistenceUnitTransactionType implements Enumerator {
* @ordered
*/
RESOURCE_LOCAL(1, "RESOURCE_LOCAL", "RESOURCE_LOCAL");
+
/**
* The '<em><b>JTA</b></em>' literal value.
* <!-- begin-user-doc -->
@@ -72,33 +78,39 @@ public enum PersistenceUnitTransactionType implements Enumerator {
public static final int RESOURCE_LOCAL_VALUE = 1;
/**
- * An array of all the '<em><b>Unit Transaction Type</b></em>' enumerators.
+ * An array of all the '<em><b>Xml Persistence Unit Transaction Type</b></em>' enumerators.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- private static final PersistenceUnitTransactionType[] VALUES_ARRAY = new PersistenceUnitTransactionType[] {
- JTA, RESOURCE_LOCAL,
- };
+ private static final XmlPersistenceUnitTransactionType[] VALUES_ARRAY =
+ new XmlPersistenceUnitTransactionType[]
+ {
+ JTA,
+ RESOURCE_LOCAL,
+ };
/**
- * A public read-only list of all the '<em><b>Unit Transaction Type</b></em>' enumerators.
+ * A public read-only list of all the '<em><b>Xml Persistence Unit Transaction Type</b></em>' enumerators.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- public static final List<PersistenceUnitTransactionType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+ public static final List<XmlPersistenceUnitTransactionType> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
/**
- * Returns the '<em><b>Unit Transaction Type</b></em>' literal with the specified literal value.
+ * Returns the '<em><b>Xml Persistence Unit Transaction Type</b></em>' literal with the specified literal value.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- public static PersistenceUnitTransactionType get(String literal) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
- PersistenceUnitTransactionType result = VALUES_ARRAY[i];
- if (result.toString().equals(literal)) {
+ public static XmlPersistenceUnitTransactionType get(String literal)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ XmlPersistenceUnitTransactionType result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal))
+ {
return result;
}
}
@@ -106,15 +118,18 @@ public enum PersistenceUnitTransactionType implements Enumerator {
}
/**
- * Returns the '<em><b>Unit Transaction Type</b></em>' literal with the specified name.
+ * Returns the '<em><b>Xml Persistence Unit Transaction Type</b></em>' literal with the specified name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- public static PersistenceUnitTransactionType getByName(String name) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
- PersistenceUnitTransactionType result = VALUES_ARRAY[i];
- if (result.getName().equals(name)) {
+ public static XmlPersistenceUnitTransactionType getByName(String name)
+ {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i)
+ {
+ XmlPersistenceUnitTransactionType result = VALUES_ARRAY[i];
+ if (result.getName().equals(name))
+ {
return result;
}
}
@@ -122,17 +137,17 @@ public enum PersistenceUnitTransactionType implements Enumerator {
}
/**
- * Returns the '<em><b>Unit Transaction Type</b></em>' literal with the specified integer value.
+ * Returns the '<em><b>Xml Persistence Unit Transaction Type</b></em>' literal with the specified integer value.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- public static PersistenceUnitTransactionType get(int value) {
- switch (value) {
- case JTA_VALUE :
- return JTA;
- case RESOURCE_LOCAL_VALUE :
- return RESOURCE_LOCAL;
+ public static XmlPersistenceUnitTransactionType get(int value)
+ {
+ switch (value)
+ {
+ case JTA_VALUE: return JTA;
+ case RESOURCE_LOCAL_VALUE: return RESOURCE_LOCAL;
}
return null;
}
@@ -164,7 +179,8 @@ public enum PersistenceUnitTransactionType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- private PersistenceUnitTransactionType(int value, String name, String literal) {
+ private XmlPersistenceUnitTransactionType(int value, String name, String literal)
+ {
this.value = value;
this.name = name;
this.literal = literal;
@@ -175,8 +191,9 @@ public enum PersistenceUnitTransactionType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public int getValue() {
- return value;
+ public int getValue()
+ {
+ return value;
}
/**
@@ -184,8 +201,9 @@ public enum PersistenceUnitTransactionType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public String getName() {
- return name;
+ public String getName()
+ {
+ return name;
}
/**
@@ -193,8 +211,9 @@ public enum PersistenceUnitTransactionType implements Enumerator {
* <!-- end-user-doc -->
* @generated
*/
- public String getLiteral() {
- return literal;
+ public String getLiteral()
+ {
+ return literal;
}
/**
@@ -204,7 +223,9 @@ public enum PersistenceUnitTransactionType implements Enumerator {
* @generated
*/
@Override
- public String toString() {
+ public String toString()
+ {
return literal;
}
-}
+
+} //XmlPersistenceUnitTransactionType
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/Properties.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlProperties.java
index 2ecd61f12f..670f910dd4 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/Properties.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlProperties.java
@@ -1,12 +1,15 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 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
+ * Copyright (c) 2006, 2007 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.content.persistence;
+
+package org.eclipse.jpt.core.internal.resource.persistence;
import java.util.Collection;
import org.eclipse.emf.common.notify.NotificationChain;
@@ -15,25 +18,27 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jpt.core.internal.XmlEObject;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
/**
* <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Properties</b></em>'.
+ * A representation of the model object '<em><b>XmlProperties</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.Properties#getProperties <em>Properties</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperties#getProperties <em>Properties</em>}</li>
* </ul>
* </p>
*
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getProperties()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlProperties()
* @model kind="class"
+ * @extends IJpaEObject
* @generated
*/
-public class Properties extends XmlEObject
+public class XmlProperties extends JpaEObject implements IJpaEObject
{
/**
* The cached value of the '{@link #getProperties() <em>Properties</em>}' containment reference list.
@@ -43,14 +48,15 @@ public class Properties extends XmlEObject
* @generated
* @ordered
*/
- protected EList<Property> properties;
+ protected EList<XmlProperty> properties;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- protected Properties() {
+ protected XmlProperties()
+ {
super();
}
@@ -60,23 +66,30 @@ public class Properties extends XmlEObject
* @generated
*/
@Override
- protected EClass eStaticClass() {
- return PersistencePackage.Literals.PROPERTIES;
+ protected EClass eStaticClass()
+ {
+ return PersistencePackage.Literals.XML_PROPERTIES;
}
/**
* Returns the value of the '<em><b>Properties</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.jpt.core.internal.content.persistence.Property}.
+ * The list contents are of type {@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperty}.
* <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>XmlProperties</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Properties</em>' containment reference list.
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getProperties_Properties()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlProperties_Properties()
* @model containment="true"
* @generated
*/
- public EList<Property> getProperties() {
- if (properties == null) {
- properties = new EObjectContainmentEList<Property>(Property.class, this, PersistencePackage.PROPERTIES__PROPERTIES);
+ public EList<XmlProperty> getProperties()
+ {
+ if (properties == null)
+ {
+ properties = new EObjectContainmentEList<XmlProperty>(XmlProperty.class, this, PersistencePackage.XML_PROPERTIES__PROPERTIES);
}
return properties;
}
@@ -87,10 +100,12 @@ public class Properties extends XmlEObject
* @generated
*/
@Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case PersistencePackage.PROPERTIES__PROPERTIES :
- return ((InternalEList<?>) getProperties()).basicRemove(otherEnd, msgs);
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PROPERTIES__PROPERTIES:
+ return ((InternalEList<?>)getProperties()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
@@ -101,9 +116,11 @@ public class Properties extends XmlEObject
* @generated
*/
@Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case PersistencePackage.PROPERTIES__PROPERTIES :
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PROPERTIES__PROPERTIES:
return getProperties();
}
return super.eGet(featureID, resolve, coreType);
@@ -116,11 +133,13 @@ public class Properties extends XmlEObject
*/
@SuppressWarnings("unchecked")
@Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case PersistencePackage.PROPERTIES__PROPERTIES :
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PROPERTIES__PROPERTIES:
getProperties().clear();
- getProperties().addAll((Collection<? extends Property>) newValue);
+ getProperties().addAll((Collection<? extends XmlProperty>)newValue);
return;
}
super.eSet(featureID, newValue);
@@ -132,9 +151,11 @@ public class Properties extends XmlEObject
* @generated
*/
@Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case PersistencePackage.PROPERTIES__PROPERTIES :
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PROPERTIES__PROPERTIES:
getProperties().clear();
return;
}
@@ -147,11 +168,14 @@ public class Properties extends XmlEObject
* @generated
*/
@Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case PersistencePackage.PROPERTIES__PROPERTIES :
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PROPERTIES__PROPERTIES:
return properties != null && !properties.isEmpty();
}
return super.eIsSet(featureID);
}
-} //PropertiesImpl
+
+} // XmlProperties
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/Property.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlProperty.java
index b38ec0bdd4..bdbef8069c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/Property.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/XmlProperty.java
@@ -1,36 +1,40 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 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
+ * Copyright (c) 2006, 2008 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
+ * Contributors:
+ * Oracle - initial API and implementation
*******************************************************************************/
-package org.eclipse.jpt.core.internal.content.persistence;
+
+package org.eclipse.jpt.core.internal.resource.persistence;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.jpt.core.internal.XmlEObject;
+import org.eclipse.jpt.core.internal.resource.common.IJpaEObject;
+import org.eclipse.jpt.core.internal.resource.common.JpaEObject;
/**
* <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Property</b></em>'.
+ * A representation of the model object '<em><b>XmlProperty</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* <ul>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.Property#getName <em>Name</em>}</li>
- * <li>{@link org.eclipse.jpt.core.internal.content.persistence.Property#getValue <em>Value</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperty#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperty#getValue <em>Value</em>}</li>
* </ul>
* </p>
*
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getProperty()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlProperty()
* @model kind="class"
+ * @extends IJpaEObject
* @generated
*/
-public class Property extends XmlEObject
+public class XmlProperty extends JpaEObject implements IJpaEObject
{
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
@@ -77,7 +81,8 @@ public class Property extends XmlEObject
* <!-- end-user-doc -->
* @generated
*/
- protected Property() {
+ protected XmlProperty()
+ {
super();
}
@@ -87,66 +92,79 @@ public class Property extends XmlEObject
* @generated
*/
@Override
- protected EClass eStaticClass() {
- return PersistencePackage.Literals.PROPERTY;
+ protected EClass eStaticClass()
+ {
+ return PersistencePackage.Literals.XML_PROPERTY;
}
/**
* Returns the value of the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Name</em>' attribute.
* @see #setName(String)
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getProperty_Name()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlProperty_Name()
* @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
* @generated
*/
- public String getName() {
+ public String getName()
+ {
return name;
}
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.Property#getName <em>Name</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperty#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
* @see #getName()
* @generated
*/
- public void setName(String newName) {
+ public void setName(String newName)
+ {
String oldName = name;
name = newName;
if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.PROPERTY__NAME, oldName, name));
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PROPERTY__NAME, oldName, name));
}
/**
* Returns the value of the '<em><b>Value</b></em>' attribute.
* <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Value</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Value</em>' attribute.
* @see #setValue(String)
- * @see org.eclipse.jpt.core.internal.content.persistence.PersistencePackage#getProperty_Value()
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage#getXmlProperty_Value()
* @model unique="false" dataType="org.eclipse.emf.ecore.xml.type.String" required="true"
* @generated
*/
- public String getValue() {
+ public String getValue()
+ {
return value;
}
/**
- * Sets the value of the '{@link org.eclipse.jpt.core.internal.content.persistence.Property#getValue <em>Value</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperty#getValue <em>Value</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Value</em>' attribute.
* @see #getValue()
* @generated
*/
- public void setValue(String newValue) {
+ public void setValue(String newValue)
+ {
String oldValue = value;
value = newValue;
if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.PROPERTY__VALUE, oldValue, value));
+ eNotify(new ENotificationImpl(this, Notification.SET, PersistencePackage.XML_PROPERTY__VALUE, oldValue, value));
}
/**
@@ -155,11 +173,13 @@ public class Property extends XmlEObject
* @generated
*/
@Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case PersistencePackage.PROPERTY__NAME :
+ public Object eGet(int featureID, boolean resolve, boolean coreType)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PROPERTY__NAME:
return getName();
- case PersistencePackage.PROPERTY__VALUE :
+ case PersistencePackage.XML_PROPERTY__VALUE:
return getValue();
}
return super.eGet(featureID, resolve, coreType);
@@ -171,13 +191,15 @@ public class Property extends XmlEObject
* @generated
*/
@Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case PersistencePackage.PROPERTY__NAME :
- setName((String) newValue);
+ public void eSet(int featureID, Object newValue)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PROPERTY__NAME:
+ setName((String)newValue);
return;
- case PersistencePackage.PROPERTY__VALUE :
- setValue((String) newValue);
+ case PersistencePackage.XML_PROPERTY__VALUE:
+ setValue((String)newValue);
return;
}
super.eSet(featureID, newValue);
@@ -189,12 +211,14 @@ public class Property extends XmlEObject
* @generated
*/
@Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case PersistencePackage.PROPERTY__NAME :
+ public void eUnset(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PROPERTY__NAME:
setName(NAME_EDEFAULT);
return;
- case PersistencePackage.PROPERTY__VALUE :
+ case PersistencePackage.XML_PROPERTY__VALUE:
setValue(VALUE_EDEFAULT);
return;
}
@@ -207,26 +231,25 @@ public class Property extends XmlEObject
* @generated
*/
@Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case PersistencePackage.PROPERTY__NAME :
+ public boolean eIsSet(int featureID)
+ {
+ switch (featureID)
+ {
+ case PersistencePackage.XML_PROPERTY__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
- case PersistencePackage.PROPERTY__VALUE :
+ case PersistencePackage.XML_PROPERTY__VALUE:
return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
}
return super.eIsSet(featureID);
}
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
+
@Override
- public String toString() {
- if (eIsProxy())
- return super.toString();
- StringBuffer result = new StringBuffer(super.toString());
+ public String toString()
+ {
+ if (eIsProxy()) return super.toString();
+
+ StringBuilder result = new StringBuilder(super.toString());
result.append(" (name: ");
result.append(name);
result.append(", value: ");
@@ -234,4 +257,5 @@ public class Property extends XmlEObject
result.append(')');
return result.toString();
}
-} //PropertyImpl
+
+} // XmlProperty
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/JavaClassRefTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/JavaClassRefTranslator.java
index 2f32b413f7..ff50003511 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/JavaClassRefTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/JavaClassRefTranslator.java
@@ -1,17 +1,18 @@
/*******************************************************************************
- * Copyright (c) 2007 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
+ * Copyright (c) 2006, 2007 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.content.persistence.resource;
+
+package org.eclipse.jpt.core.internal.resource.persistence.translators;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.persistence.PersistencePackage;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage;
import org.eclipse.wst.common.internal.emf.resource.Translator;
public class JavaClassRefTranslator extends Translator
@@ -37,7 +38,7 @@ public class JavaClassRefTranslator extends Translator
private static Translator[] createChildren() {
return new Translator[] {
- new Translator(TEXT_ATTRIBUTE_VALUE, PersistencePackage.eINSTANCE.getJavaClassRef_JavaClass())
+ new Translator(TEXT_ATTRIBUTE_VALUE, PersistencePackage.eINSTANCE.getXmlJavaClassRef_JavaClass())
};
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/MappingFileTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/MappingFileTranslator.java
index d38858bc43..231ce9ee1a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/MappingFileTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/MappingFileTranslator.java
@@ -1,30 +1,27 @@
/*******************************************************************************
- * Copyright (c) 2007 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
+ * Copyright (c) 2006, 2007 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.content.persistence.resource;
+
+package org.eclipse.jpt.core.internal.resource.persistence.translators;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jpt.core.internal.content.persistence.PersistencePackage;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage;
import org.eclipse.wst.common.internal.emf.resource.Translator;
public class MappingFileTranslator extends Translator
{
- private static Translator[] children;
+ private Translator[] children;
- public MappingFileTranslator(String domNameAndPath, EStructuralFeature feature, int style) {
- super(domNameAndPath, feature, style);
- }
-
- public MappingFileTranslator(String domNameAndPath, EStructuralFeature feature) {
- super(domNameAndPath, feature);
+ public MappingFileTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
}
@@ -35,9 +32,9 @@ public class MappingFileTranslator extends Translator
return children;
}
- private static Translator[] createChildren() {
+ protected Translator[] createChildren() {
return new Translator[] {
- new Translator(TEXT_ATTRIBUTE_VALUE, PersistencePackage.eINSTANCE.getMappingFileRef_FileName())
+ new Translator(TEXT_ATTRIBUTE_VALUE, PersistencePackage.eINSTANCE.getXmlMappingFileRef_FileName())
};
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PersistenceTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PersistenceTranslator.java
new file mode 100644
index 0000000000..91c79d89b9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PersistenceTranslator.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.persistence.translators;
+
+import org.eclipse.wst.common.internal.emf.resource.ConstantAttributeTranslator;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.RootTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class PersistenceTranslator extends RootTranslator
+ implements PersistenceXmlMapper
+{
+ public static PersistenceTranslator INSTANCE = new PersistenceTranslator();
+
+ private Translator[] children;
+
+
+ public PersistenceTranslator() {
+ super(PERSISTENCE, PERSISTENCE_PKG.eINSTANCE.getXmlPersistence());
+ }
+
+
+ public Translator[] getChildren(Object target, int versionID) {
+ if (children == null) {
+ children = createChildren();
+ }
+ return children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createVersionTranslator(),
+ new ConstantAttributeTranslator(XML_NS, PERSISTENCE_NS_URL),
+ new ConstantAttributeTranslator(XML_NS_XSI, XSI_NS_URL),
+ new ConstantAttributeTranslator(XSI_SCHEMA_LOCATION, PERSISTENCE_NS_URL + ' ' + PERSISTENCE_SCHEMA_LOC_1_0),
+ createPersistenceUnitTranslator()
+ };
+ }
+
+ private Translator createVersionTranslator() {
+ return new Translator(VERSION, PERSISTENCE_PKG.getXmlPersistence_Version(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createPersistenceUnitTranslator() {
+ return new PersistenceUnitTranslator(PERSISTENCE_UNIT, PERSISTENCE_PKG.getXmlPersistence_PersistenceUnits());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PersistenceUnitTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PersistenceUnitTranslator.java
new file mode 100644
index 0000000000..67cecd6bf7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PersistenceUnitTranslator.java
@@ -0,0 +1,86 @@
+package org.eclipse.jpt.core.internal.resource.persistence.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jpt.core.internal.resource.common.translators.BooleanTranslator;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class PersistenceUnitTranslator extends Translator
+ implements PersistenceXmlMapper
+{
+ private Translator[] children;
+
+
+ public PersistenceUnitTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+
+ public Translator[] getChildren(Object target, int versionID) {
+ if (children == null) {
+ children = createChildren();
+ }
+ return children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createTransactionTypeTranslator(),
+ createDescriptionTranslator(),
+ createProviderTranslator(),
+ createJtaDataSourceTranslator(),
+ createNonJtaDataSourceTranslator(),
+ createMappingFileTranslator(),
+ createJarFileTranslator(),
+ createClassTranslator(),
+ createExcludeUnlistedClassesTranslator(),
+ createPropertiesTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, PERSISTENCE_PKG.getXmlPersistenceUnit_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createTransactionTypeTranslator() {
+ return new Translator(TRANSACTION_TYPE, PERSISTENCE_PKG.getXmlPersistenceUnit_TransactionType(), DOM_ATTRIBUTE | UNSET_IF_NULL);
+ }
+
+ private Translator createDescriptionTranslator() {
+ return new Translator(DESCRIPTION, PERSISTENCE_PKG.getXmlPersistenceUnit_Description());
+ }
+
+ private Translator createProviderTranslator() {
+ return new Translator(PROVIDER, PERSISTENCE_PKG.getXmlPersistenceUnit_Provider());
+ }
+
+ private Translator createJtaDataSourceTranslator() {
+ return new Translator(JTA_DATA_SOURCE, PERSISTENCE_PKG.getXmlPersistenceUnit_JtaDataSource());
+ }
+
+ private Translator createNonJtaDataSourceTranslator() {
+ return new Translator(NON_JTA_DATA_SOURCE, PERSISTENCE_PKG.getXmlPersistenceUnit_NonJtaDataSource());
+ }
+
+ private Translator createMappingFileTranslator() {
+ return new MappingFileTranslator(MAPPING_FILE, PERSISTENCE_PKG.getXmlPersistenceUnit_MappingFiles());
+ }
+
+ private Translator createJarFileTranslator() {
+ return new Translator(JAR_FILE, PERSISTENCE_PKG.getXmlPersistenceUnit_JarFiles());
+ }
+
+ private Translator createClassTranslator() {
+ return new JavaClassRefTranslator(CLASS, PERSISTENCE_PKG.getXmlPersistenceUnit_Classes());
+ }
+
+ private Translator createExcludeUnlistedClassesTranslator() {
+ return new BooleanTranslator(EXCLUDE_UNLISTED_CLASSES, PERSISTENCE_PKG.getXmlPersistenceUnit_ExcludeUnlistedClasses());
+ }
+
+ private Translator createPropertiesTranslator() {
+ return new PropertiesTranslator(PROPERTIES, PERSISTENCE_PKG.getXmlPersistenceUnit_Properties());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/PersistenceXMLMapper.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PersistenceXmlMapper.java
index ffd05ea9ab..3a0e0ad9ef 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/persistence/resource/PersistenceXMLMapper.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PersistenceXmlMapper.java
@@ -1,15 +1,21 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 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
+ * Copyright (c) 2006, 2007 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.content.persistence.resource;
+package org.eclipse.jpt.core.internal.resource.persistence.translators;
-public interface PersistenceXMLMapper
+import org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage;
+
+public interface PersistenceXmlMapper
{
+ PersistencePackage PERSISTENCE_PKG = PersistencePackage.eINSTANCE;
+
String XML_NS = "xmlns"; //$NON-NLS-1$
String XML_NS_XSI = "xmlns:xsi"; //$NON-NLS-1$
String XSI_SCHEMA_LOCATION = "xsi:schemaLocation"; //$NON-NLS-1$
@@ -18,21 +24,20 @@ public interface PersistenceXMLMapper
String PERSISTENCE_SCHEMA_LOC_1_0 = "http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"; //$NON-NLS-1$
- String PERSISTENCE = "persistence"; //$NON-NLS-1$
- String PERSISTENCE_VERSION = "version"; //$NON-NLS-1$
- String PERSISTENCE_UNIT = "persistence-unit"; //$NON-NLS-1$
- String PERSISTENCE_UNIT_NAME = "name"; //$NON-NLS-1$
- String PERSISTENCE_UNIT_DESCRIPTION = "description"; //$NON-NLS-1$
- String PERSISTENCE_UNIT_PROVIDER = "provider"; //$NON-NLS-1$
- String JTA_DATA_SOURCE = "jta-data-source"; //$NON-NLS-1$
- String NON_JTA_DATA_SOURCE = "non-jta-data-source"; //$NON-NLS-1$
- String MAPPING_FILE = "mapping-file"; //$NON-NLS-1$
- String JAR_FILE = "jar-file"; //$NON-NLS-1$
String CLASS = "class"; //$NON-NLS-1$
+ String DESCRIPTION = "description"; //$NON-NLS-1$
String EXCLUDE_UNLISTED_CLASSES = "exclude-unlisted-classes"; //$NON-NLS-1$
+ String JAR_FILE = "jar-file"; //$NON-NLS-1$
+ String JTA_DATA_SOURCE = "jta-data-source"; //$NON-NLS-1$
+ String MAPPING_FILE = "mapping-file"; //$NON-NLS-1$
+ String NAME = "name"; //$NON-NLS-1$
+ String NON_JTA_DATA_SOURCE = "non-jta-data-source"; //$NON-NLS-1$
+ String PERSISTENCE = "persistence"; //$NON-NLS-1$
+ String PERSISTENCE_UNIT = "persistence-unit"; //$NON-NLS-1$
String PROPERTIES = "properties"; //$NON-NLS-1$
String PROPERTY = "property"; //$NON-NLS-1$
- String PROPERTY_NAME = "name"; //$NON-NLS-1$
- String PROPERTY_VALUE = "value"; //$NON-NLS-1$
+ String PROVIDER = "provider"; //$NON-NLS-1$
String TRANSACTION_TYPE = "transaction-type"; //$NON-NLS-1$
+ String VALUE = "value"; //$NON-NLS-1$
+ String VERSION = "version"; //$NON-NLS-1$
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PropertiesTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PropertiesTranslator.java
new file mode 100644
index 0000000000..b2a2383646
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PropertiesTranslator.java
@@ -0,0 +1,35 @@
+package org.eclipse.jpt.core.internal.resource.persistence.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class PropertiesTranslator extends Translator
+ implements PersistenceXmlMapper
+{
+ private Translator[] children;
+
+
+ public PropertiesTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature);
+ }
+
+
+ public Translator[] getChildren(Object target, int versionID) {
+ if (children == null) {
+ children = createChildren();
+ }
+ return children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createPropertyTranslator()
+ };
+ }
+
+ private Translator createPropertyTranslator() {
+ return new PropertyTranslator(PROPERTY, PERSISTENCE_PKG.getXmlProperties_Properties());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PropertyTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PropertyTranslator.java
new file mode 100644
index 0000000000..17d72d1c45
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/translators/PropertyTranslator.java
@@ -0,0 +1,40 @@
+package org.eclipse.jpt.core.internal.resource.persistence.translators;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.wst.common.internal.emf.resource.IDTranslator;
+import org.eclipse.wst.common.internal.emf.resource.Translator;
+
+public class PropertyTranslator extends Translator
+ implements PersistenceXmlMapper
+{
+ private Translator[] children;
+
+
+ public PropertyTranslator(String domNameAndPath, EStructuralFeature aFeature) {
+ super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
+ }
+
+
+ public Translator[] getChildren(Object target, int versionID) {
+ if (children == null) {
+ children = createChildren();
+ }
+ return children;
+ }
+
+ protected Translator[] createChildren() {
+ return new Translator[] {
+ IDTranslator.INSTANCE,
+ createNameTranslator(),
+ createValueTranslator()
+ };
+ }
+
+ private Translator createNameTranslator() {
+ return new Translator(NAME, PERSISTENCE_PKG.getXmlProperty_Name(), DOM_ATTRIBUTE);
+ }
+
+ private Translator createValueTranslator() {
+ return new Translator(VALUE, PERSISTENCE_PKG.getXmlProperty_Value(), DOM_ATTRIBUTE);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/util/PersistenceAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/util/PersistenceAdapterFactory.java
new file mode 100644
index 0000000000..dc2e9d2667
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/util/PersistenceAdapterFactory.java
@@ -0,0 +1,244 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.persistence.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlProperties;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlProperty;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage
+ * @generated
+ */
+public class PersistenceAdapterFactory extends AdapterFactoryImpl
+{
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static PersistencePackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PersistenceAdapterFactory()
+ {
+ if (modelPackage == null)
+ {
+ modelPackage = PersistencePackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object)
+ {
+ if (object == modelPackage)
+ {
+ return true;
+ }
+ if (object instanceof EObject)
+ {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PersistenceSwitch<Adapter> modelSwitch =
+ new PersistenceSwitch<Adapter>()
+ {
+ @Override
+ public Adapter caseXmlPersistence(XmlPersistence object)
+ {
+ return createXmlPersistenceAdapter();
+ }
+ @Override
+ public Adapter caseXmlPersistenceUnit(XmlPersistenceUnit object)
+ {
+ return createXmlPersistenceUnitAdapter();
+ }
+ @Override
+ public Adapter caseXmlMappingFileRef(XmlMappingFileRef object)
+ {
+ return createXmlMappingFileRefAdapter();
+ }
+ @Override
+ public Adapter caseXmlJavaClassRef(XmlJavaClassRef object)
+ {
+ return createXmlJavaClassRefAdapter();
+ }
+ @Override
+ public Adapter caseXmlProperties(XmlProperties object)
+ {
+ return createXmlPropertiesAdapter();
+ }
+ @Override
+ public Adapter caseXmlProperty(XmlProperty object)
+ {
+ return createXmlPropertyAdapter();
+ }
+ @Override
+ public Adapter defaultCase(EObject object)
+ {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target)
+ {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence <em>Xml Persistence</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence
+ * @generated
+ */
+ public Adapter createXmlPersistenceAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit <em>Xml Persistence Unit</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit
+ * @generated
+ */
+ public Adapter createXmlPersistenceUnitAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef <em>Xml Mapping File Ref</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef
+ * @generated
+ */
+ public Adapter createXmlMappingFileRefAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef <em>Xml Java Class Ref</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef
+ * @generated
+ */
+ public Adapter createXmlJavaClassRefAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperties <em>Xml Properties</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlProperties
+ * @generated
+ */
+ public Adapter createXmlPropertiesAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.resource.persistence.XmlProperty <em>Xml Property</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.jpt.core.internal.resource.persistence.XmlProperty
+ * @generated
+ */
+ public Adapter createXmlPropertyAdapter()
+ {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter()
+ {
+ return null;
+ }
+
+} //PersistenceAdapterFactory
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/util/PersistenceSwitch.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/util/PersistenceSwitch.java
new file mode 100644
index 0000000000..5baf8f47a3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/util/PersistenceSwitch.java
@@ -0,0 +1,266 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.resource.persistence.util;
+
+import java.util.List;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlProperties;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlProperty;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.jpt.core.internal.resource.persistence.PersistencePackage
+ * @generated
+ */
+public class PersistenceSwitch<T>
+{
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static PersistencePackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PersistenceSwitch()
+ {
+ if (modelPackage == null)
+ {
+ modelPackage = PersistencePackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ public T doSwitch(EObject theEObject)
+ {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(EClass theEClass, EObject theEObject)
+ {
+ if (theEClass.eContainer() == modelPackage)
+ {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else
+ {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return
+ eSuperTypes.isEmpty() ?
+ defaultCase(theEObject) :
+ doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(int classifierID, EObject theEObject)
+ {
+ switch (classifierID)
+ {
+ case PersistencePackage.XML_PERSISTENCE:
+ {
+ XmlPersistence xmlPersistence = (XmlPersistence)theEObject;
+ T result = caseXmlPersistence(xmlPersistence);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case PersistencePackage.XML_PERSISTENCE_UNIT:
+ {
+ XmlPersistenceUnit xmlPersistenceUnit = (XmlPersistenceUnit)theEObject;
+ T result = caseXmlPersistenceUnit(xmlPersistenceUnit);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case PersistencePackage.XML_MAPPING_FILE_REF:
+ {
+ XmlMappingFileRef xmlMappingFileRef = (XmlMappingFileRef)theEObject;
+ T result = caseXmlMappingFileRef(xmlMappingFileRef);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case PersistencePackage.XML_JAVA_CLASS_REF:
+ {
+ XmlJavaClassRef xmlJavaClassRef = (XmlJavaClassRef)theEObject;
+ T result = caseXmlJavaClassRef(xmlJavaClassRef);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case PersistencePackage.XML_PROPERTIES:
+ {
+ XmlProperties xmlProperties = (XmlProperties)theEObject;
+ T result = caseXmlProperties(xmlProperties);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case PersistencePackage.XML_PROPERTY:
+ {
+ XmlProperty xmlProperty = (XmlProperty)theEObject;
+ T result = caseXmlProperty(xmlProperty);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Xml Persistence</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Xml Persistence</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseXmlPersistence(XmlPersistence object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Xml Persistence Unit</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Xml Persistence Unit</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseXmlPersistenceUnit(XmlPersistenceUnit object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Xml Mapping File Ref</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Xml Mapping File Ref</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseXmlMappingFileRef(XmlMappingFileRef object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Xml Java Class Ref</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Xml Java Class Ref</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseXmlJavaClassRef(XmlJavaClassRef object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Xml Properties</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Xml Properties</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseXmlProperties(XmlProperties object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Xml Property</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Xml Property</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseXmlProperty(XmlProperty object)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public T defaultCase(EObject object)
+ {
+ return null;
+ }
+
+} //PersistenceSwitch
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/synch/SynchronizeClassesJob.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/synch/SynchronizeClassesJob.java
index 920541a18f..d475684010 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/synch/SynchronizeClassesJob.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/synch/SynchronizeClassesJob.java
@@ -16,25 +16,15 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.IPersistentType;
import org.eclipse.jpt.core.internal.JptCoreMessages;
import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
-import org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode;
-import org.eclipse.jpt.core.internal.content.persistence.JavaClassRef;
-import org.eclipse.jpt.core.internal.content.persistence.MappingFileRef;
-import org.eclipse.jpt.core.internal.content.persistence.Persistence;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode;
-import org.eclipse.jpt.core.internal.content.persistence.resource.PersistenceResource;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.Filter;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResource;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
/**
* Synchronizes the lists of persistent classes in a persistence unit and a
@@ -59,37 +49,35 @@ public class SynchronizeClassesJob extends Job
}
IJpaFile jpaFile = JptCorePlugin.jpaFile(this.persistenceXmlFile);
- PersistenceXmlRootContentNode root;
+ PersistenceResource resource;
try {
- root = (PersistenceXmlRootContentNode) jpaFile.getContent();
+ resource = (PersistenceResource) jpaFile.getResourceModel();
}
catch (ClassCastException cce) {
return new Status(IStatus.ERROR, JptCorePlugin.PLUGIN_ID, JptCoreMessages.INVALID_PERSISTENCE_XML_CONTENT);
}
- Persistence persistence = root.getPersistence();
+ XmlPersistence persistence = resource.getPersistence();
if (persistence == null) {
- persistence = PersistenceFactory.eINSTANCE.createPersistence();
- root.setPersistence(persistence);
+ persistence = PersistenceFactory.eINSTANCE.createXmlPersistence();
+ resource.getContents().add(persistence);
}
- PersistenceUnit persistenceUnit;
+ XmlPersistenceUnit persistenceUnit;
if (persistence.getPersistenceUnits().size() > 0) {
persistenceUnit = persistence.getPersistenceUnits().get(0);
}
else {
- persistenceUnit = PersistenceFactory.eINSTANCE.createPersistenceUnit();
+ persistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
persistenceUnit.setName(this.persistenceXmlFile.getProject().getName());
persistence.getPersistenceUnits().add(persistenceUnit);
}
- PersistenceResource resource = (PersistenceResource) persistenceUnit.eResource();
-
persistenceUnit.getClasses().clear();
for (Iterator<String> stream = this.sortedMappedTypeNames(persistenceUnit); stream.hasNext(); ) {
- JavaClassRef classRef = PersistenceFactory.eINSTANCE.createJavaClassRef();
+ XmlJavaClassRef classRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
classRef.setJavaClass(stream.next());
persistenceUnit.getClasses().add(classRef);
}
@@ -106,73 +94,84 @@ public class SynchronizeClassesJob extends Job
return Status.OK_STATUS;
}
- private Iterator<String> sortedMappedTypeNames(PersistenceUnit persistenceUnit) {
- return CollectionTools.sort(this.mappedTypeNames(persistenceUnit));
- }
-
- private Iterator<String> mappedTypeNames(PersistenceUnit persistenceUnit) {
- return new TransformationIterator<IPersistentType, String>(this.mappedTypes(persistenceUnit)) {
- @Override
- protected String transform(IPersistentType pType) {
- return pType.findJdtType().getFullyQualifiedName();
- }
- };
- }
-
- private Iterator<IPersistentType> mappedTypes(PersistenceUnit persistenceUnit) {
- return new FilteringIterator<IPersistentType>(persistenceUnit.getJpaProject().javaPersistentTypes(), filter(persistenceUnit));
- }
-
- private Filter<IPersistentType> filter(final PersistenceUnit persistenceUnit) {
- return new Filter<IPersistentType>() {
- public boolean accept(IPersistentType o) {
- if (o == null) {
- return false;
- }
- if (o.getMappingKey() == IMappingKeys.NULL_TYPE_MAPPING_KEY) {
- return false;
- }
- IType jdtType = o.findJdtType();
- if (jdtType == null) {
- return false;
- }
- for (MappingFileRef mappingFileRef : persistenceUnit.getMappingFiles()) {
- if (containsType(mappingFileRef, jdtType)) {
- return false;
- }
- }
- return true;
- }
- };
- }
-
- private boolean containsType(MappingFileRef mappingFileRef, IType jdtType) {
- IJpaFile mappingFile = mappingFileRef.getMappingFile();
- if (mappingFile == null) {
- return false;
- }
-
- XmlRootContentNode root;
- try {
- root = (XmlRootContentNode) mappingFile.getContent();
- }
- catch (ClassCastException cce) {
- return false;
- }
-
- EntityMappingsInternal entityMappings = root.getEntityMappings();
-
- if (entityMappings == null) {
- return false;
- }
-
- for (IPersistentType persistentType : entityMappings.getPersistentTypes()) {
- IType otherJdtType = persistentType.findJdtType();
- if (otherJdtType != null && otherJdtType.equals(jdtType)) {
- return true;
- }
- }
-
- return false;
+ private Iterator<String> sortedMappedTypeNames(XmlPersistenceUnit persistenceUnit) {
+ return EmptyIterator.instance();
+// return CollectionTools.sort(this.mappedTypeNames(persistenceUnit));
}
+//
+// private Iterator<String> mappedTypeNames(XmlPersistenceUnit persistenceUnit) {
+// return new TransformationIterator<IPersistentType, String>(this.mappedTypes(persistenceUnit)) {
+// @Override
+// protected String transform(IPersistentType pType) {
+// return pType.findJdtType().getFullyQualifiedName();
+// }
+// };
+// }
+//
+// private Iterator<IPersistentType> mappedTypes(XmlPersistenceUnit persistenceUnit) {
+// return new FilteringIterator<IPersistentType>(allJavaTypes(persistenceUnit.getJpaProject()), filter(persistenceUnit));
+// }
+//
+// private Iterator<IPersistentType> allJavaTypes(IJpaProject jpaProject) {
+// return new TransformationIterator<IJpaFile, IPersistentType>(jpaProject.jpaFiles(JptCorePlugin.JAVA_CONTENT_TYPE).iterator()) {
+// @Override
+// protected IPersistentType transform(IJpaFile next) {
+// JpaCompilationUnit jcu = (JpaCompilationUnit) next.getContent();
+// return (jcu.getTypes().isEmpty()) ? null : jcu.getTypes().get(0);
+// }
+// };
+// }
+//
+// private Filter<IPersistentType> filter(final XmlPersistenceUnit persistenceUnit) {
+// return new Filter<IPersistentType>() {
+// public boolean accept(IPersistentType o) {
+// if (o == null) {
+// return false;
+// }
+// if (o.getMappingKey() == IMappingKeys.NULL_TYPE_MAPPING_KEY) {
+// return false;
+// }
+// IType jdtType = o.findJdtType();
+// if (jdtType == null) {
+// return false;
+// }
+// for (XmlMappingFileRef mappingFileRef : persistenceUnit.getMappingFiles()) {
+// if (containsType(mappingFileRef, jdtType)) {
+// return false;
+// }
+// }
+// return true;
+// }
+// };
+// }
+//
+// private boolean containsType(XmlMappingFileRef mappingFileRef, IType jdtType) {
+// IJpaFile mappingFile = mappingFileRef.getMappingFile();
+// if (mappingFile == null) {
+// return false;
+// }
+//
+// XmlRootContentNode root;
+// try {
+// root = (XmlRootContentNode) mappingFile.getContent();
+// }
+// catch (ClassCastException cce) {
+// return false;
+// }
+//
+// EntityMappingsInternal entityMappings = root.getEntityMappings();
+//
+// if (entityMappings == null) {
+// return false;
+// }
+//
+// for (IPersistentType persistentType : entityMappings.getPersistentTypes()) {
+// IType otherJdtType = persistentType.findJdtType();
+// if (otherJdtType != null && otherJdtType.equals(jdtType)) {
+// return true;
+// }
+// }
+//
+// return false;
+// }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/util/JpaCoreAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/util/JpaCoreAdapterFactory.java
deleted file mode 100644
index 4e3e40e05f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/util/JpaCoreAdapterFactory.java
+++ /dev/null
@@ -1,424 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.util;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IJpaDataSource;
-import org.eclipse.jpt.core.internal.IJpaEObject;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IJpaRootContentNode;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.IXmlEObject;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.JpaDataSource;
-import org.eclipse.jpt.core.internal.JpaEObject;
-import org.eclipse.jpt.core.internal.JpaFile;
-import org.eclipse.jpt.core.internal.NullTypeMapping;
-import org.eclipse.jpt.core.internal.XmlEObject;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Adapter Factory</b> for the model.
- * It provides an adapter <code>createXXX</code> method for each class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.JpaCorePackage
- * @generated
- */
-public class JpaCoreAdapterFactory extends AdapterFactoryImpl
-{
- /**
- * The cached model package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static JpaCorePackage modelPackage;
-
- /**
- * Creates an instance of the adapter factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaCoreAdapterFactory() {
- if (modelPackage == null) {
- modelPackage = JpaCorePackage.eINSTANCE;
- }
- }
-
- /**
- * Returns whether this factory is applicable for the type of the object.
- * <!-- begin-user-doc -->
- * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
- * <!-- end-user-doc -->
- * @return whether this factory is applicable for the type of the object.
- * @generated
- */
- @Override
- public boolean isFactoryForType(Object object) {
- if (object == modelPackage) {
- return true;
- }
- if (object instanceof EObject) {
- return ((EObject) object).eClass().getEPackage() == modelPackage;
- }
- return false;
- }
-
- /**
- * The switch the delegates to the <code>createXXX</code> methods.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected JpaCoreSwitch<Adapter> modelSwitch = new JpaCoreSwitch<Adapter>() {
- @Override
- public Adapter caseIJpaEObject(IJpaEObject object) {
- return createIJpaEObjectAdapter();
- }
-
- @Override
- public Adapter caseJpaEObject(JpaEObject object) {
- return createJpaEObjectAdapter();
- }
-
- @Override
- public Adapter caseIJpaDataSource(IJpaDataSource object) {
- return createIJpaDataSourceAdapter();
- }
-
- @Override
- public Adapter caseJpaDataSource(JpaDataSource object) {
- return createJpaDataSourceAdapter();
- }
-
- @Override
- public Adapter caseIJpaFile(IJpaFile object) {
- return createIJpaFileAdapter();
- }
-
- @Override
- public Adapter caseJpaFile(JpaFile object) {
- return createJpaFileAdapter();
- }
-
- @Override
- public Adapter caseIJpaSourceObject(IJpaSourceObject object) {
- return createIJpaSourceObjectAdapter();
- }
-
- @Override
- public Adapter caseIXmlEObject(IXmlEObject object) {
- return createIXmlEObjectAdapter();
- }
-
- @Override
- public Adapter caseXmlEObject(XmlEObject object) {
- return createXmlEObjectAdapter();
- }
-
- @Override
- public Adapter caseIJpaContentNode(IJpaContentNode object) {
- return createIJpaContentNodeAdapter();
- }
-
- @Override
- public Adapter caseIJpaRootContentNode(IJpaRootContentNode object) {
- return createIJpaRootContentNodeAdapter();
- }
-
- @Override
- public Adapter caseIPersistentType(IPersistentType object) {
- return createIPersistentTypeAdapter();
- }
-
- @Override
- public Adapter caseITypeMapping(ITypeMapping object) {
- return createITypeMappingAdapter();
- }
-
- @Override
- public Adapter caseNullTypeMapping(NullTypeMapping object) {
- return createNullTypeMappingAdapter();
- }
-
- @Override
- public Adapter caseIPersistentAttribute(IPersistentAttribute object) {
- return createIPersistentAttributeAdapter();
- }
-
- @Override
- public Adapter caseIAttributeMapping(IAttributeMapping object) {
- return createIAttributeMappingAdapter();
- }
-
- @Override
- public Adapter defaultCase(EObject object) {
- return createEObjectAdapter();
- }
- };
-
- /**
- * Creates an adapter for the <code>target</code>.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param target the object to adapt.
- * @return the adapter for the <code>target</code>.
- * @generated
- */
- @Override
- public Adapter createAdapter(Notifier target) {
- return modelSwitch.doSwitch((EObject) target);
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaEObject <em>IJpa EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaEObject
- * @generated
- */
- public Adapter createIJpaEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.JpaEObject <em>Jpa EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.JpaEObject
- * @generated
- */
- public Adapter createJpaEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaFile <em>IJpa File</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaFile
- * @generated
- */
- public Adapter createIJpaFileAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.JpaFile <em>Jpa File</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.JpaFile
- * @generated
- */
- public Adapter createJpaFileAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaSourceObject <em>IJpa Source Object</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaSourceObject
- * @generated
- */
- public Adapter createIJpaSourceObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IXmlEObject <em>IXml EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IXmlEObject
- * @generated
- */
- public Adapter createIXmlEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaContentNode <em>IJpa Content Node</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaContentNode
- * @generated
- */
- public Adapter createIJpaContentNodeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaRootContentNode <em>IJpa Root Content Node</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaRootContentNode
- * @generated
- */
- public Adapter createIJpaRootContentNodeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IPersistentType <em>IPersistent Type</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IPersistentType
- * @generated
- */
- public Adapter createIPersistentTypeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.ITypeMapping <em>IType Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.ITypeMapping
- * @generated
- */
- public Adapter createITypeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.NullTypeMapping <em>Null Type Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.NullTypeMapping
- * @generated
- */
- public Adapter createNullTypeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IPersistentAttribute <em>IPersistent Attribute</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IPersistentAttribute
- * @generated
- */
- public Adapter createIPersistentAttributeAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IAttributeMapping <em>IAttribute Mapping</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IAttributeMapping
- * @generated
- */
- public Adapter createIAttributeMappingAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.XmlEObject <em>Xml EObject</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.XmlEObject
- * @generated
- */
- public Adapter createXmlEObjectAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.IJpaDataSource <em>IJpa Data Source</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.IJpaDataSource
- * @generated
- */
- public Adapter createIJpaDataSourceAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.jpt.core.internal.JpaDataSource <em>Jpa Data Source</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.jpt.core.internal.JpaDataSource
- * @generated
- */
- public Adapter createJpaDataSourceAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for the default case.
- * <!-- begin-user-doc -->
- * This default implementation returns null.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @generated
- */
- public Adapter createEObjectAdapter() {
- return null;
- }
-} //JpaCoreAdapterFactory
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/util/JpaCoreSwitch.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/util/JpaCoreSwitch.java
deleted file mode 100644
index d40f85a59a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/util/JpaCoreSwitch.java
+++ /dev/null
@@ -1,546 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.util;
-
-import java.util.List;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IJpaDataSource;
-import org.eclipse.jpt.core.internal.IJpaEObject;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.IJpaRootContentNode;
-import org.eclipse.jpt.core.internal.IJpaSourceObject;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.IXmlEObject;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.JpaDataSource;
-import org.eclipse.jpt.core.internal.JpaEObject;
-import org.eclipse.jpt.core.internal.JpaFile;
-import org.eclipse.jpt.core.internal.NullTypeMapping;
-import org.eclipse.jpt.core.internal.XmlEObject;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Switch</b> for the model's inheritance hierarchy.
- * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
- * to invoke the <code>caseXXX</code> method for each class of the model,
- * starting with the actual class of the object
- * and proceeding up the inheritance hierarchy
- * until a non-null result is returned,
- * which is the result of the switch.
- * <!-- end-user-doc -->
- * @see org.eclipse.jpt.core.internal.JpaCorePackage
- * @generated
- */
-public class JpaCoreSwitch<T>
-{
- /**
- * The cached model package
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static JpaCorePackage modelPackage;
-
- /**
- * Creates an instance of the switch.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public JpaCoreSwitch() {
- if (modelPackage == null) {
- modelPackage = JpaCorePackage.eINSTANCE;
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- public T doSwitch(EObject theEObject) {
- return doSwitch(theEObject.eClass(), theEObject);
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(EClass theEClass, EObject theEObject) {
- if (theEClass.eContainer() == modelPackage) {
- return doSwitch(theEClass.getClassifierID(), theEObject);
- }
- else {
- List<EClass> eSuperTypes = theEClass.getESuperTypes();
- return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), theEObject);
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(int classifierID, EObject theEObject) {
- switch (classifierID) {
- case JpaCorePackage.IJPA_EOBJECT : {
- IJpaEObject iJpaEObject = (IJpaEObject) theEObject;
- T result = caseIJpaEObject(iJpaEObject);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCorePackage.JPA_EOBJECT : {
- JpaEObject jpaEObject = (JpaEObject) theEObject;
- T result = caseJpaEObject(jpaEObject);
- if (result == null)
- result = caseIJpaEObject(jpaEObject);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCorePackage.IJPA_DATA_SOURCE : {
- IJpaDataSource iJpaDataSource = (IJpaDataSource) theEObject;
- T result = caseIJpaDataSource(iJpaDataSource);
- if (result == null)
- result = caseIJpaEObject(iJpaDataSource);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCorePackage.JPA_DATA_SOURCE : {
- JpaDataSource jpaDataSource = (JpaDataSource) theEObject;
- T result = caseJpaDataSource(jpaDataSource);
- if (result == null)
- result = caseJpaEObject(jpaDataSource);
- if (result == null)
- result = caseIJpaDataSource(jpaDataSource);
- if (result == null)
- result = caseIJpaEObject(jpaDataSource);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCorePackage.IJPA_FILE : {
- IJpaFile iJpaFile = (IJpaFile) theEObject;
- T result = caseIJpaFile(iJpaFile);
- if (result == null)
- result = caseIJpaEObject(iJpaFile);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCorePackage.JPA_FILE : {
- JpaFile jpaFile = (JpaFile) theEObject;
- T result = caseJpaFile(jpaFile);
- if (result == null)
- result = caseJpaEObject(jpaFile);
- if (result == null)
- result = caseIJpaFile(jpaFile);
- if (result == null)
- result = caseIJpaEObject(jpaFile);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCorePackage.IJPA_SOURCE_OBJECT : {
- IJpaSourceObject iJpaSourceObject = (IJpaSourceObject) theEObject;
- T result = caseIJpaSourceObject(iJpaSourceObject);
- if (result == null)
- result = caseIJpaEObject(iJpaSourceObject);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCorePackage.IXML_EOBJECT : {
- IXmlEObject iXmlEObject = (IXmlEObject) theEObject;
- T result = caseIXmlEObject(iXmlEObject);
- if (result == null)
- result = caseIJpaEObject(iXmlEObject);
- if (result == null)
- result = caseIJpaSourceObject(iXmlEObject);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCorePackage.XML_EOBJECT : {
- XmlEObject xmlEObject = (XmlEObject) theEObject;
- T result = caseXmlEObject(xmlEObject);
- if (result == null)
- result = caseJpaEObject(xmlEObject);
- if (result == null)
- result = caseIXmlEObject(xmlEObject);
- if (result == null)
- result = caseIJpaEObject(xmlEObject);
- if (result == null)
- result = caseIJpaSourceObject(xmlEObject);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCorePackage.IJPA_CONTENT_NODE : {
- IJpaContentNode iJpaContentNode = (IJpaContentNode) theEObject;
- T result = caseIJpaContentNode(iJpaContentNode);
- if (result == null)
- result = caseIJpaSourceObject(iJpaContentNode);
- if (result == null)
- result = caseIJpaEObject(iJpaContentNode);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCorePackage.IJPA_ROOT_CONTENT_NODE : {
- IJpaRootContentNode iJpaRootContentNode = (IJpaRootContentNode) theEObject;
- T result = caseIJpaRootContentNode(iJpaRootContentNode);
- if (result == null)
- result = caseIJpaContentNode(iJpaRootContentNode);
- if (result == null)
- result = caseIJpaSourceObject(iJpaRootContentNode);
- if (result == null)
- result = caseIJpaEObject(iJpaRootContentNode);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCorePackage.IPERSISTENT_TYPE : {
- IPersistentType iPersistentType = (IPersistentType) theEObject;
- T result = caseIPersistentType(iPersistentType);
- if (result == null)
- result = caseIJpaContentNode(iPersistentType);
- if (result == null)
- result = caseIJpaSourceObject(iPersistentType);
- if (result == null)
- result = caseIJpaEObject(iPersistentType);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCorePackage.ITYPE_MAPPING : {
- ITypeMapping iTypeMapping = (ITypeMapping) theEObject;
- T result = caseITypeMapping(iTypeMapping);
- if (result == null)
- result = caseIJpaSourceObject(iTypeMapping);
- if (result == null)
- result = caseIJpaEObject(iTypeMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCorePackage.NULL_TYPE_MAPPING : {
- NullTypeMapping nullTypeMapping = (NullTypeMapping) theEObject;
- T result = caseNullTypeMapping(nullTypeMapping);
- if (result == null)
- result = caseJpaEObject(nullTypeMapping);
- if (result == null)
- result = caseITypeMapping(nullTypeMapping);
- if (result == null)
- result = caseIJpaSourceObject(nullTypeMapping);
- if (result == null)
- result = caseIJpaEObject(nullTypeMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCorePackage.IPERSISTENT_ATTRIBUTE : {
- IPersistentAttribute iPersistentAttribute = (IPersistentAttribute) theEObject;
- T result = caseIPersistentAttribute(iPersistentAttribute);
- if (result == null)
- result = caseIJpaContentNode(iPersistentAttribute);
- if (result == null)
- result = caseIJpaSourceObject(iPersistentAttribute);
- if (result == null)
- result = caseIJpaEObject(iPersistentAttribute);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- case JpaCorePackage.IATTRIBUTE_MAPPING : {
- IAttributeMapping iAttributeMapping = (IAttributeMapping) theEObject;
- T result = caseIAttributeMapping(iAttributeMapping);
- if (result == null)
- result = caseIJpaSourceObject(iAttributeMapping);
- if (result == null)
- result = caseIJpaEObject(iAttributeMapping);
- if (result == null)
- result = defaultCase(theEObject);
- return result;
- }
- default :
- return defaultCase(theEObject);
- }
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaEObject(IJpaEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Jpa EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Jpa EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJpaEObject(JpaEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa File</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa File</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaFile(IJpaFile object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Jpa File</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Jpa File</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJpaFile(JpaFile object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa Source Object</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa Source Object</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaSourceObject(IJpaSourceObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IXml EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IXml EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIXmlEObject(IXmlEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa Content Node</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa Content Node</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaContentNode(IJpaContentNode object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa Root Content Node</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa Root Content Node</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaRootContentNode(IJpaRootContentNode object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IPersistent Type</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IPersistent Type</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIPersistentType(IPersistentType object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IType Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IType Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseITypeMapping(ITypeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Null Type Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Null Type Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseNullTypeMapping(NullTypeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IPersistent Attribute</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IPersistent Attribute</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIPersistentAttribute(IPersistentAttribute object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IAttribute Mapping</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IAttribute Mapping</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIAttributeMapping(IAttributeMapping object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Xml EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Xml EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseXmlEObject(XmlEObject object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>IJpa Data Source</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>IJpa Data Source</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseIJpaDataSource(IJpaDataSource object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Jpa Data Source</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Jpa Data Source</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseJpaDataSource(JpaDataSource object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch, but this is the last case anyway.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject)
- * @generated
- */
- public T defaultCase(EObject object) {
- return null;
- }
-} //JpaCoreSwitch
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java
index e2fdde0240..f9a16ae423 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java
@@ -16,28 +16,28 @@ import org.eclipse.wst.validation.internal.provisional.core.IMessage;
public class JpaValidationMessages
implements IJpaValidationMessages
{
- private static String[] DEFAULT_PARAMS = new String[0];
+ private static String[] DEFAULT_PARMS = new String[0];
private static ITextRange DEFAULT_TEXT_RANGE = ITextRange.Empty.instance();
public static IMessage buildMessage(
int severity, String messageId, Object targetObject) {
- return buildMessage(severity, messageId, DEFAULT_PARAMS, targetObject);
+ return buildMessage(severity, messageId, DEFAULT_PARMS, targetObject);
}
public static IMessage buildMessage(
- int severity, String messageId, String[] params, Object targetObject) {
- return buildMessage(severity, messageId, params, targetObject, DEFAULT_TEXT_RANGE);
+ int severity, String messageId, String[] parms, Object targetObject) {
+ return buildMessage(severity, messageId, parms, targetObject, DEFAULT_TEXT_RANGE);
}
public static IMessage buildMessage(
int severity, String messageId, Object targetObject, ITextRange textRange) {
- return buildMessage(severity, messageId, DEFAULT_PARAMS, targetObject, textRange);
+ return buildMessage(severity, messageId, DEFAULT_PARMS, targetObject, textRange);
}
public static IMessage buildMessage(
- int severity, String messageId, String[] params, Object targetObject, ITextRange textRange) {
- IMessage message = new Message(BUNDLE, severity, messageId, params, targetObject);
+ int severity, String messageId, String[] parms, Object targetObject, ITextRange textRange) {
+ IMessage message = new Message(BUNDLE, severity, messageId, parms, targetObject);
message.setLineNo(textRange.getLineNumber());
message.setOffset(textRange.getOffset());
message.setLength(textRange.getLength());
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java
index eef0b8b0bc..d4a6d77fdc 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java
@@ -10,7 +10,6 @@
package org.eclipse.jpt.core.internal.validation;
import java.util.Iterator;
-
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -38,7 +37,6 @@ import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
* This class is referenced in the JPA extension for the
* WTP validator extension point.
*/
-@SuppressWarnings("restriction") // we use lots of stuff that is still internal to WTP
public class JpaValidator implements IValidatorJob {
diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/.settings/org.eclipse.core.resources.prefs b/jpa/plugins/org.eclipse.jpt.db.ui/.settings/org.eclipse.core.resources.prefs
index ee4b8c1b90..8fa7db1fac 100644
--- a/jpa/plugins/org.eclipse.jpt.db.ui/.settings/org.eclipse.core.resources.prefs
+++ b/jpa/plugins/org.eclipse.jpt.db.ui/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +1,3 @@
-#Sun May 27 15:10:38 EDT 2007
+#Tue Jan 15 11:11:22 EST 2008
eclipse.preferences.version=1
encoding/<project>=ISO-8859-1
diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java b/jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java
index 632fe81411..eae38da018 100644
--- a/jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java
+++ b/jpa/plugins/org.eclipse.jpt.db.ui/src/org/eclipse/jpt/db/ui/internal/DTPUiTools.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2007 Oracle. All rights reserved.
+* Copyright (c) 2007, 2008 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.
@@ -44,6 +44,7 @@ public class DTPUiTools {
// Filter datasource category
ViewerFilter viewerFilter = new ViewerFilter() {
+ @Override
public boolean select( Viewer viewer, Object parentElement, Object element) {
CPWizardNode wizardNode = ( CPWizardNode) element;
@@ -55,8 +56,7 @@ public class DTPUiTools {
while( cat != null) {
if( cat.getId().equals( ConnectionProfileRepository.DATABASE_CATEGORY_ID))
return true;
- else
- cat = cat.getParent();
+ cat = cat.getParent();
}
}
return false;
@@ -80,7 +80,7 @@ public class DTPUiTools {
return addedProfile.getName();
}
- private static class LocalProfileListener implements IProfileListener {
+ static class LocalProfileListener implements IProfileListener {
IConnectionProfile addedProfile;
public void profileAdded( IConnectionProfile profile) {
diff --git a/jpa/plugins/org.eclipse.jpt.db/.settings/org.eclipse.core.resources.prefs b/jpa/plugins/org.eclipse.jpt.db/.settings/org.eclipse.core.resources.prefs
index 797ea025b1..84ebb5c739 100644
--- a/jpa/plugins/org.eclipse.jpt.db/.settings/org.eclipse.core.resources.prefs
+++ b/jpa/plugins/org.eclipse.jpt.db/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +1,3 @@
-#Sun May 27 15:10:29 EDT 2007
+#Tue Jan 15 11:11:02 EST 2008
eclipse.preferences.version=1
encoding/<project>=ISO-8859-1
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Catalog.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Catalog.java
index 0c4238e616..9b1e787d66 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Catalog.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Catalog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -77,6 +77,10 @@ final class Catalog extends DTPWrapper implements Comparable<Catalog> {
return this.database.column(dtpColumn);
}
+ public Database database() {
+ return this.database;
+ }
+
// ***** schemata
synchronized Set<Schema> buildSchemata() {
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Column.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Column.java
index 547ba01aad..2f8bbd222c 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Column.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Column.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -13,8 +13,10 @@ import java.text.Collator;
import org.eclipse.datatools.connectivity.sqm.core.rte.ICatalogObject;
import org.eclipse.datatools.connectivity.sqm.core.rte.ICatalogObjectListener;
+import org.eclipse.datatools.modelbase.dbdefinition.PredefinedDataTypeDefinition;
import org.eclipse.datatools.modelbase.sql.datatypes.DataType;
import org.eclipse.datatools.modelbase.sql.datatypes.PredefinedDataType;
+import org.eclipse.jpt.utility.internal.ClassTools;
import org.eclipse.jpt.utility.internal.JavaType;
import org.eclipse.jpt.utility.internal.NameTools;
@@ -35,6 +37,14 @@ public final class Column extends DTPWrapper implements Comparable<Column> {
private static final JavaType CLOB_JAVA_TYPE = new JavaType(java.sql.Clob.class);
private static final JavaType STRING_JAVA_TYPE = new JavaType(java.lang.String.class);
+ private static final JavaType UTIL_DATE_JAVA_TYPE = new JavaType(java.util.Date.class);
+ private static final JavaType SQL_DATE_JAVA_TYPE = new JavaType(java.sql.Date.class);
+ private static final JavaType SQL_TIME_JAVA_TYPE = new JavaType(java.sql.Time.class);
+ private static final JavaType SQL_TIMESTAMP_JAVA_TYPE = new JavaType(java.sql.Timestamp.class);
+
+ private static final JavaType BIG_DECIMAL_JAVA_TYPE = new JavaType(java.math.BigDecimal.class);
+ private static final JavaType LONG_JAVA_TYPE = new JavaType(long.class);
+
// ********** constructors **********
@@ -109,6 +119,54 @@ public final class Column extends DTPWrapper implements Comparable<Column> {
/**
* Return a Java type declaration that is reasonably
+ * similar to the column's data type and suitable for use as a
+ * primary key field.
+ */
+ public String primaryKeyJavaTypeDeclaration() {
+ return this.primaryKeyJavaType().declaration();
+ }
+
+ /**
+ * Return a Java type that is reasonably
+ * similar to the column's data type and suitable for use as a
+ * primary key field.
+ */
+ public JavaType primaryKeyJavaType() {
+ return this.jpaSpecCompliantPrimaryKeyJavaType(this.javaType());
+ }
+
+ /**
+ * The JPA spec [2.1.4] says only the following types are allowed in
+ * primary key fields:
+ * [variable] primitives
+ * [variable] primitive wrappers
+ * java.lang.String
+ * java.util.Date
+ * java.sql.Date
+ */
+ private JavaType jpaSpecCompliantPrimaryKeyJavaType(JavaType javaType) {
+ if (javaType.isVariablePrimitive()
+ || javaType.isVariablePrimitiveWrapper()
+ || javaType.equals(STRING_JAVA_TYPE)
+ || javaType.equals(UTIL_DATE_JAVA_TYPE)
+ || javaType.equals(SQL_DATE_JAVA_TYPE)) {
+ return javaType;
+ }
+ if (javaType.equals(BIG_DECIMAL_JAVA_TYPE)) {
+ return LONG_JAVA_TYPE; // ??
+ }
+ if (javaType.equals(SQL_TIME_JAVA_TYPE)) {
+ return UTIL_DATE_JAVA_TYPE; // ???
+ }
+ if (javaType.equals(SQL_TIMESTAMP_JAVA_TYPE)) {
+ return UTIL_DATE_JAVA_TYPE; // ???
+ }
+ // all the other typical types are pretty much un-mappable - return String(?)
+ return STRING_JAVA_TYPE;
+ }
+
+ /**
+ * Return a Java type declaration that is reasonably
* similar to the column's data type.
*/
public String javaTypeDeclaration() {
@@ -122,11 +180,21 @@ public final class Column extends DTPWrapper implements Comparable<Column> {
public JavaType javaType() {
DataType dataType = this.dtpColumn.getDataType();
return (dataType instanceof PredefinedDataType) ?
- this.jpaSpecCompliantJavaType(DTPTools.javaTypeFor(((PredefinedDataType) dataType).getPrimitiveType()))
+ this.jpaSpecCompliantJavaType(this.javaType((PredefinedDataType) dataType))
:
DEFAULT_JAVA_TYPE;
}
+ private JavaType javaType(PredefinedDataType dataType) {
+ // this is just a bit hacky: moving from a type declaration to a class name to a type declaration...
+ String dtpJavaClassName = this.predefinedDataTypeDefinition(dataType).getJavaClassName();
+ return new JavaType(ClassTools.classNameForTypeDeclaration(dtpJavaClassName));
+ }
+
+ private PredefinedDataTypeDefinition predefinedDataTypeDefinition(PredefinedDataType dataType) {
+ return this.database().dtpDefinition().getPredefinedDataTypeDefinition(dataType.getName());
+ }
+
/**
* The JDBC spec says JDBC drivers should be able to map BLOBs and CLOBs
* directly, but the JPA spec does not allow them.
@@ -153,6 +221,10 @@ public final class Column extends DTPWrapper implements Comparable<Column> {
return this.dtpColumn == column;
}
+ public Database database() {
+ return this.table.database();
+ }
+
// ********** Comparable implementation **********
public int compareTo( Column column) {
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ConnectionProfile.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ConnectionProfile.java
index 46dd3e41ef..7a93a8f5c4 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ConnectionProfile.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ConnectionProfile.java
@@ -114,6 +114,11 @@ public abstract class ConnectionProfile extends DTPWrapper implements Comparable
public abstract String getUserPassword();
+ /**
+ * protected, use defaultSchema() : Schema instead
+ */
+ protected abstract String getDefaultSchemaName();
+
public abstract String getDefaultSchema();
public abstract String getInstanceId();
@@ -140,6 +145,13 @@ public abstract class ConnectionProfile extends DTPWrapper implements Comparable
*/
public abstract boolean canWorkOffline();
+ /**
+ * Return the default Schema for this connection. Can be null.
+ */
+ public Schema defaultSchema() {
+ return getDatabase().schemaNamed(getDefaultSchemaName());
+ }
+
@Override
protected boolean connectionIsOnline() {
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ConnectionProfileRepository.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ConnectionProfileRepository.java
index 9e76ac0aa7..117816e148 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ConnectionProfileRepository.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ConnectionProfileRepository.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -9,12 +9,12 @@
******************************************************************************/
package org.eclipse.jpt.db.internal;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.Vector;
+
import org.eclipse.datatools.connectivity.IConnectionProfile;
import org.eclipse.datatools.connectivity.IProfileListener;
import org.eclipse.datatools.connectivity.ProfileManager;
@@ -172,10 +172,10 @@ public class ConnectionProfileRepository {
// ********** member class **********
/**
* Keep the repository in synch with the DTP profile manager
- * and forward events to the repositories listeners.
+ * and forward events to the repository's listeners.
*/
private class LocalProfileListener implements IProfileListener {
- private Collection<ProfileListener> listeners = new Vector<ProfileListener>();
+ private Vector<ProfileListener> listeners = new Vector<ProfileListener>();
LocalProfileListener() {
super();
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileWrapper.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileWrapper.java
index ae4cb741e5..d7337660a8 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionProfileWrapper.java
@@ -271,7 +271,7 @@ public final class DTPConnectionProfileWrapper extends ConnectionProfile {
}
@Override
- public String getDefaultSchema() {
+ protected String getDefaultSchemaName() {
if( this.getDatabase().getVendor().equalsIgnoreCase( POSTGRESQL_VENDOR)) {
return PUBLIC_SCHEMA;
}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionWrapper.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionWrapper.java
index 180ff5c998..c9e4673716 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPConnectionWrapper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -22,7 +22,7 @@ import org.eclipse.datatools.connectivity.IManagedConnectionOfflineListener;
*/
final class DTPConnectionWrapper extends Connection {
- final private DTPConnectionProfileWrapper profile;
+ final DTPConnectionProfileWrapper profile;
private LocalConnectionListener connectionListener;
// ********** constructors **********
@@ -67,12 +67,12 @@ final class DTPConnectionWrapper extends Connection {
// ********** queries **********
- private IManagedConnection getDTPConnection() {
+ IManagedConnection getDTPConnection() {
return this.profile.getDTPConnection();
}
- private IManagedConnection getDTPOfflineConnection() {
+ IManagedConnection getDTPOfflineConnection() {
return this.profile.getDTPOfflineConnection();
}
@@ -200,21 +200,18 @@ final class DTPConnectionWrapper extends Connection {
}
}
- @SuppressWarnings("unused")
void databaseChanged( Database database, int eventType) {
for (ConnectionListener listener : this.listeners) {
listener.databaseChanged( DTPConnectionWrapper.this.profile, database);
}
}
- @SuppressWarnings("unused")
void schemaChanged( Schema schema, Database database, int eventType) {
for (ConnectionListener listener : this.listeners) {
listener.schemaChanged( DTPConnectionWrapper.this.profile, schema);
}
}
- @SuppressWarnings("unused")
void tableChanged( Table table, Schema schema, Database database, int eventType) {
for (ConnectionListener listener : this.listeners) {
listener.tableChanged( DTPConnectionWrapper.this.profile, table);
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseWrapper.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseWrapper.java
index a636134d8c..017ce94d7c 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/DTPDatabaseWrapper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -15,8 +15,10 @@ import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Set;
+import org.eclipse.datatools.connectivity.sqm.core.definition.DatabaseDefinition;
import org.eclipse.datatools.connectivity.sqm.core.rte.ICatalogObject;
import org.eclipse.datatools.connectivity.sqm.core.rte.ICatalogObjectListener;
+import org.eclipse.datatools.connectivity.sqm.internal.core.RDBCorePlugin;
import org.eclipse.emf.common.util.EList;
/**
@@ -135,6 +137,11 @@ public final class DTPDatabaseWrapper extends Database {
return this.dtpDatabase.getVersion();
}
+ @Override
+ public DatabaseDefinition dtpDefinition() {
+ return RDBCorePlugin.getDefault().getDatabaseDefinitionRegistry().getDefinition(this.dtpDatabase);
+ }
+
// ***** schemata
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Database.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Database.java
index ab7f5656e9..a4f9f2c14d 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Database.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Database.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -13,6 +13,7 @@ import java.text.Collator;
import java.util.Iterator;
import java.util.Set;
+import org.eclipse.datatools.connectivity.sqm.core.definition.DatabaseDefinition;
import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
@@ -71,6 +72,12 @@ public abstract class Database extends DTPWrapper implements Comparable<Database
return this.schema( dtpTable.getSchema()).table( dtpTable);
}
+ public Database database() {
+ return this;
+ }
+
+ public abstract DatabaseDefinition dtpDefinition();
+
// ********** Comparable implementation **********
public int compareTo( Database database) {
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ForeignKey.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ForeignKey.java
index 6287711978..6493592884 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ForeignKey.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/ForeignKey.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -123,10 +123,10 @@ public final class ForeignKey extends DTPWrapper implements Comparable<ForeignKe
* the base table's primary key
*/
public Iterator<Column> nonPrimaryKeyBaseColumns() {
- return new FilteringIterator<Column>(this.baseColumns()) {
+ return new FilteringIterator<Column, Column>(this.baseColumns()) {
@Override
- protected boolean accept(Object o) {
- return ! ForeignKey.this.getBaseTable().primaryKeyColumnsContains((Column) o);
+ protected boolean accept(Column o) {
+ return ! ForeignKey.this.getBaseTable().primaryKeyColumnsContains(o);
}
};
}
@@ -176,6 +176,10 @@ public final class ForeignKey extends DTPWrapper implements Comparable<ForeignKe
return columnPair.getBaseColumn().matchesJavaFieldName(javaFieldName + "_" + pkColumn.getName());
}
+ public Database database() {
+ return this.baseTable.database();
+ }
+
// ***** column pairs
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/NullConnectionProfile.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/NullConnectionProfile.java
index 2822a50297..ba97c88f43 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/NullConnectionProfile.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/NullConnectionProfile.java
@@ -127,7 +127,7 @@ public final class NullConnectionProfile extends ConnectionProfile {
}
@Override
- public String getDefaultSchema() {
+ public String getDefaultSchemaName() {
return "";
}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/NullDatabase.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/NullDatabase.java
index bc92d29d54..0ba22eb085 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/NullDatabase.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/NullDatabase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -11,6 +11,7 @@ package org.eclipse.jpt.db.internal;
import java.util.Collections;
import java.util.Set;
+import org.eclipse.datatools.connectivity.sqm.core.definition.DatabaseDefinition;
import org.eclipse.jpt.utility.internal.ClassTools;
/**
@@ -80,6 +81,11 @@ public final class NullDatabase extends Database {
return "";
}
+ @Override
+ public DatabaseDefinition dtpDefinition() {
+ return null;
+ }
+
// ***** catalogs
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Schema.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Schema.java
index 9ef2c7fb04..de19966414 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Schema.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Schema.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -125,6 +125,10 @@ public final class Schema extends DTPWrapper implements Comparable<Schema> {
return this.database.column(dtpColumn);
}
+ public Database database() {
+ return this.database;
+ }
+
// ********** tables **********
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Sequence.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Sequence.java
index 7cb68a47e5..28a096614b 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Sequence.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Sequence.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -71,4 +71,9 @@ public final class Sequence extends DTPWrapper implements Comparable<Sequence> {
public int compareTo( Sequence sequence) {
return Collator.getInstance().compare( this.getName(), sequence.getName());
}
+
+ public Database database() {
+ return this.schema.database();
+ }
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Table.java b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Table.java
index 7b49b72f8c..8f7aaf732e 100644
--- a/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Table.java
+++ b/jpa/plugins/org.eclipse.jpt.db/src/org/eclipse/jpt/db/internal/Table.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -151,6 +151,10 @@ public final class Table extends DTPWrapper implements Comparable<Table> {
return this.schema.table(table);
}
+ public Database database() {
+ return this.schema.database();
+ }
+
// ***** columns
private synchronized Set<Column> getColumns() {
diff --git a/jpa/plugins/org.eclipse.jpt.gen/.settings/org.eclipse.core.resources.prefs b/jpa/plugins/org.eclipse.jpt.gen/.settings/org.eclipse.core.resources.prefs
index 7e690b4d88..1f15ff2b4b 100644
--- a/jpa/plugins/org.eclipse.jpt.gen/.settings/org.eclipse.core.resources.prefs
+++ b/jpa/plugins/org.eclipse.jpt.gen/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +1,3 @@
-#Sun May 27 15:10:55 EDT 2007
+#Tue Jan 15 11:12:07 EST 2008
eclipse.preferences.version=1
encoding/<project>=ISO-8859-1
diff --git a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/EntityGenerator.java b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/EntityGenerator.java
index ca71064bdf..6e38a8d2b9 100644
--- a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/EntityGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/EntityGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -20,12 +20,13 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jdt.core.IJavaModelStatusConstants;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.core.internal.content.java.mappings.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
import org.eclipse.jpt.db.internal.Column;
import org.eclipse.jpt.db.internal.ForeignKey;
import org.eclipse.jpt.db.internal.Table;
@@ -241,6 +242,8 @@ public class EntityGenerator {
}
}
+ // TODO if the field's type is java.util.Date, it needs @Temporal(DATE)
+ // TODO if the primary key is auto-generated, the field must be an integral type
private void printReadOnlyPrimaryKeyFieldOn(Column column, EntitySourceWriter pw, boolean printIdAnnotation) {
String fieldName = this.genTable.fieldNameFor(column);
if (this.config.fieldAccessType()) {
@@ -255,7 +258,7 @@ public class EntityGenerator {
}
}
pw.printVisibility(this.config.fieldVisibility());
- pw.printTypeDeclaration(column.javaTypeDeclaration());
+ pw.printTypeDeclaration(column.primaryKeyJavaTypeDeclaration());
pw.print(' ');
pw.print(fieldName);
pw.print(';');
@@ -287,6 +290,8 @@ public class EntityGenerator {
}
}
+ // TODO if the field's type is java.util.Date, it needs @Temporal(DATE)
+ // TODO if the primary key is auto-generated, the field must be an integral type
private void printWritablePrimaryKeyFieldOn(Column column, EntitySourceWriter pw, boolean printIdAnnotation) {
String fieldName = this.genTable.fieldNameFor(column);
if (this.config.fieldAccessType()) {
@@ -299,7 +304,7 @@ public class EntityGenerator {
}
}
pw.printVisibility(this.config.fieldVisibility());
- pw.printTypeDeclaration(column.javaTypeDeclaration());
+ pw.printTypeDeclaration(column.primaryKeyJavaTypeDeclaration());
pw.print(' ');
pw.print(fieldName);
pw.print(';');
@@ -664,6 +669,8 @@ public class EntityGenerator {
}
}
+ // TODO if the property's type is java.util.Date, it needs @Temporal(DATE)
+ // TODO if the primary key is auto-generated, the property must be an integral type
private void printReadOnlyPrimaryKeyGetterAndSetterOn(Column column, EntitySourceWriter pw, boolean printIdAnnotation) {
String propertyName = this.genTable.fieldNameFor(column);
if (this.config.propertyAccessType()) {
@@ -678,7 +685,7 @@ public class EntityGenerator {
}
}
- pw.printGetterAndSetter(propertyName, column.javaTypeDeclaration(), this.config.methodVisibility());
+ pw.printGetterAndSetter(propertyName, column.primaryKeyJavaTypeDeclaration(), this.config.methodVisibility());
}
private void printEntityWritablePrimaryKeyGettersAndSettersOn(EntitySourceWriter pw) {
@@ -691,6 +698,8 @@ public class EntityGenerator {
}
}
+ // TODO if the property's type is java.util.Date, it needs @Temporal(DATE)
+ // TODO if the primary key is auto-generated, the property must be an integral type
private void printWritablePrimaryKeyGetterAndSetterOn(Column column, EntitySourceWriter pw, boolean printIdAnnotation) {
String propertyName = this.genTable.fieldNameFor(column);
if (this.config.propertyAccessType()) {
@@ -703,7 +712,7 @@ public class EntityGenerator {
}
}
- pw.printGetterAndSetter(propertyName, column.javaTypeDeclaration(), this.config.methodVisibility());
+ pw.printGetterAndSetter(propertyName, column.primaryKeyJavaTypeDeclaration(), this.config.methodVisibility());
}
private void printEntityNonPrimaryKeyBasicGettersAndSettersOn(EntitySourceWriter pw) {
@@ -844,7 +853,7 @@ public class EntityGenerator {
private void printIdFieldOn(Column column, EntitySourceWriter pw) {
String fieldName = this.genTable.fieldNameFor(column);
pw.printVisibility(this.config.fieldVisibility());
- pw.printTypeDeclaration(column.javaTypeDeclaration());
+ pw.printTypeDeclaration(column.primaryKeyJavaTypeDeclaration());
pw.print(' ');
pw.print(fieldName);
pw.print(';');
@@ -867,7 +876,7 @@ public class EntityGenerator {
private void printIdGetterAndSetterOn(Column column, EntitySourceWriter pw) {
String propertyName = this.genTable.fieldNameFor(column);
- pw.printGetterAndSetter(propertyName, column.javaTypeDeclaration(), this.config.methodVisibility());
+ pw.printGetterAndSetter(propertyName, column.primaryKeyJavaTypeDeclaration(), this.config.methodVisibility());
}
private void printEqualsMethodOn(String className, Iterator<Column> columns, EntitySourceWriter pw) {
@@ -971,7 +980,7 @@ public class EntityGenerator {
String fieldName = this.genTable.fieldNameFor(column);
JavaType javaType = column.javaType();
if (javaType.isPrimitive()) {
- this.printPrimitiveHashCodeClauseOn(javaType.getElementTypeName(), fieldName, pw);
+ this.printPrimitiveHashCodeClauseOn(javaType.elementTypeName(), fieldName, pw);
} else {
this.printReferenceHashCodeClauseOn(fieldName, pw);
}
@@ -1179,11 +1188,10 @@ public class EntityGenerator {
}
public Iterator<Map.Entry<String, String>> importEntries() {
- return new FilteringIterator<Map.Entry<String, String>>(this.sortedImportEntries()) {
+ return new FilteringIterator<Map.Entry<String, String>, Map.Entry<String, String>>(this.sortedImportEntries()) {
@Override
- protected boolean accept(Object next) {
- @SuppressWarnings("unchecked")
- String pkg = ((Map.Entry<String, String>) next).getValue();
+ protected boolean accept(Map.Entry<String, String> next) {
+ String pkg = next.getValue();
if (pkg.equals("")
|| pkg.equals("java.lang")
|| pkg.equals(EntitySourceWriter.this.packageName)) {
diff --git a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/GenScope.java b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/GenScope.java
index ee9db7fa8d..98a088bc6c 100644
--- a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/GenScope.java
+++ b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/GenScope.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -120,10 +120,10 @@ class GenScope {
* entities (i.e. exclude the "join" tables)
*/
Iterator<GenTable> entityTables() {
- return new FilteringIterator<GenTable>(this.tables()) {
+ return new FilteringIterator<GenTable, GenTable>(this.tables()) {
@Override
- protected boolean accept(Object next) {
- return ! ((GenTable) next).isJoinTable();
+ protected boolean accept(GenTable next) {
+ return ! next.isJoinTable();
}
};
}
@@ -150,10 +150,10 @@ class GenScope {
* return only the "join" gen tables
*/
private Iterator<GenTable> joinTables() {
- return new FilteringIterator<GenTable>(this.tables()) {
+ return new FilteringIterator<GenTable, GenTable>(this.tables()) {
@Override
- protected boolean accept(Object next) {
- return ((GenTable) next).isJoinTable();
+ protected boolean accept(GenTable next) {
+ return next.isJoinTable();
}
};
}
diff --git a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/GenTable.java b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/GenTable.java
index ea7fd3d3c9..f97f43bd7c 100644
--- a/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/GenTable.java
+++ b/jpa/plugins/org.eclipse.jpt.gen/src/org/eclipse/jpt/gen/internal/GenTable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -153,10 +153,10 @@ class GenTable {
* but are also part of an "in-scope" foreign key
*/
public Iterator<Column> readOnlyPrimaryKeyColumns() {
- return new FilteringIterator<Column>(this.table.primaryKeyColumns()) {
+ return new FilteringIterator<Column, Column>(this.table.primaryKeyColumns()) {
@Override
- protected boolean accept(Object column) {
- return GenTable.this.foreignKeyColumnsContains((Column) column);
+ protected boolean accept(Column column) {
+ return GenTable.this.foreignKeyColumnsContains(column);
}
};
}
@@ -166,10 +166,10 @@ class GenTable {
* but are NOT part of any "in-scope" foreign key
*/
Iterator<Column> writablePrimaryKeyColumns() {
- return new FilteringIterator<Column>(this.table.primaryKeyColumns()) {
+ return new FilteringIterator<Column, Column>(this.table.primaryKeyColumns()) {
@Override
- protected boolean accept(Object column) {
- return ! GenTable.this.foreignKeyColumnsContains((Column) column);
+ protected boolean accept(Column column) {
+ return ! GenTable.this.foreignKeyColumnsContains(column);
}
};
}
@@ -179,11 +179,11 @@ class GenTable {
* NOR part of any foreign key
*/
public Iterator<Column> nonPrimaryKeyBasicColumns() {
- return new FilteringIterator<Column>(this.table.columns()) {
+ return new FilteringIterator<Column, Column>(this.table.columns()) {
@Override
- protected boolean accept(Object column) {
- return ! (GenTable.this.primaryKeyColumnsContains((Column) column)
- || GenTable.this.foreignKeyColumnsContains((Column) column));
+ protected boolean accept(Column column) {
+ return ! (GenTable.this.primaryKeyColumnsContains(column)
+ || GenTable.this.foreignKeyColumnsContains(column));
}
};
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/.options b/jpa/plugins/org.eclipse.jpt.ui/.options
new file mode 100644
index 0000000000..37e1229856
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/.options
@@ -0,0 +1,14 @@
+# Debugging options for org.eclipse.jpt.ui plug-in
+
+# Turn on debugging for the org.eclipse.jpt.ui plugin.
+org.eclipse.jpt.ui/debug=false
+
+# Turn on debugging for unit-tests
+org.eclipse.jpt.ui/debug/unit-tests=false
+
+# Turn on debugging for events occurring in the UI panes
+org.eclipse.jpt.ui/debug/ui/layout=false
+org.eclipse.jpt.ui/debug/ui/detailsView=false
+
+# Turn on debugging for events coming from ConnectionProfile
+org.eclipse.jpt.ui/debug/ui/db=false
diff --git a/jpa/plugins/org.eclipse.jpt.ui/.settings/org.eclipse.core.resources.prefs b/jpa/plugins/org.eclipse.jpt.ui/.settings/org.eclipse.core.resources.prefs
index 8f3899b660..2c6dda4a74 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/.settings/org.eclipse.core.resources.prefs
+++ b/jpa/plugins/org.eclipse.jpt.ui/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +1,3 @@
-#Sun May 27 15:11:25 EDT 2007
+#Tue Jan 15 11:12:14 EST 2008
eclipse.preferences.version=1
encoding/<project>=ISO-8859-1
diff --git a/jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF
index f7621c13f6..f72f096a83 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.ui/META-INF/MANIFEST.MF
@@ -30,30 +30,35 @@ Require-Bundle: org.eclipse.core.resources,
org.eclipse.wst.common.project.facet.core,
org.eclipse.wst.common.project.facet.ui,
org.eclipse.wst.sse.ui,
- org.eclipse.wst.web.ui
+ org.eclipse.wst.web.ui,
+ org.eclipse.ui.navigator
Eclipse-LazyStart: true
Export-Package: org.eclipse.jpt.ui.internal;x-internal:=true,
org.eclipse.jpt.ui.internal.actions;x-internal:=true,
org.eclipse.jpt.ui.internal.details;x-internal:=true,
org.eclipse.jpt.ui.internal.dialogs;x-internal:=true,
- org.eclipse.jpt.ui.internal.generic;x-internal:=true,
org.eclipse.jpt.ui.internal.java.details;x-internal:=true,
org.eclipse.jpt.ui.internal.java.mappings.properties;x-internal:=true,
- org.eclipse.jpt.ui.internal.java.structure;x-internal:=true,
org.eclipse.jpt.ui.internal.jface;x-internal:=true,
org.eclipse.jpt.ui.internal.listeners;x-internal:=true,
org.eclipse.jpt.ui.internal.mappings;x-internal:=true,
+ org.eclipse.jpt.ui.internal.mappings.db;x-internal:=true,
org.eclipse.jpt.ui.internal.mappings.details;x-internal:=true,
+ org.eclipse.jpt.ui.internal.navigator;x-internal:=true,
org.eclipse.jpt.ui.internal.perspective;x-internal:=true,
+ org.eclipse.jpt.ui.internal.platform;x-internal:=true,
+ org.eclipse.jpt.ui.internal.platform.base;x-internal:=true,
+ org.eclipse.jpt.ui.internal.platform.generic;x-internal:=true,
org.eclipse.jpt.ui.internal.prefs;x-internal:=true,
org.eclipse.jpt.ui.internal.properties;x-internal:=true,
org.eclipse.jpt.ui.internal.selection;x-internal:=true,
org.eclipse.jpt.ui.internal.structure;x-internal:=true,
+ org.eclipse.jpt.ui.internal.swt;x-internal:=true,
org.eclipse.jpt.ui.internal.util;x-internal:=true,
org.eclipse.jpt.ui.internal.views;x-internal:=true,
+ org.eclipse.jpt.ui.internal.views.structure;x-internal:=true,
org.eclipse.jpt.ui.internal.widgets;x-internal:=true,
org.eclipse.jpt.ui.internal.wizards;x-internal:=true,
org.eclipse.jpt.ui.internal.xml;x-internal:=true,
- org.eclipse.jpt.ui.internal.xml.details;x-internal:=true,
- org.eclipse.jpt.ui.internal.xml.structure;x-internal:=true
+ org.eclipse.jpt.ui.internal.xml.details;x-internal:=true
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/jpa-content.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/jpa-content.gif
new file mode 100644
index 0000000000..c0ab917511
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/jpa-content.gif
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/jpa-file.gif b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/jpa-file.gif
new file mode 100644
index 0000000000..b4e9f4724b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/icons/full/obj16/jpa-file.gif
Binary files differ
diff --git a/jpa/plugins/org.eclipse.jpt.ui/plugin.properties b/jpa/plugins/org.eclipse.jpt.ui/plugin.properties
index be47f4053a..564291f6db 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/plugin.properties
+++ b/jpa/plugins/org.eclipse.jpt.ui/plugin.properties
@@ -24,6 +24,7 @@ providerName=Eclipse.org
JPA_PLATFORM="JPA Platform UI"
+jpaNavigatorContent=JPA Content
jpaWizardCategoryName = JPA
newJpaProjectWizardName = JPA Project
diff --git a/jpa/plugins/org.eclipse.jpt.ui/plugin.xml b/jpa/plugins/org.eclipse.jpt.ui/plugin.xml
index 12561ff32a..194376cd55 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/plugin.xml
+++ b/jpa/plugins/org.eclipse.jpt.ui/plugin.xml
@@ -14,18 +14,24 @@
<factory
adaptableType="org.eclipse.ui.IWorkbenchPart"
class="org.eclipse.jpt.ui.internal.selection.SelectionParticipantFactory">
- <adapter type="org.eclipse.jpt.ui.internal.selection.ISelectionParticipant"/>
+ <adapter type="org.eclipse.jpt.ui.internal.selection.IJpaSelectionParticipant"/>
</factory>
<factory
- adaptableType="org.eclipse.jpt.core.internal.IPersistentAttribute"
+ adaptableType="org.eclipse.ui.IEditorPart"
+ class="org.eclipse.jpt.ui.internal.structure.JpaStructureProviderFactory">
+ <adapter type="org.eclipse.jpt.ui.internal.structure.IJpaStructureProvider"/>
+ </factory>
+
+ <factory
+ adaptableType="org.eclipse.jpt.core.internal.context.base.IPersistentAttribute"
class="org.eclipse.jpt.ui.internal.actions.PersistentAttributeActionFilter$Factory">
<adapter
type="org.eclipse.ui.IActionFilter"/>
</factory>
<factory
- adaptableType="org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute"
+ adaptableType="org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute"
class="org.eclipse.jpt.ui.internal.actions.XmlPersistentAttributeActionFilter$Factory">
<adapter
type="org.eclipse.ui.IActionFilter"/>
@@ -39,7 +45,71 @@
<jpaPlatform
id="generic"
- class="org.eclipse.jpt.ui.internal.generic.GenericPlatformUi"/>
+ class="org.eclipse.jpt.ui.internal.platform.generic.GenericPlatformUi"/>
+
+ </extension>
+
+
+ <extension
+ point="org.eclipse.ui.navigator.viewer">
+
+ <viewerContentBinding
+ viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <contentExtension pattern="org.eclipse.jpt.ui.*"/>
+ </includes>
+ </viewerContentBinding>
+
+ </extension>
+
+
+ <extension
+ point="org.eclipse.ui.navigator.navigatorContent">
+
+ <navigatorContent
+ id="org.eclipse.jpt.ui.jpaNavigatorContent"
+ name="%jpaNavigatorContent"
+ priority="higher"
+ icon="icons/full/obj16/jpa_content.gif"
+ activeByDefault="true"
+ contentProvider="org.eclipse.jpt.ui.internal.navigator.JpaNavigatorContentProvider"
+ labelProvider="org.eclipse.jpt.ui.internal.navigator.JpaNavigatorLabelProvider">
+
+ <triggerPoints>
+ <and>
+ <adapt type="org.eclipse.core.resources.IProject">
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jpt.jpa" />
+ </adapt>
+ </and>
+ </triggerPoints>
+
+ <!--
+
+ <possibleChildren>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.emf.ecore.EObject" />
+ <or>
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.common.emfworkbench.integration.emfPackage"
+ value="ejb.xmi" />
+ </or>
+ </and>
+ <instanceof value="org.eclipse.jst.j2ee.internal.ejb.provider.J2EEJavaClassProviderHelper"/>
+ <instanceof value="org.eclipse.jst.j2ee.internal.ejb.provider.GroupedEJBItemProvider"/>
+ </or>
+ <instanceof value="org.eclipse.jst.j2ee.navigator.internal.LoadingDDNode"/>
+ </possibleChildren>
+
+ <commonSorter
+ id="org.eclipse.jst.j2ee.navigator.internal.J2EEViewerSorter"
+ class="org.eclipse.jst.j2ee.navigator.internal.J2EEViewerSorter" />
+
+ -->
+
+ </navigatorContent>
</extension>
@@ -124,7 +194,7 @@
<objectContribution
id="org.eclipse.jpt.ui.entityMappingsActions"
- objectClass="org.eclipse.jpt.core.internal.content.orm.EntityMappings">
+ objectClass="org.eclipse.jpt.core.internal.context.orm.EntityMappings">
<action
id="org.eclipse.jpt.ui.addPersistentClass"
class="org.eclipse.jpt.ui.internal.actions.AddPersistentClassAction"
@@ -134,7 +204,7 @@
<objectContribution
id="org.eclipse.jpt.ui.xmlPersistentTypeActions"
- objectClass="org.eclipse.jpt.core.internal.content.orm.XmlPersistentType">
+ objectClass="org.eclipse.jpt.core.internal.context.orm.XmlPersistentType">
<action
id="org.eclipse.jpt.ui.removePersistentClass"
class="org.eclipse.jpt.ui.internal.actions.RemovePersistentClassAction"
@@ -143,7 +213,7 @@
</objectContribution>
<objectContribution
id="org.eclipse.jpt.ui.xmlPersistentAttributeActions1"
- objectClass="org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute">
+ objectClass="org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute">
<action
id="org.eclipse.jpt.ui.addPersistentAttributeToXml"
@@ -165,7 +235,7 @@
<objectContribution
id="org.eclipse.jpt.ui.xmlPersistentAttributeActions2"
- objectClass="org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute">
+ objectClass="org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute">
<action
id="org.eclipse.jpt.ui.addPersistentAttributeToXmlAndMap"
@@ -188,7 +258,7 @@
<objectContribution
id="org.eclipse.jpt.ui.xmlPersistentAttributeActions3"
- objectClass="org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute">
+ objectClass="org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute">
<action
id="org.eclipse.jpt.ui.removePersistentAttributeFromXml"
@@ -244,7 +314,7 @@
<view
category="org.eclipse.jpt.ui"
- class="org.eclipse.jpt.ui.internal.views.JpaStructureView"
+ class="org.eclipse.jpt.ui.internal.views.structure.JpaStructureView"
icon="icons/full/eview16/jpa_structure.gif"
id="org.eclipse.jpt.ui.jpaStructureView"
name="%jpaStructure"/>
diff --git a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui.properties b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui.properties
index 1ff880ba95..f8bcec6ffb 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui.properties
+++ b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui.properties
@@ -17,6 +17,9 @@ AddPersistentClassDialog_duplicateClassWarning=File already contains that persis
AddPersistentClassDialog_classNotFoundWarning=Cannot resolve class
AddPersistentClassDialog_noMappingKeyError=You must specify a mapping type
+AddRemovePane_AddButtonText=Add...
+AddRemovePane_RemoveButtonText=Remove
+
DatabaseReconnectWizardPage_database=Database Settings
DatabaseReconnectWizardPage_databaseConnection=Database Connection
DatabaseReconnectWizardPage_reconnectToDatabase=Reconnect to the database.
@@ -26,6 +29,9 @@ DatabaseReconnectWizardPage_schemaInfo=(Note: Must have active connection to se
DatabaseReconnectWizardPage_addConnectionLink=<a>Add connections...</a>
DatabaseReconnectWizardPage_reconnectLink=<a>Reconnect...</a>
+EnumComboViewer_default=Default
+EnumComboViewer_defaultWithDefault=Default ({0})
+
General_browse=Browse...
General_deselectAll=Deselect All
General_selectAll=Select All
@@ -45,7 +51,7 @@ JpaPreferencePage_defaultJpaLib=Default JPA implementation library:
JpaPreferencePage_userLibsLink=<a>Configure user libraries ...</a>
JpaPreferencePage_invalidJpaLib=Invalid Library: Must contain javax.persistence classes.
-JpaStructureView_viewNotAvailable=Structure is not available for the current selection.
+JpaStructureView_structureNotAvailable=JPA structure is not available.
JpaStructureView_linkWithEditorText=Link with Editor
JpaStructureView_linkWithEditorDesc=Link with Active Editor
JpaStructureView_linkWithEditorTooltip=Link with Editor
@@ -71,6 +77,9 @@ JpaFacetWizardPage_discoverClassesButton=Discover annotated classes automaticall
JpaFacetWizardPage_listClassesButton=Annotated classes must be listed in persistence.xml
JpaFacetWizardPage_createOrmXmlButton=Create orm.xml
+OrmItemLabelProviderFactory_entityMappingsLabel=Entity Mappings
+
+PersistenceItemLabelProviderFactory_persistenceLabel=Persistence
PersistentAttributePage_mapAs=Map As:
PersistentTypePage_mapAs=Map As:
diff --git a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties
index d8d63ae59e..bdf10604cc 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties
+++ b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_mappings.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2006, 2007 Oracle. All rights reserved.
+# Copyright (c) 2006, 2008 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.
@@ -8,6 +8,9 @@
# Oracle - initial API and implementation
###############################################################################
+Boolean_True=True
+Boolean_False=False
+
PersistentTypePage_EntityLabel=Entity
PersistentTypePage_EmbeddableLabel=Embeddable
PersistentTypePage_MappedSuperclassLabel=Mapped Superclass
@@ -34,15 +37,19 @@ EntityGeneralSection_name=Name:
BasicGeneralSection_name=Name:
BasicGeneralSection_nameDefault=Default ({0})
BasicGeneralSection_fetchLabel=Fetch:
-BasicGeneralSection_optionalLabel=Optional:
+BasicGeneralSection_optionalLabel=Optional
+BasicGeneralSection_optionalLabelDefault=Optional ({0})
BasicGeneralSection_lobLabel=Lob
BasicGeneralSection_temporalLabel=Temporal:
BasicGeneralSection_enumeratedLabel=Enumerated:
+DefaultBasicMappingUiProvider_Default=Default ({0})
+DefaultEmbeddedMappingUiProvider_Default=Default ({0})
+
TableChooser_label=Name:
CatalogChooser_label=Catalog:
SchemaChooser_label=Schema:
-TableComposite_tableSection=Table:
+TableComposite_tableSection=Table
TableComposite_defaultEmpty=Default ()
TableComposite_defaultWithOneParam=Default ({0})
@@ -53,6 +60,7 @@ TargetEntityChooser_label=Target Entity:
TargetEntityChooser_defaultEmpty=Default ()
TargetEntityChooser_defaultWithOneParam=Default ({0})
TargetEntityChooser_browse=Browse...
+TargetEntityChooser_selectTypeTitle=Select Type
NonOwningMapping_mappedByLabel=Mapped By:
@@ -92,11 +100,13 @@ MultiRelationshipMappingComposite_cascadeType=Cascade Type:
MultiRelationshipMappingComposite_fetchType=Fetch Type:
MultiRelationshipMappingComposite_mappedBy=Mapped By:
-ColumnComposite_columnSection=Column:
+ColumnComposite_columnSection=Column
ColumnComposite_defaultWithOneParam=Default ({0})
-ColumnComposite_defaultEmpty=Default ()
-ColumnComposite_insertable=Insertable:
-ColumnComposite_updatable=Updatable:
+ColumnComposite_defaultEmpty=Default()
+ColumnComposite_insertable=Insertable
+ColumnComposite_insertableWithDefault=Insertable ({0})
+ColumnComposite_updatable=Updatable
+ColumnComposite_updatableWithDefault=Updatable ({0})
JoinColumnComposite_joinColumn=Join Columns
JoinColumnComposite_defaultEmpty=Default()
@@ -113,9 +123,7 @@ JoinColumnComposite_remove=Remove
JoinColumnComposite_overrideDefaultJoinColumns=Override Default
PrimaryKeyJoinColumnsComposite_overrideDefaultPrimaryKeyJoinColumns=Override Default
-PrimaryKeyJoinColumnsComposite_add=Add...
PrimaryKeyJoinColumnsComposite_edit=Edit...
-PrimaryKeyJoinColumnsComposite_remove=Remove
PrimaryKeyJoinColumnsComposite_defaultEmpty=Default()
PrimaryKeyJoinColumnsComposite_defaultWithOneParam=Default ({0})
PrimaryKeyJoinColumnsComposite_primaryKeyJoinColumn=Primary Key Join Columns
@@ -126,7 +134,7 @@ PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsFirstDefault=Default ({0})
PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsSecDefault={0} -> Default ({1})
AttributeOverridesComposite_attributeOverrides=Attribute Overrides
-AttributeOverridesComposite_overridDefault=Override Default
+AttributeOverridesComposite_overrideDefault=Override Default
OverridesComposite_joinColumn=Join Columns
InheritanceComposite_default=Default ({0})
InheritanceComposite_strategy=Strategy:
@@ -145,6 +153,10 @@ IdMappingComposite_sequenceGenerator=Sequence Generator
GeneratedValueComposite_generatedValue=Generated Value
GeneratedValueComposite_generatorName=Generator Name:
GeneratedValueComposite_strategy=Strategy:
+GeneratedValueComposite_auto=Auto
+GeneratedValueComposite_identity=Identity
+GeneratedValueComposite_sequence=Sequence
+GeneratedValueComposite_table=Table
SequenceGeneratorComposite_sequenceGenerator=Sequence Generator
SequenceGeneratorComposite_name=Name:
@@ -166,9 +178,7 @@ OrderByComposite_primaryKeyOrdering=Primary Key Ordering
OrderByComposite_customOrdering=Custom Ordering
SecondaryTablesComposite_secondaryTables=Secondary Tables
-SecondaryTablesComposite_add=Add...
SecondaryTablesComposite_edit=Edit...
-SecondaryTablesComposite_remove=Remove
SecondaryTableDialog_editSecondaryTable=Edit Secondary Table
SecondaryTableDialog_name=Name:
@@ -178,8 +188,37 @@ SecondaryTableDialog_defaultSchema=Default ({0})
SecondaryTableDialog_defaultCatalog=Default ({0})
AccessTypeCombo_default=Default
-EnumComboViewer_default=Default ({0})
MetaDataCompleteCombo_Default=Default ({0})
JoinColumnDialog_defaultTrue=Default ({0})
InheritanceComposite_defaultDiscriminatorType=Default ({0})
-GeneratedValueComposite_default=Default ({0})
+
+OptionalComposite_false=False
+OptionalComposite_true=True
+
+EnumTypeComposite_ordinal=Ordinal
+EnumTypeComposite_string=String
+
+FetchTypeComposite_eager=Eager
+FetchTypeComposite_lazy=Lazy
+
+TemporalTypeComposite_date=Date
+TemporalTypeComposite_time=Time
+TemporalTypeComposite_timestamp=Timestamp
+
+CascadeComposite_all=All
+CascadeComposite_cascadeTitle=Cascade
+CascadeComposite_merge=Merge
+CascadeComposite_persist=Persist
+CascadeComposite_refresh=Refresh
+CascadeComposite_remove=Remove
+
+InheritanceComposite_joined=Joined
+InheritanceComposite_single_table=String Table
+InheritanceComposite_table_per_class=Table Per Class
+InheritanceComposite_char=Character
+InheritanceComposite_integer=Integer
+InheritanceComposite_string=String
+
+MetaDataCompleteComboViewer_true=True
+MetaDataCompleteComboViewer_false=False
+
diff --git a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_xml.properties b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_xml.properties
index f581ea4e89..067562a255 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_xml.properties
+++ b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_xml.properties
@@ -17,6 +17,8 @@ PersistenceUnitMetadataSection_CatalogDefault=Default
PersistentAttributePage_javaAttributeLabel=Java Attribute:
+XmlEntityMappingsDetailsPage_package=Package:
+
XMLEntityMappingsPage_XmlMappingMetadataCompleteCheckBox=XML Mapping Metadata Complete
XMLEntityMappingsPage_CascadePersistCheckBox=Cascade Persist
XMLEntityMappingsPage_PersistenceUnitSection=Persistence Unit
@@ -34,3 +36,6 @@ XmlJavaClassChooser_XmlJavaClassDialog_message=Choose a type:
XmlPackageChooser_PackageDialog_title=Package Selection
XmlPackageChooser_PackageDialog_message=Choose a folder:
+AccessTypeComposite_field=Field
+AccessTypeComposite_property=Property
+
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaUiFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaUiFactory.java
index b94a63b279..94cdd29f33 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaUiFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaUiFactory.java
@@ -1,85 +1,196 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.ui.internal;
-import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddable;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IMappedSuperclass;
+import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
+import org.eclipse.jpt.core.internal.context.base.IVersionMapping;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.BasicComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.BasicMappingComposite;
import org.eclipse.jpt.ui.internal.mappings.details.EmbeddableComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.EmbeddedComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.EmbeddedIdComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.EmbeddedIdMappingComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.EmbeddedMappingComposite;
import org.eclipse.jpt.ui.internal.mappings.details.EntityComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.IdComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.ManyToManyComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.ManyToOneComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.IdMappingComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.ManyToManyMappingComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.ManyToOneMappingComposite;
import org.eclipse.jpt.ui.internal.mappings.details.MappedSuperclassComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.OneToManyComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.OneToOneComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.TransientComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.OneToManyMappingComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.OneToOneMappingComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.TransientMappingComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.VersionMappingComposite;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
+/**
+ * The default implementation of the UI factory required to show the information
+ * related to a JPA mapping (type or attribute).
+ *
+ * @see IJpaUiFactory
+ *
+ * @version 2.0
+ * @since 1.0
+ */
public abstract class BaseJpaUiFactory implements IJpaUiFactory
{
-
- public IJpaComposite createBasicMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new BasicComposite(parent, commandStack, widgetFactory);
+ /*
+ * (non-Javadoc)
+ */
+ public IJpaComposite<IBasicMapping> createBasicMappingComposite(
+ PropertyValueModel<IBasicMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return new BasicMappingComposite(subjectHolder, parent, widgetFactory);
}
- public IJpaComposite createEmbeddableComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new EmbeddableComposite(parent, commandStack, widgetFactory);
+ /*
+ * (non-Javadoc)
+ */
+ public IJpaComposite<IEmbeddable> createEmbeddableComposite(
+ PropertyValueModel<IEmbeddable> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return new EmbeddableComposite(subjectHolder, parent, widgetFactory);
}
- public IJpaComposite createEmbeddedIdMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new EmbeddedIdComposite(parent, commandStack, widgetFactory);
+ /*
+ * (non-Javadoc)
+ */
+ public IJpaComposite<IEmbeddedIdMapping> createEmbeddedIdMappingComposite(
+ PropertyValueModel<IEmbeddedIdMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return new EmbeddedIdMappingComposite(subjectHolder, parent, widgetFactory);
}
- public IJpaComposite createEmbeddedMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new EmbeddedComposite(parent, commandStack, widgetFactory);
+ /*
+ * (non-Javadoc)
+ */
+ public IJpaComposite<IEmbeddedMapping> createEmbeddedMappingComposite(
+ PropertyValueModel<IEmbeddedMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return new EmbeddedMappingComposite(subjectHolder, parent, widgetFactory);
}
- public IJpaComposite createEntityComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new EntityComposite(parent, commandStack, widgetFactory);
+ /*
+ * (non-Javadoc)
+ */
+ public IJpaComposite<IEntity> createEntityComposite(
+ PropertyValueModel<IEntity> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return new EntityComposite(subjectHolder, parent, widgetFactory);
}
- public IJpaComposite createIdMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new IdComposite(parent, commandStack, widgetFactory);
+ /*
+ * (non-Javadoc)
+ */
+ public IJpaComposite<IIdMapping> createIdMappingComposite(
+ PropertyValueModel<IIdMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return new IdMappingComposite(subjectHolder, parent, widgetFactory);
}
- public IJpaComposite createManyToManyMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new ManyToManyComposite(parent, commandStack, widgetFactory);
+ /*
+ * (non-Javadoc)
+ */
+ public IJpaComposite<IManyToManyMapping> createManyToManyMappingComposite(
+ PropertyValueModel<IManyToManyMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return new ManyToManyMappingComposite(subjectHolder, parent, widgetFactory);
}
- public IJpaComposite createManyToOneMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new ManyToOneComposite(parent, commandStack, widgetFactory);
+ /*
+ * (non-Javadoc)
+ */
+ public IJpaComposite<IManyToOneMapping> createManyToOneMappingComposite(
+ PropertyValueModel<IManyToOneMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return new ManyToOneMappingComposite(subjectHolder, parent, widgetFactory);
}
- public IJpaComposite createMappedSuperclassComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new MappedSuperclassComposite(parent, commandStack, widgetFactory);
+ /*
+ * (non-Javadoc)
+ */
+ public IJpaComposite<IMappedSuperclass> createMappedSuperclassComposite(
+ PropertyValueModel<IMappedSuperclass> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return new MappedSuperclassComposite(subjectHolder, parent, widgetFactory);
}
- public IJpaComposite createOneToManyMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new OneToManyComposite(parent, commandStack, widgetFactory);
+ /*
+ * (non-Javadoc)
+ */
+ public IJpaComposite<IOneToManyMapping> createOneToManyMappingComposite(
+ PropertyValueModel<IOneToManyMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return new OneToManyMappingComposite(subjectHolder, parent, widgetFactory);
}
- public IJpaComposite createOneToOneMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new OneToOneComposite(parent, commandStack, widgetFactory);
+ /*
+ * (non-Javadoc)
+ */
+ public IJpaComposite<IOneToOneMapping> createOneToOneMappingComposite(
+ PropertyValueModel<IOneToOneMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return new OneToOneMappingComposite(subjectHolder, parent, widgetFactory);
}
- public IJpaComposite createTransientMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new TransientComposite(parent, commandStack, widgetFactory);
+ /*
+ * (non-Javadoc)
+ */
+ public IJpaComposite<ITransientMapping> createTransientMappingComposite(
+ PropertyValueModel<ITransientMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return new TransientMappingComposite(subjectHolder, parent, widgetFactory);
}
- public IJpaComposite createVersionMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new BasicComposite(parent, commandStack, widgetFactory);
+ /*
+ * (non-Javadoc)
+ */
+ public IJpaComposite<IVersionMapping> createVersionMappingComposite(
+ PropertyValueModel<IVersionMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+ return new VersionMappingComposite(subjectHolder, parent, widgetFactory);
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/GenericJpaUiFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/GenericJpaUiFactory.java
index 9d3edce4f6..734d484241 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/GenericJpaUiFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/GenericJpaUiFactory.java
@@ -3,14 +3,21 @@
* 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.ui.internal;
-
+/**
+ * The default implementation of the UI factory required to show the information
+ * related to a JPA mapping (type or attribute).
+ *
+ * @see IJpaUiFactory
+ *
+ * @version 1.0
+ * @since 1.0
+ */
public class GenericJpaUiFactory extends BaseJpaUiFactory
{
-
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaPlatformUi.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaPlatformUi.java
index 342ac51de2..f998e3ddb1 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaPlatformUi.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaPlatformUi.java
@@ -3,55 +3,79 @@
* 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.ui.internal;
-import java.util.Iterator;
-import java.util.ListIterator;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jpt.core.internal.IJpaProject;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
import org.eclipse.jpt.ui.internal.details.IJpaDetailsProvider;
-import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
-import org.eclipse.jpt.ui.internal.structure.IJpaStructureProvider;
-
+import org.eclipse.ui.navigator.ICommonContentProvider;
+import org.eclipse.ui.navigator.ICommonLabelProvider;
+/**
+ * This interface is to be implemented by a JPA vendor to provide extensions to
+ * JPA UI functionality. This is intended to work in conjunction with a core
+ * JPA platform ({@link IJpaPlatform}) implementation with the same ID.
+ * <p>
+ * Any implementation should be <i>stateless</i> in nature.
+ * <p>
+ * The "generic" extension supplies UI for the core platform extension with the same
+ * ID.
+ *
+ * @see the org.eclipse.jpt.ui.jpaPlatform extension point
+ */
public interface IJpaPlatformUi
{
- Iterator<IJpaStructureProvider> structureProviders();
-
- IJpaStructureProvider structureProvider(String fileContentType);
-
- Iterator<IJpaDetailsProvider> detailsProviders();
-
- IJpaDetailsProvider detailsProvider(String fileContentType);
-
- /**
- * Return the type mapping UI providers for java. This will populate
- * the type mapping combo box in order and displaying ITypeMappingUiProvider.label().
- * It will also be used to create the appropriate composite given a type mapping.
- */
- ListIterator<ITypeMappingUiProvider> javaTypeMappingUiProviders();
-
/**
- * Return the attribute mapping UI providers for java. This will populate
- * the attribute mapping combo box in order and display IAttributeMappingUiProvider.label().
- * It will also be used to create the appropriate composite given an attribute mapping.
+ * Return a *new* navigator content provider. There will be (at most) one
+ * of these per view that uses it.
*/
- ListIterator<IAttributeMappingUiProvider> javaAttributeMappingUiProviders();
+ ICommonContentProvider buildNavigatorContentProvider();
/**
- * Return the default attribute mapping UI providers for java. These will be used
- * to provide a default mapping option if one applies in java.
+ * Return a *new* navigator label provider. There will be (at most) one
+ * of these per view that uses it.
*/
- ListIterator<IAttributeMappingUiProvider> defaultJavaAttributeMappingUiProviders();
+ ICommonLabelProvider buildNavigatorLabelProvider();
- IJpaUiFactory getJpaUiFactory();
void generateDDL(IJpaProject project, IStructuredSelection selection);
-
+
void generateEntities(IJpaProject project, IStructuredSelection selection);
+
+
+// Iterator<IJpaStructureProvider> structureProviders();
+//
+// IJpaStructureProvider structureProvider(String fileContentType);
+//
+// Iterator<IJpaDetailsProvider> detailsProviders();
+//
+ IJpaDetailsProvider detailsProvider(IJpaContextNode contextNode);
+//
+// /**
+// * Return the type mapping UI providers for java. This will populate
+// * the type mapping combo box in order and displaying ITypeMappingUiProvider.label().
+// * It will also be used to create the appropriate composite given a type mapping.
+// */
+// ListIterator<ITypeMappingUiProvider> javaTypeMappingUiProviders();
+//
+// /**
+// * Return the attribute mapping UI providers for java. This will populate
+// * the attribute mapping combo box in order and display IAttributeMappingUiProvider.label().
+// * It will also be used to create the appropriate composite given an attribute mapping.
+// */
+// ListIterator<IAttributeMappingUiProvider> javaAttributeMappingUiProviders();
+//
+// /**
+// * Return the default attribute mapping UI providers for java. These will be used
+// * to provide a default mapping option if one applies in java.
+// */
+// ListIterator<IAttributeMappingUiProvider> defaultJavaAttributeMappingUiProviders();
+//
+// IJpaUiFactory getJpaUiFactory();
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaUiFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaUiFactory.java
index 2939cdfec2..5f1cdeab22 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaUiFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/IJpaUiFactory.java
@@ -3,20 +3,33 @@
* 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.ui.internal;
-import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddable;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IMappedSuperclass;
+import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
+import org.eclipse.jpt.core.internal.context.base.IVersionMapping;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
/**
* Use IJpaFactory to create any IJavaTypeMapping or IJavaAttributeMappings. This is necessary
- * so that platforms can extend the java model with their own annotations.
+ * so that platforms can extend the java model with their own annotations.
* IJavaTypeMappingProvider and IJavaAttributeMappingProvider use this factory.
* See IJpaPlatform.javaTypeMappingProviders() and IJpaPlatform.javaAttributeMappingProviders()
* for creating new mappings types.
@@ -24,29 +37,29 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
*/
public interface IJpaUiFactory
{
- IJpaComposite createEntityComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createEmbeddableComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createMappedSuperclassComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createBasicMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createEmbeddedMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createEmbeddedIdMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createIdMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createManyToManyMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createManyToOneMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createOneToManyMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createOneToOneMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createTransientMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
- IJpaComposite createVersionMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-}
+ IJpaComposite<IBasicMapping> createBasicMappingComposite(PropertyValueModel<IBasicMapping> subjectHolder, Composite parent, TabbedPropertySheetWidgetFactory widgetFactory);
+
+ IJpaComposite<IEmbeddable> createEmbeddableComposite(PropertyValueModel<IEmbeddable> subjectHolder, Composite parent, TabbedPropertySheetWidgetFactory widgetFactory);
+
+ IJpaComposite<IEmbeddedIdMapping> createEmbeddedIdMappingComposite(PropertyValueModel<IEmbeddedIdMapping> subjectHolder, Composite parent, TabbedPropertySheetWidgetFactory widgetFactory);
+
+ IJpaComposite<IEmbeddedMapping> createEmbeddedMappingComposite(PropertyValueModel<IEmbeddedMapping> subjectHolder, Composite parent, TabbedPropertySheetWidgetFactory widgetFactory);
+
+ IJpaComposite<IEntity> createEntityComposite(PropertyValueModel<IEntity> subjectHolder, Composite parent, TabbedPropertySheetWidgetFactory widgetFactory);
+
+ IJpaComposite<IIdMapping> createIdMappingComposite(PropertyValueModel<IIdMapping> subjectHolder, Composite parent, TabbedPropertySheetWidgetFactory widgetFactory);
+
+ IJpaComposite<IManyToManyMapping> createManyToManyMappingComposite(PropertyValueModel<IManyToManyMapping> subjectHolder, Composite parent, TabbedPropertySheetWidgetFactory widgetFactory);
+
+ IJpaComposite<IManyToOneMapping> createManyToOneMappingComposite(PropertyValueModel<IManyToOneMapping> subjectHolder, Composite parent, TabbedPropertySheetWidgetFactory widgetFactory);
+
+ IJpaComposite<IMappedSuperclass> createMappedSuperclassComposite(PropertyValueModel<IMappedSuperclass> subjectHolder, Composite parent, TabbedPropertySheetWidgetFactory widgetFactory);
+
+ IJpaComposite<IOneToManyMapping> createOneToManyMappingComposite(PropertyValueModel<IOneToManyMapping> subjectHolder, Composite parent, TabbedPropertySheetWidgetFactory widgetFactory);
+
+ IJpaComposite<IOneToOneMapping> createOneToOneMappingComposite(PropertyValueModel<IOneToOneMapping> subjectHolder, Composite parent, TabbedPropertySheetWidgetFactory widgetFactory);
+
+ IJpaComposite<ITransientMapping> createTransientMappingComposite(PropertyValueModel<ITransientMapping> subjectHolder, Composite parent, TabbedPropertySheetWidgetFactory widgetFactory);
+
+ IJpaComposite<IVersionMapping> createVersionMappingComposite(PropertyValueModel<IVersionMapping> subjectHolder, Composite parent, TabbedPropertySheetWidgetFactory widgetFactory);
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JpaCompletionProposalComputer.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JpaCompletionProposalComputer.java
index b59161c202..5958cc8195 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JpaCompletionProposalComputer.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JpaCompletionProposalComputer.java
@@ -13,12 +13,12 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.CompletionContext;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext;
import org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer;
import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
@@ -26,7 +26,9 @@ import org.eclipse.jface.text.contentassist.CompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jpt.core.internal.IJpaFile;
import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit;
+import org.eclipse.jpt.core.internal.context.java.JavaPersistentType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.JavaResourceModel;
import org.eclipse.jpt.utility.internal.Filter;
import org.eclipse.jpt.utility.internal.StringTools;
@@ -67,7 +69,13 @@ public class JpaCompletionProposalComputer implements IJavaCompletionProposalCom
return Collections.emptyList();
}
- JpaCompilationUnit jpaCU = (JpaCompilationUnit) jpaFile.getContent();
+ JavaResourceModel javaResourceModel = (JavaResourceModel) jpaFile.getResourceModel();
+
+ //TODO A bit of hackery for now just to get this compiling and working good enough,
+ //we need to have a way to get the context model given an IFile or IJpaFile
+ //instead of having to ask the IResourceModel for it
+ JavaPersistentType contextNode = (JavaPersistentType) javaResourceModel.rootContextNodes().next();
+
CompletionContext cc = context.getCoreContext();
// the context's "token" is really a sort of "prefix" - it does NOT
@@ -88,8 +96,9 @@ public class JpaCompletionProposalComputer implements IJavaCompletionProposalCom
// String snippet = source.substring(Math.max(0, tokenStart - 20), Math.min(source.length(), tokenEnd + 21));
// System.out.println("surrounding snippet: =>" + snippet + "<=");
+ CompilationUnit astRoot = JDTTools.buildASTRoot(cu);
List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
- for (Iterator<String> stream = jpaCU.candidateValuesFor(context.getInvocationOffset(), filter); stream.hasNext(); ) {
+ for (Iterator<String> stream = contextNode.candidateValuesFor(context.getInvocationOffset(), filter, astRoot); stream.hasNext(); ) {
String s = stream.next();
proposals.add(new CompletionProposal(s, tokenStart, tokenEnd - tokenStart + 1, s.length()));
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JpaMappingImageHelper.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JpaMappingImageHelper.java
new file mode 100644
index 0000000000..8145695deb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JpaMappingImageHelper.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.swt.graphics.Image;
+
+public class JpaMappingImageHelper
+{
+ public static Image imageForTypeMapping(String mappingKey) {
+ if (IMappingKeys.NULL_TYPE_MAPPING_KEY == mappingKey) {
+ return JptUiPlugin.getImage(JptUiIcons.NULL_TYPE_MAPPING);
+ }
+ else if (IMappingKeys.ENTITY_TYPE_MAPPING_KEY.equals(mappingKey)) {
+ return JptUiPlugin.getImage(JptUiIcons.ENTITY);
+ }
+ else if (IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY.equals(mappingKey)) {
+ return JptUiPlugin.getImage(JptUiIcons.EMBEDDABLE);
+ }
+ else if (IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY.equals(mappingKey)) {
+ return JptUiPlugin.getImage(JptUiIcons.MAPPED_SUPERCLASS);
+ }
+ return null;
+ }
+
+ public static Image imageForAttributeMapping(String mappingKey) {
+ if (IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY == mappingKey) {
+ return JptUiPlugin.getImage(JptUiIcons.NULL_ATTRIBUTE_MAPPING);
+ }
+ else if (IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
+ return JptUiPlugin.getImage(JptUiIcons.BASIC);
+ }
+ else if (IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
+ return JptUiPlugin.getImage(JptUiIcons.ID);
+ }
+ else if (IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
+ return JptUiPlugin.getImage(JptUiIcons.VERSION);
+ }
+ else if (IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
+ return JptUiPlugin.getImage(JptUiIcons.EMBEDDED_ID);
+ }
+ else if (IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
+ return JptUiPlugin.getImage(JptUiIcons.EMBEDDED);
+ }
+ else if (IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
+ return JptUiPlugin.getImage(JptUiIcons.ONE_TO_ONE);
+ }
+ else if (IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
+ return JptUiPlugin.getImage(JptUiIcons.ONE_TO_MANY);
+ }
+ else if (IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
+ return JptUiPlugin.getImage(JptUiIcons.MANY_TO_ONE);
+ }
+ else if (IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
+ return JptUiPlugin.getImage(JptUiIcons.MANY_TO_MANY);
+ }
+ else if (IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) {
+ return JptUiPlugin.getImage(JptUiIcons.TRANSIENT);
+ }
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiIcons.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiIcons.java
index abdd525cf2..e04747e58e 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiIcons.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiIcons.java
@@ -12,5 +12,60 @@ package org.eclipse.jpt.ui.internal;
public class JptUiIcons
{
+ // **************** General JPA icons **************************************
+
public static final String JPA_WIZ_BANNER = "full/wizban/jpa_facet_wizban"; //$NON-NLS-1$
+
+ public static final String JPA_CONTENT = "full/obj16/jpa-content"; //$NON-NLS-1$
+
+ public static final String JPA_FILE = "full/obj16/jpa-file"; //$NON-NLS-1$
+
+
+ // **************** Persistence icons **************************************
+
+ public static final String PERSISTENCE = "full/obj16/persistence"; //$NON-NLS-1$
+
+ public static final String PERSISTENCE_UNIT = "full/obj16/persistence-unit"; //$NON-NLS-1$
+
+ public static final String MAPPING_FILE_REF = "full/obj16/jpa-file"; //$NON-NLS-1$
+
+ public static final String CLASS_REF = "full/obj16/null-type-mapping"; //$NON-NLS-1$
+
+
+ // **************** Orm icons **********************************************
+
+ public static final String ENTITY_MAPPINGS = "full/obj16/entity-mappings"; //$NON-NLS-1$
+
+
+ // **************** Orm/Java common icons **********************************
+
+ public static final String ENTITY = "full/obj16/entity"; //$NON-NLS-1$
+
+ public static final String EMBEDDABLE = "full/obj16/embeddable"; //$NON-NLS-1$
+
+ public static final String MAPPED_SUPERCLASS = "full/obj16/mapped-superclass"; //$NON-NLS-1$
+
+ public static final String NULL_TYPE_MAPPING = "full/obj16/null-type-mapping"; //$NON-NLS-1$
+
+ public static final String BASIC = "full/obj16/basic"; //$NON-NLS-1$
+
+ public static final String VERSION = "full/obj16/version"; //$NON-NLS-1$
+
+ public static final String ID = "full/obj16/id"; //$NON-NLS-1$
+
+ public static final String EMBEDDED_ID = "full/obj16/embedded-id"; //$NON-NLS-1$
+
+ public static final String EMBEDDED = "full/obj16/embedded"; //$NON-NLS-1$
+
+ public static final String ONE_TO_ONE = "full/obj16/one-to-one"; //$NON-NLS-1$
+
+ public static final String ONE_TO_MANY = "full/obj16/one-to-many"; //$NON-NLS-1$
+
+ public static final String MANY_TO_ONE = "full/obj16/many-to-one"; //$NON-NLS-1$
+
+ public static final String MANY_TO_MANY = "full/obj16/many-to-many"; //$NON-NLS-1$
+
+ public static final String TRANSIENT = "full/obj16/transient"; //$NON-NLS-1$
+
+ public static final String NULL_ATTRIBUTE_MAPPING = "full/obj16/null-attribute-mapping"; //$NON-NLS-1$
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiMessages.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiMessages.java
index cdc142e820..95ed06f070 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiMessages.java
@@ -1,151 +1,102 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 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.
- *
+ * Copyright (c) 2006, 2008 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.ui.internal;
import org.eclipse.osgi.util.NLS;
-public class JptUiMessages extends NLS
-{
- private static final String BUNDLE_NAME = "jpt_ui"; //$NON-NLS-1$
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, JptUiMessages.class);
- }
-
- public static String AddPersistentAttributeDialog_title;
-
+/**
+ * The resource strings used by the JPT UI classes.
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+@SuppressWarnings("nls")
+public class JptUiMessages extends NLS
+{
+ private static final String BUNDLE_NAME = "jpt_ui";
+
public static String AddPersistentAttributeDialog_attributeLabel;
-
public static String AddPersistentAttributeDialog_mappingLabel;
-
public static String AddPersistentAttributeDialog_noMappingKeyError;
-
- public static String AddPersistentClassDialog_title;
-
- public static String AddPersistentClassDialog_classLabel;
-
- public static String AddPersistentClassDialog_classDialog_title;
-
+ public static String AddPersistentAttributeDialog_title;
public static String AddPersistentClassDialog_classDialog_message;
-
+ public static String AddPersistentClassDialog_classDialog_title;
+ public static String AddPersistentClassDialog_classLabel;
+ public static String AddPersistentClassDialog_classNotFoundWarning;
+ public static String AddPersistentClassDialog_duplicateClassWarning;
public static String AddPersistentClassDialog_mappingLabel;
-
public static String AddPersistentClassDialog_noClassError;
-
- public static String AddPersistentClassDialog_duplicateClassWarning;
-
- public static String AddPersistentClassDialog_classNotFoundWarning;
-
public static String AddPersistentClassDialog_noMappingKeyError;
-
+ public static String AddPersistentClassDialog_title;
+ public static String AddRemovePane_AddButtonText;
+ public static String AddRemovePane_RemoveButtonText;
+ public static String DatabaseReconnectWizardPage_addConnectionLink;
+ public static String DatabaseReconnectWizardPage_connection;
public static String DatabaseReconnectWizardPage_database;
-
public static String DatabaseReconnectWizardPage_databaseConnection;
-
+ public static String DatabaseReconnectWizardPage_reconnectLink;
public static String DatabaseReconnectWizardPage_reconnectToDatabase;
-
- public static String DatabaseReconnectWizardPage_connection;
-
public static String DatabaseReconnectWizardPage_schema;
-
public static String DatabaseReconnectWizardPage_schemaInfo;
-
- public static String DatabaseReconnectWizardPage_addConnectionLink;
-
- public static String DatabaseReconnectWizardPage_reconnectLink;
-
+ public static String EnumComboViewer_default;
+ public static String EnumComboViewer_defaultWithDefault;
public static String General_browse;
-
public static String General_deselectAll;
-
public static String General_selectAll;
-
public static String GenerateEntitiesWizard_generateEntities;
-
public static String GenerateEntitiesWizardPage_chooseEntityTable;
-
+ public static String GenerateEntitiesWizardPage_entityNameColumn;
public static String GenerateEntitiesWizardPage_generateEntities;
-
public static String GenerateEntitiesWizardPage_synchronizeClasses;
-
- public static String GenerateEntitiesWizardPage_tables;
-
public static String GenerateEntitiesWizardPage_tableColumn;
-
- public static String GenerateEntitiesWizardPage_entityNameColumn;
-
- public static String GenericPlatformUiDialog_notSupportedMessageTitle;
-
+ public static String GenerateEntitiesWizardPage_tables;
public static String GenericPlatformUiDialog_notSupportedMessageText;
-
- public static String JpaPreferencePage_defaultJpaLib;
-
- public static String JpaPreferencePage_userLibsLink;
-
- public static String JpaPreferencePage_invalidJpaLib;
-
- public static String JpaStructureView_viewNotAvailable;
-
- public static String JpaStructureView_linkWithEditorText;
-
- public static String JpaStructureView_linkWithEditorDesc;
-
- public static String JpaStructureView_linkWithEditorTooltip;
-
+ public static String GenericPlatformUiDialog_notSupportedMessageTitle;
public static String JpaDetailsView_viewNotAvailable;
-
- public static String NewJpaProjectWizard_title;
-
- public static String NewJpaProjectWizard_firstPage_title;
-
- public static String NewJpaProjectWizard_firstPage_description;
-
- public static String JpaFacetWizardPage_title;
-
- public static String JpaFacetWizardPage_description;
-
- public static String JpaFacetWizardPage_platformLabel;
-
public static String JpaFacetWizardPage_connectionLabel;
-
public static String JpaFacetWizardPage_connectionLink;
-
+ public static String JpaFacetWizardPage_createOrmXmlButton;
+ public static String JpaFacetWizardPage_description;
+ public static String JpaFacetWizardPage_discoverClassesButton;
public static String JpaFacetWizardPage_jpaImplementationLabel;
-
- public static String JpaFacetWizardPage_userServerLibLabel;
-
- public static String JpaFacetWizardPage_specifyLibLabel;
-
public static String JpaFacetWizardPage_jpaPrefsLink;
-
- public static String JpaFacetWizardPage_userLibsLink;
-
- public static String JpaFacetWizardPage_persistentClassManagementLabel;
-
- public static String JpaFacetWizardPage_discoverClassesButton;
-
public static String JpaFacetWizardPage_listClassesButton;
-
- public static String JpaFacetWizardPage_createOrmXmlButton;
-
+ public static String JpaFacetWizardPage_persistentClassManagementLabel;
+ public static String JpaFacetWizardPage_platformLabel;
+ public static String JpaFacetWizardPage_specifyLibLabel;
+ public static String JpaFacetWizardPage_title;
+ public static String JpaFacetWizardPage_userLibsLink;
+ public static String JpaFacetWizardPage_userServerLibLabel;
+ public static String JpaPreferencePage_defaultJpaLib;
+ public static String JpaPreferencePage_invalidJpaLib;
+ public static String JpaPreferencePage_userLibsLink;
+ public static String JpaStructureView_linkWithEditorDesc;
+ public static String JpaStructureView_linkWithEditorText;
+ public static String JpaStructureView_linkWithEditorTooltip;
+ public static String JpaStructureView_structureNotAvailable;
+ public static String NewJpaProjectWizard_firstPage_description;
+ public static String NewJpaProjectWizard_firstPage_title;
+ public static String NewJpaProjectWizard_title;
+ public static String OrmItemLabelProviderFactory_entityMappingsLabel;
+ public static String OverwriteConfirmerDialog_text;
+ public static String OverwriteConfirmerDialog_title;
+ public static String PersistenceItemLabelProviderFactory_persistenceLabel;
public static String PersistentAttributePage_mapAs;
-
public static String PersistentTypePage_mapAs;
-
- public static String OverwriteConfirmerDialog_title;
- public static String OverwriteConfirmerDialog_text;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, JptUiMessages.class);
+ }
-
private JptUiMessages() {
throw new UnsupportedOperationException();
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiPlugin.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiPlugin.java
index 77e697c5d8..693b62143c 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiPlugin.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiPlugin.java
@@ -11,6 +11,9 @@ package org.eclipse.jpt.ui.internal;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jpt.core.internal.IJpaPlatform;
+import org.eclipse.jpt.ui.internal.platform.JpaPlatformUiRegistry;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.plugin.AbstractUIPlugin;
public class JptUiPlugin extends AbstractUIPlugin
@@ -43,15 +46,12 @@ public class JptUiPlugin extends AbstractUIPlugin
}
- public JptUiPlugin() {
- super();
- INSTANCE = this;
- }
+ // **************** Image API **********************************************
/**
* This gets a .gif from the icons folder.
*/
- public ImageDescriptor getImageDescriptor(String key) {
+ public static ImageDescriptor getImageDescriptor(String key) {
if (! key.startsWith("icons/")) {
key = "icons/" + key;
}
@@ -60,4 +60,28 @@ public class JptUiPlugin extends AbstractUIPlugin
}
return imageDescriptorFromPlugin(PLUGIN_ID, key);
}
+
+ /**
+ * This returns an image for a .gif from the icons folder
+ */
+ public static Image getImage(String key) {
+ ImageDescriptor desc = getImageDescriptor(key);
+ return (desc == null) ? null : desc.createImage();
+ }
+
+
+ // **************** Construction *******************************************
+
+ public JptUiPlugin() {
+ super();
+ INSTANCE = this;
+ }
+
+
+ /**
+ * Return the JPA platform UI corresponding to the given JPA platform
+ */
+ public IJpaPlatformUi jpaPlatformUi(IJpaPlatform jpaPlatform) {
+ return JpaPlatformUiRegistry.instance().jpaPlatform(jpaPlatform.getId());
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/Tracing.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/Tracing.java
new file mode 100644
index 0000000000..4589e13b95
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/Tracing.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal;
+
+import org.eclipse.core.runtime.Platform;
+
+/**
+ * This tracing class manages to convert the string value into boolean values or
+ * integer values that are associated with the tracing debug flags. Those flags
+ * are specified in the .options file. The supported keys are defined here as
+ * constants for quick reference.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public final class Tracing
+{
+ /**
+ * A constant used to retrieve the value associated with "/debug".
+ */
+ public static final String DEBUG = "/debug";
+
+ /**
+ * A constant used to retrieve the value associated with "/debug/ui/db".
+ */
+ public static final String UI_DB = "/debug/ui/db";
+
+ /**
+ * A constant used to retrieve the value associated with "/debug/ui/detailsView".
+ */
+ public static final String UI_DETAILS_VIEW = "/debug/ui/detailsView";
+
+ /**
+ * A constant used to retrieve the value associated with "/debug/ui/layout".
+ */
+ public static final String UI_LAYOUT = "/debug/ui/layout";
+
+ /**
+ * A constant used to retrieve the value associated with "/unit-tests".
+ */
+ public static final String UNIT_TESTS = "/unit-tests";
+
+ /**
+ * Can't instantiate this <code>Tracing</code> class.
+ */
+ private Tracing()
+ {
+ super();
+ throw new UnsupportedOperationException("Tracing cannot be instantiated");
+ }
+
+ /**
+ * Retrieves the debug value associated with the given flag. The default
+ * value is <code>false</code>.
+ *
+ * @param flag The flag to retrieve the debug value, which should be
+ * contained in the .options file, the flag should start with "/"
+ * @return <code>true</code> if the given flag is active; <code>false</code>
+ * otherwise
+ */
+ public static boolean booleanDebugOption(String flag)
+ {
+ return booleanDebugOption(flag, false);
+ }
+
+ /**
+ * Retrieves the debug value associated with the given flag.
+ *
+ * @param flag The flag to retrieve the debug value, which should be
+ * contained in the .options file, the flag should start with "/"
+ * @param defaultValue The default value if the value associated with the
+ * given flag could not be found
+ * @return <code>true</code> if the given flag is active; <code>false</code>
+ * otherwise
+ */
+ public static boolean booleanDebugOption(String flag, boolean defaultValue)
+ {
+ String result = Platform.getDebugOption(JptUiPlugin.PLUGIN_ID + flag);
+
+ if (result == null)
+ {
+ return defaultValue;
+ }
+
+ return Boolean.valueOf(result.trim());
+ }
+
+ /**
+ * Retrieves the debug value associated with the given flag. The default value
+ * is 0.
+ *
+ * @param flag The flag to retrieve the debug value, which should be
+ * contained in the .options file, the flag should start with "/"
+ * @return The value associated with the given flag, or the given default
+ * value
+ */
+ public static int intDebugOption(String flag)
+ {
+ return intDebugOption(flag, 0);
+ }
+
+ /**
+ * Retrieves the debug value associated with the given flag.
+ *
+ * @param flag The flag to retrieve the debug value, which should be
+ * contained in the .options file, the flag should start with "/"
+ * @param defaultValue The default value if the value associated with the
+ * given flag could not be found
+ * @return The value associated with the given flag, or the given default
+ * value
+ */
+ public static int intDebugOption(String flag, int defaultValue)
+ {
+ String result = Platform.getDebugOption(JptUiPlugin.PLUGIN_ID + flag);
+
+ if (result == null)
+ {
+ return defaultValue;
+ }
+
+ return Integer.valueOf(result);
+ }
+
+ /**
+ * Logs the given messages, appends it with this plug-in id.
+ *
+ * @param message The message to be logged
+ */
+ public static void log(String message)
+ {
+ System.out.print("[" + JptUiPlugin.PLUGIN_ID + "] ");
+ System.out.println(message);
+ }
+
+ /**
+ * Retrieves the debug value associated with the given flag. The default value
+ * is an empty string.
+ *
+ * @param flag The flag to retrieve the debug value, which should be
+ * contained in the .options file, the flag should start with "/"
+ * @return The value associated with the given flag, or the given default
+ * value
+ */
+ public static String stringDebugOption(String flag)
+ {
+ return stringDebugOption(flag, "");
+ }
+
+ /**
+ * Retrieves the debug value associated with the given flag.
+ *
+ * @param flag The flag to retrieve the debug value, which should be
+ * contained in the .options file, the flag should start with "/"
+ * @param defaultValue The default value if the value associated with the
+ * given flag could not be found
+ * @return The value associated with the given flag, or the given default
+ * value
+ */
+ public static String stringDebugOption(String flag, String defaultValue)
+ {
+ String result = Platform.getDebugOption(JptUiPlugin.PLUGIN_ID + flag);
+
+ if (result == null)
+ {
+ result = defaultValue;
+ }
+
+ return result;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAction.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAction.java
index f38efd98b4..4a26ae0b84 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAction.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAction.java
@@ -13,7 +13,7 @@ import java.util.Iterator;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
import org.eclipse.ui.actions.ActionDelegate;
public class AddPersistentAttributeToXmlAction extends ActionDelegate
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAndMapAction.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAndMapAction.java
index f8ee7458a8..2a7377678e 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAndMapAction.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentAttributeToXmlAndMapAction.java
@@ -12,7 +12,7 @@ package org.eclipse.jpt.ui.internal.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
import org.eclipse.jpt.ui.internal.dialogs.AddPersistentAttributeToXmlAndMapDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IObjectActionDelegate;
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentClassAction.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentClassAction.java
index 23b4deba52..79328635fa 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentClassAction.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/AddPersistentClassAction.java
@@ -13,7 +13,7 @@ package org.eclipse.jpt.ui.internal.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
+import org.eclipse.jpt.core.internal.context.orm.EntityMappings;
import org.eclipse.jpt.ui.internal.dialogs.AddPersistentClassDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IObjectActionDelegate;
@@ -24,7 +24,7 @@ public class AddPersistentClassAction
{
private Shell shell;
- private EntityMappingsInternal entityMappings;
+ private EntityMappings entityMappings;
public AddPersistentClassAction() {
@@ -40,10 +40,10 @@ public class AddPersistentClassAction
}
public void selectionChanged(IAction action, ISelection selection) {
- entityMappings = (EntityMappingsInternal) ((StructuredSelection) selection).getFirstElement();
+ this.entityMappings = (EntityMappings) ((StructuredSelection) selection).getFirstElement();
}
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- shell = targetPart.getSite().getShell();
+ this.shell = targetPart.getSite().getShell();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/PersistentAttributeActionFilter.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/PersistentAttributeActionFilter.java
index 243055089e..8a61c71abc 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/PersistentAttributeActionFilter.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/PersistentAttributeActionFilter.java
@@ -11,7 +11,7 @@ package org.eclipse.jpt.ui.internal.actions;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
import org.eclipse.ui.IActionFilter;
public class PersistentAttributeActionFilter
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/ProjectAction.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/ProjectAction.java
index 96bd1d9ff6..8189b0b7b4 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/ProjectAction.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/ProjectAction.java
@@ -18,7 +18,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jpt.core.internal.IJpaProject;
import org.eclipse.jpt.core.internal.JptCorePlugin;
import org.eclipse.jpt.ui.internal.IJpaPlatformUi;
-import org.eclipse.jpt.ui.internal.PlatformRegistry;
+import org.eclipse.jpt.ui.internal.platform.JpaPlatformUiRegistry;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
@@ -76,7 +76,7 @@ public abstract class ProjectAction implements IObjectActionDelegate {
protected IJpaPlatformUi jpaPlatformUi(IJpaProject project) {
String coreJpaPlatformId = project.jpaPlatform().getId();
- return PlatformRegistry.instance().jpaPlatform(coreJpaPlatformId);
+ return JpaPlatformUiRegistry.instance().jpaPlatform(coreJpaPlatformId);
}
protected void execute(IProject project) {
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentAttributeFromXmlAction.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentAttributeFromXmlAction.java
index 849f0eacd0..6a074289ad 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentAttributeFromXmlAction.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentAttributeFromXmlAction.java
@@ -13,8 +13,7 @@ import java.util.Iterator;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
import org.eclipse.ui.actions.ActionDelegate;
public class RemovePersistentAttributeFromXmlAction extends ActionDelegate
@@ -32,8 +31,7 @@ public class RemovePersistentAttributeFromXmlAction extends ActionDelegate
if (this.selection instanceof StructuredSelection) {
for (Iterator<XmlPersistentAttribute> i = ((StructuredSelection) selection).iterator(); i.hasNext(); ) {
XmlPersistentAttribute xmlPersistentAttribute = i.next();
- XmlPersistentType xmlPersistentType = xmlPersistentAttribute.typeMapping().getPersistentType();
- xmlPersistentType.getSpecifiedAttributeMappings().remove(xmlPersistentAttribute.getMapping());
+ xmlPersistentAttribute.setVirtual(true);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentClassAction.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentClassAction.java
index 3d8a55a236..2ca72027cd 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentClassAction.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/RemovePersistentClassAction.java
@@ -13,16 +13,14 @@ package org.eclipse.jpt.ui.internal.actions;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentType;
-import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
public class RemovePersistentClassAction
implements IObjectActionDelegate
{
- private XmlPersistentType persistentClass;
+ private XmlPersistentType persistentType;
public RemovePersistentClassAction() {
@@ -30,12 +28,11 @@ public class RemovePersistentClassAction
}
public void run(IAction action) {
- XmlTypeMapping mapping = persistentClass.getMapping();
- ((EntityMappingsInternal) mapping.getEntityMappings()).getTypeMappings().remove(mapping);
+ this.persistentType.entityMappings().removeXmlPersistentType(this.persistentType);
}
public void selectionChanged(IAction action, ISelection selection) {
- persistentClass = (XmlPersistentType) ((StructuredSelection) selection).getFirstElement();
+ this.persistentType = (XmlPersistentType) ((StructuredSelection) selection).getFirstElement();
}
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/XmlPersistentAttributeActionFilter.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/XmlPersistentAttributeActionFilter.java
index 736953be85..084bf44654 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/XmlPersistentAttributeActionFilter.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/actions/XmlPersistentAttributeActionFilter.java
@@ -10,7 +10,7 @@
package org.eclipse.jpt.ui.internal.actions;
import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
import org.eclipse.ui.IActionFilter;
public class XmlPersistentAttributeActionFilter
@@ -19,6 +19,7 @@ public class XmlPersistentAttributeActionFilter
public static final String IS_VIRTUAL = "isVirtual";
+ @Override
public boolean testAttribute(Object target, String name, String value) {
if (! IS_VIRTUAL.equals(name)) {
return super.testAttribute(target, name, value);
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaComposite.java
index 6c3ff8ba80..a53cfa156d 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaComposite.java
@@ -3,45 +3,94 @@
* 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.ui.internal.details;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.swt.SWT;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.node.Node;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public abstract class BaseJpaComposite extends BaseJpaController
- implements IJpaComposite
+/**
+ * @deprecated Extend directly BaseJpaController, this pane will go away the
+ * moment I have a sec. ~PF
+ */
+@Deprecated
+public abstract class BaseJpaComposite<T extends Node> extends BaseJpaController<T>
{
- private Composite composite;
-
- public BaseJpaComposite(Composite parent, int style, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, style, theCommandStack, widgetFactory);
+ /**
+ * Creates a new <code>BaseJpaComposite</code>.
+ *
+ * @param parentController The parent container of this one
+ * @param parent The parent container
+ */
+ protected BaseJpaComposite(BaseJpaController<? extends T> parentController,
+ Composite parent) {
+
+ super(parentController, parent);
}
-
- public BaseJpaComposite(Composite parent, CommandStack theCommandStack,TabbedPropertySheetWidgetFactory widgetFactory) {
- this(parent, SWT.NULL, theCommandStack, widgetFactory);
+
+ /**
+ * Creates a new <code>BaseJpaComposite</code>.
+ *
+ * @param parentController The parent container of this one
+ * @param parent The parent container
+ * @param automaticallyAlignWidgets <code>true</code> to make the widgets
+ * this pane aligned with the widgets of the given parent controller;
+ * <code>false</code> to not align them
+ */
+ protected BaseJpaComposite(BaseJpaController<? extends T> parentController,
+ Composite parent,
+ boolean automaticallyAlignWidgets) {
+
+ super(parentController, parent, automaticallyAlignWidgets);
}
-
- @Override
- protected void buildWidget(Composite parent, int style) {
- super.buildWidget(parent);
- this.composite = createComposite(parent, style);
- initializeLayout(this.composite);
+
+ /**
+ * Creates a new <code>BaseJpaComposite</code>.
+ *
+ * @param parentController The parent container of this one
+ * @param subjectHolder The holder of the subject
+ * @param parent The parent container
+ */
+ protected BaseJpaComposite(BaseJpaController<?> parentController,
+ PropertyValueModel<? extends T> subjectHolder,
+ Composite parent) {
+
+ super(parentController, subjectHolder, parent);
}
-
- protected Composite createComposite(Composite parent, int style) {
- return this.widgetFactory.createComposite(parent, style);
+
+ /**
+ * Creates a new <code>BaseJpaComposite</code>.
+ *
+ * @param parentController The parent container of this one
+ * @param subjectHolder The holder of the subject
+ * @param parent The parent container
+ * @param automaticallyAlignWidgets <code>true</code> to make the widgets
+ * this pane aligned with the widgets of the given parent controller;
+ * <code>false</code> to not align them
+ */
+ protected BaseJpaComposite(BaseJpaController<?> parentController,
+ PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ boolean automaticallyAlignWidgets) {
+
+ super(parentController, subjectHolder, parent, automaticallyAlignWidgets);
}
-
- protected abstract void initializeLayout(Composite composite);
- public Control getControl() {
- return this.composite;
+ /**
+ * Creates a new <code>BaseJpaComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ protected BaseJpaComposite(PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
}
-
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaController.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaController.java
index 84ac1dca1b..0806931ac4 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaController.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaController.java
@@ -1,110 +1,114 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2006, 2008 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.ui.internal.details;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.Model;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public abstract class BaseJpaController
+/**
+ * The abstract class used to create a pane. (TODO)
+ *
+ * @deprecated Remove this pane and extend directly AbstractFormPane.
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+@Deprecated
+public abstract class BaseJpaController<T extends Model> extends AbstractFormPane<T>
+ implements IJpaComposite<T>
{
- //****** we are using this commandStack in 0 places ********
- //do we plan to use it in the future? *should* we be using it? are we removing emf?
- protected CommandStack commandStack;
-
- protected TabbedPropertySheetWidgetFactory widgetFactory;
+ /**
+ * Creates a new <code>BaseJpaController</code>.
+ *
+ * @param parentController The parent controller of this one
+ * @param parent The parent container
+ *
+ * @category Constructor
+ */
+ protected BaseJpaController(BaseJpaController<? extends T> parentController,
+ Composite parent) {
- //put in the populating flag to stop the circular population of the entity name combo
- //populateEntityNameCombo is calling select() which causes entityNameComboModified() to be called
- //this sets the name in the model which starts the circle over again. We should probably
- //short-circuit this differently, like in the emf model, keep the property change from being fired if
- //a change did not actually occur - KFM
- private boolean populating;
-
-
- public BaseJpaController(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super();
- this.widgetFactory = widgetFactory;
- buildWidget(parent);
- this.commandStack = theCommandStack;
+ super(parentController, parent);
}
-
- public BaseJpaController(Composite parent, int style, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super();
- this.widgetFactory = widgetFactory;
- buildWidget(parent, style);
- this.commandStack = theCommandStack;
- }
-
-
+
/**
- * Override this method if using the constructor without the style bit
+ * Creates a new <code>BaseJpaController</code>.
+ *
+ * @param parentController The parent container of this one
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various widgets
+ * @param automaticallyAlignWidgets <code>true</code> to make the widgets
+ * this pane aligned with the widgets of the given parent controller;
+ * <code>false</code> to not align them
+ *
+ * @category Constructor
*/
- protected void buildWidget(Composite parent) {
- // no op
+ protected BaseJpaController(BaseJpaController<? extends T> parentController,
+ Composite parent,
+ boolean automaticallyAlignWidgets) {
+
+ super(parentController, parent, automaticallyAlignWidgets);
}
-
+
/**
- * Override this method if using the constructor with the style bit
+ * Creates a new <code>BaseJpaController</code>.
+ *
+ * @param parentController The parent container of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ *
+ * @category Constructor
*/
- protected void buildWidget(Composite parent, int style) {
- // no op
+ protected BaseJpaController(BaseJpaController<?> parentController,
+ PropertyValueModel<? extends T> subjectHolder,
+ Composite parent) {
+
+ super(parentController, subjectHolder, parent);
}
-
+
/**
- * This method is called from outside when setting the object of interest
+ * Creates a new <code>BaseJpaController</code>.
+ *
+ * @param parentController The parent container of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various widgets
+ * @param automaticallyAlignWidgets <code>true</code> to make the widgets
+ * this pane aligned with the widgets of the given parent controller;
+ * <code>false</code> to not align them
+ *
+ * @category Constructor
*/
- public final void populate(EObject obj) {
- if (getControl().isDisposed()) {
- return;
- }
- this.populating = true;
- disengageListeners();
- doPopulate(obj);
- engageListeners();
- this.populating = false;
+ protected BaseJpaController(BaseJpaController<?> parentController,
+ PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ boolean automaticallyAlignWidgets) {
+
+ super(parentController, subjectHolder, parent, automaticallyAlignWidgets);
}
-
+
/**
- * This method is called (perhaps internally) when this needs to repopulate
- * but the object of interest has not changed
+ * Creates a new <code>BaseJpaController</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ *
+ * @category Constructor
*/
- public final void populate() {
- if (getControl().isDisposed()) {
- return;
- }
- this.populating = true;
- doPopulate();
- this.populating = false;
- }
-
- protected abstract void doPopulate(EObject obj);
-
- protected abstract void doPopulate();
-
- protected abstract void engageListeners();
-
- protected abstract void disengageListeners();
-
- protected boolean isPopulating() {
- return this.populating;
- }
-
- public TabbedPropertySheetWidgetFactory getWidgetFactory() {
- return this.widgetFactory;
- }
-
- public void dispose() {
- disengageListeners();
+ protected BaseJpaController(PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
}
-
- public abstract Control getControl();
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaDetailsPage.java
index d57e13f02a..86154fc78a 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/BaseJpaDetailsPage.java
@@ -1,63 +1,56 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2006, 2008 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.ui.internal.details;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public abstract class BaseJpaDetailsPage extends BaseJpaComposite
- implements IJpaDetailsPage
+/**
+ * The base class for the details view.
+ *
+ * @see IJpaContextNode
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public abstract class BaseJpaDetailsPage<T extends IJpaContextNode>
+ extends AbstractFormPane<T>
+ implements IJpaDetailsPage<T>
{
- private Composite control;
+ /**
+ * Creates a new <code>BaseJpaDetailsPage</code>.
+ *
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ protected BaseJpaDetailsPage(Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
- public BaseJpaDetailsPage(
- Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
+ super(new SimplePropertyValueModel<T>(), parent, widgetFactory);
}
- public BaseJpaDetailsPage(
- Composite parent, int style, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, style, theCommandStack, widgetFactory);
- }
-
- @Override
- //using this to get a Scroll bar on the JpaDetailsView
- protected Composite createComposite(Composite parent, int style) {
- ScrolledForm scrolledForm = this.widgetFactory.createScrolledForm(parent);
- //Nesting another composite because combos on the ScrolledForm didn't have a border
- scrolledForm.getBody().setLayout(new FillLayout());
- Composite composite = super.createComposite(scrolledForm.getBody(), style);
- this.control = scrolledForm;
- return composite;
- }
+ /*
+ * (non-Javadoc)
+ */
+ public final void setSubject(T subject) {
+ WritablePropertyValueModel<T> subjectHolder = (WritablePropertyValueModel<T>) getSubjectHolder();
+ subjectHolder.setValue(subject);
- public final void populate(IJpaContentNode contentNode) {
- super.populate(contentNode);
- }
-
- @Override
- protected final void doPopulate(EObject obj) {
- doPopulate((IJpaContentNode) obj);
+ if (subject != null) {
+ populate();
+ }
+ else {
+ dispose();
+ }
}
-
- protected abstract void doPopulate(IJpaContentNode contentNode);
-
-
- @Override
- public Control getControl() {
- return this.control;
- }
-
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaComposite.java
index bd09fed9d7..80eb8d52fd 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaComposite.java
@@ -1,22 +1,38 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2005, 2008 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.ui.internal.details;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.swt.widgets.Control;
+/**
+ * A <code>IJpaComposite</code> defines the common behavior of the JPA related
+ * widgets.
+ */
+public interface IJpaComposite<T> {
-public interface IJpaComposite<E extends EObject> {
+ /**
+ * Notifies this composite it should populates its widgets using the given
+ * model object.
+ *
+ * @param model The model used to retrieve the information to be displayed
+ */
+ void populate();
- void populate(E model);
-
+ /**
+ * Returns the actual <code>Composite</code>.
+ *
+ * @return This composite's actual widget
+ */
Control getControl();
-
+
+ /**
+ * Notifies this composite it should dispose any resources.
+ */
void dispose();
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsPage.java
index ae78d2fc38..a370d5e440 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsPage.java
@@ -1,28 +1,39 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2006, 2008 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.ui.internal.details;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
import org.eclipse.swt.widgets.Control;
-public interface IJpaDetailsPage
+/**
+ * A details page is used to show the propery pane for a given context node. The
+ * <code>IJpaDetailsProvider</code> is responsible for creating the pane.
+ *
+ * @see IJpaDetailsProvider
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface IJpaDetailsPage<T extends IJpaContextNode>
{
- Control getControl();
-
/**
- * Set the content for the page and populate widgets
+ * Returns this details' page's widget.
+ *
+ * @return The container of the widgets shown by this details page
*/
- void populate(IJpaContentNode contentNode);
-
-
+ Control getControl();
+
/**
- * Perform any other disposal needed
+ * Sets the subject for this details page.
+ *
+ * @param subject Either the new subject or <code>null</code> if the subject
+ * needs to be removed
*/
- void dispose();
-}
+ void setSubject(T subject);
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsProvider.java
index aab2f6f721..e125c62fcd 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/IJpaDetailsProvider.java
@@ -1,27 +1,38 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2006, 2008 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.ui.internal.details;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public interface IJpaDetailsProvider
+/**
+ * This provider is responsible to create the <code>IJpaDetailsPage</code>
+ * responsible to show the information for a given content node id.
+ *
+ * @see IJpaDetailsPage
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface IJpaDetailsProvider
{
-
- String fileContentType();
-
/**
- * Build a properties page given the parent Composite and the
- * content node id.
- * It is legal to set the layout for the given Composite.
+ * Creates a new details page based on the given content node id.
+ *
+ * @param parent The parent container
+ * @param contentNodeId The unique identifier used to determine which details
+ * page to create
+ * @param widgetFactory The factory used to create various widgets
*/
- IJpaDetailsPage buildDetailsPage(Composite parentComposite, Object contentNodeId, TabbedPropertySheetWidgetFactory widgetFactory);
-
- void dispose();
-}
+ IJpaDetailsPage<? extends IJpaContextNode> buildDetailsPage(
+ Composite parent,
+ Object contentNodeId,
+ TabbedPropertySheetWidgetFactory widgetFactory);
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PageBookManager.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PageBookManager.java
index 80c583ba2c..993b8f88f4 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PageBookManager.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PageBookManager.java
@@ -3,14 +3,12 @@
* 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: Versant. - initial API and implementation
******************************************************************************/
package org.eclipse.jpt.ui.internal.details;
-import java.util.Collection;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
@@ -23,30 +21,30 @@ import org.eclipse.ui.part.PageBook;
*/
public class PageBookManager extends PageBook {
- private Map pageRecords;
+ private Map<Object, Composite> pageRecords;
private Object active;
private PageBook pageBook;
private Composite defaultComposite;
-
+
/**
* A <code>PageBookManager<code> is a wrapper for a <code>PageBook</code>. It provides
* convenience methods to add, remove, activate and inactive pages in the internal <code>PageBook</code>.
* If a page gets deactivated, the manager activates a default page.
- *
+ *
* @param parent The parent composite to this manager
* @param aDefaultLabel The label on the the default page.
*/
public PageBookManager(Composite parent, String aDefaultLabel) {
super(parent, SWT.NULL);
this.setLayout(new FillLayout());
- this.pageRecords = new HashMap();
+ this.pageRecords = new HashMap<Object, Composite>();
this.pageBook = new PageBook(this, SWT.NONE);
this.defaultComposite = new DefaultComposite(pageBook, aDefaultLabel);
this.pageBook.showPage(this.defaultComposite);
}
/**
- * @param anObj Activates (flips to top in the <code>PageBook</code>) the associated <code>Composite</code>
+ * @param anObj Activates (flips to top in the <code>PageBook</code>) the associated <code>Composite</code>
* for the given <code>Object</code>. Activates the <code>DefaultComposite</code> if there is no association
* for the given <code>Object</code>.
* @return Return false if there is no <code>Composite</code> association to the given <code>Object</code> or
@@ -54,7 +52,7 @@ public class PageBookManager extends PageBook {
*/
public boolean activate(Object anObj) {
if(anObj != null && !anObj.equals(this.active) && this.pageRecords.containsKey(anObj)) {
- Composite composite = (Composite) this.pageRecords.get(anObj);
+ Composite composite = this.pageRecords.get(anObj);
this.pageBook.showPage(composite);
this.active = anObj;
return true;
@@ -64,7 +62,7 @@ public class PageBookManager extends PageBook {
}
return false;
}
-
+
/**
* @param anObj
* @return Returns true if the associated <code>Composite</code> has been deactivated.
@@ -86,19 +84,19 @@ public class PageBookManager extends PageBook {
* in this <code>PageBookManager</code>.
* If this manager previously contained a mapping for the <code>Object</code>, the old
* <code>Composite</code> is replaced by the specified <code>Composite</code>.
- *
+ *
* @param anObj <code>Object</code> with which the specified <code>Composite</code> is to be associated.
* @param aComposite <code>Composite</code> to be associated with the specified <code>Object</code>.
- *
+ *
* @return previous <code>Composite</code> associated with specified <code>Object</code>,
* or <tt>null</tt> if there was no mapping for <code>Object</code>.
*/
public Composite put(Object anObj, Composite aComposite) {
- Composite composite = (Composite) this.pageRecords.put(anObj, aComposite);
+ Composite composite = this.pageRecords.put(anObj, aComposite);
this.activate(anObj);
return composite;
}
-
+
/**
* Removes the mapping for this <code>Object</code> from this pagebookmanager if it is present.
*
@@ -109,8 +107,8 @@ public class PageBookManager extends PageBook {
if(anObj.equals(this.active)) {
this.active = null;
this.pageBook.showPage(this.defaultComposite);
- }
- return (Composite) this.pageRecords.remove(anObj);
+ }
+ return this.pageRecords.remove(anObj);
}
/**
@@ -121,9 +119,9 @@ public class PageBookManager extends PageBook {
public boolean contains(Object anObj) {
return this.pageRecords.containsKey(anObj);
}
-
+
public Composite get(Object key) {
- return (Composite) pageRecords.get(key);
+ return pageRecords.get(key);
}
/**
@@ -133,12 +131,12 @@ public class PageBookManager extends PageBook {
if(this.active == null) {
return this.defaultComposite;
} else {
- return (Composite) this.pageRecords.get(this.active);
+ return this.pageRecords.get(this.active);
}
}
/**
- * @return The internal <code>PageBook</code> of this <code>PageBookManager</code>.
+ * @return The internal <code>PageBook</code> of this <code>PageBookManager</code>.
* <code>Composite</code>s which should work with this manager needs to be created
* with this <code>Composite</code> as their parent composite.
*/
@@ -156,12 +154,12 @@ public class PageBookManager extends PageBook {
label.setText(aDefaultLabel);
}
}
-
+
+ @Override
public void dispose() {
super.dispose();
- Collection composites = this.pageRecords.values();
- for (Iterator i = composites.iterator(); i.hasNext(); ) {
- ((Composite) i.next()).dispose();
+ for (Composite pane : this.pageRecords.values()) {
+ pane.dispose();
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentAttributeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentAttributeDetailsPage.java
index 870e35677c..0505cd01a3 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentAttributeDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentAttributeDetailsPage.java
@@ -1,22 +1,18 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.ui.internal.details;
+import java.util.Collection;
import java.util.HashMap;
import java.util.ListIterator;
import java.util.Map;
-
-import org.eclipse.emf.common.command.BasicCommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.IContentProvider;
@@ -26,276 +22,365 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
import org.eclipse.jpt.ui.internal.IJpaPlatformUi;
import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.PlatformRegistry;
+import org.eclipse.jpt.ui.internal.JptUiPlugin;
+import org.eclipse.jpt.ui.internal.Tracing;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
+import org.eclipse.jpt.ui.internal.platform.JpaPlatformUiRegistry;
+import org.eclipse.jpt.ui.internal.platform.base.BaseJpaPlatformUi;
import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.model.value.FilteringPropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public abstract class PersistentAttributeDetailsPage extends BaseJpaDetailsPage
+/**
+ * The abstract definition of the details page responsible to show the
+ * information for an persistent attribute.
+ *
+ * @see IPersistentAttribute
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+@SuppressWarnings("nls")
+public abstract class PersistentAttributeDetailsPage<T extends IPersistentAttribute> extends BaseJpaDetailsPage<T>
{
- private IPersistentAttribute attribute;
- private IAttributeMapping attributeMapping;
- private Adapter persistentAttributeListener;
-
+ private IJpaComposite<IAttributeMapping> currentMappingComposite;
private String currentMappingKey;
-
private ComboViewer mappingCombo;
-
private Map<String, IJpaComposite<IAttributeMapping>> mappingComposites;
- protected PageBook mappingPageBook;
- private IJpaComposite<IAttributeMapping> currentMappingComposite;
-
- public PersistentAttributeDetailsPage(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NONE, new BasicCommandStack(), widgetFactory);
- this.persistentAttributeListener = buildAttributeListener();
- this.mappingComposites = new HashMap<String, IJpaComposite<IAttributeMapping>>();
- }
-
- protected IJpaPlatformUi jpaPlatformUi() {
- String platformId = getAttribute().jpaPlatform().getId();
- return PlatformRegistry.instance().jpaPlatform(platformId);
+ private PageBook mappingPageBook;
+
+ /**
+ * Creates a new <code>PersistentAttributeDetailsPage</code>.
+ *
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ protected PersistentAttributeDetailsPage(Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(parent, widgetFactory);
}
- protected IJpaUiFactory jpaUiFactory() {
- return jpaPlatformUi().getJpaUiFactory();
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(IPersistentAttribute.DEFAULT_MAPPING_PROPERTY);
+ propertyNames.add(IPersistentAttribute.SPECIFIED_MAPPING_PROPERTY);
}
-
- protected abstract ListIterator<IAttributeMappingUiProvider> attributeMappingUiProviders();
-
- protected abstract ListIterator<IAttributeMappingUiProvider> defaultAttributeMappingUiProviders();
-
- protected IAttributeMappingUiProvider attributeMappingUiProvider(String key) {
- for (ListIterator<IAttributeMappingUiProvider> i = attributeMappingUiProviders(); i.hasNext(); ) {
- IAttributeMappingUiProvider provider = i.next();
+
+ protected IAttributeMappingUiProvider<? extends IAttributeMapping> attributeMappingUiProvider(String key) {
+ for (ListIterator<IAttributeMappingUiProvider<? extends IAttributeMapping>> i = attributeMappingUiProviders(); i.hasNext(); ) {
+ IAttributeMappingUiProvider<? extends IAttributeMapping> provider = i.next();
if (provider.attributeMappingKey() == key) {
return provider;
}
}
throw new IllegalArgumentException("Unsupported attribute mapping UI provider key: ");
}
-
- protected abstract IAttributeMappingUiProvider defaultAttributeMappingUiProvider(String key);
-
- private Adapter buildAttributeListener() {
- return new AdapterImpl() {
- @Override
- public void notifyChanged(Notification notification) {
- persistentAttributeChanged(notification);
- }
- };
- }
-
- protected void persistentAttributeChanged(Notification notification) {
- switch (notification.getFeatureID(IPersistentAttribute.class)) {
- case JpaCorePackage.IPERSISTENT_ATTRIBUTE__MAPPING:
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- break;
- }
- }
-
- protected Label buildMappingLabel(Composite parent) {
- return getWidgetFactory().createLabel(parent, JptUiMessages.PersistentAttributePage_mapAs);
- }
-
- protected ComboViewer buildMappingCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent);
- this.mappingCombo = new ComboViewer(combo);
- this.mappingCombo.setContentProvider(buildContentProvider());
- this.mappingCombo.setLabelProvider(buildLabelProvider());
- this.mappingCombo.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- mappingChanged(event);
- }
- });
- return this.mappingCombo;
- }
+
+ protected abstract ListIterator<IAttributeMappingUiProvider<? extends IAttributeMapping>>
+ attributeMappingUiProviders();
+
+ protected abstract IAttributeMappingUiProvider<? extends IAttributeMapping>[]
+ attributeMappingUiProvidersFor(IPersistentAttribute persistentAttribute);
private IContentProvider buildContentProvider() {
return new IStructuredContentProvider() {
public void dispose() {
// do nothing
}
-
+
public Object[] getElements(Object inputElement) {
if (inputElement == null) {
- return new Object[]{};
+ return new Object[0];
}
return attributeMappingUiProvidersFor((IPersistentAttribute) inputElement);
}
-
+
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
// do nothing
}
};
}
-
- protected abstract IAttributeMappingUiProvider[] attributeMappingUiProvidersFor(IPersistentAttribute persistentAttribute);
-
+
+ private PropertyAspectAdapter<IPersistentAttribute, IAttributeMapping> buildGenericMappingHolder() {
+ return new PropertyAspectAdapter<IPersistentAttribute, IAttributeMapping>(
+ getSubjectHolder(),
+ IPersistentAttribute.DEFAULT_MAPPING_PROPERTY,
+ IPersistentAttribute.SPECIFIED_MAPPING_PROPERTY)
+ {
+ @Override
+ protected IAttributeMapping buildValue_() {
+ return subject.getMapping();
+ }
+ };
+ }
+
private IBaseLabelProvider buildLabelProvider() {
return new LabelProvider() {
@Override
public String getText(Object element) {
- return ((IAttributeMappingUiProvider) element).label();
+ return ((IAttributeMappingUiProvider<?>) element).label();
}
};
}
-
+
+ protected ComboViewer buildMappingCombo(Composite parent) {
+
+ this.mappingCombo = buildComboViewer(parent, buildLabelProvider());
+ this.mappingCombo.getCCombo().setVisibleItemCount(Integer.MAX_VALUE);
+ this.mappingCombo.setContentProvider(buildContentProvider());
+ this.mappingCombo.addSelectionChangedListener(buildMappingComboModifyListener());
+ return this.mappingCombo;
+ }
+
+ private ISelectionChangedListener buildMappingComboModifyListener() {
+ return new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent e) {
+ mappingChanged(e);
+ }
+ };
+ }
+
+ @SuppressWarnings("unchecked")
+ protected IJpaComposite<IAttributeMapping> buildMappingComposite(PageBook pageBook,
+ String key) {
+
+ IAttributeMappingUiProvider<IAttributeMapping> uiProvider = (IAttributeMappingUiProvider<IAttributeMapping>) mappingUIProvider(key);
+
+ return uiProvider.buildAttributeMappingComposite(
+ jpaUiFactory(),
+ buildMappingHolder(key),
+ pageBook,
+ getFormWidgetFactory()
+ );
+ }
+
+ private Filter<IAttributeMapping> buildMappingFilter(final String key) {
+ return new Filter<IAttributeMapping>() {
+ public boolean accept(IAttributeMapping value) {
+ return (value == null) || key.equals(value.getKey());
+ }
+ };
+ }
+
+ private PropertyValueModel<IAttributeMapping> buildMappingHolder(final String key) {
+ return new FilteringPropertyValueModel<IAttributeMapping>(
+ buildGenericMappingHolder(),
+ buildMappingFilter(key)
+ );
+ }
+
+ protected Label buildMappingLabel(Composite parent) {
+ return buildLabel(parent, JptUiMessages.PersistentAttributePage_mapAs);
+ }
+
protected PageBook buildMappingPageBook(Composite parent) {
this.mappingPageBook = new PageBook(parent, SWT.NONE);
return this.mappingPageBook;
}
-
- protected IJpaComposite<IAttributeMapping> buildMappingComposite(PageBook pageBook, String key) {
- if (this.attributeMapping == null || this.attributeMapping.isDefault()) {
- return defaultAttributeMappingUiProvider(key).buildAttributeMappingComposite(jpaUiFactory(), pageBook, this.commandStack, getWidgetFactory());
- }
- return attributeMappingUiProvider(key).buildAttributeMappingComposite(jpaUiFactory(), pageBook, this.commandStack, getWidgetFactory());
- }
-
- void mappingChanged(SelectionChangedEvent event) {
- if (isPopulating()) {
- return;
- }
- if (event.getSelection() instanceof StructuredSelection) {
- IAttributeMappingUiProvider provider = (IAttributeMappingUiProvider) ((StructuredSelection) event.getSelection()).getFirstElement();
- String key = (CollectionTools.contains(defaultAttributeMappingUiProviders(), provider) ? null : provider.attributeMappingKey());
- this.attribute.setSpecifiedMappingKey(key);
- }
- }
-
+ protected abstract IAttributeMappingUiProvider<? extends IAttributeMapping>
+ defaultAttributeMappingUiProvider(String key);
+
+ protected abstract ListIterator<IAttributeMappingUiProvider<? extends IAttributeMapping>>
+ defaultAttributeMappingUiProviders();
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void doPopulate(IJpaContentNode persistentAttributeNode) {
- this.attribute = (IPersistentAttribute) persistentAttributeNode;
- populateMappingComboAndPage();
+ protected void doDispose() {
+ log("PersistentAttributeDetailsPage.doDispose()");
+
+ this.currentMappingComposite = null;
+
+ for (IJpaComposite<IAttributeMapping> composite : this.mappingComposites.values()) {
+ try {
+ composite.dispose();
+ }
+ catch (Exception e) {
+ JptUiPlugin.log(e);
+ }
+ }
+
+ this.mappingComposites.clear();
+ super.doDispose();
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
protected void doPopulate() {
+ super.doPopulate();
populateMappingComboAndPage();
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void engageListeners() {
- if (this.attribute != null) {
- this.attribute.eAdapters().add(this.persistentAttributeListener);
- }
+ protected void initialize() {
+ super.initialize();
+ this.mappingComposites = new HashMap<String, IJpaComposite<IAttributeMapping>>();
}
-
- @Override
- protected void disengageListeners() {
- if (this.attribute != null) {
- this.attribute.eAdapters().remove(this.persistentAttributeListener);
- }
+
+ protected IJpaPlatformUi jpaPlatformUi() {
+ String platformId = subject().jpaProject().jpaPlatform().getId();
+ return JpaPlatformUiRegistry.instance().jpaPlatform(platformId);
}
-
- private void populateMappingComboAndPage() {
- if (this.attribute == null) {
- this.attributeMapping = null;
- this.currentMappingKey = null;
- this.mappingCombo.setInput(null);
- this.mappingCombo.setSelection(StructuredSelection.EMPTY);
-
- if (this.currentMappingComposite != null) {
- this.currentMappingComposite.populate(null);
- this.currentMappingComposite = null;
- }
-
- return;
- }
- this.attributeMapping = this.attribute.getMapping();
- setComboData();
-
- populateMappingPage(this.attributeMapping == null ? null : this.attributeMapping.getKey());
+
+ protected IJpaUiFactory jpaUiFactory() {
+ // TODO: Remove the type cast, used for testing
+ return ((BaseJpaPlatformUi) jpaPlatformUi()).getJpaUiFactory();
}
-
- private void populateMappingPage(String mappingKey) {
- if (this.currentMappingComposite != null) {
- if (mappingKey == this.currentMappingKey) {
- if (this.currentMappingComposite != null) {
- this.currentMappingComposite.populate(this.attributeMapping);
- return;
- }
- }
- else {
- this.currentMappingComposite.populate(null);
- // don't return
- }
+
+ private void log(String message) {
+ if (Tracing.booleanDebugOption(Tracing.UI_DETAILS_VIEW)) {
+ Tracing.log(message);
}
-
- this.currentMappingKey = mappingKey;
-
- IJpaComposite<IAttributeMapping> composite = mappingCompositeFor(mappingKey);
- this.mappingPageBook.showPage(composite.getControl());
-
- this.currentMappingComposite = composite;
- this.currentMappingComposite.populate(this.attributeMapping);
}
-
- private void setComboData() {
- if (this.attribute != this.mappingCombo.getInput()) {
- this.mappingCombo.setInput(this.attribute);
- }
- if (this.attributeMapping == null || this.attributeMapping.isDefault()) {
- this.mappingCombo.setSelection(new StructuredSelection(this.mappingCombo.getElementAt(0)));
- }
- else {
- IAttributeMappingUiProvider provider = attributeMappingUiProvider(this.attribute.mappingKey());
- if (provider != null && ! provider.equals(((StructuredSelection) this.mappingCombo.getSelection()).getFirstElement())) {
- this.mappingCombo.setSelection(new StructuredSelection(provider));
- }
+
+ private void mappingChanged(SelectionChangedEvent event) {
+ if (event.getSelection() instanceof StructuredSelection) {
+ IAttributeMappingUiProvider<?> provider = (IAttributeMappingUiProvider<?>) ((StructuredSelection) event.getSelection()).getFirstElement();
+ String key = (CollectionTools.contains(defaultAttributeMappingUiProviders(), provider) ? null : provider.attributeMappingKey());
+ this.subject().setSpecifiedMappingKey(key);
}
}
-
+
private IJpaComposite<IAttributeMapping> mappingCompositeFor(String key) {
IJpaComposite<IAttributeMapping> composite = this.mappingComposites.get(key);
if (composite != null) {
return composite;
}
-
+
composite = buildMappingComposite(this.mappingPageBook, key);
-
+
if (composite != null) {
this.mappingComposites.put(key, composite);
}
-
+
return composite;
}
-
+
+ private IAttributeMappingUiProvider<? extends IAttributeMapping> mappingUIProvider(String key) {
+
+ if (this.subject().getMapping() == null ||
+ this.subject().getMapping().isDefault()) {
+
+ return defaultAttributeMappingUiProvider(key);
+ }
+
+ return attributeMappingUiProvider(key);
+ }
+
+ private void populateMapAsCombo() {
+ if (this.subject() != this.mappingCombo.getInput()) {
+ this.mappingCombo.setInput(this.subject());
+ }
+ if (this.subject() != null) {
+ if (this.subject().getMapping() == null || this.subject().getMapping().isDefault()) {
+ this.mappingCombo.setSelection(new StructuredSelection(this.mappingCombo.getElementAt(0)));
+ }
+ else {
+ IAttributeMappingUiProvider<? extends IAttributeMapping> provider = attributeMappingUiProvider(this.subject().mappingKey());
+ if (provider != null && ! provider.equals(((StructuredSelection) this.mappingCombo.getSelection()).getFirstElement())) {
+ this.mappingCombo.setSelection(new StructuredSelection(provider));
+ }
+ }
+ }
+ }
+
+ private void populateMappingComboAndPage() {
+ populateMapAsCombo();
+ updateMappingPage();
+ }
+
+ private void populateMappingPage(String mappingKey) {
+
+ // Nothing to update
+ if (this.currentMappingKey == mappingKey) {
+ return;
+ }
+ else if (this.currentMappingComposite != null) {
+ this.log("PersistentAttributeDetailsPage.populateMappingPage() disposing of current page: " + this.currentMappingKey);
+ this.currentMappingComposite.dispose();
+ }
+
+ this.currentMappingKey = mappingKey;
+
+ if (this.currentMappingKey != null) {
+ this.currentMappingComposite = mappingCompositeFor(mappingKey);
+
+ try {
+ this.log("PersistentAttributeDetailsPage.populateMappingPage() populating new page: " + this.currentMappingKey);
+
+ this.currentMappingComposite.populate();
+ this.mappingPageBook.showPage(this.currentMappingComposite.getControl());
+// this.mappingPageBook.getParent().layout(true);
+ }
+ catch (Exception e) {
+ this.log("PersistentAttributeDetailsPage.populateMappingPage() error encountered");
+ this.mappingComposites.remove(this.currentMappingComposite);
+ this.currentMappingComposite = null;
+ this.mappingPageBook.showPage(new Label(this.mappingPageBook, SWT.NULL));
+ JptUiPlugin.log(e);
+ }
+ }
+ else {
+ this.log("PersistentAttributeDetailsPage.populateMappingPage() no page to show");
+ this.currentMappingComposite = null;
+ this.mappingPageBook.showPage(new Label(this.mappingPageBook, SWT.NULL));
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void propertyChanged(String propertyName) {
+ super.propertyChanged(propertyName);
+
+ if (propertyName == IPersistentAttribute.DEFAULT_MAPPING_PROPERTY ||
+ propertyName == IPersistentAttribute.SPECIFIED_MAPPING_PROPERTY) {
+
+ populateMappingComboAndPage();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected boolean repopulateWithNullSubject() {
+ return false;
+ }
+
//TODO focus??
// public boolean setFocus() {
// super.setFocus();
// return mappingCombo.getCombo().setFocus();
// }
-
- @Override
- public void dispose() {
- disengageListeners();
- for (IJpaComposite<IAttributeMapping> composite : this.mappingComposites.values()) {
- composite.dispose();
- }
- super.dispose();
- }
-
- public IPersistentAttribute getAttribute() {
- return this.attribute;
+
+ private void updateMappingPage() {
+ IAttributeMapping mapping = (this.subject() != null) ? this.subject().getMapping() : null;
+ populateMappingPage(mapping == null ? null : mapping.getKey());
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentTypeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentTypeDetailsPage.java
index 6656cb43c0..28e2c3b44b 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentTypeDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/details/PersistentTypeDetailsPage.java
@@ -3,20 +3,16 @@
* 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.ui.internal.details;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.Map;
-
-import org.eclipse.emf.common.command.BasicCommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.IContentProvider;
@@ -26,229 +22,265 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
+import org.eclipse.jpt.core.internal.context.base.IPersistentType;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
import org.eclipse.jpt.ui.internal.JptUiMessages;
import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.Filter;
+import org.eclipse.jpt.utility.internal.model.value.FilteringPropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public abstract class PersistentTypeDetailsPage extends BaseJpaDetailsPage
-{
- private IPersistentType persistentType;
- private Adapter persistentTypeListener;
-
+/**
+ * The abstract definition of the details page responsible to show the
+ * information for an persistent type.
+ *
+ * @see IPersistentType
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+@SuppressWarnings("nls")
+public abstract class PersistentTypeDetailsPage<T extends IPersistentType> extends BaseJpaDetailsPage<T>
+{
+ private Map<String, IJpaComposite<ITypeMapping>> composites;
+ private IJpaComposite<ITypeMapping> currentMappingComposite;
private String currentMappingKey;
-
private ComboViewer typeMappingCombo;
-
- private Map<String, IJpaComposite<ITypeMapping>> composites;
-
- protected PageBook typeMappingPageBook;
-
- private IJpaComposite<ITypeMapping> visibleMappingComposite;
-
- public PersistentTypeDetailsPage(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NONE, new BasicCommandStack(), widgetFactory);
- this.persistentTypeListener = buildPersistentTypeListener();
+ private PageBook typeMappingPageBook;
+
+ /**
+ * Creates a new <code>PersistentTypeDetailsPage</code>.
+ *
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public PersistentTypeDetailsPage(Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(parent, widgetFactory);
this.composites = new HashMap<String, IJpaComposite<ITypeMapping>>();
}
-
- protected abstract ListIterator<ITypeMappingUiProvider> typeMappingUiProviders();
-
- private ITypeMappingUiProvider typeMappingUiProvider(String key) {
- for (ListIterator<ITypeMappingUiProvider> i = this.typeMappingUiProviders(); i.hasNext();) {
- ITypeMappingUiProvider provider = i.next();
- if (provider.mappingKey() == key) {
- return provider;
- }
- }
- throw new IllegalArgumentException("Unsupported type mapping UI provider key: " + key);
- }
- private Adapter buildPersistentTypeListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- persistentTypeChanged(notification);
- }
- };
- }
-
- private void persistentTypeChanged(Notification notification) {
- switch (notification.getFeatureID(IPersistentType.class)) {
- case JpaCorePackage.IPERSISTENT_TYPE__MAPPING_KEY:
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- break;
- }
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(IPersistentType.MAPPING_PROPERTY);
}
- protected Label buildTypeMappingLabel(Composite parent) {
- return getWidgetFactory().createLabel(parent, JptUiMessages.PersistentTypePage_mapAs);
- }
-
- protected ComboViewer buildTypeMappingCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent);
- this.typeMappingCombo = new ComboViewer(combo);
- this.typeMappingCombo.setContentProvider(buildContentProvider());
- this.typeMappingCombo.setLabelProvider(buildLabelProvider());
- this.typeMappingCombo.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- typeMappingChanged(event);
- }
- });
- return this.typeMappingCombo;
- }
-
private IContentProvider buildContentProvider() {
return new IStructuredContentProvider() {
public void dispose() {
// do nothing
}
-
+
public Object[] getElements(Object inputElement) {
- return (persistentType == null) ?
+ return (subject() == null) ?
new String[] {}:
CollectionTools.array(PersistentTypeDetailsPage.this.typeMappingUiProviders());
}
-
+
public void inputChanged(
Viewer viewer, Object oldInput, Object newInput) {
// do nothing
}
};
}
+
private IBaseLabelProvider buildLabelProvider() {
return new LabelProvider() {
@Override
public String getText(Object element) {
- return ((ITypeMappingUiProvider) element).label();
+ return ((ITypeMappingUiProvider<?>) element).label();
}
};
}
-
+
+ @SuppressWarnings("unchecked")
+ protected IJpaComposite<ITypeMapping> buildMappingComposite(PageBook pageBook,
+ String key) {
+
+ ITypeMappingUiProvider<ITypeMapping> uiProvider =
+ (ITypeMappingUiProvider<ITypeMapping>) typeMappingUiProvider(key);
+
+ return uiProvider.buildPersistentTypeMappingComposite(
+ buildMappingHolder(key),
+ pageBook,
+ getFormWidgetFactory()
+ );
+ }
+
+ private PropertyValueModel<ITypeMapping> buildMappingHolder(String key) {
+ return new FilteringPropertyValueModel<ITypeMapping>(
+ buildGenericMappingHolder(),
+ buildMappingFilter(key)
+ );
+ }
+
+ private PropertyAspectAdapter<IPersistentType, ITypeMapping> buildGenericMappingHolder() {
+ return new PropertyAspectAdapter<IPersistentType, ITypeMapping>(getSubjectHolder(), IPersistentType.MAPPING_PROPERTY) {
+ @Override
+ protected ITypeMapping buildValue_() {
+ return subject.getMapping();
+ }
+ };
+ }
+
+ private Filter<ITypeMapping> buildMappingFilter(final String key) {
+ return new Filter<ITypeMapping>() {
+ public boolean accept(ITypeMapping value) {
+ return (value == null) || key.equals(value.getKey());
+ }
+ };
+ }
+
+ protected ComboViewer buildTypeMappingCombo(Composite parent) {
+ CCombo combo = buildCombo(parent);
+ this.typeMappingCombo = new ComboViewer(combo);
+ this.typeMappingCombo.getCCombo().setVisibleItemCount(Integer.MAX_VALUE);
+ this.typeMappingCombo.setContentProvider(buildContentProvider());
+ this.typeMappingCombo.setLabelProvider(buildLabelProvider());
+ this.typeMappingCombo.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ typeMappingChanged(event);
+ }
+ });
+ return this.typeMappingCombo;
+ }
+
+ protected Label buildTypeMappingLabel(Composite parent) {
+ return buildLabel(parent, JptUiMessages.PersistentTypePage_mapAs);
+ }
+
protected PageBook buildTypeMappingPageBook(Composite parent) {
this.typeMappingPageBook = new PageBook(parent, SWT.NONE);
return this.typeMappingPageBook;
}
-
-
- private void typeMappingChanged(SelectionChangedEvent event) {
- if (isPopulating()) {
- return;
- }
- if (event.getSelection() instanceof StructuredSelection) {
- ITypeMappingUiProvider provider = (ITypeMappingUiProvider) ((StructuredSelection) event.getSelection()).getFirstElement();
- this.persistentType.setMappingKey(provider.mappingKey());
- }
- }
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void doPopulate(IJpaContentNode persistentTypeNode) {
- this.persistentType = (IPersistentType) persistentTypeNode;
- populateMappingComboAndPage();
+ protected void doDispose() {
+
+ for (Iterator<IJpaComposite<ITypeMapping>> iter = this.composites.values().iterator(); iter.hasNext(); ) {
+ iter.next().dispose();
+ }
+
+ super.doDispose();
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
protected void doPopulate() {
+ super.doPopulate();
populateMappingComboAndPage();
}
-
- protected void engageListeners() {
- if (this.persistentType != null) {
- this.persistentType.eAdapters().add(this.persistentTypeListener);
+
+ private IJpaComposite<ITypeMapping> mappingCompositeFor(String key) {
+ IJpaComposite<ITypeMapping> mappingComposite = this.composites.get(key);
+ if (mappingComposite != null) {
+ return mappingComposite;
}
- }
-
- protected void disengageListeners() {
- if (this.persistentType != null) {
- this.persistentType.eAdapters().remove(this.persistentTypeListener);
+
+ mappingComposite = buildMappingComposite(this.typeMappingPageBook, key);
+
+ if (mappingComposite != null) {
+ this.composites.put(key, mappingComposite);
}
+
+ return mappingComposite;
}
-
+
private void populateMappingComboAndPage() {
- if (this.persistentType == null) {
+ if (this.subject() == null) {
this.currentMappingKey = null;
this.typeMappingCombo.setInput(null);
this.typeMappingCombo.setSelection(StructuredSelection.EMPTY);
-
- if (this.visibleMappingComposite != null) {
- this.visibleMappingComposite.populate(null);
- this.visibleMappingComposite = null;
+
+ if (this.currentMappingComposite != null) {
+ this.currentMappingComposite.populate();
+ this.currentMappingComposite = null;
}
-
+
return;
}
-
- String mappingKey = this.persistentType.getMapping().getKey();
+
+ String mappingKey = this.subject().getMapping().getKey();
setComboData(mappingKey);
-
+
populateMappingPage(mappingKey);
}
-
+
private void populateMappingPage(String mappingKey) {
- if (this.visibleMappingComposite != null) {
- if (mappingKey == this.currentMappingKey) {
- if (this.visibleMappingComposite != null) {
- this.visibleMappingComposite.populate(this.persistentType.getMapping());
- return;
- }
+ if (this.currentMappingComposite != null &&
+ this.currentMappingKey == mappingKey) {
+
+ this.currentMappingComposite.populate();
+ return;
+ }
+
+ this.currentMappingKey = mappingKey;
+
+ if (this.currentMappingKey != null) {
+ this.currentMappingComposite = mappingCompositeFor(mappingKey);
+
+ try {
+ this.currentMappingComposite.populate();
}
- else {
- this.visibleMappingComposite.populate(null);
- // don't return
+ finally {
+ // Log or show error
}
+
+ this.typeMappingPageBook.showPage(this.currentMappingComposite.getControl());
+ this.typeMappingPageBook.layout(true);
+ }
+ else {
+ this.currentMappingComposite = null;
+ this.typeMappingPageBook.showPage(new Label(this.typeMappingPageBook, SWT.NULL));
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void propertyChanged(String propertyName) {
+ super.propertyChanged(propertyName);
+
+ if (propertyName == IPersistentType.MAPPING_PROPERTY) {
+ populateMappingComboAndPage();
}
-
- this.currentMappingKey = mappingKey;
-
- IJpaComposite mappingComposite = mappingCompositeFor(mappingKey);
- this.typeMappingPageBook.showPage(mappingComposite.getControl());
-
- this.visibleMappingComposite = mappingComposite;
- this.visibleMappingComposite.populate(this.persistentType.getMapping());
}
-
+
private void setComboData(String mappingKey) {
- if (this.persistentType != this.typeMappingCombo.getInput()) {
- this.typeMappingCombo.setInput(this.persistentType);
+ if (this.subject() != this.typeMappingCombo.getInput()) {
+ this.typeMappingCombo.setInput(this.subject());
}
-
- ITypeMappingUiProvider provider = typeMappingUiProvider(mappingKey);
+
+ ITypeMappingUiProvider<? extends ITypeMapping> provider = typeMappingUiProvider(mappingKey);
if (! provider.equals(((StructuredSelection) this.typeMappingCombo.getSelection()).getFirstElement())) {
this.typeMappingCombo.setSelection(new StructuredSelection(provider));
}
}
-
- private IJpaComposite<ITypeMapping> mappingCompositeFor(String key) {
- IJpaComposite<ITypeMapping> mappingComposite = this.composites.get(key);
- if (mappingComposite != null) {
- return mappingComposite;
- }
-
- mappingComposite = buildMappingComposite(this.typeMappingPageBook, key);
-
- if (mappingComposite != null) {
- this.composites.put(key, mappingComposite);
+
+ private void typeMappingChanged(SelectionChangedEvent event) {
+ if (event.getSelection() instanceof StructuredSelection) {
+ ITypeMappingUiProvider<?> provider = (ITypeMappingUiProvider<?>) ((StructuredSelection) event.getSelection()).getFirstElement();
+ this.subject().setMappingKey(provider.mappingKey());
}
-
- return mappingComposite;
- }
-
- protected IJpaComposite<ITypeMapping> buildMappingComposite(PageBook pageBook, String key) {
- return typeMappingUiProvider(key).buildPersistentTypeMappingComposite(pageBook, this.commandStack, getWidgetFactory());
}
//TODO focus??
@@ -256,17 +288,16 @@ public abstract class PersistentTypeDetailsPage extends BaseJpaDetailsPage
// super.setFocus();
// return typeMappingCombo.getCombo().setFocus();
// }
-
- public void dispose() {
- disengageListeners();
- for (Iterator<IJpaComposite<ITypeMapping>> i = this.composites.values().iterator(); i.hasNext(); ) {
- i.next().dispose();
+
+ private ITypeMappingUiProvider<? extends ITypeMapping> typeMappingUiProvider(String key) {
+ for (ListIterator<ITypeMappingUiProvider<? extends ITypeMapping>> iter = this.typeMappingUiProviders(); iter.hasNext();) {
+ ITypeMappingUiProvider<? extends ITypeMapping> provider = iter.next();
+ if (provider.mappingKey() == key) {
+ return provider;
+ }
}
- super.dispose();
- }
-
- public IPersistentType getPersistentType() {
- return this.persistentType;
+ throw new IllegalArgumentException("Unsupported type mapping UI provider key: " + key);
}
-}
+ protected abstract ListIterator<ITypeMappingUiProvider<? extends ITypeMapping>> typeMappingUiProviders();
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java
index 9db8842e31..2725d9cb5d 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java
@@ -10,7 +10,7 @@ import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
import org.eclipse.jpt.ui.internal.JptUiMessages;
import org.eclipse.jpt.ui.internal.JptUiPlugin;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
@@ -37,27 +37,25 @@ import org.eclipse.swt.widgets.Text;
public class AddPersistentAttributeToXmlAndMapDialog extends StatusDialog
{
private XmlPersistentAttribute unmappedPersistentAttribute;
-
private Text attributeText;
-
private ComboViewer mappingCombo;
-
-
+
public AddPersistentAttributeToXmlAndMapDialog(Shell parentShell, XmlPersistentAttribute unmappedPersistentAttribute) {
super(parentShell);
this.unmappedPersistentAttribute = unmappedPersistentAttribute;
setTitle(JptUiMessages.AddPersistentAttributeDialog_title);
}
-
+
+ @Override
protected Control createDialogArea(Composite parent) {
Composite dialogArea = (Composite) super.createDialogArea(parent);
-
+
Composite composite = new Composite(dialogArea, SWT.NULL);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
composite.setLayout(new GridLayout());
-
+
createLabel(composite, 1, JptUiMessages.AddPersistentAttributeDialog_attributeLabel);
-
+
attributeText = createText(composite, 1);
// attributeText.addModifyListener(
// new ModifyListener() {
@@ -68,14 +66,14 @@ public class AddPersistentAttributeToXmlAndMapDialog extends StatusDialog
// );
attributeText.setText(unmappedPersistentAttribute.getName());
attributeText.setEditable(false);
-
+
createLabel(composite, 1, JptUiMessages.AddPersistentClassDialog_mappingLabel);
-
+
mappingCombo = new ComboViewer(createCombo(composite, 1));
mappingCombo.setContentProvider(
new IStructuredContentProvider() {
public void dispose() {}
-
+
public Object[] getElements(Object inputElement) {
return new Object[] {
BasicMappingUiProvider.instance(),
@@ -90,7 +88,7 @@ public class AddPersistentAttributeToXmlAndMapDialog extends StatusDialog
VersionMappingUiProvider.instance()
};
}
-
+
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
});
mappingCombo.setLabelProvider(
@@ -107,18 +105,18 @@ public class AddPersistentAttributeToXmlAndMapDialog extends StatusDialog
});
mappingCombo.setInput("FOO");
mappingCombo.getCombo().select(0); // select Basic to begin
-
+
// TODO - F1 Help
// PlatformUI.getWorkbench().getHelpSystem().setHelp(group, IDaliHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_DATABASE);
-
+
//getButton(IDialogConstants.OK_ID).setEnabled(false); // disabled to start
- applyDialogFont(dialogArea);
-
+ applyDialogFont(dialogArea);
+
validate();
-
+
return dialogArea;
}
-
+
private Label createLabel(Composite container, int span, String text) {
Label label = new Label(container, SWT.NONE);
label.setText(text);
@@ -127,7 +125,7 @@ public class AddPersistentAttributeToXmlAndMapDialog extends StatusDialog
label.setLayoutData(gd);
return label;
}
-
+
private Text createText(Composite container, int span) {
Text text = new Text(container, SWT.BORDER | SWT.SINGLE);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -136,7 +134,7 @@ public class AddPersistentAttributeToXmlAndMapDialog extends StatusDialog
text.setLayoutData(gd);
return text;
}
-
+
private Combo createCombo(Composite container, int span) {
Combo combo = new Combo(container, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -144,25 +142,25 @@ public class AddPersistentAttributeToXmlAndMapDialog extends StatusDialog
combo.setLayoutData(gd);
return combo;
}
-
+
public String getAttributeName() {
return attributeText.getText();
}
-
+
public String getMappingKey() {
StructuredSelection selection = (StructuredSelection) mappingCombo.getSelection();
return (selection.isEmpty()) ? null : ((IAttributeMappingUiProvider) selection.getFirstElement()).attributeMappingKey();
}
-
+
private void validate() {
// if (entityMappings.containsPersistentType(type)) {
// updateStatus(
// new Status(
-// IStatus.WARNING, JptUiPlugin.PLUGIN_ID,
+// IStatus.WARNING, JptUiPlugin.PLUGIN_ID,
// JptUiMessages.AddPersistentClassDialog_duplicateClassWarning));
// return;
// }
-//
+//
String mappingKey = getMappingKey();
if (mappingKey == null) {
updateStatus(
@@ -171,10 +169,10 @@ public class AddPersistentAttributeToXmlAndMapDialog extends StatusDialog
JptUiMessages.AddPersistentAttributeDialog_noMappingKeyError));
return;
}
-
+
updateStatus(Status.OK_STATUS);
}
-
+
@Override
protected void okPressed() {
unmappedPersistentAttribute.setSpecifiedMappingKey(getMappingKey());
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentClassDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentClassDialog.java
index df5f48df2a..5d74a0bc5b 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentClassDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/dialogs/AddPersistentClassDialog.java
@@ -28,7 +28,7 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.Window;
import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
+import org.eclipse.jpt.core.internal.context.orm.EntityMappings;
import org.eclipse.jpt.ui.internal.JptUiMessages;
import org.eclipse.jpt.ui.internal.JptUiPlugin;
import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
@@ -56,7 +56,7 @@ import org.eclipse.ui.progress.IProgressService;
public class AddPersistentClassDialog extends StatusDialog
{
- private EntityMappingsInternal entityMappings;
+ private EntityMappings entityMappings;
private Text classText;
@@ -65,12 +65,13 @@ public class AddPersistentClassDialog extends StatusDialog
private ComboViewer mappingCombo;
- public AddPersistentClassDialog(Shell parentShell, EntityMappingsInternal entityMappings) {
+ public AddPersistentClassDialog(Shell parentShell, EntityMappings entityMappings) {
super(parentShell);
this.entityMappings = entityMappings;
setTitle(JptUiMessages.AddPersistentClassDialog_title);
}
+ @Override
protected Control createDialogArea(Composite parent) {
Composite dialogArea = (Composite) super.createDialogArea(parent);
@@ -80,8 +81,8 @@ public class AddPersistentClassDialog extends StatusDialog
createLabel(composite, 2, JptUiMessages.AddPersistentClassDialog_classLabel);
- classText = createText(composite, 1);
- classText.addModifyListener(
+ this.classText = createText(composite, 1);
+ this.classText.addModifyListener(
new ModifyListener() {
public void modifyText(ModifyEvent e) {
validate();
@@ -89,8 +90,8 @@ public class AddPersistentClassDialog extends StatusDialog
}
);
- classBrowseButton = createButton(composite, 1, JptUiMessages.General_browse);
- classBrowseButton.addSelectionListener(new SelectionListener() {
+ this.classBrowseButton = createButton(composite, 1, JptUiMessages.General_browse);
+ this.classBrowseButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
IType type = chooseType();
if (type != null) {
@@ -104,8 +105,8 @@ public class AddPersistentClassDialog extends StatusDialog
createLabel(composite, 2, JptUiMessages.AddPersistentClassDialog_mappingLabel);
- mappingCombo = new ComboViewer(createCombo(composite, 2));
- mappingCombo.setContentProvider(
+ this.mappingCombo = new ComboViewer(createCombo(composite, 2));
+ this.mappingCombo.setContentProvider(
new IStructuredContentProvider() {
public void dispose() {}
@@ -119,20 +120,20 @@ public class AddPersistentClassDialog extends StatusDialog
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
});
- mappingCombo.setLabelProvider(
+ this.mappingCombo.setLabelProvider(
new LabelProvider() {
@Override
public String getText(Object element) {
- return ((ITypeMappingUiProvider) element).label();
+ return ((ITypeMappingUiProvider<?>) element).label();
}
});
- mappingCombo.addSelectionChangedListener(new ISelectionChangedListener() {
+ this.mappingCombo.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
validate();
}
});
- mappingCombo.setInput("FOO");
- mappingCombo.getCombo().select(1); // select Entity to begin
+ this.mappingCombo.setInput("FOO");
+ this.mappingCombo.getCombo().select(1); // select Entity to begin
// TODO - F1 Help
// PlatformUI.getWorkbench().getHelpSystem().setHelp(group, IDaliHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_DATABASE);
@@ -181,16 +182,16 @@ public class AddPersistentClassDialog extends StatusDialog
}
private IJpaProject getJpaProject() {
- return entityMappings.getJpaProject();
+ return this.entityMappings.jpaProject();
}
public String getClassName() {
- return classText.getText();
+ return this.classText.getText();
}
public String getMappingKey() {
- StructuredSelection selection = (StructuredSelection) mappingCombo.getSelection();
- return (selection.isEmpty()) ? null : ((ITypeMappingUiProvider) selection.getFirstElement()).mappingKey();
+ StructuredSelection selection = (StructuredSelection) this.mappingCombo.getSelection();
+ return (selection.isEmpty()) ? null : ((ITypeMappingUiProvider<?>) selection.getFirstElement()).mappingKey();
}
protected IType chooseType() {
@@ -246,7 +247,7 @@ public class AddPersistentClassDialog extends StatusDialog
return;
}
- if (entityMappings.containsPersistentType(type)) {
+ if (this.entityMappings.containsPersistentType(className)) {
updateStatus(
new Status(
IStatus.WARNING, JptUiPlugin.PLUGIN_ID,
@@ -268,7 +269,7 @@ public class AddPersistentClassDialog extends StatusDialog
@Override
protected void okPressed() {
- entityMappings.addMapping(getClassName(), getMappingKey());
+ this.entityMappings.addXmlPersistentType(getMappingKey(), getClassName());
super.okPressed();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/IAttributeMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/IAttributeMappingUiProvider.java
index 4493c0c794..c3960c40a4 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/IAttributeMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/IAttributeMappingUiProvider.java
@@ -3,21 +3,20 @@
* 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.ui.internal.java.details;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public interface IAttributeMappingUiProvider
+public interface IAttributeMappingUiProvider<T extends IAttributeMapping>
{
/**
* A unique string that corresponds to the key of a MappingProvider in the core
@@ -26,23 +25,24 @@ public interface IAttributeMappingUiProvider
String attributeMappingKey();
/**
- * A label to be displayed to the label as an option in the mapping type combo box
- * @return
- */
- String label();
-
- /**
* The IJpaComposite that correponds to this mapping type. This will be displayed
* by the PersistentAttributeDetailsPage when the mapping key matches the key given
* by this provider. The composites will be stored in a Map with the mapping key as the key.
* @param factory
* @param parent
- * @param commandStack
* @param widgetFactory
- *
+ *
* @return
*/
- IJpaComposite<IAttributeMapping> buildAttributeMappingComposite(
- IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
-}
+ IJpaComposite<T> buildAttributeMappingComposite(
+ IJpaUiFactory factory,
+ PropertyValueModel<T> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory);
+
+ /**
+ * A label to be displayed to the label as an option in the mapping type combo box
+ * @return
+ */
+ String label();
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/ITypeMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/ITypeMappingUiProvider.java
index 51318e9568..b97cba51cf 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/ITypeMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/ITypeMappingUiProvider.java
@@ -3,27 +3,27 @@
* 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.ui.internal.java.details;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.core.internal.ITypeMapping;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public interface ITypeMappingUiProvider
+public interface ITypeMappingUiProvider<T extends ITypeMapping>
{
/**
* A unique string that corresponds to the key of a MappingProvider in the core
*/
String mappingKey();
-
+
/**
- * A label to be displayed to the label as an option in the mapping type combo box
+ * A label to be displayed to the label as an option in the mapping type combo box
* @return
*/
String label();
@@ -32,13 +32,14 @@ public interface ITypeMappingUiProvider
* The IJpaComposite that correponds to this mapping type. This will be displayed
* by the PersistentTypeDetailsPage when the mapping key matches the key given
* by this provider. The composites will be stored in a Map with the mapping key as the key.
- *
+ *
* @param parent
- * @param commandStack
* @param widgetFactory
* @return
*/
- IJpaComposite<ITypeMapping> buildPersistentTypeMappingComposite(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory);
-
+ IJpaComposite<T> buildPersistentTypeMappingComposite(
+ PropertyValueModel<T> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory);
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaDetailsProvider.java
index 314f1c505c..796f36a4b2 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaDetailsProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaDetailsProvider.java
@@ -1,45 +1,55 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.ui.internal.java.details;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.core.internal.content.java.IJavaContentNodes;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
import org.eclipse.jpt.ui.internal.details.IJpaDetailsPage;
import org.eclipse.jpt.ui.internal.details.IJpaDetailsProvider;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class JavaDetailsProvider
+/**
+ * This provider is responsible for creating the <code>IJpaDetailsPage</code>
+ * when the information comes from the Java source file.
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class JavaDetailsProvider
implements IJpaDetailsProvider
{
+ /**
+ * Creates a new <code>JavaDetailsProvider</code>.
+ */
public JavaDetailsProvider() {
super();
}
-
- public String fileContentType() {
- return JavaCore.JAVA_SOURCE_CONTENT_TYPE;
- }
-
- public IJpaDetailsPage buildDetailsPage(
- Composite parentComposite, Object contentNodeId, TabbedPropertySheetWidgetFactory widgetFactory) {
- if (contentNodeId.equals(IJavaContentNodes.PERSISTENT_TYPE_ID)) {
- return new JavaPersistentTypeDetailsPage(parentComposite, widgetFactory);
+
+ /*
+ * (non-Javadoc)
+ */
+ public IJpaDetailsPage<? extends IJpaContextNode> buildDetailsPage(
+ Composite parent,
+ Object contentNodeId,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ if (contentNodeId instanceof IJavaPersistentType) {
+ return new JavaPersistentTypeDetailsPage(parent, widgetFactory);
}
- else if (contentNodeId.equals(IJavaContentNodes.PERSISTENT_ATTRIBUTE_ID)) {
- return new JavaPersistentAttributeDetailsPage(parentComposite, widgetFactory);
+
+ if (contentNodeId instanceof IJavaPersistentAttribute) {
+ return new JavaPersistentAttributeDetailsPage(parent, widgetFactory);
}
-
- return null;
- }
- public void dispose() {
- // no op ... for now
+ return null;
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java
index ba03040b85..54926f49b8 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentAttributeDetailsPage.java
@@ -3,100 +3,126 @@
* 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.ui.internal.java.details;
import java.util.ListIterator;
-
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentAttribute;
import org.eclipse.jpt.ui.internal.details.PersistentAttributeDetailsPage;
import org.eclipse.jpt.ui.internal.java.mappings.properties.NullAttributeMappingUiProvider;
+import org.eclipse.jpt.ui.internal.platform.base.BaseJpaPlatformUi;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class JavaPersistentAttributeDetailsPage
- extends PersistentAttributeDetailsPage
+/**
+ * The default implementation of the details page used for the Java persistent
+ * attribute.
+ *
+ * @see IPersistentAttribute
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class JavaPersistentAttributeDetailsPage extends PersistentAttributeDetailsPage<IJavaPersistentAttribute>
{
- public JavaPersistentAttributeDetailsPage(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
+ /**
+ * Creates a new <code>JavaPersistentAttributeDetailsPage</code>.
+ *
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public JavaPersistentAttributeDetailsPage(Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
super(parent, widgetFactory);
}
-
-
- @Override
- protected ListIterator<IAttributeMappingUiProvider> attributeMappingUiProviders() {
- return jpaPlatformUi().javaAttributeMappingUiProviders();
- }
-
- protected IAttributeMappingUiProvider nullAttributeMappingUiProvider() {
- return NullAttributeMappingUiProvider.instance();
- }
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected ListIterator<IAttributeMappingUiProvider> defaultAttributeMappingUiProviders() {
- return jpaPlatformUi().defaultJavaAttributeMappingUiProviders();
+ protected ListIterator<IAttributeMappingUiProvider<? extends IAttributeMapping>> attributeMappingUiProviders() {
+ // TODO
+ return ((BaseJpaPlatformUi) jpaPlatformUi()).javaAttributeMappingUiProviders();
}
-
/**
* These IAtttributeMappingUiProviders will be used as elements in the attributeMapping combo
* The first element in the combo will be one of the defaultAttributeMappingUiProviders or
* if none of those apply the nullAttributeMappingUiProvider will be used. The rest of the elements
* will be the attributeMappingUiProviders. The defaultAttributeMappingUiProvider is
- * determined by matching its key with the key of the current attributeMapping.
+ * determined by matching its key with the key of the current attributeMapping.
*/
@Override
- protected IAttributeMappingUiProvider[] attributeMappingUiProvidersFor(IPersistentAttribute persistentAttribute) {
- IAttributeMappingUiProvider[] providers = new IAttributeMappingUiProvider[CollectionTools.size(attributeMappingUiProviders()) + 1];
+ protected IAttributeMappingUiProvider<? extends IAttributeMapping>[] attributeMappingUiProvidersFor(IPersistentAttribute persistentAttribute) {
+ IAttributeMappingUiProvider<? extends IAttributeMapping>[] providers = new IAttributeMappingUiProvider<?>[CollectionTools.size(attributeMappingUiProviders()) + 1];
providers[0] = defaultAttributeMappingUiProvider(persistentAttribute.defaultMappingKey());
int i = 1;
- for (ListIterator<IAttributeMappingUiProvider> iterator = attributeMappingUiProviders(); iterator.hasNext(); ) {
+ for (ListIterator<IAttributeMappingUiProvider<? extends IAttributeMapping>> iterator = attributeMappingUiProviders(); iterator.hasNext(); ) {
providers[i++] = iterator.next();
}
return providers;
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected IAttributeMappingUiProvider defaultAttributeMappingUiProvider(String key) {
- for (ListIterator<IAttributeMappingUiProvider> i = defaultAttributeMappingUiProviders(); i.hasNext(); ) {
- IAttributeMappingUiProvider provider = i.next();
+ protected IAttributeMappingUiProvider<? extends IAttributeMapping> defaultAttributeMappingUiProvider(String key) {
+ for (ListIterator<IAttributeMappingUiProvider<? extends IAttributeMapping>> i = defaultAttributeMappingUiProviders(); i.hasNext(); ) {
+ IAttributeMappingUiProvider<? extends IAttributeMapping> provider = i.next();
if (provider.attributeMappingKey() == key) {
return provider;
}
}
return this.nullAttributeMappingUiProvider();
}
-
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected ListIterator<IAttributeMappingUiProvider<? extends IAttributeMapping>> defaultAttributeMappingUiProviders() {
+ // TODO
+// return jpaPlatformUi().defaultJavaAttributeMappingUiProviders();
+ return ((BaseJpaPlatformUi) jpaPlatformUi()).defaultJavaAttributeMappingUiProviders();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void initializeLayout(Composite composite) {
- composite.setLayout(new GridLayout(2, false));
-
- GridData gridData;
-
- buildMappingLabel(composite);
-
- ComboViewer mappingCombo = buildMappingCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- mappingCombo.getCombo().setLayoutData(gridData);
-
- PageBook book = buildMappingPageBook(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
+ protected void initializeLayout(Composite container) {
+
+ // Note: The combo's parent is a container fixing the issue with the
+ // border not being painted
+ buildLabeledComposite(
+ container,
+ buildMappingLabel(container),
+ buildMappingCombo(container).getControl().getParent()
+ );
+
+ PageBook mappingPane = buildMappingPageBook(container);
+
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = SWT.FILL;
+ gridData.verticalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- book.setLayoutData(gridData);
+ gridData.grabExcessVerticalSpace = true;
+
+ mappingPane.setLayoutData(gridData);
+ }
+
+ protected IAttributeMappingUiProvider<IAttributeMapping> nullAttributeMappingUiProvider() {
+ return NullAttributeMappingUiProvider.instance();
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentTypeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentTypeDetailsPage.java
index 29e70c383e..7661a106ac 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentTypeDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/details/JavaPersistentTypeDetailsPage.java
@@ -1,67 +1,85 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.ui.internal.java.details;
import java.util.ListIterator;
-
-import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
import org.eclipse.jpt.ui.internal.IJpaPlatformUi;
-import org.eclipse.jpt.ui.internal.PlatformRegistry;
import org.eclipse.jpt.ui.internal.details.PersistentTypeDetailsPage;
+import org.eclipse.jpt.ui.internal.platform.JpaPlatformUiRegistry;
+import org.eclipse.jpt.ui.internal.platform.base.BaseJpaPlatformUi;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class JavaPersistentTypeDetailsPage extends
- PersistentTypeDetailsPage
-{
-
- public JavaPersistentTypeDetailsPage(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
+/**
+ * The default implementation of the details page used for the Java persistent
+ * type.
+ *
+ * @see IJavaPersistentType
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class JavaPersistentTypeDetailsPage extends PersistentTypeDetailsPage<IJavaPersistentType>
+{
+ /**
+ * Creates a new <code>JavaPersistentTypeDetailsPage</code>.
+ *
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public JavaPersistentTypeDetailsPage(Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
super(parent, widgetFactory);
}
-
+
protected IJpaPlatformUi jpaPlatformUi() {
- String platformId = getPersistentType().jpaPlatform().getId();
- return PlatformRegistry.instance().jpaPlatform(platformId);
+ String platformId = subject().jpaProject().jpaPlatform().getId();
+ return JpaPlatformUiRegistry.instance().jpaPlatform(platformId);
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected ListIterator<ITypeMappingUiProvider> typeMappingUiProviders() {
- return jpaPlatformUi().javaTypeMappingUiProviders();
+ protected ListIterator<ITypeMappingUiProvider<? extends ITypeMapping>> typeMappingUiProviders() {
+ // TODO
+ return ((BaseJpaPlatformUi) jpaPlatformUi()).javaTypeMappingUiProviders();
}
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void initializeLayout(Composite composite) {
- GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 2;
- composite.setLayout(gridLayout);
-
- buildTypeMappingLabel(composite);
-
- ComboViewer typeMappingCombo = buildTypeMappingCombo(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- typeMappingCombo.getCombo().setLayoutData(gridData);
+ protected void initializeLayout(Composite container) {
+
+ // Entity Type widgets
+ buildLabeledComposite(
+ container,
+ buildTypeMappingLabel(container),
+ buildTypeMappingCombo(container).getControl().getParent()
+ );
- PageBook typeMappingPageBook = buildTypeMappingPageBook(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
+ PageBook typeMappingPageBook = buildTypeMappingPageBook(container);
+
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = SWT.FILL;
+ gridData.verticalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- typeMappingPageBook.setLayoutData(gridData);
- }
+ gridData.grabExcessVerticalSpace = true;
-}
+ typeMappingPageBook.setLayoutData(gridData);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/BasicMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/BasicMappingUiProvider.java
index f9882fb990..fc8a7ac928 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/BasicMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/BasicMappingUiProvider.java
@@ -3,32 +3,33 @@
* 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
public class BasicMappingUiProvider
- implements IAttributeMappingUiProvider
+ implements IAttributeMappingUiProvider<IBasicMapping>
{
-
+
// singleton
private static final BasicMappingUiProvider INSTANCE = new BasicMappingUiProvider();
/**
* Return the singleton.
*/
- public static IAttributeMappingUiProvider instance() {
+ public static IAttributeMappingUiProvider<IBasicMapping> instance() {
return INSTANCE;
}
@@ -38,16 +39,21 @@ public class BasicMappingUiProvider
private BasicMappingUiProvider() {
super();
}
-
+
public String attributeMappingKey() {
return IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String label() {
return JptUiMappingsMessages.PersistentAttributePage_BasicLabel;
}
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createBasicMappingComposite(parent, commandStack, widgetFactory);
+
+ public IJpaComposite<IBasicMapping> buildAttributeMappingComposite(
+ IJpaUiFactory factory,
+ PropertyValueModel<IBasicMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return factory.createBasicMappingComposite(subjectHolder, parent, widgetFactory);
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultBasicMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultBasicMappingUiProvider.java
index 5eee3a03f9..e6d91b2ab2 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultBasicMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultBasicMappingUiProvider.java
@@ -3,23 +3,25 @@
* 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
public class DefaultBasicMappingUiProvider
- implements IAttributeMappingUiProvider
+ implements IAttributeMappingUiProvider<IBasicMapping>
{
// singleton
private static final DefaultBasicMappingUiProvider INSTANCE = new DefaultBasicMappingUiProvider();
@@ -27,7 +29,7 @@ public class DefaultBasicMappingUiProvider
/**
* Return the singleton.
*/
- public static IAttributeMappingUiProvider instance() {
+ public static IAttributeMappingUiProvider<IBasicMapping> instance() {
return INSTANCE;
}
@@ -37,16 +39,23 @@ public class DefaultBasicMappingUiProvider
private DefaultBasicMappingUiProvider() {
super();
}
-
+
public String attributeMappingKey() {
return IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String label() {
- return "Default (" + JptUiMappingsMessages.PersistentAttributePage_BasicLabel + ")";
+ return NLS.bind(
+ JptUiMappingsMessages.DefaultBasicMappingUiProvider_Default,
+ JptUiMappingsMessages.PersistentAttributePage_BasicLabel
+ );
}
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createBasicMappingComposite(parent, commandStack, widgetFactory);
+
+ public IJpaComposite<IBasicMapping> buildAttributeMappingComposite(IJpaUiFactory factory,
+ PropertyValueModel<IBasicMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return factory.createBasicMappingComposite(subjectHolder, parent, widgetFactory);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultEmbeddedMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultEmbeddedMappingUiProvider.java
index f8c882dba3..0f7f9c8146 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultEmbeddedMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/DefaultEmbeddedMappingUiProvider.java
@@ -3,23 +3,25 @@
* 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
public class DefaultEmbeddedMappingUiProvider
- implements IAttributeMappingUiProvider
+ implements IAttributeMappingUiProvider<IEmbeddedMapping>
{
// singleton
private static final DefaultEmbeddedMappingUiProvider INSTANCE = new DefaultEmbeddedMappingUiProvider();
@@ -27,7 +29,7 @@ public class DefaultEmbeddedMappingUiProvider
/**
* Return the singleton.
*/
- public static IAttributeMappingUiProvider instance() {
+ public static IAttributeMappingUiProvider<IEmbeddedMapping> instance() {
return INSTANCE;
}
@@ -37,16 +39,24 @@ public class DefaultEmbeddedMappingUiProvider
private DefaultEmbeddedMappingUiProvider() {
super();
}
-
+
public String attributeMappingKey() {
return IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String label() {
- return "Default (" + JptUiMappingsMessages.PersistentAttributePage_EmbeddedLabel + ")";
+ return NLS.bind(
+ JptUiMappingsMessages.DefaultEmbeddedMappingUiProvider_Default,
+ JptUiMappingsMessages.PersistentAttributePage_EmbeddedLabel
+ );
}
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createEmbeddedMappingComposite(parent, commandStack, widgetFactory);
+
+ public IJpaComposite<IEmbeddedMapping> buildAttributeMappingComposite(
+ IJpaUiFactory factory,
+ PropertyValueModel<IEmbeddedMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return factory.createEmbeddedMappingComposite(subjectHolder, parent, widgetFactory);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddableUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddableUiProvider.java
index b15444d07a..62dc32fa34 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddableUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddableUiProvider.java
@@ -3,22 +3,23 @@
* 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddable;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.mappings.details.EmbeddableComposite;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class EmbeddableUiProvider implements ITypeMappingUiProvider
+public class EmbeddableUiProvider implements ITypeMappingUiProvider<IEmbeddable>
{
// singleton
private static final EmbeddableUiProvider INSTANCE = new EmbeddableUiProvider();
@@ -26,7 +27,7 @@ public class EmbeddableUiProvider implements ITypeMappingUiProvider
/**
* Return the singleton.
*/
- public static ITypeMappingUiProvider instance() {
+ public static ITypeMappingUiProvider<IEmbeddable> instance() {
return INSTANCE;
}
@@ -40,13 +41,16 @@ public class EmbeddableUiProvider implements ITypeMappingUiProvider
public String mappingKey() {
return IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
}
-
+
public String label() {
return JptUiMappingsMessages.PersistentTypePage_EmbeddableLabel;
}
-
- public IJpaComposite buildPersistentTypeMappingComposite(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new EmbeddableComposite(parent, commandStack, widgetFactory);
+
+ public IJpaComposite<IEmbeddable> buildPersistentTypeMappingComposite(
+ PropertyValueModel<IEmbeddable> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return new EmbeddableComposite(subjectHolder, parent, widgetFactory);
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedIdMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedIdMappingUiProvider.java
index 65b4665844..ea5c609e89 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedIdMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedIdMappingUiProvider.java
@@ -3,32 +3,33 @@
* 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
public class EmbeddedIdMappingUiProvider
- implements IAttributeMappingUiProvider
+ implements IAttributeMappingUiProvider<IEmbeddedIdMapping>
{
-
+
// singleton
private static final EmbeddedIdMappingUiProvider INSTANCE = new EmbeddedIdMappingUiProvider();
/**
* Return the singleton.
*/
- public static IAttributeMappingUiProvider instance() {
+ public static IAttributeMappingUiProvider<IEmbeddedIdMapping> instance() {
return INSTANCE;
}
@@ -42,12 +43,17 @@ public class EmbeddedIdMappingUiProvider
public String attributeMappingKey() {
return IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String label() {
return JptUiMappingsMessages.PersistentAttributePage_EmbeddedIdLabel;
}
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createEmbeddedIdMappingComposite(parent, commandStack, widgetFactory);
+
+ public IJpaComposite<IEmbeddedIdMapping> buildAttributeMappingComposite(
+ IJpaUiFactory factory,
+ PropertyValueModel<IEmbeddedIdMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return factory.createEmbeddedIdMappingComposite(subjectHolder, parent, widgetFactory);
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedMappingUiProvider.java
index e5387c4290..47c3688b22 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EmbeddedMappingUiProvider.java
@@ -3,32 +3,33 @@
* 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
public class EmbeddedMappingUiProvider
- implements IAttributeMappingUiProvider
+ implements IAttributeMappingUiProvider<IEmbeddedMapping>
{
-
+
// singleton
private static final EmbeddedMappingUiProvider INSTANCE = new EmbeddedMappingUiProvider();
/**
* Return the singleton.
*/
- public static IAttributeMappingUiProvider instance() {
+ public static IAttributeMappingUiProvider<IEmbeddedMapping> instance() {
return INSTANCE;
}
@@ -42,12 +43,17 @@ public class EmbeddedMappingUiProvider
public String attributeMappingKey() {
return IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String label() {
return JptUiMappingsMessages.PersistentAttributePage_EmbeddedLabel;
}
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createEmbeddedMappingComposite(parent, commandStack, widgetFactory);
+
+ public IJpaComposite<IEmbeddedMapping> buildAttributeMappingComposite(
+ IJpaUiFactory factory,
+ PropertyValueModel<IEmbeddedMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return factory.createEmbeddedMappingComposite(subjectHolder, parent, widgetFactory);
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EntityUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EntityUiProvider.java
index 64c4c2a55e..feb4242d7d 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EntityUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/EntityUiProvider.java
@@ -3,22 +3,23 @@
* 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.mappings.details.EntityComposite;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class EntityUiProvider implements ITypeMappingUiProvider
+public class EntityUiProvider implements ITypeMappingUiProvider<IEntity>
{
// singleton
private static final EntityUiProvider INSTANCE = new EntityUiProvider();
@@ -26,7 +27,7 @@ public class EntityUiProvider implements ITypeMappingUiProvider
/**
* Return the singleton.
*/
- public static ITypeMappingUiProvider instance() {
+ public static ITypeMappingUiProvider<IEntity> instance() {
return INSTANCE;
}
@@ -40,13 +41,16 @@ public class EntityUiProvider implements ITypeMappingUiProvider
public String mappingKey() {
return IMappingKeys.ENTITY_TYPE_MAPPING_KEY;
}
-
+
public String label() {
return JptUiMappingsMessages.PersistentTypePage_EntityLabel;
}
-
- public IJpaComposite buildPersistentTypeMappingComposite(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new EntityComposite(parent, commandStack, widgetFactory);
+
+ public IJpaComposite<IEntity> buildPersistentTypeMappingComposite(
+ PropertyValueModel<IEntity> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return new EntityComposite(subjectHolder, parent, widgetFactory);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/IdMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/IdMappingUiProvider.java
index 2d1dafd6f7..996b1b7e08 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/IdMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/IdMappingUiProvider.java
@@ -3,23 +3,24 @@
* 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
public class IdMappingUiProvider
- implements IAttributeMappingUiProvider
+ implements IAttributeMappingUiProvider<IIdMapping>
{
// singleton
private static final IdMappingUiProvider INSTANCE = new IdMappingUiProvider();
@@ -27,7 +28,7 @@ public class IdMappingUiProvider
/**
* Return the singleton.
*/
- public static IAttributeMappingUiProvider instance() {
+ public static IAttributeMappingUiProvider<IIdMapping> instance() {
return INSTANCE;
}
@@ -41,12 +42,17 @@ public class IdMappingUiProvider
public String attributeMappingKey() {
return IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String label() {
return JptUiMappingsMessages.PersistentAttributePage_IdLabel;
}
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createIdMappingComposite(parent, commandStack, widgetFactory);
+ public IJpaComposite<IIdMapping> buildAttributeMappingComposite(
+ IJpaUiFactory factory,
+ PropertyValueModel<IIdMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return factory.createIdMappingComposite(subjectHolder, parent, widgetFactory);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToManyMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToManyMappingUiProvider.java
index 286c454427..a76292585c 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToManyMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToManyMappingUiProvider.java
@@ -3,23 +3,24 @@
* 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping;
import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
public class ManyToManyMappingUiProvider
- implements IAttributeMappingUiProvider
+ implements IAttributeMappingUiProvider<IManyToManyMapping>
{
// singleton
private static final ManyToManyMappingUiProvider INSTANCE = new ManyToManyMappingUiProvider();
@@ -27,7 +28,7 @@ public class ManyToManyMappingUiProvider
/**
* Return the singleton.
*/
- public static IAttributeMappingUiProvider instance() {
+ public static IAttributeMappingUiProvider<IManyToManyMapping> instance() {
return INSTANCE;
}
@@ -41,12 +42,17 @@ public class ManyToManyMappingUiProvider
public String attributeMappingKey() {
return IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String label() {
return JptUiMappingsMessages.PersistentAttributePage_ManyToManyLabel;
}
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createManyToManyMappingComposite(parent, commandStack, widgetFactory);
+ public IJpaComposite<IManyToManyMapping> buildAttributeMappingComposite(
+ IJpaUiFactory factory,
+ PropertyValueModel<IManyToManyMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return factory.createManyToManyMappingComposite(subjectHolder, parent, widgetFactory);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToOneMappingUiProvider.java
index ea619de917..8c002cc4f8 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToOneMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/ManyToOneMappingUiProvider.java
@@ -3,23 +3,24 @@
* 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping;
import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
public class ManyToOneMappingUiProvider
- implements IAttributeMappingUiProvider
+ implements IAttributeMappingUiProvider<IManyToOneMapping>
{
// singleton
private static final ManyToOneMappingUiProvider INSTANCE = new ManyToOneMappingUiProvider();
@@ -27,7 +28,7 @@ public class ManyToOneMappingUiProvider
/**
* Return the singleton.
*/
- public static IAttributeMappingUiProvider instance() {
+ public static IAttributeMappingUiProvider<IManyToOneMapping> instance() {
return INSTANCE;
}
@@ -41,12 +42,17 @@ public class ManyToOneMappingUiProvider
public String attributeMappingKey() {
return IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String label() {
return JptUiMappingsMessages.PersistentAttributePage_ManyToOneLabel;
}
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createManyToOneMappingComposite(parent, commandStack, widgetFactory);
+ public IJpaComposite<IManyToOneMapping> buildAttributeMappingComposite(
+ IJpaUiFactory factory,
+ PropertyValueModel<IManyToOneMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return factory.createManyToOneMappingComposite(subjectHolder, parent, widgetFactory);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/MappedSuperclassUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/MappedSuperclassUiProvider.java
index e15397c483..13db3419e4 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/MappedSuperclassUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/MappedSuperclassUiProvider.java
@@ -3,22 +3,23 @@
* 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IMappedSuperclass;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
import org.eclipse.jpt.ui.internal.mappings.details.MappedSuperclassComposite;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class MappedSuperclassUiProvider implements ITypeMappingUiProvider
+public class MappedSuperclassUiProvider implements ITypeMappingUiProvider<IMappedSuperclass>
{
// singleton
private static final MappedSuperclassUiProvider INSTANCE = new MappedSuperclassUiProvider();
@@ -26,7 +27,7 @@ public class MappedSuperclassUiProvider implements ITypeMappingUiProvider
/**
* Return the singleton.
*/
- public static ITypeMappingUiProvider instance() {
+ public static ITypeMappingUiProvider<IMappedSuperclass> instance() {
return INSTANCE;
}
@@ -40,12 +41,16 @@ public class MappedSuperclassUiProvider implements ITypeMappingUiProvider
public String mappingKey() {
return IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
}
-
+
public String label() {
return JptUiMappingsMessages.PersistentTypePage_MappedSuperclassLabel;
}
- public IJpaComposite buildPersistentTypeMappingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new MappedSuperclassComposite(parent, commandStack, widgetFactory);
+ public IJpaComposite<IMappedSuperclass> buildPersistentTypeMappingComposite(
+ PropertyValueModel<IMappedSuperclass> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return new MappedSuperclassComposite(subjectHolder, parent, widgetFactory);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullAttributeMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullAttributeMappingUiProvider.java
index ca2907b5ce..511e925934 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullAttributeMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullAttributeMappingUiProvider.java
@@ -1,35 +1,35 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
-import org.eclipse.swt.SWT;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+@SuppressWarnings("nls")
public class NullAttributeMappingUiProvider
- implements IAttributeMappingUiProvider
+ implements IAttributeMappingUiProvider<IAttributeMapping>
{
-
+
// singleton
private static final NullAttributeMappingUiProvider INSTANCE = new NullAttributeMappingUiProvider();
/**
* Return the singleton.
*/
- public static IAttributeMappingUiProvider instance() {
+ public static IAttributeMappingUiProvider<IAttributeMapping> instance() {
return INSTANCE;
}
@@ -41,36 +41,47 @@ public class NullAttributeMappingUiProvider
}
+ /*
+ * (non-Javadoc)
+ */
public String attributeMappingKey() {
return null;
}
-
+
+ /*
+ * (non-Javadoc)
+ */
public String label() {
return "";
}
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new NullComposite(parent);
+
+ /*
+ * (non-Javadoc)
+ */
+ public IJpaComposite<IAttributeMapping> buildAttributeMappingComposite(
+ IJpaUiFactory factory,
+ PropertyValueModel<IAttributeMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return new NullComposite(subjectHolder, parent, widgetFactory);
}
-
-
- public static class NullComposite extends Composite
- implements IJpaComposite
- {
- NullComposite(Composite parent) {
- super(parent, SWT.NONE);
- }
-
- public void populate(EObject model) {
- // no op
+
+ public static class NullComposite extends AbstractFormPane<IAttributeMapping>
+ implements IJpaComposite<IAttributeMapping>{
+
+ NullComposite(PropertyValueModel<IAttributeMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- public void dispose() {
- super.dispose();
- }
- public Control getControl() {
- return this;
+ protected void initializeLayout(Composite container) {
}
- }
+ }
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullTypeMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullTypeMappingUiProvider.java
index 1b44936878..88356d1735 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullTypeMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/NullTypeMappingUiProvider.java
@@ -3,22 +3,23 @@
* 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class NullTypeMappingUiProvider implements ITypeMappingUiProvider
+@SuppressWarnings("nls")
+public class NullTypeMappingUiProvider implements ITypeMappingUiProvider<ITypeMapping>
{
// singleton
private static final NullTypeMappingUiProvider INSTANCE = new NullTypeMappingUiProvider();
@@ -26,7 +27,7 @@ public class NullTypeMappingUiProvider implements ITypeMappingUiProvider
/**
* Return the singleton.
*/
- public static ITypeMappingUiProvider instance() {
+ public static ITypeMappingUiProvider<ITypeMapping> instance() {
return INSTANCE;
}
@@ -36,39 +37,42 @@ public class NullTypeMappingUiProvider implements ITypeMappingUiProvider
private NullTypeMappingUiProvider() {
super();
}
-
+
public String mappingKey() {
return null;
}
-
+
public String label() {
return "";
}
-
- public IJpaComposite buildPersistentTypeMappingComposite(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ public IJpaComposite<ITypeMapping> buildPersistentTypeMappingComposite(
+ PropertyValueModel<ITypeMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
return new NullComposite(parent);
}
-
-
- public static class NullComposite extends Composite
- implements IJpaComposite
+
+
+ public static class NullComposite extends Composite
+ implements IJpaComposite<ITypeMapping>
{
private Composite composite;
NullComposite(Composite parent) {
super(parent, SWT.NONE);
this.composite = new Composite(parent, SWT.NONE);
}
-
- public void populate(EObject model) {
+
+ public void populate() {
// no op
}
-
+
@Override
public void dispose() {
super.dispose();
}
-
+
public Control getControl() {
return this.composite;
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToManyMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToManyMappingUiProvider.java
index cc9fd85c26..cc53b9ff90 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToManyMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToManyMappingUiProvider.java
@@ -3,23 +3,24 @@
* 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping;
import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
public class OneToManyMappingUiProvider
- implements IAttributeMappingUiProvider
+ implements IAttributeMappingUiProvider<IOneToManyMapping>
{
// singleton
private static final OneToManyMappingUiProvider INSTANCE = new OneToManyMappingUiProvider();
@@ -27,7 +28,7 @@ public class OneToManyMappingUiProvider
/**
* Return the singleton.
*/
- public static IAttributeMappingUiProvider instance() {
+ public static IAttributeMappingUiProvider<IOneToManyMapping> instance() {
return INSTANCE;
}
@@ -41,12 +42,17 @@ public class OneToManyMappingUiProvider
public String attributeMappingKey() {
return IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String label() {
return JptUiMappingsMessages.PersistentAttributePage_OneToManyLabel;
}
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createOneToManyMappingComposite(parent, commandStack, widgetFactory);
+ public IJpaComposite<IOneToManyMapping> buildAttributeMappingComposite(
+ IJpaUiFactory factory,
+ PropertyValueModel<IOneToManyMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return factory.createOneToManyMappingComposite(subjectHolder, parent, widgetFactory);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToOneMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToOneMappingUiProvider.java
index d59e50ca32..5911e92c98 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToOneMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/OneToOneMappingUiProvider.java
@@ -3,32 +3,33 @@
* 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping;
import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
public class OneToOneMappingUiProvider
- implements IAttributeMappingUiProvider
+ implements IAttributeMappingUiProvider<IOneToOneMapping>
{
-
+
// singleton
private static final OneToOneMappingUiProvider INSTANCE = new OneToOneMappingUiProvider();
/**
* Return the singleton.
*/
- public static IAttributeMappingUiProvider instance() {
+ public static IAttributeMappingUiProvider<IOneToOneMapping> instance() {
return INSTANCE;
}
@@ -42,12 +43,17 @@ public class OneToOneMappingUiProvider
public String attributeMappingKey() {
return IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String label() {
return JptUiMappingsMessages.PersistentAttributePage_OneToOneLabel;
}
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createOneToOneMappingComposite(parent, commandStack, widgetFactory);
+
+ public IJpaComposite<IOneToOneMapping> buildAttributeMappingComposite(
+ IJpaUiFactory factory,
+ PropertyValueModel<IOneToOneMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return factory.createOneToOneMappingComposite(subjectHolder, parent, widgetFactory);
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/TransientMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/TransientMappingUiProvider.java
index 10d679d8da..12de4a399a 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/TransientMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/TransientMappingUiProvider.java
@@ -3,32 +3,33 @@
* 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
public class TransientMappingUiProvider
- implements IAttributeMappingUiProvider
+ implements IAttributeMappingUiProvider<ITransientMapping>
{
-
+
// singleton
private static final TransientMappingUiProvider INSTANCE = new TransientMappingUiProvider();
/**
* Return the singleton.
*/
- public static IAttributeMappingUiProvider instance() {
+ public static IAttributeMappingUiProvider<ITransientMapping> instance() {
return INSTANCE;
}
@@ -42,12 +43,17 @@ public class TransientMappingUiProvider
public String attributeMappingKey() {
return IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String label() {
return JptUiMappingsMessages.PersistentAttributePage_TransientLabel;
}
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createTransientMappingComposite(parent, commandStack, widgetFactory);
+
+ public IJpaComposite<ITransientMapping> buildAttributeMappingComposite(
+ IJpaUiFactory factory,
+ PropertyValueModel<ITransientMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return factory.createTransientMappingComposite(subjectHolder, parent, widgetFactory);
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/VersionMappingUiProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/VersionMappingUiProvider.java
index 67f4d523f1..35950bf8fe 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/VersionMappingUiProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/mappings/properties/VersionMappingUiProvider.java
@@ -3,32 +3,33 @@
* 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.ui.internal.java.mappings.properties;
-import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IVersionMapping;
import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
public class VersionMappingUiProvider
- implements IAttributeMappingUiProvider
+ implements IAttributeMappingUiProvider<IVersionMapping>
{
-
+
// singleton
private static final VersionMappingUiProvider INSTANCE = new VersionMappingUiProvider();
/**
* Return the singleton.
*/
- public static IAttributeMappingUiProvider instance() {
+ public static IAttributeMappingUiProvider<IVersionMapping> instance() {
return INSTANCE;
}
@@ -42,12 +43,17 @@ public class VersionMappingUiProvider
public String attributeMappingKey() {
return IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
}
-
+
public String label() {
return JptUiMappingsMessages.PersistentAttributePage_VersionLabel;
}
-
- public IJpaComposite buildAttributeMappingComposite(IJpaUiFactory factory, Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return factory.createVersionMappingComposite(parent, commandStack, widgetFactory);
+
+ public IJpaComposite<IVersionMapping> buildAttributeMappingComposite(
+ IJpaUiFactory factory,
+ PropertyValueModel<IVersionMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ return factory.createVersionMappingComposite(subjectHolder, parent, widgetFactory);
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaCompilationUnitItemProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaCompilationUnitItemProvider.java
deleted file mode 100644
index ba60ac46d8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaCompilationUnitItemProvider.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ui.internal.java.structure;
-
-import java.util.Collection;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-import org.eclipse.jpt.core.internal.content.java.JpaCompilationUnit;
-import org.eclipse.jpt.core.internal.content.java.JpaJavaPackage;
-
-public class JavaCompilationUnitItemProvider extends ItemProviderAdapter
- implements IEditingDomainItemProvider,
- IStructuredItemContentProvider,
- ITreeItemContentProvider,
- IItemLabelProvider
-{
- public JavaCompilationUnitItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- @Override
- protected Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
- if (this.childrenFeatures == null) {
- super.getChildrenFeatures(object);
- this.childrenFeatures.add(JpaJavaPackage.Literals.JPA_COMPILATION_UNIT__TYPES);
- }
- return this.childrenFeatures;
- }
-
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(JpaCompilationUnit.class)) {
- case JpaJavaPackage.JPA_COMPILATION_UNIT__TYPES:
- fireNotifyChanged(
- new ViewerNotification(
- notification, notification.getNotifier(), true, false));
- return;
- }
-
- super.notifyChanged(notification);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaPersistentAttributeItemProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaPersistentAttributeItemProvider.java
deleted file mode 100644
index 902c83233e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaPersistentAttributeItemProvider.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ui.internal.java.structure;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddedId;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.IManyToMany;
-import org.eclipse.jpt.core.internal.mappings.IManyToOne;
-import org.eclipse.jpt.core.internal.mappings.IOneToMany;
-import org.eclipse.jpt.core.internal.mappings.IOneToOne;
-import org.eclipse.jpt.core.internal.mappings.ITransient;
-import org.eclipse.jpt.core.internal.mappings.IVersion;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsImages;
-
-public class JavaPersistentAttributeItemProvider extends ItemProviderAdapter
- implements IEditingDomainItemProvider,
- IStructuredItemContentProvider,
- ITreeItemContentProvider,
- IItemLabelProvider
-{
- public JavaPersistentAttributeItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- @Override
- public Object getImage(Object object) {
- IAttributeMapping mapping = ((IPersistentAttribute) object).getMapping();
-
- if (mapping instanceof IBasic) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.BASIC);
- }
- else if (mapping instanceof IId) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.ID);
- }
- else if (mapping instanceof IVersion) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.VERSION);
- }
- else if (mapping instanceof IEmbedded) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.EMBEDDED);
- }
- else if (mapping instanceof IEmbeddedId) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.EMBEDDED_ID);
- }
- else if (mapping instanceof IOneToOne) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.ONE_TO_ONE);
- }
- else if (mapping instanceof IOneToMany) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.ONE_TO_MANY);
- }
- else if (mapping instanceof IManyToOne) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.MANY_TO_ONE);
- }
- else if (mapping instanceof IManyToMany) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.MANY_TO_MANY);
- }
- else if (mapping instanceof ITransient) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.TRANSIENT);
- }
- else {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.NULL_ATTRIBUTE_MAPPING);
- }
- }
-
- @Override
- public String getText(Object object) {
- return ((IPersistentAttribute) object).getName();
- }
-
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(IPersistentAttribute.class)) {
- case JpaCorePackage.IPERSISTENT_ATTRIBUTE__MAPPING:
- fireNotifyChanged(new ViewerNotification(notification, notification
- .getNotifier(), false, true));
- return;
- }
- super.notifyChanged(notification);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaPersistentTypeItemProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaPersistentTypeItemProvider.java
deleted file mode 100644
index c1cd5bb875..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaPersistentTypeItemProvider.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ui.internal.java.structure;
-
-import java.util.Collection;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.content.java.JpaJavaPackage;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddable;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IMappedSuperclass;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsImages;
-
-public class JavaPersistentTypeItemProvider extends ItemProviderAdapter
- implements IEditingDomainItemProvider,
- IStructuredItemContentProvider,
- ITreeItemContentProvider,
- IItemLabelProvider
-{
- public JavaPersistentTypeItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
-
- @Override
- protected Collection getChildrenFeatures(Object object) {
- if (childrenFeatures == null) {
- super.getChildrenFeatures(object);
- childrenFeatures.add(JpaJavaPackage.Literals.JAVA_PERSISTENT_TYPE__ATTRIBUTES);
- }
- return childrenFeatures;
- }
-
- @Override
- public Object getImage(Object object) {
- ITypeMapping mapping = ((IPersistentType) object).getMapping();
-
-
- if (mapping instanceof IEntity) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.ENTITY);
- }
- else if (mapping instanceof IEmbeddable) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.EMBEDDABLE);
- }
- else if (mapping instanceof IMappedSuperclass) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.MAPPED_SUPERCLASS);
- }
- else {
- return null;
- }
- }
-
- @Override
- public String getText(Object object) {
- IType type = ((IPersistentType) object).findJdtType();
- return (type == null) ? "" : type.getElementName();
- }
-
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(JavaPersistentType.class)) {
- case JpaCorePackage.IPERSISTENT_TYPE__MAPPING_KEY:
- fireNotifyChanged(
- new ViewerNotification(
- notification, notification.getNotifier(), false, true));
- return;
-
- case JpaJavaPackage.JAVA_PERSISTENT_TYPE__ATTRIBUTES:
- fireNotifyChanged(
- new ViewerNotification(
- notification, notification.getNotifier(), true, false));
- return;
- }
-
- super.notifyChanged(notification);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaStructureProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaStructureProvider.java
deleted file mode 100644
index a1af28c175..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JavaStructureProvider.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ui.internal.java.structure;
-
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jpt.ui.internal.structure.IJpaStructureProvider;
-
-public class JavaStructureProvider implements IJpaStructureProvider
-{
- public String fileContentType() {
- return JavaCore.JAVA_SOURCE_CONTENT_TYPE;
- }
-
- public ITreeContentProvider buildContentProvider() {
- return new AdapterFactoryContentProvider(new JpaCoreJavaItemProviderAdapterFactory());
- }
-
- public ILabelProvider buildLabelProvider() {
- return new AdapterFactoryLabelProvider(new JpaCoreJavaItemProviderAdapterFactory());
- }
-
- public void dispose() {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JpaCoreJavaItemProviderAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JpaCoreJavaItemProviderAdapterFactory.java
deleted file mode 100644
index 730853482c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/java/structure/JpaCoreJavaItemProviderAdapterFactory.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ui.internal.java.structure;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.edit.provider.ChangeNotifier;
-import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.IChangeNotifier;
-import org.eclipse.emf.edit.provider.IDisposable;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.INotifyChangedListener;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.jpt.core.internal.content.java.util.JpaJavaAdapterFactory;
-
-/**
- * This is the factory that is used to provide the interfaces needed to support Viewers.
- * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
- * The adapters also support Eclipse property sheets.
- * Note that most of the adapters are shared among multiple instances.
- */
-public class JpaCoreJavaItemProviderAdapterFactory
- extends JpaJavaAdapterFactory
- implements ComposeableAdapterFactory,
- IChangeNotifier,
- IDisposable
-{
- /**
- * This keeps track of the root adapter factory that delegates to this adapter factory.
- */
- protected ComposedAdapterFactory parentAdapterFactory;
-
- /**
- * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
- */
- protected IChangeNotifier changeNotifier = new ChangeNotifier();
-
- /**
- * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
- */
- protected Collection supportedTypes = new ArrayList();
-
-
- public JpaCoreJavaItemProviderAdapterFactory() {
- supportedTypes.add(IEditingDomainItemProvider.class);
- supportedTypes.add(IStructuredItemContentProvider.class);
- supportedTypes.add(ITreeItemContentProvider.class);
- supportedTypes.add(IItemLabelProvider.class);
- }
-
-
- protected JavaCompilationUnitItemProvider javaCompilationUnitItemProvider;
-
- public Adapter createJpaCompilationUnitAdapter() {
- if (javaCompilationUnitItemProvider == null) {
- javaCompilationUnitItemProvider = new JavaCompilationUnitItemProvider(this);
- }
-
- return javaCompilationUnitItemProvider;
- }
-
- protected JavaPersistentTypeItemProvider javaPersistentTypeItemProvider;
-
- public Adapter createJavaPersistentTypeAdapter() {
- if (javaPersistentTypeItemProvider == null) {
- javaPersistentTypeItemProvider = new JavaPersistentTypeItemProvider(this);
- }
-
- return javaPersistentTypeItemProvider;
- }
-
- protected JavaPersistentAttributeItemProvider javaPersistentAttributeItemProvider;
-
- public Adapter createJavaPersistentAttributeAdapter() {
- if (javaPersistentAttributeItemProvider == null) {
- javaPersistentAttributeItemProvider = new JavaPersistentAttributeItemProvider(
- this);
- }
-
- return javaPersistentAttributeItemProvider;
- }
-
- /**
- * This returns the root adapter factory that contains this factory.
- */
- public ComposeableAdapterFactory getRootAdapterFactory() {
- return parentAdapterFactory == null ?
- this :
- parentAdapterFactory.getRootAdapterFactory();
- }
-
- /**
- * This sets the composed adapter factory that contains this factory.
- */
- public void setParentAdapterFactory(
- ComposedAdapterFactory parentAdapterFactory) {
- this.parentAdapterFactory = parentAdapterFactory;
- }
-
- public boolean isFactoryForType(Object type) {
- return supportedTypes.contains(type) || super.isFactoryForType(type);
- }
-
- /**
- * This implementation substitutes the factory itself as the key for the adapter.
- */
- public Adapter adapt(Notifier notifier, Object type) {
- return super.adapt(notifier, this);
- }
-
- public Object adapt(Object object, Object type) {
- if (isFactoryForType(type)) {
- Object adapter = super.adapt(object, type);
- if (!(type instanceof Class)
- || (((Class) type).isInstance(adapter))) {
- return adapter;
- }
- }
-
- return null;
- }
-
- /**
- * This adds a listener.
- */
- public void addListener(INotifyChangedListener notifyChangedListener) {
- changeNotifier.addListener(notifyChangedListener);
- }
-
- /**
- * This removes a listener.
- */
- public void removeListener(INotifyChangedListener notifyChangedListener) {
- changeNotifier.removeListener(notifyChangedListener);
- }
-
- /**
- * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
- */
- public void fireNotifyChanged(Notification notification) {
- changeNotifier.fireNotifyChanged(notification);
-
- if (parentAdapterFactory != null) {
- parentAdapterFactory.fireNotifyChanged(notification);
- }
- }
-
- /**
- * This disposes all of the item providers created by this factory.
- */
- public void dispose() {
- if (javaCompilationUnitItemProvider != null) {
- javaCompilationUnitItemProvider.dispose();
- }
- if (javaPersistentTypeItemProvider != null) {
- javaPersistentTypeItemProvider.dispose();
- }
- if (javaPersistentAttributeItemProvider != null) {
- javaPersistentAttributeItemProvider.dispose();
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/AbstractItemLabelProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/AbstractItemLabelProvider.java
new file mode 100644
index 0000000000..f1471b3148
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/AbstractItemLabelProvider.java
@@ -0,0 +1,153 @@
+package org.eclipse.jpt.ui.internal.jface;
+
+import org.eclipse.jpt.utility.internal.model.Model;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Implementation of {@link IItemLabelProvider} that provides updating
+ * label information for a Model object.
+ *
+ * The typical subclass will override the following methods:
+ * #buildTextModel()
+ * return a {@link PropertyValueModel} that represents the text for the represented
+ * model object.
+ * #buildImageModel()
+ * return a {@link PropertyValueModel} that represents the image for the represented
+ * model object
+ *
+ * Other methods may be overridden, but take care to preserve the logic provided
+ * by this class.
+ */
+public abstract class AbstractItemLabelProvider implements IItemLabelProvider
+{
+ private DelegatingContentAndLabelProvider labelProvider;
+
+ private Model model;
+
+ private PropertyValueModel<String> textModel;
+
+ private PropertyValueModel<Image> imageModel;
+
+ private PropertyChangeListener labelChangeListener;
+
+
+ protected AbstractItemLabelProvider(
+ Model model, DelegatingContentAndLabelProvider labelProvider) {
+ this.model = model;
+ this.labelProvider = labelProvider;
+ this.labelChangeListener = buildLabelChangeListener();
+ }
+
+
+ /**
+ * Construct a listener to update the viewer (through the label provider)
+ * if the text or image changes
+ */
+ protected PropertyChangeListener buildLabelChangeListener() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent event) {
+ labelProvider().updateLabel(model());
+ }
+ };
+ }
+
+ /**
+ * Return the text value model
+ * (lazy and just-in-time initialized)
+ */
+ protected PropertyValueModel<String> textModel() {
+ if (textModel == null) {
+ textModel = buildTextModel();
+ engageTextModel();
+ }
+ return textModel;
+ }
+
+ /**
+ * Construct a text value model
+ */
+ protected abstract PropertyValueModel<String> buildTextModel();
+
+ /**
+ * Should only be overridden with a call to super.engageTextModel() before
+ * subclass logic
+ */
+ protected void engageTextModel() {
+ textModel.addPropertyChangeListener(PropertyValueModel.VALUE, labelChangeListener);
+ }
+
+ /**
+ * Should only be overridden with a call to super.disengageTextModel() after
+ * subclass logic
+ */
+ protected void disengageTextModel() {
+ if (textModel != null) {
+ textModel.removePropertyChangeListener(PropertyValueModel.VALUE, labelChangeListener);
+ }
+ }
+
+ /**
+ * Return the image value model
+ * (lazy and just-in-time initialized)
+ */
+ protected PropertyValueModel<Image> imageModel() {
+ if (imageModel == null) {
+ imageModel = buildImageModel();
+ engageImageModel();
+ }
+ return imageModel;
+ }
+
+ /**
+ * Construct an image model
+ */
+ protected abstract PropertyValueModel<Image> buildImageModel();
+
+ /**
+ * Should only be overridden with a call to super.engageImageModel() before
+ * subclass logic
+ */
+ protected void engageImageModel() {
+ imageModel.addPropertyChangeListener(PropertyValueModel.VALUE, labelChangeListener);
+ }
+
+ /**
+ * Should only be overridden with a call to super.disengageImageModel() after
+ * subclass logic
+ */
+ protected void disengageImageModel() {
+ if (imageModel != null) {
+ imageModel.removePropertyChangeListener(PropertyValueModel.VALUE, labelChangeListener);
+ }
+ }
+
+ /**
+ * Return the model object represented by this item
+ */
+ public Model model() {
+ return model;
+ }
+
+ /**
+ * Return the label provider that delegates to this item
+ */
+ public DelegatingContentAndLabelProvider labelProvider() {
+ return labelProvider;
+ }
+
+ public String text() {
+ return textModel().value();
+ }
+
+ public Image image() {
+ return imageModel().value();
+ }
+
+ public void dispose() {
+ disengageTextModel();
+ disengageImageModel();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/AbstractTreeItemContentProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/AbstractTreeItemContentProvider.java
new file mode 100644
index 0000000000..c20cfaf1bf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/AbstractTreeItemContentProvider.java
@@ -0,0 +1,207 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.jface;
+
+import java.util.Iterator;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.model.Model;
+import org.eclipse.jpt.utility.internal.model.event.ListChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.ListChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.CollectionListValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.NullListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyCollectionValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+
+/**
+ * Implementation of {@link ITreeItemContentProvider} that provides updating
+ * children information for a Model object.
+ *
+ * The typical subclass will override the following methods:
+ * #getParent()
+ * the default behavior for this method is to return null. there is no
+ * property value model for this as this should not be changing for a given
+ * node. all such changes will be provided by the parent side of the relationship.
+ * #buildChildrenModel()
+ * return a {@link ListValueModel} that represents the children for the represented
+ * model object. #buildChildrenModel(CollectionValueModel) and
+ * #buildChildrenModel(PropertyValueModel) are provided if the children are more
+ * easily represented as a collection or as a property (single child)
+ * the default behavior is to return a {@link NullListValueModel}
+ *
+ * Other methods may be overridden, but take care to preserve the logic provided
+ * by this class.
+ */
+public abstract class AbstractTreeItemContentProvider<E>
+ implements ITreeItemContentProvider
+{
+ private DelegatingTreeContentAndLabelProvider treeContentProvider;
+
+ private Model model;
+
+ private ListValueModel<E> childrenModel;
+
+ private ListChangeListener childrenListener;
+
+
+ protected AbstractTreeItemContentProvider(
+ Model model, DelegatingTreeContentAndLabelProvider treeContentProvider) {
+ this.model = model;
+ this.treeContentProvider = treeContentProvider;
+ this.childrenListener = buildChildrenListener();
+ }
+
+ /**
+ * Construct a listener to refresh the tree (through the tree content provider)
+ * if the children change
+ */
+ protected ListChangeListener buildChildrenListener() {
+ return new ListChangeListener() {
+ public void itemsAdded(ListChangeEvent event) {
+ treeContentProvider().updateContent(model());
+ }
+
+ public void itemsMoved(ListChangeEvent event) {
+ treeContentProvider().updateContent(model());
+ }
+
+ public void itemsRemoved(ListChangeEvent event) {
+ treeContentProvider().updateContent(model());
+ for (Iterator<?> stream = event.items(); stream.hasNext(); ) {
+ treeContentProvider().dispose(stream.next());
+ }
+ }
+
+ public void itemsReplaced(ListChangeEvent event) {
+ treeContentProvider().updateContent(model());
+ for (Iterator<?> stream = event.replacedItems(); stream.hasNext(); ) {
+ treeContentProvider().dispose(stream.next());
+ }
+ }
+
+ public void listChanged(ListChangeEvent event) {
+ treeContentProvider().updateContent(model());
+ // in the case of a list changed event, we don't have
+ // access to the removed objects, so we can't dispose them.
+ // keep a watch on this to see if this becomes a problem.
+ }
+
+ public void listCleared(ListChangeEvent event) {
+ treeContentProvider().updateContent(model());
+ // in the case of a list cleared event, we don't have
+ // access to the removed objects, so we can't dispose them.
+ // keep a watch on this to see if this becomes a problem.
+ }
+ };
+ }
+
+ /**
+ * Return the children model
+ * (lazy and just-in-time initialized)
+ */
+ protected ListValueModel<E> childrenModel() {
+ if (childrenModel == null) {
+ childrenModel = buildChildrenModel();
+ engageChildren();
+ }
+ return childrenModel;
+ }
+
+ /**
+ * Construct a children model
+ */
+ @SuppressWarnings("unchecked")
+ protected ListValueModel<E> buildChildrenModel() {
+ return new NullListValueModel();
+ }
+
+ /**
+ * Utility method that can be used if the children model is better represented
+ * as a collection.
+ * This wraps the children collection model and uses it internally as a list
+ * model.
+ */
+ protected ListValueModel<E> buildChildrenModel(CollectionValueModel<E> childrenModel) {
+ return new CollectionListValueModelAdapter<E>(childrenModel);
+ }
+
+ /**
+ * Utility method that can be used if the children model is better represented
+ * as a single value property.
+ * This wraps the children (child) property model and uses it internally as a list
+ * model.
+ */
+ protected ListValueModel<E> buildChildrenModel(PropertyValueModel<E> childrenModel) {
+ return buildChildrenModel(new PropertyCollectionValueModelAdapter<E>(childrenModel));
+ }
+
+ /**
+ * Return the model object represented by this node
+ */
+ public Model model() {
+ return model;
+ }
+
+ /**
+ * Return the tree content provider that delegates to this node
+ */
+ public DelegatingTreeContentAndLabelProvider treeContentProvider() {
+ return treeContentProvider;
+ }
+
+ public Object getParent() {
+ return null;
+ }
+
+ public Object[] getElements() {
+ return getChildren();
+ }
+
+ public Object[] getChildren() {
+ return CollectionTools.array(childrenModel().listIterator());
+ }
+
+ /**
+ * Override with potentially more efficient logic
+ */
+ public boolean hasChildren() {
+ return childrenModel().listIterator().hasNext();
+ }
+
+ /**
+ * Should only be overridden with a call to super.dispose()
+ */
+ public void dispose() {
+ for (Object child : getChildren()) {
+ treeContentProvider().dispose(child);
+ }
+ disengageChildren();
+ }
+
+ /**
+ * Should only be overridden with a call to super.engageChildren() before
+ * subclass logic
+ */
+ protected void engageChildren() {
+ childrenModel.addListChangeListener(ListValueModel.LIST_VALUES, childrenListener);
+ }
+
+ /**
+ * Should only be overridden with a call to super.disengageChildren() after
+ * subclass logic
+ */
+ protected void disengageChildren() {
+ if (childrenModel != null) {
+ childrenModel.removeListChangeListener(ListValueModel.LIST_VALUES, childrenListener);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/DelegatingContentAndLabelProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/DelegatingContentAndLabelProvider.java
new file mode 100644
index 0000000000..35294e85ea
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/DelegatingContentAndLabelProvider.java
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.jface;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Implementation of {@link IStructuredContentProvider} and {@link ILabelProvider} that
+ * maintains a collection (Map, actually) of {@link IItemContentProvider}
+ * delegates that perform the function of providing content and label information
+ * for each represented item
+ *
+ * NB: This class, if used as a label provider *MUST* be used as a content provider
+ * for the same viewer. It may be used as a content provider with a different
+ * label provider, however.
+ */
+public abstract class DelegatingContentAndLabelProvider extends BaseLabelProvider
+ implements IStructuredContentProvider, ILabelProvider
+{
+ private final IItemContentProviderFactory itemContentProviderFactory;
+
+ private final IItemLabelProviderFactory itemLabelProviderFactory;
+
+ private final Map<Object, IItemContentProvider> itemContentProviders;
+
+ private final Map<Object, IItemLabelProvider> itemLabelProviders;
+
+ private StructuredViewer viewer;
+
+
+ protected DelegatingContentAndLabelProvider(
+ IItemContentProviderFactory itemContentProviderFactory) {
+ this(itemContentProviderFactory, null);
+ }
+
+ protected DelegatingContentAndLabelProvider(
+ IItemContentProviderFactory itemContentProviderFactory,
+ IItemLabelProviderFactory itemLabelProviderFactory) {
+ super();
+ this.itemContentProviderFactory = itemContentProviderFactory;
+ this.itemLabelProviderFactory = itemLabelProviderFactory;
+ this.itemContentProviders = new HashMap<Object, IItemContentProvider>();
+ this.itemLabelProviders = new HashMap<Object, IItemLabelProvider>();
+ }
+
+
+ protected IItemContentProvider itemContentProvider(Object item) {
+ IItemContentProvider itemContentProvider = itemContentProviders.get(item);
+ if (itemContentProvider != null) {
+ return itemContentProvider;
+ }
+ itemContentProvider = itemContentProviderFactory.buildItemContentProvider(item, this);
+ if (itemContentProvider == null) {
+ return null;
+ }
+ itemContentProviders.put(item, itemContentProvider);
+ return itemContentProvider;
+ }
+
+ protected IItemLabelProvider itemLabelProvider(Object item) {
+ if (viewer == null) {
+ throw new IllegalStateException(
+ "This provider must be used as a content" +
+ "provider *as well as* a label provider.");
+ }
+ IItemLabelProvider itemLabelProvider = itemLabelProviders.get(item);
+ if (itemLabelProvider != null) {
+ return itemLabelProvider;
+ }
+ itemLabelProvider = itemLabelProviderFactory.buildItemLabelProvider(item, this);
+ if (itemLabelProvider == null) {
+ return null;
+ }
+ itemLabelProviders.put(item, itemLabelProvider);
+ return itemLabelProvider;
+ }
+
+
+ public Object[] getElements(Object inputElement) {
+ return itemContentProvider(inputElement).getElements();
+ }
+
+ public Image getImage(Object element) {
+ return itemLabelProvider(element).image();
+ }
+
+ public String getText(Object element) {
+ return itemLabelProvider(element).text();
+ }
+
+ /**
+ * Disposes all items
+ */
+ public void dispose() {
+ // coded this way to allow some item providers to dispose of their child
+ // elements without disrupting the entire process
+ while (! itemContentProviders.isEmpty()) {
+ dispose(itemContentProviders.keySet().iterator().next());
+ }
+ // this catches any items that weren't disposed from the content providers,
+ // though there most likely won't be any items represented here that
+ // haven't already been disposed
+ while (! itemLabelProviders.isEmpty()) {
+ dispose(itemLabelProviders.keySet().iterator().next());
+ }
+ }
+
+ /**
+ * Disposes item
+ */
+ protected void dispose(Object item) {
+ if (itemContentProviders.containsKey(item)) {
+ itemContentProviders.get(item).dispose();
+ itemContentProviders.remove(item);
+ }
+ if (itemLabelProviders.containsKey(item)) {
+ itemLabelProviders.get(item).dispose();
+ itemLabelProviders.remove(item);
+ }
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ if (oldInput != newInput) {
+ dispose();
+ }
+ this.viewer = (StructuredViewer) viewer;
+ }
+
+ /**
+ * Update the content for the given item
+ */
+ public void updateContent(final Object item) {
+ Runnable runnable = new Runnable() {
+ public void run() {
+ if (viewer != null && viewer.getControl() != null && !viewer.getControl().isDisposed()) {
+ viewer.refresh(item);
+ }
+ }
+ };
+ viewer.getControl().getDisplay().asyncExec(runnable);
+ }
+
+ /**
+ * Update the label for the given item
+ */
+ public void updateLabel(final Object item) {
+ Runnable runnable = new Runnable() {
+ public void run() {
+ if (viewer != null && viewer.getControl() != null && !viewer.getControl().isDisposed()) {
+ fireLabelProviderChanged(new LabelProviderChangedEvent(DelegatingContentAndLabelProvider.this, item));
+ }
+ }
+ };
+ viewer.getControl().getDisplay().asyncExec(runnable);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/DelegatingTreeContentAndLabelProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/DelegatingTreeContentAndLabelProvider.java
new file mode 100644
index 0000000000..b400887ccb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/DelegatingTreeContentAndLabelProvider.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.jface;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+
+/**
+ * Extension of {@link DelegatingContentAndLabelProvider} that provides an extension
+ * to provide tree content
+ */
+public class DelegatingTreeContentAndLabelProvider extends DelegatingContentAndLabelProvider
+ implements ITreeContentProvider
+{
+ public DelegatingTreeContentAndLabelProvider(
+ ITreeItemContentProviderFactory treeItemContentProviderFactory) {
+ super(treeItemContentProviderFactory);
+ }
+
+ public DelegatingTreeContentAndLabelProvider(
+ ITreeItemContentProviderFactory treeItemContentProviderFactory,
+ IItemLabelProviderFactory itemLabelProviderFactory) {
+ super(treeItemContentProviderFactory, itemLabelProviderFactory);
+ }
+
+
+ protected ITreeItemContentProvider itemContentProvider(Object item) {
+ return (ITreeItemContentProvider) super.itemContentProvider(item);
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ return itemContentProvider(parentElement).getChildren();
+ }
+
+ public Object getParent(Object element) {
+ return itemContentProvider(element).getParent();
+ }
+
+ public boolean hasChildren(Object element) {
+ return itemContentProvider(element).hasChildren();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/IItemContentProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/IItemContentProvider.java
new file mode 100644
index 0000000000..06589c7da7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/IItemContentProvider.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.jface;
+
+/**
+ * Marker interface used in conjunction with DelegatingContentProvider to return
+ * content information for a particular item.
+ * @see DelegatingContentProvider
+ * @see IItemContentProviderFactory
+ */
+public interface IItemContentProvider
+{
+ /**
+ * Return the elements of the represented item.
+ * Note that when this is called, the represented item is an input element.
+ */
+ Object[] getElements();
+
+ /**
+ * Dispose of this content provider, cleaning up all references, listeners, etc.
+ */
+ void dispose();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/IItemContentProviderFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/IItemContentProviderFactory.java
new file mode 100644
index 0000000000..4237b9b707
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/IItemContentProviderFactory.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.jface;
+
+/**
+ * Factory interface used to describe how to build {@link IItemContentProvider}s
+ * for a {@link DelegatingContentAndLabelProvider}
+ */
+public interface IItemContentProviderFactory
+{
+ IItemContentProvider buildItemContentProvider(Object item,
+ DelegatingContentAndLabelProvider contentAndLabelProvider);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/IItemLabelProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/IItemLabelProvider.java
new file mode 100644
index 0000000000..d59afdd16e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/IItemLabelProvider.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.jface;
+
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Interface used in conjunction with DelegatingLabelProvider to return
+ * label information for a particular item.
+ * @see DelegatingLabelProvider
+ * @see IItemLabelProviderFactory
+ */
+public interface IItemLabelProvider
+{
+ /**
+ * Return the image for the item
+ */
+ Image image();
+
+ /**
+ * Return the text for the item
+ */
+ public String text();
+
+ /**
+ * Dispose of this label provider, cleaning up all references, listeners, etc.
+ */
+ void dispose();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/IItemLabelProviderFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/IItemLabelProviderFactory.java
new file mode 100644
index 0000000000..4979ee32b7
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/IItemLabelProviderFactory.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.jface;
+
+/**
+ * Factory interface used to describe how to build IItemLabelProviders
+ * for a DelegatingContentAndLabelProvider
+ */
+public interface IItemLabelProviderFactory
+{
+ IItemLabelProvider buildItemLabelProvider(
+ Object item, DelegatingContentAndLabelProvider contentAndLabelProvider);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/ITreeItemContentProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/ITreeItemContentProvider.java
new file mode 100644
index 0000000000..520f966ef4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/ITreeItemContentProvider.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.jface;
+
+/**
+ * Interface used in conjunction with DelegatingTreeContentProvider to return
+ * tree information for a particular item.
+ * @see DelegatingTreeContentProvider
+ * @see ITreeItemContentProviderFactory
+ */
+public interface ITreeItemContentProvider extends IItemContentProvider
+{
+ /**
+ * Return the parent of the represented item
+ */
+ Object getParent();
+
+ /**
+ * Return whether the represented item has children
+ */
+ boolean hasChildren();
+
+ /**
+ * Return the children of the represented item
+ */
+ Object[] getChildren();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/ITreeItemContentProviderFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/ITreeItemContentProviderFactory.java
new file mode 100644
index 0000000000..9d0b0009d0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/ITreeItemContentProviderFactory.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.jface;
+
+/**
+ * Extension of {@link IItemContentProviderFactory} that extends functionality
+ * for tree content
+ */
+public interface ITreeItemContentProviderFactory extends IItemContentProviderFactory
+{
+ public ITreeItemContentProvider buildItemContentProvider(Object item,
+ DelegatingContentAndLabelProvider contentAndLabelProvider);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullLabelProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullLabelProvider.java
index 7fb66541d9..22fad41590 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullLabelProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullLabelProvider.java
@@ -1,43 +1,60 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 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
- *******************************************************************************/
+ * Copyright (c) 2006, 2007 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.ui.internal.jface;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.swt.graphics.Image;
-public class NullLabelProvider
+/**
+ * Null implementation of the ILabelProvider interface.
+ * Implemented as a singleton.
+ */
+public final class NullLabelProvider
implements ILabelProvider
{
- public static NullLabelProvider INSTANCE = new NullLabelProvider();
-
-
+ public static final NullLabelProvider INSTANCE = new NullLabelProvider();
+
+ public static ILabelProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure a single instance.
+ */
private NullLabelProvider() {
super();
}
-
-
+
public Image getImage(Object element) {
return null;
}
-
+
public String getText(Object element) {
return null;
}
-
- public void addListener(ILabelProviderListener listener) {}
-
- public void dispose() {}
-
+
+ public void addListener(ILabelProviderListener listener) {
+ // do nothing
+ }
+
+ public void dispose() {
+ // do nothing
+ }
+
public boolean isLabelProperty(Object element, String property) {
return false;
}
-
- public void removeListener(ILabelProviderListener listener) {}
+
+ public void removeListener(ILabelProviderListener listener) {
+ // do nothing
+ }
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullTreeContentProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullTreeContentProvider.java
index 864a29b08f..2a53f274de 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullTreeContentProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/jface/NullTreeContentProvider.java
@@ -1,44 +1,60 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 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
- *******************************************************************************/
+ * Copyright (c) 2006, 2007 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.ui.internal.jface;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
-public class NullTreeContentProvider
+/**
+ * Null implementation of the ILabelProvider interface.
+ * Implemented as a singleton.
+ */
+public final class NullTreeContentProvider
implements ITreeContentProvider
{
- public static NullTreeContentProvider INSTANCE = new NullTreeContentProvider();
-
-
+ private static final Object[] EMPTY_ARRAY = new Object[0];
+ public static final NullTreeContentProvider INSTANCE = new NullTreeContentProvider();
+
+ public static ITreeContentProvider instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure a single instance.
+ */
private NullTreeContentProvider() {
super();
}
-
-
+
public Object[] getChildren(Object parentElement) {
- return new Object[0];
+ return EMPTY_ARRAY;
}
-
+
public Object getParent(Object element) {
return null;
}
-
+
public boolean hasChildren(Object element) {
return false;
}
-
+
public Object[] getElements(Object inputElement) {
- return new Object[0];
+ return EMPTY_ARRAY;
+ }
+
+ public void dispose() {
+ // do nothing
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // do nothing
}
-
- public void dispose() {}
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsImages.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsImages.java
deleted file mode 100644
index 7acab93e34..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsImages.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.mappings;
-
-import org.eclipse.jpt.ui.internal.JptUiPlugin;
-import org.eclipse.swt.graphics.Image;
-
-public class JptUiMappingsImages
-{
- public final static String BASIC = "full/obj16/basic";
-
- public final static String EMBEDDABLE = "full/obj16/embeddable";
-
- public final static String EMBEDDED = "full/obj16/embedded";
-
- public final static String EMBEDDED_ID = "full/obj16/embedded-id";
-
- public final static String ENTITY = "full/obj16/entity";
-
- public final static String ENTITY_MAPPINGS = "full/obj16/entity-mappings";
-
- public final static String ID = "full/obj16/id";
-
- public final static String NULL_ATTRIBUTE_MAPPING = "full/obj16/null-attribute-mapping";
-
- public final static String MANY_TO_MANY = "full/obj16/many-to-many";
-
- public final static String MANY_TO_ONE = "full/obj16/many-to-one";
-
- public final static String MAPPED_SUPERCLASS = "full/obj16/mapped-superclass";
-
- public final static String NULL_TYPE_MAPPING = "full/obj16/null-type-mapping";
-
- public final static String ONE_TO_MANY = "full/obj16/one-to-many";
-
- public final static String ONE_TO_ONE = "full/obj16/one-to-one";
-
- public final static String TEMPORAL = "full/obj16/temporal";
-
- public final static String TRANSIENT = "full/obj16/transient";
-
- public final static String VERSION = "full/obj16/version";
-
-
- public static Image getImage(String imageLocator) {
- return JptUiPlugin.getPlugin().getImageDescriptor(imageLocator).createImage();
- }
-
-
- private JptUiMappingsImages() {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java
index 03380e75d7..a59bea443a 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/JptUiMappingsMessages.java
@@ -1,20 +1,23 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings;
import org.eclipse.osgi.util.NLS;
-public class JptUiMappingsMessages extends NLS
+public class JptUiMappingsMessages extends NLS
{
private static final String BUNDLE_NAME = "jpt_ui_mappings"; //$NON-NLS-1$
-
+
+ public static String Boolean_True;
+ public static String Boolean_False;
+
public static String PersistentTypePage_EntityLabel;
public static String PersistentTypePage_EmbeddableLabel;
public static String PersistentTypePage_MappedSuperclassLabel;
@@ -30,40 +33,44 @@ public class JptUiMappingsMessages extends NLS
public static String PersistentAttributePage_EmbeddedIdLabel;
public static String PersistentAttributePage_OneToOneLabel;
-
public static String EntityGeneralSection_nameDefaultWithOneParam;
public static String EntityGeneralSection_nameDefaultEmpty;
public static String EntityGeneralSection_name;
-
+
public static String BasicGeneralSection_name;
public static String BasicGeneralSection_nameDefault;
public static String BasicGeneralSection_fetchLabel;
public static String BasicGeneralSection_optionalLabel;
+ public static String BasicGeneralSection_optionalLabelDefault;
public static String BasicGeneralSection_lobLabel;
public static String BasicGeneralSection_temporalLabel;
public static String BasicGeneralSection_enumeratedLabel;
+ public static String DefaultBasicMappingUiProvider_Default;
+ public static String DefaultEmbeddedMappingUiProvider_Default;
+
public static String EntityComposite_tableDefault;
public static String EntityComposite_tableNoDefaultSpecified;
public static String EntityComposite_inheritance;
public static String TableComposite_tableSection;
public static String TableComposite_defaultEmpty;
public static String TableComposite_defaultWithOneParam;
-
+
public static String TableChooser_label;
public static String CatalogChooser_label;
public static String SchemaChooser_label;
public static String ColumnChooser_label;
public static String ColumnTableChooser_label;
-
+
public static String TargetEntityChooser_label;
public static String TargetEntityChooser_defaultEmpty;
public static String TargetEntityChooser_defaultWithOneParam;
public static String TargetEntityChooser_browse;
-
+ public static String TargetEntityChooser_selectTypeTitle;
+
public static String NonOwningMapping_mappedByLabel;
-
+
public static String JoinTableComposite_add;
public static String JoinTableComposite_defaultEmpty;
public static String JoinTableComposite_defaultWithOneParam;
@@ -88,11 +95,10 @@ public class JptUiMappingsMessages extends NLS
public static String JoinColumnDialog_defaultWithOneParam;
public static String JoinColumnDialog_referencedColumnName;
public static String JoinColumnDialog_table;
-
+
public static String InverseJoinColumnDialog_defaultWithOneParam;
public static String InverseJoinColumnDialog_editInverseJoinColumn;
-
public static String MultiRelationshipMappingComposite_cascadeType;
public static String MultiRelationshipMappingComposite_fetchType;
public static String MultiRelationshipMappingComposite_general;
@@ -103,8 +109,10 @@ public class JptUiMappingsMessages extends NLS
public static String ColumnComposite_columnSection;
public static String ColumnComposite_defaultWithOneParam;
public static String ColumnComposite_defaultEmpty;
- public static String ColumnComposite_insertable;
+ public static String ColumnComposite_insertable;
+ public static String ColumnComposite_insertableWithDefault;
public static String ColumnComposite_updatable;
+ public static String ColumnComposite_updatableWithDefault;
public static String JoinColumnComposite_defaultEmpty;
public static String JoinColumnComposite_defaultWithOneParam;
@@ -121,9 +129,7 @@ public class JptUiMappingsMessages extends NLS
public static String JoinColumnComposite_overrideDefaultJoinColumns;
public static String PrimaryKeyJoinColumnsComposite_overrideDefaultPrimaryKeyJoinColumns;
- public static String PrimaryKeyJoinColumnsComposite_add;
public static String PrimaryKeyJoinColumnsComposite_edit;
- public static String PrimaryKeyJoinColumnsComposite_remove;
public static String PrimaryKeyJoinColumnsComposite_defaultEmpty;
public static String PrimaryKeyJoinColumnsComposite_defaultWithOneParam;
public static String PrimaryKeyJoinColumnsComposite_primaryKeyJoinColumn;
@@ -132,18 +138,18 @@ public class JptUiMappingsMessages extends NLS
public static String PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsBothDefault;
public static String PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsFirstDefault;
public static String PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsSecDefault;
-
+
public static String AttributeOverridesComposite_attributeOverrides;
- public static String AttributeOverridesComposite_overridDefault;
+ public static String AttributeOverridesComposite_overrideDefault;
public static String OverridesComposite_joinColumn;
- public static String InheritanceComposite_default;
- public static String InheritanceComposite_strategy;
- public static String InheritanceComposite_discriminatorValue;
+ public static String InheritanceComposite_default;
+ public static String InheritanceComposite_strategy;
+ public static String InheritanceComposite_discriminatorValue;
public static String InheritanceComposite_discriminatorValueDefaultWithOneParam;
- public static String DiscriminatorColumnComposite_defaultEmpty;
- public static String DiscriminatorColumnComposite_column;
+ public static String DiscriminatorColumnComposite_defaultEmpty;
+ public static String DiscriminatorColumnComposite_column;
public static String DiscriminatorColumnComposite_discriminatorType;
public static String GeneratedValueComposite_generatedValue;
@@ -163,35 +169,65 @@ public class JptUiMappingsMessages extends NLS
public static String SequenceGeneratorComposite_sequence;
public static String SequenceGeneratorComposite_default;
- public static String IdMappingComposite_pk_generation;
- public static String IdMappingComposite_primaryKeyGeneration;
+ public static String IdMappingComposite_pk_generation;
+ public static String IdMappingComposite_primaryKeyGeneration;
public static String IdMappingComposite_tableGenerator;
public static String IdMappingComposite_sequenceGenerator;
- public static String OrderByComposite_orderByGroup;
- public static String OrderByComposite_noOrdering;
- public static String OrderByComposite_primaryKeyOrdering;
+ public static String OrderByComposite_orderByGroup;
+ public static String OrderByComposite_noOrdering;
+ public static String OrderByComposite_primaryKeyOrdering;
public static String OrderByComposite_customOrdering;
public static String OrderByComposite_orderByLabel;
public static String SecondaryTablesComposite_secondaryTables;
- public static String SecondaryTablesComposite_add;
public static String SecondaryTablesComposite_edit;
- public static String SecondaryTablesComposite_remove;
public static String SecondaryTableDialog_editSecondaryTable;
public static String SecondaryTableDialog_name;
public static String SecondaryTableDialog_catalog;
public static String SecondaryTableDialog_schema;
public static String SecondaryTableDialog_defaultSchema;
- public static String SecondaryTableDialog_defaultCatalog;
-
+ public static String SecondaryTableDialog_defaultCatalog;
+
public static String AccessTypeCombo_default;
- public static String EnumComboViewer_default;
public static String MetaDataCompleteCombo_Default;
public static String JoinColumnDialog_defaultTrue;
public static String InheritanceComposite_defaultDiscriminatorType;
- public static String GeneratedValueComposite_default;
+ public static String GeneratedValueComposite_auto;
+ public static String GeneratedValueComposite_identity;
+ public static String GeneratedValueComposite_sequence;
+ public static String GeneratedValueComposite_table;
+
+ public static String OptionalComposite_false;
+ public static String OptionalComposite_true;
+
+ public static String EnumTypeComposite_ordinal;
+ public static String EnumTypeComposite_string;
+
+ public static String TemporalTypeComposite_date;
+ public static String TemporalTypeComposite_time;
+ public static String TemporalTypeComposite_timestamp;
+
+ public static String FetchTypeComposite_eager;
+ public static String FetchTypeComposite_lazy;
+
+ public static String CascadeComposite_all;
+ public static String CascadeComposite_cascadeTitle;
+ public static String CascadeComposite_merge;
+ public static String CascadeComposite_persist;
+ public static String CascadeComposite_refresh;
+ public static String CascadeComposite_remove;
+
+ public static String InheritanceComposite_single_table;
+ public static String InheritanceComposite_joined;
+ public static String InheritanceComposite_table_per_class;
+ public static String InheritanceComposite_string;
+ public static String InheritanceComposite_char;
+ public static String InheritanceComposite_integer;
+
+ public static String MetaDataCompleteComboViewer_true;
+ public static String MetaDataCompleteComboViewer_false;
static {
// initialize resource bundle
@@ -201,5 +237,4 @@ public class JptUiMappingsMessages extends NLS
private JptUiMappingsMessages() {
throw new UnsupportedOperationException();
}
-
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/AbstractDatabaseObjectCombo.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/AbstractDatabaseObjectCombo.java
new file mode 100644
index 0000000000..fd885df523
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/AbstractDatabaseObjectCombo.java
@@ -0,0 +1,462 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.db;
+
+import java.util.Iterator;
+import org.eclipse.jpt.core.internal.IJpaNode;
+import org.eclipse.jpt.db.internal.ConnectionListener;
+import org.eclipse.jpt.db.internal.ConnectionProfile;
+import org.eclipse.jpt.db.internal.Database;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.ui.internal.Tracing;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.ClassTools;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This abstract implementation keeps a combo in sync with the database objects
+ * when a connection is active.
+ *
+ * @see CatalogCombo
+ * @see ColumnCombo
+ * @see SchemaCombo
+ * @see TableCombo
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public abstract class AbstractDatabaseObjectCombo<T extends IJpaNode> extends AbstractFormPane<T>
+{
+ /**
+ * The main widget of this pane.
+ */
+ private CCombo combo;
+
+ /**
+ * The listener added to the <code>ConnectionProfile</code> responsible to
+ * keep the combo in sync with the database metadata.
+ */
+ private ConnectionListener connectionListener;
+
+ /**
+ * Creates a new <code>AbstractDatabaseObjectCombo</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ protected AbstractDatabaseObjectCombo(AbstractFormPane<? extends T> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ /**
+ * Creates a new <code>AbstractDatabaseObjectCombo</code>.
+ *
+ * @param subjectHolder The holder of the subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ protected AbstractDatabaseObjectCombo(PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory)
+ {
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ private void addConnectionListener(T column) {
+ if (column != null) {
+ column.jpaProject().connectionProfile().addConnectionListener(this.connectionListener);
+ }
+ }
+
+ private ConnectionListener buildConnectionListener() {
+
+ return new ConnectionListener() {
+
+ public void aboutToClose(ConnectionProfile profile) {
+ log("aboutToClose");
+ }
+
+ public void closed(ConnectionProfile profile) {
+
+ SWTUtil.asyncExec(new Runnable() {
+ public void run() {
+ log("closed");
+
+ if (!getCombo().isDisposed()) {
+ AbstractDatabaseObjectCombo.this.repopulate();
+ }
+ }
+ });
+ }
+
+ public void databaseChanged(ConnectionProfile profile,
+ Database database) {
+
+ log("databaseChanged");
+ }
+
+ public void modified(ConnectionProfile profile) {
+ SWTUtil.asyncExec(new Runnable() {
+ public void run() {
+ log("modified");
+
+ if (!getCombo().isDisposed()) {
+ AbstractDatabaseObjectCombo.this.repopulate();
+ }
+ }
+ });
+ }
+
+ public boolean okToClose(ConnectionProfile profile) {
+ log("okToClose");
+ return true;
+ }
+
+ public void opened(ConnectionProfile profile) {
+
+ SWTUtil.asyncExec(new Runnable() {
+ public void run() {
+ log("opened");
+
+ if (!getCombo().isDisposed()) {
+ AbstractDatabaseObjectCombo.this.repopulate();
+ }
+ }
+ });
+ }
+
+ public void schemaChanged(ConnectionProfile profile,
+ final Schema schema) {
+
+ SWTUtil.asyncExec(new Runnable() {
+ public void run() {
+ log("schemaChanged: " + schema.getName());
+
+ if (!getCombo().isDisposed()) {
+ AbstractDatabaseObjectCombo.this.schemaChanged(schema);
+ }
+ }
+ });
+ }
+
+ public void tableChanged(ConnectionProfile profile,
+ final Table table) {
+
+ SWTUtil.asyncExec(new Runnable() {
+ public void run() {
+ log("tableChanged: " + table.getName());
+
+ if (!getCombo().isDisposed()) {
+ AbstractDatabaseObjectCombo.this.tableChanged(table);
+ }
+ }
+ });
+ }
+ };
+ }
+
+ private ModifyListener buildModifyListener() {
+ return new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ if (!isPopulating()) {
+ CCombo combo = (CCombo) e.widget;
+ valueChanged(combo.getText());
+ }
+ }
+ };
+ }
+
+ /**
+ * Returns the JPA project's connection profile, which is never
+ * <code>null</code>.
+ *
+ * @return The connection set in the project's properties or a <code>null</code>
+ * connection
+ */
+ protected final ConnectionProfile connectionProfile() {
+ return subject().jpaProject().connectionProfile();
+ }
+
+ /**
+ * Returns the database associated with the active connection profile.
+ *
+ * @return The online database or a <code>null</code> instance if no
+ * connection profile was set or the
+ */
+ protected final Database database() {
+ return connectionProfile().getDatabase();
+ }
+
+ /**
+ * Returns the default value, or <code>null</code> if no default is
+ * specified.
+ *
+ * @return The value that represents the default when no value was specified
+ */
+ protected abstract String defaultValue();
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void disengageListeners(T subject) {
+ super.disengageListeners(subject);
+ removeConnectionListener(subject);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void doPopulate() {
+
+ this.combo.removeAll();
+
+ if (subject() != null) {
+ populateCombo();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public void enableWidgets(boolean enabled) {
+
+ super.enableWidgets(enabled);
+
+ if (!this.combo.isDisposed()) {
+ this.combo.setEnabled(enabled);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void engageListeners(T subject) {
+ super.engageListeners(subject);
+ addConnectionListener(subject);
+ }
+
+ public final CCombo getCombo() {
+ return this.combo;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initialize() {
+ super.initialize();
+ this.connectionListener = buildConnectionListener();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ this.combo = buildCombo(container);
+ this.combo.add(JptUiMappingsMessages.ColumnComposite_defaultEmpty);
+ this.combo.addModifyListener(buildModifyListener());
+ }
+
+ private void log(String message) {
+ if (Tracing.booleanDebugOption(Tracing.UI_DB)) {
+ Class<?> thisClass = getClass();
+ String className = ClassTools.shortNameFor(thisClass);
+
+ if (thisClass.isAnonymousClass()) {
+ className = className.substring(0, className.indexOf('$'));
+ className += "->" + ClassTools.shortNameFor(thisClass.getSuperclass());
+ }
+
+ Tracing.log(className + ": " + message);
+ }
+ }
+
+ /**
+ * Populates the combo's list by adding first the default value is available
+ * and then the possible choices.
+ */
+ private void populateCombo() {
+
+ populateDefaultValue();
+
+ if (connectionProfile().isConnected()) {
+
+ for (Iterator<String> iter = CollectionTools.sort(values()); iter.hasNext(); ) {
+ this.combo.add(iter.next());
+ }
+ }
+
+ updateSelectedItem();
+ }
+
+ /**
+ * Adds the default value to the combo if one exists.
+ */
+ private void populateDefaultValue() {
+
+ String defaultValue = defaultValue();
+
+ if (defaultValue != null) {
+ this.combo.add(NLS.bind(
+ JptUiMappingsMessages.ColumnComposite_defaultWithOneParam,
+ defaultValue
+ ));
+ }
+ else {
+ this.combo.add(JptUiMappingsMessages.ColumnComposite_defaultEmpty);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void propertyChanged(String propertyName) {
+ super.propertyChanged(propertyName);
+
+ if (CollectionTools.contains(propertyNames(), propertyName)) {
+ updateSelectedItem();
+ }
+ }
+
+ private void removeConnectionListener(T value) {
+ if (value != null) {
+ value.jpaProject().connectionProfile().removeConnectionListener(this.connectionListener);
+ }
+ }
+
+ /**
+ * The
+ *
+ * @param schema
+ */
+ protected void schemaChanged(Schema schema) {
+ }
+
+ /**
+ * Sets the given value as the new value.
+ *
+ * @param value The new value to send to the model object
+ */
+ protected abstract void setValue(String value);
+
+ /**
+ * The
+ *
+ * @param catalog
+ */
+ protected void tableChanged(Table table) {
+ }
+
+ /**
+ * Updates the selected item by selected the current value, if not
+ * <code>null</code>, or select the default value if one is available,
+ * otherwise remove the selection.
+ * <p>
+ * <b>Note:</b> It seems the text can be shown as truncated, changing the
+ * selection to (0, 0) makes the entire text visible.
+ */
+ private void updateSelectedItem() {
+ String value = value();
+
+ if (value != null) {
+ this.combo.setText(value);
+ this.combo.setSelection(new Point(0, 0));
+ }
+ else {
+ String defaultValue = defaultValue();
+ String displayString = NLS.bind(JptUiMappingsMessages.ColumnComposite_defaultWithOneParam, defaultValue);
+
+ if (!this.combo.getText().equals(displayString)) {
+ this.combo.setText(displayString);
+ this.combo.setSelection(new Point(0, 0));
+ }
+ else {
+ this.combo.select(-1);
+ }
+ }
+ }
+
+ /**
+ * Requests the current value from the model object.
+ *
+ * @return The current value
+ */
+ protected abstract String value();
+
+ /**
+ * The selection has changed, update the model if required.
+ *
+ * @param value The new value
+ */
+ protected void valueChanged(String value) {
+
+ IJpaNode subject = subject();
+
+ if (subject == null) {
+ return;
+ }
+
+ String oldValue = value();
+
+ // Check for null value
+ if (StringTools.stringIsEmpty(value)) {
+ value = null;
+
+ if (StringTools.stringIsEmpty(oldValue)) {
+ return;
+ }
+ }
+
+ // The default value
+ if (value != null &&
+ getCombo().getItemCount() > 0 &&
+ value.equals(getCombo().getItem(0)))
+ {
+ value = null;
+ }
+
+ // Set the new value
+ if ((value != null) && (oldValue == null)) {
+ setValue(value);
+ }
+ else if ((oldValue != null) && !oldValue.equals(value)) {
+ setValue(value);
+ }
+ }
+
+ /**
+ * Retrieves the possible values, which will be added to the combo during
+ * population.
+ *
+ * @return A non-<code>null</code> <code>Iterator</code> of the possible
+ * choices to be added to the combo
+ */
+ protected abstract Iterator<String> values();
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/CatalogCombo.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/CatalogCombo.java
new file mode 100644
index 0000000000..c5473562ac
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/CatalogCombo.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.db;
+
+import java.util.Iterator;
+import org.eclipse.jpt.core.internal.IJpaNode;
+import org.eclipse.jpt.db.internal.Database;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This database object combo handles showing the database's catalogs.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public abstract class CatalogCombo<T extends IJpaNode> extends AbstractDatabaseObjectCombo<T>
+{
+ /**
+ * Creates a new <code>CatalogCombo</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public CatalogCombo(AbstractFormPane<? extends T> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ /**
+ * Creates a new <code>CatalogCombo</code>.
+ *
+ * @param subjectHolder The holder of the subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public CatalogCombo(PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected Iterator<String> values() {
+
+ Database database = database();
+
+ if (database != null) {
+ return database.catalogNames();
+ }
+
+ return EmptyIterator.instance();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/ColumnCombo.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/ColumnCombo.java
new file mode 100644
index 0000000000..63d298356d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/ColumnCombo.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.db;
+
+import java.util.Iterator;
+import org.eclipse.jpt.core.internal.IJpaNode;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This database object combo handles showing a table's columns.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public abstract class ColumnCombo<T extends IJpaNode> extends AbstractDatabaseObjectCombo<T>
+{
+ /**
+ * Creates a new <code>ColumnCombo</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public ColumnCombo(AbstractFormPane<? extends T> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ /**
+ * Creates a new <code>ColumnCombo</code>.
+ *
+ * @param subjectHolder The holder of the subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public ColumnCombo(PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ protected abstract Table table();
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void tableChanged(Table table) {
+ super.tableChanged(table);
+
+ if (table == table()) {
+ this.doPopulate();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected Iterator<String> values() {
+
+ Table table = table();
+
+ if (table != null) {
+ return table.columnNames();
+ }
+
+ return EmptyIterator.instance();
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/SchemaCombo.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/SchemaCombo.java
new file mode 100644
index 0000000000..31924eab52
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/SchemaCombo.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.db;
+
+import java.util.Iterator;
+import org.eclipse.jpt.core.internal.IJpaNode;
+import org.eclipse.jpt.db.internal.Database;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This database object combo handles showing the database's schemas.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public abstract class SchemaCombo<T extends IJpaNode> extends AbstractDatabaseObjectCombo<T>
+{
+ /**
+ * Creates a new <code>SchemaCombo</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public SchemaCombo(AbstractFormPane<? extends T> parentPane,
+ Composite parent)
+ {
+ super(parentPane, parent);
+ }
+
+ /**
+ * Creates a new <code>SchemaCombo</code>.
+ *
+ * @param subjectHolder The holder of the subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public SchemaCombo(PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory)
+ {
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected Iterator<String> values() {
+
+ Database database = this.database();
+
+ if (database != null) {
+ return database.schemaNames();
+ }
+
+ return EmptyIterator.instance();
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/SequenceCombo.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/SequenceCombo.java
new file mode 100644
index 0000000000..3f5773bd9b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/SequenceCombo.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.db;
+
+import java.util.Iterator;
+import org.eclipse.jpt.core.internal.IJpaNode;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This database object combo handles showing the database's sequences for a
+ * given <code>Schema</code>.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public abstract class SequenceCombo<T extends IJpaNode> extends AbstractDatabaseObjectCombo<T>
+{
+ /**
+ * Creates a new <code>SequenceCombo</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public SequenceCombo(AbstractFormPane<? extends T> parentPane, Composite parent)
+ {
+ super(parentPane, parent);
+ }
+
+ /**
+ * Creates a new <code>SequenceCombo</code>.
+ *
+ * @param subjectHolder The holder of the subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public SequenceCombo(PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory)
+ {
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ protected abstract Schema schema();
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected Iterator<String> values() {
+ Schema schema = schema();
+
+ if (schema != null) {
+ return schema.sequenceNames();
+ }
+
+ return EmptyIterator.instance();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/TableCombo.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/TableCombo.java
new file mode 100644
index 0000000000..1e56a97bcb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/db/TableCombo.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.db;
+
+import org.eclipse.jpt.core.internal.IJpaNode;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This database object combo handles showing the database's tables.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public abstract class TableCombo<T extends IJpaNode> extends AbstractDatabaseObjectCombo<T>
+{
+ /**
+ * Creates a new <code>TableCombo</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public TableCombo(AbstractFormPane<? extends T> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ /**
+ * Creates a new <code>TableCombo</code>.
+ *
+ * @param subjectHolder The holder of the subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public TableCombo(PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory)
+ {
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ protected abstract Table table();
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void tableChanged(Table table) {
+ super.tableChanged(table);
+
+ if (table == table()) {
+ this.doPopulate();
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnDialog.java
index 2435c30c6f..60c269d3af 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnDialog.java
@@ -1,183 +1,72 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
-import java.util.Iterator;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
+import org.eclipse.jpt.ui.internal.widgets.AbstractDialog;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-//if there is only 1 joinColumn and the user is editing it, they should be
-//able to define defaults. otherwise, we probably shouldn't allow it.
-public abstract class AbstractJoinColumnDialog<E extends IAbstractJoinColumn> extends Dialog {
+/**
+ * @see AbstractJoinColumnStateObject
+ *
+ * TODO: If there is only 1 join column and the user is editing it, they should
+ * be able to define defaults. otherwise, we probably shouldn't allow it.
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public abstract class AbstractJoinColumnDialog<T extends AbstractJoinColumnStateObject> extends AbstractDialog<T> {
- //if creating a new JoinColumn, this will be null,
- //specify the JoinColumnOwner instead in the appropriate construtor
- private E joinColumn;
-
- private Combo nameCombo;
- private Combo referencedColumnNameCombo;
-
- private boolean defaultNameSelected;
- private String selectedName;
- private boolean defaultReferencedColumnNameSelected;
- private String selectedReferencedColumnName;
-
- AbstractJoinColumnDialog(Shell parent) {
+ private IAbstractJoinColumn joinColumn;
+
+ /**
+ * Creates a new <code>AbstractJoinColumnDialog</code>.
+ *
+ * @param parent The parent shell
+ */
+ public AbstractJoinColumnDialog(Shell parent) {
super(parent);
}
- AbstractJoinColumnDialog(Shell parent, E joinColumn) {
- super(parent);
+ /**
+ * Creates a new <code>AbstractJoinColumnDialog</code>.
+ *
+ * @param parent The parent shell
+ * @param joinColumn
+ */
+ public AbstractJoinColumnDialog(Shell parent,
+ IAbstractJoinColumn joinColumn) {
+
+ this(parent);
this.joinColumn = joinColumn;
}
-
- protected String getAddTitle() {
- return JptUiMappingsMessages.JoinColumnDialog_addJoinColumn;
- }
- protected String getEditTitle() {
- return JptUiMappingsMessages.JoinColumnDialog_editJoinColumn;
+ /**
+ * Returns
+ *
+ * @return
+ */
+ public IAbstractJoinColumn getJoinColumn() {
+ return joinColumn;
}
-
- protected Control createDialogArea(Composite parent) {
- if (this.joinColumn == null) {
- getShell().setText(getAddTitle());
- }
- else {
- getShell().setText(getEditTitle());
- }
- Composite composite = (Composite) super.createDialogArea(parent);
- GridLayout gridLayout = (GridLayout) composite.getLayout();
- gridLayout.numColumns = 2;
-
- Label nameLabel = new Label(composite, SWT.LEFT);
- nameLabel.setText(JptUiMappingsMessages.JoinColumnDialog_name);
- GridData gridData = new GridData();
- nameLabel.setLayoutData(gridData);
-
- this.nameCombo = new Combo(composite, SWT.LEFT);
- gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.nameCombo.setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.nameCombo, IJpaHelpContextIds.MAPPING_JOIN_COLUMN_NAME);
- populateNameCombo();
-
- Label referencedColumnNameLabel = new Label(composite, SWT.LEFT);
- referencedColumnNameLabel.setText(JptUiMappingsMessages.JoinColumnDialog_referencedColumnName);
- gridData = new GridData();
- referencedColumnNameLabel.setLayoutData(gridData);
- this.referencedColumnNameCombo = new Combo(composite, SWT.LEFT);
- gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.referencedColumnNameCombo.setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.referencedColumnNameCombo, IJpaHelpContextIds.MAPPING_JOIN_REFERENCED_COLUMN);
- populateReferencedNameCombo();
-
- return composite;
- }
-
- protected void populateNameCombo() {
- this.nameCombo.removeAll();
- if (getJoinColumn() != null) {
- this.nameCombo.add(NLS.bind(JptUiMappingsMessages.JoinColumnDialog_defaultWithOneParam, getJoinColumn().getDefaultName()));
- }
- Table table = getNameTable();
- if (table != null) {
- for (Iterator i = table.columnNames(); i.hasNext(); ) {
- this.nameCombo.add((String) i.next());
- }
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected String title() {
+ if (joinColumn == null) {
+ return JptUiMappingsMessages.JoinColumnDialog_addJoinColumn;
}
- if (getJoinColumn() != null) {
- if (getJoinColumn().getSpecifiedName() != null) {
- this.nameCombo.setText(getJoinColumn().getSpecifiedName());
- }
- else {
- this.nameCombo.select(0);
- }
- }
- }
-
- protected Combo getNameCombo() {
- return this.nameCombo;
- }
-
- protected Combo getReferencedColumnNameCombo() {
- return this.referencedColumnNameCombo;
- }
-
- protected abstract Table getNameTable();
-
- protected abstract Table getReferencedNameTable();
- protected void populateReferencedNameCombo() {
- if (getJoinColumn() != null) {
- this.referencedColumnNameCombo.add(NLS.bind(JptUiMappingsMessages.JoinColumnDialog_defaultWithOneParam, getJoinColumn().getDefaultReferencedColumnName()));
- }
- Table referencedNameTable = getReferencedNameTable();
- if (referencedNameTable != null) {
- for (Iterator i = referencedNameTable.columnNames(); i.hasNext(); ) {
- this.referencedColumnNameCombo.add((String) i.next());
- }
- }
- if (getJoinColumn() != null) {
- if (getJoinColumn().getSpecifiedReferencedColumnName() != null) {
- this.referencedColumnNameCombo.setText(getJoinColumn().getSpecifiedReferencedColumnName());
- }
- else {
- this.referencedColumnNameCombo.select(0);
- }
- }
- }
-
- protected E getJoinColumn() {
- return this.joinColumn;
- }
-
- protected boolean isDefaultNameSelected() {
- return this.defaultNameSelected;
- }
-
- protected String getSelectedName() {
- return this.selectedName;
- }
-
- protected boolean isDefaultReferencedColumnNameSelected() {
- return this.defaultReferencedColumnNameSelected;
- }
-
- protected String getReferencedColumnName() {
- return this.selectedReferencedColumnName;
- }
-
- public boolean close() {
- this.defaultNameSelected = this.nameCombo.getSelectionIndex() == 0;
- this.selectedName = this.nameCombo.getText();
- this.defaultReferencedColumnNameSelected = this.referencedColumnNameCombo.getSelectionIndex() == 0;
- this.selectedReferencedColumnName = this.referencedColumnNameCombo.getText();
- return super.close();
+ return JptUiMappingsMessages.JoinColumnDialog_editJoinColumn;
}
-
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnDialogPane.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnDialogPane.java
new file mode 100644
index 0000000000..2e0dc4c1ab
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnDialogPane.java
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.details;
+
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.AbstractDialogPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------- |
+ * | Name: | |v| |
+ * | ------------------------------------------------- |
+ * | ------------------------------------------------- |
+ * | Referenced Column Name: | |v| |
+ * | ------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see AbstractJoinColumnStateObject
+ * @see JoinColumnInJoinTableDialog - A container of this pane
+ * @see PrimaryKeyJoinColumnInSecondaryTableDialog - A container of this pane
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class AbstractJoinColumnDialogPane<T extends AbstractJoinColumnStateObject> extends AbstractDialogPane<T>
+{
+ private CCombo nameCombo;
+ private CCombo referencedColumnNameCombo;
+
+ /**
+ * Creates a new <code>AbstractJoinColumnDialogPane</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ */
+ public AbstractJoinColumnDialogPane(PropertyValueModel<? extends T> subjectHolder,
+ Composite parent)
+ {
+ super(subjectHolder, parent);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(AbstractJoinColumnStateObject.SELECTED_REFERENCED_COLUMN_NAME_PROPERTY);
+ propertyNames.add(AbstractJoinColumnStateObject.SELECTED_NAME_PROPERTY);
+ }
+
+ private ModifyListener buildNameComboListener() {
+ return new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ CCombo combo = (CCombo) e.widget;
+ subject().setSelectedName(combo.getText());
+ subject().setDefaultNameSelected(combo.getSelectionIndex() == 0);
+ }
+ };
+ }
+
+ private ModifyListener buildReferencedColumnNameComboListener() {
+ return new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ CCombo combo = (CCombo) e.widget;
+ subject().setSelectedReferencedColumnName(combo.getText());
+ subject().setDefaultReferencedColumnNameSelected(combo.getSelectionIndex() == 0);
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void doPopulate() {
+ super.doPopulate();
+ populateNameCombo();
+ }
+
+ public final CCombo getNameCombo() {
+ return nameCombo;
+ }
+
+ public final CCombo getReferencedColumnNameCombo() {
+ return referencedColumnNameCombo;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ // Name widgets
+ nameCombo = buildCombo(container);
+ nameCombo.addModifyListener(buildNameComboListener());
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.JoinColumnDialog_name,
+ nameCombo,
+ IJpaHelpContextIds.MAPPING_JOIN_COLUMN_NAME
+ );
+
+ // Referenced Column Name widgets
+ referencedColumnNameCombo = buildCombo(container);
+ referencedColumnNameCombo.addModifyListener(buildReferencedColumnNameComboListener());
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.JoinColumnDialog_referencedColumnName,
+ referencedColumnNameCombo,
+ IJpaHelpContextIds.MAPPING_JOIN_REFERENCED_COLUMN
+ );
+ }
+
+ public void populateNameCombo() {
+
+ AbstractJoinColumnStateObject subject = subject();
+ this.nameCombo.removeAll();
+
+ if (subject.getDefaultName() != null) {
+ this.nameCombo.add(NLS.bind(JptUiMappingsMessages.JoinColumnDialog_defaultWithOneParam, subject.getDefaultName()));
+ }
+
+ Table table = subject.getNameTable();
+
+ if (table != null) {
+ for (Iterator<String> iter = table.columnNames(); iter.hasNext(); ) {
+ this.nameCombo.add(iter.next());
+ }
+ }
+
+ if (subject.getJoinColumn() != null) {
+ if (subject.getSpecifiedName() != null) {
+ this.nameCombo.setText(subject.getSpecifiedName());
+ }
+ else {
+ this.nameCombo.select(0);
+ }
+ }
+ }
+
+ public void populateReferencedNameCombo() {
+
+ AbstractJoinColumnStateObject subject = subject();
+
+ if (subject.getDefaultReferencedColumnName() != null) {
+ this.referencedColumnNameCombo.add(NLS.bind(JptUiMappingsMessages.JoinColumnDialog_defaultWithOneParam, subject.getDefaultReferencedColumnName()));
+ }
+
+ Table referencedNameTable = subject.getReferencedNameTable();
+
+ if (referencedNameTable != null) {
+ for (Iterator<String> iter = referencedNameTable.columnNames(); iter.hasNext(); ) {
+ this.referencedColumnNameCombo.add(iter.next());
+ }
+ }
+
+ if (subject.getJoinColumn() != null) {
+ if (subject.getSpecifiedReferencedColumnName() != null) {
+ this.referencedColumnNameCombo.setText(subject().getSpecifiedReferencedColumnName());
+ }
+ else {
+ this.referencedColumnNameCombo.select(0);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void propertyChanged(String propertyName) {
+ super.propertyChanged(propertyName);
+
+ if (propertyName == AbstractJoinColumnStateObject.SELECTED_NAME_PROPERTY) {
+ populateNameCombo();
+ }
+ else if (propertyName == AbstractJoinColumnStateObject.SELECTED_REFERENCED_COLUMN_NAME_PROPERTY) {
+ populateReferencedNameCombo();
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnStateObject.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnStateObject.java
new file mode 100644
index 0000000000..f999da130b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/AbstractJoinColumnStateObject.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.utility.internal.node.AbstractNode;
+import org.eclipse.jpt.utility.internal.node.Node;
+
+/**
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public abstract class AbstractJoinColumnStateObject extends AbstractNode
+{
+ private boolean defaultNameSelected;
+ private boolean defaultReferencedColumnNameSelected;
+ private IAbstractJoinColumn joinColumn;
+ private String selectedName;
+ private String selectedReferencedColumnName;
+ private Validator validator;
+
+ static final String DEFAULT_NAME_SELECTED_PROPERTY = "defaultNameSelected";
+ static final String DEFAULT_REFERENCE_COLUMN_NAME_SELECTED_PROPERTY = "defaultReferencedColumnNameSelected";
+ static final String SELECTED_NAME_PROPERTY = "selectedName";
+ static final String SELECTED_REFERENCED_COLUMN_NAME_PROPERTY = "selectedReferencedColumnName";
+
+ /**
+ * Creates a new <code>AbstractJoinColumnStateObject</code>.
+ */
+ public AbstractJoinColumnStateObject() {
+ super(null);
+ }
+
+ /**
+ * Creates a new <code>AbstractJoinColumnStateObject</code>.
+ *
+ * @param joinColumn
+ */
+ public AbstractJoinColumnStateObject(IAbstractJoinColumn joinColumn) {
+ super(null);
+ this.joinColumn = joinColumn;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void checkParent(Node parentNode) {
+ // This is the root of the Join Column state object
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public String displayString() {
+ return "";
+ }
+
+ public String getDefaultName() {
+ if (this.joinColumn == null) {
+ return null;
+ }
+
+ return this.joinColumn.getDefaultName();
+ }
+
+ public String getDefaultReferencedColumnName() {
+ if (this.joinColumn == null) {
+ return null;
+ }
+
+ return this.joinColumn.getDefaultReferencedColumnName();
+ }
+
+ public IAbstractJoinColumn getJoinColumn() {
+ return this.joinColumn;
+ }
+
+ public abstract Table getNameTable();
+
+ public abstract Table getReferencedNameTable();
+
+ public String getSelectedName() {
+ return this.selectedName;
+ }
+
+ public String getSelectedReferencedColumnName() {
+ return this.selectedReferencedColumnName;
+ }
+
+ public String getSpecifiedName() {
+ if (this.joinColumn == null) {
+ return null;
+ }
+
+ return this.joinColumn.getSpecifiedName();
+ }
+
+ public String getSpecifiedReferencedColumnName() {
+ if (this.joinColumn == null) {
+ return null;
+ }
+
+ return this.joinColumn.getSpecifiedReferencedColumnName();
+ }
+
+ public boolean isDefaultNameSelected() {
+ return this.defaultNameSelected;
+ }
+
+ public boolean isDefaultReferencedColumnNameSelected() {
+ return this.defaultReferencedColumnNameSelected;
+ }
+
+ public void setDefaultNameSelected(boolean defaultNameSelected) {
+ boolean oldDefaultNameSelected = this.defaultNameSelected;
+ this.defaultNameSelected = defaultNameSelected;
+ firePropertyChanged(DEFAULT_NAME_SELECTED_PROPERTY, oldDefaultNameSelected, defaultNameSelected);
+ }
+
+ public void setDefaultReferencedColumnNameSelected(boolean defaultReferencedColumnNameSelected) {
+ boolean oldDefaultReferencedColumnNameSelected = this.defaultReferencedColumnNameSelected;
+ this.defaultReferencedColumnNameSelected = defaultReferencedColumnNameSelected;
+ firePropertyChanged(DEFAULT_REFERENCE_COLUMN_NAME_SELECTED_PROPERTY, oldDefaultReferencedColumnNameSelected, defaultReferencedColumnNameSelected);
+ }
+
+ public void setSelectedName(String selectedName) {
+ String oldSelectedName = this.selectedName;
+ this.selectedName = selectedName;
+ firePropertyChanged(SELECTED_NAME_PROPERTY, oldSelectedName, selectedName);
+ }
+
+ public void setSelectedReferencedColumnName(String selectedReferencedColumnName) {
+ String oldSelectedReferencedColumnName = this.selectedReferencedColumnName;
+ this.selectedReferencedColumnName = selectedReferencedColumnName;
+ firePropertyChanged(SELECTED_REFERENCED_COLUMN_NAME_PROPERTY, oldSelectedReferencedColumnName, selectedReferencedColumnName);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public void setValidator(Validator validator) {
+ this.validator = validator;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public Validator validator() {
+ return this.validator;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicComposite.java
deleted file mode 100644
index 1ba80cdb67..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicComposite.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.EnumType;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.TemporalType;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.EnumComboViewer.EnumHolder;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class BasicComposite extends BaseJpaComposite
-{
- private IBasic basic;
-
- private ColumnComposite columnComposite;
-
- private EnumComboViewer fetchTypeComboViewer;
- private EnumComboViewer optionalComboViewer;
- private LobCheckBox lobCheckBox;
- private EnumComboViewer temporalTypeViewer;
- private EnumComboViewer enumeratedTypeViewer;
-
- public BasicComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- Control generalControl = buildGeneralComposite(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generalControl.setLayoutData(gridData);
-
- }
-
- private Control buildGeneralComposite(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- Composite generalComposite = getWidgetFactory().createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- generalComposite.setLayout(layout);
-
- this.columnComposite = new ColumnComposite(generalComposite, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.columnComposite.getControl().setLayoutData(gridData);
-
- CommonWidgets.buildFetchLabel(generalComposite, getWidgetFactory());
- this.fetchTypeComboViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.fetchTypeComboViewer.getControl().setLayoutData(gridData);
- helpSystem.setHelp(fetchTypeComboViewer.getControl(), IJpaHelpContextIds.MAPPING_FETCH_TYPE);
-
- CommonWidgets.buildOptionalLabel(generalComposite, getWidgetFactory());
- this.optionalComboViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.optionalComboViewer.getControl().setLayoutData(gridData);
- helpSystem.setHelp(optionalComboViewer.getControl(), IJpaHelpContextIds.MAPPING_OPTIONAL);
-
- CommonWidgets.buildTemporalLabel(generalComposite, getWidgetFactory());
- this.temporalTypeViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.temporalTypeViewer.getControl().setLayoutData(gridData);
- helpSystem.setHelp(temporalTypeViewer.getControl(), IJpaHelpContextIds.MAPPING_TEMPORAL);
-
- CommonWidgets.buildEnumeratedLabel(generalComposite, getWidgetFactory());
- this.enumeratedTypeViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.enumeratedTypeViewer.getControl().setLayoutData(gridData);
- helpSystem.setHelp(enumeratedTypeViewer.getControl(), IJpaHelpContextIds.MAPPING_ENUMERATED);
-
- this.lobCheckBox = buildLobCheckBox(generalComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.lobCheckBox.getControl().setLayoutData(gridData);
- helpSystem.setHelp(lobCheckBox.getControl(), IJpaHelpContextIds.MAPPING_LOB);
-
- return generalComposite;
- }
-
- private LobCheckBox buildLobCheckBox(Composite parent) {
- return new LobCheckBox(parent, this.commandStack, getWidgetFactory());
- }
-
- public void doPopulate(EObject obj) {
- this.basic = (IBasic) obj;
- if (this.basic != null) {
- this.columnComposite.populate(this.basic.getColumn());
- }
- else {
- this.columnComposite.populate(null);
- }
- this.fetchTypeComboViewer.populate(new FetchHolder(this.basic));
- this.optionalComboViewer.populate(new OptionalHolder(this.basic));
- this.lobCheckBox.populate(this.basic);
- this.temporalTypeViewer.populate(new TemporalTypeHolder(this.basic));
- this.enumeratedTypeViewer.populate(new EnumeratedTypeHolder(this.basic));
- }
-
- public void doPopulate() {
- this.columnComposite.populate();
- this.fetchTypeComboViewer.populate();
- this.optionalComboViewer.populate();
- this.lobCheckBox.populate();
- this.temporalTypeViewer.populate();
- this.enumeratedTypeViewer.populate();
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
- @Override
- public void dispose() {
- this.columnComposite.dispose();
- this.fetchTypeComboViewer.dispose();
- this.optionalComboViewer.dispose();
- this.lobCheckBox.dispose();
- this.temporalTypeViewer.dispose();
- this.enumeratedTypeViewer.dispose();
- super.dispose();
- }
-
- protected IBasic getBasic() {
- return this.basic;
- }
-
- private class FetchHolder extends EObjectImpl implements EnumHolder {
-
- private IBasic basic;
-
- FetchHolder(IBasic basic) {
- super();
- this.basic = basic;
- }
-
- public Object get() {
- return this.basic.getFetch();
- }
-
- public void set(Object enumSetting) {
- this.basic.setFetch((DefaultEagerFetchType) enumSetting);
-
- }
-
- public Class featureClass() {
- return IBasic.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IBASIC__FETCH;
- }
-
- public EObject wrappedObject() {
- return this.basic;
- }
-
- public Object[] enumValues() {
- return DefaultEagerFetchType.VALUES.toArray();
- }
-
- public Object defaultValue() {
- return DefaultEagerFetchType.DEFAULT;
- }
-
- public String defaultString() {
- //TODO move this out of the UI into the model
- return "Eager";
- }
- }
-
-
- private class OptionalHolder extends EObjectImpl implements EnumHolder {
-
- private IBasic basic;
-
- OptionalHolder(IBasic basic) {
- super();
- this.basic = basic;
- }
-
- public Object get() {
- return this.basic.getOptional();
- }
-
- public void set(Object enumSetting) {
- this.basic.setOptional((DefaultTrueBoolean) enumSetting);
- }
-
- public Class featureClass() {
- return IBasic.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IBASIC__OPTIONAL;
- }
-
- public EObject wrappedObject() {
- return this.basic;
- }
-
- public Object[] enumValues() {
- return DefaultTrueBoolean.VALUES.toArray();
- }
-
- public Object defaultValue() {
- return DefaultTrueBoolean.DEFAULT;
- }
-
- public String defaultString() {
- //TODO move this out of the UI into the model
- return "True";
- }
-
- }
-
-
- private class TemporalTypeHolder extends EObjectImpl implements EnumHolder {
-
- private IBasic basic;
-
- TemporalTypeHolder(IBasic basic) {
- super();
- this.basic = basic;
- }
-
- public Object get() {
- return this.basic.getTemporal();
- }
-
- public void set(Object enumSetting) {
- this.basic.setTemporal((TemporalType) enumSetting);
- }
-
- public Class featureClass() {
- return IBasic.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IBASIC__TEMPORAL;
- }
-
- public EObject wrappedObject() {
- return this.basic;
- }
-
- public Object[] enumValues() {
- return TemporalType.VALUES.toArray();
- }
-
- /**
- * TemporalType has no Default, return null
- */
- public Object defaultValue() {
- return null;
- }
-
- /**
- * TemporalType has no Default, return null
- */
- public String defaultString() {
- return null;
- }
- }
-
- private class EnumeratedTypeHolder extends EObjectImpl implements EnumHolder {
-
- private IBasic basic;
-
- EnumeratedTypeHolder(IBasic basic) {
- super();
- this.basic = basic;
- }
-
- public Object get() {
- return this.basic.getEnumerated();
- }
-
- public void set(Object enumSetting) {
- this.basic.setEnumerated((EnumType) enumSetting);
- }
-
- public Class featureClass() {
- return IBasic.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IBASIC__ENUMERATED;
- }
-
- public EObject wrappedObject() {
- return this.basic;
- }
-
- public Object[] enumValues() {
- return EnumType.VALUES.toArray();
- }
-
- public Object defaultValue() {
- return EnumType.DEFAULT;
- }
-
- public String defaultString() {
- //TODO move this out of the UI into the model
- return "Ordinal";
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicMappingComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicMappingComposite.java
new file mode 100644
index 0000000000..28372d1f8f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/BasicMappingComposite.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IColumn;
+import org.eclipse.jpt.ui.internal.details.IJpaComposite;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | ColumnComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | FetchTypeComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | TemporalTypeComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | EnumTypeComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | OptionalComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | LobComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IBasicMapping
+ * @see BaseJpaUiFactory - The factory creating this pane
+ * @see ColumnComposite
+ * @see EnumTypeComposite
+ * @see FetchTypeComposite
+ * @see LobComposite
+ * @see OptionalComposite
+ * @see TemporalTypeComposite
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class BasicMappingComposite extends AbstractFormPane<IBasicMapping>
+ implements IJpaComposite<IBasicMapping>
+{
+ /**
+ * Creates a new <code>BasicMappingComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IBasicMapping</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public BasicMappingComposite(PropertyValueModel<IBasicMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ private PropertyValueModel<IColumn> buildColumnHolder() {
+ return new TransformationPropertyValueModel<IBasicMapping, IColumn>(getSubjectHolder()) {
+ @Override
+ protected IColumn transform_(IBasicMapping value) {
+ return value.getColumn();
+ }
+ };
+ }
+
+ private Composite buildPane(Composite container, int groupBoxMargin) {
+ return buildSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ int groupBoxMargin = groupBoxMargin();
+
+ // Column widgets
+ new ColumnComposite(this, buildColumnHolder(), container);
+
+ // Fetch Type widgets
+ new FetchTypeComposite(this, buildPane(container, groupBoxMargin));
+
+ // Temporal Type widgets
+ new TemporalTypeComposite(this, buildPane(container, groupBoxMargin));
+
+ // Enumerated widgets
+ new EnumTypeComposite(this, buildPane(container, groupBoxMargin));
+
+ // Optional widgets
+ new OptionalComposite(this, buildPane(container, groupBoxMargin));
+
+ // Lob check box
+ new LobComposite(this, buildPane(container, groupBoxMargin));
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CascadeComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CascadeComposite.java
index a2eb0eb160..e5e246c0d4 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CascadeComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CascadeComposite.java
@@ -3,376 +3,192 @@
* 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.ui.internal.mappings.details;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.ICascade;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
+import org.eclipse.jpt.core.internal.context.base.ICascade;
+import org.eclipse.jpt.core.internal.context.base.IRelationshipMapping;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class CascadeComposite extends BaseJpaComposite
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | - Cascade --------------------------------------------------------------- |
+ * | | | |
+ * | | x All x Persist x Merge x Remove x Refresh | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see ICascade
+ * @see IRelationshipMapping
+ * @see ManyToManyMappingComposite - A container of this pane
+ * @see ManyToOneMappingComposite - A container of this pane
+ * @see OneToManyMappingComposite - A container of this pane
+ * @see OneToOneMappingComposite - A container of this pane
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class CascadeComposite extends AbstractFormPane<ICascade>
{
- private IRelationshipMapping relationshipMapping;
- private ICascade cascade;
-
- private Adapter relationshipMappingListener;
- private Adapter cascadeListener;
-
-
- private Button allCheckBox;
- private Button persistCheckBox;
- private Button mergeCheckBox;
- private Button removeCheckBox;
- private Button refreshCheckBox;
-
- public CascadeComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.relationshipMappingListener = buildRelationshipMappingListener();
- this.cascadeListener = buildCascadeListener();
- }
+ /**
+ * Creates a new <code>CascadeComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of the subject <code>ICascade</code>
+ * @param parent The parent container
+ */
+ public CascadeComposite(AbstractFormPane<? extends IRelationshipMapping> parentPane,
+ PropertyValueModel<? extends ICascade> subjectHolder,
+ Composite parent) {
- private Adapter buildRelationshipMappingListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- relationshipMappingChanged(notification);
- }
- };
+ super(parentPane, subjectHolder, parent, false);
}
- private Adapter buildCascadeListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- cascadeChanged(notification);
- }
- };
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- composite.setLayout(new FillLayout());
-
- Group cascadeGroup = getWidgetFactory().createGroup(composite, "Cascade");
- GridLayout layout = new GridLayout(5, false);
- cascadeGroup.setLayout(layout);
-
- GridData gridData;
-
- this.allCheckBox = createAllCheckBox(cascadeGroup);
- gridData = new GridData();
- this.allCheckBox.setLayoutData(gridData);
+ /**
+ * Creates a new <code>ColumnComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>ICascade</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public CascadeComposite(PropertyValueModel<? extends ICascade> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
- this.persistCheckBox = createPersistCheckBox(cascadeGroup);
- gridData = new GridData();
- this.persistCheckBox.setLayoutData(gridData);
-
- this.mergeCheckBox = createMergeCheckBox(cascadeGroup);
- gridData = new GridData();
- this.mergeCheckBox.setLayoutData(gridData);
-
- this.removeCheckBox = createRemoveCheckBox(cascadeGroup);
- gridData = new GridData();
- this.removeCheckBox.setLayoutData(gridData);
-
- this.refreshCheckBox = createRefreshCheckBox(cascadeGroup);
- gridData = new GridData();
- this.refreshCheckBox.setLayoutData(gridData);
- }
-
- private Button createAllCheckBox(Composite composite) {
- Button button = getWidgetFactory().createButton(composite, "All", SWT.CHECK);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- CascadeComposite.this.allSelected(e);
- }
- public void widgetSelected(SelectionEvent e) {
- CascadeComposite.this.allSelected(e);
- }
- });
- return button;
+ super(subjectHolder, parent, widgetFactory);
}
-
- protected void allSelected(SelectionEvent e) {
- boolean setSelection = initializeCascade();
- if (setSelection) {
- this.cascade.setAll(this.allCheckBox.getSelection());
- }
- }
-
- private boolean initializeCascade() {
- if (allCheckBoxesFalse() && this.cascade != null) {
- disengageCascadeListener();
- this.relationshipMapping.setCascade(null);
- return false;
- }
- if (this.cascade == null) {
- this.cascade = this.relationshipMapping.createCascade();
- this.relationshipMapping.setCascade(this.cascade);
- engageCascadeListener();
- }
- return true;
- }
-
- private Button createPersistCheckBox(Composite composite) {
- Button button = getWidgetFactory().createButton(composite, "Persist", SWT.CHECK);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- CascadeComposite.this.persistSelected(e);
+
+ private WritablePropertyValueModel<Boolean> buildCascadeTypeAllHolder() {
+ return new PropertyAspectAdapter<ICascade, Boolean>(getSubjectHolder(), ICascade.ALL_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return subject.isAll();
}
- public void widgetSelected(SelectionEvent e) {
- CascadeComposite.this.persistSelected(e);
+
+ @Override
+ protected void setValue_(Boolean value) {
+ subject.setAll(value);
}
- });
- return button;
- }
-
- protected void persistSelected(SelectionEvent e) {
- boolean setSelection = initializeCascade();
- if (setSelection) {
- this.cascade.setPersist(this.persistCheckBox.getSelection());
- }
+ };
}
- private Button createMergeCheckBox(Composite composite) {
- Button button = getWidgetFactory().createButton(composite, "Merge", SWT.CHECK);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- CascadeComposite.this.mergeSelected(e);
+ private WritablePropertyValueModel<Boolean> buildCascadeTypeMergeHolder() {
+ return new PropertyAspectAdapter<ICascade, Boolean>(getSubjectHolder(), ICascade.MERGE_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return subject.isMerge();
}
- public void widgetSelected(SelectionEvent e) {
- CascadeComposite.this.mergeSelected(e);
+
+ @Override
+ protected void setValue_(Boolean value) {
+ subject.setMerge(value);
}
- });
- return button;
- }
-
- protected void mergeSelected(SelectionEvent e) {
- boolean setSelection = initializeCascade();
- if (setSelection) {
- this.cascade.setMerge(this.mergeCheckBox.getSelection());
- }
+ };
}
-
- private Button createRemoveCheckBox(Composite composite) {
- Button button = getWidgetFactory().createButton(composite, "Remove", SWT.CHECK);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- CascadeComposite.this.removeSelected(e);
+
+ private WritablePropertyValueModel<Boolean> buildCascadeTypePersistHolder() {
+ return new PropertyAspectAdapter<ICascade, Boolean>(getSubjectHolder(), ICascade.PERSIST_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return subject.isPersist();
}
- public void widgetSelected(SelectionEvent e) {
- CascadeComposite.this.removeSelected(e);
+
+ @Override
+ protected void setValue_(Boolean value) {
+ subject.setPersist(value);
}
- });
- return button;
- }
-
- protected void removeSelected(SelectionEvent e) {
- boolean setSelection = initializeCascade();
- if (setSelection) {
- this.cascade.setRemove(this.removeCheckBox.getSelection());
- }
+ };
}
-
- private Button createRefreshCheckBox(Composite composite) {
- Button button = getWidgetFactory().createButton(composite, "Refresh", SWT.CHECK);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- CascadeComposite.this.refreshSelected(e);
+
+ private WritablePropertyValueModel<Boolean> buildCascadeTypeRefreshHolder() {
+ return new PropertyAspectAdapter<ICascade, Boolean>(getSubjectHolder(), ICascade.REFRESH_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return subject.isRefresh();
}
- public void widgetSelected(SelectionEvent e) {
- CascadeComposite.this.refreshSelected(e);
+
+ @Override
+ protected void setValue_(Boolean value) {
+ subject.setRefresh(value);
}
- });
- return button;
- }
-
- protected void refreshSelected(SelectionEvent e) {
- boolean setSelection = initializeCascade();
- if (setSelection) {
- this.cascade.setRefresh(this.refreshCheckBox.getSelection());
- }
- }
-
- private boolean allCheckBoxesFalse() {
- return !(this.allCheckBox.getSelection()
- || this.persistCheckBox.getSelection()
- || this.mergeCheckBox.getSelection()
- || this.removeCheckBox.getSelection()
- || this.refreshCheckBox.getSelection());
-
-
- }
-
- private void relationshipMappingChanged(Notification notification) {
- if (notification.getFeatureID(IRelationshipMapping.class) ==
- JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__CASCADE) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- if (CascadeComposite.this.cascade != null) {
- disengageCascadeListener();
- }
- CascadeComposite.this.cascade = CascadeComposite.this.relationshipMapping.getCascade();
- populateCascade();
-
- if (CascadeComposite.this.cascade != null) {
- engageCascadeListener();
- }
- }
- });
- }
- }
-
- private void cascadeChanged(final Notification notification) {
- switch (notification.getFeatureID(ICascade.class)) {
- case JpaCoreMappingsPackage.ICASCADE__ALL :
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CascadeComposite.this.allCheckBox.setSelection(notification.getNewBooleanValue());
- }
- });
- break;
- case JpaCoreMappingsPackage.ICASCADE__PERSIST :
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CascadeComposite.this.persistCheckBox.setSelection(notification.getNewBooleanValue());
- }
- });
- break;
- case JpaCoreMappingsPackage.ICASCADE__MERGE :
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CascadeComposite.this.mergeCheckBox.setSelection(notification.getNewBooleanValue());
- }
- });
- break;
- case JpaCoreMappingsPackage.ICASCADE__REMOVE :
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CascadeComposite.this.removeCheckBox.setSelection(notification.getNewBooleanValue());
- }
- });
- break;
- case JpaCoreMappingsPackage.ICASCADE__REFRESH :
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CascadeComposite.this.refreshCheckBox.setSelection(notification.getNewBooleanValue());
- }
- });
- break;
- default :
- break;
- }
- if (notification.getFeatureID(ICascade.class) ==
- JpaCoreMappingsPackage.ICASCADE__ALL) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CascadeComposite.this.allCheckBox.setSelection(notification.getNewBooleanValue());
- }
- });
- }
-
+ };
}
-
- public void doPopulate(EObject obj) {
- this.relationshipMapping = (IRelationshipMapping) obj;
-
- if (this.relationshipMapping != null) {
- this.cascade = this.relationshipMapping.getCascade();
- populateCascade();
- }
- }
-
- private void populateCascade() {
- if (this.cascade != null) {
- this.allCheckBox.setSelection(this.cascade.isAll());
- this.persistCheckBox.setSelection(this.cascade.isPersist());
- this.mergeCheckBox.setSelection(this.cascade.isMerge());
- this.removeCheckBox.setSelection(this.cascade.isRemove());
- this.refreshCheckBox.setSelection(this.cascade.isRefresh());
- }
- else {
- this.allCheckBox.setSelection(false);
- this.persistCheckBox.setSelection(false);
- this.mergeCheckBox.setSelection(false);
- this.removeCheckBox.setSelection(false);
- this.refreshCheckBox.setSelection(false);
- }
- }
-
- public void doPopulate() {
- }
-
- protected void engageListeners() {
- if (this.relationshipMapping != null) {
- this.relationshipMapping.eAdapters().add(this.relationshipMappingListener);
- if (this.cascade != null) {
- engageCascadeListener();
+ private WritablePropertyValueModel<Boolean> buildCascadeTypeRemoveHolder() {
+ return new PropertyAspectAdapter<ICascade, Boolean>(getSubjectHolder(), ICascade.REMOVE_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return subject.isRemove();
}
- }
- }
-
- protected void engageCascadeListener() {
- this.cascade.eAdapters().add(this.cascadeListener);
- }
-
- protected void disengageCascadeListener() {
- this.cascade.eAdapters().remove(this.cascadeListener);
- }
-
- protected void disengageListeners() {
- if (this.relationshipMapping != null) {
- this.relationshipMapping.eAdapters().remove(this.relationshipMappingListener);
- if (this.cascade != null) {
- disengageCascadeListener();
+
+ @Override
+ protected void setValue_(Boolean value) {
+ subject.setRemove(value);
}
- }
+ };
}
-}
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ // Cascade group
+ Group cascadeGroup = buildTitledPane(
+ container,
+ JptUiMappingsMessages.CascadeComposite_cascadeTitle
+ );
+
+ // Container of the check boxes
+ container = buildSubPane(cascadeGroup, 5, 8, 0, 0, 0);
+
+ // All check box
+ buildCheckBox(
+ container,
+ JptUiMappingsMessages.CascadeComposite_all,
+ buildCascadeTypeAllHolder()
+ );
+
+ // Persist check box
+ buildCheckBox(
+ container,
+ JptUiMappingsMessages.CascadeComposite_persist,
+ buildCascadeTypePersistHolder()
+ );
+
+ // Merge check box
+ buildCheckBox(
+ container,
+ JptUiMappingsMessages.CascadeComposite_merge,
+ buildCascadeTypeMergeHolder()
+ );
+
+ // Remove check box
+ buildCheckBox(
+ container,
+ JptUiMappingsMessages.CascadeComposite_remove,
+ buildCascadeTypeRemoveHolder()
+ );
+
+ // Refresh check box
+ buildCheckBox(
+ container,
+ JptUiMappingsMessages.CascadeComposite_refresh,
+ buildCascadeTypeRefreshHolder()
+ );
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CatalogCombo.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CatalogCombo.java
deleted file mode 100644
index 0544782356..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CatalogCombo.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.ConnectionListener;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.Database;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class CatalogCombo extends BaseJpaController
-{
- private ITable table;
-
- private Adapter listener;
-
- /**
- * Caching the connectionProfile so we can remove the listener. If the
- * cached table object has been removed from the model then we no longer
- * have access to the parent and cannot find the connectionProfile
- */
- private ConnectionProfile connectionProfile;
-
- private ConnectionListener connectionListener;
-
- private CCombo combo;
-
- public CatalogCombo(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- this.listener = this.buildTableListener();
- this.connectionListener = this.buildConnectionListener();
- }
-
- private Adapter buildTableListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- CatalogCombo.this.catalogChanged(notification);
- }
- };
- }
-
- private ConnectionListener buildConnectionListener() {
- return new ConnectionListener() {
- public void aboutToClose(ConnectionProfile profile) {
- // not interested to this event.
- }
-
- public void closed(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CatalogCombo.this.populateCatalogCombo();
- }
- });
- }
-
- public void modified(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CatalogCombo.this.populateCatalogCombo();
- }
- });
- }
-
- public boolean okToClose(ConnectionProfile profile) {
- // not interested to this event.
- return true;
- }
-
- public void opened(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CatalogCombo.this.populateCatalogCombo();
- }
- });
- }
-
- public void databaseChanged(ConnectionProfile profile, final Database database) {
- getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (database == CatalogCombo.this.getDatabase()) {
- if (!getControl().isDisposed()) {
- CatalogCombo.this.populateCatalogCombo();
- }
- }
- }
- });
- }
-
- public void schemaChanged(ConnectionProfile profile, final Schema schema) {
- // not interested to this event.
- }
-
- public void tableChanged(ConnectionProfile profile, final Table table) {
- // not interested to this event.
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- this.combo = getWidgetFactory().createCCombo(parent, SWT.FLAT | SWT.READ_ONLY);
- this.combo.add(JptUiMappingsMessages.TableComposite_defaultEmpty);
- this.combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String catalogText = ((CCombo) e.getSource()).getText();
- if (catalogText.equals("")) { //$NON-NLS-1$
- catalogText = null;
- if (CatalogCombo.this.table.getSpecifiedCatalog() == null || CatalogCombo.this.table.getSpecifiedCatalog().equals("")) { //$NON-NLS-1$
- return;
- }
- }
- if (catalogText != null && combo.getItemCount() > 0 && catalogText.equals(combo.getItem(0))) {
- catalogText = null;
- }
- if (CatalogCombo.this.table.getSpecifiedCatalog() == null && catalogText != null) {
- CatalogCombo.this.setSpecifiedCatalog(catalogText);
- }
- if (CatalogCombo.this.table.getSpecifiedCatalog() != null && !CatalogCombo.this.table.getSpecifiedCatalog().equals(catalogText)) {
- CatalogCombo.this.setSpecifiedCatalog(catalogText);
- }
- }
- });
- }
-
- private void setSpecifiedCatalog(String catalogName) {
- this.table.setSpecifiedCatalog(catalogName);
- this.getConnectionProfile().setCatalogName(catalogName);
- }
-
- protected void catalogChanged(Notification notification) {
- if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__SPECIFIED_CATALOG) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CatalogCombo.this.populateCatalogName();
- }
- });
- }
- else if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__DEFAULT_CATALOG) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- CatalogCombo.this.populateDefaultCatalogName();
- }
- });
- }
- }
-
- public void doPopulate(EObject obj) {
- this.table = (ITable) obj;
- if (this.table != null) {
- this.populateCatalogCombo();
- }
- else {
- this.connectionProfile = null;
- }
- }
-
- public void doPopulate() {
- this.populateCatalogCombo();
- }
-
- protected Database getDatabase() {
- return this.getConnectionProfile().getDatabase();
- }
-
- private ConnectionProfile getConnectionProfile() {
- if (this.connectionProfile == null) {
- this.connectionProfile = this.table.getJpaProject().connectionProfile();
- }
- return this.connectionProfile;
- }
-
- private void populateCatalogCombo() {
- if (this.table == null) {
- return;
- }
- this.populateDefaultCatalogName();
- if (this.getConnectionProfile().isConnected()) {
- this.combo.remove(1, this.combo.getItemCount() - 1);
- Database database = this.getDatabase();
- if (database != null) {
- Iterator<String> catalogs = database.catalogNames();
- for (Iterator<String> stream = CollectionTools.sort(catalogs); stream.hasNext();) {
- this.combo.add(stream.next());
- }
- }
- }
- else {
- this.combo.remove(1, this.combo.getItemCount() - 1);
- }
- this.populateCatalogName();
- }
-
- protected void populateDefaultCatalogName() {
- // String defaultCatalogName = this.table.getDefaultCatalog(); //
- // DefaultCatalog cannot be initialized if DB not online
- String defaultCatalogName = this.getDatabase().getDefaultCatalogName(); // TOREVIEW
- int selectionIndex = combo.getSelectionIndex();
- combo.setItem(0, NLS.bind(JptUiMappingsMessages.TableComposite_defaultWithOneParam, defaultCatalogName));
- if (selectionIndex == 0) {
- combo.clearSelection();
- combo.select(0);
- }
- }
-
- protected void populateCatalogName() {
- if (this.table == null) {
- return;
- }
- String catalogName = this.table.getSpecifiedCatalog();
- // String defaultCatalogName = this.table.getDefaultCatalog(); //
- // DefaultCatalog cannot be initialized if DB not online
- String defaultCatalogName = this.getDatabase().getDefaultCatalogName(); // TOREVIEW
- if (!StringTools.stringIsEmpty(catalogName)) {
- if (!this.combo.getText().equals(catalogName)) {
- this.combo.setText(catalogName);
- }
- }
- else {
- if (!this.combo.getText().equals(NLS.bind(JptUiMappingsMessages.TableComposite_defaultWithOneParam, defaultCatalogName))) {
- this.combo.select(0);
- }
- }
- }
-
- public CCombo getCombo() {
- return this.combo;
- }
-
- @Override
- public Control getControl() {
- return getCombo();
- }
-
- @Override
- protected void disengageListeners() {
- if (this.table != null) {
- this.removeConnectionListener();
- this.table.eAdapters().remove(this.listener);
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.table != null) {
- this.table.eAdapters().add(this.listener);
- this.addConnectionListener();
- }
- }
-
- private void addConnectionListener() {
- this.getConnectionProfile().addConnectionListener(this.connectionListener);
- }
-
- private void removeConnectionListener() {
- this.getConnectionProfile().removeConnectionListener(this.connectionListener);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ColumnComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ColumnComposite.java
index 3c55a6524b..88a64b254d 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ColumnComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ColumnComposite.java
@@ -1,566 +1,319 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
+import java.util.Collection;
import java.util.Iterator;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.IAbstractColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.ConnectionListener;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.Database;
-import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.core.internal.context.base.IColumn;
+import org.eclipse.jpt.core.internal.context.base.INamedColumn;
import org.eclipse.jpt.db.internal.Table;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.EnumComboViewer.EnumHolder;
-import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.ui.internal.mappings.db.ColumnCombo;
+import org.eclipse.jpt.ui.internal.mappings.db.TableCombo;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.TriStateCheckBox;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-//TODO repopulate this panel based on the Entity table changing
-public class ColumnComposite extends BaseJpaComposite
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | ColumnCombo | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | TableCombo | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | |
+ * | x Insertable |
+ * | |
+ * | x Updatable |
+ * | |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IColumn
+ * @see ColumnCombo
+ * @see TableCombo
+ * @see BasicMappingComposite - A container of this pane
+ * @see EmbeddedAttributeOverridesComposite - A container of this pane
+ * @see IdMappingComposite - A container of this pane
+ * @see VersionMappingComposite - A container of this pane
+ *
+ * @TODO repopulate this panel based on the Entity table changing
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class ColumnComposite extends AbstractFormPane<IColumn>
{
-
- private IColumn column;
-
- private Adapter columnListener;
- private ConnectionListener connectionListener;
-
- protected CCombo columnCombo;
- protected CCombo tableCombo;
- protected EnumComboViewer insertableComboViewer;
- protected EnumComboViewer updatableComboViewer;
-
- private ConnectionProfile connectionProfile;
-
- public ColumnComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.columnListener = buildColumnListener();
- this.connectionListener = buildConnectionListener();
+ private TriStateCheckBox insertableCheckBox;
+ private TriStateCheckBox updatableCheckBox;
+
+ /**
+ * Creates a new <code>ColumnComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of the subject <code>IColumn</code>
+ * @param parent The parent container
+ */
+ public ColumnComposite(AbstractFormPane<?> parentPane,
+ PropertyValueModel<? extends IColumn> subjectHolder,
+ Composite parent) {
+
+ super(parentPane, subjectHolder, parent);
}
-
- private Adapter buildColumnListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- columnChanged(notification);
- }
- };
+
+ /**
+ * Creates a new <code>ColumnComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IColumn</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public ColumnComposite(PropertyValueModel<? extends IColumn> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
}
- private ConnectionListener buildConnectionListener() {
- return new ConnectionListener() {
+ private ColumnCombo<IColumn> buildColumnCombo(Composite container) {
- public void aboutToClose(ConnectionProfile profile) {
- // not interested to this event.
- }
+ return new ColumnCombo<IColumn>(this, container) {
- public void closed(ConnectionProfile profile) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- ColumnComposite.this.populateColumnCombo();
- }
- });
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(INamedColumn.DEFAULT_NAME_PROPERTY);
+ propertyNames.add(INamedColumn.SPECIFIED_NAME_PROPERTY);
}
- public void modified(ConnectionProfile profile) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- ColumnComposite.this.populateColumnCombo();
- }
- });
+ @Override
+ protected String defaultValue() {
+ return subject().getDefaultName();
}
- public boolean okToClose(ConnectionProfile profile) {
- // not interested to this event.
- return true;
+ @Override
+ protected void setValue(String value) {
+ subject().setSpecifiedName(value);
}
- public void opened(ConnectionProfile profile) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- ColumnComposite.this.populateColumnCombo();
- }
- });
+ @Override
+ protected Table table() {
+ return subject().dbTable();
}
- public void databaseChanged(ConnectionProfile profile, final Database database) {
- return;
+ @Override
+ protected String value() {
+ return subject().getSpecifiedName();
}
+ };
+ }
- public void schemaChanged(ConnectionProfile profile, final Schema schema) {
- return;
+ private WritablePropertyValueModel<Boolean> buildInsertableHolder() {
+ return new PropertyAspectAdapter<IColumn, Boolean>(
+ getSubjectHolder(),
+ IColumn.DEFAULT_INSERTABLE_PROPERTY,
+ IColumn.SPECIFIED_INSERTABLE_PROPERTY)
+ {
+ @Override
+ protected Boolean buildValue_() {
+ return subject.getSpecifiedInsertable();
}
- public void tableChanged(ConnectionProfile profile, final Table table) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if(table == getDbTable()) {
- if (!getControl().isDisposed()) {
- ColumnComposite.this.populateColumnCombo();
- }
- }
- }
- });
+ @Override
+ protected void setValue_(Boolean value) {
+ subject.setSpecifiedInsertable(value);
}
};
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- Group columnGroup = getWidgetFactory().createGroup(composite, JptUiMappingsMessages.ColumnComposite_columnSection);
- layout = new GridLayout();
- layout.marginHeight = 0;
- columnGroup.setLayout(layout);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace= true;
- columnGroup.setLayoutData(gridData);
-
- //created this composite because combos as direct children of a Group do not have a border, no clue why
- Composite intermediaryComposite = getWidgetFactory().createComposite(columnGroup);
- layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- intermediaryComposite.setLayout(layout);
-
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace= true;
- intermediaryComposite.setLayoutData(gridData);
-
-
- CommonWidgets.buildColumnLabel(intermediaryComposite, getWidgetFactory());
-
- this.columnCombo = buildColumnCombo(intermediaryComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.columnCombo.setLayoutData(gridData);
- helpSystem.setHelp(columnCombo, IJpaHelpContextIds.MAPPING_COLUMN);
-
-
- CommonWidgets.buildColumnTableLabel(intermediaryComposite, getWidgetFactory());
-
- this.tableCombo = buildTableCombo(intermediaryComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.tableCombo.setLayoutData(gridData);
- helpSystem.setHelp(tableCombo, IJpaHelpContextIds.MAPPING_COLUMN_TABLE);
-
- getWidgetFactory().createLabel(intermediaryComposite, JptUiMappingsMessages.ColumnComposite_insertable);
-
- this.insertableComboViewer = new EnumComboViewer(intermediaryComposite, this.commandStack, getWidgetFactory());
- this.insertableComboViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- helpSystem.setHelp(this.insertableComboViewer.getControl(), IJpaHelpContextIds.MAPPING_COLUMN_INSERTABLE);
-
- getWidgetFactory().createLabel(intermediaryComposite, JptUiMappingsMessages.ColumnComposite_updatable);
-
- this.updatableComboViewer = new EnumComboViewer(intermediaryComposite, this.commandStack, getWidgetFactory());
- this.updatableComboViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- helpSystem.setHelp(this.updatableComboViewer.getControl(), IJpaHelpContextIds.MAPPING_COLUMN_UPDATABLE);
}
-
-
- private CCombo buildColumnCombo(Composite parent) {
- final CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(JptUiMappingsMessages.ColumnComposite_defaultEmpty);
- combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String columnText = ((CCombo) e.getSource()).getText();
- if (columnText.equals("")) { //$NON-NLS-1$
- columnText = null;
- if (column.getSpecifiedName() == null || column.getSpecifiedName().equals("")) { //$NON-NLS-1$
- return;
- }
- }
-
- if (columnText != null && combo.getItemCount() > 0 && columnText.equals(combo.getItem(0))) {
- columnText = null;
- }
- if (column.getSpecifiedName() == null && columnText != null) {
- column.setSpecifiedName(columnText);
- }
- if (column.getSpecifiedName() != null && !column.getSpecifiedName().equals(columnText)) {
- column.setSpecifiedName(columnText);
- }
- }
- });
- return combo;
- }
-
- private CCombo buildTableCombo(Composite parent) {
- final CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(JptUiMappingsMessages.ColumnComposite_defaultEmpty);
- combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String tableText = ((CCombo) e.getSource()).getText();
- if (tableText.equals("")) { //$NON-NLS-1$
- tableText = null;
- if (column.getSpecifiedTable() == null || column.getSpecifiedTable().equals("")) { //$NON-NLS-1$
- return;
+ private PropertyValueModel<String> buildInsertableStringHolder() {
+
+ return new TransformationPropertyValueModel<Boolean, String>(buildInsertableHolder()) {
+
+ @Override
+ protected String transform(Boolean value) {
+
+ if ((subject() != null) && (value == null)) {
+
+ Boolean defaultValue = subject().getDefaultInsertable();
+
+ if (defaultValue != null) {
+
+ String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True :
+ JptUiMappingsMessages.Boolean_False;
+
+ return NLS.bind(
+ JptUiMappingsMessages.ColumnComposite_insertableWithDefault,
+ defaultStringValue
+ );
}
}
-
- if (tableText != null && combo.getItemCount() > 0 && tableText.equals(combo.getItem(0))) {
- tableText = null;
- }
- if (column.getSpecifiedTable() == null && tableText != null) {
- column.setSpecifiedTable(tableText);
- }
- if (column.getSpecifiedTable() != null && !column.getSpecifiedTable().equals(tableText)) {
- column.setSpecifiedTable(tableText);
- }
+ return JptUiMappingsMessages.ColumnComposite_insertable;
}
- });
- return combo;
-
- }
-
- protected void columnChanged(Notification notification) {
- if (notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__SPECIFIED_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed() || isPopulating()) {
- return;
- }
- populateColumnName();
- }
- });
- }
- else if (notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateDefaultColumnName();
- }
- });
- }
- else if (notification.getFeatureID(IAbstractColumn.class) == JpaCoreMappingsPackage.IABSTRACT_COLUMN__DEFAULT_TABLE) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateDefaultColumnTable();
- populateColumnCombo();
- }
- });
- }
- else if (notification.getFeatureID(IAbstractColumn.class) == JpaCoreMappingsPackage.IABSTRACT_COLUMN__SPECIFIED_TABLE) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateColumnTable();
- populateColumnCombo();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.column != null) {
- this.column.eAdapters().add(this.columnListener);
- this.addConnectionListener();
- }
+ };
}
- @Override
- protected void disengageListeners() {
- if (this.column != null) {
- this.removeConnectionListener();
- this.column.eAdapters().remove(this.columnListener);
- }
- }
+ private TableCombo<IColumn> buildTableCombo(Composite container) {
- private ConnectionProfile getConnectionProfile() {
- if (this.connectionProfile == null) {
- this.connectionProfile = this.column.getJpaProject().connectionProfile();
- }
- return this.connectionProfile;
- }
-
- private void addConnectionListener() {
- this.getConnectionProfile().addConnectionListener(this.connectionListener);
- }
-
- private void removeConnectionListener() {
- this.getConnectionProfile().removeConnectionListener(this.connectionListener);
- }
-
- private Table getDbTable() {
- return this.column.dbTable();
- }
+ return new TableCombo<IColumn>(this, container) {
- private void populateColumnCombo() {
- //TODO don't do instanceof check here - check on Table, or isRoot check on Entity
- //this.tableCombo.setEnabled(!(this.table instanceof SingleTableInheritanceChildTableImpl));
- populateDefaultColumnName();
-
- if (this.getConnectionProfile().isConnected()) {
- this.columnCombo.remove(1, this.columnCombo.getItemCount()-1);
- Table table = getDbTable();
- if (table != null) {
- for (Iterator i = CollectionTools.sort(CollectionTools.list(table.columnNames())).iterator(); i.hasNext();) {
- this.columnCombo.add((String) i.next());
- }
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(IColumn.DEFAULT_TABLE_PROPERTY);
+ propertyNames.add(IColumn.SPECIFIED_TABLE_PROPERTY);
}
- }
- else {
- this.columnCombo.remove(1, this.columnCombo.getItemCount()-1);
- }
- populateColumnName();
- }
-
- protected void populateDefaultColumnName() {
- String defaultTableName = column.getDefaultName();
- int selectionIndex = columnCombo.getSelectionIndex();
- columnCombo.setItem(0, NLS.bind(JptUiMappingsMessages.ColumnComposite_defaultWithOneParam, defaultTableName));
- if (selectionIndex == 0) {
- //combo text does not update when switching between 2 mappings of the same type
- //that both have a default column name. clear the selection and then set it again
- columnCombo.clearSelection();
- columnCombo.select(0);
- }
- }
-
- protected void populateColumnName() {
- String specifiedColumnName = this.column.getSpecifiedName();
- if (specifiedColumnName != null) {
- if (!this.columnCombo.getText().equals(specifiedColumnName)) {
- this.columnCombo.setText(specifiedColumnName);
+
+ @Override
+ protected String defaultValue() {
+ return subject().getDefaultTable();
}
- }
- else {
- String defaultColumnName = this.column.getDefaultName();
- if (!this.columnCombo.getText().equals(NLS.bind(JptUiMappingsMessages.ColumnComposite_defaultWithOneParam, defaultColumnName))) {
- this.columnCombo.select(0);
+
+ @Override
+ protected void setValue(String value) {
+ subject().setSpecifiedTable(value);
}
- }
- }
-
- private void populateTableCombo() {
- //TODO don't do instanceof check here - check on Table, or isRoot check on Entity
- //this.tableCombo.setEnabled(!(this.table instanceof SingleTableInheritanceChildTableImpl));
- populateDefaultColumnTable();
- this.tableCombo.remove(1, this.tableCombo.getItemCount()-1);
-
- if (this.column != null) {
- for (Iterator i = this.column.getOwner().getTypeMapping().associatedTableNamesIncludingInherited(); i.hasNext(); ) {
- this.tableCombo.add((String) i.next());
+
+ @Override
+ protected Table table() {
+ return subject().dbTable();
}
- }
- populateColumnTable();
- }
-
- protected void populateDefaultColumnTable() {
- String defaultTableName = column.getDefaultTable();
- int selectionIndex = tableCombo.getSelectionIndex();
- tableCombo.setItem(0, NLS.bind(JptUiMappingsMessages.ColumnComposite_defaultWithOneParam, defaultTableName));
- if (selectionIndex == 0) {
- //combo text does not update when switching between 2 mappings of the same type
- //that both have a default column name. clear the selection and then set it again
- tableCombo.clearSelection();
- tableCombo.select(0);
- }
- }
-
- protected void populateColumnTable() {
- String tableName = this.column.getSpecifiedTable();
- String defaultTableName = this.column.getDefaultTable();
- if (tableName != null) {
- if (!this.tableCombo.getText().equals(tableName)) {
- this.tableCombo.setText(tableName);
+
+ @Override
+ protected String value() {
+ return subject().getSpecifiedTable();
}
- }
- else {
- if (!this.tableCombo.getText().equals(NLS.bind(JptUiMappingsMessages.ColumnComposite_defaultWithOneParam, defaultTableName))) {
- this.tableCombo.select(0);
+
+ @Override
+ protected Iterator<String> values() {
+ return subject().owner().typeMapping().associatedTableNamesIncludingInherited();
}
- }
+ };
}
- public void doPopulate(EObject obj) {
- this.column = (IColumn) obj;
- if (this.column != null) {
- populateColumnCombo();
- populateTableCombo();
- }
- this.insertableComboViewer.populate(new InsertableHolder(this.column));
- this.updatableComboViewer.populate(new UpdatableHolder(this.column));
- }
-
- public void doPopulate() {
- if (this.column != null) {
- populateColumnCombo();
- populateTableCombo();
- }
- else {
- this.connectionProfile = null;
- }
- this.insertableComboViewer.populate();
- this.updatableComboViewer.populate();
+ private WritablePropertyValueModel<Boolean> buildUpdatableHolder() {
+ return new PropertyAspectAdapter<IColumn, Boolean>(
+ getSubjectHolder(),
+ IColumn.DEFAULT_UPDATABLE_PROPERTY,
+ IColumn.SPECIFIED_UPDATABLE_PROPERTY)
+ {
+ @Override
+ protected Boolean buildValue_() {
+ return subject.getSpecifiedUpdatable();
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ subject.setSpecifiedUpdatable(value);
+ }
+ };
}
-
- protected void enableWidgets(boolean enabled) {
- this.columnCombo.setEnabled(enabled);
- this.tableCombo.setEnabled(enabled);
- this.insertableComboViewer.getControl().setEnabled(enabled);
- this.updatableComboViewer.getControl().setEnabled(enabled);
+
+ private PropertyValueModel<String> buildUpdatableStringHolder() {
+
+ return new TransformationPropertyValueModel<Boolean, String>(buildUpdatableHolder()) {
+
+ @Override
+ protected String transform(Boolean value) {
+
+ if ((subject() != null) && (value == null)) {
+
+ Boolean defaultValue = subject().getDefaultUpdatable();
+
+ if (defaultValue != null) {
+
+ String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True :
+ JptUiMappingsMessages.Boolean_False;
+
+ return NLS.bind(
+ JptUiMappingsMessages.ColumnComposite_updatableWithDefault,
+ defaultStringValue
+ );
+ }
+ }
+
+ return JptUiMappingsMessages.ColumnComposite_updatable;
+ }
+ };
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- public void dispose() {
- this.insertableComboViewer.dispose();
- this.updatableComboViewer.dispose();
- super.dispose();
- }
-
- private class InsertableHolder extends EObjectImpl implements EnumHolder {
-
- private IAbstractColumn column;
-
- InsertableHolder(IAbstractColumn column) {
- super();
- this.column = column;
- }
-
- public Object get() {
- return this.column.getInsertable();
- }
-
- public void set(Object enumSetting) {
- this.column.setInsertable((DefaultTrueBoolean) enumSetting);
-
- }
-
- public Class featureClass() {
- return IAbstractColumn.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__INSERTABLE;
- }
-
- public EObject wrappedObject() {
- return this.column;
- }
-
- public Object[] enumValues() {
- return DefaultTrueBoolean.VALUES.toArray();
- }
-
- public Object defaultValue() {
- return DefaultTrueBoolean.DEFAULT;
- }
-
- public String defaultString() {
- //TODO move this out of the UI into the model
- return "True";
- }
+ public void enableWidgets(boolean enabled) {
+ super.enableWidgets(enabled);
+ insertableCheckBox.setEnabled(enabled);
+ updatableCheckBox.setEnabled(enabled);
}
- private class UpdatableHolder extends EObjectImpl implements EnumHolder {
-
- private IAbstractColumn column;
-
- UpdatableHolder(IAbstractColumn column) {
- super();
- this.column = column;
- }
-
- public Object get() {
- return this.column.getUpdatable();
- }
-
- public void set(Object enumSetting) {
- this.column.setUpdatable((DefaultTrueBoolean) enumSetting);
-
- }
-
- public Class featureClass() {
- return IAbstractColumn.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__UPDATABLE;
- }
-
- public EObject wrappedObject() {
- return this.column;
- }
-
- public Object[] enumValues() {
- return DefaultTrueBoolean.VALUES.toArray();
- }
-
- public Object defaultValue() {
- return DefaultTrueBoolean.DEFAULT;
- }
-
- public String defaultString() {
- //TODO move this out of the UI into the model
- return "True";
- }
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ // Column group pane
+ container = buildTitledPane(
+ container,
+ JptUiMappingsMessages.ColumnComposite_columnSection
+ );
+
+ // Column widgets
+ ColumnCombo<IColumn> columnCombo = buildColumnCombo(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.ColumnChooser_label,
+ columnCombo.getControl(),
+ IJpaHelpContextIds.MAPPING_COLUMN
+ );
+
+ // Table widgets
+ TableCombo<IColumn> tableCombo = buildTableCombo(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.ColumnTableChooser_label,
+ tableCombo.getControl(),
+ IJpaHelpContextIds.MAPPING_COLUMN_TABLE
+ );
+
+ // Insertable widgets
+ insertableCheckBox = buildTriStateCheckBoxWithDefault(
+ container,
+ JptUiMappingsMessages.ColumnComposite_insertable,
+ buildInsertableHolder(),
+ buildInsertableStringHolder(),
+ IJpaHelpContextIds.MAPPING_COLUMN_INSERTABLE
+ );
+
+ // Updatable widgets
+ updatableCheckBox = buildTriStateCheckBoxWithDefault(
+ container,
+ JptUiMappingsMessages.ColumnComposite_updatable,
+ buildUpdatableHolder(),
+ buildUpdatableStringHolder(),
+ IJpaHelpContextIds.MAPPING_COLUMN_UPDATABLE
+ );
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CommonWidgets.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CommonWidgets.java
index 14fd1119c0..04239dfad1 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CommonWidgets.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/CommonWidgets.java
@@ -3,302 +3,24 @@
* 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.jpt.core.internal.mappings.DefaultEagerFetchType;
-import org.eclipse.jpt.core.internal.mappings.DefaultLazyFetchType;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.IAbstractColumn;
-import org.eclipse.jpt.core.internal.mappings.IColumn;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.EnumComboViewer.EnumHolder;
-import org.eclipse.jpt.ui.internal.mappings.details.StringWithDefaultChooser.StringHolder;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class CommonWidgets
+public class CommonWidgets
{
- public static Label buildEntityNameLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.EntityGeneralSection_name);
- }
-
- public static EntityNameCombo buildEntityNameCombo(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new EntityNameCombo(parent, commandStack, widgetFactory);
- }
-
- public static Label buildTableLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.TableChooser_label);
- }
-
public static Label buildCatalogLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
return widgetFactory.createLabel(parent, JptUiMappingsMessages.CatalogChooser_label);
}
-
+
public static Label buildSchemaLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
return widgetFactory.createLabel(parent, JptUiMappingsMessages.SchemaChooser_label);
}
-
- public static StringWithDefaultChooser buildStringWithDefaultChooser(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new StringWithDefaultChooser(parent, commandStack, widgetFactory);
- }
-
-
- public static Label buildFetchLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.BasicGeneralSection_fetchLabel);
- }
-
- public static Label buildTargetEntityLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.TargetEntityChooser_label);
- }
-
- public static Label buildOptionalLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.BasicGeneralSection_optionalLabel);
- }
-
- public static Label buildTemporalLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.BasicGeneralSection_temporalLabel);
- }
-
- public static Label buildEnumeratedLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.BasicGeneralSection_enumeratedLabel);
- }
-
- public static Label buildMappedByLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.NonOwningMapping_mappedByLabel);
- }
-
- public static EnumComboViewer buildEnumComboViewer(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new EnumComboViewer(parent, commandStack, widgetFactory);
- }
-
- public static EnumHolder buildMultiRelationshipMappingFetchEnumHolder(IMultiRelationshipMapping mapping) {
- return new FetchHolder(mapping);
- }
-
- public static EnumHolder buildSingleRelationshipMappingFetchEnumHolder(ISingleRelationshipMapping mapping) {
- return new SingleRelationshipMappingFetchHolder(mapping);
- }
-
- public static EnumHolder buildOptionalHolder(ISingleRelationshipMapping mapping) {
- return new OptionalHolder(mapping);
- }
-
- public static Label buildColumnLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.ColumnChooser_label);
- }
-
- public static Label buildColumnTableLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiMappingsMessages.ColumnTableChooser_label);
- }
-
- public static ColumnTableHolder buildColumnTableHolder(IColumn column) {
- return new ColumnTableHolder(column);
- }
-
- public static TargetEntityChooser buildTargetEntityChooser(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new TargetEntityChooser(parent, commandStack, widgetFactory);
- }
- private static class FetchHolder extends EObjectImpl implements EnumHolder {
-
- private IMultiRelationshipMapping mapping;
-
- FetchHolder(IMultiRelationshipMapping mapping) {
- super();
- this.mapping = mapping;
- }
-
- public Object get() {
- return this.mapping.getFetch();
- }
-
- public void set(Object enumSetting) {
- this.mapping.setFetch((DefaultLazyFetchType) enumSetting);
-
- }
-
- public Class featureClass() {
- return IMultiRelationshipMapping.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__FETCH;
- }
-
- public EObject wrappedObject() {
- return this.mapping;
- }
-
- public Object[] enumValues() {
- return DefaultLazyFetchType.VALUES.toArray();
- }
-
- public Object defaultValue() {
- return DefaultLazyFetchType.DEFAULT;
- }
-
- public String defaultString() {
- //TODO move this out of the UI into the model
- return "Lazy";
- }
- }
-
- private static class SingleRelationshipMappingFetchHolder extends EObjectImpl implements EnumHolder {
-
- private ISingleRelationshipMapping mapping;
-
- SingleRelationshipMappingFetchHolder(ISingleRelationshipMapping mapping) {
- super();
- this.mapping = mapping;
- }
-
- public Object get() {
- return this.mapping.getFetch();
- }
-
- public void set(Object enumSetting) {
- this.mapping.setFetch((DefaultEagerFetchType) enumSetting);
-
- }
-
- public Class featureClass() {
- return ISingleRelationshipMapping.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__FETCH;
- }
-
- public EObject wrappedObject() {
- return this.mapping;
- }
-
- public Object[] enumValues() {
- return DefaultEagerFetchType.VALUES.toArray();
- }
-
- public Object defaultValue() {
- return DefaultEagerFetchType.DEFAULT;
- }
-
- public String defaultString() {
- //TODO move this out of the UI into the model
- return "Eager";
- }
- }
- private static abstract class ColumnHolder extends EObjectImpl implements StringHolder {
- private IAbstractColumn column;
-
- ColumnHolder(IAbstractColumn column) {
- super();
- this.column = column;
- }
-
- public Class featureClass() {
- return IAbstractColumn.class;
- }
-
- public boolean supportsDefault() {
- return true;
- }
-
- public EObject wrappedObject() {
- return this.column;
- }
-
- protected IAbstractColumn getColumn() {
- return this.column;
- }
- }
-
- public static class ColumnTableHolder extends ColumnHolder implements StringHolder {
-
- ColumnTableHolder(IAbstractColumn column) {
- super(column);
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__SPECIFIED_TABLE;
- }
-
- public int defaultFeatureId() {
- return JpaCoreMappingsPackage.IABSTRACT_COLUMN__DEFAULT_TABLE;
- }
-
- public String defaultItem() {
- String defaultName = getColumn().getDefaultTable();
- if (defaultName != null) {
- return NLS.bind(JptUiMappingsMessages.ColumnComposite_defaultWithOneParam, defaultName);
- }
- return JptUiMappingsMessages.ColumnComposite_defaultEmpty;
- }
-
- public String getString() {
- return getColumn().getSpecifiedTable();
- }
-
- public void setString(String newName) {
- getColumn().setSpecifiedTable(newName);
- }
- }
-
- private static class OptionalHolder extends EObjectImpl implements EnumHolder {
-
- private ISingleRelationshipMapping mapping;
-
- OptionalHolder(ISingleRelationshipMapping mapping) {
- super();
- this.mapping = mapping;
- }
-
- public Object get() {
- return this.mapping.getOptional();
- }
-
- public void set(Object enumSetting) {
- this.mapping.setOptional((DefaultTrueBoolean) enumSetting);
- }
-
- public Class featureClass() {
- return ISingleRelationshipMapping.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__OPTIONAL;
- }
-
- public EObject wrappedObject() {
- return this.mapping;
- }
-
- public Object[] enumValues() {
- return DefaultTrueBoolean.VALUES.toArray();
- }
-
- public Object defaultValue() {
- return DefaultTrueBoolean.DEFAULT;
- }
-
- public String defaultString() {
- //TODO move this out of the UI into the model
- return "True";
- }
-
- }
-
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddableComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddableComposite.java
index b7c98a5e16..658156b652 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddableComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddableComposite.java
@@ -1,114 +1,51 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddable;
+import org.eclipse.jpt.ui.internal.details.IJpaComposite;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class EmbeddableComposite extends BaseJpaComposite
+/**
+ * This pane does not have any widgets.
+ *
+ * @see IEmbeddable
+ * @see BaseJpaUiFactory - The factory creating this pane
+ * @see EmbeddableUiProvider
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class EmbeddableComposite extends AbstractFormPane<IEmbeddable>
+ implements IJpaComposite<IEmbeddable>
{
-// private IEmbeddable embeddable;
-// private Adapter mappedSuperclassListener;
-
- public EmbeddableComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- //this.mappedSuperclassListener = buildMappedSuperclassListener();
- }
-
-// private Adapter buildMappedSuperclassListener() {
-// return new AdapterImpl() {
-// @Override
-// public void notifyChanged(Notification notification) {
-// mappedSuperclassChanged(notification);
-// }
-// };
-// }
-
- @Override
- protected void initializeLayout(Composite composite) {
- composite.setLayout(new FillLayout(SWT.VERTICAL));
-
-// Label accessTypeLabel = new Label(composite, SWT.LEFT);
-// accessTypeLabel.setText(DaliUiMessages.MappedSuperclassComposite_accessType);
-// this.accessTypeComboViewer = buildAccessTypeCombo(composite);
-// //eventually this will be enabled if editing xml instead of java
-// this.accessTypeComboViewer.getCombo().setEnabled(false);
-// GridData gridData = new GridData();
-// gridData.horizontalAlignment = GridData.FILL;
-// gridData.grabExcessHorizontalSpace = true;
-// this.accessTypeComboViewer.getCombo().setLayoutData(gridData);
-// PlatformUI.getWorkbench().getHelpSystem().setHelp(this.accessTypeComboViewer.getCombo(), IDaliHelpContextIds.ENTITY_ACCESS_TYPE);
-
- }
-
-// private ComboViewer buildAccessTypeCombo(Composite parent) {
-// ComboViewer viewer = new ComboViewer(parent, SWT.READ_ONLY);
-// viewer.add(AccessType.VALUES.toArray());
-// viewer.addSelectionChangedListener(new ISelectionChangedListener() {
-// public void selectionChanged(SelectionChangedEvent event) {
-// if (populating) {
-// return;
-// }
-// if (event.getSelection() instanceof StructuredSelection) {
-// StructuredSelection selection = (StructuredSelection) event.getSelection();
-// editingDomain.getCommandStack().execute(SetCommand.create(editingDomain, persistentType, OrmPackage.eINSTANCE.getPersistentType_AccessType(), selection.getFirstElement()));
-// }
-// }
-// });
-// return viewer;
-// }
-
- @Override
- protected void doPopulate(EObject model) {
- //this.embeddable = (IEmbeddable) model;
- }
-
- @Override
- protected void doPopulate() {
-
- }
-
-
- protected void engageListeners() {
-// this.persistentTypeItemProvider.addListener(getPersistentTypeListener());
-// this.persistentType.eAdapters().add(this.persistentTypeItemProvider);
+ /**
+ * Creates a new <code>EmbeddableComposite</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public EmbeddableComposite(PropertyValueModel<? extends IEmbeddable> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
}
- protected void disengageListeners() {
-// if (this.persistentType != null){
-// this.persistentType.eAdapters().remove(this.persistentTypeItemProvider);
-// this.persistentTypeItemProvider.removeListener(getPersistentTypeListener());
-// }
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
}
-
-// private INotifyChangedListener getPersistentTypeListener() {
-// if (this.persistentTypeListener == null) {
-// this.persistentTypeListener = new INotifyChangedListener() {
-// public void notifyChanged(Notification notification) {
-// if (notification.getFeatureID(PersistentType.class) == OrmPackage.PERSISTENT_TYPE__ACCESS_TYPE) {
-// final AccessType accessType = (AccessType) notification.getNewValue();
-// Display.getDefault().syncExec(new Runnable() {
-// public void run() {
-// if (((StructuredSelection) accessTypeComboViewer.getSelection()).getFirstElement() != accessType) {
-// accessTypeComboViewer.setSelection(new StructuredSelection(accessType));
-// }
-// }
-// });
-// }
-// }
-// };
-// }
-// return this.persistentTypeListener;
-// }
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedAttributeOverridesComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedAttributeOverridesComposite.java
index d0da0632d9..197bf3fb04 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedAttributeOverridesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedAttributeOverridesComposite.java
@@ -3,336 +3,341 @@
* 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.ui.internal.mappings.details;
import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
+import org.eclipse.jpt.core.internal.context.base.IAttributeOverride;
+import org.eclipse.jpt.core.internal.context.base.IColumn;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
+import org.eclipse.jpt.ui.internal.swt.ListBoxModelAdapter;
+import org.eclipse.jpt.ui.internal.util.ControlEnabler;
+import org.eclipse.jpt.ui.internal.util.PaneEnabler;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.CollectionAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.TransformationListValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationWritablePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
+import org.eclipse.swt.widgets.List;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class EmbeddedAttributeOverridesComposite extends BaseJpaComposite
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | AddRemoveListPane | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | |
+ * | x Override Default |
+ * | |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | ColumnComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IEmbeddedMapping
+ * @see EmbeddedMappingComposite - The parent container
+ * @see ColumnComposite
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class EmbeddedAttributeOverridesComposite extends AbstractFormPane<IEmbeddedMapping>
{
- private ListViewer listViewer;
-
- private IEmbedded embedded;
- private Adapter embeddedListener;
-
- private IAttributeOverride attributeOverride;
- private Adapter attributeOverrideListener;
-
- protected ColumnComposite columnComposite;
-
- private Button overrideDefaultButton;
-
- public EmbeddedAttributeOverridesComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.embeddedListener = buildEmbeddedListener();
- this.attributeOverrideListener = buildAttributeOverrideListener();
+ private WritablePropertyValueModel<IAttributeOverride> attributeOverrideHolder;
+ private List list;
+
+ /**
+ * Creates a new <code>EmbeddedAttributeOverridesComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public EmbeddedAttributeOverridesComposite(AbstractFormPane<? extends IEmbeddedMapping> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
}
-
- private Adapter buildEmbeddedListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- embeddedChanged(notification);
- }
- };
+
+ /**
+ * Creates a new <code>EmbeddedAttributeOverridesComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IEmbeddedMapping</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public EmbeddedAttributeOverridesComposite(PropertyValueModel<? extends IEmbeddedMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
}
-
- private Adapter buildAttributeOverrideListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- attributeOverrideChanged(notification);
+
+ private WritablePropertyValueModel<IAttributeOverride> buildAttributeOverrideHolder() {
+ return new SimplePropertyValueModel<IAttributeOverride>();
+ }
+
+ private CollectionValueModel<IAttributeOverride> buildAttributeOverridesCollectionHolder() {
+ return new CollectionAspectAdapter<IEmbeddedMapping, IAttributeOverride>(
+ this.getSubjectHolder(),
+ IEmbeddedMapping.DEFAULT_ATTRIBUTE_OVERRIDES_LIST,
+ IEmbeddedMapping.SPECIFIED_ATTRIBUTE_OVERRIDES_LIST)
+ {
+ @Override
+ protected Iterator<IAttributeOverride> iterator_() {
+ return subject.attributeOverrides();
}
};
}
-
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- Group attributeOverridesGroup = getWidgetFactory().createGroup(
- composite, JptUiMappingsMessages.AttributeOverridesComposite_attributeOverrides);
- attributeOverridesGroup.setLayout(new GridLayout(2, true));
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace= true;
- attributeOverridesGroup.setLayoutData(gridData);
-
- this.listViewer = buildAttributeOverridesListViewer(attributeOverridesGroup);
- gridData = new GridData();
- gridData.verticalSpan = 2;
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace= true;
- this.listViewer.getList().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.listViewer.getList(), IJpaHelpContextIds.MAPPING_EMBEDDED_ATTRIBUTE_OVERRIDES);
-
- this.overrideDefaultButton = getWidgetFactory().createButton(attributeOverridesGroup, "Override Default", SWT.CHECK);
- this.overrideDefaultButton.addSelectionListener(buildOverrideDefaultSelectionListener());
- gridData = new GridData();
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.overrideDefaultButton.setLayoutData(gridData);
-
-
- this.columnComposite = new ColumnComposite(attributeOverridesGroup, commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.columnComposite.getControl().setLayoutData(gridData);
+ private List buildAttributeOverridesList(Composite parent,
+ WritablePropertyValueModel<IAttributeOverride> attributeOverrideHolder) {
+
+ WritablePropertyValueModel<String> selectedItemHolder =
+ buildSelectedAttributeOverrideHolder(attributeOverrideHolder);
+
+ List list = buildList(
+ parent,
+ selectedItemHolder,
+ IJpaHelpContextIds.MAPPING_EMBEDDED_ATTRIBUTE_OVERRIDES
+ );
+
+ ListBoxModelAdapter.adapt(
+ buildAttributeOverridesStringListHolder(),
+ selectedItemHolder,
+ list
+ );
+
+ return list;
}
-
- private SelectionListener buildOverrideDefaultSelectionListener() {
- return new SelectionListener(){
-
- public void widgetSelected(SelectionEvent e) {
- overrideDefaultButtonSelected(e);
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- overrideDefaultButtonSelected(e);
+
+ private ListValueModel<IAttributeOverride> buildAttributeOverridesListHolder() {
+ return new SortedListValueModelAdapter<IAttributeOverride>(
+ buildAttributeOverridesCollectionHolder()
+ );
+ }
+
+ private ListValueModel<String> buildAttributeOverridesStringListHolder() {
+ return new TransformationListValueModelAdapter<IAttributeOverride, String>(buildAttributeOverridesListHolder()) {
+ @Override
+ protected String transformItem(IAttributeOverride item) {
+ return item.getName();
}
};
}
-
- private void overrideDefaultButtonSelected(SelectionEvent e) {
- boolean selection = this.overrideDefaultButton.getSelection();
- if (selection) {
- int index = this.embedded.getSpecifiedAttributeOverrides().size();
- IAttributeOverride attributeOverride = this.embedded.createAttributeOverride(index);
- this.embedded.getSpecifiedAttributeOverrides().add(attributeOverride);
- attributeOverride.setName(this.attributeOverride.getName());
- attributeOverride.getColumn().setSpecifiedName(this.attributeOverride.getColumn().getName());
- }
- else {
- this.embedded.getSpecifiedAttributeOverrides().remove(this.attributeOverride);
- }
- }
-
-
- private ListViewer buildAttributeOverridesListViewer(Composite parent) {
- ListViewer listViewer = new ListViewer(parent, SWT.SINGLE | SWT.BORDER);
- listViewer.setLabelProvider(buildAttributeOverridesLabelProvider());
- listViewer.setContentProvider(buildAttributeOverridesContentProvider());
-
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- attributeOverridesListSelectionChanged(event);
- }
- });
- return listViewer;
+ private PropertyValueModel<Boolean> buildColumnEnablementHolder(PropertyValueModel<IColumn> columnHolder) {
+ return new TransformationPropertyValueModel<IColumn, Boolean>(columnHolder) {
+ @Override
+ protected Boolean transform(IColumn value) {
+ return (value != null);
+ }
+ };
}
-
- protected void attributeOverridesListSelectionChanged(SelectionChangedEvent event) {
- if (((StructuredSelection) event.getSelection()).isEmpty()) {
- this.columnComposite.populate(null);
- this.columnComposite.enableWidgets(false);
- this.overrideDefaultButton.setSelection(false);
- this.overrideDefaultButton.setEnabled(false);
- }
- else {
- this.attributeOverride = getSelectedAttributeOverride();
- boolean specifiedOverride = this.embedded.getSpecifiedAttributeOverrides().contains(this.attributeOverride);
- this.overrideDefaultButton.setSelection(specifiedOverride);
- this.columnComposite.populate(this.attributeOverride.getColumn());
- this.columnComposite.enableWidgets(specifiedOverride);
- this.overrideDefaultButton.setEnabled(true);
- }
+
+ private PropertyValueModel<IColumn> buildColumnHolder(WritablePropertyValueModel<IAttributeOverride> attributeOverrideHolder) {
+ return new TransformationPropertyValueModel<IAttributeOverride, IColumn>(attributeOverrideHolder) {
+ @Override
+ protected IColumn transform_(IAttributeOverride value) {
+ return value.getColumn();
+ }
+ };
}
-
- private ILabelProvider buildAttributeOverridesLabelProvider() {
- return new LabelProvider() {
- public String getText(Object element) {
- //TODO also display column name somehow
- return ((IAttributeOverride) element).getName();
+
+ private PropertyValueModel<Boolean> buildOverrideDefaultButtonBooleanHolder(PropertyValueModel<IAttributeOverride> attributeOverrideHolder) {
+ return new TransformationPropertyValueModel<IAttributeOverride, Boolean>(attributeOverrideHolder) {
+ @Override
+ protected Boolean transform(IAttributeOverride value) {
+ return (value != null);
}
};
}
-
- private IContentProvider buildAttributeOverridesContentProvider() {
- return new IStructuredContentProvider() {
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ private WritablePropertyValueModel<Boolean> buildOverrideDefaultHolder(WritablePropertyValueModel<IAttributeOverride> attributeOverrideHolder) {
+ return new TransformationWritablePropertyValueModel<IAttributeOverride, Boolean>(attributeOverrideHolder) {
+ @Override
+ public void setValue(Boolean value) {
+ // Not done here
}
-
- public void dispose() {
+
+ @Override
+ protected Boolean transform_(IAttributeOverride value) {
+ return !value.isVirtual();
}
-
- public Object[] getElements(Object inputElement) {
- return ((IEmbedded) inputElement).getAttributeOverrides().toArray();
+ };
+ }
+
+ private SelectionListener buildOverrideDefaultSelectionListener() {
+ return new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Button button = (Button) e.widget;
+ overrideDefaultButtonSelected(button.getSelection());
}
};
}
- private IAttributeOverride getSelectedAttributeOverride() {
- return (IAttributeOverride) ((StructuredSelection) this.listViewer.getSelection()).getFirstElement();
+ private void buildPropertiesPane(Composite container,
+ WritablePropertyValueModel<IAttributeOverride> attributeOverrideHolder) {
+
+ // Override Default check box
+ Button overrideDefaultButton = buildCheckBox(
+ container,
+ JptUiMappingsMessages.AttributeOverridesComposite_overrideDefault,
+ buildOverrideDefaultHolder(attributeOverrideHolder)
+ );
+
+ GridData data = new GridData();
+ data.horizontalIndent = groupBoxMargin();
+ data.verticalIndent = 0;
+ overrideDefaultButton.setLayoutData(data);
+
+ overrideDefaultButton.addSelectionListener(
+ buildOverrideDefaultSelectionListener()
+ );
+
+ installOverrideDefaultButtonEnabler(
+ attributeOverrideHolder,
+ overrideDefaultButton
+ );
+
+ // Column widgets
+ PropertyValueModel<IColumn> columnHolder = buildColumnHolder(attributeOverrideHolder);
+
+ ColumnComposite columnComposite = new ColumnComposite(
+ this,
+ columnHolder,
+ container
+ );
+
+ data = new GridData();
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ columnComposite.getControl().setLayoutData(data);
+
+ installColumnCompositeEnabler(columnHolder, columnComposite);
}
-
-
- public void doPopulate(EObject obj) {
- this.embedded = (IEmbedded) obj;
- if (this.embedded == null) {
- this.attributeOverride = null;
- this.columnComposite.populate(null);
- this.listViewer.setInput(null);
- return;
- }
-
- if (this.listViewer.getInput() != this.embedded) {
- this.listViewer.setInput(this.embedded);
- }
- if (!this.embedded.getAttributeOverrides().isEmpty()) {
- if (this.listViewer.getSelection().isEmpty()) {
- IAttributeOverride attributeOverride = this.embedded.getAttributeOverrides().get(0);
- this.listViewer.setSelection(new StructuredSelection(attributeOverride));
+
+ private WritablePropertyValueModel<String> buildSelectedAttributeOverrideHolder(WritablePropertyValueModel<IAttributeOverride> attributeOverrideHolder) {
+ return new TransformationWritablePropertyValueModel<IAttributeOverride, String>(attributeOverrideHolder) {
+ @Override
+ protected IAttributeOverride reverseTransform_(String value) {
+ for (Iterator<IAttributeOverride> iter = subject().attributeOverrides(); iter.hasNext(); ) {
+ IAttributeOverride attributeOverride = iter.next();
+ if (attributeOverride.getName().equals(value)) {
+ return attributeOverride;
+ }
+ }
+ return null;
}
- else {
- this.columnComposite.enableWidgets(true);
- this.columnComposite.populate(((IAttributeOverride)((StructuredSelection) this.listViewer.getSelection()).getFirstElement()).getColumn());
+
+ @Override
+ protected String transform_(IAttributeOverride value) {
+ return value.getName();
}
- }
- else {
- this.columnComposite.populate(null);
- this.columnComposite.enableWidgets(false);
- }
+ };
}
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void doPopulate() {
- this.columnComposite.doPopulate();
+ protected void initialize() {
+ super.initialize();
+ this.attributeOverrideHolder = buildAttributeOverrideHolder();
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void engageListeners() {
- if (this.embedded != null) {
- this.embedded.eAdapters().add(this.embeddedListener);
- for (IAttributeOverride attributeOverride : this.embedded.getAttributeOverrides()) {
- attributeOverride.eAdapters().add(this.attributeOverrideListener);
- }
- }
+ protected void initializeLayout(Composite container) {
+
+ WritablePropertyValueModel<IAttributeOverride> attributeOverrideHolder =
+ buildAttributeOverrideHolder();
+
+ // Attribute Overrides group box
+ Composite groupBox = buildTitledPane(
+ container,
+ JptUiMappingsMessages.AttributeOverridesComposite_attributeOverrides
+ );
+
+ // Sub-pane to align the check box and ColumnComposite
+ // to the right of the list
+ container = buildSubPane(groupBox, 1, 5, 0, 0, 0);
+
+ // Attribute Overrides list
+ list = buildAttributeOverridesList(
+ container,
+ attributeOverrideHolder
+ );
+
+ GridData data = new GridData();
+ data.verticalSpan = 2;
+ data.grabExcessVerticalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ list.setLayoutData(data);
+
+ // Properties for the selected attribute overrides
+ buildPropertiesPane(
+ buildSubPane(container, 5, 0),
+ attributeOverrideHolder
+ );
}
-
- @Override
- protected void disengageListeners() {
- if (this.embedded != null) {
- this.embedded.eAdapters().remove(this.embeddedListener);
- for (IAttributeOverride attributeOverride : this.embedded.getAttributeOverrides()) {
- attributeOverride.eAdapters().remove(this.attributeOverrideListener);
- }
- }
+
+ private void installColumnCompositeEnabler(PropertyValueModel<IColumn> columnHolder,
+ ColumnComposite columnComposite) {
+
+ new PaneEnabler(
+ buildColumnEnablementHolder(columnHolder),
+ columnComposite
+ );
}
-
- protected void embeddedChanged(Notification notification) {
- switch (notification.getFeatureID(IEmbedded.class)) {
- case JpaCoreMappingsPackage.IEMBEDDED__SPECIFIED_ATTRIBUTE_OVERRIDES :
- case JpaCoreMappingsPackage.IEMBEDDED__DEFAULT_ATTRIBUTE_OVERRIDES :
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (listViewer.getList().isDisposed()) {
- return;
- }
- listViewer.refresh();
- columnComposite.enableWidgets(!listViewer.getSelection().isEmpty());
- if (listViewer.getSelection().isEmpty()) {
- columnComposite.populate(null);
- }
- }
- });
- if (notification.getEventType() == Notification.ADD) {
- ((IAttributeOverride) notification.getNewValue()).eAdapters().add(this.attributeOverrideListener);
- final Object newValue = notification.getNewValue();
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (listViewer.getList().isDisposed()) {
- return;
- }
- listViewer.setSelection(new StructuredSelection(newValue));
- }
- });
- }
- else if (notification.getEventType() == Notification.ADD_MANY) {
- List addedList = (List) notification.getNewValue();
- for (Iterator<IAttributeOverride> i = addedList.iterator(); i.hasNext(); ) {
- IAttributeOverride override = i.next();
- override.eAdapters().add(this.attributeOverrideListener);
- }
- }
- else if (notification.getEventType() == Notification.REMOVE) {
- ((IAttributeOverride) notification.getOldValue()).eAdapters().remove(this.attributeOverrideListener);
- }
- else if (notification.getEventType() == Notification.REMOVE_MANY) {
- List removedList = (List) notification.getOldValue();
- for (Iterator<IAttributeOverride> i = removedList.iterator(); i.hasNext(); ) {
- IAttributeOverride override = i.next();
- override.eAdapters().remove(this.attributeOverrideListener);
- }
- }
- break;
- default :
- break;
- }
+ private void installOverrideDefaultButtonEnabler(PropertyValueModel<IAttributeOverride> attributeOverrideHolder,
+ Button overrideDefaultButton) {
+
+ new ControlEnabler(
+ this.buildOverrideDefaultButtonBooleanHolder(attributeOverrideHolder),
+ overrideDefaultButton
+ );
}
- protected void attributeOverrideChanged(Notification notification) {
- switch (notification.getFeatureID(IAttributeOverride.class)) {
- case JpaCoreMappingsPackage.IATTRIBUTE_OVERRIDE__NAME :
- final IAttributeOverride attributeOverride = (IAttributeOverride) notification.getNotifier();
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- listViewer.refresh(attributeOverride);
- }
- });
- break;
- default :
- break;
+ private void overrideDefaultButtonSelected(boolean overrideDefault) {
+
+ if (overrideDefault) {
+ int index = this.subject().specifiedAttributeOverridesSize();
+
+ IAttributeOverride defaultAttributeOverride = this.attributeOverrideHolder.value();
+ IAttributeOverride attributeOverride = this.subject().addSpecifiedAttributeOverride(index);
+
+ attributeOverride.setName(defaultAttributeOverride.getName());
+ attributeOverride.getColumn().setSpecifiedName(defaultAttributeOverride.getColumn().getName());
+ }
+ else {
+ this.subject().removeSpecifiedAttributeOverride(this.list.getSelectionIndex());
}
}
-
- public void dispose() {
- this.columnComposite.dispose();
- super.dispose();
- }
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedComposite.java
deleted file mode 100644
index 3ad33eb5a1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedComposite.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class EmbeddedComposite extends BaseJpaComposite
-{
- private EmbeddedAttributeOverridesComposite attributeOverridesComposite;
-
- public EmbeddedComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- GridData gridData;
-
- this.attributeOverridesComposite = new EmbeddedAttributeOverridesComposite(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.attributeOverridesComposite.getControl().setLayoutData(gridData);
- }
-
-
- public void doPopulate(EObject obj) {
- this.attributeOverridesComposite.populate(obj);
- }
-
- public void doPopulate() {
- this.attributeOverridesComposite.populate();
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
- @Override
- public void dispose() {
- this.attributeOverridesComposite.dispose();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedIdComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedIdComposite.java
deleted file mode 100644
index 13111065c2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedIdComposite.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class EmbeddedIdComposite extends BaseJpaComposite
-{
- public EmbeddedIdComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
-
- }
-
-
- public void doPopulate(EObject obj) {
- }
-
- public void doPopulate() {
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedIdMappingComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedIdMappingComposite.java
new file mode 100644
index 0000000000..33b424858b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedIdMappingComposite.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
+import org.eclipse.jpt.ui.internal.details.IJpaComposite;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * This pane does not have any widgets.
+ *
+ * @see IEmbeddedIdMapping
+ * @see BaseJpaUiFactory - The factory creating this pane
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class EmbeddedIdMappingComposite extends AbstractFormPane<IEmbeddedIdMapping>
+ implements IJpaComposite<IEmbeddedIdMapping>
+{
+ /**
+ * Creates a new <code>EmbeddedIdMappingComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IEmbeddedIdMapping</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public EmbeddedIdMappingComposite(PropertyValueModel<? extends IEmbeddedIdMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite composite) {
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedMappingComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedMappingComposite.java
new file mode 100644
index 0000000000..4f520202c9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EmbeddedMappingComposite.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
+import org.eclipse.jpt.ui.internal.details.IJpaComposite;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | EmbeddedAttributeOverridesComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IEmbeddedMapping
+ * @see BaseJpaUiFactory - The factory creating this pane
+ * @see EmbeddedAttributeOverridesComposite
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class EmbeddedMappingComposite extends AbstractFormPane<IEmbeddedMapping>
+ implements IJpaComposite<IEmbeddedMapping>
+{
+ /**
+ * Creates a new <code>EmbeddedMappingComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IEmbeddedMapping</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public EmbeddedMappingComposite(PropertyValueModel<? extends IEmbeddedMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ new EmbeddedAttributeOverridesComposite(
+ this,
+ container
+ );
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityComposite.java
index e81b6f23a7..8f3d63b076 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityComposite.java
@@ -1,213 +1,156 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.ITable;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
+import org.eclipse.jpt.ui.internal.details.IJpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class EntityComposite extends BaseJpaComposite
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | EntityNameCombo | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | TableComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | |
+ * | - v Attribute Overrides ------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | OverridesComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | |
+ * | - v Secondary Tables ---------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | SecondaryTablesComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | |
+ * | - v Inheritance --------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | InheritanceComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IBasicMapping
+ * @see BaseJpaUiFactory - The factory creating this pane
+ * @see EntityNameCombo
+ * @see InheritanceComposite
+ * @see OverridesComposite
+ * @see SecondaryTablesComposite
+ * @see TableComposite
+ *
+ * TODO talk to JavaEditor people about what we can do to hook in TabbedProperties for the JavaEditor
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class EntityComposite extends AbstractFormPane<IEntity>
+ implements IJpaComposite<IEntity>
{
- private IEntity entity;
-
- private EntityNameCombo entityNameCombo;
-
- private TableComposite tableComposite;
- private InheritanceComposite inheritanceComposite;
- private SecondaryTablesComposite secondaryTablesComposite;
- private OverridesComposite attributeOverridesComposite;
-
- public EntityComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- Control generalControl = buildGeneralComposite(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generalControl.setLayoutData(gridData);
-
- Control attributeOverridesControl = buildAttributeOverridesComposite(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- attributeOverridesControl.setLayoutData(gridData);
-
- Control secondaryTablesControl = buildSecondaryTablesComposite(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- secondaryTablesControl.setLayoutData(gridData);
-
- Control inheritanceControl = buildInheritanceComposite(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- inheritanceControl.setLayoutData(gridData);
- }
-
- private Control buildGeneralComposite(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- Composite generalComposite = getWidgetFactory().createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- generalComposite.setLayout(layout);
-
- CommonWidgets.buildEntityNameLabel(generalComposite, getWidgetFactory());
-
- this.entityNameCombo =
- CommonWidgets.buildEntityNameCombo(generalComposite, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.entityNameCombo.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(this.entityNameCombo.getCombo(), IJpaHelpContextIds.ENTITY_NAME);
-
-
- this.tableComposite = new TableComposite(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.tableComposite.getControl().setLayoutData(gridData);
-
- return generalComposite;
- }
-
- private Control buildSecondaryTablesComposite(Composite composite) {
- Section section = getWidgetFactory().createSection(composite, SWT.FLAT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
- section.setText(JptUiMappingsMessages.SecondaryTablesComposite_secondaryTables);
-
- Composite client = getWidgetFactory().createComposite(section);
- section.setClient(client);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- client.setLayout(layout);
-
- this.secondaryTablesComposite = new SecondaryTablesComposite(client, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.secondaryTablesComposite.getControl().setLayoutData(gridData);
-
- return section;
- }
+ /**
+ * Creates a new <code>EntityComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IEntity</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public EntityComposite(PropertyValueModel<? extends IEntity> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
- private Control buildInheritanceComposite(Composite composite) {
- Section section = getWidgetFactory().createSection(composite, SWT.FLAT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
- section.setText(JptUiMappingsMessages.EntityComposite_inheritance);
-
- Composite inheritanceClient = getWidgetFactory().createComposite(section);
- section.setClient(inheritanceClient);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- inheritanceClient.setLayout(layout);
-
- this.inheritanceComposite = new InheritanceComposite(inheritanceClient, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.inheritanceComposite.getControl().setLayoutData(gridData);
-
- return section;
+ super(subjectHolder, parent, widgetFactory);
}
- private Control buildAttributeOverridesComposite(Composite composite) {
- Section section = getWidgetFactory().createSection(composite, SWT.FLAT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
- section.setText(JptUiMappingsMessages.AttributeOverridesComposite_attributeOverrides);
- //section.setExpanded(true); //not going to expand this for now, it causes the scroll bar not to appear
- Composite client = getWidgetFactory().createComposite(section);
- section.setClient(client);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- client.setLayout(layout);
-
- this.attributeOverridesComposite = new OverridesComposite(client, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.attributeOverridesComposite.getControl().setLayoutData(gridData);
-
- return section;
+ private PropertyValueModel<ITable> buildTableHolder() {
+ return new TransformationPropertyValueModel<IEntity, ITable>(getSubjectHolder()) {
+ @Override
+ protected ITable transform_(IEntity value) {
+ return value.getTable();
+ }
+ };
}
- //TODO talk to JavaEditor people about what we can do to hook in TabbedProperties for the JavaEditor
-
- public void doPopulate(EObject obj) {
- this.entity = (IEntity) obj;
- this.entityNameCombo.populate(obj);
- this.attributeOverridesComposite.populate(obj);
- this.secondaryTablesComposite.populate(obj);
- this.inheritanceComposite.populate(obj);
- if (this.entity != null) {
- this.tableComposite.populate(this.entity.getTable());
- }
- else {
- this.tableComposite.populate(null);
- }
- }
-
- public void doPopulate() {
- this.entityNameCombo.populate();
- this.tableComposite.populate();
- this.attributeOverridesComposite.populate();
- this.secondaryTablesComposite.populate();
- this.inheritanceComposite.populate();
+ private void initializeAttributeOverridesPane(Composite container) {
+
+ container = buildSection(
+ container,
+ JptUiMappingsMessages.AttributeOverridesComposite_attributeOverrides
+ );
+
+ new OverridesComposite(this, container);
}
-
- protected void engageListeners() {
+
+ private void initializeGeneralPane(Composite container) {
+
+ int groupBoxMargin = groupBoxMargin();
+ EntityNameCombo entityNameCombo = new EntityNameCombo(this, container);
+
+ // Entity Name widgets
+ buildLabeledComposite(
+ buildSubPane(container, 1, 0, groupBoxMargin, 0, groupBoxMargin),
+ JptUiMappingsMessages.EntityGeneralSection_name,
+ entityNameCombo.getControl(),
+ IJpaHelpContextIds.ENTITY_NAME
+ );
+
+ // Table widgets
+ new TableComposite(this, buildTableHolder(), container);
}
-
- protected void disengageListeners() {
+
+ private void initializeInheritancePane(Composite container) {
+
+ container = buildSection(
+ container,
+ JptUiMappingsMessages.EntityComposite_inheritance
+ );
+
+ new InheritanceComposite(this, container);
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- public void dispose() {
- this.entityNameCombo.dispose();
- this.tableComposite.dispose();
- this.attributeOverridesComposite.dispose();
- this.secondaryTablesComposite.dispose();
- this.inheritanceComposite.dispose();
- super.dispose();
- }
-
- protected IEntity getEntity() {
- return this.entity;
+ protected void initializeLayout(Composite container) {
+
+ initializeGeneralPane(container);
+ initializeAttributeOverridesPane(container);
+ initializeSecondaryTablesPane(container);
+ initializeInheritancePane(container);
}
-}
+ private void initializeSecondaryTablesPane(Composite container) {
+
+ container = buildSection(
+ container,
+ JptUiMappingsMessages.SecondaryTablesComposite_secondaryTables
+ );
+
+ new SecondaryTablesComposite(this, container);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityNameCombo.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityNameCombo.java
index 8fe0ffcf4c..90bbfcaac8 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityNameCombo.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EntityNameCombo.java
@@ -1,165 +1,143 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
import java.util.Arrays;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-// TODO get Default updating appropriately based on Entity name default
-
-public class EntityNameCombo extends BaseJpaController
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------ |
+ * | Entity Name: | I |v| |
+ * | ------------------------------------------------------------ |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IEntity
+ * @see EntityComposite - The parent container
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class EntityNameCombo extends AbstractFormPane<IEntity>
{
- private IEntity entity;
- private Adapter entityListener;
-
private CCombo combo;
-
-
- public EntityNameCombo(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, commandStack, widgetFactory);
- buildEntityListener();
+
+ /**
+ * Creates a new <code>EntityNameCombo</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public EntityNameCombo(AbstractFormPane<? extends IEntity> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void addPropertyNames(java.util.Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(IEntity.DEFAULT_NAME_PROPERTY);
+ propertyNames.add(IEntity.SPECIFIED_NAME_PROPERTY);
}
-
-
- private void buildEntityListener() {
- entityListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- entityChanged(notification);
+
+ private ModifyListener buildComboModifyListener() {
+ return new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ comboModified(e);
}
};
}
-
- @Override
- protected void buildWidget(Composite parent) {
- combo = this.widgetFactory.createCCombo(parent, SWT.FLAT);
- combo.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- comboModified(e);
- }
- });
- }
-
+
private void comboModified(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
-
String text = ((CCombo) e.getSource()).getText();
+
if (text.equals(combo.getItem(0))) {
text = null;
}
-
- entity.setSpecifiedName(text);
-
+
+ subject().setSpecifiedName(text);
+
// TODO Does this need to be done?
//this.editingDomain.getCommandStack().execute(SetCommand.create(this.editingDomain, this.entity, MappingsPackage.eINSTANCE.getEntity_SpecifiedName(), text));
}
-
- private void entityChanged(Notification notification) {
- switch (notification.getFeatureID(IEntity.class)) {
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_NAME :
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- break;
- case JpaCoreMappingsPackage.IENTITY__DEFAULT_NAME :
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- break;
- }
- }
-
- @Override
- protected void engageListeners() {
- if (entity != null) {
- entity.eAdapters().add(entityListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (entity != null) {
- entity.eAdapters().remove(entityListener);
- }
- }
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- public void doPopulate(EObject obj) {
- entity = (IEntity) obj;
+ protected void doPopulate() {
+ super.doPopulate();
populateCombo();
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void doPopulate() {
- populateCombo();
+ protected void initializeLayout(Composite container) {
+ combo = buildCombo(container);
+ combo.addModifyListener(buildComboModifyListener());
}
-
+
private void populateCombo() {
- if (entity == null) {
+ if (subject() == null) {
combo.clearSelection();
- combo.setItems(new String[] {});
- return;
- }
-
- String defaultItem = NLS.bind(JptUiMappingsMessages.EntityGeneralSection_nameDefaultWithOneParam, entity.getDefaultName());
- String specifiedName = entity.getSpecifiedName();
-
- if (specifiedName == null) {
- setComboData(defaultItem, new String[] {defaultItem});
+ combo.setItems(new String[0]);
}
else {
- setComboData(specifiedName, new String[] {defaultItem});
+ String defaultItem = NLS.bind(JptUiMappingsMessages.EntityGeneralSection_nameDefaultWithOneParam, subject().getDefaultName());
+ String specifiedName = subject().getSpecifiedName();
+
+ if (specifiedName == null) {
+ setComboData(defaultItem, new String[] { defaultItem });
+ }
+ else {
+ setComboData(specifiedName, new String[] { defaultItem });
+ }
}
}
-
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void propertyChanged(String propertyName) {
+ super.propertyChanged(propertyName);
+
+ if (propertyName == IEntity.DEFAULT_NAME_PROPERTY ||
+ propertyName == IEntity.SPECIFIED_NAME_PROPERTY) {
+
+ populateCombo();
+ }
+ }
+
private void setComboData(String text, String[] items) {
if (! Arrays.equals(items, combo.getItems())) {
combo.setItems(items);
}
-
+
if (! text.equals(combo.getText())) {
combo.setText(text);
}
}
-
- public CCombo getCombo() {
- return combo;
- }
-
- @Override
- public Control getControl() {
- return getCombo();
- }
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumComboViewer.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumComboViewer.java
deleted file mode 100644
index 7cb415f359..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumComboViewer.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class EnumComboViewer extends BaseJpaController
-{
- private EnumHolder enumHolder;
- private Adapter enumListener;
-
- private ComboViewer comboViewer;
-
-
- public EnumComboViewer(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildListener();
- }
-
-
- private void buildListener() {
- this.enumListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- modelChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent);
- this.comboViewer = new ComboViewer(combo);
- this.comboViewer.setLabelProvider(buildLabelProvider());
- this.comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- EnumComboViewer.this.selectionChanged(event.getSelection());
- }
- });
- }
- protected IBaseLabelProvider buildLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- if (element == enumHolder.defaultValue()) {
- return NLS.bind(JptUiMappingsMessages.EnumComboViewer_default, enumHolder.defaultString());
- }
- return super.getText(element);
- }
- };
- }
-
- void selectionChanged(ISelection sel) {
- if (sel instanceof IStructuredSelection) {
- Object selection = ((IStructuredSelection) sel).getFirstElement();
- if ( ! this.enumHolder.get().equals(selection)) {
- this.enumHolder.set(selection);
-// this.editingDomain.getCommandStack().execute(
-// SetCommand.create(
-// this.editingDomain,
-// this.basicMapping,
-// OrmPackage.eINSTANCE.getBasicMapping_Optional(),
-// optional
-// )
-// );
- }
- }
- }
-
- private void modelChanged(Notification notification) {
- if (notification.getFeatureID(this.enumHolder.featureClass()) ==
- this.enumHolder.featureId()) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.enumHolder != null && this.enumHolder.wrappedObject() != null) {
- this.enumHolder.wrappedObject().eAdapters().add(this.enumListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.enumHolder != null && this.enumHolder.wrappedObject() != null) {
- this.enumHolder.wrappedObject().eAdapters().remove(this.enumListener);
- }
- }
-
- public final void populate(EnumHolder enumHolder) {
- super.populate(enumHolder);
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.enumHolder = (EnumHolder) obj;
- populateCombo();
- }
-
- @Override
- protected void doPopulate() {
- populateCombo();
- }
-
- private void populateCombo() {
- this.comboViewer.getCombo().removeAll();
- if (this.enumHolder.wrappedObject() == null) {
- return;
- }
-
- this.comboViewer.add(this.enumHolder.enumValues());
-
- Object modelSetting = this.enumHolder.get();
-
- if (((IStructuredSelection) this.comboViewer.getSelection()).getFirstElement() != modelSetting) {
- this.comboViewer.setSelection(new StructuredSelection(modelSetting));
- }
- }
-
-
- @Override
- public Control getControl() {
- return this.comboViewer.getCombo();
- }
-
-
- /**
- * An interface to wrap an object that supports accessType
- * An object of this type must be passed in to populate(EObject)
- */
- public static interface EnumHolder extends EObject {
- /**
- * Return the num setting from the wrapped object
- * @return
- */
- Object get();
-
- /**
- * Set the enum setting on the wrapped object
- * @param fetch
- */
- void set(Object enumSetting);
-
- /**
- * Return the Class of the wrapped object
- * @return
- */
- Class featureClass();
-
- /**
- * Return the feature id of enum setting on the wrapped object
- * @return
- */
- int featureId();
-
- /**
- * The wrapped EObject that the enum setting is stored on
- * @return
- */
- EObject wrappedObject();
-
- Object[] enumValues();
-
- /**
- * Return the Default Enumerator object
- */
- Object defaultValue();
-
- /**
- * Return the String to be displayed to the user
- * Deafult ([defaultString()])
- */
- String defaultString();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumTypeComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumTypeComposite.java
new file mode 100644
index 0000000000..685bc25def
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/EnumTypeComposite.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
+
+import java.util.Collection;
+import org.eclipse.jpt.core.internal.context.base.EnumType;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.EnumComboViewer;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | -------------------------------------------------------------- |
+ * | Enum Type: | |v| |
+ * | -------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IBasicMapping
+ * @see BasicMappingComposite - A container of this widget
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class EnumTypeComposite extends AbstractFormPane<IBasicMapping>
+{
+ /**
+ * Creates a new <code>FetchTypeComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public EnumTypeComposite(AbstractFormPane<? extends IBasicMapping> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ private EnumComboViewer<IBasicMapping, EnumType> buildEnumTypeCombo(Composite container) {
+
+ return new EnumComboViewer<IBasicMapping, EnumType>(this, container) {
+
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(IBasicMapping.DEFAULT_ENUMERATED_PROPERTY);
+ propertyNames.add(IBasicMapping.SPECIFIED_ENUMERATED_PROPERTY);
+ }
+
+ @Override
+ protected EnumType[] choices() {
+ return EnumType.values();
+ }
+
+ @Override
+ protected EnumType defaultValue() {
+ return subject().getDefaultEnumerated();
+ }
+
+ @Override
+ protected String displayString(EnumType value) {
+ return buildDisplayString(
+ JptUiMappingsMessages.class,
+ EnumTypeComposite.this,
+ value
+ );
+ }
+
+ @Override
+ protected EnumType getValue() {
+ return subject().getSpecifiedEnumerated();
+ }
+
+ @Override
+ protected void setValue(EnumType value) {
+ subject().setSpecifiedEnumerated(value);
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ EnumComboViewer<IBasicMapping, EnumType> enumTypeCombo =
+ buildEnumTypeCombo(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.BasicGeneralSection_enumeratedLabel,
+ enumTypeCombo.getControl(),
+ IJpaHelpContextIds.MAPPING_ENUMERATED
+ );
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/FetchTypeComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/FetchTypeComposite.java
new file mode 100644
index 0000000000..7d8e17482b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/FetchTypeComposite.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
+
+import java.util.Collection;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.base.IFetchable;
+import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.EnumComboViewer;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------ |
+ * | Fetch: | |v| |
+ * | ------------------------------------------------------------------ |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IFetchable
+ * @see BasicMappingComposite - A container of this widget
+ * @see ManyToManyMappingComposite - A container of this widget
+ * @see ManyToOneMappingComposite - A container of this widget
+ * @see OneToManyMappingComposite - A container of this widget
+ * @see OneToOneMappingComposite - A container of this widget
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class FetchTypeComposite extends AbstractFormPane<IFetchable> {
+
+ /**
+ * Creates a new <code>FetchTypeComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public FetchTypeComposite(AbstractFormPane<? extends IFetchable> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ private EnumComboViewer<IFetchable, FetchType> buildFetchTypeCombo(Composite container) {
+
+ return new EnumComboViewer<IFetchable, FetchType>(this, container) {
+
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(IFetchable.DEFAULT_FETCH_PROPERTY);
+ propertyNames.add(IFetchable.SPECIFIED_FETCH_PROPERTY);
+ }
+
+ @Override
+ protected FetchType[] choices() {
+ return FetchType.values();
+ }
+
+ @Override
+ protected FetchType defaultValue() {
+ return subject().getDefaultFetch();
+ }
+
+ @Override
+ protected String displayString(FetchType value) {
+ return buildDisplayString(
+ JptUiMappingsMessages.class,
+ FetchTypeComposite.this,
+ value
+ );
+ }
+
+ @Override
+ protected FetchType getValue() {
+ return subject().getSpecifiedFetch();
+ }
+
+ @Override
+ protected void setValue(FetchType value) {
+ subject().setSpecifiedFetch(value);
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ EnumComboViewer<IFetchable, FetchType> fetchTypeCombo =
+ buildFetchTypeCombo(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.BasicGeneralSection_fetchLabel,
+ fetchTypeCombo.getControl(),
+ IJpaHelpContextIds.MAPPING_FETCH_TYPE
+ );
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratedValueComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratedValueComposite.java
index 11285beeed..33b5289eed 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratedValueComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratedValueComposite.java
@@ -1,288 +1,351 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
-import java.util.Iterator;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.mappings.GenerationType;
-import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.platform.IGeneratorRepository;
-import org.eclipse.jpt.core.internal.platform.NullGeneratorRepository;
+import java.util.Collection;
+import org.eclipse.jpt.core.internal.context.base.GenerationType;
+import org.eclipse.jpt.core.internal.context.base.IGeneratedValue;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
+import org.eclipse.jpt.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.EnumComboViewer;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class GeneratedValueComposite extends BaseJpaComposite
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | --------------------------------------------------------- |
+ * | Strategy: | I |v| |
+ * | --------------------------------------------------------- |
+ * | --------------------------------------------------------- |
+ * | Generator Name: | I |v| |
+ * | --------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IIdMapping
+ * @see IGeneratedValue
+ * @see GenerationComposite - The parent container
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+@SuppressWarnings("nls")
+public class GeneratedValueComposite extends AbstractFormPane<IIdMapping>
{
- private IId id;
- private IGeneratedValue generatedValue;
- private Adapter generatedValueListener;
+ private PropertyChangeListener generatedValueChangeListener;
+ private PropertyChangeListener generatorNameChangeListener;
+ private CCombo generatorNameCombo;
+ private PropertyChangeListener subjectChangeListener;
- private ComboViewer strategyComboViewer;
+ /**
+ * Creates a new <code>GeneratedValueComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public GeneratedValueComposite(AbstractFormPane<? extends IIdMapping> parentPane,
+ Composite parent) {
- private CCombo generatorNameCombo;
+ super(parentPane, parent);
+ }
- protected boolean populating;
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(IGeneratedValue.SPECIFIED_GENERATOR_PROPERTY);
+ }
- public GeneratedValueComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.generatedValueListener = buildGeneratedValueListener();
+ private PropertyChangeListener buildGeneratedValueChangeListener() {
+ return new SWTPropertyChangeListenerWrapper(buildGeneratedValueChangeListener_());
}
- private Adapter buildGeneratedValueListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- generatedValueChanged(notification);
+ private PropertyChangeListener buildGeneratedValueChangeListener_() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent e) {
+
+ IGeneratedValue oldValue = (IGeneratedValue) e.oldValue();
+ IGeneratedValue newValue = (IGeneratedValue) e.newValue();
+
+ uninstallGeneratedValueListeners(oldValue);
+ repopulate();
+ installGeneratedValueListeners(newValue);
}
};
}
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- composite.setLayout(layout);
-
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.GeneratedValueComposite_strategy);
-
- this.strategyComboViewer = buildStrategyComboViewer(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.strategyComboViewer.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(this.strategyComboViewer.getCombo(), IJpaHelpContextIds.MAPPING_GENERATED_VALUE_STRATEGY);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.GeneratedValueComposite_generatorName);
-
- this.generatorNameCombo = buildGeneratorNameCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.generatorNameCombo.setLayoutData(gridData);
- helpSystem.setHelp(this.generatorNameCombo, IJpaHelpContextIds.MAPPING_GENERATED_VALUE_GENERATOR_NAME);
-
- // TODO
- // buildGeneratorNameSelectionButton( this);
- }
- private ComboViewer buildStrategyComboViewer(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent);
- ComboViewer viewer = new ComboViewer(combo);
- viewer.setLabelProvider(buildStrategyLabelProvider());
- viewer.add(GenerationType.VALUES.toArray());
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- if (populating) {
- return;
- }
- if (event.getSelection() instanceof StructuredSelection) {
- StructuredSelection selection = (StructuredSelection) event.getSelection();
- GenerationType selectedType = (GenerationType) selection.getFirstElement();
- if (generatedValue == null) {
- createGeneratedValue();
- }
- if (!generatedValue.getStrategy().equals(selectedType)) {
- generatedValue.setStrategy(selectedType);
- }
- }
- }
- });
- return viewer;
+ private PropertyChangeListener buildGeneratorNameChangeListener() {
+ return new SWTPropertyChangeListenerWrapper(buildGeneratorNameChangeListener_());
}
- private IBaseLabelProvider buildStrategyLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- if (element == GenerationType.DEFAULT) {
- //TODO need to move this to the model, don't want hardcoded String
- return NLS.bind(JptUiMappingsMessages.GeneratedValueComposite_default, "Auto");
+ private PropertyChangeListener buildGeneratorNameChangeListener_() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent e) {
+ if (isPopulating()) {
+ return;
}
- return super.getText(element);
+
+ populateGeneratorName();
}
};
}
-
- protected CCombo buildGeneratorNameCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
+ private CCombo buildGeneratorNameCombo(Composite parent) {
+
+ CCombo combo = buildCombo(parent);
combo.add(JptUiMappingsMessages.TableComposite_defaultEmpty);
- combo.addModifyListener(new ModifyListener() {
+ combo.addModifyListener(buildGeneratorNameModifyListener());
+ return combo;
+ }
+
+ private ModifyListener buildGeneratorNameModifyListener() {
+ return new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (isPopulating()) {
return;
}
+
String generatorName = ((CCombo) e.getSource()).getText();
-
- if (generatorName.equals("")) { //$NON-NLS-1$
- if (generatedValue.getGenerator() == null || generatedValue.getGenerator().equals("")) {
+ IGeneratedValue generatedValue = subject().getGeneratedValue();
+
+ if (StringTools.stringIsEmpty(generatorName)) {
+
+ if ((generatedValue == null) ||
+ StringTools.stringIsEmpty(generatedValue.getGenerator()))
+ {
return;
}
+
generatorName = null;
}
+
if (generatedValue == null) {
- createGeneratedValue();
+ generatedValue = subject().addGeneratedValue();
}
- generatedValue.setGenerator(generatorName);
+
+ generatedValue.setSpecifiedGenerator(generatorName);
}
- });
- return combo;
+ };
}
- private void createGeneratedValue() {
- this.generatedValue = this.id.createGeneratedValue();
- this.id.setGeneratedValue(this.generatedValue);
+ private PropertyValueModel<IGeneratedValue> buildGeneratorValueHolder() {
+ return new PropertyAspectAdapter<IIdMapping, IGeneratedValue>(getSubjectHolder(), IIdMapping.GENERATED_VALUE_PROPERTY) {
+ @Override
+ protected IGeneratedValue buildValue_() {
+ return subject().getGeneratedValue();
+ }
+ };
}
-
- protected void generatedValueChanged(Notification notification) {
- if (notification.getFeatureID(IGeneratedValue.class) == JpaCoreMappingsPackage.IGENERATED_VALUE__STRATEGY) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- if (selectedStrategy() != generatedValue.getStrategy()) {
- strategyComboViewer.setSelection(new StructuredSelection(generatedValue.getStrategy()));
- }
- }
- });
- }
- else if (notification.getFeatureID(IGeneratedValue.class) == JpaCoreMappingsPackage.IGENERATED_VALUE__GENERATOR) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateGeneratorName();
+ private EnumComboViewer<IGeneratedValue, GenerationType> buildStrategyComboViewer(Composite parent) {
+ return new EnumComboViewer<IGeneratedValue, GenerationType>(this, buildGeneratorValueHolder(), parent) {
+
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(IGeneratedValue.DEFAULT_STRATEGY_PROPERTY);
+ propertyNames.add(IGeneratedValue.SPECIFIED_STRATEGY_PROPERTY);
+ }
+
+ @Override
+ protected GenerationType[] choices() {
+ return GenerationType.values();
+ }
+
+ @Override
+ protected GenerationType defaultValue() {
+ return subject().getDefaultStrategy();
+ }
+
+ @Override
+ protected String displayString(GenerationType value) {
+ return buildDisplayString(
+ JptUiMappingsMessages.class,
+ GeneratedValueComposite.this,
+ value
+ );
+ }
+
+ @Override
+ protected GenerationType getValue() {
+ return subject().getSpecifiedStrategy();
+ }
+
+ @Override
+ protected void setValue(GenerationType value) {
+ IGeneratedValue generatedValue = subject();
+
+ if (generatedValue == null) {
+ generatedValue = GeneratedValueComposite.this.subject().addGeneratedValue();
}
- });
- }
+
+ subject().setSpecifiedStrategy(value);
+ }
+ };
}
+ private PropertyChangeListener buildSubjectChangeListener() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent e) {
+ uninstallListeners((IIdMapping) e.oldValue());
+ installListeners((IIdMapping) e.newValue());
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void doPopulate(EObject obj) {
- this.id = (IId) obj;
- if (this.id == null) {
- this.generatedValue= null;
- }
- else {
- this.generatedValue = this.id.getGeneratedValue();
- }
- if (this.generatedValue == null) {
- this.strategyComboViewer.getCombo().setText("");
- this.generatorNameCombo.setText("");
- this.populating = false;
- return;
- }
- populateStrategyCombo();
- populateGeneratorNameCombo();
+ protected void disengageListeners() {
+ super.disengageListeners();
+ getSubjectHolder().removePropertyChangeListener(PropertyValueModel.VALUE, subjectChangeListener);
+ uninstallListeners(subject());
}
+ /*
+ * (non-Javadoc)
+ */
@Override
protected void doPopulate() {
-
+ super.doPopulate();
+ populateGeneratorNameCombo();
}
-
+
+// private IGeneratorRepository getGeneratorRepository() {
+// return NullGeneratorRepository.instance(); //this.id.getJpaProject().getPlatform().generatorRepository(this.id.typeMapping().getPersistentType());
+// }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
protected void engageListeners() {
- if (this.generatedValue != null) {
- this.generatedValue.eAdapters().add(this.generatedValueListener);
- }
+ super.engageListeners();
+ getSubjectHolder().addPropertyChangeListener(PropertyValueModel.VALUE, subjectChangeListener);
+ installListeners(subject());
}
- protected void disengageListeners() {
- if (this.generatedValue != null) {
- this.generatedValue.eAdapters().remove(this.generatedValueListener);
- }
+ @Override
+ protected void initialize() {
+ super.initialize();
+
+ subjectChangeListener = buildSubjectChangeListener();
+ generatedValueChangeListener = buildGeneratedValueChangeListener();
+ generatorNameChangeListener = buildGeneratorNameChangeListener();
}
- private IGeneratorRepository getGeneratorRepository() {
- return NullGeneratorRepository.instance(); //this.id.getJpaProject().getPlatform().generatorRepository(this.id.typeMapping().getPersistentType());
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ // Strategy widgets
+ EnumComboViewer<IGeneratedValue, GenerationType> strategyComboViewer =
+ buildStrategyComboViewer(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.GeneratedValueComposite_strategy,
+ strategyComboViewer.getControl(),
+ IJpaHelpContextIds.MAPPING_GENERATED_VALUE_STRATEGY
+ );
+
+ // Generator Name widgets
+ generatorNameCombo = buildGeneratorNameCombo(container);
+
+ // Note: The combo's parent is a container fixing the issue with the
+ // border not being painted
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.GeneratedValueComposite_generatorName,
+ generatorNameCombo.getParent(),
+ IJpaHelpContextIds.MAPPING_GENERATED_VALUE_STRATEGY
+ );
+
+ // TODO
+ // buildGeneratorNameSelectionButton( this);
}
-
- private void populateGeneratorNameCombo() {
- this.generatorNameCombo.removeAll();
- for (Iterator<String> i = getGeneratorRepository().generatorNames(); i.hasNext(); ){
- this.generatorNameCombo.add(i.next());
+
+ private void installGeneratedValueListeners(IGeneratedValue generatedValue) {
+ if (generatedValue != null) {
+ generatedValue.addPropertyChangeListener(IGeneratedValue.DEFAULT_GENERATOR_PROPERTY, generatorNameChangeListener);
+ generatedValue.addPropertyChangeListener(IGeneratedValue.SPECIFIED_GENERATOR_PROPERTY, generatorNameChangeListener);
}
+ }
- populateGeneratorName();
+ private void installListeners(IIdMapping idMapping) {
+ if (idMapping != null) {
+ idMapping.addPropertyChangeListener(IIdMapping.GENERATED_VALUE_PROPERTY, generatedValueChangeListener);
+ installGeneratedValueListeners(idMapping.getGeneratedValue());
+ }
}
+
private void populateGeneratorName() {
- String generatorName = this.generatedValue.getGenerator();
- if (generatorName == null || generatorName.equals("")) {
+ if (subject() == null) {
this.generatorNameCombo.setText("");
}
- else if (!this.generatorNameCombo.getText().equals(generatorName)) {
- this.generatorNameCombo.setText(generatorName);
- }
- }
-
- private void populateStrategyCombo() {
- GenerationType selectedType = selectedStrategy();
- GenerationType strategy = this.generatedValue.getStrategy();
- if (strategy == GenerationType.AUTO) {
- if (selectedType != GenerationType.AUTO) {
- this.strategyComboViewer.setSelection(new StructuredSelection(GenerationType.AUTO));
- }
- }
- else if (strategy == GenerationType.SEQUENCE) {
- if (selectedType != GenerationType.SEQUENCE) {
- this.strategyComboViewer.setSelection(new StructuredSelection(GenerationType.SEQUENCE));
- }
- }
- else if (strategy == GenerationType.IDENTITY) {
- if (selectedType != GenerationType.IDENTITY) {
- this.strategyComboViewer.setSelection(new StructuredSelection(GenerationType.IDENTITY));
+ else {
+ IGeneratedValue generatedValue = subject().getGeneratedValue();
+
+ if (generatedValue == null) {
+ this.generatorNameCombo.setText("");
}
- }
- else if (strategy == GenerationType.TABLE) {
- if (selectedType != GenerationType.TABLE) {
- this.strategyComboViewer.setSelection(new StructuredSelection(GenerationType.TABLE));
+ else {
+ String generatorName = generatedValue.getGenerator();
+
+ if (StringTools.stringIsEmpty(generatorName)) {
+ this.generatorNameCombo.setText("");
+ }
+ else if (!this.generatorNameCombo.getText().equals(generatorName)) {
+ this.generatorNameCombo.setText(generatorName);
+ }
}
}
- else {
- if (selectedType != GenerationType.DEFAULT) {
- this.strategyComboViewer.setSelection(new StructuredSelection(GenerationType.DEFAULT));
- }
+ }
+
+ private void populateGeneratorNameCombo() {
+ this.generatorNameCombo.removeAll();
+ //TODO
+// for (Iterator<String> i = getGeneratorRepository().generatorNames(); i.hasNext(); ){
+// this.generatorNameCombo.add(i.next());
+// }
+
+ populateGeneratorName();
+ }
+
+ private void uninstallGeneratedValueListeners(IGeneratedValue generatedValue) {
+ if (generatedValue != null) {
+ generatedValue.removePropertyChangeListener(IGeneratedValue.DEFAULT_GENERATOR_PROPERTY, generatorNameChangeListener);
+ generatedValue.removePropertyChangeListener(IGeneratedValue.SPECIFIED_GENERATOR_PROPERTY, generatorNameChangeListener);
}
- // TODO first initialization
}
- private GenerationType selectedStrategy() {
- return (GenerationType) ((StructuredSelection) this.strategyComboViewer.getSelection()).getFirstElement();
+ private void uninstallListeners(IIdMapping idMapping) {
+ if (idMapping != null) {
+ idMapping.removePropertyChangeListener(IIdMapping.GENERATED_VALUE_PROPERTY, generatedValueChangeListener);
+ uninstallGeneratedValueListeners(idMapping.getGeneratedValue());
+ }
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GenerationComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GenerationComposite.java
new file mode 100644
index 0000000000..6263dee02a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GenerationComposite.java
@@ -0,0 +1,268 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.IGeneratedValue;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.ISequenceGenerator;
+import org.eclipse.jpt.core.internal.context.base.ITableGenerator;
+import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | v Primary Key Generation |
+ * | |
+ * | x Primary Key Generation |
+ * | --------------------------------------------------------------------- |
+ * | | | |
+ * | | GeneratedValueComposite | |
+ * | | | |
+ * | --------------------------------------------------------------------- |
+ * | |
+ * | v Table Generator |
+ * | |
+ * | x Table Generator |
+ * | --------------------------------------------------------------------- |
+ * | | | |
+ * | | TableGeneratorComposite | |
+ * | | | |
+ * | --------------------------------------------------------------------- |
+ * | |
+ * | v Sequence Generator |
+ * | |
+ * | x Sequence Generator |
+ * | --------------------------------------------------------------------- |
+ * | | | |
+ * | | SequenceGeneratorComposite | |
+ * | | | |
+ * | --------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IIdMapping
+ * @see GeneratedValueComposite
+ * @see TableGeneratorComposite
+ * @see SequenceGeneratorComposite
+ * @see IdMappingComposite - The parent container
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class GenerationComposite extends AbstractFormPane<IIdMapping>
+{
+ private WritablePropertyValueModel<Boolean> sequenceGeneratorExpansionStateHolder;
+ private WritablePropertyValueModel<Boolean> tableGeneratorExpansionStateHolder;
+
+ /**
+ * Creates a new <code>GenerationComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public GenerationComposite(AbstractFormPane<? extends IIdMapping> parentPane,
+ Composite parent)
+ {
+ super(parentPane, parent, false);
+ }
+
+ private WritablePropertyValueModel<Boolean> buildPrimaryKeyGenerationHolder() {
+ return new PropertyAspectAdapter<IIdMapping, Boolean>(getSubjectHolder(), IIdMapping.GENERATED_VALUE_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return subject().getGeneratedValue() != null;
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+
+ if (value && (subject.getGeneratedValue() == null)) {
+ subject.addGeneratedValue();
+ }
+ else if (!value && (subject.getGeneratedValue() != null)) {
+ subject.removeGeneratedValue();
+ }
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Boolean> buildSequenceGeneratorBooleanHolder() {
+ return new PropertyAspectAdapter<IIdMapping, Boolean>(getSubjectHolder(), IIdMapping.SEQUENCE_GENERATOR_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return subject().getSequenceGenerator() != null;
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+
+ if (value && (subject.getSequenceGenerator() == null)) {
+
+ ISequenceGenerator sequenceGenerator = subject.addSequenceGenerator();
+ IGeneratedValue generatedValue = subject.getGeneratedValue();
+
+ if ((generatedValue != null) &&
+ (generatedValue.getGenerator() != null))
+ {
+ sequenceGenerator.setName(generatedValue.getGenerator());
+ }
+ }
+ else if (!value && (subject.getSequenceGenerator() != null)) {
+ subject.removeSequenceGenerator();
+ }
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Boolean> buildTableGeneratorBooleanHolder() {
+ return new PropertyAspectAdapter<IIdMapping, Boolean>(getSubjectHolder(), IIdMapping.TABLE_GENERATOR_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return subject.getTableGenerator() != null;
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+
+ if (value && (subject.getTableGenerator() == null)) {
+
+ ITableGenerator tableGenerator = subject.addTableGenerator();
+ IGeneratedValue generatedValue = subject.getGeneratedValue();
+
+ if ((generatedValue != null) &&
+ (generatedValue.getGenerator() != null))
+ {
+ tableGenerator.setName(generatedValue.getGenerator());
+ }
+ }
+ else if (!value && (subject.getTableGenerator() != null)) {
+ subject.removeTableGenerator();
+ }
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void doPopulate()
+ {
+ super.doPopulate();
+
+ sequenceGeneratorExpansionStateHolder.setValue(subject() != null && subject().getSequenceGenerator() != null);
+ tableGeneratorExpansionStateHolder .setValue(subject() != null && subject().getTableGenerator() != null);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initialize() {
+ super.initialize();
+
+ sequenceGeneratorExpansionStateHolder = new SimplePropertyValueModel<Boolean>(false);
+ tableGeneratorExpansionStateHolder = new SimplePropertyValueModel<Boolean>(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ // Primary Key Generation section
+ container = buildSection(
+ container,
+ JptUiMappingsMessages.IdMappingComposite_primaryKeyGeneration
+ );
+
+ // Primary Key Generation check box
+ Button primaryKeyGenerationCheckBox = buildCheckBox(
+ container,
+ JptUiMappingsMessages.IdMappingComposite_primaryKeyGeneration,
+ buildPrimaryKeyGenerationHolder(),
+ IJpaHelpContextIds.MAPPING_PRIMARY_KEY_GENERATION
+ );
+
+ // Generated Value widgets
+ GeneratedValueComposite generatedValueComposite = new GeneratedValueComposite(
+ this,
+ container
+ );
+
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.horizontalIndent = primaryKeyGenerationCheckBox.getBorderWidth() + 16;
+
+ generatedValueComposite.getControl().setLayoutData(gridData);
+
+ // Table Generator pane
+ initializeTableGeneratorPane(container);
+
+ // Sequence Generator pane
+ initializeSequenceGeneratorPane(container);
+ }
+
+ private void initializeSequenceGeneratorPane(Composite container) {
+
+ // Sequence Generator sub-section
+ container = buildSubSection(
+ container,
+ JptUiMappingsMessages.IdMappingComposite_sequenceGenerator,
+ sequenceGeneratorExpansionStateHolder
+ );
+
+ // Sequence Generator check box
+ Button sequenceGeneratorCheckBox = buildCheckBox(
+ container,
+ JptUiMappingsMessages.IdMappingComposite_sequenceGenerator,
+ buildSequenceGeneratorBooleanHolder(),
+ IJpaHelpContextIds.MAPPING_SEQUENCE_GENERATOR
+ );
+
+ // Sequence Generator pane
+ new SequenceGeneratorComposite(
+ this,
+ buildSubPane(container, 0, sequenceGeneratorCheckBox.getBorderWidth() + 16)
+ );
+ }
+
+ private void initializeTableGeneratorPane(Composite container) {
+
+ // Table Generator sub-section
+ container = buildSubSection(
+ container,
+ JptUiMappingsMessages.IdMappingComposite_tableGenerator,
+ tableGeneratorExpansionStateHolder
+ );
+
+ Button tableGeneratorCheckBox = buildCheckBox(
+ container,
+ JptUiMappingsMessages.IdMappingComposite_tableGenerator,
+ buildTableGeneratorBooleanHolder(),
+ IJpaHelpContextIds.MAPPING_TABLE_GENERATOR
+ );
+
+ new TableGeneratorComposite(
+ this,
+ buildSubPane(container, 0, tableGeneratorCheckBox.getBorderWidth() + 16)
+ );
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratorComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratorComposite.java
index a9f0227daf..2d968ddb7f 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratorComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/GeneratorComposite.java
@@ -3,149 +3,222 @@
* 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.ui.internal.mappings.details;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IGenerator;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
+import org.eclipse.jpt.core.internal.context.base.IGenerator;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
/**
- * GeneratorComposite
+ * This is the generic pane for a generator.
+ *
+ * @see IIdMapping
+ * @see IGenerator
+ * @see SequenceGeneratorComposite - A sub-pane
+ * @see TalbeGeneratorComposite - A sub-pane
+ *
+ * @version 2.0
+ * @since 1.0
*/
-public abstract class GeneratorComposite<E extends IGenerator> extends BaseJpaComposite
+@SuppressWarnings("nls")
+public abstract class GeneratorComposite<T extends IGenerator> extends AbstractFormPane<IIdMapping>
{
- private IId id;
- private E generator;
- private Adapter generatorListener;
+ private PropertyChangeListener generatorChangeListener;
+ private PropertyValueModel<T> generatorHolder;
+ private PropertyChangeListener namePropertyChangeListener;
+ private Text nameText;
- protected Text nameTextWidget;
+ /**
+ * Creates a new <code>GeneratorComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public GeneratorComposite(AbstractFormPane<? extends IIdMapping> parentPane,
+ Composite parent) {
- public GeneratorComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.generatorListener = buildGeneratorListner();
+ super(parentPane, parent);
}
-
- private Adapter buildGeneratorListner() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- generatorChanged(notification);
+
+ /**
+ * Creates the new <code>IGenerator</code>.
+ *
+ * @return The newly created <code>IGenerator</code>
+ */
+ protected abstract T buildGenerator();
+
+ private PropertyChangeListener buildGeneratorChangeListener() {
+ return new SWTPropertyChangeListenerWrapper(this.buildGeneratorChangeListener_());
+ }
+
+ @SuppressWarnings("unchecked")
+ private PropertyChangeListener buildGeneratorChangeListener_() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent e) {
+
+ GeneratorComposite.this.uninstallListeners((T) e.oldValue());
+
+ if (!isPopulating()) {
+ GeneratorComposite.this.repopulate();
+ }
+
+ GeneratorComposite.this.installListeners((T) e.newValue());
}
};
}
- /**
- * Builds the Generator specifiedName viewer.
- *
- * @param parent
- * @return
- */
- protected Text buildNameText(Composite parent) {
- final Text text = getWidgetFactory().createText(parent, null);
- text.addModifyListener(new ModifyListener() {
- public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
+ private PropertyValueModel<T> buildGeneratorHolder() {
+ return new PropertyAspectAdapter<IIdMapping, T>(getSubjectHolder(), propertyName()) {
+ @Override
+ protected T buildValue_() {
+ return GeneratorComposite.this.getGenerator(subject);
+ }
+ };
+ }
+
+ private ModifyListener buildGeneratorNameModifyListener() {
+ return new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ if (!isPopulating()) {
+ String name = ((Text) e.getSource()).getText();
+ updateGeneratorName(name);
+ }
+ }
+ };
+ }
+
+ private PropertyChangeListener buildNamePropertyChangeListener() {
+ return new SWTPropertyChangeListenerWrapper(buildNamePropertyChangeListener_());
+ }
+
+ private PropertyChangeListener buildNamePropertyChangeListener_() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent e) {
if (isPopulating()) {
return;
}
-
- String name = text.getText();
- if (name.equals("")) { //$NON-NLS-1$
- if (getGenerator().getName() == null) {
- return;
- }
- name = null;
+
+ GeneratorComposite.this.setPopulating(true);
+ try {
+ GeneratorComposite.this.populateNameViewer();
}
- IGenerator generator = getGenerator();
- if (generator == null) {
- generator = createGenerator();
+ finally {
+ GeneratorComposite.this.setPopulating(false);
}
- generator.setName(name);
}
- });
+ };
+ }
+
+ /**
+ * Builds the Generator specifiedName viewer.
+ *
+ * @param parent
+ * @return
+ */
+ protected final Text buildNameText(Composite parent) {
+ Text text = this.buildText(parent);
+ text.addModifyListener(this.buildGeneratorNameModifyListener());
return text;
}
- protected abstract E createGenerator();
+ protected void clearNameViewer() {
+ this.nameText.setText("");
+ }
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void doPopulate(EObject obj) {
- this.id = (IId) obj;
- if (this.id == null) {
- this.generator = null;
- return;
- }
- this.generator = generator(this.id);
- if (this.generator == null) {
- clear();
- return;
- }
- populateNameViewer();
- return;
+ protected void disengageListeners() {
+ super.disengageListeners();
+
+ this.generatorHolder.removePropertyChangeListener(
+ PropertyValueModel.VALUE,
+ this.generatorChangeListener
+ );
+
+ this.uninstallListeners(this.getGenerator(this.subject()));
}
+ /*
+ * (non-Javadoc)
+ */
@Override
protected void doPopulate() {
- populateNameViewer();
+ super.doPopulate();
+ this.populateNameViewer();
}
-
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
protected void engageListeners() {
- if (this.generator != null) {
- this.generator.eAdapters().add(this.generatorListener);
- }
+ super.engageListeners();
+
+ this.generatorHolder.addPropertyChangeListener(
+ PropertyValueModel.VALUE,
+ this.generatorChangeListener
+ );
+
+ this.installListeners(this.getGenerator(this.subject()));
}
- protected void disengageListeners() {
- if (this.generator != null) {
- this.generator.eAdapters().remove(this.generatorListener);
- }
+ /**
+ * Retrieves without creating the <code>IGenerator</code> from the subject.
+ *
+ * @param subject The subject used to retrieve the generator
+ * @return The <code>IGenerator</code> or <code>null</code> if it doesn't
+ * exists
+ */
+ protected abstract T getGenerator(IIdMapping subject);
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initialize() {
+ super.initialize();
+
+ this.generatorHolder = buildGeneratorHolder();
+ this.generatorChangeListener = buildGeneratorChangeListener();
+ this.namePropertyChangeListener = buildNamePropertyChangeListener();
}
- protected abstract E generator(IId id);
-
- protected IId idMapping() {
- return this.id;
- }
-
- protected void generatorChanged(Notification notification) {
- if (notification.getFeatureID(IGenerator.class) == JpaCoreMappingsPackage.IGENERATOR__NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- if (nameTextWidget.getText() == null || !nameTextWidget.getText().equals(getGenerator().getName())) {
- if (getGenerator().getName() == null) {
- clearNameViewer();
- }
- else {
- nameTextWidget.setText(getGenerator().getName());
- }
- }
- }
- });
+ protected void installListeners(T generator) {
+ if (generator != null) {
+ generator.addPropertyChangeListener(IGenerator.NAME_PROPERTY, this.namePropertyChangeListener);
}
}
private void populateNameViewer() {
- String name = this.getGenerator().getName();
- if (name != null) {
- if (!this.nameTextWidget.getText().equals(name)) {
- this.nameTextWidget.setText(name);
+ IGenerator generator = this.getGenerator(this.subject());
+
+ if (generator != null) {
+ String name = generator.getName();
+
+ if (name != null) {
+ if (!this.nameText.getText().equals(name)) {
+ this.nameText.setText(name);
+ this.nameText.setSelection(0, 0);
+ }
+ }
+ else {
+ this.clearNameViewer();
}
}
else {
@@ -153,15 +226,48 @@ public abstract class GeneratorComposite<E extends IGenerator> extends BaseJpaCo
}
}
- protected E getGenerator() {
- return this.generator;
+ /**
+ * Returns the property name used to listen to the ID mapping when the
+ * generator changes.
+ *
+ * @return The property name associated with the generator
+ */
+ protected abstract String propertyName();
+
+ protected final void setNameText(Text nameText) {
+ this.nameText = nameText;
}
- protected void clear() {
- this.clearNameViewer();
+ protected void uninstallListeners(T generator) {
+ if (generator != null) {
+ generator.removePropertyChangeListener(IGenerator.NAME_PROPERTY, this.namePropertyChangeListener);
+ }
}
- protected void clearNameViewer() {
- this.nameTextWidget.setText(""); //$NON-NLS-1$
+ private void updateGeneratorName(String name) {
+
+ if (StringTools.stringIsEmpty(name)) {
+
+ if (getGenerator(subject()).getName() == null) {
+ return;
+ }
+
+ name = null;
+ }
+
+ IGenerator generator = getGenerator(subject());
+
+ if (generator == null) {
+ setPopulating(true);
+
+ try {
+ generator = buildGenerator();
+ }
+ finally {
+ setPopulating(false);
+ }
+ }
+
+ generator.setName(name);
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdComposite.java
deleted file mode 100644
index b71d4cfffe..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdComposite.java
+++ /dev/null
@@ -1,459 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.TemporalType;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.EnumComboViewer.EnumHolder;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class IdComposite extends BaseJpaComposite
-{
- private IId id;
- private Adapter idListener;
-
- private ColumnComposite columnComposite;
-
- private EnumComboViewer temporalTypeViewer;
-
- private Section pkGenerationSection;
- private Button primaryKeyGenerationCheckBox;
- private GeneratedValueComposite generatedValueComposite;
-
- private Section tableGenSection;
- private Button tableGeneratorCheckBox;
- private TableGeneratorComposite tableGeneratorComposite;
-
- private Section sequenceGenSection;
- private Button sequenceGeneratorCheckBox;
- private SequenceGeneratorComposite sequenceGeneratorComposite;
-
-
- public IdComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.idListener = buildIdListener();
- }
-
- private Adapter buildIdListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- idMappingChanged(notification);
- }
- };
- }
- void idMappingChanged(Notification notification) {
- switch (notification.getFeatureID(IId.class)) {
- case JpaCoreMappingsPackage.IID__TABLE_GENERATOR :
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- IdComposite.this.populateTableGeneratorComposite();
- }
- });
- break;
- case JpaCoreMappingsPackage.IID__SEQUENCE_GENERATOR :
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- IdComposite.this.populateSequenceGeneratorComposite();
- }
- });
- break;
- case JpaCoreMappingsPackage.IID__GENERATED_VALUE :
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- IdComposite.this.populateGeneratedValueComposite();
- }
- });
- break;
- }
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- Control generalControl = buildGeneralComposite(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generalControl.setLayoutData(gridData);
-
- Control generationControl = buildGenerationComposite(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generationControl.setLayoutData(gridData);
- }
-
- private Control buildGeneralComposite(Composite composite) {
- Composite generalComposite = getWidgetFactory().createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- generalComposite.setLayout(layout);
-
- this.columnComposite = new ColumnComposite(generalComposite, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.columnComposite.getControl().setLayoutData(gridData);
-
- CommonWidgets.buildTemporalLabel(generalComposite, getWidgetFactory());
- this.temporalTypeViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.temporalTypeViewer.getControl().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(temporalTypeViewer.getControl(), IJpaHelpContextIds.MAPPING_TEMPORAL);
-
- return generalComposite;
- }
-
- private Control buildGenerationComposite(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- this.pkGenerationSection = getWidgetFactory().createSection(composite, SWT.FLAT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
- this.pkGenerationSection.setText(JptUiMappingsMessages.IdMappingComposite_primaryKeyGeneration);
-
- Composite generationClient = getWidgetFactory().createComposite(this.pkGenerationSection);
- this.pkGenerationSection.setClient(generationClient);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- generationClient.setLayout(layout);
-
- this.primaryKeyGenerationCheckBox = buildPrimaryKeyGenerationCheckBox(generationClient);
- GridData gridData = new GridData();
- this.primaryKeyGenerationCheckBox.setLayoutData(gridData);
- helpSystem.setHelp(primaryKeyGenerationCheckBox, IJpaHelpContextIds.MAPPING_PRIMARY_KEY_GENERATION);
-
- this.generatedValueComposite = new GeneratedValueComposite(generationClient, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalIndent = 20;
- this.generatedValueComposite.getControl().setLayoutData(gridData);
-
- this.tableGenSection = getWidgetFactory().createSection(generationClient, SWT.FLAT | ExpandableComposite.TWISTIE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.tableGenSection.setLayoutData(gridData);
-
- this.tableGenSection.setText(JptUiMappingsMessages.IdMappingComposite_tableGenerator);
-
- Composite tableGenClient = getWidgetFactory().createComposite(this.tableGenSection);
- this.tableGenSection.setClient(tableGenClient);
-
- layout = new GridLayout();
- layout.marginWidth = 0;
- tableGenClient.setLayout(layout);
-
- this.tableGeneratorCheckBox = buildTableGeneratorCheckBox(tableGenClient);
- gridData = new GridData();
- this.tableGeneratorCheckBox.setLayoutData(gridData);
- helpSystem.setHelp(tableGeneratorCheckBox, IJpaHelpContextIds.MAPPING_TABLE_GENERATOR);
-
- this.tableGeneratorComposite = new TableGeneratorComposite(tableGenClient, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalIndent = 20;
- this.tableGeneratorComposite.getControl().setLayoutData(gridData);
-
-
-
- this.sequenceGenSection = getWidgetFactory().createSection(generationClient, SWT.FLAT | ExpandableComposite.TWISTIE);
- this.sequenceGenSection.setText(JptUiMappingsMessages.IdMappingComposite_sequenceGenerator);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.sequenceGenSection.setLayoutData(gridData);
-
- Composite sequenceGenClient = getWidgetFactory().createComposite(this.sequenceGenSection);
- this.sequenceGenSection.setClient(sequenceGenClient);
-
- layout = new GridLayout();
- layout.marginWidth = 0;
- sequenceGenClient.setLayout(layout);
-
- this.sequenceGeneratorCheckBox = buildSequenceGeneratorCheckBox(sequenceGenClient);
- gridData = new GridData();
- this.sequenceGeneratorCheckBox.setLayoutData(gridData);
- helpSystem.setHelp(sequenceGeneratorCheckBox, IJpaHelpContextIds.MAPPING_SEQUENCE_GENERATOR);
-
- this.sequenceGeneratorComposite = new SequenceGeneratorComposite(sequenceGenClient, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalIndent = 20;
- this.sequenceGeneratorComposite.getControl().setLayoutData(gridData);
-
- return this.pkGenerationSection;
- }
-
- private Button buildPrimaryKeyGenerationCheckBox(Composite parent) {
- Button button = getWidgetFactory().createButton(parent,JptUiMappingsMessages.IdMappingComposite_primaryKeyGeneration, SWT.CHECK);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
-
- public void widgetSelected(SelectionEvent e) {
- IdComposite.this.primaryKeyGenerationCheckBoxClicked(e);
- }
- });
- return button;
- }
-
- void primaryKeyGenerationCheckBoxClicked(SelectionEvent e) {
- boolean mappingHasGeneratedValue = this.id.getGeneratedValue() != null;
- boolean checked = this.primaryKeyGenerationCheckBox.getSelection();
- if (checked == mappingHasGeneratedValue) {
- return;
- }
- IGeneratedValue generatedValue = null;
- if (checked) {
- generatedValue = this.id.createGeneratedValue();
- }
- this.id.setGeneratedValue(generatedValue);
- }
-
- private Button buildTableGeneratorCheckBox(Composite parent) {
- Button button = getWidgetFactory().createButton(parent,JptUiMappingsMessages.IdMappingComposite_tableGenerator, SWT.CHECK);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
-
- public void widgetSelected(SelectionEvent e) {
- IdComposite.this.tableGeneratorCheckBoxClicked(e);
- }
- });
- return button;
- }
-
- void tableGeneratorCheckBoxClicked(SelectionEvent e) {
- boolean mappingHasTableGenerator = this.id.getTableGenerator() != null;
- boolean checked = this.tableGeneratorCheckBox.getSelection();
- if (checked == mappingHasTableGenerator) {
- return;
- }
- ITableGenerator tableGenerator = null;
- if (checked) {
- tableGenerator = this.id.createTableGenerator();
- }
- this.id.setTableGenerator(tableGenerator);
- if (checked) {
- IGeneratedValue generatedValue = this.id.getGeneratedValue();
- if (generatedValue != null && generatedValue.getGenerator() != null) {
- tableGenerator.setName(generatedValue.getGenerator());
- }
- }
- }
-
- private Button buildSequenceGeneratorCheckBox(Composite parent) {
- Button button = getWidgetFactory().createButton(parent,JptUiMappingsMessages.IdMappingComposite_sequenceGenerator, SWT.CHECK);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
-
- public void widgetSelected(SelectionEvent e) {
- IdComposite.this.sequenceGeneratorCheckBoxClicked(e);
- }
- });
- return button;
- }
-
- void sequenceGeneratorCheckBoxClicked(SelectionEvent e) {
- boolean mappingHasSequenceGenerator = this.id.getSequenceGenerator() != null;
- boolean checked = this.sequenceGeneratorCheckBox.getSelection();
- if (checked == mappingHasSequenceGenerator) {
- return;
- }
- ISequenceGenerator sequenceGenerator = null;
- if (checked) {
- sequenceGenerator = this.id.createSequenceGenerator();
- }
- this.id.setSequenceGenerator(sequenceGenerator);
- if (checked) {
- IGeneratedValue generatedValue = this.id.getGeneratedValue();
- if (generatedValue != null && generatedValue.getGenerator() != null) {
- sequenceGenerator.setName(generatedValue.getGenerator());
- }
- }
- }
-
-
-
- public void doPopulate(EObject obj) {
- this.id = (IId) obj;
- if (this.id != null) {
- this.columnComposite.populate(this.id.getColumn());
- }
- else {
- this.columnComposite.populate(null);
- this.generatedValueComposite.populate(null);
- this.tableGeneratorComposite.populate(null);
- this.sequenceGeneratorComposite.populate(null);
- return;
- }
- this.pkGenerationSection.setExpanded(true);
- this.temporalTypeViewer.populate(new TemporalTypeHolder(this.id));
- populateGeneratedValueComposite();
- populateSequenceGeneratorComposite();
- populateTableGeneratorComposite();
- }
-
- public void doPopulate() {
- this.columnComposite.populate();
- this.temporalTypeViewer.populate();
- this.generatedValueComposite.populate();
- this.tableGeneratorComposite.populate();
- this.sequenceGeneratorComposite.populate();
- }
-
- private void populateTableGeneratorComposite() {
- this.tableGeneratorComposite.populate(this.id);
- boolean tableGeneratorExists = this.id.getTableGenerator() != null;
- this.tableGeneratorCheckBox.setSelection(tableGeneratorExists);
- if (tableGeneratorExists) {
- this.tableGenSection.setExpanded(true);
- }
- }
-
- private void populateSequenceGeneratorComposite() {
- this.sequenceGeneratorComposite.populate(this.id);
- boolean sequenceGeneratorExists = this.id.getSequenceGenerator() != null;
- this.sequenceGeneratorCheckBox.setSelection(sequenceGeneratorExists);
- if (sequenceGeneratorExists) {
- this.sequenceGenSection.setExpanded(true);
- }
- }
-
- private void populateGeneratedValueComposite() {
- this.generatedValueComposite.populate(this.id);
- this.primaryKeyGenerationCheckBox.setSelection(this.id.getGeneratedValue() != null);
- }
-
-
- protected void engageListeners() {
- if (this.id !=null) {
- this.id.eAdapters().add(this.idListener);
- }
- }
-
- protected void disengageListeners() {
- if (this.id !=null) {
- this.id.eAdapters().remove(this.idListener);
- }
- }
-
- @Override
- public void dispose() {
- this.columnComposite.dispose();
- this.temporalTypeViewer.dispose();
- this.generatedValueComposite.dispose();
- this.tableGeneratorComposite.dispose();
- this.sequenceGeneratorComposite.dispose();
- super.dispose();
- }
-
- protected IId getId() {
- return this.id;
- }
-
- private class TemporalTypeHolder extends EObjectImpl implements EnumHolder {
-
- private IId id;
-
- TemporalTypeHolder(IId id) {
- super();
- this.id = id;
- }
-
- public Object get() {
- return this.id.getTemporal();
- }
-
- public void set(Object enumSetting) {
- this.id.setTemporal((TemporalType) enumSetting);
- }
-
- public Class featureClass() {
- return IId.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IID__TEMPORAL;
- }
-
- public EObject wrappedObject() {
- return this.id;
- }
-
- public Object[] enumValues() {
- return TemporalType.VALUES.toArray();
- }
-
- /**
- * TemporalType has no Default, return null
- */
- public Object defaultValue() {
- return null;
- }
-
- /**
- * TemporalType has no Default, return null
- */
- public String defaultString() {
- return null;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdMappingComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdMappingComposite.java
new file mode 100644
index 0000000000..a6a3fae5af
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/IdMappingComposite.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.IColumn;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.ui.internal.details.IJpaComposite;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | ColumnComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | TemporalTypeComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | GenerationComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IIdMapping
+ * @see BaseJpaUiFactory - The factory creating this pane
+ * @see ColumnComposite
+ * @see TemporalTypeComposite
+ * @see GenerationComposite
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class IdMappingComposite extends AbstractFormPane<IIdMapping>
+ implements IJpaComposite<IIdMapping>
+{
+ /**
+ * Creates a new <code>IdMappingComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IIdMapping</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public IdMappingComposite(PropertyValueModel<? extends IIdMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ private PropertyValueModel<? extends IColumn> buildColumnHolder() {
+ return new TransformationPropertyValueModel<IIdMapping, IColumn>(getSubjectHolder()) {
+ @Override
+ protected IColumn transform_(IIdMapping value) {
+ return value.getColumn();
+ }
+ };
+ }
+
+ private Composite buildPane(Composite container, int groupBoxMargin) {
+ return buildSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ int groupBoxMargin = groupBoxMargin();
+
+ // Column widgets
+ new ColumnComposite(this, buildColumnHolder(), container);
+
+ // Temporal Type widgets
+ new TemporalTypeComposite(this, buildPane(container, groupBoxMargin));
+
+ // Generation pane
+ new GenerationComposite(this, buildSubPane(container, 10));
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InheritanceComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InheritanceComposite.java
index 77bcdbaf86..9b61d85b1e 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InheritanceComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InheritanceComposite.java
@@ -1,99 +1,143 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
-import java.util.Iterator;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.mappings.DiscriminatorType;
-import org.eclipse.jpt.core.internal.mappings.IDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.InheritanceType;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
+import java.util.Collection;
+import org.eclipse.jpt.core.internal.context.base.DiscriminatorType;
+import org.eclipse.jpt.core.internal.context.base.IDiscriminatorColumn;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.InheritanceType;
import org.eclipse.jpt.db.internal.ConnectionListener;
import org.eclipse.jpt.db.internal.ConnectionProfile;
import org.eclipse.jpt.db.internal.Database;
import org.eclipse.jpt.db.internal.Schema;
import org.eclipse.jpt.db.internal.Table;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.EnumComboViewer;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class InheritanceComposite extends BaseJpaComposite {
-
- private IEntity entity;
- private IDiscriminatorColumn discriminatorColumn;
- private final Adapter entityListener;
- private final Adapter discriminatorColumnListener;
-
- private ComboViewer strategyViewer;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ---------------------------------------------------- |
+ * | Strategy: | EnumComboViewer | |
+ * | ---------------------------------------------------- |
+ * | ---------------------------------------------------- |
+ * | Column: | I |v| |
+ * | ---------------------------------------------------- |
+ * | ---------------------------------------------------- |
+ * | Discriminator Type: | EnumComboViewer |v| |
+ * | ---------------------------------------------------- |
+ * | ---------------------------------------------------- |
+ * | Discriminator Value: | I |v| |
+ * | ---------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | PrimaryKeyJoinColumnsComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IEntity
+ * @see EntityComposite - The parent container
+ * @see EnumComboViewer
+ * @see PrimaryKeyJoinColumnsComposite
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public class InheritanceComposite extends AbstractFormPane<IEntity> {
+
private CCombo columnCombo;
- private ComboViewer discriminatorTypeViewer;
private CCombo discriminatorValueCombo;
-
- private ConnectionListener connectionListener;
-
- private ConnectionProfile connectionProfile;
-
-
- private PrimaryKeyJoinColumnsComposite pkJoinColumnsComposite;
-
- public InheritanceComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.entityListener = buildEntityListener();
- this.discriminatorColumnListener = buildDiscriminatorColumnListener();
- this.connectionListener = buildConnectionListener();
+
+ /**
+ * Creates a new <code>InheritanceComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public InheritanceComposite(AbstractFormPane<? extends IEntity> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
}
-
- private Adapter buildEntityListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- entityChanged(notification);
- }
- };
+
+ /**
+ * Creates a new <code>InheritanceComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IEntity</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public InheritanceComposite(PropertyValueModel<? extends IEntity> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent,widgetFactory);
+ }
+
+ private void addConnectionListener() {
+// this.getConnectionProfile().addConnectionListener(this.connectionListener);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+
+ propertyNames.add(IEntity.DEFAULT_DISCRIMINATOR_VALUE_PROPERTY);
+ propertyNames.add(IEntity.SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY);
}
- private Adapter buildDiscriminatorColumnListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- discriminatorColumnChanged(notification);
+ private ModifyListener buildColumnComboSelectionListener() {
+ return new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ CCombo combo = (CCombo) e.widget;
+ IDiscriminatorColumn discriminatorColumn = subject().getDiscriminatorColumn();
+ String tableText = combo.getText();
+
+ if (tableText.equals("")) {
+ tableText = null;
+ if (discriminatorColumn.getSpecifiedName() == null || discriminatorColumn.getSpecifiedName().equals("")) {
+ return;
+ }
+ }
+
+ if (tableText != null && combo.getItemCount() > 0 && tableText.equals(combo.getItem(0))) {
+ tableText = null;
+ }
+
+ if (discriminatorColumn.getSpecifiedName() == null && tableText != null) {
+ discriminatorColumn.setSpecifiedName(tableText);
+ }
+ if (discriminatorColumn.getSpecifiedName() != null && !discriminatorColumn.getSpecifiedName().equals(tableText)) {
+ discriminatorColumn.setSpecifiedName(tableText);
+ }
}
};
}
-
- private ConnectionListener buildConnectionListener() {
+
+ private ConnectionListener buildConnectionListener() {
return new ConnectionListener() {
public void aboutToClose(ConnectionProfile profile) {
@@ -111,6 +155,10 @@ public class InheritanceComposite extends BaseJpaComposite {
});
}
+ public void databaseChanged(ConnectionProfile profile, final Database database) {
+ return;
+ }
+
public void modified(ConnectionProfile profile) {
getControl().getDisplay().asyncExec( new Runnable() {
public void run() {
@@ -138,10 +186,6 @@ public class InheritanceComposite extends BaseJpaComposite {
});
}
- public void databaseChanged(ConnectionProfile profile, final Database database) {
- return;
- }
-
public void schemaChanged(ConnectionProfile profile, final Schema schema) {
return;
}
@@ -158,291 +202,222 @@ public class InheritanceComposite extends BaseJpaComposite {
});
}
};
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- GridData gridData;
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.InheritanceComposite_strategy);
-
- this.strategyViewer = buildStrategyCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.strategyViewer.getCombo().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.strategyViewer.getCombo(), IJpaHelpContextIds.ENTITY_INHERITANCE_STRATEGY);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.DiscriminatorColumnComposite_column);
-
- this.columnCombo = buildColumnCombo(composite);
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.columnCombo.setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.columnCombo, IJpaHelpContextIds.ENTITY_INHERITANCE_DISCRIMINATOR_COLUMN);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.DiscriminatorColumnComposite_discriminatorType);
-
- this.discriminatorTypeViewer = buildDiscriminatorTypeCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.discriminatorTypeViewer.getCombo().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.discriminatorTypeViewer.getCombo(), IJpaHelpContextIds.ENTITY_INHERITANCE_DISCRIMINATOR_TYPE);
-
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.InheritanceComposite_discriminatorValue);
-
- this.discriminatorValueCombo = buildDiscriminatorValueCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.discriminatorValueCombo.setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.discriminatorValueCombo, IJpaHelpContextIds.ENTITY_INHERITANCE_DISCRIMINATOR_VALUE);
-
- this.pkJoinColumnsComposite = new PrimaryKeyJoinColumnsComposite(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalSpan = 2;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessVerticalSpace = true;
- this.pkJoinColumnsComposite.getControl().setLayoutData(gridData);
- }
-
- private ComboViewer buildStrategyCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent);
- ComboViewer strategyViewer = new ComboViewer(combo);
- strategyViewer.setLabelProvider(buildStrategyLabelProvider());
- strategyViewer.add(InheritanceType.VALUES.toArray());
- strategyViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- InheritanceComposite.this.strategySelectionChanged(event.getSelection());
- }
- });
-
- return strategyViewer;
- }
-
- private IBaseLabelProvider buildStrategyLabelProvider() {
- return new LabelProvider() {
+ }
+
+ private PropertyValueModel<IDiscriminatorColumn> buildDiscriminatorColumnHolder() {
+ return new TransformationPropertyValueModel<IEntity, IDiscriminatorColumn>(getSubjectHolder()) {
@Override
- public String getText(Object element) {
- if (element == InheritanceType.DEFAULT) {
- //TODO need to move this to the model, don't want hardcoded String
- return NLS.bind(JptUiMappingsMessages.InheritanceComposite_default, "Single Table");
- }
- return super.getText(element);
+ protected IDiscriminatorColumn transform_(IEntity value) {
+ return value.getDiscriminatorColumn();
}
};
}
-
- void strategySelectionChanged(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- InheritanceType inheritanceType = (InheritanceType) ((IStructuredSelection) selection).getFirstElement();
- if ( ! this.entity.getInheritanceStrategy().equals(inheritanceType)) {
- this.entity.setInheritanceStrategy(inheritanceType);
+
+ private EnumComboViewer<IDiscriminatorColumn, DiscriminatorType> buildDiscriminatorTypeCombo(Composite container) {
+
+ return new EnumComboViewer<IDiscriminatorColumn, DiscriminatorType>(
+ this,
+ buildDiscriminatorColumnHolder(),
+ container)
+ {
+ @Override
+ protected DiscriminatorType[] choices() {
+ return DiscriminatorType.values();
}
- }
- }
-
- private CCombo buildColumnCombo(Composite parent) {
- final CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(JptUiMappingsMessages.ColumnComposite_defaultEmpty);
- combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String tableText = ((CCombo) e.getSource()).getText();
- if (tableText.equals("")) { //$NON-NLS-1$
- tableText = null;
- if (discriminatorColumn.getSpecifiedName() == null || discriminatorColumn.getSpecifiedName().equals("")) { //$NON-NLS-1$
- return;
- }
- }
-
- if (tableText != null && combo.getItemCount() > 0 && tableText.equals(combo.getItem(0))) {
- tableText = null;
- }
- if (discriminatorColumn.getSpecifiedName() == null && tableText != null) {
- discriminatorColumn.setSpecifiedName(tableText);
- }
- if (discriminatorColumn.getSpecifiedName() != null && !discriminatorColumn.getSpecifiedName().equals(tableText)) {
- discriminatorColumn.setSpecifiedName(tableText);
- }
+ @Override
+ protected DiscriminatorType defaultValue() {
+ return subject().getDefaultDiscriminatorType();
}
- });
- return combo;
-
- }
-
- private ComboViewer buildDiscriminatorTypeCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent);
- ComboViewer discriminatorTypeViewer = new ComboViewer(combo);
- discriminatorTypeViewer.setLabelProvider(buildDiscriminatorTypeLabelProvider());
- discriminatorTypeViewer.add(DiscriminatorType.VALUES.toArray());
-
- discriminatorTypeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- InheritanceComposite.this.discriminatorTypeSelectionChanged(event.getSelection());
+
+ @Override
+ protected String displayString(DiscriminatorType value) {
+ return buildDisplayString(
+ JptUiMappingsMessages.class,
+ InheritanceComposite.this,
+ value
+ );
}
- });
-
- return discriminatorTypeViewer;
- }
-
- private IBaseLabelProvider buildDiscriminatorTypeLabelProvider() {
- return new LabelProvider() {
+
@Override
- public String getText(Object element) {
- if (element == DiscriminatorType.DEFAULT) {
- //TODO need to move this to the model, don't want hardcoded String
- return NLS.bind(JptUiMappingsMessages.InheritanceComposite_defaultDiscriminatorType, "String");
- }
- return super.getText(element);
+ protected DiscriminatorType getValue() {
+ return subject().getSpecifiedDiscriminatorType();
}
- };
- }
-
- void discriminatorTypeSelectionChanged(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- DiscriminatorType discriminatorType = (DiscriminatorType) ((IStructuredSelection) selection).getFirstElement();
- if ( ! this.discriminatorColumn.getDiscriminatorType().equals(discriminatorType)) {
- this.discriminatorColumn.setDiscriminatorType(discriminatorType);
+
+ @Override
+ protected String propertyName() {
+ return IDiscriminatorColumn.SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY;
}
- }
+
+ @Override
+ protected void setValue(DiscriminatorType value) {
+ subject().setSpecifiedDiscriminatorType(value);
+ }
+ };
}
-
- private CCombo buildDiscriminatorValueCombo(Composite parent) {
- final CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.addModifyListener(new ModifyListener() {
+
+ private ModifyListener buildDiscriminatorValueComboSelectionListener() {
+ return new ModifyListener() {
public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String discriminatorValue = entity.getSpecifiedDiscriminatorValue();
- String value = ((CCombo) e.getSource()).getText();
- if (value.equals("")) { //$NON-NLS-1$
+ CCombo combo = (CCombo) e.widget;
+ String value = combo.getText();
+ String discriminatorValue = subject().getSpecifiedDiscriminatorValue();
+
+ if (value.equals("")) {
value = null;
- if (discriminatorValue == null || discriminatorValue.equals("")) { //$NON-NLS-1$
+ if (discriminatorValue == null || discriminatorValue.equals("")) {
return;
}
}
-
+
if (value != null && combo.getItemCount() > 0 && value.equals(combo.getItem(0))) {
value = null;
}
if (discriminatorValue == null || !discriminatorValue.equals(value)) {
- entity.setSpecifiedDiscriminatorValue(value);
+ subject().setSpecifiedDiscriminatorValue(value);
}
}
- });
- return combo;
+ };
}
- public void doPopulate(EObject obj) {
- this.entity = (IEntity) obj;
- if (this.entity != null) {
- this.discriminatorColumn = this.entity.getDiscriminatorColumn();
- populateColumnCombo();
- popuplateDiscriminatorTypeComboViewer();
- populateStrategyComboViewer();
- populateDiscriminatorValueCombo();
- this.pkJoinColumnsComposite.populate(this.entity);
- }
- else {
- this.discriminatorColumn = null;
- this.connectionProfile = null;
- }
- }
-
- public void doPopulate() {
- if (this.entity != null) {
- populateColumnCombo();
-// popuplateStrategyComboViewer();
-// popuplateDiscriminatorValueCombo();
- }
- }
+ private EnumComboViewer<IEntity, InheritanceType> buildStrategyCombo(Composite container) {
- @Override
- protected void engageListeners() {
- if (this.entity != null) {
- this.entity.eAdapters().add(this.entityListener);
- this.discriminatorColumn.eAdapters().add(this.discriminatorColumnListener);
- this.addConnectionListener();
- }
+ return new EnumComboViewer<IEntity, InheritanceType>(this, container) {
+ @Override
+ protected InheritanceType[] choices() {
+ return InheritanceType.values();
+ }
+
+ @Override
+ protected InheritanceType defaultValue() {
+ return subject().getDefaultInheritanceStrategy();
+ }
+
+ @Override
+ protected String displayString(InheritanceType value) {
+ return buildDisplayString(
+ JptUiMappingsMessages.class,
+ InheritanceComposite.this,
+ value
+ );
+ }
+
+ @Override
+ protected InheritanceType getValue() {
+ return subject().getSpecifiedInheritanceStrategy();
+ }
+
+ @Override
+ protected String propertyName() {
+ return IEntity.SPECIFIED_INHERITANCE_STRATEGY_PROPERTY;
+ }
+
+ @Override
+ protected void setValue(InheritanceType value) {
+ subject().setSpecifiedInheritanceStrategy(value);
+ }
+ };
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void disengageListeners() {
- if (this.entity != null) {
- this.entity.eAdapters().remove(this.entityListener);
- this.removeConnectionListener();
- this.discriminatorColumn.eAdapters().remove(this.discriminatorColumnListener);
- }
+ protected void doPopulate() {
+ super.doPopulate();
+ populateColumnCombo();
+ populateDiscriminatorValueCombo();
}
- private ConnectionProfile getConnectionProfile() {
- if(this.connectionProfile == null) {
- this.connectionProfile = this.entity.getJpaProject().connectionProfile();
- }
- return this.connectionProfile;
+ private Table getDbTable() {
+ return this.subject().primaryDbTable();
}
- private void addConnectionListener() {
- this.getConnectionProfile().addConnectionListener(this.connectionListener);
- }
-
- private void removeConnectionListener() {
- this.getConnectionProfile().removeConnectionListener(this.connectionListener);
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ // Strategy widgets
+ EnumComboViewer<IEntity, InheritanceType> strategyViewer =
+ buildStrategyCombo(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.InheritanceComposite_strategy,
+ strategyViewer.getControl(),
+ IJpaHelpContextIds.ENTITY_INHERITANCE_STRATEGY
+ );
+
+ // Column widgets
+ columnCombo = buildCombo(container);
+ columnCombo.add(JptUiMappingsMessages.ColumnComposite_defaultEmpty);
+ columnCombo.addModifyListener(buildColumnComboSelectionListener());
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.DiscriminatorColumnComposite_column,
+ columnCombo,
+ IJpaHelpContextIds.ENTITY_INHERITANCE_DISCRIMINATOR_COLUMN
+ );
+
+ // Discriminator Type widgets
+ EnumComboViewer<IDiscriminatorColumn, DiscriminatorType> discriminatorTypeViewer =
+ buildDiscriminatorTypeCombo(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.DiscriminatorColumnComposite_discriminatorType,
+ discriminatorTypeViewer.getControl(),
+ IJpaHelpContextIds.ENTITY_INHERITANCE_DISCRIMINATOR_TYPE
+ );
+
+ // Discrinator Value widgets
+ discriminatorValueCombo = buildCombo(container);
+ discriminatorValueCombo.addModifyListener(buildDiscriminatorValueComboSelectionListener());
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.InheritanceComposite_discriminatorValue,
+ discriminatorValueCombo,
+ IJpaHelpContextIds.ENTITY_INHERITANCE_DISCRIMINATOR_VALUE
+ );
+
+ // Primary Key Join Columns widgets
+ new PrimaryKeyJoinColumnsComposite(
+ this,
+ container
+ );
}
- private Table getDbTable() {
- return this.entity.primaryDbTable();
- }
-
private void populateColumnCombo() {
//TODO don't do instanceof check here - check on Table, or isRoot check on Entity
//this.tableCombo.setEnabled(!(this.table instanceof SingleTableInheritanceChildTableImpl));
populateDefaultColumnName();
- if (this.getConnectionProfile().isConnected()) {
- this.columnCombo.remove(1, this.columnCombo.getItemCount()-1);
- Table table = getDbTable();
- if (table != null) {
- for (Iterator i = CollectionTools.sort(CollectionTools.list(table.columnNames())).iterator(); i.hasNext();) {
- this.columnCombo.add((String) i.next());
- }
- }
- }
- else {
- this.columnCombo.remove(1, this.columnCombo.getItemCount()-1);
- }
+// if (this.getConnectionProfile().isConnected()) {
+// this.columnCombo.remove(1, this.columnCombo.getItemCount()-1);
+// Table table = getDbTable();
+// if (table != null) {
+// for (Iterator i = CollectionTools.sort(CollectionTools.list(table.columnNames())).iterator(); i.hasNext();) {
+// this.columnCombo.add((String) i.next());
+// }
+// }
+// }
+// else {
+// this.columnCombo.remove(1, this.columnCombo.getItemCount()-1);
+// }
+
populateColumnName();
}
-
- protected void populateDefaultColumnName() {
- String defaultTableName = discriminatorColumn.getDefaultName();
- int selectionIndex = columnCombo.getSelectionIndex();
- columnCombo.setItem(0, NLS.bind(JptUiMappingsMessages.ColumnComposite_defaultWithOneParam, defaultTableName));
- if (selectionIndex == 0) {
- //combo text does not update when switching between 2 mappings of the same type
- //that both have a default column name. clear the selection and then set it again
- columnCombo.clearSelection();
- columnCombo.select(0);
- }
- }
-
- protected void populateColumnName() {
- String tableName = this.discriminatorColumn.getSpecifiedName();
- String defaultName = this.discriminatorColumn.getDefaultName();
+
+ private void populateColumnName() {
+ IDiscriminatorColumn discriminatorColumn = subject().getDiscriminatorColumn();
+ String tableName = discriminatorColumn.getSpecifiedName();
+ String defaultName = discriminatorColumn.getDefaultName();
+
if (tableName != null) {
if (!this.columnCombo.getText().equals(tableName)) {
this.columnCombo.setText(tableName);
@@ -455,57 +430,24 @@ public class InheritanceComposite extends BaseJpaComposite {
}
}
- private void popuplateDiscriminatorTypeComboViewer() {
- if (this.discriminatorColumn.getDiscriminatorType() == DiscriminatorType.DEFAULT) {
- if (((StructuredSelection) this.discriminatorTypeViewer.getSelection()).getFirstElement() != DiscriminatorType.DEFAULT) {
- this.discriminatorTypeViewer.setSelection(new StructuredSelection(DiscriminatorType.DEFAULT));
- }
- }
- else if (this.discriminatorColumn.getDiscriminatorType() == DiscriminatorType.CHAR) {
- if (((StructuredSelection) this.discriminatorTypeViewer.getSelection()).getFirstElement() != DiscriminatorType.CHAR) {
- this.discriminatorTypeViewer.setSelection(new StructuredSelection(DiscriminatorType.CHAR));
- }
- }
- else if (this.discriminatorColumn.getDiscriminatorType() == DiscriminatorType.INTEGER) {
- if (((StructuredSelection) this.discriminatorTypeViewer.getSelection()).getFirstElement() != DiscriminatorType.INTEGER) {
- this.discriminatorTypeViewer.setSelection(new StructuredSelection(DiscriminatorType.INTEGER));
- }
- }
- else {
- if (((StructuredSelection) this.discriminatorTypeViewer.getSelection()).getFirstElement() != DiscriminatorType.STRING) {
- this.discriminatorTypeViewer.setSelection(new StructuredSelection(DiscriminatorType.STRING));
- }
- }
- }
-
- private void populateStrategyComboViewer() {
- if (this.entity.getInheritanceStrategy() == InheritanceType.DEFAULT) {
- if (((StructuredSelection) this.strategyViewer.getSelection()).getFirstElement() != InheritanceType.DEFAULT) {
- this.strategyViewer.setSelection(new StructuredSelection(InheritanceType.DEFAULT));
- }
- }
- else if (this.entity.getInheritanceStrategy() == InheritanceType.JOINED) {
- if (((StructuredSelection) this.strategyViewer.getSelection()).getFirstElement() != InheritanceType.JOINED) {
- this.strategyViewer.setSelection(new StructuredSelection(InheritanceType.JOINED));
- }
- }
- else if (this.entity.getInheritanceStrategy() == InheritanceType.SINGLE_TABLE) {
- if (((StructuredSelection) this.strategyViewer.getSelection()).getFirstElement() != InheritanceType.SINGLE_TABLE) {
- this.strategyViewer.setSelection(new StructuredSelection(InheritanceType.SINGLE_TABLE));
- }
+ private void populateDefaultColumnName() {
+ IDiscriminatorColumn discriminatorColumn = subject().getDiscriminatorColumn();
+ String defaultTableName = discriminatorColumn.getDefaultName();
+ int selectionIndex = columnCombo.getSelectionIndex();
+ columnCombo.setItem(0, NLS.bind(JptUiMappingsMessages.ColumnComposite_defaultWithOneParam, defaultTableName));
+ if (selectionIndex == 0) {
+ //combo text does not update when switching between 2 mappings of the same type
+ //that both have a default column name. clear the selection and then set it again
+ columnCombo.clearSelection();
+ columnCombo.select(0);
}
- else {
- if (((StructuredSelection) this.strategyViewer.getSelection()).getFirstElement() != InheritanceType.TABLE_PER_CLASS) {
- this.strategyViewer.setSelection(new StructuredSelection(InheritanceType.TABLE_PER_CLASS));
- }
- }
}
private void populateDiscriminatorValueCombo() {
- String specifiedValue = this.entity.getSpecifiedDiscriminatorValue();
- String defaultValue = this.entity.getDefaultDiscriminatorValue();
+ String specifiedValue = this.subject().getSpecifiedDiscriminatorValue();
+ String defaultValue = this.subject().getDefaultDiscriminatorValue();
- if (this.entity.discriminatorValueIsAllowed()) {
+ if (true) { // TODO this.subject().discriminatorValueIsAllowed()) {
this.discriminatorValueCombo.setEnabled(true);
if (this.discriminatorValueCombo.getItemCount() == 0) {
this.discriminatorValueCombo.add(JptUiMappingsMessages.DiscriminatorColumnComposite_defaultEmpty);
@@ -524,97 +466,35 @@ public class InheritanceComposite extends BaseJpaComposite {
this.discriminatorValueCombo.removeAll();
}
}
-
+
if (specifiedValue != null) {
if (!this.discriminatorValueCombo.getText().equals(specifiedValue)) {
this.discriminatorValueCombo.setText(specifiedValue);
}
}
else {
- //combo text does not update when switching between 2 entities that both have a default discriminator value.
+ //combo text does not update when switching between 2 entities that both have a default discriminator value.
//clear the selection and then set it again
this.discriminatorValueCombo.clearSelection();
this.discriminatorValueCombo.select(0);
}
}
-
- private void entityChanged(Notification notification) {
- if (notification.getFeatureID(IEntity.class) == JpaCoreMappingsPackage.IENTITY__INHERITANCE_STRATEGY) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- InheritanceType inheritanceType = entity.getInheritanceStrategy();
- if (((StructuredSelection) strategyViewer.getSelection()).getFirstElement() != inheritanceType) {
- strategyViewer.setSelection(new StructuredSelection(inheritanceType));
- }
- }
- });
- }
- else if (notification.getFeatureID(IEntity.class) == JpaCoreMappingsPackage.IENTITY__SPECIFIED_DISCRIMINATOR_VALUE) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- String discriminatorValue = entity.getSpecifiedDiscriminatorValue();
- if (discriminatorValueCombo.getText() == null || !discriminatorValueCombo.getText().equals(discriminatorValue)) {
- if (discriminatorValue == null) {
- discriminatorValueCombo.select(0);
- }
- else {
- discriminatorValueCombo.setText(discriminatorValue);
- }
- }
- }
- });
- }
- else if (notification.getFeatureID(IEntity.class) == JpaCoreMappingsPackage.IENTITY__DEFAULT_DISCRIMINATOR_VALUE) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateDiscriminatorValueCombo();
- }
- });
- }
- }
- protected void discriminatorColumnChanged(Notification notification) {
- if (notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__SPECIFIED_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateColumnName();
- }
- });
- }
- else if (notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateDefaultColumnName();
- }
- });
- }
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void propertyChanged(String propertyName) {
+ super.propertyChanged(propertyName);
- else if (notification.getFeatureID(IDiscriminatorColumn.class) == JpaCoreMappingsPackage.IDISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- DiscriminatorType discriminatorType = discriminatorColumn.getDiscriminatorType();
- if (((StructuredSelection) discriminatorTypeViewer.getSelection()).getFirstElement() != discriminatorType) {
- discriminatorTypeViewer.setSelection(new StructuredSelection(discriminatorType));
- }
- }
- });
+ if (propertyName == IEntity.DEFAULT_DISCRIMINATOR_VALUE_PROPERTY ||
+ propertyName == IEntity.SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY)
+ {
+ populateDiscriminatorValueCombo();
}
}
- public void dispose() {
- this.pkJoinColumnsComposite.dispose();
- super.dispose();
+ private void removeConnectionListener() {
+// this.getConnectionProfile().removeConnectionListener(this.connectionListener);
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InverseJoinColumnDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InverseJoinColumnDialog.java
index 4d45d3732b..8c7ad7696d 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InverseJoinColumnDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InverseJoinColumnDialog.java
@@ -1,81 +1,71 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
-import java.util.Iterator;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IJoinTable;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
+/**
+ * TODO
+ *
+ * @see JoinColumnInJoinTableStateObject
+ * @see InverseJoinColumnDialogPane
+ *
+ * @version 2.0
+ * @since 2.0
+ */
public class InverseJoinColumnDialog extends JoinColumnInJoinTableDialog {
- InverseJoinColumnDialog(Shell parent, IJoinTable joinTable) {
- super(parent, joinTable);
- }
+ /**
+ * Creates a new <code>InverseJoinColumnDialog</code>.
+ *
+ * @param parent The parent shell
+ * @param joinColumn
+ */
+ public InverseJoinColumnDialog(Shell parent, IJoinColumn joinColumn) {
- InverseJoinColumnDialog(Shell parent, IJoinColumn joinColumn) {
super(parent, joinColumn);
}
-
- protected String getTitle() {
- return JptUiMappingsMessages.InverseJoinColumnDialog_editInverseJoinColumn;
+
+ /**
+ * Creates a new <code>InverseJoinColumnDialog</code>.
+ *
+ * @param parent The parent shell
+ * @param joinTable
+ */
+ public InverseJoinColumnDialog(Shell parent, IJoinTable joinTable) {
+
+ super(parent, joinTable);
}
-
- protected void populateNameCombo() {
- if (getJoinTable() == null) {
- return;
- }
- if (getJoinColumn() != null) {
- getNameCombo().add(NLS.bind(JptUiMappingsMessages.InverseJoinColumnDialog_defaultWithOneParam, getJoinColumn().getDefaultName()));
- }
- Table joinDBTable = getJoinTable().dbTable();
- if (joinDBTable != null) {
- for (Iterator i = joinDBTable.columnNames(); i.hasNext(); ) {
- getNameCombo().add((String) i.next());
- }
- }
- if (getJoinColumn() != null && getJoinColumn().getSpecifiedName() != null) {
- getNameCombo().setText(getJoinColumn().getSpecifiedName());
- }
- else {
- getNameCombo().select(0);
- }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeMainPane(Composite container) {
+ new InverseJoinColumnDialogPane(getSubjectHolder(), container);
}
- protected void populateReferencedNameCombo() {
- if (getJoinTable() == null) {
- return;
- }
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected String title() {
+
if (getJoinColumn() != null) {
- getReferencedColumnNameCombo().add(NLS.bind(JptUiMappingsMessages.InverseJoinColumnDialog_defaultWithOneParam, getJoinColumn().getDefaultReferencedColumnName()));
- }
- IMultiRelationshipMapping multiRelationshipMapping = (IMultiRelationshipMapping) getJoinTable().eContainer();
- IEntity targetEntity = multiRelationshipMapping.getResolvedTargetEntity();
- if (targetEntity != null) {
- Table referencedDbTable = targetEntity.primaryDbTable();
- if (referencedDbTable != null) {
- for (Iterator i = referencedDbTable.columnNames(); i.hasNext(); ) {
- getReferencedColumnNameCombo().add((String) i.next());
- }
- }
- }
- if (getJoinColumn() != null && getJoinColumn().getSpecifiedReferencedColumnName() != null) {
- getReferencedColumnNameCombo().setText(getJoinColumn().getSpecifiedReferencedColumnName());
- }
- else {
- getReferencedColumnNameCombo().select(0);
+ return JptUiMappingsMessages.InverseJoinColumnDialog_editInverseJoinColumn;
}
+
+ return super.title();
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InverseJoinColumnDialogPane.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InverseJoinColumnDialogPane.java
new file mode 100644
index 0000000000..7cd7dbf523
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/InverseJoinColumnDialogPane.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.details;
+
+import java.util.Iterator;
+import org.eclipse.jpt.core.internal.context.base.IAbstractJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IMultiRelationshipMapping;
+import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * See <code>AbstractJoinColumnDialogPane</code> for the layout.
+ *
+ * @see JoinColumnInJoinTableStateObject
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class InverseJoinColumnDialogPane extends AbstractJoinColumnDialogPane<JoinColumnInJoinTableStateObject>
+{
+ /**
+ * Creates a new <code>InverseJoinColumnDialogPane</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ */
+ public InverseJoinColumnDialogPane(PropertyValueModel<JoinColumnInJoinTableStateObject> subjectHolder,
+ Composite parent)
+ {
+ super(subjectHolder, parent);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public void populateNameCombo() {
+
+ JoinColumnInJoinTableStateObject subject = subject();
+ IAbstractJoinColumn joinColumn = subject.getJoinColumn();
+
+ if (subject.getJoinTable() == null) {
+ return;
+ }
+
+ if (joinColumn != null) {
+ getNameCombo().add(NLS.bind(JptUiMappingsMessages.InverseJoinColumnDialog_defaultWithOneParam, joinColumn.getDefaultName()));
+ }
+
+ Table joinDBTable = subject.getJoinTable().dbTable();
+
+ if (joinDBTable != null) {
+ for (Iterator<String> iter = joinDBTable.columnNames(); iter.hasNext(); ) {
+ getNameCombo().add(iter.next());
+ }
+ }
+
+ if (joinColumn != null &&
+ joinColumn.getSpecifiedName() != null)
+ {
+ getNameCombo().setText(joinColumn.getSpecifiedName());
+ }
+ else {
+ getNameCombo().select(0);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public void populateReferencedNameCombo() {
+
+ JoinColumnInJoinTableStateObject subject = subject();
+ IAbstractJoinColumn joinColumn = subject.getJoinColumn();
+
+ if (subject.getJoinTable() == null) {
+ return;
+ }
+
+ if (joinColumn != null) {
+ getReferencedColumnNameCombo().add(NLS.bind(JptUiMappingsMessages.InverseJoinColumnDialog_defaultWithOneParam, joinColumn.getDefaultReferencedColumnName()));
+ }
+
+ IMultiRelationshipMapping multiRelationshipMapping = subject.relationshipMapping();
+ IEntity targetEntity = multiRelationshipMapping.getResolvedTargetEntity();
+
+ if (targetEntity != null) {
+ Table referencedDbTable = targetEntity.primaryDbTable();
+
+ if (referencedDbTable != null) {
+ for (Iterator<String> iter = referencedDbTable.columnNames(); iter.hasNext(); ) {
+ getReferencedColumnNameCombo().add(iter.next());
+ }
+ }
+ }
+
+ if (joinColumn != null &&
+ joinColumn.getSpecifiedReferencedColumnName() != null)
+ {
+ getReferencedColumnNameCombo().setText(joinColumn.getSpecifiedReferencedColumnName());
+ }
+ else {
+ getReferencedColumnNameCombo().select(0);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnComposite.java
index 98b52e4fc1..82d06c2652 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnComposite.java
@@ -1,428 +1,401 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.ui.internal.mappings.details;
-import java.util.Iterator;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IContentProvider;
+import java.util.ListIterator;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.IAbstractColumn;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.ISingleRelationshipMapping;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane;
+import org.eclipse.jpt.ui.internal.widgets.AddRemovePane;
+import org.eclipse.jpt.ui.internal.widgets.PostExecution;
+import org.eclipse.jpt.ui.internal.widgets.AddRemovePane.Adapter;
+import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class JoinColumnComposite
- extends BaseJpaComposite
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | |
+ * | x Override Default |
+ * | |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | AddRemoveListPane | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see ISingleRelationshipMapping
+ * @see IJoinColumn
+ * @see ManyToOneMappingComposite - A container of this pane
+ * @see OneToOneMappingComposite - A container of this pane
+ * @see JoinColumnInRelationshipMappingDialog
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class JoinColumnComposite extends AbstractFormPane<ISingleRelationshipMapping>
{
- private ISingleRelationshipMapping singleRelationshipMapping;
- private final Adapter singleRelationshipMappingListener;
- private final Adapter joinColumnListener;
-
-
- private Group joinColumnsGroup;
- Button overrideDefaultJoinColumnsCheckBox;
- ListViewer joinColumnsListViewer;
- private Button joinColumnsRemoveButton;
- private Button joinColumnsEditButton;
-
-
-
- public JoinColumnComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.singleRelationshipMappingListener = buildSingleRelationshipMappingListener();
- this.joinColumnListener = buildJoinColumnListener();
+ private Button overrideDefaultJoinColumnsCheckBox;
+
+ /**
+ * Creates a new <code>JoinColumnComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ protected JoinColumnComposite(AbstractFormPane<? extends ISingleRelationshipMapping> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
}
-
- private Adapter buildSingleRelationshipMappingListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- singleRelationshipMappingChanged(notification);
- }
- };
+ /**
+ * Creates a new <code>JoinColumnComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>ISingleRelationshipMapping</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public JoinColumnComposite(PropertyValueModel<? extends ISingleRelationshipMapping> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ private void addJoinColumn() {
+
+ JoinColumnInRelationshipMappingDialog dialog =
+ new JoinColumnInRelationshipMappingDialog(shell(), subject());
+
+ dialog.openDialog(buildAddJoinColumnPostExecution());
}
-
- private Adapter buildJoinColumnListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- joinColumnChanged(notification);
+
+ private void addJoinColumn(JoinColumnInRelationshipMappingStateObject stateObject) {
+
+ int index = subject().specifiedJoinColumnsSize();
+
+ IJoinColumn joinColumn = subject().addSpecifiedJoinColumn(index);
+ joinColumn.setSpecifiedName(stateObject.getSelectedName());
+ joinColumn.setSpecifiedReferencedColumnName(stateObject.getSpecifiedReferencedColumnName());
+
+ if (!stateObject.isDefaultTableSelected()) {
+ // Not checking this for name and referenced column name because
+ // there is no default option when you are adding a second join
+ // column. There is always at least 1 join column (the default)
+ joinColumn.setSpecifiedTable(stateObject.getSelectedTable());
+ }
+ }
+
+ private PostExecution<JoinColumnInRelationshipMappingDialog> buildAddJoinColumnPostExecution() {
+ return new PostExecution<JoinColumnInRelationshipMappingDialog>() {
+ public void execute(JoinColumnInRelationshipMappingDialog dialog) {
+ if (dialog.wasConfirmed()) {
+ JoinColumnInRelationshipMappingStateObject stateObject = dialog.subject();
+ addJoinColumn(stateObject);
+ }
}
};
}
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- this.overrideDefaultJoinColumnsCheckBox =
- getWidgetFactory().createButton(
- composite,
- JptUiMappingsMessages.JoinColumnComposite_overrideDefaultJoinColumns,
- SWT.CHECK);
- this.overrideDefaultJoinColumnsCheckBox.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- if (JoinColumnComposite.this.overrideDefaultJoinColumnsCheckBox.getSelection()) {
- IJoinColumn defaultJoinColumn = JoinColumnComposite.this.singleRelationshipMapping.getDefaultJoinColumns().get(0);
- String columnName = defaultJoinColumn.getDefaultName();
- String referencedColumnName = defaultJoinColumn.getDefaultReferencedColumnName();
-
- IJoinColumn joinColumn = JoinColumnComposite.this.singleRelationshipMapping.createJoinColumn(0);
- JoinColumnComposite.this.singleRelationshipMapping.getSpecifiedJoinColumns().add(joinColumn);
- joinColumn.setSpecifiedName(columnName);
- joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- } else {
- JoinColumnComposite.this.singleRelationshipMapping.getSpecifiedJoinColumns().clear();
+
+ private String buildDefaultJoinColumnLabel(IJoinColumn joinColumn) {
+ return NLS.bind(
+ JptUiMappingsMessages.JoinColumnComposite_mappingBetweenTwoParamsDefault,
+ joinColumn.getName(),
+ joinColumn.getReferencedColumnName()
+ );
+ }
+
+ private PostExecution<JoinColumnInRelationshipMappingDialog> buildEditJoinColumnPostExecution() {
+ return new PostExecution<JoinColumnInRelationshipMappingDialog>() {
+ public void execute(JoinColumnInRelationshipMappingDialog dialog) {
+ if (dialog.wasConfirmed()) {
+ updateJoinColumn(dialog.subject());
}
}
- });
-
- this.joinColumnsGroup =
- getWidgetFactory().createGroup(
- composite,
- JptUiMappingsMessages.JoinColumnComposite_joinColumn);
- this.joinColumnsGroup.setLayout(new GridLayout(2, false));
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- this.joinColumnsGroup.setLayoutData(gridData);
-
- this.joinColumnsListViewer = new ListViewer(this.joinColumnsGroup, SWT.BORDER | SWT.MULTI);
- this.joinColumnsListViewer.setContentProvider(buildJoinColumnsListContentProvider());
- this.joinColumnsListViewer.setLabelProvider(buildJoinColumnsListLabelProvider());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.verticalSpan = 3;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.joinColumnsListViewer.getList().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.joinColumnsListViewer.getList(), IJpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS);
-
- Button addJoinColumnButton = getWidgetFactory().createButton(this.joinColumnsGroup, JptUiMappingsMessages.JoinColumnComposite_add, SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- addJoinColumnButton.setLayoutData(gridData);
- addJoinColumnButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
+ };
+ }
+
+ private WritablePropertyValueModel<IJoinColumn> buildJoinColumnHolder() {
+ return new SimplePropertyValueModel<IJoinColumn>();
+ }
+
+ private String buildJoinColumnLabel(IJoinColumn joinColumn) {
+ if (joinColumn.getSpecifiedName() == null) {
+ if (joinColumn.getSpecifiedReferencedColumnName() == null) {
+ return NLS.bind(
+ JptUiMappingsMessages.JoinColumnComposite_mappingBetweenTwoParamsBothDefault,
+ joinColumn.getName(),
+ joinColumn.getReferencedColumnName()
+ );
}
-
- public void widgetSelected(SelectionEvent e) {
+
+ return NLS.bind(
+ JptUiMappingsMessages.JoinColumnComposite_mappingBetweenTwoParamsFirstDefault,
+ joinColumn.getName(),
+ joinColumn.getReferencedColumnName()
+ );
+ }
+ else if (joinColumn.getSpecifiedReferencedColumnName() == null) {
+ return NLS.bind(
+ JptUiMappingsMessages.JoinColumnComposite_mappingBetweenTwoParamsSecDefault,
+ joinColumn.getName(),
+ joinColumn.getReferencedColumnName()
+ );
+ }
+ else {
+ return NLS.bind(
+ JptUiMappingsMessages.JoinColumnComposite_mappingBetweenTwoParams,
+ joinColumn.getName(),
+ joinColumn.getReferencedColumnName()
+ );
+ }
+ }
+
+ private Adapter buildJoinColumnsAdapter() {
+ return new AddRemovePane.AbstractAdapter() {
+
+ public void addNewItem(ObjectListSelectionModel listSelectionModel) {
addJoinColumn();
}
- });
-
- this.joinColumnsEditButton = getWidgetFactory().createButton(this.joinColumnsGroup, JptUiMappingsMessages.JoinColumnComposite_edit, SWT.NONE);
- this.joinColumnsEditButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- editJoinColumn();
- }
- });
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- this.joinColumnsEditButton.setLayoutData(gridData);
-
- this.joinColumnsRemoveButton = getWidgetFactory().createButton(this.joinColumnsGroup, JptUiMappingsMessages.JoinColumnComposite_remove, SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.BEGINNING;
- this.joinColumnsRemoveButton.setLayoutData(gridData);
- this.joinColumnsRemoveButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- removeJoinColumn();
+
+ @Override
+ public boolean hasOptionalButton() {
+ return true;
}
- });
-
- this.joinColumnsListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateEnablement();
+
+ @Override
+ public String optionalButtonText() {
+ return JptUiMappingsMessages.JoinColumnComposite_edit;
}
- });
- }
- private IContentProvider buildJoinColumnsListContentProvider() {
- return new IStructuredContentProvider(){
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
+ @Override
+ public void optionOnSelection(ObjectListSelectionModel listSelectionModel) {
+ editJoinColumn(listSelectionModel);
}
- public void dispose() {
- // do nothing
+
+ public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) {
+ removeJoinColumn(listSelectionModel);
}
- public Object[] getElements(Object inputElement) {
- return ((ISingleRelationshipMapping) inputElement).getJoinColumns().toArray();
+ };
+ }
+
+ private ListValueModel<IJoinColumn> buildJoinColumnsListHolder() {
+ return new ListAspectAdapter<ISingleRelationshipMapping, IJoinColumn>(
+ getSubjectHolder(),
+ ISingleRelationshipMapping.DEFAULT_JOIN_COLUMNS_LIST,
+ ISingleRelationshipMapping.SPECIFIED_JOIN_COLUMNS_LIST)
+ {
+ @Override
+ protected ListIterator<IJoinColumn> listIterator_() {
+ return subject.joinColumns();
}
};
}
-
+
private ILabelProvider buildJoinColumnsListLabelProvider() {
return new LabelProvider() {
+ @Override
public String getText(Object element) {
IJoinColumn joinColumn = (IJoinColumn) element;
- return (JoinColumnComposite.this.singleRelationshipMapping.getSpecifiedJoinColumns().size() == 0) ?
- buildDefaultJoinColumnLabel(joinColumn)
- :
+
+ return (subject().specifiedJoinColumnsSize() == 0) ?
+ buildDefaultJoinColumnLabel(joinColumn) :
buildJoinColumnLabel(joinColumn);
}
};
}
-
- String buildDefaultJoinColumnLabel(IJoinColumn joinColumn) {
- return NLS.bind(JptUiMappingsMessages.JoinColumnComposite_mappingBetweenTwoParamsDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
-
- String buildJoinColumnLabel(IJoinColumn joinColumn) {
- if (joinColumn.getSpecifiedName() == null) {
- if (joinColumn.getSpecifiedReferencedColumnName() == null) {
- return NLS.bind(JptUiMappingsMessages.JoinColumnComposite_mappingBetweenTwoParamsBothDefault, joinColumn.getName(),joinColumn.getReferencedColumnName());
- }
- return NLS.bind(JptUiMappingsMessages.JoinColumnComposite_mappingBetweenTwoParamsFirstDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- else if (joinColumn.getSpecifiedReferencedColumnName() == null) {
- return NLS.bind(JptUiMappingsMessages.JoinColumnComposite_mappingBetweenTwoParamsSecDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- else {
- return NLS.bind(JptUiMappingsMessages.JoinColumnComposite_mappingBetweenTwoParams, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- }
-
- protected void joinColumnChanged(Notification notification) {
- if (notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__SPECIFIED_NAME
- || notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME
- || notification.getFeatureID(IAbstractColumn.class) == JpaCoreMappingsPackage.IABSTRACT_COLUMN__SPECIFIED_TABLE
- || notification.getFeatureID(IAbstractColumn.class) == JpaCoreMappingsPackage.IABSTRACT_COLUMN__DEFAULT_TABLE
- || notification.getFeatureID(IAbstractJoinColumn.class) == JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME
- || notification.getFeatureID(IAbstractJoinColumn.class) == JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
+
+ private SelectionAdapter buildOverrideDefaultJoinColumnsSelectionListener() {
+ return new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+
+ if (isPopulating()) {
+ return;
+ }
+
+ if (overrideDefaultJoinColumnsCheckBox.getSelection()) {
+ IJoinColumn defaultJoinColumn = subject().defaultJoinColumns().next();
+ String columnName = defaultJoinColumn.getDefaultName();
+ String referencedColumnName = defaultJoinColumn.getDefaultReferencedColumnName();
+
+ IJoinColumn joinColumn = subject().addSpecifiedJoinColumn(0);
+ joinColumn.setSpecifiedName(columnName);
+ joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
+ }
+ else {
+ for (int index = subject().specifiedJoinColumnsSize(); --index >= 0; ) {
+ subject().removeSpecifiedJoinColumn(index);
}
- joinColumnsListViewer.refresh();
}
- });
- }
+ }
+ };
}
- void addJoinColumn() {
- JoinColumnDialog dialog = new JoinColumnInRelationshipMappingDialog(this.getControl().getShell(), this.singleRelationshipMapping);
- this.addJoinColumnFromDialog(dialog);
+ private WritablePropertyValueModel<Boolean> buildOverrideDefaultJoinsColumnHolder() {
+ // TODO
+ return new SimplePropertyValueModel<Boolean>();
}
-
- private void addJoinColumnFromDialog(JoinColumnDialog dialog) {
- if (dialog.open() != Window.OK) {
- return;
- }
- int index = this.singleRelationshipMapping.getJoinColumns().size();
- IJoinColumn joinColumn = this.singleRelationshipMapping.createJoinColumn(index);
- this.singleRelationshipMapping.getSpecifiedJoinColumns().add(joinColumn);
- joinColumn.setSpecifiedName(dialog.getSelectedName());
- joinColumn.setSpecifiedReferencedColumnName(dialog.getReferencedColumnName());
- if (!dialog.isDefaultTableSelected()) {
- //not checking this for name and referenced column name because there is no
- //default option when you are adding a second join column. There is always
- //at least 1 join column (the default)
- joinColumn.setSpecifiedTable(dialog.getSelectedTable());
- }
+
+ private Composite buildPane(Composite container, int groupBoxMargin) {
+ return buildSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
+ }
+
+ private ListValueModel<IJoinColumn> buildSortedJoinColumnsListHolder() {
+ return new SortedListValueModelAdapter<IJoinColumn>(
+ buildJoinColumnsListHolder()
+ );
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void doPopulate() {
+ super.doPopulate();
+ overrideDefaultJoinColumnsCheckBox.setSelection(subject() != null && subject().containsSpecifiedJoinColumns());
}
-
- void editJoinColumn() {
- IJoinColumn joinColumn = getSelectedJoinColumn();
- JoinColumnDialog dialog = new JoinColumnInRelationshipMappingDialog(this.getControl().getShell(), joinColumn);
- editJoinColumnFromDialog(dialog, joinColumn);
+
+ private void editJoinColumn(ObjectListSelectionModel listSelectionModel) {
+
+ IJoinColumn joinColumn = (IJoinColumn) listSelectionModel.selectedValue();
+
+ JoinColumnInRelationshipMappingDialog dialog =
+ new JoinColumnInRelationshipMappingDialog(shell(), joinColumn);
+
+ dialog.openDialog(buildEditJoinColumnPostExecution());
}
-
- private IJoinColumn getSelectedJoinColumn() {
- return (IJoinColumn) ((StructuredSelection) this.joinColumnsListViewer.getSelection()).getFirstElement();
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ int groupBoxMargin = groupBoxMargin();
+
+ // Override Default Join Columns check box
+ overrideDefaultJoinColumnsCheckBox = buildCheckBox(
+ buildPane(container, groupBoxMargin),
+ JptUiMappingsMessages.JoinColumnComposite_overrideDefaultJoinColumns,
+ buildOverrideDefaultJoinsColumnHolder()
+ );
+
+ overrideDefaultJoinColumnsCheckBox.addSelectionListener(
+ buildOverrideDefaultJoinColumnsSelectionListener()
+ );
+
+ // Join Columns group
+ Group joinColumnsGroup = buildTitledPane(
+ container,
+ JptUiMappingsMessages.JoinColumnComposite_joinColumn
+ );
+
+ // Join Columns list pane
+ new AddRemoveListPane<ISingleRelationshipMapping>(
+ this,
+ joinColumnsGroup,
+ buildJoinColumnsAdapter(),
+ buildSortedJoinColumnsListHolder(),
+ buildJoinColumnHolder(),
+ buildJoinColumnsListLabelProvider(),
+ IJpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS
+ );
}
- private void editJoinColumnFromDialog(JoinColumnDialog dialog, IJoinColumn joinColumn) {
- if (dialog.open() == Window.OK) {
- editJoinColumnDialogOkd(dialog, joinColumn);
+ private void removeJoinColumn(ObjectListSelectionModel listSelectionModel) {
+
+ int[] selectedIndices = listSelectionModel.selectedIndices();
+
+ for (int index = selectedIndices.length; --index >= 0; ) {
+ subject().removeSpecifiedJoinColumn(selectedIndices[index]);
}
}
-
- private void editJoinColumnDialogOkd(JoinColumnDialog dialog, IJoinColumn joinColumn) {
- String name = dialog.getSelectedName();
- String referencedColumnName = dialog.getReferencedColumnName();
- String table = dialog.getSelectedTable();
- if (dialog.isDefaultNameSelected()) {
+ private void updateJoinColumn(JoinColumnInRelationshipMappingStateObject stateObject) {
+
+ IJoinColumn joinColumn = stateObject.getJoinColumn();
+ String name = stateObject.getSelectedName();
+ String referencedColumnName = stateObject.getSpecifiedReferencedColumnName();
+ String table = stateObject.getSelectedTable();
+
+ // Name
+ if (stateObject.isDefaultNameSelected()) {
+
if (joinColumn.getSpecifiedName() != null) {
joinColumn.setSpecifiedName(null);
}
}
- else if (joinColumn.getSpecifiedName() == null || !joinColumn.getSpecifiedName().equals(name)){
+ else if (joinColumn.getSpecifiedName() == null ||
+ !joinColumn.getSpecifiedName().equals(name)){
+
joinColumn.setSpecifiedName(name);
}
- if (dialog.isDefaultReferencedColumnNameSelected()) {
+
+ // Referenced Column Name
+ if (stateObject.isDefaultReferencedColumnNameSelected()) {
+
if (joinColumn.getSpecifiedReferencedColumnName() != null) {
joinColumn.setSpecifiedReferencedColumnName(null);
}
}
- else if (joinColumn.getSpecifiedReferencedColumnName() == null || !joinColumn.getSpecifiedReferencedColumnName().equals(referencedColumnName)){
+ else if (joinColumn.getSpecifiedReferencedColumnName() == null ||
+ !joinColumn.getSpecifiedReferencedColumnName().equals(referencedColumnName)){
+
joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
}
-
- if (dialog.isDefaultTableSelected()) {
+
+ // Specified Table
+ if (stateObject.isDefaultTableSelected()) {
+
if (joinColumn.getSpecifiedTable() != null) {
joinColumn.setSpecifiedTable(null);
}
}
- else if (joinColumn.getSpecifiedTable() == null || !joinColumn.getSpecifiedTable().equals(table)){
+ else if (joinColumn.getSpecifiedTable() == null ||
+ !joinColumn.getSpecifiedTable().equals(table)){
+
joinColumn.setSpecifiedTable(table);
}
- DefaultTrueBoolean insertable = dialog.getInsertable();
+ // Insertable
+ Boolean insertable = stateObject.getInsertable();
+
if (joinColumn.getInsertable() != insertable) {
- joinColumn.setInsertable(insertable);
+ joinColumn.setSpecifiedInsertable(insertable);
}
- DefaultTrueBoolean updatable = dialog.getUpdatable();
- if (joinColumn.getUpdatable() != updatable) {
- joinColumn.setUpdatable(updatable);
- }
- }
-
- void removeJoinColumn() {
- ISelection selection = this.joinColumnsListViewer.getSelection();
- if (selection instanceof StructuredSelection) {
- for (Iterator stream = ((StructuredSelection) selection).iterator(); stream.hasNext(); ) {
- this.singleRelationshipMapping.getJoinColumns().remove(stream.next());
- }
- }
- }
-
- protected void singleRelationshipMappingChanged(Notification notification) {
- if (notification.getFeatureID(ISingleRelationshipMapping.class) == JpaCoreMappingsPackage.ISINGLE_RELATIONSHIP_MAPPING__SPECIFIED_JOIN_COLUMNS) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- JoinColumnComposite.this.joinColumnsListViewer.refresh();
- JoinColumnComposite.this.overrideDefaultJoinColumnsCheckBox.setSelection(singleRelationshipMapping.containsSpecifiedJoinColumns());
- JoinColumnComposite.this.updateEnablement();
- }
- });
- if (notification.getEventType() == Notification.ADD) {
- ((IJoinColumn) notification.getNewValue()).eAdapters().add(this.joinColumnListener);
- }
- else if (notification.getEventType() == Notification.REMOVE) {
- ((IJoinColumn) notification.getOldValue()).eAdapters().remove(this.joinColumnListener);
- }
- }
- }
-
- private void enableGroup(Group group, boolean enabled) {
- group.setEnabled(enabled);
- for (int i = 0; i < group.getChildren().length; i++) {
- group.getChildren()[i].setEnabled(enabled);
- }
- }
+ // Updatable
+ Boolean updatable = stateObject.getUpdatable();
-
-
- protected void engageListeners() {
- if (this.singleRelationshipMapping != null) {
- this.singleRelationshipMapping.eAdapters().add(this.singleRelationshipMappingListener);
- for (Iterator i = this.singleRelationshipMapping.getJoinColumns().iterator(); i.hasNext(); ) {
- ((IJoinColumn) i.next()).eAdapters().add(this.joinColumnListener);
- }
- }
- }
-
- protected void disengageListeners() {
- if (this.singleRelationshipMapping != null) {
- for (Iterator i = this.singleRelationshipMapping.getJoinColumns().iterator(); i.hasNext(); ) {
- ((IJoinColumn) i.next()).eAdapters().remove(this.joinColumnListener);
- }
- this.singleRelationshipMapping.eAdapters().remove(this.singleRelationshipMappingListener);
- }
- }
-
- public void doPopulate(EObject obj) {
- this.singleRelationshipMapping = (ISingleRelationshipMapping) obj;
- if (this.singleRelationshipMapping == null) {
- this.joinColumnsListViewer.setInput(null);
- return;
+ if (joinColumn.getUpdatable() != updatable) {
+ joinColumn.setSpecifiedUpdatable(updatable);
}
-
- this.joinColumnsListViewer.setInput(this.singleRelationshipMapping);
-
-
- updateEnablement();
- this.overrideDefaultJoinColumnsCheckBox.setSelection(this.singleRelationshipMapping.containsSpecifiedJoinColumns());
- }
-
- @Override
- protected void doPopulate() {
- this.joinColumnsListViewer.setInput(this.singleRelationshipMapping);
- }
-
- void updateEnablement() {
- boolean groupEnabledState = this.singleRelationshipMapping.containsSpecifiedJoinColumns();
- enableGroup(this.joinColumnsGroup, groupEnabledState);
-
- this.joinColumnsRemoveButton.setEnabled(groupEnabledState && !((StructuredSelection) this.joinColumnsListViewer.getSelection()).isEmpty());
- this.joinColumnsEditButton.setEnabled(groupEnabledState && ((StructuredSelection) this.joinColumnsListViewer.getSelection()).size() == 1);
- }
-
- public void dispose() {
- disengageListeners();
- super.dispose();
}
-
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialog.java
index ff716ce124..f78c8e79d6 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialog.java
@@ -3,206 +3,59 @@
* 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.ui.internal.mappings.details;
-import java.util.Iterator;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.mappings.DefaultTrueBoolean;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Combo;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-public abstract class JoinColumnDialog extends AbstractJoinColumnDialog<IJoinColumn> {
-
- private Combo tableCombo;
- private ComboViewer insertableComboViewer;
- private ComboViewer updatableComboViewer;
-
- private boolean defaultTableSelected;
- private String selectedTable;
- private DefaultTrueBoolean insertable;
- private DefaultTrueBoolean updatable;
-
- JoinColumnDialog(Shell parent) {
+/**
+ * TODO
+ *
+ * @see JoinColumnStateObject
+ * @see JoinColumnDialogPane
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public abstract class JoinColumnDialog<T extends JoinColumnStateObject> extends AbstractJoinColumnDialog<T> {
+
+ /**
+ * Creates a new <code>AbstractJoinColumnDialog</code>.
+ *
+ * @param parent The parent shell
+ */
+ public JoinColumnDialog(Shell parent) {
super(parent);
}
- JoinColumnDialog(Shell parent, IJoinColumn joinColumn) {
+ /**
+ * Creates a new <code>AbstractJoinColumnDialog</code>.
+ *
+ * @param parent The parent shell
+ * @param joinColumn
+ */
+ public JoinColumnDialog(Shell parent, IJoinColumn joinColumn) {
super(parent, joinColumn);
}
- protected Control createDialogArea(Composite parent) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
- Composite composite = (Composite) super.createDialogArea(parent);
-
- Label tableLabel = new Label(composite, SWT.LEFT);
- tableLabel.setText(JptUiMappingsMessages.JoinColumnDialog_table);
- GridData gridData = new GridData();
- tableLabel.setLayoutData(gridData);
-
- this.tableCombo = new Combo(composite, SWT.LEFT);
- this.tableCombo.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- populateNameCombo();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- populateNameCombo();
- }
- });
- gridData = new GridData();
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.tableCombo.setLayoutData(gridData);
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(this.tableCombo, IJpaHelpContextIds.MAPPING_JOIN_REFERENCED_COLUMN);
- populateTableCombo();
-
- Label insertableLabel = new Label(composite, SWT.LEFT);
- insertableLabel.setText(JptUiMappingsMessages.JoinColumnDialog_insertable);
- insertableLabel.setLayoutData(new GridData());
-
- this.insertableComboViewer = this.buildInsertableComboViewer(composite);
- this.insertableComboViewer.getCombo().setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- helpSystem.setHelp(this.insertableComboViewer.getCombo(), IJpaHelpContextIds.MAPPING_COLUMN_INSERTABLE);
-
- Label updatableLabel = new Label(composite, SWT.LEFT);
- updatableLabel.setText(JptUiMappingsMessages.JoinColumnDialog_updatable);
- updatableLabel.setLayoutData(new GridData());
-
- this.updatableComboViewer = this.buildUpdatableComboViewer(composite);
- this.updatableComboViewer.getCombo().setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- helpSystem.setHelp(this.updatableComboViewer.getCombo(), IJpaHelpContextIds.MAPPING_COLUMN_UPDATABLE);
-
- return composite;
- }
-
- private ComboViewer buildInsertableComboViewer(Composite parent) {
- ComboViewer viewer = new ComboViewer(parent, SWT.READ_ONLY);
- viewer.setLabelProvider(buildDefaultTrueLabelProvider());
- viewer.add(DefaultTrueBoolean.VALUES.toArray());
-
- DefaultTrueBoolean sel = (this.joinColumn() == null) ? DefaultTrueBoolean.DEFAULT : this.joinColumn().getInsertable();
- viewer.setSelection(new StructuredSelection(sel));
- return viewer;
- }
-
- private IBaseLabelProvider buildDefaultTrueLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- if (element == DefaultTrueBoolean.DEFAULT) {
- //TODO need to move this to the model, don't want hardcoded String
- return NLS.bind(JptUiMappingsMessages.JoinColumnDialog_defaultTrue, "True");
- }
- return super.getText(element);
- }
- };
- }
-
- private ComboViewer buildUpdatableComboViewer(Composite parent) {
- ComboViewer viewer = new ComboViewer(parent, SWT.READ_ONLY);
- viewer.setLabelProvider(buildDefaultTrueLabelProvider());
- viewer.add(DefaultTrueBoolean.VALUES.toArray());
- DefaultTrueBoolean sel = (this.joinColumn() == null) ? DefaultTrueBoolean.DEFAULT : this.joinColumn().getUpdatable();
- viewer.setSelection(new StructuredSelection(sel));
- return viewer;
- }
-
- protected void populateTableCombo() {
- this.tableCombo.add(NLS.bind(JptUiMappingsMessages.JoinColumnDialog_defaultWithOneParam, defaultTableName()));
- Schema schema = this.getSchema();
- if (schema != null) {
- Iterator<String> tables = schema.tableNames();
- for (Iterator<String> stream = CollectionTools.sort( tables); stream.hasNext(); ) {
- this.tableCombo.add(stream.next());
- }
- }
- if (specifiedTableName() != null) {
- this.tableCombo.setText(specifiedTableName());
- }
- else {
- this.tableCombo.select(0);
- }
- }
-
- protected abstract String defaultTableName();
-
- protected String specifiedTableName() {
- if (getJoinColumn() != null) {
- return getJoinColumn().getSpecifiedTable();
- }
- return null;
- }
-
- protected String tableName() {
- if (this.tableCombo != null) {
- if (this.tableCombo.getSelectionIndex() == 0) {
- return defaultTableName();
- }
- return this.tableCombo.getText();
- }
- return (this.specifiedTableName() == null) ? defaultTableName() : this.specifiedTableName();
- }
-
- protected abstract Schema getSchema();
-
- private IJoinColumn joinColumn() {
- return this.getJoinColumn();
- }
-
- protected boolean isDefaultTableSelected() {
- return this.defaultTableSelected;
- }
-
- public String getSelectedTable() {
- return this.selectedTable;
- }
-
- public DefaultTrueBoolean getInsertable() {
- return this.insertable;
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public IJoinColumn getJoinColumn() {
+ return (IJoinColumn) super.getJoinColumn();
}
- public DefaultTrueBoolean getUpdatable() {
- return this.updatable;
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeMainPane(Composite container) {
+ new JoinColumnDialogPane(getSubjectHolder(), container);
}
-
- public boolean close() {
- this.defaultTableSelected = this.tableCombo.getSelectionIndex() == 0;
- this.selectedTable = this.tableCombo.getText();
-
- ISelection selection = this.insertableComboViewer.getSelection();
- if (selection instanceof IStructuredSelection) {
- this.insertable = (DefaultTrueBoolean) ((IStructuredSelection) selection).getFirstElement();
- }
-
- selection = this.updatableComboViewer.getSelection();
- if (selection instanceof IStructuredSelection) {
- this.updatable = (DefaultTrueBoolean) ((IStructuredSelection) selection).getFirstElement();
- }
-
- return super.close();
- }
-
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialogPane.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialogPane.java
new file mode 100644
index 0000000000..b47feacc53
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnDialogPane.java
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.EnumComboViewer;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------ |
+ * | Table: | TableCombo |v| |
+ * | ------------------------------------------------------------------ |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | EnumComboViewer | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | EnumComboViewer | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see JoinColumnStateObject
+ * @see EnumComboViewer
+ * @see JoinColumnDialog - The parent container
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class JoinColumnDialogPane extends AbstractJoinColumnDialogPane<JoinColumnStateObject>
+{
+ private CCombo tableCombo;
+
+ /**
+ * Creates a new <code>JoinColumnDialogPane</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ */
+ public JoinColumnDialogPane(PropertyValueModel<? extends JoinColumnStateObject> subjectHolder,
+ Composite parent)
+ {
+ super(subjectHolder, parent);
+ }
+
+ private EnumComboViewer<JoinColumnStateObject, Boolean> buildInsertableCombo(Composite container) {
+
+ return new EnumComboViewer<JoinColumnStateObject, Boolean>(this, container) {
+
+ @Override
+ protected Boolean[] choices() {
+ return new Boolean[] { Boolean.TRUE, Boolean.FALSE };
+ }
+
+ @Override
+ protected Boolean defaultValue() {
+ return null;
+ }
+
+ @Override
+ protected String displayString(Boolean value) {
+ return buildDisplayString(
+ JptUiMappingsMessages.class,
+ JoinColumnDialogPane.this,
+ value
+ );
+ }
+
+ @Override
+ protected Boolean getValue() {
+ return subject().getInsertable();
+ }
+
+ @Override
+ protected String propertyName() {
+ return JoinColumnStateObject.INSERTABLE_PROPERTY;
+ }
+
+ @Override
+ protected void setValue(Boolean value) {
+ subject().setInsertable(value);
+ }
+ };
+ }
+
+ private SelectionListener buildTableComboSelectionListener() {
+ return new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ populateNameCombo();
+ }
+ };
+ }
+
+ private EnumComboViewer<JoinColumnStateObject, Boolean> buildUpdatableCombo(Composite container) {
+
+ return new EnumComboViewer<JoinColumnStateObject, Boolean>(this, container) {
+
+ @Override
+ protected Boolean[] choices() {
+ return new Boolean[] { Boolean.TRUE, Boolean.FALSE };
+ }
+
+ @Override
+ protected Boolean defaultValue() {
+ return true;
+ }
+
+ @Override
+ protected String displayString(Boolean value) {
+ return buildDisplayString(
+ JptUiMappingsMessages.class,
+ JoinColumnDialogPane.this,
+ value
+ );
+ }
+
+ @Override
+ protected Boolean getValue() {
+ return subject().getUpdatable();
+ }
+
+ @Override
+ protected String propertyName() {
+ return JoinColumnStateObject.UPDATABLE_PROPERTY;
+ }
+
+ @Override
+ protected void setValue(Boolean value) {
+ subject().setUpdatable(value);
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+ super.initializeLayout(container);
+
+ // Join Referenced Column widgets
+ tableCombo = buildCombo(container);
+ tableCombo.addSelectionListener(buildTableComboSelectionListener());
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.JoinColumnDialog_table,
+ tableCombo,
+ IJpaHelpContextIds.MAPPING_JOIN_REFERENCED_COLUMN
+ );
+
+ // Insertable widgets
+ EnumComboViewer<JoinColumnStateObject, Boolean> insertableCombo =
+ buildInsertableCombo(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.JoinColumnDialog_insertable,
+ insertableCombo.getControl(),
+ IJpaHelpContextIds.MAPPING_COLUMN_INSERTABLE
+ );
+
+ // Updatable widgets
+ EnumComboViewer<JoinColumnStateObject, Boolean> updatableCombo =
+ buildUpdatableCombo(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.JoinColumnDialog_updatable,
+ updatableCombo.getControl(),
+ IJpaHelpContextIds.MAPPING_COLUMN_UPDATABLE
+ );
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInAssociationOverrideDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInAssociationOverrideDialog.java
index c324a95b34..6007374426 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInAssociationOverrideDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInAssociationOverrideDialog.java
@@ -1,62 +1,67 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
-import org.eclipse.jpt.core.internal.IAttributeMapping;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.core.internal.context.base.IAssociationOverride;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
import org.eclipse.swt.widgets.Shell;
-public class JoinColumnInAssociationOverrideDialog extends JoinColumnDialog {
+/**
+ * TODO
+ *
+ * @see JoinColumnInAssociationOverrideStateObject
+ * @see JoinColumnDialogPane
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class JoinColumnInAssociationOverrideDialog extends JoinColumnDialog<JoinColumnInAssociationOverrideStateObject> {
private IAssociationOverride associationOverride;
-
- JoinColumnInAssociationOverrideDialog(Shell parent, IAssociationOverride associationOverride) {
+
+ /**
+ * Creates a new <code>JoinColumnInAssociationOverrideDialog</code>.
+ *
+ * @param parent The parent shell
+ * @param associationOverride
+ */
+ public JoinColumnInAssociationOverrideDialog(Shell parent,
+ IAssociationOverride associationOverride) {
+
super(parent);
this.associationOverride = associationOverride;
}
- JoinColumnInAssociationOverrideDialog(Shell parent, IJoinColumn joinColumn) {
+ /**
+ * Creates a new <code>JoinColumnInAssociationOverrideDialog</code>.
+ *
+ * @param parent The parent shell
+ * @param joinColumn
+ */
+ public JoinColumnInAssociationOverrideDialog(Shell parent,
+ IJoinColumn joinColumn) {
+
super(parent, joinColumn);
- this.associationOverride = (IAssociationOverride) joinColumn.eContainer();
- }
-
- protected Schema getSchema() {
- return this.associationOverride.typeMapping().dbSchema();
- }
-
- protected String defaultTableName() {
- if (getJoinColumn() != null) {
- return getJoinColumn().getDefaultTable();
- }
- return this.associationOverride.typeMapping().getTableName();
+ this.associationOverride = (IAssociationOverride) joinColumn.parent();
}
- protected Table getNameTable() {
- return this.associationOverride.typeMapping().primaryDbTable();
- }
-
- protected Table getReferencedNameTable() {
- IAttributeMapping attributeMapping = this.associationOverride.getOwner().attributeMapping(this.associationOverride.getName());
- if (attributeMapping == null || !(attributeMapping instanceof IRelationshipMapping)) {
- return null;
- }
- IEntity targetEntity = ((IRelationshipMapping) attributeMapping).getResolvedTargetEntity();
- if (targetEntity != null) {
- return targetEntity.primaryDbTable();
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected JoinColumnInAssociationOverrideStateObject buildStateObject() {
+
+ if (associationOverride != null) {
+ return new JoinColumnInAssociationOverrideStateObject(associationOverride);
}
- return null;
- }
-}
+ return new JoinColumnInAssociationOverrideStateObject(getJoinColumn());
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInAssociationOverrideStateObject.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInAssociationOverrideStateObject.java
new file mode 100644
index 0000000000..be0b0f153c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInAssociationOverrideStateObject.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.IAssociationOverride;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IRelationshipMapping;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.db.internal.Table;
+
+/**
+ * @version 2.0
+ * @since 2.0
+ */
+public class JoinColumnInAssociationOverrideStateObject extends JoinColumnStateObject
+{
+ private IAssociationOverride associationOverride;
+
+ /**
+ * Creates a new <code>JoinColumnInAssociationOverrideStateObject</code>.
+ */
+ public JoinColumnInAssociationOverrideStateObject(IAssociationOverride associationOverride) {
+ super();
+ this.associationOverride = associationOverride;
+ }
+
+ /**
+ * Creates a new <code>JoinColumnInAssociationOverrideStateObject</code>.
+ *
+ * @param joinColumn
+ */
+ public JoinColumnInAssociationOverrideStateObject(IJoinColumn joinColumn) {
+ super(joinColumn);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public String defaultTableName() {
+ if (getJoinColumn() != null) {
+ return getJoinColumn().getDefaultTable();
+ }
+
+ return typeMapping().getTableName();
+ }
+
+ public IAssociationOverride getAssociationOverride() {
+ return associationOverride;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public Table getNameTable() {
+ return typeMapping().primaryDbTable();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public Table getReferencedNameTable() {
+ IAttributeMapping attributeMapping = null;// TODO: this.associationOverride.getOwner().attributeMapping(this.associationOverride.getName());
+
+ if (attributeMapping == null ||
+ !(attributeMapping instanceof IRelationshipMapping))
+ {
+ return null;
+ }
+
+ IEntity targetEntity = ((IRelationshipMapping) attributeMapping).getResolvedTargetEntity();
+
+ if (targetEntity != null) {
+ return targetEntity.primaryDbTable();
+ }
+
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public Schema getSchema() {
+ return typeMapping().dbSchema();
+ }
+
+ public ITypeMapping typeMapping() {
+ return null; //TODO (ITypeMapping) associationOverride.parent();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInJoinTableDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInJoinTableDialog.java
index 5a8a7479c2..6c15d9c161 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInJoinTableDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInJoinTableDialog.java
@@ -1,45 +1,87 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IJoinTable;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
-//if there is only 1 joinColumn and the user is editing it, they should be
-//able to define defaults. otherwise, we probably shouldn't allow it.
-public class JoinColumnInJoinTableDialog extends AbstractJoinColumnDialog<IJoinColumn> {
+/**
+ * TODO
+ *
+ * @see JoinColumnInJoinTableStateObject
+ * @see AbstractJoinColumnDialogPane
+ *
+ * TODO: If there is only 1 join column and the user is editing it, they should
+ * be able to define defaults. otherwise, we probably shouldn't allow it.
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class JoinColumnInJoinTableDialog extends AbstractJoinColumnDialog<JoinColumnInJoinTableStateObject> {
private IJoinTable joinTable;
-
- JoinColumnInJoinTableDialog(Shell parent, IJoinTable joinTable) {
+
+ /**
+ * Creates a new <code>JoinColumnInJoinTableDialog</code>.
+ *
+ * @param parent The parent shell
+ * @param joinColumn
+ */
+ public JoinColumnInJoinTableDialog(Shell parent, IJoinColumn joinColumn) {
+
+ super(parent, joinColumn);
+ }
+
+ /**
+ * Creates a new <code>JoinColumnInJoinTableDialog</code>.
+ *
+ * @param parent The parent shell
+ * @param joinColumn
+ */
+ public JoinColumnInJoinTableDialog(Shell parent, IJoinTable joinTable) {
+
super(parent);
this.joinTable = joinTable;
}
- JoinColumnInJoinTableDialog(Shell parent, IJoinColumn joinColumn) {
- super(parent, joinColumn);
- this.joinTable = (IJoinTable) joinColumn.eContainer();
- }
- protected IJoinTable getJoinTable() {
- return this.joinTable;
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected JoinColumnInJoinTableStateObject buildStateObject() {
+
+ if (joinTable != null) {
+ return new JoinColumnInJoinTableStateObject(joinTable);
+ }
+
+ return new JoinColumnInJoinTableStateObject(getJoinColumn());
}
-
- protected Table getNameTable() {
- return getJoinTable().dbTable();
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public IJoinColumn getJoinColumn() {
+ return (IJoinColumn) super.getJoinColumn();
}
-
- protected Table getReferencedNameTable() {
- IMultiRelationshipMapping multiRelationshipMapping = (IMultiRelationshipMapping) getJoinTable().eContainer();
- return multiRelationshipMapping.typeMapping().primaryDbTable();
+
+ /*
+ * non-Javadoc)
+ */
+ @Override
+ protected void initializeMainPane(Composite container) {
+ new AbstractJoinColumnDialogPane<JoinColumnInJoinTableStateObject>(
+ getSubjectHolder(),
+ container
+ );
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInJoinTableStateObject.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInJoinTableStateObject.java
new file mode 100644
index 0000000000..27bf69bf41
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInJoinTableStateObject.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IJoinTable;
+import org.eclipse.jpt.core.internal.context.base.IMultiRelationshipMapping;
+import org.eclipse.jpt.db.internal.Table;
+
+/**
+ * @version 2.0
+ * @since 2.0
+ */
+public class JoinColumnInJoinTableStateObject extends AbstractJoinColumnStateObject
+{
+ private IJoinTable joinTable;
+
+ /**
+ * Creates a new <code>JoinColumnInJoinTableStateObject</code>.
+ *
+ * @param joinColumn
+ */
+ public JoinColumnInJoinTableStateObject(IJoinColumn joinColumn) {
+ super(joinColumn);
+ }
+
+ /**
+ * Creates a new <code>JoinColumnInJoinTableStateObject</code>.
+ *
+ * @param joinTable
+ */
+ public JoinColumnInJoinTableStateObject(IJoinTable joinTable) {
+ super();
+ this.joinTable = joinTable;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public IJoinColumn getJoinColumn() {
+ return (IJoinColumn) super.getJoinColumn();
+ }
+
+ public final IJoinTable getJoinTable() {
+ return joinTable;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public Table getNameTable() {
+ if (getJoinColumn() == null) {
+ return null;
+ }
+
+ return joinTable.dbTable();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public Table getReferencedNameTable() {
+ return relationshipMapping().typeMapping().primaryDbTable();
+ }
+
+ public IMultiRelationshipMapping relationshipMapping() {
+ return (IMultiRelationshipMapping) joinTable.parent();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInRelationshipMappingDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInRelationshipMappingDialog.java
index e60a047663..ef4552b48f 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInRelationshipMappingDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInRelationshipMappingDialog.java
@@ -1,56 +1,64 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISingleRelationshipMapping;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.ISingleRelationshipMapping;
import org.eclipse.swt.widgets.Shell;
-public class JoinColumnInRelationshipMappingDialog extends JoinColumnDialog {
+/**
+ * TODO
+ *
+ * @see JoinColumnInRelationshipMappingStateObject
+ * @see JoinColumnDialogPane
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class JoinColumnInRelationshipMappingDialog extends JoinColumnDialog<JoinColumnInRelationshipMappingStateObject> {
- private ISingleRelationshipMapping singleRelationshipMapping;
-
- JoinColumnInRelationshipMappingDialog(Shell parent, ISingleRelationshipMapping singleRelationshipMapping) {
- super(parent);
- this.singleRelationshipMapping = singleRelationshipMapping;
- }
+ private ISingleRelationshipMapping relationshipMapping;
+ /**
+ * Creates a new <code>AbstractJoinColumnDialog</code>.
+ *
+ * @param parent The parent shell
+ * @param joinColumn
+ */
JoinColumnInRelationshipMappingDialog(Shell parent, IJoinColumn joinColumn) {
super(parent, joinColumn);
- this.singleRelationshipMapping = (ISingleRelationshipMapping) joinColumn.eContainer();
- }
-
- protected String defaultTableName() {
- if (getJoinColumn() != null) {
- return getJoinColumn().getDefaultTable();
- }
- return this.singleRelationshipMapping.typeMapping().getTableName();
- }
-
- protected Schema getSchema() {
- return this.singleRelationshipMapping.typeMapping().dbSchema();
}
-
- protected Table getNameTable() {
- Schema schema = this.getSchema();
- return (schema == null) ? null : schema.tableNamed(tableName());
+
+ /**
+ * Creates a new <code>AbstractJoinColumnDialog</code>.
+ *
+ * @param parent The parent shell
+ * @param relationshipMapping
+ */
+ JoinColumnInRelationshipMappingDialog(Shell parent,
+ ISingleRelationshipMapping relationshipMapping) {
+
+ super(parent);
+ this.relationshipMapping = relationshipMapping;
}
-
- protected Table getReferencedNameTable() {
- IEntity targetEntity = this.singleRelationshipMapping.getResolvedTargetEntity();
- if (targetEntity != null) {
- return targetEntity.primaryDbTable();
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected JoinColumnInRelationshipMappingStateObject buildStateObject() {
+
+ if (relationshipMapping != null) {
+ return new JoinColumnInRelationshipMappingStateObject(relationshipMapping);
}
- return null;
+
+ return new JoinColumnInRelationshipMappingStateObject(getJoinColumn());
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInRelationshipMappingStateObject.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInRelationshipMappingStateObject.java
new file mode 100644
index 0000000000..dc8946e06e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnInRelationshipMappingStateObject.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.ISingleRelationshipMapping;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.db.internal.Table;
+
+/**
+ * @version 2.0
+ * @since 2.0
+ */
+public class JoinColumnInRelationshipMappingStateObject extends JoinColumnStateObject
+{
+ private ISingleRelationshipMapping relationshipMapping;
+
+ /**
+ * Creates a new <code>JoinColumnInRelationshipMappingStateObject</code>.
+ *
+ * @param joinColumn
+ */
+ public JoinColumnInRelationshipMappingStateObject(IJoinColumn joinColumn) {
+ super(joinColumn);
+ this.relationshipMapping = (ISingleRelationshipMapping) joinColumn.parent();
+ }
+
+ /**
+ * Creates a new <code>JoinColumnInRelationshipMappingStateObject</code>.
+ */
+ public JoinColumnInRelationshipMappingStateObject(ISingleRelationshipMapping relationshipMapping) {
+ super();
+ this.relationshipMapping = relationshipMapping;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public String defaultTableName() {
+
+ if (getJoinColumn() != null) {
+ return getJoinColumn().getDefaultTable();
+ }
+
+ return relationshipMapping.typeMapping().getTableName();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public Table getNameTable() {
+ Schema schema = getSchema();
+ return (schema == null) ? null : schema.tableNamed(tableName());
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public Table getReferencedNameTable() {
+ IEntity targetEntity = relationshipMapping.getResolvedTargetEntity();
+
+ if (targetEntity != null) {
+ return targetEntity.primaryDbTable();
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns
+ *
+ * @return
+ */
+ public ISingleRelationshipMapping getRelationshipMapping() {
+ return relationshipMapping;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public Schema getSchema() {
+ return relationshipMapping.typeMapping().dbSchema();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnStateObject.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnStateObject.java
new file mode 100644
index 0000000000..6bc67e139b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnStateObject.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.db.internal.Table;
+
+/**
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public abstract class JoinColumnStateObject extends AbstractJoinColumnStateObject
+{
+ private boolean defaultTableSelected;
+ private Boolean insertable;
+ private String selectedTable;
+ private Boolean updatable;
+
+ public static final String INSERTABLE_PROPERTY = "insertable";
+ public static final String UPDATABLE_PROPERTY = "updatable";
+
+ /**
+ * Creates a new <code>JoinColumnStateObject</code>.
+ */
+ public JoinColumnStateObject() {
+ super();
+ }
+
+ /**
+ * Creates a new <code>JoinColumnStateObject</code>.
+ *
+ * @param joinColumn
+ */
+ public JoinColumnStateObject(IJoinColumn joinColumn) {
+ super(joinColumn);
+ }
+
+ public abstract String defaultTableName();
+
+ public Boolean getInsertable() {
+ return insertable;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public IJoinColumn getJoinColumn() {
+ return (IJoinColumn) super.getJoinColumn();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public Table getNameTable() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public Table getReferencedNameTable() {
+ return null;
+ }
+
+ public abstract Schema getSchema();
+
+ public String getSelectedTable() {
+ return selectedTable;
+ }
+
+ public Boolean getUpdatable() {
+ return updatable;
+ }
+
+ public boolean isDefaultTableSelected() {
+ return defaultTableSelected;
+ }
+
+ public void setInsertable(Boolean insertable) {
+ Boolean oldInsertable = this.insertable;
+ this.insertable = insertable;
+ firePropertyChanged(INSERTABLE_PROPERTY, oldInsertable, insertable);
+ }
+
+ public void setUpdatable(Boolean updatable) {
+ Boolean oldUpdatable = this.updatable;
+ this.updatable = updatable;
+ firePropertyChanged(UPDATABLE_PROPERTY, oldUpdatable, updatable);
+ }
+
+ public String specifiedTableName() {
+
+ if (getJoinColumn() != null) {
+ return getJoinColumn().getSpecifiedTable();
+ }
+
+ return null;
+ }
+
+ public String tableName() {
+ return (specifiedTableName() == null) ? defaultTableName() : specifiedTableName();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnsComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnsComposite.java
index 886e200383..c85332a246 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnsComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinColumnsComposite.java
@@ -1,348 +1,238 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IContentProvider;
+import java.util.ListIterator;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.core.internal.mappings.IAbstractColumn;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
+import org.eclipse.jpt.core.internal.IJpaNode;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane;
+import org.eclipse.jpt.ui.internal.widgets.AddRemovePane.AbstractAdapter;
+import org.eclipse.jpt.ui.internal.widgets.AddRemovePane.Adapter;
+import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class JoinColumnsComposite extends BaseJpaComposite
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | AddRemoveListPane | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see JoinTableComposite - A container of this pane
+ * @see OverridesComposite - A container of this pane
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class JoinColumnsComposite<T extends IJpaNode> extends AbstractFormPane<T>
{
-
- private Owner owner;
- private final Adapter joinColumnsOwnerListener;
+ private IJoinColumnsEditor<T> joinColumnsEditor;
- private ListViewer joinColumnsListViewer;
-
- private final Adapter joinColumnListener;
-
- private Group joinColumnsGroup;
- private Button joinColumnsAddButton;
- private Button joinColumnsRemoveButton;
- private Button joinColumnsEditButton;
-
+ /**
+ * Creates a new <code>JoinColumnsComposite</code>.
+ *
+ * @param parentPane The parent controller of this one
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public JoinColumnsComposite(AbstractFormPane<? extends T> parentPane,
+ Composite parent,
+ IJoinColumnsEditor<T> joinColumnsEditor) {
- public JoinColumnsComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory, String groupTitle) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.joinColumnsOwnerListener = buildJoinColumnsOwnerListener();
- this.joinColumnListener = buildJoinColumnListener();
- this.joinColumnsGroup.setText(groupTitle);
+ super(parentPane, parent);
+ this.joinColumnsEditor = joinColumnsEditor;
+ initializeLayout2();
}
-
- private Adapter buildJoinColumnsOwnerListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- joinColumnsOwnerChanged(notification);
- }
- };
+
+ /**
+ * Creates a new <code>JoinColumnsComposite</code>.
+ *
+ * @param parentPane The parent controller of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public JoinColumnsComposite(AbstractFormPane<?> parentPane,
+ PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ IJoinColumnsEditor<T> joinColumnsEditor) {
+
+ super(parentPane, subjectHolder, parent);
+ this.joinColumnsEditor = joinColumnsEditor;
+ initializeLayout2();
}
-
- private Adapter buildJoinColumnListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- joinColumnChanged(notification, joinColumnsListViewer);
- }
- };
+
+ /**
+ * Creates a new <code>JoinColumnsComposite</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public JoinColumnsComposite(PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory,
+ IJoinColumnsEditor<T> joinColumnsEditor) {
+
+ super(subjectHolder, parent, widgetFactory);
+ this.joinColumnsEditor = joinColumnsEditor;
+ initializeLayout2();
}
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- composite.setLayout(layout);
- this.joinColumnsGroup =
- getWidgetFactory().createGroup(
- composite,
- "");
- this.joinColumnsGroup.setLayout(new GridLayout(2, false));
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- this.joinColumnsGroup.setLayoutData(gridData);
-
- this.joinColumnsListViewer = new ListViewer(this.joinColumnsGroup, SWT.BORDER | SWT.MULTI);
- this.joinColumnsListViewer.setContentProvider(buildJoinColumnsListContentProvider());
- this.joinColumnsListViewer.setLabelProvider(buildJoinColumnsListLabelProvider());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.verticalSpan = 3;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.joinColumnsListViewer.getList().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.joinColumnsListViewer.getList(), IJpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS);
-
- this.joinColumnsAddButton = getWidgetFactory().createButton(this.joinColumnsGroup, JptUiMappingsMessages.JoinTableComposite_add, SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- this.joinColumnsAddButton.setLayoutData(gridData);
- this.joinColumnsAddButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- owner.addJoinColumn();
+ private String buildDefaultJoinColumnLabel(IJoinColumn joinColumn) {
+ return NLS.bind(
+ JptUiMappingsMessages.JoinTableComposite_mappingBetweenTwoParamsDefault,
+ joinColumn.getName(),
+ joinColumn.getReferencedColumnName()
+ );
+ }
+
+ private WritablePropertyValueModel<IJoinColumn> buildJoinColumnHolder() {
+ return new SimplePropertyValueModel<IJoinColumn>();
+ }
+
+ private String buildJoinColumnLabel(IJoinColumn joinColumn) {
+
+ if (joinColumn.getSpecifiedName() == null) {
+
+ if (joinColumn.getSpecifiedReferencedColumnName() == null) {
+ return NLS.bind(
+ JptUiMappingsMessages.JoinTableComposite_mappingBetweenTwoParamsBothDefault,
+ joinColumn.getName(),
+ joinColumn.getReferencedColumnName()
+ );
}
- });
-
- this.joinColumnsEditButton = getWidgetFactory().createButton(this.joinColumnsGroup, JptUiMappingsMessages.JoinTableComposite_edit, SWT.NONE);
- this.joinColumnsEditButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
+
+ return NLS.bind(
+ JptUiMappingsMessages.JoinTableComposite_mappingBetweenTwoParamsFirstDefault,
+ joinColumn.getName(),
+ joinColumn.getReferencedColumnName()
+ );
+ }
+
+ if (joinColumn.getSpecifiedReferencedColumnName() == null) {
+ return NLS.bind(
+ JptUiMappingsMessages.JoinTableComposite_mappingBetweenTwoParamsSecDefault,
+ joinColumn.getName(),
+ joinColumn.getReferencedColumnName()
+ );
+ }
+
+ return NLS.bind(
+ JptUiMappingsMessages.JoinTableComposite_mappingBetweenTwoParams,
+ joinColumn.getName(),
+ joinColumn.getReferencedColumnName()
+ );
+ }
+
+ private Adapter buildJoinColumnsAdapter() {
+ return new AbstractAdapter() {
+
+ public void addNewItem(ObjectListSelectionModel listSelectionModel) {
+ joinColumnsEditor.addJoinColumn(subject());
}
-
- public void widgetSelected(SelectionEvent e) {
- editJoinColumn();
+
+ @Override
+ public boolean hasOptionalButton() {
+ return true;
}
- });
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- this.joinColumnsEditButton.setLayoutData(gridData);
- this.joinColumnsRemoveButton = getWidgetFactory().createButton(this.joinColumnsGroup, JptUiMappingsMessages.JoinTableComposite_remove, SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.BEGINNING;
- this.joinColumnsRemoveButton.setLayoutData(gridData);
- this.joinColumnsRemoveButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
+ @Override
+ public String optionalButtonText() {
+ return JptUiMappingsMessages.JoinColumnComposite_edit;
}
-
- public void widgetSelected(SelectionEvent e) {
- removeJoinColumn();
+
+ @Override
+ public void optionOnSelection(ObjectListSelectionModel listSelectionModel) {
+ IJoinColumn joinColumn = (IJoinColumn) listSelectionModel.selectedValue();
+ joinColumnsEditor.editJoinColumn(subject(), joinColumn);
}
- });
-
- this.joinColumnsListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateJoinColumnsEnablement();
+
+ public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) {
+ joinColumnsEditor.removeJoinColumns(subject(), listSelectionModel.selectedIndices());
}
- });
+ };
}
- private IContentProvider buildJoinColumnsListContentProvider() {
- return new IStructuredContentProvider(){
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
-
- }
-
- public Object[] getElements(Object inputElement) {
- return ((Owner) inputElement).getJoinColumns().toArray();
+ private ListValueModel<IJoinColumn> buildJoinColumnsListHolder() {
+ return new ListAspectAdapter<T, IJoinColumn>(getSubjectHolder(), joinColumnsEditor.propertyNames()) {
+ @Override
+ protected ListIterator<IJoinColumn> listIterator_() {
+ return joinColumnsEditor.joinColumns(subject);
}
};
}
-
+
private ILabelProvider buildJoinColumnsListLabelProvider() {
return new LabelProvider() {
+ @Override
public String getText(Object element) {
IJoinColumn joinColumn = (IJoinColumn) element;
- return (JoinColumnsComposite.this.owner.containsSpecifiedJoinColumns()) ?
- buildJoinColumnLabel(joinColumn)
- :
+
+ return joinColumnsEditor.hasSpecifiedJoinColumns(subject()) ?
+ buildJoinColumnLabel(joinColumn) :
buildDefaultJoinColumnLabel(joinColumn);
}
};
}
-
- private String buildDefaultJoinColumnLabel(IJoinColumn joinColumn) {
- return NLS.bind(JptUiMappingsMessages.JoinTableComposite_mappingBetweenTwoParamsDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
-
- private String buildJoinColumnLabel(IJoinColumn joinColumn) {
- if (joinColumn.getSpecifiedName() == null) {
- if (joinColumn.getSpecifiedReferencedColumnName() == null) {
- return NLS.bind(JptUiMappingsMessages.JoinTableComposite_mappingBetweenTwoParamsBothDefault, joinColumn.getName(),joinColumn.getReferencedColumnName());
- }
- return NLS.bind(JptUiMappingsMessages.JoinTableComposite_mappingBetweenTwoParamsFirstDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- else if (joinColumn.getSpecifiedReferencedColumnName() == null) {
- return NLS.bind(JptUiMappingsMessages.JoinTableComposite_mappingBetweenTwoParamsSecDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- else {
- return NLS.bind(JptUiMappingsMessages.JoinTableComposite_mappingBetweenTwoParams, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- }
- void editJoinColumn() {
- this.owner.editJoinColumn(getSelectedJoinColumn());
- }
-
- void removeJoinColumn() {
- ISelection selection = this.joinColumnsListViewer.getSelection();
- if (selection instanceof StructuredSelection) {
- for (Iterator stream = ((StructuredSelection) selection).iterator(); stream.hasNext(); ) {
- this.owner.getJoinColumns().remove(stream.next());
- }
- }
- }
-
- private IJoinColumn getSelectedJoinColumn() {
- return (IJoinColumn) ((StructuredSelection) this.joinColumnsListViewer.getSelection()).getFirstElement();
- }
-
- protected void joinColumnsOwnerChanged(Notification notification) {
- if (notification.getFeatureID(owner.owningFeatureClass()) == owner.specifiedJoinColumnsFeatureId()) {
- if (notification.getEventType() == Notification.ADD) {
- ((IJoinColumn) notification.getNewValue()).eAdapters().add(this.joinColumnListener);
- }
- else if (notification.getEventType() == Notification.REMOVE) {
- ((IJoinColumn) notification.getOldValue()).eAdapters().remove(this.joinColumnListener);
- }
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- joinColumnsListViewer.refresh();
- updateJoinColumnsEnablement();
- }
- });
- }
- }
-
- private void enableGroup(Group group, boolean enabled) {
- group.setEnabled(enabled);
- for (int i = 0; i < group.getChildren().length; i++) {
- group.getChildren()[i].setEnabled(enabled);
- }
- }
- protected void joinColumnChanged(Notification notification, final ListViewer listViewer) {
- if (notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__SPECIFIED_NAME
- || notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME
- || notification.getFeatureID(IAbstractColumn.class) == JpaCoreMappingsPackage.IABSTRACT_COLUMN__SPECIFIED_TABLE
- || notification.getFeatureID(IAbstractColumn.class) == JpaCoreMappingsPackage.IABSTRACT_COLUMN__DEFAULT_TABLE
- || notification.getFeatureID(IAbstractJoinColumn.class) == JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME
- || notification.getFeatureID(IAbstractJoinColumn.class) == JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- listViewer.refresh();
- }
- });
- }
- }
-
- protected void engageListeners() {
- if (this.owner != null) {
- this.owner.getEObject().eAdapters().add(this.joinColumnsOwnerListener);
- for (IJoinColumn joinColumn : this.owner.getJoinColumns()) {
- joinColumn.eAdapters().add(this.joinColumnListener);
- }
- }
- }
-
- protected void disengageListeners() {
- if (this.owner != null) {
- for (IJoinColumn joinColumn : this.owner.getJoinColumns()) {
- joinColumn.eAdapters().remove(this.joinColumnListener);
- }
- this.owner.getEObject().eAdapters().remove(this.joinColumnsOwnerListener);
- }
- }
-
- public void doPopulate(EObject obj) {
- this.owner = (Owner) obj;
- if (this.owner == null) {
- this.joinColumnsListViewer.setInput(null);
- return;
- }
-
- this.joinColumnsListViewer.setInput(this.owner);
-
- updateEnablement();
+ private ListValueModel<IJoinColumn> buildSortedJoinColumnsListHolder() {
+ return new SortedListValueModelAdapter<IJoinColumn>(
+ buildJoinColumnsListHolder()
+ );
}
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void doPopulate() {
+ protected void initializeLayout(Composite container) {
}
- private void updateEnablement() {
- updateJoinColumnsEnablement();
- }
-
- void updateJoinColumnsEnablement() {
- boolean groupEnabledState = this.owner.containsSpecifiedJoinColumns();
- enableGroup(this.joinColumnsGroup, groupEnabledState);
+ private void initializeLayout2() {
- this.joinColumnsRemoveButton.setEnabled(groupEnabledState && !((StructuredSelection) this.joinColumnsListViewer.getSelection()).isEmpty());
- this.joinColumnsEditButton.setEnabled(groupEnabledState && ((StructuredSelection) this.joinColumnsListViewer.getSelection()).size() == 1);
- }
-
- protected void enableWidgets(boolean enabled) {
- enableGroup(this.joinColumnsGroup, enabled);
- this.joinColumnsAddButton.setEnabled(enabled);
- this.joinColumnsEditButton.setEnabled(enabled);
- this.joinColumnsRemoveButton.setEnabled(enabled);
- this.joinColumnsListViewer.getList().setEnabled(enabled);
+ // Join Columns list pane
+ new AddRemoveListPane<T>(
+ this,
+ getControl(),
+ buildJoinColumnsAdapter(),
+ buildSortedJoinColumnsListHolder(),
+ buildJoinColumnHolder(),
+ buildJoinColumnsListLabelProvider(),
+ IJpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS
+ );
}
- public interface Owner {
- int specifiedJoinColumnsFeatureId();
-
- Class owningFeatureClass();
+ public static interface IJoinColumnsEditor<T> {
- EObject getEObject();
-
- boolean containsSpecifiedJoinColumns();
-
- List<IJoinColumn> getJoinColumns();
-
- List<IJoinColumn> getSpecifiedJoinColumns();
-
- IJoinColumn createJoinColumn(int index);
-
- void addJoinColumn();
-
- void editJoinColumn(IJoinColumn joinColumn);
+ void addJoinColumn(T subject);
+ void editJoinColumn(T subject, IJoinColumn joinColumn);
+ boolean hasSpecifiedJoinColumns(T subject);
+ ListIterator<IJoinColumn> joinColumns(T subject);
+ String[] propertyNames();
+ void removeJoinColumns(T subject, int[] selectedIndices);
}
-
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinTableComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinTableComposite.java
index 1f2f436c05..9bbe104cf8 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinTableComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/JoinTableComposite.java
@@ -3,470 +3,457 @@
* 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.ui.internal.mappings.details;
-import java.util.List;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.JpaEObject;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IJoinTable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.ConnectionListener;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.Database;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IJoinTable;
import org.eclipse.jpt.db.internal.Schema;
import org.eclipse.jpt.db.internal.Table;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.JoinColumnsComposite.Owner;
-import org.eclipse.swt.SWT;
+import org.eclipse.jpt.ui.internal.mappings.db.TableCombo;
+import org.eclipse.jpt.ui.internal.mappings.details.JoinColumnsComposite.IJoinColumnsEditor;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.PostExecution;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+import org.eclipse.swt.widgets.Group;
-public class JoinTableComposite extends BaseJpaComposite
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | --------------------------------------------------------------- |
+ * | Name: | |v| |
+ * | --------------------------------------------------------------- |
+ * | |
+ * | x Override Default Join Columns |
+ * | |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | JoinColumnsComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | |
+ * | x Override Default Inverse Join Columns |
+ * | |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | JoinColumnsComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IJoinTable
+ * @see OneToManyMappingComposite - A container of this pane
+ * @see ManyToManyMappingComposite - A container of this pane
+ * @see JoinColumnsComposite
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class JoinTableComposite extends AbstractFormPane<IJoinTable>
{
-
- private IJoinTable joinTable;
- private final Adapter joinTableListener;
+ private Button overrideDefaultInverseJoinColumnsCheckBox;
+ private Button overrideDefaultJoinColumnsCheckBox;
- protected TableCombo tableCombo;
+ /**
+ * Creates a new <code>JoinTableComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ */
+ public JoinTableComposite(AbstractFormPane<?> parentPane,
+ PropertyValueModel<? extends IJoinTable> subjectHolder,
+ Composite parent) {
- private ConnectionProfile connectionProfile;
- private ConnectionListener connectionListener;
-
- private Button overrideDefaultJoinColumnsCheckBox;
- private JoinColumnsComposite joinColumnsComposite;
-
- private Button overrideDefaultInverseJoinColumnsCheckBox;
- private JoinColumnsComposite inverseJoinColumnsComposite;
+ super(parentPane, subjectHolder, parent);
+ }
- public JoinTableComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.joinTableListener = buildJoinTableListener();
- this.connectionListener = buildConnectionListener();
+ /**
+ * Creates a new <code>JoinTableComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IJoinTable</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public JoinTableComposite(PropertyValueModel<? extends IJoinTable> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
}
-
- private Adapter buildJoinTableListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- joinTableChanged(notification);
- }
- };
+
+ private void addInverseJoinColumn(IJoinTable joinTable) {
+
+ InverseJoinColumnDialog dialog = new InverseJoinColumnDialog(shell(), joinTable);
+ dialog.openDialog(buildAddInverseJoinColumnPostExecution());
}
-
- private ConnectionListener buildConnectionListener() {
- return new ConnectionListener() {
- public void aboutToClose(ConnectionProfile profile) {
- // not interested to this event.
- }
+ private void addInverseJoinColumnFromDialog(JoinColumnInJoinTableStateObject stateObject) {
- public void closed(ConnectionProfile profile) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- JoinTableComposite.this.tableCombo.populate();
- }
- });
- }
+ int index = subject().specifiedInverseJoinColumnsSize();
+ IJoinColumn joinColumn = subject().addSpecifiedInverseJoinColumn(index);
+ joinColumn.setSpecifiedName(stateObject.getSelectedName());
+ joinColumn.setSpecifiedReferencedColumnName(stateObject.getSpecifiedReferencedColumnName());
+ }
- public void modified(ConnectionProfile profile) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- JoinTableComposite.this.tableCombo.populate();
- }
- });
- }
+ private void addJoinColumn(IJoinTable joinTable) {
- public boolean okToClose(ConnectionProfile profile) {
- // not interested to this event.
- return true;
- }
+ JoinColumnInJoinTableDialog dialog = new JoinColumnInJoinTableDialog(shell(), joinTable);
+ dialog.openDialog(buildAddJoinColumnPostExecution());
+ }
- public void opened(ConnectionProfile profile) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- JoinTableComposite.this.tableCombo.populate();
- }
- });
+ private void addJoinColumnFromDialog(JoinColumnInJoinTableStateObject stateObject) {
+
+ int index = subject().specifiedJoinColumnsSize();
+ IJoinColumn joinColumn = subject().addSpecifiedJoinColumn(index);
+ joinColumn.setSpecifiedName(stateObject.getSelectedName());
+ joinColumn.setSpecifiedReferencedColumnName(stateObject.getSpecifiedReferencedColumnName());
+ }
+
+ private PostExecution<InverseJoinColumnDialog> buildAddInverseJoinColumnPostExecution() {
+ return new PostExecution<InverseJoinColumnDialog>() {
+ public void execute(InverseJoinColumnDialog dialog) {
+ if (dialog.wasConfirmed()) {
+ addInverseJoinColumnFromDialog(dialog.subject());
+ }
}
+ };
+ }
- public void databaseChanged(ConnectionProfile profile, final Database database) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if(database == JoinTableComposite.this.tableCombo.getDatabase()) {
- if (!getControl().isDisposed()) {
- JoinTableComposite.this.tableCombo.populate();
- }
- }
- }
- });
+ private PostExecution<JoinColumnInJoinTableDialog> buildAddJoinColumnPostExecution() {
+ return new PostExecution<JoinColumnInJoinTableDialog>() {
+ public void execute(JoinColumnInJoinTableDialog dialog) {
+ if (dialog.wasConfirmed()) {
+ addJoinColumnFromDialog(dialog.subject());
+ }
}
-
- public void schemaChanged(ConnectionProfile profile, final Schema schema) {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if(schema == JoinTableComposite.this.tableCombo.getTableSchema()) {
- if (!getControl().isDisposed()) {
- JoinTableComposite.this.tableCombo.populate();
- }
- }
- }
- });
+ };
+ }
+
+ private PostExecution<JoinColumnInJoinTableDialog> buildEditInverseJoinColumnPostExecution() {
+ return new PostExecution<JoinColumnInJoinTableDialog>() {
+ public void execute(JoinColumnInJoinTableDialog dialog) {
+ if (dialog.wasConfirmed()) {
+ editJoinColumn(dialog.subject());
+ }
}
+ };
+ }
- public void tableChanged(ConnectionProfile profile, final Table table) {
- // not interested to this event.
+ private PostExecution<JoinColumnInJoinTableDialog> buildEditJoinColumnPostExecution() {
+ return new PostExecution<JoinColumnInJoinTableDialog>() {
+ public void execute(JoinColumnInJoinTableDialog dialog) {
+ if (dialog.wasConfirmed()) {
+ editJoinColumn(dialog.subject());
+ }
}
};
- }
+ }
- private ConnectionProfile getConnectionProfile() {
- if(this.connectionProfile == null) {
- IJpaProject jpaProject = this.joinTable.getJpaProject();
- this.connectionProfile = jpaProject.connectionProfile();
- }
- return this.connectionProfile;
+ private InverseJoinColumnsProvider buildInverseJoinColumnsEditor() {
+ return new InverseJoinColumnsProvider();
}
-
- private void addConnectionListener() {
- this.getConnectionProfile().addConnectionListener(this.connectionListener);
+
+ private JoinColumnsProvider buildJoinColumnsEditor() {
+ return new JoinColumnsProvider();
}
-
- private void removeConnectionListener() {
- this.getConnectionProfile().removeConnectionListener(this.connectionListener);
+
+ private WritablePropertyValueModel<Boolean> buildOverrideDefaultHolder() {
+ // TODO
+ return new SimplePropertyValueModel<Boolean>();
}
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.JoinTableComposite_name);
-
- this.tableCombo = new TableCombo(composite, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.tableCombo.getCombo().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.tableCombo.getCombo(), IJpaHelpContextIds.MAPPING_JOIN_TABLE_NAME);
-
- this.overrideDefaultJoinColumnsCheckBox =
- getWidgetFactory().createButton(
- composite,
- JptUiMappingsMessages.JoinTableComposite_overrideDefaultJoinColumns,
- SWT.CHECK);
- this.overrideDefaultJoinColumnsCheckBox.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
+
+ private SelectionListener buildOverrideDefaultInverseSelectionListener() {
+ return new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- if (JoinTableComposite.this.overrideDefaultJoinColumnsCheckBox.getSelection()) {
- IJoinColumn defaultJoinColumn = JoinTableComposite.this.joinTable.getDefaultJoinColumns().get(0);
+ Button button = (Button) e.widget;
+ IJoinTable joinTable = subject();
+
+ if (button.getSelection()) {
+ IJoinColumn defaultJoinColumn = joinTable.defaultInverseJoinColumns().next();
String columnName = defaultJoinColumn.getDefaultName();
String referencedColumnName = defaultJoinColumn.getDefaultReferencedColumnName();
- IJoinColumn joinColumn = JoinTableComposite.this.joinTable.createJoinColumn(0);
- JoinTableComposite.this.joinTable.getSpecifiedJoinColumns().add(joinColumn);
+
+ IJoinColumn joinColumn = joinTable.addSpecifiedInverseJoinColumn(0);
joinColumn.setSpecifiedName(columnName);
joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- } else {
- JoinTableComposite.this.joinTable.getSpecifiedJoinColumns().clear();
+ }
+ else {
+ for (int index = joinTable.specifiedInverseJoinColumnsSize(); --index >= 0; ) {
+ joinTable.removeSpecifiedJoinColumn(index);
+ }
}
}
- });
-
- this.joinColumnsComposite = new JoinColumnsComposite(composite, this.commandStack, getWidgetFactory(), JptUiMappingsMessages.JoinTableComposite_joinColumn);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- this.joinColumnsComposite.getControl().setLayoutData(gridData);
-
- this.overrideDefaultInverseJoinColumnsCheckBox = getWidgetFactory().createButton(composite, JptUiMappingsMessages.JoinTableComposite_overrideDefaultInverseJoinColumns, SWT.CHECK);
- this.overrideDefaultInverseJoinColumnsCheckBox.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
+ };
+ }
+
+ private SelectionListener buildOverrideDefaultSelectionListener() {
+ return new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent e) {
- if (JoinTableComposite.this.overrideDefaultInverseJoinColumnsCheckBox.getSelection()) {
- IJoinColumn defaultJoinColumn = JoinTableComposite.this.joinTable.getDefaultInverseJoinColumns().get(0);
+ Button button = (Button) e.widget;
+ IJoinTable joinTable = subject();
+
+ if (button.getSelection()) {
+ IJoinColumn defaultJoinColumn = joinTable.defaultJoinColumns().next();
String columnName = defaultJoinColumn.getDefaultName();
String referencedColumnName = defaultJoinColumn.getDefaultReferencedColumnName();
- IJoinColumn joinColumn = JoinTableComposite.this.joinTable.createInverseJoinColumn(0);
- JoinTableComposite.this.joinTable.getSpecifiedInverseJoinColumns().add(joinColumn);
+
+ IJoinColumn joinColumn = joinTable.addSpecifiedJoinColumn(0);
joinColumn.setSpecifiedName(columnName);
joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- } else {
- JoinTableComposite.this.joinTable.getSpecifiedInverseJoinColumns().clear();
+ }
+ else {
+ for (int index = joinTable.specifiedJoinColumnsSize(); --index >= 0; ) {
+ joinTable.removeSpecifiedJoinColumn(index);
+ }
}
}
- });
- this.inverseJoinColumnsComposite = new JoinColumnsComposite(composite, this.commandStack, getWidgetFactory(), JptUiMappingsMessages.JoinTableComposite_inverseJoinColumn);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- this.inverseJoinColumnsComposite.getControl().setLayoutData(gridData);
- }
-
- void addJoinColumn() {
- JoinColumnInJoinTableDialog dialog = new JoinColumnInJoinTableDialog(this.getControl().getShell(), this.joinTable);
- this.addJoinColumnFromDialog(dialog);
- }
-
- private void addJoinColumnFromDialog(JoinColumnInJoinTableDialog dialog) {
- if (dialog.open() != Window.OK) {
- return;
- }
- int index = this.joinTable.getJoinColumns().size();
- IJoinColumn joinColumn = this.joinTable.createJoinColumn(index);
- this.joinTable.getSpecifiedJoinColumns().add(joinColumn);
- joinColumn.setSpecifiedName(dialog.getSelectedName());
- joinColumn.setSpecifiedReferencedColumnName(dialog.getReferencedColumnName());
+ };
}
-
- void addInverseJoinColumn() {
- InverseJoinColumnDialog dialog = new InverseJoinColumnDialog(this.getControl().getShell(), this.joinTable);
- this.addInverseJoinColumnFromDialog(dialog);
+
+ private Composite buildPane(Composite container, int groupBoxMargin) {
+ return buildSubPane(container, groupBoxMargin, 0, groupBoxMargin, 0, groupBoxMargin);
}
-
- private void addInverseJoinColumnFromDialog(InverseJoinColumnDialog dialog) {
- if (dialog.open() != Window.OK) {
- return;
- }
- int index = this.joinTable.getInverseJoinColumns().size();
- IJoinColumn joinColumn = this.joinTable.createInverseJoinColumn(index);
- this.joinTable.getSpecifiedInverseJoinColumns().add(joinColumn);
- joinColumn.setSpecifiedName(dialog.getSelectedName());
- joinColumn.setSpecifiedReferencedColumnName(dialog.getReferencedColumnName());
+
+
+ private TableCombo<IJoinTable> buildTableCombo(Composite container) {
+
+ return new TableCombo<IJoinTable>(this, container) {
+
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(IJoinTable.DEFAULT_NAME_PROPERTY);
+ propertyNames.add(IJoinTable.SPECIFIED_NAME_PROPERTY);
+ }
+
+ @Override
+ protected String defaultValue() {
+ return subject().getDefaultName();
+ }
+
+ @Override
+ protected void setValue(String value) {
+ subject().setSpecifiedName(value);
+ }
+
+ @Override
+ protected Table table() {
+ return subject().dbTable();
+ }
+
+ private Schema tableSchema() {
+ return database().schemaNamed(subject().getSchema());
+ }
+
+ @Override
+ protected String value() {
+ return subject().getSpecifiedName();
+ }
+
+ @Override
+ protected Iterator<String> values() {
+ Schema schema = tableSchema();
+
+ if (schema != null) {
+ return schema.tableNames();
+ }
+
+ return EmptyIterator.instance();
+ }
+ };
}
- void editJoinColumn(IJoinColumn joinColumn) {
- JoinColumnInJoinTableDialog dialog = new JoinColumnInJoinTableDialog(this.getControl().getShell(), joinColumn);
- editJoinColumnFromDialog(dialog, joinColumn);
+ private void editInverseJoinColumn(IJoinColumn joinColumn) {
+
+ InverseJoinColumnDialog dialog =
+ new InverseJoinColumnDialog(shell(), joinColumn);
+
+ dialog.openDialog(buildEditInverseJoinColumnPostExecution());
}
-
- private void editJoinColumnFromDialog(JoinColumnInJoinTableDialog dialog, IJoinColumn joinColumn) {
- if (dialog.open() == Window.OK) {
- editJoinColumnDialogOkd(dialog, joinColumn);
- }
+
+ private void editJoinColumn(IJoinColumn joinColumn) {
+
+ JoinColumnInJoinTableDialog dialog =
+ new JoinColumnInJoinTableDialog(shell(), joinColumn);
+
+ dialog.openDialog(buildEditJoinColumnPostExecution());
}
-
- private void editJoinColumnDialogOkd(JoinColumnInJoinTableDialog dialog, IJoinColumn joinColumn) {
- String name = dialog.getSelectedName();
- String referencedColumnName = dialog.getReferencedColumnName();
- if (dialog.isDefaultNameSelected()) {
+ private void editJoinColumn(JoinColumnInJoinTableStateObject stateObject) {
+
+ IJoinColumn joinColumn = stateObject.getJoinColumn();
+ String name = stateObject.getSelectedName();
+ String referencedColumnName = stateObject.getSpecifiedReferencedColumnName();
+
+ if (stateObject.isDefaultNameSelected()) {
if (joinColumn.getSpecifiedName() != null) {
joinColumn.setSpecifiedName(null);
}
}
- else if (joinColumn.getSpecifiedName() == null || !joinColumn.getSpecifiedName().equals(name)){
+ else if (joinColumn.getSpecifiedName() == null ||
+ !joinColumn.getSpecifiedName().equals(name)){
+
joinColumn.setSpecifiedName(name);
}
-
- if (dialog.isDefaultReferencedColumnNameSelected()) {
+
+ if (stateObject.isDefaultReferencedColumnNameSelected()) {
if (joinColumn.getSpecifiedReferencedColumnName() != null) {
joinColumn.setSpecifiedReferencedColumnName(null);
}
}
- else if (joinColumn.getSpecifiedReferencedColumnName() == null || !joinColumn.getSpecifiedReferencedColumnName().equals(referencedColumnName)){
- joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- }
- }
-
-
- void editInverseJoinColumn(IJoinColumn joinColumn) {
- InverseJoinColumnDialog dialog = new InverseJoinColumnDialog(getControl().getShell(), joinColumn);
- editJoinColumnFromDialog(dialog, joinColumn);
- }
-
- protected void joinTableChanged(Notification notification) {
- if (notification.getFeatureID(IJoinTable.class) == JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_JOIN_COLUMNS) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- overrideDefaultJoinColumnsCheckBox.setSelection(joinTable.containsSpecifiedJoinColumns());
- }
- });
- }
- else if (notification.getFeatureID(IJoinTable.class) == JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS) {
+ else if (joinColumn.getSpecifiedReferencedColumnName() == null ||
+ !joinColumn.getSpecifiedReferencedColumnName().equals(referencedColumnName)){
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- overrideDefaultInverseJoinColumnsCheckBox.setSelection(joinTable.containsSpecifiedInverseJoinColumns());
- }
- });
- }
- }
-
- protected void engageListeners() {
- if (this.joinTable != null) {
- this.joinTable.eAdapters().add(this.joinTableListener);
- this.addConnectionListener();
- }
- }
-
- protected void disengageListeners() {
- if (this.joinTable != null) {
- this.joinTable.eAdapters().remove(this.joinTableListener);
- this.removeConnectionListener();
- }
- }
-
- public void doPopulate(EObject obj) {
- this.joinTable = (IJoinTable) obj;
- if (this.joinTable == null) {
- this.joinColumnsComposite.populate(null);
- this.inverseJoinColumnsComposite.populate(null);
- this.connectionProfile = null;
- return;
+ joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
}
-
- this.tableCombo.populate(this.joinTable);
- this.joinColumnsComposite.populate(new JoinColumnsOwner(this.joinTable));
- this.inverseJoinColumnsComposite.populate(new InverseJoinColumnsOwner(this.joinTable));
-
- this.overrideDefaultJoinColumnsCheckBox.setSelection(this.joinTable.containsSpecifiedJoinColumns());
- this.overrideDefaultInverseJoinColumnsCheckBox.setSelection(this.joinTable.containsSpecifiedInverseJoinColumns());
}
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void doPopulate() {
- this.tableCombo.populate();
- this.joinColumnsComposite.populate();
- this.inverseJoinColumnsComposite.populate();
- }
-
- @Override
- public void dispose() {
- this.tableCombo.dispose();
- this.joinColumnsComposite.dispose();
- this.inverseJoinColumnsComposite.dispose();
- super.dispose();
+ protected void initializeLayout(Composite container) {
+
+ int groupBoxMargin = groupBoxMargin();
+
+ // Name widgets
+ TableCombo<IJoinTable> tableCombo = buildTableCombo(container);
+
+ buildLabeledComposite(
+ buildPane(container, groupBoxMargin),
+ JptUiMappingsMessages.JoinTableComposite_name,
+ tableCombo.getControl(),
+ IJpaHelpContextIds.MAPPING_JOIN_TABLE_NAME
+ );
+
+ // Override Default Join Columns check box
+ overrideDefaultJoinColumnsCheckBox = buildCheckBox(
+ buildPane(container, groupBoxMargin),
+ JptUiMappingsMessages.JoinTableComposite_overrideDefaultJoinColumns,
+ buildOverrideDefaultHolder()
+ );
+
+ overrideDefaultJoinColumnsCheckBox.addSelectionListener(
+ buildOverrideDefaultSelectionListener()
+ );
+
+ // Join Columns widgets
+ Group joinColumnGroupPane = buildTitledPane(
+ container,
+ JptUiMappingsMessages.JoinTableComposite_joinColumn
+ );
+
+ new JoinColumnsComposite<IJoinTable>(
+ this,
+ joinColumnGroupPane,
+ buildJoinColumnsEditor()
+ );
+
+ // Override Default Inverse Join Columns check box
+ overrideDefaultInverseJoinColumnsCheckBox = buildCheckBox(
+ buildPane(container, groupBoxMargin),
+ JptUiMappingsMessages.JoinTableComposite_overrideDefaultInverseJoinColumns,
+ buildOverrideDefaultHolder()
+ );
+
+ overrideDefaultInverseJoinColumnsCheckBox.addSelectionListener(
+ buildOverrideDefaultInverseSelectionListener()
+ );
+
+ // Inverse Join Columns widgets
+ Group inverseJoinColumnGroupPane = buildTitledPane(
+ container,
+ JptUiMappingsMessages.JoinTableComposite_inverseJoinColumn
+ );
+
+ new JoinColumnsComposite<IJoinTable>(
+ this,
+ inverseJoinColumnGroupPane,
+ buildInverseJoinColumnsEditor()
+ );
}
- private class JoinColumnsOwner extends JpaEObject implements Owner {
-
- private IJoinTable joinTable;
-
- public JoinColumnsOwner(IJoinTable joinTable) {
- super();
- this.joinTable = joinTable;
- }
-
- public void addJoinColumn() {
- JoinTableComposite.this.addJoinColumn();
- }
-
- public boolean containsSpecifiedJoinColumns() {
- return this.joinTable.containsSpecifiedJoinColumns();
- }
-
- public IJoinColumn createJoinColumn(int index) {
- return this.joinTable.createJoinColumn(index);
- }
-
- public List<IJoinColumn> getJoinColumns() {
- return this.joinTable.getJoinColumns();
+ private class InverseJoinColumnsProvider implements IJoinColumnsEditor<IJoinTable> {
+
+ public void addJoinColumn(IJoinTable subject) {
+ JoinTableComposite.this.addInverseJoinColumn(subject);
}
-
- public List<IJoinColumn> getSpecifiedJoinColumns() {
- return this.joinTable.getSpecifiedJoinColumns();
+
+ public void editJoinColumn(IJoinTable subject, IJoinColumn joinColumn) {
+ JoinTableComposite.this.editInverseJoinColumn(joinColumn);
}
-
- public int specifiedJoinColumnsFeatureId() {
- return JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_JOIN_COLUMNS;
+
+ public boolean hasSpecifiedJoinColumns(IJoinTable subject) {
+ return subject.containsSpecifiedInverseJoinColumns();
}
-
- public Class owningFeatureClass() {
- return IJoinTable.class;
+
+ public ListIterator<IJoinColumn> joinColumns(IJoinTable subject) {
+ return subject.inverseJoinColumns();
}
-
- public void editJoinColumn(IJoinColumn joinColumn) {
- JoinTableComposite.this.editJoinColumn(joinColumn);
+
+ public String[] propertyNames() {
+ return new String[] {
+ IJoinTable.DEFAULT_INVERSE_JOIN_COLUMNS_LIST,
+ IJoinTable.SPECIFIED_INVERSE_JOIN_COLUMNS_LIST
+ };
}
-
- public EObject getEObject() {
- return this.joinTable;
+
+ public void removeJoinColumns(IJoinTable subject, int[] selectedIndices) {
+ for (int index = selectedIndices.length; --index >= 0; ) {
+ subject.removeSpecifiedInverseJoinColumn(selectedIndices[index]);
+ }
}
}
-
- private class InverseJoinColumnsOwner extends JpaEObject implements Owner {
-
- private IJoinTable joinTable;
-
- public InverseJoinColumnsOwner(IJoinTable joinTable) {
- super();
- this.joinTable = joinTable;
- }
-
- public void addJoinColumn() {
- JoinTableComposite.this.addInverseJoinColumn();
- }
-
- public boolean containsSpecifiedJoinColumns() {
- return this.joinTable.containsSpecifiedInverseJoinColumns();
- }
-
- public IJoinColumn createJoinColumn(int index) {
- return this.joinTable.createJoinColumn(index);
- }
-
- public List<IJoinColumn> getJoinColumns() {
- return this.joinTable.getInverseJoinColumns();
+
+ private class JoinColumnsProvider implements IJoinColumnsEditor<IJoinTable> {
+
+ public void addJoinColumn(IJoinTable subject) {
+ JoinTableComposite.this.addJoinColumn(subject);
}
-
- public List<IJoinColumn> getSpecifiedJoinColumns() {
- return this.joinTable.getSpecifiedInverseJoinColumns();
+
+ public void editJoinColumn(IJoinTable subject, IJoinColumn joinColumn) {
+ JoinTableComposite.this.editJoinColumn(joinColumn);
}
-
- public int specifiedJoinColumnsFeatureId() {
- return JpaCoreMappingsPackage.IJOIN_TABLE__SPECIFIED_INVERSE_JOIN_COLUMNS;
+
+ public boolean hasSpecifiedJoinColumns(IJoinTable subject) {
+ return subject.containsSpecifiedJoinColumns();
}
-
- public Class owningFeatureClass() {
- return IJoinTable.class;
+
+ public ListIterator<IJoinColumn> joinColumns(IJoinTable subject) {
+ return subject.joinColumns();
}
-
- public void editJoinColumn(IJoinColumn joinColumn) {
- JoinTableComposite.this.editInverseJoinColumn(joinColumn);
+
+ public String[] propertyNames() {
+ return new String[] {
+ IJoinTable.DEFAULT_JOIN_COLUMNS_LIST,
+ IJoinTable.SPECIFIED_JOIN_COLUMNS_LIST
+ };
}
-
- public EObject getEObject() {
- return this.joinTable;
+
+ public void removeJoinColumns(IJoinTable subject, int[] selectedIndices) {
+ for (int index = selectedIndices.length; --index >= 0; ) {
+ subject.removeSpecifiedJoinColumn(selectedIndices[index]);
+ }
}
}
-
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/LobCheckBox.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/LobCheckBox.java
deleted file mode 100644
index ab6f383ac9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/LobCheckBox.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class LobCheckBox extends BaseJpaController
-{
- private IBasic basicMapping;
- private Adapter basicMappingListener;
-
- private Button button;
-
-
- public LobCheckBox(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildBasicMappingListener();
- }
-
- private void buildBasicMappingListener() {
- this.basicMappingListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- basicMappingChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- this.button = getWidgetFactory().createButton(
- parent,
- JptUiMappingsMessages.BasicGeneralSection_lobLabel,
- SWT.CHECK);
-
- this.button.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- LobCheckBox.this.lobSelectionChanged();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- LobCheckBox.this.lobSelectionChanged();
- }
- });
- }
-
- void lobSelectionChanged() {
- boolean lob = this.button.getSelection();
- if (this.basicMapping.isLob() != lob) {
- this.basicMapping.setLob(lob);
- }
- }
-
- private void basicMappingChanged(Notification notification) {
- // ui thread
- if (notification.getFeatureID(IBasic.class) ==
- JpaCoreMappingsPackage.IBASIC__LOB) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.basicMapping != null) {
- this.basicMapping.eAdapters().add(this.basicMappingListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.basicMapping != null) {
- this.basicMapping.eAdapters().remove(this.basicMappingListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.basicMapping = (IBasic) obj;
- populateButton();
- }
-
- @Override
- protected void doPopulate() {
- populateButton();
- }
-
- private void populateButton() {
- boolean lob = false;
- if (this.basicMapping != null) {
- lob = this.basicMapping.isLob();
- }
-
- if (this.button.getSelection() != lob) {
- this.button.setSelection(lob);
- }
- }
-
-
- @Override
- public Control getControl() {
- return this.button;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/LobComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/LobComposite.java
new file mode 100644
index 0000000000..ef7f13a811
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/LobComposite.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This composite simply shows the Lob check box.
+ *
+ * @see IBasicMapping
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class LobComposite extends AbstractFormPane<IBasicMapping>
+{
+ /**
+ * Creates a new <code>LobComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public LobComposite(AbstractFormPane<? extends IBasicMapping> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ /**
+ * Creates a new <code>LobComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IBasicMapping</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public LobComposite(PropertyValueModel<? extends IBasicMapping> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ private PropertyAspectAdapter<IBasicMapping, Boolean> buildLobHolder() {
+
+ return new PropertyAspectAdapter<IBasicMapping, Boolean>(getSubjectHolder(), IBasicMapping.LOB_PROPERTY) {
+
+ @Override
+ protected Boolean buildValue_() {
+ return subject.isLob();
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ subject.setLob(value);
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ buildCheckBox(
+ container,
+ JptUiMappingsMessages.BasicGeneralSection_lobLabel,
+ buildLobHolder(),
+ IJpaHelpContextIds.MAPPING_LOB
+ );
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyComposite.java
deleted file mode 100644
index eafd64e845..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyComposite.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IManyToMany;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class ManyToManyComposite extends BaseJpaComposite
-{
- private IManyToMany manyToMany;
-
- private TargetEntityChooser targetEntityChooser;
-
- private EnumComboViewer fetchTypeComboViewer;
-
- private MappedByCombo mappedByCombo;
-
- private CascadeComposite cascadeComposite;
-
- private OrderingComposite orderingComposite;
-
- private JoinTableComposite joinTableComposite;
-
-
- public ManyToManyComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- Control generalControl = buildGeneralComposite(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generalControl.setLayoutData(gridData);
-
- Control joinTableControl = buildJoinTableControl(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- joinTableControl.setLayoutData(gridData);
- }
-
- private Control buildGeneralComposite(Composite composite) {
-// IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- Composite generalComposite = getWidgetFactory().createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- generalComposite.setLayout(layout);
-
- this.targetEntityChooser = CommonWidgets.buildTargetEntityChooser(generalComposite, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.targetEntityChooser.getControl().setLayoutData(gridData);
-
-
- CommonWidgets.buildFetchLabel(generalComposite, getWidgetFactory());
- this.fetchTypeComboViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.fetchTypeComboViewer.getControl().setLayoutData(gridData);
-
-
- CommonWidgets.buildMappedByLabel(generalComposite, getWidgetFactory());
- this.mappedByCombo = new MappedByCombo(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.mappedByCombo.getControl().setLayoutData(gridData);
-
- this.cascadeComposite = new CascadeComposite(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalSpan = 3;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.cascadeComposite.getControl().setLayoutData(gridData);
-
-
- this.orderingComposite = new OrderingComposite(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalSpan = 3;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.orderingComposite.getControl().setLayoutData(gridData);
-
- return generalComposite;
- }
-
- private Control buildJoinTableControl(Composite composite) {
- Section section = getWidgetFactory().createSection(composite, SWT.FLAT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
- section.setText(JptUiMappingsMessages.MultiRelationshipMappingComposite_joinTable);
-
- Composite joinTableClient = getWidgetFactory().createComposite(section);
- section.setClient(joinTableClient);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- joinTableClient.setLayout(layout);
-
- this.joinTableComposite = new JoinTableComposite(joinTableClient, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.joinTableComposite.getControl().setLayoutData(gridData);
-
- return section;
- }
-
- public void doPopulate(EObject obj) {
- this.manyToMany = (IManyToMany) obj;
- this.targetEntityChooser.populate(this.manyToMany);
- this.fetchTypeComboViewer.populate(CommonWidgets.buildMultiRelationshipMappingFetchEnumHolder(this.manyToMany));
- this.mappedByCombo.populate(this.manyToMany);
- this.cascadeComposite.populate(this.manyToMany);
- if (this.manyToMany != null) {
- this.joinTableComposite.populate(this.manyToMany.getJoinTable());
- this.orderingComposite.populate(this.manyToMany);
- }
- else {
- this.joinTableComposite.populate(null);
- this.orderingComposite.populate(null);
- }
- }
-
- public void doPopulate() {
- this.targetEntityChooser.populate();
- this.fetchTypeComboViewer.populate();
- this.mappedByCombo.populate();
- this.cascadeComposite.populate();
- this.joinTableComposite.populate();
- this.orderingComposite.populate();
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
- @Override
- public void dispose() {
- this.targetEntityChooser.dispose();
- this.fetchTypeComboViewer.dispose();
- this.mappedByCombo.dispose();
- this.cascadeComposite.dispose();
- this.joinTableComposite.dispose();
- this.orderingComposite.dispose();
- super.dispose();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyMappingComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyMappingComposite.java
new file mode 100644
index 0000000000..7078d6e0ac
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToManyMappingComposite.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.ICascade;
+import org.eclipse.jpt.core.internal.context.base.IJoinTable;
+import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping;
+import org.eclipse.jpt.ui.internal.details.IJpaComposite;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | TargetEntityComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | FetchTypeComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | CascadeComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | OrderingComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | |
+ * | - Join Table ------------------------------------------------------------ |
+ * | | | |
+ * | | JoinTableComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IManyToManyMapping
+ * @see BaseJpaUiFactory - The factory creating this pane
+ * @see CascadeComposite
+ * @see FetchTypeComposite
+ * @see JoinTableComposite
+ * @see OrderingComposite
+ * @see TargetEntityComposite
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class ManyToManyMappingComposite extends AbstractFormPane<IManyToManyMapping>
+ implements IJpaComposite<IManyToManyMapping>
+{
+ /**
+ * Creates a new <code>ManyToManyMappingComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IManyToManyMapping</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public ManyToManyMappingComposite(PropertyValueModel<? extends IManyToManyMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ private PropertyValueModel<ICascade> buildCascadeHolder() {
+ return new TransformationPropertyValueModel<IManyToManyMapping, ICascade>(getSubjectHolder()) {
+ @Override
+ protected ICascade transform_(IManyToManyMapping value) {
+ return value.getCascade();
+ }
+ };
+ }
+
+ private PropertyValueModel<IJoinTable> buildJointTableHolder() {
+ return new TransformationPropertyValueModel<IManyToManyMapping, IJoinTable>(getSubjectHolder()) {
+ @Override
+ protected IJoinTable transform_(IManyToManyMapping value) {
+ return value.getJoinTable();
+ }
+ };
+ }
+
+ private Composite buildPane(Composite container, int groupBoxMargin) {
+ return buildSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
+ }
+
+ private void initializeGeneralPane(Composite container) {
+
+ int groupBoxMargin = groupBoxMargin();
+
+ // Target Entity widgets
+ new TargetEntityComposite(this, buildPane(container, groupBoxMargin));
+
+ // Fetch Type widgets
+ new FetchTypeComposite(this, buildPane(container, groupBoxMargin));
+
+ // Mapped By widgets
+ new MappedByComposite(this, buildPane(container, groupBoxMargin));
+
+ // Cascade widgets
+ new CascadeComposite(this, buildCascadeHolder(), container);
+
+ // Ordering widgets
+ new OrderingComposite(this, container);
+ }
+
+ private void initializeJoinTablePane(Composite container) {
+
+ container = buildSection(
+ container,
+ JptUiMappingsMessages.MultiRelationshipMappingComposite_joinTable
+ );
+
+ new JoinTableComposite(
+ this,
+ buildJointTableHolder(),
+ container
+ );
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ // General sub pane
+ initializeGeneralPane(container);
+
+ // Join Table sub pane
+ initializeJoinTablePane(container);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToOneComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToOneComposite.java
deleted file mode 100644
index 9fb170b369..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToOneComposite.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IManyToOne;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class ManyToOneComposite extends BaseJpaComposite
-{
- private IManyToOne manyToOne;
-
- private TargetEntityChooser targetEntityChooser;
-
- private EnumComboViewer fetchTypeComboViewer;
-
- private EnumComboViewer optionalComboViewer;
-
- private CascadeComposite cascadeComposite;
-
- private JoinColumnComposite joinColumnComposite;
-
- public ManyToOneComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- Control generalControl = buildGeneralComposite(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generalControl.setLayoutData(gridData);
-
- }
-
- private Control buildGeneralComposite(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- Composite generalComposite = getWidgetFactory().createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- generalComposite.setLayout(layout);
-
- this.targetEntityChooser = CommonWidgets.buildTargetEntityChooser(generalComposite, commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.targetEntityChooser.getControl().setLayoutData(gridData);
- helpSystem.setHelp(targetEntityChooser.getControl(), IJpaHelpContextIds.MAPPING_TARGET_ENTITY);
-
- CommonWidgets.buildFetchLabel(generalComposite, getWidgetFactory());
- this.fetchTypeComboViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.fetchTypeComboViewer.getControl().setLayoutData(gridData);
- helpSystem.setHelp(fetchTypeComboViewer.getControl(), IJpaHelpContextIds.MAPPING_FETCH_TYPE);
-
- CommonWidgets.buildOptionalLabel(generalComposite, getWidgetFactory());
- this.optionalComboViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.optionalComboViewer.getControl().setLayoutData(gridData);
-
- this.cascadeComposite = new CascadeComposite(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalSpan = 3;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.cascadeComposite.getControl().setLayoutData(gridData);
-
- this.joinColumnComposite = new JoinColumnComposite(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- this.joinColumnComposite.getControl().setLayoutData(gridData);
-
- return generalComposite;
- }
-
- public void doPopulate(EObject obj) {
- this.manyToOne = (IManyToOne) obj;
- this.targetEntityChooser.populate(this.manyToOne);
- this.fetchTypeComboViewer.populate(CommonWidgets.buildSingleRelationshipMappingFetchEnumHolder(this.manyToOne));
- this.optionalComboViewer.populate(CommonWidgets.buildOptionalHolder(this.manyToOne));
- this.cascadeComposite.populate(this.manyToOne);
- this.joinColumnComposite.populate(this.manyToOne);
- }
-
- public void doPopulate() {
- this.targetEntityChooser.populate();
- this.fetchTypeComboViewer.populate();
- this.optionalComboViewer.populate();
- this.cascadeComposite.populate();
- this.joinColumnComposite.populate();
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
- @Override
- public void dispose() {
- this.targetEntityChooser.dispose();
- this.fetchTypeComboViewer.dispose();
- this.optionalComboViewer.dispose();
- this.cascadeComposite.dispose();
- this.joinColumnComposite.dispose();
- super.dispose();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToOneMappingComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToOneMappingComposite.java
new file mode 100644
index 0000000000..8fa41e1ad3
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/ManyToOneMappingComposite.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.ICascade;
+import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping;
+import org.eclipse.jpt.ui.internal.details.IJpaComposite;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | TargetEntityComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | FetchTypeComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | OptionalComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | CascadeComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | JoinColumnComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IManyToOneMapping
+ * @see BaseJpaUiFactory - The factory creating this pane
+ * @see CascadeComposite
+ * @see FetchTypeComposite
+ * @see JoinColumnComposite
+ * @see OptionalComposite
+ * @see TargetEntityComposite
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class ManyToOneMappingComposite extends AbstractFormPane<IManyToOneMapping>
+ implements IJpaComposite<IManyToOneMapping>
+{
+ /**
+ * Creates a new <code>ManyToOneMappingComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IManyToOneMapping</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public ManyToOneMappingComposite(PropertyValueModel<? extends IManyToOneMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ private PropertyValueModel<ICascade> buildCascadeHolder() {
+ return new TransformationPropertyValueModel<IManyToOneMapping, ICascade>(getSubjectHolder()) {
+ @Override
+ protected ICascade transform_(IManyToOneMapping value) {
+ return value.getCascade();
+ }
+ };
+ }
+
+ private Composite buildPane(Composite container, int groupBoxMargin) {
+ return buildSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ int groupBoxMargin = groupBoxMargin();
+
+ // Target Entity widgets
+ new TargetEntityComposite(this, buildPane(container, groupBoxMargin));
+
+ // Fetch Type widgets
+ new FetchTypeComposite(this, buildPane(container, groupBoxMargin));
+
+ // Optional check box
+ new OptionalComposite(this, buildPane(container, groupBoxMargin));
+
+ // Cascade widgets
+ new CascadeComposite(this, buildCascadeHolder(), container);
+
+ // Join Column widgets
+ new JoinColumnComposite(this, container);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedByCombo.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedByCombo.java
deleted file mode 100644
index 593988c654..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedByCombo.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.INonOwningMapping;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class MappedByCombo extends BaseJpaController
-{
- private INonOwningMapping nonOwningMapping;
- private Adapter nonOwningMappingListener;
-
- private CCombo combo;
-
- public MappedByCombo(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, commandStack, widgetFactory);
- this.nonOwningMappingListener = buildListener();
- }
-
- private Adapter buildListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- nonOwningMappingChanged(notification);
- }
- };
- }
- @Override
- protected void buildWidget(Composite parent) {
- this.combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(combo,IJpaHelpContextIds.MAPPING_MAPPED_BY);
- this.combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String mappedBy = ((CCombo) e.getSource()).getText();
- if (mappedBy.equals("")) { //$NON-NLS-1$
- mappedBy = null;
- if (getNonOwningMapping().getMappedBy() == null || getNonOwningMapping().getMappedBy().equals("")) { //$NON-NLS-1$
- return;
- }
- }
- if (getNonOwningMapping().getMappedBy() == null || !getNonOwningMapping().getMappedBy().equals(mappedBy)) {
- getNonOwningMapping().setMappedBy(mappedBy);
- }
- }
- });
- }
-
- private INonOwningMapping getNonOwningMapping() {
- return this.nonOwningMapping;
- }
-
- @Override
- protected void doPopulate(EObject obj) {
- this.nonOwningMapping = (INonOwningMapping) obj;
-
- if (this.nonOwningMapping == null) {
- return;
- }
-
- populateCombo();
- }
-
- private void populateCombo() {
- populateChoices();
- populateMappedByText();
- }
-
- private void populateChoices() {
- if (this.combo.getItemCount() > 0) {
- this.combo.removeAll();
- }
- for (Iterator<String> i = this.nonOwningMapping.candidateMappedByAttributeNames(); i.hasNext(); ) {
- this.combo.add(i.next());
- }
- }
-
- private void populateMappedByText() {
- String mappedBy = this.nonOwningMapping.getMappedBy();
- if (mappedBy != null) {
- if (!this.combo.getText().equals(mappedBy)) {
- this.combo.setText(mappedBy);
- }
- }
- else {
- this.combo.setText("");
- }
- }
-
- @Override
- protected void doPopulate() {
- }
-
- @Override
- protected void engageListeners() {
- if (this.nonOwningMapping != null) {
- this.nonOwningMapping.eAdapters().add(this.nonOwningMappingListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.nonOwningMapping != null) {
- this.nonOwningMapping.eAdapters().remove(this.nonOwningMappingListener);
- }
- }
-
- protected void nonOwningMappingChanged(Notification notification) {
- if (notification.getFeatureID(INonOwningMapping.class) == JpaCoreMappingsPackage.INON_OWNING_MAPPING__MAPPED_BY) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateMappedByText();
- }
- });
- }
- else if (notification.getFeatureID(IRelationshipMapping.class) == JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__RESOLVED_TARGET_ENTITY) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateChoices();
- }
- });
- }
- }
-
- @Override
- public Control getControl() {
- return this.combo;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedByComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedByComposite.java
new file mode 100644
index 0000000000..55dd58b0c6
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedByComposite.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
+
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.jpt.core.internal.context.base.INonOwningMapping;
+import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | -------------------------------------------------------------- |
+ * | Mapped By: | |v| |
+ * | -------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see INonOwningMapping
+ * @see ManyToManyMappingComposite - A container of this pane
+ * @see OneToManyMappingComposite - A container of this pane
+ * @see OneToOneMappingComposite - A container of this pane
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+@SuppressWarnings("nls")
+public class MappedByComposite extends AbstractFormPane<INonOwningMapping>
+{
+ private CCombo combo;
+
+ /**
+ * Creates a new <code>MappedByComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ protected MappedByComposite(AbstractFormPane<? extends INonOwningMapping> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ /**
+ * Creates a new <code>MappedByComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>INonOwningMapping</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public MappedByComposite(PropertyValueModel<? extends INonOwningMapping> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(INonOwningMapping.MAPPED_BY_PROPERTY);
+ }
+
+ private ModifyListener buildComboModifyListener() {
+ return new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ if (isPopulating()) {
+ return;
+ }
+
+ String mappedBy = ((CCombo) e.getSource()).getText();
+ String currentMappedBy = subject().getMappedBy();
+
+ if (StringTools.stringIsEmpty(mappedBy)) {
+ mappedBy = null;
+
+ if (StringTools.stringIsEmpty(currentMappedBy)) {
+ return;
+ }
+ }
+
+ if (currentMappedBy == null || !currentMappedBy.equals(mappedBy)) {
+ subject().setMappedBy(mappedBy);
+ }
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void doPopulate() {
+ super.doPopulate();
+ populateChoices();
+ populateMappedByText();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ combo = buildCombo(container);
+ combo.addModifyListener(buildComboModifyListener());
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.NonOwningMapping_mappedByLabel,
+ combo.getParent(),
+ IJpaHelpContextIds.MAPPING_MAPPED_BY
+ );
+ }
+
+ private void populateChoices() {
+ combo.removeAll();
+
+ if (subject() != null) {
+ for (Iterator<String> iter = subject().candidateMappedByAttributeNames(); iter.hasNext(); ) {
+ combo.add(iter.next());
+ }
+ }
+ }
+
+ private void populateMappedByText() {
+ if (subject() == null) {
+ return;
+ }
+
+ if (subject() != null) {
+ String mappedBy = subject().getMappedBy();
+
+ if (mappedBy != null) {
+ if (!combo.getText().equals(mappedBy)) {
+ combo.setText(mappedBy);
+ }
+ }
+ else {
+ combo.setText("");
+ }
+ }
+ else {
+ combo.setText("");
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void propertyChanged(String propertyName) {
+ super.propertyChanged(propertyName);
+
+ if (propertyName == INonOwningMapping.MAPPED_BY_PROPERTY) {
+ populateMappedByText();
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedSuperclassComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedSuperclassComposite.java
index 4f9f7186a8..24ec4f562e 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedSuperclassComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/MappedSuperclassComposite.java
@@ -1,57 +1,45 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2005, 2008 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.ui.internal.mappings.details;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.jpt.core.internal.context.base.IMappedSuperclass;
+import org.eclipse.jpt.ui.internal.details.IJpaComposite;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class MappedSuperclassComposite extends BaseJpaComposite
+/**
+ * @see IMappedSuperclass
+ * @see BaseJpaUiFactory - The factory creating this pane
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class MappedSuperclassComposite extends AbstractFormPane<IMappedSuperclass>
+ implements IJpaComposite<IMappedSuperclass>
{
-// private IMappedSuperclass mappedSuperclass;
-// private Adapter mappedSuperclassListener;
-
- public MappedSuperclassComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
-// this.mappedSuperclassListener = buildMappedSuperclassListener();
- }
-//
-// private Adapter buildMappedSuperclassListener() {
-// return new AdapterImpl() {
-// @Override
-// public void notifyChanged(Notification notification) {
-// mappedSuperclassChanged(notification);
-// }
-// };
-// }
-
- @Override
- protected void initializeLayout(Composite composite) {
- composite.setLayout(new FillLayout(SWT.VERTICAL));
-
-// Label accessTypeLabel = new Label(composite, SWT.LEFT);
-// accessTypeLabel.setText(DaliUiMessages.MappedSuperclassComposite_accessType);
-// this.accessTypeComboViewer = buildAccessTypeCombo(composite);
-// //eventually this will be enabled if editing xml instead of java
-// this.accessTypeComboViewer.getCombo().setEnabled(false);
-// GridData gridData = new GridData();
-// gridData.horizontalAlignment = GridData.FILL;
-// gridData.grabExcessHorizontalSpace = true;
-// this.accessTypeComboViewer.getCombo().setLayoutData(gridData);
-// PlatformUI.getWorkbench().getHelpSystem().setHelp(this.accessTypeComboViewer.getCombo(), IDaliHelpContextIds.ENTITY_ACCESS_TYPE);
-
+ /**
+ * Creates a new <code>MappedSuperclassComposite</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public MappedSuperclassComposite(PropertyValueModel<? extends IMappedSuperclass> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
}
-
+
+
// private ComboViewer buildAccessTypeCombo(Composite parent) {
// ComboViewer viewer = new ComboViewer(parent, SWT.READ_ONLY);
// viewer.add(AccessType.VALUES.toArray());
@@ -68,47 +56,21 @@ public class MappedSuperclassComposite extends BaseJpaComposite
// });
// return viewer;
// }
-
- @Override
- protected void doPopulate(EObject model) {
-// this.mappedSuperclass = (IMappedSuperclass) model;
- }
-
+
+
@Override
- protected void doPopulate() {
-
- }
-
-
- protected void engageListeners() {
-// this.persistentTypeItemProvider.addListener(getPersistentTypeListener());
-// this.persistentType.eAdapters().add(this.persistentTypeItemProvider);
- }
+ protected void initializeLayout(Composite composite) {
+
+// Label accessTypeLabel = new Label(composite, SWT.LEFT);
+// accessTypeLabel.setText(DaliUiMessages.MappedSuperclassComposite_accessType);
+// this.accessTypeComboViewer = buildAccessTypeCombo(composite);
+// //eventually this will be enabled if editing xml instead of java
+// this.accessTypeComboViewer.getCombo().setEnabled(false);
+// GridData gridData = new GridData();
+// gridData.horizontalAlignment = GridData.FILL;
+// gridData.grabExcessHorizontalSpace = true;
+// this.accessTypeComboViewer.getCombo().setLayoutData(gridData);
+// PlatformUI.getWorkbench().getHelpSystem().setHelp(this.accessTypeComboViewer.getCombo(), IDaliHelpContextIds.ENTITY_ACCESS_TYPE);
- protected void disengageListeners() {
-// if (this.persistentType != null){
-// this.persistentType.eAdapters().remove(this.persistentTypeItemProvider);
-// this.persistentTypeItemProvider.removeListener(getPersistentTypeListener());
-// }
}
-
-// private INotifyChangedListener getPersistentTypeListener() {
-// if (this.persistentTypeListener == null) {
-// this.persistentTypeListener = new INotifyChangedListener() {
-// public void notifyChanged(Notification notification) {
-// if (notification.getFeatureID(PersistentType.class) == OrmPackage.PERSISTENT_TYPE__ACCESS_TYPE) {
-// final AccessType accessType = (AccessType) notification.getNewValue();
-// Display.getDefault().syncExec(new Runnable() {
-// public void run() {
-// if (((StructuredSelection) accessTypeComboViewer.getSelection()).getFirstElement() != accessType) {
-// accessTypeComboViewer.setSelection(new StructuredSelection(accessType));
-// }
-// }
-// });
-// }
-// }
-// };
-// }
-// return this.persistentTypeListener;
-// }
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToManyComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToManyComposite.java
deleted file mode 100644
index d7193b6db2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToManyComposite.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IOneToMany;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class OneToManyComposite extends BaseJpaComposite
-{
- private IOneToMany oneToMany;
-
- private EnumComboViewer fetchTypeComboViewer;
-
- private TargetEntityChooser targetEntityChooser;
-
- private MappedByCombo mappedByCombo;
-
- private CascadeComposite cascadeComposite;
-
- private OrderingComposite orderingComposite;
-
- private JoinTableComposite joinTableComposite;
-
- public OneToManyComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- Control generalControl = buildGeneralControl(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generalControl.setLayoutData(gridData);
-
- Control joinTableControl = buildJoinTableControl(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- joinTableControl.setLayoutData(gridData);
- }
-
- private Control buildGeneralControl(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- Composite generalComposite = getWidgetFactory().createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- generalComposite.setLayout(layout);
-
- GridData gridData;
-
- this.targetEntityChooser = CommonWidgets.buildTargetEntityChooser(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.targetEntityChooser.getControl().setLayoutData(gridData);
-
- CommonWidgets.buildFetchLabel(generalComposite, getWidgetFactory());
- this.fetchTypeComboViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.fetchTypeComboViewer.getControl().setLayoutData(gridData);
- helpSystem.setHelp(this.fetchTypeComboViewer.getControl(), IJpaHelpContextIds.MAPPING_FETCH_TYPE);
-
- CommonWidgets.buildMappedByLabel(generalComposite, getWidgetFactory());
- this.mappedByCombo = new MappedByCombo(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.mappedByCombo.getControl().setLayoutData(gridData);
- helpSystem.setHelp(this.mappedByCombo.getControl(), IJpaHelpContextIds.MAPPING_MAPPED_BY);
-
- this.cascadeComposite = new CascadeComposite(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalSpan = 3;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.cascadeComposite.getControl().setLayoutData(gridData);
-
- this.orderingComposite = new OrderingComposite(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalSpan = 3;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.orderingComposite.getControl().setLayoutData(gridData);
-
-
- return generalComposite;
- }
-
- private Control buildJoinTableControl(Composite composite) {
- Section section = getWidgetFactory().createSection(composite, SWT.FLAT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
- section.setText(JptUiMappingsMessages.MultiRelationshipMappingComposite_joinTable);
-
- Composite joinTableClient = getWidgetFactory().createComposite(section);
- section.setClient(joinTableClient);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- joinTableClient.setLayout(layout);
-
- this.joinTableComposite = new JoinTableComposite(joinTableClient, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.joinTableComposite.getControl().setLayoutData(gridData);
-
- return section;
- }
-
- public void doPopulate(EObject obj) {
- this.oneToMany = (IOneToMany) obj;
- this.fetchTypeComboViewer.populate(CommonWidgets.buildMultiRelationshipMappingFetchEnumHolder(this.oneToMany));
- this.targetEntityChooser.populate(this.oneToMany);
- this.mappedByCombo.populate(this.oneToMany);
- this.cascadeComposite.populate(this.oneToMany);
- if (this.oneToMany != null) {
- this.joinTableComposite.populate(this.oneToMany.getJoinTable());
- this.orderingComposite.populate(this.oneToMany);
- }
- else {
- this.joinTableComposite.populate(null);
- this.orderingComposite.populate(null);
- }
- }
-
- public void doPopulate() {
- this.fetchTypeComboViewer.populate();
- this.targetEntityChooser.populate();
- this.mappedByCombo.populate();
- this.cascadeComposite.populate();
- this.joinTableComposite.populate();
- this.orderingComposite.populate();
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
- @Override
- public void dispose() {
- this.fetchTypeComboViewer.dispose();
- this.targetEntityChooser.dispose();
- this.mappedByCombo.dispose();
- this.cascadeComposite.dispose();
- this.joinTableComposite.dispose();
- this.orderingComposite.dispose();
- super.dispose();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToManyMappingComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToManyMappingComposite.java
new file mode 100644
index 0000000000..fa4b69fcb1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToManyMappingComposite.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.ICascade;
+import org.eclipse.jpt.core.internal.context.base.IJoinTable;
+import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping;
+import org.eclipse.jpt.ui.internal.details.IJpaComposite;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | TargetEntityComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | FetchTypeComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | CascadeComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | OrderingComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | |
+ * | - Join Table ------------------------------------------------------------ |
+ * | | | |
+ * | | JoinTableComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IOneToManyMapping
+ * @see BaseJpaUiFactory - The factory creating this pane
+ * @see CascadeComposite
+ * @see FetchTypeComposite
+ * @see JoinTableComposite
+ * @see OrderingComposite
+ * @see TargetEntityComposite
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class OneToManyMappingComposite extends AbstractFormPane<IOneToManyMapping>
+ implements IJpaComposite<IOneToManyMapping>
+{
+ /**
+ * Creates a new <code>OneToManyMappingComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IOneToManyMapping</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public OneToManyMappingComposite(PropertyValueModel<? extends IOneToManyMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ private PropertyValueModel<ICascade> buildCascadeHolder() {
+ return new TransformationPropertyValueModel<IOneToManyMapping, ICascade>(getSubjectHolder()) {
+ @Override
+ protected ICascade transform_(IOneToManyMapping value) {
+ return value.getCascade();
+ }
+ };
+ }
+
+ private PropertyValueModel<IJoinTable> buildJointTableHolder() {
+ return new TransformationPropertyValueModel<IOneToManyMapping, IJoinTable>(getSubjectHolder()) {
+ @Override
+ protected IJoinTable transform_(IOneToManyMapping value) {
+ return value.getJoinTable();
+ }
+ };
+ }
+
+ private Composite buildPane(Composite container, int groupBoxMargin) {
+ return buildSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
+ }
+
+ private void initializeGeneralPane(Composite container) {
+
+ int groupBoxMargin = groupBoxMargin();
+
+ // Target Entity widgets
+ new TargetEntityComposite(this, buildPane(container, groupBoxMargin));
+
+ // Fetch Type widgets
+ new FetchTypeComposite(this, buildPane(container, groupBoxMargin));
+
+ // Mapped By widgets
+ new MappedByComposite(this, buildPane(container, groupBoxMargin));
+
+ // Cascade widgets
+ new CascadeComposite(this, buildCascadeHolder(), container);
+
+ // Ordering widgets
+ new OrderingComposite(this, container);
+ }
+
+ private void initializeJoinTablePane(Composite container) {
+
+ container = buildSection(
+ container,
+ JptUiMappingsMessages.MultiRelationshipMappingComposite_joinTable
+ );
+
+ new JoinTableComposite(
+ this,
+ buildJointTableHolder(),
+ container
+ );
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ // General sub pane
+ initializeGeneralPane(container);
+
+ // Join Table sub pane
+ initializeJoinTablePane(container);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToOneComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToOneComposite.java
deleted file mode 100644
index 6894ac5836..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToOneComposite.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.IOneToOne;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class OneToOneComposite extends BaseJpaComposite
-{
- private IOneToOne oneToOne;
-
- private TargetEntityChooser targetEntityChooser;
-
- private EnumComboViewer fetchTypeComboViewer;
-
- private MappedByCombo mappedByCombo;
-
- private EnumComboViewer optionalComboViewer;
-
- private CascadeComposite cascadeComposite;
-
- private JoinColumnComposite joinColumnComposite;
-
- public OneToOneComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
- protected IOneToOne getOneToOne() {
- return this.oneToOne;
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- Control generalControl = buildGeneralComposite(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generalControl.setLayoutData(gridData);
-
- }
-
- protected Control buildGeneralComposite(Composite composite) {
-// IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- Composite generalComposite = getWidgetFactory().createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- generalComposite.setLayout(layout);
-
- TargetEntityChooser targetEntityChooser = getTargetEntityChooser(generalComposite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- targetEntityChooser.getControl().setLayoutData(gridData);
-
-
- CommonWidgets.buildFetchLabel(generalComposite, getWidgetFactory());
- EnumComboViewer fetchTypeComboViewer = getFetchTypeComboViewer(generalComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- fetchTypeComboViewer.getControl().setLayoutData(gridData);
-
- CommonWidgets.buildMappedByLabel(generalComposite, getWidgetFactory());
- MappedByCombo mappedByCombo = getMappedByCombo(generalComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- mappedByCombo.getControl().setLayoutData(gridData);
-
- CommonWidgets.buildOptionalLabel(generalComposite, getWidgetFactory());
- EnumComboViewer optionalComboViewer = getOptionalComboViewer(generalComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- optionalComboViewer.getControl().setLayoutData(gridData);
-
- CascadeComposite cascadeComposite = getCascadeComposite(generalComposite);
- gridData = new GridData();
- gridData.horizontalSpan = 3;
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- cascadeComposite.getControl().setLayoutData(gridData);
-
- JoinColumnComposite joinColumnComposite = getJoinColumnComposite(generalComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- joinColumnComposite.getControl().setLayoutData(gridData);
-
- return generalComposite;
- }
-
- protected TargetEntityChooser getTargetEntityChooser(Composite parentComposite) {
- if (this.targetEntityChooser == null) {
- this.targetEntityChooser = createTargetEntityChooser(parentComposite);
- }
- return this.targetEntityChooser;
- }
-
- protected TargetEntityChooser createTargetEntityChooser(Composite parentComposite) {
- return CommonWidgets.buildTargetEntityChooser(parentComposite, this.commandStack, getWidgetFactory());
- }
-
- protected EnumComboViewer getFetchTypeComboViewer(Composite parentComposite) {
- if (this.fetchTypeComboViewer == null) {
- this.fetchTypeComboViewer = createFetchTypeComboViewer(parentComposite);
- }
- return this.fetchTypeComboViewer;
- }
-
- protected EnumComboViewer createFetchTypeComboViewer(Composite parentComposite) {
- return CommonWidgets.buildEnumComboViewer(parentComposite, this.commandStack, getWidgetFactory());
- }
-
- protected MappedByCombo getMappedByCombo(Composite parentComposite) {
- if (this.mappedByCombo == null) {
- this.mappedByCombo = createMappedByCombo(parentComposite);
- }
- return this.mappedByCombo;
- }
-
- protected MappedByCombo createMappedByCombo(Composite parentComposite) {
- return new MappedByCombo(parentComposite, this.commandStack, getWidgetFactory());
- }
-
- protected EnumComboViewer getOptionalComboViewer(Composite parentComposite) {
- if (this.optionalComboViewer == null) {
- this.optionalComboViewer = createOptionalComboViewer(parentComposite);
- }
- return this.optionalComboViewer;
- }
-
- protected EnumComboViewer createOptionalComboViewer(Composite parentComposite) {
- return CommonWidgets.buildEnumComboViewer(parentComposite, this.commandStack, getWidgetFactory());
- }
-
- protected CascadeComposite getCascadeComposite(Composite parentComposite) {
- if (this.cascadeComposite == null) {
- this.cascadeComposite = createCascadeComposite(parentComposite);
- }
- return this.cascadeComposite;
- }
-
- protected CascadeComposite createCascadeComposite(Composite parentComposite) {
- return new CascadeComposite(parentComposite, this.commandStack, getWidgetFactory());
- }
-
- protected JoinColumnComposite getJoinColumnComposite(Composite parentComposite) {
- if (this.joinColumnComposite == null) {
- this.joinColumnComposite = createJoinColumnComposite(parentComposite);
- }
- return this.joinColumnComposite;
- }
-
- protected JoinColumnComposite createJoinColumnComposite(Composite parentComposite) {
- return new JoinColumnComposite(parentComposite, this.commandStack, getWidgetFactory());
- }
-
-
- public void doPopulate(EObject obj) {
- this.oneToOne = (IOneToOne) obj;
- this.targetEntityChooser.populate(getOneToOne());
- this.fetchTypeComboViewer.populate(CommonWidgets.buildSingleRelationshipMappingFetchEnumHolder(getOneToOne()));
- this.mappedByCombo.populate(getOneToOne());
- this.optionalComboViewer.populate(CommonWidgets.buildOptionalHolder(getOneToOne()));
- this.cascadeComposite.populate(getOneToOne());
- this.joinColumnComposite.populate(getOneToOne());
- }
-
- public void doPopulate() {
- this.targetEntityChooser.populate();
- this.fetchTypeComboViewer.populate();
- this.mappedByCombo.populate();
- this.optionalComboViewer.populate();
- this.cascadeComposite.populate();
- this.joinColumnComposite.populate();
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
- @Override
- public void dispose() {
- this.targetEntityChooser.dispose();
- this.fetchTypeComboViewer.dispose();
- this.mappedByCombo.dispose();
- this.optionalComboViewer.dispose();
- this.cascadeComposite.dispose();
- this.joinColumnComposite.dispose();
- super.dispose();
- }
-
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToOneMappingComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToOneMappingComposite.java
new file mode 100644
index 0000000000..d9ae3a72c1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OneToOneMappingComposite.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.ICascade;
+import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping;
+import org.eclipse.jpt.ui.internal.details.IJpaComposite;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | TargetEntityComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | FetchTypeComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | MappedByComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | OptionalComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | CascadeComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | JoinColumnComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IOneToOneMapping
+ * @see BaseJpaUiFactory - The factory creating this pane
+ * @see CascadeComposite
+ * @see FetchTypeComposite
+ * @see JoinColumnComposite
+ * @see MappedByComposite
+ * @see OptionalComposite
+ * @see TargetEntityComposite
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class OneToOneMappingComposite extends AbstractFormPane<IOneToOneMapping>
+ implements IJpaComposite<IOneToOneMapping>
+{
+ /**
+ * Creates a new <code>OneToOneMappingComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IOneToOneMapping</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public OneToOneMappingComposite(PropertyValueModel<? extends IOneToOneMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ private PropertyValueModel<ICascade> buildCascadeHolder() {
+ return new TransformationPropertyValueModel<IOneToOneMapping, ICascade>(getSubjectHolder()) {
+ @Override
+ protected ICascade transform_(IOneToOneMapping value) {
+ return value.getCascade();
+ }
+ };
+ }
+
+ private Composite buildPane(Composite container, int groupBoxMargin) {
+ return buildSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ int groupBoxMargin = groupBoxMargin();
+
+ // Target Entity widgets
+ new TargetEntityComposite(this, buildPane(container, groupBoxMargin));
+
+ // Fetch Type widgets
+ new FetchTypeComposite(this, buildPane(container, groupBoxMargin));
+
+ // Mapped By widgets
+ new MappedByComposite(this, buildPane(container, groupBoxMargin));
+
+ // Optional check box
+ new OptionalComposite(this, buildPane(container, groupBoxMargin));
+
+ // Cascade widgets
+ new CascadeComposite(this, buildCascadeHolder(), container);
+
+ // Join Column widgets
+ new JoinColumnComposite(this, container);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OptionalComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OptionalComposite.java
new file mode 100644
index 0000000000..ee65ff8050
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OptionalComposite.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.INullable;
+import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This composite simply shows a tri-state check box for the Optional option.
+ *
+ * @see IBasicMapping
+ * @see BasicMappingComposite - A container of this pane
+ * @see ManyToOneMappingComposite - A container of this pane
+ * @see OneToOneMappingComposite - A container of this pane
+ *
+ * @version 1.0
+ * @since 2.0
+ */
+public class OptionalComposite extends AbstractFormPane<INullable>
+{
+ /**
+ * Creates a new <code>OptionalComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public OptionalComposite(AbstractFormPane<? extends INullable> parentPane,
+ Composite parent)
+ {
+ super(parentPane, parent);
+ }
+
+ private WritablePropertyValueModel<Boolean> buildOptionalHolder() {
+ return new PropertyAspectAdapter<INullable, Boolean>(getSubjectHolder(), INullable.SPECIFIED_OPTIONAL_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return subject.getSpecifiedOptional();
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ subject.setSpecifiedOptional(value);
+ }
+ };
+ }
+
+ private PropertyValueModel<String> buildOptionalStringHolder() {
+
+ return new TransformationPropertyValueModel<Boolean, String>(buildOptionalHolder()) {
+
+ @Override
+ protected String transform(Boolean value) {
+
+ if ((subject() != null) && (value == null)) {
+
+ Boolean defaultValue = subject().getDefaultOptional();
+
+ if (defaultValue != null) {
+
+ String defaultStringValue = defaultValue ? JptUiMappingsMessages.Boolean_True :
+ JptUiMappingsMessages.Boolean_False;
+
+ return NLS.bind(
+ JptUiMappingsMessages.BasicGeneralSection_optionalLabelDefault,
+ defaultStringValue
+ );
+ }
+ }
+
+ return JptUiMappingsMessages.BasicGeneralSection_optionalLabel;
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ buildTriStateCheckBoxWithDefault(
+ container,
+ JptUiMappingsMessages.BasicGeneralSection_optionalLabel,
+ buildOptionalHolder(),
+ buildOptionalStringHolder(),
+ IJpaHelpContextIds.MAPPING_OPTIONAL
+ );
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OrderingComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OrderingComposite.java
index 95b1bc6284..623f358380 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OrderingComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OrderingComposite.java
@@ -1,309 +1,236 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.ITextListener;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.TextEvent;
-import org.eclipse.jface.text.TextViewer;
-import org.eclipse.jpt.core.internal.mappings.IMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
+import java.util.Collection;
+import org.eclipse.jpt.core.internal.context.base.IMultiRelationshipMapping;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
+import org.eclipse.jpt.ui.internal.util.ControlEnabler;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+import org.eclipse.swt.widgets.Text;
/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | - Order By -------------------------------------------------------------- |
+ * | | | |
+ * | | o No Ordering | |
+ * | | | |
+ * | | o Primary Key Ordering | |
+ * | | | |
+ * | | o Custom Ordering | |
+ * | | ------------------------------------------------------------------- | |
+ * | | | | | |
+ * | | ------------------------------------------------------------------- | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IMultiRelationshipMapping
+ * @see ManyToManyMappingComposite - A container of this pane
+ * @see OneToManyMappingComposite - A container of this pane
*
+ * @version 2.0
+ * @since 1.0
*/
-public class OrderingComposite extends BaseJpaComposite {
-
- private IMultiRelationshipMapping mapping;
- private Adapter mappingListener;
-
- private Button noOrderingRadioButton;
- private Button primaryKeyOrderingRadioButton;
- private Button customOrderingRadioButton;
-
- private ITextViewer orderingTextViewer;
-
- // short circuit flag for user typing
- private boolean updatingCustomOrderBy = false;
-
-
- public OrderingComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, commandStack, widgetFactory);
- this.mappingListener = buildMappingListener();
+@SuppressWarnings("nls")
+public class OrderingComposite extends AbstractFormPane<IMultiRelationshipMapping>
+{
+ private Text customOrderingText;
+
+ /**
+ * Creates a new <code>OrderingComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ protected OrderingComposite(AbstractFormPane<? extends IMultiRelationshipMapping> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ /**
+ * Creates a new <code>OrderingComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IMultiRelationshipMapping</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public OrderingComposite(PropertyValueModel<? extends IMultiRelationshipMapping> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(IMultiRelationshipMapping.ORDER_BY_PROPERTY);
}
- private Adapter buildMappingListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- mappingChanged(notification);
+ private WritablePropertyValueModel<Boolean> buildCustomOrderingHolder() {
+ return new PropertyAspectAdapter<IMultiRelationshipMapping, Boolean>(getSubjectHolder(), IMultiRelationshipMapping.ORDER_BY_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return subject.isCustomOrdering();
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ if (value) {
+ subject.setOrderBy("");
+ }
}
};
}
- @Override
- protected void initializeLayout(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- Group orderByGroup = getWidgetFactory().createGroup(composite, JptUiMappingsMessages.OrderByComposite_orderByGroup);
- orderByGroup.setLayout(new GridLayout(1, false));
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- orderByGroup.setLayoutData(gridData);
- helpSystem.setHelp(orderByGroup, IJpaHelpContextIds.MAPPING_ORDER_BY);
-
-
- this.noOrderingRadioButton = buildNoOrderingRadioButton(orderByGroup);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.noOrderingRadioButton.setLayoutData(gridData);
-// helpSystem().setHelp(this.noOrderingRadioButton, IJpaHelpContextIds.MAPPING_ORDER_BY_NO_ORDERING);
-
-
- this.primaryKeyOrderingRadioButton = buildPrimaryKeyOrderingRadioButton(orderByGroup);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.primaryKeyOrderingRadioButton.setLayoutData(gridData);
-// helpSystem().setHelp(this.primaryKeyOrderingRadioButton, IJpaHelpContextIds.MAPPING_ORDER_BY_PRIMARY_KEY_ORDERING);
-
- this.customOrderingRadioButton = buildCustomOrderingRadioButton(orderByGroup);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.customOrderingRadioButton.setLayoutData(gridData);
-// helpSystem().setHelp(this.customOrderingRadioButton, IJpaHelpContextIds.MAPPING_ORDER_BY_CUSTOM_ORDERING);
+ private ModifyListener buildCustomTextModifyListener() {
+ return new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ if (isPopulating()) {
+ return;
+ }
-
- this.orderingTextViewer = buildOrderByTestViewer(orderByGroup);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalIndent = 15;
- this.orderingTextViewer.getTextWidget().setLayoutData(gridData);
- helpSystem.setHelp(this.orderingTextViewer.getTextWidget(), IJpaHelpContextIds.MAPPING_ORDER_BY);
- }
-
- private Button buildNoOrderingRadioButton(Composite parent) {
- Button button = getWidgetFactory().createButton(
- parent,
- JptUiMappingsMessages.OrderByComposite_noOrdering,
- SWT.RADIO);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
- public void widgetSelected(SelectionEvent e) {
- OrderingComposite.this.noOrderingRadioButtonSelected(e);
+ Text text = (Text) e.widget;
+ subject().setOrderBy(text.getText());
}
- });
-
- return button;
+ };
}
- void noOrderingRadioButtonSelected(SelectionEvent e) {
- if (!((Button) e.widget).getSelection()) {
- //ignore case where radio button is deselected
- return;
- }
- if (this.mapping.isNoOrdering()) {
- return;
- }
- this.mapping.setNoOrdering();
- }
-
- private Button buildPrimaryKeyOrderingRadioButton(Composite parent) {
- Button button = getWidgetFactory().createButton(
- parent,
- JptUiMappingsMessages.OrderByComposite_primaryKeyOrdering,
- SWT.RADIO);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
+ private WritablePropertyValueModel<Boolean> buildNoOrderingHolder() {
+ return new PropertyAspectAdapter<IMultiRelationshipMapping, Boolean>(getSubjectHolder(), IMultiRelationshipMapping.ORDER_BY_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return subject.isNoOrdering();
}
- public void widgetSelected(SelectionEvent e) {
- OrderingComposite.this.primaryKeyOrderingRadioButtonSelected(e);
+
+ @Override
+ protected void setValue_(Boolean value) {
+ if (value) {
+ subject.setNoOrdering();
+ }
}
- });
- return button;
- }
-
- void primaryKeyOrderingRadioButtonSelected(SelectionEvent e) {
- if (!((Button) e.widget).getSelection()) {
- //ignore case where radio button is deselected
- return;
- }
- if (! this.mapping.isOrderByPk()) {
- this.mapping.setOrderByPk();
- }
- setTextViewerEnabled(false);
+ };
}
- private Button buildCustomOrderingRadioButton(Composite parent) {
- Button button = getWidgetFactory().createButton(
- parent,
- JptUiMappingsMessages.OrderByComposite_customOrdering,
- SWT.RADIO);
- button.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
- public void widgetSelected(SelectionEvent e) {
- OrderingComposite.this.customOrderingRadioButtonSelected(e);
+ private WritablePropertyValueModel<Boolean> buildPrimaryKeyOrderingHolder() {
+ return new PropertyAspectAdapter<IMultiRelationshipMapping, Boolean>(getSubjectHolder(), IMultiRelationshipMapping.ORDER_BY_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return subject.isOrderByPk();
}
- });
- return button;
- }
-
- void customOrderingRadioButtonSelected(SelectionEvent e) {
- if (!((Button) e.widget).getSelection()) {
- //ignore case where radio button is deselected
- return;
- }
- setTextViewerEnabled(true);
- }
-
- private ITextViewer buildOrderByTestViewer(Composite parent) {
- final TextViewer textViewer = new TextViewer(parent, SWT.SINGLE | SWT.BORDER);
- textViewer.setDocument(new Document());
- textViewer.addTextListener(new ITextListener() {
- public void textChanged(TextEvent event) {
- orderingTextViewerChanged();
+ @Override
+ protected void setValue_(Boolean value) {
+ if (value) {
+ subject.setOrderByPk();
+ }
}
- });
- return textViewer;
- }
-
- private void orderingTextViewerChanged() {
- if (isPopulating()) {
- return;
- }
- String orderByValue = this.orderingTextViewer.getDocument().get();
- if (orderByValue.equals(this.mapping.getOrderBy())) {
- return;
- }
-
- this.updatingCustomOrderBy = true;
- this.mapping.setOrderBy(orderByValue);
- }
-
- private void setTextViewerEnabled(boolean enabled) {
- this.orderingTextViewer.setEditable(enabled);
- this.orderingTextViewer.getTextWidget().setEnabled(enabled);
+ };
}
- private void mappingChanged(Notification notification) {
- if (notification.getFeatureID(IMultiRelationshipMapping.class) == JpaCoreMappingsPackage.IMULTI_RELATIONSHIP_MAPPING__ORDER_BY) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- populate();
- }
- });
- }
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void doPopulate() {
+ super.doPopulate();
+ populateCustomOrdering();
}
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void doPopulate(EObject obj) {
- this.mapping = (IMultiRelationshipMapping) obj;
- if (this.mapping == null) {
+ protected void initializeLayout(Composite container) {
+
+ // Order By group
+ Group orderByGroup = buildTitledPane(
+ container,
+ JptUiMappingsMessages.OrderByComposite_orderByGroup,
+ IJpaHelpContextIds.MAPPING_ORDER_BY);
+
+ // No Ordering radio button
+ buildRadioButton(
+ orderByGroup,
+ JptUiMappingsMessages.OrderByComposite_noOrdering,
+ buildNoOrderingHolder(),
+ IJpaHelpContextIds.MAPPING_ORDER_BY_NO_ORDERING
+ );
+
+ // Order by Primary Key radio button
+ buildRadioButton(
+ orderByGroup,
+ JptUiMappingsMessages.OrderByComposite_primaryKeyOrdering,
+ buildPrimaryKeyOrderingHolder(),
+ IJpaHelpContextIds.MAPPING_ORDER_BY_PRIMARY_KEY_ORDERING
+ );
+
+ // Custom Ordering radio button
+ buildRadioButton(
+ orderByGroup,
+ JptUiMappingsMessages.OrderByComposite_customOrdering,
+ buildCustomOrderingHolder(),
+ IJpaHelpContextIds.MAPPING_ORDER_BY_CUSTOM_ORDERING
+ );
+
+ // Custom Ordering text field
+ customOrderingText = buildText(
+ buildSubPane(orderByGroup, 0, 16),
+ IJpaHelpContextIds.MAPPING_ORDER_BY
+ );
+
+ customOrderingText.addModifyListener(buildCustomTextModifyListener());
+ installCustomTextEnabler(customOrderingText);
+ }
+
+ private void installCustomTextEnabler(Text text) {
+ new ControlEnabler(buildCustomOrderingHolder(), text);
+ }
+
+ private void populateCustomOrdering() {
+
+ if (customOrderingText.isDisposed()) {
return;
}
- populateOrderingRadioButtons();
- }
-
- @Override
- protected void doPopulate() {
- populateOrderingRadioButtons();
- }
- @Override
- protected void engageListeners() {
- if (this.mapping != null) {
- this.mapping.eAdapters().add(this.mappingListener);
+ if ((subject() != null) && subject().isCustomOrdering()) {
+ customOrderingText.setText(subject().getOrderBy());
+ }
+ else {
+ customOrderingText.setText("");
}
}
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void disengageListeners() {
- if (this.mapping != null) {
- this.mapping.eAdapters().remove(this.mappingListener);
- }
- }
-
- private void populateOrderingRadioButtons() {
- // short circuit if user is typing
- if (updatingCustomOrderBy) {
- updatingCustomOrderBy = false;
- return;
- }
-
- if (this.mapping.isNoOrdering()) {
- this.primaryKeyOrderingRadioButton.setSelection(false);
- this.customOrderingRadioButton.setSelection(false);
- this.noOrderingRadioButton.setSelection(true);
- if (! "".equals(this.orderingTextViewer.getDocument().get())) {
- this.orderingTextViewer.getDocument().set("");
- }
- }
- else if (this.mapping.isOrderByPk()) {
- this.customOrderingRadioButton.setSelection(false);
- this.noOrderingRadioButton.setSelection(false);
- this.primaryKeyOrderingRadioButton.setSelection(true);
-// String value = this.ordering.getValue();
-// if (value != null && !value.equals(this.orderingTextViewer.getDocument().get())) {
-// this.orderingTextViewer.getDocument().set(value);
-// }
-// else {
- if (!"".equals(this.orderingTextViewer.getDocument().get())) {
- this.orderingTextViewer.getDocument().set("");
- }
-// }
- }
- else if (this.mapping.isCustomOrdering()) {
- this.noOrderingRadioButton.setSelection(false);
- this.primaryKeyOrderingRadioButton.setSelection(false);
- this.customOrderingRadioButton.setSelection(true);
- String value = this.mapping.getOrderBy();
- if (value != null && !value.equals(this.orderingTextViewer.getDocument().get())) {
- this.orderingTextViewer.getDocument().set(value);
- }
+ protected void propertyChanged(String propertyName) {
+ super.propertyChanged(propertyName);
+
+ if (propertyName == IMultiRelationshipMapping.ORDER_BY_PROPERTY) {
+ populateCustomOrdering();
}
-
- setTextViewerEnabled(this.mapping.isCustomOrdering());
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OverridesComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OverridesComposite.java
index 986aab26e1..6e11bd46ff 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OverridesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/OverridesComposite.java
@@ -1,501 +1,447 @@
/*******************************************************************************
- * Copyright (c) 2007 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
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
-import java.util.List;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
+import java.util.ListIterator;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.JpaEObject;
-import org.eclipse.jpt.core.internal.mappings.IAssociationOverride;
-import org.eclipse.jpt.core.internal.mappings.IAttributeOverride;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IOverride;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
+import org.eclipse.jpt.core.internal.context.base.IAssociationOverride;
+import org.eclipse.jpt.core.internal.context.base.IAttributeOverride;
+import org.eclipse.jpt.core.internal.context.base.IColumn;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IOverride;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.ui.internal.mappings.details.JoinColumnsComposite.Owner;
+import org.eclipse.jpt.ui.internal.mappings.details.JoinColumnsComposite.IJoinColumnsEditor;
+import org.eclipse.jpt.ui.internal.swt.ListBoxModelAdapter;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.PostExecution;
import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.StringConverter;
+import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
+import org.eclipse.swt.widgets.List;
import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class OverridesComposite extends BaseJpaComposite
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | |
+ * | - Attribute Overrides --------------------------------------------------- |
+ * | | --------------------------------------------------------------------- | |
+ * | | | | | |
+ * | | | | | |
+ * | | | | | |
+ * | | --------------------------------------------------------------------- | |
+ * | | | |
+ * | | x Override Default | |
+ * | | | |
+ * | | --------------------------------------------------------------------- | |
+ * | | | | | |
+ * | | | JoinColumnsComposite | | |
+ * | | | | | |
+ * | | --------------------------------------------------------------------- | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IEntity
+ * @see EntityComposite - The parent container
+ * @see JoinColumnsComposite
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class OverridesComposite extends AbstractFormPane<IEntity>
{
- private ListViewer listViewer;
-
- private IEntity entity;
- private Adapter entityListener;
-
- private IOverride selectedOverride;
- private Adapter overrideListener;
-
- protected PageBook overridePageBook;
-
- protected ColumnComposite columnComposite;
- protected JoinColumnsComposite joinColumnsComposite;
-
- private Button overrideDefaultButton;
-
- public OverridesComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.entityListener = buildEntityListener();
- this.overrideListener = buildOverrideListener();
+ /**
+ * Creates a new <code>OverridesComposite</code>.
+ *
+ * @param parentPane The parent controller of this one
+ * @param parent The parent container
+ */
+ public OverridesComposite(AbstractFormPane<? extends IEntity> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
}
-
- private Adapter buildEntityListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- entityChanged(notification);
- }
- };
+
+ /**
+ * Creates a new <code>OverridesComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IEntity</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public OverridesComposite(PropertyValueModel<? extends IEntity> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ private void addJoinColumn(IAssociationOverride subject) {
+
+ JoinColumnInAssociationOverrideDialog dialog =
+ new JoinColumnInAssociationOverrideDialog(shell(), subject);
+
+ dialog.openDialog(buildAddJoinColumnPostExecution());
+ }
+
+ private void addJoinColumn(JoinColumnInAssociationOverrideStateObject stateObject) {
+
+ IAssociationOverride associationOverride = stateObject.getAssociationOverride();
+ int index = associationOverride.specifiedJoinColumnsSize();
+
+ IJoinColumn joinColumn = associationOverride.addSpecifiedJoinColumn(index);
+ joinColumn.setSpecifiedName(stateObject.getSelectedName());
+ joinColumn.setSpecifiedReferencedColumnName(stateObject.getSpecifiedReferencedColumnName());
}
-
- private Adapter buildOverrideListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- overrideChanged(notification);
+
+ private PostExecution<JoinColumnInAssociationOverrideDialog> buildAddJoinColumnPostExecution() {
+ return new PostExecution<JoinColumnInAssociationOverrideDialog>() {
+ public void execute(JoinColumnInAssociationOverrideDialog dialog) {
+ if (dialog.wasConfirmed()) {
+ addJoinColumn(dialog.subject());
+ }
}
};
}
-
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- Group attributeOverridesGroup = getWidgetFactory().createGroup(
- composite, JptUiMappingsMessages.AttributeOverridesComposite_attributeOverrides);
- attributeOverridesGroup.setLayout(new GridLayout(2, true));
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace= true;
- attributeOverridesGroup.setLayoutData(gridData);
-
- this.listViewer = buildAttributeOverridesListViewer(attributeOverridesGroup);
- gridData = new GridData();
- gridData.verticalSpan = 2;
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace= true;
- this.listViewer.getList().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.listViewer.getList(), IJpaHelpContextIds.ENTITY_ATTRIBUTE_OVERRIDES);
-
- this.overrideDefaultButton =
- getWidgetFactory().createButton(
- attributeOverridesGroup,
- JptUiMappingsMessages.AttributeOverridesComposite_overridDefault,
- SWT.CHECK);
- this.overrideDefaultButton.addSelectionListener(buildOverrideDefaultSelectionListener());
- gridData = new GridData();
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.overrideDefaultButton.setLayoutData(gridData);
-
-
- this.overridePageBook = buildOverridePageBook(attributeOverridesGroup);
- gridData = new GridData();
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalAlignment = SWT.FILL;
- this.overridePageBook.setLayoutData(gridData);
-
- this.joinColumnsComposite = new JoinColumnsComposite(this.overridePageBook, this.commandStack, getWidgetFactory(), JptUiMappingsMessages.OverridesComposite_joinColumn);
- this.columnComposite = new ColumnComposite(this.overridePageBook, this.commandStack, getWidgetFactory());
- this.overridePageBook.showPage(this.joinColumnsComposite.getControl());
- }
-
- protected PageBook buildOverridePageBook(Composite parent) {
- return new PageBook(parent, SWT.NONE);
+
+ private WritablePropertyValueModel<IAssociationOverride> buildAssociationOverrideHolder() {
+ return new SimplePropertyValueModel<IAssociationOverride>();
}
- private SelectionListener buildOverrideDefaultSelectionListener() {
- return new SelectionListener(){
-
- public void widgetSelected(SelectionEvent e) {
- overrideDefaultButtonSelected(e);
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- overrideDefaultButtonSelected(e);
+ private PropertyValueModel<IColumn> buildColumnHolder() {
+ return new TransformationPropertyValueModel<IEntity, IColumn>(getSubjectHolder()) {
+ @Override
+ protected IColumn transform_(IEntity value) {
+ return null; //TODO
}
};
}
-
- private void overrideDefaultButtonSelected(SelectionEvent e) {
- boolean selection = this.overrideDefaultButton.getSelection();
- if (selection) {
- if (getSelectedOverride() instanceof IAttributeOverride) {
- int index = this.entity.getSpecifiedAttributeOverrides().size();
- IAttributeOverride attributeOverride = this.entity.createAttributeOverride(index);
- this.entity.getSpecifiedAttributeOverrides().add(attributeOverride);
- attributeOverride.setName(this.selectedOverride.getName());
- attributeOverride.getColumn().setSpecifiedName(((IAttributeOverride) this.selectedOverride).getColumn().getName());
- }
- else {
- int index = this.entity.getSpecifiedAssociationOverrides().size();
- IAssociationOverride associationOverride = this.entity.createAssociationOverride(index);
- String name = this.selectedOverride.getName();
- this.entity.getSpecifiedAssociationOverrides().add(associationOverride);
- associationOverride.setName(name);
- //attributeOverride.getColumn().setSpecifiedName(this.attributeOverride.getColumn().getName());
- }
- }
- else {
- if (getSelectedOverride() instanceof IAttributeOverride) {
- this.entity.getSpecifiedAttributeOverrides().remove(this.selectedOverride);
- }
- else {
- this.entity.getSpecifiedAssociationOverrides().remove(this.selectedOverride);
+
+ private PostExecution<JoinColumnInAssociationOverrideDialog> buildEditJoinColumnPostExecution() {
+ return new PostExecution<JoinColumnInAssociationOverrideDialog>() {
+ public void execute(JoinColumnInAssociationOverrideDialog dialog) {
+ if (dialog.wasConfirmed()) {
+ editJoinColumn(dialog.subject());
+ }
}
- }
+ };
}
-
-
- private ListViewer buildAttributeOverridesListViewer(Composite parent) {
- ListViewer listViewer = new ListViewer(parent, SWT.SINGLE | SWT.BORDER);
- listViewer.setLabelProvider(buildAttributeOverridesLabelProvider());
- listViewer.setContentProvider(buildAttributeOverridesContentProvider());
-
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- overridesListSelectionChanged(event);
- }
- });
- return listViewer;
+ private JoinColumnsProvider buildJoinColumnsEditor() {
+ return new JoinColumnsProvider();
}
-
- protected void overridesListSelectionChanged(SelectionChangedEvent event) {
- if (((StructuredSelection) event.getSelection()).isEmpty()) {
- this.columnComposite.populate(null);
- this.columnComposite.enableWidgets(false);
- this.overrideDefaultButton.setSelection(false);
- this.overrideDefaultButton.setEnabled(false);
- }
- else {
- this.selectedOverride = getSelectedOverride();
- if (this.selectedOverride instanceof IAttributeOverride) {
- boolean specifiedOverride = this.entity.getSpecifiedAttributeOverrides().contains(this.selectedOverride);
- this.overrideDefaultButton.setSelection(specifiedOverride);
- this.overridePageBook.showPage(this.columnComposite.getControl());
- this.columnComposite.populate(((IAttributeOverride) this.selectedOverride).getColumn());
- this.columnComposite.enableWidgets(specifiedOverride);
- this.overrideDefaultButton.setEnabled(true);
- }
- else {
- boolean specifiedOverride = this.entity.getSpecifiedAssociationOverrides().contains(this.selectedOverride);
- this.overrideDefaultButton.setSelection(specifiedOverride);
- this.overridePageBook.showPage(this.joinColumnsComposite.getControl());
- this.joinColumnsComposite.populate(new JoinColumnsOwner((IAssociationOverride) getSelectedOverride()));
- this.joinColumnsComposite.enableWidgets(specifiedOverride);
- this.overrideDefaultButton.setEnabled(true);
+
+ private ListValueModel<IAssociationOverride> buildOverrideAttributesListHolder() {
+ return new ListAspectAdapter<IEntity, IAssociationOverride>(
+ getSubjectHolder(),
+ IEntity.DEFAULT_ASSOCIATION_OVERRIDES_LIST,
+ IEntity.SPECIFIED_ASSOCIATION_OVERRIDES_LIST)
+ {
+ @Override
+ protected ListIterator<IAssociationOverride> listIterator_() {
+ return subject.associationOverrides();
}
- }
+ };
}
-
- private ILabelProvider buildAttributeOverridesLabelProvider() {
- return new LabelProvider() {
- public String getText(Object element) {
- //TODO also display column name somehow
- return ((IOverride) element).getName();
+
+ private StringConverter<IAssociationOverride> buildOverrideAttributesStringConverter() {
+ return new StringConverter<IAssociationOverride>() {
+ public String convertToString(IAssociationOverride item) {
+ return item.displayString();
}
};
}
-
- private IContentProvider buildAttributeOverridesContentProvider() {
- return new IStructuredContentProvider() {
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
+ private WritablePropertyValueModel<Boolean> buildOverrideDefaultHolder() {
+ return new PropertyAspectAdapter<IEntity, Boolean>(getSubjectHolder(), "") {
+ @Override
+ protected Boolean buildValue_() {
+ return true;
}
-
- public Object[] getElements(Object inputElement) {
- IEntity entity = (IEntity) inputElement;
- return CollectionTools.addAll(
- entity.getAttributeOverrides().toArray(new IOverride[entity.getAttributeOverrides().size()]),
- entity.getAssociationOverrides());
+
+ @Override
+ protected void setValue_(Boolean value) {
+ // Not done here
}
};
}
- private IOverride getSelectedOverride() {
- return (IOverride) ((StructuredSelection) this.listViewer.getSelection()).getFirstElement();
- }
-
-
- public void doPopulate(EObject obj) {
- this.entity = (IEntity) obj;
- if (this.entity == null) {
- this.selectedOverride = null;
- this.columnComposite.populate(null);
- this.joinColumnsComposite.populate(null);
- this.listViewer.setInput(null);
- return;
- }
-
- if (this.listViewer.getInput() != entity) {
- this.listViewer.setInput(entity);
- }
- if (!this.entity.getAttributeOverrides().isEmpty()) {
- if (this.listViewer.getSelection().isEmpty()) {
- IOverride override = this.entity.getAttributeOverrides().get(0);
- this.listViewer.setSelection(new StructuredSelection(override));
- }
- else {
- Object selection = ((StructuredSelection) this.listViewer.getSelection()).getFirstElement();
- if (selection instanceof IAttributeOverride) {
- this.overridePageBook.showPage(this.columnComposite.getControl());
- this.columnComposite.enableWidgets(true);
- this.columnComposite.populate(((IAttributeOverride) selection).getColumn());
- }
- else {
- this.overridePageBook.showPage(this.joinColumnsComposite.getControl());
- this.joinColumnsComposite.enableWidgets(true);
- this.joinColumnsComposite.populate(new JoinColumnsOwner((IAssociationOverride) selection));
- }
+ private SelectionListener buildOverrideDefaultSelectionListener() {
+ return new SelectionAdapter(){
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Button button = (Button) e.widget;
+ overrideDefaultButtonSelected(button.getSelection());
}
- }
- else {
- this.columnComposite.populate(null);
- this.columnComposite.enableWidgets(false);
- }
+ };
}
- @Override
- protected void doPopulate() {
- this.columnComposite.doPopulate();
- this.joinColumnsComposite.doPopulate();
- }
-
- @Override
- protected void engageListeners() {
- if (this.entity != null) {
- this.entity.eAdapters().add(this.entityListener);
- for (IOverride attributeOverride : this.entity.getAttributeOverrides()) {
- attributeOverride.eAdapters().add(this.overrideListener);
- }
- for (IOverride attributeOverride : this.entity.getAssociationOverrides()) {
- attributeOverride.eAdapters().add(this.overrideListener);
- }
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.entity != null) {
- this.entity.eAdapters().remove(this.entityListener);
- for (IOverride attributeOverride : this.entity.getAttributeOverrides()) {
- attributeOverride.eAdapters().remove(this.overrideListener);
- }
- for (IOverride attributeOverride : this.entity.getAssociationOverrides()) {
- attributeOverride.eAdapters().remove(this.overrideListener);
- }
- }
+ private PageBook buildOverridePageBook(Composite parent) {
+ return new PageBook(parent, SWT.NONE);
}
-
- protected void entityChanged(Notification notification) {
- switch (notification.getFeatureID(IEntity.class)) {
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_ATTRIBUTE_OVERRIDES :
- case JpaCoreMappingsPackage.IENTITY__SPECIFIED_ASSOCIATION_OVERRIDES :
- case JpaCoreMappingsPackage.IENTITY__DEFAULT_ATTRIBUTE_OVERRIDES :
- case JpaCoreMappingsPackage.IENTITY__DEFAULT_ASSOCIATION_OVERRIDES :
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (listViewer.getList().isDisposed()) {
- return;
- }
- listViewer.refresh();
- }
- });
-
- if (notification.getEventType() == Notification.ADD) {
- ((IOverride) notification.getNewValue()).eAdapters().add(this.overrideListener);
- final Object newValue = notification.getNewValue();
- ((IOverride) newValue).eAdapters().add(this.overrideListener);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (listViewer.getList().isDisposed()) {
- return;
- }
- listViewer.setSelection(new StructuredSelection(newValue));
- }
- });
- }
- else if (notification.getEventType() == Notification.ADD_MANY) {
- List<IOverride> addedList = (List<IOverride>) notification.getNewValue();
- for (IOverride override : addedList) {
- override.eAdapters().add(this.overrideListener);
- }
- }
- else if (notification.getEventType() == Notification.REMOVE) {
- ((IOverride) notification.getOldValue()).eAdapters().remove(this.overrideListener);
- }
- else if (notification.getEventType() == Notification.REMOVE_MANY) {
- List<IOverride> removedList = (List<IOverride>) notification.getOldValue();
- for (IOverride override : removedList) {
- override.eAdapters().remove(this.overrideListener);
- }
- }
- break;
- }
+ private ListValueModel<IAssociationOverride> buildSortedOverrideAttributesListHolder() {
+ return new SortedListValueModelAdapter<IAssociationOverride>(
+ buildOverrideAttributesListHolder()
+ );
}
- protected void overrideChanged(Notification notification) {
- switch (notification.getFeatureID(IOverride.class)) {
- case JpaCoreMappingsPackage.IOVERRIDE__NAME :
- final IOverride override = (IOverride) notification.getNotifier();
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- OverridesComposite.this.listViewer.update(override, null);
- }
- });
- break;
- default :
- break;
- }
- }
-
- public void dispose() {
- this.columnComposite.dispose();
- this.joinColumnsComposite.dispose();
- super.dispose();
- }
-
+// public void doPopulate(EObject obj) {
+// this.entity = (IEntity) obj;
+// if (this.entity == null) {
+// this.selectedOverride = null;
+// this.columnComposite.populate(null);
+// this.joinColumnsComposite.populate(null);
+// this.listViewer.setInput(null);
+// return;
+// }
+//
+// if (this.listViewer.getInput() != entity) {
+// this.listViewer.setInput(entity);
+// }
+// if (!this.subject().getAttributeOverrides().isEmpty()) {
+// if (this.listViewer.getSelection().isEmpty()) {
+// IOverride override = this.subject().getAttributeOverrides().get(0);
+// this.listViewer.setSelection(new StructuredSelection(override));
+// }
+// else {
+// Object selection = ((StructuredSelection) this.listViewer.getSelection()).getFirstElement();
+// if (selection instanceof IAttributeOverride) {
+// this.overridePageBook.showPage(this.columnComposite.getControl());
+// this.columnComposite.enableWidgets(true);
+// this.columnComposite.populate(((IAttributeOverride) selection).getColumn());
+// }
+// else {
+// this.overridePageBook.showPage(this.joinColumnsComposite.getControl());
+// this.joinColumnsComposite.enableWidgets(true);
+// this.joinColumnsComposite.populate(new JoinColumnsOwner((IAssociationOverride) selection));
+// }
+// }
+// }
+// else {
+// this.columnComposite.populate(null);
+// this.ge.enableWidgets(false);
+// }
+// }
- void addJoinColumn() {
- JoinColumnInAssociationOverrideDialog dialog = new JoinColumnInAssociationOverrideDialog(this.getControl().getShell(), (IAssociationOverride) getSelectedOverride());
- this.addJoinColumnFromDialog(dialog);
- }
-
- private void addJoinColumnFromDialog(JoinColumnInAssociationOverrideDialog dialog) {
- if (dialog.open() != Window.OK) {
- return;
- }
- int index = ((IAssociationOverride) getSelectedOverride()).getJoinColumns().size();
- IJoinColumn joinColumn = ((IAssociationOverride) getSelectedOverride()).createJoinColumn(index);
- ((IAssociationOverride) getSelectedOverride()).getSpecifiedJoinColumns().add(joinColumn);
- joinColumn.setSpecifiedName(dialog.getSelectedName());
- joinColumn.setSpecifiedReferencedColumnName(dialog.getReferencedColumnName());
- }
+ private void editJoinColumn(IJoinColumn joinColumn) {
- void editJoinColumn(IJoinColumn joinColumn) {
- JoinColumnInAssociationOverrideDialog dialog = new JoinColumnInAssociationOverrideDialog(this.getControl().getShell(), joinColumn);
- editJoinColumnFromDialog(dialog, joinColumn);
- }
-
- private void editJoinColumnFromDialog(JoinColumnInAssociationOverrideDialog dialog, IJoinColumn joinColumn) {
- if (dialog.open() == Window.OK) {
- editJoinColumnDialogOkd(dialog, joinColumn);
- }
+ JoinColumnInAssociationOverrideDialog dialog =
+ new JoinColumnInAssociationOverrideDialog(shell(), joinColumn);
+
+ dialog.openDialog(buildEditJoinColumnPostExecution());
}
-
- private void editJoinColumnDialogOkd(JoinColumnInAssociationOverrideDialog dialog, IJoinColumn joinColumn) {
- String name = dialog.getSelectedName();
- String referencedColumnName = dialog.getReferencedColumnName();
- if (dialog.isDefaultNameSelected()) {
+ private void editJoinColumn(JoinColumnInAssociationOverrideStateObject stateObject) {
+
+ IJoinColumn joinColumn = stateObject.getJoinColumn();
+ String name = stateObject.getSelectedName();
+ String referencedColumnName = stateObject.getSpecifiedReferencedColumnName();
+
+ // Name
+ if (stateObject.isDefaultNameSelected()) {
if (joinColumn.getSpecifiedName() != null) {
joinColumn.setSpecifiedName(null);
}
}
- else if (joinColumn.getSpecifiedName() == null || !joinColumn.getSpecifiedName().equals(name)){
+ else if (joinColumn.getSpecifiedName() == null ||
+ !joinColumn.getSpecifiedName().equals(name)){
+
joinColumn.setSpecifiedName(name);
}
-
- if (dialog.isDefaultReferencedColumnNameSelected()) {
+
+ // Referenced Column Name
+ if (stateObject.isDefaultReferencedColumnNameSelected()) {
if (joinColumn.getSpecifiedReferencedColumnName() != null) {
joinColumn.setSpecifiedReferencedColumnName(null);
}
}
- else if (joinColumn.getSpecifiedReferencedColumnName() == null || !joinColumn.getSpecifiedReferencedColumnName().equals(referencedColumnName)){
+ else if (joinColumn.getSpecifiedReferencedColumnName() == null ||
+ !joinColumn.getSpecifiedReferencedColumnName().equals(referencedColumnName)) {
+
joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
}
}
-
- private class JoinColumnsOwner extends JpaEObject implements Owner {
-
- IAssociationOverride associationOverride;
-
- public JoinColumnsOwner(IAssociationOverride associationOverride) {
- super();
- this.associationOverride = associationOverride;
- }
-
- public void addJoinColumn() {
- OverridesComposite.this.addJoinColumn();
- }
-
- public boolean containsSpecifiedJoinColumns() {
- return this.associationOverride.containsSpecifiedJoinColumns();
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ WritablePropertyValueModel<IAssociationOverride> associationOverrideHolder =
+ buildAssociationOverrideHolder();
+
+ // Attribute Overrides group pane
+ container = buildTitledPane(
+ container,
+ JptUiMappingsMessages.AttributeOverridesComposite_attributeOverrides
+ );
+
+ List list = buildList(
+ container,
+ IJpaHelpContextIds.ENTITY_ATTRIBUTE_OVERRIDES
+ );
+
+ ListBoxModelAdapter.adapt(
+ buildSortedOverrideAttributesListHolder(),
+ associationOverrideHolder,
+ list,
+ buildOverrideAttributesStringConverter()
+ );
+
+ // Override Default check box
+ Button overrideDefaultButton = buildCheckBox(
+ container,
+ JptUiMappingsMessages.AttributeOverridesComposite_overrideDefault,
+ buildOverrideDefaultHolder()
+ );
+
+ overrideDefaultButton.addSelectionListener(
+ buildOverrideDefaultSelectionListener()
+ );
+
+ // Override sub-pane
+// PageBook overridePane = buildOverridePageBook(container);
+
+ // Join Columns widgets
+ Group joinColumnGroupPane = buildTitledPane(
+ container,
+ JptUiMappingsMessages.OverridesComposite_joinColumn
+ );
+
+// overridePane.showPage(joinColumnGroupPane);
+
+ JoinColumnsComposite<IAssociationOverride> joinColumnsComposite =
+ new JoinColumnsComposite<IAssociationOverride>(
+ this,
+ associationOverrideHolder,
+ joinColumnGroupPane,
+ buildJoinColumnsEditor()
+ );
+
+ // Column widgets
+ new ColumnComposite(
+ this,
+ buildColumnHolder(),
+ joinColumnGroupPane
+ );
+
+// overridePane.showPage(joinColumnsComposite.getControl());
+ }
+
+ private void overrideDefaultButtonSelected(boolean selected) {
+
+ IEntity entity = subject();
+ IOverride override = null;
+
+ if (selected) {
+ if (override instanceof IAttributeOverride) {
+ int index = entity.specifiedAttributeOverridesSize();
+ IAttributeOverride attributeOverride = entity.addSpecifiedAttributeOverride(index);
+ attributeOverride.setName(override.getName());
+ attributeOverride.getColumn().setSpecifiedName(((IAttributeOverride) override).getColumn().getName());
+ }
+ else {
+ int index = entity.specifiedAssociationOverridesSize();
+ IAssociationOverride associationOverride = entity.addSpecifiedAssociationOverride(index);
+ associationOverride.setName(override.getName());
+ //attributeOverride.getColumn().setSpecifiedName(this.attributeOverride.getColumn().getName());
+ }
}
-
- public IJoinColumn createJoinColumn(int index) {
- return this.associationOverride.createJoinColumn(index);
+ else {
+ if (override instanceof IAttributeOverride) {
+ int index = CollectionTools.indexOf(entity.specifiedAttributeOverrides(), override);
+ this.subject().removeSpecifiedAttributeOverride(index);
+ }
+ else {
+ int index = CollectionTools.indexOf(entity.specifiedAssociationOverrides(), override);
+ this.subject().removeSpecifiedAssociationOverride(index);
+ }
}
-
- public List<IJoinColumn> getJoinColumns() {
- return this.associationOverride.getJoinColumns();
+ }
+
+ protected void overridesListSelectionChanged(SelectionChangedEvent event) {
+// if (((StructuredSelection) event.getSelection()).isEmpty()) {
+// this.columnComposite.populate(null);
+// this.columnComposite.enableWidgets(false);
+// this.overrideDefaultButton.setSelection(false);
+// this.overrideDefaultButton.setEnabled(false);
+// }
+// else {
+// this.selectedOverride = getSelectedOverride();
+// if (this.selectedOverride instanceof IAttributeOverride) {
+// boolean specifiedOverride = this.subject().getSpecifiedAttributeOverrides().contains(this.selectedOverride);
+// this.overrideDefaultButton.setSelection(specifiedOverride);
+// this.overridePageBook.showPage(this.columnComposite.getControl());
+// this.columnComposite.populate(((IAttributeOverride) this.selectedOverride).getColumn());
+// this.columnComposite.enableWidgets(specifiedOverride);
+// this.overrideDefaultButton.setEnabled(true);
+// }
+// else {
+// boolean specifiedOverride = this.subject().getSpecifiedAssociationOverrides().contains(this.selectedOverride);
+// this.overrideDefaultButton.setSelection(specifiedOverride);
+// this.overridePageBook.showPage(this.joinColumnsComposite.getControl());
+// this.joinColumnsComposite.populate(new JoinColumnsOwner((IAssociationOverride) getSelectedOverride()));
+// this.joinColumnsComposite.enableWidgets(specifiedOverride);
+// this.overrideDefaultButton.setEnabled(true);
+// }
+// }
+ }
+
+ private class JoinColumnsProvider implements IJoinColumnsEditor<IAssociationOverride> {
+
+ public void addJoinColumn(IAssociationOverride subject) {
+ OverridesComposite.this.addJoinColumn(subject);
}
-
- public List<IJoinColumn> getSpecifiedJoinColumns() {
- return this.associationOverride.getSpecifiedJoinColumns();
+
+ public void editJoinColumn(IAssociationOverride subject, IJoinColumn joinColumn) {
+ OverridesComposite.this.editJoinColumn(joinColumn);
}
-
- public int specifiedJoinColumnsFeatureId() {
- return JpaCoreMappingsPackage.IASSOCIATION_OVERRIDE__SPECIFIED_JOIN_COLUMNS;
+
+ public boolean hasSpecifiedJoinColumns(IAssociationOverride subject) {
+ return subject.containsSpecifiedJoinColumns();
}
-
- public Class owningFeatureClass() {
- return IAssociationOverride.class;
+
+ public ListIterator<IJoinColumn> joinColumns(IAssociationOverride subject) {
+ return subject.joinColumns();
}
-
- public void editJoinColumn(IJoinColumn joinColumn) {
- OverridesComposite.this.editJoinColumn(joinColumn);
+
+ public String[] propertyNames() {
+ return new String[] {
+ IAssociationOverride.DEFAULT_JOIN_COLUMNS_LIST,
+ IAssociationOverride.SPECIFIED_JOIN_COLUMNS_LIST
+ };
}
-
- public EObject getEObject() {
- return this.associationOverride;
+
+ public void removeJoinColumns(IAssociationOverride subject, int[] selectedIndices) {
+ for (int index = selectedIndices.length; --index >= 0; ) {
+ subject.removeSpecifiedJoinColumn(selectedIndices[index]);
+ }
}
}
-
-
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnDialog.java
index f7aa9653e9..0730af9ab2 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnDialog.java
@@ -1,37 +1,81 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IPrimaryKeyJoinColumn;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
-public class PrimaryKeyJoinColumnDialog extends AbstractJoinColumnDialog<IPrimaryKeyJoinColumn> {
+/**
+ * TODO
+ *
+ * @see PrimaryKeyJoinColumnStateObject
+ * @see PrimaryKeyJoinColumnDialogPane
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class PrimaryKeyJoinColumnDialog extends AbstractJoinColumnDialog<PrimaryKeyJoinColumnStateObject> {
private IEntity entity;
-
- PrimaryKeyJoinColumnDialog(Shell parent, IEntity entity) {
+
+ /**
+ * Creates a new <code>PrimaryKeyJoinColumnDialog</code>.
+ *
+ * @param parent The parent shell
+ * @param entity
+ */
+ public PrimaryKeyJoinColumnDialog(Shell parent, IEntity entity) {
+
super(parent);
this.entity = entity;
}
- PrimaryKeyJoinColumnDialog(Shell parent, IPrimaryKeyJoinColumn joinColumn) {
+ /**
+ * Creates a new <code>PrimaryKeyJoinColumnDialog</code>.
+ *
+ * @param parent The parent shell
+ * @param joinColumn
+ */
+ public PrimaryKeyJoinColumnDialog(Shell parent,
+ IPrimaryKeyJoinColumn joinColumn) {
+
super(parent, joinColumn);
- this.entity = (IEntity) joinColumn.eContainer();
}
- protected Table getNameTable() {
- return this.entity.primaryDbTable();
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected PrimaryKeyJoinColumnStateObject buildStateObject() {
+
+ if (entity != null) {
+ return new PrimaryKeyJoinColumnStateObject(entity);
+ }
+
+ return new PrimaryKeyJoinColumnStateObject(getJoinColumn());
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public IPrimaryKeyJoinColumn getJoinColumn() {
+ return (IPrimaryKeyJoinColumn) super.getJoinColumn();
}
-
- protected Table getReferencedNameTable() {
- return this.entity.parentEntity().primaryDbTable();
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeMainPane(Composite container) {
+ new PrimaryKeyJoinColumnDialogPane(getSubjectHolder(), container);
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnDialogPane.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnDialogPane.java
new file mode 100644
index 0000000000..daf01a4d83
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnDialogPane.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * TODO:
+ *
+ * @see PrimaryKeyJoinColumnStateObject
+ * @see PrimaryKeyJoinColumnDialog - The parent container
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public final class PrimaryKeyJoinColumnDialogPane extends AbstractJoinColumnDialogPane<PrimaryKeyJoinColumnStateObject>
+{
+ /**
+ * Creates a new <code>PrimaryKeyJoinColumnDialogPane</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ */
+ public PrimaryKeyJoinColumnDialogPane(PropertyValueModel<PrimaryKeyJoinColumnStateObject> subjectHolder,
+ Composite parent) {
+
+ super(subjectHolder, parent);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+ super.initializeLayout(container);
+
+ // TODO
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnInSecondaryTableDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnInSecondaryTableDialog.java
index 51a220df88..9330f4d6a2 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnInSecondaryTableDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnInSecondaryTableDialog.java
@@ -1,37 +1,85 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.db.internal.Table;
+import org.eclipse.jpt.core.internal.context.base.IPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.ISecondaryTable;
+import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
-public class PrimaryKeyJoinColumnInSecondaryTableDialog extends AbstractJoinColumnDialog<IPrimaryKeyJoinColumn> {
+/**
+ * TODO
+ *
+ * @see PrimaryKeyJoinColumnInSecondaryTableStateObject
+ * @see AbstractJoinColumnDialogPane
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class PrimaryKeyJoinColumnInSecondaryTableDialog extends AbstractJoinColumnDialog<PrimaryKeyJoinColumnInSecondaryTableStateObject> {
private ISecondaryTable secondaryTable;
-
- PrimaryKeyJoinColumnInSecondaryTableDialog(Shell parent, ISecondaryTable secondaryTable) {
+
+ /**
+ * Creates a new <code>PrimaryKeyJoinColumnDialog</code>.
+ *
+ * @param parent The parent shell
+ * @param joinColumn
+ */
+ public PrimaryKeyJoinColumnInSecondaryTableDialog(Shell parent,
+ IPrimaryKeyJoinColumn joinColumn) {
+
+ super(parent, joinColumn);
+ }
+
+ /**
+ * Creates a new <code>PrimaryKeyJoinColumnDialog</code>.
+ *
+ * @param parent The parent shell
+ * @param secondaryTable
+ */
+ public PrimaryKeyJoinColumnInSecondaryTableDialog(Shell parent,
+ ISecondaryTable secondaryTable) {
+
super(parent);
this.secondaryTable = secondaryTable;
}
- PrimaryKeyJoinColumnInSecondaryTableDialog(Shell parent, IPrimaryKeyJoinColumn joinColumn) {
- super(parent, joinColumn);
- this.secondaryTable = (ISecondaryTable) joinColumn.eContainer();
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected PrimaryKeyJoinColumnInSecondaryTableStateObject buildStateObject() {
+
+ if (secondaryTable != null) {
+ return new PrimaryKeyJoinColumnInSecondaryTableStateObject(secondaryTable);
+ }
+
+ return new PrimaryKeyJoinColumnInSecondaryTableStateObject(getJoinColumn());
}
- protected Table getNameTable() {
- return this.secondaryTable.dbTable();
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public IPrimaryKeyJoinColumn getJoinColumn() {
+ return (IPrimaryKeyJoinColumn) super.getJoinColumn();
}
-
- protected Table getReferencedNameTable() {
- return this.secondaryTable.typeMapping().primaryDbTable();
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeMainPane(Composite container) {
+ new AbstractJoinColumnDialogPane<PrimaryKeyJoinColumnInSecondaryTableStateObject>(
+ getSubjectHolder(),
+ container
+ );
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnInSecondaryTableStateObject.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnInSecondaryTableStateObject.java
new file mode 100644
index 0000000000..1ddea501df
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnInSecondaryTableStateObject.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.IPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.ISecondaryTable;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.db.internal.Table;
+
+/**
+ * @version 2.0
+ * @since 2.0
+ */
+public final class PrimaryKeyJoinColumnInSecondaryTableStateObject extends AbstractJoinColumnStateObject
+{
+ private ISecondaryTable secondaryTable;
+
+ /**
+ * Creates a new <code>PrimaryKeyJoinColumnInSecondaryTableStateObject</code>.
+ *
+ * @param joinColumn
+ */
+ public PrimaryKeyJoinColumnInSecondaryTableStateObject(IPrimaryKeyJoinColumn joinColumn) {
+ super(joinColumn);
+ this.secondaryTable = (ISecondaryTable) joinColumn.parent();
+ }
+
+ /**
+ * Creates a new <code>PrimaryKeyJoinColumnInSecondaryTableStateObject</code>.
+ *
+ * @param secondaryTable
+ */
+ public PrimaryKeyJoinColumnInSecondaryTableStateObject(ISecondaryTable secondaryTable) {
+ super();
+ this.secondaryTable = secondaryTable;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public IPrimaryKeyJoinColumn getJoinColumn() {
+ return (IPrimaryKeyJoinColumn) super.getJoinColumn();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public Table getNameTable() {
+ return secondaryTable.dbTable();
+ }
+
+ /* (non-Javadoc)
+ */
+ @Override
+ public Table getReferencedNameTable() {
+ ITypeMapping type = (ITypeMapping) secondaryTable.parent();
+ return type.primaryDbTable();
+ }
+
+ public ISecondaryTable getSecondaryTable() {
+ return secondaryTable;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnStateObject.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnStateObject.java
new file mode 100644
index 0000000000..0a584ed815
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnStateObject.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IPrimaryKeyJoinColumn;
+import org.eclipse.jpt.db.internal.Table;
+
+/**
+ * @version 2.0
+ * @since 2.0
+ */
+final class PrimaryKeyJoinColumnStateObject extends AbstractJoinColumnStateObject
+{
+ private IEntity entity;
+
+ /**
+ * Creates a new <code>PrimaryKeyJoinColumnStateObject</code>.
+ *
+ * @param entity
+ */
+ public PrimaryKeyJoinColumnStateObject(IEntity entity) {
+ super();
+ this.entity = entity;
+ }
+
+ /**
+ * Creates a new <code>PrimaryKeyJoinColumnStateObject</code>.
+ *
+ * @param joinColumn
+ */
+ public PrimaryKeyJoinColumnStateObject(IPrimaryKeyJoinColumn joinColumn) {
+ super(joinColumn);
+ this.entity = (IEntity) joinColumn.parent();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public IPrimaryKeyJoinColumn getJoinColumn() {
+ return (IPrimaryKeyJoinColumn) super.getJoinColumn();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public Table getNameTable() {
+ return entity.primaryDbTable();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public Table getReferencedNameTable() {
+ return entity.parentEntity().primaryDbTable();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsComposite.java
index e870bfcac8..d307c8559f 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsComposite.java
@@ -1,405 +1,341 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
-import java.util.Iterator;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IContentProvider;
+import java.util.ListIterator;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IPrimaryKeyJoinColumn;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane;
+import org.eclipse.jpt.ui.internal.widgets.PostExecution;
+import org.eclipse.jpt.ui.internal.widgets.AddRemovePane.AbstractAdapter;
+import org.eclipse.jpt.ui.internal.widgets.AddRemovePane.Adapter;
+import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class PrimaryKeyJoinColumnsComposite extends BaseJpaComposite
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | |
+ * | x Override Default Join Columns |
+ * | |
+ * | - Primary Key Join Columns ---------------------------------------------- |
+ * | | | |
+ * | | AddRemoveListPane | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IEntity
+ * @see InheritanceComposite - The container of this pane
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class PrimaryKeyJoinColumnsComposite extends AbstractFormPane<IEntity>
{
- private IEntity entity;
- private final Adapter entityListener;
- private final Adapter pkJoinColumnListener;
-
- ListViewer pkJoinColumnsListViewer;
-
- private Group pkJoinColumnsGroup;
- Button overrideDefaultJoinColumnsCheckBox;
- private Button pkJoinColumnsRemoveButton;
- private Button pkJoinColumnsEditButton;
-
-
- public PrimaryKeyJoinColumnsComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.entityListener = buildEntityListener();
- this.pkJoinColumnListener = buildPkJoinColumnListener();
+ private Button overrideDefaultJoinColumnsCheckBox;
+
+ /**
+ * Creates a new <code>PrimaryKeyJoinColumnsComposite</code>.
+ *
+ * @param parentPane The parent controller of this one
+ * @param parent The parent container
+ */
+ public PrimaryKeyJoinColumnsComposite(AbstractFormPane<? extends IEntity> subjectHolder,
+ Composite parent) {
+
+ super(subjectHolder, parent);
}
-
- private Adapter buildEntityListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- entityChanged(notification);
- }
- };
+
+ /**
+ * Creates a new <code>PrimaryKeyJoinColumnsComposite</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public PrimaryKeyJoinColumnsComposite(PropertyValueModel<? extends IEntity> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
}
-
- private Adapter buildPkJoinColumnListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- pkJoinColumnChanged(notification);
+
+ private void addJoinColumn(PrimaryKeyJoinColumnStateObject stateObject) {
+
+ int index = subject().specifiedPrimaryKeyJoinColumnsSize();
+
+ IPrimaryKeyJoinColumn joinColumn = subject().addSpecifiedPrimaryKeyJoinColumn(index);
+ joinColumn.setSpecifiedName(stateObject.getSelectedName());
+ joinColumn.setSpecifiedReferencedColumnName(stateObject.getSpecifiedReferencedColumnName());
+ }
+
+ private void addPrimaryKeyJoinColumn() {
+ PrimaryKeyJoinColumnDialog dialog = new PrimaryKeyJoinColumnDialog(shell(), subject());
+ dialog.openDialog(buildAddPrimaryKeyJoinColumnPostExecution());
+ }
+
+ private PostExecution<PrimaryKeyJoinColumnDialog> buildAddPrimaryKeyJoinColumnPostExecution() {
+ return new PostExecution<PrimaryKeyJoinColumnDialog>() {
+ public void execute(PrimaryKeyJoinColumnDialog dialog) {
+ if (dialog.wasConfirmed()) {
+ addJoinColumn(dialog.subject());
+ }
}
};
}
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- GridData gridData = new GridData();
- this.overrideDefaultJoinColumnsCheckBox = getWidgetFactory().createButton(
- composite,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_overrideDefaultPrimaryKeyJoinColumns,
- SWT.CHECK);
- this.overrideDefaultJoinColumnsCheckBox.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- if (PrimaryKeyJoinColumnsComposite.this.overrideDefaultJoinColumnsCheckBox.getSelection()) {
- IPrimaryKeyJoinColumn defaultJoinColumn = PrimaryKeyJoinColumnsComposite.this.entity.getDefaultPrimaryKeyJoinColumns().get(0);
- String columnName = defaultJoinColumn.getDefaultName();
- String referencedColumnName = defaultJoinColumn.getDefaultReferencedColumnName();
-
- IPrimaryKeyJoinColumn pkJoinColumn = PrimaryKeyJoinColumnsComposite.this.entity.createPrimaryKeyJoinColumn(0);
- PrimaryKeyJoinColumnsComposite.this.entity.getSpecifiedPrimaryKeyJoinColumns().add(pkJoinColumn);
- pkJoinColumn.setSpecifiedName(columnName);
- pkJoinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- } else {
- PrimaryKeyJoinColumnsComposite.this.entity.getSpecifiedPrimaryKeyJoinColumns().clear();
+
+ String buildDefaultJoinColumnLabel(IPrimaryKeyJoinColumn joinColumn) {
+ return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
+ }
+
+ private PostExecution<PrimaryKeyJoinColumnDialog> buildEditPrimaryKeyJoinColumnPostExecution() {
+ return new PostExecution<PrimaryKeyJoinColumnDialog>() {
+ public void execute(PrimaryKeyJoinColumnDialog dialog) {
+ if (dialog.wasConfirmed()) {
+ editJoinColumn(dialog.subject());
}
}
- });
-
- this.pkJoinColumnsGroup =
- getWidgetFactory().createGroup(
- composite,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_primaryKeyJoinColumn);
- this.pkJoinColumnsGroup.setLayout(new GridLayout(2, false));
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- this.pkJoinColumnsGroup.setLayoutData(gridData);
-
- this.pkJoinColumnsListViewer = new ListViewer(this.pkJoinColumnsGroup, SWT.BORDER | SWT.MULTI);
- this.pkJoinColumnsListViewer.setContentProvider(buildJoinColumnsListContentProvider());
- this.pkJoinColumnsListViewer.setLabelProvider(buildJoinColumnsListLabelProvider());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.verticalSpan = 3;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.pkJoinColumnsListViewer.getList().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.pkJoinColumnsListViewer.getList(), IJpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS);
-
- Button addJoinColumnButton = getWidgetFactory().createButton(
- this.pkJoinColumnsGroup,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_add,
- SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- addJoinColumnButton.setLayoutData(gridData);
- addJoinColumnButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
+ };
+ }
+
+ private WritablePropertyValueModel<IJoinColumn> buildJoinColumnHolder() {
+ return new SimplePropertyValueModel<IJoinColumn>();
+ }
+
+ private String buildJoinColumnLabel(IPrimaryKeyJoinColumn joinColumn) {
+ if (joinColumn.getSpecifiedName() == null) {
+ if (joinColumn.getSpecifiedReferencedColumnName() == null) {
+ return NLS.bind(
+ JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsBothDefault,
+ joinColumn.getName(),
+ joinColumn.getReferencedColumnName()
+ );
}
-
- public void widgetSelected(SelectionEvent e) {
+
+ return NLS.bind(
+ JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsFirstDefault,
+ joinColumn.getName(),
+ joinColumn.getReferencedColumnName()
+ );
+ }
+
+ if (joinColumn.getSpecifiedReferencedColumnName() == null) {
+ return NLS.bind(
+ JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsSecDefault,
+ joinColumn.getName(),
+ joinColumn.getReferencedColumnName()
+ );
+ }
+
+ return NLS.bind(
+ JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParams,
+ joinColumn.getName(),
+ joinColumn.getReferencedColumnName()
+ );
+ }
+
+ private Adapter buildJoinColumnsAdapter() {
+ return new AbstractAdapter() {
+ public void addNewItem(ObjectListSelectionModel listSelectionModel) {
addPrimaryKeyJoinColumn();
}
- });
-
- this.pkJoinColumnsEditButton = getWidgetFactory().createButton(
- this.pkJoinColumnsGroup,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_edit,
- SWT.NONE);
- this.pkJoinColumnsEditButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- editPrimaryKeyJoinColumn();
+
+ @Override
+ public boolean hasOptionalButton() {
+ return true;
}
- });
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- this.pkJoinColumnsEditButton.setLayoutData(gridData);
-
- this.pkJoinColumnsRemoveButton = getWidgetFactory().createButton(
- this.pkJoinColumnsGroup,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_remove,
- SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.BEGINNING;
- this.pkJoinColumnsRemoveButton.setLayoutData(gridData);
- this.pkJoinColumnsRemoveButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
+
+ @Override
+ public String optionalButtonText() {
+ return JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_edit;
}
-
- public void widgetSelected(SelectionEvent e) {
- removePrimaryKeyJoinColumn();
+
+ @Override
+ public void optionOnSelection(ObjectListSelectionModel listSelectionModel) {
+ editPrimaryKeyJoinColumn(listSelectionModel);
}
- });
-
- this.pkJoinColumnsListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updatePrimaryKeyJoinColumnsEnablement();
+
+ public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) {
+
+ int[] selectedIndices = listSelectionModel.selectedIndices();
+ IEntity entity = subject();
+
+ for (int index = selectedIndices.length; --index >= 0; ) {
+ entity.removeSpecifiedPrimaryKeyJoinColumn(selectedIndices[index]);
+ }
}
- });
+ };
}
-
- private IContentProvider buildJoinColumnsListContentProvider() {
- return new IStructuredContentProvider(){
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
-
- public void dispose() {
- // do nothing
- }
-
- public Object[] getElements(Object inputElement) {
- return ((IEntity) inputElement).getPrimaryKeyJoinColumns().toArray();
+
+ private ListValueModel<IPrimaryKeyJoinColumn> buildJoinColumnsListHolder() {
+ return new ListAspectAdapter<IEntity, IPrimaryKeyJoinColumn>(
+ getSubjectHolder(),
+ IEntity.DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST,
+ IEntity.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST)
+ {
+ @Override
+ protected ListIterator<IPrimaryKeyJoinColumn> listIterator_() {
+ return subject.primaryKeyJoinColumns();
}
};
}
-
+
private ILabelProvider buildJoinColumnsListLabelProvider() {
return new LabelProvider() {
+ @Override
public String getText(Object element) {
IPrimaryKeyJoinColumn joinColumn = (IPrimaryKeyJoinColumn) element;
- return (PrimaryKeyJoinColumnsComposite.this.entity.containsSpecifiedPrimaryKeyJoinColumns()) ?
- buildJoinColumnLabel(joinColumn)
- :
+ return subject().specifiedPrimaryKeyJoinColumnsSize() > 0 ?
+ buildJoinColumnLabel(joinColumn) :
buildDefaultJoinColumnLabel(joinColumn);
}
};
}
-
- String buildDefaultJoinColumnLabel(IPrimaryKeyJoinColumn joinColumn) {
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
+
+ private WritablePropertyValueModel<Boolean> buildOverrideDefaultJoinColumnHolder() {
+ // TODO
+ return new SimplePropertyValueModel<Boolean>();
}
-
- String buildJoinColumnLabel(IPrimaryKeyJoinColumn joinColumn) {
- if (joinColumn.getSpecifiedName() == null) {
- if (joinColumn.getSpecifiedReferencedColumnName() == null) {
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsBothDefault, joinColumn.getName(),joinColumn.getReferencedColumnName());
+
+ private SelectionAdapter buildOverrideDefaultJoinColumnSelectionListener() {
+ return new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Button button = (Button) e.widget;
+ IEntity entity = subject();
+
+ if (button.getSelection()) {
+ IPrimaryKeyJoinColumn defaultJoinColumn = entity.specifiedPrimaryKeyJoinColumns().next();
+ String columnName = defaultJoinColumn.getDefaultName();
+ String referencedColumnName = defaultJoinColumn.getDefaultReferencedColumnName();
+
+ IPrimaryKeyJoinColumn pkJoinColumn = entity.addSpecifiedPrimaryKeyJoinColumn(0);
+ pkJoinColumn.setSpecifiedName(columnName);
+ pkJoinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
+ }
+ else {
+ for (int index = entity.specifiedPrimaryKeyJoinColumnsSize(); --index >= 0; ) {
+ entity.removeSpecifiedPrimaryKeyJoinColumn(index);
+ }
+ }
}
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsFirstDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- else if (joinColumn.getSpecifiedReferencedColumnName() == null) {
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsSecDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- else {
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParams, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
+ };
}
-
- void addPrimaryKeyJoinColumn() {
- PrimaryKeyJoinColumnDialog dialog = new PrimaryKeyJoinColumnDialog(this.getControl().getShell(), this.entity);
- addJoinColumnFromDialog(dialog);
- }
-
- private void addJoinColumnFromDialog(PrimaryKeyJoinColumnDialog dialog) {
- if (dialog.open() == Window.OK) {
- int index = this.entity.getSpecifiedPrimaryKeyJoinColumns().size();
- String name = dialog.getSelectedName();
- String referencedColumnName = dialog.getReferencedColumnName();
- IPrimaryKeyJoinColumn joinColumn = this.entity.createPrimaryKeyJoinColumn(index);
- this.entity.getSpecifiedPrimaryKeyJoinColumns().add(joinColumn);
- joinColumn.setSpecifiedName(name);
- joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- }
- }
-
- private IPrimaryKeyJoinColumn getSelectedJoinColumn() {
- return (IPrimaryKeyJoinColumn) ((StructuredSelection) this.pkJoinColumnsListViewer.getSelection()).getFirstElement();
+ private ListValueModel/*<IPrimaryKeyJoinColumn>*/ buildSortedJoinColumnsListHolder() {
+ return new SortedListValueModelAdapter<IPrimaryKeyJoinColumn>(
+ buildJoinColumnsListHolder()
+ );
}
- void editPrimaryKeyJoinColumn() {
- IPrimaryKeyJoinColumn joinColumn = getSelectedJoinColumn();
- PrimaryKeyJoinColumnDialog dialog = new PrimaryKeyJoinColumnDialog(this.getControl().getShell(), joinColumn);
- editJoinColumnFromDialog(dialog, joinColumn);
- }
-
- private void editJoinColumnFromDialog(PrimaryKeyJoinColumnDialog dialog, IPrimaryKeyJoinColumn joinColumn) {
- if (dialog.open() == Window.OK) {
- editJoinColumnDialogOkd(dialog, joinColumn);
- }
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void doPopulate() {
+ super.doPopulate();
+ overrideDefaultJoinColumnsCheckBox.setSelection(subject().specifiedPrimaryKeyJoinColumnsSize() > 0);
}
-
- private void editJoinColumnDialogOkd(PrimaryKeyJoinColumnDialog dialog, IPrimaryKeyJoinColumn joinColumn) {
- String name = dialog.getSelectedName();
- String referencedColumnName = dialog.getReferencedColumnName();
- if (dialog.isDefaultNameSelected()) {
+ private void editJoinColumn(PrimaryKeyJoinColumnStateObject stateObject) {
+
+ IPrimaryKeyJoinColumn joinColumn = stateObject.getJoinColumn();
+
+ String name = stateObject.getSelectedName();
+ String referencedColumnName = stateObject.getSpecifiedReferencedColumnName();
+
+ // Name
+ if (stateObject.isDefaultNameSelected()) {
if (joinColumn.getSpecifiedName() != null) {
joinColumn.setSpecifiedName(null);
}
}
- else if (joinColumn.getSpecifiedName() == null || !joinColumn.getSpecifiedName().equals(name)){
+ else if (joinColumn.getSpecifiedName() == null ||
+ !joinColumn.getSpecifiedName().equals(name)){
+
joinColumn.setSpecifiedName(name);
}
-
- if (dialog.isDefaultReferencedColumnNameSelected()) {
+
+ // Referenced Column Name
+ if (stateObject.isDefaultReferencedColumnNameSelected()) {
if (joinColumn.getSpecifiedReferencedColumnName() != null) {
joinColumn.setSpecifiedReferencedColumnName(null);
}
}
- else if (joinColumn.getSpecifiedReferencedColumnName() == null || !joinColumn.getSpecifiedReferencedColumnName().equals(referencedColumnName)){
+ else if (joinColumn.getSpecifiedReferencedColumnName() == null ||
+ !joinColumn.getSpecifiedReferencedColumnName().equals(referencedColumnName)){
+
joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
}
}
-
- void removePrimaryKeyJoinColumn() {
- ISelection selection = this.pkJoinColumnsListViewer.getSelection();
- if (selection instanceof StructuredSelection) {
- for (Iterator i = ((StructuredSelection) selection).iterator(); i.hasNext(); ) {
- this.entity.getPrimaryKeyJoinColumns().remove(i.next());
- }
- }
- }
-
- void updatePrimaryKeyJoinColumnsEnablement() {
- boolean groupEnabledState = this.entity.containsSpecifiedPrimaryKeyJoinColumns();
- enableGroup(this.pkJoinColumnsGroup, groupEnabledState);
- this.pkJoinColumnsRemoveButton.setEnabled(groupEnabledState && !((StructuredSelection) this.pkJoinColumnsListViewer.getSelection()).isEmpty());
- this.pkJoinColumnsEditButton.setEnabled(groupEnabledState && ((StructuredSelection) this.pkJoinColumnsListViewer.getSelection()).size() == 1);
- }
-
- private void enableGroup(Group group, boolean enabled) {
- group.setEnabled(enabled);
- for (int i = 0; i < group.getChildren().length; i++) {
- group.getChildren()[i].setEnabled(enabled);
- }
- }
-
-
- public void doPopulate(EObject obj) {
- this.entity = (IEntity) obj;
- if (this.entity == null) {
- this.pkJoinColumnsListViewer.setInput(null);
- return;
- }
-
- this.pkJoinColumnsListViewer.setInput(this.entity);
-
+ private void editPrimaryKeyJoinColumn(ObjectListSelectionModel listSelectionModel) {
- updatePrimaryKeyJoinColumnsEnablement();
- this.overrideDefaultJoinColumnsCheckBox.setSelection(this.entity.containsSpecifiedPrimaryKeyJoinColumns());
+ IPrimaryKeyJoinColumn joinColumn = (IPrimaryKeyJoinColumn) listSelectionModel.selectedValue();
+
+ PrimaryKeyJoinColumnDialog dialog = new PrimaryKeyJoinColumnDialog(shell(), joinColumn);
+ dialog.openDialog(buildEditPrimaryKeyJoinColumnPostExecution());
}
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void doPopulate() {
- }
+ protected void initializeLayout(Composite container) {
- protected void engageListeners() {
- if (this.entity != null) {
- this.entity.eAdapters().add(this.entityListener);
- for (IPrimaryKeyJoinColumn pkJoinColumn : this.entity.getPrimaryKeyJoinColumns()) {
- pkJoinColumn.eAdapters().add(this.pkJoinColumnListener);
- }
- //this.addConnectionListener();
- }
- }
-
- protected void disengageListeners() {
- if (this.entity != null) {
- //this.removeConnectionListener();
- for (IPrimaryKeyJoinColumn pkJoinColumn : this.entity.getPrimaryKeyJoinColumns()) {
- pkJoinColumn.eAdapters().remove(this.pkJoinColumnListener);
- }
- this.entity.eAdapters().remove(this.entityListener);
- }
- }
-
- protected void entityChanged(Notification notification) {
- if (notification.getFeatureID(IEntity.class) == JpaCoreMappingsPackage.IENTITY__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS) {
- if (notification.getEventType() == Notification.ADD) {
- ((IPrimaryKeyJoinColumn) notification.getNewValue()).eAdapters().add(this.pkJoinColumnListener);
- }
- else if (notification.getEventType() == Notification.REMOVE) {
- ((IPrimaryKeyJoinColumn) notification.getOldValue()).eAdapters().remove(this.pkJoinColumnListener);
- }
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- pkJoinColumnsListViewer.refresh();
- overrideDefaultJoinColumnsCheckBox.setSelection(entity.containsSpecifiedPrimaryKeyJoinColumns());
- updatePrimaryKeyJoinColumnsEnablement();
- }
- });
- }
- }
+ int groupBoxMargin = groupBoxMargin();
- protected void pkJoinColumnChanged(Notification notification) {
- if (notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__SPECIFIED_NAME
- || notification.getFeatureID(IAbstractJoinColumn.class) == JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME
- || notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME
- || notification.getFeatureID(IAbstractJoinColumn.class) == JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- pkJoinColumnsListViewer.refresh();
- }
- });
- }
+ // Override Default Join Columns check box
+ overrideDefaultJoinColumnsCheckBox = buildCheckBox(
+ buildSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin),
+ JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_overrideDefaultPrimaryKeyJoinColumns,
+ buildOverrideDefaultJoinColumnHolder());
+
+ overrideDefaultJoinColumnsCheckBox.addSelectionListener(
+ buildOverrideDefaultJoinColumnSelectionListener()
+ );
+
+ // Primary Key Join Columns group pane
+ Group pkJoinColumnsGroup = buildTitledPane(
+ container,
+ JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_primaryKeyJoinColumn
+ );
+
+ // Primary Key Join Columns list pane
+ new AddRemoveListPane<IEntity>(
+ this,
+ pkJoinColumnsGroup,
+ buildJoinColumnsAdapter(),
+ buildSortedJoinColumnsListHolder(),
+ buildJoinColumnHolder(),
+ buildJoinColumnsListLabelProvider(),
+ IJpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS
+ );
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsInSecondaryTableComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsInSecondaryTableComposite.java
index 8b06e17166..17266c904c 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsInSecondaryTableComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/PrimaryKeyJoinColumnsInSecondaryTableComposite.java
@@ -1,413 +1,415 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
-import java.util.Iterator;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IContentProvider;
+import java.util.ListIterator;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.mappings.IAbstractJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.INamedColumn;
-import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
+import org.eclipse.jpt.core.internal.context.base.IPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.ISecondaryTable;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.util.ControlEnabler;
+import org.eclipse.jpt.ui.internal.util.PaneEnabler;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane;
+import org.eclipse.jpt.ui.internal.widgets.AddRemovePane;
+import org.eclipse.jpt.ui.internal.widgets.PostExecution;
+import org.eclipse.jpt.utility.internal.model.event.ListChangeEvent;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class PrimaryKeyJoinColumnsInSecondaryTableComposite extends BaseJpaComposite
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | |
+ * | x Override Default |
+ * | |
+ * | - Primary Key Join Columns ---------------------------------------------- |
+ * | | | |
+ * | | AddRemoveListPane | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see ISecondaryTable
+ * @see EntityComposite - The container of this pane
+ * @see AddRemoveListPane
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class PrimaryKeyJoinColumnsInSecondaryTableComposite extends AbstractFormPane<ISecondaryTable>
{
- private ISecondaryTable secondaryTable;
- private final Adapter secondaryTableListener;
- private final Adapter pkJoinColumnListener;
-
- ListViewer pkJoinColumnsListViewer;
-
- private Group pkJoinColumnsGroup;
- Button overrideDefaultJoinColumnsCheckBox;
- private Button pkJoinColumnsAddButton;
- private Button pkJoinColumnsRemoveButton;
- private Button pkJoinColumnsEditButton;
-
-
- public PrimaryKeyJoinColumnsInSecondaryTableComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.secondaryTableListener = buildSecondaryTableListener();
- this.pkJoinColumnListener = buildPkJoinColumnListener();
+ /**
+ * Creates a new <code>PrimaryKeyJoinColumnsInSecondaryTableComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ */
+ public PrimaryKeyJoinColumnsInSecondaryTableComposite(AbstractFormPane<?> parentPane,
+ PropertyValueModel<? extends ISecondaryTable> subjectHolder,
+ Composite parent) {
+
+ super(parentPane, subjectHolder, parent);
+ }
+
+ /**
+ * Creates a new <code>PrimaryKeyJoinColumnsInSecondaryTableComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>ISecondaryTable</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public PrimaryKeyJoinColumnsInSecondaryTableComposite(PropertyValueModel<? extends ISecondaryTable> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ private void addJoinColumn(PrimaryKeyJoinColumnInSecondaryTableStateObject stateObject) {
+
+ ISecondaryTable secondaryTable = stateObject.getSecondaryTable();
+ int index = secondaryTable.specifiedPrimaryKeyJoinColumnsSize();
+
+ IPrimaryKeyJoinColumn joinColumn = secondaryTable.addSpecifiedPrimaryKeyJoinColumn(index);
+ joinColumn.setSpecifiedName(stateObject.getSelectedName());
+ joinColumn.setSpecifiedReferencedColumnName(stateObject.getSpecifiedReferencedColumnName());
}
-
- private Adapter buildSecondaryTableListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- secondaryTableChanged(notification);
+
+ private void addPrimaryKeyJoinColumn() {
+
+ PrimaryKeyJoinColumnInSecondaryTableDialog dialog =
+ new PrimaryKeyJoinColumnInSecondaryTableDialog(shell(), subject());
+
+ dialog.openDialog(buildAddPrimaryKeyJoinColumnPostExecution());
+ }
+
+ private PostExecution<PrimaryKeyJoinColumnInSecondaryTableDialog> buildAddPrimaryKeyJoinColumnPostExecution() {
+ return new PostExecution<PrimaryKeyJoinColumnInSecondaryTableDialog>() {
+ public void execute(PrimaryKeyJoinColumnInSecondaryTableDialog dialog) {
+ if (dialog.wasConfirmed()) {
+ addJoinColumn(dialog.subject());
+ }
}
};
}
-
- private Adapter buildPkJoinColumnListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- pkJoinColumnChanged(notification);
+
+ private PropertyValueModel<Boolean> buildControlBooleanHolder() {
+ return new TransformationPropertyValueModel<ISecondaryTable, Boolean>(getSubjectHolder()) {
+ @Override
+ protected Boolean transform(ISecondaryTable value) {
+ return (value != null);
}
};
}
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- GridData gridData = new GridData();
- this.overrideDefaultJoinColumnsCheckBox = getWidgetFactory().createButton(
- composite,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_overrideDefaultPrimaryKeyJoinColumns,
- SWT.CHECK);
- this.overrideDefaultJoinColumnsCheckBox.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- if (PrimaryKeyJoinColumnsInSecondaryTableComposite.this.overrideDefaultJoinColumnsCheckBox.getSelection()) {
- IPrimaryKeyJoinColumn defaultJoinColumn = PrimaryKeyJoinColumnsInSecondaryTableComposite.this.secondaryTable.getDefaultPrimaryKeyJoinColumns().get(0);
- String columnName = defaultJoinColumn.getDefaultName();
- String referencedColumnName = defaultJoinColumn.getDefaultReferencedColumnName();
-
- IPrimaryKeyJoinColumn pkJoinColumn = PrimaryKeyJoinColumnsInSecondaryTableComposite.this.secondaryTable.createPrimaryKeyJoinColumn(0);
- PrimaryKeyJoinColumnsInSecondaryTableComposite.this.secondaryTable.getSpecifiedPrimaryKeyJoinColumns().add(pkJoinColumn);
- pkJoinColumn.setSpecifiedName(columnName);
- pkJoinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- } else {
- PrimaryKeyJoinColumnsInSecondaryTableComposite.this.secondaryTable.getSpecifiedPrimaryKeyJoinColumns().clear();
+
+ private String buildDefaultJoinColumnLabel(IPrimaryKeyJoinColumn joinColumn) {
+ return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
+ }
+
+ private PostExecution<PrimaryKeyJoinColumnInSecondaryTableDialog> buildEditPrimaryKeyJoinColumnPostExecution() {
+ return new PostExecution<PrimaryKeyJoinColumnInSecondaryTableDialog>() {
+ public void execute(PrimaryKeyJoinColumnInSecondaryTableDialog dialog) {
+ if (dialog.wasConfirmed()) {
+ editPrimaryKeyJoinColumn(dialog.subject());
}
}
- });
-
- this.pkJoinColumnsGroup =
- getWidgetFactory().createGroup(
- composite,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_primaryKeyJoinColumn);
- this.pkJoinColumnsGroup.setLayout(new GridLayout(2, false));
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- this.pkJoinColumnsGroup.setLayoutData(gridData);
-
- this.pkJoinColumnsListViewer = new ListViewer(this.pkJoinColumnsGroup, SWT.BORDER | SWT.MULTI);
- this.pkJoinColumnsListViewer.setContentProvider(buildJoinColumnsListContentProvider());
- this.pkJoinColumnsListViewer.setLabelProvider(buildJoinColumnsListLabelProvider());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.verticalSpan = 3;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.pkJoinColumnsListViewer.getList().setLayoutData(gridData);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(this.pkJoinColumnsListViewer.getList(), IJpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS);
-
- this.pkJoinColumnsAddButton = getWidgetFactory().createButton(
- this.pkJoinColumnsGroup,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_add,
- SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- this.pkJoinColumnsAddButton.setLayoutData(gridData);
- this.pkJoinColumnsAddButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- addPrimaryKeyJoinColumn();
- }
- });
-
- this.pkJoinColumnsEditButton = getWidgetFactory().createButton(
- this.pkJoinColumnsGroup,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_edit,
- SWT.NONE);
- this.pkJoinColumnsEditButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- editPrimaryKeyJoinColumn();
- }
- });
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- this.pkJoinColumnsEditButton.setLayoutData(gridData);
-
- this.pkJoinColumnsRemoveButton = getWidgetFactory().createButton(
- this.pkJoinColumnsGroup,
- JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_remove,
- SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.BEGINNING;
- this.pkJoinColumnsRemoveButton.setLayoutData(gridData);
- this.pkJoinColumnsRemoveButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- removePrimaryKeyJoinColumn();
- }
- });
-
- this.pkJoinColumnsListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updatePrimaryKeyJoinColumnsEnablement();
- }
- });
+ };
}
-
- private IContentProvider buildJoinColumnsListContentProvider() {
- return new IStructuredContentProvider(){
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
-
- public void dispose() {
- // do nothing
- }
-
- public Object[] getElements(Object inputElement) {
- return ((ISecondaryTable) inputElement).getPrimaryKeyJoinColumns().toArray();
+
+ private String buildJoinColumnLabel(IPrimaryKeyJoinColumn joinColumn) {
+ if (joinColumn.getSpecifiedName() == null) {
+ if (joinColumn.getSpecifiedReferencedColumnName() == null) {
+ return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsBothDefault, joinColumn.getName(),joinColumn.getReferencedColumnName());
}
- };
+ return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsFirstDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
+ }
+
+ if (joinColumn.getSpecifiedReferencedColumnName() == null) {
+ return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsSecDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
+ }
+
+ return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParams, joinColumn.getName(), joinColumn.getReferencedColumnName());
}
-
+
private ILabelProvider buildJoinColumnsListLabelProvider() {
return new LabelProvider() {
+ @Override
public String getText(Object element) {
IPrimaryKeyJoinColumn joinColumn = (IPrimaryKeyJoinColumn) element;
- return (PrimaryKeyJoinColumnsInSecondaryTableComposite.this.secondaryTable.containsSpecifiedPrimaryKeyJoinColumns()) ?
- buildJoinColumnLabel(joinColumn)
- :
+ return subject().specifiedPrimaryKeyJoinColumnsSize() > 0 ?
+ buildJoinColumnLabel(joinColumn) :
buildDefaultJoinColumnLabel(joinColumn);
}
};
}
-
- String buildDefaultJoinColumnLabel(IPrimaryKeyJoinColumn joinColumn) {
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
+
+ private WritablePropertyValueModel<Boolean> buildOverrideDefaultHolder() {
+ return new OverrideDefaultValueModel(getSubjectHolder());
}
-
- String buildJoinColumnLabel(IPrimaryKeyJoinColumn joinColumn) {
- if (joinColumn.getSpecifiedName() == null) {
- if (joinColumn.getSpecifiedReferencedColumnName() == null) {
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsBothDefault, joinColumn.getName(),joinColumn.getReferencedColumnName());
+
+ private AddRemovePane.Adapter buildPrimaryKeyJoinColumnAdapter() {
+ return new AddRemovePane.AbstractAdapter() {
+ public void addNewItem(ObjectListSelectionModel listSelectionModel) {
+ addPrimaryKeyJoinColumn();
+ }
+
+ @Override
+ public boolean hasOptionalButton() {
+ return true;
+ }
+
+ @Override
+ public String optionalButtonText() {
+ return JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_edit;
}
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsFirstDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- else if (joinColumn.getSpecifiedReferencedColumnName() == null) {
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParamsSecDefault, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- else {
- return NLS.bind(JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_mappingBetweenTwoParams, joinColumn.getName(), joinColumn.getReferencedColumnName());
- }
- }
-
- void addPrimaryKeyJoinColumn() {
- PrimaryKeyJoinColumnInSecondaryTableDialog dialog = new PrimaryKeyJoinColumnInSecondaryTableDialog(this.getControl().getShell(), this.secondaryTable);
- addJoinColumnFromDialog(dialog);
+ @Override
+ public void optionOnSelection(ObjectListSelectionModel listSelectionModel) {
+ editPrimaryKeyJoinColumn(listSelectionModel);
+ }
+
+ public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) {
+ removePrimaryKeyJoinColumn(listSelectionModel);
+ }
+ };
}
-
- private void addJoinColumnFromDialog(PrimaryKeyJoinColumnInSecondaryTableDialog dialog) {
- if (dialog.open() == Window.OK) {
- int index = this.secondaryTable.getSpecifiedPrimaryKeyJoinColumns().size();
- String name = dialog.getSelectedName();
- String referencedColumnName = dialog.getReferencedColumnName();
- IPrimaryKeyJoinColumn joinColumn = this.secondaryTable.createPrimaryKeyJoinColumn(index);
- this.secondaryTable.getSpecifiedPrimaryKeyJoinColumns().add(joinColumn);
- joinColumn.setSpecifiedName(name);
- joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
- }
+
+ private WritablePropertyValueModel<IPrimaryKeyJoinColumn> buildPrimaryKeyJoinColumnHolder() {
+ return new SimplePropertyValueModel<IPrimaryKeyJoinColumn>();
}
-
- private IPrimaryKeyJoinColumn getSelectedJoinColumn() {
- return (IPrimaryKeyJoinColumn) ((StructuredSelection) this.pkJoinColumnsListViewer.getSelection()).getFirstElement();
+
+ private ListValueModel<IPrimaryKeyJoinColumn> buildPrimaryKeyJoinColumnListHolder() {
+ return new ListAspectAdapter<ISecondaryTable, IPrimaryKeyJoinColumn>(
+ getSubjectHolder(),
+ ISecondaryTable.DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST,
+ ISecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST)
+ {
+ @Override
+ protected ListIterator<IPrimaryKeyJoinColumn> listIterator_() {
+ return subject.primaryKeyJoinColumns();
+ }
+ };
}
- void editPrimaryKeyJoinColumn() {
- IPrimaryKeyJoinColumn joinColumn = getSelectedJoinColumn();
- PrimaryKeyJoinColumnInSecondaryTableDialog dialog = new PrimaryKeyJoinColumnInSecondaryTableDialog(this.getControl().getShell(), joinColumn);
- editJoinColumnFromDialog(dialog, joinColumn);
+ private ListValueModel<IPrimaryKeyJoinColumn> buildSortedPrimaryKeyJoinColumnListHolder() {
+ return new SortedListValueModelAdapter<IPrimaryKeyJoinColumn>(
+ buildPrimaryKeyJoinColumnListHolder()
+ );
}
-
- private void editJoinColumnFromDialog(PrimaryKeyJoinColumnInSecondaryTableDialog dialog, IPrimaryKeyJoinColumn joinColumn) {
- if (dialog.open() == Window.OK) {
- editJoinColumnDialogOkd(dialog, joinColumn);
- }
+
+ private void editPrimaryKeyJoinColumn(ObjectListSelectionModel listSelectionModel) {
+
+ IPrimaryKeyJoinColumn joinColumn = (IPrimaryKeyJoinColumn) listSelectionModel.selectedValue();
+
+ PrimaryKeyJoinColumnInSecondaryTableDialog dialog =
+ new PrimaryKeyJoinColumnInSecondaryTableDialog(shell(), joinColumn);
+
+ dialog.openDialog(buildEditPrimaryKeyJoinColumnPostExecution());
}
-
- private void editJoinColumnDialogOkd(PrimaryKeyJoinColumnInSecondaryTableDialog dialog, IPrimaryKeyJoinColumn joinColumn) {
- String name = dialog.getSelectedName();
- String referencedColumnName = dialog.getReferencedColumnName();
- if (dialog.isDefaultNameSelected()) {
+ private void editPrimaryKeyJoinColumn(PrimaryKeyJoinColumnInSecondaryTableStateObject stateObject) {
+ IPrimaryKeyJoinColumn joinColumn = stateObject.getJoinColumn();
+ String name = stateObject.getSelectedName();
+ String referencedColumnName = stateObject.getSpecifiedReferencedColumnName();
+
+ // Name
+ if (stateObject.isDefaultNameSelected()) {
if (joinColumn.getSpecifiedName() != null) {
joinColumn.setSpecifiedName(null);
}
}
- else if (joinColumn.getSpecifiedName() == null || !joinColumn.getSpecifiedName().equals(name)){
+ else if (joinColumn.getSpecifiedName() == null ||
+ !joinColumn.getSpecifiedName().equals(name)){
+
joinColumn.setSpecifiedName(name);
}
-
- if (dialog.isDefaultReferencedColumnNameSelected()) {
+
+ // Referenced Column Name
+ if (stateObject.isDefaultReferencedColumnNameSelected()) {
if (joinColumn.getSpecifiedReferencedColumnName() != null) {
joinColumn.setSpecifiedReferencedColumnName(null);
}
}
- else if (joinColumn.getSpecifiedReferencedColumnName() == null || !joinColumn.getSpecifiedReferencedColumnName().equals(referencedColumnName)){
+ else if (joinColumn.getSpecifiedReferencedColumnName() == null ||
+ !joinColumn.getSpecifiedReferencedColumnName().equals(referencedColumnName)){
+
joinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
}
}
-
- void removePrimaryKeyJoinColumn() {
- ISelection selection = this.pkJoinColumnsListViewer.getSelection();
- if (selection instanceof StructuredSelection) {
- for (Iterator i = ((StructuredSelection) selection).iterator(); i.hasNext(); ) {
- this.secondaryTable.getPrimaryKeyJoinColumns().remove(i.next());
- }
- }
- }
-
- void updatePrimaryKeyJoinColumnsEnablement() {
- boolean groupEnabledState = this.secondaryTable.containsSpecifiedPrimaryKeyJoinColumns();
- enableGroup(this.pkJoinColumnsGroup, groupEnabledState);
- this.pkJoinColumnsRemoveButton.setEnabled(groupEnabledState && !((StructuredSelection) this.pkJoinColumnsListViewer.getSelection()).isEmpty());
- this.pkJoinColumnsEditButton.setEnabled(groupEnabledState && ((StructuredSelection) this.pkJoinColumnsListViewer.getSelection()).size() == 1);
- }
-
- private void enableGroup(Group group, boolean enabled) {
- group.setEnabled(enabled);
- for (int i = 0; i < group.getChildren().length; i++) {
- group.getChildren()[i].setEnabled(enabled);
- }
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ int groupBoxMargin = groupBoxMargin();
+
+ // Override Default check box
+ Button overrideDefaultButton = buildCheckBox(
+ buildSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin),
+ JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_overrideDefaultPrimaryKeyJoinColumns,
+ buildOverrideDefaultHolder()
+ );
+
+ installOverrideDefaultButtonEnabler(overrideDefaultButton);
+
+ // Primary Key Join Columns group pane
+ container = buildTitledPane(
+ container,
+ JptUiMappingsMessages.PrimaryKeyJoinColumnsComposite_primaryKeyJoinColumn
+ );
+
+ // Primary Key Join Columns add/remove list pane
+ AddRemoveListPane<ISecondaryTable> pkJoinColumnListPane = new AddRemoveListPane<ISecondaryTable>(
+ this,
+ container,
+ buildPrimaryKeyJoinColumnAdapter(),
+ buildSortedPrimaryKeyJoinColumnListHolder(),
+ buildPrimaryKeyJoinColumnHolder(),
+ buildJoinColumnsListLabelProvider()
+ );
+
+ helpSystem().setHelp(
+ pkJoinColumnListPane.getControl(),
+ IJpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS
+ );
+
+ installPrimaryKeyJoinColumnListPaneEnabler(pkJoinColumnListPane);
}
-
-
- public void doPopulate(EObject obj) {
- this.secondaryTable = (ISecondaryTable) obj;
- if (this.secondaryTable == null) {
- this.pkJoinColumnsListViewer.setInput(null);
- return;
- }
-
- this.pkJoinColumnsListViewer.setInput(this.secondaryTable);
-
- updatePrimaryKeyJoinColumnsEnablement();
- this.overrideDefaultJoinColumnsCheckBox.setSelection(this.secondaryTable.containsSpecifiedPrimaryKeyJoinColumns());
+ private void installOverrideDefaultButtonEnabler(Button overrideDefaultButton) {
+
+ new ControlEnabler(
+ buildControlBooleanHolder(),
+ overrideDefaultButton
+ );
}
- @Override
- protected void doPopulate() {
+ private void installPrimaryKeyJoinColumnListPaneEnabler(AddRemoveListPane<ISecondaryTable> pkJoinColumnListPane) {
+
+ new PaneEnabler(
+ buildControlBooleanHolder(),
+ pkJoinColumnListPane
+ );
}
- protected void engageListeners() {
- if (this.secondaryTable != null) {
- this.secondaryTable.eAdapters().add(this.secondaryTableListener);
- for (IPrimaryKeyJoinColumn pkJoinColumn : this.secondaryTable.getPrimaryKeyJoinColumns()) {
- pkJoinColumn.eAdapters().add(this.pkJoinColumnListener);
- }
+ private void removePrimaryKeyJoinColumn(ObjectListSelectionModel listSelectionModel) {
+ int[] selectedIndices = listSelectionModel.selectedIndices();
+
+ for (int index = selectedIndices.length; --index > 0; ) {
+ subject().removeSpecifiedPrimaryKeyJoinColumn(selectedIndices[index]);
}
}
-
- protected void disengageListeners() {
- if (this.secondaryTable != null) {
- for (IPrimaryKeyJoinColumn pkJoinColumn : this.secondaryTable.getPrimaryKeyJoinColumns()) {
- pkJoinColumn.eAdapters().remove(this.pkJoinColumnListener);
- }
- this.secondaryTable.eAdapters().remove(this.secondaryTableListener);
+
+ private class OverrideDefaultValueModel extends TransformationPropertyValueModel<ISecondaryTable, Boolean>
+ implements WritablePropertyValueModel<Boolean>
+ {
+ OverrideDefaultValueModel(PropertyValueModel<ISecondaryTable> valueHolder) {
+ super(valueHolder);
+ engageListChangeListener(valueHolder);
}
- }
-
- protected void secondaryTableChanged(Notification notification) {
- if (notification.getFeatureID(ISecondaryTable.class) == JpaCoreMappingsPackage.ISECONDARY_TABLE__SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS) {
- if (notification.getEventType() == Notification.ADD) {
- ((IPrimaryKeyJoinColumn) notification.getNewValue()).eAdapters().add(this.pkJoinColumnListener);
- }
- else if (notification.getEventType() == Notification.REMOVE) {
- ((IPrimaryKeyJoinColumn) notification.getOldValue()).eAdapters().remove(this.pkJoinColumnListener);
- }
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- pkJoinColumnsListViewer.refresh();
- overrideDefaultJoinColumnsCheckBox.setSelection(secondaryTable.containsSpecifiedPrimaryKeyJoinColumns());
- updatePrimaryKeyJoinColumnsEnablement();
+
+ private void engageListChangeListener(PropertyValueModel<ISecondaryTable> valueHolder) {
+ new ListAspectAdapter<ISecondaryTable, IPrimaryKeyJoinColumn>(valueHolder, ISecondaryTable.SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST) {
+ @Override
+ protected void itemsAdded(ListChangeEvent e) {
+ super.itemsAdded(e);
+ valueChanged(e);
+ }
+
+ @Override
+ protected void itemsMoved(ListChangeEvent e) {
+ super.itemsMoved(e);
+ valueChanged(e);
+ }
+
+ @Override
+ protected void itemsRemoved(ListChangeEvent e) {
+ super.itemsRemoved(e);
+ valueChanged(e);
+ }
+
+ @Override
+ protected void itemsReplaced(ListChangeEvent e) {
+ super.itemsReplaced(e);
+ valueChanged(e);
+ }
+
+ @Override
+ protected void listChanged(ListChangeEvent e) {
+ super.listChanged(e);
+ valueChanged(e);
+ }
+
+ @Override
+ protected void listCleared(ListChangeEvent e) {
+ super.listCleared(e);
+ valueChanged(e);
}
- });
+
+ @Override
+ protected ListIterator<IPrimaryKeyJoinColumn> listIterator_() {
+ return subject.specifiedPrimaryKeyJoinColumns();
+ }
+
+ @Override
+ protected int size_() {
+ return subject.specifiedPrimaryKeyJoinColumnsSize();
+ }
+
+ private void valueChanged(ListChangeEvent e) {
+ PropertyChangeEvent event = new PropertyChangeEvent(e.getSource(), e.aspectName(), null, subject);
+ OverrideDefaultValueModel.this.valueChanged(event);
+ }
+ };
}
- }
- protected void pkJoinColumnChanged(Notification notification) {
- if (notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__SPECIFIED_NAME
- || notification.getFeatureID(IAbstractJoinColumn.class) == JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__SPECIFIED_REFERENCED_COLUMN_NAME
- || notification.getFeatureID(INamedColumn.class) == JpaCoreMappingsPackage.INAMED_COLUMN__DEFAULT_NAME
- || notification.getFeatureID(IAbstractJoinColumn.class) == JpaCoreMappingsPackage.IABSTRACT_JOIN_COLUMN__DEFAULT_REFERENCED_COLUMN_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- pkJoinColumnsListViewer.refresh();
+ public void setValue(Boolean value) {
+ ISecondaryTable secondaryTable = subject();
+
+ if (value) {
+ IPrimaryKeyJoinColumn defaultJoinColumn = secondaryTable.defaultPrimaryKeyJoinColumns().next();
+ String columnName = defaultJoinColumn.getDefaultName();
+ String referencedColumnName = defaultJoinColumn.getDefaultReferencedColumnName();
+
+ IPrimaryKeyJoinColumn pkJoinColumn = secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0);
+ pkJoinColumn.setSpecifiedName(columnName);
+ pkJoinColumn.setSpecifiedReferencedColumnName(referencedColumnName);
+ }
+ else {
+ for (int index = secondaryTable.specifiedPrimaryKeyJoinColumnsSize(); --index >= 0; ) {
+ secondaryTable.removeSpecifiedPrimaryKeyJoinColumn(index);
}
- });
+ }
}
- }
-
- protected void enableWidgets(boolean enabled) {
- this.pkJoinColumnsListViewer.getControl().setEnabled(enabled);
- this.overrideDefaultJoinColumnsCheckBox.setEnabled(enabled);
- this.pkJoinColumnsEditButton.setEnabled(enabled);
- this.pkJoinColumnsRemoveButton.setEnabled(enabled);
- this.pkJoinColumnsAddButton.setEnabled(enabled);
- }
-}
+ @Override
+ protected Boolean transform_(ISecondaryTable value) {
+ return value.specifiedPrimaryKeyJoinColumnsSize() > 0;
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SchemaCombo.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SchemaCombo.java
deleted file mode 100644
index f5b11b34b4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SchemaCombo.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.ConnectionListener;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.Database;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class SchemaCombo extends BaseJpaController
-{
- private ITable table;
-
- private Adapter listener;
-
- /**
- * Caching the connectionProfile so we can remove the listener. If the
- * cached table object has been removed from the model then we no longer
- * have access to the parent and cannot find the connectionProfile
- */
- private ConnectionProfile connectionProfile;
-
- private ConnectionListener connectionListener;
-
- private CCombo combo;
-
- public SchemaCombo(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- this.listener = this.buildTableListener();
- this.connectionListener = this.buildConnectionListener();
- }
-
- private Adapter buildTableListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- SchemaCombo.this.schemaChanged(notification);
- }
- };
- }
-
- private ConnectionListener buildConnectionListener() {
- return new ConnectionListener() {
- public void aboutToClose(ConnectionProfile profile) {
- // not interested to this event.
- }
-
- public void closed(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- SchemaCombo.this.populateShemaCombo();
- }
- });
- }
-
- public void modified(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- SchemaCombo.this.populateShemaCombo();
- }
- });
- }
-
- public boolean okToClose(ConnectionProfile profile) {
- // not interested to this event.
- return true;
- }
-
- public void opened(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- SchemaCombo.this.populateShemaCombo();
- }
- });
- }
-
- public void databaseChanged(ConnectionProfile profile, final Database database) {
- getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (database == SchemaCombo.this.getDatabase()) {
- if (!getControl().isDisposed()) {
- SchemaCombo.this.populateShemaCombo();
- }
- }
- }
- });
- }
-
- public void schemaChanged(ConnectionProfile profile, final Schema schema) {
- getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (schema == SchemaCombo.this.getTableSchema()) {
- if (!getControl().isDisposed()) {
- SchemaCombo.this.populateShemaCombo();
- }
- }
- }
- });
- }
-
- public void tableChanged(ConnectionProfile profile, final Table table) {
- // not interested to this event.
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- this.combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- this.combo.add(JptUiMappingsMessages.TableComposite_defaultEmpty);
- this.combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String schemaText = ((CCombo) e.getSource()).getText();
- if (schemaText.equals("")) { //$NON-NLS-1$
- schemaText = null;
- if (SchemaCombo.this.table.getSpecifiedSchema() == null || SchemaCombo.this.table.getSpecifiedSchema().equals("")) { //$NON-NLS-1$
- return;
- }
- }
- if (schemaText != null && combo.getItemCount() > 0 && schemaText.equals(combo.getItem(0))) {
- schemaText = null;
- }
- if (SchemaCombo.this.table.getSpecifiedSchema() == null && schemaText != null) {
- SchemaCombo.this.table.setSpecifiedSchema(schemaText);
- }
- if (SchemaCombo.this.table.getSpecifiedSchema() != null && !SchemaCombo.this.table.getSpecifiedSchema().equals(schemaText)) {
- SchemaCombo.this.table.setSpecifiedSchema(schemaText);
- }
- }
- });
- }
-
- protected void schemaChanged(Notification notification) {
- if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__SPECIFIED_SCHEMA) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- SchemaCombo.this.populateSchemaName();
- }
- });
- }
- else if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__DEFAULT_SCHEMA) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- SchemaCombo.this.populateDefaultSchemaName();
- }
- });
- }
- else if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__DEFAULT_CATALOG) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- SchemaCombo.this.populateShemaCombo();
- }
- });
- }
- else if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__SPECIFIED_CATALOG) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- SchemaCombo.this.populateShemaCombo();
- }
- });
- }
- }
-
- public void doPopulate(EObject obj) {
- this.table = (ITable) obj;
- if (this.table != null) {
- this.populateShemaCombo();
- }
- else {
- this.connectionProfile = null;
- }
- }
-
- public void doPopulate() {
- this.populateShemaCombo();
- }
-
- protected Database getDatabase() {
- return this.getConnectionProfile().getDatabase();
- }
-
- private ConnectionProfile getConnectionProfile() {
- if (this.connectionProfile == null) {
- this.connectionProfile = this.table.getJpaProject().connectionProfile();
- }
- return this.connectionProfile;
- }
-
- private void populateShemaCombo() {
- if (this.table == null) {
- return;
- }
- this.populateDefaultSchemaName();
- if (this.getConnectionProfile().isConnected()) {
- this.combo.remove(1, this.combo.getItemCount() - 1);
- Database database = this.getDatabase();
- if (database != null) {
- Iterator<String> schemata = database.schemaNames();
- for (Iterator<String> stream = CollectionTools.sort(schemata); stream.hasNext();) {
- this.combo.add(stream.next());
- }
- }
- }
- else {
- this.combo.remove(1, this.combo.getItemCount() - 1);
- }
- this.populateSchemaName();
- }
-
- protected void populateDefaultSchemaName() {
- String defaultSchemaName = this.table.getDefaultSchema();
- int selectionIndex = combo.getSelectionIndex();
- combo.setItem(0, NLS.bind(JptUiMappingsMessages.TableComposite_defaultWithOneParam, defaultSchemaName));
- if (selectionIndex == 0) {
- combo.clearSelection();
- combo.select(0);
- }
- }
-
- protected void populateSchemaName() {
- if (this.table == null) {
- return;
- }
- String schemaName = this.table.getSpecifiedSchema();
- String defaultSchemaName = this.table.getDefaultSchema();
- if (!StringTools.stringIsEmpty(schemaName)) {
- if (!this.combo.getText().equals(schemaName)) {
- this.combo.setText(schemaName);
- }
- }
- else {
- if (!this.combo.getText().equals(NLS.bind(JptUiMappingsMessages.TableComposite_defaultWithOneParam, defaultSchemaName))) {
- this.combo.select(0);
- }
- }
- }
-
- public CCombo getCombo() {
- return this.combo;
- }
-
- @Override
- public Control getControl() {
- return getCombo();
- }
-
- protected Schema getTableSchema() {
- return this.getConnectionProfile().getDatabase().schemaNamed(table.getSchema());
- }
-
- @Override
- protected void disengageListeners() {
- if (this.table != null) {
- this.removeConnectionListener();
- this.table.eAdapters().remove(this.listener);
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.table != null) {
- this.table.eAdapters().add(this.listener);
- this.addConnectionListener();
- }
- }
-
- private void addConnectionListener() {
- this.getConnectionProfile().addConnectionListener(this.connectionListener);
- }
-
- private void removeConnectionListener() {
- this.getConnectionProfile().removeConnectionListener(this.connectionListener);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTableDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTableDialog.java
index 14be07b492..4c91240e66 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTableDialog.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTableDialog.java
@@ -3,16 +3,16 @@
* 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.ui.internal.mappings.details;
import java.util.Iterator;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.ISecondaryTable;
import org.eclipse.jpt.db.internal.ConnectionProfile;
import org.eclipse.jpt.db.internal.Database;
import org.eclipse.jpt.db.internal.Schema;
@@ -30,22 +30,22 @@ import org.eclipse.swt.widgets.Shell;
public class SecondaryTableDialog extends Dialog {
- //if creating a new JoinColumn, this will be null,
+ //if creating a new JoinColumn, this will be null,
//specify the JoinColumnOwner instead in the appropriate construtor
private ISecondaryTable secondaryTable;
private IEntity entity;
-
+
protected Combo nameCombo;
protected Combo catalogCombo;
protected Combo schemaCombo;
-
+
private String selectedName;
private String selectedSchema;
private String selectedCatalog;
-
+
private boolean defaultSchemaSelected;
private boolean defaultCatalogSelected;
-
+
SecondaryTableDialog(Shell parent, IEntity entity) {
super(parent);
this.entity = entity;
@@ -56,38 +56,40 @@ public class SecondaryTableDialog extends Dialog {
this.secondaryTable = secondaryTable;
this.entity = entity;
}
-
+
+ @Override
protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setText(getTitle());
}
-
+
protected String getTitle() {
return JptUiMappingsMessages.SecondaryTableDialog_editSecondaryTable;
}
-
+
+ @Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
GridLayout gridLayout = (GridLayout) composite.getLayout();
gridLayout.numColumns = 2;
-
+
Label nameLabel = new Label(composite, SWT.LEFT);
nameLabel.setText(JptUiMappingsMessages.SecondaryTableDialog_name);
GridData gridData = new GridData();
nameLabel.setLayoutData(gridData);
-
+
this.nameCombo = new Combo(composite, SWT.LEFT);
gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = SWT.FILL;
this.nameCombo.setLayoutData(gridData);
populateNameCombo();
-
+
Label catalogLabel = new Label(composite, SWT.LEFT);
catalogLabel.setText(JptUiMappingsMessages.SecondaryTableDialog_catalog);
gridData = new GridData();
catalogLabel.setLayoutData(gridData);
-
+
this.catalogCombo = new Combo(composite, SWT.LEFT);
gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
@@ -99,7 +101,7 @@ public class SecondaryTableDialog extends Dialog {
schemaLabel.setText(JptUiMappingsMessages.SecondaryTableDialog_schema);
gridData = new GridData();
schemaLabel.setLayoutData(gridData);
-
+
this.schemaCombo = new Combo(composite, SWT.LEFT);
gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
@@ -109,16 +111,16 @@ public class SecondaryTableDialog extends Dialog {
return composite;
}
-
+
protected Database getDatabase() {
return this.getConnectionProfile().getDatabase();
}
-
+
private ConnectionProfile getConnectionProfile() {
- IJpaProject project = (this.secondaryTable == null) ? this.entity.getJpaProject() : this.secondaryTable.getJpaProject();
+ IJpaProject project = (this.secondaryTable == null) ? this.entity.jpaProject() : this.secondaryTable.jpaProject();
return project.connectionProfile();
}
-
+
protected Schema getTableSchema() {
Database database = this.getDatabase();
if (database != null) {
@@ -129,7 +131,7 @@ public class SecondaryTableDialog extends Dialog {
}
return null;
}
-
+
protected void populateNameCombo() {
Schema schema = this.getTableSchema();
if (schema != null) {
@@ -150,9 +152,9 @@ public class SecondaryTableDialog extends Dialog {
if (getSecondaryTable() != null) {
this.schemaCombo.add(NLS.bind(JptUiMappingsMessages.SecondaryTableDialog_defaultSchema, getSecondaryTable().getDefaultSchema()));
}
-
+
Database database = this.getDatabase();
-
+
if (database != null) {
Iterator<String> schemata = database.schemaNames();
for (Iterator<String> stream = CollectionTools.sort(schemata); stream.hasNext(); ) {
@@ -169,13 +171,13 @@ public class SecondaryTableDialog extends Dialog {
}
}
}
-
+
protected void populateCatalogCombo() {
if (getSecondaryTable() != null) {
this.catalogCombo.add(NLS.bind(JptUiMappingsMessages.SecondaryTableDialog_defaultCatalog, getSecondaryTable().getDefaultCatalog()));
}
Database database = this.getDatabase();
-
+
if (database != null) {
Iterator<String> catalogs = database.catalogNames();
for (Iterator<String> stream = CollectionTools.sort(catalogs); stream.hasNext(); ) {
@@ -191,45 +193,46 @@ public class SecondaryTableDialog extends Dialog {
this.catalogCombo.select(0);
}
}
- }
-
+ }
+
protected Combo getNameCombo() {
return this.nameCombo;
}
-
+
protected Combo getSchemaCombo() {
return this.schemaCombo;
}
-
+
protected Combo getCatalogCombo() {
return this.catalogCombo;
}
-
+
protected ISecondaryTable getSecondaryTable() {
return this.secondaryTable;
}
-
-
+
+
protected String getSelectedName() {
return this.selectedName;
}
-
+
protected String getSelectedCatalog() {
return this.selectedCatalog;
}
-
+
protected String getSelectedSchema() {
return this.selectedSchema;
}
-
+
protected boolean isDefaultSchemaSelected() {
return this.defaultSchemaSelected;
}
-
+
protected boolean isDefaultCatalogSelected() {
return this.defaultCatalogSelected;
}
-
+
+ @Override
public boolean close() {
this.selectedName = this.nameCombo.getText();
this.selectedSchema = this.schemaCombo.getText();
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTablesComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTablesComposite.java
index 052cd72f48..7cf03aa774 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTablesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SecondaryTablesComposite.java
@@ -1,268 +1,174 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
-import java.util.Iterator;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.IContentProvider;
+import java.util.ListIterator;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.ISecondaryTable;
+import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.AddRemoveListPane;
+import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-//TODO handle xml, how to handle virtual secondaryTables, adding them to xml, are they overriden, etc??
-public class SecondaryTablesComposite extends BaseJpaComposite
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | AddRemoveListPane | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | PrimaryKeyJoinColumnsInSecondaryTableComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IEntity
+ * @see EntityComposite - The container of this pane
+ * @see AddRemoveListPane
+ * @see PrimaryKeyJoinColumnsInSecondaryTableComposite
+ *
+ * @TODO handle xml, how to handle virtual secondaryTables, adding them to xml, are they overriden, etc??
+ * @version 2.0
+ * @since 1.0
+ */
+public class SecondaryTablesComposite extends AbstractFormPane<IEntity>
{
- private IEntity entity;
- private final Adapter entityListener;
- private final Adapter secondaryTableListener;
-
- ListViewer secondaryTablesListViewer;
+ /**
+ * Creates a new <code>SecondaryTablesComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public SecondaryTablesComposite(AbstractFormPane<? extends IEntity> parentPane,
+ Composite parent) {
- private Button addButton;
- private Button editButton;
- private Button removeButton;
-
- private PrimaryKeyJoinColumnsInSecondaryTableComposite pkJoinColumnsComposite;
-
- public SecondaryTablesComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- this.entityListener = buildEntityListener();
- this.secondaryTableListener = buildSecondaryTableListener();
+ super(parentPane, parent);
}
-
- private Adapter buildEntityListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- entityChanged(notification);
- }
- };
+
+ /**
+ * Creates a new <code>SecondaryTablesComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IEntity</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public SecondaryTablesComposite(PropertyValueModel<? extends IEntity> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent,widgetFactory);
}
-
- private Adapter buildSecondaryTableListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- seoncaryTableChanged(notification);
+
+ private void addSecondaryTableFromDialog(SecondaryTableDialog dialog,
+ ObjectListSelectionModel listSelectionModel) {
+ if (dialog.open() == Window.OK) {
+ int index = this.subject().specifiedSecondaryTablesSize();
+ String name = dialog.getSelectedName();
+ String catalog = dialog.getSelectedCatalog();
+ String schema = dialog.getSelectedSchema();
+ ISecondaryTable secondaryTable = this.subject().addSpecifiedSecondaryTable(index);
+ secondaryTable.setSpecifiedName(name);
+ secondaryTable.setSpecifiedCatalog(catalog);
+ secondaryTable.setSpecifiedSchema(schema);
+
+ listSelectionModel.setSelectedValue(secondaryTable);
+ }
+ }
+
+ private WritablePropertyValueModel<ISecondaryTable> buildSecondaryTableHolder() {
+ return new SimplePropertyValueModel<ISecondaryTable>();
+ }
+
+ private ILabelProvider buildSecondaryTableLabelProvider() {
+ return new LabelProvider() {
+ @Override
+ public String getText(Object element) {
+ // TODO display a qualified name instead
+ ISecondaryTable secondaryTable = (ISecondaryTable) element;
+ return secondaryTable.getName();
}
};
}
-
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- GridData gridData = new GridData();
-
- Composite secondaryTablesComposite = new Composite(composite, SWT.NONE);
- layout = new GridLayout(3, false);
- layout.marginWidth = 0;
- secondaryTablesComposite.setLayout(layout);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- secondaryTablesComposite.setLayoutData(gridData);
-
- this.secondaryTablesListViewer = buildSecondaryTablesListViewer(secondaryTablesComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.horizontalSpan = 3;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.secondaryTablesListViewer.getList().setLayoutData(gridData);
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(this.secondaryTablesListViewer.getList(), IJpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS);
-
- Composite buttonsComposite = new Composite(secondaryTablesComposite, SWT.NONE);
- layout = new GridLayout(3, false);
- layout.marginWidth = 0;
- buttonsComposite.setLayout(layout);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.END;
- buttonsComposite.setLayoutData(gridData);
-
- this.addButton = getWidgetFactory().createButton(
- buttonsComposite,
- JptUiMappingsMessages.SecondaryTablesComposite_add,
- SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- this.addButton.setLayoutData(gridData);
- this.addButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- addSecondaryTable();
- }
- });
-
- this.editButton = getWidgetFactory().createButton(
- buttonsComposite,
- JptUiMappingsMessages.SecondaryTablesComposite_edit,
- SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- this.editButton.setLayoutData(gridData);
- this.editButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
- }
-
- public void widgetSelected(SelectionEvent e) {
- editSecondaryTable();
+
+ private AddRemoveListPane.Adapter buildSecondaryTablesAdapter() {
+ return new AddRemoveListPane.AbstractAdapter() {
+
+ public void addNewItem(ObjectListSelectionModel listSelectionModel) {
+ SecondaryTableDialog dialog = new SecondaryTableDialog(getControl().getShell(), subject());
+ addSecondaryTableFromDialog(dialog, listSelectionModel);
}
- });
- this.removeButton = getWidgetFactory().createButton(
- buttonsComposite,
- JptUiMappingsMessages.SecondaryTablesComposite_remove,
- SWT.NONE);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.BEGINNING;
- this.removeButton.setLayoutData(gridData);
- this.removeButton.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- // do nothing
+ @Override
+ public boolean hasOptionalButton() {
+ return true;
}
-
- public void widgetSelected(SelectionEvent e) {
- removeSecondaryTable();
+
+ @Override
+ public String optionalButtonText() {
+ return JptUiMappingsMessages.SecondaryTablesComposite_edit;
}
- });
-
- this.pkJoinColumnsComposite = new PrimaryKeyJoinColumnsInSecondaryTableComposite(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.verticalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- this.pkJoinColumnsComposite.getControl().setLayoutData(gridData);
- }
-
- private ListViewer buildSecondaryTablesListViewer(Composite parent) {
- ListViewer listViewer = new ListViewer(parent, SWT.SINGLE | SWT.BORDER);
- listViewer.setLabelProvider(buildSecondaryTablesListLabelProvider());
- listViewer.setContentProvider(buildSecondaryTablesListContentProvider());
-
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- updateEnablement();
- secondaryTablesListSelectionChanged(event);
+
+ @Override
+ public void optionOnSelection(ObjectListSelectionModel listSelectionModel) {
+ ISecondaryTable secondaryTable = (ISecondaryTable) listSelectionModel.selectedValue();
+ SecondaryTableDialog dialog = new SecondaryTableDialog(getControl().getShell(), secondaryTable, subject());
+ editSecondaryTableFromDialog(dialog, secondaryTable);
}
- });
- return listViewer;
- }
-
- protected void secondaryTablesListSelectionChanged(SelectionChangedEvent event) {
- if (((StructuredSelection) event.getSelection()).isEmpty()) {
- this.pkJoinColumnsComposite.populate(null);
- this.pkJoinColumnsComposite.enableWidgets(false);
- }
- else {
- ISecondaryTable selectedSecondaryTable = getSelectedSecondaryTable();
- this.pkJoinColumnsComposite.populate(selectedSecondaryTable);
- this.pkJoinColumnsComposite.enableWidgets(true);
- }
- }
+ public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) {
+ IEntity entity = subject();
+ int[] selectedIndices = listSelectionModel.selectedIndices();
- private IContentProvider buildSecondaryTablesListContentProvider() {
- return new IStructuredContentProvider(){
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // do nothing
- }
-
- public void dispose() {
- // do nothing
- }
-
- public Object[] getElements(Object inputElement) {
- return ((IEntity) inputElement).getSecondaryTables().toArray();
+ for (int index = selectedIndices.length; --index >= 0; ) {
+ entity.removeSpecifiedSecondaryTable(selectedIndices[index]);
+ }
}
};
}
-
- private ILabelProvider buildSecondaryTablesListLabelProvider() {
- return new LabelProvider() {
- public String getText(Object element) {
- //TODO display a qualified name instead
- ISecondaryTable secondaryTable = (ISecondaryTable) element;
- return secondaryTable.getName();
+
+ private ListValueModel<ISecondaryTable> buildSecondaryTablesListHolder() {
+ return new ListAspectAdapter<IEntity, ISecondaryTable>(getSubjectHolder(), IEntity.SPECIFIED_SECONDARY_TABLES_LIST) {
+ @Override
+ protected ListIterator<ISecondaryTable> listIterator_() {
+ return subject.secondaryTables();
+ }
+
+ @Override
+ protected int size_() {
+ return subject.secondaryTablesSize();
}
};
}
-
- void addSecondaryTable() {
- SecondaryTableDialog dialog = new SecondaryTableDialog(this.getControl().getShell(), this.entity);
- addSecondaryTableFromDialog(dialog);
- }
-
- private void addSecondaryTableFromDialog(SecondaryTableDialog dialog) {
- if (dialog.open() == Window.OK) {
- int index = this.entity.getSpecifiedSecondaryTables().size();
- String name = dialog.getSelectedName();
- String catalog = dialog.getSelectedCatalog();
- String schema = dialog.getSelectedSchema();
- ISecondaryTable secondaryTable = this.entity.createSecondaryTable(index);
- this.entity.getSpecifiedSecondaryTables().add(secondaryTable);
- secondaryTable.setSpecifiedName(name);
- secondaryTable.setSpecifiedCatalog(catalog);
- secondaryTable.setSpecifiedSchema(schema);
-
- this.secondaryTablesListViewer.setSelection(new StructuredSelection(secondaryTable));
- }
- }
-
- void editSecondaryTable() {
- ISecondaryTable secondaryTable = getSelectedSecondaryTable();
- SecondaryTableDialog dialog = new SecondaryTableDialog(this.getControl().getShell(), secondaryTable, this.entity);
- editSecondaryTableFromDialog(dialog, secondaryTable);
- }
-
- private void editSecondaryTableFromDialog(SecondaryTableDialog dialog, ISecondaryTable secondaryTable) {
- if (dialog.open() == Window.OK) {
- editSecondaryTableDialogOkd(dialog, secondaryTable);
- }
+
+ private ListValueModel<ISecondaryTable> buildSortedSecondaryTablesListHolder() {
+ return new SortedListValueModelAdapter<ISecondaryTable>(
+ buildSecondaryTablesListHolder()
+ );
}
-
+
private void editSecondaryTableDialogOkd(SecondaryTableDialog dialog, ISecondaryTable secondaryTable) {
String name = dialog.getSelectedName();
String catalog = dialog.getSelectedCatalog();
@@ -271,7 +177,7 @@ public class SecondaryTablesComposite extends BaseJpaComposite
if (secondaryTable.getSpecifiedName() == null || !secondaryTable.getSpecifiedName().equals(name)){
secondaryTable.setSpecifiedName(name);
}
-
+
if (dialog.isDefaultCatalogSelected()) {
if (secondaryTable.getSpecifiedCatalog() != null) {
secondaryTable.setSpecifiedCatalog(null);
@@ -280,7 +186,7 @@ public class SecondaryTablesComposite extends BaseJpaComposite
else if (secondaryTable.getSpecifiedCatalog() == null || !secondaryTable.getSpecifiedCatalog().equals(catalog)){
secondaryTable.setSpecifiedCatalog(catalog);
}
-
+
if (dialog.isDefaultSchemaSelected()) {
if (secondaryTable.getSpecifiedSchema() != null) {
secondaryTable.setSpecifiedSchema(null);
@@ -291,98 +197,39 @@ public class SecondaryTablesComposite extends BaseJpaComposite
}
}
- private ISecondaryTable getSelectedSecondaryTable() {
- return (ISecondaryTable) ((StructuredSelection) this.secondaryTablesListViewer.getSelection()).getFirstElement();
- }
-
-
- void removeSecondaryTable() {
- ISelection selection = this.secondaryTablesListViewer.getSelection();
- if (selection instanceof StructuredSelection) {
- for (Iterator<ISecondaryTable> i = ((StructuredSelection) selection).iterator(); i.hasNext(); ) {
- this.entity.getSpecifiedSecondaryTables().remove(i.next());
- }
- }
- }
-
- void updateEnablement() {
- this.editButton.setEnabled(!((StructuredSelection) this.secondaryTablesListViewer.getSelection()).isEmpty());
- this.removeButton.setEnabled(!((StructuredSelection) this.secondaryTablesListViewer.getSelection()).isEmpty());
- }
-
- public void doPopulate(EObject obj) {
- this.entity = (IEntity) obj;
- if (this.entity == null) {
- this.secondaryTablesListViewer.setInput(null);
- return;
- }
-
- this.secondaryTablesListViewer.setInput(this.entity);
- if (!this.entity.getSecondaryTables().isEmpty()) {
- this.secondaryTablesListViewer.setSelection(new StructuredSelection(this.entity.getSecondaryTables().get(0)));
- }
- else {
- this.secondaryTablesListViewer.setSelection(null);
+ private void editSecondaryTableFromDialog(SecondaryTableDialog dialog, ISecondaryTable secondaryTable) {
+ if (dialog.open() == Window.OK) {
+ editSecondaryTableDialogOkd(dialog, secondaryTable);
}
- updateEnablement();
}
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void doPopulate() {
- }
+ protected void initializeLayout(Composite container) {
- protected void engageListeners() {
- if (this.entity != null) {
- this.entity.eAdapters().add(this.entityListener);
- for (ISecondaryTable secondaryTable : this.entity.getSecondaryTables()) {
- secondaryTable.eAdapters().add(this.secondaryTableListener);
- }
- }
- }
-
- protected void disengageListeners() {
- if (this.entity != null) {
- for (ISecondaryTable secondaryTable : this.entity.getSecondaryTables()) {
- secondaryTable.eAdapters().remove(this.secondaryTableListener);
- }
- this.entity.eAdapters().remove(this.entityListener);
- }
- }
-
- protected void entityChanged(Notification notification) {
- if (notification.getFeatureID(IEntity.class) == JpaCoreMappingsPackage.IENTITY__SPECIFIED_SECONDARY_TABLES) {
- if (notification.getEventType() == Notification.ADD) {
- ((ISecondaryTable) notification.getNewValue()).eAdapters().add(this.secondaryTableListener);
- }
- else if (notification.getEventType() == Notification.REMOVE) {
- ((ISecondaryTable) notification.getOldValue()).eAdapters().remove(this.secondaryTableListener);
- }
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- secondaryTablesListViewer.refresh();
- updateEnablement();
- }
- });
- }
- }
+ int groupBoxMargin = groupBoxMargin();
- protected void seoncaryTableChanged(Notification notification) {
- if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__SPECIFIED_NAME
- || notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__SPECIFIED_CATALOG
- || notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__SPECIFIED_SCHEMA
- || notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__DEFAULT_CATALOG
- || notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__DEFAULT_SCHEMA) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- secondaryTablesListViewer.refresh();
- }
- });
- }
- }
-}
+ WritablePropertyValueModel<ISecondaryTable> secondaryTableHolder =
+ buildSecondaryTableHolder();
+
+ // Secondary Tables add/remove list pane
+ new AddRemoveListPane<IEntity>(
+ this,
+ buildSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin),
+ buildSecondaryTablesAdapter(),
+ buildSortedSecondaryTablesListHolder(),
+ secondaryTableHolder,
+ buildSecondaryTableLabelProvider(),
+ IJpaHelpContextIds.MAPPING_JOIN_TABLE_COLUMNS
+ );
+
+ // Primary Key Join Columns pane
+ new PrimaryKeyJoinColumnsInSecondaryTableComposite(
+ this,
+ secondaryTableHolder,
+ container
+ );
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SequenceGeneratorComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SequenceGeneratorComposite.java
index 9be54c3668..66af2c9b69 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SequenceGeneratorComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/SequenceGeneratorComposite.java
@@ -1,185 +1,160 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.ISequenceGenerator;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
+import org.eclipse.jpt.core.internal.IJpaNode;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.ISequenceGenerator;
+import org.eclipse.jpt.db.internal.Schema;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.jpt.ui.internal.mappings.db.SequenceCombo;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+import org.eclipse.swt.widgets.Text;
/**
- * SequenceGeneratorComposite
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ----------------------------------------------------- |
+ * | Name: | I | |
+ * | ----------------------------------------------------- |
+ * | ----------------------------------------------------- |
+ * | Sequence Generator: | SequenceCombo | |
+ * | ----------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IIdMapping
+ * @see ISequenceGenerator
+ * @see GenerationComposite - The parent container
+ * @see SequenceCombo
+ *
+ * @version 2.0
+ * @since 1.0
*/
public class SequenceGeneratorComposite extends GeneratorComposite<ISequenceGenerator>
{
- private CCombo sequenceNameCombo;
+ /**
+ * Creates a new <code>SequenceGeneratorComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public SequenceGeneratorComposite(AbstractFormPane<? extends IIdMapping> parentPane,
+ Composite parent) {
- private ModifyListener sequenceNameComboListener;
-
- private ConnectionProfile connectionProfile;
-
- public SequenceGeneratorComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, commandStack, widgetFactory);
- }
-
- protected ISequenceGenerator createGenerator() {
- ISequenceGenerator sequenceGenerator = idMapping().createSequenceGenerator();
- idMapping().setSequenceGenerator(sequenceGenerator);
- return sequenceGenerator;
- }
-
- protected ISequenceGenerator generator(IId idMapping) {
- return idMapping.getSequenceGenerator();
+ super(parentPane, parent);
}
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void initializeLayout(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- GridLayout layout = new GridLayout(2, false);
- composite.setLayout(layout);
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.SequenceGeneratorComposite_name);
-
- this.nameTextWidget = buildNameText(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.nameTextWidget.setLayoutData(gridData);
- helpSystem.setHelp(this.nameTextWidget, IJpaHelpContextIds.MAPPING_SEQUENCE_GENERATOR_NAME);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.SequenceGeneratorComposite_sequence);
-
- this.sequenceNameCombo = buildSequenceNameCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.sequenceNameCombo.setLayoutData(gridData);
- helpSystem.setHelp(sequenceNameCombo, IJpaHelpContextIds.MAPPING_SEQUENCE_GENERATOR_SEQUENCE);
+ protected ISequenceGenerator buildGenerator() {
+ return subject().addSequenceGenerator();
}
- private CCombo buildSequenceNameCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(""); //$NON-NLS-1$
- combo.select(0);
- combo.addModifyListener(getSequenceNameListener());
- return combo;
- }
+ private SequenceCombo<IJpaNode> buildSequenceNameCombo(Composite parent) {
- private ModifyListener getSequenceNameListener() {
- if (this.sequenceNameComboListener == null) {
- this.sequenceNameComboListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String text = ((CCombo) e.getSource()).getText();
- if (text != null && sequenceNameCombo.getItemCount() > 0 && text.equals(sequenceNameCombo.getItem(0))) {
- text = null;
- }
- ISequenceGenerator generator = getGenerator();
- if (generator == null) {
- generator = createGenerator();
- }
- generator.setSpecifiedSequenceName(text);
+ return new SequenceCombo<IJpaNode>(this, parent) {
+
+ @Override
+ protected String defaultValue() {
+ return JptUiMappingsMessages.SequenceGeneratorComposite_default;
+ }
+
+ @Override
+ protected Schema schema() {
+ return null;
+ // TODO
+// return database().schemaNamed(subject().jpaProject().getSchemaName());
+ }
+
+ @Override
+ protected void setValue(String value) {
+ ISequenceGenerator generator = getGenerator((IIdMapping) super.subject());
+
+ if (generator == null) {
+ generator = buildGenerator();
}
- };
- }
- return this.sequenceNameComboListener;
- }
- protected void generatorChanged(Notification notification) {
- super.generatorChanged(notification);
- if (notification.getFeatureID(ISequenceGenerator.class) == JpaCoreMappingsPackage.ISEQUENCE_GENERATOR__SPECIFIED_SEQUENCE_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- String sequenceName = getGenerator().getSpecifiedSequenceName();
- if (sequenceName == null) {
- sequenceNameCombo.select(0);
- }
- else if (!sequenceNameCombo.getText().equals(sequenceName)) {
- sequenceNameCombo.setText(sequenceName);
- }
+ generator.setSpecifiedSequenceName(value);
+ }
+
+ @Override
+ protected IJpaNode subject() {
+ IJpaNode subject = super.subject();
+
+ if (subject == null) {
+ subject = SequenceGeneratorComposite.this.subject();
+ }
+
+ return subject;
+ }
+
+ @Override
+ protected String value() {
+ ISequenceGenerator generator = getGenerator((IIdMapping) super.subject());
+
+ if (generator != null) {
+ return generator.getSpecifiedSequenceName();
}
- });
- }
+
+ return null;
+ }
+ };
}
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void doPopulate(EObject obj) {
- super.doPopulate(obj);
- if (obj == null) {
- return;
- }
- populateSequenceNameCombo();
+ protected ISequenceGenerator getGenerator(IIdMapping subject) {
+ return (subject != null) ? subject.getSequenceGenerator() : null;
}
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void doPopulate() {
- populateSequenceNameCombo();
- }
-
- private ConnectionProfile getConnectionProfile() {
- if(this.connectionProfile == null) {
- IJpaProject jpaProject = getGenerator().getJpaProject();
- this.connectionProfile = jpaProject.connectionProfile();
- }
- return this.connectionProfile;
- }
+ protected void initializeLayout(Composite container) {
- private void populateSequenceNameCombo() {
- if (this.getGenerator() == null) {
- return;
- }
- this.sequenceNameCombo.setItem(0, JptUiMappingsMessages.SequenceGeneratorComposite_default);
- if (this.getConnectionProfile().isConnected()) {
-// this.sequenceNameCombo.remove(1, this.sequenceNameCombo.getItemCount() - 1);
-// Schema schema = getConnectionProfile().getDatabase().schemaNamed(getGenerator().getJpaProject().getSchemaName());
-// if (schema != null) {
-// for (Iterator stream = CollectionTools.sort(schema.sequenceNames()); stream.hasNext();) {
-// this.sequenceNameCombo.add((String) stream.next());
-// }
-// }
- }
- String sequenceName = this.getGenerator().getSpecifiedSequenceName();
- if (sequenceName != null) {
- if (!this.sequenceNameCombo.getText().equals(sequenceName)) {
- this.sequenceNameCombo.setText(sequenceName);
- }
- }
- else {
- this.sequenceNameCombo.select(0);
- }
+ // Name widgets
+ Text nameText = buildNameText(container);
+ setNameText(nameText);
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.SequenceGeneratorComposite_name,
+ nameText,
+ IJpaHelpContextIds.MAPPING_SEQUENCE_GENERATOR_NAME
+ );
+
+ // Sequence Generator widgets
+ SequenceCombo<IJpaNode> sequenceNameCombo =
+ buildSequenceNameCombo(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.SequenceGeneratorComposite_sequence,
+ sequenceNameCombo.getControl(),
+ IJpaHelpContextIds.MAPPING_SEQUENCE_GENERATOR_SEQUENCE
+ );
}
- protected void clear() {
- super.clear();
- this.sequenceNameCombo.select(0);
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected String propertyName() {
+ return IIdMapping.SEQUENCE_GENERATOR_PROPERTY;
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/StringWithDefaultChooser.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/StringWithDefaultChooser.java
deleted file mode 100644
index 330f39594a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/StringWithDefaultChooser.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class StringWithDefaultChooser extends BaseJpaController
-{
- private StringHolder stringHolder;
- private Adapter stringHolderListener;
-
- private ComboViewer comboViewer;
-
- private static final String DEFAULT = "default";
-
-
- public StringWithDefaultChooser(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildStringHolderListener();
- }
-
-
- private void buildStringHolderListener() {
- this.stringHolderListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- stringHolderChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- this.comboViewer = new ComboViewer(combo);
- this.comboViewer.setContentProvider(buildContentProvider());
- this.comboViewer.setLabelProvider(buildLabelProvider());
-
- this.comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- StringWithDefaultChooser.this.selectionChanged(event.getSelection());
- }
- });
-
- combo.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- comboModified(e);
- }
- });
- }
-
- private IContentProvider buildContentProvider() {
- return new IStructuredContentProvider(){
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public void dispose() {
- }
-
- public Object[] getElements(Object inputElement) {
- return new String[] {DEFAULT};
- }
- };
- }
-
-
- private IBaseLabelProvider buildLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- if (element == DEFAULT && stringHolder.wrappedObject() != null) {
- return stringHolder.defaultItem();
- }
- return super.getText(element);
- }
- };
- }
- void selectionChanged(ISelection sel) {
- if (isPopulating()) {
- return;
- }
-
- if (sel instanceof IStructuredSelection) {
- String selection = (String) ((IStructuredSelection) sel).getFirstElement();
- if (this.comboViewer.getCombo().getSelectionIndex() == 0) {
- selection = null;
- }
- if (this.stringHolder.getString() == null) {
- if (selection != null) {
- this.stringHolder.setString(selection);
- }
- }
- else if (!this.stringHolder.getString().equals(selection)) {
- this.stringHolder.setString(selection);
- }
- }
- }
-
- private void comboModified(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- CCombo combo = (CCombo) e.getSource();
- combo.getSelectionIndex();
- String text = combo.getText();
-
- if (text != null && combo.getItemCount() > 0 && text.equals(combo.getItem(0))) {
- text = null;
- }
- if (this.stringHolder.getString() != text) {
- this.stringHolder.setString(text);
- }
- }
-
- private void stringHolderChanged(Notification notification) {
- if (notification.getFeatureID(this.stringHolder.featureClass()) ==
- this.stringHolder.featureId()) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getCombo().isDisposed()) {
- return;
- }
- populate();
- }
- });
- }
- else if (this.stringHolder.supportsDefault()) {
- if (notification.getFeatureID(this.stringHolder.featureClass()) ==
- this.stringHolder.defaultFeatureId()) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- if (getCombo().isDisposed()) {
- return;
- }
- populate();
- }
- });
-
- }
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.stringHolder != null && this.stringHolder.wrappedObject() != null) {
- this.stringHolder.wrappedObject().eAdapters().add(this.stringHolderListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.stringHolder != null && this.stringHolder.wrappedObject() != null) {
- this.stringHolder.wrappedObject().eAdapters().remove(this.stringHolderListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.stringHolder = (StringHolder) obj;
- this.comboViewer.setInput(this.stringHolder);
- populateCombo();
- }
-
- @Override
- protected void doPopulate() {
- populateCombo();
- }
-
- private void populateCombo() {
- if (this.stringHolder.wrappedObject() == null) {
- this.comboViewer.setSelection(StructuredSelection.EMPTY);
- return;
- }
- this.comboViewer.update(this.comboViewer.getElementAt(0), null);
-
- String string = this.stringHolder.getString();
- if (string == null) {
- if (((StructuredSelection) this.comboViewer.getSelection()).getFirstElement() == DEFAULT) {
- this.comboViewer.refresh();
- }
- else {
- this.comboViewer.setSelection(new StructuredSelection(DEFAULT));
- }
- }
- else {
- if (!this.comboViewer.getCombo().getText().equals(string)) {
- this.comboViewer.getCombo().setText(string);
- }
- }
- }
-
- public CCombo getCombo() {
- return this.comboViewer.getCCombo();
- }
-
- @Override
- public Control getControl() {
- return getCombo();
- }
- /**
- * An interface to wrap an object that supports a string with a default setting
- * An object of this type must be passed in to populate(EObject)
- */
- public static interface StringHolder extends EObject {
- /**
- * Return the string setting from the wrapped object
- * @return
- */
- String getString();
-
- /**
- * Set the string setting on the wrapped object
- * @param string
- */
- void setString(String string);
-
- /**
- * Return the Class of the wrapped object
- * @return
- */
- Class featureClass();
-
- /**
- * Return the feature id of string setting on the wrapped object
- * @return
- */
- int featureId();
-
- boolean supportsDefault();
-
- int defaultFeatureId();
-
- /**
- * The wrapped EObject that the enum setting is stored on
- * @return
- */
- EObject wrappedObject();
-
- String defaultItem();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableCombo.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableCombo.java
deleted file mode 100644
index 68e148bc9a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableCombo.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ui.internal.mappings.details;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.ITable;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.ConnectionListener;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.Database;
-import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class TableCombo extends BaseJpaController
-{
- private ITable table;
-
- private Adapter listener;
-
- /**
- * Caching the connectionProfile so we can remove the listener. If the
- * cached table object has been removed from the model then we no longer
- * have access to parent and cannot find the connectionProfile
- */
- private ConnectionProfile connectionProfile;
-
- private ConnectionListener connectionListener;
-
- private CCombo combo;
-
- public TableCombo(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- this.listener = buildTableListener();
- this.connectionListener = buildConnectionListener();
- }
-
- private Adapter buildTableListener() {
- return new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- tableChanged(notification);
- }
- };
- }
-
- private ConnectionListener buildConnectionListener() {
- return new ConnectionListener() {
- public void aboutToClose(ConnectionProfile profile) {
- // not interested to this event.
- }
-
- public void closed(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- TableCombo.this.populateTableCombo();
- }
- });
- }
-
- public void modified(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- TableCombo.this.populateTableCombo();
- }
- });
- }
-
- public boolean okToClose(ConnectionProfile profile) {
- // not interested to this event.
- return true;
- }
-
- public void opened(ConnectionProfile profile) {
- getCombo().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- TableCombo.this.populateTableCombo();
- }
- });
- }
-
- public void databaseChanged(ConnectionProfile profile, final Database database) {
- getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (database == TableCombo.this.getDatabase()) {
- if (!getControl().isDisposed()) {
- TableCombo.this.populateTableCombo();
- }
- }
- }
- });
- }
-
- public void schemaChanged(ConnectionProfile profile, final Schema schema) {
- getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (schema == TableCombo.this.getTableSchema()) {
- if (!getControl().isDisposed()) {
- TableCombo.this.populateTableCombo();
- }
- }
- }
- });
- }
-
- public void tableChanged(ConnectionProfile profile, final Table table) {
- // not interested to this event.
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- this.combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- this.combo.add(JptUiMappingsMessages.TableComposite_defaultEmpty);
- this.combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String tableText = ((CCombo) e.getSource()).getText();
- if (tableText.equals("")) { //$NON-NLS-1$
- tableText = null;
- if (table.getSpecifiedName() == null || table.getSpecifiedName().equals("")) { //$NON-NLS-1$
- return;
- }
- }
- if (tableText != null && combo.getItemCount() > 0 && tableText.equals(combo.getItem(0))) {
- tableText = null;
- }
- if (table.getSpecifiedName() == null && tableText != null) {
- table.setSpecifiedName(tableText);
- }
- if (table.getSpecifiedName() != null && !table.getSpecifiedName().equals(tableText)) {
- table.setSpecifiedName(tableText);
- }
- }
- });
- }
-
- protected void tableChanged(Notification notification) {
- if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__SPECIFIED_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateTableName();
- }
- });
- }
- else if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__DEFAULT_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateDefaultTableName();
- }
- });
- }
- else if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__DEFAULT_SCHEMA) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateTableCombo();
- }
- });
- }
- else if (notification.getFeatureID(ITable.class) == JpaCoreMappingsPackage.ITABLE__SPECIFIED_SCHEMA) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateTableCombo();
- }
- });
- }
- }
-
- public void doPopulate(EObject obj) {
- this.table = (ITable) obj;
- if (this.table != null) {
- populateTableCombo();
- }
- else {
- this.connectionProfile = null;
- }
- }
-
- public void doPopulate() {
- if (this.table != null) {
- populateTableCombo();
- }
- }
-
- protected Database getDatabase() {
- return getConnectionProfile().getDatabase();
- }
-
- protected Schema getTableSchema() {
- return getConnectionProfile().getDatabase().schemaNamed(table.getSchema());
- }
-
- private ConnectionProfile getConnectionProfile() {
- if (this.connectionProfile == null) {
- this.connectionProfile = this.table.getJpaProject().connectionProfile();
- }
- return this.connectionProfile;
- }
-
- private void populateTableCombo() {
- if (this.table == null) {
- return;
- }
- // TODO don't do instanceof check here - check on Table, or isRoot check
- // on Entity
- // this.tableCombo.setEnabled(!(this.table instanceof
- // SingleTableInheritanceChildTableImpl));
- populateDefaultTableName();
- if (getConnectionProfile().isConnected()) {
- this.combo.remove(1, this.combo.getItemCount() - 1);
- Schema schema = this.getTableSchema();
- if (schema != null) {
- Iterator<String> tables = schema.tableNames();
- for (Iterator<String> stream = CollectionTools.sort(tables); stream.hasNext();) {
- this.combo.add(stream.next());
- }
- }
- }
- else {
- this.combo.remove(1, this.combo.getItemCount() - 1);
- }
- populateTableName();
- }
-
- protected void populateDefaultTableName() {
- if (this.table == null) {
- return;
- }
- String defaultTableName = table.getDefaultName();
- int selectionIndex = combo.getSelectionIndex();
- combo.setItem(0, NLS.bind(JptUiMappingsMessages.TableComposite_defaultWithOneParam, defaultTableName));
- if (selectionIndex == 0) {
- // combo text does not update when switching between 2 mappings of
- // the same type
- // that both have a default column name. clear the selection and
- // then set it again
- combo.clearSelection();
- combo.select(0);
- }
- }
-
- protected void populateTableName() {
- if (this.table == null) {
- return;
- }
- String tableName = this.table.getSpecifiedName();
- String defaultTableName = this.table.getDefaultName();
- if (tableName != null) {
- if (!this.combo.getText().equals(tableName)) {
- this.combo.setText(tableName);
- }
- }
- else {
- if (!this.combo.getText().equals(NLS.bind(JptUiMappingsMessages.TableComposite_defaultWithOneParam, defaultTableName))) {
- this.combo.select(0);
- }
- }
- }
-
- public CCombo getCombo() {
- return this.combo;
- }
-
- @Override
- public Control getControl() {
- return getCombo();
- }
-
- @Override
- protected void disengageListeners() {
- if (this.table != null) {
- this.removeConnectionListener();
- this.table.eAdapters().remove(this.listener);
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.table != null) {
- this.table.eAdapters().add(this.listener);
- this.addConnectionListener();
- }
- }
-
- private void addConnectionListener() {
- this.getConnectionProfile().addConnectionListener(this.connectionListener);
- }
-
- private void removeConnectionListener() {
- this.getConnectionProfile().removeConnectionListener(this.connectionListener);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableComposite.java
index cc6f99ae00..0718203988 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableComposite.java
@@ -1,129 +1,232 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.mappings.ITable;
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.jpt.core.internal.context.base.ITable;
+import org.eclipse.jpt.db.internal.Schema;
+import org.eclipse.jpt.db.internal.Table;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.jpt.ui.internal.mappings.db.CatalogCombo;
+import org.eclipse.jpt.ui.internal.mappings.db.SchemaCombo;
+import org.eclipse.jpt.ui.internal.mappings.db.TableCombo;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-//TODO repopulate this panel based on the Entity table changing
-public class TableComposite extends BaseJpaComposite
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | |
+ * | - Table ----------------------------------------------------------------- |
+ * | | ------------------------------------------------------------ | |
+ * | | Table: | TableCombo | | |
+ * | | ------------------------------------------------------------ | |
+ * | | ------------------------------------------------------------ | |
+ * | | Catalog: | CatalogCombo | | |
+ * | | ------------------------------------------------------------ | |
+ * | | ------------------------------------------------------------ | |
+ * | | Schema: | SchemaCombo | | |
+ * | | ------------------------------------------------------------ | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IBasicMapping
+ * @see BaseJpaUiFactory
+ * @see TableCombo
+ * @see CatalogCombo
+ * @see SchemaCombo
+ *
+ * @TODO repopulate this panel based on the Entity table changing
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class TableComposite extends AbstractFormPane<ITable>
{
- private ITable table;
-
- protected TableCombo tableCombo;
-
- protected CatalogCombo catalogCombo;
- protected SchemaCombo schemaCombo;
-
- public TableComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
+ /**
+ * Creates a new <code>TableComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of the subject
+ * @param parent The parent container
+ */
+ public TableComposite(AbstractFormPane<?> parentPane,
+ PropertyValueModel<? extends ITable> subjectHolder,
+ Composite parent) {
- @Override
- protected void initializeLayout(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- Group columnGroup = getWidgetFactory().createGroup(composite, JptUiMappingsMessages.TableComposite_tableSection);
- layout = new GridLayout();
- layout.marginHeight = 0;
- columnGroup.setLayout(layout);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace= true;
- columnGroup.setLayoutData(gridData);
-
- //created this composite because combos as direct children of a Group do not have a border, no clue why
- Composite intermediaryComposite = getWidgetFactory().createComposite(columnGroup);
- layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- intermediaryComposite.setLayout(layout);
-
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace= true;
- intermediaryComposite.setLayoutData(gridData);
-
- CommonWidgets.buildTableLabel(intermediaryComposite, getWidgetFactory());
-
- this.tableCombo = new TableCombo(intermediaryComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.tableCombo.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(tableCombo.getCombo(), IJpaHelpContextIds.ENTITY_TABLE);
-
- CommonWidgets.buildCatalogLabel(intermediaryComposite, getWidgetFactory());
- this.catalogCombo = new CatalogCombo(intermediaryComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.catalogCombo.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(catalogCombo.getCombo(), IJpaHelpContextIds.ENTITY_CATALOG);
-
- CommonWidgets.buildSchemaLabel(intermediaryComposite, getWidgetFactory());
- this.schemaCombo = new SchemaCombo(intermediaryComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.schemaCombo.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(schemaCombo.getCombo(), IJpaHelpContextIds.ENTITY_SCHEMA);
+ super(parentPane, subjectHolder, parent);
}
-
- @Override
- protected void engageListeners() {
+
+ /**
+ * Creates a new <code>TableComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>ITable</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public TableComposite(PropertyValueModel<? extends ITable> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
}
- @Override
- protected void disengageListeners() {
+ private CatalogCombo<ITable> buildCatalogCombo(Composite container) {
+
+ return new CatalogCombo<ITable>(this, container) {
+
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(ITable.DEFAULT_CATALOG_PROPERTY);
+ propertyNames.add(ITable.SPECIFIED_CATALOG_PROPERTY);
+ }
+
+ @Override
+ protected String defaultValue() {
+ return subject().getDefaultCatalog();
+ }
+
+ @Override
+ protected void setValue(String value) {
+ subject().setSpecifiedCatalog(value);
+ }
+
+ @Override
+ protected String value() {
+ return subject().getSpecifiedCatalog();
+ }
+ };
}
-
- public void doPopulate(EObject obj) {
- this.table = (ITable) obj;
- this.tableCombo.populate(this.table);
- this.catalogCombo.populate(this.table);
- this.schemaCombo.populate(this.table);
+
+ private SchemaCombo<ITable> buildSchemaCombo(Composite container) {
+
+ return new SchemaCombo<ITable>(this, container) {
+
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(ITable.DEFAULT_SCHEMA_PROPERTY);
+ propertyNames.add(ITable.SPECIFIED_SCHEMA_PROPERTY);
+ }
+
+ @Override
+ protected String defaultValue() {
+ return subject().getDefaultSchema();
+ }
+
+ @Override
+ protected void setValue(String value) {
+ subject().setSpecifiedSchema(value);
+ }
+
+ @Override
+ protected String value() {
+ return subject().getSpecifiedSchema();
+ }
+ };
}
-
- public void doPopulate() {
- this.tableCombo.populate();
- this.catalogCombo.populate();
- this.schemaCombo.populate();
+
+ private TableCombo<ITable> buildTableCombo(Composite container) {
+
+ return new TableCombo<ITable>(this, container) {
+
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(ITable.DEFAULT_NAME_PROPERTY);
+ propertyNames.add(ITable.SPECIFIED_NAME_PROPERTY);
+ }
+
+ @Override
+ protected String defaultValue() {
+ return subject().getDefaultName();
+ }
+
+ @Override
+ protected void setValue(String value) {
+ subject().setSpecifiedName(value);
+ }
+
+ @Override
+ protected Table table() {
+ return subject().dbTable();
+ }
+
+ private Schema tableSchema() {
+ return database().schemaNamed(subject().getSchema());
+ }
+
+ @Override
+ protected String value() {
+ return subject().getSpecifiedName();
+ }
+
+ @Override
+ protected Iterator<String> values() {
+ Schema schema = tableSchema();
+
+ if (schema != null) {
+ return schema.tableNames();
+ }
+
+ return EmptyIterator.instance();
+ }
+ };
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- public void dispose() {
- this.catalogCombo.dispose();
- this.schemaCombo.dispose();
- this.tableCombo.dispose();
- super.dispose();
- }
+ protected void initializeLayout(Composite container) {
+
+ // Table group pane
+ Group tableGroupPane = buildTitledPane(
+ container,
+ JptUiMappingsMessages.TableComposite_tableSection
+ );
+
+ // Table widgets
+ TableCombo<ITable> tableCombo = buildTableCombo(tableGroupPane);
+
+ buildLabeledComposite(
+ tableGroupPane,
+ JptUiMappingsMessages.TableChooser_label,
+ tableCombo.getControl(),
+ IJpaHelpContextIds.ENTITY_TABLE
+ );
-}
+ // Catalog widgets
+ CatalogCombo<ITable> catalogCombo = buildCatalogCombo(tableGroupPane);
+
+ buildLabeledComposite(
+ tableGroupPane,
+ JptUiMappingsMessages.CatalogChooser_label,
+ catalogCombo.getControl(),
+ IJpaHelpContextIds.ENTITY_CATALOG
+ );
+
+ // Schema widgets
+ SchemaCombo<ITable> schemaCombo = buildSchemaCombo(tableGroupPane);
+
+ buildLabeledComposite(
+ tableGroupPane,
+ JptUiMappingsMessages.SchemaChooser_label,
+ schemaCombo.getControl(),
+ IJpaHelpContextIds.ENTITY_SCHEMA
+ );
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableGeneratorComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableGeneratorComposite.java
index 7426882c70..fca4a2607a 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableGeneratorComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TableGeneratorComposite.java
@@ -1,535 +1,388 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
-import java.util.Iterator;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.ITableGenerator;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.db.internal.ConnectionListener;
-import org.eclipse.jpt.db.internal.ConnectionProfile;
-import org.eclipse.jpt.db.internal.Database;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.ITableGenerator;
import org.eclipse.jpt.db.internal.Schema;
-import org.eclipse.jpt.db.internal.Table;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.swt.SWT;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+import org.eclipse.swt.widgets.Text;
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ----------------------------------------------- |
+ * | Name: | I | |
+ * | ----------------------------------------------- |
+ * | ----------------------------------------------- |
+ * | Table: | I |v| |
+ * | ----------------------------------------------- |
+ * | ----------------------------------------------- |
+ * | Primary Key Column: | I |v| |
+ * | ----------------------------------------------- |
+ * | ----------------------------------------------- |
+ * | Value Column: | I |v| |
+ * | ----------------------------------------------- |
+ * | ----------------------------------------------- |
+ * | Primary Key Column Value: | I |v| |
+ * | ----------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IIdMapping
+ * @see ITableGenerator
+ * @see GenerationComposite - The parent container
+ *
+ * @version 2.0
+ * @since 1.0
+ */
public class TableGeneratorComposite extends GeneratorComposite<ITableGenerator>
{
- private CCombo tableNameCombo;
private CCombo pkColumnNameCombo;
- private CCombo valueColumnNameCombo;
private CCombo pkColumnValueCombo;
+ private CCombo tableNameCombo;
+ private CCombo valueColumnNameCombo;
- private ConnectionListener connectionListener;
-
- private ConnectionProfile connectionProfile;
+ /**
+ * Creates a new <code>TableGeneratorComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public TableGeneratorComposite(AbstractFormPane<? extends IIdMapping> parentPane,
+ Composite parent) {
- public TableGeneratorComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, commandStack, widgetFactory);
- this.connectionListener = this.buildConnectionListener();
- }
-
- protected ITableGenerator createGenerator() {
- ITableGenerator tableGenerator = idMapping().createTableGenerator();
- idMapping().setTableGenerator(tableGenerator);
- return tableGenerator;
- }
-
- protected ITableGenerator generator(IId idMapping) {
- return idMapping.getTableGenerator();
+ super(parentPane, parent);
}
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout(2, false);
- composite.setLayout(layout);
-
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.TableGeneratorComposite_name);
-
- this.nameTextWidget = buildNameText(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.nameTextWidget.setLayoutData(gridData);
- helpSystem.setHelp(this.nameTextWidget, IJpaHelpContextIds.MAPPING_TABLE_GENERATOR_NAME);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.TableGeneratorComposite_table);
-
- this.tableNameCombo = buildTableNameCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.tableNameCombo.setLayoutData(gridData);
- helpSystem.setHelp(this.tableNameCombo, IJpaHelpContextIds.MAPPING_TABLE_GENERATOR_TABLE);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.TableGeneratorComposite_pkColumn);
-
- this.pkColumnNameCombo = buildPkColumnNameCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.pkColumnNameCombo.setLayoutData(gridData);
- helpSystem.setHelp(this.pkColumnNameCombo, IJpaHelpContextIds.MAPPING_TABLE_GENERATOR_PRIMARY_KEY_COLUMN);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.TableGeneratorComposite_valueColumn);
-
- this.valueColumnNameCombo = buildValueColumnNameCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.valueColumnNameCombo.setLayoutData(gridData);
- helpSystem.setHelp(this.valueColumnNameCombo, IJpaHelpContextIds.MAPPING_TABLE_GENERATOR_VALUE_COLUMN);
-
- getWidgetFactory().createLabel(composite, JptUiMappingsMessages.TableGeneratorComposite_pkColumnValue);
-
- this.pkColumnValueCombo = buildPkColumnValueCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.pkColumnValueCombo.setLayoutData(gridData);
- helpSystem.setHelp(this.pkColumnValueCombo, IJpaHelpContextIds.MAPPING_TABLE_GENERATOR_PRIMARY_KEY_COLUMN_VALUE);
- }
-
- private CCombo buildTableNameCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(JptUiMappingsMessages.TableGeneratorComposite_default);
- combo.select(0);
- combo.addModifyListener(buildTableNameListener());
- return combo;
+ protected ITableGenerator buildGenerator() {
+ return subject().addTableGenerator();
}
private CCombo buildPkColumnNameCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
+ CCombo combo = buildCombo(parent);
combo.add(JptUiMappingsMessages.TableGeneratorComposite_default);
combo.select(0);
combo.addModifyListener(buildPkColumnNameListener());
return combo;
}
- private CCombo buildValueColumnNameCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(JptUiMappingsMessages.TableGeneratorComposite_default);
- combo.select(0);
- combo.addModifyListener(buildValueColumnNameListener());
- return combo;
+ private ModifyListener buildPkColumnNameListener() {
+ return new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ String text = ((CCombo) e.getSource()).getText();
+ if (text != null && pkColumnNameCombo.getItemCount() > 0 && text.equals(pkColumnNameCombo.getItem(0))) {
+ text = null;
+ }
+ ITableGenerator generator = retrieveTableGenerator();
+ generator.setSpecifiedPkColumnName(text);
+ }
+ };
}
private CCombo buildPkColumnValueCombo(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
+ CCombo combo = buildCombo(parent);
combo.add(JptUiMappingsMessages.TableGeneratorComposite_default);
combo.select(0);
combo.addModifyListener(buildPkColumnValueListener());
return combo;
}
- private ModifyListener buildTableNameListener() {
+ private ModifyListener buildPkColumnValueListener() {
return new ModifyListener() {
public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
String text = ((CCombo) e.getSource()).getText();
- if (text != null && tableNameCombo.getItemCount() > 0 && text.equals(tableNameCombo.getItem(0))) {
+ if (text != null && pkColumnValueCombo.getItemCount() > 0 && text.equals(pkColumnValueCombo.getItem(0))) {
text = null;
}
- ITableGenerator generator = getGenerator();
- if (generator == null) {
- generator = createGenerator();
- }
- generator.setSpecifiedTable(text);
+ ITableGenerator generator = retrieveTableGenerator();
+ generator.setSpecifiedPkColumnValue(text);
}
};
}
- private ModifyListener buildPkColumnNameListener() {
+ private CCombo buildTableNameCombo(Composite parent) {
+ CCombo combo = buildCombo(parent);
+ combo.add(JptUiMappingsMessages.TableGeneratorComposite_default);
+ combo.select(0);
+ combo.addModifyListener(buildTableNameListener());
+ return combo;
+ }
+
+ private ModifyListener buildTableNameListener() {
return new ModifyListener() {
public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
String text = ((CCombo) e.getSource()).getText();
- if (text != null && pkColumnNameCombo.getItemCount() > 0 && text.equals(pkColumnNameCombo.getItem(0))) {
+ if (text != null && tableNameCombo.getItemCount() > 0 && text.equals(tableNameCombo.getItem(0))) {
text = null;
}
- ITableGenerator generator = getGenerator();
- if (generator == null) {
- generator = createGenerator();
- }
- generator.setSpecifiedPkColumnName(text);
+ ITableGenerator generator = retrieveTableGenerator();
+ generator.setSpecifiedTable(text);
}
};
}
+ private CCombo buildValueColumnNameCombo(Composite parent) {
+ CCombo combo = buildCombo(parent);
+ combo.add(JptUiMappingsMessages.TableGeneratorComposite_default);
+ combo.select(0);
+ combo.addModifyListener(buildValueColumnNameListener());
+ return combo;
+ }
+
private ModifyListener buildValueColumnNameListener() {
return new ModifyListener() {
public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
String text = ((CCombo) e.getSource()).getText();
if (text != null && valueColumnNameCombo.getItemCount() > 0 && text.equals(valueColumnNameCombo.getItem(0))) {
text = null;
}
- ITableGenerator generator = getGenerator();
- if (generator == null) {
- generator = createGenerator();
- }
+ ITableGenerator generator = retrieveTableGenerator();
generator.setSpecifiedValueColumnName(text);
}
};
}
- private ModifyListener buildPkColumnValueListener() {
- return new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String text = ((CCombo) e.getSource()).getText();
- if (text != null && pkColumnValueCombo.getItemCount() > 0 && text.equals(pkColumnValueCombo.getItem(0))) {
- text = null;
- }
- ITableGenerator generator = getGenerator();
- if (generator == null) {
- generator = createGenerator();
- }
- generator.setSpecifiedPkColumnValue(text);
- }
- };
- }
-
- protected void generatorChanged(Notification notification) {
- super.generatorChanged(notification);
- if (notification.getFeatureID(ITableGenerator.class) == JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_TABLE) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- String tableName = getGenerator().getSpecifiedTable();
- if (tableName == null) {
- tableNameCombo.select(0);
- }
- else if (!tableNameCombo.getText().equals(tableName)) {
- tableNameCombo.setText(tableName);
- }
- populatePkColumnNameCombo();
- populateValueColumnNameCombo();
- }
- });
- }
- else if (notification.getFeatureID(ITableGenerator.class) == JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populatePkColumnName();
-
- }
- });
- }
- else if (notification.getFeatureID(ITableGenerator.class) == JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_VALUE_COLUMN_NAME) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- String columnName = getGenerator().getSpecifiedValueColumnName();
- if (columnName == null) {
- valueColumnNameCombo.select(0);
- }
- else if (!valueColumnNameCombo.getText().equals(columnName)) {
- valueColumnNameCombo.setText(columnName);
- }
- }
- });
- }
- else if (notification.getFeatureID(ITableGenerator.class) == JpaCoreMappingsPackage.ITABLE_GENERATOR__SPECIFIED_PK_COLUMN_VALUE) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- String columnValue = getGenerator().getSpecifiedPkColumnValue();
- if (columnValue == null) {
- pkColumnValueCombo.select(0);
- }
- else if (!pkColumnValueCombo.getText().equals(columnValue)) {
- pkColumnValueCombo.setText(columnValue);
- }
- }
- });
- }
- }
-
- @Override
- protected void doPopulate(EObject obj) {
- super.doPopulate(obj);
- if (obj == null) {
- this.connectionProfile = null;
- return;
- }
- populateTableNameCombo();
- populatePkColumnNameCombo();
- populateValueColumnNameCombo();
- populatePkColumnValueCombo();
- }
-
+ /*
+ * (non-Javadoc)
+ */
@Override
protected void doPopulate() {
super.doPopulate();
+
populateTableNameCombo();
populatePkColumnNameCombo();
populateValueColumnNameCombo();
populatePkColumnValueCombo();
}
-
- @Override
- protected void engageListeners() {
- super.engageListeners();
- if (getGenerator() != null) {
- addConnectionListener();
- }
- }
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void disengageListeners() {
- if (getGenerator() != null) {
- removeConnectionListener();
- }
- super.disengageListeners();
+ protected ITableGenerator getGenerator(IIdMapping subject) {
+ return (subject != null) ? subject.getTableGenerator() : null;
}
-
- private ConnectionProfile getConnectionProfile() {
- if(this.connectionProfile == null) {
- IJpaProject jpaProject = idMapping().getJpaProject();
- this.connectionProfile = jpaProject.connectionProfile();
+
+ protected Schema getSchema() {
+ if (getGenerator(subject()) != null) {
+ return null;// this.getConnectionProfile().getDatabase().schemaNamed(getGenerator().getSchema());
}
- return this.connectionProfile;
+ return null;
}
-
- private void addConnectionListener() {
- this.getConnectionProfile().addConnectionListener(this.connectionListener);
- }
-
- private void removeConnectionListener() {
- this.getConnectionProfile().removeConnectionListener(this.connectionListener);
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ // Name widgets
+ Text nameText = this.buildNameText(container);
+ this.setNameText(nameText);
+
+ this.buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.TableGeneratorComposite_name,
+ nameText,
+ IJpaHelpContextIds.MAPPING_TABLE_GENERATOR_NAME
+ );
+
+ // Table widgets
+ this.tableNameCombo = buildTableNameCombo(container);
+
+ this.buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.TableGeneratorComposite_table,
+ tableNameCombo.getParent(),
+ IJpaHelpContextIds.MAPPING_TABLE_GENERATOR_TABLE
+ );
+
+ // Primary Key Column widgets
+ this.pkColumnNameCombo = buildPkColumnNameCombo(container);
+
+ this.buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.TableGeneratorComposite_pkColumn,
+ pkColumnNameCombo.getParent(),
+ IJpaHelpContextIds.MAPPING_TABLE_GENERATOR_PRIMARY_KEY_COLUMN
+ );
+
+ // Value Column widgets
+ this.valueColumnNameCombo = buildValueColumnNameCombo(container);
+
+ this.buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.TableGeneratorComposite_valueColumn,
+ valueColumnNameCombo.getParent(),
+ IJpaHelpContextIds.MAPPING_TABLE_GENERATOR_VALUE_COLUMN
+ );
+
+ // Primary Key Column Value widgets
+ this.pkColumnValueCombo = buildPkColumnValueCombo(container);
+
+ this.buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.TableGeneratorComposite_pkColumnValue,
+ pkColumnValueCombo.getParent(),
+ IJpaHelpContextIds.MAPPING_TABLE_GENERATOR_PRIMARY_KEY_COLUMN_VALUE
+ );
}
- protected Schema getSchema() {
- if (getGenerator() != null) {
- return this.getConnectionProfile().getDatabase().schemaNamed(getGenerator().getSchema());
- }
- return null;
+ private void populatePkColumnChoices() {
+ this.pkColumnNameCombo.remove(1, this.pkColumnNameCombo.getItemCount() - 1);
+
+// if (this.getConnectionProfile().isConnected()) {
+// if (!this.tableNameCombo.getText().equals(JptUiMappingsMessages.TableGeneratorComposite_default)) { // hmm,
+// // if they actually set the table to Default??
+// String tableName = this.tableNameCombo.getText();
+// Schema schema = getSchema();
+// if (schema != null) {
+// Table table = schema.tableNamed(tableName);
+// if (table != null) {
+// for (Iterator<String> stream = CollectionTools.sort(table.columnNames()); stream.hasNext();) {
+// this.pkColumnNameCombo.add(stream.next());
+// }
+// }
+// }
+// }
+// }
}
- private void populateTableNameCombo() {
- if (this.getGenerator() == null) {
- return;
- }
- if (this.getConnectionProfile().isConnected()) {
- this.tableNameCombo.remove(1, this.tableNameCombo.getItemCount()-1);
- Schema schema = this.getSchema();
- if (schema != null) {
- Iterator<String> tables = schema.tableNames();
- for (Iterator<String> stream = CollectionTools.sort(tables); stream.hasNext(); ) {
- this.tableNameCombo.add(stream.next());
- }
- }
- }
- String tableName = this.getGenerator().getSpecifiedTable();
- if (tableName != null) {
- if (!this.tableNameCombo.getText().equals(tableName)) {
- this.tableNameCombo.setText(tableName);
+
+ private void populatePkColumnName() {
+ String pkColumnName = this.tableGenerator().getSpecifiedPkColumnName();
+ if (pkColumnName != null) {
+ if (!this.pkColumnNameCombo.getText().equals(pkColumnName)) {
+ this.pkColumnNameCombo.setText(pkColumnName);
}
}
else {
- this.tableNameCombo.select(0);
+ this.pkColumnNameCombo.select(0);
}
}
private void populatePkColumnNameCombo() {
- if (this.getGenerator() == null) {
+ if (this.tableGenerator() == null) {
return;
}
populatePkColumnChoices();
populatePkColumnName();
}
- private void populatePkColumnChoices() {
- this.pkColumnNameCombo.remove(1, this.pkColumnNameCombo.getItemCount() - 1);
-
- if (this.getConnectionProfile().isConnected()) {
- if (!this.tableNameCombo.getText().equals(JptUiMappingsMessages.TableGeneratorComposite_default)) { // hmm,
- // if
- // they
- // actually
- // set
- // the
- // table
- // to
- // Default??
- String tableName = this.tableNameCombo.getText();
- Schema schema = getSchema();
- if (schema != null) {
- Table table = schema.tableNamed(tableName);
- if (table != null) {
- for (Iterator<String> stream = CollectionTools.sort(table.columnNames()); stream.hasNext();) {
- this.pkColumnNameCombo.add(stream.next());
- }
- }
- }
- }
+
+ private void populatePkColumnValueCombo() {
+ if (this.tableGenerator() == null) {
+ return;
}
- }
-
- private void populatePkColumnName() {
- String pkColumnName = this.getGenerator().getSpecifiedPkColumnName();
- if (pkColumnName != null) {
- if (!this.pkColumnNameCombo.getText().equals(pkColumnName)) {
- this.pkColumnNameCombo.setText(pkColumnName);
+ String pkColumnValue = this.tableGenerator().getSpecifiedPkColumnValue();
+ if (pkColumnValue != null) {
+ if (!this.pkColumnValueCombo.getText().equals(pkColumnValue)) {
+ this.pkColumnValueCombo.setText(pkColumnValue);
}
}
else {
- this.pkColumnNameCombo.select(0);
+ this.pkColumnValueCombo.select(0);
}
}
- private void populateValueColumnNameCombo() {
- if (this.getGenerator() == null) {
+ private void populateTableNameCombo() {
+ if (this.tableGenerator() == null) {
return;
}
- if (this.getConnectionProfile().isConnected()) {
- this.valueColumnNameCombo.remove(1, this.valueColumnNameCombo.getItemCount() - 1);
- if (!this.tableNameCombo.getText().equals(JptUiMappingsMessages.TableGeneratorComposite_default)) { // hmm,
- // if
- // they
- // actually
- // set
- // the
- // table
- // to
- // Default??
- String tableName = this.tableNameCombo.getText();
- Schema schema = getSchema();
- if (schema != null) {
- Table table = schema.tableNamed(tableName);
- if (table != null) {
- for (Iterator<String> stream = CollectionTools.sort(table.columnNames()); stream.hasNext();) {
- this.valueColumnNameCombo.add(stream.next());
- }
- }
- }
- }
- }
- String valueColumnName = this.getGenerator().getSpecifiedValueColumnName();
- if (valueColumnName != null) {
- if (!this.valueColumnNameCombo.getText().equals(valueColumnName)) {
- this.valueColumnNameCombo.setText(valueColumnName);
+// if (this.getConnectionProfile().isConnected()) {
+// this.tableNameCombo.remove(1, this.tableNameCombo.getItemCount()-1);
+// Schema schema = this.getSchema();
+// if (schema != null) {
+// Iterator<String> tables = schema.tableNames();
+// for (Iterator<String> stream = CollectionTools.sort(tables); stream.hasNext(); ) {
+// this.tableNameCombo.add(stream.next());
+// }
+// }
+// }
+ String tableName = this.tableGenerator().getSpecifiedTable();
+ if (tableName != null) {
+ if (!this.tableNameCombo.getText().equals(tableName)) {
+ this.tableNameCombo.setText(tableName);
}
}
else {
- this.valueColumnNameCombo.select(0);
+ this.tableNameCombo.select(0);
}
}
- private void populatePkColumnValueCombo() {
- if (this.getGenerator() == null) {
+ private void populateValueColumnNameCombo() {
+ if (this.tableGenerator() == null) {
return;
}
- String pkColumnValue = this.getGenerator().getSpecifiedPkColumnValue();
- if (pkColumnValue != null) {
- if (!this.pkColumnValueCombo.getText().equals(pkColumnValue)) {
- this.pkColumnValueCombo.setText(pkColumnValue);
+// if (this.getConnectionProfile().isConnected()) {
+// this.valueColumnNameCombo.remove(1, this.valueColumnNameCombo.getItemCount() - 1);
+// if (!this.tableNameCombo.getText().equals(JptUiMappingsMessages.TableGeneratorComposite_default)) { // hmm,
+// // if they actually set the table to Default??
+// String tableName = this.tableNameCombo.getText();
+// Schema schema = getSchema();
+// if (schema != null) {
+// Table table = schema.tableNamed(tableName);
+// if (table != null) {
+// for (Iterator<String> stream = CollectionTools.sort(table.columnNames()); stream.hasNext();) {
+// this.valueColumnNameCombo.add(stream.next());
+// }
+// }
+// }
+// }
+// }
+ String valueColumnName = this.tableGenerator().getSpecifiedValueColumnName();
+ if (valueColumnName != null) {
+ if (!this.valueColumnNameCombo.getText().equals(valueColumnName)) {
+ this.valueColumnNameCombo.setText(valueColumnName);
}
}
else {
- this.pkColumnValueCombo.select(0);
+ this.valueColumnNameCombo.select(0);
}
}
- protected void clear() {
- super.clear();
- this.tableNameCombo.select(0);
- this.pkColumnNameCombo.select(0);
- this.pkColumnValueCombo.select(0);
- this.valueColumnNameCombo.select(0);
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected String propertyName() {
+ return IIdMapping.TABLE_GENERATOR_PROPERTY;
}
-
- private ConnectionListener buildConnectionListener() {
- return new ConnectionListener() {
- public void closed(ConnectionProfile profile) {
- populate();
- }
-
- public void modified(ConnectionProfile profile) {
- populate();
- }
- public void opened(ConnectionProfile profile) {
- populate();
- }
+ private ITableGenerator retrieveTableGenerator() {
+ ITableGenerator generator = tableGenerator();
- public void databaseChanged(ConnectionProfile profile, final Database database) {
- populate();
- }
-
- public void schemaChanged(ConnectionProfile profile, final Schema schema) {
- populate();
- }
+ if (generator == null) {
+ setPopulating(true);
- private void populate() {
- getControl().getDisplay().asyncExec( new Runnable() {
- public void run() {
- if (getControl().isDisposed()) {
- return;
- }
- populateTableNameCombo();
- populatePkColumnChoices();
- populateValueColumnNameCombo();
- }
- });
- }
-
- public void aboutToClose(ConnectionProfile profile) {
- // not interested to this event.
- }
-
- public boolean okToClose(ConnectionProfile profile) {
- // not interested to this event.
- return true;
+ try {
+ generator = buildGenerator();
}
-
- public void tableChanged(ConnectionProfile profile, final Table table) {
- // not interested to this event.
+ finally {
+ setPopulating(false);
}
- };
+ }
+
+ return generator;
+ }
+
+ private ITableGenerator tableGenerator() {
+ return (subject() != null) ? subject().getTableGenerator() : null;
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TargetEntityChooser.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TargetEntityChooser.java
deleted file mode 100644
index dc1ae25cfa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TargetEntityChooser.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.ui.IJavaElementSearchConstants;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.mappings.IRelationshipMapping;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class TargetEntityChooser extends BaseJpaController
-{
- private IRelationshipMapping relationshipMapping;
- private Adapter relationshipMappingListener;
-
- protected CCombo targetEntityCombo;
-
-
- private Composite composite;
-
- public TargetEntityChooser(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildRelationshipMappingListener();
- }
-
-
- private void buildRelationshipMappingListener() {
- relationshipMappingListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- relationshipMappingChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- this.composite = getWidgetFactory().createComposite(parent);
- GridLayout gridLayout = new GridLayout();
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- gridLayout.numColumns = 3;
- this.composite.setLayout(gridLayout);
-
- CommonWidgets.buildTargetEntityLabel(this.composite, getWidgetFactory());
-
- this.targetEntityCombo = buildTargetEntityCombo(this.composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- this.targetEntityCombo.setLayoutData(gridData);
-
- buildTargetEntitySelectionButton(this.composite);
-
- }
-
- protected CCombo buildTargetEntityCombo(Composite parent) {
- final CCombo combo = getWidgetFactory().createCCombo(parent, SWT.FLAT);
- combo.add(JptUiMappingsMessages.TargetEntityChooser_defaultEmpty);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(combo, IJpaHelpContextIds.MAPPING_TARGET_ENTITY);
- combo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
- String targetEntityName = ((CCombo) e.getSource()).getText();
- if (targetEntityName.equals(combo.getItem(0)) || targetEntityName.equals("")) { //$NON-NLS-1$
- targetEntityName = null;
- }
- else if (!relationshipMapping.targetEntityIsValid(targetEntityName)) {
- return;
- }
- relationshipMapping.setSpecifiedTargetEntity(targetEntityName);
- }
- });
- return combo;
- }
-
-
- private void relationshipMappingChanged(Notification notification) {
- if (notification.getFeatureID(IRelationshipMapping.class) ==
- JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__SPECIFIED_TARGET_ENTITY) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- else if (notification.getFeatureID(IRelationshipMapping.class) ==
- JpaCoreMappingsPackage.IRELATIONSHIP_MAPPING__DEFAULT_TARGET_ENTITY) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (relationshipMapping != null) {
- relationshipMapping.eAdapters().add(relationshipMappingListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.relationshipMapping != null) {
- this.relationshipMapping.eAdapters().remove(relationshipMappingListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.relationshipMapping = (IRelationshipMapping) obj;
- populateCombo();
- }
-
- @Override
- protected void doPopulate() {
- populateCombo();
- }
-
- private void populateCombo() {
- if (relationshipMapping == null) {
- targetEntityCombo.clearSelection();
- return;
- }
- String targetEntity = this.relationshipMapping.getSpecifiedTargetEntity();
- this.targetEntityCombo.setItem(0, NLS.bind(JptUiMappingsMessages.TargetEntityChooser_defaultWithOneParam, this.relationshipMapping.getDefaultTargetEntity()));
- if (targetEntity != null) {
- if (!this.targetEntityCombo.getText().equals(targetEntity)) {
- this.targetEntityCombo.setText(targetEntity);
- }
- }
- else {
- if (this.targetEntityCombo.getSelectionIndex() != 0) {
- this.targetEntityCombo.select(0);
- }
- }
- }
-
- @Override
- public Control getControl() {
- return this.composite;
- }
-
- //see org.eclipse.pde.internal.ui.editor.plugin.rows.ClassAttributeRow
- //for example of the hyperlink opening a resource
- protected Button buildTargetEntitySelectionButton(Composite parent) {
- Button button = getWidgetFactory().createButton(
- parent,
- JptUiMappingsMessages.TargetEntityChooser_browse,
- SWT.PUSH);
-
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- browse();
- }
- });
- return button;
- }
-
- protected void browse() {
- BusyIndicator.showWhile(this.targetEntityCombo.getDisplay(), new Runnable() {
- public void run() {
- doOpenSelectionDialog();
- }
- });
- }
-
- private void doOpenSelectionDialog() {
- SelectionDialog dialog;
- try {
- dialog = JavaUI.createTypeDialog(getControl().getShell(),
- PlatformUI.getWorkbench().getProgressService(),
- SearchEngine.createWorkspaceScope(),
- IJavaElementSearchConstants.CONSIDER_ALL_TYPES,
- false,
- ""); //$NON-NLS-1$
- }
- catch (JavaModelException e) {
- throw new RuntimeException(e);
- }
- dialog.setTitle("Select Type"); //$NON-NLS-1$
- if (dialog.open() == Window.OK) {
- IType type = (IType) dialog.getResult()[0];
- this.targetEntityCombo.setText(type.getFullyQualifiedName('$'));
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TargetEntityComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TargetEntityComposite.java
new file mode 100644
index 0000000000..30d7a90859
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TargetEntityComposite.java
@@ -0,0 +1,241 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
+
+import java.util.Collection;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.ui.IJavaElementSearchConstants;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jpt.core.internal.context.base.IRelationshipMapping;
+import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
+import org.eclipse.jpt.ui.internal.JptUiPlugin;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.SelectionDialog;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ---------------------------------------------------------- |
+ * | Target Entity: | |v| |
+ * | ---------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IRelationshipMapping
+ * @see OneToOneMappingComposite - A container of this pane
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+@SuppressWarnings("nls")
+public class TargetEntityComposite extends AbstractFormPane<IRelationshipMapping>
+{
+ private CCombo targetEntityCombo;
+
+ /**
+ * Creates a new <code>TargetEntityComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ protected TargetEntityComposite(AbstractFormPane<? extends IRelationshipMapping> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ /**
+ * Creates a new <code>TargetEntityComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IRelationshipMapping</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public TargetEntityComposite(PropertyValueModel<? extends IRelationshipMapping> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(IRelationshipMapping.DEFAULT_TARGET_ENTITY_PROPERTY);
+ propertyNames.add(IRelationshipMapping.SPECIFIED_TARGET_ENTITY_PROPERTY);
+ }
+
+ private Runnable buildOpenTargetEntityAction() {
+ return new Runnable() {
+ public void run() {
+ System.out.println("TODO: Open Editor");
+ }
+ };
+ }
+
+ private Runnable buildOpenTypeAction() {
+ return new Runnable() {
+ public void run() {
+ BusyIndicator.showWhile(targetEntityCombo.getDisplay(), new Runnable() {
+ public void run() {
+ doOpenSelectionDialog();
+ }
+ });
+ }
+ };
+ }
+
+ private ModifyListener buildTargetEntityModifyListener() {
+ return new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+
+ String targetEntityName = targetEntityCombo.getText();
+
+ if (StringTools.stringIsEmpty(targetEntityName)) {
+ targetEntityName = null;
+ }
+ else if (targetEntityName.equals(targetEntityCombo.getItem(0)) || targetEntityName.equals("")) { //$NON-NLS-1$
+ targetEntityName = null;
+ }
+ else if (!subject().targetEntityIsValid(targetEntityName)) {
+ return;
+ }
+
+ if (targetEntityName != null) {
+ targetEntityName = targetEntityName.trim();
+ }
+
+ subject().setSpecifiedTargetEntity(targetEntityName);
+ }
+ };
+ }
+
+ private Button buildTargetEntitySelectionButton(Composite parent) {
+ return buildPushButton(
+ parent,
+ JptUiMappingsMessages.TargetEntityChooser_browse,
+ buildOpenTypeAction()
+ );
+ }
+
+ private void doOpenSelectionDialog() {
+ SelectionDialog dialog;
+
+ try {
+ dialog = JavaUI.createTypeDialog(
+ getControl().getShell(),
+ PlatformUI.getWorkbench().getProgressService(),
+ SearchEngine.createWorkspaceScope(),
+ IJavaElementSearchConstants.CONSIDER_ALL_TYPES,
+ false
+ );
+ }
+ catch (JavaModelException e) {
+ JptUiPlugin.log(e);
+ return;
+ }
+
+ dialog.setTitle(JptUiMappingsMessages.TargetEntityChooser_selectTypeTitle);
+
+ if (dialog.open() == Window.OK) {
+ IType type = (IType) dialog.getResult()[0];
+ this.targetEntityCombo.setText(type.getFullyQualifiedName('$'));
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void doPopulate() {
+ super.doPopulate();
+ this.populateCombo();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ targetEntityCombo = buildCombo(container);
+ targetEntityCombo.add(JptUiMappingsMessages.TargetEntityChooser_defaultEmpty);
+ targetEntityCombo.addModifyListener(buildTargetEntityModifyListener());
+
+ Hyperlink labelLink = buildHyperLink(container,
+ JptUiMappingsMessages.TargetEntityChooser_label,
+ buildOpenTargetEntityAction()
+ );
+
+ buildLabeledComposite(
+ container,
+ labelLink,
+ targetEntityCombo,
+ buildTargetEntitySelectionButton(container),
+ IJpaHelpContextIds.MAPPING_TARGET_ENTITY
+ );
+ }
+
+ private void populateCombo() {
+
+ if (targetEntityCombo.isDisposed()) {
+ return;
+ }
+
+ targetEntityCombo.clearSelection();
+
+ if (subject() != null) {
+ String targetEntity = subject().getSpecifiedTargetEntity();
+ targetEntityCombo.setItem(0, NLS.bind(JptUiMappingsMessages.TargetEntityChooser_defaultWithOneParam, subject().getDefaultTargetEntity()));
+
+ if (targetEntity != null) {
+ if (!targetEntityCombo.getText().equals(targetEntity)) {
+ targetEntityCombo.setText(targetEntity);
+ }
+ }
+ else {
+ if (targetEntityCombo.getSelectionIndex() != 0) {
+ targetEntityCombo.select(0);
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void propertyChanged(String propertyName) {
+ super.propertyChanged(propertyName);
+
+ if (propertyName == IRelationshipMapping.DEFAULT_TARGET_ENTITY_PROPERTY ||
+ propertyName == IRelationshipMapping.SPECIFIED_TARGET_ENTITY_PROPERTY) {
+
+ populateCombo();
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TemporalTypeComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TemporalTypeComposite.java
new file mode 100644
index 0000000000..9323beb2f1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TemporalTypeComposite.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.ui.internal.mappings.details;
+
+import java.util.Collection;
+import org.eclipse.jpt.core.internal.context.base.IColumnMapping;
+import org.eclipse.jpt.core.internal.context.base.TemporalType;
+import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
+import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.EnumComboViewer;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | --------------------------------------------------------------- |
+ * | Temporal: | |v| |
+ * | --------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IColumnMapping
+ * @see BasicMappingComposite - A container of this widget
+ * @see IdMappingComposite - A container of this widget
+ * @see VersionMappingComposite - A container of this widget
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class TemporalTypeComposite extends AbstractFormPane<IColumnMapping> {
+
+ /**
+ * Creates a new <code>TemporalTypeComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public TemporalTypeComposite(AbstractFormPane<? extends IColumnMapping> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ private EnumComboViewer<IColumnMapping, TemporalType> buildTemporalCombo(Composite container) {
+
+ return new EnumComboViewer<IColumnMapping, TemporalType>(this, container) {
+
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(IColumnMapping.TEMPORAL_PROPERTY);
+ }
+
+ @Override
+ protected TemporalType[] choices() {
+ return TemporalType.values();
+ }
+
+ @Override
+ protected TemporalType defaultValue() {
+ return null;
+ }
+
+ @Override
+ protected String displayString(TemporalType value) {
+ return buildDisplayString(
+ JptUiMappingsMessages.class,
+ TemporalTypeComposite.this,
+ value.name()
+ );
+ }
+
+ @Override
+ protected TemporalType getValue() {
+ return subject().getTemporal();
+ }
+
+ @Override
+ protected void setValue(TemporalType value) {
+ subject().setTemporal(value);
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ EnumComboViewer<IColumnMapping, TemporalType> temporalCombo =
+ buildTemporalCombo(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiMappingsMessages.BasicGeneralSection_temporalLabel,
+ temporalCombo.getControl(),
+ IJpaHelpContextIds.MAPPING_TEMPORAL
+ );
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TransientComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TransientComposite.java
deleted file mode 100644
index 3871e8ac4c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TransientComposite.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class TransientComposite extends BaseJpaComposite
-{
- public TransientComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
-
- @Override
- protected void initializeLayout(Composite composite) {
-
- }
-
-
- public void doPopulate(EObject obj) {
- }
-
- public void doPopulate() {
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TransientMappingComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TransientMappingComposite.java
new file mode 100644
index 0000000000..7614db08c8
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/TransientMappingComposite.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
+import org.eclipse.jpt.ui.internal.details.IJpaComposite;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * This pane does not have any widgets.
+ *
+ * @see ITransientMapping
+ * @see BaseJpaUiFactory - The factory creating this pane
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class TransientMappingComposite extends AbstractFormPane<ITransientMapping>
+ implements IJpaComposite<ITransientMapping>
+{
+ /**
+ * Creates a new <code>TransientMappingComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>ITransientMapping</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public TransientMappingComposite(PropertyValueModel<? extends ITransientMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionComposite.java
deleted file mode 100644
index fe7fb65ac2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionComposite.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ui.internal.mappings.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.IVersion;
-import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
-import org.eclipse.jpt.core.internal.mappings.TemporalType;
-import org.eclipse.jpt.ui.internal.details.BaseJpaComposite;
-import org.eclipse.jpt.ui.internal.mappings.details.EnumComboViewer.EnumHolder;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class VersionComposite extends BaseJpaComposite
-{
- private IVersion version;
-
- private ColumnComposite columnComposite;
-
- private EnumComboViewer temporalTypeViewer;
-
-
- public VersionComposite(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, SWT.NULL, commandStack, widgetFactory);
- }
- @Override
- protected void initializeLayout(Composite composite) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- Control generalControl = buildGeneralComposite(composite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- generalControl.setLayoutData(gridData);
-
- }
-
- private Control buildGeneralComposite(Composite composite) {
-// IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
-
- Composite generalComposite = getWidgetFactory().createComposite(composite);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- generalComposite.setLayout(layout);
-
- this.columnComposite = new ColumnComposite(generalComposite, this.commandStack, getWidgetFactory());
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.columnComposite.getControl().setLayoutData(gridData);
-
- CommonWidgets.buildTemporalLabel(generalComposite, getWidgetFactory());
- this.temporalTypeViewer = CommonWidgets.buildEnumComboViewer(generalComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.temporalTypeViewer.getControl().setLayoutData(gridData);
-
- return generalComposite;
- }
-
- public void doPopulate(EObject obj) {
- this.version = (IVersion) obj;
- if (this.version != null) {
- this.columnComposite.populate(this.version.getColumn());
- }
- else {
- this.columnComposite.populate(null);
- }
- this.temporalTypeViewer.populate(new TemporalTypeHolder(this.version));
- }
-
- public void doPopulate() {
- this.columnComposite.populate();
- this.temporalTypeViewer.populate();
- }
-
- protected void engageListeners() {
- }
-
- protected void disengageListeners() {
- }
-
- @Override
- public void dispose() {
- this.columnComposite.dispose();
- this.temporalTypeViewer.dispose();
- super.dispose();
- }
-
- protected IVersion getVersion() {
- return this.version;
- }
-
-
-
-
- private class TemporalTypeHolder extends EObjectImpl implements EnumHolder {
-
- private IVersion version;
-
- TemporalTypeHolder(IVersion version) {
- super();
- this.version = version;
- }
-
- public Object get() {
- return this.version.getTemporal();
- }
-
- public void set(Object enumSetting) {
- this.version.setTemporal((TemporalType) enumSetting);
- }
-
- public Class featureClass() {
- return IBasic.class;
- }
-
- public int featureId() {
- return JpaCoreMappingsPackage.IVERSION__TEMPORAL;
- }
-
- public EObject wrappedObject() {
- return this.version;
- }
-
- public Object[] enumValues() {
- return TemporalType.VALUES.toArray();
- }
-
- /**
- * TemporalType has no Default, return null
- */
- public Object defaultValue() {
- return null;
- }
-
- /**
- * TemporalType has no Default, return null
- */
- public String defaultString() {
- return null;
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionMappingComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionMappingComposite.java
new file mode 100644
index 0000000000..1af0e0b84d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/mappings/details/VersionMappingComposite.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.ui.internal.mappings.details;
+
+import org.eclipse.jpt.core.internal.context.base.IColumn;
+import org.eclipse.jpt.core.internal.context.base.IVersionMapping;
+import org.eclipse.jpt.ui.internal.details.IJpaComposite;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | ColumnComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | TemporalTypeComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see IBasicMapping
+ * @see BaseJpaUiFactory - The factory creating this pane
+ * @see ColumnComposite
+ * @see TemporalTypeComposite
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class VersionMappingComposite extends AbstractFormPane<IVersionMapping>
+ implements IJpaComposite<IVersionMapping>
+{
+ /**
+ * Creates a new <code>VersionMappingComposite</code>.
+ *
+ * @param subjectHolder The holder of the subject <code>IVersionMapping</code>
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public VersionMappingComposite(PropertyValueModel<? extends IVersionMapping> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ private PropertyValueModel<IColumn> buildColumnHolder() {
+ return new TransformationPropertyValueModel<IVersionMapping, IColumn>(getSubjectHolder()) {
+ @Override
+ protected IColumn transform_(IVersionMapping value) {
+ return value.getColumn();
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ // Column widgets
+ new ColumnComposite(this, buildColumnHolder(), container);
+
+ // Temporal Type widgets
+ new TemporalTypeComposite(this, container);
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/navigator/JpaNavigatorContentProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/navigator/JpaNavigatorContentProvider.java
new file mode 100644
index 0000000000..58ff3beae1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/navigator/JpaNavigatorContentProvider.java
@@ -0,0 +1,258 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.navigator;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jpt.core.internal.IJpaPlatform;
+import org.eclipse.jpt.core.internal.IJpaProject;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.ui.internal.IJpaPlatformUi;
+import org.eclipse.jpt.ui.internal.JptUiPlugin;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent;
+import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener;
+import org.eclipse.wst.common.project.facet.core.events.IProjectFacetActionEvent;
+
+/**
+ * This extension of navigator content provider delegates to the platform UI
+ * (see the org.eclipse.jpt.ui.jpaPlatform extension point) for navigator content.
+ *
+ * If there is a platform UI for the given project, this content provider will
+ * provide a root "JPA Content" node (child of the project), otherwise there
+ * will be no content. For children of the "JPA Content" node (or for any other
+ * sub-node), this provider will delegate to the content provider returned by the
+ * platform UI implementation.
+ */
+public class JpaNavigatorContentProvider
+ implements ICommonContentProvider
+{
+ private IFacetedProjectListener facetListener;
+
+ private StructuredViewer viewer;
+
+ /**
+ * Exactly *one* of these is created for each view that utilizes it. Therefore,
+ * as we delegate to the platform UI for each project, we should maintain the
+ * same multiplicity. That is, if there is a delegate for each platform UI, we
+ * should maintain *one* delegate for each view.
+ *
+ * Key: platform id, Value: delegate content provider
+ */
+ private Map<String, ICommonContentProvider> delegateContentProviders;
+
+
+ public JpaNavigatorContentProvider() {
+ super();
+ delegateContentProviders = new HashMap<String, ICommonContentProvider>();
+ facetListener = new FacetListener();
+ FacetedProjectFramework.addListener(
+ facetListener,
+ IFacetedProjectEvent.Type.POST_INSTALL,
+ IFacetedProjectEvent.Type.POST_UNINSTALL,
+ IFacetedProjectEvent.Type.PROJECT_MODIFIED);
+ }
+
+
+ // **************** IContentProvider implementation ************************
+
+ public void dispose() {
+ FacetedProjectFramework.removeListener(facetListener);
+ for (ICommonContentProvider delegate : delegateContentProviders.values()) {
+ delegate.dispose();
+ }
+ delegateContentProviders.clear();
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // should always be a StructuredViewer
+ this.viewer = (StructuredViewer) viewer;
+ for (ICommonContentProvider delegate : delegateContentProviders.values()) {
+ delegate.inputChanged(viewer, oldInput, newInput);
+ }
+ }
+
+
+ // **************** IStructuredContentProvider implementation **************
+
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+
+ // **************** ITreeContentProvider implementation ********************
+
+ public Object getParent(Object element) {
+ ICommonContentProvider delegate = getDelegate(element);
+
+ if (delegate != null) {
+ return delegate.getParent(element);
+ }
+
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ if (element instanceof IAdaptable) {
+ IProject project = (IProject) ((IAdaptable) element).getAdapter(IProject.class);
+
+ if (project != null) {
+ IJpaProject jpaProject = JptCorePlugin.jpaProject(project);
+ if (jpaProject != null) {
+ IJpaPlatformUi platformUi = JptUiPlugin.getPlugin().jpaPlatformUi(jpaProject.jpaPlatform());
+
+ return platformUi != null;
+ }
+ }
+ }
+
+ ICommonContentProvider delegate = getDelegate(element);
+
+ if (delegate != null) {
+ return delegate.hasChildren(element);
+ }
+
+ return false;
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IAdaptable) {
+ IProject project = (IProject) ((IAdaptable) parentElement).getAdapter(IProject.class);
+
+ if (project != null) {
+ IJpaProject jpaProject = JptCorePlugin.jpaProject(project);
+ if (jpaProject != null) {
+ IJpaPlatformUi platformUi = JptUiPlugin.getPlugin().jpaPlatformUi(jpaProject.jpaPlatform());
+
+ if (platformUi != null) {
+ return new Object[] {jpaProject.contextModel()};
+ }
+ }
+ }
+ }
+
+ ICommonContentProvider delegate = getDelegate(parentElement);
+
+ if (delegate != null) {
+ return delegate.getChildren(parentElement);
+ }
+
+ return new Object[0];
+ }
+
+
+ // **************** IMementoAware implementation ***************************
+
+ public void saveState(IMemento memento) {
+ for (ICommonContentProvider delegate : delegateContentProviders.values()) {
+ delegate.saveState(memento);
+ }
+ }
+
+ public void restoreState(IMemento memento) {
+ for (ICommonContentProvider delegate : delegateContentProviders.values()) {
+ delegate.restoreState(memento);
+ }
+ }
+
+
+ // **************** ICommonContentProvider implementation ******************
+
+ public void init(ICommonContentExtensionSite config) {
+ for (ICommonContentProvider delegate : delegateContentProviders.values()) {
+ delegate.init(config);
+ }
+ }
+
+
+ // *************** internal ************************************************
+
+ private ICommonContentProvider getDelegate(Object element) {
+ if (! (element instanceof IAdaptable)) {
+ return null;
+ }
+
+ IJpaContextNode contextNode = (IJpaContextNode) ((IAdaptable) element).getAdapter(IJpaContextNode.class);
+
+ if (contextNode == null) {
+ return null;
+ }
+
+ IJpaPlatform platform = contextNode.jpaProject().jpaPlatform();
+ IJpaPlatformUi platformUi = JptUiPlugin.getPlugin().jpaPlatformUi(platform);
+
+ ICommonContentProvider delegate = delegateContentProviders.get(platform.getId());
+
+ if (delegate == null && platform != null && ! delegateContentProviders.containsKey(platform.getId())) {
+ delegate = platformUi.buildNavigatorContentProvider();
+ delegateContentProviders.put(platform.getId(), delegate);
+ }
+
+ return delegate;
+ }
+
+
+ // **************** member classes *****************************************
+
+ private class FacetListener
+ implements IFacetedProjectListener
+ {
+ public void handleEvent(IFacetedProjectEvent event) {
+ if (event.getType() == IFacetedProjectEvent.Type.PROJECT_MODIFIED) {
+ refreshViewer(event.getProject().getProject());
+ }
+ else if (event.getType() == IFacetedProjectEvent.Type.POST_INSTALL
+ || event.getType() == IFacetedProjectEvent.Type.POST_UNINSTALL) {
+ IProjectFacetActionEvent ipaEvent = (IProjectFacetActionEvent) event;
+ if (ipaEvent.getProjectFacet().equals(
+ ProjectFacetsManager.getProjectFacet(JptCorePlugin.FACET_ID))) {
+ refreshViewer(ipaEvent.getProject().getProject());
+ }
+ }
+ }
+
+ private void refreshViewer(final IProject project) {
+ if (viewer != null
+ && viewer.getControl() != null
+ && !viewer.getControl().isDisposed()) {
+ // Using job here so that project model update (which also uses
+ // a job) will complete first
+ Job refreshJob = new Job("Refresh viewer") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ // Using runnable here so that refresh will go on correct thread
+ viewer.getControl().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ viewer.refresh(project);
+ }
+ });
+ return Status.OK_STATUS;
+ }
+ };
+ refreshJob.setRule(project);
+ refreshJob.schedule();
+ }
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/navigator/JpaNavigatorLabelProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/navigator/JpaNavigatorLabelProvider.java
new file mode 100644
index 0000000000..96714c09c0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/navigator/JpaNavigatorLabelProvider.java
@@ -0,0 +1,185 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.navigator;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.LabelProviderChangedEvent;
+import org.eclipse.jpt.core.internal.IJpaPlatform;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.ui.internal.IJpaPlatformUi;
+import org.eclipse.jpt.ui.internal.JptUiPlugin;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonLabelProvider;
+
+/**
+ * This extension of navigator label provider delegates to the platform UI
+ * (see the org.eclipse.jpt.ui.jpaPlatform extension point) for navigator labels.
+ *
+ * This label provider provides a label for the root "JPA Content" node provided
+ * by the content provider (see {@link JpaNavigatorContentProvider}) and delegates
+ * to the label provider returned by the platform UI implementation for labels
+ * for children of the "JPA Content" node (or for any other sub-node).
+ */
+public class JpaNavigatorLabelProvider extends LabelProvider
+ implements ICommonLabelProvider
+{
+ /**
+ * Exactly *one* of these is created for each view that utilizes it. Therefore,
+ * as we delegate to the platform UI for each project, we should maintain the
+ * same multiplicity. That is, if there is a delegate for each platform UI, we
+ * should maintain *one* delegate for each view.
+ *
+ * Key: platform id, Value: delegate label provider
+ */
+ private Map<String, ICommonLabelProvider> delegateLabelProviders;
+
+ private ILabelProviderListener delegateLabelProviderListener;
+
+
+ public JpaNavigatorLabelProvider() {
+ super();
+ delegateLabelProviders = new HashMap<String, ICommonLabelProvider>();
+ delegateLabelProviderListener = new DelegateLabelProviderListener();
+ }
+
+
+ // **************** IBaseLabelProvider implementation **********************
+
+ public void addListener(ILabelProviderListener listener) {
+ super.addListener(listener);
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ super.removeListener(listener);
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ ICommonLabelProvider delegate = getDelegate(element);
+
+ if (delegate != null) {
+ return delegate.isLabelProperty(element, property);
+ }
+
+ return super.isLabelProperty(element, property);
+ }
+
+ public void dispose() {
+ super.dispose();
+ for (ICommonLabelProvider delegate : delegateLabelProviders.values()) {
+ delegate.dispose();
+ }
+ delegateLabelProviders.clear();
+ }
+
+
+ // **************** ILabelProvider implementation **************************
+
+ public Image getImage(Object element) {
+ ICommonLabelProvider delegate = getDelegate(element);
+
+ if (delegate != null) {
+ return delegate.getImage(element);
+ }
+
+ return super.getImage(element);
+ }
+
+ public String getText(Object element) {
+ ICommonLabelProvider delegate = getDelegate(element);
+
+ if (delegate != null) {
+ return delegate.getText(element);
+ }
+
+ return super.getText(element);
+ }
+
+
+ // **************** IDescriptionProvider implementation ********************
+
+ public String getDescription(Object element) {
+ ICommonLabelProvider delegate = getDelegate(element);
+
+ if (delegate != null) {
+ return delegate.getDescription(element);
+ }
+
+ // no "super" implementation - default to getText(..) for description
+ return super.getText(element);
+ }
+
+
+ // **************** IMementoAware implementation ***************************
+
+ public void saveState(IMemento memento) {
+ for (ICommonLabelProvider delegate : delegateLabelProviders.values()) {
+ delegate.saveState(memento);
+ }
+ }
+
+ public void restoreState(IMemento memento) {
+ for (ICommonLabelProvider delegate : delegateLabelProviders.values()) {
+ delegate.restoreState(memento);
+ }
+ }
+
+
+ // **************** ICommonLabelProvider implementation ********************
+
+ public void init(ICommonContentExtensionSite config) {
+ for (ICommonLabelProvider delegate : delegateLabelProviders.values()) {
+ delegate.init(config);
+ }
+ }
+
+
+ // *************** internal ************************************************
+
+ private ICommonLabelProvider getDelegate(Object element) {
+ if (! (element instanceof IAdaptable)) {
+ return null;
+ }
+
+ IJpaContextNode contextNode = (IJpaContextNode) ((IAdaptable) element).getAdapter(IJpaContextNode.class);
+
+ if (contextNode == null) {
+ return null;
+ }
+
+ IJpaPlatform platform = contextNode.jpaProject().jpaPlatform();
+ IJpaPlatformUi platformUi = JptUiPlugin.getPlugin().jpaPlatformUi(platform);
+
+ ICommonLabelProvider delegate = delegateLabelProviders.get(platform.getId());
+
+ if (delegate == null && platform != null && ! delegateLabelProviders.containsKey(platform.getId())) {
+ delegate = platformUi.buildNavigatorLabelProvider();
+ delegate.addListener(delegateLabelProviderListener);
+ delegateLabelProviders.put(platform.getId(), delegate);
+ }
+
+ return delegate;
+ }
+
+
+ private class DelegateLabelProviderListener
+ implements ILabelProviderListener
+ {
+ public void labelProviderChanged(LabelProviderChangedEvent event) {
+ fireLabelProviderChanged(event);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/PlatformRegistry.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/JpaPlatformUiRegistry.java
index ede93c3a73..b70eb5d893 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/PlatformRegistry.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/JpaPlatformUiRegistry.java
@@ -6,7 +6,7 @@
*
* Contributors: Oracle. - initial API and implementation
*******************************************************************************/
-package org.eclipse.jpt.ui.internal;
+package org.eclipse.jpt.ui.internal.platform;
import java.util.HashMap;
import java.util.Iterator;
@@ -17,19 +17,21 @@ import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jpt.ui.internal.IJpaPlatformUi;
+import org.eclipse.jpt.ui.internal.JptUiPlugin;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-public class PlatformRegistry
+public class JpaPlatformUiRegistry
{
// singleton
- private static final PlatformRegistry INSTANCE = new PlatformRegistry();
+ private static final JpaPlatformUiRegistry INSTANCE = new JpaPlatformUiRegistry();
/**
* Return the singleton.
*/
- public static PlatformRegistry instance() {
+ public static JpaPlatformUiRegistry instance() {
return INSTANCE;
}
@@ -52,7 +54,7 @@ public class PlatformRegistry
/* (non Java doc)
* restrict access
*/
- private PlatformRegistry() {
+ private JpaPlatformUiRegistry() {
buildJpaPlatforms();
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/BaseJpaNavigatorContentProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/BaseJpaNavigatorContentProvider.java
new file mode 100644
index 0000000000..967c29ef8a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/BaseJpaNavigatorContentProvider.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.platform.base;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jpt.core.internal.context.base.IBaseJpaContent;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+
+public class BaseJpaNavigatorContentProvider implements ICommonContentProvider
+{
+ public void init(ICommonContentExtensionSite config) {
+ // TODO Auto-generated method stub
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IBaseJpaContent) {
+ IBaseJpaContent baseJpaContent = (IBaseJpaContent) parentElement;
+ if (baseJpaContent.getPersistenceXml() != null) {
+ return new Object[] {baseJpaContent.getPersistenceXml()};
+ }
+ }
+
+ return new Object[0];
+ }
+
+ public Object getParent(Object element) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return element instanceof IBaseJpaContent;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // TODO Auto-generated method stub
+ }
+
+ public void restoreState(IMemento memento) {
+ // TODO Auto-generated method stub
+ }
+
+ public void saveState(IMemento memento) {
+ // TODO Auto-generated method stub
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/BaseJpaNavigatorLabelProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/BaseJpaNavigatorLabelProvider.java
new file mode 100644
index 0000000000..85c7aa3716
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/BaseJpaNavigatorLabelProvider.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.platform.base;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jpt.core.internal.IContextModel;
+import org.eclipse.jpt.core.internal.context.base.PersistenceXml;
+import org.eclipse.jpt.ui.internal.JptUiIcons;
+import org.eclipse.jpt.ui.internal.JptUiPlugin;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonLabelProvider;
+
+public class BaseJpaNavigatorLabelProvider extends LabelProvider
+ implements ICommonLabelProvider
+{
+
+ // **************** IBaseLabelProvider implementation **********************
+
+ public void addListener(ILabelProviderListener listener) {
+ super.addListener(listener);
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ super.addListener(listener);
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return super.isLabelProperty(element, property);
+ }
+
+ public void dispose() {
+ super.dispose();
+ }
+
+
+ // **************** ILabelProvider implementation **************************
+
+ public Image getImage(Object element) {
+ if (element instanceof IContextModel) {
+ return JptUiPlugin.getPlugin().getImage(JptUiIcons.JPA_CONTENT);
+ }
+
+ if (element instanceof PersistenceXml) {
+ return JptUiPlugin.getPlugin().getImage(JptUiIcons.JPA_FILE);
+ }
+
+ return super.getImage(element);
+ }
+
+ public String getText(Object element) {
+ if (element instanceof IContextModel) {
+ return "JPA Content";
+ }
+
+ if (element instanceof PersistenceXml) {
+ return "persistence.xml";
+ }
+
+ return null;
+ }
+
+
+ // **************** IDescriptionProvider implementation ********************
+
+ public String getDescription(Object anElement) {
+ // TODO Auto-generated method stub
+ return getText(anElement);
+ }
+
+
+ // **************** IMementoAware implementation ***************************
+
+ public void saveState(IMemento memento) {
+ // TODO Auto-generated method stub
+ }
+
+ public void restoreState(IMemento memento) {
+ // TODO Auto-generated method stub
+ }
+
+
+ // **************** ICommonLabelProvider implementation ********************
+
+ public void init(ICommonContentExtensionSite config) {
+ // TODO Auto-generated method stub
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaPlatformUi.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/BaseJpaPlatformUi.java
index 9298773ef0..0c37db0aa6 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/BaseJpaPlatformUi.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/BaseJpaPlatformUi.java
@@ -3,11 +3,11 @@
* 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.ui.internal;
+package org.eclipse.jpt.ui.internal.platform.base;
import java.util.ArrayList;
import java.util.Collection;
@@ -16,8 +16,13 @@ import java.util.List;
import java.util.ListIterator;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jpt.core.internal.IJpaProject;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaJpaContextNode;
+import org.eclipse.jpt.ui.internal.IJpaPlatformUi;
+import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.details.IJpaDetailsProvider;
-import org.eclipse.jpt.ui.internal.generic.EntitiesGenerator;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
import org.eclipse.jpt.ui.internal.java.details.JavaDetailsProvider;
@@ -37,31 +42,45 @@ import org.eclipse.jpt.ui.internal.java.mappings.properties.OneToManyMappingUiPr
import org.eclipse.jpt.ui.internal.java.mappings.properties.OneToOneMappingUiProvider;
import org.eclipse.jpt.ui.internal.java.mappings.properties.TransientMappingUiProvider;
import org.eclipse.jpt.ui.internal.java.mappings.properties.VersionMappingUiProvider;
-import org.eclipse.jpt.ui.internal.java.structure.JavaStructureProvider;
import org.eclipse.jpt.ui.internal.structure.IJpaStructureProvider;
import org.eclipse.jpt.ui.internal.xml.details.XmlDetailsProvider;
-import org.eclipse.jpt.ui.internal.xml.structure.XmlStructureProvider;
import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+import org.eclipse.ui.navigator.ICommonLabelProvider;
public abstract class BaseJpaPlatformUi implements IJpaPlatformUi
{
- private Collection<IJpaDetailsProvider> detailsProviders;
+ // TODO: Transformed into a List for testing
+ private List<IJpaDetailsProvider> detailsProviders;
private Collection<IJpaStructureProvider> structureProviders;
-
- private List<ITypeMappingUiProvider> javaTypeMappingUiProviders;
- private List<IAttributeMappingUiProvider> javaAttributeMappingUiProviders;
- private List<IAttributeMappingUiProvider> defaultJavaAttributeMappingUiProviders;
-
+
+ private List<ITypeMappingUiProvider<? extends ITypeMapping>> javaTypeMappingUiProviders;
+ private List<IAttributeMappingUiProvider<? extends IAttributeMapping>> javaAttributeMappingUiProviders;
+ private List<IAttributeMappingUiProvider<? extends IAttributeMapping>> defaultJavaAttributeMappingUiProviders;
+
private IJpaUiFactory jpaUiFactory;
-
+
+
protected BaseJpaPlatformUi() {
super();
this.jpaUiFactory = createJpaUiFactory();
}
+
+ // **************** navigator content **************************************
+
+ public ICommonContentProvider buildNavigatorContentProvider() {
+ return new BaseJpaNavigatorContentProvider();
+ }
+
+ public ICommonLabelProvider buildNavigatorLabelProvider() {
+ return new BaseJpaNavigatorLabelProvider();
+ }
+
+
// ********** behavior **********
-
+
protected abstract IJpaUiFactory createJpaUiFactory();
public IJpaUiFactory getJpaUiFactory() {
@@ -75,7 +94,7 @@ public abstract class BaseJpaPlatformUi implements IJpaPlatformUi
}
return new CloneIterator<IJpaDetailsProvider>(this.detailsProviders);
}
-
+
/**
* Override this to specify more or different details providers.
* The default includes the JPA spec-defined java and orm.xml
@@ -84,110 +103,96 @@ public abstract class BaseJpaPlatformUi implements IJpaPlatformUi
providers.add(new JavaDetailsProvider());
providers.add(new XmlDetailsProvider());
}
-
- public IJpaDetailsProvider detailsProvider(String fileContentType) {
- for (Iterator<IJpaDetailsProvider> i = this.detailsProviders(); i.hasNext(); ) {
- IJpaDetailsProvider provider = i.next();
- if (provider.fileContentType().equals(fileContentType)) {
- return provider;
- }
+
+ public IJpaDetailsProvider detailsProvider(IJpaContextNode contextNode) {
+ // TODO: To implement, this is written only for testing
+ detailsProviders();
+ if (contextNode instanceof IJavaJpaContextNode) {
+ return detailsProviders.get(0);
}
- return null;
- }
-
- public Iterator<IJpaStructureProvider> structureProviders() {
- if (this.structureProviders == null) {
- this.structureProviders = new ArrayList<IJpaStructureProvider>();
- this.addStructureProvidersTo(this.structureProviders);
+ else {
+ return detailsProviders.get(1);
}
- return new CloneIterator<IJpaStructureProvider>(this.structureProviders);
- }
-
- /**
- * Override this to specify more or different structure providers.
- * The default includes the JPA spec-defined java and orm.xml
- */
- protected void addStructureProvidersTo(Collection<IJpaStructureProvider> providers) {
- providers.add(new JavaStructureProvider());
- providers.add(new XmlStructureProvider());
+// for (Iterator<IJpaDetailsProvider> i = this.detailsProviders(); i.hasNext(); ) {
+// IJpaDetailsProvider provider = i.next();
+// if (provider.fileContentType().equals(fileContentType)) {
+// return provider;
+// }
+// }
+// return null;
}
- public IJpaStructureProvider structureProvider(String fileContentType) {
- for (Iterator<IJpaStructureProvider> i = this.structureProviders(); i.hasNext(); ) {
- IJpaStructureProvider provider = i.next();
- if (provider.fileContentType().equals(fileContentType)) {
- return provider;
- }
- }
- return null;
- }
-
- public ListIterator<ITypeMappingUiProvider> javaTypeMappingUiProviders() {
+ public ListIterator<ITypeMappingUiProvider<? extends ITypeMapping>> javaTypeMappingUiProviders() {
if (this.javaTypeMappingUiProviders == null) {
- this.javaTypeMappingUiProviders = new ArrayList<ITypeMappingUiProvider>();
+ this.javaTypeMappingUiProviders = new ArrayList<ITypeMappingUiProvider<? extends ITypeMapping>>();
this.addJavaTypeMappingUiProvidersTo(this.javaTypeMappingUiProviders);
}
- return new CloneListIterator<ITypeMappingUiProvider>(this.javaTypeMappingUiProviders);
+ return new CloneListIterator<ITypeMappingUiProvider<? extends ITypeMapping>>(
+ this.javaTypeMappingUiProviders
+ );
}
-
+
/**
* Override this to specify more or different type mapping ui providers
* The default includes the JPA spec-defined entity, mapped superclass, embeddable,
* and null (when the others don't apply)
*/
- protected void addJavaTypeMappingUiProvidersTo(List<ITypeMappingUiProvider> providers) {
+ protected void addJavaTypeMappingUiProvidersTo(List<ITypeMappingUiProvider<? extends ITypeMapping>> providers) {
providers.add(NullTypeMappingUiProvider.instance());
providers.add(EntityUiProvider.instance());
- providers.add(MappedSuperclassUiProvider.instance());
- providers.add(EmbeddableUiProvider.instance());
+ providers.add(MappedSuperclassUiProvider.instance());
+ providers.add(EmbeddableUiProvider.instance());
}
-
- public ListIterator<IAttributeMappingUiProvider> javaAttributeMappingUiProviders() {
+
+ public ListIterator<IAttributeMappingUiProvider<? extends IAttributeMapping>> javaAttributeMappingUiProviders() {
if (this.javaAttributeMappingUiProviders == null) {
- this.javaAttributeMappingUiProviders = new ArrayList<IAttributeMappingUiProvider>();
+ this.javaAttributeMappingUiProviders = new ArrayList<IAttributeMappingUiProvider<? extends IAttributeMapping>>();
this.addJavaAttributeMappingUiProvidersTo(this.javaAttributeMappingUiProviders);
}
- return new CloneListIterator<IAttributeMappingUiProvider>(this.javaAttributeMappingUiProviders);
+ return new CloneListIterator<IAttributeMappingUiProvider<? extends IAttributeMapping>>(
+ this.javaAttributeMappingUiProviders
+ );
}
-
+
/**
* Override this to specify more or different java attribute mapping ui providers.
- * The default includes the JPA spec-defined basic, embedded, embeddedId, id,
+ * The default includes the JPA spec-defined basic, embedded, embeddedId, id,
* manyToMany, manyToOne, oneToMany, oneToOne, transient, and version
*/
- protected void addJavaAttributeMappingUiProvidersTo(List<IAttributeMappingUiProvider> providers) {
+ protected void addJavaAttributeMappingUiProvidersTo(List<IAttributeMappingUiProvider<? extends IAttributeMapping>> providers) {
providers.add(BasicMappingUiProvider.instance());
providers.add(EmbeddedMappingUiProvider.instance());
providers.add(EmbeddedIdMappingUiProvider.instance());
- providers.add(IdMappingUiProvider.instance());
- providers.add(ManyToManyMappingUiProvider.instance());
- providers.add(ManyToOneMappingUiProvider.instance());
- providers.add(OneToManyMappingUiProvider.instance());
+ providers.add(IdMappingUiProvider.instance());
+ providers.add(ManyToManyMappingUiProvider.instance());
+ providers.add(ManyToOneMappingUiProvider.instance());
+ providers.add(OneToManyMappingUiProvider.instance());
providers.add(OneToOneMappingUiProvider.instance());
providers.add(TransientMappingUiProvider.instance());
providers.add(VersionMappingUiProvider.instance());
}
-
- public ListIterator<IAttributeMappingUiProvider> defaultJavaAttributeMappingUiProviders() {
+
+ public ListIterator<IAttributeMappingUiProvider<? extends IAttributeMapping>> defaultJavaAttributeMappingUiProviders() {
if (this.defaultJavaAttributeMappingUiProviders == null) {
- this.defaultJavaAttributeMappingUiProviders = new ArrayList<IAttributeMappingUiProvider>();
+ this.defaultJavaAttributeMappingUiProviders = new ArrayList<IAttributeMappingUiProvider<? extends IAttributeMapping>>();
this.addDefaultJavaAttributeMappingUiProvidersTo(this.defaultJavaAttributeMappingUiProviders);
}
- return new CloneListIterator<IAttributeMappingUiProvider>(this.defaultJavaAttributeMappingUiProviders);
+ return new CloneListIterator<IAttributeMappingUiProvider<? extends IAttributeMapping>>(
+ this.defaultJavaAttributeMappingUiProviders
+ );
}
-
+
/**
* Override this to specify more or different default java attribute mapping ui providers.
* The default includes the JPA spec-defined basic, embedded
*/
- protected void addDefaultJavaAttributeMappingUiProvidersTo(List<IAttributeMappingUiProvider> providers) {
+ protected void addDefaultJavaAttributeMappingUiProvidersTo(List<IAttributeMappingUiProvider<? extends IAttributeMapping>> providers) {
providers.add(DefaultBasicMappingUiProvider.instance());
providers.add(DefaultEmbeddedMappingUiProvider.instance());
}
-
public void generateEntities(IJpaProject project, IStructuredSelection selection) {
EntitiesGenerator.generate(project, selection);
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/generic/EntitiesGenerator.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/EntitiesGenerator.java
index 8613951a8b..69653c833f 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/generic/EntitiesGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/base/EntitiesGenerator.java
@@ -7,9 +7,10 @@
* Contributors:
* Oracle - initial API and implementation
*******************************************************************************/
-package org.eclipse.jpt.ui.internal.generic;
+package org.eclipse.jpt.ui.internal.platform.base;
import java.util.Collection;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
@@ -22,9 +23,11 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.jpt.core.internal.IJpaFile;
import org.eclipse.jpt.core.internal.IJpaProject;
+import org.eclipse.jpt.core.internal.context.base.IBaseJpaContent;
+import org.eclipse.jpt.core.internal.context.base.IPersistenceXml;
import org.eclipse.jpt.core.internal.synch.SynchronizeClassesJob;
+import org.eclipse.jpt.db.internal.Table;
import org.eclipse.jpt.gen.internal.EntityGenerator;
import org.eclipse.jpt.gen.internal.PackageGenerator;
import org.eclipse.jpt.ui.internal.JptUiMessages;
@@ -80,7 +83,7 @@ public class EntitiesGenerator
wizard.getEntityGeneratorConfig(),
wizard.getSelectedTables(),
wizard.synchronizePersistenceXml(),
- project,
+ this.project,
new OverwriteConfirmer(this.getCurrentShell())
);
@@ -97,7 +100,7 @@ public class EntitiesGenerator
static class GenerateEntitiesRunnable extends WorkspaceJob {
private final PackageGenerator.Config packageConfig;
private final EntityGenerator.Config entityConfig;
- private final Collection selectedTables;
+ private final Collection<Table> selectedTables;
private final boolean synchronizePersistenceXml;
private final EntityGenerator.OverwriteConfirmer overwriteConfirmer;
private final IJpaProject project;
@@ -105,7 +108,7 @@ public class EntitiesGenerator
GenerateEntitiesRunnable(
PackageGenerator.Config packageConfig,
EntityGenerator.Config entityConfig,
- Collection selectedTables,
+ Collection<Table> selectedTables,
boolean synchronizePersistenceXml,
IJpaProject project,
EntityGenerator.OverwriteConfirmer overwriteConfirmer
@@ -125,11 +128,14 @@ public class EntitiesGenerator
PackageGenerator.generateEntities(this.packageConfig, this.entityConfig, this.selectedTables, this.overwriteConfirmer, monitor);
//force resourceChangeEvents to be posted before synchronizing persistence.xml
ResourcesPlugin.getWorkspace().checkpoint(false);
- if (synchronizePersistenceXml) {
+ if (this.synchronizePersistenceXml) {
// we currently only support *one* persistence.xml file per project
- IJpaFile resource = project.jpaPlatform().validPersistenceXmlFiles().next();
- if (resource != null) {
- SynchronizeClassesJob job = new SynchronizeClassesJob(resource.getFile());
+ //TODO casting to IBaseJpaContent, IContextModel doesn't seem useful to me
+ //just trying to get rid of all compiler errors for now KFB
+ IPersistenceXml persistenceXml = ((IBaseJpaContent) this.project.contextModel()).getPersistenceXml();
+ if (persistenceXml != null) {
+ //TODO casting to IFile - just trying to get rid of all compiler errors for now
+ SynchronizeClassesJob job = new SynchronizeClassesJob((IFile) persistenceXml.resource());
job.schedule();
}
}
@@ -165,7 +171,7 @@ public class EntitiesGenerator
final OverwriteConfirmerDialog dialog = new OverwriteConfirmerDialog(this.shell, className);
//get on the UI thread synchronously, need feedback before continuing
- shell.getDisplay().syncExec(new Runnable() {
+ this.shell.getDisplay().syncExec(new Runnable() {
public void run() {
dialog.open();
}
@@ -203,11 +209,13 @@ public class EntitiesGenerator
this.className = className;
}
+ @Override
protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setText(JptUiMessages.OverwriteConfirmerDialog_title);
}
+ @Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
GridLayout gridLayout = (GridLayout) composite.getLayout();
@@ -220,6 +228,7 @@ public class EntitiesGenerator
return composite;
}
+ @Override
protected void createButtonsForButtonBar(Composite parent) {
this.createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, false);
this.createButton(parent, IDialogConstants.YES_TO_ALL_ID, IDialogConstants.YES_TO_ALL_LABEL, false);
@@ -228,6 +237,7 @@ public class EntitiesGenerator
this.createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}
+ @Override
protected void buttonPressed(int buttonId) {
switch (buttonId) {
case IDialogConstants.YES_ID :
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/generic/GenericPlatformUi.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/generic/GenericPlatformUi.java
index 1490e5fc21..22c391c871 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/generic/GenericPlatformUi.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/platform/generic/GenericPlatformUi.java
@@ -3,20 +3,20 @@
* 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.ui.internal.generic;
+package org.eclipse.jpt.ui.internal.platform.generic;
import java.text.MessageFormat;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jpt.core.internal.IJpaProject;
-import org.eclipse.jpt.ui.internal.BaseJpaPlatformUi;
import org.eclipse.jpt.ui.internal.GenericJpaUiFactory;
import org.eclipse.jpt.ui.internal.IJpaUiFactory;
import org.eclipse.jpt.ui.internal.JptUiMessages;
+import org.eclipse.jpt.ui.internal.platform.base.BaseJpaPlatformUi;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
@@ -25,20 +25,19 @@ public class GenericPlatformUi extends BaseJpaPlatformUi
public GenericPlatformUi() {
super();
}
-
+
@Override
protected IJpaUiFactory createJpaUiFactory() {
return new GenericJpaUiFactory();
}
-
+
public void generateDDL(IJpaProject project, IStructuredSelection selection) {
this.displayNotSupportedMessage(JptUiMessages.GenericPlatformUiDialog_notSupportedMessageTitle, JptUiMessages.GenericPlatformUiDialog_notSupportedMessageText);
}
protected void displayNotSupportedMessage(String title, String message) {
- String formattedMessage = MessageFormat.format( message, (Object [])(new String [] { message}));
+ String formattedMessage = MessageFormat.format(message, message);
Shell currentShell = Display.getCurrent().getActiveShell();
- MessageDialog.openInformation(currentShell, title, formattedMessage);
+ MessageDialog.openInformation(currentShell, title, formattedMessage);
}
-
-}
+} \ No newline at end of file
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 e59e78b77d..d82512e6b8 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -11,7 +11,6 @@ package org.eclipse.jpt.ui.internal.properties;
import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
@@ -28,10 +27,10 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jpt.core.internal.IJpaProject;
import org.eclipse.jpt.core.internal.JpaModelManager;
-import org.eclipse.jpt.core.internal.JpaPlatformRegistry;
import org.eclipse.jpt.core.internal.JptCorePlugin;
import org.eclipse.jpt.core.internal.facet.IJpaFacetDataModelProperties;
import org.eclipse.jpt.core.internal.facet.JpaFacetDataModelProvider;
+import org.eclipse.jpt.core.internal.platform.JpaPlatformRegistry;
import org.eclipse.jpt.db.internal.ConnectionProfileRepository;
import org.eclipse.jpt.db.ui.internal.DTPUiTools;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
@@ -168,7 +167,7 @@ public class JpaProjectPropertiesPage
}
String connection = this.model.getStringProperty(IJpaFacetDataModelProperties.CONNECTION);
- if ( ! connection.equals(jpaProject.dataSource().getConnectionProfileName())) {
+ if ( ! connection.equals(jpaProject.dataSource().connectionProfileName())) {
change = true;
jpaProject.dataSource().setConnectionProfileName(connection);
JptCorePlugin.setConnectionProfileName(project, connection);
@@ -339,7 +338,7 @@ public class JpaProjectPropertiesPage
}
void performDefaults() {
- String connectionName = getJpaProject().dataSource().getConnectionProfileName();
+ String connectionName = getJpaProject().dataSource().connectionProfileName();
model.setProperty(CONNECTION, connectionName);
if (connectionName == null) {
connectionCombo.clearSelection();
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/IJpaSelection.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/IJpaSelection.java
new file mode 100644
index 0000000000..3c0770a964
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/IJpaSelection.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.selection;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+
+@SuppressWarnings("nls")
+public interface IJpaSelection extends ISelection
+{
+ static IJpaSelection NULL_SELECTION =
+ new IJpaSelection() {
+ public IJpaContextNode getSelectedNode() {
+ return null;
+ }
+
+ public boolean isEmpty() {
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "NULL SELECTION";
+ }
+ };
+
+
+ IJpaContextNode getSelectedNode();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/ISelectionManager.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/IJpaSelectionManager.java
index 42e7dc2aef..294040971f 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/ISelectionManager.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/IJpaSelectionManager.java
@@ -11,27 +11,27 @@ package org.eclipse.jpt.ui.internal.selection;
import org.eclipse.ui.IWorkbenchPart;
-public interface ISelectionManager
+public interface IJpaSelectionManager
{
/**
* Return the current selection.
- * This will never be null, but it may be <code>Selection.NULL_SELECTION</code>.
+ * This will never be null, but it may be <code>JpaSelection.NULL_SELECTION</code>.
*/
- public Selection getCurrentSelection();
+ public IJpaSelection getCurrentSelection();
/**
* Not to be called lightly, this will affect the selection for all interested
* objects in a window.
* The newSelection will be selected.
*/
- public void select(Selection newSelection);
+ public void select(IJpaSelection newSelection);
/**
* Not to be called lightly, this will affect the selection for all interested
* objects in a window.
* The oldSelection will be deselected, iff it matches the current selection.
*/
- public void deselect(Selection oldSelection);
+ public void deselect(IJpaSelection oldSelection);
/**
* This may be used to register a part with the selection manager if the part
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/ISelectionParticipant.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/IJpaSelectionParticipant.java
index 56fdb85040..249207026c 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/ISelectionParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/IJpaSelectionParticipant.java
@@ -9,18 +9,18 @@
******************************************************************************/
package org.eclipse.jpt.ui.internal.selection;
-public interface ISelectionParticipant
+public interface IJpaSelectionParticipant
{
/**
* Return the current selection of the participant
*/
- Selection getSelection();
+ IJpaSelection getSelection();
/**
* The selection has changed in the central selection manager.
* Update this participant accordingly.
*/
- void selectionChanged(SelectionEvent evt);
+ void selectionChanged(JpaSelectionEvent evt);
/**
* Return whether this selection participant should disconnect itself from
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaDetailsSelectionParticipant.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaDetailsSelectionParticipant.java
index da44c1d141..53f8b955f3 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaDetailsSelectionParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaDetailsSelectionParticipant.java
@@ -13,7 +13,7 @@ import org.eclipse.jpt.ui.internal.views.JpaDetailsView;
public class JpaDetailsSelectionParticipant
- implements ISelectionParticipant
+ implements IJpaSelectionParticipant
{
private final JpaDetailsView detailsView;
@@ -23,11 +23,11 @@ public class JpaDetailsSelectionParticipant
this.detailsView = detailsView;
}
- public Selection getSelection() {
+ public IJpaSelection getSelection() {
return this.detailsView.getSelection();
}
- public void selectionChanged(SelectionEvent evt) {
+ public void selectionChanged(JpaSelectionEvent evt) {
this.detailsView.select(evt.getSelection());
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/Selection.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaSelection.java
index e05032bdf0..a4e12ea25c 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/Selection.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaSelection.java
@@ -3,69 +3,54 @@
* 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.ui.internal.selection;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
-
-public class Selection
+@SuppressWarnings("nls")
+public class JpaSelection
+ implements IJpaSelection
{
- public static Selection NULL_SELECTION = new Selection();
-
- private IJpaContentNode selectedNode;
-
-
- /* Used internally - only for NULL_SELECTION */
- private Selection() {
- super();
- }
-
- public Selection(IJpaContentNode selectedNode) {
+ private IJpaContextNode selectedNode;
+
+
+ public JpaSelection(IJpaContextNode selectedNode) {
if (selectedNode == null) {
throw new NullPointerException("A 'selectedNode' is required; otherwise use NULL_SELECTION.");
}
this.selectedNode = selectedNode;
}
-
- public IJpaContentNode getSelectedNode() {
+
+ public IJpaContextNode getSelectedNode() {
return selectedNode;
}
-
+
+ public boolean isEmpty() {
+ // by definition, this selection is never empty
+ // use IJpaSelection.NULL_SELECTION for empty selections
+ return false;
+ }
+
@Override
public boolean equals(Object obj) {
- if (! (obj instanceof Selection)) {
- return false;
- }
-
- if ((this == NULL_SELECTION) && (obj == NULL_SELECTION)) {
- return true;
- }
-
- if ((this == NULL_SELECTION) || (obj == NULL_SELECTION)) {
+ if (! (obj instanceof JpaSelection)) {
return false;
}
-
- return this.selectedNode.equals(((Selection) obj).selectedNode);
+
+ return this.selectedNode.equals(((JpaSelection) obj).selectedNode);
}
-
+
@Override
public int hashCode() {
- return (this == NULL_SELECTION) ?
- super.hashCode()
- :
- this.selectedNode.hashCode();
+ return this.selectedNode.hashCode();
}
@Override
public String toString() {
- return (this == NULL_SELECTION) ?
- "NULL_SELECTION"
- :
- selectedNode.toString();
+ return selectedNode.toString();
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionEvent.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaSelectionEvent.java
index 1020ef3ec1..44fbabad84 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionEvent.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaSelectionEvent.java
@@ -11,7 +11,7 @@ package org.eclipse.jpt.ui.internal.selection;
import java.util.EventObject;
-public class SelectionEvent extends EventObject
+public class JpaSelectionEvent extends EventObject
{
/**
* Serializable uid
@@ -34,7 +34,7 @@ public class SelectionEvent extends EventObject
/**
* The selection object whose selection status has changed
*/
- private Selection selection;
+ private IJpaSelection selection;
/**
* The type of the selection event, either a SELECTION or a DESELECTION
@@ -42,7 +42,7 @@ public class SelectionEvent extends EventObject
private int type;
- public SelectionEvent(Selection theSelection, int theType, Object source) {
+ public JpaSelectionEvent(IJpaSelection theSelection, int theType, Object source) {
super(source);
selection = theSelection;
type = theType;
@@ -51,7 +51,7 @@ public class SelectionEvent extends EventObject
/**
* Return the selection object whose selection status has changed
*/
- public Selection getSelection() {
+ public IJpaSelection getSelection() {
return selection;
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionManager.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaSelectionManager.java
index 108a700989..db47b79801 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionManager.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaSelectionManager.java
@@ -15,7 +15,6 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-
import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IPageListener;
@@ -26,66 +25,82 @@ import org.eclipse.ui.IWorkbenchPartReference;
import org.eclipse.ui.IWorkbenchWindow;
/**
- * A <code>SelectionManager</code> stores the current <code>Selection</code> and
+ * A <code>JpaSelectionManager</code> stores the current <code>JpaSelection</code> and
* notifies <code>ISelectionListener</code>s when the selection changes.
*/
-public class SelectionManager
- implements ISelectionManager
+public class JpaSelectionManager
+ implements IJpaSelectionManager
{
+ /* The window for which this object manages selections */
+ private IWorkbenchWindow window;
+
/* The set of pages for which this object is managing selections */
private Set<IWorkbenchPage> pages;
- /* The map of <code>ISelectionParticipant</code>s (keyed by part) this object
- is using to manage selections */
- private Map<IWorkbenchPart, ISelectionParticipant> selectionParticipants;
+ /* The active editor part */
+ private IEditorPart activeEditor;
- private IPageListener pageListener;
+ private IJpaSelection currentSelection;
- private IPartListener2 partListener;
+ /* The map of <code>IJpaSelectionParticipant</code>s (keyed by part) */
+ private Map<IWorkbenchPart, IJpaSelectionParticipant> selectionParticipants;
- /* The window for which this object manages selections */
- private IWorkbenchWindow window;
+ private IPageListener pageListener;
- private Selection currentSelection;
+ private IPartListener2 partListener;
- public SelectionManager() {
+ public JpaSelectionManager() {
super();
pages = Collections.synchronizedSet(new HashSet<IWorkbenchPage>());
- selectionParticipants = Collections.synchronizedMap(new HashMap<IWorkbenchPart, ISelectionParticipant>());
+ selectionParticipants = Collections.synchronizedMap(new HashMap<IWorkbenchPart, IJpaSelectionParticipant>());
pageListener = new PageListener();
partListener = new PartListener();
- currentSelection = Selection.NULL_SELECTION;
+ currentSelection = JpaSelection.NULL_SELECTION;
}
- public void init(IWorkbenchWindow aWindow) {
+ void init(IWorkbenchWindow aWindow) {
window = aWindow;
aWindow.addPageListener(pageListener);
initPage(aWindow.getActivePage());
}
- void initPage(IWorkbenchPage page) {
+ private void initPage(IWorkbenchPage page) {
if ((page != null) && (! pages.contains(page))) {
page.addPartListener(partListener);
pages.add(page);
- IEditorPart activeEditor = page.getActiveEditor();
- initPart(activeEditor);
- selectPart(activeEditor);
+ activateEditor(page.getActiveEditor());
}
}
- void disposePage(IWorkbenchPage page) {
+ private void disposePage(IWorkbenchPage page) {
if ((page != null) && (pages.contains(page))) {
page.removePartListener(partListener);
pages.remove(page);
}
}
+ private void activateEditor(IEditorPart editor) {
+ if (editor == activeEditor) {
+ return;
+ }
+ if (activeEditor != null) {
+ inactivateEditor(activeEditor);
+ }
+ initPart(editor);
+ activeEditor = editor;
+ selectEditor(activeEditor);
+ }
+
+ private void inactivateEditor(IEditorPart editor) {
+
+ }
+
void initPart(IWorkbenchPart part) {
if (part != null) {
if (selectionParticipants.get(part) == null) {
- ISelectionParticipant selectionParticipant =
- (ISelectionParticipant) part.getAdapter(ISelectionParticipant.class);
+ IJpaSelectionParticipant selectionParticipant =
+ (IJpaSelectionParticipant) part.getAdapter(IJpaSelectionParticipant.class);
if (selectionParticipant != null) {
selectionParticipants.put(part, selectionParticipant);
}
@@ -93,22 +108,26 @@ public class SelectionManager
}
}
+ private void selectEditor(IEditorPart editor) {
+
+ }
+
void selectPart(IWorkbenchPart part) {
- ISelectionParticipant selectionParticipant = getSelectionParticipant(part);
+ IJpaSelectionParticipant selectionParticipant = getSelectionParticipant(part);
if (selectionParticipant != null) {
select(selectionParticipant.getSelection());
}
}
void hidePart(IWorkbenchPart part) {
- ISelectionParticipant selectionParticipant = getSelectionParticipant(part);
+ IJpaSelectionParticipant selectionParticipant = getSelectionParticipant(part);
if ((selectionParticipant != null) && (selectionParticipant.disposeOnHide())) {
closePart(part);
}
}
void closePart(IWorkbenchPart part) {
- ISelectionParticipant selectionParticipant = getSelectionParticipant(part);
+ IJpaSelectionParticipant selectionParticipant = getSelectionParticipant(part);
if (selectionParticipant != null) {
disposePart(part);
checkForNoEditors();
@@ -125,7 +144,7 @@ public class SelectionManager
IWorkbenchPage activePage = window.getActivePage();
if ((activePage == null)
|| (activePage.getActiveEditor() == null)) {
- select(Selection.NULL_SELECTION);
+ select(JpaSelection.NULL_SELECTION);
}
}
@@ -147,14 +166,14 @@ public class SelectionManager
* objects in a window.
* The newSelection will be selected.
*/
- public void select(Selection newSelection) {
+ public void select(IJpaSelection newSelection) {
if (currentSelection.equals(newSelection)) {
return;
}
currentSelection = newSelection;
fireSelectionChange(
- new SelectionEvent(newSelection, SelectionEvent.SELECTION, this)
+ new JpaSelectionEvent(newSelection, JpaSelectionEvent.SELECTION, this)
);
}
@@ -163,26 +182,26 @@ public class SelectionManager
* objects in a window.
* The oldSelection will be deselected, iff it matches the current selection.
*/
- public void deselect(Selection oldSelection) {
+ public void deselect(IJpaSelection oldSelection) {
if (currentSelection.equals(oldSelection)) {
- currentSelection = Selection.NULL_SELECTION;
+ currentSelection = JpaSelection.NULL_SELECTION;
fireSelectionChange(
- new SelectionEvent(oldSelection, SelectionEvent.DESELECTION, this)
+ new JpaSelectionEvent(oldSelection, JpaSelectionEvent.DESELECTION, this)
);
}
}
- private void fireSelectionChange(SelectionEvent event) {
- for (ISelectionParticipant sp : selectionParticipants.values()) {
+ private void fireSelectionChange(JpaSelectionEvent event) {
+ for (IJpaSelectionParticipant sp : selectionParticipants.values()) {
sp.selectionChanged(event);
}
}
- private ISelectionParticipant getSelectionParticipant(IWorkbenchPart part) {
+ private IJpaSelectionParticipant getSelectionParticipant(IWorkbenchPart part) {
return selectionParticipants.get(part);
}
- public Selection getCurrentSelection() {
+ public IJpaSelection getCurrentSelection() {
return currentSelection;
}
@@ -211,11 +230,11 @@ public class SelectionManager
}
public void pageClosed(IWorkbenchPage page) {
- SelectionManager.this.disposePage(page);
+ JpaSelectionManager.this.disposePage(page);
}
public void pageOpened(IWorkbenchPage page) {
- SelectionManager.this.initPage(page);
+ JpaSelectionManager.this.initPage(page);
}
}
@@ -229,8 +248,8 @@ public class SelectionManager
public void partActivated(IWorkbenchPartReference partRef) {
IWorkbenchPart part = partRef.getPart(false);
if (part != null) {
- SelectionManager.this.initPart(part);
- SelectionManager.this.selectPart(part);
+ JpaSelectionManager.this.initPart(part);
+ JpaSelectionManager.this.selectPart(part);
}
}
@@ -241,9 +260,9 @@ public class SelectionManager
public void partClosed(IWorkbenchPartReference partRef) {
IWorkbenchPart part = partRef.getPart(false);
if (part != null) {
- SelectionManager.this.closePart(part);
- SelectionManager.this.disposePart(part);
- SelectionManager.this.checkForNoEditors();
+ JpaSelectionManager.this.closePart(part);
+ JpaSelectionManager.this.disposePart(part);
+ JpaSelectionManager.this.checkForNoEditors();
}
}
@@ -254,7 +273,7 @@ public class SelectionManager
public void partHidden(IWorkbenchPartReference partRef) {
IWorkbenchPart part = partRef.getPart(false);
if (part != null) {
- SelectionManager.this.hidePart(part);
+ JpaSelectionManager.this.hidePart(part);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaStructureSelectionParticipant.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaStructureSelectionParticipant.java
index 749efdcf55..067e6d1713 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaStructureSelectionParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/JpaStructureSelectionParticipant.java
@@ -11,25 +11,25 @@ package org.eclipse.jpt.ui.internal.selection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jpt.ui.internal.views.JpaStructureView;
+import org.eclipse.jpt.ui.internal.views.structure.JpaStructureView;
public class JpaStructureSelectionParticipant
- implements ISelectionParticipant
+ implements IJpaSelectionParticipant
{
final JpaStructureView structureView;
- public JpaStructureSelectionParticipant(ISelectionManager selectionManager, JpaStructureView structureView) {
+ public JpaStructureSelectionParticipant(IJpaSelectionManager selectionManager, JpaStructureView structureView) {
super();
this.structureView = structureView;
structureView.addSelectionChangedListener(new StructureViewSelectionListener(selectionManager, structureView));
}
- public Selection getSelection() {
+ public IJpaSelection getSelection() {
return this.structureView.getSelection();
}
- public void selectionChanged(SelectionEvent evt) {
+ public void selectionChanged(JpaSelectionEvent evt) {
this.structureView.select(evt.getSelection());
}
@@ -47,9 +47,9 @@ public class JpaStructureSelectionParticipant
private class StructureViewSelectionListener
implements ISelectionChangedListener
{
- private final ISelectionManager selectionManager;
+ private final IJpaSelectionManager selectionManager;
- StructureViewSelectionListener(ISelectionManager selectionManager, JpaStructureView structureView) {
+ StructureViewSelectionListener(IJpaSelectionManager selectionManager, JpaStructureView structureView) {
super();
this.selectionManager = selectionManager;
}
@@ -58,10 +58,8 @@ public class JpaStructureSelectionParticipant
this.selectionManager.select(this.structureViewSelection());
}
- private Selection structureViewSelection() {
+ private IJpaSelection structureViewSelection() {
return JpaStructureSelectionParticipant.this.structureView.getSelection();
}
-
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionManagerFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionManagerFactory.java
index 7e96a1807f..8f3811b097 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionManagerFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionManagerFactory.java
@@ -3,9 +3,9 @@
* 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.ui.internal.selection;
@@ -16,23 +16,23 @@ import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
-public class SelectionManagerFactory
+public class SelectionManagerFactory
{
private static SelectionManagerFactory INSTANCE;
-
+
private static Object MUTEX = new Object();
-
-
+
+
/**
- * Each <code>IWorkbenchWindow</code> has its own <code>SelectionManager</code>
- * to track the selection events in the <code>IWorkbenchWindow</code>. All
- * <code>ISelectionListener</code>s in the same <code>IWorkbenchWindow</code>
- * share the same <code>SelectionManager</code>.
- *
- * @return The <code>SelectionManager</code> associated with the current
+ * Each <code>IWorkbenchWindow</code> has its own <code>JpaSelectionManager</code>
+ * to track the selection events in the <code>IWorkbenchWindow</code>. All
+ * <code>ISelectionListener</code>s in the same <code>IWorkbenchWindow</code>
+ * share the same <code>JpaSelectionManager</code>.
+ *
+ * @return The <code>JpaSelectionManager</code> associated with the current
* <code>IWorkbenchWindow</code>
*/
- public static ISelectionManager getSelectionManager(IWorkbenchWindow window) {
+ public static IJpaSelectionManager getSelectionManager(IWorkbenchWindow window) {
if (INSTANCE == null) {
// this is thread safe for now. you never know whats comming
synchronized (MUTEX) {
@@ -46,54 +46,54 @@ public class SelectionManagerFactory
}
return INSTANCE.internalGetSelectionManager(window);
}
-
-
- private Map managers;
-
+
+
+ private Map<IWorkbenchWindow, JpaSelectionManager> managers;
+
private WindowListener windowListener;
-
-
+
+
private SelectionManagerFactory() {
- managers = new HashMap();
+ managers = new HashMap<IWorkbenchWindow, JpaSelectionManager>();
windowListener = new WindowListener();
}
-
+
private void init() {
IWorkbench workbench = PlatformUI.getWorkbench();
workbench.addWindowListener(windowListener);
}
-
+
/**
- * Returns the SelectionManager for the IWorkbenchWindow.
+ * Returns the JpaSelectionManager for the IWorkbenchWindow.
* Creates a new one if none exists yet.
*/
- private SelectionManager internalGetSelectionManager(IWorkbenchWindow window) {
+ private JpaSelectionManager internalGetSelectionManager(IWorkbenchWindow window) {
if (window == null) {
- throw new IllegalArgumentException(window.toString());
+ throw new IllegalArgumentException("The IWorkbenchWindow cannot be null");
}
-
+
if (! managers.containsKey(window)) {
- SelectionManager manager = new SelectionManager();
+ JpaSelectionManager manager = new JpaSelectionManager();
this.managers.put(window, manager);
manager.init(window);
}
-
- return (SelectionManager) managers.get(window);
+
+ return managers.get(window);
}
-
-
+
+
private class WindowListener implements IWindowListener
{
public void windowOpened(IWorkbenchWindow aWindow) {}
-
+
public void windowClosed(IWorkbenchWindow aWindow) {
- SelectionManager manager = internalGetSelectionManager(aWindow);
+ JpaSelectionManager manager = internalGetSelectionManager(aWindow);
manager.dispose();
managers.remove(aWindow);
}
-
+
public void windowActivated(IWorkbenchWindow aWindow) {}
-
+
public void windowDeactivated(IWorkbenchWindow aWindow) {}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionParticipantFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionParticipantFactory.java
index 0bd4ca3bee..906cc7e26b 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionParticipantFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/SelectionParticipantFactory.java
@@ -11,31 +11,33 @@ package org.eclipse.jpt.ui.internal.selection;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.jpt.ui.internal.views.JpaDetailsView;
-import org.eclipse.jpt.ui.internal.views.JpaStructureView;
+import org.eclipse.jpt.ui.internal.views.structure.JpaStructureView;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.texteditor.ITextEditor;
public class SelectionParticipantFactory
implements IAdapterFactory
{
- private static final Class[] ADAPTER_LIST = new Class[] { ISelectionParticipant.class };
-
+ @SuppressWarnings("unchecked")
+ private static final Class[] ADAPTER_LIST = new Class[] { IJpaSelectionParticipant.class };
+
+ @SuppressWarnings("unchecked")
public Class[] getAdapterList() {
return ADAPTER_LIST;
}
+ @SuppressWarnings("unchecked")
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (! (adaptableObject instanceof IWorkbenchPart)) {
return null;
}
- ISelectionManager selectionManager =
+ IJpaSelectionManager selectionManager =
SelectionManagerFactory.getSelectionManager(((IWorkbenchPart) adaptableObject).getSite().getWorkbenchWindow());
- // TODO turn this into extension point
if (adaptableObject instanceof ITextEditor) {
return new TextEditorSelectionParticipant(selectionManager, (ITextEditor) adaptableObject);
}
- else if (adaptableObject instanceof JpaStructureView) {
+ if (adaptableObject instanceof JpaStructureView) {
return new JpaStructureSelectionParticipant(selectionManager, (JpaStructureView) adaptableObject);
}
else if (adaptableObject instanceof JpaDetailsView) {
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/TextEditorSelectionParticipant.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/TextEditorSelectionParticipant.java
index 3750cb371c..8cef83aa58 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/TextEditorSelectionParticipant.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/selection/TextEditorSelectionParticipant.java
@@ -3,7 +3,7 @@
* 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
******************************************************************************/
@@ -14,10 +14,10 @@ import org.eclipse.jface.viewers.IPostSelectionProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
import org.eclipse.jpt.core.internal.IJpaFile;
import org.eclipse.jpt.core.internal.ITextRange;
import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
import org.eclipse.jpt.ui.internal.views.AbstractJpaView;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
@@ -25,23 +25,23 @@ import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.texteditor.ITextEditor;
-public class TextEditorSelectionParticipant
- implements ISelectionParticipant
+public class TextEditorSelectionParticipant
+ implements IJpaSelectionParticipant
{
- private final ISelectionManager selectionManager;
+ private final IJpaSelectionManager selectionManager;
final ITextEditor textEditor;
-
+
private final IPropertyListener editorInputListener;
-
+
private final ISelectionChangedListener editorSelectionListener;
-
- private Selection currentSelection;
-
+
+ private IJpaSelection currentSelection;
+
private boolean forwardSelection = true; // TODO this just smells wrong ~bjv
-
-
- public TextEditorSelectionParticipant(ISelectionManager selectionManager, ITextEditor textEditor) {
+
+
+ public TextEditorSelectionParticipant(IJpaSelectionManager selectionManager, ITextEditor textEditor) {
super();
this.selectionManager = selectionManager;
this.textEditor = textEditor;
@@ -52,20 +52,20 @@ public class TextEditorSelectionParticipant
this.currentSelection = this.calculateSelection();
}
- // ********** ISelectionParticipant implementation **********
+ // ********** IJpaSelectionParticipant implementation **********
- public Selection getSelection() {
+ public IJpaSelection getSelection() {
return this.currentSelection;
}
-
- public void selectionChanged(SelectionEvent evt) {
- Selection newSelection = evt.getSelection();
-
- if ((newSelection == Selection.NULL_SELECTION)
+
+ public void selectionChanged(JpaSelectionEvent evt) {
+ IJpaSelection newSelection = evt.getSelection();
+
+ if ((newSelection == IJpaSelection.NULL_SELECTION)
|| newSelection.equals(this.currentSelection)) {
return;
}
-
+
this.forwardSelection = false;
ITextRange textRange = newSelection.getSelectedNode().selectionTextRange();
if (textRange != null) {
@@ -73,11 +73,11 @@ public class TextEditorSelectionParticipant
}
this.forwardSelection = true;
}
-
+
public boolean disposeOnHide() {
return true;
}
-
+
public void dispose() {
this.textEditor.removePropertyListener(this.editorInputListener);
this.postSelectionProvider().removePostSelectionChangedListener(this.editorSelectionListener);
@@ -86,25 +86,25 @@ public class TextEditorSelectionParticipant
// ********** internal methods **********
- private Selection calculateSelection() {
+ private IJpaSelection calculateSelection() {
ISelection selection = this.textEditor.getSelectionProvider().getSelection();
if (! (selection instanceof ITextSelection)) {
- return Selection.NULL_SELECTION;
+ return IJpaSelection.NULL_SELECTION;
}
IJpaFile jpaFile = this.jpaFile();
if (jpaFile == null) {
- return Selection.NULL_SELECTION;
+ return IJpaSelection.NULL_SELECTION;
}
- IJpaContentNode selectedNode = jpaFile.getContentNode(((ITextSelection) selection).getOffset());
+ IJpaContextNode selectedNode = jpaFile.contextNode(((ITextSelection) selection).getOffset());
if (selectedNode == null) {
- return Selection.NULL_SELECTION;
+ return IJpaSelection.NULL_SELECTION;
}
- return new Selection(selectedNode);
+ return new JpaSelection(selectedNode);
}
-
+
private IJpaFile jpaFile() {
IEditorInput input = this.textEditor.getEditorInput();
if ( ! (input instanceof IFileEditorInput)) {
@@ -112,7 +112,7 @@ public class TextEditorSelectionParticipant
}
return JptCorePlugin.jpaFile(((IFileEditorInput) input).getFile());
}
-
+
private IPostSelectionProvider postSelectionProvider() {
return (IPostSelectionProvider) this.textEditor.getSelectionProvider();
}
@@ -121,7 +121,7 @@ public class TextEditorSelectionParticipant
// ********** listener callbacks **********
void editorInputChanged() {
- Selection newSelection = this.calculateSelection();
+ IJpaSelection newSelection = this.calculateSelection();
if (newSelection.equals(this.currentSelection)) {
return;
}
@@ -130,15 +130,15 @@ public class TextEditorSelectionParticipant
this.selectionManager.select(newSelection);
}
}
-
+
void editorSelectionChanged(SelectionChangedEvent event) {
- Selection newSelection = this.calculateSelection();
+ IJpaSelection newSelection = this.calculateSelection();
if (newSelection.equals(this.currentSelection)) {
return;
}
this.currentSelection = newSelection;
- // bug 188344 - won't actively change selection manager selection if
+ // bug 188344 - won't actively change selection manager selection if
// a "JPA" view is the active (and presumably selecting) view
if (this.textEditor.getEditorSite().getPage().getActivePart() instanceof AbstractJpaView) {
return;
@@ -148,7 +148,7 @@ public class TextEditorSelectionParticipant
this.selectionManager.select(newSelection);
}
}
-
+
// ********** listeners **********
@@ -163,8 +163,8 @@ public class TextEditorSelectionParticipant
}
}
}
-
-
+
+
private class EditorSelectionListener implements ISelectionChangedListener {
EditorSelectionListener() {
super();
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/GeneralJpaMappingItemContentProviderFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/GeneralJpaMappingItemContentProviderFactory.java
new file mode 100644
index 0000000000..fc2127443c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/GeneralJpaMappingItemContentProviderFactory.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.structure;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.IPersistentType;
+import org.eclipse.jpt.ui.internal.jface.AbstractTreeItemContentProvider;
+import org.eclipse.jpt.ui.internal.jface.DelegatingContentAndLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.DelegatingTreeContentAndLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.ITreeItemContentProvider;
+import org.eclipse.jpt.ui.internal.jface.ITreeItemContentProviderFactory;
+import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+
+public abstract class GeneralJpaMappingItemContentProviderFactory
+ implements ITreeItemContentProviderFactory
+{
+ public ITreeItemContentProvider buildItemContentProvider(
+ Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) {
+ DelegatingTreeContentAndLabelProvider treeContentProvider = (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider;
+ if (item instanceof IPersistentType) {
+ return new PersistentTypeItemContentProvider((IPersistentType) item, treeContentProvider);
+ }
+ else if (item instanceof IPersistentAttribute) {
+ return new PersistentAttributeItemContentProvider((IPersistentAttribute) item, treeContentProvider);
+ }
+ return null;
+ }
+
+
+ public static class PersistentTypeItemContentProvider extends AbstractTreeItemContentProvider<IPersistentAttribute>
+ {
+ public PersistentTypeItemContentProvider(
+ IPersistentType persistentType, DelegatingTreeContentAndLabelProvider contentProvider) {
+ super(persistentType, contentProvider);
+ }
+
+ @Override
+ public Object getParent() {
+ return ((IPersistentType) model()).parent();
+ }
+
+ @Override
+ protected ListValueModel<IPersistentAttribute> buildChildrenModel() {
+ return new ListAspectAdapter<IPersistentType, IPersistentAttribute>(new String[]{IPersistentType.SPECIFIED_ATTRIBUTES_LIST, IPersistentType.VIRTUAL_ATTRIBUTES_LIST}, (IPersistentType) model()) {
+ @Override
+ protected ListIterator<IPersistentAttribute> listIterator_() {
+ return subject.attributes();
+ }
+ };
+ }
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public static class PersistentAttributeItemContentProvider extends AbstractTreeItemContentProvider
+ {
+ public PersistentAttributeItemContentProvider(
+ IPersistentAttribute persistentAttribute, DelegatingTreeContentAndLabelProvider contentProvider) {
+ super(persistentAttribute, contentProvider);
+ }
+
+ @Override
+ public Object getParent() {
+ return ((IPersistentAttribute) model()).parent();
+ }
+
+ @Override
+ public boolean hasChildren() {
+ return false;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/GeneralJpaMappingItemLabelProviderFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/GeneralJpaMappingItemLabelProviderFactory.java
new file mode 100644
index 0000000000..a301febab4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/GeneralJpaMappingItemLabelProviderFactory.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.structure;
+
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.IPersistentType;
+import org.eclipse.jpt.ui.internal.JpaMappingImageHelper;
+import org.eclipse.jpt.ui.internal.jface.AbstractItemLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.DelegatingContentAndLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.IItemLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.IItemLabelProviderFactory;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.graphics.Image;
+
+public abstract class GeneralJpaMappingItemLabelProviderFactory
+ implements IItemLabelProviderFactory
+{
+ public IItemLabelProvider buildItemLabelProvider(
+ Object item, DelegatingContentAndLabelProvider labelProvider) {
+ if (item instanceof IPersistentType) {
+ return new PersistentTypeItemLabelProvider((IPersistentType) item, labelProvider);
+ }
+ else if (item instanceof IPersistentAttribute) {
+ return new PersistentAttributeItemLabelProvider((IPersistentAttribute) item, labelProvider);
+ }
+ return null;
+ }
+
+
+ public static class PersistentTypeItemLabelProvider extends AbstractItemLabelProvider
+ {
+ public PersistentTypeItemLabelProvider(
+ IPersistentType persistentType, DelegatingContentAndLabelProvider labelProvider) {
+ super(persistentType, labelProvider);
+ }
+
+ @Override
+ protected PropertyValueModel<String> buildTextModel() {
+ return new PropertyAspectAdapter<IPersistentType, String>(IPersistentType.NAME_PROPERTY, (IPersistentType) model()) {
+ @Override
+ protected String buildValue_() {
+ return subject.getName();
+ }
+ };
+ }
+
+ @Override
+ protected PropertyValueModel<Image> buildImageModel() {
+ return new PropertyAspectAdapter<IPersistentType, Image>(IPersistentType.MAPPING_PROPERTY, (IPersistentType) model()) {
+ @Override
+ protected Image buildValue_() {
+ return JpaMappingImageHelper.imageForTypeMapping(subject.mappingKey());
+ }
+ };
+ }
+ }
+
+
+ public static class PersistentAttributeItemLabelProvider extends AbstractItemLabelProvider
+ {
+ public PersistentAttributeItemLabelProvider(
+ IPersistentAttribute persistentAttribute, DelegatingContentAndLabelProvider labelProvider) {
+ super(persistentAttribute, labelProvider);
+ }
+
+ @Override
+ protected PropertyValueModel<String> buildTextModel() {
+ return new PropertyAspectAdapter<IPersistentAttribute, String>(IPersistentAttribute.NAME_PROPERTY, (IPersistentAttribute) model()) {
+ @Override
+ protected String buildValue_() {
+ return subject.getName();
+ }
+ };
+ }
+
+ @Override
+ protected PropertyValueModel<Image> buildImageModel() {
+ return new PropertyAspectAdapter<IPersistentAttribute, Image>(
+ new String[] {IPersistentAttribute.DEFAULT_MAPPING_PROPERTY, IPersistentAttribute.SPECIFIED_MAPPING_PROPERTY},
+ (IPersistentAttribute) model()) {
+ @Override
+ protected Image buildValue_() {
+ return JpaMappingImageHelper.imageForAttributeMapping(subject.mappingKey());
+ }
+ };
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/IJpaStructureProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/IJpaStructureProvider.java
index 90899cac54..cea72b7589 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/IJpaStructureProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/IJpaStructureProvider.java
@@ -3,29 +3,28 @@
* 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.ui.internal.structure;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jpt.ui.internal.jface.IItemLabelProviderFactory;
+import org.eclipse.jpt.ui.internal.jface.ITreeItemContentProviderFactory;
-public interface IJpaStructureProvider
+public interface IJpaStructureProvider
{
+ // TODO - change this
+ Object getInput();
- String fileContentType();
-
/**
- * Build an outline content provider.
+ * Build an factory to create {@link ITreeItemContentProvider}s
*/
- ITreeContentProvider buildContentProvider();
-
+ ITreeItemContentProviderFactory treeItemContentProviderFactory();
+
/**
- * Build an outline label provider.
+ * Build a factory to create {@link IItemLabelProvider}s
*/
- ILabelProvider buildLabelProvider();
-
+ IItemLabelProviderFactory itemLabelProviderFactory();
+
void dispose();
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/JavaItemContentProviderFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/JavaItemContentProviderFactory.java
new file mode 100644
index 0000000000..4329b4149c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/JavaItemContentProviderFactory.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.structure;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.IResourceModel;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.resource.java.JavaResourceModel;
+import org.eclipse.jpt.ui.internal.jface.AbstractTreeItemContentProvider;
+import org.eclipse.jpt.ui.internal.jface.DelegatingContentAndLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.DelegatingTreeContentAndLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.ITreeItemContentProvider;
+import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+
+
+public class JavaItemContentProviderFactory extends GeneralJpaMappingItemContentProviderFactory
+{
+ public ITreeItemContentProvider buildItemContentProvider(
+ Object item, DelegatingContentAndLabelProvider contentProvider) {
+ DelegatingTreeContentAndLabelProvider treeContentProvider = (DelegatingTreeContentAndLabelProvider) contentProvider;
+ if (item instanceof JavaResourceModel) {
+ return new JavaResourceModelItemContentProvider((JavaResourceModel) item, treeContentProvider);
+ }
+ return super.buildItemContentProvider(item, treeContentProvider);
+ }
+
+
+ public static class JavaResourceModelItemContentProvider extends AbstractTreeItemContentProvider<IJpaContextNode>
+ {
+ public JavaResourceModelItemContentProvider(
+ JavaResourceModel javaResourceModel, DelegatingTreeContentAndLabelProvider contentProvider) {
+ super(javaResourceModel, contentProvider);
+ }
+
+ @Override
+ public Object getParent() {
+ return null;
+ }
+
+ @Override
+ protected ListValueModel<IJpaContextNode> buildChildrenModel() {
+ return new ListAspectAdapter<JavaResourceModel, IJpaContextNode>(
+ IResourceModel.ROOT_CONTEXT_NODE_LIST, (JavaResourceModel) model()) {
+ @Override
+ protected ListIterator<IJpaContextNode> listIterator_() {
+ return subject.rootContextNodes();
+ }
+ };
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/JavaItemLabelProviderFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/JavaItemLabelProviderFactory.java
new file mode 100644
index 0000000000..82bc52ac7c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/JavaItemLabelProviderFactory.java
@@ -0,0 +1,17 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.structure;
+
+
+public class JavaItemLabelProviderFactory extends GeneralJpaMappingItemLabelProviderFactory
+{
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/JavaResourceModelStructureProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/JavaResourceModelStructureProvider.java
new file mode 100644
index 0000000000..22b7a499c2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/JavaResourceModelStructureProvider.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.structure;
+
+import org.eclipse.jpt.core.internal.resource.java.JavaResourceModel;
+import org.eclipse.jpt.ui.internal.jface.IItemLabelProviderFactory;
+import org.eclipse.jpt.ui.internal.jface.ITreeItemContentProviderFactory;
+
+public class JavaResourceModelStructureProvider
+ extends ResourceModelStructureProvider
+{
+ public JavaResourceModelStructureProvider(JavaResourceModel resourceModel) {
+ super(resourceModel);
+ }
+
+ public ITreeItemContentProviderFactory treeItemContentProviderFactory() {
+ return new JavaItemContentProviderFactory();
+ }
+
+ public IItemLabelProviderFactory itemLabelProviderFactory() {
+ return new JavaItemLabelProviderFactory();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/JpaStructureProviderFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/JpaStructureProviderFactory.java
new file mode 100644
index 0000000000..a1001d274b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/JpaStructureProviderFactory.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.structure;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.jpt.core.internal.IJpaFile;
+import org.eclipse.jpt.core.internal.IJpaProject;
+import org.eclipse.jpt.core.internal.IResourceModel;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.resource.java.JavaResourceModel;
+import org.eclipse.jpt.core.internal.resource.orm.OrmResourceModel;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResourceModel;
+import org.eclipse.jpt.ui.internal.views.structure.JpaStructurePage;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+
+public class JpaStructureProviderFactory
+ implements IAdapterFactory
+{
+ @SuppressWarnings("unchecked")
+ private static final Class[] ADAPTER_LIST =
+ new Class[] { JpaStructurePage.class };
+
+ @SuppressWarnings("unchecked")
+ public Class[] getAdapterList() {
+ return ADAPTER_LIST;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (! (adaptableObject instanceof IEditorPart)) {
+ return null;
+ }
+
+ IEditorInput editorInput = ((IEditorPart) adaptableObject).getEditorInput();
+
+ if (! (editorInput instanceof IFileEditorInput)) {
+ return null;
+ }
+
+ IFile file = ((IFileEditorInput) editorInput).getFile();
+ IJpaProject jpaProject = JptCorePlugin.jpaProject(file.getProject());
+
+ if (jpaProject == null) {
+ return null;
+ }
+
+ IJpaFile jpaFile = jpaProject.jpaFile(file);
+
+ if (jpaFile == null) {
+ return null;
+ }
+
+ IResourceModel resourceModel = jpaFile.getResourceModel();
+
+ if (resourceModel instanceof JavaResourceModel) {
+ return new JavaResourceModelStructureProvider((JavaResourceModel) resourceModel);
+ }
+ else if (resourceModel instanceof OrmResourceModel) {
+ return new OrmResourceModelStructureProvider((OrmResourceModel) resourceModel);
+ }
+ else if (resourceModel instanceof PersistenceResourceModel) {
+ return new PersistenceResourceModelStructureProvider((PersistenceResourceModel) resourceModel);
+ }
+
+ return null;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/OrmItemContentProviderFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/OrmItemContentProviderFactory.java
new file mode 100644
index 0000000000..961400b6e5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/OrmItemContentProviderFactory.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.structure;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.IResourceModel;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.orm.EntityMappings;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.orm.OrmResourceModel;
+import org.eclipse.jpt.ui.internal.jface.AbstractTreeItemContentProvider;
+import org.eclipse.jpt.ui.internal.jface.DelegatingContentAndLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.DelegatingTreeContentAndLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.ITreeItemContentProvider;
+import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+
+public class OrmItemContentProviderFactory extends GeneralJpaMappingItemContentProviderFactory
+{
+ public ITreeItemContentProvider buildItemContentProvider(
+ Object item, DelegatingContentAndLabelProvider contentProvider) {
+ DelegatingTreeContentAndLabelProvider treeContentProvider = (DelegatingTreeContentAndLabelProvider) contentProvider;
+ if (item instanceof OrmResourceModel) {
+ return new OrmResourceModelItemContentProvider((OrmResourceModel) item, treeContentProvider);
+ }
+ if (item instanceof EntityMappings) {
+ return new EntityMappingsItemContentProvider((EntityMappings) item, treeContentProvider);
+ }
+ else return super.buildItemContentProvider(item, treeContentProvider);
+ }
+
+
+ public static class OrmResourceModelItemContentProvider extends AbstractTreeItemContentProvider<IJpaContextNode>
+ {
+ public OrmResourceModelItemContentProvider(
+ OrmResourceModel ormResourceModel, DelegatingTreeContentAndLabelProvider contentProvider) {
+ super(ormResourceModel, contentProvider);
+ }
+
+ @Override
+ public Object getParent() {
+ return null;
+ }
+
+ @Override
+ protected ListValueModel<IJpaContextNode> buildChildrenModel() {
+ return new ListAspectAdapter<OrmResourceModel, IJpaContextNode>(
+ IResourceModel.ROOT_CONTEXT_NODE_LIST, (OrmResourceModel) model()) {
+ @Override
+ protected ListIterator<IJpaContextNode> listIterator_() {
+ return subject.rootContextNodes();
+ }
+ };
+ }
+ }
+
+
+ public static class EntityMappingsItemContentProvider extends AbstractTreeItemContentProvider<XmlPersistentType>
+ {
+ public EntityMappingsItemContentProvider(
+ EntityMappings entityMappings, DelegatingTreeContentAndLabelProvider contentProvider) {
+ super(entityMappings, contentProvider);
+ }
+
+
+ @Override
+ public Object getParent() {
+ // I'd like to return the resource model here, but that involves a hefty
+ // API change - we'll see what happens with this code first
+ return null;
+ }
+
+ @Override
+ protected ListValueModel<XmlPersistentType> buildChildrenModel() {
+ return new ListAspectAdapter<EntityMappings, XmlPersistentType>(
+ EntityMappings.PERSISTENT_TYPES_LIST, (EntityMappings) model()) {
+ @Override
+ protected ListIterator<XmlPersistentType> listIterator_() {
+ return subject.xmlPersistentTypes();
+ }
+ };
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/OrmItemLabelProviderFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/OrmItemLabelProviderFactory.java
new file mode 100644
index 0000000000..6d743fe7af
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/OrmItemLabelProviderFactory.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.structure;
+
+import org.eclipse.jpt.core.internal.context.orm.EntityMappings;
+import org.eclipse.jpt.ui.internal.JptUiIcons;
+import org.eclipse.jpt.ui.internal.JptUiMessages;
+import org.eclipse.jpt.ui.internal.JptUiPlugin;
+import org.eclipse.jpt.ui.internal.jface.AbstractItemLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.DelegatingContentAndLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.IItemLabelProvider;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.StaticPropertyValueModel;
+import org.eclipse.swt.graphics.Image;
+
+public class OrmItemLabelProviderFactory extends GeneralJpaMappingItemLabelProviderFactory
+{
+ public IItemLabelProvider buildItemLabelProvider(
+ Object item, DelegatingContentAndLabelProvider labelProvider) {
+ if (item instanceof EntityMappings) {
+ return new EntityMappingsItemLabelProvider((EntityMappings) item, labelProvider);
+ }
+ else return super.buildItemLabelProvider(item, labelProvider);
+ }
+
+
+ public static class EntityMappingsItemLabelProvider extends AbstractItemLabelProvider
+ {
+ public EntityMappingsItemLabelProvider(
+ EntityMappings entityMappings, DelegatingContentAndLabelProvider labelProvider) {
+ super(entityMappings, labelProvider);
+ }
+
+ @Override
+ protected PropertyValueModel<String> buildTextModel() {
+ return new StaticPropertyValueModel<String>(JptUiMessages.OrmItemLabelProviderFactory_entityMappingsLabel);
+ }
+
+ @Override
+ protected PropertyValueModel<Image> buildImageModel() {
+ return new StaticPropertyValueModel<Image>(JptUiPlugin.getImage(JptUiIcons.ENTITY_MAPPINGS));
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/OrmResourceModelStructureProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/OrmResourceModelStructureProvider.java
new file mode 100644
index 0000000000..95b1525ac1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/OrmResourceModelStructureProvider.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.structure;
+
+import org.eclipse.jpt.core.internal.resource.orm.OrmResourceModel;
+import org.eclipse.jpt.ui.internal.jface.IItemLabelProviderFactory;
+import org.eclipse.jpt.ui.internal.jface.ITreeItemContentProviderFactory;
+
+public class OrmResourceModelStructureProvider
+ extends ResourceModelStructureProvider
+{
+ public OrmResourceModelStructureProvider(OrmResourceModel resourceModel) {
+ super(resourceModel);
+ }
+
+ public ITreeItemContentProviderFactory treeItemContentProviderFactory() {
+ return new OrmItemContentProviderFactory();
+ }
+
+ public IItemLabelProviderFactory itemLabelProviderFactory() {
+ return new OrmItemLabelProviderFactory();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/PersistenceItemContentProviderFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/PersistenceItemContentProviderFactory.java
new file mode 100644
index 0000000000..6753568592
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/PersistenceItemContentProviderFactory.java
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.structure;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.IResourceModel;
+import org.eclipse.jpt.core.internal.context.base.IClassRef;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.base.IMappingFileRef;
+import org.eclipse.jpt.core.internal.context.base.IPersistence;
+import org.eclipse.jpt.core.internal.context.base.IPersistenceUnit;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResourceModel;
+import org.eclipse.jpt.ui.internal.jface.AbstractTreeItemContentProvider;
+import org.eclipse.jpt.ui.internal.jface.DelegatingContentAndLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.DelegatingTreeContentAndLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.ITreeItemContentProvider;
+import org.eclipse.jpt.ui.internal.jface.ITreeItemContentProviderFactory;
+import org.eclipse.jpt.utility.internal.iterators.ReadOnlyCompositeListIterator;
+import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+
+public class PersistenceItemContentProviderFactory
+ implements ITreeItemContentProviderFactory
+{
+ public ITreeItemContentProvider buildItemContentProvider(
+ Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) {
+ DelegatingTreeContentAndLabelProvider treeContentProvider = (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider;
+ if (item instanceof PersistenceResourceModel) {
+ return new PersistenceResourceModelItemContentProvider((PersistenceResourceModel) item, treeContentProvider);
+ }
+ else if (item instanceof IPersistence) {
+ return new PersistenceItemContentProvider((IPersistence) item, treeContentProvider);
+ }
+ else if (item instanceof IPersistenceUnit) {
+ return new PersistenceUnitItemContentProvider((IPersistenceUnit) item, treeContentProvider);
+ }
+ else if (item instanceof IMappingFileRef) {
+ return new MappingFileRefItemContentProvider((IMappingFileRef) item, treeContentProvider);
+ }
+ else if (item instanceof IClassRef) {
+ return new ClassRefItemContentProvider((IClassRef) item, treeContentProvider);
+ }
+ return null;
+ }
+
+
+ public static class PersistenceResourceModelItemContentProvider extends AbstractTreeItemContentProvider<IJpaContextNode>
+ {
+ public PersistenceResourceModelItemContentProvider(
+ PersistenceResourceModel persistenceResourceModel,
+ DelegatingTreeContentAndLabelProvider contentProvider) {
+ super(persistenceResourceModel, contentProvider);
+ }
+
+ @Override
+ public Object getParent() {
+ return null;
+ }
+
+ @Override
+ protected ListValueModel<IJpaContextNode> buildChildrenModel() {
+ return new ListAspectAdapter<PersistenceResourceModel, IJpaContextNode>(
+ IResourceModel.ROOT_CONTEXT_NODE_LIST, (PersistenceResourceModel) model()) {
+ @Override
+ protected ListIterator<IJpaContextNode> listIterator_() {
+ return subject.rootContextNodes();
+ }
+ };
+ }
+ }
+
+
+ public static class PersistenceItemContentProvider extends AbstractTreeItemContentProvider<IPersistenceUnit>
+ {
+ public PersistenceItemContentProvider(
+ IPersistence persistence, DelegatingTreeContentAndLabelProvider contentProvider) {
+ super(persistence, contentProvider);
+ }
+
+
+ @Override
+ public Object getParent() {
+ // I'd like to return the resource model here, but that involves a hefty
+ // API change - we'll see what happens with this code first
+ return null;
+ }
+
+ @Override
+ protected ListValueModel<IPersistenceUnit> buildChildrenModel() {
+ return new ListAspectAdapter<IPersistence, IPersistenceUnit>(
+ IPersistence.PERSISTENCE_UNITS_LIST, (IPersistence) model()) {
+ @Override
+ protected ListIterator<IPersistenceUnit> listIterator_() {
+ return subject.persistenceUnits();
+ }
+ };
+ }
+ }
+
+
+ public static class PersistenceUnitItemContentProvider extends AbstractTreeItemContentProvider<IJpaContextNode>
+ {
+ public PersistenceUnitItemContentProvider(
+ IPersistenceUnit persistenceUnit, DelegatingTreeContentAndLabelProvider contentProvider) {
+ super(persistenceUnit, contentProvider);
+ }
+
+ @Override
+ public Object getParent() {
+ return ((IPersistenceUnit) model()).persistence();
+ }
+
+ @Override
+ protected ListValueModel<IJpaContextNode> buildChildrenModel() {
+ return new ListAspectAdapter<IPersistenceUnit, IJpaContextNode>(
+ new String[] {IPersistenceUnit.SPECIFIED_MAPPING_FILE_REF_LIST, IPersistenceUnit.CLASS_REF_LIST},
+ (IPersistenceUnit) model()) {
+ @Override
+ @SuppressWarnings("unchecked")
+ protected ListIterator<IJpaContextNode> listIterator_() {
+ return new ReadOnlyCompositeListIterator<IJpaContextNode>(
+ subject.mappingFileRefs(), subject.classRefs());
+ }
+ };
+ }
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public static class MappingFileRefItemContentProvider extends AbstractTreeItemContentProvider
+ {
+ public MappingFileRefItemContentProvider(
+ IMappingFileRef mappingFileRef, DelegatingTreeContentAndLabelProvider contentProvider) {
+ super(mappingFileRef, contentProvider);
+ }
+
+ @Override
+ public Object getParent() {
+ return ((IMappingFileRef) model()).persistenceUnit();
+ }
+
+ @Override
+ public boolean hasChildren() {
+ return false;
+ }
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public static class ClassRefItemContentProvider extends AbstractTreeItemContentProvider
+ {
+ public ClassRefItemContentProvider(
+ IClassRef classRef, DelegatingTreeContentAndLabelProvider contentProvider) {
+ super(classRef, contentProvider);
+ }
+
+ @Override
+ public Object getParent() {
+ return ((IClassRef) model()).persistenceUnit();
+ }
+
+ @Override
+ public boolean hasChildren() {
+ return false;
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/PersistenceItemLabelProviderFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/PersistenceItemLabelProviderFactory.java
new file mode 100644
index 0000000000..e54ac6ff9c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/PersistenceItemLabelProviderFactory.java
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.structure;
+
+import org.eclipse.jpt.core.internal.context.base.IClassRef;
+import org.eclipse.jpt.core.internal.context.base.IMappingFileRef;
+import org.eclipse.jpt.core.internal.context.base.IPersistence;
+import org.eclipse.jpt.core.internal.context.base.IPersistenceUnit;
+import org.eclipse.jpt.ui.internal.JptUiIcons;
+import org.eclipse.jpt.ui.internal.JptUiMessages;
+import org.eclipse.jpt.ui.internal.JptUiPlugin;
+import org.eclipse.jpt.ui.internal.jface.AbstractItemLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.DelegatingContentAndLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.IItemLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.IItemLabelProviderFactory;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.StaticPropertyValueModel;
+import org.eclipse.swt.graphics.Image;
+
+public class PersistenceItemLabelProviderFactory
+ implements IItemLabelProviderFactory
+{
+ public IItemLabelProvider buildItemLabelProvider(
+ Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) {
+ if (item instanceof IPersistence) {
+ return new PersistenceItemLabelProvider((IPersistence) item, contentAndLabelProvider);
+ }
+ else if (item instanceof IPersistenceUnit) {
+ return new PersistenceUnitItemLabelProvider((IPersistenceUnit) item, contentAndLabelProvider);
+ }
+ else if (item instanceof IMappingFileRef) {
+ return new MappingFileRefItemLabelProvider((IMappingFileRef) item, contentAndLabelProvider);
+ }
+ else if (item instanceof IClassRef) {
+ return new ClassRefItemLabelProvider((IClassRef) item, contentAndLabelProvider);
+ }
+ return null;
+ }
+
+
+ public static class PersistenceItemLabelProvider extends AbstractItemLabelProvider
+ {
+ public PersistenceItemLabelProvider(
+ IPersistence persistence, DelegatingContentAndLabelProvider labelProvider) {
+ super(persistence, labelProvider);
+ }
+
+ @Override
+ protected PropertyValueModel<String> buildTextModel() {
+ return new StaticPropertyValueModel<String>(JptUiMessages.PersistenceItemLabelProviderFactory_persistenceLabel);
+ }
+
+ @Override
+ protected PropertyValueModel<Image> buildImageModel() {
+ return new StaticPropertyValueModel<Image>(JptUiPlugin.getImage(JptUiIcons.PERSISTENCE));
+ }
+ }
+
+
+ public static class PersistenceUnitItemLabelProvider extends AbstractItemLabelProvider
+ {
+ public PersistenceUnitItemLabelProvider(
+ IPersistenceUnit persistenceUnit, DelegatingContentAndLabelProvider labelProvider) {
+ super(persistenceUnit, labelProvider);
+ }
+
+ @Override
+ protected PropertyValueModel<String> buildTextModel() {
+ return new PropertyAspectAdapter<IPersistenceUnit, String>(IPersistenceUnit.NAME_PROPERTY, (IPersistenceUnit) model()) {
+ @Override
+ protected String buildValue_() {
+ return subject.getName();
+ }
+ };
+ }
+
+ @Override
+ protected PropertyValueModel<Image> buildImageModel() {
+ return new StaticPropertyValueModel<Image>(JptUiPlugin.getImage(JptUiIcons.PERSISTENCE_UNIT));
+ }
+ }
+
+
+ public static class MappingFileRefItemLabelProvider extends AbstractItemLabelProvider
+ {
+ public MappingFileRefItemLabelProvider(
+ IMappingFileRef mappingFileRef, DelegatingContentAndLabelProvider labelProvider) {
+ super(mappingFileRef, labelProvider);
+ }
+
+ @Override
+ protected PropertyValueModel<String> buildTextModel() {
+ return new PropertyAspectAdapter<IMappingFileRef, String>(IMappingFileRef.FILE_NAME_PROPERTY, (IMappingFileRef) model()) {
+ @Override
+ protected String buildValue_() {
+ return subject.getFileName();
+ }
+ };
+ }
+
+ @Override
+ protected PropertyValueModel<Image> buildImageModel() {
+ return new StaticPropertyValueModel<Image>(JptUiPlugin.getImage(JptUiIcons.MAPPING_FILE_REF));
+ }
+ }
+
+
+ public static class ClassRefItemLabelProvider extends AbstractItemLabelProvider
+ {
+ public ClassRefItemLabelProvider(
+ IClassRef classRef, DelegatingContentAndLabelProvider labelProvider) {
+ super(classRef, labelProvider);
+ }
+
+ @Override
+ protected PropertyValueModel<String> buildTextModel() {
+ return new PropertyAspectAdapter<IClassRef, String>(IClassRef.CLASS_NAME_PROPERTY, (IClassRef) model()) {
+ @Override
+ protected String buildValue_() {
+ return subject.getClassName();
+ }
+ };
+ }
+
+ @Override
+ protected PropertyValueModel<Image> buildImageModel() {
+ return new StaticPropertyValueModel<Image>(JptUiPlugin.getImage(JptUiIcons.CLASS_REF));
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/PersistenceResourceModelStructureProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/PersistenceResourceModelStructureProvider.java
new file mode 100644
index 0000000000..cbcb257fd0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/PersistenceResourceModelStructureProvider.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.structure;
+
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResourceModel;
+import org.eclipse.jpt.ui.internal.jface.IItemLabelProviderFactory;
+import org.eclipse.jpt.ui.internal.jface.ITreeItemContentProviderFactory;
+
+public class PersistenceResourceModelStructureProvider
+ extends ResourceModelStructureProvider
+{
+ public PersistenceResourceModelStructureProvider(PersistenceResourceModel resourceModel) {
+ super(resourceModel);
+ }
+
+ public ITreeItemContentProviderFactory treeItemContentProviderFactory() {
+ return new PersistenceItemContentProviderFactory();
+ }
+
+ public IItemLabelProviderFactory itemLabelProviderFactory() {
+ return new PersistenceItemLabelProviderFactory();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/ResourceModelStructureProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/ResourceModelStructureProvider.java
new file mode 100644
index 0000000000..e2b2df4229
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/structure/ResourceModelStructureProvider.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.structure;
+
+import org.eclipse.jpt.core.internal.IResourceModel;
+
+public abstract class ResourceModelStructureProvider
+ implements IJpaStructureProvider
+{
+ protected IResourceModel resourceModel;
+
+
+ public ResourceModelStructureProvider(IResourceModel resourceModel) {
+ this.resourceModel = resourceModel;
+ }
+
+ public Object getInput() {
+ return resourceModel;
+ }
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/swt/BooleanButtonModelAdapter.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/swt/BooleanButtonModelAdapter.java
new file mode 100644
index 0000000000..05c501b56b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/swt/BooleanButtonModelAdapter.java
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.swt;
+
+import org.eclipse.jpt.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+
+/**
+ * This adapter can be used to keep a check box or toggle button in synch with
+ * a model boolean.
+ */
+public class BooleanButtonModelAdapter {
+
+ /** A value model on the underlying model boolean. */
+ protected final WritablePropertyValueModel<Boolean> booleanHolder;
+
+ /**
+ * A listener that allows us to synchronize the button's selection state with
+ * the model boolean.
+ */
+ protected final PropertyChangeListener booleanChangeListener;
+
+ /** The check box/toggle button we synchronize with the model boolean. */
+ protected final Button button;
+
+ /**
+ * A listener that allows us to synchronize the model boolean with
+ * the button's selection state.
+ */
+ protected final SelectionListener buttonSelectionListener;
+
+ /**
+ * A listener that allows us to stop listening to stuff when the button
+ * is disposed.
+ */
+ protected final DisposeListener buttonDisposeListener;
+
+ /**
+ * The default setting for the check box/toggle button; for when the
+ * underlying model is null.
+ * The default [default value] is false (i.e. the button is checked/popped out).
+ */
+ protected final boolean defaultValue;
+
+
+ // ********** static methods **********
+
+ /**
+ * Adapt the specified boolean to the specified button.
+ * If the boolean is null, the button's value will be "unselected".
+ */
+ public static BooleanButtonModelAdapter adapt(WritablePropertyValueModel<Boolean> booleanHolder, Button button) {
+ return new BooleanButtonModelAdapter(booleanHolder, button);
+ }
+
+ /**
+ * Adapt the specified boolean to the specified button.
+ * If the boolean is null, the button's value will be the specified default value.
+ */
+ public static BooleanButtonModelAdapter adapt(WritablePropertyValueModel<Boolean> booleanHolder, Button button, boolean defaultValue) {
+ return new BooleanButtonModelAdapter(booleanHolder, button, defaultValue);
+ }
+
+
+ // ********** constructors **********
+
+ /**
+ * Constructor - the boolean holder and button are required.
+ * The default value will be false.
+ */
+ protected BooleanButtonModelAdapter(WritablePropertyValueModel<Boolean> booleanHolder, Button button) {
+ this(booleanHolder, button, false);
+ }
+
+ /**
+ * Constructor - the boolean holder and button are required.
+ */
+ protected BooleanButtonModelAdapter(WritablePropertyValueModel<Boolean> booleanHolder, Button button, boolean defaultValue) {
+ super();
+ if ((booleanHolder == null) || (button == null)) {
+ throw new NullPointerException();
+ }
+ this.booleanHolder = booleanHolder;
+ this.button = button;
+ this.defaultValue = defaultValue;
+
+ this.booleanChangeListener = this.buildBooleanChangeListener();
+ this.booleanHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.booleanChangeListener);
+
+ this.buttonDisposeListener = this.buildButtonDisposeListener();
+ this.button.addDisposeListener(this.buttonDisposeListener);
+
+ this.buttonSelectionListener = this.buildButtonSelectionListener();
+ this.button.addSelectionListener(this.buttonSelectionListener);
+
+ this.setButtonSelection(this.booleanHolder.value());
+ }
+
+
+ // ********** initialization **********
+
+ protected PropertyChangeListener buildBooleanChangeListener() {
+ return new SWTPropertyChangeListenerWrapper(this.buildBooleanChangeListener_());
+ }
+
+ protected PropertyChangeListener buildBooleanChangeListener_() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent event) {
+ BooleanButtonModelAdapter.this.booleanChanged(event);
+ }
+ @Override
+ public String toString() {
+ return "boolean listener";
+ }
+ };
+ }
+
+ protected SelectionListener buildButtonSelectionListener() {
+ return new SelectionListener() {
+ public void widgetSelected(SelectionEvent event) {
+ BooleanButtonModelAdapter.this.buttonSelected(event);
+ }
+ public void widgetDefaultSelected(SelectionEvent event) {
+ // ignore
+ }
+ @Override
+ public String toString() {
+ return "button selection listener";
+ }
+ };
+ }
+
+ protected DisposeListener buildButtonDisposeListener() {
+ return new DisposeListener() {
+ public void widgetDisposed(DisposeEvent event) {
+ BooleanButtonModelAdapter.this.buttonDisposed(event);
+ }
+ @Override
+ public String toString() {
+ return "button dispose listener";
+ }
+ };
+ }
+
+
+ // ********** behavior **********
+
+ /**
+ * The model has changed - synchronize the button.
+ * If the new model value is null, use the adapter's default value
+ * (which is typically false).
+ */
+ protected void booleanChanged(PropertyChangeEvent event) {
+ this.setButtonSelection((Boolean) event.newValue());
+ }
+
+ protected void setButtonSelection(Boolean b) {
+ this.button.setSelection(this.booleanValue(b));
+ }
+
+ protected boolean booleanValue(Boolean b) {
+ return (b != null) ? b.booleanValue() : this.defaultValue();
+ }
+
+ protected boolean defaultValue() {
+ return this.defaultValue;
+ }
+
+ /**
+ * The button has been "selected" - synchronize the model.
+ */
+ protected void buttonSelected(SelectionEvent event) {
+ this.booleanHolder.setValue(Boolean.valueOf(button.getSelection()));
+ }
+
+
+ // ********** dispose **********
+
+ protected void buttonDisposed(DisposeEvent event) {
+ this.button.removeSelectionListener(this.buttonSelectionListener);
+ this.button.removeDisposeListener(this.buttonDisposeListener);
+ this.booleanHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.booleanChangeListener);
+ }
+
+
+ // ********** standard methods **********
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.booleanHolder);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/swt/ListBoxModelAdapter.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/swt/ListBoxModelAdapter.java
new file mode 100644
index 0000000000..dfdd0cd29e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/swt/ListBoxModelAdapter.java
@@ -0,0 +1,588 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.ui.internal.swt;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.EventObject;
+import java.util.Iterator;
+import java.util.ListIterator;
+
+import org.eclipse.jpt.ui.internal.listeners.SWTCollectionChangeListenerWrapper;
+import org.eclipse.jpt.ui.internal.listeners.SWTListChangeListenerWrapper;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.StringConverter;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.model.event.CollectionChangeEvent;
+import org.eclipse.jpt.utility.internal.model.event.ListChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener;
+import org.eclipse.jpt.utility.internal.model.listener.ListChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyCollectionValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.List;
+
+/**
+ * This adapter provides a more object-oriented interface to the items and
+ * selected items in a list box.
+ * 'listHolder' contains the items in the list box.
+ * 'selectedItemsHolder' contains the items in 'listHolder' that are selected
+ * in the list box.
+ */
+public class ListBoxModelAdapter<E> {
+
+ // ********** model **********
+ /**
+ * A value model on the underlying model list.
+ */
+ protected final ListValueModel<E> listHolder;
+
+ /**
+ * A listener that allows us to synchronize the list box's contents with
+ * the model list.
+ */
+ protected final ListChangeListener listChangeListener;
+
+ /**
+ * A value model on the underlying model selections.
+ */
+ protected final CollectionValueModel<E> selectedItemsHolder;
+
+ /**
+ * A listener that allows us to synchronize the list box's selection with
+ * the model selections.
+ */
+ protected final CollectionChangeListener selectedItemsChangeListener;
+
+ /**
+ * A converter that converts items in the model list
+ * to strings that can be put in the list box.
+ */
+ protected StringConverter<E> stringConverter;
+
+ // ********** UI **********
+ /**
+ * The list box we keep synchronized with the model list.
+ */
+ protected final List listBox;
+
+ /**
+ * A listener that allows us to synchronize our selection list holder
+ * with the list box's selection.
+ */
+ protected final SelectionListener listBoxSelectionListener;
+
+ /**
+ * Clients that are interested in selection change events.
+ */
+ protected SelectionChangeListener<E>[] selectionChangeListeners;
+
+ /**
+ * Clients that are interested in double click events.
+ */
+ protected DoubleClickListener<E>[] doubleClickListeners;
+
+ /**
+ * A listener that allows us to stop listening to stuff when the list box
+ * is disposed.
+ */
+ protected final DisposeListener listBoxDisposeListener;
+
+
+ // ********** static methods **********
+
+ /**
+ * Adapt the specified model list and selections to the specified list box.
+ * Use the default string converter to convert the model items to strings
+ * to be displayed in the list box, which calls #toString() on the
+ * items in the model list.
+ */
+ public static <T> ListBoxModelAdapter<T> adapt(
+ ListValueModel<T> listHolder,
+ CollectionValueModel<T> selectedItemsHolder,
+ List listBox)
+ {
+ return adapt(listHolder, selectedItemsHolder, listBox, StringConverter.Default.<T>instance());
+ }
+
+ /**
+ * Adapt the specified model list and selections to the specified list box.
+ * Use the specified string converter to convert the model items to strings
+ * to be displayed in the list box.
+ */
+ public static <T> ListBoxModelAdapter<T> adapt(
+ ListValueModel<T> listHolder,
+ CollectionValueModel<T> selectedItemsHolder,
+ List listBox,
+ StringConverter<T> stringConverter)
+ {
+ return new ListBoxModelAdapter<T>(listHolder, selectedItemsHolder, listBox, stringConverter);
+ }
+
+ /**
+ * Adapt the specified model list and selection to the specified list box.
+ * Use the default string converter to convert the model items to strings
+ * to be displayed in the list box, which calls #toString() on the
+ * items in the model list.
+ */
+ public static <T> ListBoxModelAdapter<T> adapt(
+ ListValueModel<T> listHolder,
+ PropertyValueModel<T> selectedItemHolder,
+ List listBox)
+ {
+ return adapt(listHolder, selectedItemHolder, listBox, StringConverter.Default.<T>instance());
+ }
+
+ /**
+ * Adapt the specified model list and selection to the specified list box.
+ * Use the specified string converter to convert the model items to strings
+ * to be displayed in the list box.
+ */
+ public static <T> ListBoxModelAdapter<T> adapt(
+ ListValueModel<T> listHolder,
+ PropertyValueModel<T> selectedItemHolder,
+ List listBox,
+ StringConverter<T> stringConverter)
+ {
+ return new ListBoxModelAdapter<T>(listHolder, new PropertyCollectionValueModelAdapter<T>(selectedItemHolder), listBox, stringConverter);
+ }
+
+
+ // ********** constructors **********
+
+ /**
+ * Constructor - the list holder, selections holder, list box, and
+ * string converter are required.
+ */
+ protected ListBoxModelAdapter(
+ ListValueModel<E> listHolder,
+ CollectionValueModel<E> selectedItemsHolder,
+ List listBox,
+ StringConverter<E> stringConverter)
+ {
+ super();
+ if ((listHolder == null) || (selectedItemsHolder == null) || (listBox == null) || (stringConverter == null)) {
+ throw new NullPointerException();
+ }
+ this.listHolder = listHolder;
+ this.selectedItemsHolder = selectedItemsHolder;
+ this.listBox = listBox;
+ this.stringConverter = stringConverter;
+
+ this.listChangeListener = this.buildListChangeListener();
+ this.listHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener);
+
+ this.selectedItemsChangeListener = this.buildSelectedItemsChangeListener();
+ this.selectedItemsHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.selectedItemsChangeListener);
+
+ this.listBoxSelectionListener = this.buildListBoxSelectionListener();
+ this.listBox.addSelectionListener(this.listBoxSelectionListener);
+
+ this.selectionChangeListeners = this.buildSelectionChangeListeners();
+ this.doubleClickListeners = this.buildDoubleClickListeners();
+
+ this.listBoxDisposeListener = this.buildListBoxDisposeListener();
+ this.listBox.addDisposeListener(this.listBoxDisposeListener);
+
+ this.synchronizeListBox();
+ }
+
+
+ // ********** initialization **********
+
+ protected ListChangeListener buildListChangeListener() {
+ return new SWTListChangeListenerWrapper(this.buildListChangeListener_());
+ }
+
+ protected ListChangeListener buildListChangeListener_() {
+ return new ListChangeListener() {
+ public void itemsAdded(ListChangeEvent event) {
+ ListBoxModelAdapter.this.listItemsAdded(event);
+ }
+ public void itemsRemoved(ListChangeEvent event) {
+ ListBoxModelAdapter.this.listItemsRemoved(event);
+ }
+ public void itemsMoved(ListChangeEvent event) {
+ ListBoxModelAdapter.this.listItemsMoved(event);
+ }
+ public void itemsReplaced(ListChangeEvent event) {
+ ListBoxModelAdapter.this.listItemsReplaced(event);
+ }
+ public void listCleared(ListChangeEvent event) {
+ ListBoxModelAdapter.this.listCleared(event);
+ }
+ public void listChanged(ListChangeEvent event) {
+ ListBoxModelAdapter.this.listChanged(event);
+ }
+ @Override
+ public String toString() {
+ return "list listener";
+ }
+ };
+ }
+
+ protected CollectionChangeListener buildSelectedItemsChangeListener() {
+ return new SWTCollectionChangeListenerWrapper(this.buildSelectedItemsChangeListener_());
+ }
+
+ protected CollectionChangeListener buildSelectedItemsChangeListener_() {
+ return new CollectionChangeListener() {
+ public void itemsAdded(CollectionChangeEvent event) {
+ ListBoxModelAdapter.this.selectedItemsAdded(event);
+ }
+ public void itemsRemoved(CollectionChangeEvent event) {
+ ListBoxModelAdapter.this.selectedItemsRemoved(event);
+ }
+ public void collectionCleared(CollectionChangeEvent event) {
+ ListBoxModelAdapter.this.selectedItemsCleared(event);
+ }
+ public void collectionChanged(CollectionChangeEvent event) {
+ ListBoxModelAdapter.this.selectedItemsChanged(event);
+ }
+ @Override
+ public String toString() {
+ return "selected items listener";
+ }
+ };
+ }
+
+ protected SelectionListener buildListBoxSelectionListener() {
+ return new SelectionListener() {
+ public void widgetSelected(SelectionEvent event) {
+ ListBoxModelAdapter.this.listBoxSelectionChanged(event);
+ }
+ public void widgetDefaultSelected(SelectionEvent event) {
+ ListBoxModelAdapter.this.listBoxDoubleClicked(event);
+ }
+ @Override
+ public String toString() {
+ return "list box selection listener";
+ }
+ };
+ }
+
+ @SuppressWarnings("unchecked")
+ protected DoubleClickListener<E>[] buildDoubleClickListeners() {
+ return new DoubleClickListener[0];
+ }
+
+ @SuppressWarnings("unchecked")
+ protected SelectionChangeListener<E>[] buildSelectionChangeListeners() {
+ return new SelectionChangeListener[0];
+ }
+
+ protected DisposeListener buildListBoxDisposeListener() {
+ return new DisposeListener() {
+ public void widgetDisposed(DisposeEvent event) {
+ ListBoxModelAdapter.this.listBoxDisposed(event);
+ }
+ @Override
+ public String toString() {
+ return "list box dispose listener";
+ }
+ };
+ }
+
+ protected void synchronizeListBox() {
+ this.synchronizeListBoxItems();
+ this.synchronizeListBoxSelection();
+ }
+
+
+ // ********** string converter **********
+
+ public void setStringConverter(StringConverter<E> stringConverter) {
+ if (stringConverter == null) {
+ throw new NullPointerException();
+ }
+ this.stringConverter = stringConverter;
+ this.synchronizeListBox();
+ }
+
+
+ // ********** list **********
+
+ /**
+ * Use the string converter to convert the specified item to a
+ * string that can be added to the list box.
+ */
+ protected String convert(E item) {
+ return this.stringConverter.convertToString(item);
+ }
+
+ /**
+ * Brute force synchronization of list box with the model list.
+ */
+ protected void synchronizeListBoxItems() {
+ int len = this.listHolder.size();
+ String[] items = new String[len];
+ for (int i = 0; i < len; i++) {
+ items[i] = this.convert(this.listHolder.get(i));
+ }
+ this.listBox.setItems(items);
+ }
+
+ /**
+ * The model has changed - synchronize the list box.
+ */
+ protected void listItemsAdded(ListChangeEvent event) {
+ int i = event.index();
+ for (ListIterator<E> stream = this.items(event); stream.hasNext(); ) {
+ this.listBox.add(this.convert(stream.next()), i++);
+ }
+ }
+
+ /**
+ * The model has changed - synchronize the list box.
+ */
+ protected void listItemsRemoved(ListChangeEvent event) {
+ this.listBox.remove(event.index(), event.index() + event.itemsSize() - 1);
+ }
+
+ /**
+ * The model has changed - synchronize the list box.
+ */
+ protected void listItemsMoved(ListChangeEvent event) {
+ int target = event.targetIndex();
+ int source = event.sourceIndex();
+ int len = event.moveLength();
+ int loStart = Math.min(target, source);
+ int hiStart = Math.max(target, source);
+ // make a copy of the affected items...
+ String[] subArray = CollectionTools.subArray(this.listBox.getItems(), loStart, hiStart + len - loStart);
+ // ...move them around...
+ subArray = CollectionTools.move(subArray, target - loStart, source - loStart, len);
+ // ...and then put them back
+ for (int i = 0; i < subArray.length; i++) {
+ this.listBox.setItem(loStart + i, subArray[i]);
+ }
+ }
+
+ /**
+ * The model has changed - synchronize the list box.
+ */
+ protected void listItemsReplaced(ListChangeEvent event) {
+ int i = event.index();
+ for (ListIterator<E> stream = this.items(event); stream.hasNext(); ) {
+ this.listBox.setItem(i++, this.convert(stream.next()));
+ }
+ }
+
+ /**
+ * The model has changed - synchronize the list box.
+ */
+ protected void listCleared(ListChangeEvent event) {
+ this.listBox.removeAll();
+ }
+
+ /**
+ * The model has changed - synchronize the list box.
+ */
+ protected void listChanged(ListChangeEvent event) {
+ this.synchronizeListBoxItems();
+ }
+
+ // minimized unchecked code
+ @SuppressWarnings("unchecked")
+ protected ListIterator<E> items(ListChangeEvent event) {
+ return ((ListIterator<E>) event.items());
+ }
+
+
+ // ********** selected items **********
+
+ protected int indexOf(E item) {
+ int len = this.listHolder.size();
+ for (int i = 0; i < len; i++) {
+ if (this.listHolder.get(i) == item) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ protected void synchronizeListBoxSelection() {
+ int[] indices = new int[this.selectedItemsHolder.size()];
+ int i = 0;
+ for (Iterator<E> stream = this.selectedItemsHolder.iterator(); stream.hasNext(); ) {
+ indices[i++] = this.indexOf(stream.next());
+ }
+ this.listBox.deselectAll();
+ this.listBox.select(indices);
+ }
+
+ protected void selectedItemsAdded(CollectionChangeEvent event) {
+ int[] indices = new int[event.itemsSize()];
+ int i = 0;
+ for (Iterator<E> stream = this.items(event); stream.hasNext(); ) {
+ indices[i++] = this.indexOf(stream.next());
+ }
+ this.listBox.select(indices);
+ }
+
+ protected void selectedItemsRemoved(CollectionChangeEvent event) {
+ int[] indices = new int[event.itemsSize()];
+ int i = 0;
+ for (Iterator<E> stream = this.items(event); stream.hasNext(); ) {
+ indices[i++] = this.indexOf(stream.next());
+ }
+ this.listBox.deselect(indices);
+ }
+
+ protected void selectedItemsCleared(CollectionChangeEvent event) {
+ this.listBox.deselectAll();
+ }
+
+ protected void selectedItemsChanged(CollectionChangeEvent event) {
+ this.synchronizeListBoxSelection();
+ }
+
+ // minimized unchecked code
+ @SuppressWarnings("unchecked")
+ protected Iterator<E> items(CollectionChangeEvent event) {
+ return ((Iterator<E>) event.items());
+ }
+
+
+ // ********** list box events **********
+
+ protected void listBoxSelectionChanged(SelectionEvent event) {
+ if (this.selectionChangeListeners.length > 0) {
+ @SuppressWarnings("unchecked")
+ SelectionChangeEvent<E> scEvent = new SelectionChangeEvent(this, this.selectedItems());
+ for (SelectionChangeListener<E> selectionChangeListener : this.selectionChangeListeners) {
+ selectionChangeListener.selectionChanged(scEvent);
+ }
+ }
+ }
+
+ protected Collection<E> selectedItems() {
+ @SuppressWarnings("unchecked")
+ ArrayList<E> selectedItems = new ArrayList(this.listBox.getSelectionCount());
+ for (int selectionIndex : this.listBox.getSelectionIndices()) {
+ selectedItems.add(this.listHolder.get(selectionIndex));
+ }
+ return selectedItems;
+ }
+
+ protected void listBoxDoubleClicked(SelectionEvent event) {
+ if (this.doubleClickListeners.length > 0) {
+ // there should be only a single item selected during a double-click(?)
+ E selection = this.listHolder.get(this.listBox.getSelectionIndex());
+ @SuppressWarnings("unchecked")
+ DoubleClickEvent<E> dcEvent = new DoubleClickEvent(this, selection);
+ for (DoubleClickListener<E> doubleClickListener : this.doubleClickListeners) {
+ doubleClickListener.doubleClick(dcEvent);
+ }
+ }
+ }
+
+
+ // ********** dispose **********
+
+ protected void listBoxDisposed(DisposeEvent event) {
+ this.listBox.removeDisposeListener(this.listBoxDisposeListener);
+ this.listBox.removeSelectionListener(this.listBoxSelectionListener);
+ this.selectedItemsHolder.removeCollectionChangeListener(CollectionValueModel.VALUES, this.selectedItemsChangeListener);
+ this.listHolder.removeListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener);
+ }
+
+
+ // ********** standard methods **********
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.listHolder);
+ }
+
+
+ // ********** double click support **********
+
+ public void addDoubleClickListener(DoubleClickListener<E> listener) {
+ this.doubleClickListeners = CollectionTools.add(this.doubleClickListeners, listener);
+ }
+
+ public void removeDoubleClickListener(DoubleClickListener<E> listener) {
+ this.doubleClickListeners = CollectionTools.remove(this.doubleClickListeners, listener);
+ }
+
+ public interface DoubleClickListener<E> {
+ void doubleClick(DoubleClickEvent<E> event);
+ }
+
+ public static class DoubleClickEvent<E> extends EventObject {
+ private final E selection;
+ private static final long serialVersionUID = 1L;
+
+ protected DoubleClickEvent(ListBoxModelAdapter<E> source, E selection) {
+ super(source);
+ if (selection == null) {
+ throw new NullPointerException();
+ }
+ this.selection = selection;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public ListBoxModelAdapter<E> getSource() {
+ return (ListBoxModelAdapter<E>) super.getSource();
+ }
+
+ public E selection() {
+ return this.selection;
+ }
+
+ }
+
+
+ // ********** selection support **********
+
+ public void addSelectionChangeListener(SelectionChangeListener<E> listener) {
+ this.selectionChangeListeners = CollectionTools.add(this.selectionChangeListeners, listener);
+ }
+
+ public void removeSelectionChangeListener(SelectionChangeListener<E> listener) {
+ this.selectionChangeListeners = CollectionTools.remove(this.selectionChangeListeners, listener);
+ }
+
+ public interface SelectionChangeListener<E> {
+ void selectionChanged(SelectionChangeEvent<E> event);
+ }
+
+ public static class SelectionChangeEvent<E> extends EventObject {
+ private final Collection<E> selection;
+ private static final long serialVersionUID = 1L;
+
+ protected SelectionChangeEvent(ListBoxModelAdapter<E> source, Collection<E> selection) {
+ super(source);
+ if (selection == null) {
+ throw new NullPointerException();
+ }
+ this.selection = selection;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public ListBoxModelAdapter<E> getSource() {
+ return (ListBoxModelAdapter<E>) super.getSource();
+ }
+
+ public Iterator<E> selection() {
+ return this.selection.iterator();
+ }
+
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/swt/TriStateBooleanButtonModelAdapter.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/swt/TriStateBooleanButtonModelAdapter.java
new file mode 100644
index 0000000000..f9bce7517d
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/swt/TriStateBooleanButtonModelAdapter.java
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.swt;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jpt.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
+import org.eclipse.jpt.ui.internal.widgets.TriStateCheckBox;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+
+/**
+ * This adapter can be used to keep a tri-state check box in synch with
+ * a model Boolean where the value can be <code>null</code>.
+ */
+@SuppressWarnings("nls")
+public class TriStateBooleanButtonModelAdapter {
+
+ /** A value model on the underlying model boolean. */
+ protected final WritablePropertyValueModel<Boolean> booleanHolder;
+
+ /**
+ * A listener that allows us to synchronize the button's selection state with
+ * the model boolean.
+ */
+ protected final PropertyChangeListener booleanChangeListener;
+
+ /** The check box/toggle button we synchronize with the model boolean. */
+ protected final TriStateCheckBox button;
+
+ /**
+ * A listener that allows us to synchronize the model boolean with
+ * the button's selection state.
+ */
+ protected final SelectionListener buttonSelectionListener;
+
+ /**
+ * A listener that allows us to stop listening to stuff when the button
+ * is disposed.
+ */
+ protected final DisposeListener buttonDisposeListener;
+
+
+ // ********** static methods **********
+
+ /**
+ * Adapt the specified boolean to the specified button.
+ * If the boolean is null, the button's value will be "unselected".
+ */
+ public static TriStateBooleanButtonModelAdapter adapt(WritablePropertyValueModel<Boolean> booleanHolder, TriStateCheckBox button) {
+ return new TriStateBooleanButtonModelAdapter(booleanHolder, button);
+ }
+
+
+ // ********** constructors **********
+
+ /**
+ * Constructor - the boolean holder and button are required.
+ */
+ protected TriStateBooleanButtonModelAdapter(WritablePropertyValueModel<Boolean> booleanHolder, TriStateCheckBox button) {
+ super();
+
+ Assert.isNotNull(booleanHolder, "The boolean holder cannot be null");
+ Assert.isNotNull(button, "The check box cannot be null");
+
+ this.booleanHolder = booleanHolder;
+ this.button = button;
+
+ this.booleanChangeListener = this.buildBooleanChangeListener();
+ this.booleanHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.booleanChangeListener);
+
+ this.buttonDisposeListener = this.buildButtonDisposeListener();
+ this.button.addDisposeListener(this.buttonDisposeListener);
+
+ this.buttonSelectionListener = this.buildButtonSelectionListener();
+ this.button.addSelectionListener(this.buttonSelectionListener);
+
+ this.setButtonSelection(this.booleanHolder.value());
+ }
+
+
+ // ********** initialization **********
+
+ protected PropertyChangeListener buildBooleanChangeListener() {
+ return new SWTPropertyChangeListenerWrapper(this.buildBooleanChangeListener_());
+ }
+
+ protected PropertyChangeListener buildBooleanChangeListener_() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent event) {
+ TriStateBooleanButtonModelAdapter.this.booleanChanged(event);
+ }
+ @Override
+ public String toString() {
+ return "tri-state boolean listener";
+ }
+ };
+ }
+
+ protected SelectionListener buildButtonSelectionListener() {
+ return new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ TriStateBooleanButtonModelAdapter.this.buttonSelected(event);
+ }
+ @Override
+ public String toString() {
+ return "tri-state button selection listener";
+ }
+ };
+ }
+
+ protected DisposeListener buildButtonDisposeListener() {
+ return new DisposeListener() {
+ public void widgetDisposed(DisposeEvent event) {
+ TriStateBooleanButtonModelAdapter.this.buttonDisposed(event);
+ }
+ @Override
+ public String toString() {
+ return "tri-state button dispose listener";
+ }
+ };
+ }
+
+
+ // ********** behavior **********
+
+ /**
+ * The model has changed - synchronize the button.
+ * If the new model value is null, use the adapter's default value
+ * (which is typically false).
+ */
+ protected void booleanChanged(PropertyChangeEvent event) {
+ this.setButtonSelection((Boolean) event.newValue());
+ }
+
+ protected void setButtonSelection(Boolean selection) {
+ this.button.setSelection(selection);
+ }
+
+ /**
+ * The button has been "selected" - synchronize the model.
+ */
+ protected void buttonSelected(SelectionEvent event) {
+ this.booleanHolder.setValue(button.getSelection());
+ }
+
+
+ // ********** dispose **********
+
+ protected void buttonDisposed(DisposeEvent event) {
+ this.button.removeSelectionListener(this.buttonSelectionListener);
+ this.button.removeDisposeListener(this.buttonDisposeListener);
+ this.booleanHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.booleanChangeListener);
+ }
+
+
+ // ********** standard methods **********
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.booleanHolder);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/AbstractControlEnabler.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/AbstractControlEnabler.java
new file mode 100644
index 0000000000..2e19c58c62
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/AbstractControlEnabler.java
@@ -0,0 +1,284 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+
+/**
+ * A <code>ControlEnabler</code> keeps the "enabled" state of a collection of
+ * widgets in synch with the provided boolean holder.
+ *
+ * @see BaseControllerEnabler
+ * @see ControlEnabler
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+class AbstractControlEnabler
+{
+ /**
+ * A listener that allows us to synchronize the controlHolders with changes made
+ * to the underlying boolean model.
+ */
+ private PropertyChangeListener booleanChangeListener;
+
+ /**
+ * A value model on the underlying boolean model
+ */
+ private PropertyValueModel<Boolean> booleanHolder;
+
+ /**
+ * The collection of <code>IControlHolder</code>s whose "enabled" state is
+ * kept in sync with the boolean holder's value.
+ */
+ private Collection<IControlHolder> controlHolders;
+
+ /**
+ * The default setting for the "enabled" state; for when the underlying model
+ * is <code>null</code>. The default [default value] is <code>false<code>
+ * (i.e. the controlHolders are disabled).
+ */
+ private boolean defaultValue;
+
+ /**
+ * Creates a new <code>AbstractControlEnabler</code>.
+ */
+ AbstractControlEnabler() {
+ super();
+ initialize();
+ }
+
+ /**
+ * Creates a new <code>AbstractControlEnabler</code> with a default value of
+ * <code>false</code> (i.e. disabled).
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param controlHolders The collection of controlHolders whose "enabled" state is
+ * kept in sync with the boolean holder's value
+ */
+ AbstractControlEnabler(PropertyValueModel<Boolean> booleanHolder,
+ Collection<IControlHolder> controlHolders) {
+
+ this(booleanHolder, controlHolders, false);
+ }
+
+ /**
+ * Creates a new <code>ControlEnabler</code>.
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param controlHolders The collection of <code>IControlHolder</code>s whose
+ * "enabled" state is kept in sync with the boolean holder's value
+ * @param defaultValue The value to use when the underlying model is
+ * <code>null</code>
+ */
+ AbstractControlEnabler(PropertyValueModel<Boolean> booleanHolder,
+ Collection<IControlHolder> controlHolders,
+ boolean defaultValue) {
+
+ this();
+ initialize(booleanHolder, controlHolders, defaultValue);
+ }
+
+ /**
+ * Creates a new <code>ControlEnabler</code> with a default value of
+ * <code>false</code> (i.e. disabled).
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param controlHolder The <code>IControlHolder</code> whose "enabled" state
+ * is kept in sync with the boolean holder's value
+ */
+ AbstractControlEnabler(PropertyValueModel<Boolean> booleanHolder,
+ IControlHolder controlHolder) {
+
+ this(booleanHolder, controlHolder, false);
+ }
+
+ /**
+ * Creates a new <code>ControlEnabler</code> with a default value of
+ * <code>false</code> (i.e. disabled).
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param controlHolders The collection of controlHolders whose "enabled"
+ * state is kept in sync with the boolean holder's value
+ */
+ AbstractControlEnabler(PropertyValueModel<Boolean> booleanHolder,
+ IControlHolder... controlHolders) {
+
+ this(booleanHolder, CollectionTools.collection(controlHolders), false);
+ }
+
+ /**
+ * Creates a new <code>ControlEnabler</code>.
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param controlHolder The <code>IControlHolder</code>s whose "enabled" state
+ * is kept in sync with the boolean holder's value
+ * @param defaultValue The value to use when the underlying model is
+ * <code>null</code>
+ */
+ AbstractControlEnabler(PropertyValueModel<Boolean> booleanHolder,
+ IControlHolder controlHolder,
+ boolean defaultValue) {
+
+ this(booleanHolder, new IControlHolder[] { controlHolder }, false);
+ }
+
+ /**
+ * Creates a new <code>ControlEnabler</code>.
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param controlHolders The collection of controlHolders whose "enabled" state is
+ * kept in sync with the boolean holder's value
+ * @param defaultValue The value to use when the underlying model is
+ * <code>null</code>
+ */
+ AbstractControlEnabler(PropertyValueModel<Boolean> booleanHolder,
+ IControlHolder[] controlHolders,
+ boolean defaultValue) {
+
+ this();
+ this.initialize(booleanHolder, CollectionTools.collection(controlHolders), defaultValue);
+ }
+
+ /**
+ * Creates a new <code>ControlEnabler</code> with a default value of
+ * <code>false</code> (i.e. disabled).
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param controlHolders An iterator on the collection of controlHolders whose
+ * "enabled" state is kept in sync with the boolean holder's value
+ */
+ AbstractControlEnabler(PropertyValueModel<Boolean> booleanHolder,
+ Iterator<IControlHolder> controlHolders) {
+
+ this(booleanHolder, CollectionTools.collection(controlHolders), false);
+ }
+
+ /**
+ * Creates a new <code>ControlEnabler</code>.
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param controlHolders An iterator on the collection of controlHolders whose
+ * "enabled" state is kept in sync with the boolean holder's value
+ * @param defaultValue The value to use when the underlying model is
+ * <code>null</code>
+ */
+ AbstractControlEnabler(PropertyValueModel<Boolean> booleanHolder,
+ Iterator<IControlHolder> controlHolders,
+ boolean defaultValue) {
+
+ this();
+ initialize(booleanHolder, CollectionTools.collection(controlHolders), defaultValue);
+ }
+
+ /**
+ * Returns the boolean primitive of the given <code>Boolean</code> value but
+ * also checks for <code>null</code>, if that is the case, then
+ * {@link #defaultValue} is returned.
+ *
+ * @param value The <code>Boolean</code> value to be returned as a primitive
+ * @return The primitive of the given value or {@link #defaultValue}when the
+ * value is <code>null</code>
+ */
+ protected boolean booleanValue(Boolean value) {
+ return (value == null) ? this.defaultValue : value;
+ }
+
+ /**
+ * Creates a listener for the boolean holder.
+ *
+ * @return A new <code>PropertyChangeListener</code>
+ */
+ private PropertyChangeListener buildBooleanChangeListener() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent event) {
+ updateEnableState(booleanValue(booleanHolder.value()));
+ }
+
+ @Override
+ public String toString() {
+ return "boolean change listener";
+ }
+ };
+ }
+
+ /**
+ * Returns an <code>Iterator</code> over the collection of
+ * <code>IControlHolder</code>s.
+ *
+ * @return The iteration of controlHolders
+ */
+ final Iterator<IControlHolder> controlHolders() {
+ return this.controlHolders.iterator();
+ }
+
+ /**
+ * Initializes this <code>ControlEnabler</code> by building the
+ * appropriate listeners.
+ */
+ protected void initialize() {
+ this.booleanChangeListener = this.buildBooleanChangeListener();
+ }
+
+ /**
+ * Initializes this <code>ControlEnabler</code> with the given state.
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param controlHolders A <code>IControlHolder</code>s whose enablement state
+ * is kept in sync with the boolean holder's value
+ * @param defaultValue The value to use when the underlying model is
+ * <code>null</code>
+ */
+ protected void initialize(PropertyValueModel<Boolean> booleanHolder,
+ Collection<IControlHolder> controlHolders,
+ boolean defaultValue) {
+
+ Assert.isNotNull(booleanHolder, "The holder of the boolean value cannot be null");
+ Assert.isNotNull(controlHolders, "The collection of ControlHolders cannot be null");
+
+ this.controlHolders = new ArrayList<IControlHolder>(controlHolders);
+ this.defaultValue = defaultValue;
+ this.booleanHolder = booleanHolder;
+ this.booleanHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.booleanChangeListener);
+ this.updateEnableState();
+ }
+
+ /**
+ * Updates the enablement state of the controlHolders.
+ */
+ protected void updateEnableState() {
+ this.updateEnableState(booleanValue(booleanHolder.value()));
+ }
+
+ /**
+ * Updates the enable state of the <code>IControlHolder</code>s.
+ *
+ * @param enabledState The new enable state the widgets need to have
+ */
+ protected void updateEnableState(boolean enabled) {
+ for (IControlHolder controlHolder : this.controlHolders) {
+ controlHolder.setEnabled(enabled);
+ }
+ }
+
+ /**
+ * This holder of the actual widget.
+ */
+ static interface IControlHolder {
+ void setEnabled(boolean enabled);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/ControlAligner.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/ControlAligner.java
new file mode 100644
index 0000000000..89565f4d58
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/ControlAligner.java
@@ -0,0 +1,912 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import org.eclipse.jpt.utility.internal.ClassTools;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+
+/**
+ * This class is responsible to set a preferred width on the registered widgets
+ * (either <code>Control</code> or <code>ControlAligner</code>) based on the
+ * widest widget.
+ * <p>
+ * Important: The layout data has to be a <code>GridData</code>. If none is set,
+ * then a new <code>GridData</code> is automatically created.
+ * <p>
+ * Here an example of the result if this aligner is used to align controls
+ * within either one or two group boxes, the controls added are the labels in
+ * this case.
+ * <pre>
+ * -Group Box 1------------------------------
+ * | ------------------ |
+ * | Name: | I | |
+ * | ------------------ |
+ * | --------- |
+ * | Preallocation Size: | |I| |
+ * | --------- |
+ * | ------------------ |
+ * | Descriptor: | |v| |
+ * | ------------------ |
+ * ------------------------------------------
+ * -Group Box 2------------------------------
+ * | ------------------ |
+ * | Mapping Type: | |V| |
+ * | ------------------ |
+ * | ------------------ |
+ * | Check in Script: |I | |
+ * | ------------------ |
+ * ------------------------------------------</pre>
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public final class ControlAligner
+{
+ /**
+ * <code>true</code> if the length of every control needs to be updated
+ * when control are added or removed; <code>false</code> to add or remove
+ * the control and then at the end invoke {@link #revalidateSize()}.
+ */
+ private boolean autoValidate;
+
+ /**
+ * The utility class used to support bound properties.
+ */
+ private Collection<ControlListener> changeSupport;
+
+ /**
+ * The listener added to each of the controls that listens only to a text
+ * change.
+ */
+ private ControlListener controlListener;
+
+ /**
+ * Prevents infinite recursion when recalculating the preferred width.
+ * This happens in an hierarchy of <code>ControlAligner</code>s. The lock
+ * has to be placed here and not in the {@link ControlAlignerWrapper}.
+ */
+ private boolean locked;
+
+ /**
+ * The length of the widest control. If the length was not calculated, then
+ * this value is -1.
+ */
+ private int maximumWidth;
+
+ /**
+ * The collection of {@link Wrapper}s encapsulating either <code>Control</code>s
+ * or {@link ControlAligner}s.
+ */
+ private Collection<Wrapper> wrappers;
+
+ /**
+ * A null-<code>Point</code> object used to clear the preferred size.
+ */
+ private static final Point DEFAULT_SIZE = new Point(SWT.DEFAULT, SWT.DEFAULT);
+
+ /**
+ * Creates a new <code>ControlAligner</code>.
+ */
+ public ControlAligner()
+ {
+ super();
+ initialize();
+ }
+
+ /**
+ * Creates a new <code>ControlAligner</code>.
+ *
+ * @param items The collection of <code>Component</code>s
+ */
+ public ControlAligner(Collection<? extends Control> components)
+ {
+ this();
+ addAllComponents(components);
+ }
+
+ /**
+ * Adds the given control. Its preferred width will be used along with the
+ * width of all the other controls in order to get the widest control and
+ * use its width as the width for all the controls.
+ *
+ * @param control The control to be added
+ */
+ public void add(Control control)
+ {
+ Wrapper wrapper = buildWrapper(control);
+ wrapper.addControlListener(controlListener);
+ wrappers.add(wrapper);
+
+ revalidate();
+ }
+
+ /**
+ * Adds the given control. Its preferred width will be used along with the
+ * width of all the other controls in order to get the widest control and
+ * use its width as the width for all the controls.
+ *
+ * @param controlAligner The <code>ControlAligner</code> to be added
+ * @exception IllegalArgumentException Can't add the ControlAligner to itself
+ */
+ public void add(ControlAligner controlAligner)
+ {
+ if (controlAligner == this)
+ {
+ throw new IllegalArgumentException("Can't add the ControlAligner to itself");
+ }
+
+ Wrapper wrapper = buildWrapper(controlAligner);
+ wrapper.addControlListener(controlListener);
+ wrappers.add(wrapper);
+
+ if (!controlAligner.wrappers.isEmpty())
+ {
+ revalidate();
+ }
+ }
+
+ /**
+ * Adds the items contained in the given collection into this
+ * <code>ControlAligner</code>. The preferred width of each item will be
+ * used along with the width of all the other items in order to get the
+ * widest control and use its width as the width for all the controls.
+ *
+ * @param items The collection of <code>Control</code>s
+ */
+ public void addAll(Collection<? extends Control> items)
+ {
+ // Deactivate the auto validation while adding all the Controls
+ // in order to improve performance
+ boolean oldAutoValidate = autoValidate;
+ autoValidate = false;
+
+ for (Control item : items)
+ {
+ add(item);
+ }
+
+ autoValidate = oldAutoValidate;
+ revalidate();
+ }
+
+ /**
+ * Adds the items contained in the given collection into this
+ * <code>ControlAligner</code>. The preferred width of each item will be
+ * used along with the width of all the other items in order to get the
+ * widest component and use its width as the width for all the components.
+ *
+ * @param items The collection of <code>ControlAligner</code>s
+ */
+ public void addAllComponentAligners(Collection<ControlAligner> aligners)
+ {
+ // Deactivate the auto validation while adding all the JComponents and/or
+ // ComponentAligners in order to improve performance
+ boolean oldAutoValidate = autoValidate;
+ autoValidate = false;
+
+ for (ControlAligner aligner : aligners)
+ {
+ add(aligner);
+ }
+
+ autoValidate = oldAutoValidate;
+ revalidate();
+ }
+
+ /**
+ * Adds the items contained in the given collection into this
+ * <code>ControlAligner</code>. The preferred width of each item will be
+ * used along with the width of all the other items in order to get the
+ * widest component and use its width as the width for all the components.
+ *
+ * @param items The collection of <code>Control</code>s
+ */
+ public void addAllComponents(Collection<? extends Control> components)
+ {
+ // Deactivate the auto validation while adding all the JComponents and/or
+ // ComponentAligners in order to improve performance
+ boolean oldAutoValidate = autoValidate;
+ autoValidate = false;
+
+ for (Control component : components)
+ {
+ add(component);
+ }
+
+ autoValidate = oldAutoValidate;
+ revalidate();
+ }
+
+ /**
+ * Adds the given <code>ControListener</code>.
+ *
+ * @param listener The <code>ControlListener</code> to be added
+ */
+ private void addControlListener(ControlListener listener)
+ {
+ if (changeSupport == null)
+ {
+ changeSupport = new ArrayList<ControlListener>();
+ }
+
+ changeSupport.add(listener);
+ }
+
+ /**
+ * Creates a new <code>Wrapper</code> that encapsulates the given source.
+ *
+ * @param control The control to be wrapped
+ * @return A new {@link Wrapper}
+ */
+ private Wrapper buildWrapper(Control control)
+ {
+ return new ControlWrapper(control);
+ }
+
+ /**
+ * Creates a new <code>Wrapper</code> that encapsulates the given source.
+ *
+ * @param ControlAligner The <code>ControlAligner</code> to be wrapped
+ * @return A new {@link ControlAlignerWrapper}
+ */
+ private Wrapper buildWrapper(ControlAligner ControlAligner)
+ {
+ return new ControlAlignerWrapper(ControlAligner);
+ }
+
+ /**
+ * Reports a bound property change.
+ *
+ * @param oldValue the old value of the property (as an int)
+ * @param newValue the new value of the property (as an int)
+ */
+ private void controlResized(int oldValue, int newValue)
+ {
+ if ((changeSupport != null) && (oldValue != newValue))
+ {
+ // Set a dummy widget otherwise EventObject will
+ // throw a NPE for its source
+ Event event = new Event();
+ event.widget = SWTUtil.getShell();
+
+ ControlEvent controlEvent = new ControlEvent(event);
+
+ // It seems we need to use reflection so the source can properly be set
+ ClassTools.setFieldValue(controlEvent, "source", this);
+
+ for (ControlListener listener : changeSupport)
+ {
+ listener.controlResized(controlEvent);
+ }
+ }
+ }
+
+ /**
+ * Returns the length of the widest control. If the length was not
+ * calculated, then this value is -1.
+ *
+ * @return The width of the widest control or -1 if the length has not
+ * been calculated yet
+ */
+ public int getMaximumWidth()
+ {
+ return maximumWidth;
+ }
+
+ /**
+ * Returns the size by determining which control has the greatest
+ * width.
+ *
+ * @return The size of this <code>ControlAligner</code>, which is
+ * {@link #getMaximumWidth()} for the width
+ */
+ private Point getPreferredSize()
+ {
+ if (maximumWidth == -1)
+ {
+ recalculateWidth();
+ }
+
+ return new Point(maximumWidth, 0);
+ }
+
+ /**
+ * Initializes this <code>ControlAligner</code>.
+ */
+ private void initialize()
+ {
+ this.autoValidate = true;
+ this.maximumWidth = -1;
+ this.controlListener = new ControlHandler();
+ this.wrappers = new ArrayList<Wrapper>();
+ }
+
+ /**
+ * Invalidates the size of the given object.
+ *
+ * @param source The source object to be invalidated
+ */
+ private void invalidate(Object source)
+ {
+ Wrapper wrapper = retrieveWrapper(source);
+
+ if (wrapper.isLocked())
+ {
+ return;
+ }
+
+ Point size = wrapper.getCachedSize();
+ size.x = 0;
+ size.y = 0;
+
+ wrapper.setPreferredSize(DEFAULT_SIZE);
+ }
+
+ /**
+ * Determines whether the length of each control should be set each time a
+ * control is added or removed. If the control's text is changed and
+ * {@link #isAutoValidate()} returns <code>true</code> then the length of
+ * each control is automatically updated. When <code>false</code> is returned,
+ * {@link #revalidateSize()}has to be called manually.
+ *
+ * @return <code>true</code> to recalculate the length of every control
+ * when a control is either added or removed; <code>false</code> to allow
+ * all the controls to be either added or removed before invoking
+ * {@link #revalidateSize()}
+ */
+ public boolean isAutoValidate()
+ {
+ return autoValidate;
+ }
+
+ /**
+ * Determines whether the wrapped component is visible or not, which will
+ * determine if its preferred width will be included in the calculation of
+ * this <code>ComponentAligner</code>'s minimum width.
+ *
+ * @return <code>true</code> if the source is visible; <code>false</code>
+ * otherwise
+ */
+ private boolean isVisible()
+ {
+ boolean visible = true;
+
+ for (Wrapper wrapper : wrappers)
+ {
+ visible &= wrapper.isVisible();
+ }
+
+ return visible;
+ }
+
+ /**
+ * Updates the maximum length based on the widest control. This methods
+ * does not update the width of the controls.
+ */
+ private void recalculateWidth()
+ {
+ int width = -1;
+
+ for (Wrapper wrapper : wrappers)
+ {
+ Point size = wrapper.getCachedSize();
+
+ // The size has not been calculated yet
+ if ((size.y == 0) && wrapper.isVisible())
+ {
+ Point newSize = wrapper.getPreferredSize();
+
+ size.x = newSize.x;
+ size.y = newSize.y;
+ }
+
+ // Only keep the greatest width
+ width = Math.max(size.x, width);
+ }
+
+ locked = true;
+ setMaximumWidth(width);
+ locked = false;
+ }
+
+ /**
+ * Removes the given control. Its preferred width will not be used when
+ * calculating the widest control.
+ *
+ * @param control The control to be removed
+ */
+ public void remove(Control control)
+ {
+ Wrapper wrapper = retrieveWrapper(control);
+ wrapper.removeControlListener(controlListener);
+ wrappers.remove(wrapper);
+
+// if (control.isPreferredSizeSet())
+// {
+// control.setPreferredSize(null);
+// }
+
+ revalidate();
+ }
+
+ /**
+ * Removes the given <code>ControlAligner</code>. Its preferred width
+ * will not be used when calculating the widest control.
+ *
+ * @param controlAligner The <code>ControlAligner</code> to be removed
+ */
+ public void remove(ControlAligner controlAligner)
+ {
+ Wrapper wrapper = retrieveWrapper(controlAligner);
+ wrapper.removeControlListener(controlListener);
+ wrappers.remove(wrapper);
+
+ revalidate();
+ }
+
+ /**
+ * Removes the given <code>ControlListener</code>.
+ *
+ * @param listener The <code>ControlListener</code> to be removed
+ */
+ private void removeControlListener(ControlListener listener)
+ {
+ changeSupport.remove(listener);
+
+ if (changeSupport.isEmpty())
+ {
+ changeSupport = null;
+ }
+ }
+
+ /**
+ * Retrieves the <code>Wrapper</code> that is encapsulating the given object.
+ *
+ * @param source Either a <code>Control</code> or a <code>ControlAligner</code>
+ * @return Its <code>Wrapper</code>
+ */
+ private Wrapper retrieveWrapper(Object source)
+ {
+ for (Wrapper wrapper : wrappers)
+ {
+ if (wrapper.getSource() == source)
+ {
+ return wrapper;
+ }
+ }
+
+ throw new IllegalArgumentException("Can't retrieve the Wrapper for " + source);
+ }
+
+ /**
+ * If the count of control is greater than one and {@link #isAutoValidate()}
+ * returns <code>true</code>, then the size of all the registered
+ * <code>Control</code>s will be udpated.
+ */
+ private void revalidate()
+ {
+ if (autoValidate)
+ {
+ recalculateWidth();
+ revalidatePreferredSizeImp();
+ }
+ }
+
+ /**
+ * Updates the preferred size of every component based on the widest
+ * component.
+ */
+ private void revalidatePreferredSizeImp()
+ {
+ for (Wrapper wrapper : wrappers)
+ {
+ Point size = wrapper.getCachedSize();
+ size = new Point(maximumWidth, size.y);
+ wrapper.setPreferredSize(size);
+ }
+ }
+
+ /**
+ * Updates the size of every control based on the widest control.
+ */
+ public void revalidateSize()
+ {
+ recalculateWidth();
+ revalidateSizeImp();
+ }
+
+ /**
+ * Updates the size of every control based on the widest control.
+ */
+ private void revalidateSizeImp()
+ {
+ // Set the preferred width for every control
+ for (Wrapper wrapper : wrappers)
+ {
+ Point size = wrapper.getCachedSize();
+ size = new Point(maximumWidth, size.y);
+ wrapper.setPreferredSize(size);
+ }
+ }
+
+ /**
+ * Sets the length of the widest control. If the length was not calulcated,
+ * then this value is -1.
+ *
+ * @param maximumWidth The width of the widest control
+ */
+ private void setMaximumWidth(int maximumWidth)
+ {
+ int oldMaximumWidth = getMaximumWidth();
+ this.maximumWidth = maximumWidth;
+ controlResized(oldMaximumWidth, maximumWidth);
+ }
+
+ /**
+ * Returns a string representation of this <code>ControlAligner</code>.
+ *
+ * @return Information about this object
+ */
+ @Override
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ StringTools.buildToStringFor(this, sb);
+ sb.append("autoValidate=");
+ sb.append(autoValidate);
+ sb.append(", maximumWidth=");
+ sb.append(maximumWidth);
+ sb.append(", wrappers=");
+ sb.append(wrappers);
+ return sb.toString();
+ }
+
+ /**
+ * This <code>Wrapper</code> encapsulates a {@link ControlAligner}.
+ */
+ private class ControlAlignerWrapper implements Wrapper
+ {
+ /**
+ * The cached size, which is {@link ControlAligner#maximumWidth}.
+ */
+ private Point cachedSize;
+
+ /**
+ * The <code>ControlAligner</code> encapsulated by this
+ * <code>Wrapper</code>.
+ */
+ private final ControlAligner controlAligner;
+
+ /**
+ * Creates a new <code>ControlAlignerWrapper</code> that encapsulates
+ * the given <code>ControlAligner</code>.
+ *
+ * @param controlAligner The <code>ControlAligner</code> to be
+ * encapsulated by this <code>Wrapper</code>
+ */
+ private ControlAlignerWrapper(ControlAligner controlAligner)
+ {
+ super();
+
+ this.controlAligner = controlAligner;
+ cachedSize = new Point(controlAligner.maximumWidth, 0);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public void addControlListener(ControlListener listener)
+ {
+ controlAligner.addControlListener(listener);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public Point getCachedSize()
+ {
+ return cachedSize;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public Point getPreferredSize()
+ {
+ return controlAligner.getPreferredSize();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public Object getSource()
+ {
+ return controlAligner;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public boolean isLocked()
+ {
+ return controlAligner.locked;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public boolean isVisible()
+ {
+ return controlAligner.isVisible();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public void removeControlListener(ControlListener listener)
+ {
+ controlAligner.removeControlListener(listener);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public void setPreferredSize(Point size)
+ {
+ if (size == DEFAULT_SIZE)
+ {
+ controlAligner.maximumWidth = -1;
+ }
+ else if (controlAligner.maximumWidth != size.x)
+ {
+ controlAligner.maximumWidth = size.x;
+ controlAligner.revalidateSizeImp();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ StringTools.buildToStringFor(this, sb);
+ sb.append("cachedSize=");
+ sb.append(cachedSize);
+ sb.append(", controlAligner=");
+ sb.append(controlAligner);
+ return sb.toString();
+ }
+ }
+
+ /**
+ * The listener added to each of the control that listens only to a text
+ * change.
+ */
+ private class ControlHandler implements ControlListener
+ {
+ /*
+ * (non-Javadoc)
+ */
+ public void controlMoved(ControlEvent e)
+ {
+ // Nothing to do
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public void controlResized(ControlEvent e)
+ {
+ invalidate(e.getSource());
+ revalidate();
+ }
+ }
+
+ /**
+ * This <code>Wrapper</code> encapsulates a {@link Control}.
+ */
+ private class ControlWrapper implements Wrapper
+ {
+ /**
+ * The cached size, which is control's size.
+ */
+ private Point cachedSize;
+
+ /**
+ * The control to be encapsulated by this <code>Wrapper</code>.
+ */
+ private final Control control;
+
+ /**
+ * Creates a new <code>controlWrapper</code> that encapsulates the given
+ * control.
+ *
+ * @param control The control to be encapsulated by this <code>Wrapper</code>
+ */
+ private ControlWrapper(Control control)
+ {
+ super();
+
+ this.control = control;
+ cachedSize = new Point(0, 0);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public void addControlListener(ControlListener listener)
+ {
+ control.addControlListener(listener);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public Point getCachedSize()
+ {
+ return cachedSize;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public Point getPreferredSize()
+ {
+ return control.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public Object getSource()
+ {
+ return control;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public boolean isLocked()
+ {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public boolean isVisible()
+ {
+ return control.isVisible();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public void removeControlListener(ControlListener listener)
+ {
+ control.removeControlListener(listener);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public void setPreferredSize(Point size)
+ {
+ GridData data = (GridData) control.getLayoutData();
+
+ if (data == null)
+ {
+ data = new GridData();
+ data.horizontalAlignment = SWT.FILL;
+ control.setLayoutData(data);
+ }
+
+ data.widthHint = size.x;
+ data.heightHint = size.y;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ StringTools.buildToStringFor(this, sb);
+ sb.append("cachedSize=");
+ sb.append(cachedSize);
+ sb.append(", control=");
+ sb.append(control);
+ return sb.toString();
+ }
+ }
+
+ /**
+ * This <code>Wrapper</code> helps to encapsulate heterogeneous objects and
+ * apply the same behavior on them.
+ */
+ private interface Wrapper
+ {
+ /**
+ * Adds a <code>IPropertyChangeListener</code> for a specific property.
+ * The listener will be invoked only when a call on
+ * <code>firePropertyChange</code> names that specific property.
+ *
+ * @param listener The <code>ControlListener</code> to be added
+ */
+ public void addControlListener(ControlListener listener);
+
+ /**
+ * Returns the cached size of the encapsulated source.
+ *
+ * @return A non-<code>null</code> size
+ */
+ public Point getCachedSize();
+
+ /**
+ * Returns the preferred size of the wrapped source.
+ *
+ * @return The preferred size
+ */
+ public Point getPreferredSize();
+
+ /**
+ * Returns the encapsulated object.
+ *
+ * @return The object that is been wrapped
+ */
+ public Object getSource();
+
+ /**
+ * Prevents infinite recursion when recalculating the preferred width.
+ * This happens in an hierarchy of <code>ControlAligner</code>s.
+ *
+ * @return <code>true</code> to prevent this <code>Wrapper</code> from
+ * being invalidated; otherwise <code>false</code>
+ */
+ public boolean isLocked();
+
+ /**
+ * Determines whether the wrapped component is visible or not, which will
+ * determine if its preferred width will be included in the calculation of
+ * this <code>ComponentAligner</code>'s minimum width.
+ *
+ * @return <code>true</code> if the source is visible; <code>false</code>
+ * otherwise
+ */
+ boolean isVisible();
+
+ /**
+ * Removes the given <code>ControlListener</code>.
+ *
+ * @param listener The <code>ControlListener</code> to be removed
+ */
+ public void removeControlListener(ControlListener listener);
+
+ /**
+ * Sets the size on the encapsulated source.
+ *
+ * @param size The new size
+ */
+ public void setPreferredSize(Point size);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/ControlEnabler.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/ControlEnabler.java
new file mode 100644
index 0000000000..29465b0394
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/ControlEnabler.java
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.util;
+
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * This <code>ControlEnabler</code> keeps the "enabled" state of a collection of
+ * controls in synch with the provided boolean holder.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class ControlEnabler extends AbstractControlEnabler
+{
+ /**
+ * Creates a new <code>ControlEnabler</code> with a default value of
+ * <code>false</code> (i.e. disabled).
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param controls The collection of controls whose "enabled" state is
+ * kept in sync with the boolean holder's value
+ */
+ public ControlEnabler(PropertyValueModel<Boolean> booleanHolder,
+ Collection<? extends Control> controls) {
+
+ this(booleanHolder, controls, false);
+ }
+
+ /**
+ * Creates a new <code>ControlEnabler</code>.
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param controls The collection of controls whose "enabled" state is
+ * kept in sync with the boolean holder's value
+ * @param defaultValue The value to use when the underlying model is
+ * <code>null</code>
+ */
+ public ControlEnabler(PropertyValueModel<Boolean> booleanHolder,
+ Collection<? extends Control> controls,
+ boolean defaultValue) {
+
+ this(booleanHolder, controls.iterator(), defaultValue);
+ }
+
+ /**
+ * Creates a new <code>ControlEnabler</code> with a default value of
+ * <code>false</code> (i.e. disabled).
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param control The control whose "enabled" state is
+ * kept in sync with the boolean holder's value
+ */
+ public ControlEnabler(PropertyValueModel<Boolean> booleanHolder,
+ Control control) {
+
+ this(booleanHolder, control, false);
+ }
+
+ /**
+ * Creates a new <code>ControlEnabler</code> with a default value of
+ * <code>false</code> (i.e. disabled).
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param controls The collection of controls whose "enabled" state is
+ * kept in sync with the boolean holder's value
+ */
+ public ControlEnabler(PropertyValueModel<Boolean> booleanHolder,
+ Control... controls) {
+
+ this(booleanHolder, CollectionTools.iterator(controls), false);
+ }
+
+ /**
+ * Creates a new <code>ControlEnabler</code>.
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param control The control whose "enabled" state is
+ * kept in sync with the boolean holder's value
+ * @param defaultValue The value to use when the underlying model is
+ * <code>null</code>
+ */
+ public ControlEnabler(PropertyValueModel<Boolean> booleanHolder,
+ Control control,
+ boolean defaultValue) {
+
+ this(booleanHolder, CollectionTools.singletonIterator(control), false);
+ }
+
+ /**
+ * Creates a new <code>ControlEnabler</code>.
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param controls The collection of controls whose "enabled" state is
+ * kept in sync with the boolean holder's value
+ * @param defaultValue The value to use when the underlying model is
+ * <code>null</code>
+ */
+ public ControlEnabler(PropertyValueModel<Boolean> booleanHolder,
+ Control[] controls,
+ boolean defaultValue) {
+
+ this(booleanHolder, CollectionTools.iterator(controls), defaultValue);
+ }
+
+ /**
+ * Creates a new <code>ControlEnabler</code> with a default value of
+ * <code>false</code> (i.e. disabled).
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param controls An iterator on the collection of controls whose
+ * "enabled" state is kept in sync with the boolean holder's value
+ */
+ public ControlEnabler(PropertyValueModel<Boolean> booleanHolder,
+ Iterator<? extends Control> controls) {
+
+ this(booleanHolder, controls, false);
+ }
+
+ /**
+ * Creates a new <code>ControlEnabler</code>.
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param controls An iterator on the collection of controls whose
+ * "enabled" state is kept in sync with the boolean holder's value
+ * @param defaultValue The value to use when the underlying model is
+ * <code>null</code>
+ */
+ public ControlEnabler(PropertyValueModel<Boolean> booleanHolder,
+ Iterator<? extends Control> controls,
+ boolean defaultValue) {
+
+ super(booleanHolder, wrap(controls), defaultValue);
+ }
+
+ private static Collection<IControlHolder> wrap(Iterator<? extends Control> controls) {
+ return CollectionTools.collection(new TransformationIterator<Control, IControlHolder>(controls) {
+ @Override
+ protected IControlHolder transform(Control control) {
+ return new ControlHolder(control);
+ }
+ });
+ }
+
+ private static class ControlHolder implements IControlHolder {
+ private final Control control;
+
+ ControlHolder(Control control) {
+ super();
+ this.control = control;
+ }
+
+ public void setEnabled(boolean enabled) {
+ if (!this.control.isDisposed()) {
+ this.control.setEnabled(enabled);
+ }
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledButton.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledButton.java
new file mode 100644
index 0000000000..ca87b1f9be
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledButton.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.util;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Button;
+
+/**
+ * A default implementation of <code>LabeledControl</code> that updates a
+ * <code>Button</code> when required.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public final class LabeledButton implements LabeledControl
+{
+ /**
+ * The button to be updated with a different icon and text.
+ */
+ private final Button button;
+
+ /**
+ * Creates a new <code>LabeledButton</code>.
+ *
+ * @param button The button that will have its text and icon updated when
+ * required
+ */
+ public LabeledButton(Button button) {
+ super();
+ Assert.isNotNull(button, "The button cannot be null");
+ this.button = button;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public void setIcon(Image image) {
+ this.button.setImage(image);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public void setText(String text) {
+ this.button.setText(text);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledControl.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledControl.java
new file mode 100644
index 0000000000..508872b76a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledControl.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.util;
+
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * This <code>LabeledControl</code> is used to encapsulate a widget and update
+ * its properties (icon and text).
+ *
+ * @see LabeledButton
+ * @see LabeledLabel
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public interface LabeledControl {
+ /**
+ * Passes the image so the wrapped component can receive it.
+ *
+ * @param image The new <code>Image</code>
+ */
+ void setIcon(Image image);
+
+ /**
+ * Passes the text so the wrapped component can receive it.
+ *
+ * @param text The new text
+ */
+ void setText(String text);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledControlUpdater.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledControlUpdater.java
new file mode 100644
index 0000000000..1958bcdc44
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledControlUpdater.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.util;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jpt.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * This updater is responsible to update the <code>LabeledControl</code> when
+ * the text and the icon need to change.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public final class LabeledControlUpdater {
+
+ /**
+ * The wrapper around a control that has text and icon.
+ */
+ private LabeledControl labeledControl;
+
+ /**
+ * Creates a new <code>LabeledControlUpdater</code>.
+ *
+ * @param labeledControl The wrapper around the control that needs to
+ * have its text updated
+ * @param textHolder The holder this class will listen for changes
+ */
+ public LabeledControlUpdater(LabeledControl labeledControl,
+ PropertyValueModel<String> textHolder)
+ {
+ this(labeledControl, textHolder, null);
+ }
+
+ /**
+ * Creates a new <code>LabeledControlUpdater</code>.
+ *
+ * @param labeledControl The wrapper around the control that needs to
+ * have its image and text updated
+ * @param imageHolder The holder this class will listen for changes
+ * @param textHolder The holder this class will listen for changes
+ */
+ public LabeledControlUpdater(LabeledControl labeledControl,
+ PropertyValueModel<String> textHolder,
+ PropertyValueModel<Image> imageHolder)
+ {
+ super();
+ initialize(labeledControl, imageHolder, textHolder);
+ }
+
+ private PropertyChangeListener buildIconListener() {
+ return new SWTPropertyChangeListenerWrapper(buildIconListener_());
+ }
+
+ private PropertyChangeListener buildIconListener_() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent e) {
+ LabeledControlUpdater.this.setImage((Image) e.newValue());
+ }
+
+ @Override
+ public String toString() {
+ return "LabeledControlUpdater.imageListener";
+ }
+ };
+ }
+
+ private PropertyChangeListener buildTextListener() {
+ return new SWTPropertyChangeListenerWrapper(buildTextListener_());
+ }
+
+ private PropertyChangeListener buildTextListener_() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent e) {
+ LabeledControlUpdater.this.setText((String) e.newValue());
+ }
+
+ @Override
+ public String toString() {
+ return "LabeledControlUpdater.textListener";
+ }
+ };
+ }
+
+ private void initialize(LabeledControl labeledControl,
+ PropertyValueModel<Image> imageHolder,
+ PropertyValueModel<String> textHolder)
+ {
+ Assert.isNotNull(labeledControl, "The LabeledControl cannot be null");
+ Assert.isNotNull(textHolder, "The text holder cannot be null");
+
+ this.labeledControl = labeledControl;
+
+ textHolder.addPropertyChangeListener(PropertyValueModel.VALUE, buildTextListener());
+ setText(textHolder.value());
+
+ if (imageHolder != null) {
+ imageHolder.addPropertyChangeListener(PropertyValueModel.VALUE, buildIconListener());
+ setImage(imageHolder.value());
+ }
+ }
+
+ private void setImage(Image icon) {
+ labeledControl.setIcon(icon);
+ }
+
+ private void setText(String text) {
+ labeledControl.setText(text);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledLabel.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledLabel.java
new file mode 100644
index 0000000000..a1230ae71c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledLabel.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.util;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * A default implementation of <code>LabeledControl</code> that updates an
+ * <code>Label</code> when required.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public final class LabeledLabel implements LabeledControl
+{
+ /**
+ * The label to be updated with a different icon and text.
+ */
+ private final Label label;
+
+ /**
+ * Creates a new <code>LabeledButton</code>.
+ *
+ * @param label The label that will have its text and icon updated when
+ * required
+ */
+ public LabeledLabel(Label label) {
+ super();
+ Assert.isNotNull(label, "The label cannot be null");
+ this.label = label;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public void setIcon(Image image) {
+ this.label.setImage(image);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public void setText(String text) {
+ this.label.setText(text);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledTableItem.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledTableItem.java
new file mode 100644
index 0000000000..fae134f714
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/LabeledTableItem.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.util;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+
+/**
+ * A default implementation of <code>LabeledControl</code> that updates a
+ * <code>TableItem</code> when required.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public final class LabeledTableItem implements LabeledControl
+{
+ /**
+ * The table cell to be updated with a different icon and text.
+ */
+ private TableItem tableItem;
+
+ /**
+ * Creates a new <code>LabeledTableItem</code>.
+ *
+ * @param tableItem The <code>TableItem</code> that will have its text and
+ * icon updated when required
+ */
+ public LabeledTableItem(TableItem tableItem) {
+ super();
+
+ Assert.isNotNull(tableItem, "The TableItem cannot be null");
+ this.tableItem = tableItem;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public void setIcon(final Image image) {
+
+ if (tableItem.isDisposed()) {
+ return;
+ }
+
+ updateTableItem(tableItem.getText(), image);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public void setText(final String text) {
+
+ if (tableItem.isDisposed()) {
+ return;
+ }
+
+ updateTableItem(text, tableItem.getImage());
+ }
+
+ private void updateTableItem(String text, Image image) {
+
+ if (text == null) {
+ text = "";
+ }
+
+ Table table = tableItem.getParent();
+ table.setRedraw(false);
+
+ boolean checked = tableItem.getChecked();
+ boolean grayed = tableItem.getGrayed();
+ boolean hasFocus = table.isFocusControl();
+
+ int index = table.indexOf(tableItem);
+ table.remove(index);
+
+ tableItem = new TableItem(table, SWT.CHECK, index);
+ tableItem.setText(text);
+ tableItem.setImage(image);
+ tableItem.setChecked(checked);
+ tableItem.setGrayed(grayed);
+
+ table.layout(true, true);
+ table.getParent().getParent().layout(true, true);
+ table.setRedraw(true);
+
+ if (hasFocus) {
+ table.forceFocus();
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/PaneEnabler.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/PaneEnabler.java
new file mode 100644
index 0000000000..d30451fb20
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/PaneEnabler.java
@@ -0,0 +1,168 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.util;
+
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.jpt.ui.internal.widgets.AbstractPane;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+
+/**
+ * This <code>PaneEnabler</code> keeps the "enabled" state of a collection of
+ * controls in synch with the provided boolean holder.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class PaneEnabler extends AbstractControlEnabler
+{
+ /**
+ * Creates a new <code>PaneEnabler</code> with a default value of
+ * <code>false</code> (i.e. disabled).
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param pane The pane whose "enabled" state is kept in sync with the
+ * boolean holder's value
+ */
+ public PaneEnabler(PropertyValueModel<Boolean> booleanHolder,
+ AbstractPane<?> pane) {
+
+ this(booleanHolder, pane, false);
+ }
+
+ /**
+ * Creates a new <code>PaneEnabler</code> with a default value of
+ * <code>false</code> (i.e. disabled).
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param panes The collection of panes whose "enabled" state is kept in sync
+ * with the boolean holder's value
+ */
+ public PaneEnabler(PropertyValueModel<Boolean> booleanHolder,
+ AbstractPane<?>... panes) {
+
+ this(booleanHolder, CollectionTools.collection(panes), false);
+ }
+
+ /**
+ * Creates a new <code>PaneEnabler</code>.
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param pane The pane whose "enabled" state is kept in sync with the
+ * boolean holder's value
+ * @param defaultValue The value to use when the underlying model is
+ * <code>null</code>
+ */
+ public PaneEnabler(PropertyValueModel<Boolean> booleanHolder,
+ AbstractPane<?> pane,
+ boolean defaultValue) {
+
+ this(booleanHolder, CollectionTools.singletonIterator(pane), false);
+ }
+
+ /**
+ * Creates a new <code>PaneEnabler</code>.
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param panes The collection of panes whose "enabled" state is kept in sync
+ * with the boolean holder's value
+ * @param defaultValue The value to use when the underlying model is
+ * <code>null</code>
+ */
+ public PaneEnabler(PropertyValueModel<Boolean> booleanHolder,
+ AbstractPane<?>[] panes,
+ boolean defaultValue) {
+
+ this(booleanHolder, CollectionTools.iterator(panes), defaultValue);
+ }
+
+ /**
+ * Creates a new <code>BaseJpaControllerEnabler</code> with a default value
+ * of* <code>false</code> (i.e. disabled).
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param panes The collection of panes whose "enabled" state is kept in sync
+ * with the boolean holder's value
+ */
+ public PaneEnabler(PropertyValueModel<Boolean> booleanHolder,
+ Collection<? extends AbstractPane<?>> panes) {
+
+ this(booleanHolder, panes, false);
+ }
+
+ /**
+ * Creates a new <code>BaseJpaControllerEnabler</code>.
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param panes The collection of panes whose "enabled" state is kept in sync
+ * with the boolean holder's value
+ * @param defaultValue The value to use when the underlying model is
+ * <code>null</code>
+ */
+ public PaneEnabler(PropertyValueModel<Boolean> booleanHolder,
+ Collection<? extends AbstractPane<?>> panes,
+ boolean defaultValue) {
+
+ this(booleanHolder, panes.iterator(), defaultValue);
+ }
+
+ /**
+ * Creates a new <code>BaseJpaControllerEnabler</code> with a default value of
+ * <code>false</code> (i.e. disabled).
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param panes An iterator on the collection of panes whose "enabled" state
+ * is kept in sync with the boolean holder's value
+ */
+ public PaneEnabler(PropertyValueModel<Boolean> booleanHolder,
+ Iterator<? extends AbstractPane<?>> panes) {
+
+ this(booleanHolder, panes, false);
+ }
+
+ /**
+ * Creates a new <code>BaseJpaControllerEnabler</code>.
+ *
+ * @param booleanHolder A value model on the underlying boolean model
+ * @param panes An iterator on the collection of panes whose "enabled" state
+ * is kept in sync with the boolean holder's value
+ * @param defaultValue The value to use when the underlying model is
+ * <code>null</code>
+ */
+ public PaneEnabler(PropertyValueModel<Boolean> booleanHolder,
+ Iterator<? extends AbstractPane<?>> panes,
+ boolean defaultValue) {
+
+ super(booleanHolder, wrap(panes), defaultValue);
+ }
+
+ private static Collection<IControlHolder> wrap(Iterator<? extends AbstractPane<?>> panes) {
+ return CollectionTools.collection(new TransformationIterator<AbstractPane<?>, IControlHolder>(panes) {
+ @Override
+ protected IControlHolder transform(AbstractPane<?> pane) {
+ return new PaneHolder(pane);
+ }
+ });
+ }
+
+ private static class PaneHolder implements IControlHolder {
+ private final AbstractPane<?> pane;
+
+ PaneHolder(AbstractPane<?> pane) {
+ super();
+ this.pane = pane;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.pane.enableWidgets(enabled);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/SWTUtil.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/SWTUtil.java
index 1f14002888..3585006bdb 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/SWTUtil.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/SWTUtil.java
@@ -1,28 +1,263 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * 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
+ * Copyright (c) 2008 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
+ * Oracle - initial API and implementation
+ ******************************************************************************/
package org.eclipse.jpt.ui.internal.util;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.AssertionFailedException;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jpt.ui.internal.widgets.NullPostExecution;
+import org.eclipse.jpt.ui.internal.widgets.PostExecution;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
-//copied from jdt.internal.ui.util
+/**
+ * A suite of utility methods related to the user interface.
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+@SuppressWarnings("nls")
public class SWTUtil {
- public static int getTableHeightHint(Table table, int rows) {
+ /**
+ * Causes the <code>run()</code> method of the given runnable to be invoked
+ * by the user-interface thread at the next reasonable opportunity. The caller
+ * of this method continues to run in parallel, and is not notified when the
+ * runnable has completed.
+ *
+ * @param runnable Code to run on the user-interface thread
+ * @exception org.eclipse.swt.SWTException
+ * <ul>
+ * <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed</li>
+ * </ul>
+ * @see #syncExec
+ */
+ public static void asyncExec(Runnable runnable) {
+ getStandardDisplay().asyncExec(runnable);
+ }
+
+ /**
+ * Creates the <code>Runnable</code> that will invoke the given
+ * <code>PostExecution</code> in order to its execution to be done in the
+ * UI thread.
+ *
+ * @param dialog The dialog that was just diposed
+ * @param postExecution The post execution once the dialog is disposed
+ * @return The <code>Runnable</code> that will invoke
+ * {@link PostExecution#execute(Dialog)}
+ */
+ @SuppressWarnings("unchecked")
+ private static <D1 extends Dialog, D2 extends D1>
+ Runnable buildPostExecutionRunnable(
+ final D1 dialog,
+ final PostExecution<D2> postExecution) {
+
+ return new Runnable() {
+ public void run() {
+ setUserInterfaceActive(false);
+ try {
+ postExecution.execute((D2) dialog);
+ }
+ finally {
+ setUserInterfaceActive(true);
+ }
+ }
+ };
+ }
+
+ /**
+ * Convenience method for getting the current shell. If the current thread is
+ * not the UI thread, then an invalid thread access exception will be thrown.
+ *
+ * @return The shell, never <code>null</code>
+ */
+ public static Shell getShell() {
+
+ // Retrieve the active shell, which can be the shell from any window
+ Shell shell = getStandardDisplay().getActiveShell();
+
+ // No shell could be found, revert back to the active workbench window
+ if (shell == null) {
+ shell = getWorkbench().getActiveWorkbenchWindow().getShell();
+ }
+
+ // Make sure it's never null
+ if (shell == null) {
+ shell = new Shell(getStandardDisplay().getActiveShell());
+ }
+
+ return shell;
+ }
+
+ /**
+ * Returns the standard display to be used. The method first checks, if the
+ * thread calling this method has an associated display. If so, this display
+ * is returned. Otherwise the method returns the default display.
+ *
+ * @return The current display if not <code>null</code> otherwise the default
+ * display is returned
+ */
+ public static Display getStandardDisplay()
+ {
+ Display display = Display.getCurrent();
+
+ if (display == null) {
+ display = Display.getDefault();
+ }
+
+ return display;
+ }
+
+ public static int getTableHeightHint(Table table, int rows) {
if (table.getFont().equals(JFaceResources.getDefaultFont()))
table.setFont(JFaceResources.getDialogFont());
int result= table.getItemHeight() * rows + table.getHeaderHeight();
if (table.getLinesVisible())
result+= table.getGridLineWidth() * (rows - 1);
- return result;
- }
-}
+ return result;
+ }
+
+ /**
+ * Returns the Platform UI workbench.
+ *
+ * @return The workbench for this plug-in
+ */
+ public static IWorkbench getWorkbench() {
+ return PlatformUI.getWorkbench();
+ }
+
+ /**
+ * Sets whether the entire shell and its widgets should be enabled or
+ * everything should be unaccessible.
+ *
+ * @param active <code>true</code> to make all the UI active otherwise
+ * <code>false</code> to deactivate it
+ */
+ public static void setUserInterfaceActive(boolean active) {
+ Shell[] shells = getStandardDisplay().getShells();
+
+ for (Shell shell : shells) {
+ shell.setEnabled(active);
+ }
+ }
+
+ /**
+ * Asynchronously launches the specified dialog in the UI thread.
+ *
+ * @param dialog The dialog to show on screen
+ */
+ public static void show(Dialog dialog) {
+ show(dialog, NullPostExecution.<Dialog>instance());
+ }
+
+ /**
+ * Asynchronously launches the specified dialog in the UI thread.
+ *
+ * @param dialog The dialog to show on screen
+ * @param postExecution This interface let the caller to invoke a piece of
+ * code once the dialog is disposed
+ */
+ public static <D1 extends Dialog, D2 extends D1>
+ void show(final D1 dialog, final PostExecution<D2> postExecution) {
+
+ try {
+ Assert.isNotNull(dialog, "The dialog cannot be null");
+ Assert.isNotNull(postExecution, "The PostExecution cannot be null");
+ }
+ catch (AssertionFailedException e) {
+ // Make sure the UI is interactive
+ setUserInterfaceActive(true);
+ throw e;
+ }
+
+ new Thread() {
+ @Override
+ public void run() {
+ asyncExec(
+ new Runnable() { public void run() {
+ showImp(dialog, postExecution);
+ }
+ }
+ );
+ }}.start();
+ }
+
+ /**
+ * Asynchronously launches the specified dialog in the UI thread.
+ *
+ * @param dialog The dialog to show on screen
+ * @param postExecution This interface let the caller to invoke a piece of
+ * code once the dialog is disposed
+ */
+ private static <D1 extends Dialog, D2 extends D1>
+ void showImp(D1 dialog, PostExecution<D2> postExecution) {
+
+ setUserInterfaceActive(true);
+ dialog.open();
+
+ if (postExecution != NullPostExecution.<D2>instance()) {
+ asyncExec(buildPostExecutionRunnable(dialog, postExecution));
+ }
+ }
+
+ /**
+ * Causes the <code>run()</code> method of the given runnable to be invoked
+ * by the user-interface thread at the next reasonable opportunity. The
+ * thread which calls this method is suspended until the runnable completes.
+ *
+ * @param runnable code to run on the user-interface thread.
+ * @see #asyncExec
+ */
+ public static void syncExec(Runnable runnable) {
+ getStandardDisplay().syncExec(runnable);
+ }
+
+ /**
+ * Determines if the current thread is the UI event thread.
+ *
+ * @return <code>true</code> if it's the UI event thread, <code>false</code>
+ * otherwise
+ */
+ public static boolean uiThread() {
+ return getStandardDisplay().getThread() == Thread.currentThread();
+ }
+
+ /**
+ * Determines if the current thread is the UI event thread by using the
+ * thread from which the given viewer's display was instantiated.
+ *
+ * @param viewer The viewer used to determine if the current thread
+ * is the UI event thread
+ * @return <code>true</code> if the current thread is the UI event thread;
+ * <code>false</code> otherwise
+ */
+ public static boolean uiThread(Viewer viewer) {
+ return uiThread(viewer.getControl());
+ }
+
+ /**
+ * Determines if the current thread is the UI event thread by using the
+ * thread from which the given widget's display was instantiated.
+ *
+ * @param widget The widget used to determine if the current thread
+ * is the UI event thread
+ * @return <code>true</code> if the current thread is the UI event thread;
+ * <code>false</code> otherwise
+ */
+ public static boolean uiThread(Widget widget) {
+ return widget.getDisplay().getThread() == Thread.currentThread();
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/TableLayoutComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/TableLayoutComposite.java
index cd51349405..11bb2b2e57 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/TableLayoutComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/util/TableLayoutComposite.java
@@ -13,9 +13,10 @@ package org.eclipse.jpt.ui.internal.util;
import java.util.ArrayList;
import java.util.List;
-
import org.eclipse.core.runtime.Assert;
-
+import org.eclipse.jface.viewers.ColumnLayoutData;
+import org.eclipse.jface.viewers.ColumnPixelData;
+import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
@@ -25,10 +26,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-
/**
* A special composite to layout columns inside a table. The composite is needed since we have
* to layout the columns "before" the actual table gets layouted. Hence we can't use a normal
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/AbstractJpaView.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/AbstractJpaView.java
index aaa185b234..96c28f489c 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/AbstractJpaView.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/AbstractJpaView.java
@@ -3,77 +3,154 @@
* 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: Versant and Others. - initial API and implementation
********************************************************************************/
package org.eclipse.jpt.ui.internal.views;
-import org.eclipse.jpt.ui.internal.selection.ISelectionManager;
-import org.eclipse.jpt.ui.internal.selection.Selection;
+import org.eclipse.jpt.ui.internal.selection.IJpaSelection;
+import org.eclipse.jpt.ui.internal.selection.IJpaSelectionManager;
import org.eclipse.jpt.ui.internal.selection.SelectionManagerFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public abstract class AbstractJpaView extends ViewPart
-{
- protected PageBook pageBook;
-
- protected Composite defaultComposite;
-
-
+/**
+ * This is the abstract implementation of the JPA view. The selection is changed
+ * by receiving a <code>IJpaSelection</code>.
+ *
+ * @see IJpaSelection
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public abstract class AbstractJpaView extends ViewPart
+{
+ /**
+ * The default page used when nothing can be shown.
+ */
+ private Composite defaultComposite;
+
/**
* The string to display when there is no view content
*/
private String defaultLabel;
-
+
+ /**
+ * The container of the current page.
+ */
+ private PageBook pageBook;
+
+ /**
+ *
+ */
private TabbedPropertySheetWidgetFactory widgetFactory;
-
-
- public AbstractJpaView(String aDefaultLabel) {
+
+ /**
+ * Creates a new <code>AbstractJpaView</code>.
+ *
+ * @param defaultLabel
+ */
+ public AbstractJpaView(String defaultLabel) {
super();
- defaultLabel = aDefaultLabel;
- this.widgetFactory = new TabbedPropertySheetWidgetFactory();
+ this.defaultLabel = defaultLabel;
+ this.initialize();
}
-
+
+ private Composite buildDefaultComposite() {
+ Composite composite = getWidgetFactory().createComposite(pageBook, SWT.NONE);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+ getWidgetFactory().createLabel(composite, defaultLabel);
+ return composite;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
public final void createPartControl(Composite parent) {
pageBook = new PageBook(parent, SWT.NONE);
+
defaultComposite = buildDefaultComposite();
pageBook.showPage(defaultComposite);
-
+
subcreatePartControl(parent);
-
- ISelectionManager selectionManager =
+
+ IJpaSelectionManager selectionManager =
SelectionManagerFactory.getSelectionManager(getViewSite().getWorkbenchWindow());
+
selectionManager.register(this);
select(selectionManager.getCurrentSelection());
}
-
- protected void subcreatePartControl(Composite parent) {
- // no op - for subclasses to override if wished
+
+ protected final PageBook getPageBook() {
+ return pageBook;
}
-
- private Composite buildDefaultComposite() {
- Composite composite = getWidgetFactory().createComposite(pageBook, SWT.NONE);
- composite.setLayout(new FillLayout(SWT.VERTICAL));
- getWidgetFactory().createLabel(composite, defaultLabel);
- return composite;
+
+ public final TabbedPropertySheetWidgetFactory getWidgetFactory() {
+ return this.widgetFactory;
}
-
- public abstract void select(Selection aSelection);
-
- protected void showDefaultPage() {
- pageBook.showPage(defaultComposite);
+
+ /**
+ * Initializes this JPA view.
+ */
+ protected void initialize() {
+ this.widgetFactory = new TabbedPropertySheetWidgetFactory();
}
-
+
+ /**
+ * The selection has changed, update the current page by using the given
+ * selection state.
+ *
+ * @param jpaSelection The new selection used to update this JPA view
+ */
+ public abstract void select(IJpaSelection jpaSelection);
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
public void setFocus() {
pageBook.setFocus();
}
-
- public TabbedPropertySheetWidgetFactory getWidgetFactory() {
- return this.widgetFactory;
+
+ /**
+ * Changes the current page and show the default one.
+ */
+ protected void showDefaultPage() {
+ showPage(defaultComposite);
+ }
+
+ /**
+ * Changes the current page and show the given one.
+ *
+ * @param page The new page to show, <code>null</code> can't be passed
+ */
+ protected final void showPage(Control page) {
+ pageBook.getParent().setRedraw(false);
+ try {
+ // It seems the scroll pane has to be installed right before showing
+ // the page, if it is installed during the creation of the pane then
+ // its layout will not always revalidate correctly, i.e. will not show
+ // all the time the vertical scroll bar
+ ScrolledForm scrolledForm = widgetFactory.createScrolledForm(pageBook);
+ scrolledForm.getBody().setLayout(new GridLayout(1, false));
+ page.setParent(scrolledForm.getBody());
+
+ pageBook.showPage(scrolledForm);
+ }
+ finally {
+ pageBook.getParent().setRedraw(true);
+ }
+ }
+
+ protected void subcreatePartControl(Composite parent) {
+ // no op - for subclasses to override if wished
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaDetailsView.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaDetailsView.java
index 7aaa8548ff..6161215101 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaDetailsView.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaDetailsView.java
@@ -1,162 +1,217 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2006, 2008 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.ui.internal.views;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
import org.eclipse.jpt.ui.internal.IJpaPlatformUi;
import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.PlatformRegistry;
+import org.eclipse.jpt.ui.internal.JptUiPlugin;
+import org.eclipse.jpt.ui.internal.Tracing;
import org.eclipse.jpt.ui.internal.details.IJpaDetailsPage;
import org.eclipse.jpt.ui.internal.details.IJpaDetailsProvider;
-import org.eclipse.jpt.ui.internal.selection.Selection;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
+import org.eclipse.jpt.ui.internal.platform.JpaPlatformUiRegistry;
+import org.eclipse.jpt.ui.internal.selection.IJpaSelection;
+import org.eclipse.jpt.ui.internal.selection.JpaSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
-public class JpaDetailsView extends AbstractJpaView
-{
- private Selection currentSelection;
-
- private IJpaDetailsPage currentPage;
-
- /* key: String file content id, value: IJpaDetailsProvider */
- private Map<String, IJpaDetailsProvider> detailsProviders;
-
- /* key: Object content node id, value: Composite page */
- private Map<Object, IJpaDetailsPage> detailsPages;
-
+/**
+ * The JPA view that shows the details a mapping (either type or attribute).
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+@SuppressWarnings("nls")
+public class JpaDetailsView extends AbstractJpaView
+{
+ /**
+ * The current <code>IJpaDetailsPage</code> that was retrieve based on the
+ * current selection.
+ */
+ private IJpaDetailsPage<IJpaContextNode> currentPage;
+
+ /**
+ * The current selection used to show the right <code>IJpaDetailsPage</code>.
+ */
+ private IJpaSelection currentSelection;
+
+ /**
+ * key: Object content node id, value: Composite page.
+ */
+ private Map<Object, IJpaDetailsPage<? extends IJpaContextNode>> detailsPages;
+
+ /**
+ * Creates a new <code>JpaDetailsView</code>.
+ */
public JpaDetailsView() {
super(JptUiMessages.JpaDetailsView_viewNotAvailable);
- this.currentSelection = Selection.NULL_SELECTION;
- this.detailsProviders = new HashMap<String, IJpaDetailsProvider>();
- this.detailsPages = new HashMap<Object, IJpaDetailsPage>();
}
-
-
- public Selection getSelection() {
+
+ private IJpaDetailsPage<? extends IJpaContextNode> buildDetailsPage(IJpaContextNode contextNode) {
+ IJpaDetailsProvider detailsProvider = getDetailsProvider(contextNode);
+
+ if (detailsProvider == null) {
+ return null;
+ }
+
+ String id = contextNode.jpaProject().jpaPlatform().getId();
+
+ Composite container = getWidgetFactory().createComposite(getPageBook());
+ container.setLayout(new FillLayout(SWT.HORIZONTAL));
+
+ IJpaDetailsPage<? extends IJpaContextNode> page = detailsProvider.buildDetailsPage(
+ container,
+ contextNode,
+ getWidgetFactory()
+ );
+
+ if (page != null) {
+ detailsPages.put(id, page);
+ }
+
+ return page;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public void dispose() {
+
+ detailsPages.clear();
+
+ currentSelection = JpaSelection.NULL_SELECTION;
+ currentPage = null;
+
+ super.dispose();
+ }
+
+ private IJpaDetailsPage<? extends IJpaContextNode> getDetailsPage(IJpaContextNode contextNode) {
+ //TODO commented out the caching of the details provider for the time being,
+ //someone should probably revist the possibility of caching
+// String id = contextNode.jpaProject().jpaPlatform().getId();
+//
+// if (detailsPages.containsKey(id)) {
+// IJpaDetailsPage<? extends IJpaContextNode> page = detailsPages.get(id);
+//
+// if ((page != null) && page.getControl().isDisposed()) {
+// detailsPages.remove(id);
+// }
+// else {
+// return page;
+// }
+// }
+//
+ return buildDetailsPage(contextNode);
+ }
+
+ private IJpaDetailsProvider getDetailsProvider(IJpaContextNode contextNode) {
+
+ String platformId = contextNode.jpaProject().jpaPlatform().getId();
+ IJpaPlatformUi jpaPlatformUI = JpaPlatformUiRegistry.instance().jpaPlatform(platformId);
+ return jpaPlatformUI.detailsProvider(contextNode);
+
+ //TODO this view and the detailsProviders Map is not created on a per project basis.
+ //the detailsProviders and their fileContentTypes could overlap across project, this would cause problems with storing this map.
+ }
+
+ public IJpaSelection getSelection() {
return currentSelection;
}
-
- public void select(Selection newSelection) {
- if (newSelection.equals(currentSelection)) {
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initialize() {
+ super.initialize();
+
+ this.currentSelection = IJpaSelection.NULL_SELECTION;
+ this.detailsPages = new HashMap<Object, IJpaDetailsPage<? extends IJpaContextNode>>();
+ }
+
+ private void log(String message) {
+ if (Tracing.booleanDebugOption(Tracing.UI_DETAILS_VIEW)) {
+ Tracing.log(message);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public void select(IJpaSelection jpaSelection) {
+ if (jpaSelection.equals(currentSelection)) {
return;
}
-
- currentSelection = newSelection;
-
- if (newSelection != Selection.NULL_SELECTION) {
- IJpaContentNode newNode = newSelection.getSelectedNode();
- IJpaDetailsPage newPage = getDetailsPage(newNode);
+
+ currentSelection = jpaSelection;
+
+ if (jpaSelection != IJpaSelection.NULL_SELECTION) {
+ IJpaContextNode newNode = jpaSelection.getSelectedNode();
+ IJpaDetailsPage<? extends IJpaContextNode> newPage = getDetailsPage(newNode);
setCurrentPage(newPage);
}
- else if (currentSelection != Selection.NULL_SELECTION) {
+ else {
setCurrentPage(null);
}
}
-
- private IJpaDetailsPage getDetailsPage(IJpaContentNode contentNode) {
- if (detailsPages.containsKey(contentNode.getId())) {
- IJpaDetailsPage page = detailsPages.get(contentNode.getId());
-
- if ((page != null) &&
- (page.getControl().isDisposed())) {
- detailsPages.remove(contentNode.getId());
+
+ /**
+ * Changes the current page and shows the given page.
+ *
+ * @param newPage The new page to display
+ */
+ @SuppressWarnings("unchecked")
+ private void setCurrentPage(IJpaDetailsPage<? extends IJpaContextNode> page) {
+
+ // Unpopulate old page
+ if (currentPage != null) {
+ try {
+ log("JpaDetailsView.setCurrentPage() : disposing of current page");
+
+ currentPage.setSubject(null);
}
- else {
- return page;
+ catch (Exception e) {
+ JptUiPlugin.log(e);
}
}
-
- return buildDetailsPage(contentNode);
- }
-
- private IJpaDetailsPage buildDetailsPage(IJpaContentNode contentNode) {
- IJpaDetailsProvider detailsProvider =
- getDetailsProvider(contentNode);
-
- if (detailsProvider == null) {
- return null;
- }
- Composite parentComposite = getWidgetFactory().createComposite(pageBook, SWT.NONE);
- parentComposite.setLayout(new FillLayout(SWT.VERTICAL));
- IJpaDetailsPage page =
- detailsProvider.buildDetailsPage(parentComposite, contentNode.getId(), getWidgetFactory());
-
+
+ IJpaDetailsPage<IJpaContextNode> newPage = (IJpaDetailsPage<IJpaContextNode>) page;
+
+ // Populate new page
if (page != null) {
- detailsPages.put(contentNode.getId(), page);
- }
-
- return page;
- }
-
- private IJpaDetailsProvider getDetailsProvider(IJpaContentNode contentNode) {
- String contentId = contentNode.getJpaFile().getContentId();
- IJpaDetailsProvider provider = detailsProviders.get(contentId);
-
- if (provider == null) {
- String platformId = contentNode.jpaPlatform().getId();
- IJpaPlatformUi jpaPlatformUI = PlatformRegistry.instance().jpaPlatform(platformId);
- provider = jpaPlatformUI.detailsProvider(contentId);
-
- //TODO this view and the detailsProviders Map is not created on a per project basis.
- //the detailsProviders and their fileContentTypes could overlap across project, this would cause problems with storing this map.
-
- if (provider != null) {
- detailsProviders.put(contentId, provider);
+ try {
+ log("JpaDetailsView.setCurrentPage() : populating new page");
+ newPage.setSubject(currentSelection.getSelectedNode());
+ }
+ catch (Exception e) {
+ // Show error page
+ page = null;
+ JptUiPlugin.log(e);
}
}
-
- return provider;
- }
-
- private void setCurrentPage(IJpaDetailsPage newPage) {
- // depopulate old page
- if ((currentPage != null) && (currentPage != newPage)) {
- currentPage.populate(null);
- }
-
- // populate new page
- if (newPage != null) {
- newPage.populate(currentSelection.getSelectedNode());
+ else {
+ log("JpaDetailsView.setCurrentPage() : No page to populate");
}
-
+
currentPage = newPage;
-
- // show new page
- if (newPage == null) {
+
+ // Show new page
+ if (page == null) {
showDefaultPage();
}
else {
- pageBook.showPage(newPage.getControl().getParent());
- }
- }
-
- public void dispose() {
- for (Iterator<String> stream = new CloneIterator<String>(detailsProviders.keySet()); stream.hasNext(); ) {
- String key = stream.next();
- IJpaDetailsProvider provider = detailsProviders.remove(key);
- provider.dispose();
+ showPage(page.getControl());
}
-
- for (Iterator<Object> stream = new CloneIterator<Object>(detailsPages.keySet()); stream.hasNext(); ) {
- Object key = stream.next();
- IJpaDetailsPage detailsPage = detailsPages.remove(key);
- detailsPage.dispose();
- }
-
- currentSelection = Selection.NULL_SELECTION;
- currentPage = null;
-
- super.dispose();
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaStructureView.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaStructureView.java
deleted file mode 100644
index 4df3a6f498..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/JpaStructureView.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.views;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.ui.internal.IJpaPlatformUi;
-import org.eclipse.jpt.ui.internal.JptUiMessages;
-import org.eclipse.jpt.ui.internal.PlatformRegistry;
-import org.eclipse.jpt.ui.internal.jface.NullLabelProvider;
-import org.eclipse.jpt.ui.internal.jface.NullTreeContentProvider;
-import org.eclipse.jpt.ui.internal.selection.Selection;
-import org.eclipse.jpt.ui.internal.structure.IJpaStructureProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IWorkbenchActionConstants;
-
-public class JpaStructureView extends AbstractJpaView
-{
- private StructureComposite structureComposite;
-
-
- public JpaStructureView() {
- super(JptUiMessages.JpaStructureView_viewNotAvailable);
- }
-
-
- @Override
- public void subcreatePartControl(Composite parent) {
- structureComposite =
- new StructureComposite(pageBook, SWT.NULL);
- }
-
- public Selection getSelection() {
- if (structureComposite.isVisible()) {
- return structureComposite.getSelection();
- }
- else {
- return Selection.NULL_SELECTION;
- }
- }
-
- @Override
- public void select(Selection newSelection) {
- Selection currentSelection = getSelection();
-
- if (newSelection.equals(currentSelection)) {
- return;
- }
-
- if (newSelection == Selection.NULL_SELECTION) {
- showDefaultPage();
- }
- else {
- pageBook.showPage(structureComposite);
- }
-
- structureComposite.select(newSelection);
- }
-
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- structureComposite.viewer.addSelectionChangedListener(listener);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- structureComposite.viewer.removeSelectionChangedListener(listener);
- }
-
-
- private class StructureComposite extends Composite
- {
- /* key: String file content id, value: IJpaStructureProvider */
- private Map structureProviders;
-
- private TreeViewer viewer;
-
- private StructureComposite(Composite parent, int style) {
- super(parent, style);
-
- structureProviders = new HashMap();
-
- this.setLayout(new FillLayout());
-
- viewer = new TreeViewer(this, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.setAutoExpandLevel(2);
- initContextMenu();
- }
-
- protected void initContextMenu() {
- // Create dynamic menu mgr. Dynamic is currently required to
- // support action contributions.
- MenuManager mgr = new MenuManager();
- mgr.setRemoveAllWhenShown(true);
- mgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager mgr) {
- fillContextMenu(mgr);
- }
- });
- Menu menu = mgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
- getSite().registerContextMenu(mgr, viewer);
-
- }
-
- /**
- * Called when the context menu is about to open.
- * Delegates to the action group using the viewer's selection as the action context.
- * @since 2.0
- */
- protected void fillContextMenu(IMenuManager manager) {
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- private Selection getSelection() {
- ITreeSelection viewerSelection = (ITreeSelection) viewer.getSelection();
-
- if (viewerSelection.isEmpty() || viewerSelection.size() > 1) {
- if (viewer.getInput() == null) {
- return Selection.NULL_SELECTION;
- }
- else {
- return new Selection((IJpaContentNode) viewer.getInput());
- }
- }
-
- else {
- return new Selection((IJpaContentNode) viewerSelection.getFirstElement());
- }
-
- }
-
- private void select(Selection selection) {
- // note: checks for null and equals() selection have already been performed
-
- if (selection.equals(Selection.NULL_SELECTION)) {
- clearViewer();
- return;
- }
-
- Selection currentSelection = getSelection();
- IJpaContentNode newNode = selection.getSelectedNode();
- IJpaFile newFile = newNode.getJpaFile();
- IJpaContentNode currentNode =
- (currentSelection == Selection.NULL_SELECTION) ?
- null : getSelection().getSelectedNode();
- IJpaFile currentFile =
- (currentNode == null) ?
- null : currentNode.getJpaFile();
-
- if (newFile.equals(currentFile)) {
- viewer.setSelection(new StructuredSelection(newNode), true);
- }
- else if (currentFile != null && newFile.getContentId().equals(currentFile.getContentId())) {
- viewer.setInput(newFile.getContent());
- viewer.setSelection(new StructuredSelection(newNode), true);
- }
- else {
- // new content type
- // replace composite and set selection of tree
- IJpaStructureProvider provider = getStructureProvider(newNode);
-
- if (provider == null) {
- clearViewer();
- }
- else {
- viewer.setContentProvider(provider.buildContentProvider());
- viewer.setLabelProvider(provider.buildLabelProvider());
- viewer.setInput(newFile.getContent());
- }
- }
- }
-
- private void clearViewer() {
- viewer.setContentProvider(NullTreeContentProvider.INSTANCE);
- viewer.setLabelProvider(NullLabelProvider.INSTANCE);
- viewer.setInput(null);
- }
-
- private IJpaStructureProvider getStructureProvider(IJpaContentNode contentNode) {
- String contentId = contentNode.getJpaFile().getContentId();
- IJpaStructureProvider provider =
- (IJpaStructureProvider) structureProviders.get(contentId);
-
- if (provider == null) {
- String platformId = contentNode.jpaPlatform().getId();
- IJpaPlatformUi jpaPlatformUI = PlatformRegistry.instance().jpaPlatform(platformId);
- provider = jpaPlatformUI.structureProvider(contentId);
-
- //TODO this view and the detailsProviders Map is not created on a per project basis.
- //the detailsProviders and their fileContentTypes could overlap across project, this would cause problems with storing this map.
- if (provider != null) {
- structureProviders.put(contentId, provider);
- }
- }
-
- return provider;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/structure/JpaStructurePage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/structure/JpaStructurePage.java
new file mode 100644
index 0000000000..97a0590156
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/structure/JpaStructurePage.java
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ui.internal.views.structure;
+
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.ui.internal.jface.DelegatingTreeContentAndLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.NullLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.NullTreeContentProvider;
+import org.eclipse.jpt.ui.internal.selection.IJpaSelection;
+import org.eclipse.jpt.ui.internal.selection.JpaSelection;
+import org.eclipse.jpt.ui.internal.structure.IJpaStructureProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.IPageSite;
+import org.eclipse.ui.part.Page;
+
+public class JpaStructurePage extends Page
+ implements ISelectionProvider, ISelectionChangedListener
+{
+ private IJpaStructureProvider structureProvider;
+
+ private ListenerList selectionChangedListeners;
+
+ private Composite control;
+
+ private TreeViewer viewer;
+
+ private IWorkbenchPart workbenchPart;
+
+ public JpaStructurePage(IWorkbenchPart part, IJpaStructureProvider structureProvider) {
+ this.workbenchPart = part;
+ this.structureProvider = structureProvider;
+ this.selectionChangedListeners = new ListenerList();
+ }
+
+ @Override
+ public void init(IPageSite pageSite) {
+ super.init(pageSite);
+ pageSite.setSelectionProvider(this);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ control = new Composite(parent, SWT.NULL);
+ control.setLayout(new FillLayout());
+ viewer = new TreeViewer(control, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ viewer.setAutoExpandLevel(2);
+ DelegatingTreeContentAndLabelProvider contentAndLabelProvider
+ = new DelegatingTreeContentAndLabelProvider(
+ structureProvider.treeItemContentProviderFactory(),
+ structureProvider.itemLabelProviderFactory());
+ viewer.setContentProvider(contentAndLabelProvider);
+ // TODO Use problem decorator
+ viewer.setLabelProvider(contentAndLabelProvider);
+ viewer.setInput(structureProvider.getInput());
+ viewer.addSelectionChangedListener(this);
+ initContextMenu();
+ }
+
+ @Override
+ public void dispose() {
+ viewer.removeSelectionChangedListener(this);
+ structureProvider.dispose();
+ super.dispose();
+ }
+
+ //TODO this isn't really working. our jpa actions appear, but along with a bunch of other actions!!
+ protected void initContextMenu() {
+ // Create dynamic menu mgr. Dynamic is currently required to
+ // support action contributions.
+ MenuManager mgr = new MenuManager();
+ mgr.setRemoveAllWhenShown(true);
+ mgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager mgr) {
+ fillContextMenu(mgr);
+ }
+ });
+ Menu menu = mgr.createContextMenu(viewer.getControl());
+ viewer.getControl().setMenu(menu);
+ workbenchPart.getSite().registerContextMenu(mgr, viewer);
+ }
+
+ /**
+ * Called when the context menu is about to open.
+ * Delegates to the action group using the viewer's selection as the action context.
+ * @since 2.0
+ */
+ protected void fillContextMenu(IMenuManager manager) {
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
+ @Override
+ public Control getControl() {
+ return control;
+ }
+
+ @Override
+ public void setFocus() {
+ control.setFocus();
+ }
+
+
+
+ void select(IJpaSelection selection) {
+ // TODO
+ // // note: checks for null and equals() selection have already been performed
+ //
+ // if (selection.equals(IJpaSelection.NULL_SELECTION)) {
+ // clearViewer();
+ // return;
+ // }
+ //
+ // IJpaSelection currentSelection = getSelection();
+ // IJpaContentNode newNode = selection.getSelectedNode();
+ // IJpaFile newFile = newNode.getJpaFile();
+ // IJpaContentNode currentNode =
+ // (currentSelection == IJpaSelection.NULL_SELECTION) ?
+ // null : getSelection().getSelectedNode();
+ // IJpaFile currentFile =
+ // (currentNode == null) ?
+ // null : currentNode.getJpaFile();
+ //
+ // if (newFile.equals(currentFile)) {
+ // viewer.setSelection(new StructuredSelection(newNode), true);
+ // }
+ // else if (currentFile != null && newFile.getContentId().equals(currentFile.getContentId())) {
+ // viewer.setInput(newFile.getContent());
+ // viewer.setSelection(new StructuredSelection(newNode), true);
+ // }
+ // else {
+ // // new content type
+ // // replace composite and set selection of tree
+ // IJpaStructureProvider provider = getStructureProvider(newNode);
+ //
+ // if (provider == null) {
+ // clearViewer();
+ // }
+ // else {
+ // viewer.setContentProvider(provider.buildContentProvider());
+ // viewer.setLabelProvider(provider.buildLabelProvider());
+ // viewer.setInput(newFile.getContent());
+ // }
+ // }
+ }
+
+ private void clearViewer() {
+ viewer.setContentProvider(NullTreeContentProvider.INSTANCE);
+ viewer.setLabelProvider(NullLabelProvider.INSTANCE);
+ viewer.setInput(null);
+ }
+
+
+ // **************** ISelectionProvider impl ********************************
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ selectionChangedListeners.add(listener);
+ }
+
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ selectionChangedListeners.remove(listener);
+ }
+
+ public IJpaSelection getSelection() {
+ ITreeSelection viewerSelection = (ITreeSelection) viewer.getSelection();
+
+ if (viewerSelection.isEmpty() || viewerSelection.size() > 1) {
+ return IJpaSelection.NULL_SELECTION;
+ }
+ else {
+ return new JpaSelection((IJpaContextNode) viewerSelection.getFirstElement());
+ }
+ }
+
+ public void setSelection(ISelection selection) {
+ if (viewer != null) {
+ viewer.setSelection(selection);
+ }
+ }
+
+
+
+ // **************** ISelectionChangedListener impl *************************
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ fireSelectionChanged(event.getSelection());
+ }
+
+ protected void fireSelectionChanged(ISelection selection) {
+ // create an event
+ final SelectionChangedEvent event =
+ new SelectionChangedEvent(this, selection);
+
+ // fire the event
+ Object[] listeners = selectionChangedListeners.getListeners();
+ for (int i = 0; i < listeners.length; ++i) {
+ final ISelectionChangedListener l = (ISelectionChangedListener) listeners[i];
+ SafeRunner.run(
+ new SafeRunnable() {
+ public void run() {
+ l.selectionChanged(event);
+ }
+ });
+ }
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/structure/JpaStructureView.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/structure/JpaStructureView.java
new file mode 100644
index 0000000000..2859ec9ef4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/views/structure/JpaStructureView.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 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.ui.internal.views.structure;
+
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jpt.ui.internal.JptUiMessages;
+import org.eclipse.jpt.ui.internal.selection.IJpaSelection;
+import org.eclipse.jpt.ui.internal.structure.IJpaStructureProvider;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.IPage;
+import org.eclipse.ui.part.MessagePage;
+import org.eclipse.ui.part.PageBook;
+import org.eclipse.ui.part.PageBookView;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+public class JpaStructureView extends PageBookView
+{
+ private TabbedPropertySheetWidgetFactory widgetFactory =
+ new TabbedPropertySheetWidgetFactory();
+
+
+ public JpaStructureView() {
+ super();
+ }
+
+
+ @Override
+ protected boolean isImportant(IWorkbenchPart part) {
+ return part instanceof IEditorPart;
+ }
+
+ @Override
+ protected IWorkbenchPart getBootstrapPart() {
+ IWorkbenchPage page = getSite().getPage();
+ if (page != null) {
+ return page.getActiveEditor();
+ }
+
+ return null;
+ }
+
+ @Override
+ protected IPage createDefaultPage(PageBook book) {
+ MessagePage page = new MessagePage();
+ initPage(page);
+ page.createControl(book);
+ page.setMessage(JptUiMessages.JpaStructureView_structureNotAvailable);
+ return page;
+ }
+
+ @Override
+ protected PageRec doCreatePage(IWorkbenchPart part) {
+ IJpaStructureProvider structureProvider =
+ (IJpaStructureProvider) part.getAdapter(IJpaStructureProvider.class);
+ if (structureProvider != null) {
+ JpaStructurePage page = new JpaStructurePage(part, structureProvider);
+ initPage(page);
+ page.createControl(getPageBook());
+ return new PageRec(part, page);
+ }
+ return null;
+ }
+
+ @Override
+ protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
+ JpaStructurePage page = (JpaStructurePage) pageRecord.page;
+ removeSelectionChangedListener(page);
+ page.dispose();
+ pageRecord.dispose();
+ }
+
+ public IJpaSelection getSelection() {
+ if (getCurrentPage() != getDefaultPage()) {
+ return ((JpaStructurePage) getCurrentPage()).getSelection();
+ }
+ else {
+ return IJpaSelection.NULL_SELECTION;
+ }
+ }
+
+ public void select(IJpaSelection newSelection) {
+ // correct page should be shown
+ if (getCurrentPage() != getDefaultPage()) {
+ ((JpaStructurePage) getCurrentPage()).select(newSelection);
+ }
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ getSelectionProvider().addSelectionChangedListener(listener);
+ }
+
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ getSelectionProvider().removeSelectionChangedListener(listener);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractDialog.java
new file mode 100644
index 0000000000..57eec4536a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractDialog.java
@@ -0,0 +1,240 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.widgets;
+
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jpt.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.jpt.utility.internal.node.Node;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.help.IWorkbenchHelpSystem;
+
+/**
+ * The abstract implementation of a dialog using a "state object" (model object)
+ * for behavior.
+ * <p>
+ * The main pane of this dialog should be extending <code>AbstractDialogPane</code>
+ * for creating the right type of widgets and it has the "state object" (subject)
+ * behavior built-in.
+ *
+ * @see Node
+ * @see AbstractDialogPane
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public abstract class AbstractDialog<T extends Node> extends TitleAreaDialog
+{
+ /**
+ * The holder of the "state object" used by this dialog.
+ */
+ private WritablePropertyValueModel<T> subjectHolder;
+
+ /**
+ * Caches the title text until the dialog is created and the dialog's shell
+ * needs to be configured.
+ */
+ private String title;
+
+ /**
+ * Creates a new <code>AbstractDialog</code>.
+ *
+ * @param parent The parent shell
+ */
+ protected AbstractDialog(Shell parent) {
+ this(parent, "");
+ }
+
+ /**
+ * Creates a new <code>AbstractDialog</code>.
+ *
+ * @param parent The parent shell
+ * @param title The dialog's title
+ */
+ protected AbstractDialog(Shell parent, String title) {
+ super(parent);
+ this.title = title;
+ initialize();
+ }
+
+ protected T buildStateObject() {
+ return null;
+ }
+
+ Node.Validator buildValidator() {
+ return Node.NULL_VALIDATOR;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(title());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void create() {
+ super.create();
+ installSubject();
+ getButton(OK).setEnabled(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected Control createContents(Composite parent) {
+ if (hasTitleArea()) {
+ return super.createContents(parent);
+ }
+
+ return createDefaultContent(parent);
+ }
+
+ private Control createDefaultContent(Composite parent) {
+
+ Composite composite = new Composite(parent, 0);
+
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.verticalSpacing = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ applyDialogFont(composite);
+ initializeDialogUnits(composite);
+ this.dialogArea = createDialogArea(composite);
+ this.buttonBar = createButtonBar(composite);
+
+ return composite;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected Composite createDialogArea(Composite parent) {
+
+ parent = (Composite) super.createDialogArea(parent);
+
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.marginTop = 0;
+ layout.marginLeft = 0;
+ layout.marginBottom = 0;
+ layout.marginRight = 0;
+
+ Composite dialogPane = new Composite(parent, SWT.NULL);
+ dialogPane.setLayout(layout);
+ initializeMainPane(dialogPane);
+
+ return parent;
+ }
+
+ protected final WritablePropertyValueModel<T> getSubjectHolder() {
+ return this.subjectHolder;
+ }
+
+ boolean hasTitleArea() {
+ return false;
+ }
+
+ /**
+ * Returns the helps system.
+ *
+ * @return The platform's help system
+ *
+ * @category Helper
+ */
+ protected final IWorkbenchHelpSystem helpSystem() {
+ return PlatformUI.getWorkbench().getHelpSystem();
+ }
+
+ /**
+ * Initializes this dialog.
+ */
+ protected void initialize() {
+ this.subjectHolder = new SimplePropertyValueModel<T>();
+ }
+
+ /**
+ * The dialog is built when the show() method is called not
+ * when the Dialog is constructed
+ */
+ protected abstract void initializeMainPane(Composite container);
+
+ private void installSubject() {
+
+ T subject = this.buildStateObject();
+
+ if (subject != null) {
+ subject.setValidator(buildValidator());
+ }
+
+ this.subjectHolder.setValue(subject);
+ }
+
+ /**
+ * Asynchronously launches this dialog in the UI thread.
+ */
+ public final void openDialog() {
+ SWTUtil.setUserInterfaceActive(false);
+ SWTUtil.show(this);
+ }
+
+ /**
+ * Asynchronously launches this dialog in the UI thread and invoke the given
+ * <code>PostExecution</code> to perform any post-task.
+ *
+ * @param postExecution This interface let the caller to invoke a piece of
+ * code once the dialog is disposed
+ */
+ public final void openDialog(PostExecution<? extends AbstractDialog<T>> execution) {
+ SWTUtil.setUserInterfaceActive(false);
+ SWTUtil.show(this, execution);
+ }
+
+ /**
+ * Returns the subject of this dialog.
+ *
+ * @return The subject of this dialog or <code>null</code> if no subject was
+ * used
+ */
+ public T subject() {
+ return this.subjectHolder.value();
+ }
+
+ protected String title() {
+ return this.title;
+ }
+
+ public boolean wasCancelled() {
+ return getReturnCode() == CANCEL;
+ }
+
+ public boolean wasConfirmed() {
+ return getReturnCode() == OK;
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractDialogPane.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractDialogPane.java
new file mode 100644
index 0000000000..37a9830592
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractDialogPane.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.widgets;
+
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.node.Node;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * The abstract pane to use when the pane is shown in an <code>AbstractDialog</code>.
+ *
+ * @see AbstractDialog
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public abstract class AbstractDialogPane<T extends Node> extends AbstractPane<T> {
+
+ /**
+ * Creates a new <code>AbstractDialog</code>.
+ *
+ * @param parentPane The parent controller of this one
+ * @param parent The parent container
+ *
+ * @category Constructor
+ */
+ protected AbstractDialogPane(AbstractDialogPane<? extends T> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ /**
+ * Creates a new <code>AbstractDialogPane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various widgets
+ * @param automaticallyAlignWidgets <code>true</code> to make the widgets
+ * this pane aligned with the widgets of the given parent controller;
+ * <code>false</code> to not align them
+ *
+ * @category Constructor
+ */
+ protected AbstractDialogPane(AbstractDialogPane<? extends T> parentPane,
+ Composite parent,
+ boolean automaticallyAlignWidgets) {
+
+ super(parentPane, parent, automaticallyAlignWidgets);
+ }
+
+ /**
+ * Creates a new <code>AbstractDialogPane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ *
+ * @category Constructor
+ */
+ protected AbstractDialogPane(AbstractDialogPane<?> parentPane,
+ PropertyValueModel<? extends T> subjectHolder,
+ Composite parent) {
+
+ super(parentPane, subjectHolder, parent);
+ }
+
+ /**
+ * Creates a new <code>AbstractDialogPane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various widgets
+ * @param automaticallyAlignWidgets <code>true</code> to make the widgets
+ * this pane aligned with the widgets of the given parent controller;
+ * <code>false</code> to not align them
+ *
+ * @category Constructor
+ */
+ protected AbstractDialogPane(AbstractDialogPane<?> parentPane,
+ PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ boolean automaticallyAlignWidgets) {
+
+ super(parentPane, subjectHolder, parent, automaticallyAlignWidgets);
+ }
+
+ /**
+ * Creates a new <code>AbstractDialogPane</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ *
+ * @category Constructor
+ */
+ protected AbstractDialogPane(PropertyValueModel<? extends T> subjectHolder,
+ Composite parent) {
+
+ super(subjectHolder, parent, WidgetFactory.instance());
+ }
+
+ private static class WidgetFactory implements IWidgetFactory {
+
+ private static final IWidgetFactory INSTANCE = new WidgetFactory();
+
+ static IWidgetFactory instance() {
+ return INSTANCE;
+ }
+
+ public Button createButton(Composite parent, String text, int style) {
+ Button button = new Button(parent, style);
+ button.setText(text);
+ return button;
+ }
+
+ public CCombo createCombo(Composite parent) {
+ return new CCombo(parent, SWT.NULL);
+ }
+
+ public Composite createComposite(Composite parent) {
+ return new Composite(parent, SWT.NULL);
+ }
+
+ public Group createGroup(Composite parent, String title) {
+ Group group = new Group(parent, SWT.NULL);
+ group.setText(title);
+ return group;
+ }
+
+ public Hyperlink createHyperlink(Composite parent, String text) {
+ Hyperlink hyperlink = new Hyperlink(parent, SWT.NULL);
+ hyperlink.setText(text);
+ return hyperlink;
+ }
+
+ public Label createLabel(Composite container, String labelText) {
+ Label label = new Label(container, SWT.NULL);
+ label.setText(labelText);
+ return label;
+ }
+
+ public List createList(Composite container, int style) {
+ return new List(container, style);
+ }
+
+ public Section createSection(Composite parent, int style) {
+ return new Section(parent, style);
+ }
+
+ public Text createText(Composite parent) {
+ return new Text(parent, SWT.NULL);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractFormPane.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractFormPane.java
new file mode 100644
index 0000000000..bc8f01d9de
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractFormPane.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.widgets;
+
+import org.eclipse.jpt.utility.internal.model.Model;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
+
+/**
+ * The abstract pane to use when the pane is shown using the form look and feel,
+ * which is handled by <code>TabbedPropertySheetWidgetFactory</code>.
+ *
+ * @see TabbedPropertySheetWidgetFactory
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public abstract class AbstractFormPane<T extends Model> extends AbstractPane<T>
+{
+ /**
+ * Creates a new <code>BaseJpaController</code>.
+ *
+ * @param parentPane The parent controller of this one
+ * @param parent The parent container
+ *
+ * @category Constructor
+ */
+ protected AbstractFormPane(AbstractFormPane<? extends T> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ /**
+ * Creates a new <code>AbstractFormPane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various widgets
+ * @param automaticallyAlignWidgets <code>true</code> to make the widgets
+ * this pane aligned with the widgets of the given parent controller;
+ * <code>false</code> to not align them
+ *
+ * @category Constructor
+ */
+ protected AbstractFormPane(AbstractFormPane<? extends T> parentPane,
+ Composite parent,
+ boolean automaticallyAlignWidgets) {
+
+ super(parentPane, parent, automaticallyAlignWidgets);
+ }
+
+ /**
+ * Creates a new <code>AbstractFormPane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ *
+ * @category Constructor
+ */
+ protected AbstractFormPane(AbstractFormPane<?> parentPane,
+ PropertyValueModel<? extends T> subjectHolder,
+ Composite parent) {
+
+ super(parentPane, subjectHolder, parent);
+ }
+
+ /**
+ * Creates a new <code>AbstractFormPane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various widgets
+ * @param automaticallyAlignWidgets <code>true</code> to make the widgets
+ * this pane aligned with the widgets of the given parent controller;
+ * <code>false</code> to not align them
+ *
+ * @category Constructor
+ */
+ protected AbstractFormPane(AbstractFormPane<?> parentPane,
+ PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ boolean automaticallyAlignWidgets) {
+
+ super(parentPane, subjectHolder, parent, automaticallyAlignWidgets);
+ }
+
+ /**
+ * Creates a new <code>AbstractFormPane</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ *
+ * @category Constructor
+ */
+ protected AbstractFormPane(PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ /**
+ * Creates a new <code>AbstractFormPane</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ *
+ * @category Constructor
+ */
+ protected AbstractFormPane(PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ this(subjectHolder, parent, new WidgetFactory(widgetFactory));
+ }
+
+ /**
+ * Returns
+ *
+ * @return
+ */
+ protected final TabbedPropertySheetWidgetFactory getFormWidgetFactory() {
+ WidgetFactory widgetFactory = (WidgetFactory) getWidgetFactory();
+ return widgetFactory.widgetFactory;
+ }
+
+ private static class WidgetFactory implements IWidgetFactory {
+
+ private final TabbedPropertySheetWidgetFactory widgetFactory;
+
+ public WidgetFactory(TabbedPropertySheetWidgetFactory widgetFactory) {
+ super();
+ this.widgetFactory = widgetFactory;
+ }
+
+ public Button createButton(Composite parent, String text, int style) {
+ return widgetFactory.createButton(parent, text, style);
+ }
+
+ public CCombo createCombo(Composite parent) {
+ return widgetFactory.createCCombo(parent, SWT.FLAT);
+ }
+
+ public Composite createComposite(Composite parent) {
+ return widgetFactory.createComposite(parent);
+ }
+
+ public Group createGroup(Composite parent, String title) {
+ return widgetFactory.createGroup(parent, title);
+ }
+
+ public Hyperlink createHyperlink(Composite parent, String text) {
+ return widgetFactory.createHyperlink(parent, text, SWT.FLAT);
+ }
+
+ public Label createLabel(Composite container, String labelText) {
+ return widgetFactory.createLabel(container, labelText);
+ }
+
+ public List createList(Composite container, int style) {
+ return widgetFactory.createList(container, style | SWT.FLAT);
+ }
+
+ public Section createSection(Composite parent, int style) {
+ return widgetFactory.createSection(parent, style | SWT.FLAT);
+ }
+
+ public Text createText(Composite parent) {
+ return widgetFactory.createText(parent, null);
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractPane.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractPane.java
new file mode 100644
index 0000000000..bd6f372460
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractPane.java
@@ -0,0 +1,2108 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.widgets;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jpt.ui.internal.Tracing;
+import org.eclipse.jpt.ui.internal.listeners.SWTPropertyChangeListenerWrapper;
+import org.eclipse.jpt.ui.internal.swt.BooleanButtonModelAdapter;
+import org.eclipse.jpt.ui.internal.swt.TriStateBooleanButtonModelAdapter;
+import org.eclipse.jpt.ui.internal.util.ControlAligner;
+import org.eclipse.jpt.ui.internal.util.LabeledControlUpdater;
+import org.eclipse.jpt.ui.internal.util.LabeledTableItem;
+import org.eclipse.jpt.ui.internal.util.SWTUtil;
+import org.eclipse.jpt.utility.internal.ClassTools;
+import org.eclipse.jpt.utility.internal.model.Model;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.help.IWorkbenchHelpSystem;
+
+/**
+ * The abstract definition of a pane which holds onto a <code>PropertyValueModel</code>
+ * that contains the subject of this pane.
+ * <p>
+ * It also contains convenience methods for building buttons, labels, check
+ * boxes, and radio buttons, etc.
+ * <p>
+ * It is possible to easily listen to any property changes coming from the
+ * subject, {@link #addPropertyNames(Collection)} is specify which properties
+ * are of interest and {@link #propertyChanged(String)} is used to notify the
+ * pane when the property has changed.
+ *
+ * @see AbstractFormPane
+ * @see AbstractDialogPane
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public abstract class AbstractPane<T extends Model>
+{
+ /**
+ * The listener registered with the subject in order to be notified when a
+ * property has changed, the property names are determined by
+ * {@link #propertyNames()}.
+ */
+ private PropertyChangeListener aspectChangeListener;
+
+ /**
+ * The container of this composite.
+ */
+ private Composite container;
+
+ /**
+ * The aligner responsible to align the left controls.
+ */
+ private ControlAligner leftControlAligner;
+
+ /**
+ * Flag used to stop the circular population of widgets.
+ */
+ private boolean populating;
+
+ /**
+ * The aligner responsible to align the left controls.
+ */
+ private ControlAligner rightControlAligner;
+
+ /**
+ * This listener is registered with the subject holder in order to
+ * automatically repopulate this pane with the new subject.
+ */
+ private PropertyChangeListener subjectChangeListener;
+
+ /**
+ * The subject of this pane.
+ */
+ private PropertyValueModel<T> subjectHolder;
+
+ /**
+ * The collection of registered sub-panes will be automatically notified
+ * when listeners need to be engaged or disengaged or when to populate its
+ * widgets.
+ */
+ private Collection<AbstractPane<?>> subPanes;
+
+ /**
+ * The factory used to create various common widgets.
+ */
+ private IWidgetFactory widgetFactory;
+
+ /**
+ * Creates a new <code>AbstractSubjectPane</code>.
+ *
+ * @category Constructor
+ */
+ @SuppressWarnings("unused")
+ private AbstractPane() {
+ super();
+ }
+
+ /**
+ * Creates a new <code>AbstractSubjectPane</code>.
+ *
+ * @param parentPane The parent pane of this one
+ * @param parent The parent container
+ *
+ * @category Constructor
+ */
+ protected AbstractPane(AbstractPane<? extends T> parentPane,
+ Composite parent) {
+
+ this(parentPane, parent, true);
+ }
+
+ /**
+ * Creates a new <code>AbstractSubjectPane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various widgets
+ * @param automaticallyAlignWidgets <code>true</code> to make the widgets
+ * this pane aligned with the widgets of the given parent pane;
+ * <code>false</code> to not align them
+ *
+ * @category Constructor
+ */
+ protected AbstractPane(AbstractPane<? extends T> parentPane,
+ Composite parent,
+ boolean automaticallyAlignWidgets) {
+
+ this(parentPane,
+ parentPane.getSubjectHolder(),
+ parent,
+ automaticallyAlignWidgets);
+ }
+
+ /**
+ * Creates a new <code>AbstractSubjectPane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ *
+ * @category Constructor
+ */
+ protected AbstractPane(AbstractPane<?> parentPane,
+ PropertyValueModel<? extends T> subjectHolder,
+ Composite parent) {
+
+ this(parentPane, subjectHolder, parent, true);
+ }
+
+ /**
+ * Creates a new <code>AbstractSubjectPane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various widgets
+ * @param automaticallyAlignWidgets <code>true</code> to make the widgets
+ * this pane aligned with the widgets of the given parent pane;
+ * <code>false</code> to not align them
+ *
+ * @category Constructor
+ */
+ protected AbstractPane(AbstractPane<?> parentPane,
+ PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ boolean automaticallyAlignWidgets) {
+
+ this(subjectHolder,
+ parent,
+ parentPane.getWidgetFactory());
+
+ initialize(parentPane, automaticallyAlignWidgets);
+ }
+
+ /**
+ * Creates a new <code>AbstractSubjectPane</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ *
+ * @category Constructor
+ */
+ protected AbstractPane(PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory) {
+
+ super();
+
+ this.initialize(subjectHolder, widgetFactory);
+
+ try {
+ this.populating = true;
+
+ this.container = this.buildContainer(parent);
+ this.initializeLayout(this.container);
+ }
+ finally {
+ this.populating = false;
+ }
+ }
+
+ /**
+ * Adds the given pane's widgets (those that were registered with its
+ * left <code>ControlAligner</code>) to this pane's left
+ * <code>ControlAligner</code> so that their width can be adjusted to have
+ * the width of the widest widget.
+ *
+ * @param pane The pane containing the widgets to add
+ *
+ * @category Layout
+ */
+ protected final void addAlignLeft(AbstractPane<?> container) {
+ this.leftControlAligner.add(container.leftControlAligner);
+ }
+
+ /**
+ * Adds the given control to the collection of widgets that have their width
+ * adjust with the width of the widest widget. The left alignment is usually
+ * used for labels.
+ *
+ * @param pane The pane to add
+ *
+ * @category Layout
+ */
+ protected final void addAlignLeft(Control control) {
+ this.leftControlAligner.add(control);
+ }
+
+ /**
+ * Adds the given pane's widgets (those that were registered with its
+ * right <code>ControlAligner</code>) to this pane's right
+ * <code>ControlAligner</code> so that their width can be adjusted to have
+ * the width of the widest widget.
+ *
+ * @param pane The pane containing the widgets to add
+ *
+ * @category Layout
+ */
+ protected final void addAlignRight(AbstractPane<?> container) {
+ this.rightControlAligner.add(container.rightControlAligner);
+ }
+
+ /**
+ * Adds the given control to the collection of widgets that have their width
+ * adjust with the width of the widest widget. The left alignment is usually
+ * used for buttons.
+ *
+ * @param pane The pane to add
+ *
+ * @category Layout
+ */
+ protected final void addAlignRight(Control control) {
+ this.rightControlAligner.add(control);
+ }
+
+ /**
+ * Adds the given pane's controls (those that were registered for
+ * alignment) from this pane.
+ *
+ * @param pane The pane containing the widgets to add for
+ * alignment
+ *
+ * @category Layout
+ */
+ protected final void addPaneForAlignment(AbstractPane<?> container) {
+ addAlignLeft(container);
+ addAlignRight(container);
+ }
+
+ /**
+ * Adds any property names to the given collection in order to be notified
+ * when the actual property changes in the subject.
+ *
+ * @param propertyNames The collection of property names to register with the
+ * subject
+ */
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ }
+
+ private PropertyChangeListener buildAspectChangeListener() {
+ return new SWTPropertyChangeListenerWrapper(buildAspectChangeListener_());
+ }
+
+ private PropertyChangeListener buildAspectChangeListener_() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent e) {
+ updatePane(e.propertyName());
+ }
+ };
+ }
+
+ /**
+ * Creates a new button using the given information.
+ *
+ * @param parent The parent container
+ * @param buttonText The button's text
+ * @param buttonAction The action to be invoked when the button is pressed
+ * @return The newly created <code>Button</code>
+ *
+ * @category Layout
+ */
+ protected final Button buildButton(Composite container,
+ String text,
+ final Runnable buttonAction) {
+
+ return this.buildButton(container, text, null, buttonAction);
+ }
+
+ /**
+ * Creates a new button using the given information.
+ *
+ * @param parent The parent container
+ * @param buttonText The button's text
+ * @param helpId The topic help ID to be registered for the new check box
+ * @param buttonAction The action to be invoked when the button is pressed
+ * @return The newly created <code>Button</code>
+ *
+ * @category Layout
+ */
+ protected final Button buildButton(Composite container,
+ String text,
+ String helpId,
+ final Runnable buttonAction) {
+
+ Button button = this.widgetFactory.createButton(container, text, SWT.NULL);
+ button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ SWTUtil.asyncExec(buttonAction);
+ }
+ });
+
+ if (helpId != null) {
+ helpSystem().setHelp(button, helpId);
+ }
+
+ return button;
+ }
+
+ /**
+ * Creates a new check box using the given information.
+ *
+ * @param parent The parent container
+ * @param buttonText The button's text
+ * @param booleanHolder The holder of the selection state
+ * @return The newly created <code>Button</code>
+ *
+ * @category Layout
+ */
+ protected final Button buildCheckBox(Composite parent,
+ String buttonText,
+ WritablePropertyValueModel<Boolean> booleanHolder) {
+
+ return this.buildCheckBox(parent, buttonText, booleanHolder, null);
+ }
+
+ /**
+ * Creates a new check box using the given information.
+ *
+ * @param parent The parent container
+ * @param buttonText The button's text
+ * @param booleanHolder The holder of the selection state
+ * @param helpId The topic help ID to be registered for the new check box
+ * @return The newly created <code>Button</code>
+ *
+ * @category Layout
+ */
+ protected final Button buildCheckBox(Composite parent,
+ String buttonText,
+ WritablePropertyValueModel<Boolean> booleanHolder,
+ String helpId) {
+
+ return this.buildToggleButton(
+ parent,
+ buttonText,
+ booleanHolder,
+ helpId,
+ SWT.CHECK
+ );
+ }
+
+ /**
+ * Creates a new flat-style combo.
+ *
+ * @param container The parent container
+ * @return The newly created <code>Combo</code>
+ *
+ * @category Layout
+ */
+ protected final CCombo buildCombo(Composite container) {
+
+ container = this.fixBorderNotPainted(container);
+ CCombo combo = this.widgetFactory.createCombo(container);
+
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ combo.setLayoutData(gridData);
+
+ return combo;
+ }
+
+ /**
+ * Creates a new flat-style <code>ComboViewer</code>.
+ *
+ * @param container The parent container
+ * @param labelProvider The provider responsible to convert the combo's items
+ * into human readable strings
+ * @return The newly created <code>ComboViewer</code>
+ *
+ * @category Layout
+ */
+ protected final ComboViewer buildComboViewer(Composite container,
+ IBaseLabelProvider labelProvider) {
+
+ CCombo combo = this.buildCombo(container);
+ ComboViewer viewer = new ComboViewer(combo);
+ viewer.setLabelProvider(labelProvider);
+ return viewer;
+ }
+
+ protected Composite buildContainer(Composite parent) {
+ Composite container = this.buildPane(parent);
+
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.marginTop = 0;
+ layout.marginLeft = 0;
+ layout.marginBottom = 0;
+ layout.marginRight = 0;
+ container.setLayout(layout);
+
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ container.setLayoutData(gridData);
+
+ return container;
+ }
+
+ private PropertyChangeListener buildExpandedStateChangeListener(final Section section) {
+ return new SWTPropertyChangeListenerWrapper(buildExpandedStateChangeListener_(section));
+ }
+
+ private PropertyChangeListener buildExpandedStateChangeListener_(final Section section) {
+ return new PropertyChangeListener() {
+ public void propertyChanged(final PropertyChangeEvent e) {
+ Boolean value = (Boolean) e.newValue();
+ if (value == null) {
+ value = Boolean.TRUE;
+ }
+ section.setExpanded(value);
+ }
+ };
+ }
+
+ /**
+ * Creates a new <code>Hyperlink</code> that will invoked the given
+ * <code>Runnable</code> when selected. The given action is always invoked
+ * from the UI thread.
+ *
+ * @param parent The parent container
+ * @param text The hyperlink's text
+ * @param hyperLinkAction The action to be invoked when the link was selected
+ * return The newly created <code>Hyperlink</code>
+ */
+ protected final Hyperlink buildHyperLink(Composite parent,
+ String text,
+ final Runnable hyperLinkAction) {
+
+ Hyperlink link = this.widgetFactory.createHyperlink(parent, text);
+ link.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseUp(MouseEvent e) {
+ SWTUtil.asyncExec(hyperLinkAction);
+ }
+ });
+ return link;
+ }
+
+ /**
+ * Creates a new lable using the given information.
+ *
+ * @param parent The parent container
+ * @param labelText The label's text
+ *
+ * @category Layout
+ */
+ protected final Label buildLabel(Composite container,
+ String labelText) {
+
+ return this.widgetFactory.createLabel(container, labelText);
+ }
+
+ /**
+ * Creates a new container that will have the given center control labeled
+ * with the given label.
+ *
+ * @param container The parent container
+ * @param leftControl The widget shown to the left of the main widget
+ * @param centerControl The main widget
+ * @param rightControl The control shown to the right of the main widget
+ * @param helpId The topic help ID to be registered for the given center
+ * compositer
+ * @return The container of the label and the given center control
+ *
+ * @category Layout
+ */
+ protected final Composite buildLabeledComposite(Composite container,
+ Control leftControl,
+ Control centerControl,
+ Control rightControl,
+ String helpId) {
+
+ // Container for the label and main composite
+ container = this.buildSubPane(container, 3, 5, 0, 0, 0);
+
+ // Left control
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.BEGINNING;
+ gridData.grabExcessHorizontalSpace = false;
+ leftControl.setLayoutData(gridData);
+
+ // Re-parent the left control to the new sub pane
+ leftControl.setParent(container);
+ this.leftControlAligner.add(leftControl);
+
+ // Center control
+ gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ centerControl.setLayoutData(gridData);
+
+ // Re-parent the center control to the new sub pane
+ centerControl.setParent(container);
+
+ // Register the help id for the center control
+ if (helpId != null) {
+ helpSystem().setHelp(centerControl, helpId);
+ }
+
+ // Right control
+ if (rightControl == null) {
+ // TODO: Find a way to create a spacer that doesn't always
+ // have a size of (64, 64) (I tried with Composite and Canvas) ~PF
+ }
+ else {
+ gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL_HORIZONTAL;
+ gridData.grabExcessHorizontalSpace = false;
+
+ rightControl.setLayoutData(gridData);
+ rightControl.setParent(container);
+
+ // Re-parent the right control to the new sub pane
+ this.rightControlAligner.add(rightControl);
+
+ // Register the help id for the right control
+ if (helpId != null) {
+ helpSystem().setHelp(rightControl, helpId);
+ }
+ }
+
+ return container;
+ }
+
+ /**
+ * Creates a new container that will have the given center control labeled
+ * with the given label.
+ *
+ * @param container The parent container
+ * @param label The label used to describe the center control
+ * @param centerControl The main widget
+ * @return The container of the label and the given center control
+ *
+ * @category Layout
+ */
+ protected final Composite buildLabeledComposite(Composite container,
+ Label label,
+ Control centerControl) {
+
+ return this.buildLabeledComposite(
+ container,
+ label,
+ centerControl,
+ null
+ );
+ }
+
+ /**
+ * Creates a new container that will have the given center control labeled
+ * with the given label.
+ *
+ * @param container The parent container
+ * @param label The label used to describe the center control
+ * @param centerControl The main widget
+ * @param helpId The topic help ID to be registered for the given center
+ * control
+ * @return The container of the label and the given center control
+ *
+ * @category Layout
+ */
+ protected final Composite buildLabeledComposite(Composite container,
+ Label label,
+ Control centerControl,
+ String helpId) {
+
+ return this.buildLabeledComposite(
+ container,
+ label,
+ centerControl,
+ null,
+ helpId
+ );
+ }
+
+ /**
+ * Creates a new container that will have the given center composite labeled
+ * with the given label text.
+ *
+ * @param container The parent container
+ * @param labelText The text to label the main composite
+ * @param centerControl The main widget
+ * @return The container of the label and the given center control
+ *
+ * @category Layout
+ */
+ protected final Composite buildLabeledComposite(Composite container,
+ String labelText,
+ Control centerControl) {
+
+
+ return this.buildLabeledComposite(
+ container,
+ labelText,
+ centerControl,
+ null,
+ null
+ );
+ }
+
+ /**
+ * Creates a new container that will have the given center composite labeled
+ * with the given label text.
+ *
+ * @param container The parent container
+ * @param labelText The text to label the main composite
+ * @param centerControl The main widget
+ * @param rightControl The control shown to the right of the main widget
+ * @return The container of the label and the given center control
+ *
+ * @category Layout
+ */
+ protected final Composite buildLabeledComposite(Composite container,
+ String labelText,
+ Control centerControl,
+ Control rightControl) {
+
+
+ return this.buildLabeledComposite(
+ container,
+ labelText,
+ centerControl,
+ rightControl,
+ null
+ );
+ }
+
+ /**
+ * Creates a new container that will have the given center composite labeled
+ * with the given label text.
+ *
+ * @param container The parent container
+ * @param labelText The text to label the main composite
+ * @param centerControl The main widget
+ * @param rightControl The control shown to the right of the main widget
+ * @param helpId The topic help ID to be registered for the given center
+ * compositer
+ * @return The container of the label and the given center control
+ *
+ * @category Layout
+ */
+ protected final Composite buildLabeledComposite(Composite container,
+ String labelText,
+ Control centerControl,
+ Control rightCentrol,
+ String helpId) {
+
+ Label label = this.buildLabel(container, labelText);
+
+ return this.buildLabeledComposite(
+ container,
+ label,
+ centerControl,
+ rightCentrol,
+ helpId
+ );
+ }
+
+ /**
+ * Creates a new container that will have the given center composite labeled
+ * with the given label text.
+ *
+ * @param container The parent container
+ * @param labelText The text to label the main composite
+ * @param centerControl The main widget
+ * @param helpId The topic help ID to be registered for the given center
+ * compositer
+ * @return The container of the label and the given center control
+ *
+ * @category Layout
+ */
+ protected final Composite buildLabeledComposite(Composite container,
+ String labelText,
+ Control centerControl,
+ String helpId) {
+
+ Label label = this.buildLabel(container, labelText);
+
+ return this.buildLabeledComposite(
+ container,
+ label,
+ centerControl,
+ helpId
+ );
+ }
+
+ /**
+ * Creates a new container that will have a <code>Text</code> widget labeled
+ * with the given label text.
+ *
+ * @param container The parent container
+ * @param labelText The text to label the text field
+ * @return The container of the label and the given center control
+ *
+ * @category Layout
+ */
+ protected final Composite buildLabeledText(Composite container,
+ String labelText) {
+
+ return this.buildLabeledComposite(
+ container,
+ labelText,
+ this.buildText(container)
+ );
+ }
+
+ /**
+ * Creates a new list and notify the given selection holder when the
+ * selection changes. If the selection count is different than one than the
+ * holder will receive <code>null</code>.
+ *
+ * @param container The parent container
+ * @return The newly created <code>List</code>
+ *
+ * @category Layout
+ */
+ protected final List buildList(Composite container) {
+
+ return this.buildList(container, (String) null);
+ }
+
+ /**
+ * Creates a new list and notify the given selection holder when the
+ * selection changes. If the selection count is different than one than the
+ * holder will receive <code>null</code>.
+ *
+ * @param container The parent container
+ * @param helpId The topic help ID to be registered for the new radio button
+ * @return The newly created <code>List</code>
+ *
+ * @category Layout
+ */
+ protected final List buildList(Composite container, String helpId) {
+
+ return this.buildList(
+ container,
+ new SimplePropertyValueModel<String>(),
+ helpId
+ );
+ }
+
+ /**
+ * Creates a new list and notify the given selection holder when the
+ * selection changes. If the selection count is different than one than the
+ * holder will receive <code>null</code>.
+ *
+ * @param container The parent container
+ * @param selectionHolder The holder of the unique selected item
+ * @return The newly created <code>List</code>
+ *
+ * @category Layout
+ */
+ protected final List buildList(Composite container,
+ WritablePropertyValueModel<String> selectionHolder) {
+
+ return this.buildList(container, selectionHolder, null);
+ }
+
+ /**
+ * Creates a new list and notify the given selection holder when the
+ * selection changes. If the selection count is different than one than the
+ * holder will receive <code>null</code>.
+ *
+ * @param container The parent container
+ * @param selectionHolder The holder of the unique selected item
+ * @param helpId The topic help ID to be registered for the new radio button
+ * @return The newly created <code>List</code>
+ *
+ * @category Layout
+ */
+ protected final List buildList(Composite container,
+ WritablePropertyValueModel<String> selectionHolder,
+ String helpId) {
+
+ List list = this.widgetFactory.createList(
+ container,
+ SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI
+ );
+
+ list.addSelectionListener(buildSelectionListener(selectionHolder));
+
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.verticalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.grabExcessVerticalSpace = true;
+ list.setLayoutData(gridData);
+
+ if (helpId != null) {
+ helpSystem().setHelp(list, helpId);
+ }
+
+ return list;
+ }
+
+ /**
+ * Creates a new container without specifying any layout manager.
+ *
+ * @param container The parent of the new container
+ * @return The newly created <code>Composite</code>
+ *
+ * @category Layout
+ */
+ protected final Composite buildPane(Composite parent) {
+ return this.widgetFactory.createComposite(parent);
+ }
+
+ /**
+ * Creates a new container using the given layout manager.
+ *
+ * @param parent The parent of the new container
+ * @param layout The layout manager of the new container
+ * @return The newly created container
+ *
+ * @category Layout
+ */
+ protected final Composite buildPane(Composite parent, Layout layout) {
+
+ Composite container = this.widgetFactory.createComposite(parent);
+ container.setLayout(layout);
+
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.verticalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.grabExcessVerticalSpace = true;
+ container.setLayoutData(gridData);
+
+ return container;
+ }
+
+ /**
+ * Creates a new push button using the given information.
+ *
+ * @param parent The parent container
+ * @param buttonText The button's text
+ * @param buttonAction The action to be invoked when the button is pressed
+ * @return The newly created <code>Button</code>
+ *
+ * @category Layout
+ */
+ protected final Button buildPushButton(Composite parent,
+ String buttonText,
+ final Runnable buttonAction) {
+
+ return this.buildPushButton(parent, buttonText, null, buttonAction);
+ }
+
+ /**
+ * Creates a new push button using the given information.
+ *
+ * @param parent The parent container
+ * @param buttonText The button's text
+ * @param buttonAction The action to be invoked when the button is pressed
+ * @param helpId The topic help ID to be registered for the new radio button
+ * @return The newly created <code>Button</code>
+ *
+ * @category Layout
+ */
+ protected final Button buildPushButton(Composite parent,
+ String buttonText,
+ String helpId,
+ final Runnable buttonAction) {
+
+ Button button = this.widgetFactory.createButton(
+ parent,
+ buttonText,
+ SWT.PUSH
+ );
+
+ button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ SWTUtil.asyncExec(buttonAction);
+ }
+ });
+
+ button.setLayoutData(new GridData());
+
+ if (helpId != null) {
+ helpSystem().setHelp(button, helpId);
+ }
+
+ return button;
+ }
+
+ /**
+ * Creates a new radio button using the given information.
+ *
+ * @param parent The parent container
+ * @param buttonText The button's text
+ * @param booleanHolder The holder of the selection state
+ * @return The newly created <code>Button</code>
+ *
+ * @category Layout
+ */
+ protected final Button buildRadioButton(Composite parent,
+ String buttonText,
+ WritablePropertyValueModel<Boolean> booleanHolder) {
+
+ return this.buildRadioButton(parent, buttonText, booleanHolder, null);
+ }
+
+ /**
+ * Creates a new check box using the given information.
+ *
+ * @param parent The parent container
+ * @param buttonText The button's text
+ * @param booleanHolder The holder of the selection state
+ * @param helpId The topic help ID to be registered for the new radio button
+ * @return The newly created <code>Button</code>
+ *
+ * @category Layout
+ */
+ protected final Button buildRadioButton(Composite parent,
+ String buttonText,
+ WritablePropertyValueModel<Boolean> booleanHolder,
+ String helpId) {
+
+ return this.buildToggleButton(
+ parent,
+ buttonText,
+ booleanHolder,
+ helpId,
+ SWT.RADIO
+ );
+ }
+
+ /**
+ * Creates a new <code>Section</code> with flat style. A sub-pane is
+ * automatically added as its client and is the returned <code>Composite</code>.
+ *
+ * @param container The container of the new widget
+ * @param sectionText The text of the new section
+ * @return The <code>Section</code>'s sub-pane
+ *
+ * @category Layout
+ */
+ protected final Composite buildSection(Composite container,
+ String sectionText) {
+
+ return this.buildSection(
+ container,
+ sectionText,
+ ExpandableComposite.TITLE_BAR
+ );
+ }
+
+ /**
+ * Creates a new <code>Section</code> with flat style. A sub-pane is
+ * automatically added as its client and is the returned <code>Composite</code>.
+ *
+ * @param container The container of the new widget
+ * @param sectionText The text of the new section
+ * @param type The type of section to create
+ * @return The <code>Section</code>'s sub-pane
+ *
+ * @category Layout
+ */
+ private Composite buildSection(Composite container,
+ String sectionText,
+ int type) {
+
+ return this.buildSection(
+ container,
+ sectionText,
+ type,
+ new SimplePropertyValueModel<Boolean>(Boolean.TRUE)
+ );
+ }
+
+ /**
+ * Creates a new <code>Section</code> with flat style. A sub-pane is
+ * automatically added as its client and is the returned <code>Composite</code>.
+ *
+ * @param container The container of the new widget
+ * @param sectionText The text of the new section
+ * @param type The type of section to create
+ * @param expandedStateHolder The holder of the boolean that will dictate
+ * when to expand or collapse the section
+ * @return The <code>Section</code>'s sub-pane
+ *
+ * @category Layout
+ */
+ private Composite buildSection(Composite container,
+ String sectionText,
+ int type,
+ PropertyValueModel<Boolean> expandedStateHolder) {
+
+ Section section = this.widgetFactory.createSection(
+ container,
+ ExpandableComposite.TWISTIE | type
+ );
+
+ section.setText(sectionText);
+
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ section.setLayoutData(gridData);
+
+ Composite subPane = this.buildSubPane(section, 5, 0);
+ section.setClient(subPane);
+
+ expandedStateHolder.addPropertyChangeListener(
+ PropertyValueModel.VALUE,
+ buildExpandedStateChangeListener(section)
+ );
+
+ section.setExpanded(
+ expandedStateHolder.value() != null ? expandedStateHolder.value() : true
+ );
+
+ return subPane;
+ }
+
+ /**
+ * Creates a new <code>Section</code> with flat style. A sub-pane is
+ * automatically added as its client and is the returned <code>Composite</code>.
+ *
+ * @param container The container of the new widget
+ * @param sectionText The text of the new section
+ * @param expandedStateHolder The holder of the boolean that will dictate
+ * when to expand or collapse the section
+ * @return The <code>Section</code>'s sub-pane
+ *
+ * @category Layout
+ */
+ protected final Composite buildSection(Composite container,
+ String sectionText,
+ PropertyValueModel<Boolean> expandedStateHolder) {
+
+ return this.buildSection(
+ container,
+ sectionText,
+ ExpandableComposite.TITLE_BAR,
+ expandedStateHolder
+ );
+ }
+
+ private SelectionListener buildSelectionListener(final WritablePropertyValueModel<String> selectionHolder) {
+ return new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ List list = (List) e.widget;
+ String[] selectedItems = list.getSelection();
+ if ((selectedItems == null) || (selectedItems.length != 1)) {
+ selectionHolder.setValue(null);
+ }
+ else {
+ selectionHolder.setValue(selectedItems[0]);
+ }
+ }
+ };
+ }
+
+ private PropertyChangeListener buildSubjectChangeListener() {
+ return new SWTPropertyChangeListenerWrapper(this.buildSubjectChangeListener_());
+ }
+
+ private PropertyChangeListener buildSubjectChangeListener_() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent e) {
+ AbstractPane.this.subjectChanged(e);
+ }
+ };
+ }
+
+ /**
+ * Creates a new <code>Composite</code> used as a sub-pane.
+ *
+ * @param container The parent container
+ * @return The newly created <code>Composite</code> used as a sub-pane
+ *
+ * @category Layout
+ */
+ protected final Composite buildSubPane(Composite container) {
+ return this.buildSubPane(container, 0);
+ }
+
+ /**
+ * Creates a new <code>Composite</code> used as a sub-pane.
+ *
+ * @param container The parent container
+ * @param topMargin The extra spacing to add at the top of the pane
+ * @return The newly created <code>Composite</code> used as a sub-pane
+ *
+ * @category Layout
+ */
+ protected final Composite buildSubPane(Composite container, int topMargin) {
+ return this.buildSubPane(container, topMargin, 0);
+ }
+
+ /**
+ * Creates a new <code>Composite</code> used as a sub-pane.
+ *
+ * @param container The parent container
+ * @param topMargin The extra spacing to add at the top of the pane
+ * @param leftMargin The extra spacing to add to the left of the pane
+ * @return The newly created <code>Composite</code> used as a sub-pane
+ *
+ * @category Layout
+ */
+ protected final Composite buildSubPane(Composite container,
+ int topMargin,
+ int leftMargin) {
+
+ return this.buildSubPane(container, topMargin, leftMargin, 0, 0);
+ }
+
+ /**
+ * Creates a new <code>Composite</code> used as a sub-pane, the new widget
+ * will have its layout and layout data already initialized, the layout will
+ * be a <code>GridLayout</code> with 1 column.
+ *
+ * @param container The parent container
+ * @param topMargin The extra spacing to add at the top of the pane
+ * @param leftMargin The extra spacing to add to the left of the pane
+ * @param bottomMargin The extra spacing to add at the bottom of the pane
+ * @param rightMargin The extra spacing to add to the right of the pane
+ * @return The newly created <code>Composite</code> used as a sub-pane
+ *
+ * @category Layout
+ */
+ protected final Composite buildSubPane(Composite container,
+ int topMargin,
+ int leftMargin,
+ int bottomMargin,
+ int rightMargin) {
+
+ return this.buildSubPane(
+ container,
+ 1,
+ topMargin,
+ leftMargin,
+ bottomMargin,
+ rightMargin);
+ }
+
+ /**
+ * Creates a new <code>Composite</code> used as a sub-pane, the new widget
+ * will have its layout and layout data already initialized, the layout will
+ * be a <code>GridLayout</code> with 1 column.
+ *
+ * @param container The parent container
+ * @param topMargin The extra spacing to add at the top of the pane
+ * @param leftMargin The extra spacing to add to the left of the pane
+ * @param bottomMargin The extra spacing to add at the bottom of the pane
+ * @param rightMargin The extra spacing to add to the right of the pane
+ * @return The newly created <code>Composite</code> used as a sub-pane
+ *
+ * @category Layout
+ */
+ protected final Composite buildSubPane(Composite container,
+ int columnCount,
+ int topMargin,
+ int leftMargin,
+ int bottomMargin,
+ int rightMargin) {
+
+ GridLayout layout = new GridLayout(columnCount, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.marginTop = topMargin;
+ layout.marginLeft = leftMargin;
+ layout.marginBottom = bottomMargin;
+ layout.marginRight = rightMargin;
+
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+
+ container = this.buildPane(container, layout);
+ container.setLayoutData(gridData);
+
+ return container;
+ }
+
+ /**
+ * Creates a new <code>Section</code> with flat style. A sub-pane is
+ * automatically added as its client which can be typed cast directly as a
+ * <code>Composite</code>.
+ *
+ * @param container The container of the new widget
+ * @param sectionText The text of the new section
+ * @return The <code>Section</code>'s sub-pane
+ *
+ * @category Layout
+ */
+ protected final Composite buildSubSection(Composite container,
+ String sectionText) {
+
+ return this.buildSubSection(
+ container,
+ sectionText,
+ new SimplePropertyValueModel<Boolean>(Boolean.TRUE)
+ );
+ }
+
+ /**
+ * Creates a new <code>Section</code> with flat style. A sub-pane is
+ * automatically added as its client which can be typed cast directly as a
+ * <code>Composite</code>.
+ *
+ * @param container The container of the new widget
+ * @param sectionText The text of the new section
+ * @param expandedStateHolder The holder of the boolean that will dictate
+ * when to expand or collapse the section
+ * @return The <code>Section</code>'s sub-pane
+ *
+ * @category Layout
+ */
+ protected final Composite buildSubSection(Composite container,
+ String sectionText,
+ PropertyValueModel<Boolean> expandedStateHolder) {
+
+ return this.buildSection(
+ container,
+ sectionText,
+ SWT.NULL,
+ expandedStateHolder
+ );
+ }
+
+ /**
+ * Creates a new <code>Text</code> widget, the widget is created with the
+ * flat-style look.
+ *
+ * @param container The parent container
+ * @return The newly created <code>Text</code> widget
+ *
+ * @category Layout
+ */
+ protected final Text buildText(Composite container) {
+ return this.widgetFactory.createText(container);
+ }
+
+ /**
+ * Creates a new <code>Text</code> widget, the widget is created with the
+ * flat-style look.
+ *
+ * @param container The parent container
+ * @param helpId The topic help ID to be registered for the new text
+ * @return The newly created <code>Text</code> widget
+ *
+ * @category Layout
+ */
+ protected final Text buildText(Composite container, String helpId) {
+ Text text = this.widgetFactory.createText(container);
+
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ text.setLayoutData(gridData);
+
+ if (helpId != null) {
+ helpSystem().setHelp(text, helpId);
+ }
+
+ return text;
+ }
+
+ /**
+ * Creates a new container with a titled border.
+ *
+ * @param title The text of the titled border
+ * @param container The parent container
+ * @return The newly created <code>Composite</code> with a titled border
+ *
+ * @category Layout
+ */
+ protected final Group buildTitledPane(Composite container, String title) {
+ return this.buildTitledPane(container, title, null);
+ }
+
+ /**
+ * Creates a new container with a titled border.
+ *
+ * @param title The text of the titled border
+ * @param container The parent container
+ * @param helpId The topic help ID to be registered for the new group
+ * @return The newly created <code>Composite</code> with a titled border
+ *
+ * @category Layout
+ */
+ protected final Group buildTitledPane(Composite container,
+ String title,
+ String helpId) {
+
+ Group group = this.widgetFactory.createGroup(container, title);
+
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.marginTop = 2;
+ layout.marginLeft = 5;
+ layout.marginBottom = 9;
+ layout.marginRight = 5;
+ group.setLayout(layout);
+
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = GridData.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.verticalIndent = 0;
+ group.setLayoutData(gridData);
+
+ if (helpId != null) {
+ helpSystem().setHelp(group, helpId);
+ }
+
+ return group;
+ }
+
+ /**
+ * Creates a new toggle button (radio button or check box) using the given
+ * information.
+ *
+ * @param parent The parent container
+ * @param buttonText The button's text
+ * @param booleanHolder The holder of the selection state
+ * @param helpId The topic help ID to be registered for the new button
+ * @return The newly created <code>Button</code>
+ *
+ * @category Layout
+ */
+ private Button buildToggleButton(Composite parent,
+ String buttonText,
+ WritablePropertyValueModel<Boolean> booleanHolder,
+ String helpId,
+ int toggleButtonType) {
+
+ Button button = this.widgetFactory.createButton(
+ parent,
+ buttonText,
+ toggleButtonType
+ );
+
+ button.setLayoutData(new GridData());
+ BooleanButtonModelAdapter.adapt(booleanHolder, button);
+
+ if (helpId != null) {
+ helpSystem().setHelp(button, helpId);
+ }
+
+ return button;
+ }
+
+ /**
+ * Creates a new check box that can have 3 selection states (selected,
+ * unselected and partially selected.
+ *
+ * @param parent The parent container
+ * @param text The button's text
+ * @param booleanHolder The holder of the boolean value where <code>null</code>
+ * means partially selected
+ * @return The newly created <code>TriStateCheckBox</code>
+ */
+ protected final TriStateCheckBox buildTriStateCheckBox(Composite parent,
+ String text,
+ WritablePropertyValueModel<Boolean> booleanHolder) {
+
+ return this.buildTriStateCheckBox(parent, text, booleanHolder, null);
+ }
+
+ /**
+ * Creates a new check box that can have 3 selection states (selected,
+ * unselected and partially selected.
+ *
+ * @param parent The parent container
+ * @param text The button's text
+ * @param booleanHolder The holder of the boolean value where <code>null</code>
+ * means partially selected
+ * @param helpId The topic help ID to be registered for the new check box
+ * @return The newly created <code>TriStateCheckBox</code>
+ */
+ protected final TriStateCheckBox buildTriStateCheckBox(Composite parent,
+ String text,
+ WritablePropertyValueModel<Boolean> booleanHolder,
+ String helpId) {
+
+ TriStateCheckBox checkBox = new TriStateCheckBox(parent);
+ checkBox.setText(text);
+
+ TriStateBooleanButtonModelAdapter.adapt(
+ booleanHolder,
+ checkBox
+ );
+
+ if (helpId != null) {
+ helpSystem().setHelp(checkBox.getControl(), helpId);
+ }
+
+ return checkBox;
+ }
+
+ /**
+ * Creates a new check box that can have 3 selection states (selected,
+ * unselected and partially selected.
+ *
+ * @param parent The parent container
+ * @param text The button's text
+ * @param booleanHolder The holder of the boolean value where <code>null</code>
+ * means partially selected
+ * @param stringHolder The holder of the string to put in parenthesis after
+ * the check box's text when it is partially selected
+ * @return The newly created <code>TriStateCheckBox</code>
+ */
+ protected final TriStateCheckBox buildTriStateCheckBoxWithDefault(Composite parent,
+ String text,
+ WritablePropertyValueModel<Boolean> booleanHolder,
+ PropertyValueModel<String> stringHolder) {
+
+ return this.buildTriStateCheckBoxWithDefault(
+ parent,
+ text,
+ booleanHolder,
+ stringHolder,
+ null
+ );
+ }
+
+ /**
+ * Creates a new check box that can have 3 selection states (selected,
+ * unselected and partially selected.
+ *
+ * @param parent The parent container
+ * @param text The button's text
+ * @param booleanHolder The holder of the boolean value where <code>null</code>
+ * means partially selected
+ * @param stringHolder The holder of the string to put in parenthesis after
+ * the check box's text when it is partially selected
+ * @param helpId The topic help ID to be registered for the new check box
+ * @return The newly created <code>TriStateCheckBox</code>
+ */
+ protected final TriStateCheckBox buildTriStateCheckBoxWithDefault(Composite parent,
+ String text,
+ WritablePropertyValueModel<Boolean> booleanHolder,
+ PropertyValueModel<String> stringHolder,
+ String helpId) {
+
+ TriStateCheckBox checkBox = this.buildTriStateCheckBox(
+ parent,
+ text,
+ booleanHolder,
+ helpId
+ );
+
+ new LabeledControlUpdater(
+ new LabeledTableItem(checkBox.getCheckBox()),
+ stringHolder
+ );
+
+ return checkBox;
+ }
+
+ /**
+ * Uninstalls any listeners from the subject in order to stop being notified
+ * for changes made outside of this panes.
+ *
+ * @category Populate
+ */
+ protected void disengageListeners() {
+
+ this.log(" ->disengageListeners()");
+
+ this.subjectHolder.removePropertyChangeListener(
+ PropertyValueModel.VALUE,
+ this.subjectChangeListener
+ );
+
+ this.disengageListeners(this.subject());
+
+ for (AbstractPane<?> subPane : this.subPanes) {
+ subPane.disengageListeners();
+ }
+ }
+
+ /**
+ * Removes any property change listeners from the given subject.
+ *
+ * @param subject The old subject
+ *
+ * @category Populate
+ */
+ protected void disengageListeners(T subject) {
+ if (subject != null) {
+// this.log(" ->disengageListeners() from " + subject);
+
+ for (String propertyName : this.propertyNames()) {
+ subject.removePropertyChangeListener(propertyName, this.aspectChangeListener);
+ }
+ }
+ }
+
+ /**
+ * Notifies this pane is should dispose itself.
+ *
+ * @category Populate
+ */
+ public final void dispose() {
+ if (!this.container.isDisposed()) {
+ this.log("dispose()");
+ this.performDispose();
+ this.disengageListeners();
+ }
+ }
+
+ /**
+ * Requests this pane to dispose itself.
+ *
+ * @category Populate
+ */
+ protected void doDispose() {
+ this.log(" ->doDispose()");
+ }
+
+ /**
+ * Requests this pane to populate its widgets with the subject's values.
+ *
+ * @category Populate
+ */
+ protected void doPopulate() {
+ this.log(" ->doPopulate()");
+ }
+
+ /**
+ * Changes the enablement state of the widgets of this pane.
+ *
+ * @param enabled <code>true</code> to enable the widgets or <code>false</code>
+ * to disable them
+ *
+ * @category Layout
+ */
+ public void enableWidgets(boolean enabled) {
+ for (AbstractPane<?> subPane : this.subPanes) {
+ subPane.enableWidgets(enabled);
+ }
+ }
+
+ /**
+ * Installs the listeners on the subject in order to be notified from changes
+ * made outside of this panes.
+ *
+ * @category Populate
+ */
+ protected void engageListeners() {
+
+ this.log(" ->engageListeners()");
+
+ this.subjectHolder.addPropertyChangeListener(
+ PropertyValueModel.VALUE,
+ this.subjectChangeListener
+ );
+
+ this.engageListeners(this.subject());
+
+ for (AbstractPane<?> subPane : this.subPanes) {
+ subPane.engageListeners();
+ }
+ }
+
+ /**
+ * TODO
+ *
+ * @param subject
+ *
+ * @category Populate
+ */
+ protected void engageListeners(T subject) {
+ if (subject != null) {
+
+// this.log(" ->engageListeners() on " + subject);
+
+ for (String propertyName : this.propertyNames()) {
+ subject.addPropertyChangeListener(propertyName, this.aspectChangeListener);
+ }
+ }
+ }
+
+ /**
+ * Wraps the given <code>Composite</code> into a new <code>Composite</code>
+ * in order to have the widgets' border painted. This must be a bug in the
+ * <code>GridLayout</code> used in a form.
+ *
+ * @param container The parent of the sub-pane with 1 pixel border
+ * @return A new <code>Composite</code> that has the necessary space to paint
+ * the border
+ */
+ protected final Composite fixBorderNotPainted(Composite container) {
+ return buildSubPane(container, 1, 1, 1, 1, 1);
+ }
+
+ /**
+ * Returns the main <code>Control</code> of this pane.
+ *
+ * @return The main container
+ *
+ * @category Layout
+ */
+ public Composite getControl() {
+ return this.container;
+ }
+
+ /**
+ * Returns the subject holder used by this pane.
+ *
+ * @return The holder of the subject
+ *
+ * @category Populate
+ */
+ protected final PropertyValueModel<T> getSubjectHolder() {
+ return this.subjectHolder;
+ }
+
+ /**
+ * Returns
+ *
+ * @return
+ *
+ * @category Layout
+ */
+ protected final IWidgetFactory getWidgetFactory() {
+ return this.widgetFactory;
+ }
+
+ /**
+ * Returns the margin taken by a group box, which is the number of pixel the
+ * group box border and its margin takes before displaying its widgets plus
+ * 5 pixels since the widgets inside of the group box and the border should
+ * have that extra 5 pixels.
+ *
+ * @return The width taken by the group box border with its margin
+ *
+ * @category Layout
+ */
+ protected final int groupBoxMargin() {
+ Group group = this.widgetFactory.createGroup(Display.getCurrent().getActiveShell(), "");
+ Rectangle clientArea = group.getClientArea();
+ group.dispose();
+ return clientArea.x + 5;
+ }
+
+ /**
+ * Returns the helps system.
+ *
+ * @return The platform's help system
+ *
+ * @category Helper
+ */
+ protected final IWorkbenchHelpSystem helpSystem() {
+ return PlatformUI.getWorkbench().getHelpSystem();
+ }
+
+ /**
+ * Initializes this <code>AbstractSubjectPane</code>.
+ *
+ * @category Initialization
+ */
+ protected void initialize() {
+ }
+
+ /**
+ * Registers this pane with the parent pane.
+ *
+ * @param parentPane The parent pane
+ * @param automaticallyAlignWidgets <code>true</code> to make the widgets
+ * this pane aligned with the widgets of the given parent pane;
+ * <code>false</code> to not align them
+ *
+ * @category Initialization
+ */
+ private void initialize(AbstractPane<?> parentPane,
+ boolean automaticallyAlignWidgets) {
+
+ // Register this pane with the parent pane, it will call the methods
+ // automatically (engageListeners(), disengageListeners(), populate(),
+ // dispose(), etc)
+ parentPane.registerSubPane(this);
+
+ // Align the left and right controls with the controls from the parent
+ // pane
+ if (automaticallyAlignWidgets) {
+ parentPane.leftControlAligner .add(this.leftControlAligner);
+ parentPane.rightControlAligner.add(this.rightControlAligner);
+ }
+ }
+
+ /**
+ * Initializes this <code>AbstractSubjectPane</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param widgetFactory The factory used to create various widgets
+ *
+ * @category Initialization
+ */
+ @SuppressWarnings("unchecked")
+ private void initialize(PropertyValueModel<? extends T> subjectHolder,
+ IWidgetFactory widgetFactory)
+ {
+ Assert.isNotNull(subjectHolder, "The subject holder cannot be null");
+
+ this.subjectHolder = (PropertyValueModel<T>) subjectHolder;
+ this.widgetFactory = widgetFactory;
+ this.subPanes = new ArrayList<AbstractPane<?>>();
+ this.leftControlAligner = new ControlAligner();
+ this.rightControlAligner = new ControlAligner();
+ this.subjectChangeListener = this.buildSubjectChangeListener();
+ this.aspectChangeListener = this.buildAspectChangeListener();
+
+ this.initialize();
+ }
+
+ /**
+ * Initializes the layout of this pane.
+ *
+ * @param container The parent container
+ *
+ * @category Layout
+ */
+ protected abstract void initializeLayout(Composite container);
+
+ /**
+ * Determines whether
+ *
+ * @return
+ *
+ * @category Populate
+ */
+ protected final boolean isPopulating() {
+ return this.populating;
+ }
+
+ /**
+ * Logs the given message if the <code>Tracing.DEBUG_LAYOUT</code> is enabled.
+ *
+ * @param message The logging message
+ */
+ private void log(String message) {
+
+ if (Tracing.booleanDebugOption(Tracing.UI_LAYOUT)) {
+
+ Class<?> thisClass = getClass();
+ String className = ClassTools.shortNameFor(thisClass);
+
+ if (thisClass.isAnonymousClass()) {
+ className = className.substring(0, className.indexOf('$'));
+ className += "->" + ClassTools.shortNameFor(thisClass.getSuperclass());
+ }
+
+ Tracing.log(className + ": " + message);
+ }
+ }
+
+ /**
+ * Notifies this pane is should dispose itself.
+ *
+ * @category Populate
+ */
+ protected void performDispose() {
+ this.log(" ->performDispose()");
+
+ // Dispose this pane
+ doDispose();
+
+ // Ask the sub-panes to perform the dispose themselves
+ for (AbstractPane<?> subPane : this.subPanes) {
+ subPane.performDispose();
+ }
+ }
+
+ /**
+ * Notifies this pane to populate itself using the subject's information.
+ *
+ * @category Populate
+ */
+ public final void populate() {
+ if (!this.container.isDisposed()) {
+ this.log("populate()");
+ this.repopulate();
+ this.engageListeners();
+ }
+ }
+
+ /**
+ * Notifies the subject's property associated with the given property name
+ * has changed.
+ *
+ * @param propertyName The property name associated with the property change
+ *
+ * @category Populate
+ */
+ protected void propertyChanged(String propertyName) {
+ }
+
+ /**
+ * Returns the list of names to listen for properties changing from the
+ * subject.
+ *
+ * @return A non-<code>null</code> list of property names
+ *
+ * @category Populate
+ */
+ protected Collection<String> propertyNames() {
+ ArrayList<String> propertyNames = new ArrayList<String>();
+ addPropertyNames(propertyNames);
+ return propertyNames;
+ }
+
+ /**
+ * Registers another <code>AbstractSubjectPane</code> with this one so it can
+ * be automatically notified about certain events such as engaging or
+ * disengaging the listeners, etc.
+ *
+ * @param subPane The sub-pane to register
+ *
+ * @category Controller
+ */
+ protected final void registerSubPane(AbstractPane<?> subPane) {
+ this.subPanes.add(subPane);
+ }
+
+ /**
+ * Removes the given pane's widgets (those that were registered with
+ * its left <code>ControlAligner</code>) from this pane's left
+ * <code>ControlAligner</code> so that their width will no longer be adjusted
+ * with the width of the widest widget.
+ *
+ * @param pane The pane containing the widgets to remove
+ *
+ * @category Layout
+ */
+ protected final void removeAlignLeft(AbstractPane<?> pane) {
+ this.leftControlAligner.remove(pane.leftControlAligner);
+ }
+
+ /**
+ * Removes the given control from the collection of widgets that are aligned
+ * to have the same width when they are shown to the left side of the 3
+ * widget colums.
+ *
+ * @param pane The pane to remove, its width will no longer be
+ * ajusted to be the width of the longest widget
+ *
+ * @category Layout
+ */
+ protected final void removeAlignLeft(Control control) {
+ this.leftControlAligner.remove(control);
+ }
+
+ /**
+ * Removes the given pane's widgets (those that were registered with
+ * its right <code>ControlAligner</code>) from this pane's right
+ * <code>ControlAligner</code> so that their width will no longer be adjusted
+ * with the width of the widest widget.
+ *
+ * @param pane The pane containing the widgets to remove
+ *
+ * @category Layout
+ */
+ protected final void removeAlignRight(AbstractPane<?> pane) {
+ this.rightControlAligner.remove(pane.rightControlAligner);
+ }
+
+ /**
+ * Removes the given control from the collection of widgets that are aligned
+ * to have the same width when they are shown to the right side of the 3
+ * widget colums.
+ *
+ * @param pane The pane to remove, its width will no longer be
+ * ajusted to be the width of the longest widget
+ *
+ * @category Layout
+ */
+ protected final void removeAlignRight(Control control) {
+ this.rightControlAligner.remove(control);
+ }
+
+ /**
+ * Removes the given pane's controls (those that were registered for
+ * alignment) from this pane.
+ *
+ * @param pane The pane containing the widgets that no longer
+ * requires their width adjusted with the width of the longest widget
+ *
+ * @category Layout
+ */
+ protected final void removePaneForAlignment(AbstractPane<?> pane) {
+ removeAlignLeft(pane);
+ removeAlignRight(pane);
+ }
+
+ /**
+ * This method is called (perhaps internally) when this needs to repopulate
+ * but the object of interest has not changed.
+ *
+ * @category Populate
+ */
+ protected final void repopulate() {
+
+ this.log(" ->repopulate()");
+
+ // Populate this pane
+ try {
+ setPopulating(true);
+ doPopulate();
+ }
+ finally {
+ setPopulating(false);
+ }
+
+ // Ask the sub-panes to repopulate themselves
+ for (AbstractPane<?> subPane : this.subPanes) {
+ subPane.repopulate();
+ }
+ }
+
+ /**
+ * Determines whether this pane should be repopulate even if the subject if
+ * <code>null</code>.
+ *
+ * @return <code>true</code> is returned by default
+ */
+ protected boolean repopulateWithNullSubject() {
+ return true;
+ }
+
+ /**
+ * Sets (TODO)
+ *
+ * @param populating
+ *
+ * @category Populate
+ */
+ protected final void setPopulating(boolean populating) {
+ this.populating = populating;
+ }
+
+ /**
+ * Returns the nearest <code>Shell</code> displaying the main widget of this
+ * pane.
+ *
+ * @return The nearest window displaying this pane
+ */
+ protected final Shell shell() {
+ return this.container.getShell();
+ }
+
+ /**
+ * Returns the subject of this pane.
+ *
+ * @return The subject if this pane was not disposed; <code>null</code>
+ * if it was
+ *
+ * @category Populate
+ */
+ protected T subject() {
+ return this.subjectHolder.value();
+ }
+
+ /**
+ * The subject holder's value changed, disconnects any listeners from the
+ * old subject and connects those listeners onto the new subject.
+ *
+ * @param e The property change containing the old and new subjects
+ *
+ * @category Populate
+ */
+ @SuppressWarnings("unchecked")
+ private void subjectChanged(PropertyChangeEvent e) {
+ if (!this.container.isDisposed()) {
+ T oldSubject = (T) e.oldValue();
+ T newSubject = (T) e.newValue();
+
+ this.log("subjectChanged()");
+ this.disengageListeners(oldSubject);
+
+ // Only repopulate if it is allowed when the subject is null
+ if (newSubject != null ||
+ (newSubject == null && repopulateWithNullSubject()))
+ {
+ this.repopulate();
+ }
+
+ this.engageListeners(newSubject);
+ }
+ }
+
+ /**
+ * Unregisters the given <code>AbstractSubjectPane</code> from this one so it
+ * can no longer be automatically notified about certain events such as
+ * engaging or disengaging the listeners, etc.
+ *
+ * @param subPane The sub-pane to unregister
+ *
+ * @category Controller
+ */
+ protected final void unregisterSubPane(AbstractPane<?> subPane) {
+ this.subPanes.remove(subPane);
+ }
+
+ private void updatePane(String propertyName) {
+ if (!container.isDisposed()) {
+ populating = true;
+ try {
+ propertyChanged(propertyName);
+ }
+ finally {
+ populating = false;
+ }
+ }
+ }
+
+ public static interface IWidgetFactory {
+ Button createButton(Composite parent, String text, int style);
+ CCombo createCombo(Composite parent);
+ Composite createComposite(Composite parent);
+ Group createGroup(Composite parent, String title);
+ Hyperlink createHyperlink(Composite parent, String text);
+ Label createLabel(Composite container, String labelText);
+ List createList(Composite container, int style);
+ Section createSection(Composite parent, int style);
+ Text createText(Composite parent);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractValidatingDialog.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractValidatingDialog.java
new file mode 100644
index 0000000000..1ff3f874cd
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractValidatingDialog.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.widgets;
+
+import org.eclipse.jpt.utility.internal.node.Node;
+import org.eclipse.jpt.utility.internal.node.Problem;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * This dialog is similar to it superclass, <code>AbstractDialog</code>, with
+ * the added value of an error message label below the main panel. A subclass
+ * can set this error message as needed so that it can inform the user something
+ * incorrect has been entered.
+ * <p>
+ * If there is an error message, it will be shown. If there is a warning
+ * message, it will only be shown if there is no error message. Warning messages
+ * have a different icon than error messages.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public abstract class AbstractValidatingDialog<T extends Node> extends AbstractDialog<T> {
+
+ /**
+ * Creates a new <code>AbstractValidatingDialog</code>.
+ *
+ * @param parent The parent shell
+ */
+ public AbstractValidatingDialog(Shell parent) {
+ super(parent);
+ }
+
+ /**
+ * Creates a new <code>AbstractValidatingDialog</code>.
+ *
+ * @param parent The parent shell
+ * @param title The dialog's title
+ */
+ public AbstractValidatingDialog(Shell parent, String title) {
+ super(parent, title);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ Node.Validator buildValidator() {
+ return new Node.Validator() {
+ public void pause() {
+ }
+
+ public void resume() {
+ }
+
+ public void validate() {
+ AbstractValidatingDialog.this.validate();
+ }
+ };
+ }
+
+ protected void clearErrorMessage() {
+ setErrorMessage(null);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ boolean hasTitleArea() {
+ return true;
+ }
+
+ /**
+ * convenience method for simple error message
+ */
+ protected void setErrorMessageKey(String key, Object... argument) {
+ setErrorMessage(NLS.bind(key, argument));
+ }
+
+ /**
+ * Updates the error message, either shows the first error problem or hides
+ * the error pane. If the progress bar is shown, then the error message will
+ * not be shown.
+ */
+ private void updateErrorMessage() {
+ if (subject().hasBranchProblems()) {
+ Problem problem = subject().branchProblems().next();
+ setErrorMessageKey(problem.messageKey(), problem.messageArguments());
+ }
+ // TODO: It would be nice to add warnings to the model
+// else if (this.subject().hasBranchWarnings()) {
+// Problem problem = this.subject().branchWarnings().next();
+// this.setWarningMessageKey(problem.getMessageKey(), problem.getMessageArguments());
+// }
+ else {
+ clearErrorMessage();
+ }
+ }
+
+ private void validate() {
+ subject().validateBranch();
+ updateErrorMessage();
+ getButton(OK).setEnabled(!subject().hasBranchProblems());
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AddRemoveListPane.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AddRemoveListPane.java
new file mode 100644
index 0000000000..953248882e
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AddRemoveListPane.java
@@ -0,0 +1,250 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.widgets;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jpt.ui.internal.swt.ListBoxModelAdapter;
+import org.eclipse.jpt.ui.internal.swt.ListBoxModelAdapter.SelectionChangeEvent;
+import org.eclipse.jpt.ui.internal.swt.ListBoxModelAdapter.SelectionChangeListener;
+import org.eclipse.jpt.utility.internal.StringConverter;
+import org.eclipse.jpt.utility.internal.model.Model;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.List;
+
+/**
+ * This implementation of the <code>AddRemovePane</code> uses a <code>List</code>
+ * as its main widget.
+ * <p>
+ * Here the layot of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------- ----------- |
+ * | | Item 1 | | Add... | |
+ * | | ... | ----------- |
+ * | | Item n | ----------- |
+ * | | | | Edit... | |
+ * | | | ----------- |
+ * | | | ----------- |
+ * | | | | Remove | |
+ * | | | ----------- |
+ * | ------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class AddRemoveListPane<T extends Model> extends AddRemovePane<T>
+{
+ /**
+ * The main widget of this add/remove pane.
+ */
+ private List list;
+
+ /**
+ * Creates a new <code>AddRemoveListPane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ * @param adapter
+ * @param listHolder The <code>ListValueModel</code> containing the items
+ * @param selectedItemHolder The holder of the selected item, if more than
+ * one item or no items are selected, then <code>null</code> will be passed
+ * @param labelProvider The renderer used to format the list holder's items
+ */
+ public AddRemoveListPane(AbstractPane<? extends T> parentPane,
+ Composite parent,
+ Adapter adapter,
+ ListValueModel<?> listHolder,
+ WritablePropertyValueModel<?> selectedItemHolder,
+ ILabelProvider labelProvider) {
+
+ super(parentPane,
+ parent,
+ adapter,
+ listHolder,
+ selectedItemHolder,
+ labelProvider);
+ }
+
+ /**
+ * Creates a new <code>AddRemoveListPane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ * @param adapter
+ * @param listHolder The <code>ListValueModel</code> containing the items
+ * @param selectedItemHolder The holder of the selected item, if more than
+ * one item or no items are selected, then <code>null</code> will be passed
+ * @param labelProvider The renderer used to format the list holder's items
+ * @param helpId The topic help ID to be registered with this pane
+ */
+ public AddRemoveListPane(AbstractPane<? extends T> parentPane,
+ Composite parent,
+ Adapter adapter,
+ ListValueModel<?> listHolder,
+ WritablePropertyValueModel<?> selectedItemHolder,
+ ILabelProvider labelProvider,
+ String helpId) {
+
+ super(parentPane,
+ parent,
+ adapter,
+ listHolder,
+ selectedItemHolder,
+ labelProvider,
+ helpId);
+ }
+
+ /**
+ * Creates a new <code>AddRemoveListPane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of the subject
+ * @param adapter
+ * @param parent The parent container
+ * @param listHolder The <code>ListValueModel</code> containing the items
+ * @param selectedItemHolder The holder of the selected item, if more than
+ * one item or no items are selected, then <code>null</code> will be passed
+ * @param labelProvider The renderer used to format the list holder's items
+ */
+ public AddRemoveListPane(AbstractPane<?> parentPane,
+ PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ Adapter adapter,
+ ListValueModel<?> listHolder,
+ WritablePropertyValueModel<?> selectedItemHolder,
+ ILabelProvider labelProvider) {
+
+ super(parentPane,
+ subjectHolder,
+ parent,
+ adapter,
+ listHolder,
+ selectedItemHolder,
+ labelProvider);
+ }
+
+ /**
+ * Creates a new <code>AddRemoveListPane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of the subject
+ * @param adapter
+ * @param parent The parent container
+ * @param listHolder The <code>ListValueModel</code> containing the items
+ * @param selectedItemHolder The holder of the selected item, if more than
+ * one item or no items are selected, then <code>null</code> will be passed
+ * @param labelProvider The renderer used to format the list holder's items
+ * @param helpId The topic help ID to be registered with this pane
+ */
+ public AddRemoveListPane(AbstractPane<?> parentPane,
+ PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ Adapter adapter,
+ ListValueModel<?> listHolder,
+ WritablePropertyValueModel<?> selectedItemHolder,
+ ILabelProvider labelProvider,
+ String helpId) {
+
+ super(parentPane,
+ subjectHolder,
+ parent,
+ adapter,
+ listHolder,
+ selectedItemHolder,
+ labelProvider,
+ helpId);
+ }
+
+ private WritablePropertyValueModel<String> buildSelectedItemHolder() {
+ return new SimplePropertyValueModel<String>();
+ }
+
+ private SelectionChangeListener<Object> buildSelectionListener() {
+ return new SelectionChangeListener<Object>() {
+ public void selectionChanged(SelectionChangeEvent<Object> e) {
+ AddRemoveListPane.this.selectionChanged();
+ }
+ };
+ }
+
+ private StringConverter<Object> buildStringConverter(final ILabelProvider labelProvider) {
+ return new StringConverter<Object>() {
+ public String convertToString(Object item) {
+ return labelProvider.getText(item);
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ protected void initializeMainComposite(Composite container,
+ Adapter adapter,
+ ListValueModel<?> listHolder,
+ WritablePropertyValueModel<?> selectedItemHolder,
+ ILabelProvider labelProvider,
+ String helpId) {
+
+ list = buildList(container, buildSelectedItemHolder());
+
+ if (helpId != null) {
+ helpSystem().setHelp(list, helpId);
+ }
+
+ ListBoxModelAdapter<Object> listModel = ListBoxModelAdapter.adapt(
+ (ListValueModel<Object>) listHolder,
+ new SimplePropertyValueModel<Object>(),
+ list,
+ buildStringConverter(labelProvider)
+ );
+
+ listModel.addSelectionChangeListener(buildSelectionListener());
+ }
+
+ /**
+ * The selection has changed, update (1) the selected item holder, (2) the
+ * selection model and (3) the buttons.
+ */
+ private void selectionChanged() {
+
+ WritablePropertyValueModel<Object> selectedItemHolder = getSelectedItemHolder();
+ ObjectListSelectionModel selectionModel = getSelectionModel();
+ int selectionCount = list.getSelectionCount();
+
+ if (selectionCount == 0) {
+ selectedItemHolder.setValue(null);
+ selectionModel.clearSelection();
+ }
+ else if (selectionCount != 1) {
+ selectedItemHolder.setValue(null);
+ selectionModel.clearSelection();
+
+ for (int index : list.getSelectionIndices()) {
+ selectionModel.addSelectionInterval(index, index);
+ }
+ }
+ else {
+ int selectedIndex = list.getSelectionIndex();
+ Object selectedItem = getListHolder().get(selectedIndex);
+
+ selectedItemHolder.setValue(selectedItem);
+ selectionModel.setSelectedValue(selectedItem);
+ }
+
+ updateButtons();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AddRemovePane.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AddRemovePane.java
new file mode 100644
index 0000000000..3c7f03ecd1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AddRemovePane.java
@@ -0,0 +1,588 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.widgets;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jpt.ui.internal.JptUiMessages;
+import org.eclipse.jpt.utility.internal.model.Model;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.swing.ListModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.swing.ObjectListSelectionModel;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * The abstract definition of a pane that has add/remove buttons, up/down
+ * buttons and an option button that is kept in sync with the selected items.
+ *
+ * @version 1.0
+ * @since 2.0
+ */
+public abstract class AddRemovePane<T extends Model> extends AbstractPane<T>
+{
+ private Adapter adapter;
+ private Button addButton;
+ private Composite container;
+ private ILabelProvider labelProvider;
+ private ListValueModel<?> listHolder;
+ private Button optionalButton;
+ private Button removeButton;
+ private WritablePropertyValueModel<Object> selectedItemHolder;
+ private ObjectListSelectionModel selectionModel;
+
+ /**
+ * Creates a new <code>AddRemovePane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ * @param adapter This <code>Adapter</code> is used to dictacte the behavior
+ * of this <code>AddRemovePane</code> and by delegating to it some of the
+ * behavior
+ * @param listHolder The <code>ListValueModel</code> containing the items
+ * @param selectedItemHolder The holder of the selected item, if more than
+ * one item or no items are selected, then <code>null</code> will be passed
+ * @param labelProvider The renderer used to format the list holder's items
+ */
+ protected AddRemovePane(AbstractPane<? extends T> parentPane,
+ Composite parent,
+ Adapter adapter,
+ ListValueModel<?> listHolder,
+ WritablePropertyValueModel<?> selectedItemHolder,
+ ILabelProvider labelProvider) {
+
+ this(parentPane,
+ parent,
+ adapter,
+ listHolder,
+ selectedItemHolder,
+ labelProvider,
+ null);
+ }
+
+ /**
+ * Creates a new <code>AddRemovePane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ * @param adapter This <code>Adapter</code> is used to dictacte the behavior
+ * of this <code>AddRemovePane</code> and by delegating to it some of the
+ * behavior
+ * @param listHolder The <code>ListValueModel</code> containing the items
+ * @param selectedItemHolder The holder of the selected item, if more than
+ * one item or no items are selected, then <code>null</code> will be passed
+ * @param labelProvider The renderer used to format the list holder's items
+ * @param helpId The topic help ID to be registered with this pane
+ */
+ protected AddRemovePane(AbstractPane<? extends T> parentPane,
+ Composite parent,
+ Adapter adapter,
+ ListValueModel<?> listHolder,
+ WritablePropertyValueModel<?> selectedItemHolder,
+ ILabelProvider labelProvider,
+ String helpId) {
+
+ super(parentPane, parent);
+
+ initialize(
+ adapter,
+ listHolder,
+ selectedItemHolder,
+ labelProvider
+ );
+
+ initializeLayout(
+ adapter,
+ listHolder,
+ selectedItemHolder,
+ labelProvider,
+ helpId
+ );
+ }
+
+ /**
+ * Creates a new <code>AddRemovePane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of the subject
+ * @param adapter This <code>Adapter</code> is used to dictacte the behavior
+ * of this <code>AddRemovePane</code> and by delegating to it some of the
+ * behavior
+ * @param parent The parent container
+ * @param listHolder The <code>ListValueModel</code> containing the items
+ * @param selectedItemHolder The holder of the selected item, if more than
+ * one item or no items are selected, then <code>null</code> will be passed
+ * @param labelProvider The renderer used to format the list holder's items
+ */
+ protected AddRemovePane(AbstractPane<?> parentPane,
+ PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ Adapter adapter,
+ ListValueModel<?> listHolder,
+ WritablePropertyValueModel<?> selectedItemHolder,
+ ILabelProvider labelProvider) {
+
+ this(parentPane,
+ subjectHolder,
+ parent,
+ adapter,
+ listHolder,
+ selectedItemHolder,
+ labelProvider,
+ null);
+ }
+
+ /**
+ * Creates a new <code>AddRemovePane</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of the subject
+ * @param adapter This <code>Adapter</code> is used to dictacte the behavior
+ * of this <code>AddRemovePane</code> and by delegating to it some of the
+ * behavior
+ * @param parent The parent container
+ * @param listHolder The <code>ListValueModel</code> containing the items
+ * @param selectedItemHolder The holder of the selected item, if more than
+ * one item or no items are selected, then <code>null</code> will be passed
+ * @param labelProvider The renderer used to format the list holder's items
+ * @param helpId The topic help ID to be registered with this pane
+ */
+ protected AddRemovePane(AbstractPane<?> parentPane,
+ PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ Adapter adapter,
+ ListValueModel<?> listHolder,
+ WritablePropertyValueModel<?> selectedItemHolder,
+ ILabelProvider labelProvider,
+ String helpId) {
+
+ super(parentPane, subjectHolder, parent);
+
+ initialize(
+ adapter,
+ listHolder,
+ selectedItemHolder,
+ labelProvider
+ );
+
+ initializeLayout(
+ adapter,
+ listHolder,
+ selectedItemHolder,
+ labelProvider,
+ helpId
+ );
+ }
+
+ /**
+ * @category Add
+ */
+ protected void addItem() {
+ adapter.addNewItem(selectionModel);
+ }
+
+ /**
+ * @category Initialize
+ */
+ protected Adapter buildAdapter() {
+ return adapter;
+ }
+
+ /**
+ * @category Add
+ */
+ protected Button buildAddButton(Composite parent) {
+ return buildButton(
+ parent,
+ adapter.addButtonText(),
+ buildAddItemAction()
+ );
+ }
+
+ /**
+ * @category Add
+ */
+ private Runnable buildAddItemAction() {
+ return new Runnable() {
+ public void run() {
+ AddRemovePane.this.addItem();
+ }
+ };
+ }
+
+// private ListChangeListener/*<Object>*/ buildListChangeListener() {
+// return new ListChangeAdapter/*<Object>*/() {
+// @Override
+// public void listChanged(ListChangeEvent/*<Object>*/ e) {
+// AddRemovePane.this.updateButtons();
+// }
+// };
+// }
+
+ /**
+ * @category Option
+ */
+ private Runnable buildOptionalAction() {
+ return new Runnable() {
+ public void run() {
+ }
+ };
+ }
+
+ /**
+ * @category Option
+ */
+ protected Button buildOptionalButton(Composite container) {
+ return buildButton(
+ container,
+ adapter.optionalButtonText(),
+ buildOptionalAction()
+ );
+ }
+
+ /**
+ * @category Add
+ */
+ protected Button buildRemoveButton(Composite parent) {
+ return buildButton(
+ parent,
+ adapter.removeButtonText(),
+ buildRemoveItemsAction()
+ );
+ }
+
+ /**
+ * @category Remove
+ */
+ private Runnable buildRemoveItemsAction() {
+ return new Runnable() {
+ public void run() {
+ AddRemovePane.this.removeItems();
+ }
+ };
+ }
+
+ protected ObjectListSelectionModel buildRowSelectionModel(ListValueModel<?> listModel) {
+ return new ObjectListSelectionModel(new ListModelAdapter(listModel));
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public void enableWidgets(boolean enabled) {
+ super.enableWidgets(enabled);
+ updateButtons();
+ }
+
+ protected final Composite getContainer() {
+ return container;
+ }
+
+ protected final ILabelProvider getLabelProvider() {
+ return labelProvider;
+ }
+
+ protected final ListValueModel<?> getListHolder() {
+ return listHolder;
+ }
+
+ protected final WritablePropertyValueModel<Object> getSelectedItemHolder() {
+ return selectedItemHolder;
+ }
+
+ public final ObjectListSelectionModel getSelectionModel() {
+ return selectionModel;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void initialize(Adapter adapter,
+ ListValueModel<?> listHolder,
+ WritablePropertyValueModel<?> selectedItemHolder,
+ ILabelProvider labelProvider)
+ {
+ this.listHolder = listHolder;
+ this.labelProvider = labelProvider;
+ this.adapter = (adapter == null) ? buildAdapter() : adapter;
+ this.selectedItemHolder = (WritablePropertyValueModel<Object>) selectedItemHolder;
+ this.selectionModel = new ObjectListSelectionModel(new ListModelAdapter(listHolder));
+ }
+
+ protected void initializeButtonPane(Composite container, String helpId) {
+
+ container = buildPane(container);
+
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.marginTop = 0;
+ layout.marginLeft = 0;
+ layout.marginBottom = 0;
+ layout.marginRight = 0;
+ container.setLayout(layout);
+ container.setLayoutData(new GridData());
+
+ // Add button
+ addButton = buildAddButton(container);
+ addAlignRight(addButton);
+
+ // Optional button
+ if (adapter.hasOptionalButton()) {
+ optionalButton = buildOptionalButton(container);
+ addAlignRight(optionalButton);
+ }
+
+ // Remove button
+ removeButton = buildRemoveButton(container);
+ addAlignRight(removeButton);
+
+ // Update the help topic ID
+ if (helpId != null) {
+ helpSystem().setHelp(addButton, helpId);
+ helpSystem().setHelp(removeButton, helpId);
+
+ if (optionalButton != null) {
+ helpSystem().setHelp(optionalButton, helpId);
+ }
+ }
+
+// upButton = buildUpButton((adapter instanceof UpDownAdapter) ? (UpDownAdapter) adapter : null);
+// downButton = buildDownButton((adapter instanceof UpDownAdapter) ? (UpDownAdapter) adapter : null);
+// gotoButton = buildGotoButton();
+// component = buildComponent();
+ }
+
+ protected void initializeLayout(Adapter adapter,
+ ListValueModel<?> listHolder,
+ WritablePropertyValueModel<?> selectedItemHolder,
+ ILabelProvider labelProvider,
+ String helpId) {
+
+ initializeMainComposite(
+ container,
+ adapter,
+ listHolder,
+ selectedItemHolder,
+ labelProvider,
+ helpId);
+
+ initializeButtonPane(container, helpId);
+ enableWidgets(subject() != null);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+ this.container = buildSubPane(container, 2, 0, 0, 0, 0);
+ }
+
+ /**
+ * Initializes the main widget of this add/remove pane.
+ *
+ * @param container The parent container
+ * @param adapter This <code>Adapter</code> is used to dictacte the behavior
+ * of this <code>AddRemovePane</code> and by delegating to it some of the
+ * behavior
+ * @param listHolder The <code>ListValueModel</code> containing the items
+ * @param selectedItemHolder The holder of the selected item, if more than
+ * one item or no items are selected, then <code>null</code> will be passed
+ * @param labelProvider The renderer used to format the list holder's items
+ * @param helpId The topic help ID to be registered with this pane or
+ * <code>null</code> if it was not specified
+ */
+ protected abstract void initializeMainComposite(Composite container,
+ Adapter adapter,
+ ListValueModel<?> listHolder,
+ WritablePropertyValueModel<?> selectedItemHolder,
+ ILabelProvider labelProvider,
+ String helpId);
+
+ /**
+ * @category Remove
+ */
+ protected void removeItems() {
+ adapter.removeSelectedItems(selectionModel);
+ }
+
+ /**
+ * @category UpdateButtons
+ */
+ protected void updateAddButton(Button addButton) {
+ addButton.setEnabled(
+ getControl().isEnabled() &&
+ (subject() != null)
+ );
+ }
+
+ /**
+ * @category UpdateButtons
+ */
+ protected void updateButtons() {
+ if (container.isDisposed()) {
+ return;
+ }
+
+ updateAddButton(addButton);
+ updateRemoveButton(removeButton);
+ updateOptionalButton(optionalButton);
+ }
+
+ /**
+ * @category UpdateButtons
+ */
+ protected void updateOptionalButton(Button optionalButton) {
+ if (optionalButton != null) {
+ optionalButton.setEnabled(
+ getControl().isEnabled() &&
+ adapter.enableOptionOnSelectionChange(selectionModel)
+ );
+ }
+ }
+
+ /**
+ * @category UpdateButtons
+ */
+ protected void updateRemoveButton(Button removeButton) {
+ removeButton.setEnabled(
+ getControl().isEnabled() &&
+ selectionModel.selectedValue() != null
+ );
+ }
+
+ /**
+ * An abstract implementation of <code>Adapter</code>.
+ */
+ public static abstract class AbstractAdapter implements Adapter {
+
+ private String addButtonText;
+ private boolean hasOptionalButton;
+ private String optionalButtonText;
+ private String removeButtonText;
+
+ public AbstractAdapter() {
+ this(JptUiMessages.AddRemovePane_AddButtonText,
+ JptUiMessages.AddRemovePane_RemoveButtonText);
+ }
+
+ public AbstractAdapter(boolean hasOptionalButton) {
+ super();
+ this.hasOptionalButton = hasOptionalButton;
+ }
+
+ public AbstractAdapter(String optionalButtonText) {
+ this(true);
+ this.optionalButtonText = optionalButtonText;
+ }
+
+ public AbstractAdapter(String addButtonText,
+ String removeButtonText) {
+
+ super();
+ this.addButtonText = addButtonText;
+ this.removeButtonText = removeButtonText;
+ }
+
+ public AbstractAdapter(String addButtonText,
+ String removeButtonText,
+ String optionalButtonText) {
+
+ this(optionalButtonText);
+ this.addButtonText = addButtonText;
+ this.removeButtonText = removeButtonText;
+ }
+
+ public String addButtonText() {
+ return addButtonText;
+ }
+
+ public boolean enableOptionOnSelectionChange(ObjectListSelectionModel listSelectionModel) {
+ return listSelectionModel.selectedValuesSize() == 1;
+ }
+
+ public boolean hasOptionalButton() {
+ return hasOptionalButton;
+ }
+
+ public String optionalButtonText() {
+ return optionalButtonText;
+ }
+
+ public void optionOnSelection(ObjectListSelectionModel listSelectionModel) {
+ }
+
+ public String removeButtonText() {
+ return removeButtonText;
+ }
+
+ public void setAddButtonText(String addButtonText) {
+ this.addButtonText = addButtonText;
+ }
+
+ public void setOptionalButtonText(String optionalButtonText) {
+ this.optionalButtonText = optionalButtonText;
+ }
+
+ public void setRemoveButtonText(String removeButtonText) {
+ this.removeButtonText = removeButtonText;
+ }
+ }
+
+ /**
+ * This adapter is used to perform the actual action when adding a new item
+ * or removing the selected items. It is possible to add an optional button.
+ */
+ public static interface Adapter {
+
+ /**
+ *
+ */
+ String addButtonText();
+
+ /**
+ * Invoked when the user selects the Add button.
+ */
+ void addNewItem(ObjectListSelectionModel listSelectionModel);
+
+ /**
+ * Invoked when selection changes. Implementation dictates whether button
+ * should be enabled.
+ */
+ boolean enableOptionOnSelectionChange(ObjectListSelectionModel listSelectionModel);
+
+ /**
+ *
+ */
+ boolean hasOptionalButton();
+
+ /**
+ * Resource string key for the optional button.
+ */
+ String optionalButtonText();
+
+ /**
+ * Invoked when the user selects the optional button
+ */
+ void optionOnSelection(ObjectListSelectionModel listSelectionModel);
+
+ /**
+ *
+ */
+ String removeButtonText();
+
+ /**
+ * Invoked when the user selects the Remove button.
+ */
+ void removeSelectedItems(ObjectListSelectionModel listSelectionModel);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/EnumComboViewer.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/EnumComboViewer.java
new file mode 100644
index 0000000000..5ad23152f0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/EnumComboViewer.java
@@ -0,0 +1,361 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.ui.internal.widgets;
+
+import java.text.Collator;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Comparator;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jpt.ui.internal.JptUiMessages;
+import org.eclipse.jpt.utility.internal.ClassTools;
+import org.eclipse.jpt.utility.internal.model.Model;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This pane simply shows a combo where its data is populating through
+ * {@link #choices()} and a default value can also be added.
+ * <p>
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------------------- |
+ * | | I |v| |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+@SuppressWarnings("nls")
+public abstract class EnumComboViewer<T extends Model, V> extends AbstractPane<T>
+{
+ /**
+ * The main widget of this pane.
+ */
+ private ComboViewer comboViewer;
+
+ /**
+ * A constant used to represent the <code>null</code> value.
+ */
+ private static final String NULL_VALUE = "null";
+
+ /**
+ * Creates a new <code>EnumComboViewer</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various widgets
+ */
+ protected EnumComboViewer(AbstractPane<? extends T> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ /**
+ * Creates a new <code>EnumComboViewer</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various widgets
+ */
+ protected EnumComboViewer(AbstractPane<?> parentPane,
+ PropertyValueModel<? extends T> subjectHolder,
+ Composite parent) {
+
+ super(parentPane, subjectHolder, parent);
+ }
+
+ /**
+ * Creates a new <code>EnumComboViewer</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various widgets
+ */
+ protected EnumComboViewer(PropertyValueModel<? extends T> subjectHolder,
+ Composite parent,
+ IWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(propertyName());
+ }
+
+ /**
+ * Creates the list of choices and add an extra element that represents the
+ * default value.
+ *
+ * @return The combo's choices including the default value
+ */
+ private Object[] buildChoices() {
+ V[] choices = choices();
+ Object[] extendedChoices;
+
+ if (subject() != null) {
+ extendedChoices = new Object[choices.length + 1];
+ System.arraycopy(choices, 0, extendedChoices, 1, choices.length);
+ extendedChoices[0] = NULL_VALUE;
+ }
+ else {
+ extendedChoices = choices();
+ }
+
+ Arrays.sort(extendedChoices, buildComparator());
+ return extendedChoices;
+ }
+
+ private Comparator<Object> buildComparator() {
+ return new Comparator<Object>() {
+ final LabelProvider labelProvider = buildLabelProvider();
+
+ public int compare(Object value1, Object value2) {
+ String displayString1 = labelProvider.getText(value1);
+ String displayString2 = labelProvider.getText(value2);
+ return Collator.getInstance().compare(displayString1, displayString2);
+ }
+ };
+ }
+
+ /**
+ * Retrieves the localized string from the given NLS class by creating the
+ * key. That key is the concatenation of the composite's short class name
+ * with the toString() of the given value separated by an underscore.
+ *
+ * @param nlsClass The NLS class used to retrieve the localized text
+ * @param compositeClass The class used for creating the key, its short class
+ * name is the beginning of the key
+ * @param value The value used to append its toString() to the generated key
+ * @return The localized text associated with the value
+ */
+ protected final String buildDisplayString(Class<?> nlsClass,
+ Class<?> compositeClass,
+ Object value) {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append(ClassTools.shortNameFor(compositeClass));
+ sb.append("_");
+ sb.append(value.toString().toLowerCase());
+
+ return (String) ClassTools.staticFieldValue(nlsClass, sb.toString());
+ }
+
+ /**
+ * Retrieves the localized string from the given NLS class by creating the
+ * key. That key is the concatenation of the composite's short class name
+ * with the toString() of the given value separated by an underscore.
+ *
+ * @param nlsClass The NLS class used to retrieve the localized text
+ * @param composite The object used to retrieve the short class name that is
+ * the beginning of the key
+ * @param value The value used to append its toString() to the generated key
+ * @return The localized text associated with the value
+ */
+ protected final String buildDisplayString(Class<?> nlsClass,
+ Object composite,
+ Object value) {
+
+ return this.buildDisplayString(nlsClass, composite.getClass(), value);
+ }
+
+ /**
+ * Creates the display string for the given element. If the element is the
+ * virtual <code>null</code> value then its display string will be "Default"
+ * appended by the actual default value, if it exists.
+ *
+ * @param value The value to convert into a human readable string
+ * @return The string representation of the given element
+ */
+ @SuppressWarnings("unchecked")
+ private String buildDisplayString(Object value) {
+ if (value == NULL_VALUE) {
+ V defaultValue = (subject() != null) ? defaultValue() : null;
+
+ if (defaultValue != null) {
+ String displayString = displayString(defaultValue);
+ return NLS.bind(JptUiMessages.EnumComboViewer_defaultWithDefault, displayString);
+ }
+ else {
+ return JptUiMessages.EnumComboViewer_default;
+ }
+ }
+
+ return displayString((V) value);
+ }
+
+ private LabelProvider buildLabelProvider() {
+ return new LabelProvider() {
+ @Override
+ public String getText(Object element) {
+ return buildDisplayString(element);
+ }
+ };
+ }
+
+ private ISelection buildSelection() {
+ Object value = (subject() != null) ? getValue() : null;
+
+ if (value == null) {
+ value = NULL_VALUE;
+ }
+
+ return new StructuredSelection(value);
+ }
+
+ @SuppressWarnings("unchecked")
+ private ISelectionChangedListener buildSelectionChangedListener() {
+ return new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent e) {
+
+ if (isPopulating()) {
+ return;
+ }
+
+ StructuredSelection selection = (StructuredSelection) e.getSelection();
+ Object value = selection.getFirstElement();
+
+ // Convert the default "null" value to a real null
+ if (value == NULL_VALUE) {
+ value = null;
+ }
+
+ EnumComboViewer.this.setValue((V) value);
+ }
+ };
+ }
+
+ /**
+ * Returns the possible choices to show in the viewer.
+ *
+ * @return The items to show in the combos
+ */
+ protected abstract V[] choices();
+
+ /**
+ * Returns the default value, this method is not called if the subject is
+ * <code>null</code>.
+ *
+ * @return The value that is declared as being the default when it is not
+ * defined or <code>null</code> if there is no default value
+ */
+ protected abstract V defaultValue();
+
+ /**
+ * Returns the displayable string for the given value.
+ *
+ * @param value The value to translate into a human readable string
+ * @return The localized text representing the given value
+ */
+ protected abstract String displayString(V value);
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void doPopulate() {
+ super.doPopulate();
+ this.populateCombo();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ public void enableWidgets(boolean enabled) {
+ super.enableWidgets(enabled);
+
+ if (!this.comboViewer.getCCombo().isDisposed()) {
+ this.comboViewer.getCCombo().setEnabled(enabled);
+ }
+ }
+
+ protected final CCombo getCombo() {
+ return this.comboViewer.getCCombo();
+ }
+
+ /**
+ * Retrieves the subject's value. The subject is never <code>null</code>.
+ *
+ * @return The subject' value, which can be <code>null</code>
+ */
+ protected abstract V getValue();
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ this.comboViewer = buildComboViewer(container, buildLabelProvider());
+ this.comboViewer.addSelectionChangedListener(buildSelectionChangedListener());
+ }
+
+ /**
+ * Populates
+ */
+ private void populateCombo() {
+ this.getCombo().removeAll();
+ this.comboViewer.add(this.buildChoices());
+ this.updateSelection();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void propertyChanged(String propertyName) {
+ super.propertyChanged(propertyName);
+ this.updateSelection();
+ }
+
+ /**
+ * Returns the property name used to listen for changes of the value when it
+ * is done outside of this viewer.
+ *
+ * @return The property name associated with the value being shown by this
+ * viewer
+ * @deprecated Use {@link #addPropertyNames(Collection)}
+ */
+ @Deprecated
+ protected String propertyName() {
+ return "";
+ }
+
+ /**
+ * Requests the given new value be set on the subject.
+ *
+ * @param value The new value to be set
+ */
+ protected abstract void setValue(V value);
+
+ /**
+ * Updates the combo's selected item.
+ */
+ private void updateSelection() {
+ this.comboViewer.setSelection(this.buildSelection());
+ this.comboViewer.getCCombo().setSelection(new Point(0, 0));
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/NullPostExecution.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/NullPostExecution.java
new file mode 100644
index 0000000000..1f5edba3ef
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/NullPostExecution.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.widgets;
+
+import org.eclipse.jface.dialogs.Dialog;
+
+/**
+ * A <code>null</code> instance of <code>PostExecution</code>.
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public final class NullPostExecution implements PostExecution<Dialog> {
+
+ /**
+ * The singleton instance of this <code>NullPostExecution</code>.
+ */
+ private static PostExecution<Dialog> INSTANCE;
+
+ /**
+ * Creates a new <code>NullPostExecution</code>.
+ */
+ private NullPostExecution() {
+ super();
+ }
+
+ /**
+ * Returns the singleton instance of this <code>NullPostExecution</code>.
+ *
+ * @param <T> The dialog where this <code>PostExecution</code> will be used
+ * @return The singleton instance with the proper type
+ */
+ @SuppressWarnings("unchecked")
+ public static synchronized <T extends Dialog> PostExecution<T> instance() {
+
+ if (INSTANCE == null) {
+ INSTANCE = new NullPostExecution();
+ }
+
+ return (PostExecution<T>) INSTANCE;
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ public void execute(Dialog dialog) {
+ // Nothing to do
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/PostExecution.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/PostExecution.java
new file mode 100644
index 0000000000..0b6b920ba1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/PostExecution.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.widgets;
+
+import org.eclipse.jface.dialogs.Dialog;
+
+/**
+ * This <code>PostExecution</code> is used to post execute a portion of code
+ * once a dialog, that was launched into a different UI thread, has been
+ * disposed.
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public interface PostExecution<T extends Dialog> {
+
+ /**
+ * Notifies this post exection the dialog that was launched into a different
+ * UI thread has been disposed.
+ *
+ * @param dialog The dialog that was launched into a different thread
+ */
+ public void execute(T dialog);
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/TriStateCheckBox.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/TriStateCheckBox.java
new file mode 100644
index 0000000000..f655c12816
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/TriStateCheckBox.java
@@ -0,0 +1,351 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.internal.widgets;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+
+/**
+ * This <code>TriStateCheckBox</code> is responsible to handle three states:
+ * unchecked, checked and partially selected. Either from a mouse selection,
+ * keyboard selection or programmatically, the selection state is using a
+ * <code>Boolean</code> value where a <code>null</code> value means partially
+ * selected.
+ * <p>
+ * The order of state state is: unchecked -> partially selected -> checked.
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public final class TriStateCheckBox {
+
+ /**
+ * Flag used to prevent the selection listener from changing the selection
+ * state when the mouse is changing it since the selection state is called
+ * after the mouse down event and before the mouse up event.
+ */
+ private boolean handledByMouseEvent;
+
+ /**
+ * The current selection state.
+ */
+ private TriState state;
+
+ /**
+ * A tri-state check box can only be used within a tree or table, we used
+ * here the table widget.
+ */
+ private Table table;
+
+ /**
+ * Creates a new <code>TriStateCheckBox</code>.
+ *
+ * @param parent The parent composite
+ */
+ public TriStateCheckBox(Composite parent) {
+ super();
+
+ this.state = TriState.UNCHECKED;
+ this.buildWidgets(parent);
+ }
+
+ /**
+ * @see org.eclipse.swt.widgets.Widget#addDisposeListener(DisposeListener)
+ */
+ public void addDisposeListener(DisposeListener disposeListener) {
+ this.table.addDisposeListener(disposeListener);
+ }
+
+ /**
+ * @see Table#addSelectionListener(SelectionListener)
+ */
+ public void addSelectionListener(SelectionListener selectionListener) {
+ this.table.addSelectionListener(selectionListener);
+ }
+
+ private MouseAdapter buildMouseListener() {
+
+ return new MouseAdapter() {
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+
+ handledByMouseEvent = true;
+
+ TriStateCheckBox.this.changeTriState();
+ TriStateCheckBox.this.updateCheckBox();
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+
+ TriStateCheckBox.this.updateCheckBox();
+ }
+ };
+ }
+
+ private SelectionAdapter buildSelectionListener() {
+
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+
+ if (handledByMouseEvent) {
+ handledByMouseEvent = false;
+ }
+ else {
+ TriStateCheckBox.this.changeTriState();
+ TriStateCheckBox.this.updateCheckBox();
+ }
+ }
+ };
+ }
+
+ private TriState buildState(Boolean selection) {
+
+ if (selection == null) {
+ return TriState.PARTIALLY_CHECKED;
+ }
+
+ return selection.booleanValue() ? TriState.CHECKED : TriState.UNCHECKED;
+ }
+
+ private Layout buildTableLayout() {
+
+ return new Layout() {
+
+ @Override
+ protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
+ Rectangle bounds = TriStateCheckBox.this.getCheckBox().getBounds();
+ return new Point(bounds.x + bounds.width, bounds.y + bounds.height);
+ }
+
+ private int indentation() {
+ if (Platform.OS_WIN32.equals(Platform.getOS())) {
+ try {
+ String version = System.getProperty("os.version");
+
+ // Under Vista, the check box has to be indented by -6
+ // but under XP, it needs to remain 0
+ if (Double.parseDouble(version) >= 6) {
+ return 6;
+ }
+ }
+ catch (Exception e) {
+ // Ignore and return 0
+ }
+ }
+
+ return 0;
+ }
+
+ @Override
+ protected void layout(Composite composite, boolean flushCache) {
+
+ Rectangle bounds = TriStateCheckBox.this.getCheckBox().getBounds();
+ int indentation = indentation();
+
+ TriStateCheckBox.this.table.setBounds(
+ -indentation,
+ 0,
+ bounds.x + bounds.width + indentation,
+ bounds.y + bounds.height
+ );
+ }
+ };
+ }
+
+ private void buildWidgets(Composite parent) {
+
+ parent = new Composite(parent, SWT.NULL);
+ parent.setLayout(this.buildTableLayout());
+
+ this.table = new Table(parent, SWT.CHECK | SWT.SINGLE | SWT.TRANSPARENT);
+ this.table.addMouseListener(buildMouseListener());
+ this.table.addSelectionListener(buildSelectionListener());
+ this.table.getHorizontalBar().setVisible(false);
+ this.table.getVerticalBar().setVisible(false);
+
+ new TableItem(this.table, SWT.CHECK);
+ }
+
+ private void changeTriState() {
+
+ if (this.state == TriState.UNCHECKED) {
+ this.state = TriState.PARTIALLY_CHECKED;
+ }
+ else if (this.state == TriState.CHECKED) {
+ this.state = TriState.UNCHECKED;
+ }
+ else {
+ this.state = TriState.CHECKED;
+ }
+ }
+
+ /**
+ * Returns the actual <code>TableItem</code> used to show a tri-state check
+ * box.
+ *
+ * @return The unique item of the table that handles tri-state selection
+ */
+ public TableItem getCheckBox() {
+ return this.table.getItem(0);
+ }
+
+ /**
+ * Returns the main widget of the tri-state check box.
+ *
+ * @return The main composite used to display the tri-state check box
+ */
+ public Control getControl() {
+ return this.table.getParent();
+ }
+
+ /**
+ * Returns the check box's image.
+ *
+ * @return The image of the check box
+ */
+ public Image getImage() {
+ return this.getCheckBox().getImage();
+ }
+
+ /**
+ * Returns the selection state of the check box.
+ *
+ * @return Either <code>true</code> or <code>false</code> for checked and
+ * unchecked; or <code>null</code> for partially selected
+ */
+ public Boolean getSelection() {
+ return (this.state == TriState.PARTIALLY_CHECKED) ? null : (this.state == TriState.CHECKED);
+ }
+
+ /**
+ * Returns the check box's text.
+ *
+ * @return The text of the check box
+ */
+ public String getText() {
+ return this.getCheckBox().getText();
+ }
+
+ /**
+ * Determines whether the check box is enabled or not.
+ *
+ * @return <code>true</code> if the check box is enabled; <code>false</code>
+ * otherwise
+ */
+ public boolean isEnabled() {
+ return this.table.isEnabled();
+ }
+
+ /**
+ * @see org.eclipse.swt.widgets.Widget#removeDisposeListener(DisposeListener)
+ */
+ public void removeDisposeListener(DisposeListener disposeListener) {
+ this.table.removeDisposeListener(disposeListener);
+ }
+
+ /**
+ * @see Table#removeSelectionListener(SelectionListener)
+ */
+ public void removeSelectionListener(SelectionListener selectionListener) {
+ this.table.removeSelectionListener(selectionListener);
+ }
+
+ /**
+ * Changes the enablement state of the widgets of this pane.
+ *
+ * @param enabled <code>true</code> to enable the widgets or <code>false</code>
+ * to disable them
+ */
+ public void setEnabled(boolean enabled) {
+ this.table.setEnabled(enabled);
+ }
+
+ /**
+ * Sets the check box's image.
+ *
+ * @param image The new image of the check box
+ */
+ public void setImage(Image image) {
+ // TODO: Not sure this will update the layout, if that is the case,
+ // then copy the code from LabeledTableItem.updateTableItem()
+ this.getCheckBox().setImage(image);
+ }
+
+ /**
+ * Changes the selection state of the check box.
+ *
+ * @param selection Either <code>true</code> or <code>false</code> for
+ * checked and unchecked; or <code>null</code> for partially selected
+ */
+ public void setSelection(Boolean selection) {
+ TriState oldState = this.state;
+ this.state = this.buildState(selection);
+
+ if (oldState != this.state) {
+ this.updateCheckBox();
+ }
+ }
+
+ /**
+ * Sets the check box's text.
+ *
+ * @param text The new text of the check box
+ */
+ public void setText(String text) {
+ // TODO: Not sure this will update the layout, if that is the case,
+ // then copy the code from LabeledTableItem.updateTableItem()
+ this.getCheckBox().setText(text);
+ }
+
+ /**
+ * Updates the selection state of the of the check box based on the tri-state
+ * value.
+ */
+ private void updateCheckBox() {
+ TableItem checkBox = this.getCheckBox();
+
+ if (this.state == TriState.PARTIALLY_CHECKED) {
+ checkBox.setChecked(true);
+ checkBox.setGrayed(true);
+ }
+ else {
+ checkBox.setGrayed(false);
+ checkBox.setChecked(this.state == TriState.CHECKED);
+ }
+ }
+
+ /**
+ * An enum containing the possible selection.
+ */
+ public enum TriState {
+ CHECKED,
+ PARTIALLY_CHECKED,
+ UNCHECKED
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/DatabaseReconnectWizardPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/DatabaseReconnectWizardPage.java
index 5344c188b7..80509f9f86 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/DatabaseReconnectWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/DatabaseReconnectWizardPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -121,6 +121,7 @@ public class DatabaseReconnectWizardPage extends WizardPage {
generateEntitiesWizard.updatePossibleTables( CollectionTools.collection( schema.tables()));
}
+ @Override
public void dispose() {
this.removeConnectionListener();
super.dispose();
@@ -137,13 +138,12 @@ public class DatabaseReconnectWizardPage extends WizardPage {
ConnectionProfile getProjectConnectionProfile() {
- String profileName = this.jpaProject.dataSource().getConnectionProfileName();
+ String profileName = this.jpaProject.dataSource().connectionProfileName();
return JptDbPlugin.getDefault().getConnectionProfileRepository().profileNamed( profileName);
}
Schema getDefaultSchema() {
- ConnectionProfile profile = getProjectConnectionProfile();
- return profile.getDatabase().schemaNamed( profile.getDefaultSchema());
+ return getProjectConnectionProfile().defaultSchema();
}
// ********** member classes **********
@@ -168,10 +168,12 @@ public class DatabaseReconnectWizardPage extends WizardPage {
createLabel( this.group, 1, JptUiMessages.DatabaseReconnectWizardPage_connection);
this.connectionCombo = createCombo( this.group, true);
this.connectionCombo.addSelectionListener( new SelectionAdapter() {
+ @Override
public void widgetDefaultSelected( SelectionEvent e) {
widgetSelected( e);
}
+ @Override
public void widgetSelected( SelectionEvent e) {
handleConnectionChange();
}
@@ -179,10 +181,12 @@ public class DatabaseReconnectWizardPage extends WizardPage {
createLabel( this.group, 1, JptUiMessages.DatabaseReconnectWizardPage_schema);
this.schemaCombo = createCombo( this.group, true);
this.schemaCombo.addSelectionListener( new SelectionAdapter() {
+ @Override
public void widgetDefaultSelected( SelectionEvent e) {
widgetSelected( e);
}
+ @Override
public void widgetSelected( SelectionEvent e) {
handleSchemaChange();
}
@@ -194,6 +198,7 @@ public class DatabaseReconnectWizardPage extends WizardPage {
this.addConnectionLink.setLayoutData( data);
this.addConnectionLink.setText( JptUiMessages.DatabaseReconnectWizardPage_addConnectionLink);
this.addConnectionLink.addSelectionListener( new SelectionAdapter() {
+ @Override
public void widgetSelected( SelectionEvent e) {
openNewConnectionWizard();
}
@@ -205,6 +210,7 @@ public class DatabaseReconnectWizardPage extends WizardPage {
this.reconnectLink.setText( JptUiMessages.DatabaseReconnectWizardPage_reconnectLink);
this.reconnectLink.setEnabled( false);
this.reconnectLink.addSelectionListener( new SelectionAdapter() {
+ @Override
public void widgetSelected( SelectionEvent e) {
openConnectionProfileNamed( connectionCombo.getText());
}
@@ -222,12 +228,11 @@ public class DatabaseReconnectWizardPage extends WizardPage {
}
private String getProjectConnectionProfileName() {
- return jpaProject.dataSource().getConnectionProfileName();
+ return jpaProject.dataSource().connectionProfileName();
}
Schema getDefaultSchema() {
- ConnectionProfile profile = getProjectConnectionProfile();
- return profile.getDatabase().schemaNamed( profile.getDefaultSchema());
+ return getProjectConnectionProfile().defaultSchema();
}
private void openConnectionProfileNamed( String connectionProfileName) {
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/GenerateEntitiesWizard.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/GenerateEntitiesWizard.java
index ed1392045c..46e5bea98f 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/GenerateEntitiesWizard.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/GenerateEntitiesWizard.java
@@ -53,6 +53,7 @@ public class GenerateEntitiesWizard extends Wizard {
this.setWindowTitle( JptUiMessages.GenerateEntitiesWizard_generateEntities);
}
+ @Override
public void addPages() {
super.addPages();
this.dbSettingsPage = new DatabaseReconnectWizardPage( this.jpaProject);
@@ -62,6 +63,7 @@ public class GenerateEntitiesWizard extends Wizard {
this.generateEntitiesPage.init( this.selection);
}
+ @Override
public boolean performFinish() {
this.packageGeneratorConfig.setPackageFragment( this.buildPackageFragment());
@@ -119,8 +121,7 @@ public class GenerateEntitiesWizard extends Wizard {
}
Schema getDefaultSchema() {
- ConnectionProfile profile = getProjectConnectionProfile();
- return profile.getDatabase().schemaNamed( profile.getDefaultSchema());
+ return getProjectConnectionProfile().defaultSchema();
}
public PackageGenerator.Config getPackageGeneratorConfig() {
@@ -139,7 +140,8 @@ public class GenerateEntitiesWizard extends Wizard {
return this.synchronizePersistenceXml;
}
- public boolean canFinish() {
+ @Override
+ public boolean canFinish() {
boolean canFinish = true;
if ( ! this.generateEntitiesPage.isPageComplete()) {
canFinish = false;
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/JpaFacetWizardPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/JpaFacetWizardPage.java
index 5d695081d7..a200130029 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/JpaFacetWizardPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/JpaFacetWizardPage.java
@@ -22,8 +22,8 @@ import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jpt.core.internal.JpaPlatformRegistry;
import org.eclipse.jpt.core.internal.facet.IJpaFacetDataModelProperties;
+import org.eclipse.jpt.core.internal.platform.JpaPlatformRegistry;
import org.eclipse.jpt.db.internal.ConnectionProfileRepository;
import org.eclipse.jpt.db.ui.internal.DTPUiTools;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/JptUiXmlMessages.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/JptUiXmlMessages.java
index c6804dd5a9..042043b359 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/JptUiXmlMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/JptUiXmlMessages.java
@@ -1,28 +1,31 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2006, 2008 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.ui.internal.xml;
import org.eclipse.osgi.util.NLS;
-public class JptUiXmlMessages
+public class JptUiXmlMessages
{
private static final String BUNDLE_NAME = "jpt_ui_xml"; //$NON-NLS-1$
-
+
+
public static String PersistentTypePage_javaClassLabel;
public static String PersistentTypePage_MetadataCompleteLabel;
public static String PersistentTypePage_AccessLabel;
-
+
public static String PersistenceUnitMetadataSection_SchemaDefault;
public static String PersistenceUnitMetadataSection_CatalogDefault;
-
+
public static String PersistentAttributePage_javaAttributeLabel;
-
+
+ public static String XmlEntityMappingsDetailsPage_package;
+
public static String XMLEntityMappingsPage_XmlMappingMetadataCompleteCheckBox;
public static String XMLEntityMappingsPage_CascadePersistCheckBox;
public static String XMLEntityMappingsPage_PersistenceUnitSection;
@@ -30,21 +33,22 @@ public class JptUiXmlMessages
public static String XMLEntityMappingsPage_SchemaNoDefaultSpecified;
public static String XMLEntityMappingsPage_CatalogDefault;
public static String XMLEntityMappingsPage_CatalogNoDefaultSpecified;
-
+
public static String XmlSchemaChooser_SchemaChooser;
public static String XmlCatalogChooser_CatalogChooser;
public static String XmlJavaClassChooser_XmlJavaClassDialog_title;
public static String XmlJavaClassChooser_XmlJavaClassDialog_message;
public static String XmlPackageChooser_PackageDialog_title;
- public static String XmlPackageChooser_PackageDialog_message;
-
-
+ public static String XmlPackageChooser_PackageDialog_message;
+
+ public static String AccessTypeComposite_field;
+ public static String AccessTypeComposite_property;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, JptUiXmlMessages.class);
}
-
+
private JptUiXmlMessages() {
throw new UnsupportedOperationException();
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/AccessTypeComboViewer.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/AccessTypeComboViewer.java
deleted file mode 100644
index 7048b4f617..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/AccessTypeComboViewer.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.xml.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.AccessType;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class AccessTypeComboViewer extends BaseJpaController
-{
- private AccessHolder accessHolder;
- private Adapter accessHolderListener;
-
- private ComboViewer comboViewer;
-
-
- public AccessTypeComboViewer(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildAccessHolderListener();
- }
-
-
- private void buildAccessHolderListener() {
- this.accessHolderListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- accessHolderChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent);
- this.comboViewer = new ComboViewer(combo);
- this.comboViewer.setLabelProvider(buildAccessTypeLabelProvider());
- this.comboViewer.add(AccessType.VALUES.toArray());
-
- this.comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- AccessTypeComboViewer.this.accessTypeSelectionChanged(event.getSelection());
- }
- });
- }
-
- private IBaseLabelProvider buildAccessTypeLabelProvider() {
- return new LabelProvider() {
- @Override
- public String getText(Object element) {
- if (element == AccessType.DEFAULT) {
- return JptUiMappingsMessages.AccessTypeCombo_default;
- }
- return super.getText(element);
- }
- };
- }
-
- void accessTypeSelectionChanged(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- AccessType access = (AccessType) ((IStructuredSelection) selection).getFirstElement();
- if ( ! this.accessHolder.getAccess().equals(access)) {
- this.accessHolder.setAccess(access);
- }
- }
- }
-
- private void accessHolderChanged(Notification notification) {
- if (notification.getFeatureID(this.accessHolder.featureClass()) ==
- this.accessHolder.featureId()) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.accessHolder != null && this.accessHolder.wrappedObject() != null) {
- this.accessHolder.wrappedObject().eAdapters().add(this.accessHolderListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.accessHolder != null && this.accessHolder.wrappedObject() != null) {
- this.accessHolder.wrappedObject().eAdapters().remove(this.accessHolderListener);
- }
- }
-
- public final void populate(AccessHolder accessHolder) {
- super.populate(accessHolder);
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.accessHolder = (AccessHolder) obj;
- populateCombo();
- }
-
- @Override
- protected void doPopulate() {
- populateCombo();
- }
-
- private void populateCombo() {
- if (this.accessHolder.wrappedObject() == null) {
- return;
- }
-
- AccessType access = this.accessHolder.getAccess();
-
- if (((IStructuredSelection) this.comboViewer.getSelection()).getFirstElement() != access) {
- this.comboViewer.setSelection(new StructuredSelection(access));
- }
- }
-
-
- @Override
- public Control getControl() {
- return this.comboViewer.getCombo();
- }
-
- /**
- * An interface to wrap an object that supports accessType
- * An object of this type must be passed in to populate(EObject)
- */
- public static interface AccessHolder extends EObject {
- /**
- * Return the AccessType from the wrapped object
- * @return
- */
- AccessType getAccess();
-
- /**
- * Set the AccessType on the wrapped object
- * @param accessType
- */
- void setAccess(AccessType accessType);
-
- /**
- * Return the Class of the wrapped object
- * @return
- */
- Class featureClass();
-
- /**
- * Return the feature id of accessType on the wrapped object
- * @return
- */
- int featureId();
-
- /**
- * The wrapped EObject that the accessType is stored on
- * @return
- */
- EObject wrappedObject();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/AccessTypeComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/AccessTypeComposite.java
new file mode 100644
index 0000000000..4f1d4a512b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/AccessTypeComposite.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.ui.internal.xml.details;
+
+import java.util.Collection;
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.orm.XmlTypeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.EnumComboViewer;
+import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------ |
+ * | Access Type: | |v| |
+ * | ------------------------------------------------------------ |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see XmlTypeMapping
+ * @see XmlPersistentTypeDetailsPage - A container of this pane
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class AccessTypeComposite extends AbstractFormPane<XmlTypeMapping<? extends TypeMapping>> {
+
+ /**
+ * Creates a new <code>AccessTypeComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ */
+ public AccessTypeComposite(AbstractFormPane<?> parentPane,
+ PropertyValueModel<? extends XmlTypeMapping<? extends TypeMapping>> subjectHolder,
+ Composite parent) {
+
+ super(parentPane, subjectHolder, parent);
+ }
+
+ private EnumComboViewer<XmlTypeMapping<? extends TypeMapping>, AccessType> buildAccessTypeComboViewer(Composite container) {
+
+ return new EnumComboViewer<XmlTypeMapping<? extends TypeMapping>, AccessType>(this, container) {
+
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(XmlTypeMapping.DEFAULT_ACCESS_PROPERTY);
+ propertyNames.add(XmlTypeMapping.SPECIFIED_ACCESS_PROPERTY);
+ }
+
+ @Override
+ protected AccessType[] choices() {
+ return AccessType.values();
+ }
+
+ @Override
+ protected AccessType defaultValue() {
+ return subject().getDefaultAccess();
+ }
+
+ @Override
+ protected String displayString(AccessType value) {
+ return buildDisplayString(
+ JptUiXmlMessages.class,
+ AccessTypeComposite.this,
+ value
+ );
+ }
+
+ @Override
+ protected AccessType getValue() {
+ return subject().getSpecifiedAccess();
+ }
+
+ @Override
+ protected void setValue(AccessType value) {
+ subject().setSpecifiedAccess(value);
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ EnumComboViewer<XmlTypeMapping<? extends TypeMapping>, AccessType> comboViewer =
+ buildAccessTypeComboViewer(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiXmlMessages.PersistentTypePage_AccessLabel,
+ comboViewer.getControl()
+ );
+ }
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/CascadePersistCheckBox.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/CascadePersistCheckBox.java
deleted file mode 100644
index 332079a3f8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/CascadePersistCheckBox.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.xml.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class CascadePersistCheckBox extends BaseJpaController
-{
- private PersistenceUnitDefaults persistenceUnitDefaults;
- private Adapter persistenceUnitDefaultsListener;
-
- private Button button;
-
-
- public CascadePersistCheckBox(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildPeristenceUnitDefaultsListener();
- }
-
- private void buildPeristenceUnitDefaultsListener() {
- this.persistenceUnitDefaultsListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- persistenceUnitDefaultsChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- this.button = getWidgetFactory().createButton(
- parent,
- JptUiXmlMessages.XMLEntityMappingsPage_CascadePersistCheckBox,
- SWT.CHECK);
-
- this.button.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- CascadePersistCheckBox.this.cascadePersistSelectionChanged();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- CascadePersistCheckBox.this.cascadePersistSelectionChanged();
- }
- });
- }
-
- void cascadePersistSelectionChanged() {
- boolean cascadePersist = this.button.getSelection();
- if (this.persistenceUnitDefaults.isCascadePersist() != cascadePersist) {
- this.persistenceUnitDefaults.setCascadePersist(cascadePersist);
- }
- }
-
- private void persistenceUnitDefaultsChanged(Notification notification) {
- if (notification.getFeatureID(PersistenceUnitDefaults.class) ==
- OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CASCADE_PERSIST) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.persistenceUnitDefaults != null) {
- this.persistenceUnitDefaults.eAdapters().add(this.persistenceUnitDefaultsListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.persistenceUnitDefaults != null) {
- this.persistenceUnitDefaults.eAdapters().remove(this.persistenceUnitDefaultsListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.persistenceUnitDefaults = (PersistenceUnitDefaults) obj;
- populateButton();
- }
-
- @Override
- protected void doPopulate() {
- populateButton();
- }
-
- private void populateButton() {
- boolean cascadePersist = false;
- if (this.persistenceUnitDefaults != null) {
- cascadePersist = this.persistenceUnitDefaults.isCascadePersist();
- }
-
- if (this.button.getSelection() != cascadePersist) {
- this.button.setSelection(cascadePersist);
- }
- }
-
-
- @Override
- public Control getControl() {
- return this.button;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/CommonWidgets.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/CommonWidgets.java
deleted file mode 100644
index 01e5c21461..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/CommonWidgets.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.xml.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.jpt.ui.internal.mappings.details.StringWithDefaultChooser;
-import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class CommonWidgets
-{
- public static Label buildJavaClassLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- Label label = widgetFactory.createLabel(parent, JptUiXmlMessages.PersistentTypePage_javaClassLabel);
- return label;
- }
-
- public static XmlJavaClassChooser buildJavaClassChooser(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new XmlJavaClassChooser(parent, commandStack, widgetFactory);
- }
-
- public static Label buildJavaAttributeNameLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- Label label = widgetFactory.createLabel(parent, JptUiXmlMessages.PersistentAttributePage_javaAttributeLabel);
- return label;
- }
-
- public static XmlJavaAttributeChooser buildJavaAttributeChooser(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new XmlJavaAttributeChooser(parent, commandStack, widgetFactory);
- }
-
-
- public static Label buildAccessLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiXmlMessages.PersistentTypePage_AccessLabel);
- }
-
- public static AccessTypeComboViewer buildAccessTypeComboViewer(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new AccessTypeComboViewer(parent, commandStack, widgetFactory);
- }
-
-
- public static Label buildCatalogLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiXmlMessages.XmlCatalogChooser_CatalogChooser);
- }
-
- public static StringWithDefaultChooser buildCatalogChooser(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new StringWithDefaultChooser(parent, commandStack, widgetFactory);
- }
-
-
- public static Label buildSchemaLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, JptUiXmlMessages.XmlSchemaChooser_SchemaChooser);
- }
-
- public static StringWithDefaultChooser buildSchemaChooser(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new StringWithDefaultChooser(parent, commandStack, widgetFactory);
- }
-
-
- public static Label buildPackageLabel(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- return widgetFactory.createLabel(parent, "Package:");
- }
-
- public static XmlPackageChooser buildXmlPackageChooser(
- Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- return new XmlPackageChooser(parent, commandStack, widgetFactory);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/MetaDataCompleteComboViewer.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/MetaDataCompleteComboViewer.java
index 62c6233cef..9390fd9c94 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/MetaDataCompleteComboViewer.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/MetaDataCompleteComboViewer.java
@@ -1,154 +1,111 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2006, 2008 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.ui.internal.xml.details;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.internal.mappings.DefaultFalseBoolean;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
+import java.util.Collection;
+import org.eclipse.jpt.core.internal.context.orm.XmlTypeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsMessages;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.CCombo;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.EnumComboViewer;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class MetaDataCompleteComboViewer extends BaseJpaController
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * </pre>
+ *
+ * @see XmlTypeMapping
+ * @see XmlPersistentTypeDetailsPage - The container of this pane
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class MetaDataCompleteComboViewer extends AbstractFormPane<XmlTypeMapping<? extends TypeMapping>>
{
- private XmlTypeMapping mapping;
- private Adapter typeMappingListener;
-
- private ComboViewer comboViewer;
+ /**
+ * Creates a new <code>MetaDataCompleteComboViewer</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ */
+ public MetaDataCompleteComboViewer(AbstractFormPane<?> parentPane,
+ PropertyValueModel<? extends XmlTypeMapping<? extends TypeMapping>> subjectHolder,
+ Composite parent) {
+ super(parentPane, subjectHolder, parent);
+ }
+
+ /**
+ * Creates a new <code>MetaDataCompleteComboViewer</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public MetaDataCompleteComboViewer(PropertyValueModel<? extends XmlTypeMapping<? extends TypeMapping>> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
- public MetaDataCompleteComboViewer(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildTypeMappingListener();
+ super(subjectHolder, parent, widgetFactory);
}
-
-
- private void buildTypeMappingListener() {
- this.typeMappingListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- typeMappingChanged(notification);
+
+ private EnumComboViewer<XmlTypeMapping<? extends TypeMapping>, Boolean> buildEnumTypeCombo(Composite container) {
+
+ return new EnumComboViewer<XmlTypeMapping<? extends TypeMapping>, Boolean>(this, container) {
+
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(XmlTypeMapping.DEFAULT_METADATA_COMPLETE_PROPERTY);
+ propertyNames.add(XmlTypeMapping.SPECIFIED_METADATA_COMPLETE_PROPERTY);
}
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- CCombo combo = getWidgetFactory().createCCombo(parent);
- this.comboViewer = new ComboViewer(combo);
- this.comboViewer.setLabelProvider(buildLabelProvider());
- this.comboViewer.add(DefaultFalseBoolean.VALUES.toArray());
- this.comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- MetaDataCompleteComboViewer.this.metadataCompleteSelectionChanged(event.getSelection());
+
+ @Override
+ protected Boolean[] choices() {
+ return new Boolean[] { Boolean.TRUE, Boolean.FALSE };
}
- });
- }
- private IBaseLabelProvider buildLabelProvider() {
- return new LabelProvider() {
+
@Override
- public String getText(Object element) {
- if (element == DefaultFalseBoolean.DEFAULT) {
- //TODO need to move this to the model, don't want hardcoded String
- return NLS.bind(JptUiMappingsMessages.MetaDataCompleteCombo_Default, "False");
- }
- return super.getText(element);
+ protected Boolean defaultValue() {
+ return null;
+ }
+
+ @Override
+ protected String displayString(Boolean value) {
+ return buildDisplayString(
+ JptUiMappingsMessages.class,
+ MetaDataCompleteComboViewer.this,
+ value
+ );
}
- };
- }
- void metadataCompleteSelectionChanged(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- DefaultFalseBoolean metadataComplete = (DefaultFalseBoolean) ((IStructuredSelection) selection).getFirstElement();
- if ( ! this.mapping.getMetadataComplete().equals(metadataComplete)) {
- this.mapping.setMetadataComplete(metadataComplete);
-// this.editingDomain.getCommandStack().execute(
-// SetCommand.create(
-// this.editingDomain,
-// this.basicMapping,
-// OrmPackage.eINSTANCE.getBasicMapping_Optional(),
-// optional
-// )
-// );
+ @Override
+ protected Boolean getValue() {
+ return subject().getSpecifiedMetadataComplete();
}
- }
- }
- private void typeMappingChanged(Notification notification) {
- if (notification.getFeatureID(XmlTypeMapping.class) ==
- OrmPackage.XML_TYPE_MAPPING__METADATA_COMPLETE) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.mapping != null) {
- this.mapping.eAdapters().add(this.typeMappingListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.mapping != null) {
- this.mapping.eAdapters().remove(this.typeMappingListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.mapping = (XmlTypeMapping) obj;
- populateCombo();
- }
-
- @Override
- protected void doPopulate() {
- populateCombo();
- }
-
- private void populateCombo() {
- if (this.mapping == null) {
- return;
- }
-
- DefaultFalseBoolean metadataComplete = this.mapping.getMetadataComplete();
-
- if (((IStructuredSelection) this.comboViewer.getSelection()).getFirstElement() != metadataComplete) {
- this.comboViewer.setSelection(new StructuredSelection(metadataComplete));
- }
+ @Override
+ protected void setValue(Boolean value) {
+ subject().setSpecifiedMetadataComplete(value);
+ }
+ };
}
-
+ /*
+ * (non-Javadoc)
+ */
@Override
- public Control getControl() {
- return this.comboViewer.getCombo();
+ protected void initializeLayout(Composite container) {
+ buildEnumTypeCombo(container);
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/PersistenceUnitMetadataComposite.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/PersistenceUnitMetadataComposite.java
new file mode 100644
index 0000000000..64167255d1
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/PersistenceUnitMetadataComposite.java
@@ -0,0 +1,277 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 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.ui.internal.xml.details;
+
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.orm.PersistenceUnitDefaults;
+import org.eclipse.jpt.core.internal.context.orm.PersistenceUnitMetadata;
+import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.ui.internal.widgets.EnumComboViewer;
+import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | |
+ * | - Persistence Unit ------------------------------------------------------ |
+ * | |
+ * | x XML Mapping Metadata Complete |
+ * | |
+ * | x Cascade Persist |
+ * | |
+ * | ------------------------------------------------------------ |
+ * | Schema: | |v| |
+ * | ------------------------------------------------------------ |
+ * | ------------------------------------------------------------ |
+ * | Catalog: | |v| |
+ * | ------------------------------------------------------------ |
+ * | ------------------------------------------------------------ |
+ * | Access Type: | |v| |
+ * | ------------------------------------------------------------ |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see PersistenceUnitMetadata
+ * @see PersistenceUnitDefaults
+ * @see XmlEntityMappingsDetailsPage - The parent container
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public class PersistenceUnitMetadataComposite extends AbstractFormPane<PersistenceUnitMetadata>
+{
+ /**
+ * Creates a new <code>PersistenceUnitMetadataComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ */
+ public PersistenceUnitMetadataComposite(AbstractFormPane<?> parentPane,
+ PropertyValueModel<? extends PersistenceUnitMetadata> subjectHolder,
+ Composite parent) {
+
+ super(parentPane, subjectHolder, parent);
+ }
+
+ private EnumComboViewer<PersistenceUnitDefaults, AccessType> buildAccessTypeCombo(Composite container) {
+
+ return new EnumComboViewer<PersistenceUnitDefaults, AccessType>(this, buildPersistenceUnitDefaultsHolder(), container) {
+ @Override
+ protected AccessType[] choices() {
+ return AccessType.values();
+ }
+
+ @Override
+ protected AccessType defaultValue() {
+ return null;
+ }
+
+ @Override
+ protected String displayString(AccessType value) {
+ return buildDisplayString(
+ JptUiXmlMessages.class,
+ PersistenceUnitMetadataComposite.this,
+ value
+ );
+ }
+
+ @Override
+ protected AccessType getValue() {
+ return subject().getAccess();
+ }
+
+ @Override
+ protected String propertyName() {
+ return PersistenceUnitDefaults.ACCESS_PROPERTY;
+ }
+
+ @Override
+ protected void setValue(AccessType value) {
+ subject().setAccess(value);
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Boolean> buildCascadePersistHolder() {
+ return new PropertyAspectAdapter<PersistenceUnitDefaults, Boolean>(buildPersistenceUnitDefaultsHolder(), PersistenceUnitDefaults.CASCADE_PERSIST_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return subject.isCascadePersist();
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ subject.setCascadePersist(value);
+ }
+ };
+ }
+
+ private EnumComboViewer<PersistenceUnitDefaults, String> buildCatalogComboViewer(Composite container) {
+
+ return new EnumComboViewer<PersistenceUnitDefaults, String>(this, buildPersistenceUnitDefaultsHolder(), container) {
+ @Override
+ protected String[] choices() {
+ return new String[0];
+ }
+
+ @Override
+ protected String defaultValue() {
+ return "default";
+ }
+
+ @Override
+ protected String displayString(String value) {
+ return value;
+ }
+
+ @Override
+ protected String getValue() {
+ return subject().getCatalog();
+ }
+
+ @Override
+ protected String propertyName() {
+ return PersistenceUnitDefaults.CATALOG_PROPERTY;
+ }
+
+ @Override
+ protected void setValue(String value) {
+ subject().setCatalog(value);
+ }
+ };
+ }
+
+ private PropertyValueModel<PersistenceUnitDefaults> buildPersistenceUnitDefaultsHolder() {
+ return new TransformationPropertyValueModel<PersistenceUnitMetadata, PersistenceUnitDefaults>(getSubjectHolder()) {
+ @Override
+ protected PersistenceUnitDefaults transform_(PersistenceUnitMetadata value) {
+ return value.getPersistenceUnitDefaults();
+ }
+ };
+ }
+
+ private EnumComboViewer<PersistenceUnitDefaults, String> buildSchemaComboViewer(Composite container) {
+
+ return new EnumComboViewer<PersistenceUnitDefaults, String>(this, buildPersistenceUnitDefaultsHolder(), container) {
+ @Override
+ protected String[] choices() {
+ return new String[0];
+ }
+
+ @Override
+ protected String defaultValue() {
+ return "default";
+ }
+
+ @Override
+ protected String displayString(String value) {
+ return value;
+ }
+
+ @Override
+ protected String getValue() {
+ return subject().getSchema();
+ }
+
+ @Override
+ protected String propertyName() {
+ return PersistenceUnitDefaults.SCHEMA_PROPERTY;
+ }
+
+ @Override
+ protected void setValue(String value) {
+ subject().setSchema(value);
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Boolean> buildXmlMappingMetadataCompleteHolder() {
+ return new PropertyAspectAdapter<PersistenceUnitMetadata, Boolean>(getSubjectHolder(), PersistenceUnitMetadata.XML_MAPPING_METADATA_COMPLETE_PROPERTY) {
+ @Override
+ protected Boolean buildValue_() {
+ return subject.isXmlMappingMetadataComplete();
+ }
+
+ @Override
+ protected void setValue_(Boolean value) {
+ subject.setXmlMappingMetadataComplete(value);
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ // Section
+ container = buildSection(
+ container,
+ JptUiXmlMessages.XMLEntityMappingsPage_PersistenceUnitSection
+ );
+
+ // XML mapping metadata complete check box
+ buildCheckBox(
+ container,
+ JptUiXmlMessages.XMLEntityMappingsPage_XmlMappingMetadataCompleteCheckBox,
+ buildXmlMappingMetadataCompleteHolder(),
+ IJpaHelpContextIds.ENTITY_ORM_XML
+ );
+
+ // Cascade Persist widgets
+ buildCheckBox(
+ container,
+ JptUiXmlMessages.XMLEntityMappingsPage_CascadePersistCheckBox,
+ buildCascadePersistHolder(),
+ IJpaHelpContextIds.ENTITY_ORM_CASCADE
+ );
+
+ // Schema widgets
+ EnumComboViewer<PersistenceUnitDefaults, String> schemaComboViewer =
+ buildSchemaComboViewer(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiXmlMessages.XmlSchemaChooser_SchemaChooser,
+ schemaComboViewer.getControl(),
+ IJpaHelpContextIds.ENTITY_ORM_SCHEMA
+ );
+
+ // Catalog widgets
+ EnumComboViewer<PersistenceUnitDefaults, String> catalogComboViewer =
+ buildCatalogComboViewer(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiXmlMessages.XmlCatalogChooser_CatalogChooser,
+ catalogComboViewer.getControl(),
+ IJpaHelpContextIds.ENTITY_ORM_CATALOG
+ );
+
+ // Access Type widgets
+ EnumComboViewer<PersistenceUnitDefaults, AccessType> accessTypeComposite =
+ buildAccessTypeCombo(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiXmlMessages.PersistentTypePage_AccessLabel,
+ accessTypeComposite.getControl(),
+ IJpaHelpContextIds.ENTITY_ORM_ACCESS
+ );
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/PersistenceUnitMetadataSection.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/PersistenceUnitMetadataSection.java
deleted file mode 100644
index 253d9c91c4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/PersistenceUnitMetadataSection.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.xml.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.AccessType;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaults;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitDefaultsInternal;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata;
-import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.mappings.details.StringWithDefaultChooser;
-import org.eclipse.jpt.ui.internal.mappings.details.StringWithDefaultChooser.StringHolder;
-import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
-import org.eclipse.jpt.ui.internal.xml.details.AccessTypeComboViewer.AccessHolder;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class PersistenceUnitMetadataSection extends BaseJpaController
-{
-
- private Section section;
- private XmlMappingMetadataCompleteCheckBox xmlMappingMetadataCompleteCheckBox;
- private StringWithDefaultChooser xmlSchemaChooser;
- private StringWithDefaultChooser xmlCatalogChooser;
- private AccessTypeComboViewer accessComboViewer;
- private CascadePersistCheckBox cascadePersistCheckBox;
-
- public PersistenceUnitMetadataSection(Composite parent, CommandStack commandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, commandStack, widgetFactory);
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
- this.section = getWidgetFactory().createSection(parent, SWT.FLAT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
- this.section.setText(JptUiXmlMessages.XMLEntityMappingsPage_PersistenceUnitSection);
-
- Composite persistenceUnitComposite = getWidgetFactory().createComposite(this.section);
- this.section.setClient(persistenceUnitComposite);
-
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 1;
- persistenceUnitComposite.setLayout(layout);
-
-
- this.xmlMappingMetadataCompleteCheckBox = buildXmlMappingMetadataCompleteCheckBox(persistenceUnitComposite);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.xmlMappingMetadataCompleteCheckBox.getControl().setLayoutData(gridData);
- helpSystem.setHelp(xmlMappingMetadataCompleteCheckBox.getControl(), IJpaHelpContextIds.ENTITY_ORM_XML);
-
- CommonWidgets.buildSchemaLabel(persistenceUnitComposite, getWidgetFactory());
-
- this.xmlSchemaChooser = CommonWidgets.buildSchemaChooser(persistenceUnitComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.xmlSchemaChooser.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(xmlSchemaChooser.getControl(), IJpaHelpContextIds.ENTITY_ORM_SCHEMA);
-
- CommonWidgets.buildCatalogLabel(persistenceUnitComposite, getWidgetFactory());
-
- this.xmlCatalogChooser = CommonWidgets.buildCatalogChooser(persistenceUnitComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.xmlCatalogChooser.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(xmlCatalogChooser.getControl(), IJpaHelpContextIds.ENTITY_ORM_CATALOG);
-
- CommonWidgets.buildAccessLabel(persistenceUnitComposite, getWidgetFactory());
-
- this.accessComboViewer = CommonWidgets.buildAccessTypeComboViewer(persistenceUnitComposite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.accessComboViewer.getControl().setLayoutData(gridData);
- helpSystem.setHelp(accessComboViewer.getControl(), IJpaHelpContextIds.ENTITY_ORM_ACCESS);
-
-
- this.cascadePersistCheckBox = buildCascadePersistCheckBox(persistenceUnitComposite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.cascadePersistCheckBox.getControl().setLayoutData(gridData);
- helpSystem.setHelp(cascadePersistCheckBox.getControl(), IJpaHelpContextIds.ENTITY_ORM_CASCADE);
-
- }
-
- private XmlMappingMetadataCompleteCheckBox buildXmlMappingMetadataCompleteCheckBox(Composite parent) {
- return new XmlMappingMetadataCompleteCheckBox(parent, this.commandStack, getWidgetFactory());
- }
-
- private CascadePersistCheckBox buildCascadePersistCheckBox(Composite parent) {
- return new CascadePersistCheckBox(parent, this.commandStack, getWidgetFactory());
- }
-
- @Override
- protected void engageListeners() {
- }
-
- @Override
- protected void disengageListeners() {
- }
-
- @Override
- public void doPopulate(EObject obj) {
- PersistenceUnitMetadata persistenceUnitMetadata = (PersistenceUnitMetadata) obj;
- this.xmlMappingMetadataCompleteCheckBox.populate(persistenceUnitMetadata);
- if (persistenceUnitMetadata != null) {
- this.accessComboViewer.populate(new MyAccessHolder(persistenceUnitMetadata.getPersistenceUnitDefaults()));
- this.xmlSchemaChooser.populate(new SchemaHolder(persistenceUnitMetadata.getPersistenceUnitDefaults()));
- this.xmlCatalogChooser.populate(new CatalogHolder(persistenceUnitMetadata.getPersistenceUnitDefaults()));
- this.cascadePersistCheckBox.populate(persistenceUnitMetadata.getPersistenceUnitDefaults());
- }
- else {
- this.accessComboViewer.populate(new MyAccessHolder(null));
- this.xmlSchemaChooser.populate(new SchemaHolder(null));
- this.xmlCatalogChooser.populate(new CatalogHolder(null));
- this.cascadePersistCheckBox.populate(null);
- }
- }
- private class MyAccessHolder extends XmlEObject implements AccessHolder{
-
- private PersistenceUnitDefaultsInternal persistenceUnitDefaults;
- MyAccessHolder(PersistenceUnitDefaults persistenceUnitDefaultsInternal) {
- super();
- this.persistenceUnitDefaults = (PersistenceUnitDefaultsInternal) persistenceUnitDefaultsInternal;
- }
- public void setAccess(AccessType accessType) {
- persistenceUnitDefaults.setAccess(accessType);
- }
-
- public AccessType getAccess() {
- return persistenceUnitDefaults.getAccess();
- }
-
- public Class featureClass() {
- return PersistenceUnitDefaults.class;
- }
-
- public int featureId() {
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS__ACCESS;
- }
-
- public EObject wrappedObject() {
- return this.persistenceUnitDefaults;
- }
- }
-
- private class SchemaHolder extends XmlEObject implements StringHolder {
- private PersistenceUnitDefaults persistenceUnitDefaults;
- SchemaHolder(PersistenceUnitDefaults persistenceUnitDefaults) {
- super();
- this.persistenceUnitDefaults = persistenceUnitDefaults;
- }
-
- public Class featureClass() {
- return PersistenceUnitDefaults.class;
- }
-
- public int featureId() {
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS__SCHEMA;
- }
-
- public boolean supportsDefault() {
- return false;
- }
-
- public int defaultFeatureId() {
- throw new UnsupportedOperationException();
- }
-
- public String defaultItem() {
- return JptUiXmlMessages.PersistenceUnitMetadataSection_SchemaDefault;
- }
-
- public String getString() {
- return this.persistenceUnitDefaults.getSchema();
- }
-
- public void setString(String newSchema) {
- this.persistenceUnitDefaults.setSchema(newSchema);
- }
-
- public EObject wrappedObject() {
- return this.persistenceUnitDefaults;
- }
- }
-
- private class CatalogHolder extends XmlEObject implements StringHolder {
- private PersistenceUnitDefaults persistenceUnitDefaults;
- CatalogHolder(PersistenceUnitDefaults persistenceUnitDefaults) {
- super();
- this.persistenceUnitDefaults = persistenceUnitDefaults;
- }
-
- public Class featureClass() {
- return PersistenceUnitDefaults.class;
- }
-
- public int featureId() {
- return OrmPackage.PERSISTENCE_UNIT_DEFAULTS__CATALOG;
- }
-
- public boolean supportsDefault() {
- return false;
- }
-
- public int defaultFeatureId() {
- throw new UnsupportedOperationException();
- }
-
- public String defaultItem() {
- return JptUiXmlMessages.PersistenceUnitMetadataSection_CatalogDefault;
- }
-
- public String getString() {
- return this.persistenceUnitDefaults.getCatalog();
- }
-
- public void setString(String string) {
- this.persistenceUnitDefaults.setCatalog(string);
- }
-
- public EObject wrappedObject() {
- return this.persistenceUnitDefaults;
- }
-
- }
-
- @Override
- protected void doPopulate() {
- this.xmlMappingMetadataCompleteCheckBox.populate();
- this.xmlSchemaChooser.populate();
- this.xmlCatalogChooser.populate();
- this.accessComboViewer.populate();
- this.cascadePersistCheckBox.populate();
- }
-
- @Override
- public void dispose() {
- this.xmlMappingMetadataCompleteCheckBox.dispose();
- this.xmlSchemaChooser.dispose();
- this.xmlCatalogChooser.dispose();
- this.accessComboViewer.dispose();
- this.cascadePersistCheckBox.dispose();
- super.dispose();
- }
-
- public Section getSection() {
- return this.section;
- }
-
- @Override
- public Control getControl() {
- return getSection();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlDetailsProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlDetailsProvider.java
index 0bcd70ded8..5bb58d7e8a 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlDetailsProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlDetailsProvider.java
@@ -1,47 +1,60 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2006, 2008 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.ui.internal.xml.details;
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.core.internal.content.orm.IXmlContentNodes;
+import org.eclipse.jpt.core.internal.context.base.IJpaContextNode;
+import org.eclipse.jpt.core.internal.context.orm.EntityMappings;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
import org.eclipse.jpt.ui.internal.details.IJpaDetailsPage;
import org.eclipse.jpt.ui.internal.details.IJpaDetailsProvider;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class XmlDetailsProvider
- implements IJpaDetailsProvider
+/**
+ * This provider is responsible for creating the <code>IJpaDetailsPage</code>
+ * when the information comes from the XML file (either from the persistence
+ * configuration or from the Mappings Descriptor).
+ *
+ * @version 2.0
+ * @since 1.0
+ */
+public class XmlDetailsProvider
+ implements IJpaDetailsProvider
{
+ /**
+ * Creates a new <code>XmlDetailsProvider</code>.
+ */
public XmlDetailsProvider() {
super();
}
-
- public String fileContentType() {
- return JptCorePlugin.ORM_XML_CONTENT_TYPE;
- }
-
- public IJpaDetailsPage buildDetailsPage(
- Composite parentComposite, Object contentNodeId, TabbedPropertySheetWidgetFactory widgetFactory) {
- if (contentNodeId.equals(IXmlContentNodes.ENTITY_MAPPINGS_ID)) {
- return new XmlEntityMappingsDetailsPage(parentComposite, widgetFactory);
+
+ /*
+ * (non-Javadoc)
+ */
+ public IJpaDetailsPage<? extends IJpaContextNode> buildDetailsPage(
+ Composite parent,
+ Object contentNodeId,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ if (contentNodeId instanceof EntityMappings) {
+ return new XmlEntityMappingsDetailsPage(parent, widgetFactory);
}
- else if (contentNodeId.equals(IXmlContentNodes.PERSISTENT_TYPE_ID)) {
- return new XmlPersistentTypeDetailsPage(parentComposite, widgetFactory);
+
+ if (contentNodeId instanceof XmlPersistentType) {
+ return new XmlPersistentTypeDetailsPage(parent, widgetFactory);
}
- else if (contentNodeId.equals(IXmlContentNodes.PERSISTENT_ATTRIBUTE_ID)) {
- return new XmlPersistentAttributeDetailsPage(parentComposite, widgetFactory);
+
+ if (contentNodeId instanceof XmlPersistentAttribute) {
+ return new XmlPersistentAttributeDetailsPage(parent, widgetFactory);
}
-
+
return null;
}
-
- public void dispose() {
- // no op ... for now
- }
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlEntityMappingsDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlEntityMappingsDetailsPage.java
index b70bde8825..1f030753b0 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlEntityMappingsDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlEntityMappingsDetailsPage.java
@@ -1,274 +1,245 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2006, 2008 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.ui.internal.xml.details;
-import org.eclipse.emf.common.command.BasicCommandStack;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.AccessType;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappings;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.orm.EntityMappings;
+import org.eclipse.jpt.core.internal.context.orm.PersistenceUnitMetadata;
import org.eclipse.jpt.ui.internal.IJpaHelpContextIds;
import org.eclipse.jpt.ui.internal.details.BaseJpaDetailsPage;
-import org.eclipse.jpt.ui.internal.mappings.details.StringWithDefaultChooser;
-import org.eclipse.jpt.ui.internal.mappings.details.StringWithDefaultChooser.StringHolder;
+import org.eclipse.jpt.ui.internal.widgets.EnumComboViewer;
import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
-import org.eclipse.jpt.ui.internal.xml.details.AccessTypeComboViewer.AccessHolder;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class XmlEntityMappingsDetailsPage extends BaseJpaDetailsPage
+/**
+ * Here the layout of this pane:
+ * <pre>
+ * -----------------------------------------------------------------------------
+ * | ------------------------------------------------------------ |
+ * | Package: | |v| |
+ * | ------------------------------------------------------------ |
+ * | ------------------------------------------------------------ |
+ * | Schema: | |v| |
+ * | ------------------------------------------------------------ |
+ * | ------------------------------------------------------------ |
+ * | Catalog: | |v| |
+ * | ------------------------------------------------------------ |
+ * | ------------------------------------------------------------ |
+ * | Access Type: | |v| |
+ * | ------------------------------------------------------------ |
+ * | |
+ * | ------------------------------------------------------------------------- |
+ * | | | |
+ * | | PersistenceUnitMetadataComposite | |
+ * | | | |
+ * | ------------------------------------------------------------------------- |
+ * -----------------------------------------------------------------------------</pre>
+ *
+ * @see EntityMappings
+ * @see XmlEntityMappingsDetailsPage - The parent container
+ * @see PersistenceUnitMetadataComposite
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class XmlEntityMappingsDetailsPage extends BaseJpaDetailsPage<EntityMappings>
{
- private EntityMappings entityMappings;
-
- private XmlPackageChooser xmlPackageChooser;
-
- private StringWithDefaultChooser xmlSchemaChooser;
-
- private StringWithDefaultChooser xmlCatalogChooser;
-
- private AccessTypeComboViewer accessComboViewer;
-
- private PersistenceUnitMetadataSection persistenceUnitMetadataSection;
-
- public XmlEntityMappingsDetailsPage(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, new BasicCommandStack(), widgetFactory);
- }
+ /**
+ * Creates a new <code>XmlEntityMappingsDetailsPage</code>.
+ *
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public XmlEntityMappingsDetailsPage(Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
- @Override
- protected void initializeLayout(Composite composite) {
- IWorkbenchHelpSystem helpSystem = PlatformUI.getWorkbench().getHelpSystem();
- GridLayout layout = new GridLayout(2, false);
- layout.horizontalSpacing = 6;
- composite.setLayout(layout);
-
- GridData gridData;
-
- CommonWidgets.buildPackageLabel(composite, getWidgetFactory());
-
- this.xmlPackageChooser = CommonWidgets.buildXmlPackageChooser(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.xmlPackageChooser.getControl().setLayoutData(gridData);
- helpSystem.setHelp(xmlPackageChooser.getControl(), IJpaHelpContextIds.ENTITY_ORM_PACKAGE);
-
-
- CommonWidgets.buildSchemaLabel(composite, getWidgetFactory());
-
- this.xmlSchemaChooser = CommonWidgets.buildSchemaChooser(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.xmlSchemaChooser.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(xmlSchemaChooser.getControl(), IJpaHelpContextIds.ENTITY_ORM_SCHEMA);
-
-
- CommonWidgets.buildCatalogLabel(composite, getWidgetFactory());
-
- this.xmlCatalogChooser = CommonWidgets.buildCatalogChooser(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.xmlCatalogChooser.getCombo().setLayoutData(gridData);
- helpSystem.setHelp(xmlCatalogChooser.getControl(), IJpaHelpContextIds.ENTITY_ORM_CATALOG);
-
-
- CommonWidgets.buildAccessLabel(composite, getWidgetFactory());
-
- this.accessComboViewer = CommonWidgets.buildAccessTypeComboViewer(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.accessComboViewer.getControl().setLayoutData(gridData);
- helpSystem.setHelp(accessComboViewer.getControl(), IJpaHelpContextIds.ENTITY_ORM_ACCESS);
-
- this.persistenceUnitMetadataSection = new PersistenceUnitMetadataSection(composite, this.commandStack, getWidgetFactory());
-
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- this.persistenceUnitMetadataSection.getSection().setLayoutData(gridData);
+ super(parent, widgetFactory);
}
-
- @Override
- protected void doPopulate(IJpaContentNode contentNode) {
- this.entityMappings = (EntityMappings) contentNode;
- this.xmlPackageChooser.populate(this.entityMappings);
- this.xmlSchemaChooser.populate(new SchemaHolder(this.entityMappings));
- this.xmlCatalogChooser.populate(new CatalogHolder(this.entityMappings));
- this.accessComboViewer.populate(new MyAccessHolder(this.entityMappings));
- if (this.entityMappings != null) {
- this.persistenceUnitMetadataSection.populate(this.entityMappings.getPersistenceUnitMetadata());
- }
- else {
- this.persistenceUnitMetadataSection.populate(null);
- }
- }
+ private EnumComboViewer<EntityMappings, AccessType> buildAccessTypeCombo(Composite container) {
- @Override
- protected void doPopulate() {
- this.xmlPackageChooser.populate();
- this.xmlSchemaChooser.populate();
- this.xmlCatalogChooser.populate();
- this.accessComboViewer.populate();
- this.persistenceUnitMetadataSection.populate();
- }
-
- @Override
- public void dispose() {
- this.xmlPackageChooser.dispose();
- this.xmlSchemaChooser.dispose();
- this.xmlCatalogChooser.dispose();
- this.accessComboViewer.dispose();
- this.persistenceUnitMetadataSection.dispose();
- super.dispose();
- }
-
- @Override
- protected void engageListeners() {
- }
-
- @Override
- protected void disengageListeners() {
+ return new EnumComboViewer<EntityMappings, AccessType>(this, container) {
+ @Override
+ protected AccessType[] choices() {
+ return AccessType.values();
+ }
+
+ @Override
+ protected AccessType defaultValue() {
+ return subject().getDefaultAccess();
+ }
+
+ @Override
+ protected String displayString(AccessType value) {
+ return buildDisplayString(
+ JptUiXmlMessages.class,
+ XmlEntityMappingsDetailsPage.this,
+ value
+ );
+ }
+
+ @Override
+ protected AccessType getValue() {
+ return subject().getAccess();
+ }
+
+ @Override
+ protected String propertyName() {
+ return EntityMappings.SPECIFIED_ACCESS_PROPERTY;
+ }
+
+ @Override
+ protected void setValue(AccessType value) {
+ subject().setSpecifiedAccess(value);
+ }
+ };
}
-
- private class MyAccessHolder extends XmlEObject implements AccessHolder{
-
- private EntityMappingsInternal entityMappings;
- MyAccessHolder(EntityMappings entityMappings) {
- super();
- this.entityMappings = (EntityMappingsInternal) entityMappings;
- }
- public void setAccess(AccessType accessType) {
- entityMappings.setSpecifiedAccess(accessType);
- }
-
- public AccessType getAccess() {
- return entityMappings.getSpecifiedAccess();
- }
-
- public Class featureClass() {
- return EntityMappingsInternal.class;
- }
-
- public int featureId() {
- return OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_ACCESS;
- }
-
- public EObject wrappedObject() {
- return this.entityMappings;
- }
-
+ private EnumComboViewer<EntityMappings, String> buildCatalogComboViewer(Composite container) {
+
+ return new EnumComboViewer<EntityMappings, String>(this, container) {
+ @Override
+ protected String[] choices() {
+ return new String[0];
+ }
+
+ @Override
+ protected String defaultValue() {
+ return subject().getDefaultCatalog();
+ }
+
+ @Override
+ protected String displayString(String value) {
+ return value;
+ }
+
+ @Override
+ protected String getValue() {
+ return subject().getSpecifiedCatalog();
+ }
+
+ @Override
+ protected String propertyName() {
+ return EntityMappings.SPECIFIED_CATALOG_PROPERTY;
+ }
+
+ @Override
+ protected void setValue(String value) {
+ subject().setSpecifiedCatalog(value);
+ }
+ };
}
-
- private class SchemaHolder extends XmlEObject implements StringHolder {
- private EntityMappingsInternal entityMappings;
- SchemaHolder(EntityMappings entityMappings) {
- super();
- this.entityMappings = (EntityMappingsInternal) entityMappings;
- }
-
- public Class featureClass() {
- return EntityMappingsInternal.class;
- }
-
- public int featureId() {
- return OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_SCHEMA;
- }
-
- public boolean supportsDefault() {
- return true;
- }
-
- public int defaultFeatureId() {
- return OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_SCHEMA;
- }
-
- public String defaultItem() {
- String defaultSchema = this.entityMappings.getDefaultSchema();
- if (defaultSchema != null) {
- return NLS.bind(JptUiXmlMessages.XMLEntityMappingsPage_SchemaDefault, defaultSchema);
+
+ private PropertyValueModel<PersistenceUnitMetadata> buildPersistentUnitMetadaHolder() {
+ return new TransformationPropertyValueModel<EntityMappings, PersistenceUnitMetadata>(getSubjectHolder()) {
+ @Override
+ protected PersistenceUnitMetadata transform_(EntityMappings value) {
+ return value.getPersistenceUnitMetadata();
}
- return JptUiXmlMessages.XMLEntityMappingsPage_SchemaNoDefaultSpecified;
- }
-
- public String getString() {
- return this.entityMappings.getSpecifiedSchema();
- }
-
- public void setString(String newSchema) {
- this.entityMappings.setSpecifiedSchema(newSchema);
- }
-
- public EObject wrappedObject() {
- return this.entityMappings;
- }
+ };
}
-
- private class CatalogHolder extends XmlEObject implements StringHolder {
- private EntityMappingsInternal entityMappings;
- CatalogHolder(EntityMappings entityMappings) {
- super();
- this.entityMappings = (EntityMappingsInternal) entityMappings;
- }
-
- public Class featureClass() {
- return EntityMappingsInternal.class;
- }
-
- public int featureId() {
- return OrmPackage.ENTITY_MAPPINGS_INTERNAL__SPECIFIED_CATALOG;
- }
-
- public boolean supportsDefault() {
- return true;
- }
-
- public int defaultFeatureId() {
- return OrmPackage.ENTITY_MAPPINGS_INTERNAL__DEFAULT_CATALOG;
- }
-
- public String defaultItem() {
- String defaultCatalog = this.entityMappings.getDefaultCatalog();
- if (defaultCatalog != null) {
- return NLS.bind(JptUiXmlMessages.XMLEntityMappingsPage_CatalogDefault, defaultCatalog);
+
+ private EnumComboViewer<EntityMappings, String> buildSchemaComboViewer(Composite container) {
+
+ return new EnumComboViewer<EntityMappings, String>(this, container) {
+ @Override
+ protected String[] choices() {
+ return new String[0];
+ }
+
+ @Override
+ protected String defaultValue() {
+ return subject().getDefaultSchema();
+ }
+
+ @Override
+ protected String displayString(String value) {
+ return value;
+ }
+
+ @Override
+ protected String getValue() {
+ return subject().getSpecifiedSchema();
+ }
+
+ @Override
+ protected String propertyName() {
+ return EntityMappings.SPECIFIED_SCHEMA_PROPERTY;
}
- return JptUiXmlMessages.XMLEntityMappingsPage_CatalogNoDefaultSpecified;
- }
-
- public String getString() {
- return this.entityMappings.getSpecifiedCatalog();
- }
-
- public void setString(String newCatalog) {
- this.entityMappings.setSpecifiedCatalog(newCatalog);
- }
-
- public EObject wrappedObject() {
- return this.entityMappings;
- }
+
+ @Override
+ protected void setValue(String value) {
+ subject().setSpecifiedSchema(value);
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ // Package widgets
+ XmlPackageChooser xmlCatalogChooser = new XmlPackageChooser(
+ this,
+ container
+ );
+
+ buildLabeledComposite(
+ container,
+ JptUiXmlMessages.XmlEntityMappingsDetailsPage_package,
+ xmlCatalogChooser.getControl(),
+ IJpaHelpContextIds.ENTITY_ORM_PACKAGE
+ );
+
+ // Schema widgets
+ EnumComboViewer<EntityMappings, String> schemaComboViewer =
+ buildSchemaComboViewer(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiXmlMessages.XmlSchemaChooser_SchemaChooser,
+ schemaComboViewer.getControl(),
+ IJpaHelpContextIds.ENTITY_ORM_SCHEMA
+ );
+
+ // Catalog widgets
+ EnumComboViewer<EntityMappings, String> catalogComboViewer =
+ buildCatalogComboViewer(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiXmlMessages.XmlCatalogChooser_CatalogChooser,
+ catalogComboViewer.getControl(),
+ IJpaHelpContextIds.ENTITY_ORM_CATALOG
+ );
+
+ // Access Type widgets
+ EnumComboViewer<EntityMappings, AccessType> accessTypeComposite =
+ buildAccessTypeCombo(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiXmlMessages.PersistentTypePage_AccessLabel,
+ accessTypeComposite.getControl(),
+ IJpaHelpContextIds.ENTITY_ORM_ACCESS
+ );
+
+ // Persistence Unit Metadata widgets
+ new PersistenceUnitMetadataComposite(
+ this,
+ buildPersistentUnitMetadaHolder(),
+ container
+ );
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaAttributeChooser.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaAttributeChooser.java
index 8f58be68b4..a2af9ceac6 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaAttributeChooser.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaAttributeChooser.java
@@ -1,55 +1,67 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2006, 2008 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.ui.internal.xml.details;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
+import org.eclipse.jpt.core.internal.context.orm.XmlAttributeMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class XmlJavaAttributeChooser extends BaseJpaController
+/**
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public class XmlJavaAttributeChooser extends AbstractFormPane<XmlAttributeMapping<? extends AttributeMapping>>
{
- private XmlPersistentAttribute attribute;
- private Adapter persistentAttributeListener;
-
private Text text;
-
-
- public XmlJavaAttributeChooser(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildPersistentAttributeListener();
+
+ /**
+ * Creates a new <code>XmlJavaAttributeChooser</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ */
+ public XmlJavaAttributeChooser(AbstractFormPane<?> parentPane,
+ PropertyValueModel<? extends XmlAttributeMapping<? extends AttributeMapping>> subjectHolder,
+ Composite parent) {
+
+ super(parentPane, subjectHolder, parent);
}
-
-
- private void buildPersistentAttributeListener() {
- this.persistentAttributeListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- persistentAttributeChanged(notification);
- }
- };
+
+
+ private XmlPersistentAttribute attribute() {
+ return (subject() != null) ? subject().persistentAttribute() : null;
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void buildWidget(Composite parent) {
- text = getWidgetFactory().createText(parent, "");
+ public void doPopulate() {
+ super.doPopulate();
+ populateText();
+ }
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+ text = buildText(container);
text.addModifyListener(
new ModifyListener() {
public void modifyText(ModifyEvent e) {
@@ -57,77 +69,35 @@ public class XmlJavaAttributeChooser extends BaseJpaController
}
});
}
-
- private void textModified(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
-
- String text = ((Text) e.getSource()).getText();
- attribute.setName(text);
-
- // TODO Does this need to be done?
- //this.editingDomain.getCommandStack().execute(SetCommand.create(this.editingDomain, this.entity, MappingsPackage.eINSTANCE.getEntity_SpecifiedName(), text));
- }
-
- private void persistentAttributeChanged(Notification notification) {
- if (notification.getFeatureID(XmlAttributeMapping.class) ==
- OrmPackage.XML_PERSISTENT_ATTRIBUTE__NAME) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (attribute != null) {
- attribute.eAdapters().add(persistentAttributeListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (attribute != null) {
- attribute.eAdapters().remove(persistentAttributeListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- attribute = (obj == null) ? null : ((XmlAttributeMapping) obj).getPersistentAttribute();
- populateText();
- }
-
- @Override
- protected void doPopulate() {
- populateText();
- }
-
+
private void populateText() {
- if (attribute == null) {
+ if (attribute() == null) {
text.clearSelection();
return;
}
-
- String name = attribute.getName();
-
+
+ String name = attribute().getName();
+
if (name == null) {
name = "";
}
setTextData(name);
}
-
+
private void setTextData(String textData) {
if (! textData.equals(text.getText())) {
text.setText(textData);
}
}
-
- public Control getControl() {
- return text;
+
+ private void textModified(ModifyEvent e) {
+ if (isPopulating()) {
+ return;
+ }
+ String text = ((Text) e.getSource()).getText();
+ subject().setName(text);
+
+ // TODO Does this need to be done?
+ //this.editingDomain.getCommandStack().execute(SetCommand.create(this.editingDomain, this.entity, MappingsPackage.eINSTANCE.getEntity_SpecifiedName(), text));
}
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaClassChooser.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaClassChooser.java
index 3485245d26..54410df47f 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaClassChooser.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlJavaClassChooser.java
@@ -1,20 +1,15 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.ui.internal.xml.details;
import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
@@ -28,12 +23,12 @@ import org.eclipse.jdt.internal.ui.refactoring.contentassist.JavaTypeCompletionP
import org.eclipse.jdt.ui.IJavaElementSearchConstants;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentType;
-import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlTypeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
import org.eclipse.jpt.ui.internal.JptUiPlugin;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -43,8 +38,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionDialog;
@@ -52,41 +45,55 @@ import org.eclipse.ui.progress.IProgressService;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
//TODO possibly help the user and if they have chosen a package at the entity-mappings level
-//only insert the class name in the xml file if they choose a class from the package.
+//only insert the class name in the xml file if they choose a class from the package.
//Not sure if this should be driven by the UI or by ui api in the model
-public class XmlJavaClassChooser extends BaseJpaController
-{
- private XmlPersistentType persistentType;
- private Adapter persistentTypeListener;
-
+public class XmlJavaClassChooser extends AbstractFormPane<XmlTypeMapping<?>> {
+
private Composite composite;
private Text text;
private JavaTypeCompletionProcessor javaTypeCompletionProcessor;
-
- public XmlJavaClassChooser(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildPersistentTypeListener();
+
+ /**
+ * Creates a new <code>XmlJavaClassChooser</code>.
+ *
+ * @param parentPane The parent controller of this one
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ */
+ public XmlJavaClassChooser(AbstractFormPane<?> parentPane,
+ PropertyValueModel<? extends XmlTypeMapping<? extends TypeMapping>> subjectHolder,
+ Composite parent) {
+
+ super(parentPane, subjectHolder, parent);
}
-
-
- private void buildPersistentTypeListener() {
- persistentTypeListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- persistentTypeChanged(notification);
- }
- };
+
+ /**
+ * Creates a new <code>XmlJavaClassChooser</code>.
+ *
+ * @param subjectHolder The holder of this pane's subject
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public XmlJavaClassChooser(PropertyValueModel<? extends XmlTypeMapping<? extends TypeMapping>> subjectHolder,
+ Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
+ super(subjectHolder, parent, widgetFactory);
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void buildWidget(Composite parent) {
- this.composite = getWidgetFactory().createComposite(parent);
+ protected void initializeLayout(Composite container) {
+ this.composite = getWidgetFactory().createComposite(container);
GridLayout gridLayout = new GridLayout();
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 1;
gridLayout.numColumns = 2;
this.composite.setLayout(gridLayout);
-
- text = getWidgetFactory().createText(this.composite, "");
+
+ text = getWidgetFactory().createText(this.composite);
GridData data = new GridData();
data.grabExcessHorizontalSpace = true;
data.horizontalAlignment = GridData.FILL;
@@ -102,7 +109,7 @@ public class XmlJavaClassChooser extends BaseJpaController
this.javaTypeCompletionProcessor = new JavaTypeCompletionProcessor(false, false);
ControlContentAssistHelper.createTextContentAssistant(this.text, this.javaTypeCompletionProcessor);
-
+
Button browseButton = getWidgetFactory().createButton(this.composite, "Browse...", SWT.FLAT);
data = new GridData();
browseButton.setLayoutData(data);
@@ -124,28 +131,24 @@ public class XmlJavaClassChooser extends BaseJpaController
}
private void textModified(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
-
String text = ((Text) e.getSource()).getText();
- persistentType.setClass(text);
-
+ subject().setClass(text);
+
// TODO Does this need to be done?
//this.editingDomain.getCommandStack().execute(SetCommand.create(this.editingDomain, this.entity, MappingsPackage.eINSTANCE.getEntity_SpecifiedName(), text));
}
-
-
+
+
protected IType chooseType() {
IPackageFragmentRoot root= getPackageFragmentRoot();
if (root == null) {
return null;
- }
-
+ }
+
IJavaElement[] elements= new IJavaElement[] { root.getJavaProject() };
IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements);
IProgressService service = PlatformUI.getWorkbench().getProgressService();
-
+
SelectionDialog typeSelectionDialog;
try {
typeSelectionDialog = JavaUI.createTypeDialog(this.text.getShell(), service, scope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, getType());
@@ -154,21 +157,21 @@ public class XmlJavaClassChooser extends BaseJpaController
JptUiPlugin.log(e);
throw new RuntimeException(e);
}
- typeSelectionDialog.setTitle(JptUiXmlMessages.XmlJavaClassChooser_XmlJavaClassDialog_title);
- typeSelectionDialog.setMessage(JptUiXmlMessages.XmlJavaClassChooser_XmlJavaClassDialog_message);
+ typeSelectionDialog.setTitle(JptUiXmlMessages.XmlJavaClassChooser_XmlJavaClassDialog_title);
+ typeSelectionDialog.setMessage(JptUiXmlMessages.XmlJavaClassChooser_XmlJavaClassDialog_message);
if (typeSelectionDialog.open() == Window.OK) {
return (IType) typeSelectionDialog.getResult()[0];
}
return null;
}
-
+
private String getType() {
return this.text.getText();
}
-
+
private IPackageFragmentRoot getPackageFragmentRoot() {
- IProject project = this.persistentType.getJpaProject().project();
+ IProject project = this.subject().jpaProject().project();
IJavaProject root = JavaCore.create(project);
try {
return root.getAllPackageFragmentRoots()[0];
@@ -179,57 +182,25 @@ public class XmlJavaClassChooser extends BaseJpaController
return null;
}
- private void persistentTypeChanged(Notification notification) {
- if (notification.getFeatureID(XmlPersistentType.class) ==
- OrmPackage.XML_PERSISTENT_TYPE__CLASS) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (persistentType != null) {
- persistentType.eAdapters().add(persistentTypeListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (persistentType != null) {
- persistentType.eAdapters().remove(persistentTypeListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- persistentType = (obj == null) ? null : ((XmlTypeMapping) obj).getPersistentType();
- populateText();
- }
-
@Override
protected void doPopulate() {
+ super.doPopulate();
populateText();
}
-
+
private void populateText() {
- if (persistentType == null) {
+ if (this.subject() == null) {
text.clearSelection();
return;
}
-
+
IPackageFragmentRoot root = getPackageFragmentRoot();
if (root != null) {
this.javaTypeCompletionProcessor.setPackageFragment(root.getPackageFragment(""));
}
-
- String javaClass = persistentType.getClass_();
-
+ String javaClass = this.subject().getClass_();
+
if (javaClass == null) {
setTextData("");
}
@@ -237,14 +208,10 @@ public class XmlJavaClassChooser extends BaseJpaController
setTextData(javaClass);
}
}
-
+
private void setTextData(String textData) {
if (! textData.equals(text.getText())) {
text.setText(textData);
}
}
-
- public Control getControl() {
- return this.composite;
- }
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlMappingMetadataCompleteCheckBox.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlMappingMetadataCompleteCheckBox.java
deleted file mode 100644
index 5cdd03801e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlMappingMetadataCompleteCheckBox.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.xml.details;
-
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.PersistenceUnitMetadata;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
-import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-
-public class XmlMappingMetadataCompleteCheckBox extends BaseJpaController
-{
- private PersistenceUnitMetadata persistenceUnitMetadata;
- private Adapter persistenceUnitMetadataListener;
-
- private Button button;
-
-
- public XmlMappingMetadataCompleteCheckBox(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildPeristenceUnitMetadataListener();
- }
-
- private void buildPeristenceUnitMetadataListener() {
- this.persistenceUnitMetadataListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- persistenceUnitMetadataChanged(notification);
- }
- };
- }
-
- @Override
- protected void buildWidget(Composite parent) {
- this.button = getWidgetFactory().createButton(
- parent,
- JptUiXmlMessages.XMLEntityMappingsPage_XmlMappingMetadataCompleteCheckBox,
- SWT.CHECK);
-
- this.button.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent event) {
- XmlMappingMetadataCompleteCheckBox.this.xmlMappingMetadataCompleteSelectionChanged();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- XmlMappingMetadataCompleteCheckBox.this.xmlMappingMetadataCompleteSelectionChanged();
- }
- });
- }
-
- void xmlMappingMetadataCompleteSelectionChanged() {
- boolean xmlMappingMetadataComplete = this.button.getSelection();
- if (this.persistenceUnitMetadata.isXmlMappingMetadataComplete() != xmlMappingMetadataComplete) {
- this.persistenceUnitMetadata.setXmlMappingMetadataComplete(xmlMappingMetadataComplete);
- }
- }
-
- private void persistenceUnitMetadataChanged(Notification notification) {
- if (notification.getFeatureID(PersistenceUnitMetadata.class) ==
- OrmPackage.PERSISTENCE_UNIT_METADATA__XML_MAPPING_METADATA_COMPLETE) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- populate();
- }
- });
- }
- }
-
- @Override
- protected void engageListeners() {
- if (this.persistenceUnitMetadata != null) {
- this.persistenceUnitMetadata.eAdapters().add(this.persistenceUnitMetadataListener);
- }
- }
-
- @Override
- protected void disengageListeners() {
- if (this.persistenceUnitMetadata != null) {
- this.persistenceUnitMetadata.eAdapters().remove(this.persistenceUnitMetadataListener);
- }
- }
-
- @Override
- public void doPopulate(EObject obj) {
- this.persistenceUnitMetadata = (PersistenceUnitMetadata) obj;
- populateButton();
- }
-
- @Override
- protected void doPopulate() {
- populateButton();
- }
-
- private void populateButton() {
- boolean xmlMappingMetadataComplete = false;
- if (this.persistenceUnitMetadata != null) {
- xmlMappingMetadataComplete = this.persistenceUnitMetadata.isXmlMappingMetadataComplete();
- }
-
- if (this.button.getSelection() != xmlMappingMetadataComplete) {
- this.button.setSelection(xmlMappingMetadataComplete);
- }
- }
-
-
- @Override
- public Control getControl() {
- return this.button;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPackageChooser.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPackageChooser.java
index 2800947b8b..a1119c2d20 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPackageChooser.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPackageChooser.java
@@ -1,20 +1,16 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.ui.internal.xml.details;
import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
@@ -26,12 +22,10 @@ import org.eclipse.jdt.ui.JavaElementLabelProvider;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.window.Window;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappings;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
+import org.eclipse.jpt.core.internal.context.orm.EntityMappings;
+import org.eclipse.jpt.core.internal.resource.orm.OrmPackage;
import org.eclipse.jpt.ui.internal.JptUiPlugin;
-import org.eclipse.jpt.ui.internal.details.BaseJpaController;
+import org.eclipse.jpt.ui.internal.widgets.AbstractFormPane;
import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
@@ -42,59 +36,58 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class XmlPackageChooser extends BaseJpaController
+/**
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class XmlPackageChooser extends AbstractFormPane<EntityMappings>
{
- private EntityMappingsInternal entityMappings;
- private Adapter entityMappingsListener;
- private IContentAssistProcessor contentAssistProcessor;
-
- private Composite composite;
+ private IContentAssistProcessor contentAssistProcessor;
+ private Composite composite;
private Text text;
-
-
- public XmlPackageChooser(Composite parent, CommandStack theCommandStack, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, theCommandStack, widgetFactory);
- buildSchemaHolderListener();
- }
-
-
- private void buildSchemaHolderListener() {
- this.entityMappingsListener = new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- entityMappingsChanged(notification);
- }
- };
+
+ /**
+ * Creates a new <code>XmlPackageChooser</code>.
+ *
+ * @param parentPane The parent controller of this one
+ * @param parent The parent container
+ */
+ public XmlPackageChooser(AbstractFormPane<? extends EntityMappings> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void buildWidget(Composite parent) {
- this.composite = getWidgetFactory().createComposite(parent);
- GridLayout gridLayout = new GridLayout();
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 1;
- gridLayout.numColumns = 2;
- this.composite.setLayout(gridLayout);
- this.text = getWidgetFactory().createText(this.composite, "");
+ protected void initializeLayout(Composite container) {
+ this.composite = getWidgetFactory().createComposite(container);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.marginHeight = 0;
+ gridLayout.marginWidth = 1;
+ gridLayout.numColumns = 2;
+ this.composite.setLayout(gridLayout);
+ this.text = getWidgetFactory().createText(this.composite);
GridData data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- this.text.setLayoutData(data);
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ this.text.setLayoutData(data);
this.contentAssistProcessor = new JavaPackageCompletionProcessor(new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_ROOT));
ControlContentAssistHelper.createTextContentAssistant(this.text, this.contentAssistProcessor);
- this.text.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- textModified(e);
- }
- });
-
+ this.text.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ textModified(e);
+ }
+ });
+
Button browseButton = getWidgetFactory().createButton(this.composite, "Browse...", SWT.FLAT);
data = new GridData();
browseButton.setLayoutData(data);
@@ -113,23 +106,19 @@ public class XmlPackageChooser extends BaseJpaController
}
});
}
-
+
private void textModified(ModifyEvent e) {
- if (isPopulating()) {
- return;
- }
-
String text = ((Text) e.getSource()).getText();
- this.entityMappings.setPackage(text);
+ this.subject().setPackage(text);
//TODO set a JEM Package??
//.setJavaClass(JavaRefFactory.eINSTANCE.createClassRef(text));
-
+
// TODO Does this need to be done?
//this.editingDomain.getCommandStack().execute(SetCommand.create(this.editingDomain, this.entity, MappingsPackage.eINSTANCE.getEntity_SpecifiedName(), text));
}
-
+
private void entityMappingsChanged(Notification notification) {
- if (notification.getFeatureID(EntityMappings.class) ==
+ if (notification.getFeatureID(EntityMappings.class) ==
OrmPackage.ENTITY_MAPPINGS__PACKAGE) {
Display.getDefault().asyncExec(
new Runnable() {
@@ -139,34 +128,30 @@ public class XmlPackageChooser extends BaseJpaController
});
}
}
-
+
@Override
protected void engageListeners() {
- if (this.entityMappings != null) {
- entityMappings.eAdapters().add(this.entityMappingsListener);
- }
+ super.engageListeners();
+// if (this.subject() != null) {
+// subject().eAdapters().add(this.entityMappingsListener);
+// }
}
-
+
@Override
protected void disengageListeners() {
- if (this.entityMappings != null) {
- this.entityMappings.eAdapters().remove(this.entityMappingsListener);
- }
+ super.disengageListeners();
+// if (this.subject() != null) {
+// this.subject().eAdapters().remove(this.entityMappingsListener);
+// }
}
-
- @Override
- public void doPopulate(EObject obj) {
- this.entityMappings = (EntityMappingsInternal) obj;
- populateText();
- }
-
+
@Override
protected void doPopulate() {
populateText();
}
-
+
private void populateText() {
- if (entityMappings == null) {
+ if (subject() == null) {
text.clearSelection();
return;
}
@@ -175,9 +160,9 @@ public class XmlPackageChooser extends BaseJpaController
if (root != null) {
((JavaPackageCompletionProcessor)this.contentAssistProcessor).setPackageFragmentRoot(root);
}
-
- String package_ = this.entityMappings.getPackage();
-
+
+ String package_ = this.subject().getPackage();
+
if (package_ == null) {
setTextData("");
}
@@ -185,9 +170,9 @@ public class XmlPackageChooser extends BaseJpaController
setTextData(package_);
}
}
-
+
private IPackageFragmentRoot getPackageFragmentRoot() {
- IProject project = ((XmlEObject) this.entityMappings).getJpaProject().project();
+ IProject project = subject().jpaProject().project();
IJavaProject root = JavaCore.create(project);
try {
return root.getAllPackageFragmentRoots()[0];
@@ -197,30 +182,25 @@ public class XmlPackageChooser extends BaseJpaController
}
return null;
}
-
+
private void setTextData(String textData) {
if (! textData.equals(text.getText())) {
text.setText(textData);
}
}
-
- @Override
- public Control getControl() {
- return this.composite;
- }
-
+
/**
- * Opens a selection dialog that allows to select a package.
- *
+ * Opens a selection dialog that allows to select a package.
+ *
* @return returns the selected package or <code>null</code> if the dialog has been canceled.
* The caller typically sets the result to the package input field.
* <p>
* Clients can override this method if they want to offer a different dialog.
* </p>
- *
+ *
* @since 3.2
*/
- protected IPackageFragment choosePackage() {
+ protected IPackageFragment choosePackage() {
SelectionDialog selectionDialog;
try {
selectionDialog = JavaUI.createPackageDialog(text.getShell(), getPackageFragmentRoot());
@@ -229,8 +209,8 @@ public class XmlPackageChooser extends BaseJpaController
JptUiPlugin.log(e);
throw new RuntimeException(e);
}
- selectionDialog.setTitle(JptUiXmlMessages.XmlPackageChooser_PackageDialog_title);
- selectionDialog.setMessage(JptUiXmlMessages.XmlPackageChooser_PackageDialog_message);
+ selectionDialog.setTitle(JptUiXmlMessages.XmlPackageChooser_PackageDialog_title);
+ selectionDialog.setMessage(JptUiXmlMessages.XmlPackageChooser_PackageDialog_message);
selectionDialog.setHelpAvailable(false);
IPackageFragment pack= getPackageFragment();
if (pack != null) {
@@ -245,8 +225,8 @@ public class XmlPackageChooser extends BaseJpaController
/**
* Returns the package fragment corresponding to the current input.
- *
- * @return a package fragment or <code>null</code> if the input
+ *
+ * @return a package fragment or <code>null</code> if the input
* could not be resolved.
*/
public IPackageFragment getPackageFragment() {
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentAttributeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentAttributeDetailsPage.java
index 5e2bd16073..105204cdb3 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentAttributeDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentAttributeDetailsPage.java
@@ -3,7 +3,7 @@
* 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
******************************************************************************/
@@ -13,18 +13,11 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.IPersistentAttribute;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.context.base.IAttributeMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlAttributeMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeMapping;
import org.eclipse.jpt.ui.internal.details.PersistentAttributeDetailsPage;
import org.eclipse.jpt.ui.internal.java.details.IAttributeMappingUiProvider;
import org.eclipse.jpt.ui.internal.java.mappings.properties.BasicMappingUiProvider;
@@ -37,182 +30,161 @@ import org.eclipse.jpt.ui.internal.java.mappings.properties.OneToManyMappingUiPr
import org.eclipse.jpt.ui.internal.java.mappings.properties.OneToOneMappingUiProvider;
import org.eclipse.jpt.ui.internal.java.mappings.properties.TransientMappingUiProvider;
import org.eclipse.jpt.ui.internal.java.mappings.properties.VersionMappingUiProvider;
+import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class XmlPersistentAttributeDetailsPage
- extends PersistentAttributeDetailsPage
+/**
+ * The default implementation of the details page used for the XML persistent
+ * attribute.
+ *
+ * @see IPersistentAttribute
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+@SuppressWarnings("nls")
+public class XmlPersistentAttributeDetailsPage extends PersistentAttributeDetailsPage<XmlPersistentAttribute>
{
+ private List<IAttributeMappingUiProvider<? extends IAttributeMapping>> attributeMappingUiProviders;
private XmlJavaAttributeChooser javaAttributeChooser;
-
- private Adapter persistentTypeListener;
-
- private IPersistentType persistentType;
-
- private List<IAttributeMappingUiProvider> attributeMappingUiProviders;
-
- public XmlPersistentAttributeDetailsPage(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
- super(parent, widgetFactory);
- buildPersistentTypeListener();
- }
-
- private void buildPersistentTypeListener() {
- this.persistentTypeListener = new AdapterImpl() {
- @Override
- public void notifyChanged(Notification notification) {
- persistentTypeChanged(notification);
- }
- };
- }
-
- void persistentTypeChanged(Notification notification) {
- if (notification.getFeatureID(XmlPersistentType.class) ==
- OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_ATTRIBUTE_MAPPINGS) {
- Display.getDefault().asyncExec(
- new Runnable() {
- public void run() {
- updateEnbabledState();
- }
- });
- }
- }
- @Override
- public ListIterator<IAttributeMappingUiProvider> attributeMappingUiProviders() {
- if (this.attributeMappingUiProviders == null) {
- this.attributeMappingUiProviders = new ArrayList<IAttributeMappingUiProvider>();
- this.addAttributeMappingUiProvidersTo(this.attributeMappingUiProviders);
- }
- return new CloneListIterator<IAttributeMappingUiProvider>(this.attributeMappingUiProviders);
+ /**
+ * Creates a new <code>XmlPersistentAttributeDetailsPage</code>.
+ *
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public XmlPersistentAttributeDetailsPage(Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+ super(parent, widgetFactory);
}
- protected void addAttributeMappingUiProvidersTo(List<IAttributeMappingUiProvider> providers) {
+ protected void addAttributeMappingUiProvidersTo(List<IAttributeMappingUiProvider<? extends IAttributeMapping>> providers) {
providers.add(BasicMappingUiProvider.instance());
providers.add(EmbeddedMappingUiProvider.instance());
providers.add(EmbeddedIdMappingUiProvider.instance());
- providers.add(IdMappingUiProvider.instance());
- providers.add(ManyToManyMappingUiProvider.instance());
- providers.add(ManyToOneMappingUiProvider.instance());
- providers.add(OneToManyMappingUiProvider.instance());
+ providers.add(IdMappingUiProvider.instance());
+ providers.add(ManyToManyMappingUiProvider.instance());
+ providers.add(ManyToOneMappingUiProvider.instance());
+ providers.add(OneToManyMappingUiProvider.instance());
providers.add(OneToOneMappingUiProvider.instance());
providers.add(TransientMappingUiProvider.instance());
providers.add(VersionMappingUiProvider.instance());
}
-
- @Override
- protected ListIterator<IAttributeMappingUiProvider> defaultAttributeMappingUiProviders() {
- return EmptyListIterator.instance();
- }
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected IAttributeMappingUiProvider defaultAttributeMappingUiProvider(String key) {
- throw new UnsupportedOperationException("Xml attributeMappings should not be default");
+ public ListIterator<IAttributeMappingUiProvider<? extends IAttributeMapping>> attributeMappingUiProviders() {
+ if (this.attributeMappingUiProviders == null) {
+ this.attributeMappingUiProviders = new ArrayList<IAttributeMappingUiProvider<? extends IAttributeMapping>>();
+ this.addAttributeMappingUiProvidersTo(this.attributeMappingUiProviders);
+ }
+
+ return new CloneListIterator<IAttributeMappingUiProvider<? extends IAttributeMapping>>(
+ this.attributeMappingUiProviders
+ );
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- //bug 192035 - no default mapping option in xml
- protected IAttributeMappingUiProvider[] attributeMappingUiProvidersFor(IPersistentAttribute persistentAttribute) {
+ @SuppressWarnings("unchecked")
+ protected IAttributeMappingUiProvider<? extends IAttributeMapping>[] attributeMappingUiProvidersFor(IPersistentAttribute persistentAttribute) {
+ //bug 192035 - no default mapping option in xml
return CollectionTools.array(attributeMappingUiProviders(), new IAttributeMappingUiProvider[CollectionTools.size(attributeMappingUiProviders())]);
}
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void initializeLayout(Composite composite) {
- composite.setLayout(new GridLayout(2, false));
-
- GridData gridData;
-
- CommonWidgets.buildJavaAttributeNameLabel(composite, getWidgetFactory());
-
- this.javaAttributeChooser = CommonWidgets.buildJavaAttributeChooser(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.javaAttributeChooser.getControl().setLayoutData(gridData);
-
-
- buildMappingLabel(composite);
-
- ComboViewer mappingCombo = buildMappingCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- mappingCombo.getCombo().setLayoutData(gridData);
-
- PageBook book = buildMappingPageBook(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
- book.setLayoutData(gridData);
- }
-
- @Override
- protected void engageListeners() {
- super.engageListeners();
- if (getAttribute() != null) {
- this.persistentType = getAttribute().typeMapping().getPersistentType();
- this.persistentType.eAdapters().add(this.persistentTypeListener);
- }
+ protected IAttributeMappingUiProvider<IAttributeMapping> defaultAttributeMappingUiProvider(String key) {
+ throw new UnsupportedOperationException("Xml attributeMappings should not be default");
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void disengageListeners() {
- if (this.persistentType != null) {
- this.persistentType.eAdapters().remove(this.persistentTypeListener);
- this.persistentType = null;
- }
- super.disengageListeners();
+ protected ListIterator<IAttributeMappingUiProvider<? extends IAttributeMapping>> defaultAttributeMappingUiProviders() {
+ return EmptyListIterator.instance();
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void doPopulate(IJpaContentNode persistentAttributeNode) {
- super.doPopulate(persistentAttributeNode);
- if (persistentAttributeNode == null) {
- this.javaAttributeChooser.populate(null);
- }
- else {
- XmlAttributeMapping mapping = ((XmlPersistentAttribute) persistentAttributeNode).getMapping();
- this.javaAttributeChooser.populate(mapping);
- updateEnbabledState();
- }
+ public void doDispose() {
+ this.javaAttributeChooser.dispose();
+ super.doDispose();
}
-
+
+ /*
+ * (non-Javadoc)
+ */
@Override
protected void doPopulate() {
super.doPopulate();
this.javaAttributeChooser.populate();
updateEnbabledState();
}
-
- @Override
- public void dispose() {
- this.javaAttributeChooser.dispose();
- super.dispose();
+
+ private PropertyValueModel<XmlAttributeMapping<? extends AttributeMapping>> getMappingHolder() {
+ return new TransformationPropertyValueModel<IPersistentAttribute, XmlAttributeMapping<? extends AttributeMapping>>(getSubjectHolder()) {
+ @Override
+ @SuppressWarnings("unchecked")
+ protected XmlAttributeMapping<? extends AttributeMapping> transform_(IPersistentAttribute value) {
+ return (XmlAttributeMapping<? extends AttributeMapping>) value.getMapping();
+ }
+ };
}
-
- public void updateEnbabledState() {
- if (getAttribute() == null || getAttribute().eContainer() == null) {
- return;
- }
- boolean enabled = !((XmlPersistentAttribute) getAttribute()).isVirtual();
- updateEnabledState(enabled, getControl());
+
+ /*
+ * (non-Javadoc)
+ */
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ this.javaAttributeChooser = new XmlJavaAttributeChooser(
+ this,
+ getMappingHolder(),
+ container
+ );
+
+ // Entity type widgets
+ buildLabeledComposite(
+ container,
+ JptUiXmlMessages.PersistentAttributePage_javaAttributeLabel,
+ buildMappingCombo(container).getControl()
+ );
+
+ // Properties pane
+ PageBook attributePane = buildMappingPageBook(container);
+
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = SWT.FILL;
+ gridData.verticalAlignment = SWT.FILL;
+ gridData.grabExcessHorizontalSpace = true;
+ gridData.grabExcessVerticalSpace = true;
+
+ attributePane.setLayoutData(gridData);
}
-
+
public void updateEnabledState(boolean enabled, Control control) {
control.setEnabled(enabled);
if (control instanceof Composite) {
@@ -221,4 +193,12 @@ public class XmlPersistentAttributeDetailsPage
}
}
}
+
+ public void updateEnbabledState() {
+ if (subject() == null || subject().parent() == null) {
+ return;
+ }
+ boolean enabled = !subject().isVirtual();
+ updateEnabledState(enabled, getControl());
+ }
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentTypeDetailsPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentTypeDetailsPage.java
index 6b76696a37..c04fb1becd 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentTypeDetailsPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/details/XmlPersistentTypeDetailsPage.java
@@ -1,9 +1,9 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved. This
+ * Copyright (c) 2006, 2008 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.ui.internal.xml.details;
@@ -12,174 +12,130 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.ListIterator;
-
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jpt.core.internal.AccessType;
-import org.eclipse.jpt.core.internal.IJpaContentNode;
-import org.eclipse.jpt.core.internal.XmlEObject;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentType;
-import org.eclipse.jpt.core.internal.content.orm.XmlTypeMapping;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.context.orm.XmlTypeMapping;
+import org.eclipse.jpt.core.internal.resource.orm.TypeMapping;
+import org.eclipse.jpt.ui.internal.JptUiMessages;
import org.eclipse.jpt.ui.internal.details.PersistentTypeDetailsPage;
import org.eclipse.jpt.ui.internal.java.details.ITypeMappingUiProvider;
import org.eclipse.jpt.ui.internal.java.mappings.properties.EmbeddableUiProvider;
import org.eclipse.jpt.ui.internal.java.mappings.properties.EntityUiProvider;
import org.eclipse.jpt.ui.internal.java.mappings.properties.MappedSuperclassUiProvider;
import org.eclipse.jpt.ui.internal.xml.JptUiXmlMessages;
-import org.eclipse.jpt.ui.internal.xml.details.AccessTypeComboViewer.AccessHolder;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory;
-public class XmlPersistentTypeDetailsPage extends PersistentTypeDetailsPage
+/**
+ * The default implementation of the details page used for the XML persistent
+ * attribute.
+ *
+ * @see XmlPersistentType
+ *
+ * @version 2.0
+ * @since 2.0
+ */
+public class XmlPersistentTypeDetailsPage extends PersistentTypeDetailsPage<XmlPersistentType>
{
- private XmlJavaClassChooser javaClassChooser;
-
- private MetaDataCompleteComboViewer metadataCompleteComboViewer;
-
- private AccessTypeComboViewer accessComboViewer;
-
- //Storing these here instead of querying IJpaPlatformUI, because the orm.xml schema
- //is not extensible. We only need to support extensibility for java
- private List<ITypeMappingUiProvider> xmlTypeMappingUiProviders;
-
- public XmlPersistentTypeDetailsPage(Composite parent, TabbedPropertySheetWidgetFactory widgetFactory) {
+ /**
+ * Storing these here instead of querying IJpaPlatformUI, because the orm.xml
+ * schema is not extensible. We only need to support extensibility for java.
+ */
+ private List<ITypeMappingUiProvider<? extends ITypeMapping>> xmlTypeMappingUiProviders;
+
+ /**
+ * Creates a new <code>XmlPersistentTypeDetailsPage</code>.
+ *
+ * @param parent The parent container
+ * @param widgetFactory The factory used to create various common widgets
+ */
+ public XmlPersistentTypeDetailsPage(Composite parent,
+ TabbedPropertySheetWidgetFactory widgetFactory) {
+
super(parent, widgetFactory);
}
- public ListIterator<ITypeMappingUiProvider> typeMappingUiProviders() {
- if (this.xmlTypeMappingUiProviders == null) {
- this.xmlTypeMappingUiProviders = new ArrayList<ITypeMappingUiProvider>();
- this.addXmlTypeMappingUiProvidersTo(this.xmlTypeMappingUiProviders);
- }
- return new CloneListIterator<ITypeMappingUiProvider>(this.xmlTypeMappingUiProviders);
- }
-
- protected void addXmlTypeMappingUiProvidersTo(Collection<ITypeMappingUiProvider> providers) {
+ protected void addXmlTypeMappingUiProvidersTo(Collection<ITypeMappingUiProvider<? extends ITypeMapping>> providers) {
providers.add(EntityUiProvider.instance());
- providers.add(MappedSuperclassUiProvider.instance());
- providers.add(EmbeddableUiProvider.instance());
+ providers.add(MappedSuperclassUiProvider.instance());
+ providers.add(EmbeddableUiProvider.instance());
}
-
+
+ private PropertyValueModel<XmlTypeMapping<? extends TypeMapping>> buildMappingHolder() {
+ return new TransformationPropertyValueModel<XmlPersistentType, XmlTypeMapping<? extends TypeMapping>>(getSubjectHolder()) {
+ @Override
+ protected XmlTypeMapping<? extends TypeMapping> transform_(XmlPersistentType value) {
+ return value.getMapping();
+ }
+ };
+ }
+
+ /*
+ * (non-Javadoc)
+ */
@Override
- protected void initializeLayout(Composite composite) {
- composite.setLayout(new GridLayout(2, false));
-
- GridData gridData;
-
- CommonWidgets.buildJavaClassLabel(composite, getWidgetFactory());
-
- this.javaClassChooser = CommonWidgets.buildJavaClassChooser(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.javaClassChooser.getControl().setLayoutData(gridData);
-
- buildTypeMappingLabel(composite);
-
- ComboViewer typeMappingCombo = buildTypeMappingCombo(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- typeMappingCombo.getCombo().setLayoutData(gridData);
-
- buildMetadataCompleteLabel(composite);
- this.metadataCompleteComboViewer = new MetaDataCompleteComboViewer(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.metadataCompleteComboViewer.getControl().setLayoutData(gridData);
-
- CommonWidgets.buildAccessLabel(composite, getWidgetFactory());
- this.accessComboViewer = CommonWidgets.buildAccessTypeComboViewer(composite, this.commandStack, getWidgetFactory());
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.BEGINNING;
- gridData.grabExcessHorizontalSpace = true;
- this.accessComboViewer.getControl().setLayoutData(gridData);
+ protected void initializeLayout(Composite container) {
+
+ // Java class widgets
+ XmlJavaClassChooser xmlJavaClassChooser =
+ new XmlJavaClassChooser(this, buildMappingHolder(), container);
+
+ buildLabeledComposite(
+ container,
+ JptUiXmlMessages.PersistentTypePage_javaClassLabel,
+ xmlJavaClassChooser.getControl()
+ );
+
+ // Type Mapping widgets
+ ComboViewer typeMappingCombo = buildTypeMappingCombo(container);
+
+ buildLabeledComposite(
+ container,
+ JptUiMessages.PersistentTypePage_mapAs,
+ typeMappingCombo.getControl().getParent()
+ );
+
+ // Metadata complete widget
+ MetaDataCompleteComboViewer metadataCompleteComboViewer =
+ new MetaDataCompleteComboViewer(this, buildMappingHolder(), container);
+
+ buildLabeledComposite(
+ container,
+ JptUiXmlMessages.PersistentTypePage_MetadataCompleteLabel,
+ metadataCompleteComboViewer.getControl()
+ );
- PageBook typeMappingPageBook = buildTypeMappingPageBook(composite);
- gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
+ // Access widgets
+ new AccessTypeComposite(this, buildMappingHolder(), container);
+
+ // Type mapping pane
+ PageBook typeMappingPageBook = buildTypeMappingPageBook(container);
+
+ GridData gridData = new GridData();
+ gridData.horizontalAlignment = SWT.FILL;
+ gridData.verticalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- gridData.horizontalSpan = 2;
+ gridData.grabExcessVerticalSpace = true;
+
typeMappingPageBook.setLayoutData(gridData);
}
-
- private Label buildMetadataCompleteLabel(Composite parent ) {
- return getWidgetFactory().createLabel(parent, JptUiXmlMessages.PersistentTypePage_MetadataCompleteLabel);
- }
-
- @Override
- protected void doPopulate(IJpaContentNode persistentTypeNode) {
- super.doPopulate(persistentTypeNode);
- if (persistentTypeNode == null) {
- this.javaClassChooser.populate(null);
- this.metadataCompleteComboViewer.populate(null);
- this.accessComboViewer.populate(new MyAccessHolder(null));
- }
- else {
- XmlTypeMapping mapping = ((XmlPersistentType) persistentTypeNode).getMapping();
- this.javaClassChooser.populate(mapping);
- this.metadataCompleteComboViewer.populate(mapping);
- this.accessComboViewer.populate(new MyAccessHolder(mapping));
- }
- }
-
- @Override
- protected void doPopulate() {
- super.doPopulate();
- this.javaClassChooser.populate();
- this.metadataCompleteComboViewer.populate();
- this.accessComboViewer.populate();
- }
+ /*
+ * (non-Javadoc)
+ */
@Override
- public void dispose() {
- this.javaClassChooser.dispose();
- this.metadataCompleteComboViewer.dispose();
- this.accessComboViewer.dispose();
- super.dispose();
- }
-
-
- private class MyAccessHolder extends XmlEObject implements AccessHolder{
-
- private XmlTypeMapping xmlTypeMapping;
- MyAccessHolder(XmlTypeMapping xmlTypeMapping) {
- super();
- this.xmlTypeMapping = xmlTypeMapping;
- }
- public void setAccess(AccessType accessType) {
- xmlTypeMapping.setSpecifiedAccess(accessType);
- }
-
- public AccessType getAccess() {
- return xmlTypeMapping.getSpecifiedAccess();
- }
-
- public Class featureClass() {
- return XmlTypeMapping.class;
- }
-
- public int featureId() {
- return OrmPackage.XML_TYPE_MAPPING__SPECIFIED_ACCESS;
- }
-
- public EObject wrappedObject() {
- return this.xmlTypeMapping;
+ public ListIterator<ITypeMappingUiProvider<? extends ITypeMapping>> typeMappingUiProviders() {
+ if (this.xmlTypeMappingUiProviders == null) {
+ this.xmlTypeMappingUiProviders = new ArrayList<ITypeMappingUiProvider<? extends ITypeMapping>>();
+ this.addXmlTypeMappingUiProvidersTo(this.xmlTypeMappingUiProviders);
}
+ return new CloneListIterator<ITypeMappingUiProvider<? extends ITypeMapping>>(this.xmlTypeMappingUiProviders);
}
-
-}
+} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/EntityMappingsItemProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/EntityMappingsItemProvider.java
deleted file mode 100644
index 171664b153..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/EntityMappingsItemProvider.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.xml.structure;
-
-import java.util.Collection;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsImages;
-
-public class EntityMappingsItemProvider extends ItemProviderAdapter
- implements IEditingDomainItemProvider,
- IStructuredItemContentProvider,
- ITreeItemContentProvider,
- IItemLabelProvider
-{
- public EntityMappingsItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- @Override
- public Collection getChildrenFeatures(Object object) {
- if (childrenFeatures == null) {
- super.getChildrenFeatures(object);
- childrenFeatures.add(OrmPackage.Literals.ENTITY_MAPPINGS_INTERNAL__PERSISTENT_TYPES);
- }
- return childrenFeatures;
- }
-
- @Override
- public Object getParent(Object object) {
- return null;
- }
-
- @Override
- public Object getImage(Object object) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.ENTITY_MAPPINGS);
- }
-
- @Override
- public String getText(Object object) {
- // TODO
- return "EntityMappings";
- }
-
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(EntityMappingsInternal.class)) {
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__PERSISTENT_TYPES:
- case OrmPackage.ENTITY_MAPPINGS_INTERNAL__TYPE_MAPPINGS:
- fireNotifyChanged(
- new ViewerNotification(
- notification, notification.getNotifier(), true, false));
- return;
- }
- super.notifyChanged(notification);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/JpaCoreXmlItemProviderAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/JpaCoreXmlItemProviderAdapterFactory.java
deleted file mode 100644
index a79c0ffa0b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/JpaCoreXmlItemProviderAdapterFactory.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.xml.structure;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.edit.provider.ChangeNotifier;
-import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.IChangeNotifier;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.INotifyChangedListener;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.jpt.core.internal.content.orm.util.OrmAdapterFactory;
-import org.eclipse.ui.services.IDisposable;
-
-/**
- * This is the factory that is used to provide the interfaces needed to support Viewers.
- * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
- * The adapters also support Eclipse property sheets.
- * Note that most of the adapters are shared among multiple instances.
- */
-public class JpaCoreXmlItemProviderAdapterFactory
- extends OrmAdapterFactory
- implements ComposeableAdapterFactory,
- IChangeNotifier,
- IDisposable
-{
- /**
- * This keeps track of the root adapter factory that delegates to this adapter factory.
- */
- protected ComposedAdapterFactory parentAdapterFactory;
-
- /**
- * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
- */
- protected IChangeNotifier changeNotifier = new ChangeNotifier();
-
- /**
- * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
- */
- protected Collection supportedTypes = new ArrayList();
-
- public JpaCoreXmlItemProviderAdapterFactory() {
- supportedTypes.add(IEditingDomainItemProvider.class);
- supportedTypes.add(IStructuredItemContentProvider.class);
- supportedTypes.add(ITreeItemContentProvider.class);
- supportedTypes.add(IItemLabelProvider.class);
- }
-
-
- protected XmlRootContentNodeItemProvider xmlRootContentNodeItemProvider;
-
- public Adapter createXmlRootContentNodeAdapter() {
- if (xmlRootContentNodeItemProvider == null) {
- xmlRootContentNodeItemProvider = new XmlRootContentNodeItemProvider(this);
- }
-
- return xmlRootContentNodeItemProvider;
- }
-
- protected EntityMappingsItemProvider entityMappingsItemProvider;
-
- /**
- * This creates an adapter for a {@link org.eclipse.jpt.core.internal.content.orm.EntityMappingsImpl}.
- */
- public Adapter createEntityMappingsAdapter() {
- if (entityMappingsItemProvider == null) {
- entityMappingsItemProvider = new EntityMappingsItemProvider(this);
- }
-
- return entityMappingsItemProvider;
- }
-
- /**
- * This keeps track of the one adapter used for all {@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType} instances.
- */
- protected XmlPersistentTypeItemProvider xmlPersistentTypeItemProvider;
-
- /**
- * This creates an adapter for a {@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentType}.
- */
- public Adapter createXmlPersistentTypeAdapter() {
- if (xmlPersistentTypeItemProvider == null) {
- xmlPersistentTypeItemProvider = new XmlPersistentTypeItemProvider(
- this);
- }
-
- return xmlPersistentTypeItemProvider;
- }
-
- /**
- * This keeps track of the one adapter used for all {@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute} instances.
- */
- protected XmlPersistentAttributeItemProvider xmlPersistentAttributeItemProvider;
-
- /**
- * This creates an adapter for a {@link org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute}.
- */
- public Adapter createXmlPersistentAttributeAdapter() {
- if (xmlPersistentAttributeItemProvider == null) {
- xmlPersistentAttributeItemProvider = new XmlPersistentAttributeItemProvider(
- this);
- }
-
- return xmlPersistentAttributeItemProvider;
- }
-
- /**
- * This returns the root adapter factory that contains this factory.
- */
- public ComposeableAdapterFactory getRootAdapterFactory() {
- return parentAdapterFactory == null ? this : parentAdapterFactory
- .getRootAdapterFactory();
- }
-
- /**
- * This sets the composed adapter factory that contains this factory.
- */
- public void setParentAdapterFactory(
- ComposedAdapterFactory parentAdapterFactory) {
- this.parentAdapterFactory = parentAdapterFactory;
- }
-
- public boolean isFactoryForType(Object type) {
- return supportedTypes.contains(type) || super.isFactoryForType(type);
- }
-
- /**
- * This implementation substitutes the factory itself as the key for the adapter.
- */
- public Adapter adapt(Notifier notifier, Object type) {
- return super.adapt(notifier, this);
- }
-
- public Object adapt(Object object, Object type) {
- if (isFactoryForType(type)) {
- Object adapter = super.adapt(object, type);
- if (!(type instanceof Class)
- || (((Class) type).isInstance(adapter))) {
- return adapter;
- }
- }
-
- return null;
- }
-
- /**
- * This adds a listener.
- */
- public void addListener(INotifyChangedListener notifyChangedListener) {
- changeNotifier.addListener(notifyChangedListener);
- }
-
- /**
- * This removes a listener.
- */
- public void removeListener(INotifyChangedListener notifyChangedListener) {
- changeNotifier.removeListener(notifyChangedListener);
- }
-
- /**
- * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
- */
- public void fireNotifyChanged(Notification notification) {
- changeNotifier.fireNotifyChanged(notification);
-
- if (parentAdapterFactory != null) {
- parentAdapterFactory.fireNotifyChanged(notification);
- }
- }
-
- /**
- * This disposes all of the item providers created by this factory.
- */
- public void dispose() {
- if (xmlRootContentNodeItemProvider != null)
- xmlRootContentNodeItemProvider.dispose();
- if (entityMappingsItemProvider != null)
- entityMappingsItemProvider.dispose();
- if (xmlPersistentTypeItemProvider != null)
- xmlPersistentTypeItemProvider.dispose();
- if (xmlPersistentAttributeItemProvider != null)
- xmlPersistentAttributeItemProvider.dispose();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlPersistentAttributeItemProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlPersistentAttributeItemProvider.java
deleted file mode 100644
index e9f4260b1f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlPersistentAttributeItemProvider.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.xml.structure;
-
-import org.eclipse.draw2d.ImageUtilities;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentAttribute;
-import org.eclipse.jpt.core.internal.mappings.IBasic;
-import org.eclipse.jpt.core.internal.mappings.IEmbedded;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddedId;
-import org.eclipse.jpt.core.internal.mappings.IId;
-import org.eclipse.jpt.core.internal.mappings.IManyToMany;
-import org.eclipse.jpt.core.internal.mappings.IManyToOne;
-import org.eclipse.jpt.core.internal.mappings.IOneToMany;
-import org.eclipse.jpt.core.internal.mappings.IOneToOne;
-import org.eclipse.jpt.core.internal.mappings.ITransient;
-import org.eclipse.jpt.core.internal.mappings.IVersion;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsImages;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-
-public class XmlPersistentAttributeItemProvider extends ItemProviderAdapter
- implements IEditingDomainItemProvider,
- IStructuredItemContentProvider,
- ITreeItemContentProvider,
- IItemLabelProvider
-{
- public XmlPersistentAttributeItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- @Override
- public Object getImage(Object object) {
- XmlAttributeMapping mapping = ((XmlPersistentAttribute) object).getMapping();
-
- Image image;
- if (mapping instanceof IBasic) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.BASIC);
- }
- else if (mapping instanceof IId) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.ID);
- }
- else if (mapping instanceof IVersion) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.VERSION);
- }
- else if (mapping instanceof IEmbedded) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.EMBEDDED);
- }
- else if (mapping instanceof IEmbeddedId) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.EMBEDDED_ID);
- }
- else if (mapping instanceof IOneToOne) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.ONE_TO_ONE);
- }
- else if (mapping instanceof IOneToMany) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.ONE_TO_MANY);
- }
- else if (mapping instanceof IManyToOne) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.MANY_TO_ONE);
- }
- else if (mapping instanceof IManyToMany) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.MANY_TO_MANY);
- }
- else if (mapping instanceof ITransient) {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.TRANSIENT);
- }
- else {
- image = JptUiMappingsImages.getImage(JptUiMappingsImages.NULL_ATTRIBUTE_MAPPING);
- }
-
- // apply "ghosting"
- if (mapping.isVirtual()) {
- Color offwhite = new Color(image.getDevice(), 250, 250, 250);
- ImageData imageData = ImageUtilities.createShadedImage(image, offwhite);
- image = new Image(image.getDevice(), imageData);
- }
-
- return image;
- }
-
- @Override
- public String getText(Object object) {
- return ((XmlPersistentAttribute) object).getName();
- }
-
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(XmlPersistentAttribute.class)) {
- case OrmPackage.XML_PERSISTENT_ATTRIBUTE__MAPPING:
- case OrmPackage.XML_PERSISTENT_ATTRIBUTE__NAME:
- fireNotifyChanged(new ViewerNotification(notification, notification
- .getNotifier(), false, true));
- return;
- }
- super.notifyChanged(notification);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlPersistentTypeItemProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlPersistentTypeItemProvider.java
deleted file mode 100644
index f87750ae2b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlPersistentTypeItemProvider.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.xml.structure;
-
-import java.util.Collection;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-import org.eclipse.jpt.core.internal.IPersistentType;
-import org.eclipse.jpt.core.internal.ITypeMapping;
-import org.eclipse.jpt.core.internal.JpaCorePackage;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-import org.eclipse.jpt.core.internal.content.orm.XmlPersistentType;
-import org.eclipse.jpt.core.internal.mappings.IEmbeddable;
-import org.eclipse.jpt.core.internal.mappings.IEntity;
-import org.eclipse.jpt.core.internal.mappings.IMappedSuperclass;
-import org.eclipse.jpt.ui.internal.mappings.JptUiMappingsImages;
-
-public class XmlPersistentTypeItemProvider extends ItemProviderAdapter
- implements IEditingDomainItemProvider,
- IStructuredItemContentProvider,
- ITreeItemContentProvider,
- IItemLabelProvider
-{
- public XmlPersistentTypeItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
-
- @Override
- protected Collection getChildrenFeatures(Object object) {
- if (childrenFeatures == null) {
- super.getChildrenFeatures(object);
- childrenFeatures.add(OrmPackage.Literals.XML_PERSISTENT_TYPE__SPECIFIED_PERSISTENT_ATTRIBUTES);
- childrenFeatures.add(OrmPackage.Literals.XML_PERSISTENT_TYPE__VIRTUAL_PERSISTENT_ATTRIBUTES);
- }
- return childrenFeatures;
- }
-
- @Override
- public Object getImage(Object object) {
- ITypeMapping mapping = ((IPersistentType) object).getMapping();
-
- if (mapping instanceof IEntity) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.ENTITY);
- }
- else if (mapping instanceof IEmbeddable) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.EMBEDDABLE);
- }
- else if (mapping instanceof IMappedSuperclass) {
- return JptUiMappingsImages.getImage(JptUiMappingsImages.MAPPED_SUPERCLASS);
- }
- else {
- return null;
- }
- }
-
- @Override
- public String getText(Object object) {
- return ((XmlPersistentType) object).getClass_();
- }
-
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(XmlPersistentType.class)) {
- case JpaCorePackage.IPERSISTENT_TYPE__MAPPING_KEY:
- case OrmPackage.XML_PERSISTENT_TYPE__CLASS:
- fireNotifyChanged(
- new ViewerNotification(
- notification, notification.getNotifier(), false, true));
- return;
-
- case OrmPackage.XML_PERSISTENT_TYPE__SPECIFIED_PERSISTENT_ATTRIBUTES:
- case OrmPackage.XML_PERSISTENT_TYPE__VIRTUAL_PERSISTENT_ATTRIBUTES:
- fireNotifyChanged(
- new ViewerNotification(
- notification, notification.getNotifier(), true, false));
- return;
- }
-
- super.notifyChanged(notification);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlRootContentNodeItemProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlRootContentNodeItemProvider.java
deleted file mode 100644
index 969c7c8407..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlRootContentNodeItemProvider.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.xml.structure;
-
-import java.util.Collection;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
-import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
-import org.eclipse.emf.edit.provider.ItemProviderAdapter;
-import org.eclipse.emf.edit.provider.ViewerNotification;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappings;
-import org.eclipse.jpt.core.internal.content.orm.OrmPackage;
-
-public class XmlRootContentNodeItemProvider extends ItemProviderAdapter
- implements IEditingDomainItemProvider,
- IStructuredItemContentProvider,
- ITreeItemContentProvider,
- IItemLabelProvider
-{
- public XmlRootContentNodeItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- @Override
- public Collection getChildrenFeatures(Object object) {
- if (childrenFeatures == null) {
- super.getChildrenFeatures(object);
- childrenFeatures.add(OrmPackage.Literals.XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS);
- }
- return childrenFeatures;
- }
-
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
-
- switch (notification.getFeatureID(EntityMappings.class)) {
- case OrmPackage.XML_ROOT_CONTENT_NODE__ENTITY_MAPPINGS:
- fireNotifyChanged(
- new ViewerNotification(
- notification, notification.getNotifier(), true, false));
- return;
- }
- super.notifyChanged(notification);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlStructureProvider.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlStructureProvider.java
deleted file mode 100644
index ca7dddcceb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/xml/structure/XmlStructureProvider.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.ui.internal.xml.structure;
-
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jpt.core.internal.JptCorePlugin;
-import org.eclipse.jpt.ui.internal.structure.IJpaStructureProvider;
-
-public class XmlStructureProvider implements IJpaStructureProvider {
-
- public String fileContentType() {
- return JptCorePlugin.ORM_XML_CONTENT_TYPE;
- }
-
- public ITreeContentProvider buildContentProvider() {
- return new AdapterFactoryContentProvider(new JpaCoreXmlItemProviderAdapterFactory());
- }
-
- public ILabelProvider buildLabelProvider() {
- return new AdapterFactoryLabelProvider(new JpaCoreXmlItemProviderAdapterFactory());
- }
-
- public void dispose() {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/.settings/org.eclipse.core.resources.prefs b/jpa/plugins/org.eclipse.jpt.utility/.settings/org.eclipse.core.resources.prefs
index 8b1918da29..8e5b2c2b65 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/.settings/org.eclipse.core.resources.prefs
+++ b/jpa/plugins/org.eclipse.jpt.utility/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +1,3 @@
-#Sun May 27 15:11:35 EDT 2007
+#Tue Jan 15 11:12:22 EST 2008
eclipse.preferences.version=1
encoding/<project>=ISO-8859-1
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/ClassTools.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/ClassTools.java
index 409dd1db3c..c2b7c55f88 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/ClassTools.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/ClassTools.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -42,11 +42,13 @@ public final class ClassTools {
public static final char NESTED_CLASS_NAME_SEPARATOR = '$';
public static final char ARRAY_INDICATOR = '[';
+ public static final char TYPE_DECLARATION_ARRAY_OPEN = '[';
+ public static final char TYPE_DECLARATION_ARRAY_CLOSE = ']';
public static final char REFERENCE_CLASS_CODE = 'L';
public static final char REFERENCE_CLASS_NAME_DELIMITER = ';';
- private static PrimitiveClassCode[] PRIMITIVE_CLASS_CODES; // pseudo 'final' - lazy-initialized
+ private static Primitive[] PRIMITIVES; // pseudo-'final' - lazy-initialized
public static final char BYTE_CODE = 'B';
public static final char CHAR_CODE = 'C';
public static final char DOUBLE_CODE = 'D';
@@ -56,8 +58,11 @@ public final class ClassTools {
public static final char SHORT_CODE = 'S';
public static final char BOOLEAN_CODE = 'Z';
public static final char VOID_CODE = 'V';
-
- private static int MAX_PRIMITIVE_CLASS_NAME_LENGTH = -1; // pseudo 'final' - lazy-initialized
+ private static int MAX_PRIMITIVE_CLASS_NAME_LENGTH = -1; // pseudo-'final' - lazy-initialized
+ private static int MAX_PRIMITIVE_WRAPPER_CLASS_NAME_LENGTH = -1; // pseudo-'final' - lazy-initialized
+
+ public static final String VOID_CLASS_NAME = void.class.getName();
+ public static final String VOID_WRAPPER_CLASS_NAME = java.lang.Void.class.getName();
/**
@@ -391,14 +396,14 @@ public final class ClassTools {
return field(object.getClass(), fieldName);
}
- /**
+ /*
* Return a string representation of the specified constructor.
*/
private static String fullyQualifiedConstructorSignature(Class<?> javaClass, Class<?>[] parameterTypes) {
return fullyQualifiedMethodSignature(javaClass, null, parameterTypes);
}
- /**
+ /*
* Return a string representation of the specified field.
*/
private static String fullyQualifiedFieldName(Class<?> javaClass, String fieldName) {
@@ -409,14 +414,14 @@ public final class ClassTools {
return sb.toString();
}
- /**
+ /*
* Return a string representation of the specified field.
*/
private static String fullyQualifiedFieldName(Object object, String fieldName) {
return fullyQualifiedFieldName(object.getClass(), fieldName);
}
- /**
+ /*
* Return a string representation of the specified method.
*/
private static String fullyQualifiedMethodSignature(Class<?> javaClass, String methodName, Class<?>[] parameterTypes) {
@@ -441,7 +446,7 @@ public final class ClassTools {
return sb.toString();
}
- /**
+ /*
* Return a string representation of the specified method.
*/
private static String fullyQualifiedMethodSignature(Object receiver, String methodName, Class<?>[] parameterTypes) {
@@ -454,7 +459,7 @@ public final class ClassTools {
* Useful for accessing private, package, or protected fields.
* Object#getFieldValue(String fieldName)
*/
- public static Object getFieldValue(Object object, String fieldName) {
+ public static Object fieldValue(Object object, String fieldName) {
try {
return attemptToGetFieldValue(object, fieldName);
} catch (NoSuchFieldException nsfe) {
@@ -468,7 +473,7 @@ public final class ClassTools {
* Useful for accessing private, package, or protected fields.
* Class#getStaticFieldValue(String fieldName)
*/
- public static Object getStaticFieldValue(Class<?> javaClass, String fieldName) {
+ public static Object staticFieldValue(Class<?> javaClass, String fieldName) {
try {
return attemptToGetStaticFieldValue(javaClass, fieldName);
} catch (NoSuchFieldException nsfe) {
@@ -830,7 +835,7 @@ public final class ClassTools {
return newInstance(Class.forName(className, false, classLoader), parameterType, parameter);
}
- /**
+ /*
* Push the declared fields for the specified class
* onto the top of the stack.
*/
@@ -841,7 +846,7 @@ public final class ClassTools {
}
}
- /**
+ /*
* Push the declared methods for the specified class
* onto the top of the stack.
*/
@@ -1263,21 +1268,25 @@ public final class ClassTools {
/**
* Return whether the specified class is a "reference"
- * class (i.e. not void or one of the primitives).
+ * class (i.e. neither 'void' nor one of the primitive variable classes,
+ * ['boolean', 'int', 'float', etc.]).
+ * NB: void.class.isPrimitive() == true
*/
public static boolean classNamedIsReference(String className) {
- return ! classNamedIsNonReference(className);
+ return ! classNamedIsPrimitive(className);
}
/**
- * Return whether the specified class is a "non-reference"
- * class (i.e. void or one of the primitives).
+ * Return whether the specified class is a primitive
+ * class (i.e. 'void' or one of the primitive variable classes,
+ * ['boolean', 'int', 'float', etc.]).
+ * NB: void.class.isPrimitive() == true
*/
- public static boolean classNamedIsNonReference(String className) {
+ public static boolean classNamedIsPrimitive(String className) {
if (classNamedIsArray(className) || (className.length() > maxPrimitiveClassNameLength())) {
return false; // performance tweak
}
- PrimitiveClassCode[] codes = primitiveClassCodes();
+ Primitive[] codes = primitives();
for (int i = codes.length; i-- > 0; ) {
if (codes[i].javaClass.getName().equals(className)) {
return true;
@@ -1287,6 +1296,74 @@ public final class ClassTools {
}
/**
+ * Return whether the specified class is a "variable" primitive
+ * class (i.e. 'boolean', 'int', 'float', etc., but not 'void').
+ * NB: void.class.isPrimitive() == true
+ */
+ public static boolean classNamedIsVariablePrimitive(String className) {
+ return classNamedIsPrimitive(className)
+ && ( ! className.equals(VOID_CLASS_NAME));
+ }
+
+ /**
+ * Return whether the specified class is a primitive wrapper
+ * class (i.e. 'java.lang.Void' or one of the primitive variable wrapper classes,
+ * ['java.lang.Boolean', 'java.lang.Integer', 'java.lang.Float', etc.]).
+ * NB: void.class.isPrimitive() == true
+ */
+ public static boolean classNamedIsPrimitiveWrapperClass(String className) {
+ if (classNamedIsArray(className) || (className.length() > maxPrimitiveWrapperClassNameLength())) {
+ return false; // performance tweak
+ }
+ Primitive[] codes = primitives();
+ for (int i = codes.length; i-- > 0; ) {
+ if (codes[i].wrapperClass.getName().equals(className)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return whether the specified class is a "variable" primitive
+ * class (i.e. 'boolean', 'int', 'float', etc., but not 'void').
+ * NB: void.class.isPrimitive() == true
+ */
+ public static boolean classNamedIsVariablePrimitiveWrapperClass(String className) {
+ return classNamedIsPrimitiveWrapperClass(className)
+ && ( ! className.equals(VOID_WRAPPER_CLASS_NAME));
+ }
+
+ /**
+ * Return whether the specified class is a primitive wrapper
+ * class (i.e. 'java.lang.Void' or one of the primitive variable wrapper classes,
+ * ['java.lang.Boolean', 'java.lang.Integer', 'java.lang.Float', etc.]).
+ * NB: void.class.isPrimitive() == true
+ */
+ public static boolean classIsPrimitiveWrapperClass(Class<?> javaClass) {
+ if (javaClass.isArray() || (javaClass.getName().length() > maxPrimitiveWrapperClassNameLength())) {
+ return false; // performance tweak
+ }
+ Primitive[] codes = primitives();
+ for (int i = codes.length; i-- > 0; ) {
+ if (codes[i].wrapperClass == javaClass) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return whether the specified class is a "variable" primitive
+ * class (i.e. 'boolean', 'int', 'float', etc., but not 'void').
+ * NB: void.class.isPrimitive() == true
+ */
+ public static boolean classIsVariablePrimitiveWrapperClass(Class<?> javaClass) {
+ return classIsPrimitiveWrapperClass(javaClass)
+ && (javaClass != java.lang.Void.class);
+ }
+
+ /**
* Return the class name for the specified class code.
* @see java.lang.Class#getName()
*/
@@ -1307,7 +1384,7 @@ public final class ClassTools {
* @see java.lang.Class#getName()
*/
public static Class<?> classForCode(char classCode) {
- PrimitiveClassCode[] codes = primitiveClassCodes();
+ Primitive[] codes = primitives();
for (int i = codes.length; i-- > 0; ) {
if (codes[i].code == classCode) {
return codes[i].javaClass;
@@ -1330,7 +1407,7 @@ public final class ClassTools {
*/
public static char codeForClass(Class<?> javaClass) {
if (( ! javaClass.isArray()) && (javaClass.getName().length() <= maxPrimitiveClassNameLength())) {
- PrimitiveClassCode[] codes = primitiveClassCodes();
+ Primitive[] codes = primitives();
for (int i = codes.length; i-- > 0; ) {
if (codes[i].javaClass == javaClass) {
return codes[i].code;
@@ -1346,7 +1423,7 @@ public final class ClassTools {
*/
public static char codeForClassNamed(String className) {
if (( ! classNamedIsArray(className)) && (className.length() <= maxPrimitiveClassNameLength())) {
- PrimitiveClassCode[] codes = primitiveClassCodes();
+ Primitive[] codes = primitives();
for (int i = codes.length; i-- > 0; ) {
if (codes[i].javaClass.getName().equals(className)) {
return codes[i].code;
@@ -1357,23 +1434,46 @@ public final class ClassTools {
}
/**
- * Return the class for specified "type declaration".
+ * Return the class for the specified "type declaration".
+ */
+ public static Class<?> classForTypeDeclaration(String typeDeclaration) throws ClassNotFoundException {
+ return classForTypeDeclaration(typeDeclaration, ClassTools.class.getClassLoader());
+ }
+
+ /**
+ * Return the class for the specified "type declaration",
+ * using the specified class loader.
+ */
+ public static Class<?> classForTypeDeclaration(String typeDeclaration, ClassLoader classLoader) throws ClassNotFoundException {
+ TypeDeclaration td = typeDeclaration(typeDeclaration);
+ return classForTypeDeclaration(td.elementTypeName, td.arrayDepth);
+ }
+
+ private static TypeDeclaration typeDeclaration(String typeDeclaration) {
+ typeDeclaration = StringTools.removeAllWhitespace(typeDeclaration);
+ int arrayDepth = arrayDepthForTypeDeclaration_(typeDeclaration);
+ String elementTypeName = typeDeclaration.substring(0, typeDeclaration.length() - (arrayDepth * 2));
+ return new TypeDeclaration(elementTypeName, arrayDepth);
+ }
+
+ /**
+ * Return the class for the specified "type declaration".
*/
public static Class<?> classForTypeDeclaration(String elementTypeName, int arrayDepth) throws ClassNotFoundException {
return classForTypeDeclaration(elementTypeName, arrayDepth, null);
}
/**
- * Return the class for specified "type declaration",
+ * Return the class for the specified "type declaration",
* using the specified class loader.
*/
// see the "Evaluation" of jdk bug 6446627 for a discussion of loading classes
public static Class<?> classForTypeDeclaration(String elementTypeName, int arrayDepth, ClassLoader classLoader) throws ClassNotFoundException {
// primitives cannot be loaded via Class#forName(),
// so check for a primitive class name first
- PrimitiveClassCode pcc = null;
+ Primitive pcc = null;
if (elementTypeName.length() <= maxPrimitiveClassNameLength()) { // performance tweak
- PrimitiveClassCode[] codes = primitiveClassCodes();
+ Primitive[] codes = primitives();
for (int i = codes.length; i-- > 0; ) {
if (codes[i].javaClass.getName().equals(elementTypeName)) {
pcc = codes[i];
@@ -1403,7 +1503,44 @@ public final class ClassTools {
}
/**
- * Return the class name for specified "type declaration".
+ * Return the class name for the specified "type declaration"; e.g.
+ * "int[]" -> "[I"
+ * @see java.lang.Class#getName()
+ */
+ public static String classNameForTypeDeclaration(String typeDeclaration) {
+ TypeDeclaration td = typeDeclaration(typeDeclaration);
+ return classNameForTypeDeclaration(td.elementTypeName, td.arrayDepth);
+ }
+
+ /**
+ * Return the array depth for the specified "type declaration"; e.g.
+ * "int[]" -> 1
+ */
+ public static int arrayDepthForTypeDeclaration(String typeDeclaration) {
+ return arrayDepthForTypeDeclaration_(StringTools.removeAllWhitespace(typeDeclaration));
+ }
+
+ /*
+ * Assume no whitespace in the type declaration.
+ */
+ private static int arrayDepthForTypeDeclaration_(String typeDeclaration) {
+ int last = typeDeclaration.length() - 1;
+ int depth = 0;
+ int close = last;
+ while (typeDeclaration.charAt(close) == TYPE_DECLARATION_ARRAY_CLOSE) {
+ if (typeDeclaration.charAt(close - 1) == TYPE_DECLARATION_ARRAY_OPEN) {
+ depth++;
+ } else {
+ throw new IllegalArgumentException("invalid type declaration: " + typeDeclaration);
+ }
+ close = last - (depth * 2);
+ }
+ return depth;
+ }
+
+ /**
+ * Return the class name for the specified "type declaration".
+ * @see java.lang.Class#getName()
*/
public static String classNameForTypeDeclaration(String elementTypeName, int arrayDepth) {
// non-array
@@ -1411,8 +1548,8 @@ public final class ClassTools {
return elementTypeName;
}
- if (elementTypeName.equals(void.class.getName())) {
- throw new IllegalArgumentException("'void' must have an array depth of zero: " + arrayDepth + '.');
+ if (elementTypeName.equals(VOID_CLASS_NAME)) {
+ throw new IllegalArgumentException("'" + VOID_CLASS_NAME + "' must have an array depth of zero: " + arrayDepth + '.');
}
// array
StringBuilder sb = new StringBuilder(100);
@@ -1421,9 +1558,9 @@ public final class ClassTools {
}
// look for a primitive first
- PrimitiveClassCode pcc = null;
+ Primitive pcc = null;
if (elementTypeName.length() <= maxPrimitiveClassNameLength()) { // performance tweak
- PrimitiveClassCode[] codes = primitiveClassCodes();
+ Primitive[] codes = primitives();
for (int i = codes.length; i-- > 0; ) {
if (codes[i].javaClass.getName().equals(elementTypeName)) {
pcc = codes[i];
@@ -1452,7 +1589,7 @@ public final class ClassTools {
private static int calculateMaxPrimitiveClassNameLength() {
int max = -1;
- PrimitiveClassCode[] codes = primitiveClassCodes();
+ Primitive[] codes = primitives();
for (int i = codes.length; i-- > 0; ) {
int len = codes[i].javaClass.getName().length();
if (len > max) {
@@ -1462,24 +1599,46 @@ public final class ClassTools {
return max;
}
- private static PrimitiveClassCode[] primitiveClassCodes() {
- if (PRIMITIVE_CLASS_CODES == null) {
- PRIMITIVE_CLASS_CODES = buildPrimitiveClassCodes();
- }
- return PRIMITIVE_CLASS_CODES;
- }
-
- private static PrimitiveClassCode[] buildPrimitiveClassCodes() {
- PrimitiveClassCode[] result = new PrimitiveClassCode[9];
- result[0] = new PrimitiveClassCode(BYTE_CODE, byte.class);
- result[1] = new PrimitiveClassCode(CHAR_CODE, char.class);
- result[2] = new PrimitiveClassCode(DOUBLE_CODE, double.class);
- result[3] = new PrimitiveClassCode(FLOAT_CODE, float.class);
- result[4] = new PrimitiveClassCode(INT_CODE, int.class);
- result[5] = new PrimitiveClassCode(LONG_CODE, long.class);
- result[6] = new PrimitiveClassCode(SHORT_CODE, short.class);
- result[7] = new PrimitiveClassCode(BOOLEAN_CODE, boolean.class);
- result[8] = new PrimitiveClassCode(VOID_CODE, void.class);
+ private static int maxPrimitiveWrapperClassNameLength() {
+ if (MAX_PRIMITIVE_WRAPPER_CLASS_NAME_LENGTH == -1) {
+ MAX_PRIMITIVE_WRAPPER_CLASS_NAME_LENGTH = calculateMaxPrimitiveWrapperClassNameLength();
+ }
+ return MAX_PRIMITIVE_WRAPPER_CLASS_NAME_LENGTH;
+ }
+
+ private static int calculateMaxPrimitiveWrapperClassNameLength() {
+ int max = -1;
+ Primitive[] codes = primitives();
+ for (int i = codes.length; i-- > 0; ) {
+ int len = codes[i].wrapperClass.getName().length();
+ if (len > max) {
+ max = len;
+ }
+ }
+ return max;
+ }
+
+ private static Primitive[] primitives() {
+ if (PRIMITIVES == null) {
+ PRIMITIVES = buildPrimitives();
+ }
+ return PRIMITIVES;
+ }
+
+ /**
+ * NB: void.class.isPrimitive() == true
+ */
+ private static Primitive[] buildPrimitives() {
+ Primitive[] result = new Primitive[9];
+ result[0] = new Primitive(BYTE_CODE, java.lang.Byte.class);
+ result[1] = new Primitive(CHAR_CODE, java.lang.Character.class);
+ result[2] = new Primitive(DOUBLE_CODE, java.lang.Double.class);
+ result[3] = new Primitive(FLOAT_CODE, java.lang.Float.class);
+ result[4] = new Primitive(INT_CODE, java.lang.Integer.class);
+ result[5] = new Primitive(LONG_CODE, java.lang.Long.class);
+ result[6] = new Primitive(SHORT_CODE, java.lang.Short.class);
+ result[7] = new Primitive(BOOLEAN_CODE, java.lang.Boolean.class);
+ result[8] = new Primitive(VOID_CODE, java.lang.Void.class);
return result;
}
@@ -1492,14 +1651,27 @@ public final class ClassTools {
}
- // ********** member class **********
+ // ********** member classes **********
- private static class PrimitiveClassCode {
- char code;
- Class<?> javaClass;
- PrimitiveClassCode(char code, Class<?> javaClass) {
+ private static class Primitive {
+ final char code;
+ final Class<?> javaClass;
+ final Class<?> wrapperClass;
+ private static final String WRAPPER_CLASS_TYPE_FIELD_NAME = "TYPE";
+ // e.g. java.lang.Boolean.TYPE => boolean.class
+ Primitive(char code, Class<?> wrapperClass) {
this.code = code;
- this.javaClass = javaClass;
+ this.wrapperClass = wrapperClass;
+ this.javaClass = (Class<?>) staticFieldValue(wrapperClass, WRAPPER_CLASS_TYPE_FIELD_NAME);
+ }
+ }
+
+ private static class TypeDeclaration {
+ final String elementTypeName;
+ final int arrayDepth;
+ TypeDeclaration(String elementTypeName, int arrayDepth) {
+ this.elementTypeName = elementTypeName;
+ this.arrayDepth = arrayDepth;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/Classpath.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/Classpath.java
index ff6885e08f..8abad57ec2 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/Classpath.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/Classpath.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -446,7 +446,7 @@ public class Classpath
private static Entry[] consolidateEntries(Classpath[] classpaths) {
List<Entry> entries = new ArrayList<Entry>();
for (Classpath classpath : classpaths) {
- CollectionTools.addAll(entries, classpath.getEntries());
+ CollectionTools.addAll(entries, classpath.entries());
}
return entries.toArray(new Entry[entries.size()]);
}
@@ -457,7 +457,7 @@ public class Classpath
/**
* Return the classpath's entries.
*/
- public Entry[] getEntries() {
+ public Entry[] entries() {
return this.entries;
}
@@ -777,10 +777,10 @@ public class Classpath
* under the entry's directory.
*/
private Iterator<File> classFilesForDirectory() {
- return new FilteringIterator<File>(FileTools.filesInTree(this.canonicalFile)) {
+ return new FilteringIterator<File, File>(FileTools.filesInTree(this.canonicalFile)) {
@Override
- protected boolean accept(Object next) {
- return Entry.this.fileNameMightBeForClassFile(((File) next).getName());
+ protected boolean accept(File next) {
+ return Entry.this.fileNameMightBeForClassFile(next.getName());
}
};
}
@@ -857,7 +857,7 @@ public class Classpath
* the specified filter.
*/
private Iterator<String> classNamesForDirectory(Filter<String> filter) {
- return new FilteringIterator<String>(this.classNamesForDirectory(), filter);
+ return new FilteringIterator<String, String>(this.classNamesForDirectory(), filter);
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/CollectionTools.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/CollectionTools.java
index 06e2dcc3fe..2843333b89 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/CollectionTools.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/CollectionTools.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -31,6 +31,11 @@ import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator;
public final class CollectionTools {
+ @SuppressWarnings("unchecked")
+ private static <E> E[] newArray(E[] array, int length) {
+ return (E[]) Array.newInstance(array.getClass().getComponentType(), length);
+ }
+
/**
* Return a new array that contains the elements in the
* specified array followed by the specified object to be added.
@@ -38,8 +43,7 @@ public final class CollectionTools {
*/
public static <E> E[] add(E[] array, E value) {
int len = array.length;
- @SuppressWarnings("unchecked")
- E[] result = (E[]) Array.newInstance(array.getClass().getComponentType(), len + 1);
+ E[] result = newArray(array, len + 1);
System.arraycopy(array, 0, result, 0, len);
result[len] = value;
return result;
@@ -52,8 +56,7 @@ public final class CollectionTools {
*/
public static <E> E[] add(E[] array, int index, E value) {
int len = array.length;
- @SuppressWarnings("unchecked")
- E[] result = (E[]) Array.newInstance(array.getClass().getComponentType(), len + 1);
+ E[] result = newArray(array, len + 1);
if (index > 0) {
System.arraycopy(array, 0, result, 0, index);
}
@@ -163,9 +166,23 @@ public final class CollectionTools {
* java.util.Arrays#addAll(Object[] array, java.util.Collection c)
*/
public static <E> E[] addAll(E[] array, Collection<? extends E> collection) {
+ int size = collection.size();
+ return (size == 0) ? array : addAll(array, collection, size);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static <E> E[] addAll_(E[] array, Collection<? extends E> collection) {
+ return addAll(array, collection, collection.size());
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static <E> E[] addAll(E[] array, Collection<? extends E> collection, int collectionSize) {
int len = array.length;
- @SuppressWarnings("unchecked")
- E[] result = (E[]) Array.newInstance(array.getClass().getComponentType(), array.length + collection.size());
+ E[] result = newArray(array, array.length + collectionSize);
System.arraycopy(array, 0, result, 0, len);
int i = len;
for (E item : collection) {
@@ -191,7 +208,7 @@ public final class CollectionTools {
* java.util.Arrays#addAll(Object[] array, java.util.Iterator iterator)
*/
public static <E> E[] addAll(E[] array, Iterator<? extends E> iterator) {
- return addAll(array, list(iterator));
+ return (iterator.hasNext()) ? addAll_(array, list(iterator)) : array;
}
/**
@@ -201,12 +218,24 @@ public final class CollectionTools {
* java.util.Arrays#addAll(Object[] array1, Object[] array2)
*/
public static <E> E[] addAll(E[] array1, E[] array2) {
- int len1 = array1.length;
- int len2 = array2.length;
- @SuppressWarnings("unchecked")
- E[] result = (E[]) Array.newInstance(array1.getClass().getComponentType(), len1 + len2);
- System.arraycopy(array1, 0, result, 0, len1);
- System.arraycopy(array2, 0, result, len1, len2);
+ int array2Length = array2.length;
+ return (array2Length == 0) ? array1 : addAll(array1, array2, array2Length);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static <E> E[] addAll(E[] array1, E[] array2, int array2Length) {
+ return addAll(array1, array2, array1.length, array2Length);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static <E> E[] addAll(E[] array1, E[] array2, int array1Length, int array2Length) {
+ E[] result = newArray(array1, array1Length + array2Length);
+ System.arraycopy(array1, 0, result, 0, array1Length);
+ System.arraycopy(array2, 0, result, array1Length, array2Length);
return result;
}
@@ -217,13 +246,29 @@ public final class CollectionTools {
* java.util.Arrays#add(Object[] array1, int index, Object[] array2)
*/
public static <E> E[] addAll(E[] array1, int index, E[] array2) {
- int len1 = array1.length;
- int len2 = array2.length;
- @SuppressWarnings("unchecked")
- E[] result = (E[]) Array.newInstance(array1.getClass().getComponentType(), len1 + len2);
+ int array2Length = array2.length;
+ return (array2Length == 0) ? array1 : addAll(array1, index, array2, array2Length);
+ }
+
+ /**
+ * no array2 length-checking
+ */
+ private static <E> E[] addAll(E[] array1, int index, E[] array2, int array2Length) {
+ int array1Length = array1.length;
+ return (index == array1Length) ?
+ addAll(array1, array2, array1Length, array2Length)
+ :
+ addAll(array1, index, array2, array1Length, array2Length);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static <E> E[] addAll(E[] array1, int index, E[] array2, int array1Length, int array2Length) {
+ E[] result = newArray(array1, array1Length + array2Length);
System.arraycopy(array1, 0, result, 0, index);
- System.arraycopy(array2, 0, result, index, len2);
- System.arraycopy(array1, index, result, index + len2, len1 - index);
+ System.arraycopy(array2, 0, result, index, array2Length);
+ System.arraycopy(array1, index, result, index + array2Length, array1Length - index);
return result;
}
@@ -234,11 +279,24 @@ public final class CollectionTools {
* java.util.Arrays#addAll(char[] array1, char[] array2)
*/
public static char[] addAll(char[] array1, char[] array2) {
- int len1 = array1.length;
- int len2 = array2.length;
- char[] result = new char[len1 + len2];
- System.arraycopy(array1, 0, result, 0, len1);
- System.arraycopy(array2, 0, result, len1, len2);
+ int array2Length = array2.length;
+ return (array2Length == 0) ? array1 : addAll(array1, array2, array2Length);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static char[] addAll(char[] array1, char[] array2, int array2Length) {
+ return addAll(array1, array2, array1.length, array2Length);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static char[] addAll(char[] array1, char[] array2, int array1Length, int array2Length) {
+ char[] result = new char[array1Length + array2Length];
+ System.arraycopy(array1, 0, result, 0, array1Length);
+ System.arraycopy(array2, 0, result, array1Length, array2Length);
return result;
}
@@ -249,12 +307,29 @@ public final class CollectionTools {
* java.util.Arrays#add(char[] array1, int index, char[] array2)
*/
public static char[] addAll(char[] array1, int index, char[] array2) {
- int len1 = array1.length;
- int len2 = array2.length;
- char[] result = new char[len1 + len2];
+ int array2Length = array2.length;
+ return (array2Length == 0) ? array1 : addAll(array1, index, array2, array2Length);
+ }
+
+ /**
+ * no array2 length-checking
+ */
+ private static char[] addAll(char[] array1, int index, char[] array2, int array2Length) {
+ int array1Length = array1.length;
+ return (index == array1Length) ?
+ addAll(array1, array2, array1Length, array2Length)
+ :
+ addAll(array1, index, array2, array1Length, array2Length);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static char[] addAll(char[] array1, int index, char[] array2, int array1Length, int array2Length) {
+ char[] result = new char[array1Length + array2Length];
System.arraycopy(array1, 0, result, 0, index);
- System.arraycopy(array2, 0, result, index, len2);
- System.arraycopy(array1, index, result, index + len2, len1 - index);
+ System.arraycopy(array2, 0, result, index, array2Length);
+ System.arraycopy(array1, index, result, index + array2Length, array1Length - index);
return result;
}
@@ -265,11 +340,24 @@ public final class CollectionTools {
* java.util.Arrays#addAll(int[] array1, int[] array2)
*/
public static int[] addAll(int[] array1, int[] array2) {
- int len1 = array1.length;
- int len2 = array2.length;
- int[] result = new int[len1 + len2];
- System.arraycopy(array1, 0, result, 0, len1);
- System.arraycopy(array2, 0, result, len1, len2);
+ int array2Length = array2.length;
+ return (array2Length == 0) ? array1 : addAll(array1, array2, array2Length);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static int[] addAll(int[] array1, int[] array2, int array2Length) {
+ return addAll(array1, array2, array1.length, array2Length);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static int[] addAll(int[] array1, int[] array2, int array1Length, int array2Length) {
+ int[] result = new int[array1Length + array2Length];
+ System.arraycopy(array1, 0, result, 0, array1Length);
+ System.arraycopy(array2, 0, result, array1Length, array2Length);
return result;
}
@@ -280,12 +368,29 @@ public final class CollectionTools {
* java.util.Arrays#add(int[] array1, int index, int[] array2)
*/
public static int[] addAll(int[] array1, int index, int[] array2) {
- int len1 = array1.length;
- int len2 = array2.length;
- int[] result = new int[len1 + len2];
+ int array2Length = array2.length;
+ return (array2Length == 0) ? array1 : addAll(array1, index, array2, array2Length);
+ }
+
+ /**
+ * no array2 length-checking
+ */
+ private static int[] addAll(int[] array1, int index, int[] array2, int array2Length) {
+ int array1Length = array1.length;
+ return (index == array1Length) ?
+ addAll(array1, array2, array1Length, array2Length)
+ :
+ addAll(array1, index, array2, array1Length, array2Length);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static int[] addAll(int[] array1, int index, int[] array2, int array1Length, int array2Length) {
+ int[] result = new int[array1Length + array2Length];
System.arraycopy(array1, 0, result, 0, index);
- System.arraycopy(array2, 0, result, index, len2);
- System.arraycopy(array1, index, result, index + len2, len1 - index);
+ System.arraycopy(array2, 0, result, index, array2Length);
+ System.arraycopy(array1, index, result, index + array2Length, array1Length - index);
return result;
}
@@ -339,8 +444,9 @@ public final class CollectionTools {
* java.util.Iterator#toArray()
*/
public static Object[] array(Iterator<?> iterator) {
- return list(iterator).toArray();
+ return (iterator.hasNext()) ? list(iterator).toArray() : EMPTY_OBJECT_ARRAY;
}
+ private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
/**
* Return an array corresponding to the specified iterator.
@@ -348,7 +454,7 @@ public final class CollectionTools {
* java.util.Iterator#toArray()
*/
public static Object[] array(Iterator<?> iterator, int size) {
- return list(iterator, size).toArray();
+ return (iterator.hasNext()) ? list(iterator, size).toArray() : EMPTY_OBJECT_ARRAY;
}
/**
@@ -361,7 +467,7 @@ public final class CollectionTools {
* java.util.Iterator#toArray(Object[])
*/
public static <E> E[] array(Iterator<? extends E> iterator, E[] array) {
- return list(iterator).toArray(array);
+ return (iterator.hasNext()) ? list(iterator).toArray(array) : newArray(array, 0);
}
/**
@@ -374,7 +480,7 @@ public final class CollectionTools {
* java.util.Iterator#toArray(Object[])
*/
public static <E> E[] array(Iterator<? extends E> iterator, int size, E[] array) {
- return list(iterator, size).toArray(array);
+ return (iterator.hasNext()) ? list(iterator, size).toArray(array) : newArray(array, 0);
}
/**
@@ -1230,17 +1336,40 @@ public final class CollectionTools {
* a "for" loop.
*/
public static <E> Iterable<E> iterable(final Iterator<E> iterator) {
- return new Iterable<E>() {
- private boolean used = false;
-
- public Iterator<E> iterator() {
- if (used) {
- throw new IllegalStateException("This method has already been called");
- }
- used = true;
- return iterator;
+ return new SingleUseIterable<E>(iterator);
+ }
+
+ /**
+ * This is a one-time use iterable that can return a single iterator.
+ * Once the iterator is returned the iterable is no longer valid.
+ * As such, this utility should only be used in one-time use situations,
+ * such as a 'for-each' loop.
+ */
+ public static class SingleUseIterable<E> implements Iterable<E> {
+ private Iterator<E> iterator;
+
+ public SingleUseIterable(Iterator<E> iterator) {
+ super();
+ if (iterator == null) {
+ throw new NullPointerException();
}
- };
+ this.iterator = iterator;
+ }
+
+ public Iterator<E> iterator() {
+ if (this.iterator == null) {
+ throw new IllegalStateException("This method has already been called.");
+ }
+ Iterator<E> result = this.iterator;
+ this.iterator = null;
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.iterator);
+ }
+
}
/**
@@ -1266,7 +1395,7 @@ public final class CollectionTools {
* java.util.ListIterator#lastIndexOf(Object o)
*/
public static int lastIndexOf(ListIterator<?> iterator, Object value) {
- return list(iterator).lastIndexOf(value);
+ return (iterator.hasNext()) ? list(iterator).lastIndexOf(value) : -1;
}
/**
@@ -1478,9 +1607,13 @@ public final class CollectionTools {
* java.util.Arrays#move(Object[] array, int targetIndex, int sourceIndex)
*/
public static <E> E[] move(E[] array, int targetIndex, int sourceIndex) {
- if (targetIndex == sourceIndex) {
- return array;
- }
+ return (targetIndex == sourceIndex) ? array : move_(array, targetIndex, sourceIndex);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static <E> E[] move_(E[] array, int targetIndex, int sourceIndex) {
E temp = array[sourceIndex];
if (targetIndex < sourceIndex) {
System.arraycopy(array, targetIndex, array, targetIndex + 1, sourceIndex - targetIndex);
@@ -1497,11 +1630,13 @@ public final class CollectionTools {
* java.util.Arrays#move(Object[] array, int targetIndex, int sourceIndex, int length)
*/
public static <E> E[] move(E[] array, int targetIndex, int sourceIndex, int length) {
- if (targetIndex == sourceIndex) {
+ if ((targetIndex == sourceIndex) || (length == 0)) {
return array;
}
- @SuppressWarnings("unchecked")
- E[] temp = (E[]) Array.newInstance(array.getClass().getComponentType(), length);
+ if (length == 1) {
+ return move_(array, targetIndex, sourceIndex);
+ }
+ E[] temp = newArray(array, length);
System.arraycopy(array, sourceIndex, temp, 0, length);
if (targetIndex < sourceIndex) {
System.arraycopy(array, targetIndex, array, targetIndex + length, sourceIndex - targetIndex);
@@ -1518,9 +1653,13 @@ public final class CollectionTools {
* java.util.Arrays#move(int[] array, int targetIndex, int sourceIndex)
*/
public static int[] move(int[] array, int targetIndex, int sourceIndex) {
- if (targetIndex == sourceIndex) {
- return array;
- }
+ return (targetIndex == sourceIndex) ? array : move_(array, targetIndex, sourceIndex);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static int[] move_(int[] array, int targetIndex, int sourceIndex) {
int temp = array[sourceIndex];
if (targetIndex < sourceIndex) {
System.arraycopy(array, targetIndex, array, targetIndex + 1, sourceIndex - targetIndex);
@@ -1537,9 +1676,12 @@ public final class CollectionTools {
* java.util.Arrays#move(int[] array, int targetIndex, int sourceIndex, int length)
*/
public static int[] move(int[] array, int targetIndex, int sourceIndex, int length) {
- if (targetIndex == sourceIndex) {
+ if ((targetIndex == sourceIndex) || (length == 0)) {
return array;
}
+ if (length == 1) {
+ return move_(array, targetIndex, sourceIndex);
+ }
int[] temp = new int[length];
System.arraycopy(array, sourceIndex, temp, 0, length);
if (targetIndex < sourceIndex) {
@@ -1557,9 +1699,13 @@ public final class CollectionTools {
* java.util.Arrays#move(char[] array, int targetIndex, int sourceIndex)
*/
public static char[] move(char[] array, int targetIndex, int sourceIndex) {
- if (targetIndex == sourceIndex) {
- return array;
- }
+ return (targetIndex == sourceIndex) ? array : move_(array, targetIndex, sourceIndex);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static char[] move_(char[] array, int targetIndex, int sourceIndex) {
char temp = array[sourceIndex];
if (targetIndex < sourceIndex) {
System.arraycopy(array, targetIndex, array, targetIndex + 1, sourceIndex - targetIndex);
@@ -1576,9 +1722,12 @@ public final class CollectionTools {
* java.util.Arrays#move(char[] array, int targetIndex, int sourceIndex, int length)
*/
public static char[] move(char[] array, int targetIndex, int sourceIndex, int length) {
- if (targetIndex == sourceIndex) {
+ if ((targetIndex == sourceIndex) || (length == 0)) {
return array;
}
+ if (length == 1) {
+ return move_(array, targetIndex, sourceIndex);
+ }
char[] temp = new char[length];
System.arraycopy(array, sourceIndex, temp, 0, length);
if (targetIndex < sourceIndex) {
@@ -1596,9 +1745,13 @@ public final class CollectionTools {
* java.util.List#move(int targetIndex, int sourceIndex)
*/
public static <E> List<E> move(List<E> list, int targetIndex, int sourceIndex) {
- if (targetIndex == sourceIndex) {
- return list;
- }
+ return (targetIndex == sourceIndex) ? list : move_(list, targetIndex, sourceIndex);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static <E> List<E> move_(List<E> list, int targetIndex, int sourceIndex) {
if (list instanceof RandomAccess) {
// move elements, leaving the list in place
E temp = list.get(sourceIndex);
@@ -1625,9 +1778,12 @@ public final class CollectionTools {
* java.util.List#move(int targetIndex, int sourceIndex, int length)
*/
public static <E> List<E> move(List<E> list, int targetIndex, int sourceIndex, int length) {
- if (targetIndex == sourceIndex) {
+ if ((targetIndex == sourceIndex) || (length == 0)) {
return list;
}
+ if (length == 1) {
+ return move_(list, targetIndex, sourceIndex);
+ }
if (list instanceof RandomAccess) {
// move elements, leaving the list in place
ArrayList<E> temp = new ArrayList<E>(list.subList(sourceIndex, sourceIndex + length));
@@ -1771,15 +1927,22 @@ public final class CollectionTools {
* java.util.Arrays#removeAll(Object[] array, Collection collection)
*/
public static <E> E[] removeAll(E[] array, Collection<?> collection) {
- E[] result = array;
- // go backwards since we will be pulling elements
- // out of 'result' and it will get shorter as we go
- for (int i = array.length; i-- > 0; ) {
- E item = array[i];
- if (collection.contains(item)) {
- result = removeElementAtIndex(result, i);
+ if (collection.isEmpty()) {
+ return array;
+ }
+ int arrayLength = array.length;
+ int[] indices = new int[arrayLength];
+ int j = 0;
+ for (int i = 0; i < arrayLength; i++) {
+ if ( ! collection.contains(array[i])) {
+ indices[j++] = i;
}
}
+ E[] result = newArray(array, j);
+ int resultLength = result.length;
+ for (int i = 0; i < resultLength; i++) {
+ result[i] = array[indices[i]];
+ }
return result;
}
@@ -1790,7 +1953,7 @@ public final class CollectionTools {
*/
public static <E> E[] removeAll(E[] array1, Object[] array2) {
// convert to a bag to take advantage of hashed look-up
- return removeAll(array1, bag(array2));
+ return (array2.length == 0) ? array1 : removeAll(array1, bag(array2));
}
/**
@@ -1799,16 +1962,23 @@ public final class CollectionTools {
* java.util.Arrays#removeAll(char[] array1, char[] array2)
*/
public static char[] removeAll(char[] array1, char[] array2) {
- char[] result1 = array1;
- // go backwards since we will be pulling elements
- // out of 'result1' and it will get shorter as we go
- for (int i = array1.length; i-- > 0; ) {
- char item = array1[i];
- if (contains(array2, item)) {
- result1 = removeElementAtIndex(result1, i);
+ if (array2.length == 0) {
+ return array1;
+ }
+ int array1Length = array1.length;
+ int[] indices = new int[array1Length];
+ int j = 0;
+ for (int i = 0; i < array1Length; i++) {
+ if ( ! contains(array2, array1[i])) {
+ indices[j++] = i;
}
}
- return result1;
+ char[] result = new char[j];
+ int resultLength = result.length;
+ for (int i = 0; i < resultLength; i++) {
+ result[i] = array1[indices[i]];
+ }
+ return result;
}
/**
@@ -1817,16 +1987,23 @@ public final class CollectionTools {
* java.util.Arrays#removeAll(int[] array1, int[] array2)
*/
public static int[] removeAll(int[] array1, int[] array2) {
- int[] result1 = array1;
- // go backwards since we will be pulling elements
- // out of 'result1' and it will get shorter as we go
- for (int i = array1.length; i-- > 0; ) {
- int item = array1[i];
- if (contains(array2, item)) {
- result1 = removeElementAtIndex(result1, i);
+ if (array2.length == 0) {
+ return array1;
+ }
+ int array1Length = array1.length;
+ int[] indices = new int[array1Length];
+ int j = 0;
+ for (int i = 0; i < array1Length; i++) {
+ if ( ! contains(array2, array1[i])) {
+ indices[j++] = i;
}
}
- return result1;
+ int[] result = new int[j];
+ int resultLength = result.length;
+ for (int i = 0; i < resultLength; i++) {
+ result[i] = array1[indices[i]];
+ }
+ return result;
}
/**
@@ -1862,24 +2039,27 @@ public final class CollectionTools {
* java.util.Arrays#removeAllOccurrences(Object[] array, Object value)
*/
public static <E> E[] removeAllOccurrences(E[] array, Object value) {
- E[] result = array;
+ int arrayLength = array.length;
+ int[] indices = new int[arrayLength];
+ int j = 0;
if (value == null) {
- // go backwards since we will be pulling elements
- // out of 'result' and it will get shorter as we go
- for (int i = array.length; i-- > 0; ) {
- if (array[i] == null) {
- result = removeElementAtIndex(result, i);
+ for (int i = arrayLength; i-- > 0; ) {
+ if (array[i] != null) {
+ indices[j++] = i;
}
}
} else {
- // go backwards since we will be pulling elements
- // out of 'result' and it will get shorter as we go
for (int i = array.length; i-- > 0; ) {
- if (value.equals(array[i])) {
- result = removeElementAtIndex(result, i);
+ if ( ! value.equals(array[i])) {
+ indices[j++] = i;
}
}
}
+ E[] result = newArray(array, j);
+ int resultLength = result.length;
+ for (int i = 0; i < resultLength; i++) {
+ result[i] = array[indices[i]];
+ }
return result;
}
@@ -1889,14 +2069,19 @@ public final class CollectionTools {
* java.util.Arrays#removeAllOccurrences(char[] array, char value)
*/
public static char[] removeAllOccurrences(char[] array, char value) {
- char[] result = array;
- // go backwards since we will be pulling elements
- // out of 'result' and it will get shorter as we go
- for (int i = array.length; i-- > 0; ) {
- if (array[i] == value) {
- result = removeElementAtIndex(result, i);
+ int arrayLength = array.length;
+ int[] indices = new int[arrayLength];
+ int j = 0;
+ for (int i = arrayLength; i-- > 0; ) {
+ if (array[i] != value) {
+ indices[j++] = i;
}
}
+ char[] result = new char[j];
+ int resultLength = result.length;
+ for (int i = 0; i < resultLength; i++) {
+ result[i] = array[indices[i]];
+ }
return result;
}
@@ -1906,14 +2091,19 @@ public final class CollectionTools {
* java.util.Arrays#removeAllOccurrences(int[] array, int value)
*/
public static int[] removeAllOccurrences(int[] array, int value) {
- int[] result = array;
- // go backwards since we will be pulling elements
- // out of 'result' and it will get shorter as we go
- for (int i = array.length; i-- > 0; ) {
- if (array[i] == value) {
- result = removeElementAtIndex(result, i);
+ int arrayLength = array.length;
+ int[] indices = new int[arrayLength];
+ int j = 0;
+ for (int i = arrayLength; i-- > 0; ) {
+ if (array[i] != value) {
+ indices[j++] = i;
}
}
+ int[] result = new int[j];
+ int resultLength = result.length;
+ for (int i = 0; i < resultLength; i++) {
+ result[i] = array[indices[i]];
+ }
return result;
}
@@ -1963,11 +2153,14 @@ public final class CollectionTools {
* java.util.Arrays#removeElementsAtIndex(Object[] array, int index, int length)
*/
public static <E> E[] removeElementsAtIndex(E[] array, int index, int length) {
- int len = array.length;
- @SuppressWarnings("unchecked")
- E[] result = (E[]) Array.newInstance(array.getClass().getComponentType(), len - length);
+ int arrayLength = array.length;
+ int newLength = arrayLength - length;
+ E[] result = newArray(array, newLength);
+ if ((newLength == 0) && (index == 0)) {
+ return result; // performance tweak
+ }
System.arraycopy(array, 0, result, 0, index);
- System.arraycopy(array, index + length, result, index, len - index - length);
+ System.arraycopy(array, index + length, result, index, newLength - index);
return result;
}
@@ -1977,12 +2170,17 @@ public final class CollectionTools {
* java.util.Arrays#removeElementAtIndex(char[] array, int index, int length)
*/
public static char[] removeElementsAtIndex(char[] array, int index, int length) {
- int len = array.length;
- char[] result = new char[len - length];
+ int arrayLength = array.length;
+ int newLength = arrayLength - length;
+ if ((newLength == 0) && (index == 0)) {
+ return EMPTY_CHAR_ARRAY; // performance tweak
+ }
+ char[] result = new char[newLength];
System.arraycopy(array, 0, result, 0, index);
- System.arraycopy(array, index + length, result, index, len - index - length);
+ System.arraycopy(array, index + length, result, index, newLength - index);
return result;
}
+ private static final char[] EMPTY_CHAR_ARRAY = new char[0];
/**
* Return a new array that contains the elements in the
@@ -1990,22 +2188,29 @@ public final class CollectionTools {
* java.util.Arrays#removeElementAtIndex(int[] array, int index, int length)
*/
public static int[] removeElementsAtIndex(int[] array, int index, int length) {
- int len = array.length;
- int[] result = new int[len - length];
+ int arrayLength = array.length;
+ int newLength = arrayLength - length;
+ if ((newLength == 0) && (index == 0)) {
+ return EMPTY_INT_ARRAY; // performance tweak
+ }
+ int[] result = new int[newLength];
System.arraycopy(array, 0, result, 0, index);
- System.arraycopy(array, index + length, result, index, len - index - length);
+ System.arraycopy(array, index + length, result, index, newLength - index);
return result;
}
+ private static final int[] EMPTY_INT_ARRAY = new int[0];
/**
* Remove any duplicate elements from the specified array,
* while maintaining the order.
*/
public static <E> E[] removeDuplicateElements(E... array) {
- List<E> list = removeDuplicateElements(Arrays.asList(array));
- @SuppressWarnings("unchecked")
- E[] resultArray = (E[]) Array.newInstance(array.getClass().getComponentType(), list.size());
- return list.toArray(resultArray);
+ int len = array.length;
+ if ((len == 0) || (len == 1)) {
+ return array;
+ }
+ List<E> list = removeDuplicateElements(Arrays.asList(array), len);
+ return list.toArray(newArray(array, list.size()));
}
/**
@@ -2013,8 +2218,19 @@ public final class CollectionTools {
* while maintaining the order.
*/
public static <E> List<E> removeDuplicateElements(List<E> list) {
- List<E> result = new ArrayList<E>(list.size());
- Set<E> set = new HashSet<E>(list.size()); // take advantage of hashed look-up
+ int size = list.size();
+ if ((size == 0) || (size == 1)) {
+ return list;
+ }
+ return removeDuplicateElements(list, size);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static <E> List<E> removeDuplicateElements(List<E> list, int size) {
+ List<E> result = new ArrayList<E>(size);
+ Set<E> set = new HashSet<E>(size); // take advantage of hashed look-up
for (E item : list) {
if (set.add(item)) {
result.add(item);
@@ -2040,7 +2256,14 @@ public final class CollectionTools {
* java.util.Collection#retainAll(java.util.Iterator iterator)
*/
public static boolean retainAll(Collection<?> collection, Iterator<?> iterator) {
- return collection.retainAll(collection(iterator));
+ if (iterator.hasNext()) {
+ return collection.retainAll(set(iterator));
+ }
+ if (collection.isEmpty()) {
+ return false;
+ }
+ collection.clear();
+ return true;
}
/**
@@ -2050,7 +2273,14 @@ public final class CollectionTools {
* java.util.Collection#retainAll(Object[] array)
*/
public static boolean retainAll(Collection<?> collection, Object[] array) {
- return collection.retainAll(set(array));
+ if (array.length > 0) {
+ return collection.retainAll(set(array));
+ }
+ if (collection.isEmpty()) {
+ return false;
+ }
+ collection.clear();
+ return true;
}
/**
@@ -2059,14 +2289,29 @@ public final class CollectionTools {
* java.util.Arrays#retainAll(Object[] array, Collection collection)
*/
public static <E> E[] retainAll(E[] array, Collection<?> collection) {
- E[] result = array;
- // go backwards since we will be pulling elements
- // out of 'result' and it will get shorter as we go
- for (int i = array.length; i-- > 0; ) {
- if ( ! collection.contains(array[i])) {
- result = removeElementAtIndex(result, i);
+ int arrayLength = array.length;
+ return (collection.isEmpty()) ?
+ (arrayLength == 0) ? array : newArray(array, 0)
+ :
+ retainAll(array, collection, arrayLength);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static <E> E[] retainAll(E[] array, Collection<?> collection, int arrayLength) {
+ int[] indices = new int[arrayLength];
+ int j = 0;
+ for (int i = 0; i < arrayLength; i++) {
+ if (collection.contains(array[i])) {
+ indices[j++] = i;
}
}
+ E[] result = newArray(array, j);
+ int resultLength = result.length;
+ for (int i = 0; i < resultLength; i++) {
+ result[i] = array[indices[i]];
+ }
return result;
}
@@ -2076,8 +2321,11 @@ public final class CollectionTools {
* java.util.Arrays#retainAll(Object[] array1, Object[] array2)
*/
public static <E> E[] retainAll(E[] array1, Object[] array2) {
- // convert to a bag to take advantage of hashed look-up
- return retainAll(array1, bag(array2));
+ int array1Length = array1.length;
+ return (array2.length == 0) ?
+ (array1Length == 0) ? array1 : newArray(array1, 0)
+ :
+ retainAll(array1, set(array2), array1Length);
}
/**
@@ -2086,34 +2334,64 @@ public final class CollectionTools {
* java.util.Arrays#retainAll(char[] array1, char[] array2)
*/
public static char[] retainAll(char[] array1, char[] array2) {
- char[] result1 = array1;
- // go backwards since we will be pulling elements
- // out of 'result1' and it will get shorter as we go
- for (int i = array1.length; i-- > 0; ) {
- char item = array1[i];
- if ( ! contains(array2, item)) {
- result1 = removeElementAtIndex(result1, i);
+ int array1Length = array1.length;
+ int array2Length = array2.length;
+ return (array2Length == 0) ?
+ (array1Length == 0) ? array1 : EMPTY_CHAR_ARRAY
+ :
+ retainAll(array1, array2, array1Length, array2Length);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static char[] retainAll(char[] array1, char[] array2, int array1Length, int array2Length) {
+ int[] indices = new int[array1Length];
+ int j = 0;
+ for (int i = 0; i < array1Length; i++) {
+ if (contains(array2, array1[i])) {
+ indices[j++] = i;
}
}
- return result1;
+ char[] result = new char[j];
+ int resultLength = result.length;
+ for (int i = 0; i < resultLength; i++) {
+ result[i] = array1[indices[i]];
+ }
+ return result;
}
/**
* Remove from the first specified array all the elements in
* the second specified array and return the result.
- * java.util.Arrays#removeAll(int[] array1, int[] array2)
+ * java.util.Arrays#retainAll(int[] array1, int[] array2)
*/
public static int[] retainAll(int[] array1, int[] array2) {
- int[] result1 = array1;
- // go backwards since we will be pulling elements
- // out of 'result1' and it will get shorter as we go
- for (int i = array1.length; i-- > 0; ) {
- int item = array1[i];
- if ( ! contains(array2, item)) {
- result1 = removeElementAtIndex(result1, i);
+ int array1Length = array1.length;
+ int array2Length = array2.length;
+ return (array2Length == 0) ?
+ (array1Length == 0) ? array1 : EMPTY_INT_ARRAY
+ :
+ retainAll(array1, array2, array1Length, array2Length);
+ }
+
+ /**
+ * no parm-checking
+ */
+ private static int[] retainAll(int[] array1, int[] array2, int array1Length, int array2Length) {
+ int[] indices = new int[array1Length];
+ int j = 0;
+ for (int i = 0; i < array1Length; i++) {
+ if (contains(array2, array1[i])) {
+ indices[j++] = i;
}
}
- return result1;
+ int[] result = new int[j];
+ int resultLength = result.length;
+ for (int i = 0; i < resultLength; i++) {
+ result[i] = array1[indices[i]];
+ }
+ return result;
}
/**
@@ -2182,7 +2460,7 @@ public final class CollectionTools {
*/
public static <E> E[] rotate(E[] array, int distance) {
int len = array.length;
- if (len == 0) {
+ if ((len == 0) || (len == 1)) {
return array;
}
distance = distance % len;
@@ -2223,7 +2501,7 @@ public final class CollectionTools {
*/
public static char[] rotate(char[] array, int distance) {
int len = array.length;
- if (len == 0) {
+ if ((len == 0) || (len == 1)) {
return array;
}
distance = distance % len;
@@ -2264,7 +2542,7 @@ public final class CollectionTools {
*/
public static int[] rotate(int[] array, int distance) {
int len = array.length;
- if (len == 0) {
+ if ((len == 0) || (len == 1)) {
return array;
}
distance = distance % len;
@@ -2358,6 +2636,9 @@ public final class CollectionTools {
*/
public static <E> E[] shuffle(E[] array, Random random) {
int len = array.length;
+ if ((len == 0) || (len == 1)) {
+ return array;
+ }
for (int i = len; i-- > 0; ) {
swap(array, i, random.nextInt(len));
}
@@ -2378,6 +2659,9 @@ public final class CollectionTools {
*/
public static char[] shuffle(char[] array, Random random) {
int len = array.length;
+ if ((len == 0) || (len == 1)) {
+ return array;
+ }
for (int i = len; i-- > 0; ) {
swap(array, i, random.nextInt(len));
}
@@ -2398,6 +2682,9 @@ public final class CollectionTools {
*/
public static int[] shuffle(int[] array, Random random) {
int len = array.length;
+ if ((len == 0) || (len == 1)) {
+ return array;
+ }
for (int i = len; i-- > 0; ) {
swap(array, i, random.nextInt(len));
}
@@ -2533,9 +2820,10 @@ public final class CollectionTools {
* java.util.Arrays#subArray(E[] array, int start, int length)
*/
public static <E> E[] subArray(E[] array, int start, int length) {
- @SuppressWarnings("unchecked")
- E[] result = (E[]) Array.newInstance(array.getClass().getComponentType(), length);
- System.arraycopy(array, start, result, 0, length);
+ E[] result = newArray(array, length);
+ if (length > 0) {
+ System.arraycopy(array, start, result, 0, length);
+ }
return result;
}
@@ -2546,7 +2834,9 @@ public final class CollectionTools {
*/
public static int[] subArray(int[] array, int start, int length) {
int[] result = new int[length];
- System.arraycopy(array, start, result, 0, length);
+ if (length > 0) {
+ System.arraycopy(array, start, result, 0, length);
+ }
return result;
}
@@ -2557,7 +2847,9 @@ public final class CollectionTools {
*/
public static char[] subArray(char[] array, int start, int length) {
char[] result = new char[length];
- System.arraycopy(array, start, result, 0, length);
+ if (length > 0) {
+ System.arraycopy(array, start, result, 0, length);
+ }
return result;
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/FileTools.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/FileTools.java
index 0374578e70..44154c4ed5 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/FileTools.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/FileTools.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -187,10 +187,10 @@ public final class FileTools {
}
private static Iterator<File> filesIn(File[] files) {
- return new FilteringIterator<File>(new ArrayIterator<File>(files)) {
+ return new FilteringIterator<File, File>(new ArrayIterator<File>(files)) {
@Override
- protected boolean accept(Object next) {
- return ((File) next).isFile();
+ protected boolean accept(File next) {
+ return next.isFile();
}
};
}
@@ -214,10 +214,10 @@ public final class FileTools {
}
private static Iterator<File> directoriesIn(File[] files) {
- return new FilteringIterator<File>(new ArrayIterator<File>(files)) {
+ return new FilteringIterator<File, File>(new ArrayIterator<File>(files)) {
@Override
- protected boolean accept(Object next) {
- return ((File) next).isDirectory();
+ protected boolean accept(File next) {
+ return next.isDirectory();
}
};
}
@@ -816,10 +816,10 @@ public final class FileTools {
* File#files(FileFilter fileFilter)
*/
public static Iterator<File> filter(Iterator<File> files, final FileFilter fileFilter) {
- return new FilteringIterator<File>(files) {
+ return new FilteringIterator<File, File>(files) {
@Override
- protected boolean accept(Object next) {
- return fileFilter.accept((File) next);
+ protected boolean accept(File next) {
+ return fileFilter.accept(next);
}
};
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/IndentingPrintWriter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/IndentingPrintWriter.java
index c510c86ebb..f2afb1d4e6 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/IndentingPrintWriter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/IndentingPrintWriter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -132,7 +132,7 @@ public class IndentingPrintWriter extends PrintWriter {
/**
* Return the current indent level.
*/
- public int getIndentLevel() {
+ public int indentLevel() {
return this.indentLevel;
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/JDBCTools.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/JDBCTools.java
index 91f307c551..e34316fc3b 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/JDBCTools.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/JDBCTools.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -57,7 +57,7 @@ public final class JDBCTools {
* @see java.sql.Types
*/
public static JavaType javaTypeFor(JDBCType jdbcType) {
- return javaTypeForJDBCTypeNamed(jdbcType.getName());
+ return javaTypeForJDBCTypeNamed(jdbcType.name());
}
/**
@@ -141,9 +141,9 @@ public final class JDBCTools {
private static void addJDBCToJavaTypeMappingTo(int jdbcTypeCode, Class<?> javaClass, HashMap<String, JDBCToJavaTypeMapping> mappings) {
// check for duplicates
JDBCType jdbcType = JDBCType.type(jdbcTypeCode);
- Object prev = mappings.put(jdbcType.getName(), buildJDBCToJavaTypeMapping(jdbcType, javaClass));
+ Object prev = mappings.put(jdbcType.name(), buildJDBCToJavaTypeMapping(jdbcType, javaClass));
if (prev != null) {
- throw new IllegalArgumentException("duplicate JDBC type: " + jdbcType.getName());
+ throw new IllegalArgumentException("duplicate JDBC type: " + jdbcType.name());
}
}
@@ -267,11 +267,11 @@ public final class JDBCTools {
}
public boolean maps(int jdbcTypeCode) {
- return this.jdbcType.getCode() == jdbcTypeCode;
+ return this.jdbcType.code() == jdbcTypeCode;
}
public boolean maps(String jdbcTypeName) {
- return this.jdbcType.getName().equals(jdbcTypeName);
+ return this.jdbcType.name().equals(jdbcTypeName);
}
public boolean maps(JDBCType type) {
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/JDBCType.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/JDBCType.java
index 6af61e270e..82ae294c34 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/JDBCType.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/JDBCType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -57,7 +57,7 @@ public final class JDBCType
/**
* Return the name of the type, as defined in java.sql.Types.
*/
- public String getName() {
+ public String name() {
return this.name;
}
@@ -65,7 +65,7 @@ public final class JDBCType
/**
* Return the type code, as defined in java.sql.Types.
*/
- public int getCode() {
+ public int code() {
return this.code;
}
@@ -122,7 +122,7 @@ public final class JDBCType
public static JDBCType type(int code) {
JDBCType[] types = types();
for (int i = types.length; i-- > 0; ) {
- if (types[i].getCode() == code) {
+ if (types[i].code() == code) {
return types[i];
}
}
@@ -136,7 +136,7 @@ public final class JDBCType
public static JDBCType type(String name) {
JDBCType[] types = types();
for (int i = types.length; i-- > 0; ) {
- if (types[i].getName().equals(name)) {
+ if (types[i].name().equals(name)) {
return types[i];
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/JavaType.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/JavaType.java
index dffd4f07fb..de075524ee 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/JavaType.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/JavaType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -87,14 +87,14 @@ public final class JavaType
* Return the name of the type's "element type".
* A member type will have one or more '$' characters in its name.
*/
- public String getElementTypeName() {
+ public String elementTypeName() {
return this.elementTypeName;
}
/**
* Return the type's "array depth".
*/
- public int getArrayDepth() {
+ public int arrayDepth() {
return this.arrayDepth;
}
@@ -105,8 +105,32 @@ public final class JavaType
return this.arrayDepth > 0;
}
+ /**
+ * NB: void.class.isPrimitive() == true
+ */
public boolean isPrimitive() {
- return (this.arrayDepth == 0) && ClassTools.classNamedIsNonReference(this.elementTypeName);
+ return (this.arrayDepth == 0) && ClassTools.classNamedIsPrimitive(this.elementTypeName);
+ }
+
+ /**
+ * NB: void.class.isPrimitive() == true
+ */
+ public boolean isPrimitiveWrapper() {
+ return (this.arrayDepth == 0) && ClassTools.classNamedIsPrimitiveWrapperClass(this.elementTypeName);
+ }
+
+ /**
+ * NB: variables cannot be declared 'void'
+ */
+ public boolean isVariablePrimitive() {
+ return (this.arrayDepth == 0) && ClassTools.classNamedIsVariablePrimitive(this.elementTypeName);
+ }
+
+ /**
+ * NB: variables cannot be declared 'void'
+ */
+ public boolean isVariablePrimitiveWrapper() {
+ return (this.arrayDepth == 0) && ClassTools.classNamedIsVariablePrimitiveWrapperClass(this.elementTypeName);
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/NameTools.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/NameTools.java
index 264cc073ac..5610f00845 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/NameTools.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/NameTools.java
@@ -122,7 +122,7 @@ public final class NameTools {
*/
public static String buildQualifiedDatabaseObjectName(String catalog, String schema, String name) {
if (name == null) {
- throw new IllegalArgumentException();
+ return null;
}
if ((catalog == null) && (schema == null)) {
return name;
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/ReverseComparator.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/ReverseComparator.java
index 16ff4584d5..10c01f80f0 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/ReverseComparator.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/ReverseComparator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -30,7 +30,6 @@ public class ReverseComparator<E extends Comparable<? super E>>
this.comparator = comparator;
}
- @SuppressWarnings("unchecked")
public int compare(E e1, E e2) {
return (this.comparator == null) ?
e2.compareTo(e1)
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SimpleStack.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SimpleStack.java
index e45bea5269..f183943d9a 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SimpleStack.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SimpleStack.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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,6 +10,7 @@
package org.eclipse.jpt.utility.internal;
import java.io.Serializable;
+import java.util.Collection;
import java.util.EmptyStackException;
import java.util.LinkedList;
import java.util.NoSuchElementException;
@@ -35,6 +36,18 @@ public class SimpleStack<E>
this.elements = new LinkedList<E>();
}
+ /**
+ * Construct a stack containing the elements of the specified
+ * collection. The stack will pop its elements in reverse of the
+ * order they are returned by the collection's iterator (i.e. the
+ * last element returned by the collection's iterator will be the
+ * first element returned by #pop()).
+ */
+ public SimpleStack(Collection<? extends E> c) {
+ super();
+ this.elements = new LinkedList<E>(c);
+ }
+
// ********** Stack implementation **********
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SimpleStringMatcher.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SimpleStringMatcher.java
index 7de0f24255..6ea439dda6 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SimpleStringMatcher.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SimpleStringMatcher.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -37,12 +37,12 @@ import java.util.regex.Pattern;
* object is compared to the pattern. By default the string returned
* by the object's #toString() method is passed to the pattern matcher.
*/
-public class SimpleStringMatcher
- implements StringMatcher, Filter, Serializable
+public class SimpleStringMatcher<T>
+ implements StringMatcher, Filter<T>, Serializable
{
/** An adapter that converts the objects into strings to be matched with the pattern. */
- private StringConverter stringConverter;
+ private StringConverter<T> stringConverter;
/** The string used to construct the regular expression pattern. */
private String patternString;
@@ -135,7 +135,7 @@ public class SimpleStringMatcher
// ********** Filter implementation **********
- public synchronized boolean accept(Object o) {
+ public synchronized boolean accept(T o) {
return this.matches(this.stringConverter.convertToString(o));
}
@@ -146,7 +146,7 @@ public class SimpleStringMatcher
* Return the string converter used to convert the objects
* passed to the matcher into strings.
*/
- public synchronized StringConverter getStringConverter() {
+ public synchronized StringConverter<T> stringConverter() {
return this.stringConverter;
}
@@ -154,14 +154,14 @@ public class SimpleStringMatcher
* Set the string converter used to convert the objects
* passed to the matcher into strings.
*/
- public synchronized void setStringConverter(StringConverter stringConverter) {
+ public synchronized void setStringConverter(StringConverter<T> stringConverter) {
this.stringConverter = stringConverter;
}
/**
* Return the original pattern string.
*/
- public synchronized String getPatternString() {
+ public synchronized String patternString() {
return this.patternString;
}
@@ -183,7 +183,7 @@ public class SimpleStringMatcher
/**
* Return the regular expression pattern.
*/
- public synchronized Pattern getPattern() {
+ public synchronized Pattern pattern() {
return this.pattern;
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/StringMatcher.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/StringMatcher.java
index 5dd8f28725..5f769d7040 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/StringMatcher.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/StringMatcher.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -33,19 +33,26 @@ public interface StringMatcher {
boolean matches(String string);
- StringMatcher NULL_INSTANCE =
- new StringMatcher() {
- public void setPatternString(String patternString) {
- // ignore the pattern string
- }
- public boolean matches(String string) {
- // everything is a match
- return true;
- }
- @Override
- public String toString() {
- return "NullStringMatcher";
- }
- };
+ final class Null implements StringMatcher {
+ public static final StringMatcher INSTANCE = new Null();
+ public static StringMatcher instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Null() {
+ super();
+ }
+ public void setPatternString(String patternString) {
+ // ignore the pattern string
+ }
+ public boolean matches(String string) {
+ // everything is a match
+ return true;
+ }
+ @Override
+ public String toString() {
+ return "StringMatcher.Null";
+ }
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/StringTools.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/StringTools.java
index 75d399b443..a7cc25a96c 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/StringTools.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/StringTools.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -91,7 +91,7 @@ public final class StringTools {
if (stringLength == length) {
return string;
}
- return padInternal(string, length, c);
+ return pad_(string, length, c);
}
/**
@@ -103,7 +103,15 @@ public final class StringTools {
* String#padOn(int, char, Writer)
*/
public static void padOn(String string, int length, char c, Writer writer) {
- padOn(string.toCharArray(), length, c, writer);
+ int stringLength = string.length();
+ if (stringLength > length) {
+ throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length);
+ }
+ if (stringLength == length) {
+ writeStringOn(string, writer);
+ } else {
+ padOn_(string, length, c, writer);
+ }
}
/**
@@ -115,7 +123,15 @@ public final class StringTools {
* String#padOn(int, char, StringBuffer)
*/
public static void padOn(String string, int length, char c, StringBuffer sb) {
- padOn(string.toCharArray(), length, c, sb);
+ int stringLength = string.length();
+ if (stringLength > length) {
+ throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length);
+ }
+ if (stringLength == length) {
+ sb.append(string);
+ } else {
+ padOn_(string, length, c, sb);
+ }
}
/**
@@ -127,7 +143,15 @@ public final class StringTools {
* String#padOn(int, char, StringBuilder)
*/
public static void padOn(String string, int length, char c, StringBuilder sb) {
- padOn(string.toCharArray(), length, c, sb);
+ int stringLength = string.length();
+ if (stringLength > length) {
+ throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length);
+ }
+ if (stringLength == length) {
+ sb.append(string);
+ } else {
+ padOn_(string, length, c, sb);
+ }
}
/**
@@ -190,7 +214,7 @@ public final class StringTools {
if (stringLength == length) {
return string;
}
- return padInternal(string, length, c);
+ return pad_(string, length, c);
}
/**
@@ -209,7 +233,7 @@ public final class StringTools {
if (stringLength == length) {
writeStringOn(string, writer);
} else {
- padOnInternal(string, length, c, writer);
+ padOn_(string, length, c, writer);
}
}
@@ -229,7 +253,7 @@ public final class StringTools {
if (stringLength == length) {
sb.append(string);
} else {
- padOnInternal(string, length, c, sb);
+ padOn_(string, length, c, sb);
}
}
@@ -249,7 +273,7 @@ public final class StringTools {
if (stringLength == length) {
sb.append(string);
} else {
- padOnInternal(string, length, c, sb);
+ padOn_(string, length, c, sb);
}
}
@@ -313,7 +337,7 @@ public final class StringTools {
if (stringLength > length) {
return string.substring(0, length);
}
- return padInternal(string, length, c);
+ return pad_(string, length, c);
}
/**
@@ -325,7 +349,14 @@ public final class StringTools {
* String#padOrTruncateOn(int, char, Writer)
*/
public static void padOrTruncateOn(String string, int length, char c, Writer writer) {
- padOrTruncateOn(string.toCharArray(), length, c, writer);
+ int stringLength = string.length();
+ if (stringLength == length) {
+ writeStringOn(string, writer);
+ } else if (stringLength > length) {
+ writeStringOn(string.substring(0, length), writer);
+ } else {
+ padOn_(string, length, c, writer);
+ }
}
/**
@@ -337,7 +368,14 @@ public final class StringTools {
* String#padOrTruncateOn(int, char, StringBuffer)
*/
public static void padOrTruncateOn(String string, int length, char c, StringBuffer sb) {
- padOrTruncateOn(string.toCharArray(), length, c, sb);
+ int stringLength = string.length();
+ if (stringLength == length) {
+ sb.append(string);
+ } else if (stringLength > length) {
+ sb.append(string.substring(0, length));
+ } else {
+ padOn_(string, length, c, sb);
+ }
}
/**
@@ -349,7 +387,14 @@ public final class StringTools {
* String#padOrTruncateOn(int, char, StringBuilder)
*/
public static void padOrTruncateOn(String string, int length, char c, StringBuilder sb) {
- padOrTruncateOn(string.toCharArray(), length, c, sb);
+ int stringLength = string.length();
+ if (stringLength == length) {
+ sb.append(string);
+ } else if (stringLength > length) {
+ sb.append(string.substring(0, length));
+ } else {
+ padOn_(string, length, c, sb);
+ }
}
/**
@@ -414,7 +459,7 @@ public final class StringTools {
System.arraycopy(string, 0, result, 0, length);
return result;
}
- return padInternal(string, length, c);
+ return pad_(string, length, c);
}
/**
@@ -432,7 +477,7 @@ public final class StringTools {
} else if (stringLength > length) {
writeStringOn(string, 0, length, writer);
} else {
- padOnInternal(string, length, c, writer);
+ padOn_(string, length, c, writer);
}
}
@@ -451,7 +496,7 @@ public final class StringTools {
} else if (stringLength > length) {
sb.append(string, 0, length);
} else {
- padOnInternal(string, length, c, sb);
+ padOn_(string, length, c, sb);
}
}
@@ -470,21 +515,117 @@ public final class StringTools {
} else if (stringLength > length) {
sb.append(string, 0, length);
} else {
- padOnInternal(string, length, c, sb);
+ padOn_(string, length, c, sb);
}
}
- /**
+ /*
* Pad the specified string without validating the parms.
*/
- private static String padInternal(String string, int length, char c) {
- return new String(padInternal(string.toCharArray(), length, c));
+ private static String pad_(String string, int length, char c) {
+ return new String(pad_(string.toCharArray(), length, c));
}
- /**
+ /*
* Pad the specified string without validating the parms.
*/
- private static char[] padInternal(char[] string, int length, char c) {
+ private static void padOn_(String string, int length, char c, Writer writer) {
+ writeStringOn(string, writer);
+ fill_(string, length, c, writer);
+ }
+
+ /*
+ * Add enough characters to the specified writer to compensate for
+ * the difference between the specified string and specified length.
+ */
+ private static void fill_(String string, int length, char c, Writer writer) {
+ fill_(string.length(), length, c, writer);
+ }
+
+ /*
+ * Add enough characters to the specified writer to compensate for
+ * the difference between the specified string and specified length.
+ */
+ private static void fill_(char[] string, int length, char c, Writer writer) {
+ fill_(string.length, length, c, writer);
+ }
+
+ /*
+ * Add enough characters to the specified writer to compensate for
+ * the difference between the specified string and specified length.
+ */
+ private static void fill_(int stringLength, int length, char c, Writer writer) {
+ writeStringOn(CollectionTools.fill(new char[length - stringLength], c), writer);
+ }
+
+ /*
+ * Pad the specified string without validating the parms.
+ */
+ private static void padOn_(String string, int length, char c, StringBuffer sb) {
+ sb.append(string);
+ fill_(string, length, c, sb);
+ }
+
+ /*
+ * Add enough characters to the specified string buffer to compensate for
+ * the difference between the specified string and specified length.
+ */
+ private static void fill_(String string, int length, char c, StringBuffer sb) {
+ fill_(string.length(), length, c, sb);
+ }
+
+ /*
+ * Add enough characters to the specified string buffer to compensate for
+ * the difference between the specified string and specified length.
+ */
+ private static void fill_(char[] string, int length, char c, StringBuffer sb) {
+ fill_(string.length, length, c, sb);
+ }
+
+ /*
+ * Add enough characters to the specified string buffer to compensate for
+ * the difference between the specified string and specified length.
+ */
+ private static void fill_(int stringLength, int length, char c, StringBuffer sb) {
+ sb.append(CollectionTools.fill(new char[length - stringLength], c));
+ }
+
+ /*
+ * Pad the specified string without validating the parms.
+ */
+ private static void padOn_(String string, int length, char c, StringBuilder sb) {
+ sb.append(string);
+ fill_(string, length, c, sb);
+ }
+
+ /*
+ * Add enough characters to the specified string builder to compensate for
+ * the difference between the specified string and specified length.
+ */
+ private static void fill_(String string, int length, char c, StringBuilder sb) {
+ fill_(string.length(), length, c, sb);
+ }
+
+ /*
+ * Add enough characters to the specified string builder to compensate for
+ * the difference between the specified string and specified length.
+ */
+ private static void fill_(char[] string, int length, char c, StringBuilder sb) {
+ fill_(string.length, length, c, sb);
+ }
+
+ /*
+ * Add enough characters to the specified string builder to compensate for
+ * the difference between the specified string and specified length.
+ */
+ private static void fill_(int stringLength, int length, char c, StringBuilder sb) {
+ sb.append(CollectionTools.fill(new char[length - stringLength], c));
+ }
+
+ /*
+ * Pad the specified string without validating the parms.
+ */
+ private static char[] pad_(char[] string, int length, char c) {
char[] result = new char[length];
int stringLength = string.length;
System.arraycopy(string, 0, result, 0, stringLength);
@@ -492,28 +633,28 @@ public final class StringTools {
return result;
}
- /**
+ /*
* Pad the specified string without validating the parms.
*/
- private static void padOnInternal(char[] string, int length, char c, Writer writer) {
+ private static void padOn_(char[] string, int length, char c, Writer writer) {
writeStringOn(string, writer);
- writeStringOn(CollectionTools.fill(new char[length - string.length], c), writer);
+ fill_(string, length, c, writer);
}
- /**
+ /*
* Pad the specified string without validating the parms.
*/
- private static void padOnInternal(char[] string, int length, char c, StringBuffer sb) {
+ private static void padOn_(char[] string, int length, char c, StringBuffer sb) {
sb.append(string);
- sb.append(CollectionTools.fill(new char[length - string.length], c));
+ fill_(string, length, c, sb);
}
- /**
+ /*
* Pad the specified string without validating the parms.
*/
- private static void padOnInternal(char[] string, int length, char c, StringBuilder sb) {
+ private static void padOn_(char[] string, int length, char c, StringBuilder sb) {
sb.append(string);
- sb.append(CollectionTools.fill(new char[length - string.length], c));
+ fill_(string, length, c, sb);
}
/**
@@ -576,7 +717,7 @@ public final class StringTools {
if (stringLength == length) {
return string;
}
- return frontPadInternal(string, length, c);
+ return frontPad_(string, length, c);
}
/**
@@ -588,7 +729,15 @@ public final class StringTools {
* String#frontPadOn(int, char, Writer)
*/
public static void frontPadOn(String string, int length, char c, Writer writer) {
- frontPadOn(string.toCharArray(), length, c, writer);
+ int stringLength = string.length();
+ if (stringLength > length) {
+ throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length);
+ }
+ if (stringLength == length) {
+ writeStringOn(string, writer);
+ } else {
+ frontPadOn_(string, length, c, writer);
+ }
}
/**
@@ -600,7 +749,15 @@ public final class StringTools {
* String#frontPadOn(int, char, StringBuffer)
*/
public static void frontPadOn(String string, int length, char c, StringBuffer sb) {
- frontPadOn(string.toCharArray(), length, c, sb);
+ int stringLength = string.length();
+ if (stringLength > length) {
+ throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length);
+ }
+ if (stringLength == length) {
+ sb.append(string);
+ } else {
+ frontPadOn_(string, length, c, sb);
+ }
}
/**
@@ -612,7 +769,15 @@ public final class StringTools {
* String#frontPadOn(int, char, StringBuilder)
*/
public static void frontPadOn(String string, int length, char c, StringBuilder sb) {
- frontPadOn(string.toCharArray(), length, c, sb);
+ int stringLength = string.length();
+ if (stringLength > length) {
+ throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length);
+ }
+ if (stringLength == length) {
+ sb.append(string);
+ } else {
+ frontPadOn_(string, length, c, sb);
+ }
}
/**
@@ -675,7 +840,7 @@ public final class StringTools {
if (stringLength == length) {
return string;
}
- return frontPadInternal(string, length, c);
+ return frontPad_(string, length, c);
}
/**
@@ -694,7 +859,7 @@ public final class StringTools {
if (stringLength == length) {
writeStringOn(string, writer);
} else {
- frontPadOnInternal(string, length, c, writer);
+ frontPadOn_(string, length, c, writer);
}
}
@@ -714,7 +879,7 @@ public final class StringTools {
if (stringLength == length) {
sb.append(string);
} else {
- frontPadOnInternal(string, length, c, sb);
+ frontPadOn_(string, length, c, sb);
}
}
@@ -734,7 +899,7 @@ public final class StringTools {
if (stringLength == length) {
sb.append(string);
} else {
- frontPadOnInternal(string, length, c, sb);
+ frontPadOn_(string, length, c, sb);
}
}
@@ -798,7 +963,7 @@ public final class StringTools {
if (stringLength > length) {
return string.substring(stringLength - length);
}
- return frontPadInternal(string, length, c);
+ return frontPad_(string, length, c);
}
/**
@@ -810,7 +975,14 @@ public final class StringTools {
* String#frontPadOrTruncateOn(int, char, Writer)
*/
public static void frontPadOrTruncateOn(String string, int length, char c, Writer writer) {
- frontPadOrTruncateOn(string.toCharArray(), length, c, writer);
+ int stringLength = string.length();
+ if (stringLength == length) {
+ writeStringOn(string, writer);
+ } else if (stringLength > length) {
+ writeStringOn(string.substring(stringLength - length), writer);
+ } else {
+ frontPadOn_(string, length, c, writer);
+ }
}
/**
@@ -822,7 +994,14 @@ public final class StringTools {
* String#frontPadOrTruncateOn(int, char, StringBuffer)
*/
public static void frontPadOrTruncateOn(String string, int length, char c, StringBuffer sb) {
- frontPadOrTruncateOn(string.toCharArray(), length, c, sb);
+ int stringLength = string.length();
+ if (stringLength == length) {
+ sb.append(string);
+ } else if (stringLength > length) {
+ sb.append(string.substring(stringLength - length));
+ } else {
+ frontPadOn_(string, length, c, sb);
+ }
}
/**
@@ -834,7 +1013,14 @@ public final class StringTools {
* String#frontPadOrTruncateOn(int, char, StringBuilder)
*/
public static void frontPadOrTruncateOn(String string, int length, char c, StringBuilder sb) {
- frontPadOrTruncateOn(string.toCharArray(), length, c, sb);
+ int stringLength = string.length();
+ if (stringLength == length) {
+ sb.append(string);
+ } else if (stringLength > length) {
+ sb.append(string.substring(stringLength - length));
+ } else {
+ frontPadOn_(string, length, c, sb);
+ }
}
/**
@@ -899,7 +1085,7 @@ public final class StringTools {
System.arraycopy(string, stringLength - length, result, 0, length);
return result;
}
- return frontPadInternal(string, length, c);
+ return frontPad_(string, length, c);
}
/**
@@ -917,7 +1103,7 @@ public final class StringTools {
} else if (stringLength > length) {
writeStringOn(string, stringLength - length, length, writer);
} else {
- frontPadOnInternal(string, length, c, writer);
+ frontPadOn_(string, length, c, writer);
}
}
@@ -936,7 +1122,7 @@ public final class StringTools {
} else if (stringLength > length) {
sb.append(string, stringLength - length, length);
} else {
- frontPadOnInternal(string, length, c, sb);
+ frontPadOn_(string, length, c, sb);
}
}
@@ -955,21 +1141,21 @@ public final class StringTools {
} else if (stringLength > length) {
sb.append(string, stringLength - length, length);
} else {
- frontPadOnInternal(string, length, c, sb);
+ frontPadOn_(string, length, c, sb);
}
}
- /**
+ /*
* Front-pad the specified string without validating the parms.
*/
- private static String frontPadInternal(String string, int length, char c) {
- return new String(frontPadInternal(string.toCharArray(), length, c));
+ private static String frontPad_(String string, int length, char c) {
+ return new String(frontPad_(string.toCharArray(), length, c));
}
- /**
+ /*
* Zero-pad the specified string without validating the parms.
*/
- private static char[] frontPadInternal(char[] string, int length, char c) {
+ private static char[] frontPad_(char[] string, int length, char c) {
char[] result = new char[length];
int stringLength = string.length;
int padLength = length - stringLength;
@@ -978,27 +1164,51 @@ public final class StringTools {
return result;
}
- /**
+ /*
* Pad the specified string without validating the parms.
*/
- private static void frontPadOnInternal(char[] string, int length, char c, Writer writer) {
- writeStringOn(CollectionTools.fill(new char[length - string.length], c), writer);
+ private static void frontPadOn_(String string, int length, char c, Writer writer) {
+ fill_(string, length, c, writer);
writeStringOn(string, writer);
}
- /**
+ /*
+ * Pad the specified string without validating the parms.
+ */
+ private static void frontPadOn_(char[] string, int length, char c, Writer writer) {
+ fill_(string, length, c, writer);
+ writeStringOn(string, writer);
+ }
+
+ /*
* Pad the specified string without validating the parms.
*/
- private static void frontPadOnInternal(char[] string, int length, char c, StringBuffer sb) {
- sb.append(CollectionTools.fill(new char[length - string.length], c));
+ private static void frontPadOn_(String string, int length, char c, StringBuffer sb) {
+ fill_(string, length, c, sb);
sb.append(string);
}
- /**
+ /*
* Pad the specified string without validating the parms.
*/
- private static void frontPadOnInternal(char[] string, int length, char c, StringBuilder sb) {
- sb.append(CollectionTools.fill(new char[length - string.length], c));
+ private static void frontPadOn_(char[] string, int length, char c, StringBuffer sb) {
+ fill_(string, length, c, sb);
+ sb.append(string);
+ }
+
+ /*
+ * Pad the specified string without validating the parms.
+ */
+ private static void frontPadOn_(String string, int length, char c, StringBuilder sb) {
+ fill_(string, length, c, sb);
+ sb.append(string);
+ }
+
+ /*
+ * Pad the specified string without validating the parms.
+ */
+ private static void frontPadOn_(char[] string, int length, char c, StringBuilder sb) {
+ fill_(string, length, c, sb);
sb.append(string);
}
@@ -1058,7 +1268,9 @@ public final class StringTools {
* the wrap at the front and back of the resulting string.
*/
public static void wrapOn(String string, char wrap, Writer writer) {
- wrapOn(string.toCharArray(), wrap, writer);
+ writeCharOn(wrap, writer);
+ writeStringOn(string, writer);
+ writeCharOn(wrap, writer);
}
/**
@@ -1066,7 +1278,9 @@ public final class StringTools {
* the wrap at the front and back of the resulting string.
*/
public static void wrapOn(String string, char wrap, StringBuffer sb) {
- wrapOn(string.toCharArray(), wrap, sb);
+ sb.append(wrap);
+ sb.append(string);
+ sb.append(wrap);
}
/**
@@ -1074,7 +1288,9 @@ public final class StringTools {
* the wrap at the front and back of the resulting string.
*/
public static void wrapOn(String string, char wrap, StringBuilder sb) {
- wrapOn(string.toCharArray(), wrap, sb);
+ sb.append(wrap);
+ sb.append(string);
+ sb.append(wrap);
}
/**
@@ -1103,7 +1319,9 @@ public final class StringTools {
* the wrap at the front and back of the resulting string.
*/
public static void wrapOn(String string, String wrap, Writer writer) {
- wrapOn(string.toCharArray(), wrap.toCharArray(), writer);
+ writeStringOn(wrap, writer);
+ writeStringOn(string, writer);
+ writeStringOn(wrap, writer);
}
/**
@@ -1111,7 +1329,9 @@ public final class StringTools {
* the wrap at the front and back of the resulting string.
*/
public static void wrapOn(String string, String wrap, StringBuffer sb) {
- wrapOn(string.toCharArray(), wrap.toCharArray(), sb);
+ sb.append(wrap);
+ sb.append(string);
+ sb.append(wrap);
}
/**
@@ -1119,7 +1339,9 @@ public final class StringTools {
* the wrap at the front and back of the resulting string.
*/
public static void wrapOn(String string, String wrap, StringBuilder sb) {
- wrapOn(string.toCharArray(), wrap.toCharArray(), sb);
+ sb.append(wrap);
+ sb.append(string);
+ sb.append(wrap);
}
/**
@@ -1321,7 +1543,12 @@ public final class StringTools {
* String#removeFirstOccurrenceOn(char, Writer)
*/
public static void removeFirstOccurrenceOn(String string, char c, Writer writer) {
- removeFirstOccurrenceOn(string.toCharArray(), c, writer);
+ int index = string.indexOf(c);
+ if (index == -1) {
+ writeStringOn(string, writer);
+ } else {
+ removeFirstOccurrenceOn_(string.toCharArray(), c, writer, index);
+ }
}
/**
@@ -1330,7 +1557,12 @@ public final class StringTools {
* String#removeFirstOccurrenceOn(char, StringBuffer)
*/
public static void removeFirstOccurrenceOn(String string, char c, StringBuffer sb) {
- removeFirstOccurrenceOn(string.toCharArray(), c, sb);
+ int index = string.indexOf(c);
+ if (index == -1) {
+ sb.append(string);
+ } else {
+ removeFirstOccurrenceOn_(string.toCharArray(), c, sb, index);
+ }
}
/**
@@ -1339,7 +1571,12 @@ public final class StringTools {
* String#removeFirstOccurrenceOn(char, StringBuilder)
*/
public static void removeFirstOccurrenceOn(String string, char c, StringBuilder sb) {
- removeFirstOccurrenceOn(string.toCharArray(), c, sb);
+ int index = string.indexOf(c);
+ if (index == -1) {
+ sb.append(string);
+ } else {
+ removeFirstOccurrenceOn_(string.toCharArray(), c, sb, index);
+ }
}
/**
@@ -1353,19 +1590,18 @@ public final class StringTools {
// character not found
return string;
}
-
- int len = string.length - 1;
- char[] result = new char[len];
+ int last = string.length - 1;
+ char[] result = new char[last];
if (index == 0) {
// character found at the front of string
- System.arraycopy(string, 1, result, 0, len);
- } else if (index == len) {
+ System.arraycopy(string, 1, result, 0, last);
+ } else if (index == last) {
// character found at the end of string
- System.arraycopy(string, 0, result, 0, len);
+ System.arraycopy(string, 0, result, 0, last);
} else {
// character found somewhere in the middle of the string
System.arraycopy(string, 0, result, 0, index);
- System.arraycopy(string, index + 1, result, index, len - index);
+ System.arraycopy(string, index + 1, result, index, last - index);
}
return result;
}
@@ -1378,22 +1614,24 @@ public final class StringTools {
public static void removeFirstOccurrenceOn(char[] string, char c, Writer writer) {
int index = CollectionTools.indexOf(string, c);
if (index == -1) {
- // character not found
writeStringOn(string, writer);
- return;
+ } else {
+ removeFirstOccurrenceOn_(string, c, writer, index);
}
+ }
- int len = string.length - 1;
+ private static void removeFirstOccurrenceOn_(char[] string, char c, Writer writer, int index) {
+ int last = string.length - 1;
if (index == 0) {
// character found at the front of string
- writeStringOn(string, 1, len, writer);
- } else if (index == len) {
+ writeStringOn(string, 1, last, writer);
+ } else if (index == last) {
// character found at the end of string
- writeStringOn(string, 0, len, writer);
+ writeStringOn(string, 0, last, writer);
} else {
// character found somewhere in the middle of the string
writeStringOn(string, 0, index, writer);
- writeStringOn(string, index + 1, len - index, writer);
+ writeStringOn(string, index + 1, last - index, writer);
}
}
@@ -1405,22 +1643,24 @@ public final class StringTools {
public static void removeFirstOccurrenceOn(char[] string, char c, StringBuffer sb) {
int index = CollectionTools.indexOf(string, c);
if (index == -1) {
- // character not found
sb.append(string);
- return;
+ } else {
+ removeFirstOccurrenceOn_(string, c, sb, index);
}
+ }
- int len = string.length - 1;
+ private static void removeFirstOccurrenceOn_(char[] string, char c, StringBuffer sb, int index) {
+ int last = string.length - 1;
if (index == 0) {
// character found at the front of string
- sb.append(string, 1, len);
- } else if (index == len) {
+ sb.append(string, 1, last);
+ } else if (index == last) {
// character found at the end of string
- sb.append(string, 0, len);
+ sb.append(string, 0, last);
} else {
// character found somewhere in the middle of the string
sb.append(string, 0, index);
- sb.append(string, index + 1, len - index);
+ sb.append(string, index + 1, last - index);
}
}
@@ -1432,22 +1672,24 @@ public final class StringTools {
public static void removeFirstOccurrenceOn(char[] string, char c, StringBuilder sb) {
int index = CollectionTools.indexOf(string, c);
if (index == -1) {
- // character not found
sb.append(string);
- return;
+ } else {
+ removeFirstOccurrenceOn_(string, c, sb, index);
}
+ }
- int len = string.length - 1;
+ private static void removeFirstOccurrenceOn_(char[] string, char c, StringBuilder sb, int index) {
+ int last = string.length - 1;
if (index == 0) {
// character found at the front of string
- sb.append(string, 1, len);
- } else if (index == len) {
+ sb.append(string, 1, last);
+ } else if (index == last) {
// character found at the end of string
- sb.append(string, 0, len);
+ sb.append(string, 0, last);
} else {
// character found somewhere in the middle of the string
sb.append(string, 0, index);
- sb.append(string, index + 1, len - index);
+ sb.append(string, index + 1, last - index);
}
}
@@ -1457,7 +1699,8 @@ public final class StringTools {
* String#removeAllOccurrences(char)
*/
public static String removeAllOccurrences(String string, char c) {
- return new String(removeAllOccurrences(string.toCharArray(), c));
+ int first = string.indexOf(c);
+ return (first == -1) ? string : new String(removeAllOccurrences_(string.toCharArray(), c, first));
}
/**
@@ -1466,7 +1709,12 @@ public final class StringTools {
* String#removeAllOccurrencesOn(char, Writer)
*/
public static void removeAllOccurrencesOn(String string, char c, Writer writer) {
- removeAllOccurrencesOn(string.toCharArray(), c, writer);
+ int first = string.indexOf(c);
+ if (first == -1) {
+ writeStringOn(string, writer);
+ } else {
+ removeAllOccurrencesOn_(string.toCharArray(), c, first, writer);
+ }
}
/**
@@ -1475,7 +1723,12 @@ public final class StringTools {
* String#removeAllOccurrencesOn(char, StringBuffer)
*/
public static void removeAllOccurrencesOn(String string, char c, StringBuffer sb) {
- removeAllOccurrencesOn(string.toCharArray(), c, sb);
+ int first = string.indexOf(c);
+ if (first == -1) {
+ sb.append(string);
+ } else {
+ removeAllOccurrencesOn_(string.toCharArray(), c, first, sb);
+ }
}
/**
@@ -1484,7 +1737,12 @@ public final class StringTools {
* String#removeAllOccurrencesOn(char, StringBuilder)
*/
public static void removeAllOccurrencesOn(String string, char c, StringBuilder sb) {
- removeAllOccurrencesOn(string.toCharArray(), c, sb);
+ int first = string.indexOf(c);
+ if (first == -1) {
+ sb.append(string);
+ } else {
+ removeAllOccurrencesOn_(string.toCharArray(), c, first, sb);
+ }
}
/**
@@ -1493,12 +1751,17 @@ public final class StringTools {
* String#removeAllOccurrences(char)
*/
public static char[] removeAllOccurrences(char[] string, char c) {
+ int first = CollectionTools.indexOf(string, c);
+ return (first == -1) ? string : removeAllOccurrences_(string, c, first);
+ }
+
+ /*
+ * The index of the first matching character is passed in.
+ */
+ private static char[] removeAllOccurrences_(char[] string, char c, int first) {
StringBuilder sb = new StringBuilder(string.length);
- removeAllOccurrencesOn(string, c, sb);
- int len = sb.length();
- char[] result = new char[len];
- sb.getChars(0, len, result, 0);
- return result;
+ removeAllOccurrencesOn_(string, c, first, sb);
+ return convertToCharArray(sb);
}
/**
@@ -1508,11 +1771,22 @@ public final class StringTools {
* String#removeAllOccurrencesOn(char, Writer)
*/
public static void removeAllOccurrencesOn(char[] string, char c, Writer writer) {
- removeAllOccurrencesOnInternal(string, c, writer);
+ int first = CollectionTools.indexOf(string, c);
+ if (first == -1) {
+ writeStringOn(string, writer);
+ } else {
+ removeAllOccurrencesOn_(string, c, first, writer);
+ }
}
- private static void removeAllOccurrencesOnInternal(char[] string, char c, Writer writer) {
- for (char d : string) {
+ /*
+ * The index of the first matching character is passed in.
+ */
+ private static void removeAllOccurrencesOn_(char[] string, char c, int first, Writer writer) {
+ writeStringOn(string, 0, first, writer);
+ int len = string.length;
+ for (int i = first; i < len; i++) {
+ char d = string[i];
if (d != c) {
writeCharOn(d, writer);
}
@@ -1526,7 +1800,22 @@ public final class StringTools {
* String#removeAllOccurrencesOn(char, StringBuffer)
*/
public static void removeAllOccurrencesOn(char[] string, char c, StringBuffer sb) {
- for (char d : string) {
+ int first = CollectionTools.indexOf(string, c);
+ if (first == -1) {
+ sb.append(string);
+ } else {
+ removeAllOccurrencesOn_(string, c, first, sb);
+ }
+ }
+
+ /*
+ * The index of the first matching character is passed in.
+ */
+ private static void removeAllOccurrencesOn_(char[] string, char c, int first, StringBuffer sb) {
+ sb.append(string, 0, first);
+ int len = string.length;
+ for (int i = first; i < len; i++) {
+ char d = string[i];
if (d != c) {
sb.append(d);
}
@@ -1536,11 +1825,26 @@ public final class StringTools {
/**
* Remove all occurrences of the specified character
* from the specified string and append the result to the
- * specified string buffer.
+ * specified string builder.
* String#removeAllOccurrencesOn(char, StringBuilder)
*/
public static void removeAllOccurrencesOn(char[] string, char c, StringBuilder sb) {
- for (char d : string) {
+ int first = CollectionTools.indexOf(string, c);
+ if (first == -1) {
+ sb.append(string);
+ } else {
+ removeAllOccurrencesOn_(string, c, first, sb);
+ }
+ }
+
+ /*
+ * The index of the first matching character is passed in.
+ */
+ private static void removeAllOccurrencesOn_(char[] string, char c, int first, StringBuilder sb) {
+ sb.append(string, 0, first);
+ int len = string.length;
+ for (int i = first; i < len; i++) {
+ char d = string[i];
if (d != c) {
sb.append(d);
}
@@ -1555,6 +1859,246 @@ public final class StringTools {
return removeAllOccurrences(string, ' ');
}
+ /**
+ * Remove all the spaces
+ * from the specified string and write the result to the specified writer.
+ * String#removeAllSpacesOn(Writer)
+ */
+ public static void removeAllSpacesOn(String string, Writer writer) {
+ removeAllOccurrencesOn(string, ' ', writer);
+ }
+
+ /**
+ * Remove all the spaces
+ * from the specified string and write the result to the specified
+ * string buffer.
+ * String#removeAllSpacesOn(StringBuffer)
+ */
+ public static void removeAllSpacesOn(String string, StringBuffer sb) {
+ removeAllOccurrencesOn(string, ' ', sb);
+ }
+
+ /**
+ * Remove all the spaces
+ * from the specified string and write the result to the specified
+ * string builder.
+ * String#removeAllSpacesOn(StringBuilder)
+ */
+ public static void removeAllSpacesOn(String string, StringBuilder sb) {
+ removeAllOccurrencesOn(string, ' ', sb);
+ }
+
+ /**
+ * Remove all the spaces from the specified string and return the result.
+ * String#removeAllSpaces()
+ */
+ public static char[] removeAllSpaces(char[] string) {
+ return removeAllOccurrences(string, ' ');
+ }
+
+ /**
+ * Remove all the spaces
+ * from the specified string and write the result to the
+ * specified writer.
+ * String#removeAllSpacesOn(Writer)
+ */
+ public static void removeAllSpacesOn(char[] string, Writer writer) {
+ removeAllOccurrencesOn(string, ' ', writer);
+ }
+
+ /**
+ * Remove all the spaces
+ * from the specified string and append the result to the
+ * specified string buffer.
+ * String#removeAllSpacesOn(StringBuffer)
+ */
+ public static void removeAllSpacesOn(char[] string, StringBuffer sb) {
+ removeAllOccurrencesOn(string, ' ', sb);
+ }
+
+ /**
+ * Remove all the spaces
+ * from the specified string and append the result to the
+ * specified string builder.
+ * String#removeAllSpacesOn(StringBuilder)
+ */
+ public static void removeAllSpacesOn(char[] string, StringBuilder sb) {
+ removeAllOccurrencesOn(string, ' ', sb);
+ }
+
+ /**
+ * Remove all the whitespace from the specified string and return the result.
+ * String#removeAllWhitespace()
+ */
+ public static String removeAllWhitespace(String string) {
+ char[] string2 = string.toCharArray();
+ int first = indexOfWhitespace_(string2);
+ return (first == -1) ? string : new String(removeAllWhitespace_(string2, first));
+ }
+
+ /**
+ * Remove all the whitespace
+ * from the specified string and append the result to the
+ * specified writer.
+ * String#removeAllWhitespaceOn(Writer)
+ */
+ public static void removeAllWhitespaceOn(String string, Writer writer) {
+ char[] string2 = string.toCharArray();
+ int first = indexOfWhitespace_(string2);
+ if (first == -1) {
+ writeStringOn(string, writer);
+ } else {
+ removeAllWhitespaceOn_(string2, first, writer);
+ }
+ }
+
+ /**
+ * Remove all the whitespace
+ * from the specified string and append the result to the
+ * specified string buffer.
+ * String#removeAllWhitespaceOn(StringBuffer)
+ */
+ public static void removeAllWhitespaceOn(String string, StringBuffer sb) {
+ char[] string2 = string.toCharArray();
+ int first = indexOfWhitespace_(string2);
+ if (first == -1) {
+ sb.append(string);
+ } else {
+ removeAllWhitespaceOn_(string2, first, sb);
+ }
+ }
+
+ /**
+ * Remove all the whitespace
+ * from the specified string and append the result to the
+ * specified string builder.
+ * String#removeAllWhitespaceOn(StringBuilder)
+ */
+ public static void removeAllWhitespaceOn(String string, StringBuilder sb) {
+ char[] string2 = string.toCharArray();
+ int first = indexOfWhitespace_(string2);
+ if (first == -1) {
+ sb.append(string);
+ } else {
+ removeAllWhitespaceOn_(string2, first, sb);
+ }
+ }
+
+ /**
+ * Remove all the whitespace from the specified string and return the result.
+ * String#removeAllWhitespace()
+ */
+ public static char[] removeAllWhitespace(char[] string) {
+ int first = indexOfWhitespace_(string);
+ return (first == -1) ? string : removeAllWhitespace_(string, first);
+ }
+
+ private static int indexOfWhitespace_(char[] string) {
+ int len = string.length;
+ for (int i = 0; i < len; i++) {
+ if (Character.isWhitespace(string[i])) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ /*
+ * The index of the first non-whitespace character is passed in.
+ */
+ private static char[] removeAllWhitespace_(char[] string, int first) {
+ StringBuilder sb = new StringBuilder(string.length);
+ removeAllWhitespaceOn_(string, first, sb);
+ return convertToCharArray(sb);
+ }
+
+ /**
+ * Remove all the whitespace
+ * from the specified string and append the result to the
+ * specified writer.
+ * String#removeAllWhitespaceOn(Writer)
+ */
+ public static void removeAllWhitespaceOn(char[] string, Writer writer) {
+ int first = indexOfWhitespace_(string);
+ if (first == -1) {
+ writeStringOn(string, writer);
+ } else {
+ removeAllWhitespaceOn_(string, first, writer);
+ }
+ }
+
+ /*
+ * The index of the first non-whitespace character is passed in.
+ */
+ private static void removeAllWhitespaceOn_(char[] string, int first, Writer writer) {
+ writeStringOn(string, 0, first, writer);
+ int len = string.length;
+ for (int i = first; i < len; i++) {
+ char c = string[i];
+ if ( ! Character.isWhitespace(c)) {
+ writeCharOn(c, writer);
+ }
+ }
+ }
+
+ /**
+ * Remove all the whitespace
+ * from the specified string and append the result to the
+ * specified string buffer.
+ * String#removeAllWhitespaceOn(StringBuffer)
+ */
+ public static void removeAllWhitespaceOn(char[] string, StringBuffer sb) {
+ int first = indexOfWhitespace_(string);
+ if (first == -1) {
+ sb.append(string);
+ } else {
+ removeAllWhitespaceOn_(string, first, sb);
+ }
+ }
+
+ /*
+ * The index of the first non-whitespace character is passed in.
+ */
+ private static void removeAllWhitespaceOn_(char[] string, int first, StringBuffer sb) {
+ sb.append(string, 0, first);
+ int len = string.length;
+ for (int i = first; i < len; i++) {
+ char c = string[i];
+ if ( ! Character.isWhitespace(c)) {
+ sb.append(c);
+ }
+ }
+ }
+
+ /**
+ * Remove all the whitespace
+ * from the specified string and append the result to the
+ * specified string builder.
+ * String#removeAllWhitespaceOn(StringBuilder)
+ */
+ public static void removeAllWhitespaceOn(char[] string, StringBuilder sb) {
+ int first = indexOfWhitespace_(string);
+ if (first == -1) {
+ sb.append(string);
+ } else {
+ removeAllWhitespaceOn_(string, first, sb);
+ }
+ }
+
+ /*
+ * The index of the first non-whitespace character is passed in.
+ */
+ private static void removeAllWhitespaceOn_(char[] string, int first, StringBuilder sb) {
+ sb.append(string, 0, first);
+ int len = string.length;
+ for (int i = first; i < len; i++) {
+ char c = string[i];
+ if ( ! Character.isWhitespace(c)) {
+ sb.append(c);
+ }
+ }
+ }
+
// ********** common prefix **********
@@ -1570,7 +2114,7 @@ public final class StringTools {
* Return the length of the common prefix shared by the specified strings.
*/
public static int commonPrefixLength(char[] s1, char[] s2) {
- return commonPrefixLengthInternal(s1, s2, Math.min(s1.length, s2.length));
+ return commonPrefixLength_(s1, s2, Math.min(s1.length, s2.length));
}
/**
@@ -1587,15 +2131,15 @@ public final class StringTools {
* but limit the length to the specified maximum.
*/
public static int commonPrefixLength(char[] s1, char[] s2, int max) {
- return commonPrefixLengthInternal(s1, s2, Math.min(max, Math.min(s1.length, s2.length)));
+ return commonPrefixLength_(s1, s2, Math.min(max, Math.min(s1.length, s2.length)));
}
- /**
+ /*
* Return the length of the common prefix shared by the specified strings;
* but limit the length to the specified maximum. Assume the specified
* maximum is less than the lengths of the specified strings.
*/
- private static int commonPrefixLengthInternal(char[] s1, char[] s2, int max) {
+ private static int commonPrefixLength_(char[] s1, char[] s2, int max) {
for (int i = 0; i < max; i++) {
if (s1[i] != s2[i]) {
return i;
@@ -1607,10 +2151,10 @@ public final class StringTools {
// ********** capitalization **********
- /**
+ /*
* no zero-length check or lower case check
*/
- private static char[] capitalizeInternal(char[] string) {
+ private static char[] capitalize_(char[] string) {
string[0] = Character.toUpperCase(string[0]);
return string;
}
@@ -1623,7 +2167,7 @@ public final class StringTools {
if ((string.length == 0) || Character.isUpperCase(string[0])) {
return string;
}
- return capitalizeInternal(string);
+ return capitalize_(string);
}
/**
@@ -1634,21 +2178,13 @@ public final class StringTools {
if ((string.length() == 0) || Character.isUpperCase(string.charAt(0))) {
return string;
}
- return new String(capitalizeInternal(string.toCharArray()));
+ return new String(capitalize_(string.toCharArray()));
}
- /**
+ /*
* no zero-length check or upper case check
*/
- private static void capitalizeOnInternal(char[] string, StringBuffer sb) {
- sb.append(Character.toUpperCase(string[0]));
- sb.append(string, 1, string.length - 1);
- }
-
- /**
- * no zero-length check or upper case check
- */
- private static void capitalizeOnInternal(char[] string, StringBuilder sb) {
+ private static void capitalizeOn_(char[] string, StringBuffer sb) {
sb.append(Character.toUpperCase(string[0]));
sb.append(string, 1, string.length - 1);
}
@@ -1664,45 +2200,53 @@ public final class StringTools {
if (Character.isUpperCase(string[0])) {
sb.append(string);
} else {
- capitalizeOnInternal(string, sb);
+ capitalizeOn_(string, sb);
}
}
/**
* Append the specified string to the specified string buffer
* with its first letter capitalized.
+ * String#capitalizeOn(StringBuffer)
*/
- public static void capitalizeOn(char[] string, StringBuilder sb) {
- if (string.length == 0) {
+ public static void capitalizeOn(String string, StringBuffer sb) {
+ if (string.length() == 0) {
return;
}
- if (Character.isUpperCase(string[0])) {
+ if (Character.isUpperCase(string.charAt(0))) {
sb.append(string);
} else {
- capitalizeOnInternal(string, sb);
+ capitalizeOn_(string.toCharArray(), sb);
}
}
+ /*
+ * no zero-length check or upper case check
+ */
+ private static void capitalizeOn_(char[] string, StringBuilder sb) {
+ sb.append(Character.toUpperCase(string[0]));
+ sb.append(string, 1, string.length - 1);
+ }
+
/**
- * Append the specified string to the specified string buffer
+ * Append the specified string to the specified string builder
* with its first letter capitalized.
- * String#capitalizeOn(StringBuffer)
*/
- public static void capitalizeOn(String string, StringBuffer sb) {
- if (string.length() == 0) {
+ public static void capitalizeOn(char[] string, StringBuilder sb) {
+ if (string.length == 0) {
return;
}
- if (Character.isUpperCase(string.charAt(0))) {
+ if (Character.isUpperCase(string[0])) {
sb.append(string);
} else {
- capitalizeOnInternal(string.toCharArray(), sb);
+ capitalizeOn_(string, sb);
}
}
/**
- * Append the specified string to the specified string buffer
+ * Append the specified string to the specified string builder
* with its first letter capitalized.
- * String#capitalizeOn(StringBuilder)
+ * String#capitalizeOn(StringBuffer)
*/
public static void capitalizeOn(String string, StringBuilder sb) {
if (string.length() == 0) {
@@ -1711,14 +2255,14 @@ public final class StringTools {
if (Character.isUpperCase(string.charAt(0))) {
sb.append(string);
} else {
- capitalizeOnInternal(string.toCharArray(), sb);
+ capitalizeOn_(string.toCharArray(), sb);
}
}
- /**
+ /*
* no zero-length check or upper case check
*/
- private static void capitalizeOnInternal(char[] string, Writer writer) {
+ private static void capitalizeOn_(char[] string, Writer writer) {
writeCharOn(Character.toUpperCase(string[0]), writer);
writeStringOn(string, 1, string.length - 1, writer);
}
@@ -1734,7 +2278,7 @@ public final class StringTools {
if (Character.isUpperCase(string[0])) {
writeStringOn(string, writer);
} else {
- capitalizeOnInternal(string, writer);
+ capitalizeOn_(string, writer);
}
}
@@ -1750,19 +2294,19 @@ public final class StringTools {
if (Character.isUpperCase(string.charAt(0))) {
writeStringOn(string, writer);
} else {
- capitalizeOnInternal(string.toCharArray(), writer);
+ capitalizeOn_(string.toCharArray(), writer);
}
}
- /**
+ /*
* no zero-length check or lower case check
*/
- private static char[] uncapitalizeInternal(char[] string) {
+ private static char[] uncapitalize_(char[] string) {
string[0] = Character.toLowerCase(string[0]);
return string;
}
- private static boolean stringNeedNotBeUncapitalized(char[] string) {
+ private static boolean stringNeedNotBeUncapitalized_(char[] string) {
if (string.length == 0) {
return true;
}
@@ -1786,13 +2330,13 @@ public final class StringTools {
* in which case the string is returned unchanged.)
*/
public static char[] uncapitalize(char[] string) {
- if (stringNeedNotBeUncapitalized(string)) {
+ if (stringNeedNotBeUncapitalized_(string)) {
return string;
}
- return uncapitalizeInternal(string);
+ return uncapitalize_(string);
}
- private static boolean stringNeedNotBeUncapitalized(String string) {
+ private static boolean stringNeedNotBeUncapitalized_(String string) {
if (string.length() == 0) {
return true;
}
@@ -1816,24 +2360,16 @@ public final class StringTools {
* String#uncapitalize()
*/
public static String uncapitalize(String string) {
- if (stringNeedNotBeUncapitalized(string)) {
+ if (stringNeedNotBeUncapitalized_(string)) {
return string;
}
- return new String(uncapitalizeInternal(string.toCharArray()));
+ return new String(uncapitalize_(string.toCharArray()));
}
- /**
+ /*
* no zero-length check or lower case check
*/
- private static void uncapitalizeOnInternal(char[] string, StringBuffer sb) {
- sb.append(Character.toLowerCase(string[0]));
- sb.append(string, 1, string.length - 1);
- }
-
- /**
- * no zero-length check or lower case check
- */
- private static void uncapitalizeOnInternal(char[] string, StringBuilder sb) {
+ private static void uncapitalizeOn_(char[] string, StringBuffer sb) {
sb.append(Character.toLowerCase(string[0]));
sb.append(string, 1, string.length - 1);
}
@@ -1845,10 +2381,10 @@ public final class StringTools {
* in which case the string is returned unchanged.)
*/
public static void uncapitalizeOn(char[] string, StringBuffer sb) {
- if (stringNeedNotBeUncapitalized(string)) {
+ if (stringNeedNotBeUncapitalized_(string)) {
sb.append(string);
} else {
- uncapitalizeOnInternal(string, sb);
+ uncapitalizeOn_(string, sb);
}
}
@@ -1857,49 +2393,57 @@ public final class StringTools {
* with its first letter converted to lower case.
* (Unless both the first and second letters are upper case,
* in which case the string is returned unchanged.)
+ * String#uncapitalizeOn(StringBuffer)
*/
- public static void uncapitalizeOn(char[] string, StringBuilder sb) {
- if (stringNeedNotBeUncapitalized(string)) {
+ public static void uncapitalizeOn(String string, StringBuffer sb) {
+ if (stringNeedNotBeUncapitalized_(string)) {
sb.append(string);
} else {
- uncapitalizeOnInternal(string, sb);
+ uncapitalizeOn_(string.toCharArray(), sb);
}
}
+ /*
+ * no zero-length check or lower case check
+ */
+ private static void uncapitalizeOn_(char[] string, StringBuilder sb) {
+ sb.append(Character.toLowerCase(string[0]));
+ sb.append(string, 1, string.length - 1);
+ }
+
/**
- * Append the specified string to the specified string buffer
+ * Append the specified string to the specified string builder
* with its first letter converted to lower case.
* (Unless both the first and second letters are upper case,
* in which case the string is returned unchanged.)
- * String#uncapitalizeOn(StringBuffer)
*/
- public static void uncapitalizeOn(String string, StringBuffer sb) {
- if (stringNeedNotBeUncapitalized(string)) {
+ public static void uncapitalizeOn(char[] string, StringBuilder sb) {
+ if (stringNeedNotBeUncapitalized_(string)) {
sb.append(string);
} else {
- uncapitalizeOnInternal(string.toCharArray(), sb);
+ uncapitalizeOn_(string, sb);
}
}
/**
- * Append the specified string to the specified string buffer
+ * Append the specified string to the specified string builder
* with its first letter converted to lower case.
* (Unless both the first and second letters are upper case,
* in which case the string is returned unchanged.)
- * String#uncapitalizeOn(StringBuilder)
+ * String#uncapitalizeOn(StringBuffer)
*/
public static void uncapitalizeOn(String string, StringBuilder sb) {
- if (stringNeedNotBeUncapitalized(string)) {
+ if (stringNeedNotBeUncapitalized_(string)) {
sb.append(string);
} else {
- uncapitalizeOnInternal(string.toCharArray(), sb);
+ uncapitalizeOn_(string.toCharArray(), sb);
}
}
- /**
+ /*
* no zero-length check or upper case check
*/
- private static void uncapitalizeOnInternal(char[] string, Writer writer) {
+ private static void uncapitalizeOn_(char[] string, Writer writer) {
writeCharOn(Character.toLowerCase(string[0]), writer);
writeStringOn(string, 1, string.length - 1, writer);
}
@@ -1911,10 +2455,10 @@ public final class StringTools {
* in which case the string is returned unchanged.)
*/
public static void uncapitalizeOn(char[] string, Writer writer) {
- if (stringNeedNotBeUncapitalized(string)) {
+ if (stringNeedNotBeUncapitalized_(string)) {
writeStringOn(string, writer);
} else {
- uncapitalizeOnInternal(string, writer);
+ uncapitalizeOn_(string, writer);
}
}
@@ -1926,10 +2470,10 @@ public final class StringTools {
* String#uncapitalizeOn(Writer)
*/
public static void uncapitalizeOn(String string, Writer writer) {
- if (stringNeedNotBeUncapitalized(string)) {
+ if (stringNeedNotBeUncapitalized_(string)) {
writeStringOn(string, writer);
} else {
- uncapitalizeOnInternal(string.toCharArray(), writer);
+ uncapitalizeOn_(string.toCharArray(), writer);
}
}
@@ -1997,7 +2541,7 @@ public final class StringTools {
if ((string == null) || (string.length() == 0)) {
return true;
}
- return stringIsEmptyInternal(string.toCharArray());
+ return stringIsEmpty_(string.toCharArray());
}
/**
@@ -2008,10 +2552,10 @@ public final class StringTools {
if ((string == null) || (string.length == 0)) {
return true;
}
- return stringIsEmptyInternal(string);
+ return stringIsEmpty_(string);
}
- private static boolean stringIsEmptyInternal(char[] s) {
+ private static boolean stringIsEmpty_(char[] s) {
for (int i = s.length; i-- > 0; ) {
if ( ! Character.isWhitespace(s[i])) {
return false;
@@ -2098,7 +2642,11 @@ public final class StringTools {
* "largeProject" -> "LARGE_PROJECT"
*/
public static String convertCamelCaseToAllCaps(String camelCaseString) {
- return new String(convertCamelCaseToAllCaps(camelCaseString.toCharArray()));
+ int len = camelCaseString.length();
+ if (len == 0) {
+ return camelCaseString;
+ }
+ return new String(convertCamelCaseToAllCaps_(camelCaseString.toCharArray(), len));
}
/**
@@ -2110,8 +2658,12 @@ public final class StringTools {
if (len == 0) {
return camelCaseString;
}
+ return convertCamelCaseToAllCaps_(camelCaseString, len);
+ }
+
+ private static char[] convertCamelCaseToAllCaps_(char[] camelCaseString, int len) {
StringBuilder sb = new StringBuilder(len * 2);
- convertCamelCaseToAllCapsOnInternal(camelCaseString, len, sb);
+ convertCamelCaseToAllCapsOn_(camelCaseString, len, sb);
return convertToCharArray(sb);
}
@@ -2120,25 +2672,9 @@ public final class StringTools {
* "largeProject" -> "LARGE_PROJECT"
*/
public static void convertCamelCaseToAllCapsOn(String camelCaseString, StringBuffer sb) {
- convertCamelCaseToAllCapsOn(camelCaseString.toCharArray(), sb);
- }
-
- /**
- * Convert the specified "camel case" string to an "all caps" string:
- * "largeProject" -> "LARGE_PROJECT"
- */
- public static void convertCamelCaseToAllCapsOn(String camelCaseString, StringBuilder sb) {
- convertCamelCaseToAllCapsOn(camelCaseString.toCharArray(), sb);
- }
-
- /**
- * Convert the specified "camel case" string to an "all caps" string:
- * "largeProject" -> "LARGE_PROJECT"
- */
- public static void convertCamelCaseToAllCapsOn(char[] camelCaseString, StringBuffer sb) {
- int len = camelCaseString.length;
+ int len = camelCaseString.length();
if (len != 0) {
- convertCamelCaseToAllCapsOnInternal(camelCaseString, len, sb);
+ convertCamelCaseToAllCapsOn_(camelCaseString.toCharArray(), len, sb);
}
}
@@ -2146,21 +2682,21 @@ public final class StringTools {
* Convert the specified "camel case" string to an "all caps" string:
* "largeProject" -> "LARGE_PROJECT"
*/
- public static void convertCamelCaseToAllCapsOn(char[] camelCaseString, StringBuilder sb) {
+ public static void convertCamelCaseToAllCapsOn(char[] camelCaseString, StringBuffer sb) {
int len = camelCaseString.length;
if (len != 0) {
- convertCamelCaseToAllCapsOnInternal(camelCaseString, len, sb);
+ convertCamelCaseToAllCapsOn_(camelCaseString, len, sb);
}
}
- private static void convertCamelCaseToAllCapsOnInternal(char[] camelCaseString, int len, StringBuffer sb) {
+ private static void convertCamelCaseToAllCapsOn_(char[] camelCaseString, int len, StringBuffer sb) {
char prev = 0; // assume 0 is not a valid char
char c = 0;
char next = camelCaseString[0];
for (int i = 1; i <= len; i++) { // NB: start at 1 and end at len!
c = next;
next = ((i == len) ? 0 : camelCaseString[i]);
- if (camelCaseWordBreak(prev, c, next)) {
+ if (camelCaseWordBreak_(prev, c, next)) {
sb.append('_');
}
sb.append(Character.toUpperCase(c));
@@ -2168,14 +2704,36 @@ public final class StringTools {
}
}
- private static void convertCamelCaseToAllCapsOnInternal(char[] camelCaseString, int len, StringBuilder sb) {
+ /**
+ * Convert the specified "camel case" string to an "all caps" string:
+ * "largeProject" -> "LARGE_PROJECT"
+ */
+ public static void convertCamelCaseToAllCapsOn(String camelCaseString, StringBuilder sb) {
+ int len = camelCaseString.length();
+ if (len != 0) {
+ convertCamelCaseToAllCapsOn_(camelCaseString.toCharArray(), len, sb);
+ }
+ }
+
+ /**
+ * Convert the specified "camel case" string to an "all caps" string:
+ * "largeProject" -> "LARGE_PROJECT"
+ */
+ public static void convertCamelCaseToAllCapsOn(char[] camelCaseString, StringBuilder sb) {
+ int len = camelCaseString.length;
+ if (len != 0) {
+ convertCamelCaseToAllCapsOn_(camelCaseString, len, sb);
+ }
+ }
+
+ private static void convertCamelCaseToAllCapsOn_(char[] camelCaseString, int len, StringBuilder sb) {
char prev = 0; // assume 0 is not a valid char
char c = 0;
char next = camelCaseString[0];
for (int i = 1; i <= len; i++) { // NB: start at 1 and end at len!
c = next;
next = ((i == len) ? 0 : camelCaseString[i]);
- if (camelCaseWordBreak(prev, c, next)) {
+ if (camelCaseWordBreak_(prev, c, next)) {
sb.append('_');
}
sb.append(Character.toUpperCase(c));
@@ -2188,7 +2746,10 @@ public final class StringTools {
* "largeProject" -> "LARGE_PROJECT"
*/
public static void convertCamelCaseToAllCapsOn(String camelCaseString, Writer writer) {
- convertCamelCaseToAllCapsOn(camelCaseString.toCharArray(), writer);
+ int len = camelCaseString.length();
+ if (len != 0) {
+ convertCamelCaseToAllCapsOn_(camelCaseString.toCharArray(), len, writer);
+ }
}
/**
@@ -2198,18 +2759,18 @@ public final class StringTools {
public static void convertCamelCaseToAllCapsOn(char[] camelCaseString, Writer writer) {
int len = camelCaseString.length;
if (len != 0) {
- convertCamelCaseToAllCapsOnInternal(camelCaseString, len, writer);
+ convertCamelCaseToAllCapsOn_(camelCaseString, len, writer);
}
}
- private static void convertCamelCaseToAllCapsOnInternal(char[] camelCaseString, int len, Writer writer) {
+ private static void convertCamelCaseToAllCapsOn_(char[] camelCaseString, int len, Writer writer) {
char prev = 0; // assume 0 is not a valid char
char c = 0;
char next = camelCaseString[0];
for (int i = 1; i <= len; i++) { // NB: start at 1 and end at len!
c = next;
next = ((i == len) ? 0 : camelCaseString[i]);
- if (camelCaseWordBreak(prev, c, next)) {
+ if (camelCaseWordBreak_(prev, c, next)) {
writeCharOn('_', writer);
}
writeCharOn(Character.toUpperCase(c), writer);
@@ -2223,7 +2784,11 @@ public final class StringTools {
* Limit the resulting string to the specified maximum length.
*/
public static String convertCamelCaseToAllCaps(String camelCaseString, int maxLength) {
- return new String(convertCamelCaseToAllCaps(camelCaseString.toCharArray(), maxLength));
+ int len = camelCaseString.length();
+ if ((len == 0) || (maxLength == 0)) {
+ return camelCaseString;
+ }
+ return new String(convertCamelCaseToAllCaps_(camelCaseString.toCharArray(), maxLength, len));
}
/**
@@ -2236,8 +2801,12 @@ public final class StringTools {
if ((len == 0) || (maxLength == 0)) {
return camelCaseString;
}
+ return convertCamelCaseToAllCaps_(camelCaseString, maxLength, len);
+ }
+
+ private static char[] convertCamelCaseToAllCaps_(char[] camelCaseString, int maxLength, int len) {
StringBuilder sb = new StringBuilder(maxLength);
- convertCamelCaseToAllCapsOnInternal(camelCaseString, maxLength, len, sb);
+ convertCamelCaseToAllCapsOn_(camelCaseString, maxLength, len, sb);
return convertToCharArray(sb);
}
@@ -2247,27 +2816,9 @@ public final class StringTools {
* Limit the resulting string to the specified maximum length.
*/
public static void convertCamelCaseToAllCapsOn(String camelCaseString, int maxLength, StringBuffer sb) {
- convertCamelCaseToAllCapsOn(camelCaseString.toCharArray(), maxLength, sb);
- }
-
- /**
- * Convert the specified "camel case" string to an "all caps" string:
- * "largeProject" -> "LARGE_PROJECT"
- * Limit the resulting string to the specified maximum length.
- */
- public static void convertCamelCaseToAllCapsOn(String camelCaseString, int maxLength, StringBuilder sb) {
- convertCamelCaseToAllCapsOn(camelCaseString.toCharArray(), maxLength, sb);
- }
-
- /**
- * Convert the specified "camel case" string to an "all caps" string:
- * "largeProject" -> "LARGE_PROJECT"
- * Limit the resulting string to the specified maximum length.
- */
- public static void convertCamelCaseToAllCapsOn(char[] camelCaseString, int maxLength, StringBuffer sb) {
- int len = camelCaseString.length;
+ int len = camelCaseString.length();
if ((len != 0) && (maxLength != 0)) {
- convertCamelCaseToAllCapsOnInternal(camelCaseString, maxLength, len, sb);
+ convertCamelCaseToAllCapsOn_(camelCaseString.toCharArray(), maxLength, len, sb);
}
}
@@ -2276,21 +2827,21 @@ public final class StringTools {
* "largeProject" -> "LARGE_PROJECT"
* Limit the resulting string to the specified maximum length.
*/
- public static void convertCamelCaseToAllCapsOn(char[] camelCaseString, int maxLength, StringBuilder sb) {
+ public static void convertCamelCaseToAllCapsOn(char[] camelCaseString, int maxLength, StringBuffer sb) {
int len = camelCaseString.length;
if ((len != 0) && (maxLength != 0)) {
- convertCamelCaseToAllCapsOnInternal(camelCaseString, maxLength, len, sb);
+ convertCamelCaseToAllCapsOn_(camelCaseString, maxLength, len, sb);
}
}
- private static void convertCamelCaseToAllCapsOnInternal(char[] camelCaseString, int maxLength, int len, StringBuffer sb) {
+ private static void convertCamelCaseToAllCapsOn_(char[] camelCaseString, int maxLength, int len, StringBuffer sb) {
char prev = 0; // assume 0 is not a valid char
char c = 0;
char next = camelCaseString[0];
for (int i = 1; i <= len; i++) { // NB: start at 1 and end at len!
c = next;
next = ((i == len) ? 0 : camelCaseString[i]);
- if (camelCaseWordBreak(prev, c, next)) {
+ if (camelCaseWordBreak_(prev, c, next)) {
sb.append('_');
if (sb.length() == maxLength) {
return;
@@ -2304,14 +2855,38 @@ public final class StringTools {
}
}
- private static void convertCamelCaseToAllCapsOnInternal(char[] camelCaseString, int maxLength, int len, StringBuilder sb) {
+ /**
+ * Convert the specified "camel case" string to an "all caps" string:
+ * "largeProject" -> "LARGE_PROJECT"
+ * Limit the resulting string to the specified maximum length.
+ */
+ public static void convertCamelCaseToAllCapsOn(String camelCaseString, int maxLength, StringBuilder sb) {
+ int len = camelCaseString.length();
+ if ((len != 0) && (maxLength != 0)) {
+ convertCamelCaseToAllCapsOn_(camelCaseString.toCharArray(), maxLength, len, sb);
+ }
+ }
+
+ /**
+ * Convert the specified "camel case" string to an "all caps" string:
+ * "largeProject" -> "LARGE_PROJECT"
+ * Limit the resulting string to the specified maximum length.
+ */
+ public static void convertCamelCaseToAllCapsOn(char[] camelCaseString, int maxLength, StringBuilder sb) {
+ int len = camelCaseString.length;
+ if ((len != 0) && (maxLength != 0)) {
+ convertCamelCaseToAllCapsOn_(camelCaseString, maxLength, len, sb);
+ }
+ }
+
+ private static void convertCamelCaseToAllCapsOn_(char[] camelCaseString, int maxLength, int len, StringBuilder sb) {
char prev = 0; // assume 0 is not a valid char
char c = 0;
char next = camelCaseString[0];
for (int i = 1; i <= len; i++) { // NB: start at 1 and end at len!
c = next;
next = ((i == len) ? 0 : camelCaseString[i]);
- if (camelCaseWordBreak(prev, c, next)) {
+ if (camelCaseWordBreak_(prev, c, next)) {
sb.append('_');
if (sb.length() == maxLength) {
return;
@@ -2331,7 +2906,10 @@ public final class StringTools {
* Limit the resulting string to the specified maximum length.
*/
public static void convertCamelCaseToAllCapsOn(String camelCaseString, int maxLength, Writer writer) {
- convertCamelCaseToAllCapsOn(camelCaseString.toCharArray(), maxLength, writer);
+ int len = camelCaseString.length();
+ if ((len != 0) && (maxLength != 0)) {
+ convertCamelCaseToAllCapsOn_(camelCaseString.toCharArray(), maxLength, len, writer);
+ }
}
/**
@@ -2342,11 +2920,11 @@ public final class StringTools {
public static void convertCamelCaseToAllCapsOn(char[] camelCaseString, int maxLength, Writer writer) {
int len = camelCaseString.length;
if ((len != 0) && (maxLength != 0)) {
- convertCamelCaseToAllCapsOnInternal(camelCaseString, maxLength, len, writer);
+ convertCamelCaseToAllCapsOn_(camelCaseString, maxLength, len, writer);
}
}
- private static void convertCamelCaseToAllCapsOnInternal(char[] camelCaseString, int maxLength, int len, Writer writer) {
+ private static void convertCamelCaseToAllCapsOn_(char[] camelCaseString, int maxLength, int len, Writer writer) {
char prev = 0; // assume 0 is not a valid char
char c = 0;
char next = camelCaseString[0];
@@ -2354,7 +2932,7 @@ public final class StringTools {
for (int i = 1; i <= len; i++) { // NB: start at 1 and end at len!
c = next;
next = ((i == len) ? 0 : camelCaseString[i]);
- if (camelCaseWordBreak(prev, c, next)) {
+ if (camelCaseWordBreak_(prev, c, next)) {
writeCharOn('_', writer);
if (++writerLength == maxLength) {
return;
@@ -2368,7 +2946,7 @@ public final class StringTools {
}
}
- /**
+ /*
* Return whether the specified series of characters occur at
* a "camel case" work break:
* "*aa" -> false
@@ -2383,7 +2961,7 @@ public final class StringTools {
* "AAa" -> true
* where '*' == any char
*/
- private static boolean camelCaseWordBreak(char prev, char c, char next) {
+ private static boolean camelCaseWordBreak_(char prev, char c, char next) {
if (prev == 0) { // start of string
return false;
}
@@ -2405,7 +2983,7 @@ public final class StringTools {
* Capitalize the first letter.
*/
public static String convertUnderscoresToCamelCase(String underscoreString) {
- return new String(convertUnderscoresToCamelCase(underscoreString.toCharArray()));
+ return convertUnderscoresToCamelCase(underscoreString, true);
}
/**
@@ -2423,7 +3001,11 @@ public final class StringTools {
* Optionally capitalize the first letter.
*/
public static String convertUnderscoresToCamelCase(String underscoreString, boolean capitalizeFirstLetter) {
- return new String(convertUnderscoresToCamelCase(underscoreString.toCharArray(), capitalizeFirstLetter));
+ int len = underscoreString.length();
+ if (len == 0) {
+ return underscoreString;
+ }
+ return new String(convertUnderscoresToCamelCase_(underscoreString.toCharArray(), capitalizeFirstLetter, len));
}
/**
@@ -2436,8 +3018,12 @@ public final class StringTools {
if (len == 0) {
return underscoreString;
}
+ return convertUnderscoresToCamelCase_(underscoreString, capitalizeFirstLetter, len);
+ }
+
+ private static char[] convertUnderscoresToCamelCase_(char[] underscoreString, boolean capitalizeFirstLetter, int len) {
StringBuilder sb = new StringBuilder(len);
- convertUnderscoresToCamelCaseOnInternal(underscoreString, capitalizeFirstLetter, len, sb);
+ convertUnderscoresToCamelCaseOn_(underscoreString, capitalizeFirstLetter, len, sb);
return convertToCharArray(sb);
}
@@ -2447,27 +3033,9 @@ public final class StringTools {
* Optionally capitalize the first letter.
*/
public static void convertUnderscoresToCamelCaseOn(String underscoreString, boolean capitalizeFirstLetter, StringBuffer sb) {
- convertUnderscoresToCamelCaseOn(underscoreString.toCharArray(), capitalizeFirstLetter, sb);
- }
-
- /**
- * Convert the specified "underscore" string to a "camel case" string:
- * "LARGE_PROJECT" -> "largeProject"
- * Optionally capitalize the first letter.
- */
- public static void convertUnderscoresToCamelCaseOn(String underscoreString, boolean capitalizeFirstLetter, StringBuilder sb) {
- convertUnderscoresToCamelCaseOn(underscoreString.toCharArray(), capitalizeFirstLetter, sb);
- }
-
- /**
- * Convert the specified "underscore" string to a "camel case" string:
- * "LARGE_PROJECT" -> "largeProject"
- * Optionally capitalize the first letter.
- */
- public static void convertUnderscoresToCamelCaseOn(char[] underscoreString, boolean capitalizeFirstLetter, StringBuffer sb) {
- int len = underscoreString.length;
+ int len = underscoreString.length();
if (len != 0) {
- convertUnderscoresToCamelCaseOnInternal(underscoreString, capitalizeFirstLetter, len, sb);
+ convertUnderscoresToCamelCaseOn_(underscoreString.toCharArray(), capitalizeFirstLetter, len, sb);
}
}
@@ -2476,14 +3044,14 @@ public final class StringTools {
* "LARGE_PROJECT" -> "largeProject"
* Optionally capitalize the first letter.
*/
- public static void convertUnderscoresToCamelCaseOn(char[] underscoreString, boolean capitalizeFirstLetter, StringBuilder sb) {
+ public static void convertUnderscoresToCamelCaseOn(char[] underscoreString, boolean capitalizeFirstLetter, StringBuffer sb) {
int len = underscoreString.length;
if (len != 0) {
- convertUnderscoresToCamelCaseOnInternal(underscoreString, capitalizeFirstLetter, len, sb);
+ convertUnderscoresToCamelCaseOn_(underscoreString, capitalizeFirstLetter, len, sb);
}
}
- private static void convertUnderscoresToCamelCaseOnInternal(char[] underscoreString, boolean capitalizeFirstLetter, int len, StringBuffer sb) {
+ private static void convertUnderscoresToCamelCaseOn_(char[] underscoreString, boolean capitalizeFirstLetter, int len, StringBuffer sb) {
char prev = 0;
char c = 0;
boolean first = true;
@@ -2510,7 +3078,31 @@ public final class StringTools {
}
}
- private static void convertUnderscoresToCamelCaseOnInternal(char[] underscoreString, boolean capitalizeFirstLetter, int len, StringBuilder sb) {
+ /**
+ * Convert the specified "underscore" string to a "camel case" string:
+ * "LARGE_PROJECT" -> "largeProject"
+ * Optionally capitalize the first letter.
+ */
+ public static void convertUnderscoresToCamelCaseOn(String underscoreString, boolean capitalizeFirstLetter, StringBuilder sb) {
+ int len = underscoreString.length();
+ if (len != 0) {
+ convertUnderscoresToCamelCaseOn_(underscoreString.toCharArray(), capitalizeFirstLetter, len, sb);
+ }
+ }
+
+ /**
+ * Convert the specified "underscore" string to a "camel case" string:
+ * "LARGE_PROJECT" -> "largeProject"
+ * Optionally capitalize the first letter.
+ */
+ public static void convertUnderscoresToCamelCaseOn(char[] underscoreString, boolean capitalizeFirstLetter, StringBuilder sb) {
+ int len = underscoreString.length;
+ if (len != 0) {
+ convertUnderscoresToCamelCaseOn_(underscoreString, capitalizeFirstLetter, len, sb);
+ }
+ }
+
+ private static void convertUnderscoresToCamelCaseOn_(char[] underscoreString, boolean capitalizeFirstLetter, int len, StringBuilder sb) {
char prev = 0;
char c = 0;
boolean first = true;
@@ -2543,7 +3135,10 @@ public final class StringTools {
* Optionally capitalize the first letter.
*/
public static void convertUnderscoresToCamelCaseOn(String underscoreString, boolean capitalizeFirstLetter, Writer writer) {
- convertUnderscoresToCamelCaseOn(underscoreString.toCharArray(), capitalizeFirstLetter, writer);
+ int len = underscoreString.length();
+ if (len != 0) {
+ convertUnderscoresToCamelCaseOn_(underscoreString.toCharArray(), capitalizeFirstLetter, len, writer);
+ }
}
/**
@@ -2554,11 +3149,11 @@ public final class StringTools {
public static void convertUnderscoresToCamelCaseOn(char[] underscoreString, boolean capitalizeFirstLetter, Writer writer) {
int len = underscoreString.length;
if (len != 0) {
- convertUnderscoresToCamelCaseOnInternal(underscoreString, capitalizeFirstLetter, len, writer);
+ convertUnderscoresToCamelCaseOn_(underscoreString, capitalizeFirstLetter, len, writer);
}
}
- private static void convertUnderscoresToCamelCaseOnInternal(char[] underscoreString, boolean capitalizeFirstLetter, int len, Writer writer) {
+ private static void convertUnderscoresToCamelCaseOn_(char[] underscoreString, boolean capitalizeFirstLetter, int len, Writer writer) {
char prev = 0;
char c = 0;
boolean first = true;
@@ -2602,9 +3197,6 @@ public final class StringTools {
return result;
}
-
- // ********** wrap Writer IOExceptions **********
-
private static void writeStringOn(char[] string, Writer writer) {
try {
writer.write(string);
@@ -2640,7 +3232,7 @@ public final class StringTools {
// ********** constructor **********
- /**
+ /*
* Suppress default constructor, ensuring non-instantiability.
*/
private StringTools() {
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SynchronizedBoolean.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SynchronizedBoolean.java
index 059e31be0d..6fb05a9a33 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SynchronizedBoolean.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SynchronizedBoolean.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -140,11 +140,12 @@ public class SynchronizedBoolean
/**
* Suspend the current thread until the boolean value changes
- * to the specified value.
+ * to the specified value. If the boolean value is already the
+ * specified value, return immediately.
*/
- public void waitUntilValueIs(boolean x) throws InterruptedException {
+ public void waitUntilValueIs(boolean v) throws InterruptedException {
synchronized (this.mutex) {
- while (this.value != x) {
+ while (this.value != v) {
this.mutex.wait();
}
}
@@ -152,6 +153,7 @@ public class SynchronizedBoolean
/**
* Suspend the current thread until the boolean value changes to true.
+ * If the boolean value is already true, return immediately.
*/
public void waitUntilTrue() throws InterruptedException {
synchronized (this.mutex) {
@@ -161,6 +163,7 @@ public class SynchronizedBoolean
/**
* Suspend the current thread until the boolean value changes to false.
+ * If the boolean value is already false, return immediately.
*/
public void waitUntilFalse() throws InterruptedException {
synchronized (this.mutex) {
@@ -169,24 +172,38 @@ public class SynchronizedBoolean
}
/**
+ * Suspend the current thread until the boolean value changes to
+ * NOT the specified value, then change it back to the specified
+ * value and continue executing. If the boolean value is already
+ * NOT the specified value, set the value to the specified value
+ * immediately.
+ */
+ public void waitToSetValue(boolean v) throws InterruptedException {
+ synchronized (this.mutex) {
+ this.waitUntilValueIs( ! v);
+ this.setValue(v);
+ }
+ }
+
+ /**
* Suspend the current thread until the boolean value changes to false,
- * then change it back to true and continue executing.
+ * then change it back to true and continue executing. If the boolean
+ * value is already false, set the value to true immediately.
*/
public void waitToSetTrue() throws InterruptedException {
synchronized (this.mutex) {
- this.waitUntilFalse();
- this.setValue(true);
+ this.waitToSetValue(true);
}
}
/**
* Suspend the current thread until the boolean value changes to true,
- * then change it back to false and continue executing.
+ * then change it back to false and continue executing. If the boolean
+ * value is already true, set the value to false immediately.
*/
public void waitToSetFalse() throws InterruptedException {
synchronized (this.mutex) {
- this.waitUntilTrue();
- this.setValue(false);
+ this.waitToSetValue(false);
}
}
@@ -198,21 +215,23 @@ public class SynchronizedBoolean
* to the specified value or the specified time-out occurs.
* The time-out is specified in milliseconds. Return true if the specified
* value was achieved; return false if a time-out occurred.
+ * If the boolean value is already the specified value, return true
+ * immediately.
*/
- public boolean waitUntilValueIs(boolean x, long timeout) throws InterruptedException {
+ public boolean waitUntilValueIs(boolean v, long timeout) throws InterruptedException {
synchronized (this.mutex) {
if (timeout == 0L) {
- this.waitUntilValueIs(x); // wait indefinitely until notified
+ this.waitUntilValueIs(v); // wait indefinitely until notified
return true; // if it ever comes back, the condition was met
}
long stop = System.currentTimeMillis() + timeout;
long remaining = timeout;
- while ((this.value != x) && (remaining > 0L)) {
+ while ((this.value != v) && (remaining > 0L)) {
this.mutex.wait(remaining);
remaining = stop - System.currentTimeMillis();
}
- return (this.value == x);
+ return (this.value == v);
}
}
@@ -221,6 +240,7 @@ public class SynchronizedBoolean
* to true or the specified time-out occurs.
* The time-out is specified in milliseconds. Return true if the specified
* value was achieved; return false if a time-out occurred.
+ * If the boolean value is already true, return true immediately.
*/
public boolean waitUntilTrue(long timeout) throws InterruptedException {
synchronized (this.mutex) {
@@ -233,6 +253,7 @@ public class SynchronizedBoolean
* to false or the specified time-out occurs.
* The time-out is specified in milliseconds. Return true if the specified
* value was achieved; return false if a time-out occurred.
+ * If the boolean value is already true, return true immediately.
*/
public boolean waitUntilFalse(long timeout) throws InterruptedException {
synchronized (this.mutex) {
@@ -241,38 +262,52 @@ public class SynchronizedBoolean
}
/**
- * Suspend the current thread until the boolean value changes to false,
- * then change it back to true and continue executing. If the boolean
- * value does not change to false before the time-out, simply continue
- * executing without changing the value.
+ * Suspend the current thread until the boolean value changes to NOT the
+ * specified value, then change it back to the specified value and continue
+ * executing. If the boolean value does not change to false before the
+ * time-out, simply continue executing without changing the value.
* The time-out is specified in milliseconds. Return true if the value was
- * set to true; return false if a time-out occurred.
+ * set to the specified value; return false if a time-out occurred.
+ * If the boolean value is already NOT the specified value, set the value
+ * to the specified value immediately and return true.
*/
- public boolean waitToSetTrue(long timeout) throws InterruptedException {
+ public boolean waitToSetValue(boolean v, long timeout) throws InterruptedException {
synchronized (this.mutex) {
- boolean success = this.waitUntilFalse(timeout);
+ boolean success = this.waitUntilValueIs( ! v, timeout);
if (success) {
- this.setValue(true);
+ this.setValue(v);
}
return success;
}
}
/**
+ * Suspend the current thread until the boolean value changes to false,
+ * then change it back to true and continue executing. If the boolean
+ * value does not change to false before the time-out, simply continue
+ * executing without changing the value. The time-out is specified in
+ * milliseconds. Return true if the value was set to true; return false
+ * if a time-out occurred. If the boolean value is already false, set the
+ * value to true immediately and return true.
+ */
+ public boolean waitToSetTrue(long timeout) throws InterruptedException {
+ synchronized (this.mutex) {
+ return this.waitToSetValue(true, timeout);
+ }
+ }
+
+ /**
* Suspend the current thread until the boolean value changes to true,
* then change it back to false and continue executing. If the boolean
* value does not change to true before the time-out, simply continue
- * executing without changing the value.
- * The time-out is specified in milliseconds. Return true if the value was
- * set to false; return false if a time-out occurred.
+ * executing without changing the value. The time-out is specified in
+ * milliseconds. Return true if the value was set to false; return false
+ * if a time-out occurred. If the boolean value is already true, set the
+ * value to false immediately and return true.
*/
public boolean waitToSetFalse(long timeout) throws InterruptedException {
synchronized (this.mutex) {
- boolean success = this.waitUntilTrue(timeout);
- if (success) {
- this.setValue(false);
- }
- return success;
+ return this.waitToSetValue(false, timeout);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SynchronizedObject.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SynchronizedObject.java
index cada106e04..b71421bb0f 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SynchronizedObject.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SynchronizedObject.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -122,11 +122,12 @@ public class SynchronizedObject<T>
/**
* Suspend the current thread until the value changes
- * to the specified value.
+ * to the specified value. If the value is already the
+ * specified value, return immediately.
*/
- public void waitUntilValueIs(T x) throws InterruptedException {
+ public void waitUntilValueIs(T v) throws InterruptedException {
synchronized (this.mutex) {
- while (this.value != x) {
+ while (this.value != v) {
this.mutex.wait();
}
}
@@ -134,11 +135,12 @@ public class SynchronizedObject<T>
/**
* Suspend the current thread until the value changes
- * to something other than the specified value.
+ * to something other than the specified value. If the
+ * value is already NOT the specified value, return immediately.
*/
- public void waitUntilValueIsNot(T x) throws InterruptedException {
+ public void waitUntilValueIsNot(T v) throws InterruptedException {
synchronized (this.mutex) {
- while (this.value == x) {
+ while (this.value == v) {
this.mutex.wait();
}
}
@@ -146,6 +148,7 @@ public class SynchronizedObject<T>
/**
* Suspend the current thread until the value changes to null.
+ * If the value is already null, return immediately.
*/
public void waitUntilNull() throws InterruptedException {
synchronized (this.mutex) {
@@ -156,6 +159,7 @@ public class SynchronizedObject<T>
/**
* Suspend the current thread until the value changes
* to something other than null.
+ * If the value is already NOT null, return immediately.
*/
public void waitUntilNotNull() throws InterruptedException {
synchronized (this.mutex) {
@@ -167,17 +171,21 @@ public class SynchronizedObject<T>
* Suspend the current thread until the value changes to
* something other than the specified value, then change
* it back to the specified value and continue executing.
+ * If the value is already NOT the specified value, set
+ * the value immediately.
*/
- public void waitToSetValue(T x) throws InterruptedException {
+ public void waitToSetValue(T v) throws InterruptedException {
synchronized (this.mutex) {
- this.waitUntilValueIsNot(x);
- this.setValue(x);
+ this.waitUntilValueIsNot(v);
+ this.setValue(v);
}
}
/**
* Suspend the current thread until the value changes to
- * null, then change it back to null and continue executing.
+ * something other than null, then change it back to null
+ * and continue executing. If the value is already NOT null,
+ * set the value to null immediately.
*/
public void waitToSetNull() throws InterruptedException {
synchronized (this.mutex) {
@@ -194,21 +202,22 @@ public class SynchronizedObject<T>
* to the specified value or the specified time-out occurs.
* The time-out is specified in milliseconds. Return true if the specified
* value was achieved; return false if a time-out occurred.
+ * If the value is already the specified value, return true immediately.
*/
- public boolean waitUntilValueIs(T x, long timeout) throws InterruptedException {
+ public boolean waitUntilValueIs(T v, long timeout) throws InterruptedException {
synchronized (this.mutex) {
if (timeout == 0L) {
- this.waitUntilValueIs(x); // wait indefinitely until notified
+ this.waitUntilValueIs(v); // wait indefinitely until notified
return true; // if it ever comes back, the condition was met
}
long stop = System.currentTimeMillis() + timeout;
long remaining = timeout;
- while ((this.value != x) && (remaining > 0L)) {
+ while ((this.value != v) && (remaining > 0L)) {
this.mutex.wait(remaining);
remaining = stop - System.currentTimeMillis();
}
- return (this.value == x);
+ return (this.value == v);
}
}
@@ -217,21 +226,22 @@ public class SynchronizedObject<T>
* other than the specified value or the specified time-out occurs.
* The time-out is specified in milliseconds. Return true if the specified
* value was removed; return false if a time-out occurred.
+ * If the value is already NOT the specified value, return true immediately.
*/
- public boolean waitUntilValueIsNot(T x, long timeout) throws InterruptedException {
+ public boolean waitUntilValueIsNot(T v, long timeout) throws InterruptedException {
synchronized (this.mutex) {
if (timeout == 0L) {
- this.waitUntilValueIsNot(x); // wait indefinitely until notified
+ this.waitUntilValueIsNot(v); // wait indefinitely until notified
return true; // if it ever comes back, the condition was met
}
long stop = System.currentTimeMillis() + timeout;
long remaining = timeout;
- while ((this.value == x) && (remaining > 0L)) {
+ while ((this.value == v) && (remaining > 0L)) {
this.mutex.wait(remaining);
remaining = stop - System.currentTimeMillis();
}
- return (this.value != x);
+ return (this.value != v);
}
}
@@ -240,6 +250,7 @@ public class SynchronizedObject<T>
* to null or the specified time-out occurs.
* The time-out is specified in milliseconds. Return true if the specified
* value was achieved; return false if a time-out occurred.
+ * If the value is already null, return true immediately.
*/
public boolean waitUntilNull(long timeout) throws InterruptedException {
synchronized (this.mutex) {
@@ -252,6 +263,7 @@ public class SynchronizedObject<T>
* to something other than null or the specified time-out occurs.
* The time-out is specified in milliseconds. Return true if the specified
* value was achieved; return false if a time-out occurred.
+ * If the value is already NOT null, return true immediately.
*/
public boolean waitUntilNotNull(long timeout) throws InterruptedException {
synchronized (this.mutex) {
@@ -268,12 +280,14 @@ public class SynchronizedObject<T>
* without changing the value.
* The time-out is specified in milliseconds. Return true if the value was
* set to true; return false if a time-out occurred.
+ * If the value is already something other than the specified value, set
+ * the value immediately and return true.
*/
- public boolean waitToSetValue(T x, long timeout) throws InterruptedException {
+ public boolean waitToSetValue(T v, long timeout) throws InterruptedException {
synchronized (this.mutex) {
- boolean success = this.waitUntilValueIsNot(x, timeout);
+ boolean success = this.waitUntilValueIsNot(v, timeout);
if (success) {
- this.setValue(x);
+ this.setValue(v);
}
return success;
}
@@ -286,6 +300,8 @@ public class SynchronizedObject<T>
* the time-out, simply continue executing without changing the value.
* The time-out is specified in milliseconds. Return true if the value was
* set to false; return false if a time-out occurred.
+ * If the value is already something other than null, set
+ * the value to null immediately and return true.
*/
public boolean waitToSetNull(long timeout) throws InterruptedException {
synchronized (this.mutex) {
@@ -335,16 +351,16 @@ public class SynchronizedObject<T>
if ( ! (obj instanceof SynchronizedObject)) {
return false;
}
- Object thisValue = this.value();
- Object otherValue = ((SynchronizedObject<?>) obj).value();
- return (thisValue == null) ?
- (otherValue == null) : thisValue.equals(otherValue);
+ Object v1 = this.value();
+ Object v2 = ((SynchronizedObject<?>) obj).value();
+ return (v1 == null) ?
+ (v2 == null) : v1.equals(v2);
}
@Override
public int hashCode() {
- Object temp = this.value();
- return (temp == null) ? 0 : temp.hashCode();
+ Object v = this.value();
+ return (v == null) ? 0 : v.hashCode();
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SynchronizedStack.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SynchronizedStack.java
index 6455e84257..8f4fb89ab5 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SynchronizedStack.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/SynchronizedStack.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -261,7 +261,7 @@ public class SynchronizedStack<E>
* Return the object this object locks on while performing
* its operations.
*/
- public Object getMutex() {
+ public Object mutex() {
return this.mutex;
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CloneIterator.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CloneIterator.java
index e238d4b3c0..cf823a5e2d 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CloneIterator.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CloneIterator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -32,7 +32,7 @@ import org.eclipse.jpt.utility.internal.StringTools;
public class CloneIterator<E>
implements Iterator<E>
{
- private final Iterator<E> nestedIterator;
+ private final Iterator<Object> nestedIterator;
private E current;
private final Mutator<E> mutator;
private boolean removeAllowed;
@@ -56,17 +56,12 @@ public class CloneIterator<E>
*/
public CloneIterator(Collection<? extends E> c, Mutator<E> mutator) {
super();
- this.nestedIterator = new ArrayIterator<E>(buildArray(c));
+ this.nestedIterator = new ArrayIterator<Object>(c.toArray());
this.current = null;
this.mutator = mutator;
this.removeAllowed = false;
}
- @SuppressWarnings("unchecked")
- private static <T> T[] buildArray(Collection<? extends T> c) {
- return (T[]) c.toArray();
- }
-
// ********** Iterator implementation **********
@@ -75,7 +70,7 @@ public class CloneIterator<E>
}
public E next() {
- this.current = this.nestedIterator.next();
+ this.current = this.nestedNext();
this.removeAllowed = true;
return this.current;
}
@@ -92,6 +87,17 @@ public class CloneIterator<E>
// ********** internal methods **********
/**
+ * The collection passed in during construction held Es,
+ * so this cast is not a problem. We need this cast because
+ * all the elements of the original collection were copied into
+ * an object array (Object[]).
+ */
+ @SuppressWarnings("unchecked")
+ protected E nestedNext() {
+ return (E) this.nestedIterator.next();
+ }
+
+ /**
* Remove the specified element from the original collection.
* <p>
* This method can be overridden by a subclass as an
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CloneListIterator.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CloneListIterator.java
index e3606402bb..bbad3409e2 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CloneListIterator.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CloneListIterator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.iterators;
-import java.util.Collection;
import java.util.List;
import java.util.ListIterator;
@@ -34,7 +33,7 @@ import org.eclipse.jpt.utility.internal.StringTools;
public class CloneListIterator<E>
implements ListIterator<E>
{
- private final ListIterator<E> nestedListIterator;
+ private final ListIterator<Object> nestedListIterator;
private int cursor;
private String state;
private final Mutator<E> mutator;
@@ -63,17 +62,12 @@ public class CloneListIterator<E>
super();
// build a copy of the list and keep it in synch with original (if the mutator allows changes)
// that way the nested list iterator will maintain some of our state
- this.nestedListIterator = CollectionTools.list(buildArray(list)).listIterator();
+ this.nestedListIterator = CollectionTools.list(list.toArray()).listIterator();
this.mutator = mutator;
this.cursor = 0;
this.state = UNKNOWN;
}
- @SuppressWarnings("unchecked")
- private static <T> T[] buildArray(Collection<? extends T> c) {
- return (T[]) c.toArray();
- }
-
// ********** ListIterator implementation **********
@@ -83,7 +77,7 @@ public class CloneListIterator<E>
public E next() {
// allow the nested iterator to throw an exception before we modify the index
- E next = this.nestedListIterator.next();
+ E next = this.nestedNext();
this.cursor++;
this.state = NEXT;
return next;
@@ -114,7 +108,7 @@ public class CloneListIterator<E>
public E previous() {
// allow the nested iterator to throw an exception before we modify the index
- E previous = this.nestedListIterator.previous();
+ E previous = this.nestedPrevious();
this.cursor--;
this.state = PREVIOUS;
return previous;
@@ -141,6 +135,28 @@ public class CloneListIterator<E>
// ********** internal methods **********
/**
+ * The list passed in during construction held Es,
+ * so this cast is not a problem. We need this cast because
+ * all the elements of the original collection were copied into
+ * an object array (Object[]).
+ */
+ @SuppressWarnings("unchecked")
+ protected E nestedNext() {
+ return (E) this.nestedListIterator.next();
+ }
+
+ /**
+ * The list passed in during construction held Es,
+ * so this cast is not a problem. We need this cast because
+ * all the elements of the original collection were copied into
+ * an object array (Object[]).
+ */
+ @SuppressWarnings("unchecked")
+ protected E nestedPrevious() {
+ return (E) this.nestedListIterator.previous();
+ }
+
+ /**
* Add the specified element to the original list.
* <p>
* This method can be overridden by a subclass as an
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CompositeListIterator.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CompositeListIterator.java
index 324d3c2f68..c2037f053d 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CompositeListIterator.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/CompositeListIterator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -39,7 +39,7 @@ public class CompositeListIterator<E>
public CompositeListIterator(List<? extends ListIterator<E>> iterators) {
this(iterators.listIterator());
}
-
+
/**
* Construct a list iterator with the specified list of list iterators.
*/
@@ -49,7 +49,7 @@ public class CompositeListIterator<E>
this.nextIndex = 0;
this.nextReturned = false;
}
-
+
/**
* Construct a list iterator with the specified object prepended
* to the specified iterator.
@@ -58,7 +58,7 @@ public class CompositeListIterator<E>
public CompositeListIterator(E object, ListIterator<E> iterator) {
this(new SingleElementListIterator<E>(object), iterator);
}
-
+
/**
* Construct a list iterator with the specified object appended
* to the specified iterator.
@@ -67,7 +67,7 @@ public class CompositeListIterator<E>
public CompositeListIterator(ListIterator<E> iterator, E object) {
this(iterator, new SingleElementListIterator<E>(object));
}
-
+
/**
* Construct a list iterator with the specified list iterators.
*/
@@ -80,7 +80,7 @@ public class CompositeListIterator<E>
this.nextIterator.add(o);
this.nextIndex++;
}
-
+
public boolean hasNext() {
try {
this.loadNextIterator();
@@ -90,7 +90,7 @@ public class CompositeListIterator<E>
}
return this.nextIterator.hasNext();
}
-
+
public boolean hasPrevious() {
try {
this.loadPreviousIterator();
@@ -100,43 +100,43 @@ public class CompositeListIterator<E>
}
return this.nextIterator.hasPrevious();
}
-
+
public E next() {
this.loadNextIterator();
E result = this.nextIterator.next();
-
+
// the statement above will throw a NoSuchElementException
// if the current iterator is at the end of the line;
- // so if we get here, we can set the lastIteratorToReturnElement
+ // so if we get here, we can set the 'lastIteratorToReturnElement'
this.lastIteratorToReturnElement = this.nextIterator;
this.nextIndex++;
this.nextReturned = true;
-
+
return result;
}
-
+
public int nextIndex() {
return this.nextIndex;
}
-
+
public E previous() {
this.loadPreviousIterator();
E result = this.nextIterator.previous();
-
+
// the statement above will throw a NoSuchElementException
// if the current iterator is at the end of the line;
- // so if we get here, we can set the lastIteratorToReturnElement
+ // so if we get here, we can set the 'lastIteratorToReturnElement'
this.lastIteratorToReturnElement = this.nextIterator;
this.nextIndex--;
this.nextReturned = false;
-
+
return result;
}
-
+
public int previousIndex() {
return this.nextIndex - 1;
}
-
+
public void remove() {
if (this.lastIteratorToReturnElement == null) {
throw new IllegalStateException();
@@ -147,16 +147,16 @@ public class CompositeListIterator<E>
this.nextIndex--;
}
}
-
+
public void set(E e) {
if (this.lastIteratorToReturnElement == null) {
throw new IllegalStateException();
}
this.lastIteratorToReturnElement.set(e);
}
-
+
/**
- * Load nextIterator with the first iterator that <code>hasNext()</code>
+ * Load 'nextIterator' with the first iterator that <code>hasNext()</code>
* or the final iterator if all the elements have already been retrieved.
*/
private void loadNextIterator() {
@@ -165,9 +165,9 @@ public class CompositeListIterator<E>
this.nextIterator = this.iterators.next();
}
}
-
+
/**
- * Load nextIterator with the first iterator that <code>hasPrevious()</code>
+ * Load 'nextIterator' with the first iterator that <code>hasPrevious()</code>
* or the first iterator if all the elements have already been retrieved.
*/
private void loadPreviousIterator() {
@@ -176,19 +176,19 @@ public class CompositeListIterator<E>
this.nextIterator = this.iterators.previous();
}
}
-
+
/**
- * If nextIterator is null, load it with the first iterator.
+ * If 'nextIterator' is null, load it with the first iterator.
*/
private void checkNextIterator() {
if (this.nextIterator == null) {
this.nextIterator = this.iterators.next();
}
}
-
+
@Override
public String toString() {
return StringTools.buildToStringFor(this, this.iterators);
}
-
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/EmptyIterator.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/EmptyIterator.java
index cb85a24c51..af8a394119 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/EmptyIterator.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/EmptyIterator.java
@@ -14,7 +14,7 @@ import java.util.NoSuchElementException;
import org.eclipse.jpt.utility.internal.StringTools;
/**
- * A <code>NullIterator</code> is just that.
+ * An <code>EmptyIterator</code> is just that.
*/
public final class EmptyIterator<E>
implements Iterator<E>
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/EmptyListIterator.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/EmptyListIterator.java
index ba93e81790..70a3367377 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/EmptyListIterator.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/EmptyListIterator.java
@@ -15,7 +15,7 @@ import java.util.NoSuchElementException;
import org.eclipse.jpt.utility.internal.StringTools;
/**
- * A <code>NullListIterator</code> is just that.
+ * An <code>EmptyListIterator</code> is just that.
*/
public final class EmptyListIterator<E>
implements ListIterator<E>
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/FilteringIterator.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/FilteringIterator.java
index 02de67b77c..e11559c39c 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/FilteringIterator.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/FilteringIterator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -33,14 +33,12 @@ import org.eclipse.jpt.utility.internal.StringTools;
* This also prevents a filtered iterator from supporting the optional
* <code>remove()</code> method.
*/
-public class FilteringIterator<E>
- implements Iterator<E>
+public class FilteringIterator<E1, E2>
+ implements Iterator<E2>
{
- private final Iterator<?> nestedIterator;
- // trust that the filter is correct - i.e. it will only accept elements of type E
- @SuppressWarnings("unchecked")
- private final Filter filter;
- private E next;
+ private final Iterator<? extends E1> nestedIterator;
+ private final Filter<E1> filter;
+ private E2 next;
private boolean done;
@@ -51,15 +49,15 @@ public class FilteringIterator<E>
* <code>accept(Object)</code> method instead of building
* a <code>Filter</code>.
*/
- public FilteringIterator(Iterator<?> nestedIterator) {
- this(nestedIterator, Filter.Disabled.instance());
+ public FilteringIterator(Iterator<? extends E1> nestedIterator) {
+ this(nestedIterator, Filter.Disabled.<E1>instance());
}
/**
* Construct an iterator with the specified nested
* iterator and filter.
*/
- public FilteringIterator(Iterator<?> nestedIterator, @SuppressWarnings("unchecked") Filter filter) {
+ public FilteringIterator(Iterator<? extends E1> nestedIterator, Filter<E1> filter) {
super();
this.nestedIterator = nestedIterator;
this.filter = filter;
@@ -70,11 +68,11 @@ public class FilteringIterator<E>
return ! this.done;
}
- public E next() {
+ public E2 next() {
if (this.done) {
throw new NoSuchElementException();
}
- E result = this.next;
+ E2 result = this.next;
this.loadNext();
return result;
}
@@ -95,10 +93,10 @@ public class FilteringIterator<E>
private void loadNext() {
this.done = true;
while (this.nestedIterator.hasNext() && (this.done)) {
- Object o = this.nestedIterator.next();
- if (this.accept(o)) {
+ E1 temp = this.nestedIterator.next();
+ if (this.accept(temp)) {
// assume that if the object was accepted it is of type E
- this.next = this.downcast(o);
+ this.next = this.cast(temp);
this.done = false;
} else {
this.next = null;
@@ -107,9 +105,13 @@ public class FilteringIterator<E>
}
}
+ /**
+ * We have to assume the filter will only "accept" objects that can
+ * be cast to E2.
+ */
@SuppressWarnings("unchecked")
- private E downcast(Object o) {
- return (E) o;
+ private E2 cast(E1 o) {
+ return (E2) o;
}
/**
@@ -120,8 +122,7 @@ public class FilteringIterator<E>
* This method can be overridden by a subclass as an
* alternative to building a <code>Filter</code>.
*/
- @SuppressWarnings("unchecked")
- protected boolean accept(Object o) {
+ protected boolean accept(E1 o) {
return this.filter.accept(o);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyCompositeListIterator.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyCompositeListIterator.java
new file mode 100644
index 0000000000..d13d36e25b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/iterators/ReadOnlyCompositeListIterator.java
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.utility.internal.iterators;
+
+import java.util.List;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+import org.eclipse.jpt.utility.internal.StringTools;
+
+/**
+ * A <code>ReadOnlyCompositeListIterator</code> wraps a list
+ * of <code>ListIterator</code>s and makes them appear to be a single
+ * read-only <code>ListIterator</code>. A read-only composite list
+ * iterator is more flexible than a normal composite when it comes to the element types of
+ * the nested iterators.
+ */
+public class ReadOnlyCompositeListIterator<E>
+ implements ListIterator<E>
+{
+ private final ListIterator<? extends ListIterator<? extends E>> iterators;
+ private ListIterator<? extends E> nextIterator;
+ private int nextIndex;
+
+
+ /**
+ * Construct a read-only list iterator with the specified list of
+ * list iterators.
+ */
+ public ReadOnlyCompositeListIterator(List<? extends ListIterator<? extends E>> iterators) {
+ this(iterators.listIterator());
+ }
+
+ /**
+ * Construct a read-only list iterator with the specified list of
+ * list iterators.
+ */
+ public ReadOnlyCompositeListIterator(ListIterator<? extends ListIterator<? extends E>> iterators) {
+ super();
+ this.iterators = iterators;
+ this.nextIndex = 0;
+ }
+
+ /**
+ * Construct a read-only list iterator with the specified object prepended
+ * to the specified iterator.
+ */
+ @SuppressWarnings("unchecked")
+ public ReadOnlyCompositeListIterator(E object, ListIterator<? extends E> iterator) {
+ this(new SingleElementListIterator<E>(object), iterator);
+ }
+
+ /**
+ * Construct a read-only list iterator with the specified object appended
+ * to the specified iterator.
+ */
+ @SuppressWarnings("unchecked")
+ public ReadOnlyCompositeListIterator(ListIterator<? extends E> iterator, E object) {
+ this(iterator, new SingleElementListIterator<E>(object));
+ }
+
+ /**
+ * Construct a read-only list iterator with the specified list iterators.
+ */
+ public ReadOnlyCompositeListIterator(ListIterator<? extends E>... iterators) {
+ this(new ArrayListIterator<ListIterator<? extends E>>(iterators));
+ }
+
+ public boolean hasNext() {
+ try {
+ this.loadNextIterator();
+ } catch (NoSuchElementException ex) {
+ // this occurs if there are no iterators at all
+ return false;
+ }
+ return this.nextIterator.hasNext();
+ }
+
+ public boolean hasPrevious() {
+ try {
+ this.loadPreviousIterator();
+ } catch (NoSuchElementException ex) {
+ // this occurs if there are no iterators at all
+ return false;
+ }
+ return this.nextIterator.hasPrevious();
+ }
+
+ public E next() {
+ this.loadNextIterator();
+ E result = this.nextIterator.next();
+
+ // the statement above will throw a NoSuchElementException
+ // if the current iterator is at the end of the line;
+ // so if we get here, we can increment 'nextIndex'
+ this.nextIndex++;
+
+ return result;
+ }
+
+ public int nextIndex() {
+ return this.nextIndex;
+ }
+
+ public E previous() {
+ this.loadPreviousIterator();
+ E result = this.nextIterator.previous();
+
+ // the statement above will throw a NoSuchElementException
+ // if the current iterator is at the end of the line;
+ // so if we get here, we can decrement 'nextIndex'
+ this.nextIndex--;
+
+ return result;
+ }
+
+ public int previousIndex() {
+ return this.nextIndex - 1;
+ }
+
+ public void add(E o) {
+ // the list iterator is read-only
+ throw new UnsupportedOperationException();
+ }
+
+ public void remove() {
+ // the list iterator is read-only
+ throw new UnsupportedOperationException();
+ }
+
+ public void set(E e) {
+ // the list iterator is read-only
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Load nextIterator with the first iterator that <code>hasNext()</code>
+ * or the final iterator if all the elements have already been retrieved.
+ */
+ private void loadNextIterator() {
+ this.checkNextIterator();
+ while (( ! this.nextIterator.hasNext()) && this.iterators.hasNext()) {
+ this.nextIterator = this.iterators.next();
+ }
+ }
+
+ /**
+ * Load nextIterator with the first iterator that <code>hasPrevious()</code>
+ * or the first iterator if all the elements have already been retrieved.
+ */
+ private void loadPreviousIterator() {
+ this.checkNextIterator();
+ while (( ! this.nextIterator.hasPrevious()) && this.iterators.hasPrevious()) {
+ this.nextIterator = this.iterators.previous();
+ }
+ }
+
+ /**
+ * If 'nextIterator' is null, load it with the first iterator.
+ */
+ private void checkNextIterator() {
+ if (this.nextIterator == null) {
+ this.nextIterator = this.iterators.next();
+ }
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.iterators);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/AbstractModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/AbstractModel.java
index 0c7b5da6d8..a0481df157 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/AbstractModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/AbstractModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -11,6 +11,7 @@ package org.eclipse.jpt.utility.internal.model;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -18,6 +19,7 @@ import java.util.List;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.HashBag;
import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.utility.internal.model.event.CollectionChangeEvent;
import org.eclipse.jpt.utility.internal.model.event.ListChangeEvent;
import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
@@ -211,6 +213,17 @@ public abstract class AbstractModel implements Model, Serializable {
* Return whether collection changed.
* @see java.util.Collection#addAll(java.util.Collection)
*/
+ protected <E> boolean addItemsToCollection(E[] items, Collection<E> collection, String collectionName) {
+ return this.addItemsToCollection(new ArrayIterator<E>(items), collection, collectionName);
+ }
+
+ /**
+ * Convenience method.
+ * Add the specified items to the specified bound collection
+ * and fire the appropriate event if necessary.
+ * Return whether collection changed.
+ * @see java.util.Collection#addAll(java.util.Collection)
+ */
protected <E> boolean addItemsToCollection(Iterable<? extends E> items, Collection<E> collection, String collectionName) {
return this.addItemsToCollection(items.iterator(), collection, collectionName);
}
@@ -262,6 +275,17 @@ public abstract class AbstractModel implements Model, Serializable {
* Return whether the collection changed.
* @see java.util.Collection#removeAll(java.util.Collection)
*/
+ protected boolean removeItemsFromCollection(Object[] items, Collection<?> collection, String collectionName) {
+ return this.removeItemsFromCollection(new ArrayIterator<Object>(items), collection, collectionName);
+ }
+
+ /**
+ * Convenience method.
+ * Remove the specified items from the specified bound collection
+ * and fire the appropriate event if necessary.
+ * Return whether the collection changed.
+ * @see java.util.Collection#removeAll(java.util.Collection)
+ */
protected boolean removeItemsFromCollection(Iterable<?> items, Collection<?> collection, String collectionName) {
return this.removeItemsFromCollection(items.iterator(), collection, collectionName);
}
@@ -291,6 +315,17 @@ public abstract class AbstractModel implements Model, Serializable {
* Return whether the collection changed.
* @see java.util.Collection#retainAll(java.util.Collection)
*/
+ protected boolean retainItemsInCollection(Object[] items, Collection<?> collection, String collectionName) {
+ return this.retainItemsInCollection(new ArrayIterator<Object>(items), collection, collectionName);
+ }
+
+ /**
+ * Convenience method.
+ * Retain the specified items in the specified bound collection
+ * and fire the appropriate event if necessary.
+ * Return whether the collection changed.
+ * @see java.util.Collection#retainAll(java.util.Collection)
+ */
protected boolean retainItemsInCollection(Iterable<?> items, Collection<?> collection, String collectionName) {
return this.retainItemsInCollection(items.iterator(), collection, collectionName);
}
@@ -482,6 +517,16 @@ public abstract class AbstractModel implements Model, Serializable {
* and fire the appropriate event if necessary.
* @see java.util.List#addAll(int, java.util.Collection)
*/
+ protected <E> boolean addItemsToList(int index, E[] items, List<E> list, String listName) {
+ return this.addItemsToList(index, new ArrayIterator<E>(items), list, listName);
+ }
+
+ /**
+ * Convenience method.
+ * Add the specified items to the specified bound list
+ * and fire the appropriate event if necessary.
+ * @see java.util.List#addAll(int, java.util.Collection)
+ */
protected <E> boolean addItemsToList(int index, Iterable<? extends E> items, List<E> list, String listName) {
return this.addItemsToList(index, items.iterator(), list, listName);
}
@@ -507,6 +552,16 @@ public abstract class AbstractModel implements Model, Serializable {
* and fire the appropriate event if necessary.
* @see java.util.List#addAll(java.util.Collection)
*/
+ protected <E> boolean addItemsToList(E[] items, List<E> list, String listName) {
+ return this.addItemsToList(new ArrayIterator<E>(items), list, listName);
+ }
+
+ /**
+ * Convenience method.
+ * Add the specified items to the end of to the specified bound list
+ * and fire the appropriate event if necessary.
+ * @see java.util.List#addAll(java.util.Collection)
+ */
protected <E> boolean addItemsToList(Iterable<? extends E> items, List<E> list, String listName) {
return this.addItemsToList(items.iterator(), list, listName);
}
@@ -579,6 +634,17 @@ public abstract class AbstractModel implements Model, Serializable {
* Return the removed items.
* @see java.util.List#removeAll(java.util.Collection)
*/
+ protected boolean removeItemsFromList(Object[] items, List<?> list, String listName) {
+ return this.removeItemsFromList(new ArrayIterator<Object>(items), list, listName);
+ }
+
+ /**
+ * Convenience method.
+ * Remove the specified items from the specified bound list
+ * and fire the appropriate event if necessary.
+ * Return the removed items.
+ * @see java.util.List#removeAll(java.util.Collection)
+ */
protected boolean removeItemsFromList(Iterable<?> items, List<?> list, String listName) {
return this.removeItemsFromList(items.iterator(), list, listName);
}
@@ -605,6 +671,17 @@ public abstract class AbstractModel implements Model, Serializable {
* Return whether the collection changed.
* @see java.util.List#retainAll(java.util.Collection)
*/
+ protected boolean retainItemsInList(Object[] items, List<?> list, String listName) {
+ return this.retainItemsInList(new ArrayIterator<Object>(items), list, listName);
+ }
+
+ /**
+ * Convenience method.
+ * Retain the specified items in the specified bound list
+ * and fire the appropriate event if necessary.
+ * Return whether the collection changed.
+ * @see java.util.List#retainAll(java.util.Collection)
+ */
protected boolean retainItemsInList(Iterable<?> items, List<?> list, String listName) {
return this.retainItemsInList(items.iterator(), list, listName);
}
@@ -654,6 +731,17 @@ public abstract class AbstractModel implements Model, Serializable {
* Return the replaced items.
* @see java.util.List#set(int, Object)
*/
+ protected <E> List<E> setItemsInList(int index, E[] items, List<E> list, String listName) {
+ return this.setItemsInList(index, Arrays.asList(items), list, listName);
+ }
+
+ /**
+ * Convenience method.
+ * Set the specified items in the specified bound list
+ * and fire the appropriate event if necessary.
+ * Return the replaced items.
+ * @see java.util.List#set(int, Object)
+ */
protected <E> List<E> setItemsInList(int index, List<? extends E> items, List<E> list, String listName) {
List<E> subList = list.subList(index, index + items.size());
List<E> replacedItems = new ArrayList<E>(subList);
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/event/CollectionChangeEvent.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/event/CollectionChangeEvent.java
index af7671638e..dee500c269 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/event/CollectionChangeEvent.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/event/CollectionChangeEvent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -72,7 +72,6 @@ public class CollectionChangeEvent extends ChangeEvent {
* @param source The object on which the event initially occurred.
* @param collectionName The programmatic name of the collection that was changed.
*/
- @SuppressWarnings("unchecked")
public CollectionChangeEvent(Model source, String collectionName) {
this(source, collectionName, Collections.emptySet());
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/event/ListChangeEvent.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/event/ListChangeEvent.java
index c2512e2f62..e01f183dcc 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/event/ListChangeEvent.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/event/ListChangeEvent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -117,7 +117,6 @@ public class ListChangeEvent extends ChangeEvent {
* @param index The index at which the items were added to or removed from the list.
* @param items The items that were added to or removed from the list.
*/
- @SuppressWarnings("unchecked")
public ListChangeEvent(Model source, String listName, int index, List<?> items) {
this(source, listName, index, items, Collections.emptyList(), -1, -1);
}
@@ -130,7 +129,6 @@ public class ListChangeEvent extends ChangeEvent {
* @param targetIndex The index to which the items were moved.
* @param sourceIndex The index from which the items were moved.
*/
- @SuppressWarnings("unchecked")
public ListChangeEvent(Model source, String listName, int targetIndex, int sourceIndex, int length) {
this(source, listName, targetIndex, Collections.emptyList(), Collections.emptyList(), sourceIndex, length);
}
@@ -141,7 +139,6 @@ public class ListChangeEvent extends ChangeEvent {
* @param source The object on which the event initially occurred.
* @param listName The programmatic name of the list that was changed.
*/
- @SuppressWarnings("unchecked")
public ListChangeEvent(Model source, String listName) {
this(source, listName, -1, Collections.emptyList(), Collections.emptyList(), -1, -1);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/event/TreeChangeEvent.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/event/TreeChangeEvent.java
index 47b73a9d7c..c5b99893b1 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/event/TreeChangeEvent.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/event/TreeChangeEvent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -59,7 +59,6 @@ public class TreeChangeEvent extends ChangeEvent {
* @param source The object on which the event initially occurred.
* @param treeName The programmatic name of the tree that was changed.
*/
- @SuppressWarnings("unchecked")
public TreeChangeEvent(Model source, String treeName) {
this(source, treeName, EMPTY_PATH);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AbstractTreeNodeValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AbstractTreeNodeValueModel.java
index d327fc5c14..a076466396 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AbstractTreeNodeValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AbstractTreeNodeValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -41,9 +41,9 @@ import org.eclipse.jpt.utility.internal.model.listener.StateChangeListener;
* override these methods to listen to the node's value if
* it can change in a way that should be reflected in the tree
*/
-public abstract class AbstractTreeNodeValueModel
+public abstract class AbstractTreeNodeValueModel<T>
extends AbstractModel
- implements TreeNodeValueModel
+ implements TreeNodeValueModel<T>
{
@@ -58,14 +58,18 @@ public abstract class AbstractTreeNodeValueModel
@Override
protected ChangeSupport buildChangeSupport() {
- // this value model is allowed to fire state change events...
-// return new ValueModelChangeSupport(this);
+ // this model fires *both* "value property change" and "state change" events...
+// return new SingleAspectChangeSupport(this, PropertyChangeListener.class, PropertyValueModel.VALUE);
return super.buildChangeSupport();
}
// ********** extend AbstractModel implementation **********
+ /**
+ * Clients should be adding both "state change" and "value property change"
+ * listeners.
+ */
@Override
public void addStateChangeListener(StateChangeListener listener) {
if (this.hasNoStateChangeListeners()) {
@@ -75,13 +79,14 @@ public abstract class AbstractTreeNodeValueModel
}
/**
- * Begin listening to the node's value. If the state of the node changes
+ * Begin listening to the node's value's state. If the state of the node changes
* in a way that should be reflected in the tree, fire a "state change" event.
- * If the entire value of the node changes, fire a "value property change"
- * event.
*/
protected abstract void engageValue();
+ /**
+ * @see #addStateChangeListener(StateChangeListener)
+ */
@Override
public void removeStateChangeListener(StateChangeListener listener) {
super.removeStateChangeListener(listener);
@@ -97,17 +102,18 @@ public abstract class AbstractTreeNodeValueModel
protected abstract void disengageValue();
- // ********** PropertyValueModel implementation **********
+ // ********** WritablePropertyValueModel implementation **********
- public void setValue(Object value) {
+ public void setValue(T value) {
throw new UnsupportedOperationException();
}
// ********** TreeNodeValueModel implementation **********
- public TreeNodeValueModel[] path() {
- List<TreeNodeValueModel> path = CollectionTools.reverseList(this.backPath());
+ @SuppressWarnings("unchecked")
+ public TreeNodeValueModel<T>[] path() {
+ List<TreeNodeValueModel<T>> path = CollectionTools.reverseList(this.backPath());
return path.toArray(new TreeNodeValueModel[path.size()]);
}
@@ -116,25 +122,25 @@ public abstract class AbstractTreeNodeValueModel
* starting with, and including, the node
* and up to, and including, the root node.
*/
- protected Iterator<TreeNodeValueModel> backPath() {
- return new ChainIterator<TreeNodeValueModel>(this) {
+ protected Iterator<TreeNodeValueModel<T>> backPath() {
+ return new ChainIterator<TreeNodeValueModel<T>>(this) {
@Override
- protected TreeNodeValueModel nextLink(TreeNodeValueModel currentLink) {
+ protected TreeNodeValueModel<T> nextLink(TreeNodeValueModel<T> currentLink) {
return currentLink.parent();
}
};
}
- public TreeNodeValueModel child(int index) {
- return (TreeNodeValueModel) this.childrenModel().get(index);
+ public TreeNodeValueModel<T> child(int index) {
+ return this.childrenModel().get(index);
}
public int childrenSize() {
return this.childrenModel().size();
}
- public int indexOfChild(TreeNodeValueModel child) {
- ListValueModel children = this.childrenModel();
+ public int indexOfChild(TreeNodeValueModel<T> child) {
+ ListValueModel<TreeNodeValueModel<T>> children = this.childrenModel();
int size = children.size();
for (int i = 0; i < size; i++) {
if (children.get(i) == child) {
@@ -169,7 +175,8 @@ public abstract class AbstractTreeNodeValueModel
if (o.getClass() != this.getClass()) {
return false;
}
- AbstractTreeNodeValueModel other = (AbstractTreeNodeValueModel) o;
+ @SuppressWarnings("unchecked")
+ AbstractTreeNodeValueModel<T> other = (AbstractTreeNodeValueModel<T>) o;
return this.value().equals(other.value());
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AspectAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AspectAdapter.java
index 93e60d517f..556ae2bea5 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AspectAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AspectAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -26,7 +26,7 @@ import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
* adapter itself actually has listeners. This will allow the adapter to be
* garbage collected when appropriate
*/
-public abstract class AspectAdapter
+public abstract class AspectAdapter<S>
extends AbstractModel
{
/**
@@ -35,7 +35,7 @@ public abstract class AspectAdapter
* We need to hold on to this directly so we can
* disengage it when it changes.
*/
- protected Object subject;
+ protected S subject;
/**
* A value model that holds the subject
@@ -46,7 +46,7 @@ public abstract class AspectAdapter
* For now, this is can only be set upon construction and is
* immutable.
*/
- protected final ValueModel subjectHolder;
+ protected final PropertyValueModel<? extends S> subjectHolder;
/** A listener that keeps us in synch with the subjectHolder. */
protected final PropertyChangeListener subjectChangeListener;
@@ -57,15 +57,15 @@ public abstract class AspectAdapter
/**
* Construct an AspectAdapter for the specified subject.
*/
- protected AspectAdapter(Object subject) {
- this(new ReadOnlyPropertyValueModel(subject));
+ protected AspectAdapter(S subject) {
+ this(new StaticPropertyValueModel<S>(subject));
}
/**
* Construct an AspectAdapter for the specified subject holder.
* The subject holder cannot be null.
*/
- protected AspectAdapter(ValueModel subjectHolder) {
+ protected AspectAdapter(PropertyValueModel<? extends S> subjectHolder) {
super();
if (subjectHolder == null) {
throw new NullPointerException();
@@ -154,39 +154,39 @@ public abstract class AspectAdapter
*/
protected abstract void fireAspectChange(Object oldValue, Object newValue);
- /**
- * The subject is not null - add our listener.
- */
- protected abstract void engageNonNullSubject();
-
protected void engageSubject() {
// check for nothing to listen to
if (this.subject != null) {
- this.engageNonNullSubject();
+ this.engageSubject_();
}
}
/**
- * The subject is not null - remove our listener.
+ * The subject is not null - add our listener.
*/
- protected abstract void disengageNonNullSubject();
+ protected abstract void engageSubject_();
protected void disengageSubject() {
// check for nothing to listen to
if (this.subject != null) {
- this.disengageNonNullSubject();
+ this.disengageSubject_();
}
}
+ /**
+ * The subject is not null - remove our listener.
+ */
+ protected abstract void disengageSubject_();
+
protected void engageSubjectHolder() {
- this.subjectHolder.addPropertyChangeListener(ValueModel.VALUE, this.subjectChangeListener);
+ this.subjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.subjectChangeListener);
// synch our subject *after* we start listening to the subject holder,
// since its value might change when a listener is added
this.subject = this.subjectHolder.value();
}
protected void disengageSubjectHolder() {
- this.subjectHolder.removePropertyChangeListener(ValueModel.VALUE, this.subjectChangeListener);
+ this.subjectHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.subjectChangeListener);
// clear out the subject when we are not listening to its holder
this.subject = null;
}
@@ -215,7 +215,7 @@ public abstract class AspectAdapter
protected class LocalChangeSupport extends SingleAspectChangeSupport {
private static final long serialVersionUID = 1L;
- public LocalChangeSupport(AspectAdapter source, Class<? extends ChangeListener> listenerClass, String aspectName) {
+ public LocalChangeSupport(AspectAdapter<S> source, Class<? extends ChangeListener> listenerClass, String aspectName) {
super(source, listenerClass, aspectName);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AspectPropertyValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AspectPropertyValueModelAdapter.java
new file mode 100644
index 0000000000..2da27fea02
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/AspectPropertyValueModelAdapter.java
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.utility.internal.model.value;
+
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
+import org.eclipse.jpt.utility.internal.model.ChangeSupport;
+import org.eclipse.jpt.utility.internal.model.SingleAspectChangeSupport;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+
+/**
+ * This abstract class provides the infrastructure needed to wrap
+ * a value model, "lazily" listen to it, and convert
+ * its change notifications into property value model change
+ * notifications.
+ *
+ * Subclasses must override:
+ * - #buildValue()
+ * to return the current property value, as derived from the
+ * current model value
+ *
+ */
+public abstract class AspectPropertyValueModelAdapter<T>
+ extends AbstractModel
+ implements PropertyValueModel<T>
+{
+ /**
+ * Cache the current value so we can pass an "old value" when
+ * we fire a property change event.
+ * We need this because the value may be calculated and we may
+ * not able to derive the "old value" from the collection
+ * change event fired by the collection value model.
+ */
+ protected T value;
+
+
+ // ********** constructor/initialization **********
+
+ protected AspectPropertyValueModelAdapter() {
+ super();
+ // our value is null when we are not listening to the collection holder
+ this.value = null;
+ }
+
+ @Override
+ protected ChangeSupport buildChangeSupport() {
+ return new SingleAspectChangeSupport(this, PropertyChangeListener.class, VALUE);
+ }
+
+
+ // ********** PropertyValueModel implementation **********
+
+ /**
+ * Return the cached value.
+ */
+ public T value() {
+ return this.value;
+ }
+
+
+ // ********** extend change support **********
+
+ /**
+ * Extend to start listening to the wrapped collection if necessary.
+ */
+ @Override
+ public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
+ if (this.hasNoListeners()) {
+ this.engageModel();
+ }
+ super.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Extend to start listening to the wrapped collection if necessary.
+ */
+ @Override
+ public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ if (propertyName == VALUE && this.hasNoListeners()) {
+ this.engageModel();
+ }
+ super.addPropertyChangeListener(propertyName, listener);
+ }
+
+ /**
+ * Extend to stop listening to the wrapped collection if necessary.
+ */
+ @Override
+ public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
+ super.removePropertyChangeListener(listener);
+ if (this.hasNoListeners()) {
+ this.disengageModel();
+ }
+ }
+
+ /**
+ * Extend to stop listening to the wrapped collection if necessary.
+ */
+ @Override
+ public synchronized void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ super.removePropertyChangeListener(propertyName, listener);
+ if (propertyName == VALUE && this.hasNoListeners()) {
+ this.disengageModel();
+ }
+ }
+
+
+ // ********** queries **********
+
+ /**
+ * Return whether there are any listeners for the aspect.
+ */
+ protected boolean hasListeners() {
+ return this.hasAnyPropertyChangeListeners(VALUE);
+ }
+
+ /**
+ * Return whether there are any listeners for the aspect.
+ */
+ protected boolean hasNoListeners() {
+ return ! this.hasListeners();
+ }
+
+
+ // ********** behavior **********
+
+ /**
+ * Start listening to the model and build the value.
+ */
+ protected void engageModel() {
+ this.engageModel_();
+ // synch our value *after* we start listening to the collection,
+ // since the collection's value might change when a listener is added
+ this.value = this.buildValue();
+ }
+
+ /**
+ * Start listening to the model.
+ */
+ protected abstract void engageModel_();
+
+ /**
+ * Build and return the current value, as derived from the
+ * current state of the wrapped model.
+ */
+ protected abstract T buildValue();
+
+ /**
+ * Stop listening to the model and clear the value.
+ */
+ protected void disengageModel() {
+ this.disengageModel_();
+ // clear out our value when we are not listening to the collection
+ this.value = null;
+ }
+
+ /**
+ * Stop listening to the model.
+ */
+ protected abstract void disengageModel_();
+
+ /**
+ * The wrapped model changed in some fashion.
+ * Recalculate the value and notify any listeners.
+ */
+ protected void propertyChanged() {
+ Object old = this.value;
+ this.value = this.buildValue();
+ this.firePropertyChanged(VALUE, old, this.value);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/BufferedWritablePropertyValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/BufferedWritablePropertyValueModel.java
new file mode 100644
index 0000000000..086cd2c154
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/BufferedWritablePropertyValueModel.java
@@ -0,0 +1,343 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.internal.model.value;
+
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+
+/**
+ * A BufferedPropertyValueModel is used to hold a temporary copy of the value
+ * in another property value model (the "wrapped" value holder). The application
+ * can modify this temporary copy, ad nauseam; but the temporary copy is only
+ * passed through to the "wrapped" value holder when the trigger "accepts" the
+ * buffered value. Alternatively, the application can "reset" the buffered value
+ * to the original, "wrapped" value.
+ *
+ * The trigger is another value model that holds a Boolean and the application
+ * changes the trigger's value to true on "accept", false on "reset". Typically,
+ * in a dialog:
+ * - pressing the OK button will trigger an "accept" and close the dialog
+ * - pressing the Cancel button will simply close the dialog,
+ * dropping the "buffered" values into the bit bucket
+ * - pressing the Apply button will trigger an "accept" and leave the dialog open
+ * - pressing the Restore button will trigger a "reset" and leave the dialog open
+ *
+ * A number of buffered property value models can wrap another set of
+ * property aspect adapters that adapt the various aspects of a single
+ * domain model. All the bufferd property value models can be hooked to the
+ * same trigger, and that trigger is controlled by the application, typically
+ * via the OK button in a dialog.
+ *
+ * @see PropertyAspectAdapter
+ */
+public class BufferedWritablePropertyValueModel<T>
+ extends PropertyValueModelWrapper<T>
+ implements WritablePropertyValueModel<T>
+{
+
+ /**
+ * We cache the value here until it is accepted and passed
+ * through to the wrapped value holder.
+ */
+ protected T bufferedValue;
+
+ /**
+ * This is set to true when we are "accepting" the buffered value
+ * and passing it through to the wrapped value holder. This allows
+ * us to ignore the property change event fired by the wrapped
+ * value holder.
+ * (We can't stop listening to the wrapped value holder, because
+ * if we are the only listener that could "deactivate" the wrapped
+ * value holder.)
+ */
+ protected boolean accepting;
+
+ /**
+ * This is the trigger that indicates whether the buffered value
+ * should be accepted or reset.
+ */
+ protected final PropertyValueModel<Boolean> triggerHolder;
+
+ /** This listens to the trigger holder. */
+ protected final PropertyChangeListener triggerChangeListener;
+
+ /**
+ * This flag indicates whether our buffered value has been assigned
+ * a value and is possibly out of synch with the wrapped value.
+ */
+ protected boolean buffering;
+
+
+ // ********** constructors **********
+
+ /**
+ * Construct a buffered property value model with the specified wrapped
+ * property value model and trigger holder.
+ */
+ public BufferedWritablePropertyValueModel(WritablePropertyValueModel<T> valueHolder, PropertyValueModel<Boolean> triggerHolder) {
+ super(valueHolder);
+ if (triggerHolder == null) {
+ throw new NullPointerException();
+ }
+ this.triggerHolder = triggerHolder;
+ this.bufferedValue = null;
+ this.buffering = false;
+ this.accepting = false;
+ this.triggerChangeListener = this.buildTriggerChangeListener();
+ }
+
+
+ // ********** initialization **********
+
+ protected PropertyChangeListener buildTriggerChangeListener() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent e) {
+ BufferedWritablePropertyValueModel.this.triggerChanged(e);
+ }
+ @Override
+ public String toString() {
+ return "trigger change listener";
+ }
+ };
+ }
+
+
+ // ********** ValueModel implementation **********
+
+ /**
+ * If we are currently "buffering" a value, return that;
+ * otherwise, return the wrapped value.
+ */
+ public T value() {
+ return this.buffering ? this.bufferedValue : this.valueHolder.value();
+ }
+
+ /**
+ * Assign the new value to our "buffered" value.
+ * It will be forwarded to the wrapped value holder
+ * when the trigger is "accepted".
+ */
+ public void setValue(T value) {
+ Object old = this.value();
+ this.bufferedValue = value;
+ this.buffering = true;
+ this.firePropertyChanged(VALUE, old, this.bufferedValue);
+ }
+
+
+ // ********** PropertyValueModelWrapper extensions **********
+
+ /**
+ * extend to engage the trigger holder also
+ */
+ @Override
+ protected void engageValueHolder() {
+ super.engageValueHolder();
+ this.triggerHolder.addPropertyChangeListener(VALUE, this.triggerChangeListener);
+ }
+
+ /**
+ * extend to disengage the trigger holder also
+ */
+ @Override
+ protected void disengageValueHolder() {
+ this.triggerHolder.removePropertyChangeListener(VALUE, this.triggerChangeListener);
+ super.disengageValueHolder();
+ }
+
+
+ // ********** behavior **********
+
+ /**
+ * If we do not yet have a "buffered" value, simply propagate the
+ * change notification with the buffered model as the source.
+ * If we do have a "buffered" value, do nothing.
+ */
+ @Override
+ protected void valueChanged(PropertyChangeEvent e) {
+ if (this.accepting) {
+ // if we are currently "accepting" the value, ignore change notifications,
+ // since we caused them and our own listeners are already aware of the change
+ return;
+ }
+ if (this.buffering) {
+ this.handleChangeConflict(e);
+ } else {
+ this.firePropertyChanged(e.cloneWithSource(this));
+ }
+ }
+
+ /**
+ * By default, if we have a "buffered" value and the "wrapped" value changes,
+ * we simply ignore the new "wrapped" value and simply overlay it with the
+ * "buffered" value if it is "accepted". ("Last One In Wins" concurrency model)
+ * Subclasses can override this method to change that behavior with a
+ * different concurrency model. For example, you could drop the "buffered" value
+ * and replace it with the new "wrapped" value, or you could throw an
+ * exception.
+ */
+ protected void handleChangeConflict(PropertyChangeEvent e) {
+ // the default is to do nothing
+ }
+
+ /**
+ * The trigger changed:
+ * If it is now true, "accept" the buffered value and forward
+ * it to the wrapped value holder.
+ * If it is now false, "reset" the buffered value to its original value.
+ */
+ protected void triggerChanged(PropertyChangeEvent e) {
+ if ( ! this.buffering) {
+ // if nothing has been "buffered", we don't need to do anything:
+ // nothing needs to be passed through; nothing needs to be reset;
+ return;
+ }
+ if (((Boolean) e.newValue()).booleanValue()) {
+ // set the accepting flag so we ignore any events
+ // fired by the wrapped value holder
+ this.accepting = true;
+ this.valueHolder().setValue(this.bufferedValue);
+ this.bufferedValue = null;
+ this.buffering = false;
+ // clear the flag once the "accept" is complete
+ this.accepting = false;
+ } else {
+ // notify our listeners that our value has been reset
+ Object old = this.bufferedValue;
+ this.bufferedValue = null;
+ this.buffering = false;
+ this.firePropertyChanged(VALUE, old, this.valueHolder.value());
+ }
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value());
+ }
+
+
+ // ********** convenience methods **********
+
+ /**
+ * Return whether the buffered model is currently "buffering"
+ * a value.
+ */
+ public boolean isBuffering() {
+ return this.buffering;
+ }
+
+ /**
+ * Our constructor accepts only a WritablePropertyValueModel<T>.
+ */
+ @SuppressWarnings("unchecked")
+ protected WritablePropertyValueModel<T> valueHolder() {
+ return (WritablePropertyValueModel<T>) this.valueHolder;
+ }
+
+
+ // ********** inner class **********
+
+ /**
+ * Trigger is a special property value model that only maintains its
+ * value (of true or false) during the change notification caused by
+ * the #setValue(Object) method. In other words, a Trigger object
+ * only has a valid value
+ */
+ public static class Trigger extends SimplePropertyValueModel<Boolean> {
+
+
+ // ********** constructor **********
+
+ /**
+ * Construct a trigger with a null value.
+ */
+ public Trigger() {
+ super();
+ }
+
+
+ // ********** ValueModel implementation **********
+
+ /**
+ * Extend so that this method can only be invoked during
+ * change notification triggered by #setValue(Object).
+ */
+ @Override
+ public Boolean value() {
+ if (this.value == null) {
+ throw new IllegalStateException("The method Trigger.value() may only be called during change notification.");
+ }
+ return this.value;
+ }
+
+ /**
+ * Extend to reset the value to null once all the
+ * listeners have been notified.
+ */
+ @Override
+ public void setValue(Boolean value) {
+ super.setValue(value);
+ this.value = null;
+ }
+
+
+ // ********** convenience methods **********
+
+ /**
+ * Set the trigger's value:
+ * - true indicates "accept"
+ * - false indicates "reset"
+ */
+ public void setValue(boolean value) {
+ this.setValue(Boolean.valueOf(value));
+ }
+
+ /**
+ * Return the trigger's value:
+ * - true indicates "accept"
+ * - false indicates "reset"
+ */
+ public boolean booleanValue() {
+ return this.value().booleanValue();
+ }
+
+ /**
+ * Accept the trigger (i.e. set its value to true).
+ */
+ public void accept() {
+ this.setValue(true);
+ }
+
+ /**
+ * Return whether the trigger has been accepted
+ * (i.e. its value was changed to true).
+ */
+ public boolean isAccepted() {
+ return this.booleanValue();
+ }
+
+ /**
+ * Reset the trigger (i.e. set its value to false).
+ */
+ public void reset() {
+ this.setValue(false);
+ }
+
+ /**
+ * Return whether the trigger has been reset
+ * (i.e. its value was changed to false).
+ */
+ public boolean isReset() {
+ return ! this.booleanValue();
+ }
+
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionAspectAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionAspectAdapter.java
index b77340b208..5e22ec2598 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionAspectAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionAspectAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.model.value;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.Iterator;
import org.eclipse.jpt.utility.internal.CollectionTools;
@@ -20,6 +22,8 @@ import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener;
/**
* This extension of AspectAdapter provides CollectionChange support.
+ * This allows us to convert a set of one or more collections into
+ * a single collection, VALUES.
*
* The typical subclass will override the following methods:
* #iterator_()
@@ -36,14 +40,15 @@ import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener;
* override this method only if returning a zero when the
* subject is null is unacceptable
*/
-public abstract class CollectionAspectAdapter
- extends AspectAdapter
- implements CollectionValueModel
+public abstract class CollectionAspectAdapter<S extends Model, E>
+ extends AspectAdapter<S>
+ implements CollectionValueModel<E>
{
/**
- * The name of the subject's collection that we use for the value.
+ * The name of the subject's collections that we use for the value.
*/
- protected final String collectionName;
+ protected final String[] collectionNames;
+ protected static final String[] EMPTY_COLLECTION_NAMES = new String[0];
/** A listener that listens to the subject's collection aspect. */
protected final CollectionChangeListener collectionChangeListener;
@@ -55,30 +60,46 @@ public abstract class CollectionAspectAdapter
* Construct a CollectionAspectAdapter for the specified subject
* and collection.
*/
- protected CollectionAspectAdapter(String collectionName, Model subject) {
- this(new ReadOnlyPropertyValueModel(subject), collectionName);
+ protected CollectionAspectAdapter(String collectionName, S subject) {
+ this(new String[] {collectionName}, subject);
}
/**
- * Construct a CollectionAspectAdapter for an "unchanging" collection in
- * the specified subject. This is useful for a collection aspect that does not
- * change for a particular subject; but the subject will change, resulting in
- * a new collection.
+ * Construct a CollectionAspectAdapter for the specified subject
+ * and collections.
*/
- protected CollectionAspectAdapter(ValueModel subjectHolder) {
- this(subjectHolder, null);
+ protected CollectionAspectAdapter(String[] collectionNames, S subject) {
+ this(new StaticPropertyValueModel<S>(subject), collectionNames);
}
/**
* Construct a CollectionAspectAdapter for the specified subject holder
- * and collection.
+ * and collections.
*/
- protected CollectionAspectAdapter(ValueModel subjectHolder, String collectionName) {
+ protected CollectionAspectAdapter(PropertyValueModel<? extends S> subjectHolder, String... collectionNames) {
super(subjectHolder);
- this.collectionName = collectionName;
+ this.collectionNames = collectionNames;
this.collectionChangeListener = this.buildCollectionChangeListener();
}
+ /**
+ * Construct a CollectionAspectAdapter for the specified subject holder
+ * and collections.
+ */
+ protected CollectionAspectAdapter(PropertyValueModel<? extends S> subjectHolder, Collection<String> collectionNames) {
+ this(subjectHolder, collectionNames.toArray(new String[collectionNames.size()]));
+ }
+
+ /**
+ * Construct a CollectionAspectAdapter for an "unchanging" collection in
+ * the specified subject. This is useful for a collection aspect that does not
+ * change for a particular subject; but the subject will change, resulting in
+ * a new collection.
+ */
+ protected CollectionAspectAdapter(PropertyValueModel<? extends S> subjectHolder) {
+ this(subjectHolder, EMPTY_COLLECTION_NAMES);
+ }
+
// ********** initialization **********
@@ -102,7 +123,7 @@ public abstract class CollectionAspectAdapter
}
@Override
public String toString() {
- return "collection change listener: " + CollectionAspectAdapter.this.collectionName;
+ return "collection change listener: " + Arrays.asList(CollectionAspectAdapter.this.collectionNames);
}
};
}
@@ -113,8 +134,8 @@ public abstract class CollectionAspectAdapter
/**
* Return the elements of the subject's collection aspect.
*/
- public Iterator iterator() {
- return (this.subject == null) ? EmptyIterator.instance() : this.iterator_();
+ public Iterator<E> iterator() {
+ return (this.subject == null) ? EmptyIterator.<E>instance() : this.iterator_();
}
/**
@@ -122,7 +143,7 @@ public abstract class CollectionAspectAdapter
* At this point we can be sure that the subject is not null.
* @see #iterator()
*/
- protected Iterator iterator_() {
+ protected Iterator<E> iterator_() {
throw new UnsupportedOperationException();
}
@@ -171,22 +192,27 @@ public abstract class CollectionAspectAdapter
}
@Override
- protected void engageNonNullSubject() {
- if (this.collectionName != null) {
- ((Model) this.subject).addCollectionChangeListener(this.collectionName, this.collectionChangeListener);
+ protected void engageSubject_() {
+ for (String collectionName : this.collectionNames) {
+ ((Model) this.subject).addCollectionChangeListener(collectionName, this.collectionChangeListener);
}
}
@Override
- protected void disengageNonNullSubject() {
- if (this.collectionName != null) {
- ((Model) this.subject).removeCollectionChangeListener(this.collectionName, this.collectionChangeListener);
+ protected void disengageSubject_() {
+ for (String collectionName : this.collectionNames) {
+ ((Model) this.subject).removeCollectionChangeListener(collectionName, this.collectionChangeListener);
}
}
@Override
public void toString(StringBuilder sb) {
- sb.append(this.collectionName);
+ for (int i = 0; i < this.collectionNames.length; i++) {
+ if (i != 0) {
+ sb.append(", ");
+ }
+ sb.append(this.collectionNames[i]);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionListValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionListValueModelAdapter.java
index ab1eab80b6..1a1e0ebff6 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionListValueModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionListValueModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -11,7 +11,6 @@ package org.eclipse.jpt.utility.internal.model.value;
import java.util.ArrayList;
import java.util.Iterator;
-import java.util.List;
import java.util.ListIterator;
import org.eclipse.jpt.utility.internal.CollectionTools;
@@ -37,12 +36,12 @@ import org.eclipse.jpt.utility.internal.model.listener.ListChangeListener;
* we do not have any listeners. This should not be too painful since,
* most likely, client objects will also be listeners.
*/
-public class CollectionListValueModelAdapter
+public class CollectionListValueModelAdapter<E>
extends AbstractModel
- implements ListValueModel
+ implements ListValueModel<E>
{
/** The wrapped collection value model. */
- protected final CollectionValueModel collectionHolder;
+ protected final CollectionValueModel<? extends E> collectionHolder;
/** A listener that forwards any events fired by the collection holder. */
protected final CollectionChangeListener collectionChangeListener;
@@ -52,7 +51,7 @@ public class CollectionListValueModelAdapter
* the wrapped collection, but keeps them in order.
*/
// we declare this an ArrayList so we can use #clone() and #ensureCapacity(int)
- protected final ArrayList list;
+ protected final ArrayList<E> list;
// ********** constructors **********
@@ -60,14 +59,14 @@ public class CollectionListValueModelAdapter
/**
* Wrap the specified CollectionValueModel.
*/
- public CollectionListValueModelAdapter(CollectionValueModel collectionHolder) {
+ public CollectionListValueModelAdapter(CollectionValueModel<? extends E> collectionHolder) {
super();
if (collectionHolder == null) {
throw new NullPointerException();
}
this.collectionHolder = collectionHolder;
this.collectionChangeListener = this.buildCollectionChangeListener();
- this.list = new ArrayList();
+ this.list = new ArrayList<E>();
// postpone building the list and listening to the underlying collection
// until we have listeners ourselves...
}
@@ -108,16 +107,15 @@ public class CollectionListValueModelAdapter
// ********** ListValueModel implementation **********
- public Iterator iterator() {
+ public Iterator<E> iterator() {
return this.listIterator();
}
- public ListIterator listIterator() {
- // try to prevent backdoor modification of the list
- return new ReadOnlyListIterator(this.list);
+ public ListIterator<E> listIterator() {
+ return new ReadOnlyListIterator<E>(this.list);
}
- public Object get(int index) {
+ public E get(int index) {
return this.list.get(index);
}
@@ -212,7 +210,7 @@ public class CollectionListValueModelAdapter
// ********** behavior **********
protected void buildList() {
- Iterator stream = (Iterator) this.collectionHolder.iterator();
+ Iterator<? extends E> stream = this.collectionHolder.iterator();
// if the new collection is empty, do nothing
if (stream.hasNext()) {
this.list.ensureCapacity(this.collectionHolder.size());
@@ -245,17 +243,22 @@ public class CollectionListValueModelAdapter
}
protected void itemsAdded(CollectionChangeEvent e) {
- this.addItemsToList(this.indexToAddItems(), CollectionTools.list(e.items()), this.list, LIST_VALUES);
+ this.addItemsToList(this.indexToAddItems(), CollectionTools.list(this.items(e)), this.list, LIST_VALUES);
}
- protected int indexToAddItems() {
- return this.list.size();
- }
-
+ protected int indexToAddItems() {
+ return this.list.size();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Iterator<E> items(CollectionChangeEvent e) {
+ return (Iterator<E>) e.items();
+ }
+
protected void itemsRemoved(CollectionChangeEvent e) {
// we have to remove the items individually,
// since they are probably not in sequence
- for (Iterator stream = e.items(); stream.hasNext(); ) {
+ for (Iterator<E> stream = this.items(e); stream.hasNext(); ) {
this.removeItemFromList(this.lastIdentityIndexOf(stream.next()), this.list, LIST_VALUES);
}
}
@@ -271,7 +274,8 @@ public class CollectionListValueModelAdapter
protected void collectionChanged(CollectionChangeEvent e) {
// put in empty check so we don't fire events unnecessarily
if ( ! this.list.isEmpty()) {
- ArrayList removedItems = (ArrayList) this.list.clone();
+ @SuppressWarnings("unchecked")
+ ArrayList<E> removedItems = (ArrayList<E>) this.list.clone();
this.list.clear();
this.fireItemsRemoved(LIST_VALUES, 0, removedItems);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionPropertyValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionPropertyValueModelAdapter.java
index a7e34e8d51..b03ebfb4a5 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionPropertyValueModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionPropertyValueModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,12 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.model.value;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.ChangeSupport;
-import org.eclipse.jpt.utility.internal.model.SingleAspectChangeSupport;
import org.eclipse.jpt.utility.internal.model.event.CollectionChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener;
-import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
/**
* This abstract class provides the infrastructure needed to wrap
@@ -28,28 +24,17 @@ import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
* current collection value
*
* Subclasses might want to override:
- * - #setValue(Object)
- * to manipulate the collection in some appropriate fashion
* - #itemsAdded(CollectionChangeEvent e)
* - #itemsRemoved(CollectionChangeEvent e)
+ * - #collectionCleared(CollectionChangeEvent e)
* - #collectionChanged(CollectionChangeEvent e)
* to improve performance (by not recalculating the value, if possible)
*/
-public abstract class CollectionPropertyValueModelAdapter
- extends AbstractModel
- implements PropertyValueModel
+public abstract class CollectionPropertyValueModelAdapter<T>
+ extends AspectPropertyValueModelAdapter<T>
{
- /**
- * Cache the current value so we can pass an "old value" when
- * we fire a property change event.
- * We need this because the value may be calculated and we may
- * not able to derive the "old value" from the collection
- * change event fired by the collection value model.
- */
- protected Object value;
-
/** The wrapped collection value model. */
- protected final CollectionValueModel collectionHolder;
+ protected final CollectionValueModel<?> collectionHolder;
/** A listener that allows us to synch with changes to the wrapped collection holder. */
protected final CollectionChangeListener collectionChangeListener;
@@ -61,19 +46,12 @@ public abstract class CollectionPropertyValueModelAdapter
* Construct a property value model with the specified wrapped
* collection value model.
*/
- protected CollectionPropertyValueModelAdapter(CollectionValueModel collectionHolder) {
+ protected CollectionPropertyValueModelAdapter(CollectionValueModel<?> collectionHolder) {
super();
this.collectionHolder = collectionHolder;
- // our value is null when we are not listening to the collection holder
- this.value = null;
this.collectionChangeListener = this.buildCollectionChangeListener();
}
- @Override
- protected ChangeSupport buildChangeSupport() {
- return new SingleAspectChangeSupport(this, PropertyChangeListener.class, VALUE);
- }
-
protected CollectionChangeListener buildCollectionChangeListener() {
return new CollectionChangeListener() {
public void itemsAdded(CollectionChangeEvent e) {
@@ -96,112 +74,22 @@ public abstract class CollectionPropertyValueModelAdapter
}
- // ********** ValueModel implementation **********
-
- /**
- * Return the cached value.
- */
- public Object value() {
- return this.value;
- }
-
-
- // ********** PropertyValueModel implementation **********
-
- public void setValue(Object value) {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** extend change support **********
-
- /**
- * Extend to start listening to the wrapped collection if necessary.
- */
- @Override
- public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
- if (this.hasNoListeners()) {
- this.engageModel();
- }
- super.addPropertyChangeListener(listener);
- }
-
- /**
- * Extend to start listening to the wrapped collection if necessary.
- */
- @Override
- public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- if (propertyName == VALUE && this.hasNoListeners()) {
- this.engageModel();
- }
- super.addPropertyChangeListener(propertyName, listener);
- }
-
- /**
- * Extend to stop listening to the wrapped collection if necessary.
- */
- @Override
- public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
- super.removePropertyChangeListener(listener);
- if (this.hasNoListeners()) {
- this.disengageModel();
- }
- }
-
- /**
- * Extend to stop listening to the wrapped collection if necessary.
- */
- @Override
- public synchronized void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- super.removePropertyChangeListener(propertyName, listener);
- if (propertyName == VALUE && this.hasNoListeners()) {
- this.disengageModel();
- }
- }
-
-
- // ********** queries **********
-
- /**
- * Return whether there are any listeners for the aspect.
- */
- protected boolean hasListeners() {
- return this.hasAnyPropertyChangeListeners(VALUE);
- }
-
- /**
- * Return whether there are any listeners for the aspect.
- */
- protected boolean hasNoListeners() {
- return ! this.hasListeners();
- }
-
-
// ********** behavior **********
/**
* Start listening to the collection holder.
*/
- protected void engageModel() {
+ @Override
+ protected void engageModel_() {
this.collectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.collectionChangeListener);
- // synch our value *after* we start listening to the collection,
- // since the collection's value might change when a listener is added
- this.value = this.buildValue();
}
/**
- * Build and return the current value, as derived from the
- * current state of the wrapped collection.
- */
- protected abstract Object buildValue();
-
- /**
* Stop listening to the collection holder.
*/
- protected void disengageModel() {
+ @Override
+ protected void disengageModel_() {
this.collectionHolder.removeCollectionChangeListener(CollectionValueModel.VALUES, this.collectionChangeListener);
- // clear out our value when we are not listening to the collection
- this.value = null;
}
@Override
@@ -248,14 +136,4 @@ public abstract class CollectionPropertyValueModelAdapter
this.propertyChanged();
}
- /**
- * The wrapped collection changed in some fashion.
- * Recalculate the value and notify any listeners.
- */
- protected void propertyChanged() {
- Object old = this.value;
- this.value = this.buildValue();
- this.firePropertyChanged(VALUE, old, this.value);
- }
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionValueModel.java
index bc17035f97..58c76cc505 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -17,14 +17,14 @@ import org.eclipse.jpt.utility.internal.model.Model;
* Interface used to abstract collection accessing and
* change notification and make it more pluggable.
*/
-public interface CollectionValueModel
- extends Model//, Iterable<E>
+public interface CollectionValueModel<E>
+ extends Model, Iterable<E>
{
/**
* Return the collection's values.
*/
- Iterator iterator();
+ Iterator<E> iterator();
String VALUES = "values";
/**
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionValueModelWrapper.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionValueModelWrapper.java
index c1a9b31a92..1ebb7103a6 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionValueModelWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CollectionValueModelWrapper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.model.value;
-import java.util.Collection;
import java.util.Iterator;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
@@ -23,13 +22,12 @@ import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener;
* another collection value model, "lazily" listen to it, and propagate
* its change notifications.
*/
-public abstract class CollectionValueModelWrapper
+public abstract class CollectionValueModelWrapper<E>
extends AbstractModel
- implements CollectionValueModel
{
/** The wrapped collection value model. */
- protected final CollectionValueModel collectionHolder;
+ protected final CollectionValueModel<? extends E> collectionHolder;
/** A listener that allows us to synch with changes to the wrapped collection holder. */
protected final CollectionChangeListener collectionChangeListener;
@@ -41,7 +39,7 @@ public abstract class CollectionValueModelWrapper
* Construct a collection value model with the specified wrapped
* collection value model.
*/
- protected CollectionValueModelWrapper(CollectionValueModel collectionHolder) {
+ protected CollectionValueModelWrapper(CollectionValueModel<? extends E> collectionHolder) {
super();
this.collectionHolder = collectionHolder;
this.collectionChangeListener = this.buildCollectionChangeListener();
@@ -52,22 +50,22 @@ public abstract class CollectionValueModelWrapper
@Override
protected ChangeSupport buildChangeSupport() {
- return new SingleAspectChangeSupport(this, CollectionChangeListener.class, VALUES);
+ return new SingleAspectChangeSupport(this, CollectionChangeListener.class, CollectionValueModel.VALUES);
}
protected CollectionChangeListener buildCollectionChangeListener() {
return new CollectionChangeListener() {
- public void itemsAdded(CollectionChangeEvent e) {
- CollectionValueModelWrapper.this.itemsAdded(e);
+ public void itemsAdded(CollectionChangeEvent event) {
+ CollectionValueModelWrapper.this.itemsAdded(event);
}
- public void itemsRemoved(CollectionChangeEvent e) {
- CollectionValueModelWrapper.this.itemsRemoved(e);
+ public void itemsRemoved(CollectionChangeEvent event) {
+ CollectionValueModelWrapper.this.itemsRemoved(event);
}
- public void collectionCleared(CollectionChangeEvent e) {
- CollectionValueModelWrapper.this.collectionCleared(e);
+ public void collectionCleared(CollectionChangeEvent event) {
+ CollectionValueModelWrapper.this.collectionCleared(event);
}
- public void collectionChanged(CollectionChangeEvent e) {
- CollectionValueModelWrapper.this.collectionChanged(e);
+ public void collectionChanged(CollectionChangeEvent event) {
+ CollectionValueModelWrapper.this.collectionChanged(event);
}
@Override
public String toString() {
@@ -84,7 +82,7 @@ public abstract class CollectionValueModelWrapper
*/
@Override
public synchronized void addCollectionChangeListener(CollectionChangeListener listener) {
- if (this.hasNoCollectionChangeListeners(VALUES)) {
+ if (this.hasNoCollectionChangeListeners(CollectionValueModel.VALUES)) {
this.engageModel();
}
super.addCollectionChangeListener(listener);
@@ -95,7 +93,7 @@ public abstract class CollectionValueModelWrapper
*/
@Override
public synchronized void addCollectionChangeListener(String collectionName, CollectionChangeListener listener) {
- if (collectionName == VALUES && this.hasNoCollectionChangeListeners(VALUES)) {
+ if (collectionName == CollectionValueModel.VALUES && this.hasNoCollectionChangeListeners(CollectionValueModel.VALUES)) {
this.engageModel();
}
super.addCollectionChangeListener(collectionName, listener);
@@ -107,7 +105,7 @@ public abstract class CollectionValueModelWrapper
@Override
public synchronized void removeCollectionChangeListener(CollectionChangeListener listener) {
super.removeCollectionChangeListener(listener);
- if (this.hasNoCollectionChangeListeners(VALUES)) {
+ if (this.hasNoCollectionChangeListeners(CollectionValueModel.VALUES)) {
this.disengageModel();
}
}
@@ -118,7 +116,7 @@ public abstract class CollectionValueModelWrapper
@Override
public synchronized void removeCollectionChangeListener(String collectionName, CollectionChangeListener listener) {
super.removeCollectionChangeListener(collectionName, listener);
- if (collectionName == VALUES && this.hasNoCollectionChangeListeners(VALUES)) {
+ if (collectionName == CollectionValueModel.VALUES && this.hasNoCollectionChangeListeners(CollectionValueModel.VALUES)) {
this.disengageModel();
}
}
@@ -130,14 +128,20 @@ public abstract class CollectionValueModelWrapper
* Start listening to the collection holder.
*/
protected void engageModel() {
- this.collectionHolder.addCollectionChangeListener(VALUES, this.collectionChangeListener);
+ this.collectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.collectionChangeListener);
}
/**
* Stop listening to the collection holder.
*/
protected void disengageModel() {
- this.collectionHolder.removeCollectionChangeListener(VALUES, this.collectionChangeListener);
+ this.collectionHolder.removeCollectionChangeListener(CollectionValueModel.VALUES, this.collectionChangeListener);
+ }
+
+ // minimize suppressed warnings
+ @SuppressWarnings("unchecked")
+ protected Iterator<E> items(CollectionChangeEvent event) {
+ return (Iterator<E>) event.items();
}
@Override
@@ -152,24 +156,24 @@ public abstract class CollectionValueModelWrapper
* Items were added to the wrapped collection holder;
* propagate the change notification appropriately.
*/
- protected abstract void itemsAdded(CollectionChangeEvent e);
+ protected abstract void itemsAdded(CollectionChangeEvent event);
/**
* Items were removed from the wrapped collection holder;
* propagate the change notification appropriately.
*/
- protected abstract void itemsRemoved(CollectionChangeEvent e);
+ protected abstract void itemsRemoved(CollectionChangeEvent event);
/**
* The wrapped collection holder was cleared;
* propagate the change notification appropriately.
*/
- protected abstract void collectionCleared(CollectionChangeEvent e);
+ protected abstract void collectionCleared(CollectionChangeEvent event);
/**
* The value of the wrapped collection holder has changed;
* propagate the change notification appropriately.
*/
- protected abstract void collectionChanged(CollectionChangeEvent e);
+ protected abstract void collectionChanged(CollectionChangeEvent event);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CompositeCollectionValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CompositeCollectionValueModel.java
index 2fd599019e..29a0f0feff 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CompositeCollectionValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/CompositeCollectionValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -35,28 +35,29 @@ import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener;
* - components - the component collection value models that are combined
* by this composite collection value model
*/
-public class CompositeCollectionValueModel
- extends CollectionValueModelWrapper
+public class CompositeCollectionValueModel<T, E>
+ extends CollectionValueModelWrapper<T>
+ implements CollectionValueModel<E>
{
/**
* This is the (optional) user-supplied object that transforms
* the items in the wrapped collection to collection value models.
*/
- private final Transformer transformer;
+ private final Transformer<T, CollectionValueModel<E>> transformer;
/**
* Cache of the component collection value models that
* were generated by the transformer; keyed by the item
* in the wrapped collection that was passed to the transformer.
*/
- private final IdentityHashMap components;
+ private final IdentityHashMap<T, CollectionValueModel<E>> components;
/**
* Cache of the collections corresponding to the component
* collection value models above; keyed by the component
* collection value models.
*/
- private final IdentityHashMap collections;
+ private final IdentityHashMap<CollectionValueModel<E>, ArrayList<E>> collections;
/** Listener that listens to all the component collection value models. */
private final CollectionChangeListener componentListener;
@@ -73,19 +74,19 @@ public class CompositeCollectionValueModel
* <code>transform(Object)</code> method instead of building a
* <code>Transformer</code>.
*/
- public CompositeCollectionValueModel(CollectionValueModel collectionHolder) {
- this(collectionHolder, Transformer.Disabled.instance());
+ public CompositeCollectionValueModel(CollectionValueModel<? extends T> collectionHolder) {
+ this(collectionHolder, Transformer.Disabled.<T, CollectionValueModel<E>>instance());
}
/**
* Construct a collection value model with the specified wrapped
* collection value model and transformer.
*/
- public CompositeCollectionValueModel(CollectionValueModel collectionHolder, Transformer transformer) {
+ public CompositeCollectionValueModel(CollectionValueModel<? extends T> collectionHolder, Transformer<T, CollectionValueModel<E>> transformer) {
super(collectionHolder);
this.transformer = transformer;
- this.components = new IdentityHashMap();
- this.collections = new IdentityHashMap();
+ this.components = new IdentityHashMap<T, CollectionValueModel<E>>();
+ this.collections = new IdentityHashMap<CollectionValueModel<E>, ArrayList<E>>();
this.componentListener = this.buildComponentListener();
this.size = 0;
}
@@ -96,16 +97,16 @@ public class CompositeCollectionValueModel
* <code>transform(Object)</code> method instead of building a
* <code>Transformer</code>.
*/
- public CompositeCollectionValueModel(ListValueModel listHolder) {
- this(new ListCollectionValueModelAdapter(listHolder));
+ public CompositeCollectionValueModel(ListValueModel<? extends T> listHolder) {
+ this(new ListCollectionValueModelAdapter<T>(listHolder));
}
/**
* Construct a collection value model with the specified wrapped
* list value model and transformer.
*/
- public CompositeCollectionValueModel(ListValueModel listHolder, Transformer transformer) {
- this(new ListCollectionValueModelAdapter(listHolder), transformer);
+ public CompositeCollectionValueModel(ListValueModel<? extends T> listHolder, Transformer<T, CollectionValueModel<E>> transformer) {
+ this(new ListCollectionValueModelAdapter<T>(listHolder), transformer);
}
@@ -135,14 +136,15 @@ public class CompositeCollectionValueModel
// ********** CollectionValueModel implementation **********
- public Iterator iterator() {
- return new CompositeIterator(this.buildCollectionsIterators());
+ public Iterator<E> iterator() {
+ return new CompositeIterator<E>(this.buildCollectionsIterators());
}
- protected Iterator buildCollectionsIterators() {
- return new TransformationIterator(this.collections.values().iterator()) {
- protected Object transform(Object next) {
- return ((ArrayList) next).iterator();
+ protected Iterator<Iterator<E>> buildCollectionsIterators() {
+ return new TransformationIterator<ArrayList<E>, Iterator<E>>(this.collections.values().iterator()) {
+ @Override
+ protected Iterator<E> transform(ArrayList<E> next) {
+ return next.iterator();
}
};
}
@@ -162,15 +164,15 @@ public class CompositeCollectionValueModel
// the following will trigger the firing of a number of unnecessary events
// (since we don't have any listeners yet),
// but it reduces the amount of duplicate code
- this.addComponentSources((Iterator) this.collectionHolder.iterator());
+ this.addComponentSources(this.collectionHolder.iterator());
}
@Override
protected void disengageModel() {
super.disengageModel();
// stop listening to the components...
- for (Iterator stream = this.components.values().iterator(); stream.hasNext(); ) {
- ((CollectionValueModel) stream.next()).removeCollectionChangeListener(CollectionValueModel.VALUES, this.componentListener);
+ for (CollectionValueModel<E> cvm : this.components.values()) {
+ cvm.removeCollectionChangeListener(CollectionValueModel.VALUES, this.componentListener);
}
// ...and clear the cache
this.components.clear();
@@ -184,14 +186,14 @@ public class CompositeCollectionValueModel
*/
@Override
protected void itemsAdded(CollectionChangeEvent e) {
- this.addComponentSources(e.items());
+ this.addComponentSources(this.items(e));
}
/**
* Transform the specified sources to collection value models
* and add their items to our cache.
*/
- protected void addComponentSources(Iterator sources) {
+ protected void addComponentSources(Iterator<? extends T> sources) {
while (sources.hasNext()) {
this.addComponentSource(sources.next());
}
@@ -201,13 +203,13 @@ public class CompositeCollectionValueModel
* Transform the specified source to a collection value model
* and add its items to our cache.
*/
- protected void addComponentSource(Object source) {
- CollectionValueModel component = this.transform(source);
+ protected void addComponentSource(T source) {
+ CollectionValueModel<E> component = this.transform(source);
if (this.components.put(source, component) != null) {
throw new IllegalStateException("duplicate component: " + source);
}
component.addCollectionChangeListener(CollectionValueModel.VALUES, this.componentListener);
- ArrayList componentCollection = new ArrayList(component.size());
+ ArrayList<E> componentCollection = new ArrayList<E>(component.size());
if (this.collections.put(component, componentCollection) != null) {
throw new IllegalStateException("duplicate collection: " + source);
}
@@ -220,14 +222,14 @@ public class CompositeCollectionValueModel
*/
@Override
protected void itemsRemoved(CollectionChangeEvent e) {
- this.removeComponentSources(e.items());
+ this.removeComponentSources(this.items(e));
}
/**
* Remove the items corresponding to the specified sources
* from our cache.
*/
- protected void removeComponentSources(Iterator sources) {
+ protected void removeComponentSources(Iterator<T> sources) {
while (sources.hasNext()) {
this.removeComponentSource(sources.next());
}
@@ -237,13 +239,13 @@ public class CompositeCollectionValueModel
* Remove the items corresponding to the specified source
* from our cache.
*/
- protected void removeComponentSource(Object source) {
- CollectionValueModel component = (CollectionValueModel) this.components.remove(source);
+ protected void removeComponentSource(T source) {
+ CollectionValueModel<E> component = this.components.remove(source);
if (component == null) {
throw new IllegalStateException("missing component: " + source);
}
component.removeCollectionChangeListener(CollectionValueModel.VALUES, this.componentListener);
- ArrayList componentCollection = (ArrayList) this.collections.remove(component);
+ ArrayList<E> componentCollection = this.collections.remove(component);
if (componentCollection == null) {
throw new IllegalStateException("missing collection: " + source);
}
@@ -257,7 +259,7 @@ public class CompositeCollectionValueModel
@Override
protected void collectionCleared(CollectionChangeEvent e) {
// copy the keys so we don't eat our own tail
- this.removeComponentSources(new ArrayList(this.components.keySet()).iterator());
+ this.removeComponentSources(new ArrayList<T>(this.components.keySet()).iterator());
}
/**
@@ -267,8 +269,8 @@ public class CompositeCollectionValueModel
@Override
protected void collectionChanged(CollectionChangeEvent e) {
// copy the keys so we don't eat our own tail
- this.removeComponentSources(new ArrayList(this.components.keySet()).iterator());
- this.addComponentSources((Iterator) this.collectionHolder.iterator());
+ this.removeComponentSources(new ArrayList<T>(this.components.keySet()).iterator());
+ this.addComponentSources(this.collectionHolder.iterator());
}
@@ -279,8 +281,8 @@ public class CompositeCollectionValueModel
* Cast to ArrayList so we can use ArrayList-specific methods
* (e.g. #clone() and #ensureCapacity()).
*/
- protected ArrayList getComponentCollection(CollectionValueModel collectionValueModel) {
- return (ArrayList) this.collections.get(collectionValueModel);
+ protected ArrayList<E> componentCollection(CollectionValueModel<E> collectionValueModel) {
+ return this.collections.get(collectionValueModel);
}
@@ -292,8 +294,8 @@ public class CompositeCollectionValueModel
* This method can be overridden by a subclass as an
* alternative to building a <code>Transformer</code>.
*/
- protected CollectionValueModel transform(Object value) {
- return (CollectionValueModel) this.transformer.transform(value);
+ protected CollectionValueModel<E> transform(T value) {
+ return this.transformer.transform(value);
}
/**
@@ -301,27 +303,27 @@ public class CompositeCollectionValueModel
* synchronize our caches.
*/
protected void componentItemsAdded(CollectionChangeEvent e) {
- this.addComponentItems(e.items(), e.itemsSize(), (CollectionValueModel) e.getSource());
+ this.addComponentItems(this.componentItems(e), e.itemsSize(), this.componentCVM(e));
}
/**
* Update our cache.
*/
- protected void addComponentItems(Iterator items, int itemsSize, CollectionValueModel cvm) {
- this.addComponentItems(items, itemsSize, this.getComponentCollection(cvm));
+ protected void addComponentItems(Iterator<E> items, int itemsSize, CollectionValueModel<E> cvm) {
+ this.addComponentItems(items, itemsSize, this.componentCollection(cvm));
}
/**
* Update our cache.
*/
- protected void addComponentItems(CollectionValueModel itemsHolder, ArrayList componentCollection) {
- this.addComponentItems((Iterator) itemsHolder.iterator(), itemsHolder.size(), componentCollection);
+ protected void addComponentItems(CollectionValueModel<E> itemsHolder, ArrayList<E> componentCollection) {
+ this.addComponentItems(itemsHolder.iterator(), itemsHolder.size(), componentCollection);
}
/**
* Update our size and collection cache.
*/
- protected void addComponentItems(Iterator items, int itemsSize, ArrayList componentCollection) {
+ protected void addComponentItems(Iterator<E> items, int itemsSize, ArrayList<E> componentCollection) {
this.size += itemsSize;
componentCollection.ensureCapacity(componentCollection.size() + itemsSize);
this.addItemsToCollection(items, componentCollection, CollectionValueModel.VALUES);
@@ -332,28 +334,29 @@ public class CompositeCollectionValueModel
* synchronize our caches.
*/
protected void componentItemsRemoved(CollectionChangeEvent e) {
- this.removeComponentItems(e.items(), e.itemsSize(), (CollectionValueModel) e.getSource());
+ this.removeComponentItems(this.componentItems(e), e.itemsSize(), this.componentCVM(e));
}
/**
* Update our size and collection cache.
*/
- protected void removeComponentItems(Iterator items, int itemsSize, CollectionValueModel cvm) {
- this.removeComponentItems(items, itemsSize, this.getComponentCollection(cvm));
+ protected void removeComponentItems(Iterator<E> items, int itemsSize, CollectionValueModel<E> cvm) {
+ this.removeComponentItems(items, itemsSize, this.componentCollection(cvm));
}
/**
* Update our size and collection cache.
*/
- protected void clearComponentItems(ArrayList items) {
+ protected void clearComponentItems(ArrayList<E> items) {
// clone the collection so we don't eat our own tail
- this.removeComponentItems(((ArrayList) items.clone()).iterator(), items.size(), items);
+ @SuppressWarnings("unchecked") ArrayList<E> clone = (ArrayList<E>) items.clone();
+ this.removeComponentItems(clone.iterator(), items.size(), items);
}
/**
* Update our size and collection cache.
*/
- protected void removeComponentItems(Iterator items, int itemsSize, ArrayList componentCollection) {
+ protected void removeComponentItems(Iterator<E> items, int itemsSize, ArrayList<E> componentCollection) {
this.size -= itemsSize;
this.removeItemsFromCollection(items, componentCollection, CollectionValueModel.VALUES);
}
@@ -364,8 +367,7 @@ public class CompositeCollectionValueModel
* collection.
*/
protected void componentCollectionCleared(CollectionChangeEvent e) {
- CollectionValueModel component = (CollectionValueModel) e.getSource();
- ArrayList items = this.getComponentCollection(component);
+ ArrayList<E> items = this.componentCollection(this.componentCVM(e));
this.clearComponentItems(items);
}
@@ -375,10 +377,22 @@ public class CompositeCollectionValueModel
* collection and then rebuilding it.
*/
protected void componentCollectionChanged(CollectionChangeEvent e) {
- CollectionValueModel component = (CollectionValueModel) e.getSource();
- ArrayList items = this.getComponentCollection(component);
+ CollectionValueModel<E> componentCVM = this.componentCVM(e);
+ ArrayList<E> items = this.componentCollection(componentCVM);
this.clearComponentItems(items);
- this.addComponentItems(component, items);
+ this.addComponentItems(componentCVM, items);
+ }
+
+ // minimize suppressed warnings
+ @SuppressWarnings("unchecked")
+ protected Iterator<E> componentItems(CollectionChangeEvent e) {
+ return (Iterator<E>) e.items();
+ }
+
+ // minimize suppressed warnings
+ @SuppressWarnings("unchecked")
+ protected CollectionValueModel<E> componentCVM(CollectionChangeEvent e) {
+ return (CollectionValueModel<E>) e.getSource();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ExtendedListValueModelWrapper.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ExtendedListValueModelWrapper.java
index da5a33401f..1d69c3e39c 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ExtendedListValueModelWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ExtendedListValueModelWrapper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -16,7 +16,7 @@ import java.util.List;
import java.util.ListIterator;
import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CompositeListIterator;
+import org.eclipse.jpt.utility.internal.iterators.ReadOnlyCompositeListIterator;
import org.eclipse.jpt.utility.internal.iterators.ReadOnlyListIterator;
import org.eclipse.jpt.utility.internal.model.event.ListChangeEvent;
@@ -27,14 +27,15 @@ import org.eclipse.jpt.utility.internal.model.event.ListChangeEvent;
* NB: Be careful using or wrapping this list value model, since the
* "extended" items may be unexpected by the client code or wrapper.
*/
-public class ExtendedListValueModelWrapper
- extends ListValueModelWrapper
+public class ExtendedListValueModelWrapper<E>
+ extends ListValueModelWrapper<E>
+ implements ListValueModel<E>
{
/** the items "prepended" to the wrapped list */
- protected List prefix;
+ protected List<E> prefix;
/** the items "appended" to the wrapped list */
- protected List suffix;
+ protected List<E> suffix;
// ********** lots o' constructors **********
@@ -42,16 +43,16 @@ public class ExtendedListValueModelWrapper
/**
* Extend the specified list with a prefix and suffix.
*/
- public ExtendedListValueModelWrapper(List prefix, ListValueModel listHolder, List suffix) {
+ public ExtendedListValueModelWrapper(List<? extends E> prefix, ListValueModel<? extends E> listHolder, List<? extends E> suffix) {
super(listHolder);
- this.prefix = new ArrayList(prefix);
- this.suffix = new ArrayList(suffix);
+ this.prefix = new ArrayList<E>(prefix);
+ this.suffix = new ArrayList<E>(suffix);
}
/**
* Extend the specified list with a prefix and suffix.
*/
- public ExtendedListValueModelWrapper(Object prefix, ListValueModel listHolder, Object suffix) {
+ public ExtendedListValueModelWrapper(E prefix, ListValueModel<? extends E> listHolder, E suffix) {
super(listHolder);
this.prefix = Collections.singletonList(prefix);
this.suffix = Collections.singletonList(suffix);
@@ -60,68 +61,69 @@ public class ExtendedListValueModelWrapper
/**
* Extend the specified list with a prefix.
*/
- public ExtendedListValueModelWrapper(List prefix, ListValueModel listHolder) {
+ public ExtendedListValueModelWrapper(List<? extends E> prefix, ListValueModel<? extends E> listHolder) {
super(listHolder);
- this.prefix = new ArrayList(prefix);
- this.suffix = Collections.EMPTY_LIST;
+ this.prefix = new ArrayList<E>(prefix);
+ this.suffix = Collections.emptyList();
}
/**
* Extend the specified list with a prefix.
*/
- public ExtendedListValueModelWrapper(Object prefix, ListValueModel listHolder) {
+ public ExtendedListValueModelWrapper(E prefix, ListValueModel<? extends E> listHolder) {
super(listHolder);
this.prefix = Collections.singletonList(prefix);
- this.suffix = Collections.EMPTY_LIST;
+ this.suffix = Collections.emptyList();
}
/**
* Extend the specified list with a suffix.
*/
- public ExtendedListValueModelWrapper(ListValueModel listHolder, List suffix) {
+ public ExtendedListValueModelWrapper(ListValueModel<? extends E> listHolder, List<? extends E> suffix) {
super(listHolder);
- this.prefix = Collections.EMPTY_LIST;
- this.suffix = new ArrayList(suffix);
+ this.prefix = Collections.emptyList();
+ this.suffix = new ArrayList<E>(suffix);
}
/**
* Extend the specified list with a suffix.
*/
- public ExtendedListValueModelWrapper(ListValueModel listHolder, Object suffix) {
+ public ExtendedListValueModelWrapper(ListValueModel<? extends E> listHolder, E suffix) {
super(listHolder);
- this.prefix = Collections.EMPTY_LIST;
+ this.prefix = Collections.emptyList();
this.suffix = Collections.singletonList(suffix);
}
/**
* Extend the specified list with a prefix containing a single null item.
*/
- public ExtendedListValueModelWrapper(ListValueModel listHolder) {
+ public ExtendedListValueModelWrapper(ListValueModel<? extends E> listHolder) {
super(listHolder);
this.prefix = Collections.singletonList(null);
- this.suffix = Collections.EMPTY_LIST;
+ this.suffix = Collections.emptyList();
}
// ********** ListValueModel implementation **********
- public Iterator iterator() {
+ public Iterator<E> iterator() {
return this.listIterator();
}
- public ListIterator listIterator() {
- // try to prevent backdoor modification of the lists
- return new ReadOnlyListIterator(
- new CompositeListIterator(
- this.prefix.listIterator(),
- this.listHolder.listIterator(),
- this.suffix.listIterator()
- )
+ public ListIterator<E> listIterator() {
+ return new ReadOnlyListIterator<E>(this.listIterator_());
+ }
+
+ @SuppressWarnings("unchecked")
+ protected ListIterator<E> listIterator_() {
+ return new ReadOnlyCompositeListIterator<E>(
+ this.prefix.listIterator(),
+ this.listHolder.listIterator(),
+ this.suffix.listIterator()
);
}
- @Override
- public Object get(int index) {
+ public E get(int index) {
int prefixSize = this.prefix.size();
if (index < prefixSize) {
return this.prefix.get(index);
@@ -132,14 +134,12 @@ public class ExtendedListValueModelWrapper
}
}
- @Override
public int size() {
return this.prefix.size() + this.listHolder.size() + this.suffix.size();
}
- @Override
public Object[] toArray() {
- ArrayList list = new ArrayList(this.size());
+ ArrayList<E> list = new ArrayList<E>(this.size());
list.addAll(this.prefix);
CollectionTools.addAll(list, this.listHolder.iterator());
list.addAll(this.suffix);
@@ -191,12 +191,12 @@ public class ExtendedListValueModelWrapper
// ********** miscellaneous **********
- public void setPrefix(List prefix) {
+ public void setPrefix(List<E> prefix) {
this.prefix = prefix;
this.fireListChanged(LIST_VALUES);
}
- public void setSuffix(List suffix) {
+ public void setSuffix(List<E> suffix) {
this.suffix = suffix;
this.fireListChanged(LIST_VALUES);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/FilteringCollectionValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/FilteringCollectionValueModel.java
index fadfcaf6ae..e645484d6f 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/FilteringCollectionValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/FilteringCollectionValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -40,14 +40,15 @@ import org.eclipse.jpt.utility.internal.model.event.CollectionChangeEvent;
* changes. The event will cause this wrapper to re-filter the changed
* item and add or remove it from the "filtered" collection as appropriate.
*/
-public class FilteringCollectionValueModel
- extends CollectionValueModelWrapper
+public class FilteringCollectionValueModel<E>
+ extends CollectionValueModelWrapper<E>
+ implements CollectionValueModel<E>
{
/** This filters the items in the nested collection. */
- private Filter filter;
+ private Filter<E> filter;
/** Cache the items that were accepted by the filter */
- private final Collection filteredItems;
+ private final Collection<E> filteredItems;
// ********** constructors **********
@@ -56,41 +57,41 @@ public class FilteringCollectionValueModel
* Construct a collection value model with the specified wrapped
* collection value model and a filter that simply accepts every object.
*/
- public FilteringCollectionValueModel(CollectionValueModel collectionHolder) {
- this(collectionHolder, Filter.Null.instance());
+ public FilteringCollectionValueModel(CollectionValueModel<? extends E> collectionHolder) {
+ this(collectionHolder, Filter.Null.<E>instance());
}
/**
* Construct a collection value model with the specified wrapped
* collection value model and filter.
*/
- public FilteringCollectionValueModel(CollectionValueModel collectionHolder, Filter filter) {
+ public FilteringCollectionValueModel(CollectionValueModel<? extends E> collectionHolder, Filter<E> filter) {
super(collectionHolder);
this.filter = filter;
- this.filteredItems = new ArrayList();
+ this.filteredItems = new ArrayList<E>();
}
/**
* Construct a collection value model with the specified wrapped
* list value model and a filter that simply accepts every object.
*/
- public FilteringCollectionValueModel(ListValueModel listHolder) {
- this(new ListCollectionValueModelAdapter(listHolder));
+ public FilteringCollectionValueModel(ListValueModel<E> listHolder) {
+ this(new ListCollectionValueModelAdapter<E>(listHolder));
}
/**
* Construct a collection value model with the specified wrapped
* list value model and filter.
*/
- public FilteringCollectionValueModel(ListValueModel listHolder, Filter filter) {
- this(new ListCollectionValueModelAdapter(listHolder), filter);
+ public FilteringCollectionValueModel(ListValueModel<E> listHolder, Filter<E> filter) {
+ this(new ListCollectionValueModelAdapter<E>(listHolder), filter);
}
// ********** CollectionValueModel implementation **********
- public Iterator iterator() {
- return new ReadOnlyIterator(this.filteredItems);
+ public Iterator<E> iterator() {
+ return new ReadOnlyIterator<E>(this.filteredItems);
}
public int size() {
@@ -118,7 +119,7 @@ public class FilteringCollectionValueModel
@Override
protected void itemsAdded(CollectionChangeEvent e) {
// filter the values before propagating the change event
- this.addItemsToCollection(this.filter(e.items()), this.filteredItems, VALUES);
+ this.addItemsToCollection(this.filter(this.items(e)), this.filteredItems, VALUES);
}
@Override
@@ -145,7 +146,7 @@ public class FilteringCollectionValueModel
/**
* Change the filter and rebuild the collection.
*/
- public void setFilter(Filter filter) {
+ public void setFilter(Filter<E> filter) {
this.filter = filter;
this.rebuildFilteredItems();
}
@@ -153,8 +154,8 @@ public class FilteringCollectionValueModel
/**
* Return an iterator that filters the specified iterator.
*/
- protected Iterator filter(Iterator items) {
- return new FilteringIterator(items, this.filter);
+ protected Iterator<E> filter(Iterator<? extends E> items) {
+ return new FilteringIterator<E, E>(items, this.filter);
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/FilteringPropertyValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/FilteringPropertyValueModel.java
index 2d5e192bd9..6ac16b63e7 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/FilteringPropertyValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/FilteringPropertyValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,34 +9,30 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.model.value;
-import org.eclipse.jpt.utility.internal.BidiFilter;
+import org.eclipse.jpt.utility.internal.Filter;
import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
/**
* A <code>FilteringPropertyValueModel</code> wraps another
- * <code>PropertyValueModel</code> and uses a <code>BidiFilter</code>
+ * <code>PropertyValueModel</code> and uses a <code>Filter</code>
* to determine when the wrapped value is to be returned by calls
- * to <code>value()</code> and modified by calls to
- * <code>setValue(Object)</code>
+ * to <code>value()</code>.
* <p>
- * As an alternative to building a <code>BidiFilter</code>, a subclass
+ * As an alternative to building a <code>Filter</code>, a subclass
* of <code>FilteringPropertyValueModel</code> can override the
- * <code>accept(Object)</code> and <code>reverseAccept(Object)</code>
- * methods.
+ * <code>accept(Object)</code> method.
* <p>
* One, possibly undesirable, side-effect of using this value model is that
* it must return *something* as the value. The default behavior is
* to return <code>null</code> whenever the wrapped value is not "accepted",
* which can be configured and/or overridden.
- * <p>
- * Likewise, if an incoming value is not "reverseAccepted", *nothing* will passed
- * through to the wrapped value holder, not even <code>null</code>.
*/
-public class FilteringPropertyValueModel
- extends PropertyValueModelWrapper
+public class FilteringPropertyValueModel<T>
+ extends PropertyValueModelWrapper<T>
+ implements PropertyValueModel<T>
{
- private final BidiFilter filter;
- private final Object defaultValue;
+ protected final Filter<T> filter;
+ protected final T defaultValue;
// ********** constructors **********
@@ -45,25 +41,25 @@ public class FilteringPropertyValueModel
* Construct a property value model with the specified nested
* property value model and a disabled filter.
* Use this constructor if you want to override the
- * <code>accept(Object)</code> and <code>reverseAccept(Object)</code>
- * methods instead of building a <code>BidiFilter</code>.
+ * <code>accept(Object)</code>
+ * method instead of building a <code>Filter</code>.
* The default value will be <code>null</code>.
*/
- public FilteringPropertyValueModel(PropertyValueModel valueHolder) {
- this(valueHolder, BidiFilter.Disabled.instance(), null);
+ public FilteringPropertyValueModel(PropertyValueModel<? extends T> valueHolder) {
+ this(valueHolder, Filter.Disabled.<T>instance(), null);
}
/**
* Construct a property value model with the specified nested
* property value model, specified default value, and a disabled filter.
* Use this constructor if you want to override the
- * <code>accept(Object)</code> and <code>reverseAccept(Object)</code>
- * methods instead of building a <code>BidiFilter</code>
+ * <code>accept(Object)</code>
+ * method instead of building a <code>Filter</code>
* <em>and</em> you need to specify
* a default value other than <code>null</code>.
*/
- public FilteringPropertyValueModel(PropertyValueModel valueHolder, Object defaultValue) {
- this(valueHolder, BidiFilter.Disabled.instance(), defaultValue);
+ public FilteringPropertyValueModel(PropertyValueModel<? extends T> valueHolder, T defaultValue) {
+ this(valueHolder, Filter.Disabled.<T>instance(), defaultValue);
}
/**
@@ -71,7 +67,7 @@ public class FilteringPropertyValueModel
* property value model and filter.
* The default value will be <code>null</code>.
*/
- public FilteringPropertyValueModel(PropertyValueModel valueHolder, BidiFilter filter) {
+ public FilteringPropertyValueModel(PropertyValueModel<? extends T> valueHolder, Filter<T> filter) {
this(valueHolder, filter, null);
}
@@ -79,26 +75,17 @@ public class FilteringPropertyValueModel
* Construct an property value model with the specified nested
* property value model, filter, and default value.
*/
- public FilteringPropertyValueModel(PropertyValueModel valueHolder, BidiFilter filter, Object defaultValue) {
+ public FilteringPropertyValueModel(PropertyValueModel<? extends T> valueHolder, Filter<T> filter, T defaultValue) {
super(valueHolder);
this.filter = filter;
this.defaultValue = defaultValue;
}
- // ********** ValueModel implementation **********
-
- public Object value() {
- return this.filterValue(this.valueHolder.value());
- }
-
-
// ********** PropertyValueModel implementation **********
- public void setValue(Object value) {
- if (this.reverseAccept(value)) {
- this.valueHolder.setValue(value);
- }
+ public T value() {
+ return this.filterValue(this.valueHolder.value());
}
@@ -107,8 +94,10 @@ public class FilteringPropertyValueModel
@Override
protected void valueChanged(PropertyChangeEvent e) {
// filter the values before propagating the change event
- Object oldValue = this.filterValue(e.oldValue());
- Object newValue = this.filterValue(e.newValue());
+ @SuppressWarnings("unchecked")
+ Object oldValue = this.filterValue((T) e.oldValue());
+ @SuppressWarnings("unchecked")
+ Object newValue = this.filterValue((T) e.newValue());
this.firePropertyChanged(VALUE, oldValue, newValue);
}
@@ -119,7 +108,7 @@ public class FilteringPropertyValueModel
* If the specified value is "accepted" simply return it,
* otherwise return the default value.
*/
- protected Object filterValue(Object value) {
+ protected T filterValue(T value) {
return this.accept(value) ? value : this.defaultValue();
}
@@ -130,31 +119,18 @@ public class FilteringPropertyValueModel
* from the nested property value model
* <p>
* This method can be overridden by a subclass as an
- * alternative to building a <code>BidiFilter</code>.
+ * alternative to building a <code>Filter</code>.
*/
- protected boolean accept(Object value) {
+ protected boolean accept(T value) {
return this.filter.accept(value);
}
/**
- * Return whether the <code>FilteringPropertyValueModel</code>
- * should pass through the specified value to the nested
- * property value model in a call to the
- * <code>setValue(Object)</code> method
- * <p>
- * This method can be overridden by a subclass as an
- * alternative to building a <code>BidiFilter</code>.
- */
- protected boolean reverseAccept(Object value) {
- return this.filter.reverseAccept(value);
- }
-
- /**
* Return the object that should be returned if
* the nested value was rejected by the filter.
* The default is <code>null</code>.
*/
- protected Object defaultValue() {
+ protected T defaultValue() {
return this.defaultValue;
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/FilteringWritablePropertyValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/FilteringWritablePropertyValueModel.java
new file mode 100644
index 0000000000..96ca481ba2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/FilteringWritablePropertyValueModel.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.utility.internal.model.value;
+
+import org.eclipse.jpt.utility.internal.BidiFilter;
+
+/**
+ * A <code>FilteringWritablePropertyValueModel</code> wraps another
+ * <code>WritabelPropertyValueModel</code> and uses a <code>BidiFilter</code>
+ * to determine when the wrapped value is to be returned by calls
+ * to <code>value()</code> and modified by calls to
+ * <code>setValue(Object)</code>.
+ * <p>
+ * As an alternative to building a <code>BidiFilter</code>, a subclass
+ * of <code>FilteringWritablePropertyValueModel</code> can override the
+ * <code>accept(Object)</code> and <code>reverseAccept(Object)</code>
+ * methods.
+ * <p>
+ * One, possibly undesirable, side-effect of using this value model is that
+ * it must return *something* as the value. The default behavior is
+ * to return <code>null</code> whenever the wrapped value is not "accepted",
+ * which can be configured and/or overridden.
+ * <p>
+ * Similarly, if an incoming value is not "reverseAccepted", *nothing* will passed
+ * through to the wrapped value holder, not even <code>null</code>.
+ */
+public class FilteringWritablePropertyValueModel<T>
+ extends FilteringPropertyValueModel<T>
+ implements WritablePropertyValueModel<T>
+{
+
+
+ // ********** constructors **********
+
+ /**
+ * Construct a property value model with the specified nested
+ * property value model and a disabled filter.
+ * Use this constructor if you want to override the
+ * <code>accept(Object)</code> and <code>reverseAccept(Object)</code>
+ * methods instead of building a <code>BidiFilter</code>.
+ * The default value will be <code>null</code>.
+ */
+ public FilteringWritablePropertyValueModel(WritablePropertyValueModel<T> valueHolder) {
+ this(valueHolder, BidiFilter.Disabled.<T>instance(), null);
+ }
+
+ /**
+ * Construct a property value model with the specified nested
+ * property value model, specified default value, and a disabled filter.
+ * Use this constructor if you want to override the
+ * <code>accept(Object)</code> and <code>reverseAccept(Object)</code>
+ * methods instead of building a <code>BidiFilter</code>
+ * <em>and</em> you need to specify
+ * a default value other than <code>null</code>.
+ */
+ public FilteringWritablePropertyValueModel(WritablePropertyValueModel<T> valueHolder, T defaultValue) {
+ this(valueHolder, BidiFilter.Disabled.<T>instance(), defaultValue);
+ }
+
+ /**
+ * Construct an property value model with the specified nested
+ * property value model and filter.
+ * The default value will be <code>null</code>.
+ */
+ public FilteringWritablePropertyValueModel(WritablePropertyValueModel<T> valueHolder, BidiFilter<T> filter) {
+ this(valueHolder, filter, null);
+ }
+
+ /**
+ * Construct an property value model with the specified nested
+ * property value model, filter, and default value.
+ */
+ public FilteringWritablePropertyValueModel(WritablePropertyValueModel<T> valueHolder, BidiFilter<T> filter, T defaultValue) {
+ super(valueHolder, filter, defaultValue);
+ }
+
+
+ // ********** WritablePropertyValueModel implementation **********
+
+ public void setValue(T value) {
+ if (this.reverseAccept(value)) {
+ this.valueHolder().setValue(value);
+ }
+ }
+
+
+ // ********** queries **********
+
+ /**
+ * Return whether the <code>FilteringWritablePropertyValueModel</code>
+ * should pass through the specified value to the nested
+ * writable property value model in a call to the
+ * <code>setValue(Object)</code> method
+ * <p>
+ * This method can be overridden by a subclass as an
+ * alternative to building a <code>BidiFilter</code>.
+ */
+ protected boolean reverseAccept(T value) {
+ return this.filter().reverseAccept(value);
+ }
+
+ /**
+ * Our constructors accept only a WritablePropertyValueModel<T>.
+ */
+ @SuppressWarnings("unchecked")
+ protected WritablePropertyValueModel<T> valueHolder() {
+ return (WritablePropertyValueModel<T>) this.valueHolder;
+ }
+
+ /**
+ * Our constructors accept only a bidirectional filter.
+ */
+ protected BidiFilter<T> filter() {
+ return (BidiFilter<T>) this.filter;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemAspectListValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemAspectListValueModelAdapter.java
index 3cc7ba5768..2460a1d814 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemAspectListValueModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemAspectListValueModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -17,6 +17,7 @@ import java.util.Iterator;
import java.util.ListIterator;
import org.eclipse.jpt.utility.internal.Counter;
+import org.eclipse.jpt.utility.internal.iterators.ReadOnlyListIterator;
import org.eclipse.jpt.utility.internal.model.Model;
import org.eclipse.jpt.utility.internal.model.event.ListChangeEvent;
@@ -32,22 +33,23 @@ import org.eclipse.jpt.utility.internal.model.event.ListChangeEvent;
*
* Subclasses need to override two methods:
*
- * listenToItem(Model)
+ * #listenToItem(Model)
* begin listening to the appropriate aspect of the specified item and call
* #itemAspectChanged(Object) whenever the aspect changes
*
- * stopListeningToItem(Model)
+ * #stopListeningToItem(Model)
* stop listening to the appropriate aspect of the specified item
*/
-public abstract class ItemAspectListValueModelAdapter
- extends ListValueModelWrapper
+public abstract class ItemAspectListValueModelAdapter<E>
+ extends ListValueModelWrapper<E>
+ implements ListValueModel<E>
{
/**
* Maintain a counter for each of the items in the
* wrapped list holder we are listening to.
*/
- protected final IdentityHashMap counters;
+ protected final IdentityHashMap<E, Counter> counters;
// ********** constructors **********
@@ -55,36 +57,37 @@ public abstract class ItemAspectListValueModelAdapter
/**
* Constructor - the list holder is required.
*/
- protected ItemAspectListValueModelAdapter(ListValueModel listHolder) {
+ protected ItemAspectListValueModelAdapter(ListValueModel<? extends E> listHolder) {
super(listHolder);
- this.counters = new IdentityHashMap();
+ this.counters = new IdentityHashMap<E, Counter>();
}
/**
* Constructor - the collection holder is required.
*/
- protected ItemAspectListValueModelAdapter(CollectionValueModel collectionHolder) {
- this(new CollectionListValueModelAdapter(collectionHolder));
+ protected ItemAspectListValueModelAdapter(CollectionValueModel<? extends E> collectionHolder) {
+ this(new CollectionListValueModelAdapter<E>(collectionHolder));
}
// ********** ListValueModel implementation **********
- public ListIterator listIterator() {
- return this.listHolder.listIterator();
+ public Iterator<E> iterator() {
+ return this.listIterator();
}
- @Override
- public Object get(int index) {
+ public ListIterator<E> listIterator() {
+ return new ReadOnlyListIterator<E>(this.listHolder.listIterator());
+ }
+
+ public E get(int index) {
return this.listHolder.get(index);
}
- @Override
public int size() {
return this.listHolder.size();
}
- @Override
public Object[] toArray() {
return this.listHolder.toArray();
}
@@ -105,15 +108,15 @@ public abstract class ItemAspectListValueModelAdapter
this.engageItems(this.listHolder.iterator());
}
- protected void engageItems(Iterator stream) {
+ protected void engageItems(Iterator<? extends E> stream) {
while (stream.hasNext()) {
this.engageItem(stream.next());
}
}
- protected void engageItem(Object item) {
+ protected void engageItem(E item) {
// listen to an item only once
- Counter counter = (Counter) this.counters.get(item);
+ Counter counter = this.counters.get(item);
if (counter == null) {
counter = new Counter();
this.counters.put(item, counter);
@@ -140,15 +143,15 @@ public abstract class ItemAspectListValueModelAdapter
this.disengageItems(this.listHolder.iterator());
}
- protected void disengageItems(Iterator stream) {
+ protected void disengageItems(Iterator<? extends E> stream) {
while (stream.hasNext()) {
this.disengageItem(stream.next());
}
}
- protected void disengageItem(Object item) {
+ protected void disengageItem(E item) {
// stop listening to an item only once
- Counter counter = (Counter) this.counters.get(item);
+ Counter counter = this.counters.get(item);
if (counter == null) {
// something is wrong if this happens... ~bjv
throw new IllegalStateException("missing counter: " + item);
@@ -175,7 +178,7 @@ public abstract class ItemAspectListValueModelAdapter
protected void itemsAdded(ListChangeEvent e) {
// re-fire event with the wrapper as the source
this.fireItemsAdded(e.cloneWithSource(this, LIST_VALUES));
- this.engageItems(e.items());
+ this.engageItems(this.items(e));
}
/**
@@ -184,7 +187,7 @@ public abstract class ItemAspectListValueModelAdapter
*/
@Override
protected void itemsRemoved(ListChangeEvent e) {
- this.disengageItems(e.items());
+ this.disengageItems(this.items(e));
// re-fire event with the wrapper as the source
this.fireItemsRemoved(e.cloneWithSource(this, LIST_VALUES));
}
@@ -196,10 +199,10 @@ public abstract class ItemAspectListValueModelAdapter
*/
@Override
protected void itemsReplaced(ListChangeEvent e) {
- this.disengageItems(e.replacedItems());
+ this.disengageItems(this.replacedItems(e));
// re-fire event with the wrapper as the source
this.fireItemsReplaced(e.cloneWithSource(this, LIST_VALUES));
- this.engageItems(e.items());
+ this.engageItems(this.items(e));
}
/**
@@ -220,7 +223,7 @@ public abstract class ItemAspectListValueModelAdapter
protected void listCleared(ListChangeEvent e) {
// we should only need to disengage each item once...
// make a copy to prevent a ConcurrentModificationException
- Collection keys = new ArrayList(this.counters.keySet());
+ Collection<E> keys = new ArrayList<E>(this.counters.keySet());
this.disengageItems(keys.iterator());
this.counters.clear();
// re-fire event with the wrapper as the source
@@ -235,7 +238,7 @@ public abstract class ItemAspectListValueModelAdapter
protected void listChanged(ListChangeEvent e) {
// we should only need to disengage each item once...
// make a copy to prevent a ConcurrentModificationException
- Collection keys = new ArrayList(this.counters.keySet());
+ Collection<E> keys = new ArrayList<E>(this.counters.keySet());
this.disengageItems(keys.iterator());
this.counters.clear();
// re-fire event with the wrapper as the source
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemCollectionListValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemCollectionListValueModelAdapter.java
index 2c114334e9..6157a6a3e0 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemCollectionListValueModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemCollectionListValueModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -19,8 +19,8 @@ import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener;
* Extend ItemAspectListValueModelAdapter to listen to one or more collection
* aspects of each item in the wrapped list model.
*/
-public class ItemCollectionListValueModelAdapter
- extends ItemAspectListValueModelAdapter
+public class ItemCollectionListValueModelAdapter<E>
+ extends ItemAspectListValueModelAdapter<E>
{
/** The names of the items' collections that we listen to. */
@@ -33,30 +33,9 @@ public class ItemCollectionListValueModelAdapter
// ********** constructors **********
/**
- * Construct an adapter for the specified item Collection.
- */
- public ItemCollectionListValueModelAdapter(ListValueModel listHolder, String collectionName) {
- this(listHolder, new String[] {collectionName});
- }
-
- /**
* Construct an adapter for the specified item Collections.
*/
- public ItemCollectionListValueModelAdapter(ListValueModel listHolder, String collectionName1, String collectionName2) {
- this(listHolder, new String[] {collectionName1, collectionName2});
- }
-
- /**
- * Construct an adapter for the specified item Collections.
- */
- public ItemCollectionListValueModelAdapter(ListValueModel listHolder, String collectionName1, String collectionName2, String collectionName3) {
- this(listHolder, new String[] {collectionName1, collectionName2, collectionName3});
- }
-
- /**
- * Construct an adapter for the specified item Collections.
- */
- public ItemCollectionListValueModelAdapter(ListValueModel listHolder, String[] collectionNames) {
+ public ItemCollectionListValueModelAdapter(ListValueModel<E> listHolder, String... collectionNames) {
super(listHolder);
this.collectionNames = collectionNames;
this.itemCollectionListener = this.buildItemCollectionListener();
@@ -65,29 +44,8 @@ public class ItemCollectionListValueModelAdapter
/**
* Construct an adapter for the specified item Collections.
*/
- public ItemCollectionListValueModelAdapter(CollectionValueModel collectionHolder, String collectionName) {
- this(collectionHolder, new String[] {collectionName});
- }
-
- /**
- * Construct an adapter for the specified item Collections.
- */
- public ItemCollectionListValueModelAdapter(CollectionValueModel collectionHolder, String collectionName1, String collectionName2) {
- this(collectionHolder, new String[] {collectionName1, collectionName2});
- }
-
- /**
- * Construct an adapter for the specified item Collections.
- */
- public ItemCollectionListValueModelAdapter(CollectionValueModel collectionHolder, String collectionName1, String collectionName2, String collectionName3) {
- this(collectionHolder, new String[] {collectionName1, collectionName2, collectionName3});
- }
-
- /**
- * Construct an adapter for the specified item Collections.
- */
- public ItemCollectionListValueModelAdapter(CollectionValueModel collectionHolder, String[] collectionNames) {
- this(new CollectionListValueModelAdapter(collectionHolder), collectionNames);
+ public ItemCollectionListValueModelAdapter(CollectionValueModel<E> collectionHolder, String... collectionNames) {
+ this(new CollectionListValueModelAdapter<E>(collectionHolder), collectionNames);
}
@@ -123,15 +81,15 @@ public class ItemCollectionListValueModelAdapter
@Override
protected void startListeningToItem(Model item) {
- for (int i = this.collectionNames.length; i-- > 0; ) {
- item.addCollectionChangeListener(this.collectionNames[i], this.itemCollectionListener);
+ for (String collectionName : this.collectionNames) {
+ item.addCollectionChangeListener(collectionName, this.itemCollectionListener);
}
}
@Override
protected void stopListeningToItem(Model item) {
- for (int i = this.collectionNames.length; i-- > 0; ) {
- item.removeCollectionChangeListener(this.collectionNames[i], this.itemCollectionListener);
+ for (String collectionName : this.collectionNames) {
+ item.removeCollectionChangeListener(collectionName, this.itemCollectionListener);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemListListValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemListListValueModelAdapter.java
index d743f54982..e6174055bd 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemListListValueModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemListListValueModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -19,8 +19,8 @@ import org.eclipse.jpt.utility.internal.model.listener.ListChangeListener;
* Extend ItemAspectListValueModelAdapter to listen to one or more list
* aspects of each item in the wrapped list model.
*/
-public class ItemListListValueModelAdapter
- extends ItemAspectListValueModelAdapter
+public class ItemListListValueModelAdapter<E>
+ extends ItemAspectListValueModelAdapter<E>
{
/** The names of the subject's lists that we listen to. */
@@ -33,61 +33,19 @@ public class ItemListListValueModelAdapter
// ********** constructors **********
/**
- * Construct an adapter for the specified item List aspect.
- */
- public ItemListListValueModelAdapter(ListValueModel listHolder, String listName) {
- this(listHolder, new String[] {listName});
- }
-
- /**
- * Construct an adapter for the specified item List aspects.
- */
- public ItemListListValueModelAdapter(ListValueModel listHolder, String listName1, String listName2) {
- this(listHolder, new String[] {listName1, listName2});
- }
-
- /**
- * Construct an adapter for the specified item List aspects.
- */
- public ItemListListValueModelAdapter(ListValueModel listHolder, String listName1, String listName2, String listName3) {
- this(listHolder, new String[] {listName1, listName2, listName3});
- }
-
- /**
* Construct an adapter for the specified item List aspects.
*/
- public ItemListListValueModelAdapter(ListValueModel listHolder, String[] listNames) {
+ public ItemListListValueModelAdapter(ListValueModel<E> listHolder, String... listNames) {
super(listHolder);
this.listNames = listNames;
this.itemListListener = this.buildItemListListener();
}
/**
- * Construct an adapter for the specified item List aspect.
- */
- public ItemListListValueModelAdapter(CollectionValueModel collectionHolder, String listName) {
- this(collectionHolder, new String[] {listName});
- }
-
- /**
- * Construct an adapter for the specified item List aspects.
- */
- public ItemListListValueModelAdapter(CollectionValueModel collectionHolder, String listName1, String listName2) {
- this(collectionHolder, new String[] {listName1, listName2});
- }
-
- /**
- * Construct an adapter for the specified item List aspects.
- */
- public ItemListListValueModelAdapter(CollectionValueModel collectionHolder, String listName1, String listName2, String listName3) {
- this(collectionHolder, new String[] {listName1, listName2, listName3});
- }
-
- /**
* Construct an adapter for the specified item List aspects.
*/
- public ItemListListValueModelAdapter(CollectionValueModel collectionHolder, String[] listNames) {
- this(new CollectionListValueModelAdapter(collectionHolder), listNames);
+ public ItemListListValueModelAdapter(CollectionValueModel<E> collectionHolder, String... listNames) {
+ this(new CollectionListValueModelAdapter<E>(collectionHolder), listNames);
}
@@ -129,15 +87,15 @@ public class ItemListListValueModelAdapter
@Override
protected void startListeningToItem(Model item) {
- for (int i = this.listNames.length; i-- > 0; ) {
- item.addListChangeListener(this.listNames[i], this.itemListListener);
+ for (String listName : this.listNames) {
+ item.addListChangeListener(listName, this.itemListListener);
}
}
@Override
protected void stopListeningToItem(Model item) {
- for (int i = this.listNames.length; i-- > 0; ) {
- item.removeListChangeListener(this.listNames[i], this.itemListListener);
+ for (String listName : this.listNames) {
+ item.removeListChangeListener(listName, this.itemListListener);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemPropertyListValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemPropertyListValueModelAdapter.java
index 0a19623f30..9ec52ca98d 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemPropertyListValueModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemPropertyListValueModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -19,8 +19,8 @@ import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
* Extend ItemAspectListValueModelAdapter to listen to one or more
* properties of each item in the wrapped list model.
*/
-public class ItemPropertyListValueModelAdapter
- extends ItemAspectListValueModelAdapter
+public class ItemPropertyListValueModelAdapter<E>
+ extends ItemAspectListValueModelAdapter<E>
{
/** The names of the items' properties that we listen to. */
@@ -33,61 +33,19 @@ public class ItemPropertyListValueModelAdapter
// ********** constructors **********
/**
- * Construct an adapter for the specified item property.
- */
- public ItemPropertyListValueModelAdapter(ListValueModel listHolder, String propertyName) {
- this(listHolder, new String[] {propertyName});
- }
-
- /**
- * Construct an adapter for the specified item properties.
- */
- public ItemPropertyListValueModelAdapter(ListValueModel listHolder, String propertyName1, String propertyName2) {
- this(listHolder, new String[] {propertyName1, propertyName2});
- }
-
- /**
- * Construct an adapter for the specified item properties.
- */
- public ItemPropertyListValueModelAdapter(ListValueModel listHolder, String propertyName1, String propertyName2, String propertyName3) {
- this(listHolder, new String[] {propertyName1, propertyName2, propertyName3});
- }
-
- /**
* Construct an adapter for the specified item properties.
*/
- public ItemPropertyListValueModelAdapter(ListValueModel listHolder, String[] propertyNames) {
+ public ItemPropertyListValueModelAdapter(ListValueModel<E> listHolder, String... propertyNames) {
super(listHolder);
this.propertyNames = propertyNames;
this.itemPropertyListener = this.buildItemPropertyListener();
}
/**
- * Construct an adapter for the specified item property.
- */
- public ItemPropertyListValueModelAdapter(CollectionValueModel collectionHolder, String propertyName) {
- this(collectionHolder, new String[] {propertyName});
- }
-
- /**
- * Construct an adapter for the specified item properties.
- */
- public ItemPropertyListValueModelAdapter(CollectionValueModel collectionHolder, String propertyName1, String propertyName2) {
- this(collectionHolder, new String[] {propertyName1, propertyName2});
- }
-
- /**
- * Construct an adapter for the specified item properties.
- */
- public ItemPropertyListValueModelAdapter(CollectionValueModel collectionHolder, String propertyName1, String propertyName2, String propertyName3) {
- this(collectionHolder, new String[] {propertyName1, propertyName2, propertyName3});
- }
-
- /**
* Construct an adapter for the specified item properties.
*/
- public ItemPropertyListValueModelAdapter(CollectionValueModel collectionHolder, String[] propertyNames) {
- this(new CollectionListValueModelAdapter(collectionHolder), propertyNames);
+ public ItemPropertyListValueModelAdapter(CollectionValueModel<E> collectionHolder, String... propertyNames) {
+ this(new CollectionListValueModelAdapter<E>(collectionHolder), propertyNames);
}
@@ -110,15 +68,15 @@ public class ItemPropertyListValueModelAdapter
@Override
protected void startListeningToItem(Model item) {
- for (int i = this.propertyNames.length; i-- > 0; ) {
- item.addPropertyChangeListener(this.propertyNames[i], this.itemPropertyListener);
+ for (String propertyName : this.propertyNames) {
+ item.addPropertyChangeListener(propertyName, this.itemPropertyListener);
}
}
@Override
protected void stopListeningToItem(Model item) {
- for (int i = this.propertyNames.length; i-- > 0; ) {
- item.removePropertyChangeListener(this.propertyNames[i], this.itemPropertyListener);
+ for (String propertyName : this.propertyNames) {
+ item.removePropertyChangeListener(propertyName, this.itemPropertyListener);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemStateListValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemStateListValueModelAdapter.java
index 9548fbb37e..50c1a52c46 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemStateListValueModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemStateListValueModelAdapter.java
@@ -17,8 +17,8 @@ import org.eclipse.jpt.utility.internal.model.listener.StateChangeListener;
* Extend ItemAspectListValueModelAdapter to listen to the
* "state" of each item in the wrapped list model.
*/
-public class ItemStateListValueModelAdapter
- extends ItemAspectListValueModelAdapter
+public class ItemStateListValueModelAdapter<E>
+ extends ItemAspectListValueModelAdapter<E>
{
/** Listener that listens to all the items in the list. */
protected final StateChangeListener itemStateListener;
@@ -29,7 +29,7 @@ public class ItemStateListValueModelAdapter
/**
* Construct an adapter for the item state.
*/
- public ItemStateListValueModelAdapter(ListValueModel listHolder) {
+ public ItemStateListValueModelAdapter(ListValueModel<E> listHolder) {
super(listHolder);
this.itemStateListener = this.buildItemStateListener();
}
@@ -37,8 +37,8 @@ public class ItemStateListValueModelAdapter
/**
* Construct an adapter for the item state.
*/
- public ItemStateListValueModelAdapter(CollectionValueModel collectionHolder) {
- this(new CollectionListValueModelAdapter(collectionHolder));
+ public ItemStateListValueModelAdapter(CollectionValueModel<E> collectionHolder) {
+ this(new CollectionListValueModelAdapter<E>(collectionHolder));
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemTreeListValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemTreeListValueModelAdapter.java
new file mode 100644
index 0000000000..86ec2f5b89
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ItemTreeListValueModelAdapter.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.utility.internal.model.value;
+
+import java.util.Arrays;
+
+import org.eclipse.jpt.utility.internal.model.Model;
+import org.eclipse.jpt.utility.internal.model.event.TreeChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.TreeChangeListener;
+
+/**
+ * Extend ItemAspectListValueModelAdapter to listen to one or more tree
+ * aspects of each item in the wrapped list model.
+ */
+public class ItemTreeListValueModelAdapter<E>
+ extends ItemAspectListValueModelAdapter<E>
+{
+
+ /** The names of the items' tree that we listen to. */
+ protected final String[] treeNames;
+
+ /** Listener that listens to all the items in the list. */
+ protected final TreeChangeListener itemTreeListener;
+
+
+ // ********** constructors **********
+
+ /**
+ * Construct an adapter for the specified item trees.
+ */
+ public ItemTreeListValueModelAdapter(ListValueModel<E> listHolder, String... treeNames) {
+ super(listHolder);
+ this.treeNames = treeNames;
+ this.itemTreeListener = this.buildItemTreeListener();
+ }
+
+ /**
+ * Construct an adapter for the specified item trees.
+ */
+ public ItemTreeListValueModelAdapter(CollectionValueModel<E> collectionHolder, String... treeNames) {
+ this(new CollectionListValueModelAdapter<E>(collectionHolder), treeNames);
+ }
+
+
+ // ********** initialization **********
+
+ /**
+ * All we really care about is the fact that a tree aspect has
+ * changed. Do the same thing no matter which event occurs.
+ */
+ protected TreeChangeListener buildItemTreeListener() {
+ return new TreeChangeListener() {
+ public void nodeAdded(TreeChangeEvent e) {
+ ItemTreeListValueModelAdapter.this.itemAspectChanged(e);
+ }
+ public void nodeRemoved(TreeChangeEvent e) {
+ ItemTreeListValueModelAdapter.this.itemAspectChanged(e);
+ }
+ public void treeCleared(TreeChangeEvent e) {
+ ItemTreeListValueModelAdapter.this.itemAspectChanged(e);
+ }
+ public void treeChanged(TreeChangeEvent e) {
+ ItemTreeListValueModelAdapter.this.itemAspectChanged(e);
+ }
+ @Override
+ public String toString() {
+ return "item tree listener: " + Arrays.asList(ItemTreeListValueModelAdapter.this.treeNames);
+ }
+ };
+ }
+
+
+ // ********** behavior **********
+
+ @Override
+ protected void startListeningToItem(Model item) {
+ for (String treeName : this.treeNames) {
+ item.addTreeChangeListener(treeName, this.itemTreeListener);
+ }
+ }
+
+ @Override
+ protected void stopListeningToItem(Model item) {
+ for (String treeName : this.treeNames) {
+ item.removeTreeChangeListener(treeName, this.itemTreeListener);
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListAspectAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListAspectAdapter.java
index 3d4981bf85..fc94f933cb 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListAspectAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListAspectAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.model.value;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.Iterator;
import java.util.ListIterator;
@@ -21,6 +23,8 @@ import org.eclipse.jpt.utility.internal.model.listener.ListChangeListener;
/**
* This extension of AspectAdapter provides ListChange support.
+ * This allows us to convert a set of one or more collections into
+ * a single collection, LIST_VALUES.
*
* The typical subclass will override the following methods:
* #listIterator_()
@@ -39,14 +43,15 @@ import org.eclipse.jpt.utility.internal.model.listener.ListChangeListener;
* override this method only if returning a zero when the
* subject is null is unacceptable
*/
-public abstract class ListAspectAdapter
- extends AspectAdapter
- implements ListValueModel
+public abstract class ListAspectAdapter<S extends Model, E>
+ extends AspectAdapter<S>
+ implements ListValueModel<E>
{
/**
- * The name of the subject's list that we use for the value.
+ * The name of the subject's lists that we use for the value.
*/
- protected final String listName;
+ protected final String[] listNames;
+ protected static final String[] EMPTY_LIST_NAMES = new String[0];
/** A listener that listens to the subject's list aspect. */
protected final ListChangeListener listChangeListener;
@@ -60,30 +65,46 @@ public abstract class ListAspectAdapter
* Construct a ListAspectAdapter for the specified subject
* and list.
*/
- protected ListAspectAdapter(String listName, Model subject) {
- this(new ReadOnlyPropertyValueModel(subject), listName);
+ protected ListAspectAdapter(String listName, S subject) {
+ this(new String[] {listName}, subject);
}
/**
- * Construct a ListAspectAdapter for an "unchanging" list in
- * the specified subject. This is useful for a list aspect that does not
- * change for a particular subject; but the subject will change, resulting in
- * a new list.
+ * Construct a ListAspectAdapter for the specified subject
+ * and lists.
*/
- protected ListAspectAdapter(ValueModel subjectHolder) {
- this(subjectHolder, null);
+ protected ListAspectAdapter(String[] listNames, S subject) {
+ this(new StaticPropertyValueModel<S>(subject), listNames);
}
/**
* Construct a ListAspectAdapter for the specified subject holder
- * and list.
+ * and lists.
*/
- protected ListAspectAdapter(ValueModel subjectHolder, String listName) {
+ protected ListAspectAdapter(PropertyValueModel<? extends S> subjectHolder, String... listNames) {
super(subjectHolder);
- this.listName = listName;
+ this.listNames = listNames;
this.listChangeListener = this.buildListChangeListener();
}
+ /**
+ * Construct a ListAspectAdapter for the specified subject holder
+ * and lists.
+ */
+ protected ListAspectAdapter(PropertyValueModel<? extends S> subjectHolder, Collection<String> listNames) {
+ this(subjectHolder, listNames.toArray(new String[listNames.size()]));
+ }
+
+ /**
+ * Construct a ListAspectAdapter for an "unchanging" list in
+ * the specified subject. This is useful for a list aspect that does not
+ * change for a particular subject; but the subject will change, resulting in
+ * a new list.
+ */
+ protected ListAspectAdapter(PropertyValueModel<? extends S> subjectHolder) {
+ this(subjectHolder, EMPTY_LIST_NAMES);
+ }
+
// ********** initialization **********
@@ -113,7 +134,7 @@ public abstract class ListAspectAdapter
}
@Override
public String toString() {
- return "list change listener: " + ListAspectAdapter.this.listName;
+ return "list change listener: " + Arrays.asList(ListAspectAdapter.this.listNames);
}
};
}
@@ -124,15 +145,15 @@ public abstract class ListAspectAdapter
/**
* Return the elements of the subject's list aspect.
*/
- public Iterator iterator() {
+ public Iterator<E> iterator() {
return this.listIterator();
}
/**
* Return the elements of the subject's list aspect.
*/
- public ListIterator listIterator() {
- return (this.subject == null) ? EmptyListIterator.instance() : this.listIterator_();
+ public ListIterator<E> listIterator() {
+ return (this.subject == null) ? EmptyListIterator.<E>instance() : this.listIterator_();
}
/**
@@ -140,14 +161,14 @@ public abstract class ListAspectAdapter
* At this point we can be sure that the subject is not null.
* @see #listIterator()
*/
- protected ListIterator listIterator_() {
+ protected ListIterator<E> listIterator_() {
throw new UnsupportedOperationException();
}
/**
* Return the element at the specified index of the subject's list aspect.
*/
- public Object get(int index) {
+ public E get(int index) {
return CollectionTools.get(this.listIterator(), index);
}
@@ -212,22 +233,27 @@ public abstract class ListAspectAdapter
}
@Override
- protected void engageNonNullSubject() {
- if (this.listName != null) {
- ((Model) this.subject).addListChangeListener(this.listName, this.listChangeListener);
+ protected void engageSubject_() {
+ for (String listName : this.listNames) {
+ ((Model) this.subject).addListChangeListener(listName, this.listChangeListener);
}
}
@Override
- protected void disengageNonNullSubject() {
- if (this.listName != null) {
- ((Model) this.subject).removeListChangeListener(this.listName, this.listChangeListener);
+ protected void disengageSubject_() {
+ for (String listName : this.listNames) {
+ ((Model) this.subject).removeListChangeListener(listName, this.listChangeListener);
}
}
@Override
public void toString(StringBuilder sb) {
- sb.append(this.listName);
+ for (int i = 0; i < this.listNames.length; i++) {
+ if (i != 0) {
+ sb.append(", ");
+ }
+ sb.append(this.listNames[i]);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListCollectionValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListCollectionValueModelAdapter.java
index 0492a43f1c..42eab093f3 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListCollectionValueModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListCollectionValueModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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,8 +10,8 @@
package org.eclipse.jpt.utility.internal.model.value;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Iterator;
+import java.util.ListIterator;
import org.eclipse.jpt.utility.internal.iterators.ReadOnlyIterator;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
@@ -34,12 +34,12 @@ import org.eclipse.jpt.utility.internal.model.listener.ListChangeListener;
* we do not have any listeners. This should not be too painful since,
* most likely, client objects will also be listeners.
*/
-public class ListCollectionValueModelAdapter
+public class ListCollectionValueModelAdapter<E>
extends AbstractModel
- implements CollectionValueModel
+ implements CollectionValueModel<E>
{
/** The wrapped list value model. */
- protected final ListValueModel listHolder;
+ protected final ListValueModel<? extends E> listHolder;
/** A listener that forwards any events fired by the list holder. */
protected final ListChangeListener listChangeListener;
@@ -49,7 +49,7 @@ public class ListCollectionValueModelAdapter
* the wrapped list.
*/
// we declare this an ArrayList so we can use #clone() and #ensureCapacity(int)
- protected final ArrayList collection;
+ protected final ArrayList<E> collection;
// ********** constructors/initialization **********
@@ -57,14 +57,14 @@ public class ListCollectionValueModelAdapter
/**
* Wrap the specified ListValueModel.
*/
- public ListCollectionValueModelAdapter(ListValueModel listHolder) {
+ public ListCollectionValueModelAdapter(ListValueModel<? extends E> listHolder) {
super();
if (listHolder == null) {
throw new NullPointerException();
}
this.listHolder = listHolder;
this.listChangeListener = this.buildListChangeListener();
- this.collection = new ArrayList();
+ this.collection = new ArrayList<E>();
// postpone building the collection and listening to the underlying list
// until we have listeners ourselves...
}
@@ -108,9 +108,9 @@ public class ListCollectionValueModelAdapter
// ********** CollectionValueModel implementation **********
- public Iterator iterator() {
+ public Iterator<E> iterator() {
// try to prevent backdoor modification of the list
- return new ReadOnlyIterator(this.collection);
+ return new ReadOnlyIterator<E>(this.collection);
}
public int size() {
@@ -200,7 +200,7 @@ public class ListCollectionValueModelAdapter
// ********** behavior **********
protected void buildCollection() {
- Iterator stream = this.listHolder.iterator();
+ Iterator<? extends E> stream = this.listHolder.iterator();
// if the new list is empty, do nothing
if (stream.hasNext()) {
this.collection.ensureCapacity(this.listHolder.size());
@@ -223,11 +223,23 @@ public class ListCollectionValueModelAdapter
this.collection.clear();
}
+ // minimize suppressed warnings
+ @SuppressWarnings("unchecked")
+ protected ListIterator<E> items(ListChangeEvent e) {
+ return (ListIterator<E>) e.items();
+ }
+
+ // minimize suppressed warnings
+ @SuppressWarnings("unchecked")
+ protected ListIterator<E> replacedItems(ListChangeEvent e) {
+ return (ListIterator<E>) e.replacedItems();
+ }
+
protected void itemsAdded(ListChangeEvent e) {
- this.addItemsToCollection(e.items(), this.collection, VALUES);
+ this.addItemsToCollection(this.items(e), this.collection, VALUES);
}
- protected void removeInternalItems(Iterator items) {
+ protected void removeInternalItems(Iterator<E> items) {
// we have to remove the items individually,
// since they are probably not in sequence
while (items.hasNext()) {
@@ -239,12 +251,12 @@ public class ListCollectionValueModelAdapter
}
protected void itemsRemoved(ListChangeEvent e) {
- this.removeInternalItems(e.items());
+ this.removeInternalItems(this.items(e));
}
protected void itemsReplaced(ListChangeEvent e) {
- this.removeInternalItems(e.replacedItems());
- this.addItemsToCollection(e.items(), this.collection, VALUES);
+ this.removeInternalItems(this.replacedItems(e));
+ this.addItemsToCollection(this.items(e), this.collection, VALUES);
}
protected void itemsMoved(ListChangeEvent e) {
@@ -266,7 +278,8 @@ public class ListCollectionValueModelAdapter
protected void listChanged(ListChangeEvent e) {
// put in empty check so we don't fire events unnecessarily
if ( ! this.collection.isEmpty()) {
- ArrayList removedItems = (ArrayList) this.collection.clone();
+ @SuppressWarnings("unchecked")
+ ArrayList<E> removedItems = (ArrayList<E>) this.collection.clone();
this.collection.clear();
this.fireItemsRemoved(VALUES, removedItems);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListCurator.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListCurator.java
index 0b6d6d2567..900b5d5635 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListCurator.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListCurator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -27,12 +27,12 @@ import org.eclipse.jpt.utility.internal.model.listener.StateChangeListener;
* by adapting a subject's state change events to a minimum set
* of list change events.
*/
-public abstract class ListCurator
- extends AspectAdapter
- implements ListValueModel
+public abstract class ListCurator<S extends Model, E>
+ extends AspectAdapter<S>
+ implements ListValueModel<E>
{
/** How the list looked before the last state change */
- private final ArrayList record;
+ private final ArrayList<E> record;
/** A listener that listens for the subject's state to change */
private final StateChangeListener stateChangeListener;
@@ -43,17 +43,17 @@ public abstract class ListCurator
/**
* Construct a Curator for the specified subject.
*/
- protected ListCurator(Model subject) {
- this(new ReadOnlyPropertyValueModel(subject));
+ protected ListCurator(S subject) {
+ this(new StaticPropertyValueModel<S>(subject));
}
/**
* Construct a curator for the specified subject holder.
* The subject holder cannot be null.
*/
- protected ListCurator(ValueModel subjectHolder) {
+ protected ListCurator(PropertyValueModel<? extends S> subjectHolder) {
super(subjectHolder);
- this.record = new ArrayList();
+ this.record = new ArrayList<E>();
this.stateChangeListener = this.buildStateChangeListener();
}
@@ -78,18 +78,18 @@ public abstract class ListCurator
// ********** ListValueModel implementation **********
- public Iterator iterator() {
+ public Iterator<E> iterator() {
return this.listIterator();
}
- public ListIterator listIterator() {
- return new ReadOnlyListIterator(this.record);
+ public ListIterator<E> listIterator() {
+ return new ReadOnlyListIterator<E>(this.record);
}
/**
* Return the item at the specified index of the subject's list aspect.
*/
- public Object get(int index) {
+ public E get(int index) {
return this.record.get(index);
}
@@ -142,7 +142,7 @@ public abstract class ListCurator
* The subject is not null - add our listener.
*/
@Override
- protected void engageNonNullSubject() {
+ protected void engageSubject_() {
((Model) this.subject).addStateChangeListener(this.stateChangeListener);
// synch our list *after* we start listening to the subject,
// since its value might change when a listener is added
@@ -153,7 +153,7 @@ public abstract class ListCurator
* The subject is not null - remove our listener.
*/
@Override
- protected void disengageNonNullSubject() {
+ protected void disengageSubject_() {
((Model) this.subject).removeStateChangeListener(this.stateChangeListener);
// clear out the list when we are not listening to the subject
this.record.clear();
@@ -167,24 +167,24 @@ public abstract class ListCurator
* It is intended to be used only when the subject changes or the
* subject's "state" changes (as signified by a state change event).
*/
- protected abstract Iterator iteratorForRecord();
+ protected abstract Iterator<E> iteratorForRecord();
// ********** behavior **********
void submitInventoryReport() {
- List newRecord = CollectionTools.list(this.iteratorForRecord());
+ List<E> newRecord = CollectionTools.list(this.iteratorForRecord());
int recordIndex = 0;
// add items from the new record
- for (Object newItem : newRecord) {
+ for (E newItem : newRecord) {
this.inventoryNewItem(recordIndex, newItem);
recordIndex++;
}
// clean out items that are no longer in the new record
for (recordIndex = 0; recordIndex < this.record.size(); ) {
- Object item = this.record.get(recordIndex);
+ E item = this.record.get(recordIndex);
if (newRecord.contains(item)) {
recordIndex++;
@@ -194,8 +194,8 @@ public abstract class ListCurator
}
}
- private void inventoryNewItem(int recordIndex, Object newItem) {
- List rec = new ArrayList(this.record);
+ private void inventoryNewItem(int recordIndex, E newItem) {
+ List<E> rec = new ArrayList<E>(this.record);
if ((recordIndex < rec.size()) && rec.get(recordIndex).equals(newItem)) {
return;
@@ -208,11 +208,11 @@ public abstract class ListCurator
}
}
- private void addItemToInventory(int index, Object item) {
+ private void addItemToInventory(int index, E item) {
this.addItemToList(index, item, this.record, LIST_VALUES);
}
- private void removeItemFromInventory(int index, Object item) {
+ private void removeItemFromInventory(int index, E item) {
this.removeItemFromList(index, this.record, LIST_VALUES);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListPropertyValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListPropertyValueModelAdapter.java
new file mode 100644
index 0000000000..5d7d4ccc1b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListPropertyValueModelAdapter.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.utility.internal.model.value;
+
+import org.eclipse.jpt.utility.internal.model.event.ListChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.ListChangeListener;
+
+/**
+ * This abstract class provides the infrastructure needed to wrap
+ * a list value model, "lazily" listen to it, and convert
+ * its change notifications into property value model change
+ * notifications.
+ *
+ * Subclasses must override:
+ * - #buildValue()
+ * to return the current property value, as derived from the
+ * current list value
+ *
+ * Subclasses might want to override:
+ * - #itemsAdded(ListChangeEvent e)
+ * - #itemsRemoved(ListChangeEvent e)
+ * - #itemsReplaced(ListChangeEvent e)
+ * - #itemsMoved(ListChangeEvent e)
+ * - #listCleared(ListChangeEvent e)
+ * - #listChanged(ListChangeEvent e)
+ * to improve performance (by not recalculating the value, if possible)
+ */
+public abstract class ListPropertyValueModelAdapter<T>
+ extends AspectPropertyValueModelAdapter<T>
+{
+ /** The wrapped list value model. */
+ protected final ListValueModel<?> listHolder;
+
+ /** A listener that allows us to synch with changes to the wrapped list holder. */
+ protected final ListChangeListener listChangeListener;
+
+
+ // ********** constructor/initialization **********
+
+ /**
+ * Construct a property value model with the specified wrapped
+ * list value model.
+ */
+ protected ListPropertyValueModelAdapter(ListValueModel<?> listHolder) {
+ super();
+ this.listHolder = listHolder;
+ this.listChangeListener = this.buildListChangeListener();
+ }
+
+ protected ListChangeListener buildListChangeListener() {
+ return new ListChangeListener() {
+ public void itemsAdded(ListChangeEvent e) {
+ ListPropertyValueModelAdapter.this.itemsAdded(e);
+ }
+ public void itemsRemoved(ListChangeEvent e) {
+ ListPropertyValueModelAdapter.this.itemsRemoved(e);
+ }
+ public void itemsReplaced(ListChangeEvent e) {
+ ListPropertyValueModelAdapter.this.itemsReplaced(e);
+ }
+ public void itemsMoved(ListChangeEvent e) {
+ ListPropertyValueModelAdapter.this.itemsMoved(e);
+ }
+ public void listCleared(ListChangeEvent e) {
+ ListPropertyValueModelAdapter.this.listCleared(e);
+ }
+ public void listChanged(ListChangeEvent e) {
+ ListPropertyValueModelAdapter.this.listChanged(e);
+ }
+ @Override
+ public String toString() {
+ return "list change listener";
+ }
+ };
+ }
+
+
+ // ********** behavior **********
+
+ /**
+ * Start listening to the list holder.
+ */
+ @Override
+ protected void engageModel_() {
+ this.listHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener);
+ }
+
+ /**
+ * Stop listening to the list holder.
+ */
+ @Override
+ protected void disengageModel_() {
+ this.listHolder.removeListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.listHolder);
+ }
+
+
+ // ********** collection change support **********
+
+ /**
+ * Items were added to the wrapped list holder;
+ * propagate the change notification appropriately.
+ */
+ protected void itemsAdded(ListChangeEvent e) {
+ // by default, simply recalculate the value and fire an event
+ this.propertyChanged();
+ }
+
+ /**
+ * Items were removed from the wrapped list holder;
+ * propagate the change notification appropriately.
+ */
+ protected void itemsRemoved(ListChangeEvent e) {
+ // by default, simply recalculate the value and fire an event
+ this.propertyChanged();
+ }
+
+ /**
+ * Items were replaced in the wrapped list holder;
+ * propagate the change notification appropriately.
+ */
+ protected void itemsReplaced(ListChangeEvent e) {
+ // by default, simply recalculate the value and fire an event
+ this.propertyChanged();
+ }
+
+ /**
+ * Items were moved in the wrapped list holder;
+ * propagate the change notification appropriately.
+ */
+ protected void itemsMoved(ListChangeEvent e) {
+ // by default, simply recalculate the value and fire an event
+ this.propertyChanged();
+ }
+
+ /**
+ * The wrapped list holder was cleared;
+ * propagate the change notification appropriately.
+ */
+ protected void listCleared(ListChangeEvent e) {
+ // by default, simply recalculate the value and fire an event
+ this.propertyChanged();
+ }
+
+ /**
+ * The value of the wrapped list holder has changed;
+ * propagate the change notification appropriately.
+ */
+ protected void listChanged(ListChangeEvent e) {
+ // by default, simply recalculate the value and fire an event
+ this.propertyChanged();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListValueModel.java
index d432922aa8..33fda0c2be 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -18,19 +18,19 @@ import org.eclipse.jpt.utility.internal.model.Model;
* Interface used to abstract list accessing and
* change notification and make it more pluggable.
*/
-public interface ListValueModel
- extends Model//, Iterable<E>
+public interface ListValueModel<E>
+ extends Model, Iterable<E>
{
/**
* Return the list's values.
*/
- Iterator iterator();
+ Iterator<E> iterator();
String LIST_VALUES = "list values";
/**
* Return the list's values.
*/
- ListIterator listIterator();
+ ListIterator<E> listIterator();
/**
* Return the size of the list.
@@ -40,7 +40,7 @@ public interface ListValueModel
/**
* Return the item at the specified index of the list.
*/
- Object get(int index);
+ E get(int index);
/**
* Return the list's values.
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListValueModelWrapper.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListValueModelWrapper.java
index f97920c3db..3c09087e12 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListValueModelWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ListValueModelWrapper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,9 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.model.value;
-import java.util.Iterator;
+import java.util.ListIterator;
-import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
import org.eclipse.jpt.utility.internal.model.ChangeSupport;
import org.eclipse.jpt.utility.internal.model.SingleAspectChangeSupport;
@@ -23,13 +22,12 @@ import org.eclipse.jpt.utility.internal.model.listener.ListChangeListener;
* another list value model, "lazily" listen to it, and propagate
* its change notifications.
*/
-public abstract class ListValueModelWrapper
+public abstract class ListValueModelWrapper<E>
extends AbstractModel
- implements ListValueModel
{
/** The wrapped list value model. */
- protected final ListValueModel listHolder;
+ protected final ListValueModel<? extends E> listHolder;
/** A listener that allows us to synch with changes to the wrapped list holder. */
protected final ListChangeListener listChangeListener;
@@ -41,7 +39,7 @@ public abstract class ListValueModelWrapper
* Construct a list value model with the specified wrapped
* list value model.
*/
- protected ListValueModelWrapper(ListValueModel listHolder) {
+ protected ListValueModelWrapper(ListValueModel<? extends E> listHolder) {
super();
if (listHolder == null) {
throw new NullPointerException();
@@ -55,7 +53,7 @@ public abstract class ListValueModelWrapper
@Override
protected ChangeSupport buildChangeSupport() {
- return new SingleAspectChangeSupport(this, ListChangeListener.class, LIST_VALUES);
+ return new SingleAspectChangeSupport(this, ListChangeListener.class, ListValueModel.LIST_VALUES);
}
protected ListChangeListener buildListChangeListener() {
@@ -86,25 +84,6 @@ public abstract class ListValueModelWrapper
}
- // ********** ListValueModel implementation **********
-
- public Iterator iterator() {
- return this.listIterator();
- }
-
- public Object get(int index) {
- return CollectionTools.get(this.listIterator(), index);
- }
-
- public int size() {
- return CollectionTools.size(this.listIterator());
- }
-
- public Object[] toArray() {
- return CollectionTools.array(this.listIterator());
- }
-
-
// ********** extend change support **********
/**
@@ -112,7 +91,7 @@ public abstract class ListValueModelWrapper
*/
@Override
public synchronized void addListChangeListener(ListChangeListener listener) {
- if (this.hasNoListChangeListeners(LIST_VALUES)) {
+ if (this.hasNoListChangeListeners(ListValueModel.LIST_VALUES)) {
this.engageModel();
}
super.addListChangeListener(listener);
@@ -123,7 +102,7 @@ public abstract class ListValueModelWrapper
*/
@Override
public synchronized void addListChangeListener(String listName, ListChangeListener listener) {
- if (listName == LIST_VALUES && this.hasNoListChangeListeners(LIST_VALUES)) {
+ if (listName == ListValueModel.LIST_VALUES && this.hasNoListChangeListeners(ListValueModel.LIST_VALUES)) {
this.engageModel();
}
super.addListChangeListener(listName, listener);
@@ -135,7 +114,7 @@ public abstract class ListValueModelWrapper
@Override
public synchronized void removeListChangeListener(ListChangeListener listener) {
super.removeListChangeListener(listener);
- if (this.hasNoListChangeListeners(LIST_VALUES)) {
+ if (this.hasNoListChangeListeners(ListValueModel.LIST_VALUES)) {
this.disengageModel();
}
}
@@ -146,7 +125,7 @@ public abstract class ListValueModelWrapper
@Override
public synchronized void removeListChangeListener(String listName, ListChangeListener listener) {
super.removeListChangeListener(listName, listener);
- if (listName == LIST_VALUES && this.hasNoListChangeListeners(LIST_VALUES)) {
+ if (listName == ListValueModel.LIST_VALUES && this.hasNoListChangeListeners(ListValueModel.LIST_VALUES)) {
this.disengageModel();
}
}
@@ -158,14 +137,14 @@ public abstract class ListValueModelWrapper
* Start listening to the list holder.
*/
protected void engageModel() {
- this.listHolder.addListChangeListener(LIST_VALUES, this.listChangeListener);
+ this.listHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener);
}
/**
* Stop listening to the list holder.
*/
protected void disengageModel() {
- this.listHolder.removeListChangeListener(LIST_VALUES, this.listChangeListener);
+ this.listHolder.removeListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener);
}
@Override
@@ -173,6 +152,18 @@ public abstract class ListValueModelWrapper
sb.append(this.listHolder);
}
+ // minimize suppressed warnings
+ @SuppressWarnings("unchecked")
+ protected ListIterator<E> items(ListChangeEvent e) {
+ return (ListIterator<E>) e.items();
+ }
+
+ // minimize suppressed warnings
+ @SuppressWarnings("unchecked")
+ protected ListIterator<E> replacedItems(ListChangeEvent e) {
+ return (ListIterator<E>) e.replacedItems();
+ }
+
// ********** list change support **********
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullCollectionValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullCollectionValueModel.java
index 767a915369..a3e8e4cf82 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullCollectionValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullCollectionValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -11,46 +11,39 @@ package org.eclipse.jpt.utility.internal.model.value;
import java.util.Iterator;
+import org.eclipse.jpt.utility.internal.ClassTools;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
/**
* A read-only collection value model for when you
* don't need to support a collection. In particular, this
* is useful for the leaf nodes of a tree that never have
* children.
+ *
+ * We don't use a singleton because we hold on to listeners.
*/
-public final class NullCollectionValueModel
- extends AbstractReadOnlyCollectionValueModel
+public final class NullCollectionValueModel<E>
+ extends AbstractModel
+ implements CollectionValueModel<E>
{
private static final long serialVersionUID = 1L;
- // singleton
- private static final NullCollectionValueModel INSTANCE = new NullCollectionValueModel();
-
/**
- * Return the singleton.
+ * Default constructor.
*/
- public static synchronized CollectionValueModel instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure non-instantiability.
- */
- private NullCollectionValueModel() {
+ public NullCollectionValueModel() {
super();
}
// ********** CollectionValueModel implementation **********
- @Override
public int size() {
return 0;
}
- public Iterator iterator() {
+ public Iterator<E> iterator() {
return EmptyIterator.instance();
}
@@ -59,14 +52,7 @@ public final class NullCollectionValueModel
@Override
public String toString() {
- return "NullCollectionValueModel";
- }
-
- /**
- * Serializable singleton support
- */
- private Object readResolve() {
- return instance();
+ return ClassTools.shortClassNameForObject(this);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullListValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullListValueModel.java
index 14747d6fae..fbfc1ccf65 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullListValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullListValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,52 +9,53 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.model.value;
+import java.util.Iterator;
import java.util.ListIterator;
+import org.eclipse.jpt.utility.internal.ClassTools;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
/**
- * A read-only list value model for when you don't
+ * An empty list value model for when you don't
* need to support a list.
+ *
+ * We don't use a singleton because we hold on to listeners.
*/
-public final class NullListValueModel
- extends AbstractReadOnlyListValueModel
+public final class NullListValueModel<E>
+ extends AbstractModel
+ implements ListValueModel<E>
{
-
private static final Object[] EMPTY_ARRAY = new Object[0];
private static final long serialVersionUID = 1L;
- // singleton
- private static final NullListValueModel INSTANCE = new NullListValueModel();
-
- /**
- * Return the singleton.
- */
- public static synchronized ListValueModel instance() {
- return INSTANCE;
- }
-
/**
- * Ensure non-instantiability.
+ * Default constructor.
*/
- private NullListValueModel() {
+ public NullListValueModel() {
super();
}
// ********** ListValueModel implementation **********
- @Override
+ public Iterator<E> iterator() {
+ return EmptyIterator.instance();
+ }
+
+ public ListIterator<E> listIterator() {
+ return EmptyListIterator.instance();
+ }
+
public int size() {
return 0;
}
- public ListIterator listIterator() {
- return EmptyListIterator.instance();
+ public E get(int index) {
+ throw new IndexOutOfBoundsException("Index: " + index + ", Size: 0");
}
- @Override
public Object[] toArray() {
return EMPTY_ARRAY;
}
@@ -62,16 +63,9 @@ public final class NullListValueModel
// ********** Object overrides **********
- @Override
+ @Override
public String toString() {
- return "NullListValueModel";
- }
-
- /**
- * Serializable singleton support
- */
- private Object readResolve() {
- return instance();
+ return ClassTools.shortClassNameForObject(this);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullPropertyValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullPropertyValueModel.java
index 2df9b11ad4..a69cda1146 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullPropertyValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullPropertyValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,37 +9,32 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.model.value;
+import org.eclipse.jpt.utility.internal.ClassTools;
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
+
/**
- * A read-only property value model for when you
+ * A property value model for when you
* don't need to support a value.
+ *
+ * We don't use a singleton because we hold on to listeners.
*/
-public final class NullPropertyValueModel
- extends AbstractReadOnlyPropertyValueModel
+public class NullPropertyValueModel<T>
+ extends AbstractModel
+ implements PropertyValueModel<T>
{
-
private static final long serialVersionUID = 1L;
- // singleton
- private static final NullPropertyValueModel INSTANCE = new NullPropertyValueModel();
-
- /**
- * Return the singleton.
- */
- public static synchronized PropertyValueModel instance() {
- return INSTANCE;
- }
-
/**
- * Ensure non-instantiability.
+ * Default constructor.
*/
- private NullPropertyValueModel() {
+ public NullPropertyValueModel() {
super();
}
// ********** PropertyValueModel implementation **********
- public Object value() {
+ public T value() {
return null;
}
@@ -48,14 +43,7 @@ public final class NullPropertyValueModel
@Override
public String toString() {
- return "NullPropertyValueModel";
- }
-
- /**
- * Serializable singleton support
- */
- private Object readResolve() {
- return instance();
+ return ClassTools.shortClassNameForObject(this);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullTreeValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullTreeValueModel.java
new file mode 100644
index 0000000000..a914e8fb9b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/NullTreeValueModel.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.utility.internal.model.value;
+
+import java.util.Iterator;
+
+import org.eclipse.jpt.utility.internal.ClassTools;
+import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
+
+/**
+ * A tree value model for when you
+ * don't need to support any nodes.
+ *
+ * We don't use a singleton because we hold on to listeners.
+ */
+public class NullTreeValueModel<E>
+ extends AbstractModel
+ implements TreeValueModel<E>
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Default constructor.
+ */
+ public NullTreeValueModel() {
+ super();
+ }
+
+
+ // ********** TreeValueModel implementation **********
+
+ public Iterator<E> nodes() {
+ return EmptyIterator.instance();
+ }
+
+
+ // ********** Object overrides **********
+
+ @Override
+ public String toString() {
+ return ClassTools.shortClassNameForObject(this);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyAspectAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyAspectAdapter.java
index 6f43abb60a..15f00844f1 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyAspectAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyAspectAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -39,9 +39,9 @@ import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
* override this method only if something must be done when the subject
* is null (e.g. throw an exception)
*/
-public abstract class PropertyAspectAdapter
- extends AspectAdapter
- implements PropertyValueModel
+public abstract class PropertyAspectAdapter<S extends Model, T>
+ extends AspectAdapter<S>
+ implements WritablePropertyValueModel<T>
{
/**
* Cache the current value of the aspect so we
@@ -50,11 +50,11 @@ public abstract class PropertyAspectAdapter
* not be in the property change event fired by the subject,
* especially when dealing with multiple aspects.
*/
- protected Object value;
+ protected T value;
/** The name of the subject's properties that we use for the value. */
protected final String[] propertyNames;
- private static final String[] EMPTY_PROPERTY_NAMES = new String[0];
+ protected static final String[] EMPTY_PROPERTY_NAMES = new String[0];
/** A listener that listens to the appropriate properties of the subject. */
protected final PropertyChangeListener propertyChangeListener;
@@ -66,7 +66,7 @@ public abstract class PropertyAspectAdapter
* Construct a PropertyAspectAdapter for the specified subject
* and property.
*/
- protected PropertyAspectAdapter(String propertyName, Model subject) {
+ protected PropertyAspectAdapter(String propertyName, S subject) {
this(new String[] {propertyName}, subject);
}
@@ -74,15 +74,15 @@ public abstract class PropertyAspectAdapter
* Construct a PropertyAspectAdapter for the specified subject
* and properties.
*/
- protected PropertyAspectAdapter(String[] propertyNames, Model subject) {
- this(new ReadOnlyPropertyValueModel(subject), propertyNames);
+ protected PropertyAspectAdapter(String[] propertyNames, S subject) {
+ this(new StaticPropertyValueModel<S>(subject), propertyNames);
}
/**
* Construct a PropertyAspectAdapter for the specified subject holder
* and properties.
*/
- protected PropertyAspectAdapter(ValueModel subjectHolder, String... propertyNames) {
+ protected PropertyAspectAdapter(PropertyValueModel<? extends S> subjectHolder, String... propertyNames) {
super(subjectHolder);
this.propertyNames = propertyNames;
this.propertyChangeListener = this.buildPropertyChangeListener();
@@ -94,7 +94,7 @@ public abstract class PropertyAspectAdapter
* Construct a PropertyAspectAdapter for the specified subject holder
* and properties.
*/
- protected PropertyAspectAdapter(ValueModel subjectHolder, Collection<String> propertyNames) {
+ protected PropertyAspectAdapter(PropertyValueModel<? extends S> subjectHolder, Collection<String> propertyNames) {
this(subjectHolder, propertyNames.toArray(new String[propertyNames.size()]));
}
@@ -102,9 +102,10 @@ public abstract class PropertyAspectAdapter
* Construct a PropertyAspectAdapter for an "unchanging" property in
* the specified subject. This is useful for a property aspect that does not
* change for a particular subject; but the subject will change, resulting in
- * a new property.
+ * a new property. (A TransformationPropertyValueModel could also be
+ * used in this situation.)
*/
- protected PropertyAspectAdapter(ValueModel subjectHolder) {
+ protected PropertyAspectAdapter(PropertyValueModel<? extends S> subjectHolder) {
this(subjectHolder, EMPTY_PROPERTY_NAMES);
}
@@ -128,23 +129,23 @@ public abstract class PropertyAspectAdapter
}
- // ********** ValueModel implementation **********
+ // ********** PropertyValueModel implementation **********
/**
* Return the value of the subject's property.
*/
@Override
- public final Object value() {
+ public final T value() {
return this.value;
}
- // ********** PropertyValueModel implementation **********
+ // ********** WritablePropertyValueModel implementation **********
/**
* Set the value of the subject's property.
*/
- public void setValue(Object value) {
+ public void setValue(T value) {
if (this.subject != null) {
this.setValue_(value);
}
@@ -155,7 +156,7 @@ public abstract class PropertyAspectAdapter
* At this point we can be sure that the subject is not null.
* @see #setValue(Object)
*/
- protected void setValue_(Object value) {
+ protected void setValue_(T value) {
throw new UnsupportedOperationException();
}
@@ -191,9 +192,9 @@ public abstract class PropertyAspectAdapter
}
@Override
- protected void engageNonNullSubject() {
- for (int i = this.propertyNames.length; i-- > 0; ) {
- ((Model) this.subject).addPropertyChangeListener(this.propertyNames[i], this.propertyChangeListener);
+ protected void engageSubject_() {
+ for (String propertyName : this.propertyNames) {
+ ((Model) this.subject).addPropertyChangeListener(propertyName, this.propertyChangeListener);
}
}
@@ -205,9 +206,9 @@ public abstract class PropertyAspectAdapter
}
@Override
- protected void disengageNonNullSubject() {
- for (int i = this.propertyNames.length; i-- > 0; ) {
- ((Model) this.subject).removePropertyChangeListener(this.propertyNames[i], this.propertyChangeListener);
+ protected void disengageSubject_() {
+ for (String propertyName : this.propertyNames) {
+ ((Model) this.subject).removePropertyChangeListener(propertyName, this.propertyChangeListener);
}
}
@@ -231,7 +232,7 @@ public abstract class PropertyAspectAdapter
* Return the aspect's value.
* At this point the subject may be null.
*/
- protected Object buildValue() {
+ protected T buildValue() {
return (this.subject == null) ? null : this.buildValue_();
}
@@ -240,12 +241,12 @@ public abstract class PropertyAspectAdapter
* At this point we can be sure that the subject is not null.
* @see #buildValue()
*/
- protected Object buildValue_() {
+ protected T buildValue_() {
throw new UnsupportedOperationException();
}
protected void propertyChanged() {
- Object old = this.value;
+ T old = this.value;
this.value = this.buildValue();
this.fireAspectChange(old, this.value);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyCollectionValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyCollectionValueModelAdapter.java
index 8414392fbf..5e37718f14 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyCollectionValueModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyCollectionValueModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.model.value;
-import java.util.Collection;
import java.util.Iterator;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
@@ -28,18 +27,18 @@ import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
* If the property's value is null, an empty iterator is returned
* (i.e. you can't have a collection with a null element).
*/
-public class PropertyCollectionValueModelAdapter
+public class PropertyCollectionValueModelAdapter<E>
extends AbstractModel
- implements CollectionValueModel
+ implements CollectionValueModel<E>
{
/** The wrapped property value model. */
- protected final PropertyValueModel valueHolder;
+ protected final PropertyValueModel<? extends E> valueHolder;
/** A listener that forwards any events fired by the value holder. */
protected final PropertyChangeListener propertyChangeListener;
/** Cache the value. */
- protected Object value;
+ protected E value;
// ********** constructors/initialization **********
@@ -47,7 +46,7 @@ public class PropertyCollectionValueModelAdapter
/**
* Wrap the specified ListValueModel.
*/
- public PropertyCollectionValueModelAdapter(PropertyValueModel valueHolder) {
+ public PropertyCollectionValueModelAdapter(PropertyValueModel<? extends E> valueHolder) {
super();
if (valueHolder == null) {
throw new NullPointerException();
@@ -69,8 +68,9 @@ public class PropertyCollectionValueModelAdapter
*/
protected PropertyChangeListener buildPropertyChangeListener() {
return new PropertyChangeListener() {
+ @SuppressWarnings("unchecked")
public void propertyChanged(PropertyChangeEvent e) {
- PropertyCollectionValueModelAdapter.this.valueChanged(e.newValue());
+ PropertyCollectionValueModelAdapter.this.valueChanged((E) e.newValue());
}
@Override
public String toString() {
@@ -82,11 +82,11 @@ public class PropertyCollectionValueModelAdapter
// ********** CollectionValueModel implementation **********
- public Iterator iterator() {
+ public Iterator<E> iterator() {
return (this.value == null) ?
- EmptyIterator.instance()
+ EmptyIterator.<E>instance()
:
- new SingleElementIterator(this.value);
+ new SingleElementIterator<E>(this.value);
}
public int size() {
@@ -155,14 +155,14 @@ public class PropertyCollectionValueModelAdapter
// ********** behavior **********
protected void engageModel() {
- this.valueHolder.addPropertyChangeListener(ValueModel.VALUE, this.propertyChangeListener);
+ this.valueHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.propertyChangeListener);
// synch our value *after* we start listening to the value holder,
// since its value might change when a listener is added
this.value = this.valueHolder.value();
}
protected void disengageModel() {
- this.valueHolder.removePropertyChangeListener(ValueModel.VALUE, this.propertyChangeListener);
+ this.valueHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.propertyChangeListener);
// clear out the value when we are not listening to the value holder
this.value = null;
}
@@ -171,10 +171,10 @@ public class PropertyCollectionValueModelAdapter
* synchronize our internal value with the wrapped value
* and fire the appropriate events
*/
- protected void valueChanged(Object newValue) {
+ protected void valueChanged(E newValue) {
// put in "empty" check so we don't fire events unnecessarily
if (this.value != null) {
- Object oldValue = this.value;
+ E oldValue = this.value;
this.value = null;
this.fireItemRemoved(VALUES, oldValue);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyValueModel.java
index 0625fba89e..31481f2380 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyValueModel.java
@@ -9,17 +9,20 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.model.value;
+import org.eclipse.jpt.utility.internal.model.Model;
+
/**
- * Extend ValueModel to allow the setting of the property's value.
+ * Interface used to abstract property accessing and
+ * change notification and make it more pluggable.
*/
-public interface PropertyValueModel
- extends ValueModel
+public interface PropertyValueModel<T>
+ extends Model
{
/**
- * Set the value and fire a property change notification.
- * @see ValueModel#VALUE
+ * Return the property's value.
*/
- void setValue(Object value);
+ T value();
+ String VALUE = "value";
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyValueModelWrapper.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyValueModelWrapper.java
index eb0d4f1895..b94d9bc798 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyValueModelWrapper.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/PropertyValueModelWrapper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -20,25 +20,24 @@ import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
* another property value model, "lazily" listen to it, and propagate
* its change notifications.
*/
-public abstract class PropertyValueModelWrapper
+public abstract class PropertyValueModelWrapper<T>
extends AbstractModel
- implements PropertyValueModel
{
/** The wrapped property value model. */
- protected final PropertyValueModel valueHolder;
+ protected final PropertyValueModel<? extends T> valueHolder;
/** A listener that allows us to synch with changes to the wrapped value holder. */
protected final PropertyChangeListener valueChangeListener;
- // ********** constructors **********
+ // ********** constructors/initialization **********
/**
* Construct a property value model with the specified wrapped
* property value model. The value holder is required.
*/
- protected PropertyValueModelWrapper(PropertyValueModel valueHolder) {
+ protected PropertyValueModelWrapper(PropertyValueModel<? extends T> valueHolder) {
super();
if (valueHolder == null) {
throw new NullPointerException();
@@ -47,12 +46,9 @@ public abstract class PropertyValueModelWrapper
this.valueChangeListener = this.buildValueChangeListener();
}
-
- // ********** initialization **********
-
@Override
protected ChangeSupport buildChangeSupport() {
- return new SingleAspectChangeSupport(this, PropertyChangeListener.class, VALUE);
+ return new SingleAspectChangeSupport(this, PropertyChangeListener.class, PropertyValueModel.VALUE);
}
protected PropertyChangeListener buildValueChangeListener() {
@@ -75,7 +71,7 @@ public abstract class PropertyValueModelWrapper
*/
@Override
public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
- if (this.hasNoPropertyChangeListeners(VALUE)) {
+ if (this.hasNoPropertyChangeListeners(PropertyValueModel.VALUE)) {
this.engageValueHolder();
}
super.addPropertyChangeListener(listener);
@@ -86,7 +82,7 @@ public abstract class PropertyValueModelWrapper
*/
@Override
public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- if (propertyName == VALUE && this.hasNoPropertyChangeListeners(VALUE)) {
+ if (propertyName == PropertyValueModel.VALUE && this.hasNoPropertyChangeListeners(PropertyValueModel.VALUE)) {
this.engageValueHolder();
}
super.addPropertyChangeListener(propertyName, listener);
@@ -98,7 +94,7 @@ public abstract class PropertyValueModelWrapper
@Override
public synchronized void removePropertyChangeListener(PropertyChangeListener listener) {
super.removePropertyChangeListener(listener);
- if (this.hasNoPropertyChangeListeners(VALUE)) {
+ if (this.hasNoPropertyChangeListeners(PropertyValueModel.VALUE)) {
this.disengageValueHolder();
}
}
@@ -109,7 +105,7 @@ public abstract class PropertyValueModelWrapper
@Override
public synchronized void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
super.removePropertyChangeListener(propertyName, listener);
- if (propertyName == VALUE && this.hasNoPropertyChangeListeners(VALUE)) {
+ if (propertyName == PropertyValueModel.VALUE && this.hasNoPropertyChangeListeners(PropertyValueModel.VALUE)) {
this.disengageValueHolder();
}
}
@@ -121,14 +117,14 @@ public abstract class PropertyValueModelWrapper
* Begin listening to the value holder.
*/
protected void engageValueHolder() {
- this.valueHolder.addPropertyChangeListener(VALUE, this.valueChangeListener);
+ this.valueHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.valueChangeListener);
}
/**
* Stop listening to the value holder.
*/
protected void disengageValueHolder() {
- this.valueHolder.removePropertyChangeListener(VALUE, this.valueChangeListener);
+ this.valueHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.valueChangeListener);
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SimpleCollectionValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SimpleCollectionValueModel.java
index 3dc3dfd460..5e94b40327 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SimpleCollectionValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SimpleCollectionValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -26,7 +26,7 @@ import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener;
*/
public class SimpleCollectionValueModel<E>
extends AbstractModel
- implements CollectionValueModel, Collection<E>
+ implements CollectionValueModel<E>, Collection<E>
{
/** The collection. */
protected Collection<E> collection;
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SimpleListValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SimpleListValueModel.java
index 6102f68698..b5dc9d7554 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SimpleListValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SimpleListValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -27,7 +27,7 @@ import org.eclipse.jpt.utility.internal.model.listener.ListChangeListener;
*/
public class SimpleListValueModel<E>
extends AbstractModel
- implements ListValueModel, List<E>
+ implements ListValueModel<E>, List<E>
{
/** The list. */
protected List<E> list;
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SimplePropertyValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SimplePropertyValueModel.java
index 13f5dd366d..8967a31df6 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SimplePropertyValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SimplePropertyValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -15,21 +15,21 @@ import org.eclipse.jpt.utility.internal.model.SingleAspectChangeSupport;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
/**
- * Implementation of PropertyValueModel that simply holds on to an
+ * Implementation of WritablePropertyValueModel that simply holds on to an
* object and uses it as the value.
*/
-public class SimplePropertyValueModel
+public class SimplePropertyValueModel<T>
extends AbstractModel
- implements PropertyValueModel
+ implements WritablePropertyValueModel<T>
{
/** The value. */
- protected Object value;
+ protected T value;
/**
* Construct a PropertyValueModel for the specified value.
*/
- public SimplePropertyValueModel(Object value) {
+ public SimplePropertyValueModel(T value) {
super();
this.value = value;
}
@@ -47,12 +47,12 @@ public class SimplePropertyValueModel
}
- public Object value() {
+ public T value() {
return this.value;
}
- public void setValue(Object value) {
- Object old = this.value;
+ public void setValue(T value) {
+ T old = this.value;
this.value = value;
this.firePropertyChanged(VALUE, old, value);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SortedListValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SortedListValueModelAdapter.java
index 449cc1e62f..f94552adba 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SortedListValueModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/SortedListValueModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -35,14 +35,14 @@ import org.eclipse.jpt.utility.internal.model.event.CollectionChangeEvent;
* we do not have any listeners. This should not be too painful since,
* most likely, client objects will also be listeners.
*/
-public class SortedListValueModelAdapter
- extends CollectionListValueModelAdapter
+public class SortedListValueModelAdapter<E>
+ extends CollectionListValueModelAdapter<E>
{
/**
* A comparator used for sorting the elements;
* if it is null, we use "natural ordering".
*/
- protected Comparator comparator;
+ protected Comparator<E> comparator;
// ********** constructors **********
@@ -51,7 +51,7 @@ public class SortedListValueModelAdapter
* Wrap the specified collection value model and sort its contents
* using the specified comparator.
*/
- public SortedListValueModelAdapter(CollectionValueModel collectionHolder, Comparator comparator) {
+ public SortedListValueModelAdapter(CollectionValueModel<? extends E> collectionHolder, Comparator<E> comparator) {
super(collectionHolder);
this.comparator = comparator;
}
@@ -60,7 +60,7 @@ public class SortedListValueModelAdapter
* Wrap the specified collection value model and sort its contents
* based on the elements' "natural ordering".
*/
- public SortedListValueModelAdapter(CollectionValueModel collectionHolder) {
+ public SortedListValueModelAdapter(CollectionValueModel<? extends E> collectionHolder) {
this(collectionHolder, null);
}
@@ -68,22 +68,22 @@ public class SortedListValueModelAdapter
* Wrap the specified list value model and sort its contents
* using the specified comparator.
*/
- public SortedListValueModelAdapter(ListValueModel listHolder, Comparator comparator) {
- this(new ListCollectionValueModelAdapter(listHolder), comparator);
+ public SortedListValueModelAdapter(ListValueModel<? extends E> listHolder, Comparator<E> comparator) {
+ this(new ListCollectionValueModelAdapter<E>(listHolder), comparator);
}
/**
* Wrap the specified list value model and sort its contents
* based on the elements' "natural ordering".
*/
- public SortedListValueModelAdapter(ListValueModel listHolder) {
+ public SortedListValueModelAdapter(ListValueModel<? extends E> listHolder) {
this(listHolder, null);
}
// ********** accessors **********
- public void setComparator(Comparator comparator) {
+ public void setComparator(Comparator<E> comparator) {
this.comparator = comparator;
this.sortList();
}
@@ -117,12 +117,13 @@ public class SortedListValueModelAdapter
*/
protected void sortList() {
// save the unsorted state of the sorted list so we can minimize the number of "replaced" items
- ArrayList unsortedList = (ArrayList) this.list.clone();
+ @SuppressWarnings("unchecked")
+ ArrayList<E> unsortedList = (ArrayList<E>) this.list.clone();
Collections.sort(this.list, this.comparator);
Range diffRange = CollectionTools.identityDiffRange(unsortedList, this.list);
if (diffRange.size > 0) {
- List unsortedItems = unsortedList.subList(diffRange.start, diffRange.end + 1);
- List sortedItems = this.list.subList(diffRange.start, diffRange.end + 1);
+ List<E> unsortedItems = unsortedList.subList(diffRange.start, diffRange.end + 1);
+ List<E> sortedItems = this.list.subList(diffRange.start, diffRange.end + 1);
this.fireItemsReplaced(LIST_VALUES, diffRange.start, sortedItems, unsortedItems);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StatePropertyValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StatePropertyValueModelAdapter.java
new file mode 100644
index 0000000000..cdbabb5711
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StatePropertyValueModelAdapter.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.utility.internal.model.value;
+
+import org.eclipse.jpt.utility.internal.model.Model;
+import org.eclipse.jpt.utility.internal.model.event.StateChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.StateChangeListener;
+
+/**
+ * This abstract class provides the infrastructure needed to wrap
+ * a model, "lazily" listen to it, and convert
+ * its state change notifications into property value model change
+ * notifications.
+ *
+ * Subclasses must override:
+ * - #buildValue()
+ * to return the current property value, as derived from the
+ * current model
+ *
+ * Subclasses might want to override:
+ * - #stateChanged(StateChangeEvent e)
+ * to improve performance (by not recalculating the value, if possible)
+ */
+public abstract class StatePropertyValueModelAdapter<T>
+ extends AspectPropertyValueModelAdapter<T>
+{
+ /** The wrapped model. */
+ protected final Model model;
+
+ /** A listener that allows us to synch with changes to the wrapped model. */
+ protected final StateChangeListener stateChangeListener;
+
+
+ // ********** constructor/initialization **********
+
+ /**
+ * Construct a property value model with the specified wrapped model.
+ */
+ protected StatePropertyValueModelAdapter(Model model) {
+ super();
+ this.model = model;
+ this.stateChangeListener = this.buildStateChangeListener();
+ }
+
+ protected StateChangeListener buildStateChangeListener() {
+ return new StateChangeListener() {
+ public void stateChanged(StateChangeEvent event) {
+ StatePropertyValueModelAdapter.this.stateChanged(event);
+ }
+ @Override
+ public String toString() {
+ return "state change listener";
+ }
+ };
+ }
+
+
+ // ********** behavior **********
+
+ /**
+ * Start listening to the model.
+ */
+ @Override
+ protected void engageModel_() {
+ this.model.addStateChangeListener(this.stateChangeListener);
+ }
+
+ /**
+ * Stop listening to the model.
+ */
+ @Override
+ protected void disengageModel_() {
+ this.model.removeStateChangeListener(this.stateChangeListener);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.model);
+ }
+
+
+ // ********** state change support **********
+
+ /**
+ * The model's state changed;
+ * propagate the change notification appropriately.
+ */
+ protected void stateChanged(StateChangeEvent e) {
+ // by default, simply recalculate the value and fire an event
+ this.propertyChanged();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StaticCollectionValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StaticCollectionValueModel.java
new file mode 100644
index 0000000000..005dc3db67
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StaticCollectionValueModel.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.internal.model.value;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.iterators.ReadOnlyIterator;
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
+
+/**
+ * Implementation of CollectionValueModel that can be used for
+ * returning an iterator on a static collection, but still allows listeners to be added.
+ * Listeners will NEVER be notified of any changes, because there should be none.
+ */
+public class StaticCollectionValueModel<E>
+ extends AbstractModel
+ implements CollectionValueModel<E>
+{
+ /** The collection. */
+ protected final Collection<? extends E> collection;
+
+ private static final long serialVersionUID = 1L;
+
+
+ /**
+ * Construct a static CollectionValueModel for the specified collection.
+ */
+ public StaticCollectionValueModel(Collection<? extends E> collection) {
+ super();
+ if (collection == null) {
+ throw new NullPointerException();
+ }
+ this.collection = collection;
+ }
+
+ // ********** CollectionValueModel implementation **********
+
+ public int size() {
+ return this.collection.size();
+ }
+
+ public Iterator<E> iterator() {
+ return new ReadOnlyIterator<E>(this.collection.iterator());
+ }
+
+
+ // ********** Object overrides **********
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.collection);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StaticListValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StaticListValueModel.java
new file mode 100644
index 0000000000..bd8987c747
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StaticListValueModel.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.internal.model.value;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.iterators.ReadOnlyIterator;
+import org.eclipse.jpt.utility.internal.iterators.ReadOnlyListIterator;
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
+
+/**
+ * Implementation of ListValueModel that can be used for
+ * returning a list iterator on a static list, but still allows listeners to be added.
+ * Listeners will NEVER be notified of any changes, because there should be none.
+ */
+public class StaticListValueModel<E>
+ extends AbstractModel
+ implements ListValueModel<E>
+{
+ /** The value. */
+ protected final List<? extends E> list;
+
+ private static final long serialVersionUID = 1L;
+
+
+ /**
+ * Construct a static ListValueModel for the specified list.
+ */
+ public StaticListValueModel(List<? extends E> list) {
+ super();
+ if (list == null) {
+ throw new NullPointerException();
+ }
+ this.list = list;
+ }
+
+
+ // ********** ListValueModel implementation **********
+
+ public Iterator<E> iterator() {
+ return new ReadOnlyIterator<E>(this.list.iterator());
+ }
+
+ public ListIterator<E> listIterator() {
+ return new ReadOnlyListIterator<E>(this.list.listIterator());
+ }
+
+ public int size() {
+ return this.list.size();
+ }
+
+ public E get(int index) {
+ return this.list.get(index);
+ }
+
+ public Object[] toArray() {
+ return this.list.toArray();
+ }
+
+
+ // ********** Object overrides **********
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.list);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StaticPropertyValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StaticPropertyValueModel.java
new file mode 100644
index 0000000000..0a6c1d41e0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StaticPropertyValueModel.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.internal.model.value;
+
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
+
+/**
+ * Implementation of PropertyValueModel that can be used for
+ * returning a static value, but still allows listeners to be added.
+ * Listeners will NEVER be notified of any changes, because there should be none.
+ */
+public class StaticPropertyValueModel<T>
+ extends AbstractModel
+ implements PropertyValueModel<T>
+{
+ /** The value. */
+ protected final T value;
+
+ private static final long serialVersionUID = 1L;
+
+
+ /**
+ * Construct a static PropertyValueModel for the specified value.
+ */
+ public StaticPropertyValueModel(T value) {
+ super();
+ this.value = value;
+ }
+
+
+ // ********** PropertyValueModel implementation **********
+
+ public T value() {
+ return this.value;
+ }
+
+
+ // ********** Object overrides **********
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, this.value);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StaticTreeValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StaticTreeValueModel.java
new file mode 100644
index 0000000000..9f4780a442
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/StaticTreeValueModel.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.utility.internal.model.value;
+
+import java.util.Iterator;
+
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.iterators.ReadOnlyIterator;
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
+
+/**
+ * Implementation of TreeValueModel that can be used for
+ * returning an iterator on a static tree, but still allows listeners to be added.
+ * Listeners will NEVER be notified of any changes, because there should be none.
+ */
+public class StaticTreeValueModel<E>
+ extends AbstractModel
+ implements TreeValueModel<E>
+{
+ /** The tree's nodes. */
+ protected final Iterable<? extends E> nodes;
+
+ private static final long serialVersionUID = 1L;
+
+
+ /**
+ * Construct a read-only TreeValueModel for the specified nodes.
+ */
+ public StaticTreeValueModel(Iterable<? extends E> nodes) {
+ super();
+ if (nodes == null) {
+ throw new NullPointerException();
+ }
+ this.nodes = nodes;
+ }
+
+ // ********** TreeValueModel implementation **********
+
+ public Iterator<E> nodes() {
+ return new ReadOnlyIterator<E>(this.nodes.iterator());
+ }
+
+
+ // ********** Object overrides **********
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this, CollectionTools.collection(this.nodes()));
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TransformationListValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TransformationListValueModelAdapter.java
index 60f464fd4f..582b1a362b 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TransformationListValueModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TransformationListValueModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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,6 +10,7 @@
package org.eclipse.jpt.utility.internal.model.value;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
@@ -35,15 +36,16 @@ import org.eclipse.jpt.utility.internal.model.event.ListChangeEvent;
* we do not have any listeners. This should not be too painful since,
* most likely, client objects will also be listeners.
*/
-public class TransformationListValueModelAdapter
- extends ListValueModelWrapper
+public class TransformationListValueModelAdapter<E1, E2>
+ extends ListValueModelWrapper<E1>
+ implements ListValueModel<E2>
{
/** This transforms the items, unless the subclass overrides #transformItem(Object). */
- protected Transformer transformer;
+ protected Transformer<E1, E2> transformer;
/** The list of transformed items. */
- protected final List transformedList;
+ protected final List<E2> transformedList;
// ********** constructors **********
@@ -51,52 +53,52 @@ public class TransformationListValueModelAdapter
/**
* Constructor - the list holder is required.
*/
- public TransformationListValueModelAdapter(ListValueModel listHolder, Transformer transformer) {
+ public TransformationListValueModelAdapter(ListValueModel<? extends E1> listHolder, Transformer<E1, E2> transformer) {
super(listHolder);
this.transformer = transformer;
- this.transformedList = new ArrayList();
+ this.transformedList = new ArrayList<E2>();
}
/**
* Constructor - the list holder is required.
*/
- public TransformationListValueModelAdapter(ListValueModel listHolder) {
- this(listHolder, Transformer.Null.instance());
+ public TransformationListValueModelAdapter(ListValueModel<? extends E1> listHolder) {
+ this(listHolder, Transformer.Null.<E1, E2>instance());
}
/**
* Constructor - the collection holder is required.
*/
- public TransformationListValueModelAdapter(CollectionValueModel collectionHolder, Transformer transformer) {
- this(new CollectionListValueModelAdapter(collectionHolder), transformer);
+ public TransformationListValueModelAdapter(CollectionValueModel<? extends E1> collectionHolder, Transformer<E1, E2> transformer) {
+ this(new CollectionListValueModelAdapter<E1>(collectionHolder), transformer);
}
/**
* Constructor - the collection holder is required.
*/
- public TransformationListValueModelAdapter(CollectionValueModel collectionHolder) {
- this(new CollectionListValueModelAdapter(collectionHolder));
+ public TransformationListValueModelAdapter(CollectionValueModel<? extends E1> collectionHolder) {
+ this(new CollectionListValueModelAdapter<E1>(collectionHolder));
}
// ********** ListValueModel implementation **********
- public ListIterator listIterator() {
- // try to prevent backdoor modification of the list
- return new ReadOnlyListIterator(this.transformedList);
+ public Iterator<E2> iterator() {
+ return this.listIterator();
}
- @Override
- public Object get(int index) {
+ public ListIterator<E2> listIterator() {
+ return new ReadOnlyListIterator<E2>(this.transformedList);
+ }
+
+ public E2 get(int index) {
return this.transformedList.get(index);
}
- @Override
public int size() {
return this.transformedList.size();
}
- @Override
public Object[] toArray() {
return this.transformedList.toArray();
}
@@ -121,29 +123,29 @@ public class TransformationListValueModelAdapter
/**
* Transform the items associated with the specified event.
*/
- protected List transformItems(ListChangeEvent e) {
- return this.transformItems(e.items(), e.itemsSize());
+ protected List<E2> transformItems(ListChangeEvent e) {
+ return this.transformItems(this.items(e), e.itemsSize());
}
/**
* Transform the items in the specified list value model.
*/
- protected List transformItems(ListValueModel lvm) {
+ protected List<E2> transformItems(ListValueModel<? extends E1> lvm) {
return this.transformItems(lvm.listIterator(), lvm.size());
}
/**
* Transform the replaced items associated with the specified event.
*/
- protected List transformReplacedItems(ListChangeEvent e) {
- return this.transformItems(e.replacedItems(), e.itemsSize());
+ protected List<E2> transformReplacedItems(ListChangeEvent e) {
+ return this.transformItems(this.replacedItems(e), e.itemsSize());
}
/**
* Transform the specified items.
*/
- protected List transformItems(ListIterator items, int size) {
- List result = new ArrayList(size);
+ protected List<E2> transformItems(ListIterator<? extends E1> items, int size) {
+ List<E2> result = new ArrayList<E2>(size);
while (items.hasNext()) {
result.add(this.transformItem(items.next()));
}
@@ -153,14 +155,14 @@ public class TransformationListValueModelAdapter
/**
* Transform the specified item.
*/
- protected Object transformItem(Object item) {
+ protected E2 transformItem(E1 item) {
return this.transformer.transform(item);
}
/**
* Change the transformer and rebuild the collection.
*/
- public void setTransformer(Transformer transformer) {
+ public void setTransformer(Transformer<E1, E2> transformer) {
this.transformer = transformer;
this.rebuildTransformedList();
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TransformationPropertyValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TransformationPropertyValueModel.java
index a94059940b..b89e6ec117 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TransformationPropertyValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TransformationPropertyValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,74 +9,72 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.model.value;
-import org.eclipse.jpt.utility.internal.BidiTransformer;
+import org.eclipse.jpt.utility.internal.Transformer;
import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
/**
* A <code>TransformationPropertyValueModel</code> wraps another
- * <code>PropertyValueModel</code> and uses a <code>BidiTransformer</code>
- * to:<ul>
- * <li>transform the wrapped value before it is returned by <code>value()</code>
- * <li>"reverse-transform" the new value that comes in via
- * <code>setValue(Object)</code>
- * </ul>
- * As an alternative to building a <code>BidiTransformer</code>,
+ * <code>PropertyValueModel</code> and uses a <code>Transformer</code>
+ * to transform the wrapped value before it is returned by <code>value()</code>.
+ * <p>
+ * As an alternative to building a <code>Transformer</code>,
* a subclass of <code>TransformationPropertyValueModel</code> can
- * override the <code>transform(Object)</code> and
- * <code>reverseTransform(Object)</code> methods.
+ * either override the <code>transform_(Object)</code> method or,
+ * if something other than null should be returned when the wrapped value
+ * is null, override the <code>transform(Object)</code> method.
*/
-public class TransformationPropertyValueModel
- extends PropertyValueModelWrapper
+public class TransformationPropertyValueModel<T1, T2>
+ extends PropertyValueModelWrapper<T1>
+ implements PropertyValueModel<T2>
{
- private final BidiTransformer transformer;
+ protected final Transformer<T1, T2> transformer;
- // ********** constructors **********
+ // ********** constructors/initialization **********
/**
* Construct a property value model with the specified nested
- * property value model and a disabled transformer.
+ * property value model and the default transformer.
* Use this constructor if you want to override the
- * <code>transform(Object)</code> and <code>reverseTransform(Object)</code>
- * methods instead of building a <code>BidiTransformer</code>.
+ * <code>transform_(Object)</code> or <code>transform(Object)</code>
+ * method instead of building a <code>Transformer</code>.
*/
- public TransformationPropertyValueModel(PropertyValueModel valueHolder) {
- this(valueHolder, BidiTransformer.Disabled.instance());
+ public TransformationPropertyValueModel(PropertyValueModel<? extends T1> valueHolder) {
+ super(valueHolder);
+ this.transformer = this.buildTransformer();
}
/**
* Construct an property value model with the specified nested
* property value model and transformer.
*/
- public TransformationPropertyValueModel(PropertyValueModel valueHolder, BidiTransformer transformer) {
+ public TransformationPropertyValueModel(PropertyValueModel<? extends T1> valueHolder, Transformer<T1, T2> transformer) {
super(valueHolder);
this.transformer = transformer;
}
-
- // ********** ValueModel implementation **********
-
- public Object value() {
- // transform the object returned by the nested value model before returning it
- return this.transform(this.valueHolder.value());
+ protected Transformer<T1, T2> buildTransformer() {
+ return new DefaultTransformer();
}
// ********** PropertyValueModel implementation **********
- public void setValue(Object value) {
- // "reverse-transform" the object before passing it to the the nested value model
- this.valueHolder.setValue(this.reverseTransform(value));
+ public T2 value() {
+ // transform the object returned by the nested value model before returning it
+ return this.transform(this.valueHolder.value());
}
// ********** PropertyValueModelWrapper implementation **********
- @Override
+ @Override
protected void valueChanged(PropertyChangeEvent e) {
// transform the values before propagating the change event
- Object oldValue = this.transform(e.oldValue());
- Object newValue = this.transform(e.newValue());
+ @SuppressWarnings("unchecked")
+ Object oldValue = this.transform((T1) e.oldValue());
+ @SuppressWarnings("unchecked")
+ Object newValue = this.transform((T1) e.newValue());
this.firePropertyChanged(VALUE, oldValue, newValue);
}
@@ -84,19 +82,32 @@ public class TransformationPropertyValueModel
// ********** behavior **********
/**
- * Transform the specified object and return the result.
- * This is called by #value().
+ * Transform the specified value and return the result.
+ * This is called by #value() and #valueChanged(PropertyChangeEvent).
*/
- protected Object transform(Object value) {
+ protected T2 transform(T1 value) {
return this.transformer.transform(value);
}
/**
- * "Reverse-transform" the specified object and return the result.
- * This is called by #setValue(Object).
+ * Transform the specified, non-null, value and return the result.
+ */
+ protected T2 transform_(T1 value) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** default transformer **********
+
+ /**
+ * The default transformer will return null if the wrapped value is null.
+ * If the wrapped value is not null, it is transformed by a subclass
+ * implementation of #transform_(Object).
*/
- protected Object reverseTransform(Object value) {
- return this.transformer.reverseTransform(value);
+ protected class DefaultTransformer implements Transformer<T1, T2> {
+ public T2 transform(T1 value) {
+ return (value == null) ? null : TransformationPropertyValueModel.this.transform_(value);
+ }
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TransformationWritablePropertyValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TransformationWritablePropertyValueModel.java
new file mode 100644
index 0000000000..a3ce7d5fef
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TransformationWritablePropertyValueModel.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.utility.internal.model.value;
+
+import org.eclipse.jpt.utility.internal.BidiTransformer;
+
+/**
+ * A <code>TransformationWritablePropertyValueModel</code> wraps another
+ * <code>WritablePropertyValueModel</code> and uses a <code>BidiTransformer</code>
+ * to:<ul>
+ * <li>transform the wrapped value before it is returned by <code>value()</code>
+ * <li>"reverse-transform" the new value that comes in via
+ * <code>setValue(Object)</code>
+ * </ul>
+ * As an alternative to building a <code>BidiTransformer</code>,
+ * a subclass of <code>TransformationWritablePropertyValueModel</code> can
+ * override the <code>transform_(Object)</code> and
+ * <code>reverseTransform_(Object)</code> methods; or,
+ * if something other than null should be returned when the wrapped value
+ * is null or the new value is null, override the <code>transform(Object)</code>
+ * and <code>reverseTransform(Object)</code> methods.
+ */
+public class TransformationWritablePropertyValueModel<T1, T2>
+ extends TransformationPropertyValueModel<T1, T2>
+ implements WritablePropertyValueModel<T2>
+{
+
+ // ********** constructors/initialization **********
+
+ /**
+ * Construct a writable property value model with the specified nested
+ * writable property value model and the default bidi transformer.
+ * Use this constructor if you want to override the
+ * <code>transform_(Object)</code> and <code>reverseTransform_(Object)</code>
+ * (or <code>transform(Object)</code> and <code>reverseTransform(Object)</code>)
+ * methods instead of building a <code>BidiTransformer</code>.
+ */
+ public TransformationWritablePropertyValueModel(WritablePropertyValueModel<T1> valueHolder) {
+ super(valueHolder);
+ }
+
+ /**
+ * Construct a writable property value model with the specified nested
+ * writable property value model and bidi transformer.
+ */
+ public TransformationWritablePropertyValueModel(WritablePropertyValueModel<T1> valueHolder, BidiTransformer<T1, T2> transformer) {
+ super(valueHolder, transformer);
+ }
+
+ @Override
+ protected BidiTransformer<T1, T2> buildTransformer() {
+ return new DefaultBidiTransformer();
+ }
+
+
+ // ********** WritablePropertyValueModel implementation **********
+
+ public void setValue(T2 value) {
+ // "reverse-transform" the object before passing it to the the nested value model
+ this.valueHolder().setValue(this.reverseTransform(value));
+ }
+
+
+ // ********** behavior **********
+
+ /**
+ * "Reverse-transform" the specified value and return the result.
+ * This is called by #setValue(Object).
+ */
+ protected T1 reverseTransform(T2 value) {
+ return this.transformer().reverseTransform(value);
+ }
+
+ /**
+ * "Reverse-transform" the specified, non-null, value and return the result.
+ */
+ protected T1 reverseTransform_(T2 value) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** queries **********
+
+ /**
+ * Our constructors accept only a WritablePropertyValueModel<T1>.
+ */
+ @SuppressWarnings("unchecked")
+ protected WritablePropertyValueModel<T1> valueHolder() {
+ return (WritablePropertyValueModel<T1>) this.valueHolder;
+ }
+
+ /**
+ * Our constructors accept only a bidirectional transformer.
+ */
+ protected BidiTransformer<T1, T2> transformer() {
+ return (BidiTransformer<T1, T2>) this.transformer;
+ }
+
+
+ // ********** default bidi transformer **********
+
+ /**
+ * The default bidi transformer will return null if the wrapped value is null.
+ * If the wrapped value is not null, it is transformed by a subclass
+ * implementation of #transform_(Object).
+ * The default bidi transformer will also return null if the new value is null.
+ * If the new value is not null, it is reverse-transformed by a subclass
+ * implementation of #reverseTransform_(Object).
+ */
+ protected class DefaultBidiTransformer
+ extends DefaultTransformer
+ implements BidiTransformer<T1, T2>
+ {
+ public T1 reverseTransform(T2 value) {
+ return (value == null) ? null : TransformationWritablePropertyValueModel.this.reverseTransform_(value);
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreeAspectAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreeAspectAdapter.java
index 549cd66c23..66a6bb4fe6 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreeAspectAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreeAspectAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.model.value;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.Iterator;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
@@ -19,6 +21,8 @@ import org.eclipse.jpt.utility.internal.model.listener.TreeChangeListener;
/**
* This extension of PropertyAdapter provides TreeChange support.
+ * This allows us to convert a set of one or more trees into
+ * a single tree, NODES.
*
* The typical subclass will override the following methods:
* #nodes_()
@@ -29,14 +33,15 @@ import org.eclipse.jpt.utility.internal.model.listener.TreeChangeListener;
* override this method only if returning an empty iterator when the
* subject is null is unacceptable
*/
-public abstract class TreeAspectAdapter
- extends AspectAdapter
- implements TreeValueModel
+public abstract class TreeAspectAdapter<S extends Model, E>
+ extends AspectAdapter<S>
+ implements TreeValueModel<E>
{
/**
- * The name of the subject's tree that we use for the value.
+ * The name of the subject's trees that we use for the value.
*/
- protected final String treeName;
+ protected final String[] treeNames;
+ protected static final String[] EMPTY_TREE_NAMES = new String[0];
/** A listener that listens to the subject's tree aspect. */
protected final TreeChangeListener treeChangeListener;
@@ -48,20 +53,46 @@ public abstract class TreeAspectAdapter
* Construct a TreeAspectAdapter for the specified subject
* and tree.
*/
- protected TreeAspectAdapter(String treeName, Model subject) {
- this(new ReadOnlyPropertyValueModel(subject), treeName);
+ protected TreeAspectAdapter(String treeName, S subject) {
+ this(new String[] {treeName}, subject);
+ }
+
+ /**
+ * Construct a TreeAspectAdapter for the specified subject
+ * and trees.
+ */
+ protected TreeAspectAdapter(String[] treeNames, S subject) {
+ this(new StaticPropertyValueModel<S>(subject), treeNames);
}
/**
* Construct a TreeAspectAdapter for the specified subject holder
- * and tree.
+ * and trees.
*/
- protected TreeAspectAdapter(ValueModel subjectHolder, String treeName) {
+ protected TreeAspectAdapter(PropertyValueModel<? extends S> subjectHolder, String... treeNames) {
super(subjectHolder);
- this.treeName = treeName;
+ this.treeNames = treeNames;
this.treeChangeListener = this.buildTreeChangeListener();
}
+ /**
+ * Construct a TreeAspectAdapter for the specified subject holder
+ * and trees.
+ */
+ protected TreeAspectAdapter(PropertyValueModel<? extends S> subjectHolder, Collection<String> treeNames) {
+ this(subjectHolder, treeNames.toArray(new String[treeNames.size()]));
+ }
+
+ /**
+ * Construct a TreeAspectAdapter for an "unchanging" tree in
+ * the specified subject. This is useful for a tree aspect that does not
+ * change for a particular subject; but the subject will change, resulting in
+ * a new tree.
+ */
+ protected TreeAspectAdapter(PropertyValueModel<? extends S> subjectHolder) {
+ this(subjectHolder, EMPTY_TREE_NAMES);
+ }
+
// ********** initialization **********
@@ -85,7 +116,7 @@ public abstract class TreeAspectAdapter
}
@Override
public String toString() {
- return "tree change listener: " + TreeAspectAdapter.this.treeName;
+ return "tree change listener: " + Arrays.asList(TreeAspectAdapter.this.treeNames);
}
};
}
@@ -96,8 +127,8 @@ public abstract class TreeAspectAdapter
/**
* Return the nodes of the subject's tree aspect.
*/
- public Iterator nodes() {
- return (this.subject == null) ? EmptyIterator.instance() : this.nodes_();
+ public Iterator<E> nodes() {
+ return (this.subject == null) ? EmptyIterator.<E>instance() : this.nodes_();
}
/**
@@ -105,7 +136,7 @@ public abstract class TreeAspectAdapter
* At this point we can be sure that the subject is not null.
* @see #nodes()
*/
- protected Iterator nodes_() {
+ protected Iterator<E> nodes_() {
throw new UnsupportedOperationException();
}
@@ -138,18 +169,27 @@ public abstract class TreeAspectAdapter
}
@Override
- protected void engageNonNullSubject() {
- ((Model) this.subject).addTreeChangeListener(this.treeName, this.treeChangeListener);
+ protected void engageSubject_() {
+ for (String treeName : this.treeNames) {
+ ((Model) this.subject).addTreeChangeListener(treeName, this.treeChangeListener);
+ }
}
@Override
- protected void disengageNonNullSubject() {
- ((Model) this.subject).removeTreeChangeListener(this.treeName, this.treeChangeListener);
+ protected void disengageSubject_() {
+ for (String treeName : this.treeNames) {
+ ((Model) this.subject).removeTreeChangeListener(treeName, this.treeChangeListener);
+ }
}
@Override
public void toString(StringBuilder sb) {
- sb.append(this.treeName);
+ for (int i = 0; i < this.treeNames.length; i++) {
+ if (i != 0) {
+ sb.append(", ");
+ }
+ sb.append(this.treeNames[i]);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreeNodeValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreeNodeValueModel.java
index 418e73769d..81eadb03b2 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreeNodeValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreeNodeValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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,7 +10,7 @@
package org.eclipse.jpt.utility.internal.model.value;
/**
- * Extend PropertyValueModel to better support the TreeModelAdapter class.
+ * Extend WritablePropertyValueModel to better support TreeModelAdapter.
*
* Implementors of this interface should fire a "state change" event
* whenever the node's internal state changes in a way that the
@@ -22,30 +22,30 @@ package org.eclipse.jpt.utility.internal.model.value;
*
* @see AbstractTreeNodeValueModel
*/
-public interface TreeNodeValueModel
- extends PropertyValueModel
+public interface TreeNodeValueModel<T>
+ extends WritablePropertyValueModel<T>
{
/**
* Return the node's parent node; null if the node
* is the root.
*/
- TreeNodeValueModel parent();
+ TreeNodeValueModel<T> parent();
/**
* Return the path to the node.
*/
- TreeNodeValueModel[] path();
+ TreeNodeValueModel<T>[] path();
/**
* Return a list value model of the node's child nodes.
*/
- ListValueModel childrenModel();
+ ListValueModel<TreeNodeValueModel<T>> childrenModel();
/**
* Return the node's child at the specified index.
*/
- TreeNodeValueModel child(int index);
+ TreeNodeValueModel<T> child(int index);
/**
* Return the size of the node's list of children.
@@ -55,7 +55,7 @@ public interface TreeNodeValueModel
/**
* Return the index in the node's list of children of the specified child.
*/
- int indexOfChild(TreeNodeValueModel child);
+ int indexOfChild(TreeNodeValueModel<T> child);
/**
* Return whether the node is a leaf (i.e. it has no children)
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreePropertyValueModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreePropertyValueModelAdapter.java
new file mode 100644
index 0000000000..d0bcd1bbaf
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreePropertyValueModelAdapter.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.utility.internal.model.value;
+
+import org.eclipse.jpt.utility.internal.model.event.TreeChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.TreeChangeListener;
+
+/**
+ * This abstract class provides the infrastructure needed to wrap
+ * a tree value model, "lazily" listen to it, and convert
+ * its change notifications into property value model change
+ * notifications.
+ *
+ * Subclasses must override:
+ * - #buildValue()
+ * to return the current property value, as derived from the
+ * current collection value
+ *
+ * Subclasses might want to override:
+ * - #stateChanged(StateChangeEvent e)
+ * to improve performance (by not recalculating the value, if possible)
+ */
+public abstract class TreePropertyValueModelAdapter<T>
+ extends AspectPropertyValueModelAdapter<T>
+{
+ /** The wrapped tree value model. */
+ protected final TreeValueModel<?> treeHolder;
+
+ /** A listener that allows us to synch with changes to the wrapped tree holder. */
+ protected final TreeChangeListener treeChangeListener;
+
+
+ // ********** constructor/initialization **********
+
+ /**
+ * Construct a property value model with the specified wrapped
+ * tree value model.
+ */
+ protected TreePropertyValueModelAdapter(TreeValueModel<?> treeHolder) {
+ super();
+ this.treeHolder = treeHolder;
+ this.treeChangeListener = this.buildTreeChangeListener();
+ }
+
+ protected TreeChangeListener buildTreeChangeListener() {
+ return new TreeChangeListener() {
+ public void nodeAdded(TreeChangeEvent event) {
+ TreePropertyValueModelAdapter.this.nodeAdded(event);
+ }
+ public void nodeRemoved(TreeChangeEvent event) {
+ TreePropertyValueModelAdapter.this.nodeRemoved(event);
+ }
+ public void treeCleared(TreeChangeEvent event) {
+ TreePropertyValueModelAdapter.this.treeCleared(event);
+ }
+ public void treeChanged(TreeChangeEvent event) {
+ TreePropertyValueModelAdapter.this.treeChanged(event);
+ }
+ @Override
+ public String toString() {
+ return "tree change listener";
+ }
+ };
+ }
+
+
+ // ********** behavior **********
+
+ /**
+ * Start listening to the tree holder.
+ */
+ @Override
+ protected void engageModel_() {
+ this.treeHolder.addTreeChangeListener(this.treeChangeListener);
+ }
+
+ /**
+ * Stop listening to the tree holder.
+ */
+ @Override
+ protected void disengageModel_() {
+ this.treeHolder.removeTreeChangeListener(this.treeChangeListener);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.treeHolder);
+ }
+
+
+ // ********** state change support **********
+
+ /**
+ * Nodes were added to the wrapped tree holder;
+ * propagate the change notification appropriately.
+ */
+ protected void nodeAdded(TreeChangeEvent event) {
+ // by default, simply recalculate the value and fire an event
+ this.propertyChanged();
+ }
+
+ /**
+ * Nodes were removed from the wrapped tree holder;
+ * propagate the change notification appropriately.
+ */
+ protected void nodeRemoved(TreeChangeEvent event) {
+ // by default, simply recalculate the value and fire an event
+ this.propertyChanged();
+ }
+
+ /**
+ * The wrapped tree holder was cleared;
+ * propagate the change notification appropriately.
+ */
+ protected void treeCleared(TreeChangeEvent event) {
+ // by default, simply recalculate the value and fire an event
+ this.propertyChanged();
+ }
+
+ /**
+ * The wrapped tree holder changed;
+ * propagate the change notification appropriately.
+ */
+ protected void treeChanged(TreeChangeEvent event) {
+ // by default, simply recalculate the value and fire an event
+ this.propertyChanged();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreeValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreeValueModel.java
index f631a7174e..1affcd6faa 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreeValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/TreeValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -17,13 +17,13 @@ import org.eclipse.jpt.utility.internal.model.Model;
* Interface used to abstract tree accessing and
* change notification and make it more pluggable.
*/
-public interface TreeValueModel
+public interface TreeValueModel<E>
extends Model
{
/**
* Return the tree's nodes.
*/
- Iterator nodes();
+ Iterator<E> nodes();
String NODES = "nodes";
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueAspectAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueAspectAdapter.java
new file mode 100644
index 0000000000..34651e2c20
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueAspectAdapter.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.internal.model.value;
+
+import org.eclipse.jpt.utility.internal.model.ChangeSupport;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.StateChangeListener;
+
+/**
+ * Abstract model that provides behavior for wrapping a property
+ * value model and listening for changes to aspects of the *value* contained
+ * by the property value model. Changes to the actual value are also monitored.
+ *
+ * This is useful if you have a value that may change, but whose aspects can also
+ * change in a fashion that might be of interest to the client.
+ *
+ * NB: Clients will need to listen for two different change notifications: a property
+ * change event will be be fired when the value changes; a state change event
+ * will be fired when an aspect of the value changes.
+ *
+ * Subclasses need to override two methods:
+ *
+ * #engageValue_()
+ * begin listening to the appropriate aspect of the value and call
+ * #valueAspectChanged(Object) whenever the aspect changes
+ *
+ * #disengageValue_()
+ * stop listening to the appropriate aspect of the value
+ */
+public abstract class ValueAspectAdapter<T>
+ extends PropertyValueModelWrapper<T>
+ implements WritablePropertyValueModel<T>
+{
+ /** Cache the value so we can disengage. */
+ protected T value;
+
+
+ // ********** constructors/initialization **********
+
+ /**
+ * Constructor - the value holder is required.
+ */
+ protected ValueAspectAdapter(WritablePropertyValueModel<T> valueHolder) {
+ super(valueHolder);
+ }
+
+ @Override
+ protected void initialize() {
+ super.initialize();
+ this.value = null;
+ }
+
+ /**
+ * Override to allow both property value model change and state change
+ * listeners.
+ */
+ @Override
+ protected ChangeSupport buildChangeSupport() {
+ return new ChangeSupport(this);
+ }
+
+
+ // ********** PropertyValueModel implementation **********
+
+ public T value() {
+ return this.value;
+ }
+
+
+ // ********** WritablePropertyValueModel implementation **********
+
+ public void setValue(T value) {
+ this.valueHolder().setValue(value);
+ }
+
+
+ // ********** PropertyValueModelWrapper implementation **********
+
+ @Override
+ protected void valueChanged(PropertyChangeEvent e) {
+ this.disengageValue();
+ this.engageValue();
+ this.firePropertyChanged(e.cloneWithSource(this));
+ }
+
+
+ // ********** extend change support **********
+
+ @Override
+ public synchronized void addStateChangeListener(StateChangeListener listener) {
+ if (this.hasNoStateChangeListeners()) {
+ this.engageValue();
+ }
+ super.addStateChangeListener(listener);
+ }
+
+ @Override
+ public synchronized void removeStateChangeListener(StateChangeListener listener) {
+ super.removeStateChangeListener(listener);
+ if (this.hasNoStateChangeListeners()) {
+ this.disengageValue();
+ }
+ }
+
+
+ // ********** behavior **********
+
+ /**
+ * Start listening to the current value.
+ */
+ protected void engageValue() {
+ this.value = this.valueHolder.value();
+ if (this.value != null) {
+ this.engageValue_();
+ }
+ }
+
+ /**
+ * Start listening to the current value.
+ * At this point we can be sure that the value is not null.
+ */
+ protected abstract void engageValue_();
+
+ /**
+ * Stop listening to the current value.
+ */
+ protected void disengageValue() {
+ if (this.value != null) {
+ this.disengageValue_();
+ this.value = null;
+ }
+ }
+
+ /**
+ * Stop listening to the current value.
+ * At this point we can be sure that the value is not null.
+ */
+ protected abstract void disengageValue_();
+
+ /**
+ * Subclasses should call this method whenever the value's aspect changes.
+ */
+ protected void valueAspectChanged() {
+ this.fireStateChanged();
+ }
+
+ /**
+ * Our constructors accept only a WritablePropertyValueModel<T1>.
+ */
+ @SuppressWarnings("unchecked")
+ protected WritablePropertyValueModel<T> valueHolder() {
+ return (WritablePropertyValueModel<T>) this.valueHolder;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueCollectionAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueCollectionAdapter.java
new file mode 100644
index 0000000000..f56497b23c
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueCollectionAdapter.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.internal.model.value;
+
+import java.util.Arrays;
+
+import org.eclipse.jpt.utility.internal.model.Model;
+import org.eclipse.jpt.utility.internal.model.event.CollectionChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener;
+
+/**
+ * Extend ValueAspectAdapter to listen to one or more collection
+ * aspects of the value in the wrapped value model.
+ */
+public class ValueCollectionAdapter<T extends Model>
+ extends ValueAspectAdapter<T>
+{
+
+ /** The names of the value's collections that we listen to. */
+ protected final String[] collectionNames;
+
+ /** Listener that listens to the value. */
+ protected final CollectionChangeListener valueCollectionListener;
+
+
+ // ********** constructors **********
+
+ /**
+ * Construct an adapter for the specified value collections.
+ */
+ public ValueCollectionAdapter(WritablePropertyValueModel<T> valueHolder, String... collectionNames) {
+ super(valueHolder);
+ this.collectionNames = collectionNames;
+ this.valueCollectionListener = this.buildValueCollectionListener();
+ }
+
+
+ // ********** initialization **********
+
+ /**
+ * All we really care about is the fact that a Collection aspect has
+ * changed. Do the same thing no matter which event occurs.
+ */
+ protected CollectionChangeListener buildValueCollectionListener() {
+ return new CollectionChangeListener() {
+ public void itemsAdded(CollectionChangeEvent e) {
+ ValueCollectionAdapter.this.valueAspectChanged();
+ }
+ public void itemsRemoved(CollectionChangeEvent e) {
+ ValueCollectionAdapter.this.valueAspectChanged();
+ }
+ public void collectionCleared(CollectionChangeEvent e) {
+ ValueCollectionAdapter.this.valueAspectChanged();
+ }
+ public void collectionChanged(CollectionChangeEvent e) {
+ ValueCollectionAdapter.this.valueAspectChanged();
+ }
+ @Override
+ public String toString() {
+ return "value collection listener: " + Arrays.asList(ValueCollectionAdapter.this.collectionNames);
+ }
+ };
+ }
+
+ @Override
+ protected void engageValue_() {
+ for (String collectionName : this.collectionNames) {
+ this.value.addCollectionChangeListener(collectionName, this.valueCollectionListener);
+ }
+ }
+
+ @Override
+ protected void disengageValue_() {
+ for (String collectionName : this.collectionNames) {
+ this.value.removeCollectionChangeListener(collectionName, this.valueCollectionListener);
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueListAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueListAdapter.java
new file mode 100644
index 0000000000..c6c2fceda9
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueListAdapter.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.internal.model.value;
+
+import java.util.Arrays;
+
+import org.eclipse.jpt.utility.internal.model.Model;
+import org.eclipse.jpt.utility.internal.model.event.ListChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.ListChangeListener;
+
+/**
+ * Extend ValueAspectAdapter to listen to one or more list
+ * aspects of the value in the wrapped value model.
+ */
+public class ValueListAdapter<T extends Model>
+ extends ValueAspectAdapter<T>
+{
+
+ /** The names of the value's lists that we listen to. */
+ protected final String[] listNames;
+
+ /** Listener that listens to the value. */
+ protected final ListChangeListener valueListListener;
+
+
+ // ********** constructors **********
+
+ /**
+ * Construct an adapter for the specified value lists.
+ */
+ public ValueListAdapter(WritablePropertyValueModel<T> valueHolder, String... listNames) {
+ super(valueHolder);
+ this.listNames = listNames;
+ this.valueListListener = this.buildValueListListener();
+ }
+
+
+ // ********** initialization **********
+
+ /**
+ * All we really care about is the fact that a List aspect has
+ * changed. Do the same thing no matter which event occurs.
+ */
+ protected ListChangeListener buildValueListListener() {
+ return new ListChangeListener() {
+ public void itemsAdded(ListChangeEvent e) {
+ ValueListAdapter.this.valueAspectChanged();
+ }
+ public void itemsRemoved(ListChangeEvent e) {
+ ValueListAdapter.this.valueAspectChanged();
+ }
+ public void itemsReplaced(ListChangeEvent e) {
+ ValueListAdapter.this.valueAspectChanged();
+ }
+ public void itemsMoved(ListChangeEvent e) {
+ ValueListAdapter.this.valueAspectChanged();
+ }
+ public void listCleared(ListChangeEvent e) {
+ ValueListAdapter.this.valueAspectChanged();
+ }
+ public void listChanged(ListChangeEvent e) {
+ ValueListAdapter.this.valueAspectChanged();
+ }
+ @Override
+ public String toString() {
+ return "value list listener: " + Arrays.asList(ValueListAdapter.this.listNames);
+ }
+ };
+ }
+
+ @Override
+ protected void engageValue_() {
+ for (String listName : this.listNames) {
+ this.value.addListChangeListener(listName, this.valueListListener);
+ }
+ }
+
+ @Override
+ protected void disengageValue_() {
+ for (String listName : this.listNames) {
+ this.value.removeListChangeListener(listName, this.valueListListener);
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValuePropertyAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValuePropertyAdapter.java
new file mode 100644
index 0000000000..5fc1714744
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValuePropertyAdapter.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.internal.model.value;
+
+import java.util.Arrays;
+
+import org.eclipse.jpt.utility.internal.model.Model;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+
+/**
+ * Extend ValueAspectAdapter to listen to one or more
+ * properties of the value in the wrapped value model.
+ */
+public class ValuePropertyAdapter<T extends Model>
+ extends ValueAspectAdapter<T>
+{
+ /** The names of the value's properties that we listen to. */
+ protected final String[] propertyNames;
+
+ /** Listener that listens to the value. */
+ protected final PropertyChangeListener valuePropertyListener;
+
+
+ // ********** constructors **********
+
+ /**
+ * Construct an adapter for the specified value properties.
+ */
+ public ValuePropertyAdapter(WritablePropertyValueModel<T> valueHolder, String... propertyNames) {
+ super(valueHolder);
+ this.propertyNames = propertyNames;
+ this.valuePropertyListener = this.buildValuePropertyListener();
+ }
+
+
+ // ********** initialization **********
+
+ protected PropertyChangeListener buildValuePropertyListener() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent e) {
+ ValuePropertyAdapter.this.valueAspectChanged();
+ }
+ @Override
+ public String toString() {
+ return "value property listener: " + Arrays.asList(ValuePropertyAdapter.this.propertyNames);
+ }
+ };
+ }
+
+
+ // ********** behavior **********
+
+ @Override
+ protected void engageValue_() {
+ for (String propertyName : this.propertyNames) {
+ this.value.addPropertyChangeListener(propertyName, this.valuePropertyListener);
+ }
+ }
+
+ @Override
+ protected void disengageValue_() {
+ for (String propertyName : this.propertyNames) {
+ this.value.removePropertyChangeListener(propertyName, this.valuePropertyListener);
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueStateAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueStateAdapter.java
new file mode 100644
index 0000000000..b127dbcc69
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueStateAdapter.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.internal.model.value;
+
+import org.eclipse.jpt.utility.internal.model.Model;
+import org.eclipse.jpt.utility.internal.model.event.StateChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.StateChangeListener;
+
+/**
+ * Extend ValueAspectAdapter to listen to the
+ * "state" of the value in the wrapped value model.
+ */
+public class ValueStateAdapter<T extends Model>
+ extends ValueAspectAdapter<T>
+{
+ /** Listener that listens to value. */
+ protected final StateChangeListener valueStateListener;
+
+
+ // ********** constructors **********
+
+ /**
+ * Construct an adapter for the value state.
+ */
+ public ValueStateAdapter(WritablePropertyValueModel<T> valueHolder) {
+ super(valueHolder);
+ this.valueStateListener = this.buildValueStateListener();
+ }
+
+
+ // ********** initialization **********
+
+ protected StateChangeListener buildValueStateListener() {
+ return new StateChangeListener() {
+ public void stateChanged(StateChangeEvent e) {
+ ValueStateAdapter.this.valueAspectChanged();
+ }
+ @Override
+ public String toString() {
+ return "value state listener";
+ }
+ };
+ }
+
+
+ // ********** behavior **********
+
+ @Override
+ protected void engageValue_() {
+ this.value.addStateChangeListener(this.valueStateListener);
+ }
+
+ @Override
+ protected void disengageValue_() {
+ this.value.removeStateChangeListener(this.valueStateListener);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueTreeAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueTreeAdapter.java
new file mode 100644
index 0000000000..41e3148c2a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/ValueTreeAdapter.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.utility.internal.model.value;
+
+import java.util.Arrays;
+
+import org.eclipse.jpt.utility.internal.model.Model;
+import org.eclipse.jpt.utility.internal.model.event.TreeChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.TreeChangeListener;
+
+/**
+ * Extend ValueAspectAdapter to listen to one or more
+ * tree aspects of the value in the wrapped value model.
+ */
+public class ValueTreeAdapter<T extends Model>
+ extends ValueAspectAdapter<T>
+{
+ /** The names of the value's trees that we listen to. */
+ protected final String[] treeNames;
+
+ /** Listener that listens to the value. */
+ protected final TreeChangeListener valueTreeListener;
+
+
+ // ********** constructors **********
+
+ /**
+ * Construct an adapter for the specified value trees.
+ */
+ public ValueTreeAdapter(WritablePropertyValueModel<T> valueHolder, String... treeNames) {
+ super(valueHolder);
+ this.treeNames = treeNames;
+ this.valueTreeListener = this.buildValueTreeListener();
+ }
+
+
+ // ********** initialization **********
+
+ protected TreeChangeListener buildValueTreeListener() {
+ return new TreeChangeListener() {
+ public void nodeAdded(TreeChangeEvent event) {
+ ValueTreeAdapter.this.valueAspectChanged();
+ }
+ public void nodeRemoved(TreeChangeEvent event) {
+ ValueTreeAdapter.this.valueAspectChanged();
+ }
+ public void treeCleared(TreeChangeEvent event) {
+ ValueTreeAdapter.this.valueAspectChanged();
+ }
+ public void treeChanged(TreeChangeEvent event) {
+ ValueTreeAdapter.this.valueAspectChanged();
+ }
+ @Override
+ public String toString() {
+ return "value tree listener: " + Arrays.asList(ValueTreeAdapter.this.treeNames);
+ }
+ };
+ }
+
+
+ // ********** behavior **********
+
+ @Override
+ protected void engageValue_() {
+ for (String treeName : this.treeNames) {
+ this.value.addTreeChangeListener(treeName, this.valueTreeListener);
+ }
+ }
+
+ @Override
+ protected void disengageValue_() {
+ for (String treeName : this.treeNames) {
+ this.value.removeTreeChangeListener(treeName, this.valueTreeListener);
+ }
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/WritablePropertyValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/WritablePropertyValueModel.java
new file mode 100644
index 0000000000..91e819a3d0
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/WritablePropertyValueModel.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.utility.internal.model.value;
+
+/**
+ * Extend ValueModel to allow the setting of the property's value.
+ */
+public interface WritablePropertyValueModel<T>
+ extends PropertyValueModel<T>
+{
+
+ /**
+ * Set the value and fire a property change notification.
+ * @see PropertyValueModel#VALUE
+ */
+ void setValue(T value);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/prefs/PreferencePropertyValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/prefs/PreferencePropertyValueModel.java
index 2870c29412..c94a3758eb 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/prefs/PreferencePropertyValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/prefs/PreferencePropertyValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -17,9 +17,9 @@ import org.eclipse.jpt.utility.internal.BidiStringConverter;
import org.eclipse.jpt.utility.internal.model.listener.ChangeListener;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
import org.eclipse.jpt.utility.internal.model.value.AspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.StaticPropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ReadOnlyPropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
/**
* This adapter wraps a Preference and converts it into a PropertyValueModel.
@@ -44,8 +44,8 @@ import org.eclipse.jpt.utility.internal.model.value.ValueModel;
* rely on that event to keep our internally cached value in synch.
*/
public class PreferencePropertyValueModel<P>
- extends AspectAdapter
- implements PropertyValueModel
+ extends AspectAdapter<Preferences>
+ implements WritablePropertyValueModel<P>
{
/** The key to the preference we use for the value. */
protected final String key;
@@ -95,7 +95,7 @@ public class PreferencePropertyValueModel<P>
* the specified default value for the preference.
*/
public PreferencePropertyValueModel(Preferences preferences, String key, P defaultValue, BidiStringConverter<P> converter) {
- this(new ReadOnlyPropertyValueModel(preferences), key, defaultValue, converter);
+ this(new StaticPropertyValueModel<Preferences>(preferences), key, defaultValue, converter);
}
/**
@@ -128,7 +128,7 @@ public class PreferencePropertyValueModel<P>
* Construct an adapter for the specified preference.
* The default value of the preference will be null.
*/
- public PreferencePropertyValueModel(ValueModel preferencesHolder, String key) {
+ public PreferencePropertyValueModel(PropertyValueModel<? extends Preferences> preferencesHolder, String key) {
this(preferencesHolder, key, null);
}
@@ -136,7 +136,7 @@ public class PreferencePropertyValueModel<P>
* Construct an adapter for the specified preference with
* the specified default value for the preference.
*/
- public PreferencePropertyValueModel(ValueModel preferencesHolder, String key, P defaultValue) {
+ public PreferencePropertyValueModel(PropertyValueModel<? extends Preferences> preferencesHolder, String key, P defaultValue) {
this(preferencesHolder, key, defaultValue, BidiStringConverter.Default.<P>instance());
}
@@ -144,7 +144,7 @@ public class PreferencePropertyValueModel<P>
* Construct an adapter for the specified preference with
* the specified default value for the preference.
*/
- public PreferencePropertyValueModel(ValueModel preferencesHolder, String key, P defaultValue, BidiStringConverter<P> converter) {
+ public PreferencePropertyValueModel(PropertyValueModel<? extends Preferences> preferencesHolder, String key, P defaultValue, BidiStringConverter<P> converter) {
super(preferencesHolder);
this.key = key;
this.defaultValue = defaultValue;
@@ -180,23 +180,17 @@ public class PreferencePropertyValueModel<P>
* Return the cached (converted) value.
*/
@Override
- public synchronized Object value() {
+ public synchronized P value() {
return this.value;
}
// ********** PropertyValueModel implementation **********
- // TODO combine these methods when PropertyValueModel is parameterized
- @SuppressWarnings("unchecked")
- public synchronized void setValue(Object value) {
- this.setValue2((P) value);
- }
-
/**
* Set the cached value, then set the appropriate preference value.
*/
- protected void setValue2(P value) {
+ public synchronized void setValue(P value) {
if (this.hasNoListeners()) {
return; // no changes allowed when we have no listeners
}
@@ -234,15 +228,15 @@ public class PreferencePropertyValueModel<P>
}
@Override
- protected void engageNonNullSubject() {
- ((Preferences) this.subject).addPreferenceChangeListener(this.preferenceChangeListener);
+ protected void engageSubject_() {
+ this.subject.addPreferenceChangeListener(this.preferenceChangeListener);
this.value = this.buildValue();
}
@Override
- protected void disengageNonNullSubject() {
+ protected void disengageSubject_() {
try {
- ((Preferences) this.subject).removePreferenceChangeListener(this.preferenceChangeListener);
+ this.subject.removePreferenceChangeListener(this.preferenceChangeListener);
} catch (IllegalStateException ex) {
// for some odd reason, we are not allowed to remove a listener from a "dead"
// preferences node; so handle the exception that gets thrown here
@@ -270,7 +264,7 @@ public class PreferencePropertyValueModel<P>
/**
* Return the preference's key.
*/
- public String getKey() {
+ public String key() {
return this.key;
}
@@ -290,7 +284,7 @@ public class PreferencePropertyValueModel<P>
* At this point we can be sure that the subject is not null.
*/
protected P buildValue_() {
- return this.convertToObject(((Preferences) this.subject).get(this.key, this.convertToString(this.defaultValue)));
+ return this.convertToObject(this.subject.get(this.key, this.convertToString(this.defaultValue)));
}
/**
@@ -298,7 +292,7 @@ public class PreferencePropertyValueModel<P>
* At this point we can be sure that the subject is not null.
*/
protected void setValue_(P value) {
- ((Preferences) this.subject).put(this.key, this.convertToString(value));
+ this.subject.put(this.key, this.convertToString(value));
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/prefs/PreferencesCollectionValueModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/prefs/PreferencesCollectionValueModel.java
index a0a87ddbac..e30c0239be 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/prefs/PreferencesCollectionValueModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/prefs/PreferencesCollectionValueModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -22,21 +22,21 @@ import org.eclipse.jpt.utility.internal.model.listener.ChangeListener;
import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener;
import org.eclipse.jpt.utility.internal.model.value.AspectAdapter;
import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ReadOnlyPropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.StaticPropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
/**
* This adapter wraps a Preferences node and converts its preferences into a
* CollectionValueModel of PreferencePropertyValueModels. It listens for
* "preference" changes and converts them into VALUE collection changes.
*/
-public class PreferencesCollectionValueModel
- extends AspectAdapter
- implements CollectionValueModel
+public class PreferencesCollectionValueModel<P>
+ extends AspectAdapter<Preferences>
+ implements CollectionValueModel<PreferencePropertyValueModel<P>>
{
/** Cache the current preferences, stored in models and keyed by name. */
- protected final HashMap<String, PreferencePropertyValueModel> preferences;
+ protected final HashMap<String, PreferencePropertyValueModel<P>> preferences;
/** A listener that listens to the preferences node for added or removed preferences. */
protected final PreferenceChangeListener preferenceChangeListener;
@@ -48,15 +48,15 @@ public class PreferencesCollectionValueModel
* Construct an adapter for the specified preferences node.
*/
public PreferencesCollectionValueModel(Preferences preferences) {
- this(new ReadOnlyPropertyValueModel(preferences));
+ this(new StaticPropertyValueModel<Preferences>(preferences));
}
/**
* Construct an adapter for the specified preferences node.
*/
- public PreferencesCollectionValueModel(ValueModel preferencesHolder) {
+ public PreferencesCollectionValueModel(PropertyValueModel<? extends Preferences> preferencesHolder) {
super(preferencesHolder);
- this.preferences = new HashMap<String, PreferencePropertyValueModel>();
+ this.preferences = new HashMap<String, PreferencePropertyValueModel<P>>();
this.preferenceChangeListener = this.buildPreferenceChangeListener();
}
@@ -85,7 +85,7 @@ public class PreferencesCollectionValueModel
/**
* Return an iterator on the preference models.
*/
- public synchronized Iterator<PreferencePropertyValueModel> iterator() {
+ public synchronized Iterator<PreferencePropertyValueModel<P>> iterator() {
return this.preferences.values().iterator();
}
@@ -122,18 +122,18 @@ public class PreferencesCollectionValueModel
}
@Override
- protected void engageNonNullSubject() {
- ((Preferences) this.subject).addPreferenceChangeListener(this.preferenceChangeListener);
- for (Iterator<PreferencePropertyValueModel> stream = this.preferenceModels(); stream.hasNext(); ) {
- PreferencePropertyValueModel preferenceModel = stream.next();
- this.preferences.put(preferenceModel.getKey(), preferenceModel);
+ protected void engageSubject_() {
+ this.subject.addPreferenceChangeListener(this.preferenceChangeListener);
+ for (Iterator<PreferencePropertyValueModel<P>> stream = this.preferenceModels(); stream.hasNext(); ) {
+ PreferencePropertyValueModel<P> preferenceModel = stream.next();
+ this.preferences.put(preferenceModel.key(), preferenceModel);
}
}
@Override
- protected void disengageNonNullSubject() {
+ protected void disengageSubject_() {
try {
- ((Preferences) this.subject).removePreferenceChangeListener(this.preferenceChangeListener);
+ this.subject.removePreferenceChangeListener(this.preferenceChangeListener);
} catch (IllegalStateException ex) {
// for some odd reason, we are not allowed to remove a listener from a "dead"
// preferences node; so handle the exception that gets thrown here
@@ -160,16 +160,16 @@ public class PreferencesCollectionValueModel
* Return an iterator on the preference models.
* At this point we can be sure that the subject is not null.
*/
- protected Iterator<PreferencePropertyValueModel> preferenceModels() {
+ protected Iterator<PreferencePropertyValueModel<P>> preferenceModels() {
String[] keys;
try {
- keys = ((Preferences) this.subject).keys();
+ keys = this.subject.keys();
} catch (BackingStoreException ex) {
throw new RuntimeException(ex);
}
- return new TransformationIterator<String, PreferencePropertyValueModel>(new ArrayIterator<String>(keys)) {
+ return new TransformationIterator<String, PreferencePropertyValueModel<P>>(new ArrayIterator<String>(keys)) {
@Override
- protected PreferencePropertyValueModel transform(String key) {
+ protected PreferencePropertyValueModel<P> transform(String key) {
return PreferencesCollectionValueModel.this.buildPreferenceModel(key);
}
};
@@ -179,18 +179,18 @@ public class PreferencesCollectionValueModel
* Override this method to tweak the model used to wrap the
* specified preference (e.g. to customize the model's converter).
*/
- protected PreferencePropertyValueModel buildPreferenceModel(String key) {
- return new PreferencePropertyValueModel(this.subjectHolder, key);
+ protected PreferencePropertyValueModel<P> buildPreferenceModel(String key) {
+ return new PreferencePropertyValueModel<P>(this.subjectHolder, key);
}
protected synchronized void preferenceChanged(String key, String newValue) {
if (newValue == null) {
// a preference was removed
- PreferencePropertyValueModel preferenceModel = this.preferences.remove(key);
+ PreferencePropertyValueModel<P> preferenceModel = this.preferences.remove(key);
this.fireItemRemoved(VALUES, preferenceModel);
} else if ( ! this.preferences.containsKey(key)) {
// a preference was added
- PreferencePropertyValueModel preferenceModel = this.buildPreferenceModel(key);
+ PreferencePropertyValueModel<P> preferenceModel = this.buildPreferenceModel(key);
this.preferences.put(key, preferenceModel);
this.fireItemAdded(VALUES, preferenceModel);
} else {
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/AbstractTreeModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/AbstractTreeModel.java
index 725ed6acc9..b16f57df22 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/AbstractTreeModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/AbstractTreeModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -55,7 +55,7 @@ public abstract class AbstractTreeModel
* (There seems to be a pattern of making this type of method public;
* although it should probably be protected....)
*/
- public TreeModelListener[] getTreeModelListeners() {
+ public TreeModelListener[] treeModelListeners() {
return this.listenerList.getListeners(TreeModelListener.class);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/CheckBoxModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/CheckBoxModelAdapter.java
index 23bf3b68d8..6b669adb6a 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/CheckBoxModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/CheckBoxModelAdapter.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.model.value.swing;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
/**
* This javax.swing.ButtonModel can be used to keep a listener
@@ -28,7 +28,7 @@ public class CheckBoxModelAdapter
/**
* Constructor - the boolean holder is required.
*/
- public CheckBoxModelAdapter(PropertyValueModel booleanHolder, boolean defaultValue) {
+ public CheckBoxModelAdapter(WritablePropertyValueModel<Boolean> booleanHolder, boolean defaultValue) {
super(booleanHolder, defaultValue);
}
@@ -36,7 +36,7 @@ public class CheckBoxModelAdapter
* Constructor - the boolean holder is required.
* The default value will be false.
*/
- public CheckBoxModelAdapter(PropertyValueModel booleanHolder) {
+ public CheckBoxModelAdapter(WritablePropertyValueModel<Boolean> booleanHolder) {
super(booleanHolder);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ColumnAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ColumnAdapter.java
index 62bcde0692..f61e26b2ef 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ColumnAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ColumnAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.utility.internal.model.value.swing;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
/**
@@ -22,28 +22,28 @@ public interface ColumnAdapter {
* Return the number of columns in the table.
* Typically this is static.
*/
- int getColumnCount();
+ int columnCount();
/**
* Return the name of the specified column.
*/
- String getColumnName(int index);
+ String columnName(int index);
/**
* Return the class of the specified column.
*/
- Class<?> getColumnClass(int index);
+ Class<?> columnClass(int index);
/**
* Return whether the specified column is editable.
* Typically this is the same for every row.
*/
- boolean isColumnEditable(int index);
+ boolean columnIsEditable(int index);
/**
* Return the cell models for the specified subject
* that corresponds to a single row in the table.
*/
- PropertyValueModel[] cellModels(Object subject);
+ WritablePropertyValueModel<Object>[] cellModels(Object subject);
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ComboBoxModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ComboBoxModelAdapter.java
index 3bf1c27b3c..f09e4a3a90 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ComboBoxModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ComboBoxModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -17,8 +17,8 @@ import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
import org.eclipse.jpt.utility.internal.model.listener.awt.AWTPropertyChangeListenerWrapper;
import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
/**
* This javax.swing.ComboBoxModel can be used to keep a ListDataListener
@@ -43,7 +43,7 @@ public class ComboBoxModelAdapter
extends ListModelAdapter
implements ComboBoxModel
{
- protected final PropertyValueModel selectionHolder;
+ protected final WritablePropertyValueModel<Object> selectionHolder;
protected final PropertyChangeListener selectionListener;
@@ -52,7 +52,7 @@ public class ComboBoxModelAdapter
/**
* Constructor - the list holder and selection holder are required;
*/
- public ComboBoxModelAdapter(ListValueModel listHolder, PropertyValueModel selectionHolder) {
+ public ComboBoxModelAdapter(ListValueModel<?> listHolder, WritablePropertyValueModel<Object> selectionHolder) {
super(listHolder);
if (selectionHolder == null) {
throw new NullPointerException();
@@ -64,7 +64,7 @@ public class ComboBoxModelAdapter
/**
* Constructor - the collection holder and selection holder are required;
*/
- public ComboBoxModelAdapter(CollectionValueModel collectionHolder, PropertyValueModel selectionHolder) {
+ public ComboBoxModelAdapter(CollectionValueModel<?> collectionHolder, WritablePropertyValueModel<Object> selectionHolder) {
super(collectionHolder);
if (selectionHolder == null) {
throw new NullPointerException();
@@ -113,7 +113,7 @@ public class ComboBoxModelAdapter
@Override
protected void engageModel() {
super.engageModel();
- this.selectionHolder.addPropertyChangeListener(ValueModel.VALUE, this.selectionListener);
+ this.selectionHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.selectionListener);
}
/**
@@ -121,7 +121,7 @@ public class ComboBoxModelAdapter
*/
@Override
protected void disengageModel() {
- this.selectionHolder.removePropertyChangeListener(ValueModel.VALUE, this.selectionListener);
+ this.selectionHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.selectionListener);
super.disengageModel();
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/DateSpinnerModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/DateSpinnerModelAdapter.java
index 1910a01055..d289b38211 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/DateSpinnerModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/DateSpinnerModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -19,8 +19,8 @@ import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
import org.eclipse.jpt.utility.internal.model.listener.awt.AWTPropertyChangeListenerWrapper;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
/**
* This javax.swing.SpinnerDateModel can be used to keep a ChangeListener
@@ -46,7 +46,7 @@ public class DateSpinnerModelAdapter
private final Date defaultValue;
/** A value model on the underlying date. */
- private final PropertyValueModel dateHolder;
+ private final WritablePropertyValueModel<Object> dateHolder;
/** A listener that allows us to synchronize with changes made to the underlying date. */
private final PropertyChangeListener dateChangeListener;
@@ -58,14 +58,14 @@ public class DateSpinnerModelAdapter
* Constructor - the date holder is required.
* The default spinner value is the current date.
*/
- public DateSpinnerModelAdapter(PropertyValueModel dateHolder) {
+ public DateSpinnerModelAdapter(WritablePropertyValueModel<Object> dateHolder) {
this(dateHolder, new Date());
}
/**
* Constructor - the date holder and default value are required.
*/
- public DateSpinnerModelAdapter(PropertyValueModel dateHolder, Date defaultValue) {
+ public DateSpinnerModelAdapter(WritablePropertyValueModel<Object> dateHolder, Date defaultValue) {
this(dateHolder, null, null, Calendar.DAY_OF_MONTH, defaultValue);
}
@@ -73,14 +73,14 @@ public class DateSpinnerModelAdapter
* Constructor - the date holder is required.
* The default spinner value is the current date.
*/
- public DateSpinnerModelAdapter(PropertyValueModel dateHolder, Comparable start, Comparable end, int calendarField) {
+ public DateSpinnerModelAdapter(WritablePropertyValueModel<Object> dateHolder, Comparable<?> start, Comparable<?> end, int calendarField) {
this(dateHolder, start, end, calendarField, new Date());
}
/**
* Constructor - the date holder is required.
*/
- public DateSpinnerModelAdapter(PropertyValueModel dateHolder, Comparable start, Comparable end, int calendarField, Date defaultValue) {
+ public DateSpinnerModelAdapter(WritablePropertyValueModel<Object> dateHolder, Comparable<?> start, Comparable<?> end, int calendarField, Date defaultValue) {
super(dateHolder.value() == null ? defaultValue : (Date) dateHolder.value(), start, end, calendarField);
this.dateHolder = dateHolder;
this.dateChangeListener = this.buildDateChangeListener();
@@ -143,7 +143,7 @@ public class DateSpinnerModelAdapter
@Override
public void addChangeListener(ChangeListener listener) {
if (this.getChangeListeners().length == 0) {
- this.dateHolder.addPropertyChangeListener(ValueModel.VALUE, this.dateChangeListener);
+ this.dateHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.dateChangeListener);
this.synchronize(this.dateHolder.value());
}
super.addChangeListener(listener);
@@ -156,7 +156,7 @@ public class DateSpinnerModelAdapter
public void removeChangeListener(ChangeListener listener) {
super.removeChangeListener(listener);
if (this.getChangeListeners().length == 0) {
- this.dateHolder.removePropertyChangeListener(ValueModel.VALUE, this.dateChangeListener);
+ this.dateHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.dateChangeListener);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/DocumentAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/DocumentAdapter.java
index 6eaba6cf99..48378b66be 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/DocumentAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/DocumentAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -29,8 +29,8 @@ import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
import org.eclipse.jpt.utility.internal.model.listener.awt.AWTPropertyChangeListenerWrapper;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
/**
* This javax.swing.text.Document can be used to keep a DocumentListener
@@ -51,7 +51,7 @@ public class DocumentAdapter
protected final CombinedListener delegateListener;
/** A value model on the underlying model string. */
- protected final PropertyValueModel stringHolder;
+ protected final WritablePropertyValueModel<String> stringHolder;
/** A listener that allows us to synchronize with changes made to the underlying model string. */
protected final PropertyChangeListener stringListener;
@@ -66,7 +66,7 @@ public class DocumentAdapter
* Constructor - the string holder is required.
* Wrap the specified document.
*/
- public DocumentAdapter(PropertyValueModel stringHolder, Document delegate) {
+ public DocumentAdapter(WritablePropertyValueModel<String> stringHolder, Document delegate) {
super();
if (stringHolder == null || delegate == null) {
throw new NullPointerException();
@@ -83,7 +83,7 @@ public class DocumentAdapter
* Constructor - the string holder is required.
* Wrap a plain document.
*/
- public DocumentAdapter(PropertyValueModel stringHolder) {
+ public DocumentAdapter(WritablePropertyValueModel<String> stringHolder) {
this(stringHolder, new PlainDocument());
}
@@ -220,11 +220,11 @@ public class DocumentAdapter
// ********** queries **********
- public DocumentListener[] getDocumentListeners() {
+ public DocumentListener[] documentListeners() {
return this.listenerList.getListeners(DocumentListener.class);
}
- public UndoableEditListener[] getUndoableEditListeners() {
+ public UndoableEditListener[] undoableEditListeners() {
return this.listenerList.getListeners(UndoableEditListener.class);
}
@@ -257,19 +257,19 @@ public class DocumentAdapter
}
protected void engageStringHolder() {
- this.stringHolder.addPropertyChangeListener(ValueModel.VALUE, this.stringListener);
- this.synchronizeDelegate((String) this.stringHolder.value());
+ this.stringHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.stringListener);
+ this.synchronizeDelegate(this.stringHolder.value());
}
protected void disengageStringHolder() {
- this.stringHolder.removePropertyChangeListener(ValueModel.VALUE, this.stringListener);
+ this.stringHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.stringListener);
}
protected void delegateChangedUpdate(DocumentEvent e) {
// no need to lazy-initialize the event;
// we wouldn't get here if we did not have listeners...
DocumentEvent ee = new InternalDocumentEvent(this, e);
- DocumentListener[] listeners = this.getDocumentListeners();
+ DocumentListener[] listeners = this.documentListeners();
for (int i = listeners.length; i-- > 0; ) {
listeners[i].changedUpdate(ee);
}
@@ -279,7 +279,7 @@ public class DocumentAdapter
// no need to lazy-initialize the event;
// we wouldn't get here if we did not have listeners...
DocumentEvent ee = new InternalDocumentEvent(this, e);
- DocumentListener[] listeners = this.getDocumentListeners();
+ DocumentListener[] listeners = this.documentListeners();
for (int i = listeners.length; i-- > 0; ) {
listeners[i].insertUpdate(ee);
}
@@ -289,7 +289,7 @@ public class DocumentAdapter
// no need to lazy-initialize the event;
// we wouldn't get here if we did not have listeners...
DocumentEvent ee = new InternalDocumentEvent(this, e);
- DocumentListener[] listeners = this.getDocumentListeners();
+ DocumentListener[] listeners = this.documentListeners();
for (int i = listeners.length; i-- > 0; ) {
listeners[i].removeUpdate(ee);
}
@@ -299,7 +299,7 @@ public class DocumentAdapter
// no need to lazy-initialize the event;
// we wouldn't get here if we did not have listeners...
UndoableEditEvent ee = new UndoableEditEvent(this, e.getEdit());
- UndoableEditListener[] listeners = this.getUndoableEditListeners();
+ UndoableEditListener[] listeners = this.undoableEditListeners();
for (int i = listeners.length; i-- > 0; ) {
listeners[i].undoableEditHappened(ee);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ListModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ListModelAdapter.java
index b83d5ca3dd..5e691b92a3 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ListModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ListModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -33,7 +33,7 @@ public class ListModelAdapter
extends AbstractListModel
{
/** A value model on the underlying model list. */
- protected ListValueModel listHolder;
+ protected ListValueModel<?> listHolder;
/**
* Cache the size of the list for "dramatic" changes.
@@ -59,7 +59,7 @@ public class ListModelAdapter
/**
* Constructor - the list holder is required.
*/
- public ListModelAdapter(ListValueModel listHolder) {
+ public ListModelAdapter(ListValueModel<?> listHolder) {
this();
this.setModel(listHolder);
}
@@ -67,7 +67,7 @@ public class ListModelAdapter
/**
* Constructor - the collection holder is required.
*/
- public ListModelAdapter(CollectionValueModel collectionHolder) {
+ public ListModelAdapter(CollectionValueModel<?> collectionHolder) {
this();
this.setModel(collectionHolder);
}
@@ -147,14 +147,14 @@ public class ListModelAdapter
/**
* Return the underlying list model.
*/
- public ListValueModel getModel() {
+ public ListValueModel<?> model() {
return this.listHolder;
}
/**
* Set the underlying list model.
*/
- public void setModel(ListValueModel listHolder) {
+ public void setModel(ListValueModel<?> listHolder) {
if (listHolder == null) {
throw new NullPointerException();
}
@@ -172,7 +172,8 @@ public class ListModelAdapter
/**
* Set the underlying collection model.
*/
- public void setModel(CollectionValueModel collectionHolder) {
+ @SuppressWarnings("unchecked")
+ public void setModel(CollectionValueModel<?> collectionHolder) {
this.setModel(new CollectionListValueModelAdapter(collectionHolder));
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ListSpinnerModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ListSpinnerModelAdapter.java
index 9923074181..37a750001d 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ListSpinnerModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ListSpinnerModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -19,8 +19,8 @@ import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
import org.eclipse.jpt.utility.internal.model.listener.awt.AWTPropertyChangeListenerWrapper;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
/**
* This javax.swing.SpinnerListModel can be used to keep a ChangeListener
@@ -51,7 +51,7 @@ public class ListSpinnerModelAdapter
private final Object defaultValue;
/** A value model on the underlying value. */
- private final PropertyValueModel valueHolder;
+ private final WritablePropertyValueModel<Object> valueHolder;
/** A listener that allows us to synchronize with changes made to the underlying value. */
private final PropertyChangeListener valueChangeListener;
@@ -63,14 +63,14 @@ public class ListSpinnerModelAdapter
* Constructor - the value holder is required.
* Use the model value itself as the default spinner value.
*/
- public ListSpinnerModelAdapter(PropertyValueModel valueHolder) {
+ public ListSpinnerModelAdapter(WritablePropertyValueModel<Object> valueHolder) {
this(valueHolder, valueHolder.value());
}
/**
* Constructor - the value holder is required.
*/
- public ListSpinnerModelAdapter(PropertyValueModel valueHolder, Object defaultValue) {
+ public ListSpinnerModelAdapter(WritablePropertyValueModel<Object> valueHolder, Object defaultValue) {
this(valueHolder, new Object[] {defaultValue}, defaultValue);
}
@@ -78,14 +78,14 @@ public class ListSpinnerModelAdapter
* Constructor - the value holder is required.
* Use the first item in the list of values as the default spinner value.
*/
- public ListSpinnerModelAdapter(PropertyValueModel valueHolder, Object[] values) {
+ public ListSpinnerModelAdapter(WritablePropertyValueModel<Object> valueHolder, Object[] values) {
this(valueHolder, values, values[0]);
}
/**
* Constructor - the value holder is required.
*/
- public ListSpinnerModelAdapter(PropertyValueModel valueHolder, Object[] values, Object defaultValue) {
+ public ListSpinnerModelAdapter(WritablePropertyValueModel<Object> valueHolder, Object[] values, Object defaultValue) {
this(valueHolder, Arrays.asList(values), defaultValue);
}
@@ -93,14 +93,14 @@ public class ListSpinnerModelAdapter
* Constructor - the value holder is required.
* Use the first item in the list of values as the default spinner value.
*/
- public ListSpinnerModelAdapter(PropertyValueModel valueHolder, List values) {
+ public ListSpinnerModelAdapter(WritablePropertyValueModel<Object> valueHolder, List<Object> values) {
this(valueHolder, values, values.get(0));
}
/**
* Constructor - the value holder is required.
*/
- public ListSpinnerModelAdapter(PropertyValueModel valueHolder, List values, Object defaultValue) {
+ public ListSpinnerModelAdapter(WritablePropertyValueModel<Object> valueHolder, List<Object> values, Object defaultValue) {
super(values);
this.valueHolder = valueHolder;
this.valueChangeListener = this.buildValueChangeListener();
@@ -163,7 +163,7 @@ public class ListSpinnerModelAdapter
@Override
public void addChangeListener(ChangeListener listener) {
if (this.getChangeListeners().length == 0) {
- this.valueHolder.addPropertyChangeListener(ValueModel.VALUE, this.valueChangeListener);
+ this.valueHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.valueChangeListener);
this.synchronize(this.valueHolder.value());
}
super.addChangeListener(listener);
@@ -176,7 +176,7 @@ public class ListSpinnerModelAdapter
public void removeChangeListener(ChangeListener listener) {
super.removeChangeListener(listener);
if (this.getChangeListeners().length == 0) {
- this.valueHolder.removePropertyChangeListener(ValueModel.VALUE, this.valueChangeListener);
+ this.valueHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.valueChangeListener);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/NumberSpinnerModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/NumberSpinnerModelAdapter.java
index d7a49e85b5..86820054ac 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/NumberSpinnerModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/NumberSpinnerModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -16,8 +16,8 @@ import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
import org.eclipse.jpt.utility.internal.model.listener.awt.AWTPropertyChangeListenerWrapper;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
/**
* This javax.swing.SpinnerNumberModel can be used to keep a ChangeListener
@@ -43,7 +43,7 @@ public class NumberSpinnerModelAdapter
private final Number defaultValue;
/** A value model on the underlying number. */
- private final PropertyValueModel numberHolder;
+ private final WritablePropertyValueModel<Number> numberHolder;
/**
* A listener that allows us to synchronize with
@@ -59,7 +59,7 @@ public class NumberSpinnerModelAdapter
* The default spinner value is zero.
* The step size is one.
*/
- public NumberSpinnerModelAdapter(PropertyValueModel numberHolder) {
+ public NumberSpinnerModelAdapter(WritablePropertyValueModel<Number> numberHolder) {
this(numberHolder, 0);
}
@@ -67,7 +67,7 @@ public class NumberSpinnerModelAdapter
* Constructor - the number holder is required.
* The step size is one.
*/
- public NumberSpinnerModelAdapter(PropertyValueModel numberHolder, int defaultValue) {
+ public NumberSpinnerModelAdapter(WritablePropertyValueModel<Number> numberHolder, int defaultValue) {
this(numberHolder, null, null, new Integer(1), new Integer(defaultValue));
}
@@ -75,14 +75,14 @@ public class NumberSpinnerModelAdapter
* Constructor - the number holder is required.
* Use the minimum value as the default spinner value.
*/
- public NumberSpinnerModelAdapter(PropertyValueModel numberHolder, int minimum, int maximum, int stepSize) {
+ public NumberSpinnerModelAdapter(WritablePropertyValueModel<Number> numberHolder, int minimum, int maximum, int stepSize) {
this(numberHolder, minimum, maximum, stepSize, minimum);
}
/**
* Constructor - the number holder is required.
*/
- public NumberSpinnerModelAdapter(PropertyValueModel numberHolder, int minimum, int maximum, int stepSize, int defaultValue) {
+ public NumberSpinnerModelAdapter(WritablePropertyValueModel<Number> numberHolder, int minimum, int maximum, int stepSize, int defaultValue) {
this(numberHolder, new Integer(minimum), new Integer(maximum), new Integer(stepSize), new Integer(defaultValue));
}
@@ -90,21 +90,21 @@ public class NumberSpinnerModelAdapter
* Constructor - the number holder is required.
* Use the minimum value as the default spinner value.
*/
- public NumberSpinnerModelAdapter(PropertyValueModel numberHolder, double value, double minimum, double maximum, double stepSize) {
+ public NumberSpinnerModelAdapter(WritablePropertyValueModel<Number> numberHolder, double value, double minimum, double maximum, double stepSize) {
this(numberHolder, value, minimum, maximum, stepSize, minimum);
}
/**
* Constructor - the number holder is required.
*/
- public NumberSpinnerModelAdapter(PropertyValueModel numberHolder, double value, double minimum, double maximum, double stepSize, double defaultValue) {
+ public NumberSpinnerModelAdapter(WritablePropertyValueModel<Number> numberHolder, double value, double minimum, double maximum, double stepSize, double defaultValue) {
this(numberHolder, new Double(minimum), new Double(maximum), new Double(stepSize), new Double(defaultValue));
}
/**
* Constructor - the number holder is required.
*/
- public NumberSpinnerModelAdapter(PropertyValueModel numberHolder, Comparable minimum, Comparable maximum, Number stepSize, Number defaultValue) {
+ public NumberSpinnerModelAdapter(WritablePropertyValueModel<Number> numberHolder, Comparable<?> minimum, Comparable<?> maximum, Number stepSize, Number defaultValue) {
super(numberHolder.value() == null ? defaultValue : (Number) numberHolder.value(), minimum, maximum, stepSize);
this.numberHolder = numberHolder;
this.numberChangeListener = this.buildNumberChangeListener();
@@ -158,7 +158,7 @@ public class NumberSpinnerModelAdapter
@Override
public void setValue(Object value) {
super.setValue(value);
- this.numberHolder.setValue(value);
+ this.numberHolder.setValue((Number) value);
}
/**
@@ -167,7 +167,7 @@ public class NumberSpinnerModelAdapter
@Override
public void addChangeListener(ChangeListener listener) {
if (this.getChangeListeners().length == 0) {
- this.numberHolder.addPropertyChangeListener(ValueModel.VALUE, this.numberChangeListener);
+ this.numberHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.numberChangeListener);
this.synchronize(this.numberHolder.value());
}
super.addChangeListener(listener);
@@ -180,7 +180,7 @@ public class NumberSpinnerModelAdapter
public void removeChangeListener(ChangeListener listener) {
super.removeChangeListener(listener);
if (this.getChangeListeners().length == 0) {
- this.numberHolder.removePropertyChangeListener(ValueModel.VALUE, this.numberChangeListener);
+ this.numberHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.numberChangeListener);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ObjectListSelectionModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ObjectListSelectionModel.java
index a02eb1af55..a1d0437682 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ObjectListSelectionModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ObjectListSelectionModel.java
@@ -1,23 +1,22 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.utility.internal.model.value.swing;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
-
import javax.swing.DefaultListSelectionModel;
import javax.swing.ListModel;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionListener;
-
import org.eclipse.jpt.utility.internal.CollectionTools;
/**
@@ -71,7 +70,7 @@ public class ObjectListSelectionModel
* Typically, the selection does not need to be cleared when the
* contents of the list have changed. Most of the time this just
* means an item has changed in a way that affects its display string
- * or icon. We typically only use the class for edits involving
+ * or icon. We typically only use the class for edits involving
* single selection.
* A subclass can override this method if the selection
* should be cleared because a change could mean the selection is invalid.
@@ -108,15 +107,15 @@ public class ObjectListSelectionModel
protected boolean hasNoListSelectionListeners() { // private-protected
return this.getListSelectionListeners().length == 0;
}
-
+
/**
* Return the list model referenced by the list selection model.
*/
- public ListModel getListModel() {
+ public ListModel listModel() {
return this.listModel;
}
- public int getSelectedValuesSize() {
+ public int selectedValuesSize() {
int min = this.getMinSelectionIndex();
int max = this.getMaxSelectionIndex();
@@ -125,7 +124,7 @@ public class ObjectListSelectionModel
}
int n = 0;
- int count = this.getListModel().getSize();
+ int count = this.listModel().getSize();
for (int i = min; i <= max; i++) {
if (this.isSelectedIndex(i) && (i < count)) {
n++;
@@ -138,21 +137,21 @@ public class ObjectListSelectionModel
* Return the first selected value.
* Return null if the selection is empty.
*/
- public Object getSelectedValue() {
+ public Object selectedValue() {
int index = this.getMinSelectionIndex();
if (index == -1) {
return null;
}
- if (this.getListModel().getSize() <= index) {
+ if (this.listModel().getSize() <= index) {
return null;
}
- return this.getListModel().getElementAt(index);
+ return this.listModel().getElementAt(index);
}
/**
* Return an array of the selected values.
*/
- public Object[] getSelectedValues() {
+ public Object[] selectedValues() {
int min = this.getMinSelectionIndex();
int max = this.getMaxSelectionIndex();
@@ -163,10 +162,10 @@ public class ObjectListSelectionModel
int maxSize = (max - min) + 1;
Object[] temp = new Object[maxSize];
int n = 0;
- int count = this.getListModel().getSize();
+ int count = this.listModel().getSize();
for (int i = min; i <= max; i++) {
if (this.isSelectedIndex(i) && (i < count)) {
- temp[n++] = this.getListModel().getElementAt(i);
+ temp[n++] = this.listModel().getElementAt(i);
}
}
if (n == maxSize) {
@@ -180,6 +179,38 @@ public class ObjectListSelectionModel
}
/**
+ * Return an array of the selected indices in ordered.
+ */
+ public int[] selectedIndices() {
+ int min = this.getMinSelectionIndex();
+ int max = this.getMaxSelectionIndex();
+
+ if ((min < 0) || (max < 0)) {
+ return new int[0];
+ }
+
+ int maxSize = (max - min) + 1;
+ int[] temp = new int[maxSize];
+ int n = 0;
+ int count = this.listModel().getSize();
+ for (int i = min; i <= max; i++) {
+ if (this.isSelectedIndex(i) && (i < count)) {
+ temp[n++] = i;
+ }
+ }
+ if (n == maxSize) {
+ // all the elements in the range were selected
+ Arrays.sort(temp);
+ return temp;
+ }
+ // only some of the elements in the range were selected
+ int[] result = new int[n];
+ System.arraycopy(temp, 0, result, 0, n);
+ Arrays.sort(result);
+ return result;
+ }
+
+ /**
* Set the selected value.
*/
public void setSelectedValue(Object object) {
@@ -190,7 +221,7 @@ public class ObjectListSelectionModel
* Set the current set of selected objects to the specified objects.
* @see javax.swing.ListSelectionModel#setSelectionInterval(int, int)
*/
- public void setSelectedValues(Iterator objects) {
+ public void setSelectedValues(Iterator<?> objects) {
this.setValueIsAdjusting(true);
this.clearSelection();
this.addSelectedValuesInternal(objects);
@@ -201,10 +232,10 @@ public class ObjectListSelectionModel
* Set the current set of selected objects to the specified objects.
* @see javax.swing.ListSelectionModel#setSelectionInterval(int, int)
*/
- public void setSelectedValues(Collection objects) {
+ public void setSelectedValues(Collection<?> objects) {
this.setSelectedValues(objects.iterator());
}
-
+
/**
* Set the current set of selected objects to the specified objects.
* @see javax.swing.ListSelectionModel#setSelectionInterval(int, int)
@@ -225,20 +256,20 @@ public class ObjectListSelectionModel
* Add the specified objects to the current set of selected objects.
* @see javax.swing.ListSelectionModel#addSelectionInterval(int, int)
*/
- public void addSelectedValues(Iterator objects) {
+ public void addSelectedValues(Iterator<?> objects) {
this.setValueIsAdjusting(true);
this.addSelectedValuesInternal(objects);
this.setValueIsAdjusting(false);
}
-
+
/**
* Add the specified objects to the current set of selected objects.
* @see javax.swing.ListSelectionModel#addSelectionInterval(int, int)
*/
- public void addSelectedValues(Collection objects) {
+ public void addSelectedValues(Collection<?> objects) {
this.addSelectedValues(objects.iterator());
}
-
+
/**
* Add the specified objects to the current set of selected objects.
* @see javax.swing.ListSelectionModel#addSelectionInterval(int, int)
@@ -246,7 +277,7 @@ public class ObjectListSelectionModel
public void addSelectedValues(Object[] objects) {
this.addSelectedValues(CollectionTools.iterator(objects));
}
-
+
/**
* Remove the specified object from the current set of selected objects.
* @see javax.swing.ListSelectionModel#removeSelectionInterval(int, int)
@@ -259,9 +290,9 @@ public class ObjectListSelectionModel
* Remove the specified objects from the current set of selected objects.
* @see javax.swing.ListSelectionModel#removeSelectionInterval(int, int)
*/
- public void removeSelectedValues(Iterator objects) {
+ public void removeSelectedValues(Iterator<?> objects) {
this.setValueIsAdjusting(true);
- ListModel lm = this.getListModel();
+ ListModel lm = this.listModel();
int lmSize = lm.getSize();
while (objects.hasNext()) {
int index = this.indexOf(objects.next(), lm, lmSize);
@@ -269,15 +300,15 @@ public class ObjectListSelectionModel
}
this.setValueIsAdjusting(false);
}
-
+
/**
* Remove the specified objects from the current set of selected objects.
* @see javax.swing.ListSelectionModel#removeSelectionInterval(int, int)
*/
- public void removeSelectedValues(Collection objects) {
+ public void removeSelectedValues(Collection<?> objects) {
this.removeSelectedValues(objects.iterator());
}
-
+
/**
* Remove the specified objects from the current set of selected objects.
* @see javax.swing.ListSelectionModel#removeSelectionInterval(int, int)
@@ -285,7 +316,7 @@ public class ObjectListSelectionModel
public void removeSelectedValues(Object[] objects) {
this.removeSelectedValues(CollectionTools.iterator(objects));
}
-
+
/**
* @see javax.swing.ListSelectionModel#getAnchorSelectionIndex()
* Return null if the anchor selection is empty.
@@ -295,16 +326,16 @@ public class ObjectListSelectionModel
if (index == -1) {
return null;
}
- return this.getListModel().getElementAt(index);
+ return this.listModel().getElementAt(index);
}
-
+
/**
* @see javax.swing.ListSelectionModel#setAnchorSelectionIndex(int)
*/
public void setAnchorSelectedValue(Object object) {
this.setAnchorSelectionIndex(this.indexOf(object));
}
-
+
/**
* @see javax.swing.ListSelectionModel#getLeadSelectionIndex()
* Return null if the lead selection is empty.
@@ -314,16 +345,16 @@ public class ObjectListSelectionModel
if (index == -1) {
return null;
}
- return this.getListModel().getElementAt(index);
+ return this.listModel().getElementAt(index);
}
-
+
/**
* @see javax.swing.ListSelectionModel#setLeadSelectionIndex(int)
*/
public void setLeadSelectedValue(Object object) {
this.setLeadSelectionIndex(this.indexOf(object));
}
-
+
/**
* @see javax.swing.ListSelectionModel#getMaxSelectionIndex()
* Return null if the max selection is empty.
@@ -333,9 +364,9 @@ public class ObjectListSelectionModel
if (index == -1) {
return null;
}
- return this.getListModel().getElementAt(index);
+ return this.listModel().getElementAt(index);
}
-
+
/**
* @see javax.swing.ListSelectionModel#getMinSelectionIndex()
* Return null if the min selection is empty.
@@ -345,7 +376,7 @@ public class ObjectListSelectionModel
if (index == -1) {
return null;
}
- return this.getListModel().getElementAt(index);
+ return this.listModel().getElementAt(index);
}
/**
@@ -359,8 +390,8 @@ public class ObjectListSelectionModel
* Add the specified objects to the current set of selected objects,
* without wrapping the actions in "adjusting" events.
*/
- private void addSelectedValuesInternal(Iterator objects) {
- ListModel lm = this.getListModel();
+ private void addSelectedValuesInternal(Iterator<?> objects) {
+ ListModel lm = this.listModel();
int listModelSize = lm.getSize();
while (objects.hasNext()) {
int index = this.indexOf(objects.next(), lm, listModelSize);
@@ -373,7 +404,7 @@ public class ObjectListSelectionModel
* Return -1 if the object is not in the list model.
*/
private int indexOf(Object object) {
- ListModel lm = this.getListModel();
+ ListModel lm = this.listModel();
return this.indexOf(object, lm, lm.getSize());
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/PrimitiveListTreeModel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/PrimitiveListTreeModel.java
index 4275a11d68..cc3b4f2ac4 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/PrimitiveListTreeModel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/PrimitiveListTreeModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -49,7 +49,7 @@ public abstract class PrimitiveListTreeModel
extends DefaultTreeModel
{
/** a model on the list of primitives */
- private final ListValueModel listHolder;
+ private final ListValueModel<?> listHolder;
/** a listener that handles the adding, removing, and replacing of the primitives */
private final ListChangeListener listChangeListener;
@@ -60,7 +60,7 @@ public abstract class PrimitiveListTreeModel
/**
* Public constructor - the list holder is required
*/
- public PrimitiveListTreeModel(ListValueModel listHolder) {
+ public PrimitiveListTreeModel(ListValueModel<?> listHolder) {
super(new DefaultMutableTreeNode(null, true)); // true = the root can have children
if (listHolder == null) {
throw new NullPointerException();
@@ -144,7 +144,7 @@ public abstract class PrimitiveListTreeModel
}
private void buildList() {
- for (Iterator stream = this.listHolder.iterator(); stream.hasNext(); ) {
+ for (Iterator<?> stream = this.listHolder.iterator(); stream.hasNext(); ) {
this.addPrimitive(stream.next());
}
}
@@ -193,7 +193,7 @@ public abstract class PrimitiveListTreeModel
public void itemsAdded(ListChangeEvent e) {
int i = e.index();
- for (ListIterator stream = e.items(); stream.hasNext(); ) {
+ for (ListIterator<?> stream = e.items(); stream.hasNext(); ) {
PrimitiveListTreeModel.this.insertPrimitive(i++, stream.next());
}
}
@@ -206,7 +206,7 @@ public abstract class PrimitiveListTreeModel
public void itemsReplaced(ListChangeEvent e) {
int i = e.index();
- for (ListIterator stream = e.items(); stream.hasNext(); ) {
+ for (ListIterator<?> stream = e.items(); stream.hasNext(); ) {
PrimitiveListTreeModel.this.replacePrimitive(i++, stream.next());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/RadioButtonModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/RadioButtonModelAdapter.java
index 3e1804088d..14e783cb05 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/RadioButtonModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/RadioButtonModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -11,9 +11,9 @@ package org.eclipse.jpt.utility.internal.model.value.swing;
import org.eclipse.jpt.utility.internal.BidiFilter;
import org.eclipse.jpt.utility.internal.BidiTransformer;
-import org.eclipse.jpt.utility.internal.model.value.FilteringPropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.FilteringWritablePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationWritablePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
/**
* This javax.swing.ButtonModel can be used to keep a listener
@@ -35,7 +35,7 @@ public class RadioButtonModelAdapter
/**
* Constructor - the value holder is required.
*/
- public RadioButtonModelAdapter(PropertyValueModel valueHolder, Object buttonValue, boolean defaultValue) {
+ public RadioButtonModelAdapter(WritablePropertyValueModel<Object> valueHolder, Object buttonValue, boolean defaultValue) {
super(buildBooleanHolder(valueHolder, buttonValue), defaultValue);
}
@@ -43,7 +43,7 @@ public class RadioButtonModelAdapter
* Constructor - the value holder is required.
* The default value will be false.
*/
- public RadioButtonModelAdapter(PropertyValueModel valueHolder, Object buttonValue) {
+ public RadioButtonModelAdapter(WritablePropertyValueModel<Object> valueHolder, Object buttonValue) {
super(buildBooleanHolder(valueHolder, buttonValue));
}
@@ -59,9 +59,9 @@ public class RadioButtonModelAdapter
* value is set to true, the wrapper will set the value holder's
* value to the button value.
*/
- public static PropertyValueModel buildBooleanHolder(PropertyValueModel valueHolder, Object buttonValue) {
- PropertyValueModel filteringPVM = new FilteringPropertyValueModel(valueHolder, new RadioButtonFilter(buttonValue));
- return new TransformationPropertyValueModel(filteringPVM, new RadioButtonTransformer(buttonValue));
+ public static WritablePropertyValueModel<Boolean> buildBooleanHolder(WritablePropertyValueModel<Object> valueHolder, Object buttonValue) {
+ WritablePropertyValueModel<Object> filteringPVM = new FilteringWritablePropertyValueModel<Object>(valueHolder, new RadioButtonFilter(buttonValue));
+ return new TransformationWritablePropertyValueModel<Object, Boolean>(filteringPVM, new RadioButtonTransformer(buttonValue));
}
@@ -91,7 +91,7 @@ public class RadioButtonModelAdapter
* This filter will only pass through a new value to the wrapped
* value holder when it matches the configured button value.
*/
- public static class RadioButtonFilter implements BidiFilter {
+ public static class RadioButtonFilter implements BidiFilter<Object> {
private Object buttonValue;
public RadioButtonFilter(Object buttonValue) {
@@ -120,7 +120,7 @@ public class RadioButtonModelAdapter
* This transformer will convert the wrapped value to Boolean.TRUE
* when it matches the configured button value.
*/
- public static class RadioButtonTransformer implements BidiTransformer {
+ public static class RadioButtonTransformer implements BidiTransformer<Object, Boolean> {
private Object buttonValue;
public RadioButtonTransformer(Object buttonValue) {
@@ -134,7 +134,7 @@ public class RadioButtonModelAdapter
* but if it is null simply pass it through because it will cause the
* button model's default value to be used
*/
- public Object transform(Object value) {
+ public Boolean transform(Object value) {
return (value == null) ? null : Boolean.valueOf(value == this.buttonValue);
}
@@ -142,8 +142,8 @@ public class RadioButtonModelAdapter
* if the new value is true, pass through the our button value;
* otherwise pass through null
*/
- public Object reverseTransform(Object value) {
- return (((Boolean) value).booleanValue()) ? this.buttonValue : null;
+ public Object reverseTransform(Boolean value) {
+ return (value.booleanValue()) ? this.buttonValue : null;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/SpinnerModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/SpinnerModelAdapter.java
index 5cfbd0e6fe..b6cfdebc1b 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/SpinnerModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/SpinnerModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -19,8 +19,8 @@ import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
import org.eclipse.jpt.utility.internal.model.listener.awt.AWTPropertyChangeListenerWrapper;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
/**
* This javax.swing.SpinnerModel can be used to keep a ChangeListener
@@ -46,7 +46,7 @@ public class SpinnerModelAdapter
protected final ChangeListener delegateListener;
/** A value model on the underlying value. */
- protected final PropertyValueModel valueHolder;
+ protected final WritablePropertyValueModel<Object> valueHolder;
/** A listener that allows us to synchronize with changes made to the underlying value. */
protected final PropertyChangeListener valueListener;
@@ -57,7 +57,7 @@ public class SpinnerModelAdapter
/**
* Constructor - the value holder and delegate are required.
*/
- public SpinnerModelAdapter(PropertyValueModel valueHolder, SpinnerModel delegate) {
+ public SpinnerModelAdapter(WritablePropertyValueModel<Object> valueHolder, SpinnerModel delegate) {
super();
if (valueHolder == null || delegate == null) {
throw new NullPointerException();
@@ -74,7 +74,7 @@ public class SpinnerModelAdapter
* Constructor - the value holder is required.
* This will wrap a simple number spinner model.
*/
- public SpinnerModelAdapter(PropertyValueModel valueHolder) {
+ public SpinnerModelAdapter(WritablePropertyValueModel<Object> valueHolder) {
this(valueHolder, new SpinnerNumberModel());
}
@@ -189,12 +189,12 @@ public class SpinnerModelAdapter
}
protected void engageValueHolder() {
- this.valueHolder.addPropertyChangeListener(ValueModel.VALUE, this.valueListener);
+ this.valueHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.valueListener);
this.synchronizeDelegate(this.valueHolder.value());
}
protected void disengageValueHolder() {
- this.valueHolder.removePropertyChangeListener(ValueModel.VALUE, this.valueListener);
+ this.valueHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.valueListener);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/TableModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/TableModelAdapter.java
index ab5ad28bfe..905d26480e 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/TableModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/TableModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -25,8 +25,8 @@ import org.eclipse.jpt.utility.internal.model.listener.awt.AWTPropertyChangeList
import org.eclipse.jpt.utility.internal.model.value.CollectionListValueModelAdapter;
import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
/**
* This TableModel can be used to keep a TableModelListener (e.g. a JTable)
@@ -59,21 +59,21 @@ import org.eclipse.jpt.utility.internal.model.value.ValueModel;
* - 1 cell listener per row
* - 1 cell listener per cell
*/
-public class TableModelAdapter
+public class TableModelAdapter<E>
extends AbstractTableModel
{
/**
* a list of user objects that are converted to
* rows via the column adapter
*/
- private ListValueModel listHolder;
+ private ListValueModel<? extends E> listHolder;
private final ListChangeListener listChangeListener;
/**
* each row is an array of cell models
*/
// declare as ArrayList so we can use #ensureCapacity(int)
- private final ArrayList<PropertyValueModel[]> rows;
+ private final ArrayList<WritablePropertyValueModel<Object>[]> rows;
/**
* client-supplied adapter that provides with the various column
@@ -94,7 +94,7 @@ public class TableModelAdapter
* Construct a table model adapter for the specified objects
* and adapter.
*/
- public TableModelAdapter(ListValueModel listHolder, ColumnAdapter columnAdapter) {
+ public TableModelAdapter(ListValueModel<? extends E> listHolder, ColumnAdapter columnAdapter) {
super();
if (listHolder == null) {
throw new NullPointerException();
@@ -102,7 +102,7 @@ public class TableModelAdapter
this.listHolder = listHolder;
this.columnAdapter = columnAdapter;
this.listChangeListener = this.buildListChangeListener();
- this.rows = new ArrayList<PropertyValueModel[]>();
+ this.rows = new ArrayList<WritablePropertyValueModel<Object>[]>();
this.cellListener = this.buildCellListener();
}
@@ -110,8 +110,8 @@ public class TableModelAdapter
* Construct a table model adapter for the specified objects
* and adapter.
*/
- public TableModelAdapter(CollectionValueModel collectionHolder, ColumnAdapter columnAdapter) {
- this(new CollectionListValueModelAdapter(collectionHolder), columnAdapter);
+ public TableModelAdapter(CollectionValueModel<? extends E> collectionHolder, ColumnAdapter columnAdapter) {
+ this(new CollectionListValueModelAdapter<E>(collectionHolder), columnAdapter);
}
@@ -124,13 +124,13 @@ public class TableModelAdapter
protected ListChangeListener buildListChangeListener_() {
return new ListChangeListener() {
public void itemsAdded(ListChangeEvent e) {
- TableModelAdapter.this.addRows(e.index(), e.itemsSize(), e.items());
+ TableModelAdapter.this.addRows(e.index(), e.itemsSize(), this.items(e));
}
public void itemsRemoved(ListChangeEvent e) {
TableModelAdapter.this.removeRows(e.index(), e.itemsSize());
}
public void itemsReplaced(ListChangeEvent e) {
- TableModelAdapter.this.replaceRows(e.index(), e.items());
+ TableModelAdapter.this.replaceRows(e.index(), this.items(e));
}
public void itemsMoved(ListChangeEvent e) {
TableModelAdapter.this.moveRows(e.targetIndex(), e.sourceIndex(), e.moveLength());
@@ -141,6 +141,13 @@ public class TableModelAdapter
public void listChanged(ListChangeEvent e) {
TableModelAdapter.this.rebuildTable();
}
+ /**
+ * minimize scope of suppressed warnings
+ */
+ @SuppressWarnings("unchecked")
+ protected Iterator<Object> items(ListChangeEvent event) {
+ return (Iterator<Object>) event.items();
+ }
@Override
public String toString() {
return "list listener";
@@ -148,14 +155,16 @@ public class TableModelAdapter
};
}
+
protected PropertyChangeListener buildCellListener() {
return new AWTPropertyChangeListenerWrapper(this.buildCellListener_());
}
protected PropertyChangeListener buildCellListener_() {
return new PropertyChangeListener() {
+ @SuppressWarnings("unchecked")
public void propertyChanged(PropertyChangeEvent evt) {
- TableModelAdapter.this.cellChanged((PropertyValueModel) evt.getSource());
+ TableModelAdapter.this.cellChanged((WritablePropertyValueModel<Object>) evt.getSource());
}
@Override
public String toString() {
@@ -168,7 +177,7 @@ public class TableModelAdapter
// ********** TableModel implementation **********
public int getColumnCount() {
- return this.columnAdapter.getColumnCount();
+ return this.columnAdapter.columnCount();
}
public int getRowCount() {
@@ -177,27 +186,27 @@ public class TableModelAdapter
@Override
public String getColumnName(int column) {
- return this.columnAdapter.getColumnName(column);
+ return this.columnAdapter.columnName(column);
}
@Override
- public Class getColumnClass(int columnIndex) {
- return this.columnAdapter.getColumnClass(columnIndex);
+ public Class<?> getColumnClass(int columnIndex) {
+ return this.columnAdapter.columnClass(columnIndex);
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
- return this.columnAdapter.isColumnEditable(columnIndex);
+ return this.columnAdapter.columnIsEditable(columnIndex);
}
public Object getValueAt(int rowIndex, int columnIndex) {
- PropertyValueModel[] row = this.rows.get(rowIndex);
+ WritablePropertyValueModel<Object>[] row = this.rows.get(rowIndex);
return row[columnIndex].value();
}
@Override
public void setValueAt(Object value, int rowIndex, int columnIndex) {
- PropertyValueModel[] row = this.rows.get(rowIndex);
+ WritablePropertyValueModel<Object>[] row = this.rows.get(rowIndex);
row[columnIndex].setValue(value);
}
@@ -229,14 +238,14 @@ public class TableModelAdapter
/**
* Return the underlying list model.
*/
- public ListValueModel getModel() {
+ public ListValueModel<? extends E> model() {
return this.listHolder;
}
/**
* Set the underlying list model.
*/
- public void setModel(ListValueModel listHolder) {
+ public void setModel(ListValueModel<E> listHolder) {
if (listHolder == null) {
throw new NullPointerException();
}
@@ -254,8 +263,8 @@ public class TableModelAdapter
/**
* Set the underlying collection model.
*/
- public void setModel(CollectionValueModel collectionHolder) {
- this.setModel(new CollectionListValueModelAdapter(collectionHolder));
+ public void setModel(CollectionValueModel<E> collectionHolder) {
+ this.setModel(new CollectionListValueModelAdapter<E>(collectionHolder));
}
@@ -292,8 +301,8 @@ public class TableModelAdapter
*/
private void engageAllCells() {
this.rows.ensureCapacity(this.listHolder.size());
- for (Iterator stream = this.listHolder.iterator(); stream.hasNext(); ) {
- PropertyValueModel[] row = this.columnAdapter.cellModels(stream.next());
+ for (Iterator<? extends E> stream = this.listHolder.iterator(); stream.hasNext(); ) {
+ WritablePropertyValueModel<Object>[] row = this.columnAdapter.cellModels(stream.next());
this.engageRow(row);
this.rows.add(row);
}
@@ -302,9 +311,9 @@ public class TableModelAdapter
/**
* Listen to the cells in the specified row.
*/
- private void engageRow(PropertyValueModel[] row) {
+ private void engageRow(WritablePropertyValueModel<Object>[] row) {
for (int i = row.length; i-- > 0; ) {
- row[i].addPropertyChangeListener(ValueModel.VALUE, this.cellListener);
+ row[i].addPropertyChangeListener(PropertyValueModel.VALUE, this.cellListener);
}
}
@@ -317,24 +326,24 @@ public class TableModelAdapter
}
private void disengageAllCells() {
- for (PropertyValueModel[] row : this.rows) {
+ for (WritablePropertyValueModel<Object>[] row : this.rows) {
this.disengageRow(row);
}
this.rows.clear();
}
- private void disengageRow(PropertyValueModel[] row) {
+ private void disengageRow(WritablePropertyValueModel<Object>[] row) {
for (int i = row.length; i-- > 0; ) {
- row[i].removePropertyChangeListener(ValueModel.VALUE, this.cellListener);
+ row[i].removePropertyChangeListener(PropertyValueModel.VALUE, this.cellListener);
}
}
/**
* brute-force search for the cell(s) that changed...
*/
- void cellChanged(PropertyValueModel cellHolder) {
+ void cellChanged(WritablePropertyValueModel<Object> cellHolder) {
for (int i = this.rows.size(); i-- > 0; ) {
- PropertyValueModel[] row = this.rows.get(i);
+ WritablePropertyValueModel<Object>[] row = this.rows.get(i);
for (int j = row.length; j-- > 0; ) {
if (row[j] == cellHolder) {
this.fireTableCellUpdated(i, j);
@@ -346,10 +355,10 @@ public class TableModelAdapter
/**
* convert the items to rows
*/
- void addRows(int index, int size, Iterator items) {
- List<PropertyValueModel[]> newRows = new ArrayList<PropertyValueModel[]>(size);
+ void addRows(int index, int size, Iterator<Object> items) {
+ List<WritablePropertyValueModel<Object>[]> newRows = new ArrayList<WritablePropertyValueModel<Object>[]>(size);
while (items.hasNext()) {
- PropertyValueModel[] row = this.columnAdapter.cellModels(items.next());
+ WritablePropertyValueModel<Object>[] row = this.columnAdapter.cellModels(items.next());
this.engageRow(row);
newRows.add(row);
}
@@ -364,10 +373,10 @@ public class TableModelAdapter
this.fireTableRowsDeleted(index, index + size - 1);
}
- void replaceRows(int index, Iterator items) {
+ void replaceRows(int index, Iterator<Object> items) {
int i = index;
while (items.hasNext()) {
- PropertyValueModel[] row = this.rows.get(i);
+ WritablePropertyValueModel<Object>[] row = this.rows.get(i);
this.disengageRow(row);
row = this.columnAdapter.cellModels(items.next());
this.engageRow(row);
@@ -378,7 +387,7 @@ public class TableModelAdapter
}
void moveRows(int targetIndex, int sourceIndex, int length) {
- ArrayList<PropertyValueModel[]> temp = new ArrayList<PropertyValueModel[]>(length);
+ ArrayList<WritablePropertyValueModel<Object>[]> temp = new ArrayList<WritablePropertyValueModel<Object>[]>(length);
for (int i = 0; i < length; i++) {
temp.add(this.rows.remove(sourceIndex));
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ToggleButtonModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ToggleButtonModelAdapter.java
index 3369513434..0fc40049ea 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ToggleButtonModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/ToggleButtonModelAdapter.java
@@ -19,8 +19,8 @@ import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
import org.eclipse.jpt.utility.internal.model.listener.awt.AWTPropertyChangeListenerWrapper;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
/**
* This javax.swing.ButtonModel can be used to keep a listener
@@ -37,7 +37,7 @@ public class ToggleButtonModelAdapter
protected final boolean defaultValue;
/** A value model on the underlying model boolean. */
- protected final PropertyValueModel booleanHolder;
+ protected final WritablePropertyValueModel<Boolean> booleanHolder;
/**
* A listener that allows us to synchronize with
@@ -51,7 +51,7 @@ public class ToggleButtonModelAdapter
/**
* Constructor - the boolean holder is required.
*/
- public ToggleButtonModelAdapter(PropertyValueModel booleanHolder, boolean defaultValue) {
+ public ToggleButtonModelAdapter(WritablePropertyValueModel<Boolean> booleanHolder, boolean defaultValue) {
super();
if (booleanHolder == null) {
throw new NullPointerException();
@@ -67,7 +67,7 @@ public class ToggleButtonModelAdapter
* Constructor - the boolean holder is required.
* The default value will be false.
*/
- public ToggleButtonModelAdapter(PropertyValueModel booleanHolder) {
+ public ToggleButtonModelAdapter(WritablePropertyValueModel<Boolean> booleanHolder) {
this(booleanHolder, false);
}
@@ -180,7 +180,7 @@ public class ToggleButtonModelAdapter
return this.listenerList.getListenerCount() == 0;
}
- protected boolean getDefaultValue() {
+ protected boolean defaultValue() {
return this.defaultValue;
}
@@ -193,7 +193,7 @@ public class ToggleButtonModelAdapter
*/
protected void setSelected(Boolean value) {
if (value == null) {
- this.setSelected(this.getDefaultValue());
+ this.setSelected(this.defaultValue());
} else {
this.setSelected(value.booleanValue());
}
@@ -207,12 +207,12 @@ public class ToggleButtonModelAdapter
}
protected void engageModel() {
- this.booleanHolder.addPropertyChangeListener(ValueModel.VALUE, this.booleanChangeListener);
- this.setSelected((Boolean) this.booleanHolder.value());
+ this.booleanHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.booleanChangeListener);
+ this.setSelected(this.booleanHolder.value());
}
protected void disengageModel() {
- this.booleanHolder.removePropertyChangeListener(ValueModel.VALUE, this.booleanChangeListener);
+ this.booleanHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.booleanChangeListener);
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/TreeModelAdapter.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/TreeModelAdapter.java
index 1b7d81f490..380286cf31 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/TreeModelAdapter.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/model/value/swing/TreeModelAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -29,9 +29,8 @@ import org.eclipse.jpt.utility.internal.model.listener.awt.AWTPropertyChangeList
import org.eclipse.jpt.utility.internal.model.listener.awt.AWTStateChangeListenerWrapper;
import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ReadOnlyPropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.StaticPropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.TreeNodeValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
/**
* This javax.swing.tree.TreeModel can be used to keep a TreeModelListener
@@ -45,7 +44,7 @@ import org.eclipse.jpt.utility.internal.model.value.ValueModel;
* which, typically, should not be a problem. (If you want to display an empty
* tree you can set the JTree's treeModel to null.)
*/
-public class TreeModelAdapter
+public class TreeModelAdapter<T>
extends AbstractTreeModel
{
/**
@@ -54,7 +53,7 @@ public class TreeModelAdapter
* the entire tree. Due to limitations in JTree, the root should
* never be set to null while we have listeners.
*/
- private final PropertyValueModel rootHolder;
+ private final PropertyValueModel<TreeNodeValueModel<T>> rootHolder;
private final PropertyChangeListener rootListener;
/**
@@ -86,7 +85,7 @@ public class TreeModelAdapter
* most of the time. The root is cached so we can disengage
* from it when it has been swapped out.
*/
- private TreeNodeValueModel root;
+ private TreeNodeValueModel<T> root;
/**
* Map the nodes to their lists of children.
@@ -95,7 +94,7 @@ public class TreeModelAdapter
* the items that were affected).
* @see EventChangePolicy#rebuildChildren()
*/
- final IdentityHashMap<TreeNodeValueModel, List<TreeNodeValueModel>> childrenLists;
+ final IdentityHashMap<TreeNodeValueModel<T>, List<TreeNodeValueModel<T>>> childrenLists;
/**
* Map the children models to their parents.
@@ -103,7 +102,7 @@ public class TreeModelAdapter
* list change events (the parent).
* @see EventChangePolicy#parent()
*/
- final IdentityHashMap<ListValueModel, TreeNodeValueModel> parents;
+ final IdentityHashMap<ListValueModel<TreeNodeValueModel<T>>, TreeNodeValueModel<T>> parents;
// ********** constructors **********
@@ -111,7 +110,7 @@ public class TreeModelAdapter
/**
* Construct a tree model for the specified root.
*/
- public TreeModelAdapter(PropertyValueModel rootHolder) {
+ public TreeModelAdapter(PropertyValueModel<TreeNodeValueModel<T>> rootHolder) {
super();
if (rootHolder == null) {
throw new NullPointerException();
@@ -121,15 +120,15 @@ public class TreeModelAdapter
this.nodeStateListener = this.buildNodeStateListener();
this.nodeValueListener = this.buildNodeValueListener();
this.childrenListener = this.buildChildrenListener();
- this.childrenLists = new IdentityHashMap<TreeNodeValueModel, List<TreeNodeValueModel>>();
- this.parents = new IdentityHashMap<ListValueModel, TreeNodeValueModel>();
+ this.childrenLists = new IdentityHashMap<TreeNodeValueModel<T>, List<TreeNodeValueModel<T>>>();
+ this.parents = new IdentityHashMap<ListValueModel<TreeNodeValueModel<T>>, TreeNodeValueModel<T>>();
}
/**
* Construct a tree model for the specified root.
*/
- public TreeModelAdapter(TreeNodeValueModel root) {
- this(new ReadOnlyPropertyValueModel(root));
+ public TreeModelAdapter(TreeNodeValueModel<T> root) {
+ this(new StaticPropertyValueModel<TreeNodeValueModel<T>>(root));
}
@@ -157,8 +156,9 @@ public class TreeModelAdapter
protected PropertyChangeListener buildNodeValueListener_() {
return new PropertyChangeListener() {
+ @SuppressWarnings("unchecked")
public void propertyChanged(PropertyChangeEvent e) {
- TreeModelAdapter.this.nodeChanged((TreeNodeValueModel) e.getSource());
+ TreeModelAdapter.this.nodeChanged((TreeNodeValueModel<T>) e.getSource());
}
@Override
public String toString() {
@@ -173,8 +173,9 @@ public class TreeModelAdapter
protected StateChangeListener buildNodeStateListener_() {
return new StateChangeListener() {
+ @SuppressWarnings("unchecked")
public void stateChanged(StateChangeEvent e) {
- TreeModelAdapter.this.nodeChanged((TreeNodeValueModel) e.getSource());
+ TreeModelAdapter.this.nodeChanged((TreeNodeValueModel<T>) e.getSource());
}
@Override
public String toString() {
@@ -221,24 +222,29 @@ public class TreeModelAdapter
return this.root;
}
+ @SuppressWarnings("unchecked")
public Object getChild(Object parent, int index) {
- return ((TreeNodeValueModel) parent).child(index);
+ return ((TreeNodeValueModel<T>) parent).child(index);
}
+ @SuppressWarnings("unchecked")
public int getChildCount(Object parent) {
- return ((TreeNodeValueModel) parent).childrenSize();
+ return ((TreeNodeValueModel<T>) parent).childrenSize();
}
+ @SuppressWarnings("unchecked")
public boolean isLeaf(Object node) {
- return ((TreeNodeValueModel) node).isLeaf();
+ return ((TreeNodeValueModel<T>) node).isLeaf();
}
+ @SuppressWarnings("unchecked")
public void valueForPathChanged(TreePath path, Object newValue) {
- ((TreeNodeValueModel) path.getLastPathComponent()).setValue(newValue);
+ ((TreeNodeValueModel<T>) path.getLastPathComponent()).setValue((T) newValue);
}
+ @SuppressWarnings("unchecked")
public int getIndexOfChild(Object parent, Object child) {
- return ((TreeNodeValueModel) parent).indexOfChild((TreeNodeValueModel) child);
+ return ((TreeNodeValueModel<T>) parent).indexOfChild((TreeNodeValueModel<T>) child);
}
/**
@@ -271,8 +277,8 @@ public class TreeModelAdapter
* in the underlying tree model.
*/
private void engageModel() {
- this.rootHolder.addPropertyChangeListener(ValueModel.VALUE, this.rootListener);
- this.root = (TreeNodeValueModel) this.rootHolder.value();
+ this.rootHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.rootListener);
+ this.root = this.rootHolder.value();
if (this.root == null) {
throw new NullPointerException(); // the root cannot be null while we have listeners
}
@@ -295,7 +301,7 @@ public class TreeModelAdapter
this.removeRoot();
this.disengageNode(this.root);
this.root = null;
- this.rootHolder.removePropertyChangeListener(ValueModel.VALUE, this.rootListener);
+ this.rootHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.rootListener);
}
/**
@@ -312,7 +318,7 @@ public class TreeModelAdapter
* non-root nodes.
*/
void rootChanged() {
- TreeNodeValueModel newRoot = (TreeNodeValueModel) this.rootHolder.value();
+ TreeNodeValueModel<T> newRoot = this.rootHolder.value();
if (newRoot == null) {
throw new NullPointerException(); // the root cannot be null while we have listeners
}
@@ -321,7 +327,7 @@ public class TreeModelAdapter
this.removeRoot();
// save the old root and swap in the new root
- TreeNodeValueModel oldRoot = this.root;
+ TreeNodeValueModel<T> oldRoot = this.root;
this.root = newRoot;
// we must be listening to both the old and new roots when we fire the event
@@ -340,8 +346,8 @@ public class TreeModelAdapter
* Either the "value" or the "state" of the specified node has changed,
* forward notification to our listeners.
*/
- void nodeChanged(TreeNodeValueModel node) {
- TreeNodeValueModel parent = node.parent();
+ void nodeChanged(TreeNodeValueModel<T> node) {
+ TreeNodeValueModel<T> parent = node.parent();
if (parent == null) {
this.fireTreeRootChanged(node);
} else {
@@ -355,23 +361,23 @@ public class TreeModelAdapter
* We must listen to the nodes before notifying anybody, because
* adding a listener can change the value of a node.
*/
- void addChildren(Object[] path, int[] childIndices, Object[] children) {
+ void addChildren(TreeNodeValueModel<T>[] path, int[] childIndices, TreeNodeValueModel<T>[] children) {
int len = childIndices.length;
for (int i = 0; i < len; i++) {
- this.engageNode((TreeNodeValueModel) children[i]);
+ this.engageNode(children[i]);
}
this.fireTreeNodesInserted(path, childIndices, children);
for (int i = 0; i < len; i++) {
- this.addNode(childIndices[i], (TreeNodeValueModel) children[i]);
+ this.addNode(childIndices[i], children[i]);
}
}
/**
* Listen to the node and its children model.
*/
- private void engageNode(TreeNodeValueModel node) {
+ private void engageNode(TreeNodeValueModel<T> node) {
node.addStateChangeListener(this.nodeStateListener);
- node.addPropertyChangeListener(ValueModel.VALUE, this.nodeValueListener);
+ node.addPropertyChangeListener(PropertyValueModel.VALUE, this.nodeValueListener);
node.childrenModel().addListChangeListener(ListValueModel.LIST_VALUES, this.childrenListener);
}
@@ -380,7 +386,7 @@ public class TreeModelAdapter
* then recurse down through the node's children,
* adding them to the internal tree also.
*/
- private void addNode(int index, TreeNodeValueModel node) {
+ private void addNode(int index, TreeNodeValueModel<T> node) {
this.addNodeToInternalTree(node.parent(), index, node, node.childrenModel());
new NodeChangePolicy(node).addChildren();
}
@@ -388,10 +394,10 @@ public class TreeModelAdapter
/**
* Add the specified node to our internal tree.
*/
- private void addNodeToInternalTree(TreeNodeValueModel parent, int index, TreeNodeValueModel node, ListValueModel childrenModel) {
- List<TreeNodeValueModel> siblings = this.childrenLists.get(parent);
+ private void addNodeToInternalTree(TreeNodeValueModel<T> parent, int index, TreeNodeValueModel<T> node, ListValueModel<TreeNodeValueModel<T>> childrenModel) {
+ List<TreeNodeValueModel<T>> siblings = this.childrenLists.get(parent);
if (siblings == null) {
- siblings = new ArrayList<TreeNodeValueModel>();
+ siblings = new ArrayList<TreeNodeValueModel<T>>();
this.childrenLists.put(parent, siblings);
}
siblings.add(index, node);
@@ -405,15 +411,15 @@ public class TreeModelAdapter
* We must listen to the nodes until after notifying anybody, because
* removing a listener can change the value of a node.
*/
- void removeChildren(Object[] path, int[] childIndices, Object[] children) {
+ void removeChildren(TreeNodeValueModel<T>[] path, int[] childIndices, TreeNodeValueModel<T>[] children) {
int len = childIndices.length;
for (int i = 0; i < len; i++) {
// the indices slide down a notch each time we remove a child
- this.removeNode(childIndices[i] - i, (TreeNodeValueModel) children[i]);
+ this.removeNode(childIndices[i] - i, children[i]);
}
this.fireTreeNodesRemoved(path, childIndices, children);
for (int i = 0; i < len; i++) {
- this.disengageNode((TreeNodeValueModel) children[i]);
+ this.disengageNode(children[i]);
}
}
@@ -422,7 +428,7 @@ public class TreeModelAdapter
* removing them from our internal tree;
* then remove the node itself from our internal tree.
*/
- private void removeNode(int index, TreeNodeValueModel node) {
+ private void removeNode(int index, TreeNodeValueModel<T> node) {
new NodeChangePolicy(node).removeChildren();
this.removeNodeFromInternalTree(node.parent(), index, node, node.childrenModel());
}
@@ -430,10 +436,10 @@ public class TreeModelAdapter
/**
* Remove the specified node from our internal tree.
*/
- private void removeNodeFromInternalTree(TreeNodeValueModel parent, int index, TreeNodeValueModel node, ListValueModel childrenModel) {
+ private void removeNodeFromInternalTree(TreeNodeValueModel<T> parent, int index, TreeNodeValueModel<T> node, ListValueModel<TreeNodeValueModel<T>> childrenModel) {
this.parents.remove(childrenModel);
- List<TreeNodeValueModel> siblings = this.childrenLists.get(parent);
+ List<TreeNodeValueModel<T>> siblings = this.childrenLists.get(parent);
siblings.remove(index);
if (siblings.isEmpty()) {
this.childrenLists.remove(parent);
@@ -443,15 +449,15 @@ public class TreeModelAdapter
/**
* Stop listening to the node and its children model.
*/
- private void disengageNode(TreeNodeValueModel node) {
+ private void disengageNode(TreeNodeValueModel<T> node) {
node.childrenModel().removeListChangeListener(ListValueModel.LIST_VALUES, this.childrenListener);
- node.removePropertyChangeListener(ValueModel.VALUE, this.nodeValueListener);
+ node.removePropertyChangeListener(PropertyValueModel.VALUE, this.nodeValueListener);
node.removeStateChangeListener(this.nodeStateListener);
}
- void moveChildren(TreeNodeValueModel parent, int targetIndex, int sourceIndex, int length) {
- List<TreeNodeValueModel> childrenList = this.childrenLists.get(parent);
- ArrayList<TreeNodeValueModel> temp = new ArrayList<TreeNodeValueModel>(length);
+ void moveChildren(TreeNodeValueModel<T> parent, int targetIndex, int sourceIndex, int length) {
+ List<TreeNodeValueModel<T>> childrenList = this.childrenLists.get(parent);
+ ArrayList<TreeNodeValueModel<T>> temp = new ArrayList<TreeNodeValueModel<T>>(length);
for (int i = 0; i < length; i++) {
temp.add(childrenList.remove(sourceIndex));
}
@@ -505,7 +511,7 @@ public class TreeModelAdapter
/**
* Return an array of the current set of children.
*/
- Object[] childArray() {
+ TreeNodeValueModel<T>[] childArray() {
return this.buildArray(this.children(), this.childrenSize());
}
@@ -513,8 +519,9 @@ public class TreeModelAdapter
* Build an array to hold the elements in the specified iterator.
* If they are different sizes, something is screwed up...
*/
- Object[] buildArray(Iterator<?> stream, int size) {
- Object[] array = new Object[size];
+ TreeNodeValueModel<T>[] buildArray(Iterator<TreeNodeValueModel<T>> stream, int size) {
+ @SuppressWarnings("unchecked")
+ TreeNodeValueModel<T>[] array = new TreeNodeValueModel[size];
for (int i = 0; stream.hasNext(); i++) {
array[i] = stream.next();
}
@@ -545,7 +552,7 @@ public class TreeModelAdapter
/**
* Return the parent of the current set of children.
*/
- abstract TreeNodeValueModel parent();
+ abstract TreeNodeValueModel<T> parent();
/**
* Return the starting index for the current set of children.
@@ -560,7 +567,7 @@ public class TreeModelAdapter
/**
* Return an interator on the current set of children.
*/
- abstract Iterator children();
+ abstract Iterator<TreeNodeValueModel<T>> children();
}
@@ -580,7 +587,7 @@ public class TreeModelAdapter
* Map the ListChangeEvent's source to the corresponding parent.
*/
@Override
- TreeNodeValueModel parent() {
+ TreeNodeValueModel<T> parent() {
return TreeModelAdapter.this.parents.get(this.event.getSource());
}
@@ -604,15 +611,16 @@ public class TreeModelAdapter
* The ListChangeEvent's items are the children.
*/
@Override
- Iterator children() {
- return this.event.items();
+ @SuppressWarnings("unchecked")
+ Iterator<TreeNodeValueModel<T>> children() {
+ return (Iterator<TreeNodeValueModel<T>>) this.event.items();
}
/**
* Remove the old nodes and add the new ones.
*/
void replaceChildren() {
- Object[] parentPath = this.parent().path();
+ TreeNodeValueModel<T>[] parentPath = this.parent().path();
int[] childIndices = this.childIndices();
TreeModelAdapter.this.removeChildren(parentPath, childIndices, this.replacedChildren());
TreeModelAdapter.this.addChildren(parentPath, childIndices, this.childArray());
@@ -629,11 +637,11 @@ public class TreeModelAdapter
* Clear all the nodes.
*/
void clearChildren() {
- TreeNodeValueModel parent = this.parent();
- Object[] parentPath = parent.path();
- List<TreeNodeValueModel> childrenList = TreeModelAdapter.this.childrenLists.get(parent);
+ TreeNodeValueModel<T> parent = this.parent();
+ TreeNodeValueModel<T>[] parentPath = parent.path();
+ List<TreeNodeValueModel<T>> childrenList = TreeModelAdapter.this.childrenLists.get(parent);
int[] childIndices = this.buildIndices(childrenList.size());
- Object[] childArray = this.buildArray(childrenList.iterator(), childrenList.size());
+ TreeNodeValueModel<T>[] childArray = this.buildArray(childrenList.iterator(), childrenList.size());
TreeModelAdapter.this.removeChildren(parentPath, childIndices, childArray);
}
@@ -641,11 +649,11 @@ public class TreeModelAdapter
* Remove all the old nodes and add all the new nodes.
*/
void rebuildChildren() {
- TreeNodeValueModel parent = this.parent();
- Object[] parentPath = parent.path();
- List<TreeNodeValueModel> childrenList = TreeModelAdapter.this.childrenLists.get(parent);
+ TreeNodeValueModel<T> parent = this.parent();
+ TreeNodeValueModel<T>[] parentPath = parent.path();
+ List<TreeNodeValueModel<T>> childrenList = TreeModelAdapter.this.childrenLists.get(parent);
int[] childIndices = this.buildIndices(childrenList.size());
- Object[] childArray = this.buildArray(childrenList.iterator(), childrenList.size());
+ TreeNodeValueModel<T>[] childArray = this.buildArray(childrenList.iterator(), childrenList.size());
TreeModelAdapter.this.removeChildren(parentPath, childIndices, childArray);
childIndices = this.buildIndices(parent.childrenModel().size());
@@ -656,8 +664,9 @@ public class TreeModelAdapter
/**
* The ListChangeEvent's replaced items are the replaced children.
*/
- Object[] replacedChildren() {
- return this.buildArray(this.event.replacedItems(), this.event.itemsSize());
+ @SuppressWarnings("unchecked")
+ TreeNodeValueModel<T>[] replacedChildren() {
+ return this.buildArray((Iterator<TreeNodeValueModel<T>>) this.event.replacedItems(), this.event.itemsSize());
}
}
@@ -667,9 +676,9 @@ public class TreeModelAdapter
* Wraps a TreeNodeValueModel for adding and removing its children.
*/
private class NodeChangePolicy extends ChangePolicy {
- private TreeNodeValueModel node;
+ private TreeNodeValueModel<T> node;
- NodeChangePolicy(TreeNodeValueModel node) {
+ NodeChangePolicy(TreeNodeValueModel<T> node) {
this.node = node;
}
@@ -677,7 +686,7 @@ public class TreeModelAdapter
* The node itself is the parent.
*/
@Override
- TreeNodeValueModel parent() {
+ TreeNodeValueModel<T> parent() {
return this.node;
}
@@ -706,7 +715,7 @@ public class TreeModelAdapter
* the children model.
*/
@Override
- Iterator children() {
+ Iterator<TreeNodeValueModel<T>> children() {
return this.node.childrenModel().iterator();
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/node/AbstractNode.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/node/AbstractNode.java
index 918f3c5ce1..c7709ee3d7 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/node/AbstractNode.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/node/AbstractNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -633,10 +633,10 @@ public abstract class AbstractNode
* Only really used for testing and debugging.
*/
public final Iterator<Node> allDirtyNodes() {
- return new FilteringIterator<Node>(this.allNodes()) {
+ return new FilteringIterator<Node, Node>(this.allNodes()) {
@Override
- protected boolean accept(Object o) {
- return (o instanceof AbstractNode) && ((AbstractNode) o).isDirty();
+ protected boolean accept(Node node) {
+ return (node instanceof AbstractNode) && ((AbstractNode) node).isDirty();
}
};
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/node/PluggableValidator.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/node/PluggableValidator.java
index d4fa10a441..c44f8aab43 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/node/PluggableValidator.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/node/PluggableValidator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -21,6 +21,7 @@ public class PluggableValidator
implements Node.Validator
{
private boolean pause;
+ private boolean validateOnResume;
private final Delegate delegate;
@@ -44,11 +45,14 @@ public class PluggableValidator
public PluggableValidator(Delegate delegate) {
super();
this.pause = false;
+ this.validateOnResume = false;
this.delegate = delegate;
}
public synchronized void validate() {
- if ( ! this.pause) {
+ if (this.pause) {
+ this.validateOnResume = true;
+ } else {
this.delegate.validate();
}
}
@@ -65,8 +69,11 @@ public class PluggableValidator
throw new IllegalStateException("not paused");
}
this.pause = false;
- // validate all the changes that occurred while the validation was paused
- this.delegate.validate();
+ // validate any changes that occurred while the validation was paused
+ if (this.validateOnResume) {
+ this.validateOnResume = false;
+ this.delegate.validate();
+ }
}
@Override
@@ -92,9 +99,7 @@ public class PluggableValidator
* This delegate does nothing.
*/
final class Null implements Delegate {
- @SuppressWarnings("unchecked")
public static final Delegate INSTANCE = new Null();
- @SuppressWarnings("unchecked")
public static Delegate instance() {
return INSTANCE;
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/CheckBoxTableCellRenderer.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/CheckBoxTableCellRenderer.java
index 15c2fd0e42..6cbd37ddd2 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/CheckBoxTableCellRenderer.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/CheckBoxTableCellRenderer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -200,7 +200,7 @@ public class CheckBoxTableCellRenderer implements TableCellEditorAdapter.Rendere
* to set the table's row height to something the check box
* will look good in....
*/
- public int getPreferredHeight() {
+ public int preferredHeight() {
// add in space for the border top and bottom
return (int) this.checkBox.getPreferredSize().getHeight() + 2;
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/ComboBoxTableCellRenderer.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/ComboBoxTableCellRenderer.java
index ba2a1581a0..d0db82bbdf 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/ComboBoxTableCellRenderer.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/ComboBoxTableCellRenderer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -178,7 +178,7 @@ public class ComboBoxTableCellRenderer implements TableCellEditorAdapter.Rendere
private JList getListBox(JComboBox result) {
- return (JList) ClassTools.getFieldValue(result.getUI(), "listBox");
+ return (JList) ClassTools.fieldValue(result.getUI(), "listBox");
}
@@ -323,7 +323,7 @@ public class ComboBoxTableCellRenderer implements TableCellEditorAdapter.Rendere
* Return the renderer's preferred height. This allows you
* to set the row height to something the combo-box will look good in....
*/
- public int getPreferredHeight() {
+ public int preferredHeight() {
return height;
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/FilteringListBrowser.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/FilteringListBrowser.java
index e5a1d39523..d59f3e04d3 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/FilteringListBrowser.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/FilteringListBrowser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -20,10 +20,10 @@ import javax.swing.ListModel;
* is passed a FilteringListPanel to assist the user in making
* a selection.
*/
-public class FilteringListBrowser
+public class FilteringListBrowser<T>
implements ListChooser.ListBrowser
{
- private FilteringListPanel panel;
+ private FilteringListPanel<T> panel;
/**
* Default constructor.
@@ -33,8 +33,8 @@ public class FilteringListBrowser
this.panel = this.buildPanel();
}
- protected FilteringListPanel buildPanel() {
- return new LocalFilteringListPanel();
+ protected FilteringListPanel<T> buildPanel() {
+ return new LocalFilteringListPanel<T>();
}
/**
@@ -57,16 +57,16 @@ public class FilteringListBrowser
);
if (option == JOptionPane.OK_OPTION) {
- chooser.getModel().setSelectedItem(this.panel.getSelection());
+ chooser.getModel().setSelectedItem(this.panel.selection());
}
// clear the text field so the list box is re-filtered
- this.panel.getTextField().setText("");
+ this.panel.textField().setText("");
}
protected void initializeCellRenderer(JComboBox comboBox) {
// default behavior should be to use the cell renderer from the combobox.
- this.panel.getListBox().setCellRenderer(comboBox.getRenderer());
+ this.panel.listBox().setCellRenderer(comboBox.getRenderer());
}
/**
@@ -118,10 +118,11 @@ public class FilteringListBrowser
// ********** custom panel **********
- protected class LocalFilteringListPanel extends FilteringListPanel {
-
+ protected static class LocalFilteringListPanel<S> extends FilteringListPanel<S> {
+ protected static final Object[] EMPTY_ARRAY = new Object[0];
+
protected LocalFilteringListPanel() {
- super(new Object[0], null);
+ super(EMPTY_ARRAY, null);
}
/**
@@ -129,9 +130,11 @@ public class FilteringListBrowser
* will try open wide enough to disable the horizontal scroll bar;
* and it looks a bit clumsy.
*/
+ @Override
protected String prototypeCellValue() {
return null;
}
}
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/FilteringListPanel.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/FilteringListPanel.java
index bb36dfbef5..af9a56dac8 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/FilteringListPanel.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/FilteringListPanel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -65,7 +65,7 @@ import org.eclipse.jpt.utility.internal.StringMatcher;
* dialog that directs the user's behavior (as opposed to a "normal"
* window).
*/
-public class FilteringListPanel extends JPanel {
+public class FilteringListPanel<T> extends JPanel {
/**
* The complete list of available choices
@@ -78,7 +78,7 @@ public class FilteringListPanel extends JPanel {
* to strings so they can be run through the matcher
* and displayed in the text field.
*/
- StringConverter stringConverter;
+ StringConverter<T> stringConverter;
/** The text field. */
private JTextField textField;
@@ -120,7 +120,7 @@ public class FilteringListPanel extends JPanel {
* the objects).
*/
public FilteringListPanel(Object[] completeList, Object initialSelection) {
- this(completeList, initialSelection, StringConverter.Default.instance());
+ this(completeList, initialSelection, StringConverter.Default.<T>instance());
}
/**
@@ -128,7 +128,7 @@ public class FilteringListPanel extends JPanel {
* and initial selection. Use the specified string converter to convert the
* choices and selection to strings.
*/
- public FilteringListPanel(Object[] completeList, Object initialSelection, StringConverter stringConverter) {
+ public FilteringListPanel(Object[] completeList, Object initialSelection, StringConverter<T> stringConverter) {
super(new BorderLayout());
this.completeList = completeList;
this.stringConverter = stringConverter;
@@ -140,7 +140,7 @@ public class FilteringListPanel extends JPanel {
private void initialize(Object initialSelection) {
this.maxListSize = this.defaultMaxListSize();
- this.buffer = new Object[this.max()];
+ this.buffer = this.buildBuffer();
this.textFieldListener = this.buildTextFieldListener();
@@ -149,6 +149,10 @@ public class FilteringListPanel extends JPanel {
this.initializeLayout(initialSelection);
}
+ private Object[] buildBuffer() {
+ return new Object[this.max()];
+ }
+
/**
* Return the current max number of entries allowed in the list box.
*/
@@ -186,7 +190,7 @@ public class FilteringListPanel extends JPanel {
}
private StringMatcher buildStringMatcher() {
- return new SimpleStringMatcher();
+ return new SimpleStringMatcher<T>();
}
private void initializeLayout(Object initialSelection) {
@@ -234,7 +238,7 @@ public class FilteringListPanel extends JPanel {
// ********** public API **********
- public Object getSelection() {
+ public Object selection() {
return this.listBox.getSelectedValue();
}
@@ -242,7 +246,7 @@ public class FilteringListPanel extends JPanel {
this.listBox.setSelectedValue(selection, true);
}
- public Object[] getCompleteList() {
+ public Object[] completeList() {
return this.completeList;
}
@@ -253,33 +257,33 @@ public class FilteringListPanel extends JPanel {
public void setCompleteList(Object[] completeList) {
this.completeList = completeList;
if (this.buffer.length < this.max()) {
- // the buffer will never shrink - might want to re-consider... -bjv
- this.buffer = new Object[this.max()];
+ // the buffer will never shrink - might want to re-consider... ~bjv
+ this.buffer = this.buildBuffer();
}
this.filterList();
}
- public int getMaxListSize() {
+ public int maxListSize() {
return this.maxListSize;
}
public void setMaxListSize(int maxListSize) {
this.maxListSize = maxListSize;
if (this.buffer.length < this.max()) {
- // the buffer will never shrink - might want to re-consider... -bjv
- this.buffer = new Object[this.max()];
+ // the buffer will never shrink - might want to re-consider... ~bjv
+ this.buffer = this.buildBuffer();
}
this.filterList();
}
- public StringConverter getStringConverter() {
+ public StringConverter<T> stringConverter() {
return this.stringConverter;
}
/**
* apply the new filter to the list
*/
- public void setStringConverter(StringConverter stringConverter) {
+ public void setStringConverter(StringConverter<T> stringConverter) {
this.stringConverter = stringConverter;
this.filterList();
}
@@ -288,14 +292,14 @@ public class FilteringListPanel extends JPanel {
* allow client code to access the text field
* (so we can set the focus)
*/
- public JTextField getTextField() {
+ public JTextField textField() {
return this.textField;
}
/**
* allow client code to access the text field label
*/
- public JLabel getTextFieldLabel() {
+ public JLabel textFieldLabel() {
return this.textFieldLabel;
}
@@ -310,7 +314,7 @@ public class FilteringListPanel extends JPanel {
* allow client code to access the list box
* (so we can add mouse listeners for double-clicking)
*/
- public JList getListBox() {
+ public JList listBox() {
return this.listBox;
}
@@ -324,7 +328,7 @@ public class FilteringListPanel extends JPanel {
/**
* allow client code to access the list box label
*/
- public JLabel getListBoxLabel() {
+ public JLabel listBoxLabel() {
return this.listBoxLabel;
}
@@ -345,7 +349,7 @@ public class FilteringListPanel extends JPanel {
this.listBox.setFont(font);
}
- public StringMatcher getStringMatcher() {
+ public StringMatcher stringMatcher() {
return this.stringMatcher;
}
@@ -375,8 +379,9 @@ public class FilteringListPanel extends JPanel {
protected ListCellRenderer buildDefaultCellRenderer() {
return new SimpleListCellRenderer() {
@Override
+ @SuppressWarnings("unchecked")
protected String buildText(Object value) {
- return FilteringListPanel.this.stringConverter.convertToString(value);
+ return FilteringListPanel.this.stringConverter.convertToString((T) value);
}
};
}
@@ -385,7 +390,7 @@ public class FilteringListPanel extends JPanel {
* Something has changed that requires us to filter the list.
*
* This method is synchronized because a fast typist can
- * generate events quicker than we can filter the list. (? -bjv)
+ * generate events quicker than we can filter the list. (? ~bjv)
*/
synchronized void filterList() {
// temporarily stop listening to the list box selection, since we will
@@ -407,7 +412,7 @@ public class FilteringListPanel extends JPanel {
int len = this.completeList.length;
int max = this.max();
for (int i = 0; i < len; i++) {
- if (this.stringMatcher.matches(this.stringConverter.convertToString(this.completeList[i]))) {
+ if (this.stringMatcher.matches(this.stringConverter.convertToString(this.entry(i)))) {
this.buffer[j++] = this.completeList[i];
}
if (j == max) {
@@ -428,6 +433,14 @@ public class FilteringListPanel extends JPanel {
}
/**
+ * minimize scope of suppressed warnings
+ */
+ @SuppressWarnings("unchecked")
+ private T entry(int index) {
+ return (T) this.completeList[index];
+ }
+
+ /**
* Build a list model that wraps only a portion of the specified array.
* The model will include the array entries from 0 to (size - 1).
*/
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/ListChooser.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/ListChooser.java
index 52f8c8f9a4..2ddca8b367 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/ListChooser.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/ListChooser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -113,12 +113,12 @@ public class ListChooser
//These are used to workaround problems with Swing trying to
//determine the size of a comboBox with a large model
setPrototypeDisplayValue(prototypeLabel);
- getListBox().setPrototypeCellValue(prototypeLabel);
+ listBox().setPrototypeCellValue(prototypeLabel);
}
- private JList getListBox() {
- return (JList) ClassTools.getFieldValue(this.ui, "listBox");
+ private JList listBox() {
+ return (JList) ClassTools.fieldValue(this.ui, "listBox");
}
/**
@@ -215,7 +215,7 @@ public class ListChooser
private void updateArrowButton() {
try {
BasicComboBoxUI comboBoxUi = (BasicComboBoxUI) ListChooser.this.getUI();
- JButton arrowButton = (JButton) ClassTools.getFieldValue(comboBoxUi, "arrowButton");
+ JButton arrowButton = (JButton) ClassTools.fieldValue(comboBoxUi, "arrowButton");
arrowButton.setEnabled(this.isEnabled() && this.choosable);
}
catch (Exception e) {
@@ -241,7 +241,7 @@ public class ListChooser
// **************** Public ************************************************
- public int getLongListSize() {
+ public int longListSize() {
return this.longListSize;
}
@@ -389,7 +389,7 @@ public class ListChooser
private void checkComboBoxButton() {
try {
BasicComboBoxUI comboBoxUi = (BasicComboBoxUI) ListChooser.this.getUI();
- JButton arrowButton = (JButton) ClassTools.getFieldValue(comboBoxUi, "arrowButton");
+ JButton arrowButton = (JButton) ClassTools.fieldValue(comboBoxUi, "arrowButton");
arrowButton.getModel().setPressed(false);
}
catch (Exception e) {
diff --git a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/SpinnerTableCellRenderer.java b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/SpinnerTableCellRenderer.java
index 2f1f07e949..ad071e4ac9 100644
--- a/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/SpinnerTableCellRenderer.java
+++ b/jpa/plugins/org.eclipse.jpt.utility/src/org/eclipse/jpt/utility/internal/swing/SpinnerTableCellRenderer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -179,7 +179,7 @@ public class SpinnerTableCellRenderer implements TableCellEditorAdapter.Renderer
* Return the renderer's preferred height. This allows you
* to set the row height to something the spinner will look good in....
*/
- public int getPreferredHeight() {
+ public int preferredHeight() {
// add in space for the border top and bottom
return (int) this.spinner.getPreferredSize().getHeight() + 2;
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/META-INF/MANIFEST.MF
index 13e7e66355..f52d3d4ead 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/META-INF/MANIFEST.MF
+++ b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/META-INF/MANIFEST.MF
@@ -20,4 +20,4 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.jpt.utility,
org.eclipse.core.resources
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.eclipse.jpt.core.tests.extension.resource;x-friends:="org.eclipse.jpt.ui.tests"
+Export-Package: org.eclipse.jpt.core.tests.extension.resource;x-friends:="org.eclipse.jpt.ui.tests,org.eclipse.jpt.core.tests"
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/.settings/org.eclipse.core.resources.prefs b/jpa/tests/org.eclipse.jpt.core.tests/.settings/org.eclipse.core.resources.prefs
index 88638b5d88..eb348782fa 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/.settings/org.eclipse.core.resources.prefs
+++ b/jpa/tests/org.eclipse.jpt.core.tests/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +1,3 @@
-#Sun May 27 15:10:20 EDT 2007
+#Tue Jan 15 11:10:55 EST 2008
eclipse.preferences.version=1
encoding/<project>=ISO-8859-1
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.core.tests/META-INF/MANIFEST.MF
index c9ccb4ebfb..48f02cedcb 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/META-INF/MANIFEST.MF
+++ b/jpa/tests/org.eclipse.jpt.core.tests/META-INF/MANIFEST.MF
@@ -10,19 +10,30 @@ Require-Bundle: org.eclipse.core.resources,
org.eclipse.emf.ecore,
org.eclipse.emf.ecore.xmi,
org.eclipse.jdt.core,
+ org.eclipse.jdt.ui,
org.eclipse.jem,
+ org.eclipse.jem.util,
org.eclipse.jpt.core,
- org.eclipse.jpt.core.tests.extension.resource,
+ org.eclipse.jpt.db,
org.eclipse.jpt.utility,
+ org.eclipse.jpt.utility.tests,
org.eclipse.wst.common.emf,
+ org.eclipse.wst.common.emfworkbench.integration,
org.eclipse.wst.common.frameworks,
org.eclipse.wst.common.modulecore,
org.eclipse.wst.common.project.facet.core,
- org.junit
+ org.junit,
+ org.eclipse.wst.xml.core,
+ org.eclipse.wst.validation
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.jpt.core.tests.internal;x-friends:="org.eclipse.jpt.ui.tests",
- org.eclipse.jpt.core.tests.internal.content.java.mappings;x-internal:=true,
+ org.eclipse.jpt.core.tests.internal.context;x-internal:=true,
+ org.eclipse.jpt.core.tests.internal.context.java;x-internal:=true,
+ org.eclipse.jpt.core.tests.internal.context.orm;x-internal:=true,
+ org.eclipse.jpt.core.tests.internal.context.persistence;x-internal:=true,
org.eclipse.jpt.core.tests.internal.jdtutility;x-internal:=true,
org.eclipse.jpt.core.tests.internal.model;x-internal:=true,
org.eclipse.jpt.core.tests.internal.platform;x-internal:=true,
- org.eclipse.jpt.core.tests.internal.projects;x-friends:="org.eclipse.jpt.ui.tests"
+ org.eclipse.jpt.core.tests.internal.projects;x-friends:="org.eclipse.jpt.ui.tests",
+ org.eclipse.jpt.core.tests.internal.resource;x-internal:=true,
+ org.eclipse.jpt.core.tests.internal.resource.java;x-internal:=true
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java
index fbd57c9799..c1c7c27159 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java
@@ -9,13 +9,12 @@
******************************************************************************/
package org.eclipse.jpt.core.tests.internal;
-import org.eclipse.jpt.core.tests.internal.content.java.mappings.JptCoreContentJavaMappingsTests;
-import org.eclipse.jpt.core.tests.internal.jdtutility.JptCoreJdtUtilityTests;
-import org.eclipse.jpt.core.tests.internal.model.JptCoreModelTests;
-import org.eclipse.jpt.core.tests.internal.platform.JptCorePlatformTests;
-
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.jpt.core.tests.internal.context.JptCoreContextModelTests;
+import org.eclipse.jpt.core.tests.internal.jdtutility.JptCoreJdtUtilityTests;
+import org.eclipse.jpt.core.tests.internal.model.JptCoreModelTests;
+import org.eclipse.jpt.core.tests.internal.resource.JptCoreResourceModelTests;
/**
* Runs MOST JPT Core Tests. Currently we do not have a jpa.jar checked into cvs.
@@ -32,10 +31,10 @@ public class JptCoreTests {
public static Test suite(boolean all) {
String quantity = all ? "All" : "Most";
TestSuite suite = new TestSuite(quantity + " JPT Core Tests");
- suite.addTest(JptCoreContentJavaMappingsTests.suite(all));
suite.addTest(JptCoreJdtUtilityTests.suite(all));
suite.addTest(JptCoreModelTests.suite(all));
- suite.addTest(JptCorePlatformTests.suite(all));
+ suite.addTest(JptCoreResourceModelTests.suite(all));
+ suite.addTest(JptCoreContextModelTests.suite(all));
return suite;
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JavaEntityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JavaEntityTests.java
deleted file mode 100644
index bbb313fc29..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JavaEntityTests.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.tests.internal.content.java.mappings;
-
-import java.util.Iterator;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jpt.core.internal.IMappingKeys;
-import org.eclipse.jpt.core.internal.content.java.IJavaTypeMapping;
-import org.eclipse.jpt.core.internal.content.java.mappings.JPA;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
-
-public class JavaEntityTests extends JpaJavaTestCase {
-
- public JavaEntityTests(String name) {
- super(name);
- }
-
- private void createTestEntity1() throws CoreException {
- this.createTestType(new DefaultAnnotationWriter() {
- @Override
- public Iterator<String> imports() {
- return new ArrayIterator<String>(JPA.ENTITY);
- }
- @Override
- public void appendTypeAnnotationTo(StringBuilder sb) {
- sb.append("@Entity");
- }
- });
- this.synchPersistenceXml();
- }
-
-// public void testXXX() throws Exception {
-// this.createTestEntity1();
-// this.assertSourceDoesNotContain("@Id");
-//
-// IWorkbench wb = PlatformUI.getWorkbench();
-// IWorkbenchWindow[] windows = wb.getWorkbenchWindows();
-// IWorkbenchWindow window = windows[0];
-// IWorkbenchPage[] pages = window.getPages();
-// IWorkbenchPage page = pages[0];
-// IFile file = (IFile) this.javaProject.getProject().findMember(FILE_PATH);
-// IDE.openEditor(page, file);
-// TestThread t = new TestThread();
-// t.start();
-//
-//// while (t.isAlive()) {
-//// Thread.sleep(50);
-//// }
-//// assertFalse("see console", t.exceptionCaught);
-// }
-
-// private class TestThread extends Thread {
-// boolean exceptionCaught = false;
-// TestThread() {
-// super();
-// }
-// @Override
-// public void run() {
-// try {
-// JavaEntityTests.this.xxx();
-// } catch (Exception ex) {
-// this.exceptionCaught = true;
-// throw new RuntimeException(ex);
-// }
-// }
-// }
-//
-// void xxx() throws Exception {
-// this.jpaProject().getJpaProject().setThreadLocalModifySharedDocumentCommandExecutor(SynchronousUiCommandExecutor.instance());
-// JavaPersistentAttribute attribute = this.javaPersistentAttributeNamed("id");
-// attribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
-// this.assertSourceContains("@Id");
-// }
-//
-// // TODO move to JavaPersistentAttributeTests
-// public void testSetSpecifiedMappingKey() throws Exception {
-// this.createTestEntity1();
-// this.assertSourceDoesNotContain("@Id");
-// JavaPersistentAttribute attribute = this.javaPersistentAttributeNamed("id");
-// attribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
-// this.assertSourceContains("@Id");
-// }
-//
- public void testGetName() throws Exception {
- this.createTestEntity1();
- IJavaTypeMapping typeMapping = this.javaPersistentTypeNamed(FULLY_QUALIFIED_TYPE_NAME).getMapping();
- assertEquals(TYPE_NAME, typeMapping.getName());
- }
-
- public void testGetKey() throws Exception {
- this.createTestEntity1();
- IJavaTypeMapping typeMapping = this.javaPersistentTypeNamed(FULLY_QUALIFIED_TYPE_NAME).getMapping();
- assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, typeMapping.getKey());
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JpaJavaTestCase.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JpaJavaTestCase.java
deleted file mode 100644
index bfeccb381b..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JpaJavaTestCase.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.tests.internal.content.java.mappings;
-
-import java.util.Iterator;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.content.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.jdtutility.Type;
-import org.eclipse.jpt.core.internal.synch.SynchronizeClassesJob;
-import org.eclipse.jpt.core.tests.internal.jdtutility.AnnotationTestCase;
-import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject;
-import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-import org.eclipse.jpt.core.tests.internal.projects.TestPlatformProject;
-import org.eclipse.jpt.utility.internal.ClassTools;
-
-public abstract class JpaJavaTestCase extends AnnotationTestCase {
-
- public JpaJavaTestCase(String name) {
- super(name);
- }
-
- @Override
- protected TestJavaProject buildJavaProject(String projectName, boolean autoBuild) throws Exception {
- return new TestJpaProject(TestPlatformProject.uniqueProjectName(projectName), autoBuild);
- }
-
- protected TestJpaProject jpaProject() {
- return (TestJpaProject) this.javaProject;
- }
-
- protected JavaPersistentType javaPersistentTypeNamed(String typeName) {
- for (Iterator<JavaPersistentType> stream = this.jpaProject().getJpaProject().javaPersistentTypes(); stream.hasNext(); ) {
- JavaPersistentType jpt = stream.next();
- if (jpt.fullyQualifiedTypeName().equals(typeName)) {
- return jpt;
- }
- }
- throw new IllegalArgumentException("missing type: " + typeName);
- }
-
- protected JavaPersistentAttribute javaPersistentAttributeNamed(String attributeName) {
- return this.javaPersistentAttributeNamed(attributeName, FULLY_QUALIFIED_TYPE_NAME);
- }
-
- protected JavaPersistentAttribute javaPersistentAttributeNamed(String attributeName, String typeName) {
- for (JavaPersistentAttribute attribute : this.javaPersistentTypeNamed(typeName).getAttributes()) {
- if (attribute.getName().equals(attributeName)) {
- return attribute;
- }
- }
- throw new IllegalArgumentException("missing attribute: " + typeName + "." + attributeName);
- }
-
- protected Type typeNamed(String typeName) {
- return this.javaPersistentTypeNamed(typeName).getType();
- }
-
- protected void synchPersistenceXml() {
- SynchronizeClassesJob job = new SynchronizeClassesJob(this.jpaProject().getProject().getFile("src/META-INF/persistence.xml"));
- ClassTools.executeMethod(job, "run", IProgressMonitor.class, new NullProgressMonitor());
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JptCoreContentJavaMappingsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JptCoreContentJavaMappingsTests.java
deleted file mode 100644
index 5efc901f07..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/content/java/mappings/JptCoreContentJavaMappingsTests.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.tests.internal.content.java.mappings;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class JptCoreContentJavaMappingsTests {
-
- public static Test suite() {
- return suite(true);
- }
-
- public static Test suite(boolean all) {
- TestSuite suite = new TestSuite(JptCoreContentJavaMappingsTests.class.getPackage().getName());
- if (all) {
- suite.addTestSuite(JavaEntityTests.class);
- }
- return suite;
- }
-
- private JptCoreContentJavaMappingsTests() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/ContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/ContextModelTestCase.java
new file mode 100644
index 0000000000..cecb1d0997
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/ContextModelTestCase.java
@@ -0,0 +1,192 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.tests.internal.context;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IJpaProject;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.IBaseJpaContent;
+import org.eclipse.jpt.core.internal.context.base.IClassRef;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IPersistenceUnit;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.context.orm.EntityMappings;
+import org.eclipse.jpt.core.internal.resource.orm.OrmArtifactEdit;
+import org.eclipse.jpt.core.internal.resource.orm.OrmResource;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceArtifactEdit;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResource;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.core.tests.internal.jdtutility.AnnotationTestCase;
+import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject;
+import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
+import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
+
+public abstract class ContextModelTestCase extends AnnotationTestCase
+{
+ protected static final String BASE_PROJECT_NAME = "ContextModelTestProject";
+
+ protected PersistenceArtifactEdit persistenceArtifactEdit;
+ protected OrmArtifactEdit ormArtifactEdit;
+
+
+ protected ContextModelTestCase(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.persistenceArtifactEdit = PersistenceArtifactEdit.getArtifactEditForWrite(getJavaProject().getProject());
+ this.ormArtifactEdit = OrmArtifactEdit.getArtifactEditForWrite(getJavaProject().getProject());
+ waitForWorkspaceJobs();
+ }
+
+ @Override
+ protected void deleteAllProjects() throws Exception{
+ //don't delete projects, creating a new one with a new name
+ //workspace will be deleted next time tests are run.
+ //not saying this is the ultimate solution, but it will work for now
+ //until we can figure out how to properly delete projects in tests
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //at least delete the project from the workspace since, deleting from the file system doesn't work well.
+ //tests run too slow otherwise because so many projects are created in the workspace
+ this.persistenceArtifactEdit.dispose();
+ this.persistenceArtifactEdit = null;
+ this.ormArtifactEdit.dispose();
+ this.ormArtifactEdit = null;
+ getJavaProject().getProject().delete(false, true, null);
+ super.tearDown();
+ }
+
+ @Override
+ protected TestJavaProject buildJavaProject(boolean autoBuild) throws Exception {
+ return buildJpaProject(BASE_PROJECT_NAME, autoBuild);
+ }
+
+ protected TestJpaProject buildJpaProject(String projectName, boolean autoBuild)
+ throws Exception {
+ return TestJpaProject.buildJpaProject(projectName, autoBuild);
+ }
+
+ protected IJpaProject jpaProject() {
+ return getJavaProject().getJpaProject();
+ }
+
+ protected void waitForWorkspaceJobs() {
+ // This job will not finish running until the workspace jobs are done
+ Job waitJob = new Job("Wait job") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ return Status.OK_STATUS;
+ }
+ };
+ waitJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
+ waitJob.schedule();
+ try {
+ waitJob.join();
+ } catch (InterruptedException ex) {
+ // the job thread was interrupted during a wait - ignore
+ }
+ }
+
+ protected PersistenceResource persistenceResource() {
+ return this.persistenceArtifactEdit.getResource();
+ }
+
+ protected OrmResource ormResource() {
+ return this.ormArtifactEdit.getResource(JptCorePlugin.ormXmlDeploymentURI(jpaProject().project()));
+ }
+
+ protected XmlPersistence xmlPersistence() {
+ return persistenceResource().getPersistence();
+ }
+
+ protected EntityMappings entityMappings() {
+ return persistenceUnit().mappingFileRefs().next().getOrmXml().getEntityMappings();
+ }
+
+ protected XmlPersistenceUnit xmlPersistenceUnit() {
+ return persistenceResource().getPersistence().getPersistenceUnits().get(0);
+ }
+
+ protected IPersistenceUnit persistenceUnit() {
+ return jpaContent().getPersistenceXml().getPersistence().persistenceUnits().next();
+ }
+
+ protected IClassRef classRef() {
+ return persistenceUnit().classRefs().next();
+ }
+
+ protected IJavaPersistentType javaPersistentType() {
+ return classRef().getJavaPersistentType();
+ }
+
+ protected IEntity javaEntity() {
+ return (IEntity) javaPersistentType().getMapping();
+ }
+
+ protected void addXmlClassRef(String className) {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+
+ XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
+ xmlClassRef.setJavaClass(className);
+ xmlPersistenceUnit.getClasses().add(xmlClassRef);
+ }
+
+ protected void removeXmlClassRef(String className) {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ XmlJavaClassRef xmlJavaClassRefToRemove = null;
+ for (XmlJavaClassRef xmlJavaClassRef : xmlPersistenceUnit.getClasses()) {
+ if (xmlJavaClassRef.getJavaClass().equals(className)) {
+ xmlJavaClassRefToRemove = xmlJavaClassRef;
+ }
+ }
+ if (xmlJavaClassRefToRemove == null) {
+ throw new IllegalArgumentException();
+ }
+ xmlPersistenceUnit.getClasses().remove(xmlJavaClassRefToRemove);
+ }
+
+ protected IBaseJpaContent jpaContent() {
+ return (IBaseJpaContent) getJavaProject().getJpaProject().contextModel();
+ }
+
+ @Override
+ protected TestJpaProject getJavaProject() {
+ return (TestJpaProject) super.getJavaProject();
+ }
+
+ protected void deleteResource(Resource resource) throws CoreException {
+ System.gc();
+ WorkbenchResourceHelper.deleteResource(resource);
+ waitForWorkspaceJobs();
+ }
+
+ protected IType createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception {
+ return this.javaProject.createType("javax.persistence", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }");
+ }
+
+ protected IType createEnumAndMembers(String enumName, String enumBody) throws Exception {
+ return this.javaProject.createType("javax.persistence", enumName + ".java", "public enum " + enumName + " { " + enumBody + " }");
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JptCoreContextModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JptCoreContextModelTests.java
new file mode 100644
index 0000000000..25ed426183
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/JptCoreContextModelTests.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.eclipse.jpt.core.tests.internal.context.java.JptCoreContextJavaModelTests;
+import org.eclipse.jpt.core.tests.internal.context.orm.JptCoreOrmContextModelTests;
+import org.eclipse.jpt.core.tests.internal.context.persistence.JptCorePersistenceContextModelTests;
+
+public class JptCoreContextModelTests extends TestCase
+{
+ public static Test suite() {
+ return suite(true);
+ }
+
+ public static Test suite(boolean all) {
+ TestSuite suite = new TestSuite(JptCoreContextModelTests.class.getName());
+ suite.addTest(JptCorePersistenceContextModelTests.suite(all));
+ suite.addTest(JptCoreOrmContextModelTests.suite(all));
+ suite.addTest(JptCoreContextJavaModelTests.suite(all));
+ return suite;
+ }
+
+ private JptCoreContextModelTests() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAssociationOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAssociationOverrideTests.java
new file mode 100644
index 0000000000..7cad910aed
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAssociationOverrideTests.java
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.context.base.IAssociationOverride;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.resource.java.AssociationOverride;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+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.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaAssociationOverrideTests extends ContextModelTestCase
+{
+ private static final String ASSOCIATION_OVERRIDE_NAME = "MY_ASSOCIATION_OVERRIDE_NAME";
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createMappedSuperclassAnnotation() throws Exception{
+ this.createAnnotationAndMembers("MappedSuperclass", "");
+ }
+
+ private void createJoinColumnAnnotation() throws Exception {
+ this.createAnnotationAndMembers("JoinColumn",
+ "String name() default \"\";" +
+ "String referencedColumnName() default \"\";" +
+ "boolean unique() default false;" +
+ "boolean nullable() default true;" +
+ "boolean insertable() default true;" +
+ "boolean updatable() default true;" +
+ "String columnDefinition() default \"\";" +
+ "String table() default \"\";");
+ }
+
+ private void createAssociationOverrideAnnotation() throws Exception {
+ createJoinColumnAnnotation();
+ this.createAnnotationAndMembers("AssociationOverride",
+ "String name();" +
+ "JoinColumn[] joinColumns();");
+ }
+
+ private IType createTestMappedSuperclass() throws Exception {
+ createMappedSuperclassAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS, JPA.ONE_TO_ONE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@MappedSuperclass");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(" @OneToOne");
+ sb.append(CR);
+ sb.append(" private int address;").append(CR);
+ sb.append(CR);
+ sb.append(" ");
+ }
+ });
+ }
+
+ private IType createTestEntityWithAssociationOverride() throws Exception {
+ createEntityAnnotation();
+ createAssociationOverrideAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ASSOCIATION_OVERRIDE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ sb.append("@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestSubType() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
+ sb.append("extends " + TYPE_NAME + " ");
+ sb.append("{}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
+ }
+
+
+
+ public JavaAssociationOverrideTests(String name) {
+ super(name);
+ }
+
+ public void testGetName() throws Exception {
+ createTestEntityWithAssociationOverride();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IAssociationOverride specifiedAssociationOverride = javaEntity().specifiedAssociationOverrides().next();
+ assertEquals(ASSOCIATION_OVERRIDE_NAME, specifiedAssociationOverride.getName());
+
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ AssociationOverride associationOverrideResource = (AssociationOverride) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE);
+
+ associationOverrideResource.setName("FOO");
+ specifiedAssociationOverride = javaEntity().specifiedAssociationOverrides().next();
+ assertEquals("FOO", specifiedAssociationOverride.getName());
+ }
+
+ public void testSetName() throws Exception {
+ createTestEntityWithAssociationOverride();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IAssociationOverride specifiedAssociationOverride = javaEntity().specifiedAssociationOverrides().next();
+ assertEquals(ASSOCIATION_OVERRIDE_NAME, specifiedAssociationOverride.getName());
+
+ specifiedAssociationOverride.setName("FOO");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ AssociationOverride associationOverrideResource = (AssociationOverride) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE);
+
+ assertEquals("FOO", associationOverrideResource.getName());
+ }
+
+ public void testDefaultName() throws Exception {
+ createTestMappedSuperclass();
+ createTestSubType();
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ assertEquals("AnnotationTestTypeChild", entity.getName());
+ assertEquals(1, CollectionTools.size(entity.defaultAssociationOverrides()));
+
+ IAssociationOverride associationOverride = entity.defaultAssociationOverrides().next();
+ assertEquals("address", associationOverride.getName());
+ }
+
+ public void testIsVirtual() throws Exception {
+ createTestMappedSuperclass();
+ createTestSubType();
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ assertEquals("AnnotationTestTypeChild", entity.getName());
+ assertEquals(1, CollectionTools.size(entity.defaultAssociationOverrides()));
+
+ IAssociationOverride associationOverride = entity.defaultAssociationOverrides().next();
+ assertTrue(associationOverride.isVirtual());
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAttributeOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAttributeOverrideTests.java
new file mode 100644
index 0000000000..c9db451c0b
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAttributeOverrideTests.java
@@ -0,0 +1,262 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.context.base.IAttributeOverride;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IColumn;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.java.Column;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+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.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaAttributeOverrideTests extends ContextModelTestCase
+{
+ private static final String ATTRIBUTE_OVERRIDE_NAME = "MY_ATTRIBUTE_OVERRIDE_NAME";
+ private static final String ATTRIBUTE_OVERRIDE_COLUMN_NAME = "MY_ATTRIBUTE_OVERRIDE_COLUMN_NAME";
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createMappedSuperclassAnnotation() throws Exception{
+ this.createAnnotationAndMembers("MappedSuperclass", "");
+ }
+
+ private void createColumnAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Column",
+ "String name() default \"\";" +
+ "boolean unique() default false;" +
+ "boolean nullable() default true;" +
+ "boolean insertable() default true;" +
+ "boolean updatable() default true;" +
+ "String columnDefinition() default \"\";" +
+ "String table() default \"\";" +
+ "int length() default 255;" +
+ "int precision() default 0;" +
+ "int scale() default 0;");
+ }
+
+ private void createAttributeOverrideAnnotation() throws Exception {
+ createColumnAnnotation();
+ this.createAnnotationAndMembers("AttributeOverride",
+ "String name();" +
+ "Column column();");
+ }
+
+ private IType createTestMappedSuperclass() throws Exception {
+ createMappedSuperclassAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@MappedSuperclass");
+ }
+ });
+ }
+
+ private IType createTestEntityWithAttributeOverride() throws Exception {
+ createEntityAnnotation();
+ createAttributeOverrideAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ATTRIBUTE_OVERRIDE, JPA.COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ sb.append("@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\", column=@Column(name=\"" + ATTRIBUTE_OVERRIDE_COLUMN_NAME + "\"))");
+ }
+ });
+ }
+
+ private IType createTestSubType() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
+ sb.append("extends " + TYPE_NAME + " ");
+ sb.append("{}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
+ }
+
+
+
+ public JavaAttributeOverrideTests(String name) {
+ super(name);
+ }
+
+ public void testGetName() throws Exception {
+ createTestEntityWithAttributeOverride();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IAttributeOverride specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next();
+ assertEquals(ATTRIBUTE_OVERRIDE_NAME, specifiedAttributeOverride.getName());
+
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ AttributeOverride attributeOverrideResource = (AttributeOverride) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE);
+
+ attributeOverrideResource.setName("FOO");
+ specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next();
+ assertEquals("FOO", specifiedAttributeOverride.getName());
+ }
+
+ public void testSetName() throws Exception {
+ createTestEntityWithAttributeOverride();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IAttributeOverride specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next();
+ assertEquals(ATTRIBUTE_OVERRIDE_NAME, specifiedAttributeOverride.getName());
+
+ specifiedAttributeOverride.setName("FOO");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ AttributeOverride attributeOverrideResource = (AttributeOverride) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE);
+
+ assertEquals("FOO", attributeOverrideResource.getName());
+ }
+
+ public void testColumnGetName() throws Exception {
+ createTestEntityWithAttributeOverride();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IAttributeOverride specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next();
+ IColumn column = specifiedAttributeOverride.getColumn();
+ assertEquals(ATTRIBUTE_OVERRIDE_COLUMN_NAME, column.getName());
+
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ AttributeOverride attributeOverrideResource = (AttributeOverride) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE);
+ Column columnResource = attributeOverrideResource.getColumn();
+ columnResource.setName("FOO");
+
+
+ column = javaEntity().specifiedAttributeOverrides().next().getColumn();
+ assertEquals("FOO", column.getName());
+ }
+
+ public void testColumnSetName() throws Exception {
+ createTestEntityWithAttributeOverride();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IAttributeOverride specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next();
+ IColumn column = specifiedAttributeOverride.getColumn();
+ assertEquals(ATTRIBUTE_OVERRIDE_COLUMN_NAME, column.getName());
+
+ column.setSpecifiedName("FOO");
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ AttributeOverride attributeOverrideResource = (AttributeOverride) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE);
+ Column columnResource = attributeOverrideResource.getColumn();
+
+ assertEquals("FOO", columnResource.getName());
+
+ column.setSpecifiedName(null);
+
+ attributeOverrideResource = (AttributeOverride) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE);
+ assertNull(attributeOverrideResource.getColumn());
+ assertNotNull(specifiedAttributeOverride.getColumn());
+ }
+
+ public void testColumnDefaultName() throws Exception {
+ createTestMappedSuperclass();
+ createTestSubType();
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ assertEquals("AnnotationTestTypeChild", entity.getName());
+ assertEquals(2, CollectionTools.size(entity.defaultAttributeOverrides()));
+
+ IAttributeOverride attributeOverride = entity.defaultAttributeOverrides().next();
+ assertEquals("id", attributeOverride.getColumn().getDefaultName());
+
+
+ IJavaPersistentType mappedSuperclass = CollectionTools.list(persistenceUnit().classRefs()).get(1).getJavaPersistentType();
+ IBasicMapping basicMapping = (IBasicMapping) mappedSuperclass.attributeNamed("id").getMapping();
+ basicMapping.getColumn().setSpecifiedName("FOO");
+
+ attributeOverride = entity.defaultAttributeOverrides().next();
+ assertEquals("FOO", attributeOverride.getColumn().getDefaultName());
+ }
+
+ public void testColumnDefaultTableName() throws Exception {
+ createTestMappedSuperclass();
+ createTestSubType();
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ assertEquals("AnnotationTestTypeChild", entity.getName());
+ assertEquals(2, CollectionTools.size(entity.defaultAttributeOverrides()));
+
+ IAttributeOverride attributeOverride = entity.defaultAttributeOverrides().next();
+ assertEquals("AnnotationTestTypeChild", attributeOverride.getColumn().getDefaultTable());
+
+
+ IJavaPersistentType mappedSuperclass = CollectionTools.list(persistenceUnit().classRefs()).get(1).getJavaPersistentType();
+ IBasicMapping basicMapping = (IBasicMapping) mappedSuperclass.attributeNamed("id").getMapping();
+ basicMapping.getColumn().setSpecifiedTable("BAR");
+
+ attributeOverride = entity.defaultAttributeOverrides().next();
+ assertEquals("BAR", attributeOverride.getColumn().getDefaultTable());
+ }
+
+ public void testDefaultName() throws Exception {
+ createTestMappedSuperclass();
+ createTestSubType();
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ assertEquals("AnnotationTestTypeChild", entity.getName());
+ assertEquals(2, CollectionTools.size(entity.defaultAttributeOverrides()));
+
+ IAttributeOverride attributeOverride = entity.defaultAttributeOverrides().next();
+ assertEquals("id", attributeOverride.getName());
+ }
+
+ public void testIsVirtual() throws Exception {
+ createTestMappedSuperclass();
+ createTestSubType();
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ assertEquals("AnnotationTestTypeChild", entity.getName());
+ assertEquals(2, CollectionTools.size(entity.defaultAttributeOverrides()));
+
+ IAttributeOverride attributeOverride = entity.defaultAttributeOverrides().next();
+ assertTrue(attributeOverride.isVirtual());
+ }
+}
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
new file mode 100644
index 0000000000..6eef141ea9
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java
@@ -0,0 +1,1000 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.base.EnumType;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
+import org.eclipse.jpt.core.internal.context.base.IVersionMapping;
+import org.eclipse.jpt.core.internal.context.base.TemporalType;
+import org.eclipse.jpt.core.internal.resource.java.Basic;
+import org.eclipse.jpt.core.internal.resource.java.Column;
+import org.eclipse.jpt.core.internal.resource.java.Embedded;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.java.Enumerated;
+import org.eclipse.jpt.core.internal.resource.java.Id;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.Lob;
+import org.eclipse.jpt.core.internal.resource.java.ManyToOne;
+import org.eclipse.jpt.core.internal.resource.java.OneToOne;
+import org.eclipse.jpt.core.internal.resource.java.Temporal;
+import org.eclipse.jpt.core.internal.resource.java.Transient;
+import org.eclipse.jpt.core.internal.resource.java.Version;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaBasicMappingTests extends ContextModelTestCase
+{
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createBasicAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Basic", "FetchType fetch() default EAGER; boolean optional() default true;");
+ }
+
+ private void createLobAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Lob", "");
+ }
+
+ private void createEnumeratedAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Enumerated", "EnumType value() default ORDINAL;");
+ }
+
+ private void createTemporalAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Temporal", "TemporalType value();");
+ }
+
+ private IType createTestEntity() throws Exception {
+ createEntityAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ });
+ }
+
+ private IType createTestEntityWithBasicMapping() throws Exception {
+ createEntityAnnotation();
+ createBasicAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Basic").append(CR);
+ }
+ });
+ }
+ private IType createTestEntityWithBasicMappingFetchOptionalSpecified() throws Exception {
+ createEntityAnnotation();
+ createBasicAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, JPA.FETCH_TYPE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Basic(fetch=FetchType.EAGER, optional=false)").append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithLob() throws Exception {
+ createEntityAnnotation();
+ createLobAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.LOB);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Lob").append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithEnumerated() throws Exception {
+ createEntityAnnotation();
+ createEnumeratedAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ENUMERATED, JPA.ENUM_TYPE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Enumerated(EnumType.STRING)").append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithTemporal() throws Exception {
+ createEntityAnnotation();
+ createTemporalAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.TEMPORAL, JPA.TEMPORAL_TYPE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Temporal(TemporalType.TIMESTAMP)").append(CR);
+ }
+ });
+ }
+
+ public JavaBasicMappingTests(String name) {
+ super(name);
+ }
+
+ public void testDefaultBasicGetDefaultFetch() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertEquals(FetchType.EAGER, basicMapping.getDefaultFetch());
+ }
+
+ public void testSpecifiedBasicGetDefaultFetch() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+ assertEquals(FetchType.EAGER, basicMapping.getDefaultFetch());
+ }
+
+ public void testGetFetch() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertEquals(FetchType.EAGER, basicMapping.getFetch());
+
+ basicMapping.setSpecifiedFetch(FetchType.LAZY);
+ assertEquals(FetchType.LAZY, basicMapping.getFetch());
+ }
+
+ public void testGetSpecifiedFetch() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(basicMapping.getSpecifiedFetch());
+
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC);
+ basic.setFetch(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY);
+
+ assertEquals(FetchType.LAZY, basicMapping.getSpecifiedFetch());
+ }
+
+ public void testGetSpecifiedFetch2() throws Exception {
+ createTestEntityWithBasicMappingFetchOptionalSpecified();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertEquals(FetchType.EAGER, basicMapping.getSpecifiedFetch());
+ }
+
+ public void testSetSpecifiedFetch() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+ assertNull(basicMapping.getSpecifiedFetch());
+
+ basicMapping.setSpecifiedFetch(FetchType.LAZY);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC);
+
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY, basic.getFetch());
+
+ basicMapping.setSpecifiedFetch(null);
+ assertNotNull(attributeResource.mappingAnnotation(JPA.BASIC));
+ }
+
+ public void testSetSpecifiedFetch2() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ createOrmXmlFile();
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertNull(basicMapping.getSpecifiedFetch());
+ assertTrue(basicMapping.isDefault());
+
+ basicMapping.setSpecifiedFetch(FetchType.LAZY);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.properties().next();
+ Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC);
+
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY, basic.getFetch());
+
+ basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertEquals(FetchType.LAZY, basicMapping.getSpecifiedFetch());
+ assertFalse(basicMapping.isDefault());
+
+ basicMapping.setSpecifiedFetch(null);
+ assertNotNull(attributeResource.mappingAnnotation(JPA.BASIC));
+
+ basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertFalse(basicMapping.isDefault());
+ }
+
+ protected void createOrmXmlFile() throws Exception {
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ public void testSetBasicRemovedFromResourceModel() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertFalse(basicMapping.isDefault());
+ basicMapping.getColumn().setSpecifiedName("FOO");
+ basicMapping.setTemporal(TemporalType.TIME);
+ basicMapping.setLob(true);
+ basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ assertFalse(basicMapping.isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ attributeResource.setMappingAnnotation(null);
+
+ assertNotSame(basicMapping, persistentAttribute.getMapping());
+
+ basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertTrue(basicMapping.isDefault());
+ assertEquals("FOO", basicMapping.getColumn().getSpecifiedName());
+
+
+ assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Lob.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME));
+ }
+
+ public void testBasicMorphToDefaultBasic() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertFalse(basicMapping.isDefault());
+ basicMapping.getColumn().setSpecifiedName("FOO");
+ basicMapping.setLob(true);
+ basicMapping.setTemporal(TemporalType.TIME);
+ basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedFetch(FetchType.EAGER);
+ basicMapping.setSpecifiedOptional(Boolean.FALSE);
+ assertFalse(basicMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+ assertEquals("FOO", ((IBasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
+ assertEquals(TemporalType.TIME, ((IBasicMapping) persistentAttribute.getMapping()).getTemporal());
+ assertTrue(((IBasicMapping) persistentAttribute.getMapping()).isLob());
+ assertEquals(EnumType.ORDINAL, ((IBasicMapping) persistentAttribute.getMapping()).getEnumerated());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(((IBasicMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
+ assertNull(((IBasicMapping) persistentAttribute.getMapping()).getSpecifiedOptional());
+ assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Lob.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME));
+ }
+
+ public void testBasicMorphToId() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertFalse(basicMapping.isDefault());
+ basicMapping.getColumn().setSpecifiedName("FOO");
+ basicMapping.setLob(true);
+ basicMapping.setTemporal(TemporalType.TIME);
+ basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedFetch(FetchType.EAGER);
+ basicMapping.setSpecifiedOptional(Boolean.FALSE);
+ assertFalse(basicMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
+ assertEquals("FOO", ((IIdMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
+ assertEquals(TemporalType.TIME, ((IIdMapping) persistentAttribute.getMapping()).getTemporal());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME));
+ }
+
+ public void testBasicMorphToVersion() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertFalse(basicMapping.isDefault());
+ basicMapping.getColumn().setSpecifiedName("FOO");
+ basicMapping.setTemporal(TemporalType.TIME);
+ basicMapping.setLob(true);
+ basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ assertFalse(basicMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
+ assertEquals("FOO", ((IVersionMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
+ assertEquals(TemporalType.TIME, ((IVersionMapping) persistentAttribute.getMapping()).getTemporal());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME));
+ }
+
+ public void testBasicMorphToEmbedded() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertFalse(basicMapping.isDefault());
+ basicMapping.getColumn().setSpecifiedName("FOO");
+ basicMapping.setTemporal(TemporalType.TIME);
+ basicMapping.setLob(true);
+ basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ assertFalse(basicMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME));
+ }
+
+ public void testBasicMorphToEmbeddedId() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertFalse(basicMapping.isDefault());
+ basicMapping.getColumn().setSpecifiedName("FOO");
+ basicMapping.setTemporal(TemporalType.TIME);
+ basicMapping.setLob(true);
+ basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ assertFalse(basicMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME));
+ }
+
+ public void testBasicMorphToTransient() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertFalse(basicMapping.isDefault());
+ basicMapping.getColumn().setSpecifiedName("FOO");
+ basicMapping.setTemporal(TemporalType.TIME);
+ basicMapping.setLob(true);
+ basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ assertFalse(basicMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME));
+ }
+
+ public void testBasicMorphToOneToOne() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertFalse(basicMapping.isDefault());
+ basicMapping.getColumn().setSpecifiedName("FOO");
+ basicMapping.setTemporal(TemporalType.TIME);
+ basicMapping.setLob(true);
+ basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedFetch(FetchType.EAGER);
+ basicMapping.setSpecifiedOptional(Boolean.FALSE);
+ assertFalse(basicMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+//TODO assertEquals(FetchType.EAGER, ((IOneToOneMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
+// assertEquals(Boolean.FALSE, ((IOneToOneMapping) persistentAttribute.getMapping()).getSpecifiedOptional());
+ assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME));
+ }
+
+ public void testBasicMorphToOneToMany() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertFalse(basicMapping.isDefault());
+ basicMapping.getColumn().setSpecifiedName("FOO");
+ basicMapping.setTemporal(TemporalType.TIME);
+ basicMapping.setLob(true);
+ basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedFetch(FetchType.EAGER);
+ basicMapping.setSpecifiedOptional(Boolean.FALSE);
+ assertFalse(basicMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+//TODO assertEquals(FetchType.EAGER, ((IOneToManyMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
+// assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME));
+ }
+ public void testBasicMorphToManyToOne() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertFalse(basicMapping.isDefault());
+ basicMapping.getColumn().setSpecifiedName("FOO");
+ basicMapping.setTemporal(TemporalType.TIME);
+ basicMapping.setLob(true);
+ basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedFetch(FetchType.EAGER);
+ basicMapping.setSpecifiedOptional(Boolean.FALSE);
+ assertFalse(basicMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+//TODO assertEquals(FetchType.EAGER, ((IManyToOneMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
+// assertEquals(Boolean.FALSE, ((IManyToOneMapping) persistentAttribute.getMapping()).getSpecifiedOptional());
+ assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME));
+ }
+
+ public void testBasicMorphToManyToMany() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertFalse(basicMapping.isDefault());
+ basicMapping.getColumn().setSpecifiedName("FOO");
+ basicMapping.setTemporal(TemporalType.TIME);
+ basicMapping.setLob(true);
+ basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ basicMapping.setSpecifiedFetch(FetchType.EAGER);
+ basicMapping.setSpecifiedOptional(Boolean.FALSE);
+ assertFalse(basicMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+//TODO assertEquals(FetchType.EAGER, ((IManyToManyMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
+// assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME));
+ }
+
+ public void testDefaultBasicGetDefaultOptional() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertEquals(Boolean.TRUE, basicMapping.getDefaultOptional());
+ }
+
+ public void testSpecifiedBasicGetDefaultOptional() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+ assertEquals(Boolean.TRUE, basicMapping.getDefaultOptional());
+ }
+
+ public void testGetOptional() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertEquals(Boolean.TRUE, basicMapping.getOptional());
+
+ basicMapping.setSpecifiedOptional(basicMapping.getOptional());
+ assertEquals(Boolean.TRUE, basicMapping.getOptional());
+ }
+
+ public void testGetSpecifiedOptional() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(basicMapping.getSpecifiedOptional());
+
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC);
+ basic.setOptional(Boolean.FALSE);
+
+ assertEquals(Boolean.FALSE, basicMapping.getSpecifiedOptional());
+ }
+
+ public void testGetSpecifiedOptional2() throws Exception {
+ createTestEntityWithBasicMappingFetchOptionalSpecified();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertEquals(Boolean.FALSE, basicMapping.getSpecifiedOptional());
+ }
+
+ public void testSetSpecifiedOptional() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+ assertNull(basicMapping.getSpecifiedOptional());
+
+ basicMapping.setSpecifiedOptional(Boolean.FALSE);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC);
+
+ assertEquals(Boolean.FALSE, basic.getOptional());
+
+ basicMapping.setSpecifiedOptional(null);
+ assertNotNull(attributeResource.mappingAnnotation(JPA.BASIC));
+ }
+
+ public void testSetSpecifiedOptional2() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertNull(basicMapping.getSpecifiedOptional());
+ assertTrue(basicMapping.isDefault());
+
+ basicMapping.setSpecifiedOptional(Boolean.TRUE);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC);
+
+ assertEquals(Boolean.TRUE, basic.getOptional());
+
+ basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertEquals(Boolean.TRUE, basicMapping.getSpecifiedOptional());
+ assertFalse(basicMapping.isDefault());
+
+ basicMapping.setSpecifiedOptional(null);
+ assertNotNull(attributeResource.mappingAnnotation(JPA.BASIC));
+
+ basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertFalse(basicMapping.isDefault());
+ }
+
+
+ public void testGetSpecifiedOptionalUpdatesFromResourceModelChange() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(basicMapping.getSpecifiedOptional());
+
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC);
+ basic.setOptional(Boolean.FALSE);
+
+ assertEquals(Boolean.FALSE, basicMapping.getSpecifiedOptional());
+
+ basic.setOptional(null);
+ assertNull(basicMapping.getSpecifiedOptional());
+ assertFalse(basicMapping.isDefault());
+ assertSame(basicMapping, persistentAttribute.getSpecifiedMapping());
+
+ basic.setOptional(Boolean.FALSE);
+ attributeResource.setMappingAnnotation(null);
+
+ assertNull(persistentAttribute.getSpecifiedMapping());
+ assertEquals(Boolean.TRUE, ((IBasicMapping) persistentAttribute.getMapping()).getOptional());
+ }
+
+
+ public void testIsLob() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertFalse(basicMapping.isLob());
+ }
+
+ public void testIsLob2() throws Exception {
+ createTestEntityWithLob();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+
+ assertTrue(basicMapping.isLob());
+ }
+
+ public void testSetLob() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+
+ basicMapping.setLob(true);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNotNull(attributeResource.annotation(Lob.ANNOTATION_NAME));
+
+ basicMapping.setLob(false);
+ assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME));
+ }
+
+ public void testIsLobUpdatesFromResourceModelChange() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertFalse(basicMapping.isLob());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ attributeResource.addAnnotation(Lob.ANNOTATION_NAME);
+
+ assertTrue(basicMapping.isLob());
+
+ attributeResource.removeAnnotation(Lob.ANNOTATION_NAME);
+
+ assertFalse(basicMapping.isLob());
+ }
+
+ public void testDefaultBasicGetDefaultEnumerated() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+ assertEquals(EnumType.ORDINAL, basicMapping.getDefaultEnumerated());
+ }
+
+ public void testSpecifiedBasicGetDefaultEnumerated() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+ assertEquals(EnumType.ORDINAL, basicMapping.getDefaultEnumerated());
+ }
+
+ public void testGetEnumerated() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertEquals(EnumType.ORDINAL, basicMapping.getEnumerated());
+
+ basicMapping.setSpecifiedEnumerated(EnumType.STRING);
+ assertEquals(EnumType.STRING, basicMapping.getEnumerated());
+ }
+
+ public void testGetSpecifiedEnumerated() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(basicMapping.getSpecifiedEnumerated());
+ }
+
+ public void testGetSpecifiedEnumerated2() throws Exception {
+ createTestEntityWithEnumerated();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+
+ assertEquals(EnumType.STRING, basicMapping.getSpecifiedEnumerated());
+ }
+
+ public void testSetSpecifiedEnumerated() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+ assertNull(basicMapping.getSpecifiedEnumerated());
+
+ basicMapping.setSpecifiedEnumerated(EnumType.STRING);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Enumerated enumerated = (Enumerated) attributeResource.annotation(Enumerated.ANNOTATION_NAME);
+
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.EnumType.STRING, enumerated.getValue());
+
+ basicMapping.setSpecifiedEnumerated(null);
+ assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME));
+ }
+
+ public void testGetSpecifieEnumeratedUpdatesFromResourceModelChange() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(basicMapping.getSpecifiedEnumerated());
+
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Enumerated enumerated = (Enumerated) attributeResource.addAnnotation(Enumerated.ANNOTATION_NAME);
+ enumerated.setValue(org.eclipse.jpt.core.internal.resource.java.EnumType.STRING);
+
+ assertEquals(EnumType.STRING, basicMapping.getSpecifiedEnumerated());
+
+ enumerated.setValue(null);
+ assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME));
+ assertNull(basicMapping.getSpecifiedEnumerated());
+ assertFalse(basicMapping.isDefault());
+ assertSame(basicMapping, persistentAttribute.getSpecifiedMapping());
+ }
+
+
+ public void testGetTemporal() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(basicMapping.getTemporal());
+ }
+
+ public void testGetTemporal2() throws Exception {
+ createTestEntityWithTemporal();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping();
+
+ assertEquals(TemporalType.TIMESTAMP, basicMapping.getTemporal());
+ }
+
+ public void testSetTemporal() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+ assertNull(basicMapping.getTemporal());
+
+ basicMapping.setTemporal(TemporalType.TIME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Temporal temporal = (Temporal) attributeResource.annotation(Temporal.ANNOTATION_NAME);
+
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.TemporalType.TIME, temporal.getValue());
+
+ basicMapping.setTemporal(null);
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ }
+
+ public void testGetTemporalUpdatesFromResourceModelChange() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(basicMapping.getTemporal());
+
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Temporal temporal = (Temporal) attributeResource.addAnnotation(Temporal.ANNOTATION_NAME);
+ temporal.setValue(org.eclipse.jpt.core.internal.resource.java.TemporalType.DATE);
+
+ assertEquals(TemporalType.DATE, basicMapping.getTemporal());
+
+ attributeResource.removeAnnotation(Temporal.ANNOTATION_NAME);
+
+ assertNull(basicMapping.getTemporal());
+ assertFalse(basicMapping.isDefault());
+ assertSame(basicMapping, persistentAttribute.getSpecifiedMapping());
+ }
+
+ public void testGetColumn() throws Exception {
+ createTestEntityWithBasicMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedName());
+ assertEquals("id", basicMapping.getColumn().getName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN);
+ column.setName("foo");
+
+ assertEquals("foo", basicMapping.getColumn().getSpecifiedName());
+ assertEquals("foo", basicMapping.getColumn().getName());
+ assertEquals("id", basicMapping.getColumn().getDefaultName());
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaColumnTests.java
new file mode 100644
index 0000000000..cd17122989
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaColumnTests.java
@@ -0,0 +1,849 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.context.base.IAbstractColumn;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IColumn;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.resource.java.Column;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaColumnTests extends ContextModelTestCase
+{
+ private static final String COLUMN_NAME = "MY_COLUMN";
+ private static final String TABLE_NAME = "MY_TABLE";
+ private static final String COLUMN_DEFINITION = "MY_COLUMN_DEFINITION";
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createBasicAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Basic", "String name() default \"\";");
+ }
+
+ private void createColumnAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Column",
+ "String name() default \"\";" +
+ "boolean unique() default false;" +
+ "boolean nullable() default true;" +
+ "boolean insertable() default true;" +
+ "boolean updatable() default true;" +
+ "String columnDefinition() default \"\";" +
+ "String table() default \"\";" +
+ "int length() default 255;" +
+ "int precision() default 0;" +
+ "int scale() default 0;");
+ }
+
+ private IType createTestEntity() throws Exception {
+ createEntityAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ });
+ }
+
+ private IType createTestEntityWithDefaultBasicColumn() throws Exception {
+ createEntityAnnotation();
+ createColumnAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Column(name=\"" + COLUMN_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestEntityWithBasicColumnTableSet() throws Exception {
+ createEntityAnnotation();
+ createColumnAnnotation();
+ createBasicAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, JPA.COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Basic");
+ sb.append("@Column(table=\"" + TABLE_NAME + "\")");
+ }
+ });
+ }
+ private IType createTestEntityWithBasicColumnColumnDefinitionSet() throws Exception {
+ createEntityAnnotation();
+ createColumnAnnotation();
+ createBasicAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, JPA.COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Basic");
+ sb.append("@Column(columnDefinition=\"" + COLUMN_DEFINITION + "\")");
+ }
+ });
+ }
+
+ public JavaColumnTests(String name) {
+ super(name);
+ }
+
+ public void testGetSpecifiedNameNull() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedName());
+ }
+
+ public void testGetSpecifiedName() throws Exception {
+ createTestEntityWithDefaultBasicColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(COLUMN_NAME, basicMapping.getColumn().getSpecifiedName());
+ }
+
+ public void testGetDefaultNameSpecifiedNameNull() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(basicMapping.persistentAttribute().getName(), basicMapping.getColumn().getDefaultName());
+ assertEquals("id", basicMapping.getColumn().getDefaultName());
+ }
+
+ public void testGetDefaultName() throws Exception {
+ createTestEntityWithDefaultBasicColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+ assertEquals("id", basicMapping.getColumn().getDefaultName());
+
+ basicMapping.getColumn().setSpecifiedName("foo");
+ assertEquals("id", basicMapping.getColumn().getDefaultName());
+ }
+
+ public void testGetNameSpecifiedNameNull() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals("id", basicMapping.getColumn().getName());
+ }
+
+ public void testGetName() throws Exception {
+ createTestEntityWithDefaultBasicColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(COLUMN_NAME, basicMapping.getColumn().getName());
+ }
+
+ public void testSetSpecifiedName() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ basicMapping.getColumn().setSpecifiedName("foo");
+
+ assertEquals("foo", basicMapping.getColumn().getSpecifiedName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals("foo", column.getName());
+ }
+
+ public void testSetSpecifiedNameNull() throws Exception {
+ createTestEntityWithDefaultBasicColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ basicMapping.getColumn().setSpecifiedName(null);
+
+ assertNull(basicMapping.getColumn().getSpecifiedName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.annotation(JPA.COLUMN));
+ }
+
+ public void testGetNameUpdatesFromResourceChange() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN);
+
+ column.setName("foo");
+ assertEquals("foo", basicMapping.getColumn().getSpecifiedName());
+ assertEquals("foo", basicMapping.getColumn().getName());
+
+ column.setName(null);
+ assertNull(basicMapping.getColumn().getSpecifiedName());
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+ public void testGetSpecifiedTableNull() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedTable());
+ }
+
+ public void testGetSpecifiedTable() throws Exception {
+ createTestEntityWithBasicColumnTableSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(TABLE_NAME, basicMapping.getColumn().getSpecifiedTable());
+ }
+
+ public void testGetDefaultTableSpecifiedTableNull() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(((IEntity) basicMapping.typeMapping()).getName(), basicMapping.getColumn().getDefaultTable());
+ assertEquals(TYPE_NAME, basicMapping.getColumn().getDefaultTable());
+ }
+
+ public void testGetDefaultTable() throws Exception {
+ createTestEntityWithDefaultBasicColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+ assertEquals(TYPE_NAME, basicMapping.getColumn().getDefaultTable());
+
+ basicMapping.getColumn().setSpecifiedTable("foo");
+ assertEquals(TYPE_NAME, basicMapping.getColumn().getDefaultTable());
+ }
+
+ public void testGetTable() throws Exception {
+ createTestEntityWithBasicColumnTableSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(TABLE_NAME, basicMapping.getColumn().getTable());
+ }
+
+ public void testSetSpecifiedTable() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ basicMapping.getColumn().setSpecifiedTable("foo");
+
+ assertEquals("foo", basicMapping.getColumn().getSpecifiedTable());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals("foo", column.getTable());
+ }
+
+ public void testSetSpecifiedTableNull() throws Exception {
+ createTestEntityWithBasicColumnTableSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ basicMapping.getColumn().setSpecifiedTable(null);
+
+ assertNull(basicMapping.getColumn().getSpecifiedTable());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.annotation(JPA.COLUMN));
+ }
+
+ public void testGetTableUpdatesFromResourceChange() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedTable());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN);
+
+ column.setTable("foo");
+ assertEquals("foo", basicMapping.getColumn().getSpecifiedTable());
+ assertEquals("foo", basicMapping.getColumn().getTable());
+
+ column.setTable(null);
+ assertNull(basicMapping.getColumn().getSpecifiedTable());
+ }
+
+ public void testGetColumnDefinition() throws Exception {
+ createTestEntityWithBasicColumnColumnDefinitionSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(COLUMN_DEFINITION, basicMapping.getColumn().getColumnDefinition());
+ }
+
+ public void testSetColumnDefinition() throws Exception {
+ createTestEntityWithBasicColumnTableSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ basicMapping.getColumn().setColumnDefinition("foo");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals("foo", column.getColumnDefinition());
+
+ basicMapping.getColumn().setColumnDefinition(null);
+ assertNull(column.getColumnDefinition());
+ }
+
+ public void testGetColumnDefinitionUpdatesFromResourceChange() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getColumnDefinition());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN);
+
+ column.setColumnDefinition("foo");
+ assertEquals("foo", basicMapping.getColumn().getColumnDefinition());
+
+ column.setColumnDefinition(null);
+ assertNull(basicMapping.getColumn().getColumnDefinition());
+
+ }
+
+ public void testGetLength() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(IColumn.DEFAULT_LENGTH, basicMapping.getColumn().getLength());
+ basicMapping.getColumn().setSpecifiedLength(Integer.valueOf(55));
+ assertEquals(Integer.valueOf(55), basicMapping.getColumn().getLength());
+ }
+
+ public void testGetDefaultLength() throws Exception {
+ createTestEntityWithBasicColumnColumnDefinitionSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(IColumn.DEFAULT_LENGTH, basicMapping.getColumn().getDefaultLength());
+ basicMapping.getColumn().setSpecifiedLength(Integer.valueOf(55));
+
+ assertEquals(IColumn.DEFAULT_LENGTH, basicMapping.getColumn().getDefaultLength());
+ }
+
+ public void testGetSpecifiedLength() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedLength());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN);
+ column.setLength(Integer.valueOf(66));
+
+ assertEquals(Integer.valueOf(66), basicMapping.getColumn().getSpecifiedLength());
+ assertEquals(Integer.valueOf(66), basicMapping.getColumn().getLength());
+
+ column.setLength(null);
+
+ assertNull(attributeResource.annotation(JPA.COLUMN));
+ assertNull(basicMapping.getColumn().getSpecifiedLength());
+ }
+
+ public void testSetSpecifiedLength() throws Exception {
+ createTestEntityWithBasicColumnColumnDefinitionSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedLength());
+
+ basicMapping.getColumn().setSpecifiedLength(Integer.valueOf(100));
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals(Integer.valueOf(100), column.getLength());
+
+ basicMapping.getColumn().setSpecifiedLength(null);
+
+ assertNull(column.getLength());
+ }
+
+ public void testGetPrecision() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(IColumn.DEFAULT_PRECISION, basicMapping.getColumn().getPrecision());
+ basicMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(55));
+ assertEquals(Integer.valueOf(55), basicMapping.getColumn().getPrecision());
+ }
+
+ public void testGetDefaultPrecision() throws Exception {
+ createTestEntityWithBasicColumnColumnDefinitionSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(IColumn.DEFAULT_PRECISION, basicMapping.getColumn().getDefaultPrecision());
+ basicMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(55));
+
+ assertEquals(IColumn.DEFAULT_PRECISION, basicMapping.getColumn().getDefaultPrecision());
+ }
+
+ public void testGetSpecifiedPrecision() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedPrecision());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN);
+ column.setPrecision(Integer.valueOf(66));
+
+ assertEquals(Integer.valueOf(66), basicMapping.getColumn().getSpecifiedPrecision());
+ assertEquals(Integer.valueOf(66), basicMapping.getColumn().getPrecision());
+
+ column.setPrecision(null);
+
+ assertNull(attributeResource.annotation(JPA.COLUMN));
+ assertNull(basicMapping.getColumn().getSpecifiedPrecision());
+ }
+
+ public void testSetSpecifiedPrecision() throws Exception {
+ createTestEntityWithBasicColumnColumnDefinitionSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedPrecision());
+
+ basicMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(100));
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals(Integer.valueOf(100), column.getPrecision());
+
+ basicMapping.getColumn().setSpecifiedPrecision(null);
+
+ assertNull(column.getPrecision());
+ }
+
+ public void testGetScale() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(IColumn.DEFAULT_SCALE, basicMapping.getColumn().getScale());
+ basicMapping.getColumn().setSpecifiedScale(Integer.valueOf(55));
+ assertEquals(Integer.valueOf(55), basicMapping.getColumn().getScale());
+ }
+
+ public void testGetDefaultScale() throws Exception {
+ createTestEntityWithBasicColumnColumnDefinitionSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(IColumn.DEFAULT_SCALE, basicMapping.getColumn().getDefaultScale());
+ basicMapping.getColumn().setSpecifiedScale(Integer.valueOf(55));
+
+ assertEquals(IColumn.DEFAULT_SCALE, basicMapping.getColumn().getDefaultScale());
+ }
+
+ public void testGetSpecifiedScale() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedScale());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN);
+ column.setScale(Integer.valueOf(66));
+
+ assertEquals(Integer.valueOf(66), basicMapping.getColumn().getSpecifiedScale());
+ assertEquals(Integer.valueOf(66), basicMapping.getColumn().getScale());
+
+ column.setScale(null);
+
+ assertNull(attributeResource.annotation(JPA.COLUMN));
+ assertNull(basicMapping.getColumn().getSpecifiedScale());
+ }
+
+ public void testSetSpecifiedScale() throws Exception {
+ createTestEntityWithBasicColumnColumnDefinitionSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedScale());
+
+ basicMapping.getColumn().setSpecifiedScale(Integer.valueOf(100));
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals(Integer.valueOf(100), column.getScale());
+
+ basicMapping.getColumn().setSpecifiedScale(null);
+
+ assertNull(column.getScale());
+ }
+
+ public void testGetUnique() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(IAbstractColumn.DEFAULT_UNIQUE, basicMapping.getColumn().getUnique());
+ basicMapping.getColumn().setSpecifiedUnique(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, basicMapping.getColumn().getUnique());
+ }
+
+ public void testGetDefaultUnique() throws Exception {
+ createTestEntityWithBasicColumnColumnDefinitionSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(IAbstractColumn.DEFAULT_UNIQUE, basicMapping.getColumn().getDefaultUnique());
+ basicMapping.getColumn().setSpecifiedUnique(Boolean.TRUE);
+
+ assertEquals(IAbstractColumn.DEFAULT_UNIQUE, basicMapping.getColumn().getDefaultUnique());
+ }
+
+ public void testGetSpecifiedUnique() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedUnique());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN);
+ column.setUnique(Boolean.TRUE);
+
+ assertEquals(Boolean.TRUE, basicMapping.getColumn().getSpecifiedUnique());
+ assertEquals(Boolean.TRUE, basicMapping.getColumn().getUnique());
+
+ column.setUnique(null);
+
+ assertNull(attributeResource.annotation(JPA.COLUMN));
+ assertNull(basicMapping.getColumn().getSpecifiedUnique());
+ }
+
+ public void testSetSpecifiedUnique() throws Exception {
+ createTestEntityWithBasicColumnColumnDefinitionSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedUnique());
+
+ basicMapping.getColumn().setSpecifiedUnique(Boolean.FALSE);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals(Boolean.FALSE, column.getUnique());
+
+ basicMapping.getColumn().setSpecifiedUnique(null);
+
+ assertNull(column.getUnique());
+ }
+
+ public void testGetInsertable() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(IAbstractColumn.DEFAULT_INSERTABLE, basicMapping.getColumn().getInsertable());
+ basicMapping.getColumn().setSpecifiedInsertable(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, basicMapping.getColumn().getInsertable());
+ }
+
+ public void testGetDefaultInsertable() throws Exception {
+ createTestEntityWithBasicColumnColumnDefinitionSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(IAbstractColumn.DEFAULT_INSERTABLE, basicMapping.getColumn().getDefaultInsertable());
+ basicMapping.getColumn().setSpecifiedInsertable(Boolean.TRUE);
+
+ assertEquals(IAbstractColumn.DEFAULT_INSERTABLE, basicMapping.getColumn().getDefaultInsertable());
+ }
+
+ public void testGetSpecifiedInsertable() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedInsertable());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN);
+ column.setInsertable(Boolean.TRUE);
+
+ assertEquals(Boolean.TRUE, basicMapping.getColumn().getSpecifiedInsertable());
+ assertEquals(Boolean.TRUE, basicMapping.getColumn().getInsertable());
+
+ column.setInsertable(null);
+
+ assertNull(attributeResource.annotation(JPA.COLUMN));
+ assertNull(basicMapping.getColumn().getSpecifiedInsertable());
+ }
+
+ public void testSetSpecifiedInsertable() throws Exception {
+ createTestEntityWithBasicColumnColumnDefinitionSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedInsertable());
+
+ basicMapping.getColumn().setSpecifiedInsertable(Boolean.FALSE);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals(Boolean.FALSE, column.getInsertable());
+
+ basicMapping.getColumn().setSpecifiedInsertable(null);
+
+ assertNull(column.getInsertable());
+ }
+
+ public void testGetNullable() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(IAbstractColumn.DEFAULT_NULLABLE, basicMapping.getColumn().getNullable());
+ basicMapping.getColumn().setSpecifiedNullable(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, basicMapping.getColumn().getNullable());
+ }
+
+ public void testGetDefaultNullable() throws Exception {
+ createTestEntityWithBasicColumnColumnDefinitionSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(IAbstractColumn.DEFAULT_NULLABLE, basicMapping.getColumn().getDefaultNullable());
+ basicMapping.getColumn().setSpecifiedNullable(Boolean.TRUE);
+
+ assertEquals(IAbstractColumn.DEFAULT_NULLABLE, basicMapping.getColumn().getDefaultNullable());
+ }
+
+ public void testGetSpecifiedNullable() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedNullable());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN);
+ column.setNullable(Boolean.TRUE);
+
+ assertEquals(Boolean.TRUE, basicMapping.getColumn().getSpecifiedNullable());
+ assertEquals(Boolean.TRUE, basicMapping.getColumn().getNullable());
+
+ column.setNullable(null);
+
+ assertNull(attributeResource.annotation(JPA.COLUMN));
+ assertNull(basicMapping.getColumn().getSpecifiedNullable());
+ }
+
+ public void testSetSpecifiedNullable() throws Exception {
+ createTestEntityWithBasicColumnColumnDefinitionSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedNullable());
+
+ basicMapping.getColumn().setSpecifiedNullable(Boolean.FALSE);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals(Boolean.FALSE, column.getNullable());
+
+ basicMapping.getColumn().setSpecifiedNullable(null);
+
+ assertNull(column.getNullable());
+ }
+
+ public void testGetUpdatable() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(IAbstractColumn.DEFAULT_UPDATABLE, basicMapping.getColumn().getUpdatable());
+ basicMapping.getColumn().setSpecifiedUpdatable(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, basicMapping.getColumn().getUpdatable());
+ }
+
+ public void testGetDefaultUpdatable() throws Exception {
+ createTestEntityWithBasicColumnColumnDefinitionSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertEquals(IAbstractColumn.DEFAULT_UPDATABLE, basicMapping.getColumn().getDefaultUpdatable());
+ basicMapping.getColumn().setSpecifiedUpdatable(Boolean.TRUE);
+
+ assertEquals(IAbstractColumn.DEFAULT_UPDATABLE, basicMapping.getColumn().getDefaultUpdatable());
+ }
+
+ public void testGetSpecifiedUpdatable() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedUpdatable());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN);
+ column.setUpdatable(Boolean.TRUE);
+
+ assertEquals(Boolean.TRUE, basicMapping.getColumn().getSpecifiedUpdatable());
+ assertEquals(Boolean.TRUE, basicMapping.getColumn().getUpdatable());
+
+ column.setUpdatable(null);
+
+ assertNull(attributeResource.annotation(JPA.COLUMN));
+ assertNull(basicMapping.getColumn().getSpecifiedUpdatable());
+ }
+
+ public void testSetSpecifiedUpdatable() throws Exception {
+ createTestEntityWithBasicColumnColumnDefinitionSet();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping();
+
+ assertNull(basicMapping.getColumn().getSpecifiedUpdatable());
+
+ basicMapping.getColumn().setSpecifiedUpdatable(Boolean.FALSE);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals(Boolean.FALSE, column.getUpdatable());
+
+ basicMapping.getColumn().setSpecifiedUpdatable(null);
+
+ assertNull(column.getUpdatable());
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java
new file mode 100644
index 0000000000..a6e3b8fe29
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java
@@ -0,0 +1,327 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.context.base.DiscriminatorType;
+import org.eclipse.jpt.core.internal.context.base.IDiscriminatorColumn;
+import org.eclipse.jpt.core.internal.resource.java.DiscriminatorColumn;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaDiscriminatorColumnTests extends ContextModelTestCase
+{
+ private static final String DISCRIMINATOR_COLUMN_NAME = "MY_DISCRIMINATOR_COLUMN";
+ private static final String COLUMN_DEFINITION = "MY_COLUMN_DEFINITION";
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+ private void createDiscriminatorColumnAnnotation() throws Exception{
+ this.createAnnotationAndMembers("DiscriminatorColumn",
+ "String name() default \"DTYPE\";" +
+ "DiscriminatorType discriminatorType() default STRING;" +
+ "String columnDefinition() default \"\";" +
+ "int length() default 31;");
+ }
+
+
+ private IType createTestEntity() throws Exception {
+ createEntityAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ });
+ }
+
+ private IType createTestEntityWithDiscriminatorColumn() throws Exception {
+ createEntityAnnotation();
+ createDiscriminatorColumnAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.DISCRIMINATOR_COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ sb.append("@DiscriminatorColumn(name=\"" + DISCRIMINATOR_COLUMN_NAME + "\")");
+ }
+ });
+ }
+
+
+ public JavaDiscriminatorColumnTests(String name) {
+ super(name);
+ }
+
+ public void testGetSpecifiedNameNull() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedName());
+ }
+
+ public void testGetSpecifiedName() throws Exception {
+ createTestEntityWithDiscriminatorColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(DISCRIMINATOR_COLUMN_NAME, javaEntity().getDiscriminatorColumn().getSpecifiedName());
+ }
+
+ public void testGetDefaultNameSpecifiedNameNull() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals("DTYPE", javaEntity().getDiscriminatorColumn().getDefaultName());
+ }
+
+ public void testGetDefaultName() throws Exception {
+ createTestEntityWithDiscriminatorColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals("DTYPE", javaEntity().getDiscriminatorColumn().getDefaultName());
+
+ javaEntity().getDiscriminatorColumn().setSpecifiedName("foo");
+ assertEquals("DTYPE", javaEntity().getDiscriminatorColumn().getDefaultName());
+ }
+
+ public void testGetNameSpecifiedNameNull() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals("DTYPE", javaEntity().getDiscriminatorColumn().getName());
+ }
+
+ public void testGetName() throws Exception {
+ createTestEntityWithDiscriminatorColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(DISCRIMINATOR_COLUMN_NAME, javaEntity().getDiscriminatorColumn().getName());
+ }
+
+ public void testSetSpecifiedName() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().getDiscriminatorColumn().setSpecifiedName("foo");
+
+ assertEquals("foo", javaEntity().getDiscriminatorColumn().getSpecifiedName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ DiscriminatorColumn discriminatorColumn = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+
+ assertEquals("foo", discriminatorColumn.getName());
+ }
+
+ public void testSetSpecifiedNameNull() throws Exception {
+ createTestEntityWithDiscriminatorColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().getDiscriminatorColumn().setSpecifiedName(null);
+
+ assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ DiscriminatorColumn discriminatorColumn = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+
+ assertNull(discriminatorColumn);
+ }
+
+ public void testGetDefaultDiscriminatorType() throws Exception {
+ createTestEntityWithDiscriminatorColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(DiscriminatorType.STRING, javaEntity().getDiscriminatorColumn().getDefaultDiscriminatorType());
+ }
+
+ public void testGetDiscriminatorType() throws Exception {
+ createTestEntityWithDiscriminatorColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(DiscriminatorType.STRING, javaEntity().getDiscriminatorColumn().getDiscriminatorType());
+
+ javaEntity().getDiscriminatorColumn().setSpecifiedDiscriminatorType(DiscriminatorType.CHAR);
+ assertEquals(DiscriminatorType.CHAR, javaEntity().getDiscriminatorColumn().getDiscriminatorType());
+ }
+
+ public void testGetSpecifiedDiscriminatorType() throws Exception {
+ createTestEntityWithDiscriminatorColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType());
+
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ DiscriminatorColumn discriminatorColumn = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+ discriminatorColumn.setDiscriminatorType(org.eclipse.jpt.core.internal.resource.java.DiscriminatorType.CHAR);
+
+ assertEquals(DiscriminatorType.CHAR, javaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType());
+ }
+
+ public void testSetSpecifiedDiscriminatorType() throws Exception {
+ createTestEntityWithDiscriminatorColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType());
+
+ javaEntity().getDiscriminatorColumn().setSpecifiedDiscriminatorType(DiscriminatorType.CHAR);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ DiscriminatorColumn discriminatorColumn = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.DiscriminatorType.CHAR, discriminatorColumn.getDiscriminatorType());
+
+ javaEntity().getDiscriminatorColumn().setSpecifiedName(null);
+ javaEntity().getDiscriminatorColumn().setSpecifiedDiscriminatorType(null);
+ assertNull(typeResource.annotation(JPA.DISCRIMINATOR_COLUMN));
+ }
+
+ public void testGetDiscriminatorTypeUpdatesFromResourceChange() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ DiscriminatorColumn column = (DiscriminatorColumn) typeResource.addAnnotation(JPA.DISCRIMINATOR_COLUMN);
+
+ column.setDiscriminatorType(org.eclipse.jpt.core.internal.resource.java.DiscriminatorType.INTEGER);
+ assertEquals(DiscriminatorType.INTEGER, javaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType());
+ assertEquals(DiscriminatorType.INTEGER, javaEntity().getDiscriminatorColumn().getDiscriminatorType());
+
+ column.setDiscriminatorType(null);
+ assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType());
+ assertEquals(IDiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE, javaEntity().getDiscriminatorColumn().getDiscriminatorType());
+ }
+
+ public void testGetLength() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(IDiscriminatorColumn.DEFAULT_LENGTH, javaEntity().getDiscriminatorColumn().getLength());
+ javaEntity().getDiscriminatorColumn().setSpecifiedLength(Integer.valueOf(55));
+ assertEquals(Integer.valueOf(55), javaEntity().getDiscriminatorColumn().getLength());
+ }
+
+ public void testGetDefaultLength() throws Exception {
+ createTestEntityWithDiscriminatorColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(IDiscriminatorColumn.DEFAULT_LENGTH, javaEntity().getDiscriminatorColumn().getDefaultLength());
+ javaEntity().getDiscriminatorColumn().setSpecifiedLength(Integer.valueOf(55));
+
+ assertEquals(IDiscriminatorColumn.DEFAULT_LENGTH, javaEntity().getDiscriminatorColumn().getDefaultLength());
+ }
+
+ public void testGetSpecifiedLength() throws Exception {
+ createTestEntityWithDiscriminatorColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedLength());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ DiscriminatorColumn discriminatorColumn = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+ discriminatorColumn.setLength(Integer.valueOf(66));
+
+ assertEquals(Integer.valueOf(66), javaEntity().getDiscriminatorColumn().getSpecifiedLength());
+ assertEquals(Integer.valueOf(66), javaEntity().getDiscriminatorColumn().getLength());
+ discriminatorColumn.setName(null);
+ discriminatorColumn.setLength(null);
+
+ assertNull(typeResource.annotation(JPA.DISCRIMINATOR_COLUMN));
+ assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedLength());
+ }
+
+ public void testSetSpecifiedLength() throws Exception {
+ createTestEntityWithDiscriminatorColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedLength());
+
+ javaEntity().getDiscriminatorColumn().setSpecifiedLength(Integer.valueOf(100));
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ DiscriminatorColumn discriminatorColumn = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+
+ assertEquals(Integer.valueOf(100), discriminatorColumn.getLength());
+
+ javaEntity().getDiscriminatorColumn().setSpecifiedName(null);
+ javaEntity().getDiscriminatorColumn().setSpecifiedLength(null);
+ assertNull(typeResource.annotation(JPA.DISCRIMINATOR_COLUMN));
+ }
+
+ public void testGetLengthUpdatesFromResourceChange() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedLength());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ DiscriminatorColumn column = (DiscriminatorColumn) typeResource.addAnnotation(JPA.DISCRIMINATOR_COLUMN);
+
+ column.setLength(Integer.valueOf(78));
+ assertEquals(Integer.valueOf(78), javaEntity().getDiscriminatorColumn().getSpecifiedLength());
+ assertEquals(Integer.valueOf(78), javaEntity().getDiscriminatorColumn().getLength());
+
+ column.setLength(null);
+ assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedLength());
+ assertEquals(IDiscriminatorColumn.DEFAULT_LENGTH, javaEntity().getDiscriminatorColumn().getLength());
+ }
+
+
+ public void testGetColumnDefinition() throws Exception {
+ createTestEntityWithDiscriminatorColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getDiscriminatorColumn().getColumnDefinition());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+ column.setColumnDefinition(COLUMN_DEFINITION);
+
+ assertEquals(COLUMN_DEFINITION, javaEntity().getDiscriminatorColumn().getColumnDefinition());
+
+ column.setColumnDefinition(null);
+
+ assertNull(javaEntity().getDiscriminatorColumn().getColumnDefinition());
+
+ typeResource.removeAnnotation(JPA.DISCRIMINATOR_COLUMN);
+ }
+
+ public void testSetColumnDefinition() throws Exception {
+ createTestEntityWithDiscriminatorColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().getDiscriminatorColumn().setColumnDefinition("foo");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+
+ assertEquals("foo", column.getColumnDefinition());
+
+ javaEntity().getDiscriminatorColumn().setColumnDefinition(null);
+ column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+ assertNull(column.getColumnDefinition());
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddableTests.java
new file mode 100644
index 0000000000..2e69d1452d
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddableTests.java
@@ -0,0 +1,187 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddable;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IMappedSuperclass;
+import org.eclipse.jpt.core.internal.context.java.JavaNullTypeMapping;
+import org.eclipse.jpt.core.internal.resource.java.Embeddable;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaEmbeddableTests extends ContextModelTestCase
+{
+
+ private void createEmbeddableAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Embeddable", "");
+ }
+
+ private IType createTestEmbeddable() throws Exception {
+ createEmbeddableAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.EMBEDDABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Embeddable");
+ }
+ });
+ }
+
+
+ public JavaEmbeddableTests(String name) {
+ super(name);
+ }
+
+ public void testMorphToEntity() throws Exception {
+ createTestEmbeddable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaPersistentType().setMappingKey(IMappingKeys.ENTITY_TYPE_MAPPING_KEY);
+ assertTrue(javaPersistentType().getMapping() instanceof IEntity);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Embeddable.ANNOTATION_NAME));
+ }
+
+ public void testMorphToMappedSuperclass() throws Exception {
+ createTestEmbeddable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaPersistentType().setMappingKey(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
+ assertTrue(javaPersistentType().getMapping() instanceof IMappedSuperclass);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Embeddable.ANNOTATION_NAME));
+ }
+
+ public void testMorphToNull() throws Exception {
+ createTestEmbeddable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaPersistentType().setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY);
+ assertTrue(javaPersistentType().getMapping() instanceof JavaNullTypeMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ assertNull(typeResource.mappingAnnotation(Embeddable.ANNOTATION_NAME));
+ }
+
+ public void testEmbeddable() throws Exception {
+ createTestEmbeddable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ assertTrue(javaPersistentType().getMapping() instanceof IEmbeddable);
+ }
+
+ public void testOverridableAttributeNames() throws Exception {
+ createTestEmbeddable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping();
+ Iterator<String> overridableAttributeNames = embeddable.overridableAttributeNames();
+ assertFalse(overridableAttributeNames.hasNext());
+ }
+
+ public void testOverridableAssociationNames() throws Exception {
+ createTestEmbeddable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping();
+ Iterator<String> overridableAssociationNames = embeddable.overridableAssociationNames();
+ assertFalse(overridableAssociationNames.hasNext());
+ }
+
+ public void testTableNameIsInvalid() throws Exception {
+ createTestEmbeddable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping();
+
+ assertFalse(embeddable.tableNameIsInvalid(FULLY_QUALIFIED_TYPE_NAME));
+ assertFalse(embeddable.tableNameIsInvalid("FOO"));
+ }
+
+ public void testAttributeMappingKeyAllowed() throws Exception {
+ createTestEmbeddable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping();
+ assertTrue(embeddable.attributeMappingKeyAllowed(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(embeddable.attributeMappingKeyAllowed(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY));
+ assertFalse(embeddable.attributeMappingKeyAllowed(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY));
+ assertFalse(embeddable.attributeMappingKeyAllowed(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY));
+ assertFalse(embeddable.attributeMappingKeyAllowed(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY));
+ assertFalse(embeddable.attributeMappingKeyAllowed(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY));
+ assertFalse(embeddable.attributeMappingKeyAllowed(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY));
+ assertFalse(embeddable.attributeMappingKeyAllowed(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY));
+ assertFalse(embeddable.attributeMappingKeyAllowed(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY));
+ assertFalse(embeddable.attributeMappingKeyAllowed(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY));
+ }
+
+
+ public void testAssociatedTables() throws Exception {
+ createTestEmbeddable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping();
+
+ assertFalse(embeddable.associatedTables().hasNext());
+ }
+
+ public void testAssociatedTablesIncludingInherited() throws Exception {
+ createTestEmbeddable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping();
+
+ assertFalse(embeddable.associatedTablesIncludingInherited().hasNext());
+ }
+
+ public void testAssociatedTableNamesIncludingInherited() throws Exception {
+ createTestEmbeddable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping();
+
+ assertFalse(embeddable.associatedTableNamesIncludingInherited().hasNext());
+ }
+
+ public void testAllOverridableAttributeNames() throws Exception {
+ createTestEmbeddable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping();
+ Iterator<String> overridableAttributeNames = embeddable.overridableAttributeNames();
+ assertFalse(overridableAttributeNames.hasNext());
+ }
+
+ //TODO need to create a subclass mappedSuperclass and test this
+ public void testAllOverridableAssociationNames() throws Exception {
+ createTestEmbeddable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping();
+ Iterator<String> overridableAssociationNames = embeddable.overridableAssociationNames();
+ assertFalse(overridableAssociationNames.hasNext());
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java
new file mode 100644
index 0000000000..ec89c84cfb
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java
@@ -0,0 +1,615 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IAttributeOverride;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IClassRef;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddable;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
+import org.eclipse.jpt.core.internal.context.base.IVersionMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaAttributeOverride;
+import org.eclipse.jpt.core.internal.context.java.JavaNullAttributeMapping;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverrides;
+import org.eclipse.jpt.core.internal.resource.java.Basic;
+import org.eclipse.jpt.core.internal.resource.java.Embedded;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.java.Id;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.java.ManyToOne;
+import org.eclipse.jpt.core.internal.resource.java.OneToMany;
+import org.eclipse.jpt.core.internal.resource.java.OneToOne;
+import org.eclipse.jpt.core.internal.resource.java.Transient;
+import org.eclipse.jpt.core.internal.resource.java.Version;
+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.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
+{
+
+ public static final String EMBEDDABLE_TYPE_NAME = "MyEmbeddable";
+ public static final String FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME = PACKAGE_NAME + "." + EMBEDDABLE_TYPE_NAME;
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createEmbeddableAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Embeddable", "");
+ }
+
+ private void createEmbeddedIdAnnotation() throws Exception{
+ this.createAnnotationAndMembers("EmbeddedId", "");
+ }
+
+ private IType createTestEntityWithEmbeddedIdMapping() throws Exception {
+ createEntityAnnotation();
+ createEmbeddedIdAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.EMBEDDED_ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@EmbeddedId").append(CR);
+ sb.append(CR);
+ sb.append(" private " + EMBEDDABLE_TYPE_NAME +" myEmbeddedId;").append(CR);
+ sb.append(CR);
+ }
+ });
+ }
+
+ private IType createEmbeddableType() throws Exception {
+ createEmbeddableAnnotation();
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.EMBEDDABLE);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Embeddable");
+ sb.append(CR);
+ sb.append("public class ").append(EMBEDDABLE_TYPE_NAME).append(" {");
+ sb.append(CR);
+ sb.append(" private String city;").append(CR);
+ sb.append(CR);
+ sb.append(" private String state;").append(CR);
+ sb.append(CR);
+ sb.append(" ");
+ sb.append("}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, EMBEDDABLE_TYPE_NAME + ".java", sourceWriter);
+ }
+
+
+ public JavaEmbeddedIdMappingTests(String name) {
+ super(name);
+ }
+
+ public void testMorphToBasicMapping() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping();
+ embeddedIdMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedIdMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IBasicMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testMorphToDefault() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping();
+ embeddedIdMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedIdMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(((IEmbeddedMapping) persistentAttribute.getMapping()).attributeOverrides().hasNext());
+ assertTrue(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testDefaultEmbeddedIdMapping() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping();
+ assertFalse(embeddedIdMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof JavaNullAttributeMapping);
+ assertTrue(persistentAttribute.getMapping().isDefault());
+
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping);
+ assertTrue(persistentAttribute.getMapping().isDefault());
+ }
+
+ public void testMorphToVersionMapping() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping();
+ embeddedIdMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedIdMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IVersionMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testMorphToTransientMapping() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping();
+ embeddedIdMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedIdMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testMorphToIdMapping() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping();
+ embeddedIdMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedIdMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IIdMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddedMapping() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping();
+ embeddedIdMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedIdMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testMorphToOneToOneMapping() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping();
+ embeddedIdMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedIdMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testMorphToOneToManyMapping() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping();
+ embeddedIdMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedIdMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testMorphToManyToOneMapping() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping();
+ embeddedIdMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedIdMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testMorphToManyToManyMapping() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping();
+ embeddedIdMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedIdMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testSpecifiedAttributeOverrides() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping();
+
+ ListIterator<IJavaAttributeOverride> specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
+
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ //add an annotation to the resource model and verify the context model is updated
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("FOO");
+ specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals("FOO", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+ attributeOverride = (AttributeOverride) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("BAR");
+ specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals("FOO", specifiedAttributeOverrides.next().getName());
+ assertEquals("BAR", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+
+ attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("BAZ");
+ specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
+ assertEquals("FOO", specifiedAttributeOverrides.next().getName());
+ assertEquals("BAR", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+ //move an annotation to the resource model and verify the context model is updated
+ attributeResource.move(1, 0, JPA.ATTRIBUTE_OVERRIDES);
+ specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals("FOO", specifiedAttributeOverrides.next().getName());
+ assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
+ assertEquals("BAR", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+ attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
+ assertEquals("BAR", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+ attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals("BAR", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+
+ attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
+ assertFalse(specifiedAttributeOverrides.hasNext());
+ }
+
+ public void testDefaultAttributeOverrides() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertEquals("myEmbeddedId", attributeResource.getName());
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverrides.ANNOTATION_NAME));
+
+ assertEquals(2, CollectionTools.size(embeddedIdMapping.defaultAttributeOverrides()));
+ IAttributeOverride defaultAttributeOverride = embeddedIdMapping.defaultAttributeOverrides().next();
+ assertEquals("city", defaultAttributeOverride.getName());
+ assertEquals("city", defaultAttributeOverride.getColumn().getName());
+ assertEquals(TYPE_NAME, defaultAttributeOverride.getColumn().getTable());
+
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IEmbeddable embeddable = (IEmbeddable) classRefs.next().getJavaPersistentType().getMapping();
+
+ IBasicMapping cityMapping = (IBasicMapping) embeddable.persistentType().attributeNamed("city").getMapping();
+ cityMapping.getColumn().setSpecifiedName("FOO");
+ cityMapping.getColumn().setSpecifiedTable("BAR");
+
+ assertEquals(2, CollectionTools.size(embeddedIdMapping.defaultAttributeOverrides()));
+ defaultAttributeOverride = embeddedIdMapping.defaultAttributeOverrides().next();
+ assertEquals("city", defaultAttributeOverride.getName());
+ assertEquals("FOO", defaultAttributeOverride.getColumn().getName());
+ assertEquals("BAR", defaultAttributeOverride.getColumn().getTable());
+
+ cityMapping.getColumn().setSpecifiedName(null);
+ cityMapping.getColumn().setSpecifiedTable(null);
+ defaultAttributeOverride = embeddedIdMapping.defaultAttributeOverrides().next();
+ assertEquals("city", defaultAttributeOverride.getName());
+ assertEquals("city", defaultAttributeOverride.getColumn().getName());
+ assertEquals(TYPE_NAME, defaultAttributeOverride.getColumn().getTable());
+
+ embeddedIdMapping.addSpecifiedAttributeOverride(0).setName("city");
+ assertEquals(1, CollectionTools.size(embeddedIdMapping.defaultAttributeOverrides()));
+ }
+
+ public void testSpecifiedAttributeOverridesSize() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping();
+ assertEquals(0, embeddedIdMapping.specifiedAttributeOverridesSize());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ //add an annotation to the resource model and verify the context model is updated
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("FOO");
+ attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("BAR");
+
+ assertEquals(2, embeddedIdMapping.specifiedAttributeOverridesSize());
+ }
+
+ public void testAddSpecifiedAttributeOverride() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping();
+ embeddedIdMapping.addSpecifiedAttributeOverride(0).setName("FOO");
+ embeddedIdMapping.addSpecifiedAttributeOverride(0).setName("BAR");
+ embeddedIdMapping.addSpecifiedAttributeOverride(0).setName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Iterator<JavaResource> attributeOverrides = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+
+ assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertFalse(attributeOverrides.hasNext());
+ }
+
+ public void testAddSpecifiedAttributeOverride2() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping();
+ embeddedIdMapping.addSpecifiedAttributeOverride(0).setName("FOO");
+ embeddedIdMapping.addSpecifiedAttributeOverride(1).setName("BAR");
+ embeddedIdMapping.addSpecifiedAttributeOverride(2).setName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Iterator<JavaResource> attributeOverrides = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+
+ assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertFalse(attributeOverrides.hasNext());
+ }
+
+ public void testRemoveSpecifiedAttributeOverride() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping();
+ embeddedIdMapping.addSpecifiedAttributeOverride(0).setName("FOO");
+ embeddedIdMapping.addSpecifiedAttributeOverride(1).setName("BAR");
+ embeddedIdMapping.addSpecifiedAttributeOverride(2).setName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ assertEquals(3, CollectionTools.size(attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME)));
+
+ embeddedIdMapping.removeSpecifiedAttributeOverride(1);
+
+ Iterator<JavaResource> attributeOverrideResources = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ assertEquals("FOO", ((AttributeOverride) attributeOverrideResources.next()).getName());
+ assertEquals("BAZ", ((AttributeOverride) attributeOverrideResources.next()).getName());
+ assertFalse(attributeOverrideResources.hasNext());
+
+ Iterator<IAttributeOverride> attributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+
+ embeddedIdMapping.removeSpecifiedAttributeOverride(1);
+ attributeOverrideResources = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ assertEquals("FOO", ((AttributeOverride) attributeOverrideResources.next()).getName());
+ assertFalse(attributeOverrideResources.hasNext());
+
+ attributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+
+ embeddedIdMapping.removeSpecifiedAttributeOverride(0);
+ attributeOverrideResources = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ assertFalse(attributeOverrideResources.hasNext());
+ attributeOverrides = embeddedIdMapping.specifiedAttributeOverrides();
+ assertFalse(attributeOverrides.hasNext());
+
+ assertNull(attributeResource.annotation(AttributeOverrides.ANNOTATION_NAME));
+ }
+
+ public void testMoveSpecifiedAttributeOverride() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping();
+ embeddedIdMapping.addSpecifiedAttributeOverride(0).setName("FOO");
+ embeddedIdMapping.addSpecifiedAttributeOverride(1).setName("BAR");
+ embeddedIdMapping.addSpecifiedAttributeOverride(2).setName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ attributeResource.move(2, 0, AttributeOverrides.ANNOTATION_NAME);
+
+ Iterator<JavaResource> attributeOverrides = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+
+ assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName());
+ }
+
+ public void testAttributeOverrideIsVirtual() throws Exception {
+ createTestEntityWithEmbeddedIdMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping();
+ ListIterator<IAttributeOverride> defaultAttributeOverrides = embeddedIdMapping.defaultAttributeOverrides();
+ IAttributeOverride defaultAttributeOverride = defaultAttributeOverrides.next();
+ assertEquals("city", defaultAttributeOverride.getName());
+ assertTrue(defaultAttributeOverride.isVirtual());
+
+ defaultAttributeOverride = defaultAttributeOverrides.next();
+ assertEquals("state", defaultAttributeOverride.getName());
+ assertTrue(defaultAttributeOverride.isVirtual());
+ assertFalse(defaultAttributeOverrides.hasNext());
+
+ embeddedIdMapping.addSpecifiedAttributeOverride(0).setName("state");
+ IAttributeOverride specifiedAttributeOverride = embeddedIdMapping.specifiedAttributeOverrides().next();
+ assertFalse(specifiedAttributeOverride.isVirtual());
+
+
+ defaultAttributeOverrides = embeddedIdMapping.defaultAttributeOverrides();
+ defaultAttributeOverride = defaultAttributeOverrides.next();
+ assertEquals("city", defaultAttributeOverride.getName());
+ assertTrue(defaultAttributeOverride.isVirtual());
+ assertFalse(defaultAttributeOverrides.hasNext());
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedMappingTests.java
new file mode 100644
index 0000000000..9922dcd9c8
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedMappingTests.java
@@ -0,0 +1,618 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IAttributeOverride;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IClassRef;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddable;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
+import org.eclipse.jpt.core.internal.context.base.IVersionMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaAttributeOverride;
+import org.eclipse.jpt.core.internal.context.java.JavaNullAttributeMapping;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverrides;
+import org.eclipse.jpt.core.internal.resource.java.Basic;
+import org.eclipse.jpt.core.internal.resource.java.Embedded;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.java.Id;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.java.ManyToOne;
+import org.eclipse.jpt.core.internal.resource.java.OneToMany;
+import org.eclipse.jpt.core.internal.resource.java.OneToOne;
+import org.eclipse.jpt.core.internal.resource.java.Transient;
+import org.eclipse.jpt.core.internal.resource.java.Version;
+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.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaEmbeddedMappingTests extends ContextModelTestCase
+{
+
+ public static final String EMBEDDABLE_TYPE_NAME = "MyEmbeddable";
+ public static final String FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME = PACKAGE_NAME + "." + EMBEDDABLE_TYPE_NAME;
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createEmbeddableAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Embeddable", "");
+ }
+
+ private void createEmbeddedAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Embedded", "");
+ }
+
+ private IType createTestEntityWithEmbeddedMapping() throws Exception {
+ createEntityAnnotation();
+ createEmbeddedAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.EMBEDDED);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Embedded").append(CR);
+ sb.append(" private " + EMBEDDABLE_TYPE_NAME + " myEmbedded;").append(CR);
+ sb.append(CR);
+ }
+ });
+ }
+
+ private IType createEmbeddableType() throws Exception {
+ createEmbeddableAnnotation();
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.EMBEDDABLE);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Embeddable");
+ sb.append(CR);
+ sb.append("public class ").append(EMBEDDABLE_TYPE_NAME).append(" {");
+ sb.append(CR);
+ sb.append(" private String city;").append(CR);
+ sb.append(CR);
+ sb.append(" private String state;").append(CR);
+ sb.append(CR);
+ sb.append(" ");
+ sb.append("}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, EMBEDDABLE_TYPE_NAME + ".java", sourceWriter);
+ }
+
+
+ public JavaEmbeddedMappingTests(String name) {
+ super(name);
+ }
+
+ public void testMorphToBasicMapping() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping();
+ assertFalse(embeddedMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IBasicMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testMorphToDefault() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping();
+ embeddedMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(((IEmbeddedMapping) persistentAttribute.getMapping()).attributeOverrides().hasNext());
+ assertTrue(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testDefaultEmbeddedMapping() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping();
+ assertFalse(embeddedMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof JavaNullAttributeMapping);
+ assertTrue(persistentAttribute.getMapping().isDefault());
+
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping);
+ assertTrue(persistentAttribute.getMapping().isDefault());
+ }
+
+ public void testMorphToVersionMapping() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping();
+ embeddedMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IVersionMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testMorphToTransientMapping() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping();
+ embeddedMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testMorphToIdMapping() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping();
+ embeddedMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IIdMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddedIdMapping() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping();
+ embeddedMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testMorphToOneToOneMapping() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping();
+ embeddedMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testMorphToOneToManyMapping() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping();
+ embeddedMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testMorphToManyToOneMapping() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping();
+ embeddedMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testMorphToManyToManyMapping() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping();
+ embeddedMapping.addSpecifiedAttributeOverride(0);
+ assertFalse(embeddedMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ }
+
+ public void testSpecifiedAttributeOverrides() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping();
+
+ ListIterator<IJavaAttributeOverride> specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
+
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ //add an annotation to the resource model and verify the context model is updated
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("FOO");
+ specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
+ assertEquals("FOO", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+ attributeOverride = (AttributeOverride) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("BAR");
+ specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
+ assertEquals("FOO", specifiedAttributeOverrides.next().getName());
+ assertEquals("BAR", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+
+ attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("BAZ");
+ specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
+ assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
+ assertEquals("FOO", specifiedAttributeOverrides.next().getName());
+ assertEquals("BAR", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+ //move an annotation to the resource model and verify the context model is updated
+ attributeResource.move(1, 0, JPA.ATTRIBUTE_OVERRIDES);
+ specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
+ assertEquals("FOO", specifiedAttributeOverrides.next().getName());
+ assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
+ assertEquals("BAR", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+ attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
+ assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
+ assertEquals("BAR", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+ attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
+ assertEquals("BAR", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+
+ attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides();
+ assertFalse(specifiedAttributeOverrides.hasNext());
+ }
+
+ public void testDefaultAttributeOverrides() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertEquals("myEmbedded", attributeResource.getName());
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverrides.ANNOTATION_NAME));
+
+ assertEquals(2, CollectionTools.size(embeddedMapping.defaultAttributeOverrides()));
+ IAttributeOverride defaultAttributeOverride = embeddedMapping.defaultAttributeOverrides().next();
+ assertEquals("city", defaultAttributeOverride.getName());
+ assertEquals("city", defaultAttributeOverride.getColumn().getName());
+ assertEquals(TYPE_NAME, defaultAttributeOverride.getColumn().getTable());
+
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IEmbeddable embeddable = (IEmbeddable) classRefs.next().getJavaPersistentType().getMapping();
+
+ IBasicMapping cityMapping = (IBasicMapping) embeddable.persistentType().attributeNamed("city").getMapping();
+ cityMapping.getColumn().setSpecifiedName("FOO");
+ cityMapping.getColumn().setSpecifiedTable("BAR");
+
+ assertEquals("myEmbedded", attributeResource.getName());
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverrides.ANNOTATION_NAME));
+
+ assertEquals(2, CollectionTools.size(embeddedMapping.defaultAttributeOverrides()));
+ defaultAttributeOverride = embeddedMapping.defaultAttributeOverrides().next();
+ assertEquals("city", defaultAttributeOverride.getName());
+ assertEquals("FOO", defaultAttributeOverride.getColumn().getName());
+ assertEquals("BAR", defaultAttributeOverride.getColumn().getTable());
+
+ cityMapping.getColumn().setSpecifiedName(null);
+ cityMapping.getColumn().setSpecifiedTable(null);
+ defaultAttributeOverride = embeddedMapping.defaultAttributeOverrides().next();
+ assertEquals("city", defaultAttributeOverride.getName());
+ assertEquals("city", defaultAttributeOverride.getColumn().getName());
+ assertEquals(TYPE_NAME, defaultAttributeOverride.getColumn().getTable());
+
+ embeddedMapping.addSpecifiedAttributeOverride(0).setName("city");
+ assertEquals(1, CollectionTools.size(embeddedMapping.defaultAttributeOverrides()));
+ }
+
+ public void testSpecifiedAttributeOverridesSize() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping();
+ assertEquals(0, embeddedMapping.specifiedAttributeOverridesSize());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ //add an annotation to the resource model and verify the context model is updated
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("FOO");
+ attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("BAR");
+
+ assertEquals(2, embeddedMapping.specifiedAttributeOverridesSize());
+ }
+
+ public void testAddSpecifiedAttributeOverride() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping();
+ embeddedMapping.addSpecifiedAttributeOverride(0).setName("FOO");
+ embeddedMapping.addSpecifiedAttributeOverride(0).setName("BAR");
+ embeddedMapping.addSpecifiedAttributeOverride(0).setName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Iterator<JavaResource> attributeOverrides = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+
+ assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertFalse(attributeOverrides.hasNext());
+ }
+
+ public void testAddSpecifiedAttributeOverride2() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping();
+ embeddedMapping.addSpecifiedAttributeOverride(0).setName("FOO");
+ embeddedMapping.addSpecifiedAttributeOverride(1).setName("BAR");
+ embeddedMapping.addSpecifiedAttributeOverride(2).setName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Iterator<JavaResource> attributeOverrides = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+
+ assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertFalse(attributeOverrides.hasNext());
+ }
+
+ public void testRemoveSpecifiedAttributeOverride() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping();
+ embeddedMapping.addSpecifiedAttributeOverride(0).setName("FOO");
+ embeddedMapping.addSpecifiedAttributeOverride(1).setName("BAR");
+ embeddedMapping.addSpecifiedAttributeOverride(2).setName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ assertEquals(3, CollectionTools.size(attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME)));
+
+ embeddedMapping.removeSpecifiedAttributeOverride(1);
+
+ Iterator<JavaResource> attributeOverrideResources = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ assertEquals("FOO", ((AttributeOverride) attributeOverrideResources.next()).getName());
+ assertEquals("BAZ", ((AttributeOverride) attributeOverrideResources.next()).getName());
+ assertFalse(attributeOverrideResources.hasNext());
+
+ Iterator<IAttributeOverride> attributeOverrides = embeddedMapping.specifiedAttributeOverrides();
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+
+ embeddedMapping.removeSpecifiedAttributeOverride(1);
+ attributeOverrideResources = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ assertEquals("FOO", ((AttributeOverride) attributeOverrideResources.next()).getName());
+ assertFalse(attributeOverrideResources.hasNext());
+
+ attributeOverrides = embeddedMapping.specifiedAttributeOverrides();
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+
+ embeddedMapping.removeSpecifiedAttributeOverride(0);
+ attributeOverrideResources = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ assertFalse(attributeOverrideResources.hasNext());
+ attributeOverrides = embeddedMapping.specifiedAttributeOverrides();
+ assertFalse(attributeOverrides.hasNext());
+
+ assertNull(attributeResource.annotation(AttributeOverrides.ANNOTATION_NAME));
+ }
+
+ public void testMoveSpecifiedAttributeOverride() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping();
+ embeddedMapping.addSpecifiedAttributeOverride(0).setName("FOO");
+ embeddedMapping.addSpecifiedAttributeOverride(1).setName("BAR");
+ embeddedMapping.addSpecifiedAttributeOverride(2).setName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ attributeResource.move(2, 0, AttributeOverrides.ANNOTATION_NAME);
+
+ Iterator<JavaResource> attributeOverrides = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+
+ assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName());
+ }
+
+ public void testAttributeOverrideIsVirtual() throws Exception {
+ createTestEntityWithEmbeddedMapping();
+ createEmbeddableType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
+
+ IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping();
+ ListIterator<IAttributeOverride> defaultAttributeOverrides = embeddedMapping.defaultAttributeOverrides();
+ IAttributeOverride defaultAttributeOverride = defaultAttributeOverrides.next();
+ assertEquals("city", defaultAttributeOverride.getName());
+ assertTrue(defaultAttributeOverride.isVirtual());
+
+ defaultAttributeOverride = defaultAttributeOverrides.next();
+ assertEquals("state", defaultAttributeOverride.getName());
+ assertTrue(defaultAttributeOverride.isVirtual());
+ assertFalse(defaultAttributeOverrides.hasNext());
+
+ embeddedMapping.addSpecifiedAttributeOverride(0).setName("state");
+ IAttributeOverride specifiedAttributeOverride = embeddedMapping.specifiedAttributeOverrides().next();
+ assertFalse(specifiedAttributeOverride.isVirtual());
+
+
+ defaultAttributeOverrides = embeddedMapping.defaultAttributeOverrides();
+ defaultAttributeOverride = defaultAttributeOverrides.next();
+ assertEquals("city", defaultAttributeOverride.getName());
+ assertTrue(defaultAttributeOverride.isVirtual());
+ assertFalse(defaultAttributeOverrides.hasNext());
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java
new file mode 100644
index 0000000000..3fb053666a
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java
@@ -0,0 +1,2440 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.base.DiscriminatorType;
+import org.eclipse.jpt.core.internal.context.base.IAssociationOverride;
+import org.eclipse.jpt.core.internal.context.base.IAttributeOverride;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IClassRef;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddable;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IMappedSuperclass;
+import org.eclipse.jpt.core.internal.context.base.INamedNativeQuery;
+import org.eclipse.jpt.core.internal.context.base.INamedQuery;
+import org.eclipse.jpt.core.internal.context.base.IPersistentType;
+import org.eclipse.jpt.core.internal.context.base.IPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.ISecondaryTable;
+import org.eclipse.jpt.core.internal.context.base.ITable;
+import org.eclipse.jpt.core.internal.context.base.InheritanceType;
+import org.eclipse.jpt.core.internal.context.java.IJavaAttributeOverride;
+import org.eclipse.jpt.core.internal.context.java.IJavaEntity;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.context.java.IJavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.context.java.IJavaSecondaryTable;
+import org.eclipse.jpt.core.internal.context.java.JavaNullTypeMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.AssociationOverride;
+import org.eclipse.jpt.core.internal.resource.java.AssociationOverrides;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverrides;
+import org.eclipse.jpt.core.internal.resource.java.DiscriminatorColumn;
+import org.eclipse.jpt.core.internal.resource.java.DiscriminatorValue;
+import org.eclipse.jpt.core.internal.resource.java.Entity;
+import org.eclipse.jpt.core.internal.resource.java.IdClass;
+import org.eclipse.jpt.core.internal.resource.java.Inheritance;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueries;
+import org.eclipse.jpt.core.internal.resource.java.NamedNativeQuery;
+import org.eclipse.jpt.core.internal.resource.java.NamedQueries;
+import org.eclipse.jpt.core.internal.resource.java.NamedQuery;
+import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumns;
+import org.eclipse.jpt.core.internal.resource.java.SecondaryTable;
+import org.eclipse.jpt.core.internal.resource.java.SecondaryTables;
+import org.eclipse.jpt.core.internal.resource.java.SequenceGenerator;
+import org.eclipse.jpt.core.internal.resource.java.Table;
+import org.eclipse.jpt.core.internal.resource.java.TableGenerator;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.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.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaEntityTests extends ContextModelTestCase
+{
+ private static final String ENTITY_NAME = "entityName";
+ private static final String TABLE_NAME = "MY_TABLE";
+ private static final String DISCRIMINATOR_VALUE = "MY_DISCRIMINATOR_VALUE";
+ protected static final String SUB_TYPE_NAME = "AnnotationTestTypeChild";
+ protected static final String FULLY_QUALIFIED_SUB_TYPE_NAME = PACKAGE_NAME + "." + SUB_TYPE_NAME;
+
+
+ public JavaEntityTests(String name) {
+ super(name);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createIdAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Id", "");
+ }
+
+ private void createMappedSuperclassAnnotation() throws Exception{
+ this.createAnnotationAndMembers("MappedSuperclass", "");
+ }
+
+ private void createTableAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Table", "String name() default \"\";");
+ }
+
+ private void createInheritanceAnnotation() throws Exception {
+ createInheritanceTypeEnum();
+ this.createAnnotationAndMembers("Inheritance", "InheritanceType strategy() default SINGLE_TABLE;");
+ }
+
+ private void createInheritanceTypeEnum() throws Exception {
+ this.createEnumAndMembers("InheritanceType", "SINGLE_TABLE, JOINED, TABLE_PER_CLASS");
+ }
+
+ private void createDiscriminatorValueAnnotation() throws Exception {
+ this.createAnnotationAndMembers("DiscriminatorValue", "String value();");
+ }
+
+ private void createSecondaryTableAnnotation() throws Exception {
+ this.createAnnotationAndMembers("SecondaryTable",
+ "String name(); " +
+ "String catalog() default \"\"; " +
+ "String schema() default \"\"; ");
+// PrimaryKeyJoinColumn[] pkJoinColumns() default {};
+// UniqueConstraint[] uniqueConstraints() default {};
+ }
+
+ private void createSecondaryTablesAnnotation() throws Exception {
+ createSecondaryTableAnnotation();
+ this.createAnnotationAndMembers("SecondaryTables", "SecondaryTable[] value();");
+ }
+
+ private void createPrimaryKeyJoinColumnAnnotation() throws Exception {
+ this.createAnnotationAndMembers("PrimaryKeyJoinColumn",
+ "String name(); " +
+ "String referencedColumnName() default \"\"; " +
+ "String columnDefinition() default \"\"; ");
+ }
+
+ private void createPrimaryKeyJoinColumnsAnnotation() throws Exception {
+ createPrimaryKeyJoinColumnAnnotation();
+ this.createAnnotationAndMembers("PrimaryKeyJoinColumns", "PrimaryKeyJoinColumn[] value();");
+ }
+
+
+ private IType createTestEntity() throws Exception {
+ createEntityAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ });
+ }
+
+ private IType createTestEntityAnnotationOnProperty() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestMappedSuperclass() throws Exception {
+ createMappedSuperclassAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS, JPA.ONE_TO_ONE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@MappedSuperclass");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToOne");
+ sb.append(CR);
+ sb.append(" private int address;").append(CR);
+ sb.append(CR);
+ sb.append(" ");
+ }
+ });
+ }
+
+ private IType createTestEntityWithName() throws Exception {
+ createEntityAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity(name=\"" + ENTITY_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestEntityWithTable() throws Exception {
+ createEntityAnnotation();
+ createTableAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.TABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ sb.append("@Table(name=\"" + TABLE_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestSubType() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
+ sb.append("extends " + TYPE_NAME + " ");
+ sb.append("{}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
+ }
+
+ private IType createTestEntityWithInheritance() throws Exception {
+ createEntityAnnotation();
+ createInheritanceAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.INHERITANCE, JPA.INHERITANCE_TYPE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ sb.append("@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)").append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithDiscriminatorValue() throws Exception {
+ createEntityAnnotation();
+ createDiscriminatorValueAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.DISCRIMINATOR_VALUE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ sb.append("@DiscriminatorValue(value=\"" + DISCRIMINATOR_VALUE + "\")");
+ }
+ });
+ }
+
+ private IType createTestEntityWithSecondaryTable() throws Exception {
+ createEntityAnnotation();
+ createSecondaryTableAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ sb.append("@SecondaryTable(name=\"foo\")");
+ }
+ });
+ }
+
+ private IType createTestEntityWithSecondaryTables() throws Exception {
+ createEntityAnnotation();
+ createSecondaryTablesAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ sb.append("@SecondaryTables({@SecondaryTable(name=\"foo\"), @SecondaryTable(name=\"bar\")})");
+ }
+ });
+ }
+
+ private IType createTestEntityWithPrimaryKeyJoinColumns() throws Exception {
+ createEntityAnnotation();
+ createPrimaryKeyJoinColumnsAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ sb.append("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name=\"foo\"), @PrimaryKeyJoinColumn(name=\"bar\")})");
+ }
+ });
+ }
+
+
+ public void testMorphToMappedSuperclass() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = (IEntity) javaPersistentType().getMapping();
+ entity.getTable().setSpecifiedName("FOO");
+ entity.addSpecifiedSecondaryTable(0);
+ entity.addSpecifiedPrimaryKeyJoinColumn(0);
+ entity.addSpecifiedAttributeOverride(0);
+ entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+ entity.setSpecifiedDiscriminatorValue("asdf");
+ entity.addTableGenerator();
+ entity.addSequenceGenerator();
+
+ javaPersistentType().setMappingKey(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
+ assertTrue(javaPersistentType().getMapping() instanceof IMappedSuperclass);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Entity.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Table.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(SecondaryTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(PrimaryKeyJoinColumn.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Inheritance.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(DiscriminatorValue.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddable() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = (IEntity) javaPersistentType().getMapping();
+ entity.getTable().setSpecifiedName("FOO");
+ entity.addSpecifiedSecondaryTable(0);
+ entity.addSpecifiedPrimaryKeyJoinColumn(0);
+ entity.addSpecifiedAttributeOverride(0);
+ entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+ entity.setSpecifiedDiscriminatorValue("asdf");
+ entity.addTableGenerator();
+ entity.addSequenceGenerator();
+
+ javaPersistentType().setMappingKey(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
+ assertTrue(javaPersistentType().getMapping() instanceof IEmbeddable);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ assertNull(typeResource.mappingAnnotation(Entity.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(Table.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(SecondaryTable.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(PrimaryKeyJoinColumn.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(Inheritance.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(DiscriminatorValue.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(TableGenerator.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(SequenceGenerator.ANNOTATION_NAME));
+ }
+
+ public void testMorphToNull() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = (IEntity) javaPersistentType().getMapping();
+ entity.getTable().setSpecifiedName("FOO");
+ entity.addSpecifiedSecondaryTable(0);
+ entity.addSpecifiedPrimaryKeyJoinColumn(0);
+ entity.addSpecifiedAttributeOverride(0);
+ entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+ entity.setSpecifiedDiscriminatorValue("asdf");
+ entity.addTableGenerator();
+ entity.addSequenceGenerator();
+
+ javaPersistentType().setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY);
+ assertTrue(javaPersistentType().getMapping() instanceof JavaNullTypeMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ assertNull(typeResource.mappingAnnotation(Entity.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(Table.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(SecondaryTable.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(PrimaryKeyJoinColumn.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(Inheritance.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(DiscriminatorValue.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(TableGenerator.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(SequenceGenerator.ANNOTATION_NAME));
+ }
+
+ public void testAccessNoAnnotations() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ assertEquals(AccessType.FIELD, javaPersistentType().access());
+ }
+
+ public void testAccessAnnotationsOnParent() throws Exception {
+ createTestEntityAnnotationOnProperty();
+ createTestSubType();
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+
+ IJavaPersistentType childPersistentType = javaPersistentType();
+ IPersistentType parentPersistentType = childPersistentType.parentPersistentType();
+
+ assertEquals(AccessType.PROPERTY, parentPersistentType.access());
+ assertEquals(AccessType.PROPERTY, childPersistentType.access());
+
+ ((IIdMapping) parentPersistentType.attributeNamed("id").getMapping()).getColumn().setSpecifiedName("FOO");
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ typeResource.properties().next().setMappingAnnotation(null);
+ //no mapping(Id) annotation, but still a Column annotation, so access should still be property
+ assertEquals(AccessType.PROPERTY, parentPersistentType.access());
+ assertEquals(AccessType.PROPERTY, childPersistentType.access());
+
+ ((IBasicMapping) parentPersistentType.attributeNamed("id").getMapping()).getColumn().setSpecifiedName(null);
+ assertEquals(AccessType.FIELD, parentPersistentType.access());
+ assertEquals(AccessType.FIELD, childPersistentType.access());
+
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
+ assertEquals(AccessType.PROPERTY, parentPersistentType.access());
+ assertEquals(AccessType.PROPERTY, childPersistentType.access());
+
+ entityMappings().setSpecifiedAccess(AccessType.FIELD);
+ //still accessType of PROPERTY because the java class is not specified in this orm.xml
+ assertEquals(AccessType.PROPERTY, parentPersistentType.access());
+ assertEquals(AccessType.PROPERTY, childPersistentType.access());
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ removeXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ //only parent specified in orm.xml, i think this outcome is right??
+ assertEquals(AccessType.FIELD, xmlPersistentType.javaPersistentType().access());
+ assertEquals(AccessType.FIELD, childPersistentType.access());
+
+ XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+ removeXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ //both parent and child specified in orm.xml
+ assertEquals(AccessType.FIELD, xmlPersistentType.javaPersistentType().access());
+ assertEquals(AccessType.FIELD, childXmlPersistentType.javaPersistentType().access());
+ }
+
+ public void testAccessWithXmlSettings() throws Exception {
+ createTestEntityAnnotationOnProperty();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+
+ assertEquals(AccessType.PROPERTY, javaPersistentType().access());
+
+ ((IIdMapping) javaPersistentType().attributeNamed("id").getMapping()).getColumn().setSpecifiedName("FOO");
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ typeResource.properties().next().setMappingAnnotation(null);
+ //no mapping(Id) annotation, but still a Column annotation, so access should still be property
+ assertEquals(AccessType.PROPERTY, javaPersistentType().access());
+
+ ((IBasicMapping) javaPersistentType().attributeNamed("id").getMapping()).getColumn().setSpecifiedName(null);
+ assertEquals(AccessType.FIELD, javaPersistentType().access());
+
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
+ assertEquals(AccessType.PROPERTY, javaPersistentType().access());
+
+ entityMappings().setSpecifiedAccess(AccessType.FIELD);
+ //still accessType of PROPERTY because the java class is not specified in this orm.xml
+ assertEquals(AccessType.PROPERTY, javaPersistentType().access());
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+
+ //now class is specified in orm.xml, so entityMappings access setting wins over persistence-unit-defaults
+ assertEquals(AccessType.FIELD, xmlPersistentType.javaPersistentType().access());
+
+ ((XmlEntity) xmlPersistentType.getMapping()).setSpecifiedAccess(AccessType.PROPERTY);
+
+ //accessType should be PROPERTY now, java gets the access from xml entity if it is specified
+ assertEquals(AccessType.PROPERTY, xmlPersistentType.javaPersistentType().access());
+ }
+
+ public void testGetSpecifiedNameNull() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getSpecifiedName());
+ }
+
+ public void testGetSpecifiedName() throws Exception {
+ createTestEntityWithName();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(ENTITY_NAME, javaEntity().getSpecifiedName());
+ }
+
+ public void testGetDefaultNameSpecifiedNameNull() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(TYPE_NAME, javaEntity().getDefaultName());
+ }
+
+ public void testGetDefaultName() throws Exception {
+ createTestEntityWithName();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(TYPE_NAME, javaEntity().getDefaultName());
+ }
+
+ public void testGetNameSpecifiedNameNull() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(TYPE_NAME, javaEntity().getName());
+ }
+
+ public void testGetName() throws Exception {
+ createTestEntityWithName();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(ENTITY_NAME, javaEntity().getName());
+ }
+
+ public void testSetSpecifiedName() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().setSpecifiedName("foo");
+
+ assertEquals("foo", javaEntity().getSpecifiedName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals("foo", ((Entity) typeResource.mappingAnnotation()).getName());
+ }
+
+ public void testSetSpecifiedNameNull() throws Exception {
+ createTestEntityWithName();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().setSpecifiedName(null);
+
+ assertNull(javaEntity().getSpecifiedName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(((Entity) typeResource.mappingAnnotation()).getName());
+ }
+
+ public void testUpdateFromSpecifiedNameChangeInResourceModel() throws Exception {
+ createTestEntityWithName();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ Entity entity = (Entity) typeResource.mappingAnnotation();
+ entity.setName("foo");
+
+ assertEquals("foo", javaEntity().getSpecifiedName());
+ }
+
+ public void testGetTableName() throws Exception {
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ createTestEntityWithName();
+
+ assertEquals(ENTITY_NAME, javaEntity().getTableName());
+ }
+
+ public void testGetTableName2() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(TYPE_NAME, javaEntity().getTableName());
+ }
+
+ public void testGetTableName3() throws Exception {
+ createTestEntityWithTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(TABLE_NAME, javaEntity().getTableName());
+ }
+
+ public void testSetTableNameWithNullTable() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ITable table = javaEntity().getTable();
+ assertEquals(TYPE_NAME, table.getName());
+ assertSourceDoesNotContain("@Table");
+
+ table.setSpecifiedName(TABLE_NAME);
+ assertSourceContains("@Table(name=\"" + TABLE_NAME + "\")");
+
+ assertEquals(TABLE_NAME, javaEntity().getTableName());
+ assertEquals(TABLE_NAME, table.getName());
+
+ table.setSpecifiedCatalog(TABLE_NAME);
+ }
+
+ public void testGetInheritanceStrategy() throws Exception {
+ createTestEntityWithInheritance();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(InheritanceType.TABLE_PER_CLASS, javaEntity().getInheritanceStrategy());
+ }
+
+ public void testGetDefaultInheritanceStrategy() throws Exception {
+ createTestEntity();
+ createTestSubType();
+
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNotSame(javaEntity(), javaEntity().rootEntity());
+ assertEquals(InheritanceType.SINGLE_TABLE, javaEntity().getDefaultInheritanceStrategy());
+
+ //change root inheritance strategy, verify default is changed for child entity
+ javaEntity().rootEntity().setSpecifiedInheritanceStrategy(InheritanceType.TABLE_PER_CLASS);
+
+ assertEquals(InheritanceType.SINGLE_TABLE, javaEntity().rootEntity().getDefaultInheritanceStrategy());
+ assertEquals(InheritanceType.TABLE_PER_CLASS, javaEntity().getDefaultInheritanceStrategy());
+ assertEquals(InheritanceType.TABLE_PER_CLASS, javaEntity().getInheritanceStrategy());
+ assertNull(javaEntity().getSpecifiedInheritanceStrategy());
+ }
+
+ public void testGetSpecifiedInheritanceStrategy() throws Exception {
+ createTestEntityWithInheritance();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(InheritanceType.TABLE_PER_CLASS, javaEntity().getSpecifiedInheritanceStrategy());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ Inheritance inheritance = (Inheritance) typeResource.annotation(Inheritance.ANNOTATION_NAME);
+
+ inheritance.setStrategy(org.eclipse.jpt.core.internal.resource.java.InheritanceType.JOINED);
+
+ assertEquals(InheritanceType.JOINED, javaEntity().getSpecifiedInheritanceStrategy());
+
+ inheritance.setStrategy(null);
+
+ assertNull(javaEntity().getSpecifiedInheritanceStrategy());
+ }
+
+ public void testSetSpecifiedInheritanceStrategy() throws Exception {
+ createTestEntityWithInheritance();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ assertEquals(InheritanceType.TABLE_PER_CLASS, javaEntity().getSpecifiedInheritanceStrategy());
+
+ javaEntity().setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+
+ assertEquals(InheritanceType.JOINED, javaEntity().getSpecifiedInheritanceStrategy());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ Inheritance inheritance = (Inheritance) typeResource.annotation(Inheritance.ANNOTATION_NAME);
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.InheritanceType.JOINED, inheritance.getStrategy());
+
+ }
+
+ public void testGetDiscriminatorValue() throws Exception {
+ createTestEntityWithDiscriminatorValue();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(DISCRIMINATOR_VALUE, javaEntity().getDiscriminatorValue());
+ }
+
+ public void testGetDefaultDiscriminatorValue() throws Exception {
+ createTestEntityWithDiscriminatorValue();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(javaEntity().getName(), javaEntity().getDefaultDiscriminatorValue());
+
+ javaEntity().getDiscriminatorColumn().setSpecifiedDiscriminatorType(DiscriminatorType.INTEGER);
+ assertNull(javaEntity().getDefaultDiscriminatorValue());
+ }
+
+ public void testGetSpecifiedDiscriminatorValue() throws Exception {
+ createTestEntityWithDiscriminatorValue();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(DISCRIMINATOR_VALUE, javaEntity().getSpecifiedDiscriminatorValue());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ DiscriminatorValue discriminatorValue = (DiscriminatorValue) typeResource.annotation(DiscriminatorValue.ANNOTATION_NAME);
+
+ discriminatorValue.setValue("foo");
+
+ assertEquals("foo", javaEntity().getSpecifiedDiscriminatorValue());
+
+ discriminatorValue.setValue(null);
+
+ assertNull(javaEntity().getSpecifiedDiscriminatorValue());
+ assertNull(typeResource.annotation(DiscriminatorValue.ANNOTATION_NAME));
+ }
+
+ public void testSetSpecifiedDiscriminatorValue() throws Exception {
+ createTestEntityWithDiscriminatorValue();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ assertEquals(DISCRIMINATOR_VALUE, javaEntity().getSpecifiedDiscriminatorValue());
+
+ javaEntity().setSpecifiedDiscriminatorValue("foo");
+
+ assertEquals("foo", javaEntity().getSpecifiedDiscriminatorValue());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ DiscriminatorValue discriminatorValue = (DiscriminatorValue) typeResource.annotation(DiscriminatorValue.ANNOTATION_NAME);
+ assertEquals("foo", discriminatorValue.getValue());
+ }
+
+ public void testSecondaryTables() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ListIterator<IJavaSecondaryTable> secondaryTables = javaEntity().secondaryTables();
+
+ assertTrue(secondaryTables.hasNext());
+ assertEquals("foo", secondaryTables.next().getName());
+ assertFalse(secondaryTables.hasNext());
+ }
+
+ public void testSecondaryTablesSize() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(1, javaEntity().secondaryTablesSize());
+ }
+
+ public void testSpecifiedSecondaryTables() throws Exception {
+ createTestEntityWithSecondaryTables();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ListIterator<IJavaSecondaryTable> specifiedSecondaryTables = javaEntity().specifiedSecondaryTables();
+
+ assertTrue(specifiedSecondaryTables.hasNext());
+ assertEquals("foo", specifiedSecondaryTables.next().getName());
+ assertEquals("bar", specifiedSecondaryTables.next().getName());
+ assertFalse(specifiedSecondaryTables.hasNext());
+ }
+
+ public void testSpecifiedSecondaryTablesSize() throws Exception {
+ createTestEntityWithSecondaryTables();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(2, javaEntity().specifiedSecondaryTablesSize());
+ }
+
+ public void testAddSpecifiedSecondaryTable() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
+ javaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAR");
+ javaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ Iterator<JavaResource> secondaryTables = typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME);
+
+ assertEquals("BAZ", ((SecondaryTable) secondaryTables.next()).getName());
+ assertEquals("BAR", ((SecondaryTable) secondaryTables.next()).getName());
+ assertEquals("FOO", ((SecondaryTable) secondaryTables.next()).getName());
+ assertFalse(secondaryTables.hasNext());
+ }
+
+ public void testAddSpecifiedSecondaryTable2() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
+ javaEntity().addSpecifiedSecondaryTable(1).setSpecifiedName("BAR");
+ javaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ Iterator<JavaResource> secondaryTables = typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME);
+
+ assertEquals("BAZ", ((SecondaryTable) secondaryTables.next()).getName());
+ assertEquals("FOO", ((SecondaryTable) secondaryTables.next()).getName());
+ assertEquals("BAR", ((SecondaryTable) secondaryTables.next()).getName());
+ assertFalse(secondaryTables.hasNext());
+ }
+ public void testRemoveSpecifiedSecondaryTable() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
+ javaEntity().addSpecifiedSecondaryTable(1).setSpecifiedName("BAR");
+ javaEntity().addSpecifiedSecondaryTable(2).setSpecifiedName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(3, CollectionTools.size(typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)));
+
+ javaEntity().removeSpecifiedSecondaryTable(1);
+
+ Iterator<JavaResource> secondaryTableResources = typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME);
+ assertEquals("FOO", ((SecondaryTable) secondaryTableResources.next()).getName());
+ assertEquals("BAZ", ((SecondaryTable) secondaryTableResources.next()).getName());
+ assertFalse(secondaryTableResources.hasNext());
+
+ Iterator<ISecondaryTable> secondaryTables = javaEntity().secondaryTables();
+ assertEquals("FOO", secondaryTables.next().getName());
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertFalse(secondaryTables.hasNext());
+
+
+ javaEntity().removeSpecifiedSecondaryTable(1);
+ secondaryTableResources = typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME);
+ assertEquals("FOO", ((SecondaryTable) secondaryTableResources.next()).getName());
+ assertFalse(secondaryTableResources.hasNext());
+
+ secondaryTables = javaEntity().secondaryTables();
+ assertEquals("FOO", secondaryTables.next().getName());
+ assertFalse(secondaryTables.hasNext());
+
+
+ javaEntity().removeSpecifiedSecondaryTable(0);
+ secondaryTableResources = typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME);
+ assertFalse(secondaryTableResources.hasNext());
+ secondaryTables = javaEntity().secondaryTables();
+ assertFalse(secondaryTables.hasNext());
+
+ assertNull(typeResource.annotation(SecondaryTables.ANNOTATION_NAME));
+ }
+
+ public void testMoveSpecifiedSecondaryTable() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ entity.addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
+ entity.addSpecifiedSecondaryTable(1).setSpecifiedName("BAR");
+ entity.addSpecifiedSecondaryTable(2).setSpecifiedName("BAZ");
+
+ ListIterator<SecondaryTable> javaSecondaryTables = typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME);
+ assertEquals(3, CollectionTools.size(javaSecondaryTables));
+
+
+ entity.moveSpecifiedSecondaryTable(2, 0);
+ ListIterator<ISecondaryTable> secondaryTables = entity.specifiedSecondaryTables();
+ assertEquals("BAR", secondaryTables.next().getSpecifiedName());
+ assertEquals("BAZ", secondaryTables.next().getSpecifiedName());
+ assertEquals("FOO", secondaryTables.next().getSpecifiedName());
+
+ javaSecondaryTables = typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME);
+ assertEquals("BAR", javaSecondaryTables.next().getName());
+ assertEquals("BAZ", javaSecondaryTables.next().getName());
+ assertEquals("FOO", javaSecondaryTables.next().getName());
+
+
+ entity.moveSpecifiedSecondaryTable(0, 1);
+ secondaryTables = entity.specifiedSecondaryTables();
+ assertEquals("BAZ", secondaryTables.next().getSpecifiedName());
+ assertEquals("BAR", secondaryTables.next().getSpecifiedName());
+ assertEquals("FOO", secondaryTables.next().getSpecifiedName());
+
+ javaSecondaryTables = typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME);
+ assertEquals("BAZ", javaSecondaryTables.next().getName());
+ assertEquals("BAR", javaSecondaryTables.next().getName());
+ assertEquals("FOO", javaSecondaryTables.next().getName());
+ }
+
+ public void testUpdateSpecifiedSecondaryTables() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ ((SecondaryTable) typeResource.addAnnotation(0, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("FOO");
+ ((SecondaryTable) typeResource.addAnnotation(1, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("BAR");
+ ((SecondaryTable) typeResource.addAnnotation(2, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("BAZ");
+
+ ListIterator<ISecondaryTable> secondaryTables = entity.specifiedSecondaryTables();
+ assertEquals("FOO", secondaryTables.next().getName());
+ assertEquals("BAR", secondaryTables.next().getName());
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertFalse(secondaryTables.hasNext());
+
+ typeResource.move(2, 0, SecondaryTables.ANNOTATION_NAME);
+ secondaryTables = entity.specifiedSecondaryTables();
+ assertEquals("BAR", secondaryTables.next().getName());
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertEquals("FOO", secondaryTables.next().getName());
+ assertFalse(secondaryTables.hasNext());
+
+ typeResource.move(0, 1, SecondaryTables.ANNOTATION_NAME);
+ secondaryTables = entity.specifiedSecondaryTables();
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertEquals("BAR", secondaryTables.next().getName());
+ assertEquals("FOO", secondaryTables.next().getName());
+ assertFalse(secondaryTables.hasNext());
+
+ typeResource.removeAnnotation(1, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME);
+ secondaryTables = entity.specifiedSecondaryTables();
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertEquals("FOO", secondaryTables.next().getName());
+ assertFalse(secondaryTables.hasNext());
+
+ typeResource.removeAnnotation(1, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME);
+ secondaryTables = entity.specifiedSecondaryTables();
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertFalse(secondaryTables.hasNext());
+
+ typeResource.removeAnnotation(0, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME);
+ secondaryTables = entity.specifiedSecondaryTables();
+ assertFalse(secondaryTables.hasNext());
+ }
+
+ public void testAssociatedTables() throws Exception {
+ createTestEntityWithSecondaryTables();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(3, CollectionTools.size(javaEntity().associatedTables()));
+ Iterator<ITable> associatedTables = javaEntity().associatedTables();
+ ITable table1 = associatedTables.next();
+ ISecondaryTable table2 = (ISecondaryTable) associatedTables.next();
+ ISecondaryTable table3 = (ISecondaryTable) associatedTables.next();
+ assertEquals(TYPE_NAME, table1.getName());
+ assertEquals("foo", table2.getName());
+ assertEquals("bar", table3.getName());
+ }
+
+ public void testAssociatedTablesIncludingInherited() throws Exception {
+ createTestEntityWithSecondaryTables();
+ createTestSubType();
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity parentEntity = javaEntity().rootEntity();
+ assertEquals(3, CollectionTools.size(parentEntity.associatedTablesIncludingInherited()));
+ Iterator<ITable> associatedTables = parentEntity.associatedTablesIncludingInherited();
+ ITable table1 = associatedTables.next();
+ ISecondaryTable table2 = (ISecondaryTable) associatedTables.next();
+ ISecondaryTable table3 = (ISecondaryTable) associatedTables.next();
+ assertEquals(TYPE_NAME, table1.getName());
+ assertEquals("foo", table2.getName());
+ assertEquals("bar", table3.getName());
+
+ IEntity childEntity = javaEntity();
+ //TODO probably want this to be 3, since in this case the child descriptor really uses the
+ //parent table because it is single table inheritance strategy. Not sure yet how to deal with this.
+ assertEquals(4, CollectionTools.size(childEntity.associatedTablesIncludingInherited()));
+ }
+
+ public void testAssociatedTableNamesIncludingInherited() throws Exception {
+ createTestEntityWithSecondaryTables();
+ createTestSubType();
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity parentEntity = javaEntity().rootEntity();
+ assertEquals(3, CollectionTools.size(parentEntity.associatedTableNamesIncludingInherited()));
+ Iterator<String> associatedTables = parentEntity.associatedTableNamesIncludingInherited();
+ String table1 = associatedTables.next();
+ String table2 = associatedTables.next();
+ String table3 = associatedTables.next();
+ assertEquals(TYPE_NAME, table1);
+ assertEquals("foo", table2);
+ assertEquals("bar", table3);
+
+ IEntity childEntity = javaEntity();
+ //TODO probably want this to be 3, since in this case the child descriptor really uses the
+ //parent table because it is single table inheritance strategy. Not sure yet how to deal with this.
+ assertEquals(4, CollectionTools.size(childEntity.associatedTableNamesIncludingInherited()));
+ }
+
+ public void testAddSecondaryTableToResourceModel() throws Exception {
+ createTestEntityWithName();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ SecondaryTable secondaryTable = (SecondaryTable) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ secondaryTable.setName("FOO");
+
+ assertEquals(1, javaEntity().secondaryTablesSize());
+ assertEquals("FOO", javaEntity().secondaryTables().next().getSpecifiedName());
+ assertEquals("FOO", javaEntity().secondaryTables().next().getName());
+
+ SecondaryTable secondaryTable2 = (SecondaryTable) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ secondaryTable2.setName("BAR");
+
+ assertEquals(2, javaEntity().secondaryTablesSize());
+ ListIterator<ISecondaryTable> secondaryTables = javaEntity().secondaryTables();
+ assertEquals("FOO", secondaryTables.next().getSpecifiedName());
+ assertEquals("BAR", secondaryTables.next().getSpecifiedName());
+
+ SecondaryTable secondaryTable3 = (SecondaryTable) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ secondaryTable3.setName("BAZ");
+
+ assertEquals(3, javaEntity().secondaryTablesSize());
+ secondaryTables = javaEntity().secondaryTables();
+ assertEquals("BAZ", secondaryTables.next().getSpecifiedName());
+ assertEquals("FOO", secondaryTables.next().getSpecifiedName());
+ assertEquals("BAR", secondaryTables.next().getSpecifiedName());
+ }
+
+ public void testRemoveSecondaryTableFromResourceModel() throws Exception {
+ createTestEntityWithSecondaryTables();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().addSpecifiedSecondaryTable(2).setSpecifiedName("baz");
+ ListIterator<ISecondaryTable> secondaryTables = javaEntity().secondaryTables();
+
+ assertEquals(3, javaEntity().secondaryTablesSize());
+ assertEquals("foo", secondaryTables.next().getSpecifiedName());
+ assertEquals("bar", secondaryTables.next().getSpecifiedName());
+ assertEquals("baz", secondaryTables.next().getSpecifiedName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+
+ secondaryTables = javaEntity().secondaryTables();
+ assertEquals(2, javaEntity().secondaryTablesSize());
+ assertEquals("bar", secondaryTables.next().getSpecifiedName());
+ assertEquals("baz", secondaryTables.next().getSpecifiedName());
+
+ typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+
+ secondaryTables = javaEntity().secondaryTables();
+ assertEquals(1, javaEntity().secondaryTablesSize());
+ assertEquals("baz", secondaryTables.next().getSpecifiedName());
+
+
+ typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+
+ secondaryTables = javaEntity().secondaryTables();
+ assertEquals(0, javaEntity().secondaryTablesSize());
+ assertFalse(secondaryTables.hasNext());
+ }
+
+ public void testGetSequenceGenerator() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getSequenceGenerator());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ typeResource.addAnnotation(JPA.SEQUENCE_GENERATOR);
+
+ assertNotNull(javaEntity().getSequenceGenerator());
+ assertEquals(1, CollectionTools.size(typeResource.annotations()));
+ }
+
+ public void testAddSequenceGenerator() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getSequenceGenerator());
+
+ javaEntity().addSequenceGenerator();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNotNull(typeResource.annotation(JPA.SEQUENCE_GENERATOR));
+ assertNotNull(javaEntity().getSequenceGenerator());
+
+ //try adding another sequence generator, should get an IllegalStateException
+ try {
+ javaEntity().addSequenceGenerator();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testRemoveSequenceGenerator() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ typeResource.addAnnotation(JPA.SEQUENCE_GENERATOR);
+
+ javaEntity().removeSequenceGenerator();
+
+ assertNull(javaEntity().getSequenceGenerator());
+ assertNull(typeResource.annotation(JPA.SEQUENCE_GENERATOR));
+
+ //try removing the sequence generator again, should get an IllegalStateException
+ try {
+ javaEntity().removeSequenceGenerator();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testGetTableGenerator() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getTableGenerator());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ typeResource.addAnnotation(JPA.TABLE_GENERATOR);
+
+ assertNotNull(javaEntity().getTableGenerator());
+ assertEquals(1, CollectionTools.size(typeResource.annotations()));
+ }
+
+ public void testAddTableGenerator() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getTableGenerator());
+
+ javaEntity().addTableGenerator();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNotNull(typeResource.annotation(JPA.TABLE_GENERATOR));
+ assertNotNull(javaEntity().getTableGenerator());
+
+ //try adding another table generator, should get an IllegalStateException
+ try {
+ javaEntity().addTableGenerator();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testRemoveTableGenerator() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ typeResource.addAnnotation(JPA.TABLE_GENERATOR);
+
+ javaEntity().removeTableGenerator();
+
+ assertNull(javaEntity().getTableGenerator());
+ assertNull(typeResource.annotation(JPA.TABLE_GENERATOR));
+
+ //try removing the table generator again, should get an IllegalStateException
+ try {
+ javaEntity().removeTableGenerator();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testGetDiscriminatorColumn() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNotNull(javaEntity().getDiscriminatorColumn());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ DiscriminatorColumn column = (DiscriminatorColumn) typeResource.addAnnotation(JPA.DISCRIMINATOR_COLUMN);
+ column.setName("foo");
+
+ assertEquals("foo", javaEntity().getDiscriminatorColumn().getSpecifiedName());
+
+ column.setName(null);
+
+ assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedName());
+
+ typeResource.removeAnnotation(JPA.DISCRIMINATOR_COLUMN);
+
+ assertNotNull(javaEntity().getDiscriminatorColumn());
+ }
+
+ public void testSpecifiedPrimaryKeyJoinColumns() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ListIterator<IJavaPrimaryKeyJoinColumn> specifiedPkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns();
+
+ assertFalse(specifiedPkJoinColumns.hasNext());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ //add an annotation to the resource model and verify the context model is updated
+ PrimaryKeyJoinColumn pkJoinColumn = (PrimaryKeyJoinColumn) typeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ pkJoinColumn.setName("FOO");
+ specifiedPkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns();
+ assertEquals("FOO", specifiedPkJoinColumns.next().getName());
+ assertFalse(specifiedPkJoinColumns.hasNext());
+
+ pkJoinColumn = (PrimaryKeyJoinColumn) typeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ pkJoinColumn.setName("BAR");
+ specifiedPkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAR", specifiedPkJoinColumns.next().getName());
+ assertEquals("FOO", specifiedPkJoinColumns.next().getName());
+ assertFalse(specifiedPkJoinColumns.hasNext());
+
+
+ pkJoinColumn = (PrimaryKeyJoinColumn) typeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ pkJoinColumn.setName("BAZ");
+ specifiedPkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAZ", specifiedPkJoinColumns.next().getName());
+ assertEquals("BAR", specifiedPkJoinColumns.next().getName());
+ assertEquals("FOO", specifiedPkJoinColumns.next().getName());
+ assertFalse(specifiedPkJoinColumns.hasNext());
+
+ //move an annotation to the resource model and verify the context model is updated
+ typeResource.move(1, 0, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ specifiedPkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAR", specifiedPkJoinColumns.next().getName());
+ assertEquals("BAZ", specifiedPkJoinColumns.next().getName());
+ assertEquals("FOO", specifiedPkJoinColumns.next().getName());
+ assertFalse(specifiedPkJoinColumns.hasNext());
+
+ typeResource.removeAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ specifiedPkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAZ", specifiedPkJoinColumns.next().getName());
+ assertEquals("FOO", specifiedPkJoinColumns.next().getName());
+ assertFalse(specifiedPkJoinColumns.hasNext());
+
+ typeResource.removeAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ specifiedPkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns();
+ assertEquals("FOO", specifiedPkJoinColumns.next().getName());
+ assertFalse(specifiedPkJoinColumns.hasNext());
+
+
+ typeResource.removeAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ specifiedPkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns();
+ assertFalse(specifiedPkJoinColumns.hasNext());
+ }
+
+ public void testDefaultPrimaryKeyJoinColumns() {
+ //TODO
+ }
+
+ public void testSpecifiedPrimaryKeyJoinColumnsSize() throws Exception {
+ createTestEntityWithPrimaryKeyJoinColumns();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(2, javaEntity().specifiedPrimaryKeyJoinColumnsSize());
+ }
+
+ public void testAddSpecifiedPrimaryKeyJoinColumn() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
+ javaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAR");
+ javaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ Iterator<JavaResource> pkJoinColumns = typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+
+ assertEquals("BAZ", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName());
+ assertEquals("BAR", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName());
+ assertEquals("FOO", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName());
+ assertFalse(pkJoinColumns.hasNext());
+ }
+
+ public void testAddSpecifiedPrimaryKeyJoinColumn2() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
+ javaEntity().addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
+ javaEntity().addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ Iterator<JavaResource> pkJoinColumns = typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+
+ assertEquals("FOO", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName());
+ assertEquals("BAR", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName());
+ assertEquals("BAZ", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName());
+ assertFalse(pkJoinColumns.hasNext());
+ }
+ public void testRemoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
+ javaEntity().addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
+ javaEntity().addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(3, CollectionTools.size(typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME)));
+
+ javaEntity().removeSpecifiedPrimaryKeyJoinColumn(1);
+
+ Iterator<JavaResource> pkJoinColumnResources = typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+ assertEquals("FOO", ((PrimaryKeyJoinColumn) pkJoinColumnResources.next()).getName());
+ assertEquals("BAZ", ((PrimaryKeyJoinColumn) pkJoinColumnResources.next()).getName());
+ assertFalse(pkJoinColumnResources.hasNext());
+
+ Iterator<IPrimaryKeyJoinColumn> pkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns();
+ assertEquals("FOO", pkJoinColumns.next().getName());
+ assertEquals("BAZ", pkJoinColumns.next().getName());
+ assertFalse(pkJoinColumns.hasNext());
+
+
+ javaEntity().removeSpecifiedPrimaryKeyJoinColumn(1);
+ pkJoinColumnResources = typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+ assertEquals("FOO", ((PrimaryKeyJoinColumn) pkJoinColumnResources.next()).getName());
+ assertFalse(pkJoinColumnResources.hasNext());
+
+ pkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns();
+ assertEquals("FOO", pkJoinColumns.next().getName());
+ assertFalse(pkJoinColumns.hasNext());
+
+
+ javaEntity().removeSpecifiedPrimaryKeyJoinColumn(0);
+ pkJoinColumnResources = typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+ assertFalse(pkJoinColumnResources.hasNext());
+ pkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns();
+ assertFalse(pkJoinColumns.hasNext());
+
+ assertNull(typeResource.annotation(PrimaryKeyJoinColumns.ANNOTATION_NAME));
+ }
+
+ public void testMoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ entity.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
+ entity.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
+ entity.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
+
+ ListIterator<PrimaryKeyJoinColumn> javaPrimaryKeyJoinColumns = typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+ assertEquals(3, CollectionTools.size(javaPrimaryKeyJoinColumns));
+
+
+ entity.moveSpecifiedPrimaryKeyJoinColumn(2, 0);
+ ListIterator<IPrimaryKeyJoinColumn> primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName());
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName());
+
+ javaPrimaryKeyJoinColumns = typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+ assertEquals("BAR", javaPrimaryKeyJoinColumns.next().getName());
+ assertEquals("BAZ", javaPrimaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", javaPrimaryKeyJoinColumns.next().getName());
+
+
+ entity.moveSpecifiedPrimaryKeyJoinColumn(0, 1);
+ primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName());
+ assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName());
+
+ javaPrimaryKeyJoinColumns = typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+ assertEquals("BAZ", javaPrimaryKeyJoinColumns.next().getName());
+ assertEquals("BAR", javaPrimaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", javaPrimaryKeyJoinColumns.next().getName());
+ }
+
+ public void testUpdateSpecifiedPrimaryKeyJoinColumns() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ ((PrimaryKeyJoinColumn) typeResource.addAnnotation(0, PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME)).setName("FOO");
+ ((PrimaryKeyJoinColumn) typeResource.addAnnotation(1, PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME)).setName("BAR");
+ ((PrimaryKeyJoinColumn) typeResource.addAnnotation(2, PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME)).setName("BAZ");
+
+ ListIterator<IPrimaryKeyJoinColumn> primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAR", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertFalse(primaryKeyJoinColumns.hasNext());
+
+ typeResource.move(2, 0, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+ primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAR", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+ assertFalse(primaryKeyJoinColumns.hasNext());
+
+ typeResource.move(0, 1, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+ primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAR", primaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+ assertFalse(primaryKeyJoinColumns.hasNext());
+
+ typeResource.removeAnnotation(1, PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+ primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+ assertFalse(primaryKeyJoinColumns.hasNext());
+
+ typeResource.removeAnnotation(1, PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+ primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertFalse(primaryKeyJoinColumns.hasNext());
+
+ typeResource.removeAnnotation(0, PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME);
+ primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
+ assertFalse(primaryKeyJoinColumns.hasNext());
+ }
+
+ public void testPrimaryKeyJoinColumnIsVirtual() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().addSpecifiedPrimaryKeyJoinColumn(0);
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+ assertFalse(specifiedPkJoinColumn.isVirtual());
+
+ IPrimaryKeyJoinColumn defaultPkJoinColumn = javaEntity().defaultPrimaryKeyJoinColumns().next();
+ assertTrue(defaultPkJoinColumn.isVirtual());
+ }
+
+ public void testOverridableAttributeNames() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ Iterator<String> overridableAttributeNames = javaEntity().overridableAttributeNames();
+ assertFalse(overridableAttributeNames.hasNext());
+ }
+
+ public void testAllOverridableAttributeNames() throws Exception {
+ createTestMappedSuperclass();
+ createTestSubType();
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ Iterator<String> overridableAttributeNames = javaEntity().allOverridableAttributeNames();
+ assertEquals("id", overridableAttributeNames.next());
+ assertEquals("name", overridableAttributeNames.next());
+ assertFalse(overridableAttributeNames.hasNext());
+ }
+
+ public void testOverridableAssociationNames() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ Iterator<String> overridableAssociationNames = javaEntity().overridableAssociationNames();
+ assertFalse(overridableAssociationNames.hasNext());
+ }
+ //TODO add some associations to the MappedSuperclass
+ //add all mapping types to test which ones are overridable
+ public void testAllOverridableAssociationNames() throws Exception {
+ createTestMappedSuperclass();
+ createTestSubType();
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ Iterator<String> overridableAssociationNames = javaPersistentType().parentPersistentType().getMapping().allOverridableAssociationNames();
+ assertFalse(overridableAssociationNames.hasNext());
+ }
+
+ public void testTableNameIsInvalid() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertFalse(javaEntity().tableNameIsInvalid(TYPE_NAME));
+ assertTrue(javaEntity().tableNameIsInvalid("FOO"));
+
+ javaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAR");
+
+ assertFalse(javaEntity().tableNameIsInvalid("BAR"));
+ }
+
+ public void testAttributeMappingKeyAllowed() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = (IEntity) javaPersistentType().getMapping();
+ assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY));
+ }
+
+ public void testSpecifiedAttributeOverrides() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ListIterator<IJavaAttributeOverride> specifiedAttributeOverrides = javaEntity().specifiedAttributeOverrides();
+
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ //add an annotation to the resource model and verify the context model is updated
+ AttributeOverride attributeOverride = (AttributeOverride) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("FOO");
+ specifiedAttributeOverrides = javaEntity().specifiedAttributeOverrides();
+ assertEquals("FOO", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+ attributeOverride = (AttributeOverride) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("BAR");
+ specifiedAttributeOverrides = javaEntity().specifiedAttributeOverrides();
+ assertEquals("FOO", specifiedAttributeOverrides.next().getName());
+ assertEquals("BAR", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+
+ attributeOverride = (AttributeOverride) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("BAZ");
+ specifiedAttributeOverrides = javaEntity().specifiedAttributeOverrides();
+ assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
+ assertEquals("FOO", specifiedAttributeOverrides.next().getName());
+ assertEquals("BAR", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+ //move an annotation to the resource model and verify the context model is updated
+ typeResource.move(1, 0, JPA.ATTRIBUTE_OVERRIDES);
+ specifiedAttributeOverrides = javaEntity().specifiedAttributeOverrides();
+ assertEquals("FOO", specifiedAttributeOverrides.next().getName());
+ assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
+ assertEquals("BAR", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+ typeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ specifiedAttributeOverrides = javaEntity().specifiedAttributeOverrides();
+ assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
+ assertEquals("BAR", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+ typeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ specifiedAttributeOverrides = javaEntity().specifiedAttributeOverrides();
+ assertEquals("BAR", specifiedAttributeOverrides.next().getName());
+ assertFalse(specifiedAttributeOverrides.hasNext());
+
+
+ typeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ specifiedAttributeOverrides = javaEntity().specifiedAttributeOverrides();
+ assertFalse(specifiedAttributeOverrides.hasNext());
+ }
+
+ public void testDefaultAttributeOverrides() throws Exception {
+ createTestMappedSuperclass();
+ createTestSubType();
+
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IJavaEntity javaEntity = (IJavaEntity) classRefs.next().getJavaPersistentType().getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_SUB_TYPE_NAME);
+ assertEquals(SUB_TYPE_NAME, typeResource.getName());
+ assertNull(typeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(AttributeOverrides.ANNOTATION_NAME));
+
+ assertEquals(2, CollectionTools.size(javaEntity.defaultAttributeOverrides()));
+ IAttributeOverride defaultAttributeOverride = javaEntity.defaultAttributeOverrides().next();
+ assertEquals("id", defaultAttributeOverride.getName());
+ assertEquals("id", defaultAttributeOverride.getColumn().getName());
+ assertEquals(SUB_TYPE_NAME, defaultAttributeOverride.getColumn().getTable());
+
+
+ IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping();
+
+ IBasicMapping idMapping = (IBasicMapping) mappedSuperclass.persistentType().attributeNamed("id").getMapping();
+ idMapping.getColumn().setSpecifiedName("FOO");
+ idMapping.getColumn().setSpecifiedTable("BAR");
+
+ assertEquals(SUB_TYPE_NAME, typeResource.getName());
+ assertNull(typeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(AttributeOverrides.ANNOTATION_NAME));
+
+ assertEquals(2, CollectionTools.size(javaEntity.defaultAttributeOverrides()));
+ defaultAttributeOverride = javaEntity.defaultAttributeOverrides().next();
+ assertEquals("id", defaultAttributeOverride.getName());
+ assertEquals("FOO", defaultAttributeOverride.getColumn().getName());
+ assertEquals("BAR", defaultAttributeOverride.getColumn().getTable());
+
+ idMapping.getColumn().setSpecifiedName(null);
+ idMapping.getColumn().setSpecifiedTable(null);
+ assertEquals(SUB_TYPE_NAME, typeResource.getName());
+ assertNull(typeResource.annotation(AttributeOverride.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(AttributeOverrides.ANNOTATION_NAME));
+
+ defaultAttributeOverride = javaEntity.defaultAttributeOverrides().next();
+ assertEquals("id", defaultAttributeOverride.getName());
+ assertEquals("id", defaultAttributeOverride.getColumn().getName());
+ assertEquals(SUB_TYPE_NAME, defaultAttributeOverride.getColumn().getTable());
+
+ javaEntity.addSpecifiedAttributeOverride(0).setName("id");
+ assertEquals(1, CollectionTools.size(javaEntity.defaultAttributeOverrides()));
+ }
+
+ public void testSpecifiedAttributeOverridesSize() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(0, javaEntity().specifiedAttributeOverridesSize());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ //add an annotation to the resource model and verify the context model is updated
+ AttributeOverride attributeOverride = (AttributeOverride) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("FOO");
+ attributeOverride = (AttributeOverride) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("BAR");
+
+ assertEquals(2, javaEntity().specifiedAttributeOverridesSize());
+ }
+
+ public void testAddSpecifiedAttributeOverride() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().addSpecifiedAttributeOverride(0).setName("FOO");
+ javaEntity().addSpecifiedAttributeOverride(0).setName("BAR");
+ javaEntity().addSpecifiedAttributeOverride(0).setName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ Iterator<JavaResource> attributeOverrides = typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+
+ assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertFalse(attributeOverrides.hasNext());
+ }
+
+ public void testAddSpecifiedAttributeOverride2() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().addSpecifiedAttributeOverride(0).setName("FOO");
+ javaEntity().addSpecifiedAttributeOverride(1).setName("BAR");
+ javaEntity().addSpecifiedAttributeOverride(2).setName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ Iterator<JavaResource> attributeOverrides = typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+
+ assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertFalse(attributeOverrides.hasNext());
+ }
+
+ public void testRemoveSpecifiedAttributeOverride() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().addSpecifiedAttributeOverride(0).setName("FOO");
+ javaEntity().addSpecifiedAttributeOverride(1).setName("BAR");
+ javaEntity().addSpecifiedAttributeOverride(2).setName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(3, CollectionTools.size(typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME)));
+
+ javaEntity().removeSpecifiedAttributeOverride(1);
+
+ Iterator<JavaResource> attributeOverrideResources = typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ assertEquals("FOO", ((AttributeOverride) attributeOverrideResources.next()).getName());
+ assertEquals("BAZ", ((AttributeOverride) attributeOverrideResources.next()).getName());
+ assertFalse(attributeOverrideResources.hasNext());
+
+ Iterator<IAttributeOverride> attributeOverrides = javaEntity().specifiedAttributeOverrides();
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+
+ javaEntity().removeSpecifiedAttributeOverride(1);
+ attributeOverrideResources = typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ assertEquals("FOO", ((AttributeOverride) attributeOverrideResources.next()).getName());
+ assertFalse(attributeOverrideResources.hasNext());
+
+ attributeOverrides = javaEntity().specifiedAttributeOverrides();
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+
+ javaEntity().removeSpecifiedAttributeOverride(0);
+ attributeOverrideResources = typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ assertFalse(attributeOverrideResources.hasNext());
+ attributeOverrides = javaEntity().specifiedAttributeOverrides();
+ assertFalse(attributeOverrides.hasNext());
+
+ assertNull(typeResource.annotation(AttributeOverrides.ANNOTATION_NAME));
+ }
+
+ public void testMoveSpecifiedAttributeOverride() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ entity.addSpecifiedAttributeOverride(0).setName("FOO");
+ entity.addSpecifiedAttributeOverride(1).setName("BAR");
+ entity.addSpecifiedAttributeOverride(2).setName("BAZ");
+
+ ListIterator<AttributeOverride> javaAttributeOverrides = typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ assertEquals(3, CollectionTools.size(javaAttributeOverrides));
+
+
+ entity.moveSpecifiedAttributeOverride(2, 0);
+ ListIterator<IAttributeOverride> attributeOverrides = entity.specifiedAttributeOverrides();
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+
+ javaAttributeOverrides = typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ assertEquals("BAR", javaAttributeOverrides.next().getName());
+ assertEquals("BAZ", javaAttributeOverrides.next().getName());
+ assertEquals("FOO", javaAttributeOverrides.next().getName());
+
+
+ entity.moveSpecifiedAttributeOverride(0, 1);
+ attributeOverrides = entity.specifiedAttributeOverrides();
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+
+ javaAttributeOverrides = typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ assertEquals("BAZ", javaAttributeOverrides.next().getName());
+ assertEquals("BAR", javaAttributeOverrides.next().getName());
+ assertEquals("FOO", javaAttributeOverrides.next().getName());
+ }
+
+ public void testUpdateSpecifiedAttributeOverrides() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ ((AttributeOverride) typeResource.addAnnotation(0, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME)).setName("FOO");
+ ((AttributeOverride) typeResource.addAnnotation(1, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME)).setName("BAR");
+ ((AttributeOverride) typeResource.addAnnotation(2, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME)).setName("BAZ");
+
+ ListIterator<IAttributeOverride> attributeOverrides = entity.specifiedAttributeOverrides();
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ typeResource.move(2, 0, AttributeOverrides.ANNOTATION_NAME);
+ attributeOverrides = entity.specifiedAttributeOverrides();
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ typeResource.move(0, 1, AttributeOverrides.ANNOTATION_NAME);
+ attributeOverrides = entity.specifiedAttributeOverrides();
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ typeResource.removeAnnotation(1, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ attributeOverrides = entity.specifiedAttributeOverrides();
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ typeResource.removeAnnotation(1, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ attributeOverrides = entity.specifiedAttributeOverrides();
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ typeResource.removeAnnotation(0, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME);
+ attributeOverrides = entity.specifiedAttributeOverrides();
+ assertFalse(attributeOverrides.hasNext());
+ }
+
+ public void testAttributeOverrideIsVirtual() throws Exception {
+ createTestMappedSuperclass();
+ createTestSubType();
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ListIterator<IAttributeOverride> defaultAttributeOverrides = javaEntity().defaultAttributeOverrides();
+ IAttributeOverride defaultAttributeOverride = defaultAttributeOverrides.next();
+ assertEquals("id", defaultAttributeOverride.getName());
+ assertTrue(defaultAttributeOverride.isVirtual());
+
+ defaultAttributeOverride = defaultAttributeOverrides.next();
+ assertEquals("name", defaultAttributeOverride.getName());
+ assertTrue(defaultAttributeOverride.isVirtual());
+ assertFalse(defaultAttributeOverrides.hasNext());
+
+ javaEntity().addSpecifiedAttributeOverride(0).setName("id");
+ IAttributeOverride specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next();
+ assertFalse(specifiedAttributeOverride.isVirtual());
+
+
+ defaultAttributeOverrides = javaEntity().defaultAttributeOverrides();
+ defaultAttributeOverride = defaultAttributeOverrides.next();
+ assertEquals("name", defaultAttributeOverride.getName());
+ assertTrue(defaultAttributeOverride.isVirtual());
+ assertFalse(defaultAttributeOverrides.hasNext());
+ }
+
+ public void testAddNamedQuery() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ INamedQuery namedQuery = entity.addNamedQuery(0);
+ namedQuery.setName("FOO");
+
+ ListIterator<NamedQuery> javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ assertEquals("FOO", javaNamedQueries.next().getName());
+
+ INamedQuery namedQuery2 = entity.addNamedQuery(0);
+ namedQuery2.setName("BAR");
+
+ javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ assertEquals("BAR", javaNamedQueries.next().getName());
+ assertEquals("FOO", javaNamedQueries.next().getName());
+
+ INamedQuery namedQuery3 = entity.addNamedQuery(1);
+ namedQuery3.setName("BAZ");
+
+ javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ assertEquals("BAR", javaNamedQueries.next().getName());
+ assertEquals("BAZ", javaNamedQueries.next().getName());
+ assertEquals("FOO", javaNamedQueries.next().getName());
+
+ ListIterator<INamedQuery> namedQueries = entity.namedQueries();
+ assertEquals(namedQuery2, namedQueries.next());
+ assertEquals(namedQuery3, namedQueries.next());
+ assertEquals(namedQuery, namedQueries.next());
+
+ namedQueries = entity.namedQueries();
+ assertEquals("BAR", namedQueries.next().getName());
+ assertEquals("BAZ", namedQueries.next().getName());
+ assertEquals("FOO", namedQueries.next().getName());
+ }
+
+ public void testRemoveNamedQuery() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ entity.addNamedQuery(0).setName("FOO");
+ entity.addNamedQuery(1).setName("BAR");
+ entity.addNamedQuery(2).setName("BAZ");
+
+ ListIterator<NamedQuery> javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ assertEquals(3, CollectionTools.size(javaNamedQueries));
+
+ entity.removeNamedQuery(0);
+ javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ assertEquals(2, CollectionTools.size(javaNamedQueries));
+ javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ assertEquals("BAR", javaNamedQueries.next().getName());
+ assertEquals("BAZ", javaNamedQueries.next().getName());
+
+ entity.removeNamedQuery(0);
+ javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ assertEquals(1, CollectionTools.size(javaNamedQueries));
+ javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ assertEquals("BAZ", javaNamedQueries.next().getName());
+
+ entity.removeNamedQuery(0);
+ javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ assertEquals(0, CollectionTools.size(javaNamedQueries));
+ }
+
+ public void testMoveNamedQuery() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ entity.addNamedQuery(0).setName("FOO");
+ entity.addNamedQuery(1).setName("BAR");
+ entity.addNamedQuery(2).setName("BAZ");
+
+ ListIterator<NamedQuery> javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ assertEquals(3, CollectionTools.size(javaNamedQueries));
+
+
+ entity.moveNamedQuery(2, 0);
+ ListIterator<INamedQuery> namedQueries = entity.namedQueries();
+ assertEquals("BAR", namedQueries.next().getName());
+ assertEquals("BAZ", namedQueries.next().getName());
+ assertEquals("FOO", namedQueries.next().getName());
+
+ javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ assertEquals("BAR", javaNamedQueries.next().getName());
+ assertEquals("BAZ", javaNamedQueries.next().getName());
+ assertEquals("FOO", javaNamedQueries.next().getName());
+
+
+ entity.moveNamedQuery(0, 1);
+ namedQueries = entity.namedQueries();
+ assertEquals("BAZ", namedQueries.next().getName());
+ assertEquals("BAR", namedQueries.next().getName());
+ assertEquals("FOO", namedQueries.next().getName());
+
+ javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ assertEquals("BAZ", javaNamedQueries.next().getName());
+ assertEquals("BAR", javaNamedQueries.next().getName());
+ assertEquals("FOO", javaNamedQueries.next().getName());
+ }
+
+ public void testUpdateNamedQueries() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ ((NamedQuery) typeResource.addAnnotation(0, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME)).setName("FOO");
+ ((NamedQuery) typeResource.addAnnotation(1, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME)).setName("BAR");
+ ((NamedQuery) typeResource.addAnnotation(2, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME)).setName("BAZ");
+
+ ListIterator<INamedQuery> namedQueries = entity.namedQueries();
+ assertEquals("FOO", namedQueries.next().getName());
+ assertEquals("BAR", namedQueries.next().getName());
+ assertEquals("BAZ", namedQueries.next().getName());
+ assertFalse(namedQueries.hasNext());
+
+ typeResource.move(2, 0, NamedQueries.ANNOTATION_NAME);
+ namedQueries = entity.namedQueries();
+ assertEquals("BAR", namedQueries.next().getName());
+ assertEquals("BAZ", namedQueries.next().getName());
+ assertEquals("FOO", namedQueries.next().getName());
+ assertFalse(namedQueries.hasNext());
+
+ typeResource.move(0, 1, NamedQueries.ANNOTATION_NAME);
+ namedQueries = entity.namedQueries();
+ assertEquals("BAZ", namedQueries.next().getName());
+ assertEquals("BAR", namedQueries.next().getName());
+ assertEquals("FOO", namedQueries.next().getName());
+ assertFalse(namedQueries.hasNext());
+
+ typeResource.removeAnnotation(1, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ namedQueries = entity.namedQueries();
+ assertEquals("BAZ", namedQueries.next().getName());
+ assertEquals("FOO", namedQueries.next().getName());
+ assertFalse(namedQueries.hasNext());
+
+ typeResource.removeAnnotation(1, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ namedQueries = entity.namedQueries();
+ assertEquals("BAZ", namedQueries.next().getName());
+ assertFalse(namedQueries.hasNext());
+
+ typeResource.removeAnnotation(0, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME);
+ namedQueries = entity.namedQueries();
+ assertFalse(namedQueries.hasNext());
+ }
+
+ public void testAddNamedNativeQuery() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ INamedNativeQuery namedNativeQuery = entity.addNamedNativeQuery(0);
+ namedNativeQuery.setName("FOO");
+
+ ListIterator<NamedNativeQuery> javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ assertEquals("FOO", javaNamedQueries.next().getName());
+
+ INamedNativeQuery namedNativeQuery2 = entity.addNamedNativeQuery(0);
+ namedNativeQuery2.setName("BAR");
+
+ javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ assertEquals("BAR", javaNamedQueries.next().getName());
+ assertEquals("FOO", javaNamedQueries.next().getName());
+
+ INamedNativeQuery namedNativeQuery3 = entity.addNamedNativeQuery(1);
+ namedNativeQuery3.setName("BAZ");
+
+ javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ assertEquals("BAR", javaNamedQueries.next().getName());
+ assertEquals("BAZ", javaNamedQueries.next().getName());
+ assertEquals("FOO", javaNamedQueries.next().getName());
+
+ ListIterator<INamedNativeQuery> namedQueries = entity.namedNativeQueries();
+ assertEquals(namedNativeQuery2, namedQueries.next());
+ assertEquals(namedNativeQuery3, namedQueries.next());
+ assertEquals(namedNativeQuery, namedQueries.next());
+
+ namedQueries = entity.namedNativeQueries();
+ assertEquals("BAR", namedQueries.next().getName());
+ assertEquals("BAZ", namedQueries.next().getName());
+ assertEquals("FOO", namedQueries.next().getName());
+ }
+
+ public void testRemoveNamedNativeQuery() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ entity.addNamedNativeQuery(0).setName("FOO");
+ entity.addNamedNativeQuery(1).setName("BAR");
+ entity.addNamedNativeQuery(2).setName("BAZ");
+
+ ListIterator<NamedNativeQuery> javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ assertEquals(3, CollectionTools.size(javaNamedQueries));
+
+ entity.removeNamedNativeQuery(0);
+ javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ assertEquals(2, CollectionTools.size(javaNamedQueries));
+ javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ assertEquals("BAR", javaNamedQueries.next().getName());
+ assertEquals("BAZ", javaNamedQueries.next().getName());
+
+ entity.removeNamedNativeQuery(0);
+ javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ assertEquals(1, CollectionTools.size(javaNamedQueries));
+ javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ assertEquals("BAZ", javaNamedQueries.next().getName());
+
+ entity.removeNamedNativeQuery(0);
+ javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ assertEquals(0, CollectionTools.size(javaNamedQueries));
+ }
+
+ public void testMoveNamedNativeQuery() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ entity.addNamedNativeQuery(0).setName("FOO");
+ entity.addNamedNativeQuery(1).setName("BAR");
+ entity.addNamedNativeQuery(2).setName("BAZ");
+
+ ListIterator<NamedNativeQuery> javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ assertEquals(3, CollectionTools.size(javaNamedQueries));
+
+
+ entity.moveNamedNativeQuery(2, 0);
+ ListIterator<INamedNativeQuery> namedQueries = entity.namedNativeQueries();
+ assertEquals("BAR", namedQueries.next().getName());
+ assertEquals("BAZ", namedQueries.next().getName());
+ assertEquals("FOO", namedQueries.next().getName());
+
+ javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ assertEquals("BAR", javaNamedQueries.next().getName());
+ assertEquals("BAZ", javaNamedQueries.next().getName());
+ assertEquals("FOO", javaNamedQueries.next().getName());
+
+
+ entity.moveNamedNativeQuery(0, 1);
+ namedQueries = entity.namedNativeQueries();
+ assertEquals("BAZ", namedQueries.next().getName());
+ assertEquals("BAR", namedQueries.next().getName());
+ assertEquals("FOO", namedQueries.next().getName());
+
+ javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ assertEquals("BAZ", javaNamedQueries.next().getName());
+ assertEquals("BAR", javaNamedQueries.next().getName());
+ assertEquals("FOO", javaNamedQueries.next().getName());
+ }
+
+ public void testUpdateNamedNativeQueries() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ ((NamedNativeQuery) typeResource.addAnnotation(0, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME)).setName("FOO");
+ ((NamedNativeQuery) typeResource.addAnnotation(1, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME)).setName("BAR");
+ ((NamedNativeQuery) typeResource.addAnnotation(2, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME)).setName("BAZ");
+
+ ListIterator<INamedNativeQuery> namedQueries = entity.namedNativeQueries();
+ assertEquals("FOO", namedQueries.next().getName());
+ assertEquals("BAR", namedQueries.next().getName());
+ assertEquals("BAZ", namedQueries.next().getName());
+ assertFalse(namedQueries.hasNext());
+
+ typeResource.move(2, 0, NamedNativeQueries.ANNOTATION_NAME);
+ namedQueries = entity.namedNativeQueries();
+ assertEquals("BAR", namedQueries.next().getName());
+ assertEquals("BAZ", namedQueries.next().getName());
+ assertEquals("FOO", namedQueries.next().getName());
+ assertFalse(namedQueries.hasNext());
+
+ typeResource.move(0, 1, NamedNativeQueries.ANNOTATION_NAME);
+ namedQueries = entity.namedNativeQueries();
+ assertEquals("BAZ", namedQueries.next().getName());
+ assertEquals("BAR", namedQueries.next().getName());
+ assertEquals("FOO", namedQueries.next().getName());
+ assertFalse(namedQueries.hasNext());
+
+ typeResource.removeAnnotation(1, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ namedQueries = entity.namedNativeQueries();
+ assertEquals("BAZ", namedQueries.next().getName());
+ assertEquals("FOO", namedQueries.next().getName());
+ assertFalse(namedQueries.hasNext());
+
+ typeResource.removeAnnotation(1, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ namedQueries = entity.namedNativeQueries();
+ assertEquals("BAZ", namedQueries.next().getName());
+ assertFalse(namedQueries.hasNext());
+
+ typeResource.removeAnnotation(0, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME);
+ namedQueries = entity.namedNativeQueries();
+ assertFalse(namedQueries.hasNext());
+ }
+
+ public void testAddSpecifiedAssociationOverride() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ IAssociationOverride associationOverride = entity.addSpecifiedAssociationOverride(0);
+ associationOverride.setName("FOO");
+
+ ListIterator<AssociationOverride> javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ assertEquals("FOO", javaAssociationOverrides.next().getName());
+
+ IAssociationOverride associationOverride2 = entity.addSpecifiedAssociationOverride(0);
+ associationOverride2.setName("BAR");
+
+ javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ assertEquals("BAR", javaAssociationOverrides.next().getName());
+ assertEquals("FOO", javaAssociationOverrides.next().getName());
+
+ IAssociationOverride associationOverride3 = entity.addSpecifiedAssociationOverride(1);
+ associationOverride3.setName("BAZ");
+
+ javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ assertEquals("BAR", javaAssociationOverrides.next().getName());
+ assertEquals("BAZ", javaAssociationOverrides.next().getName());
+ assertEquals("FOO", javaAssociationOverrides.next().getName());
+
+ ListIterator<IAssociationOverride> associationOverrides = entity.specifiedAssociationOverrides();
+ assertEquals(associationOverride2, associationOverrides.next());
+ assertEquals(associationOverride3, associationOverrides.next());
+ assertEquals(associationOverride, associationOverrides.next());
+
+ associationOverrides = entity.specifiedAssociationOverrides();
+ assertEquals("BAR", associationOverrides.next().getName());
+ assertEquals("BAZ", associationOverrides.next().getName());
+ assertEquals("FOO", associationOverrides.next().getName());
+ }
+
+ public void testRemoveSpecifiedAssociationOverride() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ entity.addSpecifiedAssociationOverride(0).setName("FOO");
+ entity.addSpecifiedAssociationOverride(1).setName("BAR");
+ entity.addSpecifiedAssociationOverride(2).setName("BAZ");
+
+ ListIterator<AssociationOverride> javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ assertEquals(3, CollectionTools.size(javaAssociationOverrides));
+
+ entity.removeSpecifiedAssociationOverride(0);
+ javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ assertEquals(2, CollectionTools.size(javaAssociationOverrides));
+ javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ assertEquals("BAR", javaAssociationOverrides.next().getName());
+ assertEquals("BAZ", javaAssociationOverrides.next().getName());
+
+ entity.removeSpecifiedAssociationOverride(0);
+ javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ assertEquals(1, CollectionTools.size(javaAssociationOverrides));
+ javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ assertEquals("BAZ", javaAssociationOverrides.next().getName());
+
+ entity.removeSpecifiedAssociationOverride(0);
+ javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ assertEquals(0, CollectionTools.size(javaAssociationOverrides));
+ }
+
+ public void testMoveSpecifiedAssociationOverride() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ entity.addSpecifiedAssociationOverride(0).setName("FOO");
+ entity.addSpecifiedAssociationOverride(1).setName("BAR");
+ entity.addSpecifiedAssociationOverride(2).setName("BAZ");
+
+ ListIterator<AssociationOverride> javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ assertEquals(3, CollectionTools.size(javaAssociationOverrides));
+
+
+ entity.moveSpecifiedAssociationOverride(2, 0);
+ ListIterator<IAssociationOverride> associationOverrides = entity.specifiedAssociationOverrides();
+ assertEquals("BAR", associationOverrides.next().getName());
+ assertEquals("BAZ", associationOverrides.next().getName());
+ assertEquals("FOO", associationOverrides.next().getName());
+
+ javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ assertEquals("BAR", javaAssociationOverrides.next().getName());
+ assertEquals("BAZ", javaAssociationOverrides.next().getName());
+ assertEquals("FOO", javaAssociationOverrides.next().getName());
+
+
+ entity.moveSpecifiedAssociationOverride(0, 1);
+ associationOverrides = entity.specifiedAssociationOverrides();
+ assertEquals("BAZ", associationOverrides.next().getName());
+ assertEquals("BAR", associationOverrides.next().getName());
+ assertEquals("FOO", associationOverrides.next().getName());
+
+ javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ assertEquals("BAZ", javaAssociationOverrides.next().getName());
+ assertEquals("BAR", javaAssociationOverrides.next().getName());
+ assertEquals("FOO", javaAssociationOverrides.next().getName());
+ }
+
+ public void testUpdateSpecifiedAssociationOverrides() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ ((AssociationOverride) typeResource.addAnnotation(0, AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME)).setName("FOO");
+ ((AssociationOverride) typeResource.addAnnotation(1, AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME)).setName("BAR");
+ ((AssociationOverride) typeResource.addAnnotation(2, AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME)).setName("BAZ");
+
+ ListIterator<IAssociationOverride> associationOverrides = entity.specifiedAssociationOverrides();
+ assertEquals("FOO", associationOverrides.next().getName());
+ assertEquals("BAR", associationOverrides.next().getName());
+ assertEquals("BAZ", associationOverrides.next().getName());
+ assertFalse(associationOverrides.hasNext());
+
+ typeResource.move(2, 0, AssociationOverrides.ANNOTATION_NAME);
+ associationOverrides = entity.specifiedAssociationOverrides();
+ assertEquals("BAR", associationOverrides.next().getName());
+ assertEquals("BAZ", associationOverrides.next().getName());
+ assertEquals("FOO", associationOverrides.next().getName());
+ assertFalse(associationOverrides.hasNext());
+
+ typeResource.move(0, 1, AssociationOverrides.ANNOTATION_NAME);
+ associationOverrides = entity.specifiedAssociationOverrides();
+ assertEquals("BAZ", associationOverrides.next().getName());
+ assertEquals("BAR", associationOverrides.next().getName());
+ assertEquals("FOO", associationOverrides.next().getName());
+ assertFalse(associationOverrides.hasNext());
+
+ typeResource.removeAnnotation(1, AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ associationOverrides = entity.specifiedAssociationOverrides();
+ assertEquals("BAZ", associationOverrides.next().getName());
+ assertEquals("FOO", associationOverrides.next().getName());
+ assertFalse(associationOverrides.hasNext());
+
+ typeResource.removeAnnotation(1, AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ associationOverrides = entity.specifiedAssociationOverrides();
+ assertEquals("BAZ", associationOverrides.next().getName());
+ assertFalse(associationOverrides.hasNext());
+
+ typeResource.removeAnnotation(0, AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME);
+ associationOverrides = entity.specifiedAssociationOverrides();
+ assertFalse(associationOverrides.hasNext());
+ }
+
+ public void testAssociationOverrideIsVirtual() throws Exception {
+ createTestMappedSuperclass();
+ createTestSubType();
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ListIterator<IAssociationOverride> defaultAssociationOverrides = javaEntity().defaultAssociationOverrides();
+ IAssociationOverride defaultAssociationOverride = defaultAssociationOverrides.next();
+ assertEquals("address", defaultAssociationOverride.getName());
+ assertTrue(defaultAssociationOverride.isVirtual());
+ assertFalse(defaultAssociationOverrides.hasNext());
+
+ javaEntity().addSpecifiedAssociationOverride(0).setName("address");
+ IAssociationOverride specifiedAssociationOverride = javaEntity().specifiedAssociationOverrides().next();
+ assertFalse(specifiedAssociationOverride.isVirtual());
+
+ defaultAssociationOverrides = javaEntity().defaultAssociationOverrides();
+ assertFalse(defaultAssociationOverrides.hasNext());
+ }
+
+ public void testDefaultAssociationOverrides() throws Exception {
+ createTestMappedSuperclass();
+ createTestSubType();
+
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IJavaEntity javaEntity = (IJavaEntity) classRefs.next().getJavaPersistentType().getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_SUB_TYPE_NAME);
+ assertEquals(SUB_TYPE_NAME, typeResource.getName());
+ assertNull(typeResource.annotation(AssociationOverride.ANNOTATION_NAME));
+ assertNull(typeResource.annotation(AssociationOverrides.ANNOTATION_NAME));
+
+ assertEquals(1, CollectionTools.size(javaEntity.defaultAssociationOverrides()));
+ IAssociationOverride defaultAssociationOverride = javaEntity.defaultAssociationOverrides().next();
+ assertEquals("address", defaultAssociationOverride.getName());
+ //TODO joinColumns for default association overrides
+// IJoinColumn defaultJoinColumn = defaultAssociationOverride.joinColumns().next();
+// assertEquals("address", defaultJoinColumn.getName());
+// assertEquals("address", defaultJoinColumn.getReferencedColumnName());
+// assertEquals(SUB_TYPE_NAME, defaultJoinColumn.getTable());
+//
+//
+// IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping();
+//
+// IOneToOneMapping addressMapping = (IOneToOneMapping) mappedSuperclass.persistentType().attributeNamed("address").getMapping();
+// IJoinColumn joinColumn = addressMapping.addSpecifiedJoinColumn(0);
+// joinColumn.setSpecifiedName("FOO");
+// joinColumn.setSpecifiedReferencedColumnName("BAR");
+// joinColumn.setSpecifiedTable("BAZ");
+//
+// assertEquals(SUB_TYPE_NAME, typeResource.getName());
+// assertNull(typeResource.annotation(AssociationOverride.ANNOTATION_NAME));
+// assertNull(typeResource.annotation(AssociationOverrides.ANNOTATION_NAME));
+//
+// assertEquals(1, CollectionTools.size(javaEntity.defaultAssociationOverrides()));
+// defaultAssociationOverride = javaEntity.defaultAssociationOverrides().next();
+// assertEquals("address", defaultAssociationOverride.getName());
+// assertEquals("FOO", defaultJoinColumn.getName());
+// assertEquals("BAR", defaultJoinColumn.getReferencedColumnName());
+// assertEquals("BAZ", defaultJoinColumn.getTable());
+//
+// joinColumn.setSpecifiedName(null);
+// joinColumn.setSpecifiedReferencedColumnName(null);
+// joinColumn.setSpecifiedTable(null);
+// assertEquals(SUB_TYPE_NAME, typeResource.getName());
+// assertNull(typeResource.annotation(AssociationOverride.ANNOTATION_NAME));
+// assertNull(typeResource.annotation(AssociationOverrides.ANNOTATION_NAME));
+//
+// defaultAssociationOverride = javaEntity.defaultAssociationOverrides().next();
+// assertEquals("address", defaultJoinColumn.getName());
+// assertEquals("address", defaultJoinColumn.getReferencedColumnName());
+// assertEquals(SUB_TYPE_NAME, defaultJoinColumn.getTable());
+//
+// javaEntity.addSpecifiedAssociationOverride(0).setName("address");
+// assertEquals(0, CollectionTools.size(javaEntity.defaultAssociationOverrides()));
+ }
+
+ public void testSpecifiedAssociationOverrides() {
+ //TODO
+ }
+
+ public void testUpdateIdClass() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getIdClass());
+ assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME));
+
+ IdClass idClass = (IdClass) typeResource.addAnnotation(IdClass.ANNOTATION_NAME);
+ assertNull(javaEntity().getIdClass());
+ assertNotNull(typeResource.annotation(IdClass.ANNOTATION_NAME));
+
+ idClass.setValue("model.Foo");
+ assertEquals("model.Foo", javaEntity().getIdClass());
+ assertEquals("model.Foo", ((IdClass) typeResource.annotation(IdClass.ANNOTATION_NAME)).getValue());
+
+ //test setting @IdClass value to null, IdClass annotation is removed
+ idClass.setValue(null);
+ assertNull(javaEntity().getIdClass());
+ assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME));
+
+ //reset @IdClass value and then remove @IdClass
+ idClass = (IdClass) typeResource.addAnnotation(IdClass.ANNOTATION_NAME);
+ idClass.setValue("model.Foo");
+ typeResource.removeAnnotation(IdClass.ANNOTATION_NAME);
+
+ assertNull(javaEntity().getIdClass());
+ assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME));
+ }
+
+ public void testModifyIdClass() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getIdClass());
+ assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME));
+
+ javaEntity().setIdClass("model.Foo");
+ assertEquals("model.Foo", ((IdClass) typeResource.annotation(IdClass.ANNOTATION_NAME)).getValue());
+ assertEquals("model.Foo", javaEntity().getIdClass());
+
+ javaEntity().setIdClass(null);
+ assertNull(javaEntity().getIdClass());
+ assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME));
+ }
+
+// Iterator<String> allOverridableAttributeNames();
+//
+// Iterator<String> allOverridableAssociationNames();
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaGeneratedValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaGeneratedValueTests.java
new file mode 100644
index 0000000000..58e4a63f29
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaGeneratedValueTests.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.context.base.GenerationType;
+import org.eclipse.jpt.core.internal.context.base.IGeneratedValue;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.resource.java.GeneratedValue;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaGeneratedValueTests extends ContextModelTestCase
+{
+ private static final String GENERATOR = "MY_GENERATOR";
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createGeneratedValueAnnotation() throws Exception{
+ this.createAnnotationAndMembers("GeneratedValue",
+ "GenerationType strategy() default;" +
+ "String generator() default \"\"; ");
+ }
+
+ private IType createTestEntityWithGeneratedValue() throws Exception {
+ createEntityAnnotation();
+ createGeneratedValueAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.GENERATED_VALUE, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id").append(CR);
+ sb.append("@GeneratedValue(generator=\"" + GENERATOR + "\")");
+ }
+ });
+ }
+
+ public JavaGeneratedValueTests(String name) {
+ super(name);
+ }
+
+ public void testGetGenerator() throws Exception {
+ createTestEntityWithGeneratedValue();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ assertEquals(GENERATOR, idMapping.getGeneratedValue().getGenerator());
+
+ //change resource model sequenceGenerator name, verify the context model is updated
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE);
+
+ generatedValue.setGenerator("foo");
+
+ assertEquals("foo", idMapping.getGeneratedValue().getGenerator());
+ }
+
+ public void testSetSpecifiedGenerator() throws Exception {
+ createTestEntityWithGeneratedValue();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ assertEquals(GENERATOR, idMapping.getGeneratedValue().getGenerator());
+
+ idMapping.getGeneratedValue().setSpecifiedGenerator("foo");
+
+ assertEquals("foo", idMapping.getGeneratedValue().getGenerator());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE);
+
+ assertEquals("foo", generatedValue.getGenerator());
+ }
+
+ public void testSetSpecifiedNameNull() throws Exception {
+ createTestEntityWithGeneratedValue();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ assertEquals(GENERATOR, idMapping.getGeneratedValue().getGenerator());
+
+ idMapping.getGeneratedValue().setSpecifiedGenerator(null);
+
+ assertNotNull(idMapping.getGeneratedValue());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE);
+
+ assertNotNull(generatedValue);
+ }
+
+ public void testGetStrategy() throws Exception {
+ createTestEntityWithGeneratedValue();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ assertEquals(IGeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getStrategy());
+
+ //change resource model sequenceGenerator name, verify the context model is updated
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE);
+
+ generatedValue.setStrategy(org.eclipse.jpt.core.internal.resource.java.GenerationType.IDENTITY);
+
+ assertEquals(GenerationType.IDENTITY, idMapping.getGeneratedValue().getStrategy());
+ assertEquals(IGeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getDefaultStrategy());
+ }
+
+ public void testSetSpecifiedStrategy() throws Exception {
+ createTestEntityWithGeneratedValue();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ assertEquals(IGeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getStrategy());
+
+ idMapping.getGeneratedValue().setSpecifiedStrategy(GenerationType.IDENTITY);
+
+ assertEquals(GenerationType.IDENTITY, idMapping.getGeneratedValue().getStrategy());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE);
+
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.GenerationType.IDENTITY, generatedValue.getStrategy());
+
+ idMapping.getGeneratedValue().setSpecifiedStrategy(null);
+
+ assertEquals(IGeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getStrategy());
+ generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE);
+ assertNotNull(generatedValue);
+ assertNull(generatedValue.getStrategy());
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java
new file mode 100644
index 0000000000..d0b46a02a3
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java
@@ -0,0 +1,724 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
+import org.eclipse.jpt.core.internal.context.base.IVersionMapping;
+import org.eclipse.jpt.core.internal.context.base.TemporalType;
+import org.eclipse.jpt.core.internal.resource.java.Basic;
+import org.eclipse.jpt.core.internal.resource.java.Column;
+import org.eclipse.jpt.core.internal.resource.java.Embedded;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.java.GeneratedValue;
+import org.eclipse.jpt.core.internal.resource.java.Id;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.java.ManyToOne;
+import org.eclipse.jpt.core.internal.resource.java.OneToMany;
+import org.eclipse.jpt.core.internal.resource.java.OneToOne;
+import org.eclipse.jpt.core.internal.resource.java.SequenceGenerator;
+import org.eclipse.jpt.core.internal.resource.java.TableGenerator;
+import org.eclipse.jpt.core.internal.resource.java.Temporal;
+import org.eclipse.jpt.core.internal.resource.java.Transient;
+import org.eclipse.jpt.core.internal.resource.java.Version;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaIdMappingTests extends ContextModelTestCase
+{
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createIdAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Id", "");
+ }
+
+ private void createGeneratedValueAnnotation() throws Exception{
+ this.createAnnotationAndMembers("GeneratedValue", "");
+ }
+
+ private void createTemporalAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Temporal", "TemporalType value();");
+ }
+
+ private IType createTestEntityWithIdMapping() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id").append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithTemporal() throws Exception {
+ createEntityAnnotation();
+ createTemporalAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.TEMPORAL, JPA.TEMPORAL_TYPE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id").append(CR);
+ sb.append("@Temporal(TemporalType.TIMESTAMP)").append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithIdMappingGeneratedValue() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+ createGeneratedValueAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.GENERATED_VALUE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id").append(CR);
+ sb.append("@GeneratedValue").append(CR);
+ }
+ });
+ }
+
+ public JavaIdMappingTests(String name) {
+ super(name);
+ }
+
+ public void testMorphToBasicMapping() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping();
+ assertFalse(idMapping.isDefault());
+ idMapping.getColumn().setSpecifiedName("FOO");
+ idMapping.setTemporal(TemporalType.TIME);
+ idMapping.addGeneratedValue();
+ idMapping.addTableGenerator();
+ idMapping.addSequenceGenerator();
+ assertFalse(idMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
+ assertEquals("FOO", ((IBasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
+ assertEquals(TemporalType.TIME, ((IBasicMapping) persistentAttribute.getMapping()).getTemporal());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME));
+ }
+
+ public void testMorphToDefault() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping();
+ assertFalse(idMapping.isDefault());
+ idMapping.getColumn().setSpecifiedName("FOO");
+ idMapping.setTemporal(TemporalType.TIME);
+ idMapping.addGeneratedValue();
+ idMapping.addTableGenerator();
+ idMapping.addSequenceGenerator();
+ assertFalse(idMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+ assertEquals("FOO", ((IBasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
+ assertEquals(TemporalType.TIME, ((IBasicMapping) persistentAttribute.getMapping()).getTemporal());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME));
+ }
+
+ public void testMorphToVersionMapping() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping();
+ assertFalse(idMapping.isDefault());
+ idMapping.getColumn().setSpecifiedName("FOO");
+ idMapping.setTemporal(TemporalType.TIME);
+ idMapping.addGeneratedValue();
+ idMapping.addTableGenerator();
+ idMapping.addSequenceGenerator();
+ assertFalse(idMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
+ assertEquals("FOO", ((IVersionMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
+ assertEquals(TemporalType.TIME, ((IVersionMapping) persistentAttribute.getMapping()).getTemporal());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddedMapping() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping();
+ assertFalse(idMapping.isDefault());
+ idMapping.getColumn().setSpecifiedName("FOO");
+ idMapping.setTemporal(TemporalType.TIME);
+ idMapping.addGeneratedValue();
+ idMapping.addTableGenerator();
+ idMapping.addSequenceGenerator();
+ assertFalse(idMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME));
+ }
+
+ public void testMorphToTransientMapping() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping();
+ assertFalse(idMapping.isDefault());
+ idMapping.getColumn().setSpecifiedName("FOO");
+ idMapping.setTemporal(TemporalType.TIME);
+ idMapping.addGeneratedValue();
+ idMapping.addTableGenerator();
+ idMapping.addSequenceGenerator();
+ assertFalse(idMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddedIdMapping() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping();
+ assertFalse(idMapping.isDefault());
+ idMapping.getColumn().setSpecifiedName("FOO");
+ idMapping.setTemporal(TemporalType.TIME);
+ idMapping.addGeneratedValue();
+ idMapping.addTableGenerator();
+ idMapping.addSequenceGenerator();
+ assertFalse(idMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME));
+ }
+
+ public void testMorphToOneToOneMapping() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping();
+ assertFalse(idMapping.isDefault());
+ idMapping.getColumn().setSpecifiedName("FOO");
+ idMapping.setTemporal(TemporalType.TIME);
+ idMapping.addGeneratedValue();
+ idMapping.addTableGenerator();
+ idMapping.addSequenceGenerator();
+ assertFalse(idMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME));
+ }
+
+ public void testMorphToOneToManyMapping() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping();
+ assertFalse(idMapping.isDefault());
+ idMapping.getColumn().setSpecifiedName("FOO");
+ idMapping.setTemporal(TemporalType.TIME);
+ idMapping.addGeneratedValue();
+ idMapping.addTableGenerator();
+ idMapping.addSequenceGenerator();
+ assertFalse(idMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME));
+ }
+
+ public void testMorphToManyToOneMapping() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping();
+ assertFalse(idMapping.isDefault());
+ idMapping.getColumn().setSpecifiedName("FOO");
+ idMapping.setTemporal(TemporalType.TIME);
+ idMapping.addGeneratedValue();
+ idMapping.addTableGenerator();
+ idMapping.addSequenceGenerator();
+ assertFalse(idMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME));
+ }
+
+ public void testMorphToManyToManyMapping() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping();
+ assertFalse(idMapping.isDefault());
+ idMapping.getColumn().setSpecifiedName("FOO");
+ idMapping.setTemporal(TemporalType.TIME);
+ idMapping.addGeneratedValue();
+ idMapping.addTableGenerator();
+ idMapping.addSequenceGenerator();
+ assertFalse(idMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME));
+ }
+
+ public void testGetTemporal() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(idMapping.getTemporal());
+ }
+
+ public void testGetTemporal2() throws Exception {
+ createTestEntityWithTemporal();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertEquals(TemporalType.TIMESTAMP, idMapping.getTemporal());
+ }
+
+ public void testSetTemporal() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping();
+ assertNull(idMapping.getTemporal());
+
+ idMapping.setTemporal(TemporalType.TIME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Temporal temporal = (Temporal) attributeResource.annotation(Temporal.ANNOTATION_NAME);
+
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.TemporalType.TIME, temporal.getValue());
+
+ idMapping.setTemporal(null);
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ }
+
+ public void testGetTemporalUpdatesFromResourceModelChange() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(idMapping.getTemporal());
+
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Temporal temporal = (Temporal) attributeResource.addAnnotation(Temporal.ANNOTATION_NAME);
+ temporal.setValue(org.eclipse.jpt.core.internal.resource.java.TemporalType.DATE);
+
+ assertEquals(TemporalType.DATE, idMapping.getTemporal());
+
+ attributeResource.removeAnnotation(Temporal.ANNOTATION_NAME);
+
+ assertNull(idMapping.getTemporal());
+ assertFalse(idMapping.isDefault());
+ assertSame(idMapping, persistentAttribute.getSpecifiedMapping());
+ }
+
+ public void testGetColumn() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(idMapping.getColumn().getSpecifiedName());
+ assertEquals("id", idMapping.getColumn().getName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN);
+ column.setName("foo");
+
+ assertEquals("foo", idMapping.getColumn().getSpecifiedName());
+ assertEquals("foo", idMapping.getColumn().getName());
+ assertEquals("id", idMapping.getColumn().getDefaultName());
+ }
+
+ public void testGetSequenceGenerator() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(idMapping.getSequenceGenerator());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ attributeResource.addAnnotation(JPA.SEQUENCE_GENERATOR);
+
+ assertNotNull(idMapping.getSequenceGenerator());
+ assertEquals(1, CollectionTools.size(attributeResource.annotations()));
+ }
+
+ public void testAddSequenceGenerator() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(idMapping.getSequenceGenerator());
+
+ idMapping.addSequenceGenerator();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ assertNotNull(attributeResource.annotation(JPA.SEQUENCE_GENERATOR));
+ assertNotNull(idMapping.getSequenceGenerator());
+
+ //try adding another sequence generator, should get an IllegalStateException
+ try {
+ idMapping.addSequenceGenerator();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testRemoveSequenceGenerator() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ attributeResource.addAnnotation(JPA.SEQUENCE_GENERATOR);
+
+
+ idMapping.removeSequenceGenerator();
+
+ assertNull(idMapping.getSequenceGenerator());
+ assertNull(attributeResource.annotation(JPA.SEQUENCE_GENERATOR));
+
+ //try removing the sequence generator again, should get an IllegalStateException
+ try {
+ idMapping.removeSequenceGenerator();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testGetTableGenerator() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(idMapping.getTableGenerator());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ attributeResource.addAnnotation(JPA.TABLE_GENERATOR);
+
+ assertNotNull(idMapping.getTableGenerator());
+ assertEquals(1, CollectionTools.size(attributeResource.annotations()));
+ }
+
+ public void testAddTableGenerator() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(idMapping.getTableGenerator());
+
+ idMapping.addTableGenerator();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ assertNotNull(attributeResource.annotation(JPA.TABLE_GENERATOR));
+ assertNotNull(idMapping.getTableGenerator());
+
+ //try adding another table generator, should get an IllegalStateException
+ try {
+ idMapping.addTableGenerator();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testRemoveTableGenerator() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ attributeResource.addAnnotation(JPA.TABLE_GENERATOR);
+
+
+ idMapping.removeTableGenerator();
+
+ assertNull(idMapping.getTableGenerator());
+ assertNull(attributeResource.annotation(JPA.TABLE_GENERATOR));
+
+ //try removing the table generator again, should get an IllegalStateException
+ try {
+ idMapping.removeTableGenerator();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testGetGeneratedValue() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(idMapping.getGeneratedValue());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ attributeResource.addAnnotation(JPA.GENERATED_VALUE);
+
+ assertNotNull(idMapping.getGeneratedValue());
+ assertEquals(1, CollectionTools.size(attributeResource.annotations()));
+ }
+
+ public void testGetGeneratedValue2() throws Exception {
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ createTestEntityWithIdMappingGeneratedValue();
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ assertNotNull(idMapping.getGeneratedValue());
+ assertEquals(1, CollectionTools.size(attributeResource.annotations()));
+ }
+
+ public void testAddGeneratedValue() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(idMapping.getGeneratedValue());
+
+ idMapping.addGeneratedValue();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ assertNotNull(attributeResource.annotation(JPA.GENERATED_VALUE));
+ assertNotNull(idMapping.getGeneratedValue());
+
+ //try adding another generated value, should get an IllegalStateException
+ try {
+ idMapping.addGeneratedValue();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testRemoveGeneratedValue() throws Exception {
+ createTestEntityWithIdMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ attributeResource.addAnnotation(JPA.GENERATED_VALUE);
+
+
+ idMapping.removeGeneratedValue();
+
+ assertNull(idMapping.getGeneratedValue());
+ assertNull(attributeResource.annotation(JPA.GENERATED_VALUE));
+
+ //try removing the generatedValue again, should get an IllegalStateException
+ try {
+ idMapping.removeGeneratedValue();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinTableTests.java
new file mode 100644
index 0000000000..c328b889a6
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinTableTests.java
@@ -0,0 +1,851 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IJoinTable;
+import org.eclipse.jpt.core.internal.context.java.IJavaManyToManyMapping;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JoinTable;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaJoinTableTests extends ContextModelTestCase
+{
+ public JavaJoinTableTests(String name) {
+ super(name);
+ }
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createManyToManyAnnotation() throws Exception{
+ this.createAnnotationAndMembers("ManyToMany", "");
+ }
+
+ private void createJoinTableAnnotation() throws Exception{
+ //TODO
+ this.createAnnotationAndMembers("JoinTable",
+ "String name() default \"\"; " +
+ "String catalog() default \"\"; " +
+ "String schema() default \"\";");
+ }
+
+
+ private IType createTestEntityWithManyToMany() throws Exception {
+ createEntityAnnotation();
+ createManyToManyAnnotation();
+ createJoinTableAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_MANY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToMany").append(CR);
+ }
+ });
+ }
+
+
+ public void testUpdateSpecifiedName() throws Exception {
+ createTestEntityWithManyToMany();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping();
+ IJoinTable joinTable = manyToManyMapping.getJoinTable();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ JoinTable javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+
+ assertNull(joinTable.getSpecifiedName());
+ assertNull(javaJoinTable);
+
+
+ //set name in the resource model, verify context model updated
+ attributeResource.addAnnotation(JoinTable.ANNOTATION_NAME);
+ javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+ javaJoinTable.setName("FOO");
+ assertEquals("FOO", joinTable.getSpecifiedName());
+ assertEquals("FOO", javaJoinTable.getName());
+
+ //set name to null in the resource model
+ javaJoinTable.setName(null);
+ assertNull(joinTable.getSpecifiedName());
+ assertNull(javaJoinTable.getName());
+
+ javaJoinTable.setName("FOO");
+ assertEquals("FOO", joinTable.getSpecifiedName());
+ assertEquals("FOO", javaJoinTable.getName());
+
+ attributeResource.removeAnnotation(JoinTable.ANNOTATION_NAME);
+ assertNull(joinTable.getSpecifiedName());
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ }
+
+ public void testModifySpecifiedName() throws Exception {
+ createTestEntityWithManyToMany();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping();
+ IJoinTable joinTable = manyToManyMapping.getJoinTable();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ JoinTable javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+
+ assertNull(joinTable.getSpecifiedName());
+ assertNull(javaJoinTable);
+
+ //set name in the context model, verify resource model modified
+ joinTable.setSpecifiedName("foo");
+ javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+ assertEquals("foo", joinTable.getSpecifiedName());
+ assertEquals("foo", javaJoinTable.getName());
+
+ //set name to null in the context model
+ joinTable.setSpecifiedName(null);
+ assertNull(joinTable.getSpecifiedName());
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ }
+
+//// public void testUpdateDefaultNameFromJavaTable() throws Exception {
+//// createTestEntity();
+////
+//// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+//// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+//// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+////
+//// xmlEntity.javaEntity().getTable().setSpecifiedName("Foo");
+//// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+////
+//// xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+//// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+////
+//// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+//// xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+//// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+////
+//// xmlEntity.setSpecifiedMetadataComplete(null);
+//// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+////
+//// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+//// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+////
+//// xmlEntity.getTable().setSpecifiedName("Bar");
+//// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//// }
+////
+//// public void testUpdateDefaultNameNoJava() throws Exception {
+//// createTestEntity();
+////
+//// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+//// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+//// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+//// }
+////
+//// public void testUpdateDefaultNameFromParent() throws Exception {
+//// createTestEntity();
+//// createTestSubType();
+////
+//// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+//// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+//// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping();
+//// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping();
+////
+//// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+//// assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName());
+////
+//// parentXmlEntity.getTable().setSpecifiedName("FOO");
+//// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+//// assertEquals("FOO", childXmlEntity.getTable().getDefaultName());
+////
+//// parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+//// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+//// assertEquals("AnnotationTestTypeChild", childXmlEntity.getTable().getDefaultName());
+//// }
+
+ public void testUpdateSpecifiedSchema() throws Exception {
+ createTestEntityWithManyToMany();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping();
+ IJoinTable joinTable = manyToManyMapping.getJoinTable();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ JoinTable javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+
+ assertNull(joinTable.getSpecifiedSchema());
+ assertNull(javaJoinTable);
+
+
+ //set schema in the resource model, verify context model updated
+ attributeResource.addAnnotation(JoinTable.ANNOTATION_NAME);
+ javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+ javaJoinTable.setSchema("FOO");
+ assertEquals("FOO", joinTable.getSpecifiedSchema());
+ assertEquals("FOO", javaJoinTable.getSchema());
+
+ //set schema to null in the resource model
+ javaJoinTable.setSchema(null);
+ assertNull(joinTable.getSpecifiedSchema());
+ assertNull(javaJoinTable.getSchema());
+
+ javaJoinTable.setSchema("FOO");
+ assertEquals("FOO", joinTable.getSpecifiedSchema());
+ assertEquals("FOO", javaJoinTable.getSchema());
+
+ attributeResource.removeAnnotation(JoinTable.ANNOTATION_NAME);
+ assertNull(joinTable.getSpecifiedSchema());
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ }
+
+ public void testModifySpecifiedSchema() throws Exception {
+ createTestEntityWithManyToMany();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping();
+ IJoinTable joinTable = manyToManyMapping.getJoinTable();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ JoinTable javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+
+ assertNull(joinTable.getSpecifiedSchema());
+ assertNull(javaJoinTable);
+
+ //set schema in the context model, verify resource model modified
+ joinTable.setSpecifiedSchema("foo");
+ javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+ assertEquals("foo", joinTable.getSpecifiedSchema());
+ assertEquals("foo", javaJoinTable.getSchema());
+
+ //set schema to null in the context model
+ joinTable.setSpecifiedSchema(null);
+ assertNull(joinTable.getSpecifiedSchema());
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ }
+
+//// public void testUpdateDefaultSchemaFromJavaTable() throws Exception {
+//// createTestEntity();
+////
+//// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+//// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+//// assertNull(xmlEntity.getTable().getDefaultSchema());
+////
+//// xmlEntity.javaEntity().getTable().setSpecifiedSchema("Foo");
+//// assertEquals("Foo", xmlEntity.getTable().getDefaultSchema());
+////
+//// xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+//// assertNull(xmlEntity.getTable().getDefaultSchema());
+////
+//// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+//// xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+//// assertNull(xmlEntity.getTable().getDefaultSchema());
+////
+//// xmlEntity.setSpecifiedMetadataComplete(null);
+//// assertNull(xmlEntity.getTable().getDefaultSchema());
+////
+//// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+//// assertEquals("Foo", xmlEntity.getTable().getDefaultSchema());
+////
+//// xmlEntity.getTable().setSpecifiedName("Bar");
+//// assertNull(xmlEntity.getTable().getDefaultSchema());
+//// }
+////
+//// public void testUpdateDefaultSchemaNoJava() throws Exception {
+//// createTestEntity();
+////
+//// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+//// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+//// assertNull(xmlEntity.getTable().getDefaultSchema());
+//// }
+////
+//// public void testUpdateDefaultSchemaFromParent() throws Exception {
+//// createTestEntity();
+//// createTestSubType();
+////
+//// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+//// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+//// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping();
+//// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping();
+////
+//// assertNull(parentXmlEntity.getTable().getDefaultSchema());
+//// assertNull(childXmlEntity.getTable().getDefaultSchema());
+////
+//// parentXmlEntity.getTable().setSpecifiedSchema("FOO");
+//// assertNull(parentXmlEntity.getTable().getDefaultSchema());
+//// assertEquals("FOO", childXmlEntity.getTable().getDefaultSchema());
+////
+//// parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+//// assertNull(parentXmlEntity.getTable().getDefaultSchema());
+//// assertNull(childXmlEntity.getTable().getDefaultSchema());
+//// }
+////
+//// public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
+//// createTestEntity();
+////
+//// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+//// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+//// assertNull(xmlEntity.getTable().getDefaultSchema());
+////
+//// xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema("FOO");
+//// assertEquals("FOO", xmlEntity.getTable().getDefaultSchema());
+////
+//// xmlEntity.entityMappings().setSpecifiedSchema("BAR");
+//// assertEquals("BAR", xmlEntity.getTable().getDefaultSchema());
+////
+//// xmlEntity.javaEntity().getTable().setSpecifiedSchema("JAVA_SCHEMA");
+//// assertEquals("JAVA_SCHEMA", xmlEntity.getTable().getDefaultSchema());
+////
+//// xmlEntity.getTable().setSpecifiedName("BLAH");
+//// //xml entity now has a table element so default schema is not taken from java
+//// assertEquals("BAR", xmlEntity.getTable().getDefaultSchema());
+////
+////
+//// xmlEntity.entityMappings().setSpecifiedSchema(null);
+//// assertEquals("FOO", xmlEntity.getTable().getDefaultSchema());
+////
+//// xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema(null);
+//// assertNull(xmlEntity.getTable().getDefaultSchema());
+////
+//// xmlEntity.getTable().setSpecifiedName(null);
+//// assertEquals("JAVA_SCHEMA", xmlEntity.getTable().getDefaultSchema());
+//// }
+
+ public void testUpdateSpecifiedCatalog() throws Exception {
+ createTestEntityWithManyToMany();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping();
+ IJoinTable joinTable = manyToManyMapping.getJoinTable();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ JoinTable javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+
+ assertNull(joinTable.getSpecifiedCatalog());
+ assertNull(javaJoinTable);
+
+
+ //set catalog in the resource model, verify context model updated
+ attributeResource.addAnnotation(JoinTable.ANNOTATION_NAME);
+ javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+ javaJoinTable.setCatalog("FOO");
+ assertEquals("FOO", joinTable.getSpecifiedCatalog());
+ assertEquals("FOO", javaJoinTable.getCatalog());
+
+ //set catalog to null in the resource model
+ javaJoinTable.setCatalog(null);
+ assertNull(joinTable.getSpecifiedCatalog());
+ assertNull(javaJoinTable.getCatalog());
+
+ javaJoinTable.setCatalog("FOO");
+ assertEquals("FOO", joinTable.getSpecifiedCatalog());
+ assertEquals("FOO", javaJoinTable.getCatalog());
+
+ attributeResource.removeAnnotation(JoinTable.ANNOTATION_NAME);
+ assertNull(joinTable.getSpecifiedCatalog());
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ }
+
+ public void testModifySpecifiedCatalog() throws Exception {
+ createTestEntityWithManyToMany();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping();
+ IJoinTable joinTable = manyToManyMapping.getJoinTable();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ JoinTable javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+
+ assertNull(joinTable.getSpecifiedCatalog());
+ assertNull(javaJoinTable);
+
+ //set catalog in the context model, verify resource model modified
+ joinTable.setSpecifiedCatalog("foo");
+ javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+ assertEquals("foo", joinTable.getSpecifiedCatalog());
+ assertEquals("foo", javaJoinTable.getCatalog());
+
+ //set catalog to null in the context model
+ joinTable.setSpecifiedCatalog(null);
+ assertNull(joinTable.getSpecifiedCatalog());
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ }
+
+//// public void testUpdateDefaultCatalogFromJavaTable() throws Exception {
+//// createTestEntity();
+////
+//// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+//// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+//// assertNull(xmlEntity.getTable().getDefaultCatalog());
+////
+//// xmlEntity.javaEntity().getTable().setSpecifiedCatalog("Foo");
+//// assertEquals("Foo", xmlEntity.getTable().getDefaultCatalog());
+////
+//// xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+//// assertNull(xmlEntity.getTable().getDefaultCatalog());
+////
+//// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+//// xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+//// assertNull(xmlEntity.getTable().getDefaultCatalog());
+////
+//// xmlEntity.setSpecifiedMetadataComplete(null);
+//// assertNull(xmlEntity.getTable().getDefaultCatalog());
+////
+//// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+//// assertEquals("Foo", xmlEntity.getTable().getDefaultCatalog());
+////
+//// xmlEntity.getTable().setSpecifiedName("Bar");
+//// assertNull(xmlEntity.getTable().getDefaultCatalog());
+//// }
+////
+//// public void testUpdateDefaultCatalogNoJava() throws Exception {
+//// createTestEntity();
+////
+//// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+//// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+//// assertNull(xmlEntity.getTable().getDefaultCatalog());
+//// }
+////
+//// public void testUpdateDefaultCatalogFromParent() throws Exception {
+//// createTestEntity();
+//// createTestSubType();
+////
+//// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+//// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+//// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping();
+//// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping();
+////
+//// assertNull(parentXmlEntity.getTable().getDefaultCatalog());
+//// assertNull(childXmlEntity.getTable().getDefaultCatalog());
+////
+//// parentXmlEntity.getTable().setSpecifiedCatalog("FOO");
+//// assertNull(parentXmlEntity.getTable().getDefaultCatalog());
+//// assertEquals("FOO", childXmlEntity.getTable().getDefaultCatalog());
+////
+//// parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+//// assertNull(parentXmlEntity.getTable().getDefaultCatalog());
+//// assertNull(childXmlEntity.getTable().getDefaultCatalog());
+//// }
+////
+//// public void testUpdateDefaultCatalogFromPersistenceUnitDefaults() throws Exception {
+//// createTestEntity();
+////
+//// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+//// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+//// assertNull(xmlEntity.getTable().getDefaultCatalog());
+////
+//// xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("FOO");
+//// assertEquals("FOO", xmlEntity.getTable().getDefaultCatalog());
+////
+//// xmlEntity.entityMappings().setSpecifiedCatalog("BAR");
+//// assertEquals("BAR", xmlEntity.getTable().getDefaultCatalog());
+////
+//// xmlEntity.javaEntity().getTable().setSpecifiedCatalog("JAVA_CATALOG");
+//// assertEquals("JAVA_CATALOG", xmlEntity.getTable().getDefaultCatalog());
+////
+//// xmlEntity.getTable().setSpecifiedName("BLAH");
+//// //xml entity now has a table element so default schema is not taken from java
+//// assertEquals("BAR", xmlEntity.getTable().getDefaultCatalog());
+////
+////
+//// xmlEntity.entityMappings().setSpecifiedCatalog(null);
+//// assertEquals("FOO", xmlEntity.getTable().getDefaultCatalog());
+////
+//// xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog(null);
+//// assertNull(xmlEntity.getTable().getDefaultCatalog());
+////
+//// xmlEntity.getTable().setSpecifiedName(null);
+//// assertEquals("JAVA_CATALOG", xmlEntity.getTable().getDefaultCatalog());
+////}
+//
+////
+//// public void testUpdateName() throws Exception {
+//// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+//// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+//// Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+//// assertEquals("Foo", xmlEntity.getName());
+////
+//// //set class in the resource model, verify context model updated
+//// entityResource.setClassName("com.Bar");
+//// assertEquals("Bar", xmlEntity.getName());
+////
+//// entityResource.setName("Baz");
+//// assertEquals("Baz", xmlEntity.getName());
+////
+//// //set class to null in the resource model
+//// entityResource.setClassName(null);
+//// assertEquals("Baz", xmlEntity.getName());
+////
+//// entityResource.setName(null);
+//// assertNull(xmlEntity.getName());
+//// }
+//
+
+ public void testAddSpecifiedJoinColumn() throws Exception {
+ createTestEntityWithManyToMany();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping();
+ IJoinTable joinTable = manyToManyMapping.getJoinTable();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+
+ IJoinColumn joinColumn = joinTable.addSpecifiedJoinColumn(0);
+ joinColumn.setSpecifiedName("FOO");
+
+ JoinTable joinTableResource = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+
+ assertEquals("FOO", joinTableResource.joinColumnAt(0).getName());
+
+ IJoinColumn joinColumn2 = joinTable.addSpecifiedJoinColumn(0);
+ joinColumn2.setSpecifiedName("BAR");
+
+ assertEquals("BAR", joinTableResource.joinColumnAt(0).getName());
+ assertEquals("FOO", joinTableResource.joinColumnAt(1).getName());
+
+ IJoinColumn joinColumn3 = joinTable.addSpecifiedJoinColumn(1);
+ joinColumn3.setSpecifiedName("BAZ");
+
+ assertEquals("BAR", joinTableResource.joinColumnAt(0).getName());
+ assertEquals("BAZ", joinTableResource.joinColumnAt(1).getName());
+ assertEquals("FOO", joinTableResource.joinColumnAt(2).getName());
+
+ ListIterator<IJoinColumn> joinColumns = joinTable.specifiedJoinColumns();
+ assertEquals(joinColumn2, joinColumns.next());
+ assertEquals(joinColumn3, joinColumns.next());
+ assertEquals(joinColumn, joinColumns.next());
+
+ joinColumns = joinTable.specifiedJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ }
+
+ public void testRemoveSpecifiedJoinColumn() throws Exception {
+ createTestEntityWithManyToMany();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping();
+ IJoinTable joinTable = manyToManyMapping.getJoinTable();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ joinTable.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ joinTable.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
+ joinTable.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
+
+ JoinTable joinTableResource = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+ assertEquals(3, joinTableResource.joinColumnsSize());
+
+ joinTable.removeSpecifiedJoinColumn(0);
+ assertEquals(2, joinTableResource.joinColumnsSize());
+ assertEquals("BAR", joinTableResource.joinColumnAt(0).getName());
+ assertEquals("BAZ", joinTableResource.joinColumnAt(1).getName());
+
+ joinTable.removeSpecifiedJoinColumn(0);
+ assertEquals(1, joinTableResource.joinColumnsSize());
+ assertEquals("BAZ", joinTableResource.joinColumnAt(0).getName());
+
+ joinTable.removeSpecifiedJoinColumn(0);
+ assertEquals(0, joinTableResource.joinColumnsSize());
+ }
+
+ public void testMoveSpecifiedJoinColumn() throws Exception {
+ createTestEntityWithManyToMany();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping();
+ IJoinTable joinTable = manyToManyMapping.getJoinTable();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ joinTable.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ joinTable.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
+ joinTable.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
+
+ JoinTable joinTableResource = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+ assertEquals(3, joinTableResource.joinColumnsSize());
+
+
+ joinTable.moveSpecifiedJoinColumn(2, 0);
+ ListIterator<IJoinColumn> joinColumns = joinTable.specifiedJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+
+ assertEquals("BAR", joinTableResource.joinColumnAt(0).getName());
+ assertEquals("BAZ", joinTableResource.joinColumnAt(1).getName());
+ assertEquals("FOO", joinTableResource.joinColumnAt(2).getName());
+
+
+ joinTable.moveSpecifiedJoinColumn(0, 1);
+ joinColumns = joinTable.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+
+ assertEquals("BAZ", joinTableResource.joinColumnAt(0).getName());
+ assertEquals("BAR", joinTableResource.joinColumnAt(1).getName());
+ assertEquals("FOO", joinTableResource.joinColumnAt(2).getName());
+ }
+
+ public void testUpdateJoinColumns() throws Exception {
+ createTestEntityWithManyToMany();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping();
+ IJoinTable joinTable = manyToManyMapping.getJoinTable();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ JoinTable joinTableResource = (JoinTable) attributeResource.addAnnotation(JoinTable.ANNOTATION_NAME);
+
+ joinTableResource.addJoinColumn(0);
+ joinTableResource.addJoinColumn(1);
+ joinTableResource.addJoinColumn(2);
+
+ joinTableResource.joinColumnAt(0).setName("FOO");
+ joinTableResource.joinColumnAt(1).setName("BAR");
+ joinTableResource.joinColumnAt(2).setName("BAZ");
+
+ ListIterator<IJoinColumn> joinColumns = joinTable.specifiedJoinColumns();
+ assertEquals("FOO", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ joinTableResource.moveJoinColumn(2, 0);
+ joinColumns = joinTable.specifiedJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ joinTableResource.moveJoinColumn(0, 1);
+ joinColumns = joinTable.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ joinTableResource.removeJoinColumn(1);
+ joinColumns = joinTable.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ joinTableResource.removeJoinColumn(1);
+ joinColumns = joinTable.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ joinTableResource.removeJoinColumn(0);
+ assertFalse(joinTable.specifiedJoinColumns().hasNext());
+ }
+
+ public void testAddSpecifiedInverseJoinColumn() throws Exception {
+ createTestEntityWithManyToMany();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping();
+ IJoinTable joinTable = manyToManyMapping.getJoinTable();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+
+ IJoinColumn inverseJoinColumn = joinTable.addSpecifiedInverseJoinColumn(0);
+ inverseJoinColumn.setSpecifiedName("FOO");
+
+ JoinTable joinTableResource = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+
+ assertEquals("FOO", joinTableResource.inverseJoinColumnAt(0).getName());
+
+ IJoinColumn inverseJoinColumn2 = joinTable.addSpecifiedInverseJoinColumn(0);
+ inverseJoinColumn2.setSpecifiedName("BAR");
+
+ assertEquals("BAR", joinTableResource.inverseJoinColumnAt(0).getName());
+ assertEquals("FOO", joinTableResource.inverseJoinColumnAt(1).getName());
+
+ IJoinColumn inverseJoinColumn3 = joinTable.addSpecifiedInverseJoinColumn(1);
+ inverseJoinColumn3.setSpecifiedName("BAZ");
+
+ assertEquals("BAR", joinTableResource.inverseJoinColumnAt(0).getName());
+ assertEquals("BAZ", joinTableResource.inverseJoinColumnAt(1).getName());
+ assertEquals("FOO", joinTableResource.inverseJoinColumnAt(2).getName());
+
+ ListIterator<IJoinColumn> inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ assertEquals(inverseJoinColumn2, inverseJoinColumns.next());
+ assertEquals(inverseJoinColumn3, inverseJoinColumns.next());
+ assertEquals(inverseJoinColumn, inverseJoinColumns.next());
+
+ inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ assertEquals("BAR", inverseJoinColumns.next().getName());
+ assertEquals("BAZ", inverseJoinColumns.next().getName());
+ assertEquals("FOO", inverseJoinColumns.next().getName());
+ }
+
+ public void testRemoveSpecifiedInverseJoinColumn() throws Exception {
+ createTestEntityWithManyToMany();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping();
+ IJoinTable joinTable = manyToManyMapping.getJoinTable();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ joinTable.addSpecifiedInverseJoinColumn(0).setSpecifiedName("FOO");
+ joinTable.addSpecifiedInverseJoinColumn(1).setSpecifiedName("BAR");
+ joinTable.addSpecifiedInverseJoinColumn(2).setSpecifiedName("BAZ");
+
+ JoinTable joinTableResource = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+ assertEquals(3, joinTableResource.inverseJoinColumnsSize());
+
+ joinTable.removeSpecifiedInverseJoinColumn(0);
+ assertEquals(2, joinTableResource.inverseJoinColumnsSize());
+ assertEquals("BAR", joinTableResource.inverseJoinColumnAt(0).getName());
+ assertEquals("BAZ", joinTableResource.inverseJoinColumnAt(1).getName());
+
+ joinTable.removeSpecifiedInverseJoinColumn(0);
+ assertEquals(1, joinTableResource.inverseJoinColumnsSize());
+ assertEquals("BAZ", joinTableResource.inverseJoinColumnAt(0).getName());
+
+ joinTable.removeSpecifiedInverseJoinColumn(0);
+ assertEquals(0, joinTableResource.inverseJoinColumnsSize());
+ }
+
+ public void testMoveSpecifiedInverseJoinColumn() throws Exception {
+ createTestEntityWithManyToMany();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping();
+ IJoinTable joinTable = manyToManyMapping.getJoinTable();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ joinTable.addSpecifiedInverseJoinColumn(0).setSpecifiedName("FOO");
+ joinTable.addSpecifiedInverseJoinColumn(1).setSpecifiedName("BAR");
+ joinTable.addSpecifiedInverseJoinColumn(2).setSpecifiedName("BAZ");
+
+ JoinTable joinTableResource = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME);
+ assertEquals(3, joinTableResource.inverseJoinColumnsSize());
+
+
+ joinTable.moveSpecifiedInverseJoinColumn(2, 0);
+ ListIterator<IJoinColumn> inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ assertEquals("BAR", inverseJoinColumns.next().getName());
+ assertEquals("BAZ", inverseJoinColumns.next().getName());
+ assertEquals("FOO", inverseJoinColumns.next().getName());
+
+ assertEquals("BAR", joinTableResource.inverseJoinColumnAt(0).getName());
+ assertEquals("BAZ", joinTableResource.inverseJoinColumnAt(1).getName());
+ assertEquals("FOO", joinTableResource.inverseJoinColumnAt(2).getName());
+
+
+ joinTable.moveSpecifiedInverseJoinColumn(0, 1);
+ inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ assertEquals("BAZ", inverseJoinColumns.next().getName());
+ assertEquals("BAR", inverseJoinColumns.next().getName());
+ assertEquals("FOO", inverseJoinColumns.next().getName());
+
+ assertEquals("BAZ", joinTableResource.inverseJoinColumnAt(0).getName());
+ assertEquals("BAR", joinTableResource.inverseJoinColumnAt(1).getName());
+ assertEquals("FOO", joinTableResource.inverseJoinColumnAt(2).getName());
+ }
+
+ public void testUpdateInverseJoinColumns() throws Exception {
+ createTestEntityWithManyToMany();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping();
+ IJoinTable joinTable = manyToManyMapping.getJoinTable();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ JoinTable joinTableResource = (JoinTable) attributeResource.addAnnotation(JoinTable.ANNOTATION_NAME);
+
+ joinTableResource.addInverseJoinColumn(0);
+ joinTableResource.addInverseJoinColumn(1);
+ joinTableResource.addInverseJoinColumn(2);
+
+ joinTableResource.inverseJoinColumnAt(0).setName("FOO");
+ joinTableResource.inverseJoinColumnAt(1).setName("BAR");
+ joinTableResource.inverseJoinColumnAt(2).setName("BAZ");
+
+ ListIterator<IJoinColumn> inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ assertEquals("FOO", inverseJoinColumns.next().getName());
+ assertEquals("BAR", inverseJoinColumns.next().getName());
+ assertEquals("BAZ", inverseJoinColumns.next().getName());
+ assertFalse(inverseJoinColumns.hasNext());
+
+ joinTableResource.moveInverseJoinColumn(2, 0);
+ inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ assertEquals("BAR", inverseJoinColumns.next().getName());
+ assertEquals("BAZ", inverseJoinColumns.next().getName());
+ assertEquals("FOO", inverseJoinColumns.next().getName());
+ assertFalse(inverseJoinColumns.hasNext());
+
+ joinTableResource.moveInverseJoinColumn(0, 1);
+ inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ assertEquals("BAZ", inverseJoinColumns.next().getName());
+ assertEquals("BAR", inverseJoinColumns.next().getName());
+ assertEquals("FOO", inverseJoinColumns.next().getName());
+ assertFalse(inverseJoinColumns.hasNext());
+
+ joinTableResource.removeInverseJoinColumn(1);
+ inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ assertEquals("BAZ", inverseJoinColumns.next().getName());
+ assertEquals("FOO", inverseJoinColumns.next().getName());
+ assertFalse(inverseJoinColumns.hasNext());
+
+ joinTableResource.removeInverseJoinColumn(1);
+ inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ assertEquals("BAZ", inverseJoinColumns.next().getName());
+ assertFalse(inverseJoinColumns.hasNext());
+
+ joinTableResource.removeInverseJoinColumn(0);
+ assertFalse(joinTable.specifiedInverseJoinColumns().hasNext());
+ }
+
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToManyMappingTests.java
new file mode 100644
index 0000000000..76159ef015
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToManyMappingTests.java
@@ -0,0 +1,872 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IClassRef;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.context.base.IVersionMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.Basic;
+import org.eclipse.jpt.core.internal.resource.java.Embedded;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.java.Id;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JoinTable;
+import org.eclipse.jpt.core.internal.resource.java.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.java.ManyToOne;
+import org.eclipse.jpt.core.internal.resource.java.MapKey;
+import org.eclipse.jpt.core.internal.resource.java.OneToMany;
+import org.eclipse.jpt.core.internal.resource.java.OneToOne;
+import org.eclipse.jpt.core.internal.resource.java.OrderBy;
+import org.eclipse.jpt.core.internal.resource.java.Transient;
+import org.eclipse.jpt.core.internal.resource.java.Version;
+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.iterators.ArrayIterator;
+
+public class JavaManyToManyMappingTests extends ContextModelTestCase
+{
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createManyToManyAnnotation() throws Exception{
+ this.createAnnotationAndMembers("ManyToMany", "");
+ }
+
+ private IType createTestTargetEntityAddress() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ID);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("Address").append(" ");
+ sb.append("{").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ sb.append(" private int id;").append(CR);
+ sb.append(CR);
+ sb.append(" private String city;").append(CR);
+ sb.append(CR);
+ sb.append(" private String state;").append(CR);
+ sb.append(CR);
+ sb.append(" private int zip;").append(CR);
+ sb.append(CR);
+ sb.append("}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "Address.java", sourceWriter);
+ }
+
+ private IType createTestEntityWithManyToManyMapping() throws Exception {
+ createEntityAnnotation();
+ createManyToManyAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_MANY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToMany").append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithValidManyToManyMapping() throws Exception {
+ createEntityAnnotation();
+ createManyToManyAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_MANY, JPA.ID, "java.util.Collection");
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @ManyToMany").append(CR);
+ sb.append(" private Collection<Address> addresses;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ }
+ });
+ }
+ private IType createTestEntityWithCollectionManyToManyMapping() throws Exception {
+ createEntityAnnotation();
+ createManyToManyAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_MANY, JPA.ID, "java.util.Collection");
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @ManyToMany").append(CR);
+ sb.append(" private Collection addresses;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ }
+ });
+ }
+ private IType createTestEntityWithNonCollectionManyToManyMapping() throws Exception {
+ createEntityAnnotation();
+ createManyToManyAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_MANY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @ManyToMany").append(CR);
+ sb.append(" private Address addresses;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ }
+ });
+ }
+
+ public JavaManyToManyMappingTests(String name) {
+ super(name);
+ }
+
+ public void testMorphToBasicMapping() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+ manyToManyMapping.setOrderBy("asdf");
+ manyToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(manyToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IBasicMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToDefault() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+ manyToManyMapping.setOrderBy("asdf");
+ manyToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(manyToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+ assertNull(persistentAttribute.getSpecifiedMapping());
+ assertTrue(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToVersionMapping() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+ manyToManyMapping.setOrderBy("asdf");
+ manyToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(manyToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IVersionMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToIdMapping() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+ manyToManyMapping.setOrderBy("asdf");
+ manyToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(manyToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IIdMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddedMapping() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+ manyToManyMapping.setOrderBy("asdf");
+ manyToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(manyToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddedIdMapping() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+ manyToManyMapping.setOrderBy("asdf");
+ manyToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(manyToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToTransientMapping() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+ manyToManyMapping.setOrderBy("asdf");
+ manyToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(manyToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToOneToOneMapping() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+ manyToManyMapping.setOrderBy("asdf");
+ manyToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(manyToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToOneToManyMapping() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+ manyToManyMapping.setOrderBy("asdf");
+ manyToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(manyToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToManyToOneMapping() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+ manyToManyMapping.setOrderBy("asdf");
+ manyToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(manyToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testUpdateSpecifiedTargetEntity() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation();
+
+ assertNull(manyToManyMapping.getSpecifiedTargetEntity());
+ assertNull(manyToMany.getTargetEntity());
+
+ //set target entity in the resource model, verify context model updated
+ manyToMany.setTargetEntity("newTargetEntity");
+ assertEquals("newTargetEntity", manyToManyMapping.getSpecifiedTargetEntity());
+ assertEquals("newTargetEntity", manyToMany.getTargetEntity());
+
+ //set target entity to null in the resource model
+ manyToMany.setTargetEntity(null);
+ assertNull(manyToManyMapping.getSpecifiedTargetEntity());
+ assertNull(manyToMany.getTargetEntity());
+ }
+
+ public void testModifySpecifiedTargetEntity() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation();
+
+ assertNull(manyToManyMapping.getSpecifiedTargetEntity());
+ assertNull(manyToMany.getTargetEntity());
+
+ //set target entity in the context model, verify resource model updated
+ manyToManyMapping.setSpecifiedTargetEntity("newTargetEntity");
+ assertEquals("newTargetEntity", manyToManyMapping.getSpecifiedTargetEntity());
+ assertEquals("newTargetEntity", manyToMany.getTargetEntity());
+
+ //set target entity to null in the context model
+ manyToManyMapping.setSpecifiedTargetEntity(null);
+ assertNull(manyToManyMapping.getSpecifiedTargetEntity());
+ assertNull(manyToMany.getTargetEntity());
+ }
+
+ public void testUpdateSpecifiedFetch() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation();
+
+ assertNull(manyToManyMapping.getSpecifiedFetch());
+ assertNull(manyToMany.getFetch());
+
+ //set fetch in the resource model, verify context model updated
+ manyToMany.setFetch(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER);
+ assertEquals(FetchType.EAGER, manyToManyMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER, manyToMany.getFetch());
+
+ manyToMany.setFetch(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY);
+ assertEquals(FetchType.LAZY, manyToManyMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY, manyToMany.getFetch());
+
+
+ //set fetch to null in the resource model
+ manyToMany.setFetch(null);
+ assertNull(manyToManyMapping.getSpecifiedFetch());
+ assertNull(manyToMany.getFetch());
+ }
+
+ public void testModifySpecifiedFetch() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation();
+
+ assertNull(manyToManyMapping.getSpecifiedFetch());
+ assertNull(manyToMany.getFetch());
+
+ //set fetch in the context model, verify resource model updated
+ manyToManyMapping.setSpecifiedFetch(FetchType.EAGER);
+ assertEquals(FetchType.EAGER, manyToManyMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER, manyToMany.getFetch());
+
+ manyToManyMapping.setSpecifiedFetch(FetchType.LAZY);
+ assertEquals(FetchType.LAZY, manyToManyMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY, manyToMany.getFetch());
+
+
+ //set fetch to null in the context model
+ manyToManyMapping.setSpecifiedFetch(null);
+ assertNull(manyToManyMapping.getSpecifiedFetch());
+ assertNull(manyToMany.getFetch());
+ }
+
+ public void testUpdateMappedBy() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation();
+
+ assertNull(manyToManyMapping.getMappedBy());
+ assertNull(manyToMany.getMappedBy());
+
+ //set mappedBy in the resource model, verify context model updated
+ manyToMany.setMappedBy("newMappedBy");
+ assertEquals("newMappedBy", manyToManyMapping.getMappedBy());
+ assertEquals("newMappedBy", manyToMany.getMappedBy());
+
+ //set mappedBy to null in the resource model
+ manyToMany.setMappedBy(null);
+ assertNull(manyToManyMapping.getMappedBy());
+ assertNull(manyToMany.getMappedBy());
+ }
+
+ public void testModifyMappedBy() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation();
+
+ assertNull(manyToManyMapping.getMappedBy());
+ assertNull(manyToMany.getMappedBy());
+
+ //set mappedBy in the context model, verify resource model updated
+ manyToManyMapping.setMappedBy("newTargetEntity");
+ assertEquals("newTargetEntity", manyToManyMapping.getMappedBy());
+ assertEquals("newTargetEntity", manyToMany.getMappedBy());
+
+ //set mappedBy to null in the context model
+ manyToManyMapping.setMappedBy(null);
+ assertNull(manyToManyMapping.getMappedBy());
+ assertNull(manyToMany.getMappedBy());
+ }
+
+
+ public void testCandidateMappedByAttributeNames() throws Exception {
+ createTestEntityWithValidManyToManyMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ Iterator<String> attributeNames = manyToManyMapping.candidateMappedByAttributeNames();
+ assertEquals("id", attributeNames.next());
+ assertEquals("city", attributeNames.next());
+ assertEquals("state", attributeNames.next());
+ assertEquals("zip", attributeNames.next());
+ assertFalse(attributeNames.hasNext());
+
+ manyToManyMapping.setSpecifiedTargetEntity("foo");
+ attributeNames = manyToManyMapping.candidateMappedByAttributeNames();
+ assertFalse(attributeNames.hasNext());
+
+ manyToManyMapping.setSpecifiedTargetEntity(null);
+ attributeNames = manyToManyMapping.candidateMappedByAttributeNames();
+ assertEquals("id", attributeNames.next());
+ assertEquals("city", attributeNames.next());
+ assertEquals("state", attributeNames.next());
+ assertEquals("zip", attributeNames.next());
+ assertFalse(attributeNames.hasNext());
+ }
+
+ public void testDefaultTargetEntity() throws Exception {
+ createTestEntityWithValidManyToManyMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ //targetEntity not in the persistence unit, default still set, handled by validation
+ assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getDefaultTargetEntity());
+
+ //add targetEntity to the persistence unit
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+ assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getDefaultTargetEntity());
+
+ //test default still the same when specified target entity it set
+ manyToManyMapping.setSpecifiedTargetEntity("foo");
+ assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getDefaultTargetEntity());
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IClassRef addressClassRef = classRefs.next();
+ IJavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType();
+
+ //test target is not an Entity, default target entity still exists, this case handled with validation
+ addressPersistentType.setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY);
+ assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getDefaultTargetEntity());
+ }
+
+ public void testDefaultTargetEntityCollectionType() throws Exception {
+ createTestEntityWithCollectionManyToManyMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ assertNull(manyToManyMapping.getDefaultTargetEntity());
+ }
+
+ public void testDefaultTargetEntityNonCollectionType() throws Exception {
+ createTestEntityWithNonCollectionManyToManyMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ assertNull(manyToManyMapping.getDefaultTargetEntity());
+ }
+
+ public void testTargetEntity() throws Exception {
+ createTestEntityWithValidManyToManyMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getTargetEntity());
+
+ manyToManyMapping.setSpecifiedTargetEntity("foo");
+ assertEquals("foo", manyToManyMapping.getTargetEntity());
+
+ manyToManyMapping.setSpecifiedTargetEntity(null);
+ assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getTargetEntity());
+ }
+
+ public void testResolvedTargetEntity() throws Exception {
+ createTestEntityWithValidManyToManyMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ //targetEntity not in the persistence unit
+ assertNull(manyToManyMapping.getResolvedTargetEntity());
+
+ //add targetEntity to the persistence unit, now target entity should resolve
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IClassRef addressClassRef = classRefs.next();
+ ITypeMapping addressTypeMapping = addressClassRef.getJavaPersistentType().getMapping();
+ assertEquals(addressTypeMapping, manyToManyMapping.getResolvedTargetEntity());
+
+ //test default still the same when specified target entity it set
+ manyToManyMapping.setSpecifiedTargetEntity("foo");
+ assertNull(manyToManyMapping.getResolvedTargetEntity());
+
+
+ manyToManyMapping.setSpecifiedTargetEntity(PACKAGE_NAME + ".Address");
+ assertEquals(addressTypeMapping, manyToManyMapping.getResolvedTargetEntity());
+
+
+ manyToManyMapping.setSpecifiedTargetEntity(null);
+ assertEquals(addressTypeMapping, manyToManyMapping.getResolvedTargetEntity());
+ }
+
+
+ public void testUpdateMapKey() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ assertNull(manyToManyMapping.getMapKey());
+ assertNull(attributeResource.annotation(MapKey.ANNOTATION_NAME));
+
+ //set mapKey in the resource model, verify context model does not change
+ attributeResource.addAnnotation(MapKey.ANNOTATION_NAME);
+ assertNull(manyToManyMapping.getMapKey());
+ MapKey mapKey = (MapKey) attributeResource.annotation(MapKey.ANNOTATION_NAME);
+ assertNotNull(mapKey);
+
+ //set mapKey name in the resource model, verify context model updated
+ mapKey.setName("myMapKey");
+ assertEquals("myMapKey", manyToManyMapping.getMapKey());
+ assertEquals("myMapKey", mapKey.getName());
+
+ //set mapKey name to null in the resource model
+ mapKey.setName(null);
+ assertNull(manyToManyMapping.getMapKey());
+ assertNull(mapKey.getName());
+
+ mapKey.setName("myMapKey");
+ attributeResource.removeAnnotation(MapKey.ANNOTATION_NAME);
+ assertNull(manyToManyMapping.getMapKey());
+ assertNull(attributeResource.annotation(MapKey.ANNOTATION_NAME));
+ }
+
+ public void testModifyMapKey() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ assertNull(manyToManyMapping.getMapKey());
+ assertNull(attributeResource.annotation(MapKey.ANNOTATION_NAME));
+
+ //set mapKey in the context model, verify resource model updated
+ manyToManyMapping.setMapKey("myMapKey");
+ MapKey mapKey = (MapKey) attributeResource.annotation(MapKey.ANNOTATION_NAME);
+ assertEquals("myMapKey", manyToManyMapping.getMapKey());
+ assertEquals("myMapKey", mapKey.getName());
+
+ //set mapKey to null in the context model
+ manyToManyMapping.setMapKey(null);
+ assertNull(manyToManyMapping.getMapKey());
+ assertNull(attributeResource.annotation(MapKey.ANNOTATION_NAME));
+ }
+
+ public void testUpdateOrderBy() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ assertNull(manyToManyMapping.getOrderBy());
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+
+ //set orderBy in the resource model, verify context model updated
+ attributeResource.addAnnotation(OrderBy.ANNOTATION_NAME);
+ OrderBy orderBy = (OrderBy) attributeResource.annotation(OrderBy.ANNOTATION_NAME);
+ orderBy.setValue("newOrderBy");
+ assertEquals("newOrderBy", manyToManyMapping.getOrderBy());
+ assertEquals("newOrderBy", orderBy.getValue());
+
+ //set orderBy to null in the resource model
+ attributeResource.removeAnnotation(OrderBy.ANNOTATION_NAME);
+ assertNull(manyToManyMapping.getOrderBy());
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testModifyOrderBy() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ assertNull(manyToManyMapping.getOrderBy());
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+
+ //set mappedBy in the context model, verify resource model updated
+ manyToManyMapping.setOrderBy("newOrderBy");
+ assertEquals("newOrderBy", manyToManyMapping.getOrderBy());
+ OrderBy orderBy = (OrderBy) attributeResource.annotation(OrderBy.ANNOTATION_NAME);
+ assertEquals("newOrderBy", orderBy.getValue());
+
+ //set mappedBy to null in the context model
+ manyToManyMapping.setOrderBy(null);
+ assertNull(manyToManyMapping.getOrderBy());
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testIsNoOrdering() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ assertTrue(manyToManyMapping.isNoOrdering());
+
+ manyToManyMapping.setOrderBy("foo");
+ assertFalse(manyToManyMapping.isNoOrdering());
+
+ manyToManyMapping.setOrderBy(null);
+ assertTrue(manyToManyMapping.isNoOrdering());
+ }
+
+ public void testSetNoOrdering() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ assertTrue(manyToManyMapping.isNoOrdering());
+
+ manyToManyMapping.setOrderBy("foo");
+ assertFalse(manyToManyMapping.isNoOrdering());
+
+ manyToManyMapping.setNoOrdering();
+ assertTrue(manyToManyMapping.isNoOrdering());
+ assertNull(manyToManyMapping.getOrderBy());
+ }
+//TODO
+// public boolean isOrderByPk() {
+// return "".equals(getOrderBy());
+// }
+//
+// public void setOrderByPk() {
+// setOrderBy("");
+// }
+
+ public void testIsCustomOrdering() throws Exception {
+ createTestEntityWithManyToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping();
+
+ assertFalse(manyToManyMapping.isCustomOrdering());
+
+ manyToManyMapping.setOrderBy("foo");
+ assertTrue(manyToManyMapping.isCustomOrdering());
+
+ manyToManyMapping.setOrderBy(null);
+ assertFalse(manyToManyMapping.isCustomOrdering());
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToOneMappingTests.java
new file mode 100644
index 0000000000..a2af9759bf
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToOneMappingTests.java
@@ -0,0 +1,884 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IClassRef;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.context.base.IVersionMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaJoinColumn;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.Basic;
+import org.eclipse.jpt.core.internal.resource.java.Embedded;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.java.Id;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumns;
+import org.eclipse.jpt.core.internal.resource.java.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.java.ManyToOne;
+import org.eclipse.jpt.core.internal.resource.java.OneToMany;
+import org.eclipse.jpt.core.internal.resource.java.OneToOne;
+import org.eclipse.jpt.core.internal.resource.java.Transient;
+import org.eclipse.jpt.core.internal.resource.java.Version;
+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.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaManyToOneMappingTests extends ContextModelTestCase
+{
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createManyToOneAnnotation() throws Exception{
+ this.createAnnotationAndMembers("ManyToOne", "");
+ }
+
+ private IType createTestTargetEntityAddress() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ID);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("Address").append(" ");
+ sb.append("{").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ sb.append(" private int id;").append(CR);
+ sb.append(CR);
+ sb.append(" private String city;").append(CR);
+ sb.append(CR);
+ sb.append(" private String state;").append(CR);
+ sb.append(CR);
+ sb.append(" private int zip;").append(CR);
+ sb.append(CR);
+ sb.append("}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "Address.java", sourceWriter);
+ }
+
+ private IType createTestEntityWithManyToOneMapping() throws Exception {
+ createEntityAnnotation();
+ createManyToOneAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_ONE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToOne").append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithValidManyToOneMapping() throws Exception {
+ createEntityAnnotation();
+ createManyToOneAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_ONE, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @ManyToOne").append(CR);
+ sb.append(" private Address address;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithCollectionManyToOneMapping() throws Exception {
+ createEntityAnnotation();
+ createManyToOneAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_ONE, JPA.ID, "java.util.Collection");
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @ManyToOne").append(CR);
+ sb.append(" private Collection address;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithGenericizedCollectionManyToOneMapping() throws Exception {
+ createEntityAnnotation();
+ createManyToOneAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_ONE, JPA.ID, "java.util.Collection");
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @ManyToOne").append(CR);
+ sb.append(" private Collection<Address> address;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ }
+ });
+ }
+
+ public JavaManyToOneMappingTests(String name) {
+ super(name);
+ }
+
+ public void testMorphToBasicMapping() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+ manyToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(manyToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IBasicMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToDefault() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+ manyToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(manyToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+ assertNull(persistentAttribute.getSpecifiedMapping());
+ assertTrue(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToVersionMapping() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+ manyToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(manyToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IVersionMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToIdMapping() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+ manyToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(manyToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IIdMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddedMapping() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+ manyToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(manyToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddedIdMapping() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+ manyToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(manyToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToTransientMapping() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+ manyToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(manyToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToOneToOneMapping() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+ manyToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(manyToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToOneToManyMapping() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+ manyToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(manyToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToManyToManyMapping() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+ manyToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(manyToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testUpdateSpecifiedTargetEntity() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation();
+
+ assertNull(manyToOneMapping.getSpecifiedTargetEntity());
+ assertNull(manyToOne.getTargetEntity());
+
+ //set target entity in the resource model, verify context model updated
+ manyToOne.setTargetEntity("newTargetEntity");
+ assertEquals("newTargetEntity", manyToOneMapping.getSpecifiedTargetEntity());
+ assertEquals("newTargetEntity", manyToOne.getTargetEntity());
+
+ //set target entity to null in the resource model
+ manyToOne.setTargetEntity(null);
+ assertNull(manyToOneMapping.getSpecifiedTargetEntity());
+ assertNull(manyToOne.getTargetEntity());
+ }
+
+ public void testModifySpecifiedTargetEntity() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation();
+
+ assertNull(manyToOneMapping.getSpecifiedTargetEntity());
+ assertNull(manyToOne.getTargetEntity());
+
+ //set target entity in the context model, verify resource model updated
+ manyToOneMapping.setSpecifiedTargetEntity("newTargetEntity");
+ assertEquals("newTargetEntity", manyToOneMapping.getSpecifiedTargetEntity());
+ assertEquals("newTargetEntity", manyToOne.getTargetEntity());
+
+ //set target entity to null in the context model
+ manyToOneMapping.setSpecifiedTargetEntity(null);
+ assertNull(manyToOneMapping.getSpecifiedTargetEntity());
+ assertNull(manyToOne.getTargetEntity());
+ }
+
+ public void testUpdateSpecifiedOptional() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation();
+
+ assertNull(manyToOneMapping.getSpecifiedOptional());
+ assertNull(manyToOne.getOptional());
+
+ //set optional in the resource model, verify context model updated
+ manyToOne.setOptional(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, manyToOneMapping.getSpecifiedOptional());
+ assertEquals(Boolean.TRUE, manyToOne.getOptional());
+
+ manyToOne.setOptional(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, manyToOneMapping.getSpecifiedOptional());
+ assertEquals(Boolean.FALSE, manyToOne.getOptional());
+
+
+ //set optional to null in the resource model
+ manyToOne.setOptional(null);
+ assertNull(manyToOneMapping.getSpecifiedOptional());
+ assertNull(manyToOne.getOptional());
+ }
+
+ public void testModifySpecifiedOptional() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation();
+
+ assertNull(manyToOneMapping.getSpecifiedOptional());
+ assertNull(manyToOne.getOptional());
+
+ //set optional in the context model, verify resource model updated
+ manyToOneMapping.setSpecifiedOptional(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, manyToOneMapping.getSpecifiedOptional());
+ assertEquals(Boolean.TRUE, manyToOne.getOptional());
+
+ manyToOneMapping.setSpecifiedOptional(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, manyToOneMapping.getSpecifiedOptional());
+ assertEquals(Boolean.FALSE, manyToOne.getOptional());
+
+
+ //set optional to null in the context model
+ manyToOneMapping.setSpecifiedOptional(null);
+ assertNull(manyToOneMapping.getSpecifiedOptional());
+ assertNull(manyToOne.getOptional());
+ }
+
+
+ public void testSpecifiedJoinColumns() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+
+ ListIterator<IJavaJoinColumn> specifiedJoinColumns = manyToOneMapping.specifiedJoinColumns();
+
+ assertFalse(specifiedJoinColumns.hasNext());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ //add an annotation to the resource model and verify the context model is updated
+ JoinColumn joinColumn = (JoinColumn) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ joinColumn.setName("FOO");
+ specifiedJoinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertEquals("FOO", specifiedJoinColumns.next().getName());
+ assertFalse(specifiedJoinColumns.hasNext());
+
+ joinColumn = (JoinColumn) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ joinColumn.setName("BAR");
+ specifiedJoinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertEquals("BAR", specifiedJoinColumns.next().getName());
+ assertEquals("FOO", specifiedJoinColumns.next().getName());
+ assertFalse(specifiedJoinColumns.hasNext());
+
+
+ joinColumn = (JoinColumn) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ joinColumn.setName("BAZ");
+ specifiedJoinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertEquals("BAZ", specifiedJoinColumns.next().getName());
+ assertEquals("BAR", specifiedJoinColumns.next().getName());
+ assertEquals("FOO", specifiedJoinColumns.next().getName());
+ assertFalse(specifiedJoinColumns.hasNext());
+
+ //move an annotation to the resource model and verify the context model is updated
+ attributeResource.move(1, 0, JPA.JOIN_COLUMNS);
+ specifiedJoinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertEquals("BAR", specifiedJoinColumns.next().getName());
+ assertEquals("BAZ", specifiedJoinColumns.next().getName());
+ assertEquals("FOO", specifiedJoinColumns.next().getName());
+ assertFalse(specifiedJoinColumns.hasNext());
+
+ attributeResource.removeAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ specifiedJoinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertEquals("BAZ", specifiedJoinColumns.next().getName());
+ assertEquals("FOO", specifiedJoinColumns.next().getName());
+ assertFalse(specifiedJoinColumns.hasNext());
+
+ attributeResource.removeAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ specifiedJoinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertEquals("FOO", specifiedJoinColumns.next().getName());
+ assertFalse(specifiedJoinColumns.hasNext());
+
+
+ attributeResource.removeAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ specifiedJoinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertFalse(specifiedJoinColumns.hasNext());
+ }
+
+ public void testDefaultJoinColumns() {
+ //TODO
+ }
+
+ public void testSpecifiedJoinColumnsSize() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+
+ assertEquals(0, manyToOneMapping.specifiedJoinColumnsSize());
+
+ manyToOneMapping.addSpecifiedJoinColumn(0);
+ assertEquals(1, manyToOneMapping.specifiedJoinColumnsSize());
+
+ manyToOneMapping.removeSpecifiedJoinColumn(0);
+ assertEquals(0, manyToOneMapping.specifiedJoinColumnsSize());
+ }
+
+ public void testAddSpecifiedJoinColumn() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+
+ manyToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ manyToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("BAR");
+ manyToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Iterator<JavaResource> joinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+
+ assertEquals("BAZ", ((JoinColumn) joinColumns.next()).getName());
+ assertEquals("BAR", ((JoinColumn) joinColumns.next()).getName());
+ assertEquals("FOO", ((JoinColumn) joinColumns.next()).getName());
+ assertFalse(joinColumns.hasNext());
+ }
+
+ public void testAddSpecifiedJoinColumn2() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+
+ manyToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ manyToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
+ manyToOneMapping.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Iterator<JavaResource> joinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+
+ assertEquals("FOO", ((JoinColumn) joinColumns.next()).getName());
+ assertEquals("BAR", ((JoinColumn) joinColumns.next()).getName());
+ assertEquals("BAZ", ((JoinColumn) joinColumns.next()).getName());
+ assertFalse(joinColumns.hasNext());
+ }
+ public void testRemoveSpecifiedJoinColumn() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+
+ manyToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ manyToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
+ manyToOneMapping.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ assertEquals(3, CollectionTools.size(attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)));
+
+ manyToOneMapping.removeSpecifiedJoinColumn(1);
+
+ Iterator<JavaResource> joinColumnResources = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ assertEquals("FOO", ((JoinColumn) joinColumnResources.next()).getName());
+ assertEquals("BAZ", ((JoinColumn) joinColumnResources.next()).getName());
+ assertFalse(joinColumnResources.hasNext());
+
+ Iterator<IJoinColumn> joinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertEquals("FOO", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+
+ manyToOneMapping.removeSpecifiedJoinColumn(1);
+ joinColumnResources = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ assertEquals("FOO", ((JoinColumn) joinColumnResources.next()).getName());
+ assertFalse(joinColumnResources.hasNext());
+
+ joinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+
+ manyToOneMapping.removeSpecifiedJoinColumn(0);
+ joinColumnResources = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ assertFalse(joinColumnResources.hasNext());
+ joinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertFalse(joinColumns.hasNext());
+
+ assertNull(attributeResource.annotation(JoinColumns.ANNOTATION_NAME));
+ }
+
+ public void testMoveSpecifiedJoinColumn() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+
+ manyToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ manyToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
+ manyToOneMapping.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
+
+ JavaPersistentAttributeResource attributeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME).attributes().next();
+
+ ListIterator<JoinColumn> javaJoinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ assertEquals(3, CollectionTools.size(javaJoinColumns));
+
+
+ manyToOneMapping.moveSpecifiedJoinColumn(2, 0);
+ ListIterator<IJoinColumn> primaryKeyJoinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName());
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName());
+
+ javaJoinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ assertEquals("BAR", javaJoinColumns.next().getName());
+ assertEquals("BAZ", javaJoinColumns.next().getName());
+ assertEquals("FOO", javaJoinColumns.next().getName());
+
+
+ manyToOneMapping.moveSpecifiedJoinColumn(0, 1);
+ primaryKeyJoinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName());
+ assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName());
+
+ javaJoinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ assertEquals("BAZ", javaJoinColumns.next().getName());
+ assertEquals("BAR", javaJoinColumns.next().getName());
+ assertEquals("FOO", javaJoinColumns.next().getName());
+ }
+
+ public void testUpdateSpecifiedJoinColumns() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+ JavaPersistentAttributeResource attributeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME).attributes().next();
+
+ ((JoinColumn) attributeResource.addAnnotation(0, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("FOO");
+ ((JoinColumn) attributeResource.addAnnotation(1, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("BAR");
+ ((JoinColumn) attributeResource.addAnnotation(2, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("BAZ");
+
+ ListIterator<IJoinColumn> joinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertEquals("FOO", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ attributeResource.move(2, 0, JoinColumns.ANNOTATION_NAME);
+ joinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ attributeResource.move(0, 1, JoinColumns.ANNOTATION_NAME);
+ joinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ attributeResource.removeAnnotation(1, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ joinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ attributeResource.removeAnnotation(1, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ joinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ attributeResource.removeAnnotation(0, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ joinColumns = manyToOneMapping.specifiedJoinColumns();
+ assertFalse(joinColumns.hasNext());
+ }
+ public void testJoinColumnIsVirtual() throws Exception {
+ createTestEntityWithManyToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+
+ manyToOneMapping.addSpecifiedJoinColumn(0);
+ IJoinColumn specifiedJoinColumn = manyToOneMapping.specifiedJoinColumns().next();
+ assertFalse(specifiedJoinColumn.isVirtual());
+
+ IJoinColumn defaultJoinColumn = manyToOneMapping.defaultJoinColumns().next();
+ assertTrue(defaultJoinColumn.isVirtual());
+ }
+
+ public void testDefaultTargetEntity() throws Exception {
+ createTestEntityWithValidManyToOneMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+
+ //targetEntity not in the persistence unit, default still set, handled by validation
+ assertEquals(PACKAGE_NAME + ".Address", manyToOneMapping.getDefaultTargetEntity());
+
+ //add targetEntity to the persistence unit
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+ assertEquals(PACKAGE_NAME + ".Address", manyToOneMapping.getDefaultTargetEntity());
+
+ //test default still the same when specified target entity it set
+ manyToOneMapping.setSpecifiedTargetEntity("foo");
+ assertEquals(PACKAGE_NAME + ".Address", manyToOneMapping.getDefaultTargetEntity());
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IClassRef addressClassRef = classRefs.next();
+ IJavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType();
+
+ //test target is not an Entity, default target entity still exists, this case handled with validation
+ addressPersistentType.setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY);
+ assertEquals(PACKAGE_NAME + ".Address", manyToOneMapping.getDefaultTargetEntity());
+ }
+
+ public void testDefaultTargetEntityCollectionType() throws Exception {
+ createTestEntityWithCollectionManyToOneMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+
+ assertNull(manyToOneMapping.getDefaultTargetEntity());
+ }
+
+ public void testDefaultTargetEntityGenericizedCollectionType() throws Exception {
+ createTestEntityWithGenericizedCollectionManyToOneMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+
+ assertNull(manyToOneMapping.getDefaultTargetEntity());
+ }
+
+ public void testTargetEntity() throws Exception {
+ createTestEntityWithValidManyToOneMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+
+ assertEquals(PACKAGE_NAME + ".Address", manyToOneMapping.getTargetEntity());
+
+ manyToOneMapping.setSpecifiedTargetEntity("foo");
+ assertEquals("foo", manyToOneMapping.getTargetEntity());
+
+ manyToOneMapping.setSpecifiedTargetEntity(null);
+ assertEquals(PACKAGE_NAME + ".Address", manyToOneMapping.getTargetEntity());
+ }
+
+ public void testResolvedTargetEntity() throws Exception {
+ createTestEntityWithValidManyToOneMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping();
+
+ //targetEntity not in the persistence unit
+ assertNull(manyToOneMapping.getResolvedTargetEntity());
+
+ //add targetEntity to the persistence unit, now target entity should resolve
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IClassRef addressClassRef = classRefs.next();
+ ITypeMapping addressTypeMapping = addressClassRef.getJavaPersistentType().getMapping();
+ assertEquals(addressTypeMapping, manyToOneMapping.getResolvedTargetEntity());
+
+ //test default still the same when specified target entity it set
+ manyToOneMapping.setSpecifiedTargetEntity("foo");
+ assertNull(manyToOneMapping.getResolvedTargetEntity());
+
+
+ manyToOneMapping.setSpecifiedTargetEntity(PACKAGE_NAME + ".Address");
+ assertEquals(addressTypeMapping, manyToOneMapping.getResolvedTargetEntity());
+
+
+ manyToOneMapping.setSpecifiedTargetEntity(null);
+ assertEquals(addressTypeMapping, manyToOneMapping.getResolvedTargetEntity());
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaMappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaMappedSuperclassTests.java
new file mode 100644
index 0000000000..f0275ba494
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaMappedSuperclassTests.java
@@ -0,0 +1,243 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddable;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IMappedSuperclass;
+import org.eclipse.jpt.core.internal.context.java.JavaNullTypeMapping;
+import org.eclipse.jpt.core.internal.resource.java.IdClass;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.MappedSuperclass;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaMappedSuperclassTests extends ContextModelTestCase
+{
+
+ private void createMappedSuperclassAnnotation() throws Exception {
+ this.createAnnotationAndMembers("MappedSuperclass", "");
+ }
+
+ private IType createTestMappedSuperclass() throws Exception {
+ createMappedSuperclassAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@MappedSuperclass");
+ }
+ });
+ }
+
+
+ public JavaMappedSuperclassTests(String name) {
+ super(name);
+ }
+
+ public void testMorphToEntity() throws Exception {
+ createTestMappedSuperclass();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaPersistentType().setMappingKey(IMappingKeys.ENTITY_TYPE_MAPPING_KEY);
+ assertTrue(javaPersistentType().getMapping() instanceof IEntity);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(MappedSuperclass.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddable() throws Exception {
+ createTestMappedSuperclass();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaPersistentType().setMappingKey(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
+ assertTrue(javaPersistentType().getMapping() instanceof IEmbeddable);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(MappedSuperclass.ANNOTATION_NAME));
+ }
+
+ public void testMorphToNull() throws Exception {
+ createTestMappedSuperclass();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaPersistentType().setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY);
+ assertTrue(javaPersistentType().getMapping() instanceof JavaNullTypeMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ assertNull(typeResource.mappingAnnotation(MappedSuperclass.ANNOTATION_NAME));
+ }
+
+
+ public void testMappedSuperclass() throws Exception {
+ createTestMappedSuperclass();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ assertTrue(javaPersistentType().getMapping() instanceof IMappedSuperclass);
+ }
+
+ public void testOverridableAttributeNames() throws Exception {
+ createTestMappedSuperclass();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping();
+ Iterator<String> overridableAttributeNames = mappedSuperclass.overridableAttributeNames();
+ assertEquals("id", overridableAttributeNames.next());
+ assertEquals("name", overridableAttributeNames.next());
+ assertFalse(overridableAttributeNames.hasNext());
+ }
+
+ public void testOverridableAssociationNames() throws Exception {
+ createTestMappedSuperclass();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping();
+ Iterator<String> overridableAssociationNames = mappedSuperclass.overridableAssociationNames();
+ assertFalse(overridableAssociationNames.hasNext());
+ }
+
+ public void testTableNameIsInvalid() throws Exception {
+ createTestMappedSuperclass();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping();
+
+ assertFalse(mappedSuperclass.tableNameIsInvalid(FULLY_QUALIFIED_TYPE_NAME));
+ assertFalse(mappedSuperclass.tableNameIsInvalid("FOO"));
+ }
+
+ public void testAssociatedTables() throws Exception {
+ createTestMappedSuperclass();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping();
+
+ assertFalse(mappedSuperclass.associatedTables().hasNext());
+ }
+
+ public void testAssociatedTablesIncludingInherited() throws Exception {
+ createTestMappedSuperclass();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping();
+
+ assertFalse(mappedSuperclass.associatedTablesIncludingInherited().hasNext());
+ }
+
+ public void testAssociatedTableNamesIncludingInherited() throws Exception {
+ createTestMappedSuperclass();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping();
+
+ assertFalse(mappedSuperclass.associatedTableNamesIncludingInherited().hasNext());
+ }
+
+ public void testAllOverridableAttributeNames() throws Exception {
+ createTestMappedSuperclass();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping();
+ Iterator<String> overridableAttributeNames = mappedSuperclass.overridableAttributeNames();
+ assertEquals("id", overridableAttributeNames.next());
+ assertEquals("name", overridableAttributeNames.next());
+ assertFalse(overridableAttributeNames.hasNext());
+ }
+
+ //TODO need to create a subclass mappedSuperclass and test this
+ public void testAllOverridableAssociationNames() throws Exception {
+ createTestMappedSuperclass();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping();
+ Iterator<String> overridableAssociationNames = mappedSuperclass.overridableAssociationNames();
+ assertFalse(overridableAssociationNames.hasNext());
+ }
+
+ public void testAttributeMappingKeyAllowed() throws Exception {
+ createTestMappedSuperclass();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping();
+ assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY));
+ assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY));
+ }
+
+ public void testUpdateIdClass() throws Exception {
+ createTestMappedSuperclass();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping();
+
+ assertNull(mappedSuperclass.getIdClass());
+ assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME));
+
+ IdClass idClass = (IdClass) typeResource.addAnnotation(IdClass.ANNOTATION_NAME);
+ assertNull(mappedSuperclass.getIdClass());
+ assertNotNull(typeResource.annotation(IdClass.ANNOTATION_NAME));
+
+ idClass.setValue("model.Foo");
+ assertEquals("model.Foo", mappedSuperclass.getIdClass());
+ assertEquals("model.Foo", ((IdClass) typeResource.annotation(IdClass.ANNOTATION_NAME)).getValue());
+
+ //test setting @IdClass value to null, IdClass annotation is removed
+ idClass.setValue(null);
+ assertNull(mappedSuperclass.getIdClass());
+ assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME));
+
+ //reset @IdClass value and then remove @IdClass
+ idClass = (IdClass) typeResource.addAnnotation(IdClass.ANNOTATION_NAME);
+ idClass.setValue("model.Foo");
+ typeResource.removeAnnotation(IdClass.ANNOTATION_NAME);
+
+ assertNull(mappedSuperclass.getIdClass());
+ assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME));
+ }
+
+ public void testModifyIdClass() throws Exception {
+ createTestMappedSuperclass();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping();
+
+ assertNull(mappedSuperclass.getIdClass());
+ assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME));
+
+ mappedSuperclass.setIdClass("model.Foo");
+ assertEquals("model.Foo", ((IdClass) typeResource.annotation(IdClass.ANNOTATION_NAME)).getValue());
+ assertEquals("model.Foo", mappedSuperclass.getIdClass());
+
+ mappedSuperclass.setIdClass(null);
+ assertNull(mappedSuperclass.getIdClass());
+ assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME));
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedNativeQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedNativeQueryTests.java
new file mode 100644
index 0000000000..a93b9905ae
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedNativeQueryTests.java
@@ -0,0 +1,424 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.INamedNativeQuery;
+import org.eclipse.jpt.core.internal.context.base.IQueryHint;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.NamedNativeQuery;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaNamedNativeQueryTests extends ContextModelTestCase
+{
+ private static final String QUERY_NAME = "QUERY_NAME";
+ private static final String QUERY_QUERY = "MY_QUERY";
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createNamedNativeQueryAnnotation() throws Exception {
+ createQueryHintAnnotation();
+ this.createAnnotationAndMembers("NamedNativeQuery",
+ "String name();" +
+ "String query();" +
+ "QueryHint[] hints() default {};");
+ }
+
+ private void createQueryHintAnnotation() throws Exception {
+ this.createAnnotationAndMembers("QueryHint",
+ "String name();" +
+ "String value();");
+ }
+
+ private IType createTestEntityWithNamedNativeQuery() throws Exception {
+ createEntityAnnotation();
+ createNamedNativeQueryAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.NAMED_NATIVE_QUERY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ sb.append("@NamedNativeQuery(name=\"" + QUERY_NAME + "\", query=\"" + QUERY_QUERY + "\")");
+ }
+ });
+ }
+
+
+
+ public JavaNamedNativeQueryTests(String name) {
+ super(name);
+ }
+
+ public void testUpdateName() throws Exception {
+ createTestEntityWithNamedNativeQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME);
+
+ assertEquals(QUERY_NAME, javaNamedNativeQuery.getName());
+ assertEquals(QUERY_NAME, namedNativeQuery.getName());
+
+ //set name to null in the resource model
+ javaNamedNativeQuery.setName(null);
+ assertNull(javaNamedNativeQuery.getName());
+ assertNull(namedNativeQuery.getName());
+
+ //set name in the resource model, verify context model updated
+ javaNamedNativeQuery.setName("foo");
+ assertEquals("foo", javaNamedNativeQuery.getName());
+ assertEquals("foo", namedNativeQuery.getName());
+ }
+
+ public void testModifyName() throws Exception {
+ createTestEntityWithNamedNativeQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IEntity entity = javaEntity();
+ INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME);
+
+ assertEquals(QUERY_NAME, javaNamedNativeQuery.getName());
+ assertEquals(QUERY_NAME, namedNativeQuery.getName());
+
+ //set name to null in the context model
+ namedNativeQuery.setName(null);
+ assertNull(javaNamedNativeQuery.getName());
+ assertNull(namedNativeQuery.getName());
+
+ //set name in the context model, verify resource model updated
+ namedNativeQuery.setName("foo");
+ assertEquals("foo", javaNamedNativeQuery.getName());
+ assertEquals("foo", namedNativeQuery.getName());
+ }
+
+ public void testUpdateQuery() throws Exception {
+ createTestEntityWithNamedNativeQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME);
+
+ assertEquals(QUERY_QUERY, javaNamedNativeQuery.getQuery());
+ assertEquals(QUERY_QUERY, namedNativeQuery.getQuery());
+
+ //set name to null in the resource model
+ javaNamedNativeQuery.setQuery(null);
+ assertNull(javaNamedNativeQuery.getQuery());
+ assertNull(namedNativeQuery.getQuery());
+
+ //set name in the resource model, verify context model updated
+ javaNamedNativeQuery.setQuery("foo");
+ assertEquals("foo", javaNamedNativeQuery.getQuery());
+ assertEquals("foo", namedNativeQuery.getQuery());
+ }
+
+ public void testModifyQuery() throws Exception {
+ createTestEntityWithNamedNativeQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IEntity entity = javaEntity();
+ INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME);
+
+ assertEquals(QUERY_QUERY, javaNamedNativeQuery.getQuery());
+ assertEquals(QUERY_QUERY, namedNativeQuery.getQuery());
+
+ //set name to null in the context model
+ namedNativeQuery.setQuery(null);
+ assertNull(javaNamedNativeQuery.getQuery());
+ assertNull(namedNativeQuery.getQuery());
+
+ //set name in the context model, verify resource model updated
+ namedNativeQuery.setQuery("foo");
+ assertEquals("foo", javaNamedNativeQuery.getQuery());
+ assertEquals("foo", namedNativeQuery.getQuery());
+ }
+
+
+ public void testAddHint() throws Exception {
+ createTestEntityWithNamedNativeQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IEntity entity = javaEntity();
+ INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME);
+
+
+ IQueryHint queryHint = namedNativeQuery.addHint(0);
+ ormResource().save(null);
+ queryHint.setName("FOO");
+ ormResource().save(null);
+
+ assertEquals("FOO", javaNamedNativeQuery.hintAt(0).getName());
+
+ IQueryHint queryHint2 = namedNativeQuery.addHint(0);
+ ormResource().save(null);
+ queryHint2.setName("BAR");
+ ormResource().save(null);
+
+ assertEquals("BAR", javaNamedNativeQuery.hintAt(0).getName());
+ assertEquals("FOO", javaNamedNativeQuery.hintAt(1).getName());
+
+ IQueryHint queryHint3 = namedNativeQuery.addHint(1);
+ ormResource().save(null);
+ queryHint3.setName("BAZ");
+ ormResource().save(null);
+
+ assertEquals("BAR", javaNamedNativeQuery.hintAt(0).getName());
+ assertEquals("BAZ", javaNamedNativeQuery.hintAt(1).getName());
+ assertEquals("FOO", javaNamedNativeQuery.hintAt(2).getName());
+
+ ListIterator<IQueryHint> hints = namedNativeQuery.hints();
+ assertEquals(queryHint2, hints.next());
+ assertEquals(queryHint3, hints.next());
+ assertEquals(queryHint, hints.next());
+
+ hints = namedNativeQuery.hints();
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+ }
+
+ public void testRemoveHint() throws Exception {
+ createTestEntityWithNamedNativeQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IEntity entity = javaEntity();
+ INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME);
+
+ namedNativeQuery.addHint(0).setName("FOO");
+ namedNativeQuery.addHint(1).setName("BAR");
+ namedNativeQuery.addHint(2).setName("BAZ");
+
+ assertEquals(3, javaNamedNativeQuery.hintsSize());
+
+ namedNativeQuery.removeHint(0);
+ assertEquals(2, javaNamedNativeQuery.hintsSize());
+ assertEquals("BAR", javaNamedNativeQuery.hintAt(0).getName());
+ assertEquals("BAZ", javaNamedNativeQuery.hintAt(1).getName());
+
+ namedNativeQuery.removeHint(0);
+ assertEquals(1, javaNamedNativeQuery.hintsSize());
+ assertEquals("BAZ", javaNamedNativeQuery.hintAt(0).getName());
+
+ namedNativeQuery.removeHint(0);
+ assertEquals(0, javaNamedNativeQuery.hintsSize());
+ }
+
+ public void testMoveHint() throws Exception {
+ createTestEntityWithNamedNativeQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IEntity entity = javaEntity();
+ INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME);
+
+ namedNativeQuery.addHint(0).setName("FOO");
+ namedNativeQuery.addHint(1).setName("BAR");
+ namedNativeQuery.addHint(2).setName("BAZ");
+
+ assertEquals(3, javaNamedNativeQuery.hintsSize());
+
+
+ namedNativeQuery.moveHint(2, 0);
+ ListIterator<IQueryHint> hints = namedNativeQuery.hints();
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+
+ assertEquals("BAR", javaNamedNativeQuery.hintAt(0).getName());
+ assertEquals("BAZ", javaNamedNativeQuery.hintAt(1).getName());
+ assertEquals("FOO", javaNamedNativeQuery.hintAt(2).getName());
+
+
+ namedNativeQuery.moveHint(0, 1);
+ hints = namedNativeQuery.hints();
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+
+ assertEquals("BAZ", javaNamedNativeQuery.hintAt(0).getName());
+ assertEquals("BAR", javaNamedNativeQuery.hintAt(1).getName());
+ assertEquals("FOO", javaNamedNativeQuery.hintAt(2).getName());
+ }
+
+ public void testUpdateHints() throws Exception {
+ createTestEntityWithNamedNativeQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IEntity entity = javaEntity();
+ INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME);
+
+ javaNamedNativeQuery.addHint(0);
+ javaNamedNativeQuery.addHint(1);
+ javaNamedNativeQuery.addHint(2);
+
+ javaNamedNativeQuery.hintAt(0).setName("FOO");
+ javaNamedNativeQuery.hintAt(1).setName("BAR");
+ javaNamedNativeQuery.hintAt(2).setName("BAZ");
+
+ ListIterator<IQueryHint> hints = namedNativeQuery.hints();
+ assertEquals("FOO", hints.next().getName());
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("BAZ", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ javaNamedNativeQuery.moveHint(2, 0);
+ hints = namedNativeQuery.hints();
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ javaNamedNativeQuery.moveHint(0, 1);
+ hints = namedNativeQuery.hints();
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ javaNamedNativeQuery.removeHint(1);
+ hints = namedNativeQuery.hints();
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ javaNamedNativeQuery.removeHint(1);
+ hints = namedNativeQuery.hints();
+ assertEquals("BAZ", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ javaNamedNativeQuery.removeHint(0);
+ assertFalse(namedNativeQuery.hints().hasNext());
+ }
+
+
+ public void testUpdateResultClass() throws Exception {
+ createTestEntityWithNamedNativeQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME);
+
+ assertEquals(null, javaNamedNativeQuery.getResultClass());
+ assertEquals(null, namedNativeQuery.getResultClass());
+
+ //set name in the resource model, verify context model updated
+ javaNamedNativeQuery.setResultClass("foo");
+ assertEquals("foo", javaNamedNativeQuery.getResultClass());
+ assertEquals("foo", namedNativeQuery.getResultClass());
+
+ //set name to null in the resource model
+ javaNamedNativeQuery.setResultClass(null);
+ assertNull(javaNamedNativeQuery.getResultClass());
+ assertNull(namedNativeQuery.getResultClass());
+ }
+
+ public void testModifyResultClass() throws Exception {
+ createTestEntityWithNamedNativeQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IEntity entity = javaEntity();
+ INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME);
+
+ assertEquals(null, javaNamedNativeQuery.getResultClass());
+ assertEquals(null, namedNativeQuery.getResultClass());
+
+ //set name in the context model, verify resource model updated
+ namedNativeQuery.setResultClass("foo");
+ assertEquals("foo", javaNamedNativeQuery.getResultClass());
+ assertEquals("foo", namedNativeQuery.getResultClass());
+
+ //set name to null in the context model
+ namedNativeQuery.setResultClass(null);
+ assertNull(javaNamedNativeQuery.getResultClass());
+ assertNull(namedNativeQuery.getResultClass());
+ }
+
+ public void testUpdateResultSetMapping() throws Exception {
+ createTestEntityWithNamedNativeQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME);
+
+ assertEquals(null, javaNamedNativeQuery.getResultSetMapping());
+ assertEquals(null, namedNativeQuery.getResultSetMapping());
+
+ //set name in the resource model, verify context model updated
+ javaNamedNativeQuery.setResultSetMapping("foo");
+ assertEquals("foo", javaNamedNativeQuery.getResultSetMapping());
+ assertEquals("foo", namedNativeQuery.getResultSetMapping());
+
+ //set name to null in the resource model
+ javaNamedNativeQuery.setResultSetMapping(null);
+ assertNull(javaNamedNativeQuery.getResultSetMapping());
+ assertNull(namedNativeQuery.getResultSetMapping());
+ }
+
+ public void testModifyResultSetMapping() throws Exception {
+ createTestEntityWithNamedNativeQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IEntity entity = javaEntity();
+ INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME);
+
+ assertEquals(null, javaNamedNativeQuery.getResultSetMapping());
+ assertEquals(null, namedNativeQuery.getResultSetMapping());
+
+ //set name in the context model, verify resource model updated
+ namedNativeQuery.setResultSetMapping("foo");
+ assertEquals("foo", javaNamedNativeQuery.getResultSetMapping());
+ assertEquals("foo", namedNativeQuery.getResultSetMapping());
+
+ //set name to null in the context model
+ namedNativeQuery.setResultSetMapping(null);
+ assertNull(javaNamedNativeQuery.getResultSetMapping());
+ assertNull(namedNativeQuery.getResultSetMapping());
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedQueryTests.java
new file mode 100644
index 0000000000..b891ae238e
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedQueryTests.java
@@ -0,0 +1,329 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.INamedQuery;
+import org.eclipse.jpt.core.internal.context.base.IQueryHint;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.NamedQuery;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaNamedQueryTests extends ContextModelTestCase
+{
+ private static final String QUERY_NAME = "QUERY_NAME";
+ private static final String QUERY_QUERY = "MY_QUERY";
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createNamedQueryAnnotation() throws Exception {
+ createQueryHintAnnotation();
+ this.createAnnotationAndMembers("NamedQuery",
+ "String name();" +
+ "String query();" +
+ "QueryHint[] hints() default {};");
+ }
+
+ private void createQueryHintAnnotation() throws Exception {
+ this.createAnnotationAndMembers("QueryHint",
+ "String name();" +
+ "String value();");
+ }
+
+ private IType createTestEntityWithNamedQuery() throws Exception {
+ createEntityAnnotation();
+ createNamedQueryAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.NAMED_QUERY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ sb.append("@NamedQuery(name=\"" + QUERY_NAME + "\", query=\"" + QUERY_QUERY + "\")");
+ }
+ });
+ }
+
+
+
+ public JavaNamedQueryTests(String name) {
+ super(name);
+ }
+
+ public void testUpdateName() throws Exception {
+ createTestEntityWithNamedQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ INamedQuery namedQuery = entity.namedQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME);
+
+ assertEquals(QUERY_NAME, javaNamedQuery.getName());
+ assertEquals(QUERY_NAME, namedQuery.getName());
+
+ //set name to null in the resource model
+ javaNamedQuery.setName(null);
+ assertNull(javaNamedQuery.getName());
+ assertNull(namedQuery.getName());
+
+ //set name in the resource model, verify context model updated
+ javaNamedQuery.setName("foo");
+ assertEquals("foo", javaNamedQuery.getName());
+ assertEquals("foo", namedQuery.getName());
+ }
+
+ public void testModifyName() throws Exception {
+ createTestEntityWithNamedQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IEntity entity = javaEntity();
+ INamedQuery namedQuery = entity.namedQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME);
+
+ assertEquals(QUERY_NAME, javaNamedQuery.getName());
+ assertEquals(QUERY_NAME, namedQuery.getName());
+
+ //set name to null in the context model
+ namedQuery.setName(null);
+ assertNull(javaNamedQuery.getName());
+ assertNull(namedQuery.getName());
+
+ //set name in the context model, verify resource model updated
+ namedQuery.setName("foo");
+ assertEquals("foo", javaNamedQuery.getName());
+ assertEquals("foo", namedQuery.getName());
+ }
+
+ public void testUpdateQuery() throws Exception {
+ createTestEntityWithNamedQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ INamedQuery namedQuery = entity.namedQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME);
+
+ assertEquals(QUERY_QUERY, javaNamedQuery.getQuery());
+ assertEquals(QUERY_QUERY, namedQuery.getQuery());
+
+ //set name to null in the resource model
+ javaNamedQuery.setQuery(null);
+ assertNull(javaNamedQuery.getQuery());
+ assertNull(namedQuery.getQuery());
+
+ //set name in the resource model, verify context model updated
+ javaNamedQuery.setQuery("foo");
+ assertEquals("foo", javaNamedQuery.getQuery());
+ assertEquals("foo", namedQuery.getQuery());
+ }
+
+ public void testModifyQuery() throws Exception {
+ createTestEntityWithNamedQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IEntity entity = javaEntity();
+ INamedQuery namedQuery = entity.namedQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME);
+
+ assertEquals(QUERY_QUERY, javaNamedQuery.getQuery());
+ assertEquals(QUERY_QUERY, namedQuery.getQuery());
+
+ //set name to null in the context model
+ namedQuery.setQuery(null);
+ assertNull(javaNamedQuery.getQuery());
+ assertNull(namedQuery.getQuery());
+
+ //set name in the context model, verify resource model updated
+ namedQuery.setQuery("foo");
+ assertEquals("foo", javaNamedQuery.getQuery());
+ assertEquals("foo", namedQuery.getQuery());
+ }
+
+
+ public void testAddHint() throws Exception {
+ createTestEntityWithNamedQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IEntity entity = javaEntity();
+ INamedQuery namedQuery = entity.namedQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME);
+
+
+ IQueryHint queryHint = namedQuery.addHint(0);
+ ormResource().save(null);
+ queryHint.setName("FOO");
+ ormResource().save(null);
+
+ assertEquals("FOO", javaNamedQuery.hintAt(0).getName());
+
+ IQueryHint queryHint2 = namedQuery.addHint(0);
+ ormResource().save(null);
+ queryHint2.setName("BAR");
+ ormResource().save(null);
+
+ assertEquals("BAR", javaNamedQuery.hintAt(0).getName());
+ assertEquals("FOO", javaNamedQuery.hintAt(1).getName());
+
+ IQueryHint queryHint3 = namedQuery.addHint(1);
+ ormResource().save(null);
+ queryHint3.setName("BAZ");
+ ormResource().save(null);
+
+ assertEquals("BAR", javaNamedQuery.hintAt(0).getName());
+ assertEquals("BAZ", javaNamedQuery.hintAt(1).getName());
+ assertEquals("FOO", javaNamedQuery.hintAt(2).getName());
+
+ ListIterator<IQueryHint> hints = namedQuery.hints();
+ assertEquals(queryHint2, hints.next());
+ assertEquals(queryHint3, hints.next());
+ assertEquals(queryHint, hints.next());
+
+ hints = namedQuery.hints();
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+ }
+
+ public void testRemoveHint() throws Exception {
+ createTestEntityWithNamedQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IEntity entity = javaEntity();
+ INamedQuery namedQuery = entity.namedQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME);
+
+ namedQuery.addHint(0).setName("FOO");
+ namedQuery.addHint(1).setName("BAR");
+ namedQuery.addHint(2).setName("BAZ");
+
+ assertEquals(3, javaNamedQuery.hintsSize());
+
+ namedQuery.removeHint(0);
+ assertEquals(2, javaNamedQuery.hintsSize());
+ assertEquals("BAR", javaNamedQuery.hintAt(0).getName());
+ assertEquals("BAZ", javaNamedQuery.hintAt(1).getName());
+
+ namedQuery.removeHint(0);
+ assertEquals(1, javaNamedQuery.hintsSize());
+ assertEquals("BAZ", javaNamedQuery.hintAt(0).getName());
+
+ namedQuery.removeHint(0);
+ assertEquals(0, javaNamedQuery.hintsSize());
+ }
+
+ public void testMoveHint() throws Exception {
+ createTestEntityWithNamedQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IEntity entity = javaEntity();
+ INamedQuery namedQuery = entity.namedQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME);
+
+ namedQuery.addHint(0).setName("FOO");
+ namedQuery.addHint(1).setName("BAR");
+ namedQuery.addHint(2).setName("BAZ");
+
+ assertEquals(3, javaNamedQuery.hintsSize());
+
+
+ namedQuery.moveHint(2, 0);
+ ListIterator<IQueryHint> hints = namedQuery.hints();
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+
+ assertEquals("BAR", javaNamedQuery.hintAt(0).getName());
+ assertEquals("BAZ", javaNamedQuery.hintAt(1).getName());
+ assertEquals("FOO", javaNamedQuery.hintAt(2).getName());
+
+
+ namedQuery.moveHint(0, 1);
+ hints = namedQuery.hints();
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+
+ assertEquals("BAZ", javaNamedQuery.hintAt(0).getName());
+ assertEquals("BAR", javaNamedQuery.hintAt(1).getName());
+ assertEquals("FOO", javaNamedQuery.hintAt(2).getName());
+ }
+
+ public void testUpdateHints() throws Exception {
+ createTestEntityWithNamedQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ IEntity entity = javaEntity();
+ INamedQuery namedQuery = entity.namedQueries().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME);
+
+ javaNamedQuery.addHint(0);
+ javaNamedQuery.addHint(1);
+ javaNamedQuery.addHint(2);
+
+ javaNamedQuery.hintAt(0).setName("FOO");
+ javaNamedQuery.hintAt(1).setName("BAR");
+ javaNamedQuery.hintAt(2).setName("BAZ");
+
+ ListIterator<IQueryHint> hints = namedQuery.hints();
+ assertEquals("FOO", hints.next().getName());
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("BAZ", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ javaNamedQuery.moveHint(2, 0);
+ hints = namedQuery.hints();
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ javaNamedQuery.moveHint(0, 1);
+ hints = namedQuery.hints();
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ javaNamedQuery.removeHint(1);
+ hints = namedQuery.hints();
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ javaNamedQuery.removeHint(1);
+ hints = namedQuery.hints();
+ assertEquals("BAZ", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ javaNamedQuery.removeHint(0);
+ assertFalse(namedQuery.hints().hasNext());
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToManyMappingTests.java
new file mode 100644
index 0000000000..c5c997b577
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToManyMappingTests.java
@@ -0,0 +1,876 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IClassRef;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.context.base.IVersionMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.Basic;
+import org.eclipse.jpt.core.internal.resource.java.Embedded;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.java.Id;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JoinTable;
+import org.eclipse.jpt.core.internal.resource.java.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.java.ManyToOne;
+import org.eclipse.jpt.core.internal.resource.java.MapKey;
+import org.eclipse.jpt.core.internal.resource.java.OneToMany;
+import org.eclipse.jpt.core.internal.resource.java.OneToOne;
+import org.eclipse.jpt.core.internal.resource.java.OrderBy;
+import org.eclipse.jpt.core.internal.resource.java.Transient;
+import org.eclipse.jpt.core.internal.resource.java.Version;
+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.iterators.ArrayIterator;
+
+public class JavaOneToManyMappingTests extends ContextModelTestCase
+{
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createOneToManyAnnotation() throws Exception{
+ this.createAnnotationAndMembers("OneToMany", "");
+ }
+
+ private IType createTestTargetEntityAddress() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ID);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("Address").append(" ");
+ sb.append("{").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ sb.append(" private int id;").append(CR);
+ sb.append(CR);
+ sb.append(" private String city;").append(CR);
+ sb.append(CR);
+ sb.append(" private String state;").append(CR);
+ sb.append(CR);
+ sb.append(" private int zip;").append(CR);
+ sb.append(CR);
+ sb.append("}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "Address.java", sourceWriter);
+ }
+
+ private IType createTestEntityWithOneToManyMapping() throws Exception {
+ createEntityAnnotation();
+ createOneToManyAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_MANY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToMany").append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithValidOneToManyMapping() throws Exception {
+ createEntityAnnotation();
+ createOneToManyAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_MANY, JPA.ID, "java.util.Collection");
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @OneToMany").append(CR);
+ sb.append(" private Collection<Address> addresses;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithCollectionOneToManyMapping() throws Exception {
+ createEntityAnnotation();
+ createOneToManyAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_MANY, JPA.ID, "java.util.Collection");
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @OneToMany").append(CR);
+ sb.append(" private Collection addresses;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ }
+ });
+ }
+ private IType createTestEntityWithNonCollectionOneToManyMapping() throws Exception {
+ createEntityAnnotation();
+ createOneToManyAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_MANY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @OneToMany").append(CR);
+ sb.append(" private Address addresses;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ }
+ });
+ }
+
+
+ public JavaOneToManyMappingTests(String name) {
+ super(name);
+ }
+
+ public void testMorphToBasicMapping() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+ oneToManyMapping.setOrderBy("asdf");
+ oneToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(oneToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IBasicMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToDefault() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+ oneToManyMapping.setOrderBy("asdf");
+ oneToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(oneToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+ assertNull(persistentAttribute.getSpecifiedMapping());
+ assertTrue(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToVersionMapping() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+ oneToManyMapping.setOrderBy("asdf");
+ oneToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(oneToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IVersionMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToIdMapping() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+ oneToManyMapping.setOrderBy("asdf");
+ oneToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(oneToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IIdMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddedMapping() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+ oneToManyMapping.setOrderBy("asdf");
+ oneToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(oneToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddedIdMapping() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+ oneToManyMapping.setOrderBy("asdf");
+ oneToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(oneToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToTransientMapping() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+ oneToManyMapping.setOrderBy("asdf");
+ oneToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(oneToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToOneToOneMapping() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+ oneToManyMapping.setOrderBy("asdf");
+ oneToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(oneToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToManyToManyMapping() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+ oneToManyMapping.setOrderBy("asdf");
+ oneToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(oneToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testMorphToManyToOneMapping() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+ oneToManyMapping.setOrderBy("asdf");
+ oneToManyMapping.getJoinTable().setSpecifiedName("FOO");
+ assertFalse(oneToManyMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+
+ public void testUpdateSpecifiedTargetEntity() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation();
+
+ assertNull(oneToManyMapping.getSpecifiedTargetEntity());
+ assertNull(oneToMany.getTargetEntity());
+
+ //set target entity in the resource model, verify context model updated
+ oneToMany.setTargetEntity("newTargetEntity");
+ assertEquals("newTargetEntity", oneToManyMapping.getSpecifiedTargetEntity());
+ assertEquals("newTargetEntity", oneToMany.getTargetEntity());
+
+ //set target entity to null in the resource model
+ oneToMany.setTargetEntity(null);
+ assertNull(oneToManyMapping.getSpecifiedTargetEntity());
+ assertNull(oneToMany.getTargetEntity());
+ }
+
+ public void testModifySpecifiedTargetEntity() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation();
+
+ assertNull(oneToManyMapping.getSpecifiedTargetEntity());
+ assertNull(oneToMany.getTargetEntity());
+
+ //set target entity in the context model, verify resource model updated
+ oneToManyMapping.setSpecifiedTargetEntity("newTargetEntity");
+ assertEquals("newTargetEntity", oneToManyMapping.getSpecifiedTargetEntity());
+ assertEquals("newTargetEntity", oneToMany.getTargetEntity());
+
+ //set target entity to null in the context model
+ oneToManyMapping.setSpecifiedTargetEntity(null);
+ assertNull(oneToManyMapping.getSpecifiedTargetEntity());
+ assertNull(oneToMany.getTargetEntity());
+ }
+
+ public void testUpdateSpecifiedFetch() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation();
+
+ assertNull(oneToManyMapping.getSpecifiedFetch());
+ assertNull(oneToMany.getFetch());
+
+ //set fetch in the resource model, verify context model updated
+ oneToMany.setFetch(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER);
+ assertEquals(FetchType.EAGER, oneToManyMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER, oneToMany.getFetch());
+
+ oneToMany.setFetch(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY);
+ assertEquals(FetchType.LAZY, oneToManyMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY, oneToMany.getFetch());
+
+
+ //set fetch to null in the resource model
+ oneToMany.setFetch(null);
+ assertNull(oneToManyMapping.getSpecifiedFetch());
+ assertNull(oneToMany.getFetch());
+ }
+
+ public void testModifySpecifiedFetch() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation();
+
+ assertNull(oneToManyMapping.getSpecifiedFetch());
+ assertNull(oneToMany.getFetch());
+
+ //set fetch in the context model, verify resource model updated
+ oneToManyMapping.setSpecifiedFetch(FetchType.EAGER);
+ assertEquals(FetchType.EAGER, oneToManyMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER, oneToMany.getFetch());
+
+ oneToManyMapping.setSpecifiedFetch(FetchType.LAZY);
+ assertEquals(FetchType.LAZY, oneToManyMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY, oneToMany.getFetch());
+
+
+ //set fetch to null in the context model
+ oneToManyMapping.setSpecifiedFetch(null);
+ assertNull(oneToManyMapping.getSpecifiedFetch());
+ assertNull(oneToMany.getFetch());
+ }
+
+ public void testUpdateMappedBy() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation();
+
+ assertNull(oneToManyMapping.getMappedBy());
+ assertNull(oneToMany.getMappedBy());
+
+ //set mappedBy in the resource model, verify context model updated
+ oneToMany.setMappedBy("newMappedBy");
+ assertEquals("newMappedBy", oneToManyMapping.getMappedBy());
+ assertEquals("newMappedBy", oneToMany.getMappedBy());
+
+ //set mappedBy to null in the resource model
+ oneToMany.setMappedBy(null);
+ assertNull(oneToManyMapping.getMappedBy());
+ assertNull(oneToMany.getMappedBy());
+ }
+
+ public void testModifyMappedBy() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation();
+
+ assertNull(oneToManyMapping.getMappedBy());
+ assertNull(oneToMany.getMappedBy());
+
+ //set mappedBy in the context model, verify resource model updated
+ oneToManyMapping.setMappedBy("newTargetEntity");
+ assertEquals("newTargetEntity", oneToManyMapping.getMappedBy());
+ assertEquals("newTargetEntity", oneToMany.getMappedBy());
+
+ //set mappedBy to null in the context model
+ oneToManyMapping.setMappedBy(null);
+ assertNull(oneToManyMapping.getMappedBy());
+ assertNull(oneToMany.getMappedBy());
+ }
+
+
+ public void testCandidateMappedByAttributeNames() throws Exception {
+ createTestEntityWithValidOneToManyMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ Iterator<String> attributeNames = oneToManyMapping.candidateMappedByAttributeNames();
+ assertEquals("id", attributeNames.next());
+ assertEquals("city", attributeNames.next());
+ assertEquals("state", attributeNames.next());
+ assertEquals("zip", attributeNames.next());
+ assertFalse(attributeNames.hasNext());
+
+ oneToManyMapping.setSpecifiedTargetEntity("foo");
+ attributeNames = oneToManyMapping.candidateMappedByAttributeNames();
+ assertFalse(attributeNames.hasNext());
+
+ oneToManyMapping.setSpecifiedTargetEntity(null);
+ attributeNames = oneToManyMapping.candidateMappedByAttributeNames();
+ assertEquals("id", attributeNames.next());
+ assertEquals("city", attributeNames.next());
+ assertEquals("state", attributeNames.next());
+ assertEquals("zip", attributeNames.next());
+ assertFalse(attributeNames.hasNext());
+ }
+
+ public void testDefaultTargetEntity() throws Exception {
+ createTestEntityWithValidOneToManyMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ //targetEntity not in the persistence unit, default still set, handled by validation
+ assertEquals(PACKAGE_NAME + ".Address", oneToManyMapping.getDefaultTargetEntity());
+
+ //add targetEntity to the persistence unit
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+ assertEquals(PACKAGE_NAME + ".Address", oneToManyMapping.getDefaultTargetEntity());
+
+ //test default still the same when specified target entity it set
+ oneToManyMapping.setSpecifiedTargetEntity("foo");
+ assertEquals(PACKAGE_NAME + ".Address", oneToManyMapping.getDefaultTargetEntity());
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IClassRef addressClassRef = classRefs.next();
+ IJavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType();
+
+ //test target is not an Entity, default target entity still exists, this case handled with validation
+ addressPersistentType.setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY);
+ assertEquals(PACKAGE_NAME + ".Address", oneToManyMapping.getDefaultTargetEntity());
+ }
+
+ public void testDefaultTargetEntityCollectionType() throws Exception {
+ createTestEntityWithCollectionOneToManyMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ assertNull(oneToManyMapping.getDefaultTargetEntity());
+ }
+
+ public void testDefaultTargetEntityNonCollectionType() throws Exception {
+ createTestEntityWithNonCollectionOneToManyMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ assertNull(oneToManyMapping.getDefaultTargetEntity());
+ }
+
+ public void testTargetEntity() throws Exception {
+ createTestEntityWithValidOneToManyMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ assertEquals(PACKAGE_NAME + ".Address", oneToManyMapping.getTargetEntity());
+
+ oneToManyMapping.setSpecifiedTargetEntity("foo");
+ assertEquals("foo", oneToManyMapping.getTargetEntity());
+
+ oneToManyMapping.setSpecifiedTargetEntity(null);
+ assertEquals(PACKAGE_NAME + ".Address", oneToManyMapping.getTargetEntity());
+ }
+
+ public void testResolvedTargetEntity() throws Exception {
+ createTestEntityWithValidOneToManyMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ //targetEntity not in the persistence unit
+ assertNull(oneToManyMapping.getResolvedTargetEntity());
+
+ //add targetEntity to the persistence unit, now target entity should resolve
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IClassRef addressClassRef = classRefs.next();
+ ITypeMapping addressTypeMapping = addressClassRef.getJavaPersistentType().getMapping();
+ assertEquals(addressTypeMapping, oneToManyMapping.getResolvedTargetEntity());
+
+ //test default still the same when specified target entity it set
+ oneToManyMapping.setSpecifiedTargetEntity("foo");
+ assertNull(oneToManyMapping.getResolvedTargetEntity());
+
+
+ oneToManyMapping.setSpecifiedTargetEntity(PACKAGE_NAME + ".Address");
+ assertEquals(addressTypeMapping, oneToManyMapping.getResolvedTargetEntity());
+
+
+ oneToManyMapping.setSpecifiedTargetEntity(null);
+ assertEquals(addressTypeMapping, oneToManyMapping.getResolvedTargetEntity());
+ }
+
+
+ public void testUpdateMapKey() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ assertNull(oneToManyMapping.getMapKey());
+ assertNull(attributeResource.annotation(MapKey.ANNOTATION_NAME));
+
+ //set mapKey in the resource model, verify context model does not change
+ attributeResource.addAnnotation(MapKey.ANNOTATION_NAME);
+ assertNull(oneToManyMapping.getMapKey());
+ MapKey mapKey = (MapKey) attributeResource.annotation(MapKey.ANNOTATION_NAME);
+ assertNotNull(mapKey);
+
+ //set mapKey name in the resource model, verify context model updated
+ mapKey.setName("myMapKey");
+ assertEquals("myMapKey", oneToManyMapping.getMapKey());
+ assertEquals("myMapKey", mapKey.getName());
+
+ //set mapKey name to null in the resource model
+ mapKey.setName(null);
+ assertNull(oneToManyMapping.getMapKey());
+ assertNull(mapKey.getName());
+
+ mapKey.setName("myMapKey");
+ attributeResource.removeAnnotation(MapKey.ANNOTATION_NAME);
+ assertNull(oneToManyMapping.getMapKey());
+ assertNull(attributeResource.annotation(MapKey.ANNOTATION_NAME));
+ }
+
+ public void testModifyMapKey() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ assertNull(oneToManyMapping.getMapKey());
+ assertNull(attributeResource.annotation(MapKey.ANNOTATION_NAME));
+
+ //set mapKey in the context model, verify resource model updated
+ oneToManyMapping.setMapKey("myMapKey");
+ MapKey mapKey = (MapKey) attributeResource.annotation(MapKey.ANNOTATION_NAME);
+ assertEquals("myMapKey", oneToManyMapping.getMapKey());
+ assertEquals("myMapKey", mapKey.getName());
+
+ //set mapKey to null in the context model
+ oneToManyMapping.setMapKey(null);
+ assertNull(oneToManyMapping.getMapKey());
+ assertNull(attributeResource.annotation(MapKey.ANNOTATION_NAME));
+ }
+
+ public void testUpdateOrderBy() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ assertNull(oneToManyMapping.getOrderBy());
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+
+ //set orderBy in the resource model, verify context model updated
+ attributeResource.addAnnotation(OrderBy.ANNOTATION_NAME);
+ OrderBy orderBy = (OrderBy) attributeResource.annotation(OrderBy.ANNOTATION_NAME);
+ orderBy.setValue("newOrderBy");
+ assertEquals("newOrderBy", oneToManyMapping.getOrderBy());
+ assertEquals("newOrderBy", orderBy.getValue());
+
+ //set orderBy to null in the resource model
+ attributeResource.removeAnnotation(OrderBy.ANNOTATION_NAME);
+ assertNull(oneToManyMapping.getOrderBy());
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testModifyOrderBy() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ assertNull(oneToManyMapping.getOrderBy());
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+
+ //set mappedBy in the context model, verify resource model updated
+ oneToManyMapping.setOrderBy("newOrderBy");
+ assertEquals("newOrderBy", oneToManyMapping.getOrderBy());
+ OrderBy orderBy = (OrderBy) attributeResource.annotation(OrderBy.ANNOTATION_NAME);
+ assertEquals("newOrderBy", orderBy.getValue());
+
+ //set mappedBy to null in the context model
+ oneToManyMapping.setOrderBy(null);
+ assertNull(oneToManyMapping.getOrderBy());
+ assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME));
+ }
+
+ public void testIsNoOrdering() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ assertTrue(oneToManyMapping.isNoOrdering());
+
+ oneToManyMapping.setOrderBy("foo");
+ assertFalse(oneToManyMapping.isNoOrdering());
+
+ oneToManyMapping.setOrderBy(null);
+ assertTrue(oneToManyMapping.isNoOrdering());
+ }
+
+ public void testSetNoOrdering() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ assertTrue(oneToManyMapping.isNoOrdering());
+
+ oneToManyMapping.setOrderBy("foo");
+ assertFalse(oneToManyMapping.isNoOrdering());
+
+ oneToManyMapping.setNoOrdering();
+ assertTrue(oneToManyMapping.isNoOrdering());
+ assertNull(oneToManyMapping.getOrderBy());
+ }
+//TODO
+// public boolean isOrderByPk() {
+// return "".equals(getOrderBy());
+// }
+//
+// public void setOrderByPk() {
+// setOrderBy("");
+// }
+
+ public void testIsCustomOrdering() throws Exception {
+ createTestEntityWithOneToManyMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping();
+
+ assertFalse(oneToManyMapping.isCustomOrdering());
+
+ oneToManyMapping.setOrderBy("foo");
+ assertTrue(oneToManyMapping.isCustomOrdering());
+
+ oneToManyMapping.setOrderBy(null);
+ assertFalse(oneToManyMapping.isCustomOrdering());
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToOneMappingTests.java
new file mode 100644
index 0000000000..29ac3a5488
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToOneMappingTests.java
@@ -0,0 +1,1026 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IClassRef;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
+import org.eclipse.jpt.core.internal.context.base.ITypeMapping;
+import org.eclipse.jpt.core.internal.context.base.IVersionMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaJoinColumn;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.Basic;
+import org.eclipse.jpt.core.internal.resource.java.Embedded;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.java.Id;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumns;
+import org.eclipse.jpt.core.internal.resource.java.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.java.ManyToOne;
+import org.eclipse.jpt.core.internal.resource.java.OneToMany;
+import org.eclipse.jpt.core.internal.resource.java.OneToOne;
+import org.eclipse.jpt.core.internal.resource.java.Transient;
+import org.eclipse.jpt.core.internal.resource.java.Version;
+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.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaOneToOneMappingTests extends ContextModelTestCase
+{
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createOneToOneAnnotation() throws Exception{
+ this.createAnnotationAndMembers("OneToOne", "");
+ }
+
+ private IType createTestTargetEntityAddress() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ID);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("Address").append(" ");
+ sb.append("{").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ sb.append(" private int id;").append(CR);
+ sb.append(CR);
+ sb.append(" private String city;").append(CR);
+ sb.append(CR);
+ sb.append(" private String state;").append(CR);
+ sb.append(CR);
+ sb.append(" private int zip;").append(CR);
+ sb.append(CR);
+ sb.append("}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "Address.java", sourceWriter);
+ }
+
+
+ private IType createTestEntityWithOneToOneMapping() throws Exception {
+ createEntityAnnotation();
+ createOneToOneAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToOne").append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithValidOneToOneMapping() throws Exception {
+ createEntityAnnotation();
+ createOneToOneAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @OneToOne").append(CR);
+ sb.append(" private Address address;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithCollectionOneToOneMapping() throws Exception {
+ createEntityAnnotation();
+ createOneToOneAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE, JPA.ID, "java.util.Collection");
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @OneToOne").append(CR);
+ sb.append(" private Collection address;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithGenericizedCollectionOneToOneMapping() throws Exception {
+ createEntityAnnotation();
+ createOneToOneAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE, JPA.ID, "java.util.Collection");
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @OneToOne").append(CR);
+ sb.append(" private Collection<Address> address;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ }
+ });
+ }
+
+ public JavaOneToOneMappingTests(String name) {
+ super(name);
+ }
+
+ public void testMorphToBasicMapping() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+ oneToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(oneToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IBasicMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToDefault() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+ oneToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(oneToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+ assertNull(persistentAttribute.getSpecifiedMapping());
+ assertTrue(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToVersionMapping() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+ oneToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(oneToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IVersionMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToIdMapping() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+ oneToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(oneToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IIdMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddedMapping() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+ oneToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(oneToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddedIdMapping() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+ oneToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(oneToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToTransientMapping() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+ oneToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(oneToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToManyToOneMapping() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+ oneToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(oneToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToOneToManyMapping() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+ oneToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(oneToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+ public void testMorphToManyToManyMapping() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+ oneToOneMapping.addSpecifiedJoinColumn(0);
+ assertFalse(oneToOneMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME));
+ }
+
+
+ public void testUpdateSpecifiedTargetEntity() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation();
+
+ assertNull(oneToOneMapping.getSpecifiedTargetEntity());
+ assertNull(oneToOne.getTargetEntity());
+
+ //set target entity in the resource model, verify context model updated
+ oneToOne.setTargetEntity("newTargetEntity");
+ assertEquals("newTargetEntity", oneToOneMapping.getSpecifiedTargetEntity());
+ assertEquals("newTargetEntity", oneToOne.getTargetEntity());
+
+ //set target entity to null in the resource model
+ oneToOne.setTargetEntity(null);
+ assertNull(oneToOneMapping.getSpecifiedTargetEntity());
+ assertNull(oneToOne.getTargetEntity());
+ }
+
+ public void testModifySpecifiedTargetEntity() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation();
+
+ assertNull(oneToOneMapping.getSpecifiedTargetEntity());
+ assertNull(oneToOne.getTargetEntity());
+
+ //set target entity in the context model, verify resource model updated
+ oneToOneMapping.setSpecifiedTargetEntity("newTargetEntity");
+ assertEquals("newTargetEntity", oneToOneMapping.getSpecifiedTargetEntity());
+ assertEquals("newTargetEntity", oneToOne.getTargetEntity());
+
+ //set target entity to null in the context model
+ oneToOneMapping.setSpecifiedTargetEntity(null);
+ assertNull(oneToOneMapping.getSpecifiedTargetEntity());
+ assertNull(oneToOne.getTargetEntity());
+ }
+
+ public void testUpdateMappedBy() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation();
+
+ assertNull(oneToOneMapping.getMappedBy());
+ assertNull(oneToOne.getMappedBy());
+
+ //set mappedBy in the resource model, verify context model updated
+ oneToOne.setMappedBy("newMappedBy");
+ assertEquals("newMappedBy", oneToOneMapping.getMappedBy());
+ assertEquals("newMappedBy", oneToOne.getMappedBy());
+
+ //set mappedBy to null in the resource model
+ oneToOne.setMappedBy(null);
+ assertNull(oneToOneMapping.getMappedBy());
+ assertNull(oneToOne.getMappedBy());
+ }
+
+ public void testModifyMappedBy() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation();
+
+ assertNull(oneToOneMapping.getMappedBy());
+ assertNull(oneToOne.getMappedBy());
+
+ //set mappedBy in the context model, verify resource model updated
+ oneToOneMapping.setMappedBy("newTargetEntity");
+ assertEquals("newTargetEntity", oneToOneMapping.getMappedBy());
+ assertEquals("newTargetEntity", oneToOne.getMappedBy());
+
+ //set mappedBy to null in the context model
+ oneToOneMapping.setMappedBy(null);
+ assertNull(oneToOneMapping.getMappedBy());
+ assertNull(oneToOne.getMappedBy());
+ }
+
+ public void testUpdateSpecifiedOptional() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation();
+
+ assertNull(oneToOneMapping.getSpecifiedOptional());
+ assertNull(oneToOne.getOptional());
+
+ //set optional in the resource model, verify context model updated
+ oneToOne.setOptional(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, oneToOneMapping.getSpecifiedOptional());
+ assertEquals(Boolean.TRUE, oneToOne.getOptional());
+
+ oneToOne.setOptional(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, oneToOneMapping.getSpecifiedOptional());
+ assertEquals(Boolean.FALSE, oneToOne.getOptional());
+
+
+ //set optional to null in the resource model
+ oneToOne.setOptional(null);
+ assertNull(oneToOneMapping.getSpecifiedOptional());
+ assertNull(oneToOne.getOptional());
+ }
+
+ public void testModifySpecifiedOptional() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation();
+
+ assertNull(oneToOneMapping.getSpecifiedOptional());
+ assertNull(oneToOne.getOptional());
+
+ //set optional in the context model, verify resource model updated
+ oneToOneMapping.setSpecifiedOptional(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, oneToOneMapping.getSpecifiedOptional());
+ assertEquals(Boolean.TRUE, oneToOne.getOptional());
+
+ oneToOneMapping.setSpecifiedOptional(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, oneToOneMapping.getSpecifiedOptional());
+ assertEquals(Boolean.FALSE, oneToOne.getOptional());
+
+
+ //set optional to null in the context model
+ oneToOneMapping.setSpecifiedOptional(null);
+ assertNull(oneToOneMapping.getSpecifiedOptional());
+ assertNull(oneToOne.getOptional());
+ }
+
+ public void testUpdateSpecifiedFetch() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation();
+
+ assertNull(oneToOneMapping.getSpecifiedFetch());
+ assertNull(oneToOne.getFetch());
+
+ //set fetch in the resource model, verify context model updated
+ oneToOne.setFetch(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER);
+ assertEquals(FetchType.EAGER, oneToOneMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER, oneToOne.getFetch());
+
+ oneToOne.setFetch(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY);
+ assertEquals(FetchType.LAZY, oneToOneMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY, oneToOne.getFetch());
+
+
+ //set fetch to null in the resource model
+ oneToOne.setFetch(null);
+ assertNull(oneToOneMapping.getSpecifiedFetch());
+ assertNull(oneToOne.getFetch());
+ }
+
+ public void testModifySpecifiedFetch() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation();
+
+ assertNull(oneToOneMapping.getSpecifiedFetch());
+ assertNull(oneToOne.getFetch());
+
+ //set fetch in the context model, verify resource model updated
+ oneToOneMapping.setSpecifiedFetch(FetchType.EAGER);
+ assertEquals(FetchType.EAGER, oneToOneMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER, oneToOne.getFetch());
+
+ oneToOneMapping.setSpecifiedFetch(FetchType.LAZY);
+ assertEquals(FetchType.LAZY, oneToOneMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY, oneToOne.getFetch());
+
+
+ //set fetch to null in the context model
+ oneToOneMapping.setSpecifiedFetch(null);
+ assertNull(oneToOneMapping.getSpecifiedFetch());
+ assertNull(oneToOne.getFetch());
+ }
+
+ public void testSpecifiedJoinColumns() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ ListIterator<IJavaJoinColumn> specifiedJoinColumns = oneToOneMapping.specifiedJoinColumns();
+
+ assertFalse(specifiedJoinColumns.hasNext());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ //add an annotation to the resource model and verify the context model is updated
+ JoinColumn joinColumn = (JoinColumn) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ joinColumn.setName("FOO");
+ specifiedJoinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertEquals("FOO", specifiedJoinColumns.next().getName());
+ assertFalse(specifiedJoinColumns.hasNext());
+
+ joinColumn = (JoinColumn) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ joinColumn.setName("BAR");
+ specifiedJoinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertEquals("BAR", specifiedJoinColumns.next().getName());
+ assertEquals("FOO", specifiedJoinColumns.next().getName());
+ assertFalse(specifiedJoinColumns.hasNext());
+
+
+ joinColumn = (JoinColumn) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ joinColumn.setName("BAZ");
+ specifiedJoinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertEquals("BAZ", specifiedJoinColumns.next().getName());
+ assertEquals("BAR", specifiedJoinColumns.next().getName());
+ assertEquals("FOO", specifiedJoinColumns.next().getName());
+ assertFalse(specifiedJoinColumns.hasNext());
+
+ //move an annotation to the resource model and verify the context model is updated
+ attributeResource.move(1, 0, JPA.JOIN_COLUMNS);
+ specifiedJoinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertEquals("BAR", specifiedJoinColumns.next().getName());
+ assertEquals("BAZ", specifiedJoinColumns.next().getName());
+ assertEquals("FOO", specifiedJoinColumns.next().getName());
+ assertFalse(specifiedJoinColumns.hasNext());
+
+ attributeResource.removeAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ specifiedJoinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertEquals("BAZ", specifiedJoinColumns.next().getName());
+ assertEquals("FOO", specifiedJoinColumns.next().getName());
+ assertFalse(specifiedJoinColumns.hasNext());
+
+ attributeResource.removeAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ specifiedJoinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertEquals("FOO", specifiedJoinColumns.next().getName());
+ assertFalse(specifiedJoinColumns.hasNext());
+
+
+ attributeResource.removeAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ specifiedJoinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertFalse(specifiedJoinColumns.hasNext());
+ }
+
+ public void testDefaultJoinColumns() {
+ //TODO
+ }
+
+ public void testSpecifiedJoinColumnsSize() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ assertEquals(0, oneToOneMapping.specifiedJoinColumnsSize());
+
+ oneToOneMapping.addSpecifiedJoinColumn(0);
+ assertEquals(1, oneToOneMapping.specifiedJoinColumnsSize());
+
+ oneToOneMapping.removeSpecifiedJoinColumn(0);
+ assertEquals(0, oneToOneMapping.specifiedJoinColumnsSize());
+ }
+
+ public void testAddSpecifiedJoinColumn() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ oneToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ oneToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("BAR");
+ oneToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Iterator<JavaResource> joinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+
+ assertEquals("BAZ", ((JoinColumn) joinColumns.next()).getName());
+ assertEquals("BAR", ((JoinColumn) joinColumns.next()).getName());
+ assertEquals("FOO", ((JoinColumn) joinColumns.next()).getName());
+ assertFalse(joinColumns.hasNext());
+ }
+
+ public void testAddSpecifiedJoinColumn2() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ oneToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ oneToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
+ oneToOneMapping.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Iterator<JavaResource> joinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+
+ assertEquals("FOO", ((JoinColumn) joinColumns.next()).getName());
+ assertEquals("BAR", ((JoinColumn) joinColumns.next()).getName());
+ assertEquals("BAZ", ((JoinColumn) joinColumns.next()).getName());
+ assertFalse(joinColumns.hasNext());
+ }
+ public void testRemoveSpecifiedJoinColumn() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ oneToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ oneToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
+ oneToOneMapping.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+
+ assertEquals(3, CollectionTools.size(attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)));
+
+ oneToOneMapping.removeSpecifiedJoinColumn(1);
+
+ Iterator<JavaResource> joinColumnResources = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ assertEquals("FOO", ((JoinColumn) joinColumnResources.next()).getName());
+ assertEquals("BAZ", ((JoinColumn) joinColumnResources.next()).getName());
+ assertFalse(joinColumnResources.hasNext());
+
+ Iterator<IJoinColumn> joinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertEquals("FOO", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+
+ oneToOneMapping.removeSpecifiedJoinColumn(1);
+ joinColumnResources = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ assertEquals("FOO", ((JoinColumn) joinColumnResources.next()).getName());
+ assertFalse(joinColumnResources.hasNext());
+
+ joinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+
+ oneToOneMapping.removeSpecifiedJoinColumn(0);
+ joinColumnResources = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ assertFalse(joinColumnResources.hasNext());
+ joinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertFalse(joinColumns.hasNext());
+
+ assertNull(attributeResource.annotation(JoinColumns.ANNOTATION_NAME));
+ }
+
+ public void testMoveSpecifiedJoinColumn() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ oneToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ oneToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
+ oneToOneMapping.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
+
+ JavaPersistentAttributeResource attributeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME).attributes().next();
+
+ ListIterator<JoinColumn> javaJoinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ assertEquals(3, CollectionTools.size(javaJoinColumns));
+
+
+ oneToOneMapping.moveSpecifiedJoinColumn(2, 0);
+ ListIterator<IJoinColumn> primaryKeyJoinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName());
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName());
+
+ javaJoinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ assertEquals("BAR", javaJoinColumns.next().getName());
+ assertEquals("BAZ", javaJoinColumns.next().getName());
+ assertEquals("FOO", javaJoinColumns.next().getName());
+
+
+ oneToOneMapping.moveSpecifiedJoinColumn(0, 1);
+ primaryKeyJoinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName());
+ assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName());
+
+ javaJoinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ assertEquals("BAZ", javaJoinColumns.next().getName());
+ assertEquals("BAR", javaJoinColumns.next().getName());
+ assertEquals("FOO", javaJoinColumns.next().getName());
+ }
+
+ public void testUpdateSpecifiedJoinColumns() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+ JavaPersistentAttributeResource attributeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME).attributes().next();
+
+ ((JoinColumn) attributeResource.addAnnotation(0, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("FOO");
+ ((JoinColumn) attributeResource.addAnnotation(1, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("BAR");
+ ((JoinColumn) attributeResource.addAnnotation(2, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("BAZ");
+
+ ListIterator<IJoinColumn> joinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertEquals("FOO", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ attributeResource.move(2, 0, JoinColumns.ANNOTATION_NAME);
+ joinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ attributeResource.move(0, 1, JoinColumns.ANNOTATION_NAME);
+ joinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ attributeResource.removeAnnotation(1, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ joinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ attributeResource.removeAnnotation(1, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ joinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ attributeResource.removeAnnotation(0, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME);
+ joinColumns = oneToOneMapping.specifiedJoinColumns();
+ assertFalse(joinColumns.hasNext());
+ }
+
+ public void testJoinColumnIsVirtual() throws Exception {
+ createTestEntityWithOneToOneMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ oneToOneMapping.addSpecifiedJoinColumn(0);
+ IJoinColumn specifiedJoinColumn = oneToOneMapping.specifiedJoinColumns().next();
+ assertFalse(specifiedJoinColumn.isVirtual());
+
+ IJoinColumn defaultJoinColumn = oneToOneMapping.defaultJoinColumns().next();
+ assertTrue(defaultJoinColumn.isVirtual());
+ }
+
+
+ public void testCandidateMappedByAttributeNames() throws Exception {
+ createTestEntityWithValidOneToOneMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ Iterator<String> attributeNames = oneToOneMapping.candidateMappedByAttributeNames();
+ assertEquals("id", attributeNames.next());
+ assertEquals("city", attributeNames.next());
+ assertEquals("state", attributeNames.next());
+ assertEquals("zip", attributeNames.next());
+ assertFalse(attributeNames.hasNext());
+
+ oneToOneMapping.setSpecifiedTargetEntity("foo");
+ attributeNames = oneToOneMapping.candidateMappedByAttributeNames();
+ assertFalse(attributeNames.hasNext());
+
+ oneToOneMapping.setSpecifiedTargetEntity(null);
+ attributeNames = oneToOneMapping.candidateMappedByAttributeNames();
+ assertEquals("id", attributeNames.next());
+ assertEquals("city", attributeNames.next());
+ assertEquals("state", attributeNames.next());
+ assertEquals("zip", attributeNames.next());
+ assertFalse(attributeNames.hasNext());
+ }
+
+ public void testDefaultTargetEntity() throws Exception {
+ createTestEntityWithValidOneToOneMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ //targetEntity not in the persistence unit, default still set, handled by validation
+ assertEquals(PACKAGE_NAME + ".Address", oneToOneMapping.getDefaultTargetEntity());
+
+ //add targetEntity to the persistence unit
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+ assertEquals(PACKAGE_NAME + ".Address", oneToOneMapping.getDefaultTargetEntity());
+
+ //test default still the same when specified target entity it set
+ oneToOneMapping.setSpecifiedTargetEntity("foo");
+ assertEquals(PACKAGE_NAME + ".Address", oneToOneMapping.getDefaultTargetEntity());
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IClassRef addressClassRef = classRefs.next();
+ IJavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType();
+
+ //test target is not an Entity, default target entity still exists, this case handled with validation
+ addressPersistentType.setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY);
+ assertEquals(PACKAGE_NAME + ".Address", oneToOneMapping.getDefaultTargetEntity());
+ }
+
+ public void testDefaultTargetEntityCollectionType() throws Exception {
+ createTestEntityWithCollectionOneToOneMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ assertNull(oneToOneMapping.getDefaultTargetEntity());
+ }
+
+ public void testDefaultTargetEntityGenericizedCollectionType() throws Exception {
+ createTestEntityWithGenericizedCollectionOneToOneMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ assertNull(oneToOneMapping.getDefaultTargetEntity());
+ }
+
+ public void testTargetEntity() throws Exception {
+ createTestEntityWithValidOneToOneMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ assertEquals(PACKAGE_NAME + ".Address", oneToOneMapping.getTargetEntity());
+
+ oneToOneMapping.setSpecifiedTargetEntity("foo");
+ assertEquals("foo", oneToOneMapping.getTargetEntity());
+
+ oneToOneMapping.setSpecifiedTargetEntity(null);
+ assertEquals(PACKAGE_NAME + ".Address", oneToOneMapping.getTargetEntity());
+ }
+
+ public void testResolvedTargetEntity() throws Exception {
+ createTestEntityWithValidOneToOneMapping();
+ createTestTargetEntityAddress();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping();
+
+ //targetEntity not in the persistence unit
+ assertNull(oneToOneMapping.getResolvedTargetEntity());
+
+ //add targetEntity to the persistence unit, now target entity should resolve
+ addXmlClassRef(PACKAGE_NAME + ".Address");
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IClassRef addressClassRef = classRefs.next();
+ ITypeMapping addressTypeMapping = addressClassRef.getJavaPersistentType().getMapping();
+ assertEquals(addressTypeMapping, oneToOneMapping.getResolvedTargetEntity());
+
+ //test default still the same when specified target entity it set
+ oneToOneMapping.setSpecifiedTargetEntity("foo");
+ assertNull(oneToOneMapping.getResolvedTargetEntity());
+
+
+ oneToOneMapping.setSpecifiedTargetEntity(PACKAGE_NAME + ".Address");
+ assertEquals(addressTypeMapping, oneToOneMapping.getResolvedTargetEntity());
+
+
+ oneToOneMapping.setSpecifiedTargetEntity(null);
+ assertEquals(addressTypeMapping, oneToOneMapping.getResolvedTargetEntity());
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPersistentAttributeTests.java
new file mode 100644
index 0000000000..d76e250805
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPersistentAttributeTests.java
@@ -0,0 +1,226 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.IJavaBasicMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.java.IJavaIdMapping;
+import org.eclipse.jpt.core.internal.resource.java.Basic;
+import org.eclipse.jpt.core.internal.resource.java.Embedded;
+import org.eclipse.jpt.core.internal.resource.java.Id;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaPersistentAttributeTests extends ContextModelTestCase
+{
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+
+ private IType createTestEntityAnnotatedField() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("Id", "");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestEntityAnnotatedMethod() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("Id", "");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+
+ public JavaPersistentAttributeTests(String name) {
+ super(name);
+ }
+
+ public void testGetName() throws Exception {
+ createTestType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+
+ assertEquals("id", persistentAttribute.getName());
+ }
+
+ public void testGetMapping() throws Exception {
+ createTestEntityAnnotatedMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ assertTrue(persistentAttribute.getMapping() instanceof IJavaIdMapping);
+
+ persistentAttribute.setSpecifiedMappingKey(null);
+ assertTrue(persistentAttribute.getMapping() instanceof IJavaBasicMapping);
+ }
+
+ public void testGetSpecifiedMapping() throws Exception {
+ createTestEntityAnnotatedMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ assertTrue(persistentAttribute.getSpecifiedMapping() instanceof IJavaIdMapping);
+
+ persistentAttribute.setSpecifiedMappingKey(null);
+ assertNull(persistentAttribute.getSpecifiedMapping());
+ }
+
+ public void testGetSpecifiedMappingNull() throws Exception {
+ createTestType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+
+ assertNull(persistentAttribute.getSpecifiedMapping());
+ assertNotNull(persistentAttribute.getMapping());
+ }
+
+ public void testMappingKey() throws Exception {
+ createTestEntityAnnotatedMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+
+ assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey());
+
+ persistentAttribute.setSpecifiedMappingKey(null);
+ assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey());
+ }
+
+ public void testDefaultMappingKey() throws Exception {
+ createTestEntityAnnotatedMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+
+ assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey());
+ assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, persistentAttribute.defaultMappingKey());
+ }
+
+ public void testSetSpecifiedMappingKey() throws Exception {
+ createTestType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ assertNull(persistentAttribute.getSpecifiedMapping());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNotNull(attributeResource.mappingAnnotation());
+ assertTrue(attributeResource.mappingAnnotation() instanceof Embedded);
+
+ assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey());
+ assertTrue(persistentAttribute.getSpecifiedMapping() instanceof IJavaEmbeddedMapping);
+ }
+
+ public void testSetSpecifiedMappingKey2() throws Exception {
+ createTestEntityAnnotatedField();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNotNull(attributeResource.mappingAnnotation());
+ assertTrue(attributeResource.mappingAnnotation() instanceof Embedded);
+
+ assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey());
+ assertTrue(persistentAttribute.getSpecifiedMapping() instanceof IJavaEmbeddedMapping);
+ }
+
+ public void testSetSpecifiedMappingKeyNull() throws Exception {
+ createTestEntityAnnotatedMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation());
+ assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+
+ assertNull(persistentAttribute.getSpecifiedMapping());
+ }
+
+ public void testGetMappingKeyMappingChangeInResourceModel() throws Exception {
+ createTestEntityAnnotatedField();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ attributeResource.setMappingAnnotation(Embedded.ANNOTATION_NAME);
+
+ assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey());
+ }
+
+ public void testGetMappingKeyMappingChangeInResourceModel2() throws Exception {
+ createTestType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ assertNull(persistentAttribute.getSpecifiedMapping());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ attributeResource.setMappingAnnotation(Basic.ANNOTATION_NAME);
+
+ assertEquals(IMappingKeys.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/JavaPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPersistentTypeTests.java
new file mode 100644
index 0000000000..3a8aac52cc
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPersistentTypeTests.java
@@ -0,0 +1,701 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.base.IClassRef;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.IPersistentType;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.Embeddable;
+import org.eclipse.jpt.core.internal.resource.java.Entity;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaPersistentTypeTests extends ContextModelTestCase
+{
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private IType createTestEntity() throws Exception {
+ createEntityAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ });
+ }
+
+ private IType createTestEntityAnnotatedField() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("Id", "");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestEntityAnnotatedMethod() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("Id", "");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+ private IType createTestEntityAnnotatedFieldAndMethod() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("Id", "");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestSubType() throws Exception {
+ return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild.java", "AnnotationTestTypeChild", new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendExtendsImplementsTo(StringBuilder sb) {
+ sb.append("extends " + TYPE_NAME + " ");
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ });
+ }
+
+ private IType createTestSubTypeWithFieldAnnotation() throws Exception {
+ return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild.java", "AnnotationTestTypeChild", new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendExtendsImplementsTo(StringBuilder sb) {
+ sb.append("extends " + TYPE_NAME + " ");
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestSubTypeWithMethodAnnotation() throws Exception {
+ return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild.java", "AnnotationTestTypeChild", new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendExtendsImplementsTo(StringBuilder sb) {
+ sb.append("extends " + TYPE_NAME + " ");
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestSubTypeNonPersistent() throws Exception {
+ return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild.java", "AnnotationTestTypeChild", new DefaultAnnotationWriter() {
+ @Override
+ public void appendExtendsImplementsTo(StringBuilder sb) {
+ sb.append("extends " + TYPE_NAME + " ");
+ }
+ });
+ }
+
+ private IType createTestSubTypePersistentExtendsNonPersistent() throws Exception {
+ return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild2.java", "AnnotationTestTypeChild2", new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendExtendsImplementsTo(StringBuilder sb) {
+ sb.append("extends AnnotationTestTypeChild ");
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ public JavaPersistentTypeTests(String name) {
+ super(name);
+ }
+
+ public void testGetName() throws Exception {
+ createTestType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(FULLY_QUALIFIED_TYPE_NAME, javaPersistentType().getName());
+ }
+
+ public void testGetAccessNothingAnnotated() throws Exception {
+ createTestType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(AccessType.FIELD, javaPersistentType().access());
+ }
+
+ public void testAccessField() throws Exception {
+ createTestEntityAnnotatedField();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(AccessType.FIELD, javaPersistentType().access());
+ }
+
+ public void testAccessProperty() throws Exception {
+ createTestEntityAnnotatedMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(AccessType.PROPERTY, javaPersistentType().access());
+ }
+
+ public void testAccessFieldAndMethodAnnotated() throws Exception {
+ createTestEntityAnnotatedFieldAndMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(AccessType.FIELD, javaPersistentType().access());
+ }
+
+ public void testAccessInheritance() throws Exception {
+ createTestEntityAnnotatedMethod();
+ createTestSubType();
+
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IClassRef classRef = classRefs.next();
+
+ IJavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
+ assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName());
+
+ assertEquals(AccessType.PROPERTY, javaPersistentType.access());
+ }
+
+ public void testAccessInheritance2() throws Exception {
+ createTestEntityAnnotatedField();
+ createTestSubType();
+
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IClassRef classRef = classRefs.next();
+
+ IJavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
+ assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName());
+
+ assertEquals(AccessType.FIELD, javaPersistentType.access());
+ }
+
+ public void testAccessInheritance3() throws Exception {
+ createTestEntityAnnotatedField();
+ createTestSubTypeWithMethodAnnotation();
+
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IClassRef classRef = classRefs.next();
+
+ IJavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
+ assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName());
+
+ assertEquals(AccessType.PROPERTY, javaPersistentType.access());
+ }
+
+ public void testAccessInheritance4() throws Exception {
+ createTestEntityAnnotatedMethod();
+ createTestSubTypeWithFieldAnnotation();
+
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IClassRef classRef = classRefs.next();
+ IJavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
+
+ assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName());
+
+ assertEquals(AccessType.FIELD, javaPersistentType.access());
+ }
+
+ //inherited class having annotations set wins over the default access set on persistence-unit-defaults
+ public void testAccessInheritancePersistenceUnitDefaultAccess() throws Exception {
+ createTestEntityAnnotatedMethod();
+ createTestSubType();
+
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.FIELD);
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ classRefs.next();
+ IClassRef classRef = classRefs.next();
+ IJavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
+
+ assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName());
+
+ assertEquals(AccessType.PROPERTY, javaPersistentType.access());
+ }
+
+ public void testAccessXmlNoAccessNoAnnotations() throws Exception {
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ createTestEntity();
+
+ IJavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType();
+ assertEquals(AccessType.FIELD, javaPersistentType.access());
+ }
+
+ public void testAccessXmlEntityAccessNoAnnotations() throws Exception {
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ createTestEntity();
+ IJavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType();
+
+ entityPersistentType.getMapping().setSpecifiedAccess(AccessType.FIELD);
+ assertEquals(AccessType.FIELD, javaPersistentType.access());
+
+ entityPersistentType.getMapping().setSpecifiedAccess(AccessType.PROPERTY);
+ assertEquals(AccessType.PROPERTY, javaPersistentType.access());
+ }
+
+ public void testAccessXmlPersistentUnitDefaultsAccessNoAnnotations() throws Exception {
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ createTestEntity();
+ IJavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType();
+
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.FIELD);
+ assertEquals(AccessType.FIELD, javaPersistentType.access());
+
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
+ assertEquals(AccessType.PROPERTY, javaPersistentType.access());
+ }
+
+ public void testAccessXmlEntityPropertyAccessAndFieldAnnotations() throws Exception {
+ //xml access set to property, field annotations, JavaPersistentType access is property
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ createTestEntityAnnotatedField();
+ IJavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType();
+
+ entityPersistentType.getMapping().setSpecifiedAccess(AccessType.PROPERTY);
+ assertEquals(AccessType.PROPERTY, javaPersistentType.access());
+ }
+
+ public void testAccessXmlEntityFieldAccessAndPropertyAnnotations() throws Exception {
+ //xml access set to field, property annotations, JavaPersistentType access is field
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ createTestEntityAnnotatedMethod();
+ IJavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType();
+
+ entityPersistentType.getMapping().setSpecifiedAccess(AccessType.FIELD);
+ assertEquals(AccessType.FIELD, javaPersistentType.access());
+ }
+
+ public void testAccessXmlPersistentUnitDefaultsAccessFieldAnnotations() throws Exception {
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ createTestEntityAnnotatedField();
+ IJavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType();
+
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
+ assertEquals(AccessType.FIELD, javaPersistentType.access());
+ }
+
+ //inheritance wins over entity-mappings specified access
+ public void testAccessXmlEntityMappingsAccessWithInheritance() throws Exception {
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlPersistentType childEntityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+
+ createTestEntityAnnotatedMethod();
+ createTestSubType();
+ IJavaPersistentType childJavaPersistentType = childEntityPersistentType.javaPersistentType();
+
+ entityMappings().setSpecifiedAccess(AccessType.FIELD);
+ assertEquals(AccessType.PROPERTY, entityPersistentType.javaPersistentType().access());
+ assertEquals(AccessType.PROPERTY, childJavaPersistentType.access());
+ }
+
+ public void testAccessXmlMetadataCompleteFieldAnnotations() throws Exception {
+ //xml access set to property, so even though there are field annotations, JavaPersistentType
+ //access should be property
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ createTestEntityAnnotatedField();
+ IJavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType();
+
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
+ entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ assertEquals(AccessType.PROPERTY, javaPersistentType.access());
+
+ }
+
+ public void testAccessNoXmlAccessXmlMetdataCompletePropertyAnnotations() throws Exception {
+ //xml access not set, metadata complete set. JavaPersistentType access
+ //is field??
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ createTestEntityAnnotatedMethod();
+ IJavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType();
+
+ entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ assertEquals(AccessType.FIELD, javaPersistentType.access());
+ }
+
+ public void testParentPersistentType() throws Exception {
+ createTestEntityAnnotatedMethod();
+ createTestSubTypeWithFieldAnnotation();
+
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ IClassRef classRef = classRefs.next();
+ IJavaPersistentType rootJavaPersistentType = classRef.getJavaPersistentType();
+
+ classRef = classRefs.next();
+ IJavaPersistentType childJavaPersistentType = classRef.getJavaPersistentType();
+
+ assertEquals(rootJavaPersistentType, childJavaPersistentType.parentPersistentType());
+ assertNull(rootJavaPersistentType.parentPersistentType());
+ }
+
+ public void testParentPersistentType2() throws Exception {
+ createTestEntityAnnotatedMethod();
+ createTestSubTypeWithFieldAnnotation();
+
+ //parent is not added to the persistenceUnit, so even though it has an Entity
+ //annotation it should not be found as the parentPersistentType
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ IJavaPersistentType javaPersistentType = classRefs.next().getJavaPersistentType();
+
+ assertNull(javaPersistentType.parentPersistentType());
+ }
+
+ //Entity extends Non-Entity extends Entity
+ public void testParentPersistentType3() throws Exception {
+ createTestEntityAnnotatedMethod();
+ createTestSubTypeNonPersistent();
+ createTestSubTypePersistentExtendsNonPersistent();
+
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild2");
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ IClassRef classRef = classRefs.next();
+ IJavaPersistentType rootJavaPersistentType = classRef.getJavaPersistentType();
+
+ classRef = classRefs.next();
+ IJavaPersistentType childJavaPersistentType = classRef.getJavaPersistentType();
+
+ assertEquals(rootJavaPersistentType, childJavaPersistentType.parentPersistentType());
+ assertNull(rootJavaPersistentType.parentPersistentType());
+ }
+
+ public void testInheritanceHierarchy() throws Exception {
+ createTestEntityAnnotatedMethod();
+ createTestSubTypeNonPersistent();
+ createTestSubTypePersistentExtendsNonPersistent();
+
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild2");
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ IJavaPersistentType rootJavaPersistentType = classRefs.next().getJavaPersistentType();
+ IJavaPersistentType childJavaPersistentType = classRefs.next().getJavaPersistentType();
+
+ Iterator<IPersistentType> inheritanceHierarchy = childJavaPersistentType.inheritanceHierarchy();
+
+ assertEquals(childJavaPersistentType, inheritanceHierarchy.next());
+ assertEquals(rootJavaPersistentType, inheritanceHierarchy.next());
+ }
+
+ public void testInheritanceHierarchy2() throws Exception {
+ createTestEntityAnnotatedMethod();
+ createTestSubTypeNonPersistent();
+ createTestSubTypePersistentExtendsNonPersistent();
+
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild2");
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ListIterator<IClassRef> classRefs = persistenceUnit().classRefs();
+ IJavaPersistentType childJavaPersistentType = classRefs.next().getJavaPersistentType();
+ IJavaPersistentType rootJavaPersistentType = classRefs.next().getJavaPersistentType();
+
+ Iterator<IPersistentType> inheritanceHierarchy = childJavaPersistentType.inheritanceHierarchy();
+
+ assertEquals(childJavaPersistentType, inheritanceHierarchy.next());
+ assertEquals(rootJavaPersistentType, inheritanceHierarchy.next());
+ }
+
+ public void testGetMapping() throws Exception {
+ createTestEntityAnnotatedMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().getMapping().getKey());
+ }
+
+ public void testGetMappingNull() throws Exception {
+ createTestType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(IMappingKeys.NULL_TYPE_MAPPING_KEY, javaPersistentType().getMapping().getKey());
+ }
+
+ public void testMappingKey() throws Exception {
+ createTestEntityAnnotatedMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey());
+ }
+
+ public void testMappingKeyNull() throws Exception {
+ createTestType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(IMappingKeys.NULL_TYPE_MAPPING_KEY, javaPersistentType().mappingKey());
+ }
+
+ public void testSetMappingKey() throws Exception {
+ createTestType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(IMappingKeys.NULL_TYPE_MAPPING_KEY, javaPersistentType().mappingKey());
+
+ javaPersistentType().setMappingKey(IMappingKeys.ENTITY_TYPE_MAPPING_KEY);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ assertNotNull(typeResource.mappingAnnotation());
+ assertTrue(typeResource.mappingAnnotation() instanceof Entity);
+
+ assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey());
+ }
+
+ public void testSetMappingKey2() throws Exception {
+ createTestEntityAnnotatedField();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey());
+
+ javaPersistentType().setMappingKey(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ assertNotNull(typeResource.mappingAnnotation());
+ assertTrue(typeResource.mappingAnnotation() instanceof Embeddable);
+
+ assertEquals(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, javaPersistentType().mappingKey());
+ }
+
+ public void testSetMappingKeyNull() throws Exception {
+ createTestEntityAnnotatedMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey());
+
+ javaPersistentType().setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ assertNull(typeResource.mappingAnnotation());
+ assertNull(typeResource.mappingAnnotation(Entity.ANNOTATION_NAME));
+
+ assertEquals(IMappingKeys.NULL_TYPE_MAPPING_KEY, javaPersistentType().mappingKey());
+ }
+
+ public void testGetMappingKeyMappingChangeInResourceModel() throws Exception {
+ createTestEntityAnnotatedField();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ typeResource.setMappingAnnotation(Embeddable.ANNOTATION_NAME);
+
+ assertEquals(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, javaPersistentType().mappingKey());
+ }
+
+ public void testGetMappingKeyMappingChangeInResourceModel2() throws Exception {
+ createTestType();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(IMappingKeys.NULL_TYPE_MAPPING_KEY, javaPersistentType().mappingKey());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ typeResource.setMappingAnnotation(Entity.ANNOTATION_NAME);
+
+ assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey());
+ }
+
+ public void testIsMapped() throws Exception {
+ createTestEntityAnnotatedMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertTrue(javaPersistentType().isMapped());
+
+ javaPersistentType().setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY);
+ assertFalse(javaPersistentType().isMapped());
+ }
+
+ public void testAttributes() throws Exception {
+ createTestEntityAnnotatedMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ ListIterator<IJavaPersistentAttribute> attributes = javaPersistentType().attributes();
+
+ assertEquals("id", attributes.next().getName());
+ assertFalse(attributes.hasNext());
+ }
+
+ public void testAttributes2() throws Exception {
+ createTestEntityAnnotatedFieldAndMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ListIterator<IJavaPersistentAttribute> attributes = javaPersistentType().attributes();
+
+ assertEquals("id", attributes.next().getName());
+ assertEquals("name", attributes.next().getName());
+ assertFalse(attributes.hasNext());
+ }
+
+ public void testAttributesSize() throws Exception {
+ createTestEntityAnnotatedMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(1, javaPersistentType().attributesSize());
+ }
+
+ public void testAttributesSize2() throws Exception {
+ createTestEntityAnnotatedFieldAndMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(2, javaPersistentType().attributesSize());
+ }
+
+ public void testAttributeNamed() throws Exception {
+ createTestEntityAnnotatedMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute attribute = javaPersistentType().attributeNamed("id");
+
+ assertEquals("id", attribute.getName());
+ assertNull(javaPersistentType().attributeNamed("name"));
+ assertNull(javaPersistentType().attributeNamed("foo"));
+ }
+
+ public void testAttributeNamed2() throws Exception {
+ createTestEntityAnnotatedField();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute attribute = javaPersistentType().attributeNamed("name");
+
+ assertEquals("name", attribute.getName());
+
+ assertNull(javaPersistentType().attributeNamed("foo"));
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java
new file mode 100644
index 0000000000..412b74a123
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java
@@ -0,0 +1,319 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.IPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase
+{
+ private static final String PRIMARY_KEY_JOIN_COLUMN_NAME = "MY_PRIMARY_KEY_JOIN_COLUMN";
+ private static final String COLUMN_DEFINITION = "MY_COLUMN_DEFINITION";
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createIdAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Id", "");
+ }
+
+ private void createPrimaryKeyJoinColumnAnnotation() throws Exception{
+ this.createAnnotationAndMembers("PrimaryKeyJoinColumn",
+ "String name() default \"\";" +
+ "String referencedColumnName() default \"\";" +
+ "String columnDefinition() default \"\";");
+ }
+
+
+ private IType createTestEntity() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestEntityWithPrimaryKeyJoinColumn() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+ createPrimaryKeyJoinColumnAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.PRIMARY_KEY_JOIN_COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ sb.append("@PrimaryKeyJoinColumn(name=\"" + PRIMARY_KEY_JOIN_COLUMN_NAME + "\")");
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+
+ public JavaPrimaryKeyJoinColumnTests(String name) {
+ super(name);
+ }
+
+ public void testGetSpecifiedName() throws Exception {
+ createTestEntityWithPrimaryKeyJoinColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+ assertEquals(PRIMARY_KEY_JOIN_COLUMN_NAME, specifiedPkJoinColumn.getSpecifiedName());
+
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ PrimaryKeyJoinColumn pkJoinColumnResource = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+
+ pkJoinColumnResource.setName("FOO");
+ specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+ assertEquals("FOO", specifiedPkJoinColumn.getName());
+ }
+
+ public void testGetDefaultNameNoSpecifiedPrimaryKeyJoinColumns() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPrimaryKeyJoinColumn pkJoinColumn = javaEntity().defaultPrimaryKeyJoinColumns().next();
+ assertEquals("id", pkJoinColumn.getDefaultName());
+ }
+
+ public void testGetDefaultName() throws Exception {
+ createTestEntityWithPrimaryKeyJoinColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPrimaryKeyJoinColumn defaultPkJoinColumn = javaEntity().defaultPrimaryKeyJoinColumns().next();
+ assertEquals("id", defaultPkJoinColumn.getDefaultName());
+
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+ assertEquals("id", specifiedPkJoinColumn.getDefaultName());
+
+ //remove @Id annotation
+ IPersistentAttribute idAttribute = javaPersistentType().attributeNamed("id");
+ idAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+
+ assertNull(specifiedPkJoinColumn.getDefaultName());
+ }
+
+ public void testGetName() throws Exception {
+ createTestEntityWithPrimaryKeyJoinColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+ assertEquals(PRIMARY_KEY_JOIN_COLUMN_NAME, specifiedPkJoinColumn.getName());
+ }
+
+ public void testSetSpecifiedName() throws Exception {
+ createTestEntityWithPrimaryKeyJoinColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+
+ specifiedPkJoinColumn.setSpecifiedName("foo");
+ assertEquals("foo", specifiedPkJoinColumn.getSpecifiedName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ PrimaryKeyJoinColumn pkJoinColumn = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+
+ assertEquals("foo", pkJoinColumn.getName());
+
+ specifiedPkJoinColumn.setSpecifiedName(null);
+ assertNull(specifiedPkJoinColumn.getSpecifiedName());
+ pkJoinColumn = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+ assertNull(pkJoinColumn);
+ }
+
+ public void testGetColumnDefinition() throws Exception {
+ createTestEntityWithPrimaryKeyJoinColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+ assertNull(specifiedPkJoinColumn.getColumnDefinition());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+ column.setColumnDefinition(COLUMN_DEFINITION);
+
+ assertEquals(COLUMN_DEFINITION, specifiedPkJoinColumn.getColumnDefinition());
+
+ column.setColumnDefinition(null);
+
+ assertNull(specifiedPkJoinColumn.getColumnDefinition());
+
+ typeResource.removeAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+
+ assertEquals(0, javaEntity().specifiedPrimaryKeyJoinColumnsSize());
+ }
+
+ public void testSetColumnDefinition() throws Exception {
+ createTestEntityWithPrimaryKeyJoinColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+ specifiedPkJoinColumn.setColumnDefinition("foo");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+
+ assertEquals("foo", column.getColumnDefinition());
+
+ specifiedPkJoinColumn.setColumnDefinition(null);
+ column = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+ assertNull(column.getColumnDefinition());
+ }
+
+ public void testGetSpecifiedReferencedColumnName() throws Exception {
+ createTestEntityWithPrimaryKeyJoinColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+ assertNull(specifiedPkJoinColumn.getSpecifiedReferencedColumnName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ PrimaryKeyJoinColumn pkJoinColumnResource = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+
+ pkJoinColumnResource.setReferencedColumnName("FOO");
+ specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+ assertEquals("FOO", specifiedPkJoinColumn.getSpecifiedReferencedColumnName());
+ }
+
+ public void testGetDefaultReferencedColumnNameNoSpecifiedPrimaryKeyJoinColumns() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPrimaryKeyJoinColumn pkJoinColumn = javaEntity().defaultPrimaryKeyJoinColumns().next();
+ assertEquals("id", pkJoinColumn.getDefaultReferencedColumnName());
+ }
+
+ public void testGetDefaultReferencedColumnName() throws Exception {
+ createTestEntityWithPrimaryKeyJoinColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPrimaryKeyJoinColumn defaultPkJoinColumn = javaEntity().defaultPrimaryKeyJoinColumns().next();
+ assertEquals("id", defaultPkJoinColumn.getDefaultReferencedColumnName());
+
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+ assertEquals("id", specifiedPkJoinColumn.getDefaultReferencedColumnName());
+
+
+ //remove @Id annotation
+ IPersistentAttribute idAttribute = javaPersistentType().attributeNamed("id");
+ idAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+
+ assertNull(specifiedPkJoinColumn.getDefaultReferencedColumnName());
+ }
+
+ public void testGetReferencedColumnName() throws Exception {
+ createTestEntityWithPrimaryKeyJoinColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ PrimaryKeyJoinColumn pkJoinColumnResource = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+
+ pkJoinColumnResource.setReferencedColumnName("FOO");
+
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+ assertEquals("FOO", specifiedPkJoinColumn.getReferencedColumnName());
+ }
+
+ public void testSetSpecifiedReferencedColumnName() throws Exception {
+ createTestEntityWithPrimaryKeyJoinColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+
+ specifiedPkJoinColumn.setSpecifiedReferencedColumnName("foo");
+ assertEquals("foo", specifiedPkJoinColumn.getSpecifiedReferencedColumnName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ PrimaryKeyJoinColumn pkJoinColumn = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+
+ assertEquals("foo", pkJoinColumn.getReferencedColumnName());
+
+ specifiedPkJoinColumn.setSpecifiedName(null);
+ specifiedPkJoinColumn.setSpecifiedReferencedColumnName(null);
+ assertNull(specifiedPkJoinColumn.getSpecifiedReferencedColumnName());
+ pkJoinColumn = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+ assertNull(pkJoinColumn);
+ }
+
+ public void testIsVirtual() throws Exception {
+ createTestEntityWithPrimaryKeyJoinColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+ assertFalse(specifiedPkJoinColumn.isVirtual());
+
+ IPrimaryKeyJoinColumn defaultPkJoinColumn = javaEntity().defaultPrimaryKeyJoinColumns().next();
+ assertTrue(defaultPkJoinColumn.isVirtual());
+ }
+
+ public void testIsReferencedColumnResolved() throws Exception {
+ createTestEntityWithPrimaryKeyJoinColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+ assertFalse(specifiedPkJoinColumn.isReferencedColumnResolved());
+ }
+
+ public void testDbColumn() throws Exception {
+ createTestEntityWithPrimaryKeyJoinColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+ assertNull(specifiedPkJoinColumn.dbColumn());
+ }
+
+ public void testDbReferencedColumn() throws Exception {
+ createTestEntityWithPrimaryKeyJoinColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+ assertNull(specifiedPkJoinColumn.dbReferencedColumn());
+ }
+
+ public void testDbTable() throws Exception {
+ createTestEntityWithPrimaryKeyJoinColumn();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next();
+ assertNull(specifiedPkJoinColumn.dbTable());
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaQueryHintTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaQueryHintTests.java
new file mode 100644
index 0000000000..3c3a7acdcf
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaQueryHintTests.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.context.base.IEntity;
+import org.eclipse.jpt.core.internal.context.base.IQueryHint;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.NamedQuery;
+import org.eclipse.jpt.core.internal.resource.java.QueryHint;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaQueryHintTests extends ContextModelTestCase
+{
+ private static final String QUERY_NAME = "QUERY_NAME";
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createNamedQueryAnnotation() throws Exception {
+ createQueryHintAnnotation();
+ this.createAnnotationAndMembers("NamedQuery",
+ "String name();" +
+ "String query();" +
+ "QueryHint[] hints() default {};");
+ }
+
+ private void createQueryHintAnnotation() throws Exception {
+ this.createAnnotationAndMembers("QueryHint",
+ "String name();" +
+ "String value();");
+ }
+
+ private IType createTestEntityWithNamedQuery() throws Exception {
+ createEntityAnnotation();
+ createNamedQueryAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.NAMED_QUERY, JPA.QUERY_HINT);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ sb.append("@NamedQuery(name=\"" + QUERY_NAME + "\", hints=@QueryHint())");
+ }
+ });
+ }
+
+
+
+ public JavaQueryHintTests(String name) {
+ super(name);
+ }
+
+ public void testUpdateName() throws Exception {
+ createTestEntityWithNamedQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ IQueryHint queryHint = entity.namedQueries().next().hints().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ QueryHint javaQueryHint = ((NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME)).hints().next();
+
+ assertNull(javaQueryHint.getName());
+ assertNull(queryHint.getName());
+
+ //set name in the resource model, verify context model updated
+ javaQueryHint.setName("foo");
+ assertEquals("foo", javaQueryHint.getName());
+ assertEquals("foo", queryHint.getName());
+
+ //set name to null in the resource model
+ javaQueryHint.setName(null);
+ assertNull(javaQueryHint.getName());
+ assertEquals(0, entity.namedQueries().next().hintsSize());
+ }
+
+ public void testModifyName() throws Exception {
+ createTestEntityWithNamedQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ IQueryHint queryHint = entity.namedQueries().next().hints().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ QueryHint javaQueryhint = ((NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME)).hints().next();
+
+ assertNull(javaQueryhint.getName());
+ assertNull(queryHint.getName());
+
+ //set name in the context model, verify resource model updated
+ queryHint.setName("foo");
+ assertEquals("foo", javaQueryhint.getName());
+ assertEquals("foo", queryHint.getName());
+
+ //set name to null in the context model
+ queryHint.setName(null);
+ assertNull(javaQueryhint.getName());
+ assertNull(queryHint.getName());
+ }
+
+ public void testUpdateValue() throws Exception {
+ createTestEntityWithNamedQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ IQueryHint queryHint = entity.namedQueries().next().hints().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ QueryHint javaQueryhint = ((NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME)).hints().next();
+
+ assertNull(javaQueryhint.getValue());
+ assertNull(queryHint.getValue());
+
+ //set name in the resource model, verify context model updated
+ javaQueryhint.setValue("foo");
+ assertEquals("foo", javaQueryhint.getValue());
+ assertEquals("foo", queryHint.getValue());
+
+ //set name to null in the resource model
+ javaQueryhint.setValue(null);
+ assertNull(javaQueryhint.getValue());
+ assertEquals(0, entity.namedQueries().next().hintsSize());
+ }
+
+ public void testModifyValue() throws Exception {
+ createTestEntityWithNamedQuery();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IEntity entity = javaEntity();
+ IQueryHint queryHint = entity.namedQueries().next().hints().next();
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ QueryHint javaQueryhint = ((NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME)).hints().next();
+
+ assertNull(javaQueryhint.getValue());
+ assertNull(queryHint.getValue());
+
+ //set name in the context model, verify resource model updated
+ queryHint.setValue("foo");
+ assertEquals("foo", javaQueryhint.getValue());
+ assertEquals("foo", queryHint.getValue());
+
+ //set name to null in the context model
+ queryHint.setValue(null);
+ assertNull(javaQueryhint.getValue());
+ assertNull(queryHint.getValue());
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSecondaryTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSecondaryTableTests.java
new file mode 100644
index 0000000000..945dbf2365
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSecondaryTableTests.java
@@ -0,0 +1,496 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.IPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.context.base.ISecondaryTable;
+import org.eclipse.jpt.core.internal.context.java.IJavaPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.SecondaryTable;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaSecondaryTableTests extends ContextModelTestCase
+{
+ private static final String TABLE_NAME = "MY_TABLE";
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createIdAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Id", "");
+ }
+
+ private void createSecondaryTableAnnotation() throws Exception{
+ this.createAnnotationAndMembers("eSecondaryTable",
+ "String name() default \"\"; " +
+ "String catalog() default \"\"; " +
+ "String schema() default \"\";");
+ }
+
+ private void createSecondaryTablesAnnotation() throws Exception {
+ createSecondaryTableAnnotation();
+ this.createAnnotationAndMembers("SecondaryTables", "SecondaryTable[] value();");
+ }
+
+ private IType createTestEntityWithSecondaryTable() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+ createSecondaryTableAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ sb.append("@SecondaryTable(name=\"" + TABLE_NAME + "\")");
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestEntityWithSecondaryTables() throws Exception {
+ createEntityAnnotation();
+ createSecondaryTablesAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ sb.append("@SecondaryTables({@SecondaryTable(name=\"foo\"), @SecondaryTable(name=\"bar\")})");
+ }
+ });
+ }
+
+
+
+
+ public JavaSecondaryTableTests(String name) {
+ super(name);
+ }
+
+ public void testGetSpecifiedName() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ISecondaryTable secondaryTable = javaEntity().secondaryTables().next();
+ assertEquals(TABLE_NAME, secondaryTable.getSpecifiedName());
+ }
+
+ public void testGetDefaultNameNull() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ISecondaryTable secondaryTable = javaEntity().secondaryTables().next();
+ assertNull(secondaryTable.getDefaultName());
+ }
+
+ public void testGetName() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ISecondaryTable secondaryTable = javaEntity().secondaryTables().next();
+ assertEquals(TABLE_NAME, secondaryTable.getName());
+ }
+
+ public void testSetSpecifiedName() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ISecondaryTable secondaryTable = javaEntity().secondaryTables().next();
+ secondaryTable.setSpecifiedName("foo");
+
+ assertEquals("foo", javaEntity().secondaryTables().next().getSpecifiedName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ assertEquals("foo", table.getName());
+ }
+
+ public void testSetSpecifiedNameNull() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ISecondaryTable secondaryTable = javaEntity().secondaryTables().next();
+ secondaryTable.setSpecifiedName(null);
+
+ assertEquals(0, javaEntity().secondaryTablesSize());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ assertNull(typeResource.annotation(JPA.SECONDARY_TABLE));
+ }
+
+ public void testUpdateFromSpecifiedNameChangeInResourceModel() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+ table.setName("foo");
+
+ assertEquals("foo", javaEntity().secondaryTables().next().getSpecifiedName());
+ }
+
+ public void testUpdateFromSpecifiedCatalogChangeInResourceModel() throws Exception {
+ createTestEntityWithSecondaryTables();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ ListIterator<SecondaryTable> secondaryTableResources = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ secondaryTableResources.next().setCatalog("foo");
+ secondaryTableResources.next().setCatalog("bar");
+
+ ListIterator<ISecondaryTable> secondaryTsbles = javaEntity().secondaryTables();
+ assertEquals("foo", secondaryTsbles.next().getSpecifiedCatalog());
+ assertEquals("bar", secondaryTsbles.next().getSpecifiedCatalog());
+ }
+
+ public void testUpdateFromSpecifiedSchemaChangeInResourceModel() throws Exception {
+ createTestEntityWithSecondaryTables();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ ListIterator<SecondaryTable> secondaryTableResources = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ secondaryTableResources.next().setSchema("foo");
+ secondaryTableResources.next().setSchema("bar");
+
+ ListIterator<ISecondaryTable> secondaryTsbles = javaEntity().secondaryTables();
+ assertEquals("foo", secondaryTsbles.next().getSpecifiedSchema());
+ assertEquals("bar", secondaryTsbles.next().getSpecifiedSchema());
+ }
+
+ public void testGetCatalog() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ table.setCatalog("myCatalog");
+
+ assertEquals("myCatalog", javaEntity().secondaryTables().next().getSpecifiedCatalog());
+ assertEquals("myCatalog", javaEntity().secondaryTables().next().getCatalog());
+ }
+
+ public void testGetDefaultCatalog() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().secondaryTables().next().getDefaultCatalog());
+
+ javaEntity().secondaryTables().next().setSpecifiedCatalog("myCatalog");
+
+ assertNull(javaEntity().secondaryTables().next().getDefaultCatalog());
+ }
+
+ public void testSetSpecifiedCatalog() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ ISecondaryTable table = javaEntity().secondaryTables().next();
+ table.setSpecifiedCatalog("myCatalog");
+ table.setSpecifiedName(null);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ SecondaryTable tableResource = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ assertEquals("myCatalog", tableResource.getCatalog());
+
+ table.setSpecifiedCatalog(null);
+ assertNull(typeResource.annotation(JPA.SECONDARY_TABLE));
+ }
+
+ public void testGetSchema() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ SecondaryTable tableResource = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ tableResource.setSchema("mySchema");
+
+ assertEquals("mySchema", javaEntity().secondaryTables().next().getSpecifiedSchema());
+ assertEquals("mySchema", javaEntity().secondaryTables().next().getSchema());
+ }
+
+ public void testGetDefaultSchema() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().secondaryTables().next().getDefaultSchema());
+
+ javaEntity().secondaryTables().next().setSpecifiedSchema("mySchema");
+
+ assertNull(javaEntity().secondaryTables().next().getDefaultSchema());
+ }
+
+ public void testSetSpecifiedSchema() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ ISecondaryTable table = javaEntity().secondaryTables().next();
+ table.setSpecifiedSchema("mySchema");
+ table.setSpecifiedName(null);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ SecondaryTable tableResource = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ assertEquals("mySchema", tableResource.getSchema());
+
+ table.setSpecifiedSchema(null);
+ assertNull(typeResource.annotation(JPA.SECONDARY_TABLE));
+ }
+
+ public void testSpecifiedPrimaryKeyJoinColumns() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next();
+ ListIterator<IJavaPrimaryKeyJoinColumn> specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
+
+ assertFalse(specifiedPkJoinColumns.hasNext());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ SecondaryTable tableResource = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ //add an annotation to the resource model and verify the context model is updated
+ PrimaryKeyJoinColumn pkJoinColumn = tableResource.addPkJoinColumn(0);
+ pkJoinColumn.setName("FOO");
+ specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("FOO", specifiedPkJoinColumns.next().getName());
+ assertFalse(specifiedPkJoinColumns.hasNext());
+
+ pkJoinColumn = tableResource.addPkJoinColumn(0);
+ pkJoinColumn.setName("BAR");
+ specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAR", specifiedPkJoinColumns.next().getName());
+ assertEquals("FOO", specifiedPkJoinColumns.next().getName());
+ assertFalse(specifiedPkJoinColumns.hasNext());
+
+
+ //move an annotation to the resource model and verify the context model is updated
+ tableResource.movePkJoinColumn(1, 0);
+ specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("FOO", specifiedPkJoinColumns.next().getName());
+ assertEquals("BAR", specifiedPkJoinColumns.next().getName());
+ assertFalse(specifiedPkJoinColumns.hasNext());
+
+ tableResource.removePkJoinColumn(0);
+ specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAR", specifiedPkJoinColumns.next().getName());
+ assertFalse(specifiedPkJoinColumns.hasNext());
+
+ tableResource.removePkJoinColumn(0);
+ specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertFalse(specifiedPkJoinColumns.hasNext());
+ }
+
+ public void testSpecifiedPrimaryKeyJoinColumnsSize() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next();
+ assertEquals(0, secondaryTable.specifiedPrimaryKeyJoinColumnsSize());
+
+ secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
+ secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAR");
+ secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ");
+
+ assertEquals(3, secondaryTable.specifiedPrimaryKeyJoinColumnsSize());
+ }
+
+ public void testAddSpecifiedPrimaryKeyJoinColumn() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next();
+ secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
+ secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAR");
+ secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ");
+
+ Iterator<IPrimaryKeyJoinColumn> specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAZ", specifiedPkJoinColumns.next().getName());
+ assertEquals("BAR", specifiedPkJoinColumns.next().getName());
+ assertEquals("FOO", specifiedPkJoinColumns.next().getName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ SecondaryTable tableResource = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+ Iterator<PrimaryKeyJoinColumn> pkJoinColumns = tableResource.pkJoinColumns();
+
+ assertEquals("BAZ", pkJoinColumns.next().getName());
+ assertEquals("BAR", pkJoinColumns.next().getName());
+ assertEquals("FOO", pkJoinColumns.next().getName());
+ assertFalse(pkJoinColumns.hasNext());
+ }
+
+ public void testAddSpecifiedPrimaryKeyJoinColumn2() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next();
+
+ secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
+ secondaryTable.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
+ secondaryTable.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
+
+ Iterator<IPrimaryKeyJoinColumn> specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("FOO", specifiedPkJoinColumns.next().getName());
+ assertEquals("BAR", specifiedPkJoinColumns.next().getName());
+ assertEquals("BAZ", specifiedPkJoinColumns.next().getName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ SecondaryTable tableResource = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+ Iterator<PrimaryKeyJoinColumn> pkJoinColumns = tableResource.pkJoinColumns();
+
+ assertEquals("FOO", pkJoinColumns.next().getName());
+ assertEquals("BAR", pkJoinColumns.next().getName());
+ assertEquals("BAZ", pkJoinColumns.next().getName());
+ assertFalse(pkJoinColumns.hasNext());
+ }
+ public void testRemoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next();
+
+ secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
+ secondaryTable.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
+ secondaryTable.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ SecondaryTable tableResource = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ assertEquals(3, tableResource.pkJoinColumnsSize());
+
+ secondaryTable.removeSpecifiedPrimaryKeyJoinColumn(1);
+
+ Iterator<PrimaryKeyJoinColumn> pkJoinColumnResources = tableResource.pkJoinColumns();
+ assertEquals("FOO", pkJoinColumnResources.next().getName());
+ assertEquals("BAZ", pkJoinColumnResources.next().getName());
+ assertFalse(pkJoinColumnResources.hasNext());
+
+ Iterator<IPrimaryKeyJoinColumn> pkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("FOO", pkJoinColumns.next().getName());
+ assertEquals("BAZ", pkJoinColumns.next().getName());
+ assertFalse(pkJoinColumns.hasNext());
+
+
+ secondaryTable.removeSpecifiedPrimaryKeyJoinColumn(1);
+ pkJoinColumnResources = tableResource.pkJoinColumns();
+ assertEquals("FOO", pkJoinColumnResources.next().getName());
+ assertFalse(pkJoinColumnResources.hasNext());
+
+ pkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("FOO", pkJoinColumns.next().getName());
+ assertFalse(pkJoinColumns.hasNext());
+
+
+ secondaryTable.removeSpecifiedPrimaryKeyJoinColumn(0);
+ pkJoinColumnResources = tableResource.pkJoinColumns();
+ assertFalse(pkJoinColumnResources.hasNext());
+ pkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertFalse(pkJoinColumns.hasNext());
+
+ assertEquals(0, tableResource.pkJoinColumnsSize());
+ }
+
+ public void testMoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next();
+ secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
+ secondaryTable.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
+ secondaryTable.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
+
+ Iterator<IPrimaryKeyJoinColumn> specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("FOO", specifiedPkJoinColumns.next().getName());
+ assertEquals("BAR", specifiedPkJoinColumns.next().getName());
+ assertEquals("BAZ", specifiedPkJoinColumns.next().getName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ SecondaryTable tableResource = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+ Iterator<PrimaryKeyJoinColumn> pkJoinColumns = tableResource.pkJoinColumns();
+
+ assertEquals("FOO", pkJoinColumns.next().getName());
+ assertEquals("BAR", pkJoinColumns.next().getName());
+ assertEquals("BAZ", pkJoinColumns.next().getName());
+
+
+ secondaryTable.moveSpecifiedPrimaryKeyJoinColumn(2, 0);
+ pkJoinColumns = tableResource.pkJoinColumns();
+
+ assertEquals("BAR", pkJoinColumns.next().getName());
+ assertEquals("BAZ", pkJoinColumns.next().getName());
+ assertEquals("FOO", pkJoinColumns.next().getName());
+ }
+
+ public void testPrimaryKeyJoinColumnGetDefaultName() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next();
+ IPrimaryKeyJoinColumn defaultPkJoinColumn = secondaryTable.defaultPrimaryKeyJoinColumns().next();
+ assertEquals("id", defaultPkJoinColumn.getDefaultName());
+
+
+ //remove @Id annotation
+ IPersistentAttribute idAttribute = javaPersistentType().attributeNamed("id");
+ idAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+
+ assertNull(defaultPkJoinColumn.getDefaultName());
+ }
+ public void testPrimaryKeyJoinColumnGetDefaultReferencedColumnName() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next();
+ IPrimaryKeyJoinColumn defaultPkJoinColumn = secondaryTable.defaultPrimaryKeyJoinColumns().next();
+ assertEquals("id", defaultPkJoinColumn.getDefaultReferencedColumnName());
+
+ //remove @Id annotation
+ IPersistentAttribute idAttribute = javaPersistentType().attributeNamed("id");
+ idAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+
+ assertNull(defaultPkJoinColumn.getDefaultReferencedColumnName());
+ }
+
+ public void testPrimaryKeyJoinColumnIsVirtual() throws Exception {
+ createTestEntityWithSecondaryTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next();
+
+ secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0);
+ IPrimaryKeyJoinColumn specifiedPkJoinColumn = secondaryTable.specifiedPrimaryKeyJoinColumns().next();
+ assertFalse(specifiedPkJoinColumn.isVirtual());
+
+ IPrimaryKeyJoinColumn defaultPkJoinColumn = secondaryTable.defaultPrimaryKeyJoinColumns().next();
+ assertTrue(defaultPkJoinColumn.isVirtual());
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSequenceGeneratorTests.java
new file mode 100644
index 0000000000..0d0fb43b08
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSequenceGeneratorTests.java
@@ -0,0 +1,270 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.context.base.IGenerator;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.ISequenceGenerator;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.SequenceGenerator;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaSequenceGeneratorTests extends ContextModelTestCase
+{
+ private static final String SEQUENCE_GENERATOR_NAME = "MY_SEQUENCE_GENERATOR";
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createSequenceGeneratorAnnotation() throws Exception{
+ this.createAnnotationAndMembers("SequenceGenerator",
+ "String name();" +
+ "String sequenceName() default \"\"; " +
+ "int initialValue() default 0; " +
+ "int allocationSize() default 50;");
+ }
+
+ private IType createTestEntityWithSequenceGenerator() throws Exception {
+ createEntityAnnotation();
+ createSequenceGeneratorAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.SEQUENCE_GENERATOR, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id").append(CR);
+ sb.append("@SequenceGenerator(name=\"" + SEQUENCE_GENERATOR_NAME + "\")");
+ }
+ });
+ }
+
+ public JavaSequenceGeneratorTests(String name) {
+ super(name);
+ }
+
+ public void testGetName() throws Exception {
+ createTestEntityWithSequenceGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ assertEquals(SEQUENCE_GENERATOR_NAME, idMapping.getSequenceGenerator().getName());
+
+ //change resource model sequenceGenerator name, verify the context model is updated
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+
+ sequenceGenerator.setName("foo");
+
+ assertEquals("foo", idMapping.getSequenceGenerator().getName());
+ }
+
+ public void testSetName() throws Exception {
+ createTestEntityWithSequenceGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ assertEquals(SEQUENCE_GENERATOR_NAME, idMapping.getSequenceGenerator().getName());
+
+ idMapping.getSequenceGenerator().setName("foo");
+
+ assertEquals("foo", idMapping.getSequenceGenerator().getName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+
+ assertEquals("foo", sequenceGenerator.getName());
+ }
+
+ public void testSetSpecifiedNameNull() throws Exception {
+ createTestEntityWithSequenceGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ assertEquals(SEQUENCE_GENERATOR_NAME, idMapping.getSequenceGenerator().getName());
+
+ idMapping.getSequenceGenerator().setName(null);
+
+ assertNull(idMapping.getSequenceGenerator());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+
+ assertNull(sequenceGenerator);
+ }
+
+ public void testGetInitialValue() throws Exception {
+ createTestEntityWithSequenceGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertEquals(ISequenceGenerator.DEFAULT_INITIAL_VALUE, idMapping.getSequenceGenerator().getInitialValue());
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+
+ sequenceGenerator.setInitialValue(Integer.valueOf(82));
+
+ assertEquals(Integer.valueOf(82), idMapping.getSequenceGenerator().getInitialValue());
+ assertEquals(Integer.valueOf(82), idMapping.getSequenceGenerator().getSpecifiedInitialValue());
+ }
+
+ public void testGetDefaultInitialValue() throws Exception {
+ createTestEntityWithSequenceGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertEquals(ISequenceGenerator.DEFAULT_INITIAL_VALUE, idMapping.getSequenceGenerator().getDefaultInitialValue());
+
+ idMapping.getSequenceGenerator().setSpecifiedInitialValue(Integer.valueOf(82));
+
+ assertEquals(ISequenceGenerator.DEFAULT_INITIAL_VALUE, idMapping.getSequenceGenerator().getDefaultInitialValue());
+ assertEquals(Integer.valueOf(82), idMapping.getSequenceGenerator().getSpecifiedInitialValue());
+ }
+
+ public void testSetSpecifiedInitialValue() throws Exception {
+ createTestEntityWithSequenceGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ idMapping.getSequenceGenerator().setSpecifiedInitialValue(Integer.valueOf(20));
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+
+ assertEquals(Integer.valueOf(20), sequenceGenerator.getInitialValue());
+
+ idMapping.getSequenceGenerator().setName(null);
+ idMapping.getSequenceGenerator().setSpecifiedInitialValue(null);
+ assertNull(attributeResource.annotation(JPA.SEQUENCE_GENERATOR));
+ }
+
+ public void testGetAllocationSize() throws Exception {
+ createTestEntityWithSequenceGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertEquals(IGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getSequenceGenerator().getAllocationSize());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+
+ sequenceGenerator.setAllocationSize(Integer.valueOf(20));
+
+ assertEquals(Integer.valueOf(20), idMapping.getSequenceGenerator().getAllocationSize());
+ assertEquals(Integer.valueOf(20), idMapping.getSequenceGenerator().getSpecifiedAllocationSize());
+ }
+
+ public void testGetDefaultAllocationSize() throws Exception {
+ createTestEntityWithSequenceGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertEquals(IGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getSequenceGenerator().getDefaultAllocationSize());
+
+ idMapping.getSequenceGenerator().setSpecifiedAllocationSize(Integer.valueOf(20));
+
+ assertEquals(IGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getSequenceGenerator().getDefaultAllocationSize());
+ assertEquals(Integer.valueOf(20), idMapping.getSequenceGenerator().getSpecifiedAllocationSize());
+ }
+
+ public void testSetSpecifiedAllocationSize() throws Exception {
+ createTestEntityWithSequenceGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ idMapping.getSequenceGenerator().setSpecifiedAllocationSize(Integer.valueOf(25));
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+
+ assertEquals(Integer.valueOf(25), sequenceGenerator.getAllocationSize());
+
+ idMapping.getSequenceGenerator().setName(null);
+ idMapping.getSequenceGenerator().setSpecifiedAllocationSize(null);
+ assertNull(attributeResource.annotation(JPA.SEQUENCE_GENERATOR));
+ }
+
+
+
+ public void testGetSequenceName() throws Exception {
+ createTestEntityWithSequenceGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertNull(idMapping.getSequenceGenerator().getSequenceName());
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+
+ sequenceGenerator.setSequenceName("mySequenceName");
+
+ assertEquals("mySequenceName", idMapping.getSequenceGenerator().getSequenceName());
+ assertEquals("mySequenceName", idMapping.getSequenceGenerator().getSpecifiedSequenceName());
+ }
+
+ public void testGetDefaultSequenceName() throws Exception {
+ createTestEntityWithSequenceGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertNull(idMapping.getSequenceGenerator().getDefaultSequenceName());
+
+ idMapping.getSequenceGenerator().setSpecifiedSequenceName("mySequenceName");
+
+ assertNull(idMapping.getSequenceGenerator().getDefaultSequenceName());
+ assertEquals("mySequenceName", idMapping.getSequenceGenerator().getSpecifiedSequenceName());
+ }
+
+ public void testSetSpecifiedSequenceName() throws Exception {
+ createTestEntityWithSequenceGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ idMapping.getSequenceGenerator().setSpecifiedSequenceName("mySequenceName");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+
+ assertEquals("mySequenceName", sequenceGenerator.getSequenceName());
+
+ idMapping.getSequenceGenerator().setName(null);
+ idMapping.getSequenceGenerator().setSpecifiedSequenceName(null);
+ assertNull(attributeResource.annotation(JPA.SEQUENCE_GENERATOR));
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java
new file mode 100644
index 0000000000..7ccaab6009
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java
@@ -0,0 +1,469 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.context.base.IGenerator;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.ITableGenerator;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.TableGenerator;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaTableGeneratorTests extends ContextModelTestCase
+{
+ private static final String TABLE_GENERATOR_NAME = "MY_TABLE_GENERATOR";
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createTableGeneratorAnnotation() throws Exception{
+ this.createAnnotationAndMembers("TableGenerator",
+ "String name(); " +
+ "String table() default \"\"; " +
+ "String catalog() default \"\"; " +
+ "String schema() default \"\";" +
+ "String pkColumnName() default \"\"; " +
+ "String valueColumnName() default \"\"; " +
+ "String pkColumnValue() default \"\"; " +
+ "int initialValue() default 0; " +
+ "int allocationSize() default 50; " +
+ "UniqueConstraint[] uniqueConstraints() default {};");
+ }
+
+ private IType createTestEntityWithTableGenerator() throws Exception {
+ createEntityAnnotation();
+ createTableGeneratorAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.TABLE_GENERATOR, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id").append(CR);
+ sb.append("@TableGenerator(name=\"" + TABLE_GENERATOR_NAME + "\")");
+ }
+ });
+ }
+
+ public JavaTableGeneratorTests(String name) {
+ super(name);
+ }
+
+ public void testGetName() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ assertEquals(TABLE_GENERATOR_NAME, idMapping.getTableGenerator().getName());
+
+ //change resource model tableGenerator name, verify the context model is updated
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ tableGenerator.setName("foo");
+
+ assertEquals("foo", idMapping.getTableGenerator().getName());
+ }
+
+ public void testSetName() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ assertEquals(TABLE_GENERATOR_NAME, idMapping.getTableGenerator().getName());
+
+ idMapping.getTableGenerator().setName("foo");
+
+ assertEquals("foo", idMapping.getTableGenerator().getName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ assertEquals("foo", tableGenerator.getName());
+ }
+
+ public void testSetSpecifiedNameNull() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ assertEquals(TABLE_GENERATOR_NAME, idMapping.getTableGenerator().getName());
+
+ idMapping.getTableGenerator().setName(null);
+
+ assertNull(idMapping.getTableGenerator());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ assertNull(tableGenerator);
+ }
+
+ public void testGetCatalog() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertNull(idMapping.getTableGenerator().getCatalog());
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ tableGenerator.setCatalog("myCatalog");
+
+ assertEquals("myCatalog", idMapping.getTableGenerator().getCatalog());
+ assertEquals("myCatalog", idMapping.getTableGenerator().getSpecifiedCatalog());
+ }
+
+ public void testGetDefaultCatalog() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertNull(idMapping.getTableGenerator().getDefaultCatalog());
+
+ idMapping.getTableGenerator().setSpecifiedCatalog("myCatalog");
+
+ assertNull(idMapping.getTableGenerator().getDefaultCatalog());
+ assertEquals("myCatalog", idMapping.getTableGenerator().getSpecifiedCatalog());
+ }
+
+ public void testSetSpecifiedCatalog() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ idMapping.getTableGenerator().setSpecifiedCatalog("myCatalog");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ assertEquals("myCatalog", tableGenerator.getCatalog());
+
+ idMapping.getTableGenerator().setName(null);
+ idMapping.getTableGenerator().setSpecifiedCatalog(null);
+ assertNull(attributeResource.annotation(JPA.TABLE_GENERATOR));
+ }
+
+ public void testGetSchema() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertNull(idMapping.getTableGenerator().getSchema());
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ tableGenerator.setSchema("mySchema");
+
+ assertEquals("mySchema", idMapping.getTableGenerator().getSchema());
+ assertEquals("mySchema", idMapping.getTableGenerator().getSpecifiedSchema());
+ }
+
+ public void testGetDefaultSchema() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertNull(idMapping.getTableGenerator().getDefaultSchema());
+
+ idMapping.getTableGenerator().setSpecifiedSchema("mySchema");
+
+ assertNull(idMapping.getTableGenerator().getDefaultSchema());
+ assertEquals("mySchema", idMapping.getTableGenerator().getSpecifiedSchema());
+ }
+
+ public void testSetSpecifiedSchema() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ idMapping.getTableGenerator().setSpecifiedSchema("mySchema");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ assertEquals("mySchema", tableGenerator.getSchema());
+
+ idMapping.getTableGenerator().setName(null);
+ idMapping.getTableGenerator().setSpecifiedSchema(null);
+ assertNull(attributeResource.annotation(JPA.TABLE_GENERATOR));
+ }
+
+ public void testGetPkColumnName() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertNull(idMapping.getTableGenerator().getPkColumnName());
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ tableGenerator.setPkColumnName("myPkColumnName");
+
+ assertEquals("myPkColumnName", idMapping.getTableGenerator().getPkColumnName());
+ assertEquals("myPkColumnName", idMapping.getTableGenerator().getSpecifiedPkColumnName());
+ }
+
+ public void testGetDefaultPkColumnName() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertNull(idMapping.getTableGenerator().getDefaultPkColumnName());
+
+ idMapping.getTableGenerator().setSpecifiedPkColumnName("myPkColumnName");
+
+ assertNull(idMapping.getTableGenerator().getDefaultPkColumnName());
+ assertEquals("myPkColumnName", idMapping.getTableGenerator().getSpecifiedPkColumnName());
+ }
+
+ public void testSetSpecifiedPkColumnName() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ idMapping.getTableGenerator().setSpecifiedPkColumnName("myPkColumnName");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ assertEquals("myPkColumnName", tableGenerator.getPkColumnName());
+
+ idMapping.getTableGenerator().setName(null);
+ idMapping.getTableGenerator().setSpecifiedPkColumnName(null);
+ assertNull(attributeResource.annotation(JPA.TABLE_GENERATOR));
+ }
+
+ public void testGetValueColumnName() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertNull(idMapping.getTableGenerator().getValueColumnName());
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ tableGenerator.setValueColumnName("myValueColumnName");
+
+ assertEquals("myValueColumnName", idMapping.getTableGenerator().getValueColumnName());
+ assertEquals("myValueColumnName", idMapping.getTableGenerator().getSpecifiedValueColumnName());
+ }
+
+ public void testGetDefaultValueColumnName() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertNull(idMapping.getTableGenerator().getDefaultValueColumnName());
+
+ idMapping.getTableGenerator().setSpecifiedValueColumnName("myValueColumnName");
+
+ assertNull(idMapping.getTableGenerator().getDefaultValueColumnName());
+ assertEquals("myValueColumnName", idMapping.getTableGenerator().getSpecifiedValueColumnName());
+ }
+
+ public void testSetSpecifiedValueColumnName() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ idMapping.getTableGenerator().setSpecifiedValueColumnName("myValueColumnName");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ assertEquals("myValueColumnName", tableGenerator.getValueColumnName());
+
+ idMapping.getTableGenerator().setName(null);
+ idMapping.getTableGenerator().setSpecifiedValueColumnName(null);
+ assertNull(attributeResource.annotation(JPA.TABLE_GENERATOR));
+ }
+
+ public void testGetPkColumnValue() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertNull(idMapping.getTableGenerator().getPkColumnValue());
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ tableGenerator.setPkColumnValue("myPkColumnValue");
+
+ assertEquals("myPkColumnValue", idMapping.getTableGenerator().getPkColumnValue());
+ assertEquals("myPkColumnValue", idMapping.getTableGenerator().getSpecifiedPkColumnValue());
+ }
+
+ public void testGetDefaultPkColumnValue() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertNull(idMapping.getTableGenerator().getDefaultPkColumnValue());
+
+ idMapping.getTableGenerator().setSpecifiedPkColumnValue("myPkColumnValue");
+
+ assertNull(idMapping.getTableGenerator().getDefaultPkColumnValue());
+ assertEquals("myPkColumnValue", idMapping.getTableGenerator().getSpecifiedPkColumnValue());
+ }
+
+ public void testSetSpecifiedPkColumnValue() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ idMapping.getTableGenerator().setSpecifiedPkColumnValue("myPkColumnValue");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ assertEquals("myPkColumnValue", tableGenerator.getPkColumnValue());
+
+ idMapping.getTableGenerator().setName(null);
+ idMapping.getTableGenerator().setSpecifiedPkColumnValue(null);
+ assertNull(attributeResource.annotation(JPA.TABLE_GENERATOR));
+ }
+
+ public void testGetInitialValue() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertEquals(ITableGenerator.DEFAULT_INITIAL_VALUE, idMapping.getTableGenerator().getInitialValue());
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ tableGenerator.setInitialValue(Integer.valueOf(82));
+
+ assertEquals(Integer.valueOf(82), idMapping.getTableGenerator().getInitialValue());
+ assertEquals(Integer.valueOf(82), idMapping.getTableGenerator().getSpecifiedInitialValue());
+ }
+
+ public void testGetDefaultInitialValue() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertEquals(ITableGenerator.DEFAULT_INITIAL_VALUE, idMapping.getTableGenerator().getDefaultInitialValue());
+
+ idMapping.getTableGenerator().setSpecifiedInitialValue(Integer.valueOf(82));
+
+ assertEquals(ITableGenerator.DEFAULT_INITIAL_VALUE, idMapping.getTableGenerator().getDefaultInitialValue());
+ assertEquals(Integer.valueOf(82), idMapping.getTableGenerator().getSpecifiedInitialValue());
+ }
+
+ public void testSetSpecifiedInitialValue() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ idMapping.getTableGenerator().setSpecifiedInitialValue(Integer.valueOf(20));
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ assertEquals(Integer.valueOf(20), tableGenerator.getInitialValue());
+
+ idMapping.getTableGenerator().setName(null);
+ idMapping.getTableGenerator().setSpecifiedInitialValue(null);
+ assertNull(attributeResource.annotation(JPA.TABLE_GENERATOR));
+ }
+
+ public void testGetAllocationSize() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertEquals(IGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getTableGenerator().getAllocationSize());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ tableGenerator.setAllocationSize(Integer.valueOf(20));
+
+ assertEquals(Integer.valueOf(20), idMapping.getTableGenerator().getAllocationSize());
+ assertEquals(Integer.valueOf(20), idMapping.getTableGenerator().getSpecifiedAllocationSize());
+ }
+
+ public void testGetDefaultAllocationSize() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+
+ assertEquals(IGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getTableGenerator().getDefaultAllocationSize());
+
+ idMapping.getTableGenerator().setSpecifiedAllocationSize(Integer.valueOf(20));
+
+ assertEquals(IGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getTableGenerator().getDefaultAllocationSize());
+ assertEquals(Integer.valueOf(20), idMapping.getTableGenerator().getSpecifiedAllocationSize());
+ }
+
+ public void testSetSpecifiedAllocationSize() throws Exception {
+ createTestEntityWithTableGenerator();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping();
+ idMapping.getTableGenerator().setSpecifiedAllocationSize(Integer.valueOf(25));
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ assertEquals(Integer.valueOf(25), tableGenerator.getAllocationSize());
+
+ idMapping.getTableGenerator().setName(null);
+ idMapping.getTableGenerator().setSpecifiedAllocationSize(null);
+ assertNull(attributeResource.annotation(JPA.TABLE_GENERATOR));
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java
new file mode 100644
index 0000000000..3ae2dcbacc
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java
@@ -0,0 +1,338 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.ITable;
+import org.eclipse.jpt.core.internal.context.java.IJavaEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.Table;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaTableTests extends ContextModelTestCase
+{
+ private static final String TABLE_NAME = "MY_TABLE";
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+ private void createTableAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Table",
+ "String name() default \"\"; " +
+ "String catalog() default \"\"; " +
+ "String schema() default \"\";");
+ }
+
+
+ private IType createTestEntity() throws Exception {
+ createEntityAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ });
+ }
+
+ private IType createTestEntityWithTable() throws Exception {
+ createEntityAnnotation();
+ createTableAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.TABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ sb.append("@Table(name=\"" + TABLE_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestSubType() throws Exception {
+ return this.createTestType(PACKAGE_NAME, "AnnotationTestTypeChild.java", "AnnotationTestTypeChild", new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendExtendsImplementsTo(StringBuilder sb) {
+ sb.append("extends " + TYPE_NAME + " ");
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ });
+ }
+
+
+
+ public JavaTableTests(String name) {
+ super(name);
+ }
+
+ public void testGetSpecifiedNameNull() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getTable().getSpecifiedName());
+ }
+
+ public void testGetSpecifiedName() throws Exception {
+ createTestEntityWithTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(TABLE_NAME, javaEntity().getTable().getSpecifiedName());
+ }
+
+ public void testGetDefaultNameSpecifiedNameNull() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(TYPE_NAME, javaEntity().getTable().getDefaultName());
+ }
+
+ public void testGetDefaultName() throws Exception {
+ createTestEntityWithTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(TYPE_NAME, javaEntity().getTable().getDefaultName());
+
+ //test that setting the java entity name will change the table default name
+ javaEntity().setSpecifiedName("foo");
+ assertEquals("foo", javaEntity().getTable().getDefaultName());
+ }
+
+ public void testGetDefaultNameSingleTableInheritance() throws Exception {
+ createTestEntity();
+ createTestSubType();
+
+ addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNotSame(javaEntity(), javaEntity().rootEntity());
+ assertEquals(TYPE_NAME, javaEntity().getTable().getDefaultName());
+ assertEquals(TYPE_NAME, javaEntity().rootEntity().getTable().getDefaultName());
+
+ //test that setting the root java entity name will change the table default name of the child
+ javaEntity().rootEntity().setSpecifiedName("foo");
+ assertEquals("foo", javaEntity().getTable().getDefaultName());
+ }
+
+ public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+
+ createTestEntity();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ IJavaEntity javaEntity = xmlEntity.javaEntity();
+
+ assertNull(javaEntity.getTable().getDefaultSchema());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema("FOO");
+ assertEquals("FOO", javaEntity.getTable().getDefaultSchema());
+
+ xmlEntity.entityMappings().setSpecifiedSchema("BAR");
+ assertEquals("BAR", javaEntity.getTable().getDefaultSchema());
+
+ xmlEntity.getTable().setSpecifiedSchema("XML_SCHEMA");
+ assertEquals("BAR", javaEntity.getTable().getDefaultSchema());
+
+ entityMappings().removeXmlPersistentType(0);
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ //default schema taken from persistence-unit-defaults not entity-mappings since the entity is not in an orm.xml file
+ assertEquals("FOO", javaEntity().getTable().getDefaultSchema());
+ }
+
+ public void testGetNameSpecifiedNameNull() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(TYPE_NAME, javaEntity().getTable().getName());
+ }
+
+ public void testGetName() throws Exception {
+ createTestEntityWithTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertEquals(TABLE_NAME, javaEntity().getTable().getName());
+ }
+
+ public void testSetSpecifiedName() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().getTable().setSpecifiedName("foo");
+
+ assertEquals("foo", javaEntity().getTable().getSpecifiedName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+
+ assertEquals("foo", table.getName());
+ }
+
+ public void testSetSpecifiedNameNull() throws Exception {
+ createTestEntityWithTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ javaEntity().getTable().setSpecifiedName(null);
+
+ assertNull(javaEntity().getTable().getSpecifiedName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+
+ assertNull(table);
+ }
+
+ public void testUpdateFromSpecifiedNameChangeInResourceModel() throws Exception {
+ createTestEntityWithTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+ table.setName("foo");
+
+ assertEquals("foo", javaEntity().getTable().getSpecifiedName());
+
+ typeResource.removeAnnotation(JPA.TABLE);
+ assertNull(javaEntity().getTable().getSpecifiedName());
+ }
+
+ public void testGetCatalog() throws Exception {
+ createTestEntityWithTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+
+ table.setCatalog("myCatalog");
+
+ assertEquals("myCatalog", javaEntity().getTable().getSpecifiedCatalog());
+ assertEquals("myCatalog", javaEntity().getTable().getCatalog());
+ }
+
+ public void testGetDefaultCatalog() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getTable().getDefaultCatalog());
+
+ javaEntity().getTable().setSpecifiedCatalog("myCatalog");
+
+ assertNull(javaEntity().getTable().getDefaultCatalog());
+ }
+
+ public void testUpdateDefaultCatalogFromPersistenceUnitDefaults() throws Exception {
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+
+ createTestEntity();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ IJavaEntity javaEntity = xmlEntity.javaEntity();
+
+ assertNull(javaEntity.getTable().getDefaultCatalog());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("FOO");
+ assertEquals("FOO", javaEntity.getTable().getDefaultCatalog());
+
+ xmlEntity.entityMappings().setSpecifiedCatalog("BAR");
+ assertEquals("BAR", javaEntity.getTable().getDefaultCatalog());
+
+ xmlEntity.getTable().setSpecifiedCatalog("XML_CATALOG");
+ assertEquals("BAR", javaEntity.getTable().getDefaultCatalog());
+
+ entityMappings().removeXmlPersistentType(0);
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ //default catalog taken from persistence-unite-defaults not entity-mappings since the entity is not in an orm.xml file
+ assertEquals("FOO", javaEntity().getTable().getDefaultCatalog());
+ }
+
+ public void testSetSpecifiedCatalog() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ ITable table = javaEntity().getTable();
+ table.setSpecifiedCatalog("myCatalog");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ Table tableResource = (Table) typeResource.annotation(JPA.TABLE);
+
+ assertEquals("myCatalog", tableResource.getCatalog());
+
+ table.setSpecifiedCatalog(null);
+ assertNull(typeResource.annotation(JPA.TABLE));
+ }
+
+ public void testGetSchema() throws Exception {
+ createTestEntityWithTable();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+
+ table.setSchema("mySchema");
+
+ assertEquals("mySchema", javaEntity().getTable().getSpecifiedSchema());
+ assertEquals("mySchema", javaEntity().getTable().getSchema());
+ }
+
+ public void testGetDefaultSchema() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ assertNull(javaEntity().getTable().getDefaultSchema());
+
+ javaEntity().getTable().setSpecifiedSchema("mySchema");
+
+ assertNull(javaEntity().getTable().getDefaultSchema());
+ }
+
+ public void testSetSpecifiedSchema() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ ITable table = javaEntity().getTable();
+ table.setSpecifiedSchema("mySchema");
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ Table tableResource = (Table) typeResource.annotation(JPA.TABLE);
+
+ assertEquals("mySchema", tableResource.getSchema());
+
+ table.setSpecifiedSchema(null);
+ assertNull(typeResource.annotation(JPA.TABLE));
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTransientMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTransientMappingTests.java
new file mode 100644
index 0000000000..9883e34329
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTransientMappingTests.java
@@ -0,0 +1,259 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
+import org.eclipse.jpt.core.internal.context.base.IVersionMapping;
+import org.eclipse.jpt.core.internal.resource.java.Basic;
+import org.eclipse.jpt.core.internal.resource.java.Embedded;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.java.Id;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.java.ManyToOne;
+import org.eclipse.jpt.core.internal.resource.java.OneToMany;
+import org.eclipse.jpt.core.internal.resource.java.OneToOne;
+import org.eclipse.jpt.core.internal.resource.java.Transient;
+import org.eclipse.jpt.core.internal.resource.java.Version;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaTransientMappingTests extends ContextModelTestCase
+{
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createTransientAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Transient", "");
+ }
+
+ private IType createTestEntityWithTransientMapping() throws Exception {
+ createEntityAnnotation();
+ createTransientAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.TRANSIENT);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Transient").append(CR);
+ }
+ });
+ }
+
+ public JavaTransientMappingTests(String name) {
+ super(name);
+ }
+
+ public void testMorphToBasicMapping() throws Exception {
+ createTestEntityWithTransientMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping();
+ assertFalse(transientMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IBasicMapping);
+ assertFalse(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ }
+
+ public void testMorphToDefault() throws Exception {
+ createTestEntityWithTransientMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping();
+ assertFalse(transientMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IBasicMapping);
+ assertTrue(persistentAttribute.getMapping().isDefault());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ }
+
+ public void testMorphToVersionMapping() throws Exception {
+ createTestEntityWithTransientMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping();
+ assertFalse(transientMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IVersionMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddedMapping() throws Exception {
+ createTestEntityWithTransientMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping();
+ assertFalse(transientMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ }
+
+ public void testMorphToIdMapping() throws Exception {
+ createTestEntityWithTransientMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping();
+ assertFalse(transientMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IIdMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddedIdMapping() throws Exception {
+ createTestEntityWithTransientMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping();
+ assertFalse(transientMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ }
+
+ public void testMorphToOneToOneMapping() throws Exception {
+ createTestEntityWithTransientMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping();
+ assertFalse(transientMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ }
+
+ public void testMorphToOneToManyMapping() throws Exception {
+ createTestEntityWithTransientMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping();
+ assertFalse(transientMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ }
+
+ public void testMorphToManyToOneMapping() throws Exception {
+ createTestEntityWithTransientMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping();
+ assertFalse(transientMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ }
+
+ public void testMorphToManyToManyMapping() throws Exception {
+ createTestEntityWithTransientMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping();
+ assertFalse(transientMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ }
+
+ public void testTransientMapping() throws Exception {
+ createTestEntityWithTransientMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNotNull(transientMapping);
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java
new file mode 100644
index 0000000000..535630e6ec
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java
@@ -0,0 +1,413 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.context.base.IBasicMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.base.IIdMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.base.ITransientMapping;
+import org.eclipse.jpt.core.internal.context.base.IVersionMapping;
+import org.eclipse.jpt.core.internal.context.base.TemporalType;
+import org.eclipse.jpt.core.internal.resource.java.Basic;
+import org.eclipse.jpt.core.internal.resource.java.Column;
+import org.eclipse.jpt.core.internal.resource.java.Embedded;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.java.Id;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.java.ManyToOne;
+import org.eclipse.jpt.core.internal.resource.java.OneToMany;
+import org.eclipse.jpt.core.internal.resource.java.OneToOne;
+import org.eclipse.jpt.core.internal.resource.java.Temporal;
+import org.eclipse.jpt.core.internal.resource.java.Transient;
+import org.eclipse.jpt.core.internal.resource.java.Version;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaVersionMappingTests extends ContextModelTestCase
+{
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createVersionAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Version", "");
+ }
+
+ private void createTemporalAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Temporal", "TemporalType value();");
+ }
+
+ private IType createTestEntityWithVersionMapping() throws Exception {
+ createEntityAnnotation();
+ createVersionAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.VERSION);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Version").append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithTemporal() throws Exception {
+ createEntityAnnotation();
+ createTemporalAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.VERSION, JPA.TEMPORAL, JPA.TEMPORAL_TYPE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity").append(CR);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Version").append(CR);
+ sb.append("@Temporal(TemporalType.TIMESTAMP)").append(CR);
+ }
+ });
+ }
+
+ public JavaVersionMappingTests(String name) {
+ super(name);
+ }
+
+ public void testMorphToBasicMapping() throws Exception {
+ createTestEntityWithVersionMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping();
+ assertFalse(versionMapping.isDefault());
+ versionMapping.getColumn().setSpecifiedName("FOO");
+ versionMapping.setTemporal(TemporalType.TIME);
+ assertFalse(versionMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
+ assertEquals("FOO", ((IBasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
+ assertEquals(TemporalType.TIME, ((IBasicMapping) persistentAttribute.getMapping()).getTemporal());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ }
+
+ public void testMorphToDefault() throws Exception {
+ createTestEntityWithVersionMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping();
+ assertFalse(versionMapping.isDefault());
+ versionMapping.getColumn().setSpecifiedName("FOO");
+ versionMapping.setTemporal(TemporalType.TIME);
+ assertFalse(versionMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+ assertEquals("FOO", ((IBasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
+ assertEquals(TemporalType.TIME, ((IBasicMapping) persistentAttribute.getMapping()).getTemporal());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ }
+
+ public void testMorphToIdMapping() throws Exception {
+ createTestEntityWithVersionMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping();
+ assertFalse(versionMapping.isDefault());
+ versionMapping.getColumn().setSpecifiedName("FOO");
+ versionMapping.setTemporal(TemporalType.TIME);
+ assertFalse(versionMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
+ assertEquals("FOO", ((IIdMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
+ assertEquals(TemporalType.TIME, ((IIdMapping) persistentAttribute.getMapping()).getTemporal());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddedMapping() throws Exception {
+ createTestEntityWithVersionMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping();
+ assertFalse(versionMapping.isDefault());
+ versionMapping.getColumn().setSpecifiedName("FOO");
+ versionMapping.setTemporal(TemporalType.TIME);
+ assertFalse(versionMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ }
+
+ public void testMorphToTransientMapping() throws Exception {
+ createTestEntityWithVersionMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping();
+ assertFalse(versionMapping.isDefault());
+ versionMapping.getColumn().setSpecifiedName("FOO");
+ versionMapping.setTemporal(TemporalType.TIME);
+ assertFalse(versionMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ }
+
+ public void testMorphToEmbeddedIdMapping() throws Exception {
+ createTestEntityWithVersionMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping();
+ assertFalse(versionMapping.isDefault());
+ versionMapping.getColumn().setSpecifiedName("FOO");
+ versionMapping.setTemporal(TemporalType.TIME);
+ assertFalse(versionMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ }
+
+ public void testMorphToOneToOneMapping() throws Exception {
+ createTestEntityWithVersionMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping();
+ assertFalse(versionMapping.isDefault());
+ versionMapping.getColumn().setSpecifiedName("FOO");
+ versionMapping.setTemporal(TemporalType.TIME);
+ assertFalse(versionMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ }
+
+ public void testMorphToOneToManyMapping() throws Exception {
+ createTestEntityWithVersionMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping();
+ assertFalse(versionMapping.isDefault());
+ versionMapping.getColumn().setSpecifiedName("FOO");
+ versionMapping.setTemporal(TemporalType.TIME);
+ assertFalse(versionMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ }
+
+ public void testMorphToManyToOneMapping() throws Exception {
+ createTestEntityWithVersionMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping();
+ assertFalse(versionMapping.isDefault());
+ versionMapping.getColumn().setSpecifiedName("FOO");
+ versionMapping.setTemporal(TemporalType.TIME);
+ assertFalse(versionMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ }
+
+ public void testMorphToManyToManyMapping() throws Exception {
+ createTestEntityWithVersionMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping();
+ assertFalse(versionMapping.isDefault());
+ versionMapping.getColumn().setSpecifiedName("FOO");
+ versionMapping.setTemporal(TemporalType.TIME);
+ assertFalse(versionMapping.isDefault());
+
+ persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
+ assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME));
+ assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Column.ANNOTATION_NAME));
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ }
+
+ public void testGetTemporal() throws Exception {
+ createTestEntityWithVersionMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(versionMapping.getTemporal());
+ }
+
+ public void testGetTemporal2() throws Exception {
+ createTestEntityWithTemporal();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertEquals(TemporalType.TIMESTAMP, versionMapping.getTemporal());
+ }
+
+ public void testSetTemporal() throws Exception {
+ createTestEntityWithVersionMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getSpecifiedMapping();
+ assertNull(versionMapping.getTemporal());
+
+ versionMapping.setTemporal(TemporalType.TIME);
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Temporal temporal = (Temporal) attributeResource.annotation(Temporal.ANNOTATION_NAME);
+
+ assertEquals(org.eclipse.jpt.core.internal.resource.java.TemporalType.TIME, temporal.getValue());
+
+ versionMapping.setTemporal(null);
+ assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME));
+ }
+
+ public void testGetTemporalUpdatesFromResourceModelChange() throws Exception {
+ createTestEntityWithVersionMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(versionMapping.getTemporal());
+
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Temporal temporal = (Temporal) attributeResource.addAnnotation(Temporal.ANNOTATION_NAME);
+ temporal.setValue(org.eclipse.jpt.core.internal.resource.java.TemporalType.DATE);
+
+ assertEquals(TemporalType.DATE, versionMapping.getTemporal());
+
+ attributeResource.removeAnnotation(Temporal.ANNOTATION_NAME);
+
+ assertNull(versionMapping.getTemporal());
+ assertFalse(versionMapping.isDefault());
+ assertSame(versionMapping, persistentAttribute.getSpecifiedMapping());
+ }
+
+ public void testGetColumn() throws Exception {
+ createTestEntityWithVersionMapping();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next();
+ IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getSpecifiedMapping();
+
+ assertNull(versionMapping.getColumn().getSpecifiedName());
+ assertEquals("id", versionMapping.getColumn().getName());
+
+ JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
+ Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN);
+ column.setName("foo");
+
+ assertEquals("foo", versionMapping.getColumn().getSpecifiedName());
+ assertEquals("foo", versionMapping.getColumn().getName());
+ assertEquals("id", versionMapping.getColumn().getDefaultName());
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JptCoreContextJavaModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JptCoreContextJavaModelTests.java
new file mode 100644
index 0000000000..ed58b5da69
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JptCoreContextJavaModelTests.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.java;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class JptCoreContextJavaModelTests extends TestCase
+{
+ public static Test suite() {
+ return suite(true);
+ }
+
+ public static Test suite(boolean all) {
+ TestSuite suite = new TestSuite(JptCoreContextJavaModelTests.class.getName());
+ suite.addTestSuite(JavaAssociationOverrideTests.class);
+ suite.addTestSuite(JavaAttributeOverrideTests.class);
+ suite.addTestSuite(JavaBasicMappingTests.class);
+ suite.addTestSuite(JavaColumnTests.class);
+ suite.addTestSuite(JavaDiscriminatorColumnTests.class);
+ suite.addTestSuite(JavaEmbeddableTests.class);
+ suite.addTestSuite(JavaEmbeddedIdMappingTests.class);
+ suite.addTestSuite(JavaEmbeddedMappingTests.class);
+ suite.addTestSuite(JavaEntityTests.class);
+ suite.addTestSuite(JavaGeneratedValueTests.class);
+ suite.addTestSuite(JavaIdMappingTests.class);
+ suite.addTestSuite(JavaJoinTableTests.class);
+ suite.addTestSuite(JavaMappedSuperclassTests.class);
+ suite.addTestSuite(JavaManyToManyMappingTests.class);
+ suite.addTestSuite(JavaManyToOneMappingTests.class);
+ suite.addTestSuite(JavaNamedQueryTests.class);
+ suite.addTestSuite(JavaNamedNativeQueryTests.class);
+ suite.addTestSuite(JavaQueryHintTests.class);
+ suite.addTestSuite(JavaOneToManyMappingTests.class);
+ suite.addTestSuite(JavaOneToOneMappingTests.class);
+ suite.addTestSuite(JavaPersistentTypeTests.class);
+ suite.addTestSuite(JavaPersistentAttributeTests.class);
+ suite.addTestSuite(JavaPrimaryKeyJoinColumnTests.class);
+ suite.addTestSuite(JavaSecondaryTableTests.class);
+ suite.addTestSuite(JavaSequenceGeneratorTests.class);
+ suite.addTestSuite(JavaTableGeneratorTests.class);
+ suite.addTestSuite(JavaTableTests.class);
+ suite.addTestSuite(JavaTransientMappingTests.class);
+ suite.addTestSuite(JavaVersionMappingTests.class);
+ return suite;
+ }
+
+ private JptCoreContextJavaModelTests() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java
new file mode 100644
index 0000000000..857d7d02a5
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java
@@ -0,0 +1,1066 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.base.ISequenceGenerator;
+import org.eclipse.jpt.core.internal.context.base.ITableGenerator;
+import org.eclipse.jpt.core.internal.context.orm.XmlNamedNativeQuery;
+import org.eclipse.jpt.core.internal.context.orm.XmlNamedQuery;
+import org.eclipse.jpt.core.internal.resource.orm.Embeddable;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator;
+import org.eclipse.jpt.core.internal.resource.orm.TableGenerator;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class EntityMappingsTests extends ContextModelTestCase
+{
+ public EntityMappingsTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ public void testGetVersion() throws Exception {
+ assertEquals("1.0", entityMappings().getVersion());
+ }
+
+ public void testUpdateDescription() throws Exception {
+ assertNull(entityMappings().getDescription());
+ assertNull(ormResource().getEntityMappings().getDescription());
+
+ //set description in the resource model, verify context model updated
+ ormResource().getEntityMappings().setDescription("newDescription");
+ assertEquals("newDescription", entityMappings().getDescription());
+ assertEquals("newDescription", ormResource().getEntityMappings().getDescription());
+
+ //set description to null in the resource model
+ ormResource().getEntityMappings().setDescription(null);
+ assertNull(entityMappings().getDescription());
+ assertNull(ormResource().getEntityMappings().getDescription());
+ }
+
+ public void testModifyDescription() throws Exception {
+ assertNull(entityMappings().getDescription());
+ assertNull(ormResource().getEntityMappings().getDescription());
+
+ //set description in the context model, verify resource model modified
+ entityMappings().setDescription("newDescription");
+ assertEquals("newDescription", entityMappings().getDescription());
+ assertEquals("newDescription", ormResource().getEntityMappings().getDescription());
+
+ //set description to null in the context model
+ entityMappings().setDescription(null);
+ assertNull(entityMappings().getDescription());
+ assertNull(ormResource().getEntityMappings().getDescription());
+ }
+
+ public void testUpdatePackage() throws Exception {
+ assertNull(entityMappings().getPackage());
+ assertNull(ormResource().getEntityMappings().getPackage());
+
+ //set package in the resource model, verify context model updated
+ ormResource().getEntityMappings().setPackage("foo.model");
+ assertEquals("foo.model", entityMappings().getPackage());
+ assertEquals("foo.model", ormResource().getEntityMappings().getPackage());
+
+ //set package to null in the resource model
+ ormResource().getEntityMappings().setPackage(null);
+ assertNull(entityMappings().getPackage());
+ assertNull(ormResource().getEntityMappings().getPackage());
+ }
+
+ public void testModifyPackage() throws Exception {
+ assertNull(entityMappings().getPackage());
+ assertNull(ormResource().getEntityMappings().getPackage());
+
+ //set package in the context model, verify resource model modified
+ entityMappings().setPackage("foo.model");
+ assertEquals("foo.model", entityMappings().getPackage());
+ assertEquals("foo.model", ormResource().getEntityMappings().getPackage());
+
+ //set package to null in the context model
+ entityMappings().setPackage(null);
+ assertNull(entityMappings().getPackage());
+ assertNull(ormResource().getEntityMappings().getPackage());
+ }
+
+ public void testUpdateSpecifiedSchema() throws Exception {
+ assertNull(entityMappings().getSpecifiedSchema());
+ assertNull(ormResource().getEntityMappings().getSchema());
+
+ //set schema in the resource model, verify context model updated
+ ormResource().getEntityMappings().setSchema("MY_SCHEMA");
+ assertEquals("MY_SCHEMA", entityMappings().getSpecifiedSchema());
+ assertEquals("MY_SCHEMA", ormResource().getEntityMappings().getSchema());
+
+ //set schema to null in the resource model
+ ormResource().getEntityMappings().setSchema(null);
+ assertNull(entityMappings().getSpecifiedSchema());
+ assertNull(ormResource().getEntityMappings().getSchema());
+ }
+
+ public void testModifySpecifiedSchema() throws Exception {
+ assertNull(entityMappings().getSpecifiedSchema());
+ assertNull(ormResource().getEntityMappings().getSchema());
+
+ //set schema in the context model, verify resource model modified
+ entityMappings().setSpecifiedSchema("MY_SCHEMA");
+ assertEquals("MY_SCHEMA", entityMappings().getSpecifiedSchema());
+ assertEquals("MY_SCHEMA", ormResource().getEntityMappings().getSchema());
+
+ //set schema to null in the context model
+ entityMappings().setSpecifiedSchema(null);
+ assertNull(entityMappings().getSpecifiedSchema());
+ assertNull(ormResource().getEntityMappings().getSchema());
+ }
+
+ public void testUpdateSpecifiedCatalog() throws Exception {
+ assertNull(entityMappings().getSpecifiedCatalog());
+ assertNull(ormResource().getEntityMappings().getCatalog());
+
+ //set catalog in the resource model, verify context model updated
+ ormResource().getEntityMappings().setCatalog("MY_CATALOG");
+ assertEquals("MY_CATALOG", entityMappings().getSpecifiedCatalog());
+ assertEquals("MY_CATALOG", ormResource().getEntityMappings().getCatalog());
+
+ //set catalog to null in the resource model
+ ormResource().getEntityMappings().setCatalog(null);
+ assertNull(entityMappings().getSpecifiedCatalog());
+ assertNull(ormResource().getEntityMappings().getCatalog());
+ }
+
+ public void testUpdateDefaultSchema() throws Exception {
+ assertNull(entityMappings().getDefaultSchema());
+ assertNull(entityMappings().getSpecifiedSchema());
+ assertNull(ormResource().getEntityMappings().getSchema());
+
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults persistenceUnitDefaults = OrmFactory.eINSTANCE.createPersistenceUnitDefaults();
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(persistenceUnitDefaults);
+ persistenceUnitDefaults.setSchema("MY_SCHEMA");
+ assertEquals("MY_SCHEMA", entityMappings().getDefaultSchema());
+ assertNull(entityMappings().getSpecifiedSchema());
+ assertNull(ormResource().getEntityMappings().getSchema());
+ assertEquals("MY_SCHEMA", ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
+
+ persistenceUnitDefaults.setSchema(null);
+ ormResource().save(null);
+ assertNull(entityMappings().getDefaultSchema());
+ assertNull(entityMappings().getSpecifiedSchema());
+ assertNull(ormResource().getEntityMappings().getSchema());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
+ }
+
+ public void testUpdateSchema() throws Exception {
+ assertNull(entityMappings().getDefaultSchema());
+ assertNull(entityMappings().getSchema());
+ assertNull(entityMappings().getSpecifiedSchema());
+ assertNull(ormResource().getEntityMappings().getSchema());
+
+ ormResource().getEntityMappings().setSchema("MY_SCHEMA");
+ assertNull(entityMappings().getDefaultSchema());
+ assertEquals("MY_SCHEMA", entityMappings().getSchema());
+ assertEquals("MY_SCHEMA", entityMappings().getSpecifiedSchema());
+ assertEquals("MY_SCHEMA", ormResource().getEntityMappings().getSchema());
+
+ ormResource().getEntityMappings().setSchema(null);
+ assertNull(entityMappings().getDefaultSchema());
+ assertNull(entityMappings().getSchema());
+ assertNull(entityMappings().getSpecifiedSchema());
+ assertNull(ormResource().getEntityMappings().getSchema());
+
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema("DEFAULT_SCHEMA");
+ assertEquals("DEFAULT_SCHEMA", entityMappings().getDefaultSchema());
+ assertEquals("DEFAULT_SCHEMA", entityMappings().getSchema());
+ assertNull(entityMappings().getSpecifiedSchema());
+ assertNull(ormResource().getEntityMappings().getSchema());
+
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema(null);
+ assertNull(entityMappings().getDefaultSchema());
+ assertNull(entityMappings().getSchema());
+ assertNull(entityMappings().getSpecifiedSchema());
+ assertNull(ormResource().getEntityMappings().getSchema());
+ }
+
+ public void testModifySpecifiedCatalog() throws Exception {
+ assertNull(entityMappings().getSpecifiedCatalog());
+ assertNull(ormResource().getEntityMappings().getCatalog());
+
+ //set catalog in the context model, verify resource model modified
+ entityMappings().setSpecifiedCatalog("MY_CATALOG");
+ assertEquals("MY_CATALOG", entityMappings().getSpecifiedCatalog());
+ assertEquals("MY_CATALOG", ormResource().getEntityMappings().getCatalog());
+
+ //set catalog to null in the context model
+ entityMappings().setSpecifiedCatalog(null);
+ assertNull(entityMappings().getSpecifiedCatalog());
+ assertNull(ormResource().getEntityMappings().getCatalog());
+ }
+
+ public void testUpdateDefaultCatalog() throws Exception {
+ assertNull(entityMappings().getDefaultCatalog());
+ assertNull(entityMappings().getSpecifiedCatalog());
+ assertNull(ormResource().getEntityMappings().getCatalog());
+
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults persistenceUnitDefaults = OrmFactory.eINSTANCE.createPersistenceUnitDefaults();
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(persistenceUnitDefaults);
+ persistenceUnitDefaults.setCatalog("MY_CATALOG");
+ assertEquals("MY_CATALOG", entityMappings().getDefaultCatalog());
+ assertNull(entityMappings().getSpecifiedCatalog());
+ assertNull(ormResource().getEntityMappings().getCatalog());
+ assertEquals("MY_CATALOG", ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
+
+ persistenceUnitDefaults.setCatalog(null);
+ assertNull(entityMappings().getDefaultCatalog());
+ assertNull(entityMappings().getSpecifiedCatalog());
+ assertNull(ormResource().getEntityMappings().getCatalog());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
+ }
+
+ public void testUpdateCatalog() throws Exception {
+ assertNull(entityMappings().getDefaultCatalog());
+ assertNull(entityMappings().getCatalog());
+ assertNull(entityMappings().getSpecifiedCatalog());
+ assertNull(ormResource().getEntityMappings().getCatalog());
+
+ ormResource().getEntityMappings().setCatalog("MY_CATALOG");
+ assertNull(entityMappings().getDefaultCatalog());
+ assertEquals("MY_CATALOG", entityMappings().getCatalog());
+ assertEquals("MY_CATALOG", entityMappings().getSpecifiedCatalog());
+ assertEquals("MY_CATALOG", ormResource().getEntityMappings().getCatalog());
+
+ ormResource().getEntityMappings().setCatalog(null);
+ assertNull(entityMappings().getDefaultCatalog());
+ assertNull(entityMappings().getCatalog());
+ assertNull(entityMappings().getSpecifiedCatalog());
+ assertNull(ormResource().getEntityMappings().getCatalog());
+
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("DEFAULT_CATALOG");
+ assertEquals("DEFAULT_CATALOG", entityMappings().getDefaultCatalog());
+ assertEquals("DEFAULT_CATALOG", entityMappings().getCatalog());
+ assertNull(entityMappings().getSpecifiedCatalog());
+ assertNull(ormResource().getEntityMappings().getCatalog());
+
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog(null);
+ assertNull(entityMappings().getDefaultCatalog());
+ assertNull(entityMappings().getCatalog());
+ assertNull(entityMappings().getSpecifiedCatalog());
+ assertNull(ormResource().getEntityMappings().getCatalog());
+ }
+
+ public void testUpdateSpecifiedAccess() throws Exception {
+ assertNull(entityMappings().getSpecifiedAccess());
+ assertNull(ormResource().getEntityMappings().getAccess());
+
+ //set access in the resource model, verify context model updated
+ ormResource().getEntityMappings().setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY);
+ assertEquals(AccessType.PROPERTY, entityMappings().getSpecifiedAccess());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, ormResource().getEntityMappings().getAccess());
+
+ //set access to null in the resource model
+ ormResource().getEntityMappings().setAccess(null);
+ assertNull(entityMappings().getSpecifiedAccess());
+ assertNull(ormResource().getEntityMappings().getAccess());
+ }
+
+ public void testModifySpecifiedAccess() throws Exception {
+ assertNull(entityMappings().getSpecifiedAccess());
+ assertNull(ormResource().getEntityMappings().getAccess());
+
+ //set access in the context model, verify resource model modified
+ entityMappings().setSpecifiedAccess(AccessType.PROPERTY);
+ assertEquals(AccessType.PROPERTY, entityMappings().getSpecifiedAccess());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, ormResource().getEntityMappings().getAccess());
+
+ //set access to null in the context model
+ entityMappings().setSpecifiedAccess(null);
+ assertNull(entityMappings().getSpecifiedAccess());
+ assertNull(ormResource().getEntityMappings().getAccess());
+ }
+
+ public void testUpdateDefaultAccess() throws Exception {
+ assertNull(entityMappings().getDefaultAccess());
+ assertNull(entityMappings().getSpecifiedAccess());
+ assertNull(ormResource().getEntityMappings().getAccess());
+
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults persistenceUnitDefaults = OrmFactory.eINSTANCE.createPersistenceUnitDefaults();
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(persistenceUnitDefaults);
+ persistenceUnitDefaults.setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY);
+ assertEquals(AccessType.PROPERTY, entityMappings().getDefaultAccess());
+ assertNull(entityMappings().getSpecifiedAccess());
+ assertNull(ormResource().getEntityMappings().getAccess());
+
+ persistenceUnitDefaults.setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD);
+ assertEquals(AccessType.FIELD, entityMappings().getDefaultAccess());
+ assertNull(entityMappings().getSpecifiedAccess());
+ assertNull(ormResource().getEntityMappings().getAccess());
+
+ persistenceUnitDefaults.setAccess(null);
+ assertNull(entityMappings().getDefaultAccess());
+ assertNull(entityMappings().getSpecifiedAccess());
+ assertNull(ormResource().getEntityMappings().getAccess());
+ }
+
+ public void testUpdateAccess() throws Exception {
+ assertNull(entityMappings().getAccess());
+ assertNull(entityMappings().getDefaultAccess());
+ assertNull(entityMappings().getSpecifiedAccess());
+ assertNull(ormResource().getEntityMappings().getAccess());
+
+ ormResource().getEntityMappings().setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD);
+ assertNull(entityMappings().getDefaultAccess());
+ assertEquals(AccessType.FIELD, entityMappings().getAccess());
+ assertEquals(AccessType.FIELD, entityMappings().getSpecifiedAccess());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD, ormResource().getEntityMappings().getAccess());
+
+ ormResource().getEntityMappings().setAccess(null);
+ assertNull(entityMappings().getAccess());
+ assertNull(entityMappings().getDefaultAccess());
+ assertNull(entityMappings().getSpecifiedAccess());
+ assertNull(ormResource().getEntityMappings().getAccess());
+
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.FIELD);
+ assertEquals(AccessType.FIELD, entityMappings().getDefaultAccess());
+ assertEquals(AccessType.FIELD, entityMappings().getAccess());
+ assertNull(entityMappings().getSpecifiedAccess());
+ assertNull(ormResource().getEntityMappings().getAccess());
+
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(null);
+ assertNull(entityMappings().getDefaultAccess());
+ assertNull(entityMappings().getAccess());
+ assertNull(entityMappings().getSpecifiedAccess());
+ assertNull(ormResource().getEntityMappings().getAccess());
+ }
+
+
+ public void testUpdateXmlPersistentTypes() throws Exception {
+ assertFalse(entityMappings().xmlPersistentTypes().hasNext());
+ assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+ assertTrue(ormResource().getEntityMappings().getEntities().isEmpty());
+ assertTrue(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+
+ //add embeddable in the resource model, verify context model updated
+ Embeddable embeddable = OrmFactory.eINSTANCE.createEmbeddable();
+ ormResource().getEntityMappings().getEmbeddables().add(embeddable);
+ embeddable.setClassName("model.Foo");
+ assertTrue(entityMappings().xmlPersistentTypes().hasNext());
+ assertEquals("model.Foo", entityMappings().xmlPersistentTypes().next().getMapping().getClass_());
+ assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+ assertTrue(ormResource().getEntityMappings().getEntities().isEmpty());
+ assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+ assertEquals("model.Foo", ormResource().getEntityMappings().getEmbeddables().get(0).getClassName());
+
+ //add entity in the resource model, verify context model updated
+ Entity entity = OrmFactory.eINSTANCE.createEntity();
+ ormResource().getEntityMappings().getEntities().add(entity);
+ entity.setClassName("model.Foo2");
+ assertTrue(entityMappings().xmlPersistentTypes().hasNext());
+ assertEquals("model.Foo2", entityMappings().xmlPersistentTypes().next().getMapping().getClass_());
+ assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+ assertFalse(ormResource().getEntityMappings().getEntities().isEmpty());
+ assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+ assertEquals("model.Foo2", ormResource().getEntityMappings().getEntities().get(0).getClassName());
+
+ //add mapped-superclass in the resource model, verify context model updated
+ MappedSuperclass mappedSuperclass = OrmFactory.eINSTANCE.createMappedSuperclass();
+ ormResource().getEntityMappings().getMappedSuperclasses().add(mappedSuperclass);
+ mappedSuperclass.setClassName("model.Foo3");
+ assertTrue(entityMappings().xmlPersistentTypes().hasNext());
+ assertEquals("model.Foo3", entityMappings().xmlPersistentTypes().next().getMapping().getClass_());
+ assertFalse(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+ assertFalse(ormResource().getEntityMappings().getEntities().isEmpty());
+ assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+ assertEquals("model.Foo3", ormResource().getEntityMappings().getMappedSuperclasses().get(0).getClassName());
+ }
+
+
+ public void testAddXmlPersistentType() throws Exception {
+ assertFalse(entityMappings().xmlPersistentTypes().hasNext());
+ assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+ assertTrue(ormResource().getEntityMappings().getEntities().isEmpty());
+ assertTrue(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+
+ //add embeddable in the context model, verify resource model modified
+ entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
+ assertTrue(entityMappings().xmlPersistentTypes().hasNext());
+ assertEquals("model.Foo", entityMappings().xmlPersistentTypes().next().getMapping().getClass_());
+ assertEquals(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, entityMappings().xmlPersistentTypes().next().getMapping().getKey());
+ assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+ assertTrue(ormResource().getEntityMappings().getEntities().isEmpty());
+ assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+ assertEquals("model.Foo", ormResource().getEntityMappings().getEmbeddables().get(0).getClassName());
+
+ //add entity in the context model, verify resource model modified
+ entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
+ assertTrue(entityMappings().xmlPersistentTypes().hasNext());
+ assertEquals("model.Foo2", entityMappings().xmlPersistentTypes().next().getMapping().getClass_());
+ assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, entityMappings().xmlPersistentTypes().next().getMapping().getKey());
+ assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+ assertFalse(ormResource().getEntityMappings().getEntities().isEmpty());
+ assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+ assertEquals("model.Foo2", ormResource().getEntityMappings().getEntities().get(0).getClassName());
+
+ //add mapped-superclass in the context model, verify resource model modified
+ entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo3");
+ assertTrue(entityMappings().xmlPersistentTypes().hasNext());
+ assertEquals("model.Foo3", entityMappings().xmlPersistentTypes().next().getMapping().getClass_());
+ assertEquals(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, entityMappings().xmlPersistentTypes().next().getMapping().getKey());
+ assertFalse(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+ assertFalse(ormResource().getEntityMappings().getEntities().isEmpty());
+ assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+ assertEquals("model.Foo3", ormResource().getEntityMappings().getMappedSuperclasses().get(0).getClassName());
+ }
+
+ public void testRemoveXmlPersistentType() throws Exception {
+ assertFalse(entityMappings().xmlPersistentTypes().hasNext());
+ assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+ assertTrue(ormResource().getEntityMappings().getEntities().isEmpty());
+ assertTrue(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+
+ entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
+ entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
+ entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo3");
+
+ ormResource().save(null);
+ //remove xmlPersistentType from the context model, verify resource model modified
+ entityMappings().removeXmlPersistentType(1);
+ ormResource().save(null);
+ assertFalse(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+ assertTrue(ormResource().getEntityMappings().getEntities().isEmpty());
+ assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+
+ entityMappings().removeXmlPersistentType(1);
+ ormResource().save(null);
+ assertFalse(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+ assertTrue(ormResource().getEntityMappings().getEntities().isEmpty());
+ assertTrue(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+
+ entityMappings().removeXmlPersistentType(0);
+ ormResource().save(null);
+ assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+ assertTrue(ormResource().getEntityMappings().getEntities().isEmpty());
+ assertTrue(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+ }
+
+ public void testUpdateTableGenerators() throws Exception {
+ assertEquals(0, entityMappings().tableGeneratorsSize());
+ assertEquals(0, ormResource().getEntityMappings().getTableGenerators().size());
+ ormResource().save(null);
+ TableGenerator tableGeneratorResource = OrmFactory.eINSTANCE.createTableGeneratorImpl();
+ ormResource().getEntityMappings().getTableGenerators().add(tableGeneratorResource);
+ ormResource().save(null);
+ tableGeneratorResource.setName("FOO");
+ ormResource().save(null);
+
+ ITableGenerator tableGenerator = entityMappings().tableGenerators().next();
+ assertEquals("FOO", tableGenerator.getName());
+
+
+ TableGenerator tableGeneratorResource2 = OrmFactory.eINSTANCE.createTableGeneratorImpl();
+ ormResource().getEntityMappings().getTableGenerators().add(0, tableGeneratorResource2);
+ tableGeneratorResource2.setName("BAR");
+ ormResource().save(null);
+
+ ListIterator<ITableGenerator> tableGenerators = entityMappings().tableGenerators();
+ assertEquals("BAR", tableGenerators.next().getName());
+ assertEquals("FOO", tableGenerators.next().getName());
+ assertFalse(tableGenerators.hasNext());
+
+
+ TableGenerator tableGeneratorResource3 = OrmFactory.eINSTANCE.createTableGeneratorImpl();
+ ormResource().getEntityMappings().getTableGenerators().add(1, tableGeneratorResource3);
+ tableGeneratorResource3.setName("BAZ");
+ ormResource().save(null);
+
+ tableGenerators = entityMappings().tableGenerators();
+ assertEquals("BAR", tableGenerators.next().getName());
+ assertEquals("BAZ", tableGenerators.next().getName());
+ assertEquals("FOO", tableGenerators.next().getName());
+ assertFalse(tableGenerators.hasNext());
+
+ ormResource().getEntityMappings().getTableGenerators().move(2, 0);
+ ormResource().save(null);
+ tableGenerators = entityMappings().tableGenerators();
+ assertEquals("BAZ", tableGenerators.next().getName());
+ assertEquals("FOO", tableGenerators.next().getName());
+ assertEquals("BAR", tableGenerators.next().getName());
+ assertFalse(tableGenerators.hasNext());
+
+
+ ormResource().getEntityMappings().getTableGenerators().remove(0);
+ ormResource().save(null);
+ tableGenerators = entityMappings().tableGenerators();
+ assertEquals("FOO", tableGenerators.next().getName());
+ assertEquals("BAR", tableGenerators.next().getName());
+ assertFalse(tableGenerators.hasNext());
+
+ ormResource().getEntityMappings().getTableGenerators().remove(1);
+ ormResource().save(null);
+ tableGenerators = entityMappings().tableGenerators();
+ assertEquals("FOO", tableGenerators.next().getName());
+ assertFalse(tableGenerators.hasNext());
+
+ ormResource().getEntityMappings().getTableGenerators().clear();
+ ormResource().save(null);
+ tableGenerators = entityMappings().tableGenerators();
+ assertFalse(tableGenerators.hasNext());
+ }
+
+ public void testAddTableGenerator() throws Exception {
+ assertEquals(0, entityMappings().tableGeneratorsSize());
+ assertEquals(0, ormResource().getEntityMappings().getTableGenerators().size());
+ ormResource().save(null);
+ entityMappings().addTableGenerator(0).setName("FOO");
+
+ assertEquals("FOO", ormResource().getEntityMappings().getTableGenerators().get(0).getName());
+
+ entityMappings().addTableGenerator(0).setName("BAR");
+ assertEquals("BAR", ormResource().getEntityMappings().getTableGenerators().get(0).getName());
+ assertEquals("FOO", ormResource().getEntityMappings().getTableGenerators().get(1).getName());
+ assertEquals(2, ormResource().getEntityMappings().getTableGenerators().size());
+
+ ListIterator<ITableGenerator> tableGenerators = entityMappings().tableGenerators();
+ assertEquals("BAR", tableGenerators.next().getName());
+ assertEquals("FOO", tableGenerators.next().getName());
+ assertFalse(tableGenerators.hasNext());
+ }
+
+ public void testRemoveTableGenerator() throws Exception {
+ assertEquals(0, entityMappings().tableGeneratorsSize());
+ assertEquals(0, ormResource().getEntityMappings().getTableGenerators().size());
+
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ tableGenerator.setName("FOO");
+ ITableGenerator tableGenerator2 = entityMappings().addTableGenerator(1);
+ tableGenerator2.setName("BAR");
+ ITableGenerator tableGenerator3 = entityMappings().addTableGenerator(2);
+ tableGenerator3.setName("BAZ");
+ assertEquals("FOO", ormResource().getEntityMappings().getTableGenerators().get(0).getName());
+ assertEquals("BAR", ormResource().getEntityMappings().getTableGenerators().get(1).getName());
+ assertEquals("BAZ", ormResource().getEntityMappings().getTableGenerators().get(2).getName());
+ assertEquals(3, ormResource().getEntityMappings().getTableGenerators().size());
+
+ entityMappings().removeTableGenerator(0);
+ assertEquals("BAR", ormResource().getEntityMappings().getTableGenerators().get(0).getName());
+ assertEquals("BAZ", ormResource().getEntityMappings().getTableGenerators().get(1).getName());
+
+ ListIterator<ITableGenerator> tableGenerators = entityMappings().tableGenerators();
+ ITableGenerator xmlTableGenerator = tableGenerators.next();
+ assertEquals("BAR", xmlTableGenerator.getName());
+ assertEquals(tableGenerator2, xmlTableGenerator);
+ xmlTableGenerator = tableGenerators.next();
+ assertEquals("BAZ", xmlTableGenerator.getName());
+ assertEquals(tableGenerator3, xmlTableGenerator);
+ assertFalse(tableGenerators.hasNext());
+
+
+ entityMappings().removeTableGenerator(1);
+ assertEquals("BAR", ormResource().getEntityMappings().getTableGenerators().get(0).getName());
+ tableGenerators = entityMappings().tableGenerators();
+ xmlTableGenerator = tableGenerators.next();
+ assertEquals("BAR", xmlTableGenerator.getName());
+ assertEquals(tableGenerator2, xmlTableGenerator);
+ assertFalse(tableGenerators.hasNext());
+
+
+ entityMappings().removeTableGenerator(0);
+ assertEquals(0, ormResource().getEntityMappings().getTableGenerators().size());
+ tableGenerators = entityMappings().tableGenerators();
+ assertFalse(tableGenerators.hasNext());
+ }
+
+ public void testMoveTableGenerator() throws Exception {
+ assertEquals(0, entityMappings().tableGeneratorsSize());
+ assertEquals(0, ormResource().getEntityMappings().getTableGenerators().size());
+
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ tableGenerator.setName("FOO");
+ ITableGenerator tableGenerator2 = entityMappings().addTableGenerator(1);
+ tableGenerator2.setName("BAR");
+ ITableGenerator tableGenerator3 = entityMappings().addTableGenerator(2);
+ tableGenerator3.setName("BAZ");
+ assertEquals("FOO", ormResource().getEntityMappings().getTableGenerators().get(0).getName());
+ assertEquals("BAR", ormResource().getEntityMappings().getTableGenerators().get(1).getName());
+ assertEquals("BAZ", ormResource().getEntityMappings().getTableGenerators().get(2).getName());
+ assertEquals(3, ormResource().getEntityMappings().getTableGenerators().size());
+
+ entityMappings().moveTableGenerator(2, 0);
+ assertEquals("BAR", ormResource().getEntityMappings().getTableGenerators().get(0).getName());
+ assertEquals("BAZ", ormResource().getEntityMappings().getTableGenerators().get(1).getName());
+ assertEquals("FOO", ormResource().getEntityMappings().getTableGenerators().get(2).getName());
+ assertEquals(3, ormResource().getEntityMappings().getTableGenerators().size());
+
+ entityMappings().moveTableGenerator(0, 2);
+ assertEquals("FOO", ormResource().getEntityMappings().getTableGenerators().get(0).getName());
+ assertEquals("BAR", ormResource().getEntityMappings().getTableGenerators().get(1).getName());
+ assertEquals("BAZ", ormResource().getEntityMappings().getTableGenerators().get(2).getName());
+ assertEquals(3, ormResource().getEntityMappings().getTableGenerators().size());
+ }
+
+ public void testTableGeneratorsSize() throws Exception {
+ assertEquals(0, entityMappings().tableGeneratorsSize());
+ assertEquals(0, ormResource().getEntityMappings().getTableGenerators().size());
+
+
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ tableGenerator.setName("FOO");
+ ITableGenerator tableGenerator2 = entityMappings().addTableGenerator(1);
+ tableGenerator2.setName("BAR");
+ ITableGenerator tableGenerator3 = entityMappings().addTableGenerator(2);
+ tableGenerator3.setName("BAZ");
+
+ assertEquals(3, entityMappings().tableGeneratorsSize());
+
+ ormResource().getEntityMappings().getTableGenerators().remove(0);
+ assertEquals(2, entityMappings().tableGeneratorsSize());
+ }
+
+ public void testUpdateSequenceGenerators() throws Exception {
+ assertEquals(0, entityMappings().sequenceGeneratorsSize());
+ assertEquals(0, ormResource().getEntityMappings().getSequenceGenerators().size());
+ ormResource().save(null);
+
+ SequenceGenerator sequenceGeneratorResource = OrmFactory.eINSTANCE.createSequenceGeneratorImpl();
+ ormResource().getEntityMappings().getSequenceGenerators().add(sequenceGeneratorResource);
+ ormResource().save(null);
+ sequenceGeneratorResource.setName("FOO");
+ ormResource().save(null);
+
+ ISequenceGenerator sequenceGenerator = entityMappings().sequenceGenerators().next();
+ assertEquals("FOO", sequenceGenerator.getName());
+
+
+ SequenceGenerator sequenceGeneratorResource2 = OrmFactory.eINSTANCE.createSequenceGeneratorImpl();
+ ormResource().getEntityMappings().getSequenceGenerators().add(0, sequenceGeneratorResource2);
+ sequenceGeneratorResource2.setName("BAR");
+ ormResource().save(null);
+
+ ListIterator<ISequenceGenerator> sequenceGenerators = entityMappings().sequenceGenerators();
+ assertEquals("BAR", sequenceGenerators.next().getName());
+ assertEquals("FOO", sequenceGenerators.next().getName());
+ assertFalse(sequenceGenerators.hasNext());
+
+
+ SequenceGenerator sequenceGeneratorResource3 = OrmFactory.eINSTANCE.createSequenceGeneratorImpl();
+ ormResource().getEntityMappings().getSequenceGenerators().add(1, sequenceGeneratorResource3);
+ sequenceGeneratorResource3.setName("BAZ");
+ ormResource().save(null);
+
+ sequenceGenerators = entityMappings().sequenceGenerators();
+ assertEquals("BAR", sequenceGenerators.next().getName());
+ assertEquals("BAZ", sequenceGenerators.next().getName());
+ assertEquals("FOO", sequenceGenerators.next().getName());
+ assertFalse(sequenceGenerators.hasNext());
+
+ ormResource().getEntityMappings().getSequenceGenerators().move(2, 0);
+ ormResource().save(null);
+ sequenceGenerators = entityMappings().sequenceGenerators();
+ assertEquals("BAZ", sequenceGenerators.next().getName());
+ assertEquals("FOO", sequenceGenerators.next().getName());
+ assertEquals("BAR", sequenceGenerators.next().getName());
+ assertFalse(sequenceGenerators.hasNext());
+
+
+ ormResource().getEntityMappings().getSequenceGenerators().remove(0);
+ ormResource().save(null);
+ sequenceGenerators = entityMappings().sequenceGenerators();
+ assertEquals("FOO", sequenceGenerators.next().getName());
+ assertEquals("BAR", sequenceGenerators.next().getName());
+ assertFalse(sequenceGenerators.hasNext());
+
+ ormResource().getEntityMappings().getSequenceGenerators().remove(1);
+ ormResource().save(null);
+ sequenceGenerators = entityMappings().sequenceGenerators();
+ assertEquals("FOO", sequenceGenerators.next().getName());
+ assertFalse(sequenceGenerators.hasNext());
+
+ ormResource().getEntityMappings().getSequenceGenerators().clear();
+ ormResource().save(null);
+ sequenceGenerators = entityMappings().sequenceGenerators();
+ assertFalse(sequenceGenerators.hasNext());
+ }
+
+ public void testAddSequenceGenerator() throws Exception {
+ assertEquals(0, entityMappings().sequenceGeneratorsSize());
+ assertEquals(0, ormResource().getEntityMappings().getSequenceGenerators().size());
+
+ entityMappings().addSequenceGenerator(0).setName("FOO");
+
+ assertEquals("FOO", ormResource().getEntityMappings().getSequenceGenerators().get(0).getName());
+
+ entityMappings().addSequenceGenerator(0).setName("BAR");
+ assertEquals("BAR", ormResource().getEntityMappings().getSequenceGenerators().get(0).getName());
+ assertEquals("FOO", ormResource().getEntityMappings().getSequenceGenerators().get(1).getName());
+ assertEquals(2, ormResource().getEntityMappings().getSequenceGenerators().size());
+
+ ListIterator<ISequenceGenerator> sequenceGenerators = entityMappings().sequenceGenerators();
+ assertEquals("BAR", sequenceGenerators.next().getName());
+ assertEquals("FOO", sequenceGenerators.next().getName());
+ assertFalse(sequenceGenerators.hasNext());
+ }
+
+ public void testRemoveSequenceGenerator() throws Exception {
+ assertEquals(0, entityMappings().sequenceGeneratorsSize());
+ assertEquals(0, ormResource().getEntityMappings().getSequenceGenerators().size());
+
+ ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0);
+ sequenceGenerator.setName("FOO");
+ ISequenceGenerator sequenceGenerator2 = entityMappings().addSequenceGenerator(1);
+ sequenceGenerator2.setName("BAR");
+ ISequenceGenerator sequenceGenerator3 = entityMappings().addSequenceGenerator(2);
+ sequenceGenerator3.setName("BAZ");
+ assertEquals("FOO", ormResource().getEntityMappings().getSequenceGenerators().get(0).getName());
+ assertEquals("BAR", ormResource().getEntityMappings().getSequenceGenerators().get(1).getName());
+ assertEquals("BAZ", ormResource().getEntityMappings().getSequenceGenerators().get(2).getName());
+ assertEquals(3, ormResource().getEntityMappings().getSequenceGenerators().size());
+
+ entityMappings().removeSequenceGenerator(0);
+ assertEquals("BAR", ormResource().getEntityMappings().getSequenceGenerators().get(0).getName());
+ assertEquals("BAZ", ormResource().getEntityMappings().getSequenceGenerators().get(1).getName());
+
+ ListIterator<ISequenceGenerator> sequenceGenerators = entityMappings().sequenceGenerators();
+ ISequenceGenerator xmlSequenceGenerator = sequenceGenerators.next();
+ assertEquals("BAR", xmlSequenceGenerator.getName());
+ assertEquals(sequenceGenerator2, xmlSequenceGenerator);
+ xmlSequenceGenerator = sequenceGenerators.next();
+ assertEquals("BAZ", xmlSequenceGenerator.getName());
+ assertEquals(sequenceGenerator3, xmlSequenceGenerator);
+ assertFalse(sequenceGenerators.hasNext());
+
+
+ entityMappings().removeSequenceGenerator(1);
+ assertEquals("BAR", ormResource().getEntityMappings().getSequenceGenerators().get(0).getName());
+ sequenceGenerators = entityMappings().sequenceGenerators();
+ xmlSequenceGenerator = sequenceGenerators.next();
+ assertEquals("BAR", xmlSequenceGenerator.getName());
+ assertEquals(sequenceGenerator2, xmlSequenceGenerator);
+ assertFalse(sequenceGenerators.hasNext());
+
+
+ entityMappings().removeSequenceGenerator(0);
+ assertEquals(0, ormResource().getEntityMappings().getSequenceGenerators().size());
+ sequenceGenerators = entityMappings().sequenceGenerators();
+ assertFalse(sequenceGenerators.hasNext());
+ }
+
+ public void testMoveSequenceGenerator() throws Exception {
+ assertEquals(0, entityMappings().sequenceGeneratorsSize());
+ assertEquals(0, ormResource().getEntityMappings().getSequenceGenerators().size());
+
+ ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0);
+ sequenceGenerator.setName("FOO");
+ ISequenceGenerator sequenceGenerator2 = entityMappings().addSequenceGenerator(1);
+ sequenceGenerator2.setName("BAR");
+ ISequenceGenerator sequenceGenerator3 = entityMappings().addSequenceGenerator(2);
+ sequenceGenerator3.setName("BAZ");
+ assertEquals("FOO", ormResource().getEntityMappings().getSequenceGenerators().get(0).getName());
+ assertEquals("BAR", ormResource().getEntityMappings().getSequenceGenerators().get(1).getName());
+ assertEquals("BAZ", ormResource().getEntityMappings().getSequenceGenerators().get(2).getName());
+ assertEquals(3, ormResource().getEntityMappings().getSequenceGenerators().size());
+
+ entityMappings().moveSequenceGenerator(2, 0);
+ assertEquals("BAR", ormResource().getEntityMappings().getSequenceGenerators().get(0).getName());
+ assertEquals("BAZ", ormResource().getEntityMappings().getSequenceGenerators().get(1).getName());
+ assertEquals("FOO", ormResource().getEntityMappings().getSequenceGenerators().get(2).getName());
+ assertEquals(3, ormResource().getEntityMappings().getSequenceGenerators().size());
+
+ entityMappings().moveSequenceGenerator(0, 2);
+ assertEquals("FOO", ormResource().getEntityMappings().getSequenceGenerators().get(0).getName());
+ assertEquals("BAR", ormResource().getEntityMappings().getSequenceGenerators().get(1).getName());
+ assertEquals("BAZ", ormResource().getEntityMappings().getSequenceGenerators().get(2).getName());
+ assertEquals(3, ormResource().getEntityMappings().getSequenceGenerators().size());
+
+ }
+
+ public void testSequenceGeneratorsSize() throws Exception {
+ assertEquals(0, entityMappings().sequenceGeneratorsSize());
+ assertEquals(0, ormResource().getEntityMappings().getSequenceGenerators().size());
+
+
+ ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0);
+ sequenceGenerator.setName("FOO");
+ ISequenceGenerator sequenceGenerator2 = entityMappings().addSequenceGenerator(1);
+ sequenceGenerator2.setName("BAR");
+ ISequenceGenerator sequenceGenerator3 = entityMappings().addSequenceGenerator(2);
+ sequenceGenerator3.setName("BAZ");
+
+ assertEquals(3, entityMappings().sequenceGeneratorsSize());
+
+ ormResource().getEntityMappings().getSequenceGenerators().remove(0);
+ assertEquals(2, entityMappings().sequenceGeneratorsSize());
+ }
+
+
+ public void testAddNamedQuery() throws Exception {
+ XmlNamedQuery namedQuery = entityMappings().addNamedQuery(0);
+ namedQuery.setName("FOO");
+
+ assertEquals("FOO", ormResource().getEntityMappings().getNamedQueries().get(0).getName());
+
+ XmlNamedQuery namedQuery2 = entityMappings().addNamedQuery(0);
+ namedQuery2.setName("BAR");
+
+ assertEquals("BAR", ormResource().getEntityMappings().getNamedQueries().get(0).getName());
+ assertEquals("FOO", ormResource().getEntityMappings().getNamedQueries().get(1).getName());
+
+ XmlNamedQuery namedQuery3 = entityMappings().addNamedQuery(1);
+ namedQuery3.setName("BAZ");
+
+ assertEquals("BAR", ormResource().getEntityMappings().getNamedQueries().get(0).getName());
+ assertEquals("BAZ", ormResource().getEntityMappings().getNamedQueries().get(1).getName());
+ assertEquals("FOO", ormResource().getEntityMappings().getNamedQueries().get(2).getName());
+
+ ListIterator<XmlNamedQuery> namedQuerys = entityMappings().namedQueries();
+ assertEquals(namedQuery2, namedQuerys.next());
+ assertEquals(namedQuery3, namedQuerys.next());
+ assertEquals(namedQuery, namedQuerys.next());
+
+ namedQuerys = entityMappings().namedQueries();
+ assertEquals("BAR", namedQuerys.next().getName());
+ assertEquals("BAZ", namedQuerys.next().getName());
+ assertEquals("FOO", namedQuerys.next().getName());
+ }
+
+ public void testRemoveNamedQuery() throws Exception {
+ entityMappings().addNamedQuery(0).setName("FOO");
+ entityMappings().addNamedQuery(1).setName("BAR");
+ entityMappings().addNamedQuery(2).setName("BAZ");
+
+ assertEquals(3, ormResource().getEntityMappings().getNamedQueries().size());
+
+ entityMappings().removeNamedQuery(0);
+ assertEquals(2, ormResource().getEntityMappings().getNamedQueries().size());
+ assertEquals("BAR", ormResource().getEntityMappings().getNamedQueries().get(0).getName());
+ assertEquals("BAZ", ormResource().getEntityMappings().getNamedQueries().get(1).getName());
+
+ entityMappings().removeNamedQuery(0);
+ assertEquals(1, ormResource().getEntityMappings().getNamedQueries().size());
+ assertEquals("BAZ", ormResource().getEntityMappings().getNamedQueries().get(0).getName());
+
+ entityMappings().removeNamedQuery(0);
+ assertEquals(0, ormResource().getEntityMappings().getNamedQueries().size());
+ }
+
+ public void testMoveNamedQuery() throws Exception {
+ entityMappings().addNamedQuery(0).setName("FOO");
+ entityMappings().addNamedQuery(1).setName("BAR");
+ entityMappings().addNamedQuery(2).setName("BAZ");
+
+ assertEquals(3, ormResource().getEntityMappings().getNamedQueries().size());
+
+
+ entityMappings().moveNamedQuery(2, 0);
+ ListIterator<XmlNamedQuery> namedQuerys = entityMappings().namedQueries();
+ assertEquals("BAR", namedQuerys.next().getName());
+ assertEquals("BAZ", namedQuerys.next().getName());
+ assertEquals("FOO", namedQuerys.next().getName());
+
+ assertEquals("BAR", ormResource().getEntityMappings().getNamedQueries().get(0).getName());
+ assertEquals("BAZ", ormResource().getEntityMappings().getNamedQueries().get(1).getName());
+ assertEquals("FOO", ormResource().getEntityMappings().getNamedQueries().get(2).getName());
+
+
+ entityMappings().moveNamedQuery(0, 1);
+ namedQuerys = entityMappings().namedQueries();
+ assertEquals("BAZ", namedQuerys.next().getName());
+ assertEquals("BAR", namedQuerys.next().getName());
+ assertEquals("FOO", namedQuerys.next().getName());
+
+ assertEquals("BAZ", ormResource().getEntityMappings().getNamedQueries().get(0).getName());
+ assertEquals("BAR", ormResource().getEntityMappings().getNamedQueries().get(1).getName());
+ assertEquals("FOO", ormResource().getEntityMappings().getNamedQueries().get(2).getName());
+ }
+
+ public void testUpdateNamedQueries() throws Exception {
+ ormResource().getEntityMappings().getNamedQueries().add(OrmFactory.eINSTANCE.createNamedQuery());
+ ormResource().getEntityMappings().getNamedQueries().add(OrmFactory.eINSTANCE.createNamedQuery());
+ ormResource().getEntityMappings().getNamedQueries().add(OrmFactory.eINSTANCE.createNamedQuery());
+
+ ormResource().getEntityMappings().getNamedQueries().get(0).setName("FOO");
+ ormResource().getEntityMappings().getNamedQueries().get(1).setName("BAR");
+ ormResource().getEntityMappings().getNamedQueries().get(2).setName("BAZ");
+
+ ListIterator<XmlNamedQuery> namedQuerys = entityMappings().namedQueries();
+ assertEquals("FOO", namedQuerys.next().getName());
+ assertEquals("BAR", namedQuerys.next().getName());
+ assertEquals("BAZ", namedQuerys.next().getName());
+ assertFalse(namedQuerys.hasNext());
+
+ ormResource().getEntityMappings().getNamedQueries().move(2, 0);
+ namedQuerys = entityMappings().namedQueries();
+ assertEquals("BAR", namedQuerys.next().getName());
+ assertEquals("BAZ", namedQuerys.next().getName());
+ assertEquals("FOO", namedQuerys.next().getName());
+ assertFalse(namedQuerys.hasNext());
+
+ ormResource().getEntityMappings().getNamedQueries().move(0, 1);
+ namedQuerys = entityMappings().namedQueries();
+ assertEquals("BAZ", namedQuerys.next().getName());
+ assertEquals("BAR", namedQuerys.next().getName());
+ assertEquals("FOO", namedQuerys.next().getName());
+ assertFalse(namedQuerys.hasNext());
+
+ ormResource().getEntityMappings().getNamedQueries().remove(1);
+ namedQuerys = entityMappings().namedQueries();
+ assertEquals("BAZ", namedQuerys.next().getName());
+ assertEquals("FOO", namedQuerys.next().getName());
+ assertFalse(namedQuerys.hasNext());
+
+ ormResource().getEntityMappings().getNamedQueries().remove(1);
+ namedQuerys = entityMappings().namedQueries();
+ assertEquals("BAZ", namedQuerys.next().getName());
+ assertFalse(namedQuerys.hasNext());
+
+ ormResource().getEntityMappings().getNamedQueries().remove(0);
+ assertFalse(entityMappings().namedQueries().hasNext());
+ }
+
+ public void testAddNamedNativeQuery() throws Exception {
+ XmlNamedNativeQuery namedNativeQuery = entityMappings().addNamedNativeQuery(0);
+ namedNativeQuery.setName("FOO");
+
+ assertEquals("FOO", ormResource().getEntityMappings().getNamedNativeQueries().get(0).getName());
+
+ XmlNamedNativeQuery namedNativeQuery2 = entityMappings().addNamedNativeQuery(0);
+ namedNativeQuery2.setName("BAR");
+
+ assertEquals("BAR", ormResource().getEntityMappings().getNamedNativeQueries().get(0).getName());
+ assertEquals("FOO", ormResource().getEntityMappings().getNamedNativeQueries().get(1).getName());
+
+ XmlNamedNativeQuery namedNativeQuery3 = entityMappings().addNamedNativeQuery(1);
+ namedNativeQuery3.setName("BAZ");
+
+ assertEquals("BAR", ormResource().getEntityMappings().getNamedNativeQueries().get(0).getName());
+ assertEquals("BAZ", ormResource().getEntityMappings().getNamedNativeQueries().get(1).getName());
+ assertEquals("FOO", ormResource().getEntityMappings().getNamedNativeQueries().get(2).getName());
+
+ ListIterator<XmlNamedNativeQuery> namedNativeQuerys = entityMappings().namedNativeQueries();
+ assertEquals(namedNativeQuery2, namedNativeQuerys.next());
+ assertEquals(namedNativeQuery3, namedNativeQuerys.next());
+ assertEquals(namedNativeQuery, namedNativeQuerys.next());
+
+ namedNativeQuerys = entityMappings().namedNativeQueries();
+ assertEquals("BAR", namedNativeQuerys.next().getName());
+ assertEquals("BAZ", namedNativeQuerys.next().getName());
+ assertEquals("FOO", namedNativeQuerys.next().getName());
+ }
+
+ public void testRemoveNamedNativeQuery() throws Exception {
+ entityMappings().addNamedNativeQuery(0).setName("FOO");
+ entityMappings().addNamedNativeQuery(1).setName("BAR");
+ entityMappings().addNamedNativeQuery(2).setName("BAZ");
+
+ assertEquals(3, ormResource().getEntityMappings().getNamedNativeQueries().size());
+
+ entityMappings().removeNamedNativeQuery(0);
+ assertEquals(2, ormResource().getEntityMappings().getNamedNativeQueries().size());
+ assertEquals("BAR", ormResource().getEntityMappings().getNamedNativeQueries().get(0).getName());
+ assertEquals("BAZ", ormResource().getEntityMappings().getNamedNativeQueries().get(1).getName());
+
+ entityMappings().removeNamedNativeQuery(0);
+ assertEquals(1, ormResource().getEntityMappings().getNamedNativeQueries().size());
+ assertEquals("BAZ", ormResource().getEntityMappings().getNamedNativeQueries().get(0).getName());
+
+ entityMappings().removeNamedNativeQuery(0);
+ assertEquals(0, ormResource().getEntityMappings().getNamedNativeQueries().size());
+ }
+
+ public void testMoveNamedNativeQuery() throws Exception {
+ entityMappings().addNamedNativeQuery(0).setName("FOO");
+ entityMappings().addNamedNativeQuery(1).setName("BAR");
+ entityMappings().addNamedNativeQuery(2).setName("BAZ");
+
+ assertEquals(3, ormResource().getEntityMappings().getNamedNativeQueries().size());
+
+
+ entityMappings().moveNamedNativeQuery(2, 0);
+ ListIterator<XmlNamedNativeQuery> namedNativeQuerys = entityMappings().namedNativeQueries();
+ assertEquals("BAR", namedNativeQuerys.next().getName());
+ assertEquals("BAZ", namedNativeQuerys.next().getName());
+ assertEquals("FOO", namedNativeQuerys.next().getName());
+
+ assertEquals("BAR", ormResource().getEntityMappings().getNamedNativeQueries().get(0).getName());
+ assertEquals("BAZ", ormResource().getEntityMappings().getNamedNativeQueries().get(1).getName());
+ assertEquals("FOO", ormResource().getEntityMappings().getNamedNativeQueries().get(2).getName());
+
+
+ entityMappings().moveNamedNativeQuery(0, 1);
+ namedNativeQuerys = entityMappings().namedNativeQueries();
+ assertEquals("BAZ", namedNativeQuerys.next().getName());
+ assertEquals("BAR", namedNativeQuerys.next().getName());
+ assertEquals("FOO", namedNativeQuerys.next().getName());
+
+ assertEquals("BAZ", ormResource().getEntityMappings().getNamedNativeQueries().get(0).getName());
+ assertEquals("BAR", ormResource().getEntityMappings().getNamedNativeQueries().get(1).getName());
+ assertEquals("FOO", ormResource().getEntityMappings().getNamedNativeQueries().get(2).getName());
+ }
+
+ public void testUpdateNamedNativeQueries() throws Exception {
+ ormResource().getEntityMappings().getNamedNativeQueries().add(OrmFactory.eINSTANCE.createNamedNativeQuery());
+ ormResource().getEntityMappings().getNamedNativeQueries().add(OrmFactory.eINSTANCE.createNamedNativeQuery());
+ ormResource().getEntityMappings().getNamedNativeQueries().add(OrmFactory.eINSTANCE.createNamedNativeQuery());
+
+ ormResource().getEntityMappings().getNamedNativeQueries().get(0).setName("FOO");
+ ormResource().getEntityMappings().getNamedNativeQueries().get(1).setName("BAR");
+ ormResource().getEntityMappings().getNamedNativeQueries().get(2).setName("BAZ");
+
+ ListIterator<XmlNamedNativeQuery> namedNativeQuerys = entityMappings().namedNativeQueries();
+ assertEquals("FOO", namedNativeQuerys.next().getName());
+ assertEquals("BAR", namedNativeQuerys.next().getName());
+ assertEquals("BAZ", namedNativeQuerys.next().getName());
+ assertFalse(namedNativeQuerys.hasNext());
+
+ ormResource().getEntityMappings().getNamedNativeQueries().move(2, 0);
+ namedNativeQuerys = entityMappings().namedNativeQueries();
+ assertEquals("BAR", namedNativeQuerys.next().getName());
+ assertEquals("BAZ", namedNativeQuerys.next().getName());
+ assertEquals("FOO", namedNativeQuerys.next().getName());
+ assertFalse(namedNativeQuerys.hasNext());
+
+ ormResource().getEntityMappings().getNamedNativeQueries().move(0, 1);
+ namedNativeQuerys = entityMappings().namedNativeQueries();
+ assertEquals("BAZ", namedNativeQuerys.next().getName());
+ assertEquals("BAR", namedNativeQuerys.next().getName());
+ assertEquals("FOO", namedNativeQuerys.next().getName());
+ assertFalse(namedNativeQuerys.hasNext());
+
+ ormResource().getEntityMappings().getNamedNativeQueries().remove(1);
+ namedNativeQuerys = entityMappings().namedNativeQueries();
+ assertEquals("BAZ", namedNativeQuerys.next().getName());
+ assertEquals("FOO", namedNativeQuerys.next().getName());
+ assertFalse(namedNativeQuerys.hasNext());
+
+ ormResource().getEntityMappings().getNamedNativeQueries().remove(1);
+ namedNativeQuerys = entityMappings().namedNativeQueries();
+ assertEquals("BAZ", namedNativeQuerys.next().getName());
+ assertFalse(namedNativeQuerys.hasNext());
+
+ ormResource().getEntityMappings().getNamedNativeQueries().remove(0);
+ assertFalse(entityMappings().namedNativeQueries().hasNext());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/JptCoreOrmContextModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/JptCoreOrmContextModelTests.java
new file mode 100644
index 0000000000..d84fcd30ac
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/JptCoreOrmContextModelTests.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class JptCoreOrmContextModelTests extends TestCase
+{
+ public static Test suite() {
+ return suite(true);
+ }
+
+ public static Test suite(boolean all) {
+ TestSuite suite = new TestSuite(JptCoreOrmContextModelTests.class.getName());
+ suite.addTestSuite(OrmXmlTests.class);
+ suite.addTestSuite(EntityMappingsTests.class);
+ suite.addTestSuite(PersistenceUnitMetadataTests.class);
+ suite.addTestSuite(PersistenceUnitDefaultsTests.class);
+ suite.addTestSuite(XmlPersistentTypeTests.class);
+ suite.addTestSuite(XmlAssociationOverrideTests.class);
+ suite.addTestSuite(XmlAttributeOverrideTests.class);
+ suite.addTestSuite(XmlBasicMappingTests.class);
+ suite.addTestSuite(XmlCascadeTests.class);
+ suite.addTestSuite(XmlColumnTests.class);
+ suite.addTestSuite(XmlDiscriminatorColumnTests.class);
+ suite.addTestSuite(XmlIdMappingTests.class);
+ suite.addTestSuite(XmlEmbeddableTests.class);
+ suite.addTestSuite(XmlEmbeddedMappingTests.class);
+ suite.addTestSuite(XmlEmbeddedIdMappingTests.class);
+ suite.addTestSuite(XmlEntityTests.class);
+ suite.addTestSuite(XmlGeneratedValueTests.class);
+ suite.addTestSuite(XmlJoinColumnTests.class);
+ suite.addTestSuite(XmlJoinTableTests.class);
+ suite.addTestSuite(XmlMappedSuperclassTests.class);
+ suite.addTestSuite(XmlManyToManyMappingTests.class);
+ suite.addTestSuite(XmlManyToOneMappingTests.class);
+ suite.addTestSuite(XmlNamedQueryTests.class);
+ suite.addTestSuite(XmlNamedNativeQueryTests.class);
+ suite.addTestSuite(XmlOneToManyMappingTests.class);
+ suite.addTestSuite(XmlOneToOneMappingTests.class);
+ suite.addTestSuite(XmlPrimaryKeyJoinColumnTests.class);
+ suite.addTestSuite(XmlQueryHintTests.class);
+ suite.addTestSuite(XmlSecondaryTableTests.class);
+ suite.addTestSuite(XmlSequenceGeneratorTests.class);
+ suite.addTestSuite(XmlTableGeneratorTests.class);
+ suite.addTestSuite(XmlTableTests.class);
+ suite.addTestSuite(XmlTransientMappingTests.class);
+ suite.addTestSuite(XmlVersionMappingTests.class);
+ return suite;
+ }
+
+ private JptCoreOrmContextModelTests() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java
new file mode 100644
index 0000000000..df86346e9b
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.IPersistenceXml;
+import org.eclipse.jpt.core.internal.context.orm.OrmXml;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.OrmResource;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class OrmXmlTests extends ContextModelTestCase
+{
+ public OrmXmlTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ xmlPersistenceUnit().setName("foo");
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ protected IPersistenceXml persistenceXml() {
+ return jpaContent().getPersistenceXml();
+ }
+
+ protected OrmXml ormXml() {
+ return persistenceUnit().mappingFileRefs().next().getOrmXml();
+ }
+
+ public void testUpdateAddEntityMappings() throws Exception {
+ OrmResource ormResource = ormResource();
+ ormResource.getContents().clear();
+ ormResource.save(null);
+
+ assertNull(ormXml().getEntityMappings());
+
+ ormResource.getContents().add(OrmFactory.eINSTANCE.createEntityMappings());
+
+ assertNotNull(ormXml().getEntityMappings());
+
+ }
+
+ public void testModifyAddEntityMappings() {
+ OrmResource ormResource = ormResource();
+ ormResource.getContents().remove(ormResource.getEntityMappings());
+ assertNull(ormResource.getEntityMappings());
+
+ OrmXml ormXml = ormXml();
+ assertNull(ormXml.getEntityMappings());
+
+ ormXml.addEntityMappings();
+
+ assertNotNull(ormXml.getEntityMappings());
+
+ boolean exceptionThrown = false;
+ try {
+ ormXml.addEntityMappings();
+ }
+ catch (IllegalStateException ise) {
+ exceptionThrown = true;
+ }
+
+ assertTrue("IllegalStateException was not thrown", exceptionThrown);
+ }
+
+ public void testUpdateRemoveEntityMappings() throws Exception {
+ OrmResource ormResource = ormResource();
+
+ assertNotNull(ormXml().getEntityMappings());
+
+ ormResource.getContents().clear();
+
+ assertNull(ormXml().getEntityMappings());
+ }
+
+ public void testModifyRemoveEntityMappings() {
+ OrmXml ormXml = ormXml();
+
+ assertNotNull(ormXml.getEntityMappings());
+
+ ormXml.removeEntityMappings();
+
+ assertNull(ormXml.getEntityMappings());
+
+ boolean exceptionThrown = false;
+ try {
+ ormXml.removeEntityMappings();
+ }
+ catch (IllegalStateException ise) {
+ exceptionThrown = true;
+ }
+
+ assertTrue("IllegalStateException was not thrown", exceptionThrown);
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java
new file mode 100644
index 0000000000..f699940f3c
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java
@@ -0,0 +1,369 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.orm.PersistenceUnitDefaults;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class PersistenceUnitDefaultsTests extends ContextModelTestCase
+{
+ public PersistenceUnitDefaultsTests(String name) {
+ super(name);
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ protected PersistenceUnitDefaults persistenceUnitDefaults() {
+ return entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults();
+ }
+
+ public void testIsAllFeaturesUnset() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertNull(persistenceUnitDefaults.getAccess());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+
+ PersistenceUnitMetadata persistenceUnitMetadata = OrmFactory.eINSTANCE.createPersistenceUnitMetadata();
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(persistenceUnitMetadata);
+ assertTrue(persistenceUnitMetadata.isAllFeaturesUnset());
+
+ org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults persistenceUnitDefaultsResource = OrmFactory.eINSTANCE.createPersistenceUnitDefaults();
+ persistenceUnitMetadata.setPersistenceUnitDefaults(persistenceUnitDefaultsResource);
+ assertTrue(persistenceUnitDefaultsResource.isAllFeaturesUnset());
+
+ persistenceUnitDefaultsResource.setCascadePersist(true);
+ assertFalse(persistenceUnitDefaultsResource.isAllFeaturesUnset());
+
+ persistenceUnitDefaultsResource.setCascadePersist(false);
+ assertTrue(persistenceUnitDefaultsResource.isAllFeaturesUnset());
+
+ persistenceUnitDefaultsResource.setSchema("asdf");
+ assertFalse(persistenceUnitDefaultsResource.isAllFeaturesUnset());
+
+ persistenceUnitDefaultsResource.setSchema(null);
+ assertTrue(persistenceUnitDefaultsResource.isAllFeaturesUnset());
+
+ persistenceUnitDefaultsResource.setCatalog("asdf");
+ assertFalse(persistenceUnitDefaultsResource.isAllFeaturesUnset());
+
+ persistenceUnitDefaultsResource.setCatalog(null);
+ assertTrue(persistenceUnitDefaultsResource.isAllFeaturesUnset());
+
+
+ persistenceUnitDefaultsResource.setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY);
+ assertFalse(persistenceUnitDefaultsResource.isAllFeaturesUnset());
+
+ persistenceUnitDefaultsResource.setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD);
+ assertFalse(persistenceUnitDefaultsResource.isAllFeaturesUnset());
+
+ persistenceUnitDefaultsResource.setAccess(null);
+ assertTrue(persistenceUnitDefaultsResource.isAllFeaturesUnset());
+ }
+
+ public void testUpdateSchema() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertNull(persistenceUnitDefaults.getSchema());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+
+ //set schema in the resource model, verify context model updated
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createPersistenceUnitDefaults());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema("MY_SCHEMA");
+ assertEquals("MY_SCHEMA", persistenceUnitDefaults.getSchema());
+ assertEquals("MY_SCHEMA", ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
+
+ //set schema to null in the resource model
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema(null);
+ assertNull(persistenceUnitDefaults.getSchema());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
+ }
+
+ public void testModifySchema() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertNull(persistenceUnitDefaults.getSchema());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+
+ //set schema in the context model, verify resource model modified
+ persistenceUnitDefaults.setSchema("MY_SCHEMA");
+ assertEquals("MY_SCHEMA", persistenceUnitDefaults.getSchema());
+ assertEquals("MY_SCHEMA", ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
+
+ //set schema to null in the context model
+ persistenceUnitDefaults.setSchema(null);
+ assertNull(persistenceUnitDefaults.getSchema());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+ }
+
+ public void testModifySchema2() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertNull(persistenceUnitDefaults.getSchema());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+
+ //set schema in the context model, verify resource model modified
+ persistenceUnitDefaults.setSchema("MY_SCHEMA");
+ assertEquals("MY_SCHEMA", persistenceUnitDefaults.getSchema());
+ assertEquals("MY_SCHEMA", ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
+
+ //set another element on the persistence-unit-defaults element so it doesn't get removed
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("MY_CATALOG");
+ //set schema to null in the context model
+ persistenceUnitDefaults.setSchema(null);
+ assertNull(persistenceUnitDefaults.getSchema());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
+ }
+
+ public void testModifySchema3() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertNull(persistenceUnitDefaults.getSchema());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+ //set another element on the persistence-unit-metadata element so only persistence-unit-defaults element gets removed
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+
+ //set schema in the context model, verify resource model modified
+ persistenceUnitDefaults.setSchema("MY_SCHEMA");
+ assertEquals("MY_SCHEMA", persistenceUnitDefaults.getSchema());
+ assertEquals("MY_SCHEMA", ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getSchema());
+
+ //set schema to null in the context model
+ persistenceUnitDefaults.setSchema(null);
+ assertNull(persistenceUnitDefaults.getSchema());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults());
+ }
+
+ public void testUpdateCatalog() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertNull(persistenceUnitDefaults.getCatalog());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+
+ //set catalog in the resource model, verify context model updated
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createPersistenceUnitDefaults());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("MY_CATALOG");
+ assertEquals("MY_CATALOG", persistenceUnitDefaults.getCatalog());
+ assertEquals("MY_CATALOG", ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
+
+ //set catalog to null in the resource model
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog(null);
+ assertNull(persistenceUnitDefaults.getCatalog());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
+ }
+
+ public void testModifyCatalog() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertNull(persistenceUnitDefaults.getCatalog());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+
+ //set catalog in the context model, verify resource model modified
+ persistenceUnitDefaults.setCatalog("MY_CATALOG");
+ assertEquals("MY_CATALOG", persistenceUnitDefaults.getCatalog());
+ assertEquals("MY_CATALOG", ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
+
+ //set catalog to null in the context model
+ persistenceUnitDefaults.setCatalog(null);
+ assertNull(persistenceUnitDefaults.getCatalog());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+ }
+
+ public void testModifyCatalog2() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertNull(persistenceUnitDefaults.getCatalog());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+
+ //set catalog in the context model, verify resource model modified
+ persistenceUnitDefaults.setCatalog("MY_CATALOG");
+ assertEquals("MY_CATALOG", persistenceUnitDefaults.getCatalog());
+ assertEquals("MY_CATALOG", ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
+
+ //set another element on the persistence-unit-defaults element so it doesn't get removed
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema("MY_SCHEMA");
+ //set catalog to null in the context model
+ persistenceUnitDefaults.setCatalog(null);
+ assertNull(persistenceUnitDefaults.getCatalog());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
+ }
+
+ public void testModifyCatalog3() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertNull(persistenceUnitDefaults.getCatalog());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+ //set another element on the persistence-unit-metadata element so only persistence-unit-defaults element gets removed
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+
+ //set catalog in the context model, verify resource model modified
+ persistenceUnitDefaults.setCatalog("MY_CATALOG");
+ assertEquals("MY_CATALOG", persistenceUnitDefaults.getCatalog());
+ assertEquals("MY_CATALOG", ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getCatalog());
+
+ //set catalog to null in the context model
+ persistenceUnitDefaults.setCatalog(null);
+ assertNull(persistenceUnitDefaults.getCatalog());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults());
+ }
+
+ public void testUpdateCascadePersist() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertFalse(persistenceUnitDefaults.isCascadePersist());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+
+ //set cascadePersist in the resource model, verify context model updated
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createPersistenceUnitDefaults());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCascadePersist(true);
+ assertTrue(persistenceUnitDefaults.isCascadePersist());
+ assertTrue(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
+
+ //set cascadePersist to null in the resource model, persistence-unit-defaults tag not removed
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCascadePersist(false);
+ assertFalse(persistenceUnitDefaults.isCascadePersist());
+ assertFalse(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
+ }
+
+ public void testModifyCascadePersist() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertFalse(persistenceUnitDefaults.isCascadePersist());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+
+ //set cascadePersist in the context model, verify resource model modified
+ persistenceUnitDefaults.setCascadePersist(true);
+ assertTrue(persistenceUnitDefaults.isCascadePersist());
+ assertTrue(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
+
+ //set cascadePersist to null in the context model
+ persistenceUnitDefaults.setCascadePersist(false);
+ assertFalse(persistenceUnitDefaults.isCascadePersist());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+ }
+
+ public void testModifyCascadePersist2() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertFalse(persistenceUnitDefaults.isCascadePersist());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+
+ //set cascadePersist in the context model, verify resource model modified
+ persistenceUnitDefaults.setCascadePersist(true);
+ assertTrue(persistenceUnitDefaults.isCascadePersist());
+ assertTrue(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
+
+ //set another element on the persistence-unit-defaults element so it doesn't get removed
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("MY_CATALOG");
+ //set cascadePersist to null in the context model
+ persistenceUnitDefaults.setCascadePersist(false);
+ assertFalse(persistenceUnitDefaults.isCascadePersist());
+ assertFalse(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
+ }
+
+ public void testModifyCascadePersist3() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertFalse(persistenceUnitDefaults.isCascadePersist());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+ //set another element on the persistence-unit-metadata element so only persistence-unit-defaults element gets removed
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+
+ //set cascadePersist in the context model, verify resource model modified
+ persistenceUnitDefaults.setCascadePersist(true);
+ assertTrue(persistenceUnitDefaults.isCascadePersist());
+ assertTrue(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().isCascadePersist());
+
+ //set cascadePersist to null in the context model
+ persistenceUnitDefaults.setCascadePersist(false);
+ assertFalse(persistenceUnitDefaults.isCascadePersist());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults());
+ }
+
+
+ public void testUpdateAccess() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertNull(persistenceUnitDefaults.getAccess());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+
+ //set access in the resource model, verify context model updated
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createPersistenceUnitDefaults());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD);
+ assertEquals(AccessType.FIELD, persistenceUnitDefaults.getAccess());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD, ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
+
+ //set access to null in the resource model
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(null);
+ assertNull(persistenceUnitDefaults.getAccess());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
+ }
+
+ public void testModifyAccess() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertNull(persistenceUnitDefaults.getAccess());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+
+ //set access in the context model, verify resource model modified
+ persistenceUnitDefaults.setAccess(AccessType.PROPERTY);
+ assertEquals(AccessType.PROPERTY, persistenceUnitDefaults.getAccess());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
+
+ //set access to null in the context model
+ persistenceUnitDefaults.setAccess(null);
+ assertNull(persistenceUnitDefaults.getAccess());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+ }
+
+ public void testModifyAccess2() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertNull(persistenceUnitDefaults.getAccess());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+
+ //set access in the context model, verify resource model modified
+ persistenceUnitDefaults.setAccess(AccessType.FIELD);
+ assertEquals(AccessType.FIELD, persistenceUnitDefaults.getAccess());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD, ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
+
+ //set another element on the persistence-unit-defaults element so it doesn't get removed
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCascadePersist(true);
+ //set access to null in the context model
+ persistenceUnitDefaults.setAccess(null);
+ assertNull(persistenceUnitDefaults.getAccess());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
+ }
+
+ public void testModifyAccess3() throws Exception {
+ PersistenceUnitDefaults persistenceUnitDefaults = persistenceUnitDefaults();
+ assertNull(persistenceUnitDefaults.getAccess());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+ //set another element on the persistence-unit-metadata element so only persistence-unit-defaults element gets removed
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+
+ //set access in the context model, verify resource model modified
+ persistenceUnitDefaults.setAccess(AccessType.FIELD);
+ assertEquals(AccessType.FIELD, persistenceUnitDefaults.getAccess());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD, ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess());
+
+ //set access to null in the context model
+ persistenceUnitDefaults.setAccess(null);
+ assertNull(persistenceUnitDefaults.getAccess());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults());
+ }
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java
new file mode 100644
index 0000000000..f42fb493fb
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.PersistenceUnitMetadata;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class PersistenceUnitMetadataTests extends ContextModelTestCase
+{
+ public PersistenceUnitMetadataTests(String name) {
+ super(name);
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ protected PersistenceUnitMetadata persistenceUnitMetadata() {
+ return entityMappings().getPersistenceUnitMetadata();
+ }
+
+ public void testIsAllFeaturesUnset() throws Exception {
+ org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata persistenceUnitMetadata = OrmFactory.eINSTANCE.createPersistenceUnitMetadata();
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(persistenceUnitMetadata);
+ assertTrue(persistenceUnitMetadata.isAllFeaturesUnset());
+
+ persistenceUnitMetadata.setXmlMappingMetadataComplete(true);
+ assertFalse(persistenceUnitMetadata.isAllFeaturesUnset());
+
+ persistenceUnitMetadata.setXmlMappingMetadataComplete(false);
+ assertTrue(persistenceUnitMetadata.isAllFeaturesUnset());
+
+ persistenceUnitMetadata.setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createPersistenceUnitDefaults());
+ assertFalse(persistenceUnitMetadata.isAllFeaturesUnset());
+ }
+
+ public void testUpdateXmlMappingMetadataComplete() throws Exception {
+ PersistenceUnitMetadata persistenceUnitMetadata = entityMappings().getPersistenceUnitMetadata();
+ assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+
+ //set xmlMappingMetadataComplete in the resource model, verify context model updated
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ assertTrue(persistenceUnitMetadata.isXmlMappingMetadataComplete());
+ assertTrue(ormResource().getEntityMappings().getPersistenceUnitMetadata().isXmlMappingMetadataComplete());
+
+ //set xmlMappingMetadataComplete to null in the resource model
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+ assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
+ assertFalse(ormResource().getEntityMappings().getPersistenceUnitMetadata().isXmlMappingMetadataComplete());
+ }
+
+ public void testModifyXmlMappingMetadataComplete() throws Exception {
+ PersistenceUnitMetadata persistenceUnitMetadata = entityMappings().getPersistenceUnitMetadata();
+ assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+
+ //set xmlMappingMetadataComplete in the context model, verify resource model modified
+ persistenceUnitMetadata.setXmlMappingMetadataComplete(true);
+ assertTrue(persistenceUnitMetadata.isXmlMappingMetadataComplete());
+ assertTrue(ormResource().getEntityMappings().getPersistenceUnitMetadata().isXmlMappingMetadataComplete());
+
+ //set xmlMappingMetadataComplete to null in the context model
+ persistenceUnitMetadata.setXmlMappingMetadataComplete(false);
+ assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+ }
+
+ public void testModifyXmlMappingMetadataComplete2() throws Exception {
+ PersistenceUnitMetadata persistenceUnitMetadata = entityMappings().getPersistenceUnitMetadata();
+ assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
+ assertNull(ormResource().getEntityMappings().getPersistenceUnitMetadata());
+
+ //set xmlMappingMetadataComplete in the context model, verify resource model modified
+ persistenceUnitMetadata.setXmlMappingMetadataComplete(true);
+ assertTrue(persistenceUnitMetadata.isXmlMappingMetadataComplete());
+ assertTrue(ormResource().getEntityMappings().getPersistenceUnitMetadata().isXmlMappingMetadataComplete());
+
+ //set xmlMappingMetadataComplete to null in the context model
+ //set another element on the persistence-unit-metadata element so it doesn't get removed
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createPersistenceUnitDefaults());
+ persistenceUnitMetadata.setXmlMappingMetadataComplete(false);
+ assertFalse(persistenceUnitMetadata.isXmlMappingMetadataComplete());
+ assertFalse(ormResource().getEntityMappings().getPersistenceUnitMetadata().isXmlMappingMetadataComplete());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlAssociationOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlAssociationOverrideTests.java
new file mode 100644
index 0000000000..3d93beb16a
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlAssociationOverrideTests.java
@@ -0,0 +1,251 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.tests.internal.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.XmlAssociationOverride;
+import org.eclipse.jpt.core.internal.context.orm.XmlEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlJoinColumn;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.orm.AssociationOverride;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class XmlAssociationOverrideTests extends ContextModelTestCase
+{
+ public XmlAssociationOverrideTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ public void testUpdateName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlAssociationOverride xmlAssociationOverride = xmlEntity.addSpecifiedAssociationOverride(0);
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ AssociationOverride associationOverrideResource = entityResource.getAssociationOverrides().get(0);
+
+ assertNull(xmlAssociationOverride.getName());
+ assertNull(associationOverrideResource.getName());
+ assertTrue(xmlEntity.associationOverrides().hasNext());
+ assertFalse(entityResource.getAssociationOverrides().isEmpty());
+
+ //set name in the resource model, verify context model updated
+ associationOverrideResource.setName("FOO");
+ ormResource().save(null);
+ assertEquals("FOO", xmlAssociationOverride.getName());
+ assertEquals("FOO", associationOverrideResource.getName());
+
+ //set name to null in the resource model
+ associationOverrideResource.setName(null);
+ ormResource().save(null);
+ assertNull(xmlAssociationOverride.getName());
+ assertNull(associationOverrideResource.getName());
+
+ associationOverrideResource.setName("FOO");
+ assertEquals("FOO", xmlAssociationOverride.getName());
+ assertEquals("FOO", associationOverrideResource.getName());
+
+ entityResource.getAssociationOverrides().remove(0);
+ ormResource().save(null);
+ assertFalse(xmlEntity.associationOverrides().hasNext());
+ assertTrue(entityResource.getAssociationOverrides().isEmpty());
+ }
+
+ public void testModifyName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlAssociationOverride xmlAssociationOverride = xmlEntity.addSpecifiedAssociationOverride(0);
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ AssociationOverride associationOverrideResource = entityResource.getAssociationOverrides().get(0);
+
+ assertNull(xmlAssociationOverride.getName());
+ assertNull(associationOverrideResource.getName());
+
+ //set name in the context model, verify resource model modified
+ xmlAssociationOverride.setName("foo");
+ assertEquals("foo", xmlAssociationOverride.getName());
+ assertEquals("foo", associationOverrideResource.getName());
+
+ //set name to null in the context model
+ xmlAssociationOverride.setName(null);
+ assertNull(xmlAssociationOverride.getName());
+ assertNull(entityResource.getAssociationOverrides().get(0).getName());
+ }
+
+
+ public void testAddSpecifiedJoinColumn() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlAssociationOverride associationOverride = xmlEntity.addSpecifiedAssociationOverride(0);
+
+ AssociationOverride associationOverrideResource = ormResource().getEntityMappings().getEntities().get(0).getAssociationOverrides().get(0);
+
+ XmlJoinColumn joinColumn = associationOverride.addSpecifiedJoinColumn(0);
+ joinColumn.setSpecifiedName("FOO");
+
+ assertEquals("FOO", associationOverrideResource.getJoinColumns().get(0).getName());
+
+ XmlJoinColumn joinColumn2 = associationOverride.addSpecifiedJoinColumn(0);
+ ormResource().save(null);
+ joinColumn2.setSpecifiedName("BAR");
+ ormResource().save(null);
+
+ assertEquals("BAR", associationOverrideResource.getJoinColumns().get(0).getName());
+ assertEquals("FOO", associationOverrideResource.getJoinColumns().get(1).getName());
+
+ XmlJoinColumn joinColumn3 = associationOverride.addSpecifiedJoinColumn(1);
+ ormResource().save(null);
+ joinColumn3.setSpecifiedName("BAZ");
+ ormResource().save(null);
+
+ assertEquals("BAR", associationOverrideResource.getJoinColumns().get(0).getName());
+ assertEquals("BAZ", associationOverrideResource.getJoinColumns().get(1).getName());
+ assertEquals("FOO", associationOverrideResource.getJoinColumns().get(2).getName());
+
+ ListIterator<XmlJoinColumn> joinColumns = associationOverride.specifiedJoinColumns();
+ assertEquals(joinColumn2, joinColumns.next());
+ assertEquals(joinColumn3, joinColumns.next());
+ assertEquals(joinColumn, joinColumns.next());
+
+ joinColumns = associationOverride.specifiedJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ }
+
+ public void testRemoveSpecifiedJoinColumn() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlAssociationOverride associationOverride = xmlEntity.addSpecifiedAssociationOverride(0);
+
+ AssociationOverride associationOverrideResource = ormResource().getEntityMappings().getEntities().get(0).getAssociationOverrides().get(0);
+
+ associationOverride.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ associationOverride.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
+ associationOverride.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
+
+ assertEquals(3, associationOverrideResource.getJoinColumns().size());
+
+ associationOverride.removeSpecifiedJoinColumn(0);
+ assertEquals(2, associationOverrideResource.getJoinColumns().size());
+ assertEquals("BAR", associationOverrideResource.getJoinColumns().get(0).getName());
+ assertEquals("BAZ", associationOverrideResource.getJoinColumns().get(1).getName());
+
+ associationOverride.removeSpecifiedJoinColumn(0);
+ assertEquals(1, associationOverrideResource.getJoinColumns().size());
+ assertEquals("BAZ", associationOverrideResource.getJoinColumns().get(0).getName());
+
+ associationOverride.removeSpecifiedJoinColumn(0);
+ assertEquals(0, associationOverrideResource.getJoinColumns().size());
+ }
+
+ public void testMoveSpecifiedJoinColumn() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlAssociationOverride associationOverride = xmlEntity.addSpecifiedAssociationOverride(0);
+
+ AssociationOverride associationOverrideResource = ormResource().getEntityMappings().getEntities().get(0).getAssociationOverrides().get(0);
+
+ associationOverride.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ associationOverride.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
+ associationOverride.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
+
+ assertEquals(3, associationOverrideResource.getJoinColumns().size());
+
+
+ associationOverride.moveSpecifiedJoinColumn(2, 0);
+ ListIterator<XmlJoinColumn> joinColumns = associationOverride.specifiedJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+
+ assertEquals("BAR", associationOverrideResource.getJoinColumns().get(0).getName());
+ assertEquals("BAZ", associationOverrideResource.getJoinColumns().get(1).getName());
+ assertEquals("FOO", associationOverrideResource.getJoinColumns().get(2).getName());
+
+
+ associationOverride.moveSpecifiedJoinColumn(0, 1);
+ joinColumns = associationOverride.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+
+ assertEquals("BAZ", associationOverrideResource.getJoinColumns().get(0).getName());
+ assertEquals("BAR", associationOverrideResource.getJoinColumns().get(1).getName());
+ assertEquals("FOO", associationOverrideResource.getJoinColumns().get(2).getName());
+ }
+
+ public void testUpdateJoinColumns() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlAssociationOverride associationOverride = xmlEntity.addSpecifiedAssociationOverride(0);
+
+ AssociationOverride associationOverrideResource = ormResource().getEntityMappings().getEntities().get(0).getAssociationOverrides().get(0);
+
+ associationOverrideResource.getJoinColumns().add(OrmFactory.eINSTANCE.createJoinColumnImpl());
+ associationOverrideResource.getJoinColumns().add(OrmFactory.eINSTANCE.createJoinColumnImpl());
+ associationOverrideResource.getJoinColumns().add(OrmFactory.eINSTANCE.createJoinColumnImpl());
+
+ associationOverrideResource.getJoinColumns().get(0).setName("FOO");
+ associationOverrideResource.getJoinColumns().get(1).setName("BAR");
+ associationOverrideResource.getJoinColumns().get(2).setName("BAZ");
+
+ ListIterator<XmlJoinColumn> joinColumns = associationOverride.specifiedJoinColumns();
+ assertEquals("FOO", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ associationOverrideResource.getJoinColumns().move(2, 0);
+ joinColumns = associationOverride.specifiedJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ associationOverrideResource.getJoinColumns().move(0, 1);
+ joinColumns = associationOverride.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ associationOverrideResource.getJoinColumns().remove(1);
+ joinColumns = associationOverride.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ associationOverrideResource.getJoinColumns().remove(1);
+ joinColumns = associationOverride.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ associationOverrideResource.getJoinColumns().remove(0);
+ assertFalse(associationOverride.specifiedJoinColumns().hasNext());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlAttributeOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlAttributeOverrideTests.java
new file mode 100644
index 0000000000..62386c663c
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlAttributeOverrideTests.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.XmlAttributeOverride;
+import org.eclipse.jpt.core.internal.context.orm.XmlEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.orm.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class XmlAttributeOverrideTests extends ContextModelTestCase
+{
+ public XmlAttributeOverrideTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ public void testUpdateName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlAttributeOverride xmlAttributeOverride = xmlEntity.addSpecifiedAttributeOverride(0);
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ AttributeOverride attributeOverrideResource = entityResource.getAttributeOverrides().get(0);
+
+ assertNull(xmlAttributeOverride.getName());
+ assertNull(attributeOverrideResource.getName());
+ assertTrue(xmlEntity.attributeOverrides().hasNext());
+ assertFalse(entityResource.getAttributeOverrides().isEmpty());
+
+ //set name in the resource model, verify context model updated
+ attributeOverrideResource.setName("FOO");
+ ormResource().save(null);
+ assertEquals("FOO", xmlAttributeOverride.getName());
+ assertEquals("FOO", attributeOverrideResource.getName());
+
+ //set name to null in the resource model
+ attributeOverrideResource.setName(null);
+ ormResource().save(null);
+ assertNull(xmlAttributeOverride.getName());
+ assertNull(attributeOverrideResource.getName());
+
+ attributeOverrideResource.setName("FOO");
+ assertEquals("FOO", xmlAttributeOverride.getName());
+ assertEquals("FOO", attributeOverrideResource.getName());
+
+ entityResource.getAttributeOverrides().remove(0);
+ ormResource().save(null);
+ assertFalse(xmlEntity.attributeOverrides().hasNext());
+ assertTrue(entityResource.getAttributeOverrides().isEmpty());
+ }
+
+ public void testModifyName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlAttributeOverride xmlAttributeOverride = xmlEntity.addSpecifiedAttributeOverride(0);
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ AttributeOverride attributeOverrideResource = entityResource.getAttributeOverrides().get(0);
+
+ assertNull(xmlAttributeOverride.getName());
+ assertNull(attributeOverrideResource.getName());
+
+ //set name in the context model, verify resource model modified
+ xmlAttributeOverride.setName("foo");
+ assertEquals("foo", xmlAttributeOverride.getName());
+ assertEquals("foo", attributeOverrideResource.getName());
+
+ //set name to null in the context model
+ xmlAttributeOverride.setName(null);
+ assertNull(xmlAttributeOverride.getName());
+ assertNull(entityResource.getAttributeOverrides().get(0).getName());
+ }
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlBasicMappingTests.java
new file mode 100644
index 0000000000..c1a5d314b5
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlBasicMappingTests.java
@@ -0,0 +1,568 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.EnumType;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.base.TemporalType;
+import org.eclipse.jpt.core.internal.context.orm.XmlBasicMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlColumn;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.orm.Basic;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class XmlBasicMappingTests extends ContextModelTestCase
+{
+ public XmlBasicMappingTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createBasicAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Basic", "FetchType fetch() default EAGER; boolean optional() default true;");
+ }
+
+ private void createColumnAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Column",
+ "String name() default \"\";" +
+ "boolean unique() default false;" +
+ "boolean nullable() default true;" +
+ "boolean insertable() default true;" +
+ "boolean updatable() default true;" +
+ "String columnDefinition() default \"\";" +
+ "String table() default \"\";" +
+ "int length() default 255;" +
+ "int precision() default 0;" +
+ "int scale() default 0;");
+ }
+
+ private void createLobAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Lob", "");
+ }
+
+ private void createEnumeratedAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Enumerated", "EnumType value() default ORDINAL;");
+ }
+
+ private void createTemporalAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Temporal", "TemporalType value();");
+ }
+
+ private IType createTestEntityBasicMapping() throws Exception {
+ createEntityAnnotation();
+ createBasicAnnotation();
+ createColumnAnnotation();
+ createLobAnnotation();
+ createTemporalAnnotation();
+ createEnumeratedAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.BASIC, JPA.FETCH_TYPE, JPA.COLUMN, JPA.LOB, JPA.TEMPORAL, JPA.TEMPORAL_TYPE, JPA.ENUMERATED, JPA.ENUM_TYPE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Basic(fetch=FetchType.LAZY, optional=false)");
+ sb.append(CR);
+ sb.append(" @Column(name=\"MY_COLUMN\", unique=true, nullable=false, insertable=false, updatable=false, columnDefinition=\"COLUMN_DEFINITION\", table=\"MY_TABLE\", length=5, precision=6, scale=7)");
+ sb.append(CR);
+ sb.append(" @Lob");
+ sb.append(CR);
+ sb.append(" @Temporal(TemporalType.TIMESTAMP)");
+ sb.append(CR);
+ sb.append(" @Enumerated(EnumType.STRING)");
+ }
+ });
+ }
+
+ public void testUpdateName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
+
+ assertEquals("basicMapping", xmlBasicMapping.getName());
+ assertEquals("basicMapping", basicResource.getName());
+
+ //set name in the resource model, verify context model updated
+ basicResource.setName("newName");
+ assertEquals("newName", xmlBasicMapping.getName());
+ assertEquals("newName", basicResource.getName());
+
+ //set name to null in the resource model
+ basicResource.setName(null);
+ assertNull(xmlBasicMapping.getName());
+ assertNull(basicResource.getName());
+ }
+
+ public void testModifyName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
+
+ assertEquals("basicMapping", xmlBasicMapping.getName());
+ assertEquals("basicMapping", basicResource.getName());
+
+ //set name in the context model, verify resource model updated
+ xmlBasicMapping.setName("newName");
+ assertEquals("newName", xmlBasicMapping.getName());
+ assertEquals("newName", basicResource.getName());
+
+ //set name to null in the context model
+ xmlBasicMapping.setName(null);
+ assertNull(xmlBasicMapping.getName());
+ assertNull(basicResource.getName());
+ }
+
+ public void testUpdateSpecifiedFetch() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
+
+ assertNull(xmlBasicMapping.getSpecifiedFetch());
+ assertNull(basicResource.getFetch());
+
+ //set fetch in the resource model, verify context model updated
+ basicResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER);
+ assertEquals(FetchType.EAGER, xmlBasicMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, basicResource.getFetch());
+
+ basicResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY);
+ assertEquals(FetchType.LAZY, xmlBasicMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, basicResource.getFetch());
+
+ //set fetch to null in the resource model
+ basicResource.setFetch(null);
+ assertNull(xmlBasicMapping.getSpecifiedFetch());
+ assertNull(basicResource.getFetch());
+ }
+
+ public void testModifySpecifiedFetch() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
+
+ assertNull(xmlBasicMapping.getSpecifiedFetch());
+ assertNull(basicResource.getFetch());
+
+ //set fetch in the context model, verify resource model updated
+ xmlBasicMapping.setSpecifiedFetch(FetchType.EAGER);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, basicResource.getFetch());
+ assertEquals(FetchType.EAGER, xmlBasicMapping.getSpecifiedFetch());
+
+ xmlBasicMapping.setSpecifiedFetch(FetchType.LAZY);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, basicResource.getFetch());
+ assertEquals(FetchType.LAZY, xmlBasicMapping.getSpecifiedFetch());
+
+ //set fetch to null in the context model
+ xmlBasicMapping.setSpecifiedFetch(null);
+ assertNull(basicResource.getFetch());
+ assertNull(xmlBasicMapping.getSpecifiedFetch());
+ }
+
+ public void testUpdateSpecifiedEnumerated() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
+
+ assertNull(xmlBasicMapping.getSpecifiedEnumerated());
+ assertNull(basicResource.getEnumerated());
+
+ //set enumerated in the resource model, verify context model updated
+ basicResource.setEnumerated(org.eclipse.jpt.core.internal.resource.orm.EnumType.ORDINAL);
+ assertEquals(EnumType.ORDINAL, xmlBasicMapping.getSpecifiedEnumerated());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.EnumType.ORDINAL, basicResource.getEnumerated());
+
+ basicResource.setEnumerated(org.eclipse.jpt.core.internal.resource.orm.EnumType.STRING);
+ assertEquals(EnumType.STRING, xmlBasicMapping.getSpecifiedEnumerated());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.EnumType.STRING, basicResource.getEnumerated());
+
+ //set enumerated to null in the resource model
+ basicResource.setEnumerated(null);
+ assertNull(xmlBasicMapping.getSpecifiedEnumerated());
+ assertNull(basicResource.getEnumerated());
+ }
+
+ public void testModifySpecifiedEnumerated() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
+
+ assertNull(xmlBasicMapping.getSpecifiedEnumerated());
+ assertNull(basicResource.getEnumerated());
+
+ //set enumerated in the context model, verify resource model updated
+ xmlBasicMapping.setSpecifiedEnumerated(EnumType.ORDINAL);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.EnumType.ORDINAL, basicResource.getEnumerated());
+ assertEquals(EnumType.ORDINAL, xmlBasicMapping.getSpecifiedEnumerated());
+
+ xmlBasicMapping.setSpecifiedEnumerated(EnumType.STRING);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.EnumType.STRING, basicResource.getEnumerated());
+ assertEquals(EnumType.STRING, xmlBasicMapping.getSpecifiedEnumerated());
+
+ //set enumerated to null in the context model
+ xmlBasicMapping.setSpecifiedEnumerated(null);
+ assertNull(basicResource.getEnumerated());
+ assertNull(xmlBasicMapping.getSpecifiedEnumerated());
+ }
+
+ public void testUpdateSpecifiedOptional() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
+
+ assertNull(xmlBasicMapping.getSpecifiedOptional());
+ assertNull(basicResource.getOptional());
+
+ //set enumerated in the resource model, verify context model updated
+ basicResource.setOptional(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, xmlBasicMapping.getSpecifiedOptional());
+ assertEquals(Boolean.TRUE, basicResource.getOptional());
+
+ basicResource.setOptional(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlBasicMapping.getSpecifiedOptional());
+ assertEquals(Boolean.FALSE, basicResource.getOptional());
+
+ //set enumerated to null in the resource model
+ basicResource.setOptional(null);
+ assertNull(xmlBasicMapping.getSpecifiedOptional());
+ assertNull(basicResource.getOptional());
+ }
+
+ public void testModifySpecifiedOptional() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
+
+ assertNull(xmlBasicMapping.getSpecifiedOptional());
+ assertNull(basicResource.getOptional());
+
+ //set enumerated in the context model, verify resource model updated
+ xmlBasicMapping.setSpecifiedOptional(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, basicResource.getOptional());
+ assertEquals(Boolean.TRUE, xmlBasicMapping.getSpecifiedOptional());
+
+ xmlBasicMapping.setSpecifiedOptional(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, basicResource.getOptional());
+ assertEquals(Boolean.FALSE, xmlBasicMapping.getSpecifiedOptional());
+
+ //set enumerated to null in the context model
+ xmlBasicMapping.setSpecifiedOptional(null);
+ assertNull(basicResource.getOptional());
+ assertNull(xmlBasicMapping.getSpecifiedOptional());
+ }
+
+ public void testUpdateSpecifiedLob() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
+ ormResource().save(null);
+
+ assertFalse(xmlBasicMapping.isLob());
+ assertFalse(basicResource.isLob());
+
+ //set lob in the resource model, verify context model updated
+ basicResource.setLob(true);
+ ormResource().save(null);
+ assertTrue(xmlBasicMapping.isLob());
+ assertTrue(basicResource.isLob());
+
+ //set lob to null in the resource model
+ basicResource.setLob(false);
+ ormResource().save(null);
+ assertFalse(xmlBasicMapping.isLob());
+ assertFalse(basicResource.isLob());
+ }
+
+ public void testModifySpecifiedLob() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
+ ormResource().save(null);
+
+ assertFalse(xmlBasicMapping.isLob());
+ assertFalse(basicResource.isLob());
+
+ //set lob in the context model, verify resource model updated
+ xmlBasicMapping.setLob(true);
+ ormResource().save(null);
+ assertTrue(basicResource.isLob());
+ assertTrue(xmlBasicMapping.isLob());
+
+ //set lob to false in the context model
+ xmlBasicMapping.setLob(false);
+ ormResource().save(null);
+ assertFalse(basicResource.isLob());
+ assertFalse(xmlBasicMapping.isLob());
+ }
+
+ public void testUpdateTemporal() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
+ ormResource().save(null);
+
+ assertNull(xmlBasicMapping.getTemporal());
+ assertNull(basicResource.getTemporal());
+
+ //set temporal in the resource model, verify context model updated
+ basicResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE);
+ ormResource().save(null);
+ assertEquals(TemporalType.DATE, xmlBasicMapping.getTemporal());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE, basicResource.getTemporal());
+
+ basicResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME);
+ ormResource().save(null);
+ assertEquals(TemporalType.TIME, xmlBasicMapping.getTemporal());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME, basicResource.getTemporal());
+
+ basicResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP);
+ ormResource().save(null);
+ assertEquals(TemporalType.TIMESTAMP, xmlBasicMapping.getTemporal());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP, basicResource.getTemporal());
+
+ //set temporal to null in the resource model
+ basicResource.setTemporal(null);
+ ormResource().save(null);
+ assertNull(xmlBasicMapping.getTemporal());
+ assertNull(basicResource.getTemporal());
+ }
+
+ public void testModifyTemporal() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
+ ormResource().save(null);
+
+ assertNull(xmlBasicMapping.getTemporal());
+ assertNull(basicResource.getTemporal());
+
+ //set temporal in the context model, verify resource model updated
+ xmlBasicMapping.setTemporal(TemporalType.DATE);
+ ormResource().save(null);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE, basicResource.getTemporal());
+ assertEquals(TemporalType.DATE, xmlBasicMapping.getTemporal());
+
+ xmlBasicMapping.setTemporal(TemporalType.TIME);
+ ormResource().save(null);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME, basicResource.getTemporal());
+ assertEquals(TemporalType.TIME, xmlBasicMapping.getTemporal());
+
+ xmlBasicMapping.setTemporal(TemporalType.TIMESTAMP);
+ ormResource().save(null);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP, basicResource.getTemporal());
+ assertEquals(TemporalType.TIMESTAMP, xmlBasicMapping.getTemporal());
+
+ //set temporal to null in the context model
+ xmlBasicMapping.setTemporal(null);
+ ormResource().save(null);
+ assertNull(basicResource.getTemporal());
+ assertNull(xmlBasicMapping.getTemporal());
+ }
+
+ //TODO test morphing to other mapping types
+ //TODO test defaults
+
+
+ public void testBasicMappingNoUnderylingJavaAttribute() throws Exception {
+ createTestEntityBasicMapping();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "foo");
+ assertEquals(2, xmlPersistentType.virtualAttributesSize());
+
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next();
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+
+ assertEquals("foo", xmlBasicMapping.getName());
+ assertNull(xmlBasicMapping.getSpecifiedEnumerated());
+ assertNull(xmlBasicMapping.getSpecifiedFetch());
+ assertNull(xmlBasicMapping.getSpecifiedOptional());
+ assertFalse(xmlBasicMapping.isLob());
+ assertEquals(EnumType.ORDINAL, xmlBasicMapping.getEnumerated());
+ assertEquals(FetchType.EAGER, xmlBasicMapping.getFetch());
+ assertEquals(Boolean.TRUE, xmlBasicMapping.getOptional());
+ assertNull(xmlBasicMapping.getTemporal());
+
+
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+ assertNull(xmlColumn.getSpecifiedName());
+ assertNull(xmlColumn.getSpecifiedUnique());
+ assertNull(xmlColumn.getSpecifiedNullable());
+ assertNull(xmlColumn.getSpecifiedInsertable());
+ assertNull(xmlColumn.getSpecifiedUpdatable());
+ assertNull(xmlColumn.getColumnDefinition());
+ assertNull(xmlColumn.getSpecifiedTable());
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(xmlColumn.getSpecifiedPrecision());
+ assertNull(xmlColumn.getSpecifiedScale());
+
+ assertEquals("foo", xmlColumn.getDefaultName());
+ assertEquals(Boolean.FALSE, xmlColumn.getDefaultUnique());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultNullable());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultInsertable());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultUpdatable());
+ assertEquals(null, xmlColumn.getColumnDefinition());
+ assertEquals(TYPE_NAME, xmlColumn.getDefaultTable());
+ assertEquals(Integer.valueOf(255), xmlColumn.getDefaultLength());
+ assertEquals(Integer.valueOf(0), xmlColumn.getDefaultPrecision());
+ assertEquals(Integer.valueOf(0), xmlColumn.getDefaultScale());
+ }
+
+ //@Basic(fetch=FetchType.LAZY, optional=false)
+ //@Column(name="MY_COLUMN", unique=true, nullable=false, insertable=false, updatable=false,
+ // columnDefinition="COLUMN_DEFINITION", table="MY_TABLE", length=5, precision=6, scale=7)");
+ //@Column(
+ //@Lob
+ //@Temporal(TemporalType.TIMESTAMP)
+ //@Enumerated(EnumType.STRING)
+ public void testVirtualMappingMetadataCompleteFalse() throws Exception {
+ createTestEntityBasicMapping();
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ assertEquals(2, xmlPersistentType.virtualAttributesSize());
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next();
+
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ assertEquals("id", xmlBasicMapping.getName());
+ assertTrue(xmlBasicMapping.isLob());
+ assertEquals(EnumType.STRING, xmlBasicMapping.getSpecifiedEnumerated());
+ assertEquals(FetchType.LAZY, xmlBasicMapping.getSpecifiedFetch());
+ assertEquals(Boolean.FALSE, xmlBasicMapping.getSpecifiedOptional());
+ assertEquals(TemporalType.TIMESTAMP, xmlBasicMapping.getTemporal());
+
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+ assertEquals("MY_COLUMN", xmlColumn.getSpecifiedName());
+ assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUnique());
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable());
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedInsertable());
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUpdatable());
+ assertEquals("COLUMN_DEFINITION", xmlColumn.getColumnDefinition());
+ assertEquals("MY_TABLE", xmlColumn.getSpecifiedTable());
+ assertEquals(Integer.valueOf(5), xmlColumn.getSpecifiedLength());
+ assertEquals(Integer.valueOf(6), xmlColumn.getSpecifiedPrecision());
+ assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedScale());
+ }
+
+ public void testVirtualMappingMetadataCompleteTrue() throws Exception {
+ createTestEntityBasicMapping();
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ xmlPersistentType.getMapping().setSpecifiedMetadataComplete(true);
+ assertEquals(2, xmlPersistentType.virtualAttributesSize());
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next();
+
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ assertEquals("id", xmlBasicMapping.getName());
+ assertFalse(xmlBasicMapping.isLob());
+ assertEquals(EnumType.ORDINAL, xmlBasicMapping.getSpecifiedEnumerated());
+ assertEquals(FetchType.EAGER, xmlBasicMapping.getSpecifiedFetch());
+ assertEquals(Boolean.TRUE, xmlBasicMapping.getSpecifiedOptional());
+ assertNull(xmlBasicMapping.getTemporal());
+
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+ assertEquals("id", xmlColumn.getSpecifiedName());
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUnique());
+ assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedNullable());
+ assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedInsertable());
+ assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUpdatable());
+ assertNull(xmlColumn.getColumnDefinition());
+ assertEquals(TYPE_NAME, xmlColumn.getSpecifiedTable());
+ assertEquals(Integer.valueOf(255), xmlColumn.getSpecifiedLength());
+ assertEquals(Integer.valueOf(0), xmlColumn.getSpecifiedPrecision());
+ assertEquals(Integer.valueOf(0), xmlColumn.getSpecifiedScale());
+ }
+
+ public void testSpecifiedMapping() throws Exception {
+ createTestEntityBasicMapping();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
+ assertEquals(1, xmlPersistentType.virtualAttributesSize());
+
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next();
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+
+ assertEquals("id", xmlBasicMapping.getName());
+ assertNull(xmlBasicMapping.getSpecifiedEnumerated());
+ assertNull(xmlBasicMapping.getSpecifiedFetch());
+ assertNull(xmlBasicMapping.getSpecifiedOptional());
+ assertFalse(xmlBasicMapping.isLob());
+ assertEquals(EnumType.ORDINAL, xmlBasicMapping.getDefaultEnumerated());
+ assertEquals(FetchType.EAGER, xmlBasicMapping.getDefaultFetch());
+ assertEquals(Boolean.TRUE, xmlBasicMapping.getDefaultOptional());
+ assertNull(xmlBasicMapping.getTemporal());
+
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+ assertNull(xmlColumn.getSpecifiedName());
+ assertNull(xmlColumn.getSpecifiedUnique());
+ assertNull(xmlColumn.getSpecifiedNullable());
+ assertNull(xmlColumn.getSpecifiedInsertable());
+ assertNull(xmlColumn.getSpecifiedUpdatable());
+ assertNull(xmlColumn.getColumnDefinition());
+ assertNull(xmlColumn.getSpecifiedTable());
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(xmlColumn.getSpecifiedPrecision());
+ assertNull(xmlColumn.getSpecifiedScale());
+
+ assertEquals("id", xmlColumn.getDefaultName());
+ assertEquals(Boolean.FALSE, xmlColumn.getDefaultUnique());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultNullable());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultInsertable());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultUpdatable());
+ assertEquals(null, xmlColumn.getColumnDefinition());
+ assertEquals(TYPE_NAME, xmlColumn.getDefaultTable());
+ assertEquals(Integer.valueOf(255), xmlColumn.getDefaultLength());
+ assertEquals(Integer.valueOf(0), xmlColumn.getDefaultPrecision());
+ assertEquals(Integer.valueOf(0), xmlColumn.getDefaultScale());
+
+ }
+ //3 things tested above
+ //1. virtual mapping metadata complete=false - defaults are taken from the java annotations
+ //2. virtual mapping metadata complete=true - defaults are taken from java defaults,annotations ignored
+ //3. specified mapping (metadata complete=true/false - defaults are taken from java annotations
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlCascadeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlCascadeTests.java
new file mode 100644
index 0000000000..6bceca8fa9
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlCascadeTests.java
@@ -0,0 +1,280 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.XmlCascade;
+import org.eclipse.jpt.core.internal.context.orm.XmlOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.orm.OneToOne;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class XmlCascadeTests extends ContextModelTestCase
+{
+ public XmlCascadeTests(String name) {
+ super(name);
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ public void testUpdateCascadeAll() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+ XmlCascade xmlCascade = xmlOneToOneMapping.getCascade();
+
+ assertEquals(false, xmlCascade.isAll());
+ assertNull(oneToOne.getCascade());
+
+ //set cascade in the resource model, verify context model does not change
+ oneToOne.setCascade(OrmFactory.eINSTANCE.createCascadeTypeImpl());
+ assertEquals(false, xmlCascade.isAll());
+ assertNotNull(oneToOne.getCascade());
+
+ //set all in the resource model, verify context model updated
+ oneToOne.getCascade().setCascadeAll(true);
+ assertEquals(true, xmlCascade.isAll());
+ assertEquals(true, oneToOne.getCascade().isCascadeAll());
+
+ //set all to false in the resource model
+ oneToOne.getCascade().setCascadeAll(false);
+ assertEquals(false, xmlCascade.isAll());
+ assertEquals(false, oneToOne.getCascade().isCascadeAll());
+ }
+
+ public void testModifyCascadeAll() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ XmlCascade xmlCascade = xmlOneToOneMapping.getCascade();
+
+ assertEquals(false, xmlCascade.isAll());
+ assertNull(oneToOne.getCascade());
+
+ //set all in the context model, verify resource model updated
+ xmlCascade.setAll(true); ormResource().save(null);
+ assertEquals(true, xmlCascade.isAll());
+ assertEquals(true, oneToOne.getCascade().isCascadeAll());
+
+ //set all to false in the context model
+ xmlCascade.setAll(false);
+ assertEquals(false, xmlCascade.isAll());
+ assertNull(oneToOne.getCascade());
+ }
+
+ public void testUpdateCascadePersist() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+ XmlCascade xmlCascade = xmlOneToOneMapping.getCascade();
+
+ assertEquals(false, xmlCascade.isPersist());
+ assertNull(oneToOne.getCascade());
+
+ //set cascade in the resource model, verify context model does not change
+ oneToOne.setCascade(OrmFactory.eINSTANCE.createCascadeTypeImpl());
+ assertEquals(false, xmlCascade.isPersist());
+ assertNotNull(oneToOne.getCascade());
+
+ //set Persist in the resource model, verify context model updated
+ oneToOne.getCascade().setCascadePersist(true);
+ assertEquals(true, xmlCascade.isPersist());
+ assertEquals(true, oneToOne.getCascade().isCascadePersist());
+
+ //set Persist to false in the resource model
+ oneToOne.getCascade().setCascadePersist(false);
+ assertEquals(false, xmlCascade.isPersist());
+ assertEquals(false, oneToOne.getCascade().isCascadePersist());
+ }
+
+ public void testModifyCascadePersist() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ XmlCascade xmlCascade = xmlOneToOneMapping.getCascade();
+
+ assertEquals(false, xmlCascade.isPersist());
+ assertNull(oneToOne.getCascade());
+
+ //set Persist in the context model, verify resource model updated
+ xmlCascade.setPersist(true); ormResource().save(null);
+ assertEquals(true, xmlCascade.isPersist());
+ assertEquals(true, oneToOne.getCascade().isCascadePersist());
+
+ //set Persist to false in the context model
+ xmlCascade.setPersist(false);
+ assertEquals(false, xmlCascade.isPersist());
+ assertNull(oneToOne.getCascade());
+ }
+
+ public void testUpdateCascadeMerge() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+ XmlCascade xmlCascade = xmlOneToOneMapping.getCascade();
+
+ assertEquals(false, xmlCascade.isMerge());
+ assertNull(oneToOne.getCascade());
+
+ //set cascade in the resource model, verify context model does not change
+ oneToOne.setCascade(OrmFactory.eINSTANCE.createCascadeTypeImpl());
+ assertEquals(false, xmlCascade.isMerge());
+ assertNotNull(oneToOne.getCascade());
+
+ //set Merge in the resource model, verify context model updated
+ oneToOne.getCascade().setCascadeMerge(true);
+ assertEquals(true, xmlCascade.isMerge());
+ assertEquals(true, oneToOne.getCascade().isCascadeMerge());
+
+ //set Merge to false in the resource model
+ oneToOne.getCascade().setCascadeMerge(false);
+ assertEquals(false, xmlCascade.isMerge());
+ assertEquals(false, oneToOne.getCascade().isCascadeMerge());
+ }
+
+ public void testModifyCascadeMerge() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ XmlCascade xmlCascade = xmlOneToOneMapping.getCascade();
+
+ assertEquals(false, xmlCascade.isMerge());
+ assertNull(oneToOne.getCascade());
+
+ //set Merge in the context model, verify resource model updated
+ xmlCascade.setMerge(true); ormResource().save(null);
+ assertEquals(true, xmlCascade.isMerge());
+ assertEquals(true, oneToOne.getCascade().isCascadeMerge());
+
+ //set Merge to false in the context model
+ xmlCascade.setMerge(false);
+ assertEquals(false, xmlCascade.isMerge());
+ assertNull(oneToOne.getCascade());
+ }
+
+ public void testUpdateCascadeRemove() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+ XmlCascade xmlCascade = xmlOneToOneMapping.getCascade();
+
+ assertEquals(false, xmlCascade.isRemove());
+ assertNull(oneToOne.getCascade());
+
+ //set cascade in the resource model, verify context model does not change
+ oneToOne.setCascade(OrmFactory.eINSTANCE.createCascadeTypeImpl());
+ assertEquals(false, xmlCascade.isRemove());
+ assertNotNull(oneToOne.getCascade());
+
+ //set Remove in the resource model, verify context model updated
+ oneToOne.getCascade().setCascadeRemove(true);
+ assertEquals(true, xmlCascade.isRemove());
+ assertEquals(true, oneToOne.getCascade().isCascadeRemove());
+
+ //set Remove to false in the resource model
+ oneToOne.getCascade().setCascadeRemove(false);
+ assertEquals(false, xmlCascade.isRemove());
+ assertEquals(false, oneToOne.getCascade().isCascadeRemove());
+ }
+
+ public void testModifyCascadeRemove() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ XmlCascade xmlCascade = xmlOneToOneMapping.getCascade();
+
+ assertEquals(false, xmlCascade.isRemove());
+ assertNull(oneToOne.getCascade());
+
+ //set Remove in the context model, verify resource model updated
+ xmlCascade.setRemove(true); ormResource().save(null);
+ assertEquals(true, xmlCascade.isRemove());
+ assertEquals(true, oneToOne.getCascade().isCascadeRemove());
+
+ //set Remove to false in the context model
+ xmlCascade.setRemove(false);
+ assertEquals(false, xmlCascade.isRemove());
+ assertNull(oneToOne.getCascade());
+ }
+
+ public void testUpdateCascadeRefresh() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+ XmlCascade xmlCascade = xmlOneToOneMapping.getCascade();
+
+ assertEquals(false, xmlCascade.isRefresh());
+ assertNull(oneToOne.getCascade());
+
+ //set cascade in the resource model, verify context model does not change
+ oneToOne.setCascade(OrmFactory.eINSTANCE.createCascadeTypeImpl());
+ assertEquals(false, xmlCascade.isRefresh());
+ assertNotNull(oneToOne.getCascade());
+
+ //set Refresh in the resource model, verify context model updated
+ oneToOne.getCascade().setCascadeRefresh(true);
+ assertEquals(true, xmlCascade.isRefresh());
+ assertEquals(true, oneToOne.getCascade().isCascadeRefresh());
+
+ //set Refresh to false in the resource model
+ oneToOne.getCascade().setCascadeRefresh(false);
+ assertEquals(false, xmlCascade.isRefresh());
+ assertEquals(false, oneToOne.getCascade().isCascadeRefresh());
+ }
+
+ public void testModifyCascadeRefresh() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ XmlCascade xmlCascade = xmlOneToOneMapping.getCascade();
+
+ assertEquals(false, xmlCascade.isRefresh());
+ assertNull(oneToOne.getCascade());
+
+ //set Refresh in the context model, verify resource model updated
+ xmlCascade.setRefresh(true); ormResource().save(null);
+ assertEquals(true, xmlCascade.isRefresh());
+ assertEquals(true, oneToOne.getCascade().isCascadeRefresh());
+
+ //set Refresh to false in the context model
+ xmlCascade.setRefresh(false);
+ assertEquals(false, xmlCascade.isRefresh());
+ assertNull(oneToOne.getCascade());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlColumnTests.java
new file mode 100644
index 0000000000..582f503fb9
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlColumnTests.java
@@ -0,0 +1,698 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.XmlBasicMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlColumn;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.orm.Basic;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.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.iterators.ArrayIterator;
+
+public class XmlColumnTests extends ContextModelTestCase
+{
+ public XmlColumnTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createIdAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Id", "");
+ }
+
+ private IType createTestEntity() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestSubType() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
+ sb.append("extends " + TYPE_NAME + " ");
+ sb.append("{}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
+ }
+
+ public void testUpdateSpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedName());
+ assertNull(basic.getColumn());
+
+ //set name in the resource model, verify context model updated
+ basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl());
+ basic.getColumn().setName("FOO");
+ ormResource().save(null);
+ assertEquals("FOO", xmlColumn.getSpecifiedName());
+ assertEquals("FOO", basic.getColumn().getName());
+
+ //set name to null in the resource model
+ basic.getColumn().setName(null);
+ assertNull(xmlColumn.getSpecifiedName());
+ assertNull(basic.getColumn().getName());
+
+ basic.getColumn().setName("FOO");
+ assertEquals("FOO", xmlColumn.getSpecifiedName());
+ assertEquals("FOO", basic.getColumn().getName());
+
+ basic.setColumn(null);
+ assertNull(xmlColumn.getSpecifiedName());
+ assertNull(basic.getColumn());
+ }
+
+ public void testModifySpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedName());
+ assertNull(basic.getColumn());
+
+ //set name in the context model, verify resource model modified
+ xmlColumn.setSpecifiedName("foo");
+ assertEquals("foo", xmlColumn.getSpecifiedName());
+ assertEquals("foo", basic.getColumn().getName());
+
+ //set name to null in the context model
+ xmlColumn.setSpecifiedName(null);
+ assertNull(xmlColumn.getSpecifiedName());
+ assertNull(basic.getColumn());
+ }
+
+ public void testUpdateColumnDefinition() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getColumnDefinition());
+ assertNull(basic.getColumn());
+
+ //set name in the resource model, verify context model updated
+ basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl());
+ basic.getColumn().setColumnDefinition("FOO");
+ ormResource().save(null);
+ assertEquals("FOO", xmlColumn.getColumnDefinition());
+ assertEquals("FOO", basic.getColumn().getColumnDefinition());
+
+ //set name to null in the resource model
+ basic.getColumn().setColumnDefinition(null);
+ assertNull(xmlColumn.getColumnDefinition());
+ assertNull(basic.getColumn().getColumnDefinition());
+
+ basic.getColumn().setColumnDefinition("FOO");
+ assertEquals("FOO", xmlColumn.getColumnDefinition());
+ assertEquals("FOO", basic.getColumn().getColumnDefinition());
+
+ basic.setColumn(null);
+ assertNull(xmlColumn.getColumnDefinition());
+ assertNull(basic.getColumn());
+ }
+
+ public void testModifyColumnDefinition() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getColumnDefinition());
+ assertNull(basic.getColumn());
+
+ //set name in the context model, verify resource model modified
+ xmlColumn.setColumnDefinition("foo");
+ assertEquals("foo", xmlColumn.getColumnDefinition());
+ assertEquals("foo", basic.getColumn().getColumnDefinition());
+
+ //set name to null in the context model
+ xmlColumn.setColumnDefinition(null);
+ assertNull(xmlColumn.getColumnDefinition());
+ assertNull(basic.getColumn());
+ }
+// public void testUpdateDefaultNameFromJavaTable() throws Exception {
+// createTestEntity();
+//
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.javaEntity().getTable().setSpecifiedName("Foo");
+// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+// xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.setSpecifiedMetadataComplete(null);
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.getTable().setSpecifiedName("Bar");
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+// }
+//
+// public void testUpdateDefaultNameNoJava() throws Exception {
+// createTestEntity();
+//
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+// }
+//
+// public void testUpdateDefaultNameFromParent() throws Exception {
+// createTestEntity();
+// createTestSubType();
+//
+// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping();
+// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping();
+//
+// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+// assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName());
+//
+// parentXmlEntity.getTable().setSpecifiedName("FOO");
+// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+// assertEquals("FOO", childXmlEntity.getTable().getDefaultName());
+//
+// parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+// assertEquals("AnnotationTestTypeChild", childXmlEntity.getTable().getDefaultName());
+// }
+
+ public void testUpdateSpecifiedTable() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedTable());
+ assertNull(basic.getColumn());
+
+ //set name in the resource model, verify context model updated
+ basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl());
+ basic.getColumn().setTable("FOO");
+ assertEquals("FOO", xmlColumn.getSpecifiedTable());
+ assertEquals("FOO", basic.getColumn().getTable());
+
+ //set name to null in the resource model
+ basic.getColumn().setTable(null);
+ assertNull(xmlColumn.getSpecifiedTable());
+ assertNull(basic.getColumn().getTable());
+
+ basic.getColumn().setTable("FOO");
+ assertEquals("FOO", xmlColumn.getSpecifiedTable());
+ assertEquals("FOO", basic.getColumn().getTable());
+
+ basic.setColumn(null);
+ assertNull(xmlColumn.getSpecifiedTable());
+ assertNull(basic.getColumn());
+ }
+
+ public void testModifySpecifiedTable() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedTable());
+ assertNull(basic.getColumn());
+
+ //set name in the context model, verify resource model modified
+ xmlColumn.setSpecifiedTable("foo");
+ assertEquals("foo", xmlColumn.getSpecifiedTable());
+ assertEquals("foo", basic.getColumn().getTable());
+
+ //set name to null in the context model
+ xmlColumn.setSpecifiedTable(null);
+ assertNull(xmlColumn.getSpecifiedTable());
+ assertNull(basic.getColumn());
+ }
+
+ public void testUpdateSpecifiedNullable() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedNullable());
+ assertNull(basic.getColumn());
+
+ //set name in the resource model, verify context model updated
+ basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl());
+ basic.getColumn().setNullable(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedNullable());
+ assertEquals(Boolean.TRUE, basic.getColumn().getNullable());
+
+ //set name to null in the resource model
+ basic.getColumn().setNullable(null);
+ assertNull(xmlColumn.getSpecifiedNullable());
+ assertNull(basic.getColumn().getNullable());
+
+ basic.getColumn().setNullable(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable());
+ assertEquals(Boolean.FALSE, basic.getColumn().getNullable());
+
+ basic.setColumn(null);
+ assertNull(xmlColumn.getSpecifiedNullable());
+ assertNull(basic.getColumn());
+ }
+
+ public void testModifySpecifiedNullable() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedNullable());
+ assertNull(basic.getColumn());
+
+ //set name in the context model, verify resource model modified
+ xmlColumn.setSpecifiedNullable(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable());
+ assertEquals(Boolean.FALSE, basic.getColumn().getNullable());
+
+ //set name to null in the context model
+ xmlColumn.setSpecifiedNullable(null);
+ assertNull(xmlColumn.getSpecifiedNullable());
+ assertNull(basic.getColumn());
+ }
+
+ public void testUpdateSpecifiedUpdatable() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedUpdatable());
+ assertNull(basic.getColumn());
+
+ //set name in the resource model, verify context model updated
+ basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl());
+ basic.getColumn().setUpdatable(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUpdatable());
+ assertEquals(Boolean.TRUE, basic.getColumn().getUpdatable());
+
+ //set name to null in the resource model
+ basic.getColumn().setUpdatable(null);
+ assertNull(xmlColumn.getSpecifiedUpdatable());
+ assertNull(basic.getColumn().getUpdatable());
+
+ basic.getColumn().setUpdatable(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUpdatable());
+ assertEquals(Boolean.FALSE, basic.getColumn().getUpdatable());
+
+ basic.setColumn(null);
+ assertNull(xmlColumn.getSpecifiedUpdatable());
+ assertNull(basic.getColumn());
+ }
+
+ public void testModifySpecifiedUpdatable() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedUpdatable());
+ assertNull(basic.getColumn());
+
+ //set name in the context model, verify resource model modified
+ xmlColumn.setSpecifiedUpdatable(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUpdatable());
+ assertEquals(Boolean.FALSE, basic.getColumn().getUpdatable());
+
+ //set name to null in the context model
+ xmlColumn.setSpecifiedUpdatable(null);
+ assertNull(xmlColumn.getSpecifiedUpdatable());
+ assertNull(basic.getColumn());
+ }
+
+ public void testUpdateSpecifiedInsertable() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedInsertable());
+ assertNull(basic.getColumn());
+
+ //set name in the resource model, verify context model updated
+ basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl());
+ basic.getColumn().setInsertable(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedInsertable());
+ assertEquals(Boolean.TRUE, basic.getColumn().getInsertable());
+
+ //set name to null in the resource model
+ basic.getColumn().setInsertable(null);
+ assertNull(xmlColumn.getSpecifiedInsertable());
+ assertNull(basic.getColumn().getInsertable());
+
+ basic.getColumn().setInsertable(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedInsertable());
+ assertEquals(Boolean.FALSE, basic.getColumn().getInsertable());
+
+ basic.setColumn(null);
+ assertNull(xmlColumn.getSpecifiedInsertable());
+ assertNull(basic.getColumn());
+ }
+
+ public void testModifySpecifiedInsertable() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedInsertable());
+ assertNull(basic.getColumn());
+
+ //set name in the context model, verify resource model modified
+ xmlColumn.setSpecifiedInsertable(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedInsertable());
+ assertEquals(Boolean.FALSE, basic.getColumn().getInsertable());
+
+ //set name to null in the context model
+ xmlColumn.setSpecifiedInsertable(null);
+ assertNull(xmlColumn.getSpecifiedInsertable());
+ assertNull(basic.getColumn());
+ }
+
+ public void testUpdateSpecifiedUnique() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedUnique());
+ assertNull(basic.getColumn());
+
+ //set name in the resource model, verify context model updated
+ basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl());
+ basic.getColumn().setUnique(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUnique());
+ assertEquals(Boolean.TRUE, basic.getColumn().getUnique());
+
+ //set name to null in the resource model
+ basic.getColumn().setUnique(null);
+ assertNull(xmlColumn.getSpecifiedUnique());
+ assertNull(basic.getColumn().getUnique());
+
+ basic.getColumn().setUnique(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUnique());
+ assertEquals(Boolean.FALSE, basic.getColumn().getUnique());
+
+ basic.setColumn(null);
+ assertNull(xmlColumn.getSpecifiedUnique());
+ assertNull(basic.getColumn());
+ }
+
+ public void testModifySpecifiedUnique() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedUnique());
+ assertNull(basic.getColumn());
+
+ //set name in the context model, verify resource model modified
+ xmlColumn.setSpecifiedUnique(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUnique());
+ assertEquals(Boolean.FALSE, basic.getColumn().getUnique());
+
+ //set name to null in the context model
+ xmlColumn.setSpecifiedUnique(null);
+ assertNull(xmlColumn.getSpecifiedUnique());
+ assertNull(basic.getColumn());
+ }
+
+ public void testUpdateSpecifiedLength() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(basic.getColumn());
+
+ //set name in the resource model, verify context model updated
+ basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl());
+ basic.getColumn().setLength(Integer.valueOf(8));
+ assertEquals(Integer.valueOf(8), xmlColumn.getSpecifiedLength());
+ assertEquals(Integer.valueOf(8), basic.getColumn().getLength());
+
+ //set name to null in the resource model
+ basic.getColumn().setLength(null);
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(basic.getColumn().getLength());
+
+ basic.getColumn().setLength(Integer.valueOf(11));
+ assertEquals(Integer.valueOf(11), xmlColumn.getSpecifiedLength());
+ assertEquals(Integer.valueOf(11), basic.getColumn().getLength());
+
+ basic.setColumn(null);
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(basic.getColumn());
+ }
+
+ public void testModifySpecifiedLength() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(basic.getColumn());
+
+ //set name in the context model, verify resource model modified
+ xmlColumn.setSpecifiedLength(Integer.valueOf(7));
+ assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedLength());
+ assertEquals(Integer.valueOf(7), basic.getColumn().getLength());
+
+ //set name to null in the context model
+ xmlColumn.setSpecifiedLength(null);
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(basic.getColumn());
+ }
+
+ public void testUpdateSpecifiedPrecision() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(basic.getColumn());
+
+ //set name in the resource model, verify context model updated
+ basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl());
+ basic.getColumn().setPrecision(Integer.valueOf(8));
+ assertEquals(Integer.valueOf(8), xmlColumn.getSpecifiedPrecision());
+ assertEquals(Integer.valueOf(8), basic.getColumn().getPrecision());
+
+ //set name to null in the resource model
+ basic.getColumn().setPrecision(null);
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(basic.getColumn().getPrecision());
+
+ basic.getColumn().setPrecision(Integer.valueOf(11));
+ assertEquals(Integer.valueOf(11), xmlColumn.getSpecifiedPrecision());
+ assertEquals(Integer.valueOf(11), basic.getColumn().getPrecision());
+
+ basic.setColumn(null);
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(basic.getColumn());
+ }
+
+ public void testModifySpecifiedPrecision() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(basic.getColumn());
+
+ //set name in the context model, verify resource model modified
+ xmlColumn.setSpecifiedPrecision(Integer.valueOf(7));
+ assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedPrecision());
+ assertEquals(Integer.valueOf(7), basic.getColumn().getPrecision());
+
+ //set name to null in the context model
+ xmlColumn.setSpecifiedPrecision(null);
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(basic.getColumn());
+ }
+
+ public void testUpdateSpecifiedScale() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(basic.getColumn());
+
+ //set name in the resource model, verify context model updated
+ basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl());
+ basic.getColumn().setScale(Integer.valueOf(8));
+ assertEquals(Integer.valueOf(8), xmlColumn.getSpecifiedScale());
+ assertEquals(Integer.valueOf(8), basic.getColumn().getScale());
+
+ //set name to null in the resource model
+ basic.getColumn().setScale(null);
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(basic.getColumn().getScale());
+
+ basic.getColumn().setScale(Integer.valueOf(11));
+ assertEquals(Integer.valueOf(11), xmlColumn.getSpecifiedScale());
+ assertEquals(Integer.valueOf(11), basic.getColumn().getScale());
+
+ basic.setColumn(null);
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(basic.getColumn());
+ }
+
+ public void testModifySpecifiedScale() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping();
+ XmlColumn xmlColumn = xmlBasicMapping.getColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entityResource.getAttributes().getBasics().get(0);
+
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(basic.getColumn());
+
+ //set name in the context model, verify resource model modified
+ xmlColumn.setSpecifiedScale(Integer.valueOf(7));
+ assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedScale());
+ assertEquals(Integer.valueOf(7), basic.getColumn().getScale());
+
+ //set name to null in the context model
+ xmlColumn.setSpecifiedScale(null);
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(basic.getColumn());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlDiscriminatorColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlDiscriminatorColumnTests.java
new file mode 100644
index 0000000000..1c8df58470
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlDiscriminatorColumnTests.java
@@ -0,0 +1,353 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.DiscriminatorType;
+import org.eclipse.jpt.core.internal.context.orm.XmlDiscriminatorColumn;
+import org.eclipse.jpt.core.internal.context.orm.XmlEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.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.iterators.ArrayIterator;
+
+public class XmlDiscriminatorColumnTests extends ContextModelTestCase
+{
+ public XmlDiscriminatorColumnTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createIdAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Id", "");
+ }
+
+ private IType createTestEntity() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestSubType() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
+ sb.append("extends " + TYPE_NAME + " ");
+ sb.append("{}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
+ }
+
+ public void testUpdateSpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlColumn.getSpecifiedName());
+ assertNull(entityResource.getDiscriminatorColumn());
+
+ //set name in the resource model, verify context model updated
+ entityResource.setDiscriminatorColumn(OrmFactory.eINSTANCE.createDiscriminatorColumn());
+ entityResource.getDiscriminatorColumn().setName("FOO");
+ ormResource().save(null);
+ assertEquals("FOO", xmlColumn.getSpecifiedName());
+ assertEquals("FOO", entityResource.getDiscriminatorColumn().getName());
+
+ //set name to null in the resource model
+ entityResource.getDiscriminatorColumn().setName(null);
+ assertNull(xmlColumn.getSpecifiedName());
+ assertNull(entityResource.getDiscriminatorColumn().getName());
+
+ entityResource.getDiscriminatorColumn().setName("FOO");
+ assertEquals("FOO", xmlColumn.getSpecifiedName());
+ assertEquals("FOO", entityResource.getDiscriminatorColumn().getName());
+
+ entityResource.setDiscriminatorColumn(null);
+ assertNull(xmlColumn.getSpecifiedName());
+ assertNull(entityResource.getDiscriminatorColumn());
+ }
+
+ public void testModifySpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlColumn.getSpecifiedName());
+ assertNull(entityResource.getDiscriminatorColumn());
+
+ //set name in the context model, verify resource model modified
+ xmlColumn.setSpecifiedName("foo");
+ assertEquals("foo", xmlColumn.getSpecifiedName());
+ assertEquals("foo", entityResource.getDiscriminatorColumn().getName());
+
+ //set name to null in the context model
+ xmlColumn.setSpecifiedName(null);
+ assertNull(xmlColumn.getSpecifiedName());
+ assertNull(entityResource.getDiscriminatorColumn());
+ }
+
+// public void testUpdateDefaultNameFromJavaTable() throws Exception {
+// createTestEntity();
+//
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.javaEntity().getTable().setSpecifiedName("Foo");
+// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+// xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.setSpecifiedMetadataComplete(null);
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.getTable().setSpecifiedName("Bar");
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+// }
+//
+// public void testUpdateDefaultNameNoJava() throws Exception {
+// createTestEntity();
+//
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+// }
+//
+// public void testUpdateDefaultNameFromParent() throws Exception {
+// createTestEntity();
+// createTestSubType();
+//
+// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping();
+// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping();
+//
+// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+// assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName());
+//
+// parentXmlEntity.getTable().setSpecifiedName("FOO");
+// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+// assertEquals("FOO", childXmlEntity.getTable().getDefaultName());
+//
+// parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+// assertEquals("AnnotationTestTypeChild", childXmlEntity.getTable().getDefaultName());
+// }
+
+ public void testUpdateSpecifiedLength() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(entityResource.getDiscriminatorColumn());
+
+ //set name in the resource model, verify context model updated
+ entityResource.setDiscriminatorColumn(OrmFactory.eINSTANCE.createDiscriminatorColumn());
+ entityResource.getDiscriminatorColumn().setLength(Integer.valueOf(8));
+ assertEquals(Integer.valueOf(8), xmlColumn.getSpecifiedLength());
+ assertEquals(Integer.valueOf(8), entityResource.getDiscriminatorColumn().getLength());
+
+ //set name to null in the resource model
+ entityResource.getDiscriminatorColumn().setLength(null);
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(entityResource.getDiscriminatorColumn().getLength());
+
+ entityResource.getDiscriminatorColumn().setLength(Integer.valueOf(11));
+ assertEquals(Integer.valueOf(11), xmlColumn.getSpecifiedLength());
+ assertEquals(Integer.valueOf(11), entityResource.getDiscriminatorColumn().getLength());
+
+ entityResource.setDiscriminatorColumn(null);
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(entityResource.getDiscriminatorColumn());
+ }
+
+ public void testModifySpecifiedLength() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(entityResource.getDiscriminatorColumn());
+
+ //set name in the context model, verify resource model modified
+ xmlColumn.setSpecifiedLength(Integer.valueOf(7));
+ assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedLength());
+ assertEquals(Integer.valueOf(7), entityResource.getDiscriminatorColumn().getLength());
+
+ //set name to null in the context model
+ xmlColumn.setSpecifiedLength(null);
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(entityResource.getDiscriminatorColumn());
+ }
+
+ public void testUpdateSpecifiedColumnDefinition() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlColumn.getColumnDefinition());
+ assertNull(entityResource.getDiscriminatorColumn());
+
+ //set name in the resource model, verify context model updated
+ entityResource.setDiscriminatorColumn(OrmFactory.eINSTANCE.createDiscriminatorColumn());
+ entityResource.getDiscriminatorColumn().setColumnDefinition("FOO");
+ ormResource().save(null);
+ assertEquals("FOO", xmlColumn.getColumnDefinition());
+ assertEquals("FOO", entityResource.getDiscriminatorColumn().getColumnDefinition());
+
+ //set name to null in the resource model
+ entityResource.getDiscriminatorColumn().setColumnDefinition(null);
+ assertNull(xmlColumn.getColumnDefinition());
+ assertNull(entityResource.getDiscriminatorColumn().getColumnDefinition());
+
+ entityResource.getDiscriminatorColumn().setColumnDefinition("FOO");
+ assertEquals("FOO", xmlColumn.getColumnDefinition());
+ assertEquals("FOO", entityResource.getDiscriminatorColumn().getColumnDefinition());
+
+ entityResource.setDiscriminatorColumn(null);
+ assertNull(xmlColumn.getColumnDefinition());
+ assertNull(entityResource.getDiscriminatorColumn());
+ }
+
+ public void testModifySpecifiedColumnDefinition() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlColumn.getColumnDefinition());
+ assertNull(entityResource.getDiscriminatorColumn());
+
+ //set name in the context model, verify resource model modified
+ xmlColumn.setColumnDefinition("foo");
+ assertEquals("foo", xmlColumn.getColumnDefinition());
+ assertEquals("foo", entityResource.getDiscriminatorColumn().getColumnDefinition());
+
+ //set name to null in the context model
+ xmlColumn.setColumnDefinition(null);
+ assertNull(xmlColumn.getColumnDefinition());
+ assertNull(entityResource.getDiscriminatorColumn());
+ }
+
+ public void testUpdateSpecifiedDiscriminatorType() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlColumn.getSpecifiedDiscriminatorType());
+ assertNull(entityResource.getDiscriminatorColumn());
+
+ //set discriminator type in the resource model, verify context model updated
+ entityResource.setDiscriminatorColumn(OrmFactory.eINSTANCE.createDiscriminatorColumn());
+ entityResource.getDiscriminatorColumn().setDiscriminatorType(org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType.STRING);
+ ormResource().save(null);
+ assertEquals(DiscriminatorType.STRING, xmlColumn.getSpecifiedDiscriminatorType());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType.STRING, entityResource.getDiscriminatorColumn().getDiscriminatorType());
+
+ //set discriminator type to null in the resource model
+ entityResource.getDiscriminatorColumn().setDiscriminatorType(null);
+ assertNull(xmlColumn.getSpecifiedDiscriminatorType());
+ assertNull(entityResource.getDiscriminatorColumn().getDiscriminatorType());
+
+ entityResource.getDiscriminatorColumn().setDiscriminatorType(org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType.CHAR);
+ assertEquals(DiscriminatorType.CHAR, xmlColumn.getSpecifiedDiscriminatorType());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType.CHAR, entityResource.getDiscriminatorColumn().getDiscriminatorType());
+
+ entityResource.setDiscriminatorColumn(null);
+ assertNull(xmlColumn.getSpecifiedDiscriminatorType());
+ assertNull(entityResource.getDiscriminatorColumn());
+ }
+
+ public void testModifySpecifiedDiscriminatorType() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlColumn.getSpecifiedDiscriminatorType());
+ assertNull(entityResource.getDiscriminatorColumn());
+
+ //set discriminator type in the context model, verify resource model modified
+ xmlColumn.setSpecifiedDiscriminatorType(DiscriminatorType.STRING);
+ assertEquals(DiscriminatorType.STRING, xmlColumn.getSpecifiedDiscriminatorType());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType.STRING, entityResource.getDiscriminatorColumn().getDiscriminatorType());
+
+ //set discriminator type to null in the context model
+ xmlColumn.setSpecifiedDiscriminatorType(null);
+ assertNull(xmlColumn.getSpecifiedDiscriminatorType());
+ assertNull(entityResource.getDiscriminatorColumn());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddableTests.java
new file mode 100644
index 0000000000..31d133ec6f
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddableTests.java
@@ -0,0 +1,305 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.orm.XmlEmbeddable;
+import org.eclipse.jpt.core.internal.context.orm.XmlEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlMappedSuperclass;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.orm.Embeddable;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class XmlEmbeddableTests extends ContextModelTestCase
+{
+ public XmlEmbeddableTests(String name) {
+ super(name);
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ public void testUpdateClass() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) xmlPersistentType.getMapping();
+ Embeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0);
+ assertEquals("model.Foo", xmlEmbeddable.getClass_());
+ assertEquals("model.Foo", embeddableResource.getClassName());
+
+ //set class in the resource model, verify context model updated
+ embeddableResource.setClassName("com.Bar");
+ assertEquals("com.Bar", xmlEmbeddable.getClass_());
+ assertEquals("com.Bar", embeddableResource.getClassName());
+
+ //set class to null in the resource model
+ embeddableResource.setClassName(null);
+ assertNull(xmlEmbeddable.getClass_());
+ assertNull(embeddableResource.getClassName());
+ }
+
+ public void testModifyClass() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) xmlPersistentType.getMapping();
+ Embeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0);
+ assertEquals("model.Foo", xmlEmbeddable.getClass_());
+ assertEquals("model.Foo", embeddableResource.getClassName());
+
+ //set class in the context model, verify resource model modified
+ xmlEmbeddable.setClass("com.Bar");
+ assertEquals("com.Bar", xmlEmbeddable.getClass_());
+ assertEquals("com.Bar", embeddableResource.getClassName());
+
+ //set class to null in the context model
+ xmlEmbeddable.setClass(null);
+ assertNull(xmlEmbeddable.getClass_());
+ assertNull(embeddableResource.getClassName());
+ }
+ //TODO add tests for setting the className when the package is set on entity-mappings
+
+ public void testUpdateSpecifiedAccess() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) xmlPersistentType.getMapping();
+ Embeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0);
+ assertNull(xmlEmbeddable.getSpecifiedAccess());
+ assertNull(embeddableResource.getAccess());
+
+ //set access in the resource model, verify context model updated
+ embeddableResource.setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD);
+ assertEquals(AccessType.FIELD, xmlEmbeddable.getSpecifiedAccess());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD, embeddableResource.getAccess());
+
+ //set access to null in the resource model
+ embeddableResource.setAccess(null);
+ assertNull(xmlEmbeddable.getSpecifiedAccess());
+ assertNull(embeddableResource.getAccess());
+ }
+
+ public void testModifySpecifiedAccess() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) xmlPersistentType.getMapping();
+ Embeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0);
+ assertNull(xmlEmbeddable.getSpecifiedAccess());
+ assertNull(embeddableResource.getAccess());
+
+ //set access in the context model, verify resource model modified
+ xmlEmbeddable.setSpecifiedAccess(AccessType.PROPERTY);
+ assertEquals(AccessType.PROPERTY, xmlEmbeddable.getSpecifiedAccess());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, embeddableResource.getAccess());
+
+ //set access to null in the context model
+ xmlEmbeddable.setSpecifiedAccess(null);
+ assertNull(xmlEmbeddable.getSpecifiedAccess());
+ assertNull(embeddableResource.getAccess());
+ }
+ //TODO test default access from
+ //underlying java
+ //persistence-unit-defaults
+ //entity-mappings
+ //with xml-mapping-metadata-complete set
+
+ public void testUpdateSpecifiedMetadataComplete() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) xmlPersistentType.getMapping();
+ Embeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0);
+ assertNull(embeddableResource.getMetadataComplete());
+
+ //set metadata-complete in the resource model, verify context model updated
+ embeddableResource.setMetadataComplete(true);
+ assertTrue(xmlEmbeddable.getSpecifiedMetadataComplete());
+ assertTrue(embeddableResource.getMetadataComplete());
+
+ //set access to false in the resource model
+ embeddableResource.setMetadataComplete(false);
+ assertFalse(xmlEmbeddable.getSpecifiedMetadataComplete());
+ assertFalse(embeddableResource.getMetadataComplete());
+
+ embeddableResource.setMetadataComplete(null);
+ assertNull(xmlEmbeddable.getSpecifiedMetadataComplete());
+ assertNull(embeddableResource.getMetadataComplete());
+ }
+
+ public void testModifySpecifiedMetadataComplete() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) xmlPersistentType.getMapping();
+ Embeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0);
+ assertNull(embeddableResource.getMetadataComplete());
+
+ //set access in the context model, verify resource model modified
+ xmlEmbeddable.setSpecifiedMetadataComplete(Boolean.TRUE);
+ assertTrue(xmlEmbeddable.getSpecifiedMetadataComplete());
+ assertTrue(embeddableResource.getMetadataComplete());
+
+ //set access to null in the context model
+ xmlEmbeddable.setSpecifiedMetadataComplete(Boolean.FALSE);
+ assertFalse(xmlEmbeddable.getSpecifiedMetadataComplete());
+ assertFalse(embeddableResource.getMetadataComplete());
+
+ xmlEmbeddable.setSpecifiedMetadataComplete(null);
+ assertNull(xmlEmbeddable.getSpecifiedMetadataComplete());
+ assertNull(embeddableResource.getMetadataComplete());
+ }
+
+ public void testUpdateDefaultMetadataComplete() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) xmlPersistentType.getMapping();
+ Embeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0);
+ assertNull(xmlEmbeddable.getSpecifiedMetadataComplete());
+ assertFalse(xmlEmbeddable.isDefaultMetadataComplete());
+ assertNull(embeddableResource.getMetadataComplete());
+
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ assertTrue(xmlEmbeddable.isDefaultMetadataComplete());
+ assertNull(xmlEmbeddable.getSpecifiedMetadataComplete());
+ assertNull(embeddableResource.getMetadataComplete());
+
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+ assertNull(xmlEmbeddable.getSpecifiedMetadataComplete());
+ assertFalse(xmlEmbeddable.isDefaultMetadataComplete());
+ assertNull(embeddableResource.getMetadataComplete());
+ }
+
+ public void testUpdateMetadataComplete() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) xmlPersistentType.getMapping();
+ Embeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0);
+ assertNull(xmlEmbeddable.getSpecifiedMetadataComplete());
+ assertFalse(xmlEmbeddable.isMetadataComplete());
+ assertNull(embeddableResource.getMetadataComplete());
+
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ assertTrue(xmlEmbeddable.isMetadataComplete());
+ assertNull(xmlEmbeddable.getSpecifiedMetadataComplete());
+ assertNull(embeddableResource.getMetadataComplete());
+
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+ assertFalse(xmlEmbeddable.isMetadataComplete());
+ assertNull(xmlEmbeddable.getSpecifiedMetadataComplete());
+ assertNull(embeddableResource.getMetadataComplete());
+ }
+
+ public void testMakeEmbeddableEntity() throws Exception {
+ XmlPersistentType embeddablePersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEmbeddable embeddable = (XmlEmbeddable) embeddablePersistentType.getMapping();
+ embeddable.setSpecifiedAccess(AccessType.PROPERTY);
+ embeddable.setSpecifiedMetadataComplete(Boolean.TRUE);
+ ormResource().save(null);
+
+ embeddablePersistentType.setMappingKey(IMappingKeys.ENTITY_TYPE_MAPPING_KEY);
+ ormResource().save(null);
+
+ Entity entity = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals("model.Foo", entity.getClassName());
+ assertEquals(Boolean.TRUE, entity.getMetadataComplete());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, entity.getAccess());
+ assertNull(entity.getDiscriminatorValue());
+ assertNull(entity.getName());
+
+ XmlEntity xmlEntity = (XmlEntity) embeddablePersistentType.getMapping();
+ assertEquals("model.Foo", xmlEntity.getClass_());
+ assertEquals(Boolean.TRUE, xmlEntity.getSpecifiedMetadataComplete());
+ assertEquals(AccessType.PROPERTY, xmlEntity.getSpecifiedAccess());
+ }
+
+ //test with 2 Embeddables, make the second one an Entity so it has to move to the front of the list
+ public void testMakeEmbeddableEntity2() throws Exception {
+ entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo2");
+ XmlPersistentType embeddablePersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEmbeddable embeddable = (XmlEmbeddable) embeddablePersistentType.getMapping();
+ embeddable.setSpecifiedAccess(AccessType.PROPERTY);
+ embeddable.setSpecifiedMetadataComplete(Boolean.TRUE);
+ ormResource().save(null);
+
+ embeddablePersistentType.setMappingKey(IMappingKeys.ENTITY_TYPE_MAPPING_KEY);
+ ormResource().save(null);
+
+ Entity entity = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals("model.Foo", entity.getClassName());
+ assertEquals(Boolean.TRUE, entity.getMetadataComplete());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, entity.getAccess());
+ assertNull(entity.getDiscriminatorValue());
+ assertNull(entity.getName());
+
+ XmlEntity xmlEntity = (XmlEntity) embeddablePersistentType.getMapping();
+ assertEquals("model.Foo", xmlEntity.getClass_());
+ assertEquals(Boolean.TRUE, xmlEntity.getSpecifiedMetadataComplete());
+ assertEquals(AccessType.PROPERTY, xmlEntity.getSpecifiedAccess());
+
+ ListIterator<XmlPersistentType> persistentTypes = entityMappings().xmlPersistentTypes();
+ assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey());
+ assertEquals(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey());
+ }
+
+ public void testMakeEmbeddableMappedSuperclass() throws Exception {
+ XmlPersistentType embeddablePersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEmbeddable embeddable = (XmlEmbeddable) embeddablePersistentType.getMapping();
+ embeddable.setSpecifiedAccess(AccessType.PROPERTY);
+ embeddable.setSpecifiedMetadataComplete(Boolean.TRUE);
+ ormResource().save(null);
+
+ embeddablePersistentType.setMappingKey(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
+ ormResource().save(null);
+
+ MappedSuperclass mappedSuperclass = ormResource().getEntityMappings().getMappedSuperclasses().get(0);
+ assertEquals("model.Foo", mappedSuperclass.getClassName());
+ assertEquals(Boolean.TRUE, mappedSuperclass.getMetadataComplete());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, mappedSuperclass.getAccess());
+
+ XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) embeddablePersistentType.getMapping();
+ assertEquals("model.Foo", xmlMappedSuperclass.getClass_());
+ assertEquals(Boolean.TRUE, xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertEquals(AccessType.PROPERTY, xmlMappedSuperclass.getSpecifiedAccess());
+ }
+
+ //test with 2 Embeddables, make the second one a MappedSuperclass so it has to move to the front of the list
+ public void testMakeEmbeddableMappedSuperclass2() throws Exception {
+ entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo2");
+ XmlPersistentType embeddablePersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEmbeddable embeddable = (XmlEmbeddable) embeddablePersistentType.getMapping();
+ embeddable.setSpecifiedAccess(AccessType.PROPERTY);
+ embeddable.setSpecifiedMetadataComplete(Boolean.TRUE);
+ ormResource().save(null);
+
+ embeddablePersistentType.setMappingKey(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
+ ormResource().save(null);
+
+ MappedSuperclass mappedSuperclass = ormResource().getEntityMappings().getMappedSuperclasses().get(0);
+ assertEquals("model.Foo", mappedSuperclass.getClassName());
+ assertEquals(Boolean.TRUE, mappedSuperclass.getMetadataComplete());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, mappedSuperclass.getAccess());
+
+ XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) embeddablePersistentType.getMapping();
+ assertEquals("model.Foo", xmlMappedSuperclass.getClass_());
+ assertEquals(Boolean.TRUE, xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertEquals(AccessType.PROPERTY, xmlMappedSuperclass.getSpecifiedAccess());
+
+ ListIterator<XmlPersistentType> persistentTypes = entityMappings().xmlPersistentTypes();
+ assertEquals(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey());
+ assertEquals(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey());
+ }
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddedIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddedIdMappingTests.java
new file mode 100644
index 0000000000..f7d52f9cb0
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddedIdMappingTests.java
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.XmlAttributeOverride;
+import org.eclipse.jpt.core.internal.context.orm.XmlEmbeddedIdMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.orm.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class XmlEmbeddedIdMappingTests extends ContextModelTestCase
+{
+ public XmlEmbeddedIdMappingTests(String name) {
+ super(name);
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ public void testUpdateName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping");
+ XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) xmlPersistentAttribute.getMapping();
+ EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
+
+ assertEquals("embeddedIdMapping", xmlEmbeddedIdMapping.getName());
+ assertEquals("embeddedIdMapping", embeddedIdResource.getName());
+
+ //set name in the resource model, verify context model updated
+ embeddedIdResource.setName("newName");
+ assertEquals("newName", xmlEmbeddedIdMapping.getName());
+ assertEquals("newName", embeddedIdResource.getName());
+
+ //set name to null in the resource model
+ embeddedIdResource.setName(null);
+ assertNull(xmlEmbeddedIdMapping.getName());
+ assertNull(embeddedIdResource.getName());
+ }
+
+ public void testModifyName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping");
+ XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) xmlPersistentAttribute.getMapping();
+ EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
+
+ assertEquals("embeddedIdMapping", xmlEmbeddedIdMapping.getName());
+ assertEquals("embeddedIdMapping", embeddedIdResource.getName());
+
+ //set name in the context model, verify resource model updated
+ xmlEmbeddedIdMapping.setName("newName");
+ assertEquals("newName", xmlEmbeddedIdMapping.getName());
+ assertEquals("newName", embeddedIdResource.getName());
+
+ //set name to null in the context model
+ xmlEmbeddedIdMapping.setName(null);
+ assertNull(xmlEmbeddedIdMapping.getName());
+ assertNull(embeddedIdResource.getName());
+ }
+
+ public void testAddSpecifiedAttributeOverride() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping");
+ XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) xmlPersistentAttribute.getMapping();
+ EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
+
+ XmlAttributeOverride attributeOverride = xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(0);
+ ormResource().save(null);
+ attributeOverride.setName("FOO");
+ ormResource().save(null);
+
+ assertEquals("FOO", embeddedIdResource.getAttributeOverrides().get(0).getName());
+
+ XmlAttributeOverride attributeOverride2 = xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(0);
+ ormResource().save(null);
+ attributeOverride2.setName("BAR");
+ ormResource().save(null);
+
+ assertEquals("BAR", embeddedIdResource.getAttributeOverrides().get(0).getName());
+ assertEquals("FOO", embeddedIdResource.getAttributeOverrides().get(1).getName());
+
+ XmlAttributeOverride attributeOverride3 = xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(1);
+ ormResource().save(null);
+ attributeOverride3.setName("BAZ");
+ ormResource().save(null);
+
+ assertEquals("BAR", embeddedIdResource.getAttributeOverrides().get(0).getName());
+ assertEquals("BAZ", embeddedIdResource.getAttributeOverrides().get(1).getName());
+ assertEquals("FOO", embeddedIdResource.getAttributeOverrides().get(2).getName());
+
+ ListIterator<XmlAttributeOverride> attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals(attributeOverride2, attributeOverrides.next());
+ assertEquals(attributeOverride3, attributeOverrides.next());
+ assertEquals(attributeOverride, attributeOverrides.next());
+
+ attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+ }
+
+ public void testRemoveSpecifiedAttributeOverride() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping");
+ XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) xmlPersistentAttribute.getMapping();
+ EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
+
+ xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(0).setName("FOO");
+ xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(1).setName("BAR");
+ xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(2).setName("BAZ");
+
+ assertEquals(3, embeddedIdResource.getAttributeOverrides().size());
+
+ xmlEmbeddedIdMapping.removeSpecifiedAttributeOverride(0);
+ assertEquals(2, embeddedIdResource.getAttributeOverrides().size());
+ assertEquals("BAR", embeddedIdResource.getAttributeOverrides().get(0).getName());
+ assertEquals("BAZ", embeddedIdResource.getAttributeOverrides().get(1).getName());
+
+ xmlEmbeddedIdMapping.removeSpecifiedAttributeOverride(0);
+ assertEquals(1, embeddedIdResource.getAttributeOverrides().size());
+ assertEquals("BAZ", embeddedIdResource.getAttributeOverrides().get(0).getName());
+
+ xmlEmbeddedIdMapping.removeSpecifiedAttributeOverride(0);
+ assertEquals(0, embeddedIdResource.getAttributeOverrides().size());
+ }
+
+ public void testMoveSpecifiedAttributeOverride() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping");
+ XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) xmlPersistentAttribute.getMapping();
+ EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
+
+ xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(0).setName("FOO");
+ xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(1).setName("BAR");
+ xmlEmbeddedIdMapping.addSpecifiedAttributeOverride(2).setName("BAZ");
+
+ assertEquals(3, embeddedIdResource.getAttributeOverrides().size());
+
+
+ xmlEmbeddedIdMapping.moveSpecifiedAttributeOverride(2, 0);
+ ListIterator<XmlAttributeOverride> attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+
+ assertEquals("BAR", embeddedIdResource.getAttributeOverrides().get(0).getName());
+ assertEquals("BAZ", embeddedIdResource.getAttributeOverrides().get(1).getName());
+ assertEquals("FOO", embeddedIdResource.getAttributeOverrides().get(2).getName());
+
+
+ xmlEmbeddedIdMapping.moveSpecifiedAttributeOverride(0, 1);
+ attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+
+ assertEquals("BAZ", embeddedIdResource.getAttributeOverrides().get(0).getName());
+ assertEquals("BAR", embeddedIdResource.getAttributeOverrides().get(1).getName());
+ assertEquals("FOO", embeddedIdResource.getAttributeOverrides().get(2).getName());
+ }
+
+ public void testUpdateAttributeOverrides() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping");
+ XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) xmlPersistentAttribute.getMapping();
+ EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
+
+ embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverrideImpl());
+ embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverrideImpl());
+ embeddedIdResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverrideImpl());
+
+ embeddedIdResource.getAttributeOverrides().get(0).setName("FOO");
+ embeddedIdResource.getAttributeOverrides().get(1).setName("BAR");
+ embeddedIdResource.getAttributeOverrides().get(2).setName("BAZ");
+
+ ListIterator<XmlAttributeOverride> attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ embeddedIdResource.getAttributeOverrides().move(2, 0);
+ attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ embeddedIdResource.getAttributeOverrides().move(0, 1);
+ attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ embeddedIdResource.getAttributeOverrides().remove(1);
+ attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ embeddedIdResource.getAttributeOverrides().remove(1);
+ attributeOverrides = xmlEmbeddedIdMapping.specifiedAttributeOverrides();
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ embeddedIdResource.getAttributeOverrides().remove(0);
+ assertFalse(xmlEmbeddedIdMapping.specifiedAttributeOverrides().hasNext());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddedMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddedMappingTests.java
new file mode 100644
index 0000000000..c570b84592
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddedMappingTests.java
@@ -0,0 +1,502 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.XmlAttributeOverride;
+import org.eclipse.jpt.core.internal.context.orm.XmlColumn;
+import org.eclipse.jpt.core.internal.context.orm.XmlEmbeddedMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.orm.Embedded;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.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.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class XmlEmbeddedMappingTests extends ContextModelTestCase
+{
+ private static final String ATTRIBUTE_OVERRIDE_NAME = "city";
+ private static final String ATTRIBUTE_OVERRIDE_COLUMN_NAME = "E_CITY";
+
+ public XmlEmbeddedMappingTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createEmbeddedAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Embedded", "");
+ }
+
+ private void createColumnAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Column",
+ "String name() default \"\";" +
+ "boolean unique() default false;" +
+ "boolean nullable() default true;" +
+ "boolean insertable() default true;" +
+ "boolean updatable() default true;" +
+ "String columnDefinition() default \"\";" +
+ "String table() default \"\";" +
+ "int length() default 255;" +
+ "int precision() default 0;" +
+ "int scale() default 0;");
+ }
+
+ private void createAttributeOverrideAnnotation() throws Exception {
+ createColumnAnnotation();
+ this.createAnnotationAndMembers("AttributeOverride",
+ "String name();" +
+ "Column column();");
+ }
+
+ private IType createTestEntityEmbeddedMapping() throws Exception {
+ createEntityAnnotation();
+ createEmbeddedAnnotation();
+ createAttributeOverrideAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.EMBEDDED, JPA.ATTRIBUTE_OVERRIDE, JPA.COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @Embedded");
+ sb.append(CR);
+ sb.append(" @AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\", column=@Column(name=\"" + ATTRIBUTE_OVERRIDE_COLUMN_NAME + "\"))");
+ sb.append(CR);
+ sb.append(" private Address address;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id");
+ }
+ });
+ }
+
+ private IType createTestEmbeddableAddress() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.EMBEDDABLE);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ID);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.COLUMN);
+ sb.append(";");
+ sb.append(CR);
+ sb.append(CR);
+ sb.append("@Embeddable");
+ sb.append(CR);
+ sb.append("public class ").append("Address").append(" ");
+ sb.append("{").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ sb.append(" private int id;").append(CR);
+ sb.append(CR);
+ sb.append(" private String city;").append(CR);
+ sb.append(CR);
+ sb.append(" @Column(name=\"A_STATE\")").append(CR);
+ sb.append(" private String state;").append(CR);
+ sb.append(CR);
+ sb.append(" private int zip;").append(CR);
+ sb.append(CR);
+ sb.append("}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "Address.java", sourceWriter);
+ }
+
+ public void testUpdateName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
+ XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping();
+ Embedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
+
+ assertEquals("embeddedMapping", xmlEmbeddedMapping.getName());
+ assertEquals("embeddedMapping", embeddedResource.getName());
+
+ //set name in the resource model, verify context model updated
+ embeddedResource.setName("newName");
+ assertEquals("newName", xmlEmbeddedMapping.getName());
+ assertEquals("newName", embeddedResource.getName());
+
+ //set name to null in the resource model
+ embeddedResource.setName(null);
+ assertNull(xmlEmbeddedMapping.getName());
+ assertNull(embeddedResource.getName());
+ }
+
+ public void testModifyName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
+ XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping();
+ Embedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
+
+ assertEquals("embeddedMapping", xmlEmbeddedMapping.getName());
+ assertEquals("embeddedMapping", embeddedResource.getName());
+
+ //set name in the context model, verify resource model updated
+ xmlEmbeddedMapping.setName("newName");
+ assertEquals("newName", xmlEmbeddedMapping.getName());
+ assertEquals("newName", embeddedResource.getName());
+
+ //set name to null in the context model
+ xmlEmbeddedMapping.setName(null);
+ assertNull(xmlEmbeddedMapping.getName());
+ assertNull(embeddedResource.getName());
+ }
+
+ public void testAddSpecifiedAttributeOverride() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
+ XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping();
+ Embedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
+
+ XmlAttributeOverride attributeOverride = xmlEmbeddedMapping.addSpecifiedAttributeOverride(0);
+ ormResource().save(null);
+ attributeOverride.setName("FOO");
+ ormResource().save(null);
+
+ assertEquals("FOO", embeddedResource.getAttributeOverrides().get(0).getName());
+
+ XmlAttributeOverride attributeOverride2 = xmlEmbeddedMapping.addSpecifiedAttributeOverride(0);
+ ormResource().save(null);
+ attributeOverride2.setName("BAR");
+ ormResource().save(null);
+
+ assertEquals("BAR", embeddedResource.getAttributeOverrides().get(0).getName());
+ assertEquals("FOO", embeddedResource.getAttributeOverrides().get(1).getName());
+
+ XmlAttributeOverride attributeOverride3 = xmlEmbeddedMapping.addSpecifiedAttributeOverride(1);
+ ormResource().save(null);
+ attributeOverride3.setName("BAZ");
+ ormResource().save(null);
+
+ assertEquals("BAR", embeddedResource.getAttributeOverrides().get(0).getName());
+ assertEquals("BAZ", embeddedResource.getAttributeOverrides().get(1).getName());
+ assertEquals("FOO", embeddedResource.getAttributeOverrides().get(2).getName());
+
+ ListIterator<XmlAttributeOverride> attributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides();
+ assertEquals(attributeOverride2, attributeOverrides.next());
+ assertEquals(attributeOverride3, attributeOverrides.next());
+ assertEquals(attributeOverride, attributeOverrides.next());
+
+ attributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides();
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+ }
+
+ public void testRemoveSpecifiedAttributeOverride() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
+ XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping();
+ Embedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
+
+ xmlEmbeddedMapping.addSpecifiedAttributeOverride(0).setName("FOO");
+ xmlEmbeddedMapping.addSpecifiedAttributeOverride(1).setName("BAR");
+ xmlEmbeddedMapping.addSpecifiedAttributeOverride(2).setName("BAZ");
+
+ assertEquals(3, embeddedResource.getAttributeOverrides().size());
+
+ xmlEmbeddedMapping.removeSpecifiedAttributeOverride(0);
+ assertEquals(2, embeddedResource.getAttributeOverrides().size());
+ assertEquals("BAR", embeddedResource.getAttributeOverrides().get(0).getName());
+ assertEquals("BAZ", embeddedResource.getAttributeOverrides().get(1).getName());
+
+ xmlEmbeddedMapping.removeSpecifiedAttributeOverride(0);
+ assertEquals(1, embeddedResource.getAttributeOverrides().size());
+ assertEquals("BAZ", embeddedResource.getAttributeOverrides().get(0).getName());
+
+ xmlEmbeddedMapping.removeSpecifiedAttributeOverride(0);
+ assertEquals(0, embeddedResource.getAttributeOverrides().size());
+ }
+
+ public void testMoveSpecifiedAttributeOverride() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
+ XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping();
+ Embedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
+
+ xmlEmbeddedMapping.addSpecifiedAttributeOverride(0).setName("FOO");
+ xmlEmbeddedMapping.addSpecifiedAttributeOverride(1).setName("BAR");
+ xmlEmbeddedMapping.addSpecifiedAttributeOverride(2).setName("BAZ");
+
+ assertEquals(3, embeddedResource.getAttributeOverrides().size());
+
+
+ xmlEmbeddedMapping.moveSpecifiedAttributeOverride(2, 0);
+ ListIterator<XmlAttributeOverride> attributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides();
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+
+ assertEquals("BAR", embeddedResource.getAttributeOverrides().get(0).getName());
+ assertEquals("BAZ", embeddedResource.getAttributeOverrides().get(1).getName());
+ assertEquals("FOO", embeddedResource.getAttributeOverrides().get(2).getName());
+
+
+ xmlEmbeddedMapping.moveSpecifiedAttributeOverride(0, 1);
+ attributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides();
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+
+ assertEquals("BAZ", embeddedResource.getAttributeOverrides().get(0).getName());
+ assertEquals("BAR", embeddedResource.getAttributeOverrides().get(1).getName());
+ assertEquals("FOO", embeddedResource.getAttributeOverrides().get(2).getName());
+ }
+
+ public void testUpdateAttributeOverrides() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
+ XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping();
+ Embedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
+
+ embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverrideImpl());
+ embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverrideImpl());
+ embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverrideImpl());
+
+ embeddedResource.getAttributeOverrides().get(0).setName("FOO");
+ embeddedResource.getAttributeOverrides().get(1).setName("BAR");
+ embeddedResource.getAttributeOverrides().get(2).setName("BAZ");
+
+ ListIterator<XmlAttributeOverride> attributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides();
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ embeddedResource.getAttributeOverrides().move(2, 0);
+ attributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides();
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ embeddedResource.getAttributeOverrides().move(0, 1);
+ attributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides();
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ embeddedResource.getAttributeOverrides().remove(1);
+ attributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides();
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ embeddedResource.getAttributeOverrides().remove(1);
+ attributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides();
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ embeddedResource.getAttributeOverrides().remove(0);
+ assertFalse(xmlEmbeddedMapping.specifiedAttributeOverrides().hasNext());
+ }
+
+
+ public void testEmbeddedMappingNoUnderylingJavaAttribute() throws Exception {
+ createTestEntityEmbeddedMapping();
+ createTestEmbeddableAddress();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
+ xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "foo");
+ assertEquals(3, xmlPersistentType.virtualAttributesSize());
+
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next();
+ XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping();
+
+ assertEquals("foo", xmlEmbeddedMapping.getName());
+
+
+ assertFalse(xmlEmbeddedMapping.specifiedAttributeOverrides().hasNext());
+ assertFalse(xmlEmbeddedMapping.defaultAttributeOverrides().hasNext());
+ }
+
+
+ public void testVirtualMappingMetadataCompleteFalse() throws Exception {
+ createTestEntityEmbeddedMapping();
+ createTestEmbeddableAddress();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
+ assertEquals(3, xmlPersistentType.virtualAttributesSize());
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next();
+
+ XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping();
+ assertEquals("address", xmlEmbeddedMapping.getName());
+
+ assertEquals(4, xmlEmbeddedMapping.specifiedAttributeOverridesSize());
+ assertEquals(0, CollectionTools.size(xmlEmbeddedMapping.defaultAttributeOverrides()));
+ ListIterator<XmlAttributeOverride> xmlAttributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides();
+
+ XmlAttributeOverride xmlAttributeOverride = xmlAttributeOverrides.next();
+ assertEquals(ATTRIBUTE_OVERRIDE_NAME, xmlAttributeOverride.getName());
+ XmlColumn xmlColumn = xmlAttributeOverride.getColumn();
+ assertEquals(ATTRIBUTE_OVERRIDE_COLUMN_NAME, xmlColumn.getSpecifiedName());
+// assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUnique());
+// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable());
+// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedInsertable());
+// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUpdatable());
+// assertEquals("COLUMN_DEFINITION", xmlColumn.getColumnDefinition());
+// assertEquals("MY_TABLE", xmlColumn.getSpecifiedTable());
+// assertEquals(Integer.valueOf(5), xmlColumn.getSpecifiedLength());
+// assertEquals(Integer.valueOf(6), xmlColumn.getSpecifiedPrecision());
+// assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedScale());
+
+ xmlAttributeOverride = xmlAttributeOverrides.next();
+ assertEquals("id", xmlAttributeOverride.getName());
+ xmlColumn = xmlAttributeOverride.getColumn();
+ assertEquals("id", xmlColumn.getSpecifiedName());
+
+ xmlAttributeOverride = xmlAttributeOverrides.next();
+ assertEquals("state", xmlAttributeOverride.getName());
+ xmlColumn = xmlAttributeOverride.getColumn();
+ assertEquals("A_STATE", xmlColumn.getSpecifiedName());
+
+ xmlAttributeOverride = xmlAttributeOverrides.next();
+ assertEquals("zip", xmlAttributeOverride.getName());
+ xmlColumn = xmlAttributeOverride.getColumn();
+ assertEquals("zip", xmlColumn.getSpecifiedName());
+
+ }
+
+ public void testVirtualMappingMetadataCompleteTrue() throws Exception {
+ createTestEntityEmbeddedMapping();
+ createTestEmbeddableAddress();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
+ xmlPersistentType.getMapping().setSpecifiedMetadataComplete(true);
+ assertEquals(3, xmlPersistentType.virtualAttributesSize());
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next();
+
+ XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping();
+ assertEquals("address", xmlEmbeddedMapping.getName());
+
+ //TODO
+// assertEquals(4, xmlEmbeddedMapping.specifiedAttributeOverridesSize());
+// assertEquals(0, CollectionTools.size(xmlEmbeddedMapping.defaultAttributeOverrides()));
+// ListIterator<XmlAttributeOverride> xmlAttributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides();
+//
+// XmlAttributeOverride xmlAttributeOverride = xmlAttributeOverrides.next();
+// assertEquals(ATTRIBUTE_OVERRIDE_NAME, xmlAttributeOverride.getName());
+// XmlColumn xmlColumn = xmlAttributeOverride.getColumn();
+// assertEquals("city", xmlColumn.getSpecifiedName());
+//// assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUnique());
+//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable());
+//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedInsertable());
+//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUpdatable());
+//// assertEquals("COLUMN_DEFINITION", xmlColumn.getColumnDefinition());
+//// assertEquals("MY_TABLE", xmlColumn.getSpecifiedTable());
+//// assertEquals(Integer.valueOf(5), xmlColumn.getSpecifiedLength());
+//// assertEquals(Integer.valueOf(6), xmlColumn.getSpecifiedPrecision());
+//// assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedScale());
+//
+// xmlAttributeOverride = xmlAttributeOverrides.next();
+// assertEquals("id", xmlAttributeOverride.getName());
+// xmlColumn = xmlAttributeOverride.getColumn();
+// assertEquals("id", xmlColumn.getSpecifiedName());
+//
+// xmlAttributeOverride = xmlAttributeOverrides.next();
+// assertEquals("state", xmlAttributeOverride.getName());
+// xmlColumn = xmlAttributeOverride.getColumn();
+// assertEquals("state", xmlColumn.getSpecifiedName());
+//
+// xmlAttributeOverride = xmlAttributeOverrides.next();
+// assertEquals("zip", xmlAttributeOverride.getName());
+// xmlColumn = xmlAttributeOverride.getColumn();
+// assertEquals("zip", xmlColumn.getSpecifiedName());
+ }
+
+ public void testSpecifiedMapping() throws Exception {
+ createTestEntityEmbeddedMapping();
+ createTestEmbeddableAddress();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
+
+ xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "address");
+ assertEquals(2, xmlPersistentType.virtualAttributesSize());
+
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next();
+ XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping();
+
+ assertEquals("address", xmlEmbeddedMapping.getName());
+
+ assertEquals(0, xmlEmbeddedMapping.specifiedAttributeOverridesSize());
+ //TODO
+// assertEquals(4, CollectionTools.size(xmlEmbeddedMapping.defaultAttributeOverrides()));
+// ListIterator<XmlAttributeOverride> xmlAttributeOverrides = xmlEmbeddedMapping.defaultAttributeOverrides();
+//
+// XmlAttributeOverride xmlAttributeOverride = xmlAttributeOverrides.next();
+// assertEquals(ATTRIBUTE_OVERRIDE_NAME, xmlAttributeOverride.getName());
+// XmlColumn xmlColumn = xmlAttributeOverride.getColumn();
+// assertEquals("city", xmlColumn.getDefaultName());
+//// assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUnique());
+//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable());
+//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedInsertable());
+//// assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUpdatable());
+//// assertEquals("COLUMN_DEFINITION", xmlColumn.getColumnDefinition());
+//// assertEquals("MY_TABLE", xmlColumn.getSpecifiedTable());
+//// assertEquals(Integer.valueOf(5), xmlColumn.getSpecifiedLength());
+//// assertEquals(Integer.valueOf(6), xmlColumn.getSpecifiedPrecision());
+//// assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedScale());
+//
+// xmlAttributeOverride = xmlAttributeOverrides.next();
+// assertEquals("id", xmlAttributeOverride.getName());
+// xmlColumn = xmlAttributeOverride.getColumn();
+// assertEquals("id", xmlColumn.getDefaultName());
+//
+// xmlAttributeOverride = xmlAttributeOverrides.next();
+// assertEquals("state", xmlAttributeOverride.getName());
+// xmlColumn = xmlAttributeOverride.getColumn();
+// assertEquals("state", xmlColumn.getDefaultName());
+//
+// xmlAttributeOverride = xmlAttributeOverrides.next();
+// assertEquals("zip", xmlAttributeOverride.getName());
+// xmlColumn = xmlAttributeOverride.getColumn();
+// assertEquals("zip", xmlColumn.getDefaultName());
+ }
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEntityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEntityTests.java
new file mode 100644
index 0000000000..d385300979
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEntityTests.java
@@ -0,0 +1,1901 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.base.InheritanceType;
+import org.eclipse.jpt.core.internal.context.orm.XmlAssociationOverride;
+import org.eclipse.jpt.core.internal.context.orm.XmlAttributeOverride;
+import org.eclipse.jpt.core.internal.context.orm.XmlEmbeddable;
+import org.eclipse.jpt.core.internal.context.orm.XmlEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlMappedSuperclass;
+import org.eclipse.jpt.core.internal.context.orm.XmlNamedNativeQuery;
+import org.eclipse.jpt.core.internal.context.orm.XmlNamedQuery;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.context.orm.XmlPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.context.orm.XmlSecondaryTable;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.orm.Embeddable;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.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.iterators.ArrayIterator;
+
+public class XmlEntityTests extends ContextModelTestCase
+{
+ public XmlEntityTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createIdAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Id", "");
+ }
+
+ private IType createTestEntityDefaultFieldAccess() throws Exception {
+ createEntityAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ });
+ }
+
+ private IType createTestEntityFieldAccess() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestEntityPropertyAccess() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestSubType() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
+ sb.append("extends " + TYPE_NAME + " ");
+ sb.append("{}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
+ }
+
+
+ public void testUpdateSpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlEntity.getSpecifiedName());
+ assertNull(entityResource.getName());
+
+ //set name in the resource model, verify context model updated
+ entityResource.setName("foo");
+ assertEquals("foo", xmlEntity.getSpecifiedName());
+ assertEquals("foo", entityResource.getName());
+
+ //set name to null in the resource model
+ entityResource.setName(null);
+ assertNull(xmlEntity.getSpecifiedName());
+ assertNull(entityResource.getName());
+ }
+
+ public void testModifySpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlEntity.getSpecifiedName());
+ assertNull(entityResource.getName());
+
+ //set name in the context model, verify resource model modified
+ xmlEntity.setSpecifiedName("foo");
+ assertEquals("foo", xmlEntity.getSpecifiedName());
+ assertEquals("foo", entityResource.getName());
+
+ //set name to null in the context model
+ xmlEntity.setSpecifiedName(null);
+ assertNull(xmlEntity.getSpecifiedName());
+ assertNull(entityResource.getName());
+ }
+
+ public void testUpdateDefaultName() throws Exception {
+ createTestEntityFieldAccess();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals(TYPE_NAME, xmlEntity.getDefaultName());
+
+ xmlEntity.javaEntity().setSpecifiedName("Foo");
+ //xml default name is not affect by what is specified in java
+ assertEquals(TYPE_NAME, xmlEntity.getDefaultName());
+
+ //set class in the resource model, verify context model updated
+ entityResource.setClassName("com.Bar");
+ assertEquals("Bar", xmlEntity.getDefaultName());
+
+ //set class to null in the resource model
+ entityResource.setClassName(null);
+ assertNull(xmlEntity.getDefaultName());
+ }
+
+ public void testUpdateName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals("Foo", xmlEntity.getName());
+
+ //set class in the resource model, verify context model updated
+ entityResource.setClassName("com.Bar");
+ assertEquals("Bar", xmlEntity.getName());
+
+ entityResource.setName("Baz");
+ assertEquals("Baz", xmlEntity.getName());
+
+ //set class to null in the resource model
+ entityResource.setClassName(null);
+ assertEquals("Baz", xmlEntity.getName());
+
+ entityResource.setName(null);
+ assertNull(xmlEntity.getName());
+ }
+
+ public void testUpdateClass() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals("model.Foo", xmlEntity.getClass_());
+ assertEquals("model.Foo", entityResource.getClassName());
+
+ //set class in the resource model, verify context model updated
+ entityResource.setClassName("com.Bar");
+ assertEquals("com.Bar", xmlEntity.getClass_());
+ assertEquals("com.Bar", entityResource.getClassName());
+
+ //set class to null in the resource model
+ entityResource.setClassName(null);
+ assertNull(xmlEntity.getClass_());
+ assertNull(entityResource.getClassName());
+ }
+
+ public void testModifyClass() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals("model.Foo", xmlEntity.getClass_());
+ assertEquals("model.Foo", entityResource.getClassName());
+
+ //set class in the context model, verify resource model modified
+ xmlEntity.setClass("com.Bar");
+ assertEquals("com.Bar", xmlEntity.getClass_());
+ assertEquals("com.Bar", entityResource.getClassName());
+
+ //set class to null in the context model
+ xmlEntity.setClass(null);
+ assertNull(xmlEntity.getClass_());
+ assertNull(entityResource.getClassName());
+ }
+ //TODO add tests for setting the className when the package is set on entity-mappings
+
+ public void testUpdateSpecifiedAccess() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlEntity.getSpecifiedAccess());
+ assertNull(entityResource.getAccess());
+
+ //set access in the resource model, verify context model updated
+ entityResource.setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD);
+ ormResource().save(null);
+ assertEquals(AccessType.FIELD, xmlEntity.getSpecifiedAccess());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD, entityResource.getAccess());
+
+ //set access to null in the resource model
+ entityResource.setAccess(null);
+ assertNull(xmlEntity.getSpecifiedAccess());
+ assertNull(entityResource.getAccess());
+ }
+
+ public void testModifySpecifiedAccess() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlEntity.getSpecifiedAccess());
+ assertNull(entityResource.getAccess());
+
+ //set access in the context model, verify resource model modified
+ xmlEntity.setSpecifiedAccess(AccessType.PROPERTY);
+ assertEquals(AccessType.PROPERTY, xmlEntity.getSpecifiedAccess());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, entityResource.getAccess());
+
+ //set access to null in the context model
+ xmlEntity.setSpecifiedAccess(null);
+ assertNull(xmlEntity.getSpecifiedAccess());
+ assertNull(entityResource.getAccess());
+ }
+
+ public void testUpdateDefaultAccessFromPersistenceUnitDefaults() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlEntity.getSpecifiedAccess());
+ assertNull(xmlEntity.getDefaultAccess());
+ assertNull(entityResource.getAccess());
+
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createPersistenceUnitDefaults());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD);
+ assertEquals(AccessType.FIELD, xmlEntity.getDefaultAccess());
+ assertNull(xmlEntity.getSpecifiedAccess());
+ assertNull(entityResource.getAccess());
+
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY);
+ assertEquals(AccessType.PROPERTY, xmlEntity.getDefaultAccess());
+ assertNull(xmlEntity.getSpecifiedAccess());
+ assertNull(entityResource.getAccess());
+
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(null);
+ assertNull(xmlEntity.getSpecifiedAccess());
+ assertNull(xmlEntity.getDefaultAccess());
+ assertNull(entityResource.getAccess());
+ }
+
+ public void testUpdateDefaultAccessFromJava() throws Exception {
+ createTestEntityDefaultFieldAccess();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ //java has no annotations, so defaultAccess in xml is null
+ assertNull(xmlEntity.getDefaultAccess());
+
+ entityMappings().setSpecifiedAccess(AccessType.FIELD);
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
+ //entityMappings access wins over persistence-unit-defaults access
+ assertEquals(AccessType.FIELD, xmlEntity.getDefaultAccess());
+
+ entityMappings().setSpecifiedAccess(null);
+ //persistence-unit-defaults access used now
+ assertEquals(AccessType.PROPERTY, xmlEntity.getDefaultAccess());
+
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(null);
+ assertNull(xmlEntity.getDefaultAccess());
+
+ xmlPersistentType.javaPersistentType().attributeNamed("id").setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
+ //java has annotations on fields now, that should win in all cases
+ assertEquals(AccessType.FIELD, xmlEntity.getDefaultAccess());
+
+ entityMappings().setSpecifiedAccess(AccessType.PROPERTY);
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
+ assertEquals(AccessType.FIELD, xmlEntity.getDefaultAccess());
+
+ xmlPersistentType.javaPersistentType().attributeNamed("id").setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
+ assertEquals(AccessType.PROPERTY, xmlEntity.getDefaultAccess());
+ }
+
+ public void testUpdateDefaultAccessFromJavaFieldAccess() throws Exception {
+ createTestEntityFieldAccess();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ assertEquals(AccessType.FIELD, xmlEntity.getDefaultAccess());
+
+ xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+ assertNull(xmlEntity.getDefaultAccess());
+
+ xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+ assertEquals(AccessType.FIELD, xmlEntity.getDefaultAccess());
+
+ entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ assertNull(xmlEntity.getDefaultAccess());
+
+ xmlEntity.setSpecifiedMetadataComplete(null);
+ assertNull(xmlEntity.getDefaultAccess());
+
+ entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+ assertEquals(AccessType.FIELD, xmlEntity.getDefaultAccess());
+ }
+
+ public void testUpdateDefaultAccessFromJavaPropertyAccess() throws Exception {
+ createTestEntityPropertyAccess();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ assertEquals(AccessType.PROPERTY, xmlEntity.getDefaultAccess());
+
+ xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+ assertNull(xmlEntity.getDefaultAccess());
+
+ xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+ assertEquals(AccessType.PROPERTY, xmlEntity.getDefaultAccess());
+
+ entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ assertNull(xmlEntity.getDefaultAccess());
+
+ xmlEntity.setSpecifiedMetadataComplete(null);
+ assertNull(xmlEntity.getDefaultAccess());
+
+ entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+ assertEquals(AccessType.PROPERTY, xmlEntity.getDefaultAccess());
+ }
+
+ public void testUpdateDefaultAccessNoUnderlyingJava() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ assertNull(xmlEntity.getDefaultAccess());
+ }
+
+ public void testUpdateSpecifiedMetadataComplete() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlEntity.getSpecifiedMetadataComplete());
+ assertNull(entityResource.getMetadataComplete());
+
+ //set metadata-complete in the resource model, verify context model updated
+ entityResource.setMetadataComplete(true);
+ ormResource().save(null);
+ assertTrue(xmlEntity.getSpecifiedMetadataComplete());
+ assertTrue(entityResource.getMetadataComplete());
+
+ //set access to false in the resource model
+ entityResource.setMetadataComplete(false);
+ ormResource().save(null);
+ assertFalse(xmlEntity.getSpecifiedMetadataComplete());
+ assertFalse(entityResource.getMetadataComplete());
+
+ entityResource.setMetadataComplete(null);
+ ormResource().save(null);
+ assertNull(xmlEntity.getSpecifiedMetadataComplete());
+ assertNull(entityResource.getMetadataComplete());
+ }
+
+ public void testModifySpecifiedMetadataComplete() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlEntity.getSpecifiedMetadataComplete());
+ assertNull(entityResource.getMetadataComplete());
+
+ //set access in the context model, verify resource model modified
+ xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+ assertTrue(xmlEntity.getSpecifiedMetadataComplete());
+ assertTrue(entityResource.getMetadataComplete());
+
+ //set access to null in the context model
+ xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+ assertFalse(xmlEntity.getSpecifiedMetadataComplete());
+ assertFalse(entityResource.getMetadataComplete());
+
+ xmlEntity.setSpecifiedMetadataComplete(null);
+ assertNull(xmlEntity.getSpecifiedMetadataComplete());
+ assertNull(entityResource.getMetadataComplete());
+ }
+
+ public void testUpdateDefaultMetadataComplete() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlEntity.getSpecifiedMetadataComplete());
+ assertFalse(xmlEntity.isDefaultMetadataComplete());
+ assertNull(entityResource.getMetadataComplete());
+
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ assertTrue(xmlEntity.isDefaultMetadataComplete());
+ assertNull(xmlEntity.getSpecifiedMetadataComplete());
+ assertNull(entityResource.getMetadataComplete());
+
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+ assertNull(xmlEntity.getSpecifiedMetadataComplete());
+ assertFalse(xmlEntity.isDefaultMetadataComplete());
+ assertNull(entityResource.getMetadataComplete());
+
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ xmlEntity.setSpecifiedMetadataComplete(false);
+ assertFalse(xmlEntity.getSpecifiedMetadataComplete());
+ assertTrue(xmlEntity.isDefaultMetadataComplete());
+ assertTrue(xmlEntity.isMetadataComplete());
+ }
+
+ public void testUpdateMetadataComplete() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlEntity.getSpecifiedMetadataComplete());
+ assertFalse(xmlEntity.isMetadataComplete());
+ assertNull(entityResource.getMetadataComplete());
+
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ assertTrue(xmlEntity.isMetadataComplete());
+ assertNull(xmlEntity.getSpecifiedMetadataComplete());
+ assertNull(entityResource.getMetadataComplete());
+
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+ assertFalse(xmlEntity.isMetadataComplete());
+ assertNull(xmlEntity.getSpecifiedMetadataComplete());
+ assertNull(entityResource.getMetadataComplete());
+ }
+
+
+ public void testUpdateInheritanceStrategy() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals(InheritanceType.SINGLE_TABLE, xmlEntity.getInheritanceStrategy());
+ assertNull(entityResource.getInheritance());
+
+ //set inheritance strategy in the resource model, verify context model updated
+ entityResource.setInheritance(OrmFactory.eINSTANCE.createInheritance());
+ entityResource.getInheritance().setStrategy(org.eclipse.jpt.core.internal.resource.orm.InheritanceType.TABLE_PER_CLASS);
+
+ assertEquals(InheritanceType.TABLE_PER_CLASS, xmlEntity.getInheritanceStrategy());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.InheritanceType.TABLE_PER_CLASS, entityResource.getInheritance().getStrategy());
+ }
+
+ public void testUpdateDefaultInheritanceStrategyFromJava() throws Exception {
+ createTestEntityDefaultFieldAccess();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ //no inheritance strategy specified in java so single-table is default
+ assertEquals(InheritanceType.SINGLE_TABLE, xmlEntity.getDefaultInheritanceStrategy());
+
+ xmlEntity.javaEntity().setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+ assertEquals(InheritanceType.JOINED, xmlEntity.getDefaultInheritanceStrategy());
+
+ xmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.TABLE_PER_CLASS);
+ ormResource().save(null);
+ //inheritance tag exists in xml, so it overrides anything in java
+ assertEquals(InheritanceType.SINGLE_TABLE, xmlEntity.getDefaultInheritanceStrategy());
+
+ xmlEntity.setSpecifiedInheritanceStrategy(null);
+ ormResource().save(null);
+ assertEquals(InheritanceType.JOINED, xmlEntity.getDefaultInheritanceStrategy());
+
+ xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+ ormResource().save(null);
+ assertEquals(InheritanceType.SINGLE_TABLE, xmlEntity.getDefaultInheritanceStrategy());
+
+ xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+ assertEquals(InheritanceType.JOINED, xmlEntity.getDefaultInheritanceStrategy());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ //this setting overrides the false meta-data complete found on xmlEntity
+ assertEquals(InheritanceType.SINGLE_TABLE, xmlEntity.getDefaultInheritanceStrategy());
+ }
+
+ public void testUpdateDefaultInheritanceStrategyFromParent() throws Exception {
+ createTestEntityDefaultFieldAccess();
+ createTestSubType();
+
+ XmlPersistentType parentPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlPersistentType childPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+ XmlEntity parentXmlEntity = (XmlEntity) parentPersistentType.getMapping();
+ XmlEntity childXmlEntity = (XmlEntity) childPersistentType.getMapping();
+
+ assertEquals(parentXmlEntity, childXmlEntity.parentEntity());
+ assertEquals(InheritanceType.SINGLE_TABLE, childXmlEntity.getDefaultInheritanceStrategy());
+
+ //change root inheritance strategy, verify default is changed for child entity
+ parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.TABLE_PER_CLASS);
+ assertEquals(InheritanceType.SINGLE_TABLE, parentXmlEntity.getDefaultInheritanceStrategy());
+ assertEquals(InheritanceType.TABLE_PER_CLASS, childXmlEntity.getDefaultInheritanceStrategy());
+ assertNull(childXmlEntity.getSpecifiedInheritanceStrategy());
+
+ //set specified inheritance strategy in java and verify defaults in xml are correct
+ parentXmlEntity.setSpecifiedInheritanceStrategy(null);
+ parentXmlEntity.javaEntity().setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+ assertEquals(InheritanceType.JOINED, parentXmlEntity.getDefaultInheritanceStrategy());
+ assertEquals(InheritanceType.JOINED, childXmlEntity.getDefaultInheritanceStrategy());
+ assertNull(parentXmlEntity.getSpecifiedInheritanceStrategy());
+ assertNull(childXmlEntity.getSpecifiedInheritanceStrategy());
+
+ parentPersistentType.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ assertEquals(InheritanceType.SINGLE_TABLE, parentXmlEntity.getDefaultInheritanceStrategy());
+ assertEquals(InheritanceType.SINGLE_TABLE, childXmlEntity.getDefaultInheritanceStrategy());
+ }
+
+ public void testUpdateSpecifiedInheritanceStrategy() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlEntity.getSpecifiedInheritanceStrategy());
+ assertNull(entityResource.getInheritance());
+
+ //set strategy in the resource model, verify context model updated
+ entityResource.setInheritance(OrmFactory.eINSTANCE.createInheritance());
+ entityResource.getInheritance().setStrategy(org.eclipse.jpt.core.internal.resource.orm.InheritanceType.JOINED);
+ assertEquals(InheritanceType.JOINED, xmlEntity.getSpecifiedInheritanceStrategy());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.InheritanceType.JOINED, entityResource.getInheritance().getStrategy());
+
+ //set strategy to null in the resource model
+ entityResource.getInheritance().setStrategy(null);
+ assertNull(xmlEntity.getSpecifiedInheritanceStrategy());
+ assertNull(entityResource.getInheritance().getStrategy());
+
+ entityResource.getInheritance().setStrategy(org.eclipse.jpt.core.internal.resource.orm.InheritanceType.SINGLE_TABLE);
+ assertEquals(InheritanceType.SINGLE_TABLE, xmlEntity.getSpecifiedInheritanceStrategy());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.InheritanceType.SINGLE_TABLE, entityResource.getInheritance().getStrategy());
+
+ entityResource.setInheritance(null);
+ assertNull(xmlEntity.getSpecifiedInheritanceStrategy());
+ assertNull(entityResource.getInheritance());
+ }
+
+ public void testModifySpecifiedInheritanceStrategy() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlEntity.getSpecifiedInheritanceStrategy());
+ assertNull(entityResource.getInheritance());
+
+ //set strategy in the context model, verify resource model modified
+ xmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.TABLE_PER_CLASS);
+ assertEquals(InheritanceType.TABLE_PER_CLASS, xmlEntity.getSpecifiedInheritanceStrategy());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.InheritanceType.TABLE_PER_CLASS, entityResource.getInheritance().getStrategy());
+
+ //set strategy to null in the context model
+ xmlEntity.setSpecifiedInheritanceStrategy(null);
+ assertNull(xmlEntity.getSpecifiedInheritanceStrategy());
+ assertNull(entityResource.getInheritance());
+ }
+
+ public void testAddSpecifiedSecondaryTable() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ XmlSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0);
+ ormResource().save(null);
+ secondaryTable.setSpecifiedName("FOO");
+ ormResource().save(null);
+
+ assertEquals("FOO", entityResource.getSecondaryTables().get(0).getName());
+
+ XmlSecondaryTable secondaryTable2 = xmlEntity.addSpecifiedSecondaryTable(0);
+ ormResource().save(null);
+ secondaryTable2.setSpecifiedName("BAR");
+ ormResource().save(null);
+
+ assertEquals("BAR", entityResource.getSecondaryTables().get(0).getName());
+ assertEquals("FOO", entityResource.getSecondaryTables().get(1).getName());
+
+ XmlSecondaryTable secondaryTable3 = xmlEntity.addSpecifiedSecondaryTable(1);
+ ormResource().save(null);
+ secondaryTable3.setSpecifiedName("BAZ");
+ ormResource().save(null);
+
+ assertEquals("BAR", entityResource.getSecondaryTables().get(0).getName());
+ assertEquals("BAZ", entityResource.getSecondaryTables().get(1).getName());
+ assertEquals("FOO", entityResource.getSecondaryTables().get(2).getName());
+
+ ListIterator<XmlSecondaryTable> secondaryTables = xmlEntity.specifiedSecondaryTables();
+ assertEquals(secondaryTable2, secondaryTables.next());
+ assertEquals(secondaryTable3, secondaryTables.next());
+ assertEquals(secondaryTable, secondaryTables.next());
+
+ secondaryTables = xmlEntity.specifiedSecondaryTables();
+ assertEquals("BAR", secondaryTables.next().getName());
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertEquals("FOO", secondaryTables.next().getName());
+ }
+
+ public void testRemoveSpecifiedSecondaryTable() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ xmlEntity.addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
+ xmlEntity.addSpecifiedSecondaryTable(1).setSpecifiedName("BAR");
+ xmlEntity.addSpecifiedSecondaryTable(2).setSpecifiedName("BAZ");
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals(3, entityResource.getSecondaryTables().size());
+
+ xmlEntity.removeSpecifiedSecondaryTable(0);
+ assertEquals(2, entityResource.getSecondaryTables().size());
+ assertEquals("BAR", entityResource.getSecondaryTables().get(0).getName());
+ assertEquals("BAZ", entityResource.getSecondaryTables().get(1).getName());
+
+ xmlEntity.removeSpecifiedSecondaryTable(0);
+ assertEquals(1, entityResource.getSecondaryTables().size());
+ assertEquals("BAZ", entityResource.getSecondaryTables().get(0).getName());
+
+ xmlEntity.removeSpecifiedSecondaryTable(0);
+ assertEquals(0, entityResource.getSecondaryTables().size());
+ }
+
+ public void testMoveSpecifiedSecondaryTable() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ xmlEntity.addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
+ xmlEntity.addSpecifiedSecondaryTable(1).setSpecifiedName("BAR");
+ xmlEntity.addSpecifiedSecondaryTable(2).setSpecifiedName("BAZ");
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals(3, entityResource.getSecondaryTables().size());
+
+
+ xmlEntity.moveSpecifiedSecondaryTable(2, 0);
+ ListIterator<XmlSecondaryTable> secondaryTables = xmlEntity.specifiedSecondaryTables();
+ assertEquals("BAR", secondaryTables.next().getName());
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertEquals("FOO", secondaryTables.next().getName());
+
+ assertEquals("BAR", entityResource.getSecondaryTables().get(0).getName());
+ assertEquals("BAZ", entityResource.getSecondaryTables().get(1).getName());
+ assertEquals("FOO", entityResource.getSecondaryTables().get(2).getName());
+
+
+ xmlEntity.moveSpecifiedSecondaryTable(0, 1);
+ secondaryTables = xmlEntity.specifiedSecondaryTables();
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertEquals("BAR", secondaryTables.next().getName());
+ assertEquals("FOO", secondaryTables.next().getName());
+
+ assertEquals("BAZ", entityResource.getSecondaryTables().get(0).getName());
+ assertEquals("BAR", entityResource.getSecondaryTables().get(1).getName());
+ assertEquals("FOO", entityResource.getSecondaryTables().get(2).getName());
+ }
+
+ public void testUpdateSecondaryTables() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createSecondaryTable());
+ entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createSecondaryTable());
+ entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createSecondaryTable());
+
+ entityResource.getSecondaryTables().get(0).setName("FOO");
+ entityResource.getSecondaryTables().get(1).setName("BAR");
+ entityResource.getSecondaryTables().get(2).setName("BAZ");
+
+ ListIterator<XmlSecondaryTable> secondaryTables = xmlEntity.specifiedSecondaryTables();
+ assertEquals("FOO", secondaryTables.next().getName());
+ assertEquals("BAR", secondaryTables.next().getName());
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertFalse(secondaryTables.hasNext());
+
+ entityResource.getSecondaryTables().move(2, 0);
+ secondaryTables = xmlEntity.specifiedSecondaryTables();
+ assertEquals("BAR", secondaryTables.next().getName());
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertEquals("FOO", secondaryTables.next().getName());
+ assertFalse(secondaryTables.hasNext());
+
+ entityResource.getSecondaryTables().move(0, 1);
+ secondaryTables = xmlEntity.specifiedSecondaryTables();
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertEquals("BAR", secondaryTables.next().getName());
+ assertEquals("FOO", secondaryTables.next().getName());
+ assertFalse(secondaryTables.hasNext());
+
+ entityResource.getSecondaryTables().remove(1);
+ secondaryTables = xmlEntity.specifiedSecondaryTables();
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertEquals("FOO", secondaryTables.next().getName());
+ assertFalse(secondaryTables.hasNext());
+
+ entityResource.getSecondaryTables().remove(1);
+ secondaryTables = xmlEntity.specifiedSecondaryTables();
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertFalse(secondaryTables.hasNext());
+
+ entityResource.getSecondaryTables().remove(0);
+ assertFalse(xmlEntity.specifiedSecondaryTables().hasNext());
+ }
+
+ //test adding 2 secondary tables to java entity
+ //override one in xmlEntity, verify other one still exists as a default
+ //change xml-mapping-metadata complete setting in both locations and verify defaults from java are gone
+ public void testDefaultSecondaryTables() throws Exception {
+ createTestEntityDefaultFieldAccess();
+ createTestSubType();
+
+ XmlPersistentType parentPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlPersistentType childPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+ XmlEntity parentXmlEntity = (XmlEntity) parentPersistentType.getMapping();
+ XmlEntity childXmlEntity = (XmlEntity) childPersistentType.getMapping();
+
+ childXmlEntity.javaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
+
+ assertEquals("FOO", childXmlEntity.virtualSecondaryTables().next().getName());
+ assertEquals("FOO", childXmlEntity.secondaryTables().next().getName());
+ assertEquals(0, childXmlEntity.specifiedSecondaryTablesSize());
+ assertEquals(1, childXmlEntity.virtualSecondaryTablesSize());
+ assertEquals(1, childXmlEntity.secondaryTablesSize());
+
+ childXmlEntity.javaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAR");
+ ListIterator<XmlSecondaryTable> virtualSecondaryTables = childXmlEntity.virtualSecondaryTables();
+ ListIterator<XmlSecondaryTable> secondaryTables = childXmlEntity.secondaryTables();
+ assertEquals("BAR", virtualSecondaryTables.next().getName());
+ assertEquals("FOO", virtualSecondaryTables.next().getName());
+ assertEquals("BAR", secondaryTables.next().getName());
+ assertEquals("FOO", secondaryTables.next().getName());
+ assertEquals(0, childXmlEntity.specifiedSecondaryTablesSize());
+ assertEquals(2, childXmlEntity.virtualSecondaryTablesSize());
+ assertEquals(2, childXmlEntity.secondaryTablesSize());
+
+ childXmlEntity.addSpecifiedSecondaryTable(0).setSpecifiedName("BAZ");
+ virtualSecondaryTables = childXmlEntity.virtualSecondaryTables();
+ secondaryTables = childXmlEntity.secondaryTables();
+ assertFalse(virtualSecondaryTables.hasNext());
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertEquals(1, childXmlEntity.specifiedSecondaryTablesSize());
+ assertEquals(0, childXmlEntity.virtualSecondaryTablesSize());
+ assertEquals(1, childXmlEntity.secondaryTablesSize());
+
+ childXmlEntity.addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
+ virtualSecondaryTables = childXmlEntity.virtualSecondaryTables();
+ secondaryTables = childXmlEntity.secondaryTables();
+ assertFalse(virtualSecondaryTables.hasNext());
+ assertEquals("FOO", secondaryTables.next().getName());
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertFalse(secondaryTables.hasNext());
+ assertEquals(2, childXmlEntity.specifiedSecondaryTablesSize());
+ assertEquals(0, childXmlEntity.virtualSecondaryTablesSize());
+ assertEquals(2, childXmlEntity.secondaryTablesSize());
+
+ //add a specified secondary table to the parent, this will not affect virtual secondaryTables in child
+ parentXmlEntity.addSpecifiedSecondaryTable(0).setSpecifiedName("PARENT_TABLE");
+ virtualSecondaryTables = childXmlEntity.virtualSecondaryTables();
+ secondaryTables = childXmlEntity.secondaryTables();
+ assertFalse(virtualSecondaryTables.hasNext());
+ assertEquals("FOO", secondaryTables.next().getName());
+ assertEquals("BAZ", secondaryTables.next().getName());
+ assertFalse(secondaryTables.hasNext());
+ assertEquals(2, childXmlEntity.specifiedSecondaryTablesSize());
+ assertEquals(0, childXmlEntity.virtualSecondaryTablesSize());
+ assertEquals(2, childXmlEntity.secondaryTablesSize());
+
+ childXmlEntity.removeSpecifiedSecondaryTable(0);
+ childXmlEntity.removeSpecifiedSecondaryTable(0);
+ virtualSecondaryTables = childXmlEntity.virtualSecondaryTables();
+ secondaryTables = childXmlEntity.secondaryTables();
+ assertEquals("BAR", virtualSecondaryTables.next().getName());
+ assertEquals("FOO", virtualSecondaryTables.next().getName());
+ assertFalse(virtualSecondaryTables.hasNext());
+ assertEquals("BAR", secondaryTables.next().getName());
+ assertEquals("FOO", secondaryTables.next().getName());
+ assertFalse(secondaryTables.hasNext());
+ assertEquals(0, childXmlEntity.specifiedSecondaryTablesSize());
+ assertEquals(2, childXmlEntity.virtualSecondaryTablesSize());
+ assertEquals(2, childXmlEntity.secondaryTablesSize());
+ }
+
+ //test that inherited tables don't show up in this list
+ public void testAssociatedTables() throws Exception {
+
+ }
+
+ public void testAssociatedTableNamesIncludingInherited() throws Exception {
+
+ }
+
+ public void testTableNameIsInvalid() throws Exception {
+
+ }
+
+ public void testMakeEntityEmbeddable() throws Exception {
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity entity = (XmlEntity) entityPersistentType.getMapping();
+ entity.setSpecifiedAccess(AccessType.PROPERTY);
+ entity.setSpecifiedDiscriminatorValue("DISC_VALUE");
+ entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+ entity.setSpecifiedMetadataComplete(Boolean.TRUE);
+ entity.setSpecifiedName("ENTITY_NAME");
+ ormResource().save(null);
+
+ entityPersistentType.setMappingKey(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
+ ormResource().save(null);
+
+ Embeddable embeddable = ormResource().getEntityMappings().getEmbeddables().get(0);
+ assertEquals("model.Foo", embeddable.getClassName());
+ assertEquals(Boolean.TRUE, embeddable.getMetadataComplete());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, embeddable.getAccess());
+
+ XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) entityPersistentType.getMapping();
+ assertEquals("model.Foo", xmlEmbeddable.getClass_());
+ assertEquals(Boolean.TRUE, xmlEmbeddable.getSpecifiedMetadataComplete());
+ assertEquals(AccessType.PROPERTY, xmlEmbeddable.getSpecifiedAccess());
+ }
+
+ //TODO test that attribute mappings are not removed when changing type mapping.
+ public void testMakeEntityEmbeddable2() throws Exception {
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
+ XmlEntity entity = (XmlEntity) entityPersistentType.getMapping();
+ entity.setSpecifiedAccess(AccessType.PROPERTY);
+ entity.setSpecifiedDiscriminatorValue("DISC_VALUE");
+ entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+ entity.setSpecifiedMetadataComplete(Boolean.TRUE);
+ entity.setSpecifiedName("ENTITY_NAME");
+// entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ ormResource().save(null);
+
+ entityPersistentType.setMappingKey(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
+ ormResource().save(null);
+
+ Embeddable embeddable = ormResource().getEntityMappings().getEmbeddables().get(0);
+ assertEquals("model.Foo", embeddable.getClassName());
+ assertEquals(Boolean.TRUE, embeddable.getMetadataComplete());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, embeddable.getAccess());
+// assertEquals("basicMapping", embeddable.getAttributes().getBasics().get(0).getName());
+
+ XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) entityPersistentType.getMapping();
+ assertEquals("model.Foo", xmlEmbeddable.getClass_());
+ assertEquals(Boolean.TRUE, xmlEmbeddable.getSpecifiedMetadataComplete());
+ assertEquals(AccessType.PROPERTY, xmlEmbeddable.getSpecifiedAccess());
+// assertEquals("basicMapping", xmlEmbeddable.persistentType().attributes().next().getName());
+ }
+
+ public void testMakeEntityMappedSuperclass() throws Exception {
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity entity = (XmlEntity) entityPersistentType.getMapping();
+ entity.setSpecifiedAccess(AccessType.PROPERTY);
+ entity.setSpecifiedDiscriminatorValue("DISC_VALUE");
+ entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+ entity.setSpecifiedMetadataComplete(Boolean.TRUE);
+ entity.setSpecifiedName("ENTITY_NAME");
+ ormResource().save(null);
+
+ entityPersistentType.setMappingKey(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
+ ormResource().save(null);
+
+ MappedSuperclass mappedSuperclass = ormResource().getEntityMappings().getMappedSuperclasses().get(0);
+ assertEquals("model.Foo", mappedSuperclass.getClassName());
+ assertEquals(Boolean.TRUE, mappedSuperclass.getMetadataComplete());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, mappedSuperclass.getAccess());
+
+ XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) entityPersistentType.getMapping();
+ assertEquals("model.Foo", xmlMappedSuperclass.getClass_());
+ assertEquals(Boolean.TRUE, xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertEquals(AccessType.PROPERTY, xmlMappedSuperclass.getSpecifiedAccess());
+ }
+
+ public void testMakeEntityMappedSuperclass2() throws Exception {
+ entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity entity = (XmlEntity) entityPersistentType.getMapping();
+ entity.setSpecifiedAccess(AccessType.PROPERTY);
+ entity.setSpecifiedDiscriminatorValue("DISC_VALUE");
+ entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+ entity.setSpecifiedMetadataComplete(Boolean.TRUE);
+ entity.setSpecifiedName("ENTITY_NAME");
+ ormResource().save(null);
+
+ entityPersistentType.setMappingKey(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
+ ormResource().save(null);
+
+ MappedSuperclass mappedSuperclass = ormResource().getEntityMappings().getMappedSuperclasses().get(0);
+ assertEquals("model.Foo", mappedSuperclass.getClassName());
+ assertEquals(Boolean.TRUE, mappedSuperclass.getMetadataComplete());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, mappedSuperclass.getAccess());
+
+ XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) entityPersistentType.getMapping();
+ assertEquals("model.Foo", xmlMappedSuperclass.getClass_());
+ assertEquals(Boolean.TRUE, xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertEquals(AccessType.PROPERTY, xmlMappedSuperclass.getSpecifiedAccess());
+ }
+
+
+ public void testAddSequenceGenerator() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlEntity.getSequenceGenerator());
+ assertNull(entityResource.getSequenceGenerator());
+
+ xmlEntity.addSequenceGenerator();
+
+ assertNotNull(entityResource.getSequenceGenerator());
+ assertNotNull(xmlEntity.getSequenceGenerator());
+
+ //try adding another sequence generator, should get an IllegalStateException
+ try {
+ xmlEntity.addSequenceGenerator();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testRemoveSequenceGenerator() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlEntity.getSequenceGenerator());
+ assertNull(entityResource.getSequenceGenerator());
+
+ xmlEntity.addSequenceGenerator();
+ assertNotNull(entityResource.getSequenceGenerator());
+ assertNotNull(xmlEntity.getSequenceGenerator());
+
+ xmlEntity.removeSequenceGenerator();
+
+ assertNull(xmlEntity.getSequenceGenerator());
+ assertNull(entityResource.getSequenceGenerator());
+
+ //try removing the sequence generator again, should get an IllegalStateException
+ try {
+ xmlEntity.removeSequenceGenerator();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testUpdateSequenceGenerator() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlEntity.getSequenceGenerator());
+ assertNull(entityResource.getSequenceGenerator());
+
+ entityResource.setSequenceGenerator(OrmFactory.eINSTANCE.createSequenceGeneratorImpl());
+
+ assertNotNull(xmlEntity.getSequenceGenerator());
+ assertNotNull(entityResource.getSequenceGenerator());
+
+ entityResource.setSequenceGenerator(null);
+ assertNull(xmlEntity.getSequenceGenerator());
+ assertNull(entityResource.getSequenceGenerator());
+ }
+
+ public void testAddTableGenerator() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlEntity.getTableGenerator());
+ assertNull(entityResource.getTableGenerator());
+
+ xmlEntity.addTableGenerator();
+
+ assertNotNull(entityResource.getTableGenerator());
+ assertNotNull(xmlEntity.getTableGenerator());
+
+ //try adding another table generator, should get an IllegalStateException
+ try {
+ xmlEntity.addTableGenerator();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testRemoveTableGenerator() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlEntity.getTableGenerator());
+ assertNull(entityResource.getTableGenerator());
+
+ xmlEntity.addTableGenerator();
+ assertNotNull(entityResource.getTableGenerator());
+ assertNotNull(xmlEntity.getTableGenerator());
+
+ xmlEntity.removeTableGenerator();
+
+ assertNull(xmlEntity.getTableGenerator());
+ assertNull(entityResource.getTableGenerator());
+
+ //try removing the table generator again, should get an IllegalStateException
+ try {
+ xmlEntity.removeTableGenerator();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testUpdateTableGenerator() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlEntity.getTableGenerator());
+ assertNull(entityResource.getTableGenerator());
+
+ entityResource.setTableGenerator(OrmFactory.eINSTANCE.createTableGeneratorImpl());
+
+ assertNotNull(xmlEntity.getTableGenerator());
+ assertNotNull(entityResource.getTableGenerator());
+
+ entityResource.setTableGenerator(null);
+ assertNull(xmlEntity.getTableGenerator());
+ assertNull(entityResource.getTableGenerator());
+ }
+
+ public void testUpdateDiscriminatorColumn() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNotNull(xmlEntity.getDiscriminatorColumn());
+
+ entityResource.setDiscriminatorColumn(OrmFactory.eINSTANCE.createDiscriminatorColumn());
+ entityResource.getDiscriminatorColumn().setName("FOO");
+
+ assertEquals("FOO", xmlEntity.getDiscriminatorColumn().getSpecifiedName());
+ assertEquals("FOO", entityResource.getDiscriminatorColumn().getName());
+
+ entityResource.getDiscriminatorColumn().setName(null);
+
+ assertNull(xmlEntity.getDiscriminatorColumn().getSpecifiedName());
+ assertNull(entityResource.getDiscriminatorColumn().getName());
+
+ entityResource.setDiscriminatorColumn(null);
+
+ assertNotNull(xmlEntity.getDiscriminatorColumn());
+ }
+
+ public void testUpdateDiscriminatorValue() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlEntity.getSpecifiedDiscriminatorValue());
+ assertNull(entityResource.getDiscriminatorValue());
+
+ entityResource.setDiscriminatorValue("FOO");
+
+ assertEquals("FOO", xmlEntity.getSpecifiedDiscriminatorValue());
+ assertEquals("FOO", entityResource.getDiscriminatorValue());
+
+ entityResource.setDiscriminatorValue(null);
+
+ assertNull(xmlEntity.getSpecifiedDiscriminatorValue());
+ assertNull(entityResource.getDiscriminatorValue());
+ }
+
+ public void testModifyDiscriminatorValue() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlEntity.getSpecifiedDiscriminatorValue());
+ assertNull(entityResource.getDiscriminatorValue());
+
+ xmlEntity.setSpecifiedDiscriminatorValue("FOO");
+
+ assertEquals("FOO", xmlEntity.getSpecifiedDiscriminatorValue());
+ assertEquals("FOO", entityResource.getDiscriminatorValue());
+
+ xmlEntity.setSpecifiedDiscriminatorValue(null);
+
+ assertNull(xmlEntity.getSpecifiedDiscriminatorValue());
+ assertNull(entityResource.getDiscriminatorValue());
+ }
+
+ public void testAddSpecifiedPrimaryKeyJoinColumn() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ XmlPrimaryKeyJoinColumn primaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0);
+ primaryKeyJoinColumn.setSpecifiedName("FOO");
+
+ assertEquals("FOO", entityResource.getPrimaryKeyJoinColumns().get(0).getName());
+
+ XmlPrimaryKeyJoinColumn primaryKeyJoinColumn2 = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0);
+ primaryKeyJoinColumn2.setSpecifiedName("BAR");
+
+ assertEquals("BAR", entityResource.getPrimaryKeyJoinColumns().get(0).getName());
+ assertEquals("FOO", entityResource.getPrimaryKeyJoinColumns().get(1).getName());
+
+ XmlPrimaryKeyJoinColumn primaryKeyJoinColumn3 = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(1);
+ primaryKeyJoinColumn3.setSpecifiedName("BAZ");
+
+ assertEquals("BAR", entityResource.getPrimaryKeyJoinColumns().get(0).getName());
+ assertEquals("BAZ", entityResource.getPrimaryKeyJoinColumns().get(1).getName());
+ assertEquals("FOO", entityResource.getPrimaryKeyJoinColumns().get(2).getName());
+
+ ListIterator<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlEntity.specifiedPrimaryKeyJoinColumns();
+ assertEquals(primaryKeyJoinColumn2, primaryKeyJoinColumns.next());
+ assertEquals(primaryKeyJoinColumn3, primaryKeyJoinColumns.next());
+ assertEquals(primaryKeyJoinColumn, primaryKeyJoinColumns.next());
+
+ primaryKeyJoinColumns = xmlEntity.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAR", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+ }
+
+ public void testRemoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
+ xmlEntity.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
+ xmlEntity.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals(3, entityResource.getPrimaryKeyJoinColumns().size());
+
+ xmlEntity.removeSpecifiedPrimaryKeyJoinColumn(0);
+ assertEquals(2, entityResource.getPrimaryKeyJoinColumns().size());
+ assertEquals("BAR", entityResource.getPrimaryKeyJoinColumns().get(0).getName());
+ assertEquals("BAZ", entityResource.getPrimaryKeyJoinColumns().get(1).getName());
+
+ xmlEntity.removeSpecifiedPrimaryKeyJoinColumn(0);
+ assertEquals(1, entityResource.getPrimaryKeyJoinColumns().size());
+ assertEquals("BAZ", entityResource.getPrimaryKeyJoinColumns().get(0).getName());
+
+ xmlEntity.removeSpecifiedPrimaryKeyJoinColumn(0);
+ assertEquals(0, entityResource.getPrimaryKeyJoinColumns().size());
+ }
+
+ public void testMoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
+ xmlEntity.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
+ xmlEntity.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals(3, entityResource.getPrimaryKeyJoinColumns().size());
+
+
+ xmlEntity.moveSpecifiedPrimaryKeyJoinColumn(2, 0);
+ ListIterator<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlEntity.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAR", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+
+ assertEquals("BAR", entityResource.getPrimaryKeyJoinColumns().get(0).getName());
+ assertEquals("BAZ", entityResource.getPrimaryKeyJoinColumns().get(1).getName());
+ assertEquals("FOO", entityResource.getPrimaryKeyJoinColumns().get(2).getName());
+
+
+ xmlEntity.moveSpecifiedPrimaryKeyJoinColumn(0, 1);
+ primaryKeyJoinColumns = xmlEntity.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAR", primaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+
+ assertEquals("BAZ", entityResource.getPrimaryKeyJoinColumns().get(0).getName());
+ assertEquals("BAR", entityResource.getPrimaryKeyJoinColumns().get(1).getName());
+ assertEquals("FOO", entityResource.getPrimaryKeyJoinColumns().get(2).getName());
+ }
+
+ public void testUpdatePrimaryKeyJoinColumns() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ entityResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createPrimaryKeyJoinColumn());
+ entityResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createPrimaryKeyJoinColumn());
+ entityResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createPrimaryKeyJoinColumn());
+
+ entityResource.getPrimaryKeyJoinColumns().get(0).setName("FOO");
+ entityResource.getPrimaryKeyJoinColumns().get(1).setName("BAR");
+ entityResource.getPrimaryKeyJoinColumns().get(2).setName("BAZ");
+
+ ListIterator<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlEntity.specifiedPrimaryKeyJoinColumns();
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAR", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertFalse(primaryKeyJoinColumns.hasNext());
+
+ entityResource.getPrimaryKeyJoinColumns().move(2, 0);
+ primaryKeyJoinColumns = xmlEntity.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAR", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+ assertFalse(primaryKeyJoinColumns.hasNext());
+
+ entityResource.getPrimaryKeyJoinColumns().move(0, 1);
+ primaryKeyJoinColumns = xmlEntity.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAR", primaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+ assertFalse(primaryKeyJoinColumns.hasNext());
+
+ entityResource.getPrimaryKeyJoinColumns().remove(1);
+ primaryKeyJoinColumns = xmlEntity.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+ assertFalse(primaryKeyJoinColumns.hasNext());
+
+ entityResource.getPrimaryKeyJoinColumns().remove(1);
+ primaryKeyJoinColumns = xmlEntity.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertFalse(primaryKeyJoinColumns.hasNext());
+
+ entityResource.getPrimaryKeyJoinColumns().remove(0);
+ assertFalse(xmlEntity.specifiedPrimaryKeyJoinColumns().hasNext());
+ }
+
+ public void testAddSpecifiedAttributeOverride() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ XmlAttributeOverride attributeOverride = xmlEntity.addSpecifiedAttributeOverride(0);
+ attributeOverride.setName("FOO");
+
+ assertEquals("FOO", entityResource.getAttributeOverrides().get(0).getName());
+
+ XmlAttributeOverride attributeOverride2 = xmlEntity.addSpecifiedAttributeOverride(0);
+ attributeOverride2.setName("BAR");
+
+ assertEquals("BAR", entityResource.getAttributeOverrides().get(0).getName());
+ assertEquals("FOO", entityResource.getAttributeOverrides().get(1).getName());
+
+ XmlAttributeOverride attributeOverride3 = xmlEntity.addSpecifiedAttributeOverride(1);
+ attributeOverride3.setName("BAZ");
+
+ assertEquals("BAR", entityResource.getAttributeOverrides().get(0).getName());
+ assertEquals("BAZ", entityResource.getAttributeOverrides().get(1).getName());
+ assertEquals("FOO", entityResource.getAttributeOverrides().get(2).getName());
+
+ ListIterator<XmlAttributeOverride> attributeOverrides = xmlEntity.specifiedAttributeOverrides();
+ assertEquals(attributeOverride2, attributeOverrides.next());
+ assertEquals(attributeOverride3, attributeOverrides.next());
+ assertEquals(attributeOverride, attributeOverrides.next());
+
+ attributeOverrides = xmlEntity.specifiedAttributeOverrides();
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+ }
+
+ public void testRemoveSpecifiedAttributeOverride() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ xmlEntity.addSpecifiedAttributeOverride(0).setName("FOO");
+ xmlEntity.addSpecifiedAttributeOverride(1).setName("BAR");
+ xmlEntity.addSpecifiedAttributeOverride(2).setName("BAZ");
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals(3, entityResource.getAttributeOverrides().size());
+
+ xmlEntity.removeSpecifiedAttributeOverride(0);
+ assertEquals(2, entityResource.getAttributeOverrides().size());
+ assertEquals("BAR", entityResource.getAttributeOverrides().get(0).getName());
+ assertEquals("BAZ", entityResource.getAttributeOverrides().get(1).getName());
+
+ xmlEntity.removeSpecifiedAttributeOverride(0);
+ assertEquals(1, entityResource.getAttributeOverrides().size());
+ assertEquals("BAZ", entityResource.getAttributeOverrides().get(0).getName());
+
+ xmlEntity.removeSpecifiedAttributeOverride(0);
+ assertEquals(0, entityResource.getAttributeOverrides().size());
+ }
+
+ public void testMoveSpecifiedAttributeOverride() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ xmlEntity.addSpecifiedAttributeOverride(0).setName("FOO");
+ xmlEntity.addSpecifiedAttributeOverride(1).setName("BAR");
+ xmlEntity.addSpecifiedAttributeOverride(2).setName("BAZ");
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals(3, entityResource.getAttributeOverrides().size());
+
+
+ xmlEntity.moveSpecifiedAttributeOverride(2, 0);
+ ListIterator<XmlAttributeOverride> attributeOverrides = xmlEntity.specifiedAttributeOverrides();
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+
+ assertEquals("BAR", entityResource.getAttributeOverrides().get(0).getName());
+ assertEquals("BAZ", entityResource.getAttributeOverrides().get(1).getName());
+ assertEquals("FOO", entityResource.getAttributeOverrides().get(2).getName());
+
+
+ xmlEntity.moveSpecifiedAttributeOverride(0, 1);
+ attributeOverrides = xmlEntity.specifiedAttributeOverrides();
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+
+ assertEquals("BAZ", entityResource.getAttributeOverrides().get(0).getName());
+ assertEquals("BAR", entityResource.getAttributeOverrides().get(1).getName());
+ assertEquals("FOO", entityResource.getAttributeOverrides().get(2).getName());
+ }
+
+ public void testUpdateAttributeOverrides() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ entityResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverrideImpl());
+ entityResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverrideImpl());
+ entityResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverrideImpl());
+
+ entityResource.getAttributeOverrides().get(0).setName("FOO");
+ entityResource.getAttributeOverrides().get(1).setName("BAR");
+ entityResource.getAttributeOverrides().get(2).setName("BAZ");
+
+ ListIterator<XmlAttributeOverride> attributeOverrides = xmlEntity.specifiedAttributeOverrides();
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ entityResource.getAttributeOverrides().move(2, 0);
+ attributeOverrides = xmlEntity.specifiedAttributeOverrides();
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ entityResource.getAttributeOverrides().move(0, 1);
+ attributeOverrides = xmlEntity.specifiedAttributeOverrides();
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("BAR", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ entityResource.getAttributeOverrides().remove(1);
+ attributeOverrides = xmlEntity.specifiedAttributeOverrides();
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertEquals("FOO", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ entityResource.getAttributeOverrides().remove(1);
+ attributeOverrides = xmlEntity.specifiedAttributeOverrides();
+ assertEquals("BAZ", attributeOverrides.next().getName());
+ assertFalse(attributeOverrides.hasNext());
+
+ entityResource.getAttributeOverrides().remove(0);
+ assertFalse(xmlEntity.specifiedAttributeOverrides().hasNext());
+ }
+
+ public void testAddSpecifiedAssociationOverride() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ XmlAssociationOverride associationOverride = xmlEntity.addSpecifiedAssociationOverride(0);
+ associationOverride.setName("FOO");
+
+ assertEquals("FOO", entityResource.getAssociationOverrides().get(0).getName());
+
+ XmlAssociationOverride associationOverride2 = xmlEntity.addSpecifiedAssociationOverride(0);
+ associationOverride2.setName("BAR");
+
+ assertEquals("BAR", entityResource.getAssociationOverrides().get(0).getName());
+ assertEquals("FOO", entityResource.getAssociationOverrides().get(1).getName());
+
+ XmlAssociationOverride associationOverride3 = xmlEntity.addSpecifiedAssociationOverride(1);
+ associationOverride3.setName("BAZ");
+
+ assertEquals("BAR", entityResource.getAssociationOverrides().get(0).getName());
+ assertEquals("BAZ", entityResource.getAssociationOverrides().get(1).getName());
+ assertEquals("FOO", entityResource.getAssociationOverrides().get(2).getName());
+
+ ListIterator<XmlAssociationOverride> associationOverrides = xmlEntity.specifiedAssociationOverrides();
+ assertEquals(associationOverride2, associationOverrides.next());
+ assertEquals(associationOverride3, associationOverrides.next());
+ assertEquals(associationOverride, associationOverrides.next());
+
+ associationOverrides = xmlEntity.specifiedAssociationOverrides();
+ assertEquals("BAR", associationOverrides.next().getName());
+ assertEquals("BAZ", associationOverrides.next().getName());
+ assertEquals("FOO", associationOverrides.next().getName());
+ }
+
+ public void testRemoveSpecifiedAssociationOverride() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ xmlEntity.addSpecifiedAssociationOverride(0).setName("FOO");
+ xmlEntity.addSpecifiedAssociationOverride(1).setName("BAR");
+ xmlEntity.addSpecifiedAssociationOverride(2).setName("BAZ");
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals(3, entityResource.getAssociationOverrides().size());
+
+ xmlEntity.removeSpecifiedAssociationOverride(0);
+ assertEquals(2, entityResource.getAssociationOverrides().size());
+ assertEquals("BAR", entityResource.getAssociationOverrides().get(0).getName());
+ assertEquals("BAZ", entityResource.getAssociationOverrides().get(1).getName());
+
+ xmlEntity.removeSpecifiedAssociationOverride(0);
+ assertEquals(1, entityResource.getAssociationOverrides().size());
+ assertEquals("BAZ", entityResource.getAssociationOverrides().get(0).getName());
+
+ xmlEntity.removeSpecifiedAssociationOverride(0);
+ assertEquals(0, entityResource.getAssociationOverrides().size());
+ }
+
+ public void testMoveSpecifiedAssociationOverride() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ xmlEntity.addSpecifiedAssociationOverride(0).setName("FOO");
+ xmlEntity.addSpecifiedAssociationOverride(1).setName("BAR");
+ xmlEntity.addSpecifiedAssociationOverride(2).setName("BAZ");
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals(3, entityResource.getAssociationOverrides().size());
+
+
+ xmlEntity.moveSpecifiedAssociationOverride(2, 0);
+ ListIterator<XmlAssociationOverride> associationOverrides = xmlEntity.specifiedAssociationOverrides();
+ assertEquals("BAR", associationOverrides.next().getName());
+ assertEquals("BAZ", associationOverrides.next().getName());
+ assertEquals("FOO", associationOverrides.next().getName());
+
+ assertEquals("BAR", entityResource.getAssociationOverrides().get(0).getName());
+ assertEquals("BAZ", entityResource.getAssociationOverrides().get(1).getName());
+ assertEquals("FOO", entityResource.getAssociationOverrides().get(2).getName());
+
+
+ xmlEntity.moveSpecifiedAssociationOverride(0, 1);
+ associationOverrides = xmlEntity.specifiedAssociationOverrides();
+ assertEquals("BAZ", associationOverrides.next().getName());
+ assertEquals("BAR", associationOverrides.next().getName());
+ assertEquals("FOO", associationOverrides.next().getName());
+
+ assertEquals("BAZ", entityResource.getAssociationOverrides().get(0).getName());
+ assertEquals("BAR", entityResource.getAssociationOverrides().get(1).getName());
+ assertEquals("FOO", entityResource.getAssociationOverrides().get(2).getName());
+ }
+
+ public void testUpdateAssociationOverrides() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createAssociationOverride());
+ entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createAssociationOverride());
+ entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createAssociationOverride());
+
+ entityResource.getAssociationOverrides().get(0).setName("FOO");
+ entityResource.getAssociationOverrides().get(1).setName("BAR");
+ entityResource.getAssociationOverrides().get(2).setName("BAZ");
+
+ ListIterator<XmlAssociationOverride> associationOverrides = xmlEntity.specifiedAssociationOverrides();
+ assertEquals("FOO", associationOverrides.next().getName());
+ assertEquals("BAR", associationOverrides.next().getName());
+ assertEquals("BAZ", associationOverrides.next().getName());
+ assertFalse(associationOverrides.hasNext());
+
+ entityResource.getAssociationOverrides().move(2, 0);
+ associationOverrides = xmlEntity.specifiedAssociationOverrides();
+ assertEquals("BAR", associationOverrides.next().getName());
+ assertEquals("BAZ", associationOverrides.next().getName());
+ assertEquals("FOO", associationOverrides.next().getName());
+ assertFalse(associationOverrides.hasNext());
+
+ entityResource.getAssociationOverrides().move(0, 1);
+ associationOverrides = xmlEntity.specifiedAssociationOverrides();
+ assertEquals("BAZ", associationOverrides.next().getName());
+ assertEquals("BAR", associationOverrides.next().getName());
+ assertEquals("FOO", associationOverrides.next().getName());
+ assertFalse(associationOverrides.hasNext());
+
+ entityResource.getAssociationOverrides().remove(1);
+ associationOverrides = xmlEntity.specifiedAssociationOverrides();
+ assertEquals("BAZ", associationOverrides.next().getName());
+ assertEquals("FOO", associationOverrides.next().getName());
+ assertFalse(associationOverrides.hasNext());
+
+ entityResource.getAssociationOverrides().remove(1);
+ associationOverrides = xmlEntity.specifiedAssociationOverrides();
+ assertEquals("BAZ", associationOverrides.next().getName());
+ assertFalse(associationOverrides.hasNext());
+
+ entityResource.getAssociationOverrides().remove(0);
+ assertFalse(xmlEntity.specifiedAssociationOverrides().hasNext());
+ }
+
+
+ public void testAddNamedQuery() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ XmlNamedQuery namedQuery = xmlEntity.addNamedQuery(0);
+ namedQuery.setName("FOO");
+
+ assertEquals("FOO", entityResource.getNamedQueries().get(0).getName());
+
+ XmlNamedQuery namedQuery2 = xmlEntity.addNamedQuery(0);
+ namedQuery2.setName("BAR");
+
+ assertEquals("BAR", entityResource.getNamedQueries().get(0).getName());
+ assertEquals("FOO", entityResource.getNamedQueries().get(1).getName());
+
+ XmlNamedQuery namedQuery3 = xmlEntity.addNamedQuery(1);
+ namedQuery3.setName("BAZ");
+
+ assertEquals("BAR", entityResource.getNamedQueries().get(0).getName());
+ assertEquals("BAZ", entityResource.getNamedQueries().get(1).getName());
+ assertEquals("FOO", entityResource.getNamedQueries().get(2).getName());
+
+ ListIterator<XmlNamedQuery> namedQuerys = xmlEntity.namedQueries();
+ assertEquals(namedQuery2, namedQuerys.next());
+ assertEquals(namedQuery3, namedQuerys.next());
+ assertEquals(namedQuery, namedQuerys.next());
+
+ namedQuerys = xmlEntity.namedQueries();
+ assertEquals("BAR", namedQuerys.next().getName());
+ assertEquals("BAZ", namedQuerys.next().getName());
+ assertEquals("FOO", namedQuerys.next().getName());
+ }
+
+ public void testRemoveNamedQuery() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ xmlEntity.addNamedQuery(0).setName("FOO");
+ xmlEntity.addNamedQuery(1).setName("BAR");
+ xmlEntity.addNamedQuery(2).setName("BAZ");
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals(3, entityResource.getNamedQueries().size());
+
+ xmlEntity.removeNamedQuery(0);
+ assertEquals(2, entityResource.getNamedQueries().size());
+ assertEquals("BAR", entityResource.getNamedQueries().get(0).getName());
+ assertEquals("BAZ", entityResource.getNamedQueries().get(1).getName());
+
+ xmlEntity.removeNamedQuery(0);
+ assertEquals(1, entityResource.getNamedQueries().size());
+ assertEquals("BAZ", entityResource.getNamedQueries().get(0).getName());
+
+ xmlEntity.removeNamedQuery(0);
+ assertEquals(0, entityResource.getNamedQueries().size());
+ }
+
+ public void testMoveNamedQuery() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ xmlEntity.addNamedQuery(0).setName("FOO");
+ xmlEntity.addNamedQuery(1).setName("BAR");
+ xmlEntity.addNamedQuery(2).setName("BAZ");
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals(3, entityResource.getNamedQueries().size());
+
+
+ xmlEntity.moveNamedQuery(2, 0);
+ ListIterator<XmlNamedQuery> namedQuerys = xmlEntity.namedQueries();
+ assertEquals("BAR", namedQuerys.next().getName());
+ assertEquals("BAZ", namedQuerys.next().getName());
+ assertEquals("FOO", namedQuerys.next().getName());
+
+ assertEquals("BAR", entityResource.getNamedQueries().get(0).getName());
+ assertEquals("BAZ", entityResource.getNamedQueries().get(1).getName());
+ assertEquals("FOO", entityResource.getNamedQueries().get(2).getName());
+
+
+ xmlEntity.moveNamedQuery(0, 1);
+ namedQuerys = xmlEntity.namedQueries();
+ assertEquals("BAZ", namedQuerys.next().getName());
+ assertEquals("BAR", namedQuerys.next().getName());
+ assertEquals("FOO", namedQuerys.next().getName());
+
+ assertEquals("BAZ", entityResource.getNamedQueries().get(0).getName());
+ assertEquals("BAR", entityResource.getNamedQueries().get(1).getName());
+ assertEquals("FOO", entityResource.getNamedQueries().get(2).getName());
+ }
+
+ public void testUpdateNamedQueries() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ entityResource.getNamedQueries().add(OrmFactory.eINSTANCE.createNamedQuery());
+ entityResource.getNamedQueries().add(OrmFactory.eINSTANCE.createNamedQuery());
+ entityResource.getNamedQueries().add(OrmFactory.eINSTANCE.createNamedQuery());
+
+ entityResource.getNamedQueries().get(0).setName("FOO");
+ entityResource.getNamedQueries().get(1).setName("BAR");
+ entityResource.getNamedQueries().get(2).setName("BAZ");
+
+ ListIterator<XmlNamedQuery> namedQuerys = xmlEntity.namedQueries();
+ assertEquals("FOO", namedQuerys.next().getName());
+ assertEquals("BAR", namedQuerys.next().getName());
+ assertEquals("BAZ", namedQuerys.next().getName());
+ assertFalse(namedQuerys.hasNext());
+
+ entityResource.getNamedQueries().move(2, 0);
+ namedQuerys = xmlEntity.namedQueries();
+ assertEquals("BAR", namedQuerys.next().getName());
+ assertEquals("BAZ", namedQuerys.next().getName());
+ assertEquals("FOO", namedQuerys.next().getName());
+ assertFalse(namedQuerys.hasNext());
+
+ entityResource.getNamedQueries().move(0, 1);
+ namedQuerys = xmlEntity.namedQueries();
+ assertEquals("BAZ", namedQuerys.next().getName());
+ assertEquals("BAR", namedQuerys.next().getName());
+ assertEquals("FOO", namedQuerys.next().getName());
+ assertFalse(namedQuerys.hasNext());
+
+ entityResource.getNamedQueries().remove(1);
+ namedQuerys = xmlEntity.namedQueries();
+ assertEquals("BAZ", namedQuerys.next().getName());
+ assertEquals("FOO", namedQuerys.next().getName());
+ assertFalse(namedQuerys.hasNext());
+
+ entityResource.getNamedQueries().remove(1);
+ namedQuerys = xmlEntity.namedQueries();
+ assertEquals("BAZ", namedQuerys.next().getName());
+ assertFalse(namedQuerys.hasNext());
+
+ entityResource.getNamedQueries().remove(0);
+ assertFalse(xmlEntity.namedQueries().hasNext());
+ }
+
+ public void testAddNamedNativeQuery() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ XmlNamedNativeQuery namedNativeQuery = xmlEntity.addNamedNativeQuery(0);
+ namedNativeQuery.setName("FOO");
+
+ assertEquals("FOO", entityResource.getNamedNativeQueries().get(0).getName());
+
+ XmlNamedNativeQuery namedNativeQuery2 = xmlEntity.addNamedNativeQuery(0);
+ namedNativeQuery2.setName("BAR");
+
+ assertEquals("BAR", entityResource.getNamedNativeQueries().get(0).getName());
+ assertEquals("FOO", entityResource.getNamedNativeQueries().get(1).getName());
+
+ XmlNamedNativeQuery namedNativeQuery3 = xmlEntity.addNamedNativeQuery(1);
+ namedNativeQuery3.setName("BAZ");
+
+ assertEquals("BAR", entityResource.getNamedNativeQueries().get(0).getName());
+ assertEquals("BAZ", entityResource.getNamedNativeQueries().get(1).getName());
+ assertEquals("FOO", entityResource.getNamedNativeQueries().get(2).getName());
+
+ ListIterator<XmlNamedNativeQuery> namedNativeQuerys = xmlEntity.namedNativeQueries();
+ assertEquals(namedNativeQuery2, namedNativeQuerys.next());
+ assertEquals(namedNativeQuery3, namedNativeQuerys.next());
+ assertEquals(namedNativeQuery, namedNativeQuerys.next());
+
+ namedNativeQuerys = xmlEntity.namedNativeQueries();
+ assertEquals("BAR", namedNativeQuerys.next().getName());
+ assertEquals("BAZ", namedNativeQuerys.next().getName());
+ assertEquals("FOO", namedNativeQuerys.next().getName());
+ }
+
+ public void testRemoveNamedNativeQuery() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ xmlEntity.addNamedNativeQuery(0).setName("FOO");
+ xmlEntity.addNamedNativeQuery(1).setName("BAR");
+ xmlEntity.addNamedNativeQuery(2).setName("BAZ");
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals(3, entityResource.getNamedNativeQueries().size());
+
+ xmlEntity.removeNamedNativeQuery(0);
+ assertEquals(2, entityResource.getNamedNativeQueries().size());
+ assertEquals("BAR", entityResource.getNamedNativeQueries().get(0).getName());
+ assertEquals("BAZ", entityResource.getNamedNativeQueries().get(1).getName());
+
+ xmlEntity.removeNamedNativeQuery(0);
+ assertEquals(1, entityResource.getNamedNativeQueries().size());
+ assertEquals("BAZ", entityResource.getNamedNativeQueries().get(0).getName());
+
+ xmlEntity.removeNamedNativeQuery(0);
+ assertEquals(0, entityResource.getNamedNativeQueries().size());
+ }
+
+ public void testMoveNamedNativeQuery() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ xmlEntity.addNamedNativeQuery(0).setName("FOO");
+ xmlEntity.addNamedNativeQuery(1).setName("BAR");
+ xmlEntity.addNamedNativeQuery(2).setName("BAZ");
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals(3, entityResource.getNamedNativeQueries().size());
+
+
+ xmlEntity.moveNamedNativeQuery(2, 0);
+ ListIterator<XmlNamedNativeQuery> namedNativeQuerys = xmlEntity.namedNativeQueries();
+ assertEquals("BAR", namedNativeQuerys.next().getName());
+ assertEquals("BAZ", namedNativeQuerys.next().getName());
+ assertEquals("FOO", namedNativeQuerys.next().getName());
+
+ assertEquals("BAR", entityResource.getNamedNativeQueries().get(0).getName());
+ assertEquals("BAZ", entityResource.getNamedNativeQueries().get(1).getName());
+ assertEquals("FOO", entityResource.getNamedNativeQueries().get(2).getName());
+
+
+ xmlEntity.moveNamedNativeQuery(0, 1);
+ namedNativeQuerys = xmlEntity.namedNativeQueries();
+ assertEquals("BAZ", namedNativeQuerys.next().getName());
+ assertEquals("BAR", namedNativeQuerys.next().getName());
+ assertEquals("FOO", namedNativeQuerys.next().getName());
+
+ assertEquals("BAZ", entityResource.getNamedNativeQueries().get(0).getName());
+ assertEquals("BAR", entityResource.getNamedNativeQueries().get(1).getName());
+ assertEquals("FOO", entityResource.getNamedNativeQueries().get(2).getName());
+ }
+
+ public void testUpdateNamedNativeQueries() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ entityResource.getNamedNativeQueries().add(OrmFactory.eINSTANCE.createNamedNativeQuery());
+ entityResource.getNamedNativeQueries().add(OrmFactory.eINSTANCE.createNamedNativeQuery());
+ entityResource.getNamedNativeQueries().add(OrmFactory.eINSTANCE.createNamedNativeQuery());
+
+ entityResource.getNamedNativeQueries().get(0).setName("FOO");
+ entityResource.getNamedNativeQueries().get(1).setName("BAR");
+ entityResource.getNamedNativeQueries().get(2).setName("BAZ");
+
+ ListIterator<XmlNamedNativeQuery> namedNativeQuerys = xmlEntity.namedNativeQueries();
+ assertEquals("FOO", namedNativeQuerys.next().getName());
+ assertEquals("BAR", namedNativeQuerys.next().getName());
+ assertEquals("BAZ", namedNativeQuerys.next().getName());
+ assertFalse(namedNativeQuerys.hasNext());
+
+ entityResource.getNamedNativeQueries().move(2, 0);
+ namedNativeQuerys = xmlEntity.namedNativeQueries();
+ assertEquals("BAR", namedNativeQuerys.next().getName());
+ assertEquals("BAZ", namedNativeQuerys.next().getName());
+ assertEquals("FOO", namedNativeQuerys.next().getName());
+ assertFalse(namedNativeQuerys.hasNext());
+
+ entityResource.getNamedNativeQueries().move(0, 1);
+ namedNativeQuerys = xmlEntity.namedNativeQueries();
+ assertEquals("BAZ", namedNativeQuerys.next().getName());
+ assertEquals("BAR", namedNativeQuerys.next().getName());
+ assertEquals("FOO", namedNativeQuerys.next().getName());
+ assertFalse(namedNativeQuerys.hasNext());
+
+ entityResource.getNamedNativeQueries().remove(1);
+ namedNativeQuerys = xmlEntity.namedNativeQueries();
+ assertEquals("BAZ", namedNativeQuerys.next().getName());
+ assertEquals("FOO", namedNativeQuerys.next().getName());
+ assertFalse(namedNativeQuerys.hasNext());
+
+ entityResource.getNamedNativeQueries().remove(1);
+ namedNativeQuerys = xmlEntity.namedNativeQueries();
+ assertEquals("BAZ", namedNativeQuerys.next().getName());
+ assertFalse(namedNativeQuerys.hasNext());
+
+ entityResource.getNamedNativeQueries().remove(0);
+ assertFalse(xmlEntity.namedNativeQueries().hasNext());
+ }
+
+ public void testUpdateIdClass() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlEntity.getIdClass());
+ assertNull(entityResource.getIdClass());
+
+ entityResource.setIdClass(OrmFactory.eINSTANCE.createIdClass());
+
+ assertNull(xmlEntity.getIdClass());
+ assertNotNull(entityResource.getIdClass());
+
+ entityResource.getIdClass().setClassName("model.Foo");
+ assertEquals("model.Foo", xmlEntity.getIdClass());
+ assertEquals("model.Foo", entityResource.getIdClass().getClassName());
+
+ //test setting @IdClass value to null, id-class tag is not removed
+ entityResource.getIdClass().setClassName(null);
+ assertNull(xmlEntity.getIdClass());
+ assertNotNull(entityResource.getIdClass());
+
+ //reset @IdClass value and then remove id-class tag
+ entityResource.setIdClass(OrmFactory.eINSTANCE.createIdClass());
+ entityResource.getIdClass().setClassName("model.Foo");
+ entityResource.setIdClass(null);
+
+ assertNull(xmlEntity.getIdClass());
+ assertNull(entityResource.getIdClass());
+ }
+
+ public void testModifyIdClass() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ assertNull(xmlEntity.getIdClass());
+ assertNull(entityResource.getIdClass());
+
+ xmlEntity.setIdClass("model.Foo");
+ assertEquals("model.Foo", entityResource.getIdClass().getClassName());
+ assertEquals("model.Foo", xmlEntity.getIdClass());
+
+ xmlEntity.setIdClass(null);
+ assertNull(xmlEntity.getIdClass());
+ assertNull(entityResource.getIdClass());
+ }
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlGeneratedValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlGeneratedValueTests.java
new file mode 100644
index 0000000000..bb9778689c
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlGeneratedValueTests.java
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.XmlGeneratedValue;
+import org.eclipse.jpt.core.internal.context.orm.XmlIdMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.orm.GeneratedValue;
+import org.eclipse.jpt.core.internal.resource.orm.Id;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.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.iterators.ArrayIterator;
+
+public class XmlGeneratedValueTests extends ContextModelTestCase
+{
+ public XmlGeneratedValueTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createIdAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Id", "");
+ }
+
+ private IType createTestEntity() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestSubType() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
+ sb.append("extends " + TYPE_NAME + " ");
+ sb.append("{}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
+ }
+
+ public void testUpdateSpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ XmlGeneratedValue xmlGeneratedValue = xmlIdMapping.addGeneratedValue();
+ Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
+ GeneratedValue generatedValueResource = idResource.getGeneratedValue();
+
+ //set generator in the resource model, verify context model updated
+ generatedValueResource.setGenerator("FOO");
+ assertEquals("FOO", xmlGeneratedValue.getSpecifiedGenerator());
+ assertEquals("FOO", generatedValueResource.getGenerator());
+
+ //set name to null in the resource model
+ generatedValueResource.setGenerator(null);
+ assertNull(xmlGeneratedValue.getSpecifiedGenerator());
+ assertNull(generatedValueResource.getGenerator());
+ }
+
+ public void testModifySpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ XmlGeneratedValue xmlGeneratedValue = xmlIdMapping.addGeneratedValue();
+ Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
+ GeneratedValue generatedValueResource = idResource.getGeneratedValue();
+
+ //set name in the context model, verify resource model modified
+ xmlGeneratedValue.setSpecifiedGenerator("FOO");
+ assertEquals("FOO", generatedValueResource.getGenerator());
+ assertEquals("FOO", xmlGeneratedValue.getSpecifiedGenerator());
+
+ //set name to null in the context model
+ xmlGeneratedValue.setSpecifiedGenerator(null);
+ assertNull(generatedValueResource.getGenerator());
+ assertNull(xmlGeneratedValue.getSpecifiedGenerator());
+ }
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlIdMappingTests.java
new file mode 100644
index 0000000000..420cfbd6fa
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlIdMappingTests.java
@@ -0,0 +1,620 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.GenerationType;
+import org.eclipse.jpt.core.internal.context.base.TemporalType;
+import org.eclipse.jpt.core.internal.context.orm.XmlColumn;
+import org.eclipse.jpt.core.internal.context.orm.XmlGeneratedValue;
+import org.eclipse.jpt.core.internal.context.orm.XmlIdMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.context.orm.XmlSequenceGenerator;
+import org.eclipse.jpt.core.internal.context.orm.XmlTableGenerator;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.orm.Id;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class XmlIdMappingTests extends ContextModelTestCase
+{
+ public XmlIdMappingTests(String name) {
+ super(name);
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createIdAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Id", "");
+ }
+
+ private void createColumnAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Column",
+ "String name() default \"\";" +
+ "boolean unique() default false;" +
+ "boolean nullable() default true;" +
+ "boolean insertable() default true;" +
+ "boolean updatable() default true;" +
+ "String columnDefinition() default \"\";" +
+ "String table() default \"\";" +
+ "int length() default 255;" +
+ "int precision() default 0;" +
+ "int scale() default 0;");
+ }
+
+ private void createTemporalAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Temporal", "TemporalType value();");
+ }
+
+ private void createGeneratedValueAnnotation() throws Exception{
+ this.createAnnotationAndMembers("GeneratedValue",
+ "GenerationType strategy() default AUTO;" +
+ "String generator() default \"\"; ");
+ }
+
+
+ private void createSequenceGeneratorAnnotation() throws Exception{
+ this.createAnnotationAndMembers("SequenceGenerator",
+ "String name();" +
+ "String sequenceName() default \"\"; " +
+ "int initialValue() default 0; " +
+ "int allocationSize() default 50;");
+ }
+
+ private void createTableGeneratorAnnotation() throws Exception{
+ this.createAnnotationAndMembers("TableGenerator",
+ "String name(); " +
+ "String table() default \"\"; " +
+ "String catalog() default \"\"; " +
+ "String schema() default \"\";" +
+ "String pkColumnName() default \"\"; " +
+ "String valueColumnName() default \"\"; " +
+ "String pkColumnValue() default \"\"; " +
+ "int initialValue() default 0; " +
+ "int allocationSize() default 50; " +
+ "UniqueConstraint[] uniqueConstraints() default {};");
+ }
+
+ private IType createTestEntityIdMapping() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+ createColumnAnnotation();
+ createTemporalAnnotation();
+ createGeneratedValueAnnotation();
+ createSequenceGeneratorAnnotation();
+ createTableGeneratorAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.COLUMN, JPA.TEMPORAL, JPA.TEMPORAL_TYPE, JPA.GENERATED_VALUE, JPA.GENERATION_TYPE, JPA.TABLE_GENERATOR, JPA.SEQUENCE_GENERATOR);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ sb.append(CR);
+ sb.append(" @Column(name=\"MY_COLUMN\", unique=true, nullable=false, insertable=false, updatable=false, columnDefinition=\"COLUMN_DEFINITION\", table=\"MY_TABLE\", length=5, precision=6, scale=7)");
+ sb.append(CR);
+ sb.append(" @Temporal(TemporalType.TIMESTAMP)");
+ sb.append(CR);
+ sb.append(" @GeneratedValue(strategy=GenerationType.TABLE, generator=\"myTableGenerator\")");
+ sb.append(CR);
+ sb.append(" @TableGenerator(name=\"myTableGenerator\", table=\"myTable\", catalog=\"myCatalog\", schema=\"mySchema\", pkColumnName=\"myPkColumnName\", valueColumnName=\"myValueColumnName\", pkColumnValue=\"myPkColumnValue\", initialValue=1, allocationSize=1)");
+ sb.append(CR);
+ sb.append(" @SequenceGenerator(name=\"mySequenceGenerator\")");
+ }
+ });
+ }
+
+ public void testUpdateName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
+
+ assertEquals("idMapping", xmlIdMapping.getName());
+ assertEquals("idMapping", idResource.getName());
+
+ //set name in the resource model, verify context model updated
+ idResource.setName("newName");
+ assertEquals("newName", xmlIdMapping.getName());
+ assertEquals("newName", idResource.getName());
+
+ //set name to null in the resource model
+ idResource.setName(null);
+ assertNull(xmlIdMapping.getName());
+ assertNull(idResource.getName());
+ }
+
+ public void testModifyName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
+
+ assertEquals("idMapping", xmlIdMapping.getName());
+ assertEquals("idMapping", idResource.getName());
+
+ //set name in the context model, verify resource model updated
+ xmlIdMapping.setName("newName");
+ assertEquals("newName", xmlIdMapping.getName());
+ assertEquals("newName", idResource.getName());
+
+ //set name to null in the context model
+ xmlIdMapping.setName(null);
+ assertNull(xmlIdMapping.getName());
+ assertNull(idResource.getName());
+ }
+
+ public void testUpdateTemporal() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
+ ormResource().save(null);
+
+ assertNull(xmlIdMapping.getTemporal());
+ assertNull(idResource.getTemporal());
+
+ //set temporal in the resource model, verify context model updated
+ idResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE);
+ ormResource().save(null);
+ assertEquals(TemporalType.DATE, xmlIdMapping.getTemporal());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE, idResource.getTemporal());
+
+ idResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME);
+ ormResource().save(null);
+ assertEquals(TemporalType.TIME, xmlIdMapping.getTemporal());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME, idResource.getTemporal());
+
+ idResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP);
+ ormResource().save(null);
+ assertEquals(TemporalType.TIMESTAMP, xmlIdMapping.getTemporal());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP, idResource.getTemporal());
+
+ //set temporal to null in the resource model
+ idResource.setTemporal(null);
+ ormResource().save(null);
+ assertNull(xmlIdMapping.getTemporal());
+ assertNull(idResource.getTemporal());
+ }
+
+ public void testModifyTemporal() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
+ ormResource().save(null);
+
+ assertNull(xmlIdMapping.getTemporal());
+ assertNull(idResource.getTemporal());
+
+ //set temporal in the context model, verify resource model updated
+ xmlIdMapping.setTemporal(TemporalType.DATE);
+ ormResource().save(null);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE, idResource.getTemporal());
+ assertEquals(TemporalType.DATE, xmlIdMapping.getTemporal());
+
+ xmlIdMapping.setTemporal(TemporalType.TIME);
+ ormResource().save(null);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME, idResource.getTemporal());
+ assertEquals(TemporalType.TIME, xmlIdMapping.getTemporal());
+
+ xmlIdMapping.setTemporal(TemporalType.TIMESTAMP);
+ ormResource().save(null);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP, idResource.getTemporal());
+ assertEquals(TemporalType.TIMESTAMP, xmlIdMapping.getTemporal());
+
+ //set temporal to null in the context model
+ xmlIdMapping.setTemporal(null);
+ ormResource().save(null);
+ assertNull(idResource.getTemporal());
+ assertNull(xmlIdMapping.getTemporal());
+ }
+
+ //TODO test morphing to other mapping types
+ //TODO test defaults
+
+
+ public void testAddSequenceGenerator() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
+
+ assertNull(xmlIdMapping.getSequenceGenerator());
+ assertNull(idResource.getSequenceGenerator());
+
+ xmlIdMapping.addSequenceGenerator();
+
+ assertNotNull(idResource.getSequenceGenerator());
+ assertNotNull(xmlIdMapping.getSequenceGenerator());
+
+ //try adding another sequence generator, should get an IllegalStateException
+ try {
+ xmlIdMapping.addSequenceGenerator();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testRemoveSequenceGenerator() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
+
+ assertNull(xmlIdMapping.getSequenceGenerator());
+ assertNull(idResource.getSequenceGenerator());
+
+ xmlIdMapping.addSequenceGenerator();
+ assertNotNull(idResource.getSequenceGenerator());
+ assertNotNull(xmlIdMapping.getSequenceGenerator());
+
+ xmlIdMapping.removeSequenceGenerator();
+
+ assertNull(xmlIdMapping.getSequenceGenerator());
+ assertNull(idResource.getSequenceGenerator());
+
+ //try removing the sequence generator again, should get an IllegalStateException
+ try {
+ xmlIdMapping.removeSequenceGenerator();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testUpdateSequenceGenerator() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
+
+ assertNull(xmlIdMapping.getSequenceGenerator());
+ assertNull(idResource.getSequenceGenerator());
+
+ idResource.setSequenceGenerator(OrmFactory.eINSTANCE.createSequenceGeneratorImpl());
+
+ assertNotNull(xmlIdMapping.getSequenceGenerator());
+ assertNotNull(idResource.getSequenceGenerator());
+
+ idResource.setSequenceGenerator(null);
+ assertNull(xmlIdMapping.getSequenceGenerator());
+ assertNull(idResource.getSequenceGenerator());
+ }
+
+ public void testAddTableGenerator() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
+
+ assertNull(xmlIdMapping.getTableGenerator());
+ assertNull(idResource.getTableGenerator());
+
+ xmlIdMapping.addTableGenerator();
+
+ assertNotNull(idResource.getTableGenerator());
+ assertNotNull(xmlIdMapping.getTableGenerator());
+
+ //try adding another table generator, should get an IllegalStateException
+ try {
+ xmlIdMapping.addTableGenerator();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testRemoveTableGenerator() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
+
+ assertNull(xmlIdMapping.getTableGenerator());
+ assertNull(idResource.getTableGenerator());
+
+ xmlIdMapping.addTableGenerator();
+ assertNotNull(idResource.getTableGenerator());
+ assertNotNull(xmlIdMapping.getTableGenerator());
+
+ xmlIdMapping.removeTableGenerator();
+
+ assertNull(xmlIdMapping.getTableGenerator());
+ assertNull(idResource.getTableGenerator());
+
+ //try removing the table generator again, should get an IllegalStateException
+ try {
+ xmlIdMapping.removeTableGenerator();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testUpdateTableGenerator() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
+
+ assertNull(xmlIdMapping.getTableGenerator());
+ assertNull(idResource.getTableGenerator());
+
+ idResource.setTableGenerator(OrmFactory.eINSTANCE.createTableGeneratorImpl());
+
+ assertNotNull(xmlIdMapping.getTableGenerator());
+ assertNotNull(idResource.getTableGenerator());
+
+ idResource.setTableGenerator(null);
+ assertNull(xmlIdMapping.getTableGenerator());
+ assertNull(idResource.getTableGenerator());
+ }
+
+ public void testAddGeneratedValue() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
+
+ assertNull(xmlIdMapping.getGeneratedValue());
+ assertNull(idResource.getGeneratedValue());
+
+ xmlIdMapping.addGeneratedValue();
+
+ assertNotNull(idResource.getGeneratedValue());
+ assertNotNull(xmlIdMapping.getGeneratedValue());
+
+ //try adding another sequence generator, should get an IllegalStateException
+ try {
+ xmlIdMapping.addGeneratedValue();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testRemoveGeneratedValue() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
+
+ assertNull(xmlIdMapping.getGeneratedValue());
+ assertNull(idResource.getGeneratedValue());
+
+ xmlIdMapping.addGeneratedValue();
+ assertNotNull(idResource.getGeneratedValue());
+ assertNotNull(xmlIdMapping.getGeneratedValue());
+
+ xmlIdMapping.removeGeneratedValue();
+
+ assertNull(xmlIdMapping.getGeneratedValue());
+ assertNull(idResource.getGeneratedValue());
+
+ //try removing the sequence generator again, should get an IllegalStateException
+ try {
+ xmlIdMapping.removeGeneratedValue();
+ } catch (IllegalStateException e) {
+ return;
+ }
+ fail("IllegalStateException not thrown");
+ }
+
+ public void testUpdateGeneratedValue() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
+
+ assertNull(xmlIdMapping.getGeneratedValue());
+ assertNull(idResource.getGeneratedValue());
+
+ idResource.setGeneratedValue(OrmFactory.eINSTANCE.createGeneratedValueImpl());
+
+ assertNotNull(xmlIdMapping.getGeneratedValue());
+ assertNotNull(idResource.getGeneratedValue());
+
+ idResource.setGeneratedValue(null);
+ assertNull(xmlIdMapping.getGeneratedValue());
+ assertNull(idResource.getGeneratedValue());
+ }
+
+
+ public void testIdMappingNoUnderylingJavaAttribute() throws Exception {
+ createTestEntityIdMapping();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "foo");
+ assertEquals(2, xmlPersistentType.virtualAttributesSize());
+
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next();
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+
+ assertEquals("foo", xmlIdMapping.getName());
+ assertNull(xmlIdMapping.getTemporal());
+ assertNull(xmlIdMapping.getGeneratedValue());
+ assertNull(xmlIdMapping.getSequenceGenerator());
+ assertNull(xmlIdMapping.getTableGenerator());
+
+
+ XmlColumn xmlColumn = xmlIdMapping.getColumn();
+ assertNull(xmlColumn.getSpecifiedName());
+ assertNull(xmlColumn.getSpecifiedUnique());
+ assertNull(xmlColumn.getSpecifiedNullable());
+ assertNull(xmlColumn.getSpecifiedInsertable());
+ assertNull(xmlColumn.getSpecifiedUpdatable());
+ assertNull(xmlColumn.getColumnDefinition());
+ assertNull(xmlColumn.getSpecifiedTable());
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(xmlColumn.getSpecifiedPrecision());
+ assertNull(xmlColumn.getSpecifiedScale());
+
+ assertEquals("foo", xmlColumn.getDefaultName());
+ assertEquals(Boolean.FALSE, xmlColumn.getDefaultUnique());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultNullable());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultInsertable());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultUpdatable());
+ assertEquals(null, xmlColumn.getColumnDefinition());
+ assertEquals(TYPE_NAME, xmlColumn.getDefaultTable());
+ assertEquals(Integer.valueOf(255), xmlColumn.getDefaultLength());
+ assertEquals(Integer.valueOf(0), xmlColumn.getDefaultPrecision());
+ assertEquals(Integer.valueOf(0), xmlColumn.getDefaultScale());
+ }
+
+ //@Basic(fetch=FetchType.LAZY, optional=false)
+ //@Column(name="MY_COLUMN", unique=true, nullable=false, insertable=false, updatable=false,
+ // columnDefinition="COLUMN_DEFINITION", table="MY_TABLE", length=5, precision=6, scale=7)");
+ //@Column(
+ //@Lob
+ //@Temporal(TemporalType.TIMESTAMP)
+ //@Enumerated(EnumType.STRING)
+ public void testVirtualMappingMetadataCompleteFalse() throws Exception {
+ createTestEntityIdMapping();
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ assertEquals(2, xmlPersistentType.virtualAttributesSize());
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next();
+
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ assertEquals("id", xmlIdMapping.getName());
+ assertEquals(TemporalType.TIMESTAMP, xmlIdMapping.getTemporal());
+
+ XmlColumn xmlColumn = xmlIdMapping.getColumn();
+ assertEquals("MY_COLUMN", xmlColumn.getSpecifiedName());
+ assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUnique());
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable());
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedInsertable());
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUpdatable());
+ assertEquals("COLUMN_DEFINITION", xmlColumn.getColumnDefinition());
+ assertEquals("MY_TABLE", xmlColumn.getSpecifiedTable());
+ assertEquals(Integer.valueOf(5), xmlColumn.getSpecifiedLength());
+ assertEquals(Integer.valueOf(6), xmlColumn.getSpecifiedPrecision());
+ assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedScale());
+
+ XmlGeneratedValue xmlGeneratedValue = xmlIdMapping.getGeneratedValue();
+ assertEquals("myTableGenerator", xmlGeneratedValue.getSpecifiedGenerator());
+ assertEquals(GenerationType.TABLE, xmlGeneratedValue.getSpecifiedStrategy());
+
+ XmlTableGenerator xmlTableGenerator = xmlIdMapping.getTableGenerator();
+ assertEquals("myTableGenerator", xmlTableGenerator.getName());
+ assertEquals("myTable", xmlTableGenerator.getSpecifiedTable());
+ assertEquals("myCatalog", xmlTableGenerator.getSpecifiedCatalog());
+ assertEquals("mySchema", xmlTableGenerator.getSpecifiedSchema());
+ assertEquals("myPkColumnName", xmlTableGenerator.getSpecifiedPkColumnName());
+ assertEquals("myPkColumnValue", xmlTableGenerator.getSpecifiedPkColumnValue());
+ assertEquals("myValueColumnName", xmlTableGenerator.getSpecifiedValueColumnName());
+ assertEquals(Integer.valueOf(1), xmlTableGenerator.getSpecifiedInitialValue());
+ assertEquals(Integer.valueOf(1), xmlTableGenerator.getSpecifiedAllocationSize());
+
+ XmlSequenceGenerator xmlSequenceGenerator = xmlIdMapping.getSequenceGenerator();
+ assertEquals("mySequenceGenerator", xmlSequenceGenerator.getName());
+ }
+
+ public void testVirtualMappingMetadataCompleteTrue() throws Exception {
+ createTestEntityIdMapping();
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ xmlPersistentType.getMapping().setSpecifiedMetadataComplete(true);
+ assertEquals(2, xmlPersistentType.virtualAttributesSize());
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next();
+
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+ assertEquals("id", xmlIdMapping.getName());
+ assertNull(xmlIdMapping.getTemporal());
+ assertNull(xmlIdMapping.getGeneratedValue());
+ assertNull(xmlIdMapping.getSequenceGenerator());
+ assertNull(xmlIdMapping.getTableGenerator());
+
+ XmlColumn xmlColumn = xmlIdMapping.getColumn();
+ assertEquals("id", xmlColumn.getSpecifiedName());
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUnique());
+ assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedNullable());
+ assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedInsertable());
+ assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUpdatable());
+ assertNull(xmlColumn.getColumnDefinition());
+ assertEquals(TYPE_NAME, xmlColumn.getSpecifiedTable());
+ assertEquals(Integer.valueOf(255), xmlColumn.getSpecifiedLength());
+ assertEquals(Integer.valueOf(0), xmlColumn.getSpecifiedPrecision());
+ assertEquals(Integer.valueOf(0), xmlColumn.getSpecifiedScale());
+ }
+
+ public void testSpecifiedMapping() throws Exception {
+ createTestEntityIdMapping();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
+ assertEquals(1, xmlPersistentType.virtualAttributesSize());
+
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next();
+ XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping();
+
+ assertEquals("id", xmlIdMapping.getName());
+ assertNull(xmlIdMapping.getTemporal());
+ assertNull(xmlIdMapping.getGeneratedValue());
+ assertNull(xmlIdMapping.getSequenceGenerator());
+ assertNull(xmlIdMapping.getTableGenerator());
+
+ XmlColumn xmlColumn = xmlIdMapping.getColumn();
+ assertNull(xmlColumn.getSpecifiedName());
+ assertNull(xmlColumn.getSpecifiedUnique());
+ assertNull(xmlColumn.getSpecifiedNullable());
+ assertNull(xmlColumn.getSpecifiedInsertable());
+ assertNull(xmlColumn.getSpecifiedUpdatable());
+ assertNull(xmlColumn.getColumnDefinition());
+ assertNull(xmlColumn.getSpecifiedTable());
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(xmlColumn.getSpecifiedPrecision());
+ assertNull(xmlColumn.getSpecifiedScale());
+
+ assertEquals("id", xmlColumn.getDefaultName());
+ assertEquals(Boolean.FALSE, xmlColumn.getDefaultUnique());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultNullable());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultInsertable());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultUpdatable());
+ assertEquals(null, xmlColumn.getColumnDefinition());
+ assertEquals(TYPE_NAME, xmlColumn.getDefaultTable());
+ assertEquals(Integer.valueOf(255), xmlColumn.getDefaultLength());
+ assertEquals(Integer.valueOf(0), xmlColumn.getDefaultPrecision());
+ assertEquals(Integer.valueOf(0), xmlColumn.getDefaultScale());
+ }
+
+ //3 things tested above
+ //1. virtual mapping metadata complete=false - defaults are taken from the java annotations
+ //2. virtual mapping metadata complete=true - defaults are taken from java defaults,annotations ignored
+ //3. specified mapping (metadata complete=true/false - defaults are taken from java annotations
+
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlJoinColumnTests.java
new file mode 100644
index 0000000000..7ef1c90c6a
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlJoinColumnTests.java
@@ -0,0 +1,564 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.XmlJoinColumn;
+import org.eclipse.jpt.core.internal.context.orm.XmlJoinTable;
+import org.eclipse.jpt.core.internal.context.orm.XmlManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.orm.JoinColumn;
+import org.eclipse.jpt.core.internal.resource.orm.JoinTable;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class XmlJoinColumnTests extends ContextModelTestCase
+{
+ public XmlJoinColumnTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ public void testUpdateSpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ XmlJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
+
+ assertNull(joinColumn.getSpecifiedName());
+ assertNull(joinColumnResource.getName());
+
+ //set name in the resource model, verify context model updated
+ joinColumnResource.setName("FOO");
+ assertEquals("FOO", joinColumn.getSpecifiedName());
+ assertEquals("FOO", joinColumnResource.getName());
+
+ //set name to null in the resource model
+ joinColumnResource.setName(null);
+ assertNull(joinColumn.getSpecifiedName());
+ assertNull(joinColumnResource.getName());
+
+ joinColumnResource.setName("FOO");
+ assertEquals("FOO", joinColumn.getSpecifiedName());
+ assertEquals("FOO", joinColumnResource.getName());
+
+ joinTableResource.getJoinColumns().remove(0);
+ assertFalse(xmlJoinTable.joinColumns().hasNext());
+ assertTrue(joinTableResource.getJoinColumns().isEmpty());
+ }
+
+ public void testModifySpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ XmlJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
+
+ assertNull(joinColumn.getSpecifiedName());
+ assertNull(joinColumnResource.getName());
+
+ //set name in the context model, verify resource model modified
+ joinColumn.setSpecifiedName("foo");
+ assertEquals("foo", joinColumn.getSpecifiedName());
+ assertEquals("foo", joinColumnResource.getName());
+
+ //set name to null in the context model
+ joinColumn.setSpecifiedName(null);
+ assertNull(joinColumn.getSpecifiedName());
+ assertNull(joinTableResource.getJoinColumns().get(0).getName());
+ }
+
+ public void testUpdateSpecifiedReferencedColumnName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ XmlJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
+
+ assertNull(joinColumn.getSpecifiedReferencedColumnName());
+ assertNull(joinColumnResource.getReferencedColumnName());
+
+ //set name in the resource model, verify context model updated
+ joinColumnResource.setReferencedColumnName("FOO");
+ ormResource().save(null);
+ assertEquals("FOO", joinColumn.getSpecifiedReferencedColumnName());
+ assertEquals("FOO", joinColumnResource.getReferencedColumnName());
+
+ //set name to null in the resource model
+ joinColumnResource.setReferencedColumnName(null);
+ assertNull(joinColumn.getSpecifiedReferencedColumnName());
+ assertNull(joinColumnResource.getReferencedColumnName());
+
+ joinColumnResource.setReferencedColumnName("FOO");
+ assertEquals("FOO", joinColumn.getSpecifiedReferencedColumnName());
+ assertEquals("FOO", joinColumnResource.getReferencedColumnName());
+
+ joinTableResource.getJoinColumns().remove(0);
+ assertFalse(xmlJoinTable.joinColumns().hasNext());
+ assertTrue(joinTableResource.getJoinColumns().isEmpty());
+ }
+
+ public void testModifySpecifiedReferencedColumnName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ XmlJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
+
+ assertNull(joinColumn.getSpecifiedReferencedColumnName());
+ assertNull(joinColumnResource.getReferencedColumnName());
+
+ //set name in the context model, verify resource model modified
+ joinColumn.setSpecifiedReferencedColumnName("foo");
+ assertEquals("foo", joinColumn.getSpecifiedReferencedColumnName());
+ assertEquals("foo", joinColumnResource.getReferencedColumnName());
+
+ //set name to null in the context model
+ joinColumn.setSpecifiedReferencedColumnName(null);
+ assertNull(joinColumn.getSpecifiedReferencedColumnName());
+ assertNull(joinTableResource.getJoinColumns().get(0).getReferencedColumnName());
+ }
+
+// public void testUpdateDefaultNameFromJavaTable() throws Exception {
+// createTestEntity();
+//
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.javaEntity().getTable().setSpecifiedName("Foo");
+// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+// xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.setSpecifiedMetadataComplete(null);
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.getTable().setSpecifiedName("Bar");
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+// }
+//
+// public void testUpdateDefaultNameNoJava() throws Exception {
+// createTestEntity();
+//
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+// }
+//
+// public void testUpdateDefaultNameFromParent() throws Exception {
+// createTestEntity();
+// createTestSubType();
+//
+// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping();
+// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping();
+//
+// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+// assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName());
+//
+// parentXmlEntity.getTable().setSpecifiedName("FOO");
+// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+// assertEquals("FOO", childXmlEntity.getTable().getDefaultName());
+//
+// parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+// assertEquals("AnnotationTestTypeChild", childXmlEntity.getTable().getDefaultName());
+// }
+
+
+ public void testUpdateSpecifiedColumnDefinition() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ XmlJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
+
+ assertNull(joinColumn.getColumnDefinition());
+ assertNull(joinColumnResource.getColumnDefinition());
+
+ //set name in the resource model, verify context model updated
+ joinColumnResource.setColumnDefinition("FOO");
+ assertEquals("FOO", joinColumn.getColumnDefinition());
+ assertEquals("FOO", joinColumnResource.getColumnDefinition());
+
+ //set name to null in the resource model
+ joinColumnResource.setColumnDefinition(null);
+ assertNull(joinColumn.getColumnDefinition());
+ assertNull(joinColumnResource.getColumnDefinition());
+
+ joinColumnResource.setColumnDefinition("FOO");
+ assertEquals("FOO", joinColumn.getColumnDefinition());
+ assertEquals("FOO", joinColumnResource.getColumnDefinition());
+
+ joinTableResource.getJoinColumns().remove(0);
+ assertFalse(xmlJoinTable.joinColumns().hasNext());
+ assertTrue(joinTableResource.getJoinColumns().isEmpty());
+ }
+
+ public void testModifySpecifiedColumnDefinition() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ XmlJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
+
+ assertNull(joinColumn.getColumnDefinition());
+ assertNull(joinColumnResource.getColumnDefinition());
+
+ //set name in the context model, verify resource model modified
+ joinColumn.setColumnDefinition("foo");
+ assertEquals("foo", joinColumn.getColumnDefinition());
+ assertEquals("foo", joinColumnResource.getColumnDefinition());
+
+ //set name to null in the context model
+ joinColumn.setColumnDefinition(null);
+ assertNull(joinColumn.getColumnDefinition());
+ assertNull(joinTableResource.getJoinColumns().get(0).getColumnDefinition());
+ }
+
+ public void testUpdateSpecifiedTable() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
+
+ assertNull(xmlJoinColumn.getSpecifiedTable());
+ assertNull(joinColumnResource.getTable());
+
+ //set table in the resource model, verify context model updated
+ joinColumnResource.setTable("FOO");
+ assertEquals("FOO", xmlJoinColumn.getSpecifiedTable());
+ assertEquals("FOO", joinColumnResource.getTable());
+
+ //set table to null in the resource model
+ joinColumnResource.setTable(null);
+ assertNull(xmlJoinColumn.getSpecifiedTable());
+ assertNull(joinColumnResource.getTable());
+
+ joinColumnResource.setTable("FOO");
+ assertEquals("FOO", xmlJoinColumn.getSpecifiedTable());
+ assertEquals("FOO", joinColumnResource.getTable());
+
+ joinTableResource.getJoinColumns().remove(0);
+ assertFalse(xmlJoinTable.joinColumns().hasNext());
+ assertTrue(joinTableResource.getJoinColumns().isEmpty());
+ }
+
+ public void testModifySpecifiedTable() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
+
+ assertNull(xmlJoinColumn.getSpecifiedTable());
+ assertNull(joinColumnResource.getTable());
+
+ //set table in the context model, verify resource model modified
+ xmlJoinColumn.setSpecifiedTable("foo");
+ assertEquals("foo", xmlJoinColumn.getSpecifiedTable());
+ assertEquals("foo", joinColumnResource.getTable());
+
+ //set table to null in the context model
+ xmlJoinColumn.setSpecifiedTable(null);
+ assertNull(xmlJoinColumn.getSpecifiedTable());
+ assertNull(joinTableResource.getJoinColumns().get(0).getTable());
+ }
+
+ public void testUpdateSpecifiedNullable() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
+
+ assertNull(xmlJoinColumn.getSpecifiedNullable());
+ assertNull(joinColumnResource.getNullable());
+
+ //set nullable in the resource model, verify context model updated
+ joinColumnResource.setNullable(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, xmlJoinColumn.getSpecifiedNullable());
+ assertEquals(Boolean.TRUE, joinColumnResource.getNullable());
+
+ //set nullable to null in the resource model
+ joinColumnResource.setNullable(null);
+ assertNull(xmlJoinColumn.getSpecifiedNullable());
+ assertNull(joinColumnResource.getNullable());
+
+ joinColumnResource.setNullable(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlJoinColumn.getSpecifiedNullable());
+ assertEquals(Boolean.FALSE, joinColumnResource.getNullable());
+
+ joinTableResource.getJoinColumns().remove(0);
+ assertFalse(xmlJoinTable.joinColumns().hasNext());
+ assertTrue(joinTableResource.getJoinColumns().isEmpty());
+ }
+
+ public void testModifySpecifiedNullable() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
+
+ assertNull(xmlJoinColumn.getSpecifiedNullable());
+ assertNull(joinColumnResource.getNullable());
+
+ //set nullable in the context model, verify resource model modified
+ xmlJoinColumn.setSpecifiedNullable(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlJoinColumn.getSpecifiedNullable());
+ assertEquals(Boolean.FALSE, joinColumnResource.getNullable());
+
+ //set nullable to null in the context model
+ xmlJoinColumn.setSpecifiedNullable(null);
+ assertNull(xmlJoinColumn.getSpecifiedNullable());
+ assertNull(joinTableResource.getJoinColumns().get(0).getNullable());
+ }
+
+ public void testUpdateSpecifiedUpdatable() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
+
+ assertNull(xmlJoinColumn.getSpecifiedUpdatable());
+ assertNull(joinColumnResource.getUpdatable());
+
+ //set updatable in the resource model, verify context model updated
+ joinColumnResource.setUpdatable(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, xmlJoinColumn.getSpecifiedUpdatable());
+ assertEquals(Boolean.TRUE, joinColumnResource.getUpdatable());
+
+ //set updatable to null in the resource model
+ joinColumnResource.setUpdatable(null);
+ assertNull(xmlJoinColumn.getSpecifiedUpdatable());
+ assertNull(joinColumnResource.getUpdatable());
+
+ joinColumnResource.setUpdatable(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlJoinColumn.getSpecifiedUpdatable());
+ assertEquals(Boolean.FALSE, joinColumnResource.getUpdatable());
+
+ joinTableResource.getJoinColumns().remove(0);
+ assertFalse(xmlJoinTable.joinColumns().hasNext());
+ assertTrue(joinTableResource.getJoinColumns().isEmpty());
+ }
+
+ public void testModifySpecifiedUpdatable() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
+
+ assertNull(xmlJoinColumn.getSpecifiedUpdatable());
+ assertNull(joinColumnResource.getUpdatable());
+
+ //set updatable in the context model, verify resource model modified
+ xmlJoinColumn.setSpecifiedUpdatable(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlJoinColumn.getSpecifiedUpdatable());
+ assertEquals(Boolean.FALSE, joinColumnResource.getUpdatable());
+
+ //set updatable to null in the context model
+ xmlJoinColumn.setSpecifiedUpdatable(null);
+ assertNull(xmlJoinColumn.getSpecifiedUpdatable());
+ assertNull(joinTableResource.getJoinColumns().get(0).getUpdatable());
+ }
+
+ public void testUpdateSpecifiedInsertable() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
+
+ assertNull(xmlJoinColumn.getSpecifiedInsertable());
+ assertNull(joinColumnResource.getInsertable());
+
+ //set insertable in the resource model, verify context model updated
+ joinColumnResource.setInsertable(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, xmlJoinColumn.getSpecifiedInsertable());
+ assertEquals(Boolean.TRUE, joinColumnResource.getInsertable());
+
+ //set insertable to null in the resource model
+ joinColumnResource.setInsertable(null);
+ assertNull(xmlJoinColumn.getSpecifiedInsertable());
+ assertNull(joinColumnResource.getInsertable());
+
+ joinColumnResource.setInsertable(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlJoinColumn.getSpecifiedInsertable());
+ assertEquals(Boolean.FALSE, joinColumnResource.getInsertable());
+
+ joinTableResource.getJoinColumns().remove(0);
+ assertFalse(xmlJoinTable.joinColumns().hasNext());
+ assertTrue(joinTableResource.getJoinColumns().isEmpty());
+ }
+
+ public void testModifySpecifiedInsertable() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
+
+ assertNull(xmlJoinColumn.getSpecifiedInsertable());
+ assertNull(joinColumnResource.getInsertable());
+
+ //set insertable in the context model, verify resource model modified
+ xmlJoinColumn.setSpecifiedInsertable(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlJoinColumn.getSpecifiedInsertable());
+ assertEquals(Boolean.FALSE, joinColumnResource.getInsertable());
+
+ //set insertable to null in the context model
+ xmlJoinColumn.setSpecifiedInsertable(null);
+ assertNull(xmlJoinColumn.getSpecifiedInsertable());
+ assertNull(joinTableResource.getJoinColumns().get(0).getInsertable());
+ }
+
+ public void testUpdateSpecifiedUnique() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
+
+ assertNull(xmlJoinColumn.getSpecifiedUnique());
+ assertNull(joinColumnResource.getUnique());
+
+ //set unique in the resource model, verify context model updated
+ joinColumnResource.setUnique(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, xmlJoinColumn.getSpecifiedUnique());
+ assertEquals(Boolean.TRUE, joinColumnResource.getUnique());
+
+ //set unique to null in the resource model
+ joinColumnResource.setUnique(null);
+ assertNull(xmlJoinColumn.getSpecifiedUnique());
+ assertNull(joinColumnResource.getUnique());
+
+ joinColumnResource.setUnique(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlJoinColumn.getSpecifiedUnique());
+ assertEquals(Boolean.FALSE, joinColumnResource.getUnique());
+
+ joinTableResource.getJoinColumns().remove(0);
+ assertFalse(xmlJoinTable.joinColumns().hasNext());
+ assertTrue(joinTableResource.getJoinColumns().isEmpty());
+ }
+
+ public void testModifySpecifiedUnique() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0);
+
+ assertNull(xmlJoinColumn.getSpecifiedUnique());
+ assertNull(joinColumnResource.getUnique());
+
+ //set unique in the context model, verify resource model modified
+ xmlJoinColumn.setSpecifiedUnique(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlJoinColumn.getSpecifiedUnique());
+ assertEquals(Boolean.FALSE, joinColumnResource.getUnique());
+
+ //set unique to null in the context model
+ xmlJoinColumn.setSpecifiedUnique(null);
+ assertNull(xmlJoinColumn.getSpecifiedUnique());
+ assertNull(joinTableResource.getJoinColumns().get(0).getUnique());
+ }
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlJoinTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlJoinTableTests.java
new file mode 100644
index 0000000000..67d3cb2f2a
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlJoinTableTests.java
@@ -0,0 +1,781 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.XmlJoinColumn;
+import org.eclipse.jpt.core.internal.context.orm.XmlJoinTable;
+import org.eclipse.jpt.core.internal.context.orm.XmlManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.orm.JoinTable;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class XmlJoinTableTests extends ContextModelTestCase
+{
+ public XmlJoinTableTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ public void testUpdateSpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+
+ assertNull(xmlJoinTable.getSpecifiedName());
+ assertNull(manyToMany.getJoinTable());
+
+
+ //set name in the resource model, verify context model updated
+ manyToMany.setJoinTable(OrmFactory.eINSTANCE.createJoinTableImpl());
+ manyToMany.getJoinTable().setName("FOO");
+ assertEquals("FOO", xmlJoinTable.getSpecifiedName());
+ assertEquals("FOO", manyToMany.getJoinTable().getName());
+
+ //set name to null in the resource model
+ manyToMany.getJoinTable().setName(null);
+ assertNull(xmlJoinTable.getSpecifiedName());
+ assertNull(manyToMany.getJoinTable().getName());
+
+ manyToMany.getJoinTable().setName("FOO");
+ assertEquals("FOO", xmlJoinTable.getSpecifiedName());
+ assertEquals("FOO", manyToMany.getJoinTable().getName());
+
+ manyToMany.setJoinTable(null);
+ assertNull(xmlJoinTable.getSpecifiedName());
+ assertNull(manyToMany.getJoinTable());
+ }
+
+ public void testModifySpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+
+ assertNull(xmlJoinTable.getSpecifiedName());
+ assertNull(manyToMany.getJoinTable());
+
+ //set name in the context model, verify resource model modified
+ xmlJoinTable.setSpecifiedName("foo");
+ assertEquals("foo", xmlJoinTable.getSpecifiedName());
+ assertEquals("foo", manyToMany.getJoinTable().getName());
+
+ //set name to null in the context model
+ xmlJoinTable.setSpecifiedName(null);
+ assertNull(xmlJoinTable.getSpecifiedName());
+ assertNull(manyToMany.getJoinTable());
+ }
+
+// public void testUpdateDefaultNameFromJavaTable() throws Exception {
+// createTestEntity();
+//
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.javaEntity().getTable().setSpecifiedName("Foo");
+// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+// xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.setSpecifiedMetadataComplete(null);
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.getTable().setSpecifiedName("Bar");
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+// }
+//
+// public void testUpdateDefaultNameNoJava() throws Exception {
+// createTestEntity();
+//
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+// }
+//
+// public void testUpdateDefaultNameFromParent() throws Exception {
+// createTestEntity();
+// createTestSubType();
+//
+// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping();
+// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping();
+//
+// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+// assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName());
+//
+// parentXmlEntity.getTable().setSpecifiedName("FOO");
+// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+// assertEquals("FOO", childXmlEntity.getTable().getDefaultName());
+//
+// parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+// assertEquals("AnnotationTestTypeChild", childXmlEntity.getTable().getDefaultName());
+// }
+
+ public void testUpdateSpecifiedSchema() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+
+ assertNull(xmlJoinTable.getSpecifiedSchema());
+ assertNull(manyToMany.getJoinTable());
+
+ //set schema in the resource model, verify context model updated
+ manyToMany.setJoinTable(OrmFactory.eINSTANCE.createJoinTableImpl());
+ manyToMany.getJoinTable().setSchema("FOO");
+ assertEquals("FOO", xmlJoinTable.getSpecifiedSchema());
+ assertEquals("FOO", manyToMany.getJoinTable().getSchema());
+
+ //set Schema to null in the resource model
+ manyToMany.getJoinTable().setSchema(null);
+ assertNull(xmlJoinTable.getSpecifiedSchema());
+ assertNull(manyToMany.getJoinTable().getSchema());
+
+ manyToMany.getJoinTable().setSchema("FOO");
+ assertEquals("FOO", xmlJoinTable.getSpecifiedSchema());
+ assertEquals("FOO", manyToMany.getJoinTable().getSchema());
+
+ manyToMany.setJoinTable(null);
+ assertNull(xmlJoinTable.getSpecifiedSchema());
+ assertNull(manyToMany.getJoinTable());
+ }
+
+// public void testUpdateDefaultSchemaFromJavaTable() throws Exception {
+// createTestEntity();
+//
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// assertNull(xmlEntity.getTable().getDefaultSchema());
+//
+// xmlEntity.javaEntity().getTable().setSpecifiedSchema("Foo");
+// assertEquals("Foo", xmlEntity.getTable().getDefaultSchema());
+//
+// xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+// assertNull(xmlEntity.getTable().getDefaultSchema());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+// xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+// assertNull(xmlEntity.getTable().getDefaultSchema());
+//
+// xmlEntity.setSpecifiedMetadataComplete(null);
+// assertNull(xmlEntity.getTable().getDefaultSchema());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+// assertEquals("Foo", xmlEntity.getTable().getDefaultSchema());
+//
+// xmlEntity.getTable().setSpecifiedName("Bar");
+// assertNull(xmlEntity.getTable().getDefaultSchema());
+// }
+//
+// public void testUpdateDefaultSchemaNoJava() throws Exception {
+// createTestEntity();
+//
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// assertNull(xmlEntity.getTable().getDefaultSchema());
+// }
+//
+// public void testUpdateDefaultSchemaFromParent() throws Exception {
+// createTestEntity();
+// createTestSubType();
+//
+// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping();
+// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping();
+//
+// assertNull(parentXmlEntity.getTable().getDefaultSchema());
+// assertNull(childXmlEntity.getTable().getDefaultSchema());
+//
+// parentXmlEntity.getTable().setSpecifiedSchema("FOO");
+// assertNull(parentXmlEntity.getTable().getDefaultSchema());
+// assertEquals("FOO", childXmlEntity.getTable().getDefaultSchema());
+//
+// parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+// assertNull(parentXmlEntity.getTable().getDefaultSchema());
+// assertNull(childXmlEntity.getTable().getDefaultSchema());
+// }
+//
+// public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
+// createTestEntity();
+//
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// assertNull(xmlEntity.getTable().getDefaultSchema());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema("FOO");
+// assertEquals("FOO", xmlEntity.getTable().getDefaultSchema());
+//
+// xmlEntity.entityMappings().setSpecifiedSchema("BAR");
+// assertEquals("BAR", xmlEntity.getTable().getDefaultSchema());
+//
+// xmlEntity.javaEntity().getTable().setSpecifiedSchema("JAVA_SCHEMA");
+// assertEquals("JAVA_SCHEMA", xmlEntity.getTable().getDefaultSchema());
+//
+// xmlEntity.getTable().setSpecifiedName("BLAH");
+// //xml entity now has a table element so default schema is not taken from java
+// assertEquals("BAR", xmlEntity.getTable().getDefaultSchema());
+//
+//
+// xmlEntity.entityMappings().setSpecifiedSchema(null);
+// assertEquals("FOO", xmlEntity.getTable().getDefaultSchema());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema(null);
+// assertNull(xmlEntity.getTable().getDefaultSchema());
+//
+// xmlEntity.getTable().setSpecifiedName(null);
+// assertEquals("JAVA_SCHEMA", xmlEntity.getTable().getDefaultSchema());
+// }
+
+ public void testModifySpecifiedSchema() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+
+ assertNull(xmlJoinTable.getSpecifiedSchema());
+ assertNull(manyToMany.getJoinTable());
+
+ //set Schema in the context model, verify resource model modified
+ xmlJoinTable.setSpecifiedSchema("foo");
+ assertEquals("foo", xmlJoinTable.getSpecifiedSchema());
+ assertEquals("foo", manyToMany.getJoinTable().getSchema());
+
+ //set Schema to null in the context model
+ xmlJoinTable.setSpecifiedSchema(null);
+ assertNull(xmlJoinTable.getSpecifiedSchema());
+ assertNull(manyToMany.getJoinTable());
+ }
+
+ public void testUpdateSpecifiedCatalog() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+
+ assertNull(xmlJoinTable.getSpecifiedCatalog());
+ assertNull(manyToMany.getJoinTable());
+
+ //set Catalog in the resource model, verify context model updated
+ manyToMany.setJoinTable(OrmFactory.eINSTANCE.createJoinTableImpl());
+ manyToMany.getJoinTable().setCatalog("FOO");
+ assertEquals("FOO", xmlJoinTable.getSpecifiedCatalog());
+ assertEquals("FOO", manyToMany.getJoinTable().getCatalog());
+
+ //set Catalog to null in the resource model
+ manyToMany.getJoinTable().setCatalog(null);
+ assertNull(xmlJoinTable.getSpecifiedCatalog());
+ assertNull(manyToMany.getJoinTable().getCatalog());
+
+ manyToMany.getJoinTable().setCatalog("FOO");
+ assertEquals("FOO", xmlJoinTable.getSpecifiedCatalog());
+ assertEquals("FOO", manyToMany.getJoinTable().getCatalog());
+
+ manyToMany.setJoinTable(null);
+ assertNull(xmlJoinTable.getSpecifiedCatalog());
+ assertNull(manyToMany.getJoinTable());
+ }
+
+ public void testModifySpecifiedCatalog() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+
+ assertNull(xmlJoinTable.getSpecifiedCatalog());
+ assertNull(manyToMany.getJoinTable());
+
+ //set Catalog in the context model, verify resource model modified
+ xmlJoinTable.setSpecifiedCatalog("foo");
+ assertEquals("foo", xmlJoinTable.getSpecifiedCatalog());
+ assertEquals("foo", manyToMany.getJoinTable().getCatalog());
+
+ //set Catalog to null in the context model
+ xmlJoinTable.setSpecifiedCatalog(null);
+ assertNull(xmlJoinTable.getSpecifiedCatalog());
+ assertNull(manyToMany.getJoinTable());
+ }
+
+// public void testUpdateDefaultCatalogFromJavaTable() throws Exception {
+// createTestEntity();
+//
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// assertNull(xmlEntity.getTable().getDefaultCatalog());
+//
+// xmlEntity.javaEntity().getTable().setSpecifiedCatalog("Foo");
+// assertEquals("Foo", xmlEntity.getTable().getDefaultCatalog());
+//
+// xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+// assertNull(xmlEntity.getTable().getDefaultCatalog());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+// xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+// assertNull(xmlEntity.getTable().getDefaultCatalog());
+//
+// xmlEntity.setSpecifiedMetadataComplete(null);
+// assertNull(xmlEntity.getTable().getDefaultCatalog());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+// assertEquals("Foo", xmlEntity.getTable().getDefaultCatalog());
+//
+// xmlEntity.getTable().setSpecifiedName("Bar");
+// assertNull(xmlEntity.getTable().getDefaultCatalog());
+// }
+//
+// public void testUpdateDefaultCatalogNoJava() throws Exception {
+// createTestEntity();
+//
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// assertNull(xmlEntity.getTable().getDefaultCatalog());
+// }
+//
+// public void testUpdateDefaultCatalogFromParent() throws Exception {
+// createTestEntity();
+// createTestSubType();
+//
+// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping();
+// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping();
+//
+// assertNull(parentXmlEntity.getTable().getDefaultCatalog());
+// assertNull(childXmlEntity.getTable().getDefaultCatalog());
+//
+// parentXmlEntity.getTable().setSpecifiedCatalog("FOO");
+// assertNull(parentXmlEntity.getTable().getDefaultCatalog());
+// assertEquals("FOO", childXmlEntity.getTable().getDefaultCatalog());
+//
+// parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+// assertNull(parentXmlEntity.getTable().getDefaultCatalog());
+// assertNull(childXmlEntity.getTable().getDefaultCatalog());
+// }
+//
+// public void testUpdateDefaultCatalogFromPersistenceUnitDefaults() throws Exception {
+// createTestEntity();
+//
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// assertNull(xmlEntity.getTable().getDefaultCatalog());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("FOO");
+// assertEquals("FOO", xmlEntity.getTable().getDefaultCatalog());
+//
+// xmlEntity.entityMappings().setSpecifiedCatalog("BAR");
+// assertEquals("BAR", xmlEntity.getTable().getDefaultCatalog());
+//
+// xmlEntity.javaEntity().getTable().setSpecifiedCatalog("JAVA_CATALOG");
+// assertEquals("JAVA_CATALOG", xmlEntity.getTable().getDefaultCatalog());
+//
+// xmlEntity.getTable().setSpecifiedName("BLAH");
+// //xml entity now has a table element so default schema is not taken from java
+// assertEquals("BAR", xmlEntity.getTable().getDefaultCatalog());
+//
+//
+// xmlEntity.entityMappings().setSpecifiedCatalog(null);
+// assertEquals("FOO", xmlEntity.getTable().getDefaultCatalog());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog(null);
+// assertNull(xmlEntity.getTable().getDefaultCatalog());
+//
+// xmlEntity.getTable().setSpecifiedName(null);
+// assertEquals("JAVA_CATALOG", xmlEntity.getTable().getDefaultCatalog());
+//}
+
+//
+// public void testUpdateName() throws Exception {
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+// assertEquals("Foo", xmlEntity.getName());
+//
+// //set class in the resource model, verify context model updated
+// entityResource.setClassName("com.Bar");
+// assertEquals("Bar", xmlEntity.getName());
+//
+// entityResource.setName("Baz");
+// assertEquals("Baz", xmlEntity.getName());
+//
+// //set class to null in the resource model
+// entityResource.setClassName(null);
+// assertEquals("Baz", xmlEntity.getName());
+//
+// entityResource.setName(null);
+// assertNull(xmlEntity.getName());
+// }
+
+
+ public void testAddSpecifiedJoinColumn() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+
+ XmlJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0);
+ ormResource().save(null);
+ joinColumn.setSpecifiedName("FOO");
+ ormResource().save(null);
+
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ assertEquals("FOO", joinTableResource.getJoinColumns().get(0).getName());
+
+ XmlJoinColumn joinColumn2 = xmlJoinTable.addSpecifiedJoinColumn(0);
+ ormResource().save(null);
+ joinColumn2.setSpecifiedName("BAR");
+ ormResource().save(null);
+
+ assertEquals("BAR", joinTableResource.getJoinColumns().get(0).getName());
+ assertEquals("FOO", joinTableResource.getJoinColumns().get(1).getName());
+
+ XmlJoinColumn joinColumn3 = xmlJoinTable.addSpecifiedJoinColumn(1);
+ ormResource().save(null);
+ joinColumn3.setSpecifiedName("BAZ");
+ ormResource().save(null);
+
+ assertEquals("BAR", joinTableResource.getJoinColumns().get(0).getName());
+ assertEquals("BAZ", joinTableResource.getJoinColumns().get(1).getName());
+ assertEquals("FOO", joinTableResource.getJoinColumns().get(2).getName());
+
+ ListIterator<XmlJoinColumn> joinColumns = xmlJoinTable.specifiedJoinColumns();
+ assertEquals(joinColumn2, joinColumns.next());
+ assertEquals(joinColumn3, joinColumns.next());
+ assertEquals(joinColumn, joinColumns.next());
+
+ joinColumns = xmlJoinTable.specifiedJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ }
+
+ public void testRemoveSpecifiedJoinColumn() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+
+ xmlJoinTable.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ xmlJoinTable.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
+ xmlJoinTable.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
+
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ assertEquals(3, joinTableResource.getJoinColumns().size());
+
+ xmlJoinTable.removeSpecifiedJoinColumn(0);
+ assertEquals(2, joinTableResource.getJoinColumns().size());
+ assertEquals("BAR", joinTableResource.getJoinColumns().get(0).getName());
+ assertEquals("BAZ", joinTableResource.getJoinColumns().get(1).getName());
+
+ xmlJoinTable.removeSpecifiedJoinColumn(0);
+ assertEquals(1, joinTableResource.getJoinColumns().size());
+ assertEquals("BAZ", joinTableResource.getJoinColumns().get(0).getName());
+
+ xmlJoinTable.removeSpecifiedJoinColumn(0);
+ assertEquals(0, joinTableResource.getJoinColumns().size());
+ }
+
+ public void testMoveSpecifiedJoinColumn() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+
+ xmlJoinTable.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ xmlJoinTable.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
+ xmlJoinTable.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
+
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ assertEquals(3, joinTableResource.getJoinColumns().size());
+
+
+ xmlJoinTable.moveSpecifiedJoinColumn(2, 0);
+ ListIterator<XmlJoinColumn> joinColumns = xmlJoinTable.specifiedJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+
+ assertEquals("BAR", joinTableResource.getJoinColumns().get(0).getName());
+ assertEquals("BAZ", joinTableResource.getJoinColumns().get(1).getName());
+ assertEquals("FOO", joinTableResource.getJoinColumns().get(2).getName());
+
+
+ xmlJoinTable.moveSpecifiedJoinColumn(0, 1);
+ joinColumns = xmlJoinTable.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+
+ assertEquals("BAZ", joinTableResource.getJoinColumns().get(0).getName());
+ assertEquals("BAR", joinTableResource.getJoinColumns().get(1).getName());
+ assertEquals("FOO", joinTableResource.getJoinColumns().get(2).getName());
+ }
+
+ public void testUpdateInverseJoinColumns() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ manyToMany.setJoinTable(OrmFactory.eINSTANCE.createJoinTableImpl());
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+
+ joinTableResource.getInverseJoinColumns().add(OrmFactory.eINSTANCE.createJoinColumnImpl());
+ joinTableResource.getInverseJoinColumns().add(OrmFactory.eINSTANCE.createJoinColumnImpl());
+ joinTableResource.getInverseJoinColumns().add(OrmFactory.eINSTANCE.createJoinColumnImpl());
+
+ joinTableResource.getInverseJoinColumns().get(0).setName("FOO");
+ joinTableResource.getInverseJoinColumns().get(1).setName("BAR");
+ joinTableResource.getInverseJoinColumns().get(2).setName("BAZ");
+
+ ListIterator<XmlJoinColumn> joinColumns = xmlJoinTable.specifiedInverseJoinColumns();
+ assertEquals("FOO", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ joinTableResource.getInverseJoinColumns().move(2, 0);
+ joinColumns = xmlJoinTable.specifiedInverseJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ joinTableResource.getInverseJoinColumns().move(0, 1);
+ joinColumns = xmlJoinTable.specifiedInverseJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ joinTableResource.getInverseJoinColumns().remove(1);
+ joinColumns = xmlJoinTable.specifiedInverseJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ joinTableResource.getInverseJoinColumns().remove(1);
+ joinColumns = xmlJoinTable.specifiedInverseJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ joinTableResource.getInverseJoinColumns().remove(0);
+ assertFalse(xmlJoinTable.specifiedInverseJoinColumns().hasNext());
+ }
+
+ public void testAddSpecifiedInverseJoinColumn() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+
+ XmlJoinColumn joinColumn = xmlJoinTable.addSpecifiedInverseJoinColumn(0);
+ ormResource().save(null);
+ joinColumn.setSpecifiedName("FOO");
+ ormResource().save(null);
+
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ assertEquals("FOO", joinTableResource.getInverseJoinColumns().get(0).getName());
+
+ XmlJoinColumn joinColumn2 = xmlJoinTable.addSpecifiedInverseJoinColumn(0);
+ ormResource().save(null);
+ joinColumn2.setSpecifiedName("BAR");
+ ormResource().save(null);
+
+ assertEquals("BAR", joinTableResource.getInverseJoinColumns().get(0).getName());
+ assertEquals("FOO", joinTableResource.getInverseJoinColumns().get(1).getName());
+
+ XmlJoinColumn joinColumn3 = xmlJoinTable.addSpecifiedInverseJoinColumn(1);
+ ormResource().save(null);
+ joinColumn3.setSpecifiedName("BAZ");
+ ormResource().save(null);
+
+ assertEquals("BAR", joinTableResource.getInverseJoinColumns().get(0).getName());
+ assertEquals("BAZ", joinTableResource.getInverseJoinColumns().get(1).getName());
+ assertEquals("FOO", joinTableResource.getInverseJoinColumns().get(2).getName());
+
+ ListIterator<XmlJoinColumn> joinColumns = xmlJoinTable.specifiedInverseJoinColumns();
+ assertEquals(joinColumn2, joinColumns.next());
+ assertEquals(joinColumn3, joinColumns.next());
+ assertEquals(joinColumn, joinColumns.next());
+
+ joinColumns = xmlJoinTable.specifiedInverseJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ }
+
+ public void testRemoveSpecifiedInverseJoinColumn() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+
+ xmlJoinTable.addSpecifiedInverseJoinColumn(0).setSpecifiedName("FOO");
+ xmlJoinTable.addSpecifiedInverseJoinColumn(1).setSpecifiedName("BAR");
+ xmlJoinTable.addSpecifiedInverseJoinColumn(2).setSpecifiedName("BAZ");
+
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ assertEquals(3, joinTableResource.getInverseJoinColumns().size());
+
+ xmlJoinTable.removeSpecifiedInverseJoinColumn(0);
+ assertEquals(2, joinTableResource.getInverseJoinColumns().size());
+ assertEquals("BAR", joinTableResource.getInverseJoinColumns().get(0).getName());
+ assertEquals("BAZ", joinTableResource.getInverseJoinColumns().get(1).getName());
+
+ xmlJoinTable.removeSpecifiedInverseJoinColumn(0);
+ assertEquals(1, joinTableResource.getInverseJoinColumns().size());
+ assertEquals("BAZ", joinTableResource.getInverseJoinColumns().get(0).getName());
+
+ xmlJoinTable.removeSpecifiedInverseJoinColumn(0);
+ assertEquals(0, joinTableResource.getInverseJoinColumns().size());
+ }
+
+ public void testMoveSpecifiedInverseJoinColumn() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+
+ xmlJoinTable.addSpecifiedInverseJoinColumn(0).setSpecifiedName("FOO");
+ xmlJoinTable.addSpecifiedInverseJoinColumn(1).setSpecifiedName("BAR");
+ xmlJoinTable.addSpecifiedInverseJoinColumn(2).setSpecifiedName("BAZ");
+
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+ assertEquals(3, joinTableResource.getInverseJoinColumns().size());
+
+
+ xmlJoinTable.moveSpecifiedInverseJoinColumn(2, 0);
+ ListIterator<XmlJoinColumn> joinColumns = xmlJoinTable.specifiedInverseJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+
+ assertEquals("BAR", joinTableResource.getInverseJoinColumns().get(0).getName());
+ assertEquals("BAZ", joinTableResource.getInverseJoinColumns().get(1).getName());
+ assertEquals("FOO", joinTableResource.getInverseJoinColumns().get(2).getName());
+
+
+ xmlJoinTable.moveSpecifiedInverseJoinColumn(0, 1);
+ joinColumns = xmlJoinTable.specifiedInverseJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+
+ assertEquals("BAZ", joinTableResource.getInverseJoinColumns().get(0).getName());
+ assertEquals("BAR", joinTableResource.getInverseJoinColumns().get(1).getName());
+ assertEquals("FOO", joinTableResource.getInverseJoinColumns().get(2).getName());
+ }
+
+ public void testUpdateJoinColumns() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable();
+ manyToMany.setJoinTable(OrmFactory.eINSTANCE.createJoinTableImpl());
+ JoinTable joinTableResource = manyToMany.getJoinTable();
+
+ joinTableResource.getJoinColumns().add(OrmFactory.eINSTANCE.createJoinColumnImpl());
+ joinTableResource.getJoinColumns().add(OrmFactory.eINSTANCE.createJoinColumnImpl());
+ joinTableResource.getJoinColumns().add(OrmFactory.eINSTANCE.createJoinColumnImpl());
+
+ joinTableResource.getJoinColumns().get(0).setName("FOO");
+ joinTableResource.getJoinColumns().get(1).setName("BAR");
+ joinTableResource.getJoinColumns().get(2).setName("BAZ");
+
+ ListIterator<XmlJoinColumn> joinColumns = xmlJoinTable.specifiedJoinColumns();
+ assertEquals("FOO", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ joinTableResource.getJoinColumns().move(2, 0);
+ joinColumns = xmlJoinTable.specifiedJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ joinTableResource.getJoinColumns().move(0, 1);
+ joinColumns = xmlJoinTable.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ joinTableResource.getJoinColumns().remove(1);
+ joinColumns = xmlJoinTable.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ joinTableResource.getJoinColumns().remove(1);
+ joinColumns = xmlJoinTable.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertFalse(joinColumns.hasNext());
+
+ joinTableResource.getJoinColumns().remove(0);
+ assertFalse(xmlJoinTable.specifiedJoinColumns().hasNext());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlManyToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlManyToManyMappingTests.java
new file mode 100644
index 0000000000..5fd5d44bc5
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlManyToManyMappingTests.java
@@ -0,0 +1,349 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.orm.XmlManyToManyMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToMany;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class XmlManyToManyMappingTests extends ContextModelTestCase
+{
+ public XmlManyToManyMappingTests(String name) {
+ super(name);
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ public void testUpdateName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ assertEquals("manyToManyMapping", xmlManyToManyMapping.getName());
+ assertEquals("manyToManyMapping", manyToMany.getName());
+
+ //set name in the resource model, verify context model updated
+ manyToMany.setName("newName");
+ assertEquals("newName", xmlManyToManyMapping.getName());
+ assertEquals("newName", manyToMany.getName());
+
+ //set name to null in the resource model
+ manyToMany.setName(null);
+ assertNull(xmlManyToManyMapping.getName());
+ assertNull(manyToMany.getName());
+ }
+
+ public void testModifyName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ assertEquals("manyToManyMapping", xmlManyToManyMapping.getName());
+ assertEquals("manyToManyMapping", manyToMany.getName());
+
+ //set name in the context model, verify resource model updated
+ xmlManyToManyMapping.setName("newName");
+ assertEquals("newName", xmlManyToManyMapping.getName());
+ assertEquals("newName", manyToMany.getName());
+
+ //set name to null in the context model
+ xmlManyToManyMapping.setName(null);
+ assertNull(xmlManyToManyMapping.getName());
+ assertNull(manyToMany.getName());
+ }
+
+ public void testUpdateTargetEntity() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ assertNull(xmlManyToManyMapping.getSpecifiedTargetEntity());
+ assertNull(manyToMany.getTargetEntity());
+
+ //set target entity in the resource model, verify context model updated
+ manyToMany.setTargetEntity("newTargetEntity");
+ assertEquals("newTargetEntity", xmlManyToManyMapping.getSpecifiedTargetEntity());
+ assertEquals("newTargetEntity", manyToMany.getTargetEntity());
+
+ //set target entity to null in the resource model
+ manyToMany.setTargetEntity(null);
+ assertNull(xmlManyToManyMapping.getSpecifiedTargetEntity());
+ assertNull(manyToMany.getTargetEntity());
+ }
+
+ public void testModifyTargetEntity() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ assertNull(xmlManyToManyMapping.getSpecifiedTargetEntity());
+ assertNull(manyToMany.getTargetEntity());
+
+ //set target entity in the context model, verify resource model updated
+ xmlManyToManyMapping.setSpecifiedTargetEntity("newTargetEntity");
+ assertEquals("newTargetEntity", xmlManyToManyMapping.getSpecifiedTargetEntity());
+ assertEquals("newTargetEntity", manyToMany.getTargetEntity());
+
+ //set target entity to null in the context model
+ xmlManyToManyMapping.setSpecifiedTargetEntity(null);
+ assertNull(xmlManyToManyMapping.getSpecifiedTargetEntity());
+ assertNull(manyToMany.getTargetEntity());
+ }
+
+ public void testUpdateSpecifiedFetch() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToManyResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ assertNull(xmlManyToManyMapping.getSpecifiedFetch());
+ assertNull(manyToManyResource.getFetch());
+
+ //set fetch in the resource model, verify context model updated
+ manyToManyResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER);
+ assertEquals(FetchType.EAGER, xmlManyToManyMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, manyToManyResource.getFetch());
+
+ manyToManyResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY);
+ assertEquals(FetchType.LAZY, xmlManyToManyMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, manyToManyResource.getFetch());
+
+ //set fetch to null in the resource model
+ manyToManyResource.setFetch(null);
+ assertNull(xmlManyToManyMapping.getSpecifiedFetch());
+ assertNull(manyToManyResource.getFetch());
+ }
+
+ public void testModifySpecifiedFetch() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToManyResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ assertNull(xmlManyToManyMapping.getSpecifiedFetch());
+ assertNull(manyToManyResource.getFetch());
+
+ //set fetch in the context model, verify resource model updated
+ xmlManyToManyMapping.setSpecifiedFetch(FetchType.EAGER);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, manyToManyResource.getFetch());
+ assertEquals(FetchType.EAGER, xmlManyToManyMapping.getSpecifiedFetch());
+
+ xmlManyToManyMapping.setSpecifiedFetch(FetchType.LAZY);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, manyToManyResource.getFetch());
+ assertEquals(FetchType.LAZY, xmlManyToManyMapping.getSpecifiedFetch());
+
+ //set fetch to null in the context model
+ xmlManyToManyMapping.setSpecifiedFetch(null);
+ assertNull(manyToManyResource.getFetch());
+ assertNull(xmlManyToManyMapping.getSpecifiedFetch());
+ }
+
+ public void testUpdateMappedBy() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ assertNull(xmlManyToManyMapping.getMappedBy());
+ assertNull(manyToMany.getMappedBy());
+
+ //set mappedBy in the resource model, verify context model updated
+ manyToMany.setMappedBy("newMappedBy");
+ assertEquals("newMappedBy", xmlManyToManyMapping.getMappedBy());
+ assertEquals("newMappedBy", manyToMany.getMappedBy());
+
+ //setmappedBy to null in the resource model
+ manyToMany.setMappedBy(null);
+ assertNull(xmlManyToManyMapping.getMappedBy());
+ assertNull(manyToMany.getMappedBy());
+ }
+
+ public void testModifyMappedBy() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ assertNull(xmlManyToManyMapping.getMappedBy());
+ assertNull(manyToMany.getMappedBy());
+
+ //set mappedBy in the context model, verify resource model updated
+ xmlManyToManyMapping.setMappedBy("newMappedBy");
+ assertEquals("newMappedBy", xmlManyToManyMapping.getMappedBy());
+ assertEquals("newMappedBy", manyToMany.getMappedBy());
+
+ //set mappedBy to null in the context model
+ xmlManyToManyMapping.setMappedBy(null);
+ assertNull(xmlManyToManyMapping.getMappedBy());
+ assertNull(manyToMany.getMappedBy());
+ }
+
+ public void testUpdateMapKey() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ assertNull(xmlManyToManyMapping.getMapKey());
+ assertNull(manyToMany.getMapKey());
+
+ //set mapKey in the resource model, verify context model does not change
+ manyToMany.setMapKey(OrmFactory.eINSTANCE.createMapKeyImpl());
+ assertNull(xmlManyToManyMapping.getMapKey());
+ assertNotNull(manyToMany.getMapKey());
+
+ //set mapKey name in the resource model, verify context model updated
+ manyToMany.getMapKey().setName("myMapKey");
+ assertEquals("myMapKey", xmlManyToManyMapping.getMapKey());
+ assertEquals("myMapKey", manyToMany.getMapKey().getName());
+
+ //set mapKey name to null in the resource model
+ manyToMany.getMapKey().setName(null);
+ assertNull(xmlManyToManyMapping.getMapKey());
+ assertNull(manyToMany.getMapKey().getName());
+
+ manyToMany.getMapKey().setName("myMapKey");
+ manyToMany.setMapKey(null);
+ assertNull(xmlManyToManyMapping.getMapKey());
+ assertNull(manyToMany.getMapKey());
+ }
+
+ public void testModifyMapKey() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ assertNull(xmlManyToManyMapping.getMapKey());
+ assertNull(manyToMany.getMapKey());
+
+ //set mapKey in the context model, verify resource model updated
+ xmlManyToManyMapping.setMapKey("myMapKey");
+ assertEquals("myMapKey", xmlManyToManyMapping.getMapKey());
+ assertEquals("myMapKey", manyToMany.getMapKey().getName());
+
+ //set mapKey to null in the context model
+ xmlManyToManyMapping.setMapKey(null);
+ assertNull(xmlManyToManyMapping.getMapKey());
+ assertNull(manyToMany.getMapKey());
+ }
+
+ public void testUpdateOrderBy() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ assertNull(xmlManyToManyMapping.getOrderBy());
+ assertNull(manyToMany.getOrderBy());
+
+ //set orderBy in the resource model, verify context model updated
+ manyToMany.setOrderBy("newOrderBy");
+ assertEquals("newOrderBy", xmlManyToManyMapping.getOrderBy());
+ assertEquals("newOrderBy", manyToMany.getOrderBy());
+
+ //set orderBy to null in the resource model
+ manyToMany.setOrderBy(null);
+ assertNull(xmlManyToManyMapping.getOrderBy());
+ assertNull(manyToMany.getOrderBy());
+ }
+
+ public void testModifyOrderBy() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+ ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
+
+ assertNull(xmlManyToManyMapping.getOrderBy());
+ assertNull(manyToMany.getOrderBy());
+
+ //set mappedBy in the context model, verify resource model updated
+ xmlManyToManyMapping.setOrderBy("newOrderBy");
+ assertEquals("newOrderBy", xmlManyToManyMapping.getOrderBy());
+ assertEquals("newOrderBy", manyToMany.getOrderBy());
+
+ //set mappedBy to null in the context model
+ xmlManyToManyMapping.setOrderBy(null);
+ assertNull(xmlManyToManyMapping.getOrderBy());
+ assertNull(manyToMany.getOrderBy());
+ }
+
+ public void testIsNoOrdering() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+
+ assertTrue(xmlManyToManyMapping.isNoOrdering());
+
+ xmlManyToManyMapping.setOrderBy("foo");
+ assertFalse(xmlManyToManyMapping.isNoOrdering());
+
+ xmlManyToManyMapping.setOrderBy(null);
+ assertTrue(xmlManyToManyMapping.isNoOrdering());
+ }
+
+ public void testSetNoOrdering() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+
+ assertTrue(xmlManyToManyMapping.isNoOrdering());
+
+ xmlManyToManyMapping.setOrderBy("foo");
+ assertFalse(xmlManyToManyMapping.isNoOrdering());
+
+ xmlManyToManyMapping.setNoOrdering();
+ assertTrue(xmlManyToManyMapping.isNoOrdering());
+ assertNull(xmlManyToManyMapping.getOrderBy());
+ }
+//TODO
+// public boolean isOrderByPk() {
+// return "".equals(getOrderBy());
+// }
+//
+// public void setOrderByPk() {
+// setOrderBy("");
+// }
+
+ public void testIsCustomOrdering() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping();
+
+ assertFalse(xmlManyToManyMapping.isCustomOrdering());
+
+ xmlManyToManyMapping.setOrderBy("foo");
+ assertTrue(xmlManyToManyMapping.isCustomOrdering());
+
+ xmlManyToManyMapping.setOrderBy(null);
+ assertFalse(xmlManyToManyMapping.isCustomOrdering());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlManyToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlManyToOneMappingTests.java
new file mode 100644
index 0000000000..bbb80b4be1
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlManyToOneMappingTests.java
@@ -0,0 +1,571 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.orm.XmlCascade;
+import org.eclipse.jpt.core.internal.context.orm.XmlJoinColumn;
+import org.eclipse.jpt.core.internal.context.orm.XmlManyToOneMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToOne;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.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.iterators.ArrayIterator;
+
+public class XmlManyToOneMappingTests extends ContextModelTestCase
+{
+ public XmlManyToOneMappingTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createManyToOneAnnotation() throws Exception{
+ this.createAnnotationAndMembers("ManyToOne",
+ "Class targetEntity() default void.class;" +
+ "CascadeType[] cascade() default {};" +
+ "FetchType fetch() default EAGER;" +
+ "boolean optional() default true;");
+ }
+
+ private void createJoinColumnAnnotation() throws Exception{
+ this.createAnnotationAndMembers("JoinColumn",
+ "String name() default \"\";" +
+ "String referencedColumnName() default \"\";" +
+ "boolean unique() default false;" +
+ "boolean nullable() default true;" +
+ "boolean insertable() default true;" +
+ "boolean updatable() default true;" +
+ "String columnDefinition() default \"\";" +
+ "String table() default \"\";");
+ }
+
+ private IType createTestEntityManyToOneMapping() throws Exception {
+ createEntityAnnotation();
+ createManyToOneAnnotation();
+ createJoinColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.MANY_TO_ONE, JPA.JOIN_COLUMN, JPA.FETCH_TYPE, JPA.CASCADE_TYPE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @ManyToOne(fetch=FetchType.LAZY, optional=false, targetEntity=Address.class, cascade={CascadeType.ALL, CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE, CascadeType.REFRESH})");
+ sb.append(CR);
+ sb.append(" @JoinColumn(name=\"MY_COLUMN\", referencedColumnName=\"MY_REFERENCED_COLUMN\", unique=true, nullable=false, insertable=false, updatable=false, columnDefinition=\"COLUMN_DEFINITION\", table=\"MY_TABLE\")");
+ sb.append(CR);
+ sb.append(" private Address address;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id");
+ }
+ });
+ }
+
+ private IType createTestTargetEntityAddress() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ID);
+ sb.append(";");
+ sb.append(CR);
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("Address").append(" ");
+ sb.append("{").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ sb.append(" private int id;").append(CR);
+ sb.append(CR);
+ sb.append(" private String city;").append(CR);
+ sb.append(CR);
+ sb.append(" private String state;").append(CR);
+ sb.append(CR);
+ sb.append(" private int zip;").append(CR);
+ sb.append(CR);
+ sb.append("}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "Address.java", sourceWriter);
+ }
+
+ public void testUpdateName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping();
+ ManyToOne manyToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
+
+ assertEquals("manyToOneMapping", xmlManyToOneMapping.getName());
+ assertEquals("manyToOneMapping", manyToOne.getName());
+
+ //set name in the resource model, verify context model updated
+ manyToOne.setName("newName");
+ assertEquals("newName", xmlManyToOneMapping.getName());
+ assertEquals("newName", manyToOne.getName());
+
+ //set name to null in the resource model
+ manyToOne.setName(null);
+ assertNull(xmlManyToOneMapping.getName());
+ assertNull(manyToOne.getName());
+ }
+
+ public void testModifyName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping();
+ ManyToOne manyToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
+
+ assertEquals("manyToOneMapping", xmlManyToOneMapping.getName());
+ assertEquals("manyToOneMapping", manyToOne.getName());
+
+ //set name in the context model, verify resource model updated
+ xmlManyToOneMapping.setName("newName");
+ assertEquals("newName", xmlManyToOneMapping.getName());
+ assertEquals("newName", manyToOne.getName());
+
+ //set name to null in the context model
+ xmlManyToOneMapping.setName(null);
+ assertNull(xmlManyToOneMapping.getName());
+ assertNull(manyToOne.getName());
+ }
+
+ public void testUpdateTargetEntity() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping();
+ ManyToOne manyToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
+
+ assertNull(xmlManyToOneMapping.getSpecifiedTargetEntity());
+ assertNull(manyToOne.getTargetEntity());
+
+ //set target entity in the resource model, verify context model updated
+ manyToOne.setTargetEntity("newTargetEntity");
+ assertEquals("newTargetEntity", xmlManyToOneMapping.getSpecifiedTargetEntity());
+ assertEquals("newTargetEntity", manyToOne.getTargetEntity());
+
+ //set target entity to null in the resource model
+ manyToOne.setTargetEntity(null);
+ assertNull(xmlManyToOneMapping.getSpecifiedTargetEntity());
+ assertNull(manyToOne.getTargetEntity());
+ }
+
+ public void testModifyTargetEntity() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping();
+ ManyToOne manyToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
+
+ assertNull(xmlManyToOneMapping.getSpecifiedTargetEntity());
+ assertNull(manyToOne.getTargetEntity());
+
+ //set target entity in the context model, verify resource model updated
+ xmlManyToOneMapping.setSpecifiedTargetEntity("newTargetEntity");
+ assertEquals("newTargetEntity", xmlManyToOneMapping.getSpecifiedTargetEntity());
+ assertEquals("newTargetEntity", manyToOne.getTargetEntity());
+
+ //set target entity to null in the context model
+ xmlManyToOneMapping.setSpecifiedTargetEntity(null);
+ assertNull(xmlManyToOneMapping.getSpecifiedTargetEntity());
+ assertNull(manyToOne.getTargetEntity());
+ }
+
+ public void testUpdateSpecifiedFetch() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping();
+ ManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
+
+ assertNull(xmlManyToOneMapping.getSpecifiedFetch());
+ assertNull(manyToOneResource.getFetch());
+
+ //set fetch in the resource model, verify context model updated
+ manyToOneResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER);
+ assertEquals(FetchType.EAGER, xmlManyToOneMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, manyToOneResource.getFetch());
+
+ manyToOneResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY);
+ assertEquals(FetchType.LAZY, xmlManyToOneMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, manyToOneResource.getFetch());
+
+ //set fetch to null in the resource model
+ manyToOneResource.setFetch(null);
+ assertNull(xmlManyToOneMapping.getSpecifiedFetch());
+ assertNull(manyToOneResource.getFetch());
+ }
+
+ public void testModifySpecifiedFetch() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping();
+ ManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
+
+ assertNull(xmlManyToOneMapping.getSpecifiedFetch());
+ assertNull(manyToOneResource.getFetch());
+
+ //set fetch in the context model, verify resource model updated
+ xmlManyToOneMapping.setSpecifiedFetch(FetchType.EAGER);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, manyToOneResource.getFetch());
+ assertEquals(FetchType.EAGER, xmlManyToOneMapping.getSpecifiedFetch());
+
+ xmlManyToOneMapping.setSpecifiedFetch(FetchType.LAZY);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, manyToOneResource.getFetch());
+ assertEquals(FetchType.LAZY, xmlManyToOneMapping.getSpecifiedFetch());
+
+ //set fetch to null in the context model
+ xmlManyToOneMapping.setSpecifiedFetch(null);
+ assertNull(manyToOneResource.getFetch());
+ assertNull(xmlManyToOneMapping.getSpecifiedFetch());
+ }
+
+ public void testUpdateSpecifiedOptional() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping();
+ ManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
+
+ assertNull(xmlManyToOneMapping.getSpecifiedOptional());
+ assertNull(manyToOneResource.getOptional());
+
+ //set optional in the resource model, verify context model updated
+ manyToOneResource.setOptional(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, xmlManyToOneMapping.getSpecifiedOptional());
+ assertEquals(Boolean.TRUE, manyToOneResource.getOptional());
+
+ manyToOneResource.setOptional(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlManyToOneMapping.getSpecifiedOptional());
+ assertEquals(Boolean.FALSE, manyToOneResource.getOptional());
+
+ //set optional to null in the resource model
+ manyToOneResource.setOptional(null);
+ assertNull(xmlManyToOneMapping.getSpecifiedOptional());
+ assertNull(manyToOneResource.getOptional());
+ }
+
+ public void testModifySpecifiedOptional() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping();
+ ManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
+
+ assertNull(xmlManyToOneMapping.getSpecifiedOptional());
+ assertNull(manyToOneResource.getOptional());
+
+ //set optional in the context model, verify resource model updated
+ xmlManyToOneMapping.setSpecifiedOptional(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, manyToOneResource.getOptional());
+ assertEquals(Boolean.TRUE, xmlManyToOneMapping.getSpecifiedOptional());
+
+ xmlManyToOneMapping.setSpecifiedOptional(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, manyToOneResource.getOptional());
+ assertEquals(Boolean.FALSE, xmlManyToOneMapping.getSpecifiedOptional());
+
+ //set optional to null in the context model
+ xmlManyToOneMapping.setSpecifiedOptional(null);
+ assertNull(manyToOneResource.getOptional());
+ assertNull(xmlManyToOneMapping.getSpecifiedOptional());
+ }
+
+ public void testAddSpecifiedJoinColumn() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping();
+ ManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
+
+ XmlJoinColumn joinColumn = xmlManyToOneMapping.addSpecifiedJoinColumn(0);
+ ormResource().save(null);
+ joinColumn.setSpecifiedName("FOO");
+ ormResource().save(null);
+
+ assertEquals("FOO", manyToOneResource.getJoinColumns().get(0).getName());
+
+ XmlJoinColumn joinColumn2 = xmlManyToOneMapping.addSpecifiedJoinColumn(0);
+ ormResource().save(null);
+ joinColumn2.setSpecifiedName("BAR");
+ ormResource().save(null);
+
+ assertEquals("BAR", manyToOneResource.getJoinColumns().get(0).getName());
+ assertEquals("FOO", manyToOneResource.getJoinColumns().get(1).getName());
+
+ XmlJoinColumn joinColumn3 = xmlManyToOneMapping.addSpecifiedJoinColumn(1);
+ ormResource().save(null);
+ joinColumn3.setSpecifiedName("BAZ");
+ ormResource().save(null);
+
+ assertEquals("BAR", manyToOneResource.getJoinColumns().get(0).getName());
+ assertEquals("BAZ", manyToOneResource.getJoinColumns().get(1).getName());
+ assertEquals("FOO", manyToOneResource.getJoinColumns().get(2).getName());
+
+ ListIterator<XmlJoinColumn> joinColumns = xmlManyToOneMapping.specifiedJoinColumns();
+ assertEquals(joinColumn2, joinColumns.next());
+ assertEquals(joinColumn3, joinColumns.next());
+ assertEquals(joinColumn, joinColumns.next());
+
+ joinColumns = xmlManyToOneMapping.specifiedJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ }
+
+ public void testRemoveSpecifiedJoinColumn() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping();
+ ManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
+
+ xmlManyToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ xmlManyToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
+ xmlManyToOneMapping.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
+
+ assertEquals(3, manyToOneResource.getJoinColumns().size());
+
+ xmlManyToOneMapping.removeSpecifiedJoinColumn(0);
+ assertEquals(2, manyToOneResource.getJoinColumns().size());
+ assertEquals("BAR", manyToOneResource.getJoinColumns().get(0).getName());
+ assertEquals("BAZ", manyToOneResource.getJoinColumns().get(1).getName());
+
+ xmlManyToOneMapping.removeSpecifiedJoinColumn(0);
+ assertEquals(1, manyToOneResource.getJoinColumns().size());
+ assertEquals("BAZ", manyToOneResource.getJoinColumns().get(0).getName());
+
+ xmlManyToOneMapping.removeSpecifiedJoinColumn(0);
+ assertEquals(0, manyToOneResource.getJoinColumns().size());
+ }
+
+ public void testMoveSpecifiedJoinColumn() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping();
+ ManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
+
+ xmlManyToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ xmlManyToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
+ xmlManyToOneMapping.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
+
+ assertEquals(3, manyToOneResource.getJoinColumns().size());
+
+
+ xmlManyToOneMapping.moveSpecifiedJoinColumn(2, 0);
+ ListIterator<XmlJoinColumn> joinColumns = xmlManyToOneMapping.specifiedJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+
+ assertEquals("BAR", manyToOneResource.getJoinColumns().get(0).getName());
+ assertEquals("BAZ", manyToOneResource.getJoinColumns().get(1).getName());
+ assertEquals("FOO", manyToOneResource.getJoinColumns().get(2).getName());
+
+
+ xmlManyToOneMapping.moveSpecifiedJoinColumn(0, 1);
+ joinColumns = xmlManyToOneMapping.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+
+ assertEquals("BAZ", manyToOneResource.getJoinColumns().get(0).getName());
+ assertEquals("BAR", manyToOneResource.getJoinColumns().get(1).getName());
+ assertEquals("FOO", manyToOneResource.getJoinColumns().get(2).getName());
+ }
+
+
+ public void testManyToOneMappingNoUnderylingJavaAttribute() throws Exception {
+ createTestEntityManyToOneMapping();
+ createTestTargetEntityAddress();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
+ xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "foo");
+ assertEquals(3, xmlPersistentType.virtualAttributesSize());
+
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next();
+ XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping();
+
+ assertEquals("foo", xmlManyToOneMapping.getName());
+
+ assertNull(xmlManyToOneMapping.getSpecifiedFetch());
+ assertNull(xmlManyToOneMapping.getSpecifiedOptional());
+ assertNull(xmlManyToOneMapping.getSpecifiedTargetEntity());
+ assertEquals(FetchType.EAGER, xmlManyToOneMapping.getFetch());
+ assertEquals(Boolean.TRUE, xmlManyToOneMapping.getOptional());
+ assertNull(xmlManyToOneMapping.getTargetEntity());
+
+
+ assertFalse(xmlManyToOneMapping.specifiedJoinColumns().hasNext());
+ //TODO default joinColumns
+ //assertTrue(xmlManyToOneMapping.defaultJoinColumns().hasNext());
+
+
+ XmlCascade xmlCascade = xmlManyToOneMapping.getCascade();
+ assertFalse(xmlCascade.isAll());
+ assertFalse(xmlCascade.isMerge());
+ assertFalse(xmlCascade.isPersist());
+ assertFalse(xmlCascade.isRemove());
+ assertFalse(xmlCascade.isRefresh());
+ }
+
+ public void testVirtualMappingMetadataCompleteFalse() throws Exception {
+ createTestEntityManyToOneMapping();
+ createTestTargetEntityAddress();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
+ assertEquals(3, xmlPersistentType.virtualAttributesSize());
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next();
+
+ XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping();
+ assertEquals("address", xmlManyToOneMapping.getName());
+ assertEquals(FetchType.LAZY, xmlManyToOneMapping.getSpecifiedFetch());
+ assertEquals(Boolean.FALSE, xmlManyToOneMapping.getSpecifiedOptional());
+ assertEquals("Address", xmlManyToOneMapping.getSpecifiedTargetEntity());
+
+ XmlJoinColumn xmlJoinColumn = xmlManyToOneMapping.specifiedJoinColumns().next();
+ assertEquals("MY_COLUMN", xmlJoinColumn.getSpecifiedName());
+ assertEquals("MY_REFERENCED_COLUMN", xmlJoinColumn.getSpecifiedReferencedColumnName());
+ assertEquals(Boolean.TRUE, xmlJoinColumn.getSpecifiedUnique());
+ assertEquals(Boolean.FALSE, xmlJoinColumn.getSpecifiedNullable());
+ assertEquals(Boolean.FALSE, xmlJoinColumn.getSpecifiedInsertable());
+ assertEquals(Boolean.FALSE, xmlJoinColumn.getSpecifiedUpdatable());
+ assertEquals("COLUMN_DEFINITION", xmlJoinColumn.getColumnDefinition());
+ assertEquals("MY_TABLE", xmlJoinColumn.getSpecifiedTable());
+
+ XmlCascade xmlCascade = xmlManyToOneMapping.getCascade();
+ assertTrue(xmlCascade.isAll());
+ assertTrue(xmlCascade.isMerge());
+ assertTrue(xmlCascade.isPersist());
+ assertTrue(xmlCascade.isRemove());
+ assertTrue(xmlCascade.isRefresh());
+ }
+
+ public void testVirtualMappingMetadataCompleteTrue() throws Exception {
+ createTestEntityManyToOneMapping();
+ createTestTargetEntityAddress();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
+ xmlPersistentType.getMapping().setSpecifiedMetadataComplete(true);
+ assertEquals(3, xmlPersistentType.virtualAttributesSize());
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next();
+
+ XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping();
+ assertEquals("address", xmlManyToOneMapping.getName());
+ assertEquals(FetchType.EAGER, xmlManyToOneMapping.getSpecifiedFetch());
+ assertEquals(Boolean.TRUE, xmlManyToOneMapping.getSpecifiedOptional());
+ //TODO hmm, is this correct?
+ assertEquals("test.Address", xmlManyToOneMapping.getSpecifiedTargetEntity());
+
+ XmlJoinColumn xmlJoinColumn = xmlManyToOneMapping.specifiedJoinColumns().next();
+ //TODO java default columns name in JavaSingleRelationshipMapping.JoinColumnOwner
+ //assertEquals("address", xmlJoinColumn.getSpecifiedName());
+ //assertEquals("address", xmlJoinColumn.getSpecifiedReferencedColumnName());
+ assertEquals(Boolean.FALSE, xmlJoinColumn.getSpecifiedUnique());
+ assertEquals(Boolean.TRUE, xmlJoinColumn.getSpecifiedNullable());
+ assertEquals(Boolean.TRUE, xmlJoinColumn.getSpecifiedInsertable());
+ assertEquals(Boolean.TRUE, xmlJoinColumn.getSpecifiedUpdatable());
+ assertNull(xmlJoinColumn.getColumnDefinition());
+ assertEquals(TYPE_NAME, xmlJoinColumn.getSpecifiedTable());
+
+ XmlCascade xmlCascade = xmlManyToOneMapping.getCascade();
+ assertFalse(xmlCascade.isAll());
+ assertFalse(xmlCascade.isMerge());
+ assertFalse(xmlCascade.isPersist());
+ assertFalse(xmlCascade.isRemove());
+ assertFalse(xmlCascade.isRefresh());
+ }
+
+ public void testSpecifiedMapping() throws Exception {
+ createTestEntityManyToOneMapping();
+ createTestTargetEntityAddress();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
+
+ xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "address");
+ assertEquals(2, xmlPersistentType.virtualAttributesSize());
+
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next();
+ XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping();
+
+ assertEquals("address", xmlManyToOneMapping.getName());
+ assertNull(xmlManyToOneMapping.getSpecifiedFetch());
+ assertNull(xmlManyToOneMapping.getSpecifiedOptional());
+ assertNull(xmlManyToOneMapping.getSpecifiedTargetEntity());
+ assertEquals(FetchType.EAGER, xmlManyToOneMapping.getFetch());
+ assertEquals(Boolean.TRUE, xmlManyToOneMapping.getOptional());
+ //TODO default target entity in xml
+ //assertEquals("test.Address", xmlManyToOneMapping.getDefaultTargetEntity());
+
+ assertFalse(xmlManyToOneMapping.specifiedJoinColumns().hasNext());
+
+ //TODO default join columns for specified xmlManyToOne mapping
+// XmlJoinColumn xmlJoinColumn = xmlManyToOneMapping.defaultJoinColumns().next();
+// assertNull(xmlJoinColumn.getSpecifiedName());
+// assertNull(xmlJoinColumn.getSpecifiedReferencedColumnName());
+// assertNull(xmlJoinColumn.getSpecifiedUnique());
+// assertNull(xmlJoinColumn.getSpecifiedNullable());
+// assertNull(xmlJoinColumn.getSpecifiedInsertable());
+// assertNull(xmlJoinColumn.getSpecifiedUpdatable());
+// assertNull(xmlJoinColumn.getColumnDefinition());
+// assertNull(xmlJoinColumn.getSpecifiedTable());
+//
+// assertEquals("address", xmlJoinColumn.getDefaultName());
+// assertEquals("address", xmlJoinColumn.getDefaultReferencedColumnName());
+// assertEquals(Boolean.FALSE, xmlJoinColumn.getDefaultUnique());
+// assertEquals(Boolean.TRUE, xmlJoinColumn.getDefaultNullable());
+// assertEquals(Boolean.TRUE, xmlJoinColumn.getDefaultInsertable());
+// assertEquals(Boolean.TRUE, xmlJoinColumn.getDefaultUpdatable());
+// assertEquals(null, xmlJoinColumn.getColumnDefinition());
+// assertEquals(TYPE_NAME, xmlJoinColumn.getDefaultTable());
+
+ XmlCascade xmlCascade = xmlManyToOneMapping.getCascade();
+ assertFalse(xmlCascade.isAll());
+ assertFalse(xmlCascade.isMerge());
+ assertFalse(xmlCascade.isPersist());
+ assertFalse(xmlCascade.isRemove());
+ assertFalse(xmlCascade.isRefresh());
+ }
+
+ //3 things tested above
+ //1. virtual mapping metadata complete=false - defaults are taken from the java annotations
+ //2. virtual mapping metadata complete=true - defaults are taken from java defaults,annotations ignored
+ //3. specified mapping (metadata complete=true/false - defaults are taken from java annotations
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlMappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlMappedSuperclassTests.java
new file mode 100644
index 0000000000..66d5b69558
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlMappedSuperclassTests.java
@@ -0,0 +1,356 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.orm.XmlEmbeddable;
+import org.eclipse.jpt.core.internal.context.orm.XmlEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlMappedSuperclass;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.orm.Embeddable;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class XmlMappedSuperclassTests extends ContextModelTestCase
+{
+ public XmlMappedSuperclassTests(String name) {
+ super(name);
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ public void testUpdateClass() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
+ XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping();
+ MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0);
+ assertEquals("model.Foo", xmlMappedSuperclass.getClass_());
+ assertEquals("model.Foo", mappedSuperclassResource.getClassName());
+
+ //set class in the resource model, verify context model updated
+ mappedSuperclassResource.setClassName("com.Bar");
+ ormResource().save(null);
+ assertEquals("com.Bar", xmlMappedSuperclass.getClass_());
+ assertEquals("com.Bar", mappedSuperclassResource.getClassName());
+
+ //set class to null in the resource model
+ mappedSuperclassResource.setClassName(null);
+ assertNull(xmlMappedSuperclass.getClass_());
+ assertNull(mappedSuperclassResource.getClassName());
+ }
+
+ public void testModifyClass() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
+ XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping();
+ MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0);
+ assertEquals("model.Foo", xmlMappedSuperclass.getClass_());
+ assertEquals("model.Foo", mappedSuperclassResource.getClassName());
+
+ //set class in the context model, verify resource model modified
+ xmlMappedSuperclass.setClass("com.Bar");
+ assertEquals("com.Bar", xmlMappedSuperclass.getClass_());
+ assertEquals("com.Bar", mappedSuperclassResource.getClassName());
+
+ //set class to null in the context model
+ xmlMappedSuperclass.setClass(null);
+ assertNull(xmlMappedSuperclass.getClass_());
+ assertNull(mappedSuperclassResource.getClassName());
+ }
+ //TODO add tests for setting the className when the package is set on entity-mappings
+
+ public void testUpdateSpecifiedAccess() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
+ XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping();
+ MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0);
+ assertNull(xmlMappedSuperclass.getSpecifiedAccess());
+ assertNull(mappedSuperclassResource.getAccess());
+
+ //set access in the resource model, verify context model updated
+ mappedSuperclassResource.setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD);
+ assertEquals(AccessType.FIELD, xmlMappedSuperclass.getSpecifiedAccess());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD, mappedSuperclassResource.getAccess());
+
+ //set access to null in the resource model
+ mappedSuperclassResource.setAccess(null);
+ assertNull(xmlMappedSuperclass.getSpecifiedAccess());
+ assertNull(mappedSuperclassResource.getAccess());
+ }
+
+ public void testModifySpecifiedAccess() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
+ XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping();
+ MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0);
+ assertNull(xmlMappedSuperclass.getSpecifiedAccess());
+ assertNull(mappedSuperclassResource.getAccess());
+
+ //set access in the context model, verify resource model modified
+ xmlMappedSuperclass.setSpecifiedAccess(AccessType.PROPERTY);
+ assertEquals(AccessType.PROPERTY, xmlMappedSuperclass.getSpecifiedAccess());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, mappedSuperclassResource.getAccess());
+
+ //set access to null in the context model
+ xmlMappedSuperclass.setSpecifiedAccess(null);
+ assertNull(xmlMappedSuperclass.getSpecifiedAccess());
+ assertNull(mappedSuperclassResource.getAccess());
+ }
+ //TODO test default access from
+ //underlying java
+ //persistence-unit-defaults
+ //entity-mappings
+ //with xml-mapping-metadata-complete set
+
+ public void testUpdateSpecifiedMetadataComplete() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
+ XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping();
+ MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0);
+ assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertNull(mappedSuperclassResource.getMetadataComplete());
+
+ //set metadata-complete in the resource model, verify context model updated
+ mappedSuperclassResource.setMetadataComplete(true);
+ assertTrue(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertTrue(mappedSuperclassResource.getMetadataComplete());
+
+ //set access to false in the resource model
+ mappedSuperclassResource.setMetadataComplete(false);
+ assertFalse(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertFalse(mappedSuperclassResource.getMetadataComplete());
+
+ mappedSuperclassResource.setMetadataComplete(null);
+ assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertNull(mappedSuperclassResource.getMetadataComplete());
+ }
+
+ public void testModifySpecifiedMetadataComplete() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
+ XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping();
+ MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertNull(mappedSuperclassResource.getMetadataComplete());
+
+ //set access in the context model, verify resource model modified
+ xmlMappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
+ assertTrue(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertTrue(mappedSuperclassResource.getMetadataComplete());
+
+ //set access to null in the context model
+ xmlMappedSuperclass.setSpecifiedMetadataComplete(Boolean.FALSE);
+ assertFalse(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertFalse(mappedSuperclassResource.getMetadataComplete());
+
+ xmlMappedSuperclass.setSpecifiedMetadataComplete(null);
+ assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertNull(mappedSuperclassResource.getMetadataComplete());
+ }
+
+ public void testUpdateDefaultMetadataComplete() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
+ XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping();
+ MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0);
+ assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertFalse(xmlMappedSuperclass.isDefaultMetadataComplete());
+ assertNull(mappedSuperclassResource.getMetadataComplete());
+
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ assertTrue(xmlMappedSuperclass.isDefaultMetadataComplete());
+ assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertNull(mappedSuperclassResource.getMetadataComplete());
+
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+ assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertFalse(xmlMappedSuperclass.isDefaultMetadataComplete());
+ assertNull(mappedSuperclassResource.getMetadataComplete());
+ }
+
+ public void testUpdateMetadataComplete() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
+ XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping();
+ MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0);
+ assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertFalse(xmlMappedSuperclass.isMetadataComplete());
+ assertNull(mappedSuperclassResource.getMetadataComplete());
+
+ ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata());
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ assertTrue(xmlMappedSuperclass.isMetadataComplete());
+ assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertNull(mappedSuperclassResource.getMetadataComplete());
+
+ ormResource().getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+ assertFalse(xmlMappedSuperclass.isMetadataComplete());
+ assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+ assertNull(mappedSuperclassResource.getMetadataComplete());
+ }
+
+
+ public void testMakeMappedSuperclassEntity() throws Exception {
+ XmlPersistentType mappedSuperclassPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
+ XmlMappedSuperclass mappedSuperclass = (XmlMappedSuperclass) mappedSuperclassPersistentType.getMapping();
+ mappedSuperclass.setSpecifiedAccess(AccessType.PROPERTY);
+ mappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
+ ormResource().save(null);
+
+ mappedSuperclassPersistentType.setMappingKey(IMappingKeys.ENTITY_TYPE_MAPPING_KEY);
+ ormResource().save(null);
+
+ Entity entity = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals("model.Foo", entity.getClassName());
+ assertEquals(Boolean.TRUE, entity.getMetadataComplete());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, entity.getAccess());
+ assertNull(entity.getDiscriminatorValue());
+ assertNull(entity.getName());
+
+ XmlEntity xmlEntity = (XmlEntity) mappedSuperclassPersistentType.getMapping();
+ assertEquals("model.Foo", xmlEntity.getClass_());
+ assertEquals(Boolean.TRUE, xmlEntity.getSpecifiedMetadataComplete());
+ assertEquals(AccessType.PROPERTY, xmlEntity.getSpecifiedAccess());
+ }
+
+ //test with 2 MappedSuperclasses, make the first one an Entity so it has to move to the end of the list
+ public void testMakeMappedSuperclassEntity2() throws Exception {
+ XmlPersistentType mappedSuperclassPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
+ entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo2");
+ XmlMappedSuperclass mappedSuperclass = (XmlMappedSuperclass) mappedSuperclassPersistentType.getMapping();
+ mappedSuperclass.setSpecifiedAccess(AccessType.PROPERTY);
+ mappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
+ ormResource().save(null);
+
+ mappedSuperclassPersistentType.setMappingKey(IMappingKeys.ENTITY_TYPE_MAPPING_KEY);
+ ormResource().save(null);
+
+ Entity entity = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals("model.Foo", entity.getClassName());
+ assertEquals(Boolean.TRUE, entity.getMetadataComplete());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, entity.getAccess());
+ assertNull(entity.getDiscriminatorValue());
+ assertNull(entity.getName());
+
+ XmlEntity xmlEntity = (XmlEntity) mappedSuperclassPersistentType.getMapping();
+ assertEquals("model.Foo", xmlEntity.getClass_());
+ assertEquals(Boolean.TRUE, xmlEntity.getSpecifiedMetadataComplete());
+ assertEquals(AccessType.PROPERTY, xmlEntity.getSpecifiedAccess());
+
+ ListIterator<XmlPersistentType> persistentTypes = entityMappings().xmlPersistentTypes();
+ assertEquals(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey());
+ assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey());
+ }
+
+ public void testMakeMappedSuperclassEmbeddable() throws Exception {
+ XmlPersistentType mappedSuperclassPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
+ XmlMappedSuperclass mappedSuperclass = (XmlMappedSuperclass) mappedSuperclassPersistentType.getMapping();
+ mappedSuperclass.setSpecifiedAccess(AccessType.PROPERTY);
+ mappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
+ ormResource().save(null);
+
+ mappedSuperclassPersistentType.setMappingKey(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
+ ormResource().save(null);
+
+ Embeddable embeddable = ormResource().getEntityMappings().getEmbeddables().get(0);
+ assertEquals("model.Foo", embeddable.getClassName());
+ assertEquals(Boolean.TRUE, embeddable.getMetadataComplete());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, embeddable.getAccess());
+
+ XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) mappedSuperclassPersistentType.getMapping();
+ assertEquals("model.Foo", xmlEmbeddable.getClass_());
+ assertEquals(Boolean.TRUE, xmlEmbeddable.getSpecifiedMetadataComplete());
+ assertEquals(AccessType.PROPERTY, xmlEmbeddable.getSpecifiedAccess());
+ }
+ //test with 2 MappedSuperclasses, make the first one an Embeddable so it has to move to the end of the list
+ public void testMakeMappedSuperclassEmbeddable2() throws Exception {
+ XmlPersistentType mappedSuperclassPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
+ entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo2");
+ XmlMappedSuperclass mappedSuperclass = (XmlMappedSuperclass) mappedSuperclassPersistentType.getMapping();
+ mappedSuperclass.setSpecifiedAccess(AccessType.PROPERTY);
+ mappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE);
+ ormResource().save(null);
+
+ mappedSuperclassPersistentType.setMappingKey(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
+ ormResource().save(null);
+
+ Embeddable embeddable = ormResource().getEntityMappings().getEmbeddables().get(0);
+ assertEquals("model.Foo", embeddable.getClassName());
+ assertEquals(Boolean.TRUE, embeddable.getMetadataComplete());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, embeddable.getAccess());
+
+ XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) mappedSuperclassPersistentType.getMapping();
+ assertEquals("model.Foo", xmlEmbeddable.getClass_());
+ assertEquals(Boolean.TRUE, xmlEmbeddable.getSpecifiedMetadataComplete());
+ assertEquals(AccessType.PROPERTY, xmlEmbeddable.getSpecifiedAccess());
+
+ ListIterator<XmlPersistentType> persistentTypes = entityMappings().xmlPersistentTypes();
+ assertEquals(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey());
+ assertEquals(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey());
+ }
+
+ public void testUpdateIdClass() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
+ XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping();
+ MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+
+ assertNull(xmlMappedSuperclass.getIdClass());
+ assertNull(mappedSuperclassResource.getIdClass());
+
+ mappedSuperclassResource.setIdClass(OrmFactory.eINSTANCE.createIdClass());
+
+ assertNull(xmlMappedSuperclass.getIdClass());
+ assertNotNull(mappedSuperclassResource.getIdClass());
+
+ mappedSuperclassResource.getIdClass().setClassName("model.Foo");
+ assertEquals("model.Foo", xmlMappedSuperclass.getIdClass());
+ assertEquals("model.Foo", mappedSuperclassResource.getIdClass().getClassName());
+
+ //test setting @IdClass value to null, id-class tag is not removed
+ mappedSuperclassResource.getIdClass().setClassName(null);
+ assertNull(xmlMappedSuperclass.getIdClass());
+ assertNotNull(mappedSuperclassResource.getIdClass());
+
+ //reset @IdClass value and then remove id-class tag
+ mappedSuperclassResource.setIdClass(OrmFactory.eINSTANCE.createIdClass());
+ mappedSuperclassResource.getIdClass().setClassName("model.Foo");
+ mappedSuperclassResource.setIdClass(null);
+
+ assertNull(xmlMappedSuperclass.getIdClass());
+ assertNull(mappedSuperclassResource.getIdClass());
+ }
+
+ public void testModifyIdClass() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo");
+ XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping();
+ MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete());
+
+ assertNull(xmlMappedSuperclass.getIdClass());
+ assertNull(mappedSuperclassResource.getIdClass());
+
+ xmlMappedSuperclass.setIdClass("model.Foo");
+ assertEquals("model.Foo", mappedSuperclassResource.getIdClass().getClassName());
+ assertEquals("model.Foo", xmlMappedSuperclass.getIdClass());
+
+ xmlMappedSuperclass.setIdClass(null);
+ assertNull(xmlMappedSuperclass.getIdClass());
+ assertNull(mappedSuperclassResource.getIdClass());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlNamedNativeQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlNamedNativeQueryTests.java
new file mode 100644
index 0000000000..7ada19bb4d
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlNamedNativeQueryTests.java
@@ -0,0 +1,358 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.XmlEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlNamedNativeQuery;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.context.orm.XmlQueryHint;
+import org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class XmlNamedNativeQueryTests extends ContextModelTestCase
+{
+ public XmlNamedNativeQueryTests(String name) {
+ super(name);
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ public void testUpdateName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0);
+
+ NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
+
+ assertNull(xmlNamedNativeQuery.getName());
+ assertNull(namedNativeQueryResource.getName());
+
+ //set name in the resource model, verify context model updated
+ namedNativeQueryResource.setName("newName");
+ assertEquals("newName", xmlNamedNativeQuery.getName());
+ assertEquals("newName", namedNativeQueryResource.getName());
+
+ //set name to null in the resource model
+ namedNativeQueryResource.setName(null);
+ assertNull(xmlNamedNativeQuery.getName());
+ assertNull(namedNativeQueryResource.getName());
+ }
+
+ public void testModifyName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0);
+
+ NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
+
+ assertNull(xmlNamedNativeQuery.getName());
+ assertNull(namedNativeQueryResource.getName());
+
+ //set name in the context model, verify resource model updated
+ xmlNamedNativeQuery.setName("newName");
+ assertEquals("newName", xmlNamedNativeQuery.getName());
+ assertEquals("newName", namedNativeQueryResource.getName());
+
+ //set name to null in the context model
+ xmlNamedNativeQuery.setName(null);
+ assertNull(xmlNamedNativeQuery.getName());
+ assertNull(namedNativeQueryResource.getName());
+ }
+
+ public void testUpdateQuery() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0);
+
+ NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
+
+ assertNull(xmlNamedNativeQuery.getQuery());
+ assertNull(namedNativeQueryResource.getQuery());
+
+ //set name in the resource model, verify context model updated
+ namedNativeQueryResource.setQuery("newName");
+ assertEquals("newName", xmlNamedNativeQuery.getQuery());
+ assertEquals("newName", namedNativeQueryResource.getQuery());
+
+ //set name to null in the resource model
+ namedNativeQueryResource.setQuery(null);
+ assertNull(xmlNamedNativeQuery.getQuery());
+ assertNull(namedNativeQueryResource.getQuery());
+ }
+
+ public void testModifyQuery() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0);
+
+ NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
+
+ assertNull(xmlNamedNativeQuery.getQuery());
+ assertNull(namedNativeQueryResource.getQuery());
+
+ //set name in the context model, verify resource model updated
+ xmlNamedNativeQuery.setQuery("newName");
+ assertEquals("newName", xmlNamedNativeQuery.getQuery());
+ assertEquals("newName", namedNativeQueryResource.getQuery());
+
+ //set name to null in the context model
+ xmlNamedNativeQuery.setQuery(null);
+ assertNull(xmlNamedNativeQuery.getQuery());
+ assertNull(namedNativeQueryResource.getQuery());
+ }
+
+ public void testAddHint() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0);
+
+ NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
+
+ XmlQueryHint queryHint = xmlNamedNativeQuery.addHint(0);
+ queryHint.setName("FOO");
+
+ assertEquals("FOO", namedNativeQueryResource.getHints().get(0).getName());
+
+ XmlQueryHint queryHint2 = xmlNamedNativeQuery.addHint(0);
+ queryHint2.setName("BAR");
+
+ assertEquals("BAR", namedNativeQueryResource.getHints().get(0).getName());
+ assertEquals("FOO", namedNativeQueryResource.getHints().get(1).getName());
+
+ XmlQueryHint queryHint3 = xmlNamedNativeQuery.addHint(1);
+ queryHint3.setName("BAZ");
+
+ assertEquals("BAR", namedNativeQueryResource.getHints().get(0).getName());
+ assertEquals("BAZ", namedNativeQueryResource.getHints().get(1).getName());
+ assertEquals("FOO", namedNativeQueryResource.getHints().get(2).getName());
+
+ ListIterator<XmlQueryHint> queryHints = xmlNamedNativeQuery.hints();
+ assertEquals(queryHint2, queryHints.next());
+ assertEquals(queryHint3, queryHints.next());
+ assertEquals(queryHint, queryHints.next());
+
+ queryHints = xmlNamedNativeQuery.hints();
+ assertEquals("BAR", queryHints.next().getName());
+ assertEquals("BAZ", queryHints.next().getName());
+ assertEquals("FOO", queryHints.next().getName());
+ }
+
+ public void testRemoveHint() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0);
+
+ NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
+
+ xmlNamedNativeQuery.addHint(0).setName("FOO");
+ xmlNamedNativeQuery.addHint(1).setName("BAR");
+ xmlNamedNativeQuery.addHint(2).setName("BAZ");
+
+ assertEquals(3, namedNativeQueryResource.getHints().size());
+
+ xmlNamedNativeQuery.removeHint(0);
+ assertEquals(2, namedNativeQueryResource.getHints().size());
+ assertEquals("BAR", namedNativeQueryResource.getHints().get(0).getName());
+ assertEquals("BAZ", namedNativeQueryResource.getHints().get(1).getName());
+
+ xmlNamedNativeQuery.removeHint(0);
+ assertEquals(1, namedNativeQueryResource.getHints().size());
+ assertEquals("BAZ", namedNativeQueryResource.getHints().get(0).getName());
+
+ xmlNamedNativeQuery.removeHint(0);
+ assertEquals(0, namedNativeQueryResource.getHints().size());
+ }
+
+ public void testMoveHint() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0);
+
+ NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
+
+ xmlNamedNativeQuery.addHint(0).setName("FOO");
+ xmlNamedNativeQuery.addHint(1).setName("BAR");
+ xmlNamedNativeQuery.addHint(2).setName("BAZ");
+
+ assertEquals(3, namedNativeQueryResource.getHints().size());
+
+
+ xmlNamedNativeQuery.moveHint(2, 0);
+ ListIterator<XmlQueryHint> hints = xmlNamedNativeQuery.hints();
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+
+ assertEquals("BAR", namedNativeQueryResource.getHints().get(0).getName());
+ assertEquals("BAZ", namedNativeQueryResource.getHints().get(1).getName());
+ assertEquals("FOO", namedNativeQueryResource.getHints().get(2).getName());
+
+
+ xmlNamedNativeQuery.moveHint(0, 1);
+ hints = xmlNamedNativeQuery.hints();
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+
+ assertEquals("BAZ", namedNativeQueryResource.getHints().get(0).getName());
+ assertEquals("BAR", namedNativeQueryResource.getHints().get(1).getName());
+ assertEquals("FOO", namedNativeQueryResource.getHints().get(2).getName());
+ }
+
+ public void testUpdateHints() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0);
+
+ NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
+
+ namedNativeQueryResource.getHints().add(OrmFactory.eINSTANCE.createQueryHint());
+ namedNativeQueryResource.getHints().add(OrmFactory.eINSTANCE.createQueryHint());
+ namedNativeQueryResource.getHints().add(OrmFactory.eINSTANCE.createQueryHint());
+
+ namedNativeQueryResource.getHints().get(0).setName("FOO");
+ namedNativeQueryResource.getHints().get(1).setName("BAR");
+ namedNativeQueryResource.getHints().get(2).setName("BAZ");
+
+ ListIterator<XmlQueryHint> hints = xmlNamedNativeQuery.hints();
+ assertEquals("FOO", hints.next().getName());
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("BAZ", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ namedNativeQueryResource.getHints().move(2, 0);
+ hints = xmlNamedNativeQuery.hints();
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ namedNativeQueryResource.getHints().move(0, 1);
+ hints = xmlNamedNativeQuery.hints();
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ namedNativeQueryResource.getHints().remove(1);
+ hints = xmlNamedNativeQuery.hints();
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ namedNativeQueryResource.getHints().remove(1);
+ hints = xmlNamedNativeQuery.hints();
+ assertEquals("BAZ", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ namedNativeQueryResource.getHints().remove(0);
+ assertFalse(xmlNamedNativeQuery.hints().hasNext());
+ }
+
+
+ public void testUpdateResultSetMapping() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0);
+
+ NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
+
+ assertEquals(null, namedNativeQueryResource.getResultSetMapping());
+ assertEquals(null, xmlNamedNativeQuery.getResultSetMapping());
+
+ //set name in the resource model, verify context model updated
+ namedNativeQueryResource.setResultSetMapping("foo");
+ assertEquals("foo", namedNativeQueryResource.getResultSetMapping());
+ assertEquals("foo", xmlNamedNativeQuery.getResultSetMapping());
+
+ //set name to null in the resource model
+ namedNativeQueryResource.setResultSetMapping(null);
+ assertNull(namedNativeQueryResource.getResultSetMapping());
+ assertNull(xmlNamedNativeQuery.getResultSetMapping());
+ }
+
+ public void testModifyResultSetMapping() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0);
+
+ NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
+
+ assertEquals(null, namedNativeQueryResource.getResultSetMapping());
+ assertEquals(null, xmlNamedNativeQuery.getResultSetMapping());
+
+ //set name in the context model, verify resource model updated
+ xmlNamedNativeQuery.setResultSetMapping("foo");
+ assertEquals("foo", namedNativeQueryResource.getResultSetMapping());
+ assertEquals("foo", xmlNamedNativeQuery.getResultSetMapping());
+
+ //set name to null in the context model
+ xmlNamedNativeQuery.setResultSetMapping(null);
+ assertNull(namedNativeQueryResource.getResultSetMapping());
+ assertNull(xmlNamedNativeQuery.getResultSetMapping());
+ }
+
+ public void testUpdateResultClass() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0);
+
+ NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
+
+ assertEquals(null, namedNativeQueryResource.getResultClass());
+ assertEquals(null, xmlNamedNativeQuery.getResultClass());
+
+ //set name in the resource model, verify context model updated
+ namedNativeQueryResource.setResultClass("foo");
+ assertEquals("foo", namedNativeQueryResource.getResultClass());
+ assertEquals("foo", xmlNamedNativeQuery.getResultClass());
+
+ //set name to null in the resource model
+ namedNativeQueryResource.setResultClass(null);
+ assertNull(namedNativeQueryResource.getResultClass());
+ assertNull(xmlNamedNativeQuery.getResultClass());
+ }
+
+ public void testModifyResultClass() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0);
+
+ NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0);
+
+ assertEquals(null, namedNativeQueryResource.getResultClass());
+ assertEquals(null, xmlNamedNativeQuery.getResultClass());
+
+ //set name in the context model, verify resource model updated
+ xmlNamedNativeQuery.setResultClass("foo");
+ assertEquals("foo", namedNativeQueryResource.getResultClass());
+ assertEquals("foo", xmlNamedNativeQuery.getResultClass());
+
+ //set name to null in the context model
+ xmlNamedNativeQuery.setResultClass(null);
+ assertNull(namedNativeQueryResource.getResultClass());
+ assertNull(xmlNamedNativeQuery.getResultClass());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlNamedQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlNamedQueryTests.java
new file mode 100644
index 0000000000..dbae9442c9
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlNamedQueryTests.java
@@ -0,0 +1,273 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.XmlEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlNamedQuery;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.context.orm.XmlQueryHint;
+import org.eclipse.jpt.core.internal.resource.orm.NamedQuery;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class XmlNamedQueryTests extends ContextModelTestCase
+{
+ public XmlNamedQueryTests(String name) {
+ super(name);
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ public void testUpdateName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0);
+
+ NamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0);
+
+ assertNull(xmlNamedQuery.getName());
+ assertNull(namedQueryResource.getName());
+
+ //set name in the resource model, verify context model updated
+ namedQueryResource.setName("newName");
+ assertEquals("newName", xmlNamedQuery.getName());
+ assertEquals("newName", namedQueryResource.getName());
+
+ //set name to null in the resource model
+ namedQueryResource.setName(null);
+ assertNull(xmlNamedQuery.getName());
+ assertNull(namedQueryResource.getName());
+ }
+
+ public void testModifyName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0);
+
+ NamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0);
+
+ assertNull(xmlNamedQuery.getName());
+ assertNull(namedQueryResource.getName());
+
+ //set name in the context model, verify resource model updated
+ xmlNamedQuery.setName("newName");
+ assertEquals("newName", xmlNamedQuery.getName());
+ assertEquals("newName", namedQueryResource.getName());
+
+ //set name to null in the context model
+ xmlNamedQuery.setName(null);
+ assertNull(xmlNamedQuery.getName());
+ assertNull(namedQueryResource.getName());
+ }
+
+ public void testUpdateQuery() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0);
+
+ NamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0);
+
+ assertNull(xmlNamedQuery.getQuery());
+ assertNull(namedQueryResource.getQuery());
+
+ //set name in the resource model, verify context model updated
+ namedQueryResource.setQuery("newName");
+ assertEquals("newName", xmlNamedQuery.getQuery());
+ assertEquals("newName", namedQueryResource.getQuery());
+
+ //set name to null in the resource model
+ namedQueryResource.setQuery(null);
+ assertNull(xmlNamedQuery.getQuery());
+ assertNull(namedQueryResource.getQuery());
+ }
+
+ public void testModifyQuery() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0);
+
+ NamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0);
+
+ assertNull(xmlNamedQuery.getQuery());
+ assertNull(namedQueryResource.getQuery());
+
+ //set name in the context model, verify resource model updated
+ xmlNamedQuery.setQuery("newName");
+ assertEquals("newName", xmlNamedQuery.getQuery());
+ assertEquals("newName", namedQueryResource.getQuery());
+
+ //set name to null in the context model
+ xmlNamedQuery.setQuery(null);
+ assertNull(xmlNamedQuery.getQuery());
+ assertNull(namedQueryResource.getQuery());
+ }
+
+ public void testAddHint() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0);
+
+ NamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0);
+
+ XmlQueryHint queryHint = xmlNamedQuery.addHint(0);
+ queryHint.setName("FOO");
+
+ assertEquals("FOO", namedQueryResource.getHints().get(0).getName());
+
+ XmlQueryHint queryHint2 = xmlNamedQuery.addHint(0);
+ queryHint2.setName("BAR");
+
+ assertEquals("BAR", namedQueryResource.getHints().get(0).getName());
+ assertEquals("FOO", namedQueryResource.getHints().get(1).getName());
+
+ XmlQueryHint queryHint3 = xmlNamedQuery.addHint(1);
+ queryHint3.setName("BAZ");
+
+ assertEquals("BAR", namedQueryResource.getHints().get(0).getName());
+ assertEquals("BAZ", namedQueryResource.getHints().get(1).getName());
+ assertEquals("FOO", namedQueryResource.getHints().get(2).getName());
+
+ ListIterator<XmlQueryHint> queryHints = xmlNamedQuery.hints();
+ assertEquals(queryHint2, queryHints.next());
+ assertEquals(queryHint3, queryHints.next());
+ assertEquals(queryHint, queryHints.next());
+
+ queryHints = xmlNamedQuery.hints();
+ assertEquals("BAR", queryHints.next().getName());
+ assertEquals("BAZ", queryHints.next().getName());
+ assertEquals("FOO", queryHints.next().getName());
+ }
+
+ public void testRemoveHint() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0);
+
+ NamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0);
+
+ xmlNamedQuery.addHint(0).setName("FOO");
+ xmlNamedQuery.addHint(1).setName("BAR");
+ xmlNamedQuery.addHint(2).setName("BAZ");
+
+ assertEquals(3, namedQueryResource.getHints().size());
+
+ xmlNamedQuery.removeHint(0);
+ assertEquals(2, namedQueryResource.getHints().size());
+ assertEquals("BAR", namedQueryResource.getHints().get(0).getName());
+ assertEquals("BAZ", namedQueryResource.getHints().get(1).getName());
+
+ xmlNamedQuery.removeHint(0);
+ assertEquals(1, namedQueryResource.getHints().size());
+ assertEquals("BAZ", namedQueryResource.getHints().get(0).getName());
+
+ xmlNamedQuery.removeHint(0);
+ assertEquals(0, namedQueryResource.getHints().size());
+ }
+
+ public void testMoveHint() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0);
+
+ NamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0);
+
+ xmlNamedQuery.addHint(0).setName("FOO");
+ xmlNamedQuery.addHint(1).setName("BAR");
+ xmlNamedQuery.addHint(2).setName("BAZ");
+
+ assertEquals(3, namedQueryResource.getHints().size());
+
+
+ xmlNamedQuery.moveHint(2, 0);
+ ListIterator<XmlQueryHint> hints = xmlNamedQuery.hints();
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+
+ assertEquals("BAR", namedQueryResource.getHints().get(0).getName());
+ assertEquals("BAZ", namedQueryResource.getHints().get(1).getName());
+ assertEquals("FOO", namedQueryResource.getHints().get(2).getName());
+
+
+ xmlNamedQuery.moveHint(0, 1);
+ hints = xmlNamedQuery.hints();
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+
+ assertEquals("BAZ", namedQueryResource.getHints().get(0).getName());
+ assertEquals("BAR", namedQueryResource.getHints().get(1).getName());
+ assertEquals("FOO", namedQueryResource.getHints().get(2).getName());
+ }
+
+ public void testUpdateHints() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0);
+
+ NamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0);
+
+ namedQueryResource.getHints().add(OrmFactory.eINSTANCE.createQueryHint());
+ namedQueryResource.getHints().add(OrmFactory.eINSTANCE.createQueryHint());
+ namedQueryResource.getHints().add(OrmFactory.eINSTANCE.createQueryHint());
+
+ namedQueryResource.getHints().get(0).setName("FOO");
+ namedQueryResource.getHints().get(1).setName("BAR");
+ namedQueryResource.getHints().get(2).setName("BAZ");
+
+ ListIterator<XmlQueryHint> hints = xmlNamedQuery.hints();
+ assertEquals("FOO", hints.next().getName());
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("BAZ", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ namedQueryResource.getHints().move(2, 0);
+ hints = xmlNamedQuery.hints();
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ namedQueryResource.getHints().move(0, 1);
+ hints = xmlNamedQuery.hints();
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("BAR", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ namedQueryResource.getHints().remove(1);
+ hints = xmlNamedQuery.hints();
+ assertEquals("BAZ", hints.next().getName());
+ assertEquals("FOO", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ namedQueryResource.getHints().remove(1);
+ hints = xmlNamedQuery.hints();
+ assertEquals("BAZ", hints.next().getName());
+ assertFalse(hints.hasNext());
+
+ namedQueryResource.getHints().remove(0);
+ assertFalse(xmlNamedQuery.hints().hasNext());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlOneToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlOneToManyMappingTests.java
new file mode 100644
index 0000000000..af16fd8add
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlOneToManyMappingTests.java
@@ -0,0 +1,354 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.orm.XmlOneToManyMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.orm.OneToMany;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class XmlOneToManyMappingTests extends ContextModelTestCase
+{
+ public XmlOneToManyMappingTests(String name) {
+ super(name);
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ public void testUpdateName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping();
+ OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
+
+ assertEquals("oneToManyMapping", xmlOneToManyMapping.getName());
+ assertEquals("oneToManyMapping", oneToMany.getName());
+
+ //set name in the resource model, verify context model updated
+ oneToMany.setName("newName");
+ assertEquals("newName", xmlOneToManyMapping.getName());
+ assertEquals("newName", oneToMany.getName());
+
+ //set name to null in the resource model
+ oneToMany.setName(null);
+ assertNull(xmlOneToManyMapping.getName());
+ assertNull(oneToMany.getName());
+ }
+
+ public void testModifyName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping();
+ OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
+
+ assertEquals("oneToManyMapping", xmlOneToManyMapping.getName());
+ assertEquals("oneToManyMapping", oneToMany.getName());
+
+ //set name in the context model, verify resource model updated
+ xmlOneToManyMapping.setName("newName");
+ assertEquals("newName", xmlOneToManyMapping.getName());
+ assertEquals("newName", oneToMany.getName());
+
+ //set name to null in the context model
+ xmlOneToManyMapping.setName(null);
+ assertNull(xmlOneToManyMapping.getName());
+ assertNull(oneToMany.getName());
+ }
+
+ public void testUpdateTargetEntity() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping();
+ OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
+ ormResource().save(null);
+
+ assertNull(xmlOneToManyMapping.getSpecifiedTargetEntity());
+ assertNull(oneToMany.getTargetEntity());
+
+ //set target entity in the resource model, verify context model updated
+ oneToMany.setTargetEntity("newTargetEntity");
+ ormResource().save(null);
+ assertEquals("newTargetEntity", xmlOneToManyMapping.getSpecifiedTargetEntity());
+ assertEquals("newTargetEntity", oneToMany.getTargetEntity());
+
+ //set target entity to null in the resource model
+ oneToMany.setTargetEntity(null);
+ ormResource().save(null);
+ assertNull(xmlOneToManyMapping.getSpecifiedTargetEntity());
+ assertNull(oneToMany.getTargetEntity());
+ }
+
+ public void testModifyTargetEntity() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping();
+ OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
+
+ assertNull(xmlOneToManyMapping.getSpecifiedTargetEntity());
+ assertNull(oneToMany.getTargetEntity());
+
+ //set target entity in the context model, verify resource model updated
+ xmlOneToManyMapping.setSpecifiedTargetEntity("newTargetEntity");
+ assertEquals("newTargetEntity", xmlOneToManyMapping.getSpecifiedTargetEntity());
+ assertEquals("newTargetEntity", oneToMany.getTargetEntity());
+
+ //set target entity to null in the context model
+ xmlOneToManyMapping.setSpecifiedTargetEntity(null);
+ assertNull(xmlOneToManyMapping.getSpecifiedTargetEntity());
+ assertNull(oneToMany.getTargetEntity());
+ }
+
+ public void testUpdateSpecifiedFetch() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping();
+ OneToMany oneToManyResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
+
+ assertNull(xmlOneToManyMapping.getSpecifiedFetch());
+ assertNull(oneToManyResource.getFetch());
+
+ //set fetch in the resource model, verify context model updated
+ oneToManyResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER);
+ assertEquals(FetchType.EAGER, xmlOneToManyMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, oneToManyResource.getFetch());
+
+ oneToManyResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY);
+ assertEquals(FetchType.LAZY, xmlOneToManyMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, oneToManyResource.getFetch());
+
+ //set fetch to null in the resource model
+ oneToManyResource.setFetch(null);
+ assertNull(xmlOneToManyMapping.getSpecifiedFetch());
+ assertNull(oneToManyResource.getFetch());
+ }
+
+ public void testModifySpecifiedFetch() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping();
+ OneToMany oneToManyResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
+
+ assertNull(xmlOneToManyMapping.getSpecifiedFetch());
+ assertNull(oneToManyResource.getFetch());
+
+ //set fetch in the context model, verify resource model updated
+ xmlOneToManyMapping.setSpecifiedFetch(FetchType.EAGER);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, oneToManyResource.getFetch());
+ assertEquals(FetchType.EAGER, xmlOneToManyMapping.getSpecifiedFetch());
+
+ xmlOneToManyMapping.setSpecifiedFetch(FetchType.LAZY);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, oneToManyResource.getFetch());
+ assertEquals(FetchType.LAZY, xmlOneToManyMapping.getSpecifiedFetch());
+
+ //set fetch to null in the context model
+ xmlOneToManyMapping.setSpecifiedFetch(null);
+ assertNull(oneToManyResource.getFetch());
+ assertNull(xmlOneToManyMapping.getSpecifiedFetch());
+ }
+
+ public void testUpdateMappedBy() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping();
+ OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
+
+ assertNull(xmlOneToManyMapping.getMappedBy());
+ assertNull(oneToMany.getMappedBy());
+
+ //set mappedBy in the resource model, verify context model updated
+ oneToMany.setMappedBy("newMappedBy");
+ assertEquals("newMappedBy", xmlOneToManyMapping.getMappedBy());
+ assertEquals("newMappedBy", oneToMany.getMappedBy());
+
+ //setmappedBy to null in the resource model
+ oneToMany.setMappedBy(null);
+ assertNull(xmlOneToManyMapping.getMappedBy());
+ assertNull(oneToMany.getMappedBy());
+ }
+
+ public void testModifyMappedBy() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping();
+ OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
+
+ assertNull(xmlOneToManyMapping.getMappedBy());
+ assertNull(oneToMany.getMappedBy());
+
+ //set mappedBy in the context model, verify resource model updated
+ xmlOneToManyMapping.setMappedBy("newMappedBy");
+ assertEquals("newMappedBy", xmlOneToManyMapping.getMappedBy());
+ assertEquals("newMappedBy", oneToMany.getMappedBy());
+
+ //set mappedBy to null in the context model
+ xmlOneToManyMapping.setMappedBy(null);
+ assertNull(xmlOneToManyMapping.getMappedBy());
+ assertNull(oneToMany.getMappedBy());
+ }
+
+
+ public void testUpdateMapKey() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping();
+ OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
+
+ assertNull(xmlOneToManyMapping.getMapKey());
+ assertNull(oneToMany.getMapKey());
+
+ //set mapKey in the resource model, verify context model does not change
+ oneToMany.setMapKey(OrmFactory.eINSTANCE.createMapKeyImpl());
+ assertNull(xmlOneToManyMapping.getMapKey());
+ assertNotNull(oneToMany.getMapKey());
+
+ //set mapKey name in the resource model, verify context model updated
+ oneToMany.getMapKey().setName("myMapKey");
+ assertEquals("myMapKey", xmlOneToManyMapping.getMapKey());
+ assertEquals("myMapKey", oneToMany.getMapKey().getName());
+
+ //set mapKey name to null in the resource model
+ oneToMany.getMapKey().setName(null);
+ assertNull(xmlOneToManyMapping.getMapKey());
+ assertNull(oneToMany.getMapKey().getName());
+
+ oneToMany.getMapKey().setName("myMapKey");
+ oneToMany.setMapKey(null);
+ assertNull(xmlOneToManyMapping.getMapKey());
+ assertNull(oneToMany.getMapKey());
+ }
+
+ public void testModifyMapKey() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping();
+ OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
+
+ assertNull(xmlOneToManyMapping.getMapKey());
+ assertNull(oneToMany.getMapKey());
+
+ //set mapKey in the context model, verify resource model updated
+ xmlOneToManyMapping.setMapKey("myMapKey");
+ assertEquals("myMapKey", xmlOneToManyMapping.getMapKey());
+ assertEquals("myMapKey", oneToMany.getMapKey().getName());
+
+ //set mapKey to null in the context model
+ xmlOneToManyMapping.setMapKey(null);
+ assertNull(xmlOneToManyMapping.getMapKey());
+ assertNull(oneToMany.getMapKey());
+ }
+
+ public void testUpdateOrderBy() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping();
+ OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
+
+ assertNull(xmlOneToManyMapping.getOrderBy());
+ assertNull(oneToMany.getOrderBy());
+
+ //set orderBy in the resource model, verify context model updated
+ oneToMany.setOrderBy("newOrderBy");
+ assertEquals("newOrderBy", xmlOneToManyMapping.getOrderBy());
+ assertEquals("newOrderBy", oneToMany.getOrderBy());
+
+ //set orderBy to null in the resource model
+ oneToMany.setOrderBy(null);
+ assertNull(xmlOneToManyMapping.getOrderBy());
+ assertNull(oneToMany.getOrderBy());
+ }
+
+ public void testModifyOrderBy() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping();
+ OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
+
+ assertNull(xmlOneToManyMapping.getOrderBy());
+ assertNull(oneToMany.getOrderBy());
+
+ //set mappedBy in the context model, verify resource model updated
+ xmlOneToManyMapping.setOrderBy("newOrderBy");
+ assertEquals("newOrderBy", xmlOneToManyMapping.getOrderBy());
+ assertEquals("newOrderBy", oneToMany.getOrderBy());
+
+ //set mappedBy to null in the context model
+ xmlOneToManyMapping.setOrderBy(null);
+ assertNull(xmlOneToManyMapping.getOrderBy());
+ assertNull(oneToMany.getOrderBy());
+ }
+
+ public void testIsNoOrdering() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping();
+
+ assertTrue(xmlOneToManyMapping.isNoOrdering());
+
+ xmlOneToManyMapping.setOrderBy("foo");
+ assertFalse(xmlOneToManyMapping.isNoOrdering());
+
+ xmlOneToManyMapping.setOrderBy(null);
+ assertTrue(xmlOneToManyMapping.isNoOrdering());
+ }
+
+ public void testSetNoOrdering() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping();
+
+ assertTrue(xmlOneToManyMapping.isNoOrdering());
+
+ xmlOneToManyMapping.setOrderBy("foo");
+ assertFalse(xmlOneToManyMapping.isNoOrdering());
+
+ xmlOneToManyMapping.setNoOrdering();
+ assertTrue(xmlOneToManyMapping.isNoOrdering());
+ assertNull(xmlOneToManyMapping.getOrderBy());
+ }
+//TODO
+// public boolean isOrderByPk() {
+// return "".equals(getOrderBy());
+// }
+//
+// public void setOrderByPk() {
+// setOrderBy("");
+// }
+
+ public void testIsCustomOrdering() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping();
+
+ assertFalse(xmlOneToManyMapping.isCustomOrdering());
+
+ xmlOneToManyMapping.setOrderBy("foo");
+ assertTrue(xmlOneToManyMapping.isCustomOrdering());
+
+ xmlOneToManyMapping.setOrderBy(null);
+ assertFalse(xmlOneToManyMapping.isCustomOrdering());
+ }
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlOneToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlOneToOneMappingTests.java
new file mode 100644
index 0000000000..8411098dcb
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlOneToOneMappingTests.java
@@ -0,0 +1,610 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.FetchType;
+import org.eclipse.jpt.core.internal.context.orm.XmlCascade;
+import org.eclipse.jpt.core.internal.context.orm.XmlJoinColumn;
+import org.eclipse.jpt.core.internal.context.orm.XmlOneToOneMapping;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.orm.OneToOne;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.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.iterators.ArrayIterator;
+
+public class XmlOneToOneMappingTests extends ContextModelTestCase
+{
+ public XmlOneToOneMappingTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createOneToOneAnnotation() throws Exception{
+ this.createAnnotationAndMembers("OneToOne",
+ "Class targetEntity() default void.class;" +
+ "CascadeType[] cascade() default {};" +
+ "FetchType fetch() default EAGER;" +
+ "boolean optional() default true;" +
+ "String mappedBy() default \"\";");
+ }
+
+ private void createJoinColumnAnnotation() throws Exception{
+ this.createAnnotationAndMembers("JoinColumn",
+ "String name() default \"\";" +
+ "String referencedColumnName() default \"\";" +
+ "boolean unique() default false;" +
+ "boolean nullable() default true;" +
+ "boolean insertable() default true;" +
+ "boolean updatable() default true;" +
+ "String columnDefinition() default \"\";" +
+ "String table() default \"\";");
+ }
+
+ private IType createTestEntityOneToOneMapping() throws Exception {
+ createEntityAnnotation();
+ createOneToOneAnnotation();
+ createJoinColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ONE_TO_ONE, JPA.JOIN_COLUMN, JPA.FETCH_TYPE, JPA.CASCADE_TYPE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" @OneToOne(fetch=FetchType.LAZY, optional=false, targetEntity=Address.class, cascade={CascadeType.ALL, CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE, CascadeType.REFRESH}, mappedBy=\"foo\")");
+ sb.append(CR);
+ sb.append(" @JoinColumn(name=\"MY_COLUMN\", referencedColumnName=\"MY_REFERENCED_COLUMN\", unique=true, nullable=false, insertable=false, updatable=false, columnDefinition=\"COLUMN_DEFINITION\", table=\"MY_TABLE\")");
+ sb.append(CR);
+ sb.append(" private Address address;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id");
+ }
+ });
+ }
+
+ private IType createTestTargetEntityAddress() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ID);
+ sb.append(";");
+ sb.append(CR);
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("Address").append(" ");
+ sb.append("{").append(CR);
+ sb.append(CR);
+ sb.append(" @Id").append(CR);
+ sb.append(" private int id;").append(CR);
+ sb.append(CR);
+ sb.append(" private String city;").append(CR);
+ sb.append(CR);
+ sb.append(" private String state;").append(CR);
+ sb.append(CR);
+ sb.append(" private int zip;").append(CR);
+ sb.append(CR);
+ sb.append("}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "Address.java", sourceWriter);
+ }
+ public void testUpdateName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ assertEquals("oneToOneMapping", xmlOneToOneMapping.getName());
+ assertEquals("oneToOneMapping", oneToOne.getName());
+
+ //set name in the resource model, verify context model updated
+ oneToOne.setName("newName");
+ assertEquals("newName", xmlOneToOneMapping.getName());
+ assertEquals("newName", oneToOne.getName());
+
+ //set name to null in the resource model
+ oneToOne.setName(null);
+ assertNull(xmlOneToOneMapping.getName());
+ assertNull(oneToOne.getName());
+ }
+
+ public void testModifyName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ assertEquals("oneToOneMapping", xmlOneToOneMapping.getName());
+ assertEquals("oneToOneMapping", oneToOne.getName());
+
+ //set name in the context model, verify resource model updated
+ xmlOneToOneMapping.setName("newName");
+ assertEquals("newName", xmlOneToOneMapping.getName());
+ assertEquals("newName", oneToOne.getName());
+
+ //set name to null in the context model
+ xmlOneToOneMapping.setName(null);
+ assertNull(xmlOneToOneMapping.getName());
+ assertNull(oneToOne.getName());
+ }
+
+ public void testUpdateSpecifiedTargetEntity() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ assertNull(xmlOneToOneMapping.getSpecifiedTargetEntity());
+ assertNull(oneToOne.getTargetEntity());
+
+ //set target entity in the resource model, verify context model updated
+ oneToOne.setTargetEntity("newTargetEntity");
+ assertEquals("newTargetEntity", xmlOneToOneMapping.getSpecifiedTargetEntity());
+ assertEquals("newTargetEntity", oneToOne.getTargetEntity());
+
+ //set target entity to null in the resource model
+ oneToOne.setTargetEntity(null);
+ assertNull(xmlOneToOneMapping.getSpecifiedTargetEntity());
+ assertNull(oneToOne.getTargetEntity());
+ }
+
+ public void testModifySpecifiedTargetEntity() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ assertNull(xmlOneToOneMapping.getSpecifiedTargetEntity());
+ assertNull(oneToOne.getTargetEntity());
+
+ //set target entity in the context model, verify resource model updated
+ xmlOneToOneMapping.setSpecifiedTargetEntity("newTargetEntity");
+ assertEquals("newTargetEntity", xmlOneToOneMapping.getSpecifiedTargetEntity());
+ assertEquals("newTargetEntity", oneToOne.getTargetEntity());
+
+ //set target entity to null in the context model
+ xmlOneToOneMapping.setSpecifiedTargetEntity(null);
+ assertNull(xmlOneToOneMapping.getSpecifiedTargetEntity());
+ assertNull(oneToOne.getTargetEntity());
+ }
+
+ public void testUpdateSpecifiedFetch() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ assertNull(xmlOneToOneMapping.getSpecifiedFetch());
+ assertNull(oneToOneResource.getFetch());
+
+ //set fetch in the resource model, verify context model updated
+ oneToOneResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER);
+ assertEquals(FetchType.EAGER, xmlOneToOneMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, oneToOneResource.getFetch());
+
+ oneToOneResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY);
+ assertEquals(FetchType.LAZY, xmlOneToOneMapping.getSpecifiedFetch());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, oneToOneResource.getFetch());
+
+ //set fetch to null in the resource model
+ oneToOneResource.setFetch(null);
+ assertNull(xmlOneToOneMapping.getSpecifiedFetch());
+ assertNull(oneToOneResource.getFetch());
+ }
+
+ public void testModifySpecifiedFetch() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ assertNull(xmlOneToOneMapping.getSpecifiedFetch());
+ assertNull(oneToOneResource.getFetch());
+
+ //set fetch in the context model, verify resource model updated
+ xmlOneToOneMapping.setSpecifiedFetch(FetchType.EAGER);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, oneToOneResource.getFetch());
+ assertEquals(FetchType.EAGER, xmlOneToOneMapping.getSpecifiedFetch());
+
+ xmlOneToOneMapping.setSpecifiedFetch(FetchType.LAZY);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, oneToOneResource.getFetch());
+ assertEquals(FetchType.LAZY, xmlOneToOneMapping.getSpecifiedFetch());
+
+ //set fetch to null in the context model
+ xmlOneToOneMapping.setSpecifiedFetch(null);
+ assertNull(oneToOneResource.getFetch());
+ assertNull(xmlOneToOneMapping.getSpecifiedFetch());
+ }
+
+ public void testUpdateMappedBy() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ assertNull(xmlOneToOneMapping.getMappedBy());
+ assertNull(oneToOne.getMappedBy());
+
+ //set mappedBy in the resource model, verify context model updated
+ oneToOne.setMappedBy("newMappedBy");
+ assertEquals("newMappedBy", xmlOneToOneMapping.getMappedBy());
+ assertEquals("newMappedBy", oneToOne.getMappedBy());
+
+ //set mappedBy to null in the resource model
+ oneToOne.setMappedBy(null);
+ assertNull(xmlOneToOneMapping.getMappedBy());
+ assertNull(oneToOne.getMappedBy());
+ }
+
+ public void testModifyMappedBy() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ assertNull(xmlOneToOneMapping.getMappedBy());
+ assertNull(oneToOne.getMappedBy());
+
+ //set mappedBy in the context model, verify resource model updated
+ xmlOneToOneMapping.setMappedBy("newMappedBy");
+ assertEquals("newMappedBy", xmlOneToOneMapping.getMappedBy());
+ assertEquals("newMappedBy", oneToOne.getMappedBy());
+
+ //set mappedBy to null in the context model
+ xmlOneToOneMapping.setMappedBy(null);
+ assertNull(xmlOneToOneMapping.getMappedBy());
+ assertNull(oneToOne.getMappedBy());
+ }
+
+
+ public void testUpdateSpecifiedOptional() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ assertNull(xmlOneToOneMapping.getSpecifiedOptional());
+ assertNull(oneToOneResource.getOptional());
+
+ //set optional in the resource model, verify context model updated
+ oneToOneResource.setOptional(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, xmlOneToOneMapping.getSpecifiedOptional());
+ assertEquals(Boolean.TRUE, oneToOneResource.getOptional());
+
+ oneToOneResource.setOptional(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, xmlOneToOneMapping.getSpecifiedOptional());
+ assertEquals(Boolean.FALSE, oneToOneResource.getOptional());
+
+ //set optional to null in the resource model
+ oneToOneResource.setOptional(null);
+ assertNull(xmlOneToOneMapping.getSpecifiedOptional());
+ assertNull(oneToOneResource.getOptional());
+ }
+
+ public void testModifySpecifiedOptional() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ assertNull(xmlOneToOneMapping.getSpecifiedOptional());
+ assertNull(oneToOneResource.getOptional());
+
+ //set optional in the context model, verify resource model updated
+ xmlOneToOneMapping.setSpecifiedOptional(Boolean.TRUE);
+ assertEquals(Boolean.TRUE, oneToOneResource.getOptional());
+ assertEquals(Boolean.TRUE, xmlOneToOneMapping.getSpecifiedOptional());
+
+ xmlOneToOneMapping.setSpecifiedOptional(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, oneToOneResource.getOptional());
+ assertEquals(Boolean.FALSE, xmlOneToOneMapping.getSpecifiedOptional());
+
+ //set optional to null in the context model
+ xmlOneToOneMapping.setSpecifiedOptional(null);
+ assertNull(oneToOneResource.getOptional());
+ assertNull(xmlOneToOneMapping.getSpecifiedOptional());
+ }
+
+ public void testAddSpecifiedJoinColumn() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ XmlJoinColumn joinColumn = xmlOneToOneMapping.addSpecifiedJoinColumn(0);
+ ormResource().save(null);
+ joinColumn.setSpecifiedName("FOO");
+ ormResource().save(null);
+
+ assertEquals("FOO", oneToOneResource.getJoinColumns().get(0).getName());
+
+ XmlJoinColumn joinColumn2 = xmlOneToOneMapping.addSpecifiedJoinColumn(0);
+ ormResource().save(null);
+ joinColumn2.setSpecifiedName("BAR");
+ ormResource().save(null);
+
+ assertEquals("BAR", oneToOneResource.getJoinColumns().get(0).getName());
+ assertEquals("FOO", oneToOneResource.getJoinColumns().get(1).getName());
+
+ XmlJoinColumn joinColumn3 = xmlOneToOneMapping.addSpecifiedJoinColumn(1);
+ ormResource().save(null);
+ joinColumn3.setSpecifiedName("BAZ");
+ ormResource().save(null);
+
+ assertEquals("BAR", oneToOneResource.getJoinColumns().get(0).getName());
+ assertEquals("BAZ", oneToOneResource.getJoinColumns().get(1).getName());
+ assertEquals("FOO", oneToOneResource.getJoinColumns().get(2).getName());
+
+ ListIterator<XmlJoinColumn> joinColumns = xmlOneToOneMapping.specifiedJoinColumns();
+ assertEquals(joinColumn2, joinColumns.next());
+ assertEquals(joinColumn3, joinColumns.next());
+ assertEquals(joinColumn, joinColumns.next());
+
+ joinColumns = xmlOneToOneMapping.specifiedJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ }
+
+ public void testRemoveSpecifiedJoinColumn() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ xmlOneToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ xmlOneToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
+ xmlOneToOneMapping.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
+
+ assertEquals(3, oneToOneResource.getJoinColumns().size());
+
+ xmlOneToOneMapping.removeSpecifiedJoinColumn(0);
+ assertEquals(2, oneToOneResource.getJoinColumns().size());
+ assertEquals("BAR", oneToOneResource.getJoinColumns().get(0).getName());
+ assertEquals("BAZ", oneToOneResource.getJoinColumns().get(1).getName());
+
+ xmlOneToOneMapping.removeSpecifiedJoinColumn(0);
+ assertEquals(1, oneToOneResource.getJoinColumns().size());
+ assertEquals("BAZ", oneToOneResource.getJoinColumns().get(0).getName());
+
+ xmlOneToOneMapping.removeSpecifiedJoinColumn(0);
+ assertEquals(0, oneToOneResource.getJoinColumns().size());
+ }
+
+ public void testMoveSpecifiedJoinColumn() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ OneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
+
+ xmlOneToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
+ xmlOneToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
+ xmlOneToOneMapping.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
+
+ assertEquals(3, oneToOneResource.getJoinColumns().size());
+
+
+ xmlOneToOneMapping.moveSpecifiedJoinColumn(2, 0);
+ ListIterator<XmlJoinColumn> joinColumns = xmlOneToOneMapping.specifiedJoinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+
+ assertEquals("BAR", oneToOneResource.getJoinColumns().get(0).getName());
+ assertEquals("BAZ", oneToOneResource.getJoinColumns().get(1).getName());
+ assertEquals("FOO", oneToOneResource.getJoinColumns().get(2).getName());
+
+
+ xmlOneToOneMapping.moveSpecifiedJoinColumn(0, 1);
+ joinColumns = xmlOneToOneMapping.specifiedJoinColumns();
+ assertEquals("BAZ", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+
+ assertEquals("BAZ", oneToOneResource.getJoinColumns().get(0).getName());
+ assertEquals("BAR", oneToOneResource.getJoinColumns().get(1).getName());
+ assertEquals("FOO", oneToOneResource.getJoinColumns().get(2).getName());
+ }
+
+ public void testOneToOneMappingNoUnderylingJavaAttribute() throws Exception {
+ createTestEntityOneToOneMapping();
+ createTestTargetEntityAddress();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
+ xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "foo");
+ assertEquals(3, xmlPersistentType.virtualAttributesSize());
+
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next();
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+
+ assertEquals("foo", xmlOneToOneMapping.getName());
+
+ assertNull(xmlOneToOneMapping.getSpecifiedFetch());
+ assertNull(xmlOneToOneMapping.getSpecifiedOptional());
+ assertNull(xmlOneToOneMapping.getSpecifiedTargetEntity());
+ assertEquals(FetchType.EAGER, xmlOneToOneMapping.getFetch());
+ assertEquals(Boolean.TRUE, xmlOneToOneMapping.getOptional());
+ assertNull(xmlOneToOneMapping.getTargetEntity());
+
+
+ assertFalse(xmlOneToOneMapping.specifiedJoinColumns().hasNext());
+ //TODO default joinColumns
+ //assertTrue(xmlOneToOneMapping.defaultJoinColumns().hasNext());
+
+
+ XmlCascade xmlCascade = xmlOneToOneMapping.getCascade();
+ assertFalse(xmlCascade.isAll());
+ assertFalse(xmlCascade.isMerge());
+ assertFalse(xmlCascade.isPersist());
+ assertFalse(xmlCascade.isRemove());
+ assertFalse(xmlCascade.isRefresh());
+ }
+
+
+ public void testVirtualMappingMetadataCompleteFalse() throws Exception {
+ createTestEntityOneToOneMapping();
+ createTestTargetEntityAddress();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
+ assertEquals(3, xmlPersistentType.virtualAttributesSize());
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next();
+
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ assertEquals("address", xmlOneToOneMapping.getName());
+ assertEquals(FetchType.LAZY, xmlOneToOneMapping.getSpecifiedFetch());
+ assertEquals(Boolean.FALSE, xmlOneToOneMapping.getSpecifiedOptional());
+ assertEquals("Address", xmlOneToOneMapping.getSpecifiedTargetEntity());
+ assertEquals("foo", xmlOneToOneMapping.getMappedBy());
+
+ XmlJoinColumn xmlJoinColumn = xmlOneToOneMapping.specifiedJoinColumns().next();
+ assertEquals("MY_COLUMN", xmlJoinColumn.getSpecifiedName());
+ assertEquals("MY_REFERENCED_COLUMN", xmlJoinColumn.getSpecifiedReferencedColumnName());
+ assertEquals(Boolean.TRUE, xmlJoinColumn.getSpecifiedUnique());
+ assertEquals(Boolean.FALSE, xmlJoinColumn.getSpecifiedNullable());
+ assertEquals(Boolean.FALSE, xmlJoinColumn.getSpecifiedInsertable());
+ assertEquals(Boolean.FALSE, xmlJoinColumn.getSpecifiedUpdatable());
+ assertEquals("COLUMN_DEFINITION", xmlJoinColumn.getColumnDefinition());
+ assertEquals("MY_TABLE", xmlJoinColumn.getSpecifiedTable());
+
+ XmlCascade xmlCascade = xmlOneToOneMapping.getCascade();
+ assertTrue(xmlCascade.isAll());
+ assertTrue(xmlCascade.isMerge());
+ assertTrue(xmlCascade.isPersist());
+ assertTrue(xmlCascade.isRemove());
+ assertTrue(xmlCascade.isRefresh());
+ }
+
+ public void testVirtualMappingMetadataCompleteTrue() throws Exception {
+ createTestEntityOneToOneMapping();
+ createTestTargetEntityAddress();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
+ xmlPersistentType.getMapping().setSpecifiedMetadataComplete(true);
+ assertEquals(3, xmlPersistentType.virtualAttributesSize());
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next();
+
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+ assertEquals("address", xmlOneToOneMapping.getName());
+ assertEquals(FetchType.EAGER, xmlOneToOneMapping.getSpecifiedFetch());
+ assertEquals(Boolean.TRUE, xmlOneToOneMapping.getSpecifiedOptional());
+ //TODO hmm, is this correct?
+ assertEquals("test.Address", xmlOneToOneMapping.getSpecifiedTargetEntity());
+ assertNull(xmlOneToOneMapping.getMappedBy());
+
+ XmlJoinColumn xmlJoinColumn = xmlOneToOneMapping.specifiedJoinColumns().next();
+ //TODO java default columns name in JavaSingleRelationshipMapping.JoinColumnOwner
+ //assertEquals("address", xmlJoinColumn.getSpecifiedName());
+ //assertEquals("address", xmlJoinColumn.getSpecifiedReferencedColumnName());
+ assertEquals(Boolean.FALSE, xmlJoinColumn.getSpecifiedUnique());
+ assertEquals(Boolean.TRUE, xmlJoinColumn.getSpecifiedNullable());
+ assertEquals(Boolean.TRUE, xmlJoinColumn.getSpecifiedInsertable());
+ assertEquals(Boolean.TRUE, xmlJoinColumn.getSpecifiedUpdatable());
+ assertNull(xmlJoinColumn.getColumnDefinition());
+ assertEquals(TYPE_NAME, xmlJoinColumn.getSpecifiedTable());
+
+ XmlCascade xmlCascade = xmlOneToOneMapping.getCascade();
+ assertFalse(xmlCascade.isAll());
+ assertFalse(xmlCascade.isMerge());
+ assertFalse(xmlCascade.isPersist());
+ assertFalse(xmlCascade.isRemove());
+ assertFalse(xmlCascade.isRefresh());
+ }
+
+ public void testSpecifiedMapping() throws Exception {
+ createTestEntityOneToOneMapping();
+ createTestTargetEntityAddress();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
+
+ xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "address");
+ assertEquals(2, xmlPersistentType.virtualAttributesSize());
+
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next();
+ XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping();
+
+ assertEquals("address", xmlOneToOneMapping.getName());
+ assertNull(xmlOneToOneMapping.getSpecifiedFetch());
+ assertNull(xmlOneToOneMapping.getSpecifiedOptional());
+ assertNull(xmlOneToOneMapping.getSpecifiedTargetEntity());
+ assertNull(xmlOneToOneMapping.getMappedBy());
+ assertEquals(FetchType.EAGER, xmlOneToOneMapping.getFetch());
+ assertEquals(Boolean.TRUE, xmlOneToOneMapping.getOptional());
+ //TODO default target entity in xml
+ //assertEquals("test.Address", xmlOneToOneMapping.getDefaultTargetEntity());
+
+ assertFalse(xmlOneToOneMapping.specifiedJoinColumns().hasNext());
+
+ //TODO default join columns for specified xmlOneToOne mapping
+// XmlJoinColumn xmlJoinColumn = xmlOneToOneMapping.defaultJoinColumns().next();
+// assertNull(xmlJoinColumn.getSpecifiedName());
+// assertNull(xmlJoinColumn.getSpecifiedReferencedColumnName());
+// assertNull(xmlJoinColumn.getSpecifiedUnique());
+// assertNull(xmlJoinColumn.getSpecifiedNullable());
+// assertNull(xmlJoinColumn.getSpecifiedInsertable());
+// assertNull(xmlJoinColumn.getSpecifiedUpdatable());
+// assertNull(xmlJoinColumn.getColumnDefinition());
+// assertNull(xmlJoinColumn.getSpecifiedTable());
+//
+// assertEquals("address", xmlJoinColumn.getDefaultName());
+// assertEquals("address", xmlJoinColumn.getDefaultReferencedColumnName());
+// assertEquals(Boolean.FALSE, xmlJoinColumn.getDefaultUnique());
+// assertEquals(Boolean.TRUE, xmlJoinColumn.getDefaultNullable());
+// assertEquals(Boolean.TRUE, xmlJoinColumn.getDefaultInsertable());
+// assertEquals(Boolean.TRUE, xmlJoinColumn.getDefaultUpdatable());
+// assertEquals(null, xmlJoinColumn.getColumnDefinition());
+// assertEquals(TYPE_NAME, xmlJoinColumn.getDefaultTable());
+
+ XmlCascade xmlCascade = xmlOneToOneMapping.getCascade();
+ assertFalse(xmlCascade.isAll());
+ assertFalse(xmlCascade.isMerge());
+ assertFalse(xmlCascade.isPersist());
+ assertFalse(xmlCascade.isRemove());
+ assertFalse(xmlCascade.isRefresh());
+ }
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlPersistentTypeTests.java
new file mode 100644
index 0000000000..c8cc012285
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlPersistentTypeTests.java
@@ -0,0 +1,518 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.resource.orm.Basic;
+import org.eclipse.jpt.core.internal.resource.orm.BasicImpl;
+import org.eclipse.jpt.core.internal.resource.orm.Embedded;
+import org.eclipse.jpt.core.internal.resource.orm.EmbeddedIdImpl;
+import org.eclipse.jpt.core.internal.resource.orm.EmbeddedImpl;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.Id;
+import org.eclipse.jpt.core.internal.resource.orm.IdImpl;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl;
+import org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl;
+import org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl;
+import org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.Transient;
+import org.eclipse.jpt.core.internal.resource.orm.TransientImpl;
+import org.eclipse.jpt.core.internal.resource.orm.Version;
+import org.eclipse.jpt.core.internal.resource.orm.VersionImpl;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class XmlPersistentTypeTests extends ContextModelTestCase
+{
+ public XmlPersistentTypeTests(String name) {
+ super(name);
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+// public void testUpdateXmlTypeMapping() throws Exception {
+// assertFalse(entityMappings().xmlPersistentTypes().hasNext());
+// assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+// assertTrue(ormResource().getEntityMappings().getEntities().isEmpty());
+// assertTrue(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+//
+// //add embeddable in the resource model, verify context model updated
+// Embeddable embeddable = OrmFactory.eINSTANCE.createEmbeddable();
+// ormResource().getEntityMappings().getEmbeddables().add(embeddable);
+// embeddable.setClassName("model.Foo");
+// assertTrue(entityMappings().xmlPersistentTypes().hasNext());
+// assertEquals("model.Foo", entityMappings().xmlPersistentTypes().next().getMapping().getClass_());
+// assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+// assertTrue(ormResource().getEntityMappings().getEntities().isEmpty());
+// assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+// assertEquals("model.Foo", ormResource().getEntityMappings().getEmbeddables().get(0).getClassName());
+//
+// //add entity in the resource model, verify context model updated
+// Entity entity = OrmFactory.eINSTANCE.createEntity();
+// ormResource().getEntityMappings().getEntities().add(entity);
+// entity.setClassName("model.Foo2");
+// assertTrue(entityMappings().xmlPersistentTypes().hasNext());
+// assertEquals("model.Foo2", entityMappings().xmlPersistentTypes().next().getMapping().getClass_());
+// assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+// assertFalse(ormResource().getEntityMappings().getEntities().isEmpty());
+// assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+// assertEquals("model.Foo2", ormResource().getEntityMappings().getEntities().get(0).getClassName());
+//
+// //add mapped-superclass in the resource model, verify context model updated
+// MappedSuperclass mappedSuperclass = OrmFactory.eINSTANCE.createMappedSuperclass();
+// ormResource().getEntityMappings().getMappedSuperclasses().add(mappedSuperclass);
+// mappedSuperclass.setClassName("model.Foo3");
+// assertTrue(entityMappings().xmlPersistentTypes().hasNext());
+// assertEquals("model.Foo3", entityMappings().xmlPersistentTypes().next().getMapping().getClass_());
+// assertFalse(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+// assertFalse(ormResource().getEntityMappings().getEntities().isEmpty());
+// assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+// assertEquals("model.Foo3", ormResource().getEntityMappings().getMappedSuperclasses().get(0).getClassName());
+// }
+//
+
+ public void testMorphXmlTypeMapping() throws Exception {
+ assertFalse(entityMappings().xmlPersistentTypes().hasNext());
+ assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty());
+ assertTrue(ormResource().getEntityMappings().getEntities().isEmpty());
+ assertTrue(ormResource().getEntityMappings().getEmbeddables().isEmpty());
+
+ XmlPersistentType embeddablePersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
+ XmlPersistentType mappedSuperclassPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo3");
+ ormResource().save(null);
+
+ XmlPersistentType xmlPersistentType = entityMappings().xmlPersistentTypes().next();
+ assertEquals(mappedSuperclassPersistentType, xmlPersistentType);
+ assertEquals(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, xmlPersistentType.getMapping().getKey());
+
+ xmlPersistentType.setMappingKey(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
+ ormResource().save(null);
+ assertEquals(0, ormResource().getEntityMappings().getMappedSuperclasses().size());
+ assertEquals(1, ormResource().getEntityMappings().getEntities().size());
+ assertEquals(2, ormResource().getEntityMappings().getEmbeddables().size());
+
+ Iterator<XmlPersistentType> xmlPersistentTypes = entityMappings().xmlPersistentTypes();
+ //the same XmlPersistentTypes should still be in the context model
+ assertEquals(xmlPersistentTypes.next(), entityPersistentType);
+ assertEquals(xmlPersistentTypes.next(), embeddablePersistentType);
+ assertEquals(xmlPersistentTypes.next(), mappedSuperclassPersistentType);
+
+ assertEquals("model.Foo", ormResource().getEntityMappings().getEmbeddables().get(0).getClassName());
+ assertEquals("model.Foo3", ormResource().getEntityMappings().getEmbeddables().get(1).getClassName());
+ }
+
+ public void testAddSpecifiedPersistentAttribute() throws Exception {
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
+
+ entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute");
+ ormResource().save(null);
+
+ Entity entity = ormResource().getEntityMappings().getEntities().get(0);
+ Basic basic = entity.getAttributes().getBasics().get(0);
+ assertEquals("basicAttribute", basic.getName());
+
+ entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute");
+ ormResource().save(null);
+
+ Embedded embedded = entity.getAttributes().getEmbeddeds().get(0);
+ assertEquals("embeddedAttribute", embedded.getName());
+
+ entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute");
+ ormResource().save(null);
+
+ Transient transientResource = entity.getAttributes().getTransients().get(0);
+ assertEquals("transientAttribute", transientResource.getName());
+
+ entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute");
+ ormResource().save(null);
+
+ Version version = entity.getAttributes().getVersions().get(0);
+ assertEquals("versionAttribute", version.getName());
+
+ entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute");
+ ormResource().save(null);
+
+ Id id = entity.getAttributes().getIds().get(0);
+ assertEquals("idAttribute", id.getName());
+
+
+ ListIterator<XmlPersistentAttribute> persistentAttributes = entityPersistentType.specifiedAttributes();
+ assertEquals("idAttribute", persistentAttributes.next().getName());
+ assertEquals("basicAttribute", persistentAttributes.next().getName());
+ assertEquals("versionAttribute", persistentAttributes.next().getName());
+ assertEquals("embeddedAttribute", persistentAttributes.next().getName());
+ assertEquals("transientAttribute", persistentAttributes.next().getName());
+ assertFalse(persistentAttributes.hasNext());
+ }
+
+ public void testRemoveSpecifiedPersistentAttribute() throws Exception {
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
+
+ entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute");
+ entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute");
+ entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute");
+ entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute");
+ entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute");
+ ormResource().save(null);
+
+ Entity entity = ormResource().getEntityMappings().getEntities().get(0);
+ assertEquals("basicAttribute", entity.getAttributes().getBasics().get(0).getName());
+ 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.removeSpecifiedXmlPersistentAttribute(entityPersistentType.attributeNamed("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.removeSpecifiedXmlPersistentAttribute(entityPersistentType.attributeNamed("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.removeSpecifiedXmlPersistentAttribute(entityPersistentType.attributeNamed("versionAttribute"));
+ assertEquals("idAttribute", entity.getAttributes().getIds().get(0).getName());
+ assertEquals("transientAttribute", entity.getAttributes().getTransients().get(0).getName());
+
+ entityPersistentType.removeSpecifiedXmlPersistentAttribute(entityPersistentType.attributeNamed("idAttribute"));
+ assertEquals("transientAttribute", entity.getAttributes().getTransients().get(0).getName());
+
+ entityPersistentType.removeSpecifiedXmlPersistentAttribute(entityPersistentType.attributeNamed("transientAttribute"));
+ assertNull(entity.getAttributes());
+ }
+
+ public void testRemoveId() throws Exception {
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
+ Entity entity = ormResource().getEntityMappings().getEntities().get(0);
+
+ entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute");
+ assertEquals("idAttribute", entity.getAttributes().getIds().get(0).getName());
+
+ entityPersistentType.removeSpecifiedXmlPersistentAttribute(entityPersistentType.attributeNamed("idAttribute"));
+ assertNull(entity.getAttributes());
+ }
+
+ public void testRemoveBasic() throws Exception {
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
+ Entity entity = ormResource().getEntityMappings().getEntities().get(0);
+
+ entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute");
+ assertEquals("basicAttribute", entity.getAttributes().getBasics().get(0).getName());
+
+ entityPersistentType.removeSpecifiedXmlPersistentAttribute(entityPersistentType.attributeNamed("basicAttribute"));
+ assertNull(entity.getAttributes());
+ }
+
+ public void testRemoveVersion() throws Exception {
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
+ Entity entity = ormResource().getEntityMappings().getEntities().get(0);
+
+ entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute");
+ assertEquals("versionAttribute", entity.getAttributes().getVersions().get(0).getName());
+
+ entityPersistentType.removeSpecifiedXmlPersistentAttribute(entityPersistentType.attributeNamed("versionAttribute"));
+ assertNull(entity.getAttributes());
+ }
+
+ public void testRemoveEmbedded() throws Exception {
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
+ Entity entity = ormResource().getEntityMappings().getEntities().get(0);
+
+ entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute");
+ assertEquals("embeddedAttribute", entity.getAttributes().getEmbeddeds().get(0).getName());
+
+ entityPersistentType.removeSpecifiedXmlPersistentAttribute(entityPersistentType.attributeNamed("embeddedAttribute"));
+ assertNull(entity.getAttributes());
+ }
+
+ public void testRemoveTransient() throws Exception {
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
+ Entity entity = ormResource().getEntityMappings().getEntities().get(0);
+
+ entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute");
+ assertEquals("transientAttribute", entity.getAttributes().getTransients().get(0).getName());
+
+ entityPersistentType.removeSpecifiedXmlPersistentAttribute(entityPersistentType.attributeNamed("transientAttribute"));
+ assertNull(entity.getAttributes());
+ }
+
+ public void testUpdateSpecifiedPersistentAttributes() throws Exception {
+ XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
+ Entity entity = ormResource().getEntityMappings().getEntities().get(0);
+
+ entity.setAttributes(OrmFactory.eINSTANCE.createAttributes());
+ BasicImpl basic = OrmFactory.eINSTANCE.createBasicImpl();
+ entity.getAttributes().getBasics().add(basic);
+ basic.setName("basicAttribute");
+
+ XmlPersistentAttribute xmlPersistentAttribute = entityPersistentType.attributes().next();
+ assertEquals("basicAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+
+ EmbeddedImpl embedded = OrmFactory.eINSTANCE.createEmbeddedImpl();
+ entity.getAttributes().getEmbeddeds().add(embedded);
+ embedded.setName("embeddedAttribute");
+
+ ListIterator<XmlPersistentAttribute> attributes = entityPersistentType.attributes();
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("basicAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("embeddedAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ assertFalse(attributes.hasNext());
+
+ VersionImpl version = OrmFactory.eINSTANCE.createVersionImpl();
+ entity.getAttributes().getVersions().add(version);
+ version.setName("versionAttribute");
+
+ attributes = entityPersistentType.attributes();
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("basicAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("versionAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("embeddedAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ assertFalse(attributes.hasNext());
+
+ IdImpl id = OrmFactory.eINSTANCE.createIdImpl();
+ entity.getAttributes().getIds().add(id);
+ id.setName("idAttribute");
+
+ attributes = entityPersistentType.attributes();
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("idAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("basicAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("versionAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("embeddedAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ assertFalse(attributes.hasNext());
+
+ TransientImpl transientResource = OrmFactory.eINSTANCE.createTransientImpl();
+ entity.getAttributes().getTransients().add(transientResource);
+ transientResource.setName("transientAttribute");
+
+ attributes = entityPersistentType.attributes();
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("idAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("basicAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("versionAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("embeddedAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("transientAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ assertFalse(attributes.hasNext());
+
+ ManyToOneImpl manyToOneResource = OrmFactory.eINSTANCE.createManyToOneImpl();
+ entity.getAttributes().getManyToOnes().add(manyToOneResource);
+ manyToOneResource.setName("manyToOneAttribute");
+
+ attributes = entityPersistentType.attributes();
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("idAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("basicAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("versionAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("manyToOneAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("embeddedAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("transientAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ assertFalse(attributes.hasNext());
+
+ ManyToManyImpl manyToManyResource = OrmFactory.eINSTANCE.createManyToManyImpl();
+ entity.getAttributes().getManyToManys().add(manyToManyResource);
+ manyToManyResource.setName("manyToManyAttribute");
+
+ attributes = entityPersistentType.attributes();
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("idAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("basicAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("versionAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("manyToOneAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("manyToManyAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("embeddedAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("transientAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ assertFalse(attributes.hasNext());
+
+ OneToManyImpl oneToManyResource = OrmFactory.eINSTANCE.createOneToManyImpl();
+ entity.getAttributes().getOneToManys().add(oneToManyResource);
+ oneToManyResource.setName("oneToManyAttribute");
+
+ attributes = entityPersistentType.attributes();
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("idAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("basicAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("versionAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("manyToOneAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("oneToManyAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("manyToManyAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("embeddedAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("transientAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ assertFalse(attributes.hasNext());
+
+ OneToOneImpl oneToOneResource = OrmFactory.eINSTANCE.createOneToOneImpl();
+ entity.getAttributes().getOneToOnes().add(oneToOneResource);
+ oneToOneResource.setName("oneToOneAttribute");
+
+ attributes = entityPersistentType.attributes();
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("idAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("basicAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("versionAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("manyToOneAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("oneToManyAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("oneToOneAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("manyToManyAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("embeddedAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("transientAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ assertFalse(attributes.hasNext());
+
+
+ EmbeddedIdImpl embeddedIdResource = OrmFactory.eINSTANCE.createEmbeddedIdImpl();
+ entity.getAttributes().getEmbeddedIds().add(embeddedIdResource);
+ embeddedIdResource.setName("embeddedIdAttribute");
+
+ attributes = entityPersistentType.attributes();
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("idAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("embeddedIdAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("basicAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("versionAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("manyToOneAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("oneToManyAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("oneToOneAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("manyToManyAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("embeddedAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ xmlPersistentAttribute = attributes.next();
+ assertEquals("transientAttribute", xmlPersistentAttribute.getName());
+ assertEquals(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey());
+ assertFalse(attributes.hasNext());
+
+ entity.getAttributes().getBasics().remove(0);
+ entity.getAttributes().getEmbeddeds().remove(0);
+ entity.getAttributes().getTransients().remove(0);
+ entity.getAttributes().getIds().remove(0);
+ entity.getAttributes().getVersions().remove(0);
+ entity.getAttributes().getManyToOnes().remove(0);
+ entity.getAttributes().getManyToManys().remove(0);
+ entity.getAttributes().getOneToManys().remove(0);
+ entity.getAttributes().getOneToOnes().remove(0);
+ entity.getAttributes().getEmbeddedIds().remove(0);
+ assertFalse(entityPersistentType.attributes().hasNext());
+ assertNotNull(entity.getAttributes());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlPrimaryKeyJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlPrimaryKeyJoinColumnTests.java
new file mode 100644
index 0000000000..1a04472bb5
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlPrimaryKeyJoinColumnTests.java
@@ -0,0 +1,308 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.XmlEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.context.orm.XmlPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.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.iterators.ArrayIterator;
+
+public class XmlPrimaryKeyJoinColumnTests extends ContextModelTestCase
+{
+ public XmlPrimaryKeyJoinColumnTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createIdAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Id", "");
+ }
+
+ private IType createTestEntity() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestSubType() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
+ sb.append("extends " + TYPE_NAME + " ");
+ sb.append("{}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
+ }
+
+ public void testUpdateSpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0);
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ PrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0);
+
+ assertNull(xmlPrimaryKeyJoinColumn.getSpecifiedName());
+ assertNull(primaryKeyJoinColumnResource.getName());
+
+ //set name in the resource model, verify context model updated
+ primaryKeyJoinColumnResource.setName("FOO");
+ ormResource().save(null);
+ assertEquals("FOO", xmlPrimaryKeyJoinColumn.getSpecifiedName());
+ assertEquals("FOO", primaryKeyJoinColumnResource.getName());
+
+ //set name to null in the resource model
+ primaryKeyJoinColumnResource.setName(null);
+ ormResource().save(null);
+ assertNull(xmlPrimaryKeyJoinColumn.getSpecifiedName());
+ assertNull(primaryKeyJoinColumnResource.getName());
+
+ primaryKeyJoinColumnResource.setName("FOO");
+ assertEquals("FOO", xmlPrimaryKeyJoinColumn.getSpecifiedName());
+ assertEquals("FOO", primaryKeyJoinColumnResource.getName());
+
+ entityResource.getPrimaryKeyJoinColumns().remove(0);
+ ormResource().save(null);
+ assertFalse(xmlEntity.primaryKeyJoinColumns().hasNext());
+ assertTrue(entityResource.getPrimaryKeyJoinColumns().isEmpty());
+ }
+
+ public void testModifySpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0);
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ PrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0);
+
+ assertNull(xmlPrimaryKeyJoinColumn.getSpecifiedName());
+ assertNull(primaryKeyJoinColumnResource.getName());
+
+ //set name in the context model, verify resource model modified
+ xmlPrimaryKeyJoinColumn.setSpecifiedName("foo");
+ assertEquals("foo", xmlPrimaryKeyJoinColumn.getSpecifiedName());
+ assertEquals("foo", primaryKeyJoinColumnResource.getName());
+
+ //set name to null in the context model
+ xmlPrimaryKeyJoinColumn.setSpecifiedName(null);
+ assertNull(xmlPrimaryKeyJoinColumn.getSpecifiedName());
+ assertNull(entityResource.getPrimaryKeyJoinColumns().get(0).getName());
+ }
+
+ public void testUpdateSpecifiedReferencedColumnName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0);
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ PrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0);
+
+ assertNull(xmlPrimaryKeyJoinColumn.getSpecifiedReferencedColumnName());
+ assertNull(primaryKeyJoinColumnResource.getReferencedColumnName());
+
+ //set name in the resource model, verify context model updated
+ primaryKeyJoinColumnResource.setReferencedColumnName("FOO");
+ ormResource().save(null);
+ assertEquals("FOO", xmlPrimaryKeyJoinColumn.getSpecifiedReferencedColumnName());
+ assertEquals("FOO", primaryKeyJoinColumnResource.getReferencedColumnName());
+
+ //set name to null in the resource model
+ primaryKeyJoinColumnResource.setReferencedColumnName(null);
+ assertNull(xmlPrimaryKeyJoinColumn.getSpecifiedReferencedColumnName());
+ assertNull(primaryKeyJoinColumnResource.getReferencedColumnName());
+
+ primaryKeyJoinColumnResource.setReferencedColumnName("FOO");
+ assertEquals("FOO", xmlPrimaryKeyJoinColumn.getSpecifiedReferencedColumnName());
+ assertEquals("FOO", primaryKeyJoinColumnResource.getReferencedColumnName());
+
+ entityResource.getPrimaryKeyJoinColumns().remove(0);
+ assertFalse(xmlEntity.primaryKeyJoinColumns().hasNext());
+ assertTrue(entityResource.getPrimaryKeyJoinColumns().isEmpty());
+ }
+
+ public void testModifySpecifiedReferencedColumnName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0);
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ PrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0);
+
+ assertNull(xmlPrimaryKeyJoinColumn.getSpecifiedReferencedColumnName());
+ assertNull(primaryKeyJoinColumnResource.getReferencedColumnName());
+
+ //set name in the context model, verify resource model modified
+ xmlPrimaryKeyJoinColumn.setSpecifiedReferencedColumnName("foo");
+ assertEquals("foo", xmlPrimaryKeyJoinColumn.getSpecifiedReferencedColumnName());
+ assertEquals("foo", primaryKeyJoinColumnResource.getReferencedColumnName());
+
+ //set name to null in the context model
+ xmlPrimaryKeyJoinColumn.setSpecifiedReferencedColumnName(null);
+ assertNull(xmlPrimaryKeyJoinColumn.getSpecifiedReferencedColumnName());
+ assertNull(entityResource.getPrimaryKeyJoinColumns().get(0).getReferencedColumnName());
+ }
+
+// public void testUpdateDefaultNameFromJavaTable() throws Exception {
+// createTestEntity();
+//
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.javaEntity().getTable().setSpecifiedName("Foo");
+// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+// xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.setSpecifiedMetadataComplete(null);
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+//
+// xmlEntity.getTable().setSpecifiedName("Bar");
+// assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+// }
+//
+// public void testUpdateDefaultNameNoJava() throws Exception {
+// createTestEntity();
+//
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+// }
+//
+// public void testUpdateDefaultNameFromParent() throws Exception {
+// createTestEntity();
+// createTestSubType();
+//
+// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping();
+// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping();
+//
+// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+// assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName());
+//
+// parentXmlEntity.getTable().setSpecifiedName("FOO");
+// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+// assertEquals("FOO", childXmlEntity.getTable().getDefaultName());
+//
+// parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+// assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+// assertEquals("AnnotationTestTypeChild", childXmlEntity.getTable().getDefaultName());
+// }
+
+
+ public void testUpdateSpecifiedColumnDefinition() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0);
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ PrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0);
+
+ assertNull(xmlPrimaryKeyJoinColumn.getColumnDefinition());
+ assertNull(primaryKeyJoinColumnResource.getColumnDefinition());
+
+ //set name in the resource model, verify context model updated
+ primaryKeyJoinColumnResource.setColumnDefinition("FOO");
+ assertEquals("FOO", xmlPrimaryKeyJoinColumn.getColumnDefinition());
+ assertEquals("FOO", primaryKeyJoinColumnResource.getColumnDefinition());
+
+ //set name to null in the resource model
+ primaryKeyJoinColumnResource.setColumnDefinition(null);
+ assertNull(xmlPrimaryKeyJoinColumn.getColumnDefinition());
+ assertNull(primaryKeyJoinColumnResource.getColumnDefinition());
+
+ primaryKeyJoinColumnResource.setColumnDefinition("FOO");
+ assertEquals("FOO", xmlPrimaryKeyJoinColumn.getColumnDefinition());
+ assertEquals("FOO", primaryKeyJoinColumnResource.getColumnDefinition());
+
+ entityResource.getPrimaryKeyJoinColumns().remove(0);
+ assertFalse(xmlEntity.primaryKeyJoinColumns().hasNext());
+ assertTrue(entityResource.getPrimaryKeyJoinColumns().isEmpty());
+ }
+
+ public void testModifySpecifiedColumnDefinition() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0);
+
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ PrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0);
+
+ assertNull(xmlPrimaryKeyJoinColumn.getColumnDefinition());
+ assertNull(primaryKeyJoinColumnResource.getColumnDefinition());
+
+ //set name in the context model, verify resource model modified
+ xmlPrimaryKeyJoinColumn.setColumnDefinition("foo");
+ assertEquals("foo", xmlPrimaryKeyJoinColumn.getColumnDefinition());
+ assertEquals("foo", primaryKeyJoinColumnResource.getColumnDefinition());
+
+ //set name to null in the context model
+ xmlPrimaryKeyJoinColumn.setColumnDefinition(null);
+ assertNull(xmlPrimaryKeyJoinColumn.getColumnDefinition());
+ assertNull(entityResource.getPrimaryKeyJoinColumns().get(0).getColumnDefinition());
+ }
+
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlQueryHintTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlQueryHintTests.java
new file mode 100644
index 0000000000..ea6a41e786
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlQueryHintTests.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.XmlEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.context.orm.XmlQueryHint;
+import org.eclipse.jpt.core.internal.resource.orm.QueryHint;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class XmlQueryHintTests extends ContextModelTestCase
+{
+ public XmlQueryHintTests(String name) {
+ super(name);
+ }
+
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ public void testUpdateName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlQueryHint xmlQueryHint = xmlEntity.addNamedQuery(0).addHint(0);
+
+ QueryHint queryHintResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0).getHints().get(0);
+
+ assertNull(xmlQueryHint.getName());
+ assertNull(queryHintResource.getName());
+
+ //set name in the resource model, verify context model updated
+ queryHintResource.setName("newName");
+ assertEquals("newName", xmlQueryHint.getName());
+ assertEquals("newName", queryHintResource.getName());
+
+ //set name to null in the resource model
+ queryHintResource.setName(null);
+ assertNull(xmlQueryHint.getName());
+ assertNull(queryHintResource.getName());
+ }
+
+ public void testModifyName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlQueryHint xmlQueryHint = xmlEntity.addNamedQuery(0).addHint(0);
+
+ QueryHint queryHintResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0).getHints().get(0);
+
+ assertNull(xmlQueryHint.getName());
+ assertNull(queryHintResource.getName());
+
+ //set name in the context model, verify resource model updated
+ xmlQueryHint.setName("newName");
+ assertEquals("newName", xmlQueryHint.getName());
+ assertEquals("newName", queryHintResource.getName());
+
+ //set name to null in the context model
+ xmlQueryHint.setName(null);
+ assertNull(xmlQueryHint.getName());
+ assertNull(queryHintResource.getName());
+ }
+
+ public void testUpdateValue() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlQueryHint xmlQueryHint = xmlEntity.addNamedQuery(0).addHint(0);
+
+ QueryHint queryHintResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0).getHints().get(0);
+
+ assertNull(xmlQueryHint.getValue());
+ assertNull(queryHintResource.getValue());
+
+ //set name in the resource model, verify context model updated
+ queryHintResource.setValue("newName");
+ assertEquals("newName", xmlQueryHint.getValue());
+ assertEquals("newName", queryHintResource.getValue());
+
+ //set name to null in the resource model
+ queryHintResource.setValue(null);
+ assertNull(xmlQueryHint.getValue());
+ assertNull(queryHintResource.getValue());
+ }
+
+ public void testModifyValue() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlQueryHint xmlQueryHint = xmlEntity.addNamedQuery(0).addHint(0);
+
+ QueryHint queryHintResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0).getHints().get(0);
+
+ assertNull(xmlQueryHint.getValue());
+ assertNull(queryHintResource.getValue());
+
+ //set name in the context model, verify resource model updated
+ xmlQueryHint.setValue("newName");
+ assertEquals("newName", xmlQueryHint.getValue());
+ assertEquals("newName", queryHintResource.getValue());
+
+ //set name to null in the context model
+ xmlQueryHint.setValue(null);
+ assertNull(xmlQueryHint.getValue());
+ assertNull(queryHintResource.getValue());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlSecondaryTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlSecondaryTableTests.java
new file mode 100644
index 0000000000..c716e9daf0
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlSecondaryTableTests.java
@@ -0,0 +1,497 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.ISecondaryTable;
+import org.eclipse.jpt.core.internal.context.orm.XmlEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.context.orm.XmlPrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.context.orm.XmlSecondaryTable;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.orm.SecondaryTable;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.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.iterators.ArrayIterator;
+
+public class XmlSecondaryTableTests extends ContextModelTestCase
+{
+ public XmlSecondaryTableTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createIdAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Id", "");
+ }
+
+ private IType createTestEntity() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestSubType() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
+ sb.append("extends " + TYPE_NAME + " ");
+ sb.append("{}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
+ }
+
+ public void testUpdateSpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ //set name in the resource model, verify context model updated
+ entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createSecondaryTable());
+ entityResource.getSecondaryTables().get(0).setName("FOO");
+ XmlSecondaryTable secondaryTable = xmlEntity.specifiedSecondaryTables().next();
+ assertEquals("FOO", secondaryTable.getSpecifiedName());
+ assertEquals("FOO", entityResource.getSecondaryTables().get(0).getName());
+
+ //set name to null in the resource model
+ entityResource.getSecondaryTables().get(0).setName(null);
+ assertNull(secondaryTable.getSpecifiedName());
+ assertNull(entityResource.getSecondaryTables().get(0).getName());
+
+ entityResource.getSecondaryTables().remove(0);
+ assertFalse(xmlEntity.specifiedSecondaryTables().hasNext());
+ assertEquals(0, entityResource.getSecondaryTables().size());
+ }
+
+ public void testModifySpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ //set name in the context model, verify resource model modified
+ XmlSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0);
+ secondaryTable.setSpecifiedName("foo");
+
+ assertEquals("foo", secondaryTable.getSpecifiedName());
+ assertEquals("foo", entityResource.getSecondaryTables().get(0).getName());
+
+ //set name to null in the context model
+ secondaryTable.setSpecifiedName(null);
+ assertNull(secondaryTable.getSpecifiedName());
+ assertNull(entityResource.getSecondaryTables().get(0).getName());
+
+ xmlEntity.removeSpecifiedSecondaryTable(0);
+ assertFalse(xmlEntity.specifiedSecondaryTables().hasNext());
+ assertEquals(0, entityResource.getSecondaryTables().size());
+ }
+
+ public void testUpdateDefaultNameFromJavaTable() throws Exception {
+ createTestEntity();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+
+ xmlEntity.javaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
+ XmlSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0);
+ secondaryTable.setSpecifiedName("FOO");
+ assertNull(secondaryTable.getDefaultName());
+ }
+
+ public void testUpdateSpecifiedSchema() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ //set schema in the resource model, verify context model updated
+ entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createSecondaryTable());
+ entityResource.getSecondaryTables().get(0).setSchema("FOO");
+ XmlSecondaryTable secondaryTable = xmlEntity.specifiedSecondaryTables().next();
+ assertEquals("FOO", secondaryTable.getSpecifiedSchema());
+ assertEquals("FOO", entityResource.getSecondaryTables().get(0).getSchema());
+
+ //set schema to null in the resource model
+ entityResource.getSecondaryTables().get(0).setSchema(null);
+ assertNull(secondaryTable.getSpecifiedSchema());
+ assertNull(entityResource.getSecondaryTables().get(0).getSchema());
+
+ entityResource.getSecondaryTables().remove(0);
+ assertFalse(xmlEntity.specifiedSecondaryTables().hasNext());
+ assertEquals(0, entityResource.getSecondaryTables().size());
+ }
+
+ public void testModifySpecifiedSchema() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ //set schema in the context model, verify resource model modified
+ XmlSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0);
+ secondaryTable.setSpecifiedSchema("foo");
+
+ assertEquals("foo", secondaryTable.getSpecifiedSchema());
+ assertEquals("foo", entityResource.getSecondaryTables().get(0).getSchema());
+
+ //set schema to null in the context model
+ secondaryTable.setSpecifiedSchema(null);
+ assertNull(secondaryTable.getSpecifiedSchema());
+ assertNull(entityResource.getSecondaryTables().get(0).getSchema());
+
+ xmlEntity.removeSpecifiedSecondaryTable(0);
+ assertFalse(xmlEntity.specifiedSecondaryTables().hasNext());
+ assertEquals(0, entityResource.getSecondaryTables().size());
+ }
+
+ public void testUpdateDefaultSchemaFromJavaTable() throws Exception {
+ createTestEntity();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+
+ ISecondaryTable javaSecondaryTable = xmlEntity.javaEntity().addSpecifiedSecondaryTable(0);
+ javaSecondaryTable.setSpecifiedName("FOO");
+ javaSecondaryTable.setSpecifiedSchema("BAR");
+ XmlSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0);
+ secondaryTable.setSpecifiedName("FOO");
+ assertNull(secondaryTable.getDefaultSchema());
+ }
+
+// public void testUpdateDefaultSchemaFromParent() throws Exception {
+// createTestEntity();
+// createTestSubType();
+//
+// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(FULLY_QUALIFIED_TYPE_NAME, IMappingKeys.ENTITY_TYPE_MAPPING_KEY);
+// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild", IMappingKeys.ENTITY_TYPE_MAPPING_KEY);
+// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping();
+// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping();
+//
+// assertNull(parentXmlEntity.getTable().getDefaultSchema());
+// assertNull(childXmlEntity.getTable().getDefaultSchema());
+//
+// parentXmlEntity.getTable().setSpecifiedSchema("FOO");
+// assertNull(parentXmlEntity.getTable().getDefaultSchema());
+// assertEquals("FOO", childXmlEntity.getTable().getDefaultSchema());
+//
+// parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+// assertNull(parentXmlEntity.getTable().getDefaultSchema());
+// assertNull(childXmlEntity.getTable().getDefaultSchema());
+// }
+//
+ public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
+ createTestEntity();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0);
+ xmlSecondaryTable.setSpecifiedName("FOO");
+ assertNull(xmlSecondaryTable.getDefaultSchema());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema("FOO");
+ assertEquals("FOO", xmlSecondaryTable.getDefaultSchema());
+
+ xmlEntity.entityMappings().setSpecifiedSchema("BAR");
+ assertEquals("BAR", xmlSecondaryTable.getDefaultSchema());
+
+ ISecondaryTable javaSecondaryTable = xmlEntity.javaEntity().addSpecifiedSecondaryTable(0);
+ javaSecondaryTable.setSpecifiedName("FOO");
+ javaSecondaryTable.setSpecifiedSchema("JAVA_SCHEMA");
+ assertEquals("BAR", xmlSecondaryTable.getDefaultSchema()); //schema is not defaulted from underlying java
+
+ xmlEntity.entityMappings().setSpecifiedSchema(null);
+ assertEquals("FOO", xmlSecondaryTable.getDefaultSchema());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema(null);
+ assertNull(xmlSecondaryTable.getDefaultSchema());
+ }
+
+ public void testUpdateSpecifiedCatalog() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ //set catalog in the resource model, verify context model updated
+ entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createSecondaryTable());
+ entityResource.getSecondaryTables().get(0).setCatalog("FOO");
+ XmlSecondaryTable secondaryTable = xmlEntity.specifiedSecondaryTables().next();
+ assertEquals("FOO", secondaryTable.getSpecifiedCatalog());
+ assertEquals("FOO", entityResource.getSecondaryTables().get(0).getCatalog());
+
+ //set catalog to null in the resource model
+ entityResource.getSecondaryTables().get(0).setCatalog(null);
+ assertNull(secondaryTable.getSpecifiedCatalog());
+ assertNull(entityResource.getSecondaryTables().get(0).getCatalog());
+
+ entityResource.getSecondaryTables().remove(0);
+ assertFalse(xmlEntity.specifiedSecondaryTables().hasNext());
+ assertEquals(0, entityResource.getSecondaryTables().size());
+ }
+
+ public void testModifySpecifiedCatalog() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+
+ //set catalog in the context model, verify resource model modified
+ XmlSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0);
+ secondaryTable.setSpecifiedCatalog("foo");
+
+ assertEquals("foo", secondaryTable.getSpecifiedCatalog());
+ assertEquals("foo", entityResource.getSecondaryTables().get(0).getCatalog());
+
+ //set catalog to null in the context model
+ secondaryTable.setSpecifiedCatalog(null);
+ assertNull(secondaryTable.getSpecifiedCatalog());
+ assertNull(entityResource.getSecondaryTables().get(0).getCatalog());
+
+ xmlEntity.removeSpecifiedSecondaryTable(0);
+ assertFalse(xmlEntity.specifiedSecondaryTables().hasNext());
+ assertEquals(0, entityResource.getSecondaryTables().size());
+ }
+
+ public void testUpdateDefaultCatalogFromJavaTable() throws Exception {
+ createTestEntity();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+
+ ISecondaryTable javaSecondaryTable = xmlEntity.javaEntity().addSpecifiedSecondaryTable(0);
+ javaSecondaryTable.setSpecifiedName("FOO");
+ javaSecondaryTable.setSpecifiedCatalog("BAR");
+ XmlSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0);
+ secondaryTable.setSpecifiedName("FOO");
+ assertNull(secondaryTable.getDefaultCatalog());
+ }
+
+ public void testUpdateDefaultCatalogFromPersistenceUnitDefaults() throws Exception {
+ createTestEntity();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0);
+ xmlSecondaryTable.setSpecifiedName("FOO");
+ assertNull(xmlSecondaryTable.getDefaultCatalog());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("FOO");
+ assertEquals("FOO", xmlSecondaryTable.getDefaultCatalog());
+
+ xmlEntity.entityMappings().setSpecifiedCatalog("BAR");
+ assertEquals("BAR", xmlSecondaryTable.getDefaultCatalog());
+
+ ISecondaryTable javaSecondaryTable = xmlEntity.javaEntity().addSpecifiedSecondaryTable(0);
+ javaSecondaryTable.setSpecifiedName("FOO");
+ javaSecondaryTable.setSpecifiedCatalog("JAVA_CATALOG");
+ assertEquals("BAR", xmlSecondaryTable.getDefaultCatalog()); //schema is not defaulted from underlying java
+
+ xmlEntity.entityMappings().setSpecifiedCatalog(null);
+ assertEquals("FOO", xmlSecondaryTable.getDefaultCatalog());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog(null);
+ assertNull(xmlSecondaryTable.getDefaultCatalog());
+ }
+
+ public void testAddSpecifiedPrimaryKeyJoinColumn() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+ XmlSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0);
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ SecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0);
+
+ XmlPrimaryKeyJoinColumn primaryKeyJoinColumn = xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(0);
+ ormResource().save(null);
+ primaryKeyJoinColumn.setSpecifiedName("FOO");
+ ormResource().save(null);
+
+ assertEquals("FOO", secondaryTableResource.getPrimaryKeyJoinColumns().get(0).getName());
+
+ XmlPrimaryKeyJoinColumn primaryKeyJoinColumn2 = xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(0);
+ ormResource().save(null);
+ primaryKeyJoinColumn2.setSpecifiedName("BAR");
+ ormResource().save(null);
+
+ assertEquals("BAR", secondaryTableResource.getPrimaryKeyJoinColumns().get(0).getName());
+ assertEquals("FOO", secondaryTableResource.getPrimaryKeyJoinColumns().get(1).getName());
+
+ XmlPrimaryKeyJoinColumn primaryKeyJoinColumn3 = xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(1);
+ ormResource().save(null);
+ primaryKeyJoinColumn3.setSpecifiedName("BAZ");
+ ormResource().save(null);
+
+ assertEquals("BAR", secondaryTableResource.getPrimaryKeyJoinColumns().get(0).getName());
+ assertEquals("BAZ", secondaryTableResource.getPrimaryKeyJoinColumns().get(1).getName());
+ assertEquals("FOO", secondaryTableResource.getPrimaryKeyJoinColumns().get(2).getName());
+
+ ListIterator<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlSecondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals(primaryKeyJoinColumn2, primaryKeyJoinColumns.next());
+ assertEquals(primaryKeyJoinColumn3, primaryKeyJoinColumns.next());
+ assertEquals(primaryKeyJoinColumn, primaryKeyJoinColumns.next());
+
+ primaryKeyJoinColumns = xmlSecondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAR", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+ }
+
+ public void testRemoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+ XmlSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0);
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ SecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0);
+
+ xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
+ xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
+ xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
+
+ assertEquals(3, secondaryTableResource.getPrimaryKeyJoinColumns().size());
+
+ xmlSecondaryTable.removeSpecifiedPrimaryKeyJoinColumn(0);
+ assertEquals(2, secondaryTableResource.getPrimaryKeyJoinColumns().size());
+ assertEquals("BAR", secondaryTableResource.getPrimaryKeyJoinColumns().get(0).getName());
+ assertEquals("BAZ", secondaryTableResource.getPrimaryKeyJoinColumns().get(1).getName());
+
+ xmlSecondaryTable.removeSpecifiedPrimaryKeyJoinColumn(0);
+ assertEquals(1, secondaryTableResource.getPrimaryKeyJoinColumns().size());
+ assertEquals("BAZ", secondaryTableResource.getPrimaryKeyJoinColumns().get(0).getName());
+
+ xmlSecondaryTable.removeSpecifiedPrimaryKeyJoinColumn(0);
+ assertEquals(0, secondaryTableResource.getPrimaryKeyJoinColumns().size());
+ }
+
+ public void testMoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+ XmlSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0);
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ SecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0);
+
+ xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
+ xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
+ xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
+
+ assertEquals(3, secondaryTableResource.getPrimaryKeyJoinColumns().size());
+
+
+ xmlSecondaryTable.moveSpecifiedPrimaryKeyJoinColumn(2, 0);
+ ListIterator<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlSecondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAR", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+
+ assertEquals("BAR", secondaryTableResource.getPrimaryKeyJoinColumns().get(0).getName());
+ assertEquals("BAZ", secondaryTableResource.getPrimaryKeyJoinColumns().get(1).getName());
+ assertEquals("FOO", secondaryTableResource.getPrimaryKeyJoinColumns().get(2).getName());
+
+
+ xmlSecondaryTable.moveSpecifiedPrimaryKeyJoinColumn(0, 1);
+ primaryKeyJoinColumns = xmlSecondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAR", primaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+
+ assertEquals("BAZ", secondaryTableResource.getPrimaryKeyJoinColumns().get(0).getName());
+ assertEquals("BAR", secondaryTableResource.getPrimaryKeyJoinColumns().get(1).getName());
+ assertEquals("FOO", secondaryTableResource.getPrimaryKeyJoinColumns().get(2).getName());
+ }
+
+ public void testUpdatePrimaryKeyJoinColumns() throws Exception {
+ XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping();
+ XmlSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0);
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ SecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0);
+
+ secondaryTableResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createPrimaryKeyJoinColumn());
+ secondaryTableResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createPrimaryKeyJoinColumn());
+ secondaryTableResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createPrimaryKeyJoinColumn());
+
+ secondaryTableResource.getPrimaryKeyJoinColumns().get(0).setName("FOO");
+ secondaryTableResource.getPrimaryKeyJoinColumns().get(1).setName("BAR");
+ secondaryTableResource.getPrimaryKeyJoinColumns().get(2).setName("BAZ");
+
+ ListIterator<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlSecondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAR", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertFalse(primaryKeyJoinColumns.hasNext());
+
+ secondaryTableResource.getPrimaryKeyJoinColumns().move(2, 0);
+ primaryKeyJoinColumns = xmlSecondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAR", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+ assertFalse(primaryKeyJoinColumns.hasNext());
+
+ secondaryTableResource.getPrimaryKeyJoinColumns().move(0, 1);
+ primaryKeyJoinColumns = xmlSecondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertEquals("BAR", primaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+ assertFalse(primaryKeyJoinColumns.hasNext());
+
+ secondaryTableResource.getPrimaryKeyJoinColumns().remove(1);
+ primaryKeyJoinColumns = xmlSecondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertEquals("FOO", primaryKeyJoinColumns.next().getName());
+ assertFalse(primaryKeyJoinColumns.hasNext());
+
+ secondaryTableResource.getPrimaryKeyJoinColumns().remove(1);
+ primaryKeyJoinColumns = xmlSecondaryTable.specifiedPrimaryKeyJoinColumns();
+ assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
+ assertFalse(primaryKeyJoinColumns.hasNext());
+
+ secondaryTableResource.getPrimaryKeyJoinColumns().remove(0);
+ assertFalse(xmlSecondaryTable.specifiedPrimaryKeyJoinColumns().hasNext());
+ }
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlSequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlSequenceGeneratorTests.java
new file mode 100644
index 0000000000..d646674d24
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlSequenceGeneratorTests.java
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.ISequenceGenerator;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.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.iterators.ArrayIterator;
+
+public class XmlSequenceGeneratorTests extends ContextModelTestCase
+{
+ public XmlSequenceGeneratorTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createIdAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Id", "");
+ }
+
+ private IType createTestEntity() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestSubType() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
+ sb.append("extends " + TYPE_NAME + " ");
+ sb.append("{}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
+ }
+
+ public void testUpdateSpecifiedName() throws Exception {
+ ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0);
+ SequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0);
+
+ //set name in the resource model, verify context model updated
+ sequenceGeneratorResource.setName("FOO");
+ assertEquals("FOO", sequenceGenerator.getName());
+ assertEquals("FOO", sequenceGeneratorResource.getName());
+
+ //set name to null in the resource model
+ sequenceGeneratorResource.setName(null);
+ assertNull(sequenceGenerator.getName());
+ assertNull(sequenceGeneratorResource.getName());
+ }
+
+ public void testModifySpecifiedName() throws Exception {
+ ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0);
+ SequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0);
+
+ //set name in the context model, verify resource model modified
+ sequenceGenerator.setName("FOO");
+ assertEquals("FOO", sequenceGeneratorResource.getName());
+ assertEquals("FOO", sequenceGenerator.getName());
+
+ //set name to null in the context model
+ sequenceGenerator.setName(null);
+ assertNull(sequenceGeneratorResource.getName());
+ assertNull(sequenceGenerator.getName());
+ }
+
+ public void testUpdateSpecifiedSequenceName() throws Exception {
+ ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0);
+ SequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0);
+
+ //set name in the resource model, verify context model updated
+ sequenceGeneratorResource.setSequenceName("FOO");
+ assertEquals("FOO", sequenceGenerator.getSpecifiedSequenceName());
+ assertEquals("FOO", sequenceGeneratorResource.getSequenceName());
+
+ //set name to null in the resource model
+ sequenceGeneratorResource.setSequenceName(null);
+ assertNull(sequenceGenerator.getSpecifiedSequenceName());
+ assertNull(sequenceGeneratorResource.getSequenceName());
+ }
+
+ public void testModifySpecifiedSequenceName() throws Exception {
+ ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0);
+ SequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0);
+
+ //set name in the context model, verify resource model modified
+ sequenceGenerator.setSpecifiedSequenceName("FOO");
+ assertEquals("FOO", sequenceGeneratorResource.getSequenceName());
+ assertEquals("FOO", sequenceGenerator.getSpecifiedSequenceName());
+
+ //set name to null in the context model
+ sequenceGenerator.setSpecifiedSequenceName(null);
+ assertNull(sequenceGeneratorResource.getSequenceName());
+ assertNull(sequenceGenerator.getSpecifiedSequenceName());
+ }
+
+ public void testUpdateSpecifiedInitialValue() throws Exception {
+ ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0);
+ SequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0);
+
+ //set initial value in the resource model, verify context model updated
+ sequenceGeneratorResource.setInitialValue(Integer.valueOf(10));
+ assertEquals(Integer.valueOf(10), sequenceGenerator.getSpecifiedInitialValue());
+ assertEquals(Integer.valueOf(10), sequenceGeneratorResource.getInitialValue());
+
+ //set initial value to 1, which happens to be the default, in the resource model
+ sequenceGeneratorResource.setInitialValue(Integer.valueOf(1));
+ assertEquals(Integer.valueOf(1), sequenceGenerator.getSpecifiedInitialValue());
+ assertEquals(Integer.valueOf(1), sequenceGeneratorResource.getInitialValue());
+
+ //set initial value to null in the resource model
+ sequenceGeneratorResource.setInitialValue(null);
+ assertNull(sequenceGenerator.getSpecifiedInitialValue());
+ assertNull(sequenceGeneratorResource.getInitialValue());
+ }
+
+ public void testModifySpecifiedInitialValue() throws Exception {
+ ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0);
+ SequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0);
+
+ //set initial value in the context model, verify resource model modified
+ sequenceGenerator.setSpecifiedInitialValue(Integer.valueOf(10));
+ assertEquals(Integer.valueOf(10), sequenceGeneratorResource.getInitialValue());
+ assertEquals(Integer.valueOf(10), sequenceGenerator.getSpecifiedInitialValue());
+
+ sequenceGenerator.setSpecifiedInitialValue(Integer.valueOf(1));
+ assertEquals(Integer.valueOf(1), sequenceGeneratorResource.getInitialValue());
+ assertEquals(Integer.valueOf(1), sequenceGenerator.getSpecifiedInitialValue());
+
+ //set initial value to null in the context model
+ sequenceGenerator.setSpecifiedInitialValue(null);
+ assertNull(sequenceGeneratorResource.getInitialValue());
+ assertNull(sequenceGenerator.getSpecifiedInitialValue());
+ }
+
+ public void testUpdateSpecifiedAllocationSize() throws Exception {
+ ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0);
+ SequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0);
+
+ //set allocation size in the resource model, verify context model updated
+ sequenceGeneratorResource.setAllocationSize(Integer.valueOf(10));
+ assertEquals(Integer.valueOf(10), sequenceGenerator.getSpecifiedAllocationSize());
+ assertEquals(Integer.valueOf(10), sequenceGeneratorResource.getAllocationSize());
+
+ //set allocation size to 50, which happens to be the default, in the resource model
+ sequenceGeneratorResource.setAllocationSize(Integer.valueOf(1));
+ assertEquals(Integer.valueOf(1), sequenceGenerator.getSpecifiedAllocationSize());
+ assertEquals(Integer.valueOf(1), sequenceGeneratorResource.getAllocationSize());
+
+ //set allocation size to null in the resource model
+ sequenceGeneratorResource.setAllocationSize(null);
+ assertNull(sequenceGenerator.getSpecifiedAllocationSize());
+ assertNull(sequenceGeneratorResource.getAllocationSize());
+ }
+
+ public void testModifySpecifiedAllocationSize() throws Exception {
+ ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0);
+ SequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0);
+
+ //set allocation size in the context model, verify resource model modified
+ sequenceGenerator.setSpecifiedAllocationSize(Integer.valueOf(10));
+ assertEquals(Integer.valueOf(10), sequenceGeneratorResource.getAllocationSize());
+ assertEquals(Integer.valueOf(10), sequenceGenerator.getSpecifiedAllocationSize());
+
+ sequenceGenerator.setSpecifiedAllocationSize(Integer.valueOf(50));
+ assertEquals(Integer.valueOf(50), sequenceGeneratorResource.getAllocationSize());
+ assertEquals(Integer.valueOf(50), sequenceGenerator.getSpecifiedAllocationSize());
+
+ //set allocation size to null in the context model
+ sequenceGenerator.setSpecifiedAllocationSize(null);
+ assertNull(sequenceGeneratorResource.getAllocationSize());
+ assertNull(sequenceGenerator.getSpecifiedAllocationSize());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTableGeneratorTests.java
new file mode 100644
index 0000000000..05c366c748
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTableGeneratorTests.java
@@ -0,0 +1,373 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.ITableGenerator;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.orm.TableGenerator;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.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.iterators.ArrayIterator;
+
+public class XmlTableGeneratorTests extends ContextModelTestCase
+{
+ public XmlTableGeneratorTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createIdAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Id", "");
+ }
+
+ private IType createTestEntity() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestSubType() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
+ sb.append("extends " + TYPE_NAME + " ");
+ sb.append("{}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
+ }
+
+ public void testUpdateSpecifiedName() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set name in the resource model, verify context model updated
+ tableGeneratorResource.setName("FOO");
+ assertEquals("FOO", tableGenerator.getName());
+ assertEquals("FOO", tableGeneratorResource.getName());
+
+ //set name to null in the resource model
+ tableGeneratorResource.setName(null);
+ assertNull(tableGenerator.getName());
+ assertNull(tableGeneratorResource.getName());
+ }
+
+ public void testModifySpecifiedName() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set name in the context model, verify resource model modified
+ tableGenerator.setName("FOO");
+ assertEquals("FOO", tableGeneratorResource.getName());
+ assertEquals("FOO", tableGenerator.getName());
+
+ //set name to null in the context model
+ tableGenerator.setName(null);
+ assertNull(tableGeneratorResource.getName());
+ assertNull(tableGenerator.getName());
+ }
+
+ public void testUpdateSpecifiedInitialValue() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set initial value in the resource model, verify context model updated
+ tableGeneratorResource.setInitialValue(Integer.valueOf(10));
+ assertEquals(Integer.valueOf(10), tableGenerator.getSpecifiedInitialValue());
+ assertEquals(Integer.valueOf(10), tableGeneratorResource.getInitialValue());
+
+ //set initial value to 1, which happens to be the default, in the resource model
+ tableGeneratorResource.setInitialValue(Integer.valueOf(1));
+ assertEquals(Integer.valueOf(1), tableGenerator.getSpecifiedInitialValue());
+ assertEquals(Integer.valueOf(1), tableGeneratorResource.getInitialValue());
+
+ //set initial value to null in the resource model
+ tableGeneratorResource.setInitialValue(null);
+ assertNull(tableGenerator.getSpecifiedInitialValue());
+ assertNull(tableGeneratorResource.getInitialValue());
+ }
+
+ public void testModifySpecifiedInitialValue() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set initial value in the context model, verify resource model modified
+ tableGenerator.setSpecifiedInitialValue(Integer.valueOf(10));
+ assertEquals(Integer.valueOf(10), tableGeneratorResource.getInitialValue());
+ assertEquals(Integer.valueOf(10), tableGenerator.getSpecifiedInitialValue());
+
+ tableGenerator.setSpecifiedInitialValue(Integer.valueOf(1));
+ assertEquals(Integer.valueOf(1), tableGeneratorResource.getInitialValue());
+ assertEquals(Integer.valueOf(1), tableGenerator.getSpecifiedInitialValue());
+
+ //set initial value to null in the context model
+ tableGenerator.setSpecifiedInitialValue(null);
+ assertNull(tableGeneratorResource.getInitialValue());
+ assertNull(tableGenerator.getSpecifiedInitialValue());
+ }
+
+ public void testUpdateSpecifiedAllocationSize() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set allocation size in the resource model, verify context model updated
+ tableGeneratorResource.setAllocationSize(Integer.valueOf(10));
+ assertEquals(Integer.valueOf(10), tableGenerator.getSpecifiedAllocationSize());
+ assertEquals(Integer.valueOf(10), tableGeneratorResource.getAllocationSize());
+
+ //set allocation size to 50, which happens to be the default, in the resource model
+ tableGeneratorResource.setAllocationSize(Integer.valueOf(1));
+ assertEquals(Integer.valueOf(1), tableGenerator.getSpecifiedAllocationSize());
+ assertEquals(Integer.valueOf(1), tableGeneratorResource.getAllocationSize());
+
+ //set allocation size to null in the resource model
+ tableGeneratorResource.setAllocationSize(null);
+ assertNull(tableGenerator.getSpecifiedAllocationSize());
+ assertNull(tableGeneratorResource.getAllocationSize());
+ }
+
+ public void testModifySpecifiedAllocationSize() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set allocation size in the context model, verify resource model modified
+ tableGenerator.setSpecifiedAllocationSize(Integer.valueOf(10));
+ assertEquals(Integer.valueOf(10), tableGeneratorResource.getAllocationSize());
+ assertEquals(Integer.valueOf(10), tableGenerator.getSpecifiedAllocationSize());
+
+ tableGenerator.setSpecifiedAllocationSize(Integer.valueOf(50));
+ assertEquals(Integer.valueOf(50), tableGeneratorResource.getAllocationSize());
+ assertEquals(Integer.valueOf(50), tableGenerator.getSpecifiedAllocationSize());
+
+ //set allocation size to null in the context model
+ tableGenerator.setSpecifiedAllocationSize(null);
+ assertNull(tableGeneratorResource.getAllocationSize());
+ assertNull(tableGenerator.getSpecifiedAllocationSize());
+ }
+
+ public void testUpdateSpecifiedTable() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set name in the resource model, verify context model updated
+ tableGeneratorResource.setTable("FOO");
+ assertEquals("FOO", tableGenerator.getSpecifiedTable());
+ assertEquals("FOO", tableGeneratorResource.getTable());
+
+ //set name to null in the resource model
+ tableGeneratorResource.setTable(null);
+ assertNull(tableGenerator.getSpecifiedTable());
+ assertNull(tableGeneratorResource.getTable());
+ }
+
+ public void testModifySpecifiedTable() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set name in the context model, verify resource model modified
+ tableGenerator.setSpecifiedTable("FOO");
+ assertEquals("FOO", tableGeneratorResource.getTable());
+ assertEquals("FOO", tableGenerator.getSpecifiedTable());
+
+ //set name to null in the context model
+ tableGenerator.setSpecifiedTable(null);
+ assertNull(tableGeneratorResource.getTable());
+ assertNull(tableGenerator.getSpecifiedTable());
+ }
+
+ public void testUpdateSpecifiedSchema() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set name in the resource model, verify context model updated
+ tableGeneratorResource.setSchema("FOO");
+ assertEquals("FOO", tableGenerator.getSpecifiedSchema());
+ assertEquals("FOO", tableGeneratorResource.getSchema());
+
+ //set name to null in the resource model
+ tableGeneratorResource.setSchema(null);
+ assertNull(tableGenerator.getSpecifiedSchema());
+ assertNull(tableGeneratorResource.getSchema());
+ }
+
+ public void testModifySpecifiedSchema() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set name in the context model, verify resource model modified
+ tableGenerator.setSpecifiedSchema("FOO");
+ assertEquals("FOO", tableGeneratorResource.getSchema());
+ assertEquals("FOO", tableGenerator.getSpecifiedSchema());
+
+ //set name to null in the context model
+ tableGenerator.setSpecifiedSchema(null);
+ assertNull(tableGeneratorResource.getSchema());
+ assertNull(tableGenerator.getSpecifiedSchema());
+ }
+
+ public void testUpdateSpecifiedCatalog() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set name in the resource model, verify context model updated
+ tableGeneratorResource.setCatalog("FOO");
+ assertEquals("FOO", tableGenerator.getSpecifiedCatalog());
+ assertEquals("FOO", tableGeneratorResource.getCatalog());
+
+ //set name to null in the resource model
+ tableGeneratorResource.setCatalog(null);
+ assertNull(tableGenerator.getSpecifiedCatalog());
+ assertNull(tableGeneratorResource.getCatalog());
+ }
+
+ public void testModifySpecifiedCatalog() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set name in the context model, verify resource model modified
+ tableGenerator.setSpecifiedCatalog("FOO");
+ assertEquals("FOO", tableGeneratorResource.getCatalog());
+ assertEquals("FOO", tableGenerator.getSpecifiedCatalog());
+
+ //set name to null in the context model
+ tableGenerator.setSpecifiedCatalog(null);
+ assertNull(tableGeneratorResource.getCatalog());
+ assertNull(tableGenerator.getSpecifiedCatalog());
+ }
+
+ public void testUpdateSpecifiedPkColumnName() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set name in the resource model, verify context model updated
+ tableGeneratorResource.setPkColumnName("FOO");
+ assertEquals("FOO", tableGenerator.getSpecifiedPkColumnName());
+ assertEquals("FOO", tableGeneratorResource.getPkColumnName());
+
+ //set name to null in the resource model
+ tableGeneratorResource.setPkColumnName(null);
+ assertNull(tableGenerator.getSpecifiedPkColumnName());
+ assertNull(tableGeneratorResource.getPkColumnName());
+ }
+
+ public void testModifySpecifiedPkColumnName() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set name in the context model, verify resource model modified
+ tableGenerator.setSpecifiedPkColumnName("FOO");
+ assertEquals("FOO", tableGeneratorResource.getPkColumnName());
+ assertEquals("FOO", tableGenerator.getSpecifiedPkColumnName());
+
+ //set name to null in the context model
+ tableGenerator.setSpecifiedPkColumnName(null);
+ assertNull(tableGeneratorResource.getPkColumnName());
+ assertNull(tableGenerator.getSpecifiedPkColumnName());
+ }
+
+ public void testUpdateSpecifiedValueColumnName() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set name in the resource model, verify context model updated
+ tableGeneratorResource.setValueColumnName("FOO");
+ assertEquals("FOO", tableGenerator.getSpecifiedValueColumnName());
+ assertEquals("FOO", tableGeneratorResource.getValueColumnName());
+
+ //set name to null in the resource model
+ tableGeneratorResource.setValueColumnName(null);
+ assertNull(tableGenerator.getSpecifiedValueColumnName());
+ assertNull(tableGeneratorResource.getValueColumnName());
+ }
+
+ public void testModifySpecifiedValueColumnName() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set name in the context model, verify resource model modified
+ tableGenerator.setSpecifiedValueColumnName("FOO");
+ assertEquals("FOO", tableGeneratorResource.getValueColumnName());
+ assertEquals("FOO", tableGenerator.getSpecifiedValueColumnName());
+
+ //set name to null in the context model
+ tableGenerator.setSpecifiedValueColumnName(null);
+ assertNull(tableGeneratorResource.getValueColumnName());
+ assertNull(tableGenerator.getSpecifiedValueColumnName());
+ }
+
+ public void testUpdateSpecifiedPkColumnValue() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set name in the resource model, verify context model updated
+ tableGeneratorResource.setPkColumnValue("FOO");
+ assertEquals("FOO", tableGenerator.getSpecifiedPkColumnValue());
+ assertEquals("FOO", tableGeneratorResource.getPkColumnValue());
+
+ //set name to null in the resource model
+ tableGeneratorResource.setPkColumnValue(null);
+ assertNull(tableGenerator.getSpecifiedPkColumnValue());
+ assertNull(tableGeneratorResource.getPkColumnValue());
+ }
+
+ public void testModifySpecifiedPkColumnValue() throws Exception {
+ ITableGenerator tableGenerator = entityMappings().addTableGenerator(0);
+ TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0);
+
+ //set name in the context model, verify resource model modified
+ tableGenerator.setSpecifiedPkColumnValue("FOO");
+ assertEquals("FOO", tableGeneratorResource.getPkColumnValue());
+ assertEquals("FOO", tableGenerator.getSpecifiedPkColumnValue());
+
+ //set name to null in the context model
+ tableGenerator.setSpecifiedPkColumnValue(null);
+ assertNull(tableGeneratorResource.getPkColumnValue());
+ assertNull(tableGenerator.getSpecifiedPkColumnValue());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTableTests.java
new file mode 100644
index 0000000000..b9d0d393a3
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTableTests.java
@@ -0,0 +1,485 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.InheritanceType;
+import org.eclipse.jpt.core.internal.context.orm.XmlEntity;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.context.orm.XmlTable;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.orm.Entity;
+import org.eclipse.jpt.core.internal.resource.orm.OrmFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.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.iterators.ArrayIterator;
+
+public class XmlTableTests extends ContextModelTestCase
+{
+ public XmlTableTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createIdAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Id", "");
+ }
+
+ private IType createTestEntity() throws Exception {
+ createEntityAnnotation();
+ createIdAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestSubType() throws Exception {
+ SourceWriter sourceWriter = new SourceWriter() {
+ public void appendSourceTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append("import ");
+ sb.append(JPA.ENTITY);
+ sb.append(";");
+ sb.append(CR);
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("public class ").append("AnnotationTestTypeChild").append(" ");
+ sb.append("extends " + TYPE_NAME + " ");
+ sb.append("{}").append(CR);
+ }
+ };
+ return this.javaProject.createType(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter);
+ }
+
+ public void testUpdateSpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlTable xmlTable = xmlEntity.getTable();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlTable.getSpecifiedName());
+ assertNull(entityResource.getTable());
+
+ //set name in the resource model, verify context model updated
+ entityResource.setTable(OrmFactory.eINSTANCE.createTable());
+ entityResource.getTable().setName("FOO");
+ assertEquals("FOO", xmlTable.getSpecifiedName());
+ assertEquals("FOO", entityResource.getTable().getName());
+
+ //set name to null in the resource model
+ entityResource.getTable().setName(null);
+ assertNull(xmlTable.getSpecifiedName());
+ assertNull(entityResource.getTable().getName());
+
+ entityResource.getTable().setName("FOO");
+ assertEquals("FOO", xmlTable.getSpecifiedName());
+ assertEquals("FOO", entityResource.getTable().getName());
+
+ entityResource.setTable(null);
+ assertNull(xmlTable.getSpecifiedName());
+ assertNull(entityResource.getTable());
+ }
+
+ public void testModifySpecifiedName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlTable xmlTable = ((XmlEntity) xmlPersistentType.getMapping()).getTable();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlTable.getSpecifiedName());
+ assertNull(entityResource.getTable());
+
+ //set name in the context model, verify resource model modified
+ xmlTable.setSpecifiedName("foo");
+ assertEquals("foo", xmlTable.getSpecifiedName());
+ assertEquals("foo", entityResource.getTable().getName());
+
+ //set name to null in the context model
+ xmlTable.setSpecifiedName(null);
+ assertNull(xmlTable.getSpecifiedName());
+ assertNull(entityResource.getTable());
+ }
+
+ public void testUpdateDefaultNameFromJavaTable() throws Exception {
+ createTestEntity();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+
+ xmlEntity.javaEntity().getTable().setSpecifiedName("Foo");
+ assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+
+ xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+ assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+ assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+
+ xmlEntity.setSpecifiedMetadataComplete(null);
+ assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+ assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+
+ xmlEntity.getTable().setSpecifiedName("Bar");
+ assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName());
+ }
+
+ public void testUpdateDefaultNameNoJava() throws Exception {
+ createTestEntity();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ assertEquals("Foo", xmlEntity.getTable().getDefaultName());
+ }
+
+ public void testUpdateDefaultNameFromParent() throws Exception {
+ createTestEntity();
+ createTestSubType();
+
+ XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+ XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping();
+ XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping();
+
+ assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+ assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName());
+
+ parentXmlEntity.getTable().setSpecifiedName("FOO");
+ assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+ assertEquals("FOO", childXmlEntity.getTable().getDefaultName());
+
+ parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+ assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName());
+ assertEquals("AnnotationTestTypeChild", childXmlEntity.getTable().getDefaultName());
+ }
+
+ public void testUpdateSpecifiedSchema() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlTable xmlTable = xmlEntity.getTable();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlTable.getSpecifiedSchema());
+ assertNull(entityResource.getTable());
+
+ //set schema in the resource model, verify context model updated
+ entityResource.setTable(OrmFactory.eINSTANCE.createTable());
+ entityResource.getTable().setSchema("FOO");
+ assertEquals("FOO", xmlTable.getSpecifiedSchema());
+ assertEquals("FOO", entityResource.getTable().getSchema());
+
+ //set Schema to null in the resource model
+ entityResource.getTable().setSchema(null);
+ assertNull(xmlTable.getSpecifiedSchema());
+ assertNull(entityResource.getTable().getSchema());
+
+ entityResource.getTable().setSchema("FOO");
+ assertEquals("FOO", xmlTable.getSpecifiedSchema());
+ assertEquals("FOO", entityResource.getTable().getSchema());
+
+ entityResource.setTable(null);
+ assertNull(xmlTable.getSpecifiedSchema());
+ assertNull(entityResource.getTable());
+ }
+
+ public void testUpdateDefaultSchemaFromJavaTable() throws Exception {
+ createTestEntity();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ assertNull(xmlEntity.getTable().getDefaultSchema());
+
+ xmlEntity.javaEntity().getTable().setSpecifiedSchema("Foo");
+ assertEquals("Foo", xmlEntity.getTable().getDefaultSchema());
+
+ xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+ assertNull(xmlEntity.getTable().getDefaultSchema());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+ assertNull(xmlEntity.getTable().getDefaultSchema());
+
+ xmlEntity.setSpecifiedMetadataComplete(null);
+ assertNull(xmlEntity.getTable().getDefaultSchema());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+ assertEquals("Foo", xmlEntity.getTable().getDefaultSchema());
+
+ xmlEntity.getTable().setSpecifiedName("Bar");
+ assertNull(xmlEntity.getTable().getDefaultSchema());
+ }
+
+ public void testUpdateDefaultSchemaNoJava() throws Exception {
+ createTestEntity();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ assertNull(xmlEntity.getTable().getDefaultSchema());
+ }
+
+ public void testUpdateDefaultSchemaFromParent() throws Exception {
+ createTestEntity();
+ createTestSubType();
+
+ XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+ XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping();
+ XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping();
+
+ assertNull(parentXmlEntity.getTable().getDefaultSchema());
+ assertNull(childXmlEntity.getTable().getDefaultSchema());
+
+ parentXmlEntity.getTable().setSpecifiedSchema("FOO");
+ assertNull(parentXmlEntity.getTable().getDefaultSchema());
+ assertEquals("FOO", childXmlEntity.getTable().getDefaultSchema());
+
+ parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+ assertNull(parentXmlEntity.getTable().getDefaultSchema());
+ assertNull(childXmlEntity.getTable().getDefaultSchema());
+ }
+
+ public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception {
+ createTestEntity();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ assertNull(xmlEntity.getTable().getDefaultSchema());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema("FOO");
+ assertEquals("FOO", xmlEntity.getTable().getDefaultSchema());
+
+ xmlEntity.entityMappings().setSpecifiedSchema("BAR");
+ assertEquals("BAR", xmlEntity.getTable().getDefaultSchema());
+
+ xmlEntity.javaEntity().getTable().setSpecifiedSchema("JAVA_SCHEMA");
+ assertEquals("JAVA_SCHEMA", xmlEntity.getTable().getDefaultSchema());
+
+ xmlEntity.getTable().setSpecifiedName("BLAH");
+ //xml entity now has a table element so default schema is not taken from java
+ assertEquals("BAR", xmlEntity.getTable().getDefaultSchema());
+
+
+ xmlEntity.entityMappings().setSpecifiedSchema(null);
+ assertEquals("FOO", xmlEntity.getTable().getDefaultSchema());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema(null);
+ assertNull(xmlEntity.getTable().getDefaultSchema());
+
+ xmlEntity.getTable().setSpecifiedName(null);
+ assertEquals("JAVA_SCHEMA", xmlEntity.getTable().getDefaultSchema());
+ }
+
+ public void testModifySpecifiedSchema() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlTable xmlTable = xmlEntity.getTable();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlTable.getSpecifiedSchema());
+ assertNull(entityResource.getTable());
+
+ //set Schema in the context model, verify resource model modified
+ xmlTable.setSpecifiedSchema("foo");
+ assertEquals("foo", xmlTable.getSpecifiedSchema());
+ assertEquals("foo", entityResource.getTable().getSchema());
+
+ //set Schema to null in the context model
+ xmlTable.setSpecifiedSchema(null);
+ assertNull(xmlTable.getSpecifiedSchema());
+ assertNull(entityResource.getTable());
+ }
+
+ public void testUpdateSpecifiedCatalog() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlTable xmlTable = xmlEntity.getTable();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlTable.getSpecifiedCatalog());
+ assertNull(entityResource.getTable());
+
+ //set Catalog in the resource model, verify context model updated
+ entityResource.setTable(OrmFactory.eINSTANCE.createTable());
+ entityResource.getTable().setCatalog("FOO");
+ assertEquals("FOO", xmlTable.getSpecifiedCatalog());
+ assertEquals("FOO", entityResource.getTable().getCatalog());
+
+ //set Catalog to null in the resource model
+ entityResource.getTable().setCatalog(null);
+ assertNull(xmlTable.getSpecifiedCatalog());
+ assertNull(entityResource.getTable().getCatalog());
+
+ entityResource.getTable().setCatalog("FOO");
+ assertEquals("FOO", xmlTable.getSpecifiedCatalog());
+ assertEquals("FOO", entityResource.getTable().getCatalog());
+
+ entityResource.setTable(null);
+ assertNull(xmlTable.getSpecifiedCatalog());
+ assertNull(entityResource.getTable());
+ }
+
+ public void testModifySpecifiedCatalog() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ XmlTable xmlTable = xmlEntity.getTable();
+ Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+ assertNull(xmlTable.getSpecifiedCatalog());
+ assertNull(entityResource.getTable());
+
+ //set Catalog in the context model, verify resource model modified
+ xmlTable.setSpecifiedCatalog("foo");
+ assertEquals("foo", xmlTable.getSpecifiedCatalog());
+ assertEquals("foo", entityResource.getTable().getCatalog());
+
+ //set Catalog to null in the context model
+ xmlTable.setSpecifiedCatalog(null);
+ assertNull(xmlTable.getSpecifiedCatalog());
+ assertNull(entityResource.getTable());
+ }
+
+ public void testUpdateDefaultCatalogFromJavaTable() throws Exception {
+ createTestEntity();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ assertNull(xmlEntity.getTable().getDefaultCatalog());
+
+ xmlEntity.javaEntity().getTable().setSpecifiedCatalog("Foo");
+ assertEquals("Foo", xmlEntity.getTable().getDefaultCatalog());
+
+ xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE);
+ assertNull(xmlEntity.getTable().getDefaultCatalog());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
+ xmlEntity.setSpecifiedMetadataComplete(Boolean.FALSE);
+ assertNull(xmlEntity.getTable().getDefaultCatalog());
+
+ xmlEntity.setSpecifiedMetadataComplete(null);
+ assertNull(xmlEntity.getTable().getDefaultCatalog());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
+ assertEquals("Foo", xmlEntity.getTable().getDefaultCatalog());
+
+ xmlEntity.getTable().setSpecifiedName("Bar");
+ assertNull(xmlEntity.getTable().getDefaultCatalog());
+ }
+
+ public void testUpdateDefaultCatalogNoJava() throws Exception {
+ createTestEntity();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ assertNull(xmlEntity.getTable().getDefaultCatalog());
+ }
+
+ public void testUpdateDefaultCatalogFromParent() throws Exception {
+ createTestEntity();
+ createTestSubType();
+
+ XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild");
+ XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping();
+ XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping();
+
+ assertNull(parentXmlEntity.getTable().getDefaultCatalog());
+ assertNull(childXmlEntity.getTable().getDefaultCatalog());
+
+ parentXmlEntity.getTable().setSpecifiedCatalog("FOO");
+ assertNull(parentXmlEntity.getTable().getDefaultCatalog());
+ assertEquals("FOO", childXmlEntity.getTable().getDefaultCatalog());
+
+ parentXmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
+ assertNull(parentXmlEntity.getTable().getDefaultCatalog());
+ assertNull(childXmlEntity.getTable().getDefaultCatalog());
+ }
+
+ public void testUpdateDefaultCatalogFromPersistenceUnitDefaults() throws Exception {
+ createTestEntity();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+ assertNull(xmlEntity.getTable().getDefaultCatalog());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("FOO");
+ assertEquals("FOO", xmlEntity.getTable().getDefaultCatalog());
+
+ xmlEntity.entityMappings().setSpecifiedCatalog("BAR");
+ assertEquals("BAR", xmlEntity.getTable().getDefaultCatalog());
+
+ xmlEntity.javaEntity().getTable().setSpecifiedCatalog("JAVA_CATALOG");
+ assertEquals("JAVA_CATALOG", xmlEntity.getTable().getDefaultCatalog());
+
+ xmlEntity.getTable().setSpecifiedName("BLAH");
+ //xml entity now has a table element so default schema is not taken from java
+ assertEquals("BAR", xmlEntity.getTable().getDefaultCatalog());
+
+
+ xmlEntity.entityMappings().setSpecifiedCatalog(null);
+ assertEquals("FOO", xmlEntity.getTable().getDefaultCatalog());
+
+ xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog(null);
+ assertNull(xmlEntity.getTable().getDefaultCatalog());
+
+ xmlEntity.getTable().setSpecifiedName(null);
+ assertEquals("JAVA_CATALOG", xmlEntity.getTable().getDefaultCatalog());
+}
+
+//
+// public void testUpdateName() throws Exception {
+// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping();
+// Entity entityResource = ormResource().getEntityMappings().getEntities().get(0);
+// assertEquals("Foo", xmlEntity.getName());
+//
+// //set class in the resource model, verify context model updated
+// entityResource.setClassName("com.Bar");
+// assertEquals("Bar", xmlEntity.getName());
+//
+// entityResource.setName("Baz");
+// assertEquals("Baz", xmlEntity.getName());
+//
+// //set class to null in the resource model
+// entityResource.setClassName(null);
+// assertEquals("Baz", xmlEntity.getName());
+//
+// entityResource.setName(null);
+// assertNull(xmlEntity.getName());
+// }
+
+
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTransientMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTransientMappingTests.java
new file mode 100644
index 0000000000..118f676f10
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTransientMappingTests.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.context.orm.XmlTransientMapping;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.orm.Transient;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class XmlTransientMappingTests extends ContextModelTestCase
+{
+ public XmlTransientMappingTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createTransientAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Transient", "");
+ }
+
+
+ private IType createTestEntityTransientMapping() throws Exception {
+ createEntityAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.TRANSIENT);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Transient");
+ }
+ });
+ }
+ public void testUpdateName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientMapping");
+ XmlTransientMapping xmlTransientnMapping = (XmlTransientMapping) xmlPersistentAttribute.getMapping();
+ Transient transientResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getTransients().get(0);
+
+ assertEquals("transientMapping", xmlTransientnMapping.getName());
+ assertEquals("transientMapping", transientResource.getName());
+
+ //set name in the resource model, verify context model updated
+ transientResource.setName("newName");
+ assertEquals("newName", xmlTransientnMapping.getName());
+ assertEquals("newName", transientResource.getName());
+
+ //set name to null in the resource model
+ transientResource.setName(null);
+ assertNull(xmlTransientnMapping.getName());
+ assertNull(transientResource.getName());
+ }
+
+ public void testModifyName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientMapping");
+ XmlTransientMapping xmlTransientnMapping = (XmlTransientMapping) xmlPersistentAttribute.getMapping();
+ Transient transientResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getTransients().get(0);
+
+ assertEquals("transientMapping", xmlTransientnMapping.getName());
+ assertEquals("transientMapping", transientResource.getName());
+
+ //set name in the context model, verify resource model updated
+ xmlTransientnMapping.setName("newName");
+ assertEquals("newName", xmlTransientnMapping.getName());
+ assertEquals("newName", transientResource.getName());
+
+ //set name to null in the context model
+ xmlTransientnMapping.setName(null);
+ assertNull(xmlTransientnMapping.getName());
+ assertNull(transientResource.getName());
+ }
+
+
+ public void testTransientMappingNoUnderylingJavaAttribute() throws Exception {
+ createTestEntityTransientMapping();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "foo");
+ assertEquals(2, xmlPersistentType.virtualAttributesSize());
+
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next();
+ XmlTransientMapping xmlTransientMapping = (XmlTransientMapping) xmlPersistentAttribute.getMapping();
+
+ assertEquals("foo", xmlTransientMapping.getName());
+ }
+
+ //@Basic(fetch=FetchType.LAZY, optional=false)
+ //@Column(name="MY_COLUMN", unique=true, nullable=false, insertable=false, updatable=false,
+ // columnDefinition="COLUMN_DEFINITION", table="MY_TABLE", length=5, precision=6, scale=7)");
+ //@Column(
+ //@Lob
+ //@Temporal(TemporalType.TIMESTAMP)
+ //@Enumerated(EnumType.STRING)
+ public void testVirtualMappingMetadataCompleteFalse() throws Exception {
+ createTestEntityTransientMapping();
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ assertEquals(2, xmlPersistentType.virtualAttributesSize());
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next();
+
+ XmlTransientMapping xmlTransientMapping = (XmlTransientMapping) xmlPersistentAttribute.getMapping();
+ assertEquals("id", xmlTransientMapping.getName());
+ }
+
+ public void testVirtualMappingMetadataCompleteTrue() throws Exception {
+ createTestEntityTransientMapping();
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ xmlPersistentType.getMapping().setSpecifiedMetadataComplete(true);
+ assertEquals(2, xmlPersistentType.virtualAttributesSize());
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next();
+
+ XmlTransientMapping xmlTransientMapping = (XmlTransientMapping) xmlPersistentAttribute.getMapping();
+ assertEquals("id", xmlTransientMapping.getName());
+ }
+
+ public void testSpecifiedMapping() throws Exception {
+ createTestEntityTransientMapping();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "id");
+ assertEquals(1, xmlPersistentType.virtualAttributesSize());
+
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next();
+ XmlTransientMapping xmlTransientMapping = (XmlTransientMapping) xmlPersistentAttribute.getMapping();
+
+ assertEquals("id", xmlTransientMapping.getName());
+ }
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlVersionMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlVersionMappingTests.java
new file mode 100644
index 0000000000..1bc2d17ca0
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlVersionMappingTests.java
@@ -0,0 +1,335 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.orm;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IMappingKeys;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.TemporalType;
+import org.eclipse.jpt.core.internal.context.orm.XmlColumn;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
+import org.eclipse.jpt.core.internal.context.orm.XmlVersionMapping;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.orm.Version;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class XmlVersionMappingTests extends ContextModelTestCase
+{
+ public XmlVersionMappingTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+
+ private void createEntityAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private void createVersionAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Version", "");
+ }
+
+ private void createColumnAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Column",
+ "String name() default \"\";" +
+ "boolean unique() default false;" +
+ "boolean nullable() default true;" +
+ "boolean insertable() default true;" +
+ "boolean updatable() default true;" +
+ "String columnDefinition() default \"\";" +
+ "String table() default \"\";" +
+ "int length() default 255;" +
+ "int precision() default 0;" +
+ "int scale() default 0;");
+ }
+
+ private void createTemporalAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Temporal", "TemporalType value();");
+ }
+
+ private IType createTestEntityVersionMapping() throws Exception {
+ createEntityAnnotation();
+ createVersionAnnotation();
+ createColumnAnnotation();
+ createTemporalAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.VERSION, JPA.COLUMN, JPA.TEMPORAL, JPA.TEMPORAL_TYPE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Version");
+ sb.append(CR);
+ sb.append(" @Column(name=\"MY_COLUMN\", unique=true, nullable=false, insertable=false, updatable=false, columnDefinition=\"COLUMN_DEFINITION\", table=\"MY_TABLE\", length=5, precision=6, scale=7)");
+ sb.append(CR);
+ sb.append(" @Temporal(TemporalType.TIMESTAMP)");
+ }
+ });
+ }
+
+ public void testUpdateName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping");
+ XmlVersionMapping xmlVersionMapping = (XmlVersionMapping) xmlPersistentAttribute.getMapping();
+ Version versionResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0);
+
+ assertEquals("versionMapping", xmlVersionMapping.getName());
+ assertEquals("versionMapping", versionResource.getName());
+
+ //set name in the resource model, verify context model updated
+ versionResource.setName("newName");
+ assertEquals("newName", xmlVersionMapping.getName());
+ assertEquals("newName", versionResource.getName());
+
+ //set name to null in the resource model
+ versionResource.setName(null);
+ assertNull(xmlVersionMapping.getName());
+ assertNull(versionResource.getName());
+ }
+
+ public void testModifyName() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping");
+ XmlVersionMapping xmlVersionMapping = (XmlVersionMapping) xmlPersistentAttribute.getMapping();
+ Version versionResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0);
+
+ assertEquals("versionMapping", xmlVersionMapping.getName());
+ assertEquals("versionMapping", versionResource.getName());
+
+ //set name in the context model, verify resource model updated
+ xmlVersionMapping.setName("newName");
+ assertEquals("newName", xmlVersionMapping.getName());
+ assertEquals("newName", versionResource.getName());
+
+ //set name to null in the context model
+ xmlVersionMapping.setName(null);
+ assertNull(xmlVersionMapping.getName());
+ assertNull(versionResource.getName());
+ }
+
+ public void testUpdateTemporal() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping");
+ XmlVersionMapping xmlVersionMapping = (XmlVersionMapping) xmlPersistentAttribute.getMapping();
+ Version versionResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0);
+ ormResource().save(null);
+
+ assertNull(xmlVersionMapping.getTemporal());
+ assertNull(versionResource.getTemporal());
+
+ //set temporal in the resource model, verify context model updated
+ versionResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE);
+ ormResource().save(null);
+ assertEquals(TemporalType.DATE, xmlVersionMapping.getTemporal());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE, versionResource.getTemporal());
+
+ versionResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME);
+ ormResource().save(null);
+ assertEquals(TemporalType.TIME, xmlVersionMapping.getTemporal());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME, versionResource.getTemporal());
+
+ versionResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP);
+ ormResource().save(null);
+ assertEquals(TemporalType.TIMESTAMP, xmlVersionMapping.getTemporal());
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP, versionResource.getTemporal());
+
+ //set temporal to null in the resource model
+ versionResource.setTemporal(null);
+ ormResource().save(null);
+ assertNull(xmlVersionMapping.getTemporal());
+ assertNull(versionResource.getTemporal());
+ }
+
+ public void testModifyTemporal() throws Exception {
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping");
+ XmlVersionMapping xmlVersionMapping = (XmlVersionMapping) xmlPersistentAttribute.getMapping();
+ Version versionResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0);
+ ormResource().save(null);
+
+ assertNull(xmlVersionMapping.getTemporal());
+ assertNull(versionResource.getTemporal());
+
+ //set temporal in the context model, verify resource model updated
+ xmlVersionMapping.setTemporal(TemporalType.DATE);
+ ormResource().save(null);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE, versionResource.getTemporal());
+ assertEquals(TemporalType.DATE, xmlVersionMapping.getTemporal());
+
+ xmlVersionMapping.setTemporal(TemporalType.TIME);
+ ormResource().save(null);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME, versionResource.getTemporal());
+ assertEquals(TemporalType.TIME, xmlVersionMapping.getTemporal());
+
+ xmlVersionMapping.setTemporal(TemporalType.TIMESTAMP);
+ ormResource().save(null);
+ assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP, versionResource.getTemporal());
+ assertEquals(TemporalType.TIMESTAMP, xmlVersionMapping.getTemporal());
+
+ //set temporal to null in the context model
+ xmlVersionMapping.setTemporal(null);
+ ormResource().save(null);
+ assertNull(versionResource.getTemporal());
+ assertNull(xmlVersionMapping.getTemporal());
+ }
+
+ //TODO test morphing to other mapping types
+ //TODO test defaults
+
+ public void testVersionMappingNoUnderylingJavaAttribute() throws Exception {
+ createTestEntityVersionMapping();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "foo");
+ assertEquals(2, xmlPersistentType.virtualAttributesSize());
+
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next();
+ XmlVersionMapping xmlVersionMapping = (XmlVersionMapping) xmlPersistentAttribute.getMapping();
+
+ assertEquals("foo", xmlVersionMapping.getName());
+ assertNull(xmlVersionMapping.getTemporal());
+
+
+ XmlColumn xmlColumn = xmlVersionMapping.getColumn();
+ assertNull(xmlColumn.getSpecifiedName());
+ assertNull(xmlColumn.getSpecifiedUnique());
+ assertNull(xmlColumn.getSpecifiedNullable());
+ assertNull(xmlColumn.getSpecifiedInsertable());
+ assertNull(xmlColumn.getSpecifiedUpdatable());
+ assertNull(xmlColumn.getColumnDefinition());
+ assertNull(xmlColumn.getSpecifiedTable());
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(xmlColumn.getSpecifiedPrecision());
+ assertNull(xmlColumn.getSpecifiedScale());
+
+ assertEquals("foo", xmlColumn.getDefaultName());
+ assertEquals(Boolean.FALSE, xmlColumn.getDefaultUnique());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultNullable());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultInsertable());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultUpdatable());
+ assertEquals(null, xmlColumn.getColumnDefinition());
+ assertEquals(TYPE_NAME, xmlColumn.getDefaultTable());
+ assertEquals(Integer.valueOf(255), xmlColumn.getDefaultLength());
+ assertEquals(Integer.valueOf(0), xmlColumn.getDefaultPrecision());
+ assertEquals(Integer.valueOf(0), xmlColumn.getDefaultScale());
+ }
+
+ //@Basic(fetch=FetchType.LAZY, optional=false)
+ //@Column(name="MY_COLUMN", unique=true, nullable=false, insertable=false, updatable=false,
+ // columnDefinition="COLUMN_DEFINITION", table="MY_TABLE", length=5, precision=6, scale=7)");
+ //@Column(
+ //@Lob
+ //@Temporal(TemporalType.TIMESTAMP)
+ //@Enumerated(EnumType.STRING)
+ public void testVirtualMappingMetadataCompleteFalse() throws Exception {
+ createTestEntityVersionMapping();
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ assertEquals(2, xmlPersistentType.virtualAttributesSize());
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next();
+
+ XmlVersionMapping xmlVersionMapping = (XmlVersionMapping) xmlPersistentAttribute.getMapping();
+ assertEquals("id", xmlVersionMapping.getName());
+ assertEquals(TemporalType.TIMESTAMP, xmlVersionMapping.getTemporal());
+
+ XmlColumn xmlColumn = xmlVersionMapping.getColumn();
+ assertEquals("MY_COLUMN", xmlColumn.getSpecifiedName());
+ assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUnique());
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable());
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedInsertable());
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUpdatable());
+ assertEquals("COLUMN_DEFINITION", xmlColumn.getColumnDefinition());
+ assertEquals("MY_TABLE", xmlColumn.getSpecifiedTable());
+ assertEquals(Integer.valueOf(5), xmlColumn.getSpecifiedLength());
+ assertEquals(Integer.valueOf(6), xmlColumn.getSpecifiedPrecision());
+ assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedScale());
+ }
+
+ public void testVirtualMappingMetadataCompleteTrue() throws Exception {
+ createTestEntityVersionMapping();
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ xmlPersistentType.getMapping().setSpecifiedMetadataComplete(true);
+ assertEquals(2, xmlPersistentType.virtualAttributesSize());
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next();
+
+ XmlVersionMapping xmlVersionMapping = (XmlVersionMapping) xmlPersistentAttribute.getMapping();
+ assertEquals("id", xmlVersionMapping.getName());
+ assertNull(xmlVersionMapping.getTemporal());
+
+ XmlColumn xmlColumn = xmlVersionMapping.getColumn();
+ assertEquals("id", xmlColumn.getSpecifiedName());
+ assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUnique());
+ assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedNullable());
+ assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedInsertable());
+ assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUpdatable());
+ assertNull(xmlColumn.getColumnDefinition());
+ assertEquals(TYPE_NAME, xmlColumn.getSpecifiedTable());
+ assertEquals(Integer.valueOf(255), xmlColumn.getSpecifiedLength());
+ assertEquals(Integer.valueOf(0), xmlColumn.getSpecifiedPrecision());
+ assertEquals(Integer.valueOf(0), xmlColumn.getSpecifiedScale());
+ }
+
+ public void testSpecifiedMapping() throws Exception {
+ createTestEntityVersionMapping();
+
+ XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
+ xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "id");
+ assertEquals(1, xmlPersistentType.virtualAttributesSize());
+
+ XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next();
+ XmlVersionMapping xmlVersionMapping = (XmlVersionMapping) xmlPersistentAttribute.getMapping();
+
+ assertEquals("id", xmlVersionMapping.getName());
+ assertNull(xmlVersionMapping.getTemporal());
+
+ XmlColumn xmlColumn = xmlVersionMapping.getColumn();
+ assertNull(xmlColumn.getSpecifiedName());
+ assertNull(xmlColumn.getSpecifiedUnique());
+ assertNull(xmlColumn.getSpecifiedNullable());
+ assertNull(xmlColumn.getSpecifiedInsertable());
+ assertNull(xmlColumn.getSpecifiedUpdatable());
+ assertNull(xmlColumn.getColumnDefinition());
+ assertNull(xmlColumn.getSpecifiedTable());
+ assertNull(xmlColumn.getSpecifiedLength());
+ assertNull(xmlColumn.getSpecifiedPrecision());
+ assertNull(xmlColumn.getSpecifiedScale());
+
+ assertEquals("id", xmlColumn.getDefaultName());
+ assertEquals(Boolean.FALSE, xmlColumn.getDefaultUnique());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultNullable());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultInsertable());
+ assertEquals(Boolean.TRUE, xmlColumn.getDefaultUpdatable());
+ assertEquals(null, xmlColumn.getColumnDefinition());
+ assertEquals(TYPE_NAME, xmlColumn.getDefaultTable());
+ assertEquals(Integer.valueOf(255), xmlColumn.getDefaultLength());
+ assertEquals(Integer.valueOf(0), xmlColumn.getDefaultPrecision());
+ assertEquals(Integer.valueOf(0), xmlColumn.getDefaultScale());
+ }
+
+
+} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/BaseJpaContentTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/BaseJpaContentTests.java
new file mode 100644
index 0000000000..d83afa39a2
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/BaseJpaContentTests.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.persistence;
+
+import org.eclipse.jpt.core.internal.context.base.IBaseJpaContent;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResource;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class BaseJpaContentTests extends ContextModelTestCase
+{
+ public BaseJpaContentTests(String name) {
+ super(name);
+ }
+
+ public void testModifyAddPersistenceXml() throws Exception {
+ PersistenceResource pr = persistenceResource();
+ deleteResource(pr);
+
+ assertFalse(pr.exists());
+
+ IBaseJpaContent baseJpaContent = (IBaseJpaContent) getJavaProject().getJpaProject().contextModel();
+ assertNull(baseJpaContent.getPersistenceXml());
+
+ baseJpaContent.addPersistenceXml();
+
+ assertNotNull(baseJpaContent.getPersistenceXml());
+
+ boolean exceptionThrown = false;
+ try {
+ baseJpaContent.addPersistenceXml();
+ }
+ catch (IllegalStateException ise) {
+ exceptionThrown = true;
+ }
+
+ assertTrue(exceptionThrown);
+ }
+
+ public void testModifyRemovePersistenceXml() throws Exception {
+ IBaseJpaContent baseJpaContent = (IBaseJpaContent) getJavaProject().getJpaProject().contextModel();
+
+ assertNotNull(baseJpaContent.getPersistenceXml());
+
+ baseJpaContent.removePersistenceXml();
+ waitForWorkspaceJobs();
+
+ assertNull(baseJpaContent.getPersistenceXml());
+
+ boolean exceptionThrown = false;
+ try {
+ baseJpaContent.removePersistenceXml();
+ }
+ catch (IllegalStateException ise) {
+ exceptionThrown = true;
+ }
+
+ assertTrue(exceptionThrown);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testUpdateAddPersistenceXml() throws Exception {
+ PersistenceResource pr = persistenceResource();
+ deleteResource(pr);
+
+ assertFalse(pr.exists());
+
+ IBaseJpaContent baseJpaContent = (IBaseJpaContent) getJavaProject().getJpaProject().contextModel();
+ assertNull(baseJpaContent.getPersistenceXml());
+
+ pr.getContents().add(PersistenceFactory.eINSTANCE.createXmlPersistence());
+ pr.save(null);
+ assertNotNull(baseJpaContent.getPersistenceXml());
+ }
+
+ public void testUpdateRemovePersistenceXml() throws Exception {
+ PersistenceResource pr = persistenceResource();
+ IBaseJpaContent baseJpaContent = (IBaseJpaContent) getJavaProject().getJpaProject().contextModel();
+
+ assertNotNull(baseJpaContent.getPersistenceXml());
+
+ deleteResource(pr);
+
+ assertNull(baseJpaContent.getPersistenceXml());
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/ClassRefTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/ClassRefTests.java
new file mode 100644
index 0000000000..6583f7b0ce
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/ClassRefTests.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.persistence;
+
+import org.eclipse.jpt.core.internal.context.base.IClassRef;
+import org.eclipse.jpt.core.internal.context.base.IPersistenceUnit;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class ClassRefTests extends ContextModelTestCase
+{
+ public ClassRefTests(String name) {
+ super(name);
+ }
+
+ public void testUpdateClassName() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // add class ref
+ XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
+ xmlClassRef.setJavaClass("com.foo.Bar");
+ xmlPersistenceUnit.getClasses().add(xmlClassRef);
+ IClassRef classRef = persistenceUnit.classRefs().next();
+
+ // test that class names are initially equal
+ assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
+
+ // set xml class name to different name, test equality
+ xmlClassRef.setJavaClass("com.bar.Foo");
+
+ assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
+
+ // set class name to empty string, test equality
+ xmlClassRef.setJavaClass("");
+
+ assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
+
+ // set class name to null, test equality
+ xmlClassRef.setJavaClass(null);
+
+ assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
+
+ // set name back to non-null, test equality
+ xmlClassRef.setJavaClass("com.foo.Bar");
+
+ assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
+ }
+
+ public void testModifyClassName() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // add class ref
+ XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
+ xmlClassRef.setJavaClass("com.foo.Bar");
+ xmlPersistenceUnit.getClasses().add(xmlClassRef);
+ IClassRef classRef = persistenceUnit.classRefs().next();
+
+ // test that class names are initially equal
+ assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
+
+ // set context class name to different name, test equality
+ classRef.setClassName("com.bar.Foo");
+
+ assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
+
+ // set class name to empty string, test equality
+ classRef.setClassName("");
+
+ assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
+
+ // set class name to null, test equality
+ classRef.setClassName(null);
+
+ assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
+
+ // set name back to non-null, test equality
+ classRef.setClassName("com.foo.Bar");
+
+ assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass());
+ }
+
+
+ public void testGetPersistentType() throws Exception {
+ createTestType();
+
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+
+ XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
+ xmlClassRef.setJavaClass(FULLY_QUALIFIED_TYPE_NAME);
+ xmlPersistenceUnit.getClasses().add(xmlClassRef);
+
+ IClassRef classRef = classRef();
+
+ assertEquals(FULLY_QUALIFIED_TYPE_NAME, classRef.getJavaPersistentType().getName());
+
+ //test setting to a class that does not exist in the project
+ xmlClassRef.setJavaClass("com.foo.Bar");
+
+ classRef = classRef();
+ assertNull(classRef.getJavaPersistentType());
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/JptCorePersistenceContextModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/JptCorePersistenceContextModelTests.java
new file mode 100644
index 0000000000..db12f873fd
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/JptCorePersistenceContextModelTests.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.persistence;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+public class JptCorePersistenceContextModelTests extends TestCase
+{
+ public static Test suite() {
+ return suite(true);
+ }
+
+ public static Test suite(boolean all) {
+ TestSuite suite = new TestSuite(JptCorePersistenceContextModelTests.class.getName());
+ suite.addTestSuite(BaseJpaContentTests.class);
+ suite.addTestSuite(PersistenceXmlTests.class);
+ suite.addTestSuite(PersistenceTests.class);
+ suite.addTestSuite(PersistenceUnitTests.class);
+ suite.addTestSuite(MappingFileRefTests.class);
+ suite.addTestSuite(ClassRefTests.class);
+ return suite;
+ }
+
+ private JptCorePersistenceContextModelTests() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/MappingFileRefTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/MappingFileRefTests.java
new file mode 100644
index 0000000000..48d05e96dc
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/MappingFileRefTests.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.persistence;
+
+import org.eclipse.jpt.core.internal.context.base.IMappingFileRef;
+import org.eclipse.jpt.core.internal.context.base.IPersistenceUnit;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class MappingFileRefTests extends ContextModelTestCase
+{
+ public MappingFileRefTests(String name) {
+ super(name);
+ }
+
+ protected IMappingFileRef mappingFileRef() {
+ return persistenceUnit().mappingFileRefs().next();
+ }
+
+ public void testUpdateFileName() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // add mapping file ref
+ XmlMappingFileRef xmlFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ xmlFileRef.setFileName("foo.xml");
+ xmlPersistenceUnit.getMappingFiles().add(xmlFileRef);
+ IMappingFileRef fileRef = persistenceUnit.specifiedMappingFileRefs().next();
+
+ // test that file names are initially equal
+ assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
+
+ // set xml to different file name, test equality
+ xmlFileRef.setFileName("bar.xml");
+
+ assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
+
+ // set file name to empty string, test equality
+ xmlFileRef.setFileName("");
+
+ assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
+
+ // set file name to null, test equality
+ xmlFileRef.setFileName(null);
+
+ assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
+
+ // set file name back to non-null, test equality
+ xmlFileRef.setFileName("baz.xml");
+
+ assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
+ }
+
+ public void testModifyFileName() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // add mapping file ref
+ XmlMappingFileRef xmlFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ xmlFileRef.setFileName("foo.xml");
+ xmlPersistenceUnit.getMappingFiles().add(xmlFileRef);
+ IMappingFileRef fileRef = persistenceUnit.specifiedMappingFileRefs().next();
+
+ // test that file names are initially equal
+ assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
+
+ // set context to different file name, test equality
+ fileRef.setFileName("bar.xml");
+
+ assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
+
+ // set file name to empty string, test equality
+ fileRef.setFileName("");
+
+ assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
+
+ // set file name to null, test equality
+ fileRef.setFileName(null);
+
+ assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
+
+ // set file name back to non-null, test equality
+ fileRef.setFileName("baz.xml");
+
+ assertEquals(fileRef.getFileName(), xmlFileRef.getFileName());
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceTests.java
new file mode 100644
index 0000000000..80be25e88f
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceTests.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.persistence;
+
+import org.eclipse.jpt.core.internal.context.base.IPersistence;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResource;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+
+public class PersistenceTests extends ContextModelTestCase
+{
+ public PersistenceTests(String name) {
+ super(name);
+ }
+
+ protected IPersistence persistence() {
+ return jpaContent().getPersistenceXml().getPersistence();
+ }
+
+ public void testUpdateAddPersistenceUnit() throws Exception {
+ PersistenceResource prm = persistenceResource();
+ XmlPersistence xmlPersistence = prm.getPersistence();
+ IPersistence persistence = jpaContent().getPersistenceXml().getPersistence();
+
+ // clear xml persistence units, test that it's clear in context
+ xmlPersistence.getPersistenceUnits().clear();
+
+ assertTrue(CollectionTools.list(persistence.persistenceUnits()).isEmpty());
+
+ // add xml persistence unit, test that it's added to context
+ XmlPersistenceUnit xmlPersistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
+ xmlPersistenceUnit.setName("test");
+ xmlPersistence.getPersistenceUnits().add(xmlPersistenceUnit);
+
+ assertTrue(CollectionTools.size(persistence.persistenceUnits()) == 1);
+
+ // add another ...
+ xmlPersistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
+ xmlPersistenceUnit.setName("test2");
+ xmlPersistence.getPersistenceUnits().add(xmlPersistenceUnit);
+
+ assertTrue(CollectionTools.size(persistence.persistenceUnits()) == 2);
+ }
+
+ public void testModifyAddPersistencUnit() {
+ XmlPersistence xmlPersistence = xmlPersistence();
+ IPersistence persistence = persistence();
+
+ // clear xml persistence units, test that it's clear in context
+ xmlPersistence.getPersistenceUnits().clear();
+ assertEquals(CollectionTools.size(persistence.persistenceUnits()), 0);
+
+ // add persistence unit, test that it's added to resource
+ persistence.addPersistenceUnit();
+
+ assertEquals(CollectionTools.size(persistence.persistenceUnits()), 1);
+
+ // add another ...
+ persistence.addPersistenceUnit();
+
+ assertEquals(CollectionTools.size(persistence.persistenceUnits()), 2);
+ }
+
+ public void testUpdateRemovePersistenceUnit() throws Exception {
+ PersistenceResource prm = persistenceResource();
+ XmlPersistence xmlPersistence = prm.getPersistence();
+ IPersistence persistence = jpaContent().getPersistenceXml().getPersistence();
+
+ // add a persistence unit and test that there are two existing xml and context persistence unit
+ XmlPersistenceUnit xmlPersistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
+ xmlPersistenceUnit.setName("test");
+ xmlPersistence.getPersistenceUnits().add(xmlPersistenceUnit);
+
+ assertTrue(xmlPersistence.getPersistenceUnits().size() == 2);
+ assertTrue(CollectionTools.size(persistence.persistenceUnits()) == 2);
+
+ // remove persistence unit from xml, test that it's removed from context
+ xmlPersistenceUnit = xmlPersistence.getPersistenceUnits().get(0);
+ xmlPersistence.getPersistenceUnits().remove(xmlPersistenceUnit);
+
+ assertTrue(CollectionTools.size(persistence.persistenceUnits()) == 1);
+
+ // remove another one ...
+ xmlPersistenceUnit = xmlPersistence.getPersistenceUnits().get(0);
+ xmlPersistence.getPersistenceUnits().remove(xmlPersistenceUnit);
+
+ assertTrue(CollectionTools.size(persistence.persistenceUnits()) == 0);
+ }
+
+ public void testModifyRemovePersistenceUnit() {
+ XmlPersistence xmlPersistence = xmlPersistence();
+ IPersistence persistence = persistence();
+
+ // add a persistence unit and test that there are two existing xml and context persistence unit
+ XmlPersistenceUnit xmlPersistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
+ xmlPersistenceUnit.setName("test");
+ xmlPersistence.getPersistenceUnits().add(xmlPersistenceUnit);
+
+ assertEquals(xmlPersistence.getPersistenceUnits().size(), 2);
+ assertEquals(CollectionTools.size(persistence.persistenceUnits()), 2);
+
+ // remove persistence unit, test that it's removed from resource
+ persistence.removePersistenceUnit(0);
+
+ assertEquals(CollectionTools.size(persistence.persistenceUnits()), 1);
+
+ // remove another one ...
+ persistence.removePersistenceUnit(0);
+
+ assertEquals(CollectionTools.size(persistence.persistenceUnits()), 0);
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java
new file mode 100644
index 0000000000..60f592bee4
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java
@@ -0,0 +1,960 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.tests.internal.context.persistence;
+
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.context.base.AccessType;
+import org.eclipse.jpt.core.internal.context.base.IPersistenceUnit;
+import org.eclipse.jpt.core.internal.context.base.IProperty;
+import org.eclipse.jpt.core.internal.context.base.PersistenceUnitTransactionType;
+import org.eclipse.jpt.core.internal.resource.orm.OrmResource;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnitTransactionType;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlProperties;
+import org.eclipse.jpt.core.internal.resource.persistence.XmlProperty;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+
+public class PersistenceUnitTests extends ContextModelTestCase
+{
+ public PersistenceUnitTests(String name) {
+ super(name);
+ }
+
+ public void testUpdateName() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test that names are initially equal
+ assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
+
+ // set name to different name, test equality
+ xmlPersistenceUnit.setName("newName");
+
+ assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
+
+ // set name to empty string, test equality
+ xmlPersistenceUnit.setName("");
+
+ assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
+
+ // set name to null, test equality
+ xmlPersistenceUnit.setName(null);
+
+ assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
+
+ // set name back to non-null, test equality
+ xmlPersistenceUnit.setName("newName");
+
+ assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
+ }
+
+ public void testModifyName() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test that names are initially equal
+ assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
+
+ // set name to different name, test equality
+ persistenceUnit.setName("newName");
+
+ assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
+
+ // set name to empty string, test equality
+ persistenceUnit.setName("");
+
+ assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
+
+ // set name to null, test equality
+ persistenceUnit.setName(null);
+
+ assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
+
+ // set name back to non-null, test equality
+ persistenceUnit.setName("newName");
+
+ assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName());
+ }
+
+ public void testUpdateTransactionType() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // 1 - initial value is default
+ assertNull(xmlPersistenceUnit.getTransactionType());
+ assertEquals(persistenceUnit.getTransactionType(), PersistenceUnitTransactionType.DEFAULT);
+
+ // 2 - set value, context changed
+ xmlPersistenceUnit.setTransactionType(XmlPersistenceUnitTransactionType.JTA);
+
+ assertEquals(persistenceUnit.getTransactionType(), PersistenceUnitTransactionType.JTA);
+
+ xmlPersistenceUnit.setTransactionType(XmlPersistenceUnitTransactionType.RESOURCE_LOCAL);
+
+ assertEquals(persistenceUnit.getTransactionType(), PersistenceUnitTransactionType.RESOURCE_LOCAL);
+
+ // 3 - unset value, context changed
+ xmlPersistenceUnit.unsetTransactionType();
+
+ assertEquals(persistenceUnit.getTransactionType(), PersistenceUnitTransactionType.DEFAULT);
+ }
+
+ public void testModifyTransactionType() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // 1 - initial value is default
+ assertNull(xmlPersistenceUnit.getTransactionType());
+ assertEquals(persistenceUnit.getTransactionType(), PersistenceUnitTransactionType.DEFAULT);
+
+ // 2 - set context value, resource changed
+ persistenceUnit.setTransactionType(PersistenceUnitTransactionType.JTA);
+
+ assertEquals(xmlPersistenceUnit.getTransactionType(), XmlPersistenceUnitTransactionType.JTA);
+
+ persistenceUnit.setTransactionType(PersistenceUnitTransactionType.RESOURCE_LOCAL);
+
+ assertEquals(xmlPersistenceUnit.getTransactionType(), XmlPersistenceUnitTransactionType.RESOURCE_LOCAL);
+
+ // 3 - set context value to default, resource unset
+ persistenceUnit.setTransactionTypeToDefault();
+
+ assertTrue(persistenceUnit.isTransactionTypeDefault());
+ assertFalse(xmlPersistenceUnit.isSetTransactionType());
+ }
+
+ public void testUpdateDescription() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test that descriptions are initially equal
+ assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
+
+ // set description to different description, test equality
+ xmlPersistenceUnit.setDescription("newDescription");
+
+ assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
+
+ // set description to empty string, test equality
+ xmlPersistenceUnit.setDescription("");
+
+ assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
+
+ // set description to null, test equality
+ xmlPersistenceUnit.setDescription(null);
+
+ assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
+
+ // set description back to non-null, test equality
+ xmlPersistenceUnit.setDescription("newDescription");
+
+ assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
+ }
+
+ public void testModifyDescription() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test that descriptions are initially equal
+ assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
+
+ // set description to different description, test equality
+ persistenceUnit.setDescription("newDescription");
+
+ assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
+
+ // set description to empty string, test equality
+ persistenceUnit.setDescription("");
+
+ assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
+
+ // set description to null, test equality
+ persistenceUnit.setDescription(null);
+
+ assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
+
+ // set description back to non-null, test equality
+ persistenceUnit.setDescription("newDescription");
+
+ assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription());
+ }
+
+ public void testUpdateProvider() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test that providers are initially equal
+ assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
+
+ // set provider to different provider, test equality
+ xmlPersistenceUnit.setProvider("newProvider");
+
+ assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
+
+ // set provider to empty string, test equality
+ xmlPersistenceUnit.setProvider("");
+
+ assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
+
+ // set provider to null, test equality
+ xmlPersistenceUnit.setProvider(null);
+
+ assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
+
+ // set provider back to non-null, test equality
+ xmlPersistenceUnit.setProvider("newProvider");
+
+ assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
+ }
+
+ public void testModifyProvider() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test that providers are initially equal
+ assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
+
+ // set provider to different provider, test equality
+ persistenceUnit.setProvider("newProvider");
+
+ assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
+
+ // set provider to empty string, test equality
+ persistenceUnit.setProvider("");
+
+ assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
+
+ // set provider to null, test equality
+ persistenceUnit.setProvider(null);
+
+ assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
+
+ // set provider back to non-null, test equality
+ persistenceUnit.setProvider("newProvider");
+
+ assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider());
+ }
+
+ public void testUpdateJtaDataSource() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test that jtaDataSources are initially equal
+ assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
+
+ // set jtaDataSource to different jtaDataSource, test equality
+ xmlPersistenceUnit.setJtaDataSource("newJtaDataSource");
+
+ assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
+
+ // set jtaDataSource to empty string, test equality
+ xmlPersistenceUnit.setJtaDataSource("");
+
+ assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
+
+ // set jtaDataSource to null, test equality
+ xmlPersistenceUnit.setJtaDataSource(null);
+
+ assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
+
+ // set jtaDataSource back to non-null, test equality
+ xmlPersistenceUnit.setJtaDataSource("newJtaDataSource");
+
+ assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
+ }
+
+ public void testModifyJtaDataSource() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test that jtaDataSources are initially equal
+ assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
+
+ // set jtaDataSource to different jtaDataSource, test equality
+ persistenceUnit.setJtaDataSource("newJtaDataSource");
+
+ assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
+
+ // set jtaDataSource to empty string, test equality
+ persistenceUnit.setJtaDataSource("");
+
+ assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
+
+ // set jtaDataSource to null, test equality
+ persistenceUnit.setJtaDataSource(null);
+
+ assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
+
+ // set jtaDataSource back to non-null, test equality
+ persistenceUnit.setJtaDataSource("newJtaDataSource");
+
+ assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource());
+ }
+
+ public void testUpdateNonJtaDataSource() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test that nonJtaDataSources are initially equal
+ assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
+
+ // set nonJtaDataSource to different nonJtaDataSource, test equality
+ xmlPersistenceUnit.setNonJtaDataSource("newNonJtaDataSource");
+
+ assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
+
+ // set nonJtaDataSource to empty string, test equality
+ xmlPersistenceUnit.setNonJtaDataSource("");
+
+ assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
+
+ // set nonJtaDataSource to null, test equality
+ xmlPersistenceUnit.setNonJtaDataSource(null);
+
+ assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
+
+ // set nonJtaDataSource back to non-null, test equality
+ xmlPersistenceUnit.setNonJtaDataSource("newNonJtaDataSource");
+
+ assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
+ }
+
+ public void testModifyNonJtaDataSource() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test that nonJtaDataSources are initially equal
+ assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
+
+ // set nonJtaDataSource to different nonJtaDataSource, test equality
+ persistenceUnit.setNonJtaDataSource("newNonJtaDataSource");
+
+ assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
+
+ // set nonJtaDataSource to empty string, test equality
+ persistenceUnit.setNonJtaDataSource("");
+
+ assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
+
+ // set nonJtaDataSource to null, test equality
+ persistenceUnit.setNonJtaDataSource(null);
+
+ assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
+
+ // set nonJtaDataSource back to non-null, test equality
+ persistenceUnit.setNonJtaDataSource("newNonJtaDataSource");
+
+ assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource());
+ }
+
+ public void testUpdateJarFileRefs1() {
+ // TODO
+ }
+
+ public void testUpdateJarFileRefs2() {
+ // TODO
+ }
+
+ public void testUpdateDefaultMappingFileRef1() throws Exception {
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test that there is one initially
+ OrmResource ormResource = ormResource();
+ assertTrue(ormResource.exists());
+ assertNotNull(persistenceUnit.getDefaultMappingFileRef());
+
+ // remove orm.xml
+ deleteResource(ormResource);
+
+ assertFalse(ormResource.exists());
+ assertNull(persistenceUnit.getDefaultMappingFileRef());
+ }
+
+ public void testUpdateDefaultMappingFileRef2() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test that there is one initially
+ OrmResource ormResource = ormResource();
+ assertTrue(ormResource.exists());
+ assertNotNull(persistenceUnit.getDefaultMappingFileRef());
+
+ // add specified orm.xml
+ XmlMappingFileRef xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ xmlMappingFileRef.setFileName("META-INF/orm.xml");
+ xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
+
+ assertEquals(CollectionTools.size(persistenceUnit.specifiedMappingFileRefs()), 1);
+
+ assertTrue(ormResource.exists());
+ assertNull(persistenceUnit.getDefaultMappingFileRef());
+ }
+
+ public void testUpdateSpecifiedMappingFileRefs1() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test there are none initially
+ assertEquals(xmlPersistenceUnit.getMappingFiles().size(), 0);
+ assertEquals(CollectionTools.size(persistenceUnit.specifiedMappingFileRefs()), 0);
+
+ // add mapping file ref, test that it's added to context
+ XmlMappingFileRef xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ xmlMappingFileRef.setFileName("orm.xml");
+ xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
+
+ assertEquals(CollectionTools.size(persistenceUnit.specifiedMappingFileRefs()), 1);
+
+ // add another ...
+ xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ xmlMappingFileRef.setFileName("orm2.xml");
+ xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
+
+ assertEquals(CollectionTools.size(persistenceUnit.specifiedMappingFileRefs()), 2);
+ }
+
+ public void testUpdateSpecifiedMappingFileRefs2() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // add two mapping file refs and test that there are two existing in xml and context
+ XmlMappingFileRef xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ xmlMappingFileRef.setFileName("orm.xml");
+ xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
+ xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ xmlMappingFileRef.setFileName("orm2.xml");
+ xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
+
+ assertEquals(xmlPersistenceUnit.getMappingFiles().size(), 2);
+ assertEquals(CollectionTools.size(persistenceUnit.specifiedMappingFileRefs()), 2);
+
+ // remove mapping file ref from xml, test that it's removed from context
+ xmlMappingFileRef = xmlPersistenceUnit.getMappingFiles().get(0);
+ xmlPersistenceUnit.getMappingFiles().remove(xmlMappingFileRef);
+
+ assertEquals(CollectionTools.size(persistenceUnit.specifiedMappingFileRefs()), 1);
+
+ // remove another one ...
+ xmlMappingFileRef = xmlPersistenceUnit.getMappingFiles().get(0);
+ xmlPersistenceUnit.getMappingFiles().remove(xmlMappingFileRef);
+
+ assertEquals(CollectionTools.size(persistenceUnit.specifiedMappingFileRefs()), 0);
+ }
+
+ public void testModifySpecifiedMappingFileRefs1() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test there are none initially
+ assertEquals(xmlPersistenceUnit.getMappingFiles().size(), 0);
+ assertEquals(CollectionTools.size(persistenceUnit.specifiedMappingFileRefs()), 0);
+
+ // add mapping file ref, test that it's added to resource
+ persistenceUnit.addSpecifiedMappingFileRef();
+
+ assertEquals(xmlPersistenceUnit.getMappingFiles().size(), 1);
+
+ // add another ...
+ persistenceUnit.addSpecifiedMappingFileRef();
+
+ assertEquals(xmlPersistenceUnit.getMappingFiles().size(), 2);
+ }
+
+ public void testModifySpecifiedMappingFileRefs2() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // add two mapping file refs and test that there are two existing in xml and context
+ XmlMappingFileRef xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ xmlMappingFileRef.setFileName("orm.xml");
+ xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
+ xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ xmlMappingFileRef.setFileName("orm2.xml");
+ xmlPersistenceUnit.getMappingFiles().add(xmlMappingFileRef);
+
+ assertEquals(xmlPersistenceUnit.getMappingFiles().size(), 2);
+ assertEquals(CollectionTools.size(persistenceUnit.specifiedMappingFileRefs()), 2);
+
+ // remove mapping file ref from context, test that it's removed from xml
+ persistenceUnit.removeSpecifiedMappingFileRef(0);
+
+ assertEquals(xmlPersistenceUnit.getMappingFiles().size(), 1);
+
+ // remove another one ...
+ persistenceUnit.removeSpecifiedMappingFileRef(0);
+
+ assertEquals(xmlPersistenceUnit.getMappingFiles().size(), 0);
+ }
+
+ public void testUpdateClassRefs1() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test there are none initially
+ assertEquals(xmlPersistenceUnit.getClasses().size(), 0);
+ assertEquals(CollectionTools.size(persistenceUnit.classRefs()), 0);
+
+ // add mapping file ref, test that it's added to context
+ XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
+ xmlClassRef.setJavaClass("com.foo.Bar");
+ xmlPersistenceUnit.getClasses().add(xmlClassRef);
+
+ assertEquals(CollectionTools.size(persistenceUnit.classRefs()), 1);
+
+ // add another ...
+ xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
+ xmlClassRef.setJavaClass("com.foo.Baz");
+ xmlPersistenceUnit.getClasses().add(xmlClassRef);
+
+ assertEquals(CollectionTools.size(persistenceUnit.classRefs()), 2);
+ }
+
+ public void testUpdateClassRefs2() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // add two class refs and test that there are two existing in xml and context
+ XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
+ xmlClassRef.setJavaClass("com.foo.Bar");
+ xmlPersistenceUnit.getClasses().add(xmlClassRef);
+ xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
+ xmlClassRef.setJavaClass("com.foo.Baz");
+ xmlPersistenceUnit.getClasses().add(xmlClassRef);
+
+ assertEquals(xmlPersistenceUnit.getClasses().size(), 2);
+ assertEquals(CollectionTools.size(persistenceUnit.classRefs()), 2);
+
+ // remove class ref from xml, test that it's removed from context
+ xmlClassRef = xmlPersistenceUnit.getClasses().get(0);
+ xmlPersistenceUnit.getClasses().remove(xmlClassRef);
+
+ assertEquals(CollectionTools.size(persistenceUnit.classRefs()), 1);
+
+ // remove another one ...
+ xmlClassRef = xmlPersistenceUnit.getClasses().get(0);
+ xmlPersistenceUnit.getClasses().remove(xmlClassRef);
+
+ assertEquals(CollectionTools.size(persistenceUnit.classRefs()), 0);
+ }
+
+ public void testModifyClassRefs1() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test there are none initially
+ assertEquals(xmlPersistenceUnit.getClasses().size(), 0);
+ assertEquals(CollectionTools.size(persistenceUnit.classRefs()), 0);
+
+ // add class ref, test that it's added to context
+ persistenceUnit.addClassRef();
+
+ assertEquals(xmlPersistenceUnit.getClasses().size(), 1);
+
+ // add another ...
+ persistenceUnit.addClassRef();
+
+ assertEquals(xmlPersistenceUnit.getClasses().size(), 2);
+ }
+
+ public void testModifyClassRefs2() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // add two class refs and test that there are two existing in xml and context
+ XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
+ xmlClassRef.setJavaClass("com.foo.Bar");
+ xmlPersistenceUnit.getClasses().add(xmlClassRef);
+ xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
+ xmlClassRef.setJavaClass("com.foo.Baz");
+ xmlPersistenceUnit.getClasses().add(xmlClassRef);
+
+ assertEquals(xmlPersistenceUnit.getClasses().size(), 2);
+ assertEquals(CollectionTools.size(persistenceUnit.classRefs()), 2);
+
+ // remove class ref from context, test that it's removed from xml
+ persistenceUnit.removeClassRef(0);
+
+ assertEquals(xmlPersistenceUnit.getClasses().size(), 1);
+
+ // remove another one ...
+ persistenceUnit.removeClassRef(0);
+
+ assertEquals(xmlPersistenceUnit.getClasses().size(), 0);
+ }
+
+ public void testUpdateExcludeUnlistedClasses() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // 1 - initial value is default
+ assertFalse(xmlPersistenceUnit.isSetExcludeUnlistedClasses());
+ assertTrue(persistenceUnit.isExcludeUnlistedClassesDefault());
+ assertEquals(persistenceUnit.getExcludeUnlistedClasses(), xmlPersistenceUnit.isExcludeUnlistedClasses());
+
+ // 2 - set value, context changed
+ xmlPersistenceUnit.setExcludeUnlistedClasses(true);
+
+ assertTrue(xmlPersistenceUnit.isSetExcludeUnlistedClasses());
+ assertFalse(persistenceUnit.isExcludeUnlistedClassesDefault());
+ assertEquals(persistenceUnit.getExcludeUnlistedClasses(), xmlPersistenceUnit.isExcludeUnlistedClasses());
+
+ xmlPersistenceUnit.setExcludeUnlistedClasses(false);
+
+ assertTrue(xmlPersistenceUnit.isSetExcludeUnlistedClasses());
+ assertFalse(persistenceUnit.isExcludeUnlistedClassesDefault());
+ assertEquals(persistenceUnit.getExcludeUnlistedClasses(), xmlPersistenceUnit.isExcludeUnlistedClasses());
+
+ // 3 - unset value, context changed
+ xmlPersistenceUnit.unsetExcludeUnlistedClasses();
+
+ assertFalse(xmlPersistenceUnit.isSetExcludeUnlistedClasses());
+ assertTrue(persistenceUnit.isExcludeUnlistedClassesDefault());
+ assertEquals(persistenceUnit.getExcludeUnlistedClasses(), xmlPersistenceUnit.isExcludeUnlistedClasses());
+ }
+
+ public void testModifyExcludeUnlistedClasses() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // 1 - initial value is default
+ assertFalse(xmlPersistenceUnit.isSetExcludeUnlistedClasses());
+ assertTrue(persistenceUnit.isExcludeUnlistedClassesDefault());
+ assertEquals(persistenceUnit.getExcludeUnlistedClasses(), xmlPersistenceUnit.isExcludeUnlistedClasses());
+
+ // 2 - set value, resource changed
+ persistenceUnit.setExcludeUnlistedClasses(true);
+
+ assertTrue(xmlPersistenceUnit.isSetExcludeUnlistedClasses());
+ assertFalse(persistenceUnit.isExcludeUnlistedClassesDefault());
+ assertEquals(persistenceUnit.getExcludeUnlistedClasses(), xmlPersistenceUnit.isExcludeUnlistedClasses());
+
+ persistenceUnit.setExcludeUnlistedClasses(false);
+
+ assertTrue(xmlPersistenceUnit.isSetExcludeUnlistedClasses());
+ assertFalse(persistenceUnit.isExcludeUnlistedClassesDefault());
+ assertEquals(persistenceUnit.getExcludeUnlistedClasses(), xmlPersistenceUnit.isExcludeUnlistedClasses());
+
+ // 3 - set context to default, resource unset
+ persistenceUnit.setExcludeUnlistedClassesToDefault();
+
+ assertFalse(xmlPersistenceUnit.isSetExcludeUnlistedClasses());
+ assertTrue(persistenceUnit.isExcludeUnlistedClassesDefault());
+ assertEquals(persistenceUnit.getExcludeUnlistedClasses(), xmlPersistenceUnit.isExcludeUnlistedClasses());
+ }
+
+ public void testUpdateProperties1() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test there are none initially
+ assertNull(xmlPersistenceUnit.getProperties());
+ assertEquals(CollectionTools.size(persistenceUnit.properties()), 0);
+
+ // add "properties", test that there's no real change to context
+ XmlProperties xmlProperties = PersistenceFactory.eINSTANCE.createXmlProperties();
+ xmlPersistenceUnit.setProperties(xmlProperties);
+ assertEquals(CollectionTools.size(persistenceUnit.properties()), 0);
+
+ // add property, test that it's added to context
+ XmlProperty xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
+ xmlProperty.setName("foo");
+ xmlProperty.setValue("bar");
+ xmlProperties.getProperties().add(xmlProperty);
+
+ assertEquals(CollectionTools.size(persistenceUnit.properties()), 1);
+
+ // add another ...
+ xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
+ xmlProperty.setName("FOO");
+ xmlProperty.setValue("BAR");
+ xmlProperties.getProperties().add(xmlProperty);
+
+ assertEquals(CollectionTools.size(persistenceUnit.properties()), 2);
+ }
+
+ public void testUpdateProperties2() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // add two properties and test that there are two existing in xml and context
+ XmlProperties xmlProperties = PersistenceFactory.eINSTANCE.createXmlProperties();
+ xmlPersistenceUnit.setProperties(xmlProperties);
+ XmlProperty xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
+ xmlProperty.setName("foo");
+ xmlProperty.setValue("bar");
+ xmlProperties.getProperties().add(xmlProperty);
+ xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
+ xmlProperty.setName("FOO");
+ xmlProperty.setValue("BAR");
+ xmlProperties.getProperties().add(xmlProperty);
+
+ assertEquals(xmlPersistenceUnit.getProperties().getProperties().size(), 2);
+ assertEquals(CollectionTools.size(persistenceUnit.properties()), 2);
+
+ // remove property from xml, test that it's removed from context
+ xmlProperty = xmlProperties.getProperties().get(0);
+ xmlProperties.getProperties().remove(xmlProperty);
+
+ assertEquals(CollectionTools.size(persistenceUnit.properties()), 1);
+
+ // remove another one ...
+ xmlProperty = xmlProperties.getProperties().get(0);
+ xmlProperties.getProperties().remove(xmlProperty);
+
+ assertEquals(CollectionTools.size(persistenceUnit.properties()), 0);
+ }
+
+ public void testModifyProperties1() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // test there are none initially
+ assertNull(xmlPersistenceUnit.getProperties());
+ assertEquals(CollectionTools.size(persistenceUnit.properties()), 0);
+
+ // add property, test that it's added to resource
+ persistenceUnit.addProperty();
+
+ assertNotNull(xmlPersistenceUnit.getProperties());
+ assertEquals(xmlPersistenceUnit.getProperties().getProperties().size(), 1);
+
+ // add another ...
+ persistenceUnit.addProperty();
+
+ assertEquals(xmlPersistenceUnit.getProperties().getProperties().size(), 2);
+ }
+
+ public void testModifyProperties2() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // add two properties and test that there are two existing in xml and context
+ XmlProperties xmlProperties = PersistenceFactory.eINSTANCE.createXmlProperties();
+ xmlPersistenceUnit.setProperties(xmlProperties);
+ XmlProperty xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
+ xmlProperty.setName("foo");
+ xmlProperty.setValue("bar");
+ xmlProperties.getProperties().add(xmlProperty);
+ xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
+ xmlProperty.setName("FOO");
+ xmlProperty.setValue("BAR");
+ xmlProperties.getProperties().add(xmlProperty);
+
+ assertEquals(xmlPersistenceUnit.getProperties().getProperties().size(), 2);
+ assertEquals(CollectionTools.size(persistenceUnit.properties()), 2);
+
+ // remove property from context, test that it's removed from resource
+ persistenceUnit.removeProperty("foo");
+
+ assertEquals(xmlPersistenceUnit.getProperties().getProperties().size(), 1);
+
+ // remove another one. test that properties object is nulled
+ persistenceUnit.removeProperty("FOO", "BAR");
+
+ assertNull(xmlPersistenceUnit.getProperties());
+ }
+
+ public void testModifyProperties3() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // add two properties and test that there are two existing in xml and context
+ persistenceUnit.putProperty("foo", "bar", false);
+ persistenceUnit.putProperty("FOO", "BAR", false);
+
+ assertEquals(xmlPersistenceUnit.getProperties().getProperties().size(), 2);
+ assertEquals(CollectionTools.size(persistenceUnit.properties()), 2);
+
+ // remove property from context, test that it's removed from resource
+ persistenceUnit.removeProperty("foo", "bar");
+
+ assertEquals(xmlPersistenceUnit.getProperties().getProperties().size(), 1);
+
+ // remove another one, test that properties object is nulled
+ persistenceUnit.removeProperty("FOO");
+
+ assertNull(xmlPersistenceUnit.getProperties());
+ }
+
+ public void testModifyProperties4() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // add two properties and test that there are two existing in xml and context
+ persistenceUnit.putProperty("foo", "bar", false);
+ persistenceUnit.putProperty("FOO", "BAR", false);
+
+ assertEquals(xmlPersistenceUnit.getProperties().getProperties().size(), 2);
+ assertEquals(CollectionTools.size(persistenceUnit.properties()), 2);
+
+ // modify a property, test its value
+ persistenceUnit.putProperty("foo", "", false);
+ assertEquals("", persistenceUnit.getProperty("foo").getValue());
+
+ persistenceUnit.putProperty("foo", "BAR", false);
+ assertEquals("BAR", persistenceUnit.getProperty("foo").getValue());
+
+ // remove property that doesn't from context, test that the resource is unchanged
+ persistenceUnit.removeProperty("notExist");
+ assertEquals(2, xmlPersistenceUnit.getProperties().getProperties().size());
+
+ // remove property from context, test that it's removed from resource
+ persistenceUnit.removeProperty("FOO");
+ assertNull(persistenceUnit.getProperty("FOO"));
+ assertEquals(1, xmlPersistenceUnit.getProperties().getProperties().size());
+
+ // remove by setting value to null, test that properties object is nulled
+ persistenceUnit.putProperty("notExist", null, false);
+ assertNull(persistenceUnit.getProperty("notExist"));
+
+ persistenceUnit.putProperty("foo", null, false);
+ assertNull(persistenceUnit.getProperty("foo"));
+ assertNull(xmlPersistenceUnit.getProperties());
+ }
+
+ public void testModifyProperties5() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // testing duplicate keys, add four properties and test that there are four existing in xml and context
+ persistenceUnit.putProperty("FOO", "BAR", false);
+ persistenceUnit.putProperty("foo", "bar 3", true);
+ persistenceUnit.putProperty("foo", "bar 2", true);
+ persistenceUnit.putProperty("foo", "bar 1", true);
+
+ assertEquals(xmlPersistenceUnit.getProperties().getProperties().size(), 4);
+ assertEquals(CollectionTools.size(persistenceUnit.properties()), 4);
+
+ // modify a property, test its value
+ persistenceUnit.replacePropertyValue("foo", "bar 2", "bar two");
+
+ IProperty property = persistenceUnit.getProperty("foo", "bar two");
+ assertEquals("bar two", property.getValue());
+
+ // remove a property, test that there are four existing in xml and context
+ persistenceUnit.removeProperty("foo", "bar 1");
+ assertEquals(xmlPersistenceUnit.getProperties().getProperties().size(), 3);
+ assertEquals(CollectionTools.size(persistenceUnit.properties()), 3);
+ }
+
+ public void testAccessProperty() {
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // add two properties and try to access it.
+ persistenceUnit.putProperty("foo", "bar", false);
+ persistenceUnit.putProperty("FOO", "BAR", false);
+
+ IProperty property = persistenceUnit.getProperty("foo");
+ assertNotNull(property);
+ assertEquals("bar", property.getValue());
+ assertTrue(persistenceUnit.containsProperty("FOO"));
+ assertEquals("BAR", persistenceUnit.getProperty("FOO").getValue());
+ assertNull(persistenceUnit.getProperty("notExist"));
+ }
+
+ public void testUpdatePropertyName() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // add property for testing
+ XmlProperties xmlProperties = PersistenceFactory.eINSTANCE.createXmlProperties();
+ xmlPersistenceUnit.setProperties(xmlProperties);
+ XmlProperty xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
+ xmlProperties.getProperties().add(xmlProperty);
+ IProperty property = persistenceUnit.properties().next();
+
+ // test that names are initially equal
+ assertEquals(xmlProperty.getName(), property.getName());
+
+ // set name to different name, test equality
+ xmlProperty.setName("newName");
+
+ assertEquals(xmlProperty.getName(), property.getName());
+
+ // set name to empty string, test equality
+ xmlProperty.setName("");
+
+ assertEquals(xmlProperty.getName(), property.getName());
+
+ // set name to null, test equality
+ xmlProperty.setName(null);
+
+ assertEquals(xmlProperty.getName(), property.getName());
+
+ // set name back to non-null, test equality
+ xmlProperty.setName("newName");
+
+ assertEquals(xmlProperty.getName(), property.getName());
+ }
+
+ public void testUpdatePropertyValue() {
+ XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ // add property for testing
+ XmlProperties xmlProperties = PersistenceFactory.eINSTANCE.createXmlProperties();
+ xmlPersistenceUnit.setProperties(xmlProperties);
+ XmlProperty xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty();
+ xmlProperties.getProperties().add(xmlProperty);
+ IProperty property = persistenceUnit.properties().next();
+
+ // test that values are initially equal
+ assertEquals(xmlProperty.getValue(), property.getValue());
+
+ // set value to different value, test equality
+ xmlProperty.setValue("newValue");
+
+ assertEquals(xmlProperty.getValue(), property.getValue());
+
+ // set value to empty string, test equality
+ xmlProperty.setValue("");
+
+ assertEquals(xmlProperty.getValue(), property.getValue());
+
+ // set value to null, test equality
+ xmlProperty.setValue(null);
+
+ assertEquals(xmlProperty.getValue(), property.getValue());
+
+ // set value back to non-null, test equality
+ xmlProperty.setValue("newValue");
+
+ assertEquals(xmlProperty.getValue(), property.getValue());
+ }
+
+
+ public void testGetDefaultAccess() throws Exception {
+ createOrmXmlFile();
+ IPersistenceUnit persistenceUnit = persistenceUnit();
+
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
+ assertEquals(AccessType.PROPERTY, persistenceUnit.getDefaultAccess());
+
+ entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.FIELD);
+ assertEquals(AccessType.FIELD, persistenceUnit.getDefaultAccess());
+ }
+
+ protected void createOrmXmlFile() throws Exception {
+ XmlMappingFileRef mappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef();
+ mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH);
+ xmlPersistenceUnit().getMappingFiles().add(mappingFileRef);
+ persistenceResource().save(null);
+ }
+//TODO
+// String getDefaultSchema();
+// String getDefaultCatalog();
+// AccessType getDefaultAccess();
+// boolean getDefaultCascadePersist();
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceXmlTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceXmlTests.java
new file mode 100644
index 0000000000..e0a92c589d
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceXmlTests.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.context.persistence;
+
+import org.eclipse.jpt.core.internal.context.base.IPersistenceXml;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResource;
+import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+
+public class PersistenceXmlTests extends ContextModelTestCase
+{
+ public PersistenceXmlTests(String name) {
+ super(name);
+ }
+
+ protected IPersistenceXml persistenceXml() {
+ return jpaContent().getPersistenceXml();
+ }
+
+ public void testUpdateAddPersistence() throws Exception {
+ PersistenceResource prm = persistenceResource();
+ prm.getContents().clear();
+ prm.save(null);
+
+ assertNull(persistenceXml().getPersistence());
+
+ prm.getContents().add(PersistenceFactory.eINSTANCE.createXmlPersistence());
+
+ assertNotNull(persistenceXml().getPersistence());
+
+ }
+
+ public void testModifyAddPersistence() {
+ PersistenceResource prm = persistenceResource();
+ prm.getContents().remove(prm.getPersistence());
+ assertNull(prm.getPersistence());
+
+ IPersistenceXml persistenceXml = persistenceXml();
+
+ persistenceXml.addPersistence();
+
+ assertNotNull(persistenceXml.getPersistence());
+
+ boolean exceptionThrown = false;
+ try {
+ persistenceXml.addPersistence();
+ }
+ catch (IllegalStateException ise) {
+ exceptionThrown = true;
+ }
+
+ assertTrue(exceptionThrown);
+ }
+
+ public void testUpdateRemovePersistence() throws Exception {
+ PersistenceResource prm = persistenceResource();
+
+ assertNotNull(persistenceXml().getPersistence());
+
+ prm.getContents().clear();
+
+ assertNull(persistenceXml().getPersistence());
+ }
+
+ public void testModifyRemovePersistence() {
+ IPersistenceXml persistenceXml = persistenceXml();
+
+ assertNotNull(persistenceXml.getPersistence());
+
+ persistenceXml.removePersistence();
+
+ assertNull(persistenceXml.getPersistence());
+
+ boolean exceptionThrown = false;
+ try {
+ persistenceXml.removePersistence();
+ }
+ catch (IllegalStateException ise) {
+ exceptionThrown = true;
+ }
+
+ assertTrue(exceptionThrown);
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/AnnotationTestCase.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/AnnotationTestCase.java
index b4ad34ec36..edf77b4a38 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/AnnotationTestCase.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/AnnotationTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -12,7 +12,7 @@ package org.eclipse.jpt.core.tests.internal.jdtutility;
import java.io.File;
import java.util.Iterator;
import java.util.List;
-
+import junit.framework.TestCase;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@@ -37,8 +37,7 @@ import org.eclipse.jpt.utility.internal.CommandExecutor;
import org.eclipse.jpt.utility.internal.CommandExecutorProvider;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator;
-
-import junit.framework.TestCase;
+import org.eclipse.jpt.utility.tests.internal.TestTools;
/**
* Provide an easy(?) way to build an annotated source file.
@@ -70,19 +69,27 @@ public abstract class AnnotationTestCase extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- ProjectUtility.deleteAllProjects();
- this.javaProject = this.buildJavaProject(PROJECT_NAME, false); // false = no auto-build
+ this.deleteAllProjects();
+ this.javaProject = this.buildJavaProject(false); // false = no auto-build
}
-
+
+ protected void deleteAllProjects() throws Exception {
+ ProjectUtility.deleteAllProjects();
+ }
+
+ protected TestJavaProject buildJavaProject(boolean autoBuild) throws Exception {
+ return this.buildJavaProject(PROJECT_NAME, autoBuild);
+ }
+
protected TestJavaProject buildJavaProject(String projectName, boolean autoBuild) throws Exception {
- return new TestJavaProject(projectName, autoBuild); // false = no auto-build
+ return new TestJavaProject(projectName, autoBuild);
}
@Override
protected void tearDown() throws Exception {
// this.dumpSource();
// this.javaProject.dispose();
- this.javaProject = null;
+ TestTools.clear(this);
super.tearDown();
}
@@ -128,15 +135,24 @@ public abstract class AnnotationTestCase extends TestCase {
return this.createTestType(null, idFieldAnnotation);
}
+
protected IType createTestType(AnnotationWriter annotationWriter) throws CoreException {
return this.javaProject.createType(PACKAGE_NAME, FILE_NAME, this.createSourceWriter(annotationWriter));
}
+
+ protected IType createTestType(String packageName, String fileName, String typeName, AnnotationWriter annotationWriter) throws CoreException {
+ return this.javaProject.createType(packageName, fileName, this.createSourceWriter(annotationWriter, typeName));
+ }
protected SourceWriter createSourceWriter(AnnotationWriter annotationWriter) {
return new AnnotatedSourceWriter(annotationWriter);
}
+
+ protected SourceWriter createSourceWriter(AnnotationWriter annotationWriter, String typeName) {
+ return new AnnotatedSourceWriter(annotationWriter, typeName);
+ }
- protected void appendSourceTo(StringBuilder sb, AnnotationWriter annotationWriter) {
+ protected void appendSourceTo(StringBuilder sb, AnnotationWriter annotationWriter, String typeName) {
sb.append(CR);
for (Iterator<String> stream = annotationWriter.imports(); stream.hasNext(); ) {
sb.append("import ");
@@ -144,9 +160,12 @@ public abstract class AnnotationTestCase extends TestCase {
sb.append(";");
sb.append(CR);
}
+ sb.append(CR);
annotationWriter.appendTypeAnnotationTo(sb);
sb.append(CR);
- sb.append("public class ").append(TYPE_NAME).append(" {").append(CR);
+ sb.append("public class ").append(typeName).append(" ");
+ annotationWriter.appendExtendsImplementsTo(sb);
+ sb.append("{").append(CR);
sb.append(CR);
sb.append(" ");
annotationWriter.appendIdFieldAnnotationTo(sb);
@@ -186,12 +205,20 @@ public abstract class AnnotationTestCase extends TestCase {
sb.append(" this.testField = testField;").append(CR);
sb.append(" }").append(CR);
sb.append(CR);
+ annotationWriter.appendMemberTypeTo(sb);
+ sb.append(CR);
sb.append("}").append(CR);
+ annotationWriter.appendTopLevelTypesTo(sb);
+ sb.append(CR);
}
// ********** queries **********
+ protected TestJavaProject getJavaProject() {
+ return this.javaProject;
+ }
+
protected IType jdtType() throws JavaModelException {
return this.javaProject.findType(FULLY_QUALIFIED_TYPE_NAME);
}
@@ -219,6 +246,10 @@ public abstract class AnnotationTestCase extends TestCase {
protected MethodAttribute idGetMethod() throws JavaModelException {
return this.methodNamed("getId");
}
+
+ protected MethodAttribute idSetMethod() throws JavaModelException {
+ return this.method("setId", new String[] {"I"});
+ }
protected MethodAttribute nameGetMethod() throws JavaModelException {
return this.methodNamed("getName");
@@ -296,6 +327,9 @@ public abstract class AnnotationTestCase extends TestCase {
return null;
}
+ /**
+ * minimize the scope of the suppressed warnings
+ */
@SuppressWarnings("unchecked")
protected List<MemberValuePair> values(NormalAnnotation na) {
return na.values();
@@ -409,23 +443,29 @@ public abstract class AnnotationTestCase extends TestCase {
public interface AnnotationWriter {
Iterator<String> imports();
void appendTypeAnnotationTo(StringBuilder sb);
+ void appendExtendsImplementsTo(StringBuilder sb);
void appendIdFieldAnnotationTo(StringBuilder sb);
void appendNameFieldAnnotationTo(StringBuilder sb);
void appendGetIdMethodAnnotationTo(StringBuilder sb);
void appendSetIdMethodAnnotationTo(StringBuilder sb);
void appendGetNameMethodAnnotationTo(StringBuilder sb);
void appendSetNameMethodAnnotationTo(StringBuilder sb);
+ void appendMemberTypeTo(StringBuilder sb);
+ void appendTopLevelTypesTo(StringBuilder sb);
}
public static class DefaultAnnotationWriter implements AnnotationWriter {
public Iterator<String> imports() {return EmptyIterator.instance();}
public void appendTypeAnnotationTo(StringBuilder sb) {/* do nothing */}
+ public void appendExtendsImplementsTo(StringBuilder sb) {/* do nothing */}
public void appendIdFieldAnnotationTo(StringBuilder sb) {/* do nothing */}
public void appendNameFieldAnnotationTo(StringBuilder sb) {/* do nothing */}
public void appendGetIdMethodAnnotationTo(StringBuilder sb) {/* do nothing */}
public void appendSetIdMethodAnnotationTo(StringBuilder sb) {/* do nothing */}
public void appendGetNameMethodAnnotationTo(StringBuilder sb) {/* do nothing */}
public void appendSetNameMethodAnnotationTo(StringBuilder sb) {/* do nothing */}
+ public void appendMemberTypeTo(StringBuilder sb) {/* do nothing */}
+ public void appendTopLevelTypesTo(StringBuilder sb) {/* do nothing */}
}
public static class AnnotationWriterWrapper implements AnnotationWriter {
@@ -436,22 +476,30 @@ public abstract class AnnotationTestCase extends TestCase {
}
public Iterator<String> imports() {return aw.imports();}
public void appendTypeAnnotationTo(StringBuilder sb) {aw.appendTypeAnnotationTo(sb);}
+ public void appendExtendsImplementsTo(StringBuilder sb) {aw.appendExtendsImplementsTo(sb);}
public void appendIdFieldAnnotationTo(StringBuilder sb) {aw.appendIdFieldAnnotationTo(sb);}
public void appendNameFieldAnnotationTo(StringBuilder sb) {aw.appendNameFieldAnnotationTo(sb);}
public void appendGetIdMethodAnnotationTo(StringBuilder sb) {aw.appendGetIdMethodAnnotationTo(sb);}
public void appendSetIdMethodAnnotationTo(StringBuilder sb) {aw.appendSetIdMethodAnnotationTo(sb);}
public void appendGetNameMethodAnnotationTo(StringBuilder sb) {aw.appendGetNameMethodAnnotationTo(sb);}
public void appendSetNameMethodAnnotationTo(StringBuilder sb) {aw.appendSetNameMethodAnnotationTo(sb);}
+ public void appendMemberTypeTo(StringBuilder sb) {aw.appendMemberTypeTo(sb);}
+ public void appendTopLevelTypesTo(StringBuilder sb) {aw.appendTopLevelTypesTo(sb);}
}
public class AnnotatedSourceWriter implements SourceWriter {
private AnnotationWriter annotationWriter;
+ private String typeName;
public AnnotatedSourceWriter(AnnotationWriter annotationWriter) {
+ this(annotationWriter, TYPE_NAME);
+ }
+ public AnnotatedSourceWriter(AnnotationWriter annotationWriter, String typeName) {
super();
this.annotationWriter = annotationWriter;
+ this.typeName = typeName;
}
public void appendSourceTo(StringBuilder sb) {
- AnnotationTestCase.this.appendSourceTo(sb, this.annotationWriter);
+ AnnotationTestCase.this.appendSourceTo(sb, this.annotationWriter, typeName);
}
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/MemberAnnotationElementAdapterTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/MemberAnnotationElementAdapterTests.java
index b07c31488a..3c0fe0a112 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/MemberAnnotationElementAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/MemberAnnotationElementAdapterTests.java
@@ -15,7 +15,7 @@ import org.eclipse.jpt.core.internal.ITextRange;
import org.eclipse.jpt.core.internal.jdtutility.ASTNodeTextRange;
import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter;
import org.eclipse.jpt.core.internal.jdtutility.AnnotationStringArrayExpressionConverter;
-import org.eclipse.jpt.core.internal.jdtutility.BooleanStringExpressionConverter;
+import org.eclipse.jpt.core.internal.jdtutility.BooleanExpressionConverter;
import org.eclipse.jpt.core.internal.jdtutility.CharacterStringExpressionConverter;
import org.eclipse.jpt.core.internal.jdtutility.ConversionDeclarationAnnotationElementAdapter;
import org.eclipse.jpt.core.internal.jdtutility.DeclarationAnnotationAdapter;
@@ -26,7 +26,7 @@ import org.eclipse.jpt.core.internal.jdtutility.ExpressionConverter;
import org.eclipse.jpt.core.internal.jdtutility.MemberAnnotationElementAdapter;
import org.eclipse.jpt.core.internal.jdtutility.NestedDeclarationAnnotationAdapter;
import org.eclipse.jpt.core.internal.jdtutility.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.core.internal.jdtutility.NumberStringExpressionConverter;
+import org.eclipse.jpt.core.internal.jdtutility.NumberIntegerExpressionConverter;
import org.eclipse.jpt.core.internal.jdtutility.PrimitiveTypeStringExpressionConverter;
import org.eclipse.jpt.core.internal.jdtutility.SimpleDeclarationAnnotationAdapter;
import org.eclipse.jpt.core.internal.jdtutility.SimpleTypeStringExpressionConverter;
@@ -59,9 +59,9 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase {
this.createAnnotationAndMembers("Foo", "int bar();");
this.createTestType("@annot.Foo(bar=48)");
DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", NumberStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
- assertEquals("48", aea.getValue());
+ DeclarationAnnotationElementAdapter<Integer> daea = new ConversionDeclarationAnnotationElementAdapter<Integer>(daa, "bar", NumberIntegerExpressionConverter.instance());
+ AnnotationElementAdapter<Integer> aea = new MemberAnnotationElementAdapter<Integer>(this.idField(), daea);
+ assertEquals(Integer.valueOf(48), aea.getValue());
}
public void testGetValue3() throws Exception {
@@ -77,9 +77,9 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase {
this.createAnnotationAndMembers("Foo", "boolean bar();");
this.createTestType("@annot.Foo(bar=false)");
DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, "bar", BooleanStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
- assertEquals("false", aea.getValue());
+ DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa, "bar", BooleanExpressionConverter.instance());
+ AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(), daea);
+ assertEquals(Boolean.FALSE, aea.getValue());
}
public void testGetValue5() throws Exception {
@@ -90,18 +90,18 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase {
DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar");
DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa3, "fred", BooleanStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
- assertEquals("false", aea.getValue());
+ DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa3, "fred", BooleanExpressionConverter.instance());
+ AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(), daea);
+ assertEquals(Boolean.FALSE, aea.getValue());
}
public void testGetValue6() throws Exception {
this.createAnnotationAndMembers("Foo", "boolean value();");
this.createTestType("@annot.Foo(false)");
DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa, BooleanStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
- assertEquals("false", aea.getValue());
+ DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa, BooleanExpressionConverter.instance());
+ AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(), daea);
+ assertEquals(Boolean.FALSE, aea.getValue());
}
public void testGetValueNull1() throws Exception {
@@ -158,18 +158,18 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase {
this.createAnnotationAndMembers("Foo", "int bar();");
this.createTestType("@annot.Foo(bar=47 - 7 + 2 * 1 / 1)");
DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forNumbers(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
- assertEquals("42", aea.getValue());
+ DeclarationAnnotationElementAdapter<Integer> daea = ConversionDeclarationAnnotationElementAdapter.forNumbers(daa, "bar");
+ AnnotationElementAdapter<Integer> aea = new MemberAnnotationElementAdapter<Integer>(this.idField(), daea);
+ assertEquals(Integer.valueOf(42), aea.getValue());
}
public void testGetValueNumberShift() throws Exception {
this.createAnnotationAndMembers("Foo", "int bar();");
this.createTestType("@annot.Foo(bar=2 << 2)");
DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forNumbers(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
- assertEquals("8", aea.getValue());
+ DeclarationAnnotationElementAdapter<Integer> daea = ConversionDeclarationAnnotationElementAdapter.forNumbers(daa, "bar");
+ AnnotationElementAdapter<Integer> aea = new MemberAnnotationElementAdapter<Integer>(this.idField(), daea);
+ assertEquals(Integer.valueOf(8), aea.getValue());
}
public void testGetValueNumberConstant() throws Exception {
@@ -177,9 +177,9 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase {
// just a bit hacky:
this.createTestType("private static final int FOO_BAR = 77; @annot.Foo(bar=FOO_BAR)");
DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forNumbers(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
- assertEquals("77", aea.getValue());
+ DeclarationAnnotationElementAdapter<Integer> daea = ConversionDeclarationAnnotationElementAdapter.forNumbers(daa, "bar");
+ AnnotationElementAdapter<Integer> aea = new MemberAnnotationElementAdapter<Integer>(this.idField(), daea);
+ assertEquals(Integer.valueOf(77), aea.getValue());
}
public void testGetValueCharacterConstant() throws Exception {
@@ -205,36 +205,36 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase {
this.createAnnotationAndMembers("Foo", "boolean bar();");
this.createTestType("@annot.Foo(bar=7 > 2)");
DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
- assertEquals("true", aea.getValue());
+ DeclarationAnnotationElementAdapter<Boolean> daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar");
+ AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(), daea);
+ assertEquals(Boolean.TRUE, aea.getValue());
}
public void testGetValueBooleanOperator2() throws Exception {
this.createAnnotationAndMembers("Foo", "boolean bar();");
this.createTestType("@annot.Foo(bar=7 == 2)");
DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
- assertEquals("false", aea.getValue());
+ DeclarationAnnotationElementAdapter<Boolean> daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar");
+ AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(), daea);
+ assertEquals(Boolean.FALSE, aea.getValue());
}
public void testGetValueBooleanOperator3() throws Exception {
this.createAnnotationAndMembers("Foo", "boolean bar();");
this.createTestType("@annot.Foo(bar=(7 != 2) && false)");
DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
- assertEquals("false", aea.getValue());
+ DeclarationAnnotationElementAdapter<Boolean> daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar");
+ AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(), daea);
+ assertEquals(Boolean.FALSE, aea.getValue());
}
public void testGetValueBooleanOperator4() throws Exception {
this.createAnnotationAndMembers("Foo", "boolean bar();");
this.createTestType("@annot.Foo(bar=(7 != 2) ? false : true)");
DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
- assertEquals("false", aea.getValue());
+ DeclarationAnnotationElementAdapter<Boolean> daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar");
+ AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(), daea);
+ assertEquals(Boolean.FALSE, aea.getValue());
}
public void testGetValueInvalidValue1() throws Exception {
@@ -259,8 +259,8 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase {
this.createAnnotationAndMembers("Foo", "boolean bar();");
this.createTestType("@annot.Foo(bar=bazzzz)");
DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo");
- DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar");
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
+ DeclarationAnnotationElementAdapter<Boolean> daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar");
+ AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(), daea);
assertNull(aea.getValue());
}
@@ -303,8 +303,8 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase {
DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar");
DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa3, "fred", BooleanStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
+ DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa3, "fred", BooleanExpressionConverter.instance());
+ AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(), daea);
assertNull(aea.getValue());
}
@@ -339,7 +339,7 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase {
ITextRange textRange = new ASTNodeTextRange(aea.astNode());
assertEquals(this.source().indexOf(value), textRange.getOffset());
assertEquals(value.length(), textRange.getLength());
- assertEquals(7, textRange.getLineNumber());
+ assertEquals(8, textRange.getLineNumber());
}
public void testASTNode2() throws Exception {
@@ -353,9 +353,9 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase {
DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar");
DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa3, "fred", BooleanStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
- assertEquals("false", aea.getValue());
+ DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa3, "fred", BooleanExpressionConverter.instance());
+ AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(), daea);
+ assertEquals(Boolean.FALSE, aea.getValue());
ITextRange textRange = new ASTNodeTextRange(aea.astNode());
assertEquals(value.length(), textRange.getLength());
}
@@ -424,8 +424,8 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase {
DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar");
DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa3, "fred", BooleanStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
+ DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa3, "fred", BooleanExpressionConverter.instance());
+ AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(), daea);
aea.setValue(null);
this.assertSourceDoesNotContain(annotation);
@@ -443,8 +443,8 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase {
DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar", false);
DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz", false);
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa3, "fred", BooleanStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
+ DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa3, "fred", BooleanExpressionConverter.instance());
+ AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(), daea);
aea.setValue(null);
this.assertSourceDoesNotContain(annotation);
@@ -472,10 +472,10 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase {
DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar");
DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa3, "fred", BooleanStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
+ DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa3, "fred", BooleanExpressionConverter.instance());
+ AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(), daea);
- aea.setValue("true");
+ aea.setValue(Boolean.TRUE);
this.assertSourceDoesNotContain(annotation);
this.assertSourceContains("@annot.Foo(@annot.Bar(jimmy=@annot.Baz(fred=true)))");
}
@@ -488,10 +488,10 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase {
DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar");
DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa3, "fred", BooleanStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
+ DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa3, "fred", BooleanExpressionConverter.instance());
+ AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(), daea);
- aea.setValue("true");
+ aea.setValue(Boolean.TRUE);
this.assertSourceContains("@Foo(@Bar(jimmy=@Baz(fred=true)))");
}
@@ -560,11 +560,11 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase {
DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo");
DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar");
DeclarationAnnotationAdapter daa3 = new NestedIndexedDeclarationAnnotationAdapter(daa2, "jimmy", 2, "annot.Baz");
- DeclarationAnnotationElementAdapter<String> daea = new ConversionDeclarationAnnotationElementAdapter<String>(daa3, "fred", NumberStringExpressionConverter.instance());
- AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea);
+ DeclarationAnnotationElementAdapter<Integer> daea = new ConversionDeclarationAnnotationElementAdapter<Integer>(daa3, "fred", NumberIntegerExpressionConverter.instance());
+ AnnotationElementAdapter<Integer> aea = new MemberAnnotationElementAdapter<Integer>(this.idField(), daea);
- assertEquals("2", aea.getValue());
- aea.setValue("48");
+ assertEquals(Integer.valueOf(2), aea.getValue());
+ aea.setValue(Integer.valueOf(48));
this.assertSourceContains("@annot.Foo(@annot.Bar(jimmy={@annot.Baz(fred=0), @annot.Baz(fred=1), @annot.Baz(fred=48), @annot.Baz(fred=3)}))");
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/TypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/TypeTests.java
index 47dde10180..60a7078554 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/TypeTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/TypeTests.java
@@ -41,10 +41,6 @@ public class TypeTests extends AnnotationTestCase {
assertEquals(this.jdtType, this.testType.getJdtMember());
}
- public void testIsAbstract() throws Exception {
- assertFalse(this.testType.isAbstract());
- }
-
public void testTopLevelDeclaringType() throws Exception {
assertEquals(this.testType, this.testType.topLevelDeclaringType());
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java
index 8b611e5559..640b33814d 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java
@@ -47,7 +47,7 @@ public class JpaModelTests extends TestCase {
}
private boolean debug() {
- Boolean debug = (Boolean) ClassTools.getStaticFieldValue(JpaModelManager.class, "DEBUG");
+ Boolean debug = (Boolean) ClassTools.staticFieldValue(JpaModelManager.class, "DEBUG");
return debug.booleanValue();
}
@@ -120,103 +120,99 @@ public class JpaModelTests extends TestCase {
assertNull(jpaProject);
}
-/* Commented out the following three tests as they are unreliable on linux running on the IBM JDK
- * which describes the current build/test environment.
- */
-
-// public void testProjectCloseReopen() throws Exception {
-// TestFacetedProject testProject = this.buildTestProject();
-// testProject.installFacet("jpt.jpa", "1.0");
-//
-// testProject.getProject().close(null);
-// assertFalse(testProject.getProject().isOpen());
-// IJpaProject jpaProject = JptCorePlugin.jpaProject(testProject.getProject());
-// assertNull(jpaProject);
-//
-// testProject.getProject().open(null);
-// jpaProject = JptCorePlugin.jpaProject(testProject.getProject());
-// assertNotNull(jpaProject);
-//// assertEquals(4, jpaProject.jpaFilesSize());
-// assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/test.pkg/TestEntity.java")));
-// assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/test.pkg/TestEntity2.java")));
-// // persistence.xml and orm.xml are created in the background, so they probably
-// // won't be there yet...
-//// assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/META-INF/persistence.xml")));
-//// assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/META-INF/orm.xml")));
-// }
-//
-// public void testProjectDeleteReimport() throws Exception {
-// TestFacetedProject testProject = this.buildTestProject();
-// testProject.installFacet("jpt.jpa", "1.0");
-// IJpaProject jpaProject = JptCorePlugin.jpaProject(testProject.getProject());
-// assertNotNull(jpaProject);
-// assertEquals(1, JptCorePlugin.jpaModel().jpaProjectsSize());
-//
-// testProject.getProject().delete(false, true, null);
+ public void testProjectCloseReopen() throws Exception {
+ TestFacetedProject testProject = this.buildTestProject();
+ testProject.installFacet("jpt.jpa", "1.0");
+
+ testProject.getProject().close(null);
+ assertFalse(testProject.getProject().isOpen());
+ IJpaProject jpaProject = JptCorePlugin.jpaProject(testProject.getProject());
+ assertNull(jpaProject);
+
+ testProject.getProject().open(null);
+ jpaProject = JptCorePlugin.jpaProject(testProject.getProject());
+ assertNotNull(jpaProject);
+// assertEquals(4, jpaProject.jpaFilesSize());
+ assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/test.pkg/TestEntity.java")));
+ assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/test.pkg/TestEntity2.java")));
+ // persistence.xml and orm.xml are created in the background, so they probably
+ // won't be there yet...
+// assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/META-INF/persistence.xml")));
+// assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/META-INF/orm.xml")));
+ }
+
+ public void testProjectDeleteReimport() throws Exception {
+ TestFacetedProject testProject = this.buildTestProject();
+ testProject.installFacet("jpt.jpa", "1.0");
+ IJpaProject jpaProject = JptCorePlugin.jpaProject(testProject.getProject());
+ assertNotNull(jpaProject);
+ assertEquals(1, JptCorePlugin.jpaModel().jpaProjectsSize());
+
+ testProject.getProject().delete(false, true, null);
+ jpaProject = JptCorePlugin.jpaProject(testProject.getProject());
+ assertNull(jpaProject);
+ assertEquals(0, JptCorePlugin.jpaModel().jpaProjectsSize());
+ assertEquals(0, ResourcesPlugin.getWorkspace().getRoot().getProjects().length);
+
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(testProject.getProject().getName());
+ project.create(null);
+ assertEquals(1, ResourcesPlugin.getWorkspace().getRoot().getProjects().length);
+ project.open(null);
+
+ assertTrue(project.isOpen());
+ assertTrue(JptCorePlugin.projectHasJpaFacet(project));
+ jpaProject = JptCorePlugin.jpaProject(project);
+ assertNotNull(jpaProject);
+// assertEquals(4, jpaProject.jpaFilesSize());
+ assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/test.pkg/TestEntity.java")));
+ assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/test.pkg/TestEntity2.java")));
+ // persistence.xml and orm.xml are created in the background, so they probably
+ // won't be there yet...
+// assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/META-INF/persistence.xml")));
+// assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/META-INF/orm.xml")));
+ }
+
+ public void testEditFacetSettingsFile() throws Exception {
+ TestFacetedProject testProject = this.buildTestProject();
+ assertNull(JptCorePlugin.jpaProject(testProject.getProject()));
+
+ // add the JPA facet by modifying the facet settings file directly
+ IFile facetSettingsFile = this.file(testProject, ".settings/org.eclipse.wst.common.project.facet.core.xml");
+ InputStream inStream = new BufferedInputStream(facetSettingsFile.getContents());
+ int fileSize = inStream.available();
+ byte[] buf = new byte[fileSize];
+ inStream.read(buf);
+ inStream.close();
+
+ String oldDocument = new String(buf);
+ String oldString = "<installed facet=\"jst.utility\" version=\"1.0\"/>";
+ String newString = oldString + CR + " " + "<installed facet=\"jpt.jpa\" version=\"1.0\"/>";
+ String newDocument = oldDocument.replaceAll(oldString, newString);
+
+ facetSettingsFile.setContents(new ByteArrayInputStream(newDocument.getBytes()), false, false, null);
+
+ assertEquals(1, JptCorePlugin.jpaModel().jpaProjectsSize());
+ IJpaProject jpaProject = JptCorePlugin.jpaProject(testProject.getProject());
+ assertNotNull(jpaProject);
+ // persistence.xml and orm.xml do not get created in this situation (?)
+ assertEquals(2, jpaProject.jpaFilesSize());
+ assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/test.pkg/TestEntity.java")));
+ assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/test.pkg/TestEntity2.java")));
+ // assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/META-INF/persistence.xml")));
+ // assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/META-INF/orm.xml")));
+
+ // now remove the JPA facet
+ facetSettingsFile.setContents(new ByteArrayInputStream(oldDocument.getBytes()), false, false, null);
+// TODO moved this stuff to the error console until we can figure out why it fails intermittently ~bjv
+// assertEquals(0, JptCorePlugin.jpaModel().jpaProjectsSize());
// jpaProject = JptCorePlugin.jpaProject(testProject.getProject());
// assertNull(jpaProject);
-// assertEquals(0, JptCorePlugin.jpaModel().jpaProjectsSize());
-// assertEquals(0, ResourcesPlugin.getWorkspace().getRoot().getProjects().length);
-//
-// IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(testProject.getProject().getName());
-// project.create(null);
-// assertEquals(1, ResourcesPlugin.getWorkspace().getRoot().getProjects().length);
-// project.open(null);
-//
-// assertTrue(project.isOpen());
-// assertTrue(JptCorePlugin.projectHasJpaFacet(project));
-// jpaProject = JptCorePlugin.jpaProject(project);
-// assertNotNull(jpaProject);
-//// assertEquals(4, jpaProject.jpaFilesSize());
-// assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/test.pkg/TestEntity.java")));
-// assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/test.pkg/TestEntity2.java")));
-// // persistence.xml and orm.xml are created in the background, so they probably
-// // won't be there yet...
-//// assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/META-INF/persistence.xml")));
-//// assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/META-INF/orm.xml")));
-// }
-
-// public void testEditFacetSettingsFile() throws Exception {
-// TestFacetedProject testProject = this.buildTestProject();
-// assertNull(JptCorePlugin.jpaProject(testProject.getProject()));
-//
-// // add the JPA facet by modifying the facet settings file directly
-// IFile facetSettingsFile = this.file(testProject, ".settings/org.eclipse.wst.common.project.facet.core.xml");
-// InputStream inStream = new BufferedInputStream(facetSettingsFile.getContents());
-// int fileSize = inStream.available();
-// byte[] buf = new byte[fileSize];
-// inStream.read(buf);
-// inStream.close();
-//
-// String oldDocument = new String(buf);
-// String oldString = "<installed facet=\"jst.utility\" version=\"1.0\"/>";
-// String newString = oldString + CR + " " + "<installed facet=\"jpt.jpa\" version=\"1.0\"/>";
-// String newDocument = oldDocument.replaceAll(oldString, newString);
-//
-// facetSettingsFile.setContents(new ByteArrayInputStream(newDocument.getBytes()), false, false, null);
-//
-// assertEquals(1, JptCorePlugin.jpaModel().jpaProjectsSize());
-// IJpaProject jpaProject = JptCorePlugin.jpaProject(testProject.getProject());
-// assertNotNull(jpaProject);
-// // persistence.xml and orm.xml do not get created in this situation (?)
-// assertEquals(2, jpaProject.jpaFilesSize());
-// assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/test.pkg/TestEntity.java")));
-// assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/test.pkg/TestEntity2.java")));
-// // assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/META-INF/persistence.xml")));
-// // assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/META-INF/orm.xml")));
-//
-// // now remove the JPA facet
-// facetSettingsFile.setContents(new ByteArrayInputStream(oldDocument.getBytes()), false, false, null);
-//// TODO moved this stuff to the error console until we can figure out why it fails intermittently ~bjv
-//// assertEquals(0, JptCorePlugin.jpaModel().jpaProjectsSize());
-//// jpaProject = JptCorePlugin.jpaProject(testProject.getProject());
-//// assertNull(jpaProject);
-// int size = JptCorePlugin.jpaModel().jpaProjectsSize();
-// if (size != 0) {
-// System.err.println("bogus size: " + size);
-// System.err.println("bogus project: " + JptCorePlugin.jpaProject(testProject.getProject()));
-// }
-// }
+ int size = JptCorePlugin.jpaModel().jpaProjectsSize();
+ if (size != 0) {
+ System.err.println("bogus size: " + size);
+ System.err.println("bogus project: " + JptCorePlugin.jpaProject(testProject.getProject()));
+ }
+ }
/**
* make sure the DEBUG constants are 'false' before checking in the code
@@ -228,7 +224,7 @@ public class JpaModelTests extends TestCase {
private void verifyDEBUG(Class<?> clazz) {
assertFalse("Recompile with \"DEBUG = false\": " + clazz.getName(),
- ((Boolean) ClassTools.getStaticFieldValue(clazz, "DEBUG")).booleanValue());
+ ((Boolean) ClassTools.staticFieldValue(clazz, "DEBUG")).booleanValue());
}
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/BaseJpaPlatformTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/BaseJpaPlatformTests.java
index 3266cb3693..07c4967a77 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/BaseJpaPlatformTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/BaseJpaPlatformTests.java
@@ -1,30 +1,8 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.tests.internal.platform;
-import java.io.IOException;
import junit.framework.TestCase;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jpt.core.internal.IJpaFile;
-import org.eclipse.jpt.core.internal.content.orm.EntityMappingsInternal;
-import org.eclipse.jpt.core.internal.content.orm.OrmFactory;
-import org.eclipse.jpt.core.internal.content.orm.XmlEntityInternal;
-import org.eclipse.jpt.core.internal.content.orm.XmlRootContentNode;
-import org.eclipse.jpt.core.internal.content.persistence.JavaClassRef;
-import org.eclipse.jpt.core.internal.content.persistence.Persistence;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.internal.content.persistence.PersistenceXmlRootContentNode;
import org.eclipse.jpt.core.tests.internal.ProjectUtility;
import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-import org.eclipse.jpt.utility.internal.CollectionTools;
public class BaseJpaPlatformTests extends TestCase
{
@@ -58,34 +36,33 @@ public class BaseJpaPlatformTests extends TestCase
super.tearDown();
}
-
- public void testPersistentTypes() throws CoreException, IOException {
- IFile persistenceXmlIFile = jpaProject.getProject().getFile(PERSISTENCE_XML_LOCATION);
- IJpaFile persistenceXmlJpaFile = jpaProject.getJpaProject().jpaFile(persistenceXmlIFile);
- PersistenceXmlRootContentNode persistenceRoot = (PersistenceXmlRootContentNode) persistenceXmlJpaFile.getContent();
- Persistence persistence = persistenceRoot.getPersistence();
-
- IFile ormXmlIFile = jpaProject.getProject().getFile(ORM_XML_LOCATION);
- IJpaFile ormXmlJpaFile = jpaProject.getJpaProject().jpaFile(ormXmlIFile);
- XmlRootContentNode ormRoot = (XmlRootContentNode) ormXmlJpaFile.getContent();
- EntityMappingsInternal entityMappings = ormRoot.getEntityMappings();
-
- // add xml persistent type
- XmlEntityInternal xmlEntity = OrmFactory.eINSTANCE.createXmlEntityInternal();
- xmlEntity.setSpecifiedName("XmlEntity");
- entityMappings.getTypeMappings().add(xmlEntity);
- entityMappings.eResource().save(null);
- assertEquals(1, CollectionTools.size(jpaProject.getJpaProject().jpaPlatform().persistentTypes(PROJECT_NAME)));
-
- // add java persistent type
- jpaProject.createType(PACKAGE_NAME, "JavaEntity.java",
- "@Entity public class JavaEntity {}"
- );
- JavaClassRef javaClassRef = PersistenceFactory.eINSTANCE.createJavaClassRef();
- javaClassRef.setJavaClass(PACKAGE_NAME + ".JavaEntity");
- persistence.getPersistenceUnits().get(0).getClasses().add(javaClassRef);
- persistence.eResource().save(null);
-
- assertEquals(2, CollectionTools.size(jpaProject.getJpaProject().jpaPlatform().persistentTypes(PROJECT_NAME)));
- }
+// public void testPersistentTypes() throws CoreException, IOException {
+// IFile persistenceXmlIFile = jpaProject.getProject().getFile(PERSISTENCE_XML_LOCATION);
+// IJpaFile persistenceXmlJpaFile = jpaProject.getJpaProject().getJpaFile(persistenceXmlIFile);
+// PersistenceXmlRootContentNode persistenceRoot = (PersistenceXmlRootContentNode) persistenceXmlJpaFile.getContent();
+// XmlPersistence persistence = persistenceRoot.getPersistence();
+//
+// IFile ormXmlIFile = jpaProject.getProject().getFile(ORM_XML_LOCATION);
+// IJpaFile ormXmlJpaFile = jpaProject.getJpaProject().getJpaFile(ormXmlIFile);
+// XmlRootContentNode ormRoot = (XmlRootContentNode) ormXmlJpaFile.getContent();
+// EntityMappingsInternal entityMappings = ormRoot.getEntityMappings();
+//
+// // add xml persistent type
+// XmlEntityInternal xmlEntity = OrmFactory.eINSTANCE.createXmlEntityInternal();
+// xmlEntity.setSpecifiedName("XmlEntity");
+// entityMappings.getTypeMappings().add(xmlEntity);
+// entityMappings.eResource().save(null);
+// assertEquals(1, CollectionTools.size(jpaProject.getJpaProject().getPlatform().persistentTypes(PROJECT_NAME)));
+//
+// // add java persistent type
+// jpaProject.createType(PACKAGE_NAME, "JavaEntity.java",
+// "@Entity public class JavaEntity {}"
+// );
+// XmlJavaClassRef javaClassRef = PersistenceFactory.eINSTANCE.createJavaClassRef();
+// javaClassRef.setJavaClass(PACKAGE_NAME + ".JavaEntity");
+// persistence.getPersistenceUnits().get(0).getClasses().add(javaClassRef);
+// persistence.eResource().save(null);
+//
+// assertEquals(2, CollectionTools.size(jpaProject.getJpaProject().getPlatform().persistentTypes(PROJECT_NAME)));
+// }
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/JptCorePlatformTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/JptCorePlatformTests.java
deleted file mode 100644
index 1052e87abb..0000000000
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/platform/JptCorePlatformTests.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2007 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.tests.internal.platform;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class JptCorePlatformTests {
-
- public static Test suite() {
- return suite(true);
- }
-
- public static Test suite(boolean all) {
- TestSuite suite = new TestSuite(JptCorePlatformTests.class.getPackage().getName());
- suite.addTestSuite(JpaPlatformExtensionTests.class);
- if (all) {
- suite.addTestSuite(BaseJpaPlatformTests.class);
- suite.addTestSuite(JpaPlatformTests.class);
- }
- return suite;
- }
-
- private JptCorePlatformTests() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJpaProject.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJpaProject.java
index 30af1c30fa..f892e3a2f3 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJpaProject.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJpaProject.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -12,6 +12,7 @@ package org.eclipse.jpt.core.tests.internal.projects;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jpt.core.internal.IJpaProject;
import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.SynchronousJpaProjectUpdater;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
/**
@@ -51,6 +52,7 @@ public class TestJpaProject extends TestJavaProject {
this.installFacet("jpt.jpa", "1.0", jpaConfig);
this.addJar(this.jarName());
this.jpaProject = JptCorePlugin.jpaProject(this.getProject());
+ this.jpaProject.setUpdater(new SynchronousJpaProjectUpdater(this.jpaProject));
}
protected String jarName() {
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/JptCoreResourceModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/JptCoreResourceModelTests.java
new file mode 100644
index 0000000000..03d9784a6b
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/JptCoreResourceModelTests.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.eclipse.jpt.core.tests.internal.resource.java.JptJavaResourceTests;
+
+public class JptCoreResourceModelTests extends TestCase
+{
+ public static Test suite() {
+ return suite(true);
+ }
+
+ public static Test suite(boolean all) {
+ TestSuite suite = new TestSuite(JptCoreResourceModelTests.class.getName());
+ suite.addTest(JptJavaResourceTests.suite(all));
+ suite.addTestSuite(OrmModelTests.class);
+ suite.addTestSuite(PersistenceModelTests.class);
+ return suite;
+ }
+
+ private JptCoreResourceModelTests() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/OrmModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/OrmModelTests.java
new file mode 100644
index 0000000000..78746ac13c
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/OrmModelTests.java
@@ -0,0 +1,46 @@
+package org.eclipse.jpt.core.tests.internal.resource;
+
+import junit.framework.TestCase;
+import org.eclipse.jpt.core.internal.resource.orm.OrmArtifactEdit;
+import org.eclipse.jpt.core.internal.resource.orm.OrmResource;
+import org.eclipse.jpt.core.tests.internal.ProjectUtility;
+import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
+
+public class OrmModelTests extends TestCase
+{
+ static final String BASE_PROJECT_NAME = OrmModelTests.class.getSimpleName();
+
+ TestJpaProject jpaProject;
+
+
+ public OrmModelTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ ProjectUtility.deleteAllProjects();
+ jpaProject = TestJpaProject.buildJpaProject(BASE_PROJECT_NAME, false); // false = no auto-build
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ jpaProject = null;
+ super.tearDown();
+ }
+
+ public void testModelLoad() {
+ OrmArtifactEdit artifactEdit = OrmArtifactEdit.getArtifactEditForRead(jpaProject.getProject());
+ assertNotNull(artifactEdit);
+ OrmResource resource = artifactEdit.getResource("META-INF/orm.xml");
+ assertNotNull(resource);
+ }
+
+ public void testModelLoad2() {
+ OrmArtifactEdit artifactEdit = OrmArtifactEdit.getArtifactEditForRead(jpaProject.getProject());
+ assertNotNull(artifactEdit);
+ OrmResource resource = artifactEdit.getResource("META-INF/orm.xml");
+ assertNotNull(resource);
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/PersistenceModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/PersistenceModelTests.java
new file mode 100644
index 0000000000..571ee4e0cc
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/PersistenceModelTests.java
@@ -0,0 +1,46 @@
+package org.eclipse.jpt.core.tests.internal.resource;
+
+import junit.framework.TestCase;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceArtifactEdit;
+import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResource;
+import org.eclipse.jpt.core.tests.internal.ProjectUtility;
+import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
+
+public class PersistenceModelTests extends TestCase
+{
+ static final String BASE_PROJECT_NAME = PersistenceModelTests.class.getSimpleName();
+
+ TestJpaProject jpaProject;
+
+
+ public PersistenceModelTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ ProjectUtility.deleteAllProjects();
+ jpaProject = TestJpaProject.buildJpaProject(BASE_PROJECT_NAME, false); // false = no auto-build
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ jpaProject = null;
+ super.tearDown();
+ }
+
+ public void testModelLoad() {
+ PersistenceArtifactEdit artifactEdit = PersistenceArtifactEdit.getArtifactEditForRead(jpaProject.getProject());
+ assertNotNull(artifactEdit);
+ PersistenceResource resource = artifactEdit.getResource("META-INF/persistence.xml");
+ assertNotNull(resource);
+ }
+
+ public void testModelLoad2() {
+ PersistenceArtifactEdit artifactEdit = PersistenceArtifactEdit.getArtifactEditForRead(jpaProject.getProject());
+ assertNotNull(artifactEdit);
+ PersistenceResource resource = artifactEdit.getResource("META-INF/persistence.xml");
+ assertNotNull(resource);
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverrideTests.java
new file mode 100644
index 0000000000..5413ea1b59
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverrideTests.java
@@ -0,0 +1,283 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.AssociationOverride;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumn;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class AssociationOverrideTests extends JavaResourceModelTestCase {
+
+ private static final String ASSOCIATION_OVERRIDE_NAME = "MY_ASSOCIATION_OVERRIDE";
+
+ public AssociationOverrideTests(String name) {
+ super(name);
+ }
+
+ private void createAssociationOverrideAnnotation() throws Exception {
+ createJoinColumnAnnotation();
+ this.createAnnotationAndMembers("AssociationOverride",
+ "String name(); " +
+ "JoinColumn[] joinColumns(); ");
+ }
+
+ private void createJoinColumnAnnotation() throws Exception {
+ this.createAnnotationAndMembers("JoinColumn", "String name() default \"\";" +
+ "String referencedColumnName() default \"\";" +
+ "boolean unique() default false;" +
+ "boolean nullable() default true;" +
+ "boolean insertable() default true;" +
+ "boolean updatable() default true;" +
+ "String columnDefinition() default \"\";" +
+ "String table() default \"\";");
+ }
+
+ private IType createTestAssociationOverrideOnField() throws Exception {
+ createAssociationOverrideAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestAssociationOverrideWithJoinColumns() throws Exception {
+ createAssociationOverrideAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns={@JoinColumn(name=\"BAR\"), @JoinColumn})");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestAssociationOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE);
+
+ assertNotNull(associationOverride);
+ assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestAssociationOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE);
+
+ assertNotNull(associationOverride);
+ assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
+
+ associationOverride.setName("Foo");
+ assertEquals("Foo", associationOverride.getName());
+ assertSourceContains("@AssociationOverride(name=\"Foo\")");
+ }
+
+ public void testSetNameNull() throws Exception {
+ IType testType = this.createTestAssociationOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE);
+
+ assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
+
+ associationOverride.setName(null);
+ assertNull(associationOverride.getName());
+
+ assertSourceDoesNotContain("@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\")");
+ assertSourceContains("@AssociationOverride");
+ }
+
+
+ public void testJoinColumns() throws Exception {
+ IType testType = this.createTestAssociationOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE);
+
+ ListIterator<JoinColumn> iterator = associationOverride.joinColumns();
+
+ assertEquals(0, CollectionTools.size(iterator));
+ }
+
+ public void testJoinColumns2() throws Exception {
+ IType testType = this.createTestAssociationOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE);
+
+
+ associationOverride.addJoinColumn(0);
+ associationOverride.addJoinColumn(1);
+ associationOverride.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ ListIterator<JoinColumn> iterator = associationOverride.joinColumns();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testJoinColumns3() throws Exception {
+ IType testType = this.createTestAssociationOverrideWithJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE);
+
+ ListIterator<JoinColumn> iterator = associationOverride.joinColumns();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testAddJoinColumn() throws Exception {
+ IType testType = this.createTestAssociationOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE);
+
+ associationOverride.addJoinColumn(0).setName("FOO");
+ associationOverride.addJoinColumn(1);
+ associationOverride.addJoinColumn(0).setName("BAR");
+
+ assertEquals("BAR", associationOverride.joinColumnAt(0).getName());
+ assertEquals("FOO", associationOverride.joinColumnAt(1).getName());
+ assertNull(associationOverride.joinColumnAt(2).getName());
+
+ assertSourceContains("@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name=\"BAR\"),@JoinColumn(name=\"FOO\"), @JoinColumn})");
+ }
+
+ public void testRemoveJoinColumn() throws Exception {
+ IType testType = this.createTestAssociationOverrideWithJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE);
+ associationOverride.addJoinColumn(0).setName("FOO");
+
+ Iterator<JoinColumn> joinColumns = associationOverride.joinColumns();
+ assertEquals("FOO", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertNull(joinColumns.next().getName());
+ assertEquals(false, joinColumns.hasNext());
+ assertSourceContains("@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns={@JoinColumn(name=\"FOO\"), @JoinColumn(name=\"BAR\"), @JoinColumn})");
+
+ associationOverride.removeJoinColumn(1);
+ joinColumns = associationOverride.joinColumns();
+ assertEquals("FOO", joinColumns.next().getName());
+ assertNull(joinColumns.next().getName());
+ assertEquals(false, joinColumns.hasNext());
+ assertSourceContains("@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns={@JoinColumn(name=\"FOO\"), @JoinColumn})");
+
+ associationOverride.removeJoinColumn(0);
+ joinColumns = associationOverride.joinColumns();
+ assertNull(joinColumns.next().getName());
+ assertEquals(false, joinColumns.hasNext());
+ assertSourceContains("@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns=@JoinColumn)");
+
+
+ associationOverride.setName(null);
+ associationOverride.removeJoinColumn(0);
+ assertSourceDoesNotContain("@AssociationOverride");
+ }
+
+ public void testMoveJoinColumn() throws Exception {
+ IType testType = this.createTestAssociationOverrideWithJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE);
+ JoinColumn joinColumn = associationOverride.joinColumnAt(0);
+ joinColumn.setReferencedColumnName("REF_NAME");
+ joinColumn.setUnique(Boolean.FALSE);
+ joinColumn.setNullable(Boolean.FALSE);
+ joinColumn.setInsertable(Boolean.FALSE);
+ joinColumn.setUpdatable(Boolean.FALSE);
+ joinColumn.setColumnDefinition("COLUMN_DEF");
+ joinColumn.setTable("TABLE");
+ associationOverride.addJoinColumn(0).setName("FOO");
+
+ assertSourceContains("@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns={@JoinColumn(name=\"FOO\"), @JoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn})");
+
+ associationOverride.moveJoinColumn(2, 0);
+ assertEquals("BAR", associationOverride.joinColumnAt(0).getName());
+ assertNull(associationOverride.joinColumnAt(1).getName());
+ assertEquals("FOO", associationOverride.joinColumnAt(2).getName());
+ assertEquals(3, associationOverride.joinColumnsSize());
+ assertSourceContains("@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns={@JoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn, @JoinColumn(name=\"FOO\")})");
+ }
+
+ public void testMoveJoinColumn2() throws Exception {
+ IType testType = this.createTestAssociationOverrideWithJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE);
+
+ JoinColumn joinColumn = associationOverride.joinColumnAt(0);
+ joinColumn.setReferencedColumnName("REF_NAME");
+ joinColumn.setUnique(Boolean.FALSE);
+ joinColumn.setNullable(Boolean.FALSE);
+ joinColumn.setInsertable(Boolean.FALSE);
+ joinColumn.setUpdatable(Boolean.FALSE);
+ joinColumn.setColumnDefinition("COLUMN_DEF");
+ joinColumn.setTable("TABLE");
+ associationOverride.addJoinColumn(0).setName("FOO");
+
+ assertSourceContains("@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns={@JoinColumn(name=\"FOO\"), @JoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn})");
+
+ associationOverride.moveJoinColumn(0, 2);
+ assertNull(associationOverride.joinColumnAt(0).getName());
+ assertEquals("FOO", associationOverride.joinColumnAt(1).getName());
+ assertEquals("BAR", associationOverride.joinColumnAt(2).getName());
+ assertEquals(3, associationOverride.joinColumnsSize());
+ assertSourceContains("@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns={@JoinColumn, @JoinColumn(name=\"FOO\"), @JoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\")})");
+ }
+
+ public void testSetJoinColumnName() throws Exception {
+ IType testType = this.createTestAssociationOverrideWithJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE);
+
+ ListIterator<JoinColumn> iterator = associationOverride.joinColumns();
+ assertEquals(2, CollectionTools.size(iterator));
+
+ JoinColumn joinColumn = associationOverride.joinColumns().next();
+
+ assertEquals("BAR", joinColumn.getName());
+
+ joinColumn.setName("foo");
+ assertEquals("foo", joinColumn.getName());
+
+ assertSourceContains("@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns={@JoinColumn(name=\"foo\"), @JoinColumn})");
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverridesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverridesTests.java
new file mode 100644
index 0000000000..6a4c7c1f52
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverridesTests.java
@@ -0,0 +1,355 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.AssociationOverride;
+import org.eclipse.jpt.core.internal.resource.java.AssociationOverrides;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumn;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class AssociationOverridesTests extends JavaResourceModelTestCase {
+
+ private static final String ASSOCIATION_OVERRIDE_NAME = "MY_ASSOCIATION_OVERRIDE";
+
+ public AssociationOverridesTests(String name) {
+ super(name);
+ }
+
+ private void createAssociationOverrideAnnotation() throws Exception {
+ createJoinColumnAnnotation();
+ this.createAnnotationAndMembers("AssociationOverride",
+ "String name(); " +
+ "Column column(); ");
+ }
+
+ private void createAssociationOverridesAnnotation() throws Exception {
+ createAssociationOverrideAnnotation();
+ this.createAnnotationAndMembers("AssociationOverrides",
+ "AssociationOverride[] value();");
+ }
+
+ private void createJoinColumnAnnotation() throws Exception {
+ this.createAnnotationAndMembers("JoinColumn", "String name() default \"\";" +
+ "String referencedColumnName() default \"\";" +
+ "boolean unique() default false;" +
+ "boolean nullable() default true;" +
+ "boolean insertable() default true;" +
+ "boolean updatable() default true;" +
+ "String columnDefinition() default \"\";" +
+ "String table() default \"\";");
+
+ }
+
+ private IType createTestAssociationOverrideOnField() throws Exception {
+ createAssociationOverridesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@AssociationOverrides(@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\"))");
+ }
+ });
+ }
+ private IType createTestAssociationOverrideWithJoinColumns() throws Exception {
+ createAssociationOverridesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES, JPA.JOIN_COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@AssociationOverrides(@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns={@JoinColumn(name=\"BAR\"), @JoinColumn}))");
+ }
+ });
+ }
+
+ private IType createTestAssociationOverride() throws Exception {
+ createAssociationOverrideAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ASSOCIATION_OVERRIDE, JPA.JOIN_COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("@AssociationOverride(name=\"FOO\", joinColumns=@JoinColumn(name=\"FOO\", columnDefinition=\"BAR\", referencedColumnName=\"BAZ\"))");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestAssociationOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AssociationOverrides associationOverrides = (AssociationOverrides) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDES);
+ AssociationOverride associationOverride = associationOverrides.nestedAnnotations().next();
+
+ assertNotNull(associationOverride);
+ assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestAssociationOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AssociationOverrides associationOverrides = (AssociationOverrides) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDES);
+ AssociationOverride associationOverride = associationOverrides.nestedAnnotations().next();
+
+ assertNotNull(associationOverride);
+ assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
+
+ associationOverride.setName("Foo");
+ assertEquals("Foo", associationOverride.getName());
+ assertSourceContains("@AssociationOverrides(@AssociationOverride(name=\"Foo\"))");
+ }
+
+ public void testSetNameNull() throws Exception {
+ IType testType = this.createTestAssociationOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AssociationOverrides associationOverrides = (AssociationOverrides) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDES);
+ AssociationOverride associationOverride = associationOverrides.nestedAnnotations().next();
+ assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName());
+
+ associationOverride.setName(null);
+ assertNull(associationOverride.getName());
+
+ assertSourceDoesNotContain("@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\")");
+ assertSourceContains("@AssociationOverride");
+ assertSourceContains("@AssociationOverrides");
+ }
+
+ public void testAddAssociationOverrideCopyExisting() throws Exception {
+ IType jdtType = createTestAssociationOverride();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ AssociationOverride associationOverride = (AssociationOverride) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ associationOverride.setName("BAR");
+ assertSourceContains("@AssociationOverrides({@AssociationOverride(name=\"FOO\", joinColumns = @JoinColumn(name=\"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name=\"BAR\")})");
+
+ assertNull(typeResource.annotation(JPA.ASSOCIATION_OVERRIDE));
+ assertNotNull(typeResource.annotation(JPA.ASSOCIATION_OVERRIDES));
+ assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES)));
+ }
+
+ public void testAddAssociationOverrideToBeginningOfList() throws Exception {
+ IType jdtType = createTestAssociationOverride();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ AssociationOverride associationOverride = (AssociationOverride) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ associationOverride.setName("BAR");
+ assertSourceContains("@AssociationOverrides({@AssociationOverride(name=\"FOO\", joinColumns = @JoinColumn(name=\"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name=\"BAR\")})");
+
+ associationOverride = (AssociationOverride) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ associationOverride.setName("BAZ");
+ assertSourceContains("@AssociationOverrides({@AssociationOverride(name=\"BAZ\"),@AssociationOverride(name=\"FOO\", joinColumns = @JoinColumn(name=\"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")), @AssociationOverride(name=\"BAR\")})");
+
+ Iterator<JavaResource> associationOverrides = typeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ assertEquals("BAZ", ((AssociationOverride) associationOverrides.next()).getName());
+ assertEquals("FOO", ((AssociationOverride) associationOverrides.next()).getName());
+ assertEquals("BAR", ((AssociationOverride) associationOverrides.next()).getName());
+
+ assertNull(typeResource.annotation(JPA.ASSOCIATION_OVERRIDE));
+ assertNotNull(typeResource.annotation(JPA.ASSOCIATION_OVERRIDES));
+ assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES)));
+ }
+
+ public void testRemoveAssociationOverrideCopyExisting() throws Exception {
+ IType jdtType = createTestAssociationOverride();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ AssociationOverride associationOverride = (AssociationOverride) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ associationOverride.setName("BAR");
+ assertSourceContains("@AssociationOverrides({@AssociationOverride(name=\"FOO\", joinColumns = @JoinColumn(name=\"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name=\"BAR\")})");
+
+ typeResource.removeAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ assertSourceContains("@AssociationOverride(name=\"FOO\", joinColumns = @JoinColumn(name=\"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\"))");
+ }
+
+ public void testJoinColumns() throws Exception {
+ IType testType = this.createTestAssociationOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
+
+ ListIterator<JoinColumn> iterator = associationOverride.joinColumns();
+
+ assertEquals(0, CollectionTools.size(iterator));
+ }
+
+ public void testJoinColumns2() throws Exception {
+ IType testType = this.createTestAssociationOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
+
+ associationOverride.addJoinColumn(0);
+ associationOverride.addJoinColumn(1);
+ associationOverride.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ ListIterator<JoinColumn> iterator = associationOverride.joinColumns();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testJoinColumns3() throws Exception {
+ IType testType = this.createTestAssociationOverrideWithJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
+
+ ListIterator<JoinColumn> iterator = associationOverride.joinColumns();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testAddJoinColumn() throws Exception {
+ IType testType = this.createTestAssociationOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
+
+ associationOverride.addJoinColumn(0).setName("FOO");
+ associationOverride.addJoinColumn(1);
+ associationOverride.addJoinColumn(0).setName("BAR");
+
+
+ Iterator<JoinColumn> joinColumns = associationOverride.joinColumns();
+ assertEquals("BAR", joinColumns.next().getName());
+ assertEquals("FOO", joinColumns.next().getName());
+ assertNull(joinColumns.next().getName());
+
+ assertSourceContains("@AssociationOverrides(@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns = {@JoinColumn(name=\"BAR\"),@JoinColumn(name=\"FOO\"), @JoinColumn}))");
+ }
+
+ public void testRemoveJoinColumn() throws Exception {
+ IType testType = this.createTestAssociationOverrideWithJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
+ associationOverride.addJoinColumn(0).setName("FOO");
+
+ Iterator<JoinColumn> joinColumns = associationOverride.joinColumns();
+ assertEquals("FOO", joinColumns.next().getName());
+ assertEquals("BAR", joinColumns.next().getName());
+ assertNull(joinColumns.next().getName());
+ assertEquals(false, joinColumns.hasNext());
+ assertSourceContains("@AssociationOverrides(@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns={@JoinColumn(name=\"FOO\"), @JoinColumn(name=\"BAR\"), @JoinColumn}))");
+
+ associationOverride.removeJoinColumn(1);
+ joinColumns = associationOverride.joinColumns();
+ assertEquals("FOO", joinColumns.next().getName());
+ assertNull(joinColumns.next().getName());
+ assertEquals(false, joinColumns.hasNext());
+ assertSourceContains("@AssociationOverrides(@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns={@JoinColumn(name=\"FOO\"), @JoinColumn}))");
+
+ associationOverride.removeJoinColumn(0);
+ joinColumns = associationOverride.joinColumns();
+ assertNull(joinColumns.next().getName());
+ assertEquals(false, joinColumns.hasNext());
+ assertSourceContains("@AssociationOverrides(@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns=@JoinColumn))");
+
+
+ associationOverride.setName(null);
+ associationOverride.removeJoinColumn(0);
+ assertSourceDoesNotContain("@AssociationOverride");
+ }
+
+ public void testMoveJoinColumn() throws Exception {
+ IType testType = this.createTestAssociationOverrideWithJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
+ JoinColumn joinColumn = associationOverride.joinColumnAt(0);
+ joinColumn.setReferencedColumnName("REF_NAME");
+ joinColumn.setUnique(Boolean.FALSE);
+ joinColumn.setNullable(Boolean.FALSE);
+ joinColumn.setInsertable(Boolean.FALSE);
+ joinColumn.setUpdatable(Boolean.FALSE);
+ joinColumn.setColumnDefinition("COLUMN_DEF");
+ joinColumn.setTable("TABLE");
+ associationOverride.addJoinColumn(0).setName("FOO");
+ assertSourceContains("@AssociationOverrides(@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns={@JoinColumn(name=\"FOO\"), @JoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn}))");
+
+ associationOverride.moveJoinColumn(2, 0);
+ assertEquals("BAR", associationOverride.joinColumnAt(0).getName());
+ assertNull(associationOverride.joinColumnAt(1).getName());
+ assertEquals("FOO", associationOverride.joinColumnAt(2).getName());
+ assertEquals(3, associationOverride.joinColumnsSize());
+ assertSourceContains("@AssociationOverrides(@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns={@JoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn, @JoinColumn(name=\"FOO\")}))");
+ }
+
+ public void testMoveJoinColumn2() throws Exception {
+ IType testType = this.createTestAssociationOverrideWithJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
+
+ JoinColumn joinColumn = associationOverride.joinColumnAt(0);
+ joinColumn.setReferencedColumnName("REF_NAME");
+ joinColumn.setUnique(Boolean.FALSE);
+ joinColumn.setNullable(Boolean.FALSE);
+ joinColumn.setInsertable(Boolean.FALSE);
+ joinColumn.setUpdatable(Boolean.FALSE);
+ joinColumn.setColumnDefinition("COLUMN_DEF");
+ joinColumn.setTable("TABLE");
+ associationOverride.addJoinColumn(0).setName("FOO");
+
+ assertSourceContains("@AssociationOverrides(@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns={@JoinColumn(name=\"FOO\"), @JoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn}))");
+ associationOverride.moveJoinColumn(0, 2);
+ assertNull(associationOverride.joinColumnAt(0).getName());
+ assertEquals("FOO", associationOverride.joinColumnAt(1).getName());
+ assertEquals("BAR", associationOverride.joinColumnAt(2).getName());
+ assertEquals(3, associationOverride.joinColumnsSize());
+ assertSourceContains("@AssociationOverrides(@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns={@JoinColumn, @JoinColumn(name=\"FOO\"), @JoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\")}))");
+ }
+
+ public void testSetJoinColumnName() throws Exception {
+ IType testType = this.createTestAssociationOverrideWithJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next();
+
+ ListIterator<JoinColumn> iterator = associationOverride.joinColumns();
+ assertEquals(2, CollectionTools.size(iterator));
+
+ JoinColumn joinColumn = associationOverride.joinColumns().next();
+
+ assertEquals("BAR", joinColumn.getName());
+
+ joinColumn.setName("foo");
+ assertEquals("foo", joinColumn.getName());
+
+ assertSourceContains("@AssociationOverrides(@AssociationOverride(name=\"" + ASSOCIATION_OVERRIDE_NAME + "\", joinColumns={@JoinColumn(name=\"foo\"), @JoinColumn}))");
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverrideTests.java
new file mode 100644
index 0000000000..663f02bc33
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverrideTests.java
@@ -0,0 +1,176 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.java.Column;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class AttributeOverrideTests extends JavaResourceModelTestCase {
+
+ private static final String COLUMN_NAME = "MY_COLUMN";
+ private static final String ATTRIBUTE_OVERRIDE_NAME = "MY_ATTRIBUTE_OVERRIDE";
+
+ public AttributeOverrideTests(String name) {
+ super(name);
+ }
+
+ private void createAttributeOverrideAnnotation() throws Exception {
+ this.createAnnotationAndMembers("AttributeOverride",
+ "String name(); " +
+ "Column column(); ");
+ }
+
+ private void createColumnAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Column",
+ "String name() default \"\"; " +
+ "boolean unique() default false; " +
+ "boolean nullable() default true; " +
+ "boolean insertable() default true; " +
+ "boolean updatable() default true; " +
+ "String columnDefinition() default \"\"; " +
+ "String table() default \"\"; " +
+ "int length() default 255; " +
+ "int precision() default 0; " +
+ "int scale() default 0;");
+ }
+
+ private IType createTestAttributeOverrideOnField() throws Exception {
+ createAttributeOverrideAnnotation();
+ createColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ATTRIBUTE_OVERRIDE, JPA.COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestAttributeOverrideWithColumnOnField() throws Exception {
+ createAttributeOverrideAnnotation();
+ createColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ATTRIBUTE_OVERRIDE, JPA.COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\", column = @Column(name=\"" + COLUMN_NAME + "\"))");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestAttributeOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE);
+
+ assertNotNull(attributeOverride);
+ assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName());
+ }
+
+ public void testGetNullColumn() throws Exception {
+ IType testType = this.createTestAttributeOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE);
+ Column column = attributeOverride.getColumn();
+ assertNotNull(attributeOverride);
+ assertNull(column);
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestAttributeOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE);
+
+ assertNotNull(attributeOverride);
+ assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName());
+
+ attributeOverride.setName("Foo");
+ assertEquals("Foo", attributeOverride.getName());
+ assertSourceContains("@AttributeOverride(name=\"Foo\")");
+ }
+
+ public void testSetNameNull() throws Exception {
+ IType testType = this.createTestAttributeOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE);
+
+ assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName());
+
+ attributeOverride.setName(null);
+ assertNull(attributeOverride.getName());
+
+ assertSourceDoesNotContain("@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\")");
+ assertSourceContains("@AttributeOverride");
+ }
+
+ public void testColumnGetName() throws Exception {
+ IType testType = this.createTestAttributeOverrideWithColumnOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE);
+ Column column = attributeOverride.getColumn();
+ assertEquals(COLUMN_NAME, column.getName());
+ }
+
+ public void testColumnSetName() throws Exception {
+ IType testType = this.createTestAttributeOverrideWithColumnOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE);
+ Column column = attributeOverride.getColumn();
+ assertEquals(COLUMN_NAME, column.getName());
+
+ column.setName("Foo");
+
+ assertSourceContains("@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\", column = @Column(name=\"Foo\"))");
+
+ column.setName(null);
+ //TODO should I have to update from java before column is set to null??
+ attributeResource.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertNull(attributeOverride.getColumn());
+ assertSourceContains("@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\")");
+ }
+
+ public void testAddColumn() throws Exception {
+ IType testType = this.createTestAttributeOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE);
+ Column column = attributeOverride.getColumn();
+ assertNull(column);
+ }
+
+ public void testRemoveColumn() throws Exception {
+ IType testType = this.createTestAttributeOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE);
+ Column column = attributeOverride.getColumn();
+ assertNull(column);
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverridesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverridesTests.java
new file mode 100644
index 0000000000..f18d1e89be
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverridesTests.java
@@ -0,0 +1,303 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverrides;
+import org.eclipse.jpt.core.internal.resource.java.Column;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class AttributeOverridesTests extends JavaResourceModelTestCase {
+
+ private static final String COLUMN_NAME = "MY_COLUMN";
+ private static final String ATTRIBUTE_OVERRIDE_NAME = "MY_ATTRIBUTE_OVERRIDE";
+
+ public AttributeOverridesTests(String name) {
+ super(name);
+ }
+
+ private void createAttributeOverrideAnnotation() throws Exception {
+ createColumnAnnotation();
+ this.createAnnotationAndMembers("AttributeOverride",
+ "String name(); " +
+ "Column column(); ");
+ }
+
+ private void createAttributeOverridesAnnotation() throws Exception {
+ createAttributeOverrideAnnotation();
+ this.createAnnotationAndMembers("AttributeOverrides",
+ "AttributeOverride[] value();");
+ }
+
+ private void createColumnAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Column",
+ "String name() default \"\"; " +
+ "boolean unique() default false; " +
+ "boolean nullable() default true; " +
+ "boolean insertable() default true; " +
+ "boolean updatable() default true; " +
+ "String columnDefinition() default \"\"; " +
+ "String table() default \"\"; " +
+ "int length() default 255; " +
+ "int precision() default 0; " +
+ "int scale() default 0;");
+ }
+
+ private IType createTestAttributeOverrideOnField() throws Exception {
+ createAttributeOverridesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES, JPA.COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@AttributeOverrides(@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\"))");
+ }
+ });
+ }
+
+ private IType createTestAttributeOverrideWithColumnOnField() throws Exception {
+ createAttributeOverridesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES, JPA.COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@AttributeOverrides(@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\", column = @Column(name=\"" + COLUMN_NAME + "\")))");
+ }
+ });
+ }
+
+ private IType createTestAttributeOverride() throws Exception {
+ createAttributeOverrideAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ATTRIBUTE_OVERRIDE, JPA.COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("@AttributeOverride(name=\"FOO\", column=@Column(name=\"FOO\", columnDefinition=\"BAR\", table=\"BAZ\", unique=false, nullable=false, insertable=false, updatable=false, length=1, precision=1, scale=1))");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestAttributeOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AttributeOverrides attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverride attributeOverride = attributeOverrides.nestedAnnotations().next();
+
+ assertNotNull(attributeOverride);
+ assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName());
+ }
+
+ public void testGetNullColumn() throws Exception {
+ IType testType = this.createTestAttributeOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AttributeOverrides attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverride attributeOverride = attributeOverrides.nestedAnnotations().next();
+ Column column = attributeOverride.getColumn();
+ assertNotNull(attributeOverride);
+ assertNull(column);
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestAttributeOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AttributeOverrides attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverride attributeOverride = attributeOverrides.nestedAnnotations().next();
+
+ assertNotNull(attributeOverride);
+ assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName());
+
+ attributeOverride.setName("Foo");
+ assertEquals("Foo", attributeOverride.getName());
+ assertSourceContains("@AttributeOverrides(@AttributeOverride(name=\"Foo\"))");
+ }
+
+ public void testSetNameNull() throws Exception {
+ IType testType = this.createTestAttributeOverrideOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AttributeOverrides attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverride attributeOverride = attributeOverrides.nestedAnnotations().next();
+ assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName());
+
+ attributeOverride.setName(null);
+ assertNull(attributeOverride.getName());
+
+ assertSourceDoesNotContain("@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\")");
+ assertSourceContains("@AttributeOverride");
+ assertSourceContains("@AttributeOverrides");
+ }
+
+ public void testColumnGetName() throws Exception {
+ IType testType = this.createTestAttributeOverrideWithColumnOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AttributeOverrides attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverride attributeOverride = attributeOverrides.nestedAnnotations().next();
+
+ Column column = attributeOverride.getColumn();
+ assertEquals(COLUMN_NAME, column.getName());
+ }
+
+ public void testColumnSetName() throws Exception {
+ IType testType = this.createTestAttributeOverrideWithColumnOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next();
+
+ Column column = attributeOverride.getColumn();
+
+ assertEquals(COLUMN_NAME, column.getName());
+
+ column.setName("Foo");
+
+ assertSourceContains("@AttributeOverrides(@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\", column = @Column(name=\"Foo\")))");
+
+ column.setName(null);
+ //TODO should I have to update from java before column is set to null??
+ attributeResource.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertNull(attributeOverride.getColumn());
+ assertSourceContains("@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\")");
+ }
+
+ public void testAddAttributeOverrideCopyExisting() throws Exception {
+ IType jdtType = createTestAttributeOverride();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ AttributeOverride attributeOverride = (AttributeOverride) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("BAR");
+ assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\", column = @Column(name=\"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1)),@AttributeOverride(name=\"BAR\")})");
+
+ assertNull(typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE));
+ assertNotNull(typeResource.annotation(JPA.ATTRIBUTE_OVERRIDES));
+ assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
+ }
+
+ public void testAddAttributeOverrideToBeginningOfList() throws Exception {
+ IType jdtType = createTestAttributeOverride();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ AttributeOverride attributeOverride = (AttributeOverride) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("BAR");
+ assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\", column = @Column(name=\"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1)),@AttributeOverride(name=\"BAR\")})");
+
+ attributeOverride = (AttributeOverride) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("BAZ");
+ assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"BAZ\"),@AttributeOverride(name=\"FOO\", column = @Column(name=\"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1)), @AttributeOverride(name=\"BAR\")})");
+
+ Iterator<JavaResource> attributeOverrides = typeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName());
+ assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName());
+
+ assertNull(typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE));
+ assertNotNull(typeResource.annotation(JPA.ATTRIBUTE_OVERRIDES));
+ assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
+ }
+
+ public void testRemoveAttributeOverrideCopyExisting() throws Exception {
+ IType jdtType = createTestAttributeOverride();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ AttributeOverride attributeOverride = (AttributeOverride) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("BAR");
+ assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\", column = @Column(name=\"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1)),@AttributeOverride(name=\"BAR\")})");
+
+ typeResource.removeAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ assertSourceContains("@AttributeOverride(name=\"FOO\", column = @Column(name=\"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1))");
+ }
+ //not sure i want to test this api, how can we keep ContainerAnnotation.add, move, remove from being public?
+ //users should go throught AbstractJavapersistenceResource. this gets confusing because you would handle it differently
+ //for non top-level annotations
+// public void testAdd() throws Exception {
+// IType testType = this.createTestType();
+// JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+// JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+// AttributeOverrides attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES);
+// assertNull(attributeOverrides);
+//
+// attributeResource.addAnnotation(JPA.ATTRIBUTE_OVERRIDES);
+// attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES);
+// assertNotNull(attributeOverrides);
+//
+// assertSourceContains("@AttributeOverrides");
+//
+// AttributeOverride fooAttributeOverride = attributeOverrides.add(0);
+// fooAttributeOverride.setName("Foo");
+//
+// assertSourceContains("@AttributeOverrides(@AttributeOverride(name=\"Foo\"))");
+//
+// AttributeOverride barAttributeOverride = attributeOverrides.add(0);
+// barAttributeOverride.setName("Bar");
+//
+// assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"Bar\"), @AttributeOverride(name=\"Foo\")})");
+//
+// }
+//
+// public void testMove() throws Exception {
+// IType testType = this.createTestAttributeOverrideWithColumnOnField();
+// JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+// JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+// AttributeOverrides attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES);
+//
+// AttributeOverride fooAttributeOverride = attributeOverrides.add(1);
+// fooAttributeOverride.setName("Foo");
+//
+// assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\"), @AttributeOverride(name=\"Foo\")})");
+//
+// attributeOverrides.move(0, 1);
+//
+// assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"Foo\"), @AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\")})");
+// }
+//
+// public void testRemove() throws Exception {
+// IType testType = this.createTestAttributeOverrideWithColumnOnField();
+// JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+// JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+// AttributeOverrides attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES);
+//
+// AttributeOverride fooAttributeOverride = attributeOverrides.add(1);
+// fooAttributeOverride.setName("Foo");
+//
+// assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"" + ATTRIBUTE_OVERRIDE_NAME + "\"), @AttributeOverride(name=\"Foo\")})");
+//
+// attributeOverrides.remove(0);
+//
+// assertSourceContains("@AttributeOverrides(@AttributeOverride(name=\"Foo\"))");
+//
+// attributeOverrides.remove(0);
+//
+// assertSourceContains("@AttributeOverrides()");
+//
+// }
+
+
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/BasicTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/BasicTests.java
new file mode 100644
index 0000000000..35895d46ee
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/BasicTests.java
@@ -0,0 +1,154 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.Basic;
+import org.eclipse.jpt.core.internal.resource.java.FetchType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class BasicTests extends JavaResourceModelTestCase {
+
+ public BasicTests(String name) {
+ super(name);
+ }
+
+ private IType createTestBasic() throws Exception {
+ this.createAnnotationAndMembers("Basic", "boolean optional() default true;");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.BASIC);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Basic");
+ }
+ });
+ }
+
+ private IType createTestBasicWithOptional() throws Exception {
+ this.createAnnotationAndMembers("Basic", "boolean optional() default true;");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.BASIC);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Basic(optional=true)");
+ }
+ });
+ }
+
+ private IType createTestBasicWithFetch() throws Exception {
+ this.createAnnotationAndMembers("Basic", "boolean optional() default true; FetchType fetch() default FetchType.EAGER;");
+ this.createEnumAndMembers("FetchType", "EAGER, LAZY");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.BASIC, JPA.FETCH_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Basic(fetch=FetchType.EAGER)");
+ }
+ });
+ }
+
+ public void testBasic() throws Exception {
+ IType testType = this.createTestBasic();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC);
+ assertNotNull(basic);
+ }
+
+ public void testGetOptional() throws Exception {
+ IType testType = this.createTestBasicWithOptional();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC);
+ assertTrue(basic.getOptional());
+ }
+
+ public void testSetOptional() throws Exception {
+ IType testType = this.createTestBasicWithOptional();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC);
+ assertTrue(basic.getOptional());
+
+ basic.setOptional(false);
+ assertFalse(basic.getOptional());
+
+ assertSourceContains("@Basic(optional=false)");
+ }
+
+ public void testSetOptionalNull() throws Exception {
+ IType testType = this.createTestBasicWithOptional();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC);
+ assertTrue(basic.getOptional());
+
+ basic.setOptional(null);
+ assertNull(basic.getOptional());
+
+ assertSourceContains("@Basic");
+ assertSourceDoesNotContain("optional");
+ }
+
+ public void testGetFetch() throws Exception {
+ IType testType = this.createTestBasicWithFetch();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC);
+ assertEquals(FetchType.EAGER, basic.getFetch());
+ }
+
+ public void testSetFetch() throws Exception {
+ IType testType = this.createTestBasicWithFetch();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC);
+ assertEquals(FetchType.EAGER, basic.getFetch());
+
+ basic.setFetch(FetchType.LAZY);
+ assertEquals(FetchType.LAZY, basic.getFetch());
+
+ assertSourceContains("@Basic(fetch=LAZY)");
+ }
+
+ public void testSetFetchNull() throws Exception {
+ IType testType = this.createTestBasicWithFetch();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC);
+ assertEquals(FetchType.EAGER, basic.getFetch());
+
+ basic.setFetch(null);
+ assertNull(basic.getFetch());
+
+ assertSourceContains("@Basic");
+ assertSourceDoesNotContain("fetch");
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ColumnTests.java
new file mode 100644
index 0000000000..388c46190d
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ColumnTests.java
@@ -0,0 +1,423 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.Column;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class ColumnTests extends JavaResourceModelTestCase {
+
+ private static final String COLUMN_NAME = "MY_COLUMN";
+ private static final String COLUMN_TABLE = "MY_TABLE";
+ private static final String COLUMN_COLUMN_DEFINITION = "COLUMN_DEFINITION";
+
+ public ColumnTests(String name) {
+ super(name);
+ }
+
+ private void createColumnAnnotation() throws Exception {
+ this.createAnnotationAndMembers("Column",
+ "String name() default \"\"; " +
+ "boolean unique() default false; " +
+ "boolean nullable() default true; " +
+ "boolean insertable() default true; " +
+ "boolean updatable() default true; " +
+ "String columnDefinition() default \"\"; " +
+ "String table() default \"\"; " +
+ "int length() default 255; " +
+ "int precision() default 0; " +
+ "int scale() default 0;");
+ }
+
+ private IType createTestColumn() throws Exception {
+ createColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Column");
+ }
+ });
+ }
+
+ private IType createTestColumnWithName() throws Exception {
+ createColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Column(name=\"" + COLUMN_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestColumnWithTable() throws Exception {
+ createColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Column(table=\"" + COLUMN_TABLE + "\")");
+ }
+ });
+ }
+
+ private IType createTestColumnWithColumnDefinition() throws Exception {
+ createColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Column(columnDefinition=\"" + COLUMN_COLUMN_DEFINITION + "\")");
+ }
+ });
+ }
+
+ private IType createTestColumnWithBooleanElement(final String booleanElement) throws Exception {
+ createColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Column(" + booleanElement + "=true)");
+ }
+ });
+ }
+
+ private IType createTestColumnWithIntElement(final String intElement) throws Exception {
+ createColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Column(" + intElement + "=5)");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestColumnWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+ assertNotNull(column);
+ assertEquals(COLUMN_NAME, column.getName());
+ }
+
+ public void testGetNull() throws Exception {
+ IType testType = this.createTestColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+ assertNotNull(column);
+ assertNull(column.getName());
+ assertNull(column.getNullable());
+ assertNull(column.getInsertable());
+ assertNull(column.getUnique());
+ assertNull(column.getUpdatable());
+ assertNull(column.getTable());
+ assertNull(column.getColumnDefinition());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getName());
+
+ column.setName("Foo");
+ assertEquals("Foo", column.getName());
+
+ assertSourceContains("@Column(name=\"Foo\")");
+ }
+
+ public void testSetNameNull() throws Exception {
+ IType testType = this.createTestColumnWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals(COLUMN_NAME, column.getName());
+
+ column.setName(null);
+ assertNull(column.getName());
+
+ assertSourceDoesNotContain("@Column");
+ }
+
+ public void testGetTable() throws Exception {
+ IType testType = this.createTestColumnWithTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+ assertEquals(COLUMN_TABLE, column.getTable());
+ }
+
+ public void testSetTable() throws Exception {
+ IType testType = this.createTestColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getTable());
+
+ column.setTable("Foo");
+ assertEquals("Foo", column.getTable());
+
+ assertSourceContains("@Column(table=\"Foo\")");
+
+
+ column.setTable(null);
+ assertSourceDoesNotContain("@Column");
+ }
+
+ public void testGetColumnDefinition() throws Exception {
+ IType testType = this.createTestColumnWithColumnDefinition();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+ assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition());
+ }
+
+ public void testSetColumnDefinition() throws Exception {
+ IType testType = this.createTestColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getColumnDefinition());
+
+ column.setColumnDefinition("Foo");
+ assertEquals("Foo", column.getColumnDefinition());
+
+ assertSourceContains("@Column(columnDefinition=\"Foo\")");
+
+
+ column.setColumnDefinition(null);
+ assertSourceDoesNotContain("@Column");
+ }
+
+ public void testGetUnique() throws Exception {
+ IType testType = this.createTestColumnWithBooleanElement("unique");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals(Boolean.TRUE, column.getUnique());
+ }
+
+ public void testSetUnique() throws Exception {
+ IType testType = this.createTestColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getUnique());
+
+ column.setUnique(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, column.getUnique());
+
+ assertSourceContains("@Column(unique=false)");
+
+ column.setUnique(null);
+ assertSourceDoesNotContain("@Column");
+ }
+
+ public void testGetNullable() throws Exception {
+ IType testType = this.createTestColumnWithBooleanElement("nullable");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals(Boolean.TRUE, column.getNullable());
+ }
+
+ public void testSetNullable() throws Exception {
+ IType testType = this.createTestColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getNullable());
+
+ column.setNullable(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, column.getNullable());
+
+ assertSourceContains("@Column(nullable=false)");
+
+ column.setNullable(null);
+ assertSourceDoesNotContain("@Column");
+ }
+
+ public void testGetInsertable() throws Exception {
+ IType testType = this.createTestColumnWithBooleanElement("insertable");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals(Boolean.TRUE, column.getInsertable());
+ }
+
+ public void testSetInsertable() throws Exception {
+ IType testType = this.createTestColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getInsertable());
+
+ column.setInsertable(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, column.getInsertable());
+
+ assertSourceContains("@Column(insertable=false)");
+
+ column.setInsertable(null);
+ assertSourceDoesNotContain("@Column");
+ }
+
+ public void testGetUpdatable() throws Exception {
+ IType testType = this.createTestColumnWithBooleanElement("updatable");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals(Boolean.TRUE, column.getUpdatable());
+ }
+
+ public void testSetUpdatable() throws Exception {
+ IType testType = this.createTestColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getUpdatable());
+
+ column.setUpdatable(Boolean.FALSE);
+ assertEquals(Boolean.FALSE, column.getUpdatable());
+
+ assertSourceContains("@Column(updatable=false)");
+
+ column.setUpdatable(null);
+ assertSourceDoesNotContain("@Column");
+ }
+
+ public void testGetLength() throws Exception {
+ IType testType = this.createTestColumnWithIntElement("length");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals(Integer.valueOf(5), column.getLength());
+ }
+
+ public void testSetLength() throws Exception {
+ IType testType = this.createTestColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getLength());
+
+ column.setLength(Integer.valueOf(5));
+ assertEquals(Integer.valueOf(5), column.getLength());
+
+ assertSourceContains("@Column(length=5)");
+
+ column.setLength(null);
+ assertSourceDoesNotContain("@Column");
+ }
+
+ public void testGetPrecision() throws Exception {
+ IType testType = this.createTestColumnWithIntElement("precision");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals(Integer.valueOf(5), column.getPrecision());
+ }
+
+ public void testSetPrecision() throws Exception {
+ IType testType = this.createTestColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertNotNull(column);
+ assertEquals(null, column.getPrecision());
+
+ column.setPrecision(Integer.valueOf(5));
+ assertEquals(Integer.valueOf(5), column.getPrecision());
+
+ assertSourceContains("@Column(precision=5)");
+
+ column.setPrecision(null);
+ assertSourceDoesNotContain("@Column");
+ }
+
+ public void testGetScale() throws Exception {
+ IType testType = this.createTestColumnWithIntElement("scale");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertEquals(Integer.valueOf(5), column.getScale());
+ }
+
+ public void testSetScale() throws Exception {
+ IType testType = this.createTestColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getScale());
+
+ column.setScale(Integer.valueOf(5));
+ assertEquals(Integer.valueOf(5), column.getScale());
+
+ assertSourceContains("@Column(scale=5)");
+
+ column.setScale(null);
+ assertSourceDoesNotContain("@Column");
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorColumnTests.java
new file mode 100644
index 0000000000..76a8d64d5d
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorColumnTests.java
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.DiscriminatorColumn;
+import org.eclipse.jpt.core.internal.resource.java.DiscriminatorType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class DiscriminatorColumnTests extends JavaResourceModelTestCase {
+
+ private static final String COLUMN_NAME = "MY_COLUMN";
+ private static final String COLUMN_COLUMN_DEFINITION = "COLUMN_DEFINITION";
+
+ public DiscriminatorColumnTests(String name) {
+ super(name);
+ }
+
+ private void createDiscriminatorColumnAnnotation() throws Exception {
+ this.createEnumAndMembers("DiscriminatorType", "STRING, CHAR, INTEGER");
+ this.createAnnotationAndMembers("DiscriminatorColumn",
+ "String name() default \"DTYPE\"; " +
+ "DiscriminatorType discriminatorType() default STRING; " +
+ "String columnDefinition() default \"\"; " +
+ "int length() default 31;");
+ }
+
+ private IType createTestDiscriminatorColumn() throws Exception {
+ createDiscriminatorColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.DISCRIMINATOR_COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@DiscriminatorColumn");
+ }
+ });
+ }
+
+ private IType createTestDiscriminatorColumnWithName() throws Exception {
+ createDiscriminatorColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.DISCRIMINATOR_COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@DiscriminatorColumn(name=\"" + COLUMN_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestDiscriminatorColumnWithColumnDefinition() throws Exception {
+ createDiscriminatorColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.DISCRIMINATOR_COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@DiscriminatorColumn(columnDefinition=\"" + COLUMN_COLUMN_DEFINITION + "\")");
+ }
+ });
+ }
+
+ private IType createTestDiscriminatorColumnWithDiscriminatorType() throws Exception {
+ createDiscriminatorColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.DISCRIMINATOR_COLUMN, JPA.DISCRIMINATOR_TYPE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@DiscriminatorColumn(discriminatorType=DiscriminatorType.CHAR)");
+ }
+ });
+ }
+
+ private IType createTestColumnWithIntElement(final String intElement) throws Exception {
+ createDiscriminatorColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.DISCRIMINATOR_COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@DiscriminatorColumn(" + intElement + "=5)");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestDiscriminatorColumnWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+ assertNotNull(column);
+ assertEquals(COLUMN_NAME, column.getName());
+ }
+
+ public void testGetNull() throws Exception {
+ IType testType = this.createTestDiscriminatorColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+ assertNotNull(column);
+ assertNull(column.getName());
+ assertNull(column.getDiscriminatorType());
+ assertNull(column.getColumnDefinition());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestDiscriminatorColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getName());
+
+ column.setName("Foo");
+ assertEquals("Foo", column.getName());
+
+ assertSourceContains("@DiscriminatorColumn(name=\"Foo\")");
+ }
+
+ public void testSetNameNull() throws Exception {
+ IType testType = this.createTestDiscriminatorColumnWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+
+ assertEquals(COLUMN_NAME, column.getName());
+
+ column.setName(null);
+ assertNull(column.getName());
+
+ assertSourceDoesNotContain("@DiscriminatorColumn");
+ }
+
+ public void testGetColumnDefinition() throws Exception {
+ IType testType = this.createTestDiscriminatorColumnWithColumnDefinition();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+ assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition());
+ }
+
+ public void testSetColumnDefinition() throws Exception {
+ IType testType = this.createTestDiscriminatorColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getColumnDefinition());
+
+ column.setColumnDefinition("Foo");
+ assertEquals("Foo", column.getColumnDefinition());
+
+ assertSourceContains("@DiscriminatorColumn(columnDefinition=\"Foo\")");
+
+
+ column.setColumnDefinition(null);
+ assertSourceDoesNotContain("@DiscriminatorColumn");
+ }
+
+ public void testGetLength() throws Exception {
+ IType testType = this.createTestColumnWithIntElement("length");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+
+ assertEquals(Integer.valueOf(5), column.getLength());
+ }
+
+ public void testSetLength() throws Exception {
+ IType testType = this.createTestDiscriminatorColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getLength());
+
+ column.setLength(Integer.valueOf(5));
+ assertEquals(Integer.valueOf(5), column.getLength());
+
+ assertSourceContains("@DiscriminatorColumn(length=5)");
+
+ column.setLength(null);
+ assertSourceDoesNotContain("@DiscriminatorColumn");
+ }
+
+ public void testGetDiscriminatorType() throws Exception {
+ IType testType = this.createTestDiscriminatorColumnWithDiscriminatorType();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+ assertEquals(DiscriminatorType.CHAR, column.getDiscriminatorType());
+ }
+
+ public void testSetDiscriminatorType() throws Exception {
+ IType testType = this.createTestDiscriminatorColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN);
+
+ assertNull(column.getDiscriminatorType());
+
+ column.setDiscriminatorType(DiscriminatorType.INTEGER);
+ assertEquals(DiscriminatorType.INTEGER, column.getDiscriminatorType());
+
+ assertSourceContains("@DiscriminatorColumn(discriminatorType=INTEGER)");
+
+ column.setDiscriminatorType(null);
+ assertSourceDoesNotContain("@DiscriminatorColumn");
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorValueTests.java
new file mode 100644
index 0000000000..d10d7c377c
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorValueTests.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.DiscriminatorValue;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class DiscriminatorValueTests extends JavaResourceModelTestCase {
+
+ public DiscriminatorValueTests(String name) {
+ super(name);
+ }
+
+ private IType createTestDiscriminatorValue() throws Exception {
+ this.createAnnotationAndMembers("DiscriminatorValue", "String value() default \"\";");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.DISCRIMINATOR_VALUE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@DiscriminatorValue");
+ }
+ });
+ }
+
+ private IType createTestDiscriminatorValueWithValue() throws Exception {
+ this.createAnnotationAndMembers("DiscriminatorValue", "String value() default \"\";");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.DISCRIMINATOR_VALUE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@DiscriminatorValue(value=\"discriminator\")");
+ }
+ });
+ }
+
+ public void testDiscriminatorValue() throws Exception {
+ IType testType = this.createTestDiscriminatorValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ DiscriminatorValue discriminatorValue = (DiscriminatorValue) typeResource.annotation(JPA.DISCRIMINATOR_VALUE);
+ assertNotNull(discriminatorValue);
+ }
+
+ public void testGetValue() throws Exception {
+ IType testType = this.createTestDiscriminatorValueWithValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ DiscriminatorValue discriminatorValue = (DiscriminatorValue) typeResource.annotation(JPA.DISCRIMINATOR_VALUE);
+ assertEquals("discriminator", discriminatorValue.getValue());
+ }
+
+ public void testSetValue() throws Exception {
+ IType testType = this.createTestDiscriminatorValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ DiscriminatorValue discriminatorValue = (DiscriminatorValue) typeResource.annotation(JPA.DISCRIMINATOR_VALUE);
+
+ discriminatorValue.setValue("foo");
+
+ assertSourceContains("@DiscriminatorValue(\"foo\")");
+
+ discriminatorValue.setValue(null);
+
+ assertSourceDoesNotContain("@DiscriminatorValue");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddableTests.java
new file mode 100644
index 0000000000..41a3718e0f
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddableTests.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.Embeddable;
+import org.eclipse.jpt.core.internal.resource.java.Entity;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class EmbeddableTests extends JavaResourceModelTestCase {
+
+ public EmbeddableTests(String name) {
+ super(name);
+ }
+
+ private IType createTestEmbeddable() throws Exception {
+ this.createAnnotationAndMembers("Embeddable", "");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.EMBEDDABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Embeddable");
+ }
+ });
+ }
+
+ private IType createTestEmbeddableAndEntity() throws Exception {
+ this.createAnnotationAndMembers("Embeddable", "");
+ this.createAnnotationAndMembers("Entity", "");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.EMBEDDABLE, JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ sb.append("@Embeddable");
+ }
+ });
+ }
+
+ public void testEmbeddable() throws Exception {
+ IType testType = this.createTestEmbeddable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ JavaResource mappingAnnotation = typeResource.mappingAnnotation();
+ assertTrue(mappingAnnotation instanceof Embeddable);
+ }
+
+ public void testEmbeddableAndEntity() throws Exception {
+ IType testType = this.createTestEmbeddableAndEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ JavaResource mappingAnnotation = typeResource.mappingAnnotation();
+ assertTrue(mappingAnnotation instanceof Embeddable);
+
+ Entity entity = (Entity) typeResource.mappingAnnotation(JPA.ENTITY);
+ assertNotNull(entity);
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedIdTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedIdTests.java
new file mode 100644
index 0000000000..ad46a125a9
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedIdTests.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddedId;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class EmbeddedIdTests extends JavaResourceModelTestCase {
+
+ public EmbeddedIdTests(String name) {
+ super(name);
+ }
+
+ private IType createTestEmbeddedId() throws Exception {
+ this.createAnnotationAndMembers("EmbeddedId", "");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.EMBEDDED_ID);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@EmbeddedId");
+ }
+ });
+ }
+
+ public void testEmbeddedId() throws Exception {
+ IType testType = this.createTestEmbeddedId();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JavaResource mappingAnnotation = attributeResource.mappingAnnotation();
+ assertTrue(mappingAnnotation instanceof EmbeddedId);
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedTests.java
new file mode 100644
index 0000000000..cbac60ed83
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedTests.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.Embedded;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class EmbeddedTests extends JavaResourceModelTestCase {
+
+ public EmbeddedTests(String name) {
+ super(name);
+ }
+
+ private IType createTestEmbedded() throws Exception {
+ this.createAnnotationAndMembers("Embedded", "");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.EMBEDDED);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Embedded");
+ }
+ });
+ }
+
+ public void testEmbedded() throws Exception {
+ IType testType = this.createTestEmbedded();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JavaResource mappingAnnotation = attributeResource.mappingAnnotation();
+ assertTrue(mappingAnnotation instanceof Embedded);
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EntityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EntityTests.java
new file mode 100644
index 0000000000..0ed5ed4c03
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EntityTests.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.Entity;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.MappedSuperclass;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class EntityTests extends JavaResourceModelTestCase {
+
+ private static final String ENTITY_NAME = "Foo";
+
+ public EntityTests(String name) {
+ super(name);
+ }
+
+ private IType createTestEntity() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ });
+ }
+
+ private IType createTestEntityWithName() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity(name=\"" + ENTITY_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestMappedSuperclassAndEntity() throws Exception {
+ this.createAnnotationAndMembers("MappedSuperclass", "");
+ this.createAnnotationAndMembers("Entity", "String name();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS, JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@MappedSuperclass");
+ sb.append("@Entity");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestEntityWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Entity entity = (Entity) typeResource.mappingAnnotation(JPA.ENTITY);
+ assertTrue(entity != null);
+ assertEquals(ENTITY_NAME, entity.getName());
+ }
+
+ public void testGetNameNull() throws Exception {
+ IType testType = this.createTestEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Entity entity = (Entity) typeResource.mappingAnnotation(JPA.ENTITY);
+ assertTrue(entity != null);
+ assertNull(entity.getName());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Entity entity = (Entity) typeResource.mappingAnnotation(JPA.ENTITY);
+ assertNull(entity.getName());
+ entity.setName("Foo");
+ assertEquals("Foo", entity.getName());
+
+ assertSourceContains("@Entity(name=\"Foo\")");
+ }
+
+ public void testSetNameNull() throws Exception {
+ IType testType = this.createTestEntityWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Entity entity = (Entity) typeResource.mappingAnnotation(JPA.ENTITY);
+ assertEquals(ENTITY_NAME, entity.getName());
+
+ entity.setName(null);
+ assertNull(entity.getName());
+
+ assertSourceContains("@Entity");
+ assertSourceDoesNotContain("@Entity(name=\"Foo\")");
+ }
+
+ public void testMappedSuperclassAndEntity() throws Exception {
+ IType testType = this.createTestMappedSuperclassAndEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ JavaResource mappingAnnotation = typeResource.mappingAnnotation();
+ assertTrue(mappingAnnotation instanceof Entity);
+
+ MappedSuperclass mappedSuperclass = (MappedSuperclass) typeResource.mappingAnnotation(JPA.MAPPED_SUPERCLASS);
+ assertNotNull(mappedSuperclass);
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java
new file mode 100644
index 0000000000..eb5a87fdd3
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.EnumType;
+import org.eclipse.jpt.core.internal.resource.java.Enumerated;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class EnumeratedTests extends JavaResourceModelTestCase {
+
+ public EnumeratedTests(String name) {
+ super(name);
+ }
+
+ private IType createTestEnumerated() throws Exception {
+ this.createAnnotationAndMembers("Enumerated", "EnumType value();");
+ this.createEnumAndMembers("EnumType", "ORDINAL, STRING");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENUMERATED);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Enumerated");
+ }
+ });
+ }
+
+ private IType createTestEnumeratedWithValue() throws Exception {
+ this.createAnnotationAndMembers("Enumerated", "EnumType value();");
+ this.createEnumAndMembers("EnumType", "ORDINAL, STRING");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENUMERATED, JPA.ENUM_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Enumerated(EnumType.ORDINAL)");
+ }
+ });
+ }
+
+ public void testEnumerated() throws Exception {
+ IType testType = this.createTestEnumerated();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ Enumerated enumerated = (Enumerated) attributeResource.annotation(JPA.ENUMERATED);
+ assertNotNull(enumerated);
+ }
+
+ public void testGetValue() throws Exception {
+ IType testType = this.createTestEnumeratedWithValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ Enumerated enumerated = (Enumerated) attributeResource.annotation(JPA.ENUMERATED);
+ assertEquals(EnumType.ORDINAL, enumerated.getValue());
+ }
+
+ public void testSetValue() throws Exception {
+ IType testType = this.createTestEnumerated();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ Enumerated enumerated = (Enumerated) attributeResource.annotation(JPA.ENUMERATED);
+
+ enumerated.setValue(EnumType.STRING);
+
+ assertSourceContains("@Enumerated(STRING)");
+
+ enumerated.setValue(null);
+
+ assertSourceDoesNotContain("@Enumerated");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/GeneratedValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/GeneratedValueTests.java
new file mode 100644
index 0000000000..cd06d1d1f0
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/GeneratedValueTests.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.GeneratedValue;
+import org.eclipse.jpt.core.internal.resource.java.GenerationType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class GeneratedValueTests extends JavaResourceModelTestCase {
+
+ private static final String GENERATOR = "MY_GENERATOR";
+ public GeneratedValueTests(String name) {
+ super(name);
+ }
+
+ private void createGenerationTypeEnum() throws Exception {
+ this.createEnumAndMembers("GenerationType", "TABLE, SEQUENCE, IDENTITY, AUTO;");
+ }
+
+ private void createGeneratedValueAnnotation() throws Exception {
+ this.createAnnotationAndMembers("GeneratedValue", "GenerationType strategy() default AUTO; String generator() default \"\"");
+ createGenerationTypeEnum();
+ }
+
+ private IType createTestGeneratedValue() throws Exception {
+ createGeneratedValueAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.GENERATED_VALUE, JPA.GENERATION_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@GeneratedValue");
+ }
+ });
+ }
+
+ private IType createTestGeneratedValueWithGenerator() throws Exception {
+ createGeneratedValueAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.GENERATED_VALUE, JPA.GENERATION_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@GeneratedValue(generator=\"" + GENERATOR + "\")");
+ }
+ });
+ }
+
+ private IType createTestGeneratedValueWithStrategy() throws Exception {
+ createGeneratedValueAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.GENERATED_VALUE, JPA.GENERATION_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@GeneratedValue(strategy=GenerationType.SEQUENCE)");
+ }
+ });
+ }
+
+ public void testGeneratedValue() throws Exception {
+ IType testType = this.createTestGeneratedValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE);
+ assertNotNull(generatedValue);
+ }
+
+ public void testGetGenerator() throws Exception {
+ IType testType = this.createTestGeneratedValueWithGenerator();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE);
+ assertEquals(GENERATOR, generatedValue.getGenerator());
+ }
+
+ public void testSetGenerator() throws Exception {
+ IType testType = this.createTestGeneratedValueWithGenerator();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE);
+ assertEquals(GENERATOR, generatedValue.getGenerator());
+
+ generatedValue.setGenerator("foo");
+ assertEquals("foo", generatedValue.getGenerator());
+
+ assertSourceContains("@GeneratedValue(generator=\"foo\")");
+
+ generatedValue.setGenerator(null);
+ assertNull(generatedValue.getGenerator());
+
+ assertSourceDoesNotContain("generator");
+ assertSourceContains("@GeneratedValue");
+ }
+
+ public void testGetStrategy() throws Exception {
+ IType testType = this.createTestGeneratedValueWithStrategy();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE);
+ assertEquals(GenerationType.SEQUENCE, generatedValue.getStrategy());
+ }
+
+ public void testSetStrategy() throws Exception {
+ IType testType = this.createTestGeneratedValueWithStrategy();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE);
+ assertEquals(GenerationType.SEQUENCE, generatedValue.getStrategy());
+
+ generatedValue.setStrategy(GenerationType.TABLE);
+ assertEquals(GenerationType.TABLE, generatedValue.getStrategy());
+
+ assertSourceContains("@GeneratedValue(strategy=TABLE)");
+
+ generatedValue.setStrategy(null);
+ assertNull(generatedValue.getStrategy());
+ assertSourceDoesNotContain("strategy");
+ assertSourceContains("@GeneratedValue");
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdClassTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdClassTests.java
new file mode 100644
index 0000000000..8f5a43eca9
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdClassTests.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.IdClass;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class IdClassTests extends JavaResourceModelTestCase {
+
+ private static final String ID_CLASS_VALUE = "MyClass";
+
+ public IdClassTests(String name) {
+ super(name);
+ }
+
+ private void createIdClassAnnotation() throws Exception {
+ this.createAnnotationAndMembers("IdClass", "Class value();");
+ }
+
+ private IType createTestIdClass() throws Exception {
+ createIdClassAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ID_CLASS);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@IdClass");
+ }
+ });
+ }
+
+ private IType createTestIdClassWithValue() throws Exception {
+ createIdClassAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ID_CLASS);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@IdClass(" + ID_CLASS_VALUE + ".class)");
+ }
+ });
+ }
+
+ public void testIdClass() throws Exception {
+ IType testType = this.createTestIdClass();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ IdClass idClass = (IdClass) typeResource.annotation(JPA.ID_CLASS);
+ assertNotNull(idClass);
+ assertNull(idClass.getValue());
+ }
+
+ public void testGetValue() throws Exception {
+ IType testType = this.createTestIdClassWithValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ IdClass idClass = (IdClass) typeResource.annotation(JPA.ID_CLASS);
+ assertEquals(ID_CLASS_VALUE, idClass.getValue());
+ }
+
+ public void testSetValue() throws Exception {
+ IType testType = this.createTestIdClassWithValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ IdClass idClass = (IdClass) typeResource.annotation(JPA.ID_CLASS);
+ assertEquals(ID_CLASS_VALUE, idClass.getValue());
+
+ idClass.setValue("foo");
+ assertEquals("foo", idClass.getValue());
+
+ assertSourceContains("@IdClass(foo.class)");
+
+ idClass.setValue(null);
+
+ assertSourceDoesNotContain("@IdClass");
+
+ typeResource.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ idClass = (IdClass) typeResource.annotation(JPA.ID_CLASS);
+ assertNull(idClass);
+ }
+
+ public void testGetFullyQualifiedClass() throws Exception {
+ IType testType = this.createTestIdClassWithValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ IdClass idClass = (IdClass) typeResource.annotation(JPA.ID_CLASS);
+ assertNotNull(idClass.getValue());
+ assertNull(idClass.getFullyQualifiedClass());
+
+
+ idClass.setValue(TYPE_NAME);
+
+ typeResource.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ assertEquals(FULLY_QUALIFIED_TYPE_NAME, idClass.getFullyQualifiedClass());
+
+ assertSourceContains("@IdClass(" + TYPE_NAME + ".class)");
+
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdTests.java
new file mode 100644
index 0000000000..e48e4b4d76
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdTests.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.Id;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class IdTests extends JavaResourceModelTestCase {
+
+ public IdTests(String name) {
+ super(name);
+ }
+
+ private IType createTestId() throws Exception {
+ this.createAnnotationAndMembers("Id", "");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ID);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ public void testId() throws Exception {
+ IType testType = this.createTestId();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JavaResource mappingAnnotation = attributeResource.mappingAnnotation();
+ assertTrue(mappingAnnotation instanceof Id);
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/InheritanceTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/InheritanceTests.java
new file mode 100644
index 0000000000..fab5e57c33
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/InheritanceTests.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.Inheritance;
+import org.eclipse.jpt.core.internal.resource.java.InheritanceType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class InheritanceTests extends JavaResourceModelTestCase {
+
+ public InheritanceTests(String name) {
+ super(name);
+ }
+
+ private IType createTestInheritance() throws Exception {
+ this.createAnnotationAndMembers("Inheritance", "InheritanceType strategy() default SINGLE_TABLE;");
+ this.createEnumAndMembers("InheritanceType", "SINGLE_TABLE, JOINED, TABLE_PER_CLASS");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.INHERITANCE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Inheritance");
+ }
+ });
+ }
+
+ private IType createTestInheritanceWithStrategy() throws Exception {
+ this.createAnnotationAndMembers("Inheritance", "InheritanceType strategy() default SINGLE_TABLE;");
+ this.createEnumAndMembers("InheritanceType", "SINGLE_TABLE, JOINED, TABLE_PER_CLASS");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.INHERITANCE, JPA.INHERITANCE_TYPE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Inheritance(strategy=InheritanceType.JOINED)");
+ }
+ });
+ }
+
+ public void testInheritance() throws Exception {
+ IType testType = this.createTestInheritance();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Inheritance inheritance = (Inheritance) typeResource.annotation(JPA.INHERITANCE);
+ assertNotNull(inheritance);
+ }
+
+ public void testGetStrategy() throws Exception {
+ IType testType = this.createTestInheritanceWithStrategy();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Inheritance inheritance = (Inheritance) typeResource.annotation(JPA.INHERITANCE);
+ assertEquals(InheritanceType.JOINED, inheritance.getStrategy());
+ }
+
+ public void testSetStrategy() throws Exception {
+ IType testType = this.createTestInheritance();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Inheritance inheritance = (Inheritance) typeResource.annotation(JPA.INHERITANCE);
+ inheritance.setStrategy(InheritanceType.TABLE_PER_CLASS);
+
+ assertSourceContains("@Inheritance(strategy=TABLE_PER_CLASS)");
+
+ inheritance.setStrategy(null);
+
+ assertSourceDoesNotContain("@Inheritance");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JPTToolsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JPTToolsTests.java
new file mode 100644
index 0000000000..e3b7470cac
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JPTToolsTests.java
@@ -0,0 +1,527 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.IMethodBinding;
+import org.eclipse.jdt.core.dom.IVariableBinding;
+import org.eclipse.jpt.core.internal.jdtutility.FieldAttribute;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.jdtutility.JPTTools;
+import org.eclipse.jpt.core.internal.jdtutility.MethodAttribute;
+import org.eclipse.jpt.core.internal.jdtutility.Type;
+
+public class JPTToolsTests extends JavaResourceModelTestCase {
+
+ public JPTToolsTests(String name) {
+ super(name);
+ }
+
+ private IType createTestTypeFieldWithModifier(final String modifier) throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" " + modifier + " String foo;").append(CR);
+ sb.append(CR);
+ }
+ });
+ }
+
+ protected FieldAttribute fooField() throws JavaModelException {
+ return this.fieldNamed("foo");
+ }
+
+
+ private IType createTestTypeGetMethodWithModifier(final String modifier) throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" " + modifier + " int getFoo() {").append(CR);
+ sb.append(" return this.id;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ sb.append(" public void setFoo(int id) {").append(CR);
+ sb.append(" this.id = id;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ }
+ });
+ }
+
+ private IType createTestTypeInvalidMethodName() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" public int foo() {").append(CR);
+ sb.append(" return this.id;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ sb.append(" public void setFoo(int id) {").append(CR);
+ sb.append(" this.id = id;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ }
+ });
+ }
+
+ private IType createTestTypeConstructor() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" public " + TYPE_NAME + "() {").append(CR);
+ sb.append(" super();").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ }
+ });
+ }
+
+ private IType createTestTypeVoidMethodReturnType() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" public void getFoo() {").append(CR);
+ sb.append(" return this.id;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ sb.append(" public void setFoo(int id) {").append(CR);
+ sb.append(" this.id = id;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ }
+ });
+ }
+
+// private IType createTestTypeInvalidMethodReturnType() throws Exception {
+// return this.createTestType(new DefaultAnnotationWriter() {
+//
+// @Override
+// public Iterator<String> imports() {
+// return new ArrayIterator<String>("com.foo.Foo");
+// }
+// @Override
+// public void appendGetIdMethodAnnotationTo(StringBuffer sb) {
+// sb.append(CR);
+// sb.append(" public Foo getFoo() {").append(CR);
+// sb.append(" return null;").append(CR);
+// sb.append(" }").append(CR);
+// sb.append(CR);
+// sb.append(" public void setFoo(Foo id) {").append(CR);
+// sb.append(" this.id = id;").append(CR);
+// sb.append(" }").append(CR);
+// sb.append(CR);
+// }
+// });
+// }
+
+ private IType createTestTypeIsMethod() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" public boolean isFoo() {").append(CR);
+ sb.append(" return this.id;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ sb.append(" public void setFoo(boolean id) {").append(CR);
+ sb.append(" this.id = id;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ }
+ });
+ }
+
+ private IType createTestTypeIsMethodReturnInt() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" public int isFoo() {").append(CR);
+ sb.append(" return this.id;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ sb.append(" public void setFoo(int id) {").append(CR);
+ sb.append(" this.id = id;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ }
+ });
+ }
+
+ private IType createTestTypeIsAndGetMethodWithModifier(final String modifier) throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" " + modifier + " boolean isFoo() {").append(CR);
+ sb.append(" return this.id;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ sb.append(" " + modifier + " boolean getFoo() {").append(CR);
+ sb.append(" return this.id;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ sb.append(" public void setFoo(boolean id) {").append(CR);
+ sb.append(" this.id = id;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ }
+ });
+ }
+
+ private IType createTestTypeSetMethodWithModifier(final String modifier) throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" public int getFoo() {").append(CR);
+ sb.append(" return this.id;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ sb.append(" " + modifier + " void setFoo(int id) {").append(CR);
+ sb.append(" this.id = id;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ }
+ });
+ }
+
+ private IType createTestTypeWithMemberTypes() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public void appendMemberTypeTo(StringBuilder sb) {
+ sb.append(" public static class FooStatic {}").append(CR);
+ sb.append(CR);
+ sb.append(" public class FooNotStatic {}").append(CR);
+ sb.append(CR);
+ sb.append(" public @interface MyAnnotation {}").append(CR);
+ sb.append(CR);
+ sb.append(" public enum MyEnum {}").append(CR);
+ }
+ });
+ }
+
+ protected MethodAttribute fooMethod() throws JavaModelException {
+ return this.methodNamed("getFoo");
+ }
+
+ //private String foo; - persistable
+ public void testFieldIsPersistable1() throws Exception {
+ IType testType = createTestTypeFieldWithModifier("private");
+ FieldAttribute fieldAttribute = fooField();
+ IVariableBinding variableBinding = fieldAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertTrue(JPTTools.fieldIsPersistable(variableBinding));
+ }
+
+ //private static String foo; - not persistable
+ public void testFieldIsPersistable2() throws Exception {
+ IType testType = createTestTypeFieldWithModifier("private static");
+ FieldAttribute fieldAttribute = fooField();
+ IVariableBinding variableBinding = fieldAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertFalse(JPTTools.fieldIsPersistable(variableBinding));
+ }
+
+ //private transient String foo; - not persistable
+ public void testFieldIsPersistable3() throws Exception {
+ IType testType = createTestTypeFieldWithModifier("private transient");
+ FieldAttribute fieldAttribute = fooField();
+ IVariableBinding variableBinding = fieldAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertFalse(JPTTools.fieldIsPersistable(variableBinding));
+ }
+
+ //private final String foo; - persistable
+ public void testFieldIsPersistable4() throws Exception {
+ IType testType = createTestTypeFieldWithModifier("private final");
+ FieldAttribute fieldAttribute = fooField();
+ IVariableBinding variableBinding = fieldAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertTrue(JPTTools.fieldIsPersistable(variableBinding));
+ }
+
+ //public String foo; - persistable
+ public void testFieldIsPersistable5() throws Exception {
+ IType testType = createTestTypeFieldWithModifier("public");
+ FieldAttribute fieldAttribute = fooField();
+ IVariableBinding variableBinding = fieldAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertTrue(JPTTools.fieldIsPersistable(variableBinding));
+ }
+
+
+ //public int getFoo() {} - persistable
+ public void testMethodIsPersistablePropertyGetter1() throws Exception {
+ IType testType = createTestTypeGetMethodWithModifier("public");
+ MethodAttribute methodAttribute = fooMethod();
+ IMethodBinding methodBinding = methodAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertTrue(JPTTools.methodIsPersistablePropertyGetter(methodBinding));
+
+ }
+
+ //protected int getFoo() {} - persistable
+ public void testMethodIsPersistablePropertyGetter2() throws Exception {
+ IType testType = createTestTypeGetMethodWithModifier("protected");
+ MethodAttribute methodAttribute = fooMethod();
+ IMethodBinding methodBinding = methodAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertTrue(JPTTools.methodIsPersistablePropertyGetter(methodBinding));
+ }
+
+ //int getFoo() {} - not persistable
+ public void testMethodIsPersistablePropertyGetter3() throws Exception {
+ IType testType = createTestTypeGetMethodWithModifier("");
+ MethodAttribute methodAttribute = fooMethod();
+ IMethodBinding methodBinding = methodAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertFalse(JPTTools.methodIsPersistablePropertyGetter(methodBinding));
+ }
+
+ //private int getFoo() {} - not persistable
+ public void testMethodIsPersistablePropertyGetter4() throws Exception {
+ IType testType = createTestTypeGetMethodWithModifier("private");
+ MethodAttribute methodAttribute = fooMethod();
+ IMethodBinding methodBinding = methodAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertFalse(JPTTools.methodIsPersistablePropertyGetter(methodBinding));
+ }
+
+ //public static int getFoo() {} - not persistable
+ public void testMethodIsPersistablePropertyGetter5() throws Exception {
+ IType testType = createTestTypeGetMethodWithModifier("public static");
+ MethodAttribute methodAttribute = fooMethod();
+ IMethodBinding methodBinding = methodAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertFalse(JPTTools.methodIsPersistablePropertyGetter(methodBinding));
+ }
+
+ //public final int getFoo() {} - not persistable
+ public void testMethodIsPersistablePropertyGetter6() throws Exception {
+ IType testType = createTestTypeGetMethodWithModifier("public final");
+ MethodAttribute methodAttribute = fooMethod();
+ IMethodBinding methodBinding = methodAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertFalse(JPTTools.methodIsPersistablePropertyGetter(methodBinding));
+ }
+
+ //public void setFoo(int foo) {} - persistable
+ public void testMethodIsPersistablePropertyGetter7() throws Exception {
+ IType testType = createTestTypeSetMethodWithModifier("public");
+ MethodAttribute methodAttribute = fooMethod();
+ IMethodBinding methodBinding = methodAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertTrue(JPTTools.methodIsPersistablePropertyGetter(methodBinding));
+
+ }
+
+ //protected void setFoo(int foo) {} - persistable
+ public void testMethodIsPersistablePropertyGetter8() throws Exception {
+ IType testType = createTestTypeSetMethodWithModifier("protected");
+ MethodAttribute methodAttribute = fooMethod();
+ IMethodBinding methodBinding = methodAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertTrue(JPTTools.methodIsPersistablePropertyGetter(methodBinding));
+ }
+
+ //void setFoo(int foo) {} - not persistable
+ public void testMethodIsPersistablePropertyGetter9() throws Exception {
+ IType testType = createTestTypeSetMethodWithModifier("");
+ MethodAttribute methodAttribute = fooMethod();
+ IMethodBinding methodBinding = methodAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertFalse(JPTTools.methodIsPersistablePropertyGetter(methodBinding));
+ }
+
+ //private void setFoo(int foo) {} - not persistable
+ public void testMethodIsPersistablePropertyGetter10() throws Exception {
+ IType testType = createTestTypeSetMethodWithModifier("private");
+ MethodAttribute methodAttribute = fooMethod();
+ IMethodBinding methodBinding = methodAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertFalse(JPTTools.methodIsPersistablePropertyGetter(methodBinding));
+ }
+
+ //public static void setFoo(int foo) {} - not persistable
+ public void testMethodIsPersistablePropertyGetter11() throws Exception {
+ IType testType = createTestTypeSetMethodWithModifier("public static");
+ MethodAttribute methodAttribute = fooMethod();
+ IMethodBinding methodBinding = methodAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertFalse(JPTTools.methodIsPersistablePropertyGetter(methodBinding));
+ }
+
+ //public final void setFoo(int foo) {} - not persistable
+ public void testMethodIsPersistablePropertyGetter12() throws Exception {
+ IType testType = createTestTypeSetMethodWithModifier("public final");
+ MethodAttribute methodAttribute = fooMethod();
+ IMethodBinding methodBinding = methodAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertFalse(JPTTools.methodIsPersistablePropertyGetter(methodBinding));
+ }
+
+ //public boolean isFoo() {} - persistable
+ public void testMethodIsPersistablePropertyGetter13() throws Exception {
+ IType testType = createTestTypeIsMethod();
+ MethodAttribute methodAttribute = this.methodNamed("isFoo");
+ IMethodBinding methodBinding = methodAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertTrue(JPTTools.methodIsPersistablePropertyGetter(methodBinding));
+
+ }
+
+ //public int isFoo() {} - not persistable
+ public void testMethodIsPersistablePropertyGetter14() throws Exception {
+ IType testType = createTestTypeIsMethodReturnInt();
+ MethodAttribute methodAttribute = this.methodNamed("isFoo");
+ IMethodBinding methodBinding = methodAttribute.binding(JDTTools.buildASTRoot(testType));
+ assertFalse(JPTTools.methodIsPersistablePropertyGetter(methodBinding));
+
+ }
+
+ //public int isFoo() {} - persistable
+ //public int getFoo() {} - not persistable
+ public void testMethodIsPersistablePropertyGetter15() throws Exception {
+ IType testType = createTestTypeIsAndGetMethodWithModifier("public");
+ MethodAttribute isFooMethod = this.methodNamed("isFoo");
+ MethodAttribute getFooMethod = this.methodNamed("getFoo");
+
+ CompilationUnit astRoot = JDTTools.buildASTRoot(testType);
+ assertTrue(JPTTools.methodIsPersistablePropertyGetter(isFooMethod.binding(astRoot)));
+ assertFalse(JPTTools.methodIsPersistablePropertyGetter(getFooMethod.binding(astRoot)));
+ }
+
+ //public int foo() {} - not persistable
+ public void testMethodIsPersistablePropertyGetter16() throws Exception {
+ IType testType = createTestTypeInvalidMethodName();
+ MethodAttribute fooMethod = this.methodNamed("foo");
+
+ CompilationUnit astRoot = JDTTools.buildASTRoot(testType);
+ assertFalse(JPTTools.methodIsPersistablePropertyGetter(fooMethod.binding(astRoot)));
+ }
+
+ //public void getFoo() {} - not persistable - void return type
+ public void testMethodIsPersistablePropertyGetter17() throws Exception {
+ IType testType = createTestTypeVoidMethodReturnType();
+ MethodAttribute fooMethod = this.methodNamed("getFoo");
+
+ CompilationUnit astRoot = JDTTools.buildASTRoot(testType);
+ assertFalse(JPTTools.methodIsPersistablePropertyGetter(fooMethod.binding(astRoot)));
+ }
+
+ //TODO
+ //**getFooMethod.binding(CompliationUnit) is returning null, not sure why and don't know how to test
+ //**this if it is returning null there instead of returning null for IMethodBinding.getReturnType()
+// //public Foo getFoo() {} - not persistable - Foo does not resolve
+// public void testMethodIsPersistablePropertyGetter18() throws Exception {
+// IType testType = createTestTypeInvalidMethodReturnType();
+// MethodAttribute getFooMethod = this.methodNamed("getFoo");
+//
+// CompilationUnit astRoot = JDTTools.buildASTRoot(testType);
+// assertFalse(JPTTools.methodIsPersistablePropertyGetter(fooMethod.binding(astRoot)));
+// }
+
+ //method with parameters - not persistable
+ public void testMethodIsPersistablePropertyGetter19() throws Exception {
+ IType testType = createTestType();
+ MethodAttribute setIdMethod = idSetMethod();
+
+ CompilationUnit astRoot = JDTTools.buildASTRoot(testType);
+ assertFalse(JPTTools.methodIsPersistablePropertyGetter(setIdMethod.binding(astRoot)));
+ }
+
+ //constructor - not persistable
+ public void testMethodIsPersistablePropertyGetter20() throws Exception {
+ IType testType = createTestTypeConstructor();
+ MethodAttribute constructor = methodNamed(TYPE_NAME);
+
+ CompilationUnit astRoot = JDTTools.buildASTRoot(testType);
+ assertFalse(JPTTools.methodIsPersistablePropertyGetter(constructor.binding(astRoot)));
+ }
+
+ //no corresponding set method - not persistable
+ public void testMethodIsPersistablePropertyGetter21() throws Exception {
+ IType testType = createTestType();
+ MethodAttribute getNameMethod = nameGetMethod();
+
+ CompilationUnit astRoot = JDTTools.buildASTRoot(testType);
+ assertFalse(JPTTools.methodIsPersistablePropertyGetter(getNameMethod.binding(astRoot)));
+ }
+
+ //public class AnnotationTestType
+ public void testTypeIsPersistable() throws Exception {
+ IType testType = createTestType();
+ Type type = buildType(testType);
+ CompilationUnit astRoot = JDTTools.buildASTRoot(testType);
+ assertTrue(JPTTools.typeIsPersistable(type.binding(astRoot)));
+ }
+
+ //public final class MyFinal
+ public void testTypeIsPersistable2() throws Exception {
+ IType testType = this.javaProject.createType("finals", "MyFinal.java", "public final class MyFinal { }");
+ Type type = buildType(testType);
+ CompilationUnit astRoot = JDTTools.buildASTRoot(testType);
+ assertFalse(JPTTools.typeIsPersistable(type.binding(astRoot)));
+ }
+
+ //public interface AnnotationTestType
+ public void testTypeIsPersistable3() throws Exception {
+ IType testType = this.javaProject.createType("interfaces", "MyInterface.java", "public interface MyInterface { }");
+ Type type = buildType(testType);
+ CompilationUnit astRoot = JDTTools.buildASTRoot(testType);
+ assertFalse(JPTTools.typeIsPersistable(type.binding(astRoot)));
+ }
+
+ //enum not persistable
+ public void testTypeIsPersistable4() throws Exception {
+ IType testType = this.createEnumAndMembers("TestEnum", "FOO, BAR, BAZ");
+ Type type = buildType(testType);
+ CompilationUnit astRoot = JDTTools.buildASTRoot(testType);
+ assertFalse(JPTTools.typeIsPersistable(type.binding(astRoot)));
+ }
+
+ //annotation not persistable
+ public void testTypeIsPersistable5() throws Exception {
+ IType testType = this.createAnnotationAndMembers("TestAnnotation", "TestEnum foo();");
+ Type type = buildType(testType);
+ CompilationUnit astRoot = JDTTools.buildASTRoot(testType);
+ assertFalse(JPTTools.typeIsPersistable(type.binding(astRoot)));
+ }
+
+ //public static member type is persistable
+ public void testTypeIsPersistable6() throws Exception {
+ IType testType = this.createTestTypeWithMemberTypes();
+ IType staticType = testType.getType("FooStatic");
+ Type type = buildType(staticType);
+ CompilationUnit astRoot = JDTTools.buildASTRoot(testType);
+ assertTrue(JPTTools.typeIsPersistable(type.binding(astRoot)));
+ }
+
+ //non-static member type is not persistable
+ public void testTypeIsPersistable7() throws Exception {
+ IType testType = this.createTestTypeWithMemberTypes();
+ IType staticType = testType.getType("FooNotStatic");
+ Type type = buildType(staticType);
+ CompilationUnit astRoot = JDTTools.buildASTRoot(testType);
+ assertFalse(JPTTools.typeIsPersistable(type.binding(astRoot)));
+ }
+ //TODO still need to test typeIsPersistable() returns false for local and anonymous classes
+
+
+
+ public void testIsAbstract() throws Exception {
+ IType testType = createTestType();
+ Type type = buildType(testType);
+ CompilationUnit astRoot = JDTTools.buildASTRoot(testType);
+
+ assertFalse(JPTTools.typeIsAbstract(type.binding(astRoot)));
+ }
+
+}
+
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaPersistentAttributeResourceTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaPersistentAttributeResourceTests.java
new file mode 100644
index 0000000000..0783fbaca6
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaPersistentAttributeResourceTests.java
@@ -0,0 +1,825 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.AttributeOverride;
+import org.eclipse.jpt.core.internal.resource.java.Basic;
+import org.eclipse.jpt.core.internal.resource.java.Column;
+import org.eclipse.jpt.core.internal.resource.java.Id;
+import org.eclipse.jpt.core.internal.resource.java.IdImpl;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.OneToMany;
+import org.eclipse.jpt.core.internal.resource.java.OneToOneImpl;
+import org.eclipse.jpt.utility.internal.ClassTools;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+
+public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestCase {
+
+ public JavaPersistentAttributeResourceTests(String name) {
+ super(name);
+ }
+
+ private IType createTestEntity() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name();");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ });
+ }
+
+ private IType createTestEntityWithNonResolvingField() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name();");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("private Foo foo;").append(CR);
+ sb.append(CR);
+ }
+ });
+ }
+ private IType createTestEntityWithNonResolvingMethod() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name();");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("private Foo foo;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id");
+ sb.append(CR);
+ sb.append(" public Foo getFoo() {").append(CR);
+ sb.append(" return this.foo;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ sb.append(" ");
+ sb.append(CR);
+ sb.append(" public void setFoo(Foo foo) {").append(CR);
+ sb.append(" this.foo = foo;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ sb.append(" ");
+ }
+ });
+ }
+
+ private IType createTestEntityMultipleVariableDeclarationsPerLine() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name();");
+ this.createAnnotationAndMembers("Column", "String name();");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append(CR);
+ sb.append(" ");
+ sb.append("@Id");
+ sb.append(CR);
+ sb.append(" ");
+ sb.append("@Column(name=\"baz\")");
+ sb.append(" private String foo, bar;").append(CR);
+ sb.append(CR);
+ }
+ });
+ }
+
+ private IType createTestEntityWithIdAndBasic() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name();");
+ this.createAnnotationAndMembers("Id", "");
+ this.createAnnotationAndMembers("Basic", "");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.BASIC);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ sb.append(CR);
+ sb.append("@Basic");
+ }
+ });
+ }
+
+ private IType createTestEntityAnnotatedField() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name();");
+ this.createAnnotationAndMembers("Column", "String name();");
+ this.createAnnotationAndMembers("Id", "String name();");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID, JPA.COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ sb.append(CR);
+ sb.append(" ");
+ sb.append("@Column");
+ }
+ });
+ }
+
+ private IType createTestEntityWithColumn() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name();");
+ this.createAnnotationAndMembers("Column", "String name(); String table();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Column(name=\"FOO\", table=\"MY_TABLE\")");
+ }
+ });
+ }
+
+ private IType createTestEntityWithIdColumnGeneratedValue() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name();");
+ this.createAnnotationAndMembers("Column", "String name(); String table();");
+ this.createAnnotationAndMembers("GeneratedValue", "");
+ this.createAnnotationAndMembers("Id", "");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.COLUMN, JPA.ID, JPA.GENERATED_VALUE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ sb.append(CR);
+ sb.append("@Column");
+ sb.append(CR);
+ sb.append("@GeneratedValue");
+ }
+ });
+ }
+
+
+ private IType createTestEntityMultipleColumns() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name();");
+ this.createAnnotationAndMembers("Column", "String name();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Column(name=\"FOO\")");
+ sb.append(CR);
+ sb.append("@Column(name=\"BAR\")");
+ }
+ });
+ }
+
+ private IType createTestEmbeddedWithAttributeOverride() throws Exception {
+ this.createAnnotationAndMembers("Embedded", "String name();");
+ this.createAnnotationAndMembers("AttributeOverride", "String name();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.EMBEDDED, JPA.ATTRIBUTE_OVERRIDE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Embedded");
+ sb.append(CR);
+ sb.append("@AttributeOverride(name=\"FOO\")");
+ }
+ });
+ }
+ private IType createTestEmbeddedWithAttributeOverrides() throws Exception {
+ this.createAnnotationAndMembers("Embedded", "String name();");
+ this.createAnnotationAndMembers("AttributeOverride", "String name();");
+ this.createAnnotationAndMembers("AttributeOverrides", "AttributeOverride[] value();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.EMBEDDED, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Embedded");
+ sb.append(CR);
+ sb.append("@AttributeOverrides(@AttributeOverride(name=\"FOO\"))");
+ }
+ });
+ }
+ private IType createTestEmbeddedWithAttributeOverridesEmpty() throws Exception {
+ this.createAnnotationAndMembers("Embedded", "String name();");
+ this.createAnnotationAndMembers("AttributeOverrides", "AttributeOverride[] value();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.EMBEDDED, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Embedded");
+ sb.append(CR);
+ sb.append("@AttributeOverrides()");
+ }
+ });
+ }
+
+ private IType createTestEmbeddedWith2AttributeOverrides() throws Exception {
+ this.createAnnotationAndMembers("Embedded", "String name();");
+ this.createAnnotationAndMembers("AttributeOverride", "String name();");
+ this.createAnnotationAndMembers("AttributeOverrides", "AttributeOverride[] value();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.EMBEDDED, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Embedded");
+ sb.append(CR);
+ sb.append("@AttributeOverrides({@AttributeOverride(name=\"FOO\"), @AttributeOverride(name=\"BAR\")})");
+ }
+ });
+ }
+
+ private IType createTestEmbeddedWithAttributeOverrideAndAttributeOverrides() throws Exception {
+ this.createAnnotationAndMembers("Embedded", "String name();");
+ this.createAnnotationAndMembers("AttributeOverride", "String name();");
+ this.createAnnotationAndMembers("AttributeOverrides", "AttributeOverride[] value();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.EMBEDDED, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Embedded");
+ sb.append(CR);
+ sb.append("@AttributeOverride(name=\"FOO\")");
+ sb.append(CR);
+ sb.append("@AttributeOverrides({@AttributeOverride(name=\"BAR\"), @AttributeOverride(name=\"BAZ\")})");
+ }
+ });
+ }
+
+ public void testJavaAttributeAnnotations() throws Exception {
+ IType testType = this.createTestEntityWithColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ assertEquals(1, CollectionTools.size(attributeResource.annotations()));
+ }
+
+ public void testJavaAttributeAnnotation() throws Exception {
+ IType testType = this.createTestEntityWithColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ assertNotNull(attributeResource.annotation(JPA.COLUMN));
+ }
+
+ public void testJavaAttributeAnnotationNull() throws Exception {
+ IType testType = this.createTestEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ assertNull(attributeResource.annotation(JPA.TABLE));
+ }
+
+ //This will result in a compilation error, but we assume the first column found
+ public void testDuplicateAnnotations() throws Exception {
+ IType testType = this.createTestEntityMultipleColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ Column columnResource = (Column) attributeResource.annotation(JPA.COLUMN);
+ assertEquals("FOO", columnResource.getName());
+ }
+
+ public void testRemoveColumn() throws Exception {
+ IType testType = this.createTestEntityWithColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ attributeResource.removeAnnotation(JPA.COLUMN);
+
+ assertSourceDoesNotContain("@Column");
+ }
+
+ public void testRemoveColumnName() throws Exception {
+ IType testType = this.createTestEntityWithColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ Column columnResource = (Column) attributeResource.annotation(JPA.COLUMN);
+ columnResource.setTable(null);
+ assertSourceContains("@Column(name=\"FOO\")");
+
+ columnResource.setName(null);
+ assertSourceDoesNotContain("@Column");
+
+ //TODO should I be calling this in the test? where should the IElementChangedListener be set up?
+ typeResource.updateFromJava(JDTTools.buildASTRoot(jdtType()));
+ assertNull(typeResource.annotation(JPA.TABLE));
+ }
+
+ public void testMultipleAttributeMappings() throws Exception {
+ IType testType = this.createTestEntityWithIdAndBasic();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ assertEquals(2, CollectionTools.size(attributeResource.mappingAnnotations()));
+ assertEquals(0, CollectionTools.size(attributeResource.annotations()));
+ assertNotNull(attributeResource.mappingAnnotation(JPA.BASIC));
+ assertNotNull(attributeResource.mappingAnnotation(JPA.ID));
+
+ JavaResource javaAttributeMappingAnnotation = attributeResource.mappingAnnotation();
+ assertTrue(javaAttributeMappingAnnotation instanceof Basic);
+ assertSourceContains("@Basic");
+ assertSourceContains("@Id");
+
+ attributeResource.setMappingAnnotation(JPA.ONE_TO_MANY);
+ assertEquals(1, CollectionTools.size(attributeResource.mappingAnnotations()));
+ javaAttributeMappingAnnotation = attributeResource.mappingAnnotation();
+ assertTrue(javaAttributeMappingAnnotation instanceof OneToMany);
+ assertSourceDoesNotContain("@Id");
+ assertSourceContains("@OneToMany");
+ assertSourceDoesNotContain("@Basic");
+ }
+
+ public void testSetJavaAttributeMappingAnnotation() throws Exception {
+ IType testType = createTestType();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ assertEquals(0, CollectionTools.size(attributeResource.mappingAnnotations()));
+
+ attributeResource.setMappingAnnotation(JPA.ID);
+ assertTrue(attributeResource.mappingAnnotation() instanceof Id);
+ assertSourceContains("@Id");
+
+ attributeResource.setMappingAnnotation(JPA.ID);
+ //TODO need to test behavior here, throw an exception, remove the old @Id and replace it,
+ //thus clearing out any annotation elements??
+ }
+
+ public void testSetJavaAttributeMappingAnnotation2() throws Exception {
+ IType testType = createTestEntityWithColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ assertNull(attributeResource.mappingAnnotation());
+
+ attributeResource.setMappingAnnotation(JPA.ID);
+ assertTrue(attributeResource.mappingAnnotation() instanceof Id);
+
+ assertSourceContains("@Id");
+ assertSourceContains("@Column");
+ }
+
+ public void testSetJavaAttributeMappingAnnotation3() throws Exception {
+ IType testType = createTestEntityWithIdColumnGeneratedValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ assertTrue(attributeResource.mappingAnnotation() instanceof Id);
+
+ attributeResource.setMappingAnnotation(JPA.BASIC);
+ assertTrue(attributeResource.mappingAnnotation() instanceof Basic);
+
+ assertSourceDoesNotContain("@Id");
+ assertSourceContains("@GeneratedValue"); //not supported by Basic
+ assertSourceContains("@Column"); //common between Id and Basic
+ }
+
+ public void testSetJavaAttributeMappingAnnotationNull() throws Exception {
+ IType testType = createTestEntityWithIdColumnGeneratedValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ assertTrue(attributeResource.mappingAnnotation() instanceof Id);
+
+ attributeResource.setMappingAnnotation(null);
+ assertNull(attributeResource.mappingAnnotation());
+
+ assertSourceDoesNotContain("@Id");
+ assertSourceContains("@GeneratedValue"); //not supported by Basic
+ assertSourceContains("@Column"); //common between Id and Basic
+ }
+
+ public void testAddJavaAttributeAnnotation() throws Exception {
+ IType testType = createTestEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ assertSourceDoesNotContain("@Column");
+ attributeResource.addAnnotation(JPA.COLUMN);
+ assertSourceContains("@Column");
+ }
+
+ public void testRemoveJavaAttributeAnnotation() throws Exception {
+ IType testType = createTestEntityAnnotatedField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ assertSourceContains("@Column");
+ attributeResource.removeAnnotation(JPA.COLUMN);
+ assertSourceDoesNotContain("@Column");
+ }
+
+
+ //update source code to change from @Id to @OneToOne and make sure @Column is not removed
+ public void testChangeAttributeMappingInSource() throws Exception {
+ IType jdtType = createTestEntityAnnotatedField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ idField().removeAnnotation(((IdImpl) attributeResource.mappingAnnotation()).getDeclarationAnnotationAdapter());
+
+ this.createAnnotationAndMembers("OneToOne", "");
+ jdtType.getCompilationUnit().createImport("javax.persistence.OneToOne", null, new NullProgressMonitor());
+
+ idField().newMarkerAnnotation(OneToOneImpl.DECLARATION_ANNOTATION_ADAPTER);
+
+ typeResource.updateFromJava(JDTTools.buildASTRoot(jdtType));
+
+
+ assertNotNull(attributeResource.annotation(JPA.COLUMN));
+ assertNull(attributeResource.mappingAnnotation(JPA.ID));
+ assertNotNull(attributeResource.mappingAnnotation(JPA.ONE_TO_ONE));
+ assertSourceContains("@Column");
+ }
+
+ public void testJavaAttributeAnnotationsNestable() throws Exception {
+ IType jdtType = createTestEmbeddedWithAttributeOverride();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ assertEquals(1, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
+
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next();
+
+ assertEquals("FOO", attributeOverride.getName());
+ }
+
+ public void testJavaAttributeAnnotationsNoNestable() throws Exception {
+ IType jdtType = createTestEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ assertEquals(0, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
+ }
+
+ public void testJavaAttributeAnnotationsContainerNoNestable() throws Exception {
+ IType jdtType = createTestEmbeddedWithAttributeOverridesEmpty();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ assertEquals(0, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
+ }
+
+ public void testJavaAttributeAnnotationsNestableAndContainer() throws Exception {
+ IType jdtType = createTestEmbeddedWithAttributeOverrideAndAttributeOverrides();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ assertNotNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE));
+ assertNotNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES));
+ assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
+
+ AttributeOverride attributeOverrideResource = (AttributeOverride) attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next();
+ assertEquals("BAR", attributeOverrideResource.getName());
+ }
+
+ // -->> @AttributeOverride(name="FOO")
+ public void testAddJavaAttributeAnnotationNestableContainer() throws Exception {
+ IType jdtType = createTestEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("FOO");
+ assertSourceContains("@AttributeOverride(name=\"FOO\")");
+ }
+
+ // @Embedded -->> @Embedded
+ // @AttributeOverride(name="FOO") @AttributeOverrides({@AttributeOverride(name="FOO"), @AttributeOverride(name="BAR")})
+ public void testAddJavaAttributeAnnotationNestableContainer2() throws Exception {
+ IType jdtType = createTestEmbeddedWithAttributeOverride();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("BAR");
+ assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\"),@AttributeOverride(name=\"BAR\")})");
+
+ assertNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE));
+ assertNotNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES));
+ assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
+ }
+
+ // @Embedded
+ // @AttributeOverrides(@AttributeOverride(name="FOO"))
+ // ||
+ // \/
+ // @Embedded
+ // @AttributeOverrides({@AttributeOverride(name="FOO"), @AttributeOverride(name="BAR")})
+ public void testAddJavaAttributeAnnotationNestableContainer3() throws Exception {
+ IType jdtType = createTestEmbeddedWithAttributeOverrides();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("BAR");
+ assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\"),@AttributeOverride(name=\"BAR\")})");
+
+ assertNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE));
+ assertNotNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES));
+ assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
+ }
+
+ public void testAddJavaAttributeAnnotationNestableContainer5() throws Exception {
+ IType jdtType = createTestEmbeddedWithAttributeOverrides();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride.setName("BAR");
+ assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"BAR\"),@AttributeOverride(name=\"FOO\")})");
+
+ assertNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE));
+ assertNotNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES));
+ assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
+ }
+
+ // @Embedded
+ // @SecondaryTable(name=\"FOO\")
+ // @AttributeOverrides({@AttributeOverride(name=\"BAR\"), @AttributeOverride(name=\"BAZ\")})
+ // ||
+ // \/
+ // @Embedded
+ // @AttributeOverride(name=\"FOO\")
+ // @AttributeOverrides({@AttributeOverride(name=\"BAR\"), @AttributeOverride(name=\"BAZ\"), @AttributeOverride(name=\"BOO\")})
+ public void testAddJavaAttributeAnnotationNestableContainer4() throws Exception {
+ IType jdtType = createTestEmbeddedWithAttributeOverrideAndAttributeOverrides();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ assertNotNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE));
+ assertNotNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES));
+ assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
+
+ AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"BAR\"), @AttributeOverride(name=\"BAZ\"),");
+ assertSourceContains("@AttributeOverride})");
+ attributeOverride.setName("BOO");
+
+ assertNotNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE));
+ assertNotNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES));
+ assertEquals(3, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES)));
+
+ Iterator<JavaResource> attributeOverrideAnnotations = attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverride) attributeOverrideAnnotations.next();
+ assertEquals("BAR", attributeOverride.getName());
+ attributeOverride = (AttributeOverride) attributeOverrideAnnotations.next();
+ assertEquals("BAZ", attributeOverride.getName());
+ attributeOverride = (AttributeOverride) attributeOverrideAnnotations.next();
+ assertEquals("BOO", attributeOverride.getName());
+
+ assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"BAR\"), @AttributeOverride(name=\"BAZ\"),");
+ assertSourceContains("@AttributeOverride(name=\"BOO\")})");
+ }
+
+ //@Entity
+ //@AttributeOverride(name="FOO")
+ public void testRemoveJavaAttributeAnnotationNestableContainer() throws Exception {
+ IType jdtType = createTestEmbeddedWithAttributeOverride();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+
+ assertSourceDoesNotContain("@AttributeOverride");
+ }
+
+
+ //@Entity
+ //@SecondaryTables(@SecondaryTable(name="FOO"))
+ public void testRemoveJavaAttributeAnnotationNestableContainer2() throws Exception {
+ IType jdtType = createTestEmbeddedWithAttributeOverrides();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+
+ assertSourceDoesNotContain("@AttributeOverride");
+ assertSourceDoesNotContain("@AttributeOverrides");
+ }
+
+ public void testRemoveJavaAttributeAnnotationIndex() throws Exception {
+ IType jdtType = createTestEmbeddedWith2AttributeOverrides();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE , JPA.ATTRIBUTE_OVERRIDES);
+
+ assertSourceDoesNotContain("@AttributeOverride(name=\"FOO\"");
+ assertSourceContains("@AttributeOverride(name=\"BAR\"");
+ assertSourceDoesNotContain("@AttributeOverrides");
+ }
+
+ public void testRemoveJavaAttributeAnnotationIndex2() throws Exception {
+ IType jdtType = createTestEmbeddedWith2AttributeOverrides();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AttributeOverride newAnnotation = (AttributeOverride)attributeResource.addAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ newAnnotation.setName("BAZ");
+ assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\"), @AttributeOverride(name=\"BAR\"),");
+ assertSourceContains("@AttributeOverride(name=\"BAZ\")})");
+
+ attributeResource.removeAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\"), @AttributeOverride(name=\"BAZ\")})");
+ }
+
+ public void testMoveJavaTypeAnnotation() throws Exception {
+ IType jdtType = createTestEmbeddedWith2AttributeOverrides();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AttributeOverride newAnnotation = (AttributeOverride)attributeResource.addAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ newAnnotation.setName("BAZ");
+ assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\"), @AttributeOverride(name=\"BAR\"),");
+ assertSourceContains("@AttributeOverride(name=\"BAZ\")})");
+
+
+ attributeResource.move(0, 2, JPA.ATTRIBUTE_OVERRIDES);
+ assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"BAZ\"), @AttributeOverride(name=\"FOO\"),");
+ assertSourceContains("@AttributeOverride(name=\"BAR\")})");
+ }
+
+ public void testMoveJavaTypeAnnotation2() throws Exception {
+ IType jdtType = createTestEmbeddedWith2AttributeOverrides();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ AttributeOverride newAnnotation = (AttributeOverride) attributeResource.addAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ newAnnotation.setName("BAZ");
+ assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\"), @AttributeOverride(name=\"BAR\"),");
+ assertSourceContains("@AttributeOverride(name=\"BAZ\")})");
+
+ attributeResource.move(1, 0, JPA.ATTRIBUTE_OVERRIDES);
+ assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"BAR\"), @AttributeOverride(name=\"FOO\"),");
+ assertSourceContains("@AttributeOverride(name=\"BAZ\")})");
+ }
+
+ //more detailed tests in JPTToolsTests
+ public void testIsPersistableField() throws Exception {
+ IType jdtType = createTestEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ assertTrue(attributeResource.isPersistable());
+ }
+
+ public void testIsPersistableField2() throws Exception {
+ IType jdtType = createTestEntityWithNonResolvingField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ Collection<JavaPersistentAttributeResource> attributes = (Collection<JavaPersistentAttributeResource>) ClassTools.fieldValue(typeResource, "attributes");
+ JavaPersistentAttributeResource attributeResource = attributes.iterator().next();
+
+ assertEquals("foo", attributeResource.getName());
+ assertTrue(attributeResource.isForField());
+ assertFalse(attributeResource.isPersistable());
+
+ this.javaProject.createType("test", "Foo.java", "public class Foo {}");
+ this.javaResourceModel.resolveTypes();
+
+ assertTrue(attributeResource.isPersistable());
+ }
+
+ public void testGetQualifiedTypeName() throws Exception {
+ IType jdtType = createTestEntityWithNonResolvingField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ Collection<JavaPersistentAttributeResource> attributes = (Collection<JavaPersistentAttributeResource>) ClassTools.fieldValue(typeResource, "attributes");
+ JavaPersistentAttributeResource attributeResource = attributes.iterator().next();
+
+ assertEquals("foo", attributeResource.getName());
+ assertNull(attributeResource.getQualifiedTypeName());
+
+ this.javaProject.createType("test", "Foo.java", "public class Foo {}");
+ this.javaResourceModel.resolveTypes();
+
+ assertEquals("test.Foo", attributeResource.getQualifiedTypeName());
+ }
+
+
+ //more detailed tests in JPTToolsTests
+ public void testIsPersistableMethod() throws Exception {
+ IType jdtType = createTestEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.properties().next();
+
+ assertTrue(attributeResource.isPersistable());
+ }
+
+ public void testIsPersistableMethod2() throws Exception {
+ IType jdtType = createTestEntityWithNonResolvingMethod();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ Collection<JavaPersistentAttributeResource> attributes = (Collection<JavaPersistentAttributeResource>) ClassTools.fieldValue(typeResource, "attributes");
+ JavaPersistentAttributeResource attributeResource = (JavaPersistentAttributeResource) attributes.toArray()[3];
+
+ assertEquals("foo", attributeResource.getName());
+ assertTrue(attributeResource.isForProperty());
+ assertFalse(attributeResource.isPersistable());
+
+ this.javaProject.createType("test", "Foo.java", "public class Foo {}");
+ this.javaResourceModel.resolveTypes();
+
+ assertTrue(attributeResource.isPersistable());
+ }
+
+ //this tests that we handle mutliple variable declarations in one line.
+ //The annotations should apply to all fields defined. This is not really a useful
+ //thing to do with JPA beyond the most basic things that use default column names
+ public void testMultipleVariableDeclarationsPerLine() throws Exception {
+ IType jdtType = createTestEntityMultipleVariableDeclarationsPerLine();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ assertEquals(4, CollectionTools.size(typeResource.fields()));
+ Iterator<JavaPersistentAttributeResource> fields = typeResource.fields();
+ JavaPersistentAttributeResource attributeResource = fields.next();
+ Column column = (Column) attributeResource.annotation(JPA.COLUMN);
+ assertEquals("baz", column.getName());
+
+ attributeResource = fields.next();
+ column = (Column) attributeResource.annotation(JPA.COLUMN);
+ assertEquals("baz", column.getName());
+
+ }
+ //TODO add tests for JPTTools static methods
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaPersistentTypeResourceTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaPersistentTypeResourceTests.java
new file mode 100644
index 0000000000..5e964dc430
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaPersistentTypeResourceTests.java
@@ -0,0 +1,977 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.AccessType;
+import org.eclipse.jpt.core.internal.resource.java.Embeddable;
+import org.eclipse.jpt.core.internal.resource.java.EmbeddableImpl;
+import org.eclipse.jpt.core.internal.resource.java.Entity;
+import org.eclipse.jpt.core.internal.resource.java.EntityImpl;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.MappedSuperclass;
+import org.eclipse.jpt.core.internal.resource.java.SecondaryTable;
+import org.eclipse.jpt.core.internal.resource.java.Table;
+import org.eclipse.jpt.utility.internal.ClassTools;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase {
+
+ public JavaPersistentTypeResourceTests(String name) {
+ super(name);
+ }
+
+ private void createEntityAnnotation() throws Exception{
+ this.createAnnotationAndMembers("Entity", "String name() default \"\";");
+ }
+
+ private IType createTestEntity() throws Exception {
+ createEntityAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ });
+ }
+
+ private IType createTestInvalidAnnotations() throws Exception {
+ this.createAnnotationAndMembers("Foo", "String name();");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>("javax.persistence.Foo");
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Foo");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Foo");
+ }
+ });
+ }
+
+ private IType createTestEntityWithMemberEmbeddable() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("Embeddable", "String name();");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.EMBEDDABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendMemberTypeTo(StringBuilder sb) {
+ sb.append(" @Embeddable");
+ sb.append(CR);
+ sb.append(" public static class Foo { }").append(CR);
+
+ }
+ });
+ }
+
+ private IType createTestEntityDuplicates() throws Exception {
+ createEntityAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity(name=\"FirstEntity\")").append(CR);
+ sb.append("@Entity(name=\"SecondEntity\")");
+ }
+ });
+ }
+
+ private IType createTestEntityWithEmbeddable() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("Embeddable", "String name();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.EMBEDDABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("@Embeddable");
+ }
+ });
+ }
+
+ private IType createTestEntityAnnotatedField() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("Id", "");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestEntityAnnotatedMethod() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("Id", "");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+ private IType createTestEntityAnnotatedFieldAndMethod() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("Id", "");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestEntityAnnotatedNonPersistableMethod() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("Id", "");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendGetNameMethodAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private IType createTestEntityAnnotatedPersistableMethodNonPersistableField() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("Id", "");
+ this.createAnnotationAndMembers("Column", "");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Column");
+ sb.append(" private transient int notPersistable;").append(CR);
+ sb.append(CR);
+
+ }
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append("@Column");
+ }
+ });
+ }
+ private IType createTestEntityNoPersistableFields() throws Exception {
+ createEntityAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendMemberTypeTo(StringBuilder sb) {
+ sb.delete(sb.indexOf("private int id;"), sb.indexOf("private int id;") + "private int id;".length());
+ sb.delete(sb.indexOf("private String name;"), sb.indexOf("private String name;") + "private String name;".length());
+ }
+ });
+ }
+
+// private IType createTestEntityLarge(final int i) throws Exception {
+// return this.createTestType(new DefaultAnnotationWriter() {
+// @Override
+// public Iterator<String> imports() {
+// return new ArrayIterator<String>(JPA.ENTITY + i);
+// }
+// @Override
+// public void appendTypeAnnotationTo(StringBuilder sb) {
+// sb.append("@Entity" + i);
+// sb.append(CR);
+// }
+// @Override
+// public String typeName() {
+// return TYPE_NAME + i;
+// }
+// });
+// }
+//
+// public void testLarge() throws Exception {
+// for (int i = START; i <= END; i++) {
+// this.createAnnotationAndMembers("Entity" +i, "String name();");
+// }
+//
+// List<IType> testTypes = new ArrayList<IType>();
+// for (int i = START; i <= END; i++) {
+// testTypes.add(createTestEntityLarge(i));
+// }
+// long start = System.currentTimeMillis();
+// List<JavaPersistentTypeResource> typeResources = new ArrayList<JavaPersistentTypeResource>();
+// for (int i = 0; i < END; i++) {
+// typeResources.add(buildJavaTypeResource(testTypes.get(i)));
+// }
+// long end = System.currentTimeMillis();
+//
+// System.out.println(end-start + "ms");
+// for (int i = 0; i < END; i++) {
+// assertEquals(1, CollectionTools.size(typeResources.get(i).javaTypeMappingAnnotations()));
+// assertNotNull(typeResources.get(i).javaTypeMappingAnnotation(JPA.ENTITY + (i+1)));
+// }
+//
+//
+//// assertEquals(0, CollectionTools.size(typeResource.javaTypeAnnotations()));
+// }
+
+
+
+ private IType createTestEntityWithTable() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("Table", "String name(); String schema();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.TABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("@Table(name=\"FOO\", schema=\"BAR\")");
+ }
+ });
+ }
+
+ private IType createTestEntityWithTableAndIdClass() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("Table", "String name(); String schema();");
+ this.createAnnotationAndMembers("IdClass", "Class value();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.TABLE, JPA.ID_CLASS);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("@Table");
+ sb.append(CR);
+ sb.append("@IdClass");
+ }
+ });
+ }
+
+
+ private IType createTestEntityMultipleTables() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("Table", "String name(); String schema();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.TABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("@Table(name=\"FOO\")");
+ sb.append(CR);
+ sb.append("@Table(name=\"BAR\")");
+ }
+ });
+ }
+
+ private IType createTestEntityWithSecondaryTable() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("SecondaryTable", "String name();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("@SecondaryTable(name=\"FOO\")");
+ }
+ });
+ }
+ private IType createTestEntityWithEmptySecondaryTables() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("SecondaryTable", "String name();");
+ this.createAnnotationAndMembers("SecondaryTables", "SecondaryTable[] value();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("@SecondaryTables()");
+ }
+ });
+ }
+
+ private IType createTestEntityWithSecondaryTables() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("SecondaryTable", "String name();");
+ this.createAnnotationAndMembers("SecondaryTables", "SecondaryTable[] value();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("@SecondaryTables(@SecondaryTable(name=\"FOO\"))");
+ }
+ });
+ }
+
+ private IType createTestEntityWith2SecondaryTables() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("SecondaryTable", "String name();");
+ this.createAnnotationAndMembers("SecondaryTables", "SecondaryTable[] value();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("@SecondaryTables({@SecondaryTable(name=\"FOO\"), @SecondaryTable(name=\"BAR\")})");
+ }
+ });
+ }
+
+ private IType createTestEntityWithSecondaryTableAndSecondaryTables() throws Exception {
+ createEntityAnnotation();
+ this.createAnnotationAndMembers("SecondaryTable", "String name();");
+ this.createAnnotationAndMembers("SecondaryTables", "SecondaryTable[] value();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("@SecondaryTable(name=\"FOO\")");
+ sb.append(CR);
+ sb.append("@SecondaryTables({@SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\")})");
+ }
+ });
+ }
+
+ private IType createTestEntityWithMemberTypes() throws Exception {
+ createEntityAnnotation();
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendMemberTypeTo(StringBuilder sb) {
+ sb.append(" static class FooStatic {}").append(CR);
+ sb.append(CR);
+ sb.append(" class FooNotStatic {}").append(CR);
+ sb.append(CR);
+ sb.append(" @interface MyAnnotation {}").append(CR);
+ sb.append(CR);
+ sb.append(" enum MyEnum {}").append(CR);
+ }
+ });
+ }
+
+ public void testJavaTypeAnnotations() throws Exception {
+ IType testType = this.createTestEntityWithTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ assertEquals(1, CollectionTools.size(typeResource.annotations()));
+ }
+
+ public void testJavaTypeAnnotation() throws Exception {
+ IType testType = this.createTestEntityWithTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ assertNotNull(typeResource.annotation(JPA.TABLE));
+ }
+
+ public void testJavaTypeAnnotationNull() throws Exception {
+ IType testType = this.createTestEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ assertNull(typeResource.annotation(JPA.TABLE));
+ }
+
+ //This will result in a compilation error, but we assume the first table found
+ public void testDuplicateAnnotations() throws Exception {
+ IType testType = this.createTestEntityMultipleTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ Table tableResource = (Table) typeResource.annotation(JPA.TABLE);
+ assertEquals("FOO", tableResource.getName());
+ }
+
+ public void testRemoveTable() throws Exception {
+ IType testType = this.createTestEntityWithTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ typeResource.removeAnnotation(JPA.TABLE);
+
+ assertSourceDoesNotContain("@Table");
+ }
+
+ public void testRemoveTableName() throws Exception {
+ IType testType = this.createTestEntityWithTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Table tableResource = (Table) typeResource.annotation(JPA.TABLE);
+ tableResource.setSchema(null);
+ assertSourceContains("@Table(name=\"FOO\")");
+
+ tableResource.setName(null);
+ assertSourceDoesNotContain("@Table");
+
+ //TODO should I be calling this in the test? where should the IElementChangedListener be set up?
+ typeResource.updateFromJava(JDTTools.buildASTRoot(jdtType()));
+ assertNull(typeResource.annotation(JPA.TABLE));
+ }
+
+ public void testMultipleTypeMappings() throws Exception {
+ IType testType = this.createTestEntityWithEmbeddable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ assertEquals(2, CollectionTools.size(typeResource.mappingAnnotations()));
+ assertEquals(0, CollectionTools.size(typeResource.annotations()));
+ assertNotNull(typeResource.mappingAnnotation(JPA.EMBEDDABLE));
+ assertNotNull(typeResource.mappingAnnotation(JPA.ENTITY));
+
+ JavaResource javaTypeMappingAnnotation = typeResource.mappingAnnotation();
+ assertTrue(javaTypeMappingAnnotation instanceof Embeddable);
+ assertSourceContains("@Entity");
+ assertSourceContains("@Embeddable");
+
+ typeResource.setMappingAnnotation(JPA.MAPPED_SUPERCLASS);
+ assertEquals(1, CollectionTools.size(typeResource.mappingAnnotations()));
+ javaTypeMappingAnnotation = typeResource.mappingAnnotation();
+ assertTrue(javaTypeMappingAnnotation instanceof MappedSuperclass);
+ assertSourceDoesNotContain("@Entity");
+ assertSourceContains("@MappedSuperclass");
+ assertSourceDoesNotContain("@Embeddable");
+ }
+
+ public void testSetJavaTypeMappingAnnotation() throws Exception {
+ IType testType = createTestType();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ assertEquals(0, CollectionTools.size(typeResource.mappingAnnotations()));
+
+ typeResource.setMappingAnnotation(JPA.ENTITY);
+ assertTrue(typeResource.mappingAnnotation() instanceof Entity);
+ assertSourceContains("@Entity");
+
+ typeResource.setMappingAnnotation(JPA.ENTITY);
+ //TODO need to test behavior here, throw an exception, remove the old @Entity and replace it,
+ //thus clearing out any annotation elements??
+ }
+
+ public void testSetJavaTypeMappingAnnotation2() throws Exception {
+ IType testType = createTestEntityWithTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ assertTrue(typeResource.mappingAnnotation() instanceof Entity);
+
+ typeResource.setMappingAnnotation(JPA.EMBEDDABLE);
+ assertTrue(typeResource.mappingAnnotation() instanceof Embeddable);
+
+ assertSourceDoesNotContain("@Entity");
+ assertSourceContains("@Table");
+ }
+
+ public void testAddJavaTypeAnnotation() throws Exception {
+ IType testType = createTestEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ assertSourceDoesNotContain("@Table");
+ typeResource.addAnnotation(JPA.TABLE);
+
+ assertSourceContains("@Table");
+ }
+
+ public void testRemoveJavaTypeAnnotation() throws Exception {
+ IType testType = createTestEntityWithTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ assertSourceContains("@Table");
+ typeResource.removeAnnotation(JPA.TABLE);
+ assertSourceDoesNotContain("@Table");
+ }
+
+
+ //update source code to change from @Entity to @Embeddable and make sure @Table is not removed
+ public void testChangeTypeMappingInSource() throws Exception {
+ IType jdtType = createTestEntityWithTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ testType().removeAnnotation(((EntityImpl) typeResource.mappingAnnotation()).getDeclarationAnnotationAdapter());
+
+ this.createAnnotationAndMembers("Embeddable", "String name();");
+ jdtType.getCompilationUnit().createImport("javax.persistence.Embeddable", null, new NullProgressMonitor());
+
+ testType().newMarkerAnnotation(EmbeddableImpl.DECLARATION_ANNOTATION_ADAPTER);
+
+ typeResource.updateFromJava(JDTTools.buildASTRoot(jdtType));
+
+
+ assertNotNull(typeResource.annotation(JPA.TABLE));
+ assertNull(typeResource.mappingAnnotation(JPA.ENTITY));
+ assertNotNull(typeResource.mappingAnnotation(JPA.EMBEDDABLE));
+ assertSourceContains("@Table");
+ }
+
+ public void testJavaTypeAnnotationsNestable() throws Exception {
+ IType jdtType = createTestEntityWithSecondaryTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ assertEquals(1, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
+
+ SecondaryTable secondaryTableResource = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
+
+ assertEquals("FOO", secondaryTableResource.getName());
+ }
+
+ public void testJavaTypeAnnotationsNoNestable() throws Exception {
+ IType jdtType = createTestEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ assertEquals(0, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
+ }
+
+ public void testJavaTypeAnnotationsContainerNoNestable() throws Exception {
+ IType jdtType = createTestEntityWithEmptySecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ assertEquals(0, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
+ }
+
+ public void testJavaTypeAnnotationsNestableAndContainer() throws Exception {
+ IType jdtType = createTestEntityWithSecondaryTableAndSecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLE));
+ assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLES));
+ assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
+
+ SecondaryTable secondaryTableResource = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
+ assertEquals("BAR", secondaryTableResource.getName());
+ }
+
+ // @Entity -->> @Entity
+ // @SecondaryTable(name="FOO")
+ public void testAddJavaTypeAnnotationNestableContainer() throws Exception {
+ IType jdtType = createTestEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ SecondaryTable secondaryTableResource = (SecondaryTable) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ secondaryTableResource.setName("FOO");
+ assertSourceContains("@SecondaryTable(name=\"FOO\")");
+ }
+
+ // @Entity -->> @Entity
+ // @SecondaryTable(name="FOO") @SecondaryTables({@SecondaryTable(name="FOO"), @SecondaryTable(name="BAR")})
+ public void testAddJavaTypeAnnotationNestableContainer2() throws Exception {
+ IType jdtType = createTestEntityWithSecondaryTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ SecondaryTable secondaryTableResource = (SecondaryTable) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ secondaryTableResource.setName("BAR");
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\"),@SecondaryTable(name=\"BAR\")})");
+
+ assertNull(typeResource.annotation(JPA.SECONDARY_TABLE));
+ assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLES));
+ assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
+ }
+
+ // @Entity
+ // @SecondaryTables(@SecondaryTable(name="FOO"))
+ // ||
+ // \/
+ // @Entity
+ // @SecondaryTables({@SecondaryTable(name="FOO"), @SecondaryTable(name="BAR")})
+ public void testAddJavaTypeAnnotationNestableContainer3() throws Exception {
+ IType jdtType = createTestEntityWithSecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ SecondaryTable secondaryTableResource = (SecondaryTable) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ secondaryTableResource.setName("BAR");
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\"),@SecondaryTable(name=\"BAR\")})");
+
+ assertNull(typeResource.annotation(JPA.SECONDARY_TABLE));
+ assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLES));
+ assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
+ }
+
+ public void testAddJavaTypeAnnotationNestableContainer5() throws Exception {
+ IType jdtType = createTestEntityWithSecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ SecondaryTable secondaryTableResource = (SecondaryTable) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ secondaryTableResource.setName("BAR");
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"BAR\"),@SecondaryTable(name=\"FOO\")})");
+
+ assertNull(typeResource.annotation(JPA.SECONDARY_TABLE));
+ assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLES));
+ assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
+ }
+
+ public void testAddJavaTypeAnnotationNestableContainer6() throws Exception {
+ IType jdtType = createTestEntityWithSecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ SecondaryTable secondaryTableResource = (SecondaryTable) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ secondaryTableResource.setName("BAR");
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"BAR\"),@SecondaryTable(name=\"FOO\")})");
+
+ assertNull(typeResource.annotation(JPA.SECONDARY_TABLE));
+ assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLES));
+ assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
+
+ secondaryTableResource = (SecondaryTable) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ secondaryTableResource.setName("BAZ");
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"BAZ\"),@SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"FOO\")})");
+
+ assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
+ }
+
+ // @Entity
+ // @SecondaryTable(name=\"FOO\")
+ // @SecondaryTables({@SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\")})
+ // ||
+ // \/
+ // @Entity
+ // @SecondaryTable(name=\"FOO\")
+ // @SecondaryTables({@SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\"), @SecondaryTable(name=\"BOO\")})
+ public void testAddJavaTypeAnnotationNestableContainer4() throws Exception {
+ IType jdtType = createTestEntityWithSecondaryTableAndSecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLE));
+ assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLES));
+ assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
+
+ SecondaryTable secondaryTableResource = (SecondaryTable) typeResource.addAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\"), @SecondaryTable})");
+ secondaryTableResource.setName("BOO");
+
+ assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLE));
+ assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLES));
+ assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
+
+ Iterator<JavaResource> secondaryTableAnnotations = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ secondaryTableResource = (SecondaryTable) secondaryTableAnnotations.next();
+ assertEquals("BAR", secondaryTableResource.getName());
+ secondaryTableResource = (SecondaryTable) secondaryTableAnnotations.next();
+ assertEquals("BAZ", secondaryTableResource.getName());
+ secondaryTableResource = (SecondaryTable) secondaryTableAnnotations.next();
+ assertEquals("BOO", secondaryTableResource.getName());
+
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\"), @SecondaryTable(name=\"BOO\")})");
+ }
+
+ //@Entity
+ //@SecondaryTable(name="FOO")
+ public void testRemoveJavaTypeAnnotationNestableContainer() throws Exception {
+ IType jdtType = createTestEntityWithSecondaryTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+
+ assertSourceDoesNotContain("@SecondaryTable");
+ }
+
+
+ //@Entity
+ //@SecondaryTables(@SecondaryTable(name="FOO"))
+ public void testRemoveJavaTypeAnnotationNestableContainer2() throws Exception {
+ IType jdtType = createTestEntityWithSecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+
+ assertSourceDoesNotContain("@SecondaryTable");
+ assertSourceDoesNotContain("@SecondaryTables");
+ }
+
+ public void testRemoveJavaTypeAnnotationIndex() throws Exception {
+ IType jdtType = createTestEntityWith2SecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+
+ assertSourceDoesNotContain("@SecondaryTable(name=\"FOO\"");
+ assertSourceContains("@SecondaryTable(name=\"BAR\"");
+ assertSourceDoesNotContain("@SecondaryTables");
+ }
+
+ public void testRemoveJavaTypeAnnotationIndex2() throws Exception {
+ IType jdtType = createTestEntityWith2SecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ SecondaryTable newAnnotation = (SecondaryTable)typeResource.addAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ newAnnotation.setName("BAZ");
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\"), @SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\")})");
+
+ typeResource.removeAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\"), @SecondaryTable(name=\"BAZ\")})");
+ }
+
+ public void testMoveJavaTypeAnnotation() throws Exception {
+ IType jdtType = createTestEntityWith2SecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ SecondaryTable newAnnotation = (SecondaryTable)typeResource.addAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ newAnnotation.setName("BAZ");
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\"), @SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\")})");
+
+ typeResource.move(0, 2, JPA.SECONDARY_TABLES);
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"BAZ\"), @SecondaryTable(name=\"FOO\"), @SecondaryTable(name=\"BAR\")})");
+ }
+
+ public void testMoveJavaTypeAnnotation2() throws Exception {
+ IType jdtType = createTestEntityWith2SecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ SecondaryTable newAnnotation = (SecondaryTable)typeResource.addAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ newAnnotation.setName("BAZ");
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\"), @SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\")})");
+
+ typeResource.move(2, 0, JPA.SECONDARY_TABLES);
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\"), @SecondaryTable(name=\"FOO\")})");
+ }
+
+ public void testNestedTypes() throws Exception {
+ IType jdtType = createTestEntityWithMemberTypes();
+ JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType);
+
+ assertEquals("only persistable types should be returned by nestedTypes()", 1, CollectionTools.size(persistentType.nestedTypes()));
+
+ List<JavaPersistentTypeResource> nestedTypes = (List<JavaPersistentTypeResource>) ClassTools.fieldValue(persistentType, "nestedTypes");
+
+ assertEquals(4, CollectionTools.size(nestedTypes));
+
+ }
+
+ public void testDuplicateEntityAnnotations() throws Exception {
+ IType jdtType = createTestEntityDuplicates();
+ JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType);
+
+ Entity javaTypeMappingAnnotation = (Entity) persistentType.mappingAnnotation(JPA.ENTITY);
+ assertEquals("FirstEntity", javaTypeMappingAnnotation.getName());
+
+ assertEquals(1, CollectionTools.size(persistentType.mappingAnnotations()));
+
+ javaTypeMappingAnnotation = (Entity) persistentType.mappingAnnotation();
+ assertEquals("FirstEntity", javaTypeMappingAnnotation.getName());
+
+ }
+
+
+ public void testAttributes() throws Exception {
+
+ }
+
+ public void testFields() throws Exception {
+
+ }
+
+ public void testProperties() throws Exception {
+
+ }
+
+ public void testGetAccessNoAttributesAnnotated() throws Exception {
+ IType jdtType = createTestEntity();
+ JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType);
+
+ assertNull(persistentType.getAccess());
+ }
+
+ public void testGetAccessFieldsAnnotated() throws Exception {
+ IType jdtType = createTestEntityAnnotatedField();
+ JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType);
+
+ assertEquals(AccessType.FIELD, persistentType.getAccess());
+ }
+
+ public void testGetAccessMethodsAnnotated() throws Exception {
+ IType jdtType = createTestEntityAnnotatedMethod();
+ JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType);
+
+ assertEquals(AccessType.PROPERTY, persistentType.getAccess());
+ }
+
+ public void testGetAccessFieldsAndMethodsAnnotated() throws Exception {
+ IType jdtType = createTestEntityAnnotatedFieldAndMethod();
+ JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType);
+
+ assertEquals(AccessType.FIELD, persistentType.getAccess());
+ }
+
+ public void testGetAccessNonPersistableMethodAnnotated() throws Exception {
+ IType jdtType = createTestEntityAnnotatedNonPersistableMethod();
+ JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType);
+
+ assertNull(persistentType.getAccess());
+ }
+
+ public void testGetAccessPersistableMethodAndNonPersistableFieldAnnotated() throws Exception {
+ IType jdtType = createTestEntityAnnotatedPersistableMethodNonPersistableField();
+ JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType);
+
+ assertEquals(AccessType.PROPERTY, persistentType.getAccess());
+ }
+
+ public void testGetAccessNoPersistableFieldsAnnotated() throws Exception {
+ IType jdtType = createTestEntityNoPersistableFields();
+ JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType);
+
+ assertEquals(AccessType.PROPERTY, persistentType.getAccess());
+ }
+
+ //TODO more tests here with superclasses other than Object.
+ //1. Test where the superclass does not resolve
+ //2. Test a superclass that does resolve
+ //3. What about a superclass that is a class file in a jar??
+ //4.
+ public void testGetSuperclassQualifiedName() throws Exception {
+ IType jdtType = createTestEntity();
+ JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType);
+
+ assertEquals("java.lang.Object", persistentType.getSuperClassQualifiedName());
+
+ }
+
+ //more detailed tests in JPTToolsTests
+ public void testIsPersistable() throws Exception {
+ IType jdtType = createTestEntity();
+ JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType);
+
+ assertTrue(persistentType.isPersistable());
+ }
+
+ public void testAnnotatedMemberType() throws Exception {
+ IType testType = this.createTestEntityWithMemberEmbeddable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ assertNotNull(typeResource.mappingAnnotation(JPA.ENTITY));
+ assertNull(typeResource.mappingAnnotation(JPA.EMBEDDABLE));
+
+ JavaPersistentTypeResource nestedType = typeResource.nestedTypes().next();
+ assertNull(nestedType.mappingAnnotation(JPA.ENTITY));
+ assertNotNull(nestedType.mappingAnnotation(JPA.EMBEDDABLE));
+ }
+
+ public void testInvalidAnnotations() throws Exception {
+ IType testType = this.createTestInvalidAnnotations();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ assertEquals(0, CollectionTools.size(typeResource.mappingAnnotations()));
+ assertEquals(0, CollectionTools.size(typeResource.annotations()));
+
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ assertEquals(0, CollectionTools.size(attributeResource.mappingAnnotations()));
+ assertEquals(0, CollectionTools.size(attributeResource.annotations()));
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourceModelTestCase.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourceModelTestCase.java
new file mode 100644
index 0000000000..c321e33a64
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourceModelTestCase.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.tests.internal.resource.java;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResourceProxy;
+import org.eclipse.core.resources.IResourceProxyVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ElementChangedEvent;
+import org.eclipse.jdt.core.IElementChangedListener;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jpt.core.internal.IContextModel;
+import org.eclipse.jpt.core.internal.IJpaProject;
+import org.eclipse.jpt.core.internal.JpaProject;
+import org.eclipse.jpt.core.internal.JptCorePlugin;
+import org.eclipse.jpt.core.internal.SimpleJpaProjectConfig;
+import org.eclipse.jpt.core.internal.jdtutility.NullAnnotationEditFormatter;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResourceModel;
+import org.eclipse.jpt.core.tests.internal.jdtutility.AnnotationTestCase;
+import org.eclipse.jpt.utility.internal.StringTools;
+
+public class JavaResourceModelTestCase extends AnnotationTestCase
+{
+ private JavaElementChangeListener javaElementChangeListener;
+ protected JavaResourceModel javaResourceModel;
+
+
+ public JavaResourceModelTestCase(String name) {
+ super(name);
+ }
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.javaElementChangeListener = new JavaElementChangeListener();
+ JavaCore.addElementChangedListener(this.javaElementChangeListener);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ JavaCore.removeElementChangedListener(this.javaElementChangeListener);
+ this.javaElementChangeListener = null;
+ }
+
+ /**
+ * Forward the Java element change event back to the JPA model manager.
+ */
+ private class JavaElementChangeListener implements IElementChangedListener {
+ JavaElementChangeListener() {
+ super();
+ }
+ public void elementChanged(ElementChangedEvent event) {
+ if (JavaResourceModelTestCase.this.javaResourceModel != null) {
+ JavaResourceModelTestCase.this.javaResourceModel.handleJavaElementChangedEvent(event);
+ }
+ }
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+ }
+
+ protected IType createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception {
+ return this.javaProject.createType("javax.persistence", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }");
+ }
+
+ protected IType createEnumAndMembers(String enumName, String enumBody) throws Exception {
+ return this.javaProject.createType("javax.persistence", enumName + ".java", "public enum " + enumName + " { " + enumBody + " }");
+ }
+
+ //build up a dummy JpaProject that does not have JpaFiles in it and does not update from java changes
+ protected IJpaProject buildJpaProject() throws CoreException {
+ return new TestJpaProject(this.buildJpaProjectConfig(this.javaProject.getProject()));
+ }
+
+ protected class TestJpaProject extends JpaProject {
+ protected TestJpaProject(IJpaProject.Config config) throws CoreException {
+ super(config);
+ }
+
+ @Override
+ protected IResourceProxyVisitor buildInitialResourceProxyVisitor() {
+ return new IResourceProxyVisitor() {
+ public boolean visit(IResourceProxy proxy) throws CoreException {
+ return false; // ignore all the files in the Eclipse project
+ }
+ };
+ }
+
+ @Override
+ protected IContextModel buildContextModel() {
+ return null; // no context model
+ }
+
+ @Override
+ public void update() {
+ // ignore all updates, since there is no context model
+ }
+
+ }
+
+ private IJpaProject.Config buildJpaProjectConfig(IProject project) {
+ SimpleJpaProjectConfig config = new SimpleJpaProjectConfig();
+ config.setProject(project);
+ config.setJpaPlatform(JptCorePlugin.jpaPlatform(project));
+ config.setConnectionProfileName(JptCorePlugin.connectionProfileName(project));
+ config.setDiscoverAnnotatedClasses(JptCorePlugin.discoverAnnotatedClasses(project));
+ return config;
+ }
+
+ protected JavaPersistentTypeResource buildJavaTypeResource(IType testType)
+ throws CoreException {
+ this.javaResourceModel = buildJavaResourceModel(testType);
+ this.javaResourceModel.resolveTypes();
+ return this.javaResourceModel.resource().getPersistentType();
+ }
+
+ protected JavaResourceModel buildJavaResourceModel(IType testType) throws CoreException {
+ if (this.javaResourceModel != null) {
+ throw new IllegalStateException();
+ }
+ IFile file = (IFile) testType.getResource();
+ IJpaProject jpaProject = buildJpaProject();
+ return new JavaResourceModel(
+ file,
+ jpaProject.jpaPlatform().annotationProvider(),
+ MODIFY_SHARED_DOCUMENT_COMMAND_EXECUTOR_PROVIDER,
+ NullAnnotationEditFormatter.instance());
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnTests.java
new file mode 100644
index 0000000000..08ff3bcaeb
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnTests.java
@@ -0,0 +1,369 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumn;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JoinColumnTests extends JavaResourceModelTestCase {
+
+ private static final String COLUMN_NAME = "MY_COLUMN";
+ private static final String COLUMN_TABLE = "MY_TABLE";
+ private static final String COLUMN_COLUMN_DEFINITION = "COLUMN_DEFINITION";
+ private static final String COLUMN_REFERENCED_COLUMN_NAME = "MY_REF_COLUMN_NAME";
+
+ public JoinColumnTests(String name) {
+ super(name);
+ }
+
+ private void createJoinColumnAnnotation() throws Exception {
+ this.createAnnotationAndMembers("JoinColumn",
+ "String name() default \"\"; " +
+ "String referencedColumnName() default \"\"; " +
+ "boolean unique() default false; " +
+ "boolean nullable() default true; " +
+ "boolean insertable() default true; " +
+ "boolean updatable() default true; " +
+ "String columnDefinition() default \"\"; " +
+ "String table() default \"\"; ");
+ }
+
+ private IType createTestJoinColumn() throws Exception {
+ createJoinColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinColumn");
+ }
+ });
+ }
+
+ private IType createTestJoinColumnWithName() throws Exception {
+ createJoinColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinColumn(name=\"" + COLUMN_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestJoinColumnWithTable() throws Exception {
+ createJoinColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinColumn(table=\"" + COLUMN_TABLE + "\")");
+ }
+ });
+ }
+
+ private IType createTestJoinColumnWithReferencedColumnName() throws Exception {
+ createJoinColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinColumn(referencedColumnName=\"" + COLUMN_REFERENCED_COLUMN_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestJoinColumnWithColumnDefinition() throws Exception {
+ createJoinColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinColumn(columnDefinition=\"" + COLUMN_COLUMN_DEFINITION + "\")");
+ }
+ });
+ }
+
+ private IType createTestJoinColumnWithBooleanElement(final String booleanElement) throws Exception {
+ createJoinColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinColumn(" + booleanElement + "=true)");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestJoinColumnWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+ assertNotNull(column);
+ assertEquals(COLUMN_NAME, column.getName());
+ }
+
+ public void testGetNull() throws Exception {
+ IType testType = this.createTestJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+ assertNotNull(column);
+ assertNull(column.getName());
+ assertNull(column.getNullable());
+ assertNull(column.getInsertable());
+ assertNull(column.getUnique());
+ assertNull(column.getUpdatable());
+ assertNull(column.getTable());
+ assertNull(column.getReferencedColumnName());
+ assertNull(column.getColumnDefinition());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getName());
+
+ column.setName("Foo");
+ assertEquals("Foo", column.getName());
+
+ assertSourceContains("@JoinColumn(name=\"Foo\")");
+ }
+
+ public void testSetNameNull() throws Exception {
+ IType testType = this.createTestJoinColumnWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+
+ assertEquals(COLUMN_NAME, column.getName());
+
+ column.setName(null);
+ assertNull(column.getName());
+
+ assertSourceDoesNotContain("@JoinColumn");
+ }
+
+ public void testGetTable() throws Exception {
+ IType testType = this.createTestJoinColumnWithTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+ assertEquals(COLUMN_TABLE, column.getTable());
+ }
+
+ public void testSetTable() throws Exception {
+ IType testType = this.createTestJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getTable());
+
+ column.setTable("Foo");
+ assertEquals("Foo", column.getTable());
+
+ assertSourceContains("@JoinColumn(table=\"Foo\")");
+
+
+ column.setTable(null);
+ assertSourceDoesNotContain("@JoinColumn");
+ }
+
+ public void testGetReferencedColumnName() throws Exception {
+ IType testType = this.createTestJoinColumnWithReferencedColumnName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+ assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName());
+ }
+
+ public void testSetReferencedColumnName() throws Exception {
+ IType testType = this.createTestJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getReferencedColumnName());
+
+ column.setReferencedColumnName("Foo");
+ assertEquals("Foo", column.getReferencedColumnName());
+
+ assertSourceContains("@JoinColumn(referencedColumnName=\"Foo\")");
+
+
+ column.setReferencedColumnName(null);
+ assertSourceDoesNotContain("@JoinColumn");
+ }
+
+ public void testGetColumnDefinition() throws Exception {
+ IType testType = this.createTestJoinColumnWithColumnDefinition();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+ assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition());
+ }
+
+ public void testSetColumnDefinition() throws Exception {
+ IType testType = this.createTestJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getColumnDefinition());
+
+ column.setColumnDefinition("Foo");
+ assertEquals("Foo", column.getColumnDefinition());
+
+ assertSourceContains("@JoinColumn(columnDefinition=\"Foo\")");
+
+
+ column.setColumnDefinition(null);
+ assertSourceDoesNotContain("@JoinColumn");
+ }
+
+ public void testGetUnique() throws Exception {
+ IType testType = this.createTestJoinColumnWithBooleanElement("unique");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+
+ assertTrue(column.getUnique());
+ }
+
+ public void testSetUnique() throws Exception {
+ IType testType = this.createTestJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getUnique());
+
+ column.setUnique(false);
+ assertFalse(column.getUnique());
+
+ assertSourceContains("@JoinColumn(unique=false)");
+
+ column.setUnique(null);
+ assertSourceDoesNotContain("@JoinColumn");
+ }
+
+ public void testGetNullable() throws Exception {
+ IType testType = this.createTestJoinColumnWithBooleanElement("nullable");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+
+ assertTrue(column.getNullable());
+ }
+
+ public void testSetNullable() throws Exception {
+ IType testType = this.createTestJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getNullable());
+
+ column.setNullable(false);
+ assertFalse(column.getNullable());
+
+ assertSourceContains("@JoinColumn(nullable=false)");
+
+ column.setNullable(null);
+ assertSourceDoesNotContain("@JoinColumn");
+ }
+
+ public void testGetInsertable() throws Exception {
+ IType testType = this.createTestJoinColumnWithBooleanElement("insertable");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+
+ assertTrue(column.getInsertable());
+ }
+
+ public void testSetInsertable() throws Exception {
+ IType testType = this.createTestJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getInsertable());
+
+ column.setInsertable(false);
+ assertFalse(column.getInsertable());
+
+ assertSourceContains("@JoinColumn(insertable=false)");
+
+ column.setInsertable(null);
+ assertSourceDoesNotContain("@JoinColumn");
+ }
+
+ public void testGetUpdatable() throws Exception {
+ IType testType = this.createTestJoinColumnWithBooleanElement("updatable");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+
+ assertTrue(column.getUpdatable());
+ }
+
+ public void testSetUpdatable() throws Exception {
+ IType testType = this.createTestJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getUpdatable());
+
+ column.setUpdatable(false);
+ assertFalse(column.getUpdatable());
+
+ assertSourceContains("@JoinColumn(updatable=false)");
+
+ column.setUpdatable(null);
+ assertSourceDoesNotContain("@JoinColumn");
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnsTests.java
new file mode 100644
index 0000000000..50771617a2
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnsTests.java
@@ -0,0 +1,444 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumn;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JoinColumnsTests extends JavaResourceModelTestCase {
+
+ private static final String COLUMN_NAME = "MY_COLUMN";
+ private static final String COLUMN_TABLE = "MY_TABLE";
+ private static final String COLUMN_COLUMN_DEFINITION = "COLUMN_DEFINITION";
+ private static final String COLUMN_REFERENCED_COLUMN_NAME = "MY_REF_COLUMN_NAME";
+
+ public JoinColumnsTests(String name) {
+ super(name);
+ }
+
+ private void createJoinColumnAnnotation() throws Exception {
+ this.createAnnotationAndMembers("JoinColumn",
+ "String name() default \"\"; " +
+ "String referencedColumnName() default \"\"; " +
+ "boolean unique() default false; " +
+ "boolean nullable() default true; " +
+ "boolean insertable() default true; " +
+ "boolean updatable() default true; " +
+ "String columnDefinition() default \"\"; " +
+ "String table() default \"\"; ");
+ }
+
+ private void createJoinColumnsAnnotation() throws Exception {
+ createJoinColumnAnnotation();
+ this.createAnnotationAndMembers("JoinColumns",
+ "JoinColumn[] value();");
+ }
+
+ private IType createTestJoinColumns() throws Exception {
+ createJoinColumnsAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinColumns(@JoinColumn)");
+ }
+ });
+ }
+
+ private IType createTestJoinColumnWithName() throws Exception {
+ createJoinColumnsAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinColumns(@JoinColumn(name=\"" + COLUMN_NAME + "\"))");
+ }
+ });
+ }
+
+ private IType createTestJoinColumnWithTable() throws Exception {
+ createJoinColumnsAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinColumns(@JoinColumn(table=\"" + COLUMN_TABLE + "\"))");
+ }
+ });
+ }
+
+ private IType createTestJoinColumnWithReferencedColumnName() throws Exception {
+ createJoinColumnsAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinColumns(@JoinColumn(referencedColumnName=\"" + COLUMN_REFERENCED_COLUMN_NAME + "\"))");
+ }
+ });
+ }
+
+ private IType createTestJoinColumnWithColumnDefinition() throws Exception {
+ createJoinColumnsAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinColumns(@JoinColumn(columnDefinition=\"" + COLUMN_COLUMN_DEFINITION + "\"))");
+ }
+ });
+ }
+
+ private IType createTestJoinColumnWithBooleanElement(final String booleanElement) throws Exception {
+ createJoinColumnsAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinColumns(@JoinColumn(" + booleanElement + "=true))");
+ }
+ });
+ }
+
+ private IType createTestJoinColumn() throws Exception {
+ createJoinColumnsAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\")");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestJoinColumnWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+ assertNotNull(column);
+ assertEquals(COLUMN_NAME, column.getName());
+ }
+
+ public void testGetNull() throws Exception {
+ IType testType = this.createTestJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+ assertNotNull(column);
+ assertNull(column.getName());
+ assertNull(column.getNullable());
+ assertNull(column.getInsertable());
+ assertNull(column.getUnique());
+ assertNull(column.getUpdatable());
+ assertNull(column.getTable());
+ assertNull(column.getColumnDefinition());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+
+ assertNotNull(column);
+ assertNull(column.getName());
+
+ column.setName("Foo");
+ assertEquals("Foo", column.getName());
+
+ assertSourceContains("@JoinColumns(@JoinColumn(name=\"Foo\"))");
+ }
+
+ public void testSetNameNull() throws Exception {
+ IType testType = this.createTestJoinColumnWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+
+ assertEquals(COLUMN_NAME, column.getName());
+
+ column.setName(null);
+ assertNull(column.getName());
+
+ assertSourceDoesNotContain("@JoinColumn");
+ }
+
+ public void testGetTable() throws Exception {
+ IType testType = this.createTestJoinColumnWithTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+ assertEquals(COLUMN_TABLE, column.getTable());
+ }
+
+ public void testSetTable() throws Exception {
+ IType testType = this.createTestJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+
+ assertNotNull(column);
+ assertNull(column.getTable());
+
+ column.setTable("Foo");
+ assertEquals("Foo", column.getTable());
+
+ assertSourceContains("@JoinColumns(@JoinColumn(table=\"Foo\"))");
+
+
+ column.setTable(null);
+ assertSourceDoesNotContain("@JoinColumn");
+ }
+
+ public void testGetReferencedColumnName() throws Exception {
+ IType testType = this.createTestJoinColumnWithReferencedColumnName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+ assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName());
+ }
+
+ public void testSetReferencedColumnName() throws Exception {
+ IType testType = this.createTestJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+
+ assertNotNull(column);
+ assertNull(column.getReferencedColumnName());
+
+ column.setReferencedColumnName("Foo");
+ assertEquals("Foo", column.getReferencedColumnName());
+
+ assertSourceContains("@JoinColumns(@JoinColumn(referencedColumnName=\"Foo\"))");
+
+
+ column.setReferencedColumnName(null);
+ assertSourceDoesNotContain("@JoinColumn");
+ }
+
+ public void testGetColumnDefinition() throws Exception {
+ IType testType = this.createTestJoinColumnWithColumnDefinition();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+ assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition());
+ }
+
+ public void testSetColumnDefinition() throws Exception {
+ IType testType = this.createTestJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+
+ assertNotNull(column);
+ assertNull(column.getColumnDefinition());
+
+ column.setColumnDefinition("Foo");
+ assertEquals("Foo", column.getColumnDefinition());
+
+ assertSourceContains("@JoinColumns(@JoinColumn(columnDefinition=\"Foo\"))");
+
+
+ column.setColumnDefinition(null);
+ assertSourceDoesNotContain("@JoinColumn");
+ }
+
+ public void testGetUnique() throws Exception {
+ IType testType = this.createTestJoinColumnWithBooleanElement("unique");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+
+ assertTrue(column.getUnique());
+ }
+
+ public void testSetUnique() throws Exception {
+ IType testType = this.createTestJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+
+ assertNotNull(column);
+ assertNull(column.getUnique());
+
+ column.setUnique(false);
+ assertFalse(column.getUnique());
+
+ assertSourceContains("@JoinColumns(@JoinColumn(unique=false))");
+
+ column.setUnique(null);
+ assertSourceDoesNotContain("@JoinColumn");
+ }
+
+ public void testGetNullable() throws Exception {
+ IType testType = this.createTestJoinColumnWithBooleanElement("nullable");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+
+ assertTrue(column.getNullable());
+ }
+
+ public void testSetNullable() throws Exception {
+ IType testType = this.createTestJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+
+ assertNotNull(column);
+ assertNull(column.getNullable());
+
+ column.setNullable(false);
+ assertFalse(column.getNullable());
+
+ assertSourceContains("@JoinColumns(@JoinColumn(nullable=false))");
+
+ column.setNullable(null);
+ assertSourceDoesNotContain("@JoinColumn");
+ }
+
+ public void testGetInsertable() throws Exception {
+ IType testType = this.createTestJoinColumnWithBooleanElement("insertable");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+
+ assertTrue(column.getInsertable());
+ }
+
+ public void testSetInsertable() throws Exception {
+ IType testType = this.createTestJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+
+ assertNotNull(column);
+ assertNull(column.getInsertable());
+
+ column.setInsertable(false);
+ assertFalse(column.getInsertable());
+
+ assertSourceContains("@JoinColumns(@JoinColumn(insertable=false))");
+
+ column.setInsertable(null);
+ assertSourceDoesNotContain("@JoinColumn");
+ }
+
+ public void testGetUpdatable() throws Exception {
+ IType testType = this.createTestJoinColumnWithBooleanElement("updatable");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+
+ assertTrue(column.getUpdatable());
+ }
+
+ public void testSetUpdatable() throws Exception {
+ IType testType = this.createTestJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next();
+
+ assertNotNull(column);
+ assertNull(column.getUpdatable());
+
+ column.setUpdatable(false);
+ assertFalse(column.getUpdatable());
+
+ assertSourceContains("@JoinColumns(@JoinColumn(updatable=false))");
+
+ column.setUpdatable(null);
+ assertSourceDoesNotContain("@JoinColumn");
+ assertSourceDoesNotContain("@JoinColumns");
+ }
+
+
+ public void testAddJoinColumnCopyExisting() throws Exception {
+ IType jdtType = createTestJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinColumn joinColumn = (JoinColumn) attributeResource.addAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ joinColumn.setName("FOO");
+ assertSourceContains("@JoinColumns({@JoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\"),@JoinColumn(name=\"FOO\")})");
+
+ assertNull(attributeResource.annotation(JPA.JOIN_COLUMN));
+ assertNotNull(attributeResource.annotation(JPA.JOIN_COLUMNS));
+ assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS)));
+ }
+
+ public void testAddJoinColumnToBeginningOfList() throws Exception {
+ IType jdtType = createTestJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinColumn joinColumn = (JoinColumn) attributeResource.addAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ joinColumn.setName("FOO");
+ assertSourceContains("@JoinColumns({@JoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\"),@JoinColumn(name=\"FOO\")})");
+
+ joinColumn = (JoinColumn) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ joinColumn.setName("BAZ");
+ assertSourceContains("@JoinColumns({@JoinColumn(name=\"BAZ\"),@JoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\"), @JoinColumn(name=\"FOO\")})");
+
+ Iterator<JavaResource> joinColumns = attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ assertEquals("BAZ", ((JoinColumn) joinColumns.next()).getName());
+ assertEquals("BAR", ((JoinColumn) joinColumns.next()).getName());
+ assertEquals("FOO", ((JoinColumn) joinColumns.next()).getName());
+
+ assertNull(attributeResource.annotation(JPA.JOIN_COLUMN));
+ assertNotNull(attributeResource.annotation(JPA.JOIN_COLUMNS));
+ assertEquals(3, CollectionTools.size(attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS)));
+ }
+
+
+ public void testRemoveJoinColumnCopyExisting() throws Exception {
+ IType jdtType = createTestJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinColumn joinColumn = (JoinColumn) attributeResource.addAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ joinColumn.setName("FOO");
+ assertSourceContains("@JoinColumns({@JoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\"),@JoinColumn(name=\"FOO\")})");
+
+ attributeResource.removeAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS);
+ assertSourceContains("@JoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\")");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinTableTests.java
new file mode 100644
index 0000000000..f7be017dad
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinTableTests.java
@@ -0,0 +1,711 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.JoinTable;
+import org.eclipse.jpt.core.internal.resource.java.UniqueConstraint;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JoinTableTests extends JavaResourceModelTestCase {
+
+ private static final String TABLE_NAME = "MY_TABLE";
+ private static final String SCHEMA_NAME = "MY_SCHEMA";
+ private static final String CATALOG_NAME = "MY_CATALOG";
+
+ public JoinTableTests(String name) {
+ super(name);
+ }
+
+ private void createJoinColumnAnnotation() throws Exception {
+ this.createAnnotationAndMembers("JoinColumn", "String name() default \"\";" +
+ "String referencedColumnName() default \"\";" +
+ "boolean unique() default false;" +
+ "boolean nullable() default true;" +
+ "boolean insertable() default true;" +
+ "boolean updatable() default true;" +
+ "String columnDefinition() default \"\";" +
+ "String table() default \"\";");
+
+ }
+
+ private void createUniqueConstraintAnnotation() throws Exception {
+ this.createAnnotationAndMembers("UniqueConstraint", "String[] columnNames();");
+ }
+
+ private void createJoinTableAnnotation() throws Exception {
+ createJoinColumnAnnotation();
+ createUniqueConstraintAnnotation();
+ this.createAnnotationAndMembers("JoinTable", "String name() default \"\"; String catalog() default \"\"; String schema() default \"\";JoinColumn[] joinColumns() default {}; JoinColumn[] inverseJoinColumns() default {}; UniqueConstraint[] uniqueConstraints() default {};");
+ }
+
+ private IType createTestJoinTable() throws Exception {
+ createJoinTableAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_TABLE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinTable");
+ }
+ });
+ }
+
+ private IType createTestJoinTableWithName() throws Exception {
+ createJoinTableAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_TABLE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinTable(name=\"" + TABLE_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestJoinTableWithSchema() throws Exception {
+ createJoinTableAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_TABLE);
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinTable(schema=\"" + SCHEMA_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestJoinTableWithCatalog() throws Exception {
+ createJoinTableAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_TABLE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinTable(catalog=\"" + CATALOG_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestJoinTableWithUniqueConstraints() throws Exception {
+ createJoinTableAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_TABLE, JPA.UNIQUE_CONSTRAINT);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinTable(uniqueConstraints={@UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"FOO\"}), @UniqueConstraint(columnNames={\"BAZ\"})})");
+ }
+ });
+ }
+
+ private IType createTestJoinTableWithJoinColumns() throws Exception {
+ createJoinTableAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_TABLE, JPA.JOIN_COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinTable(joinColumns={@JoinColumn(name=\"BAR\"), @JoinColumn})");
+ }
+ });
+ }
+
+ private IType createTestJoinTableWithInverseJoinColumns() throws Exception {
+ createJoinTableAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.JOIN_TABLE, JPA.JOIN_COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@JoinTable(inverseJoinColumns={@JoinColumn(name=\"BAR\"), @JoinColumn})");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestJoinTableWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ assertNotNull(table);
+ assertEquals(TABLE_NAME, table.getName());
+ }
+
+ public void testGetNull() throws Exception {
+ IType testType = this.createTestJoinTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ assertNotNull(table);
+ assertNull(table.getName());
+ assertNull(table.getCatalog());
+ assertNull(table.getSchema());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestJoinTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ assertNotNull(table);
+ assertNull(table.getName());
+
+ table.setName("Foo");
+ assertEquals("Foo", table.getName());
+
+ assertSourceContains("@JoinTable(name=\"Foo\")");
+ }
+
+ public void testSetNameNull() throws Exception {
+ IType testType = this.createTestJoinTableWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ assertEquals(TABLE_NAME, table.getName());
+
+ table.setName(null);
+ assertNull(table.getName());
+
+ assertSourceDoesNotContain("@JoinTable");
+ }
+
+ public void testGetCatalog() throws Exception {
+ IType testType = this.createTestJoinTableWithCatalog();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ assertNotNull(table);
+ assertEquals(CATALOG_NAME, table.getCatalog());
+ }
+
+ public void testSetCatalog() throws Exception {
+ IType testType = this.createTestJoinTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ assertNotNull(table);
+ assertNull(table.getCatalog());
+
+ table.setCatalog("Foo");
+ assertEquals("Foo", table.getCatalog());
+
+ assertSourceContains("@JoinTable(catalog=\"Foo\")");
+ }
+
+ public void testSetCatalogNull() throws Exception {
+ IType testType = this.createTestJoinTableWithCatalog();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ assertEquals(CATALOG_NAME, table.getCatalog());
+
+ table.setCatalog(null);
+ assertNull(table.getCatalog());
+
+ assertSourceDoesNotContain("@JoinTable");
+ }
+
+ public void testGetSchema() throws Exception {
+ IType testType = this.createTestJoinTableWithSchema();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ assertNotNull(table);
+ assertEquals(SCHEMA_NAME, table.getSchema());
+ }
+
+ public void testSetSchema() throws Exception {
+ IType testType = this.createTestJoinTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ assertNotNull(table);
+ assertNull(table.getSchema());
+
+ table.setSchema("Foo");
+ assertEquals("Foo", table.getSchema());
+
+ assertSourceContains("@JoinTable(schema=\"Foo\")");
+ }
+
+ public void testSetSchemaNull() throws Exception {
+ IType testType = this.createTestJoinTableWithSchema();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ assertEquals(SCHEMA_NAME, table.getSchema());
+
+ table.setSchema(null);
+ assertNull(table.getSchema());
+
+ assertSourceDoesNotContain("@JoinTable");
+ }
+
+ public void testUniqueConstraints() throws Exception {
+ IType testType = this.createTestJoinTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+
+ ListIterator<UniqueConstraint> iterator = table.uniqueConstraints();
+
+ assertEquals(0, CollectionTools.size(iterator));
+ }
+
+ public void testUniqueConstraints2() throws Exception {
+ IType testType = this.createTestJoinTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+
+
+ table.addUniqueConstraint(0);
+ table.addUniqueConstraint(1);
+ table.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ ListIterator<UniqueConstraint> iterator = table.uniqueConstraints();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testUniqueConstraints3() throws Exception {
+ IType testType = this.createTestJoinTableWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+
+ ListIterator<UniqueConstraint> iterator = table.uniqueConstraints();
+
+ assertEquals(3, CollectionTools.size(iterator));
+ }
+
+ public void testAddUniqueConstraint() throws Exception {
+ IType testType = this.createTestJoinTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+
+ table.addUniqueConstraint(0).addColumnName("FOO");
+ table.addUniqueConstraint(1);
+ table.addUniqueConstraint(0).addColumnName("BAR");
+
+ assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next());
+ assertEquals("FOO", table.uniqueConstraintAt(1).columnNames().next());
+ assertEquals(0, table.uniqueConstraintAt(2).columnNamesSize());
+
+ assertSourceContains("@JoinTable(uniqueConstraints={@UniqueConstraint(columnNames=\"BAR\"),@UniqueConstraint(columnNames=\"FOO\"), @UniqueConstraint})");
+ }
+
+ public void testRemoveUniqueConstraint() throws Exception {
+ IType testType = this.createTestJoinTableWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next());
+ assertEquals("FOO", table.uniqueConstraintAt(1).columnNames().next());
+ assertEquals("BAZ", table.uniqueConstraintAt(2).columnNames().next());
+ assertEquals(3, table.uniqueConstraintsSize());
+
+ table.removeUniqueConstraint(1);
+ assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next());
+ assertEquals("BAZ", table.uniqueConstraintAt(1).columnNames().next());
+ assertEquals(2, table.uniqueConstraintsSize());
+ assertSourceContains("@JoinTable(uniqueConstraints={@UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"BAZ\"})})");
+
+ table.removeUniqueConstraint(0);
+ assertEquals("BAZ", table.uniqueConstraintAt(0).columnNames().next());
+ assertEquals(1, table.uniqueConstraintsSize());
+ assertSourceContains("@JoinTable(uniqueConstraints=@UniqueConstraint(columnNames={\"BAZ\"}))");
+
+ table.removeUniqueConstraint(0);
+ assertEquals(0, table.uniqueConstraintsSize());
+ assertSourceDoesNotContain("@JoinTable");
+ }
+
+ public void testMoveUniqueConstraint() throws Exception {
+ IType testType = this.createTestJoinTableWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ assertSourceContains("@JoinTable(uniqueConstraints={@UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"FOO\"}), @UniqueConstraint(columnNames={\"BAZ\"})})");
+
+ table.moveUniqueConstraint(2, 0);
+ assertSourceContains("@JoinTable(uniqueConstraints={@UniqueConstraint(columnNames={\"FOO\"}), @UniqueConstraint(columnNames={\"BAZ\"}), @UniqueConstraint(columnNames={\"BAR\"})})");
+ }
+
+ public void testMoveUniqueConstraint2() throws Exception {
+ IType testType = this.createTestJoinTableWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ assertSourceContains("@JoinTable(uniqueConstraints={@UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"FOO\"}), @UniqueConstraint(columnNames={\"BAZ\"})})");
+
+ table.moveUniqueConstraint(0, 2);
+ assertSourceContains("@JoinTable(uniqueConstraints={@UniqueConstraint(columnNames={\"BAZ\"}), @UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"FOO\"})})");
+ }
+
+ public void testJoinColumns() throws Exception {
+ IType testType = this.createTestJoinTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+
+ ListIterator<JoinColumn> iterator = table.joinColumns();
+
+ assertEquals(0, CollectionTools.size(iterator));
+ }
+
+ public void testJoinColumns2() throws Exception {
+ IType testType = this.createTestJoinTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+
+
+ table.addJoinColumn(0);
+ table.addJoinColumn(1);
+ table.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ ListIterator<JoinColumn> iterator = table.joinColumns();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testJoinColumns3() throws Exception {
+ IType testType = this.createTestJoinTableWithJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+
+ ListIterator<JoinColumn> iterator = table.joinColumns();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testAddJoinColumn() throws Exception {
+ IType testType = this.createTestJoinTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+
+ table.addJoinColumn(0).setName("FOO");
+ table.addJoinColumn(1);
+ table.addJoinColumn(0).setName("BAR");
+
+ assertEquals("BAR", table.joinColumnAt(0).getName());
+ assertEquals("FOO", table.joinColumnAt(1).getName());
+ assertNull(table.joinColumnAt(2).getName());
+ assertSourceContains("@JoinTable(joinColumns={@JoinColumn(name=\"BAR\"),@JoinColumn(name=\"FOO\"), @JoinColumn})");
+ }
+
+ public void testRemoveJoinColumn() throws Exception {
+ IType testType = this.createTestJoinTableWithJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ table.addJoinColumn(0).setName("FOO");
+
+ assertEquals("FOO", table.joinColumnAt(0).getName());
+ assertEquals("BAR", table.joinColumnAt(1).getName());
+ assertNull(table.joinColumnAt(2).getName());
+ assertEquals(3, table.joinColumnsSize());
+
+ table.removeJoinColumn(1);
+ assertEquals("FOO", table.joinColumnAt(0).getName());
+ assertNull(table.joinColumnAt(1).getName());
+ assertEquals(2, table.joinColumnsSize());
+ assertSourceContains("@JoinTable(joinColumns={@JoinColumn(name=\"FOO\"), @JoinColumn})");
+
+ table.removeJoinColumn(0);
+ assertNull(table.joinColumnAt(0).getName());
+ assertEquals(1, table.joinColumnsSize());
+ assertSourceContains("@JoinTable(joinColumns=@JoinColumn)");
+
+
+ table.removeJoinColumn(0);
+ assertEquals(0, table.joinColumnsSize());
+ assertSourceDoesNotContain("@JoinTable");
+ }
+
+ public void testMoveJoinColumn() throws Exception {
+ IType testType = this.createTestJoinTableWithJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ JoinColumn joinColumn = table.joinColumnAt(0);
+ joinColumn.setReferencedColumnName("REF_NAME");
+ joinColumn.setUnique(Boolean.FALSE);
+ joinColumn.setNullable(Boolean.FALSE);
+ joinColumn.setInsertable(Boolean.FALSE);
+ joinColumn.setUpdatable(Boolean.FALSE);
+ joinColumn.setColumnDefinition("COLUMN_DEF");
+ joinColumn.setTable("TABLE");
+ table.addJoinColumn(0).setName("FOO");
+
+ assertSourceContains("@JoinTable(joinColumns={@JoinColumn(name=\"FOO\"), @JoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn})");
+
+ table.moveJoinColumn(2, 0);
+ assertEquals("BAR", table.joinColumnAt(0).getName());
+ assertNull(table.joinColumnAt(1).getName());
+ assertEquals("FOO", table.joinColumnAt(2).getName());
+ assertEquals(3, table.joinColumnsSize());
+ assertSourceContains("@JoinTable(joinColumns={@JoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn, @JoinColumn(name=\"FOO\")})");
+ }
+
+ public void testMoveJoinColumn2() throws Exception {
+ IType testType = this.createTestJoinTableWithJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+
+ JoinColumn joinColumn = table.joinColumnAt(0);
+ joinColumn.setReferencedColumnName("REF_NAME");
+ joinColumn.setUnique(Boolean.FALSE);
+ joinColumn.setNullable(Boolean.FALSE);
+ joinColumn.setInsertable(Boolean.FALSE);
+ joinColumn.setUpdatable(Boolean.FALSE);
+ joinColumn.setColumnDefinition("COLUMN_DEF");
+ joinColumn.setTable("TABLE");
+
+ table.addJoinColumn(0).setName("FOO");
+
+ assertSourceContains("@JoinTable(joinColumns={@JoinColumn(name=\"FOO\"), @JoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\"), @JoinColumn})");
+
+
+ table.moveJoinColumn(0, 2);
+ assertNull(table.joinColumnAt(0).getName());
+ assertEquals("FOO", table.joinColumnAt(1).getName());
+ assertEquals("BAR", table.joinColumnAt(2).getName());
+ assertEquals(3, table.joinColumnsSize());
+ assertSourceContains("@JoinTable(joinColumns={@JoinColumn, @JoinColumn(name=\"FOO\"), @JoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", unique = false, nullable = false, insertable = false, updatable = false, columnDefinition = \"COLUMN_DEF\", table = \"TABLE\")})");
+ }
+
+ public void testSetJoinColumnName() throws Exception {
+ IType testType = this.createTestJoinTableWithJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+
+ ListIterator<JoinColumn> iterator = table.joinColumns();
+ assertEquals(2, CollectionTools.size(iterator));
+
+ JoinColumn joinColumn = table.joinColumns().next();
+
+ assertEquals("BAR", joinColumn.getName());
+
+ joinColumn.setName("foo");
+ assertEquals("foo", joinColumn.getName());
+
+ assertSourceContains("@JoinTable(joinColumns={@JoinColumn(name=\"foo\"), @JoinColumn})");
+ }
+
+ public void testInverseJoinColumns() throws Exception {
+ IType testType = this.createTestJoinTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+
+ ListIterator<JoinColumn> iterator = table.inverseJoinColumns();
+
+ assertEquals(0, CollectionTools.size(iterator));
+ }
+
+ public void testInverseJoinColumns2() throws Exception {
+ IType testType = this.createTestJoinTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+
+
+ table.addInverseJoinColumn(0);
+ table.addInverseJoinColumn(1);
+ table.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ ListIterator<JoinColumn> iterator = table.inverseJoinColumns();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testInverseJoinColumns3() throws Exception {
+ IType testType = this.createTestJoinTableWithInverseJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+
+ ListIterator<JoinColumn> iterator = table.inverseJoinColumns();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testAddInverseJoinColumn() throws Exception {
+ IType testType = this.createTestJoinTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+
+ table.addInverseJoinColumn(0).setName("FOO");
+ table.addInverseJoinColumn(1);
+ table.addInverseJoinColumn(0).setName("BAR");
+
+ assertEquals("BAR", table.inverseJoinColumnAt(0).getName());
+ assertEquals("FOO", table.inverseJoinColumnAt(1).getName());
+ assertNull(table.inverseJoinColumnAt(2).getName());
+ assertSourceContains("@JoinTable(inverseJoinColumns={@JoinColumn(name=\"BAR\"),@JoinColumn(name=\"FOO\"), @JoinColumn})");
+ }
+
+ public void testRemoveInverseJoinColumn() throws Exception {
+ IType testType = this.createTestJoinTableWithInverseJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ table.addInverseJoinColumn(2).setName("FOO");
+
+ Iterator<JoinColumn> inverseJoinColumns = table.inverseJoinColumns();
+ assertEquals("BAR", inverseJoinColumns.next().getName());
+ assertNull(inverseJoinColumns.next().getName());
+ assertEquals("FOO", inverseJoinColumns.next().getName());
+ assertFalse(inverseJoinColumns.hasNext());
+
+ table.removeInverseJoinColumn(1);
+ assertSourceContains("@JoinTable(inverseJoinColumns={@JoinColumn(name=\"BAR\"), @JoinColumn(name=\"FOO\")})");
+ inverseJoinColumns = table.inverseJoinColumns();
+ assertEquals("BAR", inverseJoinColumns.next().getName());
+ assertEquals("FOO", inverseJoinColumns.next().getName());
+ assertFalse(inverseJoinColumns.hasNext());
+
+ table.removeInverseJoinColumn(0);
+ assertSourceContains("@JoinTable(inverseJoinColumns=@JoinColumn(name=\"FOO\"))");
+ inverseJoinColumns = table.inverseJoinColumns();
+ assertEquals("FOO", inverseJoinColumns.next().getName());
+ assertFalse(inverseJoinColumns.hasNext());
+
+ table.removeInverseJoinColumn(0);
+ assertSourceDoesNotContain("@JoinTable");
+ }
+
+ public void testMoveInverseJoinColumn() throws Exception {
+ IType testType = this.createTestJoinTableWithInverseJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ table.addInverseJoinColumn(0).setName("FOO");
+
+ Iterator<JoinColumn> inverseJoinColumns = table.inverseJoinColumns();
+ assertEquals("FOO", inverseJoinColumns.next().getName());
+ assertEquals("BAR", inverseJoinColumns.next().getName());
+ assertNull(inverseJoinColumns.next().getName());
+
+ table.moveInverseJoinColumn(2, 0);
+ inverseJoinColumns = table.inverseJoinColumns();
+ assertEquals("BAR", inverseJoinColumns.next().getName());
+ assertNull(inverseJoinColumns.next().getName());
+ assertEquals("FOO", inverseJoinColumns.next().getName());
+
+ assertSourceContains("@JoinTable(inverseJoinColumns={@JoinColumn(name=\"BAR\"), @JoinColumn, @JoinColumn(name=\"FOO\")})");
+ }
+
+ public void testMoveInverseJoinColumn2() throws Exception {
+ IType testType = this.createTestJoinTableWithInverseJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+ table.addInverseJoinColumn(1).setName("FOO");
+
+ Iterator<JoinColumn> inverseJoinColumns = table.inverseJoinColumns();
+ assertEquals("BAR", inverseJoinColumns.next().getName());
+ assertEquals("FOO", inverseJoinColumns.next().getName());
+ assertNull(inverseJoinColumns.next().getName());
+
+ table.moveInverseJoinColumn(0, 2);
+ inverseJoinColumns = table.inverseJoinColumns();
+ assertNull(inverseJoinColumns.next().getName());
+ assertEquals("BAR", inverseJoinColumns.next().getName());
+ assertEquals("FOO", inverseJoinColumns.next().getName());
+
+ assertSourceContains("@JoinTable(inverseJoinColumns={@JoinColumn, @JoinColumn(name=\"BAR\"), @JoinColumn(name=\"FOO\")})");
+ }
+
+ public void testSetInverseJoinColumnName() throws Exception {
+ IType testType = this.createTestJoinTableWithInverseJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE);
+
+ ListIterator<JoinColumn> iterator = table.inverseJoinColumns();
+ assertEquals(2, CollectionTools.size(iterator));
+
+ JoinColumn joinColumn = table.inverseJoinColumns().next();
+
+ assertEquals("BAR", joinColumn.getName());
+
+ joinColumn.setName("foo");
+ assertEquals("foo", joinColumn.getName());
+
+ assertSourceContains("@JoinTable(inverseJoinColumns={@JoinColumn(name=\"foo\"), @JoinColumn})");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JpaCompilationUnitResourceTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JpaCompilationUnitResourceTests.java
new file mode 100644
index 0000000000..6e1d3714a7
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JpaCompilationUnitResourceTests.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.IJpaFile;
+import org.eclipse.jpt.core.internal.IJpaProject;
+import org.eclipse.jpt.core.internal.resource.java.Entity;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaResourceModel;
+import org.eclipse.jpt.core.internal.resource.java.JpaCompilationUnitResource;
+import org.eclipse.jpt.core.tests.internal.jdtutility.AnnotationTestCase;
+import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject;
+import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class JpaCompilationUnitResourceTests extends AnnotationTestCase {
+
+ public JpaCompilationUnitResourceTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected TestJavaProject buildJavaProject(String projectName, boolean autoBuild) throws Exception {
+ return new TestJpaProject(projectName, autoBuild); // false = no auto-build
+ }
+
+ private void createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception {
+ this.javaProject.createType("javax.persistence", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }");
+ }
+
+ private ICompilationUnit createTestCompilationUnit() throws Exception {
+ IType type = createTestEntity();
+ return type.getCompilationUnit();
+ }
+
+ private IType createTestEntity() throws Exception {
+ this.createAnnotationAndMembers("Entity", "String name();");
+
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ });
+ }
+
+ protected JpaCompilationUnitResource getJpaCompilationUnitResource(ICompilationUnit testCompilationUnit) throws CoreException {
+ IJpaProject jpaProject = ((TestJpaProject) this.javaProject).getJpaProject();
+ IJpaFile jpaFile = jpaProject.jpaFile((IFile) testCompilationUnit.getResource());
+ JavaResourceModel javaResourceModel = (JavaResourceModel) jpaFile.getResourceModel();
+ return javaResourceModel.resource();
+ }
+
+ public void testGetPersistentType() throws Exception {
+ ICompilationUnit compilationUnit = this.createTestCompilationUnit();
+ JpaCompilationUnitResource jpaCompilationUnit = getJpaCompilationUnitResource(compilationUnit);
+
+ assertTrue(jpaCompilationUnit.getPersistentType().mappingAnnotation() instanceof Entity);
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JptJavaResourceTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JptJavaResourceTests.java
new file mode 100644
index 0000000000..fca651df98
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JptJavaResourceTests.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class JptJavaResourceTests {
+
+ public static Test suite() {
+ return suite(true);
+ }
+
+ public static Test suite(boolean all) {
+ TestSuite suite = new TestSuite(JptJavaResourceTests.class.getName());
+ suite.addTestSuite(JpaCompilationUnitResourceTests.class);
+ suite.addTestSuite(JavaPersistentTypeResourceTests.class);
+ suite.addTestSuite(JavaPersistentAttributeResourceTests.class);
+ suite.addTestSuite(JPTToolsTests.class);
+
+ suite.addTestSuite(AssociationOverrideTests.class);
+ suite.addTestSuite(AssociationOverridesTests.class);
+ suite.addTestSuite(AttributeOverrideTests.class);
+ suite.addTestSuite(AttributeOverridesTests.class);
+ suite.addTestSuite(BasicTests.class);
+ suite.addTestSuite(ColumnTests.class);
+ suite.addTestSuite(DiscriminatorValueTests.class);
+ suite.addTestSuite(DiscriminatorColumnTests.class);
+ suite.addTestSuite(EmbeddableTests.class);
+ suite.addTestSuite(EmbeddedTests.class);
+ suite.addTestSuite(EmbeddedIdTests.class);
+ suite.addTestSuite(EntityTests.class);
+ suite.addTestSuite(EnumeratedTests.class);
+ suite.addTestSuite(GeneratedValueTests.class);
+ suite.addTestSuite(IdClassTests.class);
+ suite.addTestSuite(IdTests.class);
+ suite.addTestSuite(InheritanceTests.class);
+ suite.addTestSuite(JoinColumnTests.class);
+ suite.addTestSuite(JoinColumnsTests.class);
+ suite.addTestSuite(JoinTableTests.class);
+ suite.addTestSuite(LobTests.class);
+ suite.addTestSuite(ManyToManyTests.class);
+ suite.addTestSuite(ManyToOneTests.class);
+ suite.addTestSuite(MapKeyTests.class);
+ suite.addTestSuite(MappedSuperclassTests.class);
+ suite.addTestSuite(NamedNativeQueryTests.class);
+ suite.addTestSuite(NamedNativeQueriesTests.class);
+ suite.addTestSuite(NamedQueryTests.class);
+ suite.addTestSuite(NamedQueriesTests.class);
+ suite.addTestSuite(OneToManyTests.class);
+ suite.addTestSuite(OneToOneTests.class);
+ suite.addTestSuite(OrderByTests.class);
+ suite.addTestSuite(PrimaryKeyJoinColumnTests.class);
+ suite.addTestSuite(PrimaryKeyJoinColumnsTests.class);
+ suite.addTestSuite(QueryHintTests.class);
+ suite.addTestSuite(SecondaryTableTests.class);
+ suite.addTestSuite(SecondaryTablesTests.class);
+ suite.addTestSuite(SequenceGeneratorTests.class);
+ suite.addTestSuite(TableGeneratorTests.class);
+ suite.addTestSuite(TableTests.class);
+ suite.addTestSuite(TemporalTests.class);
+ suite.addTestSuite(TransientTests.class);
+ suite.addTestSuite(VersionTests.class);
+
+ return suite;
+ }
+
+ private JptJavaResourceTests() {
+ super();
+ throw new UnsupportedOperationException();
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/LobTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/LobTests.java
new file mode 100644
index 0000000000..5eb4fb07c1
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/LobTests.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.Lob;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class LobTests extends JavaResourceModelTestCase {
+
+ public LobTests(String name) {
+ super(name);
+ }
+
+ private IType createTestLob() throws Exception {
+ this.createAnnotationAndMembers("Lob", "");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.LOB);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Lob");
+ }
+ });
+ }
+
+ public void testLob() throws Exception {
+ IType testType = this.createTestLob();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ Lob lob = (Lob) attributeResource.annotation(JPA.LOB);
+ assertNotNull(lob);
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToManyTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToManyTests.java
new file mode 100644
index 0000000000..6424e4d000
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToManyTests.java
@@ -0,0 +1,413 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.FetchType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.ManyToMany;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class ManyToManyTests extends JavaResourceModelTestCase {
+
+ public ManyToManyTests(String name) {
+ super(name);
+ }
+
+ private IType createTestManyToMany() throws Exception {
+ this.createAnnotationAndMembers("ManyToMany", "FetchType fetch() default FetchType.LAZY; CascadeType[] cascade() default = {};");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MANY_TO_MANY);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToMany");
+ }
+ });
+ }
+
+ private IType createTestManyToManyWithFetch() throws Exception {
+ this.createAnnotationAndMembers("ManyToMany", "FetchType fetch() default FetchType.LAZY;");
+ this.createEnumAndMembers("FetchType", "EAGER, LAZY");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MANY_TO_MANY, JPA.FETCH_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToMany(fetch=FetchType.EAGER)");
+ }
+ });
+ }
+
+ private IType createTestManyToManyWithTargetEntity() throws Exception {
+ this.createAnnotationAndMembers("ManyToMany", "Class targetEntity() default void.class; ");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MANY_TO_MANY);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToMany(targetEntity=AnnotationTestType.class)");
+ }
+ });
+ }
+
+ private IType createTestManyToManyWithMappedBy() throws Exception {
+ this.createAnnotationAndMembers("ManyToMany", "String mappedBy() default\"\";");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MANY_TO_MANY);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToMany(mappedBy=\"foo\")");
+ }
+ });
+ }
+
+ private IType createTestManyToManyWithCascade() throws Exception {
+ this.createAnnotationAndMembers("ManyToMany", "CascadeType[] cascade() default = {};");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MANY_TO_MANY, JPA.CASCADE_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToMany(cascade=CascadeType.ALL)");
+ }
+ });
+ }
+
+ private IType createTestManyToManyWithMultipleCascade() throws Exception {
+ this.createAnnotationAndMembers("ManyToMany", "CascadeType[] cascade() default = {};");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MANY_TO_MANY, JPA.CASCADE_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToMany(cascade={CascadeType.MERGE, CascadeType.REMOVE})");
+ }
+ });
+ }
+
+ private IType createTestManyToManyWithDuplicateCascade() throws Exception {
+ this.createAnnotationAndMembers("ManyToMany", "CascadeType[] cascade() default = {};");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MANY_TO_MANY, JPA.CASCADE_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToMany(cascade={CascadeType.MERGE, CascadeType.MERGE})");
+ }
+ });
+ }
+
+ public void testManyToMany() throws Exception {
+ IType testType = this.createTestManyToMany();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertNotNull(manyToMany);
+ }
+
+ public void testGetFetch() throws Exception {
+ IType testType = this.createTestManyToManyWithFetch();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertEquals(FetchType.EAGER, manyToMany.getFetch());
+ }
+
+ public void testSetFetch() throws Exception {
+ IType testType = this.createTestManyToManyWithFetch();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertEquals(FetchType.EAGER, manyToMany.getFetch());
+
+ manyToMany.setFetch(FetchType.LAZY);
+ assertEquals(FetchType.LAZY, manyToMany.getFetch());
+
+ assertSourceContains("@ManyToMany(fetch=LAZY)");
+ }
+
+ public void testSetFetchNull() throws Exception {
+ IType testType = this.createTestManyToManyWithFetch();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertEquals(FetchType.EAGER, manyToMany.getFetch());
+
+ manyToMany.setFetch(null);
+ assertNull(manyToMany.getFetch());
+
+ assertSourceContains("@ManyToMany");
+ assertSourceDoesNotContain("fetch");
+ }
+
+ public void testGetTargetEntity() throws Exception {
+ IType testType = this.createTestManyToManyWithTargetEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertEquals(TYPE_NAME, manyToMany.getTargetEntity());
+ }
+
+ public void testSetTargetEntity() throws Exception {
+ IType testType = this.createTestManyToManyWithTargetEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertEquals(TYPE_NAME, manyToMany.getTargetEntity());
+
+ manyToMany.setTargetEntity("Foo");
+
+ assertSourceContains("@ManyToMany(targetEntity=Foo.class)");
+ }
+
+ public void testSetTargetEntityNull() throws Exception {
+ IType testType = this.createTestManyToManyWithTargetEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertEquals(TYPE_NAME, manyToMany.getTargetEntity());
+
+ manyToMany.setTargetEntity(null);
+
+ assertSourceContains("@ManyToMany");
+ assertSourceDoesNotContain("targetEntity");
+ }
+
+
+ public void testGetFullyQualifiedTargetEntity() throws Exception {
+ IType testType = this.createTestManyToManyWithTargetEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertEquals(FULLY_QUALIFIED_TYPE_NAME, manyToMany.getFullyQualifiedTargetEntity());
+
+ manyToMany.setTargetEntity("Foo");
+
+ assertSourceContains("@ManyToMany(targetEntity=Foo.class)");
+
+ typeResource.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertEquals("Foo", manyToMany.getTargetEntity());
+
+ assertNull(manyToMany.getFullyQualifiedTargetEntity());
+ }
+
+ public void testGetMappedBy() throws Exception {
+ IType testType = this.createTestManyToManyWithMappedBy();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertEquals("foo", manyToMany.getMappedBy());
+ }
+
+ public void testGetMappedByNull() throws Exception {
+ IType testType = this.createTestManyToMany();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertEquals(null, manyToMany.getMappedBy());
+ }
+
+ public void testSetMappedBy() throws Exception {
+ IType testType = this.createTestManyToMany();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertNull(manyToMany.getMappedBy());
+ manyToMany.setMappedBy("bar");
+ assertEquals("bar", manyToMany.getMappedBy());
+
+ assertSourceContains("@ManyToMany(mappedBy=\"bar\")");
+ }
+
+ public void testSetMappedByNull() throws Exception {
+ IType testType = this.createTestManyToManyWithMappedBy();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertEquals("foo", manyToMany.getMappedBy());
+
+ manyToMany.setMappedBy(null);
+ assertNull(manyToMany.getMappedBy());
+
+ assertSourceContains("@ManyToMany");
+ assertSourceDoesNotContain("mappedBy");
+ }
+
+ public void testSetCascadeAll() throws Exception {
+ IType testType = this.createTestManyToMany();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertFalse(manyToMany.isCascadeAll());
+
+ manyToMany.setCascadeAll(true);
+ assertSourceContains("@ManyToMany(cascade=ALL)");
+
+ manyToMany.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(manyToMany.isCascadeAll());
+ }
+
+ public void testSetCascadeMerge() throws Exception {
+ IType testType = this.createTestManyToMany();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertFalse(manyToMany.isCascadeMerge());
+
+ manyToMany.setCascadeMerge(true);
+ assertSourceContains("@ManyToMany(cascade=MERGE)");
+
+ manyToMany.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(manyToMany.isCascadeMerge());
+ }
+
+ public void testSetCascadePersist() throws Exception {
+ IType testType = this.createTestManyToMany();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertFalse(manyToMany.isCascadePersist());
+
+ manyToMany.setCascadePersist(true);
+ assertSourceContains("@ManyToMany(cascade=PERSIST)");
+
+ manyToMany.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(manyToMany.isCascadePersist());
+ }
+
+ public void testSetCascadeRemove() throws Exception {
+ IType testType = this.createTestManyToMany();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertFalse(manyToMany.isCascadeRemove());
+
+ manyToMany.setCascadeRemove(true);
+ assertSourceContains("@ManyToMany(cascade=REMOVE)");
+
+ manyToMany.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(manyToMany.isCascadeRemove());
+ }
+
+ public void testSetCascadeRefresh() throws Exception {
+ IType testType = this.createTestManyToMany();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertFalse(manyToMany.isCascadeRefresh());
+
+ manyToMany.setCascadeRefresh(true);
+ assertSourceContains("@ManyToMany(cascade=REFRESH)");
+
+ manyToMany.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(manyToMany.isCascadeRefresh());
+ }
+
+ public void testCascadeMoreThanOnce() throws Exception {
+ IType testType = this.createTestManyToManyWithCascade();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertTrue(manyToMany.isCascadeAll());
+
+ manyToMany.setCascadeAll(true);
+ assertTrue(manyToMany.isCascadeAll());
+ //a second CascadeType.All should not have been added
+ assertSourceContains("@ManyToMany(cascade=CascadeType.ALL)");
+
+ manyToMany.setCascadeAll(false);
+ assertFalse(manyToMany.isCascadeAll());
+
+ assertSourceDoesNotContain("cascade");
+
+ //test setting cascadeAll to false again, should just do nothing
+ manyToMany.setCascadeAll(false);
+ assertFalse(manyToMany.isCascadeAll());
+
+ assertSourceDoesNotContain("cascade");
+ }
+
+ public void testDuplicateCascade() throws Exception {
+ IType testType = this.createTestManyToManyWithDuplicateCascade();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertTrue(manyToMany.isCascadeMerge());
+
+ manyToMany.setCascadeMerge(false); //TODO should the resource model handle this and remove both MERGE
+ //settings instead of having to set it false twice?
+ assertTrue(manyToMany.isCascadeMerge());
+
+ manyToMany.setCascadeMerge(false);
+ assertFalse(manyToMany.isCascadeMerge());
+
+ assertSourceDoesNotContain("cascade");
+ }
+
+ public void testMultipleCascade() throws Exception {
+ IType testType = this.createTestManyToManyWithMultipleCascade();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY);
+ assertTrue(manyToMany.isCascadeMerge());
+ assertTrue(manyToMany.isCascadeRemove());
+
+ manyToMany.setCascadeMerge(false);
+ assertSourceContains("@ManyToMany(cascade=REMOVE)");
+
+ manyToMany.setCascadeRemove(false);
+ assertSourceDoesNotContain("cascade");
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToOneTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToOneTests.java
new file mode 100644
index 0000000000..82a2624cbf
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToOneTests.java
@@ -0,0 +1,405 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.FetchType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.ManyToOne;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class ManyToOneTests extends JavaResourceModelTestCase {
+
+ public ManyToOneTests(String name) {
+ super(name);
+ }
+
+ private IType createTestManyToOne() throws Exception {
+ this.createAnnotationAndMembers("ManyToOne", "FetchType fetch() default FetchType.LAZY; CascadeType[] cascade() default = {};");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MANY_TO_ONE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToOne");
+ }
+ });
+ }
+
+ private IType createTestManyToOneWithFetch() throws Exception {
+ this.createAnnotationAndMembers("ManyToOne", "FetchType fetch() default FetchType.LAZY;");
+ this.createEnumAndMembers("FetchType", "EAGER, LAZY");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MANY_TO_ONE, JPA.FETCH_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToOne(fetch=FetchType.EAGER)");
+ }
+ });
+ }
+
+ private IType createTestManyToOneWithTargetEntity() throws Exception {
+ this.createAnnotationAndMembers("ManyToOne", "Class targetEntity() default void.class;");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MANY_TO_ONE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToOne(targetEntity=AnnotationTestType.class)");
+ }
+ });
+ }
+
+ private IType createTestManyToOneWithOptional() throws Exception {
+ this.createAnnotationAndMembers("ManyToOne", "boolean optional() default true;");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MANY_TO_ONE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToOne(optional=true)");
+ }
+ });
+ }
+
+ private IType createTestManyToOneWithCascade() throws Exception {
+ this.createAnnotationAndMembers("ManyToOne", "CascadeType[] cascade() default = {};");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MANY_TO_ONE, JPA.CASCADE_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToOne(cascade=CascadeType.ALL)");
+ }
+ });
+ }
+
+ private IType createTestManyToOneWithMultipleCascade() throws Exception {
+ this.createAnnotationAndMembers("ManyToOne", "CascadeType[] cascade() default = {};");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MANY_TO_ONE, JPA.CASCADE_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToOne(cascade={CascadeType.MERGE, CascadeType.REMOVE})");
+ }
+ });
+ }
+
+ private IType createTestManyToOneWithDuplicateCascade() throws Exception {
+ this.createAnnotationAndMembers("ManyToOne", "CascadeType[] cascade() default = {};");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MANY_TO_ONE, JPA.CASCADE_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@ManyToOne(cascade={CascadeType.MERGE, CascadeType.MERGE})");
+ }
+ });
+ }
+
+ public void testManyToOne() throws Exception {
+ IType testType = this.createTestManyToOne();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertNotNull(manyToOne);
+ }
+
+ public void testGetFetch() throws Exception {
+ IType testType = this.createTestManyToOneWithFetch();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertEquals(FetchType.EAGER, manyToOne.getFetch());
+ }
+
+ public void testSetFetch() throws Exception {
+ IType testType = this.createTestManyToOneWithFetch();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertEquals(FetchType.EAGER, manyToOne.getFetch());
+
+ manyToOne.setFetch(FetchType.LAZY);
+ assertEquals(FetchType.LAZY, manyToOne.getFetch());
+
+ assertSourceContains("@ManyToOne(fetch=LAZY)");
+ }
+
+ public void testSetFetchNull() throws Exception {
+ IType testType = this.createTestManyToOneWithFetch();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertEquals(FetchType.EAGER, manyToOne.getFetch());
+
+ manyToOne.setFetch(null);
+ assertNull(manyToOne.getFetch());
+
+ assertSourceContains("@ManyToOne");
+ assertSourceDoesNotContain("fetch");
+ }
+
+
+ public void testGetTargetEntity() throws Exception {
+ IType testType = this.createTestManyToOneWithTargetEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertEquals(TYPE_NAME, manyToOne.getTargetEntity());
+ }
+
+ public void testSetTargetEntity() throws Exception {
+ IType testType = this.createTestManyToOneWithTargetEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertEquals(TYPE_NAME, manyToOne.getTargetEntity());
+
+ manyToOne.setTargetEntity("Foo");
+
+ assertSourceContains("@ManyToOne(targetEntity=Foo.class)");
+ }
+
+ public void testSetTargetEntityNull() throws Exception {
+ IType testType = this.createTestManyToOneWithTargetEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertEquals(TYPE_NAME, manyToOne.getTargetEntity());
+
+ manyToOne.setTargetEntity(null);
+
+ assertSourceContains("@ManyToOne");
+ assertSourceDoesNotContain("targetEntity");
+ }
+
+
+ public void testGetFullyQualifiedTargetEntity() throws Exception {
+ IType testType = this.createTestManyToOneWithTargetEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertEquals(FULLY_QUALIFIED_TYPE_NAME, manyToOne.getFullyQualifiedTargetEntity());
+
+ manyToOne.setTargetEntity("Foo");
+
+ assertSourceContains("@ManyToOne(targetEntity=Foo.class)");
+
+ typeResource.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertEquals("Foo", manyToOne.getTargetEntity());
+
+ assertNull(manyToOne.getFullyQualifiedTargetEntity());
+ }
+
+ public void testGetOptional() throws Exception {
+ IType testType = this.createTestManyToOneWithOptional();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertTrue(manyToOne.getOptional());
+ }
+
+ public void testSetOptional() throws Exception {
+ IType testType = this.createTestManyToOneWithOptional();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertTrue(manyToOne.getOptional());
+
+ manyToOne.setOptional(false);
+ assertFalse(manyToOne.getOptional());
+
+ assertSourceContains("@ManyToOne(optional=false)");
+ }
+
+ public void testSetOptionalNull() throws Exception {
+ IType testType = this.createTestManyToOneWithOptional();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertTrue(manyToOne.getOptional());
+
+ manyToOne.setOptional(null);
+ assertNull(manyToOne.getOptional());
+
+ assertSourceContains("@ManyToOne");
+ assertSourceDoesNotContain("optional");
+ }
+
+ public void testSetCascadeAll() throws Exception {
+ IType testType = this.createTestManyToOne();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertFalse(manyToOne.isCascadeAll());
+
+ manyToOne.setCascadeAll(true);
+ assertSourceContains("@ManyToOne(cascade=ALL)");
+
+ manyToOne.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(manyToOne.isCascadeAll());
+ }
+
+ public void testSetCascadeMerge() throws Exception {
+ IType testType = this.createTestManyToOne();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertFalse(manyToOne.isCascadeMerge());
+
+ manyToOne.setCascadeMerge(true);
+ assertSourceContains("@ManyToOne(cascade=MERGE)");
+
+ manyToOne.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(manyToOne.isCascadeMerge());
+ }
+
+ public void testSetCascadePersist() throws Exception {
+ IType testType = this.createTestManyToOne();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertFalse(manyToOne.isCascadePersist());
+
+ manyToOne.setCascadePersist(true);
+ assertSourceContains("@ManyToOne(cascade=PERSIST)");
+
+ manyToOne.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(manyToOne.isCascadePersist());
+ }
+
+ public void testSetCascadeRemove() throws Exception {
+ IType testType = this.createTestManyToOne();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertFalse(manyToOne.isCascadeRemove());
+
+ manyToOne.setCascadeRemove(true);
+ assertSourceContains("@ManyToOne(cascade=REMOVE)");
+
+ manyToOne.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(manyToOne.isCascadeRemove());
+ }
+
+ public void testSetCascadeRefresh() throws Exception {
+ IType testType = this.createTestManyToOne();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertFalse(manyToOne.isCascadeRefresh());
+
+ manyToOne.setCascadeRefresh(true);
+ assertSourceContains("@ManyToOne(cascade=REFRESH)");
+
+ manyToOne.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(manyToOne.isCascadeRefresh());
+ }
+
+ public void testCascadeMoreThanOnce() throws Exception {
+ IType testType = this.createTestManyToOneWithCascade();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertTrue(manyToOne.isCascadeAll());
+
+ manyToOne.setCascadeAll(true);
+ assertTrue(manyToOne.isCascadeAll());
+ //a second CascadeType.All should not have been added
+ assertSourceContains("@ManyToOne(cascade=CascadeType.ALL)");
+
+ manyToOne.setCascadeAll(false);
+ assertFalse(manyToOne.isCascadeAll());
+
+ assertSourceDoesNotContain("cascade");
+
+ //test setting cascadeAll to false again, should just do nothing
+ manyToOne.setCascadeAll(false);
+ assertFalse(manyToOne.isCascadeAll());
+
+ assertSourceDoesNotContain("cascade");
+ }
+
+ public void testDuplicateCascade() throws Exception {
+ IType testType = this.createTestManyToOneWithDuplicateCascade();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertTrue(manyToOne.isCascadeMerge());
+
+ manyToOne.setCascadeMerge(false);//TODO should the resource model handle this and remove both MERGE
+ //settings instead of having to set it false twice?
+ assertTrue(manyToOne.isCascadeMerge());
+
+ manyToOne.setCascadeMerge(false);
+ assertFalse(manyToOne.isCascadeMerge());
+
+ assertSourceDoesNotContain("cascade");
+ }
+
+ public void testMultipleCascade() throws Exception {
+ IType testType = this.createTestManyToOneWithMultipleCascade();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE);
+ assertTrue(manyToOne.isCascadeMerge());
+ assertTrue(manyToOne.isCascadeRemove());
+
+ manyToOne.setCascadeMerge(false);
+ assertSourceContains("@ManyToOne(cascade=REMOVE)");
+
+ manyToOne.setCascadeRemove(false);
+ assertSourceDoesNotContain("cascade");
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MapKeyTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MapKeyTests.java
new file mode 100644
index 0000000000..de0297605c
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MapKeyTests.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.MapKey;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class MapKeyTests extends JavaResourceModelTestCase {
+
+ public MapKeyTests(String name) {
+ super(name);
+ }
+
+ private IType createTestMapKey() throws Exception {
+ this.createAnnotationAndMembers("MapKey", "String name() default \"\";");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MAP_KEY);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@MapKey");
+ }
+ });
+ }
+
+ private IType createTestMapKeyWithName() throws Exception {
+ this.createAnnotationAndMembers("MapKey", "String name() default \"\";");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MAP_KEY);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@MapKey(name=\"key\")");
+ }
+ });
+ }
+
+ public void testMapKey() throws Exception {
+ IType testType = this.createTestMapKey();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ MapKey mapKey = (MapKey) attributeResource.annotation(JPA.MAP_KEY);
+ assertNotNull(mapKey);
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestMapKeyWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ MapKey mapKey = (MapKey) attributeResource.annotation(JPA.MAP_KEY);
+ assertEquals("key", mapKey.getName());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestMapKey();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ MapKey mapKey = (MapKey) attributeResource.annotation(JPA.MAP_KEY);
+
+ mapKey.setName("foo");
+
+ assertSourceContains("@MapKey(name=\"foo\")");
+
+ mapKey.setName(null);
+
+ assertSourceContains("@MapKey");
+ assertSourceDoesNotContain("@MapKey(name=\"foo\")");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MappedSuperclassTests.java
new file mode 100644
index 0000000000..3540e6cb34
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MappedSuperclassTests.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.Entity;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.MappedSuperclass;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class MappedSuperclassTests extends JavaResourceModelTestCase {
+
+ public MappedSuperclassTests(String name) {
+ super(name);
+ }
+
+ private IType createTestMappedSuperclass() throws Exception {
+ this.createAnnotationAndMembers("MappedSuperclass", "");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@MappedSuperclass");
+ }
+ });
+ }
+
+ private IType createTestMappedSuperclassAndEntity() throws Exception {
+ this.createAnnotationAndMembers("MappedSuperclass", "");
+ this.createAnnotationAndMembers("Entity", "");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.MAPPED_SUPERCLASS, JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@MappedSuperclass");
+ sb.append("@Entity");
+ }
+ });
+ }
+
+ public void testMappedSuperclass() throws Exception {
+ IType testType = this.createTestMappedSuperclass();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ JavaResource mappingAnnotation = typeResource.mappingAnnotation();
+ assertTrue(mappingAnnotation instanceof MappedSuperclass);
+ }
+
+ public void testMappedSuperclassAndEntity() throws Exception {
+ IType testType = this.createTestMappedSuperclassAndEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ JavaResource mappingAnnotation = typeResource.mappingAnnotation();
+ assertTrue(mappingAnnotation instanceof Entity);
+
+ MappedSuperclass mappedSuperclass = (MappedSuperclass) typeResource.mappingAnnotation(JPA.MAPPED_SUPERCLASS);
+ assertNotNull(mappedSuperclass);
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueriesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueriesTests.java
new file mode 100644
index 0000000000..81edea512c
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueriesTests.java
@@ -0,0 +1,452 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueries;
+import org.eclipse.jpt.core.internal.resource.java.NamedNativeQuery;
+import org.eclipse.jpt.core.internal.resource.java.QueryHint;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class NamedNativeQueriesTests extends JavaResourceModelTestCase {
+
+ private static final String QUERY_NAME = "myQuery";
+ private static final String QUERY_QUERY = "SELECT name FROM Employee";
+ private static final String QUERY_RESULT_CLASS = "Result";
+ private static final String QUERY_RESULT_SET_MAPPING = "resultSetMapping";
+
+ public NamedNativeQueriesTests(String name) {
+ super(name);
+ }
+
+ private void createNamedNativeQueryAnnotation() throws Exception {
+ createQueryHintAnnotation();
+ this.createAnnotationAndMembers("NamedNativeQuery", "String name(); " +
+ "String query();" +
+ "QueryHint[] hints() default{};");
+ }
+
+ private void createNamedNativeQueriesAnnotation() throws Exception {
+ createNamedNativeQueryAnnotation();
+ this.createAnnotationAndMembers("NamedNativeQueries",
+ "NamedNativeQuery[] value();");
+ }
+
+ private void createQueryHintAnnotation() throws Exception {
+ this.createAnnotationAndMembers("QueryHint", "String name(); " +
+ "String value();");
+ }
+
+ private IType createTestNamedNativeQueries() throws Exception {
+ createNamedNativeQueriesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERIES, JPA.NAMED_NATIVE_QUERY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedNativeQueries(@NamedNativeQuery)");
+ }
+ });
+ }
+
+ private IType createTestNamedNativeQueryWithName() throws Exception {
+ return createTestNamedNativeQueryWithStringElement("name", QUERY_NAME);
+ }
+
+ private IType createTestNamedNativeQueryWithQuery() throws Exception {
+ return createTestNamedNativeQueryWithStringElement("query", QUERY_QUERY);
+ }
+
+ private IType createTestNamedNativeQueryWithResultSetMapping() throws Exception {
+ return createTestNamedNativeQueryWithStringElement("resultSetMapping", QUERY_RESULT_SET_MAPPING);
+ }
+
+
+ private IType createTestNamedNativeQueryWithStringElement(final String elementName, final String value) throws Exception {
+ createNamedNativeQueriesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERIES, JPA.NAMED_NATIVE_QUERY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedNativeQueries(@NamedNativeQuery(" + elementName + "=\"" + value + "\"))");
+ }
+ });
+ }
+
+ private IType createTestNamedNativeQueryWithResultClass() throws Exception {
+ createNamedNativeQueriesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERIES, JPA.NAMED_NATIVE_QUERY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedNativeQueries(@NamedNativeQuery(resultClass=" + QUERY_RESULT_CLASS + ".class))");
+ }
+ });
+ }
+ private IType createTestNamedNativeQueryWithQueryHints() throws Exception {
+ createNamedNativeQueriesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERIES, JPA.NAMED_NATIVE_QUERY, JPA.QUERY_HINT);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedNativeQueries(@NamedNativeQuery(hints={@QueryHint(name=\"BAR\", value=\"FOO\"), @QueryHint}))");
+ }
+ });
+ }
+
+ private IType createTestNamedNativeQuery() throws Exception {
+ createNamedNativeQueryAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERY, JPA.QUERY_HINT);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedNativeQuery(name=\"foo\", query=\"bar\", hints=@QueryHint(name=\"BAR\", value=\"FOO\"), resultClass=Foo.class, resultSetMapping=\"mapping\")");
+ }
+ });
+ }
+
+ public void testNamedNativeQuery() throws Exception {
+ IType testType = this.createTestNamedNativeQueries();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+ assertNotNull(namedQuery);
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+ assertEquals(QUERY_NAME, namedQuery.getName());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+ assertEquals(QUERY_NAME, namedQuery.getName());
+
+ namedQuery.setName("foo");
+ assertEquals("foo", namedQuery.getName());
+
+ assertSourceContains("@NamedNativeQuery(name=\"foo\")");
+
+ namedQuery.setName(null);
+ assertNull(namedQuery.getName());
+
+ assertSourceDoesNotContain("@NamedNativeQuery");
+ }
+
+ public void testGetQuery() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+ assertEquals(QUERY_QUERY, namedQuery.getQuery());
+ }
+
+ public void testSetQuery() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+ assertEquals(QUERY_QUERY, namedQuery.getQuery());
+
+ namedQuery.setQuery("foo");
+ assertEquals("foo", namedQuery.getQuery());
+
+ assertSourceContains("@NamedNativeQuery(query=\"foo\")");
+
+ namedQuery.setQuery(null);
+ assertNull(namedQuery.getQuery());
+
+ assertSourceDoesNotContain("@NamedNativeQuery");
+ }
+
+ public void testGetResultClass() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithResultClass();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+ assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass());
+ }
+
+ public void testSetResultClass() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithResultClass();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+ assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass());
+
+ namedQuery.setResultClass("foo");
+ assertEquals("foo", namedQuery.getResultClass());
+
+ assertSourceContains("@NamedNativeQuery(resultClass=foo.class)");
+
+ namedQuery.setResultClass(null);
+ assertNull(namedQuery.getResultClass());
+
+ assertSourceDoesNotContain("@NamedNativeQuery");
+ }
+
+ public void testGetFullyQualifiedClass() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithResultClass();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+ assertNotNull(namedQuery.getResultClass());
+ assertNull(namedQuery.getFullyQualifiedResultClass());
+
+ namedQuery.setResultClass(TYPE_NAME);
+ typeResource.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ assertEquals(FULLY_QUALIFIED_TYPE_NAME, namedQuery.getFullyQualifiedResultClass());
+ assertSourceContains("@NamedNativeQuery(resultClass=" + TYPE_NAME + ".class)");
+ }
+
+ public void testGetResultSetMapping() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithResultSetMapping();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+ assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping());
+ }
+
+ public void testSetResultSetMapping() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithResultSetMapping();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+ assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping());
+
+ namedQuery.setResultSetMapping("foo");
+ assertEquals("foo", namedQuery.getResultSetMapping());
+
+ assertSourceContains("@NamedNativeQuery(resultSetMapping=\"foo\")");
+
+ namedQuery.setResultSetMapping(null);
+ assertNull(namedQuery.getResultSetMapping());
+
+ assertSourceDoesNotContain("@NamedNativeQuery");
+ }
+
+ public void testHints() throws Exception {
+ IType testType = this.createTestNamedNativeQueries();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+
+ ListIterator<QueryHint> iterator = namedQuery.hints();
+
+ assertEquals(0, CollectionTools.size(iterator));
+ }
+
+ public void testHints2() throws Exception {
+ IType testType = this.createTestNamedNativeQueries();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+
+ namedQuery.addHint(0);
+ namedQuery.addHint(1);
+ namedQuery.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ ListIterator<QueryHint> iterator = namedQuery.hints();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testHints3() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+
+ ListIterator<QueryHint> iterator = namedQuery.hints();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testAddHint() throws Exception {
+ IType testType = this.createTestNamedNativeQueries();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+
+ namedQuery.addHint(0).setName("FOO");
+ namedQuery.addHint(1);
+ namedQuery.addHint(0).setName("BAR");
+
+ assertEquals("BAR", namedQuery.hintAt(0).getName());
+ assertEquals("FOO", namedQuery.hintAt(1).getName());
+ assertNull(namedQuery.hintAt(2).getName());
+ assertSourceContains("@NamedNativeQuery(hints={@QueryHint(name=\"BAR\"),@QueryHint(name=\"FOO\"), @QueryHint})");
+ }
+
+ public void testRemoveHint() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+ namedQuery.addHint(0).setName("BAZ");
+
+ assertEquals("BAZ", namedQuery.hintAt(0).getName());
+ assertEquals("BAR", namedQuery.hintAt(1).getName());
+ assertNull(namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+
+ namedQuery.removeHint(2);
+ assertEquals("BAZ", namedQuery.hintAt(0).getName());
+ assertEquals("BAR", namedQuery.hintAt(1).getName());
+ assertEquals(2, namedQuery.hintsSize());
+ assertSourceContains("@NamedNativeQueries(@NamedNativeQuery(hints={@QueryHint(name=\"BAZ\"), @QueryHint(name=\"BAR\", value=\"FOO\")}))");
+
+ namedQuery.removeHint(0);
+ assertEquals("BAR", namedQuery.hintAt(0).getName());
+ assertEquals(1, namedQuery.hintsSize());
+ assertSourceContains("@NamedNativeQueries(@NamedNativeQuery(hints=@QueryHint(name=\"BAR\", value=\"FOO\")))");
+
+
+ namedQuery.removeHint(0);
+ assertEquals(0, namedQuery.hintsSize());
+ assertSourceDoesNotContain("@NamedNativeQuery");
+ }
+
+ public void testMoveHint() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+
+ namedQuery.addHint(0).setName("BAZ");
+
+ assertEquals("BAZ", namedQuery.hintAt(0).getName());
+ assertEquals("BAR", namedQuery.hintAt(1).getName());
+ assertNull(namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+
+ namedQuery.moveHint(2, 0);
+
+ assertEquals("BAR", namedQuery.hintAt(0).getName());
+ assertNull(namedQuery.hintAt(1).getName());
+ assertEquals("BAZ", namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+ assertSourceContains("@NamedNativeQueries(@NamedNativeQuery(hints={@QueryHint(name=\"BAR\", value=\"FOO\"), @QueryHint, @QueryHint(name=\"BAZ\")}))");
+ }
+
+ public void testMoveHint2() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next();
+
+ namedQuery.addHint(0).setName("BAZ");
+
+ assertEquals("BAZ", namedQuery.hintAt(0).getName());
+ assertEquals("BAR", namedQuery.hintAt(1).getName());
+ assertNull(namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+
+ namedQuery.moveHint(0, 2);
+
+ assertNull(namedQuery.hintAt(0).getName());
+ assertEquals("BAZ", namedQuery.hintAt(1).getName());
+ assertEquals("BAR", namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+ assertSourceContains("@NamedNativeQueries(@NamedNativeQuery(hints={@QueryHint, @QueryHint(name=\"BAZ\"), @QueryHint(name=\"BAR\", value=\"FOO\")}))");
+ }
+
+ public void testAddNamedNativeQueryCopyExisting() throws Exception {
+ IType jdtType = createTestNamedNativeQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.addAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES);
+ namedQuery.setName("BAR");
+ assertSourceContains("@NamedNativeQueries({@NamedNativeQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\"),@NamedNativeQuery(name=\"BAR\")})");
+
+ assertNull(typeResource.annotation(JPA.NAMED_NATIVE_QUERY));
+ assertNotNull(typeResource.annotation(JPA.NAMED_NATIVE_QUERIES));
+ assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES)));
+ }
+
+ public void testAddNamedNativeQueryToBeginningOfList() throws Exception {
+ IType jdtType = createTestNamedNativeQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.addAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES);
+ namedQuery.setName("BAR");
+ assertSourceContains("@NamedNativeQueries({@NamedNativeQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\"),@NamedNativeQuery(name=\"BAR\")})");
+
+ namedQuery = (NamedNativeQuery) typeResource.addAnnotation(0, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES);
+ namedQuery.setName("BAZ");
+ assertSourceContains("@NamedNativeQueries({@NamedNativeQuery(name=\"BAZ\"),@NamedNativeQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\"), @NamedNativeQuery(name=\"BAR\")})");
+
+ Iterator<JavaResource> namedQueries = typeResource.annotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES);
+ assertEquals("BAZ", ((NamedNativeQuery) namedQueries.next()).getName());
+ assertEquals("foo", ((NamedNativeQuery) namedQueries.next()).getName());
+ assertEquals("BAR", ((NamedNativeQuery) namedQueries.next()).getName());
+
+ assertNull(typeResource.annotation(JPA.NAMED_NATIVE_QUERY));
+ assertNotNull(typeResource.annotation(JPA.NAMED_NATIVE_QUERIES));
+ assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES)));
+ }
+
+ public void testRemoveNamedNativeQueryCopyExisting() throws Exception {
+ IType jdtType = createTestNamedNativeQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.addAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES);
+ namedQuery.setName("BAR");
+ assertSourceContains("@NamedNativeQueries({@NamedNativeQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\"),@NamedNativeQuery(name=\"BAR\")})");
+
+ typeResource.removeAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES);
+ assertSourceContains("@NamedNativeQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\")");
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueryTests.java
new file mode 100644
index 0000000000..2385a10a72
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueryTests.java
@@ -0,0 +1,367 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.NamedNativeQuery;
+import org.eclipse.jpt.core.internal.resource.java.QueryHint;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class NamedNativeQueryTests extends JavaResourceModelTestCase {
+
+ private static final String QUERY_NAME = "myQuery";
+ private static final String QUERY_QUERY = "SELECT name FROM Employee";
+ private static final String QUERY_RESULT_CLASS = "Result";
+ private static final String QUERY_RESULT_SET_MAPPING = "resultSetMapping";
+
+ public NamedNativeQueryTests(String name) {
+ super(name);
+ }
+
+ private void createNamedNativeQueryAnnotation() throws Exception {
+ createQueryHintAnnotation();
+ this.createAnnotationAndMembers("NamedNativeQuery", "String name(); " +
+ "String query();" +
+ "QueryHint[] hints() default{};");
+ }
+
+ private void createQueryHintAnnotation() throws Exception {
+ this.createAnnotationAndMembers("QueryHint", "String name(); " +
+ "String value();");
+ }
+
+ private IType createTestNamedNativeQuery() throws Exception {
+ createNamedNativeQueryAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedNativeQuery");
+ }
+ });
+ }
+
+ private IType createTestNamedNativeQueryWithName() throws Exception {
+ return createTestNamedNativeQueryWithStringElement("name", QUERY_NAME);
+ }
+
+ private IType createTestNamedNativeQueryWithQuery() throws Exception {
+ return createTestNamedNativeQueryWithStringElement("query", QUERY_QUERY);
+ }
+
+ private IType createTestNamedNativeQueryWithResultSetMapping() throws Exception {
+ return createTestNamedNativeQueryWithStringElement("resultSetMapping", QUERY_RESULT_SET_MAPPING);
+ }
+
+
+ private IType createTestNamedNativeQueryWithStringElement(final String elementName, final String value) throws Exception {
+ createNamedNativeQueryAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedNativeQuery(" + elementName + "=\"" + value + "\")");
+ }
+ });
+ }
+
+ private IType createTestNamedNativeQueryWithResultClass() throws Exception {
+ createNamedNativeQueryAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedNativeQuery(resultClass=" + QUERY_RESULT_CLASS + ".class)");
+ }
+ });
+ }
+ private IType createTestNamedNativeQueryWithQueryHints() throws Exception {
+ createNamedNativeQueryAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_NATIVE_QUERY, JPA.QUERY_HINT);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedNativeQuery(hints={@QueryHint(name=\"BAR\", value=\"FOO\"), @QueryHint})");
+ }
+ });
+ }
+
+ public void testNamedNativeQuery() throws Exception {
+ IType testType = this.createTestNamedNativeQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+ assertNotNull(namedQuery);
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+ assertEquals(QUERY_NAME, namedQuery.getName());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+ assertEquals(QUERY_NAME, namedQuery.getName());
+
+ namedQuery.setName("foo");
+ assertEquals("foo", namedQuery.getName());
+
+ assertSourceContains("@NamedNativeQuery(name=\"foo\")");
+
+ namedQuery.setName(null);
+ assertNull(namedQuery.getName());
+
+ assertSourceDoesNotContain("@NamedNativeQuery");
+ }
+
+ public void testGetQuery() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+ assertEquals(QUERY_QUERY, namedQuery.getQuery());
+ }
+
+ public void testSetQuery() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+ assertEquals(QUERY_QUERY, namedQuery.getQuery());
+
+ namedQuery.setQuery("foo");
+ assertEquals("foo", namedQuery.getQuery());
+
+ assertSourceContains("@NamedNativeQuery(query=\"foo\")");
+
+ namedQuery.setQuery(null);
+ assertNull(namedQuery.getQuery());
+
+ assertSourceDoesNotContain("@NamedNativeQuery");
+ }
+
+ public void testGetResultClass() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithResultClass();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+ assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass());
+ }
+
+ public void testSetResultClass() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithResultClass();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+ assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass());
+
+ namedQuery.setResultClass("foo");
+ assertEquals("foo", namedQuery.getResultClass());
+
+ assertSourceContains("@NamedNativeQuery(resultClass=foo.class)");
+
+ namedQuery.setResultClass(null);
+ assertNull(namedQuery.getResultClass());
+
+ assertSourceDoesNotContain("@NamedNativeQuery");
+ }
+
+ public void testGetFullyQualifiedClass() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithResultClass();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+ assertNotNull(namedQuery.getResultClass());
+ assertNull(namedQuery.getFullyQualifiedResultClass());
+
+ namedQuery.setResultClass(TYPE_NAME);
+ typeResource.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ assertEquals(FULLY_QUALIFIED_TYPE_NAME, namedQuery.getFullyQualifiedResultClass());
+ assertSourceContains("@NamedNativeQuery(resultClass=" + TYPE_NAME + ".class)");
+ }
+
+ public void testGetResultSetMapping() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithResultSetMapping();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+ assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping());
+ }
+
+ public void testSetResultSetMapping() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithResultSetMapping();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+ assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping());
+
+ namedQuery.setResultSetMapping("foo");
+ assertEquals("foo", namedQuery.getResultSetMapping());
+
+ assertSourceContains("@NamedNativeQuery(resultSetMapping=\"foo\")");
+
+ namedQuery.setResultSetMapping(null);
+ assertNull(namedQuery.getResultSetMapping());
+
+ assertSourceDoesNotContain("@NamedNativeQuery");
+ }
+
+ public void testHints() throws Exception {
+ IType testType = this.createTestNamedNativeQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+
+ ListIterator<QueryHint> iterator = namedQuery.hints();
+
+ assertEquals(0, CollectionTools.size(iterator));
+ }
+
+ public void testHints2() throws Exception {
+ IType testType = this.createTestNamedNativeQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+
+ namedQuery.addHint(0);
+ namedQuery.addHint(1);
+ namedQuery.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ ListIterator<QueryHint> iterator = namedQuery.hints();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testHints3() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+
+ ListIterator<QueryHint> iterator = namedQuery.hints();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+
+ public void testAddHint() throws Exception {
+ IType testType = this.createTestNamedNativeQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+
+ namedQuery.addHint(0).setName("FOO");
+ namedQuery.addHint(1);
+ namedQuery.addHint(0).setName("BAR");
+
+ assertEquals("BAR", namedQuery.hintAt(0).getName());
+ assertEquals("FOO", namedQuery.hintAt(1).getName());
+ assertNull(namedQuery.hintAt(2).getName());
+ assertSourceContains("@NamedNativeQuery(hints={@QueryHint(name=\"BAR\"),@QueryHint(name=\"FOO\"), @QueryHint})");
+ }
+
+ public void testRemoveHint() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+ namedQuery.addHint(0).setName("BAZ");
+
+ assertEquals("BAZ", namedQuery.hintAt(0).getName());
+ assertEquals("BAR", namedQuery.hintAt(1).getName());
+ assertNull(namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+
+ namedQuery.removeHint(2);
+ assertEquals("BAZ", namedQuery.hintAt(0).getName());
+ assertEquals("BAR", namedQuery.hintAt(1).getName());
+ assertEquals(2, namedQuery.hintsSize());
+ assertSourceContains("@NamedNativeQuery(hints={@QueryHint(name=\"BAZ\"), @QueryHint(name=\"BAR\", value=\"FOO\")})");
+
+ namedQuery.removeHint(0);
+ assertEquals("BAR", namedQuery.hintAt(0).getName());
+ assertEquals(1, namedQuery.hintsSize());
+ assertSourceContains("@NamedNativeQuery(hints=@QueryHint(name=\"BAR\", value=\"FOO\"))");
+
+
+ namedQuery.removeHint(0);
+ assertEquals(0, namedQuery.hintsSize());
+ assertSourceDoesNotContain("@NamedNativeQuery");
+ }
+
+ public void testMoveHint() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+
+ namedQuery.addHint(0).setName("BAZ");
+
+ assertEquals("BAZ", namedQuery.hintAt(0).getName());
+ assertEquals("BAR", namedQuery.hintAt(1).getName());
+ assertNull(namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+
+ namedQuery.moveHint(2, 0);
+
+ assertEquals("BAR", namedQuery.hintAt(0).getName());
+ assertNull(namedQuery.hintAt(1).getName());
+ assertEquals("BAZ", namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+ assertSourceContains("@NamedNativeQuery(hints={@QueryHint(name=\"BAR\", value=\"FOO\"), @QueryHint, @QueryHint(name=\"BAZ\")})");
+ }
+
+ public void testMoveHint2() throws Exception {
+ IType testType = this.createTestNamedNativeQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY);
+ namedQuery.addHint(0).setName("BAZ");
+
+ assertEquals("BAZ", namedQuery.hintAt(0).getName());
+ assertEquals("BAR", namedQuery.hintAt(1).getName());
+ assertNull(namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+
+ namedQuery.moveHint(0, 2);
+
+ assertNull(namedQuery.hintAt(0).getName());
+ assertEquals("BAZ", namedQuery.hintAt(1).getName());
+ assertEquals("BAR", namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+ assertSourceContains("@NamedNativeQuery(hints={@QueryHint, @QueryHint(name=\"BAZ\"), @QueryHint(name=\"BAR\", value=\"FOO\")})");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueriesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueriesTests.java
new file mode 100644
index 0000000000..9884843a5d
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueriesTests.java
@@ -0,0 +1,361 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.NamedQueries;
+import org.eclipse.jpt.core.internal.resource.java.NamedQuery;
+import org.eclipse.jpt.core.internal.resource.java.QueryHint;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class NamedQueriesTests extends JavaResourceModelTestCase {
+
+ private static final String QUERY_NAME = "myQuery";
+ private static final String QUERY_QUERY = "SELECT name FROM Employee";
+
+ public NamedQueriesTests(String name) {
+ super(name);
+ }
+
+ private void createNamedQueryAnnotation() throws Exception {
+ createQueryHintAnnotation();
+ this.createAnnotationAndMembers("NamedQuery", "String name(); " +
+ "String query();" +
+ "QueryHint[] hints() default{};");
+ }
+
+ private void createNamedQueriesAnnotation() throws Exception {
+ createNamedQueryAnnotation();
+ this.createAnnotationAndMembers("NamedQueries",
+ "NamedQuery[] value();");
+ }
+
+ private void createQueryHintAnnotation() throws Exception {
+ this.createAnnotationAndMembers("QueryHint", "String name(); " +
+ "String value();");
+ }
+
+ private IType createTestNamedQueries() throws Exception {
+ createNamedQueriesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_QUERIES, JPA.NAMED_QUERY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedQueries(@NamedQuery)");
+ }
+ });
+ }
+
+ private IType createTestNamedQueryWithName() throws Exception {
+ return createTestNamedQueryWithStringElement("name", QUERY_NAME);
+ }
+
+ private IType createTestNamedQueryWithQuery() throws Exception {
+ return createTestNamedQueryWithStringElement("query", QUERY_QUERY);
+ }
+
+ private IType createTestNamedQueryWithStringElement(final String elementName, final String value) throws Exception {
+ createNamedQueriesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_QUERIES, JPA.NAMED_QUERY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedQueries(@NamedQuery(" + elementName + "=\"" + value + "\"))");
+ }
+ });
+ }
+
+ private IType createTestNamedQueryWithQueryHints() throws Exception {
+ createNamedQueriesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_QUERIES, JPA.NAMED_QUERY, JPA.QUERY_HINT);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedQueries(@NamedQuery(hints={@QueryHint(name=\"BAR\", value=\"FOO\"), @QueryHint}))");
+ }
+ });
+ }
+
+
+ private IType createTestNamedQuery() throws Exception {
+ createNamedQueryAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_QUERY, JPA.QUERY_HINT);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedQuery(name=\"foo\", query=\"bar\", hints=@QueryHint(name=\"BAR\", value=\"FOO\"))");
+ }
+ });
+ }
+
+ public void testNamedQuery() throws Exception {
+ IType testType = this.createTestNamedQueries();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES);
+ NamedQuery namedQuery = namedQueries.nestedAnnotations().next();
+ assertNotNull(namedQuery);
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestNamedQueryWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES);
+ NamedQuery namedQuery = namedQueries.nestedAnnotations().next();
+ assertEquals(QUERY_NAME, namedQuery.getName());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestNamedQueryWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES);
+ NamedQuery namedQuery = namedQueries.nestedAnnotations().next();
+ assertEquals(QUERY_NAME, namedQuery.getName());
+
+ namedQuery.setName("foo");
+ assertEquals("foo", namedQuery.getName());
+
+ assertSourceContains("@NamedQuery(name=\"foo\")");
+
+ namedQuery.setName(null);
+ assertNull(namedQuery.getName());
+
+ assertSourceDoesNotContain("@NamedQuery");
+ }
+
+ public void testGetQuery() throws Exception {
+ IType testType = this.createTestNamedQueryWithQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES);
+ NamedQuery namedQuery = namedQueries.nestedAnnotations().next();
+ assertEquals(QUERY_QUERY, namedQuery.getQuery());
+ }
+
+ public void testSetQuery() throws Exception {
+ IType testType = this.createTestNamedQueryWithQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES);
+ NamedQuery namedQuery = namedQueries.nestedAnnotations().next();
+ assertEquals(QUERY_QUERY, namedQuery.getQuery());
+
+ namedQuery.setQuery("foo");
+ assertEquals("foo", namedQuery.getQuery());
+
+ assertSourceContains("@NamedQuery(query=\"foo\")");
+
+ namedQuery.setQuery(null);
+ assertNull(namedQuery.getQuery());
+
+ assertSourceDoesNotContain("@NamedQuery");
+ }
+
+ public void testHints() throws Exception {
+ IType testType = this.createTestNamedQueries();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES);
+ NamedQuery namedQuery = namedQueries.nestedAnnotations().next();
+
+ ListIterator<QueryHint> iterator = namedQuery.hints();
+
+ assertEquals(0, CollectionTools.size(iterator));
+ }
+
+ public void testHints2() throws Exception {
+ IType testType = this.createTestNamedQueries();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES);
+ NamedQuery namedQuery = namedQueries.nestedAnnotations().next();
+
+ namedQuery.addHint(0);
+ namedQuery.addHint(1);
+ namedQuery.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ ListIterator<QueryHint> iterator = namedQuery.hints();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testHints3() throws Exception {
+ IType testType = this.createTestNamedQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES);
+ NamedQuery namedQuery = namedQueries.nestedAnnotations().next();
+
+ ListIterator<QueryHint> iterator = namedQuery.hints();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testAddHint() throws Exception {
+ IType testType = this.createTestNamedQueries();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES);
+ NamedQuery namedQuery = namedQueries.nestedAnnotations().next();
+
+ namedQuery.addHint(0).setName("FOO");
+ namedQuery.addHint(1);
+ namedQuery.addHint(0).setName("BAR");
+
+ assertEquals("BAR", namedQuery.hintAt(0).getName());
+ assertEquals("FOO", namedQuery.hintAt(1).getName());
+ assertNull(namedQuery.hintAt(2).getName());
+
+ assertSourceContains("@NamedQuery(hints={@QueryHint(name=\"BAR\"),@QueryHint(name=\"FOO\"), @QueryHint})");
+ }
+
+ public void testRemoveHint() throws Exception {
+ IType testType = this.createTestNamedQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES);
+ NamedQuery namedQuery = namedQueries.nestedAnnotations().next();
+ namedQuery.addHint(0).setName("BAZ");
+
+ assertEquals("BAZ", namedQuery.hintAt(0).getName());
+ assertEquals("BAR", namedQuery.hintAt(1).getName());
+ assertNull(namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+
+ namedQuery.removeHint(2);
+ assertEquals("BAZ", namedQuery.hintAt(0).getName());
+ assertEquals("BAR", namedQuery.hintAt(1).getName());
+ assertEquals(2, namedQuery.hintsSize());
+ assertSourceContains("@NamedQueries(@NamedQuery(hints={@QueryHint(name=\"BAZ\"), @QueryHint(name=\"BAR\", value=\"FOO\")}))");
+
+ namedQuery.removeHint(0);
+ assertEquals("BAR", namedQuery.hintAt(0).getName());
+ assertEquals(1, namedQuery.hintsSize());
+ assertSourceContains("@NamedQueries(@NamedQuery(hints=@QueryHint(name=\"BAR\", value=\"FOO\")))");
+
+ namedQuery.removeHint(0);
+ assertEquals(0, namedQuery.hintsSize());
+ assertSourceDoesNotContain("@NamedQueries");
+ }
+
+ public void testMoveHint() throws Exception {
+ IType testType = this.createTestNamedQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES);
+ NamedQuery namedQuery = namedQueries.nestedAnnotations().next();
+ namedQuery.addHint(0).setName("BAZ");
+
+ assertEquals("BAZ", namedQuery.hintAt(0).getName());
+ assertEquals("BAR", namedQuery.hintAt(1).getName());
+ assertNull(namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+
+ namedQuery.moveHint(2, 0);
+
+ assertEquals("BAR", namedQuery.hintAt(0).getName());
+ assertNull(namedQuery.hintAt(1).getName());
+ assertEquals("BAZ", namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+ assertSourceContains("@NamedQueries(@NamedQuery(hints={@QueryHint(name=\"BAR\", value=\"FOO\"), @QueryHint, @QueryHint(name=\"BAZ\")}))");
+ }
+
+ public void testMoveHint2() throws Exception {
+ IType testType = this.createTestNamedQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES);
+ NamedQuery namedQuery = namedQueries.nestedAnnotations().next();
+ namedQuery.addHint(0).setName("BAZ");
+
+ assertEquals("BAZ", namedQuery.hintAt(0).getName());
+ assertEquals("BAR", namedQuery.hintAt(1).getName());
+ assertNull(namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+
+ namedQuery.moveHint(0, 2);
+
+ assertNull(namedQuery.hintAt(0).getName());
+ assertEquals("BAZ", namedQuery.hintAt(1).getName());
+ assertEquals("BAR", namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+ assertSourceContains("@NamedQueries(@NamedQuery(hints={@QueryHint, @QueryHint(name=\"BAZ\"), @QueryHint(name=\"BAR\", value=\"FOO\")}))");
+ }
+
+ public void testAddNamedQueryCopyExisting() throws Exception {
+ IType jdtType = createTestNamedQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.addAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES);
+ namedQuery.setName("BAR");
+ assertSourceContains("@NamedQueries({@NamedQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\")),@NamedQuery(name=\"BAR\")})");
+
+ assertNull(typeResource.annotation(JPA.NAMED_QUERY));
+ assertNotNull(typeResource.annotation(JPA.NAMED_QUERIES));
+ assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES)));
+ }
+
+ public void testAddNamedQueryToBeginningOfList() throws Exception {
+ IType jdtType = createTestNamedQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.addAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES);
+ namedQuery.setName("BAR");
+ assertSourceContains("@NamedQueries({@NamedQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\")),@NamedQuery(name=\"BAR\")})");
+
+
+ namedQuery = (NamedQuery) typeResource.addAnnotation(0, JPA.NAMED_QUERY, JPA.NAMED_QUERIES);
+ namedQuery.setName("BAZ");
+ assertSourceContains("@NamedQueries({@NamedQuery(name=\"BAZ\"),@NamedQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\")), @NamedQuery(name=\"BAR\")})");
+
+ Iterator<JavaResource> namedQueries = typeResource.annotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES);
+ assertEquals("BAZ", ((NamedQuery) namedQueries.next()).getName());
+ assertEquals("foo", ((NamedQuery) namedQueries.next()).getName());
+ assertEquals("BAR", ((NamedQuery) namedQueries.next()).getName());
+
+ assertNull(typeResource.annotation(JPA.NAMED_QUERY));
+ assertNotNull(typeResource.annotation(JPA.NAMED_QUERIES));
+ assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES)));
+ }
+
+ public void testRemoveNamedQueryCopyExisting() throws Exception {
+ IType jdtType = createTestNamedQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.addAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES);
+ namedQuery.setName("BAR");
+ assertSourceContains("@NamedQueries({@NamedQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\")),@NamedQuery(name=\"BAR\")})");
+
+ typeResource.removeAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES);
+ assertSourceContains("@NamedQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\"))");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueryTests.java
new file mode 100644
index 0000000000..5b9c9a0f03
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueryTests.java
@@ -0,0 +1,282 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.NamedQuery;
+import org.eclipse.jpt.core.internal.resource.java.QueryHint;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class NamedQueryTests extends JavaResourceModelTestCase {
+
+ private static final String QUERY_NAME = "myQuery";
+ private static final String QUERY_QUERY = "SELECT name FROM Employee";
+
+ public NamedQueryTests(String name) {
+ super(name);
+ }
+
+ private void createNamedQueryAnnotation() throws Exception {
+ createQueryHintAnnotation();
+ this.createAnnotationAndMembers("NamedQuery", "String name(); " +
+ "String query();" +
+ "QueryHint[] hints() default{};");
+ }
+
+ private void createQueryHintAnnotation() throws Exception {
+ this.createAnnotationAndMembers("QueryHint", "String name(); " +
+ "String value();");
+ }
+
+ private IType createTestNamedQuery() throws Exception {
+ createNamedQueryAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_QUERY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedQuery");
+ }
+ });
+ }
+
+ private IType createTestNamedQueryWithName() throws Exception {
+ return createTestNamedQueryWithStringElement("name", QUERY_NAME);
+ }
+
+ private IType createTestNamedQueryWithQuery() throws Exception {
+ return createTestNamedQueryWithStringElement("query", QUERY_QUERY);
+ }
+
+ private IType createTestNamedQueryWithStringElement(final String elementName, final String value) throws Exception {
+ createNamedQueryAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_QUERY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedQuery(" + elementName + "=\"" + value + "\")");
+ }
+ });
+ }
+
+ private IType createTestNamedQueryWithQueryHints() throws Exception {
+ createNamedQueryAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_QUERY, JPA.QUERY_HINT);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedQuery(hints={@QueryHint(name=\"BAR\", value=\"FOO\"), @QueryHint})");
+ }
+ });
+ }
+
+ public void testNamedQuery() throws Exception {
+ IType testType = this.createTestNamedQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY);
+ assertNotNull(namedQuery);
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestNamedQueryWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY);
+ assertEquals(QUERY_NAME, namedQuery.getName());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestNamedQueryWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY);
+ assertEquals(QUERY_NAME, namedQuery.getName());
+
+ namedQuery.setName("foo");
+ assertEquals("foo", namedQuery.getName());
+
+ assertSourceContains("@NamedQuery(name=\"foo\")");
+
+ namedQuery.setName(null);
+ assertNull(namedQuery.getName());
+
+ assertSourceDoesNotContain("@NamedQuery");
+ }
+
+ public void testGetQuery() throws Exception {
+ IType testType = this.createTestNamedQueryWithQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY);
+ assertEquals(QUERY_QUERY, namedQuery.getQuery());
+ }
+
+ public void testSetQuery() throws Exception {
+ IType testType = this.createTestNamedQueryWithQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY);
+ assertEquals(QUERY_QUERY, namedQuery.getQuery());
+
+ namedQuery.setQuery("foo");
+ assertEquals("foo", namedQuery.getQuery());
+
+ assertSourceContains("@NamedQuery(query=\"foo\")");
+
+ namedQuery.setQuery(null);
+ assertNull(namedQuery.getQuery());
+
+ assertSourceDoesNotContain("@NamedQuery");
+ }
+
+ public void testHints() throws Exception {
+ IType testType = this.createTestNamedQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY);
+
+ ListIterator<QueryHint> iterator = namedQuery.hints();
+
+ assertEquals(0, CollectionTools.size(iterator));
+ }
+
+ public void testHints2() throws Exception {
+ IType testType = this.createTestNamedQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY);
+
+ namedQuery.addHint(0);
+ namedQuery.addHint(1);
+ namedQuery.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ ListIterator<QueryHint> iterator = namedQuery.hints();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testHints3() throws Exception {
+ IType testType = this.createTestNamedQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY);
+
+ ListIterator<QueryHint> iterator = namedQuery.hints();
+
+ assertEquals(2, CollectionTools.size(iterator));
+
+ iterator = namedQuery.hints();
+ assertEquals("BAR", iterator.next().getName());
+ assertNull(iterator.next().getName());
+ }
+
+ public void testAddHint() throws Exception {
+ IType testType = this.createTestNamedQuery();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY);
+
+ namedQuery.addHint(0).setName("FOO");
+ namedQuery.addHint(1);
+ QueryHint queryHint = namedQuery.addHint(0);
+ queryHint.setName("BAR");
+
+ assertEquals("BAR", namedQuery.hintAt(0).getName());
+ assertEquals("FOO", namedQuery.hintAt(1).getName());
+ assertNull(namedQuery.hintAt(2).getName());
+ assertSourceContains("@NamedQuery(hints={@QueryHint(name=\"BAR\"),@QueryHint(name=\"FOO\"), @QueryHint})");
+ }
+
+ public void testRemoveHint() throws Exception {
+ IType testType = this.createTestNamedQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY);
+ namedQuery.addHint(0).setName("BAZ");
+
+ assertEquals("BAZ", namedQuery.hintAt(0).getName());
+ assertEquals("BAR", namedQuery.hintAt(1).getName());
+ assertNull(namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+
+ namedQuery.removeHint(2);
+ assertEquals("BAZ", namedQuery.hintAt(0).getName());
+ assertEquals("BAR", namedQuery.hintAt(1).getName());
+ assertEquals(2, namedQuery.hintsSize());
+ assertSourceContains("@NamedQuery(hints={@QueryHint(name=\"BAZ\"), @QueryHint(name=\"BAR\", value=\"FOO\")})");
+
+ namedQuery.removeHint(0);
+ assertEquals("BAR", namedQuery.hintAt(0).getName());
+ assertEquals(1, namedQuery.hintsSize());
+ assertSourceContains("@NamedQuery(hints=@QueryHint(name=\"BAR\", value=\"FOO\"))");
+
+ namedQuery.removeHint(0);
+ assertEquals(0, namedQuery.hintsSize());
+ assertSourceDoesNotContain("@NamedQuery");
+ }
+
+ public void testMoveHint() throws Exception {
+ IType testType = this.createTestNamedQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY);
+ namedQuery.addHint(0).setName("BAZ");
+
+ assertEquals("BAZ", namedQuery.hintAt(0).getName());
+ assertEquals("BAR", namedQuery.hintAt(1).getName());
+ assertNull(namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+
+ namedQuery.moveHint(2, 0);
+
+ assertEquals("BAR", namedQuery.hintAt(0).getName());
+ assertNull(namedQuery.hintAt(1).getName());
+ assertEquals("BAZ", namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+ assertSourceContains("@NamedQuery(hints={@QueryHint(name=\"BAR\", value=\"FOO\"), @QueryHint, @QueryHint(name=\"BAZ\")})");
+ }
+
+ public void testMoveHint2() throws Exception {
+ IType testType = this.createTestNamedQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY);
+ namedQuery.addHint(0).setName("BAZ");
+
+ assertEquals("BAZ", namedQuery.hintAt(0).getName());
+ assertEquals("BAR", namedQuery.hintAt(1).getName());
+ assertNull(namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+
+ namedQuery.moveHint(0, 2);
+
+ assertNull(namedQuery.hintAt(0).getName());
+ assertEquals("BAZ", namedQuery.hintAt(1).getName());
+ assertEquals("BAR", namedQuery.hintAt(2).getName());
+ assertEquals(3, namedQuery.hintsSize());
+ assertSourceContains("@NamedQuery(hints={@QueryHint, @QueryHint(name=\"BAZ\"), @QueryHint(name=\"BAR\", value=\"FOO\")})");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToManyTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToManyTests.java
new file mode 100644
index 0000000000..59f53e5de8
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToManyTests.java
@@ -0,0 +1,415 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.FetchType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.OneToMany;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class OneToManyTests extends JavaResourceModelTestCase {
+
+ public OneToManyTests(String name) {
+ super(name);
+ }
+
+ private IType createTestOneToMany() throws Exception {
+ this.createAnnotationAndMembers("OneToMany", "FetchType fetch() default FetchType.LAZY; CascadeType[] cascade() default = {};");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ONE_TO_MANY);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToMany");
+ }
+ });
+ }
+
+ private IType createTestOneToManyWithFetch() throws Exception {
+ this.createAnnotationAndMembers("OneToMany", "FetchType fetch() default FetchType.LAZY;");
+ this.createEnumAndMembers("FetchType", "EAGER, LAZY");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ONE_TO_MANY, JPA.FETCH_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToMany(fetch=FetchType.EAGER)");
+ }
+ });
+ }
+
+ private IType createTestOneToManyWithTargetEntity() throws Exception {
+ this.createAnnotationAndMembers("OneToMany", "Class targetEntity() default void.class;");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ONE_TO_MANY);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToMany(targetEntity=AnnotationTestType.class)");
+ }
+ });
+ }
+
+ private IType createTestOneToManyWithMappedBy() throws Exception {
+ this.createAnnotationAndMembers("OneToMany", "String mappedBy() default\"\";");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ONE_TO_MANY);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToMany(mappedBy=\"foo\")");
+ }
+ });
+ }
+
+ private IType createTestOneToManyWithCascade() throws Exception {
+ this.createAnnotationAndMembers("OneToMany", "CascadeType[] cascade() default = {};");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ONE_TO_MANY, JPA.CASCADE_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToMany(cascade=CascadeType.ALL)");
+ }
+ });
+ }
+
+ private IType createTestOneToManyWithMultipleCascade() throws Exception {
+ this.createAnnotationAndMembers("OneToMany", "CascadeType[] cascade() default = {};");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ONE_TO_MANY, JPA.CASCADE_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToMany(cascade={CascadeType.MERGE, CascadeType.REMOVE})");
+ }
+ });
+ }
+
+ private IType createTestOneToManyWithDuplicateCascade() throws Exception {
+ this.createAnnotationAndMembers("OneToMany", "CascadeType[] cascade() default = {};");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ONE_TO_MANY, JPA.CASCADE_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToMany(cascade={CascadeType.MERGE, CascadeType.MERGE})");
+ }
+ });
+ }
+
+ public void testOneToMany() throws Exception {
+ IType testType = this.createTestOneToMany();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertNotNull(oneToMany);
+ }
+
+ public void testGetFetch() throws Exception {
+ IType testType = this.createTestOneToManyWithFetch();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertEquals(FetchType.EAGER, oneToMany.getFetch());
+ }
+
+ public void testSetFetch() throws Exception {
+ IType testType = this.createTestOneToManyWithFetch();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertEquals(FetchType.EAGER, oneToMany.getFetch());
+
+ oneToMany.setFetch(FetchType.LAZY);
+ assertEquals(FetchType.LAZY, oneToMany.getFetch());
+
+ assertSourceContains("@OneToMany(fetch=LAZY)");
+ }
+
+ public void testSetFetchNull() throws Exception {
+ IType testType = this.createTestOneToManyWithFetch();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertEquals(FetchType.EAGER, oneToMany.getFetch());
+
+ oneToMany.setFetch(null);
+ assertNull(oneToMany.getFetch());
+
+ assertSourceContains("@OneToMany");
+ assertSourceDoesNotContain("fetch");
+ }
+
+
+ public void testGetTargetEntity() throws Exception {
+ IType testType = this.createTestOneToManyWithTargetEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertEquals(TYPE_NAME, oneToMany.getTargetEntity());
+ }
+
+ public void testSetTargetEntity() throws Exception {
+ IType testType = this.createTestOneToManyWithTargetEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertEquals(TYPE_NAME, oneToMany.getTargetEntity());
+
+ oneToMany.setTargetEntity("Foo");
+
+ assertSourceContains("@OneToMany(targetEntity=Foo.class)");
+ }
+
+ public void testSetTargetEntityNull() throws Exception {
+ IType testType = this.createTestOneToManyWithTargetEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertEquals(TYPE_NAME, oneToMany.getTargetEntity());
+
+ oneToMany.setTargetEntity(null);
+
+ assertSourceContains("@OneToMany");
+ assertSourceDoesNotContain("targetEntity");
+ }
+
+
+ public void testGetFullyQualifiedTargetEntity() throws Exception {
+ IType testType = this.createTestOneToManyWithTargetEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertEquals(FULLY_QUALIFIED_TYPE_NAME, oneToMany.getFullyQualifiedTargetEntity());
+
+ oneToMany.setTargetEntity("Foo");
+
+ assertSourceContains("@OneToMany(targetEntity=Foo.class)");
+
+ typeResource.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertEquals("Foo", oneToMany.getTargetEntity());
+
+ assertNull(oneToMany.getFullyQualifiedTargetEntity());
+ }
+
+ public void testGetMappedBy() throws Exception {
+ IType testType = this.createTestOneToManyWithMappedBy();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertEquals("foo", oneToMany.getMappedBy());
+ }
+
+
+ public void testGetMappedByNull() throws Exception {
+ IType testType = this.createTestOneToMany();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertEquals(null, oneToMany.getMappedBy());
+ }
+
+ public void testSetMappedBy() throws Exception {
+ IType testType = this.createTestOneToMany();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertNull(oneToMany.getMappedBy());
+ oneToMany.setMappedBy("bar");
+ assertEquals("bar", oneToMany.getMappedBy());
+
+ assertSourceContains("@OneToMany(mappedBy=\"bar\")");
+ }
+
+ public void testSetMappedByNull() throws Exception {
+ IType testType = this.createTestOneToManyWithMappedBy();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertEquals("foo", oneToMany.getMappedBy());
+
+ oneToMany.setMappedBy(null);
+ assertNull(oneToMany.getMappedBy());
+
+ assertSourceContains("@OneToMany");
+ assertSourceDoesNotContain("mappedBy");
+ }
+
+ public void testSetCascadeAll() throws Exception {
+ IType testType = this.createTestOneToMany();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertFalse(oneToMany.isCascadeAll());
+
+ oneToMany.setCascadeAll(true);
+ assertSourceContains("@OneToMany(cascade=ALL)");
+
+ oneToMany.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(oneToMany.isCascadeAll());
+ }
+
+ public void testSetCascadeMerge() throws Exception {
+ IType testType = this.createTestOneToMany();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertFalse(oneToMany.isCascadeMerge());
+
+ oneToMany.setCascadeMerge(true);
+ assertSourceContains("@OneToMany(cascade=MERGE)");
+
+ oneToMany.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(oneToMany.isCascadeMerge());
+ }
+
+ public void testSetCascadePersist() throws Exception {
+ IType testType = this.createTestOneToMany();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertFalse(oneToMany.isCascadePersist());
+
+ oneToMany.setCascadePersist(true);
+ assertSourceContains("@OneToMany(cascade=PERSIST)");
+
+ oneToMany.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(oneToMany.isCascadePersist());
+ }
+
+ public void testSetCascadeRemove() throws Exception {
+ IType testType = this.createTestOneToMany();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertFalse(oneToMany.isCascadeRemove());
+
+ oneToMany.setCascadeRemove(true);
+ assertSourceContains("@OneToMany(cascade=REMOVE)");
+
+ oneToMany.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(oneToMany.isCascadeRemove());
+ }
+
+ public void testSetCascadeRefresh() throws Exception {
+ IType testType = this.createTestOneToMany();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertFalse(oneToMany.isCascadeRefresh());
+
+ oneToMany.setCascadeRefresh(true);
+ assertSourceContains("@OneToMany(cascade=REFRESH)");
+
+ oneToMany.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(oneToMany.isCascadeRefresh());
+ }
+
+ public void testCascadeMoreThanOnce() throws Exception {
+ IType testType = this.createTestOneToManyWithCascade();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertTrue(oneToMany.isCascadeAll());
+
+ oneToMany.setCascadeAll(true);
+ assertTrue(oneToMany.isCascadeAll());
+ //a second CascadeType.All should not have been added
+ assertSourceContains("@OneToMany(cascade=CascadeType.ALL)");
+
+ oneToMany.setCascadeAll(false);
+ assertFalse(oneToMany.isCascadeAll());
+
+ assertSourceDoesNotContain("cascade");
+
+ //test setting cascadeAll to false again, should just do nothing
+ oneToMany.setCascadeAll(false);
+ assertFalse(oneToMany.isCascadeAll());
+
+ assertSourceDoesNotContain("cascade");
+ }
+
+ public void testDuplicateCascade() throws Exception {
+ IType testType = this.createTestOneToManyWithDuplicateCascade();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertTrue(oneToMany.isCascadeMerge());
+
+ oneToMany.setCascadeMerge(false);//TODO should the resource model handle this and remove both MERGE
+ //settings instead of having to set it false twice?
+ assertTrue(oneToMany.isCascadeMerge());
+
+ oneToMany.setCascadeMerge(false);
+ assertFalse(oneToMany.isCascadeMerge());
+
+ assertSourceDoesNotContain("cascade");
+ }
+
+ public void testMultipleCascade() throws Exception {
+ IType testType = this.createTestOneToManyWithMultipleCascade();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY);
+ assertTrue(oneToMany.isCascadeMerge());
+ assertTrue(oneToMany.isCascadeRemove());
+
+ oneToMany.setCascadeMerge(false);
+ assertSourceContains("@OneToMany(cascade=REMOVE)");
+
+ oneToMany.setCascadeRemove(false);
+ assertSourceDoesNotContain("cascade");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToOneTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToOneTests.java
new file mode 100644
index 0000000000..5f71bf21fb
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToOneTests.java
@@ -0,0 +1,466 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.FetchType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.OneToOne;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class OneToOneTests extends JavaResourceModelTestCase {
+
+ public OneToOneTests(String name) {
+ super(name);
+ }
+
+ private IType createTestOneToOne() throws Exception {
+ this.createAnnotationAndMembers("OneToOne", "FetchType fetch() default FetchType.LAZY; CascadeType[] cascade() default = {};");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ONE_TO_ONE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToOne");
+ }
+ });
+ }
+
+ private IType createTestOneToOneWithFetch() throws Exception {
+ this.createAnnotationAndMembers("OneToOne", "FetchType fetch() default FetchType.LAZY;");
+ this.createEnumAndMembers("FetchType", "EAGER, LAZY");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ONE_TO_ONE, JPA.FETCH_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToOne(fetch=FetchType.EAGER)");
+ }
+ });
+ }
+
+ private IType createTestOneToOneWithTargetEntity() throws Exception {
+ this.createAnnotationAndMembers("OneToOne", "Class targetEntity() default void.class;");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ONE_TO_ONE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToOne(targetEntity=AnnotationTestType.class)");
+ }
+ });
+ }
+
+ private IType createTestOneToOneWithOptional() throws Exception {
+ this.createAnnotationAndMembers("OneToOne", "boolean optional() default true;");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ONE_TO_ONE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToOne(optional=true)");
+ }
+ });
+ }
+
+ private IType createTestOneToOneWithMappedBy() throws Exception {
+ this.createAnnotationAndMembers("OneToOne", "String mappedBy() default\"\";");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ONE_TO_ONE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToOne(mappedBy=\"foo\")");
+ }
+ });
+ }
+
+ private IType createTestOneToOneWithCascade() throws Exception {
+ this.createAnnotationAndMembers("OneToOne", "CascadeType[] cascade() default = {};");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ONE_TO_ONE, JPA.CASCADE_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToOne(cascade=CascadeType.ALL)");
+ }
+ });
+ }
+
+ private IType createTestOneToOneWithMultipleCascade() throws Exception {
+ this.createAnnotationAndMembers("OneToOne", "CascadeType[] cascade() default = {};");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ONE_TO_ONE, JPA.CASCADE_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToOne(cascade={CascadeType.MERGE, CascadeType.REMOVE})");
+ }
+ });
+ }
+
+ private IType createTestOneToOneWithDuplicateCascade() throws Exception {
+ this.createAnnotationAndMembers("OneToOne", "CascadeType[] cascade() default = {};");
+ this.createEnumAndMembers("CascadeType", "ALL, PERSIST, MERGE, REMOVE, REFRESH");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ONE_TO_ONE, JPA.CASCADE_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OneToOne(cascade={CascadeType.MERGE, CascadeType.MERGE})");
+ }
+ });
+ }
+
+ public void testOneToOne() throws Exception {
+ IType testType = this.createTestOneToOne();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertNotNull(oneToOne);
+ }
+
+ public void testGetFetch() throws Exception {
+ IType testType = this.createTestOneToOneWithFetch();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertEquals(FetchType.EAGER, oneToOne.getFetch());
+ }
+
+ public void testSetFetch() throws Exception {
+ IType testType = this.createTestOneToOneWithFetch();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertEquals(FetchType.EAGER, oneToOne.getFetch());
+
+ oneToOne.setFetch(FetchType.LAZY);
+ assertEquals(FetchType.LAZY, oneToOne.getFetch());
+
+ assertSourceContains("@OneToOne(fetch=LAZY)");
+ }
+
+ public void testSetFetchNull() throws Exception {
+ IType testType = this.createTestOneToOneWithFetch();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertEquals(FetchType.EAGER, oneToOne.getFetch());
+
+ oneToOne.setFetch(null);
+ assertNull(oneToOne.getFetch());
+
+ assertSourceContains("@OneToOne");
+ assertSourceDoesNotContain("fetch");
+ }
+
+
+ public void testGetTargetEntity() throws Exception {
+ IType testType = this.createTestOneToOneWithTargetEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertEquals(TYPE_NAME, oneToOne.getTargetEntity());
+ }
+
+ public void testSetTargetEntity() throws Exception {
+ IType testType = this.createTestOneToOneWithTargetEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertEquals(TYPE_NAME, oneToOne.getTargetEntity());
+
+ oneToOne.setTargetEntity("Foo");
+
+ assertSourceContains("@OneToOne(targetEntity=Foo.class)");
+ }
+
+ public void testSetTargetEntityNull() throws Exception {
+ IType testType = this.createTestOneToOneWithTargetEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertEquals(TYPE_NAME, oneToOne.getTargetEntity());
+
+ oneToOne.setTargetEntity(null);
+
+ assertSourceContains("@OneToOne");
+ assertSourceDoesNotContain("targetEntity");
+ }
+
+
+ public void testGetFullyQualifiedTargetEntity() throws Exception {
+ IType testType = this.createTestOneToOneWithTargetEntity();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertEquals(FULLY_QUALIFIED_TYPE_NAME, oneToOne.getFullyQualifiedTargetEntity());
+
+ oneToOne.setTargetEntity("Foo");
+
+ assertSourceContains("@OneToOne(targetEntity=Foo.class)");
+
+ typeResource.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertEquals("Foo", oneToOne.getTargetEntity());
+
+ assertNull(oneToOne.getFullyQualifiedTargetEntity());
+ }
+
+ public void testGetOptional() throws Exception {
+ IType testType = this.createTestOneToOneWithOptional();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertTrue(oneToOne.getOptional());
+ }
+
+ public void testSetOptional() throws Exception {
+ IType testType = this.createTestOneToOneWithOptional();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertTrue(oneToOne.getOptional());
+
+ oneToOne.setOptional(false);
+ assertFalse(oneToOne.getOptional());
+
+ assertSourceContains("@OneToOne(optional=false)");
+ }
+
+ public void testSetOptionalNull() throws Exception {
+ IType testType = this.createTestOneToOneWithOptional();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertTrue(oneToOne.getOptional());
+
+ oneToOne.setOptional(null);
+ assertNull(oneToOne.getOptional());
+
+ assertSourceContains("@OneToOne");
+ assertSourceDoesNotContain("optional");
+ }
+
+ public void testGetMappedBy() throws Exception {
+ IType testType = this.createTestOneToOneWithMappedBy();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertEquals("foo", oneToOne.getMappedBy());
+ }
+
+ public void testGetMappedByNull() throws Exception {
+ IType testType = this.createTestOneToOne();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertEquals(null, oneToOne.getMappedBy());
+ }
+
+ public void testSetMappedBy() throws Exception {
+ IType testType = this.createTestOneToOne();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertNull(oneToOne.getMappedBy());
+ oneToOne.setMappedBy("bar");
+ assertEquals("bar", oneToOne.getMappedBy());
+
+ assertSourceContains("@OneToOne(mappedBy=\"bar\")");
+ }
+
+ public void testSetMappedByNull() throws Exception {
+ IType testType = this.createTestOneToOneWithMappedBy();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertEquals("foo", oneToOne.getMappedBy());
+
+ oneToOne.setMappedBy(null);
+ assertNull(oneToOne.getMappedBy());
+
+ assertSourceContains("@OneToOne");
+ assertSourceDoesNotContain("mappedBy");
+ }
+
+ public void testSetCascadeAll() throws Exception {
+ IType testType = this.createTestOneToOne();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertFalse(oneToOne.isCascadeAll());
+
+ oneToOne.setCascadeAll(true);
+ assertSourceContains("@OneToOne(cascade=ALL)");
+
+ oneToOne.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(oneToOne.isCascadeAll());
+ }
+
+ public void testSetCascadeMerge() throws Exception {
+ IType testType = this.createTestOneToOne();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertFalse(oneToOne.isCascadeMerge());
+
+ oneToOne.setCascadeMerge(true);
+ assertSourceContains("@OneToOne(cascade=MERGE)");
+
+ oneToOne.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(oneToOne.isCascadeMerge());
+ }
+
+ public void testSetCascadePersist() throws Exception {
+ IType testType = this.createTestOneToOne();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertFalse(oneToOne.isCascadePersist());
+
+ oneToOne.setCascadePersist(true);
+ assertSourceContains("@OneToOne(cascade=PERSIST)");
+
+ oneToOne.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(oneToOne.isCascadePersist());
+ }
+
+ public void testSetCascadeRemove() throws Exception {
+ IType testType = this.createTestOneToOne();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertFalse(oneToOne.isCascadeRemove());
+
+ oneToOne.setCascadeRemove(true);
+ assertSourceContains("@OneToOne(cascade=REMOVE)");
+
+ oneToOne.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(oneToOne.isCascadeRemove());
+ }
+
+ public void testSetCascadeRefresh() throws Exception {
+ IType testType = this.createTestOneToOne();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertFalse(oneToOne.isCascadeRefresh());
+
+ oneToOne.setCascadeRefresh(true);
+ assertSourceContains("@OneToOne(cascade=REFRESH)");
+
+ oneToOne.updateFromJava(JDTTools.buildASTRoot(testType));
+ assertTrue(oneToOne.isCascadeRefresh());
+ }
+
+ public void testCascadeMoreThanOnce() throws Exception {
+ IType testType = this.createTestOneToOneWithCascade();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertTrue(oneToOne.isCascadeAll());
+
+ oneToOne.setCascadeAll(true);
+ assertTrue(oneToOne.isCascadeAll());
+ //a second CascadeType.All should not have been added
+ assertSourceContains("@OneToOne(cascade=CascadeType.ALL)");
+
+ oneToOne.setCascadeAll(false);
+ assertFalse(oneToOne.isCascadeAll());
+
+ assertSourceDoesNotContain("cascade");
+
+ //test setting cascadeAll to false again, should just do nothing
+ oneToOne.setCascadeAll(false);
+ assertFalse(oneToOne.isCascadeAll());
+
+ assertSourceDoesNotContain("cascade");
+ }
+
+ public void testDuplicateCascade() throws Exception {
+ IType testType = this.createTestOneToOneWithDuplicateCascade();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertTrue(oneToOne.isCascadeMerge());
+
+ oneToOne.setCascadeMerge(false);//TODO should the resource model handle this and remove both MERGE
+ //settings instead of having to set it false twice?
+ assertTrue(oneToOne.isCascadeMerge());
+
+ oneToOne.setCascadeMerge(false);
+ assertFalse(oneToOne.isCascadeMerge());
+
+ assertSourceDoesNotContain("cascade");
+ }
+
+ public void testMultipleCascade() throws Exception {
+ IType testType = this.createTestOneToOneWithMultipleCascade();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE);
+ assertTrue(oneToOne.isCascadeMerge());
+ assertTrue(oneToOne.isCascadeRemove());
+
+ oneToOne.setCascadeMerge(false);
+ assertSourceContains("@OneToOne(cascade=REMOVE)");
+
+ oneToOne.setCascadeRemove(false);
+ assertSourceDoesNotContain("cascade");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OrderByTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OrderByTests.java
new file mode 100644
index 0000000000..bf9bd4f81a
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OrderByTests.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.OrderBy;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class OrderByTests extends JavaResourceModelTestCase {
+
+ public OrderByTests(String name) {
+ super(name);
+ }
+
+ private IType createTestOrderBy() throws Exception {
+ this.createAnnotationAndMembers("OrderBy", "String value() default \"\";");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ORDER_BY);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OrderBy");
+ }
+ });
+ }
+
+ private IType createTestOrderByWithValue() throws Exception {
+ this.createAnnotationAndMembers("OrderBy", "String value() default \"\";");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ORDER_BY);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@OrderBy(value=\"key\")");
+ }
+ });
+ }
+
+ public void testOrderBy() throws Exception {
+ IType testType = this.createTestOrderBy();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OrderBy orderBy = (OrderBy) attributeResource.annotation(JPA.ORDER_BY);
+ assertNotNull(orderBy);
+ }
+
+ public void testGetValue() throws Exception {
+ IType testType = this.createTestOrderByWithValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OrderBy orderBy = (OrderBy) attributeResource.annotation(JPA.ORDER_BY);
+ assertEquals("key", orderBy.getValue());
+ }
+
+ public void testSetValue() throws Exception {
+ IType testType = this.createTestOrderBy();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ OrderBy orderBy = (OrderBy) attributeResource.annotation(JPA.ORDER_BY);
+
+ orderBy.setValue("foo");
+
+ assertSourceContains("@OrderBy(\"foo\")");
+
+ orderBy.setValue(null);
+
+ assertSourceContains("@OrderBy");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java
new file mode 100644
index 0000000000..db27db9e05
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase {
+
+ private static final String COLUMN_NAME = "MY_COLUMN";
+ private static final String COLUMN_COLUMN_DEFINITION = "COLUMN_DEFINITION";
+ private static final String COLUMN_REFERENCED_COLUMN_NAME = "MY_REF_COLUMN_NAME";
+
+ public PrimaryKeyJoinColumnTests(String name) {
+ super(name);
+ }
+
+ private void createPrimaryKeyJoinColumnAnnotation() throws Exception {
+ this.createAnnotationAndMembers("PrimaryKeyJoinColumn",
+ "String name() default \"\"; " +
+ "String referencedColumnName() default \"\"; " +
+ "String columnDefinition() default \"\"; ");
+ }
+
+ private IType createTestPrimaryKeyJoinColumn() throws Exception {
+ createPrimaryKeyJoinColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@PrimaryKeyJoinColumn");
+ }
+ });
+ }
+
+ private IType createTestPrimaryKeyJoinColumnWithName() throws Exception {
+ createPrimaryKeyJoinColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@PrimaryKeyJoinColumn(name=\"" + COLUMN_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestPrimaryKeyJoinColumnWithReferencedColumnName() throws Exception {
+ createPrimaryKeyJoinColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@PrimaryKeyJoinColumn(referencedColumnName=\"" + COLUMN_REFERENCED_COLUMN_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestPrimaryKeyJoinColumnWithColumnDefinition() throws Exception {
+ createPrimaryKeyJoinColumnAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@PrimaryKeyJoinColumn(columnDefinition=\"" + COLUMN_COLUMN_DEFINITION + "\")");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestPrimaryKeyJoinColumnWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+ assertNotNull(column);
+ assertEquals(COLUMN_NAME, column.getName());
+ }
+
+ public void testGetNull() throws Exception {
+ IType testType = this.createTestPrimaryKeyJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+ assertNotNull(column);
+ assertNull(column.getReferencedColumnName());
+ assertNull(column.getColumnDefinition());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestPrimaryKeyJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getName());
+
+ column.setName("Foo");
+ assertEquals("Foo", column.getName());
+
+ assertSourceContains("@PrimaryKeyJoinColumn(name=\"Foo\")");
+ }
+
+ public void testSetNameNull() throws Exception {
+ IType testType = this.createTestPrimaryKeyJoinColumnWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+
+ assertEquals(COLUMN_NAME, column.getName());
+
+ column.setName(null);
+ assertNull(column.getName());
+
+ assertSourceDoesNotContain("@PrimaryKeyJoinColumn");
+ }
+
+
+
+ public void testGetReferencedColumnName() throws Exception {
+ IType testType = this.createTestPrimaryKeyJoinColumnWithReferencedColumnName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+ assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName());
+ }
+
+ public void testSetReferencedColumnName() throws Exception {
+ IType testType = this.createTestPrimaryKeyJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getReferencedColumnName());
+
+ column.setReferencedColumnName("Foo");
+ assertEquals("Foo", column.getReferencedColumnName());
+
+ assertSourceContains("@PrimaryKeyJoinColumn(referencedColumnName=\"Foo\")");
+
+
+ column.setReferencedColumnName(null);
+ assertSourceDoesNotContain("@PrimaryKeyJoinColumn");
+ }
+
+ public void testGetColumnDefinition() throws Exception {
+ IType testType = this.createTestPrimaryKeyJoinColumnWithColumnDefinition();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+ assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition());
+ }
+
+ public void testSetColumnDefinition() throws Exception {
+ IType testType = this.createTestPrimaryKeyJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN);
+
+ assertNotNull(column);
+ assertNull(column.getColumnDefinition());
+
+ column.setColumnDefinition("Foo");
+ assertEquals("Foo", column.getColumnDefinition());
+
+ assertSourceContains("@PrimaryKeyJoinColumn(columnDefinition=\"Foo\")");
+
+
+ column.setColumnDefinition(null);
+ assertSourceDoesNotContain("@PrimaryKeyJoinColumn");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java
new file mode 100644
index 0000000000..ce04ec1bad
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java
@@ -0,0 +1,268 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase {
+
+ private static final String COLUMN_NAME = "MY_COLUMN";
+ private static final String COLUMN_COLUMN_DEFINITION = "COLUMN_DEFINITION";
+ private static final String COLUMN_REFERENCED_COLUMN_NAME = "MY_REF_COLUMN_NAME";
+
+ public PrimaryKeyJoinColumnsTests(String name) {
+ super(name);
+ }
+
+ private void createPrimaryKeyJoinColumnAnnotation() throws Exception {
+ this.createAnnotationAndMembers("PrimaryKeyJoinColumn",
+ "String name() default \"\"; " +
+ "String referencedColumnName() default \"\"; " +
+ "String columnDefinition() default \"\";");
+ }
+
+ private void createPrimaryKeyJoinColumnsAnnotation() throws Exception {
+ createPrimaryKeyJoinColumnAnnotation();
+ this.createAnnotationAndMembers("PrimaryKeyJoinColumns",
+ "PrimaryKeyJoinColumn[] value();");
+ }
+
+ private IType createTestPrimaryKeyJoinColumns() throws Exception {
+ createPrimaryKeyJoinColumnsAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@PrimaryKeyJoinColumns(@PrimaryKeyJoinColumn)");
+ }
+ });
+ }
+
+ private IType createTestPrimaryKeyJoinColumnWithName() throws Exception {
+ createPrimaryKeyJoinColumnsAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@PrimaryKeyJoinColumns(@PrimaryKeyJoinColumn(name=\"" + COLUMN_NAME + "\"))");
+ }
+ });
+ }
+
+ private IType createTestPrimaryKeyJoinColumnWithReferencedColumnName() throws Exception {
+ createPrimaryKeyJoinColumnsAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@PrimaryKeyJoinColumns(@PrimaryKeyJoinColumn(referencedColumnName=\"" + COLUMN_REFERENCED_COLUMN_NAME + "\"))");
+ }
+ });
+ }
+
+ private IType createTestPrimaryKeyJoinColumnWithColumnDefinition() throws Exception {
+ createPrimaryKeyJoinColumnsAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@PrimaryKeyJoinColumns(@PrimaryKeyJoinColumn(columnDefinition=\"" + COLUMN_COLUMN_DEFINITION + "\"))");
+ }
+ });
+ }
+
+ private IType createTestPrimaryKeyJoinColumn() throws Exception {
+ createPrimaryKeyJoinColumnsAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@PrimaryKeyJoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\")");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestPrimaryKeyJoinColumnWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next();
+ assertNotNull(column);
+ assertEquals(COLUMN_NAME, column.getName());
+ }
+
+ public void testGetNull() throws Exception {
+ IType testType = this.createTestPrimaryKeyJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next();
+ assertNotNull(column);
+ assertNull(column.getName());
+ assertNull(column.getReferencedColumnName());
+ assertNull(column.getColumnDefinition());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestPrimaryKeyJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next();
+
+ assertNotNull(column);
+ assertNull(column.getName());
+
+ column.setName("Foo");
+ assertEquals("Foo", column.getName());
+
+ assertSourceContains("@PrimaryKeyJoinColumns(@PrimaryKeyJoinColumn(name=\"Foo\"))");
+ }
+
+ public void testSetNameNull() throws Exception {
+ IType testType = this.createTestPrimaryKeyJoinColumnWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next();
+
+ assertEquals(COLUMN_NAME, column.getName());
+
+ column.setName(null);
+ assertNull(column.getName());
+
+ assertSourceDoesNotContain("@PrimaryKeyJoinColumn");
+ }
+
+ public void testGetReferencedColumnName() throws Exception {
+ IType testType = this.createTestPrimaryKeyJoinColumnWithReferencedColumnName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next();
+ assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName());
+ }
+
+ public void testSetReferencedColumnName() throws Exception {
+ IType testType = this.createTestPrimaryKeyJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next();
+
+ assertNotNull(column);
+ assertNull(column.getReferencedColumnName());
+
+ column.setReferencedColumnName("Foo");
+ assertEquals("Foo", column.getReferencedColumnName());
+
+ assertSourceContains("@PrimaryKeyJoinColumns(@PrimaryKeyJoinColumn(referencedColumnName=\"Foo\"))");
+
+
+ column.setReferencedColumnName(null);
+ assertSourceDoesNotContain("@PrimaryKeyJoinColumn");
+ }
+
+ public void testGetColumnDefinition() throws Exception {
+ IType testType = this.createTestPrimaryKeyJoinColumnWithColumnDefinition();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next();
+ assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition());
+ }
+
+ public void testSetColumnDefinition() throws Exception {
+ IType testType = this.createTestPrimaryKeyJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+ PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next();
+
+ assertNotNull(column);
+ assertNull(column.getColumnDefinition());
+
+ column.setColumnDefinition("Foo");
+ assertEquals("Foo", column.getColumnDefinition());
+
+ assertSourceContains("@PrimaryKeyJoinColumns(@PrimaryKeyJoinColumn(columnDefinition=\"Foo\"))");
+
+
+ column.setColumnDefinition(null);
+ assertSourceDoesNotContain("@PrimaryKeyJoinColumn");
+ }
+
+
+ public void testAddPrimaryKeyJoinColumnCopyExisting() throws Exception {
+ IType jdtType = createTestPrimaryKeyJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ PrimaryKeyJoinColumn joinColumn = (PrimaryKeyJoinColumn) attributeResource.addAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ joinColumn.setName("FOO");
+ assertSourceContains("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\"),@PrimaryKeyJoinColumn(name=\"FOO\")})");
+
+ assertNull(attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN));
+ assertNotNull(attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMNS));
+ assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS)));
+ }
+ public void testAddPrimaryKeyJoinColumnToBeginningOfList() throws Exception {
+ IType jdtType = createTestPrimaryKeyJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ PrimaryKeyJoinColumn joinColumn = (PrimaryKeyJoinColumn) attributeResource.addAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ joinColumn.setName("FOO");
+ assertSourceContains("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\"),@PrimaryKeyJoinColumn(name=\"FOO\")})");
+
+ joinColumn = (PrimaryKeyJoinColumn) attributeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ joinColumn.setName("BAZ");
+ assertSourceContains("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name=\"BAZ\"),@PrimaryKeyJoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\"), @PrimaryKeyJoinColumn(name=\"FOO\")})");
+
+ Iterator<JavaResource> pkJoinColumns = attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ assertEquals("BAZ", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName());
+ assertEquals("BAR", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName());
+ assertEquals("FOO", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName());
+
+ assertNull(attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN));
+ assertNotNull(attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMNS));
+ assertEquals(3, CollectionTools.size(attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS)));
+ }
+
+ public void testRemovePrimaryKeyJoinColumnCopyExisting() throws Exception {
+ IType jdtType = createTestPrimaryKeyJoinColumn();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ PrimaryKeyJoinColumn joinColumn = (PrimaryKeyJoinColumn) attributeResource.addAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ joinColumn.setName("FOO");
+ assertSourceContains("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\"),@PrimaryKeyJoinColumn(name=\"FOO\")})");
+
+ attributeResource.removeAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ assertSourceContains("@PrimaryKeyJoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\")");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/QueryHintTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/QueryHintTests.java
new file mode 100644
index 0000000000..491a202468
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/QueryHintTests.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.NamedQuery;
+import org.eclipse.jpt.core.internal.resource.java.QueryHint;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class QueryHintTests extends JavaResourceModelTestCase {
+
+ private static final String QUERY_HINT_NAME = "myHint";
+ private static final String QUERY_HINT_VALUE = "myValue";
+
+ public QueryHintTests(String name) {
+ super(name);
+ }
+
+ private void createNamedQueryAnnotation() throws Exception {
+ createQueryHintAnnotation();
+ this.createAnnotationAndMembers("NamedQuery", "String name(); " +
+ "String query();" +
+ "QueryHint[] hints() default{};");
+ }
+
+ private void createQueryHintAnnotation() throws Exception {
+ this.createAnnotationAndMembers("QueryHint", "String name(); " +
+ "String value();");
+ }
+
+ private IType createTestNamedQueryWithQueryHints() throws Exception {
+ createNamedQueryAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.NAMED_QUERY, JPA.QUERY_HINT);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@NamedQuery(hints={@QueryHint(name=\"" + QUERY_HINT_NAME + "\", value=\"" + QUERY_HINT_VALUE + "\"), @QueryHint})");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestNamedQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY);
+ QueryHint queryHint = namedQuery.hints().next();
+ assertEquals(QUERY_HINT_NAME, queryHint.getName());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestNamedQueryWithQueryHints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY);
+ QueryHint queryHint = namedQuery.hints().next();
+ assertEquals(QUERY_HINT_NAME, queryHint.getName());
+
+ queryHint.setName("foo");
+ assertEquals("foo", queryHint.getName());
+
+ assertSourceContains("@QueryHint(name=\"foo\", value=\"" + QUERY_HINT_VALUE + "\")");
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTableTests.java
new file mode 100644
index 0000000000..fecb5c4b39
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTableTests.java
@@ -0,0 +1,477 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.SecondaryTable;
+import org.eclipse.jpt.core.internal.resource.java.UniqueConstraint;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class SecondaryTableTests extends JavaResourceModelTestCase {
+
+ private static final String TABLE_NAME = "MY_TABLE";
+ private static final String SCHEMA_NAME = "MY_SCHEMA";
+ private static final String CATALOG_NAME = "MY_CATALOG";
+
+ public SecondaryTableTests(String name) {
+ super(name);
+ }
+
+ private void createUniqueConstraintAnnotation() throws Exception {
+ this.createAnnotationAndMembers("UniqueConstraint", "String[] columnNames();");
+ }
+
+ private void createPrimaryKeyJoinColumnAnnotation() throws Exception {
+ this.createAnnotationAndMembers("PrimaryKeyJoinColumn", "String name() default \"\"; String referencedColumnName() default \"\";String columnDefinition() default \"\";");
+ }
+
+ private void createSecondaryTableAnnotation() throws Exception {
+ createPrimaryKeyJoinColumnAnnotation();
+ createUniqueConstraintAnnotation();
+ this.createAnnotationAndMembers("SecondaryTable", "String name() default \"\"; " +
+ "String catalog() default \"\";" +
+ "String schema() default \"\";" +
+ "PrimaryKeyJoinColumn[] pkJoinColumns() default {};" +
+ "UniqueConstraint[] uniqueConstraints() default {};");
+ }
+
+ private IType createTestSecondaryTable() throws Exception {
+ createSecondaryTableAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.SECONDARY_TABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@SecondaryTable");
+ }
+ });
+ }
+
+ private IType createTestSecondaryTableWithName() throws Exception {
+ createSecondaryTableAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.SECONDARY_TABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@SecondaryTable(name=\"" + TABLE_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestSecondaryTableWithSchema() throws Exception {
+ createSecondaryTableAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.SECONDARY_TABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@SecondaryTable(schema=\"" + SCHEMA_NAME + "\")");
+ }
+ });
+ }
+ private IType createTestSecondaryTableWithCatalog() throws Exception {
+ createSecondaryTableAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.SECONDARY_TABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@SecondaryTable(catalog=\"" + CATALOG_NAME + "\")");
+ }
+ });
+ }
+
+
+ private IType createTestSecondaryTableWithUniqueConstraints() throws Exception {
+ createSecondaryTableAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.SECONDARY_TABLE, JPA.UNIQUE_CONSTRAINT);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@SecondaryTable(uniqueConstraints={@UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"FOO\"}), @UniqueConstraint(columnNames={\"BAZ\"})})");
+ }
+ });
+ }
+
+ private IType createTestSecondaryTableWithPkJoinColumns() throws Exception {
+ createSecondaryTableAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.SECONDARY_TABLE, JPA.PRIMARY_KEY_JOIN_COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@SecondaryTable(pkJoinColumns={@PrimaryKeyJoinColumn(name=\"BAR\"), @PrimaryKeyJoinColumn(name=\"FOO\"), @PrimaryKeyJoinColumn(name=\"BAZ\")})");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestSecondaryTableWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+ assertNotNull(table);
+ assertEquals(TABLE_NAME, table.getName());
+ }
+
+ public void testGetNull() throws Exception {
+ IType testType = this.createTestSecondaryTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+ assertNotNull(table);
+ assertNull(table.getName());
+ assertNull(table.getCatalog());
+ assertNull(table.getSchema());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestSecondaryTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+ assertNotNull(table);
+ assertNull(table.getName());
+
+ table.setName("Foo");
+ assertEquals("Foo", table.getName());
+
+ assertSourceContains("@SecondaryTable(name=\"Foo\")");
+ }
+
+ public void testSetNameNull() throws Exception {
+ IType testType = this.createTestSecondaryTableWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+ assertEquals(TABLE_NAME, table.getName());
+
+ table.setName(null);
+ assertNull(table.getName());
+
+ assertSourceDoesNotContain("@SecondaryTable");
+ }
+
+ public void testGetCatalog() throws Exception {
+ IType testType = this.createTestSecondaryTableWithCatalog();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+ assertNotNull(table);
+ assertEquals(CATALOG_NAME, table.getCatalog());
+ }
+
+ public void testSetCatalog() throws Exception {
+ IType testType = this.createTestSecondaryTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+ assertNotNull(table);
+ assertNull(table.getCatalog());
+
+ table.setCatalog("Foo");
+ assertEquals("Foo", table.getCatalog());
+
+ assertSourceContains("@SecondaryTable(catalog=\"Foo\")");
+ }
+
+ public void testSetCatalogNull() throws Exception {
+ IType testType = this.createTestSecondaryTableWithCatalog();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+ assertEquals(CATALOG_NAME, table.getCatalog());
+
+ table.setCatalog(null);
+ assertNull(table.getCatalog());
+
+ assertSourceDoesNotContain("@SecondaryTable");
+ }
+
+ public void testGetSchema() throws Exception {
+ IType testType = this.createTestSecondaryTableWithSchema();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+ assertNotNull(table);
+ assertEquals(SCHEMA_NAME, table.getSchema());
+ }
+
+ public void testSetSchema() throws Exception {
+ IType testType = this.createTestSecondaryTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+ assertNotNull(table);
+ assertNull(table.getSchema());
+
+ table.setSchema("Foo");
+ assertEquals("Foo", table.getSchema());
+
+ assertSourceContains("@SecondaryTable(schema=\"Foo\")");
+ }
+
+ public void testSetSchemaNull() throws Exception {
+ IType testType = this.createTestSecondaryTableWithSchema();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+ assertEquals(SCHEMA_NAME, table.getSchema());
+
+ table.setSchema(null);
+ assertNull(table.getSchema());
+
+ assertSourceDoesNotContain("@SecondaryTable");
+ }
+
+
+ public void testUniqueConstraints() throws Exception {
+ IType testType = this.createTestSecondaryTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ ListIterator<UniqueConstraint> iterator = table.uniqueConstraints();
+
+ assertEquals(0, CollectionTools.size(iterator));
+ }
+
+ public void testUniqueConstraints2() throws Exception {
+ IType testType = this.createTestSecondaryTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ table.addUniqueConstraint(0);
+ table.addUniqueConstraint(1);
+ table.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ ListIterator<UniqueConstraint> iterator = table.uniqueConstraints();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testUniqueConstraints3() throws Exception {
+ IType testType = this.createTestSecondaryTableWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ ListIterator<UniqueConstraint> iterator = table.uniqueConstraints();
+
+ assertEquals(3, CollectionTools.size(iterator));
+ }
+
+ public void testAddUniqueConstraint() throws Exception {
+ IType testType = this.createTestSecondaryTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ table.addUniqueConstraint(0).addColumnName("FOO");
+ table.addUniqueConstraint(1);
+ table.addUniqueConstraint(0).addColumnName("BAR");
+
+ assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next());
+ assertEquals("FOO", table.uniqueConstraintAt(1).columnNames().next());
+ assertEquals(0, table.uniqueConstraintAt(2).columnNamesSize());
+
+ assertSourceContains("@SecondaryTable(uniqueConstraints={@UniqueConstraint(columnNames=\"BAR\"),@UniqueConstraint(columnNames=\"FOO\"), @UniqueConstraint})");
+ }
+
+ public void testRemoveUniqueConstraint() throws Exception {
+ IType testType = this.createTestSecondaryTableWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ table.removeUniqueConstraint(1);
+ Iterator<UniqueConstraint> uniqueConstraints = table.uniqueConstraints();
+ assertEquals("BAR", uniqueConstraints.next().columnNames().next());
+ assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
+ assertFalse(uniqueConstraints.hasNext());
+ assertSourceContains("@SecondaryTable(uniqueConstraints={@UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"BAZ\"})})");
+
+ table.removeUniqueConstraint(0);
+ uniqueConstraints = table.uniqueConstraints();
+ assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
+ assertFalse(uniqueConstraints.hasNext());
+ assertSourceContains("@SecondaryTable(uniqueConstraints=@UniqueConstraint(columnNames={\"BAZ\"}))");
+
+ table.removeUniqueConstraint(0);
+ uniqueConstraints = table.uniqueConstraints();
+ assertFalse(uniqueConstraints.hasNext());
+ assertSourceDoesNotContain("@SecondaryTable");
+ }
+
+ public void testMoveUniqueConstraint() throws Exception {
+ IType testType = this.createTestSecondaryTableWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable secondaryTable = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ assertEquals("BAR", secondaryTable.uniqueConstraintAt(0).columnNames().next());
+ assertEquals("FOO", secondaryTable.uniqueConstraintAt(1).columnNames().next());
+ assertEquals("BAZ", secondaryTable.uniqueConstraintAt(2).columnNames().next());
+ assertEquals(3, secondaryTable.uniqueConstraintsSize());
+
+ secondaryTable.moveUniqueConstraint(2, 0);
+ assertEquals("FOO", secondaryTable.uniqueConstraintAt(0).columnNames().next());
+ assertEquals("BAZ", secondaryTable.uniqueConstraintAt(1).columnNames().next());
+ assertEquals("BAR", secondaryTable.uniqueConstraintAt(2).columnNames().next());
+ assertEquals(3, secondaryTable.uniqueConstraintsSize());
+ assertSourceContains("@SecondaryTable(uniqueConstraints={@UniqueConstraint(columnNames={\"FOO\"}), @UniqueConstraint(columnNames={\"BAZ\"}), @UniqueConstraint(columnNames={\"BAR\"})})");
+ }
+
+ public void testMoveUniqueConstraint2() throws Exception {
+ IType testType = this.createTestSecondaryTableWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable secondaryTable = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ assertEquals("BAR", secondaryTable.uniqueConstraintAt(0).columnNames().next());
+ assertEquals("FOO", secondaryTable.uniqueConstraintAt(1).columnNames().next());
+ assertEquals("BAZ", secondaryTable.uniqueConstraintAt(2).columnNames().next());
+ assertEquals(3, secondaryTable.uniqueConstraintsSize());
+
+ secondaryTable.moveUniqueConstraint(0, 2);
+ assertEquals("BAZ", secondaryTable.uniqueConstraintAt(0).columnNames().next());
+ assertEquals("BAR", secondaryTable.uniqueConstraintAt(1).columnNames().next());
+ assertEquals("FOO", secondaryTable.uniqueConstraintAt(2).columnNames().next());
+ assertEquals(3, secondaryTable.uniqueConstraintsSize());
+ assertSourceContains("@SecondaryTable(uniqueConstraints={@UniqueConstraint(columnNames={\"BAZ\"}), @UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"FOO\"})})");
+ }
+
+
+ public void testPkJoinColumns() throws Exception {
+ IType testType = this.createTestSecondaryTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ ListIterator<PrimaryKeyJoinColumn> iterator = table.pkJoinColumns();
+
+ assertEquals(0, CollectionTools.size(iterator));
+ }
+
+ public void testPkJoinColumns2() throws Exception {
+ IType testType = this.createTestSecondaryTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ table.addPkJoinColumn(0);
+ table.addPkJoinColumn(1);
+ table.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ ListIterator<PrimaryKeyJoinColumn> iterator = table.pkJoinColumns();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testPkJoinColumns3() throws Exception {
+ IType testType = this.createTestSecondaryTableWithPkJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ ListIterator<PrimaryKeyJoinColumn> iterator = table.pkJoinColumns();
+
+ assertEquals(3, CollectionTools.size(iterator));
+ }
+
+ public void testAddPkJoinColumn() throws Exception {
+ IType testType = this.createTestSecondaryTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+
+ table.addPkJoinColumn(0).setName("FOO");
+ table.addPkJoinColumn(0);
+ table.addPkJoinColumn(0).setName("BAR");//test adding a pkJoinColumn in front of 2 other joinColumns
+
+ assertEquals("BAR", table.pkJoinColumnAt(0).getName());
+ assertNull(table.pkJoinColumnAt(1).getName());
+ assertEquals("FOO", table.pkJoinColumnAt(2).getName());
+
+ assertEquals(3, table.pkJoinColumnsSize());
+ assertSourceContains("@SecondaryTable(pkJoinColumns={@PrimaryKeyJoinColumn(name=\"BAR\"),@PrimaryKeyJoinColumn, @PrimaryKeyJoinColumn(name=\"FOO\")})");
+ }
+
+ public void testRemovePkJoinColumn() throws Exception {
+ IType testType = this.createTestSecondaryTableWithPkJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ table.removePkJoinColumn(1);
+ assertSourceContains("@SecondaryTable(pkJoinColumns={@PrimaryKeyJoinColumn(name=\"BAR\"), @PrimaryKeyJoinColumn(name=\"BAZ\")})");
+
+ table.removePkJoinColumn(0);
+ assertSourceContains("@SecondaryTable(pkJoinColumns=@PrimaryKeyJoinColumn(name=\"BAZ\"))");
+
+
+ table.removePkJoinColumn(0);
+ assertSourceDoesNotContain("@SecondaryTable");
+ }
+
+ public void testMovePkJoinColumn() throws Exception {
+ IType testType = this.createTestSecondaryTableWithPkJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+ PrimaryKeyJoinColumn joinColumn = table.pkJoinColumnAt(0);
+ joinColumn.setReferencedColumnName("REF_NAME");
+ joinColumn.setColumnDefinition("COLUMN_DEF");
+ table.movePkJoinColumn(2, 0);
+ assertSourceContains("@SecondaryTable(pkJoinColumns={@PrimaryKeyJoinColumn(name=\"FOO\"), @PrimaryKeyJoinColumn(name=\"BAZ\"), @PrimaryKeyJoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", columnDefinition = \"COLUMN_DEF\")})");
+ }
+
+ public void testMovePkJoinColumn2() throws Exception {
+ IType testType = this.createTestSecondaryTableWithPkJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+
+ PrimaryKeyJoinColumn joinColumn = table.pkJoinColumnAt(0);
+ joinColumn.setReferencedColumnName("REF_NAME");
+ joinColumn.setColumnDefinition("COLUMN_DEF");
+ table.movePkJoinColumn(0, 2);
+ assertSourceContains("@SecondaryTable(pkJoinColumns={@PrimaryKeyJoinColumn(name=\"BAZ\"), @PrimaryKeyJoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", columnDefinition = \"COLUMN_DEF\"), @PrimaryKeyJoinColumn(name=\"FOO\")})");
+ }
+
+ public void testSetPkJoinColumnName() throws Exception {
+ IType testType = this.createTestSecondaryTableWithPkJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+
+ ListIterator<PrimaryKeyJoinColumn> iterator = table.pkJoinColumns();
+ assertEquals(3, CollectionTools.size(iterator));
+
+ PrimaryKeyJoinColumn joinColumn = table.pkJoinColumns().next();
+
+ assertEquals("BAR", joinColumn.getName());
+
+ joinColumn.setName("foo");
+ assertEquals("foo", joinColumn.getName());
+
+ assertSourceContains("@SecondaryTable(pkJoinColumns={@PrimaryKeyJoinColumn(name=\"foo\"), @PrimaryKeyJoinColumn(name=\"FOO\"), @PrimaryKeyJoinColumn(name=\"BAZ\")})");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTablesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTablesTests.java
new file mode 100644
index 0000000000..4e3440950a
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTablesTests.java
@@ -0,0 +1,550 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn;
+import org.eclipse.jpt.core.internal.resource.java.SecondaryTable;
+import org.eclipse.jpt.core.internal.resource.java.SecondaryTables;
+import org.eclipse.jpt.core.internal.resource.java.UniqueConstraint;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class SecondaryTablesTests extends JavaResourceModelTestCase {
+
+ private static final String TABLE_NAME = "MY_TABLE";
+ private static final String SCHEMA_NAME = "MY_SCHEMA";
+ private static final String CATALOG_NAME = "MY_CATALOG";
+
+ public SecondaryTablesTests(String name) {
+ super(name);
+ }
+
+
+ private void createUniqueConstraintAnnotation() throws Exception {
+ this.createAnnotationAndMembers("UniqueConstraint", "String[] columnNames();");
+ }
+
+ private void createPrimaryKeyJoinColumnAnnotation() throws Exception {
+ this.createAnnotationAndMembers("PrimaryKeyJoinColumn", "String name() default \"\"; String referencedColumnName() default \"\";String columnDefinition() default \"\";");
+ }
+
+ private void createSecondaryTableAnnotation() throws Exception {
+ createPrimaryKeyJoinColumnAnnotation();
+ createUniqueConstraintAnnotation();
+ this.createAnnotationAndMembers("SecondaryTable", "String name() default \"\"; " +
+ "String catalog() default \"\"; " +
+ "String schema() default \"\";" +
+ "PrimaryKeyJoinColumn[] pkJoinColumns() default {};" +
+ "UniqueConstraint[] uniqueConstraints() default {};");
+
+ }
+ private void createSecondaryTablesAnnotation() throws Exception {
+ createSecondaryTableAnnotation();
+ this.createAnnotationAndMembers("SecondaryTables", "SecondaryTable[] value()");
+ }
+
+ private IType createTestSecondaryTables() throws Exception {
+ createSecondaryTablesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@SecondaryTables(@SecondaryTable)");
+ }
+ });
+ }
+
+ private IType createTestSecondaryTableWithName() throws Exception {
+ createSecondaryTablesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@SecondaryTables(@SecondaryTable(name=\"" + TABLE_NAME + "\"))");
+ }
+ });
+ }
+
+ private IType createTestSecondaryTableWithSchema() throws Exception {
+ createSecondaryTablesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@SecondaryTables(@SecondaryTable(schema=\"" + SCHEMA_NAME + "\"))");
+ }
+ });
+ }
+ private IType createTestSecondaryTableWithCatalog() throws Exception {
+ createSecondaryTablesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@SecondaryTables(@SecondaryTable(catalog=\"" + CATALOG_NAME + "\"))");
+ }
+ });
+ }
+
+
+ private IType createTestSecondaryTableWithUniqueConstraints() throws Exception {
+ createSecondaryTablesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES, JPA.UNIQUE_CONSTRAINT);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@SecondaryTables(@SecondaryTable(uniqueConstraints={@UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint}))");
+ }
+ });
+ }
+
+ private IType createTestSecondaryTable() throws Exception {
+ createSecondaryTablesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.SECONDARY_TABLE, JPA.UNIQUE_CONSTRAINT);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ sb.append(CR);
+ sb.append("@SecondaryTable(name=\"FOO\", catalog=\"BAR\", schema=\"BAZ\", uniqueConstraints=@UniqueConstraint(columnNames={\"BAR\"}))");
+ }
+ });
+ }
+
+ private IType createTestSecondaryTablesWithPkJoinColumns() throws Exception {
+ createSecondaryTablesAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.SECONDARY_TABLES, JPA.SECONDARY_TABLE, JPA.PRIMARY_KEY_JOIN_COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@SecondaryTables(@SecondaryTable(pkJoinColumns={@PrimaryKeyJoinColumn(name=\"BAR\"), @PrimaryKeyJoinColumn(name=\"FOO\"), @PrimaryKeyJoinColumn(name=\"BAZ\")}))");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestSecondaryTableWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE);
+ assertNull(table);
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ assertNotNull(secondaryTables);
+
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+ assertEquals(TABLE_NAME, secondaryTable.getName());
+ }
+
+ public void testGetNull() throws Exception {
+ IType testType = this.createTestSecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+ assertNull(secondaryTable.getName());
+ assertNull(secondaryTable.getCatalog());
+ assertNull(secondaryTable.getSchema());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestSecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+
+ assertNull(secondaryTable.getName());
+
+ secondaryTable.setName("Foo");
+ assertEquals("Foo", secondaryTable.getName());
+
+ assertSourceContains("@SecondaryTables(@SecondaryTable(name=\"Foo\"))");
+ }
+
+ public void testSetNameNull() throws Exception {
+ IType testType = this.createTestSecondaryTableWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+ assertEquals(TABLE_NAME, secondaryTable.getName());
+
+ secondaryTable.setName(null);
+ assertNull(secondaryTable.getName());
+
+ assertSourceDoesNotContain("@SecondaryTable");
+ }
+
+ public void testGetCatalog() throws Exception {
+ IType testType = this.createTestSecondaryTableWithCatalog();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+ assertEquals(CATALOG_NAME, secondaryTable.getCatalog());
+ }
+
+ public void testSetCatalog() throws Exception {
+ IType testType = this.createTestSecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+ assertNull(secondaryTable.getCatalog());
+
+ secondaryTable.setCatalog("Foo");
+ assertEquals("Foo", secondaryTable.getCatalog());
+
+ assertSourceContains("@SecondaryTables(@SecondaryTable(catalog=\"Foo\"))");
+ }
+
+ public void testSetCatalogNull() throws Exception {
+ IType testType = this.createTestSecondaryTableWithCatalog();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+ assertEquals(CATALOG_NAME, secondaryTable.getCatalog());
+
+ secondaryTable.setCatalog(null);
+ assertNull(secondaryTable.getCatalog());
+
+ assertSourceDoesNotContain("@SecondaryTable");
+ }
+
+ public void testGetSchema() throws Exception {
+ IType testType = this.createTestSecondaryTableWithSchema();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+ assertNotNull(secondaryTable);
+ assertEquals(SCHEMA_NAME, secondaryTable.getSchema());
+ }
+
+ public void testSetSchema() throws Exception {
+ IType testType = this.createTestSecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+ assertNull(secondaryTable.getSchema());
+
+ secondaryTable.setSchema("Foo");
+ assertEquals("Foo", secondaryTable.getSchema());
+
+ assertSourceContains("@SecondaryTables(@SecondaryTable(schema=\"Foo\"))");
+ }
+
+ public void testSetSchemaNull() throws Exception {
+ IType testType = this.createTestSecondaryTableWithSchema();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+ assertEquals(SCHEMA_NAME, secondaryTable.getSchema());
+
+ secondaryTable.setSchema(null);
+ assertNull(secondaryTable.getSchema());
+
+ assertSourceDoesNotContain("@SecondaryTable");
+ }
+
+
+ public void testUniqueConstraints() throws Exception {
+ IType testType = this.createTestSecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+
+ ListIterator<UniqueConstraint> iterator = secondaryTable.uniqueConstraints();
+
+ assertEquals(0, CollectionTools.size(iterator));
+ }
+
+ public void testUniqueConstraints2() throws Exception {
+ IType testType = this.createTestSecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+
+ secondaryTable.addUniqueConstraint(0);
+ secondaryTable.addUniqueConstraint(1);
+ secondaryTable.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ ListIterator<UniqueConstraint> iterator = secondaryTable.uniqueConstraints();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testUniqueConstraints3() throws Exception {
+ IType testType = this.createTestSecondaryTableWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+
+ ListIterator<UniqueConstraint> iterator = secondaryTable.uniqueConstraints();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testAddUniqueConstraint() throws Exception {
+ IType testType = this.createTestSecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+
+ secondaryTable.addUniqueConstraint(0).addColumnName("FOO");
+ secondaryTable.addUniqueConstraint(1);
+ secondaryTable.addUniqueConstraint(0).addColumnName("BAR");
+
+ assertEquals("BAR", secondaryTable.uniqueConstraintAt(0).columnNames().next());
+ assertEquals("FOO", secondaryTable.uniqueConstraintAt(1).columnNames().next());
+ assertEquals(0, secondaryTable.uniqueConstraintAt(2).columnNamesSize());
+
+ assertSourceContains("@SecondaryTables(@SecondaryTable(uniqueConstraints={@UniqueConstraint(columnNames=\"BAR\"),@UniqueConstraint(columnNames=\"FOO\"), @UniqueConstraint}))");
+ }
+
+ public void testRemoveUniqueConstraint() throws Exception {
+ IType testType = this.createTestSecondaryTableWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+ secondaryTable.addUniqueConstraint(0).addColumnName("FOO");
+
+ secondaryTable.removeUniqueConstraint(2);
+ assertSourceContains("@SecondaryTables(@SecondaryTable(uniqueConstraints={@UniqueConstraint(columnNames=\"FOO\"), @UniqueConstraint(columnNames={\"BAR\"})})");
+
+ secondaryTable.removeUniqueConstraint(0);
+ assertSourceContains("@SecondaryTables(@SecondaryTable(uniqueConstraints=@UniqueConstraint(columnNames={\"BAR\"}))");
+
+ secondaryTable.removeUniqueConstraint(0);
+ assertSourceDoesNotContain("@SecondaryTable");
+ }
+
+ public void testMoveUniqueConstraint() throws Exception {
+ IType testType = this.createTestSecondaryTableWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+ secondaryTable.addUniqueConstraint(0).addColumnName("FOO");
+
+ assertEquals("FOO", secondaryTable.uniqueConstraintAt(0).columnNames().next());
+ assertEquals("BAR", secondaryTable.uniqueConstraintAt(1).columnNames().next());
+ assertFalse(secondaryTable.uniqueConstraintAt(2).columnNames().hasNext());
+
+ secondaryTable.moveUniqueConstraint(2, 0);
+ assertEquals("BAR", secondaryTable.uniqueConstraintAt(0).columnNames().next());
+ assertFalse(secondaryTable.uniqueConstraintAt(1).columnNames().hasNext());
+ assertEquals("FOO", secondaryTable.uniqueConstraintAt(2).columnNames().next());
+ assertSourceContains("@SecondaryTables(@SecondaryTable(uniqueConstraints={@UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint, @UniqueConstraint(columnNames=\"FOO\")}))");
+ }
+
+ public void testMoveUniqueConstraint2() throws Exception {
+ IType testType = this.createTestSecondaryTableWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES);
+ SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0);
+ secondaryTable.addUniqueConstraint(0).addColumnName("FOO");
+
+ assertEquals("FOO", secondaryTable.uniqueConstraintAt(0).columnNames().next());
+ assertEquals("BAR", secondaryTable.uniqueConstraintAt(1).columnNames().next());
+ assertFalse(secondaryTable.uniqueConstraintAt(2).columnNames().hasNext());
+
+ secondaryTable.moveUniqueConstraint(0, 2);
+ assertFalse(secondaryTable.uniqueConstraintAt(0).columnNames().hasNext());
+ assertEquals("FOO", secondaryTable.uniqueConstraintAt(1).columnNames().next());
+ assertEquals("BAR", secondaryTable.uniqueConstraintAt(2).columnNames().next());
+ assertSourceContains("@SecondaryTables(@SecondaryTable(uniqueConstraints={@UniqueConstraint, @UniqueConstraint(columnNames=\"FOO\"), @UniqueConstraint(columnNames={\"BAR\"})}))");
+ }
+
+
+ // @Entity -->> @Entity
+ // @SecondaryTable(name="FOO") @SecondaryTables({@SecondaryTable(name="FOO"), @SecondaryTable(name="BAR")})
+ public void testAddSecondaryTableCopyExisting() throws Exception {
+ IType jdtType = createTestSecondaryTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ SecondaryTable secondaryTable = (SecondaryTable) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ secondaryTable.setName("BAR");
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\", catalog = \"BAR\", schema = \"BAZ\", uniqueConstraints = @UniqueConstraint(columnNames=\"BAR\")),@SecondaryTable(name=\"BAR\")})");
+
+ assertNull(typeResource.annotation(JPA.SECONDARY_TABLE));
+ assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLES));
+ assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
+ }
+
+ public void testAddSecondaryTable() throws Exception {
+ IType jdtType = createTestSecondaryTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ SecondaryTable secondaryTable = (SecondaryTable) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ secondaryTable.setName("BAR");
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\", catalog = \"BAR\", schema = \"BAZ\", uniqueConstraints = @UniqueConstraint(columnNames=\"BAR\")),@SecondaryTable(name=\"BAR\")})");
+
+ secondaryTable = (SecondaryTable) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ secondaryTable.setName("BAZ");
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"BAZ\"),@SecondaryTable(name=\"FOO\", catalog = \"BAR\", schema = \"BAZ\", uniqueConstraints = @UniqueConstraint(columnNames=\"BAR\")), @SecondaryTable(name=\"BAR\")})");
+
+ Iterator<JavaResource> secondaryTables = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ assertEquals("BAZ", ((SecondaryTable) secondaryTables.next()).getName());
+ assertEquals("FOO", ((SecondaryTable) secondaryTables.next()).getName());
+ assertEquals("BAR", ((SecondaryTable) secondaryTables.next()).getName());
+
+ assertNull(typeResource.annotation(JPA.SECONDARY_TABLE));
+ assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLES));
+ assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES)));
+ }
+
+ public void testRemoveSecondaryTableCopyExisting() throws Exception {
+ IType jdtType = createTestSecondaryTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType);
+
+ SecondaryTable secondaryTable = (SecondaryTable) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ secondaryTable.setName("BAR");
+ assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\", catalog = \"BAR\", schema = \"BAZ\", uniqueConstraints = @UniqueConstraint(columnNames=\"BAR\")),@SecondaryTable(name=\"BAR\")})");
+
+ typeResource.removeAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ assertSourceContains("@SecondaryTable(name=\"FOO\", catalog = \"BAR\", schema = \"BAZ\", uniqueConstraints = @UniqueConstraint(columnNames=\"BAR\"))");
+ }
+
+
+ public void testPkJoinColumns() throws Exception {
+ IType testType = this.createTestSecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
+
+ ListIterator<PrimaryKeyJoinColumn> iterator = table.pkJoinColumns();
+
+ assertEquals(0, CollectionTools.size(iterator));
+ }
+
+ public void testPkJoinColumns2() throws Exception {
+ IType testType = this.createTestSecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
+
+ table.addPkJoinColumn(0);
+ table.addPkJoinColumn(1);
+ table.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ ListIterator<PrimaryKeyJoinColumn> iterator = table.pkJoinColumns();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testPkJoinColumns3() throws Exception {
+ IType testType = this.createTestSecondaryTablesWithPkJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
+
+ ListIterator<PrimaryKeyJoinColumn> iterator = table.pkJoinColumns();
+
+ assertEquals(3, CollectionTools.size(iterator));
+ }
+
+ public void testAddPkJoinColumn() throws Exception {
+ IType testType = this.createTestSecondaryTables();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
+
+ table.addPkJoinColumn(0).setName("FOO");
+ table.addPkJoinColumn(1);
+ table.addPkJoinColumn(0).setName("BAR");
+
+ assertSourceContains("@SecondaryTables(@SecondaryTable(pkJoinColumns={@PrimaryKeyJoinColumn(name=\"BAR\"),@PrimaryKeyJoinColumn(name=\"FOO\"), @PrimaryKeyJoinColumn}))");
+ }
+
+ public void testRemovePkJoinColumn() throws Exception {
+ IType testType = this.createTestSecondaryTablesWithPkJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
+
+ table.removePkJoinColumn(1);
+ assertSourceContains("@SecondaryTables(@SecondaryTable(pkJoinColumns={@PrimaryKeyJoinColumn(name=\"BAR\"), @PrimaryKeyJoinColumn(name=\"BAZ\")}))");
+
+ table.removePkJoinColumn(0);
+ assertSourceContains("@SecondaryTables(@SecondaryTable(pkJoinColumns=@PrimaryKeyJoinColumn(name=\"BAZ\")))");
+
+ table.removePkJoinColumn(0);
+ assertSourceDoesNotContain("@SecondaryTable");
+ }
+
+ public void testMovePkJoinColumn() throws Exception {
+ IType testType = this.createTestSecondaryTablesWithPkJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
+ PrimaryKeyJoinColumn joinColumn = table.pkJoinColumnAt(0);
+ joinColumn.setReferencedColumnName("REF_NAME");
+ joinColumn.setColumnDefinition("COLUMN_DEF");
+ table.movePkJoinColumn(2, 0);
+ assertSourceContains("@SecondaryTables(@SecondaryTable(pkJoinColumns={@PrimaryKeyJoinColumn(name=\"FOO\"), @PrimaryKeyJoinColumn(name=\"BAZ\"), @PrimaryKeyJoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", columnDefinition = \"COLUMN_DEF\")}))");
+ }
+
+ public void testMovePkJoinColumn2() throws Exception {
+ IType testType = this.createTestSecondaryTablesWithPkJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
+
+
+ PrimaryKeyJoinColumn joinColumn = table.pkJoinColumnAt(0);
+ joinColumn.setReferencedColumnName("REF_NAME");
+ joinColumn.setColumnDefinition("COLUMN_DEF");
+ table.movePkJoinColumn(0, 2);
+ assertSourceContains("@SecondaryTables(@SecondaryTable(pkJoinColumns={@PrimaryKeyJoinColumn(name=\"BAZ\"), @PrimaryKeyJoinColumn(name=\"BAR\", referencedColumnName = \"REF_NAME\", columnDefinition = \"COLUMN_DEF\"), @PrimaryKeyJoinColumn(name=\"FOO\")}))");
+ }
+
+ public void testSetPkJoinColumnName() throws Exception {
+ IType testType = this.createTestSecondaryTablesWithPkJoinColumns();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ SecondaryTable table = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next();
+
+ ListIterator<PrimaryKeyJoinColumn> iterator = table.pkJoinColumns();
+ assertEquals(3, CollectionTools.size(iterator));
+
+ PrimaryKeyJoinColumn joinColumn = table.pkJoinColumns().next();
+
+ assertEquals("BAR", joinColumn.getName());
+
+ joinColumn.setName("foo");
+ assertEquals("foo", joinColumn.getName());
+
+ assertSourceContains("@SecondaryTables(@SecondaryTable(pkJoinColumns={@PrimaryKeyJoinColumn(name=\"foo\"), @PrimaryKeyJoinColumn(name=\"FOO\"), @PrimaryKeyJoinColumn(name=\"BAZ\")}))");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SequenceGeneratorTests.java
new file mode 100644
index 0000000000..1f48b1e14c
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SequenceGeneratorTests.java
@@ -0,0 +1,242 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.SequenceGenerator;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class SequenceGeneratorTests extends JavaResourceModelTestCase {
+
+ private static final String GENERATOR_NAME = "MY_GENERATOR";
+ private static final String GENERATOR_SEQUENCE_NAME = "MY_SEQUENCE";
+ private static final Integer GENERATOR_ALLOCATION_SIZE = Integer.valueOf(5);
+ private static final Integer GENERATOR_INITIAL_VALUE = Integer.valueOf(5);
+
+ public SequenceGeneratorTests(String name) {
+ super(name);
+ }
+
+ private void createSequenceGeneratorAnnotation() throws Exception {
+ this.createAnnotationAndMembers("SequenceGenerator", "String name(); " +
+ "String sequenceName() default \"\"" +
+ "int initialValue() default 1" +
+ "int allocationSize() default 50");
+ }
+
+ private IType createTestSequenceGeneratorOnField() throws Exception {
+ createSequenceGeneratorAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.SEQUENCE_GENERATOR);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@SequenceGenerator");
+ }
+ });
+ }
+
+ private IType createTestSequenceGeneratorOnType() throws Exception {
+ createSequenceGeneratorAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.SEQUENCE_GENERATOR);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@SequenceGenerator");
+ }
+ });
+ }
+
+ private IType createTestSequenceGeneratorWithName() throws Exception {
+ return createTestSequenceGeneratorWithStringElement("name", GENERATOR_NAME);
+ }
+
+ private IType createTestSequenceGeneratorWithSequenceName() throws Exception {
+ return createTestSequenceGeneratorWithStringElement("sequenceName", GENERATOR_SEQUENCE_NAME);
+ }
+
+ private IType createTestSequenceGeneratorWithStringElement(final String elementName, final String value) throws Exception {
+ createSequenceGeneratorAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.SEQUENCE_GENERATOR);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@SequenceGenerator(" + elementName + "=\"" + value + "\")");
+ }
+ });
+ }
+
+ private IType createTestSequenceGeneratorWithAllocationSize() throws Exception {
+ return createTestSequenceGeneratorWithIntElement("allocationSize", GENERATOR_ALLOCATION_SIZE);
+ }
+
+ private IType createTestSequenceGeneratorWithInitialValue() throws Exception {
+ return createTestSequenceGeneratorWithIntElement("initialValue", GENERATOR_INITIAL_VALUE);
+ }
+
+ private IType createTestSequenceGeneratorWithIntElement(final String elementName, final int value) throws Exception {
+ createSequenceGeneratorAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.SEQUENCE_GENERATOR);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@SequenceGenerator(" + elementName + "=" + value + ")");
+ }
+ });
+ }
+
+ public void testSequenceGeneratorOnField() throws Exception {
+ IType testType = this.createTestSequenceGeneratorOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+ assertNotNull(sequenceGenerator);
+ }
+
+ public void testSequenceGeneratorOnType() throws Exception {
+ IType testType = this.createTestSequenceGeneratorOnType();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) typeResource.annotation(JPA.SEQUENCE_GENERATOR);
+ assertNotNull(sequenceGenerator);
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestSequenceGeneratorWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+ assertEquals(GENERATOR_NAME, sequenceGenerator.getName());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestSequenceGeneratorWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+ assertEquals(GENERATOR_NAME, sequenceGenerator.getName());
+
+ sequenceGenerator.setName("foo");
+ assertEquals("foo", sequenceGenerator.getName());
+
+ assertSourceContains("@SequenceGenerator(name=\"foo\")");
+
+ sequenceGenerator.setName(null);
+ assertNull(sequenceGenerator.getName());
+
+ assertSourceDoesNotContain("@SequenceGenerator");
+ }
+
+ public void testGetSequenceName() throws Exception {
+ IType testType = this.createTestSequenceGeneratorWithSequenceName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+ assertEquals(GENERATOR_SEQUENCE_NAME, sequenceGenerator.getSequenceName());
+ }
+
+ public void testSetSequenceName() throws Exception {
+ IType testType = this.createTestSequenceGeneratorWithSequenceName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+ assertEquals(GENERATOR_SEQUENCE_NAME, sequenceGenerator.getSequenceName());
+
+ sequenceGenerator.setSequenceName("foo");
+ assertEquals("foo", sequenceGenerator.getSequenceName());
+
+ assertSourceContains("@SequenceGenerator(sequenceName=\"foo\")");
+
+ sequenceGenerator.setSequenceName(null);
+ assertNull(sequenceGenerator.getSequenceName());
+
+ assertSourceDoesNotContain("@SequenceGenerator");
+ }
+
+ public void testGetAllocationSize() throws Exception {
+ IType testType = this.createTestSequenceGeneratorWithAllocationSize();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+ assertEquals(GENERATOR_ALLOCATION_SIZE, sequenceGenerator.getAllocationSize());
+ }
+
+ public void testSetAllocationSize() throws Exception {
+ IType testType = this.createTestSequenceGeneratorWithAllocationSize();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+ assertEquals(GENERATOR_ALLOCATION_SIZE, sequenceGenerator.getAllocationSize());
+
+ sequenceGenerator.setAllocationSize(Integer.valueOf(500));
+ assertEquals(Integer.valueOf(500), sequenceGenerator.getAllocationSize());
+
+ assertSourceContains("@SequenceGenerator(allocationSize=500)");
+
+ sequenceGenerator.setAllocationSize(null);
+
+ assertSourceDoesNotContain("@SequenceGenerator");
+
+ sequenceGenerator.setAllocationSize(Integer.valueOf(0));
+ assertSourceContains("@SequenceGenerator(allocationSize=0)");
+ }
+
+ public void testGetInitialValue() throws Exception {
+ IType testType = this.createTestSequenceGeneratorWithInitialValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+ assertEquals(GENERATOR_INITIAL_VALUE, sequenceGenerator.getInitialValue());
+ }
+
+ public void testSetInitialValue() throws Exception {
+ IType testType = this.createTestSequenceGeneratorWithInitialValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR);
+ assertEquals(GENERATOR_INITIAL_VALUE, sequenceGenerator.getInitialValue());
+
+ sequenceGenerator.setInitialValue(Integer.valueOf(500));
+ assertEquals(Integer.valueOf(500), sequenceGenerator.getInitialValue());
+
+ assertSourceContains("@SequenceGenerator(initialValue=500)");
+
+ sequenceGenerator.setInitialValue(null);
+
+ assertSourceDoesNotContain("@SequenceGenerator");
+
+ sequenceGenerator.setInitialValue(Integer.valueOf(0));
+ assertSourceContains("@SequenceGenerator(initialValue=0)");
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableGeneratorTests.java
new file mode 100644
index 0000000000..53d5c2e58c
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableGeneratorTests.java
@@ -0,0 +1,532 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.TableGenerator;
+import org.eclipse.jpt.core.internal.resource.java.UniqueConstraint;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class TableGeneratorTests extends JavaResourceModelTestCase {
+
+ private static final String GENERATOR_NAME = "MY_GENERATOR";
+ private static final String GENERATOR_TABLE = "MY_TABLE";
+ private static final String GENERATOR_CATALOG = "MY_CATALOG";
+ private static final String GENERATOR_SCHEMA = "MY_SCHEMA";
+ private static final String GENERATOR_PK_COLUMN_NAME = "MY_PK_COLUMN_NAME";
+ private static final String GENERATOR_VALUE_COLUMN_NAME = "MY_VALUE_COLUMN_NAME";
+ private static final String GENERATOR_PK_COLUMN_VALUE = "MY_PK_COLUMN_VALUE";
+ private static final Integer GENERATOR_ALLOCATION_SIZE = Integer.valueOf(5);
+ private static final Integer GENERATOR_INITIAL_VALUE = Integer.valueOf(5);
+
+ public TableGeneratorTests(String name) {
+ super(name);
+ }
+
+ private void createTableGeneratorAnnotation() throws Exception {
+ this.createAnnotationAndMembers("TableGenerator", "String name(); " +
+ "String table() default \"\"" +
+ "String catalog() default \"\"" +
+ "String schema() default \"\"" +
+ "String pkColumnName() default \"\"" +
+ "String valueColumnName() default \"\"" +
+ "String pkColumnValue() default \"\"" +
+ "int initialValue() default 0" +
+ "int allocationSize() default 50" +
+ "UniqueConstraint[] uniqueConstraints() default{}");
+ }
+
+ private IType createTestTableGeneratorOnField() throws Exception {
+ createTableGeneratorAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.TABLE_GENERATOR);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@TableGenerator");
+ }
+ });
+ }
+
+ private IType createTestTableGeneratorOnType() throws Exception {
+ createTableGeneratorAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.TABLE_GENERATOR);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@TableGenerator");
+ }
+ });
+ }
+
+ private IType createTestTableGeneratorWithName() throws Exception {
+ return createTestTableGeneratorWithStringElement("name", GENERATOR_NAME);
+ }
+
+ private IType createTestTableGeneratorWithTable() throws Exception {
+ return createTestTableGeneratorWithStringElement("table", GENERATOR_TABLE);
+ }
+
+ private IType createTestTableGeneratorWithCatalog() throws Exception {
+ return createTestTableGeneratorWithStringElement("catalog", GENERATOR_CATALOG);
+ }
+
+ private IType createTestTableGeneratorWithSchema() throws Exception {
+ return createTestTableGeneratorWithStringElement("schema", GENERATOR_SCHEMA);
+ }
+ private IType createTestTableGeneratorWithPkColumnName() throws Exception {
+ return createTestTableGeneratorWithStringElement("pkColumnName", GENERATOR_PK_COLUMN_NAME);
+ }
+
+ private IType createTestTableGeneratorWithValueColumnName() throws Exception {
+ return createTestTableGeneratorWithStringElement("valueColumnName", GENERATOR_VALUE_COLUMN_NAME);
+ }
+
+ private IType createTestTableGeneratorWithPkColumnValue() throws Exception {
+ return createTestTableGeneratorWithStringElement("pkColumnValue", GENERATOR_PK_COLUMN_VALUE);
+ }
+
+ private IType createTestTableGeneratorWithStringElement(final String elementName, final String value) throws Exception {
+ createTableGeneratorAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.TABLE_GENERATOR);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@TableGenerator(" + elementName + "=\"" + value + "\")");
+ }
+ });
+ }
+
+ private IType createTestTableGeneratorWithAllocationSize() throws Exception {
+ return createTestTableGeneratorWithIntElement("allocationSize", GENERATOR_ALLOCATION_SIZE);
+ }
+
+ private IType createTestTableGeneratorWithInitialValue() throws Exception {
+ return createTestTableGeneratorWithIntElement("initialValue", GENERATOR_INITIAL_VALUE);
+ }
+
+ private IType createTestTableGeneratorWithIntElement(final String elementName, final int value) throws Exception {
+ createTableGeneratorAnnotation();
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.TABLE_GENERATOR);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@TableGenerator(" + elementName + "=" + value + ")");
+ }
+ });
+ }
+
+ private IType createTestTableGeneratorWithUniqueConstraints() throws Exception {
+ createTableGeneratorAnnotation();
+ this.createAnnotationAndMembers("UniqueConstraint", "String[] columnNames();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.TABLE_GENERATOR, JPA.UNIQUE_CONSTRAINT);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@TableGenerator(uniqueConstraints={@UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"FOO\"}), @UniqueConstraint(columnNames={\"BAZ\"})})");
+ }
+ });
+ }
+
+ public void testTableGeneratorOnField() throws Exception {
+ IType testType = this.createTestTableGeneratorOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertNotNull(tableGenerator);
+ }
+
+ public void testTableGeneratorOnType() throws Exception {
+ IType testType = this.createTestTableGeneratorOnType();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ TableGenerator tableGenerator = (TableGenerator) typeResource.annotation(JPA.TABLE_GENERATOR);
+ assertNotNull(tableGenerator);
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestTableGeneratorWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_NAME, tableGenerator.getName());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestTableGeneratorWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_NAME, tableGenerator.getName());
+
+ tableGenerator.setName("foo");
+ assertEquals("foo", tableGenerator.getName());
+
+ assertSourceContains("@TableGenerator(name=\"foo\")");
+
+ tableGenerator.setName(null);
+ assertNull(tableGenerator.getName());
+
+ assertSourceDoesNotContain("@TableGenerator");
+ }
+
+ public void testGetTable() throws Exception {
+ IType testType = this.createTestTableGeneratorWithTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_TABLE, tableGenerator.getTable());
+ }
+
+ public void testSetTable() throws Exception {
+ IType testType = this.createTestTableGeneratorWithTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_TABLE, tableGenerator.getTable());
+
+ tableGenerator.setTable("foo");
+ assertEquals("foo", tableGenerator.getTable());
+
+ assertSourceContains("@TableGenerator(table=\"foo\")");
+
+ tableGenerator.setTable(null);
+ assertNull(tableGenerator.getTable());
+
+ assertSourceDoesNotContain("@TableGenerator");
+ }
+
+ public void testGetCatalog() throws Exception {
+ IType testType = this.createTestTableGeneratorWithCatalog();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_CATALOG, tableGenerator.getCatalog());
+ }
+
+ public void testSetCatalog() throws Exception {
+ IType testType = this.createTestTableGeneratorWithCatalog();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_CATALOG, tableGenerator.getCatalog());
+
+ tableGenerator.setCatalog("foo");
+ assertEquals("foo", tableGenerator.getCatalog());
+
+ assertSourceContains("@TableGenerator(catalog=\"foo\")");
+
+ tableGenerator.setCatalog(null);
+ assertNull(tableGenerator.getCatalog());
+
+ assertSourceDoesNotContain("@TableGenerator");
+ }
+
+ public void testGetSchema() throws Exception {
+ IType testType = this.createTestTableGeneratorWithSchema();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_SCHEMA, tableGenerator.getSchema());
+ }
+
+ public void testSetSchema() throws Exception {
+ IType testType = this.createTestTableGeneratorWithSchema();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_SCHEMA, tableGenerator.getSchema());
+
+ tableGenerator.setSchema("foo");
+ assertEquals("foo", tableGenerator.getSchema());
+
+ assertSourceContains("@TableGenerator(schema=\"foo\")");
+
+ tableGenerator.setSchema(null);
+ assertNull(tableGenerator.getSchema());
+
+ assertSourceDoesNotContain("@TableGenerator");
+ }
+
+ public void testGetPkColumnName() throws Exception {
+ IType testType = this.createTestTableGeneratorWithPkColumnName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_PK_COLUMN_NAME, tableGenerator.getPkColumnName());
+ }
+
+ public void testSetPkColumnName() throws Exception {
+ IType testType = this.createTestTableGeneratorWithPkColumnName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_PK_COLUMN_NAME, tableGenerator.getPkColumnName());
+
+ tableGenerator.setPkColumnName("foo");
+ assertEquals("foo", tableGenerator.getPkColumnName());
+
+ assertSourceContains("@TableGenerator(pkColumnName=\"foo\")");
+
+ tableGenerator.setPkColumnName(null);
+ assertNull(tableGenerator.getPkColumnName());
+
+ assertSourceDoesNotContain("@TableGenerator");
+ }
+
+ public void testGetValueColumnName() throws Exception {
+ IType testType = this.createTestTableGeneratorWithValueColumnName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_VALUE_COLUMN_NAME, tableGenerator.getValueColumnName());
+ }
+
+ public void testSetValueColumnName() throws Exception {
+ IType testType = this.createTestTableGeneratorWithValueColumnName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_VALUE_COLUMN_NAME, tableGenerator.getValueColumnName());
+
+ tableGenerator.setValueColumnName("foo");
+ assertEquals("foo", tableGenerator.getValueColumnName());
+
+ assertSourceContains("@TableGenerator(valueColumnName=\"foo\")");
+
+ tableGenerator.setValueColumnName(null);
+ assertNull(tableGenerator.getValueColumnName());
+
+ assertSourceDoesNotContain("@TableGenerator");
+ }
+
+ public void testGetPkColumnValue() throws Exception {
+ IType testType = this.createTestTableGeneratorWithPkColumnValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_PK_COLUMN_VALUE, tableGenerator.getPkColumnValue());
+ }
+
+ public void testSetPkColumnValue() throws Exception {
+ IType testType = this.createTestTableGeneratorWithPkColumnValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_PK_COLUMN_VALUE, tableGenerator.getPkColumnValue());
+
+ tableGenerator.setPkColumnValue("foo");
+ assertEquals("foo", tableGenerator.getPkColumnValue());
+
+ assertSourceContains("@TableGenerator(pkColumnValue=\"foo\")");
+
+ tableGenerator.setPkColumnValue(null);
+ assertNull(tableGenerator.getPkColumnValue());
+
+ assertSourceDoesNotContain("@TableGenerator");
+ }
+
+ public void testGetAllocationSize() throws Exception {
+ IType testType = this.createTestTableGeneratorWithAllocationSize();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_ALLOCATION_SIZE, tableGenerator.getAllocationSize());
+ }
+
+ public void testSetAllocationSize() throws Exception {
+ IType testType = this.createTestTableGeneratorWithAllocationSize();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_ALLOCATION_SIZE, tableGenerator.getAllocationSize());
+
+ tableGenerator.setAllocationSize(Integer.valueOf(500));
+ assertEquals(Integer.valueOf(500), tableGenerator.getAllocationSize());
+
+ assertSourceContains("@TableGenerator(allocationSize=500)");
+
+ tableGenerator.setAllocationSize(null);
+
+ assertSourceDoesNotContain("@TableGenerator");
+
+ tableGenerator.setAllocationSize(Integer.valueOf(0));
+ assertSourceContains("@TableGenerator(allocationSize=0)");
+ }
+
+ public void testGetInitialValue() throws Exception {
+ IType testType = this.createTestTableGeneratorWithInitialValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_INITIAL_VALUE, tableGenerator.getInitialValue());
+ }
+
+ public void testSetInitialValue() throws Exception {
+ IType testType = this.createTestTableGeneratorWithInitialValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+ assertEquals(GENERATOR_INITIAL_VALUE, tableGenerator.getInitialValue());
+
+ tableGenerator.setInitialValue(Integer.valueOf(500));
+ assertEquals(Integer.valueOf(500), tableGenerator.getInitialValue());
+
+ assertSourceContains("@TableGenerator(initialValue=500)");
+
+ tableGenerator.setInitialValue(null);
+
+ assertSourceDoesNotContain("@TableGenerator");
+
+ tableGenerator.setInitialValue(Integer.valueOf(0));
+ assertSourceContains("@TableGenerator(initialValue=0)");
+ }
+
+ public void testUniqueConstraints() throws Exception {
+ IType testType = this.createTestTableGeneratorOnField();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ ListIterator<UniqueConstraint> iterator = tableGenerator.uniqueConstraints();
+
+ assertEquals(0, CollectionTools.size(iterator));
+ }
+
+ public void testUniqueConstraints2() throws Exception {
+ IType testType = this.createTestTableGeneratorOnField();
+ this.createAnnotationAndMembers("UniqueConstraint", "String[] columnNames();");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ tableGenerator.addUniqueConstraint(0);
+ tableGenerator.addUniqueConstraint(1);
+ tableGenerator.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ ListIterator<UniqueConstraint> iterator = tableGenerator.uniqueConstraints();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testUniqueConstraints3() throws Exception {
+ IType testType = this.createTestTableGeneratorWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ ListIterator<UniqueConstraint> iterator = tableGenerator.uniqueConstraints();
+
+ assertEquals(3, CollectionTools.size(iterator));
+ }
+
+ public void testAddUniqueConstraint() throws Exception {
+ IType testType = this.createTestTableGeneratorOnField();
+ this.createAnnotationAndMembers("UniqueConstraint", "String[] columnNames();");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ tableGenerator.addUniqueConstraint(0).addColumnName("FOO");
+ tableGenerator.addUniqueConstraint(1);
+ tableGenerator.addUniqueConstraint(0).addColumnName("BAR");
+
+ assertEquals("BAR", tableGenerator.uniqueConstraintAt(0).columnNames().next());
+ assertEquals("FOO", tableGenerator.uniqueConstraintAt(1).columnNames().next());
+ assertEquals(0, tableGenerator.uniqueConstraintAt(2).columnNamesSize());
+
+ assertEquals(3, tableGenerator.uniqueConstraintsSize());
+ assertSourceContains("@TableGenerator(uniqueConstraints={@UniqueConstraint(columnNames=\"BAR\"),@UniqueConstraint(columnNames=\"FOO\"), @UniqueConstraint})");
+ }
+
+ public void testRemoveUniqueConstraint() throws Exception {
+ IType testType = this.createTestTableGeneratorWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ tableGenerator.removeUniqueConstraint(1);
+ assertSourceContains("@TableGenerator(uniqueConstraints={@UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"BAZ\"})})");
+
+ tableGenerator.removeUniqueConstraint(0);
+ assertSourceContains("@TableGenerator(uniqueConstraints=@UniqueConstraint(columnNames={\"BAZ\"}))");
+
+ tableGenerator.removeUniqueConstraint(0);
+ assertSourceDoesNotContain("@TableGenerator");
+ }
+
+ public void testMoveUniqueConstraint() throws Exception {
+ IType testType = this.createTestTableGeneratorWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ tableGenerator.moveUniqueConstraint(2, 0);
+ assertSourceContains("@TableGenerator(uniqueConstraints={@UniqueConstraint(columnNames={\"FOO\"}), @UniqueConstraint(columnNames={\"BAZ\"}), @UniqueConstraint(columnNames={\"BAR\"})})");
+ }
+
+ public void testMoveUniqueConstraint2() throws Exception {
+ IType testType = this.createTestTableGeneratorWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR);
+
+ tableGenerator.moveUniqueConstraint(0, 2);
+ assertSourceContains("@TableGenerator(uniqueConstraints={@UniqueConstraint(columnNames={\"BAZ\"}), @UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"FOO\"})})");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableTests.java
new file mode 100644
index 0000000000..3e51271feb
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableTests.java
@@ -0,0 +1,358 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import java.util.ListIterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.jdtutility.JDTTools;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.Table;
+import org.eclipse.jpt.core.internal.resource.java.UniqueConstraint;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class TableTests extends JavaResourceModelTestCase {
+
+ private static final String TABLE_NAME = "MY_TABLE";
+ private static final String SCHEMA_NAME = "MY_SCHEMA";
+ private static final String CATALOG_NAME = "MY_CATALOG";
+
+ public TableTests(String name) {
+ super(name);
+ }
+
+ private IType createTestTable() throws Exception {
+ this.createAnnotationAndMembers("Table", "String name() default \"\"; String catalog() default \"\"; String schema() default \"\";");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.TABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Table");
+ }
+ });
+ }
+
+ private IType createTestTableWithName() throws Exception {
+ this.createAnnotationAndMembers("Table", "String name() default \"\"; String catalog() default \"\"; String schema() default \"\";");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.TABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Table(name=\"" + TABLE_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestTableWithSchema() throws Exception {
+ this.createAnnotationAndMembers("Table", "String name() default \"\"; String catalog() default \"\"; String schema() default \"\";");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.TABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Table(schema=\"" + SCHEMA_NAME + "\")");
+ }
+ });
+ }
+ private IType createTestTableWithCatalog() throws Exception {
+ this.createAnnotationAndMembers("Table", "String name() default \"\"; String catalog() default \"\"; String schema() default \"\";");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.TABLE);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Table(catalog=\"" + CATALOG_NAME + "\")");
+ }
+ });
+ }
+
+ private IType createTestTableWithUniqueConstraints() throws Exception {
+ this.createAnnotationAndMembers("Table", "UniqueConstraint[] uniqueConstraints() default{}");
+ this.createAnnotationAndMembers("UniqueConstraint", "String[] columnNames();");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.TABLE, JPA.UNIQUE_CONSTRAINT);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Table(uniqueConstraints={@UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"FOO\"}), @UniqueConstraint(columnNames={\"BAZ\"})})");
+ }
+ });
+ }
+
+ public void testGetName() throws Exception {
+ IType testType = this.createTestTableWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+ assertNotNull(table);
+ assertEquals(TABLE_NAME, table.getName());
+ }
+
+ public void testGetNull() throws Exception {
+ IType testType = this.createTestTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+ assertNotNull(table);
+ assertNull(table.getName());
+ assertNull(table.getCatalog());
+ assertNull(table.getSchema());
+ }
+
+ public void testSetName() throws Exception {
+ IType testType = this.createTestTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+ assertNotNull(table);
+ assertNull(table.getName());
+
+ table.setName("Foo");
+ assertEquals("Foo", table.getName());
+
+ assertSourceContains("@Table(name=\"Foo\")");
+ }
+
+ public void testSetNameNull() throws Exception {
+ IType testType = this.createTestTableWithName();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+ assertEquals(TABLE_NAME, table.getName());
+
+ table.setName(null);
+ assertNull(table.getName());
+
+ assertSourceDoesNotContain("@Table");
+ }
+
+ public void testGetCatalog() throws Exception {
+ IType testType = this.createTestTableWithCatalog();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+ assertNotNull(table);
+ assertEquals(CATALOG_NAME, table.getCatalog());
+ }
+
+ public void testSetCatalog() throws Exception {
+ IType testType = this.createTestTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+ assertNotNull(table);
+ assertNull(table.getCatalog());
+
+ table.setCatalog("Foo");
+ assertEquals("Foo", table.getCatalog());
+
+ assertSourceContains("@Table(catalog=\"Foo\")");
+ }
+
+ public void testSetCatalogNull() throws Exception {
+ IType testType = this.createTestTableWithCatalog();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+ assertEquals(CATALOG_NAME, table.getCatalog());
+
+ table.setCatalog(null);
+ assertNull(table.getCatalog());
+
+ assertSourceDoesNotContain("@Table");
+ }
+
+ public void testGetSchema() throws Exception {
+ IType testType = this.createTestTableWithSchema();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+ assertNotNull(table);
+ assertEquals(SCHEMA_NAME, table.getSchema());
+ }
+
+ public void testSetSchema() throws Exception {
+ IType testType = this.createTestTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+ assertNotNull(table);
+ assertNull(table.getSchema());
+
+ table.setSchema("Foo");
+ assertEquals("Foo", table.getSchema());
+
+ assertSourceContains("@Table(schema=\"Foo\")");
+ }
+
+ public void testSetSchemaNull() throws Exception {
+ IType testType = this.createTestTableWithSchema();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+ assertEquals(SCHEMA_NAME, table.getSchema());
+
+ table.setSchema(null);
+ assertNull(table.getSchema());
+
+ assertSourceDoesNotContain("@Table");
+ }
+
+ public void testUniqueConstraints() throws Exception {
+ IType testType = this.createTestTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+
+ ListIterator<UniqueConstraint> iterator = table.uniqueConstraints();
+
+ assertEquals(0, CollectionTools.size(iterator));
+ }
+
+ public void testUniqueConstraints2() throws Exception {
+ IType testType = this.createTestTable();
+ this.createAnnotationAndMembers("UniqueConstraint", "String[] columnNames();");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+
+ table.addUniqueConstraint(0);
+ table.addUniqueConstraint(1);
+ table.updateFromJava(JDTTools.buildASTRoot(testType));
+
+ ListIterator<UniqueConstraint> iterator = table.uniqueConstraints();
+
+ assertEquals(2, CollectionTools.size(iterator));
+ }
+
+ public void testUniqueConstraints3() throws Exception {
+ IType testType = this.createTestTableWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+
+ ListIterator<UniqueConstraint> iterator = table.uniqueConstraints();
+
+ assertEquals(3, CollectionTools.size(iterator));
+ }
+
+ public void testAddUniqueConstraint() throws Exception {
+ IType testType = this.createTestTable();
+ this.createAnnotationAndMembers("UniqueConstraint", "String[] columnNames();");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+
+ table.addUniqueConstraint(0).addColumnName("FOO");
+ table.addUniqueConstraint(1);
+ table.addUniqueConstraint(0).addColumnName("BAR");
+
+ assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next());
+ assertEquals("FOO", table.uniqueConstraintAt(1).columnNames().next());
+ assertEquals(0, table.uniqueConstraintAt(2).columnNamesSize());
+
+ assertSourceContains("@Table(uniqueConstraints={@UniqueConstraint(columnNames=\"BAR\"),@UniqueConstraint(columnNames=\"FOO\"), @UniqueConstraint})");
+ }
+
+ public void testAddUniqueConstraint2() throws Exception {
+ IType testType = this.createTestTable();
+ this.createAnnotationAndMembers("UniqueConstraint", "String[] columnNames();");
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+
+ table.addUniqueConstraint(0).addColumnName("FOO");
+ table.addUniqueConstraint(0);
+ table.addUniqueConstraint(1).addColumnName("BAR");
+ table.uniqueConstraintAt(1).addColumnName("BAZ");
+
+ assertSourceContains("@Table(uniqueConstraints={@UniqueConstraint,@UniqueConstraint(columnNames={ \"BAR\", \"BAZ\" }), @UniqueConstraint(columnNames=\"FOO\")})");
+ }
+ public void testRemoveUniqueConstraint() throws Exception {
+ IType testType = this.createTestTableWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+
+ table.removeUniqueConstraint(1);
+ assertSourceContains("@Table(uniqueConstraints={@UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"BAZ\"})})");
+
+ table.removeUniqueConstraint(0);
+ assertSourceContains("@Table(uniqueConstraints=@UniqueConstraint(columnNames={\"BAZ\"}))");
+
+ table.removeUniqueConstraint(0);
+ assertSourceDoesNotContain("@Table");
+ }
+
+ public void testRemoveUniqueConstraint2() throws Exception {
+ IType testType = this.createTestTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+ table.addUniqueConstraint(0).addColumnName("FOO");
+ table.addUniqueConstraint(1).addColumnName("BAR");
+ table.addUniqueConstraint(2).addColumnName("BAZ");
+ assertSourceContains("@Table(uniqueConstraints={@UniqueConstraint(columnNames=\"FOO\"),@UniqueConstraint(columnNames=\"BAR\"), @UniqueConstraint(columnNames=\"BAZ\")})");
+
+ table.removeUniqueConstraint(0);
+ assertSourceContains("@Table(uniqueConstraints={@UniqueConstraint(columnNames=\"BAR\"),@UniqueConstraint(columnNames=\"BAZ\")})");
+
+ table.removeUniqueConstraint(0);
+ assertSourceContains("@Table(uniqueConstraints=@UniqueConstraint(columnNames=\"BAZ\"))");
+
+ table.removeUniqueConstraint(0);
+ assertSourceDoesNotContain("@Table");
+ }
+
+ public void testRemoveUniqueConstraint3() throws Exception {
+ IType testType = this.createTestTable();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+ table.addUniqueConstraint(0).addColumnName("FOO");
+ table.addUniqueConstraint(1).addColumnName("BAR");
+ table.addUniqueConstraint(2).addColumnName("BAZ");
+ assertSourceContains("@Table(uniqueConstraints={@UniqueConstraint(columnNames=\"FOO\"),@UniqueConstraint(columnNames=\"BAR\"), @UniqueConstraint(columnNames=\"BAZ\")})");
+
+ table.removeUniqueConstraint(2);
+ assertSourceContains("@Table(uniqueConstraints={@UniqueConstraint(columnNames=\"FOO\"),@UniqueConstraint(columnNames=\"BAR\")})");
+
+ table.removeUniqueConstraint(1);
+ assertSourceContains("@Table(uniqueConstraints=@UniqueConstraint(columnNames=\"FOO\"))");
+
+ table.removeUniqueConstraint(0);
+ assertSourceDoesNotContain("@Table");
+ }
+
+ public void testMoveUniqueConstraint() throws Exception {
+ IType testType = this.createTestTableWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+
+ table.moveUniqueConstraint(2, 0);
+ assertSourceContains("@Table(uniqueConstraints={@UniqueConstraint(columnNames={\"FOO\"}), @UniqueConstraint(columnNames={\"BAZ\"}), @UniqueConstraint(columnNames={\"BAR\"})})");
+ }
+
+ public void testMoveUniqueConstraint2() throws Exception {
+ IType testType = this.createTestTableWithUniqueConstraints();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ Table table = (Table) typeResource.annotation(JPA.TABLE);
+
+ table.moveUniqueConstraint(0, 2);
+ assertSourceContains("@Table(uniqueConstraints={@UniqueConstraint(columnNames={\"BAZ\"}), @UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"FOO\"})})");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TemporalTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TemporalTests.java
new file mode 100644
index 0000000000..9ea3455421
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TemporalTests.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.Temporal;
+import org.eclipse.jpt.core.internal.resource.java.TemporalType;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class TemporalTests extends JavaResourceModelTestCase {
+
+ public TemporalTests(String name) {
+ super(name);
+ }
+
+ private IType createTestTemporal() throws Exception {
+ this.createAnnotationAndMembers("Temporal", "TemporalType value();");
+ this.createEnumAndMembers("TemporalType", "DATE, TIME, TIMESTAMP");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.TEMPORAL);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Temporal");
+ }
+ });
+ }
+
+ private IType createTestTemporalWithValue() throws Exception {
+ this.createAnnotationAndMembers("Temporal", "TemporalType value();");
+ this.createEnumAndMembers("TemporalType", "DATE, TIME, TIMESTAMP");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.TEMPORAL, JPA.TEMPORAL_TYPE);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Temporal(TemporalType.DATE)");
+ }
+ });
+ }
+
+ public void testTemporal() throws Exception {
+ IType testType = this.createTestTemporal();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ Temporal temporal = (Temporal) attributeResource.annotation(JPA.TEMPORAL);
+ assertNotNull(temporal);
+ }
+
+ public void testGetValue() throws Exception {
+ IType testType = this.createTestTemporalWithValue();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ Temporal temporal = (Temporal) attributeResource.annotation(JPA.TEMPORAL);
+ assertEquals(TemporalType.DATE, temporal.getValue());
+ }
+
+ public void testSetValue() throws Exception {
+ IType testType = this.createTestTemporal();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ Temporal temporal = (Temporal) attributeResource.annotation(JPA.TEMPORAL);
+
+ temporal.setValue(TemporalType.TIME);
+
+ assertSourceContains("@Temporal(TIME)");
+
+ temporal.setValue(null);
+
+ assertSourceDoesNotContain("@Temporal");
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TransientTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TransientTests.java
new file mode 100644
index 0000000000..0e5472cb4d
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TransientTests.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.Transient;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class TransientTests extends JavaResourceModelTestCase {
+
+ public TransientTests(String name) {
+ super(name);
+ }
+
+ private IType createTestTransient() throws Exception {
+ this.createAnnotationAndMembers("Transient", "");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.TRANSIENT);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Transient");
+ }
+ });
+ }
+
+ public void testTransient() throws Exception {
+ IType testType = this.createTestTransient();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JavaResource mappingAnnotation = attributeResource.mappingAnnotation();
+ assertTrue(mappingAnnotation instanceof Transient);
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/VersionTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/VersionTests.java
new file mode 100644
index 0000000000..c7ec8a9d29
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/VersionTests.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tests.internal.resource.java;
+
+import java.util.Iterator;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jpt.core.internal.resource.java.JPA;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource;
+import org.eclipse.jpt.core.internal.resource.java.JavaResource;
+import org.eclipse.jpt.core.internal.resource.java.Version;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+
+public class VersionTests extends JavaResourceModelTestCase {
+
+ public VersionTests(String name) {
+ super(name);
+ }
+
+ private IType createTestVersion() throws Exception {
+ this.createAnnotationAndMembers("Version", "");
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.VERSION);
+ }
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Version");
+ }
+ });
+ }
+
+ public void testVersion() throws Exception {
+ IType testType = this.createTestVersion();
+ JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType);
+ JavaPersistentAttributeResource attributeResource = typeResource.fields().next();
+
+ JavaResource mappingAnnotation = attributeResource.mappingAnnotation();
+ assertTrue(mappingAnnotation instanceof Version);
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/.classpath b/jpa/tests/org.eclipse.jpt.db.tests/.classpath
index a3d0c948aa..52f3036201 100644
--- a/jpa/tests/org.eclipse.jpt.db.tests/.classpath
+++ b/jpa/tests/org.eclipse.jpt.db.tests/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
<accessrule kind="accessible" pattern="org/eclipse/jpt/db/**"/>
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/.settings/org.eclipse.core.resources.prefs b/jpa/tests/org.eclipse.jpt.db.tests/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000000..b23d0c7038
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.db.tests/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Tue Jan 15 11:11:11 EST 2008
+eclipse.preferences.version=1
+encoding/<project>=ISO-8859-1
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/META-INF/MANIFEST.MF b/jpa/tests/org.eclipse.jpt.db.tests/META-INF/MANIFEST.MF
index c56b65e31a..de87ac8d1b 100644
--- a/jpa/tests/org.eclipse.jpt.db.tests/META-INF/MANIFEST.MF
+++ b/jpa/tests/org.eclipse.jpt.db.tests/META-INF/MANIFEST.MF
@@ -15,3 +15,4 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.jpt.db
Export-Package: org.eclipse.jpt.db.tests.internal;x-internal:=true,
org.eclipse.jpt.db.tests.internal.platforms;x-internal:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTestsPlugin.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTestsPlugin.java
index dfced34598..a5fe382da0 100644
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTestsPlugin.java
+++ b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/JptDbTestsPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0, which accompanies this distribution and is available at
* http://www.eclipse.org/legal/epl-v10.html.
@@ -40,6 +40,7 @@ public class JptDbTestsPlugin extends Plugin {
/**
* This method is called upon plug-in activation
*/
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
}
@@ -47,6 +48,7 @@ public class JptDbTestsPlugin extends Plugin {
/**
* This method is called when the plug-in is stopped
*/
+ @Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/DTPPlatformTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/DTPPlatformTests.java
index c92c3f826f..11622031bb 100644
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/DTPPlatformTests.java
+++ b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/DTPPlatformTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -78,6 +78,7 @@ public abstract class DTPPlatformTests extends TestCase {
this.connectionRepository = ConnectionProfileRepository.instance();
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
this.connectionRepository.start();
@@ -93,6 +94,7 @@ public abstract class DTPPlatformTests extends TestCase {
this.verifyProfileNamed( this.profileName());
}
+ @Override
protected void tearDown() throws Exception {
this.connectionRepository.stop();
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Derby101Tests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Derby101Tests.java
index be39252f85..2244b0e623 100644
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Derby101Tests.java
+++ b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Derby101Tests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2006, 2008 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.
@@ -19,35 +19,44 @@ public class Derby101Tests extends DTPPlatformTests {
super( name);
}
- protected String databaseVendor() {
+ @Override
+ protected String databaseVendor() {
return "Derby";
}
+ @Override
protected String databaseVersion() {
return "10.1";
}
+ @Override
protected String providerId() {
return "org.eclipse.datatools.connectivity.db.derby.embedded.connectionProfile";
}
+ @Override
protected String driverName() {
return "Derby Embedded JDBC Driver";
}
+ @Override
protected String driverDefinitionType() {
return "org.eclipse.datatools.connectivity.db.derby101.genericDriverTemplate";
}
+ @Override
protected String driverDefinitionId() {
return "DriverDefn.Derby Embedded JDBC Driver";
}
+ @Override
protected String driverClass() {
return "org.apache.derby.jdbc.EmbeddedDriver";
}
+ @Override
protected String getConfigName() {
return "derby101.properties";
}
+
}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/MySQL41Tests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/MySQL41Tests.java
index 2f1f28dfe7..37c190f113 100644
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/MySQL41Tests.java
+++ b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/MySQL41Tests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -19,31 +19,39 @@ public class MySQL41Tests extends DTPPlatformTests {
super( name);
}
+ @Override
protected String databaseVendor() {
return "MySql";
}
+ @Override
protected String databaseVersion() {
return "4.1";
}
+ @Override
protected String driverClass() {
return "com.mysql.jdbc.Driver";
}
+ @Override
protected String driverDefinitionId() {
return "DriverDefn.MySQL JDBC Driver";
}
+ @Override
protected String driverDefinitionType() {
return "org.eclipse.datatools.enablement.mysql.4_1.driverTemplate";
}
+ @Override
protected String driverName() {
return "MySQL JDBC Driver";
}
+ @Override
protected String getConfigName() {
return "mysql41.properties";
}
+
} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gTests.java
index 1db6d36faa..4fa85b4db8 100644
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gTests.java
+++ b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -19,31 +19,39 @@ public class Oracle10gTests extends DTPPlatformTests {
super( name);
}
+ @Override
protected String databaseVendor() {
return "Oracle";
}
+ @Override
protected String databaseVersion() {
return "10";
}
+ @Override
protected String driverClass() {
return "oracle.jdbc.OracleDriver";
}
+ @Override
protected String driverDefinitionId() {
return "DriverDefn.Oracle Thin Driver";
}
+ @Override
protected String driverDefinitionType() {
return "org.eclipse.datatools.enablement.oracle.10.driverTemplate";
}
+ @Override
protected String driverName() {
return "Oracle 10g Thin Driver";
}
+ @Override
protected String getConfigName() {
return "oracle10g.properties";
}
+
}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gXETests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gXETests.java
index a05642b38e..78e0548b1b 100644
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gXETests.java
+++ b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle10gXETests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -19,31 +19,39 @@ public class Oracle10gXETests extends DTPPlatformTests {
super( name);
}
+ @Override
protected String databaseVendor() {
return "Oracle";
}
+ @Override
protected String databaseVersion() {
return "10";
}
+ @Override
protected String driverClass() {
return "oracle.jdbc.OracleDriver";
}
+ @Override
protected String driverDefinitionId() {
return "DriverDefn.Oracle Thin Driver";
}
+ @Override
protected String driverDefinitionType() {
return "org.eclipse.datatools.enablement.oracle.10.driverTemplate";
}
+ @Override
protected String driverName() {
return "Oracle 10g Thin Driver";
}
+ @Override
protected String getConfigName() {
return "oracle10gXE.properties";
}
+
}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle9iTests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle9iTests.java
index f750079ccf..8e1795dc24 100644
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle9iTests.java
+++ b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Oracle9iTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -19,31 +19,39 @@ public class Oracle9iTests extends DTPPlatformTests {
super( name);
}
+ @Override
protected String databaseVendor() {
return "Oracle";
}
+ @Override
protected String databaseVersion() {
return "9";
}
+ @Override
protected String driverClass() {
return "oracle.jdbc.OracleDriver";
}
+ @Override
protected String driverDefinitionId() {
return "DriverDefn.Oracle Thin Driver";
}
+ @Override
protected String driverDefinitionType() {
return "org.eclipse.datatools.enablement.oracle.9.driverTemplate";
}
+ @Override
protected String driverName() {
return "Oracle 9i Thin Driver";
}
+ @Override
protected String getConfigName() {
return "oracle9i.properties";
}
+
}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/PostgreSQL824Tests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/PostgreSQL824Tests.java
index dc9a75f42b..8e011ad987 100644
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/PostgreSQL824Tests.java
+++ b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/PostgreSQL824Tests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -19,31 +19,39 @@ public class PostgreSQL824Tests extends DTPPlatformTests {
super( name);
}
+ @Override
protected String databaseVendor() {
return "postgres";
}
+ @Override
protected String databaseVersion() {
return "8.x";
}
+ @Override
protected String driverClass() {
return "org.postgresql.Driver";
}
+ @Override
protected String driverDefinitionId() {
return "DriverDefn.PostgreSQL JDBC Driver";
}
+ @Override
protected String driverDefinitionType() {
return "org.eclipse.datatools.enablement.postgresql.postgresqlDriverTemplate";
}
+ @Override
protected String driverName() {
return "PostgreSQL JDBC Driver";
}
+ @Override
protected String getConfigName() {
return "postgresql824.properties";
}
+
}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/SQLServer2005Tests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/SQLServer2005Tests.java
index 6014aa0ee4..350d844d56 100644
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/SQLServer2005Tests.java
+++ b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/SQLServer2005Tests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -19,35 +19,44 @@ public class SQLServer2005Tests extends DTPPlatformTests {
super( name);
}
+ @Override
protected String databaseVendor() {
return "SQLServer";
}
+ @Override
protected String databaseVersion() {
return "2005";
}
+ @Override
protected String providerId() {
return "org.eclipse.datatools.connectivity.db.generic.connectionProfile";
}
+ @Override
protected String driverName() {
return "Microsoft SQL Server 2005 JDBC Driver";
}
+ @Override
protected String driverDefinitionType() {
return "org.eclipse.datatools.enablement.msft.sqlserver.2005.driverTemplate";
}
+ @Override
protected String driverDefinitionId() {
return "DriverDefn.Microsoft SQL Server 2005 JDBC Driver";
}
+ @Override
protected String driverClass() {
return "com.microsoft.sqlserver.jdbc.SQLServerDriver";
}
+ @Override
protected String getConfigName() {
return "sqlserver2005.properties";
}
+
}
diff --git a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Sybase12Tests.java b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Sybase12Tests.java
index a6230a6b67..c6c7eb3e89 100644
--- a/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Sybase12Tests.java
+++ b/jpa/tests/org.eclipse.jpt.db.tests/src/org/eclipse/jpt/db/tests/internal/platforms/Sybase12Tests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -19,31 +19,39 @@ public class Sybase12Tests extends DTPPlatformTests {
super( name);
}
+ @Override
protected String databaseVendor() {
return "Sybase";
}
+ @Override
protected String databaseVersion() {
return "12.x";
}
+ @Override
protected String driverClass() {
return "com.sybase.jdbc3.jdbc.SybDriver";
}
+ @Override
protected String driverDefinitionId() {
return "DriverDefn.Sybase JDBC Driver";
}
+ @Override
protected String driverDefinitionType() {
return "org.eclipse.datatools.enablement.sybase.ase.12_x.driverTemplate";
}
+ @Override
protected String driverName() {
return "Sybase JDBC Driver";
}
+ @Override
protected String getConfigName() {
return "sybase12.properties";
}
+
}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/jface/DelegatingLabelProviderUiTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/jface/DelegatingLabelProviderUiTest.java
new file mode 100644
index 0000000000..f792c808be
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/jface/DelegatingLabelProviderUiTest.java
@@ -0,0 +1,590 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.tests.internal.jface;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.window.ApplicationWindow;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jpt.ui.internal.jface.AbstractItemLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.AbstractTreeItemContentProvider;
+import org.eclipse.jpt.ui.internal.jface.DelegatingContentAndLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.DelegatingTreeContentAndLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.IItemLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.IItemLabelProviderFactory;
+import org.eclipse.jpt.ui.internal.jface.ITreeItemContentProvider;
+import org.eclipse.jpt.ui.internal.jface.ITreeItemContentProviderFactory;
+import org.eclipse.jpt.utility.internal.ClassTools;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.NullListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.StaticListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.StaticPropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+public class DelegatingLabelProviderUiTest extends ApplicationWindow
+{
+ private TreeViewer tree;
+
+ private WritablePropertyValueModel<Vehicle> selectedVehicle;
+
+
+ public static void main(String[] args) {
+ Window window = new DelegatingLabelProviderUiTest(args);
+ window.setBlockOnOpen(true);
+ window.open();
+ Display.getCurrent().dispose();
+ System.exit(0);
+ }
+
+
+ private DelegatingLabelProviderUiTest(String[] args) {
+ super(null);
+ this.selectedVehicle = new SimplePropertyValueModel<Vehicle>();
+ }
+
+
+ @Override
+ protected Control createContents(Composite parent) {
+ ((Shell) parent).setText(ClassTools.shortClassNameForObject(this));
+ parent.setSize(400, 400);
+ parent.setLayout(new GridLayout());
+ Composite mainPanel = new Composite(parent, SWT.NONE);
+ mainPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
+ mainPanel.setLayout(new GridLayout());
+ buildTreePanel(mainPanel);
+ buildControlPanel(mainPanel);
+ return mainPanel;
+ }
+
+ private void buildTreePanel(Composite parent) {
+ Composite panel = new Composite(parent, SWT.NONE);
+ panel.setLayoutData(new GridData(GridData.FILL_BOTH));
+ panel.setLayout(new GridLayout());
+
+ Label label = new Label(panel, SWT.NONE);
+ label.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
+ label.setText("My Vehicles");
+
+ tree = new TreeViewer(panel, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ tree.getTree().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
+ DelegatingContentAndLabelProvider contentAndLabelProvider =
+ new DelegatingTreeContentAndLabelProvider(
+ new VehicleContentProviderFactory(),
+ new VehicleLabelProviderFactory());
+ tree.setContentProvider(contentAndLabelProvider);
+ tree.setLabelProvider(contentAndLabelProvider);
+ tree.setInput(new Root());
+ tree.addSelectionChangedListener(buildTreeSelectionChangedListener());
+ }
+
+ private ISelectionChangedListener buildTreeSelectionChangedListener() {
+ return new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ selectedVehicle.setValue((Vehicle) ((IStructuredSelection) event.getSelection()).getFirstElement());
+ }
+ };
+ }
+
+ private void buildControlPanel(Composite parent) {
+ Composite panel = new Composite(parent, SWT.NONE);
+ panel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
+ panel.setLayout(new GridLayout());
+ buildUpperControlPanel(panel);
+ buildLowerControlPanel(panel);
+ }
+
+ private void buildUpperControlPanel(Composite parent) {
+ Composite panel = new Composite(parent, SWT.NONE);
+ panel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
+ panel.setLayout(new GridLayout(2, true));
+ buildVehicleCombo(panel);
+ buildColorCombo(panel);
+ }
+
+ private void buildVehicleCombo(Composite parent) {
+ final ComboViewer combo = new ComboViewer(parent, SWT.READ_ONLY);
+ combo.getCombo().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
+ combo.setContentProvider(new ArrayContentProvider());
+ combo.setLabelProvider(new VehicleTypeLabelProvider());
+ combo.setInput(
+ new VehicleType[] {
+ VehicleType.BICYCLE, VehicleType.CAR,
+ VehicleType.TRUCK, VehicleType.BOAT
+ });
+ combo.getCombo().setEnabled(false);
+ combo.addSelectionChangedListener(
+ new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ selectedVehicle().setVehicleType((VehicleType) ((StructuredSelection) event.getSelection()).getFirstElement());
+ }
+ });
+ selectedVehicle.addPropertyChangeListener(
+ PropertyValueModel.VALUE,
+ new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent event) {
+ Vehicle vehicle = selectedVehicle();
+ combo.getCombo().setEnabled(vehicle != null);
+ combo.setSelection(new StructuredSelection((vehicle == null) ? null : vehicle.vehicleType()));
+ }
+ });
+ }
+
+ private void buildColorCombo(Composite parent) {
+ final ComboViewer combo = new ComboViewer(parent, SWT.READ_ONLY);
+ combo.getCombo().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
+ combo.setContentProvider(new ArrayContentProvider());
+ combo.setLabelProvider(new ColorLabelProvider());
+ combo.setInput(new Color[] {Color.RED, Color.BLUE, Color.YELLOW, Color.GREEN});
+ combo.addSelectionChangedListener(
+ new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ selectedVehicle().setColor((Color) ((StructuredSelection) event.getSelection()).getFirstElement());
+ }
+ });
+ selectedVehicle.addPropertyChangeListener(
+ PropertyValueModel.VALUE,
+ new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent event) {
+ Vehicle vehicle = selectedVehicle();
+ combo.getCombo().setEnabled(vehicle != null);
+ combo.setSelection(new StructuredSelection((vehicle == null) ? null : vehicle.color()));
+ }
+ });
+ }
+
+ private void buildLowerControlPanel(Composite parent) {
+ Composite panel = new Composite(parent, SWT.NONE);
+ panel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
+ panel.setLayout(new GridLayout(3, false));
+ buildEffectsLabel(panel);
+ buildGreyedCheckBox(panel);
+ buildTranslucentCheckBox(panel);
+ buildActionPanel(panel);
+ }
+
+ private void buildEffectsLabel(Composite parent) {
+ Label label = new Label(parent, SWT.LEFT);
+ label.setText("Color effects: ");
+ label.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1));
+ }
+
+ private void buildGreyedCheckBox(Composite parent) {
+ final Button button = new Button(parent, SWT.CHECK);
+ button.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
+ button.setText("greyed");
+ button.setEnabled(false);
+ button.addSelectionListener(
+ new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ selectedVehicle().setGreyed(button.getSelection());
+ }
+ });
+ selectedVehicle.addPropertyChangeListener(
+ PropertyValueModel.VALUE,
+ new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent event) {
+ Vehicle vehicle = selectedVehicle();
+ button.setEnabled(vehicle != null);
+ button.setSelection(vehicle != null && vehicle.isGreyed());
+ }
+ });
+ }
+
+ private void buildTranslucentCheckBox(Composite parent) {
+ final Button button = new Button(parent, SWT.CHECK);
+ button.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false));
+ button.setText("translucent");
+ button.setEnabled(false);
+ button.addSelectionListener(
+ new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ selectedVehicle().setTranslucent(button.getSelection());
+ }
+ });
+ selectedVehicle.addPropertyChangeListener(
+ PropertyValueModel.VALUE,
+ new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent event) {
+ Vehicle vehicle = selectedVehicle();
+ button.setEnabled(vehicle != null);
+ button.setSelection(vehicle != null && vehicle.isTranslucent());
+ }
+ });
+ }
+
+ private void buildActionPanel(Composite parent) {
+ Composite panel = new Composite(parent, SWT.NONE);
+ panel.setLayoutData(new GridData(GridData.END, GridData.FILL, false, false));
+ panel.setLayout(new GridLayout());
+ buildRefreshTreeACI().fill(panel);
+ }
+
+ private ActionContributionItem buildRefreshTreeACI() {
+ Action action = new Action("Refresh tree", IAction.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ refreshTree();
+ }
+ };
+ action.setToolTipText("Refresh the tree's labels");
+ return new ActionContributionItem(action);
+ }
+
+ void refreshTree() {
+ tree.refresh();
+ }
+
+ private Vehicle selectedVehicle() {
+ return selectedVehicle.value();
+ }
+
+
+ private static class VehicleTypeLabelProvider extends BaseLabelProvider
+ implements ILabelProvider
+ {
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ public String getText(Object element) {
+ return ((VehicleType) element).description();
+ }
+ }
+
+
+ private static class ColorLabelProvider extends BaseLabelProvider
+ implements ILabelProvider
+ {
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ public String getText(Object element) {
+ return ((Color) element).description();
+ }
+ }
+
+
+ private static class VehicleContentProviderFactory
+ implements ITreeItemContentProviderFactory
+ {
+ public ITreeItemContentProvider buildItemContentProvider(Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) {
+ if (item instanceof Root) {
+ return new RootContentProvider(
+ (Root) item, (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider);
+ }
+ return new VehicleContentProvider(
+ (Vehicle) item, (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider);
+ }
+ }
+
+
+ private static class RootContentProvider extends AbstractTreeItemContentProvider<Vehicle>
+ {
+ public RootContentProvider(Root item, DelegatingTreeContentAndLabelProvider contentAndLabelProvider) {
+ super(item, contentAndLabelProvider);
+ }
+
+ @Override
+ public Object getParent() {
+ return null;
+ }
+
+ @Override
+ protected ListValueModel<Vehicle> buildChildrenModel() {
+ return new StaticListValueModel<Vehicle>(CollectionTools.list(((Root) model()).vehicles()));
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private static class VehicleContentProvider extends AbstractTreeItemContentProvider
+ {
+ public VehicleContentProvider(Vehicle item, DelegatingTreeContentAndLabelProvider contentAndLabelProvider) {
+ super(item, contentAndLabelProvider);
+ }
+
+ @Override
+ public Object getParent() {
+ return ((Vehicle) model()).parent();
+ }
+
+ @Override
+ protected ListValueModel buildChildrenModel() {
+ return new NullListValueModel();
+ }
+ }
+
+
+ private static class VehicleLabelProviderFactory
+ implements IItemLabelProviderFactory
+ {
+ public IItemLabelProvider buildItemLabelProvider(Object element, DelegatingContentAndLabelProvider labelProvider) {
+ return new VehicleLabelProvider((Vehicle) element, labelProvider);
+ }
+ }
+
+
+ private static class VehicleLabelProvider extends AbstractItemLabelProvider
+ {
+ public VehicleLabelProvider(Vehicle vehicle, DelegatingContentAndLabelProvider labelProvider) {
+ super(vehicle, labelProvider);
+ }
+
+ @Override
+ protected PropertyValueModel<String> buildTextModel() {
+ return new PropertyAspectAdapter<Vehicle, String>(
+ new StaticPropertyValueModel<Vehicle>((Vehicle) model()),
+ Vehicle.VEHICLE_TYPE_PROPERTY, Vehicle.COLOR_PROPERTY) {
+ @Override
+ protected String buildValue_() {
+ return subject.color().description() + ' ' + subject.vehicleType().description();
+ }
+ };
+ }
+
+ @Override
+ protected PropertyValueModel<Image> buildImageModel() {
+ return new PropertyAspectAdapter<Vehicle, Image>(
+ new StaticPropertyValueModel<Vehicle>((Vehicle) model()),
+ Vehicle.COLOR_PROPERTY, Vehicle.GREYED_PROPERTY, Vehicle.TRANSLUCENT_PROPERTY) {
+ @Override
+ protected Image buildValue_() {
+ return subject.image();
+ }
+ };
+ }
+ }
+
+
+ private static abstract class TreeNode extends AbstractModel
+ {
+ private TreeNode parent;
+
+
+ public TreeNode(TreeNode parent) {
+ this.parent = parent;
+ }
+
+
+ public TreeNode parent() {
+ return parent;
+ }
+ }
+
+
+ private static class Root extends TreeNode
+ {
+ protected final Vehicle[] vehicles;
+
+
+ public Root() {
+ super(null);
+ vehicles = new Vehicle[] {
+ new Vehicle(this, VehicleType.BICYCLE, Color.BLUE),
+ new Vehicle(this, VehicleType.CAR, Color.YELLOW),
+ new Vehicle(this, VehicleType.TRUCK, Color.RED),
+ new Vehicle(this, VehicleType.BOAT, Color.GREEN)};
+ }
+
+ public Vehicle[] vehicles() {
+ return vehicles;
+ }
+ }
+
+
+ private static class Vehicle extends TreeNode
+ {
+ private VehicleType vehicleType;
+ public final static String VEHICLE_TYPE_PROPERTY = "vehicleType";
+
+ private Color color;
+ public final static String COLOR_PROPERTY = "color";
+
+ private boolean greyed = false;
+ public final static String GREYED_PROPERTY = "greyed";
+
+ private boolean translucent = false;
+ public final static String TRANSLUCENT_PROPERTY = "translucent";
+
+ private Image image;
+
+
+ public Vehicle(TreeNode parent, VehicleType vehicleType, Color color) {
+ super(parent);
+ this.vehicleType = vehicleType;
+ this.color = color;
+ }
+
+ public VehicleType vehicleType() {
+ return vehicleType;
+ }
+
+ public void setVehicleType(VehicleType newVehicleType) {
+ VehicleType oldVehicleType = vehicleType;
+ vehicleType = newVehicleType;
+ firePropertyChanged(VEHICLE_TYPE_PROPERTY, oldVehicleType, newVehicleType);
+ }
+
+ public Color color() {
+ return color;
+ }
+
+ public void setColor(Color newColor) {
+ Color oldColor = color;
+ color = newColor;
+ firePropertyChanged(COLOR_PROPERTY, oldColor, newColor);
+ }
+
+ public boolean isGreyed() {
+ return greyed;
+ }
+
+ public void setGreyed(boolean newGreyed) {
+ boolean oldGreyed = greyed;
+ greyed = newGreyed;
+ firePropertyChanged(GREYED_PROPERTY, oldGreyed, newGreyed);
+ }
+
+ public boolean isTranslucent() {
+ return translucent;
+ }
+
+ public void setTranslucent(boolean newTranslucent) {
+ boolean oldTranslucent = translucent;
+ translucent = newTranslucent;
+ firePropertyChanged(TRANSLUCENT_PROPERTY, oldTranslucent, newTranslucent);
+ }
+
+ public Image image() {
+ if (image != null) {
+ image.dispose();
+ }
+
+ return ImageFactory.image(color(), greyed, translucent);
+ }
+ }
+
+
+ private static enum VehicleType
+ {
+ BICYCLE("bicycle"),
+ CAR("car"),
+ TRUCK("truck"),
+ BOAT("boat");
+
+ private final String description;
+
+ private VehicleType(String description) {
+ this.description = description;
+ }
+
+ public String description() {
+ return description;
+ }
+
+ @Override
+ public String toString() {
+ return description();
+ }
+ }
+
+
+ private static enum Color
+ {
+ RED("red", new RGB(255, 0, 0)),
+ BLUE("blue", new RGB(0, 0, 255)),
+ YELLOW("yellow", new RGB(255, 255, 0)),
+ GREEN("green", new RGB(0, 255, 0));
+
+ private final String description;
+
+ private final RGB rgb;
+
+ private Color(String description, RGB rgb) {
+ this.description = description;
+ this.rgb = rgb;
+ }
+
+ public String description() {
+ return description;
+ }
+
+ public RGB rgb() {
+ return rgb;
+ }
+
+ @Override
+ public String toString() {
+ return description();
+ }
+ }
+
+
+ private static class ImageFactory
+ {
+ private static RGB rgb(Color color, boolean greyed, boolean translucent) {
+ RGB rgb = (greyed) ? new RGB(127, 127, 127) : color.rgb();
+ if (translucent) {
+ rgb = new RGB(translucify(rgb.red), translucify(rgb.green), translucify(rgb.blue));
+ }
+ return rgb;
+ }
+
+ private static int translucify(int color) {
+ return 255 - (int) ((255 - color) * 0.3);
+ }
+
+ public static Image image(Color color, boolean greyed, boolean translucent) {
+ PaletteData pd = new PaletteData(new RGB[] {rgb(color, greyed, translucent)});
+ ImageData id = new ImageData(20, 20, 1, pd);
+ for (int x = 0; x < 20; x ++) {
+ for (int y = 0; y < 20; y ++) {
+ id.setPixel(x, y, 0);
+ }
+ }
+ return new Image(Display.getCurrent(), id);
+ }
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/jface/DelegatingTreeContentProviderUiTest.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/jface/DelegatingTreeContentProviderUiTest.java
new file mode 100644
index 0000000000..c35ad607fb
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/jface/DelegatingTreeContentProviderUiTest.java
@@ -0,0 +1,570 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.ui.tests.internal.jface;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.window.ApplicationWindow;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jpt.ui.internal.jface.AbstractTreeItemContentProvider;
+import org.eclipse.jpt.ui.internal.jface.DelegatingContentAndLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.DelegatingTreeContentAndLabelProvider;
+import org.eclipse.jpt.ui.internal.jface.ITreeItemContentProvider;
+import org.eclipse.jpt.ui.internal.jface.ITreeItemContentProviderFactory;
+import org.eclipse.jpt.utility.internal.ClassTools;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
+import org.eclipse.jpt.utility.internal.iterators.ReadOnlyListIterator;
+import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
+import org.eclipse.jpt.utility.internal.model.value.CompositeCollectionValueModel;
+import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListCollectionValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.StaticCollectionValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+public class DelegatingTreeContentProviderUiTest extends ApplicationWindow
+{
+ private final Root root;
+
+ private WritablePropertyValueModel<TreeNode> selectedNode;
+
+ private TreeViewer controlTree;
+
+ private TreeViewer viewTree;
+
+ private Text nodeNameText;
+
+
+ public static void main(String[] args) {
+ Window window = new DelegatingTreeContentProviderUiTest(args);
+ window.setBlockOnOpen(true);
+ window.open();
+ Display.getCurrent().dispose();
+ System.exit(0);
+ }
+
+ private DelegatingTreeContentProviderUiTest(String[] args) {
+ super(null);
+ this.root = new Root();
+ this.root.addChild("Parent_1");
+ this.selectedNode = new SimplePropertyValueModel<TreeNode>(this.root);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ ((Shell) parent).setText(ClassTools.shortClassNameForObject(this));
+ parent.setSize(800, 400);
+ parent.setLayout(new GridLayout());
+ Composite mainPanel = new Composite(parent, SWT.NONE);
+ mainPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
+ mainPanel.setLayout(new GridLayout());
+ buildTreePanel(mainPanel);
+ buildControlPanel(mainPanel);
+ return mainPanel;
+ }
+
+ private void buildTreePanel(Composite parent) {
+ Composite panel = new Composite(parent, SWT.NONE);
+ panel.setLayoutData(new GridData(GridData.FILL_BOTH));
+ panel.setLayout(new GridLayout(2, true));
+ buildControlTreePanel(panel);
+ buildViewTreePanel(panel);
+ }
+
+ private void buildControlTreePanel(Composite parent) {
+ controlTree = buildTreePanel(
+ parent, "Control tree",
+ new DelegatingTreeContentAndLabelProvider(new ControlTreeItemContentProviderFactory()),
+ new LabelProvider());
+ controlTree.addSelectionChangedListener(buildTreeSelectionChangedListener());
+ selectedNode.addPropertyChangeListener(
+ PropertyValueModel.VALUE,
+ new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent event) {
+ controlTree.setSelection(new StructuredSelection(event.newValue()));
+ }
+ }
+ );
+ }
+
+ private void buildViewTreePanel(Composite parent) {
+ viewTree = buildTreePanel(
+ parent, "View tree",
+ new DelegatingTreeContentAndLabelProvider(new ViewTreeItemContentProviderFactory()),
+ new LabelProvider());
+ }
+
+ private TreeViewer buildTreePanel(Composite parent, String labelText, ITreeContentProvider contentProvider, ILabelProvider labelProvider) {
+ Composite panel = new Composite(parent, SWT.NONE);
+ panel.setLayoutData(new GridData(GridData.FILL_BOTH));
+ panel.setLayout(new GridLayout());
+
+ Label label = new Label(panel, SWT.LEFT);
+ label.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
+ label.setText(labelText);
+
+ final TreeViewer tree = new TreeViewer(panel, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ tree.getTree().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
+ tree.setContentProvider(contentProvider);
+ tree.setLabelProvider(labelProvider);
+ tree.setInput(root);
+
+ return tree;
+ }
+
+ private ISelectionChangedListener buildTreeSelectionChangedListener() {
+ return new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ TreeNode selection = (TreeNode) ((IStructuredSelection) event.getSelection()).getFirstElement();
+ selectedNode.setValue((selection == null) ? root : selection);
+ }
+ };
+ }
+
+ private void buildControlPanel(Composite parent) {
+ Composite panel = new Composite(parent, SWT.NONE);
+ panel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+ panel.setLayout(new GridLayout(6, false));
+ buildNodeNameText(panel);
+ buildAddChildACI().fill(panel);
+ buildAddNestedChildACI().fill(panel);
+ buildRemoveACI().fill(panel);
+ buildClearModelACI().fill(panel);
+ buildRestoreModelACI().fill(panel);
+ }
+
+ private void buildNodeNameText(Composite parent) {
+ nodeNameText = new Text(parent, SWT.SINGLE | SWT.BORDER);
+ nodeNameText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
+ }
+
+ private ActionContributionItem buildAddChildACI() {
+ final Action action = new Action("Add child", IAction.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ addChild();
+ }
+ };
+ action.setToolTipText("Add a child with the given name");
+ selectedNode.addPropertyChangeListener(
+ PropertyValueModel.VALUE,
+ new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent event) {
+ action.setEnabled(((TreeNode) event.newValue()).canHaveChildren());
+ }
+ }
+ );
+ return new ActionContributionItem(action);
+ }
+
+ private ActionContributionItem buildAddNestedChildACI() {
+ final Action action = new Action("Add nested child", IAction.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ addNestedChild();
+ }
+ };
+ action.setToolTipText("Add a nested child with the given name");
+ action.setEnabled(false);
+ selectedNode.addPropertyChangeListener(
+ PropertyValueModel.VALUE,
+ new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent event) {
+ action.setEnabled(((TreeNode) event.newValue()).canHaveNestedChildren());
+ }
+ }
+ );
+ return new ActionContributionItem(action);
+ }
+
+ private ActionContributionItem buildRemoveACI() {
+ final Action action = new Action("Remove", IAction.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ remove();
+ }
+ };
+ action.setToolTipText("Remove the selected node");
+ action.setEnabled(false);
+ selectedNode.addPropertyChangeListener(
+ PropertyValueModel.VALUE,
+ new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent event) {
+ action.setEnabled(event.newValue() != root);
+ }
+ }
+ );
+ return new ActionContributionItem(action);
+ }
+
+ private ActionContributionItem buildClearModelACI() {
+ Action action = new Action("Clear model", IAction.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ clearModel();
+ }
+ };
+ action.setToolTipText("Clear the model");
+ return new ActionContributionItem(action);
+ }
+
+ private ActionContributionItem buildRestoreModelACI() {
+ Action action = new Action("Restore model", IAction.AS_PUSH_BUTTON) {
+ @Override
+ public void run() {
+ restoreModel();
+ }
+ };
+ action.setToolTipText("Restore the model");
+ return new ActionContributionItem(action);
+ }
+
+ void addChild() {
+ String nodeName = nodeNameText.getText();
+ if (nodeName.length() != 0) {
+ selectedNode.value().addChild(nodeName);
+ }
+ }
+
+ void addNestedChild() {
+ String nodeName = nodeNameText.getText();
+ if (nodeName.length() != 0) {
+ selectedNode.value().addNestedChild(nodeName);
+ }
+ }
+
+ void remove() {
+ TreeNode node = selectedNode.value();
+ node.parent().removeChild(node);
+ }
+
+ void clearModel() {
+ controlTree.setInput(null);
+ viewTree.setInput(null);
+ }
+
+ void restoreModel() {
+ controlTree.setInput(root);
+ viewTree.setInput(root);
+ }
+
+
+ private static abstract class TreeItemContentProviderFactory
+ implements ITreeItemContentProviderFactory
+ {
+ public ITreeItemContentProvider buildItemContentProvider(
+ Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) {
+ return new GenericTreeItemContentProvider(
+ (TreeNode) item, (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider);
+ }
+ }
+
+
+ private static class ControlTreeItemContentProviderFactory extends TreeItemContentProviderFactory
+ {
+
+ }
+
+
+ private static class ViewTreeItemContentProviderFactory
+ extends TreeItemContentProviderFactory
+ {
+ @Override
+ public ITreeItemContentProvider buildItemContentProvider(
+ Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) {
+ if (item instanceof Parent) {
+ return new ViewTreeParentItemContentProvider(
+ (Parent) item, (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider);
+ }
+ return super.buildItemContentProvider(item, contentAndLabelProvider);
+ }
+ }
+
+
+ private static class GenericTreeItemContentProvider extends AbstractTreeItemContentProvider<TreeNode>
+ {
+ public GenericTreeItemContentProvider(
+ TreeNode treeNode, DelegatingTreeContentAndLabelProvider treeContentAndLabelProvider) {
+ super(treeNode, treeContentAndLabelProvider);
+ }
+
+ protected TreeNode treeNode() {
+ return (TreeNode) model();
+ }
+
+ @Override
+ public TreeNode getParent() {
+ return treeNode().parent();
+ }
+
+ @Override
+ protected ListValueModel<TreeNode> buildChildrenModel() {
+ return new ListAspectAdapter<TreeNode, TreeNode>(TreeNode.CHILDREN_LIST, treeNode()) {
+ @Override
+ protected ListIterator<TreeNode> listIterator_() {
+ return treeNode().children();
+ }
+ };
+ }
+ }
+
+ private static class ViewTreeParentItemContentProvider extends GenericTreeItemContentProvider
+ {
+ public ViewTreeParentItemContentProvider(
+ TreeNode treeNode, DelegatingTreeContentAndLabelProvider treeContentAndLabelProvider) {
+ super(treeNode, treeContentAndLabelProvider);
+ }
+
+ @Override
+ public TreeNode getParent() {
+ TreeNode parent = super.getParent();
+ if (parent instanceof Nest) {
+ parent = parent.parent();
+ }
+ return parent;
+ }
+
+ @Override
+ protected ListValueModel<TreeNode> buildChildrenModel() {
+ return buildChildrenModel(
+ new CompositeCollectionValueModel<TreeNode, TreeNode>(super.buildChildrenModel()) {
+ @Override
+ protected CollectionValueModel<TreeNode> transform(TreeNode value) {
+ if (value instanceof Nest) {
+ final Nest nest = (Nest) value;
+ return new ListCollectionValueModelAdapter<TreeNode>(
+ new ListAspectAdapter<TreeNode, TreeNode>(TreeNode.CHILDREN_LIST, nest) {
+ @Override
+ protected ListIterator<TreeNode> listIterator_() {
+ return nest.children();
+ }
+ }
+ );
+ }
+ else {
+ return new StaticCollectionValueModel<TreeNode>(CollectionTools.collection(value));
+ }
+ }
+ }
+ );
+ }
+ }
+
+
+ private static class LabelProvider extends BaseLabelProvider
+ implements ILabelProvider
+ {
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ public String getText(Object element) {
+ return ((TreeNode) element).getName();
+ }
+ }
+
+
+ private static abstract class TreeNode extends AbstractModel
+ {
+ private TreeNode parent;
+
+ protected final List<TreeNode> children;
+ public final static String CHILDREN_LIST = "children";
+
+ protected String name;
+ public final static String NAME_PROPERTY = "name";
+
+
+ public TreeNode(TreeNode parent, String name) {
+ this.parent = parent;
+ this.children = new ArrayList<TreeNode>();
+ this.name = name;
+ }
+
+ public TreeNode parent() {
+ return parent;
+ }
+
+ public ListIterator<TreeNode> children() {
+ return new ReadOnlyListIterator<TreeNode>(children);
+ }
+
+ protected void addChild(TreeNode child) {
+ addItemToList(child, children, CHILDREN_LIST);
+ }
+
+ public void removeChild(TreeNode child) {
+ removeItemFromList(child, children, CHILDREN_LIST);
+ }
+
+ public void removeChild(int index) {
+ removeItemFromList(index, children, CHILDREN_LIST);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String newName) {
+ String oldName = name;
+ name = newName;
+ firePropertyChanged(NAME_PROPERTY, oldName, newName);
+ }
+
+ public boolean canHaveChildren() {
+ return false;
+ }
+
+ public void addChild(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean canHaveNestedChildren() {
+ return false;
+ }
+
+ public void addNestedChild(String name) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(getName());
+ }
+ }
+
+
+ private static class Root extends TreeNode
+ {
+ public Root() {
+ super(null, null);
+ }
+
+ @Override
+ public boolean canHaveChildren() {
+ return true;
+ }
+
+ @Override
+ public void addChild(String name) {
+ addChild(new Parent(this, name));
+ }
+ }
+
+
+ private static class Parent extends TreeNode
+ {
+ public Parent(TreeNode parent, String name) {
+ super(parent, name);
+ }
+
+ @Override
+ public boolean canHaveChildren() {
+ return true;
+ }
+
+ @Override
+ public void addChild(String name) {
+ addChild(new Child(this, name));
+ }
+
+ @Override
+ public boolean canHaveNestedChildren() {
+ return true;
+ }
+
+ @Override
+ public void addNestedChild(String name) {
+ TreeNode nest = new Nest(this);
+ addChild(nest);
+ nest.addChild(name);
+ }
+
+ public Iterator<Child> nestlessChildren() {
+ return new FilteringIterator<Child, Child>(
+ new TransformationIterator<TreeNode, Child>(children()) {
+ @Override
+ protected Child transform(TreeNode next) {
+ if (next instanceof Nest) {
+ return ((Nest) next).child();
+ }
+ return (Child) next;
+ }
+ }) {
+ @Override
+ protected boolean accept(Child c) {
+ return c != null;
+ }
+ };
+ }
+ }
+
+
+ private static class Nest extends TreeNode
+ {
+ public Nest(TreeNode parent) {
+ super(parent, "nest");
+ }
+
+ @Override
+ public boolean canHaveChildren() {
+ return children.size() == 0;
+ }
+
+ @Override
+ public void addChild(String name) {
+ addChild(new Child(this, name));
+ }
+
+ /* can only have one child */
+ public Child child() {
+ return (children.isEmpty()) ? null : (Child) children.get(0);
+ }
+ }
+
+
+ private static class Child extends TreeNode
+ {
+ public Child(TreeNode parent, String name) {
+ super(parent, name);
+ }
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/platform/JpaPlatformUiExtensionTests.java b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/platform/JpaPlatformUiExtensionTests.java
index 26690fd80a..d3ca0a1bb6 100644
--- a/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/platform/JpaPlatformUiExtensionTests.java
+++ b/jpa/tests/org.eclipse.jpt.ui.tests/src/org/eclipse/jpt/ui/tests/internal/platform/JpaPlatformUiExtensionTests.java
@@ -1,21 +1,21 @@
package org.eclipse.jpt.ui.tests.internal.platform;
+import junit.framework.TestCase;
import org.eclipse.jpt.core.internal.IJpaProject;
+import org.eclipse.jpt.core.internal.platform.JpaPlatformRegistry;
import org.eclipse.jpt.core.tests.extension.resource.ExtensionTestPlugin;
import org.eclipse.jpt.core.tests.extension.resource.TestJpaPlatform;
import org.eclipse.jpt.core.tests.extension.resource.TestJpaPlatformUi;
import org.eclipse.jpt.core.tests.internal.ProjectUtility;
import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
-import junit.framework.TestCase;
-
public class JpaPlatformUiExtensionTests extends TestCase
{
protected TestJpaProject testProject;
protected static final String PROJECT_NAME = "ExtensionTestProject";
protected static final String PACKAGE_NAME = "extension.test";
-
+
public static final String TEST_PLUGIN_CLASS = ExtensionTestPlugin.class.getName();
public static final String TEST_PLUGIN_ID = ExtensionTestPlugin.PLUGIN_ID;
@@ -25,7 +25,7 @@ public class JpaPlatformUiExtensionTests extends TestCase
public static final String TEST_UI_PLATFORM_ID = TEST_PLATFORM_ID;
public static final String TEST_UI_PLATFORM_CLASS = TestJpaPlatformUi.class.getName();
-
+
public JpaPlatformUiExtensionTests(String name) {
super(name);
}
@@ -47,13 +47,13 @@ public class JpaPlatformUiExtensionTests extends TestCase
this.testProject = null;
super.tearDown();
}
-
+
protected IJpaProject jpaProject() {
return this.testProject.getJpaProject();
}
-
+
public void testJpaPlatform() {
- assertNotNull(PlatformRegistry.instance().jpaPlatform(jpaProject().jpaPlatform().getId()));
+ assertNotNull(JpaPlatformRegistry.instance().jpaPlatform(jpaProject().jpaPlatform().getId()));
}
-
+
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/.settings/org.eclipse.core.resources.prefs b/jpa/tests/org.eclipse.jpt.utility.tests/.settings/org.eclipse.core.resources.prefs
index c74f41d1cd..f68f9c2597 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/.settings/org.eclipse.core.resources.prefs
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/.settings/org.eclipse.core.resources.prefs
@@ -1,3 +1,3 @@
-#Sun May 27 15:11:44 EDT 2007
+#Tue Jan 15 11:12:26 EST 2008
eclipse.preferences.version=1
encoding/<project>=ISO-8859-1
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/ClassToolsTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/ClassToolsTests.java
index 504b621daa..f2e4eae173 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/ClassToolsTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/ClassToolsTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -93,7 +93,7 @@ public class ClassToolsTests extends TestCase {
Vector<?> v = ClassTools.newInstance(java.util.Vector.class, int.class, new Integer(initialCapacity));
assertNotNull(v);
assertEquals(0, v.size());
- Object[] elementData = (Object[]) ClassTools.getFieldValue(v, "elementData");
+ Object[] elementData = (Object[]) ClassTools.fieldValue(v, "elementData");
assertEquals(initialCapacity, elementData.length);
}
@@ -106,7 +106,7 @@ public class ClassToolsTests extends TestCase {
Vector<?> v = ClassTools.newInstance(java.util.Vector.class, parmTypes, parms);
assertNotNull(v);
assertEquals(0, v.size());
- Object[] elementData = (Object[]) ClassTools.getFieldValue(v, "elementData");
+ Object[] elementData = (Object[]) ClassTools.fieldValue(v, "elementData");
assertEquals(initialCapacity, elementData.length);
parms[0] = new Integer(-1);
@@ -129,14 +129,14 @@ public class ClassToolsTests extends TestCase {
assertTrue("NoSuchMethodException not thrown", exCaught);
}
- public void testGetFieldValue() {
+ public void testFieldValue() {
int initialCapacity = 200;
Vector<?> v = new Vector<Object>(initialCapacity);
- Object[] elementData = (Object[]) ClassTools.getFieldValue(v, "elementData");
+ Object[] elementData = (Object[]) ClassTools.fieldValue(v, "elementData");
assertEquals(initialCapacity, elementData.length);
// test inherited field
- Integer modCountInteger = (Integer) ClassTools.getFieldValue(v, "modCount");
+ Integer modCountInteger = (Integer) ClassTools.fieldValue(v, "modCount");
int modCount = modCountInteger.intValue();
assertEquals(0, modCount);
@@ -493,7 +493,68 @@ public class ClassToolsTests extends TestCase {
assertEquals('B', ClassTools.codeForClassNamed("byte"));
}
- public void testClassForTypeDeclaration() throws Exception {
+ public void testClassIsPrimitiveWrapperClass() {
+ assertTrue(ClassTools.classIsPrimitiveWrapperClass(java.lang.Void.class));
+ assertTrue(ClassTools.classIsPrimitiveWrapperClass(java.lang.Boolean.class));
+ assertTrue(ClassTools.classIsPrimitiveWrapperClass(java.lang.Integer.class));
+ assertTrue(ClassTools.classIsPrimitiveWrapperClass(java.lang.Float.class));
+
+ assertFalse(ClassTools.classIsPrimitiveWrapperClass(java.lang.String.class));
+ assertFalse(ClassTools.classIsPrimitiveWrapperClass(void.class));
+ assertFalse(ClassTools.classIsPrimitiveWrapperClass(int.class));
+ }
+
+ public void testClassIsVariablePrimitiveWrapperClass() {
+ assertFalse(ClassTools.classIsVariablePrimitiveWrapperClass(java.lang.Void.class));
+
+ assertTrue(ClassTools.classIsVariablePrimitiveWrapperClass(java.lang.Boolean.class));
+ assertTrue(ClassTools.classIsVariablePrimitiveWrapperClass(java.lang.Integer.class));
+ assertTrue(ClassTools.classIsVariablePrimitiveWrapperClass(java.lang.Float.class));
+
+ assertFalse(ClassTools.classIsVariablePrimitiveWrapperClass(java.lang.String.class));
+ assertFalse(ClassTools.classIsVariablePrimitiveWrapperClass(void.class));
+ assertFalse(ClassTools.classIsVariablePrimitiveWrapperClass(int.class));
+ }
+
+ public void testClassNamedIsPrimitive() {
+ assertTrue(void.class.isPrimitive());
+
+ assertTrue(ClassTools.classNamedIsPrimitive(void.class.getName()));
+ assertTrue(ClassTools.classNamedIsPrimitive(int.class.getName()));
+ assertTrue(ClassTools.classNamedIsPrimitive(float.class.getName()));
+ assertTrue(ClassTools.classNamedIsPrimitive(boolean.class.getName()));
+
+ assertFalse(ClassTools.classNamedIsPrimitive(java.lang.Number.class.getName()));
+ assertFalse(ClassTools.classNamedIsPrimitive(java.lang.String.class.getName()));
+ assertFalse(ClassTools.classNamedIsPrimitive(java.lang.Boolean.class.getName()));
+ assertFalse(ClassTools.classNamedIsPrimitive(java.lang.Integer.class.getName()));
+ }
+
+ public void testClassNamedIsVariablePrimitive() {
+ assertFalse(ClassTools.classNamedIsVariablePrimitive(void.class.getName()));
+
+ assertTrue(ClassTools.classNamedIsVariablePrimitive(int.class.getName()));
+ assertTrue(ClassTools.classNamedIsVariablePrimitive(float.class.getName()));
+ assertTrue(ClassTools.classNamedIsVariablePrimitive(boolean.class.getName()));
+
+ assertFalse(ClassTools.classNamedIsVariablePrimitive(java.lang.Number.class.getName()));
+ assertFalse(ClassTools.classNamedIsVariablePrimitive(java.lang.String.class.getName()));
+ assertFalse(ClassTools.classNamedIsVariablePrimitive(java.lang.Boolean.class.getName()));
+ }
+
+ public void testClassNamedIsVariablePrimitiveWrapperClass() {
+ assertFalse(ClassTools.classNamedIsVariablePrimitiveWrapperClass(java.lang.Void.class.getName()));
+
+ assertTrue(ClassTools.classNamedIsVariablePrimitiveWrapperClass(java.lang.Integer.class.getName()));
+ assertTrue(ClassTools.classNamedIsVariablePrimitiveWrapperClass(java.lang.Float.class.getName()));
+ assertTrue(ClassTools.classNamedIsVariablePrimitiveWrapperClass(java.lang.Boolean.class.getName()));
+
+ assertFalse(ClassTools.classNamedIsVariablePrimitiveWrapperClass(java.lang.Number.class.getName()));
+ assertFalse(ClassTools.classNamedIsVariablePrimitiveWrapperClass(java.lang.String.class.getName()));
+ assertFalse(ClassTools.classNamedIsVariablePrimitiveWrapperClass(java.lang.Object.class.getName()));
+ }
+
+ public void testClassForTypeDeclarationStringInt() throws Exception {
assertEquals(int.class, ClassTools.classForTypeDeclaration("int", 0));
assertEquals(int[].class, ClassTools.classForTypeDeclaration("int", 1));
assertEquals(int[][][].class, ClassTools.classForTypeDeclaration("int", 3));
@@ -510,7 +571,31 @@ public class ClassToolsTests extends TestCase {
}
}
- public void testClassNameForTypeDeclaration() throws Exception {
+ public void testClassNameForTypeDeclarationString() throws Exception {
+ assertEquals("int", ClassTools.classNameForTypeDeclaration("int"));
+ assertEquals("[I", ClassTools.classNameForTypeDeclaration("int[]"));
+ assertEquals("[[I", ClassTools.classNameForTypeDeclaration("int [ ] [ ]"));
+
+ assertEquals("java.lang.Object", ClassTools.classNameForTypeDeclaration("java.lang.Object"));
+ assertEquals("[Ljava.lang.Object;", ClassTools.classNameForTypeDeclaration("java.lang.Object\t[]"));
+ assertEquals("[[Ljava.lang.Object;", ClassTools.classNameForTypeDeclaration("java.lang.Object\t[]\t[]"));
+ }
+
+ public void testArrayDepthForTypeDeclarationString() throws Exception {
+ assertEquals(0, ClassTools.arrayDepthForTypeDeclaration("java.lang.Object"));
+ assertEquals(1, ClassTools.arrayDepthForTypeDeclaration("java.lang.Object[]"));
+ assertEquals(3, ClassTools.arrayDepthForTypeDeclaration("java.lang.Object[][][]"));
+
+ assertEquals(0, ClassTools.arrayDepthForTypeDeclaration("int"));
+ assertEquals(1, ClassTools.arrayDepthForTypeDeclaration("int[]"));
+ assertEquals(3, ClassTools.arrayDepthForTypeDeclaration("int[][][]"));
+
+ assertEquals(0, ClassTools.arrayDepthForTypeDeclaration("float"));
+ assertEquals(1, ClassTools.arrayDepthForTypeDeclaration("float [ ]"));
+ assertEquals(3, ClassTools.arrayDepthForTypeDeclaration("float[] [] []"));
+ }
+
+ public void testClassNameForTypeDeclarationStringInt() throws Exception {
assertEquals(int.class.getName(), ClassTools.classNameForTypeDeclaration("int", 0));
assertEquals(int[].class.getName(), ClassTools.classNameForTypeDeclaration("int", 1));
assertEquals(int[][][].class.getName(), ClassTools.classNameForTypeDeclaration("int", 3));
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/ClasspathTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/ClasspathTests.java
index 54beea0c81..4e19dac30c 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/ClasspathTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/ClasspathTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -106,7 +106,7 @@ public class ClasspathTests extends TestCase {
public void testEntries() {
Classpath cp = new Classpath(this.morph("C:\\jdk\\rt.jar;;.;C:\\jdk\\i18n.jar;;;C:\\jdk\\jaws.jar;;C:\\foo\\classes;C:\\bar\\bar.jar;C:\\bar\\bar.jar;"));
- Classpath.Entry[] entries = cp.getEntries();
+ Classpath.Entry[] entries = cp.entries();
int i = 0;
assertEquals(this.morph("C:\\jdk\\rt.jar"), entries[i++].fileName());
assertEquals(this.morph("."), entries[i++].fileName());
@@ -118,7 +118,7 @@ public class ClasspathTests extends TestCase {
assertEquals(i, entries.length);
cp = cp.compressed();
- entries = cp.getEntries();
+ entries = cp.entries();
i = 0;
assertEquals(this.morph("C:\\jdk\\rt.jar"), entries[i++].fileName());
assertEquals(this.morph("."), entries[i++].fileName());
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/CollectionToolsTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/CollectionToolsTests.java
index 654fc83d80..e02ee44d6f 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/CollectionToolsTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/CollectionToolsTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -279,6 +279,14 @@ public class CollectionToolsTests extends TestCase {
assertTrue(Arrays.equals(new Object[] { "a", "b", "X", "X", "X", "c", "d" }, a));
}
+ public void testAddAllObjectArrayIntObjectArray4() {
+ Object[] a = new Object[] { "a", "b", "c", "d" };
+ a = CollectionTools.addAll(a, 4, new String[] { "X", "X", "X" });
+ assertEquals(7, a.length);
+ assertTrue(CollectionTools.contains(a, "X"));
+ assertTrue(Arrays.equals(new Object[] { "a", "b", "c", "d", "X", "X", "X" }, a));
+ }
+
public void testAddAllCharArrayCharArray() {
char[] a = CollectionTools.addAll(this.buildCharArray(), new char[] { 'd', 'e' });
assertEquals(5, a.length);
@@ -1259,9 +1267,9 @@ public class CollectionToolsTests extends TestCase {
boolean exceptionThrown = false;
try {
- emptyIterable.iterator();
- }
- catch (IllegalStateException ise) {
+ emptyIterator = emptyIterable.iterator();
+ fail("invalid iterator: " + emptyIterator);
+ } catch (IllegalStateException ise) {
exceptionThrown = true;
}
assertTrue("IllegalStateException not thrown.", exceptionThrown);
@@ -1933,16 +1941,34 @@ public class CollectionToolsTests extends TestCase {
assertTrue(Arrays.equals(new String[] { "A", "B", "A", "D" }, a));
}
+ public void testRemoveElementsAtIndexObjectArrayIntIntEmpty() {
+ String[] a = new String[] { "A", "B", "A", "C", "A", "D" };
+ a = CollectionTools.removeElementsAtIndex(a, 0, 6);
+ assertEquals(0, a.length);
+ }
+
public void testRemoveElementsAtIndexCharArrayIntInt() {
char[] a = new char[] { 'A', 'B', 'A', 'C', 'A', 'D' };
a = CollectionTools.removeElementsAtIndex(a, 0, 5);
assertTrue(Arrays.equals(new char[] { 'D' }, a));
}
+ public void testRemoveElementsAtIndexCharArrayIntIntEmpty() {
+ char[] a = new char[] { 'A', 'B', 'A', 'C', 'A', 'D' };
+ a = CollectionTools.removeElementsAtIndex(a, 0, 6);
+ assertEquals(0, a.length);
+ }
+
public void testRemoveElementsAtIndexIntArrayIntInt() {
int[] a = new int[] { 8, 6, 7, 33, 2, 11 };
- a = CollectionTools.removeElementAtIndex(a, 3);
- assertTrue(Arrays.equals(new int[] { 8, 6, 7, 2, 11 }, a));
+ a = CollectionTools.removeElementsAtIndex(a, 3, 3);
+ assertTrue(Arrays.equals(new int[] { 8, 6, 7 }, a));
+ }
+
+ public void testRemoveElementsAtIndexIntArrayIntIntEmpty() {
+ int[] a = new int[] { 8, 6, 7, 33, 2, 11 };
+ a = CollectionTools.removeElementsAtIndex(a, 0, 6);
+ assertEquals(0, a.length);
}
public void testReplaceAllObjectArray1() {
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/IndentingPrintWriterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/IndentingPrintWriterTests.java
index c96213249b..b971895bc1 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/IndentingPrintWriterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/IndentingPrintWriterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -41,31 +41,31 @@ public class IndentingPrintWriterTests extends TestCase {
}
public void testIndent() {
- assertEquals("wrong indent level", 0, this.ipw1.getIndentLevel());
+ assertEquals("wrong indent level", 0, this.ipw1.indentLevel());
this.ipw1.indent();
- assertEquals("wrong indent level", 1, this.ipw1.getIndentLevel());
+ assertEquals("wrong indent level", 1, this.ipw1.indentLevel());
}
public void testUndent() {
- assertEquals("wrong indent level", 0, this.ipw1.getIndentLevel());
+ assertEquals("wrong indent level", 0, this.ipw1.indentLevel());
this.ipw1.indent();
- assertEquals("wrong indent level", 1, this.ipw1.getIndentLevel());
+ assertEquals("wrong indent level", 1, this.ipw1.indentLevel());
this.ipw1.undent();
- assertEquals("wrong indent level", 0, this.ipw1.getIndentLevel());
+ assertEquals("wrong indent level", 0, this.ipw1.indentLevel());
}
public void testIncrementIndentLevel() {
- assertEquals("wrong indent level", 0, this.ipw1.getIndentLevel());
+ assertEquals("wrong indent level", 0, this.ipw1.indentLevel());
this.ipw1.incrementIndentLevel();
- assertEquals("wrong indent level", 1, this.ipw1.getIndentLevel());
+ assertEquals("wrong indent level", 1, this.ipw1.indentLevel());
}
public void testDecrementIndentLevel() {
- assertEquals("wrong indent level", 0, this.ipw1.getIndentLevel());
+ assertEquals("wrong indent level", 0, this.ipw1.indentLevel());
this.ipw1.incrementIndentLevel();
- assertEquals("wrong indent level", 1, this.ipw1.getIndentLevel());
+ assertEquals("wrong indent level", 1, this.ipw1.indentLevel());
this.ipw1.decrementIndentLevel();
- assertEquals("wrong indent level", 0, this.ipw1.getIndentLevel());
+ assertEquals("wrong indent level", 0, this.ipw1.indentLevel());
}
public void testPrintTab() {
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/JDBCTypeTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/JDBCTypeTests.java
index 40f152dfa9..07dad198b5 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/JDBCTypeTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/JDBCTypeTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -26,19 +26,19 @@ public class JDBCTypeTests extends TestCase {
public void testName() {
JDBCType jdbcType;
jdbcType = JDBCType.type(Types.VARCHAR);
- assertEquals("VARCHAR", jdbcType.getName());
+ assertEquals("VARCHAR", jdbcType.name());
jdbcType = JDBCType.type(Types.INTEGER);
- assertEquals("INTEGER", jdbcType.getName());
+ assertEquals("INTEGER", jdbcType.name());
}
public void testCode() {
JDBCType jdbcType;
jdbcType = JDBCType.type(Types.VARCHAR);
- assertEquals(Types.VARCHAR, jdbcType.getCode());
+ assertEquals(Types.VARCHAR, jdbcType.code());
jdbcType = JDBCType.type(Types.INTEGER);
- assertEquals(Types.INTEGER, jdbcType.getCode());
+ assertEquals(Types.INTEGER, jdbcType.code());
}
public void testInvalidTypeCode() throws Exception {
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/JavaTypeTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/JavaTypeTests.java
index 1a0c0b826f..57a10be26a 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/JavaTypeTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/JavaTypeTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -76,49 +76,49 @@ public class JavaTypeTests extends TestCase {
public void testElementTypeName() throws Exception {
JavaType javaType;
javaType = new JavaType(java.lang.Object.class);
- assertEquals("java.lang.Object", javaType.getElementTypeName());
+ assertEquals("java.lang.Object", javaType.elementTypeName());
javaType = new JavaType(java.lang.Object[].class);
- assertEquals("java.lang.Object", javaType.getElementTypeName());
+ assertEquals("java.lang.Object", javaType.elementTypeName());
javaType = new JavaType(int.class);
- assertEquals("int", javaType.getElementTypeName());
+ assertEquals("int", javaType.elementTypeName());
javaType = new JavaType(int[].class);
- assertEquals("int", javaType.getElementTypeName());
+ assertEquals("int", javaType.elementTypeName());
javaType = new JavaType(void.class);
- assertEquals("void", javaType.getElementTypeName());
+ assertEquals("void", javaType.elementTypeName());
javaType = new JavaType(java.util.Map.Entry.class);
- assertEquals("java.util.Map$Entry", javaType.getElementTypeName());
+ assertEquals("java.util.Map$Entry", javaType.elementTypeName());
javaType = new JavaType(java.util.Map.Entry[][].class);
- assertEquals("java.util.Map$Entry", javaType.getElementTypeName());
+ assertEquals("java.util.Map$Entry", javaType.elementTypeName());
}
public void testArrayDepth() throws Exception {
JavaType javaType;
javaType = new JavaType(java.lang.Object.class);
- assertEquals(0, javaType.getArrayDepth());
+ assertEquals(0, javaType.arrayDepth());
javaType = new JavaType(java.lang.Object[].class);
- assertEquals(1, javaType.getArrayDepth());
+ assertEquals(1, javaType.arrayDepth());
javaType = new JavaType(int.class);
- assertEquals(0, javaType.getArrayDepth());
+ assertEquals(0, javaType.arrayDepth());
javaType = new JavaType(int[].class);
- assertEquals(1, javaType.getArrayDepth());
+ assertEquals(1, javaType.arrayDepth());
javaType = new JavaType(void.class);
- assertEquals(0, javaType.getArrayDepth());
+ assertEquals(0, javaType.arrayDepth());
javaType = new JavaType(java.util.Map.Entry.class);
- assertEquals(0, javaType.getArrayDepth());
+ assertEquals(0, javaType.arrayDepth());
javaType = new JavaType(java.util.Map.Entry[][].class);
- assertEquals(2, javaType.getArrayDepth());
+ assertEquals(2, javaType.arrayDepth());
}
public void testIsArray() throws Exception {
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/StringToolsTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/StringToolsTests.java
index 68161e88fc..42f6936eb1 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/StringToolsTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/StringToolsTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -515,6 +515,67 @@ public class StringToolsTests extends TestCase {
assertEquals(expectedString, sb.toString());
}
+ public void testRemoveAllWhitespace() {
+ this.verifyRemoveAllWhitespace("Employee Fred\t", ' ', "EmployeeFred");
+ this.verifyRemoveAllWhitespace("\tEmployee\n", ' ', "Employee");
+ this.verifyRemoveAllWhitespace("Employee \t Foo", ' ', "EmployeeFoo");
+ this.verifyRemoveAllWhitespace(" Emp\tloyee \n Foo", ' ', "EmployeeFoo");
+ }
+
+ private void verifyRemoveAllWhitespace(String string, char charToRemove, String expectedString) {
+ assertEquals(expectedString, StringTools.removeAllWhitespace(string));
+ }
+
+ public void testRemoveAllWhitespaceCharArray() {
+ this.verifyRemoveAllWhitespaceCharArray("Employee Fred\t", ' ', "EmployeeFred");
+ this.verifyRemoveAllWhitespaceCharArray("\tEmployee\n", ' ', "Employee");
+ this.verifyRemoveAllWhitespaceCharArray("Employee \t Foo", ' ', "EmployeeFoo");
+ this.verifyRemoveAllWhitespaceCharArray(" Emp\tloyee \n Foo", ' ', "EmployeeFoo");
+ }
+
+ private void verifyRemoveAllWhitespaceCharArray(String string, char charToRemove, String expectedString) {
+ assertEquals(expectedString, new String(StringTools.removeAllWhitespace(string.toCharArray())));
+ }
+
+ public void testRemoveAllWhitespaceOnWriter() {
+ this.verifyRemoveAllWhitespaceOnWriter("Employee Fred\t", ' ', "EmployeeFred");
+ this.verifyRemoveAllWhitespaceOnWriter("\tEmployee\n", ' ', "Employee");
+ this.verifyRemoveAllWhitespaceOnWriter("Employee \t Foo", ' ', "EmployeeFoo");
+ this.verifyRemoveAllWhitespaceOnWriter(" Emp\tloyee \n Foo", ' ', "EmployeeFoo");
+ }
+
+ private void verifyRemoveAllWhitespaceOnWriter(String string, char charToRemove, String expectedString) {
+ Writer writer = new StringWriter();
+ StringTools.removeAllWhitespaceOn(string, writer);
+ assertEquals(expectedString, writer.toString());
+ }
+
+ public void testRemoveAllWhitespaceOnStringBuffer() {
+ this.verifyRemoveAllWhitespaceOnStringBuffer("Employee Fred\t", ' ', "EmployeeFred");
+ this.verifyRemoveAllWhitespaceOnStringBuffer("\tEmployee\n", ' ', "Employee");
+ this.verifyRemoveAllWhitespaceOnStringBuffer("Employee \t Foo", ' ', "EmployeeFoo");
+ this.verifyRemoveAllWhitespaceOnStringBuffer(" Emp\tloyee \n Foo", ' ', "EmployeeFoo");
+ }
+
+ private void verifyRemoveAllWhitespaceOnStringBuffer(String string, char charToRemove, String expectedString) {
+ StringBuffer sb = new StringBuffer();
+ StringTools.removeAllWhitespaceOn(string, sb);
+ assertEquals(expectedString, sb.toString());
+ }
+
+ public void testRemoveAllWhitespaceOnStringBuilder() {
+ this.verifyRemoveAllWhitespaceOnStringBuilder("Employee Fred\t", ' ', "EmployeeFred");
+ this.verifyRemoveAllWhitespaceOnStringBuilder("\tEmployee\n", ' ', "Employee");
+ this.verifyRemoveAllWhitespaceOnStringBuilder("Employee \t Foo", ' ', "EmployeeFoo");
+ this.verifyRemoveAllWhitespaceOnStringBuilder(" Emp\tloyee \n Foo", ' ', "EmployeeFoo");
+ }
+
+ private void verifyRemoveAllWhitespaceOnStringBuilder(String string, char charToRemove, String expectedString) {
+ StringBuilder sb = new StringBuilder();
+ StringTools.removeAllWhitespaceOn(string, sb);
+ assertEquals(expectedString, sb.toString());
+ }
+
// ********** common prefix **********
public void testCommonPrefixLength() {
@@ -885,6 +946,38 @@ public class StringToolsTests extends TestCase {
assertEquals(expected, writer.toString());
}
+ public void testConvertCamelCaseToAllCapsOnStringBuffer() {
+ this.verifyConvertCamelCaseToAllCapsOnStringBuffer("TEST", "test");
+ this.verifyConvertCamelCaseToAllCapsOnStringBuffer("TEST", "TEST");
+ this.verifyConvertCamelCaseToAllCapsOnStringBuffer("TEST_TEST", "testTest");
+ this.verifyConvertCamelCaseToAllCapsOnStringBuffer("TEST_TEST", "TestTest");
+ this.verifyConvertCamelCaseToAllCapsOnStringBuffer("TEST_TEST_TEST", "testTESTTest");
+ this.verifyConvertCamelCaseToAllCapsOnStringBuffer("TEST_TEST_TEST", "TestTESTTest");
+ this.verifyConvertCamelCaseToAllCapsOnStringBuffer("TEST_TEST_TEST_T", "TestTESTTestT");
+ }
+
+ private void verifyConvertCamelCaseToAllCapsOnStringBuffer(String expected, String string) {
+ StringBuffer sb = new StringBuffer();
+ StringTools.convertCamelCaseToAllCapsOn(string, sb);
+ assertEquals(expected, sb.toString());
+ }
+
+ public void testConvertCamelCaseToAllCapsOnStringBuilder() {
+ this.verifyConvertCamelCaseToAllCapsOnStringBuilder("TEST", "test");
+ this.verifyConvertCamelCaseToAllCapsOnStringBuilder("TEST", "TEST");
+ this.verifyConvertCamelCaseToAllCapsOnStringBuilder("TEST_TEST", "testTest");
+ this.verifyConvertCamelCaseToAllCapsOnStringBuilder("TEST_TEST", "TestTest");
+ this.verifyConvertCamelCaseToAllCapsOnStringBuilder("TEST_TEST_TEST", "testTESTTest");
+ this.verifyConvertCamelCaseToAllCapsOnStringBuilder("TEST_TEST_TEST", "TestTESTTest");
+ this.verifyConvertCamelCaseToAllCapsOnStringBuilder("TEST_TEST_TEST_T", "TestTESTTestT");
+ }
+
+ private void verifyConvertCamelCaseToAllCapsOnStringBuilder(String expected, String string) {
+ StringBuilder sb = new StringBuilder();
+ StringTools.convertCamelCaseToAllCapsOn(string, sb);
+ assertEquals(expected, sb.toString());
+ }
+
public void testConvertCamelCaseToAllCapsMaxLength() {
assertEquals("TEST", StringTools.convertCamelCaseToAllCaps("test", 44));
assertEquals("TEST", StringTools.convertCamelCaseToAllCaps("test", 4));
@@ -929,6 +1022,31 @@ public class StringToolsTests extends TestCase {
assertEquals(expected, writer.toString());
}
+ public void testConvertCamelCaseToAllCapsMaxLengthOnStringBuffer() {
+ this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST", "test", 44);
+ this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST", "test", 4);
+ this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TES", "test", 3);
+ this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST", "TEST", 5);
+ this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TE", "TEST", 2);
+ this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_TEST", "testTest", 9);
+ this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_TES", "testTest", 8);
+ this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_T", "testTest", 6);
+ this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_", "testTest", 5);
+ this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST", "testTest", 4);
+ this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_TEST", "TestTest", 9);
+ this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_TEST", "TestTest", 1100);
+ this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_TEST_", "testTESTTest", 10);
+ this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_TEST_TEST", "TestTESTTest", 14);
+ this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_TEST_TEST_T", "TestTESTTestT", 16);
+ this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_TEST_TEST_", "TestTESTTestT", 15);
+ }
+
+ private void verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer(String expected, String string, int max) {
+ StringBuffer sb = new StringBuffer();
+ StringTools.convertCamelCaseToAllCapsOn(string, max, sb);
+ assertEquals(expected, sb.toString());
+ }
+
public void testConvertUnderscoresToCamelCase() {
assertEquals("test", StringTools.convertUnderscoresToCamelCase("TEST", false));
assertEquals("test", StringTools.convertUnderscoresToCamelCase("TEST_", false));
@@ -1011,4 +1129,48 @@ public class StringToolsTests extends TestCase {
assertEquals(expected, writer.toString());
}
+ public void testConvertUnderscoresToCamelCaseOnStringBuffer() {
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("test", "TEST", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("test", "TEST_", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("test", "TEST____", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("Test", "TEST", true);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("test", "TeST", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTest", "TEST_TEST", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTest", "TEST___TEST", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTest", "TEST_TEST", true);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTestTest", "TEST_TEST_TEST", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTestTest", "TEST_TEST_TEST", true);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTestTestT", "TEST_TEST_TEST_T", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTestTestT", "_TEST_TEST_TEST_T", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTestTestT", "__TEST_TEST_TEST_T", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTestTestT", "TEST_TEST_TEST_T", true);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTestTestT", "_TEST_TEST_TEST_T", true);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTestTestT", "__TEST_TEST_TEST_T", true);
+ }
+
+ public void testConvertUnderscoresToCamelCaseOnStringBufferLowercase() {
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("test", "test", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("test", "test_", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("test", "test____", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("Test", "test", true);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("test", "test", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTest", "test_test", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTest", "test___test", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTest", "test_test", true);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTestTest", "test_test_test", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTestTest", "test_test_test", true);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTestTestT", "test_test_test_t", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTestTestT", "_test_test_test_t", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTestTestT", "__test_test_test_t", false);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTestTestT", "test_test_test_t", true);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTestTestT", "_test_test_test_t", true);
+ this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTestTestT", "__test_test_test_t", true);
+ }
+
+ private void verifyConvertUnderscoresToCamelCaseOnStringBuffer(String expected, String string, boolean capitalizeFirstLetter) {
+ StringBuffer sb = new StringBuffer();
+ StringTools.convertUnderscoresToCamelCaseOn(string, capitalizeFirstLetter, sb);
+ assertEquals(expected, sb.toString());
+ }
+
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/CompositeIteratorTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/CompositeIteratorTests.java
index d7173cefa8..58c3976076 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/CompositeIteratorTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/CompositeIteratorTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -73,6 +73,10 @@ public class CompositeIteratorTests extends TestCase {
}
public void testRemove() {
+ this.verifyRemove();
+ }
+
+ protected void verifyRemove() {
List<String> list1 = this.buildList1();
Object lastElement1 = list1.get(list1.size() - 1);
List<String> list2 = this.buildList2();
@@ -153,6 +157,10 @@ public class CompositeIteratorTests extends TestCase {
}
public void testIllegalStateException() {
+ this.verifyIllegalStateException();
+ }
+
+ void verifyIllegalStateException() {
this.verifyIllegalStateException(this.buildCompositeIterator());
}
@@ -184,6 +192,10 @@ public class CompositeIteratorTests extends TestCase {
}
public void testEmptyIllegalStateException1() {
+ this.verifyEmptyIllegalStateException1();
+ }
+
+ void verifyEmptyIllegalStateException1() {
this.verifyIllegalStateException(this.buildEmptyCompositeIterator1());
}
@@ -196,6 +208,10 @@ public class CompositeIteratorTests extends TestCase {
}
public void testEmptyIllegalStateException2() {
+ this.verifyEmptyIllegalStateException2();
+ }
+
+ void verifyEmptyIllegalStateException2() {
this.verifyIllegalStateException(this.buildEmptyCompositeIterator2());
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/CompositeListIteratorTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/CompositeListIteratorTests.java
index f2de1d1426..2d2bdbec7a 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/CompositeListIteratorTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/CompositeListIteratorTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -13,38 +13,16 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
-import java.util.NoSuchElementException;
+
import org.eclipse.jpt.utility.internal.iterators.CompositeListIterator;
-public class CompositeListIteratorTests extends CompositeIteratorTests {
+public class CompositeListIteratorTests extends ReadOnlyCompositeListIteratorTests {
public CompositeListIteratorTests(String name) {
super(name);
}
@Override
- void verifyHasAnother(Iterator<String> stream) {
- super.verifyHasAnother(stream);
- ListIterator<String> stream2 = (ListIterator<String>) stream;
- int i = 0;
- while (stream2.hasPrevious()) {
- stream2.previous();
- i++;
- }
- assertEquals(8, i);
- }
-
- @Override
- void verifyAnother(Iterator<String> stream) {
- super.verifyAnother(stream);
- int i = 8;
- ListIterator<String> stream2 = (ListIterator<String>) stream;
- while (stream2.hasPrevious()) {
- assertEquals("bogus element", String.valueOf(i--), stream2.previous().substring(0, 1));
- }
- }
-
- @Override
public void testRemove() {
super.testRemove();
List<String> list1 = this.buildList1();
@@ -270,6 +248,7 @@ public class CompositeListIteratorTests extends CompositeIteratorTests {
assertFalse("element not set in collection 3", list3.contains(firstElement3));
}
+ @Override
public void testNextIndexPreviousIndex() {
int i = 0;
ListIterator<String> stream = (ListIterator<String>) this.buildCompositeIterator();
@@ -310,68 +289,19 @@ public class CompositeListIteratorTests extends CompositeIteratorTests {
assertEquals("index is corrupt", 0, i);
}
- public void testPreviousIndex() {
- // TODO
- }
-
@Override
- void verifyNoSuchElementException(Iterator<String> stream) {
- super.verifyNoSuchElementException(stream);
- ListIterator<String> stream2 = (ListIterator<String>) stream;
- boolean exCaught = false;
- String string = null;
- while (stream2.hasPrevious()) {
- string = stream2.previous();
- }
- try {
- string = stream2.previous();
- } catch (NoSuchElementException ex) {
- exCaught = true;
- }
- assertTrue("NoSuchElementException not thrown: " + string, exCaught);
- }
-
- @Override
- void verifyUnsupportedOperationException(Iterator<String> stream) {
- super.verifyUnsupportedOperationException(stream);
- boolean exCaught = false;
- ListIterator<String> stream2 = (ListIterator<String>) stream;
- while (stream2.hasPrevious()) {
- Object string = stream2.previous();
- if (string.equals("333")) {
- try {
- stream2.remove();
- } catch (UnsupportedOperationException ex) {
- exCaught = true;
- }
- }
- }
- assertTrue("UnsupportedOperationException not thrown", exCaught);
+ public void testIllegalStateException() {
+ this.verifyIllegalStateException();
}
@Override
- void verifyIllegalStateException(Iterator<String> stream) {
- super.verifyIllegalStateException(stream);
- ListIterator<String> stream2 = (ListIterator<String>) stream;
- boolean exCaught = false;
- try {
- stream2.set("junk");
- } catch (IllegalStateException ex) {
- exCaught = true;
- }
- assertTrue("IllegalStateException not thrown", exCaught);
+ public void testEmptyIllegalStateException1() {
+ this.verifyEmptyIllegalStateException1();
}
@Override
- void verifyEmptyHasAnother(Iterator<String> stream) {
- super.verifyEmptyHasAnother(stream);
- ListIterator<String> stream2 = (ListIterator<String>) stream;
- int i = 0;
- while (stream2.hasPrevious()) {
- stream2.previous();
- i++;
- }
- assertEquals(0, i);
+ public void testEmptyIllegalStateException2() {
+ this.verifyEmptyIllegalStateException2();
}
// unchecked so we can override the unchecked method in superclass
@@ -393,10 +323,7 @@ public class CompositeListIteratorTests extends CompositeIteratorTests {
return new CompositeListIterator<String>(new ListIterator[] { this.buildIterator1(), this.buildIterator2(), this.buildIterator3() });
}
- Iterator<String> buildCompositeIterator(String string, ListIterator<String> iterator) {
- return this.buildCompositeListIterator(string, iterator);
- }
-
+ @Override
ListIterator<String> buildCompositeListIterator(String string, ListIterator<String> iterator) {
return new CompositeListIterator<String>(string, iterator);
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/FilteringIteratorTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/FilteringIteratorTests.java
index 44b9c8c0c3..c23fcfa94b 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/FilteringIteratorTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/FilteringIteratorTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 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.
@@ -129,10 +129,10 @@ public class FilteringIteratorTests extends TestCase {
integers.add(new Integer(1));
integers.add(new Integer(2));
integers.add(new Integer(3));
- Iterator<Number> stream = new FilteringIterator<Number>(integers.iterator()) {
+ Iterator<Number> stream = new FilteringIterator<Integer, Number>(integers.iterator()) {
@Override
- protected boolean accept(Object o) {
- return ((Number) o).intValue() > 1;
+ protected boolean accept(Integer o) {
+ return o.intValue() > 1;
}
};
assertEquals(2, CollectionTools.size(stream));
@@ -141,14 +141,14 @@ public class FilteringIteratorTests extends TestCase {
// test a filtered iterator with a nested iterator of a super-type (Integer vs. Number)
// i.e. trust that Filter will only return the appropriate sub-type objects
public void testGenerics2() {
- List<Number> integers = new ArrayList<Number>();
- integers.add(new Integer(0));
- integers.add(new Long(1));
- integers.add(new Integer(2));
- integers.add(new Float(3));
- Iterator<Integer> stream = new FilteringIterator<Integer>(integers.iterator()) {
+ List<Number> numbers = new ArrayList<Number>();
+ numbers.add(new Integer(0));
+ numbers.add(new Long(1));
+ numbers.add(new Integer(2));
+ numbers.add(new Float(3));
+ Iterator<Integer> stream = new FilteringIterator<Number, Integer>(numbers.iterator()) {
@Override
- protected boolean accept(Object o) {
+ protected boolean accept(Number o) {
return o instanceof Integer;
}
};
@@ -171,14 +171,14 @@ public class FilteringIteratorTests extends TestCase {
}
private Iterator<String> buildFilteredIterator(Iterator<String> nestedIterator, Filter<String> filter) {
- return new FilteringIterator<String>(nestedIterator, filter);
+ return new FilteringIterator<String, String>(nestedIterator, filter);
}
private Iterator<String> buildInnerFilteredIterator(Iterator<String> nestedIterator) {
- return new FilteringIterator<String>(nestedIterator) {
+ return new FilteringIterator<String, String>(nestedIterator) {
@Override
- protected boolean accept(Object o) {
- return ((String) o).startsWith(PREFIX);
+ protected boolean accept(String s) {
+ return s.startsWith(PREFIX);
}
};
}
@@ -189,10 +189,10 @@ public class FilteringIteratorTests extends TestCase {
// this inner iterator will call the "outer" object
private Iterator<String> buildInnerFilteredIterator2(Iterator<String> nestedIterator) {
- return new FilteringIterator<String>(nestedIterator) {
+ return new FilteringIterator<String, String>(nestedIterator) {
@Override
- protected boolean accept(Object o) {
- return ((String) o).startsWith(FilteringIteratorTests.this.getPrefix());
+ protected boolean accept(String s) {
+ return s.startsWith(FilteringIteratorTests.this.getPrefix());
}
};
}
@@ -286,6 +286,19 @@ public class FilteringIteratorTests extends TestCase {
boolean exCaught = false;
try {
// missing method override
+ Iterator<String> iterator = new FilteringIterator<String, String>(this.buildNestedIterator());
+ String s = iterator.next();
+ fail("invalid string: " + s);
+ } catch (UnsupportedOperationException ex) {
+ exCaught = true;
+ }
+ assertTrue("NoSuchElementException not thrown", exCaught);
+ }
+
+ public void testInvalidFilteringIterator() {
+ boolean exCaught = false;
+ try {
+ // missing method override
Iterator<String> iterator = new FilteringIterator<String>(this.buildNestedIterator());
String s = iterator.next();
fail("invalid string: " + s);
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/JptUtilityIteratorsTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/JptUtilityIteratorsTests.java
index 297876647b..8d9d3f7270 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/JptUtilityIteratorsTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/JptUtilityIteratorsTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 Oracle. All rights reserved.
+ * Copyright (c) 2005, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -35,6 +35,7 @@ public class JptUtilityIteratorsTests {
suite.addTestSuite(GraphIteratorTests.class);
suite.addTestSuite(IteratorEnumerationTests.class);
suite.addTestSuite(PeekableIteratorTests.class);
+ suite.addTestSuite(ReadOnlyCompositeListIteratorTests.class);
suite.addTestSuite(ReadOnlyIteratorTests.class);
suite.addTestSuite(ReadOnlyListIteratorTests.class);
suite.addTestSuite(SingleElementIteratorTests.class);
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/ReadOnlyCompositeListIteratorTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/ReadOnlyCompositeListIteratorTests.java
new file mode 100644
index 0000000000..a031166f12
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/iterators/ReadOnlyCompositeListIteratorTests.java
@@ -0,0 +1,205 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.utility.tests.internal.iterators;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+import org.eclipse.jpt.utility.internal.iterators.ReadOnlyCompositeListIterator;
+
+public class ReadOnlyCompositeListIteratorTests extends CompositeIteratorTests {
+
+ public ReadOnlyCompositeListIteratorTests(String name) {
+ super(name);
+ }
+
+ @Override
+ void verifyHasAnother(Iterator<String> stream) {
+ super.verifyHasAnother(stream);
+ ListIterator<String> stream2 = (ListIterator<String>) stream;
+ int i = 0;
+ while (stream2.hasPrevious()) {
+ stream2.previous();
+ i++;
+ }
+ assertEquals(8, i);
+ }
+
+ @Override
+ void verifyAnother(Iterator<String> stream) {
+ super.verifyAnother(stream);
+ int i = 8;
+ ListIterator<String> stream2 = (ListIterator<String>) stream;
+ while (stream2.hasPrevious()) {
+ assertEquals("bogus element", String.valueOf(i--), stream2.previous().substring(0, 1));
+ }
+ }
+
+ public void testNextIndexPreviousIndex() {
+ int i = 0;
+ ListIterator<String> stream = (ListIterator<String>) this.buildCompositeIterator();
+ assertEquals(i, stream.nextIndex());
+ assertEquals(i - 1, stream.previousIndex());
+ while (stream.hasNext()) {
+ stream.next();
+ i++;
+ assertEquals(i, stream.nextIndex());
+ assertEquals(i - 1, stream.previousIndex());
+ }
+ assertEquals("index is corrupt", 8, i);
+
+ assertEquals(i, stream.nextIndex());
+ assertEquals(i - 1, stream.previousIndex());
+ while (stream.hasPrevious()) {
+ stream.previous();
+ i--;
+ assertEquals(i, stream.nextIndex());
+ assertEquals(i - 1, stream.previousIndex());
+ }
+ assertEquals("index is corrupt", 0, i);
+ }
+
+ public void testPreviousIndex() {
+ // TODO
+ }
+
+ @Override
+ public void testRemove() {
+ // #remove() is not supported
+ }
+
+ @Override
+ public void testIllegalStateException() {
+ // #remove() is not supported
+ }
+
+ @Override
+ public void testEmptyIllegalStateException1() {
+ // #remove() is not supported
+ }
+
+ @Override
+ public void testEmptyIllegalStateException2() {
+ // #remove() is not supported
+ }
+
+ @Override
+ void verifyNoSuchElementException(Iterator<String> stream) {
+ super.verifyNoSuchElementException(stream);
+ ListIterator<String> stream2 = (ListIterator<String>) stream;
+ boolean exCaught = false;
+ String string = null;
+ while (stream2.hasPrevious()) {
+ string = stream2.previous();
+ }
+ try {
+ string = stream2.previous();
+ } catch (NoSuchElementException ex) {
+ exCaught = true;
+ }
+ assertTrue("NoSuchElementException not thrown: " + string, exCaught);
+ }
+
+ @Override
+ void verifyUnsupportedOperationException(Iterator<String> stream) {
+ super.verifyUnsupportedOperationException(stream);
+ boolean exCaught = false;
+ ListIterator<String> stream2 = (ListIterator<String>) stream;
+ while (stream2.hasPrevious()) {
+ Object string = stream2.previous();
+ if (string.equals("333")) {
+ try {
+ stream2.remove();
+ } catch (UnsupportedOperationException ex) {
+ exCaught = true;
+ }
+ }
+ }
+ assertTrue("UnsupportedOperationException not thrown", exCaught);
+ }
+
+ @Override
+ void verifyIllegalStateException(Iterator<String> stream) {
+ super.verifyIllegalStateException(stream);
+ ListIterator<String> stream2 = (ListIterator<String>) stream;
+ boolean exCaught = false;
+ try {
+ stream2.set("junk");
+ } catch (IllegalStateException ex) {
+ exCaught = true;
+ }
+ assertTrue("IllegalStateException not thrown", exCaught);
+ }
+
+ @Override
+ void verifyEmptyHasAnother(Iterator<String> stream) {
+ super.verifyEmptyHasAnother(stream);
+ ListIterator<String> stream2 = (ListIterator<String>) stream;
+ int i = 0;
+ while (stream2.hasPrevious()) {
+ stream2.previous();
+ i++;
+ }
+ assertEquals(0, i);
+ }
+
+ // unchecked so we can override the unchecked method in superclass
+ @Override
+ @SuppressWarnings("unchecked")
+ Iterator<String> buildCompositeIterator(Iterator iterators) {
+ return new ReadOnlyCompositeListIterator<String>((ListIterator<ListIterator<String>>) iterators);
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ Iterator<String> buildCompositeIterator2() {
+ return new ReadOnlyCompositeListIterator<String>(this.buildIterator1(), this.buildIterator2(), this.buildIterator3());
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ Iterator<String> buildCompositeIterator3() {
+ return new ReadOnlyCompositeListIterator<String>(new ListIterator[] { this.buildIterator1(), this.buildIterator2(), this.buildIterator3() });
+ }
+
+ Iterator<String> buildCompositeIterator(String string, ListIterator<String> iterator) {
+ return this.buildCompositeListIterator(string, iterator);
+ }
+
+ ListIterator<String> buildCompositeListIterator(String string, ListIterator<String> iterator) {
+ return new ReadOnlyCompositeListIterator<String>(string, iterator);
+ }
+
+ public void testVariedNestedIterators() {
+ List<Integer> integerList = new ArrayList<Integer>();
+ integerList.add(42);
+ integerList.add(22);
+ integerList.add(111);
+ integerList.add(77);
+
+ List<Float> floatList = new ArrayList<Float>();
+ floatList.add(42.42f);
+ floatList.add(22.22f);
+ floatList.add(111.111f);
+ floatList.add(77.77f);
+
+ List<ListIterator<? extends Number>> list = new ArrayList<ListIterator<? extends Number>>();
+ list.add(integerList.listIterator());
+ list.add(floatList.listIterator());
+ ListIterator<Number> li = new ReadOnlyCompositeListIterator<Number>(list);
+ while (li.hasNext()) {
+ assertTrue(li.next().intValue() > 0);
+ }
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/AbstractModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/AbstractModelTests.java
index 93dc75a361..75a9d62fd9 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/AbstractModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/AbstractModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -1346,8 +1346,9 @@ public class AbstractModelTests
// assertEquals(Joo.class, listeners2[0].getClass());
// }
+// >>>>>>>>>>>>>>>>> these methods are called by #testSerialization(), commented out above...
private ChangeListener[] listeners(LocalModel model, Class<? extends ChangeListener> listenerClass) {
- ChangeSupport changeSupport = (ChangeSupport) ClassTools.getFieldValue(model, "changeSupport");
+ ChangeSupport changeSupport = (ChangeSupport) ClassTools.fieldValue(model, "changeSupport");
return (ChangeListener[]) ClassTools.executeMethod(changeSupport, "listeners", Class.class, listenerClass);
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/BufferedWritablePropertyValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/BufferedWritablePropertyValueModelTests.java
new file mode 100644
index 0000000000..6f31dac827
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/BufferedWritablePropertyValueModelTests.java
@@ -0,0 +1,410 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.tests.internal.model.value;
+
+import java.util.Date;
+
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.BufferedWritablePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.tests.internal.TestTools;
+
+import junit.framework.TestCase;
+
+public class BufferedWritablePropertyValueModelTests extends TestCase {
+ private Employee employee;
+ private WritablePropertyValueModel<Employee> employeeHolder;
+ PropertyChangeEvent employeeEvent;
+
+ private WritablePropertyValueModel<Integer> idAdapter;
+ private WritablePropertyValueModel<String> nameAdapter;
+ private WritablePropertyValueModel<Date> hireDateAdapter;
+ PropertyChangeEvent adapterEvent;
+
+ private BufferedWritablePropertyValueModel.Trigger trigger;
+ private WritablePropertyValueModel<Integer> bufferedIDHolder;
+ private WritablePropertyValueModel<String> bufferedNameHolder;
+ private WritablePropertyValueModel<Date> bufferedHireDateHolder;
+ PropertyChangeEvent bufferedEvent;
+
+ public BufferedWritablePropertyValueModelTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ this.employee = new Employee(17, "Freddy", new Date());
+ this.employeeHolder = new SimplePropertyValueModel<Employee>(this.employee);
+
+ this.trigger = new BufferedWritablePropertyValueModel.Trigger();
+
+ this.idAdapter = this.buildIDAdapter(this.employeeHolder);
+ this.bufferedIDHolder = new BufferedWritablePropertyValueModel<Integer>(this.idAdapter, this.trigger);
+
+ this.nameAdapter = this.buildNameAdapter(this.employeeHolder);
+ this.bufferedNameHolder = new BufferedWritablePropertyValueModel<String>(this.nameAdapter, this.trigger);
+
+ this.hireDateAdapter = this.buildHireDateAdapter(this.employeeHolder);
+ this.bufferedHireDateHolder = new BufferedWritablePropertyValueModel<Date>(this.hireDateAdapter, this.trigger);
+ }
+
+ private WritablePropertyValueModel<Integer> buildIDAdapter(PropertyValueModel<Employee> eHolder) {
+ return new PropertyAspectAdapter<Employee, Integer>(eHolder, Employee.ID_PROPERTY) {
+ @Override
+ protected Integer buildValue_() {
+ return new Integer(this.subject.getID());
+ }
+ @Override
+ protected void setValue_(Integer value) {
+ this.subject.setID(value.intValue());
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<String> buildNameAdapter(PropertyValueModel<Employee> eHolder) {
+ return new PropertyAspectAdapter<Employee, String>(eHolder, Employee.NAME_PROPERTY) {
+ @Override
+ protected String buildValue_() {
+ return this.subject.getName();
+ }
+ @Override
+ protected void setValue_(String value) {
+ this.subject.setName(value);
+ }
+ };
+ }
+
+ private WritablePropertyValueModel<Date> buildHireDateAdapter(PropertyValueModel<Employee> eHolder) {
+ return new PropertyAspectAdapter<Employee, Date>(eHolder, Employee.HIRE_DATE_PROPERTY) {
+ @Override
+ protected Date buildValue_() {
+ return this.subject.getHireDate();
+ }
+ @Override
+ protected void setValue_(Date value) {
+ this.subject.setHireDate(value);
+ }
+ };
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ TestTools.clear(this);
+ super.tearDown();
+ }
+
+ public void testValue() {
+ PropertyChangeListener bufferedListener = this.buildBufferedListener();
+ this.bufferedIDHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener);
+ this.bufferedNameHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener);
+ this.bufferedHireDateHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener);
+
+ assertEquals(new Integer(17), this.idAdapter.value());
+ assertEquals(new Integer(17), this.bufferedIDHolder.value());
+
+ assertEquals("Freddy", this.employee.getName());
+ assertEquals("Freddy", this.nameAdapter.value());
+ assertEquals("Freddy", this.bufferedNameHolder.value());
+
+ Date temp = this.employee.getHireDate();
+ assertEquals(temp, this.employee.getHireDate());
+ assertEquals(temp, this.hireDateAdapter.value());
+ assertEquals(temp, this.bufferedHireDateHolder.value());
+
+ this.bufferedIDHolder.setValue(new Integer(323));
+ assertEquals(17, this.employee.getID());
+ assertEquals(new Integer(17), this.idAdapter.value());
+ assertEquals(new Integer(323), this.bufferedIDHolder.value());
+
+ this.bufferedNameHolder.setValue("Ripley");
+ assertEquals("Freddy", this.employee.getName());
+ assertEquals("Freddy", this.nameAdapter.value());
+ assertEquals("Ripley", this.bufferedNameHolder.value());
+
+ this.bufferedHireDateHolder.setValue(null);
+ assertEquals(temp, this.employee.getHireDate());
+ assertEquals(temp, this.hireDateAdapter.value());
+ assertEquals(null, this.bufferedHireDateHolder.value());
+ }
+
+ public void testAccept() {
+ PropertyChangeListener bufferedListener = this.buildBufferedListener();
+ this.bufferedIDHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener);
+ this.bufferedNameHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener);
+ this.bufferedHireDateHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener);
+
+ this.bufferedIDHolder.setValue(new Integer(323));
+ assertEquals(17, this.employee.getID());
+ assertEquals(new Integer(17), this.idAdapter.value());
+ assertEquals(new Integer(323), this.bufferedIDHolder.value());
+
+ this.bufferedNameHolder.setValue("Ripley");
+ assertEquals("Freddy", this.employee.getName());
+ assertEquals("Freddy", this.nameAdapter.value());
+ assertEquals("Ripley", this.bufferedNameHolder.value());
+
+ Date temp = this.employee.getHireDate();
+ this.bufferedHireDateHolder.setValue(null);
+ assertEquals(temp, this.employee.getHireDate());
+ assertEquals(temp, this.hireDateAdapter.value());
+ assertEquals(null, this.bufferedHireDateHolder.value());
+
+ this.trigger.accept();
+
+ assertEquals(323, this.employee.getID());
+ assertEquals(new Integer(323), this.idAdapter.value());
+ assertEquals(new Integer(323), this.bufferedIDHolder.value());
+
+ assertEquals("Ripley", this.employee.getName());
+ assertEquals("Ripley", this.nameAdapter.value());
+ assertEquals("Ripley", this.bufferedNameHolder.value());
+
+ assertEquals(null, this.employee.getHireDate());
+ assertEquals(null, this.hireDateAdapter.value());
+ assertEquals(null, this.bufferedHireDateHolder.value());
+ }
+
+ public void testReset() {
+ PropertyChangeListener bufferedListener = this.buildBufferedListener();
+ this.bufferedIDHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener);
+ this.bufferedNameHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener);
+ this.bufferedHireDateHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener);
+
+ this.bufferedIDHolder.setValue(new Integer(323));
+ assertEquals(17, this.employee.getID());
+ assertEquals(new Integer(17), this.idAdapter.value());
+ assertEquals(new Integer(323), this.bufferedIDHolder.value());
+
+ this.bufferedNameHolder.setValue("Ripley");
+ assertEquals("Freddy", this.employee.getName());
+ assertEquals("Freddy", this.nameAdapter.value());
+ assertEquals("Ripley", this.bufferedNameHolder.value());
+
+ Date temp = this.employee.getHireDate();
+ this.bufferedHireDateHolder.setValue(null);
+ assertEquals(temp, this.employee.getHireDate());
+ assertEquals(temp, this.hireDateAdapter.value());
+ assertEquals(null, this.bufferedHireDateHolder.value());
+
+ this.trigger.reset();
+
+ assertEquals(17, this.employee.getID());
+ assertEquals(new Integer(17), this.idAdapter.value());
+ assertEquals(new Integer(17), this.bufferedIDHolder.value());
+
+ assertEquals("Freddy", this.employee.getName());
+ assertEquals("Freddy", this.nameAdapter.value());
+ assertEquals("Freddy", this.bufferedNameHolder.value());
+
+ assertEquals(temp, this.employee.getHireDate());
+ assertEquals(temp, this.hireDateAdapter.value());
+ assertEquals(temp, this.bufferedHireDateHolder.value());
+ }
+
+ public void testLazyListening() {
+ assertTrue(((AbstractModel) this.bufferedIDHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertTrue(((AbstractModel) this.bufferedNameHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertTrue(((AbstractModel) this.bufferedHireDateHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
+
+ assertTrue(((AbstractModel) this.idAdapter).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertTrue(((AbstractModel) this.nameAdapter).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertTrue(((AbstractModel) this.hireDateAdapter).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
+
+ assertTrue(this.employee.hasNoPropertyChangeListeners(Employee.ID_PROPERTY));
+ assertTrue(this.employee.hasNoPropertyChangeListeners(Employee.NAME_PROPERTY));
+ assertTrue(this.employee.hasNoPropertyChangeListeners(Employee.HIRE_DATE_PROPERTY));
+
+ PropertyChangeListener bufferedListener = this.buildBufferedListener();
+ this.bufferedIDHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener);
+ this.bufferedNameHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener);
+ this.bufferedHireDateHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener);
+
+ assertTrue(((AbstractModel) this.bufferedIDHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertTrue(((AbstractModel) this.bufferedNameHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertTrue(((AbstractModel) this.bufferedHireDateHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+
+ assertTrue(((AbstractModel) this.idAdapter).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertTrue(((AbstractModel) this.nameAdapter).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertTrue(((AbstractModel) this.hireDateAdapter).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+
+ assertTrue(this.employee.hasAnyPropertyChangeListeners(Employee.ID_PROPERTY));
+ assertTrue(this.employee.hasAnyPropertyChangeListeners(Employee.NAME_PROPERTY));
+ assertTrue(this.employee.hasAnyPropertyChangeListeners(Employee.HIRE_DATE_PROPERTY));
+
+ this.bufferedIDHolder.removePropertyChangeListener(PropertyValueModel.VALUE, bufferedListener);
+ this.bufferedNameHolder.removePropertyChangeListener(PropertyValueModel.VALUE, bufferedListener);
+ this.bufferedHireDateHolder.removePropertyChangeListener(PropertyValueModel.VALUE, bufferedListener);
+
+ assertTrue(((AbstractModel) this.bufferedIDHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertTrue(((AbstractModel) this.bufferedNameHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertTrue(((AbstractModel) this.bufferedHireDateHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
+
+ assertTrue(((AbstractModel) this.idAdapter).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertTrue(((AbstractModel) this.nameAdapter).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertTrue(((AbstractModel) this.hireDateAdapter).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
+
+ assertTrue(this.employee.hasNoPropertyChangeListeners(Employee.ID_PROPERTY));
+ assertTrue(this.employee.hasNoPropertyChangeListeners(Employee.NAME_PROPERTY));
+ assertTrue(this.employee.hasNoPropertyChangeListeners(Employee.HIRE_DATE_PROPERTY));
+ }
+
+ public void testPropertyChange1() {
+ PropertyChangeListener bufferedListener = this.buildBufferedListener();
+ this.bufferedNameHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener);
+
+ PropertyChangeListener adapterListener = this.buildAdapterListener();
+ this.nameAdapter.addPropertyChangeListener(PropertyValueModel.VALUE, adapterListener);
+
+ PropertyChangeListener employeeListener = this.buildEmployeeListener();
+ this.employee.addPropertyChangeListener(Employee.NAME_PROPERTY, employeeListener);
+
+ this.verifyPropertyChanges();
+ }
+
+ public void testPropertyChange2() {
+ PropertyChangeListener bufferedListener = this.buildBufferedListener();
+ this.bufferedNameHolder.addPropertyChangeListener(bufferedListener);
+
+ PropertyChangeListener adapterListener = this.buildAdapterListener();
+ this.nameAdapter.addPropertyChangeListener(adapterListener);
+
+ PropertyChangeListener employeeListener = this.buildEmployeeListener();
+ this.employee.addPropertyChangeListener(employeeListener);
+
+ this.verifyPropertyChanges();
+ }
+
+ private void verifyPropertyChanges() {
+ this.bufferedEvent = null;
+ this.adapterEvent = null;
+ this.employeeEvent = null;
+ this.bufferedNameHolder.setValue("Ripley");
+ this.verifyEvent(this.bufferedEvent, this.bufferedNameHolder, PropertyValueModel.VALUE, "Freddy", "Ripley");
+ assertNull(this.adapterEvent);
+ assertNull(this.employeeEvent);
+
+ this.bufferedEvent = null;
+ this.adapterEvent = null;
+ this.employeeEvent = null;
+ this.bufferedNameHolder.setValue("Charlie");
+ this.verifyEvent(this.bufferedEvent, this.bufferedNameHolder, PropertyValueModel.VALUE, "Ripley", "Charlie");
+ assertNull(this.adapterEvent);
+ assertNull(this.employeeEvent);
+
+ this.bufferedEvent = null;
+ this.adapterEvent = null;
+ this.employeeEvent = null;
+ this.trigger.accept();
+ assertNull(this.bufferedEvent);
+ this.verifyEvent(this.adapterEvent, this.nameAdapter, PropertyValueModel.VALUE, "Freddy", "Charlie");
+ this.verifyEvent(this.employeeEvent, this.employee, Employee.NAME_PROPERTY, "Freddy", "Charlie");
+
+ this.bufferedEvent = null;
+ this.adapterEvent = null;
+ this.employeeEvent = null;
+ this.bufferedNameHolder.setValue("Jason");
+ this.verifyEvent(this.bufferedEvent, this.bufferedNameHolder, PropertyValueModel.VALUE, "Charlie", "Jason");
+ assertNull(this.adapterEvent);
+ assertNull(this.employeeEvent);
+
+ this.bufferedEvent = null;
+ this.adapterEvent = null;
+ this.employeeEvent = null;
+ this.trigger.reset();
+ this.verifyEvent(this.bufferedEvent, this.bufferedNameHolder, PropertyValueModel.VALUE, "Jason", "Charlie");
+ assertNull(this.adapterEvent);
+ assertNull(this.employeeEvent);
+ }
+
+ private PropertyChangeListener buildBufferedListener() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent e) {
+ BufferedWritablePropertyValueModelTests.this.bufferedEvent = e;
+ }
+ };
+ }
+
+ private PropertyChangeListener buildAdapterListener() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent e) {
+ BufferedWritablePropertyValueModelTests.this.adapterEvent = e;
+ }
+ };
+ }
+
+ private PropertyChangeListener buildEmployeeListener() {
+ return new PropertyChangeListener() {
+ public void propertyChanged(PropertyChangeEvent e) {
+ BufferedWritablePropertyValueModelTests.this.employeeEvent = e;
+ }
+ };
+ }
+
+ private void verifyEvent(PropertyChangeEvent event, Object source, String propertyName, Object oldValue, Object newValue) {
+ assertEquals(source, event.getSource());
+ assertEquals(propertyName, event.propertyName());
+ assertEquals(oldValue, event.oldValue());
+ assertEquals(newValue, event.newValue());
+ }
+
+
+ // ********** inner class **********
+
+ private class Employee extends AbstractModel {
+ private int id;
+ public static final String ID_PROPERTY = "id";
+ private String name;
+ public static final String NAME_PROPERTY = "name";
+ private Date hireDate;
+ public static final String HIRE_DATE_PROPERTY = "hireDate";
+
+ Employee(int id, String name, Date hireDate) {
+ super();
+ this.id = id;
+ this.name = name;
+ this.hireDate = hireDate;
+ }
+ int getID() {
+ return this.id;
+ }
+ void setID(int id) {
+ int old = this.id;
+ this.id = id;
+ this.firePropertyChanged(ID_PROPERTY, old, id);
+ }
+ String getName() {
+ return this.name;
+ }
+ void setName(String name) {
+ Object old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+ Date getHireDate() {
+ return this.hireDate;
+ }
+ void setHireDate(Date hireDate) {
+ Object old = this.hireDate;
+ this.hireDate = hireDate;
+ this.firePropertyChanged(HIRE_DATE_PROPERTY, old, hireDate);
+ }
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.name);
+ }
+ }
+}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionAspectAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionAspectAdapterTests.java
index 78ccff0688..4d9e8bf51b 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionAspectAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionAspectAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -21,16 +21,16 @@ import org.eclipse.jpt.utility.internal.model.event.CollectionChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener;
import org.eclipse.jpt.utility.internal.model.value.CollectionAspectAdapter;
import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class CollectionAspectAdapterTests extends TestCase {
private TestSubject subject1;
- private PropertyValueModel subjectHolder1;
+ private WritablePropertyValueModel<TestSubject> subjectHolder1;
private LocalCollectionAspectAdapter aa1;
private CollectionChangeEvent event1;
private CollectionChangeListener listener1;
@@ -53,7 +53,7 @@ public class CollectionAspectAdapterTests extends TestCase {
this.subject1 = new TestSubject();
this.subject1.addNames(this.subject1Names());
this.subject1.addDescriptions(this.subject1Descriptions());
- this.subjectHolder1 = new SimplePropertyValueModel(this.subject1);
+ this.subjectHolder1 = new SimplePropertyValueModel<TestSubject>(this.subject1);
this.aa1 = this.buildAspectAdapter(this.subjectHolder1);
this.listener1 = this.buildValueChangeListener1();
this.aa1.addCollectionChangeListener(CollectionValueModel.VALUES, this.listener1);
@@ -93,7 +93,7 @@ public class CollectionAspectAdapterTests extends TestCase {
return result;
}
- private LocalCollectionAspectAdapter buildAspectAdapter(ValueModel subjectHolder) {
+ private LocalCollectionAspectAdapter buildAspectAdapter(PropertyValueModel<TestSubject> subjectHolder) {
return new LocalCollectionAspectAdapter(subjectHolder);
}
@@ -126,7 +126,7 @@ public class CollectionAspectAdapterTests extends TestCase {
}
public void testSubjectHolder() {
- assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.iterator()));
+ assertEquals(this.subject1Names(), CollectionTools.bag(this.aa1.iterator()));
assertNull(this.event1);
this.subjectHolder1.setValue(this.subject2);
@@ -135,7 +135,7 @@ public class CollectionAspectAdapterTests extends TestCase {
assertEquals(this.aa1, this.event1.getSource());
assertEquals(CollectionValueModel.VALUES, this.event1.collectionName());
assertFalse(this.event1.items().hasNext());
- assertEquals(this.subject2Names(), CollectionTools.bag((Iterator) this.aa1.iterator()));
+ assertEquals(this.subject2Names(), CollectionTools.bag(this.aa1.iterator()));
this.event1 = null;
this.event1Type = null;
@@ -145,7 +145,7 @@ public class CollectionAspectAdapterTests extends TestCase {
assertEquals(this.aa1, this.event1.getSource());
assertEquals(CollectionValueModel.VALUES, this.event1.collectionName());
assertFalse(this.event1.items().hasNext());
- assertFalse(((Iterator) this.aa1.iterator()).hasNext());
+ assertFalse((this.aa1.iterator()).hasNext());
this.event1 = null;
this.event1Type = null;
@@ -155,11 +155,11 @@ public class CollectionAspectAdapterTests extends TestCase {
assertEquals(this.aa1, this.event1.getSource());
assertEquals(CollectionValueModel.VALUES, this.event1.collectionName());
assertFalse(this.event1.items().hasNext());
- assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.iterator()));
+ assertEquals(this.subject1Names(), CollectionTools.bag(this.aa1.iterator()));
}
public void testAdd() {
- assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.iterator()));
+ assertEquals(this.subject1Names(), CollectionTools.bag(this.aa1.iterator()));
assertNull(this.event1);
this.subject1.addName("jam");
@@ -168,9 +168,9 @@ public class CollectionAspectAdapterTests extends TestCase {
assertEquals(this.aa1, this.event1.getSource());
assertEquals(CollectionValueModel.VALUES, this.event1.collectionName());
assertEquals("jam", this.event1.items().next());
- Collection namesPlus = this.subject1Names();
+ Collection<String> namesPlus = this.subject1Names();
namesPlus.add("jam");
- assertEquals(namesPlus, CollectionTools.bag((Iterator) this.aa1.iterator()));
+ assertEquals(namesPlus, CollectionTools.bag(this.aa1.iterator()));
this.event1 = null;
this.event1Type = null;
@@ -181,11 +181,11 @@ public class CollectionAspectAdapterTests extends TestCase {
assertEquals(CollectionValueModel.VALUES, this.event1.collectionName());
assertEquals("jaz", this.event1.items().next());
namesPlus.add("jaz");
- assertEquals(namesPlus, CollectionTools.bag((Iterator) this.aa1.iterator()));
+ assertEquals(namesPlus, CollectionTools.bag(this.aa1.iterator()));
}
public void testRemove() {
- assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.iterator()));
+ assertEquals(this.subject1Names(), CollectionTools.bag(this.aa1.iterator()));
assertNull(this.event1);
this.subject1.removeName("foo");
@@ -194,9 +194,9 @@ public class CollectionAspectAdapterTests extends TestCase {
assertEquals(this.aa1, this.event1.getSource());
assertEquals(CollectionValueModel.VALUES, this.event1.collectionName());
assertEquals("foo", this.event1.items().next());
- Collection namesMinus = this.subject1Names();
+ Collection<String> namesMinus = this.subject1Names();
namesMinus.remove("foo");
- assertEquals(namesMinus, CollectionTools.bag((Iterator) this.aa1.iterator()));
+ assertEquals(namesMinus, CollectionTools.bag(this.aa1.iterator()));
this.event1 = null;
this.event1Type = null;
@@ -207,11 +207,11 @@ public class CollectionAspectAdapterTests extends TestCase {
assertEquals(CollectionValueModel.VALUES, this.event1.collectionName());
assertEquals("bar", this.event1.items().next());
namesMinus.remove("bar");
- assertEquals(namesMinus, CollectionTools.bag((Iterator) this.aa1.iterator()));
+ assertEquals(namesMinus, CollectionTools.bag(this.aa1.iterator()));
}
public void testCollectionChange() {
- assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.iterator()));
+ assertEquals(this.subject1Names(), CollectionTools.bag(this.aa1.iterator()));
assertNull(this.event1);
this.subject1.addTwoNames("jam", "jaz");
@@ -220,20 +220,20 @@ public class CollectionAspectAdapterTests extends TestCase {
assertEquals(this.aa1, this.event1.getSource());
assertEquals(CollectionValueModel.VALUES, this.event1.collectionName());
assertFalse(this.event1.items().hasNext());
- Collection namesPlus2 = this.subject1Names();
+ Collection<String> namesPlus2 = this.subject1Names();
namesPlus2.add("jam");
namesPlus2.add("jaz");
- assertEquals(namesPlus2, CollectionTools.bag((Iterator) this.aa1.iterator()));
+ assertEquals(namesPlus2, CollectionTools.bag(this.aa1.iterator()));
}
public void testIterator() {
assertEquals(this.subject1Names(), CollectionTools.bag(this.subject1.names()));
- assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.iterator()));
+ assertEquals(this.subject1Names(), CollectionTools.bag(this.aa1.iterator()));
}
public void testSize() {
assertEquals(this.subject1Names().size(), CollectionTools.size(this.subject1.names()));
- assertEquals(this.subject1Names().size(), CollectionTools.size((Iterator) this.aa1.iterator()));
+ assertEquals(this.subject1Names().size(), CollectionTools.size(this.aa1.iterator()));
}
public void testHasListeners() {
@@ -315,51 +315,51 @@ public class CollectionAspectAdapterTests extends TestCase {
}
// this is not a typical aspect adapter - the value is determined by the aspect name
- private class LocalCollectionAspectAdapter extends CollectionAspectAdapter {
+ private class LocalCollectionAspectAdapter extends CollectionAspectAdapter<TestSubject, String> {
- LocalCollectionAspectAdapter(ValueModel subjectHolder) {
+ LocalCollectionAspectAdapter(PropertyValueModel<TestSubject> subjectHolder) {
super(subjectHolder, TestSubject.NAMES_COLLECTION);
}
@Override
protected Iterator<String> iterator_() {
- if (this.collectionName == TestSubject.NAMES_COLLECTION) {
- return ((TestSubject) this.subject).names();
+ if (this.collectionNames[0] == TestSubject.NAMES_COLLECTION) {
+ return this.subject.names();
}
- if (this.collectionName == TestSubject.DESCRIPTIONS_COLLECTION) {
- return ((TestSubject) this.subject).descriptions();
+ if (this.collectionNames[0] == TestSubject.DESCRIPTIONS_COLLECTION) {
+ return this.subject.descriptions();
}
- throw new IllegalStateException("invalid aspect name: " + this.collectionName);
+ throw new IllegalStateException("invalid aspect name: " + this.collectionNames[0]);
}
- public void add(Object item) {
- if (this.collectionName == TestSubject.NAMES_COLLECTION) {
- ((TestSubject) this.subject).addName((String) item);
- } else if (this.collectionName == TestSubject.DESCRIPTIONS_COLLECTION) {
- ((TestSubject) this.subject).addDescription((String) item);
+ public void add(String item) {
+ if (this.collectionNames[0] == TestSubject.NAMES_COLLECTION) {
+ this.subject.addName(item);
+ } else if (this.collectionNames[0] == TestSubject.DESCRIPTIONS_COLLECTION) {
+ this.subject.addDescription(item);
} else {
- throw new IllegalStateException("invalid aspect name: " + this.collectionName);
+ throw new IllegalStateException("invalid aspect name: " + this.collectionNames[0]);
}
}
- public void addAll(Collection items) {
- for (Iterator stream = items.iterator(); stream.hasNext(); ) {
+ public void addAll(Collection<String> items) {
+ for (Iterator<String> stream = items.iterator(); stream.hasNext(); ) {
this.add(stream.next());
}
}
public void remove(Object item) {
- if (this.collectionName == TestSubject.NAMES_COLLECTION) {
- ((TestSubject) this.subject).removeName((String) item);
- } else if (this.collectionName == TestSubject.DESCRIPTIONS_COLLECTION) {
- ((TestSubject) this.subject).removeDescription((String) item);
+ if (this.collectionNames[0] == TestSubject.NAMES_COLLECTION) {
+ this.subject.removeName((String) item);
+ } else if (this.collectionNames[0] == TestSubject.DESCRIPTIONS_COLLECTION) {
+ this.subject.removeDescription((String) item);
} else {
- throw new IllegalStateException("invalid aspect name: " + this.collectionName);
+ throw new IllegalStateException("invalid aspect name: " + this.collectionNames[0]);
}
}
- public void removeAll(Collection items) {
- for (Iterator stream = items.iterator(); stream.hasNext(); ) {
+ public void removeAll(Collection<String> items) {
+ for (Iterator<String> stream = items.iterator(); stream.hasNext(); ) {
this.remove(stream.next());
}
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionListValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionListValueModelAdapterTests.java
index 8e6e684988..eefaaed685 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionListValueModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionListValueModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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,7 +10,6 @@
package org.eclipse.jpt.utility.tests.internal.model.value;
import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
import javax.swing.JList;
@@ -22,7 +21,6 @@ import org.eclipse.jpt.utility.internal.model.AbstractModel;
import org.eclipse.jpt.utility.internal.model.event.ListChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.ListChangeListener;
import org.eclipse.jpt.utility.internal.model.value.CollectionListValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.ListModelAdapter;
@@ -31,9 +29,9 @@ import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class CollectionListValueModelAdapterTests extends TestCase {
- private ListValueModel adapter;
- private SimpleCollectionValueModel wrappedCollectionHolder;
- private Collection wrappedCollection;
+ private ListValueModel<String> adapter;
+ private SimpleCollectionValueModel<String> wrappedCollectionHolder;
+ private Collection<String> wrappedCollection;
public CollectionListValueModelAdapterTests(String name) {
super(name);
@@ -42,9 +40,9 @@ public class CollectionListValueModelAdapterTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.wrappedCollection = new HashBag();
- this.wrappedCollectionHolder = new SimpleCollectionValueModel(this.wrappedCollection);
- this.adapter = new CollectionListValueModelAdapter(this.wrappedCollectionHolder);
+ this.wrappedCollection = new HashBag<String>();
+ this.wrappedCollectionHolder = new SimpleCollectionValueModel<String>(this.wrappedCollection);
+ this.adapter = new CollectionListValueModelAdapter<String>(this.wrappedCollectionHolder);
}
@Override
@@ -55,42 +53,48 @@ public class CollectionListValueModelAdapterTests extends TestCase {
public void testIterator() {
this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() {
+ @Override
public void itemsAdded(ListChangeEvent e) {/* OK */}
});
this.wrappedCollectionHolder.add("foo");
this.wrappedCollectionHolder.add("bar");
this.wrappedCollectionHolder.add("baz");
- Collection adapterCollection = CollectionTools.collection(this.adapter.iterator());
+ Collection<String> adapterCollection = this.adapterCollection();
assertEquals(3, adapterCollection.size());
assertEquals(this.wrappedCollection, adapterCollection);
}
+ private Collection<String> adapterCollection() {
+ return CollectionTools.collection(this.adapter.iterator());
+ }
+
public void testStaleValue() {
ListChangeListener listener = new TestListChangeListener() {
+ @Override
public void itemsAdded(ListChangeEvent e) {/* OK */}
};
this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, listener);
this.wrappedCollectionHolder.add("foo");
this.wrappedCollectionHolder.add("bar");
this.wrappedCollectionHolder.add("baz");
- Collection adapterCollection = CollectionTools.collection(this.adapter.iterator());
+ Collection<String> adapterCollection = this.adapterCollection();
assertEquals(3, adapterCollection.size());
assertEquals(this.wrappedCollection, adapterCollection);
this.adapter.removeListChangeListener(ListValueModel.LIST_VALUES, listener);
- adapterCollection = CollectionTools.collection(this.adapter.iterator());
+ adapterCollection = this.adapterCollection();
assertEquals(0, adapterCollection.size());
- assertEquals(new HashBag(), adapterCollection);
+ assertEquals(new HashBag<String>(), adapterCollection);
this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, listener);
- adapterCollection = CollectionTools.collection(this.adapter.iterator());
+ adapterCollection = this.adapterCollection();
assertEquals(3, adapterCollection.size());
assertEquals(this.wrappedCollection, adapterCollection);
}
public void testAdd() {
- List synchList = new SynchronizedList(this.adapter);
- Bag synchCollection = new SynchronizedBag(this.wrappedCollectionHolder);
+ List<String> synchList = new CoordinatedList<String>(this.adapter);
+ Bag<String> synchCollection = new CoordinatedBag<String>(this.wrappedCollectionHolder);
this.wrappedCollectionHolder.add("foo");
assertTrue(this.wrappedCollection.contains("foo"));
this.wrappedCollectionHolder.add("bar");
@@ -100,15 +104,15 @@ public class CollectionListValueModelAdapterTests extends TestCase {
this.wrappedCollectionHolder.add("jaz");
assertEquals(6, this.wrappedCollection.size());
- Collection adapterCollection = CollectionTools.collection(this.adapter.iterator());
+ Collection<String> adapterCollection = this.adapterCollection();
assertEquals(this.wrappedCollection, adapterCollection);
assertEquals(this.wrappedCollection, CollectionTools.collection(synchList.iterator()));
assertEquals(this.wrappedCollection, synchCollection);
}
public void testRemove() {
- List synchList = new SynchronizedList(this.adapter);
- Bag synchCollection = new SynchronizedBag(this.wrappedCollectionHolder);
+ List<String> synchList = new CoordinatedList<String>(this.adapter);
+ Bag<String> synchCollection = new CoordinatedBag<String>(this.wrappedCollectionHolder);
this.wrappedCollectionHolder.add("foo");
this.wrappedCollectionHolder.add("bar");
this.wrappedCollectionHolder.add("baz");
@@ -122,7 +126,7 @@ public class CollectionListValueModelAdapterTests extends TestCase {
assertFalse(this.wrappedCollection.contains("foo"));
assertEquals(4, this.wrappedCollection.size());
- Collection adapterCollection = CollectionTools.collection(this.adapter.iterator());
+ Collection<String> adapterCollection = this.adapterCollection();
assertEquals(this.wrappedCollection, adapterCollection);
assertEquals(this.wrappedCollection, CollectionTools.collection(synchList.iterator()));
assertEquals(this.wrappedCollection, synchCollection);
@@ -130,7 +134,9 @@ public class CollectionListValueModelAdapterTests extends TestCase {
public void testListSynch() {
this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() {
+ @Override
public void itemsAdded(ListChangeEvent e) {/* OK */}
+ @Override
public void itemsRemoved(ListChangeEvent e) {/* OK */}
});
this.wrappedCollectionHolder.add("foo");
@@ -145,13 +151,13 @@ public class CollectionListValueModelAdapterTests extends TestCase {
assertFalse(this.wrappedCollection.contains("foo"));
assertEquals(4, this.wrappedCollection.size());
- Collection adapterCollection = CollectionTools.collection(this.adapter.iterator());
+ Collection<String> adapterCollection = this.adapterCollection();
assertEquals(this.wrappedCollection, adapterCollection);
}
public void testHasListeners() {
assertFalse(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
- SynchronizedList synchList = new SynchronizedList(this.adapter);
+ CoordinatedList<String> synchList = new CoordinatedList<String>(this.adapter);
assertTrue(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
this.adapter.removeListChangeListener(ListValueModel.LIST_VALUES, synchList);
assertFalse(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
@@ -163,45 +169,51 @@ public class CollectionListValueModelAdapterTests extends TestCase {
public void testCollectionChangedToEmpty() {
this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() {
+ @Override
public void itemsAdded(ListChangeEvent e) {/* OK */}
+ @Override
public void itemsRemoved(ListChangeEvent e) {/* OK */}
});
this.wrappedCollectionHolder.add("foo");
this.wrappedCollectionHolder.add("bar");
this.wrappedCollectionHolder.add("baz");
JList jList = new JList(new ListModelAdapter(this.adapter));
- ((SimpleCollectionValueModel) this.wrappedCollectionHolder).setCollection(new HashBag());
+ this.wrappedCollectionHolder.setCollection(new HashBag<String>());
assertEquals(0, jList.getModel().getSize());
}
public void testCollectionChangedFromEmpty() {
this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() {
+ @Override
public void itemsAdded(ListChangeEvent e) {/* OK */}
+ @Override
public void itemsRemoved(ListChangeEvent e) {/* OK */}
});
JList jList = new JList(new ListModelAdapter(this.adapter));
- HashBag bag = new HashBag();
+ HashBag<String> bag = new HashBag<String>();
bag.add("foo");
bag.add("bar");
- ((SimpleCollectionValueModel) this.wrappedCollectionHolder).setCollection(bag);
+ this.wrappedCollectionHolder.setCollection(bag);
assertEquals(2, jList.getModel().getSize());
}
public void testCollectionChangedFromEmptyToEmpty() {
this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() {
+ @Override
public void itemsAdded(ListChangeEvent e) {/* OK */}
+ @Override
public void itemsRemoved(ListChangeEvent e) {/* OK */}
});
JList jList = new JList(new ListModelAdapter(this.adapter));
- HashBag bag = new HashBag();
- ((SimpleCollectionValueModel) this.wrappedCollectionHolder).setCollection(bag);
+ HashBag<String> bag = new HashBag<String>();
+ this.wrappedCollectionHolder.setCollection(bag);
assertEquals(0, jList.getModel().getSize());
}
- private class TestListChangeListener implements ListChangeListener {
+ class TestListChangeListener implements ListChangeListener {
public void itemsAdded(ListChangeEvent e) {
fail("unexpected event");
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionPropertyValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionPropertyValueModelAdapterTests.java
index 5965cf214b..ff8ea31327 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionPropertyValueModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionPropertyValueModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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,7 +10,6 @@
package org.eclipse.jpt.utility.tests.internal.model.value;
import java.util.Collection;
-import java.util.Iterator;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
@@ -20,14 +19,14 @@ import org.eclipse.jpt.utility.internal.model.value.CollectionPropertyValueModel
import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class CollectionPropertyValueModelAdapterTests extends TestCase {
- private PropertyValueModel adapter;
- private SimpleCollectionValueModel wrappedCollectionHolder;
+ private WritablePropertyValueModel<Boolean> adapter;
+ private SimpleCollectionValueModel<String> wrappedCollectionHolder;
PropertyChangeEvent event;
public CollectionPropertyValueModelAdapterTests(String name) {
@@ -37,7 +36,7 @@ public class CollectionPropertyValueModelAdapterTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.wrappedCollectionHolder = new SimpleCollectionValueModel();
+ this.wrappedCollectionHolder = new SimpleCollectionValueModel<String>();
this.adapter = new LocalAdapter(this.wrappedCollectionHolder, "666");
this.event = null;
}
@@ -49,15 +48,15 @@ public class CollectionPropertyValueModelAdapterTests extends TestCase {
}
private boolean booleanValue() {
- return ((Boolean) this.adapter.value()).booleanValue();
+ return this.adapter.value().booleanValue();
}
- private Collection wrappedCollection() {
- return CollectionTools.collection((Iterator) this.wrappedCollectionHolder.iterator());
+ private Collection<String> wrappedCollection() {
+ return CollectionTools.collection(this.wrappedCollectionHolder.iterator());
}
public void testValue() {
- this.adapter.addPropertyChangeListener(ValueModel.VALUE, new PropertyChangeListener() {
+ this.adapter.addPropertyChangeListener(PropertyValueModel.VALUE, new PropertyChangeListener() {
public void propertyChanged(PropertyChangeEvent e) {/* OK */}
});
assertFalse(this.booleanValue());
@@ -81,13 +80,13 @@ public class CollectionPropertyValueModelAdapterTests extends TestCase {
assertTrue(this.booleanValue());
assertTrue(this.wrappedCollection().contains("666"));
- ((SimpleCollectionValueModel) this.wrappedCollectionHolder).clear();
+ this.wrappedCollectionHolder.clear();
assertFalse(this.booleanValue());
assertFalse(this.wrappedCollection().contains("666"));
}
public void testSetValue() {
- this.adapter.addPropertyChangeListener(ValueModel.VALUE, new PropertyChangeListener() {
+ this.adapter.addPropertyChangeListener(PropertyValueModel.VALUE, new PropertyChangeListener() {
public void propertyChanged(PropertyChangeEvent e) {/* OK */}
});
assertFalse(this.booleanValue());
@@ -103,7 +102,7 @@ public class CollectionPropertyValueModelAdapterTests extends TestCase {
}
public void testEventFiring() {
- this.adapter.addPropertyChangeListener(ValueModel.VALUE, new PropertyChangeListener() {
+ this.adapter.addPropertyChangeListener(PropertyValueModel.VALUE, new PropertyChangeListener() {
public void propertyChanged(PropertyChangeEvent e) {
CollectionPropertyValueModelAdapterTests.this.event = e;
}
@@ -125,7 +124,7 @@ public class CollectionPropertyValueModelAdapterTests extends TestCase {
this.wrappedCollectionHolder.add("666");
this.verifyEvent(false, true);
- ((SimpleCollectionValueModel) this.wrappedCollectionHolder).clear();
+ this.wrappedCollectionHolder.clear();
this.verifyEvent(true, false);
}
@@ -140,41 +139,41 @@ public class CollectionPropertyValueModelAdapterTests extends TestCase {
PropertyChangeListener listener = new PropertyChangeListener() {
public void propertyChanged(PropertyChangeEvent e) {/* OK */}
};
- this.adapter.addPropertyChangeListener(ValueModel.VALUE, listener);
+ this.adapter.addPropertyChangeListener(PropertyValueModel.VALUE, listener);
this.wrappedCollectionHolder.add("666");
assertTrue(this.booleanValue());
assertTrue(this.wrappedCollection().contains("666"));
- this.adapter.removePropertyChangeListener(ValueModel.VALUE, listener);
+ this.adapter.removePropertyChangeListener(PropertyValueModel.VALUE, listener);
assertFalse(this.booleanValue());
assertTrue(this.wrappedCollection().contains("666"));
- this.adapter.addPropertyChangeListener(ValueModel.VALUE, listener);
+ this.adapter.addPropertyChangeListener(PropertyValueModel.VALUE, listener);
assertTrue(this.booleanValue());
assertTrue(this.wrappedCollection().contains("666"));
}
public void testHasListeners() {
- assertFalse(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertFalse(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
assertFalse(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES));
PropertyChangeListener listener = new PropertyChangeListener() {
public void propertyChanged(PropertyChangeEvent e) {/* OK */}
};
- this.adapter.addPropertyChangeListener(ValueModel.VALUE, listener);
- assertTrue(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ this.adapter.addPropertyChangeListener(PropertyValueModel.VALUE, listener);
+ assertTrue(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
assertTrue(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES));
- this.adapter.removePropertyChangeListener(ValueModel.VALUE, listener);
- assertFalse(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ this.adapter.removePropertyChangeListener(PropertyValueModel.VALUE, listener);
+ assertFalse(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
assertFalse(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES));
this.adapter.addPropertyChangeListener(listener);
- assertTrue(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
assertTrue(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES));
this.adapter.removePropertyChangeListener(listener);
- assertFalse(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertFalse(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
assertFalse(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES));
}
@@ -185,10 +184,13 @@ public class CollectionPropertyValueModelAdapterTests extends TestCase {
* the value is true if the wrapped collection contains the specified item,
* otherwise the value is false
*/
- private static class LocalAdapter extends CollectionPropertyValueModelAdapter {
- private Object item;
+ private static class LocalAdapter
+ extends CollectionPropertyValueModelAdapter<Boolean>
+ implements WritablePropertyValueModel<Boolean>
+ {
+ private String item;
- LocalAdapter(CollectionValueModel collectionHolder, Object item) {
+ LocalAdapter(CollectionValueModel<String> collectionHolder, String item) {
super(collectionHolder);
this.item = item;
}
@@ -198,27 +200,27 @@ public class CollectionPropertyValueModelAdapterTests extends TestCase {
* always return a Boolean
*/
@Override
- public Object value() {
- Object result = super.value();
+ public Boolean value() {
+ Boolean result = super.value();
return (result == null) ? Boolean.FALSE : result;
}
- @Override
- public void setValue(Object value) {
+ @SuppressWarnings("unchecked")
+ public void setValue(Boolean value) {
if (this.booleanValue()) {
if ( ! this.booleanValueOf(value)) {
// the value is changing from true to false
- ((SimpleCollectionValueModel) this.collectionHolder).remove(this.item);
+ ((SimpleCollectionValueModel<String>) this.collectionHolder).remove(this.item);
}
} else {
if (this.booleanValueOf(value)) {
// the value is changing from false to true
- ((SimpleCollectionValueModel) this.collectionHolder).add(this.item);
+ ((SimpleCollectionValueModel<String>) this.collectionHolder).add(this.item);
}
}
}
@Override
- protected Object buildValue() {
- return Boolean.valueOf(CollectionTools.contains((Iterator) this.collectionHolder.iterator(), this.item));
+ protected Boolean buildValue() {
+ return Boolean.valueOf(CollectionTools.contains(this.collectionHolder.iterator(), this.item));
}
// ********** internal methods **********
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CompositeCollectionValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CompositeCollectionValueModelTests.java
index 9ed70bc967..ccad1df6ab 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CompositeCollectionValueModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CompositeCollectionValueModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -22,16 +22,16 @@ import org.eclipse.jpt.utility.internal.model.AbstractModel;
import org.eclipse.jpt.utility.internal.model.value.CollectionAspectAdapter;
import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.CompositeCollectionValueModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class CompositeCollectionValueModelTests extends TestCase {
private Neighborhood neighborhood;
- private PropertyValueModel neighborhoodHolder;
+ private WritablePropertyValueModel<Neighborhood> neighborhoodHolder;
public CompositeCollectionValueModelTests(String name) {
super(name);
@@ -41,7 +41,7 @@ public class CompositeCollectionValueModelTests extends TestCase {
protected void setUp() throws Exception {
super.setUp();
this.neighborhood = new Neighborhood("Hanna-Barbera");
- this.neighborhoodHolder = new SimplePropertyValueModel(this.neighborhood);
+ this.neighborhoodHolder = new SimplePropertyValueModel<Neighborhood>(this.neighborhood);
}
@Override
@@ -58,10 +58,10 @@ public class CompositeCollectionValueModelTests extends TestCase {
this.verifySynch(this.buildAllMembersComposite2(this.neighborhoodHolder));
}
- private void verifySynch(CollectionValueModel compositeCVM) {
- assertEquals(0, CollectionTools.size((Iterator) compositeCVM.iterator()));
- Bag familiesSynch = new SynchronizedBag(this.buildFamiliesAspectAdapter(this.neighborhoodHolder));
- Bag membersSynch = new SynchronizedBag(compositeCVM);
+ private void verifySynch(CollectionValueModel<Member> compositeCVM) {
+ assertEquals(0, CollectionTools.size(compositeCVM.iterator()));
+ Bag<Family> familiesSynch = new CoordinatedBag<Family>(this.buildFamiliesAspectAdapter(this.neighborhoodHolder));
+ Bag<Member> membersSynch = new CoordinatedBag<Member>(compositeCVM);
this.populateNeighborhood(this.neighborhood);
Family jetsons = this.neighborhood.familyNamed("Jetson");
@@ -70,35 +70,35 @@ public class CompositeCollectionValueModelTests extends TestCase {
assertEquals(12, CollectionTools.size(this.neighborhood.allMembers()));
assertEquals(12, membersSynch.size());
assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch);
- assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.iterator()));
+ assertEquals(membersSynch, CollectionTools.bag(compositeCVM.iterator()));
jetsons.removeMember(jetsons.memberNamed("Astro"));
assertEquals(3, familiesSynch.size());
assertEquals(11, CollectionTools.size(this.neighborhood.allMembers()));
assertEquals(11, membersSynch.size());
assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch);
- assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.iterator()));
+ assertEquals(membersSynch, CollectionTools.bag(compositeCVM.iterator()));
jetsons.removeMember(jetsons.memberNamed("Judy"));
assertEquals(3, familiesSynch.size());
assertEquals(10, CollectionTools.size(this.neighborhood.allMembers()));
assertEquals(10, membersSynch.size());
assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch);
- assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.iterator()));
+ assertEquals(membersSynch, CollectionTools.bag(compositeCVM.iterator()));
jetsons.addMember("Fido");
assertEquals(3, familiesSynch.size());
assertEquals(11, CollectionTools.size(this.neighborhood.allMembers()));
assertEquals(11, membersSynch.size());
assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch);
- assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.iterator()));
+ assertEquals(membersSynch, CollectionTools.bag(compositeCVM.iterator()));
this.neighborhood.removeFamily(jetsons);
assertEquals(2, familiesSynch.size());
assertEquals(7, CollectionTools.size(this.neighborhood.allMembers()));
assertEquals(7, membersSynch.size());
assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch);
- assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.iterator()));
+ assertEquals(membersSynch, CollectionTools.bag(compositeCVM.iterator()));
Family bears = this.neighborhood.addFamily("Bear");
bears.addMember("Yogi");
@@ -106,14 +106,14 @@ public class CompositeCollectionValueModelTests extends TestCase {
assertEquals(8, CollectionTools.size(this.neighborhood.allMembers()));
assertEquals(8, membersSynch.size());
assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch);
- assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.iterator()));
+ assertEquals(membersSynch, CollectionTools.bag(compositeCVM.iterator()));
bears.addMember("Boo-Boo");
assertEquals(3, familiesSynch.size());
assertEquals(9, CollectionTools.size(this.neighborhood.allMembers()));
assertEquals(9, membersSynch.size());
assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch);
- assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.iterator()));
+ assertEquals(membersSynch, CollectionTools.bag(compositeCVM.iterator()));
Neighborhood n2 = new Neighborhood("Hanna-Barbera 2");
this.neighborhoodHolder.setValue(n2);
@@ -122,11 +122,11 @@ public class CompositeCollectionValueModelTests extends TestCase {
assertEquals(12, CollectionTools.size(n2.allMembers()));
assertEquals(12, membersSynch.size());
assertEquals(CollectionTools.bag(n2.allMembers()), membersSynch);
- assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.iterator()));
+ assertEquals(membersSynch, CollectionTools.bag(compositeCVM.iterator()));
}
public void testNoTransformer() {
- Bag synchBag = new SynchronizedBag(this.buildBogusAllMembersComposite(this.neighborhoodHolder));
+ Bag<Member> synchBag = new CoordinatedBag<Member>(this.buildBogusAllMembersComposite(this.neighborhoodHolder));
boolean exCaught = false;
try {
this.populateNeighborhood(this.neighborhood);
@@ -143,7 +143,7 @@ public class CompositeCollectionValueModelTests extends TestCase {
}
public void testDuplicateItem() {
- Bag synchBag = new SynchronizedBag(this.buildAllMembersComposite(this.neighborhoodHolder));
+ Bag<Member> synchBag = new CoordinatedBag<Member>(this.buildAllMembersComposite(this.neighborhoodHolder));
this.populateNeighborhood(this.neighborhood);
boolean exCaught = false;
try {
@@ -158,8 +158,8 @@ public class CompositeCollectionValueModelTests extends TestCase {
}
public void testHasListeners() {
- CompositeCollectionValueModel compositeCVM = this.buildAllMembersComposite(this.neighborhoodHolder);
- SynchronizedBag synchBag = new SynchronizedBag(compositeCVM);
+ CompositeCollectionValueModel<Family, Member> compositeCVM = this.buildAllMembersComposite(this.neighborhoodHolder);
+ CoordinatedBag<Member> synchBag = new CoordinatedBag<Member>(compositeCVM);
this.populateNeighborhood(this.neighborhood);
Family jetsons = this.neighborhood.familyNamed("Jetson");
@@ -193,45 +193,48 @@ public class CompositeCollectionValueModelTests extends TestCase {
family3.addMember("Astro");
}
- private CollectionValueModel buildFamiliesAspectAdapter(ValueModel communeHolder) {
- return new CollectionAspectAdapter(communeHolder, Neighborhood.FAMILIES_COLLECTION) {
- protected Iterator iterator_() {
- return ((Neighborhood) this.subject).families();
+ private CollectionValueModel<Family> buildFamiliesAspectAdapter(PropertyValueModel<Neighborhood> communeHolder) {
+ return new CollectionAspectAdapter<Neighborhood, Family>(communeHolder, Neighborhood.FAMILIES_COLLECTION) {
+ @Override
+ protected Iterator<Family> iterator_() {
+ return this.subject.families();
}
};
}
- CollectionValueModel buildMembersAdapter(Family family) {
- return new CollectionAspectAdapter(Family.MEMBERS_COLLECTION, family) {
- protected Iterator iterator_() {
- return ((Family) this.subject).members();
+ CollectionValueModel<Member> buildMembersAdapter(Family family) {
+ return new CollectionAspectAdapter<Family, Member>(Family.MEMBERS_COLLECTION, family) {
+ @Override
+ protected Iterator<Member> iterator_() {
+ return this.subject.members();
}
};
}
- private CompositeCollectionValueModel buildAllMembersComposite(ValueModel communeHolder) {
+ private CompositeCollectionValueModel<Family, Member> buildAllMembersComposite(PropertyValueModel<Neighborhood> communeHolder) {
// override #transform(Object)
- return new CompositeCollectionValueModel(this.buildFamiliesAspectAdapter(communeHolder)) {
- protected CollectionValueModel transform(Object value) {
- return CompositeCollectionValueModelTests.this.buildMembersAdapter((Family) value);
+ return new CompositeCollectionValueModel<Family, Member>(this.buildFamiliesAspectAdapter(communeHolder)) {
+ @Override
+ protected CollectionValueModel<Member> transform(Family family) {
+ return CompositeCollectionValueModelTests.this.buildMembersAdapter(family);
}
};
}
- private CollectionValueModel buildAllMembersComposite2(ValueModel communeHolder) {
+ private CollectionValueModel<Member> buildAllMembersComposite2(PropertyValueModel<Neighborhood> communeHolder) {
// build a custom Transformer
- return new CompositeCollectionValueModel(this.buildFamiliesAspectAdapter(communeHolder), this.buildTransformer());
+ return new CompositeCollectionValueModel<Family, Member>(this.buildFamiliesAspectAdapter(communeHolder), this.buildTransformer());
}
- private CollectionValueModel buildBogusAllMembersComposite(ValueModel communeHolder) {
+ private CollectionValueModel<Member> buildBogusAllMembersComposite(PropertyValueModel<Neighborhood> communeHolder) {
// DISABLED Transformer
- return new CompositeCollectionValueModel(this.buildFamiliesAspectAdapter(communeHolder));
+ return new CompositeCollectionValueModel<Family, Member>(this.buildFamiliesAspectAdapter(communeHolder));
}
- private Transformer buildTransformer() {
- return new Transformer() {
- public Object transform(Object value) {
- return CompositeCollectionValueModelTests.this.buildMembersAdapter((Family) value);
+ private Transformer<Family, CollectionValueModel<Member>> buildTransformer() {
+ return new Transformer<Family, CollectionValueModel<Member>>() {
+ public CollectionValueModel<Member> transform(Family family) {
+ return CompositeCollectionValueModelTests.this.buildMembersAdapter(family);
}
@Override
public String toString() {
@@ -249,7 +252,7 @@ public class CompositeCollectionValueModelTests extends TestCase {
private class Neighborhood extends AbstractModel {
private String name;
public static final String NAME_PROPERTY = "name";
- private Collection families = new ArrayList();
+ private Collection<Family> families = new ArrayList<Family>();
public static final String FAMILIES_COLLECTION = "families";
public Neighborhood(String name) {
@@ -267,7 +270,7 @@ public class CompositeCollectionValueModelTests extends TestCase {
this.firePropertyChanged(NAME_PROPERTY, old, name);
}
- public Iterator families() {
+ public Iterator<Family> families() {
return this.families.iterator();
}
@@ -286,8 +289,7 @@ public class CompositeCollectionValueModelTests extends TestCase {
}
public Family familyNamed(String familyName) {
- for (Iterator stream = this.families.iterator(); stream.hasNext(); ) {
- Family family = (Family) stream.next();
+ for (Family family : this.families) {
if (family.getName().equals(familyName)) {
return family;
}
@@ -295,14 +297,15 @@ public class CompositeCollectionValueModelTests extends TestCase {
throw new IllegalArgumentException(familyName);
}
- public Iterator allMembers() {
- return new CompositeIterator(this.membersIterators());
+ public Iterator<Member> allMembers() {
+ return new CompositeIterator<Member>(this.membersIterators());
}
- private Iterator membersIterators() {
- return new TransformationIterator(this.families()) {
- protected Object transform(Object next) {
- return ((Family) next).members();
+ private Iterator<Iterator<Member>> membersIterators() {
+ return new TransformationIterator<Family, Iterator<Member>>(this.families()) {
+ @Override
+ protected Iterator<Member> transform(Family family) {
+ return family.members();
}
};
}
@@ -325,7 +328,7 @@ public class CompositeCollectionValueModelTests extends TestCase {
private class Family extends AbstractModel {
private String name;
public static final String NAME_PROPERTY = "name";
- private Collection members = new ArrayList();
+ private Collection<Member> members = new ArrayList<Member>();
public static final String MEMBERS_COLLECTION = "members";
public Family(String name) {
@@ -343,7 +346,7 @@ public class CompositeCollectionValueModelTests extends TestCase {
this.firePropertyChanged(NAME_PROPERTY, old, name);
}
- public Iterator members() {
+ public Iterator<Member> members() {
return this.members.iterator();
}
@@ -358,8 +361,7 @@ public class CompositeCollectionValueModelTests extends TestCase {
}
public Member memberNamed(String memberName) {
- for (Iterator stream = this.members.iterator(); stream.hasNext(); ) {
- Member member = (Member) stream.next();
+ for (Member member : this.members) {
if (member.getName().equals(memberName)) {
return member;
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CoordinatedBag.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CoordinatedBag.java
new file mode 100644
index 0000000000..3b12bdb852
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CoordinatedBag.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.tests.internal.model.value;
+
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.jpt.utility.internal.Bag;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.HashBag;
+import org.eclipse.jpt.utility.internal.model.event.CollectionChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
+
+/**
+ * Helper class that keeps an internal collection in synch with the
+ * collection held by a collection value model.
+ */
+class CoordinatedBag<E> implements Bag<E>, CollectionChangeListener {
+
+ private Bag<E> synchBag = new HashBag<E>();
+
+ CoordinatedBag(CollectionValueModel<E> cvm) {
+ cvm.addCollectionChangeListener(CollectionValueModel.VALUES, this);
+ }
+
+
+ // ********** Collection implementation **********
+
+ public boolean add(E o) {
+ return this.synchBag.add(o);
+ }
+
+ public boolean addAll(Collection<? extends E> c) {
+ return this.synchBag.addAll(c);
+ }
+
+ public void clear() {
+ this.synchBag.clear();
+ }
+
+ public boolean contains(Object o) {
+ return this.synchBag.contains(o);
+ }
+
+ public boolean containsAll(Collection<?> c) {
+ return this.synchBag.containsAll(c);
+ }
+
+ public boolean isEmpty() {
+ return this.synchBag.isEmpty();
+ }
+
+ public Iterator<E> iterator() {
+ return this.synchBag.iterator();
+ }
+
+ public boolean remove(Object o) {
+ return this.synchBag.remove(o);
+ }
+
+ public boolean removeAll(Collection<?> c) {
+ return this.synchBag.removeAll(c);
+ }
+
+ public boolean retainAll(Collection<?> c) {
+ return this.synchBag.retainAll(c);
+ }
+
+ public int size() {
+ return this.synchBag.size();
+ }
+
+ public Object[] toArray() {
+ return this.synchBag.toArray();
+ }
+
+ public <T> T[] toArray(T[] a) {
+ return this.synchBag.toArray(a);
+ }
+
+
+ // ********** Bag implementation **********
+
+ public int count(Object o) {
+ return this.synchBag.count(o);
+ }
+
+ public boolean add(E o, int count) {
+ return this.synchBag.add(o, count);
+ }
+
+ public boolean remove(Object o, int count) {
+ return this.synchBag.remove(o, count);
+ }
+
+ public Iterator<E> uniqueIterator() {
+ return this.synchBag.uniqueIterator();
+ }
+
+ // ********** CollectionChangeListener implementation **********
+
+ public void itemsAdded(CollectionChangeEvent e) {
+ for (@SuppressWarnings("unchecked") Iterator<E> stream = (Iterator<E>) e.items(); stream.hasNext(); ) {
+ this.synchBag.add(stream.next());
+ }
+ }
+
+ public void itemsRemoved(CollectionChangeEvent e) {
+ for (@SuppressWarnings("unchecked") Iterator<E> stream = (Iterator<E>) e.items(); stream.hasNext(); ) {
+ this.synchBag.remove(stream.next());
+ }
+ }
+
+ public void collectionCleared(CollectionChangeEvent e) {
+ this.synchBag.clear();
+ }
+
+ @SuppressWarnings("unchecked")
+ public void collectionChanged(CollectionChangeEvent e) {
+ this.synchBag.clear();
+ CollectionTools.addAll(this.synchBag, ((CollectionValueModel<E>) e.getSource()).iterator());
+ }
+
+
+ // ********** standard methods **********
+
+ @Override
+ public boolean equals(Object o) {
+ return this.synchBag.equals(o);
+ }
+
+ @Override
+ public int hashCode() {
+ return this.synchBag.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return this.synchBag.toString();
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CoordinatedList.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CoordinatedList.java
new file mode 100644
index 0000000000..b74c0a87e5
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CoordinatedList.java
@@ -0,0 +1,256 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.tests.internal.model.value;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import javax.swing.ListModel;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.model.event.ListChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.ListChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+
+/**
+ * Helper class that keeps an internal list in synch with the
+ * list held by a list value model.
+ */
+public class CoordinatedList<E> implements List<E>, ListChangeListener, ListDataListener {
+ private List<E> synchList = new ArrayList<E>();
+
+ public CoordinatedList(ListValueModel<E> listValueModel) {
+ listValueModel.addListChangeListener(ListValueModel.LIST_VALUES, this);
+ for (Iterator<E> stream = listValueModel.iterator(); stream.hasNext(); ) {
+ this.add(stream.next());
+ }
+ }
+
+ public CoordinatedList(ListModel listModel) {
+ listModel.addListDataListener(this);
+ for (int i = 0; i < listModel.getSize(); i++) {
+ this.add(i, this.getElementAt(listModel, i));
+ }
+ }
+
+
+ // ********** List implementation **********
+
+ public void add(int index, E element) {
+ this.synchList.add(index, element);
+ }
+
+ public boolean add(E o) {
+ return this.synchList.add(o);
+ }
+
+ public boolean addAll(Collection<? extends E> c) {
+ return this.synchList.addAll(c);
+ }
+
+ public boolean addAll(int index, Collection<? extends E> c) {
+ return this.synchList.addAll(index, c);
+ }
+
+ public void clear() {
+ this.synchList.clear();
+ }
+
+ public boolean contains(Object o) {
+ return this.synchList.contains(o);
+ }
+
+ public boolean containsAll(Collection<?> c) {
+ return this.synchList.containsAll(c);
+ }
+
+ public E get(int index) {
+ return this.synchList.get(index);
+ }
+
+ public int indexOf(Object o) {
+ return this.synchList.indexOf(o);
+ }
+
+ public boolean isEmpty() {
+ return this.synchList.isEmpty();
+ }
+
+ public Iterator<E> iterator() {
+ return this.synchList.iterator();
+ }
+
+ public int lastIndexOf(Object o) {
+ return this.synchList.lastIndexOf(o);
+ }
+
+ public ListIterator<E> listIterator() {
+ return this.synchList.listIterator();
+ }
+
+ public ListIterator<E> listIterator(int index) {
+ return this.synchList.listIterator(index);
+ }
+
+ public E remove(int index) {
+ return this.synchList.remove(index);
+ }
+
+ public boolean remove(Object o) {
+ return this.synchList.remove(o);
+ }
+
+ public boolean removeAll(Collection<?> c) {
+ return this.synchList.removeAll(c);
+ }
+
+ public boolean retainAll(Collection<?> c) {
+ return this.synchList.retainAll(c);
+ }
+
+ public E set(int index, E element) {
+ return this.synchList.set(index, element);
+ }
+
+ public int size() {
+ return this.synchList.size();
+ }
+
+ public List<E> subList(int fromIndex, int toIndex) {
+ return this.synchList.subList(fromIndex, toIndex);
+ }
+
+ public Object[] toArray() {
+ return this.synchList.toArray();
+ }
+
+ public <T> T[] toArray(T[] a) {
+ return this.synchList.toArray(a);
+ }
+
+
+ // ********** ListChangeListener implementation **********
+
+ public void itemsAdded(ListChangeEvent e) {
+ int i = e.index();
+ for (Iterator<E> stream = this.items(e); stream.hasNext(); ) {
+ this.synchList.add(i++, stream.next());
+ }
+ }
+
+ public void itemsRemoved(ListChangeEvent e) {
+ int i = e.index();
+ for (Iterator<E> stream = this.items(e); stream.hasNext(); ) {
+ stream.next();
+ this.synchList.remove(i);
+ }
+ }
+
+ public void itemsReplaced(ListChangeEvent e) {
+ int i = e.index();
+ for (Iterator<E> stream = this.items(e); stream.hasNext(); ) {
+ this.synchList.set(i++, stream.next());
+ }
+ }
+
+ public void itemsMoved(ListChangeEvent e) {
+ CollectionTools.move(this.synchList, e.targetIndex(), e.sourceIndex(), e.itemsSize());
+ }
+
+ public void listCleared(ListChangeEvent e) {
+ this.synchList.clear();
+ }
+
+ public void listChanged(ListChangeEvent e) {
+ this.synchList.clear();
+ CollectionTools.addAll(this.synchList, this.getSource(e).iterator());
+ }
+
+
+ // ********** ListDataListener implementation **********
+
+ public void contentsChanged(ListDataEvent e) {
+ this.synchList.clear();
+ ListModel lm = (ListModel) e.getSource();
+ int size = lm.getSize();
+ for (int i = 0; i < size; i++) {
+ this.synchList.add(i, this.getElementAt(lm, i));
+ }
+ }
+
+ public void intervalAdded(ListDataEvent e) {
+ ListModel lm = (ListModel) e.getSource();
+ int start = Math.min(e.getIndex0(), e.getIndex1());
+ int end = Math.max(e.getIndex0(), e.getIndex1());
+ for (int i = start; i <= end; i++) {
+ this.synchList.add(i, this.getElementAt(lm, i));
+ }
+ }
+
+ public void intervalRemoved(ListDataEvent e) {
+ int start = Math.min(e.getIndex0(), e.getIndex1());
+ int end = Math.max(e.getIndex0(), e.getIndex1());
+ int length = end - start + 1;
+ for (int i = 1; i <= length; i++) {
+ this.synchList.remove(start);
+ }
+ }
+
+
+ // ********** standard methods **********
+
+ @Override
+ public boolean equals(Object o) {
+ return this.synchList.equals(o);
+ }
+
+ @Override
+ public int hashCode() {
+ return this.synchList.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return this.synchList.toString();
+ }
+
+
+ // ********** internal methods **********
+
+ /**
+ * minimize the scope of the suppressed warnings.=
+ */
+ @SuppressWarnings("unchecked")
+ private E getElementAt(ListModel listModel, int index) {
+ return (E) listModel.getElementAt(index);
+ }
+
+ /**
+ * minimize the scope of the suppressed warnings.=
+ */
+ @SuppressWarnings("unchecked")
+ private Iterator<E> items(ListChangeEvent event) {
+ return (Iterator<E>) event.items();
+ }
+
+ /**
+ * minimize the scope of the suppressed warnings.=
+ */
+ @SuppressWarnings("unchecked")
+ private ListValueModel<E> getSource(ListChangeEvent event) {
+ return (ListValueModel<E>) event.getSource();
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ExtendedListValueModelWrapperTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ExtendedListValueModelWrapperTests.java
index d728f58cd7..ecda537173 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ExtendedListValueModelWrapperTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ExtendedListValueModelWrapperTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -13,7 +13,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
@@ -27,8 +26,8 @@ import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class ExtendedListValueModelWrapperTests extends TestCase {
- private SimpleListValueModel listHolder;
- private ListValueModel extendedListHolder;
+ private SimpleListValueModel<String> listHolder;
+ private ListValueModel<String> extendedListHolder;
ListChangeEvent event;
String eventType;
@@ -46,12 +45,12 @@ public class ExtendedListValueModelWrapperTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.listHolder = new SimpleListValueModel(this.buildList());
+ this.listHolder = new SimpleListValueModel<String>(this.buildList());
this.extendedListHolder = this.buildExtendedListHolder(this.listHolder);
}
- private List buildList() {
- List result = new ArrayList();
+ private List<String> buildList() {
+ List<String> result = new ArrayList<String>();
result.add("A");
result.add("B");
result.add("C");
@@ -59,31 +58,31 @@ public class ExtendedListValueModelWrapperTests extends TestCase {
return result;
}
- private List buildExtendedList() {
- List extendedList = new ArrayList();
+ private List<String> buildExtendedList() {
+ List<String> extendedList = new ArrayList<String>();
extendedList.addAll(this.buildPrefix());
extendedList.addAll(this.buildList());
extendedList.addAll(this.buildSuffix());
return extendedList;
}
- private List buildPrefix() {
- List prefix = new ArrayList();
+ private List<String> buildPrefix() {
+ List<String> prefix = new ArrayList<String>();
prefix.add("x");
prefix.add("y");
prefix.add("z");
return prefix;
}
- private List buildSuffix() {
- List suffix = new ArrayList();
+ private List<String> buildSuffix() {
+ List<String> suffix = new ArrayList<String>();
suffix.add("i");
suffix.add("j");
return suffix;
}
- private ListValueModel buildExtendedListHolder(ListValueModel lvm) {
- return new ExtendedListValueModelWrapper(this.buildPrefix(), lvm, this.buildSuffix());
+ private ListValueModel<String> buildExtendedListHolder(ListValueModel<String> lvm) {
+ return new ExtendedListValueModelWrapper<String>(this.buildPrefix(), lvm, this.buildSuffix());
}
@Override
@@ -107,13 +106,13 @@ public class ExtendedListValueModelWrapperTests extends TestCase {
return CollectionTools.contains(this.extendedListHolder.iterator(), item);
}
- private boolean extendedListContainsAll(Collection items) {
+ private boolean extendedListContainsAll(Collection<String> items) {
return CollectionTools.containsAll(this.extendedListHolder.iterator(), items);
}
- private boolean extendedListContainsAny(Collection items) {
- List extendedList = CollectionTools.list(this.extendedListHolder.iterator());
- for (Iterator stream = items.iterator(); stream.hasNext(); ) {
+ private boolean extendedListContainsAny(Collection<String> items) {
+ List<String> extendedList = CollectionTools.list(this.extendedListHolder.iterator());
+ for (Iterator<String> stream = items.iterator(); stream.hasNext(); ) {
if (extendedList.contains(stream.next())) {
return true;
}
@@ -125,20 +124,20 @@ public class ExtendedListValueModelWrapperTests extends TestCase {
return CollectionTools.contains(this.listHolder.iterator(), item);
}
- private boolean listContainsAll(Collection items) {
+ private boolean listContainsAll(Collection<String> items) {
return CollectionTools.containsAll(this.listHolder.iterator(), items);
}
- private boolean listContainsAny(Collection items) {
- List extendedList = CollectionTools.list(this.listHolder.iterator());
- for (Iterator stream = items.iterator(); stream.hasNext(); ) {
- if (extendedList.contains(stream.next())) {
- return true;
- }
- }
- return false;
- }
-
+// private boolean listContainsAny(Collection<String> items) {
+// List<String> extendedList = CollectionTools.list(this.listHolder.iterator());
+// for (Iterator<String> stream = items.iterator(); stream.hasNext(); ) {
+// if (extendedList.contains(stream.next())) {
+// return true;
+// }
+// }
+// return false;
+// }
+//
public void testAdd1() {
this.extendedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.buildListener());
@@ -157,8 +156,8 @@ public class ExtendedListValueModelWrapperTests extends TestCase {
assertTrue(this.listContains(null));
}
- private List buildAddList() {
- List addList = new ArrayList();
+ private List<String> buildAddList() {
+ List<String> addList = new ArrayList<String>();
addList.add("E");
addList.add("F");
return addList;
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/FilteringCollectionValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/FilteringCollectionValueModelTests.java
index c7a0e361f3..9742dd34f8 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/FilteringCollectionValueModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/FilteringCollectionValueModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -24,13 +24,13 @@ import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel;
import org.eclipse.jpt.utility.tests.internal.TestTools;
public class FilteringCollectionValueModelTests extends TestCase {
- private SimpleCollectionValueModel collectionHolder;
+ private SimpleCollectionValueModel<String> collectionHolder;
CollectionChangeEvent addEvent;
CollectionChangeEvent removeEvent;
CollectionChangeEvent collectionClearedEvent;
CollectionChangeEvent collectionChangedEvent;
- private CollectionValueModel filteredCollectionHolder;
+ private CollectionValueModel<String> filteredCollectionHolder;
CollectionChangeEvent filteredAddEvent;
CollectionChangeEvent filteredRemoveEvent;
CollectionChangeEvent filteredCollectionClearedEvent;
@@ -43,20 +43,20 @@ public class FilteringCollectionValueModelTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.collectionHolder = new SimpleCollectionValueModel(buildCollection());
- this.filteredCollectionHolder = new FilteringCollectionValueModel(this.collectionHolder, this.buildFilter());
+ this.collectionHolder = new SimpleCollectionValueModel<String>(buildCollection());
+ this.filteredCollectionHolder = new FilteringCollectionValueModel<String>(this.collectionHolder, this.buildFilter());
}
- private Collection buildCollection() {
- Collection collection = new Vector();
+ private Collection<String> buildCollection() {
+ Collection<String> collection = new Vector<String>();
collection.add("foo");
return collection;
}
- private Filter buildFilter() {
- return new Filter() {
- public boolean accept(Object o) {
- return ((String) o).startsWith("b");
+ private Filter<String> buildFilter() {
+ return new Filter<String>() {
+ public boolean accept(String s) {
+ return s.startsWith("b");
}
};
}
@@ -71,43 +71,43 @@ public class FilteringCollectionValueModelTests extends TestCase {
// add a listener to "activate" the wrapper
this.filteredCollectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildFilteredListener());
- assertEquals("foo", ((Iterator) this.collectionHolder.iterator()).next());
- assertFalse(((Iterator) this.filteredCollectionHolder.iterator()).hasNext());
+ assertEquals("foo", this.collectionHolder.iterator().next());
+ assertFalse(this.filteredCollectionHolder.iterator().hasNext());
this.collectionHolder.add("bar");
- Iterator collectionHolderValue = (Iterator) this.collectionHolder.iterator();
+ Iterator<String> collectionHolderValue = this.collectionHolder.iterator();
assertEquals("foo", collectionHolderValue.next());
assertEquals("bar", collectionHolderValue.next());
- assertTrue(((Iterator) this.filteredCollectionHolder.iterator()).hasNext());
- assertEquals("bar", ((Iterator) this.filteredCollectionHolder.iterator()).next());
+ assertTrue(this.filteredCollectionHolder.iterator().hasNext());
+ assertEquals("bar", this.filteredCollectionHolder.iterator().next());
this.collectionHolder.remove("bar");
- assertEquals("foo", ((Iterator) this.collectionHolder.iterator()).next());
- assertFalse(((Iterator) this.filteredCollectionHolder.iterator()).hasNext());
+ assertEquals("foo", this.collectionHolder.iterator().next());
+ assertFalse(this.filteredCollectionHolder.iterator().hasNext());
this.collectionHolder.remove("foo");
- assertFalse(((Iterator) this.collectionHolder.iterator()).hasNext());
- assertFalse(((Iterator) this.filteredCollectionHolder.iterator()).hasNext());
+ assertFalse(this.collectionHolder.iterator().hasNext());
+ assertFalse(this.filteredCollectionHolder.iterator().hasNext());
this.collectionHolder.add("foo");
- assertEquals("foo", ((Iterator) this.collectionHolder.iterator()).next());
- assertFalse(((Iterator) this.filteredCollectionHolder.iterator()).hasNext());
+ assertEquals("foo", this.collectionHolder.iterator().next());
+ assertFalse(this.filteredCollectionHolder.iterator().hasNext());
}
public void testSetValue() {
// add a listener to "activate" the wrapper
this.filteredCollectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildFilteredListener());
- Collection newCollection = new Vector();
+ Collection<String> newCollection = new Vector<String>();
newCollection.add("fox");
newCollection.add("baz");
- ((SimpleCollectionValueModel) this.collectionHolder).setCollection(newCollection);
+ this.collectionHolder.setCollection(newCollection);
- Iterator collectionValues = (Iterator) this.collectionHolder.iterator();
+ Iterator<String> collectionValues = this.collectionHolder.iterator();
assertEquals("fox", collectionValues.next());
assertEquals("baz", collectionValues.next());
- Iterator filteredCollectionValues = (Iterator) this.filteredCollectionHolder.iterator();
+ Iterator<String> filteredCollectionValues = this.filteredCollectionHolder.iterator();
assertEquals("baz", filteredCollectionValues.next());
assertFalse(filteredCollectionValues.hasNext());
}
@@ -152,7 +152,7 @@ public class FilteringCollectionValueModelTests extends TestCase {
private void verifyCollectionChanges() {
clearEvents();
this.collectionHolder.add("bar");
- Collection tempCollection = new Vector();
+ Collection<String> tempCollection = new Vector<String>();
tempCollection.add("bar");
this.verifyEvent(this.addEvent, this.collectionHolder, tempCollection);
this.verifyEvent(this.filteredAddEvent, this.filteredCollectionHolder, tempCollection);
@@ -182,17 +182,17 @@ public class FilteringCollectionValueModelTests extends TestCase {
clearEvents();
- Collection newCollection = new Vector();
+ Collection<String> newCollection = new Vector<String>();
newCollection.add("fox");
newCollection.add("baz");
- ((SimpleCollectionValueModel) this.collectionHolder).setCollection(newCollection);
+ this.collectionHolder.setCollection(newCollection);
- this.verifyEvent(this.collectionChangedEvent, this.collectionHolder, new Vector());
+ this.verifyEvent(this.collectionChangedEvent, this.collectionHolder, new Vector<String>());
tempCollection.remove("foo");
tempCollection.add("baz");
- this.verifyEvent(this.filteredCollectionChangedEvent, this.filteredCollectionHolder, new Vector());
+ this.verifyEvent(this.filteredCollectionChangedEvent, this.filteredCollectionHolder, new Vector<String>());
}
@@ -238,48 +238,50 @@ public class FilteringCollectionValueModelTests extends TestCase {
public void testRemoveFilteredItem() {
// build collection with TestItems
- this.collectionHolder = new SimpleCollectionValueModel(this.buildCollection2());
- this.filteredCollectionHolder = new FilteringCollectionValueModel(this.collectionHolder, this.buildFilter2());
+ SimpleCollectionValueModel<TestItem> tiHolder = new SimpleCollectionValueModel<TestItem>(this.buildCollection2());
+ CollectionValueModel<TestItem> filteredTIHolder = new FilteringCollectionValueModel<TestItem>(tiHolder, this.buildFilter2());
// add a listener to "activate" the wrapper
- this.filteredCollectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildFilteredListener());
+ filteredTIHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildFilteredListener());
- assertEquals(0, this.filteredCollectionHolder.size());
+ assertEquals(0, filteredTIHolder.size());
- this.collectionHolder.add(new TestItem("bar"));
- assertEquals(1, this.filteredCollectionHolder.size());
+ tiHolder.add(new TestItem("bar"));
+ assertEquals(1, filteredTIHolder.size());
TestItem baz = new TestItem("baz");
- this.collectionHolder.add(baz);
- assertEquals(2, this.filteredCollectionHolder.size());
+ tiHolder.add(baz);
+ assertEquals(2, filteredTIHolder.size());
// before removing it, change the item so that it is filtered
baz.name = "jaz";
- this.collectionHolder.remove(baz);
+ tiHolder.remove(baz);
// this would fail because the item was not removed from
// the filtered collection cache... but we've fixed it now
- assertEquals(1, this.filteredCollectionHolder.size());
+ assertEquals(1, filteredTIHolder.size());
}
- private Collection buildCollection2() {
- Collection collection = new Vector();
+ private Collection<TestItem> buildCollection2() {
+ Collection<TestItem> collection = new Vector<TestItem>();
collection.add(new TestItem("foo"));
return collection;
}
- private Filter buildFilter2() {
- return new Filter() {
- public boolean accept(Object o) {
- return ((TestItem) o).name.startsWith("b");
+ private Filter<TestItem> buildFilter2() {
+ return new Filter<TestItem>() {
+ public boolean accept(TestItem ti) {
+ return ti.name.startsWith("b");
}
};
}
-private class TestItem {
- String name;
- TestItem(String name) {
- super();
- this.name = name;
+ // ********** TestItem inner class **********
+
+ private class TestItem {
+ String name;
+ TestItem(String name) {
+ super();
+ this.name = name;
+ }
}
-}
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/FilteringPropertyValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/FilteringPropertyValueModelTests.java
index ad22856e42..823ae2f391 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/FilteringPropertyValueModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/FilteringPropertyValueModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -13,19 +13,19 @@ import org.eclipse.jpt.utility.internal.BidiFilter;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.internal.model.value.FilteringPropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.FilteringWritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class FilteringPropertyValueModelTests extends TestCase {
- private PropertyValueModel objectHolder;
+ private WritablePropertyValueModel<String> objectHolder;
PropertyChangeEvent event;
- private PropertyValueModel filteredObjectHolder;
+ private WritablePropertyValueModel<String> filteredObjectHolder;
PropertyChangeEvent filteredEvent;
public FilteringPropertyValueModelTests(String name) {
@@ -35,17 +35,17 @@ public class FilteringPropertyValueModelTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.objectHolder = new SimplePropertyValueModel("foo");
- this.filteredObjectHolder = new FilteringPropertyValueModel(this.objectHolder, this.buildFilter());
+ this.objectHolder = new SimplePropertyValueModel<String>("foo");
+ this.filteredObjectHolder = new FilteringWritablePropertyValueModel<String>(this.objectHolder, this.buildFilter());
}
- private BidiFilter buildFilter() {
- return new BidiFilter() {
- public boolean accept(Object o) {
- return (o != null) && ((String) o).startsWith("b");
+ private BidiFilter<String> buildFilter() {
+ return new BidiFilter<String>() {
+ public boolean accept(String s) {
+ return (s != null) && s.startsWith("b");
}
- public boolean reverseAccept(Object o) {
- return (o != null) && ((String) o).startsWith("b");
+ public boolean reverseAccept(String s) {
+ return (s != null) && s.startsWith("b");
}
};
}
@@ -98,17 +98,17 @@ public class FilteringPropertyValueModelTests extends TestCase {
}
public void testLazyListening() {
- assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
PropertyChangeListener listener = this.buildFilteredListener();
this.filteredObjectHolder.addPropertyChangeListener(listener);
- assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.filteredObjectHolder.removePropertyChangeListener(listener);
- assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
- this.filteredObjectHolder.addPropertyChangeListener(ValueModel.VALUE, listener);
- assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(ValueModel.VALUE));
- this.filteredObjectHolder.removePropertyChangeListener(ValueModel.VALUE, listener);
- assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(ValueModel.VALUE));
+ this.filteredObjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, listener);
+ assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ this.filteredObjectHolder.removePropertyChangeListener(PropertyValueModel.VALUE, listener);
+ assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
}
public void testPropertyChange1() {
@@ -118,8 +118,8 @@ public class FilteringPropertyValueModelTests extends TestCase {
}
public void testPropertyChange2() {
- this.objectHolder.addPropertyChangeListener(ValueModel.VALUE, this.buildListener());
- this.filteredObjectHolder.addPropertyChangeListener(ValueModel.VALUE, this.buildFilteredListener());
+ this.objectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildListener());
+ this.filteredObjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildFilteredListener());
this.verifyPropertyChanges();
}
@@ -179,7 +179,7 @@ public class FilteringPropertyValueModelTests extends TestCase {
private void verifyEvent(PropertyChangeEvent e, Object source, Object oldValue, Object newValue) {
assertEquals(source, e.getSource());
- assertEquals(ValueModel.VALUE, e.propertyName());
+ assertEquals(PropertyValueModel.VALUE, e.propertyName());
assertEquals(oldValue, e.oldValue());
assertEquals(newValue, e.newValue());
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemCollectionListValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemCollectionListValueModelAdapterTests.java
index 3ac27dbad6..92ba0b2831 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemCollectionListValueModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemCollectionListValueModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -18,7 +18,6 @@ import javax.swing.Icon;
import org.eclipse.jpt.utility.internal.Bag;
import org.eclipse.jpt.utility.internal.HashBag;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.ItemCollectionListValueModelAdapter;
import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel;
@@ -67,9 +66,9 @@ public class ItemCollectionListValueModelAdapterTests extends TestCase {
}
public void testCollectionSynchronization() {
- SimpleCollectionValueModel collectionHolder = this.buildCollectionHolder();
- ListValueModel listValueModel = new ItemCollectionListValueModelAdapter(collectionHolder, Junk.STUFF_COLLECTION);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ SimpleCollectionValueModel<Junk> collectionHolder = this.buildCollectionHolder();
+ ListValueModel<Junk> listValueModel = new ItemCollectionListValueModelAdapter<Junk>(collectionHolder, Junk.STUFF_COLLECTION);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
assertEquals(6, synchList.size());
this.compare(listValueModel, synchList);
@@ -87,9 +86,9 @@ public class ItemCollectionListValueModelAdapterTests extends TestCase {
}
public void testListSynchronization() {
- SimpleListValueModel listHolder = this.buildListHolder();
- ListValueModel listValueModel = new ItemCollectionListValueModelAdapter(listHolder, Junk.STUFF_COLLECTION);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
+ ListValueModel<Junk> listValueModel = new ItemCollectionListValueModelAdapter<Junk>(listHolder, Junk.STUFF_COLLECTION);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
assertEquals(6, synchList.size());
this.compare(listValueModel, synchList);
@@ -106,7 +105,7 @@ public class ItemCollectionListValueModelAdapterTests extends TestCase {
this.compare(listValueModel, synchList);
}
- private void compare(ListValueModel listValueModel, List list) {
+ private void compare(ListValueModel<Junk> listValueModel, List<Junk> list) {
assertEquals(listValueModel.size(), list.size());
for (int i = 0; i < listValueModel.size(); i++) {
assertEquals(listValueModel.get(i), list.get(i));
@@ -115,18 +114,18 @@ public class ItemCollectionListValueModelAdapterTests extends TestCase {
public void testHasListeners() throws Exception {
- SimpleListValueModel listHolder = this.buildListHolder();
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
assertFalse(this.foo.hasAnyListChangeListeners(Junk.STUFF_COLLECTION));
assertFalse(this.jaz.hasAnyListChangeListeners(Junk.STUFF_COLLECTION));
- ListValueModel listValueModel = new ItemCollectionListValueModelAdapter(listHolder, Junk.STUFF_COLLECTION);
+ ListValueModel<Junk> listValueModel = new ItemCollectionListValueModelAdapter<Junk>(listHolder, Junk.STUFF_COLLECTION);
assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
assertFalse(this.foo.hasAnyCollectionChangeListeners(Junk.STUFF_COLLECTION));
assertFalse(this.jaz.hasAnyCollectionChangeListeners(Junk.STUFF_COLLECTION));
this.verifyHasNoListeners(listValueModel);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
assertTrue(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
assertTrue(this.foo.hasAnyCollectionChangeListeners(Junk.STUFF_COLLECTION));
assertTrue(this.jaz.hasAnyCollectionChangeListeners(Junk.STUFF_COLLECTION));
@@ -140,18 +139,18 @@ public class ItemCollectionListValueModelAdapterTests extends TestCase {
}
public void testGetSize() throws Exception {
- SimpleListValueModel listHolder = this.buildListHolder();
- ListValueModel listValueModel = new ItemCollectionListValueModelAdapter(listHolder, Junk.STUFF_COLLECTION);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
+ ListValueModel<Junk> listValueModel = new ItemCollectionListValueModelAdapter<Junk>(listHolder, Junk.STUFF_COLLECTION);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
this.verifyHasListeners(listValueModel);
assertEquals(6, listValueModel.size());
assertEquals(6, synchList.size());
}
public void testGet() throws Exception {
- SimpleListValueModel listHolder = this.buildListHolder();
- ListValueModel listValueModel = new SortedListValueModelAdapter(new ItemCollectionListValueModelAdapter(listHolder, Junk.STUFF_COLLECTION));
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
+ ListValueModel<Junk> listValueModel = new SortedListValueModelAdapter<Junk>(new ItemCollectionListValueModelAdapter<Junk>(listHolder, Junk.STUFF_COLLECTION));
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
this.verifyHasListeners(listValueModel);
assertEquals(this.bar, listValueModel.get(0));
assertEquals(this.bar, synchList.get(0));
@@ -163,35 +162,35 @@ public class ItemCollectionListValueModelAdapterTests extends TestCase {
this.bar.removeStuff("zzz");
}
- private void verifyHasNoListeners(ListValueModel listValueModel) throws Exception {
+ private void verifyHasNoListeners(ListValueModel<Junk> listValueModel) throws Exception {
assertTrue(((AbstractModel) listValueModel).hasNoListChangeListeners(ListValueModel.LIST_VALUES));
}
- private void verifyHasListeners(ListValueModel listValueModel) throws Exception {
+ private void verifyHasListeners(ListValueModel<Junk> listValueModel) throws Exception {
assertTrue(((AbstractModel) listValueModel).hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
}
- private SimpleCollectionValueModel buildCollectionHolder() {
- return new SimpleCollectionValueModel(this.buildCollection());
+ private SimpleCollectionValueModel<Junk> buildCollectionHolder() {
+ return new SimpleCollectionValueModel<Junk>(this.buildCollection());
}
- private Collection buildCollection() {
- Bag bag = new HashBag();
+ private Collection<Junk> buildCollection() {
+ Bag<Junk> bag = new HashBag<Junk>();
this.populateCollection(bag);
return bag;
}
- private SimpleListValueModel buildListHolder() {
- return new SimpleListValueModel(this.buildList());
+ private SimpleListValueModel<Junk> buildListHolder() {
+ return new SimpleListValueModel<Junk>(this.buildList());
}
- private List buildList() {
- List list = new ArrayList();
+ private List<Junk> buildList() {
+ List<Junk> list = new ArrayList<Junk>();
this.populateCollection(list);
return list;
}
- private void populateCollection(Collection c) {
+ private void populateCollection(Collection<Junk> c) {
c.add(this.foo);
c.add(this.bar);
c.add(this.baz);
@@ -201,41 +200,43 @@ public class ItemCollectionListValueModelAdapterTests extends TestCase {
}
-private class Junk extends AbstractModel implements Displayable {
- private Collection stuff;
- public static final String STUFF_COLLECTION = "stuff";
-
-
- public Junk(String stuffItem) {
- this.stuff = new ArrayList();
- this.stuff.add(stuffItem);
- }
+ // ********** Junk class **********
- public void addStuff(String stuffItem) {
- this.addItemToCollection(stuffItem, this.stuff, STUFF_COLLECTION);
- }
+ private class Junk extends AbstractModel implements Displayable {
+ private Collection<String> stuff;
+ public static final String STUFF_COLLECTION = "stuff";
+
- public void removeStuff(String stuffItem) {
- this.removeItemFromCollection(stuffItem, this.stuff, STUFF_COLLECTION);
- }
-
- public String displayString() {
- return toString();
- }
-
- public Icon icon() {
- return null;
- }
+ public Junk(String stuffItem) {
+ this.stuff = new ArrayList<String>();
+ this.stuff.add(stuffItem);
+ }
+
+ public void addStuff(String stuffItem) {
+ this.addItemToCollection(stuffItem, this.stuff, STUFF_COLLECTION);
+ }
+
+ public void removeStuff(String stuffItem) {
+ this.removeItemFromCollection(stuffItem, this.stuff, STUFF_COLLECTION);
+ }
+
+ public String displayString() {
+ return toString();
+ }
+
+ public Icon icon() {
+ return null;
+ }
+
+ public int compareTo(Displayable o) {
+ return DEFAULT_COMPARATOR.compare(this, o);
+ }
+
+ @Override
+ public String toString() {
+ return "Junk(" + this.stuff + ")";
+ }
- public int compareTo(Displayable o) {
- return DEFAULT_COMPARATOR.compare(this, o);
- }
-
- @Override
- public String toString() {
- return "Junk(" + this.stuff + ")";
}
}
-
-}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemListListValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemListListValueModelAdapterTests.java
index 739f1abdf1..d414f5c9f7 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemListListValueModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemListListValueModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -18,7 +18,6 @@ import javax.swing.Icon;
import org.eclipse.jpt.utility.internal.Bag;
import org.eclipse.jpt.utility.internal.HashBag;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.ItemListListValueModelAdapter;
import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel;
@@ -67,9 +66,9 @@ public class ItemListListValueModelAdapterTests extends TestCase {
}
public void testCollectionSynchronization() {
- SimpleCollectionValueModel collectionHolder = this.buildCollectionHolder();
- ListValueModel listValueModel = new ItemListListValueModelAdapter(collectionHolder, Junk.STUFF_LIST);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ SimpleCollectionValueModel<Junk> collectionHolder = this.buildCollectionHolder();
+ ListValueModel<Junk> listValueModel = new ItemListListValueModelAdapter<Junk>(collectionHolder, Junk.STUFF_LIST);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
assertEquals(6, synchList.size());
this.compare(listValueModel, synchList);
@@ -87,9 +86,9 @@ public class ItemListListValueModelAdapterTests extends TestCase {
}
public void testListSynchronization() {
- SimpleListValueModel listHolder = this.buildListHolder();
- ListValueModel listValueModel = new ItemListListValueModelAdapter(listHolder, Junk.STUFF_LIST);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
+ ListValueModel<Junk> listValueModel = new ItemListListValueModelAdapter<Junk>(listHolder, Junk.STUFF_LIST);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
assertEquals(6, synchList.size());
this.compare(listValueModel, synchList);
@@ -106,7 +105,7 @@ public class ItemListListValueModelAdapterTests extends TestCase {
this.compare(listValueModel, synchList);
}
- private void compare(ListValueModel listValueModel, List list) {
+ private void compare(ListValueModel<Junk> listValueModel, List<Junk> list) {
assertEquals(listValueModel.size(), list.size());
for (int i = 0; i < listValueModel.size(); i++) {
assertEquals(listValueModel.get(i), list.get(i));
@@ -115,18 +114,18 @@ public class ItemListListValueModelAdapterTests extends TestCase {
public void testHasListeners() throws Exception {
- SimpleListValueModel listHolder = this.buildListHolder();
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
assertFalse(this.foo.hasAnyListChangeListeners(Junk.STUFF_LIST));
assertFalse(this.jaz.hasAnyListChangeListeners(Junk.STUFF_LIST));
- ListValueModel listValueModel = new ItemListListValueModelAdapter(listHolder, Junk.STUFF_LIST);
+ ListValueModel<Junk> listValueModel = new ItemListListValueModelAdapter<Junk>(listHolder, Junk.STUFF_LIST);
assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
assertFalse(this.foo.hasAnyListChangeListeners(Junk.STUFF_LIST));
assertFalse(this.jaz.hasAnyListChangeListeners(Junk.STUFF_LIST));
this.verifyHasNoListeners(listValueModel);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
assertTrue(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
assertTrue(this.foo.hasAnyListChangeListeners(Junk.STUFF_LIST));
assertTrue(this.jaz.hasAnyListChangeListeners(Junk.STUFF_LIST));
@@ -140,18 +139,18 @@ public class ItemListListValueModelAdapterTests extends TestCase {
}
public void testGetSize() throws Exception {
- SimpleListValueModel listHolder = this.buildListHolder();
- ListValueModel listValueModel = new ItemListListValueModelAdapter(listHolder, Junk.STUFF_LIST);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
+ ListValueModel<Junk> listValueModel = new ItemListListValueModelAdapter<Junk>(listHolder, Junk.STUFF_LIST);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
this.verifyHasListeners(listValueModel);
assertEquals(6, listValueModel.size());
assertEquals(6, synchList.size());
}
public void testGet() throws Exception {
- SimpleListValueModel listHolder = this.buildListHolder();
- ListValueModel listValueModel = new SortedListValueModelAdapter(new ItemListListValueModelAdapter(listHolder, Junk.STUFF_LIST));
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
+ ListValueModel<Junk> listValueModel = new SortedListValueModelAdapter<Junk>(new ItemListListValueModelAdapter<Junk>(listHolder, Junk.STUFF_LIST));
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
this.verifyHasListeners(listValueModel);
assertEquals(this.bar, listValueModel.get(0));
assertEquals(this.bar, synchList.get(0));
@@ -163,35 +162,35 @@ public class ItemListListValueModelAdapterTests extends TestCase {
this.bar.removeStuff("zzz");
}
- private void verifyHasNoListeners(ListValueModel listValueModel) throws Exception {
+ private void verifyHasNoListeners(ListValueModel<Junk> listValueModel) throws Exception {
assertTrue(((AbstractModel) listValueModel).hasNoListChangeListeners(ListValueModel.LIST_VALUES));
}
- private void verifyHasListeners(ListValueModel listValueModel) throws Exception {
+ private void verifyHasListeners(ListValueModel<Junk> listValueModel) throws Exception {
assertTrue(((AbstractModel) listValueModel).hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
}
- private SimpleCollectionValueModel buildCollectionHolder() {
- return new SimpleCollectionValueModel(this.buildCollection());
+ private SimpleCollectionValueModel<Junk> buildCollectionHolder() {
+ return new SimpleCollectionValueModel<Junk>(this.buildCollection());
}
- private Collection buildCollection() {
- Bag bag = new HashBag();
+ private Collection<Junk> buildCollection() {
+ Bag<Junk> bag = new HashBag<Junk>();
this.populateCollection(bag);
return bag;
}
- private SimpleListValueModel buildListHolder() {
- return new SimpleListValueModel(this.buildList());
+ private SimpleListValueModel<Junk> buildListHolder() {
+ return new SimpleListValueModel<Junk>(this.buildList());
}
- private List buildList() {
- List list = new ArrayList();
+ private List<Junk> buildList() {
+ List<Junk> list = new ArrayList<Junk>();
this.populateCollection(list);
return list;
}
- private void populateCollection(Collection c) {
+ private void populateCollection(Collection<Junk> c) {
c.add(this.foo);
c.add(this.bar);
c.add(this.baz);
@@ -200,42 +199,45 @@ public class ItemListListValueModelAdapterTests extends TestCase {
c.add(this.jaz);
}
-private class Junk extends AbstractModel implements Displayable {
- private List stuff;
- public static final String STUFF_LIST = "stuff";
-
-
- public Junk(String stuffItem) {
- this.stuff = new ArrayList();
- this.stuff.add(stuffItem);
- }
- public void addStuff(String stuffItem) {
- this.stuff.add(stuffItem);
- fireItemAdded(STUFF_LIST, this.stuff.indexOf(stuffItem), stuffItem);
- }
-
- public void removeStuff(String stuffItem) {
- int index = this.stuff.indexOf(stuffItem);
- this.stuff.remove(stuffItem);
- fireItemRemoved(STUFF_LIST, index, stuffItem);
- }
- public String displayString() {
- return toString();
- }
+ // ********** Junk class **********
- public Icon icon() {
- return null;
- }
+ private class Junk extends AbstractModel implements Displayable {
+ private List<String> stuff;
+ public static final String STUFF_LIST = "stuff";
+
- public int compareTo(Displayable o) {
- return DEFAULT_COMPARATOR.compare(this, o);
- }
-
- @Override
- public String toString() {
- return "Junk(" + this.stuff + ")";
+ public Junk(String stuffItem) {
+ this.stuff = new ArrayList<String>();
+ this.stuff.add(stuffItem);
+ }
+ public void addStuff(String stuffItem) {
+ this.stuff.add(stuffItem);
+ fireItemAdded(STUFF_LIST, this.stuff.indexOf(stuffItem), stuffItem);
+ }
+
+ public void removeStuff(String stuffItem) {
+ int index = this.stuff.indexOf(stuffItem);
+ this.stuff.remove(stuffItem);
+ fireItemRemoved(STUFF_LIST, index, stuffItem);
+ }
+
+ public String displayString() {
+ return toString();
+ }
+
+ public Icon icon() {
+ return null;
+ }
+
+ public int compareTo(Displayable o) {
+ return DEFAULT_COMPARATOR.compare(this, o);
+ }
+
+ @Override
+ public String toString() {
+ return "Junk(" + this.stuff + ")";
+ }
}
-}
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemPropertyListValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemPropertyListValueModelAdapterTests.java
index d0b0149fd2..5d9bdda881 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemPropertyListValueModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemPropertyListValueModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -70,9 +70,9 @@ public class ItemPropertyListValueModelAdapterTests extends TestCase {
}
public void testCollectionSynchronization() {
- SimpleCollectionValueModel collectionHolder = this.buildCollectionHolder();
- ListValueModel listValueModel = new ItemPropertyListValueModelAdapter(collectionHolder, Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ SimpleCollectionValueModel<Junk> collectionHolder = this.buildCollectionHolder();
+ ListValueModel<Junk> listValueModel = new ItemPropertyListValueModelAdapter<Junk>(collectionHolder, Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
assertEquals(6, synchList.size());
this.compare(listValueModel, synchList);
@@ -94,9 +94,9 @@ public class ItemPropertyListValueModelAdapterTests extends TestCase {
}
public void testListSynchronization() {
- SimpleListValueModel listHolder = this.buildListHolder();
- ListValueModel listValueModel = new ItemPropertyListValueModelAdapter(listHolder, Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
+ ListValueModel<Junk> listValueModel = new ItemPropertyListValueModelAdapter<Junk>(listHolder, Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
assertEquals(6, synchList.size());
this.compare(listValueModel, synchList);
@@ -118,7 +118,7 @@ public class ItemPropertyListValueModelAdapterTests extends TestCase {
this.compare(listValueModel, synchList);
}
- private void compare(ListValueModel listValueModel, List list) {
+ private void compare(ListValueModel<Junk> listValueModel, List<Junk> list) {
assertEquals(listValueModel.size(), list.size());
for (int i = 0; i < listValueModel.size(); i++) {
assertEquals(listValueModel.get(i), list.get(i));
@@ -141,19 +141,19 @@ public class ItemPropertyListValueModelAdapterTests extends TestCase {
this.verifyListSort(this.buildCustomComparator());
}
- private Comparator buildCustomComparator() {
+ private Comparator<Junk> buildCustomComparator() {
// sort with reverse order
- return new Comparator() {
- public int compare(Object o1, Object o2) {
- return ((Comparable) o2).compareTo(o1);
+ return new Comparator<Junk>() {
+ public int compare(Junk o1, Junk o2) {
+ return o2.compareTo(o1);
}
};
}
- private void verifyCollectionSort(Comparator comparator) {
- SimpleCollectionValueModel collectionHolder = this.buildCollectionHolder();
- ListValueModel listValueModel = new ItemPropertyListValueModelAdapter(new SortedListValueModelAdapter(collectionHolder, comparator), Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ private void verifyCollectionSort(Comparator<Junk> comparator) {
+ SimpleCollectionValueModel<Junk> collectionHolder = this.buildCollectionHolder();
+ ListValueModel<Junk> listValueModel = new ItemPropertyListValueModelAdapter<Junk>(new SortedListValueModelAdapter<Junk>(collectionHolder, comparator), Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
assertEquals(6, synchList.size());
this.compareSort(listValueModel, synchList, comparator);
@@ -174,10 +174,10 @@ public class ItemPropertyListValueModelAdapterTests extends TestCase {
this.compareSort(listValueModel, synchList, comparator);
}
- private void verifyListSort(Comparator comparator) {
- SimpleListValueModel listHolder = this.buildListHolder();
- ListValueModel listValueModel = new ItemPropertyListValueModelAdapter(new SortedListValueModelAdapter(listHolder, comparator), Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ private void verifyListSort(Comparator<Junk> comparator) {
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
+ ListValueModel<Junk> listValueModel = new ItemPropertyListValueModelAdapter<Junk>(new SortedListValueModelAdapter<Junk>(listHolder, comparator), Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
assertEquals(6, synchList.size());
this.compareSort(listValueModel, synchList, comparator);
@@ -199,26 +199,26 @@ public class ItemPropertyListValueModelAdapterTests extends TestCase {
this.compareSort(listValueModel, synchList, comparator);
}
- private void compareSort(ListValueModel listValueModel, List list, Comparator comparator) {
- SortedSet ss = new TreeSet(comparator);
+ private void compareSort(ListValueModel<Junk> listValueModel, List<Junk> list, Comparator<Junk> comparator) {
+ SortedSet<Junk> ss = new TreeSet<Junk>(comparator);
for (int i = 0; i < listValueModel.size(); i++) {
ss.add(listValueModel.get(i));
}
assertEquals(ss.size(), list.size());
- for (Iterator stream1 = ss.iterator(), stream2 = list.iterator(); stream1.hasNext(); ) {
+ for (Iterator<Junk> stream1 = ss.iterator(), stream2 = list.iterator(); stream1.hasNext(); ) {
assertEquals(stream1.next(), stream2.next());
}
}
public void testHasListeners() throws Exception {
- SimpleListValueModel listHolder = this.buildListHolder();
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
assertFalse(this.foo.hasAnyPropertyChangeListeners(Displayable.DISPLAY_STRING_PROPERTY));
assertFalse(this.foo.hasAnyPropertyChangeListeners(Displayable.ICON_PROPERTY));
assertFalse(this.jaz.hasAnyPropertyChangeListeners(Displayable.DISPLAY_STRING_PROPERTY));
assertFalse(this.jaz.hasAnyPropertyChangeListeners(Displayable.ICON_PROPERTY));
- ListValueModel listValueModel = new ItemPropertyListValueModelAdapter(new SortedListValueModelAdapter(listHolder), Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY);
+ ListValueModel<Junk> listValueModel = new ItemPropertyListValueModelAdapter<Junk>(new SortedListValueModelAdapter<Junk>(listHolder), Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY);
assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
assertFalse(this.foo.hasAnyPropertyChangeListeners(Displayable.DISPLAY_STRING_PROPERTY));
assertFalse(this.foo.hasAnyPropertyChangeListeners(Displayable.ICON_PROPERTY));
@@ -226,7 +226,7 @@ public class ItemPropertyListValueModelAdapterTests extends TestCase {
assertFalse(this.jaz.hasAnyPropertyChangeListeners(Displayable.ICON_PROPERTY));
this.verifyHasNoListeners(listValueModel);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
assertTrue(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
assertTrue(this.foo.hasAnyPropertyChangeListeners(Displayable.DISPLAY_STRING_PROPERTY));
assertTrue(this.foo.hasAnyPropertyChangeListeners(Displayable.ICON_PROPERTY));
@@ -244,18 +244,18 @@ public class ItemPropertyListValueModelAdapterTests extends TestCase {
}
public void testGetSize() throws Exception {
- SimpleListValueModel listHolder = this.buildListHolder();
- ListValueModel listValueModel = new ItemPropertyListValueModelAdapter(new SortedListValueModelAdapter(listHolder), Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
+ ListValueModel<Junk> listValueModel = new ItemPropertyListValueModelAdapter<Junk>(new SortedListValueModelAdapter<Junk>(listHolder), Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
this.verifyHasListeners(listValueModel);
assertEquals(6, listValueModel.size());
assertEquals(6, synchList.size());
}
public void testGet() throws Exception {
- SimpleListValueModel listHolder = this.buildListHolder();
- ListValueModel listValueModel = new SortedListValueModelAdapter(new ItemPropertyListValueModelAdapter(listHolder, Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY));
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
+ ListValueModel<Junk> listValueModel = new SortedListValueModelAdapter<Junk>(new ItemPropertyListValueModelAdapter<Junk>(listHolder, Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY));
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
this.verifyHasListeners(listValueModel);
assertEquals(this.bar, listValueModel.get(0));
assertEquals(this.bar, synchList.get(0));
@@ -265,35 +265,35 @@ public class ItemPropertyListValueModelAdapterTests extends TestCase {
this.bar.setName("this.bar");
}
- private void verifyHasNoListeners(ListValueModel listValueModel) throws Exception {
+ private void verifyHasNoListeners(ListValueModel<Junk> listValueModel) throws Exception {
assertTrue(((AbstractModel) listValueModel).hasNoListChangeListeners(ListValueModel.LIST_VALUES));
}
- private void verifyHasListeners(ListValueModel listValueModel) throws Exception {
+ private void verifyHasListeners(ListValueModel<Junk> listValueModel) throws Exception {
assertTrue(((AbstractModel) listValueModel).hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
}
- private SimpleCollectionValueModel buildCollectionHolder() {
- return new SimpleCollectionValueModel(this.buildCollection());
+ private SimpleCollectionValueModel<Junk> buildCollectionHolder() {
+ return new SimpleCollectionValueModel<Junk>(this.buildCollection());
}
- private Collection buildCollection() {
- Bag bag = new HashBag();
+ private Collection<Junk> buildCollection() {
+ Bag<Junk> bag = new HashBag<Junk>();
this.populateCollection(bag);
return bag;
}
- private SimpleListValueModel buildListHolder() {
- return new SimpleListValueModel(this.buildList());
+ private SimpleListValueModel<Junk> buildListHolder() {
+ return new SimpleListValueModel<Junk>(this.buildList());
}
- private List buildList() {
- List list = new ArrayList();
+ private List<Junk> buildList() {
+ List<Junk> list = new ArrayList<Junk>();
this.populateCollection(list);
return list;
}
- private void populateCollection(Collection c) {
+ private void populateCollection(Collection<Junk> c) {
c.add(this.foo);
c.add(this.bar);
c.add(this.baz);
@@ -302,29 +302,32 @@ public class ItemPropertyListValueModelAdapterTests extends TestCase {
c.add(this.jaz);
}
-private class Junk extends AbstractModel implements Displayable {
- private String name;
- public Junk(String name) {
- this.name = name;
- }
- public String displayString() {
- return this.name;
- }
- public Icon icon() {
- return null;
- }
- public int compareTo(Displayable o) {
- return DEFAULT_COMPARATOR.compare(this, o);
- }
- public void setName(String name) {
- Object old = this.name;
- this.name = name;
- this.firePropertyChanged(DISPLAY_STRING_PROPERTY, old, name);
- }
- @Override
- public String toString() {
- return "Junk(" + this.name + ")";
+
+ // ********** Junk class **********
+
+ private class Junk extends AbstractModel implements Displayable {
+ private String name;
+ public Junk(String name) {
+ this.name = name;
+ }
+ public String displayString() {
+ return this.name;
+ }
+ public Icon icon() {
+ return null;
+ }
+ public int compareTo(Displayable o) {
+ return DEFAULT_COMPARATOR.compare(this, o);
+ }
+ public void setName(String name) {
+ Object old = this.name;
+ this.name = name;
+ this.firePropertyChanged(DISPLAY_STRING_PROPERTY, old, name);
+ }
+ @Override
+ public String toString() {
+ return "Junk(" + this.name + ")";
+ }
}
-}
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemStateListValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemStateListValueModelAdapterTests.java
index 365a5716d1..5030a0ee22 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemStateListValueModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemStateListValueModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -20,7 +20,6 @@ import java.util.TreeSet;
import org.eclipse.jpt.utility.internal.Bag;
import org.eclipse.jpt.utility.internal.HashBag;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.ItemStateListValueModelAdapter;
import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel;
@@ -68,9 +67,9 @@ public class ItemStateListValueModelAdapterTests extends TestCase {
}
public void testCollectionSynchronization() {
- SimpleCollectionValueModel collectionHolder = this.buildCollectionHolder();
- ListValueModel listValueModel = new ItemStateListValueModelAdapter(collectionHolder);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ SimpleCollectionValueModel<Junk> collectionHolder = this.buildCollectionHolder();
+ ListValueModel<Junk> listValueModel = new ItemStateListValueModelAdapter<Junk>(collectionHolder);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
assertEquals(6, synchList.size());
this.compare(listValueModel, synchList);
@@ -88,9 +87,9 @@ public class ItemStateListValueModelAdapterTests extends TestCase {
}
public void testListSynchronization() {
- SimpleListValueModel listHolder = this.buildListHolder();
- ListValueModel listValueModel = new ItemStateListValueModelAdapter(listHolder);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
+ ListValueModel<Junk> listValueModel = new ItemStateListValueModelAdapter<Junk>(listHolder);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
assertEquals(6, synchList.size());
this.compare(listValueModel, synchList);
@@ -107,7 +106,7 @@ public class ItemStateListValueModelAdapterTests extends TestCase {
this.compare(listValueModel, synchList);
}
- private void compare(ListValueModel listValueModel, List list) {
+ private void compare(ListValueModel<Junk> listValueModel, List<Junk> list) {
assertEquals(listValueModel.size(), list.size());
for (int i = 0; i < listValueModel.size(); i++) {
assertEquals(listValueModel.get(i), list.get(i));
@@ -130,19 +129,19 @@ public class ItemStateListValueModelAdapterTests extends TestCase {
this.verifyListSort(this.buildCustomComparator());
}
- private Comparator buildCustomComparator() {
+ private Comparator<Junk> buildCustomComparator() {
// sort with reverse order
- return new Comparator() {
- public int compare(Object o1, Object o2) {
- return ((Comparable) o2).compareTo(o1);
+ return new Comparator<Junk>() {
+ public int compare(Junk o1, Junk o2) {
+ return o2.compareTo(o1);
}
};
}
- private void verifyCollectionSort(Comparator comparator) {
- SimpleCollectionValueModel collectionHolder = this.buildCollectionHolder();
- ListValueModel listValueModel = new ItemStateListValueModelAdapter(new SortedListValueModelAdapter(collectionHolder, comparator));
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ private void verifyCollectionSort(Comparator<Junk> comparator) {
+ SimpleCollectionValueModel<Junk> collectionHolder = this.buildCollectionHolder();
+ ListValueModel<Junk> listValueModel = new ItemStateListValueModelAdapter<Junk>(new SortedListValueModelAdapter<Junk>(collectionHolder, comparator));
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
assertEquals(6, synchList.size());
this.compareSort(listValueModel, synchList, comparator);
@@ -159,10 +158,10 @@ public class ItemStateListValueModelAdapterTests extends TestCase {
this.compareSort(listValueModel, synchList, comparator);
}
- private void verifyListSort(Comparator comparator) {
- SimpleListValueModel listHolder = this.buildListHolder();
- ListValueModel listValueModel = new ItemStateListValueModelAdapter(new SortedListValueModelAdapter(listHolder, comparator));
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ private void verifyListSort(Comparator<Junk> comparator) {
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
+ ListValueModel<Junk> listValueModel = new ItemStateListValueModelAdapter<Junk>(new SortedListValueModelAdapter<Junk>(listHolder, comparator));
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
assertEquals(6, synchList.size());
this.compareSort(listValueModel, synchList, comparator);
@@ -180,26 +179,26 @@ public class ItemStateListValueModelAdapterTests extends TestCase {
this.compareSort(listValueModel, synchList, comparator);
}
- private void compareSort(ListValueModel listValueModel, List list, Comparator comparator) {
- SortedSet ss = new TreeSet(comparator);
+ private void compareSort(ListValueModel<Junk> listValueModel, List<Junk> list, Comparator<Junk> comparator) {
+ SortedSet<Junk> ss = new TreeSet<Junk>(comparator);
for (int i = 0; i < listValueModel.size(); i++) {
ss.add(listValueModel.get(i));
}
assertEquals(ss.size(), list.size());
- for (Iterator stream1 = ss.iterator(), stream2 = list.iterator(); stream1.hasNext(); ) {
+ for (Iterator<Junk> stream1 = ss.iterator(), stream2 = list.iterator(); stream1.hasNext(); ) {
assertEquals(stream1.next(), stream2.next());
}
}
public void testHasListeners() throws Exception {
- SimpleListValueModel listHolder = this.buildListHolder();
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
assertFalse(this.foo.hasAnyStateChangeListeners());
assertFalse(this.foo.hasAnyStateChangeListeners());
assertFalse(this.jaz.hasAnyStateChangeListeners());
assertFalse(this.jaz.hasAnyStateChangeListeners());
- ListValueModel listValueModel = new ItemStateListValueModelAdapter(new SortedListValueModelAdapter(listHolder));
+ ListValueModel<Junk> listValueModel = new ItemStateListValueModelAdapter<Junk>(new SortedListValueModelAdapter<Junk>(listHolder));
assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
assertFalse(this.foo.hasAnyStateChangeListeners());
assertFalse(this.foo.hasAnyStateChangeListeners());
@@ -207,7 +206,7 @@ public class ItemStateListValueModelAdapterTests extends TestCase {
assertFalse(this.jaz.hasAnyStateChangeListeners());
this.verifyHasNoListeners(listValueModel);
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
assertTrue(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
assertTrue(this.foo.hasAnyStateChangeListeners());
assertTrue(this.foo.hasAnyStateChangeListeners());
@@ -225,18 +224,18 @@ public class ItemStateListValueModelAdapterTests extends TestCase {
}
public void testGetSize() throws Exception {
- SimpleListValueModel listHolder = this.buildListHolder();
- ListValueModel listValueModel = new ItemStateListValueModelAdapter(new SortedListValueModelAdapter(listHolder));
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
+ ListValueModel<Junk> listValueModel = new ItemStateListValueModelAdapter<Junk>(new SortedListValueModelAdapter<Junk>(listHolder));
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
this.verifyHasListeners(listValueModel);
assertEquals(6, listValueModel.size());
assertEquals(6, synchList.size());
}
public void testGet() throws Exception {
- SimpleListValueModel listHolder = this.buildListHolder();
- ListValueModel listValueModel = new SortedListValueModelAdapter(new ItemStateListValueModelAdapter(listHolder));
- SynchronizedList synchList = new SynchronizedList(listValueModel);
+ SimpleListValueModel<Junk> listHolder = this.buildListHolder();
+ ListValueModel<Junk> listValueModel = new SortedListValueModelAdapter<Junk>(new ItemStateListValueModelAdapter<Junk>(listHolder));
+ CoordinatedList<Junk> synchList = new CoordinatedList<Junk>(listValueModel);
this.verifyHasListeners(listValueModel);
assertEquals(this.bar, listValueModel.get(0));
assertEquals(this.bar, synchList.get(0));
@@ -246,35 +245,35 @@ public class ItemStateListValueModelAdapterTests extends TestCase {
this.bar.setName("this.bar");
}
- private void verifyHasNoListeners(ListValueModel listValueModel) throws Exception {
+ private void verifyHasNoListeners(ListValueModel<Junk> listValueModel) throws Exception {
assertTrue(((AbstractModel) listValueModel).hasNoListChangeListeners(ListValueModel.LIST_VALUES));
}
- private void verifyHasListeners(ListValueModel listValueModel) throws Exception {
+ private void verifyHasListeners(ListValueModel<Junk> listValueModel) throws Exception {
assertTrue(((AbstractModel) listValueModel).hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
}
- private SimpleCollectionValueModel buildCollectionHolder() {
- return new SimpleCollectionValueModel(this.buildCollection());
+ private SimpleCollectionValueModel<Junk> buildCollectionHolder() {
+ return new SimpleCollectionValueModel<Junk>(this.buildCollection());
}
- private Collection buildCollection() {
- Bag bag = new HashBag();
+ private Collection<Junk> buildCollection() {
+ Bag<Junk> bag = new HashBag<Junk>();
this.populateCollection(bag);
return bag;
}
- private SimpleListValueModel buildListHolder() {
- return new SimpleListValueModel(this.buildList());
+ private SimpleListValueModel<Junk> buildListHolder() {
+ return new SimpleListValueModel<Junk>(this.buildList());
}
- private List buildList() {
- List list = new ArrayList();
+ private List<Junk> buildList() {
+ List<Junk> list = new ArrayList<Junk>();
this.populateCollection(list);
return list;
}
- private void populateCollection(Collection c) {
+ private void populateCollection(Collection<Junk> c) {
c.add(this.foo);
c.add(this.bar);
c.add(this.baz);
@@ -283,22 +282,23 @@ public class ItemStateListValueModelAdapterTests extends TestCase {
c.add(this.jaz);
}
-private class Junk extends AbstractModel implements Comparable<Junk> {
- private String name;
- public Junk(String name) {
- this.name = name;
- }
- public void setName(String name) {
- this.name = name;
- this.fireStateChanged();
- }
- public int compareTo(Junk j) {
- return this.name.compareTo(j.name);
- }
- @Override
- public String toString() {
- return "Junk(" + this.name + ")";
+ // ********** Junk class **********
+ private class Junk extends AbstractModel implements Comparable<Junk> {
+ private String name;
+ public Junk(String name) {
+ this.name = name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ this.fireStateChanged();
+ }
+ public int compareTo(Junk j) {
+ return this.name.compareTo(j.name);
+ }
+ @Override
+ public String toString() {
+ return "Junk(" + this.name + ")";
+ }
}
-}
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/JptUtilityModelValueTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/JptUtilityModelValueTests.java
index eae9934d9f..bbaa8e5d91 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/JptUtilityModelValueTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/JptUtilityModelValueTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -23,7 +23,7 @@ public class JptUtilityModelValueTests {
suite.addTest(JptUtilityModelValuePrefsTests.suite());
suite.addTest(JptUtilityModelValueSwingTests.suite());
- suite.addTestSuite(BufferedPropertyValueModelTests.class);
+ suite.addTestSuite(BufferedWritablePropertyValueModelTests.class);
suite.addTestSuite(CollectionAspectAdapterTests.class);
suite.addTestSuite(CollectionListValueModelAdapterTests.class);
suite.addTestSuite(CollectionPropertyValueModelAdapterTests.class);
@@ -43,8 +43,8 @@ public class JptUtilityModelValueTests {
suite.addTestSuite(NullPropertyValueModelTests.class);
suite.addTestSuite(PropertyAspectAdapterTests.class);
suite.addTestSuite(PropertyCollectionValueModelAdapterTests.class);
- suite.addTestSuite(ReadOnlyCollectionValueModelTests.class);
- suite.addTestSuite(ReadOnlyListValueModelTests.class);
+ suite.addTestSuite(StaticCollectionValueModelTests.class);
+ suite.addTestSuite(StaticListValueModelTests.class);
suite.addTestSuite(SimpleCollectionValueModelTests.class);
suite.addTestSuite(SimpleListValueModelTests.class);
suite.addTestSuite(SimplePropertyValueModelTests.class);
@@ -54,10 +54,10 @@ public class JptUtilityModelValueTests {
suite.addTestSuite(TransformationListValueModelAdapterTests.TransformerTests.class);
suite.addTestSuite(TransformationPropertyValueModelTests.class);
suite.addTestSuite(TreeAspectAdapterTests.class);
- suite.addTestSuite(ValueCollectionPropertyValueModelAdapterTests.class);
- suite.addTestSuite(ValueListPropertyValueModelAdapterTests.class);
- suite.addTestSuite(ValuePropertyPropertyValueModelAdapterTests.class);
- suite.addTestSuite(ValueStatePropertyValueModelAdapterTests.class);
+ suite.addTestSuite(ValueCollectionAdapterTests.class);
+ suite.addTestSuite(ValueListAdapterTests.class);
+ suite.addTestSuite(ValuePropertyAdapterTests.class);
+ suite.addTestSuite(ValueStateAdapterTests.class);
return suite;
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListAspectAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListAspectAdapterTests.java
index 0486ebf4df..a2741adf44 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListAspectAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListAspectAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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,7 +10,6 @@
package org.eclipse.jpt.utility.tests.internal.model.value;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
@@ -23,14 +22,14 @@ import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class ListAspectAdapterTests extends TestCase {
private TestSubject subject1;
- private PropertyValueModel subjectHolder1;
+ private WritablePropertyValueModel<TestSubject> subjectHolder1;
private LocalListAspectAdapter aa1;
private ListChangeEvent event1;
private ListChangeListener listener1;
@@ -47,7 +46,7 @@ public class ListAspectAdapterTests extends TestCase {
this.subject1 = new TestSubject();
this.subject1.addNames(this.subject1Names());
this.subject1.addDescriptions(this.subject1Descriptions());
- this.subjectHolder1 = new SimplePropertyValueModel(this.subject1);
+ this.subjectHolder1 = new SimplePropertyValueModel<TestSubject>(this.subject1);
this.aa1 = this.buildAspectAdapter(this.subjectHolder1);
this.listener1 = this.buildValueChangeListener1();
this.aa1.addListChangeListener(ListValueModel.LIST_VALUES, this.listener1);
@@ -58,8 +57,8 @@ public class ListAspectAdapterTests extends TestCase {
this.subject2.addDescriptions(this.subject2Descriptions());
}
- private List subject1Names() {
- List result = new ArrayList();
+ private List<String> subject1Names() {
+ List<String> result = new ArrayList<String>();
result.add("foo");
result.add("bar");
result.add("baz");
@@ -67,15 +66,15 @@ public class ListAspectAdapterTests extends TestCase {
return result;
}
- private List subject1Descriptions() {
- List result = new ArrayList();
+ private List<String> subject1Descriptions() {
+ List<String> result = new ArrayList<String>();
result.add("this.subject1 description1");
result.add("this.subject1 description2");
return result;
}
- private List subject2Names() {
- List result = new ArrayList();
+ private List<String> subject2Names() {
+ List<String> result = new ArrayList<String>();
result.add("joo");
result.add("jar");
result.add("jaz");
@@ -83,14 +82,14 @@ public class ListAspectAdapterTests extends TestCase {
return result;
}
- private List subject2Descriptions() {
- List result = new ArrayList();
+ private List<String> subject2Descriptions() {
+ List<String> result = new ArrayList<String>();
result.add("this.subject2 description1");
result.add("this.subject2 description2");
return result;
}
- private LocalListAspectAdapter buildAspectAdapter(ValueModel subjectHolder) {
+ private LocalListAspectAdapter buildAspectAdapter(PropertyValueModel<TestSubject> subjectHolder) {
return new LocalListAspectAdapter(subjectHolder);
}
@@ -168,7 +167,7 @@ public class ListAspectAdapterTests extends TestCase {
assertEquals(ListValueModel.LIST_VALUES, this.event1.listName());
assertEquals(this.subject1Names().size(), this.event1.index());
assertEquals("jam", this.event1.items().next());
- List namesPlus = this.subject1Names();
+ List<String> namesPlus = this.subject1Names();
namesPlus.add("jam");
assertEquals(namesPlus, CollectionTools.list(this.aa1.listIterator()));
@@ -187,7 +186,7 @@ public class ListAspectAdapterTests extends TestCase {
assertEquals(this.subject1Names(), CollectionTools.list(this.aa1.listIterator()));
assertNull(this.event1);
- List items = new ArrayList();
+ List<String> items = new ArrayList<String>();
items.add("joo");
items.add("jar");
items.add("jaz");
@@ -200,7 +199,7 @@ public class ListAspectAdapterTests extends TestCase {
assertEquals(ListValueModel.LIST_VALUES, this.event1.listName());
assertEquals(5, this.event1.index()); // only the last "add" event will still be there
assertEquals("jam", this.event1.items().next());
- List namesPlus = this.subject1Names();
+ List<String> namesPlus = this.subject1Names();
namesPlus.addAll(2, items);
assertEquals(namesPlus, CollectionTools.list(this.aa1.listIterator()));
}
@@ -215,7 +214,7 @@ public class ListAspectAdapterTests extends TestCase {
assertEquals(ListValueModel.LIST_VALUES, this.event1.listName());
assertEquals(0, this.event1.index());
assertEquals(removedName, this.event1.items().next());
- List namesMinus = this.subject1Names();
+ List<String> namesMinus = this.subject1Names();
namesMinus.remove(0);
assertEquals(namesMinus, CollectionTools.list(this.aa1.listIterator()));
@@ -234,7 +233,7 @@ public class ListAspectAdapterTests extends TestCase {
assertEquals(this.subject1Names(), CollectionTools.list(this.aa1.listIterator()));
assertNull(this.event1);
- List items = new ArrayList();
+ List<String> items = new ArrayList<String>();
items.add("bar");
items.add("baz");
@@ -245,7 +244,7 @@ public class ListAspectAdapterTests extends TestCase {
assertEquals(ListValueModel.LIST_VALUES, this.event1.listName());
assertEquals(1, this.event1.index()); // only the last "remove" event will still be there
assertEquals("baz", this.event1.items().next());
- List namesPlus = this.subject1Names();
+ List<String> namesPlus = this.subject1Names();
namesPlus.remove(1);
namesPlus.remove(1);
assertEquals(namesPlus, CollectionTools.list(this.aa1.listIterator()));
@@ -262,7 +261,7 @@ public class ListAspectAdapterTests extends TestCase {
assertEquals(0, this.event1.index());
assertEquals("jelly", this.event1.items().next());
assertEquals(replacedName, this.event1.replacedItems().next());
- List namesChanged = this.subject1Names();
+ List<String> namesChanged = this.subject1Names();
namesChanged.set(0, "jelly");
assertEquals(namesChanged, CollectionTools.list(this.aa1.listIterator()));
@@ -290,7 +289,7 @@ public class ListAspectAdapterTests extends TestCase {
assertEquals(ListValueModel.LIST_VALUES, this.event1.listName());
assertEquals(-1, this.event1.index());
assertFalse(this.event1.items().hasNext());
- List namesPlus2 = this.subject1Names();
+ List<String> namesPlus2 = this.subject1Names();
namesPlus2.add(0, "jaz");
namesPlus2.add(0, "jam");
assertEquals(namesPlus2, CollectionTools.list(this.aa1.listIterator()));
@@ -331,20 +330,20 @@ public class ListAspectAdapterTests extends TestCase {
// ********** inner class **********
private class TestSubject extends AbstractModel {
- private List names;
+ private List<String> names;
public static final String NAMES_LIST = "names";
- private List descriptions;
+ private List<String> descriptions;
public static final String DESCRIPTIONS_LIST = "descriptions";
public TestSubject() {
- this.names = new ArrayList();
- this.descriptions = new ArrayList();
+ this.names = new ArrayList<String>();
+ this.descriptions = new ArrayList<String>();
}
- public ListIterator names() {
- return new ReadOnlyListIterator(this.names);
+ public ListIterator<String> names() {
+ return new ReadOnlyListIterator<String>(this.names);
}
public String getName(int index) {
- return (String) this.names.get(index);
+ return this.names.get(index);
}
public void addName(int index, String name) {
this.names.add(index, name);
@@ -353,12 +352,12 @@ public class ListAspectAdapterTests extends TestCase {
public void addName(String name) {
this.addName(this.names.size(), name);
}
- public void addNames(ListIterator newNames) {
+ public void addNames(ListIterator<String> newNames) {
while (newNames.hasNext()) {
- this.addName((String) newNames.next());
+ this.addName(newNames.next());
}
}
- public void addNames(List newNames) {
+ public void addNames(List<String> newNames) {
this.addNames(newNames.listIterator());
}
public void addTwoNames(String name1, String name2) {
@@ -367,20 +366,20 @@ public class ListAspectAdapterTests extends TestCase {
this.fireListChanged(NAMES_LIST);
}
public String removeName(int index) {
- String removedName = (String) this.names.remove(index);
+ String removedName = this.names.remove(index);
this.fireItemRemoved(NAMES_LIST, index, removedName);
return removedName;
}
public String setName(int index, String name) {
- String replacedName = (String) this.names.set(index, name);
+ String replacedName = this.names.set(index, name);
this.fireItemReplaced(NAMES_LIST, index, name, replacedName);
return replacedName;
}
- public ListIterator descriptions() {
- return new ReadOnlyListIterator(this.descriptions);
+ public ListIterator<String> descriptions() {
+ return new ReadOnlyListIterator<String>(this.descriptions);
}
public String getDescription(int index) {
- return (String) this.descriptions.get(index);
+ return this.descriptions.get(index);
}
public void addDescription(int index, String description) {
this.descriptions.add(index, description);
@@ -389,21 +388,21 @@ public class ListAspectAdapterTests extends TestCase {
public void addDescription(String description) {
this.addDescription(this.descriptions.size(), description);
}
- public void addDescriptions(ListIterator newDescriptions) {
+ public void addDescriptions(ListIterator<String> newDescriptions) {
while (newDescriptions.hasNext()) {
- this.addDescription((String) newDescriptions.next());
+ this.addDescription(newDescriptions.next());
}
}
- public void addDescriptions(List newDescriptions) {
+ public void addDescriptions(List<String> newDescriptions) {
this.addDescriptions(newDescriptions.listIterator());
}
public String removeDescription(int index) {
- String removedDescription = (String) this.descriptions.remove(index);
+ String removedDescription = this.descriptions.remove(index);
this.fireItemRemoved(DESCRIPTIONS_LIST, index, removedDescription);
return removedDescription;
}
public String setDescription(int index, String description) {
- String replacedDescription = (String) this.descriptions.set(index, description);
+ String replacedDescription = this.descriptions.set(index, description);
this.fireItemReplaced(DESCRIPTIONS_LIST, index, description, replacedDescription);
return replacedDescription;
}
@@ -411,51 +410,51 @@ public class ListAspectAdapterTests extends TestCase {
// this is not a typical aspect adapter - the value is determined by the aspect name
- private class LocalListAspectAdapter extends ListAspectAdapter {
+ private class LocalListAspectAdapter extends ListAspectAdapter<TestSubject, String> {
- LocalListAspectAdapter(ValueModel subjectHolder) {
+ LocalListAspectAdapter(PropertyValueModel<TestSubject> subjectHolder) {
super(subjectHolder, TestSubject.NAMES_LIST);
}
@Override
- protected ListIterator listIterator_() {
- if (this.listName == TestSubject.NAMES_LIST) {
- return ((TestSubject) this.subject).names();
- } else if (this.listName == TestSubject.DESCRIPTIONS_LIST) {
- return ((TestSubject) this.subject).descriptions();
+ protected ListIterator<String> listIterator_() {
+ if (this.listNames[0] == TestSubject.NAMES_LIST) {
+ return this.subject.names();
+ } else if (this.listNames[0] == TestSubject.DESCRIPTIONS_LIST) {
+ return this.subject.descriptions();
} else {
- throw new IllegalStateException("invalid aspect name: " + this.listName);
+ throw new IllegalStateException("invalid aspect name: " + this.listNames[0]);
}
}
public void add(int index, Object item) {
- if (this.listName == TestSubject.NAMES_LIST) {
- ((TestSubject) this.subject).addName(index, (String) item);
- } else if (this.listName == TestSubject.DESCRIPTIONS_LIST) {
- ((TestSubject) this.subject).addDescription(index, (String) item);
+ if (this.listNames[0] == TestSubject.NAMES_LIST) {
+ this.subject.addName(index, (String) item);
+ } else if (this.listNames[0] == TestSubject.DESCRIPTIONS_LIST) {
+ this.subject.addDescription(index, (String) item);
} else {
- throw new IllegalStateException("invalid aspect name: " + this.listName);
+ throw new IllegalStateException("invalid aspect name: " + this.listNames[0]);
}
}
- public void addAll(int index, List items) {
+ public void addAll(int index, List<String> items) {
for (int i = 0; i < items.size(); i++) {
this.add(index + i, items.get(i));
}
}
- public Object remove(int index) {
- if (this.listName == TestSubject.NAMES_LIST) {
- return ((TestSubject) this.subject).removeName(index);
- } else if (this.listName == TestSubject.DESCRIPTIONS_LIST) {
- return ((TestSubject) this.subject).removeDescription(index);
+ public String remove(int index) {
+ if (this.listNames[0] == TestSubject.NAMES_LIST) {
+ return this.subject.removeName(index);
+ } else if (this.listNames[0] == TestSubject.DESCRIPTIONS_LIST) {
+ return this.subject.removeDescription(index);
} else {
- throw new IllegalStateException("invalid aspect name: " + this.listName);
+ throw new IllegalStateException("invalid aspect name: " + this.listNames[0]);
}
}
- public List remove(int index, int length) {
- List removedItems = new ArrayList(length);
+ public List<String> remove(int index, int length) {
+ List<String> removedItems = new ArrayList<String>(length);
for (int i = 0; i < length; i++) {
removedItems.add(this.remove(index));
}
@@ -463,12 +462,12 @@ public class ListAspectAdapterTests extends TestCase {
}
public Object replace(int index, Object item) {
- if (this.listName == TestSubject.NAMES_LIST) {
- return ((TestSubject) this.subject).setName(index, (String) item);
- } else if (this.listName == TestSubject.DESCRIPTIONS_LIST) {
- return ((TestSubject) this.subject).setDescription(index, (String) item);
+ if (this.listNames[0] == TestSubject.NAMES_LIST) {
+ return this.subject.setName(index, (String) item);
+ } else if (this.listNames[0] == TestSubject.DESCRIPTIONS_LIST) {
+ return this.subject.setDescription(index, (String) item);
} else {
- throw new IllegalStateException("invalid aspect name: " + this.listName);
+ throw new IllegalStateException("invalid aspect name: " + this.listNames[0]);
}
}
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListCollectionValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListCollectionValueModelAdapterTests.java
index 03d54cf9a5..338adf3d76 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListCollectionValueModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListCollectionValueModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -11,10 +11,10 @@ package org.eclipse.jpt.utility.tests.internal.model.value;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
+
import javax.swing.JList;
-import junit.framework.TestCase;
+
import org.eclipse.jpt.utility.internal.Bag;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.HashBag;
@@ -23,15 +23,16 @@ import org.eclipse.jpt.utility.internal.model.event.CollectionChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener;
import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.ListCollectionValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimpleListValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.ListModelAdapter;
import org.eclipse.jpt.utility.tests.internal.TestTools;
+import junit.framework.TestCase;
+
public class ListCollectionValueModelAdapterTests extends TestCase {
- CollectionValueModel adapter;
- private SimpleListValueModel wrappedListHolder;
- private List wrappedList;
+ CollectionValueModel<String> adapter;
+ private SimpleListValueModel<String> wrappedListHolder;
+ private List<String> wrappedList;
public ListCollectionValueModelAdapterTests(String name) {
super(name);
@@ -40,12 +41,12 @@ public class ListCollectionValueModelAdapterTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.wrappedList = new ArrayList();
- this.wrappedListHolder = new SimpleListValueModel(this.wrappedList);
- this.adapter = new ListCollectionValueModelAdapter(this.wrappedListHolder);
+ this.wrappedList = new ArrayList<String>();
+ this.wrappedListHolder = new SimpleListValueModel<String>(this.wrappedList);
+ this.adapter = new ListCollectionValueModelAdapter<String>(this.wrappedListHolder);
}
- private Collection wrappedCollection() {
+ private Collection<String> wrappedCollection() {
return CollectionTools.collection(this.wrappedList.iterator());
}
@@ -57,6 +58,7 @@ public class ListCollectionValueModelAdapterTests extends TestCase {
public void testIterator() {
this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() {
+ @Override
public void itemsAdded(CollectionChangeEvent e) {
// override failure
}
@@ -64,37 +66,38 @@ public class ListCollectionValueModelAdapterTests extends TestCase {
this.wrappedListHolder.add(0, "foo");
this.wrappedListHolder.add(1, "bar");
this.wrappedListHolder.add(2, "baz");
- Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.iterator());
+ Collection<String> adapterCollection = CollectionTools.collection(this.adapter.iterator());
assertEquals(3, adapterCollection.size());
assertEquals(this.wrappedCollection(), adapterCollection);
}
public void testStaleValues() {
CollectionChangeListener listener = new TestListener() {
+ @Override
public void itemsAdded(CollectionChangeEvent e) {/* OK */}
};
this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, listener);
this.wrappedListHolder.add(0, "foo");
this.wrappedListHolder.add(1, "bar");
this.wrappedListHolder.add(2, "baz");
- Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.iterator());
+ Collection<String> adapterCollection = CollectionTools.collection(this.adapter.iterator());
assertEquals(3, adapterCollection.size());
assertEquals(this.wrappedCollection(), adapterCollection);
this.adapter.removeCollectionChangeListener(CollectionValueModel.VALUES, listener);
- adapterCollection = CollectionTools.collection((Iterator) this.adapter.iterator());
+ adapterCollection = CollectionTools.collection(this.adapter.iterator());
assertEquals(0, adapterCollection.size());
- assertEquals(new HashBag(), adapterCollection);
+ assertEquals(new HashBag<String>(), adapterCollection);
this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, listener);
- adapterCollection = CollectionTools.collection((Iterator) this.adapter.iterator());
+ adapterCollection = CollectionTools.collection(this.adapter.iterator());
assertEquals(3, adapterCollection.size());
assertEquals(this.wrappedCollection(), adapterCollection);
}
public void testAdd() {
- Bag synchCollection = new SynchronizedBag(this.adapter);
- List synchList = new SynchronizedList(this.wrappedListHolder);
+ Bag<String> synchCollection = new CoordinatedBag<String>(this.adapter);
+ List<String> synchList = new CoordinatedList<String>(this.wrappedListHolder);
this.wrappedListHolder.add(0, "foo");
assertTrue(this.wrappedList.contains("foo"));
this.wrappedListHolder.add(1, "bar");
@@ -104,15 +107,15 @@ public class ListCollectionValueModelAdapterTests extends TestCase {
this.wrappedListHolder.add(5, "jaz");
assertEquals(6, this.wrappedList.size());
- Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.iterator());
+ Collection<String> adapterCollection = CollectionTools.collection(this.adapter.iterator());
assertEquals(this.wrappedCollection(), adapterCollection);
assertEquals(this.wrappedCollection(), CollectionTools.collection(synchList.iterator()));
assertEquals(this.wrappedCollection(), synchCollection);
}
public void testRemove() {
- Bag synchCollection = new SynchronizedBag(this.adapter);
- List synchList = new SynchronizedList(this.wrappedListHolder);
+ Bag<String> synchCollection = new CoordinatedBag<String>(this.adapter);
+ List<String> synchList = new CoordinatedList<String>(this.wrappedListHolder);
this.wrappedListHolder.add(0, "foo");
this.wrappedListHolder.add(1, "bar");
this.wrappedListHolder.add(2, "baz");
@@ -125,7 +128,7 @@ public class ListCollectionValueModelAdapterTests extends TestCase {
assertFalse(this.wrappedList.contains("foo"));
assertEquals(4, this.wrappedList.size());
- Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.iterator());
+ Collection<String> adapterCollection = CollectionTools.collection(this.adapter.iterator());
assertEquals(this.wrappedCollection(), adapterCollection);
assertEquals(this.wrappedCollection(), CollectionTools.collection(synchList.iterator()));
assertEquals(this.wrappedCollection(), synchCollection);
@@ -133,9 +136,11 @@ public class ListCollectionValueModelAdapterTests extends TestCase {
public void testListSynch() {
this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() {
+ @Override
public void itemsAdded(CollectionChangeEvent e) {
// override failure
}
+ @Override
public void itemsRemoved(CollectionChangeEvent e) {
// override failure
}
@@ -152,15 +157,17 @@ public class ListCollectionValueModelAdapterTests extends TestCase {
assertFalse(this.wrappedList.contains("foo"));
assertEquals(4, this.wrappedList.size());
- Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.iterator());
+ Collection<String> adapterCollection = CollectionTools.collection(this.adapter.iterator());
assertEquals(this.wrappedCollection(), adapterCollection);
}
public void testReplace() {
this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() {
+ @Override
public void itemsAdded(CollectionChangeEvent e) {
// override failure
}
+ @Override
public void itemsRemoved(CollectionChangeEvent e) {
// override failure
}
@@ -168,28 +175,30 @@ public class ListCollectionValueModelAdapterTests extends TestCase {
this.wrappedListHolder.add(0, "foo");
this.wrappedListHolder.add(1, "bar");
this.wrappedListHolder.add(2, "baz");
- Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.iterator());
+ Collection<String> adapterCollection = CollectionTools.collection(this.adapter.iterator());
assertEquals(3, adapterCollection.size());
this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() {
+ @Override
public void itemsRemoved(CollectionChangeEvent e) {
assertEquals("foo", e.items().next());
- assertFalse(CollectionTools.contains((Iterator) ListCollectionValueModelAdapterTests.this.adapter.iterator(), "joo"));
+ assertFalse(CollectionTools.contains(ListCollectionValueModelAdapterTests.this.adapter.iterator(), "joo"));
assertEquals(2, ListCollectionValueModelAdapterTests.this.adapter.size());
}
+ @Override
public void itemsAdded(CollectionChangeEvent e) {
assertEquals("joo", e.items().next());
assertEquals(3, ListCollectionValueModelAdapterTests.this.adapter.size());
}
});
this.wrappedListHolder.set(0, "joo");
- adapterCollection = CollectionTools.collection((Iterator) this.adapter.iterator());
+ adapterCollection = CollectionTools.collection(this.adapter.iterator());
assertEquals(3, adapterCollection.size());
assertEquals(this.wrappedCollection(), adapterCollection);
}
public void testHasListeners() {
assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES));
- SynchronizedBag synchCollection = new SynchronizedBag(this.adapter);
+ CoordinatedBag<String> synchCollection = new CoordinatedBag<String>(this.adapter);
assertTrue(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES));
this.adapter.removeCollectionChangeListener(CollectionValueModel.VALUES, synchCollection);
assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES));
@@ -201,47 +210,53 @@ public class ListCollectionValueModelAdapterTests extends TestCase {
public void testListChangedToEmpty() {
this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() {
+ @Override
public void itemsAdded(CollectionChangeEvent e) {/* OK */}
+ @Override
public void itemsRemoved(CollectionChangeEvent e) {/* OK */}
});
this.wrappedListHolder.add(0, "foo");
this.wrappedListHolder.add(1, "bar");
this.wrappedListHolder.add(2, "baz");
JList jList = new JList(new ListModelAdapter(this.adapter));
- ((SimpleListValueModel) this.wrappedListHolder).setList(new ArrayList());
+ this.wrappedListHolder.setList(new ArrayList<String>());
assertEquals(0, jList.getModel().getSize());
}
public void testCollectionChangedFromEmpty() {
this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() {
+ @Override
public void itemsAdded(CollectionChangeEvent e) {/* OK */}
+ @Override
public void itemsRemoved(CollectionChangeEvent e) {/* OK */}
});
JList jList = new JList(new ListModelAdapter(this.adapter));
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
list.add("foo");
list.add("bar");
- ((SimpleListValueModel) this.wrappedListHolder).setList(list);
+ this.wrappedListHolder.setList(list);
assertEquals(2, jList.getModel().getSize());
}
public void testCollectionChangedFromEmptyToEmpty() {
this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() {
+ @Override
public void itemsAdded(CollectionChangeEvent e) {/* OK */}
+ @Override
public void itemsRemoved(CollectionChangeEvent e) {/* OK */}
});
JList jList = new JList(new ListModelAdapter(this.adapter));
- ArrayList list = new ArrayList();
- ((SimpleListValueModel) this.wrappedListHolder).setList(list);
+ ArrayList<String> list = new ArrayList<String>();
+ this.wrappedListHolder.setList(list);
assertEquals(0, jList.getModel().getSize());
}
// ********** inner class **********
- private class TestListener implements CollectionChangeListener {
+ class TestListener implements CollectionChangeListener {
public void itemsAdded(CollectionChangeEvent e) {
fail("unexpected event");
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListCuratorTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListCuratorTests.java
index 184a449d7e..97cc528a11 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListCuratorTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListCuratorTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -21,9 +21,9 @@ import org.eclipse.jpt.utility.internal.model.event.ListChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.ListChangeListener;
import org.eclipse.jpt.utility.internal.model.value.ListCurator;
import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
@@ -32,9 +32,9 @@ public final class ListCuratorTests
extends TestCase
{
private TestSubject subject1;
- private PropertyValueModel subjectHolder1;
+ private WritablePropertyValueModel<TestSubject> subjectHolder1;
- private ListCurator curator;
+ private ListCurator<TestSubject, String> curator;
private ListChangeListener listener1;
private ListChangeEvent event1;
@@ -48,7 +48,7 @@ public final class ListCuratorTests
protected void setUp() throws Exception {
super.setUp();
this.subject1 = new TestSubject(this.subject1Names());
- this.subjectHolder1 = new SimplePropertyValueModel(this.subject1);
+ this.subjectHolder1 = new SimplePropertyValueModel<TestSubject>(this.subject1);
this.curator = this.buildListCurator(this.subjectHolder1);
this.listener1 = this.buildListChangeListener1();
this.curator.addListChangeListener(ListValueModel.LIST_VALUES, this.listener1);
@@ -57,8 +57,8 @@ public final class ListCuratorTests
this.subject2 = new TestSubject(this.subject2Names());
}
- private List subject1Names() {
- ArrayList list = new ArrayList();
+ private List<String> subject1Names() {
+ ArrayList<String> list = new ArrayList<String>();
list.add("alpha");
list.add("bravo");
list.add("charlie");
@@ -66,8 +66,8 @@ public final class ListCuratorTests
return list;
}
- private List subject2Names() {
- ArrayList list = new ArrayList();
+ private List<String> subject2Names() {
+ ArrayList<String> list = new ArrayList<String>();
list.add("echo");
list.add("foxtrot");
list.add("glove");
@@ -75,10 +75,11 @@ public final class ListCuratorTests
return list;
}
- private ListCurator buildListCurator(ValueModel subjectHolder) {
- return new ListCurator(subjectHolder) {
- public Iterator iteratorForRecord() {
- return ((TestSubject) this.subject).strings();
+ private ListCurator<TestSubject, String> buildListCurator(PropertyValueModel<TestSubject> subjectHolder) {
+ return new ListCurator<TestSubject, String>(subjectHolder) {
+ @Override
+ public Iterator<String> iteratorForRecord() {
+ return this.subject.strings();
}
};
}
@@ -157,7 +158,7 @@ public final class ListCuratorTests
assertEquals(ListValueModel.LIST_VALUES, this.event1.listName());
assertEquals(this.subject1Names().size(), this.event1.index());
assertEquals("echo", this.event1.items().next());
- List stringsPlus = this.subject1Names();
+ List<String> stringsPlus = this.subject1Names();
stringsPlus.add("echo");
assertEquals(stringsPlus, CollectionTools.list(this.curator.listIterator()));
@@ -182,7 +183,7 @@ public final class ListCuratorTests
assertEquals(ListValueModel.LIST_VALUES, this.event1.listName());
assertEquals(0, this.event1.index());
assertEquals(removedString, this.event1.items().next());
- List stringsMinus = this.subject1Names();
+ List<String> stringsMinus = this.subject1Names();
stringsMinus.remove(0);
assertEquals(stringsMinus, CollectionTools.list(this.curator.listIterator()));
@@ -204,21 +205,21 @@ public final class ListCuratorTests
assertNotNull(this.event1);
assertEquals(this.curator, this.event1.getSource());
assertEquals(ListValueModel.LIST_VALUES, this.event1.listName());
- List newStrings = this.subject2Names();
+ List<String> newStrings = this.subject2Names();
assertEquals(newStrings, CollectionTools.list(this.curator.listIterator()));
}
public void testPartialListChange() {
- List startingList = CollectionTools.list(this.curator.listIterator());
+ List<String> startingList = CollectionTools.list(this.curator.listIterator());
assertEquals(this.subject1Names(), startingList);
assertNull(this.event1);
- String identicalString = (String) startingList.get(1); // should be "bravo"
- String nonidenticalString = (String) startingList.get(0); // should be "alpha"
- List newStrings = CollectionTools.list(new String[] {new String("bravo"), new String("alpha"), "echo", "delta", "foxtrot"});
+ String identicalString = startingList.get(1); // should be "bravo"
+ String nonidenticalString = startingList.get(0); // should be "alpha"
+ List<String> newStrings = CollectionTools.list(new String[] {new String("bravo"), new String("alpha"), "echo", "delta", "foxtrot"});
this.subject1.setStrings(newStrings);
- List finalList = CollectionTools.list(this.curator.listIterator());
+ List<String> finalList = CollectionTools.list(this.curator.listIterator());
assertNotNull(this.event1);
assertEquals(this.curator, this.event1.getSource());
assertEquals(ListValueModel.LIST_VALUES, this.event1.listName());
@@ -262,26 +263,24 @@ public final class ListCuratorTests
// **************** Inner Class *******************************************
- private class TestSubject
- extends AbstractModel
- {
- private List strings;
+ class TestSubject extends AbstractModel {
+ private List<String> strings;
public TestSubject() {
- this.strings = new ArrayList();
+ this.strings = new ArrayList<String>();
}
- public TestSubject(List strings) {
+ public TestSubject(List<String> strings) {
this();
this.setStrings(strings);
}
public String getString(int index) {
- return (String) this.strings.get(index);
+ return this.strings.get(index);
}
- public ListIterator strings() {
- return new ReadOnlyListIterator(this.strings);
+ public ListIterator<String> strings() {
+ return new ReadOnlyListIterator<String>(this.strings);
}
public void addString(int index, String string) {
@@ -294,7 +293,7 @@ public final class ListCuratorTests
}
public String removeString(int index) {
- String string = (String) this.strings.get(index);
+ String string = this.strings.get(index);
this.removeString(string);
return string;
}
@@ -304,8 +303,8 @@ public final class ListCuratorTests
this.fireStateChanged();
}
- public void setStrings(List strings) {
- this.strings = new ArrayList(strings);
+ public void setStrings(List<String> strings) {
+ this.strings = new ArrayList<String>(strings);
this.fireStateChanged();
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullCollectionValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullCollectionValueModelTests.java
index 7113451e42..4e69a71c8c 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullCollectionValueModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullCollectionValueModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -16,7 +16,7 @@ import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class NullCollectionValueModelTests extends TestCase {
- private CollectionValueModel collectionHolder;
+ private CollectionValueModel<Object> collectionHolder;
public NullCollectionValueModelTests(String name) {
super(name);
@@ -25,7 +25,7 @@ public class NullCollectionValueModelTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.collectionHolder = NullCollectionValueModel.instance();
+ this.collectionHolder = new NullCollectionValueModel<Object>();
}
@Override
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullListValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullListValueModelTests.java
index 94ae069293..1bf206c6ee 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullListValueModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullListValueModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,10 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.utility.tests.internal.model.value;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-
import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
import org.eclipse.jpt.utility.internal.model.value.NullListValueModel;
import org.eclipse.jpt.utility.tests.internal.TestTools;
@@ -20,7 +16,7 @@ import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class NullListValueModelTests extends TestCase {
- private ListValueModel listHolder;
+ private ListValueModel<Object> listHolder;
public NullListValueModelTests(String name) {
super(name);
@@ -29,7 +25,7 @@ public class NullListValueModelTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.listHolder = NullListValueModel.instance();
+ this.listHolder = new NullListValueModel<Object>();
}
@Override
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullPropertyValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullPropertyValueModelTests.java
index 00a03bc2d0..4968dbccfd 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullPropertyValueModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullPropertyValueModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -16,7 +16,7 @@ import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class NullPropertyValueModelTests extends TestCase {
- private PropertyValueModel valueHolder;
+ private PropertyValueModel<Object> valueHolder;
public NullPropertyValueModelTests(String name) {
super(name);
@@ -25,7 +25,7 @@ public class NullPropertyValueModelTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.valueHolder = NullPropertyValueModel.instance();
+ this.valueHolder = new NullPropertyValueModel<Object>();
}
@Override
@@ -34,16 +34,6 @@ public class NullPropertyValueModelTests extends TestCase {
super.tearDown();
}
- public void testSetValue() {
- boolean exCaught = false;
- try {
- this.valueHolder.setValue("foo");
- } catch (UnsupportedOperationException ex) {
- exCaught = true;
- }
- assertTrue(exCaught);
- }
-
public void testValue() {
assertNull(this.valueHolder.value());
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/PropertyAspectAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/PropertyAspectAdapterTests.java
index 8d574a033c..536ba7a45a 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/PropertyAspectAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/PropertyAspectAdapterTests.java
@@ -13,17 +13,17 @@ import org.eclipse.jpt.utility.internal.model.AbstractModel;
import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class PropertyAspectAdapterTests extends TestCase {
private TestSubject subject1;
- private PropertyValueModel subjectHolder1;
- private PropertyAspectAdapter aa1;
+ private WritablePropertyValueModel<TestSubject> subjectHolder1;
+ private PropertyAspectAdapter<TestSubject, String> aa1;
private PropertyChangeEvent event1;
private PropertyChangeListener listener1;
@@ -42,34 +42,34 @@ public class PropertyAspectAdapterTests extends TestCase {
protected void setUp() throws Exception {
super.setUp();
this.subject1 = new TestSubject("foo", "test subject 1");
- this.subjectHolder1 = new SimplePropertyValueModel(this.subject1);
+ this.subjectHolder1 = new SimplePropertyValueModel<TestSubject> (this.subject1);
this.aa1 = this.buildAspectAdapter(this.subjectHolder1);
this.listener1 = this.buildValueChangeListener1();
- this.aa1.addPropertyChangeListener(ValueModel.VALUE, this.listener1);
+ this.aa1.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener1);
this.event1 = null;
this.subject2 = new TestSubject("bar", "test subject 2");
}
- private PropertyAspectAdapter buildAspectAdapter(ValueModel subjectHolder) {
- return new PropertyAspectAdapter(subjectHolder, TestSubject.NAME_PROPERTY) {
+ private PropertyAspectAdapter<TestSubject, String> buildAspectAdapter(PropertyValueModel<TestSubject> subjectHolder) {
+ return new PropertyAspectAdapter<TestSubject, String>(subjectHolder, TestSubject.NAME_PROPERTY) {
// this is not a aspect adapter - the value is determined by the aspect name
@Override
- protected Object buildValue_() {
+ protected String buildValue_() {
if (this.propertyNames[0] == TestSubject.NAME_PROPERTY) {
- return ((TestSubject) this.subject).getName();
+ return this.subject.getName();
} else if (this.propertyNames[0] == TestSubject.DESCRIPTION_PROPERTY) {
- return ((TestSubject) this.subject).getDescription();
+ return this.subject.getDescription();
} else {
throw new IllegalStateException("invalid aspect name: " + this.propertyNames[0]);
}
}
@Override
- protected void setValue_(Object value) {
+ protected void setValue_(String value) {
if (this.propertyNames[0] == TestSubject.NAME_PROPERTY) {
- ((TestSubject) this.subject).setName((String) value);
+ this.subject.setName(value);
} else if (this.propertyNames[0] == TestSubject.DESCRIPTION_PROPERTY) {
- ((TestSubject) this.subject).setDescription((String) value);
+ this.subject.setDescription(value);
} else {
throw new IllegalStateException("invalid aspect name: " + this.propertyNames[0]);
}
@@ -102,7 +102,7 @@ public class PropertyAspectAdapterTests extends TestCase {
this.subjectHolder1.setValue(this.subject2);
assertNotNull(this.event1);
assertEquals(this.aa1, this.event1.getSource());
- assertEquals(ValueModel.VALUE, this.event1.propertyName());
+ assertEquals(PropertyValueModel.VALUE, this.event1.propertyName());
assertEquals("foo", this.event1.oldValue());
assertEquals("bar", this.event1.newValue());
assertEquals("bar", this.aa1.value());
@@ -111,7 +111,7 @@ public class PropertyAspectAdapterTests extends TestCase {
this.subjectHolder1.setValue(null);
assertNotNull(this.event1);
assertEquals(this.aa1, this.event1.getSource());
- assertEquals(ValueModel.VALUE, this.event1.propertyName());
+ assertEquals(PropertyValueModel.VALUE, this.event1.propertyName());
assertEquals("bar", this.event1.oldValue());
assertNull(this.event1.newValue());
assertNull(this.aa1.value());
@@ -120,7 +120,7 @@ public class PropertyAspectAdapterTests extends TestCase {
this.subjectHolder1.setValue(this.subject1);
assertNotNull(this.event1);
assertEquals(this.aa1, this.event1.getSource());
- assertEquals(ValueModel.VALUE, this.event1.propertyName());
+ assertEquals(PropertyValueModel.VALUE, this.event1.propertyName());
assertEquals(null, this.event1.oldValue());
assertEquals("foo", this.event1.newValue());
assertEquals("foo", this.aa1.value());
@@ -133,7 +133,7 @@ public class PropertyAspectAdapterTests extends TestCase {
this.subject1.setName("baz");
assertNotNull(this.event1);
assertEquals(this.aa1, this.event1.getSource());
- assertEquals(ValueModel.VALUE, this.event1.propertyName());
+ assertEquals(PropertyValueModel.VALUE, this.event1.propertyName());
assertEquals("foo", this.event1.oldValue());
assertEquals("baz", this.event1.newValue());
assertEquals("baz", this.aa1.value());
@@ -142,7 +142,7 @@ public class PropertyAspectAdapterTests extends TestCase {
this.subject1.setName(null);
assertNotNull(this.event1);
assertEquals(this.aa1, this.event1.getSource());
- assertEquals(ValueModel.VALUE, this.event1.propertyName());
+ assertEquals(PropertyValueModel.VALUE, this.event1.propertyName());
assertEquals("baz", this.event1.oldValue());
assertEquals(null, this.event1.newValue());
assertEquals(null, this.aa1.value());
@@ -151,7 +151,7 @@ public class PropertyAspectAdapterTests extends TestCase {
this.subject1.setName("foo");
assertNotNull(this.event1);
assertEquals(this.aa1, this.event1.getSource());
- assertEquals(ValueModel.VALUE, this.event1.propertyName());
+ assertEquals(PropertyValueModel.VALUE, this.event1.propertyName());
assertEquals(null, this.event1.oldValue());
assertEquals("foo", this.event1.newValue());
assertEquals("foo", this.aa1.value());
@@ -166,17 +166,17 @@ public class PropertyAspectAdapterTests extends TestCase {
assertEquals("foo", this.subject1.getName());
assertEquals("foo", this.aa1.value());
- this.aa1.removePropertyChangeListener(ValueModel.VALUE, this.listener1);
+ this.aa1.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener1);
assertEquals(null, this.aa1.value());
- this.aa1.addPropertyChangeListener(ValueModel.VALUE, this.listener1);
+ this.aa1.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener1);
assertEquals("foo", this.aa1.value());
- this.aa1.removePropertyChangeListener(ValueModel.VALUE, this.listener1);
+ this.aa1.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener1);
this.subjectHolder1.setValue(this.subject2);
assertEquals(null, this.aa1.value());
- this.aa1.addPropertyChangeListener(ValueModel.VALUE, this.listener1);
+ this.aa1.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener1);
assertEquals("bar", this.aa1.value());
}
@@ -187,27 +187,27 @@ public class PropertyAspectAdapterTests extends TestCase {
}
public void testHasListeners() {
- assertTrue(this.aa1.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(this.aa1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
assertTrue(this.subject1.hasAnyPropertyChangeListeners(TestSubject.NAME_PROPERTY));
- this.aa1.removePropertyChangeListener(ValueModel.VALUE, this.listener1);
+ this.aa1.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener1);
assertFalse(this.subject1.hasAnyPropertyChangeListeners(TestSubject.NAME_PROPERTY));
- assertFalse(this.aa1.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertFalse(this.aa1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
PropertyChangeListener listener2 = this.buildValueChangeListener1();
this.aa1.addPropertyChangeListener(listener2);
- assertTrue(this.aa1.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(this.aa1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
assertTrue(this.subject1.hasAnyPropertyChangeListeners(TestSubject.NAME_PROPERTY));
this.aa1.removePropertyChangeListener(listener2);
assertFalse(this.subject1.hasAnyPropertyChangeListeners(TestSubject.NAME_PROPERTY));
- assertFalse(this.aa1.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertFalse(this.aa1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
}
public void testMultipleAspectAdapter() {
TestSubject testSubject = new TestSubject("fred", "husband");
- PropertyValueModel testSubjectHolder = new SimplePropertyValueModel(testSubject);
- PropertyValueModel testAA = this.buildMultipleAspectAdapter(testSubjectHolder);
+ WritablePropertyValueModel<TestSubject> testSubjectHolder = new SimplePropertyValueModel<TestSubject>(testSubject);
+ WritablePropertyValueModel<String> testAA = this.buildMultipleAspectAdapter(testSubjectHolder);
PropertyChangeListener testListener = this.buildMultipleValueChangeListener();
- testAA.addPropertyChangeListener(ValueModel.VALUE, testListener);
+ testAA.addPropertyChangeListener(PropertyValueModel.VALUE, testListener);
assertEquals("fred:husband", testAA.value());
this.multipleValueEvent = null;
@@ -223,12 +223,11 @@ public class PropertyAspectAdapterTests extends TestCase {
assertEquals("wilma:wife", this.multipleValueEvent.newValue());
}
- private PropertyValueModel buildMultipleAspectAdapter(ValueModel subjectHolder) {
- return new PropertyAspectAdapter(subjectHolder, TestSubject.NAME_PROPERTY, TestSubject.DESCRIPTION_PROPERTY) {
+ private WritablePropertyValueModel<String> buildMultipleAspectAdapter(PropertyValueModel<TestSubject> subjectHolder) {
+ return new PropertyAspectAdapter<TestSubject, String>(subjectHolder, TestSubject.NAME_PROPERTY, TestSubject.DESCRIPTION_PROPERTY) {
@Override
- protected Object buildValue_() {
- TestSubject ts = (TestSubject) this.subject;
- return ts.getName() + ":" + ts.getDescription();
+ protected String buildValue_() {
+ return this.subject.getName() + ":" + this.subject.getDescription();
}
};
}
@@ -253,10 +252,10 @@ public class PropertyAspectAdapterTests extends TestCase {
*/
public void testCustomBuildValueWithNullSubject() {
TestSubject customSubject = new TestSubject("fred", "laborer");
- PropertyValueModel customSubjectHolder = new SimplePropertyValueModel(customSubject);
- PropertyValueModel customAA = this.buildCustomAspectAdapter(customSubjectHolder);
+ WritablePropertyValueModel<TestSubject> customSubjectHolder = new SimplePropertyValueModel<TestSubject>(customSubject);
+ WritablePropertyValueModel<String> customAA = this.buildCustomAspectAdapter(customSubjectHolder);
PropertyChangeListener customListener = this.buildCustomValueChangeListener();
- customAA.addPropertyChangeListener(ValueModel.VALUE, customListener);
+ customAA.addPropertyChangeListener(PropertyValueModel.VALUE, customListener);
assertEquals("fred", customAA.value());
this.customValueEvent = null;
@@ -273,12 +272,11 @@ public class PropertyAspectAdapterTests extends TestCase {
assertEquals("<unnamed>", this.customValueEvent.newValue());
}
- private PropertyValueModel buildCustomAspectAdapter(ValueModel subjectHolder) {
- return new PropertyAspectAdapter(subjectHolder, TestSubject.NAME_PROPERTY) {
+ private WritablePropertyValueModel<String> buildCustomAspectAdapter(PropertyValueModel<TestSubject> subjectHolder) {
+ return new PropertyAspectAdapter<TestSubject, String>(subjectHolder, TestSubject.NAME_PROPERTY) {
@Override
- protected Object buildValue() {
- TestSubject ts = (TestSubject) this.subject;
- return (ts == null) ? "<unnamed>" : ts.getName();
+ protected String buildValue() {
+ return (this.subject == null) ? "<unnamed>" : this.subject.getName();
}
};
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/PropertyCollectionValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/PropertyCollectionValueModelAdapterTests.java
index dc837b5d67..254a8b7708 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/PropertyCollectionValueModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/PropertyCollectionValueModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.utility.tests.internal.model.value;
import java.util.Collection;
-import java.util.Iterator;
+
import javax.swing.JList;
-import junit.framework.TestCase;
+
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.HashBag;
import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator;
@@ -21,14 +21,16 @@ import org.eclipse.jpt.utility.internal.model.event.CollectionChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener;
import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyCollectionValueModelAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.ListModelAdapter;
import org.eclipse.jpt.utility.tests.internal.TestTools;
+import junit.framework.TestCase;
+
public class PropertyCollectionValueModelAdapterTests extends TestCase {
- private CollectionValueModel adapter;
- private PropertyValueModel wrappedValueHolder;
+ private CollectionValueModel<String> adapter;
+ private WritablePropertyValueModel<String> wrappedValueHolder;
public PropertyCollectionValueModelAdapterTests(String name) {
super(name);
@@ -37,12 +39,12 @@ public class PropertyCollectionValueModelAdapterTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.wrappedValueHolder = new SimplePropertyValueModel();
- this.adapter = new PropertyCollectionValueModelAdapter(this.wrappedValueHolder);
+ this.wrappedValueHolder = new SimplePropertyValueModel<String>();
+ this.adapter = new PropertyCollectionValueModelAdapter<String>(this.wrappedValueHolder);
}
- private Collection wrappedCollection() {
- return CollectionTools.collection(new SingleElementIterator(this.wrappedValueHolder.value()));
+ private Collection<String> wrappedCollection() {
+ return CollectionTools.collection(new SingleElementIterator<String>(this.wrappedValueHolder.value()));
}
@Override
@@ -53,10 +55,11 @@ public class PropertyCollectionValueModelAdapterTests extends TestCase {
public void testIterator() {
this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() {
+ @Override
public void itemsAdded(CollectionChangeEvent e) {/* OK */}
});
this.wrappedValueHolder.setValue("foo");
- Collection adapterCollection = CollectionTools.collection(this.adapter.iterator());
+ Collection<String> adapterCollection = CollectionTools.collection(this.adapter.iterator());
assertEquals(1, adapterCollection.size());
assertEquals(this.wrappedCollection(), adapterCollection);
assertEquals("foo", adapterCollection.iterator().next());
@@ -64,22 +67,23 @@ public class PropertyCollectionValueModelAdapterTests extends TestCase {
public void testStaleValue() {
CollectionChangeListener listener = new TestListener() {
+ @Override
public void itemsAdded(CollectionChangeEvent e) {/* OK */}
};
this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, listener);
this.wrappedValueHolder.setValue("foo");
- Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.iterator());
+ Collection<String> adapterCollection = CollectionTools.collection(this.adapter.iterator());
assertEquals(1, adapterCollection.size());
assertEquals(this.wrappedCollection(), adapterCollection);
assertEquals("foo", adapterCollection.iterator().next());
this.adapter.removeCollectionChangeListener(CollectionValueModel.VALUES, listener);
- adapterCollection = CollectionTools.collection((Iterator) this.adapter.iterator());
+ adapterCollection = CollectionTools.collection(this.adapter.iterator());
assertEquals(0, adapterCollection.size());
- assertEquals(new HashBag(), adapterCollection);
+ assertEquals(new HashBag<String>(), adapterCollection);
this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, listener);
- adapterCollection = CollectionTools.collection((Iterator) this.adapter.iterator());
+ adapterCollection = CollectionTools.collection(this.adapter.iterator());
assertEquals(1, adapterCollection.size());
assertEquals(this.wrappedCollection(), adapterCollection);
assertEquals("foo", adapterCollection.iterator().next());
@@ -87,7 +91,7 @@ public class PropertyCollectionValueModelAdapterTests extends TestCase {
public void testHasListeners() {
assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES));
- SynchronizedBag synchCollection = new SynchronizedBag(this.adapter);
+ CoordinatedBag<String> synchCollection = new CoordinatedBag<String>(this.adapter);
assertTrue(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES));
this.adapter.removeCollectionChangeListener(CollectionValueModel.VALUES, synchCollection);
assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES));
@@ -99,7 +103,9 @@ public class PropertyCollectionValueModelAdapterTests extends TestCase {
public void testListChangedToEmpty() {
this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() {
+ @Override
public void itemsAdded(CollectionChangeEvent e) {/* OK */}
+ @Override
public void itemsRemoved(CollectionChangeEvent e) {/* OK */}
});
this.wrappedValueHolder.setValue("foo");
@@ -110,6 +116,7 @@ public class PropertyCollectionValueModelAdapterTests extends TestCase {
public void testCollectionChangedFromEmpty() {
this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() {
+ @Override
public void itemsAdded(CollectionChangeEvent e) {/* OK */}
});
JList jList = new JList(new ListModelAdapter(this.adapter));
@@ -129,10 +136,7 @@ public class PropertyCollectionValueModelAdapterTests extends TestCase {
// ********** member class **********
- private static class TestListener implements CollectionChangeListener {
- TestListener() {
- super();
- }
+ static class TestListener implements CollectionChangeListener {
public void collectionChanged(CollectionChangeEvent e) {
fail("unexpected event");
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimpleCollectionValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimpleCollectionValueModelTests.java
index d1a994fb71..66b77bd700 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimpleCollectionValueModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimpleCollectionValueModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -11,9 +11,8 @@ package org.eclipse.jpt.utility.tests.internal.model.value;
import java.util.Collection;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
-import junit.framework.TestCase;
+
import org.eclipse.jpt.utility.internal.Bag;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.HashBag;
@@ -23,12 +22,14 @@ import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel;
import org.eclipse.jpt.utility.tests.internal.TestTools;
+import junit.framework.TestCase;
+
public class SimpleCollectionValueModelTests extends TestCase {
- private SimpleCollectionValueModel bagHolder;
+ private SimpleCollectionValueModel<String> bagHolder;
CollectionChangeEvent bagEvent;
String bagEventType;
- private SimpleCollectionValueModel setHolder;
+ private SimpleCollectionValueModel<String> setHolder;
CollectionChangeEvent setEvent;
String setEventType;
@@ -45,8 +46,8 @@ public class SimpleCollectionValueModelTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.bagHolder = new SimpleCollectionValueModel(this.buildBag());
- this.setHolder = new SimpleCollectionValueModel(this.buildSet());
+ this.bagHolder = new SimpleCollectionValueModel<String>(this.buildBag());
+ this.setHolder = new SimpleCollectionValueModel<String>(this.buildSet());
}
private Bag<String> buildBag() {
@@ -94,28 +95,28 @@ public class SimpleCollectionValueModelTests extends TestCase {
}
public void testSize() {
- assertEquals(this.buildBag().size(), CollectionTools.size((Iterator) this.bagHolder.iterator()));
- assertEquals(this.buildSet().size(), CollectionTools.size((Iterator) this.setHolder.iterator()));
+ assertEquals(this.buildBag().size(), CollectionTools.size(this.bagHolder.iterator()));
+ assertEquals(this.buildSet().size(), CollectionTools.size(this.setHolder.iterator()));
}
private boolean bagHolderContains(Object item) {
- return CollectionTools.contains((Iterator) this.bagHolder.iterator(), item);
+ return CollectionTools.contains(this.bagHolder.iterator(), item);
}
private boolean setHolderContains(Object item) {
- return CollectionTools.contains((Iterator) this.setHolder.iterator(), item);
+ return CollectionTools.contains(this.setHolder.iterator(), item);
}
private boolean bagHolderContainsAll(Collection<String> items) {
- return CollectionTools.containsAll((Iterator) this.bagHolder.iterator(), items);
+ return CollectionTools.containsAll(this.bagHolder.iterator(), items);
}
private boolean setHolderContainsAll(Collection<String> items) {
- return CollectionTools.containsAll((Iterator) this.setHolder.iterator(), items);
+ return CollectionTools.containsAll(this.setHolder.iterator(), items);
}
private boolean bagHolderContainsAny(Collection<String> items) {
- Bag bag = CollectionTools.bag((Iterator) this.bagHolder.iterator());
+ Bag<String> bag = CollectionTools.bag(this.bagHolder.iterator());
for (String string : items) {
if (bag.contains(string)) {
return true;
@@ -125,7 +126,7 @@ public class SimpleCollectionValueModelTests extends TestCase {
}
private boolean setHolderContainsAny(Collection<String> items) {
- Set set = CollectionTools.set((Iterator) this.setHolder.iterator());
+ Set<String> set = CollectionTools.set(this.setHolder.iterator());
for (String string : items) {
if (set.contains(string)) {
return true;
@@ -195,7 +196,7 @@ public class SimpleCollectionValueModelTests extends TestCase {
public void testSetCollection() {
assertTrue(this.bagHolderContains("bar"));
assertFalse(this.bagHolderContains("jar"));
- ((SimpleCollectionValueModel) this.bagHolder).setCollection(this.buildAddItems());
+ this.bagHolder.setCollection(this.buildAddItems());
assertFalse(this.bagHolderContains("bar"));
assertTrue(this.bagHolderContains("jar"));
@@ -204,12 +205,12 @@ public class SimpleCollectionValueModelTests extends TestCase {
this.bagHolder.remove(null);
assertFalse(this.bagHolderContains(null));
- ((SimpleCollectionValueModel) this.bagHolder).setCollection(new HashBag());
+ this.bagHolder.setCollection(new HashBag<String>());
assertFalse(this.bagHolderContains("jar"));
assertTrue(this.setHolderContains("bar"));
assertFalse(this.setHolderContains("jar"));
- ((SimpleCollectionValueModel) this.setHolder).setCollection(this.buildAddItems());
+ this.setHolder.setCollection(this.buildAddItems());
assertFalse(this.setHolderContains("bar"));
assertTrue(this.setHolderContains("jar"));
@@ -218,7 +219,7 @@ public class SimpleCollectionValueModelTests extends TestCase {
this.setHolder.remove(null);
assertFalse(this.setHolderContains(null));
- ((SimpleCollectionValueModel) this.setHolder).setCollection(new HashBag());
+ this.setHolder.setCollection(new HashBag<String>());
assertFalse(this.setHolderContains("jar"));
}
@@ -276,7 +277,7 @@ public class SimpleCollectionValueModelTests extends TestCase {
this.bagEvent = null;
this.bagEventType = null;
- ((SimpleCollectionValueModel) this.bagHolder).setCollection(this.buildBag());
+ this.bagHolder.setCollection(this.buildBag());
this.verifyBagEvent(CHANGE);
this.bagEvent = null;
@@ -333,7 +334,7 @@ public class SimpleCollectionValueModelTests extends TestCase {
this.setEvent = null;
this.setEventType = null;
- ((SimpleCollectionValueModel) this.setHolder).setCollection(this.buildSet());
+ this.setHolder.setCollection(this.buildSet());
this.verifySetEvent(CHANGE);
this.setEvent = null;
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimpleListValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimpleListValueModelTests.java
index 01f8480440..d4636ea74c 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimpleListValueModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimpleListValueModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -13,7 +13,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.model.event.ListChangeEvent;
@@ -25,7 +24,7 @@ import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class SimpleListValueModelTests extends TestCase {
- private SimpleListValueModel listHolder;
+ private SimpleListValueModel<String> listHolder;
ListChangeEvent event;
String eventType;
@@ -44,32 +43,32 @@ public class SimpleListValueModelTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.listHolder = new SimpleListValueModel(this.buildList());
+ this.listHolder = new SimpleListValueModel<String>(this.buildList());
}
- private List buildList() {
- List result = new ArrayList();
+ private List<String> buildList() {
+ List<String> result = new ArrayList<String>();
result.add("foo");
result.add("bar");
result.add("baz");
return result;
}
- private List buildAddList() {
- List result = new ArrayList();
+ private List<String> buildAddList() {
+ List<String> result = new ArrayList<String>();
result.add("joo");
result.add("jar");
result.add("jaz");
return result;
}
- private List buildRemoveList() {
- List result = new ArrayList();
- result.add("foo");
- result.add("bar");
- return result;
- }
-
+// private List<String> buildRemoveList() {
+// List<String> result = new ArrayList<String>();
+// result.add("foo");
+// result.add("bar");
+// return result;
+// }
+//
@Override
protected void tearDown() throws Exception {
TestTools.clear(this);
@@ -88,13 +87,13 @@ public class SimpleListValueModelTests extends TestCase {
return CollectionTools.contains(this.listHolder.listIterator(), item);
}
- private boolean listContainsAll(Collection items) {
+ private boolean listContainsAll(Collection<String> items) {
return CollectionTools.containsAll(this.listHolder.listIterator(), items);
}
- private boolean listContainsAny(Collection items) {
- List list = CollectionTools.list(this.listHolder.iterator());
- for (Iterator stream = items.iterator(); stream.hasNext(); ) {
+ private boolean listContainsAny(Collection<String> items) {
+ List<String> list = CollectionTools.list(this.listHolder.iterator());
+ for (Iterator<String> stream = items.iterator(); stream.hasNext(); ) {
if (list.contains(stream.next())) {
return true;
}
@@ -130,14 +129,14 @@ public class SimpleListValueModelTests extends TestCase {
}
public void testSetValues() {
- List newList = new ArrayList();
+ List<String> newList = new ArrayList<String>();
newList.add("joo");
newList.add("jar");
newList.add("jaz");
assertTrue(this.listContains("bar"));
assertFalse(this.listContains("jar"));
- ((SimpleListValueModel) this.listHolder).setList(newList);
+ this.listHolder.setList(newList);
assertFalse(this.listContains("bar"));
assertTrue(this.listContains("jar"));
@@ -146,7 +145,7 @@ public class SimpleListValueModelTests extends TestCase {
this.listHolder.remove(1);
assertFalse(this.listContains(null));
- ((SimpleListValueModel) this.listHolder).setList(new ArrayList());
+ this.listHolder.setList(new ArrayList<String>());
assertFalse(this.listContains("jar"));
}
@@ -183,7 +182,7 @@ public class SimpleListValueModelTests extends TestCase {
this.event = null;
this.eventType = null;
- ((SimpleListValueModel) this.listHolder).setList(this.buildList());
+ this.listHolder.setList(this.buildList());
this.verifyEvent(CHANGE);
this.event = null;
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimplePropertyValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimplePropertyValueModelTests.java
index b4c0707f38..bcbd9a6410 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimplePropertyValueModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimplePropertyValueModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -11,15 +11,15 @@ package org.eclipse.jpt.utility.tests.internal.model.value;
import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class SimplePropertyValueModelTests extends TestCase {
- private PropertyValueModel objectHolder;
+ private WritablePropertyValueModel<String> objectHolder;
PropertyChangeEvent event;
@@ -30,7 +30,7 @@ public class SimplePropertyValueModelTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.objectHolder = new SimplePropertyValueModel("foo");
+ this.objectHolder = new SimplePropertyValueModel<String>("foo");
}
@Override
@@ -58,7 +58,7 @@ public class SimplePropertyValueModelTests extends TestCase {
}
public void testPropertyChange2() {
- this.objectHolder.addPropertyChangeListener(ValueModel.VALUE, this.buildListener());
+ this.objectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildListener());
this.verifyPropertyChange();
}
@@ -86,7 +86,7 @@ public class SimplePropertyValueModelTests extends TestCase {
private void verifyEvent(Object oldValue, Object newValue) {
assertEquals(this.objectHolder, this.event.getSource());
- assertEquals(ValueModel.VALUE, this.event.propertyName());
+ assertEquals(PropertyValueModel.VALUE, this.event.propertyName());
assertEquals(oldValue, this.event.oldValue());
assertEquals(newValue, this.event.newValue());
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SortedListValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SortedListValueModelAdapterTests.java
index cd77e2fef1..3e7c761037 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SortedListValueModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SortedListValueModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -13,7 +13,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
-import java.util.ListIterator;
import java.util.TreeSet;
import org.eclipse.jpt.utility.internal.Bag;
@@ -23,7 +22,6 @@ import org.eclipse.jpt.utility.internal.ReverseComparator;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
import org.eclipse.jpt.utility.internal.model.event.ListChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.ListChangeListener;
-import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
@@ -32,9 +30,9 @@ import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class SortedListValueModelAdapterTests extends TestCase {
- private SortedListValueModelAdapter adapter;
- private SimpleCollectionValueModel wrappedCollectionHolder;
- private Collection wrappedCollection;
+ private SortedListValueModelAdapter<String> adapter;
+ private SimpleCollectionValueModel<String> wrappedCollectionHolder;
+ private Collection<String> wrappedCollection;
public SortedListValueModelAdapterTests(String name) {
@@ -44,9 +42,9 @@ public class SortedListValueModelAdapterTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.wrappedCollection = new HashBag();
- this.wrappedCollectionHolder = new SimpleCollectionValueModel(this.wrappedCollection);
- this.adapter = new SortedListValueModelAdapter(this.wrappedCollectionHolder);
+ this.wrappedCollection = new HashBag<String>();
+ this.wrappedCollectionHolder = new SimpleCollectionValueModel<String>(this.wrappedCollection);
+ this.adapter = new SortedListValueModelAdapter<String>(this.wrappedCollectionHolder);
}
@Override
@@ -55,21 +53,23 @@ public class SortedListValueModelAdapterTests extends TestCase {
super.tearDown();
}
- private void verifyList(Collection expected, ListValueModel actual) {
+ private void verifyList(Collection<String> expected, ListValueModel<String> actual) {
this.verifyList(expected, actual, null);
}
- private void verifyList(Collection expected, ListValueModel actual, Comparator comparator) {
- Collection sortedSet = new TreeSet(comparator);
+ private void verifyList(Collection<String> expected, ListValueModel<String> actual, Comparator<String> comparator) {
+ Collection<String> sortedSet = new TreeSet<String>(comparator);
sortedSet.addAll(expected);
- List expectedList = new ArrayList(sortedSet);
- List actualList = CollectionTools.list(actual.iterator());
+ List<String> expectedList = new ArrayList<String>(sortedSet);
+ List<String> actualList = CollectionTools.list(actual.iterator());
assertEquals(expectedList, actualList);
}
public void testAdd() {
this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() {
+ @Override
public void itemsAdded(ListChangeEvent e) {/* OK */}
+ @Override
public void itemsReplaced(ListChangeEvent e) {/* OK */}
});
this.wrappedCollectionHolder.add("foo");
@@ -80,8 +80,8 @@ public class SortedListValueModelAdapterTests extends TestCase {
}
public void testAddItem() {
- List synchList = new SynchronizedList(this.adapter);
- Bag synchCollection = new SynchronizedBag(this.wrappedCollectionHolder);
+ List<String> synchList = new CoordinatedList<String>(this.adapter);
+ Bag<String> synchCollection = new CoordinatedBag<String>(this.wrappedCollectionHolder);
this.wrappedCollectionHolder.add("foo");
assertTrue(this.wrappedCollection.contains("foo"));
this.wrappedCollectionHolder.add("bar");
@@ -97,8 +97,8 @@ public class SortedListValueModelAdapterTests extends TestCase {
}
public void testRemoveItem() {
- List synchList = new SynchronizedList(this.adapter);
- Bag synchCollection = new SynchronizedBag(this.wrappedCollectionHolder);
+ List<String> synchList = new CoordinatedList<String>(this.adapter);
+ Bag<String> synchCollection = new CoordinatedBag<String>(this.wrappedCollectionHolder);
this.wrappedCollectionHolder.add("foo");
this.wrappedCollectionHolder.add("bar");
this.wrappedCollectionHolder.add("baz");
@@ -118,8 +118,11 @@ public class SortedListValueModelAdapterTests extends TestCase {
public void testListSynch() {
this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() {
+ @Override
public void itemsAdded(ListChangeEvent e) {/* OK */}
+ @Override
public void itemsRemoved(ListChangeEvent e) {/* OK */}
+ @Override
public void itemsReplaced(ListChangeEvent e) {/* OK */}
});
this.wrappedCollectionHolder.add("foo");
@@ -138,8 +141,8 @@ public class SortedListValueModelAdapterTests extends TestCase {
}
public void testSetComparator() {
- List synchList = new SynchronizedList(this.adapter);
- Bag synchCollection = new SynchronizedBag(this.wrappedCollectionHolder);
+ List<String> synchList = new CoordinatedList<String>(this.adapter);
+ Bag<String> synchCollection = new CoordinatedBag<String>(this.wrappedCollectionHolder);
this.wrappedCollectionHolder.add("foo");
assertTrue(this.wrappedCollection.contains("foo"));
this.wrappedCollectionHolder.add("bar");
@@ -153,15 +156,15 @@ public class SortedListValueModelAdapterTests extends TestCase {
assertEquals(this.wrappedCollection, CollectionTools.collection(synchList.iterator()));
assertEquals(this.wrappedCollection, synchCollection);
- this.adapter.setComparator(new ReverseComparator());
- this.verifyList(this.wrappedCollection, this.adapter, new ReverseComparator());
+ this.adapter.setComparator(new ReverseComparator<String>());
+ this.verifyList(this.wrappedCollection, this.adapter, new ReverseComparator<String>());
assertEquals(this.wrappedCollection, CollectionTools.collection(synchList.iterator()));
assertEquals(this.wrappedCollection, synchCollection);
}
public void testHasListeners() {
assertFalse(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
- SynchronizedList synchList = new SynchronizedList(this.adapter);
+ CoordinatedList<String> synchList = new CoordinatedList<String>(this.adapter);
assertTrue(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
this.adapter.removeListChangeListener(ListValueModel.LIST_VALUES, synchList);
assertFalse(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
@@ -171,7 +174,7 @@ public class SortedListValueModelAdapterTests extends TestCase {
assertFalse(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
}
- private class TestListChangeListener implements ListChangeListener {
+ class TestListChangeListener implements ListChangeListener {
public void itemsAdded(ListChangeEvent e) {
fail("unexpected event");
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/StaticCollectionValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/StaticCollectionValueModelTests.java
new file mode 100644
index 0000000000..e5c7a1e449
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/StaticCollectionValueModelTests.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.tests.internal.model.value;
+
+import java.util.Collection;
+
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.HashBag;
+import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
+import org.eclipse.jpt.utility.internal.model.value.StaticCollectionValueModel;
+import org.eclipse.jpt.utility.tests.internal.TestTools;
+
+import junit.framework.TestCase;
+
+public class StaticCollectionValueModelTests extends TestCase {
+
+ private static final Collection<String> COLLECTION = buildCollection();
+ private static Collection<String> buildCollection() {
+ Collection<String> result = new HashBag<String>();
+ result.add("foo");
+ result.add("bar");
+ return result;
+ }
+
+ private CollectionValueModel<String> collectionHolder;
+
+
+ public StaticCollectionValueModelTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.collectionHolder = this.buildCollectionHolder();
+ }
+
+ private CollectionValueModel<String> buildCollectionHolder() {
+ return new StaticCollectionValueModel<String>(COLLECTION);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ TestTools.clear(this);
+ super.tearDown();
+ }
+
+ public void testIterator() {
+ assertEquals(buildCollection(), CollectionTools.bag(this.collectionHolder.iterator()));
+ }
+
+ public void testSize() {
+ assertEquals(buildCollection().size(), this.collectionHolder.size());
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/StaticListValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/StaticListValueModelTests.java
new file mode 100644
index 0000000000..f2a666de05
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/StaticListValueModelTests.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.tests.internal.model.value;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
+import org.eclipse.jpt.utility.internal.model.value.StaticListValueModel;
+import org.eclipse.jpt.utility.tests.internal.TestTools;
+
+import junit.framework.TestCase;
+
+public class StaticListValueModelTests extends TestCase {
+
+ private static final List<String> LIST = buildList();
+ private static List<String> buildList() {
+ List<String> result = new ArrayList<String>();
+ result.add("foo");
+ result.add("bar");
+ return result;
+ }
+
+ private ListValueModel<String> listHolder;
+
+
+ public StaticListValueModelTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.listHolder = new StaticListValueModel<String>(LIST);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ TestTools.clear(this);
+ super.tearDown();
+ }
+
+ public void testGet() {
+ List<String> expected = buildList();
+ for (int i = 0; i < this.listHolder.size(); i++) {
+ assertEquals(expected.get(i), this.listHolder.get(i));
+ }
+ }
+
+ public void testIterator() {
+ assertEquals(buildList(), CollectionTools.list(this.listHolder.listIterator()));
+ }
+
+ public void testSize() {
+ assertEquals(buildList().size(), this.listHolder.size());
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/StaticValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/StaticValueModelTests.java
index c9b65bd21b..505eff6434 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/StaticValueModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/StaticValueModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,14 +9,15 @@
******************************************************************************/
package org.eclipse.jpt.utility.tests.internal.model.value;
-import org.eclipse.jpt.utility.internal.model.value.AbstractReadOnlyPropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.StaticPropertyValueModel;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class StaticValueModelTests extends TestCase {
- private ValueModel objectHolder;
+ private PropertyValueModel<String> objectHolder;
+ private static final PropertyValueModel<String> OBJECT_HOLDER = new StaticPropertyValueModel<String>("foo");
public StaticValueModelTests(String name) {
@@ -26,15 +27,7 @@ public class StaticValueModelTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.objectHolder = this.buildObjectHolder();
- }
-
- private ValueModel buildObjectHolder() {
- return new AbstractReadOnlyPropertyValueModel() {
- public Object value() {
- return "foo";
- }
- };
+ this.objectHolder = OBJECT_HOLDER;
}
@Override
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/TransformationListValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/TransformationListValueModelAdapterTests.java
index bc213b23b1..bdfd9cd728 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/TransformationListValueModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/TransformationListValueModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -14,7 +14,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.Transformer;
@@ -29,8 +28,8 @@ import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class TransformationListValueModelAdapterTests extends TestCase {
- private SimpleListValueModel listHolder;
- private ListValueModel transformedListHolder;
+ private SimpleListValueModel<String> listHolder;
+ private ListValueModel<String> transformedListHolder;
ListChangeEvent event;
String eventType;
@@ -49,26 +48,25 @@ public class TransformationListValueModelAdapterTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.listHolder = new SimpleListValueModel(this.buildList());
+ this.listHolder = new SimpleListValueModel<String>(this.buildList());
this.transformedListHolder = this.buildTransformedListHolder(this.listHolder);
}
- private List buildList() {
- List result = new ArrayList();
+ private List<String> buildList() {
+ List<String> result = new ArrayList<String>();
result.add("foo");
result.add("bar");
result.add("baz");
return result;
}
- private List buildTransformedList() {
+ private List<String> buildTransformedList() {
return this.transform(this.buildList());
}
- private List transform(List list) {
- List result = new ArrayList(list.size());
- for (Iterator stream = list.iterator(); stream.hasNext(); ) {
- String string = (String) stream.next();
+ private List<String> transform(List<String> list) {
+ List<String> result = new ArrayList<String>(list.size());
+ for (String string : list) {
if (string == null) {
result.add(null);
} else {
@@ -78,33 +76,34 @@ public class TransformationListValueModelAdapterTests extends TestCase {
return result;
}
- private List buildAddList() {
- List result = new ArrayList();
+ private List<String> buildAddList() {
+ List<String> result = new ArrayList<String>();
result.add("joo");
result.add("jar");
result.add("jaz");
return result;
}
- private List buildTransformedAddList() {
+ private List<String> buildTransformedAddList() {
return this.transform(this.buildAddList());
}
- private List buildRemoveList() {
- List result = new ArrayList();
- result.add("foo");
- result.add("bar");
- return result;
- }
-
- private List buildTransformedRemoveList() {
- return this.transform(this.buildRemoveList());
- }
-
- ListValueModel buildTransformedListHolder(ListValueModel lvm) {
- return new TransformationListValueModelAdapter(lvm) {
- protected Object transformItem(Object item) {
- return (item == null) ? null : ((String) item).toUpperCase();
+// private List<String> buildRemoveList() {
+// List<String> result = new ArrayList<String>();
+// result.add("foo");
+// result.add("bar");
+// return result;
+// }
+//
+// private List<String> buildTransformedRemoveList() {
+// return this.transform(this.buildRemoveList());
+// }
+//
+ ListValueModel<String> buildTransformedListHolder(ListValueModel<String> lvm) {
+ return new TransformationListValueModelAdapter<String, String>(lvm) {
+ @Override
+ protected String transformItem(String s) {
+ return (s == null) ? null : s.toUpperCase();
}
};
}
@@ -138,13 +137,13 @@ public class TransformationListValueModelAdapterTests extends TestCase {
return CollectionTools.contains(this.transformedListHolder.iterator(), item);
}
- private boolean transformedListContainsAll(Collection items) {
+ private boolean transformedListContainsAll(Collection<String> items) {
return CollectionTools.containsAll(this.transformedListHolder.iterator(), items);
}
- private boolean transformedListContainsAny(Collection items) {
- List transformedList = CollectionTools.list(this.transformedListHolder.iterator());
- for (Iterator stream = items.iterator(); stream.hasNext(); ) {
+ private boolean transformedListContainsAny(Collection<String> items) {
+ List<String> transformedList = CollectionTools.list(this.transformedListHolder.iterator());
+ for (Iterator<String> stream = items.iterator(); stream.hasNext(); ) {
if (transformedList.contains(stream.next())) {
return true;
}
@@ -304,13 +303,14 @@ public class TransformationListValueModelAdapterTests extends TestCase {
public TransformerTests(String name) {
super(name);
}
- ListValueModel buildTransformedListHolder(ListValueModel lvm) {
- return new TransformationListValueModelAdapter(lvm, this.buildTransformer());
+ @Override
+ ListValueModel<String> buildTransformedListHolder(ListValueModel<String> lvm) {
+ return new TransformationListValueModelAdapter<String, String>(lvm, this.buildTransformer());
}
- private Transformer buildTransformer() {
- return new Transformer() {
- public Object transform(Object o) {
- return (o == null) ? null : ((String) o).toUpperCase();
+ private Transformer<String, String> buildTransformer() {
+ return new Transformer<String, String>() {
+ public String transform(String s) {
+ return (s == null) ? null : s.toUpperCase();
}
};
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/TransformationPropertyValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/TransformationPropertyValueModelTests.java
index 536f6b2dd6..6c293edf9a 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/TransformationPropertyValueModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/TransformationPropertyValueModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -15,17 +15,17 @@ import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.TransformationPropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TransformationWritablePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class TransformationPropertyValueModelTests extends TestCase {
- private PropertyValueModel objectHolder;
+ private WritablePropertyValueModel<String> objectHolder;
PropertyChangeEvent event;
- private PropertyValueModel transformationObjectHolder;
+ private WritablePropertyValueModel<String> transformationObjectHolder;
PropertyChangeEvent transformationEvent;
public TransformationPropertyValueModelTests(String name) {
@@ -35,17 +35,17 @@ public class TransformationPropertyValueModelTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.objectHolder = new SimplePropertyValueModel("foo");
- this.transformationObjectHolder = new TransformationPropertyValueModel(this.objectHolder, this.buildTransformer());
+ this.objectHolder = new SimplePropertyValueModel<String>("foo");
+ this.transformationObjectHolder = new TransformationWritablePropertyValueModel<String, String>(this.objectHolder, this.buildTransformer());
}
- private BidiTransformer buildTransformer() {
- return new BidiTransformer() {
- public Object transform(Object o) {
- return (o == null) ? null : ((String) o).toUpperCase();
+ private BidiTransformer<String, String> buildTransformer() {
+ return new BidiTransformer<String, String>() {
+ public String transform(String s) {
+ return (s == null) ? null : s.toUpperCase();
}
- public Object reverseTransform(Object o) {
- return (o == null) ? null : ((String) o).toLowerCase();
+ public String reverseTransform(String s) {
+ return (s == null) ? null : s.toLowerCase();
}
};
}
@@ -96,17 +96,17 @@ public class TransformationPropertyValueModelTests extends TestCase {
}
public void testLazyListening() {
- assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
PropertyChangeListener listener = this.buildTransformationListener();
this.transformationObjectHolder.addPropertyChangeListener(listener);
- assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.transformationObjectHolder.removePropertyChangeListener(listener);
- assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
- this.transformationObjectHolder.addPropertyChangeListener(ValueModel.VALUE, listener);
- assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(ValueModel.VALUE));
- this.transformationObjectHolder.removePropertyChangeListener(ValueModel.VALUE, listener);
- assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(ValueModel.VALUE));
+ this.transformationObjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, listener);
+ assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ this.transformationObjectHolder.removePropertyChangeListener(PropertyValueModel.VALUE, listener);
+ assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
}
public void testPropertyChange1() {
@@ -116,8 +116,8 @@ public class TransformationPropertyValueModelTests extends TestCase {
}
public void testPropertyChange2() {
- this.objectHolder.addPropertyChangeListener(ValueModel.VALUE, this.buildListener());
- this.transformationObjectHolder.addPropertyChangeListener(ValueModel.VALUE, this.buildTransformationListener());
+ this.objectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildListener());
+ this.transformationObjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildTransformationListener());
this.verifyPropertyChanges();
}
@@ -177,7 +177,7 @@ public class TransformationPropertyValueModelTests extends TestCase {
private void verifyEvent(PropertyChangeEvent e, Object source, Object oldValue, Object newValue) {
assertEquals(source, e.getSource());
- assertEquals(ValueModel.VALUE, e.propertyName());
+ assertEquals(PropertyValueModel.VALUE, e.propertyName());
assertEquals(oldValue, e.oldValue());
assertEquals(newValue, e.newValue());
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/TreeAspectAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/TreeAspectAdapterTests.java
index 8b14d7aa58..80555e8770 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/TreeAspectAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/TreeAspectAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -21,19 +21,19 @@ import org.eclipse.jpt.utility.internal.iterators.TreeIterator;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
import org.eclipse.jpt.utility.internal.model.event.TreeChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.TreeChangeListener;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.TreeAspectAdapter;
import org.eclipse.jpt.utility.internal.model.value.TreeValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class TreeAspectAdapterTests extends TestCase {
private TestSubject subject1;
- private PropertyValueModel subjectHolder1;
- private TreeAspectAdapter aa1;
+ private WritablePropertyValueModel<TestSubject> subjectHolder1;
+ private TreeAspectAdapter<TestSubject, TestNode[]> aa1;
private TreeChangeEvent event1;
private TreeChangeListener listener1;
@@ -66,7 +66,7 @@ public class TreeAspectAdapterTests extends TestCase {
this.subject1.addDescription(node, "description 1.2.1");
node = this.subject1.addDescription(root, "description 1.3");
- this.subjectHolder1 = new SimplePropertyValueModel(this.subject1);
+ this.subjectHolder1 = new SimplePropertyValueModel<TestSubject>(this.subject1);
this.aa1 = this.buildAspectAdapter(this.subjectHolder1);
this.listener1 = this.buildValueChangeListener1();
this.aa1.addTreeChangeListener(TreeValueModel.NODES, this.listener1);
@@ -91,18 +91,18 @@ public class TreeAspectAdapterTests extends TestCase {
node = this.subject2.addDescription(root, "description 2.3");
}
- private TreeAspectAdapter buildAspectAdapter(ValueModel subjectHolder) {
- return new TreeAspectAdapter(subjectHolder, TestSubject.NAMES_TREE) {
+ private TreeAspectAdapter<TestSubject, TestNode[]> buildAspectAdapter(PropertyValueModel<TestSubject> subjectHolder) {
+ return new TreeAspectAdapter<TestSubject, TestNode[]>(subjectHolder, TestSubject.NAMES_TREE) {
// this is not a typical aspect adapter - the value is determined by the aspect name
@Override
- protected Iterator nodes_() {
- if (this.treeName == TestSubject.NAMES_TREE) {
- return ((TestSubject) this.subject).namePaths();
+ protected Iterator<TestNode[]> nodes_() {
+ if (this.treeNames[0] == TestSubject.NAMES_TREE) {
+ return this.subject.namePaths();
}
- if (this.treeName == TestSubject.DESCRIPTIONS_TREE) {
- return ((TestSubject) this.subject).descriptionPaths();
+ if (this.treeNames[0] == TestSubject.DESCRIPTIONS_TREE) {
+ return this.subject.descriptionPaths();
}
- throw new IllegalStateException("invalid aspect name: " + this.treeName);
+ throw new IllegalStateException("invalid aspect name: " + this.treeNames[0]);
}
};
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ValueCollectionAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ValueCollectionAdapterTests.java
new file mode 100644
index 0000000000..6bd028a273
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ValueCollectionAdapterTests.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.tests.internal.model.value;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.event.StateChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+import org.eclipse.jpt.utility.internal.model.listener.StateChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.ValueCollectionAdapter;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.tests.internal.TestTools;
+
+import junit.framework.TestCase;
+
+public class ValueCollectionAdapterTests extends TestCase {
+ private Junk junk;
+ private SimplePropertyValueModel<Junk> junkHolder;
+ private ValueCollectionAdapter<Junk> junkHolder2;
+
+
+ public ValueCollectionAdapterTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.junk = new Junk("foo");
+ this.junkHolder = new SimplePropertyValueModel<Junk>(this.junk);
+ this.junkHolder2 = new ValueCollectionAdapter<Junk>(this.junkHolder, Junk.STUFF_COLLECTION);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ TestTools.clear(this);
+ super.tearDown();
+ }
+
+ public void testWrappedPVM() {
+ Junk junk2 = new Junk("bar");
+ LocalListener l = new LocalListener(this.junkHolder2, this.junk, junk2);
+ this.junkHolder2.addPropertyChangeListener(l);
+ this.junkHolder.setValue(junk2);
+ assertTrue(l.eventReceived());
+ }
+
+ public void testHasPropertyChangeListeners() throws Exception {
+ assertFalse(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertFalse(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+
+ LocalListener l = new LocalListener(this.junkHolder2, null, this.junk);
+ this.junkHolder2.addPropertyChangeListener(l);
+ assertTrue(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertTrue(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+
+ this.junkHolder2.removePropertyChangeListener(l);
+ assertFalse(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertFalse(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ }
+
+ public void testHasStateChangeListeners() throws Exception {
+ assertFalse(this.junk.hasAnyCollectionChangeListeners(Junk.STUFF_COLLECTION));
+ assertFalse(this.junkHolder2.hasAnyStateChangeListeners());
+
+ LocalListener l = new LocalListener(this.junkHolder2, null, this.junk);
+ this.junkHolder2.addStateChangeListener(l);
+ assertTrue(this.junk.hasAnyCollectionChangeListeners(Junk.STUFF_COLLECTION));
+ assertTrue(this.junkHolder2.hasAnyStateChangeListeners());
+
+ this.junkHolder2.removeStateChangeListener(l);
+ assertFalse(this.junk.hasAnyCollectionChangeListeners(Junk.STUFF_COLLECTION));
+ assertFalse(this.junkHolder2.hasAnyStateChangeListeners());
+ }
+
+ public void testCollectionAdd() {
+ LocalListener l = new LocalListener(this.junkHolder2);
+ this.junkHolder2.addStateChangeListener(l);
+ this.junk.addStuff("bar");
+ assertTrue(l.eventReceived());
+ }
+
+ public void testCollectionRemove() {
+ LocalListener l = new LocalListener(this.junkHolder2);
+ this.junkHolder2.addStateChangeListener(l);
+ this.junk.removeStuff("foo");
+ assertTrue(l.eventReceived());
+ }
+
+
+ private class LocalListener implements PropertyChangeListener, StateChangeListener {
+ private boolean eventReceived = false;
+ private final Object source;
+ private final Object oldValue;
+ private final Object newValue;
+ LocalListener(Object source) {
+ this(source, null, null);
+ }
+ LocalListener(Object source, Object oldValue, Object newValue) {
+ super();
+ this.source = source;
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ }
+ public void propertyChanged(PropertyChangeEvent e) {
+ this.eventReceived = true;
+ assertEquals(this.source, e.getSource());
+ assertEquals(this.oldValue, e.oldValue());
+ assertEquals(this.newValue, e.newValue());
+ assertEquals(PropertyValueModel.VALUE, e.propertyName());
+ }
+ public void stateChanged(StateChangeEvent e) {
+ this.eventReceived = true;
+ assertEquals(this.source, e.getSource());
+ assertNull(e.aspectName());
+ }
+ boolean eventReceived() {
+ return this.eventReceived;
+ }
+ }
+
+
+ private class Junk extends AbstractModel {
+ private Collection<String> stuff;
+ public static final String STUFF_COLLECTION = "stuff";
+
+ public Junk(String stuffItem) {
+ this.stuff = new ArrayList<String>();
+ this.stuff.add(stuffItem);
+ }
+
+ public void addStuff(String stuffItem) {
+ this.addItemToCollection(stuffItem, this.stuff, STUFF_COLLECTION);
+ }
+
+ public void removeStuff(String stuffItem) {
+ this.removeItemFromCollection(stuffItem, this.stuff, STUFF_COLLECTION);
+ }
+
+ @Override
+ public String toString() {
+ return "Junk(" + this.stuff + ")";
+ }
+
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ValueListAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ValueListAdapterTests.java
new file mode 100644
index 0000000000..432f56ac0c
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ValueListAdapterTests.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.tests.internal.model.value;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.event.StateChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+import org.eclipse.jpt.utility.internal.model.listener.StateChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.ValueListAdapter;
+import org.eclipse.jpt.utility.tests.internal.TestTools;
+
+import junit.framework.TestCase;
+
+public class ValueListAdapterTests extends TestCase {
+ private Junk junk;
+ private SimplePropertyValueModel<Junk> junkHolder;
+ private ValueListAdapter<Junk> junkHolder2;
+
+
+
+ public ValueListAdapterTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.junk = new Junk("foo");
+ this.junkHolder = new SimplePropertyValueModel<Junk>(this.junk);
+ this.junkHolder2 = new ValueListAdapter<Junk>(this.junkHolder, Junk.STUFF_LIST);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ TestTools.clear(this);
+ super.tearDown();
+ }
+
+ public void testWrappedPVM() {
+ Junk junk2 = new Junk("bar");
+ LocalListener l = new LocalListener(this.junkHolder2, this.junk, junk2);
+ this.junkHolder2.addPropertyChangeListener(l);
+ this.junkHolder.setValue(junk2);
+ assertTrue(l.eventReceived());
+ }
+
+ public void testHasPropertyChangeListeners() throws Exception {
+ assertFalse(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertFalse(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+
+ LocalListener l = new LocalListener(this.junkHolder2, null, this.junk);
+ this.junkHolder2.addPropertyChangeListener(l);
+ assertTrue(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertTrue(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+
+ this.junkHolder2.removePropertyChangeListener(l);
+ assertFalse(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertFalse(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ }
+
+ public void testHasStateChangeListeners() throws Exception {
+ assertFalse(this.junk.hasAnyListChangeListeners(Junk.STUFF_LIST));
+ assertFalse(this.junkHolder2.hasAnyStateChangeListeners());
+
+ LocalListener l = new LocalListener(this.junkHolder2, null, this.junk);
+ this.junkHolder2.addStateChangeListener(l);
+ assertTrue(this.junk.hasAnyListChangeListeners(Junk.STUFF_LIST));
+ assertTrue(this.junkHolder2.hasAnyStateChangeListeners());
+
+ this.junkHolder2.removeStateChangeListener(l);
+ assertFalse(this.junk.hasAnyListChangeListeners(Junk.STUFF_LIST));
+ assertFalse(this.junkHolder2.hasAnyStateChangeListeners());
+ }
+
+ public void testListAdd() {
+ LocalListener l = new LocalListener(this.junkHolder2, null, this.junk);
+ this.junkHolder2.addStateChangeListener(l);
+ this.junk.addStuff("bar");
+ assertTrue(l.eventReceived());
+ }
+
+ public void testListRemove() {
+ LocalListener l = new LocalListener(this.junkHolder2, null, this.junk);
+ this.junkHolder2.addStateChangeListener(l);
+ this.junk.removeStuff("foo");
+ assertTrue(l.eventReceived());
+ }
+
+ public void testListReplace() {
+ LocalListener l = new LocalListener(this.junkHolder2, null, this.junk);
+ this.junkHolder2.addStateChangeListener(l);
+ this.junk.replaceStuff("foo", "bar");
+ assertTrue(l.eventReceived());
+ }
+
+
+ private class LocalListener implements PropertyChangeListener, StateChangeListener {
+ private boolean eventReceived = false;
+ private final Object source;
+ private final Object oldValue;
+ private final Object newValue;
+ LocalListener(Object source) {
+ this(source, null, null);
+ }
+ LocalListener(Object source, Object oldValue, Object newValue) {
+ super();
+ this.source = source;
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ }
+ public void propertyChanged(PropertyChangeEvent e) {
+ this.eventReceived = true;
+ assertEquals(this.source, e.getSource());
+ assertEquals(this.oldValue, e.oldValue());
+ assertEquals(this.newValue, e.newValue());
+ assertEquals(PropertyValueModel.VALUE, e.propertyName());
+ }
+ public void stateChanged(StateChangeEvent e) {
+ this.eventReceived = true;
+ assertEquals(this.source, e.getSource());
+ assertNull(e.aspectName());
+ }
+ boolean eventReceived() {
+ return this.eventReceived;
+ }
+ }
+
+ private class Junk extends AbstractModel {
+ private List<String> stuff;
+ public static final String STUFF_LIST = "stuff";
+
+ public Junk(String stuffItem) {
+ this.stuff = new ArrayList<String>();
+ this.stuff.add(stuffItem);
+ }
+
+ public void addStuff(String stuffItem) {
+ this.addItemToList(stuffItem, this.stuff, STUFF_LIST);
+ }
+
+ public void removeStuff(String stuffItem) {
+ this.removeItemFromList(stuffItem, this.stuff, STUFF_LIST);
+ }
+
+ public void replaceStuff(String oldStuffItem, String newStuffItem) {
+ this.replaceItemInList(oldStuffItem, newStuffItem, this.stuff, STUFF_LIST);
+ }
+
+ @Override
+ public String toString() {
+ return "Junk(" + this.stuff + ")";
+ }
+
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ValuePropertyAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ValuePropertyAdapterTests.java
new file mode 100644
index 0000000000..7fba30fa1e
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ValuePropertyAdapterTests.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.tests.internal.model.value;
+
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.event.StateChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+import org.eclipse.jpt.utility.internal.model.listener.StateChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.ValuePropertyAdapter;
+import org.eclipse.jpt.utility.tests.internal.TestTools;
+
+import junit.framework.TestCase;
+
+public class ValuePropertyAdapterTests extends TestCase {
+ private Junk junk;
+ private SimplePropertyValueModel<Junk> junkHolder;
+ private ValuePropertyAdapter<Junk> junkHolder2;
+
+
+ public ValuePropertyAdapterTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.junk = new Junk("foo");
+ this.junkHolder = new SimplePropertyValueModel<Junk>(this.junk);
+ this.junkHolder2 = new ValuePropertyAdapter<Junk>(this.junkHolder, Junk.NAME_PROPERTY);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ TestTools.clear(this);
+ super.tearDown();
+ }
+
+ public void testWrappedPVM() {
+ Junk junk2 = new Junk("bar");
+ LocalListener l = new LocalListener(this.junkHolder2, this.junk, junk2);
+ this.junkHolder2.addPropertyChangeListener(l);
+ this.junkHolder.setValue(junk2);
+ assertTrue(l.eventReceived());
+ }
+
+ public void testHasPropertyChangeListeners() throws Exception {
+ assertFalse(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertFalse(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+
+ LocalListener l = new LocalListener(this.junkHolder2, null, this.junk);
+ this.junkHolder2.addPropertyChangeListener(l);
+ assertTrue(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertTrue(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+
+ this.junkHolder2.removePropertyChangeListener(l);
+ assertFalse(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertFalse(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ }
+
+ public void testHasStateChangeListeners() throws Exception {
+ assertFalse(this.junk.hasAnyPropertyChangeListeners(Junk.NAME_PROPERTY));
+ assertFalse(this.junkHolder2.hasAnyStateChangeListeners());
+
+ LocalListener l = new LocalListener(this.junkHolder2, null, this.junk);
+ this.junkHolder2.addStateChangeListener(l);
+ assertTrue(this.junk.hasAnyPropertyChangeListeners(Junk.NAME_PROPERTY));
+ assertTrue(this.junkHolder2.hasAnyStateChangeListeners());
+
+ this.junkHolder2.removeStateChangeListener(l);
+ assertFalse(this.junk.hasAnyPropertyChangeListeners(Junk.NAME_PROPERTY));
+ assertFalse(this.junkHolder2.hasAnyStateChangeListeners());
+ }
+
+ public void testChangeProperty() {
+ LocalListener l = new LocalListener(this.junkHolder2, null, this.junk);
+ this.junkHolder2.addStateChangeListener(l);
+ this.junk.setName("bar");
+ assertTrue(l.eventReceived());
+ }
+
+
+ private class LocalListener implements PropertyChangeListener, StateChangeListener {
+ private boolean eventReceived = false;
+ private final Object source;
+ private final Object oldValue;
+ private final Object newValue;
+ LocalListener(Object source) {
+ this(source, null, null);
+ }
+ LocalListener(Object source, Object oldValue, Object newValue) {
+ super();
+ this.source = source;
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ }
+ public void propertyChanged(PropertyChangeEvent e) {
+ this.eventReceived = true;
+ assertEquals(this.source, e.getSource());
+ assertEquals(this.oldValue, e.oldValue());
+ assertEquals(this.newValue, e.newValue());
+ assertEquals(PropertyValueModel.VALUE, e.propertyName());
+ }
+ public void stateChanged(StateChangeEvent e) {
+ this.eventReceived = true;
+ assertEquals(this.source, e.getSource());
+ assertNull(e.aspectName());
+ }
+ boolean eventReceived() {
+ return this.eventReceived;
+ }
+ }
+
+ private class Junk extends AbstractModel {
+ private String name;
+ public static final String NAME_PROPERTY = "name";
+
+ public Junk(String name) {
+ this.name = name;
+ }
+
+ public void setName(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
+ }
+
+ @Override
+ public String toString() {
+ return "Junk(" + this.name + ")";
+ }
+
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ValueStateAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ValueStateAdapterTests.java
new file mode 100644
index 0000000000..95ddb96b89
--- /dev/null
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ValueStateAdapterTests.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 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.utility.tests.internal.model.value;
+
+import org.eclipse.jpt.utility.internal.model.AbstractModel;
+import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
+import org.eclipse.jpt.utility.internal.model.event.StateChangeEvent;
+import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
+import org.eclipse.jpt.utility.internal.model.listener.StateChangeListener;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.ValueStateAdapter;
+import org.eclipse.jpt.utility.tests.internal.TestTools;
+
+import junit.framework.TestCase;
+
+public class ValueStateAdapterTests extends TestCase {
+ private Junk junk;
+ private SimplePropertyValueModel<Junk> junkHolder;
+ private ValueStateAdapter<Junk> junkHolder2;
+
+
+ public ValueStateAdapterTests(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.junk = new Junk("foo");
+ this.junkHolder = new SimplePropertyValueModel<Junk>(this.junk);
+ this.junkHolder2 = new ValueStateAdapter<Junk>(this.junkHolder);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ TestTools.clear(this);
+ super.tearDown();
+ }
+
+ public void testWrappedPVM() {
+ Junk junk2 = new Junk("bar");
+ LocalListener l = new LocalListener(this.junkHolder2, this.junk, junk2);
+ this.junkHolder2.addPropertyChangeListener(l);
+ this.junkHolder.setValue(junk2);
+ assertTrue(l.eventReceived());
+ }
+
+ public void testHasPropertyChangeListeners() throws Exception {
+ assertFalse(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertFalse(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+
+ LocalListener l = new LocalListener(this.junkHolder2, null, this.junk);
+ this.junkHolder2.addPropertyChangeListener(l);
+ assertTrue(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertTrue(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+
+ this.junkHolder2.removePropertyChangeListener(l);
+ assertFalse(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ assertFalse(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
+ }
+
+ public void testHasStateChangeListeners() throws Exception {
+ assertFalse(this.junk.hasAnyStateChangeListeners());
+ assertFalse(this.junkHolder2.hasAnyStateChangeListeners());
+
+ LocalListener l = new LocalListener(this.junkHolder2, null, this.junk);
+ this.junkHolder2.addStateChangeListener(l);
+ assertTrue(this.junk.hasAnyStateChangeListeners());
+ assertTrue(this.junkHolder2.hasAnyStateChangeListeners());
+
+ this.junkHolder2.removeStateChangeListener(l);
+ assertFalse(this.junk.hasAnyStateChangeListeners());
+ assertFalse(this.junkHolder2.hasAnyStateChangeListeners());
+ }
+
+ public void testChangeState() {
+ LocalListener l = new LocalListener(this.junkHolder2, null, this.junk);
+ this.junkHolder2.addPropertyChangeListener(l);
+ this.junkHolder2.addStateChangeListener(l);
+ this.junk.setName("bar");
+ assertTrue(l.eventReceived());
+ }
+
+
+ private class LocalListener implements PropertyChangeListener, StateChangeListener {
+ private boolean eventReceived = false;
+ private final Object source;
+ private final Object oldValue;
+ private final Object newValue;
+ LocalListener(Object source) {
+ this(source, null, null);
+ }
+ LocalListener(Object source, Object oldValue, Object newValue) {
+ super();
+ this.source = source;
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ }
+ public void propertyChanged(PropertyChangeEvent e) {
+ this.eventReceived = true;
+ assertEquals(this.source, e.getSource());
+ assertEquals(this.oldValue, e.oldValue());
+ assertEquals(this.newValue, e.newValue());
+ assertEquals(PropertyValueModel.VALUE, e.propertyName());
+ }
+ public void stateChanged(StateChangeEvent e) {
+ this.eventReceived = true;
+ assertEquals(this.source, e.getSource());
+ assertNull(e.aspectName());
+ }
+ boolean eventReceived() {
+ return this.eventReceived;
+ }
+ }
+
+ private class Junk extends AbstractModel {
+ private String name;
+ public static final String NAME_PROPERTY = "name";
+
+ public Junk(String name) {
+ this.name = name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ this.fireStateChanged();
+ }
+
+ @Override
+ public String toString() {
+ return "Junk(" + this.name + ")";
+ }
+
+ }
+
+}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencePropertyValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencePropertyValueModelTests.java
index cf033eae36..b9e256ccf3 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencePropertyValueModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencePropertyValueModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -15,18 +15,18 @@ import java.util.prefs.PreferenceChangeEvent;
import java.util.prefs.PreferenceChangeListener;
import java.util.prefs.Preferences;
-import org.eclipse.jpt.utility.internal.BidiStringConverter;
import org.eclipse.jpt.utility.internal.ClassTools;
+import org.eclipse.jpt.utility.internal.model.Model;
import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.prefs.PreferencePropertyValueModel;
public class PreferencePropertyValueModelTests extends PreferencesTestCase {
- private PropertyValueModel nodeHolder;
- PreferencePropertyValueModel preferenceAdapter;
+ private WritablePropertyValueModel<Preferences> nodeHolder;
+ PreferencePropertyValueModel<String> preferenceAdapter;
PropertyChangeEvent event;
PropertyChangeListener listener;
boolean listenerRemoved = false;
@@ -43,10 +43,10 @@ public class PreferencePropertyValueModelTests extends PreferencesTestCase {
super.setUp();
this.testNode.put(KEY_NAME, STRING_VALUE);
- this.nodeHolder = new SimplePropertyValueModel(this.testNode);
- this.preferenceAdapter = new PreferencePropertyValueModel(this.nodeHolder, KEY_NAME);
+ this.nodeHolder = new SimplePropertyValueModel<Preferences>(this.testNode);
+ this.preferenceAdapter = new PreferencePropertyValueModel<String>(this.nodeHolder, KEY_NAME);
this.listener = this.buildValueChangeListener();
- this.preferenceAdapter.addPropertyChangeListener(ValueModel.VALUE, this.listener);
+ this.preferenceAdapter.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener);
this.event = null;
}
@@ -124,19 +124,19 @@ public class PreferencePropertyValueModelTests extends PreferencesTestCase {
}
public void testHasListeners() throws Exception {
- assertTrue(this.preferenceAdapter.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(this.preferenceAdapter.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
assertTrue(this.nodeHasAnyPrefListeners(this.testNode));
- this.preferenceAdapter.removePropertyChangeListener(ValueModel.VALUE, this.listener);
+ this.preferenceAdapter.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener);
assertFalse(this.nodeHasAnyPrefListeners(this.testNode));
- assertFalse(this.preferenceAdapter.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertFalse(this.preferenceAdapter.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
PropertyChangeListener listener2 = this.buildValueChangeListener();
this.preferenceAdapter.addPropertyChangeListener(listener2);
- assertTrue(this.preferenceAdapter.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(this.preferenceAdapter.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
assertTrue(this.nodeHasAnyPrefListeners(this.testNode));
this.preferenceAdapter.removePropertyChangeListener(listener2);
assertFalse(this.nodeHasAnyPrefListeners(this.testNode));
- assertFalse(this.preferenceAdapter.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertFalse(this.preferenceAdapter.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
}
public void testRemoveAndReAddPreference() throws Exception {
@@ -163,9 +163,9 @@ public class PreferencePropertyValueModelTests extends PreferencesTestCase {
public void testDefaultValue() throws Exception {
// rebuild the adapter with a default value
String DEFAULT_VALUE = "default value";
- this.preferenceAdapter.removePropertyChangeListener(ValueModel.VALUE, this.listener);
- this.preferenceAdapter = new PreferencePropertyValueModel(this.nodeHolder, KEY_NAME, DEFAULT_VALUE);
- this.preferenceAdapter.addPropertyChangeListener(ValueModel.VALUE, this.listener);
+ this.preferenceAdapter.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener);
+ this.preferenceAdapter = new PreferencePropertyValueModel<String>(this.nodeHolder, KEY_NAME, DEFAULT_VALUE);
+ this.preferenceAdapter.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener);
assertEquals(STRING_VALUE, this.testNode.get(KEY_NAME, null));
assertEquals(STRING_VALUE, this.preferenceAdapter.value());
@@ -192,7 +192,7 @@ public class PreferencePropertyValueModelTests extends PreferencesTestCase {
assertNull(this.event);
// remove the this.listener so the adapter no longer listens to the preference
- this.preferenceAdapter.removePropertyChangeListener(ValueModel.VALUE, this.listener);
+ this.preferenceAdapter.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener);
this.testNode.put(KEY_NAME, STRING_VALUE + STRING_VALUE);
this.waitForEventQueueToClear();
@@ -212,35 +212,37 @@ public class PreferencePropertyValueModelTests extends PreferencesTestCase {
assertNull(this.preferenceAdapter.value());
// add the this.listener so the adapter synchs
- this.preferenceAdapter.addPropertyChangeListener(ValueModel.VALUE, this.listener);
+ this.preferenceAdapter.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener);
assertEquals(STRING_VALUE, this.preferenceAdapter.value());
}
public void testIntegerPreference() throws Exception {
// stop listening to the node and convert it to an integer
- this.preferenceAdapter.removePropertyChangeListener(ValueModel.VALUE, this.listener);
+ this.preferenceAdapter.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener);
+
+ PreferencePropertyValueModel<Integer> integerPreferenceAdapter = new PreferencePropertyValueModel<Integer>(this.nodeHolder, KEY_NAME);
this.testNode.putInt(KEY_NAME, 123);
- this.preferenceAdapter = PreferencePropertyValueModel.forInteger(this.testNode, KEY_NAME, 0);
- this.preferenceAdapter.addPropertyChangeListener(ValueModel.VALUE, this.listener);
- assertEquals(new Integer(123), this.preferenceAdapter.value());
+ integerPreferenceAdapter = PreferencePropertyValueModel.forInteger(this.testNode, KEY_NAME, 0);
+ integerPreferenceAdapter.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener);
+ assertEquals(new Integer(123), integerPreferenceAdapter.value());
assertNull(this.event);
this.testNode.putInt(KEY_NAME, 246);
this.waitForEventQueueToClear();
- this.verifyEvent(new Integer(123), new Integer(246));
- assertEquals(new Integer(246), this.preferenceAdapter.value());
+ this.verifyEvent(integerPreferenceAdapter, new Integer(123), new Integer(246));
+ assertEquals(new Integer(246), integerPreferenceAdapter.value());
this.event = null;
this.testNode.remove(KEY_NAME);
this.waitForEventQueueToClear();
- this.verifyEvent(new Integer(246), new Integer(0));
- assertEquals(new Integer(0), this.preferenceAdapter.value());
+ this.verifyEvent(integerPreferenceAdapter, new Integer(246), new Integer(0));
+ assertEquals(new Integer(0), integerPreferenceAdapter.value());
this.event = null;
this.testNode.putInt(KEY_NAME, 123);
this.waitForEventQueueToClear();
- this.verifyEvent(new Integer(0), new Integer(123));
- assertEquals(new Integer(123), this.preferenceAdapter.value());
+ this.verifyEvent(integerPreferenceAdapter, new Integer(0), new Integer(123));
+ assertEquals(new Integer(123), integerPreferenceAdapter.value());
}
/**
@@ -251,7 +253,7 @@ public class PreferencePropertyValueModelTests extends PreferencesTestCase {
* - the node will throw an IllegalStateException - the adapter should handle it OK...
*/
public void testRemoveNode() throws Exception {
- assertTrue(this.preferenceAdapter.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(this.preferenceAdapter.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
Preferences parent = this.testNode.parent();
parent.addNodeChangeListener(this.buildParentNodeChangeListener());
@@ -260,7 +262,7 @@ public class PreferencePropertyValueModelTests extends PreferencesTestCase {
this.waitForEventQueueToClear();
assertTrue(this.listenerRemoved);
- assertTrue(this.preferenceAdapter.hasNoPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(this.preferenceAdapter.hasNoPropertyChangeListeners(PropertyValueModel.VALUE));
}
private NodeChangeListener buildParentNodeChangeListener() {
@@ -270,7 +272,7 @@ public class PreferencePropertyValueModelTests extends PreferencesTestCase {
}
public void childRemoved(NodeChangeEvent e) {
if (e.getChild() == PreferencePropertyValueModelTests.this.testNode) {
- PreferencePropertyValueModelTests.this.preferenceAdapter.removePropertyChangeListener(ValueModel.VALUE, PreferencePropertyValueModelTests.this.listener);
+ PreferencePropertyValueModelTests.this.preferenceAdapter.removePropertyChangeListener(PropertyValueModel.VALUE, PreferencePropertyValueModelTests.this.listener);
// this line of code will not execute if the line above triggers an exception
PreferencePropertyValueModelTests.this.listenerRemoved = true;
}
@@ -303,9 +305,9 @@ public class PreferencePropertyValueModelTests extends PreferencesTestCase {
assertNull(this.event);
assertNull(this.preferenceEvent);
- this.preferenceAdapter.removePropertyChangeListener(ValueModel.VALUE, this.listener);
- this.preferenceAdapter = new AlwaysUpdatePreferencePropertyValueModel(this.nodeHolder, KEY_NAME);
- this.preferenceAdapter.addPropertyChangeListener(ValueModel.VALUE, this.listener);
+ this.preferenceAdapter.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener);
+ this.preferenceAdapter = new AlwaysUpdatePreferencePropertyValueModel<String>(this.nodeHolder, KEY_NAME);
+ this.preferenceAdapter.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener);
this.testNode.addPreferenceChangeListener(this.buildPreferenceChangeListener());
@@ -335,14 +337,18 @@ public class PreferencePropertyValueModelTests extends PreferencesTestCase {
};
}
- private void verifyEvent(Object oldValue, Object newValue) {
+ private void verifyEvent(Model source, Object oldValue, Object newValue) {
assertNotNull(this.event);
- assertEquals(this.preferenceAdapter, this.event.getSource());
- assertEquals(ValueModel.VALUE, this.event.propertyName());
+ assertEquals(source, this.event.getSource());
+ assertEquals(PropertyValueModel.VALUE, this.event.propertyName());
assertEquals(oldValue, this.event.oldValue());
assertEquals(newValue, this.event.newValue());
}
+ private void verifyEvent(Object oldValue, Object newValue) {
+ this.verifyEvent(this.preferenceAdapter, oldValue, newValue);
+ }
+
private void verifyPreferenceEvent(Object newValue) {
assertNotNull(this.preferenceEvent);
assertEquals(this.testNode, this.preferenceEvent.getSource());
@@ -352,7 +358,7 @@ public class PreferencePropertyValueModelTests extends PreferencesTestCase {
}
private boolean nodeHasAnyPrefListeners(Preferences node) throws Exception {
- PreferenceChangeListener[] prefListeners = (PreferenceChangeListener[]) ClassTools.getFieldValue(node, "prefListeners");
+ PreferenceChangeListener[] prefListeners = (PreferenceChangeListener[]) ClassTools.fieldValue(node, "prefListeners");
return prefListeners.length > 0;
}
@@ -361,9 +367,9 @@ public class PreferencePropertyValueModelTests extends PreferencesTestCase {
* Use this adapter to test out always passing through the new value
* to the preference.
*/
- private class AlwaysUpdatePreferencePropertyValueModel extends PreferencePropertyValueModel {
+ private class AlwaysUpdatePreferencePropertyValueModel<P> extends PreferencePropertyValueModel<P> {
- AlwaysUpdatePreferencePropertyValueModel(ValueModel preferencesHolder, String key) {
+ AlwaysUpdatePreferencePropertyValueModel(PropertyValueModel<Preferences> preferencesHolder, String key) {
super(preferencesHolder, key);
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencesCollectionValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencesCollectionValueModelTests.java
index 3faa9cd162..822af01989 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencesCollectionValueModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencesCollectionValueModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -24,16 +24,16 @@ import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.prefs.PreferencePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.prefs.PreferencesCollectionValueModel;
public class PreferencesCollectionValueModelTests extends PreferencesTestCase {
- private Map expectedValues;
- private PropertyValueModel nodeHolder;
- PreferencesCollectionValueModel preferencesAdapter;
+ private Map<String, String> expectedValues;
+ private WritablePropertyValueModel<Preferences> nodeHolder;
+ PreferencesCollectionValueModel<String> preferencesAdapter;
CollectionChangeEvent event;
CollectionChangeListener listener;
private PropertyChangeListener itemListener;
@@ -52,13 +52,13 @@ public class PreferencesCollectionValueModelTests extends PreferencesTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.expectedValues = new HashMap();
+ this.expectedValues = new HashMap<String, String>();
this.testNode.put(KEY_NAME_1, STRING_VALUE_1); this.expectedValues.put(KEY_NAME_1, STRING_VALUE_1);
this.testNode.put(KEY_NAME_2, STRING_VALUE_2); this.expectedValues.put(KEY_NAME_2, STRING_VALUE_2);
this.testNode.put(KEY_NAME_3, STRING_VALUE_3); this.expectedValues.put(KEY_NAME_3, STRING_VALUE_3);
- this.nodeHolder = new SimplePropertyValueModel(this.testNode);
- this.preferencesAdapter = new PreferencesCollectionValueModel(this.nodeHolder);
+ this.nodeHolder = new SimplePropertyValueModel<Preferences>(this.testNode);
+ this.preferencesAdapter = new PreferencesCollectionValueModel<String>(this.nodeHolder);
this.listener = this.buildCollectionChangeListener();
this.itemListener = this.buildItemListener();
this.preferencesAdapter.addCollectionChangeListener(CollectionValueModel.VALUES, this.listener);
@@ -114,18 +114,18 @@ public class PreferencesCollectionValueModelTests extends PreferencesTestCase {
this.nodeHolder.setValue(anotherNode);
// collectionChanged does not pass any items in the this.event
- this.verifyEvent(Collections.EMPTY_MAP);
+ this.verifyEvent(Collections.<String, String>emptyMap());
this.verifyAdapter(this.preferencesAdapter);
this.event = null;
this.expectedValues.clear();
this.nodeHolder.setValue(null);
this.verifyEvent(this.expectedValues);
- assertFalse(((Iterator) this.preferencesAdapter.iterator()).hasNext());
+ assertFalse(this.preferencesAdapter.iterator().hasNext());
this.event = null;
this.nodeHolder.setValue(this.testNode);
- this.verifyEvent(Collections.EMPTY_MAP);
+ this.verifyEvent(Collections.<String, String>emptyMap());
this.expectedValues.clear();
this.expectedValues.put(KEY_NAME_1, STRING_VALUE_1);
this.expectedValues.put(KEY_NAME_2, STRING_VALUE_2);
@@ -141,7 +141,7 @@ public class PreferencesCollectionValueModelTests extends PreferencesTestCase {
String ANOTHER_STRING_VALUE = "another string value";
this.testNode.put(ANOTHER_KEY_NAME, ANOTHER_STRING_VALUE);
this.waitForEventQueueToClear();
- Map expectedItems = new HashMap();
+ Map<String, String> expectedItems = new HashMap<String, String>();
expectedItems.put(ANOTHER_KEY_NAME, ANOTHER_STRING_VALUE);
this.verifyEvent(expectedItems);
this.expectedValues.put(ANOTHER_KEY_NAME, ANOTHER_STRING_VALUE);
@@ -159,7 +159,9 @@ public class PreferencesCollectionValueModelTests extends PreferencesTestCase {
assertEquals(this.preferencesAdapter, this.event.getSource());
assertEquals(CollectionValueModel.VALUES, this.event.collectionName());
assertEquals(1, this.event.itemsSize());
- assertEquals(KEY_NAME_2, ((PreferencePropertyValueModel) this.event.items().next()).getKey());
+ @SuppressWarnings("unchecked")
+ String key = ((PreferencePropertyValueModel<String>) this.event.items().next()).key();
+ assertEquals(KEY_NAME_2, key);
this.expectedValues.remove(KEY_NAME_2);
this.verifyAdapter(this.preferencesAdapter);
@@ -235,12 +237,14 @@ public class PreferencesCollectionValueModelTests extends PreferencesTestCase {
assertFalse(this.preferencesAdapter.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES));
}
- private void verifyEvent(Map items) {
+ private void verifyEvent(Map<String, String> items) {
assertNotNull(this.event);
assertEquals(this.preferencesAdapter, this.event.getSource());
assertEquals(CollectionValueModel.VALUES, this.event.collectionName());
assertEquals(items.size(), this.event.itemsSize());
- this.verifyItems(items, this.event.items());
+ @SuppressWarnings("unchecked")
+ Iterator<PreferencePropertyValueModel<String>> eventItems = (Iterator<PreferencePropertyValueModel<String>>) this.event.items();
+ this.verifyItems(items, eventItems);
}
private void verifyNode(Preferences node) throws Exception {
@@ -251,22 +255,22 @@ public class PreferencesCollectionValueModelTests extends PreferencesTestCase {
}
}
- private void verifyAdapter(PreferencesCollectionValueModel cvm) {
+ private void verifyAdapter(PreferencesCollectionValueModel<String> cvm) {
assertEquals(this.expectedValues.size(), cvm.size());
- this.verifyItems(this.expectedValues, (Iterator) cvm.iterator());
+ this.verifyItems(this.expectedValues, cvm.iterator());
}
- private void verifyItems(Map expected, Iterator stream) {
+ private void verifyItems(Map<String, String> expected, Iterator<PreferencePropertyValueModel<String>> stream) {
while (stream.hasNext()) {
- PreferencePropertyValueModel model = (PreferencePropertyValueModel) stream.next();
- model.addPropertyChangeListener(ValueModel.VALUE, this.itemListener);
- assertEquals(expected.get(model.getKey()), model.value());
- model.removePropertyChangeListener(ValueModel.VALUE, this.itemListener);
+ PreferencePropertyValueModel<String> model = stream.next();
+ model.addPropertyChangeListener(PropertyValueModel.VALUE, this.itemListener);
+ assertEquals(expected.get(model.key()), model.value());
+ model.removePropertyChangeListener(PropertyValueModel.VALUE, this.itemListener);
}
}
private boolean nodeHasAnyPrefListeners(Preferences node) throws Exception {
- PreferenceChangeListener[] prefListeners = (PreferenceChangeListener[]) ClassTools.getFieldValue(node, "prefListeners");
+ PreferenceChangeListener[] prefListeners = (PreferenceChangeListener[]) ClassTools.fieldValue(node, "prefListeners");
return prefListeners.length > 0;
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencesTestCase.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencesTestCase.java
index d2186909db..bca284a8fd 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencesTestCase.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencesTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -9,6 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.utility.tests.internal.model.value.prefs;
+import java.util.EventObject;
import java.util.List;
import java.util.prefs.AbstractPreferences;
import java.util.prefs.Preferences;
@@ -78,8 +79,9 @@ public abstract class PreferencesTestCase extends TestCase {
}
}
- private List preferencesEventQueue() {
- return (List) ClassTools.getStaticFieldValue(AbstractPreferences.class, "eventQueue");
+ @SuppressWarnings("unchecked")
+ private List<EventObject> preferencesEventQueue() {
+ return (List<EventObject>) ClassTools.staticFieldValue(AbstractPreferences.class, "eventQueue");
}
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/CheckBoxModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/CheckBoxModelAdapterTests.java
index 023885bea6..867577eca5 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/CheckBoxModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/CheckBoxModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -16,16 +16,16 @@ import javax.swing.event.EventListenerList;
import org.eclipse.jpt.utility.internal.ClassTools;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.CheckBoxModelAdapter;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class CheckBoxModelAdapterTests extends TestCase {
- private PropertyValueModel booleanHolder;
+ private WritablePropertyValueModel<Boolean> booleanHolder;
private ButtonModel buttonModelAdapter;
boolean eventFired;
@@ -36,7 +36,7 @@ public class CheckBoxModelAdapterTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.booleanHolder = new SimplePropertyValueModel(Boolean.TRUE);
+ this.booleanHolder = new SimplePropertyValueModel<Boolean>(Boolean.TRUE);
this.buttonModelAdapter = new CheckBoxModelAdapter(this.booleanHolder) {
@Override
protected PropertyChangeListener buildBooleanChangeListener() {
@@ -98,27 +98,27 @@ public class CheckBoxModelAdapterTests extends TestCase {
}
public void testHasListeners() throws Exception {
- SimplePropertyValueModel localBooleanHolder = (SimplePropertyValueModel) this.booleanHolder;
- assertFalse(localBooleanHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ SimplePropertyValueModel<Boolean> localBooleanHolder = (SimplePropertyValueModel<Boolean>) this.booleanHolder;
+ assertFalse(localBooleanHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasNoListeners(this.buttonModelAdapter);
ChangeListener listener = new TestChangeListener();
this.buttonModelAdapter.addChangeListener(listener);
- assertTrue(localBooleanHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(localBooleanHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasListeners(this.buttonModelAdapter);
this.buttonModelAdapter.removeChangeListener(listener);
- assertFalse(localBooleanHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertFalse(localBooleanHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasNoListeners(this.buttonModelAdapter);
}
private void verifyHasNoListeners(Object model) throws Exception {
- EventListenerList listenerList = (EventListenerList) ClassTools.getFieldValue(model, "listenerList");
+ EventListenerList listenerList = (EventListenerList) ClassTools.fieldValue(model, "listenerList");
assertEquals(0, listenerList.getListenerList().length);
}
private void verifyHasListeners(Object model) throws Exception {
- EventListenerList listenerList = (EventListenerList) ClassTools.getFieldValue(model, "listenerList");
+ EventListenerList listenerList = (EventListenerList) ClassTools.fieldValue(model, "listenerList");
assertFalse(listenerList.getListenerList().length == 0);
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/CheckBoxModelAdapterUITest.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/CheckBoxModelAdapterUITest.java
index 041b65d5be..fd3deba8d7 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/CheckBoxModelAdapterUITest.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/CheckBoxModelAdapterUITest.java
@@ -30,22 +30,21 @@ import javax.swing.WindowConstants;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.CheckBoxModelAdapter;
-
/**
* Play around with a set of check boxes.
*/
public class CheckBoxModelAdapterUITest {
private TestModel testModel;
- private PropertyValueModel testModelHolder;
- private PropertyValueModel flag1Holder;
- private PropertyValueModel flag2Holder;
- private PropertyValueModel notFlag2Holder;
+ private WritablePropertyValueModel<TestModel> testModelHolder;
+ private WritablePropertyValueModel<Boolean> flag1Holder;
+ private WritablePropertyValueModel<Boolean> flag2Holder;
+ private WritablePropertyValueModel<Boolean> notFlag2Holder;
private ButtonModel flag1ButtonModel;
private ButtonModel flag2ButtonModel;
private ButtonModel notFlag2ButtonModel;
@@ -60,7 +59,7 @@ public class CheckBoxModelAdapterUITest {
private void exec(String[] args) throws Exception {
this.testModel = new TestModel(true, true);
- this.testModelHolder = new SimplePropertyValueModel(this.testModel);
+ this.testModelHolder = new SimplePropertyValueModel<TestModel>(this.testModel);
this.flag1Holder = this.buildFlag1Holder(this.testModelHolder);
this.flag1ButtonModel = this.buildCheckBoxModelAdapter(this.flag1Holder);
this.flag2Holder = this.buildFlag2Holder(this.testModelHolder);
@@ -70,46 +69,46 @@ public class CheckBoxModelAdapterUITest {
this.openWindow();
}
- private PropertyValueModel buildFlag1Holder(ValueModel vm) {
- return new PropertyAspectAdapter(vm, TestModel.FLAG1_PROPERTY) {
+ private WritablePropertyValueModel<Boolean> buildFlag1Holder(PropertyValueModel<TestModel> vm) {
+ return new PropertyAspectAdapter<TestModel, Boolean>(vm, TestModel.FLAG1_PROPERTY) {
@Override
- protected Object buildValue_() {
- return Boolean.valueOf(((TestModel) this.subject).isFlag1());
+ protected Boolean buildValue_() {
+ return Boolean.valueOf(this.subject.isFlag1());
}
@Override
- protected void setValue_(Object value) {
- ((TestModel) this.subject).setFlag1(((Boolean) value).booleanValue());
+ protected void setValue_(Boolean value) {
+ this.subject.setFlag1(value.booleanValue());
}
};
}
- private PropertyValueModel buildFlag2Holder(ValueModel vm) {
- return new PropertyAspectAdapter(vm, TestModel.FLAG2_PROPERTY) {
+ private WritablePropertyValueModel<Boolean> buildFlag2Holder(PropertyValueModel<TestModel> vm) {
+ return new PropertyAspectAdapter<TestModel, Boolean>(vm, TestModel.FLAG2_PROPERTY) {
@Override
- protected Object buildValue_() {
- return Boolean.valueOf(((TestModel) this.subject).isFlag2());
+ protected Boolean buildValue_() {
+ return Boolean.valueOf(this.subject.isFlag2());
}
@Override
- protected void setValue_(Object value) {
- ((TestModel) this.subject).setFlag2(((Boolean) value).booleanValue());
+ protected void setValue_(Boolean value) {
+ this.subject.setFlag2(value.booleanValue());
}
};
}
- private PropertyValueModel buildNotFlag2Holder(ValueModel vm) {
- return new PropertyAspectAdapter(vm, TestModel.NOT_FLAG2_PROPERTY) {
+ private WritablePropertyValueModel<Boolean> buildNotFlag2Holder(PropertyValueModel<TestModel> vm) {
+ return new PropertyAspectAdapter<TestModel, Boolean>(vm, TestModel.NOT_FLAG2_PROPERTY) {
@Override
- protected Object buildValue_() {
- return Boolean.valueOf(((TestModel) this.subject).isNotFlag2());
+ protected Boolean buildValue_() {
+ return Boolean.valueOf(this.subject.isNotFlag2());
}
@Override
- protected void setValue_(Object value) {
- ((TestModel) this.subject).setNotFlag2(((Boolean) value).booleanValue());
+ protected void setValue_(Boolean value) {
+ this.subject.setNotFlag2(value.booleanValue());
}
};
}
- private ButtonModel buildCheckBoxModelAdapter(PropertyValueModel booleanHolder) {
+ private ButtonModel buildCheckBoxModelAdapter(WritablePropertyValueModel<Boolean> booleanHolder) {
return new CheckBoxModelAdapter(booleanHolder);
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ComboBoxModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ComboBoxModelAdapterTests.java
index 3514134ce7..4d58f274d3 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ComboBoxModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ComboBoxModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -22,11 +22,11 @@ import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimpleListValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.ComboBoxModelAdapter;
import org.eclipse.jpt.utility.internal.swing.Displayable;
import org.eclipse.jpt.utility.internal.swing.SimpleDisplayable;
-import org.eclipse.jpt.utility.tests.internal.model.value.SynchronizedList;
+import org.eclipse.jpt.utility.tests.internal.model.value.CoordinatedList;
import junit.framework.TestCase;
@@ -51,25 +51,25 @@ public class ComboBoxModelAdapterTests extends TestCase {
public void testHasListeners() throws Exception {
SimpleListValueModel<Displayable> listHolder = this.buildListHolder();
assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
- SimplePropertyValueModel selectionHolder = new SimplePropertyValueModel(listHolder.iterator().next());
- assertFalse(selectionHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ SimplePropertyValueModel<Object> selectionHolder = new SimplePropertyValueModel<Object>(listHolder.iterator().next());
+ assertFalse(selectionHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
ComboBoxModel comboBoxModel = new ComboBoxModelAdapter(listHolder, selectionHolder);
assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
- assertFalse(selectionHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertFalse(selectionHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasNoListeners(comboBoxModel);
- SynchronizedList<Displayable> synchList = new SynchronizedList<Displayable>(comboBoxModel);
+ CoordinatedList<Displayable> synchList = new CoordinatedList<Displayable>(comboBoxModel);
PropertyChangeListener selectionListener = this.buildSelectionListener();
- selectionHolder.addPropertyChangeListener(ValueModel.VALUE, selectionListener);
+ selectionHolder.addPropertyChangeListener(PropertyValueModel.VALUE, selectionListener);
assertTrue(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
- assertTrue(selectionHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(selectionHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasListeners(comboBoxModel);
comboBoxModel.removeListDataListener(synchList);
- selectionHolder.removePropertyChangeListener(ValueModel.VALUE, selectionListener);
+ selectionHolder.removePropertyChangeListener(PropertyValueModel.VALUE, selectionListener);
assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
- assertFalse(selectionHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertFalse(selectionHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasNoListeners(comboBoxModel);
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest.java
index 3c7b9aa936..5e3d4cc418 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -35,10 +35,10 @@ import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimpleListValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.ComboBoxModelAdapter;
import org.eclipse.jpt.utility.internal.swing.FilteringListBrowser;
import org.eclipse.jpt.utility.internal.swing.ListChooser;
@@ -55,8 +55,8 @@ public class ComboBoxModelAdapterUITest {
protected JFrame window;
private TestModel testModel;
- private PropertyValueModel testModelHolder;
- private PropertyValueModel colorHolder;
+ private WritablePropertyValueModel<TestModel> testModelHolder;
+ private WritablePropertyValueModel<Object> colorHolder;
private SimpleListValueModel<String> colorListHolder;
protected ComboBoxModel colorComboBoxModel;
private int nextColorNumber = 0;
@@ -76,22 +76,22 @@ public class ComboBoxModelAdapterUITest {
// UIManager.setLookAndFeel(com.sun.java.swing.plaf.motif.MotifLookAndFeel.class.getName());
// UIManager.setLookAndFeel(oracle.bali.ewt.olaf.OracleLookAndFeel.class.getName());
this.testModel = this.buildTestModel();
- this.testModelHolder = new SimplePropertyValueModel(this.testModel);
+ this.testModelHolder = new SimplePropertyValueModel<TestModel>(this.testModel);
this.colorHolder = this.buildColorHolder(this.testModelHolder);
this.colorListHolder = this.buildColorListHolder();
this.colorComboBoxModel = this.buildComboBoxModelAdapter(this.colorListHolder, this.colorHolder);
this.openWindow();
}
- private PropertyValueModel buildColorHolder(ValueModel vm) {
- return new PropertyAspectAdapter(vm, TestModel.COLOR_PROPERTY) {
+ private WritablePropertyValueModel<Object> buildColorHolder(PropertyValueModel<TestModel> vm) {
+ return new PropertyAspectAdapter<TestModel, Object>(vm, TestModel.COLOR_PROPERTY) {
@Override
- protected Object buildValue_() {
- return ((TestModel) this.subject).getColor();
+ protected String buildValue_() {
+ return this.subject.getColor();
}
@Override
protected void setValue_(Object value) {
- ((TestModel) this.subject).setColor((String) value);
+ this.subject.setColor((String) value);
}
};
}
@@ -112,11 +112,11 @@ public class ComboBoxModelAdapterUITest {
// };
}
- protected ListValueModel uiColorListHolder() {
+ protected ListValueModel<String> uiColorListHolder() {
return this.colorListHolder;
}
- private ComboBoxModel buildComboBoxModelAdapter(ListValueModel listHolder, PropertyValueModel selectionHolder) {
+ private ComboBoxModel buildComboBoxModelAdapter(ListValueModel<String> listHolder, WritablePropertyValueModel<Object> selectionHolder) {
return new ComboBoxModelAdapter(listHolder, selectionHolder);
}
@@ -386,7 +386,7 @@ public class ComboBoxModelAdapterUITest {
}
@Override
protected ListBrowser buildBrowser() {
- return new FilteringListBrowser();
+ return new FilteringListBrowser<String>();
}
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest2.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest2.java
index 35eaee3648..176bdc8373 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest2.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest2.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -40,9 +40,9 @@ public class ComboBoxModelAdapterUITest2 extends ComboBoxModelAdapterUITest {
* add a null to the front of the list
*/
@Override
- protected ListValueModel uiColorListHolder() {
+ protected ListValueModel<String> uiColorListHolder() {
// the default is to prepend the wrapped list with a null item
- return new ExtendedListValueModelWrapper(super.uiColorListHolder());
+ return new ExtendedListValueModelWrapper<String>(super.uiColorListHolder());
}
/**
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/DateSpinnerModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/DateSpinnerModelAdapterTests.java
index 0e54bb9101..16864dc7fb 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/DateSpinnerModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/DateSpinnerModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -16,16 +16,16 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.DateSpinnerModelAdapter;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class DateSpinnerModelAdapterTests extends TestCase {
- private PropertyValueModel valueHolder;
+ private WritablePropertyValueModel<Object> valueHolder;
private SpinnerModel spinnerModelAdapter;
boolean eventFired;
@@ -36,7 +36,7 @@ public class DateSpinnerModelAdapterTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.valueHolder = new SimplePropertyValueModel(new Date());
+ this.valueHolder = new SimplePropertyValueModel<Object>(new Date());
this.spinnerModelAdapter = new DateSpinnerModelAdapter(this.valueHolder) {
@Override
protected PropertyChangeListener buildDateChangeListener() {
@@ -99,17 +99,17 @@ public class DateSpinnerModelAdapterTests extends TestCase {
}
public void testHasListeners() throws Exception {
- SimplePropertyValueModel localValueHolder = (SimplePropertyValueModel) this.valueHolder;
- assertFalse(localValueHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ SimplePropertyValueModel<Object> localValueHolder = (SimplePropertyValueModel<Object>) this.valueHolder;
+ assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasNoListeners(this.spinnerModelAdapter);
ChangeListener listener = new TestChangeListener();
this.spinnerModelAdapter.addChangeListener(listener);
- assertTrue(localValueHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasListeners(this.spinnerModelAdapter);
this.spinnerModelAdapter.removeChangeListener(listener);
- assertFalse(localValueHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasNoListeners(this.spinnerModelAdapter);
}
@@ -123,7 +123,7 @@ public class DateSpinnerModelAdapterTests extends TestCase {
public void testNullInitialValue() {
Date today = new Date();
- this.valueHolder = new SimplePropertyValueModel();
+ this.valueHolder = new SimplePropertyValueModel<Object>();
this.spinnerModelAdapter = new DateSpinnerModelAdapter(this.valueHolder, today) {
@Override
protected PropertyChangeListener buildDateChangeListener() {
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/DocumentAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/DocumentAdapterTests.java
index 3d7b80f015..a8dc1f645b 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/DocumentAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/DocumentAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -16,16 +16,16 @@ import javax.swing.text.Document;
import org.eclipse.jpt.utility.internal.ClassTools;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.DocumentAdapter;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class DocumentAdapterTests extends TestCase {
- private PropertyValueModel stringHolder;
+ private WritablePropertyValueModel<String> stringHolder;
Document documentAdapter;
boolean eventFired;
@@ -36,7 +36,7 @@ public class DocumentAdapterTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.stringHolder = new SimplePropertyValueModel("0123456789");
+ this.stringHolder = new SimplePropertyValueModel<String>("0123456789");
this.documentAdapter = new DocumentAdapter(this.stringHolder) {
@Override
protected PropertyChangeListener buildStringListener() {
@@ -115,28 +115,28 @@ public class DocumentAdapterTests extends TestCase {
}
public void testHasListeners() throws Exception {
- SimplePropertyValueModel localStringHolder = (SimplePropertyValueModel) this.stringHolder;
- assertFalse(localStringHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ SimplePropertyValueModel<String> localStringHolder = (SimplePropertyValueModel<String>) this.stringHolder;
+ assertFalse(localStringHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasNoListeners(this.documentAdapter);
DocumentListener listener = new TestDocumentListener();
this.documentAdapter.addDocumentListener(listener);
- assertTrue(localStringHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(localStringHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasListeners(this.documentAdapter);
this.documentAdapter.removeDocumentListener(listener);
- assertFalse(localStringHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertFalse(localStringHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasNoListeners(this.documentAdapter);
}
private void verifyHasNoListeners(Object document) throws Exception {
- Object delegate = ClassTools.getFieldValue(document, "delegate");
+ Object delegate = ClassTools.fieldValue(document, "delegate");
Object[] listeners = (Object[]) ClassTools.executeMethod(delegate, "getDocumentListeners");
assertEquals(0, listeners.length);
}
private void verifyHasListeners(Object document) throws Exception {
- Object delegate = ClassTools.getFieldValue(document, "delegate");
+ Object delegate = ClassTools.fieldValue(document, "delegate");
Object[] listeners = (Object[]) ClassTools.executeMethod(delegate, "getDocumentListeners");
assertFalse(listeners.length == 0);
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/DocumentAdapterUITest.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/DocumentAdapterUITest.java
index 8ea83d49f4..7ce248efc6 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/DocumentAdapterUITest.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/DocumentAdapterUITest.java
@@ -32,9 +32,9 @@ import javax.swing.text.PlainDocument;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.DocumentAdapter;
/**
@@ -44,8 +44,8 @@ public class DocumentAdapterUITest {
private TestModel testModel;
private static final String DEFAULT_NAME = "Scooby Doo";
- private PropertyValueModel testModelHolder;
- private PropertyValueModel nameHolder;
+ private WritablePropertyValueModel<TestModel> testModelHolder;
+ private WritablePropertyValueModel<String> nameHolder;
private Document nameDocument;
private Document upperCaseNameDocument;
@@ -59,31 +59,31 @@ public class DocumentAdapterUITest {
private void exec(String[] args) throws Exception {
this.testModel = new TestModel(DEFAULT_NAME);
- this.testModelHolder = new SimplePropertyValueModel(this.testModel);
+ this.testModelHolder = new SimplePropertyValueModel<TestModel>(this.testModel);
this.nameHolder = this.buildNameHolder(this.testModelHolder);
this.nameDocument = this.buildNameDocument(this.nameHolder);
this.upperCaseNameDocument = this.buildUpperCaseNameDocument(this.nameHolder);
this.openWindow();
}
- private PropertyValueModel buildNameHolder(ValueModel vm) {
- return new PropertyAspectAdapter(vm, TestModel.NAME_PROPERTY) {
+ private WritablePropertyValueModel<String> buildNameHolder(PropertyValueModel<TestModel> vm) {
+ return new PropertyAspectAdapter<TestModel, String>(vm, TestModel.NAME_PROPERTY) {
@Override
- protected Object buildValue_() {
- return ((TestModel) this.subject).getName();
+ protected String buildValue_() {
+ return this.subject.getName();
}
@Override
- protected void setValue_(Object value) {
- ((TestModel) this.subject).setName((String) value);
+ protected void setValue_(String value) {
+ this.subject.setName(value);
}
};
}
- private Document buildNameDocument(PropertyValueModel stringHolder) {
+ private Document buildNameDocument(WritablePropertyValueModel<String> stringHolder) {
return new DocumentAdapter(stringHolder);
}
- private Document buildUpperCaseNameDocument(PropertyValueModel stringHolder) {
+ private Document buildUpperCaseNameDocument(WritablePropertyValueModel<String> stringHolder) {
return new DocumentAdapter(stringHolder, this.buildUpperCaseNameDocumentDelegate());
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListModelAdapterTests.java
index 5e7562914a..a5f49b12dd 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -29,7 +29,7 @@ import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimpleListValueModel;
import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
import org.eclipse.jpt.utility.internal.model.value.swing.ListModelAdapter;
-import org.eclipse.jpt.utility.tests.internal.model.value.SynchronizedList;
+import org.eclipse.jpt.utility.tests.internal.model.value.CoordinatedList;
import junit.framework.TestCase;
@@ -51,7 +51,7 @@ public class ListModelAdapterTests extends TestCase {
super.tearDown();
}
- private ListModelAdapter buildListModel(ListValueModel listHolder) {
+ private ListModelAdapter buildListModel(ListValueModel<String> listHolder) {
return new ListModelAdapter(listHolder) {
@Override
protected ListChangeListener buildListChangeListener() {
@@ -60,7 +60,7 @@ public class ListModelAdapterTests extends TestCase {
};
}
- private ListModel buildListModel(CollectionValueModel collectionHolder) {
+ private ListModel buildListModel(CollectionValueModel<String> collectionHolder) {
return new ListModelAdapter(collectionHolder) {
@Override
protected ListChangeListener buildListChangeListener() {
@@ -70,9 +70,9 @@ public class ListModelAdapterTests extends TestCase {
}
public void testCollectionSynchronization() {
- SimpleCollectionValueModel collectionHolder = this.buildCollectionHolder();
+ SimpleCollectionValueModel<String> collectionHolder = this.buildCollectionHolder();
ListModel listModel = this.buildListModel(collectionHolder);
- SynchronizedList synchList = new SynchronizedList(listModel);
+ CoordinatedList<String> synchList = new CoordinatedList<String>(listModel);
assertEquals(6, synchList.size());
this.compare(listModel, synchList);
@@ -92,9 +92,9 @@ public class ListModelAdapterTests extends TestCase {
}
public void testListSynchronization() {
- SimpleListValueModel listHolder = this.buildListHolder();
+ SimpleListValueModel<String> listHolder = this.buildListHolder();
ListModel listModel = this.buildListModel(listHolder);
- SynchronizedList synchList = new SynchronizedList(listModel);
+ CoordinatedList<String> synchList = new CoordinatedList<String>(listModel);
assertEquals(6, synchList.size());
this.compare(listModel, synchList);
@@ -114,28 +114,28 @@ public class ListModelAdapterTests extends TestCase {
}
public void testSetModel() {
- SimpleListValueModel listHolder1 = this.buildListHolder();
+ SimpleListValueModel<String> listHolder1 = this.buildListHolder();
ListModelAdapter listModel = this.buildListModel(listHolder1);
- SynchronizedList synchList = new SynchronizedList(listModel);
+ CoordinatedList<String> synchList = new CoordinatedList<String>(listModel);
assertTrue(listHolder1.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
assertEquals(6, synchList.size());
this.compare(listModel, synchList);
- SimpleListValueModel listHolder2 = this.buildListHolder2();
+ SimpleListValueModel<String> listHolder2 = this.buildListHolder2();
listModel.setModel(listHolder2);
assertEquals(3, synchList.size());
this.compare(listModel, synchList);
assertTrue(listHolder1.hasNoListChangeListeners(ListValueModel.LIST_VALUES));
assertTrue(listHolder2.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
- listModel.setModel(new SimpleListValueModel());
+ listModel.setModel(new SimpleListValueModel<String>());
assertEquals(0, synchList.size());
this.compare(listModel, synchList);
assertTrue(listHolder1.hasNoListChangeListeners(ListValueModel.LIST_VALUES));
assertTrue(listHolder2.hasNoListChangeListeners(ListValueModel.LIST_VALUES));
}
- private void compare(ListModel listModel, List list) {
+ private void compare(ListModel listModel, List<String> list) {
assertEquals(listModel.getSize(), list.size());
for (int i = 0; i < listModel.getSize(); i++) {
assertEquals(listModel.getElementAt(i), list.get(i));
@@ -158,19 +158,19 @@ public class ListModelAdapterTests extends TestCase {
this.verifyListSort(this.buildCustomComparator());
}
- private Comparator buildCustomComparator() {
+ private Comparator<String> buildCustomComparator() {
// sort with reverse order
- return new Comparator() {
- public int compare(Object o1, Object o2) {
- return ((Comparable) o2).compareTo(o1);
+ return new Comparator<String>() {
+ public int compare(String s1, String s2) {
+ return s2.compareTo(s1);
}
};
}
- private void verifyCollectionSort(Comparator comparator) {
- SimpleCollectionValueModel collectionHolder = this.buildCollectionHolder();
- ListModel listModel = this.buildListModel(new SortedListValueModelAdapter(collectionHolder, comparator));
- SynchronizedList synchList = new SynchronizedList(listModel);
+ private void verifyCollectionSort(Comparator<String> comparator) {
+ SimpleCollectionValueModel<String> collectionHolder = this.buildCollectionHolder();
+ ListModel listModel = this.buildListModel(new SortedListValueModelAdapter<String>(collectionHolder, comparator));
+ CoordinatedList<String> synchList = new CoordinatedList<String>(listModel);
assertEquals(6, synchList.size());
this.compareSort(listModel, synchList, comparator);
@@ -187,10 +187,10 @@ public class ListModelAdapterTests extends TestCase {
this.compareSort(listModel, synchList, comparator);
}
- private void verifyListSort(Comparator comparator) {
- SimpleListValueModel listHolder = this.buildListHolder();
- ListModel listModel = this.buildListModel(new SortedListValueModelAdapter(listHolder, comparator));
- SynchronizedList synchList = new SynchronizedList(listModel);
+ private void verifyListSort(Comparator<String> comparator) {
+ SimpleListValueModel<String> listHolder = this.buildListHolder();
+ ListModel listModel = this.buildListModel(new SortedListValueModelAdapter<String>(listHolder, comparator));
+ CoordinatedList<String> synchList = new CoordinatedList<String>(listModel);
assertEquals(6, synchList.size());
this.compareSort(listModel, synchList, comparator);
@@ -208,26 +208,26 @@ public class ListModelAdapterTests extends TestCase {
this.compareSort(listModel, synchList, comparator);
}
- private void compareSort(ListModel listModel, List list, Comparator comparator) {
- SortedSet ss = new TreeSet(comparator);
+ private void compareSort(ListModel listModel, List<String> list, Comparator<String> comparator) {
+ SortedSet<String> ss = new TreeSet<String>(comparator);
for (int i = 0; i < listModel.getSize(); i++) {
- ss.add(listModel.getElementAt(i));
+ ss.add((String) listModel.getElementAt(i));
}
assertEquals(ss.size(), list.size());
- for (Iterator stream1 = ss.iterator(), stream2 = list.iterator(); stream1.hasNext(); ) {
+ for (Iterator<String> stream1 = ss.iterator(), stream2 = list.iterator(); stream1.hasNext(); ) {
assertEquals(stream1.next(), stream2.next());
}
}
public void testHasListeners() throws Exception {
- SimpleListValueModel listHolder = this.buildListHolder();
+ SimpleListValueModel<String> listHolder = this.buildListHolder();
assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
ListModel listModel = this.buildListModel(listHolder);
assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
this.verifyHasNoListeners(listModel);
- SynchronizedList synchList = new SynchronizedList(listModel);
+ CoordinatedList<String> synchList = new CoordinatedList<String>(listModel);
assertTrue(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES));
this.verifyHasListeners(listModel);
@@ -237,12 +237,12 @@ public class ListModelAdapterTests extends TestCase {
}
public void testGetSize() throws Exception {
- SimpleListValueModel listHolder = this.buildListHolder();
+ SimpleListValueModel<String> listHolder = this.buildListHolder();
ListModel listModel = this.buildListModel(listHolder);
this.verifyHasNoListeners(listModel);
assertEquals(6, listModel.getSize());
- SynchronizedList synchList = new SynchronizedList(listModel);
+ CoordinatedList<String> synchList = new CoordinatedList<String>(listModel);
this.verifyHasListeners(listModel);
assertEquals(6, listModel.getSize());
@@ -252,9 +252,9 @@ public class ListModelAdapterTests extends TestCase {
}
public void testGetElementAt() throws Exception {
- SimpleListValueModel listHolder = this.buildListHolder();
- ListModel listModel = this.buildListModel(new SortedListValueModelAdapter(listHolder));
- SynchronizedList synchList = new SynchronizedList(listModel);
+ SimpleListValueModel<String> listHolder = this.buildListHolder();
+ ListModel listModel = this.buildListModel(new SortedListValueModelAdapter<String>(listHolder));
+ CoordinatedList<String> synchList = new CoordinatedList<String>(listModel);
this.verifyHasListeners(listModel);
assertEquals("bar", listModel.getElementAt(0));
assertEquals("bar", synchList.get(0));
@@ -270,8 +270,8 @@ public class ListModelAdapterTests extends TestCase {
assertTrue(hasListeners);
}
- private SimpleCollectionValueModel buildCollectionHolder() {
- return new SimpleCollectionValueModel(this.buildCollection());
+ private SimpleCollectionValueModel<String> buildCollectionHolder() {
+ return new SimpleCollectionValueModel<String>(this.buildCollection());
}
private Collection<String> buildCollection() {
@@ -280,8 +280,8 @@ public class ListModelAdapterTests extends TestCase {
return bag;
}
- private SimpleListValueModel buildListHolder() {
- return new SimpleListValueModel(this.buildList());
+ private SimpleListValueModel<String> buildListHolder() {
+ return new SimpleListValueModel<String>(this.buildList());
}
private List<String> buildList() {
@@ -299,8 +299,8 @@ public class ListModelAdapterTests extends TestCase {
c.add("jaz");
}
- private SimpleListValueModel buildListHolder2() {
- return new SimpleListValueModel(this.buildList2());
+ private SimpleListValueModel<String> buildListHolder2() {
+ return new SimpleListValueModel<String>(this.buildList2());
}
private List<String> buildList2() {
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListModelAdapterUITest.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListModelAdapterUITest.java
index 45d7436b7d..46bc80a32e 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListModelAdapterUITest.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListModelAdapterUITest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -35,10 +35,11 @@ import javax.swing.JScrollPane;
import javax.swing.ListModel;
import javax.swing.WindowConstants;
+import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter;
import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
import org.eclipse.jpt.utility.internal.model.value.swing.ListModelAdapter;
@@ -49,7 +50,7 @@ import org.eclipse.jpt.utility.internal.swing.Displayable;
*/
public class ListModelAdapterUITest {
- private PropertyValueModel taskListHolder;
+ private WritablePropertyValueModel<TaskList> taskListHolder;
private TextField taskTextField;
public static void main(String[] args) throws Exception {
@@ -61,7 +62,7 @@ public class ListModelAdapterUITest {
}
private void exec(String[] args) throws Exception {
- this.taskListHolder = new SimplePropertyValueModel(new TaskList());
+ this.taskListHolder = new SimplePropertyValueModel<TaskList>(new TaskList());
this.openWindow();
}
@@ -143,11 +144,11 @@ public class ListModelAdapterUITest {
}
private ListModel buildStandardSortedPrimitiveListModel() {
- return new ListModelAdapter(new SortedListValueModelAdapter(this.buildPrimitiveTaskListAdapter()));
+ return new ListModelAdapter(new SortedListValueModelAdapter<String>(this.buildPrimitiveTaskListAdapter()));
}
private ListModel buildCustomSortedPrimitiveListModel() {
- return new ListModelAdapter(new SortedListValueModelAdapter(this.buildPrimitiveTaskListAdapter(), this.buildCustomStringComparator()));
+ return new ListModelAdapter(new SortedListValueModelAdapter<String>(this.buildPrimitiveTaskListAdapter(), this.buildCustomStringComparator()));
}
private ListModel buildUnsortedDisplayableListModel() {
@@ -155,11 +156,11 @@ public class ListModelAdapterUITest {
}
private ListModel buildStandardSortedDisplayableListModel() {
- return new ListModelAdapter(new SortedListValueModelAdapter(this.buildDisplayableTaskListAdapter()));
+ return new ListModelAdapter(new SortedListValueModelAdapter<Task>(this.buildDisplayableTaskListAdapter()));
}
private ListModel buildCustomSortedDisplayableListModel() {
- return new ListModelAdapter(new SortedListValueModelAdapter(this.buildDisplayableTaskListAdapter(), this.buildCustomTaskObjectComparator()));
+ return new ListModelAdapter(new SortedListValueModelAdapter<Task>(this.buildDisplayableTaskListAdapter(), this.buildCustomTaskObjectComparator()));
}
private Component buildListPanel(String label, ListModel listModel) {
@@ -183,28 +184,28 @@ public class ListModelAdapterUITest {
};
}
- private Comparator<TaskObject> buildCustomTaskObjectComparator() {
- return new Comparator<TaskObject>() {
- public int compare(TaskObject to1, TaskObject to2) {
+ private Comparator<Task> buildCustomTaskObjectComparator() {
+ return new Comparator<Task>() {
+ public int compare(Task to1, Task to2) {
return to2.compareTo(to1);
}
};
}
- private ListValueModel buildPrimitiveTaskListAdapter() {
- return new ListAspectAdapter(TaskList.TASKS_LIST, this.taskList()) {
+ private ListValueModel<String> buildPrimitiveTaskListAdapter() {
+ return new ListAspectAdapter<TaskList, String>(TaskList.TASK_NAMES_LIST, this.taskList()) {
@Override
protected ListIterator<String> listIterator_() {
- return ((TaskList) this.subject).tasks();
+ return this.subject.taskNames();
}
};
}
- private ListValueModel buildDisplayableTaskListAdapter() {
- return new ListAspectAdapter(TaskList.TASK_OBJECTS_LIST, this.taskList()) {
+ private ListValueModel<Task> buildDisplayableTaskListAdapter() {
+ return new ListAspectAdapter<TaskList, Task>(TaskList.TASKS_LIST, this.taskList()) {
@Override
- protected ListIterator<TaskObject> listIterator_() {
- return ((TaskList) this.subject).taskObjects();
+ protected ListIterator<Task> listIterator_() {
+ return this.subject.tasks();
}
};
}
@@ -229,7 +230,7 @@ public class ListModelAdapterUITest {
}
private TaskList taskList() {
- return (TaskList) this.taskListHolder.value();
+ return this.taskListHolder.value();
}
void addTask() {
@@ -298,50 +299,50 @@ public class ListModelAdapterUITest {
}
private class TaskList extends AbstractModel {
- private List<String> tasks = new ArrayList<String>();
- private List<TaskObject> taskObjects = new ArrayList<TaskObject>();
+ private List<String> taskNames = new ArrayList<String>();
+ private List<Task> taskObjects = new ArrayList<Task>();
+ public static final String TASK_NAMES_LIST = "taskNames";
public static final String TASKS_LIST = "tasks";
- public static final String TASK_OBJECTS_LIST = "taskObjects";
TaskList() {
super();
}
- public ListIterator<String> tasks() {
- return this.tasks.listIterator();
+ public ListIterator<String> taskNames() {
+ return this.taskNames.listIterator();
}
- public ListIterator<TaskObject> taskObjects() {
+ public ListIterator<Task> tasks() {
return this.taskObjects.listIterator();
}
- public void addTask(String task) {
- int index = this.tasks.size();
- this.tasks.add(index, task);
- this.fireItemAdded(TASKS_LIST, index, task);
+ public void addTask(String taskName) {
+ int index = this.taskNames.size();
+ this.taskNames.add(index, taskName);
+ this.fireItemAdded(TASK_NAMES_LIST, index, taskName);
- TaskObject taskObject = new TaskObject(task);
+ Task taskObject = new Task(taskName);
this.taskObjects.add(index, taskObject);
- this.fireItemAdded(TASK_OBJECTS_LIST, index, taskObject);
+ this.fireItemAdded(TASKS_LIST, index, taskObject);
}
- public void removeTask(String task) {
- int index = this.tasks.indexOf(task);
+ public void removeTask(String taskName) {
+ int index = this.taskNames.indexOf(taskName);
if (index != -1) {
- Object removedTask = this.tasks.remove(index);
- this.fireItemRemoved(TASKS_LIST, index, removedTask);
+ Object removedTask = this.taskNames.remove(index);
+ this.fireItemRemoved(TASK_NAMES_LIST, index, removedTask);
// assume the indexes match...
Object removedTaskObject = this.taskObjects.remove(index);
- this.fireItemRemoved(TASK_OBJECTS_LIST, index, removedTaskObject);
+ this.fireItemRemoved(TASKS_LIST, index, removedTaskObject);
}
}
public void clearTasks() {
- this.tasks.clear();
- this.fireListChanged(TASKS_LIST);
+ this.taskNames.clear();
+ this.fireListChanged(TASK_NAMES_LIST);
this.taskObjects.clear();
- this.fireListChanged(TASK_OBJECTS_LIST);
+ this.fireListChanged(TASKS_LIST);
}
}
- private class TaskObject extends AbstractModel implements Displayable {
+ private class Task extends AbstractModel implements Displayable {
private String name;
private Date creationTimeStamp;
- public TaskObject(String name) {
+ public Task(String name) {
this.name = name;
this.creationTimeStamp = new Date();
}
@@ -364,7 +365,7 @@ public class ListModelAdapterUITest {
}
@Override
public String toString() {
- return "TaskObject(" + this.displayString() + ")";
+ return StringTools.buildToStringFor(this, this.displayString());
}
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListSpinnerModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListSpinnerModelAdapterTests.java
index e4335a10dc..c9548dfc71 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListSpinnerModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListSpinnerModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -14,16 +14,16 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.ListSpinnerModelAdapter;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class ListSpinnerModelAdapterTests extends TestCase {
- private PropertyValueModel valueHolder;
+ private WritablePropertyValueModel<Object> valueHolder;
private SpinnerModel spinnerModelAdapter;
boolean eventFired;
private static final String[] VALUE_LIST = {"red", "green", "blue"};
@@ -36,7 +36,7 @@ public class ListSpinnerModelAdapterTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.valueHolder = new SimplePropertyValueModel(DEFAULT_VALUE);
+ this.valueHolder = new SimplePropertyValueModel<Object>(DEFAULT_VALUE);
this.spinnerModelAdapter = new ListSpinnerModelAdapter(this.valueHolder, VALUE_LIST) {
@Override
protected PropertyChangeListener buildValueChangeListener() {
@@ -100,17 +100,17 @@ public class ListSpinnerModelAdapterTests extends TestCase {
}
public void testHasListeners() throws Exception {
- SimplePropertyValueModel localValueHolder = (SimplePropertyValueModel) this.valueHolder;
- assertFalse(localValueHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ SimplePropertyValueModel<Object> localValueHolder = (SimplePropertyValueModel<Object>) this.valueHolder;
+ assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasNoListeners(this.spinnerModelAdapter);
ChangeListener listener = new TestChangeListener();
this.spinnerModelAdapter.addChangeListener(listener);
- assertTrue(localValueHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasListeners(this.spinnerModelAdapter);
this.spinnerModelAdapter.removeChangeListener(listener);
- assertFalse(localValueHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasNoListeners(this.spinnerModelAdapter);
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/NumberSpinnerModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/NumberSpinnerModelAdapterTests.java
index 10b22946bb..2f48ee864c 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/NumberSpinnerModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/NumberSpinnerModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -14,16 +14,16 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.NumberSpinnerModelAdapter;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class NumberSpinnerModelAdapterTests extends TestCase {
- private PropertyValueModel valueHolder;
+ private WritablePropertyValueModel<Number> valueHolder;
private SpinnerModel spinnerModelAdapter;
boolean eventFired;
@@ -34,7 +34,7 @@ public class NumberSpinnerModelAdapterTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.valueHolder = new SimplePropertyValueModel(new Integer(0));
+ this.valueHolder = new SimplePropertyValueModel<Number>(new Integer(0));
this.spinnerModelAdapter = new NumberSpinnerModelAdapter(this.valueHolder, -33, 33, 1) {
@Override
protected PropertyChangeListener buildNumberChangeListener() {
@@ -91,17 +91,17 @@ public class NumberSpinnerModelAdapterTests extends TestCase {
}
public void testHasListeners() throws Exception {
- SimplePropertyValueModel localValueHolder = (SimplePropertyValueModel) this.valueHolder;
- assertFalse(localValueHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ SimplePropertyValueModel<Number> localValueHolder = (SimplePropertyValueModel<Number>) this.valueHolder;
+ assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasNoListeners(this.spinnerModelAdapter);
ChangeListener listener = new TestChangeListener();
this.spinnerModelAdapter.addChangeListener(listener);
- assertTrue(localValueHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasListeners(this.spinnerModelAdapter);
this.spinnerModelAdapter.removeChangeListener(listener);
- assertFalse(localValueHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasNoListeners(this.spinnerModelAdapter);
}
@@ -114,7 +114,7 @@ public class NumberSpinnerModelAdapterTests extends TestCase {
}
public void testNullInitialValue() {
- this.valueHolder = new SimplePropertyValueModel();
+ this.valueHolder = new SimplePropertyValueModel<Number>();
this.spinnerModelAdapter = new NumberSpinnerModelAdapter(this.valueHolder, new Integer(-33), new Integer(33), new Integer(1), new Integer(0)) {
@Override
protected PropertyChangeListener buildNumberChangeListener() {
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ObjectListSelectionModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ObjectListSelectionModelTests.java
index 13aea760de..1935068f27 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ObjectListSelectionModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ObjectListSelectionModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -56,22 +56,22 @@ public class ObjectListSelectionModelTests extends TestCase {
public void testListDataListener() {
this.selectionModel.addListSelectionListener(this.buildListSelectionListener());
this.selectionModel.setSelectionInterval(0, 0);
- assertEquals("foo", this.selectionModel.getSelectedValue());
+ assertEquals("foo", this.selectionModel.selectedValue());
this.listModel.set(0, "jar");
- assertEquals("jar", this.selectionModel.getSelectedValue());
+ assertEquals("jar", this.selectionModel.selectedValue());
}
public void testGetSelectedValue() {
this.selectionModel.setSelectionInterval(0, 0);
- assertEquals("foo", this.selectionModel.getSelectedValue());
+ assertEquals("foo", this.selectionModel.selectedValue());
}
public void testGetSelectedValues() {
this.selectionModel.setSelectionInterval(0, 0);
this.selectionModel.addSelectionInterval(2, 2);
- assertEquals(2, this.selectionModel.getSelectedValues().length);
- assertTrue(CollectionTools.contains(this.selectionModel.getSelectedValues(), "foo"));
- assertTrue(CollectionTools.contains(this.selectionModel.getSelectedValues(), "baz"));
+ assertEquals(2, this.selectionModel.selectedValues().length);
+ assertTrue(CollectionTools.contains(this.selectionModel.selectedValues(), "foo"));
+ assertTrue(CollectionTools.contains(this.selectionModel.selectedValues(), "baz"));
}
public void testSetSelectedValue() {
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/PrimitiveListTreeModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/PrimitiveListTreeModelTests.java
index 98a293aa4e..ca03eca987 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/PrimitiveListTreeModelTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/PrimitiveListTreeModelTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -63,31 +63,19 @@ public class PrimitiveListTreeModelTests extends TestCase {
};
}
- private ListValueModel buildListValueModel() {
- return new ListAspectAdapter(TestModel.NAMES_LIST, this.testModel) {
+ private ListValueModel<?> buildListValueModel() {
+ return new ListAspectAdapter<TestModel, String>(TestModel.NAMES_LIST, this.testModel) {
@Override
- protected ListIterator listIterator_() {
- return ((TestModel) this.subject).names();
+ protected ListIterator<String> listIterator_() {
+ return this.subject.names();
}
@Override
- public Object get(int index) {
- return ((TestModel) this.subject).getName(index);
+ public String get(int index) {
+ return this.subject.getName(index);
}
@Override
public int size() {
- return ((TestModel) this.subject).namesSize();
- }
- public void add(int index, Object item) {
- ((TestModel) this.subject).addName(index, (String) item);
- }
- public void addAll(int index, List items) {
- ((TestModel) this.subject).addNames(index, items);
- }
- public Object remove(int index) {
- return ((TestModel) this.subject).removeName(index);
- }
- public List remove(int index, int length) {
- return ((TestModel) this.subject).removeNames(index, length);
+ return this.subject.namesSize();
}
};
}
@@ -176,16 +164,16 @@ public class PrimitiveListTreeModelTests extends TestCase {
public void addName(String name) {
this.addName(this.namesSize(), name);
}
- public void addNames(int index, List list) {
+ public void addNames(int index, List<String> list) {
this.addItemsToList(index, this.names, list, NAMES_LIST);
}
- public void addNames(List list) {
+ public void addNames(List<String> list) {
this.addNames(this.namesSize(), list);
}
public String removeName(int index) {
- return (String) this.removeItemFromList(index, this.names, NAMES_LIST);
+ return this.removeItemFromList(index, this.names, NAMES_LIST);
}
- public List removeNames(int index, int length) {
+ public List<String> removeNames(int index, int length) {
return this.removeItemsFromList(index, length, this.names, NAMES_LIST);
}
public String replaceName(int index, String newName) {
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/RadioButtonModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/RadioButtonModelAdapterTests.java
index 3aef932df8..3855fb82ce 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/RadioButtonModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/RadioButtonModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -16,16 +16,16 @@ import javax.swing.event.EventListenerList;
import org.eclipse.jpt.utility.internal.ClassTools;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.RadioButtonModelAdapter;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class RadioButtonModelAdapterTests extends TestCase {
- private PropertyValueModel valueHolder;
+ private WritablePropertyValueModel<Object> valueHolder;
private ButtonModel redButtonModelAdapter;
private ChangeListener redListener;
@@ -52,7 +52,7 @@ public class RadioButtonModelAdapterTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.valueHolder = new SimplePropertyValueModel(null);
+ this.valueHolder = new SimplePropertyValueModel<Object>(null);
// buttonGroup = new ButtonGroup();
this.redButtonModelAdapter = this.buildButtonModel(this.valueHolder, RED);
@@ -85,7 +85,7 @@ public class RadioButtonModelAdapterTests extends TestCase {
this.clearFlags();
}
- private ButtonModel buildButtonModel(PropertyValueModel pvm, Object buttonValue) {
+ private ButtonModel buildButtonModel(WritablePropertyValueModel<Object> pvm, Object buttonValue) {
return new RadioButtonModelAdapter(pvm, buttonValue) {
@Override
protected PropertyChangeListener buildBooleanChangeListener() {
@@ -188,33 +188,33 @@ public class RadioButtonModelAdapterTests extends TestCase {
}
public void testHasListeners() throws Exception {
- SimplePropertyValueModel localValueHolder = (SimplePropertyValueModel) this.valueHolder;
- assertFalse(localValueHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ SimplePropertyValueModel<Object> localValueHolder = (SimplePropertyValueModel<Object>) this.valueHolder;
+ assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasNoListeners(this.redButtonModelAdapter);
this.verifyHasNoListeners(this.greenButtonModelAdapter);
this.verifyHasNoListeners(this.blueButtonModelAdapter);
ChangeListener listener = new TestChangeListener();
this.redButtonModelAdapter.addChangeListener(listener);
- assertTrue(localValueHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasListeners(this.redButtonModelAdapter);
this.verifyHasNoListeners(this.greenButtonModelAdapter);
this.verifyHasNoListeners(this.blueButtonModelAdapter);
this.redButtonModelAdapter.removeChangeListener(listener);
- assertFalse(localValueHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasNoListeners(this.redButtonModelAdapter);
this.verifyHasNoListeners(this.greenButtonModelAdapter);
this.verifyHasNoListeners(this.blueButtonModelAdapter);
}
private void verifyHasNoListeners(Object model) throws Exception {
- EventListenerList listenerList = (EventListenerList) ClassTools.getFieldValue(model, "listenerList");
+ EventListenerList listenerList = (EventListenerList) ClassTools.fieldValue(model, "listenerList");
assertEquals(0, listenerList.getListenerList().length);
}
private void verifyHasListeners(Object model) throws Exception {
- EventListenerList listenerList = (EventListenerList) ClassTools.getFieldValue(model, "listenerList");
+ EventListenerList listenerList = (EventListenerList) ClassTools.fieldValue(model, "listenerList");
assertFalse(listenerList.getListenerList().length == 0);
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/RadioButtonModelAdapterUITest.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/RadioButtonModelAdapterUITest.java
index 05885bcd3d..dde90666fd 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/RadioButtonModelAdapterUITest.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/RadioButtonModelAdapterUITest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -29,9 +29,9 @@ import javax.swing.WindowConstants;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.RadioButtonModelAdapter;
@@ -41,8 +41,8 @@ import org.eclipse.jpt.utility.internal.model.value.swing.RadioButtonModelAdapte
public class RadioButtonModelAdapterUITest {
private TestModel testModel;
- private PropertyValueModel testModelHolder;
- private PropertyValueModel colorHolder;
+ private WritablePropertyValueModel<TestModel> testModelHolder;
+ private WritablePropertyValueModel<Object> colorHolder;
private ButtonModel redButtonModel;
private ButtonModel greenButtonModel;
private ButtonModel blueButtonModel;
@@ -57,7 +57,7 @@ public class RadioButtonModelAdapterUITest {
private void exec(String[] args) throws Exception {
this.testModel = new TestModel();
- this.testModelHolder = new SimplePropertyValueModel(this.testModel);
+ this.testModelHolder = new SimplePropertyValueModel<TestModel>(this.testModel);
this.colorHolder = this.buildColorHolder(this.testModelHolder);
this.redButtonModel = this.buildRadioButtonModelAdapter(this.colorHolder, TestModel.RED);
this.greenButtonModel = this.buildRadioButtonModelAdapter(this.colorHolder, TestModel.GREEN);
@@ -65,20 +65,20 @@ public class RadioButtonModelAdapterUITest {
this.openWindow();
}
- private PropertyValueModel buildColorHolder(ValueModel subjectHolder) {
- return new PropertyAspectAdapter(subjectHolder, TestModel.COLOR_PROPERTY) {
+ private WritablePropertyValueModel<Object> buildColorHolder(PropertyValueModel<TestModel> subjectHolder) {
+ return new PropertyAspectAdapter<TestModel, Object>(subjectHolder, TestModel.COLOR_PROPERTY) {
@Override
protected Object buildValue_() {
- return ((TestModel) this.subject).getColor();
+ return this.subject.getColor();
}
@Override
protected void setValue_(Object value) {
- ((TestModel) this.subject).setColor((String) value);
+ this.subject.setColor((String) value);
}
};
}
- private ButtonModel buildRadioButtonModelAdapter(PropertyValueModel colorPVM, String color) {
+ private ButtonModel buildRadioButtonModelAdapter(WritablePropertyValueModel<Object> colorPVM, String color) {
return new RadioButtonModelAdapter(colorPVM, color);
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ReadOnlyTableModelAdapterUITest.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ReadOnlyTableModelAdapterUITest.java
index 827b625b49..3bfb66f4ba 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ReadOnlyTableModelAdapterUITest.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ReadOnlyTableModelAdapterUITest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -30,7 +30,7 @@ public class ReadOnlyTableModelAdapterUITest extends TableModelAdapterUITest {
protected ColumnAdapter buildColumnAdapter() {
return new PersonColumnAdapter() {
@Override
- public boolean isColumnEditable(int index) {
+ public boolean columnIsEditable(int index) {
return false;
}
};
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/SpinnerModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/SpinnerModelAdapterTests.java
index 497fbfc9ac..a8d03e556a 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/SpinnerModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/SpinnerModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -15,16 +15,16 @@ import javax.swing.event.ChangeListener;
import org.eclipse.jpt.utility.internal.ClassTools;
import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.SpinnerModelAdapter;
import org.eclipse.jpt.utility.tests.internal.TestTools;
import junit.framework.TestCase;
public class SpinnerModelAdapterTests extends TestCase {
- private PropertyValueModel valueHolder;
+ private WritablePropertyValueModel<Object> valueHolder;
SpinnerModel spinnerModelAdapter;
boolean eventFired;
@@ -35,7 +35,7 @@ public class SpinnerModelAdapterTests extends TestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
- this.valueHolder = new SimplePropertyValueModel(new Integer(0));
+ this.valueHolder = new SimplePropertyValueModel<Object>(new Integer(0));
this.spinnerModelAdapter = new SpinnerModelAdapter(this.valueHolder) {
@Override
protected PropertyChangeListener buildValueListener() {
@@ -80,28 +80,28 @@ public class SpinnerModelAdapterTests extends TestCase {
}
public void testHasListeners() throws Exception {
- SimplePropertyValueModel localValueHolder = (SimplePropertyValueModel) this.valueHolder;
- assertFalse(localValueHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ SimplePropertyValueModel<Object> localValueHolder = (SimplePropertyValueModel<Object>) this.valueHolder;
+ assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasNoListeners(this.spinnerModelAdapter);
ChangeListener listener = new TestChangeListener();
this.spinnerModelAdapter.addChangeListener(listener);
- assertTrue(localValueHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertTrue(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasListeners(this.spinnerModelAdapter);
this.spinnerModelAdapter.removeChangeListener(listener);
- assertFalse(localValueHolder.hasAnyPropertyChangeListeners(ValueModel.VALUE));
+ assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE));
this.verifyHasNoListeners(this.spinnerModelAdapter);
}
private void verifyHasNoListeners(Object adapter) throws Exception {
- Object delegate = ClassTools.getFieldValue(adapter, "delegate");
+ Object delegate = ClassTools.fieldValue(adapter, "delegate");
Object[] listeners = (Object[]) ClassTools.executeMethod(delegate, "getChangeListeners");
assertEquals(0, listeners.length);
}
private void verifyHasListeners(Object adapter) throws Exception {
- Object delegate = ClassTools.getFieldValue(adapter, "delegate");
+ Object delegate = ClassTools.fieldValue(adapter, "delegate");
Object[] listeners = (Object[]) ClassTools.executeMethod(delegate, "getChangeListeners");
assertFalse(listeners.length == 0);
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/SpinnerModelAdapterUITest.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/SpinnerModelAdapterUITest.java
index 45a64beca5..742a218647 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/SpinnerModelAdapterUITest.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/SpinnerModelAdapterUITest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -31,9 +31,9 @@ import javax.swing.WindowConstants;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.DateSpinnerModelAdapter;
import org.eclipse.jpt.utility.internal.model.value.swing.ListSpinnerModelAdapter;
import org.eclipse.jpt.utility.internal.model.value.swing.NumberSpinnerModelAdapter;
@@ -44,15 +44,15 @@ import org.eclipse.jpt.utility.internal.model.value.swing.NumberSpinnerModelAdap
public class SpinnerModelAdapterUITest {
private TestModel testModel;
- private PropertyValueModel testModelHolder;
+ private WritablePropertyValueModel<TestModel> testModelHolder;
- private PropertyValueModel birthDateHolder;
+ private WritablePropertyValueModel<Object> birthDateHolder;
private SpinnerModel birthDateSpinnerModel;
- private PropertyValueModel ageHolder;
+ private WritablePropertyValueModel<Number> ageHolder;
private SpinnerModel ageSpinnerModel;
- private PropertyValueModel eyeColorHolder;
+ private WritablePropertyValueModel<Object> eyeColorHolder;
private SpinnerModel eyeColorSpinnerModel;
@@ -66,7 +66,7 @@ public class SpinnerModelAdapterUITest {
private void exec(String[] args) throws Exception {
this.testModel = new TestModel();
- this.testModelHolder = new SimplePropertyValueModel(this.testModel);
+ this.testModelHolder = new SimplePropertyValueModel<TestModel>(this.testModel);
this.birthDateHolder = this.buildBirthDateHolder(this.testModelHolder);
this.birthDateSpinnerModel = this.buildBirthDateSpinnerModel(this.birthDateHolder);
@@ -80,54 +80,54 @@ public class SpinnerModelAdapterUITest {
this.openWindow();
}
- private PropertyValueModel buildBirthDateHolder(ValueModel vm) {
- return new PropertyAspectAdapter(vm, TestModel.BIRTH_DATE_PROPERTY) {
+ private WritablePropertyValueModel<Object> buildBirthDateHolder(PropertyValueModel<TestModel> vm) {
+ return new PropertyAspectAdapter<TestModel, Object>(vm, TestModel.BIRTH_DATE_PROPERTY) {
@Override
protected Object buildValue_() {
- return ((TestModel) this.subject).getBirthDate();
+ return this.subject.getBirthDate();
}
@Override
protected void setValue_(Object value) {
- ((TestModel) this.subject).setBirthDate((Date) value);
+ this.subject.setBirthDate((Date) value);
}
};
}
- private SpinnerModel buildBirthDateSpinnerModel(PropertyValueModel valueHolder) {
+ private SpinnerModel buildBirthDateSpinnerModel(WritablePropertyValueModel<Object> valueHolder) {
return new DateSpinnerModelAdapter(valueHolder);
}
- private PropertyValueModel buildAgeHolder(ValueModel vm) {
- return new PropertyAspectAdapter(vm, TestModel.AGE_PROPERTY) {
+ private WritablePropertyValueModel<Number> buildAgeHolder(PropertyValueModel<TestModel> vm) {
+ return new PropertyAspectAdapter<TestModel, Number>(vm, TestModel.AGE_PROPERTY) {
@Override
- protected Object buildValue_() {
- return new Integer(((TestModel) this.subject).getAge());
+ protected Number buildValue_() {
+ return new Integer(this.subject.getAge());
}
@Override
- protected void setValue_(Object value) {
- ((TestModel) this.subject).setAge(((Number) value).intValue());
+ protected void setValue_(Number value) {
+ this.subject.setAge(value.intValue());
}
};
}
- private SpinnerModel buildAgeSpinnerModel(PropertyValueModel valueHolder) {
- return new NumberSpinnerModelAdapter(valueHolder, ((Integer) valueHolder.value()).intValue(), TestModel.MIN_AGE, TestModel.MAX_AGE, 1);
+ private SpinnerModel buildAgeSpinnerModel(WritablePropertyValueModel<Number> valueHolder) {
+ return new NumberSpinnerModelAdapter(valueHolder, valueHolder.value().intValue(), TestModel.MIN_AGE, TestModel.MAX_AGE, 1);
}
- private PropertyValueModel buildEyeColorHolder(ValueModel vm) {
- return new PropertyAspectAdapter(vm, TestModel.EYE_COLOR_PROPERTY) {
+ private WritablePropertyValueModel<Object> buildEyeColorHolder(PropertyValueModel<TestModel> vm) {
+ return new PropertyAspectAdapter<TestModel, Object>(vm, TestModel.EYE_COLOR_PROPERTY) {
@Override
protected Object buildValue_() {
- return ((TestModel) this.subject).getEyeColor();
+ return this.subject.getEyeColor();
}
@Override
protected void setValue_(Object value) {
- ((TestModel) this.subject).setEyeColor((String) value);
+ this.subject.setEyeColor((String) value);
}
};
}
- private SpinnerModel buildEyeColorSpinnerModel(PropertyValueModel valueHolder) {
+ private SpinnerModel buildEyeColorSpinnerModel(WritablePropertyValueModel<Object> valueHolder) {
return new ListSpinnerModelAdapter(valueHolder, TestModel.VALID_EYE_COLORS);
}
@@ -334,6 +334,7 @@ public class SpinnerModelAdapterUITest {
this.eyeColor = eyeColor;
this.firePropertyChanged(EYE_COLOR_PROPERTY, old, eyeColor);
}
+ @Override
public String toString() {
return "TestModel(birth: " + this.getBirthDate() + " - eyes: " + this.eyeColor + ")";
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TableModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TableModelAdapterTests.java
index 4786bbfd41..db1a77a9a5 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TableModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TableModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -31,7 +31,7 @@ import org.eclipse.jpt.utility.internal.model.value.CollectionAspectAdapter;
import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
import org.eclipse.jpt.utility.internal.model.value.swing.ColumnAdapter;
import org.eclipse.jpt.utility.internal.model.value.swing.TableModelAdapter;
@@ -63,7 +63,7 @@ public class TableModelAdapterTests extends TestCase {
}
public void testGetRowCount() throws Exception {
- TableModelAdapter tableModelAdapter = this.buildTableModelAdapter();
+ TableModelAdapter<Person> tableModelAdapter = this.buildTableModelAdapter();
assertEquals(0, tableModelAdapter.getRowCount());
// we need to add a listener to wake up the adapter
tableModelAdapter.addTableModelListener(this.buildTableModelListener());
@@ -71,12 +71,12 @@ public class TableModelAdapterTests extends TestCase {
}
public void testGetColumnCount() throws Exception {
- TableModelAdapter tableModelAdapter = this.buildTableModelAdapter();
+ TableModelAdapter<Person> tableModelAdapter = this.buildTableModelAdapter();
assertEquals(PersonColumnAdapter.COLUMN_COUNT, tableModelAdapter.getColumnCount());
}
public void testGetValueAt() throws Exception {
- TableModelAdapter tableModelAdapter = this.buildTableModelAdapter();
+ TableModelAdapter<Person> tableModelAdapter = this.buildTableModelAdapter();
tableModelAdapter.addTableModelListener(this.buildTableModelListener());
List<String> sortedNames = this.sortedNames();
@@ -86,7 +86,7 @@ public class TableModelAdapterTests extends TestCase {
}
public void testSetValueAt() throws Exception {
- TableModelAdapter tableModelAdapter = this.buildTableModelAdapter();
+ TableModelAdapter<Person> tableModelAdapter = this.buildTableModelAdapter();
this.event = null;
tableModelAdapter.addTableModelListener(new TestTableModelListener() {
@Override
@@ -115,7 +115,7 @@ public class TableModelAdapterTests extends TestCase {
}
public void testAddRow() throws Exception {
- TableModelAdapter tableModelAdapter = this.buildTableModelAdapter();
+ TableModelAdapter<Person> tableModelAdapter = this.buildTableModelAdapter();
this.event = null;
tableModelAdapter.addTableModelListener(this.buildSingleEventListener());
// add a person to the end of the list so we only trigger one event
@@ -126,7 +126,7 @@ public class TableModelAdapterTests extends TestCase {
}
public void testRemoveRow() throws Exception {
- TableModelAdapter tableModelAdapter = this.buildTableModelAdapter();
+ TableModelAdapter<Person> tableModelAdapter = this.buildTableModelAdapter();
this.event = null;
tableModelAdapter.addTableModelListener(this.buildSingleEventListener());
// removing a person should only trigger one event, since a re-sort is not needed
@@ -137,7 +137,7 @@ public class TableModelAdapterTests extends TestCase {
}
public void testChangeCell() throws Exception {
- TableModelAdapter tableModelAdapter = this.buildTableModelAdapter();
+ TableModelAdapter<Person> tableModelAdapter = this.buildTableModelAdapter();
this.event = null;
tableModelAdapter.addTableModelListener(this.buildSingleEventListener());
// add a person to the end of the list so we only trigger one event
@@ -149,7 +149,7 @@ public class TableModelAdapterTests extends TestCase {
}
public void testLazyListListener() throws Exception {
- TableModelAdapter tableModelAdapter = this.buildTableModelAdapter();
+ TableModelAdapter<Person> tableModelAdapter = this.buildTableModelAdapter();
TableModelListener listener = this.buildTableModelListener();
assertTrue(this.crowd.hasNoCollectionChangeListeners(Crowd.PEOPLE_COLLECTION));
tableModelAdapter.addTableModelListener(listener);
@@ -159,7 +159,7 @@ public class TableModelAdapterTests extends TestCase {
}
public void testLazyCellListener() throws Exception {
- TableModelAdapter tableModelAdapter = this.buildTableModelAdapter();
+ TableModelAdapter<Person> tableModelAdapter = this.buildTableModelAdapter();
TableModelListener listener = this.buildTableModelListener();
Person person = this.crowd.personNamed("Gollum");
assertTrue(person.hasNoPropertyChangeListeners(Person.NAME_PROPERTY));
@@ -183,8 +183,8 @@ public class TableModelAdapterTests extends TestCase {
assertTrue(person.hasNoPropertyChangeListeners(Person.RANK_PROPERTY));
}
- private TableModelAdapter buildTableModelAdapter() {
- return new TableModelAdapter(this.buildSortedPeopleAdapter(), this.buildColumnAdapter()) {
+ private TableModelAdapter<Person> buildTableModelAdapter() {
+ return new TableModelAdapter<Person>(this.buildSortedPeopleAdapter(), this.buildColumnAdapter()) {
@Override
protected PropertyChangeListener buildCellListener() {
return this.buildCellListener_();
@@ -196,19 +196,19 @@ public class TableModelAdapterTests extends TestCase {
};
}
- private ListValueModel buildSortedPeopleAdapter() {
- return new SortedListValueModelAdapter(this.buildPeopleAdapter());
+ private ListValueModel<Person> buildSortedPeopleAdapter() {
+ return new SortedListValueModelAdapter<Person>(this.buildPeopleAdapter());
}
- private CollectionValueModel buildPeopleAdapter() {
- return new CollectionAspectAdapter(Crowd.PEOPLE_COLLECTION, this.crowd) {
+ private CollectionValueModel<Person> buildPeopleAdapter() {
+ return new CollectionAspectAdapter<Crowd, Person>(Crowd.PEOPLE_COLLECTION, this.crowd) {
@Override
protected Iterator<Person> iterator_() {
- return ((Crowd) this.subject).people();
+ return this.subject.people();
}
@Override
protected int size_() {
- return ((Crowd) this.subject).peopleSize();
+ return this.subject.peopleSize();
}
};
}
@@ -273,15 +273,15 @@ public class TableModelAdapterTests extends TestCase {
};
- public int getColumnCount() {
+ public int columnCount() {
return COLUMN_COUNT;
}
- public String getColumnName(int index) {
+ public String columnName(int index) {
return COLUMN_NAMES[index];
}
- public Class<?> getColumnClass(int index) {
+ public Class<?> columnClass(int index) {
switch (index) {
case NAME_COLUMN: return Object.class;
case BIRTH_DATE_COLUMN: return Date.class;
@@ -294,112 +294,113 @@ public class TableModelAdapterTests extends TestCase {
}
}
- public boolean isColumnEditable(int index) {
+ public boolean columnIsEditable(int index) {
return index != NAME_COLUMN;
}
- public PropertyValueModel[] cellModels(Object subject) {
+ public WritablePropertyValueModel<Object>[] cellModels(Object subject) {
Person person = (Person) subject;
- PropertyValueModel[] result = new PropertyValueModel[COLUMN_COUNT];
+ @SuppressWarnings("unchecked")
+ WritablePropertyValueModel<Object>[] result = new WritablePropertyValueModel[COLUMN_COUNT];
- result[NAME_COLUMN] = this.buildNameAdapter(person);
- result[BIRTH_DATE_COLUMN] = this.buildBirthDateAdapter(person);
- result[GONE_WEST_DATE_COLUMN] = this.buildGoneWestDateAdapter(person);
- result[EYE_COLOR_COLUMN] = this.buildEyeColorAdapter(person);
- result[EVIL_COLUMN] = this.buildEvilAdapter(person);
- result[RANK_COLUMN] = this.buildRankAdapter(person);
- result[ADVENTURE_COUNT_COLUMN] = this.buildAdventureCountAdapter(person);
+ result[NAME_COLUMN] = this.buildNameAdapter(person);
+ result[BIRTH_DATE_COLUMN] = this.buildBirthDateAdapter(person);
+ result[GONE_WEST_DATE_COLUMN] = this.buildGoneWestDateAdapter(person);
+ result[EYE_COLOR_COLUMN] = this.buildEyeColorAdapter(person);
+ result[EVIL_COLUMN] = this.buildEvilAdapter(person);
+ result[RANK_COLUMN] = this.buildRankAdapter(person);
+ result[ADVENTURE_COUNT_COLUMN] = this.buildAdventureCountAdapter(person);
return result;
}
- private PropertyValueModel buildNameAdapter(Person person) {
- return new PropertyAspectAdapter(Person.NAME_PROPERTY, person) {
+ private WritablePropertyValueModel<Object> buildNameAdapter(Person person) {
+ return new PropertyAspectAdapter<Person, Object>(Person.NAME_PROPERTY, person) {
@Override
- protected Object buildValue_() {
- return ((Person) this.subject).getName();
+ protected String buildValue_() {
+ return this.subject.getName();
}
@Override
protected void setValue_(Object value) {
- ((Person) this.subject).setName((String) value);
+ this.subject.setName((String) value);
}
};
}
- private PropertyValueModel buildBirthDateAdapter(Person person) {
- return new PropertyAspectAdapter(Person.BIRTH_DATE_PROPERTY, person) {
+ private WritablePropertyValueModel<Object> buildBirthDateAdapter(Person person) {
+ return new PropertyAspectAdapter<Person, Object>(Person.BIRTH_DATE_PROPERTY, person) {
@Override
- protected Object buildValue_() {
- return ((Person) this.subject).getBirthDate();
+ protected Date buildValue_() {
+ return this.subject.getBirthDate();
}
@Override
protected void setValue_(Object value) {
- ((Person) this.subject).setBirthDate((Date) value);
+ this.subject.setBirthDate((Date) value);
}
};
}
- private PropertyValueModel buildGoneWestDateAdapter(Person person) {
- return new PropertyAspectAdapter(Person.GONE_WEST_DATE_PROPERTY, person) {
+ private WritablePropertyValueModel<Object> buildGoneWestDateAdapter(Person person) {
+ return new PropertyAspectAdapter<Person, Object>(Person.GONE_WEST_DATE_PROPERTY, person) {
@Override
- protected Object buildValue_() {
- return ((Person) this.subject).getGoneWestDate();
+ protected Date buildValue_() {
+ return this.subject.getGoneWestDate();
}
@Override
protected void setValue_(Object value) {
- ((Person) this.subject).setGoneWestDate((Date) value);
+ this.subject.setGoneWestDate((Date) value);
}
};
}
- private PropertyValueModel buildEyeColorAdapter(Person person) {
- return new PropertyAspectAdapter(Person.EYE_COLOR_PROPERTY, person) {
+ private WritablePropertyValueModel<Object> buildEyeColorAdapter(Person person) {
+ return new PropertyAspectAdapter<Person, Object>(Person.EYE_COLOR_PROPERTY, person) {
@Override
- protected Object buildValue_() {
- return ((Person) this.subject).getEyeColor();
+ protected String buildValue_() {
+ return this.subject.getEyeColor();
}
@Override
protected void setValue_(Object value) {
- ((Person) this.subject).setEyeColor((String) value);
+ this.subject.setEyeColor((String) value);
}
};
}
- private PropertyValueModel buildEvilAdapter(Person person) {
- return new PropertyAspectAdapter(Person.EVIL_PROPERTY, person) {
+ private WritablePropertyValueModel<Object> buildEvilAdapter(Person person) {
+ return new PropertyAspectAdapter<Person, Object>(Person.EVIL_PROPERTY, person) {
@Override
- protected Object buildValue_() {
- return Boolean.valueOf(((Person) this.subject).isEvil());
+ protected Boolean buildValue_() {
+ return Boolean.valueOf(this.subject.isEvil());
}
@Override
protected void setValue_(Object value) {
- ((Person) this.subject).setEvil(((Boolean) value).booleanValue());
+ this.subject.setEvil(((Boolean)value).booleanValue());
}
};
}
- private PropertyValueModel buildRankAdapter(Person person) {
- return new PropertyAspectAdapter(Person.RANK_PROPERTY, person) {
+ private WritablePropertyValueModel<Object> buildRankAdapter(Person person) {
+ return new PropertyAspectAdapter<Person, Object>(Person.RANK_PROPERTY, person) {
@Override
- protected Object buildValue_() {
- return new Integer(((Person) this.subject).getRank());
+ protected Integer buildValue_() {
+ return new Integer(this.subject.getRank());
}
@Override
protected void setValue_(Object value) {
- ((Person) this.subject).setRank(((Integer) value).intValue());
+ this.subject.setRank(((Integer) value).intValue());
}
};
}
- private PropertyValueModel buildAdventureCountAdapter(Person person) {
- return new PropertyAspectAdapter(Person.ADVENTURE_COUNT_PROPERTY, person) {
+ private WritablePropertyValueModel<Object> buildAdventureCountAdapter(Person person) {
+ return new PropertyAspectAdapter<Person, Object>(Person.ADVENTURE_COUNT_PROPERTY, person) {
@Override
- protected Object buildValue_() {
- return new Integer(((Person) this.subject).getAdventureCount());
+ protected Integer buildValue_() {
+ return new Integer(this.subject.getAdventureCount());
}
@Override
protected void setValue_(Object value) {
- ((Person) this.subject).setAdventureCount(((Integer) value).intValue());
+ this.subject.setAdventureCount(((Integer) value).intValue());
}
};
}
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TableModelAdapterUITest.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TableModelAdapterUITest.java
index ded0db6c75..59f60b1e23 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TableModelAdapterUITest.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TableModelAdapterUITest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -16,6 +16,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
+import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
@@ -53,7 +54,7 @@ import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.ItemPropertyListValueModelAdapter;
import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimpleCollectionValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
@@ -88,10 +89,10 @@ import org.eclipse.jpt.utility.tests.internal.model.value.swing.TableModelAdapte
* list value model (the sorted people adapter)
*/
public class TableModelAdapterUITest {
- private SimpleCollectionValueModel eyeColorsHolder;
- private PropertyValueModel crowdHolder;
- private PropertyValueModel selectedPersonHolder;
- private ListValueModel sortedPeopleAdapter;
+ private SimpleCollectionValueModel<Object> eyeColorsHolder; // Object because it adapts to a combo-box
+ private WritablePropertyValueModel<Crowd> crowdHolder;
+ private WritablePropertyValueModel<Person> selectedPersonHolder;
+ private ListValueModel<Person> sortedPeopleAdapter;
private TableModel tableModel;
private ObjectListSelectionModel rowSelectionModel;
private Action removeAction;
@@ -116,12 +117,12 @@ public class TableModelAdapterUITest {
this.openWindow();
}
- private SimpleCollectionValueModel buildEyeColorCollectionHolder() {
- return new SimpleCollectionValueModel(Person.getValidEyeColors());
+ private SimpleCollectionValueModel<Object> buildEyeColorCollectionHolder() {
+ return new SimpleCollectionValueModel<Object>(new ArrayList<Object>(Person.getValidEyeColors()));
}
- private PropertyValueModel buildCrowdHolder() {
- return new SimplePropertyValueModel(this.buildCrowd());
+ private WritablePropertyValueModel<Crowd> buildCrowdHolder() {
+ return new SimplePropertyValueModel<Crowd>(this.buildCrowd());
}
private Crowd buildCrowd() {
@@ -151,34 +152,34 @@ public class TableModelAdapterUITest {
return crowd;
}
- private PropertyValueModel buildSelectedPersonHolder() {
- return new SimplePropertyValueModel();
+ private WritablePropertyValueModel<Person> buildSelectedPersonHolder() {
+ return new SimplePropertyValueModel<Person>();
}
- private ListValueModel buildSortedPeopleAdapter() {
- return new SortedListValueModelAdapter(this.buildPeopleNameAdapter());
+ private ListValueModel<Person> buildSortedPeopleAdapter() {
+ return new SortedListValueModelAdapter<Person>(this.buildPeopleNameAdapter());
}
// the list will need to be re-sorted if a name changes
- private ListValueModel buildPeopleNameAdapter() {
- return new ItemPropertyListValueModelAdapter(this.buildPeopleAdapter(), Person.NAME_PROPERTY);
+ private ListValueModel<Person> buildPeopleNameAdapter() {
+ return new ItemPropertyListValueModelAdapter<Person>(this.buildPeopleAdapter(), Person.NAME_PROPERTY);
}
- private CollectionValueModel buildPeopleAdapter() {
- return new CollectionAspectAdapter(this.crowdHolder, Crowd.PEOPLE_COLLECTION) {
+ private CollectionValueModel<Person> buildPeopleAdapter() {
+ return new CollectionAspectAdapter<Crowd, Person>(this.crowdHolder, Crowd.PEOPLE_COLLECTION) {
@Override
- protected Iterator iterator_() {
- return ((Crowd) this.subject).people();
+ protected Iterator<Person> iterator_() {
+ return this.subject.people();
}
@Override
protected int size_() {
- return ((Crowd) this.subject).peopleSize();
+ return this.subject.peopleSize();
}
};
}
private TableModel buildTableModel() {
- return new TableModelAdapter(this.sortedPeopleAdapter, this.buildColumnAdapter());
+ return new TableModelAdapter<Person>(this.sortedPeopleAdapter, this.buildColumnAdapter());
}
protected ColumnAdapter buildColumnAdapter() {
@@ -204,7 +205,7 @@ public class TableModelAdapterUITest {
}
void rowSelectionChanged(ListSelectionEvent e) {
- Object selection = this.rowSelectionModel.getSelectedValue();
+ Person selection = (Person) this.rowSelectionModel.selectedValue();
this.selectedPersonHolder.setValue(selection);
boolean personSelected = (selection != null);
this.removeAction.setEnabled(personSelected);
@@ -255,7 +256,7 @@ public class TableModelAdapterUITest {
SpinnerTableCellRenderer spinnerRenderer = this.buildDateSpinnerRenderer();
column.setCellRenderer(spinnerRenderer);
column.setCellEditor(new TableCellEditorAdapter(this.buildDateSpinnerRenderer()));
- rowHeight = Math.max(rowHeight, spinnerRenderer.getPreferredHeight());
+ rowHeight = Math.max(rowHeight, spinnerRenderer.preferredHeight());
// eye color column (combo-box)
// the jdk combo-box renderer looks like a text field
@@ -264,7 +265,7 @@ public class TableModelAdapterUITest {
ComboBoxTableCellRenderer eyeColorRenderer = this.buildEyeColorComboBoxRenderer();
column.setCellRenderer(eyeColorRenderer);
column.setCellEditor(new TableCellEditorAdapter(this.buildEyeColorComboBoxRenderer()));
- rowHeight = Math.max(rowHeight, eyeColorRenderer.getPreferredHeight());
+ rowHeight = Math.max(rowHeight, eyeColorRenderer.preferredHeight());
// evil (check box)
// the jdk check box renderer and editor suck - use a custom ones
@@ -272,25 +273,25 @@ public class TableModelAdapterUITest {
CheckBoxTableCellRenderer evilRenderer = new CheckBoxTableCellRenderer();
column.setCellRenderer(evilRenderer);
column.setCellEditor(new TableCellEditorAdapter(new CheckBoxTableCellRenderer()));
- rowHeight = Math.max(rowHeight, evilRenderer.getPreferredHeight());
+ rowHeight = Math.max(rowHeight, evilRenderer.preferredHeight());
// adventure count column (spinner)
column = table.getColumnModel().getColumn(PersonColumnAdapter.ADVENTURE_COUNT_COLUMN);
spinnerRenderer = this.buildNumberSpinnerRenderer();
column.setCellRenderer(spinnerRenderer);
column.setCellEditor(new TableCellEditorAdapter(this.buildNumberSpinnerRenderer()));
- rowHeight = Math.max(rowHeight, spinnerRenderer.getPreferredHeight());
+ rowHeight = Math.max(rowHeight, spinnerRenderer.preferredHeight());
table.setRowHeight(rowHeight);
return table;
}
private SpinnerTableCellRenderer buildDateSpinnerRenderer() {
- return new SpinnerTableCellRenderer(new DateSpinnerModelAdapter(new SimplePropertyValueModel()));
+ return new SpinnerTableCellRenderer(new DateSpinnerModelAdapter(new SimplePropertyValueModel<Object>()));
}
private SpinnerTableCellRenderer buildNumberSpinnerRenderer() {
- return new SpinnerTableCellRenderer(new NumberSpinnerModelAdapter(new SimplePropertyValueModel()));
+ return new SpinnerTableCellRenderer(new NumberSpinnerModelAdapter(new SimplePropertyValueModel<Number>()));
}
private ComboBoxTableCellRenderer buildEyeColorComboBoxRenderer() {
@@ -298,7 +299,7 @@ public class TableModelAdapterUITest {
}
private ComboBoxModel buildReadOnlyEyeColorComboBoxModel() {
- return new ComboBoxModelAdapter(this.eyeColorsHolder, new SimplePropertyValueModel());
+ return new ComboBoxModelAdapter(this.eyeColorsHolder, new SimplePropertyValueModel<Object>());
}
private ListCellRenderer buildEyeColorRenderer() {
@@ -443,7 +444,7 @@ public class TableModelAdapterUITest {
}
if ((eyeColor.length() == 0)) {
JOptionPane.showMessageDialog(null, "The eye color is required.", "Invalid Eye Color", JOptionPane.ERROR_MESSAGE);
- } else if (CollectionTools.contains((Iterator) this.eyeColorsHolder.iterator(), eyeColor)) {
+ } else if (CollectionTools.contains(this.eyeColorsHolder.iterator(), eyeColor)) {
JOptionPane.showMessageDialog(null, "The eye color already exists.", "Invalid Eye Color", JOptionPane.ERROR_MESSAGE);
} else {
return eyeColor;
@@ -532,15 +533,15 @@ public class TableModelAdapterUITest {
return new DocumentAdapter(this.buildNameAdapter());
}
- private PropertyValueModel buildNameAdapter() {
- return new PropertyAspectAdapter(this.selectedPersonHolder, Person.NAME_PROPERTY) {
+ private WritablePropertyValueModel<String> buildNameAdapter() {
+ return new PropertyAspectAdapter<Person, String>(this.selectedPersonHolder, Person.NAME_PROPERTY) {
@Override
- protected Object buildValue_() {
- return ((Person) this.subject).getName();
+ protected String buildValue_() {
+ return this.subject.getName();
}
@Override
- protected void setValue_(Object value) {
- ((Person) this.subject).setName((String) value);
+ protected void setValue_(String value) {
+ this.subject.setName(value);
}
};
}
@@ -556,15 +557,15 @@ public class TableModelAdapterUITest {
return new DateSpinnerModelAdapter(this.buildBirthDateAdapter());
}
- private PropertyValueModel buildBirthDateAdapter() {
- return new PropertyAspectAdapter(this.selectedPersonHolder, Person.BIRTH_DATE_PROPERTY) {
+ private WritablePropertyValueModel<Object> buildBirthDateAdapter() {
+ return new PropertyAspectAdapter<Person, Object>(this.selectedPersonHolder, Person.BIRTH_DATE_PROPERTY) {
@Override
- protected Object buildValue_() {
- return ((Person) this.subject).getBirthDate();
+ protected Date buildValue_() {
+ return this.subject.getBirthDate();
}
@Override
protected void setValue_(Object value) {
- ((Person) this.subject).setBirthDate((Date) value);
+ this.subject.setBirthDate((Date) value);
}
};
}
@@ -580,15 +581,15 @@ public class TableModelAdapterUITest {
return new DateSpinnerModelAdapter(this.buildGoneWestDateAdapter());
}
- private PropertyValueModel buildGoneWestDateAdapter() {
- return new PropertyAspectAdapter(this.selectedPersonHolder, Person.GONE_WEST_DATE_PROPERTY) {
+ private WritablePropertyValueModel<Object> buildGoneWestDateAdapter() {
+ return new PropertyAspectAdapter<Person, Object>(this.selectedPersonHolder, Person.GONE_WEST_DATE_PROPERTY) {
@Override
- protected Object buildValue_() {
- return ((Person) this.subject).getGoneWestDate();
+ protected Date buildValue_() {
+ return this.subject.getGoneWestDate();
}
@Override
protected void setValue_(Object value) {
- ((Person) this.subject).setGoneWestDate((Date) value);
+ this.subject.setGoneWestDate((Date) value);
}
};
}
@@ -604,15 +605,15 @@ public class TableModelAdapterUITest {
return new ComboBoxModelAdapter(this.eyeColorsHolder, this.buildEyeColorAdapter());
}
- private PropertyValueModel buildEyeColorAdapter() {
- return new PropertyAspectAdapter(this.selectedPersonHolder, Person.EYE_COLOR_PROPERTY) {
+ private WritablePropertyValueModel<Object> buildEyeColorAdapter() {
+ return new PropertyAspectAdapter<Person, Object>(this.selectedPersonHolder, Person.EYE_COLOR_PROPERTY) {
@Override
protected Object buildValue_() {
- return ((Person) this.subject).getEyeColor();
+ return this.subject.getEyeColor();
}
@Override
protected void setValue_(Object value) {
- ((Person) this.subject).setEyeColor((String) value);
+ this.subject.setEyeColor((String) value);
}
};
}
@@ -631,15 +632,15 @@ public class TableModelAdapterUITest {
return new CheckBoxModelAdapter(this.buildEvilAdapter());
}
- private PropertyValueModel buildEvilAdapter() {
- return new PropertyAspectAdapter(this.selectedPersonHolder, Person.EVIL_PROPERTY) {
+ private WritablePropertyValueModel<Boolean> buildEvilAdapter() {
+ return new PropertyAspectAdapter<Person, Boolean>(this.selectedPersonHolder, Person.EVIL_PROPERTY) {
@Override
- protected Object buildValue_() {
- return Boolean.valueOf(((Person) this.subject).isEvil());
+ protected Boolean buildValue_() {
+ return Boolean.valueOf(this.subject.isEvil());
}
@Override
- protected void setValue_(Object value) {
- ((Person) this.subject).setEvil(((Boolean) value).booleanValue());
+ protected void setValue_(Boolean value) {
+ this.subject.setEvil(value.booleanValue());
}
};
}
@@ -655,15 +656,15 @@ public class TableModelAdapterUITest {
return new NumberSpinnerModelAdapter(this.buildRankAdapter());
}
- private PropertyValueModel buildRankAdapter() {
- return new PropertyAspectAdapter(this.selectedPersonHolder, Person.RANK_PROPERTY) {
+ private WritablePropertyValueModel<Number> buildRankAdapter() {
+ return new PropertyAspectAdapter<Person, Number>(this.selectedPersonHolder, Person.RANK_PROPERTY) {
@Override
- protected Object buildValue_() {
- return new Integer(((Person) this.subject).getRank());
+ protected Number buildValue_() {
+ return new Integer(this.subject.getRank());
}
@Override
- protected void setValue_(Object value) {
- ((Person) this.subject).setRank(((Integer) value).intValue());
+ protected void setValue_(Number value) {
+ this.subject.setRank(value.intValue());
}
};
}
@@ -679,15 +680,15 @@ public class TableModelAdapterUITest {
return new NumberSpinnerModelAdapter(this.buildAdventureCountAdapter());
}
- private PropertyValueModel buildAdventureCountAdapter() {
- return new PropertyAspectAdapter(this.selectedPersonHolder, Person.ADVENTURE_COUNT_PROPERTY) {
+ private WritablePropertyValueModel<Number> buildAdventureCountAdapter() {
+ return new PropertyAspectAdapter<Person, Number>(this.selectedPersonHolder, Person.ADVENTURE_COUNT_PROPERTY) {
@Override
- protected Object buildValue_() {
- return new Integer(((Person) this.subject).getAdventureCount());
+ protected Number buildValue_() {
+ return new Integer(this.subject.getAdventureCount());
}
@Override
- protected void setValue_(Object value) {
- ((Person) this.subject).setAdventureCount(((Integer) value).intValue());
+ protected void setValue_(Number value) {
+ this.subject.setAdventureCount(value.intValue());
}
};
}
@@ -696,14 +697,14 @@ public class TableModelAdapterUITest {
// ********** queries **********
private Crowd crowd() {
- return (Crowd) this.crowdHolder.value();
+ return this.crowdHolder.value();
}
private Person selectedPerson() {
if (this.rowSelectionModel.isSelectionEmpty()) {
return null;
}
- return (Person) this.rowSelectionModel.getSelectedValue();
+ return (Person) this.rowSelectionModel.selectedValue();
}
private void setSelectedPerson(Person person) {
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TreeModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TreeModelAdapterTests.java
index ddbf7a8ae8..89c1b7a234 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TreeModelAdapterTests.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TreeModelAdapterTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -12,7 +12,6 @@ package org.eclipse.jpt.utility.tests.internal.model.value.swing;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
@@ -25,6 +24,7 @@ import javax.swing.tree.TreeModel;
import org.eclipse.jpt.utility.internal.HashBag;
import org.eclipse.jpt.utility.internal.IndentingPrintWriter;
+import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.iterators.ReadOnlyIterator;
import org.eclipse.jpt.utility.internal.model.AbstractModel;
import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent;
@@ -39,13 +39,13 @@ import org.eclipse.jpt.utility.internal.model.value.ListValueModel;
import org.eclipse.jpt.utility.internal.model.value.NullListValueModel;
import org.eclipse.jpt.utility.internal.model.value.PropertyAspectAdapter;
import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ReadOnlyPropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimpleListValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SortedListValueModelAdapter;
+import org.eclipse.jpt.utility.internal.model.value.StaticPropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.TransformationListValueModelAdapter;
import org.eclipse.jpt.utility.internal.model.value.TreeNodeValueModel;
-import org.eclipse.jpt.utility.internal.model.value.ValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.TreeModelAdapter;
import org.eclipse.jpt.utility.internal.swing.Displayable;
@@ -194,7 +194,7 @@ public class TreeModelAdapterTests extends TestCase {
}
public void testTreeStructureChanged() {
- PropertyValueModel nodeHolder = new SimplePropertyValueModel(this.buildSortedRootNode());
+ WritablePropertyValueModel<TreeNodeValueModel<Object>> nodeHolder = new SimplePropertyValueModel<TreeNodeValueModel<Object>>(this.buildSortedRootNode());
TreeModel treeModel = this.buildTreeModel(nodeHolder);
this.eventFired = false;
treeModel.addTreeModelListener(new TestTreeModelListener() {
@@ -290,7 +290,7 @@ public class TreeModelAdapterTests extends TestCase {
public static class TestModel extends AbstractModel {
// the parent is immutable; the root's parent is null
- private TestModel parent;
+ private final TestModel parent;
// the name is mutable; so I guess it isn't the "primary key" :-)
private String name;
@@ -301,13 +301,13 @@ public class TreeModelAdapterTests extends TestCase {
public TestModel(String name) { // root ctor
- super();
- this.name = name;
- this.children = new HashBag<TestModel>();
+ this(null, name);
}
private TestModel(TestModel parent, String name) {
- this(name);
+ super();
this.parent = parent;
+ this.name = name;
+ this.children = new HashBag<TestModel>();
}
public TestModel getParent() {
@@ -331,45 +331,28 @@ public class TreeModelAdapterTests extends TestCase {
}
public TestModel addChild(String childName) {
TestModel child = new TestModel(this, childName);
- this.children.add(child);
- this.fireItemAdded(CHILDREN_COLLECTION, child);
+ this.addItemToCollection(child, this.children, CHILDREN_COLLECTION);
return child;
}
public TestModel[] addChildren(String[] childNames) {
TestModel[] newChildren = new TestModel[childNames.length];
for (int i = 0; i < childNames.length; i++) {
- TestModel child = new TestModel(this, childNames[i]);
- this.children.add(child);
- newChildren[i] = child;
+ newChildren[i] = new TestModel(this, childNames[i]);
}
- this.fireItemsAdded(CHILDREN_COLLECTION, Arrays.asList(newChildren));
+ this.addItemsToCollection(newChildren, this.children, CHILDREN_COLLECTION);
return newChildren;
}
public void removeChild(TestModel child) {
- if (this.children.remove(child)) {
- this.fireItemRemoved(CHILDREN_COLLECTION, child);
- }
+ this.removeItemFromCollection(child, this.children, CHILDREN_COLLECTION);
}
public void removeChildren(TestModel[] testModels) {
- Collection<TestModel> removedChildren = new ArrayList<TestModel>();
- for (int i = 0; i < testModels.length; i++) {
- if (this.children.remove(testModels[i])) {
- removedChildren.add(testModels[i]);
- } else {
- throw new IllegalArgumentException(String.valueOf(testModels[i]));
- }
- }
- if ( ! removedChildren.isEmpty()) {
- this.fireItemsRemoved(CHILDREN_COLLECTION, removedChildren);
- }
+ this.removeItemsFromCollection(testModels, this.children, CHILDREN_COLLECTION);
}
public void clearChildren() {
- this.children.clear();
- this.fireCollectionChanged(CHILDREN_COLLECTION);
+ this.clearCollection(this.children, CHILDREN_COLLECTION);
}
public TestModel childNamed(String childName) {
- for (Iterator<TestModel> stream = this.children(); stream.hasNext(); ) {
- TestModel child = stream.next();
+ for (TestModel child : this.children) {
if (child.getName().equals(childName)) {
return child;
}
@@ -386,8 +369,8 @@ public class TreeModelAdapterTests extends TestCase {
public void dumpOn(IndentingPrintWriter writer) {
writer.println(this);
writer.indent();
- for (Iterator<TestModel> stream = this.children(); stream.hasNext(); ) {
- stream.next().dumpOn(writer);
+ for (TestModel child : this.children) {
+ child.dumpOn(writer);
}
writer.undent();
}
@@ -402,7 +385,7 @@ public class TreeModelAdapterTests extends TestCase {
@Override
public String toString() {
- return "TestModel(" + this.name + ")";
+ return StringTools.buildToStringFor(this, this.name);
}
}
@@ -415,18 +398,18 @@ public class TreeModelAdapterTests extends TestCase {
* TestModel's children into a ListValueModel of Nodes whose order is
* determined by subclass implementations.
*/
- public static abstract class TestNode extends AbstractTreeNodeValueModel implements Displayable {
+ public static abstract class TestNode extends AbstractTreeNodeValueModel<Object> implements Displayable {
/** the model object wrapped by this node */
- private TestModel testModel;
+ private final TestModel testModel;
/** this node's parent node; null for the root node */
- private TestNode parent;
+ private final TestNode parent;
/** this node's child nodes */
- private ListValueModel childrenModel;
+ private final ListValueModel<TreeNodeValueModel<Object>> childrenModel;
/** a listener that notifies us when the model object's "internal state" changes */
- private PropertyChangeListener testModelListener;
+ private final PropertyChangeListener testModelListener;
- // ********** constructors **********
+ // ********** constructors/initialization **********
/**
* root node constructor
@@ -440,15 +423,9 @@ public class TreeModelAdapterTests extends TestCase {
*/
public TestNode(TestNode parent, TestModel testModel) {
super();
- this.initialize(parent, testModel);
- }
-
-
- // ********** initialization **********
-
- @Override
- protected void initialize() {
- super.initialize();
+ this.parent = parent;
+ this.testModel = testModel;
+ this.childrenModel = this.buildChildrenModel(testModel);
this.testModelListener = this.buildTestModelListener();
}
@@ -460,26 +437,20 @@ public class TreeModelAdapterTests extends TestCase {
};
}
- protected void initialize(TestNode p, TestModel tm) {
- this.parent = p;
- this.testModel = tm;
- this.childrenModel = this.buildChildrenModel(tm);
- }
-
/**
* subclasses decide the order of the child nodes
*/
- protected abstract ListValueModel buildChildrenModel(TestModel model);
+ protected abstract ListValueModel<TreeNodeValueModel<Object>> buildChildrenModel(TestModel model);
/**
* used by subclasses;
* transform the test model children into nodes
*/
- protected ListValueModel buildNodeAdapter(TestModel model) {
- return new TransformationListValueModelAdapter(this.buildChildrenAdapter(model)) {
+ protected ListValueModel<TreeNodeValueModel<Object>> buildNodeAdapter(TestModel model) {
+ return new TransformationListValueModelAdapter<TestModel, TreeNodeValueModel<Object>>(this.buildChildrenAdapter(model)) {
@Override
- protected Object transformItem(Object item) {
- return TestNode.this.buildChildNode((TestModel) item);
+ protected TestNode transformItem(TestModel item) {
+ return TestNode.this.buildChildNode(item);
}
};
}
@@ -492,15 +463,15 @@ public class TreeModelAdapterTests extends TestCase {
/**
* return a collection value model on the specified model's children
*/
- protected CollectionValueModel buildChildrenAdapter(TestModel model) {
- return new CollectionAspectAdapter(TestModel.CHILDREN_COLLECTION, model) {
+ protected CollectionValueModel<TestModel> buildChildrenAdapter(TestModel model) {
+ return new CollectionAspectAdapter<TestModel, TestModel>(TestModel.CHILDREN_COLLECTION, model) {
@Override
- protected Iterator iterator_() {
- return ((TestModel) this.subject).children();
+ protected Iterator<TestModel> iterator_() {
+ return this.subject.children();
}
@Override
protected int size_() {
- return ((TestModel) this.subject).childrenSize();
+ return this.subject.childrenSize();
}
};
}
@@ -508,25 +479,15 @@ public class TreeModelAdapterTests extends TestCase {
// ********** TreeNodeValueModel implementation **********
- public Object value() {
+ public TestModel value() {
return this.testModel;
}
- /**
- * this will probably never be called...
- */
- @Override
- public void setValue(Object value) {
- Object old = this.testModel;
- this.testModel = (TestModel) value;
- this.firePropertyChanged(VALUE, old, this.testModel);
- }
-
- public TreeNodeValueModel parent() {
+ public TreeNodeValueModel<Object> parent() {
return this.parent;
}
- public ListValueModel childrenModel() {
+ public ListValueModel<TreeNodeValueModel<Object>> childrenModel() {
return this.childrenModel;
}
@@ -567,7 +528,8 @@ public class TreeModelAdapterTests extends TestCase {
public void dumpOn(IndentingPrintWriter writer) {
writer.println(this);
writer.indent();
- for (Iterator stream = this.childrenModel.iterator(); stream.hasNext(); ) {
+ for (Iterator<TreeNodeValueModel<Object>> stream = this.childrenModel.iterator(); stream.hasNext(); ) {
+ // cast to a TestNode (i.e. this won't work with a NameTestNode in the tree)
((TestNode) stream.next()).dumpOn(writer);
}
writer.undent();
@@ -607,10 +569,12 @@ public class TreeModelAdapterTests extends TestCase {
* testing convenience method
*/
public TestNode childNamed(String name) {
- for (Iterator stream = this.childrenModel.iterator(); stream.hasNext(); ) {
- TestNode childNode = (TestNode) stream.next();
- if (childNode.getTestModel().getName().equals(name)) {
- return childNode;
+ for (Iterator<TreeNodeValueModel<Object>> stream = this.childrenModel.iterator(); stream.hasNext(); ) {
+ TreeNodeValueModel<Object> childNode = stream.next();
+ if (childNode instanceof TestNode) {
+ if (((TestNode) childNode).getTestModel().getName().equals(name)) {
+ return (TestNode) childNode;
+ }
}
}
throw new IllegalArgumentException("child not found: " + name);
@@ -649,12 +613,12 @@ public class TreeModelAdapterTests extends TestCase {
// ********** initialization **********
/** the list should be sorted */
@Override
- protected ListValueModel buildChildrenModel(TestModel testModel) {
- return new SortedListValueModelAdapter(this.buildDisplayStringAdapter(testModel));
+ protected ListValueModel<TreeNodeValueModel<Object>> buildChildrenModel(TestModel testModel) {
+ return new SortedListValueModelAdapter<TreeNodeValueModel<Object>>(this.buildDisplayStringAdapter(testModel));
}
/** the display string (name) of each node can change */
- protected ListValueModel buildDisplayStringAdapter(TestModel testModel) {
- return new ItemPropertyListValueModelAdapter(this.buildNodeAdapter(testModel), DISPLAY_STRING_PROPERTY);
+ protected ListValueModel<TreeNodeValueModel<Object>> buildDisplayStringAdapter(TestModel testModel) {
+ return new ItemPropertyListValueModelAdapter<TreeNodeValueModel<Object>>(this.buildNodeAdapter(testModel), DISPLAY_STRING_PROPERTY);
}
/** children are also sorted nodes */
@Override
@@ -681,7 +645,7 @@ public class TreeModelAdapterTests extends TestCase {
// ********** initialization **********
/** the list should NOT be sorted */
@Override
- protected ListValueModel buildChildrenModel(TestModel testModel) {
+ protected ListValueModel<TreeNodeValueModel<Object>> buildChildrenModel(TestModel testModel) {
return this.buildNodeAdapter(testModel);
}
/** children are also unsorted nodes */
@@ -710,16 +674,16 @@ public class TreeModelAdapterTests extends TestCase {
// ********** initialization **********
/** return a different list of children for "node 3" */
@Override
- protected ListValueModel buildChildrenModel(TestModel testModel) {
+ protected ListValueModel<TreeNodeValueModel<Object>> buildChildrenModel(TestModel testModel) {
if (testModel.getName().equals("node 3")) {
return this.buildSpecialChildrenModel(testModel);
}
return super.buildChildrenModel(testModel);
}
- protected ListValueModel buildSpecialChildrenModel(TestModel testModel) {
- Object[] children = new Object[1];
+ protected ListValueModel<TreeNodeValueModel<Object>> buildSpecialChildrenModel(TestModel testModel) {
+ TreeNodeValueModel<Object>[] children = new NameTestNode[1];
children[0] = new NameTestNode(this);
- return new SimpleListValueModel(Arrays.asList(children));
+ return new SimpleListValueModel<TreeNodeValueModel<Object>>(Arrays.asList(children));
}
/** children are also special nodes */
@Override
@@ -730,21 +694,20 @@ public class TreeModelAdapterTests extends TestCase {
}
- public static class NameTestNode extends AbstractTreeNodeValueModel {
- private PropertyValueModel nameAdapter;
- private SpecialTestNode specialNode; // parent node
- private PropertyChangeListener nameListener;
+ public static class NameTestNode extends AbstractTreeNodeValueModel<Object> {
+ private final WritablePropertyValueModel<String> nameAdapter;
+ private final SpecialTestNode specialNode; // parent node
+ private final PropertyChangeListener nameListener;
+ private final ListValueModel<TreeNodeValueModel<Object>> childrenModel;
// ********** construction/initialization **********
public NameTestNode(SpecialTestNode specialNode) {
super();
- this.initialize(specialNode);
- }
- @Override
- protected void initialize() {
- super.initialize();
this.nameListener = this.buildNameListener();
+ this.specialNode = specialNode;
+ this.nameAdapter = this.buildNameAdapter();
+ this.childrenModel = new NullListValueModel<TreeNodeValueModel<Object>>();
}
protected PropertyChangeListener buildNameListener() {
return new PropertyChangeListener() {
@@ -753,20 +716,15 @@ public class TreeModelAdapterTests extends TestCase {
}
};
}
- protected void initialize(SpecialTestNode node) {
- this.specialNode = node;
- this.nameAdapter = this.buildNameAdapter();
- }
-
- protected PropertyValueModel buildNameAdapter() {
- return new PropertyAspectAdapter(TestModel.NAME_PROPERTY, this.getTestModel()) {
+ protected WritablePropertyValueModel<String> buildNameAdapter() {
+ return new PropertyAspectAdapter<TestModel, String>(TestModel.NAME_PROPERTY, this.getTestModel()) {
@Override
- protected Object buildValue_() {
- return ((TestModel) this.subject).getName();
+ protected String buildValue_() {
+ return this.subject.getName();
}
@Override
- protected void setValue_(Object value) {
- ((TestModel) this.subject).setName((String) value);
+ protected void setValue_(String value) {
+ this.subject.setName(value);
}
};
}
@@ -777,29 +735,29 @@ public class TreeModelAdapterTests extends TestCase {
// ********** TreeNodeValueModel implementation **********
- public Object value() {
+ public String value() {
return this.nameAdapter.value();
}
@Override
public void setValue(Object value) {
- this.nameAdapter.setValue(value);
+ this.nameAdapter.setValue((String) value);
}
- public TreeNodeValueModel parent() {
+ public TreeNodeValueModel<Object> parent() {
return this.specialNode;
}
- public ListValueModel childrenModel() {
- return NullListValueModel.instance();
+ public ListValueModel<TreeNodeValueModel<Object>> childrenModel() {
+ return this.childrenModel;
}
// ********** AbstractTreeNodeValueModel implementation **********
@Override
protected void engageValue() {
- this.nameAdapter.addPropertyChangeListener(ValueModel.VALUE, this.nameListener);
+ this.nameAdapter.addPropertyChangeListener(PropertyValueModel.VALUE, this.nameListener);
}
@Override
protected void disengageValue() {
- this.nameAdapter.removePropertyChangeListener(ValueModel.VALUE, this.nameListener);
+ this.nameAdapter.removePropertyChangeListener(PropertyValueModel.VALUE, this.nameListener);
}
// ********** behavior **********
@@ -810,12 +768,12 @@ public class TreeModelAdapterTests extends TestCase {
}
}
- private TreeModel buildTreeModel(TreeNodeValueModel root) {
- return this.buildTreeModel(new ReadOnlyPropertyValueModel(root));
+ private TreeModel buildTreeModel(TestNode root) {
+ return this.buildTreeModel(new StaticPropertyValueModel<TreeNodeValueModel<Object>>(root));
}
- private TreeModel buildTreeModel(PropertyValueModel rootHolder) {
- return new TreeModelAdapter(rootHolder) {
+ private TreeModel buildTreeModel(PropertyValueModel<TreeNodeValueModel<Object>> rootHolder) {
+ return new TreeModelAdapter<Object>(rootHolder) {
@Override
protected ListChangeListener buildChildrenListener() {
return this.buildChildrenListener_();
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TreeModelAdapterUITest.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TreeModelAdapterUITest.java
index 70420d6be3..d675eaef86 100644
--- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TreeModelAdapterUITest.java
+++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TreeModelAdapterUITest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2008 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.
@@ -20,7 +20,6 @@ import java.awt.event.WindowListener;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
-import java.util.Iterator;
import javax.swing.AbstractAction;
import javax.swing.Action;
@@ -39,8 +38,9 @@ import javax.swing.tree.TreeSelectionModel;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterators.EnumerationIterator;
-import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel;
+import org.eclipse.jpt.utility.internal.model.value.TreeNodeValueModel;
+import org.eclipse.jpt.utility.internal.model.value.WritablePropertyValueModel;
import org.eclipse.jpt.utility.internal.model.value.swing.TreeModelAdapter;
import org.eclipse.jpt.utility.internal.swing.Displayable;
import org.eclipse.jpt.utility.tests.internal.model.value.swing.TreeModelAdapterTests.SortedTestNode;
@@ -55,7 +55,7 @@ public class TreeModelAdapterUITest {
// hold the tree so we can restore its expansion state
private JTree tree;
- private PropertyValueModel rootNodeHolder;
+ private WritablePropertyValueModel<TreeNodeValueModel<Object>> rootNodeHolder;
private boolean sorted;
private TreeModel treeModel;
private TreeSelectionModel treeSelectionModel;
@@ -78,8 +78,8 @@ public class TreeModelAdapterUITest {
this.openWindow();
}
- private PropertyValueModel buildRootNodeHolder() {
- return new SimplePropertyValueModel(this.buildSortedRootNode());
+ private WritablePropertyValueModel<TreeNodeValueModel<Object>> buildRootNodeHolder() {
+ return new SimplePropertyValueModel<TreeNodeValueModel<Object>>(this.buildSortedRootNode());
}
private TestNode buildSortedRootNode() {
@@ -116,7 +116,7 @@ public class TreeModelAdapterUITest {
}
private TreeModel buildTreeModel() {
- return new TreeModelAdapter(this.rootNodeHolder);
+ return new TreeModelAdapter<Object>(this.rootNodeHolder);
}
private TreeSelectionModel buildTreeSelectionModel() {
@@ -226,7 +226,7 @@ public class TreeModelAdapterUITest {
if (this.treeSelectionModel.isSelectionEmpty()) {
return null;
}
- return (TestModel) this.selectedNode().value();
+ return this.selectedNode().value();
}
private TestNode rootNode() {
@@ -234,15 +234,15 @@ public class TreeModelAdapterUITest {
}
private TestModel root() {
- return (TestModel) this.rootNode().value();
+ return this.rootNode().value();
}
- private Collection expandedPaths() {
- Enumeration stream = this.tree.getExpandedDescendants(new TreePath(this.rootNode()));
+ private Collection<TreePath> expandedPaths() {
+ Enumeration<TreePath> stream = this.tree.getExpandedDescendants(new TreePath(this.rootNode()));
if (stream == null) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
- return CollectionTools.list(new EnumerationIterator(stream));
+ return CollectionTools.list(new EnumerationIterator<TreePath>(stream));
}
// ********** behavior **********
@@ -250,9 +250,9 @@ public class TreeModelAdapterUITest {
this.treeSelectionModel.setSelectionPath(new TreePath(selectedNode.path()));
}
- private void expandPaths(Collection paths) {
- for (Iterator stream = paths.iterator(); stream.hasNext(); ) {
- this.tree.expandPath((TreePath) stream.next());
+ private void expandPaths(Collection<TreePath> paths) {
+ for (TreePath path : paths) {
+ this.tree.expandPath(path);
}
}
@@ -280,7 +280,7 @@ public class TreeModelAdapterUITest {
if (selectedTestModel != null) {
String name = this.getName();
// save the expansion state and restore it after the add
- Collection paths = this.expandedPaths();
+ Collection<TreePath> paths = this.expandedPaths();
selectedTestModel.addChild(name);
@@ -360,7 +360,7 @@ public class TreeModelAdapterUITest {
// save the node and re-select it after the rename
TestNode selectedNode = this.selectedNode();
// save the expansion state and restore it after the rename
- Collection paths = this.expandedPaths();
+ Collection<TreePath> paths = this.expandedPaths();
selectedTestModel.setName(this.getName());

Back to the top